@elliemae/ds-form-combobox 3.5.0-rc.9 → 3.6.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/ComboBox.js +5 -4
- package/dist/cjs/ComboBox.js.map +2 -2
- package/dist/cjs/parts/A11yFocusedOption.js +10 -9
- package/dist/cjs/parts/A11yFocusedOption.js.map +2 -2
- package/dist/cjs/parts/A11ySelectedValues.js +6 -4
- package/dist/cjs/parts/A11ySelectedValues.js.map +2 -2
- package/dist/cjs/parts/DropdownIndicator.js +6 -4
- package/dist/cjs/parts/DropdownIndicator.js.map +2 -2
- package/dist/cjs/parts/container/Container.js +32 -18
- package/dist/cjs/parts/container/Container.js.map +2 -2
- package/dist/cjs/parts/controls/Controls.js +32 -16
- package/dist/cjs/parts/controls/Controls.js.map +2 -2
- package/dist/cjs/parts/controls-input/ControlsInput.js +37 -27
- package/dist/cjs/parts/controls-input/ControlsInput.js.map +2 -2
- package/dist/cjs/parts/header-list/HeaderList.js +33 -21
- package/dist/cjs/parts/header-list/HeaderList.js.map +2 -2
- package/dist/cjs/parts/menu-list/MenuList.js +23 -16
- package/dist/cjs/parts/menu-list/MenuList.js.map +2 -2
- package/dist/cjs/parts/menu-list/useItemRenderer.js +18 -9
- package/dist/cjs/parts/menu-list/useItemRenderer.js.map +2 -2
- package/dist/cjs/parts/multi-selected-values-container/MultiSelectedValuesContainer.js +20 -16
- package/dist/cjs/parts/multi-selected-values-container/MultiSelectedValuesContainer.js.map +2 -2
- package/dist/cjs/parts/multi-selected-values-container/RemovableSelectedValuePill.js +4 -4
- package/dist/cjs/parts/multi-selected-values-container/RemovableSelectedValuePill.js.map +2 -2
- package/dist/esm/ComboBox.js +5 -4
- package/dist/esm/ComboBox.js.map +2 -2
- package/dist/esm/parts/A11yFocusedOption.js +10 -9
- package/dist/esm/parts/A11yFocusedOption.js.map +2 -2
- package/dist/esm/parts/A11ySelectedValues.js +6 -4
- package/dist/esm/parts/A11ySelectedValues.js.map +2 -2
- package/dist/esm/parts/DropdownIndicator.js +6 -4
- package/dist/esm/parts/DropdownIndicator.js.map +2 -2
- package/dist/esm/parts/container/Container.js +32 -18
- package/dist/esm/parts/container/Container.js.map +2 -2
- package/dist/esm/parts/controls/Controls.js +32 -16
- package/dist/esm/parts/controls/Controls.js.map +2 -2
- package/dist/esm/parts/controls-input/ControlsInput.js +37 -27
- package/dist/esm/parts/controls-input/ControlsInput.js.map +2 -2
- package/dist/esm/parts/header-list/HeaderList.js +33 -21
- package/dist/esm/parts/header-list/HeaderList.js.map +2 -2
- package/dist/esm/parts/menu-list/MenuList.js +23 -16
- package/dist/esm/parts/menu-list/MenuList.js.map +2 -2
- package/dist/esm/parts/menu-list/useItemRenderer.js +18 -9
- package/dist/esm/parts/menu-list/useItemRenderer.js.map +2 -2
- package/dist/esm/parts/multi-selected-values-container/MultiSelectedValuesContainer.js +20 -16
- package/dist/esm/parts/multi-selected-values-container/MultiSelectedValuesContainer.js.map +2 -2
- package/dist/esm/parts/multi-selected-values-container/RemovableSelectedValuePill.js +4 -4
- package/dist/esm/parts/multi-selected-values-container/RemovableSelectedValuePill.js.map +2 -2
- package/package.json +12 -12
|
@@ -28,7 +28,8 @@ __export(MenuList_exports, {
|
|
|
28
28
|
});
|
|
29
29
|
module.exports = __toCommonJS(MenuList_exports);
|
|
30
30
|
var React = __toESM(require("react"));
|
|
31
|
-
var
|
|
31
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
32
|
+
var import_react = require("react");
|
|
32
33
|
var import_ds_utilities = require("@elliemae/ds-utilities");
|
|
33
34
|
var import_styled = require("./styled");
|
|
34
35
|
var import_ComboboxDataTestids = require("../../ComboboxDataTestids");
|
|
@@ -52,26 +53,32 @@ const MenuList = () => {
|
|
|
52
53
|
e.preventDefault();
|
|
53
54
|
}, []);
|
|
54
55
|
return (0, import_react.useMemo)(
|
|
55
|
-
() => /* @__PURE__ */
|
|
56
|
+
() => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_styled.StyledListWrapper, {
|
|
56
57
|
ref: wrapperListRef,
|
|
57
58
|
inline,
|
|
58
59
|
onMouseDown: preventLoseInputFocus,
|
|
59
60
|
width,
|
|
60
61
|
minWidth: menuMinWidth,
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
62
|
+
children: [
|
|
63
|
+
withHeader && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_header_list.HeaderList, {}),
|
|
64
|
+
filteredOptions.length > 0 || onCreate ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styled.StyledVirtualListWrapper, {
|
|
65
|
+
inline,
|
|
66
|
+
maxHeight: menuMaxHeight,
|
|
67
|
+
ref: listRef,
|
|
68
|
+
withHeader,
|
|
69
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styled.StyledList, {
|
|
70
|
+
id: "combo-listbox",
|
|
71
|
+
role: "listbox",
|
|
72
|
+
"data-testid": import_ComboboxDataTestids.ComboboxDataTestid.LIST,
|
|
73
|
+
style: { height: virtualListHelpers?.totalSize, margin: inline ? "0px" : "8px 0px" },
|
|
74
|
+
children: ItemRenderer
|
|
75
|
+
})
|
|
76
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styled.StyledNoResultsWrapper, {
|
|
77
|
+
role: "alert",
|
|
78
|
+
children: noOptionsMessage
|
|
79
|
+
})
|
|
80
|
+
]
|
|
81
|
+
}, width),
|
|
75
82
|
[
|
|
76
83
|
wrapperListRef,
|
|
77
84
|
inline,
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/menu-list/MenuList.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["import React, { useContext, useMemo, useCallback } from 'react';\nimport { useOnElementResize } from '@elliemae/ds-utilities';\n\nimport { StyledListWrapper, StyledNoResultsWrapper, StyledList, StyledVirtualListWrapper } from './styled';\nimport { ComboboxDataTestid } from '../../ComboboxDataTestids';\nimport { ComboBoxContext } from '../../ComboBoxCTX';\nimport { HeaderList } from '../header-list';\nimport { useItemRenderer } from './useItemRenderer';\n\nexport const MenuList = (): JSX.Element => {\n const {\n props: { menuMinWidth, noOptionsMessage, menuMaxHeight, onCreate, inline, filteredOptions, selectedValues },\n controlsWrapperRef,\n listRef,\n inputValue,\n wrapperListRef,\n virtualListHelpers,\n } = useContext(ComboBoxContext);\n\n const multiple = Array.isArray(selectedValues);\n // removing the header list if we are filtering or is inline cb or we have no options to show\n const withHeader = !inline && multiple && filteredOptions.length > 0 && !inputValue;\n const ItemRenderer = useItemRenderer();\n const { width } = useOnElementResize(controlsWrapperRef);\n const preventLoseInputFocus: React.MouseEventHandler = useCallback((e) => {\n e.preventDefault();\n }, []);\n\n return useMemo(\n () => (\n <StyledListWrapper\n ref={wrapperListRef}\n inline={inline}\n onMouseDown={preventLoseInputFocus}\n width={width}\n minWidth={menuMinWidth}\n // we use width as key to force react virtual re-render on window resize\n // and update the item height accordly\n key={width}\n >\n {withHeader && <HeaderList />}\n {filteredOptions.length > 0 || onCreate ? (\n <StyledVirtualListWrapper inline={inline} maxHeight={menuMaxHeight} ref={listRef} withHeader={withHeader}>\n <StyledList\n id=\"combo-listbox\"\n role=\"listbox\"\n data-testid={ComboboxDataTestid.LIST}\n style={{ height: virtualListHelpers?.totalSize, margin: inline ? '0px' : '8px 0px' }}\n >\n {ItemRenderer}\n </StyledList>\n </StyledVirtualListWrapper>\n ) : (\n <StyledNoResultsWrapper role=\"alert\">{noOptionsMessage}</StyledNoResultsWrapper>\n )}\n </StyledListWrapper>\n ),\n [\n wrapperListRef,\n inline,\n preventLoseInputFocus,\n width,\n menuMinWidth,\n withHeader,\n filteredOptions.length,\n onCreate,\n menuMaxHeight,\n listRef,\n virtualListHelpers?.totalSize,\n ItemRenderer,\n noOptionsMessage,\n ],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAwD;AACxD,0BAAmC;AAEnC,oBAAgG;AAChG,iCAAmC;AACnC,yBAAgC;AAChC,yBAA2B;AAC3B,6BAAgC;AAEzB,MAAM,WAAW,MAAmB;AACzC,QAAM;AAAA,IACJ,OAAO,EAAE,cAAc,kBAAkB,eAAe,UAAU,QAAQ,iBAAiB,eAAe;AAAA,IAC1G;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,QAAI,yBAAW,kCAAe;AAE9B,QAAM,WAAW,MAAM,QAAQ,cAAc;AAE7C,QAAM,aAAa,CAAC,UAAU,YAAY,gBAAgB,SAAS,KAAK,CAAC;AACzE,QAAM,mBAAe,wCAAgB;AACrC,QAAM,EAAE,MAAM,QAAI,wCAAmB,kBAAkB;AACvD,QAAM,4BAAiD,0BAAY,CAAC,MAAM;AACxE,MAAE,eAAe;AAAA,EACnB,GAAG,CAAC,CAAC;AAEL,aAAO;AAAA,IACL,MACE,
|
|
6
|
-
"names": [
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB;AAAA,mBAAwD;AACxD,0BAAmC;AAEnC,oBAAgG;AAChG,iCAAmC;AACnC,yBAAgC;AAChC,yBAA2B;AAC3B,6BAAgC;AAEzB,MAAM,WAAW,MAAmB;AACzC,QAAM;AAAA,IACJ,OAAO,EAAE,cAAc,kBAAkB,eAAe,UAAU,QAAQ,iBAAiB,eAAe;AAAA,IAC1G;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,QAAI,yBAAW,kCAAe;AAE9B,QAAM,WAAW,MAAM,QAAQ,cAAc;AAE7C,QAAM,aAAa,CAAC,UAAU,YAAY,gBAAgB,SAAS,KAAK,CAAC;AACzE,QAAM,mBAAe,wCAAgB;AACrC,QAAM,EAAE,MAAM,QAAI,wCAAmB,kBAAkB;AACvD,QAAM,4BAAiD,0BAAY,CAAC,MAAM;AACxE,MAAE,eAAe;AAAA,EACnB,GAAG,CAAC,CAAC;AAEL,aAAO;AAAA,IACL,MACE,6CAAC;AAAA,MACC,KAAK;AAAA,MACL;AAAA,MACA,aAAa;AAAA,MACb;AAAA,MACA,UAAU;AAAA,MAKT;AAAA,sBAAc,4CAAC,iCAAW;AAAA,QAC1B,gBAAgB,SAAS,KAAK,WAC7B,4CAAC;AAAA,UAAyB;AAAA,UAAgB,WAAW;AAAA,UAAe,KAAK;AAAA,UAAS;AAAA,UAChF,sDAAC;AAAA,YACC,IAAG;AAAA,YACH,MAAK;AAAA,YACL,eAAa,8CAAmB;AAAA,YAChC,OAAO,EAAE,QAAQ,oBAAoB,WAAW,QAAQ,SAAS,QAAQ,UAAU;AAAA,YAElF;AAAA,WACH;AAAA,SACF,IAEA,4CAAC;AAAA,UAAuB,MAAK;AAAA,UAAS;AAAA,SAAiB;AAAA;AAAA,OAfpD,KAiBP;AAAA,IAEF;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,gBAAgB;AAAA,MAChB;AAAA,MACA;AAAA,MACA;AAAA,MACA,oBAAoB;AAAA,MACpB;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
|
@@ -28,7 +28,8 @@ __export(useItemRenderer_exports, {
|
|
|
28
28
|
});
|
|
29
29
|
module.exports = __toCommonJS(useItemRenderer_exports);
|
|
30
30
|
var React = __toESM(require("react"));
|
|
31
|
-
var
|
|
31
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
32
|
+
var import_react = require("react");
|
|
32
33
|
var import_ds_grid = require("@elliemae/ds-grid");
|
|
33
34
|
var import_ds_common = require("@elliemae/ds-common");
|
|
34
35
|
var import_ComboBoxCTX = require("../../ComboBoxCTX");
|
|
@@ -95,18 +96,18 @@ const useItemRenderer = () => {
|
|
|
95
96
|
innerRef: vItem.measureRef
|
|
96
97
|
};
|
|
97
98
|
if (option.type === import_constants.MENU_OPTION_TYPES.SECTION) {
|
|
98
|
-
return /* @__PURE__ */
|
|
99
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_common.Section, {
|
|
99
100
|
label: option.label,
|
|
100
101
|
...generalProps
|
|
101
102
|
});
|
|
102
103
|
}
|
|
103
104
|
if (option.type === import_constants.MENU_OPTION_TYPES.SEPARATOR) {
|
|
104
|
-
return /* @__PURE__ */
|
|
105
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_common.Separator, {
|
|
105
106
|
...generalProps
|
|
106
107
|
});
|
|
107
108
|
}
|
|
108
109
|
if (option.type === import_constants.MENU_OPTION_TYPES.OPTION) {
|
|
109
|
-
return /* @__PURE__ */
|
|
110
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CBItem, {
|
|
110
111
|
...generalProps,
|
|
111
112
|
value: option.value,
|
|
112
113
|
label: option.label,
|
|
@@ -122,21 +123,29 @@ const useItemRenderer = () => {
|
|
|
122
123
|
});
|
|
123
124
|
}
|
|
124
125
|
if (type === import_constants.INTERNAL_MENU_OPTION_TYPES.CREATABLE) {
|
|
125
|
-
return /* @__PURE__ */
|
|
126
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_common.SingleMenuItem, {
|
|
126
127
|
dataTestid: import_ComboboxDataTestids.ComboboxDataTestid.OPTION,
|
|
127
128
|
isActive: dsId === focusOptionIdx,
|
|
128
129
|
...generalProps,
|
|
129
|
-
render: ({ label: labelCreatable }) => /* @__PURE__ */
|
|
130
|
+
render: ({ label: labelCreatable }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ds_grid.Grid, {
|
|
130
131
|
p: "8px",
|
|
131
132
|
cols: ["min-content", "auto"],
|
|
132
133
|
gutter: "xxs",
|
|
133
|
-
alignItems: "center"
|
|
134
|
-
|
|
134
|
+
alignItems: "center",
|
|
135
|
+
children: [
|
|
136
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styled.StyledCreatableLabel, {
|
|
137
|
+
children: "Add:"
|
|
138
|
+
}),
|
|
139
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styled.StyledCreatableValue, {
|
|
140
|
+
children: `"${labelCreatable}"`
|
|
141
|
+
})
|
|
142
|
+
]
|
|
143
|
+
}),
|
|
135
144
|
label: option.label,
|
|
136
145
|
onClick: handleOnCreateClick
|
|
137
146
|
});
|
|
138
147
|
}
|
|
139
|
-
return /* @__PURE__ */
|
|
148
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {});
|
|
140
149
|
});
|
|
141
150
|
}, [filteredOptions, focusOptionIdx, selectedValues, virtualListHelpers]);
|
|
142
151
|
};
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/menu-list/useItemRenderer.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["/* eslint-disable max-statements */\n/* eslint-disable complexity */\n/* eslint-disable react-hooks/exhaustive-deps */\nimport React, { useMemo, useContext, useCallback } from 'react';\nimport { Grid } from '@elliemae/ds-grid';\nimport { SingleMenuItem, MultiMenuItem, Section, Separator } from '@elliemae/ds-common';\nimport { ComboBoxContext } from '../../ComboBoxCTX';\nimport { StyledCreatableLabel, StyledCreatableValue } from './styled';\nimport { isSelected, getSuggestedValueOnChange } from '../../utils/listHelper';\nimport { ComboboxDataTestid } from '../../ComboboxDataTestids';\nimport { DSComboboxT } from '../../react-desc-prop-types';\nimport { MENU_OPTION_TYPES, INTERNAL_MENU_OPTION_TYPES } from '../../constants';\nexport const useItemRenderer = (): Array<JSX.Element> | null => {\n const {\n props: { filteredOptions, onCreate, onChange, isNonClearable, selectedValues, onFilter, allOptions },\n setMenuState,\n inputValue,\n focusOptionIdx,\n setInputValue,\n virtualListHelpers,\n } = useContext(ComboBoxContext);\n\n const multiple = Array.isArray(selectedValues);\n const CBItem = multiple ? MultiMenuItem : SingleMenuItem;\n\n const handleOnCreateClick = useCallback(() => {\n if (inputValue && onCreate) {\n onCreate(inputValue);\n setInputValue('');\n if (onFilter) onFilter(allOptions, inputValue);\n }\n }, [onFilter, onCreate, inputValue, allOptions, setInputValue]);\n const handleClick = useCallback(\n (option: DSComboboxT.ItemOption, e: React.MouseEvent) => {\n if (option.type === MENU_OPTION_TYPES.OPTION) {\n if (!option.disabled) {\n if (onFilter) onFilter(allOptions, inputValue);\n setInputValue('');\n if (!multiple) {\n setMenuState(false, 'selectOption', e);\n }\n onChange(getSuggestedValueOnChange(option, selectedValues, isNonClearable), option, e);\n }\n }\n // prevent for loosing focus on input control\n e.stopPropagation();\n e.preventDefault();\n },\n [onFilter, selectedValues, allOptions, onChange, setMenuState, multiple],\n );\n\n // prevent blur from controls input\n const handleOnMouseDown = useCallback((e: React.MouseEvent<HTMLLIElement>) => {\n e.preventDefault();\n }, []);\n\n return useMemo(() => {\n if (!virtualListHelpers) {\n return null;\n }\n return virtualListHelpers.virtualItems.map((vItem) => {\n const option = filteredOptions[vItem.index];\n const { dsId, type, disabled } = option;\n const generalProps = {\n wrapperStyles: {\n position: 'absolute',\n top: 0,\n left: 0,\n width: '100%',\n transform: `translateY(${vItem.start}px)`,\n },\n\n key: `${dsId}`,\n innerRef: vItem.measureRef,\n };\n if (option.type === MENU_OPTION_TYPES.SECTION) {\n return <Section label={option.label} {...generalProps} />;\n }\n if (option.type === MENU_OPTION_TYPES.SEPARATOR) {\n return <Separator {...generalProps} />;\n }\n if (option.type === MENU_OPTION_TYPES.OPTION) {\n return (\n <CBItem\n {...generalProps}\n value={option.value}\n label={option.label}\n dataTestid={ComboboxDataTestid.OPTION}\n disabled={disabled}\n onClick={(e: React.MouseEvent) => {\n handleClick(option, e);\n }}\n onMouseDown={handleOnMouseDown}\n isActive={dsId === focusOptionIdx}\n isSelected={isSelected(selectedValues, option)}\n tabIndex={-1}\n />\n );\n }\n if (type === INTERNAL_MENU_OPTION_TYPES.CREATABLE) {\n return (\n <SingleMenuItem\n dataTestid={ComboboxDataTestid.OPTION}\n isActive={dsId === focusOptionIdx}\n {...generalProps}\n render={({ label: labelCreatable }: { label: string }) => (\n <Grid p=\"8px\" cols={['min-content', 'auto']} gutter=\"xxs\" alignItems=\"center\">\n <StyledCreatableLabel>Add:</StyledCreatableLabel>\n <StyledCreatableValue>{`\"${labelCreatable}\"`}</StyledCreatableValue>\n </Grid>\n )}\n label={option.label}\n onClick={handleOnCreateClick}\n />\n );\n }\n return <></>;\n });\n }, [filteredOptions, focusOptionIdx, selectedValues, virtualListHelpers]);\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
6
|
-
"names": [
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
|
@@ -28,7 +28,8 @@ __export(MultiSelectedValuesContainer_exports, {
|
|
|
28
28
|
});
|
|
29
29
|
module.exports = __toCommonJS(MultiSelectedValuesContainer_exports);
|
|
30
30
|
var React = __toESM(require("react"));
|
|
31
|
-
var
|
|
31
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
32
|
+
var import_react = require("react");
|
|
32
33
|
var import_ds_pills = require("@elliemae/ds-pills");
|
|
33
34
|
var import_ComboBoxCTX = __toESM(require("../../ComboBoxCTX"));
|
|
34
35
|
var import_useGroupPills = require("./useGroupPills");
|
|
@@ -42,22 +43,25 @@ const MultiSelectedValuesContainer = () => {
|
|
|
42
43
|
const multiSelectedValue = selectedValues;
|
|
43
44
|
const correctPillsToShow = (0, import_useGroupPills.useGroupPills)();
|
|
44
45
|
return (0, import_react.useMemo)(
|
|
45
|
-
() => /* @__PURE__ */
|
|
46
|
+
() => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
46
47
|
style: { width: multiSelectedValue.length > 0 ? "max-content" : "0px" },
|
|
47
|
-
"data-testid": import_ComboboxDataTestids.ComboboxDataTestid.SELECTED_VALUES
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
48
|
+
"data-testid": import_ComboboxDataTestids.ComboboxDataTestid.SELECTED_VALUES,
|
|
49
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ds_pills.DSPillGroupV2, {
|
|
50
|
+
innerRef: pillGroupRef,
|
|
51
|
+
children: [
|
|
52
|
+
multiSelectedValue.length > 0 && multiSelectedValue.slice(0, correctPillsToShow).map((pill) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_RemovableSelectedValuePill.RemovableSelectedValuePill, {
|
|
53
|
+
pill
|
|
54
|
+
}, pill.dsId)),
|
|
55
|
+
multiSelectedValue.length > 0 && correctPillsToShow !== multiSelectedValue.length && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_pills.DSPillV2, {
|
|
56
|
+
size: "s",
|
|
57
|
+
labelTruncated: false,
|
|
58
|
+
label: `+${multiSelectedValue.length - correctPillsToShow}`,
|
|
59
|
+
type: "value",
|
|
60
|
+
disabled
|
|
61
|
+
}, "grouped")
|
|
62
|
+
]
|
|
63
|
+
})
|
|
64
|
+
}),
|
|
61
65
|
[pillGroupRef, multiSelectedValue, correctPillsToShow, disabled]
|
|
62
66
|
);
|
|
63
67
|
};
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/multi-selected-values-container/MultiSelectedValuesContainer.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["import React, { useMemo, useContext } from 'react';\nimport { DSPillGroupV2, DSPillV2 } from '@elliemae/ds-pills';\nimport ComboBoxContext from '../../ComboBoxCTX';\nimport { useGroupPills } from './useGroupPills';\nimport { DSComboboxT } from '../../react-desc-prop-types';\nimport { ComboboxDataTestid } from '../../ComboboxDataTestids';\nimport { RemovableSelectedValuePill } from './RemovableSelectedValuePill';\nexport const MultiSelectedValuesContainer = (): JSX.Element => {\n const {\n props: { selectedValues, disabled },\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\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) => <RemovableSelectedValuePill key={pill.dsId} pill={pill} />)}\n {multiSelectedValue.length > 0 && correctPillsToShow !== multiSelectedValue.length && (\n <DSPillV2\n size=\"s\"\n labelTruncated={false}\n key=\"grouped\"\n label={`+${multiSelectedValue.length - correctPillsToShow}`}\n type=\"value\"\n disabled={disabled}\n />\n )}\n </DSPillGroupV2>\n </div>\n ),\n\n [pillGroupRef, multiSelectedValue, correctPillsToShow, disabled],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAA2C;AAC3C,sBAAwC;AACxC,yBAA4B;AAC5B,2BAA8B;AAE9B,iCAAmC;AACnC,wCAA2C;AACpC,MAAM,+BAA+B,MAAmB;AAC7D,QAAM;AAAA,IACJ,OAAO,EAAE,gBAAgB,SAAS;AAAA,IAClC;AAAA,EACF,QAAI,yBAAW,mBAAAA,OAAe;AAG9B,QAAM,qBAAqB;AAC3B,QAAM,yBAAqB,oCAAc;AAEzC,aAAO;AAAA,IACL,MACE,
|
|
6
|
-
"names": ["ComboBoxContext"
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB;AAAA,mBAA2C;AAC3C,sBAAwC;AACxC,yBAA4B;AAC5B,2BAA8B;AAE9B,iCAAmC;AACnC,wCAA2C;AACpC,MAAM,+BAA+B,MAAmB;AAC7D,QAAM;AAAA,IACJ,OAAO,EAAE,gBAAgB,SAAS;AAAA,IAClC;AAAA,EACF,QAAI,yBAAW,mBAAAA,OAAe;AAG9B,QAAM,qBAAqB;AAC3B,QAAM,yBAAqB,oCAAc;AAEzC,aAAO;AAAA,IACL,MACE,4CAAC;AAAA,MACC,OAAO,EAAE,OAAO,mBAAmB,SAAS,IAAI,gBAAgB,MAAM;AAAA,MACtE,eAAa,8CAAmB;AAAA,MAEhC,uDAAC;AAAA,QAAc,UAAU;AAAA,QACtB;AAAA,6BAAmB,SAAS,KAC3B,mBACG,MAAM,GAAG,kBAAkB,EAC3B,IAAI,CAAC,SAAS,4CAAC;AAAA,YAA2C;AAAA,aAAX,KAAK,IAAkB,CAAE;AAAA,UAC5E,mBAAmB,SAAS,KAAK,uBAAuB,mBAAmB,UAC1E,4CAAC;AAAA,YACC,MAAK;AAAA,YACL,gBAAgB;AAAA,YAEhB,OAAO,IAAI,mBAAmB,SAAS;AAAA,YACvC,MAAK;AAAA,YACL;AAAA,aAHI,SAIN;AAAA;AAAA,OAEJ;AAAA,KACF;AAAA,IAGF,CAAC,cAAc,oBAAoB,oBAAoB,QAAQ;AAAA,EACjE;AACF;",
|
|
6
|
+
"names": ["ComboBoxContext"]
|
|
7
7
|
}
|
|
@@ -28,7 +28,8 @@ __export(RemovableSelectedValuePill_exports, {
|
|
|
28
28
|
});
|
|
29
29
|
module.exports = __toCommonJS(RemovableSelectedValuePill_exports);
|
|
30
30
|
var React = __toESM(require("react"));
|
|
31
|
-
var
|
|
31
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
32
|
+
var import_react = require("react");
|
|
32
33
|
var import_ds_pills = require("@elliemae/ds-pills");
|
|
33
34
|
var import_ComboBoxCTX = __toESM(require("../../ComboBoxCTX"));
|
|
34
35
|
var import_listHelper = require("../../utils/listHelper");
|
|
@@ -37,9 +38,8 @@ const RemovableSelectedValuePill = (props) => {
|
|
|
37
38
|
const {
|
|
38
39
|
props: { onChange, isNonClearable, disabled, selectedValues, innerRef }
|
|
39
40
|
} = (0, import_react.useContext)(import_ComboBoxCTX.default);
|
|
40
|
-
return /* @__PURE__ */
|
|
41
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_pills.DSPillV2, {
|
|
41
42
|
size: "s",
|
|
42
|
-
key: pill.value,
|
|
43
43
|
label: pill.label,
|
|
44
44
|
disabled,
|
|
45
45
|
type: disabled || isNonClearable ? "value" : "removable",
|
|
@@ -49,6 +49,6 @@ const RemovableSelectedValuePill = (props) => {
|
|
|
49
49
|
onChange((0, import_listHelper.getSuggestedValueOnChange)(pill, selectedValues), pill, e);
|
|
50
50
|
innerRef.current?.focus();
|
|
51
51
|
}
|
|
52
|
-
});
|
|
52
|
+
}, pill.value);
|
|
53
53
|
};
|
|
54
54
|
//# sourceMappingURL=RemovableSelectedValuePill.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/multi-selected-values-container/RemovableSelectedValuePill.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["import React, { useContext } from 'react';\nimport { DSPillV2 } from '@elliemae/ds-pills';\nimport ComboBoxContext from '../../ComboBoxCTX';\nimport { DSComboboxT } from '../../react-desc-prop-types';\nimport { getSuggestedValueOnChange } from '../../utils/listHelper';\nexport const RemovableSelectedValuePill: React.ComponentType<{ pill: DSComboboxT.ItemOption }> = (props) => {\n const { pill } = props;\n const {\n props: { onChange, isNonClearable, disabled, selectedValues, innerRef },\n } = useContext(ComboBoxContext);\n\n return (\n <DSPillV2\n size=\"s\"\n key={pill.value}\n label={pill.label}\n disabled={disabled}\n type={disabled || isNonClearable ? 'value' : 'removable'}\n tabIndex={-1}\n onRemove={(e: React.KeyboardEvent) => {\n // preventing the menu to be opened\n e.stopPropagation();\n onChange(getSuggestedValueOnChange(pill, selectedValues), pill, e);\n innerRef.current?.focus();\n }}\n />\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkC;AAClC,sBAAyB;AACzB,yBAA4B;AAE5B,wBAA0C;AACnC,MAAM,6BAAoF,CAAC,UAAU;AAC1G,QAAM,EAAE,KAAK,IAAI;AACjB,QAAM;AAAA,IACJ,OAAO,EAAE,UAAU,gBAAgB,UAAU,gBAAgB,SAAS;AAAA,EACxE,QAAI,yBAAW,mBAAAA,OAAe;AAE9B,SACE,
|
|
6
|
-
"names": ["ComboBoxContext"
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB;AAAA,mBAAkC;AAClC,sBAAyB;AACzB,yBAA4B;AAE5B,wBAA0C;AACnC,MAAM,6BAAoF,CAAC,UAAU;AAC1G,QAAM,EAAE,KAAK,IAAI;AACjB,QAAM;AAAA,IACJ,OAAO,EAAE,UAAU,gBAAgB,UAAU,gBAAgB,SAAS;AAAA,EACxE,QAAI,yBAAW,mBAAAA,OAAe;AAE9B,SACE,4CAAC;AAAA,IACC,MAAK;AAAA,IAEL,OAAO,KAAK;AAAA,IACZ;AAAA,IACA,MAAM,YAAY,iBAAiB,UAAU;AAAA,IAC7C,UAAU;AAAA,IACV,UAAU,CAAC,MAA2B;AAEpC,QAAE,gBAAgB;AAClB,mBAAS,6CAA0B,MAAM,cAAc,GAAG,MAAM,CAAC;AACjE,eAAS,SAAS,MAAM;AAAA,IAC1B;AAAA,KAVK,KAAK,KAWZ;AAEJ;",
|
|
6
|
+
"names": ["ComboBoxContext"]
|
|
7
7
|
}
|
package/dist/esm/ComboBox.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { describe } from "@elliemae/ds-utilities";
|
|
4
4
|
import { useComboBox } from "./config/useComboBox";
|
|
5
5
|
import { Container } from "./parts/container";
|
|
@@ -7,9 +7,10 @@ import { ComboBoxContext } from "./ComboBoxCTX";
|
|
|
7
7
|
import { ComboboxPropTypes } from "./react-desc-prop-types";
|
|
8
8
|
const DSComboBox = (props) => {
|
|
9
9
|
const ctx = useComboBox(props);
|
|
10
|
-
return /* @__PURE__ */
|
|
11
|
-
value: ctx
|
|
12
|
-
|
|
10
|
+
return /* @__PURE__ */ jsx(ComboBoxContext.Provider, {
|
|
11
|
+
value: ctx,
|
|
12
|
+
children: /* @__PURE__ */ jsx(Container, {})
|
|
13
|
+
});
|
|
13
14
|
};
|
|
14
15
|
DSComboBox.propTypes = ComboboxPropTypes;
|
|
15
16
|
DSComboBox.displayName = "DSComboBox";
|
package/dist/esm/ComboBox.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/ComboBox.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { WeakValidationMap } from 'react';\nimport { describe } from '@elliemae/ds-utilities';\nimport { useComboBox } from './config/useComboBox';\nimport { Container } from './parts/container';\nimport { ComboBoxContext } from './ComboBoxCTX';\nimport { DSComboboxT, ComboboxPropTypes } from './react-desc-prop-types';\n\nconst DSComboBox: React.ComponentType<DSComboboxT.Props> = (props) => {\n const ctx = useComboBox(props);\n return (\n <ComboBoxContext.Provider value={ctx}>\n <Container />\n </ComboBoxContext.Provider>\n );\n};\nDSComboBox.propTypes = ComboboxPropTypes as WeakValidationMap<unknown>;\nDSComboBox.displayName = 'DSComboBox';\nconst DSComboBoxWithSchema = describe(DSComboBox);\n\nDSComboBoxWithSchema.propTypes = ComboboxPropTypes as WeakValidationMap<unknown>;\n\nexport { DSComboBox, DSComboBoxWithSchema, DSComboBox as DSComboBoxV3 };\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB
|
|
6
|
-
"names": [
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB;AACA,SAAS,gBAAgB;AACzB,SAAS,mBAAmB;AAC5B,SAAS,iBAAiB;AAC1B,SAAS,uBAAuB;AAChC,SAAsB,yBAAyB;AAE/C,MAAM,aAAqD,CAAC,UAAU;AACpE,QAAM,MAAM,YAAY,KAAK;AAC7B,SACE,oBAAC,gBAAgB,UAAhB;AAAA,IAAyB,OAAO;AAAA,IAC/B,8BAAC,aAAU;AAAA,GACb;AAEJ;AACA,WAAW,YAAY;AACvB,WAAW,cAAc;AACzB,MAAM,uBAAuB,SAAS,UAAU;AAEhD,qBAAqB,YAAY;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useContext, useMemo } from "react";
|
|
3
4
|
import ComboBoxContext from "../ComboBoxCTX";
|
|
4
5
|
import { StyledA11ySelectedValues } from "./styled";
|
|
5
6
|
import { getSelectableOptions, isSelected } from "../utils/listHelper";
|
|
@@ -17,19 +18,19 @@ const A11yFocusedOption = () => {
|
|
|
17
18
|
const navigationContext = "Use up and down to choose options,press enter to choose focused option, press Escape to excuse dropdown menu";
|
|
18
19
|
return useMemo(() => {
|
|
19
20
|
if (!isSeparator(focusOption) && menuState && focusOption && focusOption.type === "option")
|
|
20
|
-
return /* @__PURE__ */
|
|
21
|
-
key: menuState,
|
|
21
|
+
return /* @__PURE__ */ jsx(StyledA11ySelectedValues, {
|
|
22
22
|
"aria-live": "polite",
|
|
23
23
|
"aria-atomic": "false",
|
|
24
|
-
"aria-relevant": "additions text"
|
|
25
|
-
|
|
24
|
+
"aria-relevant": "additions text",
|
|
25
|
+
children: `option ${focusOption?.label} ${isFocusOptionSelected ? "selected and " : ""}focused .${focusSelectableOptionIdx + 1} of ${selectabledOptions.length}. ${navigationContext} `
|
|
26
|
+
}, menuState);
|
|
26
27
|
if (focusOption?.type === "creatable")
|
|
27
|
-
return /* @__PURE__ */
|
|
28
|
-
key: menuState,
|
|
28
|
+
return /* @__PURE__ */ jsx(StyledA11ySelectedValues, {
|
|
29
29
|
"aria-live": "assertive",
|
|
30
30
|
"aria-atomic": "false",
|
|
31
|
-
"aria-relevant": "additions text"
|
|
32
|
-
|
|
31
|
+
"aria-relevant": "additions text",
|
|
32
|
+
children: `Press enter to Add option written in input box. ${navigationContext}`
|
|
33
|
+
}, menuState);
|
|
33
34
|
return null;
|
|
34
35
|
}, [focusOption, menuState, isFocusOptionSelected, focusSelectableOptionIdx, selectabledOptions.length]);
|
|
35
36
|
};
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/parts/A11yFocusedOption.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext, useMemo } from 'react';\nimport ComboBoxContext from '../ComboBoxCTX';\nimport { StyledA11ySelectedValues } from './styled';\nimport { getSelectableOptions, isSelected } from '../utils/listHelper';\nimport { isSeparator } from '../sharedTypes';\n\nexport const A11yFocusedOption: React.ComponentType = () => {\n const {\n props: { filteredOptions, selectedValues },\n focusOptionIdx,\n menuState,\n } = useContext(ComboBoxContext);\n const selectabledOptions = getSelectableOptions(filteredOptions);\n const focusOption = filteredOptions.find((option) => option.dsId === focusOptionIdx);\n const isFocusOptionSelected = focusOption?.type === 'option' && isSelected(selectedValues, focusOption);\n const focusSelectableOptionIdx = selectabledOptions.findIndex((option) => option.dsId === focusOptionIdx);\n\n const navigationContext =\n 'Use up and down to choose options,press enter to choose focused option, press Escape to excuse dropdown menu';\n return useMemo(() => {\n if (!isSeparator(focusOption) && menuState && focusOption && focusOption.type === 'option')\n return (\n <StyledA11ySelectedValues key={menuState} aria-live=\"polite\" aria-atomic=\"false\" aria-relevant=\"additions text\">\n {`option ${focusOption?.label} ${isFocusOptionSelected ? 'selected and ' : ''}focused .${\n focusSelectableOptionIdx + 1\n } of ${selectabledOptions.length}. ${navigationContext} `}\n </StyledA11ySelectedValues>\n );\n if (focusOption?.type === 'creatable')\n return (\n <StyledA11ySelectedValues\n key={menuState}\n aria-live=\"assertive\"\n aria-atomic=\"false\"\n aria-relevant=\"additions text\"\n >\n {`Press enter to Add option written in input box. ${navigationContext}`}\n </StyledA11ySelectedValues>\n );\n return null;\n }, [focusOption, menuState, isFocusOptionSelected, focusSelectableOptionIdx, selectabledOptions.length]);\n};\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB,
|
|
6
|
-
"names": [
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB;AAAA,SAAgB,YAAY,eAAe;AAC3C,OAAO,qBAAqB;AAC5B,SAAS,gCAAgC;AACzC,SAAS,sBAAsB,kBAAkB;AACjD,SAAS,mBAAmB;AAErB,MAAM,oBAAyC,MAAM;AAC1D,QAAM;AAAA,IACJ,OAAO,EAAE,iBAAiB,eAAe;AAAA,IACzC;AAAA,IACA;AAAA,EACF,IAAI,WAAW,eAAe;AAC9B,QAAM,qBAAqB,qBAAqB,eAAe;AAC/D,QAAM,cAAc,gBAAgB,KAAK,CAAC,WAAW,OAAO,SAAS,cAAc;AACnF,QAAM,wBAAwB,aAAa,SAAS,YAAY,WAAW,gBAAgB,WAAW;AACtG,QAAM,2BAA2B,mBAAmB,UAAU,CAAC,WAAW,OAAO,SAAS,cAAc;AAExG,QAAM,oBACJ;AACF,SAAO,QAAQ,MAAM;AACnB,QAAI,CAAC,YAAY,WAAW,KAAK,aAAa,eAAe,YAAY,SAAS;AAChF,aACE,oBAAC;AAAA,QAAyC,aAAU;AAAA,QAAS,eAAY;AAAA,QAAQ,iBAAc;AAAA,QAC5F,oBAAU,aAAa,SAAS,wBAAwB,kBAAkB,cACzE,2BAA2B,QACtB,mBAAmB,WAAW;AAAA,SAHR,SAI/B;AAEJ,QAAI,aAAa,SAAS;AACxB,aACE,oBAAC;AAAA,QAEC,aAAU;AAAA,QACV,eAAY;AAAA,QACZ,iBAAc;AAAA,QAEb,6DAAmD;AAAA,SAL/C,SAMP;AAEJ,WAAO;AAAA,EACT,GAAG,CAAC,aAAa,WAAW,uBAAuB,0BAA0B,mBAAmB,MAAM,CAAC;AACzG;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useContext, useMemo } from "react";
|
|
3
4
|
import ComboBoxContext from "../ComboBoxCTX";
|
|
4
5
|
import { StyledA11ySelectedValues } from "./styled";
|
|
5
6
|
import { ComboboxDataTestid } from "../ComboboxDataTestids";
|
|
@@ -16,12 +17,13 @@ const A11ySelectedValues = () => {
|
|
|
16
17
|
}
|
|
17
18
|
return "No Option Selected";
|
|
18
19
|
}, [selectedValues]);
|
|
19
|
-
return /* @__PURE__ */
|
|
20
|
+
return /* @__PURE__ */ jsx(StyledA11ySelectedValues, {
|
|
20
21
|
"data-testid": ComboboxDataTestid.ALLY_SELECTED_VALUES,
|
|
21
22
|
"aria-live": "polite",
|
|
22
23
|
"aria-atomic": "false",
|
|
23
|
-
"aria-relevant": "additions text"
|
|
24
|
-
|
|
24
|
+
"aria-relevant": "additions text",
|
|
25
|
+
children: msg
|
|
26
|
+
});
|
|
25
27
|
};
|
|
26
28
|
export {
|
|
27
29
|
A11ySelectedValues
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/parts/A11ySelectedValues.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext, useMemo } from 'react';\nimport ComboBoxContext from '../ComboBoxCTX';\nimport { StyledA11ySelectedValues } from './styled';\nimport { ComboboxDataTestid } from '../ComboboxDataTestids';\nexport const A11ySelectedValues = (): JSX.Element => {\n const {\n props: { selectedValues },\n } = useContext(ComboBoxContext);\n\n const msg = useMemo(() => {\n if (Array.isArray(selectedValues) && selectedValues.length > 0) {\n return `Options selected: ${selectedValues.map((item) => item.label).join(', ')}`;\n }\n if (selectedValues) {\n return `Option selected: ${selectedValues?.label}`;\n }\n return 'No Option Selected';\n }, [selectedValues]);\n\n return (\n <StyledA11ySelectedValues\n data-testid={ComboboxDataTestid.ALLY_SELECTED_VALUES}\n aria-live=\"polite\"\n aria-atomic=\"false\"\n aria-relevant=\"additions text\"\n >\n {msg}\n </StyledA11ySelectedValues>\n );\n};\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB,
|
|
6
|
-
"names": [
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB;AAAA,SAAgB,YAAY,eAAe;AAC3C,OAAO,qBAAqB;AAC5B,SAAS,gCAAgC;AACzC,SAAS,0BAA0B;AAC5B,MAAM,qBAAqB,MAAmB;AACnD,QAAM;AAAA,IACJ,OAAO,EAAE,eAAe;AAAA,EAC1B,IAAI,WAAW,eAAe;AAE9B,QAAM,MAAM,QAAQ,MAAM;AACxB,QAAI,MAAM,QAAQ,cAAc,KAAK,eAAe,SAAS,GAAG;AAC9D,aAAO,qBAAqB,eAAe,IAAI,CAAC,SAAS,KAAK,KAAK,EAAE,KAAK,IAAI;AAAA,IAChF;AACA,QAAI,gBAAgB;AAClB,aAAO,oBAAoB,gBAAgB;AAAA,IAC7C;AACA,WAAO;AAAA,EACT,GAAG,CAAC,cAAc,CAAC;AAEnB,SACE,oBAAC;AAAA,IACC,eAAa,mBAAmB;AAAA,IAChC,aAAU;AAAA,IACV,eAAY;AAAA,IACZ,iBAAc;AAAA,IAEb;AAAA,GACH;AAEJ;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useCallback, useContext } from "react";
|
|
3
4
|
import { styled } from "@elliemae/ds-system";
|
|
4
5
|
import { DSButtonV2 } from "@elliemae/ds-button";
|
|
5
6
|
import { ChevronSmallDown } from "@elliemae/ds-icons";
|
|
@@ -25,7 +26,7 @@ const DropdownIndicator = () => {
|
|
|
25
26
|
const handleOnClick = useCallback((e) => {
|
|
26
27
|
e.preventDefault();
|
|
27
28
|
}, []);
|
|
28
|
-
return /* @__PURE__ */
|
|
29
|
+
return /* @__PURE__ */ jsx(StyledDropDownButton, {
|
|
29
30
|
onClick: handleOnClick,
|
|
30
31
|
"data-testid": ComboboxDataTestid.DROPDOWN,
|
|
31
32
|
"aria-controls": "combo-listbox",
|
|
@@ -35,8 +36,9 @@ const DropdownIndicator = () => {
|
|
|
35
36
|
"aria-haspopup": "listbox",
|
|
36
37
|
"aria-hidden": true,
|
|
37
38
|
buttonType: "icon",
|
|
38
|
-
tabIndex: -1
|
|
39
|
-
|
|
39
|
+
tabIndex: -1,
|
|
40
|
+
children: /* @__PURE__ */ jsx(ChevronSmallDown, {})
|
|
41
|
+
});
|
|
40
42
|
};
|
|
41
43
|
export {
|
|
42
44
|
DropdownIndicator
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/parts/DropdownIndicator.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/prop-types */\n/* eslint-disable import/no-cycle */\nimport React, { useCallback, useContext } from 'react';\nimport { styled } from '@elliemae/ds-system';\nimport { DSButtonV2 } from '@elliemae/ds-button';\nimport { ChevronSmallDown } from '@elliemae/ds-icons';\nimport ComboBoxContext from '../ComboBoxCTX';\nimport { ComboboxDataTestid } from '../ComboboxDataTestids';\n\nconst StyledDropDownButton = styled(DSButtonV2)`\n &:focus::after {\n border: none;\n }\n &:hover:not(:disabled) {\n background-color: transparent;\n }\n\n & svg {\n fill: ${({ theme, disabled }) => (disabled ? theme.colors.neutral['400'] : theme.colors.brand['700'])};\n }\n`;\n\nexport const DropdownIndicator = (): JSX.Element => {\n const {\n props: { disabled },\n menuState,\n } = useContext(ComboBoxContext);\n\n const handleOnClick = useCallback((e: React.MouseEvent) => {\n e.preventDefault();\n }, []);\n\n return (\n <StyledDropDownButton\n onClick={handleOnClick}\n data-testid={ComboboxDataTestid.DROPDOWN}\n aria-controls=\"combo-listbox\"\n aria-labelledby=\"combo-label\"\n disabled={disabled}\n aria-expanded={menuState}\n aria-haspopup=\"listbox\"\n aria-hidden\n buttonType=\"icon\"\n tabIndex={-1}\n >\n <ChevronSmallDown />\n </StyledDropDownButton>\n );\n};\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
6
|
-
"names": [
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB;AAEA,SAAgB,aAAa,kBAAkB;AAC/C,SAAS,cAAc;AACvB,SAAS,kBAAkB;AAC3B,SAAS,wBAAwB;AACjC,OAAO,qBAAqB;AAC5B,SAAS,0BAA0B;AAEnC,MAAM,uBAAuB,OAAO,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YASlC,CAAC,EAAE,OAAO,SAAS,MAAO,WAAW,MAAM,OAAO,QAAQ,SAAS,MAAM,OAAO,MAAM;AAAA;AAAA;AAI3F,MAAM,oBAAoB,MAAmB;AAClD,QAAM;AAAA,IACJ,OAAO,EAAE,SAAS;AAAA,IAClB;AAAA,EACF,IAAI,WAAW,eAAe;AAE9B,QAAM,gBAAgB,YAAY,CAAC,MAAwB;AACzD,MAAE,eAAe;AAAA,EACnB,GAAG,CAAC,CAAC;AAEL,SACE,oBAAC;AAAA,IACC,SAAS;AAAA,IACT,eAAa,mBAAmB;AAAA,IAChC,iBAAc;AAAA,IACd,mBAAgB;AAAA,IAChB;AAAA,IACA,iBAAe;AAAA,IACf,iBAAc;AAAA,IACd,eAAW;AAAA,IACX,YAAW;AAAA,IACX,UAAU;AAAA,IAEV,8BAAC,oBAAiB;AAAA,GACpB;AAEJ;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useCallback, useEffect, useMemo, useContext } from "react";
|
|
3
4
|
import { useGetGlobalAttributes, useGetXstyledProps } from "@elliemae/ds-utilities";
|
|
4
5
|
import { DSPopperJS } from "@elliemae/ds-popperjs";
|
|
5
6
|
import ComboBoxContext from "../../ComboBoxCTX";
|
|
@@ -31,26 +32,39 @@ const Container = () => {
|
|
|
31
32
|
};
|
|
32
33
|
}, [setMenuState]);
|
|
33
34
|
return useMemo(
|
|
34
|
-
() => /* @__PURE__ */
|
|
35
|
+
() => /* @__PURE__ */ jsx(StyledContainer, {
|
|
35
36
|
"data-testid": ComboboxDataTestid.CONTAINER,
|
|
36
37
|
ref: setReferenceElement,
|
|
37
38
|
...containerGlobals,
|
|
38
|
-
...xStyledProps
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
39
|
+
...xStyledProps,
|
|
40
|
+
children: inline ? /* @__PURE__ */ jsxs(Fragment, {
|
|
41
|
+
children: [
|
|
42
|
+
/* @__PURE__ */ jsx(Controls, {}),
|
|
43
|
+
/* @__PURE__ */ jsx(MenuList, {})
|
|
44
|
+
]
|
|
45
|
+
}) : /* @__PURE__ */ jsxs(Fragment, {
|
|
46
|
+
children: [
|
|
47
|
+
/* @__PURE__ */ jsx(Controls, {}),
|
|
48
|
+
/* @__PURE__ */ jsx(DSPopperJS, {
|
|
49
|
+
customOffset: [0, 5],
|
|
50
|
+
referenceElement,
|
|
51
|
+
showPopover: menuState,
|
|
52
|
+
closeContextMenu: handleCloseMenu,
|
|
53
|
+
startPlacementPreference,
|
|
54
|
+
placementOrderPreference,
|
|
55
|
+
withoutPortal,
|
|
56
|
+
withoutArrow: true,
|
|
57
|
+
withoutAnimation: true,
|
|
58
|
+
zIndex,
|
|
59
|
+
children: /* @__PURE__ */ jsx(StyledPopperWrapper, {
|
|
60
|
+
tabIndex: -1,
|
|
61
|
+
onMouseDown: handleMouseDown,
|
|
62
|
+
children: /* @__PURE__ */ jsx(MenuList, {})
|
|
63
|
+
})
|
|
64
|
+
})
|
|
65
|
+
]
|
|
66
|
+
})
|
|
67
|
+
}),
|
|
54
68
|
[
|
|
55
69
|
inline,
|
|
56
70
|
setReferenceElement,
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/container/Container.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable complexity */\nimport React, { useCallback, useEffect, useMemo, useContext } from 'react';\nimport { useGetGlobalAttributes, useGetXstyledProps } from '@elliemae/ds-utilities';\nimport { DSPopperJS } from '@elliemae/ds-popperjs';\nimport ComboBoxContext from '../../ComboBoxCTX';\nimport { StyledContainer, StyledPopperWrapper } from './styled';\nimport { Controls } from '../controls';\nimport { MenuList } from '../menu-list';\nimport { ComboboxDataTestid } from '../../ComboboxDataTestids';\n\nexport const Container = (): JSX.Element => {\n const { props, setMenuState, menuState, setReferenceElement, referenceElement } = useContext(ComboBoxContext);\n\n const { inline, innerRef, startPlacementPreference, placementOrderPreference, withoutPortal, zIndex } = props;\n const globalAttributes = useGetGlobalAttributes(props);\n const xStyledProps = useGetXstyledProps(props);\n // Removing possible collisionable props\n const { placeholder, onKeyDown, onChange, disabled, tabIndex, ...containerGlobals } = globalAttributes;\n const handleMouseDown = useCallback((e: React.MouseEvent) => {\n e.preventDefault();\n }, []);\n\n const handleCloseMenu = useCallback(() => {\n setMenuState(false, 'blur');\n if (innerRef?.current) innerRef.current.blur();\n }, [innerRef, setMenuState]);\n\n useEffect(() => {\n const closeMenuOnWindowBlur = () => {\n setMenuState(false, 'blur');\n };\n\n window.addEventListener('blur', closeMenuOnWindowBlur);\n\n return () => {\n window.removeEventListener('blur', closeMenuOnWindowBlur);\n };\n }, [setMenuState]);\n\n return useMemo(\n () => (\n <StyledContainer\n data-testid={ComboboxDataTestid.CONTAINER}\n ref={setReferenceElement}\n {...containerGlobals}\n {...xStyledProps}\n >\n {inline ? (\n <>\n <Controls />\n <MenuList />\n </>\n ) : (\n <>\n <Controls />\n <DSPopperJS\n customOffset={[0, 5]}\n referenceElement={referenceElement}\n showPopover={menuState}\n closeContextMenu={handleCloseMenu}\n startPlacementPreference={startPlacementPreference}\n placementOrderPreference={placementOrderPreference}\n withoutPortal={withoutPortal}\n withoutArrow\n withoutAnimation\n zIndex={zIndex}\n >\n <StyledPopperWrapper tabIndex={-1} onMouseDown={handleMouseDown}>\n <MenuList />\n </StyledPopperWrapper>\n </DSPopperJS>\n </>\n )}\n </StyledContainer>\n ),\n [\n inline,\n setReferenceElement,\n containerGlobals,\n referenceElement,\n menuState,\n xStyledProps,\n handleCloseMenu,\n startPlacementPreference,\n placementOrderPreference,\n withoutPortal,\n zIndex,\n handleMouseDown,\n ],\n );\n};\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
6
|
-
"names": [
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB;AACA,SAAgB,aAAa,WAAW,SAAS,kBAAkB;AACnE,SAAS,wBAAwB,0BAA0B;AAC3D,SAAS,kBAAkB;AAC3B,OAAO,qBAAqB;AAC5B,SAAS,iBAAiB,2BAA2B;AACrD,SAAS,gBAAgB;AACzB,SAAS,gBAAgB;AACzB,SAAS,0BAA0B;AAE5B,MAAM,YAAY,MAAmB;AAC1C,QAAM,EAAE,OAAO,cAAc,WAAW,qBAAqB,iBAAiB,IAAI,WAAW,eAAe;AAE5G,QAAM,EAAE,QAAQ,UAAU,0BAA0B,0BAA0B,eAAe,OAAO,IAAI;AACxG,QAAM,mBAAmB,uBAAuB,KAAK;AACrD,QAAM,eAAe,mBAAmB,KAAK;AAE7C,QAAM,EAAE,aAAa,WAAW,UAAU,UAAU,aAAa,iBAAiB,IAAI;AACtF,QAAM,kBAAkB,YAAY,CAAC,MAAwB;AAC3D,MAAE,eAAe;AAAA,EACnB,GAAG,CAAC,CAAC;AAEL,QAAM,kBAAkB,YAAY,MAAM;AACxC,iBAAa,OAAO,MAAM;AAC1B,QAAI,UAAU;AAAS,eAAS,QAAQ,KAAK;AAAA,EAC/C,GAAG,CAAC,UAAU,YAAY,CAAC;AAE3B,YAAU,MAAM;AACd,UAAM,wBAAwB,MAAM;AAClC,mBAAa,OAAO,MAAM;AAAA,IAC5B;AAEA,WAAO,iBAAiB,QAAQ,qBAAqB;AAErD,WAAO,MAAM;AACX,aAAO,oBAAoB,QAAQ,qBAAqB;AAAA,IAC1D;AAAA,EACF,GAAG,CAAC,YAAY,CAAC;AAEjB,SAAO;AAAA,IACL,MACE,oBAAC;AAAA,MACC,eAAa,mBAAmB;AAAA,MAChC,KAAK;AAAA,MACJ,GAAG;AAAA,MACH,GAAG;AAAA,MAEH,mBACC;AAAA,QACE;AAAA,8BAAC,YAAS;AAAA,UACV,oBAAC,YAAS;AAAA;AAAA,OACZ,IAEA;AAAA,QACE;AAAA,8BAAC,YAAS;AAAA,UACV,oBAAC;AAAA,YACC,cAAc,CAAC,GAAG,CAAC;AAAA,YACnB;AAAA,YACA,aAAa;AAAA,YACb,kBAAkB;AAAA,YAClB;AAAA,YACA;AAAA,YACA;AAAA,YACA,cAAY;AAAA,YACZ,kBAAgB;AAAA,YAChB;AAAA,YAEA,8BAAC;AAAA,cAAoB,UAAU;AAAA,cAAI,aAAa;AAAA,cAC9C,8BAAC,YAAS;AAAA,aACZ;AAAA,WACF;AAAA;AAAA,OACF;AAAA,KAEJ;AAAA,IAEF;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|