@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
|
@@ -84,6 +84,20 @@ export type DropdownProps<P extends DropdownOptionProps> = {
|
|
|
84
84
|
* @default 200
|
|
85
85
|
*/
|
|
86
86
|
maxHeight?: number;
|
|
87
|
+
/**
|
|
88
|
+
* Width of the dropdown.
|
|
89
|
+
* Can be a number (pixels) or a string (any CSS value, e.g. `'100%'`).
|
|
90
|
+
*
|
|
91
|
+
* The value is applied to the positioning base; the toggle button is
|
|
92
|
+
* stretched to fill it, so a relative width like `'60%'` resolves against the
|
|
93
|
+
* surrounding container instead of compounding. It also clears the base's
|
|
94
|
+
* default `min-width` and the toggle's `max-width`, which would otherwise cap
|
|
95
|
+
* the value.
|
|
96
|
+
*
|
|
97
|
+
* Has no default: when omitted, the dropdown sizes itself to its content,
|
|
98
|
+
* matching the behaviour of previous versions.
|
|
99
|
+
*/
|
|
100
|
+
width?: string | number;
|
|
87
101
|
};
|
|
88
102
|
/**
|
|
89
103
|
* Context value shared with child DropdownOption components via MultipleDropdownContext
|
|
@@ -1,2 +1,41 @@
|
|
|
1
1
|
import { WithNestedTableRowProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* WithNestedTableRow - Groups rows into one collapsible unit.
|
|
4
|
+
*
|
|
5
|
+
* Wrap a run of `NestedTableRow` children in it. **Position decides role**: the
|
|
6
|
+
* first child becomes the sub-header that carries the toggle, and the rest are
|
|
7
|
+
* the rows it shows and hides. Renders no markup of its own — it only supplies
|
|
8
|
+
* each child with the group's context — so it is safe between `TableBody` and
|
|
9
|
+
* the rows.
|
|
10
|
+
*
|
|
11
|
+
* A group containing a single row has nothing to toggle, so it renders no icon
|
|
12
|
+
* and ignores `defaultCollapsed` — otherwise it could start collapsed with no
|
|
13
|
+
* way to reopen it.
|
|
14
|
+
*
|
|
15
|
+
* @category Components
|
|
16
|
+
* @subcategory Data Display
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* // One group per team; each starts expanded
|
|
21
|
+
* {teams.map((team) => (
|
|
22
|
+
* <WithNestedTableRow key={team.id}>
|
|
23
|
+
* <NestedTableRow>
|
|
24
|
+
* <NestedTableCell>{team.name}</NestedTableCell>
|
|
25
|
+
* </NestedTableRow>
|
|
26
|
+
* {team.members.map((member) => (
|
|
27
|
+
* <NestedTableRow key={member.id}>
|
|
28
|
+
* <NestedTableCell>{member.name}</NestedTableCell>
|
|
29
|
+
* </NestedTableRow>
|
|
30
|
+
* ))}
|
|
31
|
+
* </WithNestedTableRow>
|
|
32
|
+
* ))}
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```tsx
|
|
37
|
+
* // Collapse just this group, whatever the table default is
|
|
38
|
+
* <WithNestedTableRow defaultCollapsed>{rows}</WithNestedTableRow>
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
2
41
|
export declare const WithNestedTableRow: ({ children, defaultCollapsed, }: WithNestedTableRowProps) => import("@emotion/react/jsx-runtime").JSX.Element[] | null | undefined;
|
|
@@ -1,4 +1,61 @@
|
|
|
1
1
|
import { PropsWithChildren, TableHTMLAttributes } from 'react';
|
|
2
2
|
import { CommonProps } from '../../../types/emotion';
|
|
3
3
|
import { NestedTableContextType } from '../types';
|
|
4
|
+
/**
|
|
5
|
+
* NestedTable - Table whose rows collapse into expandable groups.
|
|
6
|
+
*
|
|
7
|
+
* Renders a `Table` and provides the context the nested row components read, so
|
|
8
|
+
* every piece below must live inside it.
|
|
9
|
+
*
|
|
10
|
+
* ### Structure
|
|
11
|
+
* ```
|
|
12
|
+
* NestedTable — provides icons + default collapsed state
|
|
13
|
+
* └── TableBody
|
|
14
|
+
* └── WithNestedTableRow — one collapsible group
|
|
15
|
+
* ├── NestedTableRow — first child: the sub-header that toggles
|
|
16
|
+
* │ └── NestedTableCell
|
|
17
|
+
* └── NestedTableRow — remaining children: the collapsible rows
|
|
18
|
+
* └── NestedTableCell
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* Each `WithNestedTableRow` is one group. Use as many as you need, and give the
|
|
22
|
+
* header row its own `WithNestedTableRow` with `isHeader` on the row.
|
|
23
|
+
*
|
|
24
|
+
* ### Collapsing is CSS, not unmounting
|
|
25
|
+
* Collapsed rows stay in the DOM at zero height with `visibility: hidden`, which
|
|
26
|
+
* is what makes the transition animate. They remain findable by queries and by
|
|
27
|
+
* `Ctrl+F`, so do not rely on collapse to hide sensitive content.
|
|
28
|
+
*
|
|
29
|
+
* @category Components
|
|
30
|
+
* @subcategory Data Display
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```tsx
|
|
34
|
+
* <NestedTable>
|
|
35
|
+
* <TableBody>
|
|
36
|
+
* <WithNestedTableRow>
|
|
37
|
+
* <NestedTableRow>
|
|
38
|
+
* <NestedTableCell>Engineering</NestedTableCell>
|
|
39
|
+
* <NestedTableCell>24</NestedTableCell>
|
|
40
|
+
* </NestedTableRow>
|
|
41
|
+
* <NestedTableRow>
|
|
42
|
+
* <NestedTableCell>Platform</NestedTableCell>
|
|
43
|
+
* <NestedTableCell>9</NestedTableCell>
|
|
44
|
+
* </NestedTableRow>
|
|
45
|
+
* </WithNestedTableRow>
|
|
46
|
+
* </TableBody>
|
|
47
|
+
* </NestedTable>
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```tsx
|
|
52
|
+
* // Start collapsed, with custom toggle icons
|
|
53
|
+
* <NestedTable
|
|
54
|
+
* defaultCollapsed
|
|
55
|
+
* collapsedIconName="carrot-right"
|
|
56
|
+
* expandedIconName="carrot-down">
|
|
57
|
+
* {groups}
|
|
58
|
+
* </NestedTable>
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
4
61
|
export declare const NestedTable: ({ children, collapsedIconName, expandedIconName, defaultCollapsed, ...rest }: PropsWithChildren & NestedTableContextType & CommonProps & TableHTMLAttributes<HTMLTableElement>) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -1,3 +1,36 @@
|
|
|
1
1
|
import { HTMLAttributes } from 'react';
|
|
2
2
|
import { CommonProps } from '../../../types/emotion';
|
|
3
|
+
/**
|
|
4
|
+
* NestedTableCell - Cell for a `NestedTableRow`.
|
|
5
|
+
*
|
|
6
|
+
* Use instead of `TableCell` inside a nested table: it reads the group's
|
|
7
|
+
* collapsed state and animates its own height, which a plain `TableCell` will
|
|
8
|
+
* not do. Must be rendered inside `WithNestedTableRow`.
|
|
9
|
+
*
|
|
10
|
+
* ### Children are wrapped in a div
|
|
11
|
+
* The cell renders its children inside a `Wrapper`, and the collapse transition
|
|
12
|
+
* animates that inner element rather than the `td`. Two consequences: a `& div`
|
|
13
|
+
* selector in your `css` will hit the wrapper, and content that must fill the
|
|
14
|
+
* cell should stretch the wrapper rather than the cell itself.
|
|
15
|
+
*
|
|
16
|
+
* Borders and background are cleared so the group reads as one block; the row
|
|
17
|
+
* supplies the shading.
|
|
18
|
+
*
|
|
19
|
+
* @category Components
|
|
20
|
+
* @subcategory Data Display
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```tsx
|
|
24
|
+
* <NestedTableRow>
|
|
25
|
+
* <NestedTableCell>Platform</NestedTableCell>
|
|
26
|
+
* <NestedTableCell>9</NestedTableCell>
|
|
27
|
+
* </NestedTableRow>
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```tsx
|
|
32
|
+
* // Header cells render as `th`
|
|
33
|
+
* <NestedTableCell as="th">Headcount</NestedTableCell>
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
3
36
|
export declare const NestedTableCell: ({ children, ...props }: React.PropsWithChildren<HTMLAttributes<HTMLTableCellElement>> & CommonProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,48 @@
|
|
|
1
1
|
import { HTMLAttributes } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* NestedTableRow - One row inside a `WithNestedTableRow` group.
|
|
4
|
+
*
|
|
5
|
+
* Must be rendered inside `WithNestedTableRow`; it reads that group's context to
|
|
6
|
+
* know whether it is the sub-header and whether the group is collapsed.
|
|
7
|
+
*
|
|
8
|
+
* ### It prepends a cell for you
|
|
9
|
+
* The row renders a narrow toggle cell **before** your children, so a row with
|
|
10
|
+
* two `NestedTableCell` children occupies **three** columns. Size the header and
|
|
11
|
+
* `colSpan` values accordingly — this is the usual cause of a nested table
|
|
12
|
+
* whose columns look off by one.
|
|
13
|
+
*
|
|
14
|
+
* ### First child in the group is the toggle
|
|
15
|
+
* The first `NestedTableRow` in a `WithNestedTableRow` is the sub-header: it is
|
|
16
|
+
* shaded, its cells are bold, it shows the toggle icon, and clicking anywhere on
|
|
17
|
+
* it collapses or expands the rest of the group. Later rows are the collapsible
|
|
18
|
+
* body. A group holding only one row shows no toggle and never collapses.
|
|
19
|
+
*
|
|
20
|
+
* @category Components
|
|
21
|
+
* @subcategory Data Display
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```tsx
|
|
25
|
+
* <WithNestedTableRow>
|
|
26
|
+
* <NestedTableRow>
|
|
27
|
+
* <NestedTableCell>Engineering</NestedTableCell>
|
|
28
|
+
* </NestedTableRow>
|
|
29
|
+
* <NestedTableRow>
|
|
30
|
+
* <NestedTableCell>Platform</NestedTableCell>
|
|
31
|
+
* </NestedTableRow>
|
|
32
|
+
* </WithNestedTableRow>
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```tsx
|
|
37
|
+
* // Header row: renders the leading cell as an empty `th`
|
|
38
|
+
* <WithNestedTableRow>
|
|
39
|
+
* <NestedTableRow isHeader>
|
|
40
|
+
* <NestedTableCell as="th">Team</NestedTableCell>
|
|
41
|
+
* <NestedTableCell as="th">Headcount</NestedTableCell>
|
|
42
|
+
* </NestedTableRow>
|
|
43
|
+
* </WithNestedTableRow>
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
2
46
|
export declare const NestedTableRow: ({ children, isHeader, ...props }: React.PropsWithChildren<{
|
|
3
47
|
isHeader?: boolean;
|
|
4
48
|
} & HTMLAttributes<HTMLTableRowElement>>) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
import { Dispatch, SetStateAction } from 'react';
|
|
2
2
|
import { IconProps } from '../Icon/types';
|
|
3
3
|
export type NestedTableContextType = {
|
|
4
|
+
/** Toggle icon shown while a group is collapsed. @default 'carrot-up' */
|
|
4
5
|
collapsedIconName?: IconProps['name'];
|
|
6
|
+
/** Toggle icon shown while a group is expanded. @default 'carrot-down' */
|
|
5
7
|
expandedIconName?: IconProps['name'];
|
|
8
|
+
/**
|
|
9
|
+
* Whether groups start collapsed. Applies to every group in the table; a
|
|
10
|
+
* single `WithNestedTableRow` can override it. Groups holding one row ignore
|
|
11
|
+
* it, since they have no toggle to reopen with.
|
|
12
|
+
*
|
|
13
|
+
* @default false
|
|
14
|
+
*/
|
|
6
15
|
defaultCollapsed?: boolean;
|
|
7
16
|
};
|
|
8
17
|
export type NestedTableRowContextType = {
|
|
@@ -12,6 +21,14 @@ export type NestedTableRowContextType = {
|
|
|
12
21
|
setIsCollapsed: Dispatch<SetStateAction<boolean>>;
|
|
13
22
|
};
|
|
14
23
|
export type WithNestedTableRowProps = {
|
|
24
|
+
/**
|
|
25
|
+
* The group's rows. The first element becomes the sub-header that toggles the
|
|
26
|
+
* group; the rest collapse under it.
|
|
27
|
+
*/
|
|
15
28
|
children: React.ReactNode | React.ReactNode[];
|
|
29
|
+
/**
|
|
30
|
+
* Overrides the table-level `defaultCollapsed` for this group only. Ignored
|
|
31
|
+
* when the group holds a single row.
|
|
32
|
+
*/
|
|
16
33
|
defaultCollapsed?: boolean;
|
|
17
34
|
};
|
|
@@ -1,3 +1,54 @@
|
|
|
1
1
|
import { TableRowProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* TableRow - Table row component for table data
|
|
4
|
+
*
|
|
5
|
+
* A styled tr element that represents a single row in a table. Used within
|
|
6
|
+
* TableHead or TableBody sections. Supports disabled state for non-interactive
|
|
7
|
+
* rows. Works with TableCell or TableCellHeader components.
|
|
8
|
+
*
|
|
9
|
+
* @category Components
|
|
10
|
+
* @subcategory Data Display
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* // Basic table row in body
|
|
15
|
+
* <TableBody>
|
|
16
|
+
* <TableRow>
|
|
17
|
+
* <TableCell>John Doe</TableCell>
|
|
18
|
+
* <TableCell>john@example.com</TableCell>
|
|
19
|
+
* <TableCell>Admin</TableCell>
|
|
20
|
+
* </TableRow>
|
|
21
|
+
* </TableBody>
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```tsx
|
|
26
|
+
* // Table row with click handler
|
|
27
|
+
* <TableRow onClick={() => handleRowClick(item)}>
|
|
28
|
+
* <TableCell>{item.name}</TableCell>
|
|
29
|
+
* <TableCell>{item.email}</TableCell>
|
|
30
|
+
* </TableRow>
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```tsx
|
|
35
|
+
* // Disabled table row (aria-disabled is automatically set)
|
|
36
|
+
* <TableRow disabled>
|
|
37
|
+
* <TableCell>Disabled Row</TableCell>
|
|
38
|
+
* </TableRow>
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* @see {@link Table} - Parent table component
|
|
42
|
+
* @see {@link TableHead} - Header section (use TableCellHeader in rows)
|
|
43
|
+
* @see {@link TableBody} - Body section (use TableCell in rows)
|
|
44
|
+
* @see {@link TableCell} - Data cell component
|
|
45
|
+
* @see {@link TableCellHeader} - Header cell component
|
|
46
|
+
*
|
|
47
|
+
* @accessibility
|
|
48
|
+
* - Semantic HTML tr element
|
|
49
|
+
* - Automatically sets aria-disabled when disabled is true
|
|
50
|
+
* - Keyboard accessible when clickable
|
|
51
|
+
* - Proper table structure for screen readers
|
|
52
|
+
*/
|
|
2
53
|
declare const TableRow: import("react").ForwardRefExoticComponent<TableRowProps & import("react").RefAttributes<HTMLTableRowElement>>;
|
|
3
54
|
export default TableRow;
|
|
@@ -11,13 +11,17 @@ import { TooltipProps } from './types';
|
|
|
11
11
|
* positioning with auto-adjustment, and customizable appearance with size
|
|
12
12
|
* variants and optional arrows.
|
|
13
13
|
*
|
|
14
|
+
* Note that the tooltip opens on **click** by default. For the usual hover
|
|
15
|
+
* behaviour pass `enableHover enableClick={false}`, as every example below and
|
|
16
|
+
* every call site in the kit does.
|
|
17
|
+
*
|
|
14
18
|
* @category Components
|
|
15
19
|
* @subcategory Overlay
|
|
16
20
|
*
|
|
17
21
|
* @example
|
|
18
22
|
* ```tsx
|
|
19
23
|
* // Basic tooltip on hover
|
|
20
|
-
* <Tooltip>
|
|
24
|
+
* <Tooltip enableHover enableClick={false}>
|
|
21
25
|
* <TooltipTrigger>
|
|
22
26
|
* <Button>Hover me</Button>
|
|
23
27
|
* </TooltipTrigger>
|
|
@@ -28,7 +32,7 @@ import { TooltipProps } from './types';
|
|
|
28
32
|
* @example
|
|
29
33
|
* ```tsx
|
|
30
34
|
* // Tooltip with custom placement
|
|
31
|
-
* <Tooltip placement="bottom" size="large">
|
|
35
|
+
* <Tooltip enableHover enableClick={false} placement="bottom" size="large">
|
|
32
36
|
* <TooltipTrigger>
|
|
33
37
|
* <Icon name="info" />
|
|
34
38
|
* </TooltipTrigger>
|
|
@@ -43,8 +47,8 @@ import { TooltipProps } from './types';
|
|
|
43
47
|
*
|
|
44
48
|
* @example
|
|
45
49
|
* ```tsx
|
|
46
|
-
* // Click-to-open tooltip
|
|
47
|
-
* <Tooltip
|
|
50
|
+
* // Click-to-open tooltip — this is the default interaction
|
|
51
|
+
* <Tooltip>
|
|
48
52
|
* <TooltipTrigger>
|
|
49
53
|
* <Button>Click for info</Button>
|
|
50
54
|
* </TooltipTrigger>
|
|
@@ -55,7 +59,7 @@ import { TooltipProps } from './types';
|
|
|
55
59
|
* @example
|
|
56
60
|
* ```tsx
|
|
57
61
|
* // Dark surface, no shadow
|
|
58
|
-
* <Tooltip color="dark" hasShadow={false}>
|
|
62
|
+
* <Tooltip enableHover enableClick={false} color="dark" hasShadow={false}>
|
|
59
63
|
* <TooltipTrigger>
|
|
60
64
|
* <Button>Hover me</Button>
|
|
61
65
|
* </TooltipTrigger>
|
|
@@ -68,7 +72,7 @@ import { TooltipProps } from './types';
|
|
|
68
72
|
* @example
|
|
69
73
|
* ```tsx
|
|
70
74
|
* // Tooltip without arrow
|
|
71
|
-
* <Tooltip hasArrow={false}>
|
|
75
|
+
* <Tooltip enableHover enableClick={false} hasArrow={false}>
|
|
72
76
|
* <TooltipTrigger>
|
|
73
77
|
* <span>?</span>
|
|
74
78
|
* </TooltipTrigger>
|
|
@@ -30,7 +30,7 @@ export type TooltipColor = FloatingSurfaceColor;
|
|
|
30
30
|
*
|
|
31
31
|
* @example
|
|
32
32
|
* ```tsx
|
|
33
|
-
* <Tooltip placement="top">
|
|
33
|
+
* <Tooltip enableHover enableClick={false} placement="top">
|
|
34
34
|
* <TooltipTrigger>
|
|
35
35
|
* <Button>Hover me</Button>
|
|
36
36
|
* </TooltipTrigger>
|
|
@@ -50,13 +50,22 @@ export interface TooltipProps extends CommonProps {
|
|
|
50
50
|
*/
|
|
51
51
|
placement?: Placement;
|
|
52
52
|
/**
|
|
53
|
-
* Enable tooltip on hover interaction
|
|
54
|
-
*
|
|
53
|
+
* Enable tooltip on hover interaction.
|
|
54
|
+
*
|
|
55
|
+
* Off by default — despite the component's name, the tooltip opens on click
|
|
56
|
+
* unless this is set. Pass `enableHover enableClick={false}` for the usual
|
|
57
|
+
* hover-only behaviour; every call site in the kit does.
|
|
58
|
+
*
|
|
59
|
+
* @default false
|
|
55
60
|
*/
|
|
56
61
|
enableHover?: boolean;
|
|
57
62
|
/**
|
|
58
|
-
* Enable tooltip on click interaction
|
|
59
|
-
*
|
|
63
|
+
* Enable tooltip on click interaction.
|
|
64
|
+
*
|
|
65
|
+
* On by default. Set it to `false` alongside `enableHover` when a click on
|
|
66
|
+
* the trigger has to do something else, such as selecting an item.
|
|
67
|
+
*
|
|
68
|
+
* @default true
|
|
60
69
|
*/
|
|
61
70
|
enableClick?: boolean;
|
|
62
71
|
/**
|
|
@@ -89,8 +98,12 @@ export interface TooltipProps extends CommonProps {
|
|
|
89
98
|
*/
|
|
90
99
|
hoverCloseDelay?: number;
|
|
91
100
|
/**
|
|
92
|
-
* Size variant of the tooltip content
|
|
93
|
-
*
|
|
101
|
+
* Size variant of the tooltip content.
|
|
102
|
+
*
|
|
103
|
+
* Note that `small` is 8px type — intended for dense chart labels rather
|
|
104
|
+
* than prose. Use `medium` (12px) or `large` (14px) for readable text.
|
|
105
|
+
*
|
|
106
|
+
* @default 'small'
|
|
94
107
|
*/
|
|
95
108
|
size?: TooltipSize;
|
|
96
109
|
/**
|
|
@@ -3,9 +3,13 @@ import { TooltipContentProps } from '../Tooltip/types';
|
|
|
3
3
|
* TooltipContent - Content container for tooltip display
|
|
4
4
|
*
|
|
5
5
|
* Renders the actual tooltip content that appears when the trigger is activated.
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* Automatically positions based on Floating UI context and respects size
|
|
7
|
+
* variants and arrow configuration. Uses FloatingFocusManager for keyboard
|
|
8
|
+
* accessibility.
|
|
9
|
+
*
|
|
10
|
+
* Renders in a Floating Portal to escape any ancestor's `overflow` clipping.
|
|
11
|
+
* Note that the portal by itself does not lift the tooltip above positioned
|
|
12
|
+
* siblings -- the surface carries its own z-index for that.
|
|
9
13
|
*
|
|
10
14
|
* Only renders when tooltip is open (isOpen is true). Supports custom styling
|
|
11
15
|
* and can contain any React content.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { TreeViewProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* TreeView — a nestable list of rows, up to three levels deep.
|
|
4
|
+
*
|
|
5
|
+
* Domain-free by design: it knows about expansion, selection, indentation and
|
|
6
|
+
* keyboard navigation, and nothing about routing or files. Give it `items`,
|
|
7
|
+
* and hand it a `renderItem` when the row needs to be something other than a
|
|
8
|
+
* plain label — a `NavLink`, a row with a size column, a checkbox.
|
|
9
|
+
*
|
|
10
|
+
* The fourth level is a **type error**, not a runtime check: `items` is typed
|
|
11
|
+
* one level at a time, so an over-deep tree fails at the call site.
|
|
12
|
+
*
|
|
13
|
+
* Expansion and selection both follow the kit's controllable pattern
|
|
14
|
+
* (`expandedIds` / `defaultExpandedIds` / `onExpandedIdsChange`, and the same
|
|
15
|
+
* trio for selection). Selection is always an array, even in the default
|
|
16
|
+
* `single` mode, so moving to multi-select later costs nothing.
|
|
17
|
+
*
|
|
18
|
+
* ## Styling
|
|
19
|
+
*
|
|
20
|
+
* Every part carries a stable class — `ssa-tree`, `ssa-tree__group`,
|
|
21
|
+
* `ssa-tree__item` (plus `--level-1|2|3`, `--selected`, `--expanded`),
|
|
22
|
+
* `ssa-tree__row`, `ssa-tree__icon`, `ssa-tree__label`, `ssa-tree__toggle`.
|
|
23
|
+
* Target those from the `css` prop rather than the DOM shape; a single node
|
|
24
|
+
* can also carry its own `css`.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```tsx
|
|
28
|
+
* <TreeView
|
|
29
|
+
* items={[
|
|
30
|
+
* {
|
|
31
|
+
* id: 'education',
|
|
32
|
+
* label: 'Education',
|
|
33
|
+
* iconName: 'education',
|
|
34
|
+
* items: [
|
|
35
|
+
* { id: 'courses', label: 'Courses' },
|
|
36
|
+
* { id: 'exams', label: 'Exams' },
|
|
37
|
+
* ],
|
|
38
|
+
* },
|
|
39
|
+
* { id: 'employee', label: 'Employee', iconName: 'user' },
|
|
40
|
+
* ]}
|
|
41
|
+
* defaultSelectedIds={['exams']}
|
|
42
|
+
* onSelectedIdsChange={(ids) => console.log(ids)}
|
|
43
|
+
* />
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* @example Routing rows, with selection owned by the router
|
|
47
|
+
* ```tsx
|
|
48
|
+
* <TreeView
|
|
49
|
+
* items={items}
|
|
50
|
+
* semantics="list"
|
|
51
|
+
* selectedIds={[currentRouteId]}
|
|
52
|
+
* renderItem={({ item, itemProps, icon, hasItems, isExpanded, toggleProps }) => (
|
|
53
|
+
* <NavLink to={item.meta.path} {...itemProps}>
|
|
54
|
+
* {icon}
|
|
55
|
+
* <span>{item.label}</span>
|
|
56
|
+
* {hasItems && <button {...toggleProps}>{isExpanded ? '−' : '+'}</button>}
|
|
57
|
+
* </NavLink>
|
|
58
|
+
* )}
|
|
59
|
+
* />
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
export declare const TreeView: <TMeta>(props: TreeViewProps<TMeta>) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { AnyTreeItem, TreeItemRenderProps, TreeLevel, TreeViewProps } from './types';
|
|
2
|
+
import { TreeIndex } from './utils';
|
|
3
|
+
/**
|
|
4
|
+
* Everything the recursive rows share. Passed down as a prop rather than
|
|
5
|
+
* through React context: the tree is at most three levels deep, so threading
|
|
6
|
+
* it is cheaper than a provider and keeps the data flow readable.
|
|
7
|
+
*/
|
|
8
|
+
export interface TreeItemContext<TMeta> {
|
|
9
|
+
treeId: string;
|
|
10
|
+
index: TreeIndex<TMeta>;
|
|
11
|
+
expandedSet: Set<string>;
|
|
12
|
+
selectedSet: Set<string>;
|
|
13
|
+
selectedPath: Set<string>;
|
|
14
|
+
toggle: (id: string) => void;
|
|
15
|
+
select: (item: AnyTreeItem<TMeta>) => void;
|
|
16
|
+
focusedId: string | null;
|
|
17
|
+
registerItem: (id: string, element: HTMLLIElement | null) => void;
|
|
18
|
+
onItemKeyDown: (event: React.KeyboardEvent, id: string) => void;
|
|
19
|
+
theme: NonNullable<TreeViewProps['theme']>;
|
|
20
|
+
activeColor?: string;
|
|
21
|
+
semantics: NonNullable<TreeViewProps['semantics']>;
|
|
22
|
+
toggleOnItemClick: boolean;
|
|
23
|
+
reserveIconSpace: boolean;
|
|
24
|
+
indent?: number;
|
|
25
|
+
renderItem?: (props: TreeItemRenderProps<TMeta>) => React.ReactNode;
|
|
26
|
+
}
|
|
27
|
+
export declare const TreeViewItem: <TMeta>({ item, level, index: position, context, }: {
|
|
28
|
+
item: AnyTreeItem<TMeta>;
|
|
29
|
+
level: TreeLevel;
|
|
30
|
+
index: number;
|
|
31
|
+
context: TreeItemContext<TMeta>;
|
|
32
|
+
}) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { CSSObject } from '@emotion/react';
|
|
2
|
+
import { TreeLevel, TreeViewProps } from './types';
|
|
3
|
+
type TreeTheme = NonNullable<TreeViewProps['theme']>;
|
|
4
|
+
export declare const ICON_SIZE = 24;
|
|
5
|
+
export declare const TOGGLE_SIZE = 20;
|
|
6
|
+
export declare const root: import("@emotion/react").SerializedStyles;
|
|
7
|
+
export declare const group: import("@emotion/react").SerializedStyles;
|
|
8
|
+
export declare const item: import("@emotion/react").SerializedStyles;
|
|
9
|
+
export declare const row: (navTheme: TreeTheme, level: TreeLevel, indent: number, state: {
|
|
10
|
+
isSelected: boolean;
|
|
11
|
+
isEngaged: boolean;
|
|
12
|
+
isDisabled: boolean;
|
|
13
|
+
activeColor?: string;
|
|
14
|
+
}) => CSSObject;
|
|
15
|
+
export declare const icon: import("@emotion/react").SerializedStyles;
|
|
16
|
+
export declare const label: import("@emotion/react").SerializedStyles;
|
|
17
|
+
export declare const toggle: (isExpanded: boolean) => import("@emotion/react").SerializedStyles;
|
|
18
|
+
export {};
|