@fluentui/react-combobox 9.74.7-experimental.cli-api.20261006-ccaa611d58.0 → 9.75.0-experimental.css-modules.20261031-810ab07afb.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.
- package/CHANGELOG.md +60 -16
- package/README.md +12 -0
- package/dist/index.d.cts +30 -0
- package/dist/index.d.ts +30 -0
- package/lib/components/Combobox/Combobox.js.map +1 -1
- package/lib/components/Combobox/Combobox.module.css +233 -0
- package/lib/components/Combobox/Combobox.types.js.map +1 -1
- package/lib/components/Combobox/index.js.map +1 -1
- package/lib/components/Combobox/renderCombobox.js +2 -2
- package/lib/components/Combobox/renderCombobox.js.map +1 -1
- package/lib/components/Combobox/useCombobox.js +62 -42
- package/lib/components/Combobox/useCombobox.js.map +1 -1
- package/lib/components/Combobox/useComboboxExpandIconSlot.js +40 -0
- package/lib/components/Combobox/useComboboxExpandIconSlot.js.map +1 -0
- package/lib/components/Combobox/useComboboxStyles.styles.css.js +25 -0
- package/lib/components/Combobox/useComboboxStyles.styles.css.js.map +1 -0
- package/lib/components/Combobox/useComboboxStyles.styles.raw.css.js +25 -0
- package/lib/components/Combobox/useComboboxStyles.styles.raw.css.js.map +1 -0
- package/lib/components/Combobox/useComboboxStyles.styles.raw.js.map +1 -1
- package/lib/components/Combobox/useInputTriggerSlot.js +3 -2
- package/lib/components/Combobox/useInputTriggerSlot.js.map +1 -1
- package/lib/components/Dropdown/Dropdown.js.map +1 -1
- package/lib/components/Dropdown/Dropdown.module.css +237 -0
- package/lib/components/Dropdown/Dropdown.types.js.map +1 -1
- package/lib/components/Dropdown/index.js.map +1 -1
- package/lib/components/Dropdown/renderDropdown.js +2 -2
- package/lib/components/Dropdown/renderDropdown.js.map +1 -1
- package/lib/components/Dropdown/useButtonTriggerSlot.js.map +1 -1
- package/lib/components/Dropdown/useDropdown.js +5 -7
- package/lib/components/Dropdown/useDropdown.js.map +1 -1
- package/lib/components/Dropdown/useDropdownStyles.styles.css.js +25 -0
- package/lib/components/Dropdown/useDropdownStyles.styles.css.js.map +1 -0
- package/lib/components/Dropdown/useDropdownStyles.styles.js +4 -4
- package/lib/components/Dropdown/useDropdownStyles.styles.js.map +1 -1
- package/lib/components/Dropdown/useDropdownStyles.styles.raw.css.js +25 -0
- package/lib/components/Dropdown/useDropdownStyles.styles.raw.css.js.map +1 -0
- package/lib/components/Dropdown/useDropdownStyles.styles.raw.js +2 -2
- package/lib/components/Dropdown/useDropdownStyles.styles.raw.js.map +1 -1
- package/lib/components/Listbox/Listbox.js.map +1 -1
- package/lib/components/Listbox/Listbox.module.css +13 -0
- package/lib/components/Listbox/Listbox.types.js.map +1 -1
- package/lib/components/Listbox/index.js.map +1 -1
- package/lib/components/Listbox/renderListbox.js +2 -2
- package/lib/components/Listbox/renderListbox.js.map +1 -1
- package/lib/components/Listbox/useListbox.js.map +1 -1
- package/lib/components/Listbox/useListboxStyles.styles.css.js +9 -0
- package/lib/components/Listbox/useListboxStyles.styles.css.js.map +1 -0
- package/lib/components/Listbox/useListboxStyles.styles.raw.css.js +9 -0
- package/lib/components/Listbox/useListboxStyles.styles.raw.css.js.map +1 -0
- package/lib/components/Listbox/useListboxStyles.styles.raw.js.map +1 -1
- package/lib/components/Option/Option.js.map +1 -1
- package/lib/components/Option/Option.module.css +92 -0
- package/lib/components/Option/Option.types.js.map +1 -1
- package/lib/components/Option/index.js.map +1 -1
- package/lib/components/Option/renderOption.js +2 -2
- package/lib/components/Option/renderOption.js.map +1 -1
- package/lib/components/Option/useOption.js +1 -2
- package/lib/components/Option/useOption.js.map +1 -1
- package/lib/components/Option/useOptionStyles.styles.css.js +13 -0
- package/lib/components/Option/useOptionStyles.styles.css.js.map +1 -0
- package/lib/components/Option/useOptionStyles.styles.raw.css.js +13 -0
- package/lib/components/Option/useOptionStyles.styles.raw.css.js.map +1 -0
- package/lib/components/Option/useOptionStyles.styles.raw.js.map +1 -1
- package/lib/components/OptionGroup/OptionGroup.js.map +1 -1
- package/lib/components/OptionGroup/OptionGroup.module.css +23 -0
- package/lib/components/OptionGroup/OptionGroup.types.js.map +1 -1
- package/lib/components/OptionGroup/index.js.map +1 -1
- package/lib/components/OptionGroup/renderOptionGroup.js +2 -2
- package/lib/components/OptionGroup/renderOptionGroup.js.map +1 -1
- package/lib/components/OptionGroup/useOptionGroup.js.map +1 -1
- package/lib/components/OptionGroup/useOptionGroupStyles.styles.css.js +13 -0
- package/lib/components/OptionGroup/useOptionGroupStyles.styles.css.js.map +1 -0
- package/lib/components/OptionGroup/useOptionGroupStyles.styles.raw.css.js +13 -0
- package/lib/components/OptionGroup/useOptionGroupStyles.styles.raw.css.js.map +1 -0
- package/lib/components/OptionGroup/useOptionGroupStyles.styles.raw.js.map +1 -1
- package/lib/contexts/ComboboxContext.js.map +1 -1
- package/lib/contexts/ListboxContext.js.map +1 -1
- package/lib/contexts/useComboboxContextValues.js.map +1 -1
- package/lib/contexts/useListboxContextValues.js.map +1 -1
- package/lib/hooks/useComboboxFilter.js.map +1 -1
- package/lib/hooks/useTabsterEscapeIgnore.js.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/utils/ComboboxBase.types.js.map +1 -1
- package/lib/utils/OptionCollection.types.js.map +1 -1
- package/lib/utils/Selection.types.js.map +1 -1
- package/lib/utils/dropdownKeyActions.js.map +1 -1
- package/lib/utils/internalTokens.js.map +1 -1
- package/lib/utils/isComboboxOptionElement.js.map +1 -1
- package/lib/utils/useComboboxBaseState.js +5 -4
- package/lib/utils/useComboboxBaseState.js.map +1 -1
- package/lib/utils/useComboboxPositioning.js.map +1 -1
- package/lib/utils/useListboxSlot.js.map +1 -1
- package/lib/utils/useOptionCollection.js.map +1 -1
- package/lib/utils/useSelection.js.map +1 -1
- package/lib/utils/useTriggerSlot.js +6 -3
- package/lib/utils/useTriggerSlot.js.map +1 -1
- package/lib-commonjs/Combobox.cjs +7 -7
- package/lib-commonjs/Dropdown.cjs +7 -7
- package/lib-commonjs/Listbox.cjs +6 -6
- package/lib-commonjs/Option.cjs +7 -7
- package/lib-commonjs/OptionGroup.cjs +6 -6
- package/lib-commonjs/components/Combobox/Combobox.cjs.map +1 -1
- package/lib-commonjs/components/Combobox/Combobox.module.css +233 -0
- package/lib-commonjs/components/Combobox/Combobox.types.cjs.map +1 -1
- package/lib-commonjs/components/Combobox/index.cjs +7 -7
- package/lib-commonjs/components/Combobox/index.cjs.map +1 -1
- package/lib-commonjs/components/Combobox/renderCombobox.cjs.map +1 -1
- package/lib-commonjs/components/Combobox/useCombobox.cjs +62 -44
- package/lib-commonjs/components/Combobox/useCombobox.cjs.map +1 -1
- package/lib-commonjs/components/Combobox/useComboboxExpandIconSlot.cjs +46 -0
- package/lib-commonjs/components/Combobox/useComboboxExpandIconSlot.cjs.map +1 -0
- package/lib-commonjs/components/Combobox/useComboboxStyles.styles.cjs +3 -3
- package/lib-commonjs/components/Combobox/useComboboxStyles.styles.cjs.map +1 -1
- package/lib-commonjs/components/Combobox/useComboboxStyles.styles.css.cjs +44 -0
- package/lib-commonjs/components/Combobox/useComboboxStyles.styles.css.cjs.map +1 -0
- package/lib-commonjs/components/Combobox/useComboboxStyles.styles.raw.cjs +3 -3
- package/lib-commonjs/components/Combobox/useComboboxStyles.styles.raw.cjs.map +1 -1
- package/lib-commonjs/components/Combobox/useComboboxStyles.styles.raw.css.cjs +44 -0
- package/lib-commonjs/components/Combobox/useComboboxStyles.styles.raw.css.cjs.map +1 -0
- package/lib-commonjs/components/Combobox/useInputTriggerSlot.cjs +3 -2
- package/lib-commonjs/components/Combobox/useInputTriggerSlot.cjs.map +1 -1
- package/lib-commonjs/components/Dropdown/Dropdown.cjs.map +1 -1
- package/lib-commonjs/components/Dropdown/Dropdown.module.css +237 -0
- package/lib-commonjs/components/Dropdown/Dropdown.types.cjs.map +1 -1
- package/lib-commonjs/components/Dropdown/index.cjs +7 -7
- package/lib-commonjs/components/Dropdown/index.cjs.map +1 -1
- package/lib-commonjs/components/Dropdown/renderDropdown.cjs.map +1 -1
- package/lib-commonjs/components/Dropdown/useButtonTriggerSlot.cjs.map +1 -1
- package/lib-commonjs/components/Dropdown/useDropdown.cjs +8 -10
- package/lib-commonjs/components/Dropdown/useDropdown.cjs.map +1 -1
- package/lib-commonjs/components/Dropdown/useDropdownStyles.styles.cjs +7 -7
- package/lib-commonjs/components/Dropdown/useDropdownStyles.styles.cjs.map +1 -1
- package/lib-commonjs/components/Dropdown/useDropdownStyles.styles.css.cjs +44 -0
- package/lib-commonjs/components/Dropdown/useDropdownStyles.styles.css.cjs.map +1 -0
- package/lib-commonjs/components/Dropdown/useDropdownStyles.styles.raw.cjs +5 -5
- package/lib-commonjs/components/Dropdown/useDropdownStyles.styles.raw.cjs.map +1 -1
- package/lib-commonjs/components/Dropdown/useDropdownStyles.styles.raw.css.cjs +44 -0
- package/lib-commonjs/components/Dropdown/useDropdownStyles.styles.raw.css.cjs.map +1 -0
- package/lib-commonjs/components/Listbox/Listbox.cjs.map +1 -1
- package/lib-commonjs/components/Listbox/Listbox.module.css +13 -0
- package/lib-commonjs/components/Listbox/Listbox.types.cjs.map +1 -1
- package/lib-commonjs/components/Listbox/index.cjs +6 -6
- package/lib-commonjs/components/Listbox/index.cjs.map +1 -1
- package/lib-commonjs/components/Listbox/renderListbox.cjs.map +1 -1
- package/lib-commonjs/components/Listbox/useListbox.cjs.map +1 -1
- package/lib-commonjs/components/Listbox/useListboxStyles.styles.cjs +3 -3
- package/lib-commonjs/components/Listbox/useListboxStyles.styles.cjs.map +1 -1
- package/lib-commonjs/components/Listbox/useListboxStyles.styles.css.cjs +28 -0
- package/lib-commonjs/components/Listbox/useListboxStyles.styles.css.cjs.map +1 -0
- package/lib-commonjs/components/Listbox/useListboxStyles.styles.raw.cjs +3 -3
- package/lib-commonjs/components/Listbox/useListboxStyles.styles.raw.cjs.map +1 -1
- package/lib-commonjs/components/Listbox/useListboxStyles.styles.raw.css.cjs +28 -0
- package/lib-commonjs/components/Listbox/useListboxStyles.styles.raw.css.cjs.map +1 -0
- package/lib-commonjs/components/Option/Option.cjs.map +1 -1
- package/lib-commonjs/components/Option/Option.module.css +92 -0
- package/lib-commonjs/components/Option/Option.types.cjs.map +1 -1
- package/lib-commonjs/components/Option/index.cjs +7 -7
- package/lib-commonjs/components/Option/index.cjs.map +1 -1
- package/lib-commonjs/components/Option/renderOption.cjs.map +1 -1
- package/lib-commonjs/components/Option/useOption.cjs +4 -5
- package/lib-commonjs/components/Option/useOption.cjs.map +1 -1
- package/lib-commonjs/components/Option/useOptionStyles.styles.cjs +3 -3
- package/lib-commonjs/components/Option/useOptionStyles.styles.cjs.map +1 -1
- package/lib-commonjs/components/Option/useOptionStyles.styles.css.cjs +32 -0
- package/lib-commonjs/components/Option/useOptionStyles.styles.css.cjs.map +1 -0
- package/lib-commonjs/components/Option/useOptionStyles.styles.raw.cjs +3 -3
- package/lib-commonjs/components/Option/useOptionStyles.styles.raw.cjs.map +1 -1
- package/lib-commonjs/components/Option/useOptionStyles.styles.raw.css.cjs +32 -0
- package/lib-commonjs/components/Option/useOptionStyles.styles.raw.css.cjs.map +1 -0
- package/lib-commonjs/components/OptionGroup/OptionGroup.cjs.map +1 -1
- package/lib-commonjs/components/OptionGroup/OptionGroup.module.css +23 -0
- package/lib-commonjs/components/OptionGroup/OptionGroup.types.cjs.map +1 -1
- package/lib-commonjs/components/OptionGroup/index.cjs +6 -6
- package/lib-commonjs/components/OptionGroup/index.cjs.map +1 -1
- package/lib-commonjs/components/OptionGroup/renderOptionGroup.cjs.map +1 -1
- package/lib-commonjs/components/OptionGroup/useOptionGroup.cjs.map +1 -1
- package/lib-commonjs/components/OptionGroup/useOptionGroupStyles.styles.cjs +3 -3
- package/lib-commonjs/components/OptionGroup/useOptionGroupStyles.styles.cjs.map +1 -1
- package/lib-commonjs/components/OptionGroup/useOptionGroupStyles.styles.css.cjs +32 -0
- package/lib-commonjs/components/OptionGroup/useOptionGroupStyles.styles.css.cjs.map +1 -0
- package/lib-commonjs/components/OptionGroup/useOptionGroupStyles.styles.raw.cjs +3 -3
- package/lib-commonjs/components/OptionGroup/useOptionGroupStyles.styles.raw.cjs.map +1 -1
- package/lib-commonjs/components/OptionGroup/useOptionGroupStyles.styles.raw.css.cjs +32 -0
- package/lib-commonjs/components/OptionGroup/useOptionGroupStyles.styles.raw.css.cjs.map +1 -0
- package/lib-commonjs/contexts/ComboboxContext.cjs +3 -3
- package/lib-commonjs/contexts/ComboboxContext.cjs.map +1 -1
- package/lib-commonjs/contexts/ListboxContext.cjs +4 -4
- package/lib-commonjs/contexts/ListboxContext.cjs.map +1 -1
- package/lib-commonjs/contexts/useComboboxContextValues.cjs.map +1 -1
- package/lib-commonjs/contexts/useListboxContextValues.cjs.map +1 -1
- package/lib-commonjs/hooks/useComboboxFilter.cjs.map +1 -1
- package/lib-commonjs/hooks/useTabsterEscapeIgnore.cjs.map +1 -1
- package/lib-commonjs/index.cjs +44 -40
- package/lib-commonjs/index.cjs.map +1 -1
- package/lib-commonjs/utils/ComboboxBase.types.cjs.map +1 -1
- package/lib-commonjs/utils/OptionCollection.types.cjs.map +1 -1
- package/lib-commonjs/utils/Selection.types.cjs.map +1 -1
- package/lib-commonjs/utils/dropdownKeyActions.cjs.map +1 -1
- package/lib-commonjs/utils/internalTokens.cjs.map +1 -1
- package/lib-commonjs/utils/isComboboxOptionElement.cjs.map +1 -1
- package/lib-commonjs/utils/useComboboxBaseState.cjs +5 -4
- package/lib-commonjs/utils/useComboboxBaseState.cjs.map +1 -1
- package/lib-commonjs/utils/useComboboxPositioning.cjs.map +1 -1
- package/lib-commonjs/utils/useListboxSlot.cjs.map +1 -1
- package/lib-commonjs/utils/useOptionCollection.cjs.map +1 -1
- package/lib-commonjs/utils/useSelection.cjs.map +1 -1
- package/lib-commonjs/utils/useTriggerSlot.cjs +6 -3
- package/lib-commonjs/utils/useTriggerSlot.cjs.map +1 -1
- package/package.json +19 -19
- package/dist/metadata/api/api-root.json +0 -1
- package/dist/metadata/index.json +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Combobox/useComboboxStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport { tokens, typographyStyles } from '@fluentui/react-theme';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport { makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport { iconSizes } from '../../utils/internalTokens';\nimport type { ComboboxSlots, ComboboxState } from './Combobox.types';\n\nexport const comboboxClassNames: SlotClassNames<ComboboxSlots> = {\n root: 'fui-Combobox',\n input: 'fui-Combobox__input',\n expandIcon: 'fui-Combobox__expandIcon',\n clearIcon: 'fui-Combobox__clearIcon',\n listbox: 'fui-Combobox__listbox',\n};\n\n// Matches internal heights for Select and Input, but there are no theme variables for these\nconst fieldHeights = {\n small: '24px',\n medium: '32px',\n large: '40px',\n};\n\n/**\n * Styles for Combobox\n */\nconst useStyles = makeStyles({\n root: {\n alignItems: 'center',\n borderRadius: tokens.borderRadiusMedium,\n boxSizing: 'border-box',\n columnGap: tokens.spacingHorizontalXXS,\n display: 'inline-grid',\n gridTemplateColumns: '1fr auto',\n justifyContent: 'space-between',\n minWidth: '250px',\n position: 'relative',\n verticalAlign: 'middle',\n\n // windows high contrast mode focus indicator\n ':focus-within': {\n outlineWidth: '2px',\n outlineStyle: 'solid',\n outlineColor: 'transparent',\n },\n\n // bottom focus border, shared with Input, Select, and SpinButton\n '::after': {\n boxSizing: 'border-box',\n content: '\"\"',\n position: 'absolute',\n left: '-1px',\n bottom: '-1px',\n right: '-1px',\n height: `max(2px, ${tokens.borderRadiusMedium})`,\n borderBottomLeftRadius: tokens.borderRadiusMedium,\n borderBottomRightRadius: tokens.borderRadiusMedium,\n borderBottom: `${tokens.strokeWidthThick} solid ${tokens.colorCompoundBrandStroke}`,\n clipPath: 'inset(calc(100% - 2px) 0 0 0)',\n transform: 'scaleX(0)',\n transitionProperty: 'transform',\n transitionDuration: tokens.durationUltraFast,\n transitionDelay: tokens.curveAccelerateMid,\n\n '@media screen and (prefers-reduced-motion: reduce)': {\n transitionDuration: '0.01ms',\n transitionDelay: '0.01ms',\n },\n },\n ':focus-within::after': {\n transform: 'scaleX(1)',\n transitionProperty: 'transform',\n transitionDuration: tokens.durationNormal,\n transitionDelay: tokens.curveDecelerateMid,\n\n '@media screen and (prefers-reduced-motion: reduce)': {\n transitionDuration: '0.01ms',\n transitionDelay: '0.01ms',\n },\n },\n ':focus-within:active::after': {\n borderBottomColor: tokens.colorCompoundBrandStrokePressed,\n },\n },\n\n listbox: {\n boxShadow: `${tokens.shadow16}`,\n borderRadius: tokens.borderRadiusMedium,\n maxHeight: '80vh',\n boxSizing: 'border-box',\n },\n\n listboxCollapsed: {\n display: 'none',\n },\n\n // When rendering inline, the popupSurface will be rendered under relatively positioned elements such as Input.\n // This is due to the surface being positioned as absolute, therefore zIndex: 1 ensures that won't happen.\n inlineListbox: {\n zIndex: 1,\n },\n\n // size variants\n small: {\n height: fieldHeights.small,\n paddingRight: tokens.spacingHorizontalSNudge,\n },\n medium: {\n height: fieldHeights.medium,\n paddingRight: tokens.spacingHorizontalMNudge,\n },\n large: {\n columnGap: tokens.spacingHorizontalSNudge,\n height: fieldHeights.large,\n paddingRight: tokens.spacingHorizontalM,\n },\n\n // appearance variants\n outline: {\n backgroundColor: tokens.colorNeutralBackground1,\n border: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralStroke1}`,\n borderBottomColor: tokens.colorNeutralStrokeAccessible,\n },\n outlineInteractive: {\n '&:hover': {\n ...shorthands.borderColor(tokens.colorNeutralStroke1Hover),\n borderBottomColor: tokens.colorNeutralStrokeAccessibleHover,\n },\n\n '&:active': {\n ...shorthands.borderColor(tokens.colorNeutralStroke1Pressed),\n borderBottomColor: tokens.colorNeutralStrokeAccessiblePressed,\n },\n\n '&:focus-within': {\n ...shorthands.borderColor(tokens.colorNeutralStroke1Pressed),\n borderBottomColor: tokens.colorNeutralStrokeAccessiblePressed,\n },\n },\n underline: {\n backgroundColor: tokens.colorTransparentBackground,\n borderBottom: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralStrokeAccessible}`,\n borderRadius: '0',\n },\n 'filled-lighter': {\n backgroundColor: tokens.colorNeutralBackground1,\n border: `${tokens.strokeWidthThin} solid ${tokens.colorTransparentStroke}`,\n },\n 'filled-darker': {\n backgroundColor: tokens.colorNeutralBackground3,\n border: `${tokens.strokeWidthThin} solid ${tokens.colorTransparentStroke}`,\n },\n invalid: {\n ':not(:focus-within),:hover:not(:focus-within)': {\n ...shorthands.borderColor(tokens.colorPaletteRedBorder2),\n },\n },\n invalidUnderline: {\n ':not(:focus-within),:hover:not(:focus-within)': {\n borderBottomColor: tokens.colorPaletteRedBorder2,\n },\n },\n\n disabled: {\n cursor: 'not-allowed',\n backgroundColor: tokens.colorTransparentBackground,\n ...shorthands.borderColor(tokens.colorNeutralStrokeDisabled),\n '@media (forced-colors: active)': {\n ...shorthands.borderColor('GrayText'),\n },\n },\n});\n\nconst useInputStyles = makeStyles({\n input: {\n alignSelf: 'stretch',\n backgroundColor: tokens.colorTransparentBackground,\n border: 'none',\n color: tokens.colorNeutralForeground1,\n fontFamily: tokens.fontFamilyBase,\n\n '&:focus': {\n outlineStyle: 'none',\n },\n\n '&::placeholder': {\n color: tokens.colorNeutralForeground4,\n opacity: 1,\n },\n },\n\n // size variants\n small: {\n ...typographyStyles.caption1,\n padding: `0 0 0 ${`calc(${tokens.spacingHorizontalSNudge} + ${tokens.spacingHorizontalXXS})`}`,\n },\n medium: {\n ...typographyStyles.body1,\n padding: `0 0 0 ${`calc(${tokens.spacingHorizontalMNudge} + ${tokens.spacingHorizontalXXS})`}`,\n },\n large: {\n ...typographyStyles.body2,\n padding: `0 0 0 ${`calc(${tokens.spacingHorizontalM} + ${tokens.spacingHorizontalSNudge})`}`,\n },\n disabled: {\n color: tokens.colorNeutralForegroundDisabled,\n backgroundColor: tokens.colorTransparentBackground,\n cursor: 'not-allowed',\n '::placeholder': {\n color: tokens.colorNeutralForegroundDisabled,\n },\n },\n});\n\nconst useIconStyles = makeStyles({\n icon: {\n boxSizing: 'border-box',\n color: tokens.colorNeutralStrokeAccessible,\n cursor: 'pointer',\n display: 'block',\n fontSize: tokens.fontSizeBase500,\n // position: relative provides the containing block for the ::after clickable-area extension below.\n position: 'relative',\n\n // the SVG must have display: block for accurate positioning\n // otherwise an extra inline space is inserted after the svg element\n '& svg': {\n display: 'block',\n },\n\n // Extend the clickable area to cover the root's right paddingRight \"dead zone\".\n // Without this, clicking between the icon and the right border does not trigger the icon's handler.\n // The negative `right` is overridden per size variant below to match the root's paddingRight.\n '::after': {\n content: '\"\"',\n position: 'absolute',\n top: 0,\n bottom: 0,\n left: 0,\n right: 0,\n },\n },\n hidden: {\n display: 'none',\n },\n visuallyHidden: {\n clip: 'rect(0px, 0px, 0px, 0px)',\n height: '1px',\n margin: '-1px',\n overflow: 'hidden',\n padding: '0px',\n width: '1px',\n position: 'absolute',\n },\n\n // icon size variants\n small: {\n fontSize: iconSizes.small,\n marginLeft: tokens.spacingHorizontalXXS,\n '::after': {\n right: `calc(-1 * ${tokens.spacingHorizontalSNudge})`,\n },\n },\n medium: {\n fontSize: iconSizes.medium,\n marginLeft: tokens.spacingHorizontalXXS,\n '::after': {\n right: `calc(-1 * ${tokens.spacingHorizontalMNudge})`,\n },\n },\n large: {\n fontSize: iconSizes.large,\n marginLeft: tokens.spacingHorizontalSNudge,\n '::after': {\n right: `calc(-1 * ${tokens.spacingHorizontalM})`,\n },\n },\n disabled: {\n color: tokens.colorNeutralForegroundDisabled,\n cursor: 'not-allowed',\n },\n});\n\n/**\n * Apply styling to the Combobox slots based on the state\n */\nexport const useComboboxStyles_unstable = (state: ComboboxState): ComboboxState => {\n const { appearance, open, size, showClearIcon } = state;\n const invalid = `${state.input['aria-invalid']}` === 'true';\n const disabled = state.input.disabled;\n const styles = useStyles();\n const iconStyles = useIconStyles();\n const inputStyles = useInputStyles();\n\n // eslint-disable-next-line react-hooks/immutability\n state.root.className = mergeClasses(\n comboboxClassNames.root,\n styles.root,\n styles[appearance],\n styles[size],\n !disabled && appearance === 'outline' && styles.outlineInteractive,\n invalid && appearance !== 'underline' && styles.invalid,\n invalid && appearance === 'underline' && styles.invalidUnderline,\n disabled && styles.disabled,\n state.root.className,\n );\n\n // eslint-disable-next-line react-hooks/immutability\n state.input.className = mergeClasses(\n comboboxClassNames.input,\n inputStyles.input,\n inputStyles[size],\n disabled && inputStyles.disabled,\n state.input.className,\n );\n\n if (state.listbox) {\n // eslint-disable-next-line react-hooks/immutability\n state.listbox.className = mergeClasses(\n comboboxClassNames.listbox,\n styles.listbox,\n state.inlinePopup && styles.inlineListbox,\n !open && styles.listboxCollapsed,\n state.listbox.className,\n );\n }\n\n if (state.expandIcon) {\n // eslint-disable-next-line react-hooks/immutability\n state.expandIcon.className = mergeClasses(\n comboboxClassNames.expandIcon,\n iconStyles.icon,\n iconStyles[size],\n disabled && iconStyles.disabled,\n showClearIcon && iconStyles.visuallyHidden,\n state.expandIcon.className,\n );\n }\n\n if (state.clearIcon) {\n // eslint-disable-next-line react-hooks/immutability\n state.clearIcon.className = mergeClasses(\n comboboxClassNames.clearIcon,\n iconStyles.icon,\n iconStyles[size],\n disabled && iconStyles.disabled,\n !showClearIcon && iconStyles.hidden,\n state.clearIcon.className,\n );\n }\n\n return state;\n};\n"],"names":["tokens","typographyStyles","makeStyles","mergeClasses","shorthands","iconSizes","comboboxClassNames","root","input","expandIcon","clearIcon","listbox","fieldHeights","small","medium","large","useStyles","alignItems","borderRadius","borderRadiusMedium","boxSizing","columnGap","spacingHorizontalXXS","display","gridTemplateColumns","justifyContent","minWidth","position","verticalAlign","outlineWidth","outlineStyle","outlineColor","content","left","bottom","right","height","borderBottomLeftRadius","borderBottomRightRadius","borderBottom","strokeWidthThick","colorCompoundBrandStroke","clipPath","transform","transitionProperty","transitionDuration","durationUltraFast","transitionDelay","curveAccelerateMid","durationNormal","curveDecelerateMid","borderBottomColor","colorCompoundBrandStrokePressed","boxShadow","shadow16","maxHeight","listboxCollapsed","inlineListbox","zIndex","paddingRight","spacingHorizontalSNudge","spacingHorizontalMNudge","spacingHorizontalM","outline","backgroundColor","colorNeutralBackground1","border","strokeWidthThin","colorNeutralStroke1","colorNeutralStrokeAccessible","outlineInteractive","borderColor","colorNeutralStroke1Hover","colorNeutralStrokeAccessibleHover","colorNeutralStroke1Pressed","colorNeutralStrokeAccessiblePressed","underline","colorTransparentBackground","colorTransparentStroke","colorNeutralBackground3","invalid","colorPaletteRedBorder2","invalidUnderline","disabled","cursor","colorNeutralStrokeDisabled","useInputStyles","alignSelf","color","colorNeutralForeground1","fontFamily","fontFamilyBase","colorNeutralForeground4","opacity","caption1","padding","body1","body2","colorNeutralForegroundDisabled","useIconStyles","icon","fontSize","fontSizeBase500","top","hidden","visuallyHidden","clip","margin","overflow","width","marginLeft","useComboboxStyles_unstable","state","appearance","open","size","showClearIcon","styles","iconStyles","inputStyles","className","inlinePopup"],"mappings":"AAAA;;;;;;;;;;;;IAQaM,kBAAAA;;;8BAsRAyG;eAAAA;;;4BA5R4B,wBAAwB;uBAEZ,iBAAiB;gCAC5C,gCAA6B;AAGhD,2BAA0D;IAC/DxG,MAAM;IACNC,OAAO;IACPC,YAAY;IACZC,WAAW;IACXC,SAAS;AACX,EAAE;AAEF,4FAA4F;AAC5F,MAAMC,eAAe;IACnBC,OAAO;IACPC,QAAQ;IACRC,OAAO;AACT;AAEA;;CAEC,GACD,MAAMC,gBAAYd,iBAAAA,EAAW;IAC3BK,MAAM;QACJU,YAAY;QACZC,cAAclB,kBAAAA,CAAOmB,kBAAkB;QACvCC,WAAW;QACXC,WAAWrB,kBAAAA,CAAOsB,oBAAoB;QACtCC,SAAS;QACTC,qBAAqB;QACrBC,gBAAgB;QAChBC,UAAU;QACVC,UAAU;QACVC,eAAe;QAEf,6CAA6C;QAC7C,iBAAiB;YACfC,cAAc;YACdC,cAAc;YACdC,cAAc;QAChB;QAEA,iEAAiE;QACjE,WAAW;YACTX,WAAW;YACXY,SAAS;YACTL,UAAU;YACVM,MAA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DAAoD;QACpDqG,MAAMrG,OAAO,CAAC6G,SAAS,OAAGrH,mBAAAA,EACxBG,mBAAmBK,OAAO,EAC1B0G,OAAO1G,OAAO,EACdqG,MAAMS,WAAW,IAAIJ,OAAO5D,aAAa,EACzC,CAACyD,QAAQG,OAAO7D,gBAAgB,EAChCwD,MAAMrG,OAAO,CAAC6G,SAAS;IAE3B;IAEA,IAAIR,MAAMvG,UAAU,EAAE;QACpB,oDAAoD;QACpDuG,MAAMvG,UAAU,CAAC+G,SAAS,OAAGrH,mBAAAA,EAC3BG,mBAAmBG,UAAU,EAC7B6G,WAAWlB,IAAI,EACfkB,UAAU,CAACH,KAAK,EAChBhC,YAAYmC,WAAWnC,QAAQ,EAC/BiC,iBAAiBE,WAAWb,cAAc,EAC1CO,MAAMvG,UAAU,CAAC+G,SAAS;IAE9B;IAEA,IAAIR,MAAMtG,SAAS,EAAE;QACnB,oDAAoD;QACpDsG,MAAMtG,SAAS,CAAC8G,SAAS,OAAGrH,mBAAAA,EAC1BG,mBAAmBI,SAAS,EAC5B4G,WAAWlB,IAAI,EACfkB,UAAU,CAACH,KAAK,EAChBhC,YAAYmC,WAAWnC,QAAQ,EAC/B,CAACiC,iBAAiBE,WAAWd,MAAM,EACnCQ,MAAMtG,SAAS,CAAC8G,SAAS;IAE7B;IAEA,OAAOR;AACT,EAAE"}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Combobox/useComboboxStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport { tokens, typographyStyles } from '@fluentui/react-theme';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport { makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport { iconSizes } from '../../utils/internalTokens';\nimport type { ComboboxSlots, ComboboxState } from './Combobox.types';\n\nexport const comboboxClassNames: SlotClassNames<ComboboxSlots> = {\n root: 'fui-Combobox',\n input: 'fui-Combobox__input',\n expandIcon: 'fui-Combobox__expandIcon',\n clearIcon: 'fui-Combobox__clearIcon',\n listbox: 'fui-Combobox__listbox',\n};\n\n// Matches internal heights for Select and Input, but there are no theme variables for these\nconst fieldHeights = {\n small: '24px',\n medium: '32px',\n large: '40px',\n};\n\n/**\n * Styles for Combobox\n */\nconst useStyles = makeStyles({\n root: {\n alignItems: 'center',\n borderRadius: tokens.borderRadiusMedium,\n boxSizing: 'border-box',\n columnGap: tokens.spacingHorizontalXXS,\n display: 'inline-grid',\n gridTemplateColumns: '1fr auto',\n justifyContent: 'space-between',\n minWidth: '250px',\n position: 'relative',\n verticalAlign: 'middle',\n\n // windows high contrast mode focus indicator\n ':focus-within': {\n outlineWidth: '2px',\n outlineStyle: 'solid',\n outlineColor: 'transparent',\n },\n\n // bottom focus border, shared with Input, Select, and SpinButton\n '::after': {\n boxSizing: 'border-box',\n content: '\"\"',\n position: 'absolute',\n left: '-1px',\n bottom: '-1px',\n right: '-1px',\n height: `max(2px, ${tokens.borderRadiusMedium})`,\n borderBottomLeftRadius: tokens.borderRadiusMedium,\n borderBottomRightRadius: tokens.borderRadiusMedium,\n borderBottom: `${tokens.strokeWidthThick} solid ${tokens.colorCompoundBrandStroke}`,\n clipPath: 'inset(calc(100% - 2px) 0 0 0)',\n transform: 'scaleX(0)',\n transitionProperty: 'transform',\n transitionDuration: tokens.durationUltraFast,\n transitionDelay: tokens.curveAccelerateMid,\n\n '@media screen and (prefers-reduced-motion: reduce)': {\n transitionDuration: '0.01ms',\n transitionDelay: '0.01ms',\n },\n },\n ':focus-within::after': {\n transform: 'scaleX(1)',\n transitionProperty: 'transform',\n transitionDuration: tokens.durationNormal,\n transitionDelay: tokens.curveDecelerateMid,\n\n '@media screen and (prefers-reduced-motion: reduce)': {\n transitionDuration: '0.01ms',\n transitionDelay: '0.01ms',\n },\n },\n ':focus-within:active::after': {\n borderBottomColor: tokens.colorCompoundBrandStrokePressed,\n },\n },\n\n listbox: {\n boxShadow: `${tokens.shadow16}`,\n borderRadius: tokens.borderRadiusMedium,\n maxHeight: '80vh',\n boxSizing: 'border-box',\n },\n\n listboxCollapsed: {\n display: 'none',\n },\n\n // When rendering inline, the popupSurface will be rendered under relatively positioned elements such as Input.\n // This is due to the surface being positioned as absolute, therefore zIndex: 1 ensures that won't happen.\n inlineListbox: {\n zIndex: 1,\n },\n\n // size variants\n small: {\n height: fieldHeights.small,\n paddingRight: tokens.spacingHorizontalSNudge,\n },\n medium: {\n height: fieldHeights.medium,\n paddingRight: tokens.spacingHorizontalMNudge,\n },\n large: {\n columnGap: tokens.spacingHorizontalSNudge,\n height: fieldHeights.large,\n paddingRight: tokens.spacingHorizontalM,\n },\n\n // appearance variants\n outline: {\n backgroundColor: tokens.colorNeutralBackground1,\n border: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralStroke1}`,\n borderBottomColor: tokens.colorNeutralStrokeAccessible,\n },\n outlineInteractive: {\n '&:hover': {\n ...shorthands.borderColor(tokens.colorNeutralStroke1Hover),\n borderBottomColor: tokens.colorNeutralStrokeAccessibleHover,\n },\n\n '&:active': {\n ...shorthands.borderColor(tokens.colorNeutralStroke1Pressed),\n borderBottomColor: tokens.colorNeutralStrokeAccessiblePressed,\n },\n\n '&:focus-within': {\n ...shorthands.borderColor(tokens.colorNeutralStroke1Pressed),\n borderBottomColor: tokens.colorNeutralStrokeAccessiblePressed,\n },\n },\n underline: {\n backgroundColor: tokens.colorTransparentBackground,\n borderBottom: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralStrokeAccessible}`,\n borderRadius: '0',\n },\n 'filled-lighter': {\n backgroundColor: tokens.colorNeutralBackground1,\n border: `${tokens.strokeWidthThin} solid ${tokens.colorTransparentStroke}`,\n },\n 'filled-darker': {\n backgroundColor: tokens.colorNeutralBackground3,\n border: `${tokens.strokeWidthThin} solid ${tokens.colorTransparentStroke}`,\n },\n invalid: {\n ':not(:focus-within),:hover:not(:focus-within)': {\n ...shorthands.borderColor(tokens.colorPaletteRedBorder2),\n },\n },\n invalidUnderline: {\n ':not(:focus-within),:hover:not(:focus-within)': {\n borderBottomColor: tokens.colorPaletteRedBorder2,\n },\n },\n\n disabled: {\n cursor: 'not-allowed',\n backgroundColor: tokens.colorTransparentBackground,\n ...shorthands.borderColor(tokens.colorNeutralStrokeDisabled),\n '@media (forced-colors: active)': {\n ...shorthands.borderColor('GrayText'),\n },\n },\n});\n\nconst useInputStyles = makeStyles({\n input: {\n alignSelf: 'stretch',\n backgroundColor: tokens.colorTransparentBackground,\n border: 'none',\n color: tokens.colorNeutralForeground1,\n fontFamily: tokens.fontFamilyBase,\n\n '&:focus': {\n outlineStyle: 'none',\n },\n\n '&::placeholder': {\n color: tokens.colorNeutralForeground4,\n opacity: 1,\n },\n },\n\n // size variants\n small: {\n ...typographyStyles.caption1,\n padding: `0 0 0 ${`calc(${tokens.spacingHorizontalSNudge} + ${tokens.spacingHorizontalXXS})`}`,\n },\n medium: {\n ...typographyStyles.body1,\n padding: `0 0 0 ${`calc(${tokens.spacingHorizontalMNudge} + ${tokens.spacingHorizontalXXS})`}`,\n },\n large: {\n ...typographyStyles.body2,\n padding: `0 0 0 ${`calc(${tokens.spacingHorizontalM} + ${tokens.spacingHorizontalSNudge})`}`,\n },\n disabled: {\n color: tokens.colorNeutralForegroundDisabled,\n backgroundColor: tokens.colorTransparentBackground,\n cursor: 'not-allowed',\n '::placeholder': {\n color: tokens.colorNeutralForegroundDisabled,\n },\n },\n});\n\nconst useIconStyles = makeStyles({\n icon: {\n boxSizing: 'border-box',\n color: tokens.colorNeutralStrokeAccessible,\n cursor: 'pointer',\n display: 'block',\n fontSize: tokens.fontSizeBase500,\n // position: relative provides the containing block for the ::after clickable-area extension below.\n position: 'relative',\n\n // the SVG must have display: block for accurate positioning\n // otherwise an extra inline space is inserted after the svg element\n '& svg': {\n display: 'block',\n },\n\n // Extend the clickable area to cover the root's right paddingRight \"dead zone\".\n // Without this, clicking between the icon and the right border does not trigger the icon's handler.\n // The negative `right` is overridden per size variant below to match the root's paddingRight.\n '::after': {\n content: '\"\"',\n position: 'absolute',\n top: 0,\n bottom: 0,\n left: 0,\n right: 0,\n },\n },\n hidden: {\n display: 'none',\n },\n visuallyHidden: {\n clip: 'rect(0px, 0px, 0px, 0px)',\n height: '1px',\n margin: '-1px',\n overflow: 'hidden',\n padding: '0px',\n width: '1px',\n position: 'absolute',\n },\n\n // icon size variants\n small: {\n fontSize: iconSizes.small,\n marginLeft: tokens.spacingHorizontalXXS,\n '::after': {\n right: `calc(-1 * ${tokens.spacingHorizontalSNudge})`,\n },\n },\n medium: {\n fontSize: iconSizes.medium,\n marginLeft: tokens.spacingHorizontalXXS,\n '::after': {\n right: `calc(-1 * ${tokens.spacingHorizontalMNudge})`,\n },\n },\n large: {\n fontSize: iconSizes.large,\n marginLeft: tokens.spacingHorizontalSNudge,\n '::after': {\n right: `calc(-1 * ${tokens.spacingHorizontalM})`,\n },\n },\n disabled: {\n color: tokens.colorNeutralForegroundDisabled,\n cursor: 'not-allowed',\n },\n});\n\n/**\n * Apply styling to the Combobox slots based on the state\n */\nexport const useComboboxStyles_unstable = (state: ComboboxState): ComboboxState => {\n const { appearance, open, size, showClearIcon } = state;\n const invalid = `${state.input['aria-invalid']}` === 'true';\n const disabled = state.input.disabled;\n const styles = useStyles();\n const iconStyles = useIconStyles();\n const inputStyles = useInputStyles();\n\n // eslint-disable-next-line react-hooks/immutability\n state.root.className = mergeClasses(\n comboboxClassNames.root,\n styles.root,\n styles[appearance],\n styles[size],\n !disabled && appearance === 'outline' && styles.outlineInteractive,\n invalid && appearance !== 'underline' && styles.invalid,\n invalid && appearance === 'underline' && styles.invalidUnderline,\n disabled && styles.disabled,\n state.root.className,\n );\n\n // eslint-disable-next-line react-hooks/immutability\n state.input.className = mergeClasses(\n comboboxClassNames.input,\n inputStyles.input,\n inputStyles[size],\n disabled && inputStyles.disabled,\n state.input.className,\n );\n\n if (state.listbox) {\n // eslint-disable-next-line react-hooks/immutability\n state.listbox.className = mergeClasses(\n comboboxClassNames.listbox,\n styles.listbox,\n state.inlinePopup && styles.inlineListbox,\n !open && styles.listboxCollapsed,\n state.listbox.className,\n );\n }\n\n if (state.expandIcon) {\n // eslint-disable-next-line react-hooks/immutability\n state.expandIcon.className = mergeClasses(\n comboboxClassNames.expandIcon,\n iconStyles.icon,\n iconStyles[size],\n disabled && iconStyles.disabled,\n showClearIcon && iconStyles.visuallyHidden,\n state.expandIcon.className,\n );\n }\n\n if (state.clearIcon) {\n // eslint-disable-next-line react-hooks/immutability\n state.clearIcon.className = mergeClasses(\n comboboxClassNames.clearIcon,\n iconStyles.icon,\n iconStyles[size],\n disabled && iconStyles.disabled,\n !showClearIcon && iconStyles.hidden,\n state.clearIcon.className,\n );\n }\n\n return state;\n};\n"],"names":["tokens","typographyStyles","makeStyles","mergeClasses","shorthands","iconSizes","comboboxClassNames","root","input","expandIcon","clearIcon","listbox","fieldHeights","small","medium","large","useStyles","alignItems","borderRadius","borderRadiusMedium","boxSizing","columnGap","spacingHorizontalXXS","display","gridTemplateColumns","justifyContent","minWidth","position","verticalAlign","outlineWidth","outlineStyle","outlineColor","content","left","bottom","right","height","borderBottomLeftRadius","borderBottomRightRadius","borderBottom","strokeWidthThick","colorCompoundBrandStroke","clipPath","transform","transitionProperty","transitionDuration","durationUltraFast","transitionDelay","curveAccelerateMid","durationNormal","curveDecelerateMid","borderBottomColor","colorCompoundBrandStrokePressed","boxShadow","shadow16","maxHeight","listboxCollapsed","inlineListbox","zIndex","paddingRight","spacingHorizontalSNudge","spacingHorizontalMNudge","spacingHorizontalM","outline","backgroundColor","colorNeutralBackground1","border","strokeWidthThin","colorNeutralStroke1","colorNeutralStrokeAccessible","outlineInteractive","borderColor","colorNeutralStroke1Hover","colorNeutralStrokeAccessibleHover","colorNeutralStroke1Pressed","colorNeutralStrokeAccessiblePressed","underline","colorTransparentBackground","colorTransparentStroke","colorNeutralBackground3","invalid","colorPaletteRedBorder2","invalidUnderline","disabled","cursor","colorNeutralStrokeDisabled","useInputStyles","alignSelf","color","colorNeutralForeground1","fontFamily","fontFamilyBase","colorNeutralForeground4","opacity","caption1","padding","body1","body2","colorNeutralForegroundDisabled","useIconStyles","icon","fontSize","fontSizeBase500","top","hidden","visuallyHidden","clip","margin","overflow","width","marginLeft","useComboboxStyles_unstable","state","appearance","open","size","showClearIcon","styles","iconStyles","inputStyles","className","inlinePopup"],"mappings":"AAAA;;;;;;;;;;;;QAQaM;;;QAsRAyG;;;;4BA5R4B,wBAAwB;uBAEZ,iBAAiB;gCAC5C,gCAA6B;AAGhD,2BAA0D;IAC/DxG,MAAM;IACNC,OAAO;IACPC,YAAY;IACZC,WAAW;IACXC,SAAS;AACX,EAAE;AAEF,4FAA4F;AAC5F,MAAMC,eAAe;IACnBC,OAAO;IACPC,QAAQ;IACRC,OAAO;AACT;AAEA;;CAEC,GACD,MAAMC,gBAAYd,iBAAAA,EAAW;IAC3BK,MAAM;QACJU,YAAY;QACZC,cAAclB,kBAAAA,CAAOmB,kBAAkB;QACvCC,WAAW;QACXC,WAAWrB,kBAAAA,CAAOsB,oBAAoB;QACtCC,SAAS;QACTC,qBAAqB;QACrBC,gBAAgB;QAChBC,UAAU;QACVC,UAAU;QACVC,eAAe;QAEf,6CAA6C;QAC7C,iBAAiB;YACfC,cAAc;YACdC,cAAc;YACdC,cAAc;QAChB;QAEA,iEAAiE;QACjE,WAAW;YACTX,WAAW;YACXY,SAAS;YACTL,UAAU;YACVM,MAAM;YACNC,QAAQ;YACRC,OAAO;YACPC,QAAQ,CAAC,SAAS,EAAEpC,kBAAAA,CAAOmB,kBAAkB,CAAC,CAAC,CAAC;YAChDkB,wBAAwBrC,kBAAAA,CAAOmB,kBAAkB;YACjDmB,yBAAyBtC,kBAAAA,CAAOmB,kBAAkB;YAClDoB,cAAc,GAAGvC,kBAAAA,CAAOwC,gBAAgB,CAAC,OAAO,EAAExC,kBAAAA,CAAOyC,wBAAwB,EAAE;YACnFC,UAAU;YACVC,WAAW;YACXC,oBAAoB;YACpBC,oBAAoB7C,kBAAAA,CAAO8C,iBAAiB;YAC5CC,iBAAiB/C,kBAAAA,CAAOgD,kBAAk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YAAYmC,WAAWnC,QAAQ,EAC/BiC,iBAAiBE,WAAWb,cAAc,EAC1CO,MAAMvG,UAAU,CAAC+G,SAAS;IAE9B;IAEA,IAAIR,MAAMtG,SAAS,EAAE;QACnB,oDAAoD;QACpDsG,MAAMtG,SAAS,CAAC8G,SAAS,OAAGrH,mBAAAA,EAC1BG,mBAAmBI,SAAS,EAC5B4G,WAAWlB,IAAI,EACfkB,UAAU,CAACH,KAAK,EAChBhC,YAAYmC,WAAWnC,QAAQ,EAC/B,CAACiC,iBAAiBE,WAAWd,MAAM,EACnCQ,MAAMtG,SAAS,CAAC8G,SAAS;IAE7B;IAEA,OAAOR;AACT,EAAE"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
get comboboxClassNames () {
|
|
13
|
+
return comboboxClassNames;
|
|
14
|
+
},
|
|
15
|
+
get useComboboxStyles_unstable () {
|
|
16
|
+
return useComboboxStyles_unstable;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
|
20
|
+
const _clsx = require("clsx");
|
|
21
|
+
const _Comboboxmodulecss = /*#__PURE__*/ _interop_require_default._(require("./Combobox.module.css"));
|
|
22
|
+
const comboboxClassNames = {
|
|
23
|
+
root: 'fui-Combobox',
|
|
24
|
+
input: 'fui-Combobox__input',
|
|
25
|
+
expandIcon: 'fui-Combobox__expandIcon',
|
|
26
|
+
clearIcon: 'fui-Combobox__clearIcon',
|
|
27
|
+
listbox: 'fui-Combobox__listbox'
|
|
28
|
+
};
|
|
29
|
+
const useComboboxStyles_unstable = (state)=>{
|
|
30
|
+
const invalid = `${state.input['aria-invalid']}` === 'true';
|
|
31
|
+
const disabled = state.input.disabled;
|
|
32
|
+
state.root.className = (0, _clsx.clsx)(comboboxClassNames.root, _Comboboxmodulecss.default.root, _Comboboxmodulecss.default[state.appearance], _Comboboxmodulecss.default[state.size], invalid && _Comboboxmodulecss.default.invalid, disabled && _Comboboxmodulecss.default.disabled, state.root.className);
|
|
33
|
+
state.input.className = (0, _clsx.clsx)(comboboxClassNames.input, _Comboboxmodulecss.default.input, state.input.className);
|
|
34
|
+
if (state.listbox) {
|
|
35
|
+
state.listbox.className = (0, _clsx.clsx)(comboboxClassNames.listbox, _Comboboxmodulecss.default.listbox, state.inlinePopup && _Comboboxmodulecss.default.inline, !state.open && _Comboboxmodulecss.default.collapsed, state.listbox.className);
|
|
36
|
+
}
|
|
37
|
+
if (state.expandIcon) {
|
|
38
|
+
state.expandIcon.className = (0, _clsx.clsx)(comboboxClassNames.expandIcon, _Comboboxmodulecss.default.icon, state.showClearIcon && _Comboboxmodulecss.default.visuallyHidden, state.expandIcon.className);
|
|
39
|
+
}
|
|
40
|
+
if (state.clearIcon) {
|
|
41
|
+
state.clearIcon.className = (0, _clsx.clsx)(comboboxClassNames.clearIcon, _Comboboxmodulecss.default.icon, !state.showClearIcon && _Comboboxmodulecss.default.hidden, state.clearIcon.className);
|
|
42
|
+
}
|
|
43
|
+
return state;
|
|
44
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Combobox/useComboboxStyles.styles.css.ts"],"sourcesContent":["import { clsx } from 'clsx';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { ComboboxSlots, ComboboxState } from './Combobox.types';\nimport styles from './Combobox.module.css';\n\nexport const comboboxClassNames: SlotClassNames<ComboboxSlots> = {\n root: 'fui-Combobox',\n input: 'fui-Combobox__input',\n expandIcon: 'fui-Combobox__expandIcon',\n clearIcon: 'fui-Combobox__clearIcon',\n listbox: 'fui-Combobox__listbox',\n};\n\nexport const useComboboxStyles_unstable = (state: ComboboxState): ComboboxState => {\n const invalid = `${state.input['aria-invalid']}` === 'true';\n const disabled = state.input.disabled;\n state.root.className = clsx(\n comboboxClassNames.root,\n styles.root,\n styles[state.appearance],\n styles[state.size],\n invalid && styles.invalid,\n disabled && styles.disabled,\n state.root.className,\n );\n state.input.className = clsx(comboboxClassNames.input, styles.input, state.input.className);\n if (state.listbox) {\n state.listbox.className = clsx(\n comboboxClassNames.listbox,\n styles.listbox,\n state.inlinePopup && styles.inline,\n !state.open && styles.collapsed,\n state.listbox.className,\n );\n }\n if (state.expandIcon) {\n state.expandIcon.className = clsx(\n comboboxClassNames.expandIcon,\n styles.icon,\n state.showClearIcon && styles.visuallyHidden,\n state.expandIcon.className,\n );\n }\n if (state.clearIcon) {\n state.clearIcon.className = clsx(\n comboboxClassNames.clearIcon,\n styles.icon,\n !state.showClearIcon && styles.hidden,\n state.clearIcon.className,\n );\n }\n return state;\n};\n"],"names":["clsx","styles","comboboxClassNames","root","input","expandIcon","clearIcon","listbox","useComboboxStyles_unstable","state","invalid","disabled","className","appearance","size","inlinePopup","inline","open","collapsed","icon","showClearIcon","visuallyHidden","hidden"],"mappings":";;;;;;;;;;;QAKaE;;;QAQAM;;;;;sBAbQ,OAAO;4EAGT,wBAAwB;AAEpC,2BAA0D;IAC/DL,MAAM;IACNC,OAAO;IACPC,YAAY;IACZC,WAAW;IACXC,SAAS;AACX,EAAE;AAEK,mCAAmC,CAACE;IACzC,MAAMC,UAAU,GAAGD,MAAML,KAAK,CAAC,eAAe,EAAE,KAAK;IACrD,MAAMO,WAAWF,MAAML,KAAK,CAACO,QAAQ;IACrCF,MAAMN,IAAI,CAACS,SAAS,OAAGZ,UAAAA,EACrBE,mBAAmBC,IAAI,EACvBF,0BAAAA,CAAOE,IAAI,EACXF,0BAAM,CAACQ,MAAMI,UAAU,CAAC,EACxBZ,0BAAM,CAACQ,MAAMK,IAAI,CAAC,EAClBJ,WAAWT,0BAAAA,CAAOS,OAAO,EACzBC,YAAYV,0BAAAA,CAAOU,QAAQ,EAC3BF,MAAMN,IAAI,CAACS,SAAS;IAEtBH,MAAML,KAAK,CAACQ,SAAS,GAAGZ,cAAAA,EAAKE,mBAAmBE,KAAK,EAAEH,0BAAAA,CAAOG,KAAK,EAAEK,MAAML,KAAK,CAACQ,SAAS;IAC1F,IAAIH,MAAMF,OAAO,EAAE;QACjBE,MAAMF,OAAO,CAACK,SAAS,OAAGZ,UAAAA,EACxBE,mBAAmBK,OAAO,EAC1BN,0BAAAA,CAAOM,OAAO,EACdE,MAAMM,WAAW,IAAId,0BAAAA,CAAOe,MAAM,EAClC,CAACP,MAAMQ,IAAI,IAAIhB,0BAAAA,CAAOiB,SAAS,EAC/BT,MAAMF,OAAO,CAACK,SAAS;IAE3B;IACA,IAAIH,MAAMJ,UAAU,EAAE;QACpBI,MAAMJ,UAAU,CAACO,SAAS,OAAGZ,UAAAA,EAC3BE,mBAAmBG,UAAU,EAC7BJ,0BAAAA,CAAOkB,IAAI,EACXV,MAAMW,aAAa,IAAInB,0BAAAA,CAAOoB,cAAc,EAC5CZ,MAAMJ,UAAU,CAACO,SAAS;IAE9B;IACA,IAAIH,MAAMH,SAAS,EAAE;QACnBG,MAAMH,SAAS,CAACM,SAAS,OAAGZ,UAAAA,EAC1BE,mBAAmBI,SAAS,EAC5BL,0BAAAA,CAAOkB,IAAI,EACX,CAACV,MAAMW,aAAa,IAAInB,0BAAAA,CAAOqB,MAAM,EACrCb,MAAMH,SAAS,CAACM,SAAS;IAE7B;IACA,OAAOH;AACT,EAAE"}
|
|
@@ -16,7 +16,7 @@ const _keyboardkeys = require("@fluentui/keyboard-keys");
|
|
|
16
16
|
const _useTriggerSlot = require("../../utils/useTriggerSlot.cjs");
|
|
17
17
|
const _dropdownKeyActions = require("../../utils/dropdownKeyActions.cjs");
|
|
18
18
|
function useInputTriggerSlot(triggerFromProps, ref, options) {
|
|
19
|
-
const { state: { open, value, selectOption, setValue, multiselect, selectedOptions, clearSelection, getOptionById, setOpen }, freeform, defaultProps, activeDescendantController } = options;
|
|
19
|
+
const { state: { open, value, selectOption, setValue, multiselect, selectedOptions, clearSelection, getOptionById, setOpen }, freeform, defaultProps, activeDescendantController, shouldCloseOnBlur } = options;
|
|
20
20
|
const onBlur = (event)=>{
|
|
21
21
|
// handle selection and updating value if freeform is false
|
|
22
22
|
if (!open && !freeform) {
|
|
@@ -63,7 +63,8 @@ function useInputTriggerSlot(triggerFromProps, ref, options) {
|
|
|
63
63
|
state: options.state,
|
|
64
64
|
defaultProps,
|
|
65
65
|
elementType: 'input',
|
|
66
|
-
activeDescendantController
|
|
66
|
+
activeDescendantController,
|
|
67
|
+
shouldCloseOnBlur
|
|
67
68
|
});
|
|
68
69
|
// eslint-disable-next-line react-hooks/immutability
|
|
69
70
|
trigger.onChange = (0, _reactutilities.mergeCallbacks)(trigger.onChange, onChange);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Combobox/useInputTriggerSlot.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport type { ActiveDescendantImperativeRef } from '@fluentui/react-aria';\nimport { mergeCallbacks, useEventCallback } from '@fluentui/react-utilities';\nimport type { ExtractSlotProps, Slot, SlotComponentType } from '@fluentui/react-utilities';\nimport { ArrowLeft, ArrowRight } from '@fluentui/keyboard-keys';\nimport type { ComboboxProps } from '../Combobox/Combobox.types';\nimport type { UseTriggerSlotState } from '../../utils/useTriggerSlot';\nimport { useTriggerSlot } from '../../utils/useTriggerSlot';\nimport type { ComboboxBaseState } from '../../utils/ComboboxBase.types';\nimport type { OptionValue } from '../../utils/OptionCollection.types';\nimport { getDropdownActionFromKey } from '../../utils/dropdownKeyActions';\n\ntype UsedComboboxState = UseTriggerSlotState &\n Pick<ComboboxBaseState, 'value' | 'setValue' | 'selectedOptions' | 'clearSelection' | 'getOptionById'>;\n\ntype UseInputTriggerSlotOptions = {\n state: UsedComboboxState;\n freeform: boolean | undefined;\n defaultProps?: Partial<ComboboxProps>;\n activeDescendantController: ActiveDescendantImperativeRef;\n};\n\n/**\n * useInputTriggerSlot returns a tuple of trigger/listbox shorthand,\n * with the semantics and event handlers needed for the Combobox and Dropdown components.\n * The element type of the ref should always match the element type used in the trigger shorthand.\n *\n * @internal\n */\nexport function useInputTriggerSlot(\n triggerFromProps: NonNullable<Slot<'input'>>,\n ref: React.Ref<HTMLInputElement>,\n options: UseInputTriggerSlotOptions,\n): SlotComponentType<ExtractSlotProps<Slot<'input'>>> {\n const {\n state: {\n open,\n value,\n selectOption,\n setValue,\n multiselect,\n selectedOptions,\n clearSelection,\n getOptionById,\n setOpen,\n },\n freeform,\n defaultProps,\n activeDescendantController,\n } = options;\n\n const onBlur = (event: React.FocusEvent<HTMLInputElement>) => {\n // handle selection and updating value if freeform is false\n if (!open && !freeform) {\n const activeOptionId = activeDescendantController.active();\n const activeOption = activeOptionId ? getOptionById(activeOptionId) : null;\n // select matching option, if the value fully matches\n if (value && activeOption && value.trim().toLowerCase() === activeOption?.text.toLowerCase()) {\n selectOption(event, activeOption);\n }\n\n // reset typed value when the input loses focus while collapsed, unless freeform is true\n setValue(undefined);\n }\n };\n\n const getOptionFromInput = (inputValue: string): OptionValue | undefined => {\n const searchString = inputValue?.trim().toLowerCase();\n\n if (!searchString || searchString.length === 0) {\n activeDescendantController.blur();\n return;\n }\n\n const matcher = (optionText: string) => optionText.toLowerCase().indexOf(searchString) === 0;\n const match = activeDescendantController.find(id => {\n const option = getOptionById(id);\n return !!option && matcher(option.text);\n });\n\n if (!match) {\n activeDescendantController.blur();\n return undefined;\n }\n\n return getOptionById(match);\n };\n\n // update value and active option based on input\n const onChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n const inputValue = event.target.value;\n // update uncontrolled value\n setValue(inputValue);\n\n // handle updating active option based on input\n const matchingOption = getOptionFromInput(inputValue);\n\n // clear selection for single-select if the input value no longer matches the selection\n if (!multiselect && selectedOptions.length === 1 && (inputValue.length < 1 || !matchingOption)) {\n clearSelection(event);\n }\n };\n\n const trigger = useTriggerSlot(triggerFromProps, ref, {\n state: options.state,\n defaultProps,\n elementType: 'input',\n activeDescendantController,\n });\n\n // eslint-disable-next-line react-hooks/immutability\n trigger.onChange = mergeCallbacks(trigger.onChange, onChange);\n // eslint-disable-next-line react-hooks/immutability\n trigger.onBlur = mergeCallbacks(trigger.onBlur, onBlur);\n\n // NVDA and JAWS have bugs that suppress reading the input value text when aria-activedescendant is set\n // To prevent this, we clear the HTML attribute (but save the state) when a user presses left/right arrows\n // ref: https://github.com/microsoft/fluentui/issues/26359#issuecomment-1397759888\n const [hideActiveDescendant, setHideActiveDescendant] = React.useState(false);\n // save the typing vs. navigating options state, as the space key should behave differently in each case\n // we do not want to update the combobox when this changes, just save the value between renders\n const isTyping = React.useRef(false);\n\n /**\n * Freeform combobox should not select\n */\n const defaultOnKeyDown = trigger.onKeyDown;\n const onKeyDown = useEventCallback((event: React.KeyboardEvent<HTMLInputElement>) => {\n if (!open && getDropdownActionFromKey(event) === 'Type') {\n setOpen(event, true);\n }\n\n // clear activedescendant when moving the text insertion cursor\n if (event.key === ArrowLeft || event.key === ArrowRight) {\n setHideActiveDescendant(true);\n } else {\n setHideActiveDescendant(false);\n }\n\n // update typing state to true if the user is typing\n const action = getDropdownActionFromKey(event, { open, multiselect });\n if (action === 'Type') {\n isTyping.current = true;\n }\n // otherwise, update the typing state to false if opening or navigating dropdown options\n // other actions, like closing the dropdown, should not impact typing state.\n else if (\n (action === 'Open' && event.key !== ' ') ||\n action === 'Next' ||\n action === 'Previous' ||\n action === 'First' ||\n action === 'Last' ||\n action === 'PageUp' ||\n action === 'PageDown'\n ) {\n isTyping.current = false;\n }\n\n // allow space to insert a character if freeform & the last action was typing, or if the popup is closed\n if ((isTyping.current || !open) && event.key === ' ') {\n triggerFromProps?.onKeyDown?.(event);\n return;\n }\n\n defaultOnKeyDown?.(event);\n });\n\n // eslint-disable-next-line react-hooks/immutability\n trigger.onKeyDown = onKeyDown;\n\n if (hideActiveDescendant) {\n // eslint-disable-next-line react-hooks/immutability\n trigger['aria-activedescendant'] = undefined;\n }\n\n return trigger;\n}\n"],"names":["React","mergeCallbacks","useEventCallback","ArrowLeft","ArrowRight","useTriggerSlot","getDropdownActionFromKey","useInputTriggerSlot","triggerFromProps","ref","options","state","open","value","selectOption","setValue","multiselect","selectedOptions","clearSelection","getOptionById","setOpen","freeform","defaultProps","activeDescendantController","onBlur","event","activeOptionId","active","activeOption","trim","toLowerCase","text","undefined","getOptionFromInput","inputValue","searchString","length","blur","matcher","optionText","indexOf","match","find","id","option","onChange","target","matchingOption","trigger","elementType","hideActiveDescendant","setHideActiveDescendant","useState","isTyping","useRef","defaultOnKeyDown","onKeyDown","key","action","current"],"mappings":"AAAA;;;;;+BA+BgBO;;;;;;;iEA7BO,QAAQ;gCAEkB,4BAA4B;8BAEvC,0BAA0B;gCAGjC,gCAA6B;oCAGnB,oCAAiC;AAmBnE,6BACLC,gBAA4C,EAC5CC,GAAgC,EAChCC,OAAmC;IAEnC,MAAM,EACJC,OAAO,EACLC,IAAI,EACJC,KAAK,EACLC,YAAY,EACZC,QAAQ,EACRC,WAAW,EACXC,eAAe,EACfC,cAAc,EACdC,aAAa,EACbC,OAAO,EACR,EACDC,QAAQ,EACRC,YAAY,EACZC,0BAA0B,EAC3B,GAAGb;IAEJ,MAAMc,SAAS,CAACC;QACd,2DAA2D;QAC3D,IAAI,CAACb,QAAQ,CAACS,UAAU;YACtB,MAAMK,iBAAiBH,2BAA2BI,MAAM;YACxD,MAAMC,eAAeF,iBAAiBP,cAAcO,kBAAkB;YACtE,qDAAqD;YACrD,IAAIb,SAASe,gBAAgBf,MAAMgB,IAAI,GAAGC,WAAW,QAAOF,iBAAAA,QAAAA,iBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,aAAcG,IAAI,CAACD,WAAW,EAAA,GAAI;gBAC5FhB,aAAaW,OAAOG;YACtB;YAEA,wFAAwF;YACx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AAC,wBAAwB,GAAGhB;IACrC;IAEA,OAAOgB;AACT"}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Combobox/useInputTriggerSlot.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport type { ActiveDescendantImperativeRef } from '@fluentui/react-aria';\nimport { mergeCallbacks, useEventCallback } from '@fluentui/react-utilities';\nimport type { ExtractSlotProps, Slot, SlotComponentType } from '@fluentui/react-utilities';\nimport { ArrowLeft, ArrowRight } from '@fluentui/keyboard-keys';\nimport type { ComboboxProps } from '../Combobox/Combobox.types';\nimport type { UseTriggerSlotOptions, UseTriggerSlotState } from '../../utils/useTriggerSlot';\nimport { useTriggerSlot } from '../../utils/useTriggerSlot';\nimport type { ComboboxBaseState } from '../../utils/ComboboxBase.types';\nimport type { OptionValue } from '../../utils/OptionCollection.types';\nimport { getDropdownActionFromKey } from '../../utils/dropdownKeyActions';\n\ntype UsedComboboxState = UseTriggerSlotState &\n Pick<ComboboxBaseState, 'value' | 'setValue' | 'selectedOptions' | 'clearSelection' | 'getOptionById'>;\n\ntype UseInputTriggerSlotOptions = {\n state: UsedComboboxState;\n freeform: boolean | undefined;\n defaultProps?: Partial<ComboboxProps>;\n activeDescendantController: ActiveDescendantImperativeRef;\n shouldCloseOnBlur?: UseTriggerSlotOptions['shouldCloseOnBlur'];\n};\n\n/**\n * useInputTriggerSlot returns a tuple of trigger/listbox shorthand,\n * with the semantics and event handlers needed for the Combobox and Dropdown components.\n * The element type of the ref should always match the element type used in the trigger shorthand.\n *\n * @internal\n */\nexport function useInputTriggerSlot(\n triggerFromProps: NonNullable<Slot<'input'>>,\n ref: React.Ref<HTMLInputElement>,\n options: UseInputTriggerSlotOptions,\n): SlotComponentType<ExtractSlotProps<Slot<'input'>>> {\n const {\n state: {\n open,\n value,\n selectOption,\n setValue,\n multiselect,\n selectedOptions,\n clearSelection,\n getOptionById,\n setOpen,\n },\n freeform,\n defaultProps,\n activeDescendantController,\n shouldCloseOnBlur,\n } = options;\n\n const onBlur = (event: React.FocusEvent<HTMLInputElement>) => {\n // handle selection and updating value if freeform is false\n if (!open && !freeform) {\n const activeOptionId = activeDescendantController.active();\n const activeOption = activeOptionId ? getOptionById(activeOptionId) : null;\n // select matching option, if the value fully matches\n if (value && activeOption && value.trim().toLowerCase() === activeOption?.text.toLowerCase()) {\n selectOption(event, activeOption);\n }\n\n // reset typed value when the input loses focus while collapsed, unless freeform is true\n setValue(undefined);\n }\n };\n\n const getOptionFromInput = (inputValue: string): OptionValue | undefined => {\n const searchString = inputValue?.trim().toLowerCase();\n\n if (!searchString || searchString.length === 0) {\n activeDescendantController.blur();\n return;\n }\n\n const matcher = (optionText: string) => optionText.toLowerCase().indexOf(searchString) === 0;\n const match = activeDescendantController.find(id => {\n const option = getOptionById(id);\n return !!option && matcher(option.text);\n });\n\n if (!match) {\n activeDescendantController.blur();\n return undefined;\n }\n\n return getOptionById(match);\n };\n\n // update value and active option based on input\n const onChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n const inputValue = event.target.value;\n // update uncontrolled value\n setValue(inputValue);\n\n // handle updating active option based on input\n const matchingOption = getOptionFromInput(inputValue);\n\n // clear selection for single-select if the input value no longer matches the selection\n if (!multiselect && selectedOptions.length === 1 && (inputValue.length < 1 || !matchingOption)) {\n clearSelection(event);\n }\n };\n\n const trigger = useTriggerSlot(triggerFromProps, ref, {\n state: options.state,\n defaultProps,\n elementType: 'input',\n activeDescendantController,\n shouldCloseOnBlur,\n });\n\n // eslint-disable-next-line react-hooks/immutability\n trigger.onChange = mergeCallbacks(trigger.onChange, onChange);\n // eslint-disable-next-line react-hooks/immutability\n trigger.onBlur = mergeCallbacks(trigger.onBlur, onBlur);\n\n // NVDA and JAWS have bugs that suppress reading the input value text when aria-activedescendant is set\n // To prevent this, we clear the HTML attribute (but save the state) when a user presses left/right arrows\n // ref: https://github.com/microsoft/fluentui/issues/26359#issuecomment-1397759888\n const [hideActiveDescendant, setHideActiveDescendant] = React.useState(false);\n // save the typing vs. navigating options state, as the space key should behave differently in each case\n // we do not want to update the combobox when this changes, just save the value between renders\n const isTyping = React.useRef(false);\n\n /**\n * Freeform combobox should not select\n */\n const defaultOnKeyDown = trigger.onKeyDown;\n const onKeyDown = useEventCallback((event: React.KeyboardEvent<HTMLInputElement>) => {\n if (!open && getDropdownActionFromKey(event) === 'Type') {\n setOpen(event, true);\n }\n\n // clear activedescendant when moving the text insertion cursor\n if (event.key === ArrowLeft || event.key === ArrowRight) {\n setHideActiveDescendant(true);\n } else {\n setHideActiveDescendant(false);\n }\n\n // update typing state to true if the user is typing\n const action = getDropdownActionFromKey(event, { open, multiselect });\n if (action === 'Type') {\n isTyping.current = true;\n }\n // otherwise, update the typing state to false if opening or navigating dropdown options\n // other actions, like closing the dropdown, should not impact typing state.\n else if (\n (action === 'Open' && event.key !== ' ') ||\n action === 'Next' ||\n action === 'Previous' ||\n action === 'First' ||\n action === 'Last' ||\n action === 'PageUp' ||\n action === 'PageDown'\n ) {\n isTyping.current = false;\n }\n\n // allow space to insert a character if freeform & the last action was typing, or if the popup is closed\n if ((isTyping.current || !open) && event.key === ' ') {\n triggerFromProps?.onKeyDown?.(event);\n return;\n }\n\n defaultOnKeyDown?.(event);\n });\n\n // eslint-disable-next-line react-hooks/immutability\n trigger.onKeyDown = onKeyDown;\n\n if (hideActiveDescendant) {\n // eslint-disable-next-line react-hooks/immutability\n trigger['aria-activedescendant'] = undefined;\n }\n\n return trigger;\n}\n"],"names":["React","mergeCallbacks","useEventCallback","ArrowLeft","ArrowRight","useTriggerSlot","getDropdownActionFromKey","useInputTriggerSlot","triggerFromProps","ref","options","state","open","value","selectOption","setValue","multiselect","selectedOptions","clearSelection","getOptionById","setOpen","freeform","defaultProps","activeDescendantController","shouldCloseOnBlur","onBlur","event","activeOptionId","active","activeOption","trim","toLowerCase","text","undefined","getOptionFromInput","inputValue","searchString","length","blur","matcher","optionText","indexOf","match","find","id","option","onChange","target","matchingOption","trigger","elementType","hideActiveDescendant","setHideActiveDescendant","useState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OAAO;YACLA,wBAAwB;QAC1B;QAEA,oDAAoD;QACpD,MAAMO,SAASrD,gDAAAA,EAAyBoB,OAAO;YAAEd;YAAMI;QAAY;QACnE,IAAI2C,WAAW,QAAQ;YACrBL,SAASM,OAAO,GAAG;QACrB,OAGK,IACFD,WAAW,UAAUjC,MAAMgC,GAAG,KAAK,OACpCC,WAAW,UACXA,WAAW,cACXA,WAAW,WACXA,WAAW,UACXA,WAAW,YACXA,WAAW,YACX;YACAL,SAASM,OAAO,GAAG;QACrB;QAEA,wGAAwG;QACxG,IAAKN,CAAAA,SAASM,OAAO,IAAI,CAAChD,IAAAA,CAAG,IAAMc,MAAMgC,GAAG,KAAK,KAAK;gBACpDlD;YAAAA,qBAAAA,QAAAA,qBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,CAAAA,8BAAAA,iBAAkBiD,SAAAA,AAAS,MAAA,QAA3BjD,gCAAAA,KAAAA,IAAAA,KAAAA,IAAAA,4BAAAA,IAAAA,CAAAA,kBAA8BkB;YAC9B;QACF;QAEA8B,qBAAAA,QAAAA,qBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,iBAAmB9B;IACrB;IAEA,oDAAoD;IACpDuB,QAAQQ,SAAS,GAAGA;IAEpB,IAAIN,sBAAsB;QACxB,oDAAoD;QACpDF,OAAO,CAAC,wBAAwB,GAAGhB;IACrC;IAEA,OAAOgB;AACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Dropdown/Dropdown.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { useDropdown_unstable } from './useDropdown';\nimport { renderDropdown_unstable } from './renderDropdown';\nimport { useDropdownStyles_unstable } from './useDropdownStyles.styles';\nimport type { DropdownProps } from './Dropdown.types';\nimport { useComboboxContextValues } from '../../contexts/useComboboxContextValues';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\n\n/**\n * Dropdown component: a selection control that allows users to choose from a set of possible options\n */\nexport const Dropdown: ForwardRefComponent<DropdownProps> = React.forwardRef((props, ref) => {\n const state = useDropdown_unstable(props, ref);\n const contextValues = useComboboxContextValues(state);\n\n useDropdownStyles_unstable(state);\n\n useCustomStyleHook_unstable('useDropdownStyles_unstable')(state);\n\n return renderDropdown_unstable(state, contextValues);\n});\n\nDropdown.displayName = 'Dropdown';\n"],"names":["React","useDropdown_unstable","renderDropdown_unstable","useDropdownStyles_unstable","useComboboxContextValues","useCustomStyleHook_unstable","Dropdown","forwardRef","props","ref","state","contextValues","displayName"],"mappings":"AAAA;;;;;;;;;;;;iEAEuB,QAAQ;6BACM,mBAAgB;gCACb,sBAAmB;yCAChB,gCAA6B;0CAE/B,6CAA0C;qCAEvC,kCAAkC;AAKvE,MAAMM,WAAAA,WAAAA,GAA+CN,OAAMO,UAAU,CAAC,CAACC,OAAOC;IACnF,MAAMC,YAAQT,iCAAAA,EAAqBO,OAAOC;IAC1C,MAAME,oBAAgBP,kDAAAA,EAAyBM;QAE/CP,mDAAAA,EAA2BO;QAE3BL,gDAAAA,EAA4B,8BAA8BK;IAE1D,WAAOR,uCAAAA,EAAwBQ,OAAOC;AACxC,GAAG;AAEHL,SAASM,WAAW,GAAG"}
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
@layer fluentui {
|
|
2
|
+
.root {
|
|
3
|
+
border-radius: var(--borderRadiusMedium);
|
|
4
|
+
box-sizing: border-box;
|
|
5
|
+
display: inline-flex;
|
|
6
|
+
min-width: 250px;
|
|
7
|
+
position: relative;
|
|
8
|
+
vertical-align: middle;
|
|
9
|
+
}
|
|
10
|
+
.root:focus-within {
|
|
11
|
+
outline-width: 2px;
|
|
12
|
+
outline-style: solid;
|
|
13
|
+
outline-color: transparent;
|
|
14
|
+
}
|
|
15
|
+
.root::after {
|
|
16
|
+
box-sizing: border-box;
|
|
17
|
+
content: '';
|
|
18
|
+
position: absolute;
|
|
19
|
+
inset-inline-start: -1px;
|
|
20
|
+
bottom: -1px;
|
|
21
|
+
inset-inline-end: -1px;
|
|
22
|
+
height: max(var(--strokeWidthThick), var(--borderRadiusMedium));
|
|
23
|
+
border-bottom-left-radius: var(--borderRadiusMedium);
|
|
24
|
+
border-bottom-right-radius: var(--borderRadiusMedium);
|
|
25
|
+
border-bottom: var(--strokeWidthThick) solid var(--colorCompoundBrandStroke);
|
|
26
|
+
clip-path: inset(calc(100% - 2px) 0 0 0);
|
|
27
|
+
transform: scaleX(0);
|
|
28
|
+
transition-property: transform;
|
|
29
|
+
transition-duration: var(--durationUltraFast);
|
|
30
|
+
transition-delay: var(--curveAccelerateMid);
|
|
31
|
+
}
|
|
32
|
+
@media screen and (prefers-reduced-motion: reduce) {
|
|
33
|
+
.root::after {
|
|
34
|
+
transition-duration: 0.01ms;
|
|
35
|
+
transition-delay: 0.01ms;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
.root:focus-within::after {
|
|
39
|
+
transform: scaleX(1);
|
|
40
|
+
transition-property: transform;
|
|
41
|
+
transition-duration: var(--durationNormal);
|
|
42
|
+
transition-delay: var(--curveDecelerateMid);
|
|
43
|
+
}
|
|
44
|
+
@media screen and (prefers-reduced-motion: reduce) {
|
|
45
|
+
.root:focus-within::after {
|
|
46
|
+
transition-duration: 0.01ms;
|
|
47
|
+
transition-delay: 0.01ms;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
.root:focus-within:active::after {
|
|
51
|
+
border-bottom-color: var(--colorCompoundBrandStrokePressed);
|
|
52
|
+
}
|
|
53
|
+
@supports selector(:has(*)) {
|
|
54
|
+
.root:has(:global(.fui-Dropdown__clearButton):focus)::after {
|
|
55
|
+
border-bottom-color: initial;
|
|
56
|
+
transform: scaleX(0);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
.listbox {
|
|
60
|
+
box-sizing: border-box;
|
|
61
|
+
box-shadow: var(--shadow16);
|
|
62
|
+
border-radius: var(--borderRadiusMedium);
|
|
63
|
+
max-height: 80vh;
|
|
64
|
+
}
|
|
65
|
+
.collapsed {
|
|
66
|
+
display: none;
|
|
67
|
+
}
|
|
68
|
+
.inline {
|
|
69
|
+
z-index: 1;
|
|
70
|
+
}
|
|
71
|
+
.button {
|
|
72
|
+
align-items: center;
|
|
73
|
+
background-color: var(--colorTransparentBackground);
|
|
74
|
+
border: none;
|
|
75
|
+
box-sizing: border-box;
|
|
76
|
+
color: var(--colorNeutralForeground1);
|
|
77
|
+
column-gap: var(--spacingHorizontalXXS);
|
|
78
|
+
cursor: pointer;
|
|
79
|
+
display: grid;
|
|
80
|
+
font-family: var(--fontFamilyBase);
|
|
81
|
+
grid-template-columns: [content] 1fr [icon] auto [end];
|
|
82
|
+
justify-content: space-between;
|
|
83
|
+
text-align: left;
|
|
84
|
+
width: 100%;
|
|
85
|
+
}
|
|
86
|
+
.button:where(:dir(rtl)) {
|
|
87
|
+
text-align: right;
|
|
88
|
+
}
|
|
89
|
+
.button:focus {
|
|
90
|
+
outline-style: none;
|
|
91
|
+
}
|
|
92
|
+
:where(.placeholder) > .button {
|
|
93
|
+
color: var(--colorNeutralForeground4);
|
|
94
|
+
}
|
|
95
|
+
:where(.small) > .button {
|
|
96
|
+
font-family: var(--fontFamilyBase);
|
|
97
|
+
font-size: var(--fontSizeBase200);
|
|
98
|
+
font-weight: var(--fontWeightRegular);
|
|
99
|
+
line-height: var(--lineHeightBase200);
|
|
100
|
+
padding-block: calc(var(--spacingVerticalXS) - var(--strokeWidthThin));
|
|
101
|
+
padding-inline: calc(var(--spacingHorizontalSNudge) + var(--spacingHorizontalXXS)) var(--spacingHorizontalSNudge);
|
|
102
|
+
}
|
|
103
|
+
:where(.medium) > .button {
|
|
104
|
+
font-family: var(--fontFamilyBase);
|
|
105
|
+
font-size: var(--fontSizeBase300);
|
|
106
|
+
font-weight: var(--fontWeightRegular);
|
|
107
|
+
line-height: var(--lineHeightBase300);
|
|
108
|
+
padding-block: calc(var(--spacingVerticalSNudge) - var(--strokeWidthThin));
|
|
109
|
+
padding-inline: calc(var(--spacingHorizontalMNudge) + var(--spacingHorizontalXXS)) var(--spacingHorizontalMNudge);
|
|
110
|
+
}
|
|
111
|
+
:where(.large) > .button {
|
|
112
|
+
column-gap: var(--spacingHorizontalSNudge);
|
|
113
|
+
font-family: var(--fontFamilyBase);
|
|
114
|
+
font-size: var(--fontSizeBase400);
|
|
115
|
+
font-weight: var(--fontWeightRegular);
|
|
116
|
+
line-height: var(--lineHeightBase400);
|
|
117
|
+
padding-block: calc(var(--spacingVerticalS) - var(--strokeWidthThin));
|
|
118
|
+
padding-inline: calc(var(--spacingHorizontalM) + var(--spacingHorizontalSNudge)) var(--spacingHorizontalM);
|
|
119
|
+
}
|
|
120
|
+
.outline {
|
|
121
|
+
background-color: var(--colorNeutralBackground1);
|
|
122
|
+
border: var(--strokeWidthThin) solid var(--colorNeutralStroke1);
|
|
123
|
+
border-bottom-color: var(--colorNeutralStrokeAccessible);
|
|
124
|
+
}
|
|
125
|
+
.outline:where(:not(.disabled)):focus-within {
|
|
126
|
+
border-color: var(--colorNeutralStroke1Pressed);
|
|
127
|
+
border-bottom-color: var(--colorNeutralStrokeAccessiblePressed);
|
|
128
|
+
}
|
|
129
|
+
.outline:where(:not(.disabled)):hover {
|
|
130
|
+
border-color: var(--colorNeutralStroke1Hover);
|
|
131
|
+
border-bottom-color: var(--colorNeutralStrokeAccessibleHover);
|
|
132
|
+
}
|
|
133
|
+
.outline:where(:not(.disabled)):active {
|
|
134
|
+
border-color: var(--colorNeutralStroke1Pressed);
|
|
135
|
+
border-bottom-color: var(--colorNeutralStrokeAccessiblePressed);
|
|
136
|
+
}
|
|
137
|
+
.underline {
|
|
138
|
+
background-color: var(--colorTransparentBackground);
|
|
139
|
+
border-bottom: var(--strokeWidthThin) solid var(--colorNeutralStrokeAccessible);
|
|
140
|
+
border-radius: 0;
|
|
141
|
+
}
|
|
142
|
+
.filled-lighter {
|
|
143
|
+
background-color: var(--colorNeutralBackground1);
|
|
144
|
+
border: var(--strokeWidthThin) solid var(--colorTransparentStroke);
|
|
145
|
+
}
|
|
146
|
+
.filled-darker {
|
|
147
|
+
background-color: var(--colorNeutralBackground3);
|
|
148
|
+
border: var(--strokeWidthThin) solid var(--colorTransparentStroke);
|
|
149
|
+
}
|
|
150
|
+
.invalid:where(:not(.underline)):not(:focus-within),
|
|
151
|
+
.invalid:where(:not(.underline)):hover:not(:focus-within) {
|
|
152
|
+
border-color: var(--colorPaletteRedBorder2);
|
|
153
|
+
}
|
|
154
|
+
.invalid:where(.underline):not(:focus-within),
|
|
155
|
+
.invalid:where(.underline):hover:not(:focus-within) {
|
|
156
|
+
border-bottom-color: var(--colorPaletteRedBorder2);
|
|
157
|
+
}
|
|
158
|
+
.disabled {
|
|
159
|
+
cursor: not-allowed;
|
|
160
|
+
background-color: var(--colorTransparentBackground);
|
|
161
|
+
border-color: var(--colorNeutralStrokeDisabled);
|
|
162
|
+
}
|
|
163
|
+
@media (forced-colors: active) {
|
|
164
|
+
.disabled {
|
|
165
|
+
border-color: GrayText;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
:where(.disabled) > .button {
|
|
169
|
+
color: var(--colorNeutralForegroundDisabled);
|
|
170
|
+
cursor: not-allowed;
|
|
171
|
+
}
|
|
172
|
+
.clearButton {
|
|
173
|
+
align-self: center;
|
|
174
|
+
background-color: var(--colorTransparentBackground);
|
|
175
|
+
border: none;
|
|
176
|
+
cursor: pointer;
|
|
177
|
+
height: fit-content;
|
|
178
|
+
margin: 0;
|
|
179
|
+
margin-inline-end: var(--spacingHorizontalMNudge);
|
|
180
|
+
padding: 0;
|
|
181
|
+
position: relative;
|
|
182
|
+
}
|
|
183
|
+
.icon {
|
|
184
|
+
box-sizing: border-box;
|
|
185
|
+
color: var(--colorNeutralStrokeAccessible);
|
|
186
|
+
display: block;
|
|
187
|
+
font-size: var(--fontSizeBase500);
|
|
188
|
+
grid-column-start: icon;
|
|
189
|
+
grid-column-end: end;
|
|
190
|
+
}
|
|
191
|
+
.icon svg {
|
|
192
|
+
display: block;
|
|
193
|
+
}
|
|
194
|
+
:where(.small) > .button > .icon,
|
|
195
|
+
:where(.small) > .clearButton {
|
|
196
|
+
font-size: var(--fontSizeBase400);
|
|
197
|
+
margin-inline-start: var(--spacingHorizontalXXS);
|
|
198
|
+
}
|
|
199
|
+
:where(.medium) > .button > .icon,
|
|
200
|
+
:where(.medium) > .clearButton {
|
|
201
|
+
font-size: var(--fontSizeBase500);
|
|
202
|
+
margin-inline-start: var(--spacingHorizontalXXS);
|
|
203
|
+
}
|
|
204
|
+
:where(.large) > .button > .icon,
|
|
205
|
+
:where(.large) > .clearButton {
|
|
206
|
+
font-size: var(--fontSizeBase600);
|
|
207
|
+
margin-inline-start: var(--spacingHorizontalSNudge);
|
|
208
|
+
}
|
|
209
|
+
:where(.disabled) > .button > .icon,
|
|
210
|
+
:where(.disabled) > .clearButton {
|
|
211
|
+
color: var(--colorNeutralForegroundDisabled);
|
|
212
|
+
}
|
|
213
|
+
.clearButton:focus,
|
|
214
|
+
.clearButton:focus-visible {
|
|
215
|
+
outline-style: none;
|
|
216
|
+
}
|
|
217
|
+
.clearButton[data-fui-focus-visible] {
|
|
218
|
+
border-color: transparent;
|
|
219
|
+
}
|
|
220
|
+
.clearButton[data-fui-focus-visible]::after {
|
|
221
|
+
content: '';
|
|
222
|
+
position: absolute;
|
|
223
|
+
pointer-events: none;
|
|
224
|
+
z-index: 1;
|
|
225
|
+
border: 2px solid var(--colorStrokeFocus2);
|
|
226
|
+
border-radius: var(--borderRadiusMedium);
|
|
227
|
+
inset: calc(2px * -1);
|
|
228
|
+
}
|
|
229
|
+
@media (forced-colors: active) {
|
|
230
|
+
.clearButton[data-fui-focus-visible]::after {
|
|
231
|
+
border-color: Highlight;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
.hidden {
|
|
235
|
+
display: none;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Dropdown/Dropdown.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, DistributiveOmit, Slot } from '@fluentui/react-utilities';\nimport type { ActiveDescendantImperativeRef } from '@fluentui/react-aria';\nimport type {\n ActiveOptionChangeData as ComboboxBaseActiveOptionChangeData,\n ComboboxBaseContextValues,\n ComboboxBaseOpenChangeData,\n ComboboxBaseOpenEvents,\n ComboboxBaseProps,\n ComboboxBaseState,\n} from '../../utils/ComboboxBase.types';\nimport type { Listbox } from '../Listbox/Listbox';\n\nexport type DropdownSlots = {\n /** The root dropdown slot */\n root: NonNullable<Slot<'div'>>;\n\n /** The dropdown arrow icon */\n expandIcon?: Slot<'span'>;\n\n /** The dropdown clear icon */\n clearButton?: Slot<'button'>;\n\n /** The primary slot, the element with role=\"combobox\" */\n button: NonNullable<Slot<'button'>>;\n\n /** The dropdown listbox slot */\n listbox?: Slot<typeof Listbox>;\n};\n\n/**\n * Dropdown Props\n */\nexport type DropdownProps = ComponentProps<Partial<DropdownSlots>, 'button'> & ComboboxBaseProps;\n\n/**\n * Dropdown Props without design-only props.\n */\nexport type DropdownBaseProps = DistributiveOmit<DropdownProps, 'appearance' | 'size'>;\n\n/**\n * State used in rendering Dropdown\n */\nexport type DropdownState = ComponentState<DropdownSlots> &\n Omit<ComboboxBaseState, 'freeform'> & {\n /** Whether the placeholder is currently displayed */\n placeholderVisible: boolean;\n\n showClearButton?: boolean;\n\n activeDescendantController: ActiveDescendantImperativeRef;\n };\n\n/**\n * State used in rendering Dropdown, without design-only state.\n */\nexport type DropdownBaseState = DistributiveOmit<DropdownState, 'appearance' | 'size'>;\n\n/* Export types defined in ComboboxBase */\nexport type DropdownContextValues = ComboboxBaseContextValues;\nexport type DropdownOpenEvents = ComboboxBaseOpenEvents;\nexport type DropdownOpenChangeData = ComboboxBaseOpenChangeData;\nexport type ActiveOptionChangeData = ComboboxBaseActiveOptionChangeData;\n"],"names":[],"mappings":""}
|
|
@@ -5,26 +5,26 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
function _export(target, all) {
|
|
6
6
|
for(var name in all)Object.defineProperty(target, name, {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: all
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
Dropdown
|
|
12
|
+
get Dropdown () {
|
|
13
13
|
return _Dropdown.Dropdown;
|
|
14
14
|
},
|
|
15
|
-
dropdownClassNames
|
|
15
|
+
get dropdownClassNames () {
|
|
16
16
|
return _useDropdownStylesstyles.dropdownClassNames;
|
|
17
17
|
},
|
|
18
|
-
renderDropdown_unstable
|
|
18
|
+
get renderDropdown_unstable () {
|
|
19
19
|
return _renderDropdown.renderDropdown_unstable;
|
|
20
20
|
},
|
|
21
|
-
useDropdownBase_unstable
|
|
21
|
+
get useDropdownBase_unstable () {
|
|
22
22
|
return _useDropdown.useDropdownBase_unstable;
|
|
23
23
|
},
|
|
24
|
-
useDropdownStyles_unstable
|
|
24
|
+
get useDropdownStyles_unstable () {
|
|
25
25
|
return _useDropdownStylesstyles.useDropdownStyles_unstable;
|
|
26
26
|
},
|
|
27
|
-
useDropdown_unstable
|
|
27
|
+
get useDropdown_unstable () {
|
|
28
28
|
return _useDropdown.useDropdown_unstable;
|
|
29
29
|
}
|
|
30
30
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Dropdown/index.ts"],"sourcesContent":["export { Dropdown } from './Dropdown';\nexport type {\n ActiveOptionChangeData,\n DropdownBaseProps as DropdownBaseHookProps,\n DropdownBaseState as DropdownBaseHookState,\n DropdownContextValues,\n DropdownOpenChangeData,\n DropdownOpenEvents,\n DropdownProps,\n DropdownSlots,\n DropdownState,\n} from './Dropdown.types';\nexport { renderDropdown_unstable } from './renderDropdown';\nexport { useDropdownBase_unstable, useDropdown_unstable } from './useDropdown';\nexport { dropdownClassNames, useDropdownStyles_unstable } from './useDropdownStyles.styles';\n"],"names":["Dropdown","renderDropdown_unstable","useDropdownBase_unstable","useDropdown_unstable","dropdownClassNames","useDropdownStyles_unstable"],"mappings":";;;;;;;;;;;;eAASA,kBAAQ;;;eAcRI,2CAAkB;;;eAFlBH,uCAAuB;;;eACvBC,qCAAwB;;;eACJG,mDAA0B;;;eADpBF,iCAAoB;;;0BAb9B,gBAAa;gCAYE,sBAAmB;6BACI,mBAAgB;yCAChB,gCAA6B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Dropdown/renderDropdown.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { Portal } from '@fluentui/react-portal';\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport { ActiveDescendantContextProvider } from '@fluentui/react-aria';\nimport { ComboboxContext } from '../../contexts/ComboboxContext';\nimport type { DropdownContextValues, DropdownState, DropdownSlots } from './Dropdown.types';\nimport { ListboxContext } from '../../contexts/ListboxContext';\n\n/**\n * Render the final JSX of Dropdown\n */\nexport const renderDropdown_unstable = (state: DropdownState, contextValues: DropdownContextValues): JSXElement => {\n assertSlots<DropdownSlots>(state);\n\n return (\n <state.root>\n <ActiveDescendantContextProvider value={contextValues.activeDescendant}>\n <ListboxContext.Provider value={contextValues.listbox}>\n {/*eslint-disable-next-line @typescript-eslint/no-deprecated*/}\n <ComboboxContext.Provider value={contextValues.combobox}>\n <state.button>\n {state.button.children}\n {state.expandIcon && <state.expandIcon />}\n </state.button>\n {state.clearButton && <state.clearButton />}\n {state.listbox &&\n (state.inlinePopup ? (\n <state.listbox />\n ) : (\n <Portal mountNode={state.mountNode}>\n <state.listbox />\n </Portal>\n ))}\n {/*eslint-disable-next-line @typescript-eslint/no-deprecated*/}\n </ComboboxContext.Provider>\n </ListboxContext.Provider>\n </ActiveDescendantContextProvider>\n </state.root>\n );\n};\n"],"names":["Portal","assertSlots","ActiveDescendantContextProvider","ComboboxContext","ListboxContext","renderDropdown_unstable","state","contextValues","root","value","activeDescendant","Provider","listbox","combobox","button","children","expandIcon","clearButton","inlinePopup","mountNode"],"mappings":";;;;+BAeaK;;;;;;;6BAfb,CAA0B,GAC1B,iDAAiD,GAEjD,SAASL,MAAM,QAAQ,yBAAyB;gCAEpB,4BAA4B;2BAER,uBAAuB;iCACvC,oCAAiC;gCAElC,mCAAgC;AAKxD,gCAAgC,CAACM,OAAsBC;QAC5DN,2BAAAA,EAA2BK;IAE3B,OAAA,WAAA,OACE,eAAA,EAACA,MAAME,IAAI,EAAA;kBACT,WAAA,OAAA,eAAA,EAACN,0CAAAA,EAAAA;YAAgCO,OAAOF,cAAcG,gBAAgB;sBACpE,WAAA,OAAA,eAAA,EAACN,8BAAAA,CAAeO,QAAQ,EAAA;gBAACF,OAAOF,cAAcK,OAAO;0BAEnD,WAAA,OAAA,gBAAA,EAACT,gCAAAA,CAAgBQ,QAAQ,EAAA;oBAACF,OAAOF,cAAcM,QAAQ;;0CACrD,gBAAA,EAACP,MAAMQ,MAAM,EAAA;;gCACVR,MAAMQ,MAAM,CAACC,QAAQ;gCACrBT,MAAMU,UAAU,IAAA,WAAA,OAAI,eAAA,EAACV,MAAMU,UAAU,EAAA,CAAA;;;wBAEvCV,MAAMW,WAAW,IAAA,WAAA,OAAI,eAAA,EAACX,MAAMW,WAAW,EAAA,CAAA;wBACvCX,MAAMM,OAAO,IACXN,CAAAA,MAAMY,WAAW,GAAA,WAAA,OAChB,eAAA,EAACZ,MAAMM,OAAO,EAAA,CAAA,KAAA,WAAA,OAEd,eAAA,EAACZ,mBAAAA,EAAAA;4BAAOmB,WAAWb,MAAMa,SAAS;sCAChC,WAAA,OAAA,eAAA,EAACb,MAAMM,OAAO,EAAA,CAAA;2BAElB;;;;;;AAOd,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Dropdown/useButtonTriggerSlot.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { useTimeout, mergeCallbacks } from '@fluentui/react-utilities';\nimport type { Slot, ExtractSlotProps, SlotComponentType } from '@fluentui/react-utilities';\nimport type { ActiveDescendantImperativeRef } from '@fluentui/react-aria';\nimport type { UseTriggerSlotState } from '../../utils/useTriggerSlot';\nimport { useTriggerSlot } from '../../utils/useTriggerSlot';\nimport { getDropdownActionFromKey } from '../../utils/dropdownKeyActions';\n\ntype UseButtonTriggerSlotOptions = {\n state: UseTriggerSlotState;\n defaultProps: unknown;\n activeDescendantController: ActiveDescendantImperativeRef;\n};\n\n/**\n * useButtonTriggerSlot returns a tuple of trigger/listbox shorthand,\n * with the semantics and event handlers needed for the Combobox and Dropdown components.\n * The element type of the ref should always match the element type used in the trigger shorthand.\n *\n * @internal\n */\nexport function useButtonTriggerSlot(\n triggerFromProps: NonNullable<Slot<'button'>>,\n ref: React.Ref<HTMLButtonElement>,\n options: UseButtonTriggerSlotOptions,\n): SlotComponentType<ExtractSlotProps<Slot<'button'>>> {\n const {\n state: { open, setOpen, getOptionById },\n defaultProps,\n activeDescendantController,\n } = options;\n\n // jump to matching option based on typing\n const searchString = React.useRef('');\n const [setKeyTimeout, clearKeyTimeout] = useTimeout();\n\n const moveToNextMatchingOption = (\n matcher: (optionText: string) => boolean,\n opt: { startFromNext: boolean } = { startFromNext: false },\n ) => {\n const { startFromNext } = opt;\n const activeOptionId = activeDescendantController.active();\n\n const nextInOrder = activeDescendantController.find(\n id => {\n const option = getOptionById(id);\n return !!option && matcher(option.text);\n },\n { startFrom: startFromNext ? activeDescendantController.next({ passive: true }) : activeOptionId },\n );\n\n if (nextInOrder) {\n return nextInOrder;\n }\n\n // Cycle back to first match\n return activeDescendantController.find(id => {\n const option = getOptionById(id);\n return !!option && matcher(option.text);\n });\n };\n\n const moveToNextMatchingOptionWithSameCharacterHandling = () => {\n if (\n moveToNextMatchingOption(\n optionText => {\n return optionText.toLocaleLowerCase().indexOf(searchString.current) === 0;\n },\n {\n // Slowly pressing the same key will cycle through options\n startFromNext: searchString.current.length === 1,\n },\n )\n ) {\n return;\n }\n\n // if there are no direct matches, check if the search is all the same letter, e.g. \"aaa\"\n if (\n allCharactersSame(searchString.current) &&\n moveToNextMatchingOption(\n optionText => {\n return optionText.toLocaleLowerCase().indexOf(searchString.current[0]) === 0;\n },\n {\n // if the search is all the same letter, cycle through options starting with that letter\n startFromNext: true,\n },\n )\n ) {\n return;\n }\n\n activeDescendantController.blur();\n };\n\n const onTriggerKeyDown = (ev: React.KeyboardEvent<HTMLButtonElement>) => {\n // clear timeout, if it exists\n clearKeyTimeout();\n\n // if the key was a char key, update search string\n if (getDropdownActionFromKey(ev) === 'Type') {\n // update search string\n searchString.current += ev.key.toLowerCase();\n setKeyTimeout(() => {\n searchString.current = '';\n }, 500);\n\n if (open) {\n moveToNextMatchingOptionWithSameCharacterHandling();\n }\n\n // update state\n !open && setOpen(ev, true);\n }\n };\n\n const trigger = useTriggerSlot(triggerFromProps, ref, {\n state: options.state,\n defaultProps,\n elementType: 'button',\n activeDescendantController,\n });\n // eslint-disable-next-line react-hooks/immutability, react-hooks/refs\n trigger.onKeyDown = mergeCallbacks(onTriggerKeyDown, trigger.onKeyDown);\n\n return trigger;\n}\n\n/**\n * @returns - whether every character in the string is the same\n */\nfunction allCharactersSame(str: string) {\n for (let i = 1; i < str.length; i++) {\n if (str[i] !== str[i - 1]) {\n return false;\n }\n }\n\n return true;\n}\n"],"names":["React","useTimeout","mergeCallbacks","useTriggerSlot","getDropdownActionFromKey","useButtonTriggerSlot","triggerFromProps","ref","options","state","open","setOpen","getOptionById","defaultProps","activeDescendantController","searchString","useRef","setKeyTimeout","clearKeyTimeout","moveToNextMatchingOption","matcher","opt","startFromNext","activeOptionId","active","nextInOrder","find","id","option","text","startFrom","next","passive","moveToNextMatchingOptionWithSameCharacterHandling","optionText","toLocaleLowerCase","indexOf","current","length","allCharactersSame","blur","onTriggerKeyDown","ev","key","toLowerCase","trigger","elementType","onKeyDown","str","i"],"mappings":"AAAA;;;;;+BAuBgBK;;;;;;;iEArBO,QAAQ;gCACY,4BAA4B;gCAIxC,gCAA6B;oCACnB,oCAAiC;AAenE,8BACLC,gBAA6C,EAC7CC,GAAiC,EACjCC,OAAoC;IAEpC,MAAM,EACJC,OAAO,EAAEC,IAAI,EAAEC,OAAO,EAAEC,aAAa,EAAE,EACvCC,YAAY,EACZC,0BAA0B,EAC3B,GAAGN;IAEJ,0CAA0C;IAC1C,MAAMO,eAAef,OAAMgB,MAAM,CAAC;IAClC,MAAM,CAACC,eAAeC,gBAAgB,OAAGjB,0BAAAA;IAEzC,MAAMkB,2BAA2B,CAC/BC,SACAC,MAAkC;QAAEC,eAAe;IAAM,CAAC;QAE1D,MAAM,EAAEA,aAAa,EAAE,GAAGD;QAC1B,MAAME,iBAAiBT,2BAA2BU,MAAM;QAExD,MAAMC,cAAcX,2BAA2BY,IAAI,CACjDC,CAAAA;YACE,MAAMC,SAAShB,cAAce;YAC7B,OAAO,CAAC,CAACC,UAAUR,QAAQQ,OAAOC,IAAI;QACxC,GACA;YAAEC,WAAWR,gBAAgBR,2BAA2BiB,IAAI,CAAC;gBAAEC,SAAS;YAAK,KAAKT;QAAe;QAGnG,IAAIE,aAAa;YACf,OAAOA;QACT;QAEA,4BAA4B;QAC5B,OAAOX,2BAA2BY,IAAI,CAACC,CAAAA;YACrC,MAAMC,SAAShB,cAAce;YAC7B,OAAO,CAAC,CAACC,UAAUR,QAAQQ,OAAOC,IAAI;QACxC;IACF;IAEA,MAAMI,oDAAoD;QACxD,IACEd,yBACEe,CAAAA;YACE,OAAOA,WAAWC,iBAAiB,GAAGC,OAAO,CAACrB,aAAasB,OAAO,MAAM;QAC1E,GACA;YACE,0DAA0D;YAC1Df,eAAeP,aAAasB,OA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