@capra/core 1.5.3 → 1.6.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.
Files changed (104) hide show
  1. package/dist/index.cjs +23 -23
  2. package/dist/index.d.cts +9 -9
  3. package/dist/index.d.mts +9 -9
  4. package/dist/index.mjs +23 -23
  5. package/dist/style.css +62 -32
  6. package/docs/conventions--docs.md +186 -0
  7. package/docs/core-alert--design.md +110 -0
  8. package/docs/core-alert--usage.md +13 -0
  9. package/docs/core-anchor--design.md +39 -0
  10. package/docs/core-anchor--usage.md +39 -0
  11. package/docs/core-autocompletefield--design.md +91 -0
  12. package/docs/core-autocompletefield--usage.md +18 -0
  13. package/docs/core-badge--design.md +70 -0
  14. package/docs/core-badge--usage.md +13 -0
  15. package/docs/core-breadcrumbs--design.md +65 -0
  16. package/docs/core-breadcrumbs--usage.md +16 -0
  17. package/docs/core-button--design.md +97 -0
  18. package/docs/core-button--usage.md +17 -0
  19. package/docs/core-buttonlink--design.md +7 -0
  20. package/docs/core-buttonlink--usage.md +24 -0
  21. package/docs/core-card--design.md +100 -0
  22. package/docs/core-card--usage.md +5 -0
  23. package/docs/core-checkbox--design.md +66 -0
  24. package/docs/core-checkbox--usage.md +34 -0
  25. package/docs/core-collapse--design.md +28 -0
  26. package/docs/core-collapse--usage.md +20 -0
  27. package/docs/core-datepickerfield--design.md +71 -0
  28. package/docs/core-datepickerfield--usage.md +57 -0
  29. package/docs/core-daterangepickerfield--design.md +76 -0
  30. package/docs/core-daterangepickerfield--usage.md +62 -0
  31. package/docs/core-divider--design.md +35 -0
  32. package/docs/core-divider--usage.md +8 -0
  33. package/docs/core-drawer--design.md +87 -0
  34. package/docs/core-drawer--usage.md +9 -0
  35. package/docs/core-emptystate--design.md +45 -0
  36. package/docs/core-emptystate--usage.md +13 -0
  37. package/docs/core-helpertext--design.md +30 -0
  38. package/docs/core-helpertext--usage.md +11 -0
  39. package/docs/core-iconbutton--design.md +87 -0
  40. package/docs/core-iconbutton--usage.md +15 -0
  41. package/docs/core-inputrow--design.md +85 -0
  42. package/docs/core-inputrow--usage.md +6 -0
  43. package/docs/core-label--design.md +27 -0
  44. package/docs/core-label--usage.md +17 -0
  45. package/docs/core-link--design.md +58 -0
  46. package/docs/core-link--usage.md +16 -0
  47. package/docs/core-listitem--design.md +70 -0
  48. package/docs/core-listitem--usage.md +6 -0
  49. package/docs/core-menu--design.md +106 -0
  50. package/docs/core-menu--usage.md +16 -0
  51. package/docs/core-modal--design.md +39 -0
  52. package/docs/core-modal--usage.md +11 -0
  53. package/docs/core-numberfield--design.md +12 -0
  54. package/docs/core-numberfield--usage.md +14 -0
  55. package/docs/core-pagination--design.md +30 -0
  56. package/docs/core-pagination--usage.md +13 -0
  57. package/docs/core-passwordfield--design.md +7 -0
  58. package/docs/core-passwordfield--usage.md +3 -0
  59. package/docs/core-pill--design.md +94 -0
  60. package/docs/core-pill--usage.md +10 -0
  61. package/docs/core-popover--design.md +25 -0
  62. package/docs/core-popover--usage.md +8 -0
  63. package/docs/core-radio--design.md +39 -0
  64. package/docs/core-radio--usage.md +8 -0
  65. package/docs/core-radiogroup--design.md +5 -0
  66. package/docs/core-radiogroup--usage.md +12 -0
  67. package/docs/core-radiotile--design.md +5 -0
  68. package/docs/core-radiotile--usage.md +10 -0
  69. package/docs/core-ribbon--design.md +39 -0
  70. package/docs/core-ribbon--usage.md +12 -0
  71. package/docs/core-skeleton--design.md +88 -0
  72. package/docs/core-skeleton--usage.md +13 -0
  73. package/docs/core-skeletongroup--design.md +50 -0
  74. package/docs/core-skeletongroup--usage.md +10 -0
  75. package/docs/core-spinner--design.md +99 -0
  76. package/docs/core-spinner--usage.md +11 -0
  77. package/docs/core-switch--design.md +145 -0
  78. package/docs/core-switch--usage.md +8 -0
  79. package/docs/core-tabnav--design.md +77 -0
  80. package/docs/core-tabnav--usage.md +63 -0
  81. package/docs/core-tag--design.md +21 -0
  82. package/docs/core-tag--usage.md +11 -0
  83. package/docs/core-text--design.md +32 -0
  84. package/docs/core-text--usage.md +10 -0
  85. package/docs/core-textarea--design.md +74 -0
  86. package/docs/core-textarea--usage.md +18 -0
  87. package/docs/core-textfield--design.md +81 -0
  88. package/docs/core-textfield--usage.md +12 -0
  89. package/docs/core-textinput--design.md +72 -0
  90. package/docs/core-textinput--usage.md +19 -0
  91. package/docs/core-toast--design.md +100 -0
  92. package/docs/core-toast--usage.md +11 -0
  93. package/docs/core-tooltip--design.md +61 -0
  94. package/docs/core-tooltip--usage.md +48 -0
  95. package/docs/core-topnav--design.md +75 -0
  96. package/docs/core-topnav--usage.md +6 -0
  97. package/docs/core-verticalnavigation--design.md +31 -0
  98. package/docs/core-verticalnavigation--usage.md +17 -0
  99. package/docs/core-visuallyhidden--design.md +87 -0
  100. package/docs/core-visuallyhidden--usage.md +35 -0
  101. package/docs/history-changelogs-capra-core--docs.md +49 -0
  102. package/docs/index.md +110 -0
  103. package/docs/using-capra--docs.md +39 -0
  104. package/package.json +5 -4
@@ -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. |
@@ -0,0 +1,145 @@
1
+ # Core/Switch - Design
2
+
3
+ ## Properties
4
+
5
+ ### Label
6
+
7
+ Switches must be paired with an accessible label, using text that clearly describes the action being performed in 1
8
+ to 3 words. The language of the label should be phrased in a way that a response of “on”/“off” or “yes”/”no” makes
9
+ sense to the user.
10
+
11
+ <img src="images/guidelines/switch/example-1.png" />
12
+
13
+ ### Size
14
+
15
+ Switches come in two different sizes. Medium is the default and preferred size for most situations. Small size is
16
+ used when a switch is inline with another element, such as a table or popover.
17
+
18
+ <img src="images/guidelines/switch/example-2.png" />
19
+
20
+ ### Selected
21
+
22
+ Switches appear as either selected (on) or unselected (off). Switches cannot be in an indefinite state.
23
+
24
+ <img src="images/guidelines/switch/example-3.png" />
25
+
26
+ ### Disabled
27
+
28
+ Switches can be disabled in either a selected or unselected state if there is a prerequisite to altering its state.
29
+
30
+ <img src="images/guidelines/switch/example-4.png" />
31
+
32
+ ## Behavior
33
+
34
+ ### Immediate
35
+
36
+ Switches immediately update the state of the application or UI when their state changes. If a delay is necessary, a
37
+ loading indicator should be used to inform the user that the process is taking longer.
38
+
39
+ <img src="images/guidelines/switch/example-5.png" />
40
+
41
+ ### Labels
42
+
43
+ Avoid using the words “on” or “off” within the label. Switches imply an on/off state so including it in the label is
44
+ redundant.
45
+
46
+ <img src="images/guidelines/switch/example-6.png" />
47
+
48
+ ## Best Practices
49
+
50
+ ### Labels
51
+
52
+ **Do**
53
+
54
+ <img src="images/guidelines/switch/example-7.png" />
55
+
56
+ Do use clear and concise labels.
57
+
58
+ **Don't**
59
+
60
+ <img src="images/guidelines/switch/example-8.png" />
61
+
62
+ Avoid using action-related verbs with “on” or “off” when adding labels to controls. Switches imply an on/off state
63
+ so including it in the label is redundant.
64
+
65
+ ### Placement
66
+
67
+ **Do**
68
+
69
+ <img src="images/guidelines/switch/example-9.png" />
70
+
71
+ Do use switches as trailing elements.
72
+
73
+ **Don't**
74
+
75
+ <img src="images/guidelines/switch/example-10.png" />
76
+
77
+ Don’t use switches as leading elements.
78
+
79
+ **Do**
80
+
81
+ <img src="images/guidelines/switch/example-11.png" />
82
+
83
+ Do ensure switches are either aligned with the grid or with each other when multiple switches are stacked.
84
+
85
+ **Don't**
86
+
87
+ <img src="images/guidelines/switch/example-12.png" />
88
+
89
+ Don't misalign switches by placing them immediately after labels when multiple switches are stacked, as this can
90
+ affect legibility.
91
+
92
+ ### Checkbox vs Switch
93
+
94
+ **Do**
95
+
96
+ <img src="images/guidelines/switch/example-13.png" />
97
+
98
+ If the action is part of a larger form, use a checkbox instead. The items will be submitted with the rest of the
99
+ form details.
100
+
101
+ **Don't**
102
+
103
+ <img src="images/guidelines/switch/example-14.png" />
104
+
105
+ Switches apply changes immediately and don't require the user to submit anything. If you need to include the data in
106
+ form content, use a checkbox set.
107
+
108
+ ### Radio vs Switch
109
+
110
+ **Do**
111
+
112
+ <img src="images/guidelines/switch/example-15.png" />
113
+
114
+ Switches are used for activation, not selection. If you are selecting between two available options, use a radio set
115
+ instead.
116
+
117
+ **Don't**
118
+
119
+ <img src="images/guidelines/switch/example-16.png" />
120
+
121
+ Switches should not be used to choose between opposing or discrete options. Instead, use switches for on/off
122
+ situations.
123
+
124
+ ## Accessibility
125
+
126
+ ### Keyboard interaction
127
+
128
+ | Key | Function |
129
+ | ---------------------- | ------------------------------------------------------------- |
130
+ | `Tab`<br />`Shift-Tab` | Moves focus into/out of the switch. |
131
+ | `Space` | When focus is on the switch, changes the state of the switch. |
132
+
133
+ ### WAI-ARIA Roles, States, and Properties
134
+
135
+ * The switch has `role=switch`.
136
+ * The switch has an accessible label provided by one of the following:
137
+ * Visible text content contained within the element with `role=switch`.
138
+ * A visible label referenced by the value of `aria-labelledby` set on the element with `role=switch`.
139
+ * `aria-label` set on the element with `role=switch`.
140
+ * When on, the switch element has state `aria-checked` set to true.
141
+ * When off, the switch element has state `aria-checked` set to false.
142
+ * If a set of switches is presented as a logical group with a visible label, either:
143
+ * The switches are included in an element with `role=group` that has the property `aria-labelledby` set to the ID of the element containing the group label.
144
+ * The set is contained in an HTML `<fieldset>` and the label for the set is contained in an HTML `<legend>` element.
145
+ * If the presentation includes additional descriptive static text relevant to a switch or switch group, the switch or switch group has the property `aria-describedby` set to the ID of the element containing the description.
@@ -0,0 +1,8 @@
1
+ # Core/Switch - Usage
2
+
3
+ ### Switch
4
+
5
+ | Prop | Type | Required | Default | Description |
6
+ | --- | --- | --- | --- | --- |
7
+ | `size` | `'sm' \| 'md'` | No | `--` | `--` |
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,77 @@
1
+ # Core/TabNav - Design
2
+
3
+ TabNav provides a horizontal or vertical navigation styled as tabs. Tab items are links that redirect to URLs. With `subItems`, horizontal tabs open a dropdown menu; vertical tabs use an inline indented list (Tab Nav | Vertical in Figma).
4
+
5
+ Tabs and TabNav organize and manage content allowing users to navigate between different sections within the current context.
6
+
7
+ * **Tabs** organize content sections to be displayed at one time. They are displayed in Modals, Drawers, and other content panels.
8
+ * **TabNav** is a navigation menu with links, styled as tabs. They are used in Page Headers and other places where navigation is needed.
9
+
10
+ ## Properties
11
+
12
+ ### Label
13
+
14
+ Every tab must have a brief but descriptive label.
15
+
16
+ ### Variant
17
+
18
+ TabNav has two variants:
19
+
20
+ * **Default**: a single navigational link.
21
+ * **Dropdown**: a dropdown menu that displays a ListBox with additional navigational links.
22
+
23
+ ## Content
24
+
25
+ ### Labels
26
+
27
+ Tab labels should be one or two words, using title case (Tab Label). Labels should be less than 12 characters, with a maximum of 32 characters.
28
+
29
+ ## Best Practices
30
+
31
+ **Do**
32
+
33
+ <p>
34
+ Do follow the maximum character length of tab labels.
35
+ </p>
36
+
37
+ **Don't**
38
+
39
+ <p>
40
+ Don't exceed the 32 maximum character length.
41
+ </p>
42
+
43
+ **Do**
44
+
45
+ <p>
46
+ Do keep tab labels short and concise.
47
+ </p>
48
+
49
+ **Don't**
50
+
51
+ <p>
52
+ Don't wrap tab labels.
53
+ </p>
54
+
55
+ ## Accessibility
56
+
57
+ ### Keyboard interaction
58
+
59
+ | Key | Function |
60
+ | ---------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
61
+ | `Tab` / `Shift + Tab` | Moves focus into the tab list, putting focus onto the active tab. When the tab list has focus, moves focus to the next focusable element (generally within the tab panel). |
62
+ | `Left Arrow` / `Up Arrow` | Moves focus to, and activate, the previous tab. If focus is on the first tab, move focus to the last tab. Up performs the same action when `aria-orientation="vertical"` is set. |
63
+ | `Right Arrow` / `Down Arrow` | Moves focus to, and activate, the next tab. If focus is on the last tab, move focus to the first tab. Down performs the same action when `aria-orientation="vertical"` is set. |
64
+ | `Shift+F10` | Opens the menu for tabs with a dropdown. |
65
+
66
+ ### ARIA considerations
67
+
68
+ TabNav uses link-based navigation. The following apply:
69
+
70
+ * The container has `role="navigation"` with an `aria-label` for the navigation.
71
+ * Active nav links have `aria-current="page"` set.
72
+ * Tabs that contain a dropdown use a button with `aria-haspopup="menu"` and `aria-expanded` set.
73
+ * Dropdown menu items use the Menu component with appropriate roles.
74
+
75
+ ### Orientation
76
+
77
+ Use `tabPlacement="horizontal"` (default) for a horizontal tab bar at the bottom, or `tabPlacement="vertical"` for a vertical tab bar on the left. Vertical tabs have `aria-orientation="vertical"` set.
@@ -0,0 +1,63 @@
1
+ # Core/TabNav - Usage
2
+
3
+ TabNav provides a horizontal or vertical navigation styled as tabs. Tab items are links that redirect to URLs. With `subItems`, horizontal tabs open a dropdown menu; vertical tabs use an inline indented list (Tab Nav | Vertical in Figma).
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
+ | `activeKey` | `string` | No | `--` | Key of the currently active tab (for visual styling). Typically derived from the current URL. |
9
+ | `onTabClick` | `(key: string, event: React.MouseEvent) => void` | No | `--` | Callback when a tab link is clicked (before navigation). |
10
+ | `items` | `TabNavItemType[]` | Yes | `--` | Tab items configuration. |
11
+ | `tabPlacement` | `(typeof tabNavPlacements)[number]` | No | 'horizontal' | Orientation of the tab bar: horizontal (bottom) or vertical (left).<br>@default 'horizontal' |
12
+ | `centered` | `boolean` | No | false | Whether to center the tabs.<br>@default false |
13
+ | `tabBarExtraSlot` | `React.ReactNode` | No | `--` | Slot for extra content in the tab bar (e.g. right side). |
14
+ | `wrap` | `boolean` | No | true | Whether tab items can wrap to multiple lines.<br>@default true |
15
+ | `aria-label` | `string` | No | 'Navigation' | `--` |
16
+
17
+ ## Usage
18
+
19
+ ```tsx
20
+ import { TabNav } from '@capra/core';
21
+
22
+ // Basic usage - tab items are links that redirect to URLs
23
+ <TabNav
24
+ activeKey={currentPath}
25
+ items={[
26
+ { key: '1', name: 'Tab 1', href: '/tab1' },
27
+ { key: '2', name: 'Tab 2', href: '/tab2' },
28
+ ]}
29
+ />
30
+
31
+ // Optional `name` (visible) + `aria-label` on the item when the accessible name differs
32
+ <TabNav
33
+ activeKey="overview"
34
+ items={[
35
+ { key: 'overview', name: 'Overview', 'aria-label': 'Tab 1, 1 of 3, selected', href: '/overview' },
36
+ ]}
37
+ />
38
+
39
+ // With icons and disabled tab
40
+ <TabNav
41
+ activeKey="1"
42
+ items={[
43
+ { key: '1', name: 'Search', icon: <SearchOutlined size="sm" />, href: '/search' },
44
+ { key: '2', name: 'Disabled', disabled: true, href: '/disabled' },
45
+ ]}
46
+ />
47
+
48
+ // With subnav dropdown (tabs with subItems show a chevron and open a menu on click)
49
+ <TabNav
50
+ activeKey="overview::summary"
51
+ items={[
52
+ {
53
+ key: 'overview',
54
+ name: 'Overview',
55
+ subItems: [
56
+ { key: 'summary', name: 'Summary', href: '/overview/summary' },
57
+ { key: 'details', name: 'Details', href: '/overview/details' },
58
+ ],
59
+ },
60
+ { key: 'settings', name: 'Settings', href: '/settings' },
61
+ ]}
62
+ />
63
+ ```
@@ -0,0 +1,21 @@
1
+ # Core/Tag - Design
2
+
3
+ A tag component for displaying a label and an optional icon.
4
+
5
+ ## Accessibility
6
+
7
+ ### Keyboard interaction
8
+
9
+ | Key | Function |
10
+ | ---------------------- | ----------------------------------------------------- |
11
+ | `Tab`<br />`Shift-Tab` | Moves focus to the next/previous interactive element. |
12
+ | `Space` | If the tag's remove icon has focus, remove the tag. |
13
+
14
+ All buttons exist in the page's natural tab sequence, reachable via `Tab` and `Shift+Tab` keys. Pressing `Spacebar` or `Enter` activates the focused button.
15
+
16
+ ### Draggability
17
+
18
+ The tag can be made draggable by setting the `draggable` prop to `true`. When the tag is draggable, the user can drag the tag to a new position in the list.
19
+ The drag handle provides an onKeyDown handler that allows the user to drag the tag with the keyboard.
20
+
21
+ NOTE: The keyboard accessibility of the drag functionality is not defined, and is not part of this component.
@@ -0,0 +1,11 @@
1
+ # Core/Tag - Usage
2
+
3
+ A tag component for displaying a label and an optional icon.
4
+
5
+ | Prop | Type | Required | Default | Description |
6
+ | --- | --- | --- | --- | --- |
7
+ | `color` | `(typeof tagColors)[number]` | No | 'default' | The color of the tag. Defaults to `default`. |
8
+ | `icon` | `SvgIcon \| SvgLogo` | No | `--` | The icon or logo to display in the tag. |
9
+ | `children` | `string` | Yes | `--` | The label text to display in the tag. |
10
+ | `onDelete` | `() => void` | No | `--` | The callback function for when the user clicks the delete button. |
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. |
@@ -0,0 +1,32 @@
1
+ # Core/Text - Design
2
+
3
+ Component for displaying text. The visual display can be controlled via `variant`. The underlying HTML element can be controlled via the `as` prop, which defaults to a `span` tag.
4
+
5
+ ## Properties
6
+
7
+ ### Text
8
+
9
+ A text component isn't very useful if you're not going to put some text in it.
10
+
11
+ ### Variant
12
+
13
+ Variant describe the contextual purpose of the text. Text may be: heading, to create logic sections within the UI
14
+ body, for regular text throughout the UI metric, to display in graphs and data visualizations code, to display
15
+ monospace code snippets
16
+
17
+ ### Color
18
+
19
+ Text inherits color from its container element. In some cases text color may be adjusted outside its container's intention.
20
+
21
+ ### As
22
+
23
+ Gives semantic meaning to the Text variant (style), setting the underlying element rendered by the component.
24
+
25
+ ## Accessibility
26
+
27
+ ### Guidelines
28
+
29
+ Key factors to follow for an accessible typography:
30
+
31
+ * Color. Provide enough contrast between text and its background, check out the minimum recommended [WCAG 2.2 color contrast ratio](https://www.w3.org/TR/WCAG22/#contrast-minimum) (4.5:1).
32
+ * Heading hierarchy. Based on the [W3 guidelines](https://www.w3.org/WAI/tutorials/page-structure/headings/), don't skip heading levels. Make sure to separate the semantics from the style.
@@ -0,0 +1,10 @@
1
+ # Core/Text - Usage
2
+
3
+ Component for displaying text. The visual display can be controlled via `variant`. The underlying HTML element can be controlled via the `as` prop, which defaults to a `span` tag.
4
+
5
+ | Prop | Type | Required | Default | Description |
6
+ | --- | --- | --- | --- | --- |
7
+ | `variant` | `(typeof variants)[number]` | No | `--` | The text style variant. Defaults to `body`. |
8
+ | `color` | `Color \| 'inherit'` | No | `--` | The text foreground color. Can be a theme color or inherited from the environment. Defaults to `inherit`.<br>@default inherit |
9
+ | `as` | `As` | No | `--` | The underlying element rendered by the component. Defaults to `span`. |
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. |