@elliemae/ds-form-combobox 3.62.1 → 3.70.0-alpha.9
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/ComboBox.js +9 -1
- package/dist/cjs/ComboBox.js.map +2 -2
- package/dist/cjs/DSComboboxMultiT.js +3 -1
- package/dist/cjs/DSComboboxMultiT.js.map +2 -2
- package/dist/cjs/DSComboboxSingleT.js +2 -0
- package/dist/cjs/DSComboboxSingleT.js.map +2 -2
- package/dist/cjs/DSCommonComboboxPropsT.js.map +1 -1
- package/dist/cjs/{config/useClickOutside.js → TruncatedText.js} +17 -22
- package/dist/cjs/TruncatedText.js.map +7 -0
- package/dist/cjs/config/useComboBox.js.map +2 -2
- package/dist/cjs/constants/index.js +32 -4
- package/dist/cjs/constants/index.js.map +2 -2
- package/dist/cjs/parts/DropdownIndicator.js +2 -2
- package/dist/cjs/parts/DropdownIndicator.js.map +2 -2
- package/dist/cjs/parts/LiveRegion.js +13 -1
- package/dist/cjs/parts/LiveRegion.js.map +2 -2
- package/dist/cjs/parts/Section.js +8 -12
- package/dist/cjs/parts/Section.js.map +2 -2
- package/dist/cjs/parts/container/Container.js +21 -15
- package/dist/cjs/parts/container/Container.js.map +2 -2
- package/dist/cjs/parts/container/styled.js +7 -4
- package/dist/cjs/parts/container/styled.js.map +2 -2
- package/dist/cjs/parts/controls/Controls.js +35 -15
- package/dist/cjs/parts/controls/Controls.js.map +2 -2
- package/dist/cjs/parts/controls/styled.js +36 -14
- package/dist/cjs/parts/controls/styled.js.map +2 -2
- package/dist/cjs/parts/controls-input/ControlsInput.js +22 -9
- package/dist/cjs/parts/controls-input/ControlsInput.js.map +2 -2
- package/dist/cjs/parts/controls-input/styled.js +33 -13
- package/dist/cjs/parts/controls-input/styled.js.map +2 -2
- package/dist/cjs/parts/controls-input/useKeyboardNavigation.js +13 -3
- package/dist/cjs/parts/controls-input/useKeyboardNavigation.js.map +2 -2
- package/dist/cjs/parts/controls-input/useMaskedOnChange.js +1 -1
- package/dist/cjs/parts/controls-input/useMaskedOnChange.js.map +2 -2
- package/dist/cjs/parts/menu-list/LoadingContainer.js +28 -2
- package/dist/cjs/parts/menu-list/LoadingContainer.js.map +2 -2
- package/dist/cjs/parts/menu-list/MenuList.js +12 -4
- package/dist/cjs/parts/menu-list/MenuList.js.map +2 -2
- package/dist/cjs/parts/menu-list/SkeletonContainer.js +20 -1
- package/dist/cjs/parts/menu-list/SkeletonContainer.js.map +2 -2
- package/dist/cjs/parts/menu-list/styled.js +35 -5
- package/dist/cjs/parts/menu-list/styled.js.map +2 -2
- package/dist/cjs/parts/menu-list/useItemRenderer.js +35 -44
- package/dist/cjs/parts/menu-list/useItemRenderer.js.map +3 -3
- package/dist/cjs/parts/multi-selected-values-container/MultiSelectedValuesContainer.js +1 -1
- package/dist/cjs/parts/multi-selected-values-container/MultiSelectedValuesContainer.js.map +2 -2
- package/dist/cjs/parts/multi-selected-values-container/RemovableSelectedValuePill.js +6 -1
- package/dist/cjs/parts/multi-selected-values-container/RemovableSelectedValuePill.js.map +2 -2
- package/dist/cjs/parts/styled.js +9 -2
- package/dist/cjs/parts/styled.js.map +2 -2
- package/dist/cjs/react-desc-prop-types.js +2 -0
- package/dist/cjs/react-desc-prop-types.js.map +2 -2
- package/dist/cjs/typescript-testing/slot-props.js +82 -0
- package/dist/cjs/typescript-testing/slot-props.js.map +7 -0
- package/dist/cjs/typescript-testing/typescript-combobox-multi-valid.js +158 -0
- package/dist/cjs/typescript-testing/typescript-combobox-multi-valid.js.map +7 -0
- package/dist/cjs/typescript-testing/typescript-combobox-single-valid.js +158 -0
- package/dist/cjs/typescript-testing/typescript-combobox-single-valid.js.map +7 -0
- package/dist/cjs/utils/listHelper.js +2 -1
- package/dist/cjs/utils/listHelper.js.map +2 -2
- package/dist/cjs/utils/typeGuards.js +36 -0
- package/dist/cjs/utils/typeGuards.js.map +7 -0
- package/dist/esm/ComboBox.js +10 -2
- package/dist/esm/ComboBox.js.map +2 -2
- package/dist/esm/DSComboboxMultiT.js +9 -2
- package/dist/esm/DSComboboxMultiT.js.map +2 -2
- package/dist/esm/DSComboboxSingleT.js +8 -1
- package/dist/esm/DSComboboxSingleT.js.map +2 -2
- package/dist/esm/DSCommonComboboxPropsT.js.map +1 -1
- package/dist/esm/TruncatedText.js +17 -0
- package/dist/esm/TruncatedText.js.map +7 -0
- package/dist/esm/config/useComboBox.js.map +2 -2
- package/dist/esm/constants/index.js +32 -4
- package/dist/esm/constants/index.js.map +2 -2
- package/dist/esm/parts/DropdownIndicator.js +3 -3
- package/dist/esm/parts/DropdownIndicator.js.map +2 -2
- package/dist/esm/parts/LiveRegion.js +13 -1
- package/dist/esm/parts/LiveRegion.js.map +2 -2
- package/dist/esm/parts/Section.js +9 -13
- package/dist/esm/parts/Section.js.map +2 -2
- package/dist/esm/parts/container/Container.js +21 -15
- package/dist/esm/parts/container/Container.js.map +2 -2
- package/dist/esm/parts/container/styled.js +7 -4
- package/dist/esm/parts/container/styled.js.map +2 -2
- package/dist/esm/parts/controls/Controls.js +35 -15
- package/dist/esm/parts/controls/Controls.js.map +2 -2
- package/dist/esm/parts/controls/styled.js +37 -15
- package/dist/esm/parts/controls/styled.js.map +2 -2
- package/dist/esm/parts/controls-input/ControlsInput.js +22 -9
- package/dist/esm/parts/controls-input/ControlsInput.js.map +2 -2
- package/dist/esm/parts/controls-input/styled.js +34 -14
- package/dist/esm/parts/controls-input/styled.js.map +2 -2
- package/dist/esm/parts/controls-input/useKeyboardNavigation.js +13 -3
- package/dist/esm/parts/controls-input/useKeyboardNavigation.js.map +2 -2
- package/dist/esm/parts/controls-input/useMaskedOnChange.js +1 -1
- package/dist/esm/parts/controls-input/useMaskedOnChange.js.map +2 -2
- package/dist/esm/parts/menu-list/LoadingContainer.js +28 -2
- package/dist/esm/parts/menu-list/LoadingContainer.js.map +2 -2
- package/dist/esm/parts/menu-list/MenuList.js +12 -4
- package/dist/esm/parts/menu-list/MenuList.js.map +2 -2
- package/dist/esm/parts/menu-list/SkeletonContainer.js +20 -1
- package/dist/esm/parts/menu-list/SkeletonContainer.js.map +2 -2
- package/dist/esm/parts/menu-list/styled.js +35 -5
- package/dist/esm/parts/menu-list/styled.js.map +2 -2
- package/dist/esm/parts/menu-list/useItemRenderer.js +35 -44
- package/dist/esm/parts/menu-list/useItemRenderer.js.map +2 -2
- package/dist/esm/parts/multi-selected-values-container/MultiSelectedValuesContainer.js +1 -1
- package/dist/esm/parts/multi-selected-values-container/MultiSelectedValuesContainer.js.map +2 -2
- package/dist/esm/parts/multi-selected-values-container/RemovableSelectedValuePill.js +6 -1
- package/dist/esm/parts/multi-selected-values-container/RemovableSelectedValuePill.js.map +2 -2
- package/dist/esm/parts/styled.js +9 -2
- package/dist/esm/parts/styled.js.map +2 -2
- package/dist/esm/react-desc-prop-types.js +8 -1
- package/dist/esm/react-desc-prop-types.js.map +2 -2
- package/dist/esm/typescript-testing/slot-props.js +59 -0
- package/dist/esm/typescript-testing/slot-props.js.map +7 -0
- package/dist/esm/typescript-testing/typescript-combobox-multi-valid.js +135 -0
- package/dist/esm/typescript-testing/typescript-combobox-multi-valid.js.map +7 -0
- package/dist/esm/typescript-testing/typescript-combobox-single-valid.js +135 -0
- package/dist/esm/typescript-testing/typescript-combobox-single-valid.js.map +7 -0
- package/dist/esm/utils/listHelper.js +2 -1
- package/dist/esm/utils/listHelper.js.map +2 -2
- package/dist/esm/utils/typeGuards.js +6 -0
- package/dist/esm/utils/typeGuards.js.map +7 -0
- package/dist/types/ComboBox.d.ts +1 -1
- package/dist/types/DSComboboxMultiT.d.ts +5 -3
- package/dist/types/DSComboboxSingleT.d.ts +5 -3
- package/dist/types/DSCommonComboboxPropsT.d.ts +1 -1
- package/dist/types/TruncatedText.d.ts +13 -0
- package/dist/types/constants/index.d.ts +80 -2
- package/dist/types/parts/LiveRegion.d.ts +22 -1
- package/dist/types/parts/Section.d.ts +5 -5
- package/dist/types/parts/controls/styled.d.ts +1 -1
- package/dist/types/parts/controls-input/styled.d.ts +4 -2
- package/dist/types/parts/menu-list/LoadingContainer.d.ts +5 -2
- package/dist/types/parts/menu-list/SkeletonContainer.d.ts +2 -1
- package/dist/types/parts/menu-list/styled.d.ts +21 -2
- package/dist/types/parts/menu-list/useItemRenderer.d.ts +2 -1
- package/dist/types/parts/multi-selected-values-container/RemovableSelectedValuePill.d.ts +1 -1
- package/dist/types/react-desc-prop-types.d.ts +29 -1
- package/dist/types/utils/listHelper.d.ts +2 -2
- package/dist/types/utils/typeGuards.d.ts +2 -0
- package/package.json +19 -19
- package/dist/cjs/config/useClickOutside.js.map +0 -7
- package/dist/esm/config/useClickOutside.js +0 -22
- package/dist/esm/config/useClickOutside.js.map +0 -7
- package/dist/types/config/useClickOutside.d.ts +0 -1
- package/dist/types/tests/DSCombobox.exports.test.d.ts +0 -1
- package/dist/types/tests/DSCombobox.get-owner-props.test.d.ts +0 -1
- package/dist/types/tests/a11y.test.d.ts +0 -1
- package/dist/types/tests/creatable.test.d.ts +0 -1
- package/dist/types/tests/disabled.test.d.ts +0 -1
- package/dist/types/tests/force-focus-first-option-on-type.test.d.ts +0 -1
- package/dist/types/tests/general.test.d.ts +0 -1
- package/dist/types/tests/multi-select.test.d.ts +0 -1
- package/dist/types/tests/onlyselectable.test.d.ts +0 -1
- package/dist/types/tests/read-only.test.d.ts +0 -1
- package/dist/types/tests/single-select.test.d.ts +0 -1
- package/dist/types/tests/usemask.test.d.ts +0 -1
- package/dist/types/tests/utils.d.ts +0 -30
|
@@ -39,13 +39,12 @@ var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
|
39
39
|
var import_react2 = require("react");
|
|
40
40
|
var import_ComboBoxCTX = __toESM(require("../../ComboBoxCTX.js"));
|
|
41
41
|
var import_ComboboxDataTestids = require("../../ComboboxDataTestids.js");
|
|
42
|
-
var import_useClickOutside = require("../../config/useClickOutside.js");
|
|
43
42
|
var import_controls = require("../controls/index.js");
|
|
44
43
|
var import_LiveRegion = require("../LiveRegion.js");
|
|
45
44
|
var import_menu_list = require("../menu-list/index.js");
|
|
46
45
|
var import_styled = require("./styled.js");
|
|
47
46
|
const Container = () => {
|
|
48
|
-
const { props,
|
|
47
|
+
const { props, setMenuState, menuState } = (0, import_react2.useContext)(import_ComboBoxCTX.default);
|
|
49
48
|
const {
|
|
50
49
|
inline,
|
|
51
50
|
startPlacementPreference,
|
|
@@ -63,10 +62,6 @@ const Container = () => {
|
|
|
63
62
|
const handleMouseDown = (0, import_react2.useCallback)((e) => {
|
|
64
63
|
e.preventDefault();
|
|
65
64
|
}, []);
|
|
66
|
-
const handleCloseMenu = (0, import_react2.useCallback)(() => {
|
|
67
|
-
setMenuState(false, "blur");
|
|
68
|
-
if (internalRef?.current) internalRef.current.blur();
|
|
69
|
-
}, [internalRef, setMenuState]);
|
|
70
65
|
(0, import_react2.useEffect)(() => {
|
|
71
66
|
const closeMenuOnWindowBlur = () => {
|
|
72
67
|
if (menuState) setMenuState(false, "blur");
|
|
@@ -76,6 +71,10 @@ const Container = () => {
|
|
|
76
71
|
window.removeEventListener("blur", closeMenuOnWindowBlur);
|
|
77
72
|
};
|
|
78
73
|
}, [menuState, setMenuState]);
|
|
74
|
+
const handleClickOutside = (0, import_react2.useCallback)(() => {
|
|
75
|
+
if (inline) return;
|
|
76
|
+
setMenuState(false, "blur");
|
|
77
|
+
}, [setMenuState, inline]);
|
|
79
78
|
const config = (0, import_react2.useMemo)(
|
|
80
79
|
() => ({
|
|
81
80
|
placement: startPlacementPreference,
|
|
@@ -83,23 +82,20 @@ const Container = () => {
|
|
|
83
82
|
placementOrderPreference,
|
|
84
83
|
zIndex: correctZIndex,
|
|
85
84
|
customOffset: [0, 5],
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
externallyControlledIsOpen: menuState,
|
|
86
|
+
// Gate on `!inline` — in inline mode the consumer's outer wrapper handles dismissal.
|
|
87
|
+
onClickOutside: inline ? void 0 : handleClickOutside
|
|
88
88
|
}),
|
|
89
|
-
[startPlacementPreference, placementOrderPreference, correctZIndex,
|
|
89
|
+
[startPlacementPreference, placementOrderPreference, correctZIndex, menuState, inline, handleClickOutside]
|
|
90
90
|
);
|
|
91
91
|
const { refs, floatingStyles, context } = (0, import_ds_floating_context.useFloatingContext)(config);
|
|
92
|
-
const hideTooltip = (0, import_react2.useCallback)(() => {
|
|
93
|
-
setMenuState(false, "blur");
|
|
94
|
-
}, [setMenuState]);
|
|
95
|
-
(0, import_useClickOutside.useOnClickOutside)(refs.reference, hideTooltip, refs.floating);
|
|
96
92
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
97
93
|
import_styled.StyledContainer,
|
|
98
94
|
{
|
|
99
95
|
"data-testid": dataTestId ?? import_ComboboxDataTestids.ComboboxDataTestid.CONTAINER,
|
|
100
96
|
innerRef: refs.setReference,
|
|
101
97
|
className,
|
|
102
|
-
applyAriaDisabled,
|
|
98
|
+
applyAriaDisabled: applyAriaDisabled ?? false,
|
|
103
99
|
...xStyledProps,
|
|
104
100
|
getOwnerProps,
|
|
105
101
|
getOwnerPropsArguments,
|
|
@@ -117,7 +113,17 @@ const Container = () => {
|
|
|
117
113
|
...popperProps,
|
|
118
114
|
key: `${isLoading}${isSkeleton}`
|
|
119
115
|
},
|
|
120
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
116
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
117
|
+
import_styled.StyledPopperWrapper,
|
|
118
|
+
{
|
|
119
|
+
tabIndex: -1,
|
|
120
|
+
onMouseDown: handleMouseDown,
|
|
121
|
+
applyAriaDisabled: applyAriaDisabled ?? false,
|
|
122
|
+
getOwnerProps,
|
|
123
|
+
getOwnerPropsArguments,
|
|
124
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_menu_list.MenuList, {})
|
|
125
|
+
}
|
|
126
|
+
)
|
|
121
127
|
) : null
|
|
122
128
|
]
|
|
123
129
|
}
|
|
@@ -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 {
|
|
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 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 ?? false}\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={applyAriaDisabled ?? false}\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;AD0EnB;AAcI;AAtFR,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,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AACJ,QAAM,uBAAmB,gDAAuB,KAAK;AAGrD,QAAM,EAAE,QAAQ,GAAG,aAAa,QAAI,4CAAmB,KAAK;AAC5D,QAAM,EAAE,eAAe,uBAAuB,QAAI,uCAAc,KAAK;AAErE,QAAM,gBAAgB,SAAS,SAAS,QAAkB,EAAE,IAAI;AAEhE,QAAM,EAAE,WAAW,eAAe,WAAW,IAAI;AACjD,QAAM,sBAAkB,2BAAY,CAAC,MAAwB;AAC3D,MAAE,eAAe;AAAA,EACnB,GAAG,CAAC,CAAC;AAEL,+BAAU,MAAM;AACd,UAAM,wBAAwB,MAAM;AAClC,UAAI,UAAW,cAAa,OAAO,MAAM;AAAA,IAC3C;AAEA,WAAO,iBAAiB,QAAQ,qBAAqB;AAErD,WAAO,MAAM;AACX,aAAO,oBAAoB,QAAQ,qBAAqB;AAAA,IAC1D;AAAA,EACF,GAAG,CAAC,WAAW,YAAY,CAAC;AAK5B,QAAM,yBAAqB,2BAAY,MAAM;AAC3C,QAAI,OAAQ;AACZ,iBAAa,OAAO,MAAM;AAAA,EAC5B,GAAG,CAAC,cAAc,MAAM,CAAC;AAEzB,QAAM,aAAS;AAAA,IACb,OAAO;AAAA,MACL,WAAW;AAAA,MACX,kBAAkB;AAAA,MAClB;AAAA,MACA,QAAQ;AAAA,MACR,cAAc,CAAC,GAAG,CAAC;AAAA,MACnB,4BAA4B;AAAA;AAAA,MAE5B,gBAAgB,SAAS,SAAY;AAAA,IACvC;AAAA,IACA,CAAC,0BAA0B,0BAA0B,eAAe,WAAW,QAAQ,kBAAkB;AAAA,EAC3G;AAEA,QAAM,EAAE,MAAM,gBAAgB,QAAQ,QAAI,+CAAmB,MAAM;AAEnE,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAa,cAAc,8CAAmB;AAAA,MAC9C,UAAU,KAAK;AAAA,MACf;AAAA,MACA,mBAAmB,qBAAqB;AAAA,MACvC,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,mBAAmB,qBAAqB;AAAA,cACxC;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
|
}
|
|
@@ -34,10 +34,10 @@ __export(styled_exports, {
|
|
|
34
34
|
module.exports = __toCommonJS(styled_exports);
|
|
35
35
|
var React = __toESM(require("react"));
|
|
36
36
|
var import_ds_system = require("@elliemae/ds-system");
|
|
37
|
-
var
|
|
37
|
+
var import_constants = require("../../constants/index.js");
|
|
38
38
|
const StyledContainer = (0, import_ds_system.styled)("div", {
|
|
39
|
-
name:
|
|
40
|
-
slot:
|
|
39
|
+
name: import_constants.DSFormComboboxName,
|
|
40
|
+
slot: import_constants.FORM_COMBOBOX_SLOTS.ROOT
|
|
41
41
|
})`
|
|
42
42
|
position: relative;
|
|
43
43
|
cursor: ${({ disabled }) => disabled ? "not-allowed" : "default"};
|
|
@@ -45,7 +45,10 @@ const StyledContainer = (0, import_ds_system.styled)("div", {
|
|
|
45
45
|
min-width: 64px;
|
|
46
46
|
${import_ds_system.xStyledCommonProps}
|
|
47
47
|
`;
|
|
48
|
-
const StyledPopperWrapper = (0, import_ds_system.styled)("div"
|
|
48
|
+
const StyledPopperWrapper = (0, import_ds_system.styled)("div", {
|
|
49
|
+
name: import_constants.DSFormComboboxName,
|
|
50
|
+
slot: import_constants.FORM_COMBOBOX_SLOTS.POPPER_WRAPPER
|
|
51
|
+
})`
|
|
49
52
|
position: relative;
|
|
50
53
|
cursor: ${({ disabled }) => disabled ? "not-allowed" : "default"};
|
|
51
54
|
cursor: ${({ applyAriaDisabled }) => applyAriaDisabled ? "not-allowed" : "default"};
|
|
@@ -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 {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAA2C;AAE3C,
|
|
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: ${({ disabled }) => (disabled ? 'not-allowed' : 'default')};\n cursor: ${({ applyAriaDisabled }) => (applyAriaDisabled ? 'not-allowed' : 'default')};\n min-width: 64px;\n ${xStyledCommonProps}\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: ${({ disabled }) => (disabled ? 'not-allowed' : 'default')};\n cursor: ${({ applyAriaDisabled }) => (applyAriaDisabled ? 'not-allowed' : 'default')};\n overflow: auto;\n`;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAA2C;AAE3C,uBAAwD;AAIjD,MAAM,sBAAkB,yBAAO,OAAO;AAAA,EAC3C,MAAM;AAAA,EACN,MAAM,qCAAoB;AAC5B,CAAC;AAAA;AAAA,YAEW,CAAC,EAAE,SAAS,MAAO,WAAW,gBAAgB,SAAU;AAAA,YACxD,CAAC,EAAE,kBAAkB,MAAO,oBAAoB,gBAAgB,SAAU;AAAA;AAAA,IAElF,mCAAkB;AAAA;AAGf,MAAM,0BAAsB,yBAAO,OAAO;AAAA,EAC/C,MAAM;AAAA,EACN,MAAM,qCAAoB;AAC5B,CAAC;AAAA;AAAA,YAEW,CAAC,EAAE,SAAS,MAAO,WAAW,gBAAgB,SAAU;AAAA,YACxD,CAAC,EAAE,kBAAkB,MAAO,oBAAoB,gBAAgB,SAAU;AAAA;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -34,10 +34,10 @@ module.exports = __toCommonJS(Controls_exports);
|
|
|
34
34
|
var React = __toESM(require("react"));
|
|
35
35
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
36
|
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
37
|
-
var import_ds_truncated_tooltip_text = require("@elliemae/ds-truncated-tooltip-text");
|
|
38
37
|
var import_react = require("react");
|
|
39
38
|
var import_ComboBoxCTX = __toESM(require("../../ComboBoxCTX.js"));
|
|
40
39
|
var import_ComboboxDataTestids = require("../../ComboboxDataTestids.js");
|
|
40
|
+
var import_TruncatedText = require("../../TruncatedText.js");
|
|
41
41
|
var import_ControlsInput = require("../controls-input/ControlsInput.js");
|
|
42
42
|
var import_DropdownIndicator = require("../DropdownIndicator.js");
|
|
43
43
|
var import_multi_selected_values_container = require("../multi-selected-values-container/index.js");
|
|
@@ -117,28 +117,39 @@ const Controls = () => {
|
|
|
117
117
|
getOwnerProps,
|
|
118
118
|
getOwnerPropsArguments,
|
|
119
119
|
innerRef: controlsWrapperRef,
|
|
120
|
-
readOnly,
|
|
120
|
+
readOnly: readOnly ?? false,
|
|
121
121
|
cols,
|
|
122
|
-
disabled,
|
|
123
|
-
applyAriaDisabled,
|
|
124
|
-
hasError,
|
|
125
|
-
inline,
|
|
122
|
+
disabled: disabled ?? false,
|
|
123
|
+
applyAriaDisabled: applyAriaDisabled ?? false,
|
|
124
|
+
hasError: hasError ?? false,
|
|
125
|
+
inline: inline ?? false,
|
|
126
126
|
onClick: handleOnClick,
|
|
127
127
|
onMouseDown: handleOnMouseDown,
|
|
128
128
|
onKeyDown: onKeyDownPills,
|
|
129
129
|
"aria-disabled": applyAriaDisabled,
|
|
130
130
|
"data-testid": import_ComboboxDataTestids.ComboboxDataTestid.CONTROLS_WRAPPER,
|
|
131
131
|
children: [
|
|
132
|
-
!inline && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
133
|
-
import_styled.
|
|
132
|
+
!inline && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
133
|
+
import_styled.StyledSelection,
|
|
134
134
|
{
|
|
135
|
-
|
|
136
|
-
"
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
135
|
+
variant: "b2",
|
|
136
|
+
component: "div",
|
|
137
|
+
innerRef: selectedOptionsRef,
|
|
138
|
+
onClick: handleOnPillsClick,
|
|
139
|
+
getOwnerProps,
|
|
140
|
+
children: Array.isArray(selectedValues) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_multi_selected_values_container.MultiSelectedValuesContainer, {}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
141
|
+
import_styled.StyledSingleSelectWraper,
|
|
142
|
+
{
|
|
143
|
+
readOnly: readOnly ?? false,
|
|
144
|
+
"data-testid": import_ComboboxDataTestids.ComboboxDataTestid.SELECTED_VALUES,
|
|
145
|
+
disabled: disabled ?? false,
|
|
146
|
+
applyAriaDisabled: applyAriaDisabled ?? false,
|
|
147
|
+
getOwnerProps,
|
|
148
|
+
children: selectedValues && inputValue === "" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TruncatedText.TruncatedText, { value: selectedValues.label }) : null
|
|
149
|
+
}
|
|
150
|
+
)
|
|
140
151
|
}
|
|
141
|
-
)
|
|
152
|
+
),
|
|
142
153
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ControlsInput.ControlsInput, {}),
|
|
143
154
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {}),
|
|
144
155
|
!inline && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
@@ -147,8 +158,17 @@ const Controls = () => {
|
|
|
147
158
|
justifyItems: "center",
|
|
148
159
|
cols: ["min-content", "minmax(28px,max-content)"],
|
|
149
160
|
justifyContent: "flex-end",
|
|
161
|
+
getOwnerProps,
|
|
150
162
|
children: [
|
|
151
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
163
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
164
|
+
import_styled.StyleHeaderActionsSeparator,
|
|
165
|
+
{
|
|
166
|
+
disabled,
|
|
167
|
+
applyAriaDisabled,
|
|
168
|
+
readOnly,
|
|
169
|
+
getOwnerProps
|
|
170
|
+
}
|
|
171
|
+
),
|
|
152
172
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_DropdownIndicator.DropdownIndicator, {})
|
|
153
173
|
]
|
|
154
174
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/controls/Controls.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable max-statements */\n/* eslint-disable complexity */\nimport { useOwnerProps } from '@elliemae/ds-props-helpers';\nimport
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-statements */\n/* eslint-disable complexity */\nimport { useOwnerProps } from '@elliemae/ds-props-helpers';\nimport React, { useCallback, useContext, useMemo } from 'react';\nimport ComboBoxContext from '../../ComboBoxCTX.js';\nimport { ComboboxDataTestid } from '../../ComboboxDataTestids.js';\nimport { TruncatedText } from '../../TruncatedText.js';\nimport { ControlsInput } from '../controls-input/ControlsInput.js';\nimport { DropdownIndicator } from '../DropdownIndicator.js';\nimport { MultiSelectedValuesContainer } from '../multi-selected-values-container/index.js';\nimport {\n StyledControlsWrapper,\n StyledHeaderActionsWrapper,\n StyledSelection,\n StyledSingleSelectWraper,\n StyleHeaderActionsSeparator,\n} from './styled.js';\nimport { useOnPillsNavigation } from './useOnPillsNavigation.js';\n\nexport const Controls = (): JSX.Element => {\n const {\n props,\n props: { inline, disabled, hasError, selectedValues, applyAriaDisabled, readOnly, isMenuOpenableWithReadOnly },\n selectedOptionsRef,\n setMenuState,\n setFocusOptionIdx,\n hasFocus,\n inputValue,\n listRef,\n focusOptionIdx,\n menuState,\n controlsWrapperRef,\n internalRef,\n shouldPreventContextMenuOpening,\n } = useContext(ComboBoxContext);\n\n const { getOwnerProps, getOwnerPropsArguments } = useOwnerProps(props);\n\n const handleOnClick = useCallback(() => {\n if (disabled) return;\n if (applyAriaDisabled || shouldPreventContextMenuOpening) {\n internalRef.current?.focus();\n return;\n }\n if (hasFocus && menuState && !inline) {\n setMenuState(false, 'click');\n setFocusOptionIdx('');\n internalRef.current?.blur();\n return;\n }\n internalRef.current?.focus();\n setMenuState(true, 'click');\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [\n disabled,\n listRef,\n hasFocus,\n menuState,\n inline,\n setMenuState,\n focusOptionIdx,\n readOnly,\n applyAriaDisabled,\n isMenuOpenableWithReadOnly,\n ]);\n\n // this callback prevent to toggle the menu when clicking or removing pills\n const handleOnPillsClick: React.MouseEventHandler = useCallback(\n (e) => {\n if (applyAriaDisabled) return;\n if (menuState || disabled || shouldPreventContextMenuOpening) {\n e.stopPropagation();\n } else {\n internalRef.current?.focus();\n setMenuState(true, 'pill-click');\n }\n },\n [applyAriaDisabled, menuState, disabled, internalRef, setMenuState, shouldPreventContextMenuOpening],\n );\n\n // callback to prevent onBlur on the input when clicking in all the wrapper\n const handleOnMouseDown: React.MouseEventHandler = useCallback(\n (e) => {\n if (document.activeElement === internalRef.current || inline) {\n e.preventDefault();\n }\n },\n [internalRef, inline],\n );\n\n const { onKeyDownPills } = useOnPillsNavigation();\n\n const cols = useMemo(\n () => (!inline ? ['minmax(0px,max-content)', 'minmax(20px, auto)', '8px', '2.231rem'] : ['minmax(0px, auto)']),\n [inline],\n );\n return (\n <StyledControlsWrapper\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n innerRef={controlsWrapperRef}\n readOnly={readOnly ?? false}\n cols={cols}\n disabled={disabled ?? false}\n applyAriaDisabled={applyAriaDisabled ?? false}\n hasError={hasError ?? false}\n inline={inline ?? false}\n onClick={handleOnClick}\n onMouseDown={handleOnMouseDown}\n onKeyDown={onKeyDownPills}\n aria-disabled={applyAriaDisabled}\n data-testid={ComboboxDataTestid.CONTROLS_WRAPPER}\n >\n {!inline && (\n <StyledSelection\n variant=\"b2\"\n component=\"div\"\n innerRef={selectedOptionsRef}\n onClick={handleOnPillsClick}\n getOwnerProps={getOwnerProps}\n >\n {Array.isArray(selectedValues) ? (\n <MultiSelectedValuesContainer />\n ) : (\n <StyledSingleSelectWraper\n readOnly={readOnly ?? false}\n // legacy data-testid \u2014 preserved for QA/consumer compatibility, breaking change if removed\n data-testid={ComboboxDataTestid.SELECTED_VALUES}\n disabled={disabled ?? false}\n applyAriaDisabled={applyAriaDisabled ?? false}\n getOwnerProps={getOwnerProps}\n >\n {selectedValues && inputValue === '' ? <TruncatedText value={selectedValues.label} /> : null}\n </StyledSingleSelectWraper>\n )}\n </StyledSelection>\n )}\n\n <ControlsInput />\n {/** This empty div is a gap between the input and the drop down indicator */}\n <div />\n {!inline && (\n <StyledHeaderActionsWrapper\n justifyItems=\"center\"\n cols={['min-content', 'minmax(28px,max-content)']}\n justifyContent=\"flex-end\"\n getOwnerProps={getOwnerProps}\n >\n <StyleHeaderActionsSeparator\n disabled={disabled}\n applyAriaDisabled={applyAriaDisabled}\n readOnly={readOnly}\n getOwnerProps={getOwnerProps}\n />\n <DropdownIndicator />\n </StyledHeaderActionsWrapper>\n )}\n </StyledControlsWrapper>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD2HX;AAzHZ,8BAA8B;AAC9B,mBAAwD;AACxD,yBAA4B;AAC5B,iCAAmC;AACnC,2BAA8B;AAC9B,2BAA8B;AAC9B,+BAAkC;AAClC,6CAA6C;AAC7C,oBAMO;A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;AAAA;AAAA;AAAA,QACrB;AAAA;AAAA;AAAA,EAEJ;AAEJ;",
|
|
6
6
|
"names": ["ComboBoxContext"]
|
|
7
7
|
}
|
|
@@ -39,7 +39,8 @@ module.exports = __toCommonJS(styled_exports);
|
|
|
39
39
|
var React = __toESM(require("react"));
|
|
40
40
|
var import_ds_system = require("@elliemae/ds-system");
|
|
41
41
|
var import_ds_grid = require("@elliemae/ds-grid");
|
|
42
|
-
var
|
|
42
|
+
var import_ds_typography = require("@elliemae/ds-typography");
|
|
43
|
+
var import_constants = require("../../constants/index.js");
|
|
43
44
|
const readOnlyBorder = import_ds_system.css`
|
|
44
45
|
border: 1px solid ${({ theme }) => theme.colors.neutral["080"]};
|
|
45
46
|
border-bottom: 1px solid ${({ theme }) => theme.colors.neutral[400]};
|
|
@@ -67,8 +68,8 @@ const hoverBorder = import_ds_system.css`
|
|
|
67
68
|
border: 1px solid ${({ theme }) => theme.colors.brand[600]};
|
|
68
69
|
`;
|
|
69
70
|
const StyledControlsWrapper = (0, import_ds_system.styled)(import_ds_grid.Grid, {
|
|
70
|
-
name:
|
|
71
|
-
slot:
|
|
71
|
+
name: import_constants.DSFormComboboxName,
|
|
72
|
+
slot: import_constants.FORM_COMBOBOX_SLOTS.INPUT_WRAPPER
|
|
72
73
|
})`
|
|
73
74
|
${backgroundStyles}
|
|
74
75
|
position: relative;
|
|
@@ -77,11 +78,11 @@ const StyledControlsWrapper = (0, import_ds_system.styled)(import_ds_grid.Grid,
|
|
|
77
78
|
align-items: center;
|
|
78
79
|
align-content: center;
|
|
79
80
|
min-height: 28px;
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
margin: ${({ inline }) => inline ? "
|
|
81
|
+
/** PUI-15490: the spec's 5px vertical padding belongs to the TEXT LINE (StyledInputWrapper),
|
|
82
|
+
* not here — padding the wrapper would also inset the separator + chevron column and inflate
|
|
83
|
+
* the control past the spec's min-height. Right-side 8px comes from the grid gap column. */
|
|
84
|
+
padding: 0px 0px 0px 8px;
|
|
85
|
+
margin: ${({ inline }) => inline ? "8px 16px" : ""};
|
|
85
86
|
${borderStyles}
|
|
86
87
|
&:hover {
|
|
87
88
|
${({ disabled }) => !disabled ? hoverBorder : ""}
|
|
@@ -90,27 +91,48 @@ const StyledControlsWrapper = (0, import_ds_system.styled)(import_ds_grid.Grid,
|
|
|
90
91
|
${focusBorder}
|
|
91
92
|
}
|
|
92
93
|
`;
|
|
93
|
-
const StyledSingleSelectWraper = import_ds_system.styled
|
|
94
|
+
const StyledSingleSelectWraper = (0, import_ds_system.styled)("div", {
|
|
95
|
+
name: import_constants.DSFormComboboxName,
|
|
96
|
+
slot: import_constants.FORM_COMBOBOX_SLOTS.SELECTED_VALUES
|
|
97
|
+
})`
|
|
94
98
|
display: flex;
|
|
95
99
|
width: 100%;
|
|
96
100
|
align-items: center;
|
|
97
101
|
color: ${({ disabled, readOnly, theme }) => disabled || readOnly ? theme.colors.neutral["600"] : theme.colors.neutral["700"]};
|
|
98
102
|
user-select: ${({ disabled, applyAriaDisabled }) => disabled || applyAriaDisabled ? "none" : ""};
|
|
99
103
|
`;
|
|
100
|
-
const StyledSelection = import_ds_system.styled.
|
|
101
|
-
|
|
104
|
+
const StyledSelection = (0, import_ds_system.styled)(import_ds_typography.DSTypography, {
|
|
105
|
+
name: import_constants.DSFormComboboxName,
|
|
106
|
+
slot: import_constants.FORM_COMBOBOX_SLOTS.SELECTION
|
|
107
|
+
})`
|
|
102
108
|
margin-right: 3px;
|
|
103
109
|
display: flex;
|
|
110
|
+
/** PUI-15490 — no vertical padding here on purpose: the 5px text-line rhythm lives on
|
|
111
|
+
* StyledInputWrapper (always rendered), so the control height stays constant and pills
|
|
112
|
+
* (taller than the text line) center within it instead of growing the control. */
|
|
113
|
+
align-self: center;
|
|
104
114
|
`;
|
|
105
|
-
const StyledHeaderActionsWrapper = (0, import_ds_system.styled)(import_ds_grid.Grid
|
|
115
|
+
const StyledHeaderActionsWrapper = (0, import_ds_system.styled)(import_ds_grid.Grid, {
|
|
116
|
+
name: import_constants.DSFormComboboxName,
|
|
117
|
+
slot: import_constants.FORM_COMBOBOX_SLOTS.HEADER_ACTIONS
|
|
118
|
+
})`
|
|
106
119
|
height: 100%;
|
|
120
|
+
/** PUI-15490 — grid children otherwise stretch to the row height; the chevron button must
|
|
121
|
+
* keep its spec box (size 's' square, icon + 2px) and the separator its fixed 20px. */
|
|
122
|
+
align-items: center;
|
|
107
123
|
.em-ds-button--text:focus::after {
|
|
108
124
|
border: none;
|
|
109
125
|
}
|
|
110
126
|
`;
|
|
111
127
|
const StyleDropdownIndicator = import_ds_system.styled.div``;
|
|
112
|
-
const StyleHeaderActionsSeparator = import_ds_system.styled
|
|
113
|
-
|
|
128
|
+
const StyleHeaderActionsSeparator = (0, import_ds_system.styled)("span", {
|
|
129
|
+
name: import_constants.DSFormComboboxName,
|
|
130
|
+
slot: import_constants.FORM_COMBOBOX_SLOTS.HEADER_ACTIONS_SEPARATOR
|
|
131
|
+
})`
|
|
132
|
+
/** PUI-15490 — fixed 20px per the box-model spec (was height: 100%, which stretched it
|
|
133
|
+
* with the control row instead of staying at spec size). */
|
|
134
|
+
height: 20px;
|
|
135
|
+
align-self: center;
|
|
114
136
|
width: 1px;
|
|
115
137
|
background-color: ${({ theme }) => theme.colors.neutral["400"]};
|
|
116
138
|
`;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/controls/styled.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { styled, css
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,
|
|
4
|
+
"sourcesContent": ["import { styled, css } from '@elliemae/ds-system';\nimport { Grid } from '@elliemae/ds-grid';\nimport { DSTypography } from '@elliemae/ds-typography';\nimport { DSFormComboboxName, FORM_COMBOBOX_SLOTS } from '../../constants/index.js';\n\ninterface StyledControlsWrapperT {\n hasError: boolean;\n inline: boolean;\n minWidth?: number;\n disabled: boolean;\n applyAriaDisabled: boolean;\n readOnly: boolean;\n}\n\nconst readOnlyBorder = css`\n border: 1px solid ${({ theme }) => theme.colors.neutral['080']};\n border-bottom: 1px solid ${({ theme }) => theme.colors.neutral[400]};\n`;\n\nconst borderStyles = css<{ hasError: boolean; readOnly: boolean; applyAriaDisabled: boolean }>`\n border: 1px solid ${({ hasError, theme }) => (hasError ? theme.colors.danger[900] : theme.colors.neutral[400])};\n ${({ readOnly, applyAriaDisabled }) => (readOnly || applyAriaDisabled ? readOnlyBorder : '')}\n`;\n\nconst backgroundStyles = css<{ disabled: boolean; applyAriaDisabled: boolean; readOnly: boolean }>`\n background: ${({ disabled, applyAriaDisabled, readOnly, theme }) => {\n if (readOnly || applyAriaDisabled) {\n return theme.colors.neutral['050'];\n }\n if (disabled) {\n return theme.colors.neutral['080'];\n }\n return '#ffffff';\n }};\n`;\n\nconst focusBorder = css`\n outline: 2px solid ${({ theme }) => theme.colors.brand[700]};\n outline-offset: -2px;\n`;\n\nconst hoverBorder = css`\n border: 1px solid ${({ theme }) => theme.colors.brand[600]};\n`;\n\nexport const StyledControlsWrapper = styled(Grid, {\n name: DSFormComboboxName,\n slot: FORM_COMBOBOX_SLOTS.INPUT_WRAPPER,\n})<StyledControlsWrapperT>`\n ${backgroundStyles}\n position: relative;\n border-radius: 2px;\n min-width: ${({ minWidth, inline }) => (inline || !minWidth ? '' : `${minWidth}px`)};\n align-items: center;\n align-content: center;\n min-height: 28px;\n /** PUI-15490: the spec's 5px vertical padding belongs to the TEXT LINE (StyledInputWrapper),\n * not here \u2014 padding the wrapper would also inset the separator + chevron column and inflate\n * the control past the spec's min-height. Right-side 8px comes from the grid gap column. */\n padding: 0px 0px 0px 8px;\n margin: ${({ inline }) => (inline ? '8px 16px' : '')};\n ${borderStyles}\n &:hover {\n ${({ disabled }) => (!disabled ? hoverBorder : '')}\n }\n &:focus-within {\n ${focusBorder}\n }\n`;\n\nexport const StyledSingleSelectWraper = styled('div', {\n name: DSFormComboboxName,\n slot: FORM_COMBOBOX_SLOTS.SELECTED_VALUES,\n})<{\n disabled: boolean;\n applyAriaDisabled: boolean;\n readOnly: boolean;\n}>`\n display: flex;\n width: 100%;\n align-items: center;\n color: ${({ disabled, readOnly, theme }) =>\n disabled || readOnly ? theme.colors.neutral['600'] : theme.colors.neutral['700']};\n user-select: ${({ disabled, applyAriaDisabled }) => (disabled || applyAriaDisabled ? 'none' : '')};\n`;\n\nexport const StyledSelection = styled(DSTypography, {\n name: DSFormComboboxName,\n slot: FORM_COMBOBOX_SLOTS.SELECTION,\n})`\n margin-right: 3px;\n display: flex;\n /** PUI-15490 \u2014 no vertical padding here on purpose: the 5px text-line rhythm lives on\n * StyledInputWrapper (always rendered), so the control height stays constant and pills\n * (taller than the text line) center within it instead of growing the control. */\n align-self: center;\n`;\n\nexport const StyledHeaderActionsWrapper = styled(Grid, {\n name: DSFormComboboxName,\n slot: FORM_COMBOBOX_SLOTS.HEADER_ACTIONS,\n})`\n height: 100%;\n /** PUI-15490 \u2014 grid children otherwise stretch to the row height; the chevron button must\n * keep its spec box (size 's' square, icon + 2px) and the separator its fixed 20px. */\n align-items: center;\n .em-ds-button--text:focus::after {\n border: none;\n }\n`;\n\nexport const StyleDropdownIndicator = styled.div``;\n\nexport const StyleHeaderActionsSeparator = styled('span', {\n name: DSFormComboboxName,\n slot: FORM_COMBOBOX_SLOTS.HEADER_ACTIONS_SEPARATOR,\n})<Partial<StyledControlsWrapperT>>`\n /** PUI-15490 \u2014 fixed 20px per the box-model spec (was height: 100%, which stretched it\n * with the control row instead of staying at spec size). */\n height: 20px;\n align-self: center;\n width: 1px;\n background-color: ${({ theme }) => theme.colors.neutral['400']};\n`;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;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zE,CAAC,EAAE,OAAO,MAAO,SAAS,aAAa,EAAG;AAAA,IAClD,YAAY;AAAA;AAAA,MAEV,CAAC,EAAE,SAAS,MAAO,CAAC,WAAW,cAAc,EAAG;AAAA;AAAA;AAAA,MAGhD,WAAW;AAAA;AAAA;AAIV,MAAM,+BAA2B,yBAAO,OAAO;AAAA,EACpD,MAAM;AAAA,EACN,MAAM,qCAAoB;AAC5B,CAAC;AAAA;AAAA;AAAA;AAAA,WAQU,CAAC,EAAE,UAAU,UAAU,MAAM,MACpC,YAAY,WAAW,MAAM,OAAO,QAAQ,KAAK,IAAI,MAAM,OAAO,QAAQ,KAAK,CAAC;AAAA,iBACnE,CAAC,EAAE,UAAU,kBAAkB,MAAO,YAAY,oBAAoB,SAAS,EAAG;AAAA;AAG5F,MAAM,sBAAkB,yBAAO,mCAAc;AAAA,EAClD,MAAM;AAAA,EACN,MAAM,qCAAoB;AAC5B,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASM,MAAM,iCAA6B,yBAAO,qBAAM;AAAA,EACrD,MAAM;AAAA,EACN,MAAM,qCAAoB;AAC5B,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUM,MAAM,yBAAyB,wBAAO;AAEtC,MAAM,kCAA8B,yBAAO,QAAQ;AAAA,EACxD,MAAM;AAAA,EACN,MAAM,qCAAoB;AAC5B,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAMqB,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,QAAQ,KAAK,CAAC;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -33,16 +33,17 @@ __export(ControlsInput_exports, {
|
|
|
33
33
|
module.exports = __toCommonJS(ControlsInput_exports);
|
|
34
34
|
var React = __toESM(require("react"));
|
|
35
35
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
|
+
var import_react = require("react");
|
|
36
37
|
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
37
38
|
var import_ds_system = require("@elliemae/ds-system");
|
|
38
|
-
var
|
|
39
|
-
var import_react = require("react");
|
|
39
|
+
var import_TruncatedText = require("../../TruncatedText.js");
|
|
40
40
|
var import_ComboBoxCTX = require("../../ComboBoxCTX.js");
|
|
41
41
|
var import_ComboboxDataTestids = require("../../ComboboxDataTestids.js");
|
|
42
42
|
var import_listHelper = require("../../utils/listHelper.js");
|
|
43
43
|
var import_styled = require("./styled.js");
|
|
44
44
|
var import_useControlsInput = require("./useControlsInput.js");
|
|
45
45
|
var import_useKeyboardNavigation = require("./useKeyboardNavigation.js");
|
|
46
|
+
var import_typeGuards = require("../../utils/typeGuards.js");
|
|
46
47
|
const ControlsInput = () => {
|
|
47
48
|
const {
|
|
48
49
|
props,
|
|
@@ -81,7 +82,8 @@ const ControlsInput = () => {
|
|
|
81
82
|
});
|
|
82
83
|
const actualAriaDescribedBy = (0, import_react.useMemo)(() => {
|
|
83
84
|
if (id) {
|
|
84
|
-
|
|
85
|
+
const internalIds = `${id}_current_placeholder ${id}_feedback_message ${id}_error_message`;
|
|
86
|
+
return ariaDescribedBy ? `${ariaDescribedBy} ${internalIds}` : internalIds;
|
|
85
87
|
}
|
|
86
88
|
return ariaDescribedBy;
|
|
87
89
|
}, [ariaDescribedBy, id]);
|
|
@@ -89,7 +91,7 @@ const ControlsInput = () => {
|
|
|
89
91
|
if ((0, import_listHelper.isArrayOfItems)(selectedValues)) {
|
|
90
92
|
return `options ${selectedValues.map((item) => item.label).join(", ")} selected. ${readOnly ? "Read only" : ""}`;
|
|
91
93
|
}
|
|
92
|
-
if (
|
|
94
|
+
if ((0, import_typeGuards.isItemContainingALabel)(selectedValues)) {
|
|
93
95
|
return `option ${selectedValues.label} selected. ${readOnly ? "Read only" : ""}`;
|
|
94
96
|
}
|
|
95
97
|
if (readOnly) {
|
|
@@ -103,14 +105,25 @@ const ControlsInput = () => {
|
|
|
103
105
|
}
|
|
104
106
|
return void 0;
|
|
105
107
|
}, [focusOptionIdx, hasFocus, isLoading, menuState]);
|
|
108
|
+
const isNonInteractive = [disabled, applyAriaDisabled, readOnly].some(Boolean);
|
|
106
109
|
const handleOnPaste = (e) => {
|
|
107
110
|
e.preventDefault();
|
|
108
111
|
setInputValue(e.clipboardData.getData("text/plain"));
|
|
109
112
|
internalRef.current?.focus();
|
|
110
113
|
};
|
|
111
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_styled.StyledInputWrapper, { children: [
|
|
114
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_styled.StyledInputWrapper, { getOwnerProps, children: [
|
|
112
115
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styled.StyledInputWidthReference, { innerRef: spanReference, children: spanReferenceText }),
|
|
113
|
-
showPlaceholder && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
116
|
+
showPlaceholder && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
117
|
+
import_styled.StyledInputPlaceHolder,
|
|
118
|
+
{
|
|
119
|
+
variant: "b2",
|
|
120
|
+
component: "span",
|
|
121
|
+
getOwnerProps,
|
|
122
|
+
"aria-hidden": "true",
|
|
123
|
+
$nonInteractive: isNonInteractive,
|
|
124
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TruncatedText.TruncatedText, { value: showPlaceholder })
|
|
125
|
+
}
|
|
126
|
+
),
|
|
114
127
|
menuState === false && !inline ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styled.StyledHiddenDiv, { id: `combo-listbox-${instanceUid}` }) : null,
|
|
115
128
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styled.StyledHiddenDiv, { id: `${id}_current_placeholder`, children: currentPlaceholder }),
|
|
116
129
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -133,7 +146,7 @@ const ControlsInput = () => {
|
|
|
133
146
|
"aria-autocomplete": "list",
|
|
134
147
|
role: "combobox",
|
|
135
148
|
disabled,
|
|
136
|
-
applyAriaDisabled,
|
|
149
|
+
applyAriaDisabled: applyAriaDisabled ?? false,
|
|
137
150
|
style: { width },
|
|
138
151
|
innerRef: (0, import_ds_system.mergeRefs)(innerRef, internalRef),
|
|
139
152
|
value: inputValue,
|
|
@@ -141,7 +154,7 @@ const ControlsInput = () => {
|
|
|
141
154
|
onKeyDown: onInputKeyDown,
|
|
142
155
|
onChange: handleOnChange,
|
|
143
156
|
tabIndex,
|
|
144
|
-
withoutCaret: onlySelectable,
|
|
157
|
+
withoutCaret: onlySelectable ?? false,
|
|
145
158
|
autoComplete: "off",
|
|
146
159
|
"aria-readonly": readOnly
|
|
147
160
|
}
|
|
@@ -156,7 +169,7 @@ const ControlsInput = () => {
|
|
|
156
169
|
tabIndex: -1,
|
|
157
170
|
onPaste: handleOnPaste,
|
|
158
171
|
"aria-hidden": "true",
|
|
159
|
-
isDisabled: disabled || applyAriaDisabled
|
|
172
|
+
isDisabled: !!(disabled || applyAriaDisabled)
|
|
160
173
|
}
|
|
161
174
|
)
|
|
162
175
|
] });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/controls-input/ControlsInput.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["import React, { useContext, useMemo } from 'react';\nimport { useGetGlobalAttributes, useOwnerProps } from '@elliemae/ds-props-helpers';\nimport { mergeRefs } from '@elliemae/ds-system';\nimport { TruncatedText } from '../../TruncatedText.js';\nimport { ComboBoxContext } from '../../ComboBoxCTX.js';\nimport { ComboboxDataTestid } from '../../ComboboxDataTestids.js';\nimport { isArrayOfItems } from '../../utils/listHelper.js';\nimport {\n StyledHiddenDiv,\n StyledInput,\n StyledInputPlaceHolder,\n StyledInputWidthReference,\n StyledInputWrapper,\n StyleHiddenInput,\n} from './styled.js';\nimport { useControlsInput } from './useControlsInput.js';\nimport { useKeyboardNavigation } from './useKeyboardNavigation.js';\nimport { isItemContainingALabel } from '../../utils/typeGuards.js';\n\nexport const ControlsInput = (): JSX.Element => {\n const {\n props,\n props: {\n autoFocus,\n inline,\n selectedValues,\n placeholder,\n disabled,\n innerRef,\n isLoading,\n onlySelectable,\n applyAriaDisabled,\n readOnly,\n ...restProps\n },\n focusOptionIdx,\n hasFocus,\n internalRef,\n inputValue,\n setInputValue,\n menuState,\n instanceUid,\n } = useContext(ComboBoxContext);\n const { onInputKeyDown } = useKeyboardNavigation();\n\n const { spanReference, width, spanReferenceText, showPlaceholder, handleOnBlur, handleOnChange, handleOnFocus } =\n useControlsInput();\n\n const { getOwnerProps, getOwnerPropsArguments } = useOwnerProps(props);\n\n const {\n tabIndex,\n id,\n 'aria-describedby': ariaDescribedBy,\n ...globalAttrs\n } = useGetGlobalAttributes(restProps, {\n onFocus: handleOnFocus,\n onBlur: handleOnBlur,\n });\n\n const actualAriaDescribedBy = useMemo(() => {\n if (id) {\n const internalIds = `${id}_current_placeholder ${id}_feedback_message ${id}_error_message`;\n return ariaDescribedBy ? `${ariaDescribedBy} ${internalIds}` : internalIds;\n }\n return ariaDescribedBy;\n }, [ariaDescribedBy, id]);\n\n const currentPlaceholder = useMemo(() => {\n if (isArrayOfItems(selectedValues)) {\n return `options ${selectedValues.map((item) => item.label).join(', ')} selected. ${readOnly ? 'Read only' : ''}`;\n }\n if (isItemContainingALabel(selectedValues)) {\n return `option ${selectedValues.label} selected. ${readOnly ? 'Read only' : ''}`;\n }\n if (readOnly) {\n return `${placeholder}. Read only`;\n }\n return placeholder;\n }, [placeholder, selectedValues, readOnly]);\n\n const activeDescendant = useMemo(() => {\n if (!isLoading && hasFocus && menuState) {\n return focusOptionIdx;\n }\n return undefined;\n }, [focusOptionIdx, hasFocus, isLoading, menuState]);\n\n // `.some(Boolean)` over `||` keeps this component within its cyclomatic-complexity limit.\n const isNonInteractive = [disabled, applyAriaDisabled, readOnly].some(Boolean);\n\n const handleOnPaste = (e: React.ClipboardEvent<HTMLInputElement>) => {\n e.preventDefault();\n setInputValue(e.clipboardData.getData('text/plain'));\n internalRef.current?.focus();\n };\n return (\n <StyledInputWrapper getOwnerProps={getOwnerProps}>\n <StyledInputWidthReference innerRef={spanReference}>{spanReferenceText}</StyledInputWidthReference>\n {showPlaceholder && (\n <StyledInputPlaceHolder\n variant=\"b2\"\n component=\"span\"\n getOwnerProps={getOwnerProps}\n aria-hidden=\"true\"\n $nonInteractive={isNonInteractive}\n >\n <TruncatedText value={showPlaceholder} />\n </StyledInputPlaceHolder>\n )}\n\n {/* The purpose of this div is to always have the 'combo-listbox-{uid}' present in the DOM */}\n {/* Fix for PUI-11597 */}\n {menuState === false && !inline ? <StyledHiddenDiv id={`combo-listbox-${instanceUid}`}></StyledHiddenDiv> : null}\n\n {/* The announcement of currentPlaceholder is being overridden by the value of actualAriaDescribedBy */}\n {/* and since this variable is necessary for the annoucement of FormLayoutBlockItem error and feedback */}\n {/* messages, we concatenate the value of actualPlaceholder with that aria description */}\n {/* Fix for PUI-9609 */}\n <StyledHiddenDiv id={`${id}_current_placeholder`}>{currentPlaceholder}</StyledHiddenDiv>\n\n <StyledInput\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n onBlur={handleOnBlur}\n onFocus={handleOnFocus}\n readOnly={readOnly || onlySelectable}\n {...globalAttrs}\n id={id}\n data-testid={ComboboxDataTestid.INPUT}\n autoFocus={autoFocus}\n placeholder={currentPlaceholder}\n aria-activedescendant={activeDescendant}\n aria-expanded={menuState}\n aria-controls={`combo-listbox-${instanceUid}`}\n aria-describedby={actualAriaDescribedBy}\n aria-autocomplete=\"list\"\n role=\"combobox\"\n disabled={disabled}\n applyAriaDisabled={applyAriaDisabled ?? false}\n style={{ width }}\n innerRef={mergeRefs(innerRef, internalRef)}\n value={inputValue}\n type=\"text\"\n onKeyDown={onInputKeyDown}\n onChange={handleOnChange}\n tabIndex={tabIndex}\n withoutCaret={onlySelectable ?? false}\n autoComplete=\"off\"\n aria-readonly={readOnly}\n />\n {/* This input is used to handle the paste event */}\n <StyleHiddenInput\n type=\"text\"\n disabled={disabled || applyAriaDisabled}\n readOnly={readOnly}\n name=\"hidden\"\n tabIndex={-1}\n onPaste={handleOnPaste}\n aria-hidden=\"true\"\n isDisabled={!!(disabled || applyAriaDisabled)}\n />\n </StyledInputWrapper>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADiGnB;AAjGJ,mBAA2C;AAC3C,8BAAsD;AACtD,uBAA0B;AAC1B,2BAA8B;AAC9B,yBAAgC;AAChC,iCAAmC;AACnC,wBAA+B;AAC/B,oBAOO;AACP,8BAAiC;AACjC,mCAAsC;AACtC,wBAAuC;AAEhC,MAAM,gBAAgB,MAAmB;AAC9C,QAAM;AAAA,IACJ;AAAA,IACA,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,GAAG;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,QAAI,yBAAW,kCAAe;AAC9B,QAAM,EAAE,eAAe,QAAI,oDAAsB;AAEjD,QAAM,EAAE,eAAe,OAAO,mBAAmB,iBAAiB,cAAc,gBAAgB,cAAc,QAC5G,0CAAiB;AAEnB,QAAM,EAAE,eAAe,uBAAuB,QAAI,uCAAc,KAAK;AAErE,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,oBAAoB;AAAA,IACpB,GAAG;AAAA,EACL,QAAI,g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