@use 'sass:map';
@use '../../config';
@use '../../functions' as *;
@use '../../schemas/' as *;
@use '../../../utils/map' as *;

////
/// @package theming
/// @group themes
/// @access public
/// @author <a href="https://github.com/desig9stein" target="_blank">Marin Popov</a>
////

/// Date Range Picker Theme
///
/// NOTE: This component has no automatic token derivation.
/// All tokens are directly passed to the schema without calculations.
///
/// @param {Map} $schema [$light-material-schema] - The schema used as basis for styling the component.
/// @param {color} $label-color [null] - The color for date range separator label.
@function date-range-picker-theme($schema: $light-material-schema, $label-color: null) {
    $selector: #{config.element-prefix() + '-' + 'date-range-picker'};
    $date-range-schema: ();

    @if map.has-key($schema, 'date-range') {
        $date-range-schema: map.get($schema, 'date-range');
    } @else {
        $date-range-schema: $schema;
    }

    $theme: digest-schema($date-range-schema);

    @return extend(
        $theme,
        (
            selector: $selector,
            label-color: $label-color,
        )
    );
}
