@compilorama/compy 0.4.0 → 0.5.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 +13 -0
- package/dist/cjs/components/form-control/form-control.css +1 -0
- package/dist/cjs/components/form-control/form-control.js +1 -0
- package/dist/cjs/components/form-control/form-control.md +36 -0
- package/dist/cjs/components/form-control/tokens.md +11 -0
- package/dist/cjs/components/label/label.css +1 -1
- package/dist/cjs/components/label/label.js +1 -1
- package/dist/cjs/components/label/label.md +4 -1
- package/dist/cjs/components/label/tokens.md +1 -0
- package/dist/cjs/docs/components.md +1 -0
- package/dist/cjs/index.js +1 -1
- package/dist/docs/components.md +1 -0
- package/dist/es6/components/form-control/form-control.css +1 -0
- package/dist/es6/components/form-control/form-control.js +1 -0
- package/dist/es6/components/form-control/form-control.md +36 -0
- package/dist/es6/components/form-control/tokens.md +11 -0
- package/dist/es6/components/label/label.css +1 -1
- package/dist/es6/components/label/label.js +1 -1
- package/dist/es6/components/label/label.md +4 -1
- package/dist/es6/components/label/tokens.md +1 -0
- package/dist/es6/docs/components.md +1 -0
- package/dist/es6/index.js +1 -1
- package/dist/index.d.ts +2 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
# [0.5.0](https://github.com/compilorama/compy/compare/v0.4.0...v0.5.0) (2026-11-22)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* add left margin to form control label and error message ([93570b3](https://github.com/compilorama/compy/commit/93570b3744dc656ad6421606537a257f3ba2ad5f))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **form-control:** add FormControl component ([6dedcb7](https://github.com/compilorama/compy/commit/6dedcb7fcab05f986cecfc131a9db30eb5246573))
|
|
12
|
+
* **label:** add required prop ([f929f1b](https://github.com/compilorama/compy/commit/f929f1b130703f6f6af79c013b9be31836de4477))
|
|
13
|
+
|
|
1
14
|
# [0.4.0](https://github.com/compilorama/compy/compare/v0.3.0...v0.4.0) (2026-11-21)
|
|
2
15
|
|
|
3
16
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.c-form-control{--c-form-control-gap: 10px;--c-form-control-inset: 10px;--c-form-control-error-content: var(--c-color-red-70);display:flex;flex-direction:column;gap:var(--c-form-control-gap)}.c-form-control>label{align-self:flex-start;margin-left:var(--c-form-control-inset)}.c-form-control-error-message{margin-left:var(--c-form-control-inset);color:var(--c-form-control-error-content);font-family:var(--c-font-family-primary);font-size:var(--c-font-size-xs);font-weight:400}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _label=_interopRequireDefault(require("../label/label.jsx"));require("./form-control.css");var _jsxRuntime=require("react/jsx-runtime");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const FormControl=({label:e,htmlFor:t,required:o,errorMessage:r,className:l,children:s,...u})=>{const a=["c-form-control",l].filter(Boolean).join(" ");return(0,_jsxRuntime.jsxs)("div",{className:a,...u,children:[e&&(0,_jsxRuntime.jsx)(_label.default,{htmlFor:t,required:o,children:e}),s,r&&(0,_jsxRuntime.jsx)("span",{className:"c-form-control-error-message",children:r})]})};var _default=exports.default=FormControl;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: FormControl
|
|
3
|
+
description: A wrapper that places a label above a form field and an optional error message below it.
|
|
4
|
+
purpose: Compose a label, a field, and an error message with consistent spacing, so consumers do not do it by hand.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# FormControl
|
|
8
|
+
|
|
9
|
+
Wraps a form field (`Input`, `Select`, `Textarea`, etc.), passed as `children`, with a `Label` above it and an optional error message below it. Extra native `div` attributes and `className` are applied to the root element.
|
|
10
|
+
|
|
11
|
+
`FormControl` does not manage the field. It never sets `id`, `invalid`, `required`, `disabled`, or any other attribute on the children. The label is rendered only when `label` is given. To associate the label with the field, pass `htmlFor` and give the field the same value as its `id`.
|
|
12
|
+
|
|
13
|
+
## Props
|
|
14
|
+
|
|
15
|
+
The FormControl API extends the native HTML `div` attributes.
|
|
16
|
+
|
|
17
|
+
<!-- BEGIN GENERATED PROPS -->
|
|
18
|
+
_Also inherits all props from `HTMLAttributes<HTMLDivElement>`._
|
|
19
|
+
|
|
20
|
+
| Name | Type | Required | Default | Description |
|
|
21
|
+
| --- | --- | --- | --- | --- |
|
|
22
|
+
| errorMessage | `string` | No | | Message rendered below the field. Nothing is rendered when empty. |
|
|
23
|
+
| htmlFor | `string` | No | | Forwarded to the label as `htmlFor`. Give the field the same value as its `id` to associate them. |
|
|
24
|
+
| label | `string` | No | | Text of the label rendered above the field. When not given, no label is rendered. |
|
|
25
|
+
| required | `boolean` | No | `false` | Shows the required asterisk in the label. Visual only: it does not set `required` on the field. |
|
|
26
|
+
<!-- END GENERATED PROPS -->
|
|
27
|
+
|
|
28
|
+
## When to use
|
|
29
|
+
|
|
30
|
+
- Showing a label, a field, and an error message together with consistent spacing
|
|
31
|
+
- Marking a field as required in the label while the field itself is controlled by the consumer
|
|
32
|
+
|
|
33
|
+
## When NOT to use
|
|
34
|
+
|
|
35
|
+
- **Checkbox or radio captions** — use the `label` prop of the checkbox or radio component.
|
|
36
|
+
- **Validation or `invalid` handling** — `FormControl` only displays the message you give it; set `invalid` on the field yourself.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Form-control tokens
|
|
2
|
+
|
|
3
|
+
Generated from `src/components/form-control/form-control.css`.
|
|
4
|
+
|
|
5
|
+
## Base tokens
|
|
6
|
+
|
|
7
|
+
| Token | Declared value | Resolution |
|
|
8
|
+
| --- | --- | --- |
|
|
9
|
+
| `--c-form-control-error-content` | `var(--c-color-red-70)` | `var(--c-color-red-70) → hsl(0 100% 70%)` |
|
|
10
|
+
| `--c-form-control-gap` | `10px` | `10px` |
|
|
11
|
+
| `--c-form-control-inset` | `10px` | `10px` |
|
|
@@ -1 +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)}
|
|
1
|
+
.c-label{--c-label-content: var(--c-color-gray-15);--c-label-content-disabled: var(--c-color-gray-50);--c-label-asterisk: var(--c-color-red-70);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)}.c-label.is-required:after{margin-left:5px;content:"*";color:var(--c-label-asterisk)}
|
|
@@ -1 +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,...
|
|
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,required:r,className:l,children:e,...t})=>{const a=buildLabelClasses({disabled:s,required:r,className:l});return(0,_jsxRuntime.jsx)("label",{className:a,...t,children:e})};function buildLabelClasses({disabled:s,required:r,className:l}){const e=["c-label"];return s&&e.push("is-disabled"),r&&e.push("is-required"),[...e,l].filter(Boolean).join(" ")}var _default=exports.default=Label;
|
|
@@ -6,7 +6,7 @@ purpose: Name a form control with consistent label typography, on its own or nex
|
|
|
6
6
|
|
|
7
7
|
# Label
|
|
8
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
|
|
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 two visual props: `disabled`, which renders the text in the disabled color, and `required`, which shows a red asterisk after the text. The asterisk is drawn with CSS only, so it is not part of the label text.
|
|
10
10
|
|
|
11
11
|
## Props
|
|
12
12
|
|
|
@@ -18,14 +18,17 @@ _Also inherits all props from `LabelHTMLAttributes<HTMLLabelElement>`._
|
|
|
18
18
|
| Name | Type | Required | Default | Description |
|
|
19
19
|
| --- | --- | --- | --- | --- |
|
|
20
20
|
| disabled | `boolean` | No | `false` | Renders the text in the disabled color. Visual only: it does not disable any control. |
|
|
21
|
+
| required | `boolean` | No | `false` | Shows a red asterisk after the text. Visual only: the asterisk is drawn with CSS and it does not make any control required. |
|
|
21
22
|
<!-- END GENERATED PROPS -->
|
|
22
23
|
|
|
23
24
|
## When to use
|
|
24
25
|
|
|
25
26
|
- Naming a form control by pairing `htmlFor` with the control `id`
|
|
27
|
+
- Signaling that the named control is required with the `required` prop
|
|
26
28
|
- Showing a label that follows the library typography, with a disabled look next to a disabled control
|
|
27
29
|
|
|
28
30
|
## When NOT to use
|
|
29
31
|
|
|
30
32
|
- **Checkbox or radio captions** — use the `label` prop of the checkbox or radio component, which renders and associates a label for you.
|
|
31
33
|
- **Disabling a control** — the `disabled` prop is visual only; disable the control itself.
|
|
34
|
+
- **Making a control required** — the `required` prop is visual only; set `required` on the control itself.
|
|
@@ -6,5 +6,6 @@ Generated from `src/components/label/label.css`.
|
|
|
6
6
|
|
|
7
7
|
| Token | Declared value | Resolution |
|
|
8
8
|
| --- | --- | --- |
|
|
9
|
+
| `--c-label-asterisk` | `var(--c-color-red-70)` | `var(--c-color-red-70) → hsl(0 100% 70%)` |
|
|
9
10
|
| `--c-label-content` | `var(--c-color-gray-15)` | `var(--c-color-gray-15) → hsl(0 0% 15%)` |
|
|
10
11
|
| `--c-label-content-disabled` | `var(--c-color-gray-50)` | `var(--c-color-gray-50) → hsl(0 0% 50%)` |
|
|
@@ -6,6 +6,7 @@ Generated from component frontmatter. Human usage sections live in each componen
|
|
|
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
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
|
+
| FormControl | A wrapper that places a label above a form field and an optional error message below it. | Compose a label, a field, and an error message with consistent spacing, so consumers do not do it by hand. | [`../components/form-control/form-control.md`](../components/form-control/form-control.md) |
|
|
9
10
|
| 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
11
|
| 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
12
|
| 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) |
|
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}}),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}}
|
|
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,"FormControl",{enumerable:!0,get:function(){return _formControl.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")),_formControl=_interopRequireDefault(require("./components/form-control/form-control.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/docs/components.md
CHANGED
|
@@ -6,6 +6,7 @@ Generated from component frontmatter. Human usage sections live in each componen
|
|
|
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
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
|
+
| FormControl | A wrapper that places a label above a form field and an optional error message below it. | Compose a label, a field, and an error message with consistent spacing, so consumers do not do it by hand. | [`../components/form-control/form-control.md`](../components/form-control/form-control.md) |
|
|
9
10
|
| 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
11
|
| 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
12
|
| 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) |
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.c-form-control{--c-form-control-gap: 10px;--c-form-control-inset: 10px;--c-form-control-error-content: var(--c-color-red-70);display:flex;flex-direction:column;gap:var(--c-form-control-gap)}.c-form-control>label{align-self:flex-start;margin-left:var(--c-form-control-inset)}.c-form-control-error-message{margin-left:var(--c-form-control-inset);color:var(--c-form-control-error-content);font-family:var(--c-font-family-primary);font-size:var(--c-font-size-xs);font-weight:400}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import a from"../label/label.js";import"./form-control.css";import{jsx as s,jsxs as i}from"react/jsx-runtime";const d=({label:o,htmlFor:e,required:t,errorMessage:r,className:c,children:l,...m})=>{const n=["c-form-control",c].filter(Boolean).join(" ");return i("div",{className:n,...m,children:[o&&s(a,{htmlFor:e,required:t,children:o}),l,r&&s("span",{className:"c-form-control-error-message",children:r})]})};export default d;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: FormControl
|
|
3
|
+
description: A wrapper that places a label above a form field and an optional error message below it.
|
|
4
|
+
purpose: Compose a label, a field, and an error message with consistent spacing, so consumers do not do it by hand.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# FormControl
|
|
8
|
+
|
|
9
|
+
Wraps a form field (`Input`, `Select`, `Textarea`, etc.), passed as `children`, with a `Label` above it and an optional error message below it. Extra native `div` attributes and `className` are applied to the root element.
|
|
10
|
+
|
|
11
|
+
`FormControl` does not manage the field. It never sets `id`, `invalid`, `required`, `disabled`, or any other attribute on the children. The label is rendered only when `label` is given. To associate the label with the field, pass `htmlFor` and give the field the same value as its `id`.
|
|
12
|
+
|
|
13
|
+
## Props
|
|
14
|
+
|
|
15
|
+
The FormControl API extends the native HTML `div` attributes.
|
|
16
|
+
|
|
17
|
+
<!-- BEGIN GENERATED PROPS -->
|
|
18
|
+
_Also inherits all props from `HTMLAttributes<HTMLDivElement>`._
|
|
19
|
+
|
|
20
|
+
| Name | Type | Required | Default | Description |
|
|
21
|
+
| --- | --- | --- | --- | --- |
|
|
22
|
+
| errorMessage | `string` | No | | Message rendered below the field. Nothing is rendered when empty. |
|
|
23
|
+
| htmlFor | `string` | No | | Forwarded to the label as `htmlFor`. Give the field the same value as its `id` to associate them. |
|
|
24
|
+
| label | `string` | No | | Text of the label rendered above the field. When not given, no label is rendered. |
|
|
25
|
+
| required | `boolean` | No | `false` | Shows the required asterisk in the label. Visual only: it does not set `required` on the field. |
|
|
26
|
+
<!-- END GENERATED PROPS -->
|
|
27
|
+
|
|
28
|
+
## When to use
|
|
29
|
+
|
|
30
|
+
- Showing a label, a field, and an error message together with consistent spacing
|
|
31
|
+
- Marking a field as required in the label while the field itself is controlled by the consumer
|
|
32
|
+
|
|
33
|
+
## When NOT to use
|
|
34
|
+
|
|
35
|
+
- **Checkbox or radio captions** — use the `label` prop of the checkbox or radio component.
|
|
36
|
+
- **Validation or `invalid` handling** — `FormControl` only displays the message you give it; set `invalid` on the field yourself.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Form-control tokens
|
|
2
|
+
|
|
3
|
+
Generated from `src/components/form-control/form-control.css`.
|
|
4
|
+
|
|
5
|
+
## Base tokens
|
|
6
|
+
|
|
7
|
+
| Token | Declared value | Resolution |
|
|
8
|
+
| --- | --- | --- |
|
|
9
|
+
| `--c-form-control-error-content` | `var(--c-color-red-70)` | `var(--c-color-red-70) → hsl(0 100% 70%)` |
|
|
10
|
+
| `--c-form-control-gap` | `10px` | `10px` |
|
|
11
|
+
| `--c-form-control-inset` | `10px` | `10px` |
|
|
@@ -1 +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)}
|
|
1
|
+
.c-label{--c-label-content: var(--c-color-gray-15);--c-label-content-disabled: var(--c-color-gray-50);--c-label-asterisk: var(--c-color-red-70);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)}.c-label.is-required:after{margin-left:5px;content:"*";color:var(--c-label-asterisk)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./label.css";import{jsx as
|
|
1
|
+
import"./label.css";import{jsx as o}from"react/jsx-runtime";const t=({disabled:e,required:l,className:a,children:s,...i})=>{const r=n({disabled:e,required:l,className:a});return o("label",{className:r,...i,children:s})};function n({disabled:e,required:l,className:a}){const s=["c-label"];return e&&s.push("is-disabled"),l&&s.push("is-required"),[...s,a].filter(Boolean).join(" ")}export default t;
|
|
@@ -6,7 +6,7 @@ purpose: Name a form control with consistent label typography, on its own or nex
|
|
|
6
6
|
|
|
7
7
|
# Label
|
|
8
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
|
|
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 two visual props: `disabled`, which renders the text in the disabled color, and `required`, which shows a red asterisk after the text. The asterisk is drawn with CSS only, so it is not part of the label text.
|
|
10
10
|
|
|
11
11
|
## Props
|
|
12
12
|
|
|
@@ -18,14 +18,17 @@ _Also inherits all props from `LabelHTMLAttributes<HTMLLabelElement>`._
|
|
|
18
18
|
| Name | Type | Required | Default | Description |
|
|
19
19
|
| --- | --- | --- | --- | --- |
|
|
20
20
|
| disabled | `boolean` | No | `false` | Renders the text in the disabled color. Visual only: it does not disable any control. |
|
|
21
|
+
| required | `boolean` | No | `false` | Shows a red asterisk after the text. Visual only: the asterisk is drawn with CSS and it does not make any control required. |
|
|
21
22
|
<!-- END GENERATED PROPS -->
|
|
22
23
|
|
|
23
24
|
## When to use
|
|
24
25
|
|
|
25
26
|
- Naming a form control by pairing `htmlFor` with the control `id`
|
|
27
|
+
- Signaling that the named control is required with the `required` prop
|
|
26
28
|
- Showing a label that follows the library typography, with a disabled look next to a disabled control
|
|
27
29
|
|
|
28
30
|
## When NOT to use
|
|
29
31
|
|
|
30
32
|
- **Checkbox or radio captions** — use the `label` prop of the checkbox or radio component, which renders and associates a label for you.
|
|
31
33
|
- **Disabling a control** — the `disabled` prop is visual only; disable the control itself.
|
|
34
|
+
- **Making a control required** — the `required` prop is visual only; set `required` on the control itself.
|
|
@@ -6,5 +6,6 @@ Generated from `src/components/label/label.css`.
|
|
|
6
6
|
|
|
7
7
|
| Token | Declared value | Resolution |
|
|
8
8
|
| --- | --- | --- |
|
|
9
|
+
| `--c-label-asterisk` | `var(--c-color-red-70)` | `var(--c-color-red-70) → hsl(0 100% 70%)` |
|
|
9
10
|
| `--c-label-content` | `var(--c-color-gray-15)` | `var(--c-color-gray-15) → hsl(0 0% 15%)` |
|
|
10
11
|
| `--c-label-content-disabled` | `var(--c-color-gray-50)` | `var(--c-color-gray-50) → hsl(0 0% 50%)` |
|
|
@@ -6,6 +6,7 @@ Generated from component frontmatter. Human usage sections live in each componen
|
|
|
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
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
|
+
| FormControl | A wrapper that places a label above a form field and an optional error message below it. | Compose a label, a field, and an error message with consistent spacing, so consumers do not do it by hand. | [`../components/form-control/form-control.md`](../components/form-control/form-control.md) |
|
|
9
10
|
| 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
11
|
| 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
12
|
| 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) |
|
package/dist/es6/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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";
|
|
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 FormControl}from"./components/form-control/form-control.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/index.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ export type { ButtonProps } from './components/button/button.d.ts';
|
|
|
2
2
|
export { default as Button } from './components/button/button.d.ts';
|
|
3
3
|
export type { CheckboxProps } from './components/checkbox/checkbox.d.ts';
|
|
4
4
|
export { default as Checkbox } from './components/checkbox/checkbox.d.ts';
|
|
5
|
+
export type { FormControlProps } from './components/form-control/form-control.d.ts';
|
|
6
|
+
export { default as FormControl } from './components/form-control/form-control.d.ts';
|
|
5
7
|
export type { InputProps } from './components/input/input.d.ts';
|
|
6
8
|
export { default as Input } from './components/input/input.d.ts';
|
|
7
9
|
export type { LabelProps } from './components/label/label.d.ts';
|