@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,70 @@
1
+ # Core/ListItem - Design
2
+
3
+ ## Properties
4
+
5
+ ### Leading
6
+
7
+ Leading slots are commonly used for icons, avatars, or checkboxes.
8
+
9
+ ### Label
10
+
11
+ A label is required for all list items. Their length may vary based on application but should always be succinct.
12
+
13
+ ### Description
14
+
15
+ The description slot is used to display the description of the list item.
16
+
17
+ ### Suffix
18
+
19
+ A suffix provides space for information such as item counts.
20
+
21
+ ### Trailing
22
+
23
+ Trailing slots are most often used for components providing supplementary information, such as Pills, or controls for menus.
24
+
25
+ ## Behavior
26
+
27
+ ### Spacing
28
+
29
+ ### Overflow
30
+
31
+ Labels will wrap if they are wider than the parent container. The list item remains aligned to the top of the text
32
+ box.
33
+
34
+ ## Best Practices
35
+
36
+ **Do**
37
+
38
+ <p>
39
+ Do maintain consistent with usage of leading and trailing slots.
40
+ </p>
41
+
42
+ **Don't**
43
+
44
+ <p>
45
+ Don't mix items with and without slots.
46
+ </p>
47
+
48
+ **Do**
49
+
50
+ <p>
51
+ Do keep interaction to single action per row.
52
+ </p>
53
+
54
+ **Don't**
55
+
56
+ <p>
57
+ Avoid having multiple interactive elements in a list row.
58
+ </p>
59
+
60
+ **Do**
61
+
62
+ <p>
63
+ Do omit unnecessary visual clutter, such as dividers.
64
+ </p>
65
+
66
+ **Don't**
67
+
68
+ <p>
69
+ Don't include dividers when using a list group.
70
+ </p>
@@ -0,0 +1,6 @@
1
+ # Core/ListItem - Usage
2
+
3
+ | Prop | Type | Required | Default | Description |
4
+ | --- | --- | --- | --- | --- |
5
+ | `as` | `As` | No | `--` | `--` |
6
+ | `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,106 @@
1
+ # Core/Menu - Design
2
+
3
+ ## Properties
4
+
5
+ ### Label
6
+
7
+ A label is required for all menu items. Their length may vary based on application but should always be succinct.
8
+
9
+ ### Description
10
+
11
+ Descriptions can provide secondary information to menu items.
12
+
13
+ ### Icon
14
+
15
+ Capra does not suggest the use of icons in menu items, but an optional slot is available when an icon adds significant recognition.
16
+
17
+ ### Shortcut
18
+
19
+ Shortcuts enable users to more easily access common commands. If available, shortcuts to a command should be shown at the right. A menu does not need to be open for a shortcut to work.
20
+
21
+ ### Indent
22
+
23
+ Use `Menu.Section` to group `Menu.Item` rows. Add an optional `Menu.Header` inside the section to label the group; items in that section indent automatically to show hierarchy. A `Menu.Header` outside a section is only a label and does not indent following itemsβ€”wrap the header and its items in `Menu.Section` when you want indentation. Sections without a header must be named for assistive technology with `aria-label` or `aria-labelledby`. You can still set `indent` on an item to override the default.
24
+
25
+ ## Content
26
+
27
+ ### Ellipsis
28
+
29
+ Use ellipsis to indicate when the menu item leads to additional steps. This is normally followed by a modal.
30
+
31
+ ### Divider
32
+
33
+ Dividers provide subtle separation between list items. They can be used to group items when a header is not necessary. Use `Menu.Divider` between menu items to create visual separation.
34
+
35
+ ## Selection
36
+
37
+ ### Single selection
38
+
39
+ Single selection items act as radio buttons within a menu. Use the `active` prop to indicate the current page or selected item.
40
+
41
+ ### Multiple selection
42
+
43
+ Multiple selection items act as checkboxes within a menu. Users can select more than one item. Use the `active` prop on each `Menu.Item` to indicate selected items. Manage selection state in your application.
44
+
45
+ ### Section-level selection
46
+
47
+ When single and/or multiple section options are used alongside other option types, use Sections to group each selection type.
48
+
49
+ ## Behavior
50
+
51
+ ### Focus containment (`trapFocus`)
52
+
53
+ Set **`trapFocus`** on **`Menu`** when keyboard focus must stay inside the menu panel while it is openβ€”for example horizontal **`TabNav`** flyouts that sit next to other tab stops. The popover stays **non-modal**, so outside pointer dismiss still works. Focus **containment** turns on once focus has entered the panel (so the trigger can still move focus into the menu on open); **`restoreFocus`** returns focus to the trigger when the menu closes.
54
+
55
+ When **`trapFocus`** is omitted (**default `false`**), focus follows the usual tab sequence for a non-modal overlay.
56
+
57
+ ### Submenu
58
+
59
+ Use `Menu.Submenu` for nested flyouts: Capra requires `SubmenuTrigger` β†’ `Popover` β†’ `Menu` so the nested panel is positioned to the side (not stacked under the trigger). The parent row shows a trailing chevron; hover or keyboard opens the submenu. The `parent` prop on `Menu.Item` only adds the chevron for labels without a submenu.
60
+
61
+ ### Minimum and maximum width
62
+
63
+ Menu items have a minimum width of 152px and maximum width of 256px. Content that extends beyond the maximum width is truncated. An ellipsis is *not* added due to the special meaning of the ellipsis following an item label. Care should be taken to ensure menu item labels remain short and succinct to avoid running over the maximum width.
64
+
65
+ ## Best Practices
66
+
67
+ ### Menu Size
68
+
69
+ **Do**
70
+
71
+ <img className="w-full" src="images/guidelines/menu/bestpractices-size-do.png" alt="Menu with appropriate number of items" />
72
+
73
+ <p>
74
+ Do keep menus to as few items as possible, aim for no more than 5 items.
75
+ </p>
76
+
77
+ **Don't**
78
+
79
+ <img className="w-full" src="images/guidelines/menu/bestpractices-size-dont.png" alt="Overly long menu" />
80
+
81
+ <p>
82
+ Don't overload menu item choices.
83
+ </p>
84
+
85
+ ## Accessibility
86
+
87
+ ### Keyboard interaction
88
+
89
+ | Key | Function |
90
+ | --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
91
+ | `Tab` / `Shift + Tab` | Moves focus to, or away from, the trigger. If the menu is open, focus shifts away from the trigger and the menu closes. |
92
+ | `Enter` | If the trigger has focus: opens the menu and focuses the first item. If a menu item has focus: activates that item and closes the menu. |
93
+ | `Space` | If the trigger has focus, opens the menu and focuses the first item. |
94
+ | `Down Arrow` | If the trigger has focus: opens the menu and focuses the first item. If a menu item has focus: moves focus to the next item, wrapping from last to first. |
95
+ | `Up Arrow` | If a menu item has focus: moves focus to the previous item, wrapping from first to last. |
96
+ | `Esc` | Closes the menu and returns focus to the trigger. |
97
+ | `[a-z]` | Move focus to the next item whose label begins with that printable character. |
98
+
99
+ ### Aria considerations
100
+
101
+ * Triggers must have an accessible name (`aria-label` or `aria-labelledby`) or label.
102
+ * Triggers must have `aria-haspopup="menu"` and use `aria-expanded="true|false"`.
103
+ * Use `role="menu"` on menu container.
104
+ * Use `role="menuitem"` on each menu item.
105
+ * Use `role="separator"` if a separator is used.
106
+ * Group related items with `Menu.Section` (`role="group"`). When the section includes `Menu.Header`, the section is named via `aria-labelledby` (the header gets an id). Headerless sections must expose a name with `aria-label` or `aria-labelledby`.
@@ -0,0 +1,16 @@
1
+ # Core/Menu - Usage
2
+
3
+ | Prop | Type | Required | Default | Description |
4
+ | --- | --- | --- | --- | --- |
5
+ | `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
+ | `trigger` | `React.ReactElement` | Yes | `--` | Single element that toggles the menu (e.g. button). Rendered as the menu trigger; must forward refs to a focusable DOM node (wrapped with React Aria {@link Pressable} internally). |
7
+ | `children` | `React.ReactNode` | No | `--` | Menu content. Use Menu.Item, Menu.Section, Menu.Header, Menu.Divider. |
8
+ | `contentProps` | `React.HTMLAttributes<HTMLDivElement>` | No | `--` | Optional props for the element wrapping the menu panel (e.g. pointer handlers when bridging trigger and menu). |
9
+ | `open` | `boolean` | No | `--` | Controlled open state. Omit for uncontrolled usage. |
10
+ | `onOpenChange` | `(open: boolean) => void` | No | `--` | Called when the menu should open or close. |
11
+ | `itemHoverAppearance` | `'default' \| 'accent'` | No | 'default' | Hover/selected styling for items. `accent`: TabNav submenu treatment per Tab Nav \| Vertical \| Item (Figma)β€”hover uses primary background + accent-hover text; selected uses accent-selected background, accent text, semibold label, inline-end accent bar. `default`: neutral grey hover only.<br>@default 'default' |
12
+ | `itemActiveAccentBar` | `boolean` | No | true | When `itemHoverAppearance` is `accent`, whether the active/selected row shows the inline-end accent bar (vertical TabNav indicator). Set to `false` for horizontal TabNav flyout menus where selection should not show that bar.<br>@default true |
13
+ | `itemActiveLabelSemibold` | `boolean` | No | true | When `itemHoverAppearance` is `accent`, whether the active/selected row uses a semibold label. Set to `false` for TabNav horizontal submenus where the active item should match normal menu weight.<br>@default true |
14
+ | `panelPadding` | `'default' \| 'none'` | No | 'default' | Inset of the menu panel (`role="menu"`). `none` uses a minimal inset so focus rings are not clipped under scroll/overflow; use for flyouts that should sit close to the popover edge (e.g. TabNav submenu).<br>@default 'default' |
15
+ | `popoverOffset` | `number` | No | 0 | Gap along the main axis between the trigger and the menu panel (React Aria `Popover` `offset`).<br>Use a small value (e.g. 1) when the panel should clear a trigger underline/border (e.g. horizontal TabNav).<br>@default 0 |
16
+ | `trapFocus` | `boolean` | No | false | When `true`, focus is contained in the menu panel while it is open (Tab cycles within the panel; focus restores on close).<br>The popover stays non-modal so outside pointer dismiss still works. Use for patterns that must not move focus to sibling controls until the menu closes (e.g. horizontal TabNav flyouts).<br>@default false |
@@ -0,0 +1,39 @@
1
+ # Core/Modal - Design
2
+
3
+ ## Properties
4
+
5
+ ### Size
6
+
7
+ Modals come in three sizes: small, medium, and large. Medium is the default size.
8
+ The height of the modal adjusts to the content, up to a maximum height.
9
+
10
+ ### Layered modals
11
+
12
+ Modals automatically stack such that the most recent modal is interactive while preserving the
13
+ backdrop of previous layers.
14
+
15
+ :::warning
16
+
17
+ Modals should never be layered. This causes accessibility and usability issues. Open modals should be closed before new ones are opened.
18
+
19
+ Current instances of layered modals in the product should be refactored to no longer be layered.
20
+
21
+ :::
22
+
23
+ ## Accessibility
24
+
25
+ ### Keyboard interaction
26
+
27
+ | Key | Function |
28
+ | ---------------------- | ------------------------------------------------------------------------------------------------------- |
29
+ | `Tab`<br />`Shift-Tab` | Moves focus to the next/previous focusable element within the modal. Focus is trapped within the modal. |
30
+ | `Escape` | Closes the modal. |
31
+ | `Enter`<br />`Space` | Activates the focused element (e.g., buttons in the footer). |
32
+
33
+ ### WAI-ARIA Roles, States, and Properties
34
+
35
+ * The modal container has `role="dialog"` and `aria-modal="true"`.
36
+ * The modal title has a unique ID and the modal container has `aria-labelledby` set to that ID.
37
+ * The modal overlay has `role="button"` and acts as a backdrop that can close the modal when clicked (if configured).
38
+ * Focus is automatically moved to the modal when it opens and restored to the trigger when it closes.
39
+ * The `body` element has `overflow: hidden` applied when the modal is open to prevent background scrolling.
@@ -0,0 +1,11 @@
1
+ # Core/Modal - Usage
2
+
3
+ ### Modal
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
+ | `size` | `string` | No | 'md' | `--` |
9
+ | `isDismissible` | `boolean` | No | true | `--` |
10
+ | `confirmButtonText` | `string` | No | 'OK' | `--` |
11
+ | `cancelButtonText` | `string` | No | 'Cancel' | `--` |
@@ -0,0 +1,12 @@
1
+ # Core/NumberField - Design
2
+
3
+ Number field built on React Aria `NumberField`, with custom increment/decrement controls (native spinners hidden).
4
+
5
+ ## Anatomy
6
+
7
+ Single-line numeric field with custom increment/decrement controls. Use `min`, `max`, and `step` for native constraint and stepping behavior.
8
+
9
+ ## Accessibility
10
+
11
+ * The input is a text field with `aria-roledescription` of β€œNumber field”. Keyboard users can adjust values with arrow keys where supported.
12
+ * Set `aria-invalid` via `appearance="danger"`, and `aria-required` when `required` is set.
@@ -0,0 +1,14 @@
1
+ # Core/NumberField - Usage
2
+
3
+ Number field built on React Aria `NumberField`, with custom increment/decrement controls (native spinners hidden).
4
+
5
+ | Prop | Type | Required | Default | Description |
6
+ | --- | --- | --- | --- | --- |
7
+ | `onChange` | `(value: number) => void` | No | `--` | Called with the unformatted number value when the number changes. |
8
+ | `formatOptions` | `Intl.NumberFormatOptions` | No | `--` | Locale-aware display and parsing for the displayed value (see https://react-aria.adobe.com/NumberField#format-options) |
9
+ | `min` | `number` | No | `--` | Minimum value |
10
+ | `max` | `number` | No | `--` | Maximum value |
11
+ | `step` | `number` | No | `--` | Step increment. When omitted, defaults to `1` (same as native `input type="number"`). |
12
+ | `helperText` | `string` | No | `--` | Helper text below the field. Replaced by error message when status is error. Use for requirements, disclaimers. |
13
+ | `label` | `string` | No | `--` | Label for the field. Required for accessibility; use aria-label if another element acts as label. |
14
+ | `layout` | `'vertical' \| 'horizontal'` | No | `--` | Label and field layout: vertical (label above) or horizontal (label on leading side). Prefer vertical; use horizontal when space is limited. |
@@ -0,0 +1,30 @@
1
+ # Core/Pagination - Design
2
+
3
+ Pagination component for navigating through paged content. Renders prev/next buttons and a page number input with total pages indicator.
4
+
5
+ ## Properties
6
+
7
+ ### Total Pages
8
+
9
+ The total number of pages.
10
+
11
+ ## Behavior
12
+
13
+ ### Page Updates
14
+
15
+ Page updates occur immediately when clicking the forward or backward buttons. Entering a value in the input field
16
+ will update when pressing Enter or when focus is moved.
17
+
18
+ ## Accessibility
19
+
20
+ ### Keyboard interaction
21
+
22
+ | Key | Function |
23
+ | ------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
24
+ | `Tab`<br />`Shift + Tab` | - Moves focus to the next/previous focusable element. |
25
+ | `Enter` | - If an action button is focused: activates that button.<br />- If the page input field is focused: updates the entered page. Focus remains on the input field. |
26
+
27
+ ### Aria considerations
28
+
29
+ * Use the `nav` element to wrap the pagination.
30
+ * The `nav` element must have an accessible name (`aria-label` or `aria-labelledby`) or label.
@@ -0,0 +1,13 @@
1
+ # Core/Pagination - Usage
2
+
3
+ Pagination component for navigating through paged content. Renders prev/next buttons and a page number input with total pages indicator.
4
+
5
+ | Prop | Type | Required | Default | Description |
6
+ | --- | --- | --- | --- | --- |
7
+ | `total` | `number` | Yes | `--` | Total number of data items. Used with `pageSize` to compute total pages. |
8
+ | `current` | `number` | Yes | `--` | Current page number (1-based). |
9
+ | `pageSize` | `number` | No | 10 | Number of items per page. Defaults to `10`. |
10
+ | `onChange` | `(page: number, pageSize: number) => void` | No | `--` | Callback when page changes. |
11
+ | `disabled` | `boolean` | No | false | Whether the pagination is disabled. |
12
+ | `aria-label` | `string` | Yes | `--` | Accessible name for the navigation. Required for accessibility. |
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,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,3 @@
1
+ # Core/PasswordField - Usage
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`.
@@ -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,5 @@
1
+ # Core/RadioGroup - Design
2
+
3
+ A control wrapper for a group of radio buttons.
4
+
5
+ No content available yet. Check back soon!
@@ -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,5 @@
1
+ # Core/RadioTile - Design
2
+
3
+ A card variation of a radio button component. You will typically use this component within a RadioGroup component.
4
+
5
+ No content available yet. Check back soon!
@@ -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. |