@ssa-ui-kit/core 3.21.2 → 3.22.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/ai/source-map.md +2243 -0
- package/dist/components/ButtonGroup/ButtonGroup.d.ts +7 -3
- package/dist/components/ButtonGroup/ButtonGroupButton.d.ts +15 -5
- package/dist/components/ButtonGroup/ButtonGroupButtonBase.d.ts +17 -1
- package/dist/components/ButtonGroup/styles.d.ts +22 -0
- package/dist/components/ButtonGroup/types.d.ts +45 -7
- package/dist/components/Card/Card.d.ts +60 -0
- package/dist/components/Card/types.d.ts +13 -0
- package/dist/components/CardContent/CardContent.d.ts +46 -0
- package/dist/components/CardHeader/CardHeader.d.ts +42 -0
- package/dist/components/CollapsibleNavBar/CollapsibleNavBar.d.ts +35 -2
- package/dist/components/CollapsibleNavBar/components/NavHeader.d.ts +18 -0
- package/dist/components/CollapsibleNavBar/components/NavPopoverContent.d.ts +12 -0
- package/dist/components/CollapsibleNavBar/components/NavTree.d.ts +22 -0
- package/dist/components/CollapsibleNavBar/components/index.d.ts +3 -3
- package/dist/components/CollapsibleNavBar/navItems.d.ts +57 -0
- package/dist/components/CollapsibleNavBar/styles.d.ts +34 -0
- package/dist/components/CollapsibleNavBar/types.d.ts +40 -3
- package/dist/components/DatePicker/DatePicker.d.ts +57 -0
- package/dist/components/Drawer/DrawerRoot.d.ts +70 -0
- package/dist/components/Dropdown/Dropdown.d.ts +1 -1
- package/dist/components/Dropdown/types.d.ts +31 -1
- package/dist/components/DropdownOption/DropdownOption.d.ts +43 -0
- package/dist/components/Form/Form.d.ts +40 -0
- package/dist/components/Icon/Icon.d.ts +47 -0
- package/dist/components/Icon/icons/Columns.d.ts +3 -0
- package/dist/components/Icon/icons/List.d.ts +3 -0
- package/dist/components/Icon/icons/all.d.ts +2 -0
- package/dist/components/Icon/icons/iconsList.d.ts +1 -1
- package/dist/components/Icon/types.d.ts +13 -0
- package/dist/components/Input/Input.d.ts +94 -0
- package/dist/components/MultipleDropdown/MultipleDropdown.d.ts +73 -0
- package/dist/components/MultipleDropdown/types.d.ts +14 -0
- package/dist/components/NestedTable/WithNestedTableRow.d.ts +39 -0
- package/dist/components/NestedTable/components/NestedTable.d.ts +57 -0
- package/dist/components/NestedTable/components/NestedTableCell.d.ts +33 -0
- package/dist/components/NestedTable/components/NestedTableRow.d.ts +44 -0
- package/dist/components/NestedTable/types.d.ts +17 -0
- package/dist/components/TableRow/TableRow.d.ts +51 -0
- package/dist/components/Tooltip/Tooltip.d.ts +10 -6
- package/dist/components/Tooltip/types.d.ts +20 -7
- package/dist/components/TooltipContent/TooltipContent.d.ts +7 -3
- package/dist/components/TreeView/TreeView.d.ts +62 -0
- package/dist/components/TreeView/TreeViewItem.d.ts +32 -0
- package/dist/components/TreeView/index.d.ts +2 -0
- package/dist/components/TreeView/styles.d.ts +18 -0
- package/dist/components/TreeView/types.d.ts +162 -0
- package/dist/components/TreeView/useTreeViewState.d.ts +21 -0
- package/dist/components/TreeView/utils.d.ts +42 -0
- package/dist/components/Wrapper/Wrapper.d.ts +6 -6
- package/dist/components/index.d.ts +1 -0
- package/dist/index.js +2389 -679
- package/dist/index.mjs +2390 -681
- package/dist/tsbuildcache +1 -1
- package/package.json +4 -4
- package/dist/components/CollapsibleNavBar/components/ItemWithSubmenu/AccordionContent.d.ts +0 -11
- package/dist/components/CollapsibleNavBar/components/ItemWithSubmenu/AccordionContentItem.d.ts +0 -8
- package/dist/components/CollapsibleNavBar/components/ItemWithSubmenu/CollapsibleNavBarItem.d.ts +0 -6
- package/dist/components/CollapsibleNavBar/components/ItemWithSubmenu/ItemAccordionTitle.d.ts +0 -9
- package/dist/components/CollapsibleNavBar/components/ItemWithSubmenu/ItemWithSubMenu.d.ts +0 -7
- package/dist/components/CollapsibleNavBar/components/ItemWithSubmenu/index.d.ts +0 -5
- package/dist/components/CollapsibleNavBar/components/ItemWithSubmenu/styles.d.ts +0 -6
- package/dist/components/CollapsibleNavBar/components/ItemWithoutSubmenu/ItemWithoutSubMenu.d.ts +0 -5
- package/dist/components/CollapsibleNavBar/components/ItemWithoutSubmenu/index.d.ts +0 -1
- package/dist/components/CollapsibleNavBar/components/NavBarItem.d.ts +0 -8
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { CSSObject, Interpolation, Theme } from '@emotion/react';
|
|
2
|
+
import { MapIconsType } from '../Icon/types';
|
|
3
|
+
/**
|
|
4
|
+
* Fields shared by every node, at any level.
|
|
5
|
+
*
|
|
6
|
+
* `TMeta` is the consumer's own payload — a route path for navigation, a file
|
|
7
|
+
* size and mime type for a file tree. It travels untouched to `renderItem`,
|
|
8
|
+
* which is what keeps `TreeView` free of any domain knowledge.
|
|
9
|
+
*/
|
|
10
|
+
export interface TreeItemBase<TMeta = unknown> {
|
|
11
|
+
/**
|
|
12
|
+
* Stable identity. Expansion and selection are both expressed as arrays of
|
|
13
|
+
* these, so an id that changes between renders will drop the node's state.
|
|
14
|
+
*/
|
|
15
|
+
id: string;
|
|
16
|
+
label: React.ReactNode;
|
|
17
|
+
/** Kit icon rendered before the label. Ignored when `icon` is set. */
|
|
18
|
+
iconName?: keyof MapIconsType;
|
|
19
|
+
/** Arbitrary icon element, for glyphs the kit doesn't ship. Wins over `iconName`. */
|
|
20
|
+
icon?: React.ReactNode;
|
|
21
|
+
/** Blocks selection, expansion and keyboard focus, and dims the row. */
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
/** Styles for this row only, merged after the theme defaults. */
|
|
24
|
+
css?: CSSObject;
|
|
25
|
+
meta?: TMeta;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* A third-level node. `items?: never` is what caps the tree at three levels:
|
|
29
|
+
* a fourth is a type error at the call site rather than a runtime surprise.
|
|
30
|
+
*/
|
|
31
|
+
export interface TreeItemLevel3<TMeta = unknown> extends TreeItemBase<TMeta> {
|
|
32
|
+
items?: never;
|
|
33
|
+
}
|
|
34
|
+
/** A second-level node. Its children are the deepest the tree allows. */
|
|
35
|
+
export interface TreeItemLevel2<TMeta = unknown> extends TreeItemBase<TMeta> {
|
|
36
|
+
items?: TreeItemLevel3<TMeta>[];
|
|
37
|
+
}
|
|
38
|
+
/** A top-level node. `items` is optional, so a flat one-level list is valid. */
|
|
39
|
+
export interface TreeItem<TMeta = unknown> extends TreeItemBase<TMeta> {
|
|
40
|
+
items?: TreeItemLevel2<TMeta>[];
|
|
41
|
+
}
|
|
42
|
+
/** Any node, whatever its depth — what `renderItem` and the callbacks receive. */
|
|
43
|
+
export type AnyTreeItem<TMeta = unknown> = TreeItem<TMeta> | TreeItemLevel2<TMeta> | TreeItemLevel3<TMeta>;
|
|
44
|
+
/** A node's depth, 1-based. Three is the maximum the tree accepts. */
|
|
45
|
+
export type TreeLevel = 1 | 2 | 3;
|
|
46
|
+
/**
|
|
47
|
+
* Everything a custom row needs to render itself and stay in sync.
|
|
48
|
+
*
|
|
49
|
+
* Spread `itemProps` on whatever element you make interactive (a `NavLink`, a
|
|
50
|
+
* `button`, a `div`) and `toggleProps` on the expand/collapse control. The
|
|
51
|
+
* surrounding `li`, its ARIA and its keyboard handling belong to `TreeView` —
|
|
52
|
+
* a custom row never has to reproduce them.
|
|
53
|
+
*/
|
|
54
|
+
export interface TreeItemRenderProps<TMeta = unknown> {
|
|
55
|
+
item: AnyTreeItem<TMeta>;
|
|
56
|
+
level: TreeLevel;
|
|
57
|
+
/** Position among siblings, zero-based. */
|
|
58
|
+
index: number;
|
|
59
|
+
isSelected: boolean;
|
|
60
|
+
isExpanded: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* True when the node is an ancestor of a selected node. The design keeps
|
|
63
|
+
* levels 1 and 2 emphasised while the selected level 3 row is blue, and this
|
|
64
|
+
* is the flag that drives it.
|
|
65
|
+
*/
|
|
66
|
+
isInSelectedPath: boolean;
|
|
67
|
+
hasItems: boolean;
|
|
68
|
+
isDisabled: boolean;
|
|
69
|
+
/** Selects the node, honouring `selectionMode`. No-op when disabled. */
|
|
70
|
+
select: () => void;
|
|
71
|
+
/** Expands or collapses the node, honouring `expandMode`. No-op without children. */
|
|
72
|
+
toggle: () => void;
|
|
73
|
+
/** Spread on the interactive row element. */
|
|
74
|
+
itemProps: React.HTMLAttributes<HTMLElement>;
|
|
75
|
+
/** Spread on the expand/collapse control. Empty object when `hasItems` is false. */
|
|
76
|
+
toggleProps: React.ButtonHTMLAttributes<HTMLButtonElement>;
|
|
77
|
+
/** The node's icon, already built and themed — `null` when it has none. */
|
|
78
|
+
icon: React.ReactNode;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Props for {@link TreeView}. `TMeta` is the payload carried on each node and
|
|
82
|
+
* handed back to `renderItem` and the selection callback.
|
|
83
|
+
*/
|
|
84
|
+
export interface TreeViewProps<TMeta = unknown> {
|
|
85
|
+
/**
|
|
86
|
+
* The tree. Three levels deep at most — the fourth is rejected by the type,
|
|
87
|
+
* and `items` is optional at every level, so a one-level list is valid.
|
|
88
|
+
*/
|
|
89
|
+
items: TreeItem<TMeta>[];
|
|
90
|
+
/** Ids of expanded nodes. Pass to control expansion yourself. */
|
|
91
|
+
expandedIds?: string[];
|
|
92
|
+
/** Ids expanded on mount, when expansion is uncontrolled. */
|
|
93
|
+
defaultExpandedIds?: string[];
|
|
94
|
+
onExpandedIdsChange?: (ids: string[]) => void;
|
|
95
|
+
/**
|
|
96
|
+
* `single` collapses siblings when a node expands, accordion-style.
|
|
97
|
+
* @default 'multiple'
|
|
98
|
+
*/
|
|
99
|
+
expandMode?: 'multiple' | 'single';
|
|
100
|
+
/**
|
|
101
|
+
* Ids of selected nodes. Always an array, even in `single` mode — which is
|
|
102
|
+
* what lets a consumer move to multi-select later without an API change.
|
|
103
|
+
*/
|
|
104
|
+
selectedIds?: string[];
|
|
105
|
+
defaultSelectedIds?: string[];
|
|
106
|
+
/** Receives the full next selection, plus the node that was acted on. */
|
|
107
|
+
onSelectedIdsChange?: (ids: string[], item: AnyTreeItem<TMeta>) => void;
|
|
108
|
+
/**
|
|
109
|
+
* `single` replaces the selection on click, `multiple` toggles membership.
|
|
110
|
+
* @default 'single'
|
|
111
|
+
*/
|
|
112
|
+
selectionMode?: 'single' | 'multiple';
|
|
113
|
+
/** Replaces the row's interior. The `li`, ARIA and keyboard stay with `TreeView`. */
|
|
114
|
+
renderItem?: (props: TreeItemRenderProps<TMeta>) => React.ReactNode;
|
|
115
|
+
/**
|
|
116
|
+
* Colour set. `dark` is for sidebars such as `CollapsibleNavBar`'s default theme.
|
|
117
|
+
* @default 'light'
|
|
118
|
+
*/
|
|
119
|
+
theme?: 'light' | 'dark';
|
|
120
|
+
/**
|
|
121
|
+
* Overrides the selected row's colour (and the chevron and icon on it), for
|
|
122
|
+
* a consumer whose accent isn't the theme's own. Everything else — rest,
|
|
123
|
+
* hover, the engaged path — still comes from `theme`.
|
|
124
|
+
*/
|
|
125
|
+
activeColor?: string;
|
|
126
|
+
/**
|
|
127
|
+
* `tree` gives a real `role="tree"` with roving focus and arrow-key
|
|
128
|
+
* navigation — right for a file tree. `list` gives nested `ul`/`li` with
|
|
129
|
+
* disclosure buttons, which is the correct pattern for a navigation menu of
|
|
130
|
+
* links and leaves focus order to the browser.
|
|
131
|
+
* @default 'tree'
|
|
132
|
+
*/
|
|
133
|
+
semantics?: 'tree' | 'list';
|
|
134
|
+
/**
|
|
135
|
+
* Whether clicking anywhere on a parent row toggles it, rather than only the
|
|
136
|
+
* chevron.
|
|
137
|
+
* @default true
|
|
138
|
+
*/
|
|
139
|
+
toggleOnItemClick?: boolean;
|
|
140
|
+
/**
|
|
141
|
+
* Expand the ancestors of selected nodes, on mount and whenever the
|
|
142
|
+
* selection moves. Ignored while expansion is controlled.
|
|
143
|
+
* @default true
|
|
144
|
+
*/
|
|
145
|
+
autoExpandSelected?: boolean;
|
|
146
|
+
/**
|
|
147
|
+
* Keep the icon column even on rows without an icon, so labels stay aligned
|
|
148
|
+
* with their icon-bearing siblings. Off by default: a tree whose rows have
|
|
149
|
+
* no icons at all would otherwise carry an empty column.
|
|
150
|
+
* @default false
|
|
151
|
+
*/
|
|
152
|
+
reserveIconSpace?: boolean;
|
|
153
|
+
/**
|
|
154
|
+
* Left offset per level, in px. Defaults to the design's 0 / 24 / 40; a
|
|
155
|
+
* number here makes the steps linear instead (`(level - 1) * indent`).
|
|
156
|
+
*/
|
|
157
|
+
indent?: number;
|
|
158
|
+
/** Accessible name for the tree. */
|
|
159
|
+
'aria-label'?: string;
|
|
160
|
+
className?: string;
|
|
161
|
+
css?: Interpolation<Theme>;
|
|
162
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { AnyTreeItem, TreeViewProps } from './types';
|
|
2
|
+
import { TreeIndex } from './utils';
|
|
3
|
+
export interface UseTreeViewStateOptions<TMeta> extends Pick<TreeViewProps<TMeta>, 'expandedIds' | 'defaultExpandedIds' | 'onExpandedIdsChange' | 'expandMode' | 'selectedIds' | 'defaultSelectedIds' | 'onSelectedIdsChange' | 'selectionMode' | 'autoExpandSelected'> {
|
|
4
|
+
index: TreeIndex<TMeta>;
|
|
5
|
+
/** Presence of the prop, not its value — see `useControllableState`. */
|
|
6
|
+
isExpansionControlled: boolean;
|
|
7
|
+
isSelectionControlled: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Expansion and selection for `TreeView`, both controllable through the kit's
|
|
11
|
+
* `value` / `defaultValue` / `onChange` trio.
|
|
12
|
+
*/
|
|
13
|
+
export declare const useTreeViewState: <TMeta>({ index, isExpansionControlled, expandedIds, defaultExpandedIds, onExpandedIdsChange, expandMode, isSelectionControlled, selectedIds, defaultSelectedIds, onSelectedIdsChange, selectionMode, autoExpandSelected, }: UseTreeViewStateOptions<TMeta>) => {
|
|
14
|
+
expanded: string[];
|
|
15
|
+
expandedSet: Set<string>;
|
|
16
|
+
selectedSet: Set<string>;
|
|
17
|
+
selectedPath: Set<string>;
|
|
18
|
+
setExpanded: (next: string[]) => void;
|
|
19
|
+
toggle: (id: string) => void;
|
|
20
|
+
select: (item: AnyTreeItem<TMeta>) => void;
|
|
21
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { AnyTreeItem, TreeItem, TreeLevel } from './types';
|
|
2
|
+
export interface TreeIndexEntry<TMeta> {
|
|
3
|
+
item: AnyTreeItem<TMeta>;
|
|
4
|
+
level: TreeLevel;
|
|
5
|
+
parentId: string | null;
|
|
6
|
+
childIds: string[];
|
|
7
|
+
}
|
|
8
|
+
export interface TreeIndex<TMeta> {
|
|
9
|
+
byId: Map<string, TreeIndexEntry<TMeta>>;
|
|
10
|
+
/** Top-level ids, in order. */
|
|
11
|
+
rootIds: string[];
|
|
12
|
+
}
|
|
13
|
+
/** Left offsets per level, taken from the design (Level 1 / 2 / 3). */
|
|
14
|
+
export declare const LEVEL_INDENT: Record<TreeLevel, number>;
|
|
15
|
+
export declare const getIndent: (level: TreeLevel, indent?: number) => number;
|
|
16
|
+
/**
|
|
17
|
+
* Flattens the tree into an id-keyed map once per `items` change, so that
|
|
18
|
+
* ancestor lookups, sibling collapsing and keyboard navigation are all O(1)
|
|
19
|
+
* rather than repeated walks.
|
|
20
|
+
*/
|
|
21
|
+
export declare const buildTreeIndex: <TMeta>(items: TreeItem<TMeta>[]) => TreeIndex<TMeta>;
|
|
22
|
+
/** Ids of every ancestor of `id`, nearest first. Unknown ids yield `[]`. */
|
|
23
|
+
export declare const getAncestorIds: <TMeta>(index: TreeIndex<TMeta>, id: string) => string[];
|
|
24
|
+
/**
|
|
25
|
+
* Ids that should be emphasised as "on the way to" the selection — every
|
|
26
|
+
* ancestor of every selected node.
|
|
27
|
+
*/
|
|
28
|
+
export declare const getSelectedPathIds: <TMeta>(index: TreeIndex<TMeta>, selectedIds: string[]) => Set<string>;
|
|
29
|
+
/**
|
|
30
|
+
* The ids a user can currently move focus to: every node whose ancestors are
|
|
31
|
+
* all expanded, in render order, skipping disabled rows.
|
|
32
|
+
*/
|
|
33
|
+
export declare const getVisibleIds: <TMeta>(index: TreeIndex<TMeta>, expandedIds: string[]) => string[];
|
|
34
|
+
/**
|
|
35
|
+
* Union of two id lists, order-preserving and duplicate-free.
|
|
36
|
+
*
|
|
37
|
+
* Returns `current` untouched when it already covers `added`, so a caller can
|
|
38
|
+
* use the identity of the result to decide whether anything changed. The check
|
|
39
|
+
* is membership, not size: `current` may itself carry duplicates, and
|
|
40
|
+
* comparing a deduped Set against its raw length would then hide the merge.
|
|
41
|
+
*/
|
|
42
|
+
export declare const mergeIds: (current: string[], added: string[]) => string[];
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { CommonProps } from '../../types/emotion';
|
|
2
|
+
/** Flex container direction (maps to CSS flex-direction) */
|
|
3
|
+
export type WrapperDirection = 'row' | 'row-reverse' | 'column' | 'column-reverse';
|
|
4
|
+
/** Cross-axis alignment (maps to CSS align-items) */
|
|
5
|
+
export type WrapperAlignItems = 'flex-start' | 'center' | 'flex-end' | 'stretch' | 'baseline' | 'start' | 'end' | 'self-start' | 'self-end' | 'normal';
|
|
6
|
+
/** Main-axis alignment (maps to CSS justify-content) */
|
|
7
|
+
export type WrapperJustifyContent = 'flex-start' | 'flex-end' | 'center' | 'space-between' | 'space-around' | 'space-evenly' | 'start' | 'end' | 'left' | 'right' | 'normal';
|
|
2
8
|
/**
|
|
3
9
|
* Wrapper - Flexible flexbox container component
|
|
4
10
|
*
|
|
@@ -49,12 +55,6 @@ import { CommonProps } from '../../types/emotion';
|
|
|
49
55
|
* </Wrapper>
|
|
50
56
|
* ```
|
|
51
57
|
*/
|
|
52
|
-
/** Flex container direction (maps to CSS flex-direction) */
|
|
53
|
-
export type WrapperDirection = 'row' | 'row-reverse' | 'column' | 'column-reverse';
|
|
54
|
-
/** Cross-axis alignment (maps to CSS align-items) */
|
|
55
|
-
export type WrapperAlignItems = 'flex-start' | 'center' | 'flex-end' | 'stretch' | 'baseline' | 'start' | 'end' | 'self-start' | 'self-end' | 'normal';
|
|
56
|
-
/** Main-axis alignment (maps to CSS justify-content) */
|
|
57
|
-
export type WrapperJustifyContent = 'flex-start' | 'flex-end' | 'center' | 'space-between' | 'space-around' | 'space-evenly' | 'start' | 'end' | 'left' | 'right' | 'normal';
|
|
58
58
|
declare const Wrapper: import("@emotion/styled").StyledComponent<{
|
|
59
59
|
theme?: import("@emotion/react").Theme;
|
|
60
60
|
as?: React.ElementType;
|
|
@@ -107,6 +107,7 @@ export type * from './ResponsiveImage/types';
|
|
|
107
107
|
export { default as NavBar } from './NavBar';
|
|
108
108
|
export * from './NavBar';
|
|
109
109
|
export * from './CollapsibleNavBar';
|
|
110
|
+
export * from './TreeView';
|
|
110
111
|
export { default as Tab } from './Tab';
|
|
111
112
|
export { default as TabBar } from './TabBar';
|
|
112
113
|
export * from './TabBar';
|