@capra/core 1.5.3 → 1.7.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 +42 -78
- package/dist/index.d.cts +8 -2
- package/dist/index.d.mts +8 -2
- package/dist/index.mjs +42 -78
- package/dist/style.css +62 -32
- package/docs/conventions--docs.md +186 -0
- package/docs/core-alert--design.md +110 -0
- package/docs/core-alert--usage.md +13 -0
- package/docs/core-anchor--design.md +39 -0
- package/docs/core-anchor--usage.md +39 -0
- package/docs/core-autocompletefield--design.md +91 -0
- package/docs/core-autocompletefield--usage.md +18 -0
- package/docs/core-badge--design.md +70 -0
- package/docs/core-badge--usage.md +13 -0
- package/docs/core-breadcrumbs--design.md +65 -0
- package/docs/core-breadcrumbs--usage.md +16 -0
- package/docs/core-button--design.md +97 -0
- package/docs/core-button--usage.md +17 -0
- package/docs/core-buttonlink--design.md +7 -0
- package/docs/core-buttonlink--usage.md +24 -0
- package/docs/core-card--design.md +100 -0
- package/docs/core-card--usage.md +5 -0
- package/docs/core-checkbox--design.md +66 -0
- package/docs/core-checkbox--usage.md +34 -0
- package/docs/core-collapse--design.md +28 -0
- package/docs/core-collapse--usage.md +20 -0
- package/docs/core-datepickerfield--design.md +71 -0
- package/docs/core-datepickerfield--usage.md +57 -0
- package/docs/core-daterangepickerfield--design.md +76 -0
- package/docs/core-daterangepickerfield--usage.md +62 -0
- package/docs/core-divider--design.md +35 -0
- package/docs/core-divider--usage.md +8 -0
- package/docs/core-drawer--design.md +87 -0
- package/docs/core-drawer--usage.md +9 -0
- package/docs/core-emptystate--design.md +45 -0
- package/docs/core-emptystate--usage.md +13 -0
- package/docs/core-helpertext--design.md +30 -0
- package/docs/core-helpertext--usage.md +11 -0
- package/docs/core-iconbutton--design.md +87 -0
- package/docs/core-iconbutton--usage.md +15 -0
- package/docs/core-inputrow--design.md +85 -0
- package/docs/core-inputrow--usage.md +6 -0
- package/docs/core-label--design.md +27 -0
- package/docs/core-label--usage.md +17 -0
- package/docs/core-link--design.md +58 -0
- package/docs/core-link--usage.md +16 -0
- package/docs/core-listitem--design.md +70 -0
- package/docs/core-listitem--usage.md +6 -0
- package/docs/core-menu--design.md +106 -0
- package/docs/core-menu--usage.md +16 -0
- package/docs/core-modal--design.md +39 -0
- package/docs/core-modal--usage.md +11 -0
- package/docs/core-numberfield--design.md +12 -0
- package/docs/core-numberfield--usage.md +14 -0
- package/docs/core-pagination--design.md +30 -0
- package/docs/core-pagination--usage.md +13 -0
- package/docs/core-passwordfield--design.md +7 -0
- package/docs/core-passwordfield--usage.md +3 -0
- package/docs/core-pill--design.md +94 -0
- package/docs/core-pill--usage.md +10 -0
- package/docs/core-popover--design.md +25 -0
- package/docs/core-popover--usage.md +8 -0
- package/docs/core-radio--design.md +39 -0
- package/docs/core-radio--usage.md +8 -0
- package/docs/core-radiogroup--design.md +5 -0
- package/docs/core-radiogroup--usage.md +12 -0
- package/docs/core-radiotile--design.md +5 -0
- package/docs/core-radiotile--usage.md +10 -0
- package/docs/core-ribbon--design.md +39 -0
- package/docs/core-ribbon--usage.md +12 -0
- package/docs/core-skeleton--design.md +88 -0
- package/docs/core-skeleton--usage.md +13 -0
- package/docs/core-skeletongroup--design.md +50 -0
- package/docs/core-skeletongroup--usage.md +10 -0
- package/docs/core-spinner--design.md +99 -0
- package/docs/core-spinner--usage.md +11 -0
- package/docs/core-switch--design.md +145 -0
- package/docs/core-switch--usage.md +8 -0
- package/docs/core-tabnav--design.md +77 -0
- package/docs/core-tabnav--usage.md +63 -0
- package/docs/core-tag--design.md +21 -0
- package/docs/core-tag--usage.md +11 -0
- package/docs/core-text--design.md +32 -0
- package/docs/core-text--usage.md +10 -0
- package/docs/core-textarea--design.md +74 -0
- package/docs/core-textarea--usage.md +18 -0
- package/docs/core-textfield--design.md +81 -0
- package/docs/core-textfield--usage.md +12 -0
- package/docs/core-textinput--design.md +72 -0
- package/docs/core-textinput--usage.md +19 -0
- package/docs/core-toast--design.md +100 -0
- package/docs/core-toast--usage.md +11 -0
- package/docs/core-tooltip--design.md +61 -0
- package/docs/core-tooltip--usage.md +48 -0
- package/docs/core-topnav--design.md +75 -0
- package/docs/core-topnav--usage.md +6 -0
- package/docs/core-verticalnavigation--design.md +31 -0
- package/docs/core-verticalnavigation--usage.md +17 -0
- package/docs/core-visuallyhidden--design.md +87 -0
- package/docs/core-visuallyhidden--usage.md +35 -0
- package/docs/history-changelogs-capra-core--docs.md +60 -0
- package/docs/index.md +110 -0
- package/docs/using-capra--docs.md +39 -0
- package/package.json +5 -4
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Core/PasswordField - Design
|
|
2
|
+
|
|
3
|
+
Password field with a trailing control to show or hide the value. Composes {@link TextField}; visibility toggles the underlying input between `password` and `text`.
|
|
4
|
+
|
|
5
|
+
## Accessibility
|
|
6
|
+
|
|
7
|
+
`PasswordField` is a thin wrapper around `TextField` with `type="password"` and a visibility toggle. It inherits the same keyboard support, focus management, and labeling expectations as `TextField`: associate a visible label, keep error text programmatically linked, and ensure the toggle remains reachable and operable via keyboard.
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# Core/Pill - Design
|
|
2
|
+
|
|
3
|
+
## Variants
|
|
4
|
+
|
|
5
|
+
### Default
|
|
6
|
+
|
|
7
|
+
Default pills communicate information neutral of intent.
|
|
8
|
+
|
|
9
|
+
### Info
|
|
10
|
+
|
|
11
|
+
Information pills communicate general information or an important property.
|
|
12
|
+
|
|
13
|
+
### Danger
|
|
14
|
+
|
|
15
|
+
Danger pills communicate problems that require action to be resolved.
|
|
16
|
+
|
|
17
|
+
### Warning
|
|
18
|
+
|
|
19
|
+
Warning pills can communicate information that is time-sensitive, or trending towards an 'attention' state.
|
|
20
|
+
|
|
21
|
+
### Success
|
|
22
|
+
|
|
23
|
+
Success pills communicate successful states or completed actions.
|
|
24
|
+
|
|
25
|
+
### Highlight
|
|
26
|
+
|
|
27
|
+
Highlight pills bring special attention to metadata without communicating status.
|
|
28
|
+
|
|
29
|
+
## Other properties
|
|
30
|
+
|
|
31
|
+
### Label
|
|
32
|
+
|
|
33
|
+
Labels should use short and clear messaging, in one or two words. Labels are required.
|
|
34
|
+
|
|
35
|
+
### Icon
|
|
36
|
+
|
|
37
|
+
An optional icon is available. Use solid icons.
|
|
38
|
+
|
|
39
|
+
## Style
|
|
40
|
+
|
|
41
|
+
### Bold
|
|
42
|
+
|
|
43
|
+
Pills have a bold and muted style.
|
|
44
|
+
|
|
45
|
+
* **Bold**: Can be used for isolated pills, such as when in the header of an object details page. Use bold pills with caution, since they can easily distract from the primary content. Be cautious with multiple bold pills on a single page, and absolutely avoid multiple bold pills in close proximity.
|
|
46
|
+
* **Muted**: Used when pills are inline with other content, such as table cells.
|
|
47
|
+
|
|
48
|
+
### Muted
|
|
49
|
+
|
|
50
|
+
Pills have a bold and muted style.
|
|
51
|
+
|
|
52
|
+
* **Bold**: Can be used for isolated pills, such as when in the header of an object details page. Use bold pills with caution, since they can easily distract from the primary content. Be cautious with multiple bold pills on a single page, and absolutely avoid multiple bold pills in close proximity.
|
|
53
|
+
* **Muted**: Used when pills are inline with other content, such as table cells.
|
|
54
|
+
|
|
55
|
+
### Hollow
|
|
56
|
+
|
|
57
|
+
Pills have a bold and muted style.
|
|
58
|
+
|
|
59
|
+
* **Bold**: Can be used for isolated pills, such as when in the header of an object details page. Use bold pills with caution, since they can easily distract from the primary content. Be cautious with multiple bold pills on a single page, and absolutely avoid multiple bold pills in close proximity.
|
|
60
|
+
* **Muted**: Used when pills are inline with other content, such as table cells.
|
|
61
|
+
|
|
62
|
+
## Best Practices
|
|
63
|
+
|
|
64
|
+
**Do**
|
|
65
|
+
|
|
66
|
+
<img src="pill-bestpractices-label-do.png" />
|
|
67
|
+
|
|
68
|
+
<p>
|
|
69
|
+
Do provide label that succinctly communicates the pill's messaging.
|
|
70
|
+
</p>
|
|
71
|
+
|
|
72
|
+
**Don't**
|
|
73
|
+
|
|
74
|
+
<img src="pill-bestpractices-label-dont.png" />
|
|
75
|
+
|
|
76
|
+
<p>
|
|
77
|
+
Don't us a pill with just an icon.
|
|
78
|
+
</p>
|
|
79
|
+
|
|
80
|
+
**Do**
|
|
81
|
+
|
|
82
|
+
<img src="pill-bestpractices-interaction-do.png" />
|
|
83
|
+
|
|
84
|
+
<p>
|
|
85
|
+
Do use pills to message and inform the user.
|
|
86
|
+
</p>
|
|
87
|
+
|
|
88
|
+
**Don't**
|
|
89
|
+
|
|
90
|
+
<img src="pill-bestpractices-interaction-dont.png" />
|
|
91
|
+
|
|
92
|
+
<p>
|
|
93
|
+
Don't use a tooltip or make a pill interactive.
|
|
94
|
+
</p>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Core/Pill - Usage
|
|
2
|
+
|
|
3
|
+
| Prop | Type | Required | Default | Description |
|
|
4
|
+
| --- | --- | --- | --- | --- |
|
|
5
|
+
| `children` | `string` | Yes | `--` | The label text to display in the pill. The label should use short and clear messaging, in one or two words. Labels are required. |
|
|
6
|
+
| `icon` | `React.ReactNode` | No | `--` | Overrides the default icon shown based on the pill appearance and variant.<br><br><b>To use this prop you will need a design review!</b> |
|
|
7
|
+
| `variant` | `'bold' \| 'muted' \| 'outline'` | No | 'bold' | A variant to apply to the pill. Only applies when the appearance is not 'default'.<br><br><ul><br> <li><br> 'bold' - Can be used for isolated pills, such as when in the header of an object details page.<br> Use bold pills with caution, since they can easily distract from the primary content.<br> Be cautious with multiple bold pills on a single page, and absolutely avoid multiple bold pills in close proximity.<br> </li><br> <li>'muted' - Used when pills are inline with other content, such as table cells.</li><br></ul><br><br>@default 'bold' |
|
|
8
|
+
| `appearance` | `'default' \| 'info' \| 'danger' \| 'warning' \| 'success' \| 'highlight'` | No | 'default' | The appearance of the pill, which determines its color and severity.<br><br><ul><br> <li>'info' - Information pills communicate general information or an important property.</li><br> <li>'danger' - Danger pills communicate problems that require action to be resolved.</li><br> <li>'warning' - Warning pills can communicate information that is time-sensitive, or trending towards a danger state.</li><br> <li>'success' - Success pills communicate successful states or completed actions.</li><br> <li>'highlight' - Highlight pills bring special attention to metadata without communicating status.</li><br></ul><br><br>@default 'default' |
|
|
9
|
+
| `inline` | `boolean` | No | false | Whether to render the pill as an inline element. This is useful when the pill is used in a heading or other inline context.<br><br>By default, the pill will be rendered as a block element.<br><br>@default false |
|
|
10
|
+
| `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. |
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Core/Popover - Design
|
|
2
|
+
|
|
3
|
+
A popover component that renders a trigger and popover content.
|
|
4
|
+
|
|
5
|
+
### Placement
|
|
6
|
+
|
|
7
|
+
The popover can be positioned relative to the trigger element in 12 different directions. The default
|
|
8
|
+
placement is `top`.
|
|
9
|
+
|
|
10
|
+
## Accessibility
|
|
11
|
+
|
|
12
|
+
### Keyboard interaction
|
|
13
|
+
|
|
14
|
+
| Key | Function |
|
|
15
|
+
| -------- | ----------------------------------------------------------------------------------------------------------------------------- |
|
|
16
|
+
| `Escape` | Closes the popover and returns focus to the trigger. |
|
|
17
|
+
| `Tab` | Moves focus to the next focusable element. If the popover contains focusable elements, they are included in the tab sequence. |
|
|
18
|
+
|
|
19
|
+
### WAI-ARIA Roles, States, and Properties
|
|
20
|
+
|
|
21
|
+
* The popover container has `role="dialog"`.
|
|
22
|
+
* The trigger has `aria-expanded` set to `true` when the popover is open, and `false` otherwise.
|
|
23
|
+
* The trigger has `aria-controls` set to the ID of the popover content.
|
|
24
|
+
* The popover has `aria-hidden` set to `false` when open, and `true` when hidden (unless removed from DOM).
|
|
25
|
+
* The popover has `aria-describedby` pointing to the content element.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Core/Popover - Usage
|
|
2
|
+
|
|
3
|
+
A popover component that renders a trigger and popover content.
|
|
4
|
+
|
|
5
|
+
| Prop | Type | Required | Default | Description |
|
|
6
|
+
| --- | --- | --- | --- | --- |
|
|
7
|
+
| `content` | `React.ReactNode` | Yes | `--` | The popover content to be displayed. |
|
|
8
|
+
| `children` | `React.ReactNode` | Yes | `--` | The visible trigger element. This can be a single element or a component tree, but there MUST be a `Button` or `IconButton` in the tree. Only Capra buttons will trigger the popover. |
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Core/Radio - Design
|
|
2
|
+
|
|
3
|
+
A presentational radio button component. You will typically use this component within a RadioGroup component.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### Label
|
|
8
|
+
|
|
9
|
+
A label is required for all radio buttons. They should be as short as possible. If a label is not visible ensure the proper aria labels are set.
|
|
10
|
+
|
|
11
|
+
## Behavior
|
|
12
|
+
|
|
13
|
+
### Label Wrapping
|
|
14
|
+
|
|
15
|
+
Labels will wrap if they are wider than the parent container. The radio button remains aligned to the top of the text box.
|
|
16
|
+
|
|
17
|
+
### Radio groups
|
|
18
|
+
|
|
19
|
+
Radio buttons cannot be standalone. They should always be contained within a set of at least two items. The group title is required to clarify how the options are related and what decision is being made.
|
|
20
|
+
|
|
21
|
+
## Best Practices
|
|
22
|
+
|
|
23
|
+
### Logical defaults
|
|
24
|
+
|
|
25
|
+
Whenever possible, a radio button group should have a logical default set.
|
|
26
|
+
|
|
27
|
+
### Single Selection
|
|
28
|
+
|
|
29
|
+
**Do**
|
|
30
|
+
|
|
31
|
+
<p>
|
|
32
|
+
Radio buttons should only be used when a single element can be selected.
|
|
33
|
+
</p>
|
|
34
|
+
|
|
35
|
+
**Don't**
|
|
36
|
+
|
|
37
|
+
<p>
|
|
38
|
+
Don’t use radio buttons when multiple options can be applied simultaneously.
|
|
39
|
+
</p>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Core/Radio - Usage
|
|
2
|
+
|
|
3
|
+
A presentational radio button component. You will typically use this component within a RadioGroup component.
|
|
4
|
+
|
|
5
|
+
| Prop | Type | Required | Default | Description |
|
|
6
|
+
| --- | --- | --- | --- | --- |
|
|
7
|
+
| `value` | `string \| null` | Yes | `--` | The value of the radio button. |
|
|
8
|
+
| `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. |
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Core/RadioGroup - Usage
|
|
2
|
+
|
|
3
|
+
A control wrapper for a group of radio buttons.
|
|
4
|
+
|
|
5
|
+
| Prop | Type | Required | Default | Description |
|
|
6
|
+
| --- | --- | --- | --- | --- |
|
|
7
|
+
| `name` | `string` | No | `--` | The name of the radio group, this will act as a default name if one is not provided to the child radio components. |
|
|
8
|
+
| `required` | `boolean` | No | `--` | Whether the radios in the group are required |
|
|
9
|
+
| `disabled` | `boolean` | No | `--` | Whether the radios in the group are disabled |
|
|
10
|
+
| `value` | `string \| null` | No | `--` | The current value of the radio group |
|
|
11
|
+
| `layout` | `'vertical' \| 'horizontal'` | No | 'horizontal' | Whether the radio buttons should be displayed vertically or horizontally<br>@default 'horizontal' |
|
|
12
|
+
| `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. |
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Core/RadioTile - Usage
|
|
2
|
+
|
|
3
|
+
A card variation of a radio button component. You will typically use this component within a RadioGroup component.
|
|
4
|
+
|
|
5
|
+
| Prop | Type | Required | Default | Description |
|
|
6
|
+
| --- | --- | --- | --- | --- |
|
|
7
|
+
| `description` | `React.ReactNode` | No | `--` | Optional description text displayed below the main label in the tile. |
|
|
8
|
+
| `children` | `React.ReactNode` | Yes | `--` | The main label for the tile. |
|
|
9
|
+
| `icon` | `React.ReactNode` | No | `--` | Optional icon to display in the tile. |
|
|
10
|
+
| `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. |
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Core/Ribbon - Design
|
|
2
|
+
|
|
3
|
+
A ribbon component used to highlight new features that exist in a 'preview' state. Ribbons communicate that users may encounter errors when using these features.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### Color
|
|
8
|
+
|
|
9
|
+
Ribbons use the 'decorative' palette by default. Use the `color` prop for preset colors (teal, green, purple). For the rare case where you need to use a custom color, use `FORCE__className` with a class that sets the `--_ribbon-background-color` CSS variable.
|
|
10
|
+
|
|
11
|
+
### Label
|
|
12
|
+
|
|
13
|
+
Labels highlight features of the UI.
|
|
14
|
+
|
|
15
|
+
## Content
|
|
16
|
+
|
|
17
|
+
### Label
|
|
18
|
+
|
|
19
|
+
Use a simple short sentence, fewer than 5 words, in sentence case.
|
|
20
|
+
|
|
21
|
+
## Best Practices
|
|
22
|
+
|
|
23
|
+
### Preview features
|
|
24
|
+
|
|
25
|
+
Use ribbons to highlight new features that are in a 'preview' state. These features may not be fully completed and users may encounter unexpected errors.
|
|
26
|
+
|
|
27
|
+
## Accessibility
|
|
28
|
+
|
|
29
|
+
### Keyboard interaction
|
|
30
|
+
|
|
31
|
+
A ribbon is a static element, associated with other user interface controls (e.g. a card). It is not keyboard focusable by itself.
|
|
32
|
+
|
|
33
|
+
### Labeling
|
|
34
|
+
|
|
35
|
+
A ribbon adds context which must be announced in addition to the parent component's label. For example, "\[parent identifier], \[ribbon string]".
|
|
36
|
+
|
|
37
|
+
### Color contrast
|
|
38
|
+
|
|
39
|
+
When using custom colors via `FORCE__className` (e.g. setting `--_ribbon-background-color`), ensure the background color meets WCAG 2.2 Level AA contrast requirements (4.5:1 ratio) against the white foreground text.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Core/Ribbon - Usage
|
|
2
|
+
|
|
3
|
+
A ribbon component used to highlight new features that exist in a 'preview' state. Ribbons communicate that users may encounter errors when using these features.
|
|
4
|
+
|
|
5
|
+
| Prop | Type | Required | Default | Description |
|
|
6
|
+
| --- | --- | --- | --- | --- |
|
|
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. |
|
|
8
|
+
| `children` | `string` | Yes | `--` | The label text to display. |
|
|
9
|
+
| `color` | `(typeof ribbonColors)[number]` | No | 'teal' | The color of the ribbon. One of the predefined colors (teal, green, purple).<br>For custom colors, use FORCE__className with CSS that sets --_ribbon-background-color.<br>@default 'teal' |
|
|
10
|
+
| `leadingIcon` | `SvgIcon` | No | `--` | Icon to display before the ribbon text. |
|
|
11
|
+
| `position` | `(typeof ribbonPositions)[number]` | No | 'right' | The position of the ribbon tail (left or right).<br>@default 'right' |
|
|
12
|
+
| `trailingIcon` | `SvgIcon` | No | `--` | Icon to display after the ribbon text. |
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# Core/Skeleton - Design
|
|
2
|
+
|
|
3
|
+
A skeleton is a graphical placeholder, reserving physical space in the page for content in cases where a service or action may be slow to resolve. A skeleton can be considered as an alternative to the progress spinner in many situations.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### Title width
|
|
8
|
+
|
|
9
|
+
The title width can be controlled using the `titleWidth` prop.
|
|
10
|
+
|
|
11
|
+
### Paragraph
|
|
12
|
+
|
|
13
|
+
The paragraph rows and width can be controlled using the `paragraph` prop.
|
|
14
|
+
|
|
15
|
+
### Loading
|
|
16
|
+
|
|
17
|
+
The loading state can be controlled using the `loading` prop.
|
|
18
|
+
|
|
19
|
+
### Round
|
|
20
|
+
|
|
21
|
+
The paragraph and title radius can be controlled using the `round` prop.
|
|
22
|
+
|
|
23
|
+
### Active
|
|
24
|
+
|
|
25
|
+
The animation effect can be controlled using the `active` prop.
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
### When to use
|
|
30
|
+
|
|
31
|
+
* When a resource needs long time to load
|
|
32
|
+
* When the component contains lots of information (List, Card)
|
|
33
|
+
* Only when loading data for the first time
|
|
34
|
+
|
|
35
|
+
### When to consider something else
|
|
36
|
+
|
|
37
|
+
* If the visual layout of the page is not known
|
|
38
|
+
* If you need to indicate processing (use Spinner)
|
|
39
|
+
* If the content can be pre-loaded without a skeleton
|
|
40
|
+
|
|
41
|
+
## Best Practices
|
|
42
|
+
|
|
43
|
+
**Do**
|
|
44
|
+
|
|
45
|
+
<p>
|
|
46
|
+
Do maintain consistent skeleton coloring.
|
|
47
|
+
</p>
|
|
48
|
+
|
|
49
|
+
**Don't**
|
|
50
|
+
|
|
51
|
+
<p>
|
|
52
|
+
Don't change the color of skeletons.
|
|
53
|
+
</p>
|
|
54
|
+
|
|
55
|
+
**Do**
|
|
56
|
+
|
|
57
|
+
<p>
|
|
58
|
+
Do use skeleton loading by itself.
|
|
59
|
+
</p>
|
|
60
|
+
|
|
61
|
+
**Don't**
|
|
62
|
+
|
|
63
|
+
<p>
|
|
64
|
+
Don't combine skeleton loading with other spinners, or other loading indicators.
|
|
65
|
+
</p>
|
|
66
|
+
|
|
67
|
+
## Accessibility
|
|
68
|
+
|
|
69
|
+
### Alternative text
|
|
70
|
+
|
|
71
|
+
The loading skeleton requires an appropriate accessible role and label.
|
|
72
|
+
|
|
73
|
+
**Landmark details:**
|
|
74
|
+
|
|
75
|
+
* **element**: `span` (root container)
|
|
76
|
+
* **aria-label**: `"Loading"` (when loading)
|
|
77
|
+
* **role**: `status` (live region)
|
|
78
|
+
* **aria-busy**: `true` (when loading)
|
|
79
|
+
|
|
80
|
+
<img className="w-full" src="images/guidelines/skeleton/alternative-text.png" alt="Skeleton with accessibility landmark annotation showing element, aria-label, and role" />
|
|
81
|
+
|
|
82
|
+
### Color contrast
|
|
83
|
+
|
|
84
|
+
Graphics and user interface components like skeletons are not required to meet minimum contrast.
|
|
85
|
+
|
|
86
|
+
### Motion
|
|
87
|
+
|
|
88
|
+
When `active` is true, the skeleton shows a gradient shimmer animation. The animation is automatically disabled when the user has `prefers-reduced-motion: reduce` set.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Core/Skeleton - Usage
|
|
2
|
+
|
|
3
|
+
A skeleton is a graphical placeholder, reserving physical space in the page for content in cases where a service or action may be slow to resolve. A skeleton can be considered as an alternative to the progress spinner in many situations.
|
|
4
|
+
|
|
5
|
+
| Prop | Type | Required | Default | Description |
|
|
6
|
+
| --- | --- | --- | --- | --- |
|
|
7
|
+
| `loading` | `boolean` | No | `--` | Display the skeleton when true.<br>@default true |
|
|
8
|
+
| `title` | `SkeletonTitleProps \| boolean` | No | `--` | Show title placeholder.<br>@default true |
|
|
9
|
+
| `paragraph` | `SkeletonParagraphProps \| boolean` | No | `--` | Show paragraph placeholder.<br>@default true |
|
|
10
|
+
| `round` | `boolean` | No | `--` | Show paragraph and title radius when true.<br>@default false |
|
|
11
|
+
| `active` | `boolean` | No | `--` | Show animation effect. Respects prefers-reduced-motion.<br>@default false |
|
|
12
|
+
| `children` | `React.ReactNode` | No | `--` | When set together with `loading`: if `loading` is false, only `children`<br>are rendered (no skeleton). If `loading` is true, the skeleton is shown instead — for preset<br>layouts (title and/or paragraph) children are not mounted while loading; in element mode<br>(`title={false}` and `paragraph={false}`) children render inside the placeholder while loading. |
|
|
13
|
+
| `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. |
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Core/SkeletonGroup - Design
|
|
2
|
+
|
|
3
|
+
### SkeletonGroup.Button
|
|
4
|
+
|
|
5
|
+
Button-shaped placeholder.
|
|
6
|
+
|
|
7
|
+
### SkeletonGroup.Input
|
|
8
|
+
|
|
9
|
+
Input-shaped placeholder.
|
|
10
|
+
|
|
11
|
+
### SkeletonGroup.Node
|
|
12
|
+
|
|
13
|
+
Custom content placeholder.
|
|
14
|
+
|
|
15
|
+
## Preset layouts
|
|
16
|
+
|
|
17
|
+
SkeletonGroup provides standalone skeleton shapes. Use `Skeleton` for the preset title+paragraph layout.
|
|
18
|
+
|
|
19
|
+
## Best Practices
|
|
20
|
+
|
|
21
|
+
**Do**
|
|
22
|
+
|
|
23
|
+
Do maintain consistent skeleton coloring.
|
|
24
|
+
|
|
25
|
+
**Don't**
|
|
26
|
+
|
|
27
|
+
Don't change the color of skeletons.
|
|
28
|
+
|
|
29
|
+
## Accessibility
|
|
30
|
+
|
|
31
|
+
### Alternative text
|
|
32
|
+
|
|
33
|
+
The loading skeleton requires an appropriate accessible role and label.
|
|
34
|
+
|
|
35
|
+
**Landmark details:**
|
|
36
|
+
|
|
37
|
+
* **element**: `span` (root container)
|
|
38
|
+
* **aria-label**: `"Loading"` (when loading)
|
|
39
|
+
* **role**: `status` (live region)
|
|
40
|
+
* **aria-busy**: `true` (when loading)
|
|
41
|
+
|
|
42
|
+
<img className="w-full" src="images/guidelines/skeleton/alternative-text.png" alt="Skeleton with accessibility landmark annotation showing element, aria-label, and role" />
|
|
43
|
+
|
|
44
|
+
### Color contrast
|
|
45
|
+
|
|
46
|
+
Graphics and user interface components like skeletons are not required to meet minimum contrast.
|
|
47
|
+
|
|
48
|
+
### Motion
|
|
49
|
+
|
|
50
|
+
When `active` is true, the skeleton shows a gradient shimmer animation. The animation is automatically disabled when the user has `prefers-reduced-motion: reduce` set.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Core/SkeletonGroup - Usage
|
|
2
|
+
|
|
3
|
+
| Prop | Type | Required | Default | Description |
|
|
4
|
+
| --- | --- | --- | --- | --- |
|
|
5
|
+
| `style` | `React.CSSProperties` | No | `--` | `--` |
|
|
6
|
+
| `size` | `keyof typeof SKELETON_SIZE` | No | `--` | Preset dimensions from `dimension.component.*`; use `style` for custom width/height. |
|
|
7
|
+
| `active` | `boolean` | No | `--` | Show animation effect. @default false |
|
|
8
|
+
| `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. |
|
|
9
|
+
| `block` | `boolean` | No | `--` | `--` |
|
|
10
|
+
| `shape` | `'circle' \| 'round' \| 'square' \| 'default'` | No | `--` | `--` |
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# Core/Spinner - Design
|
|
2
|
+
|
|
3
|
+
The Spinner component is used to display a loading state. It can be used in two modes: **Mode 1 - Standalone Spinner:**
|
|
4
|
+
|
|
5
|
+
<p>
|
|
6
|
+
A spinner is a visual indicator of an ongoing, user-initiated process.
|
|
7
|
+
</p>
|
|
8
|
+
|
|
9
|
+
## Modes
|
|
10
|
+
|
|
11
|
+
### Replacement Mode
|
|
12
|
+
|
|
13
|
+
<p>
|
|
14
|
+
Use Replacement Mode when you want to completely hide content while loading and show the spinner instead. This is ideal for initial page loads, route transitions, or when fetching data that's required before any content can be displayed. The content and spinner never appear simultaneously—the component returns early with just the spinner when loading.
|
|
15
|
+
</p>
|
|
16
|
+
|
|
17
|
+
<p>
|
|
18
|
+
This mode is best for scenarios where showing partial or stale content would be confusing or misleading to users.
|
|
19
|
+
</p>
|
|
20
|
+
|
|
21
|
+
<p>
|
|
22
|
+
<pre>
|
|
23
|
+
```tsx
|
|
24
|
+
if (isLoading) {
|
|
25
|
+
return <Spinner title="Loading..." />;
|
|
26
|
+
}
|
|
27
|
+
return <div>Content</div>;
|
|
28
|
+
```
|
|
29
|
+
</pre>
|
|
30
|
+
</p>
|
|
31
|
+
|
|
32
|
+
### Overlay Mode
|
|
33
|
+
|
|
34
|
+
<p>
|
|
35
|
+
Use Overlay Mode when you want to keep content visible while indicating an ongoing operation. The spinner appears
|
|
36
|
+
as an overlay, allowing users to see what they're waiting for or maintain context during the loading process. This
|
|
37
|
+
is perfect for refreshing data, submitting forms, or updating specific sections of a page.
|
|
38
|
+
</p>
|
|
39
|
+
|
|
40
|
+
<p>
|
|
41
|
+
This mode works well for progressive enhancement scenarios, search results that are being refined, or any
|
|
42
|
+
situation where the existing content provides value even during loading. It's particularly useful when you want to
|
|
43
|
+
prevent user interaction temporarily without completely removing the content from view, such as during a save
|
|
44
|
+
operation or background data synchronization.
|
|
45
|
+
</p>
|
|
46
|
+
|
|
47
|
+
<p>
|
|
48
|
+
<pre>
|
|
49
|
+
```tsx
|
|
50
|
+
<Spinner title="Loading..." isPending={isLoading}>
|
|
51
|
+
<div>Content will be shown always</div>
|
|
52
|
+
<div>Will be blurred if the spinner is visible</div>
|
|
53
|
+
</Spinner>
|
|
54
|
+
```
|
|
55
|
+
</pre>
|
|
56
|
+
</p>
|
|
57
|
+
|
|
58
|
+
## Properties
|
|
59
|
+
|
|
60
|
+
### Label
|
|
61
|
+
|
|
62
|
+
<p>
|
|
63
|
+
A label can be added to the spinner to better inform users during a loading process. Common situations in which
|
|
64
|
+
they are used include navigating to a page that is not fully known beforehand (e.g., a dashboard), or loading a
|
|
65
|
+
large set of data.
|
|
66
|
+
</p>
|
|
67
|
+
|
|
68
|
+
### Sizes
|
|
69
|
+
|
|
70
|
+
<p>
|
|
71
|
+
Small spinners are used when in cards or other inline components. Medium spinners are the default and are
|
|
72
|
+
displayed when it represents a larger portion of the page, such as a primary data table. The large size can be
|
|
73
|
+
used when all, or most, of the page content is being loaded.
|
|
74
|
+
</p>
|
|
75
|
+
|
|
76
|
+
## Accessibility
|
|
77
|
+
|
|
78
|
+
### Keyboard interaction
|
|
79
|
+
|
|
80
|
+
<p>
|
|
81
|
+
A spinner is not a focusable element.
|
|
82
|
+
</p>
|
|
83
|
+
|
|
84
|
+
### Labeling
|
|
85
|
+
|
|
86
|
+
<p>
|
|
87
|
+
When possible, supplement spinners with textual indicators to clarify the purpose and state.
|
|
88
|
+
</p>
|
|
89
|
+
|
|
90
|
+
### Focus order
|
|
91
|
+
|
|
92
|
+
<p>
|
|
93
|
+
If the spinner is a blocking interaction, make sure to return focus to a relevant action once loading is complete.
|
|
94
|
+
</p>
|
|
95
|
+
|
|
96
|
+
### Aria considerations
|
|
97
|
+
|
|
98
|
+
* Use `aria-live="polite"` to enable screen readers to notify users of the loading state.
|
|
99
|
+
* When the loading state ends, remove the spinner from the DOM or hide it with `aria-hidden="true"`.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Core/Spinner - Usage
|
|
2
|
+
|
|
3
|
+
The Spinner component is used to display a loading state. It can be used in two modes: **Mode 1 - Standalone Spinner:**
|
|
4
|
+
|
|
5
|
+
| Prop | Type | Required | Default | Description |
|
|
6
|
+
| --- | --- | --- | --- | --- |
|
|
7
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | No | `--` | The size of the Spinner. @default "md" |
|
|
8
|
+
| `title` | `string` | No | `--` | (optional) The title to display in the Spinner. |
|
|
9
|
+
| `children` | `React.ReactNode` | No | `--` | The content to display inside the Spinner. When provided, Spinner acts as a wrapper with overlay. |
|
|
10
|
+
| `isPending` | `boolean` | No | `--` | Whether the Spinner is visible. Only used when children are provided. @default true |
|
|
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. |
|