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

////
/// @package theming
/// @group themes
/// @access public
/// @author <a href="https://github.com/simeonoff" target="_blank">Simeon Simeonoff</a>
////

/// Label Theme
///
/// This theme has no automatic token derivation. All tokens are independent.
///
/// @param {Map} $schema [$light-material-schema] - The schema used as basis for styling the component.
/// @param {Map} $color [null] - The text color.
/// @param {Map} $disabled-color [null] - The disabled text color.
@function label-theme($schema: $light-material-schema, $color: null, $disabled-color: null) {
    $selector: (#{config.element-prefix() + '-' + 'label'}, #{'[' + config.element-prefix() + 'Label]'});
    $label-schema: ();

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

    $theme: digest-schema($label-schema);

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