@elliemae/ds-app-picker 3.70.0-next.53 → 3.70.0-next.58
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 +6 -64
- package/dist/cjs/DSAppPicker.js.map +3 -3
- package/dist/cjs/DSAppPickerCTX.js +2 -22
- package/dist/cjs/DSAppPickerCTX.js.map +2 -2
- package/dist/cjs/config/useAppPicker.js +22 -5
- package/dist/cjs/config/useAppPicker.js.map +2 -2
- package/dist/cjs/config/useFocusTracker.js +24 -35
- package/dist/cjs/config/useFocusTracker.js.map +2 -2
- package/dist/cjs/constants/index.js +3 -0
- package/dist/cjs/constants/index.js.map +2 -2
- package/dist/cjs/package.json +1 -4
- package/dist/cjs/parts/AppPanel.js +81 -88
- package/dist/cjs/parts/AppPanel.js.map +3 -3
- package/dist/cjs/parts/AppPickerFloatingContext/AppPickerContent.js +94 -0
- package/dist/cjs/parts/AppPickerFloatingContext/AppPickerContent.js.map +7 -0
- package/dist/cjs/parts/AppPickerFloatingContext/useAppPickerFloatingContext.js +171 -0
- package/dist/cjs/parts/AppPickerFloatingContext/useAppPickerFloatingContext.js.map +7 -0
- package/dist/cjs/parts/AppPickerItem.js +23 -21
- package/dist/cjs/parts/AppPickerItem.js.map +2 -2
- package/dist/cjs/parts/AppSection.js +55 -29
- package/dist/cjs/parts/AppSection.js.map +2 -2
- package/dist/cjs/parts/Trigger.js +26 -9
- package/dist/cjs/parts/Trigger.js.map +2 -2
- 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 +21 -4
- 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 +8 -1
- 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/esm/DSAppPicker.js +7 -65
- package/dist/esm/DSAppPicker.js.map +3 -3
- package/dist/esm/DSAppPickerCTX.js +2 -22
- package/dist/esm/DSAppPickerCTX.js.map +2 -2
- package/dist/esm/config/useAppPicker.js +25 -8
- package/dist/esm/config/useAppPicker.js.map +2 -2
- package/dist/esm/config/useFocusTracker.js +23 -34
- package/dist/esm/config/useFocusTracker.js.map +2 -2
- package/dist/esm/constants/index.js +3 -0
- package/dist/esm/constants/index.js.map +2 -2
- package/dist/esm/package.json +1 -4
- package/dist/esm/parts/AppPanel.js +86 -88
- package/dist/esm/parts/AppPanel.js.map +3 -3
- package/dist/esm/parts/AppPickerFloatingContext/AppPickerContent.js +64 -0
- package/dist/esm/parts/AppPickerFloatingContext/AppPickerContent.js.map +7 -0
- package/dist/esm/parts/AppPickerFloatingContext/useAppPickerFloatingContext.js +141 -0
- package/dist/esm/parts/AppPickerFloatingContext/useAppPickerFloatingContext.js.map +7 -0
- package/dist/esm/parts/AppPickerItem.js +21 -19
- package/dist/esm/parts/AppPickerItem.js.map +2 -2
- package/dist/esm/parts/AppSection.js +57 -31
- package/dist/esm/parts/AppSection.js.map +2 -2
- package/dist/esm/parts/Trigger.js +27 -10
- package/dist/esm/parts/Trigger.js.map +2 -2
- 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 +21 -4
- 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 +8 -1
- 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/types/DSAppPicker.d.ts +1 -1
- package/dist/types/DSAppPickerCTX.d.ts +6 -17
- package/dist/types/config/useAppPicker.d.ts +110 -91
- package/dist/types/config/useFocusTracker.d.ts +10 -6
- package/dist/types/constants/index.d.ts +3 -0
- package/dist/types/parts/AppPanel.d.ts +1 -8
- package/dist/types/parts/AppPickerFloatingContext/AppPickerContent.d.ts +3 -0
- package/dist/types/parts/AppPickerFloatingContext/useAppPickerFloatingContext.d.ts +170 -0
- package/dist/types/parts/AppPickerItem.d.ts +2 -5
- package/dist/types/parts/AppSection.d.ts +1 -12
- package/dist/types/parts/Trigger.d.ts +11 -13
- package/dist/types/parts/shared-styles.d.ts +2 -0
- package/dist/types/react-desc-prop-types.d.ts +59 -1
- package/dist/types/util/getChipId.d.ts +2 -0
- package/dist/types/util/getChipRegionId.d.ts +1 -0
- package/package.json +17 -17
- package/dist/cjs/config/useAppPickerBehavior.js +0 -156
- package/dist/cjs/config/useAppPickerBehavior.js.map +0 -7
- package/dist/cjs/parts/style.js +0 -88
- package/dist/cjs/parts/style.js.map +0 -7
- package/dist/esm/config/useAppPickerBehavior.js +0 -126
- package/dist/esm/config/useAppPickerBehavior.js.map +0 -7
- package/dist/esm/parts/style.js +0 -58
- package/dist/esm/parts/style.js.map +0 -7
- package/dist/types/config/useAppPickerBehavior.d.ts +0 -39
- package/dist/types/parts/style.d.ts +0 -6
package/dist/cjs/DSAppPicker.js
CHANGED
|
@@ -35,74 +35,16 @@ module.exports = __toCommonJS(DSAppPicker_exports);
|
|
|
35
35
|
var React = __toESM(require("react"));
|
|
36
36
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
37
37
|
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
38
|
-
var
|
|
39
|
-
var import_AppPanel = require("./parts/AppPanel.js");
|
|
40
|
-
var import_react_desc_prop_types = require("./react-desc-prop-types.js");
|
|
41
|
-
var import_constants = require("./constants/index.js");
|
|
38
|
+
var import_react = __toESM(require("react"));
|
|
42
39
|
var import_useAppPicker = require("./config/useAppPicker.js");
|
|
43
|
-
var
|
|
40
|
+
var import_constants = require("./constants/index.js");
|
|
44
41
|
var import_DSAppPickerCTX = require("./DSAppPickerCTX.js");
|
|
45
|
-
var
|
|
46
|
-
var
|
|
42
|
+
var import_AppPickerContent = require("./parts/AppPickerFloatingContext/AppPickerContent.js");
|
|
43
|
+
var import_react_desc_prop_types = require("./react-desc-prop-types.js");
|
|
47
44
|
const DSAppPicker = (props) => {
|
|
48
45
|
const appPickerConfig = (0, import_useAppPicker.useAppPicker)(props);
|
|
49
|
-
const {
|
|
50
|
-
|
|
51
|
-
renderTrigger,
|
|
52
|
-
resolvedIsOpen,
|
|
53
|
-
floatingStyles,
|
|
54
|
-
arrowStyles,
|
|
55
|
-
floatingContext,
|
|
56
|
-
ownerPropsConfig,
|
|
57
|
-
defaultTriggerRef,
|
|
58
|
-
triggerRef,
|
|
59
|
-
wasOpenedByKeyboardRef,
|
|
60
|
-
handleClose,
|
|
61
|
-
handleTriggerRef,
|
|
62
|
-
handleTriggerClick,
|
|
63
|
-
floatingInnerRef,
|
|
64
|
-
focusTracker
|
|
65
|
-
} = (0, import_useAppPickerBehavior.useAppPickerBehavior)(appPickerConfig);
|
|
66
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_DSAppPickerCTX.DSAppPickerContext.Provider, { value: focusTracker, children: [
|
|
67
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
68
|
-
import_Trigger.Trigger,
|
|
69
|
-
{
|
|
70
|
-
Icon,
|
|
71
|
-
isOpen: resolvedIsOpen,
|
|
72
|
-
setRef: handleTriggerRef,
|
|
73
|
-
ownerProps: ownerPropsConfig,
|
|
74
|
-
onClick: handleTriggerClick,
|
|
75
|
-
renderTrigger
|
|
76
|
-
}
|
|
77
|
-
),
|
|
78
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
79
|
-
import_style.StyledAppPickerFloating,
|
|
80
|
-
{
|
|
81
|
-
innerRef: floatingInnerRef,
|
|
82
|
-
isOpen: resolvedIsOpen,
|
|
83
|
-
floatingStyles,
|
|
84
|
-
context: floatingContext,
|
|
85
|
-
getOwnerProps: ownerPropsConfig.getOwnerProps,
|
|
86
|
-
getOwnerPropsArguments: ownerPropsConfig.getOwnerPropsArguments,
|
|
87
|
-
children: [
|
|
88
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
89
|
-
import_AppPanel.AppPanel,
|
|
90
|
-
{
|
|
91
|
-
...appPickerConfig.propsWithDefault,
|
|
92
|
-
ownerPropsConfig,
|
|
93
|
-
globalAttributes: appPickerConfig.globalAttributes,
|
|
94
|
-
xstyledProps: appPickerConfig.xstyledProps,
|
|
95
|
-
close: handleClose,
|
|
96
|
-
triggerRef: triggerRef || defaultTriggerRef,
|
|
97
|
-
triggerIsInternal: !renderTrigger,
|
|
98
|
-
wasOpenedByKeyboardRef
|
|
99
|
-
}
|
|
100
|
-
),
|
|
101
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_floating_context.PopoverArrow, { ...arrowStyles })
|
|
102
|
-
]
|
|
103
|
-
}
|
|
104
|
-
)
|
|
105
|
-
] });
|
|
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, {}) });
|
|
106
48
|
};
|
|
107
49
|
DSAppPicker.displayName = import_constants.DSAppPickerName;
|
|
108
50
|
const AppPickerWithSchema = (0, import_ds_props_helpers.describe)(DSAppPicker);
|
|
@@ -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;ACAA,YAAuB;
|
|
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
|
}
|
|
@@ -33,26 +33,6 @@ __export(DSAppPickerCTX_exports, {
|
|
|
33
33
|
module.exports = __toCommonJS(DSAppPickerCTX_exports);
|
|
34
34
|
var React = __toESM(require("react"));
|
|
35
35
|
var import_react = require("react");
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
firstFocusableRef: { current: null },
|
|
39
|
-
lastFocusableRef: { current: null },
|
|
40
|
-
registerChip: () => {
|
|
41
|
-
},
|
|
42
|
-
trackFocusChip: () => {
|
|
43
|
-
},
|
|
44
|
-
trackFocusRegionReset: () => {
|
|
45
|
-
},
|
|
46
|
-
trackFocusTrigger: () => {
|
|
47
|
-
},
|
|
48
|
-
trackFocusPanel: () => {
|
|
49
|
-
},
|
|
50
|
-
trackFocusSelectedItem: () => {
|
|
51
|
-
},
|
|
52
|
-
trackFocusFirstItem: () => {
|
|
53
|
-
},
|
|
54
|
-
trackFocusItemAtIndex: () => {
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
const DSAppPickerContext = (0, import_react.createContext)(defaultFocusContext);
|
|
36
|
+
const defaultContext = {};
|
|
37
|
+
const DSAppPickerContext = (0, import_react.createContext)(defaultContext);
|
|
58
38
|
//# sourceMappingURL=DSAppPickerCTX.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/DSAppPickerCTX.ts", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,
|
|
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
6
|
"names": []
|
|
7
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");
|
|
39
|
+
var import_useFocusTracker = require("./useFocusTracker.js");
|
|
38
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
43
|
(0, import_useValidateProps.useValidateProps)(propsWithDefault, import_react_desc_prop_types.DSAppPickerPropTypesSchema);
|
|
42
44
|
const ownerPropsConfig = (0, import_ds_props_helpers.useOwnerProps)(propsWithDefault, propsWithDefault);
|
|
43
|
-
const globalAttributes = (0, import_ds_props_helpers.
|
|
44
|
-
const xstyledProps = (0, import_ds_props_helpers.
|
|
45
|
+
const globalAttributes = (0, import_ds_props_helpers.useGetGlobalAttributes)(props);
|
|
46
|
+
const xstyledProps = (0, import_ds_props_helpers.useGetXstyledProps)(props);
|
|
47
|
+
const wasOpenedByKeyboardRef = (0, import_react.useRef)(false);
|
|
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
|
+
wasOpenedByKeyboardRef,
|
|
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
3
|
"sources": ["../../../src/config/useAppPicker.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,
|
|
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 const wasOpenedByKeyboardRef = useRef(false);\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 wasOpenedByKeyboardRef,\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;AAIjE,QAAM,6BAAyB,qBAAO,KAAK;AAO3C,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
|
}
|
|
@@ -28,25 +28,23 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
var useFocusTracker_exports = {};
|
|
30
30
|
__export(useFocusTracker_exports, {
|
|
31
|
-
getChipRegionId: () => getChipRegionId,
|
|
32
31
|
useFocusTracker: () => useFocusTracker
|
|
33
32
|
});
|
|
34
33
|
module.exports = __toCommonJS(useFocusTracker_exports);
|
|
35
34
|
var React = __toESM(require("react"));
|
|
36
35
|
var import_react = require("react");
|
|
37
36
|
var import_constants = require("../constants/index.js");
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const useFocusTracker = () => {
|
|
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]);
|
|
41
43
|
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
44
|
const firstFocusableRef = (0, import_react.useRef)(null);
|
|
44
45
|
const lastFocusableRef = (0, import_react.useRef)(null);
|
|
45
|
-
const registerChip = (0, import_react.useCallback)((app, chipId) => {
|
|
46
|
-
chipIdRegistry.current.set(app, chipId);
|
|
47
|
-
}, []);
|
|
48
46
|
const trackFocusChip = (0, import_react.useCallback)((chipId) => {
|
|
49
|
-
setFocusRegion(getChipRegionId(chipId));
|
|
47
|
+
setFocusRegion((0, import_getChipRegionId.getChipRegionId)(chipId));
|
|
50
48
|
}, []);
|
|
51
49
|
const trackFocusRegionReset = (0, import_react.useCallback)(() => {
|
|
52
50
|
setFocusRegion(import_constants.APP_PICKER_REGION_FOCUSES.RESET);
|
|
@@ -57,38 +55,30 @@ const useFocusTracker = () => {
|
|
|
57
55
|
const trackFocusPanel = (0, import_react.useCallback)(() => {
|
|
58
56
|
setFocusRegion(import_constants.APP_PICKER_REGION_FOCUSES.PANEL);
|
|
59
57
|
}, []);
|
|
60
|
-
const trackFocusSelectedItem = (0, import_react.useCallback)((
|
|
61
|
-
const
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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));
|
|
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 trackFocusFirstItem = (0, import_react.useCallback)(() => {
|
|
64
|
+
if (firstFocusableIdx !== -1) {
|
|
65
|
+
setFocusRegion((0, import_getChipRegionId.getChipRegionId)((0, import_getChipId.getChipId)(allApps[firstFocusableIdx], firstFocusableIdx)));
|
|
74
66
|
}
|
|
75
|
-
}, []);
|
|
67
|
+
}, [firstFocusableIdx, allApps]);
|
|
76
68
|
const trackFocusItemAtIndex = (0, import_react.useCallback)(
|
|
77
|
-
(
|
|
78
|
-
const target = [
|
|
79
|
-
if (target)
|
|
80
|
-
const chipId = chipIdRegistry.current.get(target) ?? target.id ?? target.label;
|
|
81
|
-
setFocusRegion(getChipRegionId(chipId));
|
|
82
|
-
}
|
|
69
|
+
(index) => {
|
|
70
|
+
const target = allApps[index];
|
|
71
|
+
if (target) setFocusRegion((0, import_getChipRegionId.getChipRegionId)((0, import_getChipId.getChipId)(target, index)));
|
|
83
72
|
},
|
|
84
|
-
[]
|
|
73
|
+
[allApps]
|
|
85
74
|
);
|
|
86
75
|
return (0, import_react.useMemo)(
|
|
87
76
|
() => ({
|
|
77
|
+
firstFocusableIdx,
|
|
78
|
+
lastFocusableIdx,
|
|
88
79
|
focusRegion,
|
|
89
80
|
firstFocusableRef,
|
|
90
81
|
lastFocusableRef,
|
|
91
|
-
registerChip,
|
|
92
82
|
trackFocusChip,
|
|
93
83
|
trackFocusRegionReset,
|
|
94
84
|
trackFocusTrigger,
|
|
@@ -98,10 +88,9 @@ const useFocusTracker = () => {
|
|
|
98
88
|
trackFocusItemAtIndex
|
|
99
89
|
}),
|
|
100
90
|
[
|
|
91
|
+
firstFocusableIdx,
|
|
92
|
+
lastFocusableIdx,
|
|
101
93
|
focusRegion,
|
|
102
|
-
firstFocusableRef,
|
|
103
|
-
lastFocusableRef,
|
|
104
|
-
registerChip,
|
|
105
94
|
trackFocusChip,
|
|
106
95
|
trackFocusRegionReset,
|
|
107
96
|
trackFocusTrigger,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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';\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
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 const trackFocusFirstItem = useCallback(() => {\n if (firstFocusableIdx !== -1) {\n setFocusRegion(getChipRegionId(getChipId(allApps[firstFocusableIdx], firstFocusableIdx)));\n }\n }, [firstFocusableIdx, allApps]);\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 trackFocusFirstItem,\n trackFocusItemAtIndex,\n }),\n [\n firstFocusableIdx,\n lastFocusableIdx,\n focusRegion,\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;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;AAEZ,QAAM,0BAAsB,0BAAY,MAAM;AAC5C,QAAI,sBAAsB,IAAI;AAC5B,yBAAe,4CAAgB,4BAAU,QAAQ,iBAAiB,GAAG,iBAAiB,CAAC,CAAC;AAAA,IAC1F;AAAA,EACF,GAAG,CAAC,mBAAmB,OAAO,CAAC;AAE/B,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
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -29,6 +29,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
29
29
|
var constants_exports = {};
|
|
30
30
|
__export(constants_exports, {
|
|
31
31
|
APP_PICKER_REGION_FOCUSES: () => APP_PICKER_REGION_FOCUSES,
|
|
32
|
+
CHIP_REGION_PREFIX: () => CHIP_REGION_PREFIX,
|
|
32
33
|
DSAppPickerDataTestIds: () => DSAppPickerDataTestIds,
|
|
33
34
|
DSAppPickerName: () => DSAppPickerName,
|
|
34
35
|
DSAppPickerSlots: () => DSAppPickerSlots
|
|
@@ -42,8 +43,10 @@ const APP_PICKER_REGION_FOCUSES = {
|
|
|
42
43
|
TRIGGER: "trigger",
|
|
43
44
|
PANEL: "panel"
|
|
44
45
|
};
|
|
46
|
+
const CHIP_REGION_PREFIX = "chip-";
|
|
45
47
|
const DSAppPickerSlots = {
|
|
46
48
|
ROOT: "root",
|
|
49
|
+
GROUP: "group",
|
|
47
50
|
ITEM: "item",
|
|
48
51
|
TITLE: "title",
|
|
49
52
|
SEPARATOR: "separator",
|
|
@@ -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\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;",
|
|
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/package.json
CHANGED
|
@@ -33,37 +33,86 @@ __export(AppPanel_exports, {
|
|
|
33
33
|
module.exports = __toCommonJS(AppPanel_exports);
|
|
34
34
|
var React = __toESM(require("react"));
|
|
35
35
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
|
-
var
|
|
36
|
+
var import_ds_grid = require("@elliemae/ds-grid");
|
|
37
37
|
var import_ds_hooks_focus_trap = require("@elliemae/ds-hooks-focus-trap");
|
|
38
|
-
var
|
|
38
|
+
var import_ds_system = require("@elliemae/ds-system");
|
|
39
|
+
var import_react = __toESM(require("react"));
|
|
39
40
|
var import_constants = require("../constants/index.js");
|
|
40
|
-
var import_AppSection = require("./AppSection.js");
|
|
41
41
|
var import_DSAppPickerCTX = require("../DSAppPickerCTX.js");
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
42
|
+
var import_AppSection = require("./AppSection.js");
|
|
43
|
+
var import_shared_styles = require("./shared-styles.js");
|
|
44
|
+
const StyledWrapper = (0, import_ds_system.styled)(import_ds_grid.Grid, { name: import_constants.DSAppPickerName, slot: import_constants.DSAppPickerSlots.ROOT })`
|
|
45
|
+
background-color: ${({ theme }) => theme.colors.neutral["000"]};
|
|
46
|
+
min-width: 308px;
|
|
47
|
+
min-height: 110px;
|
|
48
|
+
max-height: 449px;
|
|
49
|
+
width: 308px;
|
|
50
|
+
overflow-y: auto;
|
|
51
|
+
overflow-x: hidden;
|
|
52
|
+
/* Baseline 2024: reserve scrollbar gutter so the layout doesn't shift between overflow/no-overflow.
|
|
53
|
+
Replaces a JS isOverflow detection effect that toggled right padding. */
|
|
54
|
+
scrollbar-gutter: stable;
|
|
55
|
+
margin: 0;
|
|
56
|
+
padding: 0 0 8px 16px;
|
|
57
|
+
&:focus {
|
|
58
|
+
outline: none;
|
|
59
|
+
}
|
|
60
|
+
`;
|
|
61
|
+
const StyledSeparator = (0, import_ds_system.styled)("hr", { name: import_constants.DSAppPickerName, slot: import_constants.DSAppPickerSlots.SEPARATOR })`
|
|
62
|
+
border-top: 1px solid ${({ theme }) => theme.colors.neutral[300]};
|
|
63
|
+
border-bottom: none;
|
|
64
|
+
width: 100%;
|
|
65
|
+
margin: 8px 0 0 0;
|
|
66
|
+
`;
|
|
67
|
+
const wrapperGridLayout = {
|
|
68
|
+
cols: ["repeat(3, 92px)"],
|
|
69
|
+
// Row tracks are intentionally auto-sized:
|
|
70
|
+
// - title row picks up its own typography height
|
|
71
|
+
// - chip rows expand when `wrapText` causes a chip to wrap onto a second line (Reflow story)
|
|
72
|
+
// - separator row picks up its own 1px height + margin
|
|
73
|
+
rows: ["auto"]
|
|
74
|
+
};
|
|
75
|
+
const useExecOnceAfterFirstRender = (callback) => {
|
|
76
|
+
const hasExecutedRef = import_react.default.useRef(false);
|
|
77
|
+
const executeInitialFocusRef = import_react.default.useRef(callback);
|
|
78
|
+
executeInitialFocusRef.current = callback;
|
|
59
79
|
(0, import_react.useEffect)(() => {
|
|
60
|
-
if (
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
} else {
|
|
64
|
-
trackFocusFirstItem(apps, customApps);
|
|
80
|
+
if (!hasExecutedRef.current) {
|
|
81
|
+
executeInitialFocusRef.current();
|
|
82
|
+
hasExecutedRef.current = true;
|
|
65
83
|
}
|
|
66
84
|
}, []);
|
|
85
|
+
};
|
|
86
|
+
const useMountedOpenAutofocusNuance = ({
|
|
87
|
+
pendingRef,
|
|
88
|
+
triggerIsInternal,
|
|
89
|
+
trackFocusPanel,
|
|
90
|
+
trackFocusFirstItem
|
|
91
|
+
}) => {
|
|
92
|
+
useExecOnceAfterFirstRender(() => {
|
|
93
|
+
if (!pendingRef.current) return;
|
|
94
|
+
pendingRef.current = false;
|
|
95
|
+
if (triggerIsInternal) trackFocusPanel();
|
|
96
|
+
else trackFocusFirstItem();
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
const AppPanelBase = () => {
|
|
100
|
+
const {
|
|
101
|
+
propsWithDefault: { customApps, renderTrigger, onKeyDown },
|
|
102
|
+
ownerPropsConfig,
|
|
103
|
+
globalAttributes,
|
|
104
|
+
xstyledProps,
|
|
105
|
+
mountedOpenAutofocusPendingRef,
|
|
106
|
+
focusTrackers: { focusRegion, firstFocusableRef, lastFocusableRef, trackFocusPanel, trackFocusFirstItem }
|
|
107
|
+
} = (0, import_react.useContext)(import_DSAppPickerCTX.DSAppPickerContext);
|
|
108
|
+
const triggerIsInternal = !renderTrigger;
|
|
109
|
+
const { wrap, onClick, onKeyDown: onKeyDownGlobal, ...safeGlobalAttributes } = globalAttributes;
|
|
110
|
+
useMountedOpenAutofocusNuance({
|
|
111
|
+
pendingRef: mountedOpenAutofocusPendingRef,
|
|
112
|
+
triggerIsInternal,
|
|
113
|
+
trackFocusPanel,
|
|
114
|
+
trackFocusFirstItem
|
|
115
|
+
});
|
|
67
116
|
const isWrapperFocused = focusRegion === import_constants.APP_PICKER_REGION_FOCUSES.PANEL;
|
|
68
117
|
const handleWrapperRef = (0, import_react.useCallback)(
|
|
69
118
|
(node) => {
|
|
@@ -71,84 +120,28 @@ const AppPanelBase = (props) => {
|
|
|
71
120
|
},
|
|
72
121
|
[isWrapperFocused]
|
|
73
122
|
);
|
|
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
123
|
const handleOnKeyDown = (0, import_ds_hooks_focus_trap.useFocusTrap)({
|
|
88
124
|
firstElementRef: firstFocusableRef,
|
|
89
125
|
lastElementRef: lastFocusableRef,
|
|
90
|
-
onKeyDown
|
|
126
|
+
onKeyDown
|
|
91
127
|
});
|
|
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
128
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
99
|
-
|
|
129
|
+
StyledWrapper,
|
|
100
130
|
{
|
|
101
|
-
forwardedAs: "ul",
|
|
102
|
-
role: "listbox",
|
|
103
131
|
innerRef: handleWrapperRef,
|
|
104
132
|
"data-testid": import_constants.DSAppPickerDataTestIds.ROOT,
|
|
105
|
-
cols:
|
|
106
|
-
rows:
|
|
133
|
+
cols: wrapperGridLayout.cols,
|
|
134
|
+
rows: wrapperGridLayout.rows,
|
|
107
135
|
tabIndex: -1,
|
|
108
|
-
"aria-label": `Application picker, ${sectionTitle} (${apps.length} apps)${customApps.length > 0 ? `, ${customSectionTitle} (${customApps.length} apps)` : ""}`,
|
|
109
136
|
...ownerPropsConfig,
|
|
110
137
|
...safeGlobalAttributes,
|
|
111
138
|
...xstyledProps,
|
|
112
139
|
onKeyDown: handleOnKeyDown,
|
|
113
140
|
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
|
-
),
|
|
141
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_AppSection.AppSection, {}),
|
|
127
142
|
customApps.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
128
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
129
|
-
|
|
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
|
-
)
|
|
143
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_shared_styles.StyledListItemFullRow, { "data-testid": import_constants.DSAppPickerDataTestIds.ROW, ...ownerPropsConfig, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StyledSeparator, { "data-testid": import_constants.DSAppPickerDataTestIds.SEPARATOR, ...ownerPropsConfig }) }),
|
|
144
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_AppSection.AppSection, { isCustomApps: true })
|
|
152
145
|
] })
|
|
153
146
|
]
|
|
154
147
|
}
|