@elliemae/ds-app-picker 3.61.11 → 3.70.0-alpha.9

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 (130) hide show
  1. package/dist/cjs/DSAppPicker.js +10 -141
  2. package/dist/cjs/DSAppPicker.js.map +3 -3
  3. package/dist/cjs/{utils.js → DSAppPickerCTX.js} +8 -25
  4. package/dist/cjs/DSAppPickerCTX.js.map +7 -0
  5. package/dist/cjs/config/useAppPicker.js +25 -8
  6. package/dist/cjs/config/useAppPicker.js.map +3 -3
  7. package/dist/cjs/config/useFocusTracker.js +104 -0
  8. package/dist/cjs/config/useFocusTracker.js.map +7 -0
  9. package/dist/cjs/config/useValidateProps.js +63 -0
  10. package/dist/cjs/config/useValidateProps.js.map +7 -0
  11. package/dist/cjs/constants/index.js +11 -1
  12. package/dist/cjs/constants/index.js.map +2 -2
  13. package/dist/cjs/index.js +8 -1
  14. package/dist/cjs/index.js.map +3 -3
  15. package/dist/cjs/parts/AppPanel.js +143 -0
  16. package/dist/cjs/parts/AppPanel.js.map +7 -0
  17. package/dist/cjs/parts/AppPickerFloatingContext/AppPickerContent.js +104 -0
  18. package/dist/cjs/parts/AppPickerFloatingContext/AppPickerContent.js.map +7 -0
  19. package/dist/cjs/parts/AppPickerFloatingContext/useAppPickerFloatingContext.js +195 -0
  20. package/dist/cjs/parts/AppPickerFloatingContext/useAppPickerFloatingContext.js.map +7 -0
  21. package/dist/cjs/parts/AppPickerItem.js +104 -0
  22. package/dist/cjs/parts/AppPickerItem.js.map +7 -0
  23. package/dist/cjs/parts/AppSection.js +95 -0
  24. package/dist/cjs/parts/AppSection.js.map +7 -0
  25. package/dist/cjs/parts/Trigger.js +83 -0
  26. package/dist/cjs/parts/Trigger.js.map +7 -0
  27. package/dist/cjs/parts/shared-styles.js +44 -0
  28. package/dist/cjs/parts/shared-styles.js.map +7 -0
  29. package/dist/cjs/react-desc-prop-types.js +28 -8
  30. package/dist/cjs/react-desc-prop-types.js.map +2 -2
  31. package/dist/cjs/typescript-testing/slot-props.js +48 -0
  32. package/dist/cjs/typescript-testing/slot-props.js.map +7 -0
  33. package/dist/cjs/typescript-testing/typescript-app-picker-valid.js +15 -2
  34. package/dist/cjs/typescript-testing/typescript-app-picker-valid.js.map +2 -2
  35. package/dist/cjs/util/getChipId.js +36 -0
  36. package/dist/cjs/util/getChipId.js.map +7 -0
  37. package/dist/cjs/util/getChipRegionId.js +37 -0
  38. package/dist/cjs/util/getChipRegionId.js.map +7 -0
  39. package/dist/cjs/util/getDSAppPickerContractProps.js +38 -0
  40. package/dist/cjs/util/getDSAppPickerContractProps.js.map +7 -0
  41. package/dist/cjs/util/instanceIds.js +42 -0
  42. package/dist/cjs/util/instanceIds.js.map +7 -0
  43. package/dist/esm/DSAppPicker.js +10 -141
  44. package/dist/esm/DSAppPicker.js.map +3 -3
  45. package/dist/esm/DSAppPickerCTX.js +8 -0
  46. package/dist/esm/DSAppPickerCTX.js.map +7 -0
  47. package/dist/esm/config/useAppPicker.js +29 -13
  48. package/dist/esm/config/useAppPicker.js.map +3 -3
  49. package/dist/esm/config/useFocusTracker.js +74 -0
  50. package/dist/esm/config/useFocusTracker.js.map +7 -0
  51. package/dist/esm/config/useValidateProps.js +33 -0
  52. package/dist/esm/config/useValidateProps.js.map +7 -0
  53. package/dist/esm/constants/index.js +11 -1
  54. package/dist/esm/constants/index.js.map +2 -2
  55. package/dist/esm/index.js +13 -1
  56. package/dist/esm/index.js.map +3 -3
  57. package/dist/esm/parts/AppPanel.js +118 -0
  58. package/dist/esm/parts/AppPanel.js.map +7 -0
  59. package/dist/esm/parts/AppPickerFloatingContext/AppPickerContent.js +74 -0
  60. package/dist/esm/parts/AppPickerFloatingContext/AppPickerContent.js.map +7 -0
  61. package/dist/esm/parts/AppPickerFloatingContext/useAppPickerFloatingContext.js +165 -0
  62. package/dist/esm/parts/AppPickerFloatingContext/useAppPickerFloatingContext.js.map +7 -0
  63. package/dist/esm/parts/AppPickerItem.js +74 -0
  64. package/dist/esm/parts/AppPickerItem.js.map +7 -0
  65. package/dist/esm/parts/AppSection.js +65 -0
  66. package/dist/esm/parts/AppSection.js.map +7 -0
  67. package/dist/esm/parts/Trigger.js +53 -0
  68. package/dist/esm/parts/Trigger.js.map +7 -0
  69. package/dist/esm/parts/shared-styles.js +14 -0
  70. package/dist/esm/parts/shared-styles.js.map +7 -0
  71. package/dist/esm/react-desc-prop-types.js +34 -9
  72. package/dist/esm/react-desc-prop-types.js.map +2 -2
  73. package/dist/esm/typescript-testing/slot-props.js +25 -0
  74. package/dist/esm/typescript-testing/slot-props.js.map +7 -0
  75. package/dist/esm/typescript-testing/typescript-app-picker-valid.js +15 -2
  76. package/dist/esm/typescript-testing/typescript-app-picker-valid.js.map +2 -2
  77. package/dist/esm/util/getChipId.js +6 -0
  78. package/dist/esm/util/getChipId.js.map +7 -0
  79. package/dist/esm/util/getChipRegionId.js +7 -0
  80. package/dist/esm/util/getChipRegionId.js.map +7 -0
  81. package/dist/esm/util/getDSAppPickerContractProps.js +8 -0
  82. package/dist/esm/util/getDSAppPickerContractProps.js.map +7 -0
  83. package/dist/esm/util/instanceIds.js +12 -0
  84. package/dist/esm/util/instanceIds.js.map +7 -0
  85. package/dist/types/DSAppPicker.d.ts +1 -2
  86. package/dist/types/DSAppPickerCTX.d.ts +6 -0
  87. package/dist/types/config/useAppPicker.d.ts +111 -92
  88. package/dist/types/config/useFocusTracker.d.ts +19 -0
  89. package/dist/types/config/useValidateProps.d.ts +3 -0
  90. package/dist/types/constants/index.d.ts +17 -7
  91. package/dist/types/index.d.ts +2 -0
  92. package/dist/types/parts/AppPanel.d.ts +2 -0
  93. package/dist/types/parts/AppPickerFloatingContext/AppPickerContent.d.ts +3 -0
  94. package/dist/types/parts/AppPickerFloatingContext/useAppPickerFloatingContext.d.ts +171 -0
  95. package/dist/types/parts/AppPickerItem.d.ts +11 -0
  96. package/dist/types/parts/AppSection.d.ts +6 -0
  97. package/dist/types/parts/Trigger.d.ts +14 -0
  98. package/dist/types/parts/shared-styles.d.ts +2 -0
  99. package/dist/types/react-desc-prop-types.d.ts +112 -9
  100. package/dist/types/util/getChipId.d.ts +2 -0
  101. package/dist/types/util/getChipRegionId.d.ts +1 -0
  102. package/dist/types/util/getDSAppPickerContractProps.d.ts +37 -0
  103. package/dist/types/util/instanceIds.d.ts +11 -0
  104. package/package.json +21 -18
  105. package/dist/cjs/AppPickerImpl.js +0 -204
  106. package/dist/cjs/AppPickerImpl.js.map +0 -7
  107. package/dist/cjs/hooks/useKeepTrackButtons.js +0 -69
  108. package/dist/cjs/hooks/useKeepTrackButtons.js.map +0 -7
  109. package/dist/cjs/styles.js +0 -76
  110. package/dist/cjs/styles.js.map +0 -7
  111. package/dist/cjs/utils.js.map +0 -7
  112. package/dist/esm/AppPickerImpl.js +0 -174
  113. package/dist/esm/AppPickerImpl.js.map +0 -7
  114. package/dist/esm/hooks/useKeepTrackButtons.js +0 -39
  115. package/dist/esm/hooks/useKeepTrackButtons.js.map +0 -7
  116. package/dist/esm/styles.js +0 -46
  117. package/dist/esm/styles.js.map +0 -7
  118. package/dist/esm/utils.js +0 -25
  119. package/dist/esm/utils.js.map +0 -7
  120. package/dist/types/AppPickerImpl.d.ts +0 -11
  121. package/dist/types/hooks/useKeepTrackButtons.d.ts +0 -13
  122. package/dist/types/styles.d.ts +0 -7
  123. package/dist/types/tests/app-picker.a11y.test.d.ts +0 -1
  124. package/dist/types/tests/app-picker.data-testid.test.d.ts +0 -1
  125. package/dist/types/tests/app-picker.events.test.d.ts +0 -1
  126. package/dist/types/tests/app-picker.exports.test.d.ts +0 -1
  127. package/dist/types/tests/app-picker.get-owner-props.test.d.ts +0 -1
  128. package/dist/types/tests/app-picker.keyboard.test.d.ts +0 -1
  129. package/dist/types/typescript-testing/typescript-app-picker-valid.d.ts +0 -1
  130. package/dist/types/utils.d.ts +0 -14
@@ -25,6 +25,7 @@ var React = __toESM(require("react"));
25
25
  var import_jsx_runtime = require("react/jsx-runtime");
26
26
  var import__ = require("../index.js");
27
27
  const testOptionalProps = {};
28
+ const testRequiredProps = {};
28
29
  const testPartialDefaults = {
29
30
  apps: [],
30
31
  customApps: [],
@@ -34,10 +35,12 @@ const testPartialDefaults = {
34
35
  };
35
36
  const testProps = {
36
37
  ...testOptionalProps,
38
+ ...testRequiredProps,
37
39
  ...testPartialDefaults
38
40
  };
39
41
  const testPropsAsSyntax = {
40
42
  ...testOptionalProps,
43
+ ...testRequiredProps,
41
44
  ...testPartialDefaults
42
45
  };
43
46
  const testCompleteDefaults = {
@@ -45,14 +48,17 @@ const testCompleteDefaults = {
45
48
  customApps: [],
46
49
  sectionTitle: "",
47
50
  customSectionTitle: "",
48
- icon: () => null
51
+ icon: () => null,
52
+ openAndFocusOnArrowKeys: false
49
53
  };
50
54
  const testInternalProps = {
51
55
  ...testOptionalProps,
56
+ ...testRequiredProps,
52
57
  ...testCompleteDefaults
53
58
  };
54
59
  const testInternalPropsAsSyntax = {
55
60
  ...testOptionalProps,
61
+ ...testRequiredProps,
56
62
  ...testCompleteDefaults
57
63
  };
58
64
  const testExplicitDefinition = {
@@ -69,10 +75,17 @@ const testInferedTypeCompatibility = {
69
75
  customSectionTitle: "",
70
76
  icon: () => null
71
77
  };
78
+ const CustomTrigger = ({ innerRef, id, onClick, ...rest }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { ref: innerRef, id, onClick, type: "button", ...rest, children: "Open apps" });
79
+ const testTriggerComponentProp = {
80
+ TriggerComponent: CustomTrigger
81
+ };
72
82
  const ExampleUsageComponent = () => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
73
83
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.DSAppPicker, { ...testExplicitDefinition }),
74
84
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.DSAppPicker, { ...testInferedTypeCompatibility }),
75
85
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.DSAppPicker, { apps: [], customApps: [], sectionTitle: "", customSectionTitle: "", icon: () => null }),
76
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.DSAppPicker, { apps: [], customApps: [], sectionTitle: "", customSectionTitle: "", icon: () => null })
86
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.DSAppPicker, { apps: [], customApps: [], sectionTitle: "", customSectionTitle: "", icon: () => null }),
87
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.DSAppPicker, { apps: [], TriggerComponent: CustomTrigger }),
88
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.DSAppPicker, { ...testTriggerComponentProp, apps: [] }),
89
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.DSAppPicker, { apps: [], renderTrigger: ({ ref }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { ref, type: "button", "aria-label": "banana" }) })
77
90
  ] });
78
91
  //# sourceMappingURL=typescript-app-picker-valid.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/typescript-testing/typescript-app-picker-valid.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\nimport { DSAppPicker } from '../index.js';\nimport type { DSAppPickerT } from '../index.js';\n\n// test we expose the namespace and the namespace follows our deliverable conventions\ntype ComponentPropsForApp = DSAppPickerT.Props;\ntype ComponentPropsInternals = DSAppPickerT.InternalProps;\ntype ComponentPropsDefaultProps = DSAppPickerT.DefaultProps;\ntype ComponentPropsOptionalProps = DSAppPickerT.OptionalProps;\n\nconst testOptionalProps: ComponentPropsOptionalProps = {};\n\n// difference Props and InternalProps is that InternalProps has all the default props filled in\n// Props allows for partial defaults\nconst testPartialDefaults: Partial<ComponentPropsDefaultProps> = {\n apps: [],\n customApps: [],\n sectionTitle: '',\n customSectionTitle: '',\n icon: () => null,\n};\n\nconst testProps: ComponentPropsForApp = {\n ...testOptionalProps,\n ...testPartialDefaults,\n};\nconst testPropsAsSyntax = {\n ...testOptionalProps,\n ...testPartialDefaults,\n} as ComponentPropsForApp;\n// InternalProps requires all defaults to be filled in\nconst testCompleteDefaults: Required<ComponentPropsDefaultProps> = {\n apps: [],\n customApps: [],\n sectionTitle: '',\n customSectionTitle: '',\n icon: () => null,\n};\n\nconst testInternalProps: ComponentPropsInternals = {\n ...testOptionalProps,\n ...testCompleteDefaults,\n};\nconst testInternalPropsAsSyntax = {\n ...testOptionalProps,\n ...testCompleteDefaults,\n} as ComponentPropsInternals;\n\n// using the explicit type definition, if there is an error, it will be marked on the key that is wrong\nconst testExplicitDefinition: ComponentPropsForApp = {\n apps: [],\n customApps: [],\n sectionTitle: '',\n customSectionTitle: '',\n icon: () => null,\n};\n\n// using the \"as\" syntax, if there is an error, it will be marking the whole object as wrong because it is not compatible with the type\nconst testInferedTypeCompatibility = {\n apps: [],\n customApps: [],\n sectionTitle: '',\n customSectionTitle: '',\n icon: () => null,\n} as ComponentPropsForApp;\n\nconst ExampleUsageComponent = () => (\n <>\n {/* works with explicitly casted props, all syntaxes */}\n <DSAppPicker {...testExplicitDefinition} />\n <DSAppPicker {...testInferedTypeCompatibility} />\n {/* works with inline values */}\n <DSAppPicker apps={[]} customApps={[]} sectionTitle=\"\" customSectionTitle=\"\" icon={() => null} />\n {/* multiple auto inference works */}\n <DSAppPicker apps={[]} customApps={[]} sectionTitle=\"\" customSectionTitle=\"\" icon={() => null} />\n {/* works with partial defaults */}\n </>\n);\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA,YAAuB;ACmErB;AAlEF,eAA4B;AAS5B,MAAM,oBAAiD,CAAC;AAIxD,MAAM,sBAA2D;AAAA,EAC/D,MAAM,CAAC;AAAA,EACP,YAAY,CAAC;AAAA,EACb,cAAc;AAAA,EACd,oBAAoB;AAAA,EACpB,MAAM,MAAM;AACd;AAEA,MAAM,YAAkC;AAAA,EACtC,GAAG;AAAA,EACH,GAAG;AACL;AACA,MAAM,oBAAoB;AAAA,EACxB,GAAG;AAAA,EACH,GAAG;AACL;AAEA,MAAM,uBAA6D;AAAA,EACjE,MAAM,CAAC;AAAA,EACP,YAAY,CAAC;AAAA,EACb,cAAc;AAAA,EACd,oBAAoB;AAAA,EACpB,MAAM,MAAM;AACd;AAEA,MAAM,oBAA6C;AAAA,EACjD,GAAG;AAAA,EACH,GAAG;AACL;AACA,MAAM,4BAA4B;AAAA,EAChC,GAAG;AAAA,EACH,GAAG;AACL;AAGA,MAAM,yBAA+C;AAAA,EACnD,MAAM,CAAC;AAAA,EACP,YAAY,CAAC;AAAA,EACb,cAAc;AAAA,EACd,oBAAoB;AAAA,EACpB,MAAM,MAAM;AACd;AAGA,MAAM,+BAA+B;AAAA,EACnC,MAAM,CAAC;AAAA,EACP,YAAY,CAAC;AAAA,EACb,cAAc;AAAA,EACd,oBAAoB;AAAA,EACpB,MAAM,MAAM;AACd;AAEA,MAAM,wBAAwB,MAC5B,4EAEE;AAAA,8CAAC,wBAAa,GAAG,wBAAwB;AAAA,EACzC,4CAAC,wBAAa,GAAG,8BAA8B;AAAA,EAE/C,4CAAC,wBAAY,MAAM,CAAC,GAAG,YAAY,CAAC,GAAG,cAAa,IAAG,oBAAmB,IAAG,MAAM,MAAM,MAAM;AAAA,EAE/F,4CAAC,wBAAY,MAAM,CAAC,GAAG,YAAY,CAAC,GAAG,cAAa,IAAG,oBAAmB,IAAG,MAAM,MAAM,MAAM;AAAA,GAEjG;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\nimport { DSAppPicker } from '../index.js';\nimport type { DSAppPickerT } from '../index.js';\n\n// test we expose the namespace and the namespace follows our deliverable conventions\ntype ComponentPropsForApp = DSAppPickerT.Props;\ntype ComponentPropsInternals = DSAppPickerT.InternalProps;\ntype ComponentPropsDefaultProps = DSAppPickerT.DefaultProps;\ntype ComponentPropsOptionalProps = DSAppPickerT.OptionalProps;\ntype ComponentPropsRequiredProps = DSAppPickerT.RequiredProps;\n\nconst testOptionalProps: ComponentPropsOptionalProps = {};\nconst testRequiredProps: ComponentPropsRequiredProps = {};\n\n// difference Props and InternalProps is that InternalProps has all the default props filled in\n// Props allows for partial defaults\nconst testPartialDefaults: Partial<ComponentPropsDefaultProps> = {\n apps: [],\n customApps: [],\n sectionTitle: '',\n customSectionTitle: '',\n icon: () => null,\n};\n\nconst testProps: ComponentPropsForApp = {\n ...testOptionalProps,\n ...testRequiredProps,\n ...testPartialDefaults,\n};\nconst testPropsAsSyntax = {\n ...testOptionalProps,\n ...testRequiredProps,\n ...testPartialDefaults,\n} as ComponentPropsForApp;\n// InternalProps requires all defaults to be filled in\nconst testCompleteDefaults: Required<ComponentPropsDefaultProps> = {\n apps: [],\n customApps: [],\n sectionTitle: '',\n customSectionTitle: '',\n icon: () => null,\n openAndFocusOnArrowKeys: false,\n};\n\nconst testInternalProps: ComponentPropsInternals = {\n ...testOptionalProps,\n ...testRequiredProps,\n ...testCompleteDefaults,\n};\nconst testInternalPropsAsSyntax = {\n ...testOptionalProps,\n ...testRequiredProps,\n ...testCompleteDefaults,\n} as ComponentPropsInternals;\n\n// using the explicit type definition, if there is an error, it will be marked on the key that is wrong\nconst testExplicitDefinition: ComponentPropsForApp = {\n apps: [],\n customApps: [],\n sectionTitle: '',\n customSectionTitle: '',\n icon: () => null,\n};\n\n// using the \"as\" syntax, if there is an error, it will be marking the whole object as wrong because it is not compatible with the type\nconst testInferedTypeCompatibility = {\n apps: [],\n customApps: [],\n sectionTitle: '',\n customSectionTitle: '',\n icon: () => null,\n} as ComponentPropsForApp;\n\n// TriggerComponent is typed as a real component, so its props arrive through the fiber. The exported\n// TriggerComponentProps type is what a consumer annotates their own trigger with \u2014 if that type stops\n// being reachable from the namespace, or its members change shape, this stops compiling.\nconst CustomTrigger: React.ComponentType<DSAppPickerT.TriggerComponentProps> = ({ innerRef, id, onClick, ...rest }) => (\n <button ref={innerRef} id={id} onClick={onClick} type=\"button\" {...rest}>\n Open apps\n </button>\n);\n\n// A consumer may also declare the trigger inline without naming the props type; both must compile.\nconst testTriggerComponentProp: ComponentPropsOptionalProps = {\n TriggerComponent: CustomTrigger,\n};\n\nconst ExampleUsageComponent = () => (\n <>\n {/* works with explicitly casted props, all syntaxes */}\n <DSAppPicker {...testExplicitDefinition} />\n <DSAppPicker {...testInferedTypeCompatibility} />\n {/* works with inline values */}\n <DSAppPicker apps={[]} customApps={[]} sectionTitle=\"\" customSectionTitle=\"\" icon={() => null} />\n {/* multiple auto inference works */}\n <DSAppPicker apps={[]} customApps={[]} sectionTitle=\"\" customSectionTitle=\"\" icon={() => null} />\n {/* works with partial defaults */}\n {/* TriggerComponent \u2014 the supported custom trigger API */}\n <DSAppPicker apps={[]} TriggerComponent={CustomTrigger} />\n <DSAppPicker {...testTriggerComponentProp} apps={[]} />\n {/* renderTrigger \u2014 deprecated (v4.x) but must still type-check until removal */}\n <DSAppPicker apps={[]} renderTrigger={({ ref }) => <button ref={ref} type=\"button\" aria-label=\"banana\" />} />\n </>\n);\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA,YAAuB;AC6ErB;AA5EF,eAA4B;AAU5B,MAAM,oBAAiD,CAAC;AACxD,MAAM,oBAAiD,CAAC;AAIxD,MAAM,sBAA2D;AAAA,EAC/D,MAAM,CAAC;AAAA,EACP,YAAY,CAAC;AAAA,EACb,cAAc;AAAA,EACd,oBAAoB;AAAA,EACpB,MAAM,MAAM;AACd;AAEA,MAAM,YAAkC;AAAA,EACtC,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AACA,MAAM,oBAAoB;AAAA,EACxB,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAEA,MAAM,uBAA6D;AAAA,EACjE,MAAM,CAAC;AAAA,EACP,YAAY,CAAC;AAAA,EACb,cAAc;AAAA,EACd,oBAAoB;AAAA,EACpB,MAAM,MAAM;AAAA,EACZ,yBAAyB;AAC3B;AAEA,MAAM,oBAA6C;AAAA,EACjD,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AACA,MAAM,4BAA4B;AAAA,EAChC,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAGA,MAAM,yBAA+C;AAAA,EACnD,MAAM,CAAC;AAAA,EACP,YAAY,CAAC;AAAA,EACb,cAAc;AAAA,EACd,oBAAoB;AAAA,EACpB,MAAM,MAAM;AACd;AAGA,MAAM,+BAA+B;AAAA,EACnC,MAAM,CAAC;AAAA,EACP,YAAY,CAAC;AAAA,EACb,cAAc;AAAA,EACd,oBAAoB;AAAA,EACpB,MAAM,MAAM;AACd;AAKA,MAAM,gBAAyE,CAAC,EAAE,UAAU,IAAI,SAAS,GAAG,KAAK,MAC/G,4CAAC,YAAO,KAAK,UAAU,IAAQ,SAAkB,MAAK,UAAU,GAAG,MAAM,uBAEzE;AAIF,MAAM,2BAAwD;AAAA,EAC5D,kBAAkB;AACpB;AAEA,MAAM,wBAAwB,MAC5B,4EAEE;AAAA,8CAAC,wBAAa,GAAG,wBAAwB;AAAA,EACzC,4CAAC,wBAAa,GAAG,8BAA8B;AAAA,EAE/C,4CAAC,wBAAY,MAAM,CAAC,GAAG,YAAY,CAAC,GAAG,cAAa,IAAG,oBAAmB,IAAG,MAAM,MAAM,MAAM;AAAA,EAE/F,4CAAC,wBAAY,MAAM,CAAC,GAAG,YAAY,CAAC,GAAG,cAAa,IAAG,oBAAmB,IAAG,MAAM,MAAM,MAAM;AAAA,EAG/F,4CAAC,wBAAY,MAAM,CAAC,GAAG,kBAAkB,eAAe;AAAA,EACxD,4CAAC,wBAAa,GAAG,0BAA0B,MAAM,CAAC,GAAG;AAAA,EAErD,4CAAC,wBAAY,MAAM,CAAC,GAAG,eAAe,CAAC,EAAE,IAAI,MAAM,4CAAC,YAAO,KAAU,MAAK,UAAS,cAAW,UAAS,GAAI;AAAA,GAC7G;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,36 @@
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 getChipId_exports = {};
30
+ __export(getChipId_exports, {
31
+ getChipId: () => getChipId
32
+ });
33
+ module.exports = __toCommonJS(getChipId_exports);
34
+ var React = __toESM(require("react"));
35
+ const getChipId = (app, flatIndex) => app.id ?? `${app.label}-${flatIndex}`;
36
+ //# sourceMappingURL=getChipId.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/util/getChipId.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import type { DSAppPickerT } from '../react-desc-prop-types.js';\n\n// Chip identity, assigned top-down from data the parent already holds: the app's own `id`, or a\n// deterministic `${label}-${flatIndex}` fallback for id-less apps (the flat index disambiguates\n// duplicate labels). Both the parent (the focus tracker's track* handlers) and the child\n// (AppPickerItem, via the `chipId` prop threaded through AppSection) derive identity through THIS\n// single function, so the parent can compute the exact region string a chip will match without the\n// chip generating an id and reporting it back up. That determinism removes the child\u2192parent\n// dependency entirely: focus can be addressed by identity alone, with no registry to keep in sync\n// and no wait for the child to mount and register.\n//\n// Kept as a standalone leaf util (depends only on a type) so both the hook and the parts can import\n// it without routing through the hook module \u2014 avoids any import cycle risk.\nexport const getChipId = (app: DSAppPickerT.AppItem, flatIndex: number): string =>\n app.id ?? `${app.label}-${flatIndex}`;\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADahB,MAAM,YAAY,CAAC,KAA2B,cACnD,IAAI,MAAM,GAAG,IAAI,KAAK,IAAI,SAAS;",
6
+ "names": []
7
+ }
@@ -0,0 +1,37 @@
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 getChipRegionId_exports = {};
30
+ __export(getChipRegionId_exports, {
31
+ getChipRegionId: () => getChipRegionId
32
+ });
33
+ module.exports = __toCommonJS(getChipRegionId_exports);
34
+ var React = __toESM(require("react"));
35
+ var import_constants = require("../constants/index.js");
36
+ const getChipRegionId = (chipId) => `${import_constants.CHIP_REGION_PREFIX}${chipId}`;
37
+ //# sourceMappingURL=getChipRegionId.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/util/getChipRegionId.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import { CHIP_REGION_PREFIX } from '../constants/index.js';\n\n// Maps a chipId (see getChipId) to its focus-region identifier. Standalone leaf util \u2014 depends only\n// on the constants module \u2014 so the hook and the parts can share it without importing through the\n// hook, keeping the dependency graph acyclic.\nexport const getChipRegionId = (chipId: string): string => `${CHIP_REGION_PREFIX}${chipId}`;\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAAmC;AAK5B,MAAM,kBAAkB,CAAC,WAA2B,GAAG,mCAAkB,GAAG,MAAM;",
6
+ "names": []
7
+ }
@@ -0,0 +1,38 @@
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 getDSAppPickerContractProps_exports = {};
30
+ __export(getDSAppPickerContractProps_exports, {
31
+ getDSAppPickerContractProps: () => getDSAppPickerContractProps
32
+ });
33
+ module.exports = __toCommonJS(getDSAppPickerContractProps_exports);
34
+ var React = __toESM(require("react"));
35
+ var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
36
+ var import_react_desc_prop_types = require("../react-desc-prop-types.js");
37
+ const getDSAppPickerContractProps = (props) => (0, import_ds_props_helpers.getContractProps)(props, import_react_desc_prop_types.DSAppPickerPropTypes);
38
+ //# sourceMappingURL=getDSAppPickerContractProps.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/util/getDSAppPickerContractProps.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import { getContractProps } from '@elliemae/ds-props-helpers';\nimport { DSAppPickerPropTypes, type DSAppPickerT } from '../react-desc-prop-types.js';\n\n/**\n * Filters an arbitrary object down to the props DSAppPicker actually accepts.\n *\n * **Who this is for.** Components that wrap DSAppPicker and receive its props indirectly \u2014 as a\n * configuration object from their own consumer rather than as JSX props.\n *\n * The canonical case is `ds-global-header`, whose `toolbar` config carries a `componentProps` object for\n * the `ds-app-picker` item type. Such a wrapper cannot spread that object blindly: its config type is\n * DSAppPicker's props *plus* the wrapper's own \u2014 `triggerOnClick` there \u2014 and those must not leak into\n * DSAppPicker.\n *\n * Do not swap this for a hand-listed set of forwardable keys. A hand-list has no way to fail when the\n * contract grows: the new prop type-checks at the call site, is dropped silently at runtime, and nothing\n * reports it. Deriving the set from the contract is what makes that class of bug impossible.\n *\n * **Why a utility instead of exporting the schema.** `DSAppPickerPropTypes` is internal. It exists to\n * drive prop validation and the Storybook props table; that it also happens to describe the exact set\n * of forwardable props is a convenience today, not a promise. Exposing the schema would weld those\n * concerns together and make every future change to it a public API change. Exposing this utility\n * instead means the public commitment is only \"you get the props DSAppPicker accepts\" \u2014 if the two\n * ever need to diverge, only this function changes.\n *\n * Anything the contract does not declare is discarded. Arbitrary `data-*` attributes are kept (a\n * supported consumer surface no schema can enumerate).\n *\n * `undefined` vs `null` \u2014 see `getContractProps` for the implemented rule and the React precedent it\n * follows. In short: `undefined` is dropped (\"I am not defining this, you decide\" \u2014 the wrapper's\n * default stands), `null` is forwarded (\"I am explicitly asking for nothing\") and is then judged by\n * DSAppPicker's own strictly-typed contract, which rejects it for props whose declared type does not\n * admit null. To disable a handler, pass an explicit no-op (`() => {}`) \u2014 it honours the type and\n * states the intent unambiguously.\n *\n * @param props - the object to filter, typically a wrapper's `componentProps` configuration\n * @returns a new object containing only props DSAppPicker declares\n */\nexport const getDSAppPickerContractProps = (props: object): Partial<DSAppPickerT.Props> =>\n getContractProps<DSAppPickerT.Props>(props, DSAppPickerPropTypes);\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,8BAAiC;AACjC,mCAAwD;AAqCjD,MAAM,8BAA8B,CAAC,cAC1C,0CAAqC,OAAO,iDAAoB;",
6
+ "names": []
7
+ }
@@ -0,0 +1,42 @@
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 instanceIds_exports = {};
30
+ __export(instanceIds_exports, {
31
+ getIdForAppPickerCustomSectionTitle: () => getIdForAppPickerCustomSectionTitle,
32
+ getIdForAppPickerRoot: () => getIdForAppPickerRoot,
33
+ getIdForAppPickerSectionTitle: () => getIdForAppPickerSectionTitle,
34
+ getIdForAppPickerTrigger: () => getIdForAppPickerTrigger
35
+ });
36
+ module.exports = __toCommonJS(instanceIds_exports);
37
+ var React = __toESM(require("react"));
38
+ const getIdForAppPickerRoot = (id) => id;
39
+ const getIdForAppPickerTrigger = (id) => `${id}-dialog-trigger-btn`;
40
+ const getIdForAppPickerSectionTitle = (id) => `${id}-section-title`;
41
+ const getIdForAppPickerCustomSectionTitle = (id) => `${id}-custom-section-title`;
42
+ //# sourceMappingURL=instanceIds.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/util/instanceIds.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["/*\n * The single place that owns every id suffix DSAppPicker appends.\n *\n * The component receives one `id` and has to put several distinct ids into the DOM. The id the consumer\n * gave lands, unmodified, on the ROOT \u2014 that one is theirs. Every other element gets that same value\n * with a suffix, which is what keeps a picker's ids from colliding with each other, with a second picker\n * on the page, or with the consumer's own markup.\n *\n * A suffix is only useful to a consumer if they can compute it, and it is only safe for us to change if\n * they never wrote it down. So the rule this module encodes is: EVERY suffix we invent gets an exported\n * helper here, and nothing anywhere else \u2014 inside the package or outside it \u2014 composes one by hand. A\n * consumer who needs the trigger writes `getIdForAppPickerTrigger(myId)`; if we rename the suffix\n * tomorrow, their call site keeps working and the rename is not a breaking change. A hardcoded\n * `${myId}-dialog-trigger-btn` in consumer code turns that same rename into one.\n *\n * `getIdForAppPickerRoot` appends nothing today and is exported anyway, for the same reason: it makes\n * \"your id lands on the root\" a call instead of a convention, so the day the root does need a suffix, the\n * consumers who used it are already correct.\n *\n * The names carry `AppPicker` even though the module does not need the disambiguation internally. These\n * are package-level named exports, and the next component to need the same treatment will want the same\n * four names \u2014 a consumer importing both should never have to alias one of them at the import site.\n *\n * Suffix values are frozen published surface \u2014 change them only under the breaking-change protocol, even\n * though this module is what makes such a change survivable.\n */\n\n/** The element the consumer's own `id` lands on, unchanged. */\nexport const getIdForAppPickerRoot = (id: string): string => id;\n\n/**\n * The trigger button. This is the id the panel's `aria-labelledby` points at, so it is also the answer to\n * \"what names the dialog\" \u2014 see `TriggerComponent` in the Custom Triggers documentation.\n */\nexport const getIdForAppPickerTrigger = (id: string): string => `${id}-dialog-trigger-btn`;\n\n/** The `sectionTitle` heading, which labels the `apps` group. */\nexport const getIdForAppPickerSectionTitle = (id: string): string => `${id}-section-title`;\n\n/** The `customSectionTitle` heading, which labels the `customApps` group. */\nexport const getIdForAppPickerCustomSectionTitle = (id: string): string => `${id}-custom-section-title`;\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD4BhB,MAAM,wBAAwB,CAAC,OAAuB;AAMtD,MAAM,2BAA2B,CAAC,OAAuB,GAAG,EAAE;AAG9D,MAAM,gCAAgC,CAAC,OAAuB,GAAG,EAAE;AAGnE,MAAM,sCAAsC,CAAC,OAAuB,GAAG,EAAE;",
6
+ "names": []
7
+ }
@@ -1,153 +1,22 @@
1
1
  import * as React from "react";
2
2
  import { jsx } from "react/jsx-runtime";
3
- import { useState, useEffect, useMemo, useRef, useCallback } from "react";
4
- import { DSButtonV2 } from "@elliemae/ds-button-v2";
5
- import { mergeRefs, styled } from "@elliemae/ds-system";
6
3
  import { describe } from "@elliemae/ds-props-helpers";
7
- import { DSPopover } from "@elliemae/ds-legacy-popover";
8
- import AppPickerImpl from "./AppPickerImpl.js";
9
- import { DSAppPickerPropTypes } from "./react-desc-prop-types.js";
10
- import { DSAppPickerName, DSAppPickerSlots } from "./constants/index.js";
4
+ import React2 from "react";
11
5
  import { useAppPicker } from "./config/useAppPicker.js";
12
- const StyledButton = styled(DSButtonV2, { name: DSAppPickerName, slot: DSAppPickerSlots.BUTTON })``;
6
+ import { DSAppPickerName } from "./constants/index.js";
7
+ import { DSAppPickerContext } from "./DSAppPickerCTX.js";
8
+ import { AppPickerContent } from "./parts/AppPickerFloatingContext/AppPickerContent.js";
9
+ import { DSAppPickerPropTypesSchema } from "./react-desc-prop-types.js";
13
10
  const DSAppPicker = (props) => {
14
- const { propsWithDefault, ownerPropsConfig } = useAppPicker(props);
15
- const { getOwnerProps, getOwnerPropsArguments } = ownerPropsConfig;
16
- const {
17
- apps,
18
- customApps,
19
- sectionTitle,
20
- customSectionTitle,
21
- icon: Icon,
22
- renderTrigger,
23
- isOpen,
24
- onClose,
25
- actionRef,
26
- onKeyDown,
27
- onClick,
28
- onClickOutside,
29
- triggerRef
30
- } = propsWithDefault;
31
- const [open, setOpen] = useState(false);
32
- const [isOverflow, setIsOverflow] = useState(false);
33
- const wrapperRef = useRef(null);
34
- const defaultTriggerRef = useRef(null);
35
- const wasOpenedByKeyboardRef = useRef(false);
36
- useEffect(() => {
37
- if (actionRef && actionRef.current) {
38
- actionRef.current.focusToIndex = (index) => {
39
- if (wrapperRef.current) {
40
- const parent = wrapperRef.current;
41
- const buttons = [...parent.querySelectorAll("button")];
42
- buttons[index].focus();
43
- }
44
- };
45
- actionRef.current.focusWrapper = () => {
46
- wrapperRef.current?.focus();
47
- };
48
- }
49
- }, [actionRef, apps, customApps]);
50
- useEffect(() => {
51
- setTimeout(() => {
52
- if (wrapperRef.current) {
53
- const { scrollHeight, clientHeight } = wrapperRef.current;
54
- if (scrollHeight > clientHeight) return setIsOverflow(true);
55
- }
56
- return setIsOverflow(false);
57
- });
58
- }, [isOpen, open]);
59
- const handleOnClose = useCallback(() => {
60
- setOpen(false);
61
- onClose?.();
62
- }, [onClose]);
63
- const handleOnClickOutside = (e) => {
64
- setOpen(false);
65
- onClose?.();
66
- onClickOutside?.(e);
67
- };
68
- const AppPickerContent = useCallback(
69
- () => /* @__PURE__ */ jsx(
70
- AppPickerImpl,
71
- {
72
- ...getOwnerProps(),
73
- ...getOwnerPropsArguments(),
74
- apps,
75
- customApps,
76
- sectionTitle,
77
- customSectionTitle,
78
- close: handleOnClose,
79
- wrapperRef,
80
- onKeyDown,
81
- triggerRef: triggerRef || defaultTriggerRef,
82
- actionRef,
83
- triggerIsInternal: !renderTrigger,
84
- wasOpenedByKeyboardRef,
85
- isOverflow
86
- }
87
- ),
88
- [
89
- actionRef,
90
- apps,
91
- customApps,
92
- customSectionTitle,
93
- handleOnClose,
94
- isOverflow,
95
- onKeyDown,
96
- renderTrigger,
97
- sectionTitle,
98
- triggerRef,
99
- getOwnerProps,
100
- getOwnerPropsArguments
101
- ]
102
- );
103
- const RenderTrigger = useMemo(
104
- () => renderTrigger || (({ ref }) => /* @__PURE__ */ jsx(
105
- StyledButton,
106
- {
107
- "data-testid": "app-picker__button",
108
- id: "app-picker__button",
109
- buttonType: "icon",
110
- "aria-haspopup": "true",
111
- "aria-expanded": isOpen ?? open,
112
- "aria-label": "Application picker",
113
- innerRef: mergeRefs(ref, triggerRef || defaultTriggerRef),
114
- onClick: (e) => {
115
- wasOpenedByKeyboardRef.current = e.detail === 0;
116
- onClick?.(e);
117
- setOpen(true);
118
- },
119
- getOwnerProps,
120
- getOwnerPropsArguments,
121
- children: /* @__PURE__ */ jsx(Icon, {})
122
- }
123
- )),
124
- [Icon, getOwnerProps, getOwnerPropsArguments, isOpen, onClick, open, renderTrigger, triggerRef]
125
- );
126
- return /* @__PURE__ */ jsx(
127
- DSPopover,
128
- {
129
- content: /* @__PURE__ */ jsx(AppPickerContent, {}),
130
- isOpen: typeof isOpen === "boolean" ? isOpen : open,
131
- onClickOutside: handleOnClickOutside,
132
- placement: "bottom",
133
- interactionType: "click",
134
- renderTrigger: RenderTrigger,
135
- showArrow: true,
136
- style: {
137
- padding: "0",
138
- maxWidth: "1000px",
139
- width: "fit-content"
140
- }
141
- }
142
- );
11
+ const appPickerConfig = useAppPicker(props);
12
+ const ctx = React2.useMemo(() => ({ ...appPickerConfig }), [appPickerConfig]);
13
+ return /* @__PURE__ */ jsx(DSAppPickerContext.Provider, { value: ctx, children: /* @__PURE__ */ jsx(AppPickerContent, {}) });
143
14
  };
144
15
  DSAppPicker.displayName = DSAppPickerName;
145
16
  const AppPickerWithSchema = describe(DSAppPicker);
146
- AppPickerWithSchema.propTypes = DSAppPickerPropTypes;
147
- var DSAppPicker_default = DSAppPicker;
17
+ AppPickerWithSchema.propTypes = DSAppPickerPropTypesSchema;
148
18
  export {
149
19
  AppPickerWithSchema,
150
- DSAppPicker,
151
- DSAppPicker_default as default
20
+ DSAppPicker
152
21
  };
153
22
  //# sourceMappingURL=DSAppPicker.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/DSAppPicker.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useState, useEffect, useMemo, useRef, useCallback } from 'react';\nimport { DSButtonV2 } from '@elliemae/ds-button-v2';\nimport { mergeRefs, styled } from '@elliemae/ds-system';\nimport { describe } from '@elliemae/ds-props-helpers';\n\nimport { DSPopover } from '@elliemae/ds-legacy-popover';\nimport AppPickerImpl from './AppPickerImpl.js';\nimport type { DSAppPickerT } from './react-desc-prop-types.js';\nimport { DSAppPickerPropTypes } from './react-desc-prop-types.js';\nimport { DSAppPickerName, DSAppPickerSlots } from './constants/index.js';\nimport { useAppPicker } from './config/useAppPicker.js';\n\nconst StyledButton = styled(DSButtonV2, { name: DSAppPickerName, slot: DSAppPickerSlots.BUTTON })``;\nconst DSAppPicker: React.ComponentType<DSAppPickerT.Props> = (props) => {\n const { propsWithDefault, ownerPropsConfig } = useAppPicker(props);\n\n const { getOwnerProps, getOwnerPropsArguments } = ownerPropsConfig;\n\n const {\n apps,\n customApps,\n sectionTitle,\n customSectionTitle,\n icon: Icon,\n renderTrigger,\n isOpen,\n onClose,\n actionRef,\n onKeyDown,\n onClick,\n onClickOutside,\n triggerRef,\n } = propsWithDefault;\n\n const [open, setOpen] = useState(false);\n const [isOverflow, setIsOverflow] = useState(false);\n const wrapperRef = useRef<HTMLDivElement>(null);\n const defaultTriggerRef = useRef(null);\n const wasOpenedByKeyboardRef = useRef(false);\n\n useEffect(() => {\n if (actionRef && actionRef.current) {\n actionRef.current.focusToIndex = (index: number) => {\n if (wrapperRef.current) {\n const parent = wrapperRef.current;\n const buttons = [...parent.querySelectorAll('button')];\n buttons[index].focus();\n }\n };\n actionRef.current.focusWrapper = () => {\n wrapperRef.current?.focus();\n };\n }\n }, [actionRef, apps, customApps]);\n\n useEffect(() => {\n setTimeout(() => {\n if (wrapperRef.current) {\n const { scrollHeight, clientHeight } = wrapperRef.current;\n if (scrollHeight > clientHeight) return setIsOverflow(true);\n }\n return setIsOverflow(false);\n });\n }, [isOpen, open]);\n\n const handleOnClose = useCallback(() => {\n setOpen(false);\n onClose?.();\n }, [onClose]);\n\n const handleOnClickOutside = (e: React.MouseEvent) => {\n setOpen(false);\n onClose?.();\n onClickOutside?.(e);\n };\n\n const AppPickerContent = useCallback(\n () => (\n <AppPickerImpl\n {...getOwnerProps()}\n {...getOwnerPropsArguments()}\n apps={apps}\n customApps={customApps}\n sectionTitle={sectionTitle}\n customSectionTitle={customSectionTitle}\n close={handleOnClose}\n wrapperRef={wrapperRef}\n onKeyDown={onKeyDown}\n triggerRef={triggerRef || defaultTriggerRef}\n actionRef={actionRef}\n triggerIsInternal={!renderTrigger}\n wasOpenedByKeyboardRef={wasOpenedByKeyboardRef}\n isOverflow={isOverflow}\n />\n ),\n [\n actionRef,\n apps,\n customApps,\n customSectionTitle,\n handleOnClose,\n isOverflow,\n onKeyDown,\n renderTrigger,\n sectionTitle,\n triggerRef,\n getOwnerProps,\n getOwnerPropsArguments,\n ],\n );\n\n const RenderTrigger = useMemo(\n () =>\n renderTrigger ||\n (({ ref }: { ref: React.RefObject<HTMLButtonElement> }) => (\n <StyledButton\n data-testid=\"app-picker__button\"\n id=\"app-picker__button\"\n buttonType=\"icon\"\n aria-haspopup=\"true\"\n aria-expanded={isOpen ?? open}\n aria-label=\"Application picker\"\n innerRef={mergeRefs(ref, triggerRef || defaultTriggerRef)}\n onClick={(e: React.MouseEvent | React.KeyboardEvent) => {\n wasOpenedByKeyboardRef.current = e.detail === 0;\n onClick?.(e);\n setOpen(true);\n }}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n <Icon />\n </StyledButton>\n )),\n [Icon, getOwnerProps, getOwnerPropsArguments, isOpen, onClick, open, renderTrigger, triggerRef],\n );\n\n return (\n <DSPopover\n content={<AppPickerContent />}\n isOpen={typeof isOpen === 'boolean' ? isOpen : open}\n onClickOutside={handleOnClickOutside}\n placement=\"bottom\"\n interactionType=\"click\"\n renderTrigger={RenderTrigger}\n showArrow\n style={{\n padding: '0',\n maxWidth: '1000px',\n width: 'fit-content',\n }}\n />\n );\n};\n\nDSAppPicker.displayName = DSAppPickerName;\nconst AppPickerWithSchema = describe(DSAppPicker);\nAppPickerWithSchema.propTypes = DSAppPickerPropTypes;\n\nexport { DSAppPicker, AppPickerWithSchema };\nexport default DSAppPicker;\n"],
5
- "mappings": "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",
6
- "names": []
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "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"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACejB;AAfN,SAAS,gBAAgB;AACzB,OAAOA,YAAW;AAClB,SAAS,oBAAoB;AAC7B,SAAS,uBAAuB;AAChC,SAAS,0BAA+C;AACxD,SAAS,wBAAwB;AAEjC,SAAS,kCAAkC;AAE3C,MAAM,cAAuD,CAAC,UAAU;AACtE,QAAM,kBAAkB,aAAa,KAAK;AAC1C,QAAM,MAAsBA,OAAM,QAAQ,OAAO,EAAE,GAAG,gBAAgB,IAAI,CAAC,eAAe,CAAC;AAE3F,SACE,oBAAC,mBAAmB,UAAnB,EAA4B,OAAO,KAClC,8BAAC,oBAAiB,GACpB;AAEJ;AAEA,YAAY,cAAc;AAC1B,MAAM,sBAAsB,SAAS,WAAW;AAChD,oBAAoB,YAAY;",
6
+ "names": ["React"]
7
7
  }
@@ -0,0 +1,8 @@
1
+ import * as React from "react";
2
+ import { createContext } from "react";
3
+ const defaultContext = {};
4
+ const DSAppPickerContext = createContext(defaultContext);
5
+ export {
6
+ DSAppPickerContext
7
+ };
8
+ //# sourceMappingURL=DSAppPickerCTX.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/DSAppPickerCTX.ts"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "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"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,qBAAqB;AAK9B,MAAM,iBAAiB,CAAC;AAIjB,MAAM,qBAAqB,cAA8B,cAAc;",
6
+ "names": []
7
+ }
@@ -1,28 +1,44 @@
1
1
  import * as React from "react";
2
- import React2 from "react";
3
2
  import {
3
+ useGetGlobalAttributes,
4
+ useGetXstyledProps,
4
5
  useMemoMergePropsWithDefault,
5
- useOwnerProps,
6
- useValidateTypescriptPropTypes,
7
- getGlobalAttributes,
8
- getXstyledProps
6
+ useOwnerProps
9
7
  } from "@elliemae/ds-props-helpers";
10
- import { defaultProps, DSAppPickerPropTypes } from "../react-desc-prop-types.js";
11
- import { DSAppPickerName } from "../constants/index.js";
8
+ import React2, { useMemo, useRef, useState } from "react";
9
+ import { uid } from "uid";
10
+ import { defaultProps, DSAppPickerPropTypesSchema } from "../react-desc-prop-types.js";
11
+ import { useFocusTracker } from "./useFocusTracker.js";
12
+ import { useValidateProps } from "./useValidateProps.js";
12
13
  const useAppPicker = (props) => {
13
14
  const propsWithDefault = useMemoMergePropsWithDefault(props, defaultProps);
14
- useValidateTypescriptPropTypes(propsWithDefault, DSAppPickerPropTypes, DSAppPickerName);
15
- const ownerPropsConfig = useOwnerProps(propsWithDefault, { ...props });
16
- const globalAttributes = getGlobalAttributes(props);
17
- const xstyledProps = getXstyledProps(props);
15
+ useValidateProps(propsWithDefault, DSAppPickerPropTypesSchema);
16
+ const ownerPropsConfig = useOwnerProps(propsWithDefault, propsWithDefault);
17
+ const globalAttributes = useGetGlobalAttributes(props);
18
+ const xstyledProps = useGetXstyledProps(props);
19
+ const openIntentRef = useRef("pointer");
20
+ const { isOpen, apps, customApps, id } = propsWithDefault;
21
+ const [internalIsOpen, setInternalIsOpen] = useState(false);
22
+ const resolvedIsOpen = typeof isOpen === "boolean" ? isOpen : internalIsOpen;
23
+ const mountedOpenAutofocusPendingRef = useRef(resolvedIsOpen);
24
+ const allApps = useMemo(() => [...apps, ...customApps], [apps, customApps]);
25
+ const useFocusTrackerConfig = useMemo(() => ({ allApps }), [allApps]);
26
+ const focusTrackers = useFocusTracker(useFocusTrackerConfig);
27
+ const instanceUid = React2.useMemo(() => id || `ds-app-picker-${uid(5)}`, [id]);
18
28
  return React2.useMemo(
19
29
  () => ({
30
+ focusTrackers,
20
31
  propsWithDefault,
21
32
  ownerPropsConfig,
22
33
  globalAttributes,
23
- xstyledProps
34
+ xstyledProps,
35
+ openIntentRef,
36
+ mountedOpenAutofocusPendingRef,
37
+ resolvedIsOpen,
38
+ setInternalIsOpen,
39
+ instanceUid
24
40
  }),
25
- [propsWithDefault, ownerPropsConfig, globalAttributes, xstyledProps]
41
+ [focusTrackers, propsWithDefault, ownerPropsConfig, globalAttributes, xstyledProps, resolvedIsOpen, instanceUid]
26
42
  );
27
43
  };
28
44
  export {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/config/useAppPicker.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport {\n useMemoMergePropsWithDefault,\n useOwnerProps,\n useValidateTypescriptPropTypes,\n getGlobalAttributes,\n getXstyledProps,\n} from '@elliemae/ds-props-helpers';\nimport { type DSAppPickerT, defaultProps, DSAppPickerPropTypes } from '../react-desc-prop-types.js';\nimport { DSAppPickerName } from '../constants/index.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 useValidateTypescriptPropTypes(propsWithDefault, DSAppPickerPropTypes, DSAppPickerName);\n // =============================================================================\n // GLOBAL ATTRIBUTES & XSTYLED PROPS\n // =============================================================================\n const ownerPropsConfig = useOwnerProps(propsWithDefault, { ...props });\n\n const globalAttributes = getGlobalAttributes<DSAppPickerT.Props>(props);\n const xstyledProps = getXstyledProps<DSAppPickerT.Props>(props);\n return React.useMemo(\n () => ({\n propsWithDefault,\n ownerPropsConfig,\n globalAttributes,\n xstyledProps,\n }),\n [propsWithDefault, ownerPropsConfig, globalAttributes, xstyledProps],\n );\n};\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACAvB,OAAOA,YAAW;AAClB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAA4B,cAAc,4BAA4B;AACtE,SAAS,uBAAuB;AAEzB,MAAM,eAAe,CAAC,UAA8B;AAIzD,QAAM,mBAAmB,6BAAyD,OAAO,YAAY;AACrG,iCAA+B,kBAAkB,sBAAsB,eAAe;AAItF,QAAM,mBAAmB,cAAc,kBAAkB,EAAE,GAAG,MAAM,CAAC;AAErE,QAAM,mBAAmB,oBAAwC,KAAK;AACtE,QAAM,eAAe,gBAAoC,KAAK;AAC9D,SAAOA,OAAM;AAAA,IACX,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,CAAC,kBAAkB,kBAAkB,kBAAkB,YAAY;AAAA,EACrE;AACF;",
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/config/useAppPicker.ts"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import {\n useGetGlobalAttributes,\n useGetXstyledProps,\n useMemoMergePropsWithDefault,\n useOwnerProps,\n} from '@elliemae/ds-props-helpers';\nimport React, { useMemo, useRef, useState } from 'react';\nimport { uid } from 'uid';\nimport { type DSAppPickerT, defaultProps, DSAppPickerPropTypesSchema } from '../react-desc-prop-types.js';\nimport { useFocusTracker } from './useFocusTracker.js';\nimport { useValidateProps } from './useValidateProps.js';\n\nexport const useAppPicker = (props: DSAppPickerT.Props) => {\n // =============================================================================\n // MERGE WITH DEFAULT AND VALIDATE PROPS\n // =============================================================================\n const propsWithDefault = useMemoMergePropsWithDefault<DSAppPickerT.InternalProps>(props, defaultProps);\n useValidateProps(propsWithDefault, DSAppPickerPropTypesSchema);\n // =============================================================================\n // GLOBAL ATTRIBUTES & XSTYLED PROPS\n // =============================================================================\n // Use propsWithDefault (stable, deep-comparison memoized) instead of { ...props }\n // to prevent getOwnerPropsArguments from creating a new object reference every render.\n const ownerPropsConfig = useOwnerProps(propsWithDefault, propsWithDefault);\n\n const globalAttributes = useGetGlobalAttributes<DSAppPickerT.Props>(props);\n const xstyledProps = useGetXstyledProps<DSAppPickerT.Props>(props);\n // =============================================================================\n // Specific component state and logics\n // =============================================================================\n /*\n * HOW the pending open was triggered, which is the only input to where initial focus lands.\n *\n * A union rather than a boolean because there are three landings, not two: a pointer open goes to the\n * panel, ArrowDown-style keyboard activation goes to the selection or the FIRST item, and ArrowUp goes to\n * the selection or the LAST one. Keeping it as one value means there is exactly one thing to read in\n * handleFloatingOpen, so nothing else can end up writing a competing focus intent.\n */\n const openIntentRef = useRef<DSAppPickerT.OpenIntent>('pointer');\n\n // \"Is the panel open\" is top-level component state. `isOpen` (controlled) takes precedence over\n // the internal state when provided. resolvedIsOpen feeds useFloatingContext's\n // externallyControlledIsOpen; initial-focus-on-open is driven off useFloatingContext's onOpen\n // (which fires on that transition), so the focus tracker itself stays a pure region tracker with\n // no open-state awareness.\n const { isOpen, apps, customApps, id } = propsWithDefault;\n const [internalIsOpen, setInternalIsOpen] = useState(false);\n const resolvedIsOpen = typeof isOpen === 'boolean' ? isOpen : internalIsOpen;\n\n // Was DSAppPicker rendered already-open at mount (declarative `isOpen`, before any user\n // interaction)? Such an open is not a transition, so useAppPickerFloatingContext's onOpen seed\n // never fires for it \u2014 AppPanel's useMountedOpenAutofocusNuance consumes this to seed that one\n // case. Captured once; the nuance flips it false after consuming so a later controlled reopen\n // (a real transition, handled by onOpen) doesn't re-trigger it.\n const mountedOpenAutofocusPendingRef = useRef(resolvedIsOpen);\n\n const allApps = useMemo(() => [...apps, ...customApps], [apps, customApps]);\n const useFocusTrackerConfig = useMemo(() => ({ allApps }), [allApps]);\n const focusTrackers = useFocusTracker(useFocusTrackerConfig);\n\n const instanceUid = React.useMemo(() => id || `ds-app-picker-${uid(5)}`, [id]);\n\n return React.useMemo(\n () => ({\n focusTrackers,\n propsWithDefault,\n ownerPropsConfig,\n globalAttributes,\n xstyledProps,\n openIntentRef,\n mountedOpenAutofocusPendingRef,\n resolvedIsOpen,\n setInternalIsOpen,\n instanceUid,\n }),\n [focusTrackers, propsWithDefault, ownerPropsConfig, globalAttributes, xstyledProps, resolvedIsOpen, instanceUid],\n );\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,OAAOA,UAAS,SAAS,QAAQ,gBAAgB;AACjD,SAAS,WAAW;AACpB,SAA4B,cAAc,kCAAkC;AAC5E,SAAS,uBAAuB;AAChC,SAAS,wBAAwB;AAE1B,MAAM,eAAe,CAAC,UAA8B;AAIzD,QAAM,mBAAmB,6BAAyD,OAAO,YAAY;AACrG,mBAAiB,kBAAkB,0BAA0B;AAM7D,QAAM,mBAAmB,cAAc,kBAAkB,gBAAgB;AAEzE,QAAM,mBAAmB,uBAA2C,KAAK;AACzE,QAAM,eAAe,mBAAuC,KAAK;AAYjE,QAAM,gBAAgB,OAAgC,SAAS;AAO/D,QAAM,EAAE,QAAQ,MAAM,YAAY,GAAG,IAAI;AACzC,QAAM,CAAC,gBAAgB,iBAAiB,IAAI,SAAS,KAAK;AAC1D,QAAM,iBAAiB,OAAO,WAAW,YAAY,SAAS;AAO9D,QAAM,iCAAiC,OAAO,cAAc;AAE5D,QAAM,UAAU,QAAQ,MAAM,CAAC,GAAG,MAAM,GAAG,UAAU,GAAG,CAAC,MAAM,UAAU,CAAC;AAC1E,QAAM,wBAAwB,QAAQ,OAAO,EAAE,QAAQ,IAAI,CAAC,OAAO,CAAC;AACpE,QAAM,gBAAgB,gBAAgB,qBAAqB;AAE3D,QAAM,cAAcA,OAAM,QAAQ,MAAM,MAAM,iBAAiB,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;AAE7E,SAAOA,OAAM;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
  }