/**
 * @license
 * Copyright Tyler Technologies, Inc. 
 * License: Apache-2.0
 */
@use 'sass:map';
@use '../../../animation';
@use '../../../border';
@use '../../../shape';
@use '../../../spacing';
@use '../../../theme';
@use '../../../utils';
@use '../../button/tokens' as button;

$tokens: (
  // Base
  display: utils.module-val(button-toggle, display, inline-flex),
  min-width: utils.module-val(button-toggle, min-width, auto),
  spacing: utils.module-val(button-toggle, spacing, spacing.variable(xsmall)),
  padding-block: utils.module-val(button-toggle, padding-block, 2px),
  padding-inline: utils.module-val(button-toggle, padding-inline, 8px),
  icon-size: utils.module-val(button-toggle, icon-size, button.get(icon-size)),
  
  // Theme
  color: utils.module-val(button-toggle, color, theme.variable(text-medium)),
  background: utils.module-val(button-toggle, background, transparent),
  hover-background: utils.module-ref(button-toggle, hover-background, background),
  active-background: utils.module-ref(button-toggle, active-background, background),
  cursor: utils.module-val(button-toggle, cursor, pointer),

  // Border
  border-width: utils.module-val(button-toggle, border-width, medium),
  border-style: utils.module-val(button-toggle, border-style, none),
  border-color: utils.module-val(button-toggle, border-color, theme.variable(outline-medium)),

  // Shape
  shape: utils.module-val(button-toggle, shape, shape.variable(small)),
  shape-start-start: utils.module-ref(button-toggle, shape-start-start, shape),
  shape-start-end: utils.module-ref(button-toggle, shape-start-end, shape),
  shape-end-start: utils.module-ref(button-toggle, shape-end-start, shape),
  shape-end-end: utils.module-ref(button-toggle, shape-end-end, shape),

  // Selected
  selected-background: utils.module-val(button-toggle, selected-background, theme.variable(tertiary-container)),
  selected-color: utils.module-val(button-toggle, selected-color, theme.variable(on-tertiary-container)),
  selected-disabled-background: utils.module-val(button-toggle, selected-disabled-background, theme.variable(surface-container)),

  // Dense
  dense-height: utils.module-val(button-toggle, dense-height, 24px),

  // Disabled
  disabled-opacity: utils.module-val(button-toggle, disabled-opacity, theme.emphasis(medium-low)),
  disabled-cursor: utils.module-val(button-toggle, disabled-cursor, not-allowed),
  disabled-color: utils.module-val(button-toggle, disabled-color, theme.variable(text-low)),
  disabled-background: utils.module-val(button-toggle, disabled-background, transparent),

  // Animation
  transition-duration: utils.module-val(button-toggle, transition-duration, animation.variable(duration-short3)),
  transition-timing: utils.module-val(button-toggle, transition-timing, animation.variable(easing-standard)),

  // Focus indicator
  focus-indicator-color: utils.module-val(button-toggle, focus-indicator-color, theme.variable(primary)),
  focus-indicator-offset: utils.module-val(button-toggle, focus-indicator-offset, 0px) // Requires unit
) !default;

@function get($key) {
  @return map.get($tokens, $key);
}
