@uva-glass/component-library 3.43.1 → 3.44.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/dist/SelectListbox.module-CAKDuwcy.js +28 -0
  2. package/dist/SelectListbox.module-CAKDuwcy.js.map +1 -0
  3. package/dist/assets/CheckboxButtonBar.css +1 -1
  4. package/dist/assets/SelectListbox.css +1 -1
  5. package/dist/components/Buttons/Button.stories.js +1 -1
  6. package/dist/components/Buttons/LinkButton.stories.js +1 -1
  7. package/dist/components/Buttons/MenuButton.stories.js +1 -1
  8. package/dist/components/Checkbox/Checkbox.stories.js +1 -1
  9. package/dist/components/CheckboxButtonBar/CheckboxButtonBar.d.ts +4 -2
  10. package/dist/components/CheckboxButtonBar/CheckboxButtonBar.js +95 -64
  11. package/dist/components/CheckboxButtonBar/CheckboxButtonBar.js.map +1 -1
  12. package/dist/components/CheckboxButtonBar/CheckboxButtonBar.stories.d.ts +4 -3
  13. package/dist/components/CheckboxButtonBar/CheckboxButtonBar.stories.js +61 -26
  14. package/dist/components/CheckboxButtonBar/CheckboxButtonBar.stories.js.map +1 -1
  15. package/dist/components/CheckboxTree/CheckboxTree.stories.js +2 -2
  16. package/dist/components/Chip/Chip.stories.js +1 -1
  17. package/dist/components/ControlsButton/ControlsButton.d.ts +1 -1
  18. package/dist/components/ControlsButton/ControlsButton.js +27 -27
  19. package/dist/components/ControlsButton/ControlsButton.js.map +1 -1
  20. package/dist/components/ControlsButton/ControlsButton.stories.d.ts +1 -0
  21. package/dist/components/ControlsButton/ControlsButton.stories.js +70 -25
  22. package/dist/components/ControlsButton/ControlsButton.stories.js.map +1 -1
  23. package/dist/components/Drawer/Drawer.stories.js +1 -1
  24. package/dist/components/FormInput/FormInput.stories.js +1 -1
  25. package/dist/components/IconButton/IconButton.stories.js +1 -1
  26. package/dist/components/InputField/InputField.stories.js +1 -1
  27. package/dist/components/ModalDialog/ModalDialog.stories.js +1 -1
  28. package/dist/components/MultiSelect/MultiSelect.stories.js +1 -1
  29. package/dist/components/MultiSelectBox/MultiSelectBox.stories.js +1 -1
  30. package/dist/components/Notification/Notification.stories.js +1 -1
  31. package/dist/components/OverlayCloseButton/OverlayCloseButton.stories.js +1 -1
  32. package/dist/components/PeriodSelector/PeriodSelector.stories.js +1 -1
  33. package/dist/components/RadioGroup/RadioGroup.stories.js +1 -1
  34. package/dist/components/RadioTabSelector/RadioTabSelector.stories.js +1 -1
  35. package/dist/components/SelectListbox/SelectListBox.stories.js +6 -6
  36. package/dist/components/SelectListbox/SelectListBox.stories.js.map +1 -1
  37. package/dist/components/SelectListbox/SelectListbox.d.ts +1 -1
  38. package/dist/components/SelectListbox/SelectListbox.js.map +1 -1
  39. package/dist/components/SelectListbox/components/SelectButton.d.ts +1 -1
  40. package/dist/components/SelectListbox/components/SelectButton.js +1 -1
  41. package/dist/components/SelectListbox/components/SelectButton.js.map +1 -1
  42. package/dist/components/SelectListbox/components/SelectContainer.js +1 -1
  43. package/dist/components/SelectListbox/components/SelectOption.js +1 -1
  44. package/dist/components/SelectListbox/components/SelectOptionBox.js +1 -1
  45. package/dist/components/Sortable/Sortable.stories.js +1 -1
  46. package/dist/components/TextArea/TextArea.stories.js +1 -1
  47. package/dist/components/TextArea/TextArea.test.js +1 -1
  48. package/dist/components/ToggleSwitch/ToggleSwitch.stories.js +1 -1
  49. package/dist/components/VarIndicator/VarIndicator.stories.js +1 -1
  50. package/dist/{index-BVrrnUn0.js → index-BfMTX2kB.js} +6 -3
  51. package/dist/index-BfMTX2kB.js.map +1 -0
  52. package/dist/{index-BamlKH-k.js → index-DvUwfXNb.js} +3 -2
  53. package/dist/{index-BamlKH-k.js.map → index-DvUwfXNb.js.map} +1 -1
  54. package/dist/storybook__react.d.js +3 -3
  55. package/package.json +10 -10
  56. package/dist/SelectListbox.module-yzXaWwsm.js +0 -26
  57. package/dist/SelectListbox.module-yzXaWwsm.js.map +0 -1
  58. package/dist/index-BVrrnUn0.js.map +0 -1
@@ -15,7 +15,7 @@ export interface SelectListboxProps {
15
15
  /** `true` to render the labels in bold; otherwise, `false`. The default is `false`. */
16
16
  buttonLabelBold?: boolean;
17
17
  /** The variant of the select box. */
18
- variant?: 'noborder' | 'pill' | 'pillLeft' | 'pillRight' | 'darkBorder';
18
+ variant?: 'noborder' | 'pill' | 'pillLeft' | 'pillRight' | 'darkBorder' | 'roundedLeft' | 'roundedRight';
19
19
  /** If true sets the option dropdown min-width to the width of the select button. */
20
20
  fullWidth?: boolean;
21
21
  /** The size of the select box. */
@@ -1 +1 @@
1
- {"version":3,"file":"SelectListbox.js","sources":["../../../src/components/SelectListbox/SelectListbox.tsx"],"sourcesContent":["import { Children, cloneElement, isValidElement, useState } from 'react';\n\nimport type { PropsWithChildren } from 'react';\nimport type { OptionValue, SelectValue } from './SelectProvider';\nimport type { SelectOptionProps } from './components/SelectOption';\n\nimport { SelectProvider } from './SelectProvider';\nimport { SelectButton } from './components/SelectButton';\nimport { SelectContainer } from './components/SelectContainer';\nimport { SelectOptionBox } from './components/SelectOptionBox';\nimport { SelectOption } from './components/SelectOption';\n\nimport { usePositionedFloaters } from 'components/hooks/usePositionedFloaters';\n\nexport interface SelectListboxProps {\n /** The possible options to select. */\n options: OptionValue[];\n /** The selected value by default. */\n defaultValue?: SelectValue;\n /** The max height of the options. */\n maxOptionHeight?: `${number}${'px' | 'rem'}`;\n /** `true` to disable the select box; otherwise, `false`. The default is `false`. */\n disabled?: boolean;\n /** The name of the property in the options structure that contains the label of the options. */\n buttonLabelProp?: string;\n /** `true` to render the labels in bold; otherwise, `false`. The default is `false`. */\n buttonLabelBold?: boolean;\n /** The variant of the select box. */\n variant?: 'noborder' | 'pill' | 'pillLeft' | 'pillRight' | 'darkBorder';\n /** If true sets the option dropdown min-width to the width of the select button. */\n fullWidth?: boolean;\n /** The size of the select box. */\n size?: 'small' | 'medium' | 'default';\n /** `true` to align the right side of the options with the select box; otherwise, `false` to align on the left side. */\n optionPositionRight?: boolean;\n /** The breakpoint at which to switch to the mobile view. */\n mobileBreakpoint?: `${number}${'px' | 'rem'}`;\n /** The callback function that is invoked when an option is selected. */\n onChange?: (option: OptionValue) => void;\n /** Option to add a devider after a given amout of ouptions in the select option box. */\n dividerAfter?: number;\n}\n\n/** Represents a component to render a select list box. */\nexport const SelectListbox = ({\n options,\n variant,\n fullWidth = false,\n size = 'default',\n optionPositionRight,\n defaultValue = -1,\n maxOptionHeight,\n disabled,\n buttonLabelProp = 'label',\n buttonLabelBold,\n onChange,\n dividerAfter,\n children,\n}: PropsWithChildren<SelectListboxProps>) => {\n const [positionElement, setPositionElement] = useState<HTMLElement | null>(null);\n const [referenceElement, setReferenceElement] = useState<HTMLElement | null>(null);\n const { style: positionStyle } = usePositionedFloaters(positionElement, referenceElement, {\n mouseEvent: 'click',\n position: 'bottomLeft',\n offset: 4,\n maxFixedHeight: maxOptionHeight,\n horizontalPosition: optionPositionRight ? 'right' : 'left',\n mobileBreakpoint: '28rem',\n fullWidth,\n });\n\n return (\n <SelectProvider options={options} defaultValue={defaultValue}>\n <SelectContainer>\n <SelectButton\n disabled={disabled}\n buttonLabelProp={buttonLabelProp}\n buttonLabelBold={buttonLabelBold}\n variant={variant}\n size={size}\n onChange={onChange}\n ref={setReferenceElement}\n />\n\n <SelectOptionBox ref={setPositionElement} {...positionStyle}>\n {Children.map(children, (child, index) => {\n if (isValidElement<SelectOptionProps>(child)) {\n return cloneElement(child, {\n dividerAfter,\n key: index,\n });\n }\n return child;\n })}\n </SelectOptionBox>\n </SelectContainer>\n </SelectProvider>\n );\n};\n\nSelectListbox.SelectOption = SelectOption;\n"],"names":["SelectListbox","options","variant","fullWidth","size","optionPositionRight","defaultValue","maxOptionHeight","disabled","buttonLabelProp","buttonLabelBold","onChange","dividerAfter","children","positionElement","setPositionElement","useState","referenceElement","setReferenceElement","positionStyle","usePositionedFloaters","jsx","SelectProvider","SelectContainer","SelectButton","SelectOptionBox","Children","child","index","isValidElement","cloneElement","SelectOption"],"m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"file":"SelectListbox.js","sources":["../../../src/components/SelectListbox/SelectListbox.tsx"],"sourcesContent":["import { Children, cloneElement, isValidElement, useState } from 'react';\n\nimport type { PropsWithChildren } from 'react';\nimport type { OptionValue, SelectValue } from './SelectProvider';\nimport type { SelectOptionProps } from './components/SelectOption';\n\nimport { SelectProvider } from './SelectProvider';\nimport { SelectButton } from './components/SelectButton';\nimport { SelectContainer } from './components/SelectContainer';\nimport { SelectOptionBox } from './components/SelectOptionBox';\nimport { SelectOption } from './components/SelectOption';\n\nimport { usePositionedFloaters } from 'components/hooks/usePositionedFloaters';\n\nexport interface SelectListboxProps {\n /** The possible options to select. */\n options: OptionValue[];\n /** The selected value by default. */\n defaultValue?: SelectValue;\n /** The max height of the options. */\n maxOptionHeight?: `${number}${'px' | 'rem'}`;\n /** `true` to disable the select box; otherwise, `false`. The default is `false`. */\n disabled?: boolean;\n /** The name of the property in the options structure that contains the label of the options. */\n buttonLabelProp?: string;\n /** `true` to render the labels in bold; otherwise, `false`. The default is `false`. */\n buttonLabelBold?: boolean;\n /** The variant of the select box. */\n variant?: 'noborder' | 'pill' | 'pillLeft' | 'pillRight' | 'darkBorder' | 'roundedLeft' | 'roundedRight';\n /** If true sets the option dropdown min-width to the width of the select button. */\n fullWidth?: boolean;\n /** The size of the select box. */\n size?: 'small' | 'medium' | 'default';\n /** `true` to align the right side of the options with the select box; otherwise, `false` to align on the left side. */\n optionPositionRight?: boolean;\n /** The breakpoint at which to switch to the mobile view. */\n mobileBreakpoint?: `${number}${'px' | 'rem'}`;\n /** The callback function that is invoked when an option is selected. */\n onChange?: (option: OptionValue) => void;\n /** Option to add a devider after a given amout of ouptions in the select option box. */\n dividerAfter?: number;\n}\n\n/** Represents a component to render a select list box. */\nexport const SelectListbox = ({\n options,\n variant,\n fullWidth = false,\n size = 'default',\n optionPositionRight,\n defaultValue = -1,\n maxOptionHeight,\n disabled,\n buttonLabelProp = 'label',\n buttonLabelBold,\n onChange,\n dividerAfter,\n children,\n}: PropsWithChildren<SelectListboxProps>) => {\n const [positionElement, setPositionElement] = useState<HTMLElement | null>(null);\n const [referenceElement, setReferenceElement] = useState<HTMLElement | null>(null);\n const { style: positionStyle } = usePositionedFloaters(positionElement, referenceElement, {\n mouseEvent: 'click',\n position: 'bottomLeft',\n offset: 4,\n maxFixedHeight: maxOptionHeight,\n horizontalPosition: optionPositionRight ? 'right' : 'left',\n mobileBreakpoint: '28rem',\n fullWidth,\n });\n\n return (\n <SelectProvider options={options} defaultValue={defaultValue}>\n <SelectContainer>\n <SelectButton\n disabled={disabled}\n buttonLabelProp={buttonLabelProp}\n buttonLabelBold={buttonLabelBold}\n variant={variant}\n size={size}\n onChange={onChange}\n ref={setReferenceElement}\n />\n\n <SelectOptionBox ref={setPositionElement} {...positionStyle}>\n {Children.map(children, (child, index) => {\n if (isValidElement<SelectOptionProps>(child)) {\n return cloneElement(child, {\n dividerAfter,\n key: index,\n });\n }\n return child;\n })}\n </SelectOptionBox>\n </SelectContainer>\n </SelectProvider>\n );\n};\n\nSelectListbox.SelectOption = SelectOption;\n"],"names":["SelectListbox","options","variant","fullWidth","size","optionPositionRight","defaultValue","maxOptionHeight","disabled","buttonLabelProp","buttonLabelBold","onChange","dividerAfter","children","positionElement","setPositionElement","useState","referenceElement","setReferenceElement","positionStyle","usePositionedFloaters","jsx","SelectProvider","SelectContainer","SelectButton","SelectOptionBox","Children","child","index","isValidElement","cloneElement","SelectOption"],"mappings":";;;;;;;;AA4CO,MAAMA,IAAgB,CAAC;AAAA,EAC5B,SAAAC;AAAA,EACA,SAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,MAAAC,IAAO;AAAA,EACP,qBAAAC;AAAA,EACA,cAAAC,IAAe;AAAA,EACf,iBAAAC;AAAA,EACA,UAAAC;AAAA,EACA,iBAAAC,IAAkB;AAAA,EAClB,iBAAAC;AAAA,EACA,UAAAC;AAAA,EACA,cAAAC;AAAA,EACA,UAAAC;AACF,MAA6C;AAC3C,QAAM,CAACC,GAAiBC,CAAkB,IAAIC,EAA6B,IAAI,GACzE,CAACC,GAAkBC,CAAmB,IAAIF,EAA6B,IAAI,GAC3E,EAAE,OAAOG,EAAA,IAAkBC,EAAsBN,GAAiBG,GAAkB;AAAA,IACxF,YAAY;AAAA,IAEZ,QAAQ;AAAA,IACR,gBAAgBV;AAAA,IAChB,oBAAoBF,IAAsB,UAAU;AAAA,IACpD,kBAAkB;AAAA,IAClB,WAAAF;AAAA,EAAA,CACD;AAED,SACE,gBAAAkB,EAACC,GAAA,EAAe,SAAArB,GAAkB,cAAAK,GAChC,4BAACiB,GAAA,EACC,UAAA;AAAA,IAAA,gBAAAF;AAAA,MAACG;AAAA,MAAA;AAAA,QACC,UAAAhB;AAAA,QACA,iBAAAC;AAAA,QACA,iBAAAC;AAAA,QACA,SAAAR;AAAA,QACA,MAAAE;AAAA,QACA,UAAAO;AAAA,QACA,KAAKO;AAAA,MAAA;AAAA,IAAA;AAAA,IAGP,gBAAAG,EAACI,GAAA,EAAgB,KAAKV,GAAqB,GAAGI,GAC3C,UAAAO,EAAS,IAAIb,GAAU,CAACc,GAAOC,MAC1BC,EAAkCF,CAAK,IAClCG,EAAaH,GAAO;AAAA,MACzB,cAAAf;AAAA,MACA,KAAKgB;AAAA,IAAA,CACN,IAEID,CACR,EAAA,CACH;AAAA,EAAA,EAAA,CACF,EAAA,CACF;AAEJ;AAEA3B,EAAc,eAAe+B;"}
@@ -1,6 +1,6 @@
1
1
  import { OptionValue } from 'components/SelectListbox/SelectProvider';
2
2
  export interface SelectButtonProps {
3
- variant?: 'noborder' | 'pill' | 'pillLeft' | 'pillRight' | 'darkBorder';
3
+ variant?: 'noborder' | 'pill' | 'pillLeft' | 'pillRight' | 'darkBorder' | 'roundedLeft' | 'roundedRight';
4
4
  size?: 'small' | 'medium' | 'default';
5
5
  onChange?: (option: OptionValue) => void;
6
6
  buttonLabelProp?: string;
@@ -1,7 +1,7 @@
1
1
  import { jsx as c, jsxs as K } from "react/jsx-runtime";
2
2
  import { c as m } from "../../../clsx-OuTLNxxd.js";
3
3
  import { forwardRef as N, useRef as h, useEffect as u } from "react";
4
- import { s as t } from "../../../SelectListbox.module-yzXaWwsm.js";
4
+ import { s as t } from "../../../SelectListbox.module-CAKDuwcy.js";
5
5
  import { Icon as R } from "../../Icon/Icon.js";
6
6
  import { useSelect as S } from "../SelectProvider.js";
7
7
  const O = N((y, b) => {
@@ -1 +1 @@
1
- {"version":3,"file":"SelectButton.js","sources":["../../../../src/components/SelectListbox/components/SelectButton.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useEffect, useRef, forwardRef } from 'react';\n\nimport type { KeyboardEvent } from 'react';\nimport type { OptionValue, SelectValue } from 'components/SelectListbox/SelectProvider';\n\nimport styles from 'components/SelectListbox/SelectListbox.module.css';\nimport { Icon } from 'components/Icon';\nimport { useSelect } from 'components/SelectListbox/SelectProvider';\n\nexport interface SelectButtonProps {\n variant?: 'noborder' | 'pill' | 'pillLeft' | 'pillRight' | 'darkBorder';\n size?: 'small' | 'medium' | 'default';\n onChange?: (option: OptionValue) => void;\n buttonLabelProp?: string;\n buttonLabelBold?: boolean;\n disabled?: boolean;\n}\n\nexport const SelectButton = forwardRef<HTMLButtonElement, SelectButtonProps>((props, ref) => {\n const { variant, size = 'default', onChange, buttonLabelProp = 'label', buttonLabelBold, disabled = false } = props;\n const buttonWrapper = useRef<HTMLSpanElement>(null);\n const isFirstRender = useRef(true);\n const { listboxId, isOpen, selectedValue, toggleListbox, setIsOpen, setActiveIndex, options } = useSelect() || {};\n\n const onTriggerKeyDown = (event: KeyboardEvent<HTMLButtonElement>) => {\n if (event.key.length === 1) {\n const key = event.key.toLocaleLowerCase();\n const optionIndexStartsWithKey = options.findIndex(\n (option) => !option.disabled && option.label.toLocaleLowerCase().startsWith(key)\n );\n if (optionIndexStartsWithKey !== -1) {\n setActiveIndex(optionIndexStartsWithKey);\n if (!isOpen) setIsOpen(true);\n event.preventDefault();\n return;\n }\n }\n\n switch (event.key) {\n case 'Enter':\n event.preventDefault();\n if (!isOpen) {\n setIsOpen(true);\n return;\n }\n break;\n case 'Escape':\n if (isOpen) {\n event.stopPropagation();\n setActiveIndex(options.findIndex((option) => option.value === selectedValue?.value));\n setIsOpen(false);\n }\n break;\n }\n };\n\n useEffect(() => {\n isOpen\n ? (buttonWrapper.current?.children[0] as HTMLButtonElement).blur()\n : !isFirstRender.current && (buttonWrapper.current?.children[0] as HTMLButtonElement).focus();\n }, [isOpen]);\n\n useEffect(() => {\n isFirstRender.current = false;\n\n return () => {\n isFirstRender.current = true;\n };\n }, []);\n\n useEffect(() => {\n if (onChange) onChange(selectedValue);\n }, [onChange, selectedValue]);\n\n return (\n <span ref={buttonWrapper}>\n <button\n className={clsx(styles['select-listbox-trigger'], styles[`select-listbox-trigger--${size}`], {\n [styles[`select-listbox-trigger--${variant}`]]: variant,\n [styles['select-listbox-trigger--bold']]: buttonLabelBold,\n })}\n type=\"button\"\n onClick={toggleListbox}\n onKeyDown={onTriggerKeyDown}\n aria-expanded={isOpen}\n aria-haspopup=\"listbox\"\n aria-label={`${selectedValue.label}`}\n disabled={disabled}\n aria-controls={listboxId}\n {...(ref && { ref: ref })}\n >\n <span className={styles['select-listbox-trigger-label']}>\n {selectedValue[buttonLabelProp as keyof SelectValue]}\n </span>\n\n <Icon\n className={clsx(styles['select-listbox-trigger-icon'], {\n [styles['select-listbox-trigger-icon--open']]: isOpen,\n })}\n name=\"CheveronDown\"\n size={16}\n />\n </button>\n </span>\n );\n});\n"],"names":["SelectButton","forwardRef","props","ref","variant","size","onChange","buttonLabelProp","buttonLabelBold","disabled","buttonWrapper","useRef","isFirstRender","listboxId","isOpen","selectedValue","toggleListbox","setIsOpen","setActiveIndex","options","useSelect","onTriggerKeyDown","event","key","optionIndexStartsWithKey","option","useEffect","jsx","jsxs","clsx","styles","Icon"],"mappings":";;;;;;AAmBO,MAAMA,IAAeC,EAAiD,CAACC,GAAOC,MAAQ;AAC3F,QAAM,EAAE,SAAAC,GAAS,MAA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AAM;AACd,IAAIpB,OAAmBS,CAAa;AAAA,EACtC,GAAG,CAACT,GAAUS,CAAa,CAAC,GAG1B,gBAAAY,EAAC,QAAA,EAAK,KAAKjB,GACT,UAAA,gBAAAkB;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC,EAAKC,EAAO,wBAAwB,GAAGA,EAAO,2BAA2BzB,CAAI,EAAE,GAAG;AAAA,QAC3F,CAACyB,EAAO,2BAA2B1B,CAAO,EAAE,CAAC,GAAGA;AAAA,QAChD,CAAC0B,EAAO,8BAA8B,CAAC,GAAGtB;AAAA,MAAA,CAC3C;AAAA,MACD,MAAK;AAAA,MACL,SAASQ;AAAA,MACT,WAAWK;AAAA,MACX,iBAAeP;AAAA,MACf,iBAAc;AAAA,MACd,cAAY,GAAGC,EAAc,KAAK;AAAA,MAClC,UAAAN;AAAA,MACA,iBAAeI;AAAA,MACd,GAAIV,KAAO,EAAE,KAAAA,EAAA;AAAA,MAEd,UAAA;AAAA,QAAA,gBAAAwB,EAAC,UAAK,WAAWG,EAAO,8BAA8B,GACnD,UAAAf,EAAcR,CAAoC,GACrD;AAAA,QAEA,gBAAAoB;AAAA,UAACI;AAAA,UAAA;AAAA,YACC,WAAWF,EAAKC,EAAO,6BAA6B,GAAG;AAAA,cACrD,CAACA,EAAO,mCAAmC,CAAC,GAAGhB;AAAA,YAAA,CAChD;AAAA,YACD,MAAK;AAAA,YACL,MAAM;AAAA,UAAA;AAAA,QAAA;AAAA,MACR;AAAA,IAAA;AAAA,EAAA,GAEJ;AAEJ,CAAC;"}
1
+ {"version":3,"file":"SelectButton.js","sources":["../../../../src/components/SelectListbox/components/SelectButton.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useEffect, useRef, forwardRef } from 'react';\n\nimport type { KeyboardEvent } from 'react';\nimport type { OptionValue, SelectValue } from 'components/SelectListbox/SelectProvider';\n\nimport styles from 'components/SelectListbox/SelectListbox.module.css';\nimport { Icon } from 'components/Icon';\nimport { useSelect } from 'components/SelectListbox/SelectProvider';\n\nexport interface SelectButtonProps {\n variant?: 'noborder' | 'pill' | 'pillLeft' | 'pillRight' | 'darkBorder' | 'roundedLeft' | 'roundedRight';\n size?: 'small' | 'medium' | 'default';\n onChange?: (option: OptionValue) => void;\n buttonLabelProp?: string;\n buttonLabelBold?: boolean;\n disabled?: boolean;\n}\n\nexport const SelectButton = forwardRef<HTMLButtonElement, SelectButtonProps>((props, ref) => {\n const { variant, size = 'default', onChange, buttonLabelProp = 'label', buttonLabelBold, disabled = false } = props;\n const buttonWrapper = useRef<HTMLSpanElement>(null);\n const isFirstRender = useRef(true);\n const { listboxId, isOpen, selectedValue, toggleListbox, setIsOpen, setActiveIndex, options } = useSelect() || {};\n\n const onTriggerKeyDown = (event: KeyboardEvent<HTMLButtonElement>) => {\n if (event.key.length === 1) {\n const key = event.key.toLocaleLowerCase();\n const optionIndexStartsWithKey = options.findIndex(\n (option) => !option.disabled && option.label.toLocaleLowerCase().startsWith(key)\n );\n if (optionIndexStartsWithKey !== -1) {\n setActiveIndex(optionIndexStartsWithKey);\n if (!isOpen) setIsOpen(true);\n event.preventDefault();\n return;\n }\n }\n\n switch (event.key) {\n case 'Enter':\n event.preventDefault();\n if (!isOpen) {\n setIsOpen(true);\n return;\n }\n break;\n case 'Escape':\n if (isOpen) {\n event.stopPropagation();\n setActiveIndex(options.findIndex((option) => option.value === selectedValue?.value));\n setIsOpen(false);\n }\n break;\n }\n };\n\n useEffect(() => {\n isOpen\n ? (buttonWrapper.current?.children[0] as HTMLButtonElement).blur()\n : !isFirstRender.current && (buttonWrapper.current?.children[0] as HTMLButtonElement).focus();\n }, [isOpen]);\n\n useEffect(() => {\n isFirstRender.current = false;\n\n return () => {\n isFirstRender.current = true;\n };\n }, []);\n\n useEffect(() => {\n if (onChange) onChange(selectedValue);\n }, [onChange, selectedValue]);\n\n return (\n <span ref={buttonWrapper}>\n <button\n className={clsx(styles['select-listbox-trigger'], styles[`select-listbox-trigger--${size}`], {\n [styles[`select-listbox-trigger--${variant}`]]: variant,\n [styles['select-listbox-trigger--bold']]: buttonLabelBold,\n })}\n type=\"button\"\n onClick={toggleListbox}\n onKeyDown={onTriggerKeyDown}\n aria-expanded={isOpen}\n aria-haspopup=\"listbox\"\n aria-label={`${selectedValue.label}`}\n disabled={disabled}\n aria-controls={listboxId}\n {...(ref && { ref: ref })}\n >\n <span className={styles['select-listbox-trigger-label']}>\n {selectedValue[buttonLabelProp as keyof SelectValue]}\n </span>\n\n <Icon\n className={clsx(styles['select-listbox-trigger-icon'], {\n [styles['select-listbox-trigger-icon--open']]: isOpen,\n })}\n name=\"CheveronDown\"\n size={16}\n />\n </button>\n </span>\n );\n});\n"],"names":["SelectButton","forwardRef","props","ref","variant","size","onChange","buttonLabelProp","buttonLabelBold","disabled","buttonWrapper","useRef","isFirstRender","listboxId","isOpen","selectedValue","toggleListbox","setIsOpen","setActiveIndex","options","useSelect","onTriggerKeyDown","event","key","optionIndexStartsWithKey","option","useEffect","jsx","jsxs","clsx","styles","Icon"],"mappings":";;;;;;AAmBO,MAAMA,IAAeC,EAAiD,CAACC,GAAOC,MAAQ;AAC3F,QAAM,EAAE,SAAAC,GAAS,MAAAC,IAAO,WAAW,UAAAC,GAAU,iBAAAC,IAAkB,SAAS,iBAAAC,GAAiB,UAAAC,IAAW,GAAA,IAAUP,GACxGQ,IAAgBC,EAAwB,IAAI,GAC5CC,IAAgBD,EAAO,EAAI,GAC3B,EAAE,WAAAE,GAAW,QAAAC,GAAQ,eAAAC,GAAe,eAAAC,GAAe,WAAAC,GAAW,gBAAAC,GAAgB,SAAAC,EAAA,IAAYC,EAAA,KAAe,CAAA,GAEzGC,IAAmB,CAACC,MAA4C;AACpE,QAAIA,EAAM,IAAI,WAAW,GAAG;AAC1B,YAAMC,IAAMD,EAAM,IAAI,kBAAA,GAChBE,IAA2BL,EAAQ;AAAA,QACvC,CAACM,MAAW,CAACA,EAAO,YAAYA,EAAO,MAAM,oBAAoB,WAAWF,CAAG;AAAA,MAA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AAA,MAClC,UAAAN;AAAA,MACA,iBAAeI;AAAA,MACd,GAAIV,KAAO,EAAE,KAAAA,EAAA;AAAA,MAEd,UAAA;AAAA,QAAA,gBAAAwB,EAAC,UAAK,WAAWG,EAAO,8BAA8B,GACnD,UAAAf,EAAcR,CAAoC,GACrD;AAAA,QAEA,gBAAAoB;AAAA,UAACI;AAAA,UAAA;AAAA,YACC,WAAWF,EAAKC,EAAO,6BAA6B,GAAG;AAAA,cACrD,CAACA,EAAO,mCAAmC,CAAC,GAAGhB;AAAA,YAAA,CAChD;AAAA,YACD,MAAK;AAAA,YACL,MAAM;AAAA,UAAA;AAAA,QAAA;AAAA,MACR;AAAA,IAAA;AAAA,EAAA,GAEJ;AAEJ,CAAC;"}
@@ -1,7 +1,7 @@
1
1
  import { jsx as c } from "react/jsx-runtime";
2
2
  import { useRef as i, useCallback as u, useEffect as l } from "react";
3
3
  import { useSelect as m } from "../SelectProvider.js";
4
- import { s as f } from "../../../SelectListbox.module-yzXaWwsm.js";
4
+ import { s as f } from "../../../SelectListbox.module-CAKDuwcy.js";
5
5
  const E = ({ children: o }) => {
6
6
  const { isOpen: r, setIsOpen: n } = m(), t = i(null), e = u(
7
7
  ({ target: s }) => {
@@ -2,7 +2,7 @@ import { jsxs as v, Fragment as x, jsx as m } from "react/jsx-runtime";
2
2
  import { c as I } from "../../../clsx-OuTLNxxd.js";
3
3
  import { useRef as O, useEffect as k } from "react";
4
4
  import { useSelect as g } from "../SelectProvider.js";
5
- import { s as c } from "../../../SelectListbox.module-yzXaWwsm.js";
5
+ import { s as c } from "../../../SelectListbox.module-CAKDuwcy.js";
6
6
  const K = ({ option: a, index: s, dividerAfter: u, children: w }) => {
7
7
  const i = O(null), { isOpen: l, activeIndex: t, setActiveIndex: r, selectedValue: n, setSelectedValue: p, setIsOpen: f, options: o } = g(), y = (e) => {
8
8
  p(o[e]), f(!1);
@@ -1,6 +1,6 @@
1
1
  import { jsx as s } from "react/jsx-runtime";
2
2
  import { forwardRef as m, useRef as x } from "react";
3
- import { s as i } from "../../../SelectListbox.module-yzXaWwsm.js";
3
+ import { s as i } from "../../../SelectListbox.module-CAKDuwcy.js";
4
4
  import { useSelect as a } from "../SelectProvider.js";
5
5
  const h = m((l, e) => {
6
6
  const { style: t, children: o } = l, { listboxId: r, isOpen: c } = a(), n = x(null);
@@ -1,5 +1,5 @@
1
1
  import { jsx as e, jsxs as i, Fragment as m } from "react/jsx-runtime";
2
- import { l as s } from "../../index-BamlKH-k.js";
2
+ import { l as s } from "../../index-DvUwfXNb.js";
3
3
  import { Sortable as l } from "./Sortable.js";
4
4
  import { InputField as d } from "../InputField/InputField.js";
5
5
  import { Icon as c } from "../Icon/Icon.js";
@@ -1,5 +1,5 @@
1
1
  import { jsx as r } from "react/jsx-runtime";
2
- import { l as a } from "../../index-BamlKH-k.js";
2
+ import { l as a } from "../../index-DvUwfXNb.js";
3
3
  import { TextArea as e } from "./TextArea.js";
4
4
  const o = `
5
5
  <TextArea label={label} maxCharacters={maxCharacters} defaultValue={string}/> `, x = {
@@ -1,7 +1,7 @@
1
1
  import { jsx as a } from "react/jsx-runtime";
2
2
  import "../../index-B32mP_-H.js";
3
3
  import { r as o, s as t, f as r } from "../../react.esm-WLX_DeH0.js";
4
- import { J as c } from "../../index-BamlKH-k.js";
4
+ import { J as c } from "../../index-DvUwfXNb.js";
5
5
  import { TextArea as n } from "./TextArea.js";
6
6
  describe("TextArea", () => {
7
7
  it("should render correctly with label", () => {
@@ -1,5 +1,5 @@
1
1
  import { jsx as o } from "react/jsx-runtime";
2
- import { l } from "../../index-BamlKH-k.js";
2
+ import { l } from "../../index-DvUwfXNb.js";
3
3
  import { ToggleSwitch as e } from "./ToggleSwitch.js";
4
4
  const a = `
5
5
  // Has all InputHTMLAttributes props available except "className" and "style"
@@ -1,5 +1,5 @@
1
1
  import { jsx as r } from "react/jsx-runtime";
2
- import { l as n } from "../../index-BamlKH-k.js";
2
+ import { l as n } from "../../index-DvUwfXNb.js";
3
3
  import { VarIndicator as t } from "./VarIndicator.js";
4
4
  const o = {
5
5
  DRAFT: "Concept",
@@ -1,4 +1,4 @@
1
- import { s as P, i as X, U as Au, n as So, _ as xu, Q as Dn, X as ft, h as _r, B as yt, c as Su, u as Cu, d as Du, K as $u, a as Tu, b as Fu, l as Ou, e as Iu, P as $n, Z as Tn, p as Fn, z as On, f as Ru, H as Pu, g as Co, j as Bu, T as ju, L as ku, k as _u, m as Lu, Y as It, x as Nu, O as Do, o as Mu, q as qu, r as Uu, G as Gu, t as Hu, v as $o, w as Vu, y as zu, A as Wu, C as Yu, D as Ku, V as To, E as Xu, M as Ju, F as $t, I as In } from "./index-BamlKH-k.js";
1
+ import { s as P, i as X, U as Au, n as So, _ as xu, Q as Dn, X as ft, h as _r, B as yt, c as Su, u as Cu, d as Du, K as $u, a as Tu, b as Fu, l as Ou, e as Iu, P as $n, Z as Tn, p as Fn, z as On, f as Ru, H as Pu, g as Co, j as Bu, T as ju, L as ku, k as _u, m as Lu, Y as It, x as Nu, O as Do, o as Mu, q as qu, r as Uu, G as Gu, t as Hu, v as $o, w as Vu, y as zu, A as Wu, C as Yu, D as Ku, V as To, E as Xu, M as Ju, F as $t, I as In } from "./index-DvUwfXNb.js";
2
2
  var Qu = Object.defineProperty, E = (t, e) => Qu(t, "name", { value: e, configurable: !0 });
3
3
  function _e(t) {
4
4
  for (var e = [], r = 1; r < arguments.length; r++)
@@ -4785,7 +4785,10 @@ var th = /* @__PURE__ */ f((t, e) => {
4785
4785
  if (e) {
4786
4786
  t.userEvent = Dn(
4787
4787
  { userEvent: Tu.setup() },
4788
- { intercept: !0 }
4788
+ {
4789
+ intercept: !0,
4790
+ getKeys: /* @__PURE__ */ f((o) => Object.keys(o).filter((n) => n !== "eventWrapper"), "getKeys")
4791
+ }
4789
4792
  ).userEvent, Object.defineProperty(globalThis.window.navigator, "clipboard", {
4790
4793
  get: /* @__PURE__ */ f(() => e, "get"),
4791
4794
  configurable: !0
@@ -11558,4 +11561,4 @@ export {
11558
11561
  Ih as i,
11559
11562
  $y as s
11560
11563
  };
11561
- //# sourceMappingURL=index-BVrrnUn0.js.map
11564
+ //# sourceMappingURL=index-BfMTX2kB.js.map