@newtone-dev/ui-react-web 0.2.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/LICENSE +21 -0
- package/README.md +83 -0
- package/dist/accordion/accordion.css +239 -0
- package/dist/accordion/accordion.d.ts +106 -0
- package/dist/accordion/accordion.d.ts.map +1 -0
- package/dist/accordion/accordion.js +15 -0
- package/dist/accordion/accordion.js.map +1 -0
- package/dist/accordion/index.d.ts +4 -0
- package/dist/accordion/index.d.ts.map +1 -0
- package/dist/accordion/index.js +3 -0
- package/dist/accordion/index.js.map +1 -0
- package/dist/action/action.css +86 -0
- package/dist/action/action.d.ts +62 -0
- package/dist/action/action.d.ts.map +1 -0
- package/dist/action/action.js +59 -0
- package/dist/action/action.js.map +1 -0
- package/dist/action/index.d.ts +4 -0
- package/dist/action/index.d.ts.map +1 -0
- package/dist/action/index.js +3 -0
- package/dist/action/index.js.map +1 -0
- package/dist/avatar/avatar.css +39 -0
- package/dist/avatar/avatar.d.ts +43 -0
- package/dist/avatar/avatar.d.ts.map +1 -0
- package/dist/avatar/avatar.js +38 -0
- package/dist/avatar/avatar.js.map +1 -0
- package/dist/avatar/index.d.ts +4 -0
- package/dist/avatar/index.d.ts.map +1 -0
- package/dist/avatar/index.js +3 -0
- package/dist/avatar/index.js.map +1 -0
- package/dist/button/button.css +112 -0
- package/dist/button/button.d.ts +36 -0
- package/dist/button/button.d.ts.map +1 -0
- package/dist/button/button.js +24 -0
- package/dist/button/button.js.map +1 -0
- package/dist/button/index.d.ts +3 -0
- package/dist/button/index.d.ts.map +1 -0
- package/dist/button/index.js +2 -0
- package/dist/button/index.js.map +1 -0
- package/dist/card-box/card-box.css +75 -0
- package/dist/card-box/card-box.d.ts +114 -0
- package/dist/card-box/card-box.d.ts.map +1 -0
- package/dist/card-box/card-box.js +9 -0
- package/dist/card-box/card-box.js.map +1 -0
- package/dist/card-box/index.d.ts +4 -0
- package/dist/card-box/index.d.ts.map +1 -0
- package/dist/card-box/index.js +3 -0
- package/dist/card-box/index.js.map +1 -0
- package/dist/card-grid/card-grid.css +97 -0
- package/dist/card-grid/card-grid.d.ts +63 -0
- package/dist/card-grid/card-grid.d.ts.map +1 -0
- package/dist/card-grid/card-grid.js +27 -0
- package/dist/card-grid/card-grid.js.map +1 -0
- package/dist/card-grid/index.d.ts +4 -0
- package/dist/card-grid/index.d.ts.map +1 -0
- package/dist/card-grid/index.js +3 -0
- package/dist/card-grid/index.js.map +1 -0
- package/dist/color/gamut.d.ts +20 -0
- package/dist/color/gamut.d.ts.map +1 -0
- package/dist/color/gamut.js +72 -0
- package/dist/color/gamut.js.map +1 -0
- package/dist/color/index.d.ts +8 -0
- package/dist/color/index.d.ts.map +1 -0
- package/dist/color/index.js +21 -0
- package/dist/color/index.js.map +1 -0
- package/dist/color/oklch.d.ts +35 -0
- package/dist/color/oklch.d.ts.map +1 -0
- package/dist/color/oklch.js +103 -0
- package/dist/color/oklch.js.map +1 -0
- package/dist/color/scale.d.ts +20 -0
- package/dist/color/scale.d.ts.map +1 -0
- package/dist/color/scale.js +75 -0
- package/dist/color/scale.js.map +1 -0
- package/dist/color/seeds.d.ts +33 -0
- package/dist/color/seeds.d.ts.map +1 -0
- package/dist/color/seeds.js +148 -0
- package/dist/color/seeds.js.map +1 -0
- package/dist/control/control.css +203 -0
- package/dist/control/control.d.ts +112 -0
- package/dist/control/control.d.ts.map +1 -0
- package/dist/control/control.js +107 -0
- package/dist/control/control.js.map +1 -0
- package/dist/control/index.d.ts +4 -0
- package/dist/control/index.d.ts.map +1 -0
- package/dist/control/index.js +3 -0
- package/dist/control/index.js.map +1 -0
- package/dist/data-list/data-list.css +52 -0
- package/dist/data-list/data-list.d.ts +55 -0
- package/dist/data-list/data-list.d.ts.map +1 -0
- package/dist/data-list/data-list.js +51 -0
- package/dist/data-list/data-list.js.map +1 -0
- package/dist/data-list/index.d.ts +5 -0
- package/dist/data-list/index.d.ts.map +1 -0
- package/dist/data-list/index.js +3 -0
- package/dist/data-list/index.js.map +1 -0
- package/dist/data-list/row/row.d.ts +16 -0
- package/dist/data-list/row/row.d.ts.map +1 -0
- package/dist/data-list/row/row.js +15 -0
- package/dist/data-list/row/row.js.map +1 -0
- package/dist/feature-card/feature-card.css +93 -0
- package/dist/feature-card/feature-card.d.ts +68 -0
- package/dist/feature-card/feature-card.d.ts.map +1 -0
- package/dist/feature-card/feature-card.js +11 -0
- package/dist/feature-card/feature-card.js.map +1 -0
- package/dist/feature-card/index.d.ts +4 -0
- package/dist/feature-card/index.d.ts.map +1 -0
- package/dist/feature-card/index.js +3 -0
- package/dist/feature-card/index.js.map +1 -0
- package/dist/framed-icon/framed-icon.css +77 -0
- package/dist/framed-icon/framed-icon.d.ts +61 -0
- package/dist/framed-icon/framed-icon.d.ts.map +1 -0
- package/dist/framed-icon/framed-icon.js +14 -0
- package/dist/framed-icon/framed-icon.js.map +1 -0
- package/dist/framed-icon/index.d.ts +4 -0
- package/dist/framed-icon/index.d.ts.map +1 -0
- package/dist/framed-icon/index.js +3 -0
- package/dist/framed-icon/index.js.map +1 -0
- package/dist/gallery/gallery.css +165 -0
- package/dist/gallery/gallery.d.ts +85 -0
- package/dist/gallery/gallery.d.ts.map +1 -0
- package/dist/gallery/gallery.js +75 -0
- package/dist/gallery/gallery.js.map +1 -0
- package/dist/gallery/index.d.ts +4 -0
- package/dist/gallery/index.d.ts.map +1 -0
- package/dist/gallery/index.js +3 -0
- package/dist/gallery/index.js.map +1 -0
- package/dist/icon/icon.css +83 -0
- package/dist/icon/icon.d.ts +69 -0
- package/dist/icon/icon.d.ts.map +1 -0
- package/dist/icon/icon.js +18 -0
- package/dist/icon/icon.js.map +1 -0
- package/dist/icon/index.d.ts +4 -0
- package/dist/icon/index.d.ts.map +1 -0
- package/dist/icon/index.js +3 -0
- package/dist/icon/index.js.map +1 -0
- package/dist/icon-link/icon-link.css +57 -0
- package/dist/icon-link/icon-link.d.ts +47 -0
- package/dist/icon-link/icon-link.d.ts.map +1 -0
- package/dist/icon-link/icon-link.js +35 -0
- package/dist/icon-link/icon-link.js.map +1 -0
- package/dist/icon-link/index.d.ts +4 -0
- package/dist/icon-link/index.d.ts.map +1 -0
- package/dist/icon-link/index.js +3 -0
- package/dist/icon-link/index.js.map +1 -0
- package/dist/identity/identity.d.ts +25 -0
- package/dist/identity/identity.d.ts.map +1 -0
- package/dist/identity/identity.js +25 -0
- package/dist/identity/identity.js.map +1 -0
- package/dist/identity/index.d.ts +3 -0
- package/dist/identity/index.d.ts.map +1 -0
- package/dist/identity/index.js +2 -0
- package/dist/identity/index.js.map +1 -0
- package/dist/index.d.ts +57 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +29 -0
- package/dist/index.js.map +1 -0
- package/dist/link/index.d.ts +3 -0
- package/dist/link/index.d.ts.map +1 -0
- package/dist/link/index.js +2 -0
- package/dist/link/index.js.map +1 -0
- package/dist/link/link.css +65 -0
- package/dist/link/link.d.ts +38 -0
- package/dist/link/link.d.ts.map +1 -0
- package/dist/link/link.js +22 -0
- package/dist/link/link.js.map +1 -0
- package/dist/logo-marquee/index.d.ts +4 -0
- package/dist/logo-marquee/index.d.ts.map +1 -0
- package/dist/logo-marquee/index.js +3 -0
- package/dist/logo-marquee/index.js.map +1 -0
- package/dist/logo-marquee/logo-marquee.css +227 -0
- package/dist/logo-marquee/logo-marquee.d.ts +69 -0
- package/dist/logo-marquee/logo-marquee.d.ts.map +1 -0
- package/dist/logo-marquee/logo-marquee.js +11 -0
- package/dist/logo-marquee/logo-marquee.js.map +1 -0
- package/dist/media-plate/index.d.ts +4 -0
- package/dist/media-plate/index.d.ts.map +1 -0
- package/dist/media-plate/index.js +3 -0
- package/dist/media-plate/index.js.map +1 -0
- package/dist/media-plate/media-plate.css +41 -0
- package/dist/media-plate/media-plate.d.ts +45 -0
- package/dist/media-plate/media-plate.d.ts.map +1 -0
- package/dist/media-plate/media-plate.js +5 -0
- package/dist/media-plate/media-plate.js.map +1 -0
- package/dist/media-window/media-window.css +82 -0
- package/dist/navbar/actions/actions.d.ts +14 -0
- package/dist/navbar/actions/actions.d.ts.map +1 -0
- package/dist/navbar/actions/actions.js +12 -0
- package/dist/navbar/actions/actions.js.map +1 -0
- package/dist/navbar/brand/brand.d.ts +12 -0
- package/dist/navbar/brand/brand.d.ts.map +1 -0
- package/dist/navbar/brand/brand.js +10 -0
- package/dist/navbar/brand/brand.js.map +1 -0
- package/dist/navbar/context.d.ts +12 -0
- package/dist/navbar/context.d.ts.map +1 -0
- package/dist/navbar/context.js +13 -0
- package/dist/navbar/context.js.map +1 -0
- package/dist/navbar/index.d.ts +8 -0
- package/dist/navbar/index.d.ts.map +1 -0
- package/dist/navbar/index.js +8 -0
- package/dist/navbar/index.js.map +1 -0
- package/dist/navbar/link/drawer/drawer.css +50 -0
- package/dist/navbar/link/drawer/drawer.d.ts +20 -0
- package/dist/navbar/link/drawer/drawer.d.ts.map +1 -0
- package/dist/navbar/link/drawer/drawer.js +44 -0
- package/dist/navbar/link/drawer/drawer.js.map +1 -0
- package/dist/navbar/link/link.css +54 -0
- package/dist/navbar/link/link.d.ts +30 -0
- package/dist/navbar/link/link.d.ts.map +1 -0
- package/dist/navbar/link/link.js +29 -0
- package/dist/navbar/link/link.js.map +1 -0
- package/dist/navbar/links/links.d.ts +14 -0
- package/dist/navbar/links/links.d.ts.map +1 -0
- package/dist/navbar/links/links.js +14 -0
- package/dist/navbar/links/links.js.map +1 -0
- package/dist/navbar/menu-button/menu-button.css +20 -0
- package/dist/navbar/menu-button/menu-button.d.ts +13 -0
- package/dist/navbar/menu-button/menu-button.d.ts.map +1 -0
- package/dist/navbar/menu-button/menu-button.js +20 -0
- package/dist/navbar/menu-button/menu-button.js.map +1 -0
- package/dist/navbar/navbar.css +179 -0
- package/dist/navbar/navbar.d.ts +58 -0
- package/dist/navbar/navbar.d.ts.map +1 -0
- package/dist/navbar/navbar.js +96 -0
- package/dist/navbar/navbar.js.map +1 -0
- package/dist/numbered-list/index.d.ts +4 -0
- package/dist/numbered-list/index.d.ts.map +1 -0
- package/dist/numbered-list/index.js +3 -0
- package/dist/numbered-list/index.js.map +1 -0
- package/dist/numbered-list/numbered-list.css +46 -0
- package/dist/numbered-list/numbered-list.d.ts +31 -0
- package/dist/numbered-list/numbered-list.d.ts.map +1 -0
- package/dist/numbered-list/numbered-list.js +26 -0
- package/dist/numbered-list/numbered-list.js.map +1 -0
- package/dist/on-media/on-media.css +198 -0
- package/dist/quick-action/index.d.ts +4 -0
- package/dist/quick-action/index.d.ts.map +1 -0
- package/dist/quick-action/index.js +3 -0
- package/dist/quick-action/index.js.map +1 -0
- package/dist/quick-action/quick-action.css +70 -0
- package/dist/quick-action/quick-action.d.ts +68 -0
- package/dist/quick-action/quick-action.d.ts.map +1 -0
- package/dist/quick-action/quick-action.js +54 -0
- package/dist/quick-action/quick-action.js.map +1 -0
- package/dist/segmented-control/index.d.ts +4 -0
- package/dist/segmented-control/index.d.ts.map +1 -0
- package/dist/segmented-control/index.js +3 -0
- package/dist/segmented-control/index.js.map +1 -0
- package/dist/segmented-control/segmented-control.css +206 -0
- package/dist/segmented-control/segmented-control.d.ts +91 -0
- package/dist/segmented-control/segmented-control.d.ts.map +1 -0
- package/dist/segmented-control/segmented-control.js +9 -0
- package/dist/segmented-control/segmented-control.js.map +1 -0
- package/dist/stat-card/index.d.ts +4 -0
- package/dist/stat-card/index.d.ts.map +1 -0
- package/dist/stat-card/index.js +3 -0
- package/dist/stat-card/index.js.map +1 -0
- package/dist/stat-card/stat-card.css +56 -0
- package/dist/stat-card/stat-card.d.ts +48 -0
- package/dist/stat-card/stat-card.d.ts.map +1 -0
- package/dist/stat-card/stat-card.js +11 -0
- package/dist/stat-card/stat-card.js.map +1 -0
- package/dist/surface/index.d.ts +3 -0
- package/dist/surface/index.d.ts.map +1 -0
- package/dist/surface/index.js +2 -0
- package/dist/surface/index.js.map +1 -0
- package/dist/surface/surface.d.ts +40 -0
- package/dist/surface/surface.d.ts.map +1 -0
- package/dist/surface/surface.js +22 -0
- package/dist/surface/surface.js.map +1 -0
- package/dist/tag/index.d.ts +4 -0
- package/dist/tag/index.d.ts.map +1 -0
- package/dist/tag/index.js +3 -0
- package/dist/tag/index.js.map +1 -0
- package/dist/tag/tag.css +77 -0
- package/dist/tag/tag.d.ts +80 -0
- package/dist/tag/tag.d.ts.map +1 -0
- package/dist/tag/tag.js +16 -0
- package/dist/tag/tag.js.map +1 -0
- package/dist/text/index.d.ts +3 -0
- package/dist/text/index.d.ts.map +1 -0
- package/dist/text/index.js +2 -0
- package/dist/text/index.js.map +1 -0
- package/dist/text/text.css +232 -0
- package/dist/text/text.d.ts +64 -0
- package/dist/text/text.d.ts.map +1 -0
- package/dist/text/text.js +37 -0
- package/dist/text/text.js.map +1 -0
- package/dist/video-lightbox/index.d.ts +4 -0
- package/dist/video-lightbox/index.d.ts.map +1 -0
- package/dist/video-lightbox/index.js +3 -0
- package/dist/video-lightbox/index.js.map +1 -0
- package/dist/video-lightbox/video-lightbox.css +167 -0
- package/dist/video-lightbox/video-lightbox.d.ts +92 -0
- package/dist/video-lightbox/video-lightbox.d.ts.map +1 -0
- package/dist/video-lightbox/video-lightbox.js +31 -0
- package/dist/video-lightbox/video-lightbox.js.map +1 -0
- package/dist/wrapper/index.d.ts +3 -0
- package/dist/wrapper/index.d.ts.map +1 -0
- package/dist/wrapper/index.js +2 -0
- package/dist/wrapper/index.js.map +1 -0
- package/dist/wrapper/wrapper.d.ts +113 -0
- package/dist/wrapper/wrapper.d.ts.map +1 -0
- package/dist/wrapper/wrapper.js +83 -0
- package/dist/wrapper/wrapper.js.map +1 -0
- package/package.json +184 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* One round action a page keeps within reach for a whole visit -- a chat entry, a back to top, a
|
|
4
|
+
* help button. `Action`'s persistent sibling: an action is a moment a reader arrives at, this is on
|
|
5
|
+
* screen for the entire scroll.
|
|
6
|
+
*
|
|
7
|
+
* ---- it does not position itself, and is not named for where it sits ------
|
|
8
|
+
*
|
|
9
|
+
* Whatever pins it -- a corner, a safe-area inset, a dock -- belongs to the page that placed it.
|
|
10
|
+
* `--newtone-quick-action-size` is the one property a caller retunes, which is `Avatar`'s
|
|
11
|
+
* arrangement and arrived for `Avatar`'s reason: a `sm`/`md`/`lg` ladder sized from the call sites
|
|
12
|
+
* a library happens to know about leaves the next one off every rung. A component called
|
|
13
|
+
* `FloatingButton` would be carrying a word about a slot it does not own.
|
|
14
|
+
*
|
|
15
|
+
* ---- NOTHING RENDERS ONE, and that is recorded rather than smoothed over --
|
|
16
|
+
*
|
|
17
|
+
* **Ported 2026-09-16 from `~/Projects/Harbour Space/-harbour-space-design-system` with zero call
|
|
18
|
+
* sites anywhere in this house.** It is the only component in this library in that position, and
|
|
19
|
+
* the only one whose shape was settled by reading a reference rather than by a consumer pushing on
|
|
20
|
+
* it -- which is the thing the preamble refuses, built anyway on an explicit decision after the
|
|
21
|
+
* cost was put on the table. `issues/open/154-the-round-action-nothing-presses.md`.
|
|
22
|
+
*
|
|
23
|
+
* **So every refusal below is argued from the reference and from sibling components, and none of
|
|
24
|
+
* them has been tested.** They may all be right. Whoever gives this a consumer should expect to
|
|
25
|
+
* change some of them, which is what happened to `Control` within hours of it landing.
|
|
26
|
+
*
|
|
27
|
+
* ---- no brand variant ----------------------------------------------------
|
|
28
|
+
*
|
|
29
|
+
* The reference's is a union whose `whatsapp` arm carries Meta's inline SVG and four hard-coded
|
|
30
|
+
* hexes. Two rules forbid that here and either would be enough: no component in this library names
|
|
31
|
+
* a client, and a licensed asset lives with its licence holder -- *the library learns to express a
|
|
32
|
+
* thing, it never carries it.* The slot above is what replaces it.
|
|
33
|
+
*
|
|
34
|
+
* ---- no `disabled`, and no shadow ----------------------------------------
|
|
35
|
+
*
|
|
36
|
+
* `disabled` is absent for `Action`'s reason, which is stronger here: an unavailable action that is
|
|
37
|
+
* on screen for the entire visit is worse than one that is not there.
|
|
38
|
+
*
|
|
39
|
+
* **The shadow is the one thing this visibly lost.** The reference's whole colour argument is that
|
|
40
|
+
* the circle takes the surface's own ground and is lifted by depth rather than by hue, because it
|
|
41
|
+
* must not compete with the page for a whole scroll. Newtone has no shadow vocabulary, so the lift
|
|
42
|
+
* is dropped rather than hard-coded, and a rim does the separating instead. On a busy ground this
|
|
43
|
+
* is genuinely weaker than the component it came from, and the fix is a vocabulary rather than
|
|
44
|
+
* anything in this folder -- `newtone_ui_tokens.md` section 8, *Shadows, blur, spread*.
|
|
45
|
+
*/
|
|
46
|
+
export function QuickAction({ label, children, className, ...rest }) {
|
|
47
|
+
const classes = ['newtone-quick-action', className].filter(Boolean).join(' ');
|
|
48
|
+
if (rest.href !== undefined) {
|
|
49
|
+
const { href, ...anchor } = rest;
|
|
50
|
+
return (_jsx("a", { href: href, className: classes, "aria-label": label, ...anchor, children: children }));
|
|
51
|
+
}
|
|
52
|
+
return (_jsx("button", { type: "button", className: classes, "aria-label": label, ...rest, children: children }));
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=quick-action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quick-action.js","sourceRoot":"","sources":["../../src/quick-action/quick-action.tsx"],"names":[],"mappings":";AA4BA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,MAAM,UAAU,WAAW,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,IAAI,EAAoB;IACjF,MAAM,OAAO,GAAG,CAAC,sBAAsB,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IAE7E,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAC1B,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,EAAE,GAAG,IAG3B,CAAA;QACD,OAAO,CACH,YAAG,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,gBAAc,KAAK,KAAM,MAAM,YAC3D,QAAQ,GACT,CACP,CAAA;IACL,CAAC;IAED,OAAO,CACH,iBACI,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,OAAO,gBACN,KAAK,KACZ,IAAgD,YAEpD,QAAQ,GACJ,CACZ,CAAA;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/segmented-control/index.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AACzD,YAAY,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/segmented-control/index.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA"}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
/* The control's sheet: a track, its segments, the chosen one and the focused one. Every colour is
|
|
2
|
+
* read from a Newtone role; none is declared. See the repo blueprint, sections 4.1.13 and 4.2.
|
|
3
|
+
*
|
|
4
|
+
* **Every value here was read out of the served `Toggle-module` stylesheet on 2026-09-06**, not off
|
|
5
|
+
* a computed box -- `governance/take-the-value-from-the-surface-it-lives-on` and
|
|
6
|
+
* `governance/evidence/a-fixture-is-a-copy-of-the-surface-it-quotes.md`. The declarations are quoted where
|
|
7
|
+
* ours give way.
|
|
8
|
+
*
|
|
9
|
+
* ---- this is the first `:has()` in this repo ------------------------------
|
|
10
|
+
*
|
|
11
|
+
* Zero occurrences across every stylesheet in `src/` before today, and it is here because the box
|
|
12
|
+
* that paints is the `<label>` and the thing that changes is the `<input>` INSIDE it. A sibling
|
|
13
|
+
* selector would reach the word and not the segment; putting the input outside the label instead
|
|
14
|
+
* would buy an `id` per segment and a generator to make them unique. So the parent asks about its
|
|
15
|
+
* own child, which is what `:has()` is.
|
|
16
|
+
*
|
|
17
|
+
* The live page does exactly this, in both places:
|
|
18
|
+
*
|
|
19
|
+
* .Toggle-module__segment:has(.Toggle-module__input:checked){...}
|
|
20
|
+
* .Toggle-module__segment:has(.Toggle-module__input:focus-visible){...}
|
|
21
|
+
*
|
|
22
|
+
* ---- the corners, which are derived rather than nearest -------------------
|
|
23
|
+
*
|
|
24
|
+
* Live: a 16px track around 12px segments with 4px of padding between them, so the segment's curve
|
|
25
|
+
* nests concentrically inside the track's. Newtone's radius scale has `sm` (4px) and `md` (8px) and
|
|
26
|
+
* nothing above -- a control is what `md` is FOR, so the segment lands on it exactly, and the track
|
|
27
|
+
* has nowhere to go.
|
|
28
|
+
*
|
|
29
|
+
* **So the track's corner is derived from the segment's rather than rounded down to it**:
|
|
30
|
+
* `md + space-1` is 12, which keeps the relationship the live page draws and is `framed-icon.css`'s
|
|
31
|
+
* *24 minus 8* arriving from the other direction. Rounding both to 8 would have made a track and its
|
|
32
|
+
* segments share one corner, which reads as one box with lines in it.
|
|
33
|
+
*
|
|
34
|
+
* The give-way, in values: 16 -> 12 on the track, 12 -> 8 on the segment.
|
|
35
|
+
*
|
|
36
|
+
* ---- the two grounds ------------------------------------------------------
|
|
37
|
+
*
|
|
38
|
+
* Live: a `neutral-50` track with the chosen segment in white, on a white page. Ours is the same
|
|
39
|
+
* relationship out of the two surface roles this system has -- the track steps down to
|
|
40
|
+
* `surface-secondary` and the chosen segment returns to `surface-primary`, which is the ground the
|
|
41
|
+
* band behind it is painted from. It is `tag/`'s argument for reading the secondary surface: a
|
|
42
|
+
* segment sharing its track's colour is a word with no shape around it.
|
|
43
|
+
*
|
|
44
|
+
* **The unselected segment's hover moves the ink and not the ground**, and that is a give-way rather
|
|
45
|
+
* than a choice. The live page darkens to a third neutral between the track and the page; Newtone
|
|
46
|
+
* publishes two surfaces, and the track is already the second. So hover takes the primary ink, which
|
|
47
|
+
* is where the chosen segment's ink is, and the ground stays put.
|
|
48
|
+
*
|
|
49
|
+
* ---- and no shadow --------------------------------------------------------
|
|
50
|
+
*
|
|
51
|
+
* The chosen segment carries `box-shadow: var(--shadow-s)` live -- two layers, 8% and 4% black.
|
|
52
|
+
* **Newtone has no elevation vocabulary and this repo has never written a shadow**: `grep -rn
|
|
53
|
+
* "box-shadow" src/` returns nothing. A shadow declared in one component's sheet is an elevation the
|
|
54
|
+
* rest of the site cannot agree with, which is `blueprints/newtone/contracts/roles.md`'s reason a
|
|
55
|
+
* component may not read a role, one layer down. The chosen segment is told apart by its ground and
|
|
56
|
+
* its ink, which is what `card-box/` already relies on. Section 8 carries the row.
|
|
57
|
+
*
|
|
58
|
+
* ---- the focus ring is on the label, and it has to be ---------------------
|
|
59
|
+
*
|
|
60
|
+
* **A `<label>` never takes focus**, so a global `:focus-visible` rule on the control cannot fire
|
|
61
|
+
* here: the thing that takes focus is an input at `opacity: 0` stretched across the segment, and a
|
|
62
|
+
* ring drawn on that is a ring nobody sees. So the segment asks whether its own input is focused.
|
|
63
|
+
* `governance/code/focus-is-not-optional.md`, and `2px solid` is the expression Newtone's link, button and
|
|
64
|
+
* navbar all use.
|
|
65
|
+
*
|
|
66
|
+
* `outline-offset: 0` is the live page's own value and the right one here: the track pads 4px, so a
|
|
67
|
+
* ring pushed outward would sit on the neighbouring segment.
|
|
68
|
+
*
|
|
69
|
+
* ---- the breakpoint, which is 768 where the live one is 960 ---------------
|
|
70
|
+
*
|
|
71
|
+
* Below it the track fills the column and the segments share it equally, and their inline padding
|
|
72
|
+
* drops from 24 to 8 -- the live rule's own two changes, including the padding, which was found in
|
|
73
|
+
* the stylesheet rather than in the measurement that preceded it.
|
|
74
|
+
*
|
|
75
|
+
* **960 is in nobody's vocabulary here.** Issue 022 gave this repo two widths, both of them
|
|
76
|
+
* Newtone's; `gallery/` and `video-lightbox/` step at `48rem` here and a band in the consuming site
|
|
77
|
+
* does too, and a fourth
|
|
78
|
+
* number would be the thing `tools/check-breakpoints.mjs` exists to report. So this steps at 48rem
|
|
79
|
+
* and the 192-pixel difference is recorded in values --
|
|
80
|
+
* `governance/evidence/record-a-concession-in-values-not-in-names.md`.
|
|
81
|
+
*
|
|
82
|
+
* ---- the small pill -------------------------------------------------------
|
|
83
|
+
*
|
|
84
|
+
* `−50%` is 12/16 at a 4px corner with `2px 4px` of padding, and `tag/` is a capsule at 14 with 8px
|
|
85
|
+
* of inline padding. **They are two shapes and the served sheets carry them as two modules.** So the
|
|
86
|
+
* mark is markup here rather than a second size on `tag/` -- section 4.1.13's decision D, and
|
|
87
|
+
* `portrait/`'s second size is what it would have cost. Section 8 carries the trigger.
|
|
88
|
+
*
|
|
89
|
+
* **What it does borrow is the construction, and that is the argument rather than an inconsistency.**
|
|
90
|
+
* It is a `Surface theme="tinted"` around a `Text`, which is `tag.tsx`'s two elements for
|
|
91
|
+
* `tag.tsx`'s reason: a component may not read a role, so the scope re-points `surface-secondary`
|
|
92
|
+
* and `text-secondary` at the accent-tinted pair and this sheet writes each role name once. **The
|
|
93
|
+
* tinted ground is what makes the mark legible in both places it lands** -- inside an unselected
|
|
94
|
+
* segment, where the neutral track shows through, and inside the chosen one, where the ground is the
|
|
95
|
+
* page's own white. The live pill solves the same problem with a support family Newtone publishes an
|
|
96
|
+
* ink for and no surface, which is section 4.1.13's decision D.
|
|
97
|
+
*
|
|
98
|
+
* Its block padding is `space-1`, 4px, where the live pill's is 2: Newtone's spacing scale starts at
|
|
99
|
+
* 4 and has no half step, which is the same trade `tag/` itself makes and is recorded with it.
|
|
100
|
+
*
|
|
101
|
+
* **The track's own gap is the same trade a second time**: `space-1` is 4 where the live track puts
|
|
102
|
+
* 2 between its segments. Two arrivals at the same wall inside one component.
|
|
103
|
+
*
|
|
104
|
+
* ---- and `align-self`, which is `inline-flex` meaning what it says -------
|
|
105
|
+
*
|
|
106
|
+
* **Added 2026-09-06, by the band that first rendered this.** `display: inline-flex` sizes a box to
|
|
107
|
+
* its content on the INLINE axis and says nothing about the cross axis, so in the band's column --
|
|
108
|
+
* a flex container, stretching by default -- the track filled 1216 pixels of a 345-pixel control.
|
|
109
|
+
* `align-self: start` is that declaration finishing its own sentence.
|
|
110
|
+
*
|
|
111
|
+
* **It is here rather than at the band, and that is section 4.2's line rather than a preference.** A
|
|
112
|
+
* band may not select into a component's classes, so the two candidates were this and a `Wrapper`
|
|
113
|
+
* around the control whose entire job is one declaration on its child -- which `review-card.css`
|
|
114
|
+
* refuses in writing and `master-page.tsx` deleted the reference's `outro` slot for. **A component
|
|
115
|
+
* that declares it is content-sized owns the whole of that claim.**
|
|
116
|
+
*
|
|
117
|
+
* The media query below turns it into a full-width row, and `inline-size: 100%` overrides this
|
|
118
|
+
* without contradicting it. */
|
|
119
|
+
|
|
120
|
+
.newtone-segmented-control {
|
|
121
|
+
display: inline-flex;
|
|
122
|
+
align-self: start;
|
|
123
|
+
align-items: center;
|
|
124
|
+
gap: var(--newtone-segmented-control-gap);
|
|
125
|
+
padding: var(--newtone-segmented-control-padding);
|
|
126
|
+
/* The track's corner is the segment's plus the padding between them, which is what keeps the two
|
|
127
|
+
curves concentric. Both terms are this component's own tokens, so the relationship survives a
|
|
128
|
+
retune of either -- and it is a `calc` in the sheet rather than a token because a reference is
|
|
129
|
+
a whole value and an expression over two of them is not. */
|
|
130
|
+
border-radius: calc(
|
|
131
|
+
var(--newtone-segmented-control-radius) + var(--newtone-segmented-control-padding)
|
|
132
|
+
);
|
|
133
|
+
background: var(--newtone-segmented-control-track);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.newtone-segmented-control-segment {
|
|
137
|
+
position: relative;
|
|
138
|
+
display: inline-flex;
|
|
139
|
+
align-items: center;
|
|
140
|
+
gap: var(--newtone-segmented-control-segment-gap);
|
|
141
|
+
padding-block: var(--newtone-segmented-control-segment-padding-block);
|
|
142
|
+
padding-inline: var(--newtone-segmented-control-segment-padding-inline);
|
|
143
|
+
border-radius: var(--newtone-segmented-control-segment-radius);
|
|
144
|
+
color: var(--newtone-segmented-control-segment-text);
|
|
145
|
+
white-space: nowrap;
|
|
146
|
+
cursor: pointer;
|
|
147
|
+
user-select: none;
|
|
148
|
+
transition:
|
|
149
|
+
background-color 0.15s ease-out,
|
|
150
|
+
color 0.15s ease-out;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/* The input is the control and the label is the hit area, so it covers the segment and paints
|
|
154
|
+
* nothing. `margin: 0` because a user agent gives a radio one and it would push the label. */
|
|
155
|
+
.newtone-segmented-control-input {
|
|
156
|
+
position: absolute;
|
|
157
|
+
inset: 0;
|
|
158
|
+
margin: 0;
|
|
159
|
+
opacity: 0;
|
|
160
|
+
cursor: inherit;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.newtone-segmented-control-segment:hover {
|
|
164
|
+
color: var(--newtone-segmented-control-segment-text-hover);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.newtone-segmented-control-segment:has(.newtone-segmented-control-input:checked) {
|
|
168
|
+
background: var(--newtone-segmented-control-chosen-fill);
|
|
169
|
+
color: var(--newtone-segmented-control-chosen-text);
|
|
170
|
+
cursor: default;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.newtone-segmented-control-segment:has(.newtone-segmented-control-input:focus-visible) {
|
|
174
|
+
outline: 2px solid;
|
|
175
|
+
outline-offset: 0;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/* The mark, which is not `tag/` and is built the way `tag/` is built. See the docblock. */
|
|
179
|
+
.newtone-segmented-control-badge {
|
|
180
|
+
display: inline-flex;
|
|
181
|
+
align-items: center;
|
|
182
|
+
padding: var(--newtone-segmented-control-badge-padding);
|
|
183
|
+
border-radius: var(--newtone-segmented-control-badge-radius);
|
|
184
|
+
background: var(--newtone-segmented-control-badge-fill);
|
|
185
|
+
color: var(--newtone-segmented-control-badge-text);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
@media (max-width: 48rem) {
|
|
189
|
+
.newtone-segmented-control {
|
|
190
|
+
display: flex;
|
|
191
|
+
inline-size: 100%;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.newtone-segmented-control-segment {
|
|
195
|
+
flex: 1 1 0;
|
|
196
|
+
min-inline-size: 0;
|
|
197
|
+
justify-content: center;
|
|
198
|
+
padding-inline: var(--newtone-segmented-control-segment-padding-inline-narrow);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
@media (prefers-reduced-motion: reduce) {
|
|
203
|
+
.newtone-segmented-control-segment {
|
|
204
|
+
transition: none;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* A row of segments where exactly one is chosen, and choosing one is the only thing it does.
|
|
4
|
+
*
|
|
5
|
+
* ---- it holds no state, and this is the band that could have justified one --
|
|
6
|
+
*
|
|
7
|
+
* A native radio group: one `<label>` per segment, each wrapping a visually-hidden
|
|
8
|
+
* `<input type="radio">` on one shared name. **There is no `value`, no change handler and no
|
|
9
|
+
* `'use client'`** -- the browser's own single-select, the keyboard behaviour, the announced group
|
|
10
|
+
* and the whole thing working with JavaScript off all come free and correct, and there is no flag
|
|
11
|
+
* that can fall out of step with which segment is lit.
|
|
12
|
+
*
|
|
13
|
+
* **That is `accordion/`'s answer one level harder**, and this time it reaches past the component:
|
|
14
|
+
* what a reader picks here rewrites six things inside a card in the band below. Section 4.1.13's
|
|
15
|
+
* decision A carries the whole argument, including the two costs the costing named against it that
|
|
16
|
+
* turned out not to be costs. The short version is that the card renders both states, one is
|
|
17
|
+
* `display: none`, and the band flips three inherited custom properties from
|
|
18
|
+
* `:has(input:checked)` -- so this file reports nothing to anybody and the DOM is the state.
|
|
19
|
+
*
|
|
20
|
+
* **This is the live page's own markup**, read out of the served document on 2026-09-06 rather than
|
|
21
|
+
* inferred: `role="radiogroup"` with an `aria-label`, two labels, one generated name, the input at
|
|
22
|
+
* `opacity: 0` across the whole segment so the label is the hit area.
|
|
23
|
+
*
|
|
24
|
+
* ---- what it is called -----------------------------------------------------
|
|
25
|
+
*
|
|
26
|
+
* **Not `toggle/`, which is the reference's name.** In a browser a toggle is a switch with two
|
|
27
|
+
* states; this is single-select among however many segments arrive, and the name would be wrong the
|
|
28
|
+
* first time there were three.
|
|
29
|
+
*
|
|
30
|
+
* ---- what it takes ---------------------------------------------------------
|
|
31
|
+
*
|
|
32
|
+
* **`name` is required and is not a constant.** `accordion/`'s argument unchanged: a name is an
|
|
33
|
+
* identity rather than a value, and a constant means two controls on one page quietly deselecting
|
|
34
|
+
* each other -- no error, no type failure, and no tell beyond the wrong segment lighting up.
|
|
35
|
+
*
|
|
36
|
+
* **`label` is the group's accessible name and it is content**, so it arrives with the band like
|
|
37
|
+
* every other string on this page.
|
|
38
|
+
*
|
|
39
|
+
* **`badge` is a string and not a node**, which is the one place this diverges from `accordion/`'s
|
|
40
|
+
* `trailing` slot rather than following it. That slot exists so a list never learns what `Core`
|
|
41
|
+
* means, and this control does not learn what `−50%` means either: **it owns the pill's shape and
|
|
42
|
+
* the caller owns its word.** A `ReactNode` would offer a 12px capsule as a place to put anything,
|
|
43
|
+
* which is a promise the shape cannot keep. `Tag`'s own split is the same one.
|
|
44
|
+
*
|
|
45
|
+
* **The first option is checked and there is no `defaultValue`.** One call site, and the live page
|
|
46
|
+
* checks its first segment. `governance/evidence/size-an-api-from-call-sites-not-from-the-type.md`.
|
|
47
|
+
* **Trigger:** a call site whose chosen segment is not the first one.
|
|
48
|
+
*
|
|
49
|
+
* ---- it is a plain `<div>` and that is deliberate ---------------------------
|
|
50
|
+
*
|
|
51
|
+
* The track needs `role` and `aria-label`. **This file said `Wrapper` admitted neither, and it was
|
|
52
|
+
* half wrong** -- `role` was refused and `aria-label` compiled all along, because TypeScript does
|
|
53
|
+
* not check a JSX attribute whose name is not a valid identifier, so it was arriving at the element
|
|
54
|
+
* unexamined rather than being admitted. `issues/done/026-a-box-cannot-carry-an-attribute.md` was
|
|
55
|
+
* closed by compiling that claim instead of reading it.
|
|
56
|
+
*
|
|
57
|
+
* **Both are legal on a box now and this stays a plain `<div>`**, because the reason that decided it
|
|
58
|
+
* was never the one that changed: a component written here writes its own element and reaches its
|
|
59
|
+
* own attributes. The box would buy this file nothing -- no gap, no padding, no alignment it does
|
|
60
|
+
* not already have in its own sheet. **This was the first thing on the page that wanted an
|
|
61
|
+
* accessible name on a box and it correctly did not become that issue's second call site**; the
|
|
62
|
+
* second was the band that paints, one component over.
|
|
63
|
+
*
|
|
64
|
+
* ---- it is born here and it is the clearest thing yet that should not stay --
|
|
65
|
+
*
|
|
66
|
+
* A segmented single-select is agnostic: it does not know what a course, a place or an audience
|
|
67
|
+
* is. Section 4.4 says it is born here and earns its way out **at its second consumer**, and
|
|
68
|
+
* `newtone_ui_react-web`'s section 8 will not take a component one screen has needed once. Until
|
|
69
|
+
* then there is nothing to abstract from.
|
|
70
|
+
*/
|
|
71
|
+
export interface SegmentedControlOption {
|
|
72
|
+
/** The value the input carries -- what the band's own `:has()` rule keys on. */
|
|
73
|
+
value: string;
|
|
74
|
+
/** The word on the segment. Content, and it arrives with the band. */
|
|
75
|
+
label: string;
|
|
76
|
+
/** A small mark after the label -- `−50%`. The word is the caller's; the shape is this file's. */
|
|
77
|
+
badge?: string;
|
|
78
|
+
}
|
|
79
|
+
export interface SegmentedControlProps extends HTMLAttributes<HTMLElement> {
|
|
80
|
+
/**
|
|
81
|
+
* The group these segments belong to -- the value of every input's `name`, which is what makes
|
|
82
|
+
* them exclusive. Required, and not a constant: see above.
|
|
83
|
+
*/
|
|
84
|
+
name: string;
|
|
85
|
+
/** What the group is asking. Becomes its `aria-label`. */
|
|
86
|
+
label: string;
|
|
87
|
+
/** The segments, in order. The first one is checked. */
|
|
88
|
+
options: readonly SegmentedControlOption[];
|
|
89
|
+
}
|
|
90
|
+
export declare function SegmentedControl({ name, label, options, className, ...rest }: SegmentedControlProps): import("react").JSX.Element;
|
|
91
|
+
//# sourceMappingURL=segmented-control.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"segmented-control.d.ts","sourceRoot":"","sources":["../../src/segmented-control/segmented-control.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAG3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoEG;AAEH,MAAM,WAAW,sBAAsB;IACnC,gFAAgF;IAChF,KAAK,EAAE,MAAM,CAAA;IACb,sEAAsE;IACtE,KAAK,EAAE,MAAM,CAAA;IACb,kGAAkG;IAClG,KAAK,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,qBAAsB,SAAQ,cAAc,CAAC,WAAW,CAAC;IACtE;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ,0DAA0D;IAC1D,KAAK,EAAE,MAAM,CAAA;IACb,wDAAwD;IACxD,OAAO,EAAE,SAAS,sBAAsB,EAAE,CAAA;CAC7C;AAED,wBAAgB,gBAAgB,CAAC,EAC7B,IAAI,EACJ,KAAK,EACL,OAAO,EACP,SAAS,EACT,GAAG,IAAI,EACV,EAAE,qBAAqB,+BA0CvB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// The subpaths, not the barrel. `@newtone-dev/ui-react-web` re-exports Navbar, Navbar calls hooks, and
|
|
3
|
+
// this is a server component -- see the repo blueprint, section 4.3.
|
|
4
|
+
import { Surface } from '../surface/index.js';
|
|
5
|
+
import { Text } from '../text/index.js';
|
|
6
|
+
export function SegmentedControl({ name, label, options, className, ...rest }) {
|
|
7
|
+
return (_jsx("div", { className: ['newtone-segmented-control', className].filter(Boolean).join(' '), role: "radiogroup", "aria-label": label, ...rest, children: options.map((option, index) => (_jsxs("label", { className: "newtone-segmented-control-segment", children: [_jsx("input", { className: "newtone-segmented-control-input", type: "radio", name: name, value: option.value, defaultChecked: index === 0 }), _jsx(Text, { as: "span", scale: "body-sm", weight: "medium", children: option.label }), option.badge ? (_jsx(Surface, { as: "span", theme: "tinted", className: "newtone-segmented-control-badge", children: _jsx(Text, { as: "span", scale: "caption", weight: "medium", figures: "tabular", children: option.badge }) })) : null] }, option.value))) }));
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=segmented-control.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"segmented-control.js","sourceRoot":"","sources":["../../src/segmented-control/segmented-control.tsx"],"names":[],"mappings":";AAAA,uGAAuG;AACvG,qEAAqE;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAE7C,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AA6FvC,MAAM,UAAU,gBAAgB,CAAC,EAC7B,IAAI,EACJ,KAAK,EACL,OAAO,EACP,SAAS,EACT,GAAG,IAAI,EACa;IACpB,OAAO,CACH,cACI,SAAS,EAAE,CAAC,2BAA2B,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAC7E,IAAI,EAAC,YAAY,gBACL,KAAK,KACb,IAAI,YAEP,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC,CAC5B,iBAA0B,SAAS,EAAC,mCAAmC,aAInE,gBACI,SAAS,EAAC,iCAAiC,EAC3C,IAAI,EAAC,OAAO,EACZ,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,MAAM,CAAC,KAAK,EACnB,cAAc,EAAE,KAAK,KAAK,CAAC,GAC7B,EACF,KAAC,IAAI,IAAC,EAAE,EAAC,MAAM,EAAC,KAAK,EAAC,SAAS,EAAC,MAAM,EAAC,QAAQ,YAC1C,MAAM,CAAC,KAAK,GACV,EAKN,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CACZ,KAAC,OAAO,IACJ,EAAE,EAAC,MAAM,EACT,KAAK,EAAC,QAAQ,EACd,SAAS,EAAC,iCAAiC,YAE3C,KAAC,IAAI,IAAC,EAAE,EAAC,MAAM,EAAC,KAAK,EAAC,SAAS,EAAC,MAAM,EAAC,QAAQ,EAAC,OAAO,EAAC,SAAS,YAC5D,MAAM,CAAC,KAAK,GACV,GACD,CACb,CAAC,CAAC,CAAC,IAAI,KA5BA,MAAM,CAAC,KAAK,CA6BhB,CACX,CAAC,GACA,CACT,CAAA;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/stat-card/index.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,YAAY,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/stat-card/index.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/* The statistic card's sheet: a floor and three inks. Every colour is read from this component's own
|
|
2
|
+
* semantic group; none is declared and none is a role. See the repo blueprint, sections 4.1 and 5.
|
|
3
|
+
*
|
|
4
|
+
* ---- the floor -----------------------------------------------------------
|
|
5
|
+
*
|
|
6
|
+
* **This is where the original's `minWidth="xs"` went.** There it is a prop, resolved into
|
|
7
|
+
* `flex: 1 1 min(<measure>, 100%)` plus a matching `min-width`, so one authored value both sets the
|
|
8
|
+
* card's share of a row and states where the row wraps. Newtone's `Wrapper` has no sizing family --
|
|
9
|
+
* issue 015 deferred it -- and the floor is invariant per card kind rather than per instance, so it
|
|
10
|
+
* is a rule here and no call site types it. See card-box.tsx for the whole argument.
|
|
11
|
+
*
|
|
12
|
+
* `10rem` is the original's own measure for this card: 160px, the width of a short statistic column.
|
|
13
|
+
*
|
|
14
|
+
* **`min(..., 100%)` is not tidiness.** A bare `min-width` is a floor a flex item will not shrink
|
|
15
|
+
* past, so a card in a container narrower than its own minimum pushes out of it and gives the page a
|
|
16
|
+
* horizontal scrollbar. Capped at 100% it simply fills what it has, which is what "as narrow as this
|
|
17
|
+
* may usefully get" was always meant to mean.
|
|
18
|
+
*
|
|
19
|
+
* ---- the inks ------------------------------------------------------------
|
|
20
|
+
*
|
|
21
|
+
* **The head's colour is set once and the glyph inherits it**, because `Icon` takes no colour prop
|
|
22
|
+
* and reads `currentColor`. That is what makes the mark and the label the same shade rather than two
|
|
23
|
+
* shades that agree today.
|
|
24
|
+
*
|
|
25
|
+
* **The three inks are three tokens and all three resolve to a role**, which is legal here and was
|
|
26
|
+
* not until 2026-09-07: `blueprints/newtone/contracts/roles.md` section 3 forbade a component
|
|
27
|
+
* reading a role, its own *trigger to revisit* fired at the stated count of three, and the
|
|
28
|
+
* prohibition was narrowed to what it was always arguing -- a component may not borrow a role for
|
|
29
|
+
* its own ink over its own FILL. This card declares no fill. Its head, figure and caption sit on
|
|
30
|
+
* whatever surface the `CardBox` around them is painted from, which is the same ground running prose
|
|
31
|
+
* sits on, so the role's answer to *how much contrast is enough* is the right answer here rather
|
|
32
|
+
* than a borrowed one. `tag/`, `card-box/` and `framed-icon/` are the three that fired it.
|
|
33
|
+
*
|
|
34
|
+
* **Two of the three tokens carry the same role and that is not a redundancy to collapse.** The head
|
|
35
|
+
* and the caption agree today; they are two decisions that happen to agree, and a group with one
|
|
36
|
+
* name for both would make them impossible to separate the day one of them moves.
|
|
37
|
+
*
|
|
38
|
+
* The consuming site's third level of ink lands on the second one here -- the original has three
|
|
39
|
+
* levels and Newtone has two, and the give-way is recorded in that site's own knowledge entry. */
|
|
40
|
+
|
|
41
|
+
.newtone-stat-card {
|
|
42
|
+
flex: 1 1 min(10rem, 100%);
|
|
43
|
+
min-width: min(10rem, 100%);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.newtone-stat-card-head {
|
|
47
|
+
color: var(--newtone-stat-card-head);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.newtone-stat-card-figure {
|
|
51
|
+
color: var(--newtone-stat-card-figure);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.newtone-stat-card-caption {
|
|
55
|
+
color: var(--newtone-stat-card-caption);
|
|
56
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* A statistic: a glyph and a little heading over a figure and the sentence that qualifies it.
|
|
4
|
+
* `overview` renders three of them.
|
|
5
|
+
*
|
|
6
|
+
* **There is no `size`.** The reference this was read off offers `sm` and `lg`, and its one consumer
|
|
7
|
+
* passes `sm` at all three call sites -- a constant wearing a prop's syntax, which is the count
|
|
8
|
+
* governance/evidence/size-an-api-from-call-sites-not-from-the-type.md exists to catch. What the prop
|
|
9
|
+
* actually selected there was a slot minimum, and a slot minimum is a rule in this component's sheet
|
|
10
|
+
* rather than a value anybody types. See card-box.tsx.
|
|
11
|
+
*
|
|
12
|
+
* **It arrived here on 2026-09-07 by a ruling rather than by the sort**, and by a count of one, so
|
|
13
|
+
* governance/code/a-shared-component-is-stressed-by-its-consumer.md is what happens to it next: the
|
|
14
|
+
* consumer's real demands are what widen these four props, and nothing has asked yet.
|
|
15
|
+
*
|
|
16
|
+
* ---- the three scales, and the one that is a give-way --------------------
|
|
17
|
+
*
|
|
18
|
+
* The label is `body` where the original writes `body-md`, the figure is `display-lg` in both, and
|
|
19
|
+
* the caption is `body-sm` in both. **The label's colour is the give-way, not its size**: the
|
|
20
|
+
* original sets the glyph and the label to its third level of text ink, deliberately faint so the
|
|
21
|
+
* figure is what you read. Newtone's role layer has two levels and stops, so both take the second.
|
|
22
|
+
* The consuming site's own knowledge entry carries it.
|
|
23
|
+
*
|
|
24
|
+
* **The colour is set once, on the head, and the glyph inherits it.** `Icon` takes no `color` prop
|
|
25
|
+
* on purpose, so a rule on the row is what makes the mark and the label match, and they cannot come
|
|
26
|
+
* apart.
|
|
27
|
+
*
|
|
28
|
+
* **The figure does not animate.** The reference counts a number up on arrival. Newtone has no text
|
|
29
|
+
* animation at all.
|
|
30
|
+
*
|
|
31
|
+
* **`h3` is stated here rather than passed.** Its one consumer puts every card inside a section whose
|
|
32
|
+
* own head is the `h2`, so the level is a fact about the card's position and the position does not
|
|
33
|
+
* vary. **A second consumer at another depth is exactly what would earn a prop**, and that is the
|
|
34
|
+
* loop governance/code/a-shared-component-is-stressed-by-its-consumer.md describes rather than a
|
|
35
|
+
* limitation to fix in advance.
|
|
36
|
+
*/
|
|
37
|
+
export interface StatCardProps extends HTMLAttributes<HTMLElement> {
|
|
38
|
+
/** A Material Symbols ligature. */
|
|
39
|
+
icon: string;
|
|
40
|
+
/** The little heading above the figure -- `Outcomes`, `Faculty`. */
|
|
41
|
+
label: string;
|
|
42
|
+
/** The number itself -- `95%`, `14`. A string, because `95%` is not one. */
|
|
43
|
+
figure: string;
|
|
44
|
+
/** The sentence that says what the figure is of. */
|
|
45
|
+
caption: string;
|
|
46
|
+
}
|
|
47
|
+
export declare function StatCard({ icon, label, figure, caption, className, ...rest }: StatCardProps): import("react").JSX.Element;
|
|
48
|
+
//# sourceMappingURL=stat-card.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stat-card.d.ts","sourceRoot":"","sources":["../../src/stat-card/stat-card.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAK3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,WAAW,aAAc,SAAQ,cAAc,CAAC,WAAW,CAAC;IAC9D,mCAAmC;IACnC,IAAI,EAAE,MAAM,CAAA;IACZ,oEAAoE;IACpE,KAAK,EAAE,MAAM,CAAA;IACb,4EAA4E;IAC5E,MAAM,EAAE,MAAM,CAAA;IACd,oDAAoD;IACpD,OAAO,EAAE,MAAM,CAAA;CAClB;AAED,wBAAgB,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,EAAE,aAAa,+BAyB3F"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// The subpaths, not the barrel. `@newtone-dev/ui-react-web` re-exports Navbar, Navbar calls hooks, and
|
|
3
|
+
// this is a server component -- see the repo blueprint, section 4.3.
|
|
4
|
+
import { Text } from '../text/index.js';
|
|
5
|
+
import { Wrapper } from '../wrapper/index.js';
|
|
6
|
+
import { CardBox } from '../card-box/index.js';
|
|
7
|
+
import { Icon } from '../icon/index.js';
|
|
8
|
+
export function StatCard({ icon, label, figure, caption, className, ...rest }) {
|
|
9
|
+
return (_jsxs(CardBox, { direction: "column", className: ['newtone-stat-card', className].filter(Boolean).join(' '), ...rest, children: [_jsxs(Wrapper, { direction: "row", gap: 2, padding: 3, className: "newtone-stat-card-head", children: [_jsx(Icon, { name: icon }), _jsx(Text, { as: "h3", scale: "body", children: label })] }), _jsxs(Wrapper, { direction: "column", gap: 2, padding: 3, children: [_jsx(Text, { scale: "display-lg", className: "newtone-stat-card-figure", children: figure }), _jsx(Text, { scale: "body-sm", className: "newtone-stat-card-caption", children: caption })] })] }));
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=stat-card.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stat-card.js","sourceRoot":"","sources":["../../src/stat-card/stat-card.tsx"],"names":[],"mappings":";AAAA,uGAAuG;AACvG,qEAAqE;AACrE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAEvC,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAgDvC,MAAM,UAAU,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,IAAI,EAAiB;IACxF,OAAO,CACH,MAAC,OAAO,IACJ,SAAS,EAAC,QAAQ,EAClB,SAAS,EAAE,CAAC,mBAAmB,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,KACjE,IAAI,aAIR,MAAC,OAAO,IAAC,SAAS,EAAC,KAAK,EAAC,GAAG,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,SAAS,EAAC,wBAAwB,aAC3E,KAAC,IAAI,IAAC,IAAI,EAAE,IAAI,GAAI,EACpB,KAAC,IAAI,IAAC,EAAE,EAAC,IAAI,EAAC,KAAK,EAAC,MAAM,YACrB,KAAK,GACH,IACD,EACV,MAAC,OAAO,IAAC,SAAS,EAAC,QAAQ,EAAC,GAAG,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,aAC1C,KAAC,IAAI,IAAC,KAAK,EAAC,YAAY,EAAC,SAAS,EAAC,0BAA0B,YACxD,MAAM,GACJ,EACP,KAAC,IAAI,IAAC,KAAK,EAAC,SAAS,EAAC,SAAS,EAAC,2BAA2B,YACtD,OAAO,GACL,IACD,IACJ,CACb,CAAA;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/surface/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,YAAY,EAAE,YAAY,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/surface/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type ElementType, type HTMLAttributes } from 'react';
|
|
2
|
+
export type Theme = 'default' | 'tinted' | 'emphasis' | 'strong';
|
|
3
|
+
export type Elevation = 'high' | 'base' | 'deep';
|
|
4
|
+
export type Mode = 'light' | 'dark';
|
|
5
|
+
/**
|
|
6
|
+
* The three facets, plus the attribute surface of whatever element `as` renders.
|
|
7
|
+
*
|
|
8
|
+
* **The argument for extending `HTMLAttributes<HTMLElement>` is `Wrapper`'s and is written there in
|
|
9
|
+
* full.** The short version: a component carries the attributes of the element it renders, `Link`
|
|
10
|
+
* settled that on 2026-09-01, and a second answer to it would be a second thing to keep in step.
|
|
11
|
+
* This component is the second box that needed it -- `<Surface as="section" id="apply">`, on the one
|
|
12
|
+
* band of a ten-band page that paints its own ground -- and being a *different component* is what
|
|
13
|
+
* turned an oversight into a diagnosis.
|
|
14
|
+
*
|
|
15
|
+
* **The facet attributes below are written by this component and are not part of that surface.** A
|
|
16
|
+
* caller who passes `data-newtone-theme` directly is writing the same attribute twice, and `...rest`
|
|
17
|
+
* spreads last, so theirs wins. There is no reason to do it and nothing stops them.
|
|
18
|
+
*/
|
|
19
|
+
export interface SurfaceProps extends HTMLAttributes<HTMLElement> {
|
|
20
|
+
/** Surface intent. `strong` is an inverted default -- it is not dark mode. */
|
|
21
|
+
theme?: Theme;
|
|
22
|
+
/** How raised this surface is. Colour position only; it does not accumulate. */
|
|
23
|
+
elevation?: Elevation;
|
|
24
|
+
/** Sets the mode for this element and everything under it. */
|
|
25
|
+
mode?: Mode;
|
|
26
|
+
as?: ElementType;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* A surface owns the context its contents read.
|
|
30
|
+
*
|
|
31
|
+
* Everything inside resolves its role tokens against this element, so a Button placed on
|
|
32
|
+
* an `emphasis` Surface inverts without being told anything. That is the whole point: the
|
|
33
|
+
* facets live here, and components carry none.
|
|
34
|
+
*
|
|
35
|
+
* This is markup, not a runtime. There is no provider and no re-render when a value
|
|
36
|
+
* changes -- the browser resolves custom properties at render time, which is why this repo
|
|
37
|
+
* consumes CSS rather than JSON.
|
|
38
|
+
*/
|
|
39
|
+
export declare function Surface({ theme, elevation, mode, as, children, ...rest }: SurfaceProps): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
40
|
+
//# sourceMappingURL=surface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"surface.d.ts","sourceRoot":"","sources":["../../src/surface/surface.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,OAAO,CAAA;AAE5E,MAAM,MAAM,KAAK,GAAG,SAAS,GAAG,QAAQ,GAAG,UAAU,GAAG,QAAQ,CAAA;AAChE,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAA;AAChD,MAAM,MAAM,IAAI,GAAG,OAAO,GAAG,MAAM,CAAA;AAEnC;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,YAAa,SAAQ,cAAc,CAAC,WAAW,CAAC;IAC7D,8EAA8E;IAC9E,KAAK,CAAC,EAAE,KAAK,CAAA;IACb,gFAAgF;IAChF,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB,8DAA8D;IAC9D,IAAI,CAAC,EAAE,IAAI,CAAA;IACX,EAAE,CAAC,EAAE,WAAW,CAAA;CACnB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,OAAO,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,EAAU,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,EAAE,YAAY,0FAY9F"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createElement } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* A surface owns the context its contents read.
|
|
4
|
+
*
|
|
5
|
+
* Everything inside resolves its role tokens against this element, so a Button placed on
|
|
6
|
+
* an `emphasis` Surface inverts without being told anything. That is the whole point: the
|
|
7
|
+
* facets live here, and components carry none.
|
|
8
|
+
*
|
|
9
|
+
* This is markup, not a runtime. There is no provider and no re-render when a value
|
|
10
|
+
* changes -- the browser resolves custom properties at render time, which is why this repo
|
|
11
|
+
* consumes CSS rather than JSON.
|
|
12
|
+
*/
|
|
13
|
+
export function Surface({ theme, elevation, mode, as = 'div', children, ...rest }) {
|
|
14
|
+
return createElement(as, {
|
|
15
|
+
'data-newtone-surface': '',
|
|
16
|
+
'data-newtone-theme': theme,
|
|
17
|
+
'data-newtone-elevation': elevation,
|
|
18
|
+
'data-newtone-mode': mode,
|
|
19
|
+
...rest,
|
|
20
|
+
}, children);
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=surface.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"surface.js","sourceRoot":"","sources":["../../src/surface/surface.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAyC,MAAM,OAAO,CAAA;AA8B5E;;;;;;;;;;GAUG;AACH,MAAM,UAAU,OAAO,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,GAAG,KAAK,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAgB;IAC3F,OAAO,aAAa,CAChB,EAAE,EACF;QACI,sBAAsB,EAAE,EAAE;QAC1B,oBAAoB,EAAE,KAAK;QAC3B,wBAAwB,EAAE,SAAS;QACnC,mBAAmB,EAAE,IAAI;QACzB,GAAG,IAAI;KACV,EACD,QAAQ,CACX,CAAA;AACL,CAAC"}
|