@elliemae/ds-form-combobox 3.70.0-next.2 → 3.70.0-next.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/ComboBox.js +9 -1
- package/dist/cjs/ComboBox.js.map +2 -2
- package/dist/cjs/DSComboboxMultiT.js +2 -0
- package/dist/cjs/DSComboboxMultiT.js.map +2 -2
- package/dist/cjs/DSComboboxSingleT.js +2 -0
- package/dist/cjs/DSComboboxSingleT.js.map +2 -2
- package/dist/cjs/TruncatedTooltipText.js +96 -0
- package/dist/cjs/TruncatedTooltipText.js.map +7 -0
- package/dist/cjs/constants/index.js +32 -4
- package/dist/cjs/constants/index.js.map +2 -2
- package/dist/cjs/parts/LiveRegion.js +13 -1
- package/dist/cjs/parts/LiveRegion.js.map +2 -2
- package/dist/cjs/parts/Section.js +3 -6
- package/dist/cjs/parts/Section.js.map +2 -2
- package/dist/cjs/parts/container/Container.js +21 -15
- package/dist/cjs/parts/container/Container.js.map +2 -2
- package/dist/cjs/parts/container/styled.js +7 -4
- package/dist/cjs/parts/container/styled.js.map +2 -2
- package/dist/cjs/parts/controls/Controls.js +22 -12
- package/dist/cjs/parts/controls/Controls.js.map +2 -2
- package/dist/cjs/parts/controls/styled.js +19 -7
- package/dist/cjs/parts/controls/styled.js.map +2 -2
- package/dist/cjs/parts/controls-input/ControlsInput.js +7 -7
- package/dist/cjs/parts/controls-input/ControlsInput.js.map +2 -2
- package/dist/cjs/parts/controls-input/styled.js +11 -5
- package/dist/cjs/parts/controls-input/styled.js.map +2 -2
- package/dist/cjs/parts/controls-input/useKeyboardNavigation.js +10 -2
- package/dist/cjs/parts/controls-input/useKeyboardNavigation.js.map +2 -2
- package/dist/cjs/parts/controls-input/useMaskedOnChange.js +1 -1
- package/dist/cjs/parts/controls-input/useMaskedOnChange.js.map +2 -2
- package/dist/cjs/parts/menu-list/LoadingContainer.js +28 -2
- package/dist/cjs/parts/menu-list/LoadingContainer.js.map +2 -2
- package/dist/cjs/parts/menu-list/MenuList.js +12 -4
- package/dist/cjs/parts/menu-list/MenuList.js.map +2 -2
- package/dist/cjs/parts/menu-list/SkeletonContainer.js +20 -1
- package/dist/cjs/parts/menu-list/SkeletonContainer.js.map +2 -2
- package/dist/cjs/parts/menu-list/styled.js +31 -5
- package/dist/cjs/parts/menu-list/styled.js.map +2 -2
- package/dist/cjs/parts/menu-list/useItemRenderer.js +30 -41
- package/dist/cjs/parts/menu-list/useItemRenderer.js.map +3 -3
- package/dist/cjs/parts/multi-selected-values-container/MultiSelectedValuesContainer.js +1 -1
- package/dist/cjs/parts/multi-selected-values-container/MultiSelectedValuesContainer.js.map +2 -2
- package/dist/cjs/parts/multi-selected-values-container/RemovableSelectedValuePill.js +5 -1
- package/dist/cjs/parts/multi-selected-values-container/RemovableSelectedValuePill.js.map +2 -2
- package/dist/cjs/parts/styled.js +4 -1
- package/dist/cjs/parts/styled.js.map +2 -2
- package/dist/cjs/react-desc-prop-types.js +2 -0
- package/dist/cjs/react-desc-prop-types.js.map +2 -2
- package/dist/cjs/typescript-testing/slot-props.js +82 -0
- package/dist/cjs/typescript-testing/slot-props.js.map +7 -0
- package/dist/cjs/typescript-testing/typescript-combobox-multi-valid.js +158 -0
- package/dist/cjs/typescript-testing/typescript-combobox-multi-valid.js.map +7 -0
- package/dist/cjs/typescript-testing/typescript-combobox-single-valid.js +158 -0
- package/dist/cjs/typescript-testing/typescript-combobox-single-valid.js.map +7 -0
- package/dist/cjs/utils/listHelper.js.map +2 -2
- package/dist/esm/ComboBox.js +10 -2
- package/dist/esm/ComboBox.js.map +2 -2
- package/dist/esm/DSComboboxMultiT.js +8 -1
- package/dist/esm/DSComboboxMultiT.js.map +2 -2
- package/dist/esm/DSComboboxSingleT.js +8 -1
- package/dist/esm/DSComboboxSingleT.js.map +2 -2
- package/dist/esm/TruncatedTooltipText.js +70 -0
- package/dist/esm/TruncatedTooltipText.js.map +7 -0
- package/dist/esm/constants/index.js +32 -4
- package/dist/esm/constants/index.js.map +2 -2
- package/dist/esm/parts/LiveRegion.js +13 -1
- package/dist/esm/parts/LiveRegion.js.map +2 -2
- package/dist/esm/parts/Section.js +4 -7
- package/dist/esm/parts/Section.js.map +2 -2
- package/dist/esm/parts/container/Container.js +21 -15
- package/dist/esm/parts/container/Container.js.map +2 -2
- package/dist/esm/parts/container/styled.js +7 -4
- package/dist/esm/parts/container/styled.js.map +2 -2
- package/dist/esm/parts/controls/Controls.js +22 -12
- package/dist/esm/parts/controls/Controls.js.map +2 -2
- package/dist/esm/parts/controls/styled.js +19 -7
- package/dist/esm/parts/controls/styled.js.map +2 -2
- package/dist/esm/parts/controls-input/ControlsInput.js +7 -7
- package/dist/esm/parts/controls-input/ControlsInput.js.map +2 -2
- package/dist/esm/parts/controls-input/styled.js +11 -5
- package/dist/esm/parts/controls-input/styled.js.map +2 -2
- package/dist/esm/parts/controls-input/useKeyboardNavigation.js +10 -2
- package/dist/esm/parts/controls-input/useKeyboardNavigation.js.map +2 -2
- package/dist/esm/parts/controls-input/useMaskedOnChange.js +1 -1
- package/dist/esm/parts/controls-input/useMaskedOnChange.js.map +2 -2
- package/dist/esm/parts/menu-list/LoadingContainer.js +28 -2
- package/dist/esm/parts/menu-list/LoadingContainer.js.map +2 -2
- package/dist/esm/parts/menu-list/MenuList.js +12 -4
- package/dist/esm/parts/menu-list/MenuList.js.map +2 -2
- package/dist/esm/parts/menu-list/SkeletonContainer.js +20 -1
- package/dist/esm/parts/menu-list/SkeletonContainer.js.map +2 -2
- package/dist/esm/parts/menu-list/styled.js +31 -5
- package/dist/esm/parts/menu-list/styled.js.map +2 -2
- package/dist/esm/parts/menu-list/useItemRenderer.js +30 -41
- package/dist/esm/parts/menu-list/useItemRenderer.js.map +2 -2
- package/dist/esm/parts/multi-selected-values-container/MultiSelectedValuesContainer.js +1 -1
- package/dist/esm/parts/multi-selected-values-container/MultiSelectedValuesContainer.js.map +2 -2
- package/dist/esm/parts/multi-selected-values-container/RemovableSelectedValuePill.js +5 -1
- package/dist/esm/parts/multi-selected-values-container/RemovableSelectedValuePill.js.map +2 -2
- package/dist/esm/parts/styled.js +4 -1
- package/dist/esm/parts/styled.js.map +2 -2
- package/dist/esm/react-desc-prop-types.js +8 -1
- package/dist/esm/react-desc-prop-types.js.map +2 -2
- package/dist/esm/typescript-testing/slot-props.js +59 -0
- package/dist/esm/typescript-testing/slot-props.js.map +7 -0
- package/dist/esm/typescript-testing/typescript-combobox-multi-valid.js +135 -0
- package/dist/esm/typescript-testing/typescript-combobox-multi-valid.js.map +7 -0
- package/dist/esm/typescript-testing/typescript-combobox-single-valid.js +135 -0
- package/dist/esm/typescript-testing/typescript-combobox-single-valid.js.map +7 -0
- package/dist/esm/utils/listHelper.js.map +2 -2
- package/dist/types/DSComboboxMultiT.d.ts +3 -1
- package/dist/types/DSComboboxSingleT.d.ts +3 -1
- package/dist/types/TruncatedTooltipText.d.ts +8 -0
- package/dist/types/constants/index.d.ts +80 -2
- package/dist/types/parts/LiveRegion.d.ts +21 -0
- package/dist/types/parts/Section.d.ts +4 -4
- package/dist/types/parts/menu-list/LoadingContainer.d.ts +3 -1
- package/dist/types/parts/menu-list/SkeletonContainer.d.ts +2 -1
- package/dist/types/parts/menu-list/styled.d.ts +2 -0
- package/dist/types/parts/menu-list/useItemRenderer.d.ts +2 -1
- package/dist/types/parts/multi-selected-values-container/RemovableSelectedValuePill.d.ts +1 -1
- package/dist/types/react-desc-prop-types.d.ts +28 -0
- package/dist/types/tests/DSCombobox.pui-18034.test.d.ts +1 -0
- package/dist/types/tests/DSCombobox.read-only.test.d.ts +1 -0
- package/dist/types/tests/DSCombobox.single-select.test.d.ts +1 -0
- package/dist/types/tests/DSCombobox.usemask.test.d.ts +1 -0
- package/dist/types/typescript-testing/slot-props.d.ts +1 -0
- package/dist/types/typescript-testing/typescript-combobox-multi-valid.d.ts +1 -0
- package/dist/types/typescript-testing/typescript-combobox-single-valid.d.ts +1 -0
- package/dist/types/utils/listHelper.d.ts +1 -1
- package/package.json +15 -16
- package/dist/cjs/config/useClickOutside.js +0 -52
- package/dist/cjs/config/useClickOutside.js.map +0 -7
- package/dist/esm/config/useClickOutside.js +0 -22
- package/dist/esm/config/useClickOutside.js.map +0 -7
- package/dist/types/config/useClickOutside.d.ts +0 -1
- /package/dist/types/tests/{a11y.test.d.ts → DSCombobox.a11y.test.d.ts} +0 -0
- /package/dist/types/tests/{creatable.test.d.ts → DSCombobox.api.test.d.ts} +0 -0
- /package/dist/types/tests/{disabled.test.d.ts → DSCombobox.creatable.test.d.ts} +0 -0
- /package/dist/types/tests/{force-focus-first-option-on-type.test.d.ts → DSCombobox.data-testid.test.d.ts} +0 -0
- /package/dist/types/tests/{general.test.d.ts → DSCombobox.disabled.test.d.ts} +0 -0
- /package/dist/types/tests/{multi-select.test.d.ts → DSCombobox.events.test.d.ts} +0 -0
- /package/dist/types/tests/{onlyselectable.test.d.ts → DSCombobox.force-focus-first-option-on-type.test.d.ts} +0 -0
- /package/dist/types/tests/{read-only.test.d.ts → DSCombobox.keyboard.test.d.ts} +0 -0
- /package/dist/types/tests/{single-select.test.d.ts → DSCombobox.multi-select.test.d.ts} +0 -0
- /package/dist/types/tests/{usemask.test.d.ts → DSCombobox.onlyselectable.test.d.ts} +0 -0
|
@@ -1,26 +1,52 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { styled } from "@elliemae/ds-system";
|
|
3
3
|
import { Grid } from "@elliemae/ds-grid";
|
|
4
|
-
|
|
4
|
+
import { SingleMenuItem, MultiMenuItem } from "@elliemae/ds-menu-items";
|
|
5
|
+
import { DSFormComboboxName, FORM_COMBOBOX_SLOTS } from "../../constants/index.js";
|
|
6
|
+
const StyledListWrapper = styled(Grid, {
|
|
7
|
+
name: DSFormComboboxName,
|
|
8
|
+
slot: FORM_COMBOBOX_SLOTS.LIST_WRAPPER
|
|
9
|
+
})`
|
|
5
10
|
min-width: ${({ inline, minWidth }) => inline ? "100%" : `${String(minWidth)}px`};
|
|
6
11
|
width: ${({ width }) => `${width}px`};
|
|
7
12
|
background-color: #ffffff;
|
|
8
13
|
z-index: 100;
|
|
9
14
|
`;
|
|
10
|
-
const StyledCreatableLabel = styled
|
|
15
|
+
const StyledCreatableLabel = styled("span", {
|
|
16
|
+
name: DSFormComboboxName,
|
|
17
|
+
slot: FORM_COMBOBOX_SLOTS.CREATABLE_LABEL
|
|
18
|
+
})`
|
|
11
19
|
font-weight: bold;
|
|
12
20
|
font-style: italic;
|
|
13
21
|
`;
|
|
14
|
-
const StyledCreatableValue = styled
|
|
22
|
+
const StyledCreatableValue = styled("span", {
|
|
23
|
+
name: DSFormComboboxName,
|
|
24
|
+
slot: FORM_COMBOBOX_SLOTS.CREATABLE_VALUE
|
|
25
|
+
})`
|
|
15
26
|
word-break: break-all;
|
|
16
27
|
`;
|
|
17
|
-
const StyledNoResultsWrapper = styled
|
|
28
|
+
const StyledNoResultsWrapper = styled("div", {
|
|
29
|
+
name: DSFormComboboxName,
|
|
30
|
+
slot: FORM_COMBOBOX_SLOTS.NO_MATCHES_FOUND
|
|
31
|
+
})`
|
|
18
32
|
padding: 14px;
|
|
19
33
|
`;
|
|
34
|
+
const StyledSingleMenuItem = styled(SingleMenuItem, {
|
|
35
|
+
name: DSFormComboboxName,
|
|
36
|
+
slot: FORM_COMBOBOX_SLOTS.SINGLE_MENU_ITEM,
|
|
37
|
+
preserveLegacyDataTestId: true
|
|
38
|
+
})``;
|
|
39
|
+
const StyledMultiMenuItem = styled(MultiMenuItem, {
|
|
40
|
+
name: DSFormComboboxName,
|
|
41
|
+
slot: FORM_COMBOBOX_SLOTS.MULTI_MENU_ITEM,
|
|
42
|
+
preserveLegacyDataTestId: true
|
|
43
|
+
})``;
|
|
20
44
|
export {
|
|
21
45
|
StyledCreatableLabel,
|
|
22
46
|
StyledCreatableValue,
|
|
23
47
|
StyledListWrapper,
|
|
24
|
-
|
|
48
|
+
StyledMultiMenuItem,
|
|
49
|
+
StyledNoResultsWrapper,
|
|
50
|
+
StyledSingleMenuItem
|
|
25
51
|
};
|
|
26
52
|
//# 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/menu-list/styled.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { styled } from '@elliemae/ds-system';\nimport type { SizingProps } from '@elliemae/ds-system';\nimport { Grid } from '@elliemae/ds-grid';\n\ninterface StyledListWrapperT {\n minWidth: SizingProps['minWidth'];\n maxHeight?: SizingProps['maxHeight'];\n width: number | string;\n inline?: boolean;\n}\nexport const StyledListWrapper = styled(Grid)<StyledListWrapperT>`\n min-width: ${({ inline, minWidth }) => (inline ? '100%' : `${String(minWidth)}px`)};\n width: ${({ width }) => `${width}px`};\n background-color: #ffffff;\n z-index: 100;\n`;\n\nexport const StyledCreatableLabel = styled.
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,cAAc;AAEvB,SAAS,YAAY;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { styled } from '@elliemae/ds-system';\nimport type { SizingProps } from '@elliemae/ds-system';\nimport { Grid } from '@elliemae/ds-grid';\nimport { SingleMenuItem, MultiMenuItem } from '@elliemae/ds-menu-items';\nimport { DSFormComboboxName, FORM_COMBOBOX_SLOTS } from '../../constants/index.js';\n\ninterface StyledListWrapperT {\n minWidth: SizingProps['minWidth'];\n maxHeight?: SizingProps['maxHeight'];\n width: number | string;\n inline?: boolean;\n}\nexport const StyledListWrapper = styled(Grid, {\n name: DSFormComboboxName,\n slot: FORM_COMBOBOX_SLOTS.LIST_WRAPPER,\n})<StyledListWrapperT>`\n min-width: ${({ inline, minWidth }) => (inline ? '100%' : `${String(minWidth)}px`)};\n width: ${({ width }) => `${width}px`};\n background-color: #ffffff;\n z-index: 100;\n`;\n\nexport const StyledCreatableLabel = styled('span', {\n name: DSFormComboboxName,\n slot: FORM_COMBOBOX_SLOTS.CREATABLE_LABEL,\n})`\n font-weight: bold;\n font-style: italic;\n`;\n\nexport const StyledCreatableValue = styled('span', {\n name: DSFormComboboxName,\n slot: FORM_COMBOBOX_SLOTS.CREATABLE_VALUE,\n})`\n word-break: break-all;\n`;\n\nexport const StyledNoResultsWrapper = styled('div', {\n name: DSFormComboboxName,\n slot: FORM_COMBOBOX_SLOTS.NO_MATCHES_FOUND,\n})`\n padding: 14px;\n`;\n\nexport const StyledSingleMenuItem = styled(SingleMenuItem, {\n name: DSFormComboboxName,\n slot: FORM_COMBOBOX_SLOTS.SINGLE_MENU_ITEM,\n preserveLegacyDataTestId: true,\n})``;\n\nexport const StyledMultiMenuItem = styled(MultiMenuItem, {\n name: DSFormComboboxName,\n slot: FORM_COMBOBOX_SLOTS.MULTI_MENU_ITEM,\n preserveLegacyDataTestId: true,\n})``;\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,cAAc;AAEvB,SAAS,YAAY;AACrB,SAAS,gBAAgB,qBAAqB;AAC9C,SAAS,oBAAoB,2BAA2B;AAQjD,MAAM,oBAAoB,OAAO,MAAM;AAAA,EAC5C,MAAM;AAAA,EACN,MAAM,oBAAoB;AAC5B,CAAC;AAAA,eACc,CAAC,EAAE,QAAQ,SAAS,MAAO,SAAS,SAAS,GAAG,OAAO,QAAQ,CAAC,IAAK;AAAA,WACzE,CAAC,EAAE,MAAM,MAAM,GAAG,KAAK,IAAI;AAAA;AAAA;AAAA;AAK/B,MAAM,uBAAuB,OAAO,QAAQ;AAAA,EACjD,MAAM;AAAA,EACN,MAAM,oBAAoB;AAC5B,CAAC;AAAA;AAAA;AAAA;AAKM,MAAM,uBAAuB,OAAO,QAAQ;AAAA,EACjD,MAAM;AAAA,EACN,MAAM,oBAAoB;AAC5B,CAAC;AAAA;AAAA;AAIM,MAAM,yBAAyB,OAAO,OAAO;AAAA,EAClD,MAAM;AAAA,EACN,MAAM,oBAAoB;AAC5B,CAAC;AAAA;AAAA;AAIM,MAAM,uBAAuB,OAAO,gBAAgB;AAAA,EACzD,MAAM;AAAA,EACN,MAAM,oBAAoB;AAAA,EAC1B,0BAA0B;AAC5B,CAAC;AAEM,MAAM,sBAAsB,OAAO,eAAe;AAAA,EACvD,MAAM;AAAA,EACN,MAAM,oBAAoB;AAAA,EAC1B,0BAA0B;AAC5B,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,26 +2,14 @@ import * as React from "react";
|
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useMemo, useContext, useCallback } from "react";
|
|
4
4
|
import { Grid } from "@elliemae/ds-grid";
|
|
5
|
-
import {
|
|
6
|
-
import { styled } from "@elliemae/ds-system";
|
|
5
|
+
import { Separator } from "@elliemae/ds-menu-items";
|
|
7
6
|
import { useOwnerProps } from "@elliemae/ds-props-helpers";
|
|
8
7
|
import { Section } from "../Section.js";
|
|
9
8
|
import { ComboBoxContext } from "../../ComboBoxCTX.js";
|
|
10
|
-
import { StyledCreatableLabel, StyledCreatableValue } from "./styled.js";
|
|
9
|
+
import { StyledCreatableLabel, StyledCreatableValue, StyledSingleMenuItem, StyledMultiMenuItem } from "./styled.js";
|
|
11
10
|
import { isSelected, getSuggestedValueOnChange } from "../../utils/listHelper.js";
|
|
12
11
|
import { ComboboxDataTestid } from "../../ComboboxDataTestids.js";
|
|
13
12
|
import { MENU_OPTION_TYPES, INTERNAL_MENU_OPTION_TYPES } from "../../constants.js";
|
|
14
|
-
import { DSFormComboboxName, FORM_COMBOBOX_SLOTS } from "../../constants/index.js";
|
|
15
|
-
const StyledSingleMenuItem = styled(SingleMenuItem, {
|
|
16
|
-
name: DSFormComboboxName,
|
|
17
|
-
slot: FORM_COMBOBOX_SLOTS.SINGLE_MENU_ITEM,
|
|
18
|
-
preserveLegacyDataTestId: true
|
|
19
|
-
})``;
|
|
20
|
-
const StyledMultiMenuItem = styled(MultiMenuItem, {
|
|
21
|
-
name: DSFormComboboxName,
|
|
22
|
-
slot: FORM_COMBOBOX_SLOTS.MULTI_MENU_ITEM,
|
|
23
|
-
preserveLegacyDataTestId: true
|
|
24
|
-
})``;
|
|
25
13
|
const ItemRenderer = ({ index, extraItemProps }) => {
|
|
26
14
|
const {
|
|
27
15
|
props,
|
|
@@ -59,7 +47,11 @@ const ItemRenderer = ({ index, extraItemProps }) => {
|
|
|
59
47
|
if (!multiple) {
|
|
60
48
|
setMenuState(false, "selectOption", e);
|
|
61
49
|
}
|
|
62
|
-
onChange(
|
|
50
|
+
onChange(
|
|
51
|
+
getSuggestedValueOnChange(currentOption, selectedValues, isNonClearable),
|
|
52
|
+
currentOption,
|
|
53
|
+
e
|
|
54
|
+
);
|
|
63
55
|
}
|
|
64
56
|
}
|
|
65
57
|
e.stopPropagation();
|
|
@@ -80,7 +72,7 @@ const ItemRenderer = ({ index, extraItemProps }) => {
|
|
|
80
72
|
dsId: dsId.toString(),
|
|
81
73
|
...rest
|
|
82
74
|
};
|
|
83
|
-
if (type === MENU_OPTION_TYPES.SECTION) {
|
|
75
|
+
if (option.type === MENU_OPTION_TYPES.SECTION) {
|
|
84
76
|
return /* @__PURE__ */ jsx(
|
|
85
77
|
Section,
|
|
86
78
|
{
|
|
@@ -100,29 +92,26 @@ const ItemRenderer = ({ index, extraItemProps }) => {
|
|
|
100
92
|
return /* @__PURE__ */ jsx(Separator, { ...generalProps, render: void 0 });
|
|
101
93
|
}
|
|
102
94
|
if (option.type === MENU_OPTION_TYPES.OPTION) {
|
|
103
|
-
return (
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
getOwnerPropsArguments
|
|
124
|
-
}
|
|
125
|
-
)
|
|
95
|
+
return /* @__PURE__ */ jsx(
|
|
96
|
+
CBItem,
|
|
97
|
+
{
|
|
98
|
+
...generalProps,
|
|
99
|
+
value: option.value,
|
|
100
|
+
label: option.label,
|
|
101
|
+
dataTestid: ComboboxDataTestid.OPTION,
|
|
102
|
+
disabled,
|
|
103
|
+
applyAriaDisabled: applyAriaDisabled || itemReadOnly,
|
|
104
|
+
onClick: (e) => {
|
|
105
|
+
if (applyAriaDisabled) return;
|
|
106
|
+
handleClick(option, e);
|
|
107
|
+
},
|
|
108
|
+
onMouseDown: handleOnMouseDown,
|
|
109
|
+
isActive: dsId === focusOptionIdx,
|
|
110
|
+
tabIndex: -1,
|
|
111
|
+
isSelected: isSelected(selectedValues, option),
|
|
112
|
+
getOwnerProps,
|
|
113
|
+
getOwnerPropsArguments
|
|
114
|
+
}
|
|
126
115
|
);
|
|
127
116
|
}
|
|
128
117
|
if (type === INTERNAL_MENU_OPTION_TYPES.CREATABLE) {
|
|
@@ -135,8 +124,8 @@ const ItemRenderer = ({ index, extraItemProps }) => {
|
|
|
135
124
|
isActive: dsId === focusOptionIdx,
|
|
136
125
|
...generalProps,
|
|
137
126
|
render: ({ label: labelCreatable }) => /* @__PURE__ */ jsxs(Grid, { p: "8px", cols: ["min-content", "auto"], gutter: "xxs", alignItems: "center", children: [
|
|
138
|
-
/* @__PURE__ */ jsx(StyledCreatableLabel, { children: "Add:" }),
|
|
139
|
-
/* @__PURE__ */ jsx(StyledCreatableValue, { children: `"${labelCreatable}"` })
|
|
127
|
+
/* @__PURE__ */ jsx(StyledCreatableLabel, { getOwnerProps, children: "Add:" }),
|
|
128
|
+
/* @__PURE__ */ jsx(StyledCreatableValue, { getOwnerProps, children: `"${labelCreatable}"` })
|
|
140
129
|
] }),
|
|
141
130
|
label: option.label,
|
|
142
131
|
onClick: handleOnCreateClick,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/menu-list/useItemRenderer.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* 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 {
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* 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 { Separator } from '@elliemae/ds-menu-items';\nimport { useOwnerProps } from '@elliemae/ds-props-helpers';\nimport { Section } from '../Section.js';\nimport { ComboBoxContext } from '../../ComboBoxCTX.js';\nimport { StyledCreatableLabel, StyledCreatableValue, StyledSingleMenuItem, StyledMultiMenuItem } from './styled.js';\nimport { isSelected, getSuggestedValueOnChange } from '../../utils/listHelper.js';\nimport { ComboboxDataTestid } from '../../ComboboxDataTestids.js';\nimport type { DSComboboxT } from '../../react-desc-prop-types.js';\nimport { MENU_OPTION_TYPES, INTERNAL_MENU_OPTION_TYPES } from '../../constants.js';\n\ninterface ItemRendererT {\n extraItemProps?: {\n itemList?: DSComboboxT.OptionTypes[];\n };\n index: number;\n}\n\nexport const ItemRenderer = ({ index, extraItemProps }: ItemRendererT): React.ReactElement | null => {\n const {\n props,\n props: { onCreate, onChange, isNonClearable, selectedValues, onFilter, allOptions, readOnly },\n setMenuState,\n inputValue,\n focusOptionIdx,\n setInputValue,\n optionsPerSection,\n } = useContext(ComboBoxContext);\n\n const { getOwnerProps } = useOwnerProps(props);\n const getOwnerPropsArguments = useCallback(\n () => ({\n index,\n }),\n [index],\n );\n\n const option = extraItemProps?.itemList?.[index];\n\n const multiple = Array.isArray(selectedValues);\n const CBItem: React.ComponentType<React.ComponentProps<typeof StyledSingleMenuItem>> = multiple\n ? StyledMultiMenuItem\n : StyledSingleMenuItem;\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\n const handleClick = useCallback(\n (currentOption: DSComboboxT.OptionTypes, e: React.MouseEvent) => {\n if (readOnly) return;\n if (currentOption.type === MENU_OPTION_TYPES.OPTION) {\n if (!currentOption.disabled) {\n if (onFilter) onFilter(allOptions, inputValue);\n setInputValue('');\n if (!multiple) {\n setMenuState(false, 'selectOption', e);\n }\n (onChange as (v: DSComboboxT.SelectedOptionsT, ...args: unknown[]) => void)(\n getSuggestedValueOnChange(currentOption, selectedValues, isNonClearable),\n currentOption,\n e,\n );\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 (option) {\n const { dsId, type, disabled, applyAriaDisabled, readOnly: itemReadOnly, ...rest } = option;\n const generalProps = {\n // 'aria-setsize': `${allOptions.length}`,\n // 'aria-posinset': `${vItem.index + 1}`,\n key: `${dsId}`,\n dsId: dsId.toString(),\n ...rest,\n };\n if (option.type === MENU_OPTION_TYPES.SECTION) {\n return (\n <Section\n label={option.label}\n {...generalProps}\n options={option.options}\n handleClick={handleClick}\n focusOptionIdx={focusOptionIdx}\n handleOnMouseDown={handleOnMouseDown}\n selectedValues={selectedValues}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n />\n );\n }\n if (type === MENU_OPTION_TYPES.SEPARATOR) {\n return <Separator {...generalProps} render={undefined} />;\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 applyAriaDisabled={applyAriaDisabled || itemReadOnly}\n onClick={(e: React.MouseEvent) => {\n if (applyAriaDisabled) return;\n handleClick(option, e);\n }}\n onMouseDown={handleOnMouseDown}\n isActive={dsId === focusOptionIdx}\n tabIndex={-1}\n isSelected={isSelected(selectedValues, option)}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n />\n );\n }\n if (type === INTERNAL_MENU_OPTION_TYPES.CREATABLE) {\n return (\n <StyledSingleMenuItem\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\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 getOwnerProps={getOwnerProps}>Add:</StyledCreatableLabel>\n <StyledCreatableValue getOwnerProps={getOwnerProps}>{`\"${labelCreatable}\"`}</StyledCreatableValue>\n </Grid>\n )}\n label={option.label}\n onClick={handleOnCreateClick}\n tabIndex={-1}\n />\n );\n }\n return null;\n }\n return null;\n }, [optionsPerSection, focusOptionIdx, selectedValues, allOptions, onCreate, inputValue, readOnly]);\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACiGb,cA+CI,YA/CJ;AA9FV,SAAgB,SAAS,YAAY,mBAAmB;AACxD,SAAS,YAAY;AACrB,SAAS,iBAAiB;AAC1B,SAAS,qBAAqB;AAC9B,SAAS,eAAe;AACxB,SAAS,uBAAuB;AAChC,SAAS,sBAAsB,sBAAsB,sBAAsB,2BAA2B;AACtG,SAAS,YAAY,iCAAiC;AACtD,SAAS,0BAA0B;AAEnC,SAAS,mBAAmB,kCAAkC;AASvD,MAAM,eAAe,CAAC,EAAE,OAAO,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eAAe,MAAM,GAAG,QAAO,OAAM,YAAW,UACnE;AAAA,kCAAC,wBAAqB,eAA8B,kBAAI;AAAA,cACxD,oBAAC,wBAAqB,eAA+B,cAAI,cAAc,KAAI;AAAA,eAC7E;AAAA,YAEF,OAAO,OAAO;AAAA,YACd,SAAS;AAAA,YACT,UAAU;AAAA;AAAA,QACZ;AAAA,MAEJ;AACA,aAAO;AAAA,IACT;AACA,WAAO;AAAA,EACT,GAAG,CAAC,mBAAmB,gBAAgB,gBAAgB,YAAY,UAAU,YAAY,QAAQ,CAAC;AACpG;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -22,7 +22,7 @@ const MultiSelectedValuesContainer = () => {
|
|
|
22
22
|
{
|
|
23
23
|
style: { width: multiSelectedValue.length > 0 ? "max-content" : "0px" },
|
|
24
24
|
"data-testid": ComboboxDataTestid.SELECTED_VALUES,
|
|
25
|
-
children: /* @__PURE__ */ jsxs(StyledDSPillGroupV2, { innerRef: pillGroupRef, children: [
|
|
25
|
+
children: /* @__PURE__ */ jsxs(StyledDSPillGroupV2, { innerRef: pillGroupRef, getOwnerProps: ownerProps.getOwnerProps, children: [
|
|
26
26
|
multiSelectedValue.length > 0 && multiSelectedValue.slice(0, correctPillsToShow).map((pill, idx) => /* @__PURE__ */ jsx(
|
|
27
27
|
RemovableSelectedValuePill,
|
|
28
28
|
{
|
|
@@ -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 { 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 { StyledDSPillGroupV2, 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 <StyledDSPillGroupV2 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 </StyledDSPillGroupV2>\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;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { 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 { StyledDSPillGroupV2, 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 // useOwnerProps returns () => {} for getOwnerPropsArguments, but OwnerInterface expects () => object.\n // The cast is safe \u2014 the actual return is always a plain object at runtime.\n const ownerProps = useOwnerProps(props) as {\n getOwnerProps: () => object;\n getOwnerPropsArguments: () => object;\n };\n\n return useMemo(\n () => (\n <div\n style={{ width: multiSelectedValue.length > 0 ? 'max-content' : '0px' }}\n data-testid={ComboboxDataTestid.SELECTED_VALUES}\n >\n <StyledDSPillGroupV2 innerRef={pillGroupRef} getOwnerProps={ownerProps.getOwnerProps}>\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 </StyledDSPillGroupV2>\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;ACgCf,SAKQ,KALR;AAhCR,SAAS,qBAAqB;AAC9B,SAAS,YAAY,eAAe;AACpC,OAAO,qBAAqB;AAC5B,SAAS,0BAA0B;AAEnC,SAAS,qBAAqB,sBAAsB;AACpD,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;AAGzC,QAAM,aAAa,cAAc,KAAK;AAKtC,SAAO;AAAA,IACL,MACE;AAAA,MAAC;AAAA;AAAA,QACC,OAAO,EAAE,OAAO,mBAAmB,SAAS,IAAI,gBAAgB,MAAM;AAAA,QACtE,eAAa,mBAAmB;AAAA,QAEhC,+BAAC,uBAAoB,UAAU,cAAc,eAAe,WAAW,eACpE;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
|
}
|
|
@@ -43,7 +43,11 @@ const RemovableSelectedValuePill = (props) => {
|
|
|
43
43
|
onRemove: (e) => {
|
|
44
44
|
if (readOnly) return;
|
|
45
45
|
e.stopPropagation();
|
|
46
|
-
onChange(
|
|
46
|
+
onChange(
|
|
47
|
+
getSuggestedValueOnChange(pill, selectedValues),
|
|
48
|
+
pill,
|
|
49
|
+
e
|
|
50
|
+
);
|
|
47
51
|
internalRef.current?.focus();
|
|
48
52
|
},
|
|
49
53
|
...ownerProps
|
|
@@ -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 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: () =>
|
|
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,gBAAc;AAAA,MACd,UAAU,CAAC,MAA8C;AACvD,YAAI,SAAU;AAEd,UAAE,gBAAgB;AAClB,
|
|
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: () => object;\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 labelTruncated\n onRemove={(e: React.KeyboardEvent | React.MouseEvent) => {\n if (readOnly) return;\n // preventing the menu to be opened\n e.stopPropagation();\n (onChange as (v: DSComboboxT.SelectedOptionsT, ...args: unknown[]) => void)(\n getSuggestedValueOnChange(pill, selectedValues),\n pill,\n e,\n );\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,gBAAc;AAAA,MACd,UAAU,CAAC,MAA8C;AACvD,YAAI,SAAU;AAEd,UAAE,gBAAgB;AAClB,QAAC;AAAA,UACC,0BAA0B,MAAM,cAAc;AAAA,UAC9C;AAAA,UACA;AAAA,QACF;AACA,oBAAY,SAAS,MAAM;AAAA,MAC7B;AAAA,MACC,GAAG;AAAA;AAAA,IArBC,KAAK;AAAA,EAsBZ;AAEJ;",
|
|
6
6
|
"names": ["React"]
|
|
7
7
|
}
|
package/dist/esm/parts/styled.js
CHANGED
|
@@ -27,7 +27,10 @@ const StyledDSPillV2 = styled(DSPillV2, {
|
|
|
27
27
|
|
|
28
28
|
color: ${({ theme, disabled, applyAriaDisabled, readOnly }) => disabled || applyAriaDisabled || readOnly ? "#616b7f" : theme.colors.brand["800"]};
|
|
29
29
|
`;
|
|
30
|
-
const StyledDSPillGroupV2 = styled(DSPillGroupV2
|
|
30
|
+
const StyledDSPillGroupV2 = styled(DSPillGroupV2, {
|
|
31
|
+
name: DSFormComboboxName,
|
|
32
|
+
slot: FORM_COMBOBOX_SLOTS.PILL_GROUP
|
|
33
|
+
})`
|
|
31
34
|
display: grid;
|
|
32
35
|
`;
|
|
33
36
|
export {
|
|
@@ -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 { DSPillV2, DSPillGroupV2 } 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\n/*\n * PUI-17945: https://jira.elliemae.io/browse/PUI-17945\n * By new Pills designs, pills should wrap to new lines when there is not enough horizontal space,\n * but for Combobox we want to keep them in one line and show a \"+X\" pill when there are more selected values than the max pills to show,\n * so we are changing its display property to grid instead of flex.\n
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,UAAU,qBAAqB;AACxC,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;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { DSPillV2, DSPillGroupV2 } 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\n/*\n * PUI-17945: https://jira.elliemae.io/browse/PUI-17945\n * By new Pills designs, pills should wrap to new lines when there is not enough horizontal space,\n * but for Combobox we want to keep them in one line and show a \"+X\" pill when there are more selected values than the max pills to show,\n * so we are changing its display property to grid instead of flex.\n */\n\nexport const StyledDSPillGroupV2 = styled(DSPillGroupV2, {\n name: DSFormComboboxName,\n slot: FORM_COMBOBOX_SLOTS.PILL_GROUP,\n})`\n display: grid;\n`;\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,UAAU,qBAAqB;AACxC,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;AAU9E,MAAM,sBAAsB,OAAO,eAAe;AAAA,EACvD,MAAM;AAAA,EACN,MAAM,oBAAoB;AAC5B,CAAC;AAAA;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { createRef } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
getPropsPerSlotPropTypes,
|
|
5
|
+
globalAttributesPropTypes,
|
|
6
|
+
PropTypes,
|
|
7
|
+
xstyledPropTypes
|
|
8
|
+
} from "@elliemae/ds-props-helpers";
|
|
4
9
|
import { commonComboboxPropTypes } from "./DSCommonComboboxPropsT.js";
|
|
10
|
+
import { DSFormComboboxName, FORM_COMBOBOX_SLOTS } from "./constants/index.js";
|
|
5
11
|
const defaultProps = {
|
|
6
12
|
hasError: false,
|
|
7
13
|
inline: false,
|
|
@@ -24,6 +30,7 @@ const defaultProps = {
|
|
|
24
30
|
menuMaxHeight: 300
|
|
25
31
|
};
|
|
26
32
|
const ComboboxPropTypes = {
|
|
33
|
+
...getPropsPerSlotPropTypes(DSFormComboboxName, FORM_COMBOBOX_SLOTS),
|
|
27
34
|
...globalAttributesPropTypes,
|
|
28
35
|
...xstyledPropTypes,
|
|
29
36
|
...commonComboboxPropTypes,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/react-desc-prop-types.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { createRef } from 'react';\nimport type { DSPropTypesSchema, ValidationMap } from '@elliemae/ds-props-helpers';\nimport {
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,iBAAiB;AAE1B,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { createRef } from 'react';\nimport type { DSPropTypesSchema, ValidationMap } from '@elliemae/ds-props-helpers';\nimport {\n getPropsPerSlotPropTypes,\n globalAttributesPropTypes,\n PropTypes,\n xstyledPropTypes,\n} from '@elliemae/ds-props-helpers';\nimport type { DSComboboxMultiT } from './DSComboboxMultiT.js';\nimport type { DSComboboxSingleT } from './DSComboboxSingleT.js';\nimport { commonComboboxPropTypes, type DSCommonComboboxPropsT } from './DSCommonComboboxPropsT.js';\nimport { DSFormComboboxName, FORM_COMBOBOX_SLOTS } from './constants/index.js';\n\nexport declare namespace DSComboboxT {\n export type SlotFunctionArguments = {\n dsComboboxRoot: () => object;\n dsComboboxInputWrapper: () => object;\n dsComboboxInput: () => object;\n dsComboboxDropdownButton: () => object;\n dsComboboxFastList: () => object;\n dsComboboxSectionWrapper: () => object;\n dsComboboxSectionLabel: () => object;\n dsComboboxSingleMenuItem: () => object;\n dsComboboxMultiMenuItem: () => object;\n dsComboboxLoadingIndicator: () => object;\n dsComboboxSkeletonMenuItem: () => object;\n dsComboboxPill: () => object;\n dsComboboxPillGroup: () => object;\n dsComboboxPopperWrapper: () => object;\n dsComboboxSelection: () => object;\n dsComboboxSingleValueWrapper: () => object;\n dsComboboxHeaderActions: () => object;\n dsComboboxHeaderActionsSeparator: () => object;\n dsComboboxInputPlaceholder: () => object;\n dsComboboxInputFieldWrapper: () => object;\n dsComboboxListWrapper: () => object;\n dsComboboxNoResults: () => object;\n dsComboboxCreatableLabel: () => object;\n dsComboboxCreatableValue: () => object;\n dsComboboxMenuItemsWrapper: () => object;\n dsComboboxLoadingWrapper: () => object;\n };\n\n export type CommonItemOptions = DSCommonComboboxPropsT.CommonItemOptions;\n export type ItemSeparatorOptions = DSCommonComboboxPropsT.ItemSeparatorOptions;\n export type ItemSectionOptions = DSCommonComboboxPropsT.ItemSectionOptions;\n export type ItemOption = DSCommonComboboxPropsT.ItemOption;\n export type ItemCreatableOption = DSCommonComboboxPropsT.ItemCreatableOption;\n\n export type SelectionableOptions = DSCommonComboboxPropsT.SelectionableOptions;\n export type LayoutOptions = DSCommonComboboxPropsT.LayoutOptions;\n export type OptionTypes = DSCommonComboboxPropsT.OptionTypes;\n\n export type SelectedOptionsT = ItemOption[] | ItemOption | null;\n\n type SingleComboboxRequirePropsRenameInterface = Omit<DSComboboxSingleT.RequiredProps, 'selectedValue'> & {\n selectedValues: DSComboboxSingleT.RequiredProps['selectedValue'];\n };\n\n export type RequiredProps<\n T extends DSCommonComboboxPropsT.ItemOption | DSCommonComboboxPropsT.ItemOption[] | null =\n | DSCommonComboboxPropsT.ItemOption\n | DSCommonComboboxPropsT.ItemOption[],\n > = T extends DSCommonComboboxPropsT.ItemOption[]\n ? DSComboboxMultiT.RequiredProps\n : SingleComboboxRequirePropsRenameInterface;\n\n export type DefaultProps<\n T extends DSCommonComboboxPropsT.ItemOption | DSCommonComboboxPropsT.ItemOption[] | null =\n | DSCommonComboboxPropsT.ItemOption\n | DSCommonComboboxPropsT.ItemOption[],\n > = T extends DSCommonComboboxPropsT.ItemOption[] ? DSComboboxMultiT.DefaultProps : DSComboboxSingleT.DefaultProps;\n export type OptionalProps<\n T extends DSCommonComboboxPropsT.ItemOption | DSCommonComboboxPropsT.ItemOption[] | null =\n | DSCommonComboboxPropsT.ItemOption\n | DSCommonComboboxPropsT.ItemOption[],\n > = T extends DSCommonComboboxPropsT.ItemOption[] ? DSComboboxMultiT.OptionalProps : DSComboboxSingleT.OptionalProps;\n export type PropsOptional = OptionalProps; // alias for backwards compatibility\n\n export type Props<\n T extends DSCommonComboboxPropsT.ItemOption | DSCommonComboboxPropsT.ItemOption[] | null =\n | DSCommonComboboxPropsT.ItemOption\n | DSCommonComboboxPropsT.ItemOption[],\n > = T extends DSCommonComboboxPropsT.ItemOption[]\n ? DSComboboxMultiT.Props\n : Omit<DSComboboxSingleT.Props, 'selectedValue'> & { selectedValues: DSComboboxSingleT.Props['selectedValue'] };\n export type InternalProps<\n T extends DSCommonComboboxPropsT.ItemOption | DSCommonComboboxPropsT.ItemOption[] | null =\n | DSCommonComboboxPropsT.ItemOption\n | DSCommonComboboxPropsT.ItemOption[],\n > = T extends DSCommonComboboxPropsT.ItemOption[]\n ? DSComboboxMultiT.InternalProps\n : Omit<DSComboboxSingleT.InternalProps, 'selectedValue'> & {\n selectedValues: DSComboboxSingleT.InternalProps['selectedValue'];\n };\n}\n\nexport const defaultProps: DSComboboxT.DefaultProps = {\n hasError: false,\n inline: false,\n withoutPortal: false,\n disabled: false,\n useMask: () => {},\n innerRef: createRef(),\n startPlacementPreference: 'bottom-start',\n placementOrderPreference: ['bottom-start', 'top-start'],\n noOptionsMessage: 'No Matches Found',\n isNonClearable: false,\n onlySelectable: false,\n isSkeleton: false,\n // override in useCombobox to avoid ref duplications when more than one cb is used\n applyAriaDisabled: false,\n readOnly: false,\n isMenuOpenableWithReadOnly: false,\n forceFocusFirstOptionOnType: false,\n menuMaxHeight: 300,\n};\n\n/**\n * Unified public schema used by polymorphic combobox consumption.\n *\n * `selectedValues` shape determines effective usage mode:\n * - object or null => single-select contract\n * - array => multi-select contract\n */\nexport const ComboboxPropTypes: DSPropTypesSchema<DSComboboxT.Props> = {\n ...getPropsPerSlotPropTypes(DSFormComboboxName, FORM_COMBOBOX_SLOTS),\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n ...commonComboboxPropTypes,\n onChange: PropTypes.func.isRequired\n .description(\n 'Polymorphic change callback. For single-select, suggestedValue is ItemOption | null; for multi-select, suggestedValue is ItemOption[].',\n )\n .signature(\n '(suggestedValue: ItemOption | ItemOption[] | null, selectedOption: SelectionableOptions, event: React.MouseEvent | React.KeyboardEvent) => void',\n ),\n selectedValues: PropTypes.oneOfType([\n PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.object])),\n PropTypes.object,\n PropTypes.oneOf([null]),\n ]).isRequired.description(\n 'Either a single selectable option or an array of selectable options. This shape determines single vs multi selection behavior. Null is valid only for single-select with no selection; an empty array is valid only for multi-select with no selection.',\n ),\n};\n\nexport const ComboboxPropTypesSchema = ComboboxPropTypes as unknown as ValidationMap<DSComboboxT.Props>;\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,iBAAiB;AAE1B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGP,SAAS,+BAA4D;AACrE,SAAS,oBAAoB,2BAA2B;AAsFjD,MAAM,eAAyC;AAAA,EACpD,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,eAAe;AAAA,EACf,UAAU;AAAA,EACV,SAAS,MAAM;AAAA,EAAC;AAAA,EAChB,UAAU,UAAU;AAAA,EACpB,0BAA0B;AAAA,EAC1B,0BAA0B,CAAC,gBAAgB,WAAW;AAAA,EACtD,kBAAkB;AAAA,EAClB,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,YAAY;AAAA;AAAA,EAEZ,mBAAmB;AAAA,EACnB,UAAU;AAAA,EACV,4BAA4B;AAAA,EAC5B,6BAA6B;AAAA,EAC7B,eAAe;AACjB;AASO,MAAM,oBAA0D;AAAA,EACrE,GAAG,yBAAyB,oBAAoB,mBAAmB;AAAA,EACnE,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,UAAU,UAAU,KAAK,WACtB;AAAA,IACC;AAAA,EACF,EACC;AAAA,IACC;AAAA,EACF;AAAA,EACF,gBAAgB,UAAU,UAAU;AAAA,IAClC,UAAU,QAAQ,UAAU,UAAU,CAAC,UAAU,MAAM,CAAC,CAAC;AAAA,IACzD,UAAU;AAAA,IACV,UAAU,MAAM,CAAC,IAAI,CAAC;AAAA,EACxB,CAAC,EAAE,WAAW;AAAA,IACZ;AAAA,EACF;AACF;AAEO,MAAM,0BAA0B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
const SlotPropsAsObj = {
|
|
3
|
+
dsComboboxRoot: { "aria-label": "just a typescript test" },
|
|
4
|
+
dsComboboxInputWrapper: { "aria-label": "just a typescript test" },
|
|
5
|
+
dsComboboxInput: { "aria-label": "just a typescript test" },
|
|
6
|
+
dsComboboxDropdownButton: { "aria-label": "just a typescript test" },
|
|
7
|
+
dsComboboxFastList: { "aria-label": "just a typescript test" },
|
|
8
|
+
dsComboboxSectionWrapper: { "aria-label": "just a typescript test" },
|
|
9
|
+
dsComboboxSectionLabel: { "aria-label": "just a typescript test" },
|
|
10
|
+
dsComboboxSingleMenuItem: { "aria-label": "just a typescript test" },
|
|
11
|
+
dsComboboxMultiMenuItem: { "aria-label": "just a typescript test" },
|
|
12
|
+
dsComboboxLoadingIndicator: { "aria-label": "just a typescript test" },
|
|
13
|
+
dsComboboxSkeletonMenuItem: { "aria-label": "just a typescript test" },
|
|
14
|
+
dsComboboxPill: { "aria-label": "just a typescript test" },
|
|
15
|
+
dsComboboxPillGroup: { "aria-label": "just a typescript test" },
|
|
16
|
+
dsComboboxPopperWrapper: { "aria-label": "just a typescript test" },
|
|
17
|
+
dsComboboxSelection: { "aria-label": "just a typescript test" },
|
|
18
|
+
dsComboboxSingleValueWrapper: { "aria-label": "just a typescript test" },
|
|
19
|
+
dsComboboxHeaderActions: { "aria-label": "just a typescript test" },
|
|
20
|
+
dsComboboxHeaderActionsSeparator: { "aria-label": "just a typescript test" },
|
|
21
|
+
dsComboboxInputPlaceholder: { "aria-label": "just a typescript test" },
|
|
22
|
+
dsComboboxInputFieldWrapper: { "aria-label": "just a typescript test" },
|
|
23
|
+
dsComboboxListWrapper: { "aria-label": "just a typescript test" },
|
|
24
|
+
dsComboboxNoResults: { "aria-label": "just a typescript test" },
|
|
25
|
+
dsComboboxCreatableLabel: { "aria-label": "just a typescript test" },
|
|
26
|
+
dsComboboxCreatableValue: { "aria-label": "just a typescript test" },
|
|
27
|
+
dsComboboxMenuItemsWrapper: { "aria-label": "just a typescript test" },
|
|
28
|
+
dsComboboxLoadingWrapper: { "aria-label": "just a typescript test" }
|
|
29
|
+
};
|
|
30
|
+
const SlotPropsAsFunctions = {
|
|
31
|
+
dsComboboxRoot: () => ({ "aria-label": "just a typescript test" }),
|
|
32
|
+
dsComboboxInputWrapper: () => ({ "aria-label": "just a typescript test" }),
|
|
33
|
+
dsComboboxInput: () => ({ "aria-label": "just a typescript test" }),
|
|
34
|
+
dsComboboxDropdownButton: () => ({ "aria-label": "just a typescript test" }),
|
|
35
|
+
dsComboboxFastList: () => ({ "aria-label": "just a typescript test" }),
|
|
36
|
+
dsComboboxSectionWrapper: () => ({ "aria-label": "just a typescript test" }),
|
|
37
|
+
dsComboboxSectionLabel: () => ({ "aria-label": "just a typescript test" }),
|
|
38
|
+
dsComboboxSingleMenuItem: () => ({ "aria-label": "just a typescript test" }),
|
|
39
|
+
dsComboboxMultiMenuItem: () => ({ "aria-label": "just a typescript test" }),
|
|
40
|
+
dsComboboxLoadingIndicator: () => ({ "aria-label": "just a typescript test" }),
|
|
41
|
+
dsComboboxSkeletonMenuItem: () => ({ "aria-label": "just a typescript test" }),
|
|
42
|
+
dsComboboxPill: () => ({ "aria-label": "just a typescript test" }),
|
|
43
|
+
dsComboboxPillGroup: () => ({ "aria-label": "just a typescript test" }),
|
|
44
|
+
dsComboboxPopperWrapper: () => ({ "aria-label": "just a typescript test" }),
|
|
45
|
+
dsComboboxSelection: () => ({ "aria-label": "just a typescript test" }),
|
|
46
|
+
dsComboboxSingleValueWrapper: () => ({ "aria-label": "just a typescript test" }),
|
|
47
|
+
dsComboboxHeaderActions: () => ({ "aria-label": "just a typescript test" }),
|
|
48
|
+
dsComboboxHeaderActionsSeparator: () => ({ "aria-label": "just a typescript test" }),
|
|
49
|
+
dsComboboxInputPlaceholder: () => ({ "aria-label": "just a typescript test" }),
|
|
50
|
+
dsComboboxInputFieldWrapper: () => ({ "aria-label": "just a typescript test" }),
|
|
51
|
+
dsComboboxListWrapper: () => ({ "aria-label": "just a typescript test" }),
|
|
52
|
+
dsComboboxNoResults: () => ({ "aria-label": "just a typescript test" }),
|
|
53
|
+
dsComboboxCreatableLabel: () => ({ "aria-label": "just a typescript test" }),
|
|
54
|
+
dsComboboxCreatableValue: () => ({ "aria-label": "just a typescript test" }),
|
|
55
|
+
dsComboboxMenuItemsWrapper: () => ({ "aria-label": "just a typescript test" }),
|
|
56
|
+
dsComboboxLoadingWrapper: () => ({ "aria-label": "just a typescript test" })
|
|
57
|
+
};
|
|
58
|
+
const EnsureAllSlotsExistInSlotFunctionArguments = SlotPropsAsFunctions;
|
|
59
|
+
//# sourceMappingURL=slot-props.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/typescript-testing/slot-props.ts"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\n\nimport type { TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport type { DSFormComboboxName, FORM_COMBOBOX_SLOTS } from '../constants/index.js';\nimport type { DSComboboxT } from '../react-desc-prop-types.js';\n\n// Object form \u2014 static slot props (validates slot keys exist on Props)\nconst SlotPropsAsObj: Partial<DSComboboxT.Props> = {\n dsComboboxRoot: { 'aria-label': 'just a typescript test' },\n dsComboboxInputWrapper: { 'aria-label': 'just a typescript test' },\n dsComboboxInput: { 'aria-label': 'just a typescript test' },\n dsComboboxDropdownButton: { 'aria-label': 'just a typescript test' },\n dsComboboxFastList: { 'aria-label': 'just a typescript test' },\n dsComboboxSectionWrapper: { 'aria-label': 'just a typescript test' },\n dsComboboxSectionLabel: { 'aria-label': 'just a typescript test' },\n dsComboboxSingleMenuItem: { 'aria-label': 'just a typescript test' },\n dsComboboxMultiMenuItem: { 'aria-label': 'just a typescript test' },\n dsComboboxLoadingIndicator: { 'aria-label': 'just a typescript test' },\n dsComboboxSkeletonMenuItem: { 'aria-label': 'just a typescript test' },\n dsComboboxPill: { 'aria-label': 'just a typescript test' },\n dsComboboxPillGroup: { 'aria-label': 'just a typescript test' },\n dsComboboxPopperWrapper: { 'aria-label': 'just a typescript test' },\n dsComboboxSelection: { 'aria-label': 'just a typescript test' },\n dsComboboxSingleValueWrapper: { 'aria-label': 'just a typescript test' },\n dsComboboxHeaderActions: { 'aria-label': 'just a typescript test' },\n dsComboboxHeaderActionsSeparator: { 'aria-label': 'just a typescript test' },\n dsComboboxInputPlaceholder: { 'aria-label': 'just a typescript test' },\n dsComboboxInputFieldWrapper: { 'aria-label': 'just a typescript test' },\n dsComboboxListWrapper: { 'aria-label': 'just a typescript test' },\n dsComboboxNoResults: { 'aria-label': 'just a typescript test' },\n dsComboboxCreatableLabel: { 'aria-label': 'just a typescript test' },\n dsComboboxCreatableValue: { 'aria-label': 'just a typescript test' },\n dsComboboxMenuItemsWrapper: { 'aria-label': 'just a typescript test' },\n dsComboboxLoadingWrapper: { 'aria-label': 'just a typescript test' },\n};\n\n// Function form \u2014 dynamic slot props (validates SlotFunctionArguments is complete)\nconst SlotPropsAsFunctions: DSComboboxT.SlotFunctionArguments = {\n dsComboboxRoot: () => ({ 'aria-label': 'just a typescript test' }),\n dsComboboxInputWrapper: () => ({ 'aria-label': 'just a typescript test' }),\n dsComboboxInput: () => ({ 'aria-label': 'just a typescript test' }),\n dsComboboxDropdownButton: () => ({ 'aria-label': 'just a typescript test' }),\n dsComboboxFastList: () => ({ 'aria-label': 'just a typescript test' }),\n dsComboboxSectionWrapper: () => ({ 'aria-label': 'just a typescript test' }),\n dsComboboxSectionLabel: () => ({ 'aria-label': 'just a typescript test' }),\n dsComboboxSingleMenuItem: () => ({ 'aria-label': 'just a typescript test' }),\n dsComboboxMultiMenuItem: () => ({ 'aria-label': 'just a typescript test' }),\n dsComboboxLoadingIndicator: () => ({ 'aria-label': 'just a typescript test' }),\n dsComboboxSkeletonMenuItem: () => ({ 'aria-label': 'just a typescript test' }),\n dsComboboxPill: () => ({ 'aria-label': 'just a typescript test' }),\n dsComboboxPillGroup: () => ({ 'aria-label': 'just a typescript test' }),\n dsComboboxPopperWrapper: () => ({ 'aria-label': 'just a typescript test' }),\n dsComboboxSelection: () => ({ 'aria-label': 'just a typescript test' }),\n dsComboboxSingleValueWrapper: () => ({ 'aria-label': 'just a typescript test' }),\n dsComboboxHeaderActions: () => ({ 'aria-label': 'just a typescript test' }),\n dsComboboxHeaderActionsSeparator: () => ({ 'aria-label': 'just a typescript test' }),\n dsComboboxInputPlaceholder: () => ({ 'aria-label': 'just a typescript test' }),\n dsComboboxInputFieldWrapper: () => ({ 'aria-label': 'just a typescript test' }),\n dsComboboxListWrapper: () => ({ 'aria-label': 'just a typescript test' }),\n dsComboboxNoResults: () => ({ 'aria-label': 'just a typescript test' }),\n dsComboboxCreatableLabel: () => ({ 'aria-label': 'just a typescript test' }),\n dsComboboxCreatableValue: () => ({ 'aria-label': 'just a typescript test' }),\n dsComboboxMenuItemsWrapper: () => ({ 'aria-label': 'just a typescript test' }),\n dsComboboxLoadingWrapper: () => ({ 'aria-label': 'just a typescript test' }),\n};\n\n// Exhaustiveness check \u2014 fails compilation if any slot is missing from SlotFunctionArguments\nconst EnsureAllSlotsExistInSlotFunctionArguments: Required<\n TypescriptHelpersT.PropsForSlots<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