@elliemae/ds-app-picker 3.70.0-next.7 → 3.70.0-next.70
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/DSAppPicker.js +10 -141
- package/dist/cjs/DSAppPicker.js.map +3 -3
- package/dist/cjs/{utils.js → DSAppPickerCTX.js} +8 -25
- package/dist/cjs/DSAppPickerCTX.js.map +7 -0
- package/dist/cjs/config/useAppPicker.js +25 -8
- package/dist/cjs/config/useAppPicker.js.map +3 -3
- package/dist/cjs/config/useFocusTracker.js +104 -0
- package/dist/cjs/config/useFocusTracker.js.map +7 -0
- package/dist/cjs/config/useValidateProps.js +63 -0
- package/dist/cjs/config/useValidateProps.js.map +7 -0
- package/dist/cjs/constants/index.js +11 -1
- package/dist/cjs/constants/index.js.map +2 -2
- package/dist/cjs/index.js +8 -1
- package/dist/cjs/index.js.map +3 -3
- package/dist/cjs/package.json +1 -4
- package/dist/cjs/parts/AppPanel.js +143 -0
- package/dist/cjs/parts/AppPanel.js.map +7 -0
- package/dist/cjs/parts/AppPickerFloatingContext/AppPickerContent.js +104 -0
- package/dist/cjs/parts/AppPickerFloatingContext/AppPickerContent.js.map +7 -0
- package/dist/cjs/parts/AppPickerFloatingContext/useAppPickerFloatingContext.js +195 -0
- package/dist/cjs/parts/AppPickerFloatingContext/useAppPickerFloatingContext.js.map +7 -0
- package/dist/cjs/parts/AppPickerItem.js +104 -0
- package/dist/cjs/parts/AppPickerItem.js.map +7 -0
- package/dist/cjs/parts/AppSection.js +95 -0
- package/dist/cjs/parts/AppSection.js.map +7 -0
- package/dist/cjs/parts/Trigger.js +83 -0
- package/dist/cjs/parts/Trigger.js.map +7 -0
- package/dist/cjs/parts/shared-styles.js +44 -0
- package/dist/cjs/parts/shared-styles.js.map +7 -0
- package/dist/cjs/react-desc-prop-types.js +28 -8
- package/dist/cjs/react-desc-prop-types.js.map +2 -2
- package/dist/cjs/typescript-testing/slot-props.js +48 -0
- package/dist/cjs/typescript-testing/slot-props.js.map +7 -0
- package/dist/cjs/typescript-testing/typescript-app-picker-valid.js +15 -2
- package/dist/cjs/typescript-testing/typescript-app-picker-valid.js.map +2 -2
- package/dist/cjs/util/getChipId.js +36 -0
- package/dist/cjs/util/getChipId.js.map +7 -0
- package/dist/cjs/util/getChipRegionId.js +37 -0
- package/dist/cjs/util/getChipRegionId.js.map +7 -0
- package/dist/cjs/util/getDSAppPickerContractProps.js +38 -0
- package/dist/cjs/util/getDSAppPickerContractProps.js.map +7 -0
- package/dist/cjs/util/instanceIds.js +42 -0
- package/dist/cjs/util/instanceIds.js.map +7 -0
- package/dist/esm/DSAppPicker.js +10 -141
- package/dist/esm/DSAppPicker.js.map +3 -3
- package/dist/esm/DSAppPickerCTX.js +8 -0
- package/dist/esm/DSAppPickerCTX.js.map +7 -0
- package/dist/esm/config/useAppPicker.js +29 -13
- package/dist/esm/config/useAppPicker.js.map +3 -3
- package/dist/esm/config/useFocusTracker.js +74 -0
- package/dist/esm/config/useFocusTracker.js.map +7 -0
- package/dist/esm/config/useValidateProps.js +33 -0
- package/dist/esm/config/useValidateProps.js.map +7 -0
- package/dist/esm/constants/index.js +11 -1
- package/dist/esm/constants/index.js.map +2 -2
- package/dist/esm/index.js +13 -1
- package/dist/esm/index.js.map +3 -3
- package/dist/esm/package.json +1 -4
- package/dist/esm/parts/AppPanel.js +118 -0
- package/dist/esm/parts/AppPanel.js.map +7 -0
- package/dist/esm/parts/AppPickerFloatingContext/AppPickerContent.js +74 -0
- package/dist/esm/parts/AppPickerFloatingContext/AppPickerContent.js.map +7 -0
- package/dist/esm/parts/AppPickerFloatingContext/useAppPickerFloatingContext.js +165 -0
- package/dist/esm/parts/AppPickerFloatingContext/useAppPickerFloatingContext.js.map +7 -0
- package/dist/esm/parts/AppPickerItem.js +74 -0
- package/dist/esm/parts/AppPickerItem.js.map +7 -0
- package/dist/esm/parts/AppSection.js +65 -0
- package/dist/esm/parts/AppSection.js.map +7 -0
- package/dist/esm/parts/Trigger.js +53 -0
- package/dist/esm/parts/Trigger.js.map +7 -0
- package/dist/esm/parts/shared-styles.js +14 -0
- package/dist/esm/parts/shared-styles.js.map +7 -0
- package/dist/esm/react-desc-prop-types.js +34 -9
- package/dist/esm/react-desc-prop-types.js.map +2 -2
- package/dist/esm/typescript-testing/slot-props.js +25 -0
- package/dist/esm/typescript-testing/slot-props.js.map +7 -0
- package/dist/esm/typescript-testing/typescript-app-picker-valid.js +15 -2
- package/dist/esm/typescript-testing/typescript-app-picker-valid.js.map +2 -2
- package/dist/esm/util/getChipId.js +6 -0
- package/dist/esm/util/getChipId.js.map +7 -0
- package/dist/esm/util/getChipRegionId.js +7 -0
- package/dist/esm/util/getChipRegionId.js.map +7 -0
- package/dist/esm/util/getDSAppPickerContractProps.js +8 -0
- package/dist/esm/util/getDSAppPickerContractProps.js.map +7 -0
- package/dist/esm/util/instanceIds.js +12 -0
- package/dist/esm/util/instanceIds.js.map +7 -0
- package/dist/types/DSAppPicker.d.ts +1 -2
- package/dist/types/DSAppPickerCTX.d.ts +6 -0
- package/dist/types/config/useAppPicker.d.ts +111 -92
- package/dist/types/config/useFocusTracker.d.ts +19 -0
- package/dist/types/config/useValidateProps.d.ts +3 -0
- package/dist/types/constants/index.d.ts +17 -7
- package/dist/types/index.d.ts +2 -0
- package/dist/types/parts/AppPanel.d.ts +2 -0
- package/dist/types/parts/AppPickerFloatingContext/AppPickerContent.d.ts +3 -0
- package/dist/types/parts/AppPickerFloatingContext/useAppPickerFloatingContext.d.ts +171 -0
- package/dist/types/parts/AppPickerItem.d.ts +11 -0
- package/dist/types/parts/AppSection.d.ts +6 -0
- package/dist/types/parts/Trigger.d.ts +14 -0
- package/dist/types/parts/shared-styles.d.ts +2 -0
- package/dist/types/react-desc-prop-types.d.ts +112 -9
- package/dist/types/util/getChipId.d.ts +2 -0
- package/dist/types/util/getChipRegionId.d.ts +1 -0
- package/dist/types/util/getDSAppPickerContractProps.d.ts +37 -0
- package/dist/types/util/instanceIds.d.ts +11 -0
- package/package.json +22 -19
- package/dist/cjs/AppPickerImpl.js +0 -204
- package/dist/cjs/AppPickerImpl.js.map +0 -7
- package/dist/cjs/hooks/useKeepTrackButtons.js +0 -69
- package/dist/cjs/hooks/useKeepTrackButtons.js.map +0 -7
- package/dist/cjs/styles.js +0 -76
- package/dist/cjs/styles.js.map +0 -7
- package/dist/cjs/utils.js.map +0 -7
- package/dist/esm/AppPickerImpl.js +0 -174
- package/dist/esm/AppPickerImpl.js.map +0 -7
- package/dist/esm/hooks/useKeepTrackButtons.js +0 -39
- package/dist/esm/hooks/useKeepTrackButtons.js.map +0 -7
- package/dist/esm/styles.js +0 -46
- package/dist/esm/styles.js.map +0 -7
- package/dist/esm/utils.js +0 -25
- package/dist/esm/utils.js.map +0 -7
- package/dist/types/AppPickerImpl.d.ts +0 -11
- package/dist/types/hooks/useKeepTrackButtons.d.ts +0 -13
- package/dist/types/styles.d.ts +0 -7
- package/dist/types/tests/app-picker.a11y.test.d.ts +0 -1
- package/dist/types/tests/app-picker.data-testid.test.d.ts +0 -1
- package/dist/types/tests/app-picker.events.test.d.ts +0 -1
- package/dist/types/tests/app-picker.exports.test.d.ts +0 -1
- package/dist/types/tests/app-picker.get-owner-props.test.d.ts +0 -1
- package/dist/types/tests/app-picker.keyboard.test.d.ts +0 -1
- package/dist/types/typescript-testing/typescript-app-picker-valid.d.ts +0 -1
- package/dist/types/utils.d.ts +0 -14
package/dist/cjs/DSAppPicker.js
CHANGED
|
@@ -29,155 +29,24 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
29
29
|
var DSAppPicker_exports = {};
|
|
30
30
|
__export(DSAppPicker_exports, {
|
|
31
31
|
AppPickerWithSchema: () => AppPickerWithSchema,
|
|
32
|
-
DSAppPicker: () => DSAppPicker
|
|
33
|
-
default: () => DSAppPicker_default
|
|
32
|
+
DSAppPicker: () => DSAppPicker
|
|
34
33
|
});
|
|
35
34
|
module.exports = __toCommonJS(DSAppPicker_exports);
|
|
36
35
|
var React = __toESM(require("react"));
|
|
37
36
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
38
|
-
var import_react = require("react");
|
|
39
|
-
var import_ds_button_v2 = require("@elliemae/ds-button-v2");
|
|
40
|
-
var import_ds_system = require("@elliemae/ds-system");
|
|
41
37
|
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
42
|
-
var
|
|
43
|
-
var import_AppPickerImpl = __toESM(require("./AppPickerImpl.js"));
|
|
44
|
-
var import_react_desc_prop_types = require("./react-desc-prop-types.js");
|
|
45
|
-
var import_constants = require("./constants/index.js");
|
|
38
|
+
var import_react = __toESM(require("react"));
|
|
46
39
|
var import_useAppPicker = require("./config/useAppPicker.js");
|
|
47
|
-
|
|
40
|
+
var import_constants = require("./constants/index.js");
|
|
41
|
+
var import_DSAppPickerCTX = require("./DSAppPickerCTX.js");
|
|
42
|
+
var import_AppPickerContent = require("./parts/AppPickerFloatingContext/AppPickerContent.js");
|
|
43
|
+
var import_react_desc_prop_types = require("./react-desc-prop-types.js");
|
|
48
44
|
const DSAppPicker = (props) => {
|
|
49
|
-
const
|
|
50
|
-
const {
|
|
51
|
-
|
|
52
|
-
apps,
|
|
53
|
-
customApps,
|
|
54
|
-
sectionTitle,
|
|
55
|
-
customSectionTitle,
|
|
56
|
-
icon: Icon,
|
|
57
|
-
renderTrigger,
|
|
58
|
-
isOpen,
|
|
59
|
-
onClose,
|
|
60
|
-
actionRef,
|
|
61
|
-
onKeyDown,
|
|
62
|
-
onClick,
|
|
63
|
-
onClickOutside,
|
|
64
|
-
triggerRef
|
|
65
|
-
} = propsWithDefault;
|
|
66
|
-
const [open, setOpen] = (0, import_react.useState)(false);
|
|
67
|
-
const [isOverflow, setIsOverflow] = (0, import_react.useState)(false);
|
|
68
|
-
const wrapperRef = (0, import_react.useRef)(null);
|
|
69
|
-
const defaultTriggerRef = (0, import_react.useRef)(null);
|
|
70
|
-
const wasOpenedByKeyboardRef = (0, import_react.useRef)(false);
|
|
71
|
-
(0, import_react.useEffect)(() => {
|
|
72
|
-
if (actionRef && actionRef.current) {
|
|
73
|
-
actionRef.current.focusToIndex = (index) => {
|
|
74
|
-
if (wrapperRef.current) {
|
|
75
|
-
const parent = wrapperRef.current;
|
|
76
|
-
const buttons = [...parent.querySelectorAll("button")];
|
|
77
|
-
buttons[index].focus();
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
actionRef.current.focusWrapper = () => {
|
|
81
|
-
wrapperRef.current?.focus();
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
}, [actionRef, apps, customApps]);
|
|
85
|
-
(0, import_react.useEffect)(() => {
|
|
86
|
-
setTimeout(() => {
|
|
87
|
-
if (wrapperRef.current) {
|
|
88
|
-
const { scrollHeight, clientHeight } = wrapperRef.current;
|
|
89
|
-
if (scrollHeight > clientHeight) return setIsOverflow(true);
|
|
90
|
-
}
|
|
91
|
-
return setIsOverflow(false);
|
|
92
|
-
});
|
|
93
|
-
}, [isOpen, open]);
|
|
94
|
-
const handleOnClose = (0, import_react.useCallback)(() => {
|
|
95
|
-
setOpen(false);
|
|
96
|
-
onClose?.();
|
|
97
|
-
}, [onClose]);
|
|
98
|
-
const handleOnClickOutside = (e) => {
|
|
99
|
-
setOpen(false);
|
|
100
|
-
onClose?.();
|
|
101
|
-
onClickOutside?.(e);
|
|
102
|
-
};
|
|
103
|
-
const AppPickerContent = (0, import_react.useCallback)(
|
|
104
|
-
() => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
105
|
-
import_AppPickerImpl.default,
|
|
106
|
-
{
|
|
107
|
-
...getOwnerProps(),
|
|
108
|
-
...getOwnerPropsArguments(),
|
|
109
|
-
apps,
|
|
110
|
-
customApps,
|
|
111
|
-
sectionTitle,
|
|
112
|
-
customSectionTitle,
|
|
113
|
-
close: handleOnClose,
|
|
114
|
-
wrapperRef,
|
|
115
|
-
onKeyDown,
|
|
116
|
-
triggerRef: triggerRef || defaultTriggerRef,
|
|
117
|
-
actionRef,
|
|
118
|
-
triggerIsInternal: !renderTrigger,
|
|
119
|
-
wasOpenedByKeyboardRef,
|
|
120
|
-
isOverflow
|
|
121
|
-
}
|
|
122
|
-
),
|
|
123
|
-
[
|
|
124
|
-
actionRef,
|
|
125
|
-
apps,
|
|
126
|
-
customApps,
|
|
127
|
-
customSectionTitle,
|
|
128
|
-
handleOnClose,
|
|
129
|
-
isOverflow,
|
|
130
|
-
onKeyDown,
|
|
131
|
-
renderTrigger,
|
|
132
|
-
sectionTitle,
|
|
133
|
-
triggerRef,
|
|
134
|
-
getOwnerProps,
|
|
135
|
-
getOwnerPropsArguments
|
|
136
|
-
]
|
|
137
|
-
);
|
|
138
|
-
const RenderTrigger = (0, import_react.useMemo)(
|
|
139
|
-
() => renderTrigger || (({ ref }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
140
|
-
StyledButton,
|
|
141
|
-
{
|
|
142
|
-
"data-testid": "app-picker__button",
|
|
143
|
-
id: "app-picker__button",
|
|
144
|
-
buttonType: "icon",
|
|
145
|
-
"aria-haspopup": "true",
|
|
146
|
-
"aria-expanded": isOpen ?? open,
|
|
147
|
-
"aria-label": "Application picker",
|
|
148
|
-
innerRef: (0, import_ds_system.mergeRefs)(ref, triggerRef || defaultTriggerRef),
|
|
149
|
-
onClick: (e) => {
|
|
150
|
-
wasOpenedByKeyboardRef.current = e.detail === 0;
|
|
151
|
-
onClick?.(e);
|
|
152
|
-
setOpen(true);
|
|
153
|
-
},
|
|
154
|
-
getOwnerProps,
|
|
155
|
-
getOwnerPropsArguments,
|
|
156
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, {})
|
|
157
|
-
}
|
|
158
|
-
)),
|
|
159
|
-
[Icon, getOwnerProps, getOwnerPropsArguments, isOpen, onClick, open, renderTrigger, triggerRef]
|
|
160
|
-
);
|
|
161
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
162
|
-
import_ds_legacy_popover.DSPopover,
|
|
163
|
-
{
|
|
164
|
-
content: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AppPickerContent, {}),
|
|
165
|
-
isOpen: typeof isOpen === "boolean" ? isOpen : open,
|
|
166
|
-
onClickOutside: handleOnClickOutside,
|
|
167
|
-
placement: "bottom",
|
|
168
|
-
interactionType: "click",
|
|
169
|
-
renderTrigger: RenderTrigger,
|
|
170
|
-
showArrow: true,
|
|
171
|
-
style: {
|
|
172
|
-
padding: "0",
|
|
173
|
-
maxWidth: "1000px",
|
|
174
|
-
width: "fit-content"
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
);
|
|
45
|
+
const appPickerConfig = (0, import_useAppPicker.useAppPicker)(props);
|
|
46
|
+
const ctx = import_react.default.useMemo(() => ({ ...appPickerConfig }), [appPickerConfig]);
|
|
47
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_DSAppPickerCTX.DSAppPickerContext.Provider, { value: ctx, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_AppPickerContent.AppPickerContent, {}) });
|
|
178
48
|
};
|
|
179
49
|
DSAppPicker.displayName = import_constants.DSAppPickerName;
|
|
180
50
|
const AppPickerWithSchema = (0, import_ds_props_helpers.describe)(DSAppPicker);
|
|
181
|
-
AppPickerWithSchema.propTypes = import_react_desc_prop_types.
|
|
182
|
-
var DSAppPicker_default = DSAppPicker;
|
|
51
|
+
AppPickerWithSchema.propTypes = import_react_desc_prop_types.DSAppPickerPropTypesSchema;
|
|
183
52
|
//# sourceMappingURL=DSAppPicker.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/DSAppPicker.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
6
|
-
"names": ["
|
|
4
|
+
"sourcesContent": ["import { describe } from '@elliemae/ds-props-helpers';\nimport React from 'react';\nimport { useAppPicker } from './config/useAppPicker.js';\nimport { DSAppPickerName } from './constants/index.js';\nimport { DSAppPickerContext, type DSAppPickerCTX } from './DSAppPickerCTX.js';\nimport { AppPickerContent } from './parts/AppPickerFloatingContext/AppPickerContent.js';\nimport type { DSAppPickerT } from './react-desc-prop-types.js';\nimport { DSAppPickerPropTypesSchema } from './react-desc-prop-types.js';\n\nconst DSAppPicker: React.ComponentType<DSAppPickerT.Props> = (props) => {\n const appPickerConfig = useAppPicker(props);\n const ctx: DSAppPickerCTX = React.useMemo(() => ({ ...appPickerConfig }), [appPickerConfig]);\n\n return (\n <DSAppPickerContext.Provider value={ctx}>\n <AppPickerContent />\n </DSAppPickerContext.Provider>\n );\n};\n\nDSAppPicker.displayName = DSAppPickerName;\nconst AppPickerWithSchema = describe(DSAppPicker);\nAppPickerWithSchema.propTypes = DSAppPickerPropTypesSchema;\n\nexport { AppPickerWithSchema, DSAppPicker };\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADejB;AAfN,8BAAyB;AACzB,mBAAkB;AAClB,0BAA6B;AAC7B,uBAAgC;AAChC,4BAAwD;AACxD,8BAAiC;AAEjC,mCAA2C;AAE3C,MAAM,cAAuD,CAAC,UAAU;AACtE,QAAM,sBAAkB,kCAAa,KAAK;AAC1C,QAAM,MAAsB,aAAAA,QAAM,QAAQ,OAAO,EAAE,GAAG,gBAAgB,IAAI,CAAC,eAAe,CAAC;AAE3F,SACE,4CAAC,yCAAmB,UAAnB,EAA4B,OAAO,KAClC,sDAAC,4CAAiB,GACpB;AAEJ;AAEA,YAAY,cAAc;AAC1B,MAAM,0BAAsB,kCAAS,WAAW;AAChD,oBAAoB,YAAY;",
|
|
6
|
+
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -26,30 +26,13 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
31
|
-
|
|
32
|
-
keys: () => keys
|
|
29
|
+
var DSAppPickerCTX_exports = {};
|
|
30
|
+
__export(DSAppPickerCTX_exports, {
|
|
31
|
+
DSAppPickerContext: () => DSAppPickerContext
|
|
33
32
|
});
|
|
34
|
-
module.exports = __toCommonJS(
|
|
33
|
+
module.exports = __toCommonJS(DSAppPickerCTX_exports);
|
|
35
34
|
var React = __toESM(require("react"));
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
DOWN: "ArrowDown",
|
|
41
|
-
ENTER: "Enter",
|
|
42
|
-
SPACE: "",
|
|
43
|
-
TAB: "Tab",
|
|
44
|
-
ESC: "Escape",
|
|
45
|
-
HOME: "Home",
|
|
46
|
-
END: "End"
|
|
47
|
-
};
|
|
48
|
-
const focusSelectedOrFirstAvailable = (wrapperRef, allFocusableButtonsRef, selectedButtonRef) => {
|
|
49
|
-
if (selectedButtonRef.current !== null) {
|
|
50
|
-
wrapperRef?.current?.querySelectorAll("button")[selectedButtonRef.current].focus();
|
|
51
|
-
} else {
|
|
52
|
-
allFocusableButtonsRef?.[0]?.focus();
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
//# sourceMappingURL=utils.js.map
|
|
35
|
+
var import_react = require("react");
|
|
36
|
+
const defaultContext = {};
|
|
37
|
+
const DSAppPickerContext = (0, import_react.createContext)(defaultContext);
|
|
38
|
+
//# sourceMappingURL=DSAppPickerCTX.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/DSAppPickerCTX.ts", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import { createContext } from 'react';\nimport type { useAppPicker } from './config/useAppPicker.js';\n\nexport interface DSAppPickerCTX extends ReturnType<typeof useAppPicker> {}\n\nconst defaultContext = {} as DSAppPickerCTX;\n\n/** Single source of truth for DSAppPicker's parts \u2014 props, owner-props config, floating-context\n * render state, and focus tracker. Replaces per-part prop drilling. */\nexport const DSAppPickerContext = createContext<DSAppPickerCTX>(defaultContext);\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAA8B;AAK9B,MAAM,iBAAiB,CAAC;AAIjB,MAAM,yBAAqB,4BAA8B,cAAc;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -32,24 +32,41 @@ __export(useAppPicker_exports, {
|
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(useAppPicker_exports);
|
|
34
34
|
var React = __toESM(require("react"));
|
|
35
|
-
var import_react = __toESM(require("react"));
|
|
36
35
|
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
36
|
+
var import_react = __toESM(require("react"));
|
|
37
|
+
var import_uid = require("uid");
|
|
37
38
|
var import_react_desc_prop_types = require("../react-desc-prop-types.js");
|
|
38
|
-
var
|
|
39
|
+
var import_useFocusTracker = require("./useFocusTracker.js");
|
|
40
|
+
var import_useValidateProps = require("./useValidateProps.js");
|
|
39
41
|
const useAppPicker = (props) => {
|
|
40
42
|
const propsWithDefault = (0, import_ds_props_helpers.useMemoMergePropsWithDefault)(props, import_react_desc_prop_types.defaultProps);
|
|
41
|
-
(0,
|
|
42
|
-
const ownerPropsConfig = (0, import_ds_props_helpers.useOwnerProps)(propsWithDefault,
|
|
43
|
-
const globalAttributes = (0, import_ds_props_helpers.
|
|
44
|
-
const xstyledProps = (0, import_ds_props_helpers.
|
|
43
|
+
(0, import_useValidateProps.useValidateProps)(propsWithDefault, import_react_desc_prop_types.DSAppPickerPropTypesSchema);
|
|
44
|
+
const ownerPropsConfig = (0, import_ds_props_helpers.useOwnerProps)(propsWithDefault, propsWithDefault);
|
|
45
|
+
const globalAttributes = (0, import_ds_props_helpers.useGetGlobalAttributes)(props);
|
|
46
|
+
const xstyledProps = (0, import_ds_props_helpers.useGetXstyledProps)(props);
|
|
47
|
+
const openIntentRef = (0, import_react.useRef)("pointer");
|
|
48
|
+
const { isOpen, apps, customApps, id } = propsWithDefault;
|
|
49
|
+
const [internalIsOpen, setInternalIsOpen] = (0, import_react.useState)(false);
|
|
50
|
+
const resolvedIsOpen = typeof isOpen === "boolean" ? isOpen : internalIsOpen;
|
|
51
|
+
const mountedOpenAutofocusPendingRef = (0, import_react.useRef)(resolvedIsOpen);
|
|
52
|
+
const allApps = (0, import_react.useMemo)(() => [...apps, ...customApps], [apps, customApps]);
|
|
53
|
+
const useFocusTrackerConfig = (0, import_react.useMemo)(() => ({ allApps }), [allApps]);
|
|
54
|
+
const focusTrackers = (0, import_useFocusTracker.useFocusTracker)(useFocusTrackerConfig);
|
|
55
|
+
const instanceUid = import_react.default.useMemo(() => id || `ds-app-picker-${(0, import_uid.uid)(5)}`, [id]);
|
|
45
56
|
return import_react.default.useMemo(
|
|
46
57
|
() => ({
|
|
58
|
+
focusTrackers,
|
|
47
59
|
propsWithDefault,
|
|
48
60
|
ownerPropsConfig,
|
|
49
61
|
globalAttributes,
|
|
50
|
-
xstyledProps
|
|
62
|
+
xstyledProps,
|
|
63
|
+
openIntentRef,
|
|
64
|
+
mountedOpenAutofocusPendingRef,
|
|
65
|
+
resolvedIsOpen,
|
|
66
|
+
setInternalIsOpen,
|
|
67
|
+
instanceUid
|
|
51
68
|
}),
|
|
52
|
-
[propsWithDefault, ownerPropsConfig, globalAttributes, xstyledProps]
|
|
69
|
+
[focusTrackers, propsWithDefault, ownerPropsConfig, globalAttributes, xstyledProps, resolvedIsOpen, instanceUid]
|
|
53
70
|
);
|
|
54
71
|
};
|
|
55
72
|
//# sourceMappingURL=useAppPicker.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../src/config/useAppPicker.
|
|
4
|
-
"sourcesContent": ["import
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,
|
|
3
|
+
"sources": ["../../../src/config/useAppPicker.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import {\n useGetGlobalAttributes,\n useGetXstyledProps,\n useMemoMergePropsWithDefault,\n useOwnerProps,\n} from '@elliemae/ds-props-helpers';\nimport React, { useMemo, useRef, useState } from 'react';\nimport { uid } from 'uid';\nimport { type DSAppPickerT, defaultProps, DSAppPickerPropTypesSchema } from '../react-desc-prop-types.js';\nimport { useFocusTracker } from './useFocusTracker.js';\nimport { useValidateProps } from './useValidateProps.js';\n\nexport const useAppPicker = (props: DSAppPickerT.Props) => {\n // =============================================================================\n // MERGE WITH DEFAULT AND VALIDATE PROPS\n // =============================================================================\n const propsWithDefault = useMemoMergePropsWithDefault<DSAppPickerT.InternalProps>(props, defaultProps);\n useValidateProps(propsWithDefault, DSAppPickerPropTypesSchema);\n // =============================================================================\n // GLOBAL ATTRIBUTES & XSTYLED PROPS\n // =============================================================================\n // Use propsWithDefault (stable, deep-comparison memoized) instead of { ...props }\n // to prevent getOwnerPropsArguments from creating a new object reference every render.\n const ownerPropsConfig = useOwnerProps(propsWithDefault, propsWithDefault);\n\n const globalAttributes = useGetGlobalAttributes<DSAppPickerT.Props>(props);\n const xstyledProps = useGetXstyledProps<DSAppPickerT.Props>(props);\n // =============================================================================\n // Specific component state and logics\n // =============================================================================\n /*\n * HOW the pending open was triggered, which is the only input to where initial focus lands.\n *\n * A union rather than a boolean because there are three landings, not two: a pointer open goes to the\n * panel, ArrowDown-style keyboard activation goes to the selection or the FIRST item, and ArrowUp goes to\n * the selection or the LAST one. Keeping it as one value means there is exactly one thing to read in\n * handleFloatingOpen, so nothing else can end up writing a competing focus intent.\n */\n const openIntentRef = useRef<DSAppPickerT.OpenIntent>('pointer');\n\n // \"Is the panel open\" is top-level component state. `isOpen` (controlled) takes precedence over\n // the internal state when provided. resolvedIsOpen feeds useFloatingContext's\n // externallyControlledIsOpen; initial-focus-on-open is driven off useFloatingContext's onOpen\n // (which fires on that transition), so the focus tracker itself stays a pure region tracker with\n // no open-state awareness.\n const { isOpen, apps, customApps, id } = propsWithDefault;\n const [internalIsOpen, setInternalIsOpen] = useState(false);\n const resolvedIsOpen = typeof isOpen === 'boolean' ? isOpen : internalIsOpen;\n\n // Was DSAppPicker rendered already-open at mount (declarative `isOpen`, before any user\n // interaction)? Such an open is not a transition, so useAppPickerFloatingContext's onOpen seed\n // never fires for it \u2014 AppPanel's useMountedOpenAutofocusNuance consumes this to seed that one\n // case. Captured once; the nuance flips it false after consuming so a later controlled reopen\n // (a real transition, handled by onOpen) doesn't re-trigger it.\n const mountedOpenAutofocusPendingRef = useRef(resolvedIsOpen);\n\n const allApps = useMemo(() => [...apps, ...customApps], [apps, customApps]);\n const useFocusTrackerConfig = useMemo(() => ({ allApps }), [allApps]);\n const focusTrackers = useFocusTracker(useFocusTrackerConfig);\n\n const instanceUid = React.useMemo(() => id || `ds-app-picker-${uid(5)}`, [id]);\n\n return React.useMemo(\n () => ({\n focusTrackers,\n propsWithDefault,\n ownerPropsConfig,\n globalAttributes,\n xstyledProps,\n openIntentRef,\n mountedOpenAutofocusPendingRef,\n resolvedIsOpen,\n setInternalIsOpen,\n instanceUid,\n }),\n [focusTrackers, propsWithDefault, ownerPropsConfig, globalAttributes, xstyledProps, resolvedIsOpen, instanceUid],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,8BAKO;AACP,mBAAiD;AACjD,iBAAoB;AACpB,mCAA4E;AAC5E,6BAAgC;AAChC,8BAAiC;AAE1B,MAAM,eAAe,CAAC,UAA8B;AAIzD,QAAM,uBAAmB,sDAAyD,OAAO,yCAAY;AACrG,gDAAiB,kBAAkB,uDAA0B;AAM7D,QAAM,uBAAmB,uCAAc,kBAAkB,gBAAgB;AAEzE,QAAM,uBAAmB,gDAA2C,KAAK;AACzE,QAAM,mBAAe,4CAAuC,KAAK;AAYjE,QAAM,oBAAgB,qBAAgC,SAAS;AAO/D,QAAM,EAAE,QAAQ,MAAM,YAAY,GAAG,IAAI;AACzC,QAAM,CAAC,gBAAgB,iBAAiB,QAAI,uBAAS,KAAK;AAC1D,QAAM,iBAAiB,OAAO,WAAW,YAAY,SAAS;AAO9D,QAAM,qCAAiC,qBAAO,cAAc;AAE5D,QAAM,cAAU,sBAAQ,MAAM,CAAC,GAAG,MAAM,GAAG,UAAU,GAAG,CAAC,MAAM,UAAU,CAAC;AAC1E,QAAM,4BAAwB,sBAAQ,OAAO,EAAE,QAAQ,IAAI,CAAC,OAAO,CAAC;AACpE,QAAM,oBAAgB,wCAAgB,qBAAqB;AAE3D,QAAM,cAAc,aAAAA,QAAM,QAAQ,MAAM,MAAM,qBAAiB,gBAAI,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;AAE7E,SAAO,aAAAA,QAAM;AAAA,IACX,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,CAAC,eAAe,kBAAkB,kBAAkB,kBAAkB,cAAc,gBAAgB,WAAW;AAAA,EACjH;AACF;",
|
|
6
6
|
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var useFocusTracker_exports = {};
|
|
30
|
+
__export(useFocusTracker_exports, {
|
|
31
|
+
useFocusTracker: () => useFocusTracker
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(useFocusTracker_exports);
|
|
34
|
+
var React = __toESM(require("react"));
|
|
35
|
+
var import_react = require("react");
|
|
36
|
+
var import_constants = require("../constants/index.js");
|
|
37
|
+
var import_getChipId = require("../util/getChipId.js");
|
|
38
|
+
var import_getChipRegionId = require("../util/getChipRegionId.js");
|
|
39
|
+
const useFocusTracker = (config) => {
|
|
40
|
+
const { allApps } = config;
|
|
41
|
+
const firstFocusableIdx = (0, import_react.useMemo)(() => allApps.findIndex((app) => !app.disabled), [allApps]);
|
|
42
|
+
const lastFocusableIdx = (0, import_react.useMemo)(() => allApps.reduce((acc, app, i) => !app.disabled ? i : acc, -1), [allApps]);
|
|
43
|
+
const [focusRegion, setFocusRegion] = (0, import_react.useState)(import_constants.APP_PICKER_REGION_FOCUSES.RESET);
|
|
44
|
+
const firstFocusableRef = (0, import_react.useRef)(null);
|
|
45
|
+
const lastFocusableRef = (0, import_react.useRef)(null);
|
|
46
|
+
const trackFocusChip = (0, import_react.useCallback)((chipId) => {
|
|
47
|
+
setFocusRegion((0, import_getChipRegionId.getChipRegionId)(chipId));
|
|
48
|
+
}, []);
|
|
49
|
+
const trackFocusRegionReset = (0, import_react.useCallback)(() => {
|
|
50
|
+
setFocusRegion(import_constants.APP_PICKER_REGION_FOCUSES.RESET);
|
|
51
|
+
}, []);
|
|
52
|
+
const trackFocusTrigger = (0, import_react.useCallback)(() => {
|
|
53
|
+
setFocusRegion(import_constants.APP_PICKER_REGION_FOCUSES.TRIGGER);
|
|
54
|
+
}, []);
|
|
55
|
+
const trackFocusPanel = (0, import_react.useCallback)(() => {
|
|
56
|
+
setFocusRegion(import_constants.APP_PICKER_REGION_FOCUSES.PANEL);
|
|
57
|
+
}, []);
|
|
58
|
+
const trackFocusSelectedItem = (0, import_react.useCallback)(() => {
|
|
59
|
+
const selectedIdx = allApps.findIndex((app) => app.selected);
|
|
60
|
+
const index = selectedIdx !== -1 ? selectedIdx : allApps.findIndex((app) => !app.disabled);
|
|
61
|
+
if (index !== -1) setFocusRegion((0, import_getChipRegionId.getChipRegionId)((0, import_getChipId.getChipId)(allApps[index], index)));
|
|
62
|
+
}, [allApps]);
|
|
63
|
+
const trackFocusSelectedOrLastItem = (0, import_react.useCallback)(() => {
|
|
64
|
+
const selectedIdx = allApps.findIndex((app) => app.selected);
|
|
65
|
+
const index = selectedIdx !== -1 ? selectedIdx : lastFocusableIdx;
|
|
66
|
+
if (index !== -1) setFocusRegion((0, import_getChipRegionId.getChipRegionId)((0, import_getChipId.getChipId)(allApps[index], index)));
|
|
67
|
+
}, [allApps, lastFocusableIdx]);
|
|
68
|
+
const trackFocusItemAtIndex = (0, import_react.useCallback)(
|
|
69
|
+
(index) => {
|
|
70
|
+
const target = allApps[index];
|
|
71
|
+
if (target) setFocusRegion((0, import_getChipRegionId.getChipRegionId)((0, import_getChipId.getChipId)(target, index)));
|
|
72
|
+
},
|
|
73
|
+
[allApps]
|
|
74
|
+
);
|
|
75
|
+
return (0, import_react.useMemo)(
|
|
76
|
+
() => ({
|
|
77
|
+
firstFocusableIdx,
|
|
78
|
+
lastFocusableIdx,
|
|
79
|
+
focusRegion,
|
|
80
|
+
firstFocusableRef,
|
|
81
|
+
lastFocusableRef,
|
|
82
|
+
trackFocusChip,
|
|
83
|
+
trackFocusRegionReset,
|
|
84
|
+
trackFocusTrigger,
|
|
85
|
+
trackFocusPanel,
|
|
86
|
+
trackFocusSelectedItem,
|
|
87
|
+
trackFocusSelectedOrLastItem,
|
|
88
|
+
trackFocusItemAtIndex
|
|
89
|
+
}),
|
|
90
|
+
[
|
|
91
|
+
firstFocusableIdx,
|
|
92
|
+
lastFocusableIdx,
|
|
93
|
+
focusRegion,
|
|
94
|
+
trackFocusChip,
|
|
95
|
+
trackFocusRegionReset,
|
|
96
|
+
trackFocusTrigger,
|
|
97
|
+
trackFocusPanel,
|
|
98
|
+
trackFocusSelectedItem,
|
|
99
|
+
trackFocusSelectedOrLastItem,
|
|
100
|
+
trackFocusItemAtIndex
|
|
101
|
+
]
|
|
102
|
+
);
|
|
103
|
+
};
|
|
104
|
+
//# sourceMappingURL=useFocusTracker.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/config/useFocusTracker.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import { useCallback, useMemo, useRef, useState } from 'react';\nimport { APP_PICKER_REGION_FOCUSES } from '../constants/index.js';\nimport type { DSAppPickerT } from '../react-desc-prop-types.js';\nimport { getChipId } from '../util/getChipId.js';\nimport { getChipRegionId } from '../util/getChipRegionId.js';\n\ntype FocusTrackerConfigT = {\n allApps: DSAppPickerT.AppItem[];\n};\n\nexport const useFocusTracker = (config: FocusTrackerConfigT) => {\n const { allApps } = config;\n\n // Flat indices of the first/last non-disabled item, used to mark the focus-trap edges.\n // AppSection passes isFirstFocusable/isLastFocusable to AppPickerItem, which sets\n // firstFocusableRef/lastFocusableRef when its innerRef fires.\n const firstFocusableIdx = useMemo(() => allApps.findIndex((app) => !app.disabled), [allApps]);\n const lastFocusableIdx = useMemo(() => allApps.reduce((acc, app, i) => (!app.disabled ? i : acc), -1), [allApps]);\n\n const [focusRegion, setFocusRegion] = useState<string>(APP_PICKER_REGION_FOCUSES.RESET);\n\n // DOM refs for the first and last focusable chips \u2014 set by AppPickerItem's innerRef.\n // Used by useFocusTrap in AppPanel so the focus trap needs no DOM query.\n const firstFocusableRef = useRef<HTMLElement | null>(null);\n const lastFocusableRef = useRef<HTMLElement | null>(null);\n\n const trackFocusChip = useCallback((chipId: string) => {\n setFocusRegion(getChipRegionId(chipId));\n }, []);\n\n const trackFocusRegionReset = useCallback(() => {\n setFocusRegion(APP_PICKER_REGION_FOCUSES.RESET);\n }, []);\n\n const trackFocusTrigger = useCallback(() => {\n setFocusRegion(APP_PICKER_REGION_FOCUSES.TRIGGER);\n }, []);\n\n const trackFocusPanel = useCallback(() => {\n setFocusRegion(APP_PICKER_REGION_FOCUSES.PANEL);\n }, []);\n\n const trackFocusSelectedItem = useCallback(() => {\n const selectedIdx = allApps.findIndex((app) => app.selected);\n const index = selectedIdx !== -1 ? selectedIdx : allApps.findIndex((app) => !app.disabled);\n if (index !== -1) setFocusRegion(getChipRegionId(getChipId(allApps[index], index)));\n }, [allApps]);\n\n // ArrowUp's counterpart to trackFocusSelectedItem. Same first clause \u2014 the selection wins \u2014 but the\n // fallback is the LAST available item rather than the first, because \"open upwards\" lands at the end.\n const trackFocusSelectedOrLastItem = useCallback(() => {\n const selectedIdx = allApps.findIndex((app) => app.selected);\n const index = selectedIdx !== -1 ? selectedIdx : lastFocusableIdx;\n if (index !== -1) setFocusRegion(getChipRegionId(getChipId(allApps[index], index)));\n }, [allApps, lastFocusableIdx]);\n\n const trackFocusItemAtIndex = useCallback(\n (index: number) => {\n const target = allApps[index];\n if (target) setFocusRegion(getChipRegionId(getChipId(target, index)));\n },\n [allApps],\n );\n\n return useMemo(\n () => ({\n firstFocusableIdx,\n lastFocusableIdx,\n focusRegion,\n firstFocusableRef,\n lastFocusableRef,\n trackFocusChip,\n trackFocusRegionReset,\n trackFocusTrigger,\n trackFocusPanel,\n trackFocusSelectedItem,\n trackFocusSelectedOrLastItem,\n trackFocusItemAtIndex,\n }),\n [\n firstFocusableIdx,\n lastFocusableIdx,\n focusRegion,\n trackFocusChip,\n trackFocusRegionReset,\n trackFocusTrigger,\n trackFocusPanel,\n trackFocusSelectedItem,\n trackFocusSelectedOrLastItem,\n trackFocusItemAtIndex,\n ],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAuD;AACvD,uBAA0C;AAE1C,uBAA0B;AAC1B,6BAAgC;AAMzB,MAAM,kBAAkB,CAAC,WAAgC;AAC9D,QAAM,EAAE,QAAQ,IAAI;AAKpB,QAAM,wBAAoB,sBAAQ,MAAM,QAAQ,UAAU,CAAC,QAAQ,CAAC,IAAI,QAAQ,GAAG,CAAC,OAAO,CAAC;AAC5F,QAAM,uBAAmB,sBAAQ,MAAM,QAAQ,OAAO,CAAC,KAAK,KAAK,MAAO,CAAC,IAAI,WAAW,IAAI,KAAM,EAAE,GAAG,CAAC,OAAO,CAAC;AAEhH,QAAM,CAAC,aAAa,cAAc,QAAI,uBAAiB,2CAA0B,KAAK;AAItF,QAAM,wBAAoB,qBAA2B,IAAI;AACzD,QAAM,uBAAmB,qBAA2B,IAAI;AAExD,QAAM,qBAAiB,0BAAY,CAAC,WAAmB;AACrD,uBAAe,wCAAgB,MAAM,CAAC;AAAA,EACxC,GAAG,CAAC,CAAC;AAEL,QAAM,4BAAwB,0BAAY,MAAM;AAC9C,mBAAe,2CAA0B,KAAK;AAAA,EAChD,GAAG,CAAC,CAAC;AAEL,QAAM,wBAAoB,0BAAY,MAAM;AAC1C,mBAAe,2CAA0B,OAAO;AAAA,EAClD,GAAG,CAAC,CAAC;AAEL,QAAM,sBAAkB,0BAAY,MAAM;AACxC,mBAAe,2CAA0B,KAAK;AAAA,EAChD,GAAG,CAAC,CAAC;AAEL,QAAM,6BAAyB,0BAAY,MAAM;AAC/C,UAAM,cAAc,QAAQ,UAAU,CAAC,QAAQ,IAAI,QAAQ;AAC3D,UAAM,QAAQ,gBAAgB,KAAK,cAAc,QAAQ,UAAU,CAAC,QAAQ,CAAC,IAAI,QAAQ;AACzF,QAAI,UAAU,GAAI,oBAAe,4CAAgB,4BAAU,QAAQ,KAAK,GAAG,KAAK,CAAC,CAAC;AAAA,EACpF,GAAG,CAAC,OAAO,CAAC;AAIZ,QAAM,mCAA+B,0BAAY,MAAM;AACrD,UAAM,cAAc,QAAQ,UAAU,CAAC,QAAQ,IAAI,QAAQ;AAC3D,UAAM,QAAQ,gBAAgB,KAAK,cAAc;AACjD,QAAI,UAAU,GAAI,oBAAe,4CAAgB,4BAAU,QAAQ,KAAK,GAAG,KAAK,CAAC,CAAC;AAAA,EACpF,GAAG,CAAC,SAAS,gBAAgB,CAAC;AAE9B,QAAM,4BAAwB;AAAA,IAC5B,CAAC,UAAkB;AACjB,YAAM,SAAS,QAAQ,KAAK;AAC5B,UAAI,OAAQ,oBAAe,4CAAgB,4BAAU,QAAQ,KAAK,CAAC,CAAC;AAAA,IACtE;AAAA,IACA,CAAC,OAAO;AAAA,EACV;AAEA,aAAO;AAAA,IACL,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var useValidateProps_exports = {};
|
|
30
|
+
__export(useValidateProps_exports, {
|
|
31
|
+
useValidateProps: () => useValidateProps
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(useValidateProps_exports);
|
|
34
|
+
var React = __toESM(require("react"));
|
|
35
|
+
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
36
|
+
var import_constants = require("../constants/index.js");
|
|
37
|
+
const useValidateProps = (props, propTypes) => {
|
|
38
|
+
(0, import_ds_props_helpers.useValidateTypescriptPropTypes)(props, propTypes, import_constants.DSAppPickerName);
|
|
39
|
+
if (!props.apps.length && !props.customApps.length) {
|
|
40
|
+
throw new Error(
|
|
41
|
+
`[${import_constants.DSAppPickerName}] At least one of "apps" or "customApps" must contain items. Providing both as empty arrays renders an empty picker.`
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
const suppliedAppIds = [...props.apps, ...props.customApps].map((app) => app.id).filter((id) => id !== void 0);
|
|
45
|
+
const seen = /* @__PURE__ */ new Set();
|
|
46
|
+
const duplicates = /* @__PURE__ */ new Set();
|
|
47
|
+
for (const id of suppliedAppIds) {
|
|
48
|
+
if (seen.has(id)) duplicates.add(id);
|
|
49
|
+
else seen.add(id);
|
|
50
|
+
}
|
|
51
|
+
const duplicatedAppIds = [...duplicates];
|
|
52
|
+
if (duplicatedAppIds.length) {
|
|
53
|
+
throw new Error(
|
|
54
|
+
`[${import_constants.DSAppPickerName}] Every app "id" must be unique across "apps" and "customApps" \u2014 each one is rendered as that chip's DOM id, and duplicates produce an invalid document. Duplicated: ${duplicatedAppIds.map((id) => `"${id}"`).join(", ")}.`
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
if (props.id !== void 0 && suppliedAppIds.includes(props.id)) {
|
|
58
|
+
throw new Error(
|
|
59
|
+
`[${import_constants.DSAppPickerName}] The app "id" "${props.id}" collides with the "id" given to the component, which is rendered on the root element. Every other id is suffixed away from it \u2014 see getIdForAppPickerTrigger / getIdForAppPickerSectionTitle / getIdForAppPickerCustomSectionTitle \u2014 but this one is not ours to move.`
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
//# sourceMappingURL=useValidateProps.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/config/useValidateProps.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import { useValidateTypescriptPropTypes } from '@elliemae/ds-props-helpers';\nimport type { ValidationMap } from '@elliemae/ds-props-helpers';\nimport { type DSAppPickerT } from '../react-desc-prop-types.js';\nimport { DSAppPickerName } from '../constants/index.js';\n\nexport const useValidateProps = (props: DSAppPickerT.InternalProps, propTypes: ValidationMap<unknown>): void => {\n useValidateTypescriptPropTypes(props, propTypes, DSAppPickerName);\n\n if (!props.apps.length && !props.customApps.length) {\n throw new Error(\n `[${DSAppPickerName}] At least one of \"apps\" or \"customApps\" must contain items. ` +\n `Providing both as empty arrays renders an empty picker.`,\n );\n }\n\n /*\n * An app's `id` is rendered verbatim as the chip's DOM id \u2014 it is the consumer's own value, deliberately\n * left un-namespaced so they can address their chips by the identity they already know. `apps` and\n * `customApps` are two independent arrays, so nothing about the shape of the API stops the same value\n * appearing twice, and a duplicate DOM id is a broken document: `getElementById`, `document.querySelector`\n * and every `aria-*` reference silently resolve to the first match only.\n *\n * We do not fix that by rewriting their ids \u2014 that would take away the surface the field exists to\n * provide. We make it impossible to ship instead. Uniqueness stays the consumer's responsibility; this\n * turns \"silently wrong in production\" into \"cannot render\", which is the only version of that\n * responsibility that actually holds.\n *\n * Scoped to ids the consumer supplied: id-less apps are legal (AppSection falls back to a positional key\n * and getChipId to a label-index identity), and no chip id is emitted for them at all.\n */\n const suppliedAppIds = [...props.apps, ...props.customApps]\n .map((app) => app.id)\n .filter((id): id is string => id !== undefined);\n\n const seen = new Set<string>();\n const duplicates = new Set<string>();\n for (const id of suppliedAppIds) {\n if (seen.has(id)) duplicates.add(id);\n else seen.add(id);\n }\n const duplicatedAppIds = [...duplicates];\n if (duplicatedAppIds.length) {\n throw new Error(\n `[${DSAppPickerName}] Every app \"id\" must be unique across \"apps\" and \"customApps\" \u2014 each one is ` +\n `rendered as that chip's DOM id, and duplicates produce an invalid document. ` +\n `Duplicated: ${duplicatedAppIds.map((id) => `\"${id}\"`).join(', ')}.`,\n );\n }\n\n /*\n * Same defect, one level up: the consumer's `id` lands unmodified on the ROOT (see util/instanceIds), so\n * an app carrying that same value collides with it. Every id this component generates for itself is\n * suffixed through that module and therefore cannot participate \u2014 this is the one remaining pair where\n * two consumer-supplied values meet.\n */\n if (props.id !== undefined && suppliedAppIds.includes(props.id)) {\n throw new Error(\n `[${DSAppPickerName}] The app \"id\" \"${props.id}\" collides with the \"id\" given to the component, ` +\n `which is rendered on the root element. Every other id is suffixed away from it \u2014 see ` +\n `getIdForAppPickerTrigger / getIdForAppPickerSectionTitle / getIdForAppPickerCustomSectionTitle \u2014 but this one is not ours to move.`,\n );\n }\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,8BAA+C;AAG/C,uBAAgC;AAEzB,MAAM,mBAAmB,CAAC,OAAmC,cAA4C;AAC9G,8DAA+B,OAAO,WAAW,gCAAe;AAEhE,MAAI,CAAC,MAAM,KAAK,UAAU,CAAC,MAAM,WAAW,QAAQ;AAClD,UAAM,IAAI;AAAA,MACR,IAAI,gCAAe;AAAA,IAErB;AAAA,EACF;AAiBA,QAAM,iBAAiB,CAAC,GAAG,MAAM,MAAM,GAAG,MAAM,UAAU,EACvD,IAAI,CAAC,QAAQ,IAAI,EAAE,EACnB,OAAO,CAAC,OAAqB,OAAO,MAAS;AAEhD,QAAM,OAAO,oBAAI,IAAY;AAC7B,QAAM,aAAa,oBAAI,IAAY;AACnC,aAAW,MAAM,gBAAgB;AAC/B,QAAI,KAAK,IAAI,EAAE,EAAG,YAAW,IAAI,EAAE;AAAA,QAC9B,MAAK,IAAI,EAAE;AAAA,EAClB;AACA,QAAM,mBAAmB,CAAC,GAAG,UAAU;AACvC,MAAI,iBAAiB,QAAQ;AAC3B,UAAM,IAAI;AAAA,MACR,IAAI,gCAAe,6KAEF,iBAAiB,IAAI,CAAC,OAAO,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;AAAA,IACrE;AAAA,EACF;AAQA,MAAI,MAAM,OAAO,UAAa,eAAe,SAAS,MAAM,EAAE,GAAG;AAC/D,UAAM,IAAI;AAAA,MACR,IAAI,gCAAe,mBAAmB,MAAM,EAAE;AAAA,IAGhD;AAAA,EACF;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -28,6 +28,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
var constants_exports = {};
|
|
30
30
|
__export(constants_exports, {
|
|
31
|
+
APP_PICKER_REGION_FOCUSES: () => APP_PICKER_REGION_FOCUSES,
|
|
32
|
+
CHIP_REGION_PREFIX: () => CHIP_REGION_PREFIX,
|
|
31
33
|
DSAppPickerDataTestIds: () => DSAppPickerDataTestIds,
|
|
32
34
|
DSAppPickerName: () => DSAppPickerName,
|
|
33
35
|
DSAppPickerSlots: () => DSAppPickerSlots
|
|
@@ -36,14 +38,22 @@ module.exports = __toCommonJS(constants_exports);
|
|
|
36
38
|
var React = __toESM(require("react"));
|
|
37
39
|
var import_ds_system = require("@elliemae/ds-system");
|
|
38
40
|
const DSAppPickerName = "DSApppicker";
|
|
41
|
+
const APP_PICKER_REGION_FOCUSES = {
|
|
42
|
+
RESET: "",
|
|
43
|
+
TRIGGER: "trigger",
|
|
44
|
+
PANEL: "panel"
|
|
45
|
+
};
|
|
46
|
+
const CHIP_REGION_PREFIX = "chip-";
|
|
39
47
|
const DSAppPickerSlots = {
|
|
40
48
|
ROOT: "root",
|
|
49
|
+
GROUP: "group",
|
|
41
50
|
ITEM: "item",
|
|
42
51
|
TITLE: "title",
|
|
43
52
|
SEPARATOR: "separator",
|
|
44
53
|
ROW: "row",
|
|
45
54
|
CHIP: "chip",
|
|
46
|
-
BUTTON: "button"
|
|
55
|
+
BUTTON: "button",
|
|
56
|
+
FLOATING_WRAPPER: "floating-wrapper"
|
|
47
57
|
};
|
|
48
58
|
const DSAppPickerDataTestIds = {
|
|
49
59
|
...(0, import_ds_system.slotObjectToDataTestIds)(DSAppPickerName, DSAppPickerSlots),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/constants/index.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { slotObjectToDataTestIds } from '@elliemae/ds-system';\n\nexport const DSAppPickerName = 'DSApppicker';\n\nexport const DSAppPickerSlots = {\n ROOT: 'root',\n ITEM: 'item',\n TITLE: 'title',\n SEPARATOR: 'separator',\n ROW: 'row',\n CHIP: 'chip',\n BUTTON: 'button',\n};\n\nexport const DSAppPickerDataTestIds = {\n ...(slotObjectToDataTestIds(DSAppPickerName, DSAppPickerSlots) as Record<keyof typeof DSAppPickerSlots, string>),\n CHIP: 'app-picker__chip',\n BUTTON: 'app-picker__button',\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAAwC;
|
|
4
|
+
"sourcesContent": ["import { slotObjectToDataTestIds } from '@elliemae/ds-system';\n\n// DEV-001: triple-p \"DSApppicker\" is the legacy public name. Renaming would break consumers.\n// See KNOWN_INTENTIONAL_DEVIATIONS.md.\nexport const DSAppPickerName = 'DSApppicker';\n\n// we are naming this with the ${component_name}_region_focuses convention to namespace & avoid errors on duplicate exports variables in aggregators\nexport const APP_PICKER_REGION_FOCUSES = {\n RESET: '',\n TRIGGER: 'trigger',\n PANEL: 'panel',\n} as const;\n\n// Prefix for the per-chip focus-region identifiers (see getChipRegionId in src/util).\nexport const CHIP_REGION_PREFIX = 'chip-';\n\n// we are naming this with the ${component_name}_slots convention to namespace & avoid errors on duplicate exports variables in aggregators\nexport const DSAppPickerSlots = {\n ROOT: 'root',\n GROUP: 'group',\n ITEM: 'item',\n TITLE: 'title',\n SEPARATOR: 'separator',\n ROW: 'row',\n CHIP: 'chip',\n BUTTON: 'button',\n FLOATING_WRAPPER: 'floating-wrapper',\n} as const;\n\n// Layer 2 legacy data-testid overrides:\n// CHIP and BUTTON predate the slot naming scheme; existing QA selectors must keep matching.\n// See project_compatibility.md (legacy data-testid 3-layer override pattern).\nexport const DSAppPickerDataTestIds = {\n ...(slotObjectToDataTestIds(DSAppPickerName, DSAppPickerSlots) as Record<keyof typeof DSAppPickerSlots, string>),\n CHIP: 'app-picker__chip',\n BUTTON: 'app-picker__button',\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAAwC;AAIjC,MAAM,kBAAkB;AAGxB,MAAM,4BAA4B;AAAA,EACvC,OAAO;AAAA,EACP,SAAS;AAAA,EACT,OAAO;AACT;AAGO,MAAM,qBAAqB;AAG3B,MAAM,mBAAmB;AAAA,EAC9B,MAAM;AAAA,EACN,OAAO;AAAA,EACP,MAAM;AAAA,EACN,OAAO;AAAA,EACP,WAAW;AAAA,EACX,KAAK;AAAA,EACL,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,kBAAkB;AACpB;AAKO,MAAM,yBAAyB;AAAA,EACpC,OAAI,0CAAwB,iBAAiB,gBAAgB;AAAA,EAC7D,MAAM;AAAA,EACN,QAAQ;AACV;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -32,10 +32,17 @@ __export(index_exports, {
|
|
|
32
32
|
DSAppPicker: () => import_DSAppPicker.DSAppPicker,
|
|
33
33
|
DSAppPickerDataTestIds: () => import_constants.DSAppPickerDataTestIds,
|
|
34
34
|
DSAppPickerName: () => import_constants.DSAppPickerName,
|
|
35
|
-
DSAppPickerSlots: () => import_constants.DSAppPickerSlots
|
|
35
|
+
DSAppPickerSlots: () => import_constants.DSAppPickerSlots,
|
|
36
|
+
getDSAppPickerContractProps: () => import_getDSAppPickerContractProps.getDSAppPickerContractProps,
|
|
37
|
+
getIdForAppPickerCustomSectionTitle: () => import_instanceIds.getIdForAppPickerCustomSectionTitle,
|
|
38
|
+
getIdForAppPickerRoot: () => import_instanceIds.getIdForAppPickerRoot,
|
|
39
|
+
getIdForAppPickerSectionTitle: () => import_instanceIds.getIdForAppPickerSectionTitle,
|
|
40
|
+
getIdForAppPickerTrigger: () => import_instanceIds.getIdForAppPickerTrigger
|
|
36
41
|
});
|
|
37
42
|
module.exports = __toCommonJS(index_exports);
|
|
38
43
|
var React = __toESM(require("react"));
|
|
39
44
|
var import_DSAppPicker = require("./DSAppPicker.js");
|
|
40
45
|
var import_constants = require("./constants/index.js");
|
|
46
|
+
var import_getDSAppPickerContractProps = require("./util/getDSAppPickerContractProps.js");
|
|
47
|
+
var import_instanceIds = require("./util/instanceIds.js");
|
|
41
48
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/index.
|
|
4
|
-
"sourcesContent": ["export { DSAppPicker, AppPickerWithSchema } from './DSAppPicker.js';\nexport { DSAppPickerName, DSAppPickerSlots, DSAppPickerDataTestIds } from './constants/index.js';\nexport type { DSAppPickerT } from './react-desc-prop-types.js';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,yBAAiD;AACjD,uBAA0E;",
|
|
3
|
+
"sources": ["../../src/index.ts", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["export { DSAppPicker, AppPickerWithSchema } from './DSAppPicker.js';\nexport { DSAppPickerName, DSAppPickerSlots, DSAppPickerDataTestIds } from './constants/index.js';\nexport { getDSAppPickerContractProps } from './util/getDSAppPickerContractProps.js';\nexport {\n getIdForAppPickerRoot,\n getIdForAppPickerTrigger,\n getIdForAppPickerSectionTitle,\n getIdForAppPickerCustomSectionTitle,\n} from './util/instanceIds.js';\nexport type { DSAppPickerT } from './react-desc-prop-types.js';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,yBAAiD;AACjD,uBAA0E;AAC1E,yCAA4C;AAC5C,yBAKO;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|