@elliemae/ds-form-combobox 3.80.0-next.8 → 3.80.0-next.81
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/dist/cjs/DSCommonComboboxPropsT.js +7 -3
- package/dist/cjs/DSCommonComboboxPropsT.js.map +2 -2
- package/dist/cjs/TruncatedText.js +11 -7
- package/dist/cjs/TruncatedText.js.map +2 -2
- package/dist/cjs/config/useComboBox.js +21 -6
- package/dist/cjs/config/useComboBox.js.map +2 -2
- package/dist/cjs/parts/DropdownIndicator.js +4 -3
- package/dist/cjs/parts/DropdownIndicator.js.map +2 -2
- package/dist/cjs/parts/Section.js +18 -8
- package/dist/cjs/parts/Section.js.map +2 -2
- package/dist/cjs/parts/container/Container.js +5 -2
- package/dist/cjs/parts/container/Container.js.map +2 -2
- package/dist/cjs/parts/container/styled.js +4 -4
- package/dist/cjs/parts/container/styled.js.map +2 -2
- package/dist/cjs/parts/controls/Controls.js +10 -19
- package/dist/cjs/parts/controls/Controls.js.map +2 -2
- package/dist/cjs/parts/controls/styled.js +7 -7
- package/dist/cjs/parts/controls/styled.js.map +2 -2
- package/dist/cjs/parts/controls/useOnPillsNavigation.js +5 -13
- package/dist/cjs/parts/controls/useOnPillsNavigation.js.map +2 -2
- package/dist/cjs/parts/controls-input/ControlsInput.js +20 -19
- package/dist/cjs/parts/controls-input/ControlsInput.js.map +2 -2
- package/dist/cjs/parts/controls-input/styled.js +5 -2
- package/dist/cjs/parts/controls-input/styled.js.map +2 -2
- package/dist/cjs/parts/controls-input/useKeyboardNavigation.js +22 -15
- package/dist/cjs/parts/controls-input/useKeyboardNavigation.js.map +2 -2
- package/dist/cjs/parts/controls-input/useMaskedOnChange.js +11 -4
- package/dist/cjs/parts/controls-input/useMaskedOnChange.js.map +2 -2
- package/dist/cjs/parts/menu-list/useItemRenderer.js +22 -11
- package/dist/cjs/parts/menu-list/useItemRenderer.js.map +2 -2
- package/dist/cjs/parts/multi-selected-values-container/RemovableSelectedValuePill.js +4 -9
- package/dist/cjs/parts/multi-selected-values-container/RemovableSelectedValuePill.js.map +2 -2
- package/dist/cjs/parts/multi-selected-values-container/useGroupPills.js +10 -2
- package/dist/cjs/parts/multi-selected-values-container/useGroupPills.js.map +2 -2
- package/dist/cjs/parts/styled.js.map +2 -2
- package/dist/cjs/utils/listHelper.js +2 -0
- package/dist/cjs/utils/listHelper.js.map +2 -2
- package/dist/esm/DSCommonComboboxPropsT.js +7 -3
- package/dist/esm/DSCommonComboboxPropsT.js.map +2 -2
- package/dist/esm/TruncatedText.js +11 -7
- package/dist/esm/TruncatedText.js.map +2 -2
- package/dist/esm/config/useComboBox.js +22 -7
- package/dist/esm/config/useComboBox.js.map +2 -2
- package/dist/esm/parts/DropdownIndicator.js +5 -4
- package/dist/esm/parts/DropdownIndicator.js.map +2 -2
- package/dist/esm/parts/Section.js +18 -8
- package/dist/esm/parts/Section.js.map +2 -2
- package/dist/esm/parts/container/Container.js +5 -2
- package/dist/esm/parts/container/Container.js.map +2 -2
- package/dist/esm/parts/container/styled.js +5 -5
- package/dist/esm/parts/container/styled.js.map +2 -2
- package/dist/esm/parts/controls/Controls.js +10 -19
- package/dist/esm/parts/controls/Controls.js.map +2 -2
- package/dist/esm/parts/controls/styled.js +7 -7
- package/dist/esm/parts/controls/styled.js.map +2 -2
- package/dist/esm/parts/controls/useOnPillsNavigation.js +5 -13
- package/dist/esm/parts/controls/useOnPillsNavigation.js.map +2 -2
- package/dist/esm/parts/controls-input/ControlsInput.js +27 -20
- package/dist/esm/parts/controls-input/ControlsInput.js.map +2 -2
- package/dist/esm/parts/controls-input/styled.js +6 -3
- package/dist/esm/parts/controls-input/styled.js.map +2 -2
- package/dist/esm/parts/controls-input/useKeyboardNavigation.js +24 -16
- package/dist/esm/parts/controls-input/useKeyboardNavigation.js.map +2 -2
- package/dist/esm/parts/controls-input/useMaskedOnChange.js +11 -4
- package/dist/esm/parts/controls-input/useMaskedOnChange.js.map +2 -2
- package/dist/esm/parts/menu-list/useItemRenderer.js +24 -13
- package/dist/esm/parts/menu-list/useItemRenderer.js.map +2 -2
- package/dist/esm/parts/multi-selected-values-container/RemovableSelectedValuePill.js +5 -10
- package/dist/esm/parts/multi-selected-values-container/RemovableSelectedValuePill.js.map +2 -2
- package/dist/esm/parts/multi-selected-values-container/useGroupPills.js +10 -2
- package/dist/esm/parts/multi-selected-values-container/useGroupPills.js.map +2 -2
- package/dist/esm/parts/styled.js.map +2 -2
- package/dist/esm/utils/listHelper.js +2 -0
- package/dist/esm/utils/listHelper.js.map +2 -2
- package/dist/types/ComboBoxCTX.d.ts +3 -1
- package/dist/types/TruncatedText.d.ts +2 -1
- package/dist/types/config/useComboBox.d.ts +3 -1
- package/dist/types/parts/Section.d.ts +1 -0
- package/dist/types/parts/container/styled.d.ts +4 -4
- package/dist/types/parts/controls/styled.d.ts +7 -7
- package/dist/types/parts/controls-input/styled.d.ts +1 -1
- package/dist/types/parts/controls-input/useMaskedOnChange.d.ts +1 -1
- package/dist/types/parts/styled.d.ts +5 -0
- package/dist/types/utils/listHelper.d.ts +8 -0
- package/package.json +17 -17
|
@@ -64,10 +64,14 @@ const commonComboboxPropTypes = {
|
|
|
64
64
|
onlySelectable: import_ds_props_helpers.PropTypes.bool.description("Disables free-text filtering and allows only selectable option values.").defaultValue("false"),
|
|
65
65
|
isSkeleton: import_ds_props_helpers.PropTypes.bool.description("Displays the component in skeleton loading mode.").defaultValue("false"),
|
|
66
66
|
applyAriaDisabled: import_ds_props_helpers.PropTypes.bool.description(
|
|
67
|
-
|
|
67
|
+
'Soft lock: announced as disabled (aria-disabled="true"), CAN STILL RECEIVE FOCUS, WITHHOLDS THE CHANGE: selecting, clearing, creating and removing a value do nothing and onChange is not called. Your click and key handlers are only observed, except that onKeyDown does not receive Enter or Space while an option is the current item. The menu stays closed unless `isMenuOpenableWithReadOnly` is set.'
|
|
68
|
+
).defaultValue("false"),
|
|
69
|
+
readOnly: import_ds_props_helpers.PropTypes.bool.description(
|
|
70
|
+
'Soft lock, the same as applyAriaDisabled: aria-disabled="true", CAN STILL RECEIVE FOCUS, WITHHOLDS THE CHANGE: selecting, clearing, creating and removing a value do nothing and onChange is not called. Your click and key handlers are only observed, except that onKeyDown does not receive Enter or Space while an option is the current item. Announces "Read only" through a hidden description. Dimsum never writes aria-readonly.'
|
|
71
|
+
).defaultValue("false"),
|
|
72
|
+
isMenuOpenableWithReadOnly: import_ds_props_helpers.PropTypes.bool.description(
|
|
73
|
+
"Controls whether the menu may still open while `readOnly` or `applyAriaDisabled` is true (they are the same soft lock). Selecting an option still does nothing."
|
|
68
74
|
).defaultValue("false"),
|
|
69
|
-
readOnly: import_ds_props_helpers.PropTypes.bool.description("Makes input content non-editable while keeping the field accessible.").defaultValue("false"),
|
|
70
|
-
isMenuOpenableWithReadOnly: import_ds_props_helpers.PropTypes.bool.description("Controls whether the menu may still open while `readOnly` is true.").defaultValue("false"),
|
|
71
75
|
onSelectAll: import_ds_props_helpers.PropTypes.func.description("Deprecated callback fired when selecting all options.").signature("(suggestedValue: OptionTypes[] | [], event: React.MouseEvent | React.KeyboardEvent) => void").deprecated({ version: "25.2" }),
|
|
72
76
|
popperProps: import_ds_props_helpers.PropTypes.object.description(
|
|
73
77
|
"Pass-through props forwarded to the floating wrapper implementation. Behavior is primarily defined by the floating wrapper contract."
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/DSCommonComboboxPropsT.ts", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable max-lines */\nimport type { DSFloatingWrapperT, DSHookFloatingContextT } from '@elliemae/ds-floating-context';\nimport type { DSMaskT } from '@elliemae/ds-form-helpers-mask-hooks';\nimport type { DSPropTypesSchema, GlobalAttributesT } from '@elliemae/ds-props-helpers';\nimport { PropTypes } from '@elliemae/ds-props-helpers';\nimport type { SizingProps } from '@elliemae/ds-system';\nimport type React from 'react';\n\nexport declare function noop<T extends unknown[]>(..._args: T): void;\n\nexport declare namespace DSCommonComboboxPropsT {\n export interface CommonItemOptions extends GlobalAttributesT {\n dsId: string;\n disabled?: boolean;\n applyAriaDisabled?: boolean;\n render?: React.ComponentType<unknown>;\n }\n export interface ItemSeparatorOptions extends CommonItemOptions {\n type: 'separator';\n }\n export interface ItemSectionOptions extends CommonItemOptions {\n type: 'section';\n label: string;\n options: OptionTypes[];\n }\n export interface ItemOption extends CommonItemOptions {\n value: string;\n label: string;\n type: 'option';\n }\n export interface ItemCreatableOption extends CommonItemOptions {\n label: string;\n type: 'creatable';\n }\n export type SelectionableOptions = ItemOption | ItemCreatableOption;\n export type LayoutOptions = ItemSeparatorOptions | ItemSectionOptions;\n export type OptionTypes = SelectionableOptions | LayoutOptions;\n\n export interface RequiredProps {\n allOptions: OptionTypes[];\n }\n export interface DefaultProps {\n startPlacementPreference: DSHookFloatingContextT.PopperPlacementsT;\n placementOrderPreference: DSHookFloatingContextT.PopperPlacementsT[];\n hasError: boolean;\n inline: boolean;\n withoutPortal: boolean;\n isNonClearable: boolean;\n disabled: boolean;\n noOptionsMessage: string;\n innerRef: React.MutableRefObject<HTMLInputElement | null> | ((ref: HTMLInputElement | null) => void);\n useMask: DSMaskT.Hook | typeof noop;\n onlySelectable: boolean;\n isSkeleton: boolean;\n applyAriaDisabled: boolean;\n readOnly: boolean;\n isMenuOpenableWithReadOnly: boolean;\n forceFocusFirstOptionOnType: boolean;\n menuMaxHeight: SizingProps['maxHeight'];\n }\n export interface OptionalProps {\n menuMinWidth?: SizingProps['minWidth'];\n placeholder?: string;\n autoFocus?: boolean;\n filteredOptions?: OptionTypes[];\n isMenuOpen?: boolean;\n onMenuChange?: (\n state: boolean,\n reason: string,\n e?: React.KeyboardEvent | React.MouseEvent | React.ChangeEvent<HTMLInputElement>,\n ) => void;\n onCreate?: (label: string) => void;\n onFilter?: (newOptions: OptionTypes[], inputValue?: string) => void;\n onCancel?: () => void;\n onSelectAll?: (suggestedValue: SelectionableOptions[] | [], event: React.MouseEvent | React.KeyboardEvent) => void;\n onKeyDown?: (e: React.KeyboardEvent<HTMLInputElement>, value: ItemOption) => void;\n isLoading?: boolean;\n popperProps?: DSFloatingWrapperT.Props;\n }\n}\n\ntype CommonComboboxProps = DSCommonComboboxPropsT.RequiredProps &\n DSCommonComboboxPropsT.DefaultProps &\n DSCommonComboboxPropsT.OptionalProps;\n\nexport const commonComboboxPropTypes: DSPropTypesSchema<CommonComboboxProps> = {\n placeholder: PropTypes.string.description(\n 'Input placeholder text. Note: announcement behavior may be handled by component logic for accessibility, while visible placeholder text remains as provided.',\n ),\n allOptions: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.object, PropTypes.string])).isRequired.description(\n 'Full list of options and layout rows used by the combobox before filtering.',\n ),\n filteredOptions: PropTypes.arrayOf(PropTypes.object).description(\n 'Filtered list rendered in the menu for the current input value. THIS DOES NOT SUPPORT STRING OPTIONS, ALL OPTIONS MUST BE OBJECTS.',\n ),\n disabled: PropTypes.bool\n .description('Disables user interaction with the combobox input and menu trigger.')\n .defaultValue('false'),\n autoFocus: PropTypes.bool.description('Automatically focuses the input on mount when true.'),\n hasError: PropTypes.bool.description('Applies error styling/state to the combobox.').defaultValue('false'),\n noOptionsMessage: PropTypes.string\n .description('Message displayed when no options match the current filter.')\n .defaultValue('No Matches Found'),\n onFilter: PropTypes.func\n .description('Called when input text changes and options are filtered.')\n .signature('(newOptions: OptionTypes[], inputValue?: string) => void'),\n onCreate: PropTypes.func\n .description('Called when the user creates a new option from free-text input.')\n .signature('(label: string) => void'),\n onCancel: PropTypes.func\n .description('Called when Escape dismisses/closes the menu (effectively menu dismiss semantics).')\n .signature('() => void'),\n onMenuChange: PropTypes.func\n .description('Called when the menu open state changes.')\n .signature(\n '(state: boolean, reason: string, e?: React.KeyboardEvent | React.MouseEvent | React.ChangeEvent<HTMLInputElement>) => void',\n ),\n menuMinWidth: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description(\n 'Minimum menu width. Numeric values are interpreted as px.',\n ),\n menuMaxHeight: PropTypes.oneOfType([PropTypes.number, PropTypes.string])\n .description('Maximum menu height. Will always append \"px\" to the provided values.')\n .defaultValue('300'),\n withoutPortal: PropTypes.bool\n .description(\n 'When true the contextual menu DOM will render as part of the same parent element of the input instead of the body tag.',\n )\n .defaultValue('false'),\n innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({ current: PropTypes.object })])\n .description('Mutable ref object or callback ref assigned to the underlying input.')\n .defaultValue('createRef()'),\n onlySelectable: PropTypes.bool\n .description('Disables free-text filtering and allows only selectable option values.')\n .defaultValue('false'),\n isSkeleton: PropTypes.bool.description('Displays the component in skeleton loading mode.').defaultValue('false'),\n applyAriaDisabled: PropTypes.bool\n .description(\n '
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADIvB,8BAA0B;AAiFnB,MAAM,0BAAkE;AAAA,EAC7E,aAAa,kCAAU,OAAO;AAAA,IAC5B;AAAA,EACF;AAAA,EACA,YAAY,kCAAU,QAAQ,kCAAU,UAAU,CAAC,kCAAU,QAAQ,kCAAU,MAAM,CAAC,CAAC,EAAE,WAAW;AAAA,IAClG;AAAA,EACF;AAAA,EACA,iBAAiB,kCAAU,QAAQ,kCAAU,MAAM,EAAE;AAAA,IACnD;AAAA,EACF;AAAA,EACA,UAAU,kCAAU,KACjB,YAAY,qEAAqE,EACjF,aAAa,OAAO;AAAA,EACvB,WAAW,kCAAU,KAAK,YAAY,qDAAqD;AAAA,EAC3F,UAAU,kCAAU,KAAK,YAAY,8CAA8C,EAAE,aAAa,OAAO;AAAA,EACzG,kBAAkB,kCAAU,OACzB,YAAY,6DAA6D,EACzE,aAAa,kBAAkB;AAAA,EAClC,UAAU,kCAAU,KACjB,YAAY,0DAA0D,EACtE,UAAU,0DAA0D;AAAA,EACvE,UAAU,kCAAU,KACjB,YAAY,iEAAiE,EAC7E,UAAU,yBAAyB;AAAA,EACtC,UAAU,kCAAU,KACjB,YAAY,oFAAoF,EAChG,UAAU,YAAY;AAAA,EACzB,cAAc,kCAAU,KACrB,YAAY,0CAA0C,EACtD;AAAA,IACC;AAAA,EACF;AAAA,EACF,cAAc,kCAAU,UAAU,CAAC,kCAAU,QAAQ,kCAAU,MAAM,CAAC,EAAE;AAAA,IACtE;AAAA,EACF;AAAA,EACA,eAAe,kCAAU,UAAU,CAAC,kCAAU,QAAQ,kCAAU,MAAM,CAAC,EACpE,YAAY,sEAAsE,EAClF,aAAa,KAAK;AAAA,EACrB,eAAe,kCAAU,KACtB;AAAA,IACC;AAAA,EACF,EACC,aAAa,OAAO;AAAA,EACvB,UAAU,kCAAU,UAAU,CAAC,kCAAU,MAAM,kCAAU,MAAM,EAAE,SAAS,kCAAU,OAAO,CAAC,CAAC,CAAC,EAC3F,YAAY,sEAAsE,EAClF,aAAa,aAAa;AAAA,EAC7B,gBAAgB,kCAAU,KACvB,YAAY,wEAAwE,EACpF,aAAa,OAAO;AAAA,EACvB,YAAY,kCAAU,KAAK,YAAY,kDAAkD,EAAE,aAAa,OAAO;AAAA,EAC/G,mBAAmB,kCAAU,KAC1B;AAAA,IACC;AAAA,EACF,EACC,aAAa,OAAO;AAAA,EACvB,UAAU,kCAAU,KACjB,
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-lines */\nimport type { DSFloatingWrapperT, DSHookFloatingContextT } from '@elliemae/ds-floating-context';\nimport type { DSMaskT } from '@elliemae/ds-form-helpers-mask-hooks';\nimport type { DSPropTypesSchema, GlobalAttributesT } from '@elliemae/ds-props-helpers';\nimport { PropTypes } from '@elliemae/ds-props-helpers';\nimport type { SizingProps } from '@elliemae/ds-system';\nimport type React from 'react';\n\nexport declare function noop<T extends unknown[]>(..._args: T): void;\n\nexport declare namespace DSCommonComboboxPropsT {\n export interface CommonItemOptions extends GlobalAttributesT {\n dsId: string;\n disabled?: boolean;\n applyAriaDisabled?: boolean;\n render?: React.ComponentType<unknown>;\n }\n export interface ItemSeparatorOptions extends CommonItemOptions {\n type: 'separator';\n }\n export interface ItemSectionOptions extends CommonItemOptions {\n type: 'section';\n label: string;\n options: OptionTypes[];\n }\n export interface ItemOption extends CommonItemOptions {\n value: string;\n label: string;\n type: 'option';\n }\n export interface ItemCreatableOption extends CommonItemOptions {\n label: string;\n type: 'creatable';\n }\n export type SelectionableOptions = ItemOption | ItemCreatableOption;\n export type LayoutOptions = ItemSeparatorOptions | ItemSectionOptions;\n export type OptionTypes = SelectionableOptions | LayoutOptions;\n\n export interface RequiredProps {\n allOptions: OptionTypes[];\n }\n export interface DefaultProps {\n startPlacementPreference: DSHookFloatingContextT.PopperPlacementsT;\n placementOrderPreference: DSHookFloatingContextT.PopperPlacementsT[];\n hasError: boolean;\n inline: boolean;\n withoutPortal: boolean;\n isNonClearable: boolean;\n disabled: boolean;\n noOptionsMessage: string;\n innerRef: React.MutableRefObject<HTMLInputElement | null> | ((ref: HTMLInputElement | null) => void);\n useMask: DSMaskT.Hook | typeof noop;\n onlySelectable: boolean;\n isSkeleton: boolean;\n applyAriaDisabled: boolean;\n readOnly: boolean;\n isMenuOpenableWithReadOnly: boolean;\n forceFocusFirstOptionOnType: boolean;\n menuMaxHeight: SizingProps['maxHeight'];\n }\n export interface OptionalProps {\n menuMinWidth?: SizingProps['minWidth'];\n placeholder?: string;\n autoFocus?: boolean;\n filteredOptions?: OptionTypes[];\n isMenuOpen?: boolean;\n onMenuChange?: (\n state: boolean,\n reason: string,\n e?: React.KeyboardEvent | React.MouseEvent | React.ChangeEvent<HTMLInputElement>,\n ) => void;\n onCreate?: (label: string) => void;\n onFilter?: (newOptions: OptionTypes[], inputValue?: string) => void;\n onCancel?: () => void;\n onSelectAll?: (suggestedValue: SelectionableOptions[] | [], event: React.MouseEvent | React.KeyboardEvent) => void;\n onKeyDown?: (e: React.KeyboardEvent<HTMLInputElement>, value: ItemOption) => void;\n isLoading?: boolean;\n popperProps?: DSFloatingWrapperT.Props;\n }\n}\n\ntype CommonComboboxProps = DSCommonComboboxPropsT.RequiredProps &\n DSCommonComboboxPropsT.DefaultProps &\n DSCommonComboboxPropsT.OptionalProps;\n\nexport const commonComboboxPropTypes: DSPropTypesSchema<CommonComboboxProps> = {\n placeholder: PropTypes.string.description(\n 'Input placeholder text. Note: announcement behavior may be handled by component logic for accessibility, while visible placeholder text remains as provided.',\n ),\n allOptions: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.object, PropTypes.string])).isRequired.description(\n 'Full list of options and layout rows used by the combobox before filtering.',\n ),\n filteredOptions: PropTypes.arrayOf(PropTypes.object).description(\n 'Filtered list rendered in the menu for the current input value. THIS DOES NOT SUPPORT STRING OPTIONS, ALL OPTIONS MUST BE OBJECTS.',\n ),\n disabled: PropTypes.bool\n .description('Disables user interaction with the combobox input and menu trigger.')\n .defaultValue('false'),\n autoFocus: PropTypes.bool.description('Automatically focuses the input on mount when true.'),\n hasError: PropTypes.bool.description('Applies error styling/state to the combobox.').defaultValue('false'),\n noOptionsMessage: PropTypes.string\n .description('Message displayed when no options match the current filter.')\n .defaultValue('No Matches Found'),\n onFilter: PropTypes.func\n .description('Called when input text changes and options are filtered.')\n .signature('(newOptions: OptionTypes[], inputValue?: string) => void'),\n onCreate: PropTypes.func\n .description('Called when the user creates a new option from free-text input.')\n .signature('(label: string) => void'),\n onCancel: PropTypes.func\n .description('Called when Escape dismisses/closes the menu (effectively menu dismiss semantics).')\n .signature('() => void'),\n onMenuChange: PropTypes.func\n .description('Called when the menu open state changes.')\n .signature(\n '(state: boolean, reason: string, e?: React.KeyboardEvent | React.MouseEvent | React.ChangeEvent<HTMLInputElement>) => void',\n ),\n menuMinWidth: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description(\n 'Minimum menu width. Numeric values are interpreted as px.',\n ),\n menuMaxHeight: PropTypes.oneOfType([PropTypes.number, PropTypes.string])\n .description('Maximum menu height. Will always append \"px\" to the provided values.')\n .defaultValue('300'),\n withoutPortal: PropTypes.bool\n .description(\n 'When true the contextual menu DOM will render as part of the same parent element of the input instead of the body tag.',\n )\n .defaultValue('false'),\n innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({ current: PropTypes.object })])\n .description('Mutable ref object or callback ref assigned to the underlying input.')\n .defaultValue('createRef()'),\n onlySelectable: PropTypes.bool\n .description('Disables free-text filtering and allows only selectable option values.')\n .defaultValue('false'),\n isSkeleton: PropTypes.bool.description('Displays the component in skeleton loading mode.').defaultValue('false'),\n applyAriaDisabled: PropTypes.bool\n .description(\n 'Soft lock: announced as disabled (aria-disabled=\"true\"), CAN STILL RECEIVE FOCUS, WITHHOLDS THE CHANGE: selecting, clearing, creating and removing a value do nothing and onChange is not called. Your click and key handlers are only observed, except that onKeyDown does not receive Enter or Space while an option is the current item. The menu stays closed unless `isMenuOpenableWithReadOnly` is set.',\n )\n .defaultValue('false'),\n readOnly: PropTypes.bool\n .description(\n 'Soft lock, the same as applyAriaDisabled: aria-disabled=\"true\", CAN STILL RECEIVE FOCUS, WITHHOLDS THE CHANGE: selecting, clearing, creating and removing a value do nothing and onChange is not called. Your click and key handlers are only observed, except that onKeyDown does not receive Enter or Space while an option is the current item. Announces \"Read only\" through a hidden description. Dimsum never writes aria-readonly.',\n )\n .defaultValue('false'),\n isMenuOpenableWithReadOnly: PropTypes.bool\n .description(\n 'Controls whether the menu may still open while `readOnly` or `applyAriaDisabled` is true (they are the same soft lock). Selecting an option still does nothing.',\n )\n .defaultValue('false'),\n onSelectAll: PropTypes.func\n .description('Deprecated callback fired when selecting all options.')\n .signature('(suggestedValue: OptionTypes[] | [], event: React.MouseEvent | React.KeyboardEvent) => void')\n .deprecated({ version: '25.2' }),\n popperProps: PropTypes.object.description(\n 'Pass-through props forwarded to the floating wrapper implementation. Behavior is primarily defined by the floating wrapper contract.',\n ),\n forceFocusFirstOptionOnType: PropTypes.bool\n .description('When typing, moves pseudo focus to the first available option.')\n .defaultValue('false'),\n placementOrderPreference: PropTypes.arrayOf(PropTypes.string)\n .description(\n 'When the floating menu cannot be placed in the preferred start placement, it will attempt placements in the order defined by this array.',\n )\n .defaultValue('[\"bottom-start\", \"top-start\"]'),\n startPlacementPreference: PropTypes.string\n .description('If possible, the contextual menu will position first and foremost according to this placement.')\n .defaultValue('bottom-start'),\n inline: PropTypes.bool.description('Renders menu using inline positioning strategy when true.').defaultValue('false'),\n isNonClearable: PropTypes.bool\n .description('Prevents clearing the current selection when true, in a select-like fashion.')\n .defaultValue('false'),\n useMask: PropTypes.func\n .description(\n 'Mask hook/function returning input mask handlers. Designed for the design system masks (e.g. usePhoneMask) but accepts any compatible implementation.',\n )\n .defaultValue('() => {}'),\n isMenuOpen: PropTypes.bool.description('Controlled open state for the menu.'),\n isLoading: PropTypes.bool.description('Shows loading state while options are being fetched.'),\n onKeyDown: PropTypes.func\n .description(\n 'Callback for key down events on the input text element only (not a root-level/global keyboard handler). This is intentionally narrower than generic global onKeyDown behavior.',\n )\n .signature('(e: React.KeyboardEvent<HTMLInputElement>, value: ItemOption) => void'),\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADIvB,8BAA0B;AAiFnB,MAAM,0BAAkE;AAAA,EAC7E,aAAa,kCAAU,OAAO;AAAA,IAC5B;AAAA,EACF;AAAA,EACA,YAAY,kCAAU,QAAQ,kCAAU,UAAU,CAAC,kCAAU,QAAQ,kCAAU,MAAM,CAAC,CAAC,EAAE,WAAW;AAAA,IAClG;AAAA,EACF;AAAA,EACA,iBAAiB,kCAAU,QAAQ,kCAAU,MAAM,EAAE;AAAA,IACnD;AAAA,EACF;AAAA,EACA,UAAU,kCAAU,KACjB,YAAY,qEAAqE,EACjF,aAAa,OAAO;AAAA,EACvB,WAAW,kCAAU,KAAK,YAAY,qDAAqD;AAAA,EAC3F,UAAU,kCAAU,KAAK,YAAY,8CAA8C,EAAE,aAAa,OAAO;AA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AU,OAAO;AAAA,IAC5B;AAAA,EACF;AAAA,EACA,6BAA6B,kCAAU,KACpC,YAAY,gEAAgE,EAC5E,aAAa,OAAO;AAAA,EACvB,0BAA0B,kCAAU,QAAQ,kCAAU,MAAM,EACzD;AAAA,IACC;AAAA,EACF,EACC,aAAa,+BAA+B;AAAA,EAC/C,0BAA0B,kCAAU,OACjC,YAAY,gGAAgG,EAC5G,aAAa,cAAc;AAAA,EAC9B,QAAQ,kCAAU,KAAK,YAAY,2DAA2D,EAAE,aAAa,OAAO;AAAA,EACpH,gBAAgB,kCAAU,KACvB,YAAY,8EAA8E,EAC1F,aAAa,OAAO;AAAA,EACvB,SAAS,kCAAU,KAChB;AAAA,IACC;AAAA,EACF,EACC,aAAa,UAAU;AAAA,EAC1B,YAAY,kCAAU,KAAK,YAAY,qCAAqC;AAAA,EAC5E,WAAW,kCAAU,KAAK,YAAY,sDAAsD;AAAA,EAC5F,WAAW,kCAAU,KAClB;AAAA,IACC;AAAA,EACF,EACC,UAAU,uEAAuE;AACtF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -35,13 +35,17 @@ module.exports = __toCommonJS(TruncatedText_exports);
|
|
|
35
35
|
var React = __toESM(require("react"));
|
|
36
36
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
37
37
|
var import_ds_system = require("@elliemae/ds-system");
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
38
|
+
var import_ds_typography = require("@elliemae/ds-typography");
|
|
39
|
+
const TruncatedSpan = (0, import_ds_system.styled)(import_ds_typography.DSTypography)`
|
|
40
|
+
&& {
|
|
41
|
+
font-family: inherit;
|
|
42
|
+
font-size: inherit;
|
|
43
|
+
font-weight: inherit;
|
|
44
|
+
font-style: inherit;
|
|
45
|
+
line-height: inherit;
|
|
46
|
+
color: inherit;
|
|
47
|
+
}
|
|
44
48
|
`;
|
|
45
|
-
const TruncatedText = ({ value = "" }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TruncatedSpan, { children: value });
|
|
49
|
+
const TruncatedText = ({ value = "" }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TruncatedSpan, { variant: "b2", component: "span", truncateWithEllipsis: true, children: value });
|
|
46
50
|
var TruncatedText_default = TruncatedText;
|
|
47
51
|
//# sourceMappingURL=TruncatedText.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/TruncatedText.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { styled } from '@elliemae/ds-system';\n\nconst TruncatedSpan = styled
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport { styled } from '@elliemae/ds-system';\nimport { DSTypography } from '@elliemae/ds-typography';\n\n/**\n * PUI-18953: the value renders through DSTypography, `b2` like the slots around it (`dsComboboxSelection` for the\n * single-select value, `dsComboboxInputPlaceholder` for the placeholder). `truncateWithEllipsis` applies the same five\n * declarations this span had before (ellipsis, nowrap, overflow hidden, inline-block, max-width 100%), so it is still a\n * single `<span>` and the placeholder's `& span::after` italic-clipping fix still matches only this one.\n *\n * The font is inherited from the slot around it rather than taken from b2 itself: that slot is already b2 and carries\n * the italic placeholder and the state colors, and inheriting keeps the theme's `styleOverrides` for those slots\n * reaching the text. `&&` (0-2-0) beats DSTypography's own single class whatever the injection order. Longhands, one\n * per property b2 sets (plus font-style and color, which the slots set).\n *\n * No name/slot: the injection point is the slot around it (KNOWN_INTENTIONAL_DEVIATIONS.md #4).\n */\nconst TruncatedSpan = styled(DSTypography)`\n && {\n font-family: inherit;\n font-size: inherit;\n font-weight: inherit;\n font-style: inherit;\n line-height: inherit;\n color: inherit;\n }\n`;\n\ninterface TruncatedTextProps {\n value?: string;\n}\n\n/**\n * PUI-18660: this used to render its own hand-rolled hover tooltip on truncation.\n * That internal tooltip was removed \u2014 truncation is visual-only here. Consumers who\n * need the full value on hover/focus (e.g. readOnly/aria-disabled states where the\n * menu can't be opened) wrap the combobox in DSTooltipV3 themselves; see the\n * \"WithTooltip\" examples in ds-form-single-combobox / ds-form-multi-combobox.\n */\nconst TruncatedText = ({ value = '' }: TruncatedTextProps) => (\n <TruncatedSpan variant=\"b2\" component=\"span\" truncateWithEllipsis>\n {value}\n </TruncatedSpan>\n);\n\nexport { TruncatedText };\nexport default TruncatedText;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADwCrB;AAvCF,uBAAuB;AACvB,2BAA6B;AAe7B,MAAM,oBAAgB,yBAAO,iCAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAsBzC,MAAM,gBAAgB,CAAC,EAAE,QAAQ,GAAG,MAClC,4CAAC,iBAAc,SAAQ,MAAK,WAAU,QAAO,sBAAoB,MAC9D,iBACH;AAIF,IAAO,wBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -67,9 +67,13 @@ const useComboBox = (props) => {
|
|
|
67
67
|
forceFocusFirstOptionOnType,
|
|
68
68
|
inline,
|
|
69
69
|
readOnly,
|
|
70
|
+
disabled,
|
|
70
71
|
isMenuOpenableWithReadOnly
|
|
71
72
|
} = propsWithDefaults;
|
|
72
73
|
const instanceUid = (0, import_react.useMemo)(() => id || (0, import_uid.uid)(5), [id]);
|
|
74
|
+
const shouldPreventContextMenuOpening = Boolean(applyAriaDisabled || readOnly) && !isMenuOpenableWithReadOnly;
|
|
75
|
+
const isInteractionLocked = (0, import_ds_props_helpers.isLocked)({ disabled, applyAriaDisabled, readOnly });
|
|
76
|
+
const isMenuOpeningLocked = Boolean(disabled || shouldPreventContextMenuOpening);
|
|
73
77
|
const menuState = (0, import_react.useMemo)(() => {
|
|
74
78
|
if (isMenuOpen !== void 0) return isMenuOpen;
|
|
75
79
|
return showPopover;
|
|
@@ -106,7 +110,7 @@ const useComboBox = (props) => {
|
|
|
106
110
|
}, [correctOptions, inputValue, forceFocusFirstOptionOnType, scrollOptionIntoView, selectedValues]);
|
|
107
111
|
const setMenuState = (0, import_react.useCallback)(
|
|
108
112
|
(newState, reason, e) => {
|
|
109
|
-
if (
|
|
113
|
+
if (shouldPreventContextMenuOpening) return;
|
|
110
114
|
if (onMenuChange !== void 0) onMenuChange(newState, reason, e);
|
|
111
115
|
setShowPopover(newState);
|
|
112
116
|
if (!inputValue && newState && !focusOptionIdx && !(0, import_listHelper.isSelectedValueEmpty)(selectedValues)) {
|
|
@@ -117,14 +121,21 @@ const useComboBox = (props) => {
|
|
|
117
121
|
setFocusOptionIdx("");
|
|
118
122
|
}
|
|
119
123
|
},
|
|
120
|
-
[
|
|
124
|
+
[
|
|
125
|
+
shouldPreventContextMenuOpening,
|
|
126
|
+
onMenuChange,
|
|
127
|
+
inputValue,
|
|
128
|
+
focusOptionIdx,
|
|
129
|
+
selectedValues,
|
|
130
|
+
correctOptions,
|
|
131
|
+
scrollOptionIntoView
|
|
132
|
+
]
|
|
121
133
|
);
|
|
122
134
|
(0, import_react.useEffect)(() => {
|
|
123
|
-
if (inline) {
|
|
135
|
+
if (inline && !disabled && !shouldPreventContextMenuOpening) {
|
|
124
136
|
setMenuState(true, "inline");
|
|
125
137
|
}
|
|
126
138
|
}, []);
|
|
127
|
-
const shouldPreventContextMenuOpening = readOnly && !isMenuOpenableWithReadOnly;
|
|
128
139
|
const ctx = (0, import_react.useMemo)(
|
|
129
140
|
() => ({
|
|
130
141
|
props: { ...propsWithDefaults },
|
|
@@ -149,7 +160,9 @@ const useComboBox = (props) => {
|
|
|
149
160
|
correctOptions,
|
|
150
161
|
instanceUid,
|
|
151
162
|
optionsPerSection,
|
|
152
|
-
shouldPreventContextMenuOpening
|
|
163
|
+
shouldPreventContextMenuOpening,
|
|
164
|
+
isInteractionLocked,
|
|
165
|
+
isMenuOpeningLocked
|
|
153
166
|
}),
|
|
154
167
|
[
|
|
155
168
|
scrollOptionIntoView,
|
|
@@ -169,7 +182,9 @@ const useComboBox = (props) => {
|
|
|
169
182
|
internalRef,
|
|
170
183
|
instanceUid,
|
|
171
184
|
optionsPerSection,
|
|
172
|
-
shouldPreventContextMenuOpening
|
|
185
|
+
shouldPreventContextMenuOpening,
|
|
186
|
+
isInteractionLocked,
|
|
187
|
+
isMenuOpeningLocked
|
|
173
188
|
]
|
|
174
189
|
);
|
|
175
190
|
return ctx;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/config/useComboBox.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable max-lines */\n/* eslint-disable import/prefer-default-export */\n/* eslint-disable complexity */\n/* eslint-disable max-statements */\nimport { type DSFastListT } from '@elliemae/ds-fast-list';\nimport { useMemoMergePropsWithDefault, useValidateTypescriptPropTypes } from '@elliemae/ds-props-helpers';\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { uid } from 'uid';\nimport type { DSCommonComboboxPropsT } from '../DSCommonComboboxPropsT.js';\nimport type { DSComboboxT } from '../react-desc-prop-types.js';\nimport { ComboboxPropTypes, defaultProps } from '../react-desc-prop-types.js';\nimport { DSComboBoxName } from '../theming.js';\nimport { getFirstOption, isSelectedValueEmpty } from '../utils/listHelper.js';\nimport { useCorrectOptions } from './useCorrectOptions.js';\nimport { useOptionsPerSection } from './useOptionsPerSection.js';\n\ntype ActionRefVirtualized = {\n scrollTo: (index: number, opts?: DSFastListT.ScrollToOptions) => void;\n};\n\nexport const useComboBox = <\n T extends DSCommonComboboxPropsT.ItemOption | DSCommonComboboxPropsT.ItemOption[] | null =\n DSCommonComboboxPropsT.ItemOption | DSCommonComboboxPropsT.ItemOption[],\n>(\n props: DSComboboxT.Props<T>,\n) => {\n const propsWithDefaults = useMemoMergePropsWithDefault<DSComboboxT.Props<T>>(\n props,\n // we have a weird inference going on in this component\n // weird because we are even renaming selectedValues to selectedValue for the single combobox,\n // type safety here is flanky, we need to cast this, as a one ad-hoc exception\n defaultProps as DSComboboxT.Props<T>,\n );\n useValidateTypescriptPropTypes(propsWithDefaults, ComboboxPropTypes, DSComboBoxName);\n const [showPopover, setShowPopover] = useState<boolean>(false);\n const [referenceElement, setReferenceElement] = useState<HTMLElement | null>(null);\n\n const [inputValue, setInputValue] = useState<string>('');\n const [hasFocus, setHasFocus] = useState<boolean>(false);\n\n const internalRef = useRef<HTMLInputElement>(null);\n const wrapperListRef = useRef<HTMLDivElement>(null);\n\n const selectedOptionsRef = useRef<HTMLDivElement>(null);\n const controlsWrapperRef = useRef<HTMLDivElement>(null);\n const pillGroupRef = useRef<HTMLDivElement>(null);\n\n const {\n id,\n selectedValues,\n isMenuOpen,\n onMenuChange,\n applyAriaDisabled,\n forceFocusFirstOptionOnType,\n inline,\n readOnly,\n isMenuOpenableWithReadOnly,\n } = propsWithDefaults;\n\n const instanceUid = useMemo(() => id || uid(5), [id]);\n\n const menuState = useMemo(() => {\n if (isMenuOpen !== undefined) return isMenuOpen;\n return showPopover;\n }, [showPopover, isMenuOpen]);\n\n // ---------------------------------------------------------------------------\n // Options with creatable option + filtered by selected\n // ---------------------------------------------------------------------------\n\n const correctOptions = useCorrectOptions(propsWithDefaults, inputValue);\n\n const optionsPerSection = useOptionsPerSection(correctOptions);\n\n const actionRef: ActionRefVirtualized = {\n scrollTo: () => {},\n };\n\n const listRef = useRef<ActionRefVirtualized>(actionRef);\n\n // ===========================================================================\n // Scroll into view function\n // ===========================================================================\n const scrollOptionIntoView = useCallback(\n (dsId: string, opts: DSFastListT.ScrollToOptions = { align: 'center' } as DSFastListT.ScrollToOptions) => {\n listRef.current.scrollTo(\n correctOptions.findIndex((opt) => opt.dsId === dsId),\n opts,\n );\n requestAnimationFrame(() => {\n listRef.current.scrollTo(\n correctOptions.findIndex((opt) => opt.dsId === dsId),\n opts,\n );\n });\n },\n [correctOptions],\n );\n\n // ===========================================================================\n // Init focused option when opening the menu list\n // ===========================================================================\n\n const [focusOptionIdx, setFocusOptionIdx] = useState<string>('');\n\n useEffect(() => {\n if (inputValue && forceFocusFirstOptionOnType) {\n const focusedValue = getFirstOption(correctOptions);\n setFocusOptionIdx(focusedValue);\n scrollOptionIntoView(focusedValue, { align: 'center' });\n }\n }, [correctOptions, inputValue, forceFocusFirstOptionOnType, scrollOptionIntoView, selectedValues]);\n\n const setMenuState = useCallback(\n (\n newState: boolean,\n reason: string,\n e?: React.KeyboardEvent | React.MouseEvent | React.ChangeEvent<HTMLInputElement>,\n ) => {\n if (
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADKvB,
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-lines */\n/* eslint-disable import/prefer-default-export */\n/* eslint-disable complexity */\n/* eslint-disable max-statements */\nimport { type DSFastListT } from '@elliemae/ds-fast-list';\nimport { isLocked, useMemoMergePropsWithDefault, useValidateTypescriptPropTypes } from '@elliemae/ds-props-helpers';\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { uid } from 'uid';\nimport type { DSCommonComboboxPropsT } from '../DSCommonComboboxPropsT.js';\nimport type { DSComboboxT } from '../react-desc-prop-types.js';\nimport { ComboboxPropTypes, defaultProps } from '../react-desc-prop-types.js';\nimport { DSComboBoxName } from '../theming.js';\nimport { getFirstOption, isSelectedValueEmpty } from '../utils/listHelper.js';\nimport { useCorrectOptions } from './useCorrectOptions.js';\nimport { useOptionsPerSection } from './useOptionsPerSection.js';\n\ntype ActionRefVirtualized = {\n scrollTo: (index: number, opts?: DSFastListT.ScrollToOptions) => void;\n};\n\nexport const useComboBox = <\n T extends DSCommonComboboxPropsT.ItemOption | DSCommonComboboxPropsT.ItemOption[] | null =\n DSCommonComboboxPropsT.ItemOption | DSCommonComboboxPropsT.ItemOption[],\n>(\n props: DSComboboxT.Props<T>,\n) => {\n const propsWithDefaults = useMemoMergePropsWithDefault<DSComboboxT.Props<T>>(\n props,\n // we have a weird inference going on in this component\n // weird because we are even renaming selectedValues to selectedValue for the single combobox,\n // type safety here is flanky, we need to cast this, as a one ad-hoc exception\n defaultProps as DSComboboxT.Props<T>,\n );\n useValidateTypescriptPropTypes(propsWithDefaults, ComboboxPropTypes, DSComboBoxName);\n const [showPopover, setShowPopover] = useState<boolean>(false);\n const [referenceElement, setReferenceElement] = useState<HTMLElement | null>(null);\n\n const [inputValue, setInputValue] = useState<string>('');\n const [hasFocus, setHasFocus] = useState<boolean>(false);\n\n const internalRef = useRef<HTMLInputElement>(null);\n const wrapperListRef = useRef<HTMLDivElement>(null);\n\n const selectedOptionsRef = useRef<HTMLDivElement>(null);\n const controlsWrapperRef = useRef<HTMLDivElement>(null);\n const pillGroupRef = useRef<HTMLDivElement>(null);\n\n const {\n id,\n selectedValues,\n isMenuOpen,\n onMenuChange,\n applyAriaDisabled,\n forceFocusFirstOptionOnType,\n inline,\n readOnly,\n disabled,\n isMenuOpenableWithReadOnly,\n } = propsWithDefaults;\n\n const instanceUid = useMemo(() => id || uid(5), [id]);\n\n // applyAriaDisabled and readOnly are the same soft lock: both keep the menu closed unless isMenuOpenableWithReadOnly\n // (the listbox may expand to read)\n const shouldPreventContextMenuOpening = Boolean(applyAriaDisabled || readOnly) && !isMenuOpenableWithReadOnly;\n // PUI-16695: disabled blocks every action. applyAriaDisabled and readOnly block every change of the value, and block\n // opening the menu unless isMenuOpenableWithReadOnly is set (see above)\n const isInteractionLocked = isLocked({ disabled, applyAriaDisabled, readOnly });\n const isMenuOpeningLocked = Boolean(disabled || shouldPreventContextMenuOpening);\n const menuState = useMemo(() => {\n if (isMenuOpen !== undefined) return isMenuOpen;\n return showPopover;\n }, [showPopover, isMenuOpen]);\n\n // ---------------------------------------------------------------------------\n // Options with creatable option + filtered by selected\n // ---------------------------------------------------------------------------\n\n const correctOptions = useCorrectOptions(propsWithDefaults, inputValue);\n\n const optionsPerSection = useOptionsPerSection(correctOptions);\n\n const actionRef: ActionRefVirtualized = {\n scrollTo: () => {},\n };\n\n const listRef = useRef<ActionRefVirtualized>(actionRef);\n\n // ===========================================================================\n // Scroll into view function\n // ===========================================================================\n const scrollOptionIntoView = useCallback(\n (dsId: string, opts: DSFastListT.ScrollToOptions = { align: 'center' } as DSFastListT.ScrollToOptions) => {\n listRef.current.scrollTo(\n correctOptions.findIndex((opt) => opt.dsId === dsId),\n opts,\n );\n requestAnimationFrame(() => {\n listRef.current.scrollTo(\n correctOptions.findIndex((opt) => opt.dsId === dsId),\n opts,\n );\n });\n },\n [correctOptions],\n );\n\n // ===========================================================================\n // Init focused option when opening the menu list\n // ===========================================================================\n\n const [focusOptionIdx, setFocusOptionIdx] = useState<string>('');\n\n useEffect(() => {\n if (inputValue && forceFocusFirstOptionOnType) {\n const focusedValue = getFirstOption(correctOptions);\n setFocusOptionIdx(focusedValue);\n scrollOptionIntoView(focusedValue, { align: 'center' });\n }\n }, [correctOptions, inputValue, forceFocusFirstOptionOnType, scrollOptionIntoView, selectedValues]);\n\n const setMenuState = useCallback(\n (\n newState: boolean,\n reason: string,\n e?: React.KeyboardEvent | React.MouseEvent | React.ChangeEvent<HTMLInputElement>,\n ) => {\n if (shouldPreventContextMenuOpening) return;\n if (onMenuChange !== undefined) onMenuChange(newState, reason, e);\n setShowPopover(newState);\n if (!inputValue && newState && !focusOptionIdx && !isSelectedValueEmpty(selectedValues)) {\n const focusedValue = getFirstOption(correctOptions, selectedValues);\n setFocusOptionIdx(focusedValue);\n scrollOptionIntoView(focusedValue, { align: 'center' });\n } else {\n setFocusOptionIdx('');\n }\n },\n [\n shouldPreventContextMenuOpening,\n onMenuChange,\n inputValue,\n focusOptionIdx,\n selectedValues,\n correctOptions,\n scrollOptionIntoView,\n ],\n );\n\n // We need to force the auto focus for the inline since we dont control the floating wrapper.\n // setMenuState ignores the soft locks unless isMenuOpenableWithReadOnly; disabled (hard lock) is not, so it is gated here.\n useEffect(() => {\n if (inline && !disabled && !shouldPreventContextMenuOpening) {\n setMenuState(true, 'inline');\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const ctx = useMemo(\n () => ({\n props: { ...propsWithDefaults },\n menuState,\n referenceElement,\n listRef,\n focusOptionIdx,\n selectedOptionsRef,\n controlsWrapperRef,\n inputValue,\n setInputValue,\n setMenuState,\n hasFocus,\n pillGroupRef,\n wrapperListRef,\n setHasFocus,\n setFocusOptionIdx,\n scrollOptionIntoView,\n setReferenceElement,\n setShowPopover,\n internalRef,\n correctOptions,\n instanceUid,\n optionsPerSection,\n shouldPreventContextMenuOpening,\n isInteractionLocked,\n isMenuOpeningLocked,\n }),\n [\n scrollOptionIntoView,\n setMenuState,\n correctOptions,\n hasFocus,\n propsWithDefaults,\n inputValue,\n focusOptionIdx,\n wrapperListRef,\n menuState,\n pillGroupRef,\n referenceElement,\n selectedOptionsRef,\n controlsWrapperRef,\n listRef,\n internalRef,\n instanceUid,\n optionsPerSection,\n shouldPreventContextMenuOpening,\n isInteractionLocked,\n isMenuOpeningLocked,\n ],\n );\n\n return ctx;\n};\n\nexport type UseComboBoxReturnType = ReturnType<typeof useComboBox>;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADKvB,8BAAuF;AACvF,mBAAkE;AAClE,iBAAoB;AAGpB,mCAAgD;AAChD,qBAA+B;AAC/B,wBAAqD;AACrD,+BAAkC;AAClC,kCAAqC;AAM9B,MAAM,cAAc,CAIzB,UACG;AACH,QAAM,wBAAoB;AAAA,IACxB;AAAA;AAAA;AAAA;AAAA,IAIA;AAAA,EACF;AACA,8DAA+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A;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -56,7 +56,7 @@ const StyledDropDownButton = (0, import_ds_system.styled)(import_ds_button_v2.DS
|
|
|
56
56
|
fill: ${({ theme, disabled }) => disabled ? theme.colors.neutral["400"] : theme.colors.brand["600"]};
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
${({ applyAriaDisabled }) => applyAriaDisabled &&
|
|
59
|
+
${({ applyAriaDisabled }) => applyAriaDisabled && import_ds_system.ariaDisabledInteractionCss}
|
|
60
60
|
`;
|
|
61
61
|
const DropdownIndicator = () => {
|
|
62
62
|
const {
|
|
@@ -69,6 +69,7 @@ const DropdownIndicator = () => {
|
|
|
69
69
|
const handleOnClick = (0, import_react.useCallback)((e) => {
|
|
70
70
|
e.preventDefault();
|
|
71
71
|
}, []);
|
|
72
|
+
const isDropdownLocked = Boolean(applyAriaDisabled || readOnly) && !isMenuOpenableWithReadOnly;
|
|
72
73
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
73
74
|
StyledDropDownButton,
|
|
74
75
|
{
|
|
@@ -79,14 +80,14 @@ const DropdownIndicator = () => {
|
|
|
79
80
|
"aria-controls": `combo-listbox-${instanceUid}`,
|
|
80
81
|
"aria-labelledby": "combo-label",
|
|
81
82
|
disabled,
|
|
82
|
-
"aria-disabled":
|
|
83
|
+
"aria-disabled": !disabled && isDropdownLocked ? true : void 0,
|
|
83
84
|
"aria-expanded": menuState,
|
|
84
85
|
"aria-haspopup": "listbox",
|
|
85
86
|
"aria-hidden": true,
|
|
86
87
|
buttonType: "icon",
|
|
87
88
|
tabIndex: -1,
|
|
88
89
|
size: "s",
|
|
89
|
-
applyAriaDisabled,
|
|
90
|
+
applyAriaDisabled: isDropdownLocked,
|
|
90
91
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_icons.ChevronSmallDown, { size: "s" })
|
|
91
92
|
}
|
|
92
93
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/parts/DropdownIndicator.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable react/prop-types */\n/* eslint-disable import/no-cycle */\nimport React, { useCallback, useContext } from 'react';\nimport { styled } from '@elliemae/ds-system';\nimport { DSButtonV3 } from '@elliemae/ds-button-v2';\nimport { ChevronSmallDown } from '@elliemae/ds-icons';\nimport { useOwnerProps } from '@elliemae/ds-props-helpers';\nimport ComboBoxContext from '../ComboBoxCTX.js';\nimport { ComboboxDataTestid } from '../ComboboxDataTestids.js';\nimport { DSFormComboboxName, FORM_COMBOBOX_SLOTS } from '../constants/index.js';\n\nconst StyledDropDownButton = styled(DSButtonV3, {\n name: DSFormComboboxName,\n slot: FORM_COMBOBOX_SLOTS.DROPDOWN_BUTTON,\n})<{ applyAriaDisabled: boolean | undefined }>`\n &:focus::after {\n border: none;\n }\n &:hover:not(:disabled) {\n background-color: transparent;\n }\n\n & svg {\n fill: ${({ theme, disabled }) => (disabled ? theme.colors.neutral['400'] : theme.colors.brand['600'])};\n }\n\n ${({ applyAriaDisabled }) => applyAriaDisabled &&
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable react/prop-types */\n/* eslint-disable import/no-cycle */\nimport React, { useCallback, useContext } from 'react';\nimport { styled, ariaDisabledInteractionCss } from '@elliemae/ds-system';\nimport { DSButtonV3 } from '@elliemae/ds-button-v2';\nimport { ChevronSmallDown } from '@elliemae/ds-icons';\nimport { useOwnerProps } from '@elliemae/ds-props-helpers';\nimport ComboBoxContext from '../ComboBoxCTX.js';\nimport { ComboboxDataTestid } from '../ComboboxDataTestids.js';\nimport { DSFormComboboxName, FORM_COMBOBOX_SLOTS } from '../constants/index.js';\n\nconst StyledDropDownButton = styled(DSButtonV3, {\n name: DSFormComboboxName,\n slot: FORM_COMBOBOX_SLOTS.DROPDOWN_BUTTON,\n})<{ applyAriaDisabled: boolean | undefined }>`\n &:focus::after {\n border: none;\n }\n &:hover:not(:disabled) {\n background-color: transparent;\n }\n\n & svg {\n fill: ${({ theme, disabled }) => (disabled ? theme.colors.neutral['400'] : theme.colors.brand['600'])};\n }\n\n ${({ applyAriaDisabled }) => applyAriaDisabled && ariaDisabledInteractionCss}\n`;\n\nexport const DropdownIndicator = (): JSX.Element => {\n const {\n props,\n props: { disabled, applyAriaDisabled, readOnly, isMenuOpenableWithReadOnly },\n menuState,\n instanceUid,\n } = useContext(ComboBoxContext);\n\n const { getOwnerProps, getOwnerPropsArguments } = useOwnerProps(props);\n\n const handleOnClick: (e: React.MouseEvent<HTMLButtonElement> | React.KeyboardEvent<HTMLButtonElement>) => void =\n useCallback((e) => {\n e.preventDefault();\n }, []);\n\n // applyAriaDisabled and readOnly are the same soft lock; an openable one still opens its menu, so it is not locked here\n const isDropdownLocked = Boolean(applyAriaDisabled || readOnly) && !isMenuOpenableWithReadOnly;\n\n return (\n <StyledDropDownButton\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n onClick={handleOnClick}\n data-testid={ComboboxDataTestid.DROPDOWN}\n aria-controls={`combo-listbox-${instanceUid}`}\n aria-labelledby=\"combo-label\"\n disabled={disabled}\n // button never use readOnly attribute: the soft lock is aria-disabled (Dimsum never writes aria-readonly)\n aria-disabled={!disabled && isDropdownLocked ? true : undefined}\n aria-expanded={menuState}\n aria-haspopup=\"listbox\"\n aria-hidden\n buttonType=\"icon\"\n tabIndex={-1}\n size=\"s\"\n applyAriaDisabled={isDropdownLocked}\n >\n <ChevronSmallDown size=\"s\" />\n </StyledDropDownButton>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADkEjB;AAhEN,mBAA+C;AAC/C,uBAAmD;AACnD,0BAA2B;AAC3B,sBAAiC;AACjC,8BAA8B;AAC9B,yBAA4B;AAC5B,iCAAmC;AACnC,uBAAwD;AAExD,MAAM,2BAAuB,yBAAO,gCAAY;AAAA,EAC9C,MAAM;AAAA,EACN,MAAM,qCAAoB;AAC5B,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YASW,CAAC,EAAE,OAAO,SAAS,MAAO,WAAW,MAAM,OAAO,QAAQ,KAAK,IAAI,MAAM,OAAO,MAAM,KAAK,CAAE;AAAA;AAAA;AAAA,IAGrG,CAAC,EAAE,kBAAkB,MAAM,qBAAqB,2CAA0B;AAAA;AAGvE,MAAM,oBAAoB,MAAmB;AAClD,QAAM;AAAA,IACJ;AAAA,IACA,OAAO,EAAE,UAAU,mBAAmB,UAAU,2BAA2B;AAAA,IAC3E;AAAA,IACA;AAAA,EACF,QAAI,yBAAW,mBAAAA,OAAe;AAE9B,QAAM,EAAE,eAAe,uBAAuB,QAAI,uCAAc,KAAK;AAErE,QAAM,oBACJ,0BAAY,CAAC,MAAM;AACjB,MAAE,eAAe;AAAA,EACnB,GAAG,CAAC,CAAC;AAGP,QAAM,mBAAmB,QAAQ,qBAAqB,QAAQ,KAAK,CAAC;AAEpE,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA,SAAS;AAAA,MACT,eAAa,8CAAmB;AAAA,MAChC,iBAAe,iBAAiB,WAAW;AAAA,MAC3C,mBAAgB;AAAA,MAChB;AAAA,MAEA,iBAAe,CAAC,YAAY,mBAAmB,OAAO;AAAA,MACtD,iBAAe;AAAA,MACf,iBAAc;AAAA,MACd,eAAW;AAAA,MACX,YAAW;AAAA,MACX,UAAU;AAAA,MACV,MAAK;AAAA,MACL,mBAAmB;AAAA,MAEnB,sDAAC,oCAAiB,MAAK,KAAI;AAAA;AAAA,EAC7B;AAEJ;",
|
|
6
6
|
"names": ["ComboBoxContext"]
|
|
7
7
|
}
|
|
@@ -38,6 +38,7 @@ var import_react2 = __toESM(require("react"));
|
|
|
38
38
|
var import_ds_system = require("@elliemae/ds-system");
|
|
39
39
|
var import_ds_typography = require("@elliemae/ds-typography");
|
|
40
40
|
var import_ds_menu_items = require("@elliemae/ds-menu-items");
|
|
41
|
+
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
41
42
|
var import_constants = require("../constants.js");
|
|
42
43
|
var import_ComboboxDataTestids = require("../ComboboxDataTestids.js");
|
|
43
44
|
var import_listHelper = require("../utils/listHelper.js");
|
|
@@ -64,7 +65,8 @@ const Section = import_react2.default.memo((props) => {
|
|
|
64
65
|
options,
|
|
65
66
|
handleClick,
|
|
66
67
|
getOwnerProps,
|
|
67
|
-
getOwnerPropsArguments
|
|
68
|
+
getOwnerPropsArguments,
|
|
69
|
+
isInteractionLocked
|
|
68
70
|
} = props;
|
|
69
71
|
const id = `${label.replace(/ /g, "")}-section`;
|
|
70
72
|
const CBItem = Array.isArray(selectedValues) ? import_styled.StyledMultiMenuItem : import_styled.StyledSingleMenuItem;
|
|
@@ -105,6 +107,11 @@ const Section = import_react2.default.memo((props) => {
|
|
|
105
107
|
if (type === import_constants.MENU_OPTION_TYPES.SEPARATOR) {
|
|
106
108
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_menu_items.Separator, {}, dsId);
|
|
107
109
|
}
|
|
110
|
+
const {
|
|
111
|
+
onClick: consumerOnClick,
|
|
112
|
+
onMouseDown: consumerOnMouseDown,
|
|
113
|
+
...restHandlers
|
|
114
|
+
} = (0, import_ds_props_helpers.omitLockedHandlers)(rest, Boolean(isInteractionLocked || disabled || applyAriaDisabled || readOnly));
|
|
108
115
|
return /* @__PURE__ */ (0, import_react.createElement)(
|
|
109
116
|
CBItem,
|
|
110
117
|
{
|
|
@@ -114,16 +121,19 @@ const Section = import_react2.default.memo((props) => {
|
|
|
114
121
|
label: optionLabel,
|
|
115
122
|
dataTestid: import_ComboboxDataTestids.ComboboxDataTestid.OPTION,
|
|
116
123
|
disabled,
|
|
117
|
-
applyAriaDisabled: applyAriaDisabled || readOnly,
|
|
118
|
-
onClick: (e) => {
|
|
119
|
-
if (applyAriaDisabled) return;
|
|
120
|
-
handleClick(option, e);
|
|
121
|
-
},
|
|
122
|
-
onMouseDown: handleOnMouseDown,
|
|
124
|
+
applyAriaDisabled: Boolean(applyAriaDisabled || readOnly || isInteractionLocked),
|
|
123
125
|
isActive: dsId === focusOptionIdx,
|
|
124
126
|
isSelected: option.type === import_constants.MENU_OPTION_TYPES.OPTION && (0, import_listHelper.isSelected)(selectedValues, option),
|
|
125
127
|
tabIndex: -1,
|
|
126
|
-
...
|
|
128
|
+
...restHandlers,
|
|
129
|
+
onClick: (e) => {
|
|
130
|
+
consumerOnClick?.(e);
|
|
131
|
+
handleClick(option, e);
|
|
132
|
+
},
|
|
133
|
+
onMouseDown: (e) => {
|
|
134
|
+
consumerOnMouseDown?.(e);
|
|
135
|
+
handleOnMouseDown(e);
|
|
136
|
+
},
|
|
127
137
|
key: option.dsId,
|
|
128
138
|
dsId: option.dsId
|
|
129
139
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/parts/Section.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React from 'react';\nimport { styled } from '@elliemae/ds-system';\nimport { DSTypography } from '@elliemae/ds-typography';\nimport { Separator } from '@elliemae/ds-menu-items';\n\nimport { MENU_OPTION_TYPES } from '../constants.js';\n\nimport { ComboboxDataTestid } from '../ComboboxDataTestids.js';\nimport type { DSComboboxT } from '../react-desc-prop-types.js';\nimport { isSelected } from '../utils/listHelper.js';\nimport { DSFormComboboxName, FORM_COMBOBOX_SLOTS } from '../constants/index.js';\nimport { StyledSingleMenuItem, StyledMultiMenuItem } from './menu-list/styled.js';\n\ninterface SectionProps {\n label: string;\n wrapperStyles?: React.CSSProperties;\n innerRef?: (instance: HTMLDivElement | null) => void;\n options: DSComboboxT.OptionTypes[];\n handleClick: (option: DSComboboxT.OptionTypes, e: React.MouseEvent<HTMLInputElement>) => void;\n handleOnMouseDown: (e: React.MouseEvent<HTMLLIElement>) => void;\n focusOptionIdx: string;\n selectedValues: DSComboboxT.SelectedOptionsT;\n getOwnerProps: () => object;\n getOwnerPropsArguments?: () => { index: number };\n}\n\nconst StyledSectionWrapper = styled('section', { name: DSFormComboboxName, slot: FORM_COMBOBOX_SLOTS.SECTION_WRAPPER })`\n list-style: none;\n display: grid;\n align-items: center;\n`;\n\n/**\n * The 32px group-label row height comes from this label alone: 8px top + 8px bottom padding +\n * the b3-strong line-height (~16px) = 32px. No min-height needed here.\n *\n * This is one of four independent reimplementations of the section/group-label row \u2014 the menu-items\n * path (ds-menu-items-commons StyledSectionWrapper) and ds-menu-button reach the same 32px via a\n * wrapper min-height instead. Keep all four aligned (PUI-18609); see KNOWN_INTENTIONAL_DEVIATIONS.md.\n */\nconst StyledSectionLabel = styled(DSTypography, { name: DSFormComboboxName, slot: FORM_COMBOBOX_SLOTS.SECTION_LABEL })`\n display: flex;\n align-items: center;\n padding: 8px 16px;\n`;\n\nexport const Section = React.memo((props: SectionProps) => {\n const {\n label,\n wrapperStyles,\n focusOptionIdx,\n selectedValues,\n innerRef,\n handleOnMouseDown,\n options,\n handleClick,\n getOwnerProps,\n getOwnerPropsArguments,\n } = props;\n const id = `${label.replace(/ /g, '')}-section`;\n const CBItem: React.ComponentType<React.ComponentProps<typeof StyledSingleMenuItem>> = Array.isArray(selectedValues)\n ? StyledMultiMenuItem\n : StyledSingleMenuItem;\n\n return (\n <StyledSectionWrapper\n role=\"group\"\n aria-labelledby={id}\n style={wrapperStyles}\n innerRef={innerRef}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n <StyledSectionLabel\n component=\"header\"\n variant=\"b3-strong\"\n id={id}\n role=\"presentation\"\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n {label}\n </StyledSectionLabel>\n {options?.map((option) => {\n const {\n dsId,\n type,\n value,\n label: optionLabel,\n readOnly,\n disabled,\n applyAriaDisabled,\n render,\n ...rest\n } = option;\n\n if (type === MENU_OPTION_TYPES.SEPARATOR) {\n return <Separator key={dsId} />;\n }\n\n return (\n <CBItem\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n value={value}\n label={optionLabel}\n dataTestid={ComboboxDataTestid.OPTION}\n disabled={disabled}\n applyAriaDisabled={applyAriaDisabled || readOnly}\n onClick={(e: React.MouseEvent<HTMLInputElement>) => {\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport { styled } from '@elliemae/ds-system';\nimport { DSTypography } from '@elliemae/ds-typography';\nimport { Separator } from '@elliemae/ds-menu-items';\nimport { omitLockedHandlers } from '@elliemae/ds-props-helpers';\n\nimport { MENU_OPTION_TYPES } from '../constants.js';\n\nimport { ComboboxDataTestid } from '../ComboboxDataTestids.js';\nimport type { DSComboboxT } from '../react-desc-prop-types.js';\nimport { isSelected } from '../utils/listHelper.js';\nimport { DSFormComboboxName, FORM_COMBOBOX_SLOTS } from '../constants/index.js';\nimport { StyledSingleMenuItem, StyledMultiMenuItem } from './menu-list/styled.js';\n\ninterface SectionProps {\n label: string;\n wrapperStyles?: React.CSSProperties;\n innerRef?: (instance: HTMLDivElement | null) => void;\n options: DSComboboxT.OptionTypes[];\n handleClick: (option: DSComboboxT.OptionTypes, e: React.MouseEvent<HTMLInputElement>) => void;\n handleOnMouseDown: (e: React.MouseEvent<HTMLLIElement>) => void;\n focusOptionIdx: string;\n selectedValues: DSComboboxT.SelectedOptionsT;\n getOwnerProps: () => object;\n getOwnerPropsArguments?: () => { index: number };\n // the combobox-level lock (disabled / applyAriaDisabled / readOnly), see ItemRenderer.handleClick\n isInteractionLocked?: boolean;\n}\n\nconst StyledSectionWrapper = styled('section', { name: DSFormComboboxName, slot: FORM_COMBOBOX_SLOTS.SECTION_WRAPPER })`\n list-style: none;\n display: grid;\n align-items: center;\n`;\n\n/**\n * The 32px group-label row height comes from this label alone: 8px top + 8px bottom padding +\n * the b3-strong line-height (~16px) = 32px. No min-height needed here.\n *\n * This is one of four independent reimplementations of the section/group-label row \u2014 the menu-items\n * path (ds-menu-items-commons StyledSectionWrapper) and ds-menu-button reach the same 32px via a\n * wrapper min-height instead. Keep all four aligned (PUI-18609); see KNOWN_INTENTIONAL_DEVIATIONS.md.\n */\nconst StyledSectionLabel = styled(DSTypography, { name: DSFormComboboxName, slot: FORM_COMBOBOX_SLOTS.SECTION_LABEL })`\n display: flex;\n align-items: center;\n padding: 8px 16px;\n`;\n\nexport const Section = React.memo((props: SectionProps) => {\n const {\n label,\n wrapperStyles,\n focusOptionIdx,\n selectedValues,\n innerRef,\n handleOnMouseDown,\n options,\n handleClick,\n getOwnerProps,\n getOwnerPropsArguments,\n isInteractionLocked,\n } = props;\n const id = `${label.replace(/ /g, '')}-section`;\n const CBItem: React.ComponentType<React.ComponentProps<typeof StyledSingleMenuItem>> = Array.isArray(selectedValues)\n ? StyledMultiMenuItem\n : StyledSingleMenuItem;\n\n return (\n <StyledSectionWrapper\n role=\"group\"\n aria-labelledby={id}\n style={wrapperStyles}\n innerRef={innerRef}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n <StyledSectionLabel\n component=\"header\"\n variant=\"b3-strong\"\n id={id}\n role=\"presentation\"\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n {label}\n </StyledSectionLabel>\n {options?.map((option) => {\n const {\n dsId,\n type,\n value,\n label: optionLabel,\n readOnly,\n disabled,\n applyAriaDisabled,\n render,\n ...rest\n } = option;\n\n if (type === MENU_OPTION_TYPES.SEPARATOR) {\n return <Separator key={dsId} />;\n }\n\n // the option's own consumer handlers run before the component's, and are withheld while the combobox or this\n // option is locked\n const {\n onClick: consumerOnClick,\n onMouseDown: consumerOnMouseDown,\n ...restHandlers\n } = omitLockedHandlers(rest, Boolean(isInteractionLocked || disabled || applyAriaDisabled || readOnly));\n\n return (\n <CBItem\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n value={value}\n label={optionLabel}\n dataTestid={ComboboxDataTestid.OPTION}\n disabled={disabled}\n applyAriaDisabled={Boolean(applyAriaDisabled || readOnly || isInteractionLocked)}\n isActive={dsId === focusOptionIdx}\n isSelected={option.type === MENU_OPTION_TYPES.OPTION && isSelected(selectedValues, option)}\n tabIndex={-1}\n {...restHandlers}\n onClick={(e: React.MouseEvent<HTMLInputElement>) => {\n consumerOnClick?.(e);\n handleClick(option, e);\n }}\n onMouseDown={(e: React.MouseEvent<HTMLLIElement>) => {\n consumerOnMouseDown?.(e);\n handleOnMouseDown(e);\n }}\n key={option.dsId}\n dsId={option.dsId}\n />\n );\n })}\n </StyledSectionWrapper>\n );\n});\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+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AEJ,cAAI,SAAS,mCAAkB,WAAW;AACxC,mBAAO,4CAAC,oCAAe,IAAM;AAAA,UAC/B;AAIA,gBAAM;AAAA,YACJ,SAAS;AAAA,YACT,aAAa;AAAA,YACb,GAAG;AAAA,UACL,QAAI,4CAAmB,MAAM,QAAQ,uBAAuB,YAAY,qBAAqB,QAAQ,CAAC;AAEtG,iBACE;AAAA,YAAC;AAAA;AAAA,cACC;AAAA,cACA;AAAA,cACA;AAAA,cACA,OAAO;AAAA,cACP,YAAY,8CAAmB;AAAA,cAC/B;AAAA,cACA,mBAAmB,QAAQ,qBAAqB,YAAY,mBAAmB;AAAA,cAC/E,UAAU,SAAS;AAAA,cACnB,YAAY,OAAO,SAAS,mCAAkB,cAAU,8BAAW,gBAAgB,MAAM;AAAA,cACzF,UAAU;AAAA,cACT,GAAG;AAAA,cACJ,SAAS,CAAC,MAA0C;AAClD,kCAAkB,CAAC;AACnB,4BAAY,QAAQ,CAAC;AAAA,cACvB;AAAA,cACA,aAAa,CAAC,MAAuC;AACnD,sCAAsB,CAAC;AACvB,kCAAkB,CAAC;AAAA,cACrB;AAAA,cACA,KAAK,OAAO;AAAA,cACZ,MAAM,OAAO;AAAA;AAAA,UACf;AAAA,QAEJ,CAAC;AAAA;AAAA;AAAA,EACH;AAEJ,CAAC;",
|
|
6
6
|
"names": ["import_react", "import_constants", "React"]
|
|
7
7
|
}
|
|
@@ -51,7 +51,9 @@ const Container = () => {
|
|
|
51
51
|
placementOrderPreference,
|
|
52
52
|
isLoading,
|
|
53
53
|
isSkeleton,
|
|
54
|
+
disabled,
|
|
54
55
|
applyAriaDisabled,
|
|
56
|
+
readOnly,
|
|
55
57
|
popperProps
|
|
56
58
|
} = props;
|
|
57
59
|
const globalAttributes = (0, import_ds_props_helpers.useGetGlobalAttributes)(props);
|
|
@@ -95,7 +97,8 @@ const Container = () => {
|
|
|
95
97
|
"data-testid": dataTestId ?? import_ComboboxDataTestids.ComboboxDataTestid.CONTAINER,
|
|
96
98
|
innerRef: refs.setReference,
|
|
97
99
|
className,
|
|
98
|
-
|
|
100
|
+
$disabled: Boolean(disabled),
|
|
101
|
+
$applyAriaDisabled: Boolean(applyAriaDisabled || readOnly),
|
|
99
102
|
...xStyledProps,
|
|
100
103
|
getOwnerProps,
|
|
101
104
|
getOwnerPropsArguments,
|
|
@@ -118,7 +121,7 @@ const Container = () => {
|
|
|
118
121
|
{
|
|
119
122
|
tabIndex: -1,
|
|
120
123
|
onMouseDown: handleMouseDown,
|
|
121
|
-
applyAriaDisabled: applyAriaDisabled
|
|
124
|
+
$applyAriaDisabled: Boolean(applyAriaDisabled || readOnly),
|
|
122
125
|
getOwnerProps,
|
|
123
126
|
getOwnerPropsArguments,
|
|
124
127
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_menu_list.MenuList, {})
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/container/Container.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable consistent-return */\n/* eslint-disable complexity */\nimport { FloatingWrapper, useFloatingContext } from '@elliemae/ds-floating-context';\nimport { useGetGlobalAttributes, useGetXstyledProps, useOwnerProps } from '@elliemae/ds-props-helpers';\nimport React, { useCallback, useContext, useEffect, useMemo } from 'react';\nimport ComboBoxContext from '../../ComboBoxCTX.js';\nimport { ComboboxDataTestid } from '../../ComboboxDataTestids.js';\nimport { Controls } from '../controls/index.js';\nimport { LiveRegion } from '../LiveRegion.js';\nimport { MenuList } from '../menu-list/index.js';\nimport { StyledContainer, StyledPopperWrapper } from './styled.js';\n\nexport const Container = (): JSX.Element => {\n const { props, setMenuState, menuState } = useContext(ComboBoxContext);\n\n const {\n inline,\n startPlacementPreference,\n placementOrderPreference,\n isLoading,\n isSkeleton,\n applyAriaDisabled,\n popperProps,\n } = props;\n const globalAttributes = useGetGlobalAttributes(props) as ReturnType<typeof useGetGlobalAttributes> & {\n 'data-testid'?: string;\n };\n const { zIndex, ...xStyledProps } = useGetXstyledProps(props);\n const { getOwnerProps, getOwnerPropsArguments } = useOwnerProps(props);\n\n const correctZIndex = zIndex ? parseInt(zIndex as string, 10) : undefined;\n // Removing possible collisionable props\n const { className, 'data-testid': dataTestId } = globalAttributes;\n const handleMouseDown = useCallback((e: React.MouseEvent) => {\n e.preventDefault();\n }, []);\n\n useEffect(() => {\n const closeMenuOnWindowBlur = () => {\n if (menuState) setMenuState(false, 'blur');\n };\n\n window.addEventListener('blur', closeMenuOnWindowBlur);\n\n return () => {\n window.removeEventListener('blur', closeMenuOnWindowBlur);\n };\n }, [menuState, setMenuState]);\n\n // In inline mode the combobox is rendered inside a consumer-controlled FloatingWrapper.\n // The consumer owns dismissal; if we closed the internal menuState here, the outer wrapper\n // would stay open and the user would see the input without options (\"weird state\").\n const handleClickOutside = useCallback(() => {\n if (inline) return;\n setMenuState(false, 'blur');\n }, [setMenuState, inline]);\n\n const config = useMemo(\n () => ({\n placement: startPlacementPreference,\n withoutAnimation: true,\n placementOrderPreference,\n zIndex: correctZIndex,\n customOffset: [0, 5] as [number, number],\n externallyControlledIsOpen: menuState,\n // Gate on `!inline` \u2014 in inline mode the consumer's outer wrapper handles dismissal.\n onClickOutside: inline ? undefined : handleClickOutside,\n }),\n [startPlacementPreference, placementOrderPreference, correctZIndex, menuState, inline, handleClickOutside],\n );\n\n const { refs, floatingStyles, context } = useFloatingContext(config);\n\n return (\n <StyledContainer\n data-testid={dataTestId ?? ComboboxDataTestid.CONTAINER}\n innerRef={refs.setReference}\n className={className}\n applyAriaDisabled={applyAriaDisabled
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable consistent-return */\n/* eslint-disable complexity */\nimport { FloatingWrapper, useFloatingContext } from '@elliemae/ds-floating-context';\nimport { useGetGlobalAttributes, useGetXstyledProps, useOwnerProps } from '@elliemae/ds-props-helpers';\nimport React, { useCallback, useContext, useEffect, useMemo } from 'react';\nimport ComboBoxContext from '../../ComboBoxCTX.js';\nimport { ComboboxDataTestid } from '../../ComboboxDataTestids.js';\nimport { Controls } from '../controls/index.js';\nimport { LiveRegion } from '../LiveRegion.js';\nimport { MenuList } from '../menu-list/index.js';\nimport { StyledContainer, StyledPopperWrapper } from './styled.js';\n\nexport const Container = (): JSX.Element => {\n const { props, setMenuState, menuState } = useContext(ComboBoxContext);\n\n const {\n inline,\n startPlacementPreference,\n placementOrderPreference,\n isLoading,\n isSkeleton,\n disabled,\n applyAriaDisabled,\n readOnly,\n popperProps,\n } = props;\n const globalAttributes = useGetGlobalAttributes(props) as ReturnType<typeof useGetGlobalAttributes> & {\n 'data-testid'?: string;\n };\n const { zIndex, ...xStyledProps } = useGetXstyledProps(props);\n const { getOwnerProps, getOwnerPropsArguments } = useOwnerProps(props);\n\n const correctZIndex = zIndex ? parseInt(zIndex as string, 10) : undefined;\n // Removing possible collisionable props\n const { className, 'data-testid': dataTestId } = globalAttributes;\n const handleMouseDown = useCallback((e: React.MouseEvent) => {\n e.preventDefault();\n }, []);\n\n useEffect(() => {\n const closeMenuOnWindowBlur = () => {\n if (menuState) setMenuState(false, 'blur');\n };\n\n window.addEventListener('blur', closeMenuOnWindowBlur);\n\n return () => {\n window.removeEventListener('blur', closeMenuOnWindowBlur);\n };\n }, [menuState, setMenuState]);\n\n // In inline mode the combobox is rendered inside a consumer-controlled FloatingWrapper.\n // The consumer owns dismissal; if we closed the internal menuState here, the outer wrapper\n // would stay open and the user would see the input without options (\"weird state\").\n const handleClickOutside = useCallback(() => {\n if (inline) return;\n setMenuState(false, 'blur');\n }, [setMenuState, inline]);\n\n const config = useMemo(\n () => ({\n placement: startPlacementPreference,\n withoutAnimation: true,\n placementOrderPreference,\n zIndex: correctZIndex,\n customOffset: [0, 5] as [number, number],\n externallyControlledIsOpen: menuState,\n // Gate on `!inline` \u2014 in inline mode the consumer's outer wrapper handles dismissal.\n onClickOutside: inline ? undefined : handleClickOutside,\n }),\n [startPlacementPreference, placementOrderPreference, correctZIndex, menuState, inline, handleClickOutside],\n );\n\n const { refs, floatingStyles, context } = useFloatingContext(config);\n\n return (\n <StyledContainer\n data-testid={dataTestId ?? ComboboxDataTestid.CONTAINER}\n innerRef={refs.setReference}\n className={className}\n // readOnly gets the same not-allowed cursor as applyAriaDisabled (PUI-16695: synonyms)\n $disabled={Boolean(disabled)}\n $applyAriaDisabled={Boolean(applyAriaDisabled || readOnly)}\n {...xStyledProps}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n <LiveRegion />\n <Controls />\n\n {menuState && inline ? <MenuList /> : null}\n {menuState && !inline && refs.reference ? (\n <FloatingWrapper\n innerRef={refs.setFloating}\n floatingStyles={floatingStyles}\n isOpen={menuState}\n context={context}\n {...popperProps}\n key={`${isLoading}${isSkeleton}`} // to force remount when loading/skeleton changes\n >\n <StyledPopperWrapper\n tabIndex={-1}\n onMouseDown={handleMouseDown}\n $applyAriaDisabled={Boolean(applyAriaDisabled || readOnly)}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n <MenuList />\n </StyledPopperWrapper>\n </FloatingWrapper>\n ) : null}\n </StyledContainer>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD4EnB;AAgBI;AA1FR,iCAAoD;AACpD,8BAA0E;AAC1E,IAAAA,gBAAmE;AACnE,yBAA4B;AAC5B,iCAAmC;AACnC,sBAAyB;AACzB,wBAA2B;AAC3B,uBAAyB;AACzB,oBAAqD;AAE9C,MAAM,YAAY,MAAmB;AAC1C,QAAM,EAAE,OAAO,cAAc,UAAU,QAAI,0BAAW,mBAAAC,OAAe;AAErE,QAAM;AAAA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K;AAAA,MACf;AAAA,MAEA,WAAW,QAAQ,QAAQ;AAAA,MAC3B,oBAAoB,QAAQ,qBAAqB,QAAQ;AAAA,MACxD,GAAG;AAAA,MACJ;AAAA,MACA;AAAA,MAEA;AAAA,oDAAC,gCAAW;AAAA,QACZ,4CAAC,4BAAS;AAAA,QAET,aAAa,SAAS,4CAAC,6BAAS,IAAK;AAAA,QACrC,aAAa,CAAC,UAAU,KAAK,YAC5B;AAAA,UAAC;AAAA;AAAA,YACC,UAAU,KAAK;AAAA,YACf;AAAA,YACA,QAAQ;AAAA,YACR;AAAA,YACC,GAAG;AAAA,YACJ,KAAK,GAAG,SAAS,GAAG,UAAU;AAAA;AAAA,UAE9B;AAAA,YAAC;AAAA;AAAA,cACC,UAAU;AAAA,cACV,aAAa;AAAA,cACb,oBAAoB,QAAQ,qBAAqB,QAAQ;AAAA,cACzD;AAAA,cACA;AAAA,cAEA,sDAAC,6BAAS;AAAA;AAAA,UACZ;AAAA,QACF,IACE;AAAA;AAAA;AAAA,EACN;AAEJ;",
|
|
6
6
|
"names": ["import_react", "ComboBoxContext"]
|
|
7
7
|
}
|
|
@@ -40,18 +40,18 @@ const StyledContainer = (0, import_ds_system.styled)("div", {
|
|
|
40
40
|
slot: import_constants.FORM_COMBOBOX_SLOTS.ROOT
|
|
41
41
|
})`
|
|
42
42
|
position: relative;
|
|
43
|
-
cursor:
|
|
44
|
-
cursor: ${({ applyAriaDisabled }) => applyAriaDisabled ? "not-allowed" : "default"};
|
|
43
|
+
cursor: default;
|
|
45
44
|
min-width: 64px;
|
|
46
45
|
${import_ds_system.xStyledCommonProps}
|
|
46
|
+
${import_ds_system.lockedStateInteractionCss}
|
|
47
47
|
`;
|
|
48
48
|
const StyledPopperWrapper = (0, import_ds_system.styled)("div", {
|
|
49
49
|
name: import_constants.DSFormComboboxName,
|
|
50
50
|
slot: import_constants.FORM_COMBOBOX_SLOTS.POPPER_WRAPPER
|
|
51
51
|
})`
|
|
52
52
|
position: relative;
|
|
53
|
-
cursor:
|
|
54
|
-
cursor: ${({ applyAriaDisabled }) => applyAriaDisabled ? "not-allowed" : "default"};
|
|
53
|
+
cursor: default;
|
|
55
54
|
overflow: auto;
|
|
55
|
+
${import_ds_system.lockedStateInteractionCss}
|
|
56
56
|
`;
|
|
57
57
|
//# sourceMappingURL=styled.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/container/styled.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { styled, xStyledCommonProps } from '@elliemae/ds-system';\nimport type { XstyledProps } from '@elliemae/ds-props-helpers';\nimport { DSFormComboboxName, FORM_COMBOBOX_SLOTS } from '../../constants/index.js';\n\nimport type {} from '@xstyled/system';\n\nexport const StyledContainer = styled('div', {\n name: DSFormComboboxName,\n slot: FORM_COMBOBOX_SLOTS.ROOT,\n})<XstyledProps & { disabled?: boolean; applyAriaDisabled: boolean }>`\n position: relative;\n cursor:
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,
|
|
4
|
+
"sourcesContent": ["import { styled, xStyledCommonProps, lockedStateInteractionCss } from '@elliemae/ds-system';\nimport type { XstyledProps } from '@elliemae/ds-props-helpers';\nimport { DSFormComboboxName, FORM_COMBOBOX_SLOTS } from '../../constants/index.js';\n\nimport type {} from '@xstyled/system';\n\nexport const StyledContainer = styled('div', {\n name: DSFormComboboxName,\n slot: FORM_COMBOBOX_SLOTS.ROOT,\n})<XstyledProps & { $disabled?: boolean; $applyAriaDisabled: boolean }>`\n position: relative;\n cursor: default;\n min-width: 64px;\n ${xStyledCommonProps}\n ${lockedStateInteractionCss}\n`;\n\nexport const StyledPopperWrapper = styled('div', {\n name: DSFormComboboxName,\n slot: FORM_COMBOBOX_SLOTS.POPPER_WRAPPER,\n})<{ $disabled?: boolean; $applyAriaDisabled: boolean }>`\n position: relative;\n cursor: default;\n overflow: auto;\n ${lockedStateInteractionCss}\n`;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAAsE;AAEtE,uBAAwD;AAIjD,MAAM,sBAAkB,yBAAO,OAAO;AAAA,EAC3C,MAAM;AAAA,EACN,MAAM,qCAAoB;AAC5B,CAAC;AAAA;AAAA;AAAA;AAAA,IAIG,mCAAkB;AAAA,IAClB,0CAAyB;AAAA;AAGtB,MAAM,0BAAsB,yBAAO,OAAO;AAAA,EAC/C,MAAM;AAAA,EACN,MAAM,qCAAoB;AAC5B,CAAC;AAAA;AAAA;AAAA;AAAA,IAIG,0CAAyB;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -62,7 +62,7 @@ const Controls = () => {
|
|
|
62
62
|
const { getOwnerProps, getOwnerPropsArguments } = (0, import_ds_props_helpers.useOwnerProps)(props);
|
|
63
63
|
const handleOnClick = (0, import_react.useCallback)(() => {
|
|
64
64
|
if (disabled) return;
|
|
65
|
-
if (
|
|
65
|
+
if (shouldPreventContextMenuOpening) {
|
|
66
66
|
internalRef.current?.focus();
|
|
67
67
|
return;
|
|
68
68
|
}
|
|
@@ -88,7 +88,6 @@ const Controls = () => {
|
|
|
88
88
|
]);
|
|
89
89
|
const handleOnPillsClick = (0, import_react.useCallback)(
|
|
90
90
|
(e) => {
|
|
91
|
-
if (applyAriaDisabled) return;
|
|
92
91
|
if (menuState || disabled || shouldPreventContextMenuOpening) {
|
|
93
92
|
e.stopPropagation();
|
|
94
93
|
} else {
|
|
@@ -96,7 +95,7 @@ const Controls = () => {
|
|
|
96
95
|
setMenuState(true, "pill-click");
|
|
97
96
|
}
|
|
98
97
|
},
|
|
99
|
-
[
|
|
98
|
+
[menuState, disabled, internalRef, setMenuState, shouldPreventContextMenuOpening]
|
|
100
99
|
);
|
|
101
100
|
const handleOnMouseDown = (0, import_react.useCallback)(
|
|
102
101
|
(e) => {
|
|
@@ -117,16 +116,16 @@ const Controls = () => {
|
|
|
117
116
|
getOwnerProps,
|
|
118
117
|
getOwnerPropsArguments,
|
|
119
118
|
innerRef: controlsWrapperRef,
|
|
120
|
-
readOnly: readOnly ?? false,
|
|
119
|
+
$readOnly: readOnly ?? false,
|
|
121
120
|
cols,
|
|
122
|
-
disabled: disabled ?? false,
|
|
123
|
-
applyAriaDisabled: applyAriaDisabled ?? false,
|
|
121
|
+
$disabled: disabled ?? false,
|
|
122
|
+
$applyAriaDisabled: applyAriaDisabled ?? false,
|
|
124
123
|
hasError: hasError ?? false,
|
|
125
124
|
inline: inline ?? false,
|
|
126
125
|
onClick: handleOnClick,
|
|
127
126
|
onMouseDown: handleOnMouseDown,
|
|
128
127
|
onKeyDown: onKeyDownPills,
|
|
129
|
-
"aria-disabled": applyAriaDisabled,
|
|
128
|
+
"aria-disabled": applyAriaDisabled || readOnly ? true : void 0,
|
|
130
129
|
"data-testid": import_ComboboxDataTestids.ComboboxDataTestid.CONTROLS_WRAPPER,
|
|
131
130
|
children: [
|
|
132
131
|
!inline && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -140,10 +139,10 @@ const Controls = () => {
|
|
|
140
139
|
children: Array.isArray(selectedValues) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_multi_selected_values_container.MultiSelectedValuesContainer, {}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
141
140
|
import_styled.StyledSingleSelectWraper,
|
|
142
141
|
{
|
|
143
|
-
readOnly: readOnly ?? false,
|
|
142
|
+
$readOnly: readOnly ?? false,
|
|
144
143
|
"data-testid": import_ComboboxDataTestids.ComboboxDataTestid.SELECTED_VALUES,
|
|
145
|
-
disabled: disabled ?? false,
|
|
146
|
-
applyAriaDisabled: applyAriaDisabled ?? false,
|
|
144
|
+
$disabled: disabled ?? false,
|
|
145
|
+
$applyAriaDisabled: applyAriaDisabled ?? false,
|
|
147
146
|
getOwnerProps,
|
|
148
147
|
children: selectedValues && inputValue === "" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TruncatedText.TruncatedText, { value: selectedValues.label }) : null
|
|
149
148
|
}
|
|
@@ -160,15 +159,7 @@ const Controls = () => {
|
|
|
160
159
|
justifyContent: "flex-end",
|
|
161
160
|
getOwnerProps,
|
|
162
161
|
children: [
|
|
163
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
164
|
-
import_styled.StyleHeaderActionsSeparator,
|
|
165
|
-
{
|
|
166
|
-
disabled,
|
|
167
|
-
applyAriaDisabled,
|
|
168
|
-
readOnly,
|
|
169
|
-
getOwnerProps
|
|
170
|
-
}
|
|
171
|
-
),
|
|
162
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styled.StyleHeaderActionsSeparator, { getOwnerProps }),
|
|
172
163
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_DropdownIndicator.DropdownIndicator, {})
|
|
173
164
|
]
|
|
174
165
|
}
|