@tribepad/themis 1.4.0 → 1.5.0
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.
- package/dist/elements/Tree/Tree.d.ts +62 -0
- package/dist/elements/Tree/Tree.d.ts.map +1 -0
- package/dist/elements/Tree/Tree.styles.d.ts +28 -0
- package/dist/elements/Tree/Tree.styles.d.ts.map +1 -0
- package/dist/elements/Tree/Tree.types.d.ts +161 -0
- package/dist/elements/Tree/Tree.types.d.ts.map +1 -0
- package/dist/elements/Tree/index.d.ts +33 -0
- package/dist/elements/Tree/index.d.ts.map +1 -0
- package/dist/elements/Tree/index.js +3 -0
- package/dist/elements/Tree/index.js.map +1 -0
- package/dist/elements/Tree/index.mjs +3 -0
- package/dist/elements/Tree/index.mjs.map +1 -0
- package/dist/elements/index.d.ts +2 -0
- package/dist/elements/index.d.ts.map +1 -1
- package/dist/elements/index.js +1 -1
- package/dist/elements/index.js.map +1 -1
- package/dist/elements/index.mjs +1 -1
- package/dist/elements/index.mjs.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/elements/Tree/Tree.stories.tsx +407 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tree — accessible hierarchical list, built on React Aria's `Tree`.
|
|
3
|
+
*
|
|
4
|
+
* @see WAI-ARIA Tree pattern (roving tabindex, aria-level / aria-expanded /
|
|
5
|
+
* aria-setsize / aria-posinset, type-ahead, arrow-key navigation).
|
|
6
|
+
*
|
|
7
|
+
* Themis exposes a thin wrapper that:
|
|
8
|
+
* - applies our visual variants and 44px touch-target row sizing
|
|
9
|
+
* - renders a chevron disclosure that flips on expand
|
|
10
|
+
* - supports lazy children via `hasChildItems`
|
|
11
|
+
* - supports controlled and uncontrolled selection / expansion
|
|
12
|
+
*/
|
|
13
|
+
import { type ReactElement, type ReactNode } from 'react';
|
|
14
|
+
import { type Key } from 'react-aria-components';
|
|
15
|
+
import type { TreeProps, TreeItemProps, TreeItemContentProps } from './Tree.types';
|
|
16
|
+
export declare const Tree: import("react").ForwardRefExoticComponent<TreeProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
17
|
+
export declare const TreeItem: import("react").ForwardRefExoticComponent<TreeItemProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
18
|
+
/**
|
|
19
|
+
* Wraps the row content. Inside this you typically render a chevron
|
|
20
|
+
* (via `<TreeItemChevron />`), the row's label, and any badges or row
|
|
21
|
+
* actions. Nested items go *outside* the content — at the same level as
|
|
22
|
+
* the content — so they're collected as children of this `TreeItem`.
|
|
23
|
+
*
|
|
24
|
+
* ```tsx
|
|
25
|
+
* <TreeItem id="a" textValue="A" hasChildItems>
|
|
26
|
+
* <TreeItemContent>
|
|
27
|
+
* <TreeItemChevron />
|
|
28
|
+
* <span>A</span>
|
|
29
|
+
* </TreeItemContent>
|
|
30
|
+
* <TreeItem id="a.b" textValue="A.B">
|
|
31
|
+
* <TreeItemContent>
|
|
32
|
+
* <span>A.B</span>
|
|
33
|
+
* </TreeItemContent>
|
|
34
|
+
* </TreeItem>
|
|
35
|
+
* </TreeItem>
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export declare function TreeItemContent({ className, children, }: TreeItemContentProps): ReactElement;
|
|
39
|
+
/**
|
|
40
|
+
* Disclosure chevron. Renders inside a `<TreeItemContent>` and toggles
|
|
41
|
+
* the parent item's expansion state. Hidden (with reserved space) on
|
|
42
|
+
* leaf rows so leaf and parent rows align visually.
|
|
43
|
+
*/
|
|
44
|
+
export declare function TreeItemChevron({ hasChildItems, }: {
|
|
45
|
+
/**
|
|
46
|
+
* Force the chevron to render even when there are no rendered
|
|
47
|
+
* children — useful for lazy-loaded subtrees. Defaults to true; pass
|
|
48
|
+
* `false` for a confirmed leaf to render a placeholder spacer instead.
|
|
49
|
+
*/
|
|
50
|
+
hasChildItems?: boolean;
|
|
51
|
+
}): ReactElement;
|
|
52
|
+
/**
|
|
53
|
+
* Convenience guard for consumers that need to compute `hasChildItems`
|
|
54
|
+
* from a data shape ahead of render. Returns `true` when the input
|
|
55
|
+
* either has rendered children OR a known children count > 0.
|
|
56
|
+
*/
|
|
57
|
+
export declare function deriveHasChildItems(input: {
|
|
58
|
+
childrenCount?: number | null;
|
|
59
|
+
children?: ReactNode | unknown[];
|
|
60
|
+
}): boolean;
|
|
61
|
+
export type { Key };
|
|
62
|
+
//# sourceMappingURL=Tree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tree.d.ts","sourceRoot":"","sources":["../../../src/elements/Tree/Tree.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AAEH,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,EAKL,KAAK,GAAG,EACT,MAAM,uBAAuB,CAAC;AAS/B,OAAO,KAAK,EACV,SAAS,EACT,aAAa,EACb,oBAAoB,EACrB,MAAM,cAAc,CAAC;AA8DtB,eAAO,MAAM,IAAI,sGAAuB,CAAC;AAiDzC,eAAO,MAAM,QAAQ,0GAA2B,CAAC;AAOjD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,eAAe,CAAC,EAC9B,SAAS,EACT,QAAQ,GACT,EAAE,oBAAoB,GAAG,YAAY,CAwBrC;AAMD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,EAC9B,aAAa,GACd,EAAE;IACD;;;;OAIG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,GAAG,YAAY,CAqBf;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE;IACzC,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,QAAQ,CAAC,EAAE,SAAS,GAAG,OAAO,EAAE,CAAC;CAClC,GAAG,OAAO,CAQV;AAID,YAAY,EAAE,GAAG,EAAE,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tree container styles. The wrapping `<div role="tree">` provides the
|
|
3
|
+
* scrollable surface; nested item content is rendered into a row strip
|
|
4
|
+
* indented by `--tree-indent` per level.
|
|
5
|
+
*/
|
|
6
|
+
export declare const treeVariants: (props?: ({
|
|
7
|
+
variant?: "default" | "bordered" | null | undefined;
|
|
8
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
9
|
+
/**
|
|
10
|
+
* Tree item row styles. The size variant drives the minimum row height
|
|
11
|
+
* — `default` is 44px to clear the touch-target standard.
|
|
12
|
+
*/
|
|
13
|
+
export declare const treeItemVariants: (props?: ({
|
|
14
|
+
size?: "default" | "sm" | "lg" | null | undefined;
|
|
15
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
16
|
+
/**
|
|
17
|
+
* Disclosure chevron button. Flips on `[data-expanded]`. The 44px touch
|
|
18
|
+
* target lives at the wrapping <div>; this is just the visible glyph.
|
|
19
|
+
*/
|
|
20
|
+
export declare const treeChevronVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
21
|
+
/**
|
|
22
|
+
* Indent stripe — a fixed-width spacer that the row uses to render its
|
|
23
|
+
* level. The variable allows host apps to override the indent step
|
|
24
|
+
* (e.g. tighter for compact lists).
|
|
25
|
+
*/
|
|
26
|
+
export declare const treeIndentVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
27
|
+
export declare const treeEmptyStateVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
28
|
+
//# sourceMappingURL=Tree.styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tree.styles.d.ts","sourceRoot":"","sources":["../../../src/elements/Tree/Tree.styles.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,YAAY;;8EAaxB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,gBAAgB;;8EAyB5B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,mBAAmB,oFAU/B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,oFAE7B,CAAC;AAEH,eAAO,MAAM,sBAAsB,oFAEjC,CAAC"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
import type { Selection, Key } from 'react-aria-components';
|
|
4
|
+
export type { Selection, Key };
|
|
5
|
+
/**
|
|
6
|
+
* Tree visual variant.
|
|
7
|
+
* - default: minimal, transparent rows; suits in-content lists.
|
|
8
|
+
* - bordered: rows separated by hairline borders; suits standalone trees.
|
|
9
|
+
*/
|
|
10
|
+
export declare const TreeVariantSchema: z.ZodEnum<{
|
|
11
|
+
default: "default";
|
|
12
|
+
bordered: "bordered";
|
|
13
|
+
}>;
|
|
14
|
+
export type TreeVariant = z.infer<typeof TreeVariantSchema>;
|
|
15
|
+
/**
|
|
16
|
+
* Tree size — drives row height. `default` clears the 44px touch target.
|
|
17
|
+
*/
|
|
18
|
+
export declare const TreeSizeSchema: z.ZodEnum<{
|
|
19
|
+
default: "default";
|
|
20
|
+
sm: "sm";
|
|
21
|
+
lg: "lg";
|
|
22
|
+
}>;
|
|
23
|
+
export type TreeSize = z.infer<typeof TreeSizeSchema>;
|
|
24
|
+
/**
|
|
25
|
+
* Selection mode passed through to React Aria Tree. None disables the
|
|
26
|
+
* checkbox column entirely.
|
|
27
|
+
*/
|
|
28
|
+
export declare const TreeSelectionModeSchema: z.ZodEnum<{
|
|
29
|
+
single: "single";
|
|
30
|
+
multiple: "multiple";
|
|
31
|
+
none: "none";
|
|
32
|
+
}>;
|
|
33
|
+
export type TreeSelectionMode = z.infer<typeof TreeSelectionModeSchema>;
|
|
34
|
+
/**
|
|
35
|
+
* Tree root props schema (Themis-specific; React Aria props pass through
|
|
36
|
+
* via the component implementation).
|
|
37
|
+
*/
|
|
38
|
+
export declare const TreePropsSchema: z.ZodObject<{
|
|
39
|
+
id: z.ZodOptional<z.ZodString>;
|
|
40
|
+
'aria-describedby': z.ZodOptional<z.ZodString>;
|
|
41
|
+
'aria-live': z.ZodOptional<z.ZodEnum<{
|
|
42
|
+
off: "off";
|
|
43
|
+
polite: "polite";
|
|
44
|
+
assertive: "assertive";
|
|
45
|
+
}>>;
|
|
46
|
+
'aria-hidden': z.ZodOptional<z.ZodBoolean>;
|
|
47
|
+
'data-testid': z.ZodOptional<z.ZodString>;
|
|
48
|
+
'aria-label': z.ZodOptional<z.ZodString>;
|
|
49
|
+
'aria-labelledby': z.ZodOptional<z.ZodString>;
|
|
50
|
+
selectionMode: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
51
|
+
single: "single";
|
|
52
|
+
multiple: "multiple";
|
|
53
|
+
none: "none";
|
|
54
|
+
}>>>;
|
|
55
|
+
selectedKeys: z.ZodOptional<z.ZodCustom<Selection, Selection>>;
|
|
56
|
+
defaultSelectedKeys: z.ZodOptional<z.ZodCustom<Selection, Selection>>;
|
|
57
|
+
onSelectionChange: z.ZodOptional<z.ZodCustom<(keys: Selection) => void, (keys: Selection) => void>>;
|
|
58
|
+
disabledKeys: z.ZodOptional<z.ZodCustom<Iterable<Key>, Iterable<Key>>>;
|
|
59
|
+
expandedKeys: z.ZodOptional<z.ZodCustom<Iterable<Key>, Iterable<Key>>>;
|
|
60
|
+
defaultExpandedKeys: z.ZodOptional<z.ZodCustom<Iterable<Key>, Iterable<Key>>>;
|
|
61
|
+
onExpandedChange: z.ZodOptional<z.ZodCustom<(keys: Set<Key>) => void, (keys: Set<Key>) => void>>;
|
|
62
|
+
onAction: z.ZodOptional<z.ZodCustom<(key: Key) => void, (key: Key) => void>>;
|
|
63
|
+
variant: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
64
|
+
default: "default";
|
|
65
|
+
bordered: "bordered";
|
|
66
|
+
}>>>;
|
|
67
|
+
size: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
68
|
+
default: "default";
|
|
69
|
+
sm: "sm";
|
|
70
|
+
lg: "lg";
|
|
71
|
+
}>>>;
|
|
72
|
+
className: z.ZodOptional<z.ZodString>;
|
|
73
|
+
children: z.ZodCustom<ReactNode, ReactNode>;
|
|
74
|
+
}, z.core.$strip>;
|
|
75
|
+
export interface TreeProps {
|
|
76
|
+
className?: string;
|
|
77
|
+
children?: ReactNode;
|
|
78
|
+
id?: string;
|
|
79
|
+
'aria-label'?: string;
|
|
80
|
+
'aria-labelledby'?: string;
|
|
81
|
+
'data-testid'?: string;
|
|
82
|
+
/** Selection mode. Defaults to `'none'`. */
|
|
83
|
+
selectionMode?: TreeSelectionMode;
|
|
84
|
+
selectedKeys?: Selection;
|
|
85
|
+
defaultSelectedKeys?: Selection;
|
|
86
|
+
onSelectionChange?: (keys: Selection) => void;
|
|
87
|
+
disabledKeys?: Iterable<Key>;
|
|
88
|
+
/** Controlled expansion. Use to drive lazy-loading flows. */
|
|
89
|
+
expandedKeys?: Iterable<Key>;
|
|
90
|
+
defaultExpandedKeys?: Iterable<Key>;
|
|
91
|
+
onExpandedChange?: (keys: Set<Key>) => void;
|
|
92
|
+
/** Fired when the user activates a row (Enter / double-click / Space). */
|
|
93
|
+
onAction?: (key: Key) => void;
|
|
94
|
+
/** Visual variant. Default is `'default'`. */
|
|
95
|
+
variant?: TreeVariant;
|
|
96
|
+
/** Row height variant. Default `'default'` clears the 44px touch target. */
|
|
97
|
+
size?: TreeSize;
|
|
98
|
+
/** Render-prop fallback when the tree has no items. */
|
|
99
|
+
renderEmptyState?: () => ReactNode;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* TreeItem props schema. Items are the rows of the tree; nesting is
|
|
103
|
+
* expressed by placing further `<TreeItem>`s inside the item's content.
|
|
104
|
+
*/
|
|
105
|
+
export declare const TreeItemPropsSchema: z.ZodObject<{
|
|
106
|
+
'aria-label': z.ZodOptional<z.ZodString>;
|
|
107
|
+
'aria-labelledby': z.ZodOptional<z.ZodString>;
|
|
108
|
+
'aria-describedby': z.ZodOptional<z.ZodString>;
|
|
109
|
+
'aria-live': z.ZodOptional<z.ZodEnum<{
|
|
110
|
+
off: "off";
|
|
111
|
+
polite: "polite";
|
|
112
|
+
assertive: "assertive";
|
|
113
|
+
}>>;
|
|
114
|
+
'aria-hidden': z.ZodOptional<z.ZodBoolean>;
|
|
115
|
+
'data-testid': z.ZodOptional<z.ZodString>;
|
|
116
|
+
id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
117
|
+
textValue: z.ZodString;
|
|
118
|
+
isDisabled: z.ZodOptional<z.ZodBoolean>;
|
|
119
|
+
hasChildItems: z.ZodOptional<z.ZodBoolean>;
|
|
120
|
+
onAction: z.ZodOptional<z.ZodCustom<() => void, () => void>>;
|
|
121
|
+
className: z.ZodOptional<z.ZodString>;
|
|
122
|
+
children: z.ZodCustom<ReactNode, ReactNode>;
|
|
123
|
+
}, z.core.$strip>;
|
|
124
|
+
export interface TreeItemProps {
|
|
125
|
+
/** Unique key for the row. */
|
|
126
|
+
id: Key;
|
|
127
|
+
/** Plain-text representation, used for typeahead. */
|
|
128
|
+
textValue: string;
|
|
129
|
+
/** Whether this item should be focusable but not selectable / actionable. */
|
|
130
|
+
isDisabled?: boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Force-expose the disclosure chevron even when the item has no rendered
|
|
133
|
+
* children yet (lazy loading). When `false`/omitted, the chevron is shown
|
|
134
|
+
* only if the item has rendered children.
|
|
135
|
+
*/
|
|
136
|
+
hasChildItems?: boolean;
|
|
137
|
+
/** Activation callback (Enter / Space / row-action click). */
|
|
138
|
+
onAction?: () => void;
|
|
139
|
+
className?: string;
|
|
140
|
+
children?: ReactNode;
|
|
141
|
+
id_attr?: string;
|
|
142
|
+
'data-testid'?: string;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* TreeItemContent props — the visible row contents. Use this to wrap
|
|
146
|
+
* the row's label, status pills, and action affordances.
|
|
147
|
+
*/
|
|
148
|
+
export interface TreeItemContentProps {
|
|
149
|
+
className?: string;
|
|
150
|
+
children?: ReactNode;
|
|
151
|
+
}
|
|
152
|
+
export type TreeVariantProps = {
|
|
153
|
+
variant?: TreeVariant;
|
|
154
|
+
size?: TreeSize;
|
|
155
|
+
};
|
|
156
|
+
export type TreeItemVariantProps = {
|
|
157
|
+
size?: TreeSize;
|
|
158
|
+
isSelected?: boolean;
|
|
159
|
+
isDisabled?: boolean;
|
|
160
|
+
};
|
|
161
|
+
//# sourceMappingURL=Tree.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tree.types.d.ts","sourceRoot":"","sources":["../../../src/elements/Tree/Tree.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAM5D,YAAY,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC;AAM/B;;;;GAIG;AACH,eAAO,MAAM,iBAAiB;;;EAAkC,CAAC;AACjE,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D;;GAEG;AACH,eAAO,MAAM,cAAc;;;;EAAkC,CAAC;AAC9D,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAEtD;;;GAGG;AACH,eAAO,MAAM,uBAAuB;;;;EAAyC,CAAC;AAC9E,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAMxE;;;GAGG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;wDAOS,SAAS,KAAK,IAAI,SAAlB,SAAS,KAAK,IAA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iBAG7B,CAAC;AAEH,MAAM,WAAW,aAAa;IAC5B,8BAA8B;IAC9B,EAAE,EAAE,GAAG,CAAC;IACR,qDAAqD;IACrD,SAAS,EAAE,MAAM,CAAC;IAClB,6EAA6E;IAC7E,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;OAIG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAMD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,IAAI,CAAC,EAAE,QAAQ,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tree component — accessible hierarchical list built on React Aria.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```tsx
|
|
6
|
+
* import {
|
|
7
|
+
* Tree,
|
|
8
|
+
* TreeItem,
|
|
9
|
+
* TreeItemContent,
|
|
10
|
+
* TreeItemChevron,
|
|
11
|
+
* } from '@tribepad/themis/elements/Tree';
|
|
12
|
+
*
|
|
13
|
+
* <Tree aria-label="Departments" selectionMode="single">
|
|
14
|
+
* <TreeItem id="eng" textValue="Engineering" hasChildItems>
|
|
15
|
+
* <TreeItemContent>
|
|
16
|
+
* <TreeItemChevron />
|
|
17
|
+
* <span>Engineering</span>
|
|
18
|
+
* </TreeItemContent>
|
|
19
|
+
* <TreeItem id="eng.platform" textValue="Platform">
|
|
20
|
+
* <TreeItemContent>
|
|
21
|
+
* <TreeItemChevron hasChildItems={false} />
|
|
22
|
+
* <span>Platform</span>
|
|
23
|
+
* </TreeItemContent>
|
|
24
|
+
* </TreeItem>
|
|
25
|
+
* </TreeItem>
|
|
26
|
+
* </Tree>
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export { Tree, TreeItem, TreeItemContent, TreeItemChevron, deriveHasChildItems, } from './Tree';
|
|
30
|
+
export type { TreeProps, TreeItemProps, TreeItemContentProps, TreeVariant, TreeSize, TreeSelectionMode, TreeVariantProps, TreeItemVariantProps, Selection, Key, } from './Tree.types';
|
|
31
|
+
export { TreePropsSchema, TreeItemPropsSchema, TreeVariantSchema, TreeSizeSchema, TreeSelectionModeSchema, } from './Tree.types';
|
|
32
|
+
export { treeVariants, treeItemVariants, treeChevronVariants, treeIndentVariants, treeEmptyStateVariants, } from './Tree.styles';
|
|
33
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/elements/Tree/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EACL,IAAI,EACJ,QAAQ,EACR,eAAe,EACf,eAAe,EACf,mBAAmB,GACpB,MAAM,QAAQ,CAAC;AAEhB,YAAY,EACV,SAAS,EACT,aAAa,EACb,oBAAoB,EACpB,WAAW,EACX,QAAQ,EACR,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,SAAS,EACT,GAAG,GACJ,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,EACd,uBAAuB,GACxB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,GACvB,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';var react=require('react'),reactAriaComponents=require('react-aria-components'),lucideReact=require('lucide-react'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),classVarianceAuthority=require('class-variance-authority'),jsxRuntime=require('react/jsx-runtime'),zod=require('zod');function i(...t){return tailwindMerge.twMerge(clsx.clsx(t))}var h=classVarianceAuthority.cva(["relative w-full text-sm","outline-none"],{variants:{variant:{default:"",bordered:"rounded-md border border-[var(--border)] divide-y divide-[var(--border)]"}},defaultVariants:{variant:"default"}}),x=classVarianceAuthority.cva(["group/tree-item","relative flex w-full items-center gap-2","rounded-md","transition-colors","cursor-pointer","outline-none","focus-visible:ring-2 focus-visible:ring-[var(--ring)] focus-visible:ring-offset-1","data-[selected=true]:bg-[var(--secondary)] data-[selected=true]:text-[var(--secondary-foreground)]","data-[disabled=true]:cursor-default data-[disabled=true]:opacity-60","hover:bg-[var(--secondary)]"],{variants:{size:{sm:"min-h-9 px-2 py-1 text-sm",default:"min-h-11 px-3 py-2 text-sm",lg:"min-h-14 px-4 py-3 text-base"}},defaultVariants:{size:"default"}}),T=classVarianceAuthority.cva(["flex size-6 shrink-0 items-center justify-center rounded-sm","text-[var(--muted-foreground)]","transition-transform","hover:bg-[var(--secondary)]","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]","data-[expanded=true]:rotate-90","motion-reduce:transition-none"]),H=classVarianceAuthority.cva(["block shrink-0"]),b=classVarianceAuthority.cva(["flex w-full items-center justify-center px-4 py-8 text-sm text-[var(--muted-foreground)]"]);function q({className:t,variant:o="default",size:r="default",selectionMode:d="none",renderEmptyState:l,children:c,"aria-label":p,"aria-labelledby":m,"data-testid":u,selectedKeys:f,defaultSelectedKeys:y,onSelectionChange:N,disabledKeys:z,expandedKeys:P,defaultExpandedKeys:R,onExpandedChange:E,onAction:A,id:w},M){let k=i(h({variant:o}),t);return jsxRuntime.jsx(reactAriaComponents.Tree,{ref:M,id:w,"data-testid":u,"data-tree-size":r,"aria-label":p,"aria-labelledby":m,className:k,selectionMode:d,selectedKeys:f,defaultSelectedKeys:y,onSelectionChange:N,disabledKeys:z,expandedKeys:P,defaultExpandedKeys:R,onExpandedChange:E,onAction:A,renderEmptyState:l?()=>jsxRuntime.jsx("div",{className:b(),children:l()}):void 0,children:c})}var S=react.forwardRef(q);S.displayName="Tree";function G({id:t,textValue:o,isDisabled:r,hasChildItems:d,onAction:l,className:c,children:p,"data-testid":m},u){return jsxRuntime.jsx(reactAriaComponents.TreeItem,{ref:u,id:t,textValue:o,isDisabled:r,hasChildItems:d,onAction:l,"data-testid":m,className:({isSelected:f,isDisabled:y})=>i(x(),f?"data-[selected=true]:bg-[var(--secondary)]":"",y?"opacity-60":"",c),children:p})}var I=react.forwardRef(G);I.displayName="TreeItem";function J({className:t,children:o}){return jsxRuntime.jsx(reactAriaComponents.TreeItemContent,{children:r=>jsxRuntime.jsxs("div",{className:i("flex flex-1 items-center gap-2",t),"data-level":r.level,"data-expanded":r.isExpanded,"data-has-child-items":r.hasChildItems,children:[r.level>1&&jsxRuntime.jsx("span",{"aria-hidden":"true",style:{width:`${String((r.level-1)*16)}px`}}),typeof o=="function"?o(r):o]})})}function O({hasChildItems:t}){return t!==false?jsxRuntime.jsx(reactAriaComponents.Button,{slot:"chevron",className:({isFocusVisible:r})=>i(T(),r?"ring-2 ring-[var(--ring)]":""),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"size-4","aria-hidden":"true"})}):jsxRuntime.jsx("span",{"aria-hidden":"true",className:"size-6 shrink-0"})}function Q(t){return t.childrenCount!==void 0&&t.childrenCount!==null?t.childrenCount>0:Array.isArray(t.children)?t.children.length>0:false}var v=zod.z.object({className:zod.z.string().optional(),children:zod.z.any().optional(),id:zod.z.string().optional(),"aria-label":zod.z.string().optional(),"aria-labelledby":zod.z.string().optional(),"aria-describedby":zod.z.string().optional(),"aria-live":zod.z.enum(["off","polite","assertive"]).optional(),"aria-hidden":zod.z.boolean().optional(),"data-testid":zod.z.string().optional()});var C=zod.z.enum(["default","bordered"]),V=zod.z.enum(["sm","default","lg"]),K=zod.z.enum(["none","single","multiple"]),W=v.extend({"aria-label":zod.z.string().optional(),"aria-labelledby":zod.z.string().optional(),selectionMode:K.optional().default("none"),selectedKeys:zod.z.custom().optional(),defaultSelectedKeys:zod.z.custom().optional(),onSelectionChange:zod.z.custom().optional(),disabledKeys:zod.z.custom().optional(),expandedKeys:zod.z.custom().optional(),defaultExpandedKeys:zod.z.custom().optional(),onExpandedChange:zod.z.custom().optional(),onAction:zod.z.custom().optional(),variant:C.optional().default("default"),size:V.optional().default("default"),className:zod.z.string().optional(),children:zod.z.custom()}),X=v.extend({id:zod.z.union([zod.z.string(),zod.z.number()]),textValue:zod.z.string(),isDisabled:zod.z.boolean().optional(),hasChildItems:zod.z.boolean().optional(),onAction:zod.z.custom().optional(),className:zod.z.string().optional(),children:zod.z.custom()});exports.Tree=S;exports.TreeItem=I;exports.TreeItemChevron=O;exports.TreeItemContent=J;exports.TreeItemPropsSchema=X;exports.TreePropsSchema=W;exports.TreeSelectionModeSchema=K;exports.TreeSizeSchema=V;exports.TreeVariantSchema=C;exports.deriveHasChildItems=Q;exports.treeChevronVariants=T;exports.treeEmptyStateVariants=b;exports.treeIndentVariants=H;exports.treeItemVariants=x;exports.treeVariants=h;//# sourceMappingURL=index.js.map
|
|
3
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/cn.ts","../../../src/elements/Tree/Tree.styles.ts","../../../src/elements/Tree/Tree.tsx","../../../src/schemas/BaseComponentProps.ts","../../../src/elements/Tree/Tree.types.ts"],"names":["cn","inputs","twMerge","clsx","treeVariants","cva","treeItemVariants","treeChevronVariants","treeIndentVariants","treeEmptyStateVariants","TreeImpl","className","variant","size","selectionMode","renderEmptyState","children","ariaLabel","ariaLabelledBy","testId","selectedKeys","defaultSelectedKeys","onSelectionChange","disabledKeys","expandedKeys","defaultExpandedKeys","onExpandedChange","onAction","id","ref","treeClass","jsx","AriaTree","Tree","forwardRef","TreeItemImpl","textValue","isDisabled","hasChildItems","AriaTreeItem","isSelected","disabled","TreeItem","TreeItemContent","AriaTreeItemContent","renderProps","jsxs","TreeItemChevron","AriaButton","isFocusVisible","ChevronRight","deriveHasChildItems","input","BaseComponentPropsSchema","z","TreeVariantSchema","TreeSizeSchema","TreeSelectionModeSchema","TreePropsSchema","TreeItemPropsSchema"],"mappings":"oTAcO,SAASA,CAAAA,CAAAA,GAAMC,EAA8B,CAClD,OAAOC,qBAAAA,CAAQC,SAAAA,CAAKF,CAAM,CAAC,CAC7B,CCTO,IAAMG,CAAAA,CAAeC,0BAAAA,CAC1B,CAAC,yBAAA,CAA2B,cAAc,EAC1C,CACE,QAAA,CAAU,CACR,OAAA,CAAS,CACP,OAAA,CAAS,EAAA,CACT,SAAU,0EACZ,CACF,EACA,eAAA,CAAiB,CACf,QAAS,SACX,CACF,CACF,CAAA,CAMaC,EAAmBD,0BAAAA,CAC9B,CACE,kBACA,yCAAA,CACA,YAAA,CACA,oBACA,gBAAA,CACA,cAAA,CACA,mFAAA,CACA,oGAAA,CACA,sEACA,6BACF,CAAA,CACA,CACE,QAAA,CAAU,CACR,KAAM,CACJ,EAAA,CAAI,2BAAA,CACJ,OAAA,CAAS,6BACT,EAAA,CAAI,8BACN,CACF,CAAA,CACA,gBAAiB,CACf,IAAA,CAAM,SACR,CACF,CACF,CAAA,CAMaE,CAAAA,CAAsBF,2BACjC,CACE,6DAAA,CACA,iCACA,sBAAA,CACA,6BAAA,CACA,kFAAA,CACA,gCAAA,CACA,+BACF,CACF,CAAA,CAOaG,EAAqBH,0BAAAA,CAAI,CACpC,gBACF,CAAC,CAAA,CAEYI,CAAAA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AkB,QAAA,EAAS,CAAE,QAAQ,SAAS,CAAA,CACvD,KAAMC,CAAAA,CAAe,QAAA,EAAS,CAAE,OAAA,CAAQ,SAAS,CAAA,CAEjD,SAAA,CAAWF,MAAE,MAAA,EAAO,CAAE,UAAS,CAC/B,QAAA,CAAUA,KAAAA,CAAE,MAAA,EACd,CAAC,CAAA,CAsCYK,EAAsBN,CAAAA,CAAyB,MAAA,CAAO,CACjE,EAAA,CAAIC,KAAAA,CAAE,KAAA,CAAM,CAACA,MAAE,MAAA,EAAO,CAAGA,MAAE,MAAA,EAAQ,CAAC,CAAA,CACpC,SAAA,CAAWA,KAAAA,CAAE,MAAA,GACb,UAAA,CAAYA,KAAAA,CAAE,SAAQ,CAAE,QAAA,GACxB,aAAA,CAAeA,KAAAA,CAAE,OAAA,EAAQ,CAAE,UAAS,CACpC,QAAA,CAAUA,MAAE,MAAA,EAAmB,CAAE,UAAS,CAC1C,SAAA,CAAWA,KAAAA,CAAE,MAAA,GAAS,QAAA,EAAS,CAC/B,SAAUA,KAAAA,CAAE,MAAA,EACd,CAAC","file":"index.js","sourcesContent":["/**\n * Class Name Utility\n * Merges Tailwind CSS classes with conflict resolution\n *\n * Combines clsx for conditional classes and tailwind-merge for deduplication\n *\n * @example\n * cn('px-2 py-1', 'px-4') // => 'py-1 px-4' (px-4 overrides px-2)\n * cn('text-red-500', condition && 'text-blue-500') // => conditional application\n */\n\nimport { clsx, type ClassValue } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\nexport function cn(...inputs: ClassValue[]): string {\n return twMerge(clsx(inputs));\n}\n","import { cva } from 'class-variance-authority';\n\n/**\n * Tree container styles. The wrapping `<div role=\"tree\">` provides the\n * scrollable surface; nested item content is rendered into a row strip\n * indented by `--tree-indent` per level.\n */\nexport const treeVariants = cva(\n ['relative w-full text-sm', 'outline-none'],\n {\n variants: {\n variant: {\n default: '',\n bordered: 'rounded-md border border-[var(--border)] divide-y divide-[var(--border)]',\n },\n },\n defaultVariants: {\n variant: 'default',\n },\n },\n);\n\n/**\n * Tree item row styles. The size variant drives the minimum row height\n * — `default` is 44px to clear the touch-target standard.\n */\nexport const treeItemVariants = cva(\n [\n 'group/tree-item',\n 'relative flex w-full items-center gap-2',\n 'rounded-md',\n 'transition-colors',\n 'cursor-pointer',\n 'outline-none',\n 'focus-visible:ring-2 focus-visible:ring-[var(--ring)] focus-visible:ring-offset-1',\n 'data-[selected=true]:bg-[var(--secondary)] data-[selected=true]:text-[var(--secondary-foreground)]',\n 'data-[disabled=true]:cursor-default data-[disabled=true]:opacity-60',\n 'hover:bg-[var(--secondary)]',\n ],\n {\n variants: {\n size: {\n sm: 'min-h-9 px-2 py-1 text-sm',\n default: 'min-h-11 px-3 py-2 text-sm',\n lg: 'min-h-14 px-4 py-3 text-base',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n },\n);\n\n/**\n * Disclosure chevron button. Flips on `[data-expanded]`. The 44px touch\n * target lives at the wrapping <div>; this is just the visible glyph.\n */\nexport const treeChevronVariants = cva(\n [\n 'flex size-6 shrink-0 items-center justify-center rounded-sm',\n 'text-[var(--muted-foreground)]',\n 'transition-transform',\n 'hover:bg-[var(--secondary)]',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]',\n 'data-[expanded=true]:rotate-90',\n 'motion-reduce:transition-none',\n ],\n);\n\n/**\n * Indent stripe — a fixed-width spacer that the row uses to render its\n * level. The variable allows host apps to override the indent step\n * (e.g. tighter for compact lists).\n */\nexport const treeIndentVariants = cva([\n 'block shrink-0',\n]);\n\nexport const treeEmptyStateVariants = cva([\n 'flex w-full items-center justify-center px-4 py-8 text-sm text-[var(--muted-foreground)]',\n]);\n","'use client';\n\n/**\n * Tree — accessible hierarchical list, built on React Aria's `Tree`.\n *\n * @see WAI-ARIA Tree pattern (roving tabindex, aria-level / aria-expanded /\n * aria-setsize / aria-posinset, type-ahead, arrow-key navigation).\n *\n * Themis exposes a thin wrapper that:\n * - applies our visual variants and 44px touch-target row sizing\n * - renders a chevron disclosure that flips on expand\n * - supports lazy children via `hasChildItems`\n * - supports controlled and uncontrolled selection / expansion\n */\n\nimport {\n forwardRef,\n type ForwardedRef,\n type ReactElement,\n type ReactNode,\n} from 'react';\nimport {\n Tree as AriaTree,\n TreeItem as AriaTreeItem,\n TreeItemContent as AriaTreeItemContent,\n Button as AriaButton,\n type Key,\n} from 'react-aria-components';\nimport { ChevronRight } from 'lucide-react';\nimport { cn } from '../../utils/cn';\nimport {\n treeVariants,\n treeItemVariants,\n treeChevronVariants,\n treeEmptyStateVariants,\n} from './Tree.styles';\nimport type {\n TreeProps,\n TreeItemProps,\n TreeItemContentProps,\n} from './Tree.types';\n\n// ============================================================================\n// Tree (root)\n// ============================================================================\n\nfunction TreeImpl(\n {\n className,\n variant = 'default',\n size = 'default',\n selectionMode = 'none',\n renderEmptyState,\n children,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'data-testid': testId,\n selectedKeys,\n defaultSelectedKeys,\n onSelectionChange,\n disabledKeys,\n expandedKeys,\n defaultExpandedKeys,\n onExpandedChange,\n onAction,\n id,\n }: TreeProps,\n ref: ForwardedRef<HTMLDivElement>,\n): ReactElement {\n const treeClass = cn(treeVariants({ variant }), className);\n\n return (\n <AriaTree\n ref={ref}\n id={id}\n data-testid={testId}\n data-tree-size={size}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n className={treeClass}\n selectionMode={selectionMode}\n selectedKeys={selectedKeys}\n defaultSelectedKeys={defaultSelectedKeys}\n onSelectionChange={onSelectionChange}\n disabledKeys={disabledKeys}\n expandedKeys={expandedKeys}\n defaultExpandedKeys={defaultExpandedKeys}\n onExpandedChange={onExpandedChange}\n onAction={onAction}\n renderEmptyState={\n renderEmptyState\n ? () => (\n <div className={treeEmptyStateVariants()}>{renderEmptyState()}</div>\n )\n : undefined\n }\n >\n {children}\n </AriaTree>\n );\n}\n\nexport const Tree = forwardRef(TreeImpl);\nTree.displayName = 'Tree';\n\n// ============================================================================\n// TreeItem\n// ============================================================================\n\nfunction TreeItemImpl(\n {\n id,\n textValue,\n isDisabled,\n hasChildItems,\n onAction,\n className,\n children,\n 'data-testid': testId,\n }: TreeItemProps,\n ref: ForwardedRef<HTMLDivElement>,\n): ReactElement {\n // The size variant lives on the root Tree as `data-tree-size`. Items\n // resolve their own size by reading the closest `[data-tree-size]`\n // ancestor at render time via a CSS attribute selector — but Tailwind\n // doesn't make that easy, so we accept a `default` row height here.\n // Consumers who need lg/sm rows should set `treeItemVariants({ size })`\n // themselves and pass through `className`.\n return (\n <AriaTreeItem\n ref={ref}\n id={id}\n textValue={textValue}\n isDisabled={isDisabled}\n hasChildItems={hasChildItems}\n onAction={onAction}\n data-testid={testId}\n className={({ isSelected, isDisabled: disabled }) =>\n cn(\n treeItemVariants(),\n isSelected ? 'data-[selected=true]:bg-[var(--secondary)]' : '',\n disabled ? 'opacity-60' : '',\n className,\n )\n }\n >\n {children}\n </AriaTreeItem>\n );\n}\n\nexport const TreeItem = forwardRef(TreeItemImpl);\nTreeItem.displayName = 'TreeItem';\n\n// ============================================================================\n// TreeItemContent\n// ============================================================================\n\n/**\n * Wraps the row content. Inside this you typically render a chevron\n * (via `<TreeItemChevron />`), the row's label, and any badges or row\n * actions. Nested items go *outside* the content — at the same level as\n * the content — so they're collected as children of this `TreeItem`.\n *\n * ```tsx\n * <TreeItem id=\"a\" textValue=\"A\" hasChildItems>\n * <TreeItemContent>\n * <TreeItemChevron />\n * <span>A</span>\n * </TreeItemContent>\n * <TreeItem id=\"a.b\" textValue=\"A.B\">\n * <TreeItemContent>\n * <span>A.B</span>\n * </TreeItemContent>\n * </TreeItem>\n * </TreeItem>\n * ```\n */\nexport function TreeItemContent({\n className,\n children,\n}: TreeItemContentProps): ReactElement {\n return (\n <AriaTreeItemContent>\n {(renderProps) => (\n <div\n className={cn('flex flex-1 items-center gap-2', className)}\n data-level={renderProps.level}\n data-expanded={renderProps.isExpanded}\n data-has-child-items={renderProps.hasChildItems}\n >\n {/* Indent stripe — 1 unit per level. Level 1 = root, no indent. */}\n {renderProps.level > 1 && (\n <span\n aria-hidden=\"true\"\n style={{ width: `${String((renderProps.level - 1) * 16)}px` }}\n />\n )}\n {typeof children === 'function'\n ? (children as (props: typeof renderProps) => ReactNode)(renderProps)\n : children}\n </div>\n )}\n </AriaTreeItemContent>\n );\n}\n\n// ============================================================================\n// TreeItemChevron\n// ============================================================================\n\n/**\n * Disclosure chevron. Renders inside a `<TreeItemContent>` and toggles\n * the parent item's expansion state. Hidden (with reserved space) on\n * leaf rows so leaf and parent rows align visually.\n */\nexport function TreeItemChevron({\n hasChildItems,\n}: {\n /**\n * Force the chevron to render even when there are no rendered\n * children — useful for lazy-loaded subtrees. Defaults to true; pass\n * `false` for a confirmed leaf to render a placeholder spacer instead.\n */\n hasChildItems?: boolean;\n}): ReactElement {\n const showChevron = hasChildItems !== false;\n\n if (!showChevron) {\n // Reserve the same width as the chevron so labels align.\n return <span aria-hidden=\"true\" className=\"size-6 shrink-0\" />;\n }\n\n return (\n <AriaButton\n slot=\"chevron\"\n className={({ isFocusVisible }) =>\n cn(\n treeChevronVariants(),\n isFocusVisible ? 'ring-2 ring-[var(--ring)]' : '',\n )\n }\n >\n <ChevronRight className=\"size-4\" aria-hidden=\"true\" />\n </AriaButton>\n );\n}\n\n/**\n * Convenience guard for consumers that need to compute `hasChildItems`\n * from a data shape ahead of render. Returns `true` when the input\n * either has rendered children OR a known children count > 0.\n */\nexport function deriveHasChildItems(input: {\n childrenCount?: number | null;\n children?: ReactNode | unknown[];\n}): boolean {\n if (input.childrenCount !== undefined && input.childrenCount !== null) {\n return input.childrenCount > 0;\n }\n if (Array.isArray(input.children)) {\n return input.children.length > 0;\n }\n return false;\n}\n\n// Re-export the React Aria `Key` type for consumers who set up controlled\n// expansion / selection.\nexport type { Key };\n","import { z } from 'zod';\n\n/**\n * Base props schema for all Themis components\n * Ensures consistent accessibility and styling APIs across the library\n *\n * @see spec.md FR-009 to FR-014 (Accessibility Requirements)\n * @see constitution.md Principle IV (Accessibility First - WCAG 2.2 AA minimum)\n */\nexport const BaseComponentPropsSchema = z.object({\n // Styling\n className: z.string().optional(),\n\n // React\n children: z.any().optional(), // ReactNode not directly supported by Zod\n id: z.string().optional(),\n\n // Accessibility (WCAG 2.2 AA requirements)\n 'aria-label': z.string().optional(),\n 'aria-labelledby': z.string().optional(),\n 'aria-describedby': z.string().optional(),\n 'aria-live': z.enum(['off', 'polite', 'assertive']).optional(),\n 'aria-hidden': z.boolean().optional(),\n\n // Testing & Development\n 'data-testid': z.string().optional(),\n});\n\nexport type BaseComponentProps = z.infer<typeof BaseComponentPropsSchema>;\n","import { z } from 'zod';\nimport { BaseComponentPropsSchema } from '../../schemas/BaseComponentProps';\nimport type { ReactNode } from 'react';\nimport type { Selection, Key } from 'react-aria-components';\n\n// ============================================================================\n// Re-exports for consumer convenience\n// ============================================================================\n\nexport type { Selection, Key };\n\n// ============================================================================\n// Variant Schemas\n// ============================================================================\n\n/**\n * Tree visual variant.\n * - default: minimal, transparent rows; suits in-content lists.\n * - bordered: rows separated by hairline borders; suits standalone trees.\n */\nexport const TreeVariantSchema = z.enum(['default', 'bordered']);\nexport type TreeVariant = z.infer<typeof TreeVariantSchema>;\n\n/**\n * Tree size — drives row height. `default` clears the 44px touch target.\n */\nexport const TreeSizeSchema = z.enum(['sm', 'default', 'lg']);\nexport type TreeSize = z.infer<typeof TreeSizeSchema>;\n\n/**\n * Selection mode passed through to React Aria Tree. None disables the\n * checkbox column entirely.\n */\nexport const TreeSelectionModeSchema = z.enum(['none', 'single', 'multiple']);\nexport type TreeSelectionMode = z.infer<typeof TreeSelectionModeSchema>;\n\n// ============================================================================\n// Component Props Schemas\n// ============================================================================\n\n/**\n * Tree root props schema (Themis-specific; React Aria props pass through\n * via the component implementation).\n */\nexport const TreePropsSchema = BaseComponentPropsSchema.extend({\n 'aria-label': z.string().optional(),\n 'aria-labelledby': z.string().optional(),\n\n selectionMode: TreeSelectionModeSchema.optional().default('none'),\n selectedKeys: z.custom<Selection>().optional(),\n defaultSelectedKeys: z.custom<Selection>().optional(),\n onSelectionChange: z.custom<(keys: Selection) => void>().optional(),\n disabledKeys: z.custom<Iterable<Key>>().optional(),\n\n expandedKeys: z.custom<Iterable<Key>>().optional(),\n defaultExpandedKeys: z.custom<Iterable<Key>>().optional(),\n onExpandedChange: z.custom<(keys: Set<Key>) => void>().optional(),\n\n onAction: z.custom<(key: Key) => void>().optional(),\n\n variant: TreeVariantSchema.optional().default('default'),\n size: TreeSizeSchema.optional().default('default'),\n\n className: z.string().optional(),\n children: z.custom<ReactNode>(),\n});\n\nexport interface TreeProps {\n className?: string;\n children?: ReactNode;\n id?: string;\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n 'data-testid'?: string;\n\n /** Selection mode. Defaults to `'none'`. */\n selectionMode?: TreeSelectionMode;\n selectedKeys?: Selection;\n defaultSelectedKeys?: Selection;\n onSelectionChange?: (keys: Selection) => void;\n disabledKeys?: Iterable<Key>;\n\n /** Controlled expansion. Use to drive lazy-loading flows. */\n expandedKeys?: Iterable<Key>;\n defaultExpandedKeys?: Iterable<Key>;\n onExpandedChange?: (keys: Set<Key>) => void;\n\n /** Fired when the user activates a row (Enter / double-click / Space). */\n onAction?: (key: Key) => void;\n\n /** Visual variant. Default is `'default'`. */\n variant?: TreeVariant;\n /** Row height variant. Default `'default'` clears the 44px touch target. */\n size?: TreeSize;\n\n /** Render-prop fallback when the tree has no items. */\n renderEmptyState?: () => ReactNode;\n}\n\n/**\n * TreeItem props schema. Items are the rows of the tree; nesting is\n * expressed by placing further `<TreeItem>`s inside the item's content.\n */\nexport const TreeItemPropsSchema = BaseComponentPropsSchema.extend({\n id: z.union([z.string(), z.number()]),\n textValue: z.string(),\n isDisabled: z.boolean().optional(),\n hasChildItems: z.boolean().optional(),\n onAction: z.custom<() => void>().optional(),\n className: z.string().optional(),\n children: z.custom<ReactNode>(),\n});\n\nexport interface TreeItemProps {\n /** Unique key for the row. */\n id: Key;\n /** Plain-text representation, used for typeahead. */\n textValue: string;\n /** Whether this item should be focusable but not selectable / actionable. */\n isDisabled?: boolean;\n /**\n * Force-expose the disclosure chevron even when the item has no rendered\n * children yet (lazy loading). When `false`/omitted, the chevron is shown\n * only if the item has rendered children.\n */\n hasChildItems?: boolean;\n /** Activation callback (Enter / Space / row-action click). */\n onAction?: () => void;\n className?: string;\n children?: ReactNode;\n id_attr?: string;\n 'data-testid'?: string;\n}\n\n/**\n * TreeItemContent props — the visible row contents. Use this to wrap\n * the row's label, status pills, and action affordances.\n */\nexport interface TreeItemContentProps {\n className?: string;\n children?: ReactNode;\n}\n\n// ============================================================================\n// CVA Variant Types\n// ============================================================================\n\nexport type TreeVariantProps = {\n variant?: TreeVariant;\n size?: TreeSize;\n};\n\nexport type TreeItemVariantProps = {\n size?: TreeSize;\n isSelected?: boolean;\n isDisabled?: boolean;\n};\n"]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {forwardRef}from'react';import {Tree,TreeItem,TreeItemContent,Button}from'react-aria-components';import {ChevronRight}from'lucide-react';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {cva}from'class-variance-authority';import {jsx,jsxs}from'react/jsx-runtime';import {z}from'zod';function i(...t){return twMerge(clsx(t))}var h=cva(["relative w-full text-sm","outline-none"],{variants:{variant:{default:"",bordered:"rounded-md border border-[var(--border)] divide-y divide-[var(--border)]"}},defaultVariants:{variant:"default"}}),x=cva(["group/tree-item","relative flex w-full items-center gap-2","rounded-md","transition-colors","cursor-pointer","outline-none","focus-visible:ring-2 focus-visible:ring-[var(--ring)] focus-visible:ring-offset-1","data-[selected=true]:bg-[var(--secondary)] data-[selected=true]:text-[var(--secondary-foreground)]","data-[disabled=true]:cursor-default data-[disabled=true]:opacity-60","hover:bg-[var(--secondary)]"],{variants:{size:{sm:"min-h-9 px-2 py-1 text-sm",default:"min-h-11 px-3 py-2 text-sm",lg:"min-h-14 px-4 py-3 text-base"}},defaultVariants:{size:"default"}}),T=cva(["flex size-6 shrink-0 items-center justify-center rounded-sm","text-[var(--muted-foreground)]","transition-transform","hover:bg-[var(--secondary)]","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]","data-[expanded=true]:rotate-90","motion-reduce:transition-none"]),H=cva(["block shrink-0"]),b=cva(["flex w-full items-center justify-center px-4 py-8 text-sm text-[var(--muted-foreground)]"]);function q({className:t,variant:o="default",size:r="default",selectionMode:d="none",renderEmptyState:l,children:c,"aria-label":p,"aria-labelledby":m,"data-testid":u,selectedKeys:f,defaultSelectedKeys:y,onSelectionChange:N,disabledKeys:z,expandedKeys:P,defaultExpandedKeys:R,onExpandedChange:E,onAction:A,id:w},M){let k=i(h({variant:o}),t);return jsx(Tree,{ref:M,id:w,"data-testid":u,"data-tree-size":r,"aria-label":p,"aria-labelledby":m,className:k,selectionMode:d,selectedKeys:f,defaultSelectedKeys:y,onSelectionChange:N,disabledKeys:z,expandedKeys:P,defaultExpandedKeys:R,onExpandedChange:E,onAction:A,renderEmptyState:l?()=>jsx("div",{className:b(),children:l()}):void 0,children:c})}var S=forwardRef(q);S.displayName="Tree";function G({id:t,textValue:o,isDisabled:r,hasChildItems:d,onAction:l,className:c,children:p,"data-testid":m},u){return jsx(TreeItem,{ref:u,id:t,textValue:o,isDisabled:r,hasChildItems:d,onAction:l,"data-testid":m,className:({isSelected:f,isDisabled:y})=>i(x(),f?"data-[selected=true]:bg-[var(--secondary)]":"",y?"opacity-60":"",c),children:p})}var I=forwardRef(G);I.displayName="TreeItem";function J({className:t,children:o}){return jsx(TreeItemContent,{children:r=>jsxs("div",{className:i("flex flex-1 items-center gap-2",t),"data-level":r.level,"data-expanded":r.isExpanded,"data-has-child-items":r.hasChildItems,children:[r.level>1&&jsx("span",{"aria-hidden":"true",style:{width:`${String((r.level-1)*16)}px`}}),typeof o=="function"?o(r):o]})})}function O({hasChildItems:t}){return t!==false?jsx(Button,{slot:"chevron",className:({isFocusVisible:r})=>i(T(),r?"ring-2 ring-[var(--ring)]":""),children:jsx(ChevronRight,{className:"size-4","aria-hidden":"true"})}):jsx("span",{"aria-hidden":"true",className:"size-6 shrink-0"})}function Q(t){return t.childrenCount!==void 0&&t.childrenCount!==null?t.childrenCount>0:Array.isArray(t.children)?t.children.length>0:false}var v=z.object({className:z.string().optional(),children:z.any().optional(),id:z.string().optional(),"aria-label":z.string().optional(),"aria-labelledby":z.string().optional(),"aria-describedby":z.string().optional(),"aria-live":z.enum(["off","polite","assertive"]).optional(),"aria-hidden":z.boolean().optional(),"data-testid":z.string().optional()});var C=z.enum(["default","bordered"]),V=z.enum(["sm","default","lg"]),K=z.enum(["none","single","multiple"]),W=v.extend({"aria-label":z.string().optional(),"aria-labelledby":z.string().optional(),selectionMode:K.optional().default("none"),selectedKeys:z.custom().optional(),defaultSelectedKeys:z.custom().optional(),onSelectionChange:z.custom().optional(),disabledKeys:z.custom().optional(),expandedKeys:z.custom().optional(),defaultExpandedKeys:z.custom().optional(),onExpandedChange:z.custom().optional(),onAction:z.custom().optional(),variant:C.optional().default("default"),size:V.optional().default("default"),className:z.string().optional(),children:z.custom()}),X=v.extend({id:z.union([z.string(),z.number()]),textValue:z.string(),isDisabled:z.boolean().optional(),hasChildItems:z.boolean().optional(),onAction:z.custom().optional(),className:z.string().optional(),children:z.custom()});export{S as Tree,I as TreeItem,O as TreeItemChevron,J as TreeItemContent,X as TreeItemPropsSchema,W as TreePropsSchema,K as TreeSelectionModeSchema,V as TreeSizeSchema,C as TreeVariantSchema,Q as deriveHasChildItems,T as treeChevronVariants,b as treeEmptyStateVariants,H as treeIndentVariants,x as treeItemVariants,h as treeVariants};//# sourceMappingURL=index.mjs.map
|
|
3
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/cn.ts","../../../src/elements/Tree/Tree.styles.ts","../../../src/elements/Tree/Tree.tsx","../../../src/schemas/BaseComponentProps.ts","../../../src/elements/Tree/Tree.types.ts"],"names":["cn","inputs","twMerge","clsx","treeVariants","cva","treeItemVariants","treeChevronVariants","treeIndentVariants","treeEmptyStateVariants","TreeImpl","className","variant","size","selectionMode","renderEmptyState","children","ariaLabel","ariaLabelledBy","testId","selectedKeys","defaultSelectedKeys","onSelectionChange","disabledKeys","expandedKeys","defaultExpandedKeys","onExpandedChange","onAction","id","ref","treeClass","jsx","AriaTree","Tree","forwardRef","TreeItemImpl","textValue","isDisabled","hasChildItems","AriaTreeItem","isSelected","disabled","TreeItem","TreeItemContent","AriaTreeItemContent","renderProps","jsxs","TreeItemChevron","AriaButton","isFocusVisible","ChevronRight","deriveHasChildItems","input","BaseComponentPropsSchema","z","TreeVariantSchema","TreeSizeSchema","TreeSelectionModeSchema","TreePropsSchema","TreeItemPropsSchema"],"mappings":"qTAcO,SAASA,CAAAA,CAAAA,GAAMC,EAA8B,CAClD,OAAOC,OAAAA,CAAQC,IAAAA,CAAKF,CAAM,CAAC,CAC7B,CCTO,IAAMG,CAAAA,CAAeC,GAAAA,CAC1B,CAAC,yBAAA,CAA2B,cAAc,EAC1C,CACE,QAAA,CAAU,CACR,OAAA,CAAS,CACP,OAAA,CAAS,EAAA,CACT,SAAU,0EACZ,CACF,EACA,eAAA,CAAiB,CACf,QAAS,SACX,CACF,CACF,CAAA,CAMaC,EAAmBD,GAAAA,CAC9B,CACE,kBACA,yCAAA,CACA,YAAA,CACA,oBACA,gBAAA,CACA,cAAA,CACA,mFAAA,CACA,oGAAA,CACA,sEACA,6BACF,CAAA,CACA,CACE,QAAA,CAAU,CACR,KAAM,CACJ,EAAA,CAAI,2BAAA,CACJ,OAAA,CAAS,6BACT,EAAA,CAAI,8BACN,CACF,CAAA,CACA,gBAAiB,CACf,IAAA,CAAM,SACR,CACF,CACF,CAAA,CAMaE,CAAAA,CAAsBF,IACjC,CACE,6DAAA,CACA,iCACA,sBAAA,CACA,6BAAA,CACA,kFAAA,CACA,gCAAA,CACA,+BACF,CACF,CAAA,CAOaG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CAAE,QAA2B,CAAE,QAAA,EAAS,CAElD,OAAA,CAASC,EAAkB,QAAA,EAAS,CAAE,QAAQ,SAAS,CAAA,CACvD,KAAMC,CAAAA,CAAe,QAAA,EAAS,CAAE,OAAA,CAAQ,SAAS,CAAA,CAEjD,SAAA,CAAWF,EAAE,MAAA,EAAO,CAAE,UAAS,CAC/B,QAAA,CAAUA,CAAAA,CAAE,MAAA,EACd,CAAC,CAAA,CAsCYK,EAAsBN,CAAAA,CAAyB,MAAA,CAAO,CACjE,EAAA,CAAIC,CAAAA,CAAE,KAAA,CAAM,CAACA,EAAE,MAAA,EAAO,CAAGA,EAAE,MAAA,EAAQ,CAAC,CAAA,CACpC,SAAA,CAAWA,CAAAA,CAAE,MAAA,GACb,UAAA,CAAYA,CAAAA,CAAE,SAAQ,CAAE,QAAA,GACxB,aAAA,CAAeA,CAAAA,CAAE,OAAA,EAAQ,CAAE,UAAS,CACpC,QAAA,CAAUA,EAAE,MAAA,EAAmB,CAAE,UAAS,CAC1C,SAAA,CAAWA,CAAAA,CAAE,MAAA,GAAS,QAAA,EAAS,CAC/B,SAAUA,CAAAA,CAAE,MAAA,EACd,CAAC","file":"index.mjs","sourcesContent":["/**\n * Class Name Utility\n * Merges Tailwind CSS classes with conflict resolution\n *\n * Combines clsx for conditional classes and tailwind-merge for deduplication\n *\n * @example\n * cn('px-2 py-1', 'px-4') // => 'py-1 px-4' (px-4 overrides px-2)\n * cn('text-red-500', condition && 'text-blue-500') // => conditional application\n */\n\nimport { clsx, type ClassValue } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\nexport function cn(...inputs: ClassValue[]): string {\n return twMerge(clsx(inputs));\n}\n","import { cva } from 'class-variance-authority';\n\n/**\n * Tree container styles. The wrapping `<div role=\"tree\">` provides the\n * scrollable surface; nested item content is rendered into a row strip\n * indented by `--tree-indent` per level.\n */\nexport const treeVariants = cva(\n ['relative w-full text-sm', 'outline-none'],\n {\n variants: {\n variant: {\n default: '',\n bordered: 'rounded-md border border-[var(--border)] divide-y divide-[var(--border)]',\n },\n },\n defaultVariants: {\n variant: 'default',\n },\n },\n);\n\n/**\n * Tree item row styles. The size variant drives the minimum row height\n * — `default` is 44px to clear the touch-target standard.\n */\nexport const treeItemVariants = cva(\n [\n 'group/tree-item',\n 'relative flex w-full items-center gap-2',\n 'rounded-md',\n 'transition-colors',\n 'cursor-pointer',\n 'outline-none',\n 'focus-visible:ring-2 focus-visible:ring-[var(--ring)] focus-visible:ring-offset-1',\n 'data-[selected=true]:bg-[var(--secondary)] data-[selected=true]:text-[var(--secondary-foreground)]',\n 'data-[disabled=true]:cursor-default data-[disabled=true]:opacity-60',\n 'hover:bg-[var(--secondary)]',\n ],\n {\n variants: {\n size: {\n sm: 'min-h-9 px-2 py-1 text-sm',\n default: 'min-h-11 px-3 py-2 text-sm',\n lg: 'min-h-14 px-4 py-3 text-base',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n },\n);\n\n/**\n * Disclosure chevron button. Flips on `[data-expanded]`. The 44px touch\n * target lives at the wrapping <div>; this is just the visible glyph.\n */\nexport const treeChevronVariants = cva(\n [\n 'flex size-6 shrink-0 items-center justify-center rounded-sm',\n 'text-[var(--muted-foreground)]',\n 'transition-transform',\n 'hover:bg-[var(--secondary)]',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]',\n 'data-[expanded=true]:rotate-90',\n 'motion-reduce:transition-none',\n ],\n);\n\n/**\n * Indent stripe — a fixed-width spacer that the row uses to render its\n * level. The variable allows host apps to override the indent step\n * (e.g. tighter for compact lists).\n */\nexport const treeIndentVariants = cva([\n 'block shrink-0',\n]);\n\nexport const treeEmptyStateVariants = cva([\n 'flex w-full items-center justify-center px-4 py-8 text-sm text-[var(--muted-foreground)]',\n]);\n","'use client';\n\n/**\n * Tree — accessible hierarchical list, built on React Aria's `Tree`.\n *\n * @see WAI-ARIA Tree pattern (roving tabindex, aria-level / aria-expanded /\n * aria-setsize / aria-posinset, type-ahead, arrow-key navigation).\n *\n * Themis exposes a thin wrapper that:\n * - applies our visual variants and 44px touch-target row sizing\n * - renders a chevron disclosure that flips on expand\n * - supports lazy children via `hasChildItems`\n * - supports controlled and uncontrolled selection / expansion\n */\n\nimport {\n forwardRef,\n type ForwardedRef,\n type ReactElement,\n type ReactNode,\n} from 'react';\nimport {\n Tree as AriaTree,\n TreeItem as AriaTreeItem,\n TreeItemContent as AriaTreeItemContent,\n Button as AriaButton,\n type Key,\n} from 'react-aria-components';\nimport { ChevronRight } from 'lucide-react';\nimport { cn } from '../../utils/cn';\nimport {\n treeVariants,\n treeItemVariants,\n treeChevronVariants,\n treeEmptyStateVariants,\n} from './Tree.styles';\nimport type {\n TreeProps,\n TreeItemProps,\n TreeItemContentProps,\n} from './Tree.types';\n\n// ============================================================================\n// Tree (root)\n// ============================================================================\n\nfunction TreeImpl(\n {\n className,\n variant = 'default',\n size = 'default',\n selectionMode = 'none',\n renderEmptyState,\n children,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'data-testid': testId,\n selectedKeys,\n defaultSelectedKeys,\n onSelectionChange,\n disabledKeys,\n expandedKeys,\n defaultExpandedKeys,\n onExpandedChange,\n onAction,\n id,\n }: TreeProps,\n ref: ForwardedRef<HTMLDivElement>,\n): ReactElement {\n const treeClass = cn(treeVariants({ variant }), className);\n\n return (\n <AriaTree\n ref={ref}\n id={id}\n data-testid={testId}\n data-tree-size={size}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n className={treeClass}\n selectionMode={selectionMode}\n selectedKeys={selectedKeys}\n defaultSelectedKeys={defaultSelectedKeys}\n onSelectionChange={onSelectionChange}\n disabledKeys={disabledKeys}\n expandedKeys={expandedKeys}\n defaultExpandedKeys={defaultExpandedKeys}\n onExpandedChange={onExpandedChange}\n onAction={onAction}\n renderEmptyState={\n renderEmptyState\n ? () => (\n <div className={treeEmptyStateVariants()}>{renderEmptyState()}</div>\n )\n : undefined\n }\n >\n {children}\n </AriaTree>\n );\n}\n\nexport const Tree = forwardRef(TreeImpl);\nTree.displayName = 'Tree';\n\n// ============================================================================\n// TreeItem\n// ============================================================================\n\nfunction TreeItemImpl(\n {\n id,\n textValue,\n isDisabled,\n hasChildItems,\n onAction,\n className,\n children,\n 'data-testid': testId,\n }: TreeItemProps,\n ref: ForwardedRef<HTMLDivElement>,\n): ReactElement {\n // The size variant lives on the root Tree as `data-tree-size`. Items\n // resolve their own size by reading the closest `[data-tree-size]`\n // ancestor at render time via a CSS attribute selector — but Tailwind\n // doesn't make that easy, so we accept a `default` row height here.\n // Consumers who need lg/sm rows should set `treeItemVariants({ size })`\n // themselves and pass through `className`.\n return (\n <AriaTreeItem\n ref={ref}\n id={id}\n textValue={textValue}\n isDisabled={isDisabled}\n hasChildItems={hasChildItems}\n onAction={onAction}\n data-testid={testId}\n className={({ isSelected, isDisabled: disabled }) =>\n cn(\n treeItemVariants(),\n isSelected ? 'data-[selected=true]:bg-[var(--secondary)]' : '',\n disabled ? 'opacity-60' : '',\n className,\n )\n }\n >\n {children}\n </AriaTreeItem>\n );\n}\n\nexport const TreeItem = forwardRef(TreeItemImpl);\nTreeItem.displayName = 'TreeItem';\n\n// ============================================================================\n// TreeItemContent\n// ============================================================================\n\n/**\n * Wraps the row content. Inside this you typically render a chevron\n * (via `<TreeItemChevron />`), the row's label, and any badges or row\n * actions. Nested items go *outside* the content — at the same level as\n * the content — so they're collected as children of this `TreeItem`.\n *\n * ```tsx\n * <TreeItem id=\"a\" textValue=\"A\" hasChildItems>\n * <TreeItemContent>\n * <TreeItemChevron />\n * <span>A</span>\n * </TreeItemContent>\n * <TreeItem id=\"a.b\" textValue=\"A.B\">\n * <TreeItemContent>\n * <span>A.B</span>\n * </TreeItemContent>\n * </TreeItem>\n * </TreeItem>\n * ```\n */\nexport function TreeItemContent({\n className,\n children,\n}: TreeItemContentProps): ReactElement {\n return (\n <AriaTreeItemContent>\n {(renderProps) => (\n <div\n className={cn('flex flex-1 items-center gap-2', className)}\n data-level={renderProps.level}\n data-expanded={renderProps.isExpanded}\n data-has-child-items={renderProps.hasChildItems}\n >\n {/* Indent stripe — 1 unit per level. Level 1 = root, no indent. */}\n {renderProps.level > 1 && (\n <span\n aria-hidden=\"true\"\n style={{ width: `${String((renderProps.level - 1) * 16)}px` }}\n />\n )}\n {typeof children === 'function'\n ? (children as (props: typeof renderProps) => ReactNode)(renderProps)\n : children}\n </div>\n )}\n </AriaTreeItemContent>\n );\n}\n\n// ============================================================================\n// TreeItemChevron\n// ============================================================================\n\n/**\n * Disclosure chevron. Renders inside a `<TreeItemContent>` and toggles\n * the parent item's expansion state. Hidden (with reserved space) on\n * leaf rows so leaf and parent rows align visually.\n */\nexport function TreeItemChevron({\n hasChildItems,\n}: {\n /**\n * Force the chevron to render even when there are no rendered\n * children — useful for lazy-loaded subtrees. Defaults to true; pass\n * `false` for a confirmed leaf to render a placeholder spacer instead.\n */\n hasChildItems?: boolean;\n}): ReactElement {\n const showChevron = hasChildItems !== false;\n\n if (!showChevron) {\n // Reserve the same width as the chevron so labels align.\n return <span aria-hidden=\"true\" className=\"size-6 shrink-0\" />;\n }\n\n return (\n <AriaButton\n slot=\"chevron\"\n className={({ isFocusVisible }) =>\n cn(\n treeChevronVariants(),\n isFocusVisible ? 'ring-2 ring-[var(--ring)]' : '',\n )\n }\n >\n <ChevronRight className=\"size-4\" aria-hidden=\"true\" />\n </AriaButton>\n );\n}\n\n/**\n * Convenience guard for consumers that need to compute `hasChildItems`\n * from a data shape ahead of render. Returns `true` when the input\n * either has rendered children OR a known children count > 0.\n */\nexport function deriveHasChildItems(input: {\n childrenCount?: number | null;\n children?: ReactNode | unknown[];\n}): boolean {\n if (input.childrenCount !== undefined && input.childrenCount !== null) {\n return input.childrenCount > 0;\n }\n if (Array.isArray(input.children)) {\n return input.children.length > 0;\n }\n return false;\n}\n\n// Re-export the React Aria `Key` type for consumers who set up controlled\n// expansion / selection.\nexport type { Key };\n","import { z } from 'zod';\n\n/**\n * Base props schema for all Themis components\n * Ensures consistent accessibility and styling APIs across the library\n *\n * @see spec.md FR-009 to FR-014 (Accessibility Requirements)\n * @see constitution.md Principle IV (Accessibility First - WCAG 2.2 AA minimum)\n */\nexport const BaseComponentPropsSchema = z.object({\n // Styling\n className: z.string().optional(),\n\n // React\n children: z.any().optional(), // ReactNode not directly supported by Zod\n id: z.string().optional(),\n\n // Accessibility (WCAG 2.2 AA requirements)\n 'aria-label': z.string().optional(),\n 'aria-labelledby': z.string().optional(),\n 'aria-describedby': z.string().optional(),\n 'aria-live': z.enum(['off', 'polite', 'assertive']).optional(),\n 'aria-hidden': z.boolean().optional(),\n\n // Testing & Development\n 'data-testid': z.string().optional(),\n});\n\nexport type BaseComponentProps = z.infer<typeof BaseComponentPropsSchema>;\n","import { z } from 'zod';\nimport { BaseComponentPropsSchema } from '../../schemas/BaseComponentProps';\nimport type { ReactNode } from 'react';\nimport type { Selection, Key } from 'react-aria-components';\n\n// ============================================================================\n// Re-exports for consumer convenience\n// ============================================================================\n\nexport type { Selection, Key };\n\n// ============================================================================\n// Variant Schemas\n// ============================================================================\n\n/**\n * Tree visual variant.\n * - default: minimal, transparent rows; suits in-content lists.\n * - bordered: rows separated by hairline borders; suits standalone trees.\n */\nexport const TreeVariantSchema = z.enum(['default', 'bordered']);\nexport type TreeVariant = z.infer<typeof TreeVariantSchema>;\n\n/**\n * Tree size — drives row height. `default` clears the 44px touch target.\n */\nexport const TreeSizeSchema = z.enum(['sm', 'default', 'lg']);\nexport type TreeSize = z.infer<typeof TreeSizeSchema>;\n\n/**\n * Selection mode passed through to React Aria Tree. None disables the\n * checkbox column entirely.\n */\nexport const TreeSelectionModeSchema = z.enum(['none', 'single', 'multiple']);\nexport type TreeSelectionMode = z.infer<typeof TreeSelectionModeSchema>;\n\n// ============================================================================\n// Component Props Schemas\n// ============================================================================\n\n/**\n * Tree root props schema (Themis-specific; React Aria props pass through\n * via the component implementation).\n */\nexport const TreePropsSchema = BaseComponentPropsSchema.extend({\n 'aria-label': z.string().optional(),\n 'aria-labelledby': z.string().optional(),\n\n selectionMode: TreeSelectionModeSchema.optional().default('none'),\n selectedKeys: z.custom<Selection>().optional(),\n defaultSelectedKeys: z.custom<Selection>().optional(),\n onSelectionChange: z.custom<(keys: Selection) => void>().optional(),\n disabledKeys: z.custom<Iterable<Key>>().optional(),\n\n expandedKeys: z.custom<Iterable<Key>>().optional(),\n defaultExpandedKeys: z.custom<Iterable<Key>>().optional(),\n onExpandedChange: z.custom<(keys: Set<Key>) => void>().optional(),\n\n onAction: z.custom<(key: Key) => void>().optional(),\n\n variant: TreeVariantSchema.optional().default('default'),\n size: TreeSizeSchema.optional().default('default'),\n\n className: z.string().optional(),\n children: z.custom<ReactNode>(),\n});\n\nexport interface TreeProps {\n className?: string;\n children?: ReactNode;\n id?: string;\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n 'data-testid'?: string;\n\n /** Selection mode. Defaults to `'none'`. */\n selectionMode?: TreeSelectionMode;\n selectedKeys?: Selection;\n defaultSelectedKeys?: Selection;\n onSelectionChange?: (keys: Selection) => void;\n disabledKeys?: Iterable<Key>;\n\n /** Controlled expansion. Use to drive lazy-loading flows. */\n expandedKeys?: Iterable<Key>;\n defaultExpandedKeys?: Iterable<Key>;\n onExpandedChange?: (keys: Set<Key>) => void;\n\n /** Fired when the user activates a row (Enter / double-click / Space). */\n onAction?: (key: Key) => void;\n\n /** Visual variant. Default is `'default'`. */\n variant?: TreeVariant;\n /** Row height variant. Default `'default'` clears the 44px touch target. */\n size?: TreeSize;\n\n /** Render-prop fallback when the tree has no items. */\n renderEmptyState?: () => ReactNode;\n}\n\n/**\n * TreeItem props schema. Items are the rows of the tree; nesting is\n * expressed by placing further `<TreeItem>`s inside the item's content.\n */\nexport const TreeItemPropsSchema = BaseComponentPropsSchema.extend({\n id: z.union([z.string(), z.number()]),\n textValue: z.string(),\n isDisabled: z.boolean().optional(),\n hasChildItems: z.boolean().optional(),\n onAction: z.custom<() => void>().optional(),\n className: z.string().optional(),\n children: z.custom<ReactNode>(),\n});\n\nexport interface TreeItemProps {\n /** Unique key for the row. */\n id: Key;\n /** Plain-text representation, used for typeahead. */\n textValue: string;\n /** Whether this item should be focusable but not selectable / actionable. */\n isDisabled?: boolean;\n /**\n * Force-expose the disclosure chevron even when the item has no rendered\n * children yet (lazy loading). When `false`/omitted, the chevron is shown\n * only if the item has rendered children.\n */\n hasChildItems?: boolean;\n /** Activation callback (Enter / Space / row-action click). */\n onAction?: () => void;\n className?: string;\n children?: ReactNode;\n id_attr?: string;\n 'data-testid'?: string;\n}\n\n/**\n * TreeItemContent props — the visible row contents. Use this to wrap\n * the row's label, status pills, and action affordances.\n */\nexport interface TreeItemContentProps {\n className?: string;\n children?: ReactNode;\n}\n\n// ============================================================================\n// CVA Variant Types\n// ============================================================================\n\nexport type TreeVariantProps = {\n variant?: TreeVariant;\n size?: TreeSize;\n};\n\nexport type TreeItemVariantProps = {\n size?: TreeSize;\n isSelected?: boolean;\n isDisabled?: boolean;\n};\n"]}
|
package/dist/elements/index.d.ts
CHANGED
|
@@ -45,6 +45,8 @@ export { TimeField, Time, parseTime, timeFieldVariants, timeSegmentVariants, tim
|
|
|
45
45
|
export { toast, toastQueue, toastVariants, toasterVariants, ToastProvider, Toaster, ToastOptionsSchema, ToasterPropsSchema, ToastProviderPropsSchema, ToastVariantSchema, ToasterPositionSchema, DismissReasonSchema, } from './Toast';
|
|
46
46
|
export type { ToastOptions, ToastContent, ToasterProps, ToastProviderProps, ToastVariant, ToasterPosition, DismissReason, } from './Toast';
|
|
47
47
|
export { Tooltip, TooltipTrigger, TooltipContent, TooltipArrow, tooltipContentVariants, tooltipArrowVariants, } from './Tooltip';
|
|
48
|
+
export { Tree, TreeItem, TreeItemContent, TreeItemChevron, deriveHasChildItems, treeVariants, treeItemVariants, treeChevronVariants, treeIndentVariants, treeEmptyStateVariants, TreePropsSchema, TreeItemPropsSchema, TreeVariantSchema, TreeSizeSchema, TreeSelectionModeSchema, } from './Tree';
|
|
49
|
+
export type { TreeProps, TreeItemProps, TreeItemContentProps, TreeVariant, TreeSize, TreeSelectionMode, TreeVariantProps, TreeItemVariantProps, } from './Tree';
|
|
48
50
|
export { AlertDialog, alertDialogContentVariants, } from './AlertDialog';
|
|
49
51
|
export type { AlertDialogProps, AlertDialogVariant, AlertDialogSize, } from './AlertDialog';
|
|
50
52
|
export { Combobox, ComboboxItem, ComboboxSection } from './Combobox';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/elements/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,EACrB,wBAAwB,EACxB,wBAAwB,EACxB,wBAAwB,EACxB,6BAA6B,GAC9B,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,cAAc,EACd,kBAAkB,EAClB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,MAAM,EACN,WAAW,EACX,mBAAmB,EACnB,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,KAAK,EACL,kBAAkB,EAClB,mBAAmB,EACnB,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EACL,WAAW,EACX,oBAAoB,EACpB,qBAAqB,EACrB,yBAAyB,EACzB,sBAAsB,EACtB,+BAA+B,EAC/B,mBAAmB,EACnB,uBAAuB,EACvB,4BAA4B,GAC7B,MAAM,eAAe,CAAC;AACvB,YAAY,EACV,gBAAgB,EAChB,yBAAyB,EACzB,sBAAsB,EACtB,kBAAkB,EAClB,eAAe,GAChB,MAAM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