@elliemae/ds-form-combobox 3.60.0-next.2 → 3.60.0-next.20
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/constants/index.js +4 -2
- package/dist/cjs/constants/index.js.map +2 -2
- package/dist/cjs/parts/menu-list/MenuList.js +39 -36
- package/dist/cjs/parts/menu-list/MenuList.js.map +2 -2
- package/dist/cjs/parts/multi-selected-values-container/MultiSelectedValuesContainer.js +21 -6
- package/dist/cjs/parts/multi-selected-values-container/MultiSelectedValuesContainer.js.map +2 -2
- package/dist/cjs/parts/multi-selected-values-container/RemovableSelectedValuePill.js +12 -5
- package/dist/cjs/parts/multi-selected-values-container/RemovableSelectedValuePill.js.map +2 -2
- package/dist/cjs/parts/multi-selected-values-container/useGroupPills.js +1 -1
- package/dist/cjs/parts/multi-selected-values-container/useGroupPills.js.map +2 -2
- package/dist/cjs/parts/styled.js +17 -1
- package/dist/cjs/parts/styled.js.map +2 -2
- package/dist/cjs/sharedTypes.js.map +1 -1
- package/dist/esm/constants/index.js +4 -2
- package/dist/esm/constants/index.js.map +2 -2
- package/dist/esm/parts/menu-list/MenuList.js +39 -36
- package/dist/esm/parts/menu-list/MenuList.js.map +2 -2
- package/dist/esm/parts/multi-selected-values-container/MultiSelectedValuesContainer.js +22 -7
- package/dist/esm/parts/multi-selected-values-container/MultiSelectedValuesContainer.js.map +2 -2
- package/dist/esm/parts/multi-selected-values-container/RemovableSelectedValuePill.js +12 -5
- package/dist/esm/parts/multi-selected-values-container/RemovableSelectedValuePill.js.map +2 -2
- package/dist/esm/parts/multi-selected-values-container/useGroupPills.js +1 -1
- package/dist/esm/parts/multi-selected-values-container/useGroupPills.js.map +2 -2
- package/dist/esm/parts/styled.js +17 -1
- package/dist/esm/parts/styled.js.map +2 -2
- package/dist/esm/sharedTypes.js.map +1 -1
- package/dist/types/constants/index.d.ts +2 -0
- package/dist/types/parts/multi-selected-values-container/RemovableSelectedValuePill.d.ts +4 -0
- package/dist/types/parts/styled.d.ts +12 -0
- package/dist/types/sharedTypes.d.ts +1 -1
- package/package.json +35 -39
|
@@ -48,7 +48,8 @@ const FORM_COMBOBOX_SLOTS = {
|
|
|
48
48
|
SINGLE_MENU_ITEM: "single-menu-item",
|
|
49
49
|
MULTI_MENU_ITEM: "multi-menu-item",
|
|
50
50
|
LOADING_INDICATOR: "loading-indicator",
|
|
51
|
-
SKELETON_MENU_ITEM: "skeleton-menu-item"
|
|
51
|
+
SKELETON_MENU_ITEM: "skeleton-menu-item",
|
|
52
|
+
PILL: "pill"
|
|
52
53
|
};
|
|
53
54
|
const FORM_COMBOBOX_DATA_TESTID = {
|
|
54
55
|
...(0, import_ds_system.slotObjectToDataTestIds)(DSFormComboboxName, FORM_COMBOBOX_SLOTS),
|
|
@@ -61,6 +62,7 @@ const FORM_COMBOBOX_DATA_TESTID = {
|
|
|
61
62
|
SELECTED_VALUES: "combobox-selected-values",
|
|
62
63
|
DROPDOWN: "combobox-dropdown-btn",
|
|
63
64
|
OPTION: "combobox-option",
|
|
64
|
-
ALLY_SELECTED_VALUES: "combobox-ally-selected-values"
|
|
65
|
+
ALLY_SELECTED_VALUES: "combobox-ally-selected-values",
|
|
66
|
+
PILL: "ds-pill-wrapper"
|
|
65
67
|
};
|
|
66
68
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/constants/index.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { slotObjectToDataTestIds } from '@elliemae/ds-system';\n\nexport const DSFormComboboxName = 'DSCombobox';\n\n// we are naming this with the ${component_name}_slots convention to namespace & avoid errors on duplicate exports variables in aggregators\nexport const FORM_COMBOBOX_SLOTS = {\n // Same as old container\n ROOT: 'root',\n INPUT_WRAPPER: 'input-wrapper',\n INPUT: 'input',\n DROPDOWN_BUTTON: 'dropdown-button',\n FAST_LIST: 'fast-list',\n SECTION_WRAPPER: 'section-wrapper',\n SECTION_LABEL: 'section-label',\n SINGLE_MENU_ITEM: 'single-menu-item',\n MULTI_MENU_ITEM: 'multi-menu-item',\n LOADING_INDICATOR: 'loading-indicator',\n SKELETON_MENU_ITEM: 'skeleton-menu-item',\n} as const;\n\n// we are naming this with the ${component_name}_data_testid convention to namespace & avoid errors on duplicate exports variables in aggregators\nexport const FORM_COMBOBOX_DATA_TESTID = {\n ...slotObjectToDataTestIds(DSFormComboboxName, FORM_COMBOBOX_SLOTS),\n // legacy data-testid\n CONTROLS_WRAPPER: 'combobox-controls-wrapper',\n CONTAINER: 'combobox-container',\n INPUT: 'combobox-input',\n LIST: 'combobox-menu-list',\n NO_MATCHES_FOUND: 'combobox-no-matches-found',\n SELECTED_VALUES: 'combobox-selected-values',\n DROPDOWN: 'combobox-dropdown-btn',\n OPTION: 'combobox-option',\n ALLY_SELECTED_VALUES: 'combobox-ally-selected-values',\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAAwC;AAEjC,MAAM,qBAAqB;AAG3B,MAAM,sBAAsB;AAAA;AAAA,EAEjC,MAAM;AAAA,EACN,eAAe;AAAA,EACf,OAAO;AAAA,EACP,iBAAiB;AAAA,EACjB,WAAW;AAAA,EACX,iBAAiB;AAAA,EACjB,eAAe;AAAA,EACf,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,mBAAmB;AAAA,EACnB,oBAAoB;
|
|
4
|
+
"sourcesContent": ["import { slotObjectToDataTestIds } from '@elliemae/ds-system';\n\nexport const DSFormComboboxName = 'DSCombobox';\n\n// we are naming this with the ${component_name}_slots convention to namespace & avoid errors on duplicate exports variables in aggregators\nexport const FORM_COMBOBOX_SLOTS = {\n // Same as old container\n ROOT: 'root',\n INPUT_WRAPPER: 'input-wrapper',\n INPUT: 'input',\n DROPDOWN_BUTTON: 'dropdown-button',\n FAST_LIST: 'fast-list',\n SECTION_WRAPPER: 'section-wrapper',\n SECTION_LABEL: 'section-label',\n SINGLE_MENU_ITEM: 'single-menu-item',\n MULTI_MENU_ITEM: 'multi-menu-item',\n LOADING_INDICATOR: 'loading-indicator',\n SKELETON_MENU_ITEM: 'skeleton-menu-item',\n PILL: 'pill',\n} as const;\n\n// we are naming this with the ${component_name}_data_testid convention to namespace & avoid errors on duplicate exports variables in aggregators\nexport const FORM_COMBOBOX_DATA_TESTID = {\n ...slotObjectToDataTestIds(DSFormComboboxName, FORM_COMBOBOX_SLOTS),\n // legacy data-testid\n CONTROLS_WRAPPER: 'combobox-controls-wrapper',\n CONTAINER: 'combobox-container',\n INPUT: 'combobox-input',\n LIST: 'combobox-menu-list',\n NO_MATCHES_FOUND: 'combobox-no-matches-found',\n SELECTED_VALUES: 'combobox-selected-values',\n DROPDOWN: 'combobox-dropdown-btn',\n OPTION: 'combobox-option',\n ALLY_SELECTED_VALUES: 'combobox-ally-selected-values',\n PILL: 'ds-pill-wrapper',\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAAwC;AAEjC,MAAM,qBAAqB;AAG3B,MAAM,sBAAsB;AAAA;AAAA,EAEjC,MAAM;AAAA,EACN,eAAe;AAAA,EACf,OAAO;AAAA,EACP,iBAAiB;AAAA,EACjB,WAAW;AAAA,EACX,iBAAiB;AAAA,EACjB,eAAe;AAAA,EACf,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,mBAAmB;AAAA,EACnB,oBAAoB;AAAA,EACpB,MAAM;AACR;AAGO,MAAM,4BAA4B;AAAA,EACvC,OAAG,0CAAwB,oBAAoB,mBAAmB;AAAA;AAAA,EAElE,kBAAkB;AAAA,EAClB,WAAW;AAAA,EACX,OAAO;AAAA,EACP,MAAM;AAAA,EACN,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,sBAAsB;AAAA,EACtB,MAAM;AACR;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -54,47 +54,21 @@ const StyledItemsWrapper = (0, import_ds_system.styled)(import_ds_grid.Grid)`
|
|
|
54
54
|
max-height: ${({ maxHeight }) => maxHeight ? `${String(maxHeight)}px` : "300px"};
|
|
55
55
|
`;
|
|
56
56
|
const estimatedSize = () => 32;
|
|
57
|
-
const
|
|
57
|
+
const ContentComp = () => {
|
|
58
58
|
const {
|
|
59
59
|
props,
|
|
60
|
-
props: { isLoading,
|
|
61
|
-
controlsWrapperRef,
|
|
60
|
+
props: { isLoading, noOptionsMessage, menuMaxHeight, onCreate, isSkeleton, selectedValues },
|
|
62
61
|
listRef,
|
|
63
|
-
wrapperListRef,
|
|
64
62
|
correctOptions: filteredOptions,
|
|
65
63
|
instanceUid
|
|
66
64
|
} = (0, import_react.useContext)(import_ComboBoxCTX.ComboBoxContext);
|
|
67
65
|
const { getOwnerProps } = (0, import_ds_props_helpers.useOwnerProps)(props);
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
content = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_SkeletonContainer.SkeletonContainer, { instanceUid, getOwnerProps });
|
|
75
|
-
} else if (isLoading) {
|
|
76
|
-
content = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_LoadingContainer.LoadingContainer, { getOwnerProps });
|
|
77
|
-
} else if ((filteredOptions?.length ?? 0) > 0 || onCreate) {
|
|
78
|
-
content = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StyledItemsWrapper, { maxHeight: menuMaxHeight, id: `combo-listbox-${instanceUid}`, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
79
|
-
StyledFastList,
|
|
80
|
-
{
|
|
81
|
-
dsFastlistWrapperList: {
|
|
82
|
-
role: "listbox",
|
|
83
|
-
"data-testid": import_ComboboxDataTestids.ComboboxDataTestid.LIST,
|
|
84
|
-
"aria-label": "listbox"
|
|
85
|
-
},
|
|
86
|
-
dsFastlistItem: { role: "none" },
|
|
87
|
-
actionRef: listRef,
|
|
88
|
-
count: filteredOptions.length,
|
|
89
|
-
ItemRenderer: import_useItemRenderer.ItemRenderer,
|
|
90
|
-
extraItemProps: { itemList: filteredOptions },
|
|
91
|
-
getId: (index) => filteredOptions[index].dsId,
|
|
92
|
-
estimateSize: estimatedSize,
|
|
93
|
-
getOwnerProps
|
|
94
|
-
}
|
|
95
|
-
) });
|
|
96
|
-
} else {
|
|
97
|
-
content = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
66
|
+
const isMulti = Array.isArray(selectedValues);
|
|
67
|
+
if (isSkeleton) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_SkeletonContainer.SkeletonContainer, { instanceUid, getOwnerProps });
|
|
68
|
+
if (isLoading) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_LoadingContainer.LoadingContainer, { getOwnerProps });
|
|
69
|
+
const shouldShowNoResults = !onCreate && (filteredOptions?.length ?? 0) === 0;
|
|
70
|
+
if (shouldShowNoResults)
|
|
71
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
98
72
|
import_styled.StyledNoResultsWrapper,
|
|
99
73
|
{
|
|
100
74
|
id: `combo-listbox-${instanceUid}`,
|
|
@@ -103,7 +77,36 @@ const MenuList = () => {
|
|
|
103
77
|
children: noOptionsMessage
|
|
104
78
|
}
|
|
105
79
|
);
|
|
106
|
-
}
|
|
80
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StyledItemsWrapper, { maxHeight: menuMaxHeight, id: `combo-listbox-${instanceUid}`, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
81
|
+
StyledFastList,
|
|
82
|
+
{
|
|
83
|
+
dsFastlistWrapperList: {
|
|
84
|
+
role: "listbox",
|
|
85
|
+
"aria-multiselectable": isMulti,
|
|
86
|
+
"data-testid": import_ComboboxDataTestids.ComboboxDataTestid.LIST,
|
|
87
|
+
"aria-label": "listbox"
|
|
88
|
+
},
|
|
89
|
+
dsFastlistItem: { role: "none" },
|
|
90
|
+
actionRef: listRef,
|
|
91
|
+
count: filteredOptions.length,
|
|
92
|
+
ItemRenderer: import_useItemRenderer.ItemRenderer,
|
|
93
|
+
extraItemProps: { itemList: filteredOptions },
|
|
94
|
+
getId: (index) => filteredOptions[index].dsId,
|
|
95
|
+
estimateSize: estimatedSize,
|
|
96
|
+
getOwnerProps
|
|
97
|
+
}
|
|
98
|
+
) });
|
|
99
|
+
};
|
|
100
|
+
const MenuList = () => {
|
|
101
|
+
const {
|
|
102
|
+
props: { menuMinWidth, inline },
|
|
103
|
+
controlsWrapperRef,
|
|
104
|
+
wrapperListRef
|
|
105
|
+
} = (0, import_react.useContext)(import_ComboBoxCTX.ComboBoxContext);
|
|
106
|
+
const { width } = (0, import_useOnElementResize.useOnElementResize)(controlsWrapperRef);
|
|
107
|
+
const preventLoseInputFocus = (0, import_react.useCallback)((e) => {
|
|
108
|
+
e.preventDefault();
|
|
109
|
+
}, []);
|
|
107
110
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
108
111
|
import_styled.StyledListWrapper,
|
|
109
112
|
{
|
|
@@ -112,7 +115,7 @@ const MenuList = () => {
|
|
|
112
115
|
onMouseDown: preventLoseInputFocus,
|
|
113
116
|
width,
|
|
114
117
|
minWidth: menuMinWidth,
|
|
115
|
-
children:
|
|
118
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ContentComp, {})
|
|
116
119
|
}
|
|
117
120
|
);
|
|
118
121
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/menu-list/MenuList.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React, { useContext, useCallback } from 'react';\nimport { DSFastList } from '@elliemae/ds-fast-list';\nimport { type SizingProps, styled } from '@elliemae/ds-system';\nimport { Grid } from '@elliemae/ds-grid';\nimport { useOwnerProps } from '@elliemae/ds-props-helpers';\nimport { StyledListWrapper, StyledNoResultsWrapper } from './styled.js';\nimport { ComboboxDataTestid } from '../../ComboboxDataTestids.js';\nimport { ComboBoxContext } from '../../ComboBoxCTX.js';\nimport { ItemRenderer } from './useItemRenderer.js';\nimport { LoadingContainer } from './LoadingContainer.js';\nimport { SkeletonContainer } from './SkeletonContainer.js';\nimport { useOnElementResize } from '../../utils/useOnElementResize.js';\nimport { DSFormComboboxName, FORM_COMBOBOX_SLOTS } from '../../constants/index.js';\n\nconst StyledFastList = styled(DSFastList, {\n name: DSFormComboboxName,\n slot: FORM_COMBOBOX_SLOTS.FAST_LIST,\n})``;\n\nconst StyledItemsWrapper = styled(Grid)<{\n maxHeight: SizingProps['maxHeight'];\n}>`\n max-height: ${({ maxHeight }) => (maxHeight ? `${String(maxHeight)}px` : '300px')};\n`;\n\nconst estimatedSize = () => 32;\n\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["import React, { useContext, useCallback } from 'react';\nimport { DSFastList } from '@elliemae/ds-fast-list';\nimport { type SizingProps, styled } from '@elliemae/ds-system';\nimport { Grid } from '@elliemae/ds-grid';\nimport { useOwnerProps } from '@elliemae/ds-props-helpers';\nimport { StyledListWrapper, StyledNoResultsWrapper } from './styled.js';\nimport { ComboboxDataTestid } from '../../ComboboxDataTestids.js';\nimport { ComboBoxContext } from '../../ComboBoxCTX.js';\nimport { ItemRenderer } from './useItemRenderer.js';\nimport { LoadingContainer } from './LoadingContainer.js';\nimport { SkeletonContainer } from './SkeletonContainer.js';\nimport { useOnElementResize } from '../../utils/useOnElementResize.js';\nimport { DSFormComboboxName, FORM_COMBOBOX_SLOTS } from '../../constants/index.js';\n\nconst StyledFastList = styled(DSFastList, {\n name: DSFormComboboxName,\n slot: FORM_COMBOBOX_SLOTS.FAST_LIST,\n})``;\n\nconst StyledItemsWrapper = styled(Grid)<{\n maxHeight: SizingProps['maxHeight'];\n}>`\n max-height: ${({ maxHeight }) => (maxHeight ? `${String(maxHeight)}px` : '300px')};\n`;\n\nconst estimatedSize = () => 32;\n\nconst ContentComp = () => {\n const {\n props,\n props: { isLoading, noOptionsMessage, menuMaxHeight, onCreate, isSkeleton, selectedValues },\n listRef,\n correctOptions: filteredOptions,\n instanceUid,\n } = useContext(ComboBoxContext);\n\n const { getOwnerProps } = useOwnerProps(props);\n const isMulti = Array.isArray(selectedValues);\n\n if (isSkeleton) return <SkeletonContainer instanceUid={instanceUid} getOwnerProps={getOwnerProps} />;\n if (isLoading) return <LoadingContainer getOwnerProps={getOwnerProps} />;\n\n const shouldShowNoResults = !onCreate && (filteredOptions?.length ?? 0) === 0;\n if (shouldShowNoResults)\n return (\n <StyledNoResultsWrapper\n id={`combo-listbox-${instanceUid}`}\n data-testid={ComboboxDataTestid.NO_MATCHES_FOUND}\n role=\"alert\"\n >\n {noOptionsMessage}\n </StyledNoResultsWrapper>\n );\n\n return (\n <StyledItemsWrapper maxHeight={menuMaxHeight} id={`combo-listbox-${instanceUid}`}>\n <StyledFastList\n dsFastlistWrapperList={{\n role: 'listbox',\n 'aria-multiselectable': isMulti,\n 'data-testid': ComboboxDataTestid.LIST,\n 'aria-label': 'listbox',\n }}\n dsFastlistItem={{ role: 'none' }}\n actionRef={listRef}\n count={filteredOptions.length}\n ItemRenderer={ItemRenderer}\n extraItemProps={{ itemList: filteredOptions }}\n getId={(index: number) => filteredOptions[index].dsId}\n estimateSize={estimatedSize}\n getOwnerProps={getOwnerProps}\n />\n </StyledItemsWrapper>\n );\n};\n\nexport const MenuList = (): JSX.Element => {\n const {\n props: { menuMinWidth, inline },\n controlsWrapperRef,\n wrapperListRef,\n } = useContext(ComboBoxContext);\n\n const { width } = useOnElementResize(controlsWrapperRef);\n\n const preventLoseInputFocus: React.MouseEventHandler = useCallback((e) => {\n e.preventDefault();\n }, []);\n\n return (\n <StyledListWrapper\n innerRef={wrapperListRef}\n inline={inline}\n onMouseDown={preventLoseInputFocus}\n width={width}\n minWidth={menuMinWidth}\n >\n <ContentComp />\n </StyledListWrapper>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADuCE;AAvCzB,mBAA+C;AAC/C,0BAA2B;AAC3B,uBAAyC;AACzC,qBAAqB;AACrB,8BAA8B;AAC9B,oBAA0D;AAC1D,iCAAmC;AACnC,yBAAgC;AAChC,6BAA6B;AAC7B,8BAAiC;AACjC,+BAAkC;AAClC,gCAAmC;AACnC,uBAAwD;AAExD,MAAM,qBAAiB,yBAAO,gCAAY;AAAA,EACxC,MAAM;AAAA,EACN,MAAM,qCAAoB;AAC5B,CAAC;AAED,MAAM,yBAAqB,yBAAO,mBAAI;AAAA,gBAGtB,CAAC,EAAE,UAAU,MAAO,YAAY,GAAG,OAAO,SAAS,CAAC,OAAO,OAAQ;AAAA;AAGnF,MAAM,gBAAgB,MAAM;AAE5B,MAAM,cAAc,MAAM;AACxB,QAAM;AAAA,IACJ;AAAA,IACA,OAAO,EAAE,WAAW,kBAAkB,eAAe,UAAU,YAAY,eAAe;AAAA,IAC1F;AAAA,IACA,gBAAgB;AAAA,IAChB;AAAA,EACF,QAAI,yBAAW,kCAAe;AAE9B,QAAM,EAAE,cAAc,QAAI,uCAAc,KAAK;AAC7C,QAAM,UAAU,MAAM,QAAQ,cAAc;AAE5C,MAAI,WAAY,QAAO,4CAAC,8CAAkB,aAA0B,eAA8B;AAClG,MAAI,UAAW,QAAO,4CAAC,4CAAiB,eAA8B;AAEtE,QAAM,sBAAsB,CAAC,aAAa,iBAAiB,UAAU,OAAO;AAC5E,MAAI;AACF,WACE;AAAA,MAAC;AAAA;AAAA,QACC,IAAI,iBAAiB,WAAW;AAAA,QAChC,eAAa,8CAAmB;AAAA,QAChC,MAAK;AAAA,QAEJ;AAAA;AAAA,IACH;AAGJ,SACE,4CAAC,sBAAmB,WAAW,eAAe,IAAI,iBAAiB,WAAW,IAC5E;AAAA,IAAC;AAAA;AAAA,MACC,uBAAuB;AAAA,QACrB,MAAM;AAAA,QACN,wBAAwB;AAAA,QACxB,eAAe,8CAAmB;AAAA,QAClC,cAAc;AAAA,MAChB;AAAA,MACA,gBAAgB,EAAE,MAAM,OAAO;AAAA,MAC/B,WAAW;AAAA,MACX,OAAO,gBAAgB;AAAA,MACvB,cAAc;AAAA,MACd,gBAAgB,EAAE,UAAU,gBAAgB;AAAA,MAC5C,OAAO,CAAC,UAAkB,gBAAgB,KAAK,EAAE;AAAA,MACjD,cAAc;AAAA,MACd;AAAA;AAAA,EACF,GACF;AAEJ;AAEO,MAAM,WAAW,MAAmB;AACzC,QAAM;AAAA,IACJ,OAAO,EAAE,cAAc,OAAO;AAAA,IAC9B;AAAA,IACA;AAAA,EACF,QAAI,yBAAW,kCAAe;AAE9B,QAAM,EAAE,MAAM,QAAI,8CAAmB,kBAAkB;AAEvD,QAAM,4BAAiD,0BAAY,CAAC,MAAM;AACxE,MAAE,eAAe;AAAA,EACnB,GAAG,CAAC,CAAC;AAEL,SACE;AAAA,IAAC;AAAA;AAAA,MACC,UAAU;AAAA,MACV;AAAA,MACA,aAAa;AAAA,MACb;AAAA,MACA,UAAU;AAAA,MAEV,sDAAC,eAAY;AAAA;AAAA,EACf;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -33,19 +33,23 @@ __export(MultiSelectedValuesContainer_exports, {
|
|
|
33
33
|
module.exports = __toCommonJS(MultiSelectedValuesContainer_exports);
|
|
34
34
|
var React = __toESM(require("react"));
|
|
35
35
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
|
-
var import_react = require("react");
|
|
37
36
|
var import_ds_pills_v2 = require("@elliemae/ds-pills-v2");
|
|
37
|
+
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
38
|
+
var import_react = require("react");
|
|
38
39
|
var import_ComboBoxCTX = __toESM(require("../../ComboBoxCTX.js"));
|
|
39
|
-
var import_useGroupPills = require("./useGroupPills.js");
|
|
40
40
|
var import_ComboboxDataTestids = require("../../ComboboxDataTestids.js");
|
|
41
|
+
var import_styled = require("../styled.js");
|
|
41
42
|
var import_RemovableSelectedValuePill = require("./RemovableSelectedValuePill.js");
|
|
43
|
+
var import_useGroupPills = require("./useGroupPills.js");
|
|
42
44
|
const MultiSelectedValuesContainer = () => {
|
|
43
45
|
const {
|
|
46
|
+
props,
|
|
44
47
|
props: { selectedValues, disabled, applyAriaDisabled: applyAriaDisabledToContainer, readOnly },
|
|
45
48
|
pillGroupRef
|
|
46
49
|
} = (0, import_react.useContext)(import_ComboBoxCTX.default);
|
|
47
50
|
const multiSelectedValue = selectedValues;
|
|
48
51
|
const correctPillsToShow = (0, import_useGroupPills.useGroupPills)();
|
|
52
|
+
const ownerProps = (0, import_ds_props_helpers.useOwnerProps)(props);
|
|
49
53
|
return (0, import_react.useMemo)(
|
|
50
54
|
() => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
51
55
|
"div",
|
|
@@ -57,12 +61,13 @@ const MultiSelectedValuesContainer = () => {
|
|
|
57
61
|
import_RemovableSelectedValuePill.RemovableSelectedValuePill,
|
|
58
62
|
{
|
|
59
63
|
pill,
|
|
60
|
-
trailingComma: (disabled || applyAriaDisabledToContainer || readOnly) && idx + 1 < correctPillsToShow || multiSelectedValue.length > 0 && correctPillsToShow !== multiSelectedValue.length
|
|
64
|
+
trailingComma: (disabled || applyAriaDisabledToContainer || readOnly) && idx + 1 < correctPillsToShow || multiSelectedValue.length > 0 && correctPillsToShow !== multiSelectedValue.length,
|
|
65
|
+
ownerProps
|
|
61
66
|
},
|
|
62
67
|
pill.dsId
|
|
63
68
|
)),
|
|
64
69
|
multiSelectedValue.length > 0 && correctPillsToShow !== multiSelectedValue.length && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
65
|
-
|
|
70
|
+
import_styled.StyledDSPillV2,
|
|
66
71
|
{
|
|
67
72
|
size: "s",
|
|
68
73
|
labelTruncated: false,
|
|
@@ -70,14 +75,24 @@ const MultiSelectedValuesContainer = () => {
|
|
|
70
75
|
type: "value",
|
|
71
76
|
disabled,
|
|
72
77
|
applyAriaDisabled: applyAriaDisabledToContainer,
|
|
73
|
-
readOnly
|
|
78
|
+
readOnly,
|
|
79
|
+
className: "ds-pill-wrapper ds-pill-wrapper-value",
|
|
80
|
+
...ownerProps
|
|
74
81
|
},
|
|
75
82
|
"grouped"
|
|
76
83
|
)
|
|
77
84
|
] })
|
|
78
85
|
}
|
|
79
86
|
),
|
|
80
|
-
[
|
|
87
|
+
[
|
|
88
|
+
pillGroupRef,
|
|
89
|
+
multiSelectedValue,
|
|
90
|
+
correctPillsToShow,
|
|
91
|
+
disabled,
|
|
92
|
+
applyAriaDisabledToContainer,
|
|
93
|
+
readOnly,
|
|
94
|
+
ownerProps
|
|
95
|
+
]
|
|
81
96
|
);
|
|
82
97
|
};
|
|
83
98
|
//# sourceMappingURL=MultiSelectedValuesContainer.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/multi-selected-values-container/MultiSelectedValuesContainer.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["import { DSPillGroupV2 } from '@elliemae/ds-pills-v2';\nimport { useOwnerProps } from '@elliemae/ds-props-helpers';\nimport { useContext, useMemo } from 'react';\nimport ComboBoxContext from '../../ComboBoxCTX.js';\nimport { ComboboxDataTestid } from '../../ComboboxDataTestids.js';\nimport type { DSComboboxT } from '../../react-desc-prop-types.js';\nimport { StyledDSPillV2 } from '../styled.js';\nimport { RemovableSelectedValuePill } from './RemovableSelectedValuePill.js';\nimport { useGroupPills } from './useGroupPills.js';\n\nexport const MultiSelectedValuesContainer = (): JSX.Element => {\n const {\n props,\n props: { selectedValues, disabled, applyAriaDisabled: applyAriaDisabledToContainer, readOnly },\n pillGroupRef,\n } = useContext(ComboBoxContext);\n\n // this is always an array because logic in controls component\n const multiSelectedValue = selectedValues as DSComboboxT.ItemOption[];\n const correctPillsToShow = useGroupPills();\n const ownerProps = useOwnerProps(props);\n\n return useMemo(\n () => (\n <div\n style={{ width: multiSelectedValue.length > 0 ? 'max-content' : '0px' }}\n data-testid={ComboboxDataTestid.SELECTED_VALUES}\n >\n <DSPillGroupV2 innerRef={pillGroupRef}>\n {multiSelectedValue.length > 0 &&\n multiSelectedValue\n .slice(0, correctPillsToShow)\n .map((pill, idx) => (\n <RemovableSelectedValuePill\n key={pill.dsId}\n pill={pill}\n trailingComma={\n ((disabled || applyAriaDisabledToContainer || readOnly) && idx + 1 < correctPillsToShow) ||\n (multiSelectedValue.length > 0 && correctPillsToShow !== multiSelectedValue.length)\n }\n ownerProps={ownerProps}\n />\n ))}\n {multiSelectedValue.length > 0 && correctPillsToShow !== multiSelectedValue.length && (\n <StyledDSPillV2\n size=\"s\"\n labelTruncated={false}\n key=\"grouped\"\n label={`+${multiSelectedValue.length - correctPillsToShow}`}\n type=\"value\"\n disabled={disabled}\n applyAriaDisabled={applyAriaDisabledToContainer}\n readOnly={readOnly}\n className=\"ds-pill-wrapper ds-pill-wrapper-value\"\n {...ownerProps}\n />\n )}\n </DSPillGroupV2>\n </div>\n ),\n\n [\n pillGroupRef,\n multiSelectedValue,\n correctPillsToShow,\n disabled,\n applyAriaDisabledToContainer,\n readOnly,\n ownerProps,\n ],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD4Bf;AA5BR,yBAA8B;AAC9B,8BAA8B;AAC9B,mBAAoC;AACpC,yBAA4B;AAC5B,iCAAmC;AAEnC,oBAA+B;AAC/B,wCAA2C;AAC3C,2BAA8B;AAEvB,MAAM,+BAA+B,MAAmB;AAC7D,QAAM;AAAA,IACJ;AAAA,IACA,OAAO,EAAE,gBAAgB,UAAU,mBAAmB,8BAA8B,SAAS;AAAA,IAC7F;AAAA,EACF,QAAI,yBAAW,mBAAAA,OAAe;AAG9B,QAAM,qBAAqB;AAC3B,QAAM,yBAAqB,oCAAc;AACzC,QAAM,iBAAa,uCAAc,KAAK;AAEtC,aAAO;AAAA,IACL,MACE;AAAA,MAAC;AAAA;AAAA,QACC,OAAO,EAAE,OAAO,mBAAmB,SAAS,IAAI,gBAAgB,MAAM;AAAA,QACtE,eAAa,8CAAmB;AAAA,QAEhC,uDAAC,oCAAc,UAAU,cACtB;AAAA,6BAAmB,SAAS,KAC3B,mBACG,MAAM,GAAG,kBAAkB,EAC3B,IAAI,CAAC,MAAM,QACV;AAAA,YAAC;AAAA;AAAA,cAEC;AAAA,cACA,gBACI,YAAY,gCAAgC,aAAa,MAAM,IAAI,sBACpE,mBAAmB,SAAS,KAAK,uBAAuB,mBAAmB;AAAA,cAE9E;AAAA;AAAA,YANK,KAAK;AAAA,UAOZ,CACD;AAAA,UACJ,mBAAmB,SAAS,KAAK,uBAAuB,mBAAmB,UAC1E;AAAA,YAAC;AAAA;AAAA,cACC,MAAK;AAAA,cACL,gBAAgB;AAAA,cAEhB,OAAO,IAAI,mBAAmB,SAAS,kBAAkB;AAAA,cACzD,MAAK;AAAA,cACL;AAAA,cACA,mBAAmB;AAAA,cACnB;AAAA,cACA,WAAU;AAAA,cACT,GAAG;AAAA;AAAA,YAPA;AAAA,UAQN;AAAA,WAEJ;AAAA;AAAA,IACF;AAAA,IAGF;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
6
|
"names": ["ComboBoxContext"]
|
|
7
7
|
}
|
|
@@ -34,11 +34,11 @@ module.exports = __toCommonJS(RemovableSelectedValuePill_exports);
|
|
|
34
34
|
var React = __toESM(require("react"));
|
|
35
35
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
36
|
var import_react = __toESM(require("react"));
|
|
37
|
-
var import_ds_pills_v2 = require("@elliemae/ds-pills-v2");
|
|
38
37
|
var import_ComboBoxCTX = __toESM(require("../../ComboBoxCTX.js"));
|
|
39
38
|
var import_listHelper = require("../../utils/listHelper.js");
|
|
39
|
+
var import_styled = require("../styled.js");
|
|
40
40
|
const RemovableSelectedValuePill = (props) => {
|
|
41
|
-
const { pill, trailingComma } = props;
|
|
41
|
+
const { pill, trailingComma, ownerProps } = props;
|
|
42
42
|
const {
|
|
43
43
|
props: {
|
|
44
44
|
onChange,
|
|
@@ -55,13 +55,19 @@ const RemovableSelectedValuePill = (props) => {
|
|
|
55
55
|
if (applyAriaDisabledToContainer || readOnly) return "labelOnly";
|
|
56
56
|
return "removable";
|
|
57
57
|
}, [disabled, isNonClearable, applyAriaDisabledToContainer, readOnly]);
|
|
58
|
+
const className = import_react.default.useMemo(() => {
|
|
59
|
+
if (type === "removable") return "ds-pill-wrapper ds-pill-wrapper-removable";
|
|
60
|
+
if (type === "labelOnly") return "ds-pill-wrapper ds-pill-wrapper-label";
|
|
61
|
+
return "ds-pill-wrapper ds-pill-wrapper-value";
|
|
62
|
+
}, [type]);
|
|
58
63
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
59
|
-
|
|
64
|
+
import_styled.StyledDSPillV2,
|
|
60
65
|
{
|
|
61
66
|
size: "s",
|
|
62
67
|
label: pill.label,
|
|
63
|
-
disabled,
|
|
68
|
+
disabled: disabled || pill.disabled,
|
|
64
69
|
type,
|
|
70
|
+
className,
|
|
65
71
|
applyAriaDisabled: applyAriaDisabledToContainer || pill.applyAriaDisabled,
|
|
66
72
|
readOnly,
|
|
67
73
|
trailingComma,
|
|
@@ -71,7 +77,8 @@ const RemovableSelectedValuePill = (props) => {
|
|
|
71
77
|
e.stopPropagation();
|
|
72
78
|
onChange((0, import_listHelper.getSuggestedValueOnChange)(pill, selectedValues), pill, e);
|
|
73
79
|
internalRef.current?.focus();
|
|
74
|
-
}
|
|
80
|
+
},
|
|
81
|
+
...ownerProps
|
|
75
82
|
},
|
|
76
83
|
pill.value
|
|
77
84
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/multi-selected-values-container/RemovableSelectedValuePill.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React, { useContext } from 'react';\nimport
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD+
|
|
4
|
+
"sourcesContent": ["import React, { useContext } from 'react';\nimport ComboBoxContext from '../../ComboBoxCTX.js';\nimport type { DSComboboxT } from '../../react-desc-prop-types.js';\nimport { getSuggestedValueOnChange } from '../../utils/listHelper.js';\nimport { StyledDSPillV2 } from '../styled.js';\n\nexport const RemovableSelectedValuePill: React.ComponentType<{\n pill: DSComboboxT.ItemOption;\n applyAriaDisabled?: boolean;\n trailingComma?: boolean;\n ownerProps?: {\n getOwnerProps: () => DSComboboxT.InternalProps;\n getOwnerPropsArguments: () => object;\n };\n}> = (props) => {\n const { pill, trailingComma, ownerProps } = props;\n const {\n props: {\n onChange,\n isNonClearable,\n disabled,\n selectedValues,\n applyAriaDisabled: applyAriaDisabledToContainer,\n readOnly,\n },\n internalRef,\n } = useContext(ComboBoxContext);\n\n const type = React.useMemo(() => {\n if (disabled || isNonClearable) return 'value';\n if (applyAriaDisabledToContainer || readOnly) return 'labelOnly';\n return 'removable';\n }, [disabled, isNonClearable, applyAriaDisabledToContainer, readOnly]);\n /**\n * WORKAROUND: Manual className management\n *\n * StyledDSPillV2 is a styled-component wrapping DSPillV2.\n * When using the slot system (ownerProps), the internal component's className\n * is overridden by the styled-component's generated className, causing\n * DSPillV2's variant-specific classes to be lost.\n *\n * These classes are required for correct styling of different pill types:\n * - ds-pill-wrapper-removable: Interactive pills with remove button\n * - ds-pill-wrapper-label: Read-only pills (aria-disabled state)\n * - ds-pill-wrapper-value: Non-interactive pills (disabled/non-clearable)\n *\n * TODO: Fix in ds-system's generateClassName to preserve inner component classNames\n * when styled(InnerComponent) is used. Current implementation overwrites className\n * instead of merging it.\n *\n * Or instead of defining the className manually, trust on the ones generated by styled-components and remove the manual ones from DSPillV2,\n * but this would require a refactor in ds-pills-v2 to have a slot definition per variant.\n *\n *\n * Related: packages/agregators/ds-system/src/styled/generated-attributes/generateAttributes.ts\n */\n const className = React.useMemo(() => {\n if (type === 'removable') return 'ds-pill-wrapper ds-pill-wrapper-removable';\n if (type === 'labelOnly') return 'ds-pill-wrapper ds-pill-wrapper-label';\n return 'ds-pill-wrapper ds-pill-wrapper-value';\n }, [type]);\n\n return (\n <StyledDSPillV2\n size=\"s\"\n key={pill.value}\n label={pill.label}\n disabled={disabled || pill.disabled}\n type={type}\n className={className}\n applyAriaDisabled={applyAriaDisabledToContainer || pill.applyAriaDisabled}\n readOnly={readOnly}\n trailingComma={trailingComma}\n tabIndex={-1}\n onRemove={(e: React.KeyboardEvent | React.MouseEvent) => {\n if (readOnly) return;\n // preventing the menu to be opened\n e.stopPropagation();\n onChange(getSuggestedValueOnChange(pill, selectedValues), pill, e);\n internalRef.current?.focus();\n }}\n {...ownerProps}\n />\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD+DnB;AA/DJ,mBAAkC;AAClC,yBAA4B;AAE5B,wBAA0C;AAC1C,oBAA+B;AAExB,MAAM,6BAQR,CAAC,UAAU;AACd,QAAM,EAAE,MAAM,eAAe,WAAW,IAAI;AAC5C,QAAM;AAAA,IACJ,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,mBAAmB;AAAA,MACnB;AAAA,IACF;AAAA,IACA;AAAA,EACF,QAAI,yBAAW,mBAAAA,OAAe;AAE9B,QAAM,OAAO,aAAAC,QAAM,QAAQ,MAAM;AAC/B,QAAI,YAAY,eAAgB,QAAO;AACvC,QAAI,gCAAgC,SAAU,QAAO;AACrD,WAAO;AAAA,EACT,GAAG,CAAC,UAAU,gBAAgB,8BAA8B,QAAQ,CAAC;AAwBrE,QAAM,YAAY,aAAAA,QAAM,QAAQ,MAAM;AACpC,QAAI,SAAS,YAAa,QAAO;AACjC,QAAI,SAAS,YAAa,QAAO;AACjC,WAAO;AAAA,EACT,GAAG,CAAC,IAAI,CAAC;AAET,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAK;AAAA,MAEL,OAAO,KAAK;AAAA,MACZ,UAAU,YAAY,KAAK;AAAA,MAC3B;AAAA,MACA;AAAA,MACA,mBAAmB,gCAAgC,KAAK;AAAA,MACxD;AAAA,MACA;AAAA,MACA,UAAU;AAAA,MACV,UAAU,CAAC,MAA8C;AACvD,YAAI,SAAU;AAEd,UAAE,gBAAgB;AAClB,qBAAS,6CAA0B,MAAM,cAAc,GAAG,MAAM,CAAC;AACjE,oBAAY,SAAS,MAAM;AAAA,MAC7B;AAAA,MACC,GAAG;AAAA;AAAA,IAhBC,KAAK;AAAA,EAiBZ;AAEJ;",
|
|
6
6
|
"names": ["ComboBoxContext", "React"]
|
|
7
7
|
}
|
|
@@ -51,7 +51,7 @@ const useGroupPills = () => {
|
|
|
51
51
|
const selectedValuesLength = Math.min(30, multiSelectedValues.length);
|
|
52
52
|
const [pillsToShow, setPillsToShow] = (0, import_react.useState)(selectedValuesLength);
|
|
53
53
|
const { width } = (0, import_useOnElementResize.useOnElementResize)(controlsWrapperRef);
|
|
54
|
-
const { width: widthInput } = (0, import_useOnElementResize.useOnElementResize)(innerRef
|
|
54
|
+
const { width: widthInput } = (0, import_useOnElementResize.useOnElementResize)(innerRef);
|
|
55
55
|
(0, import_react.useEffect)(() => {
|
|
56
56
|
if (selectedValuesLength !== pillsToShow) {
|
|
57
57
|
setPillsToShow(selectedValuesLength);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/multi-selected-values-container/useGroupPills.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable complexity */\nimport { useContext, useEffect, useState, useLayoutEffect } from 'react';\nimport { useOnElementResize } from '../../utils/useOnElementResize.js';\nimport { ComboBoxContext } from '../../ComboBoxCTX.js';\nimport type { DSComboboxT } from '../../react-desc-prop-types.js';\n\nconst getGroupedPillWidth = (remainingPills: number): number => {\n if (remainingPills === 0) return 0;\n const digits = remainingPills.toString().length;\n return 8 * (digits - 1) + 31;\n};\nconst useGroupPills = (): number => {\n const {\n props: { selectedValues, isNonClearable, disabled, innerRef, applyAriaDisabled: applyAriaDisabledToContainer },\n selectedOptionsRef,\n controlsWrapperRef,\n pillGroupRef,\n } = useContext(ComboBoxContext);\n\n const multiSelectedValues = selectedValues as DSComboboxT.ItemOption[];\n\n // 30 represent 30 pills maximum to calculate the grouped pill. this fix the load time issue\n // when combobox is receiving a huge amount of options.\n const selectedValuesLength = Math.min(30, multiSelectedValues.length);\n\n const [pillsToShow, setPillsToShow] = useState(selectedValuesLength);\n const { width } = useOnElementResize(controlsWrapperRef);\n const { width: widthInput } = useOnElementResize(innerRef
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,mBAAiE;AACjE,gCAAmC;AACnC,yBAAgC;AAGhC,MAAM,sBAAsB,CAAC,mBAAmC;AAC9D,MAAI,mBAAmB,EAAG,QAAO;AACjC,QAAM,SAAS,eAAe,SAAS,EAAE;AACzC,SAAO,KAAK,SAAS,KAAK;AAC5B;AACA,MAAM,gBAAgB,MAAc;AAClC,QAAM;AAAA,IACJ,OAAO,EAAE,gBAAgB,gBAAgB,UAAU,UAAU,mBAAmB,6BAA6B;AAAA,IAC7G;AAAA,IACA;AAAA,IACA;AAAA,EACF,QAAI,yBAAW,kCAAe;AAE9B,QAAM,sBAAsB;AAI5B,QAAM,uBAAuB,KAAK,IAAI,IAAI,oBAAoB,MAAM;AAEpE,QAAM,CAAC,aAAa,cAAc,QAAI,uBAAS,oBAAoB;AACnE,QAAM,EAAE,MAAM,QAAI,8CAAmB,kBAAkB;AACvD,QAAM,EAAE,OAAO,WAAW,QAAI,8CAAmB,
|
|
4
|
+
"sourcesContent": ["/* eslint-disable complexity */\nimport { useContext, useEffect, useState, useLayoutEffect } from 'react';\nimport { useOnElementResize } from '../../utils/useOnElementResize.js';\nimport { ComboBoxContext } from '../../ComboBoxCTX.js';\nimport type { DSComboboxT } from '../../react-desc-prop-types.js';\n\nconst getGroupedPillWidth = (remainingPills: number): number => {\n if (remainingPills === 0) return 0;\n const digits = remainingPills.toString().length;\n return 8 * (digits - 1) + 31;\n};\nconst useGroupPills = (): number => {\n const {\n props: { selectedValues, isNonClearable, disabled, innerRef, applyAriaDisabled: applyAriaDisabledToContainer },\n selectedOptionsRef,\n controlsWrapperRef,\n pillGroupRef,\n } = useContext(ComboBoxContext);\n\n const multiSelectedValues = selectedValues as DSComboboxT.ItemOption[];\n\n // 30 represent 30 pills maximum to calculate the grouped pill. this fix the load time issue\n // when combobox is receiving a huge amount of options.\n const selectedValuesLength = Math.min(30, multiSelectedValues.length);\n\n const [pillsToShow, setPillsToShow] = useState(selectedValuesLength);\n const { width } = useOnElementResize(controlsWrapperRef);\n const { width: widthInput } = useOnElementResize(innerRef as React.RefObject<HTMLInputElement>);\n useEffect(() => {\n if (selectedValuesLength !== pillsToShow) {\n setPillsToShow(selectedValuesLength);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [selectedValuesLength, width, widthInput]);\n\n useLayoutEffect(() => {\n if (selectedOptionsRef.current && pillGroupRef.current) {\n if (pillGroupRef.current) pillGroupRef.current.style.width = 'max-content';\n let lastPillFit = -1;\n let currentWidth = 0;\n const referenceWidth = selectedOptionsRef.current.offsetWidth;\n const pills: HTMLDivElement[] = [\n ...pillGroupRef.current.querySelectorAll(\n disabled || applyAriaDisabledToContainer || isNonClearable\n ? '.ds-pill-wrapper-value'\n : '.ds-pill-wrapper-removable, .ds-pill-wrapper-label',\n ),\n ] as HTMLDivElement[];\n const pillsWidth = pills.map((pill) => pill?.offsetWidth);\n pillsWidth.forEach((pillWidth, idx) => {\n currentWidth += pillWidth;\n if (currentWidth + getGroupedPillWidth(selectedValuesLength - idx - 1) <= referenceWidth) {\n lastPillFit = idx;\n }\n });\n\n if (!(selectedValuesLength > 0 && pillsToShow !== selectedValuesLength)) {\n const nextPillsToShow = lastPillFit + 1;\n\n if (nextPillsToShow !== pillsToShow) {\n setPillsToShow(nextPillsToShow);\n }\n }\n\n if (pillGroupRef.current) pillGroupRef.current.style.width = 'fit-content';\n }\n }, [\n selectedOptionsRef,\n innerRef,\n multiSelectedValues,\n pillsToShow,\n pillGroupRef,\n width,\n widthInput,\n disabled,\n applyAriaDisabledToContainer,\n selectedValuesLength,\n isNonClearable,\n ]);\n\n return pillsToShow || 1;\n};\n\nexport { useGroupPills };\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,mBAAiE;AACjE,gCAAmC;AACnC,yBAAgC;AAGhC,MAAM,sBAAsB,CAAC,mBAAmC;AAC9D,MAAI,mBAAmB,EAAG,QAAO;AACjC,QAAM,SAAS,eAAe,SAAS,EAAE;AACzC,SAAO,KAAK,SAAS,KAAK;AAC5B;AACA,MAAM,gBAAgB,MAAc;AAClC,QAAM;AAAA,IACJ,OAAO,EAAE,gBAAgB,gBAAgB,UAAU,UAAU,mBAAmB,6BAA6B;AAAA,IAC7G;AAAA,IACA;AAAA,IACA;AAAA,EACF,QAAI,yBAAW,kCAAe;AAE9B,QAAM,sBAAsB;AAI5B,QAAM,uBAAuB,KAAK,IAAI,IAAI,oBAAoB,MAAM;AAEpE,QAAM,CAAC,aAAa,cAAc,QAAI,uBAAS,oBAAoB;AACnE,QAAM,EAAE,MAAM,QAAI,8CAAmB,kBAAkB;AACvD,QAAM,EAAE,OAAO,WAAW,QAAI,8CAAmB,QAA6C;AAC9F,8BAAU,MAAM;AACd,QAAI,yBAAyB,aAAa;AACxC,qBAAe,oBAAoB;AAAA,IACrC;AAAA,EAEF,GAAG,CAAC,sBAAsB,OAAO,UAAU,CAAC;AAE5C,oCAAgB,MAAM;AACpB,QAAI,mBAAmB,WAAW,aAAa,SAAS;AACtD,UAAI,aAAa,QAAS,cAAa,QAAQ,MAAM,QAAQ;AAC7D,UAAI,cAAc;AAClB,UAAI,eAAe;AACnB,YAAM,iBAAiB,mBAAmB,QAAQ;AAClD,YAAM,QAA0B;AAAA,QAC9B,GAAG,aAAa,QAAQ;AAAA,UACtB,YAAY,gCAAgC,iBACxC,2BACA;AAAA,QACN;AAAA,MACF;AACA,YAAM,aAAa,MAAM,IAAI,CAAC,SAAS,MAAM,WAAW;AACxD,iBAAW,QAAQ,CAAC,WAAW,QAAQ;AACrC,wBAAgB;AAChB,YAAI,eAAe,oBAAoB,uBAAuB,MAAM,CAAC,KAAK,gBAAgB;AACxF,wBAAc;AAAA,QAChB;AAAA,MACF,CAAC;AAED,UAAI,EAAE,uBAAuB,KAAK,gBAAgB,uBAAuB;AACvE,cAAM,kBAAkB,cAAc;AAEtC,YAAI,oBAAoB,aAAa;AACnC,yBAAe,eAAe;AAAA,QAChC;AAAA,MACF;AAEA,UAAI,aAAa,QAAS,cAAa,QAAQ,MAAM,QAAQ;AAAA,IAC/D;AAAA,EACF,GAAG;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAED,SAAO,eAAe;AACxB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/parts/styled.js
CHANGED
|
@@ -28,11 +28,14 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
var styled_exports = {};
|
|
30
30
|
__export(styled_exports, {
|
|
31
|
-
StyledA11yNotVisible: () => StyledA11yNotVisible
|
|
31
|
+
StyledA11yNotVisible: () => StyledA11yNotVisible,
|
|
32
|
+
StyledDSPillV2: () => StyledDSPillV2
|
|
32
33
|
});
|
|
33
34
|
module.exports = __toCommonJS(styled_exports);
|
|
34
35
|
var React = __toESM(require("react"));
|
|
36
|
+
var import_ds_pills_v2 = require("@elliemae/ds-pills-v2");
|
|
35
37
|
var import_ds_system = require("@elliemae/ds-system");
|
|
38
|
+
var import_constants = require("../constants/index.js");
|
|
36
39
|
const StyledA11yNotVisible = import_ds_system.styled.span`
|
|
37
40
|
position: absolute;
|
|
38
41
|
width: 1px;
|
|
@@ -45,4 +48,17 @@ const StyledA11yNotVisible = import_ds_system.styled.span`
|
|
|
45
48
|
clip-path: inset(100%);
|
|
46
49
|
white-space: nowrap;
|
|
47
50
|
`;
|
|
51
|
+
const StyledDSPillV2 = (0, import_ds_system.styled)(import_ds_pills_v2.DSPillV2, {
|
|
52
|
+
name: import_constants.DSFormComboboxName,
|
|
53
|
+
slot: import_constants.FORM_COMBOBOX_SLOTS.PILL,
|
|
54
|
+
preserveLegacyDataTestId: true
|
|
55
|
+
})`
|
|
56
|
+
background-color: ${({ theme, disabled, applyAriaDisabled, readOnly }) => {
|
|
57
|
+
if (disabled) return theme.colors.neutral["080"];
|
|
58
|
+
if (applyAriaDisabled || readOnly) return theme.colors.neutral["050"];
|
|
59
|
+
return theme.colors.brand[250];
|
|
60
|
+
}};
|
|
61
|
+
|
|
62
|
+
color: ${({ theme, disabled, applyAriaDisabled, readOnly }) => disabled || applyAriaDisabled || readOnly ? "#616b7f" : theme.colors.brand["800"]};
|
|
63
|
+
`;
|
|
48
64
|
//# sourceMappingURL=styled.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/parts/styled.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { styled } from '@elliemae/ds-system';\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAAuB;
|
|
4
|
+
"sourcesContent": ["import { DSPillV2 } from '@elliemae/ds-pills-v2';\nimport { styled } from '@elliemae/ds-system';\nimport { DSFormComboboxName, FORM_COMBOBOX_SLOTS } from '../constants/index.js';\nexport const StyledA11yNotVisible = styled.span`\n position: absolute;\n width: 1px;\n height: 1px;\n margin: -1px;\n border: 0;\n padding: 0;\n overflow: hidden;\n clip: rect(0 0 0 0);\n clip-path: inset(100%);\n white-space: nowrap;\n`;\n\n/**\n * Combobox-specific pill styling with stateful behavior\n *\n * DSPillV2 is stateless by design, but Combobox requires pills to visually\n * reflect container state (disabled/aria-disabled/readOnly). This wrapper\n * applies context-aware colors based on Combobox's interaction state.\n *\n * These styles were previously part of the Pills component but have been\n * moved here as Pills were refactored to be stateless. Combobox maintains\n * this stateful behavior as a specific use case requirement.\n */\nexport const StyledDSPillV2 = styled(DSPillV2, {\n name: DSFormComboboxName,\n slot: FORM_COMBOBOX_SLOTS.PILL,\n preserveLegacyDataTestId: true,\n})`\n background-color: ${({ theme, disabled, applyAriaDisabled, readOnly }) => {\n if (disabled) return theme.colors.neutral['080'];\n if (applyAriaDisabled || readOnly) return theme.colors.neutral['050'];\n return theme.colors.brand[250];\n }};\n\n color: ${({ theme, disabled, applyAriaDisabled, readOnly }) =>\n disabled || applyAriaDisabled || readOnly ? '#616b7f' : theme.colors.brand['800']};\n`;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,yBAAyB;AACzB,uBAAuB;AACvB,uBAAwD;AACjD,MAAM,uBAAuB,wBAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAwBpC,MAAM,qBAAiB,yBAAO,6BAAU;AAAA,EAC7C,MAAM;AAAA,EACN,MAAM,qCAAoB;AAAA,EAC1B,0BAA0B;AAC5B,CAAC;AAAA,sBACqB,CAAC,EAAE,OAAO,UAAU,mBAAmB,SAAS,MAAM;AACxE,MAAI,SAAU,QAAO,MAAM,OAAO,QAAQ,KAAK;AAC/C,MAAI,qBAAqB,SAAU,QAAO,MAAM,OAAO,QAAQ,KAAK;AACpE,SAAO,MAAM,OAAO,MAAM,GAAG;AAC/B,CAAC;AAAA;AAAA,WAEQ,CAAC,EAAE,OAAO,UAAU,mBAAmB,SAAS,MACvD,YAAY,qBAAqB,WAAW,YAAY,MAAM,OAAO,MAAM,KAAK,CAAC;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/sharedTypes.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import type React from 'react';\nimport type { DSFastListT } from '@elliemae/ds-fast-list';\n\nimport type { DSComboboxT } from './react-desc-prop-types.js';\nimport { MENU_OPTION_TYPES } from './constants.js';\n\nexport declare namespace DSComboboxInternalsT {\n export interface ComboBoxContextT {\n props: DSComboboxT.InternalProps;\n internalRef: React.RefObject<HTMLInputElement>;\n menuState: boolean;\n setShowPopover: React.Dispatch<React.SetStateAction<boolean>>;\n pillGroupRef: React.RefObject<HTMLDivElement>;\n scrollOptionIntoView: (dsId: string, opts
|
|
4
|
+
"sourcesContent": ["import type React from 'react';\nimport type { DSFastListT } from '@elliemae/ds-fast-list';\n\nimport type { DSComboboxT } from './react-desc-prop-types.js';\nimport { MENU_OPTION_TYPES } from './constants.js';\n\nexport declare namespace DSComboboxInternalsT {\n export interface ComboBoxContextT {\n props: DSComboboxT.InternalProps;\n internalRef: React.RefObject<HTMLInputElement>;\n menuState: boolean;\n setShowPopover: React.Dispatch<React.SetStateAction<boolean>>;\n pillGroupRef: React.RefObject<HTMLDivElement>;\n scrollOptionIntoView: (dsId: string, opts?: DSFastListT.ScrollToOptions) => void;\n setHasFocus: React.Dispatch<React.SetStateAction<boolean>>;\n hasFocus: boolean;\n listRef: React.MutableRefObject<DSComboboxT.ActionRefVirtualized>;\n wrapperListRef: React.RefObject<HTMLDivElement>;\n inputValue: string;\n setInputValue: React.Dispatch<React.SetStateAction<string>>;\n selectedOptionsRef: React.RefObject<HTMLDivElement>;\n controlsWrapperRef: React.RefObject<HTMLDivElement>;\n focusOptionIdx: string;\n setFocusOptionIdx: React.Dispatch<React.SetStateAction<string>>;\n setMenuState: (\n newState: boolean,\n reason: string,\n e?: React.KeyboardEvent | React.MouseEvent | React.ChangeEvent<HTMLInputElement>,\n ) => void;\n correctOptions: DSComboboxT.OptionTypes[];\n instanceUid: string;\n optionsPerSection: DSComboboxT.OptionTypes[];\n shouldPreventContextMenuOpening: boolean;\n }\n}\n\nexport const isSeparator = (el: DSComboboxT.OptionTypes | undefined): el is DSComboboxT.ItemSeparatorOptions =>\n el?.type === MENU_OPTION_TYPES.SEPARATOR;\n\nexport const isOption = (el: DSComboboxT.OptionTypes | undefined): el is DSComboboxT.ItemOption =>\n el?.type === MENU_OPTION_TYPES.OPTION;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADIvB,uBAAkC;AAgC3B,MAAM,cAAc,CAAC,OAC1B,IAAI,SAAS,mCAAkB;AAE1B,MAAM,WAAW,CAAC,OACvB,IAAI,SAAS,mCAAkB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -13,7 +13,8 @@ const FORM_COMBOBOX_SLOTS = {
|
|
|
13
13
|
SINGLE_MENU_ITEM: "single-menu-item",
|
|
14
14
|
MULTI_MENU_ITEM: "multi-menu-item",
|
|
15
15
|
LOADING_INDICATOR: "loading-indicator",
|
|
16
|
-
SKELETON_MENU_ITEM: "skeleton-menu-item"
|
|
16
|
+
SKELETON_MENU_ITEM: "skeleton-menu-item",
|
|
17
|
+
PILL: "pill"
|
|
17
18
|
};
|
|
18
19
|
const FORM_COMBOBOX_DATA_TESTID = {
|
|
19
20
|
...slotObjectToDataTestIds(DSFormComboboxName, FORM_COMBOBOX_SLOTS),
|
|
@@ -26,7 +27,8 @@ const FORM_COMBOBOX_DATA_TESTID = {
|
|
|
26
27
|
SELECTED_VALUES: "combobox-selected-values",
|
|
27
28
|
DROPDOWN: "combobox-dropdown-btn",
|
|
28
29
|
OPTION: "combobox-option",
|
|
29
|
-
ALLY_SELECTED_VALUES: "combobox-ally-selected-values"
|
|
30
|
+
ALLY_SELECTED_VALUES: "combobox-ally-selected-values",
|
|
31
|
+
PILL: "ds-pill-wrapper"
|
|
30
32
|
};
|
|
31
33
|
export {
|
|
32
34
|
DSFormComboboxName,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/constants/index.ts"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { slotObjectToDataTestIds } from '@elliemae/ds-system';\n\nexport const DSFormComboboxName = 'DSCombobox';\n\n// we are naming this with the ${component_name}_slots convention to namespace & avoid errors on duplicate exports variables in aggregators\nexport const FORM_COMBOBOX_SLOTS = {\n // Same as old container\n ROOT: 'root',\n INPUT_WRAPPER: 'input-wrapper',\n INPUT: 'input',\n DROPDOWN_BUTTON: 'dropdown-button',\n FAST_LIST: 'fast-list',\n SECTION_WRAPPER: 'section-wrapper',\n SECTION_LABEL: 'section-label',\n SINGLE_MENU_ITEM: 'single-menu-item',\n MULTI_MENU_ITEM: 'multi-menu-item',\n LOADING_INDICATOR: 'loading-indicator',\n SKELETON_MENU_ITEM: 'skeleton-menu-item',\n} as const;\n\n// we are naming this with the ${component_name}_data_testid convention to namespace & avoid errors on duplicate exports variables in aggregators\nexport const FORM_COMBOBOX_DATA_TESTID = {\n ...slotObjectToDataTestIds(DSFormComboboxName, FORM_COMBOBOX_SLOTS),\n // legacy data-testid\n CONTROLS_WRAPPER: 'combobox-controls-wrapper',\n CONTAINER: 'combobox-container',\n INPUT: 'combobox-input',\n LIST: 'combobox-menu-list',\n NO_MATCHES_FOUND: 'combobox-no-matches-found',\n SELECTED_VALUES: 'combobox-selected-values',\n DROPDOWN: 'combobox-dropdown-btn',\n OPTION: 'combobox-option',\n ALLY_SELECTED_VALUES: 'combobox-ally-selected-values',\n};\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,+BAA+B;AAEjC,MAAM,qBAAqB;AAG3B,MAAM,sBAAsB;AAAA;AAAA,EAEjC,MAAM;AAAA,EACN,eAAe;AAAA,EACf,OAAO;AAAA,EACP,iBAAiB;AAAA,EACjB,WAAW;AAAA,EACX,iBAAiB;AAAA,EACjB,eAAe;AAAA,EACf,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,mBAAmB;AAAA,EACnB,oBAAoB;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { slotObjectToDataTestIds } from '@elliemae/ds-system';\n\nexport const DSFormComboboxName = 'DSCombobox';\n\n// we are naming this with the ${component_name}_slots convention to namespace & avoid errors on duplicate exports variables in aggregators\nexport const FORM_COMBOBOX_SLOTS = {\n // Same as old container\n ROOT: 'root',\n INPUT_WRAPPER: 'input-wrapper',\n INPUT: 'input',\n DROPDOWN_BUTTON: 'dropdown-button',\n FAST_LIST: 'fast-list',\n SECTION_WRAPPER: 'section-wrapper',\n SECTION_LABEL: 'section-label',\n SINGLE_MENU_ITEM: 'single-menu-item',\n MULTI_MENU_ITEM: 'multi-menu-item',\n LOADING_INDICATOR: 'loading-indicator',\n SKELETON_MENU_ITEM: 'skeleton-menu-item',\n PILL: 'pill',\n} as const;\n\n// we are naming this with the ${component_name}_data_testid convention to namespace & avoid errors on duplicate exports variables in aggregators\nexport const FORM_COMBOBOX_DATA_TESTID = {\n ...slotObjectToDataTestIds(DSFormComboboxName, FORM_COMBOBOX_SLOTS),\n // legacy data-testid\n CONTROLS_WRAPPER: 'combobox-controls-wrapper',\n CONTAINER: 'combobox-container',\n INPUT: 'combobox-input',\n LIST: 'combobox-menu-list',\n NO_MATCHES_FOUND: 'combobox-no-matches-found',\n SELECTED_VALUES: 'combobox-selected-values',\n DROPDOWN: 'combobox-dropdown-btn',\n OPTION: 'combobox-option',\n ALLY_SELECTED_VALUES: 'combobox-ally-selected-values',\n PILL: 'ds-pill-wrapper',\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,+BAA+B;AAEjC,MAAM,qBAAqB;AAG3B,MAAM,sBAAsB;AAAA;AAAA,EAEjC,MAAM;AAAA,EACN,eAAe;AAAA,EACf,OAAO;AAAA,EACP,iBAAiB;AAAA,EACjB,WAAW;AAAA,EACX,iBAAiB;AAAA,EACjB,eAAe;AAAA,EACf,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,mBAAmB;AAAA,EACnB,oBAAoB;AAAA,EACpB,MAAM;AACR;AAGO,MAAM,4BAA4B;AAAA,EACvC,GAAG,wBAAwB,oBAAoB,mBAAmB;AAAA;AAAA,EAElE,kBAAkB;AAAA,EAClB,WAAW;AAAA,EACX,OAAO;AAAA,EACP,MAAM;AAAA,EACN,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,sBAAsB;AAAA,EACtB,MAAM;AACR;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -21,47 +21,21 @@ const StyledItemsWrapper = styled(Grid)`
|
|
|
21
21
|
max-height: ${({ maxHeight }) => maxHeight ? `${String(maxHeight)}px` : "300px"};
|
|
22
22
|
`;
|
|
23
23
|
const estimatedSize = () => 32;
|
|
24
|
-
const
|
|
24
|
+
const ContentComp = () => {
|
|
25
25
|
const {
|
|
26
26
|
props,
|
|
27
|
-
props: { isLoading,
|
|
28
|
-
controlsWrapperRef,
|
|
27
|
+
props: { isLoading, noOptionsMessage, menuMaxHeight, onCreate, isSkeleton, selectedValues },
|
|
29
28
|
listRef,
|
|
30
|
-
wrapperListRef,
|
|
31
29
|
correctOptions: filteredOptions,
|
|
32
30
|
instanceUid
|
|
33
31
|
} = useContext(ComboBoxContext);
|
|
34
32
|
const { getOwnerProps } = useOwnerProps(props);
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
content = /* @__PURE__ */ jsx(SkeletonContainer, { instanceUid, getOwnerProps });
|
|
42
|
-
} else if (isLoading) {
|
|
43
|
-
content = /* @__PURE__ */ jsx(LoadingContainer, { getOwnerProps });
|
|
44
|
-
} else if ((filteredOptions?.length ?? 0) > 0 || onCreate) {
|
|
45
|
-
content = /* @__PURE__ */ jsx(StyledItemsWrapper, { maxHeight: menuMaxHeight, id: `combo-listbox-${instanceUid}`, children: /* @__PURE__ */ jsx(
|
|
46
|
-
StyledFastList,
|
|
47
|
-
{
|
|
48
|
-
dsFastlistWrapperList: {
|
|
49
|
-
role: "listbox",
|
|
50
|
-
"data-testid": ComboboxDataTestid.LIST,
|
|
51
|
-
"aria-label": "listbox"
|
|
52
|
-
},
|
|
53
|
-
dsFastlistItem: { role: "none" },
|
|
54
|
-
actionRef: listRef,
|
|
55
|
-
count: filteredOptions.length,
|
|
56
|
-
ItemRenderer,
|
|
57
|
-
extraItemProps: { itemList: filteredOptions },
|
|
58
|
-
getId: (index) => filteredOptions[index].dsId,
|
|
59
|
-
estimateSize: estimatedSize,
|
|
60
|
-
getOwnerProps
|
|
61
|
-
}
|
|
62
|
-
) });
|
|
63
|
-
} else {
|
|
64
|
-
content = /* @__PURE__ */ jsx(
|
|
33
|
+
const isMulti = Array.isArray(selectedValues);
|
|
34
|
+
if (isSkeleton) return /* @__PURE__ */ jsx(SkeletonContainer, { instanceUid, getOwnerProps });
|
|
35
|
+
if (isLoading) return /* @__PURE__ */ jsx(LoadingContainer, { getOwnerProps });
|
|
36
|
+
const shouldShowNoResults = !onCreate && (filteredOptions?.length ?? 0) === 0;
|
|
37
|
+
if (shouldShowNoResults)
|
|
38
|
+
return /* @__PURE__ */ jsx(
|
|
65
39
|
StyledNoResultsWrapper,
|
|
66
40
|
{
|
|
67
41
|
id: `combo-listbox-${instanceUid}`,
|
|
@@ -70,7 +44,36 @@ const MenuList = () => {
|
|
|
70
44
|
children: noOptionsMessage
|
|
71
45
|
}
|
|
72
46
|
);
|
|
73
|
-
}
|
|
47
|
+
return /* @__PURE__ */ jsx(StyledItemsWrapper, { maxHeight: menuMaxHeight, id: `combo-listbox-${instanceUid}`, children: /* @__PURE__ */ jsx(
|
|
48
|
+
StyledFastList,
|
|
49
|
+
{
|
|
50
|
+
dsFastlistWrapperList: {
|
|
51
|
+
role: "listbox",
|
|
52
|
+
"aria-multiselectable": isMulti,
|
|
53
|
+
"data-testid": ComboboxDataTestid.LIST,
|
|
54
|
+
"aria-label": "listbox"
|
|
55
|
+
},
|
|
56
|
+
dsFastlistItem: { role: "none" },
|
|
57
|
+
actionRef: listRef,
|
|
58
|
+
count: filteredOptions.length,
|
|
59
|
+
ItemRenderer,
|
|
60
|
+
extraItemProps: { itemList: filteredOptions },
|
|
61
|
+
getId: (index) => filteredOptions[index].dsId,
|
|
62
|
+
estimateSize: estimatedSize,
|
|
63
|
+
getOwnerProps
|
|
64
|
+
}
|
|
65
|
+
) });
|
|
66
|
+
};
|
|
67
|
+
const MenuList = () => {
|
|
68
|
+
const {
|
|
69
|
+
props: { menuMinWidth, inline },
|
|
70
|
+
controlsWrapperRef,
|
|
71
|
+
wrapperListRef
|
|
72
|
+
} = useContext(ComboBoxContext);
|
|
73
|
+
const { width } = useOnElementResize(controlsWrapperRef);
|
|
74
|
+
const preventLoseInputFocus = useCallback((e) => {
|
|
75
|
+
e.preventDefault();
|
|
76
|
+
}, []);
|
|
74
77
|
return /* @__PURE__ */ jsx(
|
|
75
78
|
StyledListWrapper,
|
|
76
79
|
{
|
|
@@ -79,7 +82,7 @@ const MenuList = () => {
|
|
|
79
82
|
onMouseDown: preventLoseInputFocus,
|
|
80
83
|
width,
|
|
81
84
|
minWidth: menuMinWidth,
|
|
82
|
-
children:
|
|
85
|
+
children: /* @__PURE__ */ jsx(ContentComp, {})
|
|
83
86
|
}
|
|
84
87
|
);
|
|
85
88
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/menu-list/MenuList.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext, useCallback } from 'react';\nimport { DSFastList } from '@elliemae/ds-fast-list';\nimport { type SizingProps, styled } from '@elliemae/ds-system';\nimport { Grid } from '@elliemae/ds-grid';\nimport { useOwnerProps } from '@elliemae/ds-props-helpers';\nimport { StyledListWrapper, StyledNoResultsWrapper } from './styled.js';\nimport { ComboboxDataTestid } from '../../ComboboxDataTestids.js';\nimport { ComboBoxContext } from '../../ComboBoxCTX.js';\nimport { ItemRenderer } from './useItemRenderer.js';\nimport { LoadingContainer } from './LoadingContainer.js';\nimport { SkeletonContainer } from './SkeletonContainer.js';\nimport { useOnElementResize } from '../../utils/useOnElementResize.js';\nimport { DSFormComboboxName, FORM_COMBOBOX_SLOTS } from '../../constants/index.js';\n\nconst StyledFastList = styled(DSFastList, {\n name: DSFormComboboxName,\n slot: FORM_COMBOBOX_SLOTS.FAST_LIST,\n})``;\n\nconst StyledItemsWrapper = styled(Grid)<{\n maxHeight: SizingProps['maxHeight'];\n}>`\n max-height: ${({ maxHeight }) => (maxHeight ? `${String(maxHeight)}px` : '300px')};\n`;\n\nconst estimatedSize = () => 32;\n\
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext, useCallback } from 'react';\nimport { DSFastList } from '@elliemae/ds-fast-list';\nimport { type SizingProps, styled } from '@elliemae/ds-system';\nimport { Grid } from '@elliemae/ds-grid';\nimport { useOwnerProps } from '@elliemae/ds-props-helpers';\nimport { StyledListWrapper, StyledNoResultsWrapper } from './styled.js';\nimport { ComboboxDataTestid } from '../../ComboboxDataTestids.js';\nimport { ComboBoxContext } from '../../ComboBoxCTX.js';\nimport { ItemRenderer } from './useItemRenderer.js';\nimport { LoadingContainer } from './LoadingContainer.js';\nimport { SkeletonContainer } from './SkeletonContainer.js';\nimport { useOnElementResize } from '../../utils/useOnElementResize.js';\nimport { DSFormComboboxName, FORM_COMBOBOX_SLOTS } from '../../constants/index.js';\n\nconst StyledFastList = styled(DSFastList, {\n name: DSFormComboboxName,\n slot: FORM_COMBOBOX_SLOTS.FAST_LIST,\n})``;\n\nconst StyledItemsWrapper = styled(Grid)<{\n maxHeight: SizingProps['maxHeight'];\n}>`\n max-height: ${({ maxHeight }) => (maxHeight ? `${String(maxHeight)}px` : '300px')};\n`;\n\nconst estimatedSize = () => 32;\n\nconst ContentComp = () => {\n const {\n props,\n props: { isLoading, noOptionsMessage, menuMaxHeight, onCreate, isSkeleton, selectedValues },\n listRef,\n correctOptions: filteredOptions,\n instanceUid,\n } = useContext(ComboBoxContext);\n\n const { getOwnerProps } = useOwnerProps(props);\n const isMulti = Array.isArray(selectedValues);\n\n if (isSkeleton) return <SkeletonContainer instanceUid={instanceUid} getOwnerProps={getOwnerProps} />;\n if (isLoading) return <LoadingContainer getOwnerProps={getOwnerProps} />;\n\n const shouldShowNoResults = !onCreate && (filteredOptions?.length ?? 0) === 0;\n if (shouldShowNoResults)\n return (\n <StyledNoResultsWrapper\n id={`combo-listbox-${instanceUid}`}\n data-testid={ComboboxDataTestid.NO_MATCHES_FOUND}\n role=\"alert\"\n >\n {noOptionsMessage}\n </StyledNoResultsWrapper>\n );\n\n return (\n <StyledItemsWrapper maxHeight={menuMaxHeight} id={`combo-listbox-${instanceUid}`}>\n <StyledFastList\n dsFastlistWrapperList={{\n role: 'listbox',\n 'aria-multiselectable': isMulti,\n 'data-testid': ComboboxDataTestid.LIST,\n 'aria-label': 'listbox',\n }}\n dsFastlistItem={{ role: 'none' }}\n actionRef={listRef}\n count={filteredOptions.length}\n ItemRenderer={ItemRenderer}\n extraItemProps={{ itemList: filteredOptions }}\n getId={(index: number) => filteredOptions[index].dsId}\n estimateSize={estimatedSize}\n getOwnerProps={getOwnerProps}\n />\n </StyledItemsWrapper>\n );\n};\n\nexport const MenuList = (): JSX.Element => {\n const {\n props: { menuMinWidth, inline },\n controlsWrapperRef,\n wrapperListRef,\n } = useContext(ComboBoxContext);\n\n const { width } = useOnElementResize(controlsWrapperRef);\n\n const preventLoseInputFocus: React.MouseEventHandler = useCallback((e) => {\n e.preventDefault();\n }, []);\n\n return (\n <StyledListWrapper\n innerRef={wrapperListRef}\n inline={inline}\n onMouseDown={preventLoseInputFocus}\n width={width}\n minWidth={menuMinWidth}\n >\n <ContentComp />\n </StyledListWrapper>\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACuCE;AAvCzB,SAAgB,YAAY,mBAAmB;AAC/C,SAAS,kBAAkB;AAC3B,SAA2B,cAAc;AACzC,SAAS,YAAY;AACrB,SAAS,qBAAqB;AAC9B,SAAS,mBAAmB,8BAA8B;AAC1D,SAAS,0BAA0B;AACnC,SAAS,uBAAuB;AAChC,SAAS,oBAAoB;AAC7B,SAAS,wBAAwB;AACjC,SAAS,yBAAyB;AAClC,SAAS,0BAA0B;AACnC,SAAS,oBAAoB,2BAA2B;AAExD,MAAM,iBAAiB,OAAO,YAAY;AAAA,EACxC,MAAM;AAAA,EACN,MAAM,oBAAoB;AAC5B,CAAC;AAED,MAAM,qBAAqB,OAAO,IAAI;AAAA,gBAGtB,CAAC,EAAE,UAAU,MAAO,YAAY,GAAG,OAAO,SAAS,CAAC,OAAO,OAAQ;AAAA;AAGnF,MAAM,gBAAgB,MAAM;AAE5B,MAAM,cAAc,MAAM;AACxB,QAAM;AAAA,IACJ;AAAA,IACA,OAAO,EAAE,WAAW,kBAAkB,eAAe,UAAU,YAAY,eAAe;AAAA,IAC1F;AAAA,IACA,gBAAgB;AAAA,IAChB;AAAA,EACF,IAAI,WAAW,eAAe;AAE9B,QAAM,EAAE,cAAc,IAAI,cAAc,KAAK;AAC7C,QAAM,UAAU,MAAM,QAAQ,cAAc;AAE5C,MAAI,WAAY,QAAO,oBAAC,qBAAkB,aAA0B,eAA8B;AAClG,MAAI,UAAW,QAAO,oBAAC,oBAAiB,eAA8B;AAEtE,QAAM,sBAAsB,CAAC,aAAa,iBAAiB,UAAU,OAAO;AAC5E,MAAI;AACF,WACE;AAAA,MAAC;AAAA;AAAA,QACC,IAAI,iBAAiB,WAAW;AAAA,QAChC,eAAa,mBAAmB;AAAA,QAChC,MAAK;AAAA,QAEJ;AAAA;AAAA,IACH;AAGJ,SACE,oBAAC,sBAAmB,WAAW,eAAe,IAAI,iBAAiB,WAAW,IAC5E;AAAA,IAAC;AAAA;AAAA,MACC,uBAAuB;AAAA,QACrB,MAAM;AAAA,QACN,wBAAwB;AAAA,QACxB,eAAe,mBAAmB;AAAA,QAClC,cAAc;AAAA,MAChB;AAAA,MACA,gBAAgB,EAAE,MAAM,OAAO;AAAA,MAC/B,WAAW;AAAA,MACX,OAAO,gBAAgB;AAAA,MACvB;AAAA,MACA,gBAAgB,EAAE,UAAU,gBAAgB;AAAA,MAC5C,OAAO,CAAC,UAAkB,gBAAgB,KAAK,EAAE;AAAA,MACjD,cAAc;AAAA,MACd;AAAA;AAAA,EACF,GACF;AAEJ;AAEO,MAAM,WAAW,MAAmB;AACzC,QAAM;AAAA,IACJ,OAAO,EAAE,cAAc,OAAO;AAAA,IAC9B;AAAA,IACA;AAAA,EACF,IAAI,WAAW,eAAe;AAE9B,QAAM,EAAE,MAAM,IAAI,mBAAmB,kBAAkB;AAEvD,QAAM,wBAAiD,YAAY,CAAC,MAAM;AACxE,MAAE,eAAe;AAAA,EACnB,GAAG,CAAC,CAAC;AAEL,SACE;AAAA,IAAC;AAAA;AAAA,MACC,UAAU;AAAA,MACV;AAAA,MACA,aAAa;AAAA,MACb;AAAA,MACA,UAAU;AAAA,MAEV,8BAAC,eAAY;AAAA;AAAA,EACf;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { DSPillGroupV2 } from "@elliemae/ds-pills-v2";
|
|
4
|
+
import { useOwnerProps } from "@elliemae/ds-props-helpers";
|
|
5
|
+
import { useContext, useMemo } from "react";
|
|
5
6
|
import ComboBoxContext from "../../ComboBoxCTX.js";
|
|
6
|
-
import { useGroupPills } from "./useGroupPills.js";
|
|
7
7
|
import { ComboboxDataTestid } from "../../ComboboxDataTestids.js";
|
|
8
|
+
import { StyledDSPillV2 } from "../styled.js";
|
|
8
9
|
import { RemovableSelectedValuePill } from "./RemovableSelectedValuePill.js";
|
|
10
|
+
import { useGroupPills } from "./useGroupPills.js";
|
|
9
11
|
const MultiSelectedValuesContainer = () => {
|
|
10
12
|
const {
|
|
13
|
+
props,
|
|
11
14
|
props: { selectedValues, disabled, applyAriaDisabled: applyAriaDisabledToContainer, readOnly },
|
|
12
15
|
pillGroupRef
|
|
13
16
|
} = useContext(ComboBoxContext);
|
|
14
17
|
const multiSelectedValue = selectedValues;
|
|
15
18
|
const correctPillsToShow = useGroupPills();
|
|
19
|
+
const ownerProps = useOwnerProps(props);
|
|
16
20
|
return useMemo(
|
|
17
21
|
() => /* @__PURE__ */ jsx(
|
|
18
22
|
"div",
|
|
@@ -24,12 +28,13 @@ const MultiSelectedValuesContainer = () => {
|
|
|
24
28
|
RemovableSelectedValuePill,
|
|
25
29
|
{
|
|
26
30
|
pill,
|
|
27
|
-
trailingComma: (disabled || applyAriaDisabledToContainer || readOnly) && idx + 1 < correctPillsToShow || multiSelectedValue.length > 0 && correctPillsToShow !== multiSelectedValue.length
|
|
31
|
+
trailingComma: (disabled || applyAriaDisabledToContainer || readOnly) && idx + 1 < correctPillsToShow || multiSelectedValue.length > 0 && correctPillsToShow !== multiSelectedValue.length,
|
|
32
|
+
ownerProps
|
|
28
33
|
},
|
|
29
34
|
pill.dsId
|
|
30
35
|
)),
|
|
31
36
|
multiSelectedValue.length > 0 && correctPillsToShow !== multiSelectedValue.length && /* @__PURE__ */ jsx(
|
|
32
|
-
|
|
37
|
+
StyledDSPillV2,
|
|
33
38
|
{
|
|
34
39
|
size: "s",
|
|
35
40
|
labelTruncated: false,
|
|
@@ -37,14 +42,24 @@ const MultiSelectedValuesContainer = () => {
|
|
|
37
42
|
type: "value",
|
|
38
43
|
disabled,
|
|
39
44
|
applyAriaDisabled: applyAriaDisabledToContainer,
|
|
40
|
-
readOnly
|
|
45
|
+
readOnly,
|
|
46
|
+
className: "ds-pill-wrapper ds-pill-wrapper-value",
|
|
47
|
+
...ownerProps
|
|
41
48
|
},
|
|
42
49
|
"grouped"
|
|
43
50
|
)
|
|
44
51
|
] })
|
|
45
52
|
}
|
|
46
53
|
),
|
|
47
|
-
[
|
|
54
|
+
[
|
|
55
|
+
pillGroupRef,
|
|
56
|
+
multiSelectedValue,
|
|
57
|
+
correctPillsToShow,
|
|
58
|
+
disabled,
|
|
59
|
+
applyAriaDisabledToContainer,
|
|
60
|
+
readOnly,
|
|
61
|
+
ownerProps
|
|
62
|
+
]
|
|
48
63
|
);
|
|
49
64
|
};
|
|
50
65
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/multi-selected-values-container/MultiSelectedValuesContainer.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { DSPillGroupV2 } from '@elliemae/ds-pills-v2';\nimport { useOwnerProps } from '@elliemae/ds-props-helpers';\nimport { useContext, useMemo } from 'react';\nimport ComboBoxContext from '../../ComboBoxCTX.js';\nimport { ComboboxDataTestid } from '../../ComboboxDataTestids.js';\nimport type { DSComboboxT } from '../../react-desc-prop-types.js';\nimport { StyledDSPillV2 } from '../styled.js';\nimport { RemovableSelectedValuePill } from './RemovableSelectedValuePill.js';\nimport { useGroupPills } from './useGroupPills.js';\n\nexport const MultiSelectedValuesContainer = (): JSX.Element => {\n const {\n props,\n props: { selectedValues, disabled, applyAriaDisabled: applyAriaDisabledToContainer, readOnly },\n pillGroupRef,\n } = useContext(ComboBoxContext);\n\n // this is always an array because logic in controls component\n const multiSelectedValue = selectedValues as DSComboboxT.ItemOption[];\n const correctPillsToShow = useGroupPills();\n const ownerProps = useOwnerProps(props);\n\n return useMemo(\n () => (\n <div\n style={{ width: multiSelectedValue.length > 0 ? 'max-content' : '0px' }}\n data-testid={ComboboxDataTestid.SELECTED_VALUES}\n >\n <DSPillGroupV2 innerRef={pillGroupRef}>\n {multiSelectedValue.length > 0 &&\n multiSelectedValue\n .slice(0, correctPillsToShow)\n .map((pill, idx) => (\n <RemovableSelectedValuePill\n key={pill.dsId}\n pill={pill}\n trailingComma={\n ((disabled || applyAriaDisabledToContainer || readOnly) && idx + 1 < correctPillsToShow) ||\n (multiSelectedValue.length > 0 && correctPillsToShow !== multiSelectedValue.length)\n }\n ownerProps={ownerProps}\n />\n ))}\n {multiSelectedValue.length > 0 && correctPillsToShow !== multiSelectedValue.length && (\n <StyledDSPillV2\n size=\"s\"\n labelTruncated={false}\n key=\"grouped\"\n label={`+${multiSelectedValue.length - correctPillsToShow}`}\n type=\"value\"\n disabled={disabled}\n applyAriaDisabled={applyAriaDisabledToContainer}\n readOnly={readOnly}\n className=\"ds-pill-wrapper ds-pill-wrapper-value\"\n {...ownerProps}\n />\n )}\n </DSPillGroupV2>\n </div>\n ),\n\n [\n pillGroupRef,\n multiSelectedValue,\n correctPillsToShow,\n disabled,\n applyAriaDisabledToContainer,\n readOnly,\n ownerProps,\n ],\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;AC4Bf,SAKQ,KALR;AA5BR,SAAS,qBAAqB;AAC9B,SAAS,qBAAqB;AAC9B,SAAS,YAAY,eAAe;AACpC,OAAO,qBAAqB;AAC5B,SAAS,0BAA0B;AAEnC,SAAS,sBAAsB;AAC/B,SAAS,kCAAkC;AAC3C,SAAS,qBAAqB;AAEvB,MAAM,+BAA+B,MAAmB;AAC7D,QAAM;AAAA,IACJ;AAAA,IACA,OAAO,EAAE,gBAAgB,UAAU,mBAAmB,8BAA8B,SAAS;AAAA,IAC7F;AAAA,EACF,IAAI,WAAW,eAAe;AAG9B,QAAM,qBAAqB;AAC3B,QAAM,qBAAqB,cAAc;AACzC,QAAM,aAAa,cAAc,KAAK;AAEtC,SAAO;AAAA,IACL,MACE;AAAA,MAAC;AAAA;AAAA,QACC,OAAO,EAAE,OAAO,mBAAmB,SAAS,IAAI,gBAAgB,MAAM;AAAA,QACtE,eAAa,mBAAmB;AAAA,QAEhC,+BAAC,iBAAc,UAAU,cACtB;AAAA,6BAAmB,SAAS,KAC3B,mBACG,MAAM,GAAG,kBAAkB,EAC3B,IAAI,CAAC,MAAM,QACV;AAAA,YAAC;AAAA;AAAA,cAEC;AAAA,cACA,gBACI,YAAY,gCAAgC,aAAa,MAAM,IAAI,sBACpE,mBAAmB,SAAS,KAAK,uBAAuB,mBAAmB;AAAA,cAE9E;AAAA;AAAA,YANK,KAAK;AAAA,UAOZ,CACD;AAAA,UACJ,mBAAmB,SAAS,KAAK,uBAAuB,mBAAmB,UAC1E;AAAA,YAAC;AAAA;AAAA,cACC,MAAK;AAAA,cACL,gBAAgB;AAAA,cAEhB,OAAO,IAAI,mBAAmB,SAAS,kBAAkB;AAAA,cACzD,MAAK;AAAA,cACL;AAAA,cACA,mBAAmB;AAAA,cACnB;AAAA,cACA,WAAU;AAAA,cACT,GAAG;AAAA;AAAA,YAPA;AAAA,UAQN;AAAA,WAEJ;AAAA;AAAA,IACF;AAAA,IAGF;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import React2, { useContext } from "react";
|
|
4
|
-
import { DSPillV2 } from "@elliemae/ds-pills-v2";
|
|
5
4
|
import ComboBoxContext from "../../ComboBoxCTX.js";
|
|
6
5
|
import { getSuggestedValueOnChange } from "../../utils/listHelper.js";
|
|
6
|
+
import { StyledDSPillV2 } from "../styled.js";
|
|
7
7
|
const RemovableSelectedValuePill = (props) => {
|
|
8
|
-
const { pill, trailingComma } = props;
|
|
8
|
+
const { pill, trailingComma, ownerProps } = props;
|
|
9
9
|
const {
|
|
10
10
|
props: {
|
|
11
11
|
onChange,
|
|
@@ -22,13 +22,19 @@ const RemovableSelectedValuePill = (props) => {
|
|
|
22
22
|
if (applyAriaDisabledToContainer || readOnly) return "labelOnly";
|
|
23
23
|
return "removable";
|
|
24
24
|
}, [disabled, isNonClearable, applyAriaDisabledToContainer, readOnly]);
|
|
25
|
+
const className = React2.useMemo(() => {
|
|
26
|
+
if (type === "removable") return "ds-pill-wrapper ds-pill-wrapper-removable";
|
|
27
|
+
if (type === "labelOnly") return "ds-pill-wrapper ds-pill-wrapper-label";
|
|
28
|
+
return "ds-pill-wrapper ds-pill-wrapper-value";
|
|
29
|
+
}, [type]);
|
|
25
30
|
return /* @__PURE__ */ jsx(
|
|
26
|
-
|
|
31
|
+
StyledDSPillV2,
|
|
27
32
|
{
|
|
28
33
|
size: "s",
|
|
29
34
|
label: pill.label,
|
|
30
|
-
disabled,
|
|
35
|
+
disabled: disabled || pill.disabled,
|
|
31
36
|
type,
|
|
37
|
+
className,
|
|
32
38
|
applyAriaDisabled: applyAriaDisabledToContainer || pill.applyAriaDisabled,
|
|
33
39
|
readOnly,
|
|
34
40
|
trailingComma,
|
|
@@ -38,7 +44,8 @@ const RemovableSelectedValuePill = (props) => {
|
|
|
38
44
|
e.stopPropagation();
|
|
39
45
|
onChange(getSuggestedValueOnChange(pill, selectedValues), pill, e);
|
|
40
46
|
internalRef.current?.focus();
|
|
41
|
-
}
|
|
47
|
+
},
|
|
48
|
+
...ownerProps
|
|
42
49
|
},
|
|
43
50
|
pill.value
|
|
44
51
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/multi-selected-values-container/RemovableSelectedValuePill.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext } from 'react';\nimport
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;AC+
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext } from 'react';\nimport ComboBoxContext from '../../ComboBoxCTX.js';\nimport type { DSComboboxT } from '../../react-desc-prop-types.js';\nimport { getSuggestedValueOnChange } from '../../utils/listHelper.js';\nimport { StyledDSPillV2 } from '../styled.js';\n\nexport const RemovableSelectedValuePill: React.ComponentType<{\n pill: DSComboboxT.ItemOption;\n applyAriaDisabled?: boolean;\n trailingComma?: boolean;\n ownerProps?: {\n getOwnerProps: () => DSComboboxT.InternalProps;\n getOwnerPropsArguments: () => object;\n };\n}> = (props) => {\n const { pill, trailingComma, ownerProps } = props;\n const {\n props: {\n onChange,\n isNonClearable,\n disabled,\n selectedValues,\n applyAriaDisabled: applyAriaDisabledToContainer,\n readOnly,\n },\n internalRef,\n } = useContext(ComboBoxContext);\n\n const type = React.useMemo(() => {\n if (disabled || isNonClearable) return 'value';\n if (applyAriaDisabledToContainer || readOnly) return 'labelOnly';\n return 'removable';\n }, [disabled, isNonClearable, applyAriaDisabledToContainer, readOnly]);\n /**\n * WORKAROUND: Manual className management\n *\n * StyledDSPillV2 is a styled-component wrapping DSPillV2.\n * When using the slot system (ownerProps), the internal component's className\n * is overridden by the styled-component's generated className, causing\n * DSPillV2's variant-specific classes to be lost.\n *\n * These classes are required for correct styling of different pill types:\n * - ds-pill-wrapper-removable: Interactive pills with remove button\n * - ds-pill-wrapper-label: Read-only pills (aria-disabled state)\n * - ds-pill-wrapper-value: Non-interactive pills (disabled/non-clearable)\n *\n * TODO: Fix in ds-system's generateClassName to preserve inner component classNames\n * when styled(InnerComponent) is used. Current implementation overwrites className\n * instead of merging it.\n *\n * Or instead of defining the className manually, trust on the ones generated by styled-components and remove the manual ones from DSPillV2,\n * but this would require a refactor in ds-pills-v2 to have a slot definition per variant.\n *\n *\n * Related: packages/agregators/ds-system/src/styled/generated-attributes/generateAttributes.ts\n */\n const className = React.useMemo(() => {\n if (type === 'removable') return 'ds-pill-wrapper ds-pill-wrapper-removable';\n if (type === 'labelOnly') return 'ds-pill-wrapper ds-pill-wrapper-label';\n return 'ds-pill-wrapper ds-pill-wrapper-value';\n }, [type]);\n\n return (\n <StyledDSPillV2\n size=\"s\"\n key={pill.value}\n label={pill.label}\n disabled={disabled || pill.disabled}\n type={type}\n className={className}\n applyAriaDisabled={applyAriaDisabledToContainer || pill.applyAriaDisabled}\n readOnly={readOnly}\n trailingComma={trailingComma}\n tabIndex={-1}\n onRemove={(e: React.KeyboardEvent | React.MouseEvent) => {\n if (readOnly) return;\n // preventing the menu to be opened\n e.stopPropagation();\n onChange(getSuggestedValueOnChange(pill, selectedValues), pill, e);\n internalRef.current?.focus();\n }}\n {...ownerProps}\n />\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;AC+DnB;AA/DJ,OAAOA,UAAS,kBAAkB;AAClC,OAAO,qBAAqB;AAE5B,SAAS,iCAAiC;AAC1C,SAAS,sBAAsB;AAExB,MAAM,6BAQR,CAAC,UAAU;AACd,QAAM,EAAE,MAAM,eAAe,WAAW,IAAI;AAC5C,QAAM;AAAA,IACJ,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,mBAAmB;AAAA,MACnB;AAAA,IACF;AAAA,IACA;AAAA,EACF,IAAI,WAAW,eAAe;AAE9B,QAAM,OAAOA,OAAM,QAAQ,MAAM;AAC/B,QAAI,YAAY,eAAgB,QAAO;AACvC,QAAI,gCAAgC,SAAU,QAAO;AACrD,WAAO;AAAA,EACT,GAAG,CAAC,UAAU,gBAAgB,8BAA8B,QAAQ,CAAC;AAwBrE,QAAM,YAAYA,OAAM,QAAQ,MAAM;AACpC,QAAI,SAAS,YAAa,QAAO;AACjC,QAAI,SAAS,YAAa,QAAO;AACjC,WAAO;AAAA,EACT,GAAG,CAAC,IAAI,CAAC;AAET,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAK;AAAA,MAEL,OAAO,KAAK;AAAA,MACZ,UAAU,YAAY,KAAK;AAAA,MAC3B;AAAA,MACA;AAAA,MACA,mBAAmB,gCAAgC,KAAK;AAAA,MACxD;AAAA,MACA;AAAA,MACA,UAAU;AAAA,MACV,UAAU,CAAC,MAA8C;AACvD,YAAI,SAAU;AAEd,UAAE,gBAAgB;AAClB,iBAAS,0BAA0B,MAAM,cAAc,GAAG,MAAM,CAAC;AACjE,oBAAY,SAAS,MAAM;AAAA,MAC7B;AAAA,MACC,GAAG;AAAA;AAAA,IAhBC,KAAK;AAAA,EAiBZ;AAEJ;",
|
|
6
6
|
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -18,7 +18,7 @@ const useGroupPills = () => {
|
|
|
18
18
|
const selectedValuesLength = Math.min(30, multiSelectedValues.length);
|
|
19
19
|
const [pillsToShow, setPillsToShow] = useState(selectedValuesLength);
|
|
20
20
|
const { width } = useOnElementResize(controlsWrapperRef);
|
|
21
|
-
const { width: widthInput } = useOnElementResize(innerRef
|
|
21
|
+
const { width: widthInput } = useOnElementResize(innerRef);
|
|
22
22
|
useEffect(() => {
|
|
23
23
|
if (selectedValuesLength !== pillsToShow) {
|
|
24
24
|
setPillsToShow(selectedValuesLength);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/multi-selected-values-container/useGroupPills.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable complexity */\nimport { useContext, useEffect, useState, useLayoutEffect } from 'react';\nimport { useOnElementResize } from '../../utils/useOnElementResize.js';\nimport { ComboBoxContext } from '../../ComboBoxCTX.js';\nimport type { DSComboboxT } from '../../react-desc-prop-types.js';\n\nconst getGroupedPillWidth = (remainingPills: number): number => {\n if (remainingPills === 0) return 0;\n const digits = remainingPills.toString().length;\n return 8 * (digits - 1) + 31;\n};\nconst useGroupPills = (): number => {\n const {\n props: { selectedValues, isNonClearable, disabled, innerRef, applyAriaDisabled: applyAriaDisabledToContainer },\n selectedOptionsRef,\n controlsWrapperRef,\n pillGroupRef,\n } = useContext(ComboBoxContext);\n\n const multiSelectedValues = selectedValues as DSComboboxT.ItemOption[];\n\n // 30 represent 30 pills maximum to calculate the grouped pill. this fix the load time issue\n // when combobox is receiving a huge amount of options.\n const selectedValuesLength = Math.min(30, multiSelectedValues.length);\n\n const [pillsToShow, setPillsToShow] = useState(selectedValuesLength);\n const { width } = useOnElementResize(controlsWrapperRef);\n const { width: widthInput } = useOnElementResize(innerRef
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACCvB,SAAS,YAAY,WAAW,UAAU,uBAAuB;AACjE,SAAS,0BAA0B;AACnC,SAAS,uBAAuB;AAGhC,MAAM,sBAAsB,CAAC,mBAAmC;AAC9D,MAAI,mBAAmB,EAAG,QAAO;AACjC,QAAM,SAAS,eAAe,SAAS,EAAE;AACzC,SAAO,KAAK,SAAS,KAAK;AAC5B;AACA,MAAM,gBAAgB,MAAc;AAClC,QAAM;AAAA,IACJ,OAAO,EAAE,gBAAgB,gBAAgB,UAAU,UAAU,mBAAmB,6BAA6B;AAAA,IAC7G;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,WAAW,eAAe;AAE9B,QAAM,sBAAsB;AAI5B,QAAM,uBAAuB,KAAK,IAAI,IAAI,oBAAoB,MAAM;AAEpE,QAAM,CAAC,aAAa,cAAc,IAAI,SAAS,oBAAoB;AACnE,QAAM,EAAE,MAAM,IAAI,mBAAmB,kBAAkB;AACvD,QAAM,EAAE,OAAO,WAAW,IAAI,mBAAmB,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable complexity */\nimport { useContext, useEffect, useState, useLayoutEffect } from 'react';\nimport { useOnElementResize } from '../../utils/useOnElementResize.js';\nimport { ComboBoxContext } from '../../ComboBoxCTX.js';\nimport type { DSComboboxT } from '../../react-desc-prop-types.js';\n\nconst getGroupedPillWidth = (remainingPills: number): number => {\n if (remainingPills === 0) return 0;\n const digits = remainingPills.toString().length;\n return 8 * (digits - 1) + 31;\n};\nconst useGroupPills = (): number => {\n const {\n props: { selectedValues, isNonClearable, disabled, innerRef, applyAriaDisabled: applyAriaDisabledToContainer },\n selectedOptionsRef,\n controlsWrapperRef,\n pillGroupRef,\n } = useContext(ComboBoxContext);\n\n const multiSelectedValues = selectedValues as DSComboboxT.ItemOption[];\n\n // 30 represent 30 pills maximum to calculate the grouped pill. this fix the load time issue\n // when combobox is receiving a huge amount of options.\n const selectedValuesLength = Math.min(30, multiSelectedValues.length);\n\n const [pillsToShow, setPillsToShow] = useState(selectedValuesLength);\n const { width } = useOnElementResize(controlsWrapperRef);\n const { width: widthInput } = useOnElementResize(innerRef as React.RefObject<HTMLInputElement>);\n useEffect(() => {\n if (selectedValuesLength !== pillsToShow) {\n setPillsToShow(selectedValuesLength);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [selectedValuesLength, width, widthInput]);\n\n useLayoutEffect(() => {\n if (selectedOptionsRef.current && pillGroupRef.current) {\n if (pillGroupRef.current) pillGroupRef.current.style.width = 'max-content';\n let lastPillFit = -1;\n let currentWidth = 0;\n const referenceWidth = selectedOptionsRef.current.offsetWidth;\n const pills: HTMLDivElement[] = [\n ...pillGroupRef.current.querySelectorAll(\n disabled || applyAriaDisabledToContainer || isNonClearable\n ? '.ds-pill-wrapper-value'\n : '.ds-pill-wrapper-removable, .ds-pill-wrapper-label',\n ),\n ] as HTMLDivElement[];\n const pillsWidth = pills.map((pill) => pill?.offsetWidth);\n pillsWidth.forEach((pillWidth, idx) => {\n currentWidth += pillWidth;\n if (currentWidth + getGroupedPillWidth(selectedValuesLength - idx - 1) <= referenceWidth) {\n lastPillFit = idx;\n }\n });\n\n if (!(selectedValuesLength > 0 && pillsToShow !== selectedValuesLength)) {\n const nextPillsToShow = lastPillFit + 1;\n\n if (nextPillsToShow !== pillsToShow) {\n setPillsToShow(nextPillsToShow);\n }\n }\n\n if (pillGroupRef.current) pillGroupRef.current.style.width = 'fit-content';\n }\n }, [\n selectedOptionsRef,\n innerRef,\n multiSelectedValues,\n pillsToShow,\n pillGroupRef,\n width,\n widthInput,\n disabled,\n applyAriaDisabledToContainer,\n selectedValuesLength,\n isNonClearable,\n ]);\n\n return pillsToShow || 1;\n};\n\nexport { useGroupPills };\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACCvB,SAAS,YAAY,WAAW,UAAU,uBAAuB;AACjE,SAAS,0BAA0B;AACnC,SAAS,uBAAuB;AAGhC,MAAM,sBAAsB,CAAC,mBAAmC;AAC9D,MAAI,mBAAmB,EAAG,QAAO;AACjC,QAAM,SAAS,eAAe,SAAS,EAAE;AACzC,SAAO,KAAK,SAAS,KAAK;AAC5B;AACA,MAAM,gBAAgB,MAAc;AAClC,QAAM;AAAA,IACJ,OAAO,EAAE,gBAAgB,gBAAgB,UAAU,UAAU,mBAAmB,6BAA6B;AAAA,IAC7G;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,WAAW,eAAe;AAE9B,QAAM,sBAAsB;AAI5B,QAAM,uBAAuB,KAAK,IAAI,IAAI,oBAAoB,MAAM;AAEpE,QAAM,CAAC,aAAa,cAAc,IAAI,SAAS,oBAAoB;AACnE,QAAM,EAAE,MAAM,IAAI,mBAAmB,kBAAkB;AACvD,QAAM,EAAE,OAAO,WAAW,IAAI,mBAAmB,QAA6C;AAC9F,YAAU,MAAM;AACd,QAAI,yBAAyB,aAAa;AACxC,qBAAe,oBAAoB;AAAA,IACrC;AAAA,EAEF,GAAG,CAAC,sBAAsB,OAAO,UAAU,CAAC;AAE5C,kBAAgB,MAAM;AACpB,QAAI,mBAAmB,WAAW,aAAa,SAAS;AACtD,UAAI,aAAa,QAAS,cAAa,QAAQ,MAAM,QAAQ;AAC7D,UAAI,cAAc;AAClB,UAAI,eAAe;AACnB,YAAM,iBAAiB,mBAAmB,QAAQ;AAClD,YAAM,QAA0B;AAAA,QAC9B,GAAG,aAAa,QAAQ;AAAA,UACtB,YAAY,gCAAgC,iBACxC,2BACA;AAAA,QACN;AAAA,MACF;AACA,YAAM,aAAa,MAAM,IAAI,CAAC,SAAS,MAAM,WAAW;AACxD,iBAAW,QAAQ,CAAC,WAAW,QAAQ;AACrC,wBAAgB;AAChB,YAAI,eAAe,oBAAoB,uBAAuB,MAAM,CAAC,KAAK,gBAAgB;AACxF,wBAAc;AAAA,QAChB;AAAA,MACF,CAAC;AAED,UAAI,EAAE,uBAAuB,KAAK,gBAAgB,uBAAuB;AACvE,cAAM,kBAAkB,cAAc;AAEtC,YAAI,oBAAoB,aAAa;AACnC,yBAAe,eAAe;AAAA,QAChC;AAAA,MACF;AAEA,UAAI,aAAa,QAAS,cAAa,QAAQ,MAAM,QAAQ;AAAA,IAC/D;AAAA,EACF,GAAG;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAED,SAAO,eAAe;AACxB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/parts/styled.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import { DSPillV2 } from "@elliemae/ds-pills-v2";
|
|
2
3
|
import { styled } from "@elliemae/ds-system";
|
|
4
|
+
import { DSFormComboboxName, FORM_COMBOBOX_SLOTS } from "../constants/index.js";
|
|
3
5
|
const StyledA11yNotVisible = styled.span`
|
|
4
6
|
position: absolute;
|
|
5
7
|
width: 1px;
|
|
@@ -12,7 +14,21 @@ const StyledA11yNotVisible = styled.span`
|
|
|
12
14
|
clip-path: inset(100%);
|
|
13
15
|
white-space: nowrap;
|
|
14
16
|
`;
|
|
17
|
+
const StyledDSPillV2 = styled(DSPillV2, {
|
|
18
|
+
name: DSFormComboboxName,
|
|
19
|
+
slot: FORM_COMBOBOX_SLOTS.PILL,
|
|
20
|
+
preserveLegacyDataTestId: true
|
|
21
|
+
})`
|
|
22
|
+
background-color: ${({ theme, disabled, applyAriaDisabled, readOnly }) => {
|
|
23
|
+
if (disabled) return theme.colors.neutral["080"];
|
|
24
|
+
if (applyAriaDisabled || readOnly) return theme.colors.neutral["050"];
|
|
25
|
+
return theme.colors.brand[250];
|
|
26
|
+
}};
|
|
27
|
+
|
|
28
|
+
color: ${({ theme, disabled, applyAriaDisabled, readOnly }) => disabled || applyAriaDisabled || readOnly ? "#616b7f" : theme.colors.brand["800"]};
|
|
29
|
+
`;
|
|
15
30
|
export {
|
|
16
|
-
StyledA11yNotVisible
|
|
31
|
+
StyledA11yNotVisible,
|
|
32
|
+
StyledDSPillV2
|
|
17
33
|
};
|
|
18
34
|
//# sourceMappingURL=styled.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/parts/styled.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { styled } from '@elliemae/ds-system';\
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,cAAc;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { DSPillV2 } from '@elliemae/ds-pills-v2';\nimport { styled } from '@elliemae/ds-system';\nimport { DSFormComboboxName, FORM_COMBOBOX_SLOTS } from '../constants/index.js';\nexport const StyledA11yNotVisible = styled.span`\n position: absolute;\n width: 1px;\n height: 1px;\n margin: -1px;\n border: 0;\n padding: 0;\n overflow: hidden;\n clip: rect(0 0 0 0);\n clip-path: inset(100%);\n white-space: nowrap;\n`;\n\n/**\n * Combobox-specific pill styling with stateful behavior\n *\n * DSPillV2 is stateless by design, but Combobox requires pills to visually\n * reflect container state (disabled/aria-disabled/readOnly). This wrapper\n * applies context-aware colors based on Combobox's interaction state.\n *\n * These styles were previously part of the Pills component but have been\n * moved here as Pills were refactored to be stateless. Combobox maintains\n * this stateful behavior as a specific use case requirement.\n */\nexport const StyledDSPillV2 = styled(DSPillV2, {\n name: DSFormComboboxName,\n slot: FORM_COMBOBOX_SLOTS.PILL,\n preserveLegacyDataTestId: true,\n})`\n background-color: ${({ theme, disabled, applyAriaDisabled, readOnly }) => {\n if (disabled) return theme.colors.neutral['080'];\n if (applyAriaDisabled || readOnly) return theme.colors.neutral['050'];\n return theme.colors.brand[250];\n }};\n\n color: ${({ theme, disabled, applyAriaDisabled, readOnly }) =>\n disabled || applyAriaDisabled || readOnly ? '#616b7f' : theme.colors.brand['800']};\n`;\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,gBAAgB;AACzB,SAAS,cAAc;AACvB,SAAS,oBAAoB,2BAA2B;AACjD,MAAM,uBAAuB,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAwBpC,MAAM,iBAAiB,OAAO,UAAU;AAAA,EAC7C,MAAM;AAAA,EACN,MAAM,oBAAoB;AAAA,EAC1B,0BAA0B;AAC5B,CAAC;AAAA,sBACqB,CAAC,EAAE,OAAO,UAAU,mBAAmB,SAAS,MAAM;AACxE,MAAI,SAAU,QAAO,MAAM,OAAO,QAAQ,KAAK;AAC/C,MAAI,qBAAqB,SAAU,QAAO,MAAM,OAAO,QAAQ,KAAK;AACpE,SAAO,MAAM,OAAO,MAAM,GAAG;AAC/B,CAAC;AAAA;AAAA,WAEQ,CAAC,EAAE,OAAO,UAAU,mBAAmB,SAAS,MACvD,YAAY,qBAAqB,WAAW,YAAY,MAAM,OAAO,MAAM,KAAK,CAAC;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/sharedTypes.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type React from 'react';\nimport type { DSFastListT } from '@elliemae/ds-fast-list';\n\nimport type { DSComboboxT } from './react-desc-prop-types.js';\nimport { MENU_OPTION_TYPES } from './constants.js';\n\nexport declare namespace DSComboboxInternalsT {\n export interface ComboBoxContextT {\n props: DSComboboxT.InternalProps;\n internalRef: React.RefObject<HTMLInputElement>;\n menuState: boolean;\n setShowPopover: React.Dispatch<React.SetStateAction<boolean>>;\n pillGroupRef: React.RefObject<HTMLDivElement>;\n scrollOptionIntoView: (dsId: string, opts
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type React from 'react';\nimport type { DSFastListT } from '@elliemae/ds-fast-list';\n\nimport type { DSComboboxT } from './react-desc-prop-types.js';\nimport { MENU_OPTION_TYPES } from './constants.js';\n\nexport declare namespace DSComboboxInternalsT {\n export interface ComboBoxContextT {\n props: DSComboboxT.InternalProps;\n internalRef: React.RefObject<HTMLInputElement>;\n menuState: boolean;\n setShowPopover: React.Dispatch<React.SetStateAction<boolean>>;\n pillGroupRef: React.RefObject<HTMLDivElement>;\n scrollOptionIntoView: (dsId: string, opts?: DSFastListT.ScrollToOptions) => void;\n setHasFocus: React.Dispatch<React.SetStateAction<boolean>>;\n hasFocus: boolean;\n listRef: React.MutableRefObject<DSComboboxT.ActionRefVirtualized>;\n wrapperListRef: React.RefObject<HTMLDivElement>;\n inputValue: string;\n setInputValue: React.Dispatch<React.SetStateAction<string>>;\n selectedOptionsRef: React.RefObject<HTMLDivElement>;\n controlsWrapperRef: React.RefObject<HTMLDivElement>;\n focusOptionIdx: string;\n setFocusOptionIdx: React.Dispatch<React.SetStateAction<string>>;\n setMenuState: (\n newState: boolean,\n reason: string,\n e?: React.KeyboardEvent | React.MouseEvent | React.ChangeEvent<HTMLInputElement>,\n ) => void;\n correctOptions: DSComboboxT.OptionTypes[];\n instanceUid: string;\n optionsPerSection: DSComboboxT.OptionTypes[];\n shouldPreventContextMenuOpening: boolean;\n }\n}\n\nexport const isSeparator = (el: DSComboboxT.OptionTypes | undefined): el is DSComboboxT.ItemSeparatorOptions =>\n el?.type === MENU_OPTION_TYPES.SEPARATOR;\n\nexport const isOption = (el: DSComboboxT.OptionTypes | undefined): el is DSComboboxT.ItemOption =>\n el?.type === MENU_OPTION_TYPES.OPTION;\n"],
|
|
5
5
|
"mappings": "AAAA,YAAY,WAAW;ACIvB,SAAS,yBAAyB;AAgC3B,MAAM,cAAc,CAAC,OAC1B,IAAI,SAAS,kBAAkB;AAE1B,MAAM,WAAW,CAAC,OACvB,IAAI,SAAS,kBAAkB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -11,6 +11,7 @@ export declare const FORM_COMBOBOX_SLOTS: {
|
|
|
11
11
|
readonly MULTI_MENU_ITEM: "multi-menu-item";
|
|
12
12
|
readonly LOADING_INDICATOR: "loading-indicator";
|
|
13
13
|
readonly SKELETON_MENU_ITEM: "skeleton-menu-item";
|
|
14
|
+
readonly PILL: "pill";
|
|
14
15
|
};
|
|
15
16
|
export declare const FORM_COMBOBOX_DATA_TESTID: {
|
|
16
17
|
CONTROLS_WRAPPER: string;
|
|
@@ -22,6 +23,7 @@ export declare const FORM_COMBOBOX_DATA_TESTID: {
|
|
|
22
23
|
DROPDOWN: string;
|
|
23
24
|
OPTION: string;
|
|
24
25
|
ALLY_SELECTED_VALUES: string;
|
|
26
|
+
PILL: string;
|
|
25
27
|
ROOT: "ds-combobox-root";
|
|
26
28
|
INPUT_WRAPPER: "ds-combobox-input-wrapper";
|
|
27
29
|
DROPDOWN_BUTTON: "ds-combobox-dropdown-button";
|
|
@@ -4,4 +4,8 @@ export declare const RemovableSelectedValuePill: React.ComponentType<{
|
|
|
4
4
|
pill: DSComboboxT.ItemOption;
|
|
5
5
|
applyAriaDisabled?: boolean;
|
|
6
6
|
trailingComma?: boolean;
|
|
7
|
+
ownerProps?: {
|
|
8
|
+
getOwnerProps: () => DSComboboxT.InternalProps;
|
|
9
|
+
getOwnerPropsArguments: () => object;
|
|
10
|
+
};
|
|
7
11
|
}>;
|
|
@@ -1 +1,13 @@
|
|
|
1
1
|
export declare const StyledA11yNotVisible: import("styled-components").StyledComponent<"span", import("@elliemae/ds-system").Theme, object & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<"span">, never>;
|
|
2
|
+
/**
|
|
3
|
+
* Combobox-specific pill styling with stateful behavior
|
|
4
|
+
*
|
|
5
|
+
* DSPillV2 is stateless by design, but Combobox requires pills to visually
|
|
6
|
+
* reflect container state (disabled/aria-disabled/readOnly). This wrapper
|
|
7
|
+
* applies context-aware colors based on Combobox's interaction state.
|
|
8
|
+
*
|
|
9
|
+
* These styles were previously part of the Pills component but have been
|
|
10
|
+
* moved here as Pills were refactored to be stateless. Combobox maintains
|
|
11
|
+
* this stateful behavior as a specific use case requirement.
|
|
12
|
+
*/
|
|
13
|
+
export declare const StyledDSPillV2: import("styled-components").StyledComponent<import("react").ComponentType<import("@elliemae/ds-pills-v2").DSPillT.Props>, import("@elliemae/ds-system").Theme, object & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<import("react").ComponentType<import("@elliemae/ds-pills-v2").DSPillT.Props>>, never>;
|
|
@@ -8,7 +8,7 @@ export declare namespace DSComboboxInternalsT {
|
|
|
8
8
|
menuState: boolean;
|
|
9
9
|
setShowPopover: React.Dispatch<React.SetStateAction<boolean>>;
|
|
10
10
|
pillGroupRef: React.RefObject<HTMLDivElement>;
|
|
11
|
-
scrollOptionIntoView: (dsId: string, opts
|
|
11
|
+
scrollOptionIntoView: (dsId: string, opts?: DSFastListT.ScrollToOptions) => void;
|
|
12
12
|
setHasFocus: React.Dispatch<React.SetStateAction<boolean>>;
|
|
13
13
|
hasFocus: boolean;
|
|
14
14
|
listRef: React.MutableRefObject<DSComboboxT.ActionRefVirtualized>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-form-combobox",
|
|
3
|
-
"version": "3.60.0-next.
|
|
3
|
+
"version": "3.60.0-next.20",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Controlled Form Combobox",
|
|
6
6
|
"files": [
|
|
@@ -35,51 +35,47 @@
|
|
|
35
35
|
"reportFile": "tests.xml",
|
|
36
36
|
"indent": 4
|
|
37
37
|
},
|
|
38
|
-
"scripts": {
|
|
39
|
-
"dev": "cross-env NODE_ENV=development node ../../../scripts/build/build.mjs --watch",
|
|
40
|
-
"test": "pui-cli test --passWithNoTests --coverage=\"false\"",
|
|
41
|
-
"lint": "node ../../../scripts/lint.mjs --fix",
|
|
42
|
-
"lint:strict": "node ../../../scripts/lint-strict.mjs",
|
|
43
|
-
"dts": "node ../../../scripts/dts.mjs",
|
|
44
|
-
"build": "cross-env NODE_ENV=production node ../../../scripts/build/build.mjs",
|
|
45
|
-
"checkDeps": "npm exec ../../util/ds-codemods -- check-missing-packages --projectFolderPath=\"./\" --ignorePackagesGlobPattern=\"\" --ignoreFilesGlobPattern=\"**/test-ables/*,**/tests/*\""
|
|
46
|
-
},
|
|
47
38
|
"dependencies": {
|
|
48
|
-
"
|
|
49
|
-
"@elliemae/ds-
|
|
50
|
-
"@elliemae/ds-fast-list": "3.60.0-next.
|
|
51
|
-
"@elliemae/ds-
|
|
52
|
-
"@elliemae/ds-
|
|
53
|
-
"@elliemae/ds-
|
|
54
|
-
"@elliemae/ds-icons": "3.60.0-next.
|
|
55
|
-
"@elliemae/ds-
|
|
56
|
-
"@elliemae/ds-
|
|
57
|
-
"@elliemae/ds-
|
|
58
|
-
"@elliemae/ds-system": "3.60.0-next.
|
|
59
|
-
"@elliemae/ds-
|
|
60
|
-
"react-virtual": "catalog:",
|
|
61
|
-
"uid": "catalog:"
|
|
39
|
+
"uid": "^2.0.2",
|
|
40
|
+
"@elliemae/ds-button-v2": "3.60.0-next.20",
|
|
41
|
+
"@elliemae/ds-fast-list": "3.60.0-next.20",
|
|
42
|
+
"@elliemae/ds-circular-progress-indicator": "3.60.0-next.20",
|
|
43
|
+
"@elliemae/ds-menu-items": "3.60.0-next.20",
|
|
44
|
+
"@elliemae/ds-floating-context": "3.60.0-next.20",
|
|
45
|
+
"@elliemae/ds-icons": "3.60.0-next.20",
|
|
46
|
+
"@elliemae/ds-grid": "3.60.0-next.20",
|
|
47
|
+
"@elliemae/ds-props-helpers": "3.60.0-next.20",
|
|
48
|
+
"@elliemae/ds-truncated-tooltip-text": "3.60.0-next.20",
|
|
49
|
+
"@elliemae/ds-system": "3.60.0-next.20",
|
|
50
|
+
"@elliemae/ds-pills-v2": "3.60.0-next.20"
|
|
62
51
|
},
|
|
63
52
|
"devDependencies": {
|
|
64
|
-
"@elliemae/
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"@elliemae/
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"styled-system": "catalog:"
|
|
53
|
+
"@elliemae/pui-theme": "~2.13.0",
|
|
54
|
+
"jest": "^30.0.0",
|
|
55
|
+
"styled-components": "~5.3.9",
|
|
56
|
+
"styled-system": "^5.1.5",
|
|
57
|
+
"@elliemae/ds-form-helpers-mask-hooks": "3.60.0-next.20",
|
|
58
|
+
"@elliemae/ds-monorepo-devops": "3.60.0-next.20",
|
|
59
|
+
"@elliemae/ds-test-utils": "3.60.0-next.20"
|
|
72
60
|
},
|
|
73
61
|
"peerDependencies": {
|
|
74
|
-
"@elliemae/pui-theme": "
|
|
75
|
-
"react": "
|
|
76
|
-
"react-dom": "
|
|
77
|
-
"styled-components": "
|
|
78
|
-
"styled-system": "
|
|
62
|
+
"@elliemae/pui-theme": "~2.13.0",
|
|
63
|
+
"react": "^18.3.1",
|
|
64
|
+
"react-dom": "^18.3.1",
|
|
65
|
+
"styled-components": "~5.3.9",
|
|
66
|
+
"styled-system": "^5.1.5"
|
|
79
67
|
},
|
|
80
68
|
"publishConfig": {
|
|
81
69
|
"access": "public",
|
|
82
70
|
"typeSafety": false
|
|
83
71
|
},
|
|
84
|
-
"
|
|
85
|
-
|
|
72
|
+
"scripts": {
|
|
73
|
+
"dev": "cross-env NODE_ENV=development node ../../../scripts/build/build.mjs --watch",
|
|
74
|
+
"test": "ds-monorepo-devops test --passWithNoTests --coverage=\"false\"",
|
|
75
|
+
"lint": "node ../../../scripts/lint.mjs --fix",
|
|
76
|
+
"lint:strict": "node ../../../scripts/lint-strict.mjs",
|
|
77
|
+
"dts": "node ../../../scripts/dts.mjs",
|
|
78
|
+
"build": "cross-env NODE_ENV=production node ../../../scripts/build/build.mjs",
|
|
79
|
+
"checkDeps": "npx -yes ../../util/ds-codemods check-missing-packages --projectFolderPath=\"./\" --ignorePackagesGlobPattern=\"\" --ignoreFilesGlobPattern=\"**/test-ables/*,**/tests/*\""
|
|
80
|
+
}
|
|
81
|
+
}
|