@capra/core 1.8.2 → 1.9.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/index.cjs +264 -23
- package/dist/index.d.cts +119 -17
- package/dist/index.d.mts +119 -17
- package/dist/index.mjs +265 -26
- package/dist/style.css +186 -25
- package/docs/core-alert--usage.md +2 -0
- package/docs/core-anchor--usage.md +2 -0
- package/docs/core-autocompletefield--usage.md +2 -0
- package/docs/core-badge--usage.md +2 -0
- package/docs/core-breadcrumbs--usage.md +2 -0
- package/docs/core-button--usage.md +2 -0
- package/docs/core-buttonlink--usage.md +2 -0
- package/docs/core-checkbox--usage.md +2 -0
- package/docs/core-collapse--usage.md +2 -0
- package/docs/core-datepickerfield--usage.md +2 -0
- package/docs/core-daterangepickerfield--usage.md +2 -0
- package/docs/core-divider--usage.md +2 -0
- package/docs/core-emptystate--usage.md +2 -0
- package/docs/core-helpertext--usage.md +2 -0
- package/docs/core-iconbutton--usage.md +2 -0
- package/docs/core-inputrow--usage.md +2 -0
- package/docs/core-label--usage.md +2 -0
- package/docs/core-link--usage.md +2 -0
- package/docs/core-listitem--usage.md +2 -0
- package/docs/core-menu--usage.md +2 -0
- package/docs/core-modal--usage.md +2 -0
- package/docs/core-pagination--usage.md +2 -0
- package/docs/core-pill--usage.md +2 -0
- package/docs/core-radio--usage.md +2 -0
- package/docs/core-radiogroup--usage.md +2 -0
- package/docs/core-radiotile--usage.md +2 -0
- package/docs/core-ribbon--usage.md +2 -0
- package/docs/core-skeleton--usage.md +1 -2
- package/docs/core-skeletongroup--usage.md +0 -1
- package/docs/core-spinner--usage.md +2 -0
- package/docs/core-switch--usage.md +2 -0
- package/docs/core-tabnav--usage.md +2 -0
- package/docs/core-tag--usage.md +2 -0
- package/docs/core-text--usage.md +2 -0
- package/docs/core-textarea--usage.md +2 -0
- package/docs/core-textinput--usage.md +2 -0
- package/docs/core-tooltip--usage.md +2 -0
- package/docs/core-topnav--usage.md +2 -0
- package/docs/core-tree--design.md +31 -0
- package/docs/core-tree--usage.md +102 -0
- package/docs/core-verticalnavigation--usage.md +2 -0
- package/docs/history-changelogs-capra-core--docs.md +23 -0
- package/docs/index.md +2 -0
- package/package.json +7 -7
|
@@ -14,6 +14,8 @@ TextInput component for single-line text entry. Backwards compatible with Ant De
|
|
|
14
14
|
| `leadingSlot` | `React.ReactNode` | No | `--` | Content before the input (e.g. icon). |
|
|
15
15
|
| `size` | `(typeof sizes)[number]` | No | `--` | Size of the input.<br>@default 'md' |
|
|
16
16
|
| `trailingSlot` | `React.ReactNode` | No | `--` | Content after the input (e.g. icon or clear button). |
|
|
17
|
+
| `className` | `never` | No | `--` | Use `FORCE__className` instead. |
|
|
18
|
+
| `style` | `never` | No | `--` | Inline styles are not supported; use component props or `FORCE__className`. |
|
|
17
19
|
| `FORCE__className` | `string` | No | `--` | 🚨 This prop is meant to be an escape hatch. 🚨<br><br>If the desired style cannot be achieved using component props, use this as a last resort. The inner workings of Capra components are implementation details and this escape hatch gives one access to those implementation details. We cannot make any guarantees that styles will applied correctly across version updates. Please use it responsibly.<br><br>Add a CSS class to the component. |
|
|
18
20
|
|
|
19
21
|
Use `layout="vertical"` (default) for label above the field; use `layout="horizontal"` for label on the leading side when space is limited.
|
|
@@ -45,4 +45,6 @@ function MyComponent() {
|
|
|
45
45
|
| `placement` | `(typeof placements)[number]` | No | 'bottom' | The position of the tooltip relative to the trigger element.<br>@default 'bottom' |
|
|
46
46
|
| `isDisabled` | `boolean` | No | false | Whether the tooltip is disabled.<br>@default false |
|
|
47
47
|
| `getContainer` | `() => HTMLElement \| null` | No | `--` | The container to mount the tooltip in.<br>@default document.body<br><br>**Warning**: This is an unsafe feature and may cause accessibility, keyboard navigation, and other issues. Only use if you know what you are doing. |
|
|
48
|
+
| `className` | `never` | No | `--` | Use `FORCE__className` instead. |
|
|
49
|
+
| `style` | `never` | No | `--` | Inline styles are not supported; use component props or `FORCE__className`. |
|
|
48
50
|
| `FORCE__className` | `string` | No | `--` | 🚨 This prop is meant to be an escape hatch. 🚨<br><br>If the desired style cannot be achieved using component props, use this as a last resort. The inner workings of Capra components are implementation details and this escape hatch gives one access to those implementation details. We cannot make any guarantees that styles will applied correctly across version updates. Please use it responsibly.<br><br>Add a CSS class to the component. |
|
|
@@ -2,5 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
| Prop | Type | Required | Default | Description |
|
|
4
4
|
| --- | --- | --- | --- | --- |
|
|
5
|
+
| `className` | `never` | No | `--` | Use `FORCE__className` instead. |
|
|
6
|
+
| `style` | `never` | No | `--` | Inline styles are not supported; use component props or `FORCE__className`. |
|
|
5
7
|
| `FORCE__className` | `string` | No | `--` | 🚨 This prop is meant to be an escape hatch. 🚨<br><br>If the desired style cannot be achieved using component props, use this as a last resort. The inner workings of Capra components are implementation details and this escape hatch gives one access to those implementation details. We cannot make any guarantees that styles will applied correctly across version updates. Please use it responsibly.<br><br>Add a CSS class to the component. |
|
|
6
8
|
| `children` | `React.ReactNode` | No | `--` | `--` |
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Core/Tree - Design
|
|
2
|
+
|
|
3
|
+
A hierarchical tree with cascading multi-select and Capra ListItem row layout.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### Label
|
|
8
|
+
|
|
9
|
+
All tree items are required to have a clear and concise label.
|
|
10
|
+
|
|
11
|
+
### Parent
|
|
12
|
+
|
|
13
|
+
Tree items containing decedents display a chevron to enable the user to show/hide the decedents.
|
|
14
|
+
|
|
15
|
+
### Open
|
|
16
|
+
|
|
17
|
+
When open, a parent Tree item's chevron displays pointing down.
|
|
18
|
+
|
|
19
|
+
### Selectable
|
|
20
|
+
|
|
21
|
+
A tree item can optionally be selectable. When enabled, a checkbox will appear to the left of the label.
|
|
22
|
+
|
|
23
|
+
### Suffix
|
|
24
|
+
|
|
25
|
+
A suffix provides space for information such as item counts.
|
|
26
|
+
|
|
27
|
+
### Trailing Slot
|
|
28
|
+
|
|
29
|
+
A trailing slot can optionally be used to add an icon to the tree item.
|
|
30
|
+
|
|
31
|
+
In Figma the preferred icons for the trailing slot are Git statuses, but other icons can be used if needed.
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# Core/Tree - Usage
|
|
2
|
+
|
|
3
|
+
A hierarchical tree with cascading multi-select and Capra ListItem row layout.
|
|
4
|
+
|
|
5
|
+
## Basic usage
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { Tree, type TreeItemType } from '@capra/core';
|
|
9
|
+
|
|
10
|
+
const items: TreeItemType[] = [
|
|
11
|
+
{
|
|
12
|
+
key: 'logs',
|
|
13
|
+
label: 'Logs',
|
|
14
|
+
children: [
|
|
15
|
+
{ key: 'auth', label: 'Auth' },
|
|
16
|
+
{ key: 'system', label: 'System' },
|
|
17
|
+
],
|
|
18
|
+
},
|
|
19
|
+
];
|
|
20
|
+
|
|
21
|
+
function Example() {
|
|
22
|
+
return <Tree items={items} aria-label="Log sources" defaultExpandedKeys={['logs']} />;
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Props
|
|
27
|
+
|
|
28
|
+
| Prop | Type | Required | Default | Description |
|
|
29
|
+
| --- | --- | --- | --- | --- |
|
|
30
|
+
| `className` | `never` | No | `--` | Use `FORCE__className` instead. |
|
|
31
|
+
| `style` | `never` | No | `--` | Inline styles are not supported; use component props or `FORCE__className`. |
|
|
32
|
+
| `FORCE__className` | `string` | No | `--` | 🚨 This prop is meant to be an escape hatch. 🚨<br><br>If the desired style cannot be achieved using component props, use this as a last resort. The inner workings of Capra components are implementation details and this escape hatch gives one access to those implementation details. We cannot make any guarantees that styles will applied correctly across version updates. Please use it responsibly.<br><br>Add a CSS class to the component. |
|
|
33
|
+
| `aria-label` | `string` | No | `--` | Defines a string value that labels the current element. |
|
|
34
|
+
| `aria-labelledby` | `string` | No | `--` | Identifies the element (or elements) that labels the current element. |
|
|
35
|
+
| `items` | `TreeItemType[]` | Yes | `--` | Items to render in the tree. |
|
|
36
|
+
| `onAction` | `(key: Key) => void` | No | `--` | Handler that is called when a user performs an action on an item. |
|
|
37
|
+
| `defaultExpandedKeys` | `Iterable<Key>` | No | `--` | The initial expanded keys when in uncontrolled mode. |
|
|
38
|
+
| `defaultSelectedKeys` | `Iterable<Key>` | No | `--` | The initial selected keys when in uncontrolled mode. |
|
|
39
|
+
| `expandedKeys` | `Iterable<Key>` | No | `--` | The currently expanded keys when in controlled mode. |
|
|
40
|
+
| `onExpandedChange` | `(keys: Set<Key>) => void` | No | `--` | Handler that is called when the expanded keys change. |
|
|
41
|
+
| `onSelectionChange` | `(keys: Set<Key>) => void` | No | `--` | Callback that is fired when the selection changes. |
|
|
42
|
+
| `selectedKeys` | `Iterable<Key>` | No | `--` | The currently selected keys when in controlled mode. |
|
|
43
|
+
| `selectionMode` | `'none' \| 'multiple'` | No | 'multiple' | The selection mode of the tree.<br>@default 'multiple' |
|
|
44
|
+
|
|
45
|
+
## Selection patterns
|
|
46
|
+
|
|
47
|
+
### Uncontrolled selection
|
|
48
|
+
|
|
49
|
+
Use `defaultSelectedKeys` for simple uncontrolled multi-select. Selecting a parent cascades to all enabled
|
|
50
|
+
descendants, and deselecting the parent removes the whole enabled branch.
|
|
51
|
+
|
|
52
|
+
```tsx
|
|
53
|
+
<Tree items={filesystemItems} aria-label="Remote filesystem" defaultSelectedKeys={['logs']} />
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Controlled selection
|
|
57
|
+
|
|
58
|
+
Use `selectedKeys` with `onSelectionChange` when the selected branch needs to stay in application state. The callback
|
|
59
|
+
receives the normalized key set after cascade rules are applied.
|
|
60
|
+
|
|
61
|
+
```tsx
|
|
62
|
+
const [selectedKeys, setSelectedKeys] = useState<Set<string>>(new Set(['logs']));
|
|
63
|
+
|
|
64
|
+
<Tree
|
|
65
|
+
items={filesystemItems}
|
|
66
|
+
aria-label="Remote filesystem"
|
|
67
|
+
selectedKeys={selectedKeys}
|
|
68
|
+
onSelectionChange={setSelectedKeys}
|
|
69
|
+
/>;
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Disabled items
|
|
73
|
+
|
|
74
|
+
Set `isDisabled` on an item to disable just that row. Disabled items are skipped during cascade selection and cannot
|
|
75
|
+
be toggled directly.
|
|
76
|
+
|
|
77
|
+
```tsx
|
|
78
|
+
const items = [
|
|
79
|
+
{
|
|
80
|
+
key: 'notebooks',
|
|
81
|
+
label: 'Notebooks',
|
|
82
|
+
isDisabled: true,
|
|
83
|
+
},
|
|
84
|
+
];
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Content options
|
|
88
|
+
|
|
89
|
+
### Suffix and trailing slot
|
|
90
|
+
|
|
91
|
+
Use `suffix` for short secondary metadata and `trailingSlot` for decorative affordances.
|
|
92
|
+
|
|
93
|
+
## Accessibility
|
|
94
|
+
|
|
95
|
+
| Key | Function |
|
|
96
|
+
| ---------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
97
|
+
| `Tab`<br />`Shift+Tab` | Moves focus into the tree.<br />- Focus is given to the last Tree \| Item to have focus.<br />- If no selection and no previous item had focus, focus is given to first item.<br />- If select and no previous item had focus, focus is given to first selected item. |
|
|
98
|
+
| `Right Arrow` | - When on a closed parent item, open the node; focus does not move.<br />- When on an open item, or item with no children, does nothing. |
|
|
99
|
+
| `Left Arrow` | - When on an open parent item, closes the item; focus does not move.<br />- When on a closed item, or item with no children, does nothing. |
|
|
100
|
+
| `Up Arrow`<br />`Down Arrow` | Moves focus to the next/previous visible item, without opening or closing a node. |
|
|
101
|
+
| `Enter` | Triggers the default action.<br />- If selection is available, selects the currently focused item.<br />- If no selection is available, open/close the currently focused item. |
|
|
102
|
+
| `Space` | Selects the currently focused item. |
|
|
@@ -6,6 +6,8 @@ Vertical navigation shell with controlled and uncontrolled collapse support. Pro
|
|
|
6
6
|
|
|
7
7
|
| Prop | Type | Required | Default | Description |
|
|
8
8
|
| --- | --- | --- | --- | --- |
|
|
9
|
+
| `className` | `never` | No | `--` | Use `FORCE__className` instead. |
|
|
10
|
+
| `style` | `never` | No | `--` | Inline styles are not supported; use component props or `FORCE__className`. |
|
|
9
11
|
| `FORCE__className` | `string` | No | `--` | 🚨 This prop is meant to be an escape hatch. 🚨<br><br>If the desired style cannot be achieved using component props, use this as a last resort. The inner workings of Capra components are implementation details and this escape hatch gives one access to those implementation details. We cannot make any guarantees that styles will applied correctly across version updates. Please use it responsibly.<br><br>Add a CSS class to the component. |
|
|
10
12
|
| `collapsed` | `boolean` | No | `--` | Controlled collapsed state. |
|
|
11
13
|
| `onCollapseChange` | `(collapsed: boolean) => void` | No | `--` | Callback fired when the collapsed state changes. |
|
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# History/Changelogs/@capra-core
|
|
2
2
|
|
|
3
|
+
### 1.9.0
|
|
4
|
+
|
|
5
|
+
#### Minor Changes
|
|
6
|
+
|
|
7
|
+
* [1cbe432](https://bitbucket.org/cribl/capra-ui/commits/1cbe432): Update intrarepo depedency ranges to use minor version pinning instead of exact versions
|
|
8
|
+
|
|
9
|
+
Excerpt from the dependency list in `package.json` for `@capra/domain`:
|
|
10
|
+
|
|
11
|
+
| Before | After |
|
|
12
|
+
| ------------------------ | ------------------------- |
|
|
13
|
+
| `"@capra/core": "1.6.0"` | `"@capra/core": "^1.6.0"` |
|
|
14
|
+
|
|
15
|
+
* [674593e](https://bitbucket.org/cribl/capra-ui/commits/674593e): Add a `Tree` component
|
|
16
|
+
|
|
17
|
+
* [8ebac6d](https://bitbucket.org/cribl/capra-ui/commits/8ebac6d): Make the `Label` component available.
|
|
18
|
+
|
|
19
|
+
* [5224ebb](https://bitbucket.org/cribl/capra-ui/commits/5224ebb): Update component types for className and style to align with runtime behavior.
|
|
20
|
+
|
|
21
|
+
#### Patch Changes
|
|
22
|
+
|
|
23
|
+
* Updated dependencies [1cbe432](https://bitbucket.org/cribl/capra-ui/commits/1cbe432) — Update intrarepo depedency ranges to use minor version pinning instead of exact versions
|
|
24
|
+
* @capra/icons\@1.8.0
|
|
25
|
+
|
|
3
26
|
### 1.8.2
|
|
4
27
|
|
|
5
28
|
#### Patch Changes
|
package/docs/index.md
CHANGED
|
@@ -103,6 +103,8 @@ Embedded documentation is available on the filesystem for each of these packages
|
|
|
103
103
|
- [Core/Tooltip - Usage](./core-tooltip--usage.md)
|
|
104
104
|
- [Core/TopNav - Design](./core-topnav--design.md)
|
|
105
105
|
- [Core/TopNav - Usage](./core-topnav--usage.md)
|
|
106
|
+
- [Core/Tree - Design](./core-tree--design.md)
|
|
107
|
+
- [Core/Tree - Usage](./core-tree--usage.md)
|
|
106
108
|
- [Core/VerticalNavigation - Design](./core-verticalnavigation--design.md)
|
|
107
109
|
- [Core/VerticalNavigation - Usage](./core-verticalnavigation--usage.md)
|
|
108
110
|
- [Core/VisuallyHidden - Design](./core-visuallyhidden--design.md)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capra/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.0",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Core React components for the Capra design system",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"react-aria": "^3.48.0",
|
|
37
37
|
"react-aria-components": "^1.17.0",
|
|
38
|
-
"@capra/icons": "1.
|
|
38
|
+
"@capra/icons": "^1.8.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"clsx": "^2.1.1",
|
|
@@ -43,11 +43,11 @@
|
|
|
43
43
|
"antd": "4.24.16",
|
|
44
44
|
"storybook": "^10.4.6",
|
|
45
45
|
"tsdown": "^0.22.7",
|
|
46
|
-
"@
|
|
47
|
-
"@
|
|
48
|
-
"@private/
|
|
49
|
-
"@private/
|
|
50
|
-
"@private/testing": "0.0.7"
|
|
46
|
+
"@capra/theme": "^1.4.0",
|
|
47
|
+
"@private/building": "^0.1.0",
|
|
48
|
+
"@private/linting": "^0.0.1",
|
|
49
|
+
"@private/stories": "^0.0.0",
|
|
50
|
+
"@private/testing": "^0.0.7"
|
|
51
51
|
},
|
|
52
52
|
"scripts": {
|
|
53
53
|
"clean": "rm -rf ./dist",
|