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

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,82 @@
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 __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (let key of __getOwnPropNames(from))
11
+ if (!__hasOwnProp.call(to, key) && key !== except)
12
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ }
14
+ return to;
15
+ };
16
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
+ // If the importer is in node compatibility mode or this is not an ESM
18
+ // file that has been converted to a CommonJS file using a Babel-
19
+ // compatible transform (i.e. "__esModule" has not been set), then set
20
+ // "default" to the CommonJS "module.exports" for node compatibility.
21
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
+ mod
23
+ ));
24
+ var React = __toESM(require("react"));
25
+ const SlotPropsAsObject = {
26
+ dsLeftnavigationtreeRoot: { "aria-label": "just a typescript test" },
27
+ dsLeftnavigationtreeTree: { "aria-label": "just a typescript test" },
28
+ dsLeftnavigationtreeItem: { "aria-label": "just a typescript test" },
29
+ dsLeftnavigationtreeItemRow: { "aria-label": "just a typescript test" },
30
+ dsLeftnavigationtreeItemLabel: { "aria-label": "just a typescript test" },
31
+ dsLeftnavigationtreeLeftContainer: { "aria-label": "just a typescript test" },
32
+ dsLeftnavigationtreeCollapsedContainer: { "aria-label": "just a typescript test" },
33
+ dsLeftnavigationtreeRightContainer: { "aria-label": "just a typescript test" },
34
+ dsLeftnavigationtreeArrowContainer: { "aria-label": "just a typescript test" },
35
+ dsLeftnavigationtreeGroup: { "aria-label": "just a typescript test" },
36
+ dsLeftnavigationtreeSectionContainer: { "aria-label": "just a typescript test" },
37
+ dsLeftnavigationtreeSectionLabel: { "aria-label": "just a typescript test" },
38
+ dsLeftnavigationtreeItemSeparator: { "aria-label": "just a typescript test" },
39
+ dsLeftnavigationtreeHeaderDisclosure: { "aria-label": "just a typescript test" },
40
+ dsLeftnavigationtreeFooterMenu: { "aria-label": "just a typescript test" },
41
+ dsLeftnavigationtreeFooterLabel: { "aria-label": "just a typescript test" },
42
+ dsLeftnavigationtreeFooterSeparator: { "aria-label": "just a typescript test" },
43
+ dsLeftnavigationtreeFooterMenuCollapse: { "aria-label": "just a typescript test" }
44
+ };
45
+ const SlotPropsAsFunctions = {
46
+ dsLeftnavigationtreeRoot: () => ({ "aria-label": "just a typescript test" }),
47
+ dsLeftnavigationtreeTree: () => ({ "aria-label": "just a typescript test" }),
48
+ dsLeftnavigationtreeItem: ({ item, level, isOpen, isCurrent }) => ({
49
+ "aria-label": `${item.dsId} ${level} ${isOpen} ${isCurrent}`
50
+ }),
51
+ dsLeftnavigationtreeItemRow: ({ item, level, isOpen, isCurrent }) => ({
52
+ "aria-label": `${item.dsId} ${level} ${isOpen} ${isCurrent}`
53
+ }),
54
+ dsLeftnavigationtreeItemLabel: ({ item, level, isOpen, isCurrent }) => ({
55
+ "aria-label": `${item.dsId} ${level} ${isOpen} ${isCurrent}`
56
+ }),
57
+ dsLeftnavigationtreeLeftContainer: ({ item, level, isOpen, isCurrent }) => ({
58
+ "aria-label": `${item.dsId} ${level} ${isOpen} ${isCurrent}`
59
+ }),
60
+ dsLeftnavigationtreeCollapsedContainer: ({ item, level, isOpen, isCurrent }) => ({
61
+ "aria-label": `${item.dsId} ${level} ${isOpen} ${isCurrent}`
62
+ }),
63
+ dsLeftnavigationtreeRightContainer: ({ item, level, isOpen, isCurrent }) => ({
64
+ "aria-label": `${item.dsId} ${level} ${isOpen} ${isCurrent}`
65
+ }),
66
+ dsLeftnavigationtreeArrowContainer: ({ item, level, isOpen, isCurrent }) => ({
67
+ "aria-label": `${item.dsId} ${level} ${isOpen} ${isCurrent}`
68
+ }),
69
+ dsLeftnavigationtreeGroup: ({ item, level, isOpen, isCurrent }) => ({
70
+ "aria-label": `${item.dsId} ${level} ${isOpen} ${isCurrent}`
71
+ }),
72
+ dsLeftnavigationtreeSectionContainer: () => ({ "aria-label": "just a typescript test" }),
73
+ dsLeftnavigationtreeSectionLabel: () => ({ "aria-label": "just a typescript test" }),
74
+ dsLeftnavigationtreeItemSeparator: () => ({ "aria-label": "just a typescript test" }),
75
+ dsLeftnavigationtreeHeaderDisclosure: () => ({ "aria-label": "just a typescript test" }),
76
+ dsLeftnavigationtreeFooterMenu: () => ({ "aria-label": "just a typescript test" }),
77
+ dsLeftnavigationtreeFooterLabel: () => ({ "aria-label": "just a typescript test" }),
78
+ dsLeftnavigationtreeFooterSeparator: () => ({ "aria-label": "just a typescript test" }),
79
+ dsLeftnavigationtreeFooterMenuCollapse: () => ({ "aria-label": "just a typescript test" })
80
+ };
81
+ const EnsureAllSlotsExistInSlotFunctionArguments = SlotPropsAsFunctions;
82
+ //# sourceMappingURL=slot-props.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/typescript-testing/slot-props.ts"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\n\nimport type { TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport type { DSLeftNavigationTreeName, LEFT_NAVIGATION_TREE_SLOTS } from '../constants/index.js';\nimport type { DSLeftNavigationTreeT } from '../react-desc-prop-types.js';\n\nconst SlotPropsAsObject: Partial<DSLeftNavigationTreeT.Props> = {\n dsLeftnavigationtreeRoot: { 'aria-label': 'just a typescript test' },\n dsLeftnavigationtreeTree: { 'aria-label': 'just a typescript test' },\n dsLeftnavigationtreeItem: { 'aria-label': 'just a typescript test' },\n dsLeftnavigationtreeItemRow: { 'aria-label': 'just a typescript test' },\n dsLeftnavigationtreeItemLabel: { 'aria-label': 'just a typescript test' },\n dsLeftnavigationtreeLeftContainer: { 'aria-label': 'just a typescript test' },\n dsLeftnavigationtreeCollapsedContainer: { 'aria-label': 'just a typescript test' },\n dsLeftnavigationtreeRightContainer: { 'aria-label': 'just a typescript test' },\n dsLeftnavigationtreeArrowContainer: { 'aria-label': 'just a typescript test' },\n dsLeftnavigationtreeGroup: { 'aria-label': 'just a typescript test' },\n dsLeftnavigationtreeSectionContainer: { 'aria-label': 'just a typescript test' },\n dsLeftnavigationtreeSectionLabel: { 'aria-label': 'just a typescript test' },\n dsLeftnavigationtreeItemSeparator: { 'aria-label': 'just a typescript test' },\n dsLeftnavigationtreeHeaderDisclosure: { 'aria-label': 'just a typescript test' },\n dsLeftnavigationtreeFooterMenu: { 'aria-label': 'just a typescript test' },\n dsLeftnavigationtreeFooterLabel: { 'aria-label': 'just a typescript test' },\n dsLeftnavigationtreeFooterSeparator: { 'aria-label': 'just a typescript test' },\n dsLeftnavigationtreeFooterMenuCollapse: { 'aria-label': 'just a typescript test' },\n};\n\nconst SlotPropsAsFunctions: DSLeftNavigationTreeT.SlotFunctionArguments = {\n dsLeftnavigationtreeRoot: () => ({ 'aria-label': 'just a typescript test' }),\n dsLeftnavigationtreeTree: () => ({ 'aria-label': 'just a typescript test' }),\n dsLeftnavigationtreeItem: ({ item, level, isOpen, isCurrent }) => ({\n 'aria-label': `${item.dsId} ${level} ${isOpen} ${isCurrent}`,\n }),\n dsLeftnavigationtreeItemRow: ({ item, level, isOpen, isCurrent }) => ({\n 'aria-label': `${item.dsId} ${level} ${isOpen} ${isCurrent}`,\n }),\n dsLeftnavigationtreeItemLabel: ({ item, level, isOpen, isCurrent }) => ({\n 'aria-label': `${item.dsId} ${level} ${isOpen} ${isCurrent}`,\n }),\n dsLeftnavigationtreeLeftContainer: ({ item, level, isOpen, isCurrent }) => ({\n 'aria-label': `${item.dsId} ${level} ${isOpen} ${isCurrent}`,\n }),\n dsLeftnavigationtreeCollapsedContainer: ({ item, level, isOpen, isCurrent }) => ({\n 'aria-label': `${item.dsId} ${level} ${isOpen} ${isCurrent}`,\n }),\n dsLeftnavigationtreeRightContainer: ({ item, level, isOpen, isCurrent }) => ({\n 'aria-label': `${item.dsId} ${level} ${isOpen} ${isCurrent}`,\n }),\n dsLeftnavigationtreeArrowContainer: ({ item, level, isOpen, isCurrent }) => ({\n 'aria-label': `${item.dsId} ${level} ${isOpen} ${isCurrent}`,\n }),\n dsLeftnavigationtreeGroup: ({ item, level, isOpen, isCurrent }) => ({\n 'aria-label': `${item.dsId} ${level} ${isOpen} ${isCurrent}`,\n }),\n dsLeftnavigationtreeSectionContainer: () => ({ 'aria-label': 'just a typescript test' }),\n dsLeftnavigationtreeSectionLabel: () => ({ 'aria-label': 'just a typescript test' }),\n dsLeftnavigationtreeItemSeparator: () => ({ 'aria-label': 'just a typescript test' }),\n dsLeftnavigationtreeHeaderDisclosure: () => ({ 'aria-label': 'just a typescript test' }),\n dsLeftnavigationtreeFooterMenu: () => ({ 'aria-label': 'just a typescript test' }),\n dsLeftnavigationtreeFooterLabel: () => ({ 'aria-label': 'just a typescript test' }),\n dsLeftnavigationtreeFooterSeparator: () => ({ 'aria-label': 'just a typescript test' }),\n dsLeftnavigationtreeFooterMenuCollapse: () => ({ 'aria-label': 'just a typescript test' }),\n};\n\n// Exhaustiveness check \u2014 fails compilation if a slot is missing from SlotFunctionArguments\nconst EnsureAllSlotsExistInSlotFunctionArguments: Required<\n TypescriptHelpersT.PropsForSlots<typeof DSLeftNavigationTreeName, typeof LEFT_NAVIGATION_TREE_SLOTS>\n> = SlotPropsAsFunctions;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA,YAAuB;ACMvB,MAAM,oBAA0D;AAAA,EAC9D,0BAA0B,EAAE,cAAc,yBAAyB;AAAA,EACnE,0BAA0B,EAAE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elliemae/ds-props-helpers";
3
+ import { withZustand } from "@elliemae/ds-zustand-helpers";
4
+ import { MainContent } from "./parts/MainContent.js";
5
+ import { config } from "./config/store.js";
6
+ import { DSLeftNavigationTreePropTypesSchema } from "./react-desc-prop-types.js";
7
+ import { DSLeftNavigationTreeName } from "./constants/index.js";
8
+ const DSLeftNavigationTree = withZustand(MainContent, config);
9
+ DSLeftNavigationTree.displayName = DSLeftNavigationTreeName;
10
+ const DSLeftNavigationTreeWithSchema = describe(DSLeftNavigationTree);
11
+ DSLeftNavigationTreeWithSchema.propTypes = DSLeftNavigationTreePropTypesSchema;
12
+ export {
13
+ DSLeftNavigationTree,
14
+ DSLeftNavigationTreeWithSchema
15
+ };
16
+ //# sourceMappingURL=DSLeftNavigationTree.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/DSLeftNavigationTree.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { describe } from '@elliemae/ds-props-helpers';\nimport { withZustand } from '@elliemae/ds-zustand-helpers';\nimport { MainContent } from './parts/MainContent.js';\nimport { config } from './config/store.js';\nimport { DSLeftNavigationTreePropTypesSchema, type DSLeftNavigationTreeT } from './react-desc-prop-types.js';\nimport { DSLeftNavigationTreeName } from './constants/index.js';\n\nconst DSLeftNavigationTree = withZustand<\n DSLeftNavigationTreeT.Props,\n DSLeftNavigationTreeT.InternalProps,\n DSLeftNavigationTreeT.InternalAtoms,\n DSLeftNavigationTreeT.UseAutoCalculatedT,\n DSLeftNavigationTreeT.Selectors,\n DSLeftNavigationTreeT.Reducers\n>(MainContent, config);\n\nDSLeftNavigationTree.displayName = DSLeftNavigationTreeName;\nconst DSLeftNavigationTreeWithSchema = describe(DSLeftNavigationTree);\nDSLeftNavigationTreeWithSchema.propTypes = DSLeftNavigationTreePropTypesSchema;\n\nexport { DSLeftNavigationTree, DSLeftNavigationTreeWithSchema };\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,gBAAgB;AACzB,SAAS,mBAAmB;AAC5B,SAAS,mBAAmB;AAC5B,SAAS,cAAc;AACvB,SAAS,2CAAuE;AAChF,SAAS,gCAAgC;AAEzC,MAAM,uBAAuB,YAO3B,aAAa,MAAM;AAErB,qBAAqB,cAAc;AACnC,MAAM,iCAAiC,SAAS,oBAAoB;AACpE,+BAA+B,YAAY;",
6
+ "names": []
7
+ }
@@ -0,0 +1,33 @@
1
+ import * as React from "react";
2
+ import { createInternalAndPropsContext } from "@elliemae/ds-zustand-helpers";
3
+ import { defaultProps } from "../react-desc-prop-types.js";
4
+ import { LEFT_NAVIGATION_TREE_REGION_FOCUSES } from "../constants/index.js";
5
+ import { useAutoCalculated } from "./useAutoCalculated.js";
6
+ const internalAtomDefaultValues = {
7
+ focusRegion: LEFT_NAVIGATION_TREE_REGION_FOCUSES.RESET,
8
+ focusedItemId: null,
9
+ toggles: {},
10
+ internalSelectedItem: null
11
+ };
12
+ const selectors = () => ({});
13
+ const reducers = () => ({});
14
+ const { PropsProvider, usePropsStore, InternalProvider, useInternalStore } = createInternalAndPropsContext();
15
+ const config = {
16
+ defaultProps,
17
+ internalAtomDefaultValues,
18
+ useAutoCalculated,
19
+ selectors,
20
+ reducers,
21
+ PropsProvider,
22
+ usePropsStore,
23
+ InternalProvider,
24
+ useInternalStore
25
+ };
26
+ export {
27
+ InternalProvider,
28
+ PropsProvider,
29
+ config,
30
+ useInternalStore,
31
+ usePropsStore
32
+ };
33
+ //# sourceMappingURL=store.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/config/store.ts"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { createInternalAndPropsContext, type ZustandT } from '@elliemae/ds-zustand-helpers';\nimport { type DSLeftNavigationTreeT, defaultProps } from '../react-desc-prop-types.js';\nimport { LEFT_NAVIGATION_TREE_REGION_FOCUSES } from '../constants/index.js';\nimport { useAutoCalculated } from './useAutoCalculated.js';\n\nconst internalAtomDefaultValues: DSLeftNavigationTreeT.InternalAtoms = {\n focusRegion: LEFT_NAVIGATION_TREE_REGION_FOCUSES.RESET,\n focusedItemId: null,\n toggles: {},\n internalSelectedItem: null,\n};\n\nconst selectors: ZustandT.SelectorObject<\n DSLeftNavigationTreeT.InternalStore,\n DSLeftNavigationTreeT.Selectors\n> = () => ({});\n\nconst reducers: ZustandT.ReducerObject<\n DSLeftNavigationTreeT.InternalStore,\n DSLeftNavigationTreeT.Reducers\n> = () => ({});\n\nexport const { PropsProvider, usePropsStore, InternalProvider, useInternalStore } = createInternalAndPropsContext<\n DSLeftNavigationTreeT.InternalProps,\n DSLeftNavigationTreeT.InternalAtoms,\n DSLeftNavigationTreeT.UseAutoCalculatedT,\n DSLeftNavigationTreeT.Selectors,\n DSLeftNavigationTreeT.Reducers\n>();\n\nexport const config = {\n defaultProps: defaultProps as DSLeftNavigationTreeT.InternalProps,\n internalAtomDefaultValues,\n useAutoCalculated,\n selectors,\n reducers,\n PropsProvider,\n usePropsStore,\n InternalProvider,\n useInternalStore,\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,qCAAoD;AAC7D,SAAqC,oBAAoB;AACzD,SAAS,2CAA2C;AACpD,SAAS,yBAAyB;AAElC,MAAM,4BAAiE;AAAA,EACrE,aAAa,oCAAoC;AAAA,EACjD,eAAe;AAAA,EACf,SAAS,CAAC;AAAA,EACV,sBAAsB;AACxB;AAEA,MAAM,YAGF,OAAO,CAAC;AAEZ,MAAM,WAGF,OAAO,CAAC;AAEL,MAAM,EAAE,eAAe,eAAe,kBAAkB,iBAAiB,IAAI,8BAMlF;AAEK,MAAM,SAAS;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,148 @@
1
+ import * as React from "react";
2
+ import { LEFT_NAVIGATION_TREE_ITEM_TYPES } from "../constants/index.js";
3
+ const isNode = (item) => item.type === LEFT_NAVIGATION_TREE_ITEM_TYPES.LEAF || item.type === LEFT_NAVIGATION_TREE_ITEM_TYPES.PARENT;
4
+ const childNodesOf = (item) => (item.itemOpts?.items ?? []).filter(isNode);
5
+ const getRootNodes = (items) => items.flatMap((item) => {
6
+ if (item.type === LEFT_NAVIGATION_TREE_ITEM_TYPES.SECTION) return childNodesOf(item);
7
+ return isNode(item) ? [item] : [];
8
+ });
9
+ const buildTreeIndex = (items) => {
10
+ const index = /* @__PURE__ */ new Map();
11
+ const visit = (item, parentId, level) => {
12
+ const children = item.type === LEFT_NAVIGATION_TREE_ITEM_TYPES.PARENT ? childNodesOf(item) : [];
13
+ index.set(item.dsId, { id: item.dsId, item, parentId, level, childIds: children.map((child) => child.dsId) });
14
+ children.forEach((child) => visit(child, item.dsId, level + 1));
15
+ };
16
+ getRootNodes(items).forEach((item) => visit(item, null, 1));
17
+ return index;
18
+ };
19
+ const hasChildren = (info) => !!info && info.childIds.length > 0;
20
+ const isControlledParent = (item) => item.itemOpts?.isOpened !== void 0;
21
+ const getAncestorIds = (index, id) => {
22
+ const ancestors = [];
23
+ let parentId = id ? index.get(id)?.parentId ?? null : null;
24
+ while (parentId) {
25
+ ancestors.push(parentId);
26
+ parentId = index.get(parentId)?.parentId ?? null;
27
+ }
28
+ return ancestors;
29
+ };
30
+ const isDescendantOf = (index, ancestorId, id) => getAncestorIds(index, id).includes(ancestorId);
31
+ const resolveIsOpen = (info, toggles, seed) => {
32
+ if (!hasChildren(info)) return false;
33
+ const { itemOpts } = info.item;
34
+ if (itemOpts?.isOpened !== void 0) return itemOpts.isOpened;
35
+ if (toggles[info.id] !== void 0) return toggles[info.id];
36
+ if (itemOpts?.startOpened) return true;
37
+ return seed.has(info.id);
38
+ };
39
+ const getVisibleIds = (index, items, isOpen) => {
40
+ const visible = [];
41
+ const visit = (id) => {
42
+ visible.push(id);
43
+ const info = index.get(id);
44
+ if (info && hasChildren(info) && isOpen(id)) info.childIds.forEach(visit);
45
+ };
46
+ getRootNodes(items).forEach((item) => visit(item.dsId));
47
+ return visible;
48
+ };
49
+ const getRailIds = (items) => getRootNodes(items).filter((item) => !!item.CollapsedComponent).map((item) => item.dsId);
50
+ const getDocumentOrder = (index, items) => getVisibleIds(index, items, () => true);
51
+ const getDefaultSelection = (index, parentId) => {
52
+ const info = index.get(parentId);
53
+ if (!info) return { leafId: null, parentIdsToOpen: [] };
54
+ const none = { leafId: null, parentIdsToOpen: [] };
55
+ return info.childIds.reduce((found, childId) => {
56
+ if (found.leafId) return found;
57
+ const child = index.get(childId);
58
+ if (child && hasChildren(child)) {
59
+ const nested = getDefaultSelection(index, childId);
60
+ return nested.leafId ? { leafId: nested.leafId, parentIdsToOpen: [childId, ...nested.parentIdsToOpen] } : found;
61
+ }
62
+ const isPage = child?.item.type === LEFT_NAVIGATION_TREE_ITEM_TYPES.LEAF && child.item.itemOpts?.selectable !== false;
63
+ return isPage ? { leafId: childId, parentIdsToOpen: [] } : found;
64
+ }, none);
65
+ };
66
+ const getTabStopChainId = (index, visibleIds, currentId) => {
67
+ const visible = new Set(visibleIds);
68
+ if (currentId && visible.has(currentId)) return currentId;
69
+ const visibleAncestor = getAncestorIds(index, currentId).find((id) => visible.has(id));
70
+ if (visibleAncestor) return visibleAncestor;
71
+ return visibleIds[0] ?? null;
72
+ };
73
+ const resolveFallbackTarget = ({
74
+ index,
75
+ documentOrder,
76
+ visibleIds,
77
+ lostId,
78
+ currentId
79
+ }) => {
80
+ const visible = new Set(visibleIds);
81
+ if (!index.has(lostId)) {
82
+ const chainId = getTabStopChainId(index, visibleIds, currentId);
83
+ return chainId ? { kind: "item", id: chainId } : { kind: "footer" };
84
+ }
85
+ const visibleAncestor = getAncestorIds(index, lostId).find((id) => visible.has(id));
86
+ if (visibleAncestor) return { kind: "item", id: visibleAncestor };
87
+ const position = documentOrder.indexOf(lostId);
88
+ const previous = documentOrder.slice(0, Math.max(position, 0)).reverse().find((id) => visible.has(id));
89
+ if (previous) return { kind: "item", id: previous };
90
+ if (visibleIds[0]) return { kind: "item", id: visibleIds[0] };
91
+ return { kind: "footer" };
92
+ };
93
+ const getTypeaheadMatchId = ({
94
+ index,
95
+ visibleIds,
96
+ fromId,
97
+ character
98
+ }) => {
99
+ const needle = character.toLowerCase();
100
+ const start = visibleIds.indexOf(fromId);
101
+ const ordered = [...visibleIds.slice(start + 1), ...visibleIds.slice(0, start + 1)];
102
+ return ordered.find((id) => {
103
+ const label = index.get(id)?.item.itemOpts?.label;
104
+ return typeof label === "string" && label.trim().toLowerCase().startsWith(needle);
105
+ }) ?? null;
106
+ };
107
+ const ROW_PADDING = 12;
108
+ const LEADING_ARROW_OFFSET = 16;
109
+ const ICON_OFFSET = 32;
110
+ const CHILD_INDENT = 16;
111
+ const hasLeadingArrow = (info) => hasChildren(info) && !info?.item.CollapsedComponent;
112
+ const getLabelOffset = (info) => (hasLeadingArrow(info) ? LEADING_ARROW_OFFSET : 0) + (info.item.CollapsedComponent ? ICON_OFFSET : 0);
113
+ const getRowPaddings = (index) => {
114
+ const labelStarts = /* @__PURE__ */ new Map();
115
+ const paddings = /* @__PURE__ */ new Map();
116
+ index.forEach((info) => {
117
+ const offset = getLabelOffset(info);
118
+ const parent = info.parentId ? index.get(info.parentId) : void 0;
119
+ let labelStart = ROW_PADDING + offset;
120
+ if (parent) {
121
+ const parentAnchor = parent.item.CollapsedComponent ? paddings.get(parent.id) ?? ROW_PADDING : labelStarts.get(parent.id) ?? ROW_PADDING;
122
+ labelStart = parentAnchor + CHILD_INDENT;
123
+ }
124
+ labelStarts.set(info.id, labelStart);
125
+ paddings.set(info.id, labelStart - offset);
126
+ });
127
+ return paddings;
128
+ };
129
+ export {
130
+ ROW_PADDING,
131
+ buildTreeIndex,
132
+ getAncestorIds,
133
+ getDefaultSelection,
134
+ getDocumentOrder,
135
+ getRailIds,
136
+ getRootNodes,
137
+ getRowPaddings,
138
+ getTabStopChainId,
139
+ getTypeaheadMatchId,
140
+ getVisibleIds,
141
+ hasChildren,
142
+ hasLeadingArrow,
143
+ isControlledParent,
144
+ isDescendantOf,
145
+ resolveFallbackTarget,
146
+ resolveIsOpen
147
+ };
148
+ //# sourceMappingURL=treeModel.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/config/treeModel.ts"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\nimport { LEFT_NAVIGATION_TREE_ITEM_TYPES } from '../constants/index.js';\nimport type { DSLeftNavigationTreeT } from '../react-desc-prop-types.js';\n\ntype Item = DSLeftNavigationTreeT.Item;\n\nexport type TreeNodeInfo = {\n id: string;\n item: Item;\n parentId: string | null;\n level: number;\n childIds: string[];\n};\n\nexport type TreeIndex = Map<string, TreeNodeInfo>;\n\nexport type FocusTarget = { kind: 'item'; id: string } | { kind: 'footer' } | null;\n\nconst isNode = (item: Item) =>\n item.type === LEFT_NAVIGATION_TREE_ITEM_TYPES.LEAF || item.type === LEFT_NAVIGATION_TREE_ITEM_TYPES.PARENT;\n\nconst childNodesOf = (item: Item): Item[] => (item.itemOpts?.items ?? []).filter(isNode);\n\n/**\n * Root nodes in document order. Children of a root SECTION are root nodes too:\n * a section is a labelled group, not a tree level.\n */\nexport const getRootNodes = (items: readonly Item[]): Item[] =>\n items.flatMap((item) => {\n if (item.type === LEFT_NAVIGATION_TREE_ITEM_TYPES.SECTION) return childNodesOf(item);\n return isNode(item) ? [item] : [];\n });\n\nexport const buildTreeIndex = (items: readonly Item[]): TreeIndex => {\n const index: TreeIndex = new Map();\n const visit = (item: Item, parentId: string | null, level: number) => {\n const children = item.type === LEFT_NAVIGATION_TREE_ITEM_TYPES.PARENT ? childNodesOf(item) : [];\n index.set(item.dsId, { id: item.dsId, item, parentId, level, childIds: children.map((child) => child.dsId) });\n children.forEach((child) => visit(child, item.dsId, level + 1));\n };\n getRootNodes(items).forEach((item) => visit(item, null, 1));\n return index;\n};\n\nexport const hasChildren = (info: TreeNodeInfo | undefined): boolean => !!info && info.childIds.length > 0;\n\nexport const isControlledParent = (item: Item): boolean => item.itemOpts?.isOpened !== undefined;\n\nexport const getAncestorIds = (index: TreeIndex, id: string | null | undefined): string[] => {\n const ancestors: string[] = [];\n let parentId = id ? (index.get(id)?.parentId ?? null) : null;\n while (parentId) {\n ancestors.push(parentId);\n parentId = index.get(parentId)?.parentId ?? null;\n }\n return ancestors;\n};\n\nexport const isDescendantOf = (index: TreeIndex, ancestorId: string, id: string | null | undefined): boolean =>\n getAncestorIds(index, id).includes(ancestorId);\n\nexport const resolveIsOpen = (\n info: TreeNodeInfo,\n toggles: Record<string, boolean>,\n seed: ReadonlySet<string>,\n): boolean => {\n if (!hasChildren(info)) return false;\n const { itemOpts } = info.item;\n if (itemOpts?.isOpened !== undefined) return itemOpts.isOpened;\n if (toggles[info.id] !== undefined) return toggles[info.id];\n if (itemOpts?.startOpened) return true;\n return seed.has(info.id);\n};\n\nexport const getVisibleIds = (index: TreeIndex, items: readonly Item[], isOpen: (id: string) => boolean): string[] => {\n const visible: string[] = [];\n const visit = (id: string) => {\n visible.push(id);\n const info = index.get(id);\n if (info && hasChildren(info) && isOpen(id)) info.childIds.forEach(visit);\n };\n getRootNodes(items).forEach((item) => visit(item.dsId));\n return visible;\n};\n\nexport const getRailIds = (items: readonly Item[]): string[] =>\n getRootNodes(items)\n .filter((item) => !!item.CollapsedComponent)\n .map((item) => item.dsId);\n\n/** Every node in depth-first document order, regardless of visibility. */\nexport const getDocumentOrder = (index: TreeIndex, items: readonly Item[]): string[] =>\n getVisibleIds(index, items, () => true);\n\n/**\n * Default selection when a parent opens (spec \"first list item selected by default; if it is a parent folder, it is\n * expanded by default\"): walks the children in order, skips non-selectable leaves, and descends into the first parent\n * that holds a selectable page, listing the parents that must open on the way.\n */\nexport const getDefaultSelection = (\n index: TreeIndex,\n parentId: string,\n): { leafId: string | null; parentIdsToOpen: string[] } => {\n const info = index.get(parentId);\n if (!info) return { leafId: null, parentIdsToOpen: [] };\n const none = { leafId: null, parentIdsToOpen: [] as string[] };\n return info.childIds.reduce<{ leafId: string | null; parentIdsToOpen: string[] }>((found, childId) => {\n if (found.leafId) return found;\n const child = index.get(childId);\n if (child && hasChildren(child)) {\n const nested = getDefaultSelection(index, childId);\n return nested.leafId ? { leafId: nested.leafId, parentIdsToOpen: [childId, ...nested.parentIdsToOpen] } : found;\n }\n const isPage =\n child?.item.type === LEFT_NAVIGATION_TREE_ITEM_TYPES.LEAF && child.item.itemOpts?.selectable !== false;\n return isPage ? { leafId: childId, parentIdsToOpen: [] } : found;\n }, none);\n};\n\nexport const getTabStopChainId = (\n index: TreeIndex,\n visibleIds: string[],\n currentId: string | null | undefined,\n): string | null => {\n const visible = new Set(visibleIds);\n if (currentId && visible.has(currentId)) return currentId;\n const visibleAncestor = getAncestorIds(index, currentId).find((id) => visible.has(id));\n if (visibleAncestor) return visibleAncestor;\n return visibleIds[0] ?? null;\n};\n\n/**\n * Where focus goes when the focused node stops being visible while focus is inside the tree:\n * nearest visible ancestor, then the previous visible node in document order, then the first\n * visible node, then the footer button. A node no longer in the data resolves through the tab-stop chain.\n */\nexport const resolveFallbackTarget = ({\n index,\n documentOrder,\n visibleIds,\n lostId,\n currentId,\n}: {\n index: TreeIndex;\n documentOrder: string[];\n visibleIds: string[];\n lostId: string;\n currentId: string | null | undefined;\n}): FocusTarget => {\n const visible = new Set(visibleIds);\n if (!index.has(lostId)) {\n const chainId = getTabStopChainId(index, visibleIds, currentId);\n return chainId ? { kind: 'item', id: chainId } : { kind: 'footer' };\n }\n const visibleAncestor = getAncestorIds(index, lostId).find((id) => visible.has(id));\n if (visibleAncestor) return { kind: 'item', id: visibleAncestor };\n const position = documentOrder.indexOf(lostId);\n const previous = documentOrder\n .slice(0, Math.max(position, 0))\n .reverse()\n .find((id) => visible.has(id));\n if (previous) return { kind: 'item', id: previous };\n if (visibleIds[0]) return { kind: 'item', id: visibleIds[0] };\n return { kind: 'footer' };\n};\n\nexport const getTypeaheadMatchId = ({\n index,\n visibleIds,\n fromId,\n character,\n}: {\n index: TreeIndex;\n visibleIds: string[];\n fromId: string;\n character: string;\n}): string | null => {\n const needle = character.toLowerCase();\n const start = visibleIds.indexOf(fromId);\n const ordered = [...visibleIds.slice(start + 1), ...visibleIds.slice(0, start + 1)];\n return (\n ordered.find((id) => {\n const label = index.get(id)?.item.itemOpts?.label;\n return typeof label === 'string' && label.trim().toLowerCase().startsWith(needle);\n }) ?? null\n );\n};\n\nexport const ROW_PADDING = 12;\nconst LEADING_ARROW_OFFSET = 16;\nconst ICON_OFFSET = 32;\nconst CHILD_INDENT = 16;\n\n/** Parents without an icon show their arrow before the label; parents with an icon show it after the label. */\nexport const hasLeadingArrow = (info: TreeNodeInfo | undefined): boolean =>\n hasChildren(info) && !info?.item.CollapsedComponent;\n\nconst getLabelOffset = (info: TreeNodeInfo) =>\n (hasLeadingArrow(info) ? LEADING_ARROW_OFFSET : 0) + (info.item.CollapsedComponent ? ICON_OFFSET : 0);\n\n/**\n * Left padding per row, following the Left Nav 1.0.4 spec: children of a parent with an icon (a section such as\n * Forms or Log) start their label 16px after the parent's row padding; children of an arrow-led parent start\n * 16px after the parent's label. The index lists parents before their children.\n */\nexport const getRowPaddings = (index: TreeIndex): ReadonlyMap<string, number> => {\n const labelStarts = new Map<string, number>();\n const paddings = new Map<string, number>();\n index.forEach((info) => {\n const offset = getLabelOffset(info);\n const parent = info.parentId ? index.get(info.parentId) : undefined;\n let labelStart = ROW_PADDING + offset;\n if (parent) {\n const parentAnchor = parent.item.CollapsedComponent\n ? (paddings.get(parent.id) ?? ROW_PADDING)\n : (labelStarts.get(parent.id) ?? ROW_PADDING);\n labelStart = parentAnchor + CHILD_INDENT;\n }\n labelStarts.set(info.id, labelStart);\n paddings.set(info.id, labelStart - offset);\n });\n return paddings;\n};\n"],
5
+ "mappings": "A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OAAO,EAAE,KAAK,cAC3B,YAAY,IAAI,OAAO,EAAE,KAAK;AACnC,mBAAa,eAAe;AAAA,IAC9B;AACA,gBAAY,IAAI,KAAK,IAAI,UAAU;AACnC,aAAS,IAAI,KAAK,IAAI,aAAa,MAAM;AAAA,EAC3C,CAAC;AACD,SAAO;AACT;",
6
+ "names": []
7
+ }
@@ -0,0 +1,7 @@
1
+ import * as React from "react";
2
+ const AUTO_CALCULATED = {};
3
+ const useAutoCalculated = () => AUTO_CALCULATED;
4
+ export {
5
+ useAutoCalculated
6
+ };
7
+ //# sourceMappingURL=useAutoCalculated.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/config/useAutoCalculated.ts"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "const AUTO_CALCULATED: Record<string, never> = {};\n\nexport const useAutoCalculated = () => AUTO_CALCULATED;\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB,MAAM,kBAAyC,CAAC;AAEzC,MAAM,oBAAoB,MAAM;",
6
+ "names": []
7
+ }
@@ -0,0 +1,33 @@
1
+ import * as React from "react";
2
+ import { useMemo } from "react";
3
+ import { useInternalStore } from "./store.js";
4
+ import { LEFT_NAVIGATION_TREE_REGION_FOCUSES } from "../constants/index.js";
5
+ const useFocusTracker = () => {
6
+ const setFocusRegion = useInternalStore((state) => state.setFocusRegion);
7
+ const setFocusedItemId = useInternalStore((state) => state.setFocusedItemId);
8
+ return useMemo(
9
+ () => ({
10
+ trackFocusItem: (id) => {
11
+ setFocusRegion(LEFT_NAVIGATION_TREE_REGION_FOCUSES.TREE);
12
+ setFocusedItemId(id);
13
+ },
14
+ trackFocusHeader: () => {
15
+ setFocusRegion(LEFT_NAVIGATION_TREE_REGION_FOCUSES.HEADER);
16
+ setFocusedItemId(null);
17
+ },
18
+ trackFocusFooter: () => {
19
+ setFocusRegion(LEFT_NAVIGATION_TREE_REGION_FOCUSES.FOOTER);
20
+ setFocusedItemId(null);
21
+ },
22
+ trackFocusRegionReset: () => {
23
+ setFocusRegion(LEFT_NAVIGATION_TREE_REGION_FOCUSES.RESET);
24
+ setFocusedItemId(null);
25
+ }
26
+ }),
27
+ [setFocusRegion, setFocusedItemId]
28
+ );
29
+ };
30
+ export {
31
+ useFocusTracker
32
+ };
33
+ //# sourceMappingURL=useFocusTracker.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/config/useFocusTracker.ts"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useMemo } from 'react';\nimport { useInternalStore } from './store.js';\nimport { LEFT_NAVIGATION_TREE_REGION_FOCUSES } from '../constants/index.js';\n\n/**\n * Write side of the focus tracker: named semantic handlers only.\n * Components read the focus region and item from the store with their own selector,\n * and apply focus from a ref callback when they are the derived focus target.\n */\nexport const useFocusTracker = () => {\n const setFocusRegion = useInternalStore((state) => state.setFocusRegion);\n const setFocusedItemId = useInternalStore((state) => state.setFocusedItemId);\n\n return useMemo(\n () => ({\n trackFocusItem: (id: string) => {\n setFocusRegion(LEFT_NAVIGATION_TREE_REGION_FOCUSES.TREE);\n setFocusedItemId(id);\n },\n trackFocusHeader: () => {\n setFocusRegion(LEFT_NAVIGATION_TREE_REGION_FOCUSES.HEADER);\n setFocusedItemId(null);\n },\n trackFocusFooter: () => {\n setFocusRegion(LEFT_NAVIGATION_TREE_REGION_FOCUSES.FOOTER);\n setFocusedItemId(null);\n },\n trackFocusRegionReset: () => {\n setFocusRegion(LEFT_NAVIGATION_TREE_REGION_FOCUSES.RESET);\n setFocusedItemId(null);\n },\n }),\n [setFocusRegion, setFocusedItemId],\n );\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,eAAe;AACxB,SAAS,wBAAwB;AACjC,SAAS,2CAA2C;AAO7C,MAAM,kBAAkB,MAAM;AACnC,QAAM,iBAAiB,iBAAiB,CAAC,UAAU,MAAM,cAAc;AACvE,QAAM,mBAAmB,iBAAiB,CAAC,UAAU,MAAM,gBAAgB;AAE3E,SAAO;AAAA,IACL,OAAO;AAAA,MACL,gBAAgB,CAAC,OAAe;AAC9B,uBAAe,oCAAoC,IAAI;AACvD,yBAAiB,EAAE;AAAA,MACrB;AAAA,MACA,kBAAkB,MAAM;AACtB,uBAAe,oCAAoC,MAAM;AACzD,yBAAiB,IAAI;AAAA,MACvB;AAAA,MACA,kBAAkB,MAAM;AACtB,uBAAe,oCAAoC,MAAM;AACzD,yBAAiB,IAAI;AAAA,MACvB;AAAA,MACA,uBAAuB,MAAM;AAC3B,uBAAe,oCAAoC,KAAK;AACxD,yBAAiB,IAAI;AAAA,MACvB;AAAA,IACF;AAAA,IACA,CAAC,gBAAgB,gBAAgB;AAAA,EACnC;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,133 @@
1
+ import * as React from "react";
2
+ import { useMemo, useRef } from "react";
3
+ import { LEFT_NAVIGATION_TREE_ITEM_TYPES, LEFT_NAVIGATION_TREE_REGION_FOCUSES } from "../constants/index.js";
4
+ import { useInternalStore, usePropsStore } from "./store.js";
5
+ import { useFocusTracker } from "./useFocusTracker.js";
6
+ import {
7
+ getDefaultSelection,
8
+ getTypeaheadMatchId,
9
+ hasChildren,
10
+ isControlledParent,
11
+ isDescendantOf
12
+ } from "./treeModel.js";
13
+ const getNodeId = (target) => target?.dataset?.dsid;
14
+ const useTreeHandlers = (model) => {
15
+ const onItemClick = usePropsStore((state) => state.onItemClick);
16
+ const onItemOpenedChange = usePropsStore((state) => state.onItemOpenedChange);
17
+ const onSelectedChange = usePropsStore((state) => state.onSelectedChange);
18
+ const onFocusChange = usePropsStore((state) => state.onFocusChange);
19
+ const disableDefaultSelection = usePropsStore((state) => state.disableDefaultSelection);
20
+ const selectedItem = usePropsStore((state) => state.selectedItem);
21
+ const setToggles = useInternalStore((state) => state.setToggles);
22
+ const setInternalSelectedItem = useInternalStore((state) => state.setInternalSelectedItem);
23
+ const getFocusRegion = useInternalStore((state) => state.getFocusRegion);
24
+ const { trackFocusItem, trackFocusRegionReset } = useFocusTracker();
25
+ const reportedFocusId = useRef(null);
26
+ return useMemo(() => {
27
+ const { index, openIds, visibleIds, isRail } = model;
28
+ const select = (id) => {
29
+ if (selectedItem === void 0) setInternalSelectedItem(id);
30
+ if (id !== model.currentId) onSelectedChange(id);
31
+ };
32
+ const setOpen = (id, nextIsOpened, e) => {
33
+ const info = index.get(id);
34
+ if (!info) return;
35
+ if (!isControlledParent(info.item)) setToggles((toggles) => ({ ...toggles, [id]: nextIsOpened }));
36
+ onItemOpenedChange(info.item, nextIsOpened, e);
37
+ };
38
+ const activateParent = (id, e) => {
39
+ const isOpen = openIds.has(id);
40
+ const nextIsOpened = isRail || !isOpen;
41
+ if (nextIsOpened !== isOpen) setOpen(id, nextIsOpened, e);
42
+ if (!nextIsOpened || disableDefaultSelection || isDescendantOf(index, id, model.currentLeafId)) return;
43
+ const { leafId, parentIdsToOpen } = getDefaultSelection(index, id);
44
+ if (!leafId) return;
45
+ parentIdsToOpen.filter((parentId) => !openIds.has(parentId)).forEach((parentId) => setOpen(parentId, true, e));
46
+ select(leafId);
47
+ };
48
+ const activate = (id, e) => {
49
+ const info = index.get(id);
50
+ if (!info) return;
51
+ onItemClick(info.item, e);
52
+ if (hasChildren(info)) {
53
+ activateParent(id, e);
54
+ return;
55
+ }
56
+ if (info.item.type === LEFT_NAVIGATION_TREE_ITEM_TYPES.LEAF && info.item.itemOpts?.selectable !== false) {
57
+ select(id);
58
+ }
59
+ };
60
+ const moveTo = (targetId) => {
61
+ if (targetId) trackFocusItem(targetId);
62
+ };
63
+ const keyHandlers = {
64
+ ArrowDown: (id) => moveTo(visibleIds[visibleIds.indexOf(id) + 1]),
65
+ ArrowUp: (id) => moveTo(visibleIds[visibleIds.indexOf(id) - 1]),
66
+ Home: () => moveTo(visibleIds[0]),
67
+ End: () => moveTo(visibleIds[visibleIds.length - 1]),
68
+ ArrowRight: (id, info, e) => {
69
+ if (isRail || !hasChildren(info)) return;
70
+ if (!openIds.has(id)) setOpen(id, true, e);
71
+ else moveTo(info.childIds[0]);
72
+ },
73
+ ArrowLeft: (id, info, e) => {
74
+ if (isRail) return;
75
+ if (hasChildren(info) && openIds.has(id)) setOpen(id, false, e);
76
+ else moveTo(info.parentId ?? void 0);
77
+ },
78
+ Enter: (id, _info, e) => activate(id, e),
79
+ " ": (id, _info, e) => activate(id, e)
80
+ };
81
+ const onTreeKeyDown = (e) => {
82
+ if (e.ctrlKey || e.altKey || e.metaKey) return;
83
+ const id = getNodeId(e.target);
84
+ const info = id ? index.get(id) : void 0;
85
+ if (!id || !info) return;
86
+ const keyHandler = keyHandlers[e.key];
87
+ if (keyHandler) {
88
+ keyHandler(id, info, e);
89
+ e.preventDefault();
90
+ return;
91
+ }
92
+ if (e.key.length !== 1) return;
93
+ const matchId = getTypeaheadMatchId({ index, visibleIds, fromId: id, character: e.key });
94
+ if (!matchId) return;
95
+ trackFocusItem(matchId);
96
+ e.preventDefault();
97
+ };
98
+ const onTreeFocus = (e) => {
99
+ const id = getNodeId(e.target);
100
+ if (!id || !index.has(id)) return;
101
+ trackFocusItem(id);
102
+ if (reportedFocusId.current !== id) {
103
+ reportedFocusId.current = id;
104
+ onFocusChange(id);
105
+ }
106
+ };
107
+ const onTreeBlur = (e) => {
108
+ const next = e.relatedTarget;
109
+ if (next && e.currentTarget.contains(next)) return;
110
+ if (!e.target.isConnected) return;
111
+ reportedFocusId.current = null;
112
+ if (getFocusRegion() === LEFT_NAVIGATION_TREE_REGION_FOCUSES.TREE) trackFocusRegionReset();
113
+ };
114
+ return { activate, onTreeKeyDown, onTreeFocus, onTreeBlur };
115
+ }, [
116
+ model,
117
+ selectedItem,
118
+ disableDefaultSelection,
119
+ onItemClick,
120
+ onItemOpenedChange,
121
+ onSelectedChange,
122
+ onFocusChange,
123
+ setToggles,
124
+ setInternalSelectedItem,
125
+ getFocusRegion,
126
+ trackFocusItem,
127
+ trackFocusRegionReset
128
+ ]);
129
+ };
130
+ export {
131
+ useTreeHandlers
132
+ };
133
+ //# sourceMappingURL=useTreeHandlers.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/config/useTreeHandlers.ts"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "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"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACCvB,SAAS,SAAS,cAAc;AAChC,SAAS,iCAAiC,2CAA2C;AAErF,SAAS,kBAAkB,qBAAqB;AAChD,SAAS,uBAAuB;AAEhC;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAIP,MAAM,YA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