@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,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/DSComboboxSingleT.ts"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\nimport type { DSPropTypesSchema, GlobalAttributesT, ValidationMap, XstyledProps } from '@elliemae/ds-props-helpers';\nimport {
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACEvB,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\nimport type { DSPropTypesSchema, GlobalAttributesT, ValidationMap, XstyledProps } from '@elliemae/ds-props-helpers';\nimport {\n getPropsPerSlotPropTypes,\n globalAttributesPropTypes,\n PropTypes,\n xstyledPropTypes,\n} from '@elliemae/ds-props-helpers';\nimport type { TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport type React from 'react';\nimport { commonComboboxPropTypes, type DSCommonComboboxPropsT } from './DSCommonComboboxPropsT.js';\nimport { DSFormComboboxName, FORM_COMBOBOX_SINGLE_SLOTS } from './constants/index.js';\n\nexport declare namespace DSComboboxSingleT {\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 interface RequiredProps extends DSCommonComboboxPropsT.RequiredProps {\n selectedValue: DSCommonComboboxPropsT.ItemOption | null;\n onChange: (\n suggestedValue: DSCommonComboboxPropsT.ItemOption | null,\n selectedOption: DSCommonComboboxPropsT.SelectionableOptions,\n event: React.MouseEvent | React.KeyboardEvent,\n ) => void;\n }\n export interface DefaultProps extends DSCommonComboboxPropsT.DefaultProps {}\n export interface OptionalProps\n extends DSCommonComboboxPropsT.OptionalProps,\n TypescriptHelpersT.PropsForGlobalOnSlots<typeof DSFormComboboxName, typeof FORM_COMBOBOX_SINGLE_SLOTS> {}\n export interface Props\n extends Partial<DefaultProps>,\n OptionalProps,\n Omit<\n GlobalAttributesT<HTMLElement>,\n keyof RequiredProps | keyof DefaultProps | keyof OptionalProps | keyof XstyledProps\n >,\n XstyledProps,\n RequiredProps {}\n\n export interface InternalProps\n extends DefaultProps,\n OptionalProps,\n Omit<\n GlobalAttributesT<HTMLElement>,\n keyof RequiredProps | keyof DefaultProps | keyof OptionalProps | keyof XstyledProps\n >,\n XstyledProps,\n RequiredProps {}\n}\n\ntype SingleComboboxWithSelectedValues = Omit<DSComboboxSingleT.Props, 'selectedValue'> & {\n selectedValues: DSComboboxSingleT.RequiredProps['selectedValue'];\n};\n\n/**\n * Single-select schema variant.\n *\n * - `selectedValues` is a single selectable option object.\n * - `null` indicates no current selection.\n */\nexport const singleComboboxPropTypes: DSPropTypesSchema<SingleComboboxWithSelectedValues> = {\n ...getPropsPerSlotPropTypes(DSFormComboboxName, FORM_COMBOBOX_SINGLE_SLOTS),\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n ...commonComboboxPropTypes,\n onChange: PropTypes.func.isRequired\n .description(\n 'Single-select change callback. Receives the next single selected option or null when selection is cleared.',\n )\n .signature(\n '(suggestedValue: ItemOption | null, selectedOption: SelectionableOptions, event: React.MouseEvent | React.KeyboardEvent) => void',\n ),\n selectedValues: PropTypes.oneOfType([PropTypes.object, PropTypes.oneOf([null])]).isRequired.description(\n 'Single-select value. Use a selectable option object for a selected state, or null for no selection.',\n ),\n};\n\nexport const singleComboboxPropTypesSchema =\n singleComboboxPropTypes as unknown as ValidationMap<SingleComboboxWithSelectedValues>;\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACEvB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGP,SAAS,+BAA4D;AACrE,SAAS,oBAAoB,kCAAkC;AAwDxD,MAAM,0BAA+E;AAAA,EAC1F,GAAG,yBAAyB,oBAAoB,0BAA0B;AAAA,EAC1E,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,CAAC,UAAU,QAAQ,UAAU,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,WAAW;AAAA,IAC1F;AAAA,EACF;AACF;AAEO,MAAM,gCACX;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useCallback, useState } from "react";
|
|
4
|
+
import { styled } from "@elliemae/ds-system";
|
|
5
|
+
import {
|
|
6
|
+
useFloatingContext,
|
|
7
|
+
FloatingWrapper,
|
|
8
|
+
PopoverArrow
|
|
9
|
+
} from "@elliemae/ds-floating-context";
|
|
10
|
+
const TruncatedSpan = styled.span`
|
|
11
|
+
text-overflow: ellipsis;
|
|
12
|
+
white-space: nowrap;
|
|
13
|
+
overflow: hidden;
|
|
14
|
+
display: inline-block;
|
|
15
|
+
max-width: 100%;
|
|
16
|
+
`;
|
|
17
|
+
const TooltipContainer = styled.div`
|
|
18
|
+
text-align: center;
|
|
19
|
+
min-width: ${({ theme }) => theme.space.l};
|
|
20
|
+
max-width: 250px;
|
|
21
|
+
overflow-wrap: break-word;
|
|
22
|
+
word-break: break-word;
|
|
23
|
+
min-height: 30px;
|
|
24
|
+
display: grid;
|
|
25
|
+
align-items: center;
|
|
26
|
+
padding: ${({ theme }) => `${theme.space.xxs} ${theme.space.xs}`};
|
|
27
|
+
position: relative;
|
|
28
|
+
background-color: white;
|
|
29
|
+
border-radius: 2px;
|
|
30
|
+
font-size: 13px;
|
|
31
|
+
color: ${({ theme }) => theme.colors.neutral[600]};
|
|
32
|
+
pointer-events: none;
|
|
33
|
+
`;
|
|
34
|
+
const TruncatedTooltipText = ({ value = "", placement = "top" }) => {
|
|
35
|
+
const [showTooltip, setShowTooltip] = useState(false);
|
|
36
|
+
const { refs, floatingStyles, arrowStyles, context } = useFloatingContext({
|
|
37
|
+
placement,
|
|
38
|
+
externallyControlledIsOpen: showTooltip,
|
|
39
|
+
withoutAnimation: true
|
|
40
|
+
});
|
|
41
|
+
const handleMouseEnter = useCallback((e) => {
|
|
42
|
+
const el = e.currentTarget;
|
|
43
|
+
setShowTooltip(el.offsetWidth < el.scrollWidth);
|
|
44
|
+
}, []);
|
|
45
|
+
const handleMouseLeave = useCallback(() => {
|
|
46
|
+
setShowTooltip(false);
|
|
47
|
+
}, []);
|
|
48
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
49
|
+
/* @__PURE__ */ jsx(TruncatedSpan, { innerRef: refs.setReference, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, children: value }),
|
|
50
|
+
/* @__PURE__ */ jsx(
|
|
51
|
+
FloatingWrapper,
|
|
52
|
+
{
|
|
53
|
+
innerRef: refs.setFloating,
|
|
54
|
+
isOpen: showTooltip,
|
|
55
|
+
floatingStyles,
|
|
56
|
+
context,
|
|
57
|
+
children: /* @__PURE__ */ jsxs(TooltipContainer, { children: [
|
|
58
|
+
value,
|
|
59
|
+
/* @__PURE__ */ jsx(PopoverArrow, { ...arrowStyles })
|
|
60
|
+
] })
|
|
61
|
+
}
|
|
62
|
+
)
|
|
63
|
+
] });
|
|
64
|
+
};
|
|
65
|
+
var TruncatedTooltipText_default = TruncatedTooltipText;
|
|
66
|
+
export {
|
|
67
|
+
TruncatedTooltipText,
|
|
68
|
+
TruncatedTooltipText_default as default
|
|
69
|
+
};
|
|
70
|
+
//# sourceMappingURL=TruncatedTooltipText.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/TruncatedTooltipText.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useCallback, useState } from 'react';\nimport { styled } from '@elliemae/ds-system';\nimport {\n useFloatingContext,\n FloatingWrapper,\n PopoverArrow,\n type DSHookFloatingContextT,\n} from '@elliemae/ds-floating-context';\n\nconst TruncatedSpan = styled.span`\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n display: inline-block;\n max-width: 100%;\n`;\n\n// Matches DSTooltipV3's StyledTooltipContainer styles for visual consistency\nconst TooltipContainer = styled.div`\n text-align: center;\n min-width: ${({ theme }) => theme.space.l};\n max-width: 250px;\n overflow-wrap: break-word;\n word-break: break-word;\n min-height: 30px;\n display: grid;\n align-items: center;\n padding: ${({ theme }) => `${theme.space.xxs} ${theme.space.xs}`};\n position: relative;\n background-color: white;\n border-radius: 2px;\n font-size: 13px;\n color: ${({ theme }) => theme.colors.neutral[600]};\n pointer-events: none;\n`;\n\ninterface TruncatedTooltipTextProps {\n value?: string;\n placement?: DSHookFloatingContextT.PopperPlacementsT;\n}\n\nconst TruncatedTooltipText = ({ value = '', placement = 'top' }: TruncatedTooltipTextProps) => {\n const [showTooltip, setShowTooltip] = useState(false);\n\n const { refs, floatingStyles, arrowStyles, context } = useFloatingContext({\n placement,\n externallyControlledIsOpen: showTooltip,\n withoutAnimation: true,\n });\n\n const handleMouseEnter = useCallback((e: React.MouseEvent<HTMLSpanElement>) => {\n const el = e.currentTarget;\n setShowTooltip(el.offsetWidth < el.scrollWidth);\n }, []);\n\n const handleMouseLeave = useCallback(() => {\n setShowTooltip(false);\n }, []);\n\n return (\n <>\n <TruncatedSpan innerRef={refs.setReference} onMouseEnter={handleMouseEnter} onMouseLeave={handleMouseLeave}>\n {value}\n </TruncatedSpan>\n <FloatingWrapper\n innerRef={refs.setFloating}\n isOpen={showTooltip}\n floatingStyles={floatingStyles}\n context={context}\n >\n <TooltipContainer>\n {value}\n <PopoverArrow {...arrowStyles} />\n </TooltipContainer>\n </FloatingWrapper>\n </>\n );\n};\n\nexport { TruncatedTooltipText };\nexport default TruncatedTooltipText;\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;AC4DnB,mBACE,KASE,YAVJ;AA5DJ,SAAgB,aAAa,gBAAgB;AAC7C,SAAS,cAAc;AACvB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AAEP,MAAM,gBAAgB,OAAO;AAAA;AA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TestIds } from "@elliemae/ds-system";
|
|
3
3
|
const DSFormComboboxName = "DSCombobox";
|
|
4
|
-
const
|
|
5
|
-
// Same as old container
|
|
4
|
+
const FORM_COMBOBOX_COMMON_SLOTS = {
|
|
6
5
|
ROOT: "root",
|
|
7
6
|
INPUT_WRAPPER: "input-wrapper",
|
|
8
7
|
INPUT: "input",
|
|
@@ -10,11 +9,38 @@ const FORM_COMBOBOX_SLOTS = {
|
|
|
10
9
|
FAST_LIST: "fast-list",
|
|
11
10
|
SECTION_WRAPPER: "section-wrapper",
|
|
12
11
|
SECTION_LABEL: "section-label",
|
|
12
|
+
// Single-select: regular menu items. Both modes: creatable items (when `onCreate` is provided).
|
|
13
13
|
SINGLE_MENU_ITEM: "single-menu-item",
|
|
14
|
-
MULTI_MENU_ITEM: "multi-menu-item",
|
|
15
14
|
LOADING_INDICATOR: "loading-indicator",
|
|
16
15
|
SKELETON_MENU_ITEM: "skeleton-menu-item",
|
|
17
|
-
|
|
16
|
+
POPPER_WRAPPER: "popper-wrapper",
|
|
17
|
+
SELECTION: "selection",
|
|
18
|
+
HEADER_ACTIONS: "header-actions",
|
|
19
|
+
HEADER_ACTIONS_SEPARATOR: "header-actions-separator",
|
|
20
|
+
INPUT_PLACEHOLDER: "input-placeholder",
|
|
21
|
+
INPUT_FIELD_WRAPPER: "input-field-wrapper",
|
|
22
|
+
LIST_WRAPPER: "list-wrapper",
|
|
23
|
+
NO_MATCHES_FOUND: "no-results",
|
|
24
|
+
// legacy data-testid: combobox-no-matches-found — breaking change if removed
|
|
25
|
+
CREATABLE_LABEL: "creatable-label",
|
|
26
|
+
CREATABLE_VALUE: "creatable-value",
|
|
27
|
+
MENU_ITEMS_WRAPPER: "menu-items-wrapper",
|
|
28
|
+
LOADING_WRAPPER: "loading-wrapper"
|
|
29
|
+
};
|
|
30
|
+
const FORM_COMBOBOX_SINGLE_SLOTS = {
|
|
31
|
+
...FORM_COMBOBOX_COMMON_SLOTS,
|
|
32
|
+
SELECTED_VALUES: "single-value-wrapper"
|
|
33
|
+
// legacy data-testid: combobox-selected-values — breaking change if removed
|
|
34
|
+
};
|
|
35
|
+
const FORM_COMBOBOX_MULTI_SLOTS = {
|
|
36
|
+
...FORM_COMBOBOX_COMMON_SLOTS,
|
|
37
|
+
PILL: "pill",
|
|
38
|
+
PILL_GROUP: "pill-group",
|
|
39
|
+
MULTI_MENU_ITEM: "multi-menu-item"
|
|
40
|
+
};
|
|
41
|
+
const FORM_COMBOBOX_SLOTS = {
|
|
42
|
+
...FORM_COMBOBOX_SINGLE_SLOTS,
|
|
43
|
+
...FORM_COMBOBOX_MULTI_SLOTS
|
|
18
44
|
};
|
|
19
45
|
const FORM_COMBOBOX_DATA_TESTID = {
|
|
20
46
|
...slotObjectToDataTestIds(DSFormComboboxName, FORM_COMBOBOX_SLOTS),
|
|
@@ -33,6 +59,8 @@ const FORM_COMBOBOX_DATA_TESTID = {
|
|
|
33
59
|
export {
|
|
34
60
|
DSFormComboboxName,
|
|
35
61
|
FORM_COMBOBOX_DATA_TESTID,
|
|
62
|
+
FORM_COMBOBOX_MULTI_SLOTS,
|
|
63
|
+
FORM_COMBOBOX_SINGLE_SLOTS,
|
|
36
64
|
FORM_COMBOBOX_SLOTS
|
|
37
65
|
};
|
|
38
66
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/constants/index.ts"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { slotObjectToDataTestIds } from '@elliemae/ds-system';\n\nexport const DSFormComboboxName = 'DSCombobox';\n\n//
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,+BAA+B;AAEjC,MAAM,qBAAqB;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { slotObjectToDataTestIds } from '@elliemae/ds-system';\n\nexport const DSFormComboboxName = 'DSCombobox';\n\n// Slots available in both single and multi-select modes\nconst FORM_COMBOBOX_COMMON_SLOTS = {\n ROOT: 'root',\n INPUT_WRAPPER: 'input-wrapper',\n INPUT: 'input',\n DROPDOWN_BUTTON: 'dropdown-button',\n FAST_LIST: 'fast-list',\n SECTION_WRAPPER: 'section-wrapper',\n SECTION_LABEL: 'section-label',\n // Single-select: regular menu items. Both modes: creatable items (when `onCreate` is provided).\n SINGLE_MENU_ITEM: 'single-menu-item',\n LOADING_INDICATOR: 'loading-indicator',\n SKELETON_MENU_ITEM: 'skeleton-menu-item',\n POPPER_WRAPPER: 'popper-wrapper',\n SELECTION: 'selection',\n HEADER_ACTIONS: 'header-actions',\n HEADER_ACTIONS_SEPARATOR: 'header-actions-separator',\n INPUT_PLACEHOLDER: 'input-placeholder',\n INPUT_FIELD_WRAPPER: 'input-field-wrapper',\n LIST_WRAPPER: 'list-wrapper',\n NO_MATCHES_FOUND: 'no-results', // legacy data-testid: combobox-no-matches-found \u2014 breaking change if removed\n CREATABLE_LABEL: 'creatable-label',\n CREATABLE_VALUE: 'creatable-value',\n MENU_ITEMS_WRAPPER: 'menu-items-wrapper',\n LOADING_WRAPPER: 'loading-wrapper',\n} as const;\n\n// Slots available in single-select mode only\nexport const FORM_COMBOBOX_SINGLE_SLOTS = {\n ...FORM_COMBOBOX_COMMON_SLOTS,\n SELECTED_VALUES: 'single-value-wrapper', // legacy data-testid: combobox-selected-values \u2014 breaking change if removed\n} as const;\n\n// Slots available in multi-select mode only\nexport const FORM_COMBOBOX_MULTI_SLOTS = {\n ...FORM_COMBOBOX_COMMON_SLOTS,\n PILL: 'pill',\n PILL_GROUP: 'pill-group',\n MULTI_MENU_ITEM: 'multi-menu-item',\n} as const;\n\n// Full slot set \u2014 union of both modes. Used for slot declarations in styled components and runtime helpers.\n// we are naming this with the ${component_name}_slots convention to namespace & avoid errors on duplicate exports variables in aggregators\nexport const FORM_COMBOBOX_SLOTS = {\n ...FORM_COMBOBOX_SINGLE_SLOTS,\n ...FORM_COMBOBOX_MULTI_SLOTS,\n} as const;\n\n// we are naming this with the ${component_name}_data_testid convention to namespace & avoid errors on duplicate exports variables in aggregators\nexport const FORM_COMBOBOX_DATA_TESTID = {\n ...slotObjectToDataTestIds(DSFormComboboxName, FORM_COMBOBOX_SLOTS),\n // legacy data-testid\n CONTROLS_WRAPPER: 'combobox-controls-wrapper',\n CONTAINER: 'combobox-container',\n INPUT: 'combobox-input',\n LIST: 'combobox-menu-list',\n NO_MATCHES_FOUND: 'combobox-no-matches-found',\n SELECTED_VALUES: 'combobox-selected-values',\n DROPDOWN: 'combobox-dropdown-btn',\n OPTION: 'combobox-option',\n ALLY_SELECTED_VALUES: 'combobox-ally-selected-values',\n PILL: 'ds-pill-wrapper',\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,+BAA+B;AAEjC,MAAM,qBAAqB;AAGlC,MAAM,6BAA6B;AAAA,EACjC,MAAM;AAAA,EACN,eAAe;AAAA,EACf,OAAO;AAAA,EACP,iBAAiB;AAAA,EACjB,WAAW;AAAA,EACX,iBAAiB;AAAA,EACjB,eAAe;AAAA;AAAA,EAEf,kBAAkB;AAAA,EAClB,mBAAmB;AAAA,EACnB,oBAAoB;AAAA,EACpB,gBAAgB;AAAA,EAChB,WAAW;AAAA,EACX,gBAAgB;AAAA,EAChB,0BAA0B;AAAA,EAC1B,mBAAmB;AAAA,EACnB,qBAAqB;AAAA,EACrB,cAAc;AAAA,EACd,kBAAkB;AAAA;AAAA,EAClB,iBAAiB;AAAA,EACjB,iBAAiB;AAAA,EACjB,oBAAoB;AAAA,EACpB,iBAAiB;AACnB;AAGO,MAAM,6BAA6B;AAAA,EACxC,GAAG;AAAA,EACH,iBAAiB;AAAA;AACnB;AAGO,MAAM,4BAA4B;AAAA,EACvC,GAAG;AAAA,EACH,MAAM;AAAA,EACN,YAAY;AAAA,EACZ,iBAAiB;AACnB;AAIO,MAAM,sBAAsB;AAAA,EACjC,GAAG;AAAA,EACH,GAAG;AACL;AAGO,MAAM,4BAA4B;AAAA,EACvC,GAAG,wBAAwB,oBAAoB,mBAAmB;AAAA;AAAA,EAElE,kBAAkB;AAAA,EAClB,WAAW;AAAA,EACX,OAAO;AAAA,EACP,MAAM;AAAA,EACN,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,sBAAsB;AAAA,EACtB,MAAM;AACR;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -22,8 +22,20 @@ const LiveRegion = () => {
|
|
|
22
22
|
);
|
|
23
23
|
};
|
|
24
24
|
const Announcer = React2.memo(({ message }) => /* @__PURE__ */ jsx(StyledA11yNotVisible, { "aria-live": "assertive", "aria-relevant": "all", children: message }));
|
|
25
|
+
const ResultCountStatus = React2.memo(
|
|
26
|
+
({
|
|
27
|
+
menuOpen,
|
|
28
|
+
isLoading,
|
|
29
|
+
isSkeleton,
|
|
30
|
+
resultCount
|
|
31
|
+
}) => {
|
|
32
|
+
const message = !menuOpen || isLoading || isSkeleton || resultCount === 0 ? "" : `${resultCount} options available`;
|
|
33
|
+
return /* @__PURE__ */ jsx(StyledA11yNotVisible, { role: "status", "aria-live": "polite", "aria-atomic": "true", children: message });
|
|
34
|
+
}
|
|
35
|
+
);
|
|
25
36
|
export {
|
|
26
37
|
Announcer,
|
|
27
|
-
LiveRegion
|
|
38
|
+
LiveRegion,
|
|
39
|
+
ResultCountStatus
|
|
28
40
|
};
|
|
29
41
|
//# sourceMappingURL=LiveRegion.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/parts/LiveRegion.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext } from 'react';\nimport ComboBoxContext from '../ComboBoxCTX.js';\nimport { StyledA11yNotVisible } from './styled.js';\nimport { ComboboxDataTestid } from '../ComboboxDataTestids.js';\nexport const LiveRegion = (): JSX.Element => {\n const {\n props: { onCreate },\n hasFocus,\n } = useContext(ComboBoxContext);\n\n const ScreenReaderText = onCreate ? <span id=\"aria-creatable\">press enter to create the option</span> : '';\n\n return (\n <StyledA11yNotVisible\n data-testid={ComboboxDataTestid.ALLY_SELECTED_VALUES}\n aria-live=\"polite\"\n aria-atomic=\"false\"\n aria-relevant=\"additions text\"\n >\n {hasFocus && ScreenReaderText}\n </StyledA11yNotVisible>\n );\n};\n\nexport const Announcer = React.memo(({ message }: { message: string }) => (\n <StyledA11yNotVisible aria-live=\"assertive\" aria-relevant=\"all\">\n {message}\n </StyledA11yNotVisible>\n));\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACUe;AAVtC,OAAOA,UAAS,kBAAkB;AAClC,OAAO,qBAAqB;AAC5B,SAAS,4BAA4B;AACrC,SAAS,0BAA0B;AAC5B,MAAM,aAAa,MAAmB;AAC3C,QAAM;AAAA,IACJ,OAAO,EAAE,SAAS;AAAA,IAClB;AAAA,EACF,IAAI,WAAW,eAAe;AAE9B,QAAM,mBAAmB,WAAW,oBAAC,UAAK,IAAG,kBAAiB,8CAAgC,IAAU;AAExG,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAa,mBAAmB;AAAA,MAChC,aAAU;AAAA,MACV,eAAY;AAAA,MACZ,iBAAc;AAAA,MAEb,sBAAY;AAAA;AAAA,EACf;AAEJ;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext } from 'react';\nimport ComboBoxContext from '../ComboBoxCTX.js';\nimport { StyledA11yNotVisible } from './styled.js';\nimport { ComboboxDataTestid } from '../ComboboxDataTestids.js';\nexport const LiveRegion = (): JSX.Element => {\n const {\n props: { onCreate },\n hasFocus,\n } = useContext(ComboBoxContext);\n\n const ScreenReaderText = onCreate ? <span id=\"aria-creatable\">press enter to create the option</span> : '';\n\n return (\n <StyledA11yNotVisible\n data-testid={ComboboxDataTestid.ALLY_SELECTED_VALUES}\n aria-live=\"polite\"\n aria-atomic=\"false\"\n aria-relevant=\"additions text\"\n >\n {hasFocus && ScreenReaderText}\n </StyledA11yNotVisible>\n );\n};\n\n/**\n * PUI-18034 \u2014 Previously used in ComboBox.tsx for the \"Loading options please wait\"\n * announcement; replaced by aria-busy + aria-label on Loading/Skeleton containers (which\n * carry the listbox role during async states) plus a polite ResultCountStatus for the\n * post-load count. No internal callers remain and not re-exported from index.tsx \u2014\n * evaluate removing.\n */\nexport const Announcer = React.memo(({ message }: { message: string }) => (\n <StyledA11yNotVisible aria-live=\"assertive\" aria-relevant=\"all\">\n {message}\n </StyledA11yNotVisible>\n));\n\n/**\n * PUI-18034 \u2014 Polite live region for post-load result count. Replaces the previous\n * assertive Announcer that raced with the SR's aria-expanded announcement.\n *\n * WCAG 2.2 SC 4.1.3 Status Messages \u2014 announce changes without shifting focus.\n * WAI-ARIA APG combobox: https://www.w3.org/WAI/ARIA/apg/patterns/combobox/\n * WCAG: https://www.w3.org/WAI/WCAG22/Understanding/status-messages.html\n */\nexport const ResultCountStatus = React.memo(\n ({\n menuOpen,\n isLoading,\n isSkeleton,\n resultCount,\n }: {\n menuOpen: boolean;\n isLoading: boolean;\n isSkeleton: boolean;\n resultCount: number;\n }) => {\n const message = !menuOpen || isLoading || isSkeleton || resultCount === 0 ? '' : `${resultCount} options available`;\n return (\n <StyledA11yNotVisible role=\"status\" aria-live=\"polite\" aria-atomic=\"true\">\n {message}\n </StyledA11yNotVisible>\n );\n },\n);\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACUe;AAVtC,OAAOA,UAAS,kBAAkB;AAClC,OAAO,qBAAqB;AAC5B,SAAS,4BAA4B;AACrC,SAAS,0BAA0B;AAC5B,MAAM,aAAa,MAAmB;AAC3C,QAAM;AAAA,IACJ,OAAO,EAAE,SAAS;AAAA,IAClB;AAAA,EACF,IAAI,WAAW,eAAe;AAE9B,QAAM,mBAAmB,WAAW,oBAAC,UAAK,IAAG,kBAAiB,8CAAgC,IAAU;AAExG,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAa,mBAAmB;AAAA,MAChC,aAAU;AAAA,MACV,eAAY;AAAA,MACZ,iBAAc;AAAA,MAEb,sBAAY;AAAA;AAAA,EACf;AAEJ;AASO,MAAM,YAAYA,OAAM,KAAK,CAAC,EAAE,QAAQ,MAC7C,oBAAC,wBAAqB,aAAU,aAAY,iBAAc,OACvD,mBACH,CACD;AAUM,MAAM,oBAAoBA,OAAM;AAAA,EACrC,CAAC;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,MAKM;AACJ,UAAM,UAAU,CAAC,YAAY,aAAa,cAAc,gBAAgB,IAAI,KAAK,GAAG,WAAW;AAC/F,WACE,oBAAC,wBAAqB,MAAK,UAAS,aAAU,UAAS,eAAY,QAChE,mBACH;AAAA,EAEJ;AACF;",
|
|
6
6
|
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -3,11 +3,12 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { createElement } from "react";
|
|
4
4
|
import React2 from "react";
|
|
5
5
|
import { styled } from "@elliemae/ds-system";
|
|
6
|
-
import {
|
|
6
|
+
import { Separator } from "@elliemae/ds-menu-items";
|
|
7
7
|
import { MENU_OPTION_TYPES } from "../constants.js";
|
|
8
8
|
import { ComboboxDataTestid } from "../ComboboxDataTestids.js";
|
|
9
9
|
import { isSelected } from "../utils/listHelper.js";
|
|
10
10
|
import { DSFormComboboxName, FORM_COMBOBOX_SLOTS } from "../constants/index.js";
|
|
11
|
+
import { StyledSingleMenuItem, StyledMultiMenuItem } from "./menu-list/styled.js";
|
|
11
12
|
const StyledSectionWrapper = styled("section", { name: DSFormComboboxName, slot: FORM_COMBOBOX_SLOTS.SECTION_WRAPPER })`
|
|
12
13
|
list-style: none;
|
|
13
14
|
min-height: 24px;
|
|
@@ -22,10 +23,6 @@ const StyledSectionLabel = styled("header", { name: DSFormComboboxName, slot: FO
|
|
|
22
23
|
font-size: 1rem;
|
|
23
24
|
color: neutral-500;
|
|
24
25
|
`;
|
|
25
|
-
const StyledSingleMenuItem = styled(SingleMenuItem, {
|
|
26
|
-
name: DSFormComboboxName,
|
|
27
|
-
slot: FORM_COMBOBOX_SLOTS.SINGLE_MENU_ITEM
|
|
28
|
-
})``;
|
|
29
26
|
const Section = React2.memo((props) => {
|
|
30
27
|
const {
|
|
31
28
|
label,
|
|
@@ -40,7 +37,7 @@ const Section = React2.memo((props) => {
|
|
|
40
37
|
getOwnerPropsArguments
|
|
41
38
|
} = props;
|
|
42
39
|
const id = `${label.replace(/ /g, "")}-section`;
|
|
43
|
-
const CBItem = Array.isArray(selectedValues) ?
|
|
40
|
+
const CBItem = Array.isArray(selectedValues) ? StyledMultiMenuItem : StyledSingleMenuItem;
|
|
44
41
|
return /* @__PURE__ */ jsxs(
|
|
45
42
|
StyledSectionWrapper,
|
|
46
43
|
{
|
|
@@ -92,7 +89,7 @@ const Section = React2.memo((props) => {
|
|
|
92
89
|
},
|
|
93
90
|
onMouseDown: handleOnMouseDown,
|
|
94
91
|
isActive: dsId === focusOptionIdx,
|
|
95
|
-
isSelected: isSelected(selectedValues, option),
|
|
92
|
+
isSelected: option.type === MENU_OPTION_TYPES.OPTION && isSelected(selectedValues, option),
|
|
96
93
|
tabIndex: -1,
|
|
97
94
|
...rest,
|
|
98
95
|
key: option.dsId,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/parts/Section.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { styled } from '@elliemae/ds-system';\nimport {
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { styled } from '@elliemae/ds-system';\nimport { Separator } from '@elliemae/ds-menu-items';\n\nimport { MENU_OPTION_TYPES } from '../constants.js';\n\nimport { ComboboxDataTestid } from '../ComboboxDataTestids.js';\nimport type { DSComboboxT } from '../react-desc-prop-types.js';\nimport { isSelected } from '../utils/listHelper.js';\nimport { DSFormComboboxName, FORM_COMBOBOX_SLOTS } from '../constants/index.js';\nimport { StyledSingleMenuItem, StyledMultiMenuItem } from './menu-list/styled.js';\n\ninterface SectionProps {\n label: string;\n wrapperStyles?: React.CSSProperties;\n innerRef?: (instance: HTMLDivElement | null) => void;\n options: DSComboboxT.OptionTypes[];\n handleClick: (option: DSComboboxT.OptionTypes, e: React.MouseEvent<HTMLInputElement>) => void;\n handleOnMouseDown: (e: React.MouseEvent<HTMLLIElement>) => void;\n focusOptionIdx: string;\n selectedValues: DSComboboxT.SelectedOptionsT;\n getOwnerProps: () => object;\n getOwnerPropsArguments?: () => { index: number };\n}\n\nconst StyledSectionWrapper = styled('section', { name: DSFormComboboxName, slot: FORM_COMBOBOX_SLOTS.SECTION_WRAPPER })`\n list-style: none;\n min-height: 24px;\n display: grid;\n align-items: center;\n`;\n\nconst StyledSectionLabel = styled('header', { name: DSFormComboboxName, slot: FORM_COMBOBOX_SLOTS.SECTION_LABEL })`\n display: flex;\n align-items: center;\n padding: 0px 16px;\n min-height: 24px;\n font-size: 1rem;\n color: neutral-500;\n`;\n\nexport const Section = React.memo((props: SectionProps) => {\n const {\n label,\n wrapperStyles,\n focusOptionIdx,\n selectedValues,\n innerRef,\n handleOnMouseDown,\n options,\n handleClick,\n getOwnerProps,\n getOwnerPropsArguments,\n } = props;\n const id = `${label.replace(/ /g, '')}-section`;\n const CBItem: React.ComponentType<React.ComponentProps<typeof StyledSingleMenuItem>> = Array.isArray(selectedValues)\n ? StyledMultiMenuItem\n : StyledSingleMenuItem;\n\n return (\n <StyledSectionWrapper\n role=\"group\"\n aria-labelledby={id}\n style={wrapperStyles}\n innerRef={innerRef}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n <StyledSectionLabel\n id={id}\n role=\"presentation\"\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n {label}\n </StyledSectionLabel>\n {options?.map((option) => {\n const {\n dsId,\n type,\n value,\n label: optionLabel,\n readOnly,\n disabled,\n applyAriaDisabled,\n render,\n ...rest\n } = option;\n\n if (type === MENU_OPTION_TYPES.SEPARATOR) {\n return <Separator key={dsId} />;\n }\n\n return (\n <CBItem\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n value={value}\n label={optionLabel}\n dataTestid={ComboboxDataTestid.OPTION}\n disabled={disabled}\n applyAriaDisabled={applyAriaDisabled || readOnly}\n onClick={(e: React.MouseEvent<HTMLInputElement>) => {\n if (applyAriaDisabled) return;\n handleClick(option, e);\n }}\n onMouseDown={handleOnMouseDown}\n isActive={dsId === focusOptionIdx}\n isSelected={option.type === MENU_OPTION_TYPES.OPTION && isSelected(selectedValues, option)}\n tabIndex={-1}\n {...rest}\n key={option.dsId}\n dsId={option.dsId}\n />\n );\n })}\n </StyledSectionWrapper>\n );\n});\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;AC4DnB,SAQE,KARF;AAkCM;AA9FV,OAAOA,YAAW;AAClB,SAAS,cAAc;AACvB,SAAS,iBAAiB;AAE1B,SAAS,yBAAyB;AAElC,SAAS,0BAA0B;AAEnC,SAAS,kBAAkB;AAC3B,SAAS,oBAAoB,2BAA2B;AACxD,SAAS,sBAAsB,2BAA2B;AAe1D,MAAM,uBAAuB,OAAO,WAAW,EAAE,MAAM,oBAAoB,MAAM,oBAAoB,gBAAgB,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAOtH,MAAM,qBAAqB,OAAO,UAAU,EAAE,MAAM,oBAAoB,MAAM,oBAAoB,cAAc,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAS1G,MAAM,UAA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;AAAA,EACH;AAEJ,CAAC;",
|
|
6
6
|
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -6,13 +6,12 @@ import { useGetGlobalAttributes, useGetXstyledProps, useOwnerProps } from "@elli
|
|
|
6
6
|
import { useCallback, useContext, useEffect, useMemo } from "react";
|
|
7
7
|
import ComboBoxContext from "../../ComboBoxCTX.js";
|
|
8
8
|
import { ComboboxDataTestid } from "../../ComboboxDataTestids.js";
|
|
9
|
-
import { useOnClickOutside } from "../../config/useClickOutside.js";
|
|
10
9
|
import { Controls } from "../controls/index.js";
|
|
11
10
|
import { LiveRegion } from "../LiveRegion.js";
|
|
12
11
|
import { MenuList } from "../menu-list/index.js";
|
|
13
12
|
import { StyledContainer, StyledPopperWrapper } from "./styled.js";
|
|
14
13
|
const Container = () => {
|
|
15
|
-
const { props,
|
|
14
|
+
const { props, setMenuState, menuState } = useContext(ComboBoxContext);
|
|
16
15
|
const {
|
|
17
16
|
inline,
|
|
18
17
|
startPlacementPreference,
|
|
@@ -30,10 +29,6 @@ const Container = () => {
|
|
|
30
29
|
const handleMouseDown = useCallback((e) => {
|
|
31
30
|
e.preventDefault();
|
|
32
31
|
}, []);
|
|
33
|
-
const handleCloseMenu = useCallback(() => {
|
|
34
|
-
setMenuState(false, "blur");
|
|
35
|
-
if (internalRef?.current) internalRef.current.blur();
|
|
36
|
-
}, [internalRef, setMenuState]);
|
|
37
32
|
useEffect(() => {
|
|
38
33
|
const closeMenuOnWindowBlur = () => {
|
|
39
34
|
if (menuState) setMenuState(false, "blur");
|
|
@@ -43,6 +38,10 @@ const Container = () => {
|
|
|
43
38
|
window.removeEventListener("blur", closeMenuOnWindowBlur);
|
|
44
39
|
};
|
|
45
40
|
}, [menuState, setMenuState]);
|
|
41
|
+
const handleClickOutside = useCallback(() => {
|
|
42
|
+
if (inline) return;
|
|
43
|
+
setMenuState(false, "blur");
|
|
44
|
+
}, [setMenuState, inline]);
|
|
46
45
|
const config = useMemo(
|
|
47
46
|
() => ({
|
|
48
47
|
placement: startPlacementPreference,
|
|
@@ -50,23 +49,20 @@ const Container = () => {
|
|
|
50
49
|
placementOrderPreference,
|
|
51
50
|
zIndex: correctZIndex,
|
|
52
51
|
customOffset: [0, 5],
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
externallyControlledIsOpen: menuState,
|
|
53
|
+
// Gate on `!inline` — in inline mode the consumer's outer wrapper handles dismissal.
|
|
54
|
+
onClickOutside: inline ? void 0 : handleClickOutside
|
|
55
55
|
}),
|
|
56
|
-
[startPlacementPreference, placementOrderPreference, correctZIndex,
|
|
56
|
+
[startPlacementPreference, placementOrderPreference, correctZIndex, menuState, inline, handleClickOutside]
|
|
57
57
|
);
|
|
58
58
|
const { refs, floatingStyles, context } = useFloatingContext(config);
|
|
59
|
-
const hideTooltip = useCallback(() => {
|
|
60
|
-
setMenuState(false, "blur");
|
|
61
|
-
}, [setMenuState]);
|
|
62
|
-
useOnClickOutside(refs.reference, hideTooltip, refs.floating);
|
|
63
59
|
return /* @__PURE__ */ jsxs(
|
|
64
60
|
StyledContainer,
|
|
65
61
|
{
|
|
66
62
|
"data-testid": dataTestId ?? ComboboxDataTestid.CONTAINER,
|
|
67
63
|
innerRef: refs.setReference,
|
|
68
64
|
className,
|
|
69
|
-
applyAriaDisabled,
|
|
65
|
+
applyAriaDisabled: applyAriaDisabled ?? false,
|
|
70
66
|
...xStyledProps,
|
|
71
67
|
getOwnerProps,
|
|
72
68
|
getOwnerPropsArguments,
|
|
@@ -84,7 +80,17 @@ const Container = () => {
|
|
|
84
80
|
...popperProps,
|
|
85
81
|
key: `${isLoading}${isSkeleton}`
|
|
86
82
|
},
|
|
87
|
-
/* @__PURE__ */ jsx(
|
|
83
|
+
/* @__PURE__ */ jsx(
|
|
84
|
+
StyledPopperWrapper,
|
|
85
|
+
{
|
|
86
|
+
tabIndex: -1,
|
|
87
|
+
onMouseDown: handleMouseDown,
|
|
88
|
+
applyAriaDisabled: applyAriaDisabled ?? false,
|
|
89
|
+
getOwnerProps,
|
|
90
|
+
getOwnerPropsArguments,
|
|
91
|
+
children: /* @__PURE__ */ jsx(MenuList, {})
|
|
92
|
+
}
|
|
93
|
+
)
|
|
88
94
|
) : null
|
|
89
95
|
]
|
|
90
96
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/container/Container.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable consistent-return */\n/* eslint-disable complexity */\nimport { FloatingWrapper, useFloatingContext } from '@elliemae/ds-floating-context';\nimport { useGetGlobalAttributes, useGetXstyledProps, useOwnerProps } from '@elliemae/ds-props-helpers';\nimport React, { useCallback, useContext, useEffect, useMemo } from 'react';\nimport ComboBoxContext from '../../ComboBoxCTX.js';\nimport { ComboboxDataTestid } from '../../ComboboxDataTestids.js';\nimport {
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable consistent-return */\n/* eslint-disable complexity */\nimport { FloatingWrapper, useFloatingContext } from '@elliemae/ds-floating-context';\nimport { useGetGlobalAttributes, useGetXstyledProps, useOwnerProps } from '@elliemae/ds-props-helpers';\nimport React, { useCallback, useContext, useEffect, useMemo } from 'react';\nimport ComboBoxContext from '../../ComboBoxCTX.js';\nimport { ComboboxDataTestid } from '../../ComboboxDataTestids.js';\nimport { Controls } from '../controls/index.js';\nimport { LiveRegion } from '../LiveRegion.js';\nimport { MenuList } from '../menu-list/index.js';\nimport { StyledContainer, StyledPopperWrapper } from './styled.js';\n\nexport const Container = (): JSX.Element => {\n const { props, setMenuState, menuState } = useContext(ComboBoxContext);\n\n const {\n inline,\n startPlacementPreference,\n placementOrderPreference,\n isLoading,\n isSkeleton,\n applyAriaDisabled,\n popperProps,\n } = props;\n const globalAttributes = useGetGlobalAttributes(props) as ReturnType<typeof useGetGlobalAttributes> & {\n 'data-testid'?: string;\n };\n const { zIndex, ...xStyledProps } = useGetXstyledProps(props);\n const { getOwnerProps, getOwnerPropsArguments } = useOwnerProps(props);\n\n const correctZIndex = zIndex ? parseInt(zIndex as string, 10) : undefined;\n // Removing possible collisionable props\n const { className, 'data-testid': dataTestId } = globalAttributes;\n const handleMouseDown = useCallback((e: React.MouseEvent) => {\n e.preventDefault();\n }, []);\n\n useEffect(() => {\n const closeMenuOnWindowBlur = () => {\n if (menuState) setMenuState(false, 'blur');\n };\n\n window.addEventListener('blur', closeMenuOnWindowBlur);\n\n return () => {\n window.removeEventListener('blur', closeMenuOnWindowBlur);\n };\n }, [menuState, setMenuState]);\n\n // In inline mode the combobox is rendered inside a consumer-controlled FloatingWrapper.\n // The consumer owns dismissal; if we closed the internal menuState here, the outer wrapper\n // would stay open and the user would see the input without options (\"weird state\").\n const handleClickOutside = useCallback(() => {\n if (inline) return;\n setMenuState(false, 'blur');\n }, [setMenuState, inline]);\n\n const config = useMemo(\n () => ({\n placement: startPlacementPreference,\n withoutAnimation: true,\n placementOrderPreference,\n zIndex: correctZIndex,\n customOffset: [0, 5] as [number, number],\n externallyControlledIsOpen: menuState,\n // Gate on `!inline` \u2014 in inline mode the consumer's outer wrapper handles dismissal.\n onClickOutside: inline ? undefined : handleClickOutside,\n }),\n [startPlacementPreference, placementOrderPreference, correctZIndex, menuState, inline, handleClickOutside],\n );\n\n const { refs, floatingStyles, context } = useFloatingContext(config);\n\n return (\n <StyledContainer\n data-testid={dataTestId ?? ComboboxDataTestid.CONTAINER}\n innerRef={refs.setReference}\n className={className}\n applyAriaDisabled={applyAriaDisabled ?? false}\n {...xStyledProps}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n <LiveRegion />\n <Controls />\n\n {menuState && inline ? <MenuList /> : null}\n {menuState && !inline && refs.reference ? (\n <FloatingWrapper\n innerRef={refs.setFloating}\n floatingStyles={floatingStyles}\n isOpen={menuState}\n context={context}\n {...popperProps}\n key={`${isLoading}${isSkeleton}`} // to force remount when loading/skeleton changes\n >\n <StyledPopperWrapper\n tabIndex={-1}\n onMouseDown={handleMouseDown}\n applyAriaDisabled={applyAriaDisabled ?? false}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n <MenuList />\n </StyledPopperWrapper>\n </FloatingWrapper>\n ) : null}\n </StyledContainer>\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;AC0EnB,SASE,KATF;AAcI;AAtFR,SAAS,iBAAiB,0BAA0B;AACpD,SAAS,wBAAwB,oBAAoB,qBAAqB;AAC1E,SAAgB,aAAa,YAAY,WAAW,eAAe;AACnE,OAAO,qBAAqB;AAC5B,SAAS,0BAA0B;AACnC,SAAS,gBAAgB;AACzB,SAAS,kBAAkB;AAC3B,SAAS,gBAAgB;AACzB,SAAS,iBAAiB,2BAA2B;AAE9C,MAAM,YAAY,MAAmB;AAC1C,QAAM,EAAE,OAAO,cAAc,UAAU,IAAI,WAAW,eAAe;AAErE,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AACJ,QAAM,mBAAmB,uBAAuB,KAAK;AAGrD,QAAM,EAAE,QAAQ,GAAG,aAAa,IAAI,mBAAmB,KAAK;AAC5D,QAAM,EAAE,eAAe,uBAAuB,IAAI,cAAc,KAAK;AAErE,QAAM,gBAAgB,SAAS,SAAS,QAAkB,EAAE,IAAI;AAEhE,QAAM,EAAE,WAAW,eAAe,WAAW,IAAI;AACjD,QAAM,kBAAkB,YAAY,CAAC,MAAwB;AAC3D,MAAE,eAAe;AAAA,EACnB,GAAG,CAAC,CAAC;AAEL,YAAU,MAAM;AACd,UAAM,wBAAwB,MAAM;AAClC,UAAI,UAAW,cAAa,OAAO,MAAM;AAAA,IAC3C;AAEA,WAAO,iBAAiB,QAAQ,qBAAqB;AA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|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { styled, xStyledCommonProps } from "@elliemae/ds-system";
|
|
3
|
-
import {
|
|
3
|
+
import { DSFormComboboxName, FORM_COMBOBOX_SLOTS } from "../../constants/index.js";
|
|
4
4
|
const StyledContainer = styled("div", {
|
|
5
|
-
name:
|
|
6
|
-
slot:
|
|
5
|
+
name: DSFormComboboxName,
|
|
6
|
+
slot: FORM_COMBOBOX_SLOTS.ROOT
|
|
7
7
|
})`
|
|
8
8
|
position: relative;
|
|
9
9
|
cursor: ${({ disabled }) => disabled ? "not-allowed" : "default"};
|
|
@@ -11,7 +11,10 @@ const StyledContainer = styled("div", {
|
|
|
11
11
|
min-width: 64px;
|
|
12
12
|
${xStyledCommonProps}
|
|
13
13
|
`;
|
|
14
|
-
const StyledPopperWrapper = styled("div"
|
|
14
|
+
const StyledPopperWrapper = styled("div", {
|
|
15
|
+
name: DSFormComboboxName,
|
|
16
|
+
slot: FORM_COMBOBOX_SLOTS.POPPER_WRAPPER
|
|
17
|
+
})`
|
|
15
18
|
position: relative;
|
|
16
19
|
cursor: ${({ disabled }) => disabled ? "not-allowed" : "default"};
|
|
17
20
|
cursor: ${({ applyAriaDisabled }) => applyAriaDisabled ? "not-allowed" : "default"};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/container/styled.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { styled, xStyledCommonProps } from '@elliemae/ds-system';\nimport type { XstyledProps } from '@elliemae/ds-props-helpers';\nimport {
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,QAAQ,0BAA0B;AAE3C,SAAS,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { styled, xStyledCommonProps } from '@elliemae/ds-system';\nimport type { XstyledProps } from '@elliemae/ds-props-helpers';\nimport { DSFormComboboxName, FORM_COMBOBOX_SLOTS } from '../../constants/index.js';\n\nimport type {} from '@xstyled/system';\n\nexport const StyledContainer = styled('div', {\n name: DSFormComboboxName,\n slot: FORM_COMBOBOX_SLOTS.ROOT,\n})<XstyledProps & { disabled?: boolean; applyAriaDisabled: boolean }>`\n position: relative;\n cursor: ${({ disabled }) => (disabled ? 'not-allowed' : 'default')};\n cursor: ${({ applyAriaDisabled }) => (applyAriaDisabled ? 'not-allowed' : 'default')};\n min-width: 64px;\n ${xStyledCommonProps}\n`;\n\nexport const StyledPopperWrapper = styled('div', {\n name: DSFormComboboxName,\n slot: FORM_COMBOBOX_SLOTS.POPPER_WRAPPER,\n})<{ disabled?: boolean; applyAriaDisabled: boolean }>`\n position: relative;\n cursor: ${({ disabled }) => (disabled ? 'not-allowed' : 'default')};\n cursor: ${({ applyAriaDisabled }) => (applyAriaDisabled ? 'not-allowed' : 'default')};\n overflow: auto;\n`;\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,QAAQ,0BAA0B;AAE3C,SAAS,oBAAoB,2BAA2B;AAIjD,MAAM,kBAAkB,OAAO,OAAO;AAAA,EAC3C,MAAM;AAAA,EACN,MAAM,oBAAoB;AAC5B,CAAC;AAAA;AAAA,YAEW,CAAC,EAAE,SAAS,MAAO,WAAW,gBAAgB,SAAU;AAAA,YACxD,CAAC,EAAE,kBAAkB,MAAO,oBAAoB,gBAAgB,SAAU;AAAA;AAAA,IAElF,kBAAkB;AAAA;AAGf,MAAM,sBAAsB,OAAO,OAAO;AAAA,EAC/C,MAAM;AAAA,EACN,MAAM,oBAAoB;AAC5B,CAAC;AAAA;AAAA,YAEW,CAAC,EAAE,SAAS,MAAO,WAAW,gBAAgB,SAAU;AAAA,YACxD,CAAC,EAAE,kBAAkB,MAAO,oBAAoB,gBAAgB,SAAU;AAAA;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useOwnerProps } from "@elliemae/ds-props-helpers";
|
|
4
|
-
import { SimpleTruncatedTooltipText } from "@elliemae/ds-truncated-tooltip-text";
|
|
5
4
|
import { useCallback, useContext, useMemo } from "react";
|
|
6
5
|
import ComboBoxContext from "../../ComboBoxCTX.js";
|
|
7
6
|
import { ComboboxDataTestid } from "../../ComboboxDataTestids.js";
|
|
7
|
+
import { TruncatedTooltipText } from "../../TruncatedTooltipText.js";
|
|
8
8
|
import { ControlsInput } from "../controls-input/ControlsInput.js";
|
|
9
9
|
import { DropdownIndicator } from "../DropdownIndicator.js";
|
|
10
10
|
import { MultiSelectedValuesContainer } from "../multi-selected-values-container/index.js";
|
|
@@ -90,26 +90,27 @@ const Controls = () => {
|
|
|
90
90
|
getOwnerProps,
|
|
91
91
|
getOwnerPropsArguments,
|
|
92
92
|
innerRef: controlsWrapperRef,
|
|
93
|
-
readOnly,
|
|
93
|
+
readOnly: readOnly ?? false,
|
|
94
94
|
cols,
|
|
95
|
-
disabled,
|
|
96
|
-
applyAriaDisabled,
|
|
97
|
-
hasError,
|
|
98
|
-
inline,
|
|
95
|
+
disabled: disabled ?? false,
|
|
96
|
+
applyAriaDisabled: applyAriaDisabled ?? false,
|
|
97
|
+
hasError: hasError ?? false,
|
|
98
|
+
inline: inline ?? false,
|
|
99
99
|
onClick: handleOnClick,
|
|
100
100
|
onMouseDown: handleOnMouseDown,
|
|
101
101
|
onKeyDown: onKeyDownPills,
|
|
102
102
|
"aria-disabled": applyAriaDisabled,
|
|
103
103
|
"data-testid": ComboboxDataTestid.CONTROLS_WRAPPER,
|
|
104
104
|
children: [
|
|
105
|
-
!inline && /* @__PURE__ */ jsx(StyledSelection, { innerRef: selectedOptionsRef, onClick: handleOnPillsClick, children: Array.isArray(selectedValues) ? /* @__PURE__ */ jsx(MultiSelectedValuesContainer, {}) : /* @__PURE__ */ jsx(
|
|
105
|
+
!inline && /* @__PURE__ */ jsx(StyledSelection, { innerRef: selectedOptionsRef, onClick: handleOnPillsClick, getOwnerProps, children: Array.isArray(selectedValues) ? /* @__PURE__ */ jsx(MultiSelectedValuesContainer, {}) : /* @__PURE__ */ jsx(
|
|
106
106
|
StyledSingleSelectWraper,
|
|
107
107
|
{
|
|
108
|
-
readOnly,
|
|
108
|
+
readOnly: readOnly ?? false,
|
|
109
109
|
"data-testid": ComboboxDataTestid.SELECTED_VALUES,
|
|
110
|
-
disabled,
|
|
111
|
-
applyAriaDisabled,
|
|
112
|
-
|
|
110
|
+
disabled: disabled ?? false,
|
|
111
|
+
applyAriaDisabled: applyAriaDisabled ?? false,
|
|
112
|
+
getOwnerProps,
|
|
113
|
+
children: selectedValues && inputValue === "" ? /* @__PURE__ */ jsx(TruncatedTooltipText, { value: selectedValues.label }) : null
|
|
113
114
|
}
|
|
114
115
|
) }),
|
|
115
116
|
/* @__PURE__ */ jsx(ControlsInput, {}),
|
|
@@ -120,8 +121,17 @@ const Controls = () => {
|
|
|
120
121
|
justifyItems: "center",
|
|
121
122
|
cols: ["min-content", "minmax(28px,max-content)"],
|
|
122
123
|
justifyContent: "flex-end",
|
|
124
|
+
getOwnerProps,
|
|
123
125
|
children: [
|
|
124
|
-
/* @__PURE__ */ jsx(
|
|
126
|
+
/* @__PURE__ */ jsx(
|
|
127
|
+
StyleHeaderActionsSeparator,
|
|
128
|
+
{
|
|
129
|
+
disabled,
|
|
130
|
+
applyAriaDisabled,
|
|
131
|
+
readOnly,
|
|
132
|
+
getOwnerProps
|
|
133
|
+
}
|
|
134
|
+
),
|
|
125
135
|
/* @__PURE__ */ jsx(DropdownIndicator, {})
|
|
126
136
|
]
|
|
127
137
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/controls/Controls.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-statements */\n/* eslint-disable complexity */\nimport { useOwnerProps } from '@elliemae/ds-props-helpers';\nimport
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACqHX,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-statements */\n/* eslint-disable complexity */\nimport { useOwnerProps } from '@elliemae/ds-props-helpers';\nimport React, { useCallback, useContext, useMemo } from 'react';\nimport ComboBoxContext from '../../ComboBoxCTX.js';\nimport { ComboboxDataTestid } from '../../ComboboxDataTestids.js';\nimport { TruncatedTooltipText } from '../../TruncatedTooltipText.js';\nimport { ControlsInput } from '../controls-input/ControlsInput.js';\nimport { DropdownIndicator } from '../DropdownIndicator.js';\nimport { MultiSelectedValuesContainer } from '../multi-selected-values-container/index.js';\nimport {\n StyledControlsWrapper,\n StyledHeaderActionsWrapper,\n StyledSelection,\n StyledSingleSelectWraper,\n StyleHeaderActionsSeparator,\n} from './styled.js';\nimport { useOnPillsNavigation } from './useOnPillsNavigation.js';\n\nexport const Controls = (): JSX.Element => {\n const {\n props,\n props: { inline, disabled, hasError, selectedValues, applyAriaDisabled, readOnly, isMenuOpenableWithReadOnly },\n selectedOptionsRef,\n setMenuState,\n setFocusOptionIdx,\n hasFocus,\n inputValue,\n listRef,\n focusOptionIdx,\n menuState,\n controlsWrapperRef,\n internalRef,\n shouldPreventContextMenuOpening,\n } = useContext(ComboBoxContext);\n\n const { getOwnerProps, getOwnerPropsArguments } = useOwnerProps(props);\n\n const handleOnClick = useCallback(() => {\n if (disabled) return;\n if (applyAriaDisabled || shouldPreventContextMenuOpening) {\n internalRef.current?.focus();\n return;\n }\n if (hasFocus && menuState && !inline) {\n setMenuState(false, 'click');\n setFocusOptionIdx('');\n internalRef.current?.blur();\n return;\n }\n internalRef.current?.focus();\n setMenuState(true, 'click');\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [\n disabled,\n listRef,\n hasFocus,\n menuState,\n inline,\n setMenuState,\n focusOptionIdx,\n readOnly,\n applyAriaDisabled,\n isMenuOpenableWithReadOnly,\n ]);\n\n // this callback prevent to toggle the menu when clicking or removing pills\n const handleOnPillsClick: React.MouseEventHandler = useCallback(\n (e) => {\n if (applyAriaDisabled) return;\n if (menuState || disabled || shouldPreventContextMenuOpening) {\n e.stopPropagation();\n } else {\n internalRef.current?.focus();\n setMenuState(true, 'pill-click');\n }\n },\n [applyAriaDisabled, menuState, disabled, internalRef, setMenuState, shouldPreventContextMenuOpening],\n );\n\n // callback to prevent onBlur on the input when clicking in all the wrapper\n const handleOnMouseDown: React.MouseEventHandler = useCallback(\n (e) => {\n if (document.activeElement === internalRef.current || inline) {\n e.preventDefault();\n }\n },\n [internalRef, inline],\n );\n\n const { onKeyDownPills } = useOnPillsNavigation();\n\n const cols = useMemo(\n () => (!inline ? ['minmax(0px,max-content)', 'minmax(20px, auto)', '8px', '2.231rem'] : ['minmax(0px, auto)']),\n [inline],\n );\n return (\n <StyledControlsWrapper\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n innerRef={controlsWrapperRef}\n readOnly={readOnly ?? false}\n cols={cols}\n disabled={disabled ?? false}\n applyAriaDisabled={applyAriaDisabled ?? false}\n hasError={hasError ?? false}\n inline={inline ?? false}\n onClick={handleOnClick}\n onMouseDown={handleOnMouseDown}\n onKeyDown={onKeyDownPills}\n aria-disabled={applyAriaDisabled}\n data-testid={ComboboxDataTestid.CONTROLS_WRAPPER}\n >\n {!inline && (\n <StyledSelection innerRef={selectedOptionsRef} onClick={handleOnPillsClick} getOwnerProps={getOwnerProps}>\n {Array.isArray(selectedValues) ? (\n <MultiSelectedValuesContainer />\n ) : (\n <StyledSingleSelectWraper\n readOnly={readOnly ?? false}\n // legacy data-testid \u2014 preserved for QA/consumer compatibility, breaking change if removed\n data-testid={ComboboxDataTestid.SELECTED_VALUES}\n disabled={disabled ?? false}\n applyAriaDisabled={applyAriaDisabled ?? false}\n getOwnerProps={getOwnerProps}\n >\n {selectedValues && inputValue === '' ? <TruncatedTooltipText value={selectedValues.label} /> : null}\n </StyledSingleSelectWraper>\n )}\n </StyledSelection>\n )}\n\n <ControlsInput />\n {/** This empty div is a gap between the input and the drop down indicator */}\n <div />\n {!inline && (\n <StyledHeaderActionsWrapper\n justifyItems=\"center\"\n cols={['min-content', 'minmax(28px,max-content)']}\n justifyContent=\"flex-end\"\n getOwnerProps={getOwnerProps}\n >\n <StyleHeaderActionsSeparator\n disabled={disabled}\n applyAriaDisabled={applyAriaDisabled}\n readOnly={readOnly}\n getOwnerProps={getOwnerProps}\n />\n <DropdownIndicator />\n </StyledHeaderActionsWrapper>\n )}\n </StyledControlsWrapper>\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACqHX,cAoBJ,YApBI;AAnHZ,SAAS,qBAAqB;AAC9B,SAAgB,aAAa,YAAY,eAAe;AACxD,OAAO,qBAAqB;AAC5B,SAAS,0BAA0B;AACnC,SAAS,4BAA4B;AACrC,SAAS,qBAAqB;AAC9B,SAAS,yBAAyB;AAClC,SAAS,oCAAoC;AAC7C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,4BAA4B;AAE9B,MAAM,WAAW,MAAmB;AACzC,QAAM;AAAA,IACJ;AAAA,IACA,OAAO,EAAE,QAAQ,UAAU,UAAU,gBAAgB,mBAAmB,UAAU,2BAA2B;AAAA,IAC7G;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,WAAW,eAAe;AAE9B,QAAM,EAAE,eAAe,uBAAuB,IAAI,cAAc,KAAK;AAErE,QAAM,gBAAgB,YAAY,MAAM;AACtC,QAAI,SAAU;AACd,QAAI,q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