@elliemae/ds-left-navigation-tree 0.0.0-stage → 3.80.0-next.38

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 (107) hide show
  1. package/dist/cjs/DSLeftNavigationTree.js +46 -0
  2. package/dist/cjs/DSLeftNavigationTree.js.map +7 -0
  3. package/dist/cjs/config/store.js +63 -0
  4. package/dist/cjs/config/store.js.map +7 -0
  5. package/dist/cjs/config/treeModel.js +178 -0
  6. package/dist/cjs/config/treeModel.js.map +7 -0
  7. package/dist/cjs/config/useAutoCalculated.js +37 -0
  8. package/dist/cjs/config/useAutoCalculated.js.map +7 -0
  9. package/dist/cjs/config/useFocusTracker.js +63 -0
  10. package/dist/cjs/config/useFocusTracker.js.map +7 -0
  11. package/dist/cjs/config/useTreeHandlers.js +157 -0
  12. package/dist/cjs/config/useTreeHandlers.js.map +7 -0
  13. package/dist/cjs/config/useTreeModel.js +110 -0
  14. package/dist/cjs/config/useTreeModel.js.map +7 -0
  15. package/dist/cjs/config/useValidateProps.js +40 -0
  16. package/dist/cjs/config/useValidateProps.js.map +7 -0
  17. package/dist/cjs/constants/index.js +79 -0
  18. package/dist/cjs/constants/index.js.map +7 -0
  19. package/dist/cjs/index.js +46 -0
  20. package/dist/cjs/index.js.map +7 -0
  21. package/dist/cjs/package.json +7 -0
  22. package/dist/cjs/parts/Footer.js +83 -0
  23. package/dist/cjs/parts/Footer.js.map +7 -0
  24. package/dist/cjs/parts/Header.js +114 -0
  25. package/dist/cjs/parts/Header.js.map +7 -0
  26. package/dist/cjs/parts/MainContent.js +95 -0
  27. package/dist/cjs/parts/MainContent.js.map +7 -0
  28. package/dist/cjs/parts/RailItem.js +109 -0
  29. package/dist/cjs/parts/RailItem.js.map +7 -0
  30. package/dist/cjs/parts/TreeContext.js +37 -0
  31. package/dist/cjs/parts/TreeContext.js.map +7 -0
  32. package/dist/cjs/parts/TreeItem.js +171 -0
  33. package/dist/cjs/parts/TreeItem.js.map +7 -0
  34. package/dist/cjs/parts/TreeRoot.js +76 -0
  35. package/dist/cjs/parts/TreeRoot.js.map +7 -0
  36. package/dist/cjs/parts/styled.js +221 -0
  37. package/dist/cjs/parts/styled.js.map +7 -0
  38. package/dist/cjs/react-desc-prop-types.js +125 -0
  39. package/dist/cjs/react-desc-prop-types.js.map +7 -0
  40. package/dist/cjs/typescript-testing/DSLeftNavigationTreeNamespace.js +172 -0
  41. package/dist/cjs/typescript-testing/DSLeftNavigationTreeNamespace.js.map +7 -0
  42. package/dist/cjs/typescript-testing/slot-props.js +82 -0
  43. package/dist/cjs/typescript-testing/slot-props.js.map +7 -0
  44. package/dist/esm/DSLeftNavigationTree.js +16 -0
  45. package/dist/esm/DSLeftNavigationTree.js.map +7 -0
  46. package/dist/esm/config/store.js +33 -0
  47. package/dist/esm/config/store.js.map +7 -0
  48. package/dist/esm/config/treeModel.js +148 -0
  49. package/dist/esm/config/treeModel.js.map +7 -0
  50. package/dist/esm/config/useAutoCalculated.js +7 -0
  51. package/dist/esm/config/useAutoCalculated.js.map +7 -0
  52. package/dist/esm/config/useFocusTracker.js +33 -0
  53. package/dist/esm/config/useFocusTracker.js.map +7 -0
  54. package/dist/esm/config/useTreeHandlers.js +133 -0
  55. package/dist/esm/config/useTreeHandlers.js.map +7 -0
  56. package/dist/esm/config/useTreeModel.js +90 -0
  57. package/dist/esm/config/useTreeModel.js.map +7 -0
  58. package/dist/esm/config/useValidateProps.js +10 -0
  59. package/dist/esm/config/useValidateProps.js.map +7 -0
  60. package/dist/esm/constants/index.js +49 -0
  61. package/dist/esm/constants/index.js.map +7 -0
  62. package/dist/esm/index.js +25 -0
  63. package/dist/esm/index.js.map +7 -0
  64. package/dist/esm/package.json +7 -0
  65. package/dist/esm/parts/Footer.js +53 -0
  66. package/dist/esm/parts/Footer.js.map +7 -0
  67. package/dist/esm/parts/Header.js +91 -0
  68. package/dist/esm/parts/Header.js.map +7 -0
  69. package/dist/esm/parts/MainContent.js +69 -0
  70. package/dist/esm/parts/MainContent.js.map +7 -0
  71. package/dist/esm/parts/RailItem.js +79 -0
  72. package/dist/esm/parts/RailItem.js.map +7 -0
  73. package/dist/esm/parts/TreeContext.js +7 -0
  74. package/dist/esm/parts/TreeContext.js.map +7 -0
  75. package/dist/esm/parts/TreeItem.js +149 -0
  76. package/dist/esm/parts/TreeItem.js.map +7 -0
  77. package/dist/esm/parts/TreeRoot.js +46 -0
  78. package/dist/esm/parts/TreeRoot.js.map +7 -0
  79. package/dist/esm/parts/styled.js +191 -0
  80. package/dist/esm/parts/styled.js.map +7 -0
  81. package/dist/esm/react-desc-prop-types.js +105 -0
  82. package/dist/esm/react-desc-prop-types.js.map +7 -0
  83. package/dist/esm/typescript-testing/DSLeftNavigationTreeNamespace.js +149 -0
  84. package/dist/esm/typescript-testing/DSLeftNavigationTreeNamespace.js.map +7 -0
  85. package/dist/esm/typescript-testing/slot-props.js +59 -0
  86. package/dist/esm/typescript-testing/slot-props.js.map +7 -0
  87. package/dist/types/DSLeftNavigationTree.d.ts +4 -0
  88. package/dist/types/config/store.d.ts +38 -0
  89. package/dist/types/config/treeModel.d.ts +69 -0
  90. package/dist/types/config/useAutoCalculated.d.ts +1 -0
  91. package/dist/types/config/useFocusTracker.d.ts +11 -0
  92. package/dist/types/config/useTreeHandlers.d.ts +11 -0
  93. package/dist/types/config/useTreeModel.d.ts +22 -0
  94. package/dist/types/config/useValidateProps.d.ts +3 -0
  95. package/dist/types/constants/index.d.ts +54 -0
  96. package/dist/types/index.d.ts +3 -0
  97. package/dist/types/parts/Footer.d.ts +2 -0
  98. package/dist/types/parts/Header.d.ts +2 -0
  99. package/dist/types/parts/MainContent.d.ts +2 -0
  100. package/dist/types/parts/RailItem.d.ts +8 -0
  101. package/dist/types/parts/TreeContext.d.ts +11 -0
  102. package/dist/types/parts/TreeItem.d.ts +4 -0
  103. package/dist/types/parts/TreeRoot.d.ts +9 -0
  104. package/dist/types/parts/styled.d.ts +46 -0
  105. package/dist/types/react-desc-prop-types.d.ts +99 -0
  106. package/package.json +72 -4
  107. package/README.md +0 -3
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/config/useTreeHandlers.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import type React from 'react';\nimport { useMemo, useRef } from 'react';\nimport { LEFT_NAVIGATION_TREE_ITEM_TYPES, LEFT_NAVIGATION_TREE_REGION_FOCUSES } from '../constants/index.js';\nimport type { DSLeftNavigationTreeT } from '../react-desc-prop-types.js';\nimport { useInternalStore, usePropsStore } from './store.js';\nimport { useFocusTracker } from './useFocusTracker.js';\nimport type { TreeModel } from './useTreeModel.js';\nimport {\n type TreeNodeInfo,\n getDefaultSelection,\n getTypeaheadMatchId,\n hasChildren,\n isControlledParent,\n isDescendantOf,\n} from './treeModel.js';\n\ntype InteractionEvent = DSLeftNavigationTreeT.InteractionEvent;\n\nconst getNodeId = (target: EventTarget | null): string | undefined => (target as HTMLElement | null)?.dataset?.dsid;\n\nexport const useTreeHandlers = (model: TreeModel) => {\n const onItemClick = usePropsStore((state) => state.onItemClick);\n const onItemOpenedChange = usePropsStore((state) => state.onItemOpenedChange);\n const onSelectedChange = usePropsStore((state) => state.onSelectedChange);\n const onFocusChange = usePropsStore((state) => state.onFocusChange);\n const disableDefaultSelection = usePropsStore((state) => state.disableDefaultSelection);\n const selectedItem = usePropsStore((state) => state.selectedItem);\n const setToggles = useInternalStore((state) => state.setToggles);\n const setInternalSelectedItem = useInternalStore((state) => state.setInternalSelectedItem);\n const getFocusRegion = useInternalStore((state) => state.getFocusRegion);\n const { trackFocusItem, trackFocusRegionReset } = useFocusTracker();\n\n /** Last id reported through onFocusChange, so the callback fires once per actual focus move. */\n const reportedFocusId = useRef<string | null>(null);\n\n return useMemo(() => {\n const { index, openIds, visibleIds, isRail } = model;\n\n const select = (id: string) => {\n if (selectedItem === undefined) setInternalSelectedItem(id);\n if (id !== model.currentId) onSelectedChange(id);\n };\n\n const setOpen = (id: string, nextIsOpened: boolean, e: InteractionEvent) => {\n const info = index.get(id);\n if (!info) return;\n if (!isControlledParent(info.item)) setToggles((toggles) => ({ ...toggles, [id]: nextIsOpened }));\n onItemOpenedChange(info.item, nextIsOpened, e);\n };\n\n const activateParent = (id: string, e: InteractionEvent) => {\n const isOpen = openIds.has(id);\n /** From the rail the spec \"expands the panel and section\", so a parent only ever opens there. */\n const nextIsOpened = isRail || !isOpen;\n if (nextIsOpened !== isOpen) setOpen(id, nextIsOpened, e);\n if (!nextIsOpened || disableDefaultSelection || isDescendantOf(index, id, model.currentLeafId)) return;\n const { leafId, parentIdsToOpen } = getDefaultSelection(index, id);\n if (!leafId) return;\n parentIdsToOpen.filter((parentId) => !openIds.has(parentId)).forEach((parentId) => setOpen(parentId, true, e));\n select(leafId);\n };\n\n const activate = (id: string, e: InteractionEvent) => {\n const info = index.get(id);\n if (!info) return;\n onItemClick(info.item, e);\n if (hasChildren(info)) {\n activateParent(id, e);\n return;\n }\n if (info.item.type === LEFT_NAVIGATION_TREE_ITEM_TYPES.LEAF && info.item.itemOpts?.selectable !== false) {\n select(id);\n }\n };\n\n const moveTo = (targetId: string | undefined) => {\n if (targetId) trackFocusItem(targetId);\n };\n\n const keyHandlers: Record<string, (id: string, info: TreeNodeInfo, e: InteractionEvent) => void> = {\n ArrowDown: (id) => moveTo(visibleIds[visibleIds.indexOf(id) + 1]),\n ArrowUp: (id) => moveTo(visibleIds[visibleIds.indexOf(id) - 1]),\n Home: () => moveTo(visibleIds[0]),\n End: () => moveTo(visibleIds[visibleIds.length - 1]),\n ArrowRight: (id, info, e) => {\n if (isRail || !hasChildren(info)) return;\n if (!openIds.has(id)) setOpen(id, true, e);\n else moveTo(info.childIds[0]);\n },\n ArrowLeft: (id, info, e) => {\n if (isRail) return;\n if (hasChildren(info) && openIds.has(id)) setOpen(id, false, e);\n else moveTo(info.parentId ?? undefined);\n },\n Enter: (id, _info, e) => activate(id, e),\n ' ': (id, _info, e) => activate(id, e),\n };\n\n const onTreeKeyDown = (e: React.KeyboardEvent<HTMLElement>) => {\n if (e.ctrlKey || e.altKey || e.metaKey) return;\n const id = getNodeId(e.target);\n const info = id ? index.get(id) : undefined;\n if (!id || !info) return;\n const keyHandler = keyHandlers[e.key];\n if (keyHandler) {\n keyHandler(id, info, e);\n e.preventDefault();\n return;\n }\n if (e.key.length !== 1) return;\n const matchId = getTypeaheadMatchId({ index, visibleIds, fromId: id, character: e.key });\n if (!matchId) return;\n trackFocusItem(matchId);\n e.preventDefault();\n };\n\n const onTreeFocus = (e: React.FocusEvent<HTMLElement>) => {\n const id = getNodeId(e.target);\n if (!id || !index.has(id)) return;\n trackFocusItem(id);\n if (reportedFocusId.current !== id) {\n reportedFocusId.current = id;\n onFocusChange(id);\n }\n };\n\n const onTreeBlur = (e: React.FocusEvent<HTMLElement>) => {\n const next = e.relatedTarget as Node | null;\n if (next && e.currentTarget.contains(next)) return;\n /** A removed node cannot be the reason focus left: keep the identity so the fallback can run. */\n if (!(e.target as Element).isConnected) return;\n reportedFocusId.current = null;\n if (getFocusRegion() === LEFT_NAVIGATION_TREE_REGION_FOCUSES.TREE) trackFocusRegionReset();\n };\n\n return { activate, onTreeKeyDown, onTreeFocus, onTreeBlur };\n }, [\n model,\n selectedItem,\n disableDefaultSelection,\n onItemClick,\n onItemOpenedChange,\n onSelectedChange,\n onFocusChange,\n setToggles,\n setInternalSelectedItem,\n getFocusRegion,\n trackFocusItem,\n trackFocusRegionReset,\n ]);\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,mBAAgC;AAChC,uBAAqF;AAErF,mBAAgD;AAChD,6BAAgC;AAEhC,uBAOO;AAIP,MAAM,YAAY,CAAC,WAAoD,QAA+B,SAAS;AAExG,MAAM,kBAAkB,CAAC,UAAqB;AACnD,QAAM,kBAAc,4BAAc,CAAC,UAAU,MAAM,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AAA,EAC5D,GAAG;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACH;",
6
+ "names": []
7
+ }
@@ -0,0 +1,110 @@
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 useTreeModel_exports = {};
30
+ __export(useTreeModel_exports, {
31
+ useIsFooterFocusTarget: () => useIsFooterFocusTarget,
32
+ useItemFocusState: () => useItemFocusState,
33
+ useTreeModel: () => useTreeModel
34
+ });
35
+ module.exports = __toCommonJS(useTreeModel_exports);
36
+ var React = __toESM(require("react"));
37
+ var import_react = require("react");
38
+ var import_constants = require("../constants/index.js");
39
+ var import_store = require("./store.js");
40
+ var import_treeModel = require("./treeModel.js");
41
+ const useTreeModel = () => {
42
+ const items = (0, import_store.usePropsStore)((state) => state.items);
43
+ const expanded = (0, import_store.usePropsStore)((state) => state.expanded);
44
+ const selectedItem = (0, import_store.usePropsStore)((state) => state.selectedItem);
45
+ const selectedParent = (0, import_store.usePropsStore)((state) => state.selectedParent);
46
+ const headerItem = (0, import_store.usePropsStore)((state) => state.HeaderComponent);
47
+ const openedItem = (0, import_store.usePropsStore)((state) => state.openedItem);
48
+ const toggles = (0, import_store.useInternalStore)((state) => state.toggles);
49
+ const internalSelectedItem = (0, import_store.useInternalStore)((state) => state.internalSelectedItem);
50
+ const [seed] = (0, import_react.useState)(
51
+ () => new Set((0, import_treeModel.getAncestorIds)((0, import_treeModel.buildTreeIndex)(items), selectedItem ?? internalSelectedItem))
52
+ );
53
+ return (0, import_react.useMemo)(() => {
54
+ const index = (0, import_treeModel.buildTreeIndex)(items);
55
+ const isRail = !expanded;
56
+ const isHeaderOpen = !!headerItem && openedItem === headerItem.dsId;
57
+ const openIds = /* @__PURE__ */ new Set();
58
+ index.forEach((info) => {
59
+ if ((0, import_treeModel.resolveIsOpen)(info, toggles, seed)) openIds.add(info.id);
60
+ });
61
+ let visibleIds = [];
62
+ if (isRail) visibleIds = (0, import_treeModel.getRailIds)(items);
63
+ else visibleIds = (0, import_treeModel.getVisibleIds)(index, items, (id) => openIds.has(id));
64
+ const visible = new Set(visibleIds);
65
+ const currentId = selectedItem !== void 0 ? selectedItem : internalSelectedItem;
66
+ const currentLeafId = currentId && index.get(currentId)?.item.type === import_constants.LEFT_NAVIGATION_TREE_ITEM_TYPES.LEAF ? currentId : null;
67
+ const selectedParentIds = new Set(
68
+ selectedParent !== void 0 ? [selectedParent] : (0, import_treeModel.getAncestorIds)(index, currentLeafId)
69
+ );
70
+ const documentOrder = (0, import_treeModel.getDocumentOrder)(index, items);
71
+ const cache = { key: null, target: null };
72
+ const resolveFocusTarget = (focusRegion, focusedItemId) => {
73
+ if (focusRegion !== import_constants.LEFT_NAVIGATION_TREE_REGION_FOCUSES.TREE || !focusedItemId) return null;
74
+ if (visible.has(focusedItemId)) return { kind: "item", id: focusedItemId };
75
+ if (cache.key !== focusedItemId) {
76
+ cache.key = focusedItemId;
77
+ cache.target = (0, import_treeModel.resolveFallbackTarget)({
78
+ index,
79
+ documentOrder,
80
+ visibleIds,
81
+ lostId: focusedItemId,
82
+ currentId: currentLeafId
83
+ });
84
+ }
85
+ return cache.target;
86
+ };
87
+ return {
88
+ items,
89
+ index,
90
+ rowPaddings: (0, import_treeModel.getRowPaddings)(index),
91
+ isRail,
92
+ headerItem,
93
+ isHeaderOpen,
94
+ openIds,
95
+ visibleIds,
96
+ currentId,
97
+ currentLeafId,
98
+ selectedParentIds,
99
+ chainTabStopId: (0, import_treeModel.getTabStopChainId)(index, visibleIds, currentLeafId),
100
+ resolveFocusTarget
101
+ };
102
+ }, [items, expanded, headerItem, openedItem, toggles, seed, selectedItem, internalSelectedItem, selectedParent]);
103
+ };
104
+ const useItemFocusState = (model, id) => (0, import_store.useInternalStore)((state) => {
105
+ const target = model.resolveFocusTarget(state.focusRegion, state.focusedItemId);
106
+ if (target?.kind === "item") return target.id === id ? "focus-target" : "none";
107
+ return model.chainTabStopId === id ? "tab-stop" : "none";
108
+ });
109
+ const useIsFooterFocusTarget = (model) => (0, import_store.useInternalStore)((state) => model.resolveFocusTarget(state.focusRegion, state.focusedItemId)?.kind === "footer");
110
+ //# sourceMappingURL=useTreeModel.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/config/useTreeModel.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["/* eslint-disable complexity */\nimport { useMemo, useState } from 'react';\nimport { LEFT_NAVIGATION_TREE_ITEM_TYPES, LEFT_NAVIGATION_TREE_REGION_FOCUSES } from '../constants/index.js';\nimport type { DSLeftNavigationTreeT } from '../react-desc-prop-types.js';\nimport { useInternalStore, usePropsStore } from './store.js';\nimport {\n type FocusTarget,\n type TreeIndex,\n buildTreeIndex,\n getAncestorIds,\n getDocumentOrder,\n getRowPaddings,\n getRailIds,\n getTabStopChainId,\n getVisibleIds,\n resolveFallbackTarget,\n resolveIsOpen,\n} from './treeModel.js';\n\nexport type TreeModel = {\n items: readonly DSLeftNavigationTreeT.Item[];\n index: TreeIndex;\n isRail: boolean;\n headerItem: DSLeftNavigationTreeT.Item | undefined;\n isHeaderOpen: boolean;\n openIds: ReadonlySet<string>;\n visibleIds: string[];\n currentId: string | null;\n currentLeafId: string | null;\n selectedParentIds: ReadonlySet<string>;\n chainTabStopId: string | null;\n resolveFocusTarget: (focusRegion: string, focusedItemId: string | null) => FocusTarget;\n rowPaddings: ReadonlyMap<string, number>;\n};\n\nexport const useTreeModel = (): TreeModel => {\n const items = usePropsStore((state) => state.items);\n const expanded = usePropsStore((state) => state.expanded);\n const selectedItem = usePropsStore((state) => state.selectedItem);\n const selectedParent = usePropsStore((state) => state.selectedParent);\n const headerItem = usePropsStore((state) => state.HeaderComponent);\n const openedItem = usePropsStore((state) => state.openedItem);\n\n const toggles = useInternalStore((state) => state.toggles);\n const internalSelectedItem = useInternalStore((state) => state.internalSelectedItem);\n\n /**\n * Captured once from the first render's props: ancestors of the initial current page start open.\n * Later selection changes never reopen branches (the tab stop falls back to the nearest visible ancestor).\n */\n const [seed] = useState<ReadonlySet<string>>(\n () => new Set(getAncestorIds(buildTreeIndex(items), selectedItem ?? internalSelectedItem)),\n );\n\n return useMemo(() => {\n const index = buildTreeIndex(items);\n const isRail = !expanded;\n const isHeaderOpen = !!headerItem && openedItem === headerItem.dsId;\n\n const openIds = new Set<string>();\n index.forEach((info) => {\n if (resolveIsOpen(info, toggles, seed)) openIds.add(info.id);\n });\n\n let visibleIds: string[] = [];\n if (isRail) visibleIds = getRailIds(items);\n else visibleIds = getVisibleIds(index, items, (id) => openIds.has(id));\n const visible = new Set(visibleIds);\n\n const currentId = selectedItem !== undefined ? selectedItem : internalSelectedItem;\n const currentLeafId =\n currentId && index.get(currentId)?.item.type === LEFT_NAVIGATION_TREE_ITEM_TYPES.LEAF ? currentId : null;\n const selectedParentIds: ReadonlySet<string> = new Set(\n selectedParent !== undefined ? [selectedParent] : getAncestorIds(index, currentLeafId),\n );\n\n const documentOrder = getDocumentOrder(index, items);\n const cache: { key: string | null; target: FocusTarget } = { key: null, target: null };\n /**\n * Derived from the store by each item's own selector, so a focus move re-renders only the items whose\n * flags change. Cached because every rendered item calls it with the same arguments on each store update.\n */\n const resolveFocusTarget = (focusRegion: string, focusedItemId: string | null): FocusTarget => {\n if (focusRegion !== LEFT_NAVIGATION_TREE_REGION_FOCUSES.TREE || !focusedItemId) return null;\n if (visible.has(focusedItemId)) return { kind: 'item', id: focusedItemId };\n if (cache.key !== focusedItemId) {\n cache.key = focusedItemId;\n cache.target = resolveFallbackTarget({\n index,\n documentOrder,\n visibleIds,\n lostId: focusedItemId,\n currentId: currentLeafId,\n });\n }\n return cache.target;\n };\n\n return {\n items,\n index,\n rowPaddings: getRowPaddings(index),\n isRail,\n headerItem,\n isHeaderOpen,\n openIds,\n visibleIds,\n currentId,\n currentLeafId,\n selectedParentIds,\n chainTabStopId: getTabStopChainId(index, visibleIds, currentLeafId),\n resolveFocusTarget,\n };\n }, [items, expanded, headerItem, openedItem, toggles, seed, selectedItem, internalSelectedItem, selectedParent]);\n};\n\nexport type ItemFocusState = 'focus-target' | 'tab-stop' | 'none';\n\n/** Primitive per-item result: the item re-renders only when its own focus state changes. */\nexport const useItemFocusState = (model: TreeModel, id: string): ItemFocusState =>\n useInternalStore((state) => {\n const target = model.resolveFocusTarget(state.focusRegion, state.focusedItemId);\n if (target?.kind === 'item') return target.id === id ? 'focus-target' : 'none';\n return model.chainTabStopId === id ? 'tab-stop' : 'none';\n });\n\nexport const useIsFooterFocusTarget = (model: TreeModel): boolean =>\n useInternalStore((state)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BAAmB,KAAK,aAAa;AACpD,CAAC;AAEI,MAAM,yBAAyB,CAAC,cACrC,+BAAiB,CAAC,UAAU,MAAM,mBAAmB,MAAM,aAAa,MAAM,aAAa,GAAG,SAAS,QAAQ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var useValidateProps_exports = {};
30
+ __export(useValidateProps_exports, {
31
+ useValidateProps: () => useValidateProps
32
+ });
33
+ module.exports = __toCommonJS(useValidateProps_exports);
34
+ var React = __toESM(require("react"));
35
+ var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
36
+ var import_constants = require("../constants/index.js");
37
+ const useValidateProps = (props, propTypes) => {
38
+ (0, import_ds_props_helpers.useValidateTypescriptPropTypes)(props, propTypes, import_constants.DSLeftNavigationTreeName);
39
+ };
40
+ //# sourceMappingURL=useValidateProps.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/config/useValidateProps.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import { useValidateTypescriptPropTypes } from '@elliemae/ds-props-helpers';\nimport type { ValidationMap } from '@elliemae/ds-props-helpers';\nimport { type DSLeftNavigationTreeT } from '../react-desc-prop-types.js';\nimport { DSLeftNavigationTreeName } from '../constants/index.js';\n\nexport const useValidateProps = (\n props: DSLeftNavigationTreeT.InternalProps,\n propTypes: ValidationMap<unknown>,\n): void => {\n // we validate the \"required if\" via 'isRequiredIf from our custom PropTypes\n useValidateTypescriptPropTypes(props, propTypes, DSLeftNavigationTreeName);\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,8BAA+C;AAG/C,uBAAyC;AAElC,MAAM,mBAAmB,CAC9B,OACA,cACS;AAET,8DAA+B,OAAO,WAAW,yCAAwB;AAC3E;",
6
+ "names": []
7
+ }
@@ -0,0 +1,79 @@
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 constants_exports = {};
30
+ __export(constants_exports, {
31
+ DSLeftNavigationTreeName: () => DSLeftNavigationTreeName,
32
+ LEFT_NAVIGATION_TREE_DATA_TESTID: () => LEFT_NAVIGATION_TREE_DATA_TESTID,
33
+ LEFT_NAVIGATION_TREE_DEFAULT_LABEL: () => LEFT_NAVIGATION_TREE_DEFAULT_LABEL,
34
+ LEFT_NAVIGATION_TREE_ITEM_TYPES: () => LEFT_NAVIGATION_TREE_ITEM_TYPES,
35
+ LEFT_NAVIGATION_TREE_REGION_FOCUSES: () => LEFT_NAVIGATION_TREE_REGION_FOCUSES,
36
+ LEFT_NAVIGATION_TREE_SLOTS: () => LEFT_NAVIGATION_TREE_SLOTS
37
+ });
38
+ module.exports = __toCommonJS(constants_exports);
39
+ var React = __toESM(require("react"));
40
+ var import_ds_system = require("@elliemae/ds-system");
41
+ const DSLeftNavigationTreeName = "DSLeftnavigationtree";
42
+ const LEFT_NAVIGATION_TREE_ITEM_TYPES = {
43
+ LEAF: "ds-left-nav-tree-item-leaf",
44
+ PARENT: "ds-left-nav-tree-item-parent",
45
+ SECTION: "ds-left-nav-tree-item-section",
46
+ SEPARATOR: "ds-left-nav-tree-item-separator"
47
+ };
48
+ const LEFT_NAVIGATION_TREE_DEFAULT_LABEL = "Primary";
49
+ const LEFT_NAVIGATION_TREE_REGION_FOCUSES = {
50
+ RESET: "",
51
+ TREE: "tree",
52
+ HEADER: "header",
53
+ FOOTER: "footer"
54
+ };
55
+ const LEFT_NAVIGATION_TREE_SLOTS = {
56
+ ROOT: "root",
57
+ TREE: "tree",
58
+ ITEM: "item",
59
+ ITEM_ROW: "item-row",
60
+ ITEM_LABEL: "item-label",
61
+ LEFT_CONTAINER: "left-container",
62
+ COLLAPSED_CONTAINER: "collapsed-container",
63
+ RIGHT_CONTAINER: "right-container",
64
+ ARROW_CONTAINER: "arrow-container",
65
+ GROUP: "group",
66
+ SECTION_CONTAINER: "section-container",
67
+ SECTION_LABEL: "section-label",
68
+ ITEM_SEPARATOR: "item-separator",
69
+ HEADER_DISCLOSURE: "header-disclosure",
70
+ FOOTER_MENU: "footer-menu",
71
+ FOOTER_LABEL: "footer-label",
72
+ FOOTER_SEPARATOR: "footer-separator",
73
+ FOOTER_MENU_COLLAPSE: "footer-menu-collapse"
74
+ };
75
+ const LEFT_NAVIGATION_TREE_DATA_TESTID = (0, import_ds_system.slotObjectToDataTestIds)(
76
+ DSLeftNavigationTreeName,
77
+ LEFT_NAVIGATION_TREE_SLOTS
78
+ );
79
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/constants/index.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import { slotObjectToDataTestIds } from '@elliemae/ds-system';\n\nexport const DSLeftNavigationTreeName = 'DSLeftnavigationtree';\n\nexport const LEFT_NAVIGATION_TREE_ITEM_TYPES = {\n LEAF: 'ds-left-nav-tree-item-leaf',\n PARENT: 'ds-left-nav-tree-item-parent',\n SECTION: 'ds-left-nav-tree-item-section',\n SEPARATOR: 'ds-left-nav-tree-item-separator',\n} as const;\n\nexport const LEFT_NAVIGATION_TREE_DEFAULT_LABEL = 'Primary';\n\n// we are naming this with the ${component_name}_region_focuses convention to namespace & avoid errors on duplicate exports variables in aggregators\nexport const LEFT_NAVIGATION_TREE_REGION_FOCUSES = {\n RESET: '',\n TREE: 'tree',\n HEADER: 'header',\n FOOTER: 'footer',\n} as const;\n\n// we are naming this with the ${component_name}_slots convention to namespace & avoid errors on duplicate exports variables in aggregators\nexport const LEFT_NAVIGATION_TREE_SLOTS = {\n ROOT: 'root',\n TREE: 'tree',\n ITEM: 'item',\n ITEM_ROW: 'item-row',\n ITEM_LABEL: 'item-label',\n LEFT_CONTAINER: 'left-container',\n COLLAPSED_CONTAINER: 'collapsed-container',\n RIGHT_CONTAINER: 'right-container',\n ARROW_CONTAINER: 'arrow-container',\n GROUP: 'group',\n SECTION_CONTAINER: 'section-container',\n SECTION_LABEL: 'section-label',\n ITEM_SEPARATOR: 'item-separator',\n HEADER_DISCLOSURE: 'header-disclosure',\n FOOTER_MENU: 'footer-menu',\n FOOTER_LABEL: 'footer-label',\n FOOTER_SEPARATOR: 'footer-separator',\n FOOTER_MENU_COLLAPSE: 'footer-menu-collapse',\n} as const;\n\n// we are naming this with the ${component_name}_data_testid convention to namespace & avoid errors on duplicate exports variables in aggregators\nexport const LEFT_NAVIGATION_TREE_DATA_TESTID = slotObjectToDataTestIds(\n DSLeftNavigationTreeName,\n LEFT_NAVIGATION_TREE_SLOTS,\n);\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAAwC;AAEjC,MAAM,2BAA2B;AAEjC,MAAM,kCAAkC;AAAA,EAC7C,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,WAAW;AACb;AAEO,MAAM,qCAAqC;AAG3C,MAAM,sCAAsC;AAAA,EACjD,OAAO;AAAA,EACP,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,QAAQ;AACV;AAGO,MAAM,6BAA6B;AAAA,EACxC,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AAAA,EACN,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,gBAAgB;AAAA,EAChB,qBAAqB;AAAA,EACrB,iBAAiB;AAAA,EACjB,iBAAiB;AAAA,EACjB,OAAO;AAAA,EACP,mBAAmB;AAAA,EACnB,eAAe;AAAA,EACf,gBAAgB;AAAA,EAChB,mBAAmB;AAAA,EACnB,aAAa;AAAA,EACb,cAAc;AAAA,EACd,kBAAkB;AAAA,EAClB,sBAAsB;AACxB;AAGO,MAAM,uCAAmC;AAAA,EAC9C;AAAA,EACA;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,46 @@
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 index_exports = {};
30
+ __export(index_exports, {
31
+ DSLeftNavigationTree: () => import_DSLeftNavigationTree.DSLeftNavigationTree,
32
+ DSLeftNavigationTreeItemOptsSchema: () => import_react_desc_prop_types.DSLeftNavigationTreeItemOptsSchema,
33
+ DSLeftNavigationTreeItemSchema: () => import_react_desc_prop_types.DSLeftNavigationTreeItemSchema,
34
+ DSLeftNavigationTreeName: () => import_constants.DSLeftNavigationTreeName,
35
+ DSLeftNavigationTreeWithSchema: () => import_DSLeftNavigationTree.DSLeftNavigationTreeWithSchema,
36
+ LEFT_NAVIGATION_TREE_DATA_TESTID: () => import_constants.LEFT_NAVIGATION_TREE_DATA_TESTID,
37
+ LEFT_NAVIGATION_TREE_ITEM_TYPES: () => import_constants.LEFT_NAVIGATION_TREE_ITEM_TYPES,
38
+ LEFT_NAVIGATION_TREE_REGION_FOCUSES: () => import_constants.LEFT_NAVIGATION_TREE_REGION_FOCUSES,
39
+ LEFT_NAVIGATION_TREE_SLOTS: () => import_constants.LEFT_NAVIGATION_TREE_SLOTS
40
+ });
41
+ module.exports = __toCommonJS(index_exports);
42
+ var React = __toESM(require("react"));
43
+ var import_DSLeftNavigationTree = require("./DSLeftNavigationTree.js");
44
+ var import_react_desc_prop_types = require("./react-desc-prop-types.js");
45
+ var import_constants = require("./constants/index.js");
46
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/index.ts", "../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["// this is a workaround to typescript error TS2742\n// https://github.com/microsoft/TypeScript/issues/47663\nimport type {} from '@xstyled/system';\nexport { DSLeftNavigationTree, DSLeftNavigationTreeWithSchema } from './DSLeftNavigationTree.js';\nexport {\n type DSLeftNavigationTreeT,\n DSLeftNavigationTreeItemSchema,\n DSLeftNavigationTreeItemOptsSchema,\n} from './react-desc-prop-types.js';\nexport {\n DSLeftNavigationTreeName,\n LEFT_NAVIGATION_TREE_ITEM_TYPES,\n LEFT_NAVIGATION_TREE_REGION_FOCUSES,\n LEFT_NAVIGATION_TREE_SLOTS,\n LEFT_NAVIGATION_TREE_DATA_TESTID,\n} from './constants/index.js';\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADGvB,kCAAqE;AACrE,mCAIO;AACP,uBAMO;",
6
+ "names": []
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "type": "commonjs",
3
+ "sideEffects": [
4
+ "*.css",
5
+ "*.scss"
6
+ ]
7
+ }
@@ -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 Footer_exports = {};
30
+ __export(Footer_exports, {
31
+ Footer: () => Footer
32
+ });
33
+ module.exports = __toCommonJS(Footer_exports);
34
+ var React = __toESM(require("react"));
35
+ var import_jsx_runtime = require("react/jsx-runtime");
36
+ var import_react = require("react");
37
+ var import_ds_icons = require("@elliemae/ds-icons");
38
+ var import_TreeContext = require("./TreeContext.js");
39
+ var import_store = require("../config/store.js");
40
+ var import_useFocusTracker = require("../config/useFocusTracker.js");
41
+ var import_useTreeModel = require("../config/useTreeModel.js");
42
+ var import_styled = require("./styled.js");
43
+ const ICON_COLOR = ["brand-primary", "600"];
44
+ const Footer = () => {
45
+ const { model, getOwnerProps } = (0, import_react.useContext)(import_TreeContext.TreeContext);
46
+ const footerLabel = (0, import_store.usePropsStore)((state) => state.footerLabel);
47
+ const onFooterExpand = (0, import_store.usePropsStore)((state) => state.onFooterExpand);
48
+ const onFooterClose = (0, import_store.usePropsStore)((state) => state.onFooterClose);
49
+ const { trackFocusFooter } = (0, import_useFocusTracker.useFocusTracker)();
50
+ const expanded = !model.isRail;
51
+ const showLabel = expanded && !!footerLabel;
52
+ const isFocusTarget = (0, import_useTreeModel.useIsFooterFocusTarget)(model);
53
+ const focusRef = (0, import_react.useCallback)(
54
+ (node) => {
55
+ if (node && isFocusTarget) node.focus();
56
+ },
57
+ [isFocusTarget]
58
+ );
59
+ const handleClick = (0, import_react.useCallback)(
60
+ (e) => {
61
+ if (expanded) onFooterClose(e);
62
+ else onFooterExpand(e);
63
+ },
64
+ [expanded, onFooterClose, onFooterExpand]
65
+ );
66
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_styled.StyledFooterMenu, { expanded, getOwnerProps, children: [
67
+ showLabel ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styled.StyledFooterLabel, { getOwnerProps, children: footerLabel }) : null,
68
+ showLabel ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styled.StyledFooterSeparator, { "aria-hidden": "true", getOwnerProps }) : null,
69
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
70
+ import_styled.StyledFooterButton,
71
+ {
72
+ type: "button",
73
+ "aria-label": expanded ? "Collapse left navigation" : "Expand left navigation",
74
+ onClick: handleClick,
75
+ onFocus: trackFocusFooter,
76
+ innerRef: focusRef,
77
+ getOwnerProps,
78
+ children: expanded ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_icons.MenuCollapse, { size: "m", color: ICON_COLOR }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_icons.MenuExpand, { size: "m", color: ICON_COLOR })
79
+ }
80
+ )
81
+ ] });
82
+ };
83
+ //# sourceMappingURL=Footer.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/parts/Footer.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import React, { useCallback, useContext } from 'react';\nimport { MenuCollapse, MenuExpand } from '@elliemae/ds-icons';\nimport { TreeContext } from './TreeContext.js';\nimport { usePropsStore } from '../config/store.js';\nimport { useFocusTracker } from '../config/useFocusTracker.js';\nimport { useIsFooterFocusTarget } from '../config/useTreeModel.js';\nimport { StyledFooterButton, StyledFooterLabel, StyledFooterMenu, StyledFooterSeparator } from './styled.js';\n\nconst ICON_COLOR = ['brand-primary', '600'] as ['brand-primary', '600'];\n\nexport const Footer = () => {\n const { model, getOwnerProps } = useContext(TreeContext);\n const footerLabel = usePropsStore((state) => state.footerLabel);\n const onFooterExpand = usePropsStore((state) => state.onFooterExpand);\n const onFooterClose = usePropsStore((state) => state.onFooterClose);\n const { trackFocusFooter } = useFocusTracker();\n const expanded = !model.isRail;\n const showLabel = expanded && !!footerLabel;\n const isFocusTarget = useIsFooterFocusTarget(model);\n\n const focusRef = useCallback(\n (node: HTMLElement | null) => {\n if (node && isFocusTarget) node.focus();\n },\n [isFocusTarget],\n );\n const handleClick = useCallback(\n (e: React.MouseEvent<HTMLElement>) => {\n if (expanded) onFooterClose(e);\n else onFooterExpand(e);\n },\n [expanded, onFooterClose, onFooterExpand],\n );\n\n return (\n <StyledFooterMenu expanded={expanded} getOwnerProps={getOwnerProps}>\n {showLabel ? <StyledFooterLabel getOwnerProps={getOwnerProps}>{footerLabel}</StyledFooterLabel> : null}\n {showLabel ? <StyledFooterSeparator aria-hidden=\"true\" getOwnerProps={getOwnerProps} /> : null}\n <StyledFooterButton\n type=\"button\"\n aria-label={expanded ? 'Collapse left navigation' : 'Expand left navigation'}\n onClick={handleClick}\n onFocus={trackFocusFooter}\n innerRef={focusRef}\n getOwnerProps={getOwnerProps}\n >\n {expanded ? <MenuCollapse size=\"m\" color={ICON_COLOR} /> : <MenuExpand size=\"m\" color={ICON_COLOR} />}\n </StyledFooterButton>\n </StyledFooterMenu>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADmCnB;AAnCJ,mBAA+C;AAC/C,sBAAyC;AACzC,yBAA4B;AAC5B,mBAA8B;AAC9B,6BAAgC;AAChC,0BAAuC;AACvC,oBAA+F;AAE/F,MAAM,aAAa,CAAC,iBAAiB,KAAK;AAEnC,MAAM,SAAS,MAAM;AAC1B,QAAM,EAAE,OAAO,cAAc,QAAI,yBAAW,8BAAW;AACvD,QAAM,kBAAc,4BAAc,CAAC,UAAU,MAAM,WAAW;AAC9D,QAAM,qBAAiB,4BAAc,CAAC,UAAU,MAAM,cAAc;AACpE,QAAM,oBAAgB,4BAAc,CAAC,UAAU,MAAM,aAAa;AAClE,QAAM,EAAE,iBAAiB,QAAI,wCAAgB;AAC7C,QAAM,WAAW,CAAC,MAAM;AACxB,QAAM,YAAY,YAAY,CAAC,CAAC;AAChC,QAAM,oBAAgB,4CAAuB,KAAK;AAElD,QAAM,eAAW;AAAA,IACf,CAAC,SAA6B;AAC5B,UAAI,QAAQ,cAAe,MAAK,MAAM;AAAA,IACxC;AAAA,IACA,CAAC,aAAa;AAAA,EAChB;AACA,QAAM,kBAAc;AAAA,IAClB,CAAC,MAAqC;AACpC,UAAI,SAAU,eAAc,CAAC;AAAA,UACxB,gBAAe,CAAC;AAAA,IACvB;AAAA,IACA,CAAC,UAAU,eAAe,cAAc;AAAA,EAC1C;AAEA,SACE,6CAAC,kCAAiB,UAAoB,eACnC;AAAA,gBAAY,4CAAC,mCAAkB,eAA+B,uBAAY,IAAuB;AAAA,IACjG,YAAY,4CAAC,uCAAsB,eAAY,QAAO,eAA8B,IAAK;AAAA,IAC1F;AAAA,MAAC;AAAA;AAAA,QACC,MAAK;AAAA,QACL,cAAY,WAAW,6BAA6B;AAAA,QACpD,SAAS;AAAA,QACT,SAAS;AAAA,QACT,UAAU;AAAA,QACV;AAAA,QAEC,qBAAW,4CAAC,gCAAa,MAAK,KAAI,OAAO,YAAY,IAAK,4CAAC,8BAAW,MAAK,KAAI,OAAO,YAAY;AAAA;AAAA,IACrG;AAAA,KACF;AAEJ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,114 @@
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 Header_exports = {};
30
+ __export(Header_exports, {
31
+ HeaderDisclosure: () => HeaderDisclosure
32
+ });
33
+ module.exports = __toCommonJS(Header_exports);
34
+ var React = __toESM(require("react"));
35
+ var import_jsx_runtime = require("react/jsx-runtime");
36
+ var import_react = require("react");
37
+ var import_ds_icons = require("@elliemae/ds-icons");
38
+ var import_TreeContext = require("./TreeContext.js");
39
+ var import_store = require("../config/store.js");
40
+ var import_useFocusTracker = require("../config/useFocusTracker.js");
41
+ var import_styled = require("./styled.js");
42
+ const HIDDEN_LABEL_STYLE = { display: "none" };
43
+ const CHEVRON_COLOR = ["brand-primary", "800"];
44
+ const HeaderDisclosure = () => {
45
+ const { model, getOwnerProps, labelOverflow, getElementId } = (0, import_react.useContext)(import_TreeContext.TreeContext);
46
+ const onItemClick = (0, import_store.usePropsStore)((state) => state.onItemClick);
47
+ const { trackFocusHeader } = (0, import_useFocusTracker.useFocusTracker)();
48
+ const { headerItem, isHeaderOpen, isRail } = model;
49
+ const handleClick = (0, import_react.useCallback)(
50
+ (e) => {
51
+ if (headerItem) onItemClick(headerItem, e);
52
+ },
53
+ [headerItem, onItemClick]
54
+ );
55
+ const getOwnerPropsArguments = (0, import_react.useCallback)(
56
+ () => ({ item: headerItem, level: 1, isOpen: isHeaderOpen && !isRail, isCurrent: false }),
57
+ [headerItem, isHeaderOpen, isRail]
58
+ );
59
+ if (!headerItem) return null;
60
+ const { label, RightComponent } = headerItem.itemOpts ?? {};
61
+ const { CollapsedComponent } = headerItem;
62
+ const labelId = getElementId("label", headerItem.dsId);
63
+ const descriptionId = getElementId("description", headerItem.dsId);
64
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
65
+ import_styled.StyledHeaderDisclosure,
66
+ {
67
+ type: "button",
68
+ isRail,
69
+ isOpen: isHeaderOpen && !isRail,
70
+ "aria-labelledby": labelId,
71
+ "aria-describedby": RightComponent && !isRail ? descriptionId : void 0,
72
+ "aria-expanded": isRail ? void 0 : isHeaderOpen,
73
+ "aria-controls": isRail || model.visibleIds.length === 0 ? void 0 : getElementId("tree", "root"),
74
+ onClick: handleClick,
75
+ onFocus: trackFocusHeader,
76
+ getOwnerProps,
77
+ children: [
78
+ isRail ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styled.StyledCollapsedContainer, { getOwnerProps, getOwnerPropsArguments, children: CollapsedComponent ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CollapsedComponent, { item: headerItem }) : null }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styled.StyledLeftContainer, { getOwnerProps, getOwnerPropsArguments, children: CollapsedComponent ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CollapsedComponent, { item: headerItem }) : null }),
79
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
80
+ import_styled.StyledItemLabel,
81
+ {
82
+ id: labelId,
83
+ isTall: true,
84
+ labelOverflow: headerItem.itemOpts?.labelOverflow ?? labelOverflow,
85
+ style: isRail ? HIDDEN_LABEL_STYLE : void 0,
86
+ getOwnerProps,
87
+ getOwnerPropsArguments,
88
+ children: label
89
+ }
90
+ ),
91
+ RightComponent && !isRail ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
92
+ import_styled.StyledRightContainer,
93
+ {
94
+ id: descriptionId,
95
+ getOwnerProps,
96
+ getOwnerPropsArguments,
97
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RightComponent, { item: headerItem })
98
+ }
99
+ ) : null,
100
+ isRail ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
101
+ import_styled.StyledArrowContainer,
102
+ {
103
+ "aria-hidden": "true",
104
+ isLeading: false,
105
+ getOwnerProps,
106
+ getOwnerPropsArguments,
107
+ children: isHeaderOpen ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_icons.ChevronSmallDown, { size: "m", color: CHEVRON_COLOR }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_icons.ChevronSmallRight, { size: "m", color: CHEVRON_COLOR })
108
+ }
109
+ )
110
+ ]
111
+ }
112
+ );
113
+ };
114
+ //# sourceMappingURL=Header.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/parts/Header.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["/* eslint-disable complexity */\nimport React, { useCallback, useContext } from 'react';\nimport { ChevronSmallDown, ChevronSmallRight } from '@elliemae/ds-icons';\nimport { TreeContext } from './TreeContext.js';\nimport { usePropsStore } from '../config/store.js';\nimport { useFocusTracker } from '../config/useFocusTracker.js';\nimport {\n StyledArrowContainer,\n StyledCollapsedContainer,\n StyledHeaderDisclosure,\n StyledItemLabel,\n StyledLeftContainer,\n StyledRightContainer,\n} from './styled.js';\n\nconst HIDDEN_LABEL_STYLE = { display: 'none' };\nconst CHEVRON_COLOR = ['brand-primary', '800'] as ['brand-primary', '800'];\n\nexport const HeaderDisclosure = () => {\n const { model, getOwnerProps, labelOverflow, getElementId } = useContext(TreeContext);\n const onItemClick = usePropsStore((state) => state.onItemClick);\n const { trackFocusHeader } = useFocusTracker();\n const { headerItem, isHeaderOpen, isRail } = model;\n\n const handleClick = useCallback(\n (e: React.MouseEvent<HTMLElement>) => {\n if (headerItem) onItemClick(headerItem, e);\n },\n [headerItem, onItemClick],\n );\n const getOwnerPropsArguments = useCallback(\n () => ({ item: headerItem, level: 1, isOpen: isHeaderOpen && !isRail, isCurrent: false }),\n [headerItem, isHeaderOpen, isRail],\n );\n\n if (!headerItem) return null;\n const { label, RightComponent } = headerItem.itemOpts ?? {};\n const { CollapsedComponent } = headerItem;\n const labelId = getElementId('label', headerItem.dsId);\n const descriptionId = getElementId('description', headerItem.dsId);\n\n return (\n <StyledHeaderDisclosure\n type=\"button\"\n isRail={isRail}\n isOpen={isHeaderOpen && !isRail}\n aria-labelledby={labelId}\n aria-describedby={RightComponent && !isRail ? descriptionId : undefined}\n aria-expanded={isRail ? undefined : isHeaderOpen}\n aria-controls={isRail || model.visibleIds.length === 0 ? undefined : getElementId('tree', 'root')}\n onClick={handleClick}\n onFocus={trackFocusHeader}\n getOwnerProps={getOwnerProps}\n >\n {isRail ? (\n <StyledCollapsedContainer getOwnerProps={getOwnerProps} getOwnerPropsArguments={getOwnerPropsArguments}>\n {CollapsedComponent ? <CollapsedComponent item={headerItem} /> : null}\n </StyledCollapsedContainer>\n ) : (\n <StyledLeftContainer getOwnerProps={getOwnerProps} getOwnerPropsArguments={getOwnerPropsArguments}>\n {CollapsedComponent ? <CollapsedComponent item={headerItem} /> : null}\n </StyledLeftContainer>\n )}\n <StyledItemLabel\n id={labelId}\n isTall\n labelOverflow={headerItem.itemOpts?.labelOverflow ?? labelOverflow}\n style={isRail ? HIDDEN_LABEL_STYLE : undefined}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n {label}\n </StyledItemLabel>\n {RightComponent && !isRail ? (\n <StyledRightContainer\n id={descriptionId}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n <RightComponent item={headerItem} />\n </StyledRightContainer>\n ) : null}\n {isRail ? null : (\n <StyledArrowContainer\n aria-hidden=\"true\"\n isLeading={false}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n {isHeaderOpen ? (\n <ChevronSmallDown size=\"m\" color={CHEVRON_COLOR} />\n ) : (\n <ChevronSmallRight size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