@compilorama/compy 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/cjs/components/button/button.css +1 -1
- package/dist/cjs/components/checkbox/checkbox.css +1 -0
- package/dist/cjs/components/checkbox/checkbox.js +1 -0
- package/dist/cjs/components/checkbox/checkbox.md +31 -0
- package/dist/cjs/components/checkbox/tokens.md +19 -0
- package/dist/cjs/components/input/input.css +1 -0
- package/dist/cjs/components/input/input.js +1 -0
- package/dist/cjs/components/input/input.md +32 -0
- package/dist/cjs/components/input/tokens.md +22 -0
- package/dist/cjs/components/label/label.css +1 -0
- package/dist/cjs/components/label/label.js +1 -0
- package/dist/cjs/components/label/label.md +31 -0
- package/dist/cjs/components/label/tokens.md +10 -0
- package/dist/cjs/components/radio/radio.css +1 -0
- package/dist/cjs/components/radio/radio.js +1 -0
- package/dist/cjs/components/radio/radio.md +33 -0
- package/dist/cjs/components/radio/tokens.md +18 -0
- package/dist/cjs/components/select/select.css +1 -0
- package/dist/cjs/components/select/select.js +1 -0
- package/dist/cjs/components/select/select.md +33 -0
- package/dist/cjs/components/select/tokens.md +25 -0
- package/dist/cjs/components/textarea/textarea.css +1 -0
- package/dist/cjs/components/textarea/textarea.js +1 -0
- package/dist/cjs/components/textarea/textarea.md +32 -0
- package/dist/cjs/components/textarea/tokens.md +22 -0
- package/dist/cjs/docs/components.md +6 -0
- package/dist/cjs/docs/tokens.md +22 -0
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/vars.css +1 -1
- package/dist/docs/components.md +6 -0
- package/dist/docs/tokens.md +22 -0
- package/dist/es6/components/button/button.css +1 -1
- package/dist/es6/components/checkbox/checkbox.css +1 -0
- package/dist/es6/components/checkbox/checkbox.js +1 -0
- package/dist/es6/components/checkbox/checkbox.md +31 -0
- package/dist/es6/components/checkbox/tokens.md +19 -0
- package/dist/es6/components/input/input.css +1 -0
- package/dist/es6/components/input/input.js +1 -0
- package/dist/es6/components/input/input.md +32 -0
- package/dist/es6/components/input/tokens.md +22 -0
- package/dist/es6/components/label/label.css +1 -0
- package/dist/es6/components/label/label.js +1 -0
- package/dist/es6/components/label/label.md +31 -0
- package/dist/es6/components/label/tokens.md +10 -0
- package/dist/es6/components/radio/radio.css +1 -0
- package/dist/es6/components/radio/radio.js +1 -0
- package/dist/es6/components/radio/radio.md +33 -0
- package/dist/es6/components/radio/tokens.md +18 -0
- package/dist/es6/components/select/select.css +1 -0
- package/dist/es6/components/select/select.js +1 -0
- package/dist/es6/components/select/select.md +33 -0
- package/dist/es6/components/select/tokens.md +25 -0
- package/dist/es6/components/textarea/textarea.css +1 -0
- package/dist/es6/components/textarea/textarea.js +1 -0
- package/dist/es6/components/textarea/textarea.md +32 -0
- package/dist/es6/components/textarea/tokens.md +22 -0
- package/dist/es6/docs/components.md +6 -0
- package/dist/es6/docs/tokens.md +22 -0
- package/dist/es6/index.js +1 -1
- package/dist/es6/vars.css +1 -1
- package/dist/index.d.ts +13 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
# [0.4.0](https://github.com/compilorama/compy/compare/v0.3.0...v0.4.0) (2026-11-21)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* add Checkbox component ([b61af3e](https://github.com/compilorama/compy/commit/b61af3e3cbd60699c132cb99678a69b95cdc16f8))
|
|
7
|
+
* add Label component and global font-size tokens ([f8074de](https://github.com/compilorama/compy/commit/f8074debee2c00a3822e8666f30dcff7beb5f753))
|
|
8
|
+
* add Radio component ([914f80a](https://github.com/compilorama/compy/commit/914f80ad15f29072d361a78ab641e2a55aa86567))
|
|
9
|
+
|
|
10
|
+
# [0.3.0](https://github.com/compilorama/compy/compare/v0.2.0...v0.3.0) (2026-11-17)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* add Input, Select, and Textarea form components ([986374e](https://github.com/compilorama/compy/commit/986374e9eb2830087a8cf3154482a059952c108d))
|
|
16
|
+
|
|
1
17
|
# [0.2.0](https://github.com/compilorama/compy/compare/v0.1.0...v0.2.0) (2026-11-16)
|
|
2
18
|
|
|
3
19
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.c-button{--c-button-background: var(--c-color-gray-90);--c-button-background-hover: var(--c-color-gray-95);--c-button-background-disabled: var(--c-color-gray-95);--c-button-content: var(--c-color-gray-10);--c-button-content-disabled: var(--c-color-gray-60);--c-button-border-color: var(--c-color-gray-90);--c-button-border-color-disabled: var(--c-color-gray-95);--c-button-box-shadow-color: var(--c-color-gray-95);--c-button-radius: 10px;--c-button-height: 40px;--c-button-width: auto;--c-button-padding: 10px 25px;display:inline-flex;position:relative;align-items:center;justify-content:center;width:var(--c-button-width);height:var(--c-button-height);padding:var(--c-button-padding);background:var(--c-button-background);color:var(--c-button-content);font-family:var(--c-font-family-primary);font-size:1rem;font-weight:700;line-height:1;border:1px solid var(--c-button-border-color);border-radius:var(--c-button-radius);box-shadow:0 0 0 0 var(--c-button-box-shadow-color);box-sizing:border-box;cursor:pointer;outline:0;transition:
|
|
1
|
+
.c-button{--c-button-background: var(--c-color-gray-90);--c-button-background-hover: var(--c-color-gray-95);--c-button-background-disabled: var(--c-color-gray-95);--c-button-content: var(--c-color-gray-10);--c-button-content-disabled: var(--c-color-gray-60);--c-button-border-color: var(--c-color-gray-90);--c-button-border-color-disabled: var(--c-color-gray-95);--c-button-box-shadow-color: var(--c-color-gray-95);--c-button-radius: 10px;--c-button-height: 40px;--c-button-width: auto;--c-button-padding: 10px 25px;display:inline-flex;position:relative;align-items:center;justify-content:center;width:var(--c-button-width);height:var(--c-button-height);padding:var(--c-button-padding);background:var(--c-button-background);color:var(--c-button-content);font-family:var(--c-font-family-primary);font-size:1rem;font-weight:700;line-height:1;border:1px solid var(--c-button-border-color);border-radius:var(--c-button-radius);box-shadow:0 0 0 0 var(--c-button-box-shadow-color);box-sizing:border-box;cursor:pointer;outline:0;transition:background-color .15s ease-out,border-color .15s ease-out,box-shadow .15s ease-out,color .15s ease-out}.c-button:hover:not(:disabled){background:var(--c-button-background-hover)}.c-button:focus-visible{box-shadow:0 0 0 5px var(--c-button-box-shadow-color)}.c-button.is-accented:not(.is-outline):focus-visible{box-shadow:0 0 0 5px var(--c-color-accented-80)}.c-button.is-outline:focus-visible,.c-button.is-borderless:focus-visible{box-shadow:0 0 0 5px var(--c-color-accented-90)}.c-button:disabled{background:var(--c-button-background-disabled);color:var(--c-button-content-disabled);border-color:var(--c-button-border-color-disabled);cursor:default}.c-button.is-accented{--c-button-background: var(--c-color-accented-10);--c-button-background-hover: var(--c-color-accented-20);--c-button-background-disabled: var(--c-color-accented-30);--c-button-content: var(--c-color-accented-95);--c-button-content-disabled: var(--c-color-accented-80);--c-button-border-color: var(--c-color-accented-10);--c-button-border-color-disabled: var(--c-color-accented-30)}.c-button.is-outline{--c-button-background: transparent;--c-button-background-hover: var(--c-color-gray-95);--c-button-background-disabled: transparent;--c-button-border-color: var(--c-color-gray-70);--c-button-border-color-disabled: var(--c-color-gray-85);--c-button-content: var(--c-color-gray-20)}.c-button.is-borderless{--c-button-background: transparent;--c-button-background-hover: var(--c-color-gray-95);--c-button-background-disabled: transparent;--c-button-border-color: transparent;--c-button-border-color-disabled: transparent;--c-button-content: var(--c-color-gray-30)}.c-button.is-accented.is-outline{--c-button-content: var(--c-color-accented-10);--c-button-content-disabled: var(--c-color-accented-70);--c-button-border-color: var(--c-color-accented-10);--c-button-border-color-disabled: var(--c-color-accented-70)}.c-button.is-accented.is-borderless{--c-button-content: var(--c-color-accented-10)}.c-button.is-round{--c-button-radius: 20px}.c-button.is-isometric{--c-button-height: 40px;--c-button-width: 40px;--c-button-padding: 0}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.c-checkbox-wrapper{display:inline-flex;align-items:center;gap:10px}.c-checkbox-wrapper .c-label:hover:not(.is-disabled){cursor:pointer}.c-checkbox{--c-checkbox-background: var(--c-color-gray-95);--c-checkbox-background-disabled: var(--c-color-gray-85);--c-checkbox-background-checked: var(--c-color-gray-10);--c-checkbox-border-color: var(--c-color-gray-85);--c-checkbox-border-color-disabled: var(--c-color-gray-85);--c-checkbox-border-color-checked: var(--c-color-gray-10);--c-checkbox-check: url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%228.5%22%20height%3D%227.9%22%20viewBox%3D%22386.595%20103.67%208.5%207.855%22%3E%3Cpath%20d%3D%22M395.057,104.851L389.957,111.396C389.917,111.437%20389.851,111.525%20389.77,111.525C389.686,111.525%20389.631,111.466%20389.583,111.418C389.535,111.37%20386.69,108.635%20386.69,108.635L386.635,108.58C386.613,108.547%20386.595,108.507%20386.595,108.463C386.595,108.419%20386.613,108.378%20386.635,108.345C386.65,108.331%20386.66,108.32%20386.675,108.301C386.957,108.004%20387.529,107.403%20387.566,107.367C387.614,107.319%20387.654,107.256%20387.742,107.256C387.834,107.256%20387.892,107.334%20387.936,107.378C387.98,107.421%20389.586,108.965%20389.586,108.965L393.668,103.722C393.704,103.692%20393.749,103.67%20393.796,103.67C393.844,103.67%20393.887,103.688%20393.925,103.718L395.046,104.602C395.076,104.638%20395.094,104.682%20395.094,104.73C395.098,104.778%20395.079,104.818%20395.057,104.851%22%20fill%3D%22white%22%2F%3E%3C%2Fsvg%3E);--c-checkbox-check-disabled: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%228.5%22%20height%3D%227.9%22%20viewBox%3D%22386.595%20103.67%208.5%207.855%22%3E%3Cpath%20d%3D%22M395.057,104.851L389.957,111.396C389.917,111.437%20389.851,111.525%20389.77,111.525C389.686,111.525%20389.631,111.466%20389.583,111.418C389.535,111.37%20386.69,108.635%20386.69,108.635L386.635,108.58C386.613,108.547%20386.595,108.507%20386.595,108.463C386.595,108.419%20386.613,108.378%20386.635,108.345C386.65,108.331%20386.66,108.32%20386.675,108.301C386.957,108.004%20387.529,107.403%20387.566,107.367C387.614,107.319%20387.654,107.256%20387.742,107.256C387.834,107.256%20387.892,107.334%20387.936,107.378C387.98,107.421%20389.586,108.965%20389.586,108.965L393.668,103.722C393.704,103.692%20393.749,103.67%20393.796,103.67C393.844,103.67%20393.887,103.688%20393.925,103.718L395.046,104.602C395.076,104.638%20395.094,104.682%20395.094,104.73C395.098,104.778%20395.079,104.818%20395.057,104.851%22%20fill%3D%22rgb(128,128,128)%22%2F%3E%3C%2Fsvg%3E");--c-checkbox-radius: 5px;--c-checkbox-size: 18px;--c-checkbox-check-size: 8.5px 7.9px;appearance:none;-webkit-appearance:none;-moz-appearance:none;display:inline-block;flex-shrink:0;margin:0;width:var(--c-checkbox-size);height:var(--c-checkbox-size);background-color:var(--c-checkbox-background);background-repeat:no-repeat;background-position:center;background-size:var(--c-checkbox-check-size);border:1px solid var(--c-checkbox-border-color);border-radius:var(--c-checkbox-radius);outline:none;box-shadow:0 0 0 0 var(--c-color-gray-95);box-sizing:border-box;cursor:pointer;transition:background-color .15s ease-out,border-color .15s ease-out,box-shadow .15s ease-out}.c-checkbox:checked{background-color:var(--c-checkbox-background-checked);background-image:var(--c-checkbox-check);border-color:var(--c-checkbox-border-color-checked)}.c-checkbox:focus-visible{box-shadow:0 0 0 5px var(--c-color-gray-95)}.c-checkbox:focus-visible:not(:checked){background-color:#fff}.c-checkbox:focus-visible:checked{box-shadow:0 0 0 5px var(--c-color-accented-80)}.c-checkbox:disabled{background-color:var(--c-checkbox-background-disabled);border-color:var(--c-checkbox-border-color-disabled);cursor:default}.c-checkbox:disabled:checked{background-image:var(--c-checkbox-check-disabled)}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _react=require("react"),_label=_interopRequireDefault(require("../label/label.jsx"));require("./checkbox.css");var _jsxRuntime=require("react/jsx-runtime");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const Checkbox=({id:e,label:r,className:a,...t})=>{const u=(0,_react.useId)(),s=e||u,o=["c-checkbox",a].filter(Boolean).join(" "),c=(0,_jsxRuntime.jsx)("input",{id:r?s:e,className:o,...t,type:"checkbox"});return r?(0,_jsxRuntime.jsxs)("span",{className:"c-checkbox-wrapper",children:[c,(0,_jsxRuntime.jsx)(_label.default,{htmlFor:s,disabled:t.disabled,children:r})]}):c};var _default=exports.default=Checkbox;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Checkbox
|
|
3
|
+
description: A native checkbox input with the library look and an optional built-in label.
|
|
4
|
+
purpose: Let the user turn an option on or off, or pick several options from a list.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Checkbox
|
|
8
|
+
|
|
9
|
+
A styled native `input` of type `checkbox`. Every native input attribute (`checked`, `defaultChecked`, `disabled`, `onChange`, `name`, `id`, etc.) is forwarded to the input. When `label` is given, the component also renders a `Label` next to the input and associates both, so clicking the text toggles the checkbox.
|
|
10
|
+
|
|
11
|
+
## Props
|
|
12
|
+
|
|
13
|
+
The Checkbox API extends the native HTML `input` attributes, except `type`. Props such as `checked`, `disabled` and `onChange` come from the native element and are not listed below.
|
|
14
|
+
|
|
15
|
+
<!-- BEGIN GENERATED PROPS -->
|
|
16
|
+
_Also inherits all props from `Omit<InputHTMLAttributes<HTMLInputElement>, 'type'>`._
|
|
17
|
+
|
|
18
|
+
| Name | Type | Required | Default | Description |
|
|
19
|
+
| --- | --- | --- | --- | --- |
|
|
20
|
+
| label | `string` | No | | Text of the label rendered next to the checkbox and associated with it. |
|
|
21
|
+
<!-- END GENERATED PROPS -->
|
|
22
|
+
|
|
23
|
+
## When to use
|
|
24
|
+
|
|
25
|
+
- Turning a single option on or off, such as accepting terms
|
|
26
|
+
- Letting the user pick any number of options from a list
|
|
27
|
+
|
|
28
|
+
## When NOT to use
|
|
29
|
+
|
|
30
|
+
- **Mutually exclusive options** — use a radio group when only one option can be picked.
|
|
31
|
+
- **Immediate actions** — use a button when the interaction triggers something right away.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Checkbox tokens
|
|
2
|
+
|
|
3
|
+
Generated from `src/components/checkbox/checkbox.css`.
|
|
4
|
+
|
|
5
|
+
## Base tokens
|
|
6
|
+
|
|
7
|
+
| Token | Declared value | Resolution |
|
|
8
|
+
| --- | --- | --- |
|
|
9
|
+
| `--c-checkbox-background` | `var(--c-color-gray-95)` | `var(--c-color-gray-95) → hsl(0 0% 95%)` |
|
|
10
|
+
| `--c-checkbox-background-checked` | `var(--c-color-gray-10)` | `var(--c-color-gray-10) → hsl(0 0% 10%)` |
|
|
11
|
+
| `--c-checkbox-background-disabled` | `var(--c-color-gray-85)` | `var(--c-color-gray-85) → hsl(0 0% 85%)` |
|
|
12
|
+
| `--c-checkbox-border-color` | `var(--c-color-gray-85)` | `var(--c-color-gray-85) → hsl(0 0% 85%)` |
|
|
13
|
+
| `--c-checkbox-border-color-checked` | `var(--c-color-gray-10)` | `var(--c-color-gray-10) → hsl(0 0% 10%)` |
|
|
14
|
+
| `--c-checkbox-border-color-disabled` | `var(--c-color-gray-85)` | `var(--c-color-gray-85) → hsl(0 0% 85%)` |
|
|
15
|
+
| `--c-checkbox-check` | `url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%228.5%22%20height%3D%227.9%22%20viewBox%3D%22386.595%20103.67%208.5%207.855%22%3E%3Cpath%20d%3D%22M395.057,104.851L389.957,111.396C389.917,111.437%20389.851,111.525%20389.77,111.525C389.686,111.525%20389.631,111.466%20389.583,111.418C389.535,111.37%20386.69,108.635%20386.69,108.635L386.635,108.58C386.613,108.547%20386.595,108.507%20386.595,108.463C386.595,108.419%20386.613,108.378%20386.635,108.345C386.65,108.331%20386.66,108.32%20386.675,108.301C386.957,108.004%20387.529,107.403%20387.566,107.367C387.614,107.319%20387.654,107.256%20387.742,107.256C387.834,107.256%20387.892,107.334%20387.936,107.378C387.98,107.421%20389.586,108.965%20389.586,108.965L393.668,103.722C393.704,103.692%20393.749,103.67%20393.796,103.67C393.844,103.67%20393.887,103.688%20393.925,103.718L395.046,104.602C395.076,104.638%20395.094,104.682%20395.094,104.73C395.098,104.778%20395.079,104.818%20395.057,104.851%22%20fill%3D%22white%22%2F%3E%3C%2Fsvg%3E")` | `url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%228.5%22%20height%3D%227.9%22%20viewBox%3D%22386.595%20103.67%208.5%207.855%22%3E%3Cpath%20d%3D%22M395.057,104.851L389.957,111.396C389.917,111.437%20389.851,111.525%20389.77,111.525C389.686,111.525%20389.631,111.466%20389.583,111.418C389.535,111.37%20386.69,108.635%20386.69,108.635L386.635,108.58C386.613,108.547%20386.595,108.507%20386.595,108.463C386.595,108.419%20386.613,108.378%20386.635,108.345C386.65,108.331%20386.66,108.32%20386.675,108.301C386.957,108.004%20387.529,107.403%20387.566,107.367C387.614,107.319%20387.654,107.256%20387.742,107.256C387.834,107.256%20387.892,107.334%20387.936,107.378C387.98,107.421%20389.586,108.965%20389.586,108.965L393.668,103.722C393.704,103.692%20393.749,103.67%20393.796,103.67C393.844,103.67%20393.887,103.688%20393.925,103.718L395.046,104.602C395.076,104.638%20395.094,104.682%20395.094,104.73C395.098,104.778%20395.079,104.818%20395.057,104.851%22%20fill%3D%22white%22%2F%3E%3C%2Fsvg%3E")` |
|
|
16
|
+
| `--c-checkbox-check-disabled` | `url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%228.5%22%20height%3D%227.9%22%20viewBox%3D%22386.595%20103.67%208.5%207.855%22%3E%3Cpath%20d%3D%22M395.057,104.851L389.957,111.396C389.917,111.437%20389.851,111.525%20389.77,111.525C389.686,111.525%20389.631,111.466%20389.583,111.418C389.535,111.37%20386.69,108.635%20386.69,108.635L386.635,108.58C386.613,108.547%20386.595,108.507%20386.595,108.463C386.595,108.419%20386.613,108.378%20386.635,108.345C386.65,108.331%20386.66,108.32%20386.675,108.301C386.957,108.004%20387.529,107.403%20387.566,107.367C387.614,107.319%20387.654,107.256%20387.742,107.256C387.834,107.256%20387.892,107.334%20387.936,107.378C387.98,107.421%20389.586,108.965%20389.586,108.965L393.668,103.722C393.704,103.692%20393.749,103.67%20393.796,103.67C393.844,103.67%20393.887,103.688%20393.925,103.718L395.046,104.602C395.076,104.638%20395.094,104.682%20395.094,104.73C395.098,104.778%20395.079,104.818%20395.057,104.851%22%20fill%3D%22rgb(128,128,128)%22%2F%3E%3C%2Fsvg%3E")` | `url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%228.5%22%20height%3D%227.9%22%20viewBox%3D%22386.595%20103.67%208.5%207.855%22%3E%3Cpath%20d%3D%22M395.057,104.851L389.957,111.396C389.917,111.437%20389.851,111.525%20389.77,111.525C389.686,111.525%20389.631,111.466%20389.583,111.418C389.535,111.37%20386.69,108.635%20386.69,108.635L386.635,108.58C386.613,108.547%20386.595,108.507%20386.595,108.463C386.595,108.419%20386.613,108.378%20386.635,108.345C386.65,108.331%20386.66,108.32%20386.675,108.301C386.957,108.004%20387.529,107.403%20387.566,107.367C387.614,107.319%20387.654,107.256%20387.742,107.256C387.834,107.256%20387.892,107.334%20387.936,107.378C387.98,107.421%20389.586,108.965%20389.586,108.965L393.668,103.722C393.704,103.692%20393.749,103.67%20393.796,103.67C393.844,103.67%20393.887,103.688%20393.925,103.718L395.046,104.602C395.076,104.638%20395.094,104.682%20395.094,104.73C395.098,104.778%20395.079,104.818%20395.057,104.851%22%20fill%3D%22rgb(128,128,128)%22%2F%3E%3C%2Fsvg%3E")` |
|
|
17
|
+
| `--c-checkbox-check-size` | `8.5px 7.9px` | `8.5px 7.9px` |
|
|
18
|
+
| `--c-checkbox-radius` | `5px` | `5px` |
|
|
19
|
+
| `--c-checkbox-size` | `18px` | `18px` |
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.c-input{--c-input-background: var(--c-color-gray-95);--c-input-background-focus: #ffffff;--c-input-background-disabled: var(--c-color-gray-85);--c-input-content: var(--c-color-gray-15);--c-input-content-disabled: var(--c-color-gray-30);--c-input-placeholder: var(--c-color-gray-60);--c-input-placeholder-focus: var(--c-color-gray-70);--c-input-placeholder-disabled: var(--c-color-gray-50);--c-input-border-color: var(--c-color-gray-85);--c-input-border-color-invalid: var(--c-color-red-70);--c-input-border-color-disabled: var(--c-color-gray-85);--c-input-radius: 10px;--c-input-height: 40px;--c-input-padding: 10px 15px;box-sizing:border-box;width:100%;height:var(--c-input-height);padding:var(--c-input-padding);background:var(--c-input-background);color:var(--c-input-content);font-family:var(--c-font-family-primary);font-size:1rem;line-height:1;border:1px solid var(--c-input-border-color);border-radius:var(--c-input-radius);outline:none;box-shadow:0 0 0 0 var(--c-color-gray-95);transition:background-color .15s ease-out,border-color .15s ease-out,box-shadow .15s ease-out,color .15s ease-out}.c-input::placeholder{color:var(--c-input-placeholder)}.c-input:focus-visible{background:var(--c-input-background-focus);box-shadow:0 0 0 5px var(--c-color-gray-95)}.c-input:focus-visible::placeholder{color:var(--c-input-placeholder-focus)}.c-input:disabled{background:var(--c-input-background-disabled);color:var(--c-input-content-disabled);border-color:var(--c-input-border-color-disabled)}.c-input:disabled::placeholder{color:var(--c-input-placeholder-disabled)}.c-input.is-invalid{border-color:var(--c-input-border-color-invalid)}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0,require("./input.css");var _jsxRuntime=require("react/jsx-runtime");const Input=({invalid:s,className:t,...e})=>{const u=buildInputClasses({invalid:s,className:t});return(0,_jsxRuntime.jsx)("input",{className:u,...e})};function buildInputClasses({invalid:s,className:t}){const e=["c-input"];return s&&e.push("is-invalid"),[...e,t].filter(Boolean).join(" ")}var _default=exports.default=Input;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Input
|
|
3
|
+
description: A single-line text field that extends the native HTML input element.
|
|
4
|
+
purpose: Collect short text values in forms with consistent field styling and error indication.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Input
|
|
8
|
+
|
|
9
|
+
A single-line text field. It extends the native HTML `input` element, so every native attribute (`type`, `value`, `placeholder`, `disabled`, `onChange`, etc.) is accepted. The component adds one visual prop, `invalid`, that marks the field as having an error.
|
|
10
|
+
|
|
11
|
+
## Props
|
|
12
|
+
|
|
13
|
+
The Input API extends the native HTML `input` attributes. Props such as `disabled` and `placeholder` come from the native element and are not listed below.
|
|
14
|
+
|
|
15
|
+
<!-- BEGIN GENERATED PROPS -->
|
|
16
|
+
_Also inherits all props from `InputHTMLAttributes<HTMLInputElement>`._
|
|
17
|
+
|
|
18
|
+
| Name | Type | Required | Default | Description |
|
|
19
|
+
| --- | --- | --- | --- | --- |
|
|
20
|
+
| invalid | `boolean` | No | `false` | Marks the field as invalid by changing its border to the error color. |
|
|
21
|
+
<!-- END GENERATED PROPS -->
|
|
22
|
+
|
|
23
|
+
## When to use
|
|
24
|
+
|
|
25
|
+
- Collecting short text such as name, email, or search queries
|
|
26
|
+
- Form fields where a single line of text is enough
|
|
27
|
+
- Surfacing validation errors with the `invalid` prop alongside accessible error messaging
|
|
28
|
+
|
|
29
|
+
## When NOT to use
|
|
30
|
+
|
|
31
|
+
- **Multi-line text** — use a textarea for longer or formatted text.
|
|
32
|
+
- **Fixed option lists** — use a select or radio group when the user must pick from predefined choices.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Input tokens
|
|
2
|
+
|
|
3
|
+
Generated from `src/components/input/input.css`.
|
|
4
|
+
|
|
5
|
+
## Base tokens
|
|
6
|
+
|
|
7
|
+
| Token | Declared value | Resolution |
|
|
8
|
+
| --- | --- | --- |
|
|
9
|
+
| `--c-input-background` | `var(--c-color-gray-95)` | `var(--c-color-gray-95) → hsl(0 0% 95%)` |
|
|
10
|
+
| `--c-input-background-disabled` | `var(--c-color-gray-85)` | `var(--c-color-gray-85) → hsl(0 0% 85%)` |
|
|
11
|
+
| `--c-input-background-focus` | `#ffffff` | `#ffffff` |
|
|
12
|
+
| `--c-input-border-color` | `var(--c-color-gray-85)` | `var(--c-color-gray-85) → hsl(0 0% 85%)` |
|
|
13
|
+
| `--c-input-border-color-disabled` | `var(--c-color-gray-85)` | `var(--c-color-gray-85) → hsl(0 0% 85%)` |
|
|
14
|
+
| `--c-input-border-color-invalid` | `var(--c-color-red-70)` | `var(--c-color-red-70) → hsl(0 100% 70%)` |
|
|
15
|
+
| `--c-input-content` | `var(--c-color-gray-15)` | `var(--c-color-gray-15) → hsl(0 0% 15%)` |
|
|
16
|
+
| `--c-input-content-disabled` | `var(--c-color-gray-30)` | `var(--c-color-gray-30) → hsl(0 0% 30%)` |
|
|
17
|
+
| `--c-input-height` | `40px` | `40px` |
|
|
18
|
+
| `--c-input-padding` | `10px 15px` | `10px 15px` |
|
|
19
|
+
| `--c-input-placeholder` | `var(--c-color-gray-60)` | `var(--c-color-gray-60) → hsl(0 0% 60%)` |
|
|
20
|
+
| `--c-input-placeholder-disabled` | `var(--c-color-gray-50)` | `var(--c-color-gray-50) → hsl(0 0% 50%)` |
|
|
21
|
+
| `--c-input-placeholder-focus` | `var(--c-color-gray-70)` | `var(--c-color-gray-70) → hsl(0 0% 70%)` |
|
|
22
|
+
| `--c-input-radius` | `10px` | `10px` |
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.c-label{--c-label-content: var(--c-color-gray-15);--c-label-content-disabled: var(--c-color-gray-50);color:var(--c-label-content);font-family:var(--c-font-family-primary);font-size:var(--c-font-size-xs);font-weight:600}.c-label.is-disabled{color:var(--c-label-content-disabled)}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0,require("./label.css");var _jsxRuntime=require("react/jsx-runtime");const Label=({disabled:s,className:l,children:e,...r})=>{const t=buildLabelClasses({disabled:s,className:l});return(0,_jsxRuntime.jsx)("label",{className:t,...r,children:e})};function buildLabelClasses({disabled:s,className:l}){const e=["c-label"];return s&&e.push("is-disabled"),[...e,l].filter(Boolean).join(" ")}var _default=exports.default=Label;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Label
|
|
3
|
+
description: A text label that extends the native HTML label element.
|
|
4
|
+
purpose: Name a form control with consistent label typography, on its own or next to any control.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Label
|
|
8
|
+
|
|
9
|
+
A standalone form label. It extends the native HTML `label` element, so every native attribute (`htmlFor`, `className`, `data-*`, etc.) is accepted. The component adds one visual prop, `disabled`, that renders the text in the disabled color.
|
|
10
|
+
|
|
11
|
+
## Props
|
|
12
|
+
|
|
13
|
+
The Label API extends the native HTML `label` attributes. Props such as `htmlFor` come from the native element and are not listed below.
|
|
14
|
+
|
|
15
|
+
<!-- BEGIN GENERATED PROPS -->
|
|
16
|
+
_Also inherits all props from `LabelHTMLAttributes<HTMLLabelElement>`._
|
|
17
|
+
|
|
18
|
+
| Name | Type | Required | Default | Description |
|
|
19
|
+
| --- | --- | --- | --- | --- |
|
|
20
|
+
| disabled | `boolean` | No | `false` | Renders the text in the disabled color. Visual only: it does not disable any control. |
|
|
21
|
+
<!-- END GENERATED PROPS -->
|
|
22
|
+
|
|
23
|
+
## When to use
|
|
24
|
+
|
|
25
|
+
- Naming a form control by pairing `htmlFor` with the control `id`
|
|
26
|
+
- Showing a label that follows the library typography, with a disabled look next to a disabled control
|
|
27
|
+
|
|
28
|
+
## When NOT to use
|
|
29
|
+
|
|
30
|
+
- **Checkbox or radio captions** — use the `label` prop of the checkbox or radio component, which renders and associates a label for you.
|
|
31
|
+
- **Disabling a control** — the `disabled` prop is visual only; disable the control itself.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Label tokens
|
|
2
|
+
|
|
3
|
+
Generated from `src/components/label/label.css`.
|
|
4
|
+
|
|
5
|
+
## Base tokens
|
|
6
|
+
|
|
7
|
+
| Token | Declared value | Resolution |
|
|
8
|
+
| --- | --- | --- |
|
|
9
|
+
| `--c-label-content` | `var(--c-color-gray-15)` | `var(--c-color-gray-15) → hsl(0 0% 15%)` |
|
|
10
|
+
| `--c-label-content-disabled` | `var(--c-color-gray-50)` | `var(--c-color-gray-50) → hsl(0 0% 50%)` |
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.c-radio-wrapper{display:inline-flex;align-items:center;gap:10px}.c-radio-wrapper .c-label:hover:not(.is-disabled){cursor:pointer}.c-radio{--c-radio-background: var(--c-color-gray-95);--c-radio-background-disabled: var(--c-color-gray-85);--c-radio-background-checked: var(--c-color-gray-10);--c-radio-border-color: var(--c-color-gray-85);--c-radio-border-color-disabled: var(--c-color-gray-85);--c-radio-border-color-checked: var(--c-color-gray-10);--c-radio-check: url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%228.5%22%20height%3D%227.9%22%20viewBox%3D%22386.595%20103.67%208.5%207.855%22%3E%3Cpath%20d%3D%22M395.057,104.851L389.957,111.396C389.917,111.437%20389.851,111.525%20389.77,111.525C389.686,111.525%20389.631,111.466%20389.583,111.418C389.535,111.37%20386.69,108.635%20386.69,108.635L386.635,108.58C386.613,108.547%20386.595,108.507%20386.595,108.463C386.595,108.419%20386.613,108.378%20386.635,108.345C386.65,108.331%20386.66,108.32%20386.675,108.301C386.957,108.004%20387.529,107.403%20387.566,107.367C387.614,107.319%20387.654,107.256%20387.742,107.256C387.834,107.256%20387.892,107.334%20387.936,107.378C387.98,107.421%20389.586,108.965%20389.586,108.965L393.668,103.722C393.704,103.692%20393.749,103.67%20393.796,103.67C393.844,103.67%20393.887,103.688%20393.925,103.718L395.046,104.602C395.076,104.638%20395.094,104.682%20395.094,104.73C395.098,104.778%20395.079,104.818%20395.057,104.851%22%20fill%3D%22white%22%2F%3E%3C%2Fsvg%3E);--c-radio-check-disabled: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%228.5%22%20height%3D%227.9%22%20viewBox%3D%22386.595%20103.67%208.5%207.855%22%3E%3Cpath%20d%3D%22M395.057,104.851L389.957,111.396C389.917,111.437%20389.851,111.525%20389.77,111.525C389.686,111.525%20389.631,111.466%20389.583,111.418C389.535,111.37%20386.69,108.635%20386.69,108.635L386.635,108.58C386.613,108.547%20386.595,108.507%20386.595,108.463C386.595,108.419%20386.613,108.378%20386.635,108.345C386.65,108.331%20386.66,108.32%20386.675,108.301C386.957,108.004%20387.529,107.403%20387.566,107.367C387.614,107.319%20387.654,107.256%20387.742,107.256C387.834,107.256%20387.892,107.334%20387.936,107.378C387.98,107.421%20389.586,108.965%20389.586,108.965L393.668,103.722C393.704,103.692%20393.749,103.67%20393.796,103.67C393.844,103.67%20393.887,103.688%20393.925,103.718L395.046,104.602C395.076,104.638%20395.094,104.682%20395.094,104.73C395.098,104.778%20395.079,104.818%20395.057,104.851%22%20fill%3D%22rgb(128,128,128)%22%2F%3E%3C%2Fsvg%3E");--c-radio-size: 18px;--c-radio-check-size: 8.5px 7.9px;appearance:none;-webkit-appearance:none;-moz-appearance:none;display:inline-block;flex-shrink:0;margin:0;width:var(--c-radio-size);height:var(--c-radio-size);background-color:var(--c-radio-background);background-repeat:no-repeat;background-position:center;background-size:var(--c-radio-check-size);border:1px solid var(--c-radio-border-color);border-radius:50%;outline:none;box-shadow:0 0 0 0 var(--c-color-gray-95);box-sizing:border-box;cursor:pointer;transition:background-color .15s ease-out,border-color .15s ease-out,box-shadow .15s ease-out}.c-radio:checked{background-color:var(--c-radio-background-checked);background-image:var(--c-radio-check);border-color:var(--c-radio-border-color-checked)}.c-radio:focus-visible{box-shadow:0 0 0 5px var(--c-color-gray-95)}.c-radio:focus-visible:not(:checked){background-color:#fff}.c-radio:focus-visible:checked{box-shadow:0 0 0 5px var(--c-color-accented-80)}.c-radio:disabled{background-color:var(--c-radio-background-disabled);border-color:var(--c-radio-border-color-disabled);cursor:default}.c-radio:disabled:checked{background-image:var(--c-radio-check-disabled)}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _react=require("react"),_label=_interopRequireDefault(require("../label/label.jsx"));require("./radio.css");var _jsxRuntime=require("react/jsx-runtime");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const Radio=({id:e,label:r,className:i,...t})=>{const u=(0,_react.useId)(),a=e||u,d=["c-radio",i].filter(Boolean).join(" "),s=(0,_jsxRuntime.jsx)("input",{id:r?a:e,className:d,...t,type:"radio"});return r?(0,_jsxRuntime.jsxs)("span",{className:"c-radio-wrapper",children:[s,(0,_jsxRuntime.jsx)(_label.default,{htmlFor:a,disabled:t.disabled,children:r})]}):s};var _default=exports.default=Radio;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Radio
|
|
3
|
+
description: A native radio input with the library look and an optional built-in label.
|
|
4
|
+
purpose: Let the user pick exactly one option from a small group of mutually exclusive options.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Radio
|
|
8
|
+
|
|
9
|
+
A styled native `input` of type `radio`. Every native input attribute (`checked`, `defaultChecked`, `disabled`, `onChange`, `name`, `value`, `id`, etc.) is forwarded to the input. Radios sharing a `name` are mutually exclusive, with native keyboard navigation. When `label` is given, the component also renders a `Label` next to the input and associates both, so clicking the text selects the radio.
|
|
10
|
+
|
|
11
|
+
## Props
|
|
12
|
+
|
|
13
|
+
The Radio API extends the native HTML `input` attributes, except `type`. Props such as `name`, `checked` and `onChange` come from the native element and are not listed below.
|
|
14
|
+
|
|
15
|
+
> **Note:** always pass the same `name` to every radio in a group. Without it, each radio becomes its own group: the keyboard focuses each one separately and the arrow keys do not move between options.
|
|
16
|
+
|
|
17
|
+
<!-- BEGIN GENERATED PROPS -->
|
|
18
|
+
_Also inherits all props from `Omit<InputHTMLAttributes<HTMLInputElement>, 'type'>`._
|
|
19
|
+
|
|
20
|
+
| Name | Type | Required | Default | Description |
|
|
21
|
+
| --- | --- | --- | --- | --- |
|
|
22
|
+
| label | `string` | No | | Text of the label rendered next to the radio and associated with it. |
|
|
23
|
+
<!-- END GENERATED PROPS -->
|
|
24
|
+
|
|
25
|
+
## When to use
|
|
26
|
+
|
|
27
|
+
- Picking exactly one option from a short, visible list
|
|
28
|
+
- Groups of options where the user should compare all choices at once
|
|
29
|
+
|
|
30
|
+
## When NOT to use
|
|
31
|
+
|
|
32
|
+
- **Multiple selections** — use checkboxes when any number of options can be picked.
|
|
33
|
+
- **Long option lists** — use a select when there are many options.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Radio tokens
|
|
2
|
+
|
|
3
|
+
Generated from `src/components/radio/radio.css`.
|
|
4
|
+
|
|
5
|
+
## Base tokens
|
|
6
|
+
|
|
7
|
+
| Token | Declared value | Resolution |
|
|
8
|
+
| --- | --- | --- |
|
|
9
|
+
| `--c-radio-background` | `var(--c-color-gray-95)` | `var(--c-color-gray-95) → hsl(0 0% 95%)` |
|
|
10
|
+
| `--c-radio-background-checked` | `var(--c-color-gray-10)` | `var(--c-color-gray-10) → hsl(0 0% 10%)` |
|
|
11
|
+
| `--c-radio-background-disabled` | `var(--c-color-gray-85)` | `var(--c-color-gray-85) → hsl(0 0% 85%)` |
|
|
12
|
+
| `--c-radio-border-color` | `var(--c-color-gray-85)` | `var(--c-color-gray-85) → hsl(0 0% 85%)` |
|
|
13
|
+
| `--c-radio-border-color-checked` | `var(--c-color-gray-10)` | `var(--c-color-gray-10) → hsl(0 0% 10%)` |
|
|
14
|
+
| `--c-radio-border-color-disabled` | `var(--c-color-gray-85)` | `var(--c-color-gray-85) → hsl(0 0% 85%)` |
|
|
15
|
+
| `--c-radio-check` | `url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%228.5%22%20height%3D%227.9%22%20viewBox%3D%22386.595%20103.67%208.5%207.855%22%3E%3Cpath%20d%3D%22M395.057,104.851L389.957,111.396C389.917,111.437%20389.851,111.525%20389.77,111.525C389.686,111.525%20389.631,111.466%20389.583,111.418C389.535,111.37%20386.69,108.635%20386.69,108.635L386.635,108.58C386.613,108.547%20386.595,108.507%20386.595,108.463C386.595,108.419%20386.613,108.378%20386.635,108.345C386.65,108.331%20386.66,108.32%20386.675,108.301C386.957,108.004%20387.529,107.403%20387.566,107.367C387.614,107.319%20387.654,107.256%20387.742,107.256C387.834,107.256%20387.892,107.334%20387.936,107.378C387.98,107.421%20389.586,108.965%20389.586,108.965L393.668,103.722C393.704,103.692%20393.749,103.67%20393.796,103.67C393.844,103.67%20393.887,103.688%20393.925,103.718L395.046,104.602C395.076,104.638%20395.094,104.682%20395.094,104.73C395.098,104.778%20395.079,104.818%20395.057,104.851%22%20fill%3D%22white%22%2F%3E%3C%2Fsvg%3E")` | `url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%228.5%22%20height%3D%227.9%22%20viewBox%3D%22386.595%20103.67%208.5%207.855%22%3E%3Cpath%20d%3D%22M395.057,104.851L389.957,111.396C389.917,111.437%20389.851,111.525%20389.77,111.525C389.686,111.525%20389.631,111.466%20389.583,111.418C389.535,111.37%20386.69,108.635%20386.69,108.635L386.635,108.58C386.613,108.547%20386.595,108.507%20386.595,108.463C386.595,108.419%20386.613,108.378%20386.635,108.345C386.65,108.331%20386.66,108.32%20386.675,108.301C386.957,108.004%20387.529,107.403%20387.566,107.367C387.614,107.319%20387.654,107.256%20387.742,107.256C387.834,107.256%20387.892,107.334%20387.936,107.378C387.98,107.421%20389.586,108.965%20389.586,108.965L393.668,103.722C393.704,103.692%20393.749,103.67%20393.796,103.67C393.844,103.67%20393.887,103.688%20393.925,103.718L395.046,104.602C395.076,104.638%20395.094,104.682%20395.094,104.73C395.098,104.778%20395.079,104.818%20395.057,104.851%22%20fill%3D%22white%22%2F%3E%3C%2Fsvg%3E")` |
|
|
16
|
+
| `--c-radio-check-disabled` | `url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%228.5%22%20height%3D%227.9%22%20viewBox%3D%22386.595%20103.67%208.5%207.855%22%3E%3Cpath%20d%3D%22M395.057,104.851L389.957,111.396C389.917,111.437%20389.851,111.525%20389.77,111.525C389.686,111.525%20389.631,111.466%20389.583,111.418C389.535,111.37%20386.69,108.635%20386.69,108.635L386.635,108.58C386.613,108.547%20386.595,108.507%20386.595,108.463C386.595,108.419%20386.613,108.378%20386.635,108.345C386.65,108.331%20386.66,108.32%20386.675,108.301C386.957,108.004%20387.529,107.403%20387.566,107.367C387.614,107.319%20387.654,107.256%20387.742,107.256C387.834,107.256%20387.892,107.334%20387.936,107.378C387.98,107.421%20389.586,108.965%20389.586,108.965L393.668,103.722C393.704,103.692%20393.749,103.67%20393.796,103.67C393.844,103.67%20393.887,103.688%20393.925,103.718L395.046,104.602C395.076,104.638%20395.094,104.682%20395.094,104.73C395.098,104.778%20395.079,104.818%20395.057,104.851%22%20fill%3D%22rgb(128,128,128)%22%2F%3E%3C%2Fsvg%3E")` | `url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%228.5%22%20height%3D%227.9%22%20viewBox%3D%22386.595%20103.67%208.5%207.855%22%3E%3Cpath%20d%3D%22M395.057,104.851L389.957,111.396C389.917,111.437%20389.851,111.525%20389.77,111.525C389.686,111.525%20389.631,111.466%20389.583,111.418C389.535,111.37%20386.69,108.635%20386.69,108.635L386.635,108.58C386.613,108.547%20386.595,108.507%20386.595,108.463C386.595,108.419%20386.613,108.378%20386.635,108.345C386.65,108.331%20386.66,108.32%20386.675,108.301C386.957,108.004%20387.529,107.403%20387.566,107.367C387.614,107.319%20387.654,107.256%20387.742,107.256C387.834,107.256%20387.892,107.334%20387.936,107.378C387.98,107.421%20389.586,108.965%20389.586,108.965L393.668,103.722C393.704,103.692%20393.749,103.67%20393.796,103.67C393.844,103.67%20393.887,103.688%20393.925,103.718L395.046,104.602C395.076,104.638%20395.094,104.682%20395.094,104.73C395.098,104.778%20395.079,104.818%20395.057,104.851%22%20fill%3D%22rgb(128,128,128)%22%2F%3E%3C%2Fsvg%3E")` |
|
|
17
|
+
| `--c-radio-check-size` | `8.5px 7.9px` | `8.5px 7.9px` |
|
|
18
|
+
| `--c-radio-size` | `18px` | `18px` |
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.c-select{--c-select-background: var(--c-color-gray-95);--c-select-background-focus: #ffffff;--c-select-background-disabled: var(--c-color-gray-85);--c-select-content: var(--c-color-gray-15);--c-select-content-disabled: var(--c-color-gray-30);--c-select-placeholder: var(--c-color-gray-60);--c-select-placeholder-focus: var(--c-color-gray-70);--c-select-placeholder-disabled: var(--c-color-gray-50);--c-select-border-color: var(--c-select-background);--c-select-border-color-focus: var(--c-color-gray-85);--c-select-border-color-invalid: var(--c-color-red-70);--c-select-border-color-disabled: var(--c-select-background-disabled);--c-select-arrow: url("data:image/svg+xml,%3Csvg%20width%3D%22100%25%22%20height%3D%22100%25%22%20viewBox%3D%220%200%2040%2040%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20style%3D%22fill-rule%3Aevenodd%3Bclip-rule%3Aevenodd%3Bstroke-linecap%3Around%3Bstroke-miterlimit%3A10%3B%22%3E%20%3Crect%20x%3D%220%22%20y%3D%220%22%20width%3D%2240%22%20height%3D%2240%22%20style%3D%22fill%3Anone%3B%22%2F%3E%20%3Cpath%20d%3D%22M23.07%2C16L20%2C12.93L16.93%2C16M16.93%2C24L20%2C27.07L23.07%2C24%22%20style%3D%22fill%3Anone%3Bfill-rule%3Anonzero%3Bstroke%3Argb(38%2C38%2C38)%3Bstroke-width%3A1px%3B%22%2F%3E%20%3C%2Fsvg%3E");--c-select-arrow-disabled: url("data:image/svg+xml,%3Csvg%20width%3D%22100%25%22%20height%3D%22100%25%22%20viewBox%3D%220%200%2040%2040%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20style%3D%22fill-rule%3Aevenodd%3Bclip-rule%3Aevenodd%3Bstroke-linecap%3Around%3Bstroke-miterlimit%3A10%3B%22%3E%20%3Crect%20x%3D%220%22%20y%3D%220%22%20width%3D%2240%22%20height%3D%2240%22%20style%3D%22fill%3Anone%3B%22%2F%3E%20%3Cpath%20d%3D%22M23.07%2C16L20%2C12.93L16.93%2C16M16.93%2C24L20%2C27.07L23.07%2C24%22%20style%3D%22fill%3Anone%3Bfill-rule%3Anonzero%3Bstroke%3Argb(128%2C128%2C128)%3Bstroke-width%3A1px%3B%22%2F%3E%20%3C%2Fsvg%3E");--c-select-radius: 10px;--c-select-height: 40px;--c-select-padding: 10px 40px 10px 15px;appearance:none;-webkit-appearance:none;-moz-appearance:none;box-sizing:border-box;width:100%;height:var(--c-select-height);padding:var(--c-select-padding);background-color:var(--c-select-background);background-image:var(--c-select-arrow);background-repeat:no-repeat;background-position:right center;background-size:40px 40px;color:var(--c-select-content);font-family:var(--c-font-family-primary);font-size:1rem;line-height:1;border:1px solid var(--c-select-border-color);border-radius:var(--c-select-radius);outline:none;box-shadow:0 0 0 0 var(--c-color-gray-95);cursor:pointer;transition:background-color .15s ease-out,border-color .15s ease-out,box-shadow .15s ease-out,color .15s ease-out}.c-select:focus-visible{background-color:var(--c-select-background-focus);border-color:var(--c-select-border-color-focus);box-shadow:0 0 0 5px var(--c-color-gray-95)}.c-select:disabled{background-color:var(--c-select-background-disabled);background-image:var(--c-select-arrow-disabled);color:var(--c-select-content-disabled);border-color:var(--c-select-border-color-disabled);cursor:default;opacity:1}.c-select.is-blank{color:var(--c-select-placeholder)}.c-select.is-blank:focus-visible{color:var(--c-select-placeholder-focus)}.c-select.is-blank:disabled{color:var(--c-select-placeholder-disabled)}.c-select.is-invalid{border-color:var(--c-select-border-color-invalid)}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _react=require("react");require("./select.css");var _jsxRuntime=require("react/jsx-runtime");const Select=({invalid:t,className:r,value:s,onChange:e,children:n,...u})=>{const a=(0,_react.useRef)(),[i,l]=(0,_react.useState)(!1),o=buildSelectClasses({invalid:t,isBlank:i,className:r}),f=c=>{l(c.target.value===""),e?.(c)};return(0,_react.useEffect)(()=>{l(a.current.value==="")},[s]),(0,_jsxRuntime.jsx)("select",{ref:a,className:o,value:s,...u,onChange:f,children:n})};function buildSelectClasses({invalid:t,isBlank:r,className:s}){const e=["c-select"];return t&&e.push("is-invalid"),r&&e.push("is-blank"),[...e,s].filter(Boolean).join(" ")}var _default=exports.default=Select;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Select
|
|
3
|
+
description: Dropdown field that lets the user choose one option from a fixed list.
|
|
4
|
+
purpose: Let the user choose one option from a fixed list.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Select
|
|
8
|
+
|
|
9
|
+
A dropdown field. It extends the native HTML `select` element, so every native attribute (`value`, `multiple`, `disabled`, `onChange`, etc.) is accepted. The component adds one visual prop, `invalid`, that marks the field as having an error. The border matches the fill color in every state except `focus-visible` (`gray-85` on a white fill) and `invalid` (`red-70`).
|
|
10
|
+
|
|
11
|
+
## Props
|
|
12
|
+
|
|
13
|
+
The Select API extends the native HTML `select` attributes. Props such as `disabled` and `value` come from the native element and are not listed below.
|
|
14
|
+
|
|
15
|
+
<!-- BEGIN GENERATED PROPS -->
|
|
16
|
+
_Also inherits all props from `SelectHTMLAttributes<HTMLSelectElement>`._
|
|
17
|
+
|
|
18
|
+
| Name | Type | Required | Default | Description |
|
|
19
|
+
| --- | --- | --- | --- | --- |
|
|
20
|
+
| children | `ReactNode` | No | `undefined` | Option elements rendered inside the select. |
|
|
21
|
+
| invalid | `boolean` | No | `false` | Marks the field as invalid by changing its border to the error color. |
|
|
22
|
+
<!-- END GENERATED PROPS -->
|
|
23
|
+
|
|
24
|
+
## When to use
|
|
25
|
+
|
|
26
|
+
- Choosing one option from a fixed list of values
|
|
27
|
+
- Form fields where a compact dropdown is enough
|
|
28
|
+
- Surfacing validation errors with the `invalid` prop alongside accessible error messaging
|
|
29
|
+
|
|
30
|
+
## When NOT to use
|
|
31
|
+
|
|
32
|
+
- **Free text** — use Input or Textarea when the user types their own value.
|
|
33
|
+
- **Few always-visible options** — use a radio group when all choices should stay on screen.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Select tokens
|
|
2
|
+
|
|
3
|
+
Generated from `src/components/select/select.css`.
|
|
4
|
+
|
|
5
|
+
## Base tokens
|
|
6
|
+
|
|
7
|
+
| Token | Declared value | Resolution |
|
|
8
|
+
| --- | --- | --- |
|
|
9
|
+
| `--c-select-arrow` | `url("data:image/svg+xml,%3Csvg%20width%3D%22100%25%22%20height%3D%22100%25%22%20viewBox%3D%220%200%2040%2040%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20style%3D%22fill-rule%3Aevenodd%3Bclip-rule%3Aevenodd%3Bstroke-linecap%3Around%3Bstroke-miterlimit%3A10%3B%22%3E%20%3Crect%20x%3D%220%22%20y%3D%220%22%20width%3D%2240%22%20height%3D%2240%22%20style%3D%22fill%3Anone%3B%22%2F%3E%20%3Cpath%20d%3D%22M23.07%2C16L20%2C12.93L16.93%2C16M16.93%2C24L20%2C27.07L23.07%2C24%22%20style%3D%22fill%3Anone%3Bfill-rule%3Anonzero%3Bstroke%3Argb(38%2C38%2C38)%3Bstroke-width%3A1px%3B%22%2F%3E%20%3C%2Fsvg%3E")` | `url("data:image/svg+xml,%3Csvg%20width%3D%22100%25%22%20height%3D%22100%25%22%20viewBox%3D%220%200%2040%2040%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20style%3D%22fill-rule%3Aevenodd%3Bclip-rule%3Aevenodd%3Bstroke-linecap%3Around%3Bstroke-miterlimit%3A10%3B%22%3E%20%3Crect%20x%3D%220%22%20y%3D%220%22%20width%3D%2240%22%20height%3D%2240%22%20style%3D%22fill%3Anone%3B%22%2F%3E%20%3Cpath%20d%3D%22M23.07%2C16L20%2C12.93L16.93%2C16M16.93%2C24L20%2C27.07L23.07%2C24%22%20style%3D%22fill%3Anone%3Bfill-rule%3Anonzero%3Bstroke%3Argb(38%2C38%2C38)%3Bstroke-width%3A1px%3B%22%2F%3E%20%3C%2Fsvg%3E")` |
|
|
10
|
+
| `--c-select-arrow-disabled` | `url("data:image/svg+xml,%3Csvg%20width%3D%22100%25%22%20height%3D%22100%25%22%20viewBox%3D%220%200%2040%2040%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20style%3D%22fill-rule%3Aevenodd%3Bclip-rule%3Aevenodd%3Bstroke-linecap%3Around%3Bstroke-miterlimit%3A10%3B%22%3E%20%3Crect%20x%3D%220%22%20y%3D%220%22%20width%3D%2240%22%20height%3D%2240%22%20style%3D%22fill%3Anone%3B%22%2F%3E%20%3Cpath%20d%3D%22M23.07%2C16L20%2C12.93L16.93%2C16M16.93%2C24L20%2C27.07L23.07%2C24%22%20style%3D%22fill%3Anone%3Bfill-rule%3Anonzero%3Bstroke%3Argb(128%2C128%2C128)%3Bstroke-width%3A1px%3B%22%2F%3E%20%3C%2Fsvg%3E")` | `url("data:image/svg+xml,%3Csvg%20width%3D%22100%25%22%20height%3D%22100%25%22%20viewBox%3D%220%200%2040%2040%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20style%3D%22fill-rule%3Aevenodd%3Bclip-rule%3Aevenodd%3Bstroke-linecap%3Around%3Bstroke-miterlimit%3A10%3B%22%3E%20%3Crect%20x%3D%220%22%20y%3D%220%22%20width%3D%2240%22%20height%3D%2240%22%20style%3D%22fill%3Anone%3B%22%2F%3E%20%3Cpath%20d%3D%22M23.07%2C16L20%2C12.93L16.93%2C16M16.93%2C24L20%2C27.07L23.07%2C24%22%20style%3D%22fill%3Anone%3Bfill-rule%3Anonzero%3Bstroke%3Argb(128%2C128%2C128)%3Bstroke-width%3A1px%3B%22%2F%3E%20%3C%2Fsvg%3E")` |
|
|
11
|
+
| `--c-select-background` | `var(--c-color-gray-95)` | `var(--c-color-gray-95) → hsl(0 0% 95%)` |
|
|
12
|
+
| `--c-select-background-disabled` | `var(--c-color-gray-85)` | `var(--c-color-gray-85) → hsl(0 0% 85%)` |
|
|
13
|
+
| `--c-select-background-focus` | `#ffffff` | `#ffffff` |
|
|
14
|
+
| `--c-select-border-color` | `var(--c-select-background)` | `var(--c-select-background) → var(--c-color-gray-95) → hsl(0 0% 95%)` |
|
|
15
|
+
| `--c-select-border-color-disabled` | `var(--c-select-background-disabled)` | `var(--c-select-background-disabled) → var(--c-color-gray-85) → hsl(0 0% 85%)` |
|
|
16
|
+
| `--c-select-border-color-focus` | `var(--c-color-gray-85)` | `var(--c-color-gray-85) → hsl(0 0% 85%)` |
|
|
17
|
+
| `--c-select-border-color-invalid` | `var(--c-color-red-70)` | `var(--c-color-red-70) → hsl(0 100% 70%)` |
|
|
18
|
+
| `--c-select-content` | `var(--c-color-gray-15)` | `var(--c-color-gray-15) → hsl(0 0% 15%)` |
|
|
19
|
+
| `--c-select-content-disabled` | `var(--c-color-gray-30)` | `var(--c-color-gray-30) → hsl(0 0% 30%)` |
|
|
20
|
+
| `--c-select-height` | `40px` | `40px` |
|
|
21
|
+
| `--c-select-padding` | `10px 40px 10px 15px` | `10px 40px 10px 15px` |
|
|
22
|
+
| `--c-select-placeholder` | `var(--c-color-gray-60)` | `var(--c-color-gray-60) → hsl(0 0% 60%)` |
|
|
23
|
+
| `--c-select-placeholder-disabled` | `var(--c-color-gray-50)` | `var(--c-color-gray-50) → hsl(0 0% 50%)` |
|
|
24
|
+
| `--c-select-placeholder-focus` | `var(--c-color-gray-70)` | `var(--c-color-gray-70) → hsl(0 0% 70%)` |
|
|
25
|
+
| `--c-select-radius` | `10px` | `10px` |
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.c-textarea{--c-textarea-background: var(--c-color-gray-95);--c-textarea-background-focus: #ffffff;--c-textarea-background-disabled: var(--c-color-gray-85);--c-textarea-content: var(--c-color-gray-15);--c-textarea-content-disabled: var(--c-color-gray-30);--c-textarea-placeholder: var(--c-color-gray-60);--c-textarea-placeholder-focus: var(--c-color-gray-70);--c-textarea-placeholder-disabled: var(--c-color-gray-50);--c-textarea-border-color: var(--c-color-gray-85);--c-textarea-border-color-invalid: var(--c-color-red-70);--c-textarea-border-color-disabled: var(--c-color-gray-85);--c-textarea-radius: 10px;--c-textarea-min-height: 40px;--c-textarea-padding: 10px 15px;box-sizing:border-box;width:100%;min-height:var(--c-textarea-min-height);padding:var(--c-textarea-padding);background:var(--c-textarea-background);color:var(--c-textarea-content);font-family:var(--c-font-family-primary);font-size:1rem;border:1px solid var(--c-textarea-border-color);border-radius:var(--c-textarea-radius);resize:vertical;outline:none;box-shadow:0 0 0 0 var(--c-color-gray-95);transition:background-color .15s ease-out,border-color .15s ease-out,box-shadow .15s ease-out,color .15s ease-out}.c-textarea::placeholder{color:var(--c-textarea-placeholder)}.c-textarea:focus-visible{background:var(--c-textarea-background-focus);box-shadow:0 0 0 5px var(--c-color-gray-95)}.c-textarea:focus-visible::placeholder{color:var(--c-textarea-placeholder-focus)}.c-textarea:disabled{background:var(--c-textarea-background-disabled);color:var(--c-textarea-content-disabled);border-color:var(--c-textarea-border-color-disabled)}.c-textarea:disabled::placeholder{color:var(--c-textarea-placeholder-disabled)}.c-textarea.is-invalid{border-color:var(--c-textarea-border-color-invalid)}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0,require("./textarea.css");var _jsxRuntime=require("react/jsx-runtime");const Textarea=({invalid:t,className:s,...e})=>{const r=buildTextareaClasses({invalid:t,className:s});return(0,_jsxRuntime.jsx)("textarea",{className:r,...e})};function buildTextareaClasses({invalid:t,className:s}){const e=["c-textarea"];return t&&e.push("is-invalid"),[...e,s].filter(Boolean).join(" ")}var _default=exports.default=Textarea;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Textarea
|
|
3
|
+
description: Multi-line text field that collects a longer text value from the user.
|
|
4
|
+
purpose: Collect a longer text value such as a comment or a message.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Textarea
|
|
8
|
+
|
|
9
|
+
A multi-line text field. It extends the native HTML `textarea` element, so every native attribute (`value`, `rows`, `disabled`, `onChange`, etc.) is accepted. The component adds one visual prop, `invalid`, that marks the field as having an error. Its visual states match the Input.
|
|
10
|
+
|
|
11
|
+
## Props
|
|
12
|
+
|
|
13
|
+
The Textarea API extends the native HTML `textarea` attributes. Props such as `disabled` come from the native element and are not listed below.
|
|
14
|
+
|
|
15
|
+
<!-- BEGIN GENERATED PROPS -->
|
|
16
|
+
_Also inherits all props from `TextareaHTMLAttributes<HTMLTextAreaElement>`._
|
|
17
|
+
|
|
18
|
+
| Name | Type | Required | Default | Description |
|
|
19
|
+
| --- | --- | --- | --- | --- |
|
|
20
|
+
| invalid | `boolean` | No | `false` | Marks the field as invalid by changing its border to the error color. |
|
|
21
|
+
<!-- END GENERATED PROPS -->
|
|
22
|
+
|
|
23
|
+
## When to use
|
|
24
|
+
|
|
25
|
+
- Collecting longer text such as comments, messages, or descriptions
|
|
26
|
+
- Form fields where the user needs more than one line
|
|
27
|
+
- Surfacing validation errors with the `invalid` prop alongside accessible error messaging
|
|
28
|
+
|
|
29
|
+
## When NOT to use
|
|
30
|
+
|
|
31
|
+
- **Short single-line text** — use Input for names, emails, or search queries.
|
|
32
|
+
- **Fixed option lists** — use a select or radio group when the user must pick from predefined choices.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Textarea tokens
|
|
2
|
+
|
|
3
|
+
Generated from `src/components/textarea/textarea.css`.
|
|
4
|
+
|
|
5
|
+
## Base tokens
|
|
6
|
+
|
|
7
|
+
| Token | Declared value | Resolution |
|
|
8
|
+
| --- | --- | --- |
|
|
9
|
+
| `--c-textarea-background` | `var(--c-color-gray-95)` | `var(--c-color-gray-95) → hsl(0 0% 95%)` |
|
|
10
|
+
| `--c-textarea-background-disabled` | `var(--c-color-gray-85)` | `var(--c-color-gray-85) → hsl(0 0% 85%)` |
|
|
11
|
+
| `--c-textarea-background-focus` | `#ffffff` | `#ffffff` |
|
|
12
|
+
| `--c-textarea-border-color` | `var(--c-color-gray-85)` | `var(--c-color-gray-85) → hsl(0 0% 85%)` |
|
|
13
|
+
| `--c-textarea-border-color-disabled` | `var(--c-color-gray-85)` | `var(--c-color-gray-85) → hsl(0 0% 85%)` |
|
|
14
|
+
| `--c-textarea-border-color-invalid` | `var(--c-color-red-70)` | `var(--c-color-red-70) → hsl(0 100% 70%)` |
|
|
15
|
+
| `--c-textarea-content` | `var(--c-color-gray-15)` | `var(--c-color-gray-15) → hsl(0 0% 15%)` |
|
|
16
|
+
| `--c-textarea-content-disabled` | `var(--c-color-gray-30)` | `var(--c-color-gray-30) → hsl(0 0% 30%)` |
|
|
17
|
+
| `--c-textarea-min-height` | `40px` | `40px` |
|
|
18
|
+
| `--c-textarea-padding` | `10px 15px` | `10px 15px` |
|
|
19
|
+
| `--c-textarea-placeholder` | `var(--c-color-gray-60)` | `var(--c-color-gray-60) → hsl(0 0% 60%)` |
|
|
20
|
+
| `--c-textarea-placeholder-disabled` | `var(--c-color-gray-50)` | `var(--c-color-gray-50) → hsl(0 0% 50%)` |
|
|
21
|
+
| `--c-textarea-placeholder-focus` | `var(--c-color-gray-70)` | `var(--c-color-gray-70) → hsl(0 0% 70%)` |
|
|
22
|
+
| `--c-textarea-radius` | `10px` | `10px` |
|
|
@@ -5,3 +5,9 @@ Generated from component frontmatter. Human usage sections live in each componen
|
|
|
5
5
|
| Component | Description | Purpose | Doc path |
|
|
6
6
|
| --- | --- | --- | --- |
|
|
7
7
|
| Button | A native button element with variant styles driven by design tokens. | Trigger actions and submit forms with consistent visual variants. | [`../components/button/button.md`](../components/button/button.md) |
|
|
8
|
+
| Checkbox | A native checkbox input with the library look and an optional built-in label. | Let the user turn an option on or off, or pick several options from a list. | [`../components/checkbox/checkbox.md`](../components/checkbox/checkbox.md) |
|
|
9
|
+
| Input | A single-line text field that extends the native HTML input element. | Collect short text values in forms with consistent field styling and error indication. | [`../components/input/input.md`](../components/input/input.md) |
|
|
10
|
+
| Label | A text label that extends the native HTML label element. | Name a form control with consistent label typography, on its own or next to any control. | [`../components/label/label.md`](../components/label/label.md) |
|
|
11
|
+
| Radio | A native radio input with the library look and an optional built-in label. | Let the user pick exactly one option from a small group of mutually exclusive options. | [`../components/radio/radio.md`](../components/radio/radio.md) |
|
|
12
|
+
| Select | Dropdown field that lets the user choose one option from a fixed list. | Let the user choose one option from a fixed list. | [`../components/select/select.md`](../components/select/select.md) |
|
|
13
|
+
| Textarea | Multi-line text field that collects a longer text value from the user. | Collect a longer text value such as a comment or a message. | [`../components/textarea/textarea.md`](../components/textarea/textarea.md) |
|
package/dist/cjs/docs/tokens.md
CHANGED
|
@@ -30,4 +30,26 @@ Generated from `src/vars.css`. Values show the declared token and the resolved r
|
|
|
30
30
|
| `--c-color-gray-85` | `hsl(0 0% 85%)` | `hsl(0 0% 85%)` |
|
|
31
31
|
| `--c-color-gray-90` | `hsl(0 0% 90%)` | `hsl(0 0% 90%)` |
|
|
32
32
|
| `--c-color-gray-95` | `hsl(0 0% 95%)` | `hsl(0 0% 95%)` |
|
|
33
|
+
| `--c-color-red-10` | `hsl(0 100% 10%)` | `hsl(0 100% 10%)` |
|
|
34
|
+
| `--c-color-red-15` | `hsl(0 100% 15%)` | `hsl(0 100% 15%)` |
|
|
35
|
+
| `--c-color-red-20` | `hsl(0 100% 20%)` | `hsl(0 100% 20%)` |
|
|
36
|
+
| `--c-color-red-30` | `hsl(0 100% 30%)` | `hsl(0 100% 30%)` |
|
|
37
|
+
| `--c-color-red-40` | `hsl(0 100% 40%)` | `hsl(0 100% 40%)` |
|
|
38
|
+
| `--c-color-red-5` | `hsl(0 100% 5%)` | `hsl(0 100% 5%)` |
|
|
39
|
+
| `--c-color-red-50` | `hsl(0 100% 50%)` | `hsl(0 100% 50%)` |
|
|
40
|
+
| `--c-color-red-60` | `hsl(0 100% 60%)` | `hsl(0 100% 60%)` |
|
|
41
|
+
| `--c-color-red-70` | `hsl(0 100% 70%)` | `hsl(0 100% 70%)` |
|
|
42
|
+
| `--c-color-red-80` | `hsl(0 100% 80%)` | `hsl(0 100% 80%)` |
|
|
43
|
+
| `--c-color-red-85` | `hsl(0 100% 85%)` | `hsl(0 100% 85%)` |
|
|
44
|
+
| `--c-color-red-90` | `hsl(0 100% 90%)` | `hsl(0 100% 90%)` |
|
|
45
|
+
| `--c-color-red-95` | `hsl(0 100% 95%)` | `hsl(0 100% 95%)` |
|
|
33
46
|
| `--c-font-family-primary` | `'Inter', sans-serif` | `'Inter', sans-serif` |
|
|
47
|
+
| `--c-font-size-lg` | `1.250rem` | `1.250rem` |
|
|
48
|
+
| `--c-font-size-md` | `1.125rem` | `1.125rem` |
|
|
49
|
+
| `--c-font-size-sm` | `1.000rem` | `1.000rem` |
|
|
50
|
+
| `--c-font-size-xl` | `1.500rem` | `1.500rem` |
|
|
51
|
+
| `--c-font-size-xs` | `0.875rem` | `0.875rem` |
|
|
52
|
+
| `--c-font-size-xxl` | `2.250rem` | `2.250rem` |
|
|
53
|
+
| `--c-font-size-xxs` | `0.750rem` | `0.750rem` |
|
|
54
|
+
| `--c-font-size-xxxl` | `3.000rem` | `3.000rem` |
|
|
55
|
+
| `--c-font-size-xxxs` | `0.625rem` | `0.625rem` |
|
package/dist/cjs/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"Button",{enumerable:!0,get:function(){return _button.default}}),require("./index.css");var _button=_interopRequireDefault(require("./components/button/button.jsx"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"Button",{enumerable:!0,get:function(){return _button.default}}),Object.defineProperty(exports,"Checkbox",{enumerable:!0,get:function(){return _checkbox.default}}),Object.defineProperty(exports,"Input",{enumerable:!0,get:function(){return _input.default}}),Object.defineProperty(exports,"Label",{enumerable:!0,get:function(){return _label.default}}),Object.defineProperty(exports,"Radio",{enumerable:!0,get:function(){return _radio.default}}),Object.defineProperty(exports,"Select",{enumerable:!0,get:function(){return _select.default}}),Object.defineProperty(exports,"Textarea",{enumerable:!0,get:function(){return _textarea.default}}),require("./index.css");var _button=_interopRequireDefault(require("./components/button/button.jsx")),_checkbox=_interopRequireDefault(require("./components/checkbox/checkbox.jsx")),_input=_interopRequireDefault(require("./components/input/input.jsx")),_label=_interopRequireDefault(require("./components/label/label.jsx")),_radio=_interopRequireDefault(require("./components/radio/radio.jsx")),_select=_interopRequireDefault(require("./components/select/select.jsx")),_textarea=_interopRequireDefault(require("./components/textarea/textarea.jsx"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}
|
package/dist/cjs/vars.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
:root{--c-font-family-primary: "Inter", sans-serif;--c-color-gray-95: hsl(0 0% 95%);--c-color-gray-90: hsl(0 0% 90%);--c-color-gray-85: hsl(0 0% 85%);--c-color-gray-80: hsl(0 0% 80%);--c-color-gray-70: hsl(0 0% 70%);--c-color-gray-60: hsl(0 0% 60%);--c-color-gray-50: hsl(0 0% 50%);--c-color-gray-40: hsl(0 0% 40%);--c-color-gray-30: hsl(0 0% 30%);--c-color-gray-20: hsl(0 0% 20%);--c-color-gray-15: hsl(0 0% 15%);--c-color-gray-10: hsl(0 0% 10%);--c-color-gray-5: hsl(0 0% 5%);--c-color-accented-95: var(--c-color-gray-95);--c-color-accented-90: var(--c-color-gray-90);--c-color-accented-85: var(--c-color-gray-85);--c-color-accented-80: var(--c-color-gray-80);--c-color-accented-70: var(--c-color-gray-70);--c-color-accented-60: var(--c-color-gray-60);--c-color-accented-50: var(--c-color-gray-50);--c-color-accented-40: var(--c-color-gray-40);--c-color-accented-30: var(--c-color-gray-30);--c-color-accented-20: var(--c-color-gray-20);--c-color-accented-15: var(--c-color-gray-15);--c-color-accented-10: var(--c-color-gray-10);--c-color-accented-5: var(--c-color-gray-5)}
|
|
1
|
+
:root{--c-font-family-primary: "Inter", sans-serif;--c-font-size-xxxs: .625rem;--c-font-size-xxs: .75rem;--c-font-size-xs: .875rem;--c-font-size-sm: 1rem;--c-font-size-md: 1.125rem;--c-font-size-lg: 1.25rem;--c-font-size-xl: 1.5rem;--c-font-size-xxl: 2.25rem;--c-font-size-xxxl: 3rem;--c-color-gray-95: hsl(0 0% 95%);--c-color-gray-90: hsl(0 0% 90%);--c-color-gray-85: hsl(0 0% 85%);--c-color-gray-80: hsl(0 0% 80%);--c-color-gray-70: hsl(0 0% 70%);--c-color-gray-60: hsl(0 0% 60%);--c-color-gray-50: hsl(0 0% 50%);--c-color-gray-40: hsl(0 0% 40%);--c-color-gray-30: hsl(0 0% 30%);--c-color-gray-20: hsl(0 0% 20%);--c-color-gray-15: hsl(0 0% 15%);--c-color-gray-10: hsl(0 0% 10%);--c-color-gray-5: hsl(0 0% 5%);--c-color-red-95: hsl(0 100% 95%);--c-color-red-90: hsl(0 100% 90%);--c-color-red-85: hsl(0 100% 85%);--c-color-red-80: hsl(0 100% 80%);--c-color-red-70: hsl(0 100% 70%);--c-color-red-60: hsl(0 100% 60%);--c-color-red-50: hsl(0 100% 50%);--c-color-red-40: hsl(0 100% 40%);--c-color-red-30: hsl(0 100% 30%);--c-color-red-20: hsl(0 100% 20%);--c-color-red-15: hsl(0 100% 15%);--c-color-red-10: hsl(0 100% 10%);--c-color-red-5: hsl(0 100% 5%);--c-color-accented-95: var(--c-color-gray-95);--c-color-accented-90: var(--c-color-gray-90);--c-color-accented-85: var(--c-color-gray-85);--c-color-accented-80: var(--c-color-gray-80);--c-color-accented-70: var(--c-color-gray-70);--c-color-accented-60: var(--c-color-gray-60);--c-color-accented-50: var(--c-color-gray-50);--c-color-accented-40: var(--c-color-gray-40);--c-color-accented-30: var(--c-color-gray-30);--c-color-accented-20: var(--c-color-gray-20);--c-color-accented-15: var(--c-color-gray-15);--c-color-accented-10: var(--c-color-gray-10);--c-color-accented-5: var(--c-color-gray-5)}
|
package/dist/docs/components.md
CHANGED
|
@@ -5,3 +5,9 @@ Generated from component frontmatter. Human usage sections live in each componen
|
|
|
5
5
|
| Component | Description | Purpose | Doc path |
|
|
6
6
|
| --- | --- | --- | --- |
|
|
7
7
|
| Button | A native button element with variant styles driven by design tokens. | Trigger actions and submit forms with consistent visual variants. | [`../components/button/button.md`](../components/button/button.md) |
|
|
8
|
+
| Checkbox | A native checkbox input with the library look and an optional built-in label. | Let the user turn an option on or off, or pick several options from a list. | [`../components/checkbox/checkbox.md`](../components/checkbox/checkbox.md) |
|
|
9
|
+
| Input | A single-line text field that extends the native HTML input element. | Collect short text values in forms with consistent field styling and error indication. | [`../components/input/input.md`](../components/input/input.md) |
|
|
10
|
+
| Label | A text label that extends the native HTML label element. | Name a form control with consistent label typography, on its own or next to any control. | [`../components/label/label.md`](../components/label/label.md) |
|
|
11
|
+
| Radio | A native radio input with the library look and an optional built-in label. | Let the user pick exactly one option from a small group of mutually exclusive options. | [`../components/radio/radio.md`](../components/radio/radio.md) |
|
|
12
|
+
| Select | Dropdown field that lets the user choose one option from a fixed list. | Let the user choose one option from a fixed list. | [`../components/select/select.md`](../components/select/select.md) |
|
|
13
|
+
| Textarea | Multi-line text field that collects a longer text value from the user. | Collect a longer text value such as a comment or a message. | [`../components/textarea/textarea.md`](../components/textarea/textarea.md) |
|
package/dist/docs/tokens.md
CHANGED
|
@@ -30,4 +30,26 @@ Generated from `src/vars.css`. Values show the declared token and the resolved r
|
|
|
30
30
|
| `--c-color-gray-85` | `hsl(0 0% 85%)` | `hsl(0 0% 85%)` |
|
|
31
31
|
| `--c-color-gray-90` | `hsl(0 0% 90%)` | `hsl(0 0% 90%)` |
|
|
32
32
|
| `--c-color-gray-95` | `hsl(0 0% 95%)` | `hsl(0 0% 95%)` |
|
|
33
|
+
| `--c-color-red-10` | `hsl(0 100% 10%)` | `hsl(0 100% 10%)` |
|
|
34
|
+
| `--c-color-red-15` | `hsl(0 100% 15%)` | `hsl(0 100% 15%)` |
|
|
35
|
+
| `--c-color-red-20` | `hsl(0 100% 20%)` | `hsl(0 100% 20%)` |
|
|
36
|
+
| `--c-color-red-30` | `hsl(0 100% 30%)` | `hsl(0 100% 30%)` |
|
|
37
|
+
| `--c-color-red-40` | `hsl(0 100% 40%)` | `hsl(0 100% 40%)` |
|
|
38
|
+
| `--c-color-red-5` | `hsl(0 100% 5%)` | `hsl(0 100% 5%)` |
|
|
39
|
+
| `--c-color-red-50` | `hsl(0 100% 50%)` | `hsl(0 100% 50%)` |
|
|
40
|
+
| `--c-color-red-60` | `hsl(0 100% 60%)` | `hsl(0 100% 60%)` |
|
|
41
|
+
| `--c-color-red-70` | `hsl(0 100% 70%)` | `hsl(0 100% 70%)` |
|
|
42
|
+
| `--c-color-red-80` | `hsl(0 100% 80%)` | `hsl(0 100% 80%)` |
|
|
43
|
+
| `--c-color-red-85` | `hsl(0 100% 85%)` | `hsl(0 100% 85%)` |
|
|
44
|
+
| `--c-color-red-90` | `hsl(0 100% 90%)` | `hsl(0 100% 90%)` |
|
|
45
|
+
| `--c-color-red-95` | `hsl(0 100% 95%)` | `hsl(0 100% 95%)` |
|
|
33
46
|
| `--c-font-family-primary` | `'Inter', sans-serif` | `'Inter', sans-serif` |
|
|
47
|
+
| `--c-font-size-lg` | `1.250rem` | `1.250rem` |
|
|
48
|
+
| `--c-font-size-md` | `1.125rem` | `1.125rem` |
|
|
49
|
+
| `--c-font-size-sm` | `1.000rem` | `1.000rem` |
|
|
50
|
+
| `--c-font-size-xl` | `1.500rem` | `1.500rem` |
|
|
51
|
+
| `--c-font-size-xs` | `0.875rem` | `0.875rem` |
|
|
52
|
+
| `--c-font-size-xxl` | `2.250rem` | `2.250rem` |
|
|
53
|
+
| `--c-font-size-xxs` | `0.750rem` | `0.750rem` |
|
|
54
|
+
| `--c-font-size-xxxl` | `3.000rem` | `3.000rem` |
|
|
55
|
+
| `--c-font-size-xxxs` | `0.625rem` | `0.625rem` |
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.c-button{--c-button-background: var(--c-color-gray-90);--c-button-background-hover: var(--c-color-gray-95);--c-button-background-disabled: var(--c-color-gray-95);--c-button-content: var(--c-color-gray-10);--c-button-content-disabled: var(--c-color-gray-60);--c-button-border-color: var(--c-color-gray-90);--c-button-border-color-disabled: var(--c-color-gray-95);--c-button-box-shadow-color: var(--c-color-gray-95);--c-button-radius: 10px;--c-button-height: 40px;--c-button-width: auto;--c-button-padding: 10px 25px;display:inline-flex;position:relative;align-items:center;justify-content:center;width:var(--c-button-width);height:var(--c-button-height);padding:var(--c-button-padding);background:var(--c-button-background);color:var(--c-button-content);font-family:var(--c-font-family-primary);font-size:1rem;font-weight:700;line-height:1;border:1px solid var(--c-button-border-color);border-radius:var(--c-button-radius);box-shadow:0 0 0 0 var(--c-button-box-shadow-color);box-sizing:border-box;cursor:pointer;outline:0;transition:
|
|
1
|
+
.c-button{--c-button-background: var(--c-color-gray-90);--c-button-background-hover: var(--c-color-gray-95);--c-button-background-disabled: var(--c-color-gray-95);--c-button-content: var(--c-color-gray-10);--c-button-content-disabled: var(--c-color-gray-60);--c-button-border-color: var(--c-color-gray-90);--c-button-border-color-disabled: var(--c-color-gray-95);--c-button-box-shadow-color: var(--c-color-gray-95);--c-button-radius: 10px;--c-button-height: 40px;--c-button-width: auto;--c-button-padding: 10px 25px;display:inline-flex;position:relative;align-items:center;justify-content:center;width:var(--c-button-width);height:var(--c-button-height);padding:var(--c-button-padding);background:var(--c-button-background);color:var(--c-button-content);font-family:var(--c-font-family-primary);font-size:1rem;font-weight:700;line-height:1;border:1px solid var(--c-button-border-color);border-radius:var(--c-button-radius);box-shadow:0 0 0 0 var(--c-button-box-shadow-color);box-sizing:border-box;cursor:pointer;outline:0;transition:background-color .15s ease-out,border-color .15s ease-out,box-shadow .15s ease-out,color .15s ease-out}.c-button:hover:not(:disabled){background:var(--c-button-background-hover)}.c-button:focus-visible{box-shadow:0 0 0 5px var(--c-button-box-shadow-color)}.c-button.is-accented:not(.is-outline):focus-visible{box-shadow:0 0 0 5px var(--c-color-accented-80)}.c-button.is-outline:focus-visible,.c-button.is-borderless:focus-visible{box-shadow:0 0 0 5px var(--c-color-accented-90)}.c-button:disabled{background:var(--c-button-background-disabled);color:var(--c-button-content-disabled);border-color:var(--c-button-border-color-disabled);cursor:default}.c-button.is-accented{--c-button-background: var(--c-color-accented-10);--c-button-background-hover: var(--c-color-accented-20);--c-button-background-disabled: var(--c-color-accented-30);--c-button-content: var(--c-color-accented-95);--c-button-content-disabled: var(--c-color-accented-80);--c-button-border-color: var(--c-color-accented-10);--c-button-border-color-disabled: var(--c-color-accented-30)}.c-button.is-outline{--c-button-background: transparent;--c-button-background-hover: var(--c-color-gray-95);--c-button-background-disabled: transparent;--c-button-border-color: var(--c-color-gray-70);--c-button-border-color-disabled: var(--c-color-gray-85);--c-button-content: var(--c-color-gray-20)}.c-button.is-borderless{--c-button-background: transparent;--c-button-background-hover: var(--c-color-gray-95);--c-button-background-disabled: transparent;--c-button-border-color: transparent;--c-button-border-color-disabled: transparent;--c-button-content: var(--c-color-gray-30)}.c-button.is-accented.is-outline{--c-button-content: var(--c-color-accented-10);--c-button-content-disabled: var(--c-color-accented-70);--c-button-border-color: var(--c-color-accented-10);--c-button-border-color-disabled: var(--c-color-accented-70)}.c-button.is-accented.is-borderless{--c-button-content: var(--c-color-accented-10)}.c-button.is-round{--c-button-radius: 20px}.c-button.is-isometric{--c-button-height: 40px;--c-button-width: 40px;--c-button-padding: 0}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.c-checkbox-wrapper{display:inline-flex;align-items:center;gap:10px}.c-checkbox-wrapper .c-label:hover:not(.is-disabled){cursor:pointer}.c-checkbox{--c-checkbox-background: var(--c-color-gray-95);--c-checkbox-background-disabled: var(--c-color-gray-85);--c-checkbox-background-checked: var(--c-color-gray-10);--c-checkbox-border-color: var(--c-color-gray-85);--c-checkbox-border-color-disabled: var(--c-color-gray-85);--c-checkbox-border-color-checked: var(--c-color-gray-10);--c-checkbox-check: url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%228.5%22%20height%3D%227.9%22%20viewBox%3D%22386.595%20103.67%208.5%207.855%22%3E%3Cpath%20d%3D%22M395.057,104.851L389.957,111.396C389.917,111.437%20389.851,111.525%20389.77,111.525C389.686,111.525%20389.631,111.466%20389.583,111.418C389.535,111.37%20386.69,108.635%20386.69,108.635L386.635,108.58C386.613,108.547%20386.595,108.507%20386.595,108.463C386.595,108.419%20386.613,108.378%20386.635,108.345C386.65,108.331%20386.66,108.32%20386.675,108.301C386.957,108.004%20387.529,107.403%20387.566,107.367C387.614,107.319%20387.654,107.256%20387.742,107.256C387.834,107.256%20387.892,107.334%20387.936,107.378C387.98,107.421%20389.586,108.965%20389.586,108.965L393.668,103.722C393.704,103.692%20393.749,103.67%20393.796,103.67C393.844,103.67%20393.887,103.688%20393.925,103.718L395.046,104.602C395.076,104.638%20395.094,104.682%20395.094,104.73C395.098,104.778%20395.079,104.818%20395.057,104.851%22%20fill%3D%22white%22%2F%3E%3C%2Fsvg%3E);--c-checkbox-check-disabled: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%228.5%22%20height%3D%227.9%22%20viewBox%3D%22386.595%20103.67%208.5%207.855%22%3E%3Cpath%20d%3D%22M395.057,104.851L389.957,111.396C389.917,111.437%20389.851,111.525%20389.77,111.525C389.686,111.525%20389.631,111.466%20389.583,111.418C389.535,111.37%20386.69,108.635%20386.69,108.635L386.635,108.58C386.613,108.547%20386.595,108.507%20386.595,108.463C386.595,108.419%20386.613,108.378%20386.635,108.345C386.65,108.331%20386.66,108.32%20386.675,108.301C386.957,108.004%20387.529,107.403%20387.566,107.367C387.614,107.319%20387.654,107.256%20387.742,107.256C387.834,107.256%20387.892,107.334%20387.936,107.378C387.98,107.421%20389.586,108.965%20389.586,108.965L393.668,103.722C393.704,103.692%20393.749,103.67%20393.796,103.67C393.844,103.67%20393.887,103.688%20393.925,103.718L395.046,104.602C395.076,104.638%20395.094,104.682%20395.094,104.73C395.098,104.778%20395.079,104.818%20395.057,104.851%22%20fill%3D%22rgb(128,128,128)%22%2F%3E%3C%2Fsvg%3E");--c-checkbox-radius: 5px;--c-checkbox-size: 18px;--c-checkbox-check-size: 8.5px 7.9px;appearance:none;-webkit-appearance:none;-moz-appearance:none;display:inline-block;flex-shrink:0;margin:0;width:var(--c-checkbox-size);height:var(--c-checkbox-size);background-color:var(--c-checkbox-background);background-repeat:no-repeat;background-position:center;background-size:var(--c-checkbox-check-size);border:1px solid var(--c-checkbox-border-color);border-radius:var(--c-checkbox-radius);outline:none;box-shadow:0 0 0 0 var(--c-color-gray-95);box-sizing:border-box;cursor:pointer;transition:background-color .15s ease-out,border-color .15s ease-out,box-shadow .15s ease-out}.c-checkbox:checked{background-color:var(--c-checkbox-background-checked);background-image:var(--c-checkbox-check);border-color:var(--c-checkbox-border-color-checked)}.c-checkbox:focus-visible{box-shadow:0 0 0 5px var(--c-color-gray-95)}.c-checkbox:focus-visible:not(:checked){background-color:#fff}.c-checkbox:focus-visible:checked{box-shadow:0 0 0 5px var(--c-color-accented-80)}.c-checkbox:disabled{background-color:var(--c-checkbox-background-disabled);border-color:var(--c-checkbox-border-color-disabled);cursor:default}.c-checkbox:disabled:checked{background-image:var(--c-checkbox-check-disabled)}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useId as p}from"react";import d from"../label/label.js";import"./checkbox.css";import{jsx as r,jsxs as m}from"react/jsx-runtime";const x=({id:o,label:s,className:n,...e})=>{const a=p(),c=o||a,i=["c-checkbox",n].filter(Boolean).join(" "),t=r("input",{id:s?c:o,className:i,...e,type:"checkbox"});return s?m("span",{className:"c-checkbox-wrapper",children:[t,r(d,{htmlFor:c,disabled:e.disabled,children:s})]}):t};export default x;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Checkbox
|
|
3
|
+
description: A native checkbox input with the library look and an optional built-in label.
|
|
4
|
+
purpose: Let the user turn an option on or off, or pick several options from a list.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Checkbox
|
|
8
|
+
|
|
9
|
+
A styled native `input` of type `checkbox`. Every native input attribute (`checked`, `defaultChecked`, `disabled`, `onChange`, `name`, `id`, etc.) is forwarded to the input. When `label` is given, the component also renders a `Label` next to the input and associates both, so clicking the text toggles the checkbox.
|
|
10
|
+
|
|
11
|
+
## Props
|
|
12
|
+
|
|
13
|
+
The Checkbox API extends the native HTML `input` attributes, except `type`. Props such as `checked`, `disabled` and `onChange` come from the native element and are not listed below.
|
|
14
|
+
|
|
15
|
+
<!-- BEGIN GENERATED PROPS -->
|
|
16
|
+
_Also inherits all props from `Omit<InputHTMLAttributes<HTMLInputElement>, 'type'>`._
|
|
17
|
+
|
|
18
|
+
| Name | Type | Required | Default | Description |
|
|
19
|
+
| --- | --- | --- | --- | --- |
|
|
20
|
+
| label | `string` | No | | Text of the label rendered next to the checkbox and associated with it. |
|
|
21
|
+
<!-- END GENERATED PROPS -->
|
|
22
|
+
|
|
23
|
+
## When to use
|
|
24
|
+
|
|
25
|
+
- Turning a single option on or off, such as accepting terms
|
|
26
|
+
- Letting the user pick any number of options from a list
|
|
27
|
+
|
|
28
|
+
## When NOT to use
|
|
29
|
+
|
|
30
|
+
- **Mutually exclusive options** — use a radio group when only one option can be picked.
|
|
31
|
+
- **Immediate actions** — use a button when the interaction triggers something right away.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Checkbox tokens
|
|
2
|
+
|
|
3
|
+
Generated from `src/components/checkbox/checkbox.css`.
|
|
4
|
+
|
|
5
|
+
## Base tokens
|
|
6
|
+
|
|
7
|
+
| Token | Declared value | Resolution |
|
|
8
|
+
| --- | --- | --- |
|
|
9
|
+
| `--c-checkbox-background` | `var(--c-color-gray-95)` | `var(--c-color-gray-95) → hsl(0 0% 95%)` |
|
|
10
|
+
| `--c-checkbox-background-checked` | `var(--c-color-gray-10)` | `var(--c-color-gray-10) → hsl(0 0% 10%)` |
|
|
11
|
+
| `--c-checkbox-background-disabled` | `var(--c-color-gray-85)` | `var(--c-color-gray-85) → hsl(0 0% 85%)` |
|
|
12
|
+
| `--c-checkbox-border-color` | `var(--c-color-gray-85)` | `var(--c-color-gray-85) → hsl(0 0% 85%)` |
|
|
13
|
+
| `--c-checkbox-border-color-checked` | `var(--c-color-gray-10)` | `var(--c-color-gray-10) → hsl(0 0% 10%)` |
|
|
14
|
+
| `--c-checkbox-border-color-disabled` | `var(--c-color-gray-85)` | `var(--c-color-gray-85) → hsl(0 0% 85%)` |
|
|
15
|
+
| `--c-checkbox-check` | `url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%228.5%22%20height%3D%227.9%22%20viewBox%3D%22386.595%20103.67%208.5%207.855%22%3E%3Cpath%20d%3D%22M395.057,104.851L389.957,111.396C389.917,111.437%20389.851,111.525%20389.77,111.525C389.686,111.525%20389.631,111.466%20389.583,111.418C389.535,111.37%20386.69,108.635%20386.69,108.635L386.635,108.58C386.613,108.547%20386.595,108.507%20386.595,108.463C386.595,108.419%20386.613,108.378%20386.635,108.345C386.65,108.331%20386.66,108.32%20386.675,108.301C386.957,108.004%20387.529,107.403%20387.566,107.367C387.614,107.319%20387.654,107.256%20387.742,107.256C387.834,107.256%20387.892,107.334%20387.936,107.378C387.98,107.421%20389.586,108.965%20389.586,108.965L393.668,103.722C393.704,103.692%20393.749,103.67%20393.796,103.67C393.844,103.67%20393.887,103.688%20393.925,103.718L395.046,104.602C395.076,104.638%20395.094,104.682%20395.094,104.73C395.098,104.778%20395.079,104.818%20395.057,104.851%22%20fill%3D%22white%22%2F%3E%3C%2Fsvg%3E")` | `url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%228.5%22%20height%3D%227.9%22%20viewBox%3D%22386.595%20103.67%208.5%207.855%22%3E%3Cpath%20d%3D%22M395.057,104.851L389.957,111.396C389.917,111.437%20389.851,111.525%20389.77,111.525C389.686,111.525%20389.631,111.466%20389.583,111.418C389.535,111.37%20386.69,108.635%20386.69,108.635L386.635,108.58C386.613,108.547%20386.595,108.507%20386.595,108.463C386.595,108.419%20386.613,108.378%20386.635,108.345C386.65,108.331%20386.66,108.32%20386.675,108.301C386.957,108.004%20387.529,107.403%20387.566,107.367C387.614,107.319%20387.654,107.256%20387.742,107.256C387.834,107.256%20387.892,107.334%20387.936,107.378C387.98,107.421%20389.586,108.965%20389.586,108.965L393.668,103.722C393.704,103.692%20393.749,103.67%20393.796,103.67C393.844,103.67%20393.887,103.688%20393.925,103.718L395.046,104.602C395.076,104.638%20395.094,104.682%20395.094,104.73C395.098,104.778%20395.079,104.818%20395.057,104.851%22%20fill%3D%22white%22%2F%3E%3C%2Fsvg%3E")` |
|
|
16
|
+
| `--c-checkbox-check-disabled` | `url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%228.5%22%20height%3D%227.9%22%20viewBox%3D%22386.595%20103.67%208.5%207.855%22%3E%3Cpath%20d%3D%22M395.057,104.851L389.957,111.396C389.917,111.437%20389.851,111.525%20389.77,111.525C389.686,111.525%20389.631,111.466%20389.583,111.418C389.535,111.37%20386.69,108.635%20386.69,108.635L386.635,108.58C386.613,108.547%20386.595,108.507%20386.595,108.463C386.595,108.419%20386.613,108.378%20386.635,108.345C386.65,108.331%20386.66,108.32%20386.675,108.301C386.957,108.004%20387.529,107.403%20387.566,107.367C387.614,107.319%20387.654,107.256%20387.742,107.256C387.834,107.256%20387.892,107.334%20387.936,107.378C387.98,107.421%20389.586,108.965%20389.586,108.965L393.668,103.722C393.704,103.692%20393.749,103.67%20393.796,103.67C393.844,103.67%20393.887,103.688%20393.925,103.718L395.046,104.602C395.076,104.638%20395.094,104.682%20395.094,104.73C395.098,104.778%20395.079,104.818%20395.057,104.851%22%20fill%3D%22rgb(128,128,128)%22%2F%3E%3C%2Fsvg%3E")` | `url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%228.5%22%20height%3D%227.9%22%20viewBox%3D%22386.595%20103.67%208.5%207.855%22%3E%3Cpath%20d%3D%22M395.057,104.851L389.957,111.396C389.917,111.437%20389.851,111.525%20389.77,111.525C389.686,111.525%20389.631,111.466%20389.583,111.418C389.535,111.37%20386.69,108.635%20386.69,108.635L386.635,108.58C386.613,108.547%20386.595,108.507%20386.595,108.463C386.595,108.419%20386.613,108.378%20386.635,108.345C386.65,108.331%20386.66,108.32%20386.675,108.301C386.957,108.004%20387.529,107.403%20387.566,107.367C387.614,107.319%20387.654,107.256%20387.742,107.256C387.834,107.256%20387.892,107.334%20387.936,107.378C387.98,107.421%20389.586,108.965%20389.586,108.965L393.668,103.722C393.704,103.692%20393.749,103.67%20393.796,103.67C393.844,103.67%20393.887,103.688%20393.925,103.718L395.046,104.602C395.076,104.638%20395.094,104.682%20395.094,104.73C395.098,104.778%20395.079,104.818%20395.057,104.851%22%20fill%3D%22rgb(128,128,128)%22%2F%3E%3C%2Fsvg%3E")` |
|
|
17
|
+
| `--c-checkbox-check-size` | `8.5px 7.9px` | `8.5px 7.9px` |
|
|
18
|
+
| `--c-checkbox-radius` | `5px` | `5px` |
|
|
19
|
+
| `--c-checkbox-size` | `18px` | `18px` |
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.c-input{--c-input-background: var(--c-color-gray-95);--c-input-background-focus: #ffffff;--c-input-background-disabled: var(--c-color-gray-85);--c-input-content: var(--c-color-gray-15);--c-input-content-disabled: var(--c-color-gray-30);--c-input-placeholder: var(--c-color-gray-60);--c-input-placeholder-focus: var(--c-color-gray-70);--c-input-placeholder-disabled: var(--c-color-gray-50);--c-input-border-color: var(--c-color-gray-85);--c-input-border-color-invalid: var(--c-color-red-70);--c-input-border-color-disabled: var(--c-color-gray-85);--c-input-radius: 10px;--c-input-height: 40px;--c-input-padding: 10px 15px;box-sizing:border-box;width:100%;height:var(--c-input-height);padding:var(--c-input-padding);background:var(--c-input-background);color:var(--c-input-content);font-family:var(--c-font-family-primary);font-size:1rem;line-height:1;border:1px solid var(--c-input-border-color);border-radius:var(--c-input-radius);outline:none;box-shadow:0 0 0 0 var(--c-color-gray-95);transition:background-color .15s ease-out,border-color .15s ease-out,box-shadow .15s ease-out,color .15s ease-out}.c-input::placeholder{color:var(--c-input-placeholder)}.c-input:focus-visible{background:var(--c-input-background-focus);box-shadow:0 0 0 5px var(--c-color-gray-95)}.c-input:focus-visible::placeholder{color:var(--c-input-placeholder-focus)}.c-input:disabled{background:var(--c-input-background-disabled);color:var(--c-input-content-disabled);border-color:var(--c-input-border-color-disabled)}.c-input:disabled::placeholder{color:var(--c-input-placeholder-disabled)}.c-input.is-invalid{border-color:var(--c-input-border-color-invalid)}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./input.css";import{jsx as o}from"react/jsx-runtime";const e=({invalid:t,className:n,...s})=>{const i=u({invalid:t,className:n});return o("input",{className:i,...s})};function u({invalid:t,className:n}){const s=["c-input"];return t&&s.push("is-invalid"),[...s,n].filter(Boolean).join(" ")}export default e;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Input
|
|
3
|
+
description: A single-line text field that extends the native HTML input element.
|
|
4
|
+
purpose: Collect short text values in forms with consistent field styling and error indication.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Input
|
|
8
|
+
|
|
9
|
+
A single-line text field. It extends the native HTML `input` element, so every native attribute (`type`, `value`, `placeholder`, `disabled`, `onChange`, etc.) is accepted. The component adds one visual prop, `invalid`, that marks the field as having an error.
|
|
10
|
+
|
|
11
|
+
## Props
|
|
12
|
+
|
|
13
|
+
The Input API extends the native HTML `input` attributes. Props such as `disabled` and `placeholder` come from the native element and are not listed below.
|
|
14
|
+
|
|
15
|
+
<!-- BEGIN GENERATED PROPS -->
|
|
16
|
+
_Also inherits all props from `InputHTMLAttributes<HTMLInputElement>`._
|
|
17
|
+
|
|
18
|
+
| Name | Type | Required | Default | Description |
|
|
19
|
+
| --- | --- | --- | --- | --- |
|
|
20
|
+
| invalid | `boolean` | No | `false` | Marks the field as invalid by changing its border to the error color. |
|
|
21
|
+
<!-- END GENERATED PROPS -->
|
|
22
|
+
|
|
23
|
+
## When to use
|
|
24
|
+
|
|
25
|
+
- Collecting short text such as name, email, or search queries
|
|
26
|
+
- Form fields where a single line of text is enough
|
|
27
|
+
- Surfacing validation errors with the `invalid` prop alongside accessible error messaging
|
|
28
|
+
|
|
29
|
+
## When NOT to use
|
|
30
|
+
|
|
31
|
+
- **Multi-line text** — use a textarea for longer or formatted text.
|
|
32
|
+
- **Fixed option lists** — use a select or radio group when the user must pick from predefined choices.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Input tokens
|
|
2
|
+
|
|
3
|
+
Generated from `src/components/input/input.css`.
|
|
4
|
+
|
|
5
|
+
## Base tokens
|
|
6
|
+
|
|
7
|
+
| Token | Declared value | Resolution |
|
|
8
|
+
| --- | --- | --- |
|
|
9
|
+
| `--c-input-background` | `var(--c-color-gray-95)` | `var(--c-color-gray-95) → hsl(0 0% 95%)` |
|
|
10
|
+
| `--c-input-background-disabled` | `var(--c-color-gray-85)` | `var(--c-color-gray-85) → hsl(0 0% 85%)` |
|
|
11
|
+
| `--c-input-background-focus` | `#ffffff` | `#ffffff` |
|
|
12
|
+
| `--c-input-border-color` | `var(--c-color-gray-85)` | `var(--c-color-gray-85) → hsl(0 0% 85%)` |
|
|
13
|
+
| `--c-input-border-color-disabled` | `var(--c-color-gray-85)` | `var(--c-color-gray-85) → hsl(0 0% 85%)` |
|
|
14
|
+
| `--c-input-border-color-invalid` | `var(--c-color-red-70)` | `var(--c-color-red-70) → hsl(0 100% 70%)` |
|
|
15
|
+
| `--c-input-content` | `var(--c-color-gray-15)` | `var(--c-color-gray-15) → hsl(0 0% 15%)` |
|
|
16
|
+
| `--c-input-content-disabled` | `var(--c-color-gray-30)` | `var(--c-color-gray-30) → hsl(0 0% 30%)` |
|
|
17
|
+
| `--c-input-height` | `40px` | `40px` |
|
|
18
|
+
| `--c-input-padding` | `10px 15px` | `10px 15px` |
|
|
19
|
+
| `--c-input-placeholder` | `var(--c-color-gray-60)` | `var(--c-color-gray-60) → hsl(0 0% 60%)` |
|
|
20
|
+
| `--c-input-placeholder-disabled` | `var(--c-color-gray-50)` | `var(--c-color-gray-50) → hsl(0 0% 50%)` |
|
|
21
|
+
| `--c-input-placeholder-focus` | `var(--c-color-gray-70)` | `var(--c-color-gray-70) → hsl(0 0% 70%)` |
|
|
22
|
+
| `--c-input-radius` | `10px` | `10px` |
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.c-label{--c-label-content: var(--c-color-gray-15);--c-label-content-disabled: var(--c-color-gray-50);color:var(--c-label-content);font-family:var(--c-font-family-primary);font-size:var(--c-font-size-xs);font-weight:600}.c-label.is-disabled{color:var(--c-label-content-disabled)}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./label.css";import{jsx as t}from"react/jsx-runtime";const i=({disabled:e,className:l,children:s,...a})=>{const o=n({disabled:e,className:l});return t("label",{className:o,...a,children:s})};function n({disabled:e,className:l}){const s=["c-label"];return e&&s.push("is-disabled"),[...s,l].filter(Boolean).join(" ")}export default i;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Label
|
|
3
|
+
description: A text label that extends the native HTML label element.
|
|
4
|
+
purpose: Name a form control with consistent label typography, on its own or next to any control.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Label
|
|
8
|
+
|
|
9
|
+
A standalone form label. It extends the native HTML `label` element, so every native attribute (`htmlFor`, `className`, `data-*`, etc.) is accepted. The component adds one visual prop, `disabled`, that renders the text in the disabled color.
|
|
10
|
+
|
|
11
|
+
## Props
|
|
12
|
+
|
|
13
|
+
The Label API extends the native HTML `label` attributes. Props such as `htmlFor` come from the native element and are not listed below.
|
|
14
|
+
|
|
15
|
+
<!-- BEGIN GENERATED PROPS -->
|
|
16
|
+
_Also inherits all props from `LabelHTMLAttributes<HTMLLabelElement>`._
|
|
17
|
+
|
|
18
|
+
| Name | Type | Required | Default | Description |
|
|
19
|
+
| --- | --- | --- | --- | --- |
|
|
20
|
+
| disabled | `boolean` | No | `false` | Renders the text in the disabled color. Visual only: it does not disable any control. |
|
|
21
|
+
<!-- END GENERATED PROPS -->
|
|
22
|
+
|
|
23
|
+
## When to use
|
|
24
|
+
|
|
25
|
+
- Naming a form control by pairing `htmlFor` with the control `id`
|
|
26
|
+
- Showing a label that follows the library typography, with a disabled look next to a disabled control
|
|
27
|
+
|
|
28
|
+
## When NOT to use
|
|
29
|
+
|
|
30
|
+
- **Checkbox or radio captions** — use the `label` prop of the checkbox or radio component, which renders and associates a label for you.
|
|
31
|
+
- **Disabling a control** — the `disabled` prop is visual only; disable the control itself.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Label tokens
|
|
2
|
+
|
|
3
|
+
Generated from `src/components/label/label.css`.
|
|
4
|
+
|
|
5
|
+
## Base tokens
|
|
6
|
+
|
|
7
|
+
| Token | Declared value | Resolution |
|
|
8
|
+
| --- | --- | --- |
|
|
9
|
+
| `--c-label-content` | `var(--c-color-gray-15)` | `var(--c-color-gray-15) → hsl(0 0% 15%)` |
|
|
10
|
+
| `--c-label-content-disabled` | `var(--c-color-gray-50)` | `var(--c-color-gray-50) → hsl(0 0% 50%)` |
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.c-radio-wrapper{display:inline-flex;align-items:center;gap:10px}.c-radio-wrapper .c-label:hover:not(.is-disabled){cursor:pointer}.c-radio{--c-radio-background: var(--c-color-gray-95);--c-radio-background-disabled: var(--c-color-gray-85);--c-radio-background-checked: var(--c-color-gray-10);--c-radio-border-color: var(--c-color-gray-85);--c-radio-border-color-disabled: var(--c-color-gray-85);--c-radio-border-color-checked: var(--c-color-gray-10);--c-radio-check: url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%228.5%22%20height%3D%227.9%22%20viewBox%3D%22386.595%20103.67%208.5%207.855%22%3E%3Cpath%20d%3D%22M395.057,104.851L389.957,111.396C389.917,111.437%20389.851,111.525%20389.77,111.525C389.686,111.525%20389.631,111.466%20389.583,111.418C389.535,111.37%20386.69,108.635%20386.69,108.635L386.635,108.58C386.613,108.547%20386.595,108.507%20386.595,108.463C386.595,108.419%20386.613,108.378%20386.635,108.345C386.65,108.331%20386.66,108.32%20386.675,108.301C386.957,108.004%20387.529,107.403%20387.566,107.367C387.614,107.319%20387.654,107.256%20387.742,107.256C387.834,107.256%20387.892,107.334%20387.936,107.378C387.98,107.421%20389.586,108.965%20389.586,108.965L393.668,103.722C393.704,103.692%20393.749,103.67%20393.796,103.67C393.844,103.67%20393.887,103.688%20393.925,103.718L395.046,104.602C395.076,104.638%20395.094,104.682%20395.094,104.73C395.098,104.778%20395.079,104.818%20395.057,104.851%22%20fill%3D%22white%22%2F%3E%3C%2Fsvg%3E);--c-radio-check-disabled: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%228.5%22%20height%3D%227.9%22%20viewBox%3D%22386.595%20103.67%208.5%207.855%22%3E%3Cpath%20d%3D%22M395.057,104.851L389.957,111.396C389.917,111.437%20389.851,111.525%20389.77,111.525C389.686,111.525%20389.631,111.466%20389.583,111.418C389.535,111.37%20386.69,108.635%20386.69,108.635L386.635,108.58C386.613,108.547%20386.595,108.507%20386.595,108.463C386.595,108.419%20386.613,108.378%20386.635,108.345C386.65,108.331%20386.66,108.32%20386.675,108.301C386.957,108.004%20387.529,107.403%20387.566,107.367C387.614,107.319%20387.654,107.256%20387.742,107.256C387.834,107.256%20387.892,107.334%20387.936,107.378C387.98,107.421%20389.586,108.965%20389.586,108.965L393.668,103.722C393.704,103.692%20393.749,103.67%20393.796,103.67C393.844,103.67%20393.887,103.688%20393.925,103.718L395.046,104.602C395.076,104.638%20395.094,104.682%20395.094,104.73C395.098,104.778%20395.079,104.818%20395.057,104.851%22%20fill%3D%22rgb(128,128,128)%22%2F%3E%3C%2Fsvg%3E");--c-radio-size: 18px;--c-radio-check-size: 8.5px 7.9px;appearance:none;-webkit-appearance:none;-moz-appearance:none;display:inline-block;flex-shrink:0;margin:0;width:var(--c-radio-size);height:var(--c-radio-size);background-color:var(--c-radio-background);background-repeat:no-repeat;background-position:center;background-size:var(--c-radio-check-size);border:1px solid var(--c-radio-border-color);border-radius:50%;outline:none;box-shadow:0 0 0 0 var(--c-color-gray-95);box-sizing:border-box;cursor:pointer;transition:background-color .15s ease-out,border-color .15s ease-out,box-shadow .15s ease-out}.c-radio:checked{background-color:var(--c-radio-background-checked);background-image:var(--c-radio-check);border-color:var(--c-radio-border-color-checked)}.c-radio:focus-visible{box-shadow:0 0 0 5px var(--c-color-gray-95)}.c-radio:focus-visible:not(:checked){background-color:#fff}.c-radio:focus-visible:checked{box-shadow:0 0 0 5px var(--c-color-accented-80)}.c-radio:disabled{background-color:var(--c-radio-background-disabled);border-color:var(--c-radio-border-color-disabled);cursor:default}.c-radio:disabled:checked{background-image:var(--c-radio-check-disabled)}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useId as c}from"react";import p from"../label/label.js";import"./radio.css";import{jsx as i,jsxs as m}from"react/jsx-runtime";const l=({id:o,label:s,className:e,...r})=>{const d=c(),t=o||d,n=["c-radio",e].filter(Boolean).join(" "),a=i("input",{id:s?t:o,className:n,...r,type:"radio"});return s?m("span",{className:"c-radio-wrapper",children:[a,i(p,{htmlFor:t,disabled:r.disabled,children:s})]}):a};export default l;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Radio
|
|
3
|
+
description: A native radio input with the library look and an optional built-in label.
|
|
4
|
+
purpose: Let the user pick exactly one option from a small group of mutually exclusive options.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Radio
|
|
8
|
+
|
|
9
|
+
A styled native `input` of type `radio`. Every native input attribute (`checked`, `defaultChecked`, `disabled`, `onChange`, `name`, `value`, `id`, etc.) is forwarded to the input. Radios sharing a `name` are mutually exclusive, with native keyboard navigation. When `label` is given, the component also renders a `Label` next to the input and associates both, so clicking the text selects the radio.
|
|
10
|
+
|
|
11
|
+
## Props
|
|
12
|
+
|
|
13
|
+
The Radio API extends the native HTML `input` attributes, except `type`. Props such as `name`, `checked` and `onChange` come from the native element and are not listed below.
|
|
14
|
+
|
|
15
|
+
> **Note:** always pass the same `name` to every radio in a group. Without it, each radio becomes its own group: the keyboard focuses each one separately and the arrow keys do not move between options.
|
|
16
|
+
|
|
17
|
+
<!-- BEGIN GENERATED PROPS -->
|
|
18
|
+
_Also inherits all props from `Omit<InputHTMLAttributes<HTMLInputElement>, 'type'>`._
|
|
19
|
+
|
|
20
|
+
| Name | Type | Required | Default | Description |
|
|
21
|
+
| --- | --- | --- | --- | --- |
|
|
22
|
+
| label | `string` | No | | Text of the label rendered next to the radio and associated with it. |
|
|
23
|
+
<!-- END GENERATED PROPS -->
|
|
24
|
+
|
|
25
|
+
## When to use
|
|
26
|
+
|
|
27
|
+
- Picking exactly one option from a short, visible list
|
|
28
|
+
- Groups of options where the user should compare all choices at once
|
|
29
|
+
|
|
30
|
+
## When NOT to use
|
|
31
|
+
|
|
32
|
+
- **Multiple selections** — use checkboxes when any number of options can be picked.
|
|
33
|
+
- **Long option lists** — use a select when there are many options.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Radio tokens
|
|
2
|
+
|
|
3
|
+
Generated from `src/components/radio/radio.css`.
|
|
4
|
+
|
|
5
|
+
## Base tokens
|
|
6
|
+
|
|
7
|
+
| Token | Declared value | Resolution |
|
|
8
|
+
| --- | --- | --- |
|
|
9
|
+
| `--c-radio-background` | `var(--c-color-gray-95)` | `var(--c-color-gray-95) → hsl(0 0% 95%)` |
|
|
10
|
+
| `--c-radio-background-checked` | `var(--c-color-gray-10)` | `var(--c-color-gray-10) → hsl(0 0% 10%)` |
|
|
11
|
+
| `--c-radio-background-disabled` | `var(--c-color-gray-85)` | `var(--c-color-gray-85) → hsl(0 0% 85%)` |
|
|
12
|
+
| `--c-radio-border-color` | `var(--c-color-gray-85)` | `var(--c-color-gray-85) → hsl(0 0% 85%)` |
|
|
13
|
+
| `--c-radio-border-color-checked` | `var(--c-color-gray-10)` | `var(--c-color-gray-10) → hsl(0 0% 10%)` |
|
|
14
|
+
| `--c-radio-border-color-disabled` | `var(--c-color-gray-85)` | `var(--c-color-gray-85) → hsl(0 0% 85%)` |
|
|
15
|
+
| `--c-radio-check` | `url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%228.5%22%20height%3D%227.9%22%20viewBox%3D%22386.595%20103.67%208.5%207.855%22%3E%3Cpath%20d%3D%22M395.057,104.851L389.957,111.396C389.917,111.437%20389.851,111.525%20389.77,111.525C389.686,111.525%20389.631,111.466%20389.583,111.418C389.535,111.37%20386.69,108.635%20386.69,108.635L386.635,108.58C386.613,108.547%20386.595,108.507%20386.595,108.463C386.595,108.419%20386.613,108.378%20386.635,108.345C386.65,108.331%20386.66,108.32%20386.675,108.301C386.957,108.004%20387.529,107.403%20387.566,107.367C387.614,107.319%20387.654,107.256%20387.742,107.256C387.834,107.256%20387.892,107.334%20387.936,107.378C387.98,107.421%20389.586,108.965%20389.586,108.965L393.668,103.722C393.704,103.692%20393.749,103.67%20393.796,103.67C393.844,103.67%20393.887,103.688%20393.925,103.718L395.046,104.602C395.076,104.638%20395.094,104.682%20395.094,104.73C395.098,104.778%20395.079,104.818%20395.057,104.851%22%20fill%3D%22white%22%2F%3E%3C%2Fsvg%3E")` | `url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%228.5%22%20height%3D%227.9%22%20viewBox%3D%22386.595%20103.67%208.5%207.855%22%3E%3Cpath%20d%3D%22M395.057,104.851L389.957,111.396C389.917,111.437%20389.851,111.525%20389.77,111.525C389.686,111.525%20389.631,111.466%20389.583,111.418C389.535,111.37%20386.69,108.635%20386.69,108.635L386.635,108.58C386.613,108.547%20386.595,108.507%20386.595,108.463C386.595,108.419%20386.613,108.378%20386.635,108.345C386.65,108.331%20386.66,108.32%20386.675,108.301C386.957,108.004%20387.529,107.403%20387.566,107.367C387.614,107.319%20387.654,107.256%20387.742,107.256C387.834,107.256%20387.892,107.334%20387.936,107.378C387.98,107.421%20389.586,108.965%20389.586,108.965L393.668,103.722C393.704,103.692%20393.749,103.67%20393.796,103.67C393.844,103.67%20393.887,103.688%20393.925,103.718L395.046,104.602C395.076,104.638%20395.094,104.682%20395.094,104.73C395.098,104.778%20395.079,104.818%20395.057,104.851%22%20fill%3D%22white%22%2F%3E%3C%2Fsvg%3E")` |
|
|
16
|
+
| `--c-radio-check-disabled` | `url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%228.5%22%20height%3D%227.9%22%20viewBox%3D%22386.595%20103.67%208.5%207.855%22%3E%3Cpath%20d%3D%22M395.057,104.851L389.957,111.396C389.917,111.437%20389.851,111.525%20389.77,111.525C389.686,111.525%20389.631,111.466%20389.583,111.418C389.535,111.37%20386.69,108.635%20386.69,108.635L386.635,108.58C386.613,108.547%20386.595,108.507%20386.595,108.463C386.595,108.419%20386.613,108.378%20386.635,108.345C386.65,108.331%20386.66,108.32%20386.675,108.301C386.957,108.004%20387.529,107.403%20387.566,107.367C387.614,107.319%20387.654,107.256%20387.742,107.256C387.834,107.256%20387.892,107.334%20387.936,107.378C387.98,107.421%20389.586,108.965%20389.586,108.965L393.668,103.722C393.704,103.692%20393.749,103.67%20393.796,103.67C393.844,103.67%20393.887,103.688%20393.925,103.718L395.046,104.602C395.076,104.638%20395.094,104.682%20395.094,104.73C395.098,104.778%20395.079,104.818%20395.057,104.851%22%20fill%3D%22rgb(128,128,128)%22%2F%3E%3C%2Fsvg%3E")` | `url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%228.5%22%20height%3D%227.9%22%20viewBox%3D%22386.595%20103.67%208.5%207.855%22%3E%3Cpath%20d%3D%22M395.057,104.851L389.957,111.396C389.917,111.437%20389.851,111.525%20389.77,111.525C389.686,111.525%20389.631,111.466%20389.583,111.418C389.535,111.37%20386.69,108.635%20386.69,108.635L386.635,108.58C386.613,108.547%20386.595,108.507%20386.595,108.463C386.595,108.419%20386.613,108.378%20386.635,108.345C386.65,108.331%20386.66,108.32%20386.675,108.301C386.957,108.004%20387.529,107.403%20387.566,107.367C387.614,107.319%20387.654,107.256%20387.742,107.256C387.834,107.256%20387.892,107.334%20387.936,107.378C387.98,107.421%20389.586,108.965%20389.586,108.965L393.668,103.722C393.704,103.692%20393.749,103.67%20393.796,103.67C393.844,103.67%20393.887,103.688%20393.925,103.718L395.046,104.602C395.076,104.638%20395.094,104.682%20395.094,104.73C395.098,104.778%20395.079,104.818%20395.057,104.851%22%20fill%3D%22rgb(128,128,128)%22%2F%3E%3C%2Fsvg%3E")` |
|
|
17
|
+
| `--c-radio-check-size` | `8.5px 7.9px` | `8.5px 7.9px` |
|
|
18
|
+
| `--c-radio-size` | `18px` | `18px` |
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.c-select{--c-select-background: var(--c-color-gray-95);--c-select-background-focus: #ffffff;--c-select-background-disabled: var(--c-color-gray-85);--c-select-content: var(--c-color-gray-15);--c-select-content-disabled: var(--c-color-gray-30);--c-select-placeholder: var(--c-color-gray-60);--c-select-placeholder-focus: var(--c-color-gray-70);--c-select-placeholder-disabled: var(--c-color-gray-50);--c-select-border-color: var(--c-select-background);--c-select-border-color-focus: var(--c-color-gray-85);--c-select-border-color-invalid: var(--c-color-red-70);--c-select-border-color-disabled: var(--c-select-background-disabled);--c-select-arrow: url("data:image/svg+xml,%3Csvg%20width%3D%22100%25%22%20height%3D%22100%25%22%20viewBox%3D%220%200%2040%2040%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20style%3D%22fill-rule%3Aevenodd%3Bclip-rule%3Aevenodd%3Bstroke-linecap%3Around%3Bstroke-miterlimit%3A10%3B%22%3E%20%3Crect%20x%3D%220%22%20y%3D%220%22%20width%3D%2240%22%20height%3D%2240%22%20style%3D%22fill%3Anone%3B%22%2F%3E%20%3Cpath%20d%3D%22M23.07%2C16L20%2C12.93L16.93%2C16M16.93%2C24L20%2C27.07L23.07%2C24%22%20style%3D%22fill%3Anone%3Bfill-rule%3Anonzero%3Bstroke%3Argb(38%2C38%2C38)%3Bstroke-width%3A1px%3B%22%2F%3E%20%3C%2Fsvg%3E");--c-select-arrow-disabled: url("data:image/svg+xml,%3Csvg%20width%3D%22100%25%22%20height%3D%22100%25%22%20viewBox%3D%220%200%2040%2040%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20style%3D%22fill-rule%3Aevenodd%3Bclip-rule%3Aevenodd%3Bstroke-linecap%3Around%3Bstroke-miterlimit%3A10%3B%22%3E%20%3Crect%20x%3D%220%22%20y%3D%220%22%20width%3D%2240%22%20height%3D%2240%22%20style%3D%22fill%3Anone%3B%22%2F%3E%20%3Cpath%20d%3D%22M23.07%2C16L20%2C12.93L16.93%2C16M16.93%2C24L20%2C27.07L23.07%2C24%22%20style%3D%22fill%3Anone%3Bfill-rule%3Anonzero%3Bstroke%3Argb(128%2C128%2C128)%3Bstroke-width%3A1px%3B%22%2F%3E%20%3C%2Fsvg%3E");--c-select-radius: 10px;--c-select-height: 40px;--c-select-padding: 10px 40px 10px 15px;appearance:none;-webkit-appearance:none;-moz-appearance:none;box-sizing:border-box;width:100%;height:var(--c-select-height);padding:var(--c-select-padding);background-color:var(--c-select-background);background-image:var(--c-select-arrow);background-repeat:no-repeat;background-position:right center;background-size:40px 40px;color:var(--c-select-content);font-family:var(--c-font-family-primary);font-size:1rem;line-height:1;border:1px solid var(--c-select-border-color);border-radius:var(--c-select-radius);outline:none;box-shadow:0 0 0 0 var(--c-color-gray-95);cursor:pointer;transition:background-color .15s ease-out,border-color .15s ease-out,box-shadow .15s ease-out,color .15s ease-out}.c-select:focus-visible{background-color:var(--c-select-background-focus);border-color:var(--c-select-border-color-focus);box-shadow:0 0 0 5px var(--c-color-gray-95)}.c-select:disabled{background-color:var(--c-select-background-disabled);background-image:var(--c-select-arrow-disabled);color:var(--c-select-content-disabled);border-color:var(--c-select-border-color-disabled);cursor:default;opacity:1}.c-select.is-blank{color:var(--c-select-placeholder)}.c-select.is-blank:focus-visible{color:var(--c-select-placeholder-focus)}.c-select.is-blank:disabled{color:var(--c-select-placeholder-disabled)}.c-select.is-invalid{border-color:var(--c-select-border-color-invalid)}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useEffect as h,useRef as m,useState as p}from"react";import"./select.css";import{jsx as d}from"react/jsx-runtime";const g=({invalid:t,className:l,value:s,onChange:e,children:o,...r})=>{const n=m(),[i,a]=p(!1),f=j({invalid:t,isBlank:i,className:l}),u=c=>{a(c.target.value===""),e?.(c)};return h(()=>{a(n.current.value==="")},[s]),d("select",{ref:n,className:f,value:s,...r,onChange:u,children:o})};function j({invalid:t,isBlank:l,className:s}){const e=["c-select"];return t&&e.push("is-invalid"),l&&e.push("is-blank"),[...e,s].filter(Boolean).join(" ")}export default g;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Select
|
|
3
|
+
description: Dropdown field that lets the user choose one option from a fixed list.
|
|
4
|
+
purpose: Let the user choose one option from a fixed list.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Select
|
|
8
|
+
|
|
9
|
+
A dropdown field. It extends the native HTML `select` element, so every native attribute (`value`, `multiple`, `disabled`, `onChange`, etc.) is accepted. The component adds one visual prop, `invalid`, that marks the field as having an error. The border matches the fill color in every state except `focus-visible` (`gray-85` on a white fill) and `invalid` (`red-70`).
|
|
10
|
+
|
|
11
|
+
## Props
|
|
12
|
+
|
|
13
|
+
The Select API extends the native HTML `select` attributes. Props such as `disabled` and `value` come from the native element and are not listed below.
|
|
14
|
+
|
|
15
|
+
<!-- BEGIN GENERATED PROPS -->
|
|
16
|
+
_Also inherits all props from `SelectHTMLAttributes<HTMLSelectElement>`._
|
|
17
|
+
|
|
18
|
+
| Name | Type | Required | Default | Description |
|
|
19
|
+
| --- | --- | --- | --- | --- |
|
|
20
|
+
| children | `ReactNode` | No | `undefined` | Option elements rendered inside the select. |
|
|
21
|
+
| invalid | `boolean` | No | `false` | Marks the field as invalid by changing its border to the error color. |
|
|
22
|
+
<!-- END GENERATED PROPS -->
|
|
23
|
+
|
|
24
|
+
## When to use
|
|
25
|
+
|
|
26
|
+
- Choosing one option from a fixed list of values
|
|
27
|
+
- Form fields where a compact dropdown is enough
|
|
28
|
+
- Surfacing validation errors with the `invalid` prop alongside accessible error messaging
|
|
29
|
+
|
|
30
|
+
## When NOT to use
|
|
31
|
+
|
|
32
|
+
- **Free text** — use Input or Textarea when the user types their own value.
|
|
33
|
+
- **Few always-visible options** — use a radio group when all choices should stay on screen.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Select tokens
|
|
2
|
+
|
|
3
|
+
Generated from `src/components/select/select.css`.
|
|
4
|
+
|
|
5
|
+
## Base tokens
|
|
6
|
+
|
|
7
|
+
| Token | Declared value | Resolution |
|
|
8
|
+
| --- | --- | --- |
|
|
9
|
+
| `--c-select-arrow` | `url("data:image/svg+xml,%3Csvg%20width%3D%22100%25%22%20height%3D%22100%25%22%20viewBox%3D%220%200%2040%2040%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20style%3D%22fill-rule%3Aevenodd%3Bclip-rule%3Aevenodd%3Bstroke-linecap%3Around%3Bstroke-miterlimit%3A10%3B%22%3E%20%3Crect%20x%3D%220%22%20y%3D%220%22%20width%3D%2240%22%20height%3D%2240%22%20style%3D%22fill%3Anone%3B%22%2F%3E%20%3Cpath%20d%3D%22M23.07%2C16L20%2C12.93L16.93%2C16M16.93%2C24L20%2C27.07L23.07%2C24%22%20style%3D%22fill%3Anone%3Bfill-rule%3Anonzero%3Bstroke%3Argb(38%2C38%2C38)%3Bstroke-width%3A1px%3B%22%2F%3E%20%3C%2Fsvg%3E")` | `url("data:image/svg+xml,%3Csvg%20width%3D%22100%25%22%20height%3D%22100%25%22%20viewBox%3D%220%200%2040%2040%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20style%3D%22fill-rule%3Aevenodd%3Bclip-rule%3Aevenodd%3Bstroke-linecap%3Around%3Bstroke-miterlimit%3A10%3B%22%3E%20%3Crect%20x%3D%220%22%20y%3D%220%22%20width%3D%2240%22%20height%3D%2240%22%20style%3D%22fill%3Anone%3B%22%2F%3E%20%3Cpath%20d%3D%22M23.07%2C16L20%2C12.93L16.93%2C16M16.93%2C24L20%2C27.07L23.07%2C24%22%20style%3D%22fill%3Anone%3Bfill-rule%3Anonzero%3Bstroke%3Argb(38%2C38%2C38)%3Bstroke-width%3A1px%3B%22%2F%3E%20%3C%2Fsvg%3E")` |
|
|
10
|
+
| `--c-select-arrow-disabled` | `url("data:image/svg+xml,%3Csvg%20width%3D%22100%25%22%20height%3D%22100%25%22%20viewBox%3D%220%200%2040%2040%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20style%3D%22fill-rule%3Aevenodd%3Bclip-rule%3Aevenodd%3Bstroke-linecap%3Around%3Bstroke-miterlimit%3A10%3B%22%3E%20%3Crect%20x%3D%220%22%20y%3D%220%22%20width%3D%2240%22%20height%3D%2240%22%20style%3D%22fill%3Anone%3B%22%2F%3E%20%3Cpath%20d%3D%22M23.07%2C16L20%2C12.93L16.93%2C16M16.93%2C24L20%2C27.07L23.07%2C24%22%20style%3D%22fill%3Anone%3Bfill-rule%3Anonzero%3Bstroke%3Argb(128%2C128%2C128)%3Bstroke-width%3A1px%3B%22%2F%3E%20%3C%2Fsvg%3E")` | `url("data:image/svg+xml,%3Csvg%20width%3D%22100%25%22%20height%3D%22100%25%22%20viewBox%3D%220%200%2040%2040%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20style%3D%22fill-rule%3Aevenodd%3Bclip-rule%3Aevenodd%3Bstroke-linecap%3Around%3Bstroke-miterlimit%3A10%3B%22%3E%20%3Crect%20x%3D%220%22%20y%3D%220%22%20width%3D%2240%22%20height%3D%2240%22%20style%3D%22fill%3Anone%3B%22%2F%3E%20%3Cpath%20d%3D%22M23.07%2C16L20%2C12.93L16.93%2C16M16.93%2C24L20%2C27.07L23.07%2C24%22%20style%3D%22fill%3Anone%3Bfill-rule%3Anonzero%3Bstroke%3Argb(128%2C128%2C128)%3Bstroke-width%3A1px%3B%22%2F%3E%20%3C%2Fsvg%3E")` |
|
|
11
|
+
| `--c-select-background` | `var(--c-color-gray-95)` | `var(--c-color-gray-95) → hsl(0 0% 95%)` |
|
|
12
|
+
| `--c-select-background-disabled` | `var(--c-color-gray-85)` | `var(--c-color-gray-85) → hsl(0 0% 85%)` |
|
|
13
|
+
| `--c-select-background-focus` | `#ffffff` | `#ffffff` |
|
|
14
|
+
| `--c-select-border-color` | `var(--c-select-background)` | `var(--c-select-background) → var(--c-color-gray-95) → hsl(0 0% 95%)` |
|
|
15
|
+
| `--c-select-border-color-disabled` | `var(--c-select-background-disabled)` | `var(--c-select-background-disabled) → var(--c-color-gray-85) → hsl(0 0% 85%)` |
|
|
16
|
+
| `--c-select-border-color-focus` | `var(--c-color-gray-85)` | `var(--c-color-gray-85) → hsl(0 0% 85%)` |
|
|
17
|
+
| `--c-select-border-color-invalid` | `var(--c-color-red-70)` | `var(--c-color-red-70) → hsl(0 100% 70%)` |
|
|
18
|
+
| `--c-select-content` | `var(--c-color-gray-15)` | `var(--c-color-gray-15) → hsl(0 0% 15%)` |
|
|
19
|
+
| `--c-select-content-disabled` | `var(--c-color-gray-30)` | `var(--c-color-gray-30) → hsl(0 0% 30%)` |
|
|
20
|
+
| `--c-select-height` | `40px` | `40px` |
|
|
21
|
+
| `--c-select-padding` | `10px 40px 10px 15px` | `10px 40px 10px 15px` |
|
|
22
|
+
| `--c-select-placeholder` | `var(--c-color-gray-60)` | `var(--c-color-gray-60) → hsl(0 0% 60%)` |
|
|
23
|
+
| `--c-select-placeholder-disabled` | `var(--c-color-gray-50)` | `var(--c-color-gray-50) → hsl(0 0% 50%)` |
|
|
24
|
+
| `--c-select-placeholder-focus` | `var(--c-color-gray-70)` | `var(--c-color-gray-70) → hsl(0 0% 70%)` |
|
|
25
|
+
| `--c-select-radius` | `10px` | `10px` |
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.c-textarea{--c-textarea-background: var(--c-color-gray-95);--c-textarea-background-focus: #ffffff;--c-textarea-background-disabled: var(--c-color-gray-85);--c-textarea-content: var(--c-color-gray-15);--c-textarea-content-disabled: var(--c-color-gray-30);--c-textarea-placeholder: var(--c-color-gray-60);--c-textarea-placeholder-focus: var(--c-color-gray-70);--c-textarea-placeholder-disabled: var(--c-color-gray-50);--c-textarea-border-color: var(--c-color-gray-85);--c-textarea-border-color-invalid: var(--c-color-red-70);--c-textarea-border-color-disabled: var(--c-color-gray-85);--c-textarea-radius: 10px;--c-textarea-min-height: 40px;--c-textarea-padding: 10px 15px;box-sizing:border-box;width:100%;min-height:var(--c-textarea-min-height);padding:var(--c-textarea-padding);background:var(--c-textarea-background);color:var(--c-textarea-content);font-family:var(--c-font-family-primary);font-size:1rem;border:1px solid var(--c-textarea-border-color);border-radius:var(--c-textarea-radius);resize:vertical;outline:none;box-shadow:0 0 0 0 var(--c-color-gray-95);transition:background-color .15s ease-out,border-color .15s ease-out,box-shadow .15s ease-out,color .15s ease-out}.c-textarea::placeholder{color:var(--c-textarea-placeholder)}.c-textarea:focus-visible{background:var(--c-textarea-background-focus);box-shadow:0 0 0 5px var(--c-color-gray-95)}.c-textarea:focus-visible::placeholder{color:var(--c-textarea-placeholder-focus)}.c-textarea:disabled{background:var(--c-textarea-background-disabled);color:var(--c-textarea-content-disabled);border-color:var(--c-textarea-border-color-disabled)}.c-textarea:disabled::placeholder{color:var(--c-textarea-placeholder-disabled)}.c-textarea.is-invalid{border-color:var(--c-textarea-border-color-invalid)}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./textarea.css";import{jsx as r}from"react/jsx-runtime";const o=({invalid:e,className:a,...s})=>{const t=i({invalid:e,className:a});return r("textarea",{className:t,...s})};function i({invalid:e,className:a}){const s=["c-textarea"];return e&&s.push("is-invalid"),[...s,a].filter(Boolean).join(" ")}export default o;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Textarea
|
|
3
|
+
description: Multi-line text field that collects a longer text value from the user.
|
|
4
|
+
purpose: Collect a longer text value such as a comment or a message.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Textarea
|
|
8
|
+
|
|
9
|
+
A multi-line text field. It extends the native HTML `textarea` element, so every native attribute (`value`, `rows`, `disabled`, `onChange`, etc.) is accepted. The component adds one visual prop, `invalid`, that marks the field as having an error. Its visual states match the Input.
|
|
10
|
+
|
|
11
|
+
## Props
|
|
12
|
+
|
|
13
|
+
The Textarea API extends the native HTML `textarea` attributes. Props such as `disabled` come from the native element and are not listed below.
|
|
14
|
+
|
|
15
|
+
<!-- BEGIN GENERATED PROPS -->
|
|
16
|
+
_Also inherits all props from `TextareaHTMLAttributes<HTMLTextAreaElement>`._
|
|
17
|
+
|
|
18
|
+
| Name | Type | Required | Default | Description |
|
|
19
|
+
| --- | --- | --- | --- | --- |
|
|
20
|
+
| invalid | `boolean` | No | `false` | Marks the field as invalid by changing its border to the error color. |
|
|
21
|
+
<!-- END GENERATED PROPS -->
|
|
22
|
+
|
|
23
|
+
## When to use
|
|
24
|
+
|
|
25
|
+
- Collecting longer text such as comments, messages, or descriptions
|
|
26
|
+
- Form fields where the user needs more than one line
|
|
27
|
+
- Surfacing validation errors with the `invalid` prop alongside accessible error messaging
|
|
28
|
+
|
|
29
|
+
## When NOT to use
|
|
30
|
+
|
|
31
|
+
- **Short single-line text** — use Input for names, emails, or search queries.
|
|
32
|
+
- **Fixed option lists** — use a select or radio group when the user must pick from predefined choices.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Textarea tokens
|
|
2
|
+
|
|
3
|
+
Generated from `src/components/textarea/textarea.css`.
|
|
4
|
+
|
|
5
|
+
## Base tokens
|
|
6
|
+
|
|
7
|
+
| Token | Declared value | Resolution |
|
|
8
|
+
| --- | --- | --- |
|
|
9
|
+
| `--c-textarea-background` | `var(--c-color-gray-95)` | `var(--c-color-gray-95) → hsl(0 0% 95%)` |
|
|
10
|
+
| `--c-textarea-background-disabled` | `var(--c-color-gray-85)` | `var(--c-color-gray-85) → hsl(0 0% 85%)` |
|
|
11
|
+
| `--c-textarea-background-focus` | `#ffffff` | `#ffffff` |
|
|
12
|
+
| `--c-textarea-border-color` | `var(--c-color-gray-85)` | `var(--c-color-gray-85) → hsl(0 0% 85%)` |
|
|
13
|
+
| `--c-textarea-border-color-disabled` | `var(--c-color-gray-85)` | `var(--c-color-gray-85) → hsl(0 0% 85%)` |
|
|
14
|
+
| `--c-textarea-border-color-invalid` | `var(--c-color-red-70)` | `var(--c-color-red-70) → hsl(0 100% 70%)` |
|
|
15
|
+
| `--c-textarea-content` | `var(--c-color-gray-15)` | `var(--c-color-gray-15) → hsl(0 0% 15%)` |
|
|
16
|
+
| `--c-textarea-content-disabled` | `var(--c-color-gray-30)` | `var(--c-color-gray-30) → hsl(0 0% 30%)` |
|
|
17
|
+
| `--c-textarea-min-height` | `40px` | `40px` |
|
|
18
|
+
| `--c-textarea-padding` | `10px 15px` | `10px 15px` |
|
|
19
|
+
| `--c-textarea-placeholder` | `var(--c-color-gray-60)` | `var(--c-color-gray-60) → hsl(0 0% 60%)` |
|
|
20
|
+
| `--c-textarea-placeholder-disabled` | `var(--c-color-gray-50)` | `var(--c-color-gray-50) → hsl(0 0% 50%)` |
|
|
21
|
+
| `--c-textarea-placeholder-focus` | `var(--c-color-gray-70)` | `var(--c-color-gray-70) → hsl(0 0% 70%)` |
|
|
22
|
+
| `--c-textarea-radius` | `10px` | `10px` |
|
|
@@ -5,3 +5,9 @@ Generated from component frontmatter. Human usage sections live in each componen
|
|
|
5
5
|
| Component | Description | Purpose | Doc path |
|
|
6
6
|
| --- | --- | --- | --- |
|
|
7
7
|
| Button | A native button element with variant styles driven by design tokens. | Trigger actions and submit forms with consistent visual variants. | [`../components/button/button.md`](../components/button/button.md) |
|
|
8
|
+
| Checkbox | A native checkbox input with the library look and an optional built-in label. | Let the user turn an option on or off, or pick several options from a list. | [`../components/checkbox/checkbox.md`](../components/checkbox/checkbox.md) |
|
|
9
|
+
| Input | A single-line text field that extends the native HTML input element. | Collect short text values in forms with consistent field styling and error indication. | [`../components/input/input.md`](../components/input/input.md) |
|
|
10
|
+
| Label | A text label that extends the native HTML label element. | Name a form control with consistent label typography, on its own or next to any control. | [`../components/label/label.md`](../components/label/label.md) |
|
|
11
|
+
| Radio | A native radio input with the library look and an optional built-in label. | Let the user pick exactly one option from a small group of mutually exclusive options. | [`../components/radio/radio.md`](../components/radio/radio.md) |
|
|
12
|
+
| Select | Dropdown field that lets the user choose one option from a fixed list. | Let the user choose one option from a fixed list. | [`../components/select/select.md`](../components/select/select.md) |
|
|
13
|
+
| Textarea | Multi-line text field that collects a longer text value from the user. | Collect a longer text value such as a comment or a message. | [`../components/textarea/textarea.md`](../components/textarea/textarea.md) |
|
package/dist/es6/docs/tokens.md
CHANGED
|
@@ -30,4 +30,26 @@ Generated from `src/vars.css`. Values show the declared token and the resolved r
|
|
|
30
30
|
| `--c-color-gray-85` | `hsl(0 0% 85%)` | `hsl(0 0% 85%)` |
|
|
31
31
|
| `--c-color-gray-90` | `hsl(0 0% 90%)` | `hsl(0 0% 90%)` |
|
|
32
32
|
| `--c-color-gray-95` | `hsl(0 0% 95%)` | `hsl(0 0% 95%)` |
|
|
33
|
+
| `--c-color-red-10` | `hsl(0 100% 10%)` | `hsl(0 100% 10%)` |
|
|
34
|
+
| `--c-color-red-15` | `hsl(0 100% 15%)` | `hsl(0 100% 15%)` |
|
|
35
|
+
| `--c-color-red-20` | `hsl(0 100% 20%)` | `hsl(0 100% 20%)` |
|
|
36
|
+
| `--c-color-red-30` | `hsl(0 100% 30%)` | `hsl(0 100% 30%)` |
|
|
37
|
+
| `--c-color-red-40` | `hsl(0 100% 40%)` | `hsl(0 100% 40%)` |
|
|
38
|
+
| `--c-color-red-5` | `hsl(0 100% 5%)` | `hsl(0 100% 5%)` |
|
|
39
|
+
| `--c-color-red-50` | `hsl(0 100% 50%)` | `hsl(0 100% 50%)` |
|
|
40
|
+
| `--c-color-red-60` | `hsl(0 100% 60%)` | `hsl(0 100% 60%)` |
|
|
41
|
+
| `--c-color-red-70` | `hsl(0 100% 70%)` | `hsl(0 100% 70%)` |
|
|
42
|
+
| `--c-color-red-80` | `hsl(0 100% 80%)` | `hsl(0 100% 80%)` |
|
|
43
|
+
| `--c-color-red-85` | `hsl(0 100% 85%)` | `hsl(0 100% 85%)` |
|
|
44
|
+
| `--c-color-red-90` | `hsl(0 100% 90%)` | `hsl(0 100% 90%)` |
|
|
45
|
+
| `--c-color-red-95` | `hsl(0 100% 95%)` | `hsl(0 100% 95%)` |
|
|
33
46
|
| `--c-font-family-primary` | `'Inter', sans-serif` | `'Inter', sans-serif` |
|
|
47
|
+
| `--c-font-size-lg` | `1.250rem` | `1.250rem` |
|
|
48
|
+
| `--c-font-size-md` | `1.125rem` | `1.125rem` |
|
|
49
|
+
| `--c-font-size-sm` | `1.000rem` | `1.000rem` |
|
|
50
|
+
| `--c-font-size-xl` | `1.500rem` | `1.500rem` |
|
|
51
|
+
| `--c-font-size-xs` | `0.875rem` | `0.875rem` |
|
|
52
|
+
| `--c-font-size-xxl` | `2.250rem` | `2.250rem` |
|
|
53
|
+
| `--c-font-size-xxs` | `0.750rem` | `0.750rem` |
|
|
54
|
+
| `--c-font-size-xxxl` | `3.000rem` | `3.000rem` |
|
|
55
|
+
| `--c-font-size-xxxs` | `0.625rem` | `0.625rem` |
|
package/dist/es6/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./index.css";export{default as Button}from"./components/button/button.js";
|
|
1
|
+
import"./index.css";export{default as Button}from"./components/button/button.js";export{default as Checkbox}from"./components/checkbox/checkbox.js";export{default as Input}from"./components/input/input.js";export{default as Label}from"./components/label/label.js";export{default as Radio}from"./components/radio/radio.js";export{default as Select}from"./components/select/select.js";export{default as Textarea}from"./components/textarea/textarea.js";
|
package/dist/es6/vars.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
:root{--c-font-family-primary: "Inter", sans-serif;--c-color-gray-95: hsl(0 0% 95%);--c-color-gray-90: hsl(0 0% 90%);--c-color-gray-85: hsl(0 0% 85%);--c-color-gray-80: hsl(0 0% 80%);--c-color-gray-70: hsl(0 0% 70%);--c-color-gray-60: hsl(0 0% 60%);--c-color-gray-50: hsl(0 0% 50%);--c-color-gray-40: hsl(0 0% 40%);--c-color-gray-30: hsl(0 0% 30%);--c-color-gray-20: hsl(0 0% 20%);--c-color-gray-15: hsl(0 0% 15%);--c-color-gray-10: hsl(0 0% 10%);--c-color-gray-5: hsl(0 0% 5%);--c-color-accented-95: var(--c-color-gray-95);--c-color-accented-90: var(--c-color-gray-90);--c-color-accented-85: var(--c-color-gray-85);--c-color-accented-80: var(--c-color-gray-80);--c-color-accented-70: var(--c-color-gray-70);--c-color-accented-60: var(--c-color-gray-60);--c-color-accented-50: var(--c-color-gray-50);--c-color-accented-40: var(--c-color-gray-40);--c-color-accented-30: var(--c-color-gray-30);--c-color-accented-20: var(--c-color-gray-20);--c-color-accented-15: var(--c-color-gray-15);--c-color-accented-10: var(--c-color-gray-10);--c-color-accented-5: var(--c-color-gray-5)}
|
|
1
|
+
:root{--c-font-family-primary: "Inter", sans-serif;--c-font-size-xxxs: .625rem;--c-font-size-xxs: .75rem;--c-font-size-xs: .875rem;--c-font-size-sm: 1rem;--c-font-size-md: 1.125rem;--c-font-size-lg: 1.25rem;--c-font-size-xl: 1.5rem;--c-font-size-xxl: 2.25rem;--c-font-size-xxxl: 3rem;--c-color-gray-95: hsl(0 0% 95%);--c-color-gray-90: hsl(0 0% 90%);--c-color-gray-85: hsl(0 0% 85%);--c-color-gray-80: hsl(0 0% 80%);--c-color-gray-70: hsl(0 0% 70%);--c-color-gray-60: hsl(0 0% 60%);--c-color-gray-50: hsl(0 0% 50%);--c-color-gray-40: hsl(0 0% 40%);--c-color-gray-30: hsl(0 0% 30%);--c-color-gray-20: hsl(0 0% 20%);--c-color-gray-15: hsl(0 0% 15%);--c-color-gray-10: hsl(0 0% 10%);--c-color-gray-5: hsl(0 0% 5%);--c-color-red-95: hsl(0 100% 95%);--c-color-red-90: hsl(0 100% 90%);--c-color-red-85: hsl(0 100% 85%);--c-color-red-80: hsl(0 100% 80%);--c-color-red-70: hsl(0 100% 70%);--c-color-red-60: hsl(0 100% 60%);--c-color-red-50: hsl(0 100% 50%);--c-color-red-40: hsl(0 100% 40%);--c-color-red-30: hsl(0 100% 30%);--c-color-red-20: hsl(0 100% 20%);--c-color-red-15: hsl(0 100% 15%);--c-color-red-10: hsl(0 100% 10%);--c-color-red-5: hsl(0 100% 5%);--c-color-accented-95: var(--c-color-gray-95);--c-color-accented-90: var(--c-color-gray-90);--c-color-accented-85: var(--c-color-gray-85);--c-color-accented-80: var(--c-color-gray-80);--c-color-accented-70: var(--c-color-gray-70);--c-color-accented-60: var(--c-color-gray-60);--c-color-accented-50: var(--c-color-gray-50);--c-color-accented-40: var(--c-color-gray-40);--c-color-accented-30: var(--c-color-gray-30);--c-color-accented-20: var(--c-color-gray-20);--c-color-accented-15: var(--c-color-gray-15);--c-color-accented-10: var(--c-color-gray-10);--c-color-accented-5: var(--c-color-gray-5)}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,14 @@
|
|
|
1
1
|
export type { ButtonProps } from './components/button/button.d.ts';
|
|
2
|
-
export { default as Button } from './components/button/button.d.ts';
|
|
2
|
+
export { default as Button } from './components/button/button.d.ts';
|
|
3
|
+
export type { CheckboxProps } from './components/checkbox/checkbox.d.ts';
|
|
4
|
+
export { default as Checkbox } from './components/checkbox/checkbox.d.ts';
|
|
5
|
+
export type { InputProps } from './components/input/input.d.ts';
|
|
6
|
+
export { default as Input } from './components/input/input.d.ts';
|
|
7
|
+
export type { LabelProps } from './components/label/label.d.ts';
|
|
8
|
+
export { default as Label } from './components/label/label.d.ts';
|
|
9
|
+
export type { RadioProps } from './components/radio/radio.d.ts';
|
|
10
|
+
export { default as Radio } from './components/radio/radio.d.ts';
|
|
11
|
+
export type { SelectProps } from './components/select/select.d.ts';
|
|
12
|
+
export { default as Select } from './components/select/select.d.ts';
|
|
13
|
+
export type { TextareaProps } from './components/textarea/textarea.d.ts';
|
|
14
|
+
export { default as Textarea } from './components/textarea/textarea.d.ts';
|