@newtone-dev/ui-react-web 0.26.3 → 0.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/checkbox-group/checkbox-group.css +90 -0
  2. package/dist/checkbox-group/checkbox-group.d.ts +45 -0
  3. package/dist/checkbox-group/checkbox-group.d.ts.map +1 -0
  4. package/dist/checkbox-group/checkbox-group.js +32 -0
  5. package/dist/checkbox-group/checkbox-group.js.map +1 -0
  6. package/dist/checkbox-group/index.d.ts +4 -0
  7. package/dist/checkbox-group/index.d.ts.map +1 -0
  8. package/dist/checkbox-group/index.js +3 -0
  9. package/dist/checkbox-group/index.js.map +1 -0
  10. package/dist/file-field/file-field.css +87 -0
  11. package/dist/file-field/file-field.d.ts +41 -0
  12. package/dist/file-field/file-field.d.ts.map +1 -0
  13. package/dist/file-field/file-field.js +36 -0
  14. package/dist/file-field/file-field.js.map +1 -0
  15. package/dist/file-field/index.d.ts +4 -0
  16. package/dist/file-field/index.d.ts.map +1 -0
  17. package/dist/file-field/index.js +3 -0
  18. package/dist/file-field/index.js.map +1 -0
  19. package/dist/index.d.ts +6 -0
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.js +3 -0
  22. package/dist/index.js.map +1 -1
  23. package/dist/page/band.d.ts +2 -2
  24. package/dist/page/band.d.ts.map +1 -1
  25. package/dist/page/band.js +8 -11
  26. package/dist/page/band.js.map +1 -1
  27. package/dist/text-field/index.d.ts +4 -0
  28. package/dist/text-field/index.d.ts.map +1 -0
  29. package/dist/text-field/index.js +3 -0
  30. package/dist/text-field/index.js.map +1 -0
  31. package/dist/text-field/text-field.css +98 -0
  32. package/dist/text-field/text-field.d.ts +61 -0
  33. package/dist/text-field/text-field.d.ts.map +1 -0
  34. package/dist/text-field/text-field.js +57 -0
  35. package/dist/text-field/text-field.js.map +1 -0
  36. package/package.json +16 -1
@@ -0,0 +1,90 @@
1
+ /* CheckboxGroup -- a legend and a column of boxes. See the repo blueprint, section 3, and
2
+ * production/newtone/ui_react-web/_blueprint/components/checkbox-group.md.
3
+ *
4
+ * ---- the fieldset's own chrome is taken off ----------------------------
5
+ *
6
+ * A user agent draws a `<fieldset>` with a groove border, inline padding and a legend set into the
7
+ * border. **None of it is a Newtone shape**, so the border, the padding and the margin go, and the
8
+ * legend becomes a line of type above the boxes. `min-inline-size: 0` undoes the fieldset's
9
+ * `min-content` floor, which would otherwise let a long label push the column wider than its
10
+ * container.
11
+ *
12
+ * **And it is not a flex column, because a legend is not a flex item.** A browser renders a fieldset's
13
+ * `<legend>` outside the box its children lay out in, so a `gap` on the fieldset would space the
14
+ * rows and never the legend. The rows stack as blocks and the legend carries the group's `gap` below
15
+ * itself.
16
+ *
17
+ * ---- each row is 40, the second rung -----------------------------------
18
+ *
19
+ * The row is the hit area -- the `<label>` wraps its box -- so it is the row that is the target on
20
+ * section 5's ladder: `space.2` above and below the 16/24 line is **40**. The box itself is 20, the
21
+ * size the 24px line holds without moving it -- **a literal `20px` in `checkbox-group.json` and not
22
+ * `{space.5}`**, though they are equal, because what it measures is the line and not the page's
23
+ * spacing, and a length that happens to equal a token is a coincidence (section 5). **The row is as wide as its words**, `fit-content`,
24
+ * so the hit area and the ring end where the label does rather than at the far edge of the column.
25
+ *
26
+ * ---- the box is native, and only its colour is ours ---------------------
27
+ *
28
+ * `accent-color` repaints the browser's own checkbox, tick and all, so nothing here redraws one and
29
+ * the box keeps every state the platform gives it -- checked, indeterminate, disabled, forced
30
+ * colours. The ring is drawn on the row and not on the box, `segmented-control.css`'s arrangement for
31
+ * the same reason: the row is what a person aims at. governance/code/focus-is-not-optional.md. */
32
+
33
+ .newtone-checkbox-group {
34
+ min-inline-size: 0;
35
+ margin: 0;
36
+ padding: 0;
37
+ border: 0;
38
+ }
39
+
40
+ .newtone-checkbox-group-legend {
41
+ padding: 0;
42
+ margin-block-end: var(--newtone-checkbox-group-gap);
43
+ font-family: var(--newtone-checkbox-group-legend-family);
44
+ font-weight: var(--newtone-checkbox-group-legend-weight);
45
+ font-size: var(--newtone-checkbox-group-legend-size);
46
+ line-height: var(--newtone-checkbox-group-legend-line-height);
47
+ color: var(--newtone-checkbox-group-legend-text);
48
+ }
49
+
50
+ .newtone-checkbox-group-option {
51
+ display: flex;
52
+ inline-size: fit-content;
53
+ align-items: center;
54
+ gap: var(--newtone-checkbox-group-option-gap);
55
+ padding-block: var(--newtone-checkbox-group-option-padding-y);
56
+ font-family: var(--newtone-checkbox-group-option-family);
57
+ font-weight: var(--newtone-checkbox-group-option-weight);
58
+ font-size: var(--newtone-checkbox-group-option-size);
59
+ line-height: var(--newtone-checkbox-group-option-line-height);
60
+ color: var(--newtone-checkbox-group-option-text);
61
+ cursor: pointer;
62
+ }
63
+
64
+ .newtone-checkbox-group-option:has(.newtone-checkbox-group-box:focus-visible) {
65
+ outline: 2px solid var(--newtone-checkbox-group-focus-ring);
66
+ outline-offset: 0;
67
+ }
68
+
69
+ /* A disabled box greys its row, or only the native box would change and the label would still
70
+ * read as live. Keyed on the box rather than the fieldset, so a disabled group and a single
71
+ * disabled box are one case. */
72
+ .newtone-checkbox-group-option:has(.newtone-checkbox-group-box:disabled) {
73
+ color: var(--newtone-checkbox-group-option-disabled-text);
74
+ cursor: default;
75
+ }
76
+
77
+ /* `margin: 0` because a user agent gives a checkbox one and it would sit inside the gap. The
78
+ * outline is the row's, above. */
79
+ .newtone-checkbox-group-box {
80
+ flex: none;
81
+ inline-size: var(--newtone-checkbox-group-box-size);
82
+ block-size: var(--newtone-checkbox-group-box-size);
83
+ margin: 0;
84
+ accent-color: var(--newtone-checkbox-group-box-fill);
85
+ cursor: inherit;
86
+ }
87
+
88
+ .newtone-checkbox-group-box:focus-visible {
89
+ outline: none;
90
+ }
@@ -0,0 +1,45 @@
1
+ import type { FieldsetHTMLAttributes } from 'react';
2
+ export interface CheckboxGroupOption {
3
+ /** What the box carries when it is ticked -- one entry in `FormData.getAll(name)`. */
4
+ value: string;
5
+ /** The word beside the box. Content. */
6
+ label: string;
7
+ }
8
+ export interface CheckboxGroupProps extends Omit<FieldsetHTMLAttributes<HTMLFieldSetElement>, 'defaultValue' | 'onChange'> {
9
+ /** What the group is asking. The `<legend>`, which is the group's accessible name. */
10
+ legend: string;
11
+ /** The one name every box shares, and what the form reads the ticked values back under. */
12
+ name: string;
13
+ /** The choices, in order. Where they come from is the caller's business. */
14
+ options: readonly CheckboxGroupOption[];
15
+ /** The values ticked when the form opens. */
16
+ defaultValue?: readonly string[];
17
+ }
18
+ /**
19
+ * A set of choices where any number can be picked: a `<fieldset>`, its `<legend>`, and one native
20
+ * checkbox per option, all on one `name`.
21
+ *
22
+ * ---- the many-to-many is the form's own --------------------------------
23
+ *
24
+ * **Checkboxes that share a name are already a list to a form**: `new FormData(form).getAll(name)`
25
+ * returns the ticked values in the order they appear, and the browser gives the keyboard behaviour,
26
+ * the announced group and a form that works with JavaScript off. **A `string[]` held here would be a
27
+ * second copy of what the boxes already say**, so there is no `value` and no handler, and
28
+ * `defaultValue` is only which boxes start ticked. `segmented-control/` is the one-of-many beside
29
+ * this any-of-many, and it refused state for the same reason.
30
+ *
31
+ * ---- the spread lands on the `<fieldset>` --------------------------------
32
+ *
33
+ * The group is the element that does this component's job, so `...rest` lands there -- and
34
+ * `disabled` on a fieldset disables every box in it, which is the browser's rule and not a prop this
35
+ * file adds.
36
+ *
37
+ * ---- the options are handed in -------------------------------------------
38
+ *
39
+ * `{ value, label }` pairs and nothing about where they came from. **The first caller ticks the
40
+ * members of a team**, and that they are records in another collection is that admin's knowledge
41
+ * and not this file's -- governance/code/a-consumer-assembles-its-own-arrangements-and-the-library-ships-knobs.md.
42
+ * `key` is the value, so two options with one value are two boxes a form could not tell apart either.
43
+ */
44
+ export declare function CheckboxGroup({ legend, name, options, defaultValue, className, ...rest }: CheckboxGroupProps): import("react").JSX.Element;
45
+ //# sourceMappingURL=checkbox-group.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkbox-group.d.ts","sourceRoot":"","sources":["../../src/checkbox-group/checkbox-group.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,OAAO,CAAA;AAEnD,MAAM,WAAW,mBAAmB;IAChC,sFAAsF;IACtF,KAAK,EAAE,MAAM,CAAA;IACb,wCAAwC;IACxC,KAAK,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAC5C,sBAAsB,CAAC,mBAAmB,CAAC,EAC3C,cAAc,GAAG,UAAU,CAC9B;IACG,sFAAsF;IACtF,MAAM,EAAE,MAAM,CAAA;IACd,2FAA2F;IAC3F,IAAI,EAAE,MAAM,CAAA;IACZ,4EAA4E;IAC5E,OAAO,EAAE,SAAS,mBAAmB,EAAE,CAAA;IACvC,6CAA6C;IAC7C,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CACnC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,aAAa,CAAC,EAC1B,MAAM,EACN,IAAI,EACJ,OAAO,EACP,YAAY,EACZ,SAAS,EACT,GAAG,IAAI,EACV,EAAE,kBAAkB,+BAwBpB"}
@@ -0,0 +1,32 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * A set of choices where any number can be picked: a `<fieldset>`, its `<legend>`, and one native
4
+ * checkbox per option, all on one `name`.
5
+ *
6
+ * ---- the many-to-many is the form's own --------------------------------
7
+ *
8
+ * **Checkboxes that share a name are already a list to a form**: `new FormData(form).getAll(name)`
9
+ * returns the ticked values in the order they appear, and the browser gives the keyboard behaviour,
10
+ * the announced group and a form that works with JavaScript off. **A `string[]` held here would be a
11
+ * second copy of what the boxes already say**, so there is no `value` and no handler, and
12
+ * `defaultValue` is only which boxes start ticked. `segmented-control/` is the one-of-many beside
13
+ * this any-of-many, and it refused state for the same reason.
14
+ *
15
+ * ---- the spread lands on the `<fieldset>` --------------------------------
16
+ *
17
+ * The group is the element that does this component's job, so `...rest` lands there -- and
18
+ * `disabled` on a fieldset disables every box in it, which is the browser's rule and not a prop this
19
+ * file adds.
20
+ *
21
+ * ---- the options are handed in -------------------------------------------
22
+ *
23
+ * `{ value, label }` pairs and nothing about where they came from. **The first caller ticks the
24
+ * members of a team**, and that they are records in another collection is that admin's knowledge
25
+ * and not this file's -- governance/code/a-consumer-assembles-its-own-arrangements-and-the-library-ships-knobs.md.
26
+ * `key` is the value, so two options with one value are two boxes a form could not tell apart either.
27
+ */
28
+ export function CheckboxGroup({ legend, name, options, defaultValue, className, ...rest }) {
29
+ const ticked = new Set(defaultValue ?? []);
30
+ return (_jsxs("fieldset", { className: ['newtone-checkbox-group', className].filter(Boolean).join(' '), ...rest, children: [_jsx("legend", { className: "newtone-checkbox-group-legend", children: legend }), options.map((option) => (_jsxs("label", { className: "newtone-checkbox-group-option", children: [_jsx("input", { className: "newtone-checkbox-group-box", type: "checkbox", name: name, value: option.value, defaultChecked: ticked.has(option.value) }), option.label] }, option.value)))] }));
31
+ }
32
+ //# sourceMappingURL=checkbox-group.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkbox-group.js","sourceRoot":"","sources":["../../src/checkbox-group/checkbox-group.tsx"],"names":[],"mappings":";AAuBA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,UAAU,aAAa,CAAC,EAC1B,MAAM,EACN,IAAI,EACJ,OAAO,EACP,YAAY,EACZ,SAAS,EACT,GAAG,IAAI,EACU;IACjB,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,YAAY,IAAI,EAAE,CAAC,CAAA;IAC1C,OAAO,CACH,oBACI,SAAS,EAAE,CAAC,wBAAwB,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,KACtE,IAAI,aAER,iBAAQ,SAAS,EAAC,+BAA+B,YAAE,MAAM,GAAU,EAClE,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAErB,iBAA0B,SAAS,EAAC,+BAA+B,aAE/D,gBACI,SAAS,EAAC,4BAA4B,EACtC,IAAI,EAAC,UAAU,EACf,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,MAAM,CAAC,KAAK,EACnB,cAAc,EAAE,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,GAC1C,EACD,MAAM,CAAC,KAAK,KATL,MAAM,CAAC,KAAK,CAUhB,CACX,CAAC,IACK,CACd,CAAA;AACL,CAAC"}
@@ -0,0 +1,4 @@
1
+ /** The door. See the repo blueprint, section 3, and components/checkbox-group.md. */
2
+ export { CheckboxGroup } from './checkbox-group.js';
3
+ export type { CheckboxGroupProps, CheckboxGroupOption } from './checkbox-group.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/checkbox-group/index.ts"],"names":[],"mappings":"AAAA,qFAAqF;AACrF,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,YAAY,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA"}
@@ -0,0 +1,3 @@
1
+ /** The door. See the repo blueprint, section 3, and components/checkbox-group.md. */
2
+ export { CheckboxGroup } from './checkbox-group.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/checkbox-group/index.ts"],"names":[],"mappings":"AAAA,qFAAqF;AACrF,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA"}
@@ -0,0 +1,87 @@
1
+ /* FileField -- a label, an optional hint, the browser's file input, and the caller's preview. See
2
+ * the repo blueprint, section 3, and production/newtone/ui_react-web/_blueprint/components/file-field.md.
3
+ *
4
+ * ---- the label and hint are the text field's type, from this group ---------
5
+ *
6
+ * The same 14/20 pair at the same two weights as `text-field.css`, **named again in `file-field.json`
7
+ * rather than read from the text field's group**, which is section 5's *reads only its own group*
8
+ * row: a form whose two kinds of label agree because both name one step, and a retune of one that
9
+ * moves only one.
10
+ *
11
+ * ---- the button is the browser's, and it is 40 ------------------------
12
+ *
13
+ * `::file-selector-button` is the native control a person presses, so it is the target on section
14
+ * 5's ladder: `space.2` above and below the 16/24 line with the border subtracted, `action.css`'s
15
+ * arithmetic, comes to **40**. The words beside it -- *no file chosen*, or the name of the pick --
16
+ * are the browser's too, set in the same step so the row has one line height.
17
+ *
18
+ * **It and its `:disabled` twin are the selectors here above a single class**, a class and a
19
+ * pseudo-element, and they land
20
+ * on an inner part a consumer's `className` cannot reach in any case: the class goes on the
21
+ * `<input>`, and no rule written on the input styles the button inside it. Section 5's
22
+ * *one class of specificity* row is about the element a className reaches.
23
+ *
24
+ * ---- the corner is the text field's pill ----------------------------
25
+ *
26
+ * 999px, stated in this group: the button sits in a column of text fields and agrees with their
27
+ * corner by naming the same value. */
28
+
29
+ .newtone-file-field {
30
+ display: flex;
31
+ flex-direction: column;
32
+ gap: var(--newtone-file-field-gap);
33
+ }
34
+
35
+ .newtone-file-field-label {
36
+ font-family: var(--newtone-file-field-label-family);
37
+ font-weight: var(--newtone-file-field-label-weight);
38
+ font-size: var(--newtone-file-field-label-size);
39
+ line-height: var(--newtone-file-field-label-line-height);
40
+ color: var(--newtone-file-field-label-text);
41
+ }
42
+
43
+ .newtone-file-field-hint {
44
+ font-family: var(--newtone-file-field-hint-family);
45
+ font-weight: var(--newtone-file-field-hint-weight);
46
+ font-size: var(--newtone-file-field-hint-size);
47
+ line-height: var(--newtone-file-field-hint-line-height);
48
+ color: var(--newtone-file-field-hint-text);
49
+ }
50
+
51
+ .newtone-file-field-input {
52
+ max-inline-size: 100%;
53
+ margin: 0;
54
+ font-family: var(--newtone-file-field-button-family);
55
+ font-size: var(--newtone-file-field-button-size);
56
+ line-height: var(--newtone-file-field-button-line-height);
57
+ color: var(--newtone-file-field-input-text);
58
+ }
59
+
60
+ .newtone-file-field-input:focus-visible {
61
+ outline: 2px solid var(--newtone-file-field-focus-ring);
62
+ outline-offset: 1px;
63
+ }
64
+
65
+ .newtone-file-field-input::file-selector-button {
66
+ margin: 0;
67
+ margin-inline-end: var(--newtone-file-field-button-gap);
68
+ padding: calc(var(--newtone-file-field-button-padding-y) - 1px)
69
+ calc(var(--newtone-file-field-button-padding-x) - 1px);
70
+ border: 1px solid var(--newtone-file-field-button-border);
71
+ border-radius: var(--newtone-file-field-radius);
72
+ background: var(--newtone-file-field-button-fill);
73
+ color: var(--newtone-file-field-button-text);
74
+ font: inherit;
75
+ font-weight: var(--newtone-file-field-button-weight);
76
+ cursor: pointer;
77
+ }
78
+
79
+ /* The button states its own fill, ink and border, so a disabled input would otherwise press-look
80
+ * exactly like an enabled one. The second selector above one class here, and the same argument as
81
+ * the first: it lands on the browser's button, which no class on the input can reach. */
82
+ .newtone-file-field-input:disabled::file-selector-button {
83
+ background: var(--newtone-file-field-button-disabled-fill);
84
+ color: var(--newtone-file-field-button-disabled-text);
85
+ border-color: var(--newtone-file-field-button-disabled-border);
86
+ cursor: not-allowed;
87
+ }
@@ -0,0 +1,41 @@
1
+ import type { InputHTMLAttributes, ReactNode } from 'react';
2
+ export interface FileFieldProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'name' | 'value' | 'defaultValue' | 'children'> {
3
+ /** What the file is for. A real `<label>`, tied to the input by `id`. Content. */
4
+ label: string;
5
+ /** The form's key for the picked files. Required, and it names the `id` when none is passed. */
6
+ name: string;
7
+ /** One line under the label, tied to the input by `aria-describedby`. */
8
+ hint?: string;
9
+ /** The preview, under the input. The caller draws it, because only the caller knows the file. */
10
+ children?: ReactNode;
11
+ }
12
+ /**
13
+ * A labeled place to pick a file: a `label`, an optional `hint`, a native `<input type="file">`, and
14
+ * a slot under it for whatever the caller wants to show of the pick.
15
+ *
16
+ * ---- it uploads nothing ------------------------------------------------
17
+ *
18
+ * **The library refuses data fetching**, section 1, and a file field that sent its file somewhere
19
+ * would be the first component here that knew an address. So the input is a form part like any
20
+ * other: the picked files are in `FormData` under `name`, and what happens to them on submit is the
21
+ * consumer's. `accept` and `multiple` pass through untouched, so `accept="image/*"` is the browser's
22
+ * own filter and the system's own picker.
23
+ *
24
+ * ---- the preview is a slot, for the same reason --------------------------
25
+ *
26
+ * What a picked file should look like before it is saved depends on what it is for -- a cover is one
27
+ * image at the ratio its site crops to, a gallery is a row of thumbnails with a caption under each --
28
+ * and **this component knows neither**. A caller that wants the files before submit listens to
29
+ * `onChange`, which the spread delivers: `...rest` lands on the `<input>`, `className` with it, and
30
+ * not on the wrapper. components/file-field.md, and
31
+ * governance/code/a-consumer-assembles-its-own-arrangements-and-the-library-ships-knobs.md.
32
+ *
33
+ * ---- the `id` comes from `name` ------------------------------------------
34
+ *
35
+ * `text-field.tsx`'s arrangement and its reason: no hook, so a missing `id` is spelled
36
+ * `newtone-file-field-<name>`. **A name used by more than one file field on a page needs an `id` from
37
+ * the caller**, or every label and hint points at the first input -- repeated names are legal to a
38
+ * form, which reads them with `FormData.getAll`, so the collision is this file's to state.
39
+ */
40
+ export declare function FileField({ label, name, hint, children, className, ...rest }: FileFieldProps): import("react").JSX.Element;
41
+ //# sourceMappingURL=file-field.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-field.d.ts","sourceRoot":"","sources":["../../src/file-field/file-field.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAE3D,MAAM,WAAW,cAAe,SAAQ,IAAI,CACxC,mBAAmB,CAAC,gBAAgB,CAAC,EACrC,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,cAAc,GAAG,UAAU,CAC1D;IACG,kFAAkF;IAClF,KAAK,EAAE,MAAM,CAAA;IACb,gGAAgG;IAChG,IAAI,EAAE,MAAM,CAAA;IACZ,yEAAyE;IACzE,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,iGAAiG;IACjG,QAAQ,CAAC,EAAE,SAAS,CAAA;CACvB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,SAAS,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,EAAE,cAAc,+BA0B5F"}
@@ -0,0 +1,36 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * A labeled place to pick a file: a `label`, an optional `hint`, a native `<input type="file">`, and
4
+ * a slot under it for whatever the caller wants to show of the pick.
5
+ *
6
+ * ---- it uploads nothing ------------------------------------------------
7
+ *
8
+ * **The library refuses data fetching**, section 1, and a file field that sent its file somewhere
9
+ * would be the first component here that knew an address. So the input is a form part like any
10
+ * other: the picked files are in `FormData` under `name`, and what happens to them on submit is the
11
+ * consumer's. `accept` and `multiple` pass through untouched, so `accept="image/*"` is the browser's
12
+ * own filter and the system's own picker.
13
+ *
14
+ * ---- the preview is a slot, for the same reason --------------------------
15
+ *
16
+ * What a picked file should look like before it is saved depends on what it is for -- a cover is one
17
+ * image at the ratio its site crops to, a gallery is a row of thumbnails with a caption under each --
18
+ * and **this component knows neither**. A caller that wants the files before submit listens to
19
+ * `onChange`, which the spread delivers: `...rest` lands on the `<input>`, `className` with it, and
20
+ * not on the wrapper. components/file-field.md, and
21
+ * governance/code/a-consumer-assembles-its-own-arrangements-and-the-library-ships-knobs.md.
22
+ *
23
+ * ---- the `id` comes from `name` ------------------------------------------
24
+ *
25
+ * `text-field.tsx`'s arrangement and its reason: no hook, so a missing `id` is spelled
26
+ * `newtone-file-field-<name>`. **A name used by more than one file field on a page needs an `id` from
27
+ * the caller**, or every label and hint points at the first input -- repeated names are legal to a
28
+ * form, which reads them with `FormData.getAll`, so the collision is this file's to state.
29
+ */
30
+ export function FileField({ label, name, hint, children, className, ...rest }) {
31
+ const id = rest.id ?? `newtone-file-field-${name}`;
32
+ const hintId = hint === undefined ? undefined : `${id}-hint`;
33
+ const describedBy = [rest['aria-describedby'], hintId].filter(Boolean).join(' ') || undefined;
34
+ return (_jsxs("div", { className: "newtone-file-field", children: [_jsx("label", { className: "newtone-file-field-label", htmlFor: id, children: label }), hint === undefined ? null : (_jsx("span", { className: "newtone-file-field-hint", id: hintId, children: hint })), _jsx("input", { ...rest, className: ['newtone-file-field-input', className].filter(Boolean).join(' '), type: "file", id: id, name: name, "aria-describedby": describedBy }), children] }));
35
+ }
36
+ //# sourceMappingURL=file-field.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-field.js","sourceRoot":"","sources":["../../src/file-field/file-field.tsx"],"names":[],"mappings":";AAgBA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,UAAU,SAAS,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,IAAI,EAAkB;IACzF,MAAM,EAAE,GAAG,IAAI,CAAC,EAAE,IAAI,sBAAsB,IAAI,EAAE,CAAA;IAClD,MAAM,MAAM,GAAG,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,EAAE,OAAO,CAAA;IAC5D,MAAM,WAAW,GAAG,CAAC,IAAI,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,SAAS,CAAA;IAE7F,OAAO,CACH,eAAK,SAAS,EAAC,oBAAoB,aAC/B,gBAAO,SAAS,EAAC,0BAA0B,EAAC,OAAO,EAAE,EAAE,YAClD,KAAK,GACF,EACP,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CACzB,eAAM,SAAS,EAAC,yBAAyB,EAAC,EAAE,EAAE,MAAM,YAC/C,IAAI,GACF,CACV,EACD,mBACQ,IAAI,EACR,SAAS,EAAE,CAAC,0BAA0B,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAC5E,IAAI,EAAC,MAAM,EACX,EAAE,EAAE,EAAE,EACN,IAAI,EAAE,IAAI,sBACQ,WAAW,GAC/B,EACD,QAAQ,IACP,CACT,CAAA;AACL,CAAC"}
@@ -0,0 +1,4 @@
1
+ /** The door. See the repo blueprint, section 3, and components/file-field.md. */
2
+ export { FileField } from './file-field.js';
3
+ export type { FileFieldProps } from './file-field.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/file-field/index.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,YAAY,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA"}
@@ -0,0 +1,3 @@
1
+ /** The door. See the repo blueprint, section 3, and components/file-field.md. */
2
+ export { FileField } from './file-field.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/file-field/index.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA"}
package/dist/index.d.ts CHANGED
@@ -46,6 +46,12 @@ export { Accordion } from './accordion/index.js';
46
46
  export type { AccordionProps, AccordionItem } from './accordion/index.js';
47
47
  export { SegmentedControl } from './segmented-control/index.js';
48
48
  export type { SegmentedControlProps, SegmentedControlOption } from './segmented-control/index.js';
49
+ export { TextField } from './text-field/index.js';
50
+ export type { TextFieldProps } from './text-field/index.js';
51
+ export { CheckboxGroup } from './checkbox-group/index.js';
52
+ export type { CheckboxGroupProps, CheckboxGroupOption } from './checkbox-group/index.js';
53
+ export { FileField } from './file-field/index.js';
54
+ export type { FileFieldProps } from './file-field/index.js';
49
55
  export { VideoLightbox } from './video-lightbox/index.js';
50
56
  export type { VideoLightboxProps } from './video-lightbox/index.js';
51
57
  export { Gallery } from './gallery/index.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAC5C,YAAY,EAAE,YAAY,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAA;AAC9E,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAC5C,YAAY,EACR,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,SAAS,GACZ,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAC1C,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACnE,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AACtC,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAC7D,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AACtC,YAAY,EACR,SAAS,EACT,SAAS,EACT,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,WAAW,EACX,WAAW,GACd,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAC1C,YAAY,EACR,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EAClB,qBAAqB,GACxB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAC9C,YAAY,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AACtC,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAC1D,OAAO,EAAE,UAAU,E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AsB,CAAA;AAC3E,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAC5C,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AACnF,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAC1C,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AACrD,YAAY,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AACtC,YAAY,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAChD,OAAO,EACH,SAAS,EACT,WAAW,EACX,cAAc,EACd,aAAa,EACb,UAAU,EACV,iBAAiB,EACjB,UAAU,EACV,SAAS,EACT,KAAK,GACR,MAAM,kBAAkB,CAAA;AACzB,YAAY,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA"}
package/dist/index.js CHANGED
@@ -22,6 +22,9 @@ export { FeatureCard } from './feature-card/index.js';
22
22
  export { LogoMarquee } from './logo-marquee/index.js';
23
23
  export { Accordion } from './accordion/index.js';
24
24
  export { SegmentedControl } from './segmented-control/index.js';
25
+ export { TextField } from './text-field/index.js';
26
+ export { CheckboxGroup } from './checkbox-group/index.js';
27
+ export { FileField } from './file-field/index.js';
25
28
  export { VideoLightbox } from './video-lightbox/index.js';
26
29
  export { Gallery } from './gallery/index.js';
27
30
  export { MediaPlate } from './media-plate/index.js';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAE5C,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;A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E,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAEvD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAE/C,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAE5C,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAE1C,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAErD,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAEtC,OAAO,EACH,SAAS,EACT,WAAW,EACX,cAAc,EACd,aAAa,EACb,UAAU,EACV,iBAAiB,EACjB,UAAU,EACV,SAAS,EACT,KAAK,GACR,MAAM,kBAAkB,CAAA"}
@@ -19,9 +19,9 @@ export interface PageBandProps extends HTMLAttributes<HTMLElement> {
19
19
  theme?: Theme;
20
20
  mode?: Mode;
21
21
  elevation?: Elevation;
22
- /** Space between the band's children. 0.26.0; omitted, none. components/page.md. */
22
+ /** Space between the band's children. 0.26.0; omitted, `8` from 0.27.0. components/page.md. */
23
23
  gap?: SpaceStep;
24
- /** The band's padding above and below. 0.26.0; omitted, none. components/page.md. */
24
+ /** The band's padding above and below. 0.26.0; omitted, `12` from 0.27.0. components/page.md. */
25
25
  padding?: SpaceStep;
26
26
  /** One screenful under the bar, its content centred in it. 0.26.0; components/page.md. */
27
27
  fold?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"band.d.ts","sourceRoot":"","sources":["../../src/page/band.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAW,KAAK,SAAS,EAAE,KAAK,IAAI,EAAE,KAAK,KAAK,EAAE,MAAM,qBAAqB,CAAA;AACpF,OAAO,KAAK,EAAiB,WAAW,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAClF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAEpD,MAAM,WAAW,aAAc,SAAQ,cAAc,CAAC,WAAW,CAAC;IAC9D,mDAAmD;IACnD,EAAE,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F,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,QAAQ,CAAC,EAAE,SAAS,CAAA;CACvB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,QAAQ,CAAC,EACrB,EAAE,EAAE,EAAc,EAClB,KAAK,EACL,IAAI,EACJ,SAAS,EACT,GAAO,EACP,OAAY,EACZ,IAAI,EACJ,SAAS,EACT,QAAQ,EACR,GAAG,IAAI,EACV,EAAE,aAAa,+BAmCf"}
package/dist/page/band.js CHANGED
@@ -30,19 +30,16 @@ import { Surface } from '../surface/index.js';
30
30
  *
31
31
  * Discharges production/newtone/ui_react-web/_blueprint/components/page.md, *The band*.
32
32
  */
33
- export function PageBand({ as: As = 'section', theme, mode, elevation, gap, padding, fold, className, children, ...rest }) {
34
- // THE RHYTHM IS THE TRACK'S, FROM 0.26.0, and it is applied only when asked for: an omitted
35
- // `gap` and `padding` render what 0.25 rendered, so every band already on a page is unmoved
36
- // until 0.27.0 makes 8 / 12 the default. assembling-a-site.md §3.
37
- const flows = gap !== undefined || padding !== undefined || fold === true;
33
+ export function PageBand({ as: As = 'section', theme, mode, elevation, gap = 8, padding = 12, fold, className, children, ...rest }) {
34
+ // THE RHYTHM IS THE TRACK'S: 8 / 12 BY DEFAULT FROM 0.27.0, the house's band
35
+ // (assembling-a-site.md §3). `gap={0} padding={0}` with no `fold` is the opt-out, and it renders
36
+ // what 0.25 rendered -- a block track, not a flex column -- because a flex column stops margins
37
+ // collapsing and the two sites that opt out lay out their own. components/page.md.
38
+ const flows = gap !== 0 || padding !== 0 || fold === true;
38
39
  const track = flows
39
40
  ? {
40
- ...(gap !== undefined && {
41
- '--newtone-page-band-gap': `var(--newtone-space-${gap})`,
42
- }),
43
- ...(padding !== undefined && {
44
- '--newtone-page-band-padding': `var(--newtone-space-${padding})`,
45
- }),
41
+ '--newtone-page-band-gap': `var(--newtone-space-${gap})`,
42
+ '--newtone-page-band-padding': `var(--newtone-space-${padding})`,
46
43
  }
47
44
  : undefined;
48
45
  return (_jsx(Surface, { as: As, theme: theme, mode: mode, elevation: elevation, className: ['newtone-page-band', className].filter(Boolean).join(' '), ...rest, children: _jsx("div", { className: [
@@ -1 +1 @@
1
- {"version":3,"file":"band.js","sourceRoot":"","sources":["../../src/page/band.tsx"],"names":[],"mappings":";AAAA,0FAA0F;AAC1F,iGAAiG;AACjG,OAAO,EAAE,OAAO,EAAyC,MAAM,qBAAqB,CAAA;AA+BpF;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,UAAU,QAAQ,CAAC,EACrB,EAAE,EAAE,EAAE,GAAG,SAAS,EAClB,KAAK,EACL,IAAI,EACJ,SAAS,EACT,GAAG,EACH,OAAO,EACP,IAAI,EACJ,SAAS,EACT,QAAQ,EACR,GAAG,IAAI,EACK;IACZ,4FAA4F;IAC5F,4FAA4F;IAC5F,kEAAkE;IAClE,MAAM,KAAK,GAAG,GAAG,KAAK,SAAS,IAAI,OAAO,KAAK,SAAS,IAAI,IAAI,KAAK,IAAI,CAAA;IACzE,MAAM,KAAK,GAA8B,KAAK;QAC1C,CAAC,CAAE;YACG,GAAG,CAAC,GAAG,KAAK,SAAS,IAAI;gBACrB,yBAAyB,EAAE,uBAAuB,GAAG,GAAG;aAC3D,CAAC;YACF,GAAG,CAAC,OAAO,KAAK,SAAS,IAAI;gBACzB,6BAA6B,EAAE,uBAAuB,OAAO,GAAG;aACnE,CAAC;SACa;QACrB,CAAC,CAAC,SAAS,CAAA;IACf,OAAO,CACH,KAAC,OAAO,IACJ,EAAE,EAAE,EAAE,EACN,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,CAAC,mBAAmB,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,KACjE,IAAI,YAER,cACI,SAAS,EAAE;gBACP,oBAAoB;gBACpB,KAAK,IAAI,0BAA0B;gB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AAM,CAAC,OAAO,CAAC;iBACf,IAAI,CAAC,GAAG,CAAC,EACd,KAAK,EAAE,KAAK,YAEX,QAAQ,GACP,GACA,CACb,CAAA;AACL,CAAC"}
@@ -0,0 +1,4 @@
1
+ /** The door. See the repo blueprint, section 3, and components/text-field.md. */
2
+ export { TextField } from './text-field.js';
3
+ export type { TextFieldProps } from './text-field.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/text-field/index.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,YAAY,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA"}
@@ -0,0 +1,3 @@
1
+ /** The door. See the repo blueprint, section 3, and components/text-field.md. */
2
+ export { TextField } from './text-field.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/text-field/index.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA"}
@@ -0,0 +1,98 @@
1
+ /* TextField -- a label, an optional hint, and the box. See the repo blueprint, section 3, and
2
+ * production/newtone/ui_react-web/_blueprint/components/text-field.md.
3
+ *
4
+ * ---- every value is this component's own, and that is the whole of issue 362 ----
5
+ *
6
+ * The five fields this replaces read `--newtone-action-radius` for the corner and
7
+ * `--newtone-action-size-sm-label-size` and `-line-height` for the type, so a retune of the Action
8
+ * would have moved every form in four admins without anybody touching a form. **This sheet names
9
+ * none of `Action`'s properties.** `text-field.json` states the same 999px corner and the same 16/24
10
+ * pair, so the two agree because both name the same values, not because one reads the other.
11
+ *
12
+ * ---- the box is 48, and the patches drew 50 ------------------------------
13
+ *
14
+ * `space.3` above and below a 24px line, plus a 1px border on each side that nothing counted, came to
15
+ * 50. **The border is subtracted from the padding here**, the way `control.css` and `action.css`
16
+ * count theirs, so the OUTER box lands on the `sm` rung -- the same 48 as the `Action` beside it --
17
+ * and the type does not move. Section 5's ladder, and the one difference a consumer will measure
18
+ * after the swap. The inline axis takes the same subtraction, so `space.4` is the distance from the
19
+ * rim to the first letter rather than to the padding box.
20
+ *
21
+ * ---- the multiline corner is a placeholder ------------------------------
22
+ *
23
+ * A `<textarea>` grows with its rows and has no rung, and **a pill corner on a box several lines
24
+ * tall has never been looked at**: none of the five drew one. `multiline-radius` is `radius.md`
25
+ * until the first caller -- the project editor's description -- is looked at and decides.
26
+ *
27
+ * ---- the focus ring is the patches' own expression --------------------
28
+ *
29
+ * `2px solid`, 1px out, in the group's `focus-ring`. governance/code/focus-is-not-optional.md. */
30
+
31
+ .newtone-text-field {
32
+ display: flex;
33
+ flex-direction: column;
34
+ gap: var(--newtone-text-field-gap);
35
+ }
36
+
37
+ .newtone-text-field-label {
38
+ font-family: var(--newtone-text-field-label-family);
39
+ font-weight: var(--newtone-text-field-label-weight);
40
+ font-size: var(--newtone-text-field-label-size);
41
+ line-height: var(--newtone-text-field-label-line-height);
42
+ color: var(--newtone-text-field-label-text);
43
+ }
44
+
45
+ .newtone-text-field-hint {
46
+ font-family: var(--newtone-text-field-hint-family);
47
+ font-weight: var(--newtone-text-field-hint-weight);
48
+ font-size: var(--newtone-text-field-hint-size);
49
+ line-height: var(--newtone-text-field-hint-line-height);
50
+ color: var(--newtone-text-field-hint-text);
51
+ }
52
+
53
+ /* `margin: 0` because a user agent gives a `<textarea>` one in some engines, and it would sit
54
+ * outside the box this sheet measures.
55
+ *
56
+ * **The height is stated, two block paddings and the line -- 48 -- rather than left to the
57
+ * content**: a `type="month"` box measured 50 in Chromium on 2026-10-07, because the browser's date
58
+ * fields carry a pixel of padding of their own above and below the line. The `--multiline` rule
59
+ * below sets it back to `auto`, by source order at the same one class. */
60
+ .newtone-text-field-box {
61
+ box-sizing: border-box;
62
+ inline-size: 100%;
63
+ block-size: calc(
64
+ var(--newtone-text-field-box-padding-y) * 2 + var(--newtone-text-field-box-line-height)
65
+ );
66
+ margin: 0;
67
+ padding: calc(var(--newtone-text-field-box-padding-y) - 1px)
68
+ calc(var(--newtone-text-field-box-padding-x) - 1px);
69
+ border: 1px solid var(--newtone-text-field-box-border);
70
+ border-radius: var(--newtone-text-field-radius);
71
+ background: var(--newtone-text-field-box-fill);
72
+ color: var(--newtone-text-field-box-text);
73
+ font-family: var(--newtone-text-field-box-family);
74
+ font-weight: var(--newtone-text-field-box-weight);
75
+ font-size: var(--newtone-text-field-box-size);
76
+ line-height: var(--newtone-text-field-box-line-height);
77
+ }
78
+
79
+ /* Disabled is drawn here because the box states its own fill, ink and border above, which takes the
80
+ * user agent's grey away from a disabled `<input>` -- so without this a disabled field looks
81
+ * editable. `button.json`'s `*-disabled-*` arrangement. */
82
+ .newtone-text-field-box:disabled {
83
+ background: var(--newtone-text-field-box-disabled-fill);
84
+ color: var(--newtone-text-field-box-disabled-text);
85
+ border-color: var(--newtone-text-field-box-disabled-border);
86
+ cursor: not-allowed;
87
+ }
88
+
89
+ .newtone-text-field-box:focus-visible {
90
+ outline: 2px solid var(--newtone-text-field-focus-ring);
91
+ outline-offset: 1px;
92
+ }
93
+
94
+ .newtone-text-field-box--multiline {
95
+ block-size: auto;
96
+ border-radius: var(--newtone-text-field-multiline-radius);
97
+ resize: vertical;
98
+ }
@@ -0,0 +1,61 @@
1
+ import type { InputHTMLAttributes, TextareaHTMLAttributes } from 'react';
2
+ interface TextFieldCommon {
3
+ /** What the box is asking for. A real `<label>`, tied to the box by `id`. Content. */
4
+ label: string;
5
+ /**
6
+ * The form's key for this box, and what `FormData` reads it back under. Required, because a
7
+ * field the form cannot read is a box that types into nothing. **It also names the box's `id`
8
+ * when the caller passes none** -- see below.
9
+ */
10
+ name: string;
11
+ /** One line under the label, tied to the box by `aria-describedby`. */
12
+ hint?: string;
13
+ }
14
+ export type TextFieldProps = TextFieldCommon & ((Omit<InputHTMLAttributes<HTMLInputElement>, 'name' | 'value' | 'onChange'> & {
15
+ /** One line. `type` passes through, so `email`, `date` and `month` are the browser's. */
16
+ multiline?: false;
17
+ }) | (Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'name' | 'value' | 'onChange'> & {
18
+ /** A `<textarea>`: the box grows with its rows and has no rung. */
19
+ multiline: true;
20
+ }));
21
+ /**
22
+ * A labeled box a person types into: a `label`, an optional `hint` under it, and the `<input>`.
23
+ *
24
+ * ---- it holds no state, and a form reads it on submit ---------------------
25
+ *
26
+ * **There is no `value` and no change handler**, and the two are taken out of the type rather than
27
+ * left to arrive through the spread: `defaultValue` and `name`, and the form reads the box with
28
+ * `FormData`. A `value` with no handler is a promise this file cannot keep, which is
29
+ * `segmented-control/`'s argument for the same refusal. It is what lets a whole editing screen be a
30
+ * plain `<form>` that works before any script has decided anything about it.
31
+ *
32
+ * **The trigger for a controlled mode** is a second consumer that needs the typed value in script
33
+ * rather than on submit. components/text-field.md, *What it does not have*.
34
+ *
35
+ * ---- the spread lands on the box, not on the wrapper ----------------------
36
+ *
37
+ * `required`, `autoComplete`, `placeholder`, `min` and `pattern` are attributes of the element a
38
+ * person types into, so `...rest` -- `className` with it -- lands on the `<input>`, or on the
39
+ * `<textarea>` under `multiline`. Section 5's *every component carries the attributes of the element
40
+ * it renders* row is about the element that does the job, and the wrapper is only a column.
41
+ *
42
+ * ---- the `id` comes from `name`, because a hook is not available here -----
43
+ *
44
+ * The label is tied to the box by `id` and the hint by `aria-describedby`, so neither depends on the
45
+ * caller remembering. **`useId()` would need a client boundary this file does not otherwise want**,
46
+ * which is `accordion/`'s reason for its own `name` prop, so a missing `id` is spelled from `name`:
47
+ * `newtone-text-field-<name>`. **So a name used by more than one field on a page needs an `id` from
48
+ * the caller.** Repeated names are legal and a form reads them back with `FormData.getAll` --
49
+ * `checkbox-group/` rests on exactly that -- but without an `id` every one of those boxes gets the
50
+ * same one, and every `<label>` and hint points at the first. The gallery's per-photo `pie` caption
51
+ * is the first caller in that position. components/text-field.md.
52
+ *
53
+ * ---- what it replaces -----------------------------------------------------
54
+ *
55
+ * Five hand-drawn fields, each reaching into `Action`'s tokens for its corner and its type: issue
56
+ * 362. **This reads its own `text-field.json` group and nothing of `Action`'s**, so the field
57
+ * and the button agree because both name the same values, and a retune of one moves only one.
58
+ */
59
+ export declare function TextField({ label, name, hint, multiline, className, ...rest }: TextFieldProps): import("react").JSX.Element;
60
+ export {};
61
+ //# sourceMappingURL=text-field.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text-field.d.ts","sourceRoot":"","sources":["../../src/text-field/text-field.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,OAAO,CAAA;AAExE,UAAU,eAAe;IACrB,sFAAsF;IACtF,KAAK,EAAE,MAAM,CAAA;IACb;;;;OAIG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ,uEAAuE;IACvE,IAAI,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,MAAM,cAAc,GAAG,eAAe,GACxC,CACM,CAAC,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,UAAU,CAAC,GAAG;IAC1E,yFAAyF;IACzF,SAAS,CAAC,EAAE,KAAK,CAAA;CACpB,CAAC,GACF,CAAC,IAAI,CAAC,sBAAsB,CAAC,mBAAmB,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,UAAU,CAAC,GAAG;IAChF,mEAAmE;IACnE,SAAS,EAAE,IAAI,CAAA;CAClB,CAAC,CACP,CAAA;AAEL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAgB,SAAS,CAAC,EACtB,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,SAAiB,EACjB,SAAS,EACT,GAAG,IAAI,EACV,EAAE,cAAc,+BA8ChB"}
@@ -0,0 +1,57 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * A labeled box a person types into: a `label`, an optional `hint` under it, and the `<input>`.
4
+ *
5
+ * ---- it holds no state, and a form reads it on submit ---------------------
6
+ *
7
+ * **There is no `value` and no change handler**, and the two are taken out of the type rather than
8
+ * left to arrive through the spread: `defaultValue` and `name`, and the form reads the box with
9
+ * `FormData`. A `value` with no handler is a promise this file cannot keep, which is
10
+ * `segmented-control/`'s argument for the same refusal. It is what lets a whole editing screen be a
11
+ * plain `<form>` that works before any script has decided anything about it.
12
+ *
13
+ * **The trigger for a controlled mode** is a second consumer that needs the typed value in script
14
+ * rather than on submit. components/text-field.md, *What it does not have*.
15
+ *
16
+ * ---- the spread lands on the box, not on the wrapper ----------------------
17
+ *
18
+ * `required`, `autoComplete`, `placeholder`, `min` and `pattern` are attributes of the element a
19
+ * person types into, so `...rest` -- `className` with it -- lands on the `<input>`, or on the
20
+ * `<textarea>` under `multiline`. Section 5's *every component carries the attributes of the element
21
+ * it renders* row is about the element that does the job, and the wrapper is only a column.
22
+ *
23
+ * ---- the `id` comes from `name`, because a hook is not available here -----
24
+ *
25
+ * The label is tied to the box by `id` and the hint by `aria-describedby`, so neither depends on the
26
+ * caller remembering. **`useId()` would need a client boundary this file does not otherwise want**,
27
+ * which is `accordion/`'s reason for its own `name` prop, so a missing `id` is spelled from `name`:
28
+ * `newtone-text-field-<name>`. **So a name used by more than one field on a page needs an `id` from
29
+ * the caller.** Repeated names are legal and a form reads them back with `FormData.getAll` --
30
+ * `checkbox-group/` rests on exactly that -- but without an `id` every one of those boxes gets the
31
+ * same one, and every `<label>` and hint points at the first. The gallery's per-photo `pie` caption
32
+ * is the first caller in that position. components/text-field.md.
33
+ *
34
+ * ---- what it replaces -----------------------------------------------------
35
+ *
36
+ * Five hand-drawn fields, each reaching into `Action`'s tokens for its corner and its type: issue
37
+ * 362. **This reads its own `text-field.json` group and nothing of `Action`'s**, so the field
38
+ * and the button agree because both name the same values, and a retune of one moves only one.
39
+ */
40
+ export function TextField({ label, name, hint, multiline = false, className, ...rest }) {
41
+ const id = rest.id ?? `newtone-text-field-${name}`;
42
+ const hintId = hint === undefined ? undefined : `${id}-hint`;
43
+ // The caller's own description is kept and the hint is added to it, rather than one replacing
44
+ // the other -- an error message a form writes beside the box is the case this exists for.
45
+ const describedBy = [rest['aria-describedby'], hintId].filter(Boolean).join(' ') || undefined;
46
+ const classes = [
47
+ 'newtone-text-field-box',
48
+ multiline ? 'newtone-text-field-box--multiline' : null,
49
+ className,
50
+ ]
51
+ .filter(Boolean)
52
+ .join(' ');
53
+ // The two casts are `action.tsx`'s: destructuring `multiline` out of the union loses the
54
+ // narrowing on what is left, and what is left is exactly the attributes of the one element below.
55
+ return (_jsxs("div", { className: "newtone-text-field", children: [_jsx("label", { className: "newtone-text-field-label", htmlFor: id, children: label }), hint === undefined ? null : (_jsx("span", { className: "newtone-text-field-hint", id: hintId, children: hint })), multiline ? (_jsx("textarea", { ...rest, className: classes, id: id, name: name, "aria-describedby": describedBy })) : (_jsx("input", { ...rest, className: classes, id: id, name: name, "aria-describedby": describedBy }))] }));
56
+ }
57
+ //# sourceMappingURL=text-field.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text-field.js","sourceRoot":"","sources":["../../src/text-field/text-field.tsx"],"names":[],"mappings":";AA2BA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,MAAM,UAAU,SAAS,CAAC,EACtB,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,SAAS,GAAG,KAAK,EACjB,SAAS,EACT,GAAG,IAAI,EACM;IACb,MAAM,EAAE,GAAG,IAAI,CAAC,EAAE,IAAI,sBAAsB,IAAI,EAAE,CAAA;IAClD,MAAM,MAAM,GAAG,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,EAAE,OAAO,CAAA;IAC5D,8FAA8F;IAC9F,0FAA0F;IAC1F,MAAM,WAAW,GAAG,CAAC,IAAI,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,SAAS,CAAA;IAE7F,MAAM,OAAO,GAAG;QACZ,wBAAwB;QACxB,SAAS,CAAC,CAAC,CAAC,mCAAmC,CAAC,CAAC,CAAC,IAAI;QACtD,SAAS;KACZ;SACI,MAAM,CAAC,OAAO,CAAC;SACf,IAAI,CAAC,GAAG,CAAC,CAAA;IAEd,yFAAyF;IACzF,kGAAkG;IAClG,OAAO,CACH,eAAK,SAAS,EAAC,oBAAoB,aAC/B,gBAAO,SAAS,EAAC,0BAA0B,EAAC,OAAO,EAAE,EAAE,YAClD,KAAK,GACF,EACP,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CACzB,eAAM,SAAS,EAAC,yBAAyB,EAAC,EAAE,EAAE,MAAM,YAC/C,IAAI,GACF,CACV,EACA,SAAS,CAAC,CAAC,CAAC,CACT,sBACS,IAAoD,EACzD,SAAS,EAAE,OAAO,EAClB,EAAE,EAAE,EAAE,EACN,IAAI,EAAE,IAAI,sBACQ,WAAW,GAC/B,CACL,CAAC,CAAC,CAAC,CACA,mBACS,IAA8C,EACnD,SAAS,EAAE,OAAO,EAClB,EAAE,EAAE,EAAE,EACN,IAAI,EAAE,IAAI,sBACQ,WAAW,GAC/B,CACL,IACC,CACT,CAAA;AACL,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@newtone-dev/ui-react-web",
3
- "version": "0.26.3",
3
+ "version": "0.28.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -191,6 +191,21 @@
191
191
  "./tag.css": "./dist/tag/tag.css",
192
192
  "./text.css": "./dist/text/text.css",
193
193
  "./video-lightbox.css": "./dist/video-lightbox/video-lightbox.css",
194
+ "./text-field": {
195
+ "types": "./dist/text-field/index.d.ts",
196
+ "default": "./dist/text-field/index.js"
197
+ },
198
+ "./text-field.css": "./dist/text-field/text-field.css",
199
+ "./checkbox-group": {
200
+ "types": "./dist/checkbox-group/index.d.ts",
201
+ "default": "./dist/checkbox-group/index.js"
202
+ },
203
+ "./checkbox-group.css": "./dist/checkbox-group/checkbox-group.css",
204
+ "./file-field": {
205
+ "types": "./dist/file-field/index.d.ts",
206
+ "default": "./dist/file-field/index.js"
207
+ },
208
+ "./file-field.css": "./dist/file-field/file-field.css",
194
209
  "./package.json": "./package.json"
195
210
  },
196
211
  "peerDependencies": {