@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,59 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Icon } from '../icon/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* The one thing a page is asking for.
|
|
5
|
+
*
|
|
6
|
+
* ---- it has no `variant`, and that absence IS the component ---------------
|
|
7
|
+
*
|
|
8
|
+
* A `Button` offers three tiers because a page has many buttons and they need an order. This offers
|
|
9
|
+
* none, because **a second action would mean neither is the action**. Where a page genuinely needs a
|
|
10
|
+
* quieter companion beside it, that companion is an ordinary `Button` -- which is what
|
|
11
|
+
* `adenario_website`'s hero does with its two doors, the first call site this ever had.
|
|
12
|
+
*
|
|
13
|
+
* ---- what makes it reserved is shape, not hue -----------------------------
|
|
14
|
+
*
|
|
15
|
+
* **Ported 2026-09-16 from `~/Projects/Harbour Space/-harbour-space-design-system`, where it is
|
|
16
|
+
* `Task` and paints from a `success` ramp** -- green, deliberately a colour no ordinary button there
|
|
17
|
+
* uses. That did not survive the crossing, and the reason is a rule rather than a preference:
|
|
18
|
+
* Newtone's `success` is a ROLE, `contracts/roles.md` section 3 forbids a component borrowing a
|
|
19
|
+
* role's answer for its own ink over its own fill, and a control that has not been pressed yet has
|
|
20
|
+
* no outcome to report. So this paints from `accent` like a primary `Button`, and what separates it
|
|
21
|
+
* is that it is a pill, larger, and that there is one of it.
|
|
22
|
+
*
|
|
23
|
+
* ---- it is NOT a Button at a second size ---------------------------------
|
|
24
|
+
*
|
|
25
|
+
* `contracts/button.md` defers a size axis and this does not discharge it. A size prop is a caller
|
|
26
|
+
* choosing emphasis among many controls; this is a different component with one tier. The repo
|
|
27
|
+
* blueprint's section 8 carries the row, because *the size already exists, it is just called
|
|
28
|
+
* Action* is the cheap misreading available from here.
|
|
29
|
+
*
|
|
30
|
+
* ---- no `disabled`, deliberately ------------------------------------------
|
|
31
|
+
*
|
|
32
|
+
* An action is the single thing a page is asking for. If the ask is unavailable, do not render it,
|
|
33
|
+
* rather than rendering the page's loudest element as an inert no -- a conditionally available ask
|
|
34
|
+
* is a `Button`. Without an `href` this renders a `<button>` that carries no handler and therefore
|
|
35
|
+
* does nothing, which is an honest placeholder and not a form control: `type="button"` is
|
|
36
|
+
* hardcoded, so it cannot submit a form it happens to be standing in.
|
|
37
|
+
*/
|
|
38
|
+
export function Action({ label, ariaLabel, iconEnd, fill = false, className, ...rest }) {
|
|
39
|
+
// `--icon-end` is keyed on the glyph being PRESENT and not on the prop being declared, because
|
|
40
|
+
// the class does one thing -- take a gap off the padding on the glyph's side -- and a pill with
|
|
41
|
+
// no glyph in it would be 16px short on one side for nothing. See action.css.
|
|
42
|
+
const classes = [
|
|
43
|
+
'newtone-action',
|
|
44
|
+
iconEnd === undefined ? null : 'newtone-action--icon-end',
|
|
45
|
+
fill ? 'newtone-action--fill' : null,
|
|
46
|
+
className,
|
|
47
|
+
]
|
|
48
|
+
.filter(Boolean)
|
|
49
|
+
.join(' ');
|
|
50
|
+
// The label is always present, so the control always has a name and the glyph is decorative.
|
|
51
|
+
// `Icon` writes its own `aria-hidden`.
|
|
52
|
+
const content = (_jsxs(_Fragment, { children: [_jsx("span", { className: "newtone-action-label", children: label }), iconEnd === undefined ? null : _jsx(Icon, { name: iconEnd, size: "md" })] }));
|
|
53
|
+
if (rest.href !== undefined) {
|
|
54
|
+
const { href, ...anchor } = rest;
|
|
55
|
+
return (_jsx("a", { href: href, className: classes, "aria-label": ariaLabel, ...anchor, children: content }));
|
|
56
|
+
}
|
|
57
|
+
return (_jsx("button", { type: "button", className: classes, "aria-label": ariaLabel, ...rest, children: content }));
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action.js","sourceRoot":"","sources":["../../src/action/action.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AA+BvC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,UAAU,MAAM,CAAC,EACnB,KAAK,EACL,SAAS,EACT,OAAO,EACP,IAAI,GAAG,KAAK,EACZ,SAAS,EACT,GAAG,IAAI,EACG;IACV,+FAA+F;IAC/F,gGAAgG;IAChG,8EAA8E;IAC9E,MAAM,OAAO,GAAG;QACZ,gBAAgB;QAChB,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,0BAA0B;QACzD,IAAI,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,IAAI;QACpC,SAAS;KACZ;SACI,MAAM,CAAC,OAAO,CAAC;SACf,IAAI,CAAC,GAAG,CAAC,CAAA;IAEd,6FAA6F;IAC7F,uCAAuC;IACvC,MAAM,OAAO,GAAG,CACZ,8BACI,eAAM,SAAS,EAAC,sBAAsB,YAAE,KAAK,GAAQ,EACpD,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAC,IAAI,IAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAC,IAAI,GAAG,IAClE,CACN,CAAA;IAED,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,SAAS,KAAM,MAAM,YAC/D,OAAO,GACR,CACP,CAAA;IACL,CAAC;IAED,OAAO,CACH,iBACI,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,OAAO,gBACN,SAAS,KAChB,IAAgD,YAEpD,OAAO,GACH,CACZ,CAAA;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/action/index.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/action/index.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/* A circular portrait on a plate.
|
|
2
|
+
*
|
|
3
|
+
* THE PLATE IS THE ONLY COLOUR HERE and it is a role this component is painted FROM rather than ink
|
|
4
|
+
* it puts on something -- contracts/roles.md section 3 as narrowed, the same act as `card-box` and
|
|
5
|
+
* `tag`. A photograph with a transparent edge needs a ground; that ground is the surface one step
|
|
6
|
+
* down, and it follows the theme and the mode with nothing passed.
|
|
7
|
+
*
|
|
8
|
+
* THE DIAMETER IS THE CALLER'S AND IS NOT A TOKEN. `--newtone-avatar-size` is read with a 7rem
|
|
9
|
+
* default and declared nowhere in this library -- the `--newtone-card-grid-min` shape, third use.
|
|
10
|
+
* It is not a token because a diameter is not re-themed; it is not a prop because the three call
|
|
11
|
+
* sites this arrived from want 3.5rem, `clamp(5rem, 28%, 7rem)` and 15rem, and the middle one is
|
|
12
|
+
* not a rung on any ladder the other two imply. */
|
|
13
|
+
.newtone-avatar {
|
|
14
|
+
display: block;
|
|
15
|
+
flex: none;
|
|
16
|
+
inline-size: var(--newtone-avatar-size, 7rem);
|
|
17
|
+
|
|
18
|
+
/* LOAD-BEARING, AND WITHOUT IT EVERY AVATAR IS AN OVAL. This component IS the `<img>`, and every
|
|
19
|
+
call site passes `width` and `height` -- correctly, because that is what reserves the ratio
|
|
20
|
+
before any bytes arrive. HTML MAPS THOSE ATTRIBUTES TO PRESENTATIONAL HINTS for the `width`
|
|
21
|
+
and `height` properties: `inline-size` above overrides the width hint, and nothing overrode
|
|
22
|
+
the height one. So a 240px disc from a 480px file was 240 WIDE AND 480 TALL, and
|
|
23
|
+
`aspect-ratio` below never applied -- it fills in a dimension that computes to `auto`, and
|
|
24
|
+
neither one did.
|
|
25
|
+
|
|
26
|
+
THE THREE HAND-WRITTEN COPIES THIS REPLACED NEVER HIT IT: each was a sized `<div>` with an
|
|
27
|
+
`<img>` inside, so the attributes landed on a child. Collapsing the wrapper moved them onto
|
|
28
|
+
the sized element, and the defect arrived with the simplification. An author stylesheet beats
|
|
29
|
+
a presentational hint, so this is what makes the circle the caller was promised.
|
|
30
|
+
adenario_website measured 108x256, 56x128 and 240x480 on 2026-09-15. */
|
|
31
|
+
block-size: auto;
|
|
32
|
+
aspect-ratio: 1;
|
|
33
|
+
border-radius: 50%;
|
|
34
|
+
background: var(--newtone-avatar-ground);
|
|
35
|
+
|
|
36
|
+
/* A photograph is almost never square. Without this, a 4:3 original is squeezed into the
|
|
37
|
+
circle and every face in a row is a different shape. */
|
|
38
|
+
object-fit: cover;
|
|
39
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { ImgHTMLAttributes } from 'react';
|
|
2
|
+
export interface AvatarProps extends Omit<ImgHTMLAttributes<HTMLImageElement>, 'alt'> {
|
|
3
|
+
src: string;
|
|
4
|
+
/**
|
|
5
|
+
* Required, and by the type rather than by a runtime check -- the same strictness `Link` puts
|
|
6
|
+
* on `href`. A face with no name is the one thing this component must not let through, and an
|
|
7
|
+
* empty string is a legal value here: it says *decorative*, deliberately, which is what the
|
|
8
|
+
* three call sites beside a written-out name actually want.
|
|
9
|
+
*/
|
|
10
|
+
alt: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* A person, in a circle, on a plate.
|
|
14
|
+
*
|
|
15
|
+
* **The plate is the point and it is why this is not an `<img>` with a class.** A portrait is
|
|
16
|
+
* usually a photograph with a transparent or near-white edge, and a circle cut out of one sits on
|
|
17
|
+
* nothing unless something is behind it. `avatar.ground` is `role.surface.secondary` -- a recess in
|
|
18
|
+
* the current surface, resolved per theme and per mode -- so the plate follows the page into dark
|
|
19
|
+
* without the caller naming a second colour. That is exactly what three hand-written copies in
|
|
20
|
+
* the consuming site were doing by hand and what none of them did for dark.
|
|
21
|
+
*
|
|
22
|
+
* ---- the size is the caller's, and that was settled by the third call site ----
|
|
23
|
+
*
|
|
24
|
+
* **There is no `size` prop, and the first draft had one.** It offered `sm` / `md` / `lg` at 3.5rem,
|
|
25
|
+
* 7rem and 15rem, sized from two of the three call sites this arrived from. The third is
|
|
26
|
+
* `clamp(5rem, 28%, 7rem)` -- a portrait that gives way as its card narrows -- and it is not a rung
|
|
27
|
+
* on any ladder those two could have implied. **A ladder proposed at two would have been wrong about
|
|
28
|
+
* its own shape**, which is exactly what governance/code/propose-the-system-at-the-third-repetition.md
|
|
29
|
+
* says the third occurrence is for.
|
|
30
|
+
*
|
|
31
|
+
* So the diameter is `--newtone-avatar-size`, read with a 7rem default and declared by the caller on
|
|
32
|
+
* an element it already owns. **That is `--newtone-card-grid-min`'s shape, and this is its third
|
|
33
|
+
* use**: a custom property does not have to reach an element to be read by it, so all three call
|
|
34
|
+
* sites keep their own exact value and none of them passes anything.
|
|
35
|
+
*
|
|
36
|
+
* **What it deliberately does not have is a corner marker.** A consuming site's own portrait component
|
|
37
|
+
* puts a country flag on one, hardcoding a path into that app's public folder, and that is the
|
|
38
|
+
* reason that component stayed its site's -- a library cannot know where an app vendors its flags.
|
|
39
|
+
* Nothing here has a slot for one. The day a second site wants a marker, what crosses is the slot,
|
|
40
|
+
* not the flag.
|
|
41
|
+
*/
|
|
42
|
+
export declare function Avatar({ src, alt, className, ...rest }: AvatarProps): import("react").JSX.Element;
|
|
43
|
+
//# sourceMappingURL=avatar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"avatar.d.ts","sourceRoot":"","sources":["../../src/avatar/avatar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAE9C,MAAM,WAAW,WAAY,SAAQ,IAAI,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,EAAE,KAAK,CAAC;IACjF,GAAG,EAAE,MAAM,CAAA;IACX;;;;;OAKG;IACH,GAAG,EAAE,MAAM,CAAA;CACd;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,MAAM,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,EAAE,WAAW,+BAanE"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* A person, in a circle, on a plate.
|
|
4
|
+
*
|
|
5
|
+
* **The plate is the point and it is why this is not an `<img>` with a class.** A portrait is
|
|
6
|
+
* usually a photograph with a transparent or near-white edge, and a circle cut out of one sits on
|
|
7
|
+
* nothing unless something is behind it. `avatar.ground` is `role.surface.secondary` -- a recess in
|
|
8
|
+
* the current surface, resolved per theme and per mode -- so the plate follows the page into dark
|
|
9
|
+
* without the caller naming a second colour. That is exactly what three hand-written copies in
|
|
10
|
+
* the consuming site were doing by hand and what none of them did for dark.
|
|
11
|
+
*
|
|
12
|
+
* ---- the size is the caller's, and that was settled by the third call site ----
|
|
13
|
+
*
|
|
14
|
+
* **There is no `size` prop, and the first draft had one.** It offered `sm` / `md` / `lg` at 3.5rem,
|
|
15
|
+
* 7rem and 15rem, sized from two of the three call sites this arrived from. The third is
|
|
16
|
+
* `clamp(5rem, 28%, 7rem)` -- a portrait that gives way as its card narrows -- and it is not a rung
|
|
17
|
+
* on any ladder those two could have implied. **A ladder proposed at two would have been wrong about
|
|
18
|
+
* its own shape**, which is exactly what governance/code/propose-the-system-at-the-third-repetition.md
|
|
19
|
+
* says the third occurrence is for.
|
|
20
|
+
*
|
|
21
|
+
* So the diameter is `--newtone-avatar-size`, read with a 7rem default and declared by the caller on
|
|
22
|
+
* an element it already owns. **That is `--newtone-card-grid-min`'s shape, and this is its third
|
|
23
|
+
* use**: a custom property does not have to reach an element to be read by it, so all three call
|
|
24
|
+
* sites keep their own exact value and none of them passes anything.
|
|
25
|
+
*
|
|
26
|
+
* **What it deliberately does not have is a corner marker.** A consuming site's own portrait component
|
|
27
|
+
* puts a country flag on one, hardcoding a path into that app's public folder, and that is the
|
|
28
|
+
* reason that component stayed its site's -- a library cannot know where an app vendors its flags.
|
|
29
|
+
* Nothing here has a slot for one. The day a second site wants a marker, what crosses is the slot,
|
|
30
|
+
* not the flag.
|
|
31
|
+
*/
|
|
32
|
+
export function Avatar({ src, alt, className, ...rest }) {
|
|
33
|
+
return (_jsx("img", { src: src, alt: alt, className: ['newtone-avatar', className].filter(Boolean).join(' '),
|
|
34
|
+
// Both default here rather than at each call site, because a portrait is never the
|
|
35
|
+
// thing a reader is waiting for and every existing call site wrote both by hand.
|
|
36
|
+
loading: "lazy", decoding: "async", ...rest }));
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=avatar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"avatar.js","sourceRoot":"","sources":["../../src/avatar/avatar.tsx"],"names":[],"mappings":";AAaA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,UAAU,MAAM,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,IAAI,EAAe;IAChE,OAAO,CACH,cACI,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,CAAC,gBAAgB,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;QAClE,mFAAmF;QACnF,iFAAiF;QACjF,OAAO,EAAC,MAAM,EACd,QAAQ,EAAC,OAAO,KACZ,IAAI,GACV,CACL,CAAA;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/avatar/index.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/avatar/index.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/* Button's own styles. Every value is a button.* token; nothing here names a colour, and
|
|
2
|
+
nothing here mentions a facet. Radius and border width are literals because the tokens
|
|
3
|
+
repo has no scale to point at yet -- see contracts/button.md, "Deliberately not in v1". */
|
|
4
|
+
|
|
5
|
+
.newtone-button {
|
|
6
|
+
display: inline-flex;
|
|
7
|
+
align-items: center;
|
|
8
|
+
justify-content: center;
|
|
9
|
+
gap: var(--newtone-button-gap);
|
|
10
|
+
padding: var(--newtone-button-padding-y) var(--newtone-button-padding-x);
|
|
11
|
+
font-family: var(--newtone-button-label-family);
|
|
12
|
+
font-size: var(--newtone-button-label-size);
|
|
13
|
+
font-weight: var(--newtone-button-label-weight);
|
|
14
|
+
line-height: var(--newtone-button-label-line-height);
|
|
15
|
+
border: 1px solid;
|
|
16
|
+
border-radius: var(--newtone-button-radius);
|
|
17
|
+
cursor: pointer;
|
|
18
|
+
|
|
19
|
+
/* THE LAST TWO ARRIVED WITH `href` ON 2026-09-15 AND ARE ONLY EVER LOAD-BEARING ON AN ANCHOR.
|
|
20
|
+
A `<button>` has no underline and shrink-wraps its own text; an `<a>` has both, so a Button
|
|
21
|
+
given a destination would otherwise arrive underlined and with its label able to break the
|
|
22
|
+
shape. They are written on the base rule rather than on an `a.newtone-button` selector
|
|
23
|
+
because the two arms must be indistinguishable on the page -- contracts/button.md,
|
|
24
|
+
*Destination* -- and a rule that applied to one of them would make that false the moment
|
|
25
|
+
anybody compared the two. */
|
|
26
|
+
text-decoration: none;
|
|
27
|
+
text-align: center;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/* :focus-visible, not :focus -- the contract is explicit, and focus is not optional.
|
|
31
|
+
The ring is per variant: it sits against that variant's own fill, and area decides
|
|
32
|
+
how much contrast it needs. */
|
|
33
|
+
.newtone-button:focus-visible {
|
|
34
|
+
outline: 2px solid;
|
|
35
|
+
outline-offset: 2px;
|
|
36
|
+
}
|
|
37
|
+
.newtone-button--primary:focus-visible {
|
|
38
|
+
outline-color: var(--newtone-button-primary-focus-ring);
|
|
39
|
+
}
|
|
40
|
+
.newtone-button--secondary:focus-visible {
|
|
41
|
+
outline-color: var(--newtone-button-secondary-focus-ring);
|
|
42
|
+
}
|
|
43
|
+
.newtone-button--tertiary:focus-visible {
|
|
44
|
+
outline-color: var(--newtone-button-tertiary-focus-ring);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.newtone-button:disabled {
|
|
48
|
+
cursor: not-allowed;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.newtone-button--primary {
|
|
52
|
+
background: var(--newtone-button-primary-rest-fill);
|
|
53
|
+
color: var(--newtone-button-primary-rest-text);
|
|
54
|
+
border-color: var(--newtone-button-primary-rest-border);
|
|
55
|
+
}
|
|
56
|
+
.newtone-button--primary:hover {
|
|
57
|
+
background: var(--newtone-button-primary-hover-fill);
|
|
58
|
+
color: var(--newtone-button-primary-hover-text);
|
|
59
|
+
border-color: var(--newtone-button-primary-hover-border);
|
|
60
|
+
}
|
|
61
|
+
.newtone-button--primary:active {
|
|
62
|
+
background: var(--newtone-button-primary-pressed-fill);
|
|
63
|
+
color: var(--newtone-button-primary-pressed-text);
|
|
64
|
+
border-color: var(--newtone-button-primary-pressed-border);
|
|
65
|
+
}
|
|
66
|
+
.newtone-button--primary:disabled {
|
|
67
|
+
background: var(--newtone-button-primary-disabled-fill);
|
|
68
|
+
color: var(--newtone-button-primary-disabled-text);
|
|
69
|
+
border-color: var(--newtone-button-primary-disabled-border);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.newtone-button--secondary {
|
|
73
|
+
background: var(--newtone-button-secondary-rest-fill);
|
|
74
|
+
color: var(--newtone-button-secondary-rest-text);
|
|
75
|
+
border-color: var(--newtone-button-secondary-rest-border);
|
|
76
|
+
}
|
|
77
|
+
.newtone-button--secondary:hover {
|
|
78
|
+
background: var(--newtone-button-secondary-hover-fill);
|
|
79
|
+
color: var(--newtone-button-secondary-hover-text);
|
|
80
|
+
border-color: var(--newtone-button-secondary-hover-border);
|
|
81
|
+
}
|
|
82
|
+
.newtone-button--secondary:active {
|
|
83
|
+
background: var(--newtone-button-secondary-pressed-fill);
|
|
84
|
+
color: var(--newtone-button-secondary-pressed-text);
|
|
85
|
+
border-color: var(--newtone-button-secondary-pressed-border);
|
|
86
|
+
}
|
|
87
|
+
.newtone-button--secondary:disabled {
|
|
88
|
+
background: var(--newtone-button-secondary-disabled-fill);
|
|
89
|
+
color: var(--newtone-button-secondary-disabled-text);
|
|
90
|
+
border-color: var(--newtone-button-secondary-disabled-border);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.newtone-button--tertiary {
|
|
94
|
+
background: var(--newtone-button-tertiary-rest-fill);
|
|
95
|
+
color: var(--newtone-button-tertiary-rest-text);
|
|
96
|
+
border-color: var(--newtone-button-tertiary-rest-border);
|
|
97
|
+
}
|
|
98
|
+
.newtone-button--tertiary:hover {
|
|
99
|
+
background: var(--newtone-button-tertiary-hover-fill);
|
|
100
|
+
color: var(--newtone-button-tertiary-hover-text);
|
|
101
|
+
border-color: var(--newtone-button-tertiary-hover-border);
|
|
102
|
+
}
|
|
103
|
+
.newtone-button--tertiary:active {
|
|
104
|
+
background: var(--newtone-button-tertiary-pressed-fill);
|
|
105
|
+
color: var(--newtone-button-tertiary-pressed-text);
|
|
106
|
+
border-color: var(--newtone-button-tertiary-pressed-border);
|
|
107
|
+
}
|
|
108
|
+
.newtone-button--tertiary:disabled {
|
|
109
|
+
background: var(--newtone-button-tertiary-disabled-fill);
|
|
110
|
+
color: var(--newtone-button-tertiary-disabled-text);
|
|
111
|
+
border-color: var(--newtone-button-tertiary-disabled-border);
|
|
112
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { AnchorHTMLAttributes, ButtonHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export type ButtonVariant = 'primary' | 'secondary' | 'tertiary';
|
|
3
|
+
interface ButtonCommon {
|
|
4
|
+
/** All three exist. There is no default-by-omission in the contract. */
|
|
5
|
+
variant?: ButtonVariant;
|
|
6
|
+
/** The `label` slot. Required; a Button has no other slot in v1. */
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The two halves of the contract's **Action / Destination** pair, typed so that exactly one can be
|
|
11
|
+
* present. A caller that passes `href` gets an anchor's attributes and no `type` or `onClick`; a
|
|
12
|
+
* caller that passes neither gets a button's. **The union is how React spells the exclusion the
|
|
13
|
+
* contract states in prose**, and it is the reason this is one component rather than two: the
|
|
14
|
+
* paint, the variants and the tokens do not move, and `href` is the only thing that does.
|
|
15
|
+
*/
|
|
16
|
+
export type ButtonProps = (ButtonCommon & Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children'> & {
|
|
17
|
+
/** Absent on this arm. A Button with no destination is a button. */
|
|
18
|
+
href?: undefined;
|
|
19
|
+
}) | (ButtonCommon & Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'children' | 'href'> & {
|
|
20
|
+
/**
|
|
21
|
+
* Where pressing it goes. Its presence turns the rendered element into an `<a>` --
|
|
22
|
+
* see contracts/button.md, *Destination*. Nothing else about the component changes.
|
|
23
|
+
*/
|
|
24
|
+
href: string;
|
|
25
|
+
});
|
|
26
|
+
/**
|
|
27
|
+
* Discharges blueprints/newtone/contracts/button.md.
|
|
28
|
+
*
|
|
29
|
+
* **Button takes no facet props.** No theme, no mode, no elevation. Every colour it uses
|
|
30
|
+
* is a `button.*` token pointing at a role, and a role resolves against the Surface this
|
|
31
|
+
* sits on -- so the same Button inverts on an `emphasis` surface with nothing passed to it.
|
|
32
|
+
* Adding a `theme` prop here would put the 24-way context product back on every component.
|
|
33
|
+
*/
|
|
34
|
+
export declare function Button({ variant, children, className, ...rest }: ButtonProps): import("react").JSX.Element;
|
|
35
|
+
export {};
|
|
36
|
+
//# sourceMappingURL=button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../src/button/button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAElF,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,UAAU,CAAA;AAEhE,UAAU,YAAY;IAClB,wEAAwE;IACxE,OAAO,CAAC,EAAE,aAAa,CAAA;IACvB,oEAAoE;IACpE,QAAQ,EAAE,SAAS,CAAA;CACtB;AAED;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GACjB,CAAC,YAAY,GACT,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,UAAU,CAAC,GAAG;IACxD,oEAAoE;IACpE,IAAI,CAAC,EAAE,SAAS,CAAA;CACnB,CAAC,GACN,CAAC,YAAY,GACT,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC,GAAG;IACjE;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAA;CACf,CAAC,CAAA;AAEZ;;;;;;;GAOG;AACH,wBAAgB,MAAM,CAAC,EAAE,OAAmB,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,EAAE,WAAW,+BA8BxF"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Discharges blueprints/newtone/contracts/button.md.
|
|
4
|
+
*
|
|
5
|
+
* **Button takes no facet props.** No theme, no mode, no elevation. Every colour it uses
|
|
6
|
+
* is a `button.*` token pointing at a role, and a role resolves against the Surface this
|
|
7
|
+
* sits on -- so the same Button inverts on an `emphasis` surface with nothing passed to it.
|
|
8
|
+
* Adding a `theme` prop here would put the 24-way context product back on every component.
|
|
9
|
+
*/
|
|
10
|
+
export function Button({ variant = 'primary', children, className, ...rest }) {
|
|
11
|
+
// One class list, both arms. The whole of the destination change is which element wears it --
|
|
12
|
+
// no token moves, no variant is added, and `button.*` stays the only group this file reads.
|
|
13
|
+
const classes = ['newtone-button', `newtone-button--${variant}`, className]
|
|
14
|
+
.filter(Boolean)
|
|
15
|
+
.join(' ');
|
|
16
|
+
if (rest.href !== undefined) {
|
|
17
|
+
const { href, ...anchor } = rest;
|
|
18
|
+
return (_jsx("a", { href: href, className: classes, ...anchor, children: children }));
|
|
19
|
+
}
|
|
20
|
+
// `type="button"` stays FIRST so a caller inside a form can still say `submit` -- the contract
|
|
21
|
+
// defers `type` as a prop, and this is the spread already doing it rather than a new one.
|
|
22
|
+
return (_jsx("button", { type: "button", className: classes, ...rest, children: children }));
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button.js","sourceRoot":"","sources":["../../src/button/button.tsx"],"names":[],"mappings":";AAiCA;;;;;;;GAOG;AACH,MAAM,UAAU,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,IAAI,EAAe;IACrF,8FAA8F;IAC9F,4FAA4F;IAC5F,MAAM,OAAO,GAAG,CAAC,gBAAgB,EAAE,mBAAmB,OAAO,EAAE,EAAE,SAAS,CAAC;SACtE,MAAM,CAAC,OAAO,CAAC;SACf,IAAI,CAAC,GAAG,CAAC,CAAA;IAEd,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,KAAM,MAAM,YACxC,QAAQ,GACT,CACP,CAAA;IACL,CAAC;IAED,+FAA+F;IAC/F,0FAA0F;IAC1F,OAAO,CACH,iBACI,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,OAAO,KACb,IAAgD,YAEpD,QAAQ,GACJ,CACZ,CAAA;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/button/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/button/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/* The card box's sheet: the ring, the ground and the corner. Every value is read from a Newtone
|
|
2
|
+
* token; none is declared. See the repo blueprint, section 4.2.
|
|
3
|
+
*
|
|
4
|
+
* ---- the corner, which is the give-way -----------------------------------
|
|
5
|
+
*
|
|
6
|
+
* The live page rounds this box at 24px and the square plate inside it at 16px, the second derived
|
|
7
|
+
* from the first -- the card's corner minus the 8px frame the plate is inset by -- so the plate's
|
|
8
|
+
* curve follows the card's.
|
|
9
|
+
*
|
|
10
|
+
* **This comment said 20px until 2026-09-04 and it was wrong**, along with the give-way entry in
|
|
11
|
+
* the consuming site's own knowledge entry that it agrees with. framed-icon.css, written
|
|
12
|
+
* a day later from the live page, says *24 minus 8* -- and the derivation stated right here only
|
|
13
|
+
* works at 24. Three of our documents, two numbers, and the odd one out was the correct one. It was
|
|
14
|
+
* found by fetching the live page's stylesheet for something else, which is
|
|
15
|
+
* governance/evidence/record-a-concession-in-values-not-in-names.md and the occurrence that promoted it: a
|
|
16
|
+
* number resolved against the system being replaced rather than the page being matched is still the
|
|
17
|
+
* wrong number.
|
|
18
|
+
*
|
|
19
|
+
* **The collapse is a fifth larger than it read.** 24px to 8px, not 20px to 8px.
|
|
20
|
+
*
|
|
21
|
+
* **Newtone's radius scale has two steps
|
|
22
|
+
* and two jobs**: `md` (8px) is the corner of a control you press, `sm` (4px) is the corner of a
|
|
23
|
+
* small thing you do not. A card is neither -- it is a large thing you do not press, a third job
|
|
24
|
+
* nobody has needed yet -- so both corners take the nearest step, both land on `md`, and the
|
|
25
|
+
* relationship between them stops existing.
|
|
26
|
+
*
|
|
27
|
+
* `radius.sm` and `radius.md` are all there is: issue 023 built two steps from twelve call sites,
|
|
28
|
+
* and knowledge/newtone/the-corner-and-the-hairline.md is why they are named rather than numbered.
|
|
29
|
+
* **What would earn a third step is a third writer of a corner that is neither a control nor a small
|
|
30
|
+
* thing** -- this box and the plate inside it are two, and they are the same decision.
|
|
31
|
+
*
|
|
32
|
+
* The give-way is recorded in the consuming site's own knowledge entry, before it
|
|
33
|
+
* shipped rather than after.
|
|
34
|
+
*
|
|
35
|
+
* ---- the hairline --------------------------------------------------------
|
|
36
|
+
*
|
|
37
|
+
* `1px` is written literally and that is the decision rather than an omission: issue 023 counted 26
|
|
38
|
+
* of them across five repos with no other width anywhere in the tree, and settled that a hairline is
|
|
39
|
+
* 1px and the trigger for a token is a second width appearing.
|
|
40
|
+
*
|
|
41
|
+
* ---- and its colour, which stopped being one value on 2026-09-06 ---------
|
|
42
|
+
*
|
|
43
|
+
* This rule read `border: 1px solid var(--newtone-role-divider)` -- one declaration for every card
|
|
44
|
+
* in the repo -- until `pricing-card/` needed a ring that turns accent when a reader picks a
|
|
45
|
+
* segment. **It is still one declaration.** What changed is that the colour is now a property with
|
|
46
|
+
* the old value as its default, so a card that says nothing gets exactly what it got before and
|
|
47
|
+
* nothing had to be re-verified.
|
|
48
|
+
*
|
|
49
|
+
* **The seam is set on the card's own element and never above it.** `--newtone-card-box-ring` inherits like
|
|
50
|
+
* any custom property, so a value declared on a band would repaint every card under it at once.
|
|
51
|
+
* `pricing-card.css` sets it on `.pricing-card`, which IS this element -- `className` lands on the
|
|
52
|
+
* `Surface` -- and pins it back to the divider for the card that has only one state. That is the
|
|
53
|
+
* whole of the contract; issue 045 and section 4.1.13's decision A carry why the alternative, a
|
|
54
|
+
* `ring` prop, is a vocabulary bought from one call site.
|
|
55
|
+
*
|
|
56
|
+
* ---- the ground ----------------------------------------------------------
|
|
57
|
+
*
|
|
58
|
+
* The box paints its surface explicitly even though it names no theme and no elevation, so it
|
|
59
|
+
* resolves to the same colour as the band behind it. Painting it is what makes it a surface rather
|
|
60
|
+
* than a hole -- the day a band paints its own ground, a transparent card would read straight
|
|
61
|
+
* through it, and the ring alone is not a card. */
|
|
62
|
+
|
|
63
|
+
.newtone-card-box {
|
|
64
|
+
background: var(--newtone-card-box-fill);
|
|
65
|
+
border: 1px solid var(--newtone-card-box-ring, var(--newtone-card-box-border));
|
|
66
|
+
border-radius: var(--newtone-card-box-radius);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/* The inner box fills the outer one, so a card stretched taller by a neighbour in the same row
|
|
70
|
+
* distributes over its whole height rather than sitting in the top of an empty ring. `Wrapper` sets
|
|
71
|
+
* no height, so this cannot be out-specified by the inline style it writes -- which is the hazard
|
|
72
|
+
* section 4.2 states, and it runs one way. */
|
|
73
|
+
.newtone-card-box-body {
|
|
74
|
+
height: 100%;
|
|
75
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { type Elevation } from '../surface/index.js';
|
|
2
|
+
import { type SpaceStep, type WrapperAlign, type WrapperDirection } from '../wrapper/index.js';
|
|
3
|
+
import type { HTMLAttributes, ReactNode } from 'react';
|
|
4
|
+
/**
|
|
5
|
+
* The box a card is: an outlined, padded surface with a corner on it.
|
|
6
|
+
*
|
|
7
|
+
* **It is two elements, because a themed box is two elements.** Newtone's `Wrapper` declares no
|
|
8
|
+
* colour of any kind -- a box that read a role to decide its colour would be doing what
|
|
9
|
+
* blueprints/newtone/contracts/roles.md section 3 forbids -- so `Surface` decides the colour, the
|
|
10
|
+
* sheet beside this file applies it, and `Wrapper` lays out. The library's own docblock argues the
|
|
11
|
+
* shape; this is the first thing in this repo to build on it.
|
|
12
|
+
*
|
|
13
|
+
* **A `Surface` decides colour and does not apply it, and this docblock said it paints until
|
|
14
|
+
* 2026-09-09.** That is why the middle term is here rather than implied: `dist/newtone.css` has zero
|
|
15
|
+
* `background` declarations in it, so a `Surface` with nothing spending its roles is a hole. The
|
|
16
|
+
* `---- the ground ----` note in card-box.css is the same fact from the sheet's side, and it has
|
|
17
|
+
* been right since it was written.
|
|
18
|
+
*
|
|
19
|
+
* ---- what it takes, and what it refuses to take --------------------------
|
|
20
|
+
*
|
|
21
|
+
* The original is `Frame`, twenty props deep. The two cards in `overview` pass six of them, and two
|
|
22
|
+
* of those six take the same value at both call sites:
|
|
23
|
+
*
|
|
24
|
+
* outlined true, twice -> not a prop. A box that is sometimes not outlined is a
|
|
25
|
+
* different box, and this one is what a card is made of
|
|
26
|
+
* padding="xs" 8px, twice -> not a prop. The card ladder's frame term, and nothing here
|
|
27
|
+
* has ever wanted a second value
|
|
28
|
+
* -> A PROP as of 2026-09-06, and the sentence above is what fired
|
|
29
|
+
* it rather than what was wrong. `pricing-card/` wants 16 --
|
|
30
|
+
* the live card's own `--space-md`, read off its inline style
|
|
31
|
+
* -- so a second value arrived exactly as the refusal said it
|
|
32
|
+
* would have to. Eight is the default, so every card written
|
|
33
|
+
* before this one is unchanged by construction
|
|
34
|
+
* direction column | row -> a prop
|
|
35
|
+
* gap none | 12px -> a prop
|
|
36
|
+
* align none | top-left -> a prop
|
|
37
|
+
* minWidth xs | md -> NOT a prop, and it is the interesting one -- below
|
|
38
|
+
*
|
|
39
|
+
* **A prop with one value is a constant wearing a prop's syntax**, which is what section 4.1.3 of
|
|
40
|
+
* the repo blueprint counted the original's page shell down from, and
|
|
41
|
+
* governance/evidence/size-an-api-from-call-sites-not-from-the-type.md is the clause.
|
|
42
|
+
*
|
|
43
|
+
* **The slot minimum is a rule in each card's own sheet, not a prop here.** The original states it
|
|
44
|
+
* as `minWidth`, which its wrapper resolves into `flex: 1 1 min(<measure>, 100%)` plus a matching
|
|
45
|
+
* `min-width`, so one authored value sets both the card's share of a row and where the row wraps.
|
|
46
|
+
* Newtone's `Wrapper` has no sizing family at all -- issue 015 deferred it, and section 4.1.3
|
|
47
|
+
* records a page shell testing that deferral and not firing it. **A card fires it, and the answer
|
|
48
|
+
* is still not a prop:** the floor is invariant per card kind, every stat card every time, which is
|
|
49
|
+
* section 4.2's line exactly. So it lives in stat-card.css and achievement-card.css.
|
|
50
|
+
*
|
|
51
|
+
* **`className` is forwarded and lands on the outer element**, which is what makes that possible --
|
|
52
|
+
* the flex sizing has to be on the child of the row, and the child of the row is the `Surface`.
|
|
53
|
+
*
|
|
54
|
+
* **`elevation` since 2026-09-18, forwarded and never read. Still no `theme`.** This said *No
|
|
55
|
+
* `elevation` and no `theme`. Zero call sites* for eleven days, and the sentence was right about what
|
|
56
|
+
* it was measuring: a card here sits on the same ground as the band behind it and is told apart by
|
|
57
|
+
* its ring, which is what the original's own cards do, so their frame names no elevation either.
|
|
58
|
+
*
|
|
59
|
+
* **What it could not measure is a consumer that wanted the OTHER arrangement and had no way to ask
|
|
60
|
+
* for it.** `adenario_website` raised three card families on 2026-09-14 by re-pointing
|
|
61
|
+
* `--newtone-card-box-fill` on each card's own class, as a mode-aware pair, at `neutral-0` and
|
|
62
|
+
* `neutral-46` -- WHICH ARE THIS LIBRARY'S OWN `high` VALUES, transcribed into a consumer's sheet
|
|
63
|
+
* because the component took no prop for them. On 2026-09-16 the token layer's emitted light block
|
|
64
|
+
* gained a third attribute and all three re-points lost a race they had been winning, silently, in
|
|
65
|
+
* the only mode that site ships. A card the same colour as the page is the arrangement above failing
|
|
66
|
+
* rather than the arrangement above holding.
|
|
67
|
+
* See issues/done/148-three-card-families-that-are-the-page-in-one-mode-and-not-in-the-other.md.
|
|
68
|
+
*
|
|
69
|
+
* **THE PROP IS FORWARDED TO `Surface` AND READ NOWHERE IN THIS FILE**, which is the whole of why it
|
|
70
|
+
* is allowed to exist here. blueprints/newtone/repos/newtone_ui_react-web.md section 5's first row
|
|
71
|
+
* used to read *no component takes a facet prop*; it now draws the line at LEARNING one -- no
|
|
72
|
+
* default, no branch, no value read -- because a component that hands the attribute to the `Surface`
|
|
73
|
+
* it was already rendering has not learned that `high` exists. It is DESTRUCTURED rather than left to
|
|
74
|
+
* `...rest`, which would have carried it just as well: a prop that works by accident is a prop
|
|
75
|
+
* nothing documents.
|
|
76
|
+
*
|
|
77
|
+
* **`theme` did not come with it and its count is still zero.** Nothing has asked. The recorded
|
|
78
|
+
* trigger -- a second consumer needing a card in a scope its band does not already set -- has not
|
|
79
|
+
* fired, and there is still one consumer; what fired here was not that count but the premise
|
|
80
|
+
* underneath it. A prop added because its neighbour was is the framework ahead of the outcome.
|
|
81
|
+
*
|
|
82
|
+
* ---- and no `ring`, although the ring is no longer always the divider ----
|
|
83
|
+
*
|
|
84
|
+
* The discounted `pricing-card/` turns its ring accent when a reader picks a segment, which is the
|
|
85
|
+
* first paint in this repo that moves because of something a reader did. **It is not a prop.** One
|
|
86
|
+
* call site, and a tone prop would be this file learning a vocabulary of ring colours from it --
|
|
87
|
+
* `governance/evidence/size-an-api-from-call-sites-not-from-the-type.md`. What card-box.css publishes instead
|
|
88
|
+
* is `--newtone-card-box-ring`, defaulting to the divider it has always drawn, so a card that says nothing
|
|
89
|
+
* is unchanged by construction. The sheet beside this file carries the one rule the seam runs on.
|
|
90
|
+
*/
|
|
91
|
+
export interface CardBoxProps extends HTMLAttributes<HTMLElement> {
|
|
92
|
+
/** Which way the card's contents run. */
|
|
93
|
+
direction?: WrapperDirection;
|
|
94
|
+
/**
|
|
95
|
+
* The frame between the ring and the contents. Defaults to `2` -- 8px, the card ladder's frame
|
|
96
|
+
* term and what every card written before 2026-09-06 takes. See the docblock for what asked.
|
|
97
|
+
*/
|
|
98
|
+
padding?: SpaceStep;
|
|
99
|
+
/** The space between them, as a step on Newtone's spacing scale. */
|
|
100
|
+
gap?: SpaceStep;
|
|
101
|
+
/** Where they sit as a group -- one of the nine positions. */
|
|
102
|
+
align?: WrapperAlign;
|
|
103
|
+
/**
|
|
104
|
+
* How far the card sits above the scope behind it. Forwarded to the `Surface` this renders and
|
|
105
|
+
* read nowhere here; omitted, the card resolves whatever the surrounding scope resolves, which
|
|
106
|
+
* is what every card written before 2026-09-18 does. See the docblock for what asked.
|
|
107
|
+
*/
|
|
108
|
+
elevation?: Elevation;
|
|
109
|
+
/** The card's own class. It lands on the outer element, where a slot minimum belongs. */
|
|
110
|
+
className?: string;
|
|
111
|
+
children?: ReactNode;
|
|
112
|
+
}
|
|
113
|
+
export declare function CardBox({ direction, padding, gap, align, elevation, className, children, ...rest }: CardBoxProps): import("react").JSX.Element;
|
|
114
|
+
//# sourceMappingURL=card-box.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card-box.d.ts","sourceRoot":"","sources":["../../src/card-box/card-box.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAW,KAAK,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAC7D,OAAO,EAAW,KAAK,SAAS,EAAE,KAAK,YAAY,EAAE,KAAK,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AACvG,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsFG;AACH,MAAM,WAAW,YAAa,SAAQ,cAAc,CAAC,WAAW,CAAC;IAC7D,yCAAyC;IACzC,SAAS,CAAC,EAAE,gBAAgB,CAAA;IAC5B;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,CAAA;IACnB,oEAAoE;IACpE,GAAG,CAAC,EAAE,SAAS,CAAA;IACf,8DAA8D;IAC9D,KAAK,CAAC,EAAE,YAAY,CAAA;IACpB;;;;OAIG;IACH,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB,yFAAyF;IACzF,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,SAAS,CAAA;CACvB;AAED,wBAAgB,OAAO,CAAC,EACpB,SAAS,EACT,OAAW,EACX,GAAG,EACH,KAAK,EACL,SAAS,EACT,SAAS,EACT,QAAQ,EACR,GAAG,IAAI,EACV,EAAE,YAAY,+BAqBd"}
|