@elliemae/ds-app-picker 3.70.0-next.52 → 3.70.0-next.54

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.
Files changed (80) hide show
  1. package/dist/cjs/DSAppPicker.js +6 -64
  2. package/dist/cjs/DSAppPicker.js.map +3 -3
  3. package/dist/cjs/DSAppPickerCTX.js +2 -22
  4. package/dist/cjs/DSAppPickerCTX.js.map +2 -2
  5. package/dist/cjs/config/useAppPicker.js +19 -5
  6. package/dist/cjs/config/useAppPicker.js.map +2 -2
  7. package/dist/cjs/config/useFocusTracker.js +24 -35
  8. package/dist/cjs/config/useFocusTracker.js.map +2 -2
  9. package/dist/cjs/constants/index.js +2 -0
  10. package/dist/cjs/constants/index.js.map +2 -2
  11. package/dist/cjs/parts/AppPanel.js +60 -43
  12. package/dist/cjs/parts/AppPanel.js.map +3 -3
  13. package/dist/cjs/parts/AppPickerFloatingContext/AppPickerContent.js +83 -0
  14. package/dist/cjs/parts/AppPickerFloatingContext/AppPickerContent.js.map +7 -0
  15. package/dist/cjs/parts/AppPickerFloatingContext/useAppPickerFloatingContext.js +171 -0
  16. package/dist/cjs/parts/AppPickerFloatingContext/useAppPickerFloatingContext.js.map +7 -0
  17. package/dist/cjs/parts/AppPickerItem.js +6 -10
  18. package/dist/cjs/parts/AppPickerItem.js.map +2 -2
  19. package/dist/cjs/parts/AppSection.js +2 -0
  20. package/dist/cjs/parts/AppSection.js.map +2 -2
  21. package/dist/cjs/parts/Trigger.js +14 -8
  22. package/dist/cjs/parts/Trigger.js.map +2 -2
  23. package/dist/cjs/parts/style.js +1 -7
  24. package/dist/cjs/parts/style.js.map +2 -2
  25. package/dist/cjs/react-desc-prop-types.js +6 -1
  26. package/dist/cjs/react-desc-prop-types.js.map +2 -2
  27. package/dist/cjs/util/getChipId.js +36 -0
  28. package/dist/cjs/util/getChipId.js.map +7 -0
  29. package/dist/cjs/util/getChipRegionId.js +37 -0
  30. package/dist/cjs/util/getChipRegionId.js.map +7 -0
  31. package/dist/esm/DSAppPicker.js +7 -65
  32. package/dist/esm/DSAppPicker.js.map +3 -3
  33. package/dist/esm/DSAppPickerCTX.js +2 -22
  34. package/dist/esm/DSAppPickerCTX.js.map +2 -2
  35. package/dist/esm/config/useAppPicker.js +22 -8
  36. package/dist/esm/config/useAppPicker.js.map +2 -2
  37. package/dist/esm/config/useFocusTracker.js +23 -34
  38. package/dist/esm/config/useFocusTracker.js.map +2 -2
  39. package/dist/esm/constants/index.js +2 -0
  40. package/dist/esm/constants/index.js.map +2 -2
  41. package/dist/esm/parts/AppPanel.js +61 -44
  42. package/dist/esm/parts/AppPanel.js.map +3 -3
  43. package/dist/esm/parts/AppPickerFloatingContext/AppPickerContent.js +53 -0
  44. package/dist/esm/parts/AppPickerFloatingContext/AppPickerContent.js.map +7 -0
  45. package/dist/esm/parts/AppPickerFloatingContext/useAppPickerFloatingContext.js +141 -0
  46. package/dist/esm/parts/AppPickerFloatingContext/useAppPickerFloatingContext.js.map +7 -0
  47. package/dist/esm/parts/AppPickerItem.js +5 -9
  48. package/dist/esm/parts/AppPickerItem.js.map +2 -2
  49. package/dist/esm/parts/AppSection.js +2 -0
  50. package/dist/esm/parts/AppSection.js.map +2 -2
  51. package/dist/esm/parts/Trigger.js +15 -9
  52. package/dist/esm/parts/Trigger.js.map +2 -2
  53. package/dist/esm/parts/style.js +1 -7
  54. package/dist/esm/parts/style.js.map +2 -2
  55. package/dist/esm/react-desc-prop-types.js +6 -1
  56. package/dist/esm/react-desc-prop-types.js.map +2 -2
  57. package/dist/esm/util/getChipId.js +6 -0
  58. package/dist/esm/util/getChipId.js.map +7 -0
  59. package/dist/esm/util/getChipRegionId.js +7 -0
  60. package/dist/esm/util/getChipRegionId.js.map +7 -0
  61. package/dist/types/DSAppPicker.d.ts +1 -1
  62. package/dist/types/DSAppPickerCTX.d.ts +6 -17
  63. package/dist/types/config/useAppPicker.d.ts +109 -91
  64. package/dist/types/config/useFocusTracker.d.ts +10 -6
  65. package/dist/types/constants/index.d.ts +1 -0
  66. package/dist/types/parts/AppPanel.d.ts +1 -8
  67. package/dist/types/parts/AppPickerFloatingContext/AppPickerContent.d.ts +3 -0
  68. package/dist/types/parts/AppPickerFloatingContext/useAppPickerFloatingContext.d.ts +170 -0
  69. package/dist/types/parts/AppPickerItem.d.ts +1 -0
  70. package/dist/types/parts/Trigger.d.ts +10 -14
  71. package/dist/types/parts/style.d.ts +0 -1
  72. package/dist/types/react-desc-prop-types.d.ts +31 -1
  73. package/dist/types/util/getChipId.d.ts +2 -0
  74. package/dist/types/util/getChipRegionId.d.ts +1 -0
  75. package/package.json +13 -14
  76. package/dist/cjs/config/useAppPickerBehavior.js +0 -156
  77. package/dist/cjs/config/useAppPickerBehavior.js.map +0 -7
  78. package/dist/esm/config/useAppPickerBehavior.js +0 -126
  79. package/dist/esm/config/useAppPickerBehavior.js.map +0 -7
  80. package/dist/types/config/useAppPickerBehavior.d.ts +0 -39
@@ -0,0 +1,83 @@
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 AppPickerContent_exports = {};
30
+ __export(AppPickerContent_exports, {
31
+ AppPickerContent: () => AppPickerContent
32
+ });
33
+ module.exports = __toCommonJS(AppPickerContent_exports);
34
+ var React = __toESM(require("react"));
35
+ var import_jsx_runtime = require("react/jsx-runtime");
36
+ var import_ds_floating_context = require("@elliemae/ds-floating-context");
37
+ var import_ds_system = require("@elliemae/ds-system");
38
+ var import_react = require("react");
39
+ var import_constants = require("../../constants/index.js");
40
+ var import_DSAppPickerCTX = require("../../DSAppPickerCTX.js");
41
+ var import_AppPanel = require("../AppPanel.js");
42
+ var import_Trigger = require("../Trigger.js");
43
+ var import_useAppPickerFloatingContext = require("./useAppPickerFloatingContext.js");
44
+ const StyledAppPickerFloating = (0, import_ds_system.styled)(import_ds_floating_context.FloatingWrapper, {
45
+ name: import_constants.DSAppPickerName,
46
+ slot: import_constants.DSAppPickerSlots.FLOATING_WRAPPER
47
+ })``;
48
+ const AppPickerContent = () => {
49
+ const {
50
+ ownerPropsConfig,
51
+ propsWithDefault,
52
+ focusTrackers,
53
+ wasOpenedByKeyboardRef,
54
+ resolvedIsOpen,
55
+ setInternalIsOpen
56
+ } = (0, import_react.useContext)(import_DSAppPickerCTX.DSAppPickerContext);
57
+ const { floatingStyles, arrowStyles, floatingContext, floatingInnerRef, handleTriggerRef, handleTriggerClick } = (0, import_useAppPickerFloatingContext.useAppPickerFloatingContext)({
58
+ propsWithDefault,
59
+ focusTrackers,
60
+ wasOpenedByKeyboardRef,
61
+ resolvedIsOpen,
62
+ setInternalIsOpen
63
+ });
64
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
65
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Trigger.Trigger, { handleTriggerRef, handleTriggerClick }),
66
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
67
+ StyledAppPickerFloating,
68
+ {
69
+ innerRef: floatingInnerRef,
70
+ isOpen: resolvedIsOpen,
71
+ floatingStyles,
72
+ context: floatingContext,
73
+ getOwnerProps: ownerPropsConfig.getOwnerProps,
74
+ getOwnerPropsArguments: ownerPropsConfig.getOwnerPropsArguments,
75
+ children: [
76
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_AppPanel.AppPanel, {}),
77
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_floating_context.PopoverArrow, { ...arrowStyles })
78
+ ]
79
+ }
80
+ )
81
+ ] });
82
+ };
83
+ //# sourceMappingURL=AppPickerContent.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/parts/AppPickerFloatingContext/AppPickerContent.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import { FloatingWrapper, PopoverArrow } from '@elliemae/ds-floating-context';\nimport { styled } from '@elliemae/ds-system';\nimport React, { useContext } from 'react';\nimport { DSAppPickerName, DSAppPickerSlots } from '../../constants/index.js';\nimport { DSAppPickerContext } from '../../DSAppPickerCTX.js';\nimport type { DSAppPickerT } from '../../react-desc-prop-types.js';\nimport { AppPanel } from '../AppPanel.js';\nimport { Trigger } from '../Trigger.js';\nimport { useAppPickerFloatingContext } from './useAppPickerFloatingContext.js';\n\nconst StyledAppPickerFloating = styled(FloatingWrapper, {\n name: DSAppPickerName,\n slot: DSAppPickerSlots.FLOATING_WRAPPER,\n})``;\n\nexport const AppPickerContent: React.ComponentType<DSAppPickerT.Props> = () => {\n const {\n ownerPropsConfig,\n propsWithDefault,\n focusTrackers,\n wasOpenedByKeyboardRef,\n resolvedIsOpen,\n setInternalIsOpen,\n } = useContext(DSAppPickerContext);\n const { floatingStyles, arrowStyles, floatingContext, floatingInnerRef, handleTriggerRef, handleTriggerClick } =\n useAppPickerFloatingContext({\n propsWithDefault,\n focusTrackers,\n wasOpenedByKeyboardRef,\n resolvedIsOpen,\n setInternalIsOpen,\n });\n return (\n <>\n <Trigger handleTriggerRef={handleTriggerRef} handleTriggerClick={handleTriggerClick} />\n <StyledAppPickerFloating\n innerRef={floatingInnerRef}\n isOpen={resolvedIsOpen}\n floatingStyles={floatingStyles}\n context={floatingContext}\n getOwnerProps={ownerPropsConfig.getOwnerProps}\n getOwnerPropsArguments={ownerPropsConfig.getOwnerPropsArguments}\n >\n <AppPanel />\n <PopoverArrow {...arrowStyles} />\n </StyledAppPickerFloating>\n </>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADiCnB;AAjCJ,iCAA8C;AAC9C,uBAAuB;AACvB,mBAAkC;AAClC,uBAAkD;AAClD,4BAAmC;AAEnC,sBAAyB;AACzB,qBAAwB;AACxB,yCAA4C;AAE5C,MAAM,8BAA0B,yBAAO,4CAAiB;AAAA,EACtD,MAAM;AAAA,EACN,MAAM,kCAAiB;AACzB,CAAC;AAEM,MAAM,mBAA4D,MAAM;AAC7E,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,QAAI,yBAAW,wCAAkB;AACjC,QAAM,EAAE,gBAAgB,aAAa,iBAAiB,kBAAkB,kBAAkB,mBAAmB,QAC3G,gEAA4B;AAAA,IAC1B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACH,SACE,4EACE;AAAA,gDAAC,0BAAQ,kBAAoC,oBAAwC;AAAA,IACrF;AAAA,MAAC;AAAA;AAAA,QACC,UAAU;AAAA,QACV,QAAQ;AAAA,QACR;AAAA,QACA,SAAS;AAAA,QACT,eAAe,iBAAiB;AAAA,QAChC,wBAAwB,iBAAiB;AAAA,QAEzC;AAAA,sDAAC,4BAAS;AAAA,UACV,4CAAC,2CAAc,GAAG,aAAa;AAAA;AAAA;AAAA,IACjC;AAAA,KACF;AAEJ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,171 @@
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 useAppPickerFloatingContext_exports = {};
30
+ __export(useAppPickerFloatingContext_exports, {
31
+ useAppPickerFloatingContext: () => useAppPickerFloatingContext
32
+ });
33
+ module.exports = __toCommonJS(useAppPickerFloatingContext_exports);
34
+ var React = __toESM(require("react"));
35
+ var import_ds_floating_context = require("@elliemae/ds-floating-context");
36
+ var import_react = require("react");
37
+ const useAppPickerFloatingContext = (appPickerConfig) => {
38
+ const { propsWithDefault, focusTrackers, wasOpenedByKeyboardRef, resolvedIsOpen, setInternalIsOpen } = appPickerConfig;
39
+ const { onOpen, onClose, actionRef, onClick, onClickOutside, onKeyDown, triggerRef, renderTrigger, isOpen } = propsWithDefault;
40
+ const triggerIsInternal = !renderTrigger;
41
+ const isControlled = typeof isOpen === "boolean";
42
+ const { trackFocusSelectedItem, trackFocusItemAtIndex, trackFocusPanel, trackFocusFirstItem } = focusTrackers;
43
+ const defaultTriggerRef = (0, import_react.useRef)(null);
44
+ const handleClickOutside = (0, import_react.useCallback)(
45
+ (e) => {
46
+ if (!isControlled) onClose?.({ reason: "click-outside", event: e });
47
+ setInternalIsOpen(false);
48
+ onClickOutside?.(e);
49
+ },
50
+ [isControlled, onClose, setInternalIsOpen, onClickOutside]
51
+ );
52
+ const handleScopedEscape = (0, import_react.useCallback)(
53
+ (event) => {
54
+ if (!isControlled) onClose?.({ reason: "escape", event });
55
+ setInternalIsOpen(false);
56
+ },
57
+ [isControlled, onClose, setInternalIsOpen]
58
+ );
59
+ const handleFloatingClose = (0, import_react.useCallback)(
60
+ (info) => {
61
+ if (info.reason === "controlled-flip" && isControlled) onClose?.({ reason: "controlled" });
62
+ },
63
+ [isControlled, onClose]
64
+ );
65
+ const handleFloatingOpen = (0, import_react.useCallback)(
66
+ (info) => {
67
+ if (wasOpenedByKeyboardRef.current && triggerIsInternal) trackFocusSelectedItem();
68
+ else if (triggerIsInternal) trackFocusPanel();
69
+ else trackFocusFirstItem();
70
+ if (info.reason === "controlled-flip" && isControlled) onOpen?.({ reason: "controlled" });
71
+ },
72
+ [
73
+ wasOpenedByKeyboardRef,
74
+ triggerIsInternal,
75
+ trackFocusSelectedItem,
76
+ trackFocusPanel,
77
+ trackFocusFirstItem,
78
+ isControlled,
79
+ onOpen
80
+ ]
81
+ );
82
+ const floatingContextConfig = (0, import_react.useMemo)(
83
+ () => ({
84
+ placement: "bottom",
85
+ // Arrow tip is ~6.1px above the panel top (arrowPlacementBase16 ≈ 17.5px, tip at 11.4px from box top).
86
+ // 4px spec gap → 4 + 6.1 ≈ 10px offset.
87
+ customOffset: [0, 10],
88
+ externallyControlledIsOpen: resolvedIsOpen,
89
+ withoutAnimation: true,
90
+ onClickOutside: handleClickOutside,
91
+ // closeOnEscape = !onKeyDown: with a consumer onKeyDown, useFloatingContext neither routes
92
+ // the Escape to onEscape (see handleScopedEscape) nor returns focus to the trigger — the
93
+ // consumer's onKeyDown owns the key entirely.
94
+ closeOnEscape: !onKeyDown,
95
+ onClose: handleFloatingClose,
96
+ onEscape: handleScopedEscape,
97
+ onOpen: handleFloatingOpen,
98
+ returnFocusToReference: true,
99
+ externalReferenceElement: triggerRef?.current || defaultTriggerRef.current
100
+ }),
101
+ [
102
+ handleClickOutside,
103
+ handleScopedEscape,
104
+ handleFloatingClose,
105
+ handleFloatingOpen,
106
+ onKeyDown,
107
+ resolvedIsOpen,
108
+ triggerRef
109
+ ]
110
+ );
111
+ const {
112
+ refs: floatingRefs,
113
+ floatingStyles,
114
+ arrowStyles,
115
+ context: floatingContext
116
+ } = (0, import_ds_floating_context.useFloatingContext)(floatingContextConfig);
117
+ const handleTriggerRef = (0, import_react.useCallback)(
118
+ (node) => {
119
+ defaultTriggerRef.current = node;
120
+ floatingRefs.setReference(node);
121
+ if (triggerRef) {
122
+ triggerRef.current = node;
123
+ }
124
+ },
125
+ [floatingRefs, triggerRef]
126
+ );
127
+ const handleActionRef = (0, import_react.useCallback)(
128
+ (node) => {
129
+ if (node && actionRef?.current) {
130
+ actionRef.current.focusToIndex = (index) => {
131
+ trackFocusItemAtIndex(index);
132
+ };
133
+ actionRef.current.focusWrapper = () => {
134
+ trackFocusPanel();
135
+ };
136
+ actionRef.current.focusSelectedOrFirstAvailable = () => {
137
+ trackFocusSelectedItem();
138
+ };
139
+ }
140
+ },
141
+ [actionRef, trackFocusItemAtIndex, trackFocusPanel, trackFocusSelectedItem]
142
+ );
143
+ const floatingInnerRef = (0, import_react.useCallback)(
144
+ (node) => {
145
+ floatingRefs.setFloating(node);
146
+ handleActionRef(node);
147
+ },
148
+ [floatingRefs.setFloating, handleActionRef]
149
+ );
150
+ const handleTriggerClick = (0, import_react.useCallback)(
151
+ (e) => {
152
+ wasOpenedByKeyboardRef.current = e.detail === 0;
153
+ onClick?.(e);
154
+ if (!isControlled) {
155
+ if (resolvedIsOpen) onClose?.({ reason: "trigger-toggle", event: e });
156
+ else onOpen?.({ reason: "trigger", event: e });
157
+ }
158
+ setInternalIsOpen((prev) => !prev);
159
+ },
160
+ [onClick, wasOpenedByKeyboardRef, setInternalIsOpen, isControlled, resolvedIsOpen, onClose, onOpen]
161
+ );
162
+ return {
163
+ floatingStyles,
164
+ arrowStyles,
165
+ floatingContext,
166
+ handleTriggerRef,
167
+ handleTriggerClick,
168
+ floatingInnerRef
169
+ };
170
+ };
171
+ //# sourceMappingURL=useAppPickerFloatingContext.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/parts/AppPickerFloatingContext/useAppPickerFloatingContext.ts", "../../../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import { useFloatingContext, type DSHookFloatingContextT } from '@elliemae/ds-floating-context';\nimport type React from 'react';\nimport { useCallback, useMemo, useRef } from 'react';\nimport type { useAppPicker } from '../../config/useAppPicker.js';\nimport type { DSAppPickerT } from '../../react-desc-prop-types.js';\n\n/**\n * useAppPickerFloatingContext \u2014 the single point that wires DSAppPicker to\n * `@elliemae/ds-floating-context`'s `useFloatingContext`.\n *\n * WHAT IT DOES (as a black box):\n * AppPicker can be used in two very different ways:\n * - Controlled: the consumer supplies `isOpen` and drives the open/close transition.\n * \u2514\u2192 AppPicker can't be event-based as the flip might originate from any cause and we don't own the business logic\n * \u2514\u2192 we need to ensure WCAG embedded behaviours (focus, Escape, click-outside) are wired to the consumer's `isOpen` flip.\n * - Uncontrolled: the consumer does not supply `isOpen` and AppPicker owns the full flows, we only notify the consumer of the transition and its cause.\n *\n * The AppPicker and this file in particular serves as the one place that coordinates the two different ways to use the component and wires with the useFloatingContext hook.\n * This files owns:\n * - Focus management relative to open/close transitions (initial focus on open, return focus to trigger on close)\n * - Escape key handling (scoped to the panel and trigger)\n * - Click-outside handling (panel and trigger)\n * - Imperative focus API via actionRef\n * - Controlled/Uncontrolled forks and differences in event notification (eager vs controlled-flip)\n * - OnOpen and OnClose notification to the consumer with the correct reason and event (if any)\n *\n * IMPORTANT:\n * Parts of the flow/logic required in this file is offloaded to useFloatingContext internal assumptions and logics.\n * Changes to useFloatingContext may break the flows in this file, or alter them in ways that are not obvious, the two are closely coupled.\n *\n * DATA / EVENT FLOW\n *\n * Two concerns run in parallel and must not be conflated: (A) what makes the panel show/hide and take\n * focus, and (B) how the consumer is told it opened/closed. They have different origins.\n *\n * (A) PANEL VISIBILITY + FOCUS \u2014 useFloatingContext internal co-ownership of the flow.\n *\n * a user action \u2502 \u2502 isOpen prop flip\n * (trigger click / scoped Escape / click outside) \u2502 \u2502 (not a traceable user action, but the consumer's own flip)\n * uncontrolled - flips the internal flag \u2502 \u2502 controlled - AppPicker's own flip is inert, consumer drives it\n * \u2502\n * \u25BC\n * resolvedIsOpen changes\n * \u2502\n * \u25BC\n * useFloatingContext (externallyControlledIsOpen) detects the transition\n * \u2502\n * \u25BC\n * on open \u2502 \u2502 on close\n * handleFloatingOpen \u2502 \u2502 focus is only restored after a SCOPED ESCAPE:\n * AppPicker business logic seeds initial focus \u2502 \u2502 useFloatingContext returns focus to the trigger\n * \u2502 \u2502 (returnFocusToReference). Click-outside / toggle\n * \u2502 \u2502 / controlled closes do NOT move focus, and\n * \u2502 \u2502 handleFloatingClose only NOTIFIES (see (B)).\n * \u2502\n * \u25BC\n * \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n * \u2502 visibility + focus are delivered to final user as expected \u2502\n * \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n *\n * (B) CONSUMER NOTIFICATION\n * Each flow below is the UNCONTROLLED path, where AppPicker owns the transition and can name the true cause.\n * The controlled equivalent for every trigger is stated once at the end.\n * \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n * \u2502 OPENING TRIGGERS FLOWS \u2502\n * \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n * TRIGGER CLICK (uncontrolled)\n * trigger click\n * user clicks the internal trigger, panel closed\n * \u2502\n * \u25BC\n * handleTriggerClick\n * ( flips the flag and wires the visual and focus Flow (A) above )\n * \u2502\n * \u25BC\n * \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n * \u2502 onOpen { reason: 'trigger', event } \u2502 fired EAGERLY, when the event is triggered\n * \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n * ------------------------------------------------------------------------------------------------------------------------\n * \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n * \u2502 CLOSING TRIGGERS FLOWS \u2502\n * \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n * KEYBOARD ESCAPE (uncontrolled)\n * Escape within the panel DOM tree or the trigger\n * scoped Escape (routed only while closeOnEscape, i.e. no consumer onKeyDown)\n * \u2502\n * \u25BC\n * onEscape \u2192 handleScopedEscape\n * ( flips the flag and wires the visual and focus Flow (A) above )\n * \u2502\n * \u25BC\n * \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n * \u2502 onClose { reason: 'escape', event } \u2502 fired EAGERLY, when the event is triggered\n * \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n *\n * CLICK OUTSIDE (uncontrolled)\n * Click outside the panel DOM tree and the trigger\n * useFloatingContext detects a pointer press outside the panel + trigger\n * \u2502\n * \u25BC\n * handleClickOutside\n * ( flips the flag and wires the visual and focus Flow (A) above )\n * \u2502\n * \u25BC\n * \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n * \u2502 onClose { reason: 'click-outside', event } \u2502 fired EAGERLY, when the event is triggered\n * \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n *\n * CLICK ON TRIGGER (uncontrolled, while internal state is open)\n * trigger click while open\n * user clicks the internal trigger, panel open\n * \u2502\n * \u25BC\n * handleTriggerClick\n * ( flips the flag and wires the visual and focus Flow (A) above )\n * \u2502\n * \u25BC\n * \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n * \u2502 onClose { reason: 'trigger-toggle', event } \u2502 fired EAGERLY, when the event is triggered\n * \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n * ------------------------------------------------------------------------------------------------------------------------\n * \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n * \u2502 CONTROLLED OPEN & CLOSE FLOWS \u2502\n * \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n * AppPicker's own flip is inert;\n * We can't fire EAGERLY and we can't track an originating event, there may be NONE\n * The consumer's `isOpen` flip is reacted to by useFloatingContext, which fires onOpen / onClose with reason 'controlled-flip'\n * We wire the visual and focus Flow (A) above, and then notify the consumer with reason 'controlled' (no event)\n * \u2502\n * \u25BC\n * \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n * \u2502 onOpen { reason: 'controlled' } \u2502 no event\n * \u2502 onClose { reason: 'controlled' } \u2502 a prop flip is not a traceable user action\n * \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n * ------------------------------------------------------------------------------------------------------------------------\n *\n * Eager (uncontrolled) and controlled-flip paths are mutually exclusive on `isControlled`.\n * the consumer is notified exactly once per transition \u2014 never twice.\n * On Escape specifically\n * a controlled consumer supplies onKeyDown, so closeOnEscape is false in useFloatingContext\n * \u2514\u2192 AppPicker's onEscape never runs \u2014\n * \u2514\u2192 the close arrives purely by listening to the flag transition\n * ------------------------------------------------------------------------------------------------------------------------\n * A nuance for an edge case:\n *\n * Declarative mount-open (rendered already-open).\n * useFloatingContext fires no onOpen for it (it did not transition to open, it started open),\n * \u2514\u2192 neither the focus-seed (A) nor the notification (B) runs\n * AppPanel compensates this locally via useMountedOpenAutofocusNuance, it needs to be seen if this is even desired or should be removed\n * ------------------------------------------------------------------------------------------------------------------------\n */\n\ntype ConfiguredAppPickerCtx = ReturnType<typeof useAppPicker>;\n\ntype AppPickerFloatingContextConfig = {\n propsWithDefault: DSAppPickerT.InternalProps;\n focusTrackers: ConfiguredAppPickerCtx['focusTrackers'];\n wasOpenedByKeyboardRef: ConfiguredAppPickerCtx['wasOpenedByKeyboardRef'];\n // Open state is owned by useAppPicker (lifted so useFocusTracker can seed focus in the same fiber).\n // This hook reads the resolved value for positioning and flips it through the setter to close/toggle.\n resolvedIsOpen: ConfiguredAppPickerCtx['resolvedIsOpen'];\n setInternalIsOpen: ConfiguredAppPickerCtx['setInternalIsOpen'];\n};\n\nexport const useAppPickerFloatingContext = (appPickerConfig: AppPickerFloatingContextConfig) => {\n const { propsWithDefault, focusTrackers, wasOpenedByKeyboardRef, resolvedIsOpen, setInternalIsOpen } =\n appPickerConfig;\n const { onOpen, onClose, actionRef, onClick, onClickOutside, onKeyDown, triggerRef, renderTrigger, isOpen } =\n propsWithDefault;\n const triggerIsInternal = !renderTrigger;\n // Controlled when the consumer supplies `isOpen`. This decides who owns a transition: uncontrolled,\n // AppPicker's own handlers own it and report the specific event-carrying reason eagerly; controlled,\n // AppPicker's own flips are inert and the consumer drives open/close via the prop (reason 'controlled').\n const isControlled = typeof isOpen === 'boolean';\n\n const { trackFocusSelectedItem, trackFocusItemAtIndex, trackFocusPanel, trackFocusFirstItem } = focusTrackers;\n\n const defaultTriggerRef = useRef<HTMLButtonElement>(null);\n\n // Uncontrolled close \u2014 see file header (B) \"CLICK OUTSIDE\". Also forwards the raw event to onClickOutside.\n const handleClickOutside = useCallback(\n (e: MouseEvent | TouchEvent) => {\n if (!isControlled) onClose?.({ reason: 'click-outside', event: e });\n setInternalIsOpen(false);\n onClickOutside?.(e as MouseEvent);\n },\n [isControlled, onClose, setInternalIsOpen, onClickOutside],\n );\n\n // onEscape target \u2014 see file header (B) \"KEYBOARD ESCAPE\". Scoped Escape only; gated by closeOnEscape\n // (`!onKeyDown`, see the config below).\n const handleScopedEscape = useCallback(\n (event: KeyboardEvent) => {\n if (!isControlled) onClose?.({ reason: 'escape', event });\n setInternalIsOpen(false);\n },\n [isControlled, onClose, setInternalIsOpen],\n );\n\n // Controlled close notify \u2014 see file header \"CONTROLLED OPEN & CLOSE FLOWS\". The guard also filters\n // out a non-scoped Escape, which reaches here as reason 'interaction' (not 'controlled-flip').\n const handleFloatingClose = useCallback(\n (info: DSHookFloatingContextT.OpenChange) => {\n if (info.reason === 'controlled-flip' && isControlled) onClose?.({ reason: 'controlled' });\n },\n [isControlled, onClose],\n );\n\n // Open transition \u2014 see file header (A) (focus) + \"CONTROLLED OPEN & CLOSE FLOWS\" (notify). Seeds\n // initial focus (targets per the CONSUMER CONFIGURATION table) and, when controlled, notifies the\n // consumer. Mount-open is not a transition, so this never fires for it (AppPanel's\n // useMountedOpenAutofocusNuance handles that one case).\n const handleFloatingOpen = useCallback(\n (info: DSHookFloatingContextT.OpenChange) => {\n if (wasOpenedByKeyboardRef.current && triggerIsInternal) trackFocusSelectedItem();\n else if (triggerIsInternal) trackFocusPanel();\n else trackFocusFirstItem();\n if (info.reason === 'controlled-flip' && isControlled) onOpen?.({ reason: 'controlled' });\n },\n [\n wasOpenedByKeyboardRef,\n triggerIsInternal,\n trackFocusSelectedItem,\n trackFocusPanel,\n trackFocusFirstItem,\n isControlled,\n onOpen,\n ],\n );\n\n const floatingContextConfig = useMemo(\n () =>\n ({\n placement: 'bottom',\n // Arrow tip is ~6.1px above the panel top (arrowPlacementBase16 \u2248 17.5px, tip at 11.4px from box top).\n // 4px spec gap \u2192 4 + 6.1 \u2248 10px offset.\n customOffset: [0, 10],\n externallyControlledIsOpen: resolvedIsOpen,\n withoutAnimation: true,\n onClickOutside: handleClickOutside,\n // closeOnEscape = !onKeyDown: with a consumer onKeyDown, useFloatingContext neither routes\n // the Escape to onEscape (see handleScopedEscape) nor returns focus to the trigger \u2014 the\n // consumer's onKeyDown owns the key entirely.\n closeOnEscape: !onKeyDown,\n onClose: handleFloatingClose,\n onEscape: handleScopedEscape,\n onOpen: handleFloatingOpen,\n returnFocusToReference: true,\n externalReferenceElement: triggerRef?.current || defaultTriggerRef.current,\n }) as DSHookFloatingContextT.Props,\n [\n handleClickOutside,\n handleScopedEscape,\n handleFloatingClose,\n handleFloatingOpen,\n onKeyDown,\n resolvedIsOpen,\n triggerRef,\n ],\n );\n\n const {\n refs: floatingRefs,\n floatingStyles,\n arrowStyles,\n context: floatingContext,\n } = useFloatingContext(floatingContextConfig);\n\n const handleTriggerRef = useCallback<React.RefCallback<HTMLButtonElement>>(\n (node) => {\n (defaultTriggerRef as React.MutableRefObject<HTMLButtonElement | null>).current = node;\n floatingRefs.setReference(node);\n if (triggerRef) {\n (triggerRef as React.MutableRefObject<HTMLButtonElement | null>).current = node;\n }\n },\n [floatingRefs, triggerRef],\n );\n\n // Populates the consumer's actionRef with imperative focus methods. Fires on mount with the panel\n // node. Every method routes through the focus tracker \u2014 no DOM queries.\n const handleActionRef = useCallback<React.RefCallback<HTMLDivElement>>(\n (node) => {\n if (node && actionRef?.current) {\n actionRef.current.focusToIndex = (index: number) => {\n trackFocusItemAtIndex(index);\n };\n actionRef.current.focusWrapper = () => {\n trackFocusPanel();\n };\n actionRef.current.focusSelectedOrFirstAvailable = () => {\n trackFocusSelectedItem();\n };\n }\n },\n [actionRef, trackFocusItemAtIndex, trackFocusPanel, trackFocusSelectedItem],\n );\n\n const floatingInnerRef = useCallback<React.RefCallback<HTMLDivElement>>(\n (node) => {\n (floatingRefs.setFloating as React.RefCallback<HTMLDivElement>)(node);\n handleActionRef(node);\n },\n [floatingRefs.setFloating, handleActionRef],\n );\n\n const handleTriggerClick = useCallback(\n (e: React.MouseEvent | React.KeyboardEvent) => {\n // detail === 0 \u21D2 keyboard activation (Enter/Space), not a pointer. handleFloatingOpen reads\n // this on the next open transition to pick keyboard-vs-pointer initial focus.\n wasOpenedByKeyboardRef.current = (e as React.MouseEvent).detail === 0;\n onClick?.(e);\n // Uncontrolled eager notify \u2014 see file header (B) \"TRIGGER CLICK\" / \"CLICK ON TRIGGER\".\n // `resolvedIsOpen` is the pre-flip value: open \u21D2 this click closes (trigger-toggle), else opens.\n if (!isControlled) {\n if (resolvedIsOpen) onClose?.({ reason: 'trigger-toggle', event: e });\n else onOpen?.({ reason: 'trigger', event: e });\n }\n setInternalIsOpen((prev) => !prev);\n },\n [onClick, wasOpenedByKeyboardRef, setInternalIsOpen, isControlled, resolvedIsOpen, onClose, onOpen],\n );\n\n return {\n floatingStyles,\n arrowStyles,\n floatingContext,\n handleTriggerRef,\n handleTriggerClick,\n floatingInnerRef,\n };\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,iCAAgE;AAEhE,mBAA6C;AAkKtC,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,CAAC,aAAa,aAAa,eAAe;AAAA,EAC5C;AAEA,QAAM,yBAAqB;AAAA,IACzB,CAAC,MAA8C;AAG7C,6BAAuB,UAAW,EAAuB,WAAW;AACpE,gBAAU,CAAC;AAGX,UAAI,CAAC,cAAc;AACjB,YAAI,eAAgB,WAAU,EAAE,QAAQ,kBAAkB,OAAO,EAAE,CAAC;AAAA,YAC/D,UAAS,EAAE,QAAQ,WAAW,OAAO,EAAE,CAAC;AAAA,MAC/C;AACA,wBAAkB,CAAC,SAAS,CAAC,IAAI;AAAA,IACnC;AAAA,IACA,CAAC,SAAS,wBAAwB,mBAAmB,cAAc,gBAAgB,SAAS,MAAM;AAAA,EACpG;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
6
+ "names": []
7
+ }
@@ -34,25 +34,21 @@ module.exports = __toCommonJS(AppPickerItem_exports);
34
34
  var React = __toESM(require("react"));
35
35
  var import_jsx_runtime = require("react/jsx-runtime");
36
36
  var import_react = __toESM(require("react"));
37
- var import_uid = require("uid");
38
37
  var import_ds_system = require("@elliemae/ds-system");
39
38
  var import_ds_chip = require("@elliemae/ds-chip");
40
39
  var import_constants = require("../constants/index.js");
41
40
  var import_style = require("./style.js");
42
41
  var import_DSAppPickerCTX = require("../DSAppPickerCTX.js");
43
- var import_useFocusTracker = require("../config/useFocusTracker.js");
42
+ var import_getChipRegionId = require("../util/getChipRegionId.js");
44
43
  const StyledChip = (0, import_ds_system.styled)(import_ds_chip.DSChip, { name: import_constants.DSAppPickerName, slot: import_constants.DSAppPickerSlots.CHIP })``;
45
44
  const AppIcon = ({ icon: Icon }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { className: "app-picker__icon", size: "m" });
46
45
  const AppPickerItem = import_react.default.memo(
47
- ({ app, positionLabel, ownerProps, onClick, isFirstFocusable, isLastFocusable }) => {
46
+ ({ app, chipId, positionLabel, ownerProps, onClick, isFirstFocusable, isLastFocusable }) => {
48
47
  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]);
48
+ const {
49
+ focusTrackers: { focusRegion, firstFocusableRef, lastFocusableRef, trackFocusChip, trackFocusRegionReset }
50
+ } = (0, import_react.useContext)(import_DSAppPickerCTX.DSAppPickerContext);
51
+ const isFocused = focusRegion === (0, import_getChipRegionId.getChipRegionId)(chipId);
56
52
  const getOwnerPropsArguments = import_react.default.useCallback(() => app, [app]);
57
53
  const renderIcon = import_react.default.useCallback(() => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AppIcon, { icon }), [icon]);
58
54
  const handleClick = import_react.default.useCallback((e) => onClick(e, app), [app, onClick]);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
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,UAAkC,CAAC,EAAE,MAAM,KAAK,MAAM,4CAAC,QAAK,WAAU,oBAAmB,MAAK,KAAI;AAWjG,MAAM,gBAA8C,aAAAA,QAAM;AAAA,EAC/D,CAAC,EAAE,KAAK,eAAe,YAAY,SAAS,kBAAkB,gBAAgB,MAAM;AAClF,UAAM,EAAE,OAAO,UAAU,mBAAmB,UAAU,MAAM,IAAI,SAAS,IAAI;AAC7E,UAAM,EAAE,aAAa,mBAAmB,kBAAkB,cAAc,gBAAgB,sBAAsB,QAC5G,yBAAW,wCAAkB;AAE/B,UAAM,cAAc,aAAAA,QAAM,QAAQ,UAAM,gBAAI,CAAC,GAAG,CAAC,CAAC;AAClD,UAAM,SAAS,MAAM,GAAG,KAAK,IAAI,WAAW;AAC5C,UAAM,YAAY,oBAAgB,wCAAgB,MAAM;AAExD,iBAAAA,QAAM,UAAU,MAAM;AACpB,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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 '../util/getChipRegionId.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 // Chip identity assigned by the parent (AppSection, via getChipId) and read here \u2014 never\n // generated locally, so the focus tracker can address this chip without it reporting back up.\n chipId: string;\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, chipId, positionLabel, ownerProps, onClick, isFirstFocusable, isLastFocusable }) => {\n const { label, disabled, applyAriaDisabled, selected, icon, id, wrapText } = app;\n const {\n focusTrackers: { focusRegion, firstFocusableRef, lastFocusableRef, trackFocusChip, trackFocusRegionReset },\n } = useContext(DSAppPickerContext);\n\n const isFocused = focusRegion === getChipRegionId(chipId);\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;ADeqC;AAf5D,mBAAkC;AAClC,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,UAAkC,CAAC,EAAE,MAAM,KAAK,MAAM,4CAAC,QAAK,WAAU,oBAAmB,MAAK,KAAI;AAcjG,MAAM,gBAA8C,aAAAA,QAAM;AAAA,EAC/D,CAAC,EAAE,KAAK,QAAQ,eAAe,YAAY,SAAS,kBAAkB,gBAAgB,MAAM;AAC1F,UAAM,EAAE,OAAO,UAAU,mBAAmB,UAAU,MAAM,IAAI,SAAS,IAAI;AAC7E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AAc,cAAc;",
6
6
  "names": ["React"]
7
7
  }
@@ -36,6 +36,7 @@ var import_jsx_runtime = require("react/jsx-runtime");
36
36
  var import_style = require("./style.js");
37
37
  var import_constants = require("../constants/index.js");
38
38
  var import_AppPickerItem = require("./AppPickerItem.js");
39
+ var import_getChipId = require("../util/getChipId.js");
39
40
  const AppSection = ({
40
41
  items,
41
42
  title,
@@ -54,6 +55,7 @@ const AppSection = ({
54
55
  import_AppPickerItem.AppPickerItem,
55
56
  {
56
57
  app,
58
+ chipId: (0, import_getChipId.getChipId)(app, flatIndex),
57
59
  positionLabel: `${title} (${flatIndex + 1} of ${totalCount})`,
58
60
  ownerProps,
59
61
  onClick: onItemClick,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
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;",
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';\nimport { getChipId } from '../util/getChipId.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 chipId={getChipId(app, flatIndex)}\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;AD8BrB;AA7BF,mBAAmD;AACnD,uBAAuC;AAEvC,2BAA8B;AAC9B,uBAA0B;AAcnB,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,YAAQ,4BAAU,KAAK,SAAS;AAAA,QAChC,eAAe,GAAG,KAAK,KAAK,YAAY,CAAC,OAAO,UAAU;AAAA,QAC1D;AAAA,QACA,SAAS;AAAA,QACT,kBAAkB,cAAc;AAAA,QAChC,iBAAiB,cAAc;AAAA;AAAA,MAP1B,IAAI,MAAM,GAAG,IAAI,KAAK,IAAI,SAAS,GAAG,KAAK;AAAA,IAQlD;AAAA,EAEJ,CAAC;AAAA,GACH;AAGF,WAAW,cAAc;",
6
6
  "names": []
7
7
  }
@@ -35,13 +35,20 @@ var React = __toESM(require("react"));
35
35
  var import_jsx_runtime = require("react/jsx-runtime");
36
36
  var import_ds_button_v2 = require("@elliemae/ds-button-v2");
37
37
  var import_ds_system = require("@elliemae/ds-system");
38
+ var import_react = require("react");
38
39
  var import_constants = require("../constants/index.js");
40
+ var import_DSAppPickerCTX = require("../DSAppPickerCTX.js");
39
41
  const StyledButton = (0, import_ds_system.styled)(import_ds_button_v2.DSButtonV3, { name: import_constants.DSAppPickerName, slot: import_constants.DSAppPickerSlots.BUTTON })`
40
42
  height: fit-content;
41
43
  `;
42
- const Trigger = ({ Icon, isOpen, setRef, ownerProps, onClick, renderTrigger }) => {
44
+ const Trigger = (PropsFromFloatingContext) => {
45
+ const { handleTriggerRef, handleTriggerClick } = PropsFromFloatingContext;
46
+ const {
47
+ propsWithDefault: { icon: Icon, renderTrigger },
48
+ ownerPropsConfig
49
+ } = (0, import_react.useContext)(import_DSAppPickerCTX.DSAppPickerContext);
43
50
  if (renderTrigger) {
44
- return renderTrigger({ ref: setRef });
51
+ return renderTrigger({ ref: handleTriggerRef });
45
52
  }
46
53
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
47
54
  StyledButton,
@@ -49,13 +56,12 @@ const Trigger = ({ Icon, isOpen, setRef, ownerProps, onClick, renderTrigger }) =
49
56
  "data-testid": import_constants.DSAppPickerDataTestIds.BUTTON,
50
57
  id: "app-picker__button",
51
58
  buttonType: "icon",
52
- "aria-haspopup": "true",
53
- "aria-expanded": isOpen,
59
+ "aria-haspopup": "dialog",
54
60
  "aria-label": "Application picker",
55
- innerRef: setRef,
56
- onClick,
57
- getOwnerProps: ownerProps.getOwnerProps,
58
- getOwnerPropsArguments: ownerProps.getOwnerPropsArguments,
61
+ innerRef: handleTriggerRef,
62
+ onClick: handleTriggerClick,
63
+ getOwnerProps: ownerPropsConfig.getOwnerProps,
64
+ getOwnerPropsArguments: ownerPropsConfig.getOwnerPropsArguments,
59
65
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, {})
60
66
  }
61
67
  );
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/parts/Trigger.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import React from 'react';\nimport { DSButtonV3 } from '@elliemae/ds-button-v2';\nimport { styled } from '@elliemae/ds-system';\nimport type { DSAppPickerT } from '../react-desc-prop-types.js';\nimport { DSAppPickerName, DSAppPickerSlots, DSAppPickerDataTestIds } from '../constants/index.js';\n\n// DSButtonV3 sizes itself with `min-height` (height stays `auto`) so multi-line labels can grow.\n// As a side effect, when the trigger is a direct grid/flex child of a consumer layout with the\n// default `align-items: stretch`, it stretches to fill the container height (PUI-18354 regression:\n// the legacy DSButtonV2 trigger used a fixed `height` and did not stretch). `height: fit-content`\n// pins the trigger to its intrinsic size \u2014 mirroring the button's own `width: fit-content` \u2014 so it\n// stays ~28px regardless of layout context.\n// DSButtonV3 sizes itself with `min-height` (height stays `auto`) so multi-line labels can grow.\n// As a side effect, when the trigger is a direct grid/flex child of a consumer layout with the\n// default `align-items: stretch`, it stretches to fill the container height (PUI-18354 regression:\n// the legacy DSButtonV2 trigger used a fixed `height` and did not stretch). `height: fit-content`\n// pins the trigger to its intrinsic size \u2014 mirroring the button's own `width: fit-content` \u2014 so it\n// stays ~28px regardless of layout context.\nconst StyledButton = styled(DSButtonV3, { name: DSAppPickerName, slot: DSAppPickerSlots.BUTTON })`\n height: fit-content;\n`;\n\ninterface TriggerProps {\n Icon: DSAppPickerT.InternalProps['icon'];\n isOpen: boolean;\n setRef: React.RefCallback<HTMLButtonElement>;\n ownerProps: { getOwnerProps: () => object; getOwnerPropsArguments: () => object };\n onClick: (e: React.MouseEvent | React.KeyboardEvent) => void;\n renderTrigger?: DSAppPickerT.OptionalProps['renderTrigger'];\n}\n\nexport const Trigger: React.FC<TriggerProps> = ({ Icon, isOpen, setRef, ownerProps, onClick, renderTrigger }) => {\n if (renderTrigger) {\n // Plain function call (not React element) preserves the legacy DSPopover render-prop contract:\n // consumers receive `ref` as a regular prop, no forwardRef required.\n return renderTrigger({ ref: setRef });\n }\n return (\n <StyledButton\n data-testid={DSAppPickerDataTestIds.BUTTON}\n id=\"app-picker__button\"\n buttonType=\"icon\"\n aria-haspopup=\"true\"\n aria-expanded={isOpen}\n aria-label=\"Application picker\"\n innerRef={setRef}\n onClick={onClick}\n getOwnerProps={ownerProps.getOwnerProps}\n getOwnerPropsArguments={ownerProps.getOwnerPropsArguments}\n >\n <Icon />\n </StyledButton>\n );\n};\n\nTrigger.displayName = 'DSAppPicker.Trigger';\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADkDjB;AAjDN,0BAA2B;AAC3B,uBAAuB;AAEvB,uBAA0E;AAc1E,MAAM,mBAAe,yBAAO,gCAAY,EAAE,MAAM,kCAAiB,MAAM,kCAAiB,OAAO,CAAC;AAAA;AAAA;AAazF,MAAM,UAAkC,CAAC,EAAE,MAAM,QAAQ,QAAQ,YAAY,SAAS,cAAc,MAAM;AAC/G,MAAI,eAAe;AAGjB,WAAO,cAAc,EAAE,KAAK,OAAO,CAAC;AAAA,EACtC;AACA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAa,wCAAuB;AAAA,MACpC,IAAG;AAAA,MACH,YAAW;AAAA,MACX,iBAAc;AAAA,MACd,iBAAe;AAAA,MACf,cAAW;AAAA,MACX,UAAU;AAAA,MACV;AAAA,MACA,eAAe,WAAW;AAAA,MAC1B,wBAAwB,WAAW;AAAA,MAEnC,sDAAC,QAAK;AAAA;AAAA,EACR;AAEJ;AAEA,QAAQ,cAAc;",
4
+ "sourcesContent": ["import { DSButtonV3 } from '@elliemae/ds-button-v2';\nimport { styled } from '@elliemae/ds-system';\nimport React, { useContext } from 'react';\nimport { DSAppPickerDataTestIds, DSAppPickerName, DSAppPickerSlots } from '../constants/index.js';\nimport { DSAppPickerContext } from '../DSAppPickerCTX.js';\nimport type { useAppPickerFloatingContext } from './AppPickerFloatingContext/useAppPickerFloatingContext.js';\n\n// DSButtonV3 sizes itself with `min-height` (height stays `auto`) so multi-line labels can grow.\n// As a side effect, when the trigger is a direct grid/flex child of a consumer layout with the\n// default `align-items: stretch`, it stretches to fill the container height (PUI-18354 regression:\n// the legacy DSButtonV2 trigger used a fixed `height` and did not stretch). `height: fit-content`\n// pins the trigger to its intrinsic size \u2014 mirroring the button's own `width: fit-content` \u2014 so it\n// stays ~28px regardless of layout context.\nconst StyledButton = styled(DSButtonV3, { name: DSAppPickerName, slot: DSAppPickerSlots.BUTTON })`\n height: fit-content;\n`;\n\ntype UseAppPickerFloatingContextT = ReturnType<typeof useAppPickerFloatingContext>;\ntype FloatingContextDictatedProps = {\n handleTriggerRef: UseAppPickerFloatingContextT['handleTriggerRef'];\n handleTriggerClick: UseAppPickerFloatingContextT['handleTriggerClick'];\n};\n\nexport const Trigger = (PropsFromFloatingContext: FloatingContextDictatedProps) => {\n const { handleTriggerRef, handleTriggerClick } = PropsFromFloatingContext;\n const {\n propsWithDefault: { icon: Icon, renderTrigger },\n ownerPropsConfig,\n } = useContext(DSAppPickerContext);\n\n if (renderTrigger) {\n // Plain function call (not React element) preserves the legacy DSPopover render-prop contract:\n // consumers receive `ref` as a regular prop, no forwardRef required.\n return renderTrigger({ ref: handleTriggerRef });\n }\n return (\n <StyledButton\n data-testid={DSAppPickerDataTestIds.BUTTON}\n id=\"app-picker__button\"\n buttonType=\"icon\"\n aria-haspopup=\"dialog\"\n aria-label=\"Application picker\"\n innerRef={handleTriggerRef}\n onClick={handleTriggerClick}\n getOwnerProps={ownerPropsConfig.getOwnerProps}\n getOwnerPropsArguments={ownerPropsConfig.getOwnerPropsArguments}\n >\n <Icon />\n </StyledButton>\n );\n};\n\nTrigger.displayName = 'DSAppPicker.Trigger';\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD+CjB;AA/CN,0BAA2B;AAC3B,uBAAuB;AACvB,mBAAkC;AAClC,uBAA0E;AAC1E,4BAAmC;AASnC,MAAM,mBAAe,yBAAO,gCAAY,EAAE,MAAM,kCAAiB,MAAM,kCAAiB,OAAO,CAAC;AAAA;AAAA;AAUzF,MAAM,UAAU,CAAC,6BAA2D;AACjF,QAAM,EAAE,kBAAkB,mBAAmB,IAAI;AACjD,QAAM;AAAA,IACJ,kBAAkB,EAAE,MAAM,MAAM,cAAc;AAAA,IAC9C;AAAA,EACF,QAAI,yBAAW,wCAAkB;AAEjC,MAAI,eAAe;AAGjB,WAAO,cAAc,EAAE,KAAK,iBAAiB,CAAC;AAAA,EAChD;AACA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAa,wCAAuB;AAAA,MACpC,IAAG;AAAA,MACH,YAAW;AAAA,MACX,iBAAc;AAAA,MACd,cAAW;AAAA,MACX,UAAU;AAAA,MACV,SAAS;AAAA,MACT,eAAe,iBAAiB;AAAA,MAChC,wBAAwB,iBAAiB;AAAA,MAEzC,sDAAC,QAAK;AAAA;AAAA,EACR;AAEJ;AAEA,QAAQ,cAAc;",
6
6
  "names": []
7
7
  }
@@ -28,7 +28,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
  var style_exports = {};
30
30
  __export(style_exports, {
31
- StyledAppPickerFloating: () => StyledAppPickerFloating,
32
31
  StyledListItem: () => StyledListItem,
33
32
  StyledListItemFullRow: () => StyledListItemFullRow,
34
33
  StyledSeparator: () => StyledSeparator,
@@ -37,15 +36,10 @@ __export(style_exports, {
37
36
  });
38
37
  module.exports = __toCommonJS(style_exports);
39
38
  var React = __toESM(require("react"));
40
- var import_ds_system = require("@elliemae/ds-system");
41
39
  var import_ds_grid = require("@elliemae/ds-grid");
40
+ var import_ds_system = require("@elliemae/ds-system");
42
41
  var import_ds_typography = require("@elliemae/ds-typography");
43
- var import_ds_floating_context = require("@elliemae/ds-floating-context");
44
42
  var import_constants = require("../constants/index.js");
45
- const StyledAppPickerFloating = (0, import_ds_system.styled)(import_ds_floating_context.FloatingWrapper, {
46
- name: import_constants.DSAppPickerName,
47
- slot: import_constants.DSAppPickerSlots.FLOATING_WRAPPER
48
- })``;
49
43
  const StyledWrapper = (0, import_ds_system.styled)(import_ds_grid.Grid, { name: import_constants.DSAppPickerName, slot: import_constants.DSAppPickerSlots.ROOT })`
50
44
  background-color: ${({ theme }) => theme.colors.neutral["000"]};
51
45
  min-width: 308px;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/parts/style.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["/* eslint-disable @typescript-eslint/no-unsafe-assignment */\nimport { styled } from '@elliemae/ds-system';\nimport { Grid } from '@elliemae/ds-grid';\nimport { DSTypography } from '@elliemae/ds-typography';\nimport { FloatingWrapper } from '@elliemae/ds-floating-context';\nimport { DSAppPickerName, DSAppPickerSlots } from '../constants/index.js';\n\nexport const StyledAppPickerFloating = styled(FloatingWrapper, {\n name: DSAppPickerName,\n slot: DSAppPickerSlots.FLOATING_WRAPPER,\n})``;\n\nexport const StyledWrapper = styled(Grid, { name: DSAppPickerName, slot: DSAppPickerSlots.ROOT })`\n background-color: ${({ theme }) => theme.colors.neutral['000']};\n min-width: 308px;\n min-height: 110px;\n max-height: 449px;\n width: 308px;\n overflow-y: auto;\n overflow-x: hidden;\n /* Baseline 2024: reserve scrollbar gutter so the layout doesn't shift between overflow/no-overflow.\n Replaces a JS isOverflow detection effect that toggled right padding. */\n scrollbar-gutter: stable;\n margin: 0;\n padding: 0 0 8px 16px;\n &:focus {\n outline: none;\n }\n`;\n\nexport const StyledListItem = styled('li', { name: DSAppPickerName, slot: DSAppPickerSlots.ITEM })`\n list-style: none;\n`;\n\nexport const StyledListItemFullRow = styled('li', { name: DSAppPickerName, slot: DSAppPickerSlots.ROW })`\n list-style: none;\n grid-column: 1/4;\n`;\n\nexport const StyledTitle = styled(DSTypography, { name: DSAppPickerName, slot: DSAppPickerSlots.TITLE })`\n color: ${({ theme }) => theme.colors.neutral[700]};\n font-size: ${({ theme }) => theme.fontSizes.value[400]};\n font-weight: ${({ theme }) => theme.fontWeights.semibold};\n margin: 12px 0 8px 0;\n line-height: 1.385;\n text-transform: uppercase;\n text-align: center;\n`;\n\nexport const StyledSeparator = styled('hr', { name: DSAppPickerName, slot: DSAppPickerSlots.SEPARATOR })`\n border-top: 1px solid ${({ theme }) => theme.colors.neutral[300]};\n border-bottom: none;\n width: 100%;\n margin: 8px 0 0 0;\n`;\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;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ography } from '@elliemae/ds-typography';\nimport { DSAppPickerName, DSAppPickerSlots } from '../constants/index.js';\n\nexport const StyledWrapper = styled(Grid, { name: DSAppPickerName, slot: DSAppPickerSlots.ROOT })`\n background-color: ${({ theme }) => theme.colors.neutral['000']};\n min-width: 308px;\n min-height: 110px;\n max-height: 449px;\n width: 308px;\n overflow-y: auto;\n overflow-x: hidden;\n /* Baseline 2024: reserve scrollbar gutter so the layout doesn't shift between overflow/no-overflow.\n Replaces a JS isOverflow detection effect that toggled right padding. */\n scrollbar-gutter: stable;\n margin: 0;\n padding: 0 0 8px 16px;\n &:focus {\n outline: none;\n }\n`;\n\nexport const StyledListItem = styled('li', { name: DSAppPickerName, slot: DSAppPickerSlots.ITEM })`\n list-style: none;\n`;\n\nexport const StyledListItemFullRow = styled('li', { name: DSAppPickerName, slot: DSAppPickerSlots.ROW })`\n list-style: none;\n grid-column: 1/4;\n`;\n\nexport const StyledTitle = styled(DSTypography, { name: DSAppPickerName, slot: DSAppPickerSlots.TITLE })`\n color: ${({ theme }) => theme.colors.neutral[700]};\n font-size: ${({ theme }) => theme.fontSizes.value[400]};\n font-weight: ${({ theme }) => theme.fontWeights.semibold};\n margin: 12px 0 8px 0;\n line-height: 1.385;\n text-transform: uppercase;\n text-align: center;\n`;\n\nexport const StyledSeparator = styled('hr', { name: DSAppPickerName, slot: DSAppPickerSlots.SEPARATOR })`\n border-top: 1px solid ${({ theme }) => theme.colors.neutral[300]};\n border-bottom: none;\n width: 100%;\n margin: 8px 0 0 0;\n`;\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,qBAAqB;AACrB,uBAAuB;AACvB,2BAA6B;AAC7B,uBAAkD;AAE3C,MAAM,oBAAgB,yBAAO,qBAAM,EAAE,MAAM,kCAAiB,MAAM,kCAAiB,KAAK,CAAC;AAAA,sBAC1E,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,QAAQ,KAAK,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBzD,MAAM,qBAAiB,yBAAO,MAAM,EAAE,MAAM,kCAAiB,MAAM,kCAAiB,KAAK,CAAC;AAAA;AAAA;AAI1F,MAAM,4BAAwB,yBAAO,MAAM,EAAE,MAAM,kCAAiB,MAAM,kCAAiB,IAAI,CAAC;AAAA;AAAA;AAAA;AAKhG,MAAM,kBAAc,yBAAO,mCAAc,EAAE,MAAM,kCAAiB,MAAM,kCAAiB,MAAM,CAAC;AAAA,WAC5F,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,QAAQ,GAAG,CAAC;AAAA,eACpC,CAAC,EAAE,MAAM,MAAM,MAAM,UAAU,MAAM,GAAG,CAAC;AAAA,iBACvC,CAAC,EAAE,MAAM,MAAM,MAAM,YAAY,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAOnD,MAAM,sBAAkB,yBAAO,MAAM,EAAE,MAAM,kCAAiB,MAAM,kCAAiB,UAAU,CAAC;AAAA,0BAC7E,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,QAAQ,GAAG,CAAC;AAAA;AAAA;AAAA;AAAA;",
6
6
  "names": []
7
7
  }
@@ -59,7 +59,12 @@ const DSAppPickerPropTypes = {
59
59
  "Ref containing a focusToIndex method. This method allows you to focus any App inside the AppPicker."
60
60
  ),
61
61
  isOpen: import_ds_props_helpers.PropTypes.bool.description("Wether the AppPicker should be open or not."),
62
- onClose: import_ds_props_helpers.PropTypes.func.description("Callback function when the AppPicker closes"),
62
+ onOpen: import_ds_props_helpers.PropTypes.func.description(
63
+ 'Callback when the AppPicker opens; receives { reason: "trigger" | "controlled", event? }.'
64
+ ),
65
+ onClose: import_ds_props_helpers.PropTypes.func.description(
66
+ 'Callback when the AppPicker closes; receives { reason: "escape" | "click-outside" | "trigger-toggle" | "controlled", event? }.'
67
+ ),
63
68
  onKeyDown: import_ds_props_helpers.PropTypes.func.description("OnKeyDown handler callback."),
64
69
  onClick: import_ds_props_helpers.PropTypes.func.description("Custom onClick for Trigger component."),
65
70
  onClickOutside: import_ds_props_helpers.PropTypes.func.description("Callback event when the user clicks outside the App Picker."),
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/react-desc-prop-types.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["/* eslint-disable @typescript-eslint/no-empty-interface */\nimport React from 'react';\nimport { MenuPicker } from '@elliemae/ds-icons';\nimport type { SvgIconT } from '@elliemae/ds-icons';\nimport type { GlobalAttributesT, XstyledProps, DSPropTypesSchema, ValidationMap } from '@elliemae/ds-props-helpers';\nimport {\n PropTypes,\n getPropsPerSlotPropTypes,\n globalAttributesPropTypes,\n xstyledPropTypes,\n} from '@elliemae/ds-props-helpers';\nimport type { TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport { DSAppPickerName, DSAppPickerSlots } from './constants/index.js';\n\nexport declare namespace DSAppPickerT {\n export interface AppItem {\n label: string;\n icon: React.ComponentType<{ className: string; size: string }>;\n onClick?: (e: React.MouseEvent, item: AppItem) => void | null;\n disabled?: boolean;\n applyAriaDisabled?: boolean;\n id?: string;\n selected?: boolean;\n wrapText?: boolean;\n }\n\n export type ActionRef = React.MutableRefObject<{\n focusToIndex?: (index: number) => void;\n focusSelectedOrFirstAvailable?: () => void;\n focusWrapper: () => void;\n }>;\n\n export interface RequiredProps {}\n\n export type SlotFunctionArguments = {\n dsApppickerRoot: () => object;\n dsApppickerItem: () => object;\n dsApppickerTitle: () => object;\n dsApppickerSeparator: () => object;\n dsApppickerRow: () => object;\n dsApppickerChip: () => object;\n dsApppickerButton: () => object;\n dsApppickerFloatingWrapper: () => object;\n };\n\n export interface DefaultProps {\n apps: AppItem[];\n customApps: AppItem[];\n sectionTitle: string;\n customSectionTitle: string;\n icon: React.ComponentType<SvgIconT.Props>;\n }\n\n interface RenderTriggerProp {\n ref: React.RefCallback<HTMLButtonElement>;\n [key: string]: unknown;\n }\n\n export interface OptionalProps\n extends TypescriptHelpersT.PropsForGlobalOnSlots<typeof DSAppPickerName, typeof DSAppPickerSlots> {\n onClose?: () => void;\n onClick?: (e: React.MouseEvent | React.KeyboardEvent) => void;\n onClickOutside?: (e: MouseEvent | React.MouseEvent) => void;\n onKeyDown?: (e: React.KeyboardEvent) => void;\n actionRef?: ActionRef;\n renderTrigger?: (props: RenderTriggerProp) => React.ReactElement | null;\n isOpen?: boolean;\n triggerRef?: React.RefObject<HTMLButtonElement>;\n }\n\n export interface Props\n extends Partial<DefaultProps>,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLDivElement>, keyof DefaultProps | keyof OptionalProps | keyof XstyledProps>,\n XstyledProps,\n RequiredProps {}\n\n export interface InternalProps\n extends DefaultProps,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLDivElement>, keyof DefaultProps | keyof OptionalProps | keyof XstyledProps>,\n XstyledProps,\n RequiredProps {}\n}\n\nexport const defaultProps: DSAppPickerT.DefaultProps = {\n apps: [],\n customApps: [],\n sectionTitle: 'APPLICATIONS',\n customSectionTitle: 'CUSTOM APPLICATIONS',\n icon: () => <MenuPicker color={['brand-primary', '700']} size=\"m\" />,\n};\n\n// =============================================================================\n// PropTypes\n// =============================================================================\n\nexport const DSAppPickerPropTypes: DSPropTypesSchema<DSAppPickerT.Props> = {\n ...getPropsPerSlotPropTypes(DSAppPickerName, DSAppPickerSlots),\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n apps: PropTypes.array\n .description('Main items. Format: [{ label:string, icon:component, onClick:func, disabled:bool, selected:bool }]')\n .defaultValue([]),\n customApps: PropTypes.array\n .description('Custom items. Format: [{ label:string, icon:component, onClick:func, disabled:bool, selected:bool }]')\n .defaultValue([]),\n sectionTitle: PropTypes.string.description('main section title').defaultValue('APPLICATIONS'),\n customSectionTitle: PropTypes.string.description('custom section title').defaultValue('CUSTOM APPLICATIONS'),\n icon: PropTypes.func.description('trigger button s icon').defaultValue(MenuPicker),\n renderTrigger: PropTypes.func.description('Custom trigger component.'),\n actionRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({ current: PropTypes.any })]).description(\n 'Ref containing a focusToIndex method. This method allows you to focus any App inside the AppPicker.',\n ),\n isOpen: PropTypes.bool.description('Wether the AppPicker should be open or not.'),\n onClose: PropTypes.func.description('Callback function when the AppPicker closes'),\n onKeyDown: PropTypes.func.description('OnKeyDown handler callback.'),\n onClick: PropTypes.func.description('Custom onClick for Trigger component.'),\n onClickOutside: PropTypes.func.description('Callback event when the user clicks outside the App Picker.'),\n triggerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({ current: PropTypes.any })]).description(\n 'Ref to the trigger button.',\n ),\n};\n\nexport const DSAppPickerPropTypesSchema = DSAppPickerPropTypes as unknown as ValidationMap<DSAppPickerT.Props>;\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD0FT;AAxFd,sBAA2B;AAG3B,8BAKO;AAEP,uBAAkD;AAyE3C,MAAM,eAA0C;AAAA,EACrD,MAAM,CAAC;AAAA,EACP,YAAY,CAAC;AAAA,EACb,cAAc;AAAA,EACd,oBAAoB;AAAA,EACpB,MAAM,MAAM,4CAAC,8BAAW,OAAO,CAAC,iBAAiB,KAAK,GAAG,MAAK,KAAI;AACpE;AAMO,MAAM,uBAA8D;AAAA,EACzE,OAAG,kDAAyB,kCAAiB,iCAAgB;AAAA,EAC7D,GAAG;AAAA,EACH,GAAG;AAAA,EACH,MAAM,kCAAU,MACb,YAAY,oGAAoG,EAChH,aAAa,CAAC,CAAC;AAAA,EAClB,YAAY,kCAAU,MACnB,YAAY,sGAAsG,EAClH,aAAa,CAAC,CAAC;AAAA,EAClB,cAAc,kCAAU,OAAO,YAAY,oBAAoB,EAAE,aAAa,cAAc;AAAA,EAC5F,oBAAoB,kCAAU,OAAO,YAAY,sBAAsB,EAAE,aAAa,qBAAqB;AAAA,EAC3G,MAAM,kCAAU,KAAK,YAAY,uBAAuB,EAAE,aAAa,0BAAU;AAAA,EACjF,eAAe,kCAAU,KAAK,YAAY,2BAA2B;AAAA,EACrE,WAAW,kCAAU,UAAU,CAAC,kCAAU,MAAM,kCAAU,MAAM,EAAE,SAAS,kCAAU,IAAI,CAAC,CAAC,CAAC,EAAE;AAAA,IAC5F;AAAA,EACF;AAAA,EACA,QAAQ,kCAAU,KAAK,YAAY,6CAA6C;AAAA,EAChF,SAAS,kCAAU,KAAK,YAAY,6CAA6C;AAAA,EACjF,WAAW,kCAAU,KAAK,YAAY,6BAA6B;AAAA,EACnE,SAAS,kCAAU,KAAK,YAAY,uCAAuC;AAAA,EAC3E,gBAAgB,kCAAU,KAAK,YAAY,6DAA6D;AAAA,EACxG,YAAY,kCAAU,UAAU,CAAC,kCAAU,MAAM,kCAAU,MAAM,EAAE,SAAS,kCAAU,IAAI,CAAC,CAAC,CAAC,EAAE;AAAA,IAC7F;AAAA,EACF;AACF;AAEO,MAAM,6BAA6B;",
4
+ "sourcesContent": ["/* eslint-disable @typescript-eslint/no-empty-interface */\nimport React from 'react';\nimport { MenuPicker } from '@elliemae/ds-icons';\nimport type { SvgIconT } from '@elliemae/ds-icons';\nimport type { GlobalAttributesT, XstyledProps, DSPropTypesSchema, ValidationMap } from '@elliemae/ds-props-helpers';\nimport {\n PropTypes,\n getPropsPerSlotPropTypes,\n globalAttributesPropTypes,\n xstyledPropTypes,\n} from '@elliemae/ds-props-helpers';\nimport type { TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport { DSAppPickerName, DSAppPickerSlots } from './constants/index.js';\n\nexport declare namespace DSAppPickerT {\n export interface AppItem {\n label: string;\n icon: React.ComponentType<{ className: string; size: string }>;\n onClick?: (e: React.MouseEvent, item: AppItem) => void | null;\n disabled?: boolean;\n applyAriaDisabled?: boolean;\n id?: string;\n selected?: boolean;\n wrapText?: boolean;\n }\n\n export type ActionRef = React.MutableRefObject<{\n focusToIndex?: (index: number) => void;\n focusSelectedOrFirstAvailable?: () => void;\n focusWrapper: () => void;\n }>;\n\n /**\n * Why the panel opened. `trigger` carries the activating event and fires synchronously in the\n * trigger's click handler (AppPicker owns the open). `controlled` fires when the consumer flips\n * the `isOpen` prop themselves \u2014 no event, delivered when that flip takes effect.\n */\n export type OpenChange =\n { reason: 'trigger'; event: React.MouseEvent | React.KeyboardEvent } | { reason: 'controlled' };\n\n /**\n * Why the panel closed. The event-carrying reasons fire synchronously from the handler that owns\n * the close (AppPicker in uncontrolled mode): `escape` (a scoped Escape), `click-outside`, and\n * `trigger-toggle` (the trigger clicked while open). `controlled` fires when the consumer flips the\n * `isOpen` prop themselves \u2014 no event, delivered when that flip takes effect.\n */\n export type CloseChange =\n | { reason: 'escape'; event: KeyboardEvent }\n | { reason: 'click-outside'; event: MouseEvent | TouchEvent }\n | { reason: 'trigger-toggle'; event: React.MouseEvent | React.KeyboardEvent }\n | { reason: 'controlled' };\n\n export interface RequiredProps {}\n\n export type SlotFunctionArguments = {\n dsApppickerRoot: () => object;\n dsApppickerItem: () => object;\n dsApppickerTitle: () => object;\n dsApppickerSeparator: () => object;\n dsApppickerRow: () => object;\n dsApppickerChip: () => object;\n dsApppickerButton: () => object;\n dsApppickerFloatingWrapper: () => object;\n };\n\n export interface DefaultProps {\n apps: AppItem[];\n customApps: AppItem[];\n sectionTitle: string;\n customSectionTitle: string;\n icon: React.ComponentType<SvgIconT.Props>;\n }\n\n interface RenderTriggerProp {\n ref: React.RefCallback<HTMLButtonElement>;\n [key: string]: unknown;\n }\n\n export interface OptionalProps extends TypescriptHelpersT.PropsForGlobalOnSlots<\n typeof DSAppPickerName,\n typeof DSAppPickerSlots\n > {\n onOpen?: (info: OpenChange) => void;\n onClose?: (info: CloseChange) => void;\n onClick?: (e: React.MouseEvent | React.KeyboardEvent) => void;\n onClickOutside?: (e: MouseEvent | React.MouseEvent) => void;\n onKeyDown?: (e: React.KeyboardEvent) => void;\n actionRef?: ActionRef;\n renderTrigger?: (props: RenderTriggerProp) => React.ReactElement | null;\n isOpen?: boolean;\n triggerRef?: React.RefObject<HTMLButtonElement>;\n }\n\n export interface Props\n extends\n Partial<DefaultProps>,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLDivElement>, keyof DefaultProps | keyof OptionalProps | keyof XstyledProps>,\n XstyledProps,\n RequiredProps {}\n\n export interface InternalProps\n extends\n DefaultProps,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLDivElement>, keyof DefaultProps | keyof OptionalProps | keyof XstyledProps>,\n XstyledProps,\n RequiredProps {}\n}\n\nexport const defaultProps: DSAppPickerT.DefaultProps = {\n apps: [],\n customApps: [],\n sectionTitle: 'APPLICATIONS',\n customSectionTitle: 'CUSTOM APPLICATIONS',\n icon: () => <MenuPicker color={['brand-primary', '700']} size=\"m\" />,\n};\n\n// =============================================================================\n// PropTypes\n// =============================================================================\n\nexport const DSAppPickerPropTypes: DSPropTypesSchema<DSAppPickerT.Props> = {\n ...getPropsPerSlotPropTypes(DSAppPickerName, DSAppPickerSlots),\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n apps: PropTypes.array\n .description('Main items. Format: [{ label:string, icon:component, onClick:func, disabled:bool, selected:bool }]')\n .defaultValue([]),\n customApps: PropTypes.array\n .description('Custom items. Format: [{ label:string, icon:component, onClick:func, disabled:bool, selected:bool }]')\n .defaultValue([]),\n sectionTitle: PropTypes.string.description('main section title').defaultValue('APPLICATIONS'),\n customSectionTitle: PropTypes.string.description('custom section title').defaultValue('CUSTOM APPLICATIONS'),\n icon: PropTypes.func.description('trigger button s icon').defaultValue(MenuPicker),\n renderTrigger: PropTypes.func.description('Custom trigger component.'),\n actionRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({ current: PropTypes.any })]).description(\n 'Ref containing a focusToIndex method. This method allows you to focus any App inside the AppPicker.',\n ),\n isOpen: PropTypes.bool.description('Wether the AppPicker should be open or not.'),\n onOpen: PropTypes.func.description(\n 'Callback when the AppPicker opens; receives { reason: \"trigger\" | \"controlled\", event? }.',\n ),\n onClose: PropTypes.func.description(\n 'Callback when the AppPicker closes; receives { reason: \"escape\" | \"click-outside\" | \"trigger-toggle\" | \"controlled\", event? }.',\n ),\n onKeyDown: PropTypes.func.description('OnKeyDown handler callback.'),\n onClick: PropTypes.func.description('Custom onClick for Trigger component.'),\n onClickOutside: PropTypes.func.description('Callback event when the user clicks outside the App Picker.'),\n triggerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({ current: PropTypes.any })]).description(\n 'Ref to the trigger button.',\n ),\n};\n\nexport const DSAppPickerPropTypesSchema = DSAppPickerPropTypes as unknown as ValidationMap<DSAppPickerT.Props>;\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADmHT;AAjHd,sBAA2B;AAG3B,8BAKO;AAEP,uBAAkD;AAkG3C,MAAM,eAA0C;AAAA,EACrD,MAAM,CAAC;AAAA,EACP,YAAY,CAAC;AAAA,EACb,cAAc;AAAA,EACd,oBAAoB;AAAA,EACpB,MAAM,MAAM,4CAAC,8BAAW,OAAO,CAAC,iBAAiB,KAAK,GAAG,MAAK,KAAI;AACpE;AAMO,MAAM,uBAA8D;AAAA,EACzE,OAAG,kDAAyB,kCAAiB,iCAAgB;AAAA,EAC7D,GAAG;AAAA,EACH,GAAG;AAAA,EACH,MAAM,kCAAU,MACb,YAAY,oGAAoG,EAChH,aAAa,CAAC,CAAC;AAAA,EAClB,YAAY,kCAAU,MACnB,YAAY,sGAAsG,EAClH,aAAa,CAAC,CAAC;AAAA,EAClB,cAAc,kCAAU,OAAO,YAAY,oBAAoB,EAAE,aAAa,cAAc;AAAA,EAC5F,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