@ensi-platform/admin-ui 0.14.1 → 0.15.1

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 (66) hide show
  1. package/dist/{Component-DNQetS8Y.js → Component-B3Iscpfx.js} +2 -2
  2. package/dist/{Component-DNQetS8Y.js.map → Component-B3Iscpfx.js.map} +1 -1
  3. package/dist/Component-BcBH4MvL.js +179 -0
  4. package/dist/Component-BcBH4MvL.js.map +1 -0
  5. package/dist/active-filters/index.js +1 -1
  6. package/dist/assets/index.css +1 -1
  7. package/dist/assets/index22.css +1 -1
  8. package/dist/assets/index23.css +1 -1
  9. package/dist/assets/index24.css +1 -1
  10. package/dist/assets/index25.css +1 -1
  11. package/dist/assets/index26.css +1 -1
  12. package/dist/assets/index27.css +1 -1
  13. package/dist/assets/index28.css +1 -1
  14. package/dist/assets/index29.css +1 -1
  15. package/dist/assets/index30.css +1 -1
  16. package/dist/assets/index31.css +1 -1
  17. package/dist/assets/index32.css +1 -1
  18. package/dist/assets/index33.css +1 -1
  19. package/dist/assets/index34.css +1 -1
  20. package/dist/assets/index35.css +1 -1
  21. package/dist/assets/index36.css +1 -0
  22. package/dist/bottom-sheet/index.js +1 -1
  23. package/dist/cascade-menu/index.js +2 -2
  24. package/dist/combobox/index.js +1 -1
  25. package/dist/context-menu/Component.d.ts.map +1 -1
  26. package/dist/context-menu/index.js +1 -1
  27. package/dist/context-menu/types.d.ts +1 -1
  28. package/dist/context-menu/types.d.ts.map +1 -1
  29. package/dist/data-table/index.js +1 -1
  30. package/dist/date-picker/index.js +1 -1
  31. package/dist/date-range-picker/index.js +2 -2
  32. package/dist/dropzone/index.js +1 -1
  33. package/dist/filters/index.js +1 -1
  34. package/dist/{index-BVJblFhG.js → index-CoyesAvE.js} +2 -2
  35. package/dist/{index-BVJblFhG.js.map → index-CoyesAvE.js.map} +1 -1
  36. package/dist/{index-o14ps46j.js → index-DbaGX3oz.js} +2 -2
  37. package/dist/{index-o14ps46j.js.map → index-DbaGX3oz.js.map} +1 -1
  38. package/dist/multi-autocomplete/index.js +1 -1
  39. package/dist/multi-autocomplete-async/index.js +1 -1
  40. package/dist/multi-select/index.js +1 -1
  41. package/dist/rating/index.js +1 -1
  42. package/dist/tabs/index.js +1 -1
  43. package/dist/toast/index.js +1 -1
  44. package/dist/tree/Component.d.ts +5 -0
  45. package/dist/tree/Component.d.ts.map +1 -0
  46. package/dist/tree/components/Item/index.d.ts +11 -0
  47. package/dist/tree/components/Item/index.d.ts.map +1 -0
  48. package/dist/tree/index.d.ts +3 -0
  49. package/dist/tree/index.d.ts.map +1 -0
  50. package/dist/tree/index.js +84 -0
  51. package/dist/tree/index.js.map +1 -0
  52. package/dist/tree/types.d.ts +51 -0
  53. package/dist/tree/types.d.ts.map +1 -0
  54. package/dist/tree/utils.d.ts +7 -0
  55. package/dist/tree/utils.d.ts.map +1 -0
  56. package/dist/typography/index.js +1 -1
  57. package/dist/vertical-tabs/index.js +1 -1
  58. package/package.json +5 -1
  59. package/src/context-menu/docs/Description.md +2 -2
  60. package/src/context-menu/types.ts +1 -1
  61. package/src/tree/docs/Description.md +29 -0
  62. package/src/tree/docs/Example.md +15 -0
  63. package/src/tree/docs/cssVariables.ts +16 -0
  64. package/src/tree/types.ts +56 -0
  65. package/dist/Component-B1piMJHv.js +0 -176
  66. package/dist/Component-B1piMJHv.js.map +0 -1
@@ -0,0 +1,84 @@
1
+ import { jsxs as m, jsx as n } from "react/jsx-runtime";
2
+ import { useState as w, useMemo as B } from "react";
3
+ import p from "classnames";
4
+ import { TreeItem as R, TreeItemContent as x, Button as $, Collection as j, Tree as E } from "react-aria-components";
5
+ import { s as I } from "../index-h8z54aFR.js";
6
+ import { typographyStyles as P } from "../typography/index.js";
7
+ import { C as D } from "../ChevronRight-BsaiJImC.js";
8
+ import '../assets/index22.css';const V = "aub_styles-module_root_172c6", q = "aub_styles-module_content_a4782", z = "aub_styles-module_label_67988", A = "aub_styles-module_chevronSlot_d846b", F = "aub_styles-module_chevron_74e49", G = "aub_styles-module_icon_abbdb", r = {
9
+ root: V,
10
+ content: q,
11
+ label: z,
12
+ chevronSlot: A,
13
+ chevron: F,
14
+ icon: G
15
+ }, i = ({ item: o, readOnly: e = !1 }) => {
16
+ const l = o.children ?? [];
17
+ return /* @__PURE__ */ m(R, { id: o.id, textValue: o.label, className: r.root, "data-readonly": e || void 0, children: [
18
+ /* @__PURE__ */ n(x, { children: ({ hasChildItems: t }) => /* @__PURE__ */ m("span", { className: r.content, children: [
19
+ /* @__PURE__ */ n("span", { className: r.chevronSlot, children: t ? /* @__PURE__ */ n($, { slot: "chevron", className: r.chevron, children: /* @__PURE__ */ n(D, { className: r.icon }) }) : null }),
20
+ /* @__PURE__ */ n("span", { className: p(P.bodyS, r.label), children: o.label })
21
+ ] }) }),
22
+ l.length > 0 ? /* @__PURE__ */ n(j, { items: l, children: (t) => /* @__PURE__ */ n(i, { item: t, readOnly: e }) }) : null
23
+ ] });
24
+ };
25
+ i.displayName = "TreeRow";
26
+ const d = (o, e, l) => (o.forEach((t) => {
27
+ e(t) && l.push(t.id), t.children?.length && d(t.children, e, l);
28
+ }), l), H = (o) => d(o, () => !0, []), J = (o) => d(o, (e) => !!e.disabled, []), K = "aub_styles-module_root_e0d56", L = {
29
+ root: K
30
+ }, O = /* @__PURE__ */ new Set(), Q = (o, e, l, t) => o ? { selectedKeys: e ?? t } : e !== void 0 ? { selectedKeys: e } : { defaultSelectedKeys: l }, U = I(
31
+ ({
32
+ ref: o,
33
+ items: e,
34
+ selectionMode: l = "single",
35
+ selectedKeys: t,
36
+ defaultSelectedKeys: h,
37
+ onSelectionChange: b,
38
+ expandedKeys: u,
39
+ defaultExpandedKeys: _,
40
+ onExpandedChange: f,
41
+ disabled: s = !1,
42
+ readOnly: v = !1,
43
+ className: y,
44
+ dataTestId: S,
45
+ "aria-label": g
46
+ }) => {
47
+ const [N] = w(() => h ?? O), c = v && !s, T = B(
48
+ () => s ? H(e) : J(e),
49
+ [s, e]
50
+ ), C = Q(
51
+ c,
52
+ t,
53
+ h,
54
+ N
55
+ );
56
+ return /* @__PURE__ */ n(
57
+ E,
58
+ {
59
+ ref: o,
60
+ "aria-label": g,
61
+ className: p(L.root, y),
62
+ items: e,
63
+ selectionMode: l,
64
+ selectionBehavior: l === "multiple" ? "toggle" : "replace",
65
+ disallowEmptySelection: l === "single",
66
+ disabledKeys: T,
67
+ disabledBehavior: "all",
68
+ "data-test-id": S,
69
+ onSelectionChange: (a) => {
70
+ c || s || b?.(a);
71
+ },
72
+ onExpandedChange: f,
73
+ ...C,
74
+ ...u !== void 0 ? { expandedKeys: u } : { defaultExpandedKeys: _ },
75
+ children: (a) => /* @__PURE__ */ n(i, { item: a, readOnly: c })
76
+ }
77
+ );
78
+ }
79
+ );
80
+ U.displayName = "Tree";
81
+ export {
82
+ U as Tree
83
+ };
84
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../src/tree/components/Item/index.tsx","../../src/tree/utils.ts","../../src/tree/Component.tsx"],"sourcesContent":["import cn from 'classnames';\nimport { Button, Collection, TreeItem, TreeItemContent } from 'react-aria-components';\n\nimport { typographyStyles } from '@ds/typography';\n\nimport { ChevronRight } from '@/icons';\n\nimport { type ITreeItem } from '../../types';\n\nimport styles from './styles.module.css';\n\ninterface ITreeRowProps {\n item: ITreeItem;\n readOnly?: boolean;\n}\n\nexport const TreeRow = ({ item, readOnly = false }: ITreeRowProps) => {\n const children = item.children ?? [];\n\n return (\n <TreeItem id={item.id} textValue={item.label} className={styles.root} data-readonly={readOnly || undefined}>\n <TreeItemContent>\n {({ hasChildItems }) => (\n <span className={styles.content}>\n <span className={styles.chevronSlot}>\n {hasChildItems ? (\n <Button slot=\"chevron\" className={styles.chevron}>\n <ChevronRight className={styles.icon} />\n </Button>\n ) : null}\n </span>\n <span className={cn(typographyStyles.bodyS, styles.label)}>{item.label}</span>\n </span>\n )}\n </TreeItemContent>\n {children.length > 0 ? (\n <Collection items={children}>{child => <TreeRow item={child} readOnly={readOnly} />}</Collection>\n ) : null}\n </TreeItem>\n );\n};\n\nTreeRow.displayName = 'TreeRow';\n","import { type Key } from 'react-aria-components';\n\nimport { type ITreeItem } from './types';\n\nconst visit = (items: readonly ITreeItem[], pick: (item: ITreeItem) => boolean, keys: Key[]) => {\n items.forEach(item => {\n if (pick(item)) keys.push(item.id);\n if (item.children?.length) visit(item.children, pick, keys);\n });\n\n return keys;\n};\n\n/** Every node id. */\nexport const collectTreeKeys = (items: readonly ITreeItem[]) => visit(items, () => true, []);\n\n/** Ids of nodes marked `disabled`. */\nexport const collectDisabledKeys = (items: readonly ITreeItem[]) => visit(items, item => Boolean(item.disabled), []);\n","import { useMemo, useState } from 'react';\n\nimport cn from 'classnames';\nimport { Tree as RacTree, type Selection } from 'react-aria-components';\n\nimport { supportRef } from '@ds/common/support-ref';\n\nimport { TreeRow } from './components/Item';\nimport { type ITreeProps } from './types';\nimport { collectDisabledKeys, collectTreeKeys } from './utils';\n\nimport styles from './styles.module.css';\n\nconst emptySelection: Selection = new Set();\n\nconst toSelectionProps = (\n lockSelection: boolean,\n selectedKeys: Selection | undefined,\n defaultSelectedKeys: Selection | undefined,\n uncontrolledSelection: Selection\n) => {\n if (lockSelection) return { selectedKeys: selectedKeys ?? uncontrolledSelection };\n if (selectedKeys !== undefined) return { selectedKeys };\n\n return { defaultSelectedKeys };\n};\n\nexport const Tree = supportRef(\n ({\n ref,\n items,\n selectionMode = 'single',\n selectedKeys,\n defaultSelectedKeys,\n onSelectionChange,\n expandedKeys,\n defaultExpandedKeys,\n onExpandedChange,\n disabled = false,\n readOnly = false,\n className,\n dataTestId,\n 'aria-label': ariaLabel,\n }: ITreeProps) => {\n const [uncontrolledSelection] = useState<Selection>(() => defaultSelectedKeys ?? emptySelection);\n const lockSelection = readOnly && !disabled;\n const disabledKeys = useMemo(\n () => (disabled ? collectTreeKeys(items) : collectDisabledKeys(items)),\n [disabled, items]\n );\n const selectionProps = toSelectionProps(\n lockSelection,\n selectedKeys,\n defaultSelectedKeys,\n uncontrolledSelection\n );\n\n return (\n <RacTree\n ref={ref}\n aria-label={ariaLabel}\n className={cn(styles.root, className)}\n items={items}\n selectionMode={selectionMode}\n selectionBehavior={selectionMode === 'multiple' ? 'toggle' : 'replace'}\n // Single mode clears a selected row on a second press when empty selection is allowed.\n // A controlled empty `selectedKeys` still clears from outside.\n disallowEmptySelection={selectionMode === 'single'}\n disabledKeys={disabledKeys}\n disabledBehavior=\"all\"\n data-test-id={dataTestId}\n onSelectionChange={keys => {\n if (lockSelection || disabled) return;\n\n onSelectionChange?.(keys);\n }}\n onExpandedChange={onExpandedChange}\n {...selectionProps}\n {...(expandedKeys !== undefined ? { expandedKeys } : { defaultExpandedKeys })}\n >\n {item => <TreeRow item={item} readOnly={lockSelection} />}\n </RacTree>\n );\n }\n);\n\nTree.displayName = 'Tree';\n"],"names":["TreeRow","item","readOnly","children","jsxs","TreeItem","styles","jsx","TreeItemContent","hasChildItems","Button","ChevronRight","cn","typographyStyles","Collection","child","visit","items","pick","keys","collectTreeKeys","collectDisabledKeys","emptySelection","toSelectionProps","lockSelection","selectedKeys","defaultSelectedKeys","uncontrolledSelection","Tree","supportRef","ref","selectionMode","onSelectionChange","expandedKeys","defaultExpandedKeys","onExpandedChange","disabled","className","dataTestId","ariaLabel","useState","disabledKeys","useMemo","selectionProps","RacTree"],"mappings":";;;;;;;;;;;;;;GAgBaA,IAAU,CAAC,EAAE,MAAAC,GAAM,UAAAC,IAAW,SAA2B;AAClE,QAAMC,IAAWF,EAAK,YAAY,CAAA;AAElC,SACI,gBAAAG,EAACC,GAAA,EAAS,IAAIJ,EAAK,IAAI,WAAWA,EAAK,OAAO,WAAWK,EAAO,MAAM,iBAAeJ,KAAY,QAC7F,UAAA;AAAA,IAAA,gBAAAK,EAACC,GAAA,EACI,WAAC,EAAE,eAAAC,EAAA,MACA,gBAAAL,EAAC,QAAA,EAAK,WAAWE,EAAO,SACpB,UAAA;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ACA,cAAAC;AAAA,IACA,qBAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,UAAAC,IAAW;AAAA,IACX,UAAAlC,IAAW;AAAA,IACX,WAAAmC;AAAA,IACA,YAAAC;AAAA,IACA,cAAcC;AAAA,EAAA,MACA;AACd,UAAM,CAACZ,CAAqB,IAAIa,EAAoB,MAAMd,KAAuBJ,CAAc,GACzFE,IAAgBtB,KAAY,CAACkC,GAC7BK,IAAeC;AAAA,MACjB,MAAON,IAAWhB,EAAgBH,CAAK,IAAII,EAAoBJ,CAAK;AAAA,MACpE,CAACmB,GAAUnB,CAAK;AAAA,IAAA,GAEd0B,IAAiBpB;AAAA,MACnBC;AAAA,MACAC;AAAA,MACAC;AAAA,MACAC;AAAA,IAAA;AAGJ,WACI,gBAAApB;AAAA,MAACqC;AAAAA,MAAA;AAAA,QACG,KAAAd;AAAA,QACA,cAAYS;AAAA,QACZ,WAAW3B,EAAGN,EAAO,MAAM+B,CAAS;AAAA,QACpC,OAAApB;AAAA,QACA,eAAAc;AAAA,QACA,mBAAmBA,MAAkB,aAAa,WAAW;AAAA,QAG7D,wBAAwBA,MAAkB;AAAA,QAC1C,cAAAU;AAAA,QACA,kBAAiB;AAAA,QACjB,gBAAcH;AAAA,QACd,mBAAmB,CAAAnB,MAAQ;AACvB,UAAIK,KAAiBY,KAErBJ,IAAoBb,CAAI;AAAA,QAC5B;AAAA,QACA,kBAAAgB;AAAA,QACC,GAAGQ;AAAA,QACH,GAAIV,MAAiB,SAAY,EAAE,cAAAA,EAAA,IAAiB,EAAE,qBAAAC,EAAA;AAAA,QAEtD,UAAA,CAAAjC,MAAQ,gBAAAM,EAACP,GAAA,EAAQ,MAAAC,GAAY,UAAUuB,EAAA,CAAe;AAAA,MAAA;AAAA,IAAA;AAAA,EAGnE;AACJ;AAEAI,EAAK,cAAc;"}
@@ -0,0 +1,51 @@
1
+ import { Ref } from 'react';
2
+ import { Key, Selection } from 'react-aria-components';
3
+ import { IDataTestIdProps } from '../ds/common/index.js';
4
+ /** One node. Omit `children` or pass an empty list for a leaf. */
5
+ export interface ITreeItem {
6
+ /** Node key. */
7
+ id: string | number;
8
+ /** Visible label. */
9
+ label: string;
10
+ /** Nested nodes. */
11
+ children?: ITreeItem[];
12
+ /** Blocks selection and expansion of this node. */
13
+ disabled?: boolean;
14
+ }
15
+ /** Selection mode. */
16
+ export type TTreeSelectionMode = 'none' | 'single' | 'multiple';
17
+ /** Selection and expansion state. */
18
+ export interface ITreeControlProps {
19
+ /** Selection mode. */
20
+ selectionMode?: TTreeSelectionMode;
21
+ /** Controlled selection. An empty set means nothing is selected. */
22
+ selectedKeys?: Selection;
23
+ /** Uncontrolled initial selection. */
24
+ defaultSelectedKeys?: Selection;
25
+ /** Selection change handler. */
26
+ onSelectionChange?: (keys: Selection) => void;
27
+ /** Controlled expanded branches. */
28
+ expandedKeys?: Iterable<Key>;
29
+ /** Uncontrolled initial expanded branches. */
30
+ defaultExpandedKeys?: Iterable<Key>;
31
+ /** Expanded branches change handler. */
32
+ onExpandedChange?: (keys: Set<Key>) => void;
33
+ /** Blocks selection and expansion for every node. */
34
+ disabled?: boolean;
35
+ /** Keeps the current selection. Expansion still works. */
36
+ readOnly?: boolean;
37
+ }
38
+ /** Own / chrome props (not from RAC). */
39
+ export interface ITreeOwnProps extends IDataTestIdProps {
40
+ /** Nodes. */
41
+ items: ITreeItem[];
42
+ /** Accessible name. The tree has no visible caption. */
43
+ 'aria-label': string;
44
+ /** Root class name. */
45
+ className?: string;
46
+ /** Ref to the tree root (React 19 prop). */
47
+ ref?: Ref<HTMLDivElement>;
48
+ }
49
+ export interface ITreeProps extends ITreeControlProps, ITreeOwnProps {
50
+ }
51
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/tree/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,OAAO,CAAC;AAEjC,OAAO,EAAE,KA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AC;IACrB,uBAAuB;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4CAA4C;IAC5C,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC7B;AAED,MAAM,WAAW,UAAW,SAAQ,iBAAiB,EAAE,aAAa;CAAG"}
@@ -0,0 +1,7 @@
1
+ import { Key } from 'react-aria-components';
2
+ import { ITreeItem } from './types';
3
+ /** Every node id. */
4
+ export declare const collectTreeKeys: (items: readonly ITreeItem[]) => Key[];
5
+ /** Ids of nodes marked `disabled`. */
6
+ export declare const collectDisabledKeys: (items: readonly ITreeItem[]) => Key[];
7
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/tree/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAEjD,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,SAAS,CAAC;AAWzC,qBAAqB;AACrB,eAAO,MAAM,eAAe,GAAI,OAAO,SAAS,SAAS,EAAE,UAAiC,CAAC;AAE7F,sCAAsC;AACtC,eAAO,MAAM,mBAAmB,GAAI,OAAO,SAAS,SAAS,EAAE,UAAqD,CAAC"}
@@ -1,4 +1,4 @@
1
- import '../assets/index35.css';const o = "aub_styles-module_bodyXs_863df", d = "aub_styles-module_bodyS_94552", s = "aub_styles-module_bodySTight_67dbf", b = "aub_styles-module_bodyM_10045", y = "aub_styles-module_bodyL_f2885", e = "aub_styles-module_headingM_1babc", t = "aub_styles-module_headingL_09557", _ = {
1
+ import '../assets/index36.css';const o = "aub_styles-module_bodyXs_863df", d = "aub_styles-module_bodyS_94552", s = "aub_styles-module_bodySTight_67dbf", b = "aub_styles-module_bodyM_10045", y = "aub_styles-module_bodyL_f2885", e = "aub_styles-module_headingM_1babc", t = "aub_styles-module_headingL_09557", _ = {
2
2
  bodyXs: o,
3
3
  bodyS: d,
4
4
  bodySTight: s,
@@ -5,7 +5,7 @@ import { SelectionIndicator as w, Tab as D, TabList as K, TabPanel as M, TabPane
5
5
  import { s as _ } from "../index-h8z54aFR.js";
6
6
  import { typographyStyles as b } from "../typography/index.js";
7
7
  import { cva as p } from "class-variance-authority";
8
- import '../assets/index31.css';const V = C(void 0), g = () => {
8
+ import '../assets/index32.css';const V = C(void 0), g = () => {
9
9
  const t = L(V);
10
10
  if (!t)
11
11
  throw new Error("This component must be used within a <VerticalTabs> component");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ensi-platform/admin-ui",
3
- "version": "0.14.1",
3
+ "version": "0.15.1",
4
4
  "description": "Admin UI for Ensi admin panel",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -289,6 +289,10 @@
289
289
  "types": "./dist/tooltip/index.d.ts",
290
290
  "import": "./dist/tooltip/index.js"
291
291
  },
292
+ "./tree": {
293
+ "types": "./dist/tree/index.d.ts",
294
+ "import": "./dist/tree/index.js"
295
+ },
292
296
  "./typography": {
293
297
  "types": "./dist/typography/index.d.ts",
294
298
  "import": "./dist/typography/index.js"
@@ -1,4 +1,4 @@
1
- Fixed cursor menu (RMB / coordinates): portal, dismiss on outside click and Escape.
1
+ Fixed cursor menu (RMB / coordinates): portal, dismiss on outside click, Escape, page or container scroll, and window resize.
2
2
 
3
3
  ```tsx
4
4
  import { ContextMenu } from '@ensi-platform/admin-ui/context-menu';
@@ -19,7 +19,7 @@ import { ContextMenu } from '@ensi-platform/admin-ui/context-menu';
19
19
  | `open` | `boolean` | `false` | whether the menu is open |
20
20
  | `x` | `number` | — | left position (viewport px) |
21
21
  | `y` | `number` | — | top position (viewport px) |
22
- | `onClose` | `() => void` | — | close (outside / Escape) |
22
+ | `onClose` | `() => void` | — | close (outside / Escape / scroll / resize) |
23
23
  | `size` | `sm` \| `md` \| `lg` | `md` | size |
24
24
  | `variant` | `primary` | `primary` | visual variant |
25
25
  | `children` | `ReactNode` | — | `ContextMenu.Item` / `Separator` entries |
@@ -24,7 +24,7 @@ export interface IContextMenuControlProps {
24
24
  x: number;
25
25
  /** Fixed top position (viewport px). */
26
26
  y: number;
27
- /** Close handler (outside click / Escape). */
27
+ /** Close handler (outside click / Escape / outside scroll / window resize). */
28
28
  onClose: () => void;
29
29
  }
30
30
 
@@ -0,0 +1,29 @@
1
+ A tree of nested rows: the chevron expands a branch, and pressing a row selects it.
2
+
3
+ ```tsx
4
+ import { Tree } from '@ensi-platform/admin-ui/tree';
5
+ ```
6
+
7
+ ## When to use
8
+
9
+ - a hierarchy where branches expand and a row is selected separately
10
+ - one selected node, or several
11
+ - not a flat menu — see `MenuList`
12
+ - not a short list of values — see `Select`
13
+
14
+ ## API (short)
15
+
16
+ | Prop | Values | Default | Description |
17
+ | --------------------- | --------------------------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
18
+ | `items` | `{ id, label, children?, disabled? }[]` | — | nodes. An empty or omitted `children` is a leaf. `disabled` blocks selection and expansion of that node |
19
+ | `aria-label` | `string` | — | accessible name. The tree has no visible caption |
20
+ | `selectionMode` | `none` \| `single` \| `multiple` | `single` | selection mode. In `single`, pressing the selected row again keeps it. In `multiple`, pressing it again clears it. An empty key set is allowed |
21
+ | `selectedKeys` | `Selection` | — | selected keys |
22
+ | `defaultSelectedKeys` | `Selection` | — | initial selection without external state |
23
+ | `onSelectionChange` | `(keys) => void` | — | selection handler. Not called when `disabled` or `readOnly` |
24
+ | `expandedKeys` | `Iterable<Key>` | — | expanded branches |
25
+ | `defaultExpandedKeys` | `Iterable<Key>` | — | initial expansion without external state |
26
+ | `onExpandedChange` | `(keys) => void` | — | expansion handler |
27
+ | `disabled` | `boolean` | `false` | no node can be selected or expanded. Wins over `readOnly` |
28
+ | `readOnly` | `boolean` | `false` | the selection stays visible and does not change. Branches still expand |
29
+ | `dataTestId` | `string` | — | `data-test-id` attribute |
@@ -0,0 +1,15 @@
1
+ ## Example
2
+
3
+ ```tsx
4
+ <Tree
5
+ aria-label="Categories"
6
+ items={[
7
+ {
8
+ id: 'clothes',
9
+ label: 'Clothing',
10
+ children: [{ id: 'shirts', label: 'Shirts' }],
11
+ },
12
+ { id: 'shoes', label: 'Shoes' },
13
+ ]}
14
+ />
15
+ ```
@@ -0,0 +1,16 @@
1
+ /** Tree CSS variables from semantic tokens (--aui-tree-*). */
2
+ export const docsCssVariables = `/* CSS variables — Tree (--aui-tree-*) */
3
+ --aui-tree-fg-primary: var(--aui-page-fg-primary); /* row label */
4
+ --aui-tree-fg-muted: var(--aui-page-fg-muted); /* chevron */
5
+ --aui-tree-item-bg-hover: var(--aui-surface-bg-muted-active); /* row hover */
6
+ --aui-tree-item-bg-selected: var(--aui-surface-bg-muted); /* selected row */
7
+ --aui-tree-item-bg-selected-hover: var(--aui-surface-bg-muted-active); /* selected row hover */
8
+ --aui-tree-border-focus: var(--aui-control-border-focus); /* focus ring */
9
+ --aui-tree-item-pad-y: var(--aui-spacing-8); /* row block padding */
10
+ --aui-tree-item-pad-x: var(--aui-spacing-8); /* row inline end padding */
11
+ --aui-tree-item-indent: var(--aui-spacing-12); /* indent per level */
12
+ --aui-tree-item-gap: var(--aui-spacing-4); /* chevron to label */
13
+ --aui-tree-chevron-size: var(--aui-spacing-16); /* chevron slot */
14
+ --aui-tree-duration-fast: var(--aui-control-duration-fast); /* chevron rotation */
15
+ --aui-tree-ease-out: var(--aui-control-ease-out); /* chevron rotation easing */
16
+ `;
@@ -0,0 +1,56 @@
1
+ import { type Ref } from 'react';
2
+
3
+ import { type Key, type Selection } from 'react-aria-components';
4
+
5
+ import { type IDataTestIdProps } from '@ds/common';
6
+
7
+ /** One node. Omit `children` or pass an empty list for a leaf. */
8
+ export interface ITreeItem {
9
+ /** Node key. */
10
+ id: string | number;
11
+ /** Visible label. */
12
+ label: string;
13
+ /** Nested nodes. */
14
+ children?: ITreeItem[];
15
+ /** Blocks selection and expansion of this node. */
16
+ disabled?: boolean;
17
+ }
18
+
19
+ /** Selection mode. */
20
+ export type TTreeSelectionMode = 'none' | 'single' | 'multiple';
21
+
22
+ /** Selection and expansion state. */
23
+ export interface ITreeControlProps {
24
+ /** Selection mode. */
25
+ selectionMode?: TTreeSelectionMode;
26
+ /** Controlled selection. An empty set means nothing is selected. */
27
+ selectedKeys?: Selection;
28
+ /** Uncontrolled initial selection. */
29
+ defaultSelectedKeys?: Selection;
30
+ /** Selection change handler. */
31
+ onSelectionChange?: (keys: Selection) => void;
32
+ /** Controlled expanded branches. */
33
+ expandedKeys?: Iterable<Key>;
34
+ /** Uncontrolled initial expanded branches. */
35
+ defaultExpandedKeys?: Iterable<Key>;
36
+ /** Expanded branches change handler. */
37
+ onExpandedChange?: (keys: Set<Key>) => void;
38
+ /** Blocks selection and expansion for every node. */
39
+ disabled?: boolean;
40
+ /** Keeps the current selection. Expansion still works. */
41
+ readOnly?: boolean;
42
+ }
43
+
44
+ /** Own / chrome props (not from RAC). */
45
+ export interface ITreeOwnProps extends IDataTestIdProps {
46
+ /** Nodes. */
47
+ items: ITreeItem[];
48
+ /** Accessible name. The tree has no visible caption. */
49
+ 'aria-label': string;
50
+ /** Root class name. */
51
+ className?: string;
52
+ /** Ref to the tree root (React 19 prop). */
53
+ ref?: Ref<HTMLDivElement>;
54
+ }
55
+
56
+ export interface ITreeProps extends ITreeControlProps, ITreeOwnProps {}
@@ -1,176 +0,0 @@
1
- import { jsxs as k, jsx as _ } from "react/jsx-runtime";
2
- import { useContext as T, createContext as A, useRef as D, useState as O, useLayoutEffect as W, useEffect as B, useMemo as F } from "react";
3
- import { createPortal as G } from "react-dom";
4
- import M from "classnames";
5
- import { useUNSAFE_PortalContext as H } from "react-aria";
6
- import { s as v } from "./index-h8z54aFR.js";
7
- import { typographyStyles as h } from "./typography/index.js";
8
- import { cva as w } from "class-variance-authority";
9
- import './assets/Component12.css';const E = A({
10
- size: "md"
11
- }), K = () => T(E), U = "aub_styles-module_root_424a2", X = "aub_styles-module_danger_078ce", q = "aub_styles-module_sm_ee87d", J = "aub_styles-module_md_9b45e", Q = "aub_styles-module_lg_965fb", Y = "aub_styles-module_icon_c3730", u = {
12
- root: U,
13
- danger: X,
14
- sm: q,
15
- md: J,
16
- lg: Q,
17
- icon: Y
18
- }, Z = w(u.root, {
19
- variants: {
20
- size: {
21
- sm: u.sm,
22
- md: u.md,
23
- lg: u.lg
24
- },
25
- variant: {
26
- primary: null,
27
- danger: u.danger
28
- }
29
- },
30
- defaultVariants: {
31
- size: "md",
32
- variant: "primary"
33
- }
34
- }), tt = {
35
- sm: h.bodyXs,
36
- md: h.bodySTight,
37
- lg: h.bodyM
38
- }, N = v(
39
- ({
40
- ref: s,
41
- children: e,
42
- icon: t,
43
- disabled: o = !1,
44
- variant: a = "primary",
45
- className: r,
46
- dataTestId: n,
47
- onClick: g,
48
- ...y
49
- }) => {
50
- const { size: p } = K();
51
- return /* @__PURE__ */ k(
52
- "button",
53
- {
54
- ...y,
55
- ref: s,
56
- type: "button",
57
- role: "menuitem",
58
- disabled: o,
59
- className: M(Z({ size: p, variant: a }), tt[p], r),
60
- "data-variant": a,
61
- "data-test-id": n,
62
- onClick: g,
63
- children: [
64
- t ? /* @__PURE__ */ _(t, { className: u.icon, "aria-hidden": !0, focusable: !1 }) : null,
65
- e
66
- ]
67
- }
68
- );
69
- }
70
- );
71
- N.displayName = "ContextMenu.Item";
72
- const et = "aub_styles-module_root_0ca94", ot = {
73
- root: et
74
- }, P = v(({ className: s, dataTestId: e, ...t }) => /* @__PURE__ */ _("div", { ...t, role: "separator", className: M(ot.root, s), "data-test-id": e }));
75
- P.displayName = "ContextMenu.Separator";
76
- const nt = "aub_styles-module_root_a6382", st = "aub_styles-module_sm_f6741", at = "aub_styles-module_md_ce9c0", rt = "aub_styles-module_lg_3b9bb", mt = "aub_styles-module_primary_5e631", f = {
77
- root: nt,
78
- sm: st,
79
- md: at,
80
- lg: rt,
81
- primary: mt
82
- }, it = w(f.root, {
83
- variants: {
84
- size: {
85
- sm: f.sm,
86
- md: f.md,
87
- lg: f.lg
88
- },
89
- variant: {
90
- primary: f.primary
91
- }
92
- },
93
- defaultVariants: {
94
- size: "md",
95
- variant: "primary"
96
- }
97
- }), i = 8, lt = (s, e, t, o, a) => {
98
- let r = s, n = e;
99
- return r + t > a.width - i && (r = Math.max(i, a.width - t - i)), r < i && (r = i), n + o > a.height - i && (n = Math.max(i, e - o)), n < i && (n = i), { left: r, top: n };
100
- }, R = v(
101
- ({
102
- ref: s,
103
- open: e = !1,
104
- x: t,
105
- y: o,
106
- onClose: a,
107
- onMouseEnter: r,
108
- size: n = "md",
109
- variant: g = "primary",
110
- children: y,
111
- className: p,
112
- dataTestId: S,
113
- style: $,
114
- ...V
115
- }) => {
116
- const b = D(null), { getContainer: I } = H(), [x, L] = O(null), C = x?.x === t && x.y === o ? x : { left: t, top: o };
117
- W(() => {
118
- const m = b.current;
119
- if (!e || !m) return;
120
- const d = m.getBoundingClientRect(), l = lt(t, o, d.width, d.height, {
121
- width: window.innerWidth,
122
- height: window.innerHeight
123
- });
124
- L(
125
- (c) => c?.x === t && c.y === o && c.left === l.left && c.top === l.top ? c : { x: t, y: o, ...l }
126
- );
127
- }, [e, t, o, y]), B(() => {
128
- if (!e)
129
- return;
130
- const m = (l) => {
131
- b.current?.contains(l.target) || a();
132
- }, d = (l) => {
133
- l.key === "Escape" && a();
134
- };
135
- return document.addEventListener("mousedown", m), document.addEventListener("keydown", d), () => {
136
- document.removeEventListener("mousedown", m), document.removeEventListener("keydown", d);
137
- };
138
- }, [e, a]);
139
- const z = F(() => ({ size: n }), [n]);
140
- if (!e || typeof document > "u")
141
- return null;
142
- const j = (m) => {
143
- if (b.current = m, typeof s == "function") {
144
- s(m);
145
- return;
146
- }
147
- s && (s.current = m);
148
- };
149
- return G(
150
- /* @__PURE__ */ _(E.Provider, { value: z, children: /* @__PURE__ */ _(
151
- "div",
152
- {
153
- ...V,
154
- ref: j,
155
- className: M(it({ size: n, variant: g }), p),
156
- style: { ...$, top: C.top, left: C.left },
157
- role: "menu",
158
- tabIndex: -1,
159
- "data-test-id": S,
160
- onMouseEnter: r,
161
- children: y
162
- }
163
- ) }),
164
- I?.() ?? document.body
165
- );
166
- }
167
- );
168
- R.displayName = "ContextMenu";
169
- const bt = Object.assign(R, {
170
- Item: N,
171
- Separator: P
172
- });
173
- export {
174
- bt as C
175
- };
176
- //# sourceMappingURL=Component-B1piMJHv.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Component-B1piMJHv.js","sources":["../src/context-menu/context.ts","../src/context-menu/components/Item/theme.ts","../src/context-menu/components/Item/index.tsx","../src/context-menu/components/Separator/index.tsx","../src/context-menu/theme.ts","../src/context-menu/utils.ts","../src/context-menu/Component.tsx"],"sourcesContent":["import { createContext, useContext } from 'react';\n\nimport { type TContextMenuSize } from './types';\n\nexport interface IContextMenuContextValue {\n size: TContextMenuSize;\n}\n\nexport const ContextMenuContext = createContext<IContextMenuContextValue>({\n size: 'md',\n});\n\nexport const useContextMenu = () => useContext(ContextMenuContext);\n","import { cva } from 'class-variance-authority';\n\nimport styles from './styles.module.css';\n\nexport const contextMenuItemVariants = cva(styles.root, {\n variants: {\n size: {\n sm: styles.sm,\n md: styles.md,\n lg: styles.lg,\n },\n variant: {\n primary: null,\n danger: styles.danger,\n },\n },\n defaultVariants: {\n size: 'md',\n variant: 'primary',\n },\n});\n","import cn from 'classnames';\n\nimport { supportRef } from '@ds/common/support-ref';\nimport { typographyStyles } from '@ds/typography';\n\nimport { useContextMenu } from '../../context';\nimport { type IContextMenuItemProps } from '../../types';\n\nimport { contextMenuItemVariants } from './theme';\n\nimport styles from './styles.module.css';\n\nconst itemTypography = {\n sm: typographyStyles.bodyXs,\n md: typographyStyles.bodySTight,\n lg: typographyStyles.bodyM,\n} as const;\n\nexport const ContextMenuItem = supportRef(\n ({\n ref,\n children,\n icon: Icon,\n disabled = false,\n variant = 'primary',\n className,\n dataTestId,\n onClick,\n ...props\n }: IContextMenuItemProps) => {\n const { size } = useContextMenu();\n\n return (\n <button\n {...props}\n ref={ref}\n type=\"button\"\n role=\"menuitem\"\n disabled={disabled}\n className={cn(contextMenuItemVariants({ size, variant }), itemTypography[size], className)}\n data-variant={variant}\n data-test-id={dataTestId}\n onClick={onClick}\n >\n {Icon ? <Icon className={styles.icon} aria-hidden focusable={false} /> : null}\n {children}\n </button>\n );\n }\n);\n\nContextMenuItem.displayName = 'ContextMenu.Item';\n","import cn from 'classnames';\n\nimport { supportRef } from '@ds/common/support-ref';\n\nimport { type IContextMenuSeparatorProps } from '../../types';\n\nimport styles from './styles.module.css';\n\nexport const ContextMenuSeparator = supportRef(({ className, dataTestId, ...props }: IContextMenuSeparatorProps) => (\n <div {...props} role=\"separator\" className={cn(styles.root, className)} data-test-id={dataTestId} />\n));\n\nContextMenuSeparator.displayName = 'ContextMenu.Separator';\n","import { cva } from 'class-variance-authority';\n\nimport styles from './styles.module.css';\n\nexport const contextMenuVariants = cva(styles.root, {\n variants: {\n size: {\n sm: styles.sm,\n md: styles.md,\n lg: styles.lg,\n },\n variant: {\n primary: styles.primary,\n },\n },\n defaultVariants: {\n size: 'md',\n variant: 'primary',\n },\n});\n","const VIEWPORT_GAP = 8;\n\n/** Keeps the menu inside the viewport. Overflow to the right shifts left; overflow below flips above the anchor. */\nexport const placeContextMenu = (\n x: number,\n y: number,\n width: number,\n height: number,\n viewport: { width: number; height: number }\n): { left: number; top: number } => {\n let left = x;\n let top = y;\n\n if (left + width > viewport.width - VIEWPORT_GAP) {\n left = Math.max(VIEWPORT_GAP, viewport.width - width - VIEWPORT_GAP);\n }\n\n if (left < VIEWPORT_GAP) left = VIEWPORT_GAP;\n\n if (top + height > viewport.height - VIEWPORT_GAP) {\n top = Math.max(VIEWPORT_GAP, y - height);\n }\n\n if (top < VIEWPORT_GAP) top = VIEWPORT_GAP;\n\n return { left, top };\n};\n","import { useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';\n\nimport { createPortal } from 'react-dom';\n\nimport cn from 'classnames';\nimport { useUNSAFE_PortalContext } from 'react-aria';\n\nimport { supportRef } from '@ds/common/support-ref';\n\nimport { ContextMenuItem } from './components/Item';\nimport { ContextMenuSeparator } from './components/Separator';\nimport { ContextMenuContext } from './context';\nimport { contextMenuVariants } from './theme';\nimport { type IContextMenuProps } from './types';\nimport { placeContextMenu } from './utils';\n\nconst ContextMenuRoot = supportRef(\n ({\n ref,\n open = false,\n x,\n y,\n onClose,\n onMouseEnter,\n size = 'md',\n variant = 'primary',\n children,\n className,\n dataTestId,\n style,\n ...props\n }: IContextMenuProps) => {\n const rootRef = useRef<HTMLDivElement | null>(null);\n const { getContainer } = useUNSAFE_PortalContext();\n const [placed, setPlaced] = useState<{ x: number; y: number; left: number; top: number } | null>(null);\n const position = placed?.x === x && placed.y === y ? placed : { left: x, top: y };\n\n useLayoutEffect(() => {\n const node = rootRef.current;\n\n if (!open || !node) return;\n\n const rect = node.getBoundingClientRect();\n const next = placeContextMenu(x, y, rect.width, rect.height, {\n width: window.innerWidth,\n height: window.innerHeight,\n });\n\n setPlaced(current =>\n current?.x === x && current.y === y && current.left === next.left && current.top === next.top\n ? current\n : { x, y, ...next }\n );\n }, [open, x, y, children]);\n\n useEffect(() => {\n if (!open) {\n return;\n }\n\n const onPointerDown = (event: MouseEvent) => {\n if (rootRef.current?.contains(event.target as Node)) {\n return;\n }\n\n onClose();\n };\n\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n onClose();\n }\n };\n\n document.addEventListener('mousedown', onPointerDown);\n document.addEventListener('keydown', onKeyDown);\n\n return () => {\n document.removeEventListener('mousedown', onPointerDown);\n document.removeEventListener('keydown', onKeyDown);\n };\n }, [open, onClose]);\n\n const contextValue = useMemo(() => ({ size }), [size]);\n\n if (!open || typeof document === 'undefined') {\n return null;\n }\n\n const setRef = (node: HTMLDivElement | null) => {\n rootRef.current = node;\n\n if (typeof ref === 'function') {\n ref(node);\n return;\n }\n\n if (ref) {\n ref.current = node;\n }\n };\n\n return createPortal(\n <ContextMenuContext.Provider value={contextValue}>\n <div\n {...props}\n ref={setRef}\n className={cn(contextMenuVariants({ size, variant }), className)}\n style={{ ...style, top: position.top, left: position.left }}\n role=\"menu\"\n tabIndex={-1}\n data-test-id={dataTestId}\n onMouseEnter={onMouseEnter}\n >\n {children}\n </div>\n </ContextMenuContext.Provider>,\n getContainer?.() ?? document.body\n );\n }\n);\n\nContextMenuRoot.displayName = 'ContextMenu';\n\nexport const ContextMenu = Object.assign(ContextMenuRoot, {\n Item: ContextMenuItem,\n Separator: ContextMenuSeparator,\n});\n"],"names":["ContextMenuContext","createContext","useContextMenu","useContext","contextMenuItemVariants","cva","styles","itemTypography","typographyStyles","ContextMenuItem","supportRef","ref","children","Icon","disabled","variant","className","dataTestId","onClick","props","size","jsxs","cn","jsx","ContextMenuSeparator","contextMenuVariants","VIEWPORT_GAP","placeContextMenu","x","y","width","height","viewport","left","top","ContextMenuRoot","open","onClose","onMouseEnter","style","rootRef","useRef","getContainer","useUNSAFE_PortalContext","placed","setPlaced","useState","position","useLayoutEffect","node","rect","next","current","useEffect","onPointerDown","event","onKeyDown","contextValue","useMemo","setRef","createPortal","ContextMenu"],"mappings":";;;;;;;;AAQO,MAAMA,IAAqBC,EAAwC;AAAA,EACtE,MAAM;AACV,CAAC,GAEYC,IAAiB,MAAMC,EAAWH,CAAkB;;;;;;;GCRpDI,IAA0BC,EAAIC,EAAO,MAAM;AAAA,EACpD,UAAU;AAAA,IACN,MAAM;AAAA,MACF,IAAIA,EAAO;AAAA,MACX,IAAIA,EAAO;AAAA,MACX,IAAIA,EAAO;AAAA,IAAA;AAAA,IAEf,SAAS;AAAA,MACL,SAAS;AAAA,MACT,QAAQA,EAAO;AAAA,IAAA;AAAA,EACnB;AAAA,EAEJ,iBAAiB;AAAA,IACb,MAAM;AAAA,IACN,SAAS;AAAA,EAAA;AAEjB,CAAC,GCRKC,KAAiB;AAAA,EACnB,IAAIC,EAAiB;AAAA,EACrB,IAAIA,EAAiB;AAAA,EACrB,IAAIA,EAAiB;AACzB,GAEaC,IAAkBC;A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