@elliemae/ds-app-picker 3.70.0-next.3 → 3.70.0-next.31
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 +59 -132
- package/dist/cjs/DSAppPicker.js.map +3 -3
- package/dist/cjs/{utils.js → DSAppPickerCTX.js} +26 -23
- package/dist/cjs/DSAppPickerCTX.js.map +7 -0
- package/dist/cjs/config/useAppPicker.js +3 -3
- package/dist/cjs/config/useAppPicker.js.map +3 -3
- package/dist/cjs/config/useAppPickerBehavior.js +156 -0
- package/dist/cjs/config/useAppPickerBehavior.js.map +7 -0
- package/dist/cjs/config/useFocusTracker.js +115 -0
- package/dist/cjs/config/useFocusTracker.js.map +7 -0
- package/dist/cjs/config/useValidateProps.js +45 -0
- package/dist/cjs/config/useValidateProps.js.map +7 -0
- package/dist/cjs/constants/index.js +8 -1
- package/dist/cjs/constants/index.js.map +2 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/parts/AppPanel.js +159 -0
- package/dist/cjs/parts/AppPanel.js.map +7 -0
- package/dist/cjs/parts/AppPickerItem.js +102 -0
- package/dist/cjs/parts/AppPickerItem.js.map +7 -0
- package/dist/cjs/parts/AppSection.js +68 -0
- package/dist/cjs/parts/AppSection.js.map +7 -0
- package/dist/cjs/parts/Trigger.js +62 -0
- package/dist/cjs/parts/Trigger.js.map +7 -0
- package/dist/cjs/{styles.js → parts/style.js} +21 -9
- package/dist/cjs/parts/style.js.map +7 -0
- package/dist/cjs/react-desc-prop-types.js +6 -7
- package/dist/cjs/react-desc-prop-types.js.map +2 -2
- package/dist/cjs/typescript-testing/typescript-app-picker-valid.js +5 -0
- package/dist/cjs/typescript-testing/typescript-app-picker-valid.js.map +2 -2
- package/dist/esm/DSAppPicker.js +62 -135
- package/dist/esm/DSAppPicker.js.map +2 -2
- package/dist/esm/DSAppPickerCTX.js +28 -0
- package/dist/esm/DSAppPickerCTX.js.map +7 -0
- package/dist/esm/config/useAppPicker.js +4 -5
- package/dist/esm/config/useAppPicker.js.map +3 -3
- package/dist/esm/config/useAppPickerBehavior.js +126 -0
- package/dist/esm/config/useAppPickerBehavior.js.map +7 -0
- package/dist/esm/config/useFocusTracker.js +85 -0
- package/dist/esm/config/useFocusTracker.js.map +7 -0
- package/dist/esm/config/useValidateProps.js +15 -0
- package/dist/esm/config/useValidateProps.js.map +7 -0
- package/dist/esm/constants/index.js +8 -1
- package/dist/esm/constants/index.js.map +2 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/parts/AppPanel.js +129 -0
- package/dist/esm/parts/AppPanel.js.map +7 -0
- package/dist/esm/parts/AppPickerItem.js +72 -0
- package/dist/esm/parts/AppPickerItem.js.map +7 -0
- package/dist/esm/parts/AppSection.js +38 -0
- package/dist/esm/parts/AppSection.js.map +7 -0
- package/dist/esm/parts/Trigger.js +32 -0
- package/dist/esm/parts/Trigger.js.map +7 -0
- package/dist/esm/{styles.js → parts/style.js} +18 -6
- package/dist/esm/parts/style.js.map +7 -0
- package/dist/esm/react-desc-prop-types.js +12 -8
- package/dist/esm/react-desc-prop-types.js.map +2 -2
- package/dist/esm/typescript-testing/typescript-app-picker-valid.js +5 -0
- package/dist/esm/typescript-testing/typescript-app-picker-valid.js.map +2 -2
- package/dist/types/DSAppPicker.d.ts +0 -1
- package/dist/types/DSAppPickerCTX.d.ts +17 -0
- package/dist/types/config/useAppPicker.d.ts +5 -5
- package/dist/types/config/useAppPickerBehavior.d.ts +39 -0
- package/dist/types/config/useFocusTracker.d.ts +15 -0
- package/dist/types/config/useValidateProps.d.ts +3 -0
- package/dist/types/constants/index.d.ts +14 -7
- package/dist/types/parts/AppPanel.d.ts +9 -0
- package/dist/types/parts/AppPickerItem.d.ts +14 -0
- package/dist/types/parts/AppSection.d.ts +17 -0
- package/dist/types/parts/Trigger.d.ts +15 -0
- package/dist/types/{styles.d.ts → parts/style.d.ts} +3 -4
- package/dist/types/react-desc-prop-types.d.ts +21 -8
- package/dist/types/tests/app-picker.get-owner-props-arguments-18354.test.d.ts +1 -0
- package/dist/types/tests/app-picker.proptype-schema.test.d.ts +1 -0
- package/dist/types/tests/app-picker.pui-18354.test.d.ts +1 -0
- package/dist/types/tests/playwright/DSAppPicker.slot-contracts-dynamic.test.playwright.d.ts +1 -0
- package/dist/types/tests/playwright/DSAppPickerSlotContractRenderer.d.ts +1 -0
- package/package.json +16 -14
- 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.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.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/utils.d.ts +0 -14
- /package/dist/types/tests/{app-picker.get-owner-props.test.d.ts → app-picker.api.test.d.ts} +0 -0
|
@@ -0,0 +1,115 @@
|
|
|
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
|
+
getChipRegionId: () => getChipRegionId,
|
|
32
|
+
useFocusTracker: () => useFocusTracker
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(useFocusTracker_exports);
|
|
35
|
+
var React = __toESM(require("react"));
|
|
36
|
+
var import_react = require("react");
|
|
37
|
+
var import_constants = require("../constants/index.js");
|
|
38
|
+
const CHIP_REGION_PREFIX = "chip-";
|
|
39
|
+
const getChipRegionId = (chipId) => `${CHIP_REGION_PREFIX}${chipId}`;
|
|
40
|
+
const useFocusTracker = () => {
|
|
41
|
+
const [focusRegion, setFocusRegion] = (0, import_react.useState)(import_constants.APP_PICKER_REGION_FOCUSES.RESET);
|
|
42
|
+
const chipIdRegistry = (0, import_react.useRef)(/* @__PURE__ */ new Map());
|
|
43
|
+
const firstFocusableRef = (0, import_react.useRef)(null);
|
|
44
|
+
const lastFocusableRef = (0, import_react.useRef)(null);
|
|
45
|
+
const registerChip = (0, import_react.useCallback)((app, chipId) => {
|
|
46
|
+
chipIdRegistry.current.set(app, chipId);
|
|
47
|
+
}, []);
|
|
48
|
+
const trackFocusChip = (0, import_react.useCallback)((chipId) => {
|
|
49
|
+
setFocusRegion(getChipRegionId(chipId));
|
|
50
|
+
}, []);
|
|
51
|
+
const trackFocusRegionReset = (0, import_react.useCallback)(() => {
|
|
52
|
+
setFocusRegion(import_constants.APP_PICKER_REGION_FOCUSES.RESET);
|
|
53
|
+
}, []);
|
|
54
|
+
const trackFocusTrigger = (0, import_react.useCallback)(() => {
|
|
55
|
+
setFocusRegion(import_constants.APP_PICKER_REGION_FOCUSES.TRIGGER);
|
|
56
|
+
}, []);
|
|
57
|
+
const trackFocusPanel = (0, import_react.useCallback)(() => {
|
|
58
|
+
setFocusRegion(import_constants.APP_PICKER_REGION_FOCUSES.PANEL);
|
|
59
|
+
}, []);
|
|
60
|
+
const trackFocusSelectedItem = (0, import_react.useCallback)((apps, customApps) => {
|
|
61
|
+
const all = [...apps, ...customApps];
|
|
62
|
+
const selected = all.find((app) => app.selected);
|
|
63
|
+
const target = selected ?? all.find((app) => !app.disabled);
|
|
64
|
+
if (target) {
|
|
65
|
+
const chipId = chipIdRegistry.current.get(target) ?? target.id ?? target.label;
|
|
66
|
+
setFocusRegion(getChipRegionId(chipId));
|
|
67
|
+
}
|
|
68
|
+
}, []);
|
|
69
|
+
const trackFocusFirstItem = (0, import_react.useCallback)((apps, customApps) => {
|
|
70
|
+
const first = [...apps, ...customApps].find((app) => !app.disabled);
|
|
71
|
+
if (first) {
|
|
72
|
+
const chipId = chipIdRegistry.current.get(first) ?? first.id ?? first.label;
|
|
73
|
+
setFocusRegion(getChipRegionId(chipId));
|
|
74
|
+
}
|
|
75
|
+
}, []);
|
|
76
|
+
const trackFocusItemAtIndex = (0, import_react.useCallback)(
|
|
77
|
+
(apps, customApps, index) => {
|
|
78
|
+
const target = [...apps, ...customApps][index];
|
|
79
|
+
if (target) {
|
|
80
|
+
const chipId = chipIdRegistry.current.get(target) ?? target.id ?? target.label;
|
|
81
|
+
setFocusRegion(getChipRegionId(chipId));
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
[]
|
|
85
|
+
);
|
|
86
|
+
return (0, import_react.useMemo)(
|
|
87
|
+
() => ({
|
|
88
|
+
focusRegion,
|
|
89
|
+
firstFocusableRef,
|
|
90
|
+
lastFocusableRef,
|
|
91
|
+
registerChip,
|
|
92
|
+
trackFocusChip,
|
|
93
|
+
trackFocusRegionReset,
|
|
94
|
+
trackFocusTrigger,
|
|
95
|
+
trackFocusPanel,
|
|
96
|
+
trackFocusSelectedItem,
|
|
97
|
+
trackFocusFirstItem,
|
|
98
|
+
trackFocusItemAtIndex
|
|
99
|
+
}),
|
|
100
|
+
[
|
|
101
|
+
focusRegion,
|
|
102
|
+
firstFocusableRef,
|
|
103
|
+
lastFocusableRef,
|
|
104
|
+
registerChip,
|
|
105
|
+
trackFocusChip,
|
|
106
|
+
trackFocusRegionReset,
|
|
107
|
+
trackFocusTrigger,
|
|
108
|
+
trackFocusPanel,
|
|
109
|
+
trackFocusSelectedItem,
|
|
110
|
+
trackFocusFirstItem,
|
|
111
|
+
trackFocusItemAtIndex
|
|
112
|
+
]
|
|
113
|
+
);
|
|
114
|
+
};
|
|
115
|
+
//# 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';\n\nconst CHIP_REGION_PREFIX = 'chip-';\n\nexport const getChipRegionId = (chipId: string): string => `${CHIP_REGION_PREFIX}${chipId}`;\n\nexport const useFocusTracker = () => {\n const [focusRegion, setFocusRegion] = useState<string>(APP_PICKER_REGION_FOCUSES.RESET);\n\n // Registry mapping each AppItem instance \u2192 its stable chipId (id ?? `${label}-${uid}`).\n // Populated by AppPickerItem on mount so trackFocusSelectedItem / trackFocusFirstItem\n // resolve the uid-qualified chipId instead of the bare label.\n const chipIdRegistry = useRef(new Map<DSAppPickerT.AppItem, string>());\n\n // DOM refs for the first and last focusable chips \u2014 set by AppPickerItem on mount.\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 registerChip = useCallback((app: DSAppPickerT.AppItem, chipId: string) => {\n chipIdRegistry.current.set(app, chipId);\n }, []);\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((apps: DSAppPickerT.AppItem[], customApps: DSAppPickerT.AppItem[]) => {\n const all = [...apps, ...customApps];\n const selected = all.find((app) => app.selected);\n const target = selected ?? all.find((app) => !app.disabled);\n if (target) {\n const chipId = chipIdRegistry.current.get(target) ?? target.id ?? target.label;\n setFocusRegion(getChipRegionId(chipId));\n }\n }, []);\n\n const trackFocusFirstItem = useCallback((apps: DSAppPickerT.AppItem[], customApps: DSAppPickerT.AppItem[]) => {\n const first = [...apps, ...customApps].find((app) => !app.disabled);\n if (first) {\n const chipId = chipIdRegistry.current.get(first) ?? first.id ?? first.label;\n setFocusRegion(getChipRegionId(chipId));\n }\n }, []);\n\n const trackFocusItemAtIndex = useCallback(\n (apps: DSAppPickerT.AppItem[], customApps: DSAppPickerT.AppItem[], index: number) => {\n const target = [...apps, ...customApps][index];\n if (target) {\n const chipId = chipIdRegistry.current.get(target) ?? target.id ?? target.label;\n setFocusRegion(getChipRegionId(chipId));\n }\n },\n [],\n );\n\n return useMemo(\n () => ({\n focusRegion,\n firstFocusableRef,\n lastFocusableRef,\n registerChip,\n trackFocusChip,\n trackFocusRegionReset,\n trackFocusTrigger,\n trackFocusPanel,\n trackFocusSelectedItem,\n trackFocusFirstItem,\n trackFocusItemAtIndex,\n }),\n [\n focusRegion,\n firstFocusableRef,\n lastFocusableRef,\n registerChip,\n trackFocusChip,\n trackFocusRegionReset,\n trackFocusTrigger,\n trackFocusPanel,\n trackFocusSelectedItem,\n trackFocusFirstItem,\n trackFocusItemAtIndex,\n ],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAuD;AACvD,uBAA0C;AAG1C,MAAM,qBAAqB;AAEpB,MAAM,kBAAkB,CAAC,WAA2B,GAAG,kBAAkB,GAAG,MAAM;AAElF,MAAM,kBAAkB,MAAM;AACnC,QAAM,CAAC,aAAa,cAAc,QAAI,uBAAiB,2CAA0B,KAAK;AAKtF,QAAM,qBAAiB,qBAAO,oBAAI,IAAkC,CAAC;AAIrE,QAAM,wBAAoB,qBAA2B,IAAI;AACzD,QAAM,uBAAmB,qBAA2B,IAAI;AAExD,QAAM,mBAAe,0BAAY,CAAC,KAA2B,WAAmB;AAC9E,mBAAe,QAAQ,IAAI,KAAK,MAAM;AAAA,EACxC,GAAG,CAAC,CAAC;AAEL,QAAM,qBAAiB,0BAAY,CAAC,WAAmB;AACrD,mBAAe,gBAAgB,MAAM,CAAC;AAAA,EACxC,GAAG,CAAC,CAAC;AAEL,QAAM,4BAAwB,0BAAY,MAAM;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O;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,IACF;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
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
|
+
};
|
|
45
|
+
//# 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", "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;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -28,6 +28,7 @@ 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,
|
|
31
32
|
DSAppPickerDataTestIds: () => DSAppPickerDataTestIds,
|
|
32
33
|
DSAppPickerName: () => DSAppPickerName,
|
|
33
34
|
DSAppPickerSlots: () => DSAppPickerSlots
|
|
@@ -36,6 +37,11 @@ module.exports = __toCommonJS(constants_exports);
|
|
|
36
37
|
var React = __toESM(require("react"));
|
|
37
38
|
var import_ds_system = require("@elliemae/ds-system");
|
|
38
39
|
const DSAppPickerName = "DSApppicker";
|
|
40
|
+
const APP_PICKER_REGION_FOCUSES = {
|
|
41
|
+
RESET: "",
|
|
42
|
+
TRIGGER: "trigger",
|
|
43
|
+
PANEL: "panel"
|
|
44
|
+
};
|
|
39
45
|
const DSAppPickerSlots = {
|
|
40
46
|
ROOT: "root",
|
|
41
47
|
ITEM: "item",
|
|
@@ -43,7 +49,8 @@ const DSAppPickerSlots = {
|
|
|
43
49
|
SEPARATOR: "separator",
|
|
44
50
|
ROW: "row",
|
|
45
51
|
CHIP: "chip",
|
|
46
|
-
BUTTON: "button"
|
|
52
|
+
BUTTON: "button",
|
|
53
|
+
FLOATING_WRAPPER: "floating-wrapper"
|
|
47
54
|
};
|
|
48
55
|
const DSAppPickerDataTestIds = {
|
|
49
56
|
...(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// 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 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;ACAA,YAAuB;ADAvB,uBAAwC;AAIjC,MAAM,kBAAkB;AAGxB,MAAM,4BAA4B;AAAA,EACvC,OAAO;AAAA,EACP,SAAS;AAAA,EACT,OAAO;AACT;AAGO,MAAM,mBAAmB;AAAA,EAC9B,MAAM;AAAA,EACN,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.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/index.
|
|
3
|
+
"sources": ["../../src/index.ts", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
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
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,yBAAiD;AACjD,uBAA0E;",
|
|
6
6
|
"names": []
|
|
@@ -0,0 +1,159 @@
|
|
|
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 AppPanel_exports = {};
|
|
30
|
+
__export(AppPanel_exports, {
|
|
31
|
+
AppPanel: () => AppPanel
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(AppPanel_exports);
|
|
34
|
+
var React = __toESM(require("react"));
|
|
35
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
|
+
var import_react = require("react");
|
|
37
|
+
var import_ds_hooks_focus_trap = require("@elliemae/ds-hooks-focus-trap");
|
|
38
|
+
var import_style = require("./style.js");
|
|
39
|
+
var import_constants = require("../constants/index.js");
|
|
40
|
+
var import_AppSection = require("./AppSection.js");
|
|
41
|
+
var import_DSAppPickerCTX = require("../DSAppPickerCTX.js");
|
|
42
|
+
const AppPanelBase = (props) => {
|
|
43
|
+
const { close, triggerRef, wasOpenedByKeyboardRef, triggerIsInternal, ownerPropsConfig, globalAttributes, xstyledProps } = props;
|
|
44
|
+
const { apps, customApps, sectionTitle, customSectionTitle, onKeyDown } = props;
|
|
45
|
+
const {
|
|
46
|
+
focusRegion,
|
|
47
|
+
firstFocusableRef,
|
|
48
|
+
lastFocusableRef,
|
|
49
|
+
trackFocusPanel,
|
|
50
|
+
trackFocusFirstItem
|
|
51
|
+
} = (0, import_react.useContext)(import_DSAppPickerCTX.DSAppPickerContext);
|
|
52
|
+
const { wrap, onClick, onKeyDown: onKeyDownGlobal, ...safeGlobalAttributes } = globalAttributes;
|
|
53
|
+
const allItems = (0, import_react.useMemo)(() => [...apps, ...customApps], [apps, customApps]);
|
|
54
|
+
const firstFocusableIdx = (0, import_react.useMemo)(() => allItems.findIndex((app) => !app.disabled), [allItems]);
|
|
55
|
+
const lastFocusableIdx = (0, import_react.useMemo)(
|
|
56
|
+
() => allItems.reduce((acc, app, i) => !app.disabled ? i : acc, -1),
|
|
57
|
+
[allItems]
|
|
58
|
+
);
|
|
59
|
+
(0, import_react.useEffect)(() => {
|
|
60
|
+
if (wasOpenedByKeyboardRef?.current && triggerIsInternal) return;
|
|
61
|
+
if (triggerIsInternal) {
|
|
62
|
+
trackFocusPanel();
|
|
63
|
+
} else {
|
|
64
|
+
trackFocusFirstItem(apps, customApps);
|
|
65
|
+
}
|
|
66
|
+
}, []);
|
|
67
|
+
const isWrapperFocused = focusRegion === import_constants.APP_PICKER_REGION_FOCUSES.PANEL;
|
|
68
|
+
const handleWrapperRef = (0, import_react.useCallback)(
|
|
69
|
+
(node) => {
|
|
70
|
+
if (node && isWrapperFocused) node.focus();
|
|
71
|
+
},
|
|
72
|
+
[isWrapperFocused]
|
|
73
|
+
);
|
|
74
|
+
const handleAppClick = (0, import_react.useCallback)((e, app) => {
|
|
75
|
+
if (app.onClick) app.onClick(e, app);
|
|
76
|
+
}, []);
|
|
77
|
+
const handleOnKeyDownWrapper = (0, import_react.useCallback)(
|
|
78
|
+
(e) => {
|
|
79
|
+
if (onKeyDown) onKeyDown(e);
|
|
80
|
+
if (!onKeyDown && e.key === "Escape") {
|
|
81
|
+
triggerRef?.current?.focus();
|
|
82
|
+
close();
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
[onKeyDown, triggerRef, close]
|
|
86
|
+
);
|
|
87
|
+
const handleOnKeyDown = (0, import_ds_hooks_focus_trap.useFocusTrap)({
|
|
88
|
+
firstElementRef: firstFocusableRef,
|
|
89
|
+
lastElementRef: lastFocusableRef,
|
|
90
|
+
onKeyDown: handleOnKeyDownWrapper
|
|
91
|
+
});
|
|
92
|
+
const totalAppsLength = (0, import_react.useMemo)(() => apps.length + customApps.length, [apps.length, customApps.length]);
|
|
93
|
+
const layout = (0, import_react.useMemo)(() => {
|
|
94
|
+
const cols = ["repeat(3, 92px)"];
|
|
95
|
+
const rows = ["auto"];
|
|
96
|
+
return { rows, cols };
|
|
97
|
+
}, []);
|
|
98
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
99
|
+
import_style.StyledWrapper,
|
|
100
|
+
{
|
|
101
|
+
forwardedAs: "ul",
|
|
102
|
+
role: "listbox",
|
|
103
|
+
innerRef: handleWrapperRef,
|
|
104
|
+
"data-testid": import_constants.DSAppPickerDataTestIds.ROOT,
|
|
105
|
+
cols: layout.cols,
|
|
106
|
+
rows: layout.rows,
|
|
107
|
+
tabIndex: -1,
|
|
108
|
+
"aria-label": `Application picker, ${sectionTitle} (${apps.length} apps)${customApps.length > 0 ? `, ${customSectionTitle} (${customApps.length} apps)` : ""}`,
|
|
109
|
+
...ownerPropsConfig,
|
|
110
|
+
...safeGlobalAttributes,
|
|
111
|
+
...xstyledProps,
|
|
112
|
+
onKeyDown: handleOnKeyDown,
|
|
113
|
+
children: [
|
|
114
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
115
|
+
import_AppSection.AppSection,
|
|
116
|
+
{
|
|
117
|
+
items: apps,
|
|
118
|
+
title: sectionTitle,
|
|
119
|
+
positionOffset: 0,
|
|
120
|
+
totalCount: totalAppsLength,
|
|
121
|
+
ownerProps: ownerPropsConfig,
|
|
122
|
+
onItemClick: handleAppClick,
|
|
123
|
+
firstFocusableIdx,
|
|
124
|
+
lastFocusableIdx
|
|
125
|
+
}
|
|
126
|
+
),
|
|
127
|
+
customApps.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
128
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
129
|
+
import_style.StyledListItemFullRow,
|
|
130
|
+
{
|
|
131
|
+
"data-testid": import_constants.DSAppPickerDataTestIds.ROW,
|
|
132
|
+
"aria-hidden": true,
|
|
133
|
+
role: "group",
|
|
134
|
+
...ownerPropsConfig,
|
|
135
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_style.StyledSeparator, { "data-testid": import_constants.DSAppPickerDataTestIds.SEPARATOR, role: "presentation", ...ownerPropsConfig })
|
|
136
|
+
}
|
|
137
|
+
),
|
|
138
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
139
|
+
import_AppSection.AppSection,
|
|
140
|
+
{
|
|
141
|
+
items: customApps,
|
|
142
|
+
title: customSectionTitle,
|
|
143
|
+
positionOffset: apps.length,
|
|
144
|
+
totalCount: totalAppsLength,
|
|
145
|
+
ownerProps: ownerPropsConfig,
|
|
146
|
+
onItemClick: handleAppClick,
|
|
147
|
+
keyPrefix: "custom-",
|
|
148
|
+
firstFocusableIdx,
|
|
149
|
+
lastFocusableIdx
|
|
150
|
+
}
|
|
151
|
+
)
|
|
152
|
+
] })
|
|
153
|
+
]
|
|
154
|
+
}
|
|
155
|
+
);
|
|
156
|
+
};
|
|
157
|
+
const AppPanel = (0, import_react.memo)(AppPanelBase);
|
|
158
|
+
AppPanel.displayName = "DSAppPicker.AppPanel";
|
|
159
|
+
//# sourceMappingURL=AppPanel.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/parts/AppPanel.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React, { useCallback, useRef, useMemo, useEffect, useContext, memo } from 'react';\nimport { useFocusTrap } from '@elliemae/ds-hooks-focus-trap';\nimport { StyledWrapper, StyledSeparator, StyledListItemFullRow } from './style.js';\nimport type { DSAppPickerT } from '../react-desc-prop-types.js';\nimport { DSAppPickerDataTestIds, APP_PICKER_REGION_FOCUSES } from '../constants/index.js';\nimport type { useAppPicker } from '../config/useAppPicker.js';\nimport { AppSection } from './AppSection.js';\nimport { DSAppPickerContext } from '../DSAppPickerCTX.js';\n\nconst AppPanelBase = (\n props: DSAppPickerT.InternalProps &\n Pick<ReturnType<typeof useAppPicker>, 'ownerPropsConfig' | 'globalAttributes' | 'xstyledProps'> & {\n close: () => void;\n wasOpenedByKeyboardRef: React.MutableRefObject<boolean>;\n triggerIsInternal: boolean;\n triggerRef: React.RefObject<HTMLButtonElement>;\n },\n) => {\n const { close, triggerRef, wasOpenedByKeyboardRef, triggerIsInternal, ownerPropsConfig, globalAttributes, xstyledProps } = props;\n const { apps, customApps, sectionTitle, customSectionTitle, onKeyDown } = props;\n\n const {\n focusRegion,\n firstFocusableRef,\n lastFocusableRef,\n trackFocusPanel,\n trackFocusFirstItem,\n } = useContext(DSAppPickerContext);\n\n // Global attributes are spread onto the ul because there is no shared wrapper that contains\n // both the floating panel and the trigger. `wrap`, `onClick`, and `onKeyDown` are filtered out\n // because they collide with the public component API (which uses these for different semantics).\n const { wrap, onClick, onKeyDown: onKeyDownGlobal, ...safeGlobalAttributes } = globalAttributes;\n\n // ---------------------------------------------------------------------------\n // Focus trap edges \u2014 populated by AppPickerItem ref callbacks, no DOM query.\n // ---------------------------------------------------------------------------\n\n // Compute which flat indices are first/last non-disabled in the full item list.\n // AppSection passes isFirstFocusable/isLastFocusable to AppPickerItem, which sets\n // firstFocusableRef/lastFocusableRef in the tracker when its innerRef fires.\n const allItems = useMemo(() => [...apps, ...customApps], [apps, customApps]);\n const firstFocusableIdx = useMemo(() => allItems.findIndex((app) => !app.disabled), [allItems]);\n const lastFocusableIdx = useMemo(\n () => allItems.reduce((acc, app, i) => (!app.disabled ? i : acc), -1),\n [allItems],\n );\n\n // ---------------------------------------------------------------------------\n // Initial focus on panel open \u2014 all paths go through the tracker.\n // ---------------------------------------------------------------------------\n // Children's effects run before parent effects, so AppPickerItem chip registration\n // (registerChip) is complete by the time this effect fires. Keyboard + internal trigger\n // is handled by useAppPickerBehavior's effect; this effect handles the other two paths.\n // eslint-disable-next-line react-hooks/exhaustive-deps -- runs once on panel mount\n useEffect(() => {\n if (wasOpenedByKeyboardRef?.current && triggerIsInternal) return;\n if (triggerIsInternal) {\n trackFocusPanel();\n } else {\n trackFocusFirstItem(apps, customApps);\n }\n }, []);\n\n // ---------------------------------------------------------------------------\n // Panel wrapper \u2014 tracker-driven focus for the mouse-open announcement path.\n // handleWrapperRef gets a new reference when isWrapperFocused changes \u2192 React\n // re-invokes the callback with the DOM node \u2192 node.focus() fires.\n // ---------------------------------------------------------------------------\n const isWrapperFocused = focusRegion === APP_PICKER_REGION_FOCUSES.PANEL;\n\n const handleWrapperRef = useCallback(\n (node: HTMLElement | null) => {\n if (node && isWrapperFocused) node.focus();\n },\n [isWrapperFocused],\n );\n\n // ---------------------------------------------------------------------------\n\n const handleAppClick = useCallback((e: React.MouseEvent, app: DSAppPickerT.AppItem) => {\n if (app.onClick) app.onClick(e, app);\n }, []);\n\n const handleOnKeyDownWrapper: React.KeyboardEventHandler = useCallback(\n (e) => {\n if (onKeyDown) onKeyDown(e);\n if (!onKeyDown && e.key === 'Escape') {\n triggerRef?.current?.focus();\n close();\n }\n },\n [onKeyDown, triggerRef, close],\n );\n\n const handleOnKeyDown = useFocusTrap({\n firstElementRef: firstFocusableRef,\n lastElementRef: lastFocusableRef,\n onKeyDown: handleOnKeyDownWrapper,\n });\n\n const totalAppsLength = useMemo(() => apps.length + customApps.length, [apps.length, customApps.length]);\n\n const layout = useMemo(() => {\n const cols = ['repeat(3, 92px)'];\n // Row tracks are intentionally auto-sized:\n // - title row picks up its own typography height\n // - chip rows expand when `wrapText` causes a chip to wrap onto a second line (Reflow story)\n // - separator row picks up its own 1px height + margin\n const rows: string[] = ['auto'];\n return { rows, cols };\n }, []);\n\n return (\n <StyledWrapper\n forwardedAs=\"ul\"\n role=\"listbox\"\n innerRef={handleWrapperRef}\n data-testid={DSAppPickerDataTestIds.ROOT}\n cols={layout.cols}\n rows={layout.rows}\n tabIndex={-1}\n aria-label={`Application picker, ${sectionTitle} (${apps.length} apps)${\n customApps.length > 0 ? `, ${customSectionTitle} (${customApps.length} apps)` : ''\n }`}\n {...ownerPropsConfig}\n {...safeGlobalAttributes}\n {...xstyledProps}\n onKeyDown={handleOnKeyDown}\n >\n <AppSection\n items={apps}\n title={sectionTitle}\n positionOffset={0}\n totalCount={totalAppsLength}\n ownerProps={ownerPropsConfig}\n onItemClick={handleAppClick}\n firstFocusableIdx={firstFocusableIdx}\n lastFocusableIdx={lastFocusableIdx}\n />\n {customApps.length > 0 && (\n <>\n <StyledListItemFullRow\n data-testid={DSAppPickerDataTestIds.ROW}\n aria-hidden\n role=\"group\"\n {...ownerPropsConfig}\n >\n <StyledSeparator data-testid={DSAppPickerDataTestIds.SEPARATOR} role=\"presentation\" {...ownerPropsConfig} />\n </StyledListItemFullRow>\n <AppSection\n items={customApps}\n title={customSectionTitle}\n positionOffset={apps.length}\n totalCount={totalAppsLength}\n ownerProps={ownerPropsConfig}\n onItemClick={handleAppClick}\n keyPrefix=\"custom-\"\n firstFocusableIdx={firstFocusableIdx}\n lastFocusableIdx={lastFocusableIdx}\n />\n </>\n )}\n </StyledWrapper>\n );\n};\n\nexport const AppPanel = memo(AppPanelBase);\nAppPanel.displayName = 'DSAppPicker.AppPanel';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADkIjB;AAlIN,mBAAiF;AACjF,iCAA6B;AAC7B,mBAAsE;AAEtE,uBAAkE;AAElE,wBAA2B;AAC3B,4BAAmC;AAEnC,MAAM,eAAe,CACnB,UAOG;AACH,QAAM,EAAE,OAAO,YAAY,wBAAwB,mBAAmB,kBAAkB,kBAAkB,aAAa,IAAI;AAC3H,QAAM,EAAE,MAAM,YAAY,cAAc,oBAAoB,UAAU,IAAI;AAE1E,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,QAAI,yBAAW,wCAAkB;AAKjC,QAAM,EAAE,MAAM,SAAS,WAAW,iBAAiB,GAAG,qBAAqB,IAAI;AAS/E,QAAM,eAAW,sBAAQ,MAAM,CAAC,GAAG,MAAM,GAAG,UAAU,GAAG,CAAC,MAAM,UAAU,CA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|
|
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 AppPickerItem_exports = {};
|
|
30
|
+
__export(AppPickerItem_exports, {
|
|
31
|
+
AppPickerItem: () => AppPickerItem
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(AppPickerItem_exports);
|
|
34
|
+
var React = __toESM(require("react"));
|
|
35
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
|
+
var import_react = __toESM(require("react"));
|
|
37
|
+
var import_uid = require("uid");
|
|
38
|
+
var import_ds_system = require("@elliemae/ds-system");
|
|
39
|
+
var import_ds_chip = require("@elliemae/ds-chip");
|
|
40
|
+
var import_constants = require("../constants/index.js");
|
|
41
|
+
var import_style = require("./style.js");
|
|
42
|
+
var import_DSAppPickerCTX = require("../DSAppPickerCTX.js");
|
|
43
|
+
var import_useFocusTracker = require("../config/useFocusTracker.js");
|
|
44
|
+
const StyledChip = (0, import_ds_system.styled)(import_ds_chip.DSChip, { name: import_constants.DSAppPickerName, slot: import_constants.DSAppPickerSlots.CHIP })``;
|
|
45
|
+
const AppIcon = ({ icon: Icon }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { className: "app-picker__icon", size: "m" });
|
|
46
|
+
const AppPickerItem = import_react.default.memo(
|
|
47
|
+
({ app, positionLabel, ownerProps, onClick, isFirstFocusable, isLastFocusable }) => {
|
|
48
|
+
const { label, disabled, applyAriaDisabled, selected, icon, id, wrapText } = app;
|
|
49
|
+
const { focusRegion, firstFocusableRef, lastFocusableRef, registerChip, trackFocusChip, trackFocusRegionReset } = (0, import_react.useContext)(import_DSAppPickerCTX.DSAppPickerContext);
|
|
50
|
+
const instanceUid = import_react.default.useMemo(() => (0, import_uid.uid)(5), []);
|
|
51
|
+
const chipId = id ?? `${label}-${instanceUid}`;
|
|
52
|
+
const isFocused = focusRegion === (0, import_useFocusTracker.getChipRegionId)(chipId);
|
|
53
|
+
import_react.default.useEffect(() => {
|
|
54
|
+
registerChip(app, chipId);
|
|
55
|
+
}, [app, chipId, registerChip]);
|
|
56
|
+
const getOwnerPropsArguments = import_react.default.useCallback(() => app, [app]);
|
|
57
|
+
const renderIcon = import_react.default.useCallback(() => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AppIcon, { icon }), [icon]);
|
|
58
|
+
const handleClick = import_react.default.useCallback((e) => onClick(e, app), [app, onClick]);
|
|
59
|
+
const handleFocus = import_react.default.useCallback(() => trackFocusChip(chipId), [chipId, trackFocusChip]);
|
|
60
|
+
const handleChipRef = import_react.default.useCallback(
|
|
61
|
+
(node) => {
|
|
62
|
+
if (isFirstFocusable) firstFocusableRef.current = node;
|
|
63
|
+
if (isLastFocusable) lastFocusableRef.current = node;
|
|
64
|
+
if (node && isFocused) node.focus();
|
|
65
|
+
},
|
|
66
|
+
[isFirstFocusable, isLastFocusable, isFocused, firstFocusableRef, lastFocusableRef]
|
|
67
|
+
);
|
|
68
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
69
|
+
import_style.StyledListItem,
|
|
70
|
+
{
|
|
71
|
+
"data-testid": import_constants.DSAppPickerDataTestIds.ITEM,
|
|
72
|
+
role: "presentation",
|
|
73
|
+
getOwnerProps: ownerProps.getOwnerProps,
|
|
74
|
+
getOwnerPropsArguments,
|
|
75
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
76
|
+
StyledChip,
|
|
77
|
+
{
|
|
78
|
+
onClick: handleClick,
|
|
79
|
+
"data-testid": import_constants.DSAppPickerDataTestIds.CHIP,
|
|
80
|
+
disabled,
|
|
81
|
+
applyAriaDisabled,
|
|
82
|
+
selected,
|
|
83
|
+
"aria-selected": selected,
|
|
84
|
+
role: "option",
|
|
85
|
+
id,
|
|
86
|
+
"aria-label": `${label}. ${positionLabel}`,
|
|
87
|
+
icon: renderIcon,
|
|
88
|
+
label,
|
|
89
|
+
getOwnerProps: ownerProps.getOwnerProps,
|
|
90
|
+
getOwnerPropsArguments,
|
|
91
|
+
wrapText,
|
|
92
|
+
innerRef: handleChipRef,
|
|
93
|
+
onBlur: trackFocusRegionReset,
|
|
94
|
+
onFocus: handleFocus
|
|
95
|
+
}
|
|
96
|
+
)
|
|
97
|
+
}
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
);
|
|
101
|
+
AppPickerItem.displayName = "DSAppPicker.AppPickerItem";
|
|
102
|
+
//# sourceMappingURL=AppPickerItem.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/parts/AppPickerItem.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React, { useContext } from 'react';\nimport { uid } from 'uid';\nimport { styled } from '@elliemae/ds-system';\nimport { DSChip } from '@elliemae/ds-chip';\nimport type { DSAppPickerT } from '../react-desc-prop-types.js';\nimport { DSAppPickerDataTestIds, DSAppPickerName, DSAppPickerSlots } from '../constants/index.js';\nimport { StyledListItem } from './style.js';\nimport { DSAppPickerContext } from '../DSAppPickerCTX.js';\nimport { getChipRegionId } from '../config/useFocusTracker.js';\n\nconst StyledChip = styled(DSChip, { name: DSAppPickerName, slot: DSAppPickerSlots.CHIP })``;\n\ninterface AppIconProps {\n icon: DSAppPickerT.AppItem['icon'];\n}\n\nconst AppIcon: React.FC<AppIconProps> = ({ icon: Icon }) => <Icon className=\"app-picker__icon\" size=\"m\" />;\n\ninterface AppPickerItemProps {\n app: DSAppPickerT.AppItem;\n positionLabel: string;\n ownerProps: { getOwnerProps: () => object };\n onClick: (e: React.MouseEvent, app: DSAppPickerT.AppItem) => void;\n isFirstFocusable: boolean;\n isLastFocusable: boolean;\n}\n\nexport const AppPickerItem: React.FC<AppPickerItemProps> = React.memo(\n ({ app, positionLabel, ownerProps, onClick, isFirstFocusable, isLastFocusable }) => {\n const { label, disabled, applyAriaDisabled, selected, icon, id, wrapText } = app;\n const { focusRegion, firstFocusableRef, lastFocusableRef, registerChip, trackFocusChip, trackFocusRegionReset } =\n useContext(DSAppPickerContext);\n\n const instanceUid = React.useMemo(() => uid(5), []);\n const chipId = id ?? `${label}-${instanceUid}`;\n const isFocused = focusRegion === getChipRegionId(chipId);\n\n React.useEffect(() => {\n registerChip(app, chipId);\n }, [app, chipId, registerChip]);\n\n const getOwnerPropsArguments = React.useCallback(() => app, [app]);\n const renderIcon = React.useCallback(() => <AppIcon icon={icon} />, [icon]);\n const handleClick = React.useCallback((e: React.MouseEvent) => onClick(e, app), [app, onClick]);\n const handleFocus = React.useCallback(() => trackFocusChip(chipId), [chipId, trackFocusChip]);\n\n // Single ref callback: registers focus-trap edges and drives tracker-seeded focus.\n // New reference when isFocused or edge membership changes \u2014 React re-invokes with the DOM node.\n const handleChipRef = React.useCallback(\n (node: HTMLElement | null) => {\n if (isFirstFocusable) firstFocusableRef.current = node;\n if (isLastFocusable) lastFocusableRef.current = node;\n if (node && isFocused) node.focus();\n },\n [isFirstFocusable, isLastFocusable, isFocused, firstFocusableRef, lastFocusableRef],\n );\n\n return (\n <StyledListItem\n data-testid={DSAppPickerDataTestIds.ITEM}\n role=\"presentation\"\n getOwnerProps={ownerProps.getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n <StyledChip\n onClick={handleClick}\n data-testid={DSAppPickerDataTestIds.CHIP}\n disabled={disabled}\n applyAriaDisabled={applyAriaDisabled}\n selected={selected}\n aria-selected={selected}\n role=\"option\"\n id={id}\n aria-label={`${label}. ${positionLabel}`}\n icon={renderIcon}\n label={label}\n getOwnerProps={ownerProps.getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n wrapText={wrapText}\n innerRef={handleChipRef}\n onBlur={trackFocusRegionReset}\n onFocus={handleFocus}\n />\n </StyledListItem>\n );\n },\n);\n\nAppPickerItem.displayName = 'DSAppPicker.AppPickerItem';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADgBqC;AAhB5D,mBAAkC;AAClC,iBAAoB;AACpB,uBAAuB;AACvB,qBAAuB;AAEvB,uBAA0E;AAC1E,mBAA+B;AAC/B,4BAAmC;AACnC,6BAAgC;AAEhC,MAAM,iBAAa,yBAAO,uBAAQ,EAAE,MAAM,kCAAiB,MAAM,kCAAiB,KAAK,CAAC;AAMxF,MAAM,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AAC;AAAA;AAAA,QACC,eAAa,wCAAuB;AAAA,QACpC,MAAK;AAAA,QACL,eAAe,WAAW;AAAA,QAC1B;AAAA,QAEA;AAAA,UAAC;AAAA;AAAA,YACC,SAAS;AAAA,YACT,eAAa,wCAAuB;AAAA,YACpC;AAAA,YACA;AAAA,YACA;AAAA,YACA,iBAAe;AAAA,YACf,MAAK;AAAA,YACL;AAAA,YACA,cAAY,GAAG,KAAK,KAAK,aAAa;AAAA,YACtC,MAAM;AAAA,YACN;AAAA,YACA,eAAe,WAAW;AAAA,YAC1B;AAAA,YACA;AAAA,YACA,UAAU;AAAA,YACV,QAAQ;AAAA,YACR,SAAS;AAAA;AAAA,QACX;AAAA;AAAA,IACF;AAAA,EAEJ;AACF;AAEA,cAAc,cAAc;",
|
|
6
|
+
"names": ["React"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
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 AppSection_exports = {};
|
|
30
|
+
__export(AppSection_exports, {
|
|
31
|
+
AppSection: () => AppSection
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(AppSection_exports);
|
|
34
|
+
var React = __toESM(require("react"));
|
|
35
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
|
+
var import_style = require("./style.js");
|
|
37
|
+
var import_constants = require("../constants/index.js");
|
|
38
|
+
var import_AppPickerItem = require("./AppPickerItem.js");
|
|
39
|
+
const AppSection = ({
|
|
40
|
+
items,
|
|
41
|
+
title,
|
|
42
|
+
positionOffset,
|
|
43
|
+
totalCount,
|
|
44
|
+
ownerProps,
|
|
45
|
+
onItemClick,
|
|
46
|
+
keyPrefix = "",
|
|
47
|
+
firstFocusableIdx,
|
|
48
|
+
lastFocusableIdx
|
|
49
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
50
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_style.StyledListItemFullRow, { "data-testid": import_constants.DSAppPickerDataTestIds.ROW, "aria-hidden": true, role: "group", ...ownerProps, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_style.StyledTitle, { "data-testid": import_constants.DSAppPickerDataTestIds.TITLE, role: "presentation", variant: "h3-strong", ...ownerProps, children: title }) }),
|
|
51
|
+
items.map((app, index) => {
|
|
52
|
+
const flatIndex = positionOffset + index;
|
|
53
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
54
|
+
import_AppPickerItem.AppPickerItem,
|
|
55
|
+
{
|
|
56
|
+
app,
|
|
57
|
+
positionLabel: `${title} (${flatIndex + 1} of ${totalCount})`,
|
|
58
|
+
ownerProps,
|
|
59
|
+
onClick: onItemClick,
|
|
60
|
+
isFirstFocusable: flatIndex === firstFocusableIdx,
|
|
61
|
+
isLastFocusable: flatIndex === lastFocusableIdx
|
|
62
|
+
},
|
|
63
|
+
app.id ?? `${app.label}-${keyPrefix}${index}`
|
|
64
|
+
);
|
|
65
|
+
})
|
|
66
|
+
] });
|
|
67
|
+
AppSection.displayName = "DSAppPicker.AppSection";
|
|
68
|
+
//# sourceMappingURL=AppSection.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/parts/AppSection.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport { StyledListItemFullRow, StyledTitle } from './style.js';\nimport { DSAppPickerDataTestIds } from '../constants/index.js';\nimport type { DSAppPickerT } from '../react-desc-prop-types.js';\nimport { AppPickerItem } from './AppPickerItem.js';\n\ninterface AppSectionProps {\n items: DSAppPickerT.AppItem[];\n title: string;\n positionOffset: number;\n totalCount: number;\n ownerProps: { getOwnerProps: () => object };\n onItemClick: (e: React.MouseEvent, app: DSAppPickerT.AppItem) => void;\n keyPrefix?: string;\n firstFocusableIdx: number;\n lastFocusableIdx: number;\n}\n\nexport const AppSection: React.FC<AppSectionProps> = ({\n items,\n title,\n positionOffset,\n totalCount,\n ownerProps,\n onItemClick,\n keyPrefix = '',\n firstFocusableIdx,\n lastFocusableIdx,\n}) => (\n <>\n <StyledListItemFullRow data-testid={DSAppPickerDataTestIds.ROW} aria-hidden role=\"group\" {...ownerProps}>\n <StyledTitle data-testid={DSAppPickerDataTestIds.TITLE} role=\"presentation\" variant=\"h3-strong\" {...ownerProps}>\n {title}\n </StyledTitle>\n </StyledListItemFullRow>\n {items.map((app, index) => {\n const flatIndex = positionOffset + index;\n return (\n <AppPickerItem\n key={app.id ?? `${app.label}-${keyPrefix}${index}`}\n app={app}\n positionLabel={`${title} (${flatIndex + 1} of ${totalCount})`}\n ownerProps={ownerProps}\n onClick={onItemClick}\n isFirstFocusable={flatIndex === firstFocusableIdx}\n isLastFocusable={flatIndex === lastFocusableIdx}\n />\n );\n })}\n </>\n);\n\nAppSection.displayName = 'DSAppPicker.AppSection';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD6BrB;AA5BF,mBAAmD;AACnD,uBAAuC;AAEvC,2BAA8B;AAcvB,MAAM,aAAwC,CAAC;AAAA,EACpD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,YAAY;AAAA,EACZ;AAAA,EACA;AACF,MACE,4EACE;AAAA,8CAAC,sCAAsB,eAAa,wCAAuB,KAAK,eAAW,MAAC,MAAK,SAAS,GAAG,YAC3F,sDAAC,4BAAY,eAAa,wCAAuB,OAAO,MAAK,gBAAe,SAAQ,aAAa,GAAG,YACjG,iBACH,GACF;AAAA,EACC,MAAM,IAAI,CAAC,KAAK,UAAU;AACzB,UAAM,YAAY,iBAAiB;AACnC,WACE;AAAA,MAAC;AAAA;AAAA,QAEC;AAAA,QACA,eAAe,GAAG,KAAK,KAAK,YAAY,CAAC,OAAO,UAAU;AAAA,QAC1D;AAAA,QACA,SAAS;AAAA,QACT,kBAAkB,cAAc;AAAA,QAChC,iBAAiB,cAAc;AAAA;AAAA,MAN1B,IAAI,MAAM,GAAG,IAAI,KAAK,IAAI,SAAS,GAAG,KAAK;AAAA,IAOlD;AAAA,EAEJ,CAAC;AAAA,GACH;AAGF,WAAW,cAAc;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|