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

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

/// Divider 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 {Color} $color [null] - The color of the divider. (Gradients are not supported for dashed dividers).
/// @param {number} $inset [null] - The inset value of the divider.
/// @requires $light-material-schema
/// @example scss - Change the color of the divider
///   $my-divider-theme: divider-theme($color: orange);
///   // Pass the theme to the css-vars() mixin
///   @include css-vars($my-divider-theme);
@function divider-theme($schema: $light-material-schema, $color: null, $inset: null) {
    $selector: #{config.element-prefix() + '-' + 'divider'};
    $divider-schema: ();

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

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

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