@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,16 @@
1
+ # Core/Breadcrumbs - Usage
2
+
3
+ Renders a breadcrumb trail with built-in support for collection behavior, keyboard support, and current-page semantics. Wrap items with {@link Breadcrumb}. The last item should represent the current page (typically without an `href`).
4
+
5
+ :::warning[Partially implemented]
6
+
7
+ The `Breadcrumbs` component is partially implemented and does not yet support dropdowns as items.
8
+
9
+ :::
10
+
11
+ | Prop | Type | Required | Default | Description |
12
+ | --- | --- | --- | --- | --- |
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. |
14
+ | `aria-label` | `string` | No | 'Breadcrumb' | Accessible name for the breadcrumb navigation landmark.<br>Defaults to `"Breadcrumb"`. |
15
+ | `size` | `string` | No | 'md' | `--` |
16
+ | `shouldEmpasizeCurrent` | `boolean` | No | true | `--` |
@@ -0,0 +1,97 @@
1
+ # Core/Button - Design
2
+
3
+ Primary interactive element displaying text and supporting leading and trailing icons.
4
+
5
+ ## Usage
6
+
7
+ Use a Button when someone needs to submit a form, confirm an action, or move a workflow forward, and the action warrants a dedicated, labeled control.
8
+
9
+ Use at most one primary (`variant="primary"`) button per view or modal for the main outcome. Pair it with a secondary (`variant="secondary"`) button for cancel or alternate paths. Use `appearance="danger"` with primary or secondary for destructive or irreversible actions.
10
+
11
+ ## Properties
12
+
13
+ ### Variant
14
+
15
+ | Variant | Usage |
16
+ | ----------- | --------------------------------------------------------------------- |
17
+ | `primary` | Highest visual weight. Use once per view for the main action. |
18
+ | `secondary` | Pairs with a primary button for cancel or alternative paths. |
19
+ | `tertiary` | Lowest visual weight. Use for supplementary or de-emphasized actions. |
20
+
21
+ ### Label
22
+
23
+ Labels should use a verb + noun structure to describe what the button will do when pressed.
24
+
25
+ ### Icon
26
+
27
+ Buttons have two icon slots; a leading and a trailing icon. Use the leading icons to visually reinforce their meaning and draw attention.
28
+
29
+ Trailing icons are used for disclosure and additional behavior indications.
30
+
31
+ ### Size
32
+
33
+ Buttons come is three different sizes. Medium is the default and preferred size for most situations.
34
+
35
+ Small size is used when a button is inline with another element, such as a table or popover.
36
+
37
+ ### Appearance
38
+
39
+ | Appearance | Default | Usage |
40
+ | ---------- | ------- | ----------------------------------------------------------- |
41
+ | `default` | ✓ | Standard interactive actions. |
42
+ | `neutral` | | Lower-prominence secondary actions within a filled surface. |
43
+ | `danger` | | Destructive or irreversible actions (delete, revoke). |
44
+
45
+ ### Size
46
+
47
+ | Size | Default | Usage |
48
+ | ---- | ------- | --------------------------------------------------- |
49
+ | `sm` | | Compact toolbars, table row actions, dense layouts. |
50
+ | `md` | ✓ | Standard form actions, modal footers. |
51
+ | `lg` | | Call-to-action in empty states, hero sections. |
52
+ | `xl` | | Marketing or onboarding hero sections. |
53
+
54
+ ## Content
55
+
56
+ * Use verb-first labels: "Save changes", "Add item", "Delete record".
57
+ * Title case for all button labels.
58
+ * Keep labels to 1-3 words when possible. Never exceed 5 words.
59
+ * Use "Add" not "New" (e.g., "Add source", not "New source").
60
+ * Avoid vague labels like "OK" or "Submit" — be specific about the action.
61
+
62
+ ## Behavior
63
+
64
+ * Activated with mouse click, Enter key, or Space key.
65
+ * Pending state (`pending` prop): replaces the leading icon or prepends a spinner while an async action is in progress; preserve button width to avoid layout shift.
66
+ * Disabled state: buttons with `disabled` prop are non-interactive and non-focusable; use `aria-disabled` if the button should remain focusable (e.g., with a tooltip explaining why it's disabled).
67
+
68
+ ## Best Practices
69
+
70
+ Do:
71
+
72
+ * Do use a single `variant="primary"` button per view.
73
+ * Do pair primary with secondary for confirm/cancel patterns.
74
+ * Do use `appearance="danger"` for destructive actions.
75
+ * Do use verb-first, title-case labels.
76
+
77
+ Don't:
78
+
79
+ * Don't use a Button for navigation to another page — use [Link](?path=/docs/core-link--design) or [Anchor](?path=/docs/core-anchor--design).
80
+ * Don't use a Button for text-only inline navigation — use [Link](?path=/docs/core-link--design).
81
+ * Don't use a Button for icon-only actions — use [IconButton](?path=/docs/core-iconbutton--design).
82
+ * Don't use two primary buttons side by side.
83
+ * Don't truncate button labels.
84
+ * Don't disable a button without explaining why (use `aria-disabled` with a tooltip).
85
+
86
+ ## Accessibility
87
+
88
+ * Always provide a visible text label; if the design requires a short label, add `aria-label` for context.
89
+ * For icon-only use cases, use [IconButton](?path=/docs/core-iconbutton--design) instead (which enforces an accessible label).
90
+ * Tab / Shift+Tab to focus. Enter or Space to activate.
91
+ * The pending state must be communicated to assistive technology (e.g., `aria-label="Saving..."` when `pending` is true).
92
+
93
+ ## Related components
94
+
95
+ * [IconButton](?path=/docs/core-iconbutton--design) — For icon-only actions.
96
+ * [Link](?path=/docs/core-link--design) — For inline text navigation.
97
+ * [Modal](?path=/docs/core-modal--design) — Buttons typically appear in modal footers for confirm/cancel patterns.
@@ -0,0 +1,17 @@
1
+ # Core/Button - Usage
2
+
3
+ Primary interactive element displaying text and supporting leading and trailing icons.
4
+
5
+ | Prop | Type | Required | Default | Description |
6
+ | --- | --- | --- | --- | --- |
7
+ | `children` | `string` | Yes | `--` | The `label` for the button. |
8
+ | `variant` | `(typeof variants)[number]` | No | 'secondary' | Which button style to use. Defaults to `secondary`. |
9
+ | `appearance` | `(typeof appearances)[number]` | No | 'default' | Appearance to apply to the button. Defaults to `default`. |
10
+ | `size` | `(typeof sizes)[number]` | No | 'md' | Size of the button. Defaults to `md`. |
11
+ | `disabled` | `boolean` | No | false | Whether the button is disabled. |
12
+ | `pending` | `boolean` | No | false | Whether the button is in a pending state. |
13
+ | `leadingIcon` | `SvgIcon` | No | `--` | Icon to display before the button text. |
14
+ | `trailingIcon` | `SvgIcon` | No | `--` | Icon to display after the button text. |
15
+ | `block` | `boolean` | No | `--` | Whether to display the button as a block-level (full-width) component. Defaults to `false`. |
16
+ | `onClick` | `React.ComponentProps<'button'>['onClick']` | No | `--` | Click handler for the button. |
17
+ | `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/ButtonLink - Design
2
+
3
+ Primary interactive element displaying text and supporting leading and trailing icons.
4
+
5
+ `ButtonLink` follows the design guidelines for [`Button`](?path=/docs/core-button--design) and uses [`Link`](?path=/docs/core-link--design) interally. Use it when you need a link styled as a button.
6
+
7
+ See those pages for more details on the properties and usage of `ButtonLink`.
@@ -0,0 +1,24 @@
1
+ # Core/ButtonLink - Usage
2
+
3
+ Primary interactive element displaying text and supporting leading and trailing icons.
4
+
5
+ | Prop | Type | Required | Default | Description |
6
+ | --- | --- | --- | --- | --- |
7
+ | `children` | `string` | Yes | `--` | The `label` for the link. |
8
+ | `variant` | `(typeof variants)[number]` | No | 'secondary' | Which visual style to use. Defaults to `secondary`. |
9
+ | `appearance` | `(typeof appearances)[number]` | No | 'default' | Appearance to apply to the link. Defaults to `default`. |
10
+ | `size` | `(typeof sizes)[number]` | No | 'md' | Size of the link. Defaults to `md`. |
11
+ | `disabled` | `boolean` | No | false | Whether the link is disabled. |
12
+ | `pending` | `boolean` | No | false | Whether the link is in a pending state. |
13
+ | `leadingIcon` | `SvgIcon` | No | `--` | Icon to display before the link text. |
14
+ | `trailingIcon` | `SvgIcon` | No | `--` | Icon to display after the link text. |
15
+ | `block` | `boolean` | No | `--` | Whether to display the link as a block-level (full-width) component. Defaults to `false`. |
16
+ | `as` | `As` | No | `--` | The underlying element rendered by the component. Defaults to `a`. |
17
+ | `href` | `unknown` | No | `--` | A URL to link to. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#href). |
18
+ | `hrefLang` | `string` | No | `--` | Hints at the human language of the linked URL. See[MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#hreflang). |
19
+ | `target` | `HTMLAttributeAnchorTarget` | No | `--` | The target window for the link. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#target). |
20
+ | `rel` | `string` | No | `--` | The relationship between the linked resource and the current page. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel). |
21
+ | `download` | `boolean \| string` | No | `--` | Causes the browser to download the linked URL. A string may be provided to suggest a file name. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#download). |
22
+ | `referrerPolicy` | `HTMLAttributeReferrerPolicy` | No | `--` | How much of the referrer to send when following the link. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#referrerpolicy). |
23
+ | `routerOptions` | `unknown` | No | `--` | Options for the configured client side router. |
24
+ | `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,100 @@
1
+ # Core/Card - Design
2
+
3
+ The base component for the card.
4
+
5
+ ## Usage
6
+
7
+ Use a Card to group related content—title, optional description, body, actions, and footer—into one scannable unit, often in grids or lists of similar items.
8
+
9
+ Treat the card as a container: put links and buttons inside slots rather than making the whole surface ambiguous.
10
+
11
+ ## Properties
12
+
13
+ ### Title
14
+
15
+ <p>
16
+ All cards must have a title identifying their content purpose. Use sentence case.
17
+ </p>
18
+
19
+ <p>
20
+ Card titles are wrapped by an `h2` by default, but can change based on their hierarchy within the page. Be sure to
21
+ note the heading level in your design file. The header's visual presentation remains the same regardless of
22
+ heading level.
23
+ </p>
24
+
25
+ ### Description
26
+
27
+ <p>
28
+ Optional. The description gives additional context to the contexts of the card. Descriptions should be brief,
29
+ taking up no more than a single line.
30
+ </p>
31
+
32
+ ### Actions
33
+
34
+ <p>
35
+ Contextual actions act on the main content area but keep the user's workflow within the card. Common examples
36
+ would be controls that act upon data visualizations, such as a View Switcher and range selections.
37
+ </p>
38
+
39
+ <p>
40
+ Supporting, non-interactive, data can also be displayed in this space.
41
+ </p>
42
+
43
+ ### Content
44
+
45
+ <p>
46
+ The primary content of the card. This is generally "one thing", though that could be a complex element such as a
47
+ graph or form.
48
+ </p>
49
+
50
+ ### Footer
51
+
52
+ <p>
53
+ Place actions or supplementary information to the primary content in the card's footer.
54
+ </p>
55
+
56
+ <p>
57
+ Actions placed here (e.g., a submit button for a form) take the user's workflow out of the card. There should be
58
+ an explicit indication of completion within the context of the card when the action is taken.
59
+ </p>
60
+
61
+ ## Layout and spacing
62
+
63
+ * Padding: `spacing.xl` on all sides (standard), `spacing.lg` for compact cards.
64
+ * Title and description: `spacing.sm` gap between them.
65
+ * Title/description block and content: `spacing.lg` gap.
66
+ * Border: `shape.border.default`, `shape.radius.xl`.
67
+ * Background: `color.background.panel.solid`.
68
+
69
+ ## Behavior
70
+
71
+ * Cards are static containers by default.
72
+ * If the entire card is interactive (e.g., a selectable card), use `role="button"` with keyboard support. Prefer [RadioTile](?path=/docs/core-radiotile--design) for selection scenarios.
73
+
74
+ ## Content
75
+
76
+ * Title: sentence case, noun phrase.
77
+ * Description: optional; one short line, sentence case with punctuation if needed.
78
+ * Action labels: verb-first, title case.
79
+
80
+ ## Best Practices
81
+
82
+ Do:
83
+
84
+ * Do include a title in every card.
85
+ * Do use the footer slot for secondary metadata (timestamps, status).
86
+
87
+ Don't:
88
+
89
+ * Don't make the entire card surface the only navigation affordance — put a [Link](?path=/docs/core-link--design) or [Button](?path=/docs/core-button--design) inside the content.
90
+ * Don't use Card for tabular data — use a table.
91
+
92
+ ## Accessibility
93
+
94
+ * Card titles are typically wrapped at an `h2` by default; choose the heading level (`h2`–`h6`) to match the page outline. Note the intended level in design specs—the visual style stays the same across levels.
95
+ * If the card is a landmark region, wrap with `<section aria-labelledby>`.
96
+
97
+ ## Related components
98
+
99
+ * [RadioTile](?path=/docs/core-radiotile--design) — For selectable card options.
100
+ * [Modal](?path=/docs/core-modal--design) — For focused overlay containers.
@@ -0,0 +1,5 @@
1
+ # Core/Card - Usage
2
+
3
+ The base component for the card.
4
+
5
+ ## Card
@@ -0,0 +1,66 @@
1
+ # Core/Checkbox - Design
2
+
3
+ Checkbox component for capturing boolean user input. Supports controlled and uncontrolled modes with proper accessibility.
4
+
5
+ ## Usage
6
+
7
+ Use a Checkbox when people can turn several options on or off independently within a group, and those choices apply when the form is submitted (or in another explicit save step).
8
+
9
+ Use a visible group heading and stack options so each label stays associated with its control. Use `indeterminate` on a parent checkbox when a tree or grouped list is partially selected.
10
+
11
+ ## Properties
12
+
13
+ ### Label
14
+
15
+ A label is required for all checkboxes. They should be short and represent a value or yes/no decision. Ensure
16
+ `aria-label` or `aria-labelledby` is used if the checkbox label is not immediately associated with the control.
17
+
18
+ ### Checked
19
+
20
+ A checkbox can be unchecked, checked, or in an indeterminate state
21
+
22
+ ### Disabled
23
+
24
+ A checkbox can be disabled in any state if there is a prerequisite to enable the selection.
25
+
26
+ ## Content
27
+
28
+ * Sentence case labels.
29
+ * Describe the option, not the action (e.g., "Send email notifications", not "Enable email").
30
+
31
+ ## Behaviour
32
+
33
+ ### Single choice
34
+
35
+ A single discrete checkbox can be used for yes/no decisions within a form.
36
+
37
+ ### Overflow
38
+
39
+ Labels will wrap if they are wider than the parent container. The checkbox remains aligned to the top of the text
40
+ box.
41
+
42
+ ## Best Practices
43
+
44
+ Do:
45
+
46
+ * Do use checkboxes for multi-select form options.
47
+ * Do use `indeterminate` for parent checkboxes in tree structures.
48
+ * Do provide a group heading for checkbox groups.
49
+
50
+ Don't:
51
+
52
+ * Don't use Checkbox for settings that apply immediately without submit — use Switch.
53
+ * Don't use Checkbox for mutually exclusive options — use RadioGroup.
54
+ * Don't use a lone Checkbox as a single on/off setting that applies immediately — use Switch.
55
+
56
+ ## Accessibility
57
+
58
+ * `role="checkbox"`, `aria-checked` (including "mixed" for indeterminate).
59
+ * Associate label using `<label for>` or wrapping `<label>`.
60
+ * Checkbox group must have a group heading using `role="group"` with `aria-labelledby`.
61
+ * Keyboard: Tab / Shift+Tab moves focus; Space or Enter toggles state when the checkbox is focused.
62
+
63
+ ## Related components
64
+
65
+ * [Switch](?path=/docs/core-switch--design) — For immediate binary settings.
66
+ * [RadioGroup](?path=/docs/core-radiogroup--design) — For mutually exclusive selections.
@@ -0,0 +1,34 @@
1
+ # Core/Checkbox - Usage
2
+
3
+ Checkbox component for capturing boolean user input. Supports controlled and uncontrolled modes with proper accessibility.
4
+
5
+ | Prop | Type | Required | Default | Description |
6
+ | --- | --- | --- | --- | --- |
7
+ | `indeterminate` | `boolean` | No | `--` | Whether the checkbox is in an indeterminate state. |
8
+ | `checked` | `boolean` | No | `--` | Controlled checked state. Use with onChange for controlled component. |
9
+ | `defaultChecked` | `boolean` | No | `--` | Default checked state for uncontrolled component. |
10
+ | `children` | `string \| React.ReactNode` | No | `--` | The label for the checkbox. |
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. |
12
+
13
+ ## Integration Notes
14
+
15
+ ### Ant Design Form Compatibility
16
+
17
+ When using Checkbox inside an Ant Design `<Form>` component, the focus ring may appear incorrectly due to Ant Design's global CSS:
18
+
19
+ ```css
20
+ .ant-form input[type='checkbox']:focus {
21
+ outline-offset: -2px;
22
+ }
23
+ ```
24
+
25
+ Capra's Checkbox includes `!important` on its focus styles to override this, but if you encounter issues, add a local override where you're using this component:
26
+
27
+ ```css
28
+ .checkbox {
29
+ input[type='checkbox']:focus,
30
+ input[type='checkbox']:focus-visible {
31
+ outline-offset: 2px !important;
32
+ }
33
+ }
34
+ ```
@@ -0,0 +1,28 @@
1
+ # Core/Collapse - Design
2
+
3
+ A collapsible disclosure section with an expandable header and panel. Pass **`title`** for the header label, optional **`headerTrailingContentSlot`** for trailing actions (switches, buttons), and the panel body via **`children`**.
4
+
5
+ ## Usage
6
+
7
+ Use Collapse to structure readable content, separate regions, or group related information. Pair it with shared spacing, typography, and surface rules. Do not stretch it into an action pattern that already has a dedicated component.
8
+
9
+ ## Best Practices
10
+
11
+ * Do use Collapse to support hierarchy, grouping, and readable scanning.
12
+ * Don't turn Collapse into an action container when a dedicated interactive pattern exists.
13
+
14
+ ## Accessibility
15
+
16
+ ### Keyboard interaction
17
+
18
+ | Key | Function |
19
+ | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
20
+ | `Tab`, `Shift-Tab` | When contents are collapsed, focus moves to the next or previous collapse header. When contents are expanded, focus moves to the next or previous focusable element within the expanded content. |
21
+ | `Enter`, `Space` | When focus is on the accordion header, toggles the expanded/collapsed state. |
22
+
23
+ * When receiving focus through the keyboard, the focus outline appears around the title of the collapse header.
24
+
25
+ ## Related components
26
+
27
+ * [Card](?path=/docs/core-card--design)
28
+ * [Divider](?path=/docs/core-divider--design)
@@ -0,0 +1,20 @@
1
+ # Core/Collapse - Usage
2
+
3
+ A collapsible disclosure section with an expandable header and panel. Pass **`title`** for the header label, optional **`headerTrailingContentSlot`** for trailing actions (switches, buttons), and the panel body via **`children`**.
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
+ | `title` | `string` | Yes | `--` | Plain string title rendered in the disclosure heading. |
9
+ | `headerTrailingContentSlot` | `React.ReactNode` | No | `--` | Trailing header region for actions (switches, buttons, etc.). |
10
+ | `children` | `React.ReactNode` | Yes | `--` | Content of the disclosure panel. |
11
+
12
+ ### `Collapse` root API
13
+
14
+ Pass **`title`** (plain string) for the header label, optional **`headerTrailingContentSlot`** for trailing actions
15
+ (switches, buttons), and the panel body via **`children`**.
16
+
17
+ The root forwards these `Disclosure` props from `react-aria-components`:
18
+ **`id`** (use when a parent **`DisclosureGroup`** controls expansion),
19
+ **`defaultExpanded`**, **`isExpanded`**, **`onExpandedChange`**, and **`isDisabled`**. Use **`FORCE__className`** on the
20
+ root as the style escape hatch.
@@ -0,0 +1,71 @@
1
+ # Core/DatePickerField - Design
2
+
3
+ ## Anatomy
4
+
5
+ The date picker combines a segmented date input with a calendar in a popover. Values use types from
6
+ [`@internationalized/date`](https://react-spectrum.adobe.com/internationalized/date/) (for example `CalendarDate`).
7
+ The visible format follows the user’s locale.
8
+
9
+ ## Properties
10
+
11
+ ### Label
12
+
13
+ Provide a visible `label` so the control has a clear accessible name. If another element acts as the label, wire the
14
+ relationship with `aria-labelledby` or `aria-label` instead.
15
+
16
+ ### Value
17
+
18
+ Use `value` with `onChange` for a controlled value, or `defaultValue` for an uncontrolled initial value. The handler
19
+ receives `null` when the field is cleared.
20
+
21
+ ### Placeholder
22
+
23
+ `placeholder` shows a single string when the field is empty and not focused. Prefer `helperText` for requirements or
24
+ instructions that must stay visible.
25
+
26
+ ### Helper text
27
+
28
+ Helper text sits below the field for requirements, hints, or errors. Pair `appearance="danger"` with error copy so
29
+ the invalid state is clear visually and to assistive technologies.
30
+
31
+ ### Layout
32
+
33
+ `layout` can be **vertical** (label above) or **horizontal** (label on the leading side). Prefer vertical; use
34
+ horizontal when horizontal space is tight.
35
+
36
+ ## Feedback
37
+
38
+ ### Appearance
39
+
40
+ `appearance` supports **default**, **danger** (invalid / error), and **warning**. Danger also drives the invalid
41
+ state for accessibility in addition to any explicit `isInvalid` flag.
42
+
43
+ ### Disabled
44
+
45
+ Disabled fields cannot be edited and do not receive focus. Values are not submitted with native form submission.
46
+
47
+ ### Read-only
48
+
49
+ Read-only fields cannot be edited; the value stays visible for reading and assistive technologies.
50
+
51
+ ## Accessibility
52
+
53
+ ### Keyboard and pointer behavior
54
+
55
+ * **Tab** moves focus into the segmented field or calendar trigger; **Shift+Tab** moves out.
56
+ * Arrow keys adjust focused segments; calendar grid follows standard date grid keyboard patterns when the popover is open.
57
+ * **Space** / **Enter** on the calendar button opens the popover where supported by the platform pattern.
58
+
59
+ ### Labeling and instructions
60
+
61
+ Provide a visible `label` or an accessible name via `aria-label` / `aria-labelledby`. Do not rely on `placeholder` alone
62
+ for the accessible name. Prefer persistent `helperText` for requirements; placeholder disappears when the user types.
63
+
64
+ ### Validation and state
65
+
66
+ Use `appearance="danger"` with error content in `helperText` for a consistent error treatment. Set `required` when the
67
+ field is mandatory. Disabled fields are not interactive and are excluded from native submission; read-only fields keep
68
+ their values visible but are not editable.
69
+
70
+ Ensure focus indicators remain visible (at least 2px, 3:1 contrast) and interactive targets meet at least 24×24 CSS
71
+ pixels where applicable.
@@ -0,0 +1,57 @@
1
+ # Core/DatePickerField - Usage
2
+
3
+ | Prop | Type | Required | Default | Description |
4
+ | --- | --- | --- | --- | --- |
5
+ | `helperText` | `string` | No | `--` | Helper text below the field. Replaced by error message when status is error. Use for requirements, disclaimers. |
6
+ | `label` | `string` | No | `--` | Label for the field. Required for accessibility; use aria-label if another element acts as label. |
7
+ | `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. |
8
+ | `granularity` | `'day' \| 'second'` | No | `--` | Smallest date/time unit shown in the field. Only `day` and `second` are supported. |
9
+ | `FORCE__className` | `string` | No | `--` | 🚨 This prop is meant to be an escape hatch. 🚨<br><br>If the desired style cannot be achieved using component props, use this as a last resort. The inner workings of Capra components are implementation details and this escape hatch gives one access to those implementation details. We cannot make any guarantees that styles will applied correctly across version updates. Please use it responsibly.<br><br>Add a CSS class to the component. |
10
+ | `canClear` | `boolean` | No | `--` | When true, shows a clear control to the left of the calendar button while the field has a value. |
11
+ | `disabled` | `boolean` | No | `--` | Disables the field. |
12
+ | `id` | `string` | No | `--` | Optional id for the root; associates the label and field. |
13
+ | `readOnly` | `boolean` | No | `--` | Read-only field. |
14
+ | `required` | `boolean` | No | `--` | Required field. |
15
+ | `isInvalid` | `boolean` | No | `--` | Invalid value; `appearance="danger"` also forces an invalid state for display. |
16
+
17
+ ## Props reference
18
+
19
+ ### Field layout and presentation
20
+
21
+ | Prop | Type | Description |
22
+ | ------------------ | ------------------------------------ | ------------------------------------------------------------------------------------------------------ |
23
+ | `label` | `string` | Visible label text; pair with `required` or assistive naming when the visible label is not sufficient. |
24
+ | `helperText` | `string` | Descriptive or error text below the field (rendered in the description slot). |
25
+ | `layout` | `'vertical' \| 'horizontal'` | Label placement relative to the control. |
26
+ | `appearance` | `'default' \| 'danger' \| 'warning'` | Visual status; `danger` also marks the field invalid for accessibility. |
27
+ | `size` | `'sm' \| 'md'` | Height and density of the input shell. |
28
+ | `leadingSlot` | `ReactNode` | Optional content before the segmented input (same pattern as `TextInput`). |
29
+ | `placeholder` | `string` | String placeholder when empty and not focus-within. |
30
+ | `id` | `string` | Optional id for the root; associates the label and field. |
31
+ | `FORCE__className` | `string` | Escape hatch: extra class on the field shell; see `StylingOverrideProps` in source. |
32
+ | `disabled` | `boolean` | Disables the control. |
33
+ | `readOnly` | `boolean` | Read-only mode. |
34
+ | `required` | `boolean` | Marks the field required for forms and assistive technologies. |
35
+ | `isInvalid` | `boolean` | Marks the value invalid; combined with `appearance === 'danger'`. |
36
+
37
+ ### Value, format, and change events
38
+
39
+ | Prop | Type | Description |
40
+ | -------------- | --------------------------------------------- | ---------------------------------------------------------------------------------------- |
41
+ | `value` | `T \| null` | Controlled value (`T` is a `DateValue` generic, defaulting to the library `DateValue`). |
42
+ | `defaultValue` | `T \| null` | Initial value when uncontrolled. |
43
+ | `onChange` | `(value: MappedDateValue<T> \| null) => void` | Fired when the committed value changes. |
44
+ | `granularity` | `'day' \| 'hour' \| 'minute' \| 'second'` | Smallest unit shown in the field (default follows value type, e.g. day for plain dates). |
45
+
46
+ `MappedDateValue<T>` preserves time and calendar types aligned with `T` (for example `CalendarDate` vs `CalendarDateTime`).
47
+
48
+ Use `isInvalid` and `helperText` for invalid feedback in Capra layouts. Validation behavior is fixed to ARIA-associated messaging for this shell (not configurable).
49
+
50
+ ### Props not supported or intentionally fixed
51
+
52
+ | Prop | Notes |
53
+ | ---------------------------------------------- | -------------------------------------------------------------------------------------------- |
54
+ | `children` | Ignored; structure (label, input, calendar) is fixed. |
55
+ | `style` | Not part of the public styling contract; use design tokens and `FORCE__className` if needed. |
56
+ | `validationBehavior` | Not configurable; the implementation always uses ARIA-associated validation for this shell. |
57
+ | `description`, `errorMessage` (slot-style API) | Not part of the public props surface; use `helperText` and validation props instead. |
@@ -0,0 +1,76 @@
1
+ # Core/DateRangePickerField - Design
2
+
3
+ ## Anatomy
4
+
5
+ The date range picker combines two segmented date inputs (start and end) with a range calendar in a popover. Values use
6
+ [`RangeValue`](https://react-spectrum.adobe.com/react-aria/DateRangePicker.html) over types from
7
+ [`@internationalized/date`](https://react-spectrum.adobe.com/internationalized/date/) (for example `CalendarDate`). The
8
+ visible format follows the user’s locale.
9
+
10
+ ## Properties
11
+
12
+ ### Label
13
+
14
+ Provide a visible `label` so the control has a clear accessible name. If another element acts as the label, wire the
15
+ relationship with `aria-labelledby` or `aria-label` instead.
16
+
17
+ ### Value
18
+
19
+ Use `value` with `onChange` for a controlled range, or `defaultValue` for an uncontrolled initial range. The handler
20
+ receives `null` when the field is cleared. Each bound is a `DateValue` consistent with your generic (for example
21
+ both `CalendarDate`).
22
+
23
+ ### Placeholder
24
+
25
+ `placeholder` is a pair of strings (`[start, end]`) shown when neither bound is set and the inputs are not
26
+ focus-within, with a swap icon between them. Prefer `helperText` for requirements or instructions that must stay
27
+ visible.
28
+
29
+ ### Helper text
30
+
31
+ Helper text sits below the field for requirements, hints, or errors. Pair `appearance="danger"` with error copy so
32
+ the invalid state is clear visually and to assistive technologies.
33
+
34
+ ### Layout
35
+
36
+ `layout` can be **vertical** (label above) or **horizontal** (label on the leading side). Prefer vertical; use
37
+ horizontal when horizontal space is tight.
38
+
39
+ ## Feedback
40
+
41
+ ### Appearance
42
+
43
+ `appearance` supports **default**, **danger** (invalid / error), and **warning**. Danger also drives the invalid
44
+ state for accessibility in addition to any explicit `isInvalid` flag.
45
+
46
+ ### Disabled
47
+
48
+ Disabled fields cannot be edited and do not receive focus. Values are not submitted with native form submission.
49
+
50
+ ### Read-only
51
+
52
+ Read-only fields cannot be edited; the range stays visible for reading and assistive technologies.
53
+
54
+ ## Accessibility
55
+
56
+ ### Keyboard and pointer behavior
57
+
58
+ * **Tab** moves focus into the segmented fields or calendar trigger; **Shift+Tab** moves out.
59
+ * Arrow keys adjust focused segments; the range calendar grid follows standard date grid and range selection patterns when
60
+ the popover is open.
61
+ * **Space** / **Enter** on the calendar button opens the popover where supported by the platform pattern.
62
+
63
+ ### Labeling and instructions
64
+
65
+ Provide a visible `label` or an accessible name via `aria-label` / `aria-labelledby`. Do not rely on `placeholder` alone
66
+ for the accessible name. Prefer persistent `helperText` for requirements; the string placeholder hides when the user
67
+ focuses or enters either bound.
68
+
69
+ ### Validation and state
70
+
71
+ Use `appearance="danger"` with error content in `helperText` for a consistent error treatment. Set `required` when both
72
+ bounds are mandatory. Disabled fields are not interactive and are excluded from native submission; read-only fields keep
73
+ their values visible but are not editable.
74
+
75
+ Ensure focus indicators remain visible (at least 2px, 3:1 contrast) and interactive targets meet at least 24×24 CSS
76
+ pixels where applicable.