@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
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Joshua Allen
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# newtone_ui_react-web
|
|
2
|
+
|
|
3
|
+
Newtone's component library for React on the web.
|
|
4
|
+
|
|
5
|
+
> The authoritative description of this repo is
|
|
6
|
+
> `~/source/blueprints/newtone/repos/newtone_ui_react-web.md`, and the components here
|
|
7
|
+
> discharge `~/source/blueprints/newtone/contracts/`. If this README and those disagree,
|
|
8
|
+
> they win.
|
|
9
|
+
|
|
10
|
+
## What is here
|
|
11
|
+
|
|
12
|
+
Four components and a colour port. The first real screen —
|
|
13
|
+
[`joshuaallen_website`](../../joshuaallen/joshuaallen_website) — is what brought them into
|
|
14
|
+
existence.
|
|
15
|
+
|
|
16
|
+
| | |
|
|
17
|
+
| --- | --- |
|
|
18
|
+
| `Surface` | Owns the context its contents read: `theme`, `elevation`, `mode` |
|
|
19
|
+
| `Button` | Discharges `contracts/button.md`. Three variants, five states |
|
|
20
|
+
| `Text` | Discharges `contracts/typography.md`. `font`, `weight`, `case`, `figures`, `ligatures` |
|
|
21
|
+
| `Identity` | A scoped seed set: re-derives colour for one subtree |
|
|
22
|
+
| `color.ts` | A port of `contracts/color-derivation.md` — the runtime half of identity |
|
|
23
|
+
|
|
24
|
+
## The idea in one example
|
|
25
|
+
|
|
26
|
+
```tsx
|
|
27
|
+
import { Surface, Button } from '@newtone-dev/ui-react-web'
|
|
28
|
+
import '@newtone-dev/ui-tokens/newtone.css'
|
|
29
|
+
import '@newtone-dev/ui-react-web/button.css'
|
|
30
|
+
|
|
31
|
+
<Surface theme="emphasis">
|
|
32
|
+
<Button>Primary</Button>
|
|
33
|
+
</Surface>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
That Button becomes a light fill with a brand label, and **nothing was passed to it.**
|
|
37
|
+
|
|
38
|
+
**Components carry no facets.** No `theme`, `mode` or `elevation` prop on Button, ever. Its
|
|
39
|
+
tokens point at roles, and a role resolves against the Surface it is sitting on. A `theme`
|
|
40
|
+
prop would put the 24-way context product back onto every component, which is precisely
|
|
41
|
+
what the role layer exists to prevent.
|
|
42
|
+
|
|
43
|
+
## Scoped identity
|
|
44
|
+
|
|
45
|
+
```tsx
|
|
46
|
+
<Identity seeds={{ system: { accent: { h: 34.5, c: 0.78 } } }}>
|
|
47
|
+
{/* this subtree wears another brand over the site's own neutrals */}
|
|
48
|
+
</Identity>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
`seeds` is shaped like the tokens repo's `seed.json` — group, then palette, then a hue and
|
|
52
|
+
a saturation. **A seed is not a colour and has no lightness**, because lightness is a
|
|
53
|
+
property of the job a colour is doing, and the job is not known until a role asks for it.
|
|
54
|
+
`c` is a ratio from 0 to 1 of the most colourful thing reachable at that lightness and hue,
|
|
55
|
+
so `c: 1` is the gamut boundary rather than an error, and the same number means the same
|
|
56
|
+
request of a yellow as of a blue.
|
|
57
|
+
|
|
58
|
+
Only the core colour layer is identity-dependent, so this writes 51 custom properties per
|
|
59
|
+
palette named and nothing else. Everything below is references and follows on its own.
|
|
60
|
+
Palettes not named inherit from the enclosing scope, and nesting is free because that
|
|
61
|
+
inheritance is CSS's own.
|
|
62
|
+
|
|
63
|
+
The derivation is computed, not tabulated: fifty-one steps spaced evenly in CIE L*, with
|
|
64
|
+
chroma taken from the Display P3 ceiling. `src/color.ts` and the tokens repo's
|
|
65
|
+
`compute/` are two implementations of one contract and must produce the same bytes.
|
|
66
|
+
|
|
67
|
+
## No build
|
|
68
|
+
|
|
69
|
+
There is no bundler, no `tsconfig.json` and no `dist/`. The consumer compiles this source,
|
|
70
|
+
which is why the only real config is the alias in the app's `vite.config.ts`. Build config
|
|
71
|
+
gets written when publishing this repo is what hurts — not before.
|
|
72
|
+
|
|
73
|
+
## Consuming
|
|
74
|
+
|
|
75
|
+
By path reference, not a registry. Nothing is published to npm.
|
|
76
|
+
|
|
77
|
+
```ts
|
|
78
|
+
// vite.config.ts -- anchored regexes, because a bare string alias for the package
|
|
79
|
+
// would also swallow "@newtone-dev/ui-react-web/button.css".
|
|
80
|
+
alias: [
|
|
81
|
+
{ find: /^@newtone\/ui-react-web$/, replacement: '<path>/newtone_ui_react-web/src/index.ts' },
|
|
82
|
+
]
|
|
83
|
+
```
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
/* The disclosure list's sheet: the rules between rows, the summary's two columns, the marker and
|
|
2
|
+
* the open transition. Every colour is read from a Newtone role; none is declared. See the repo
|
|
3
|
+
* blueprint, sections 4.1.7 and 4.2.
|
|
4
|
+
*
|
|
5
|
+
* ---- the rules, and the give-way in them ---------------------------------
|
|
6
|
+
*
|
|
7
|
+
* Each row carries a line above it and the last one closes the list, which is how six rows get
|
|
8
|
+
* seven rules out of six elements. `1px` is written literally for issue 023's reason: 26 hairlines
|
|
9
|
+
* across five repos with no second width anywhere, so a hairline is 1px and a token waits for a
|
|
10
|
+
* second width to exist.
|
|
11
|
+
*
|
|
12
|
+
* **The colour is where this gives way.** The live page rules with `--neutral-100`, `#EEEEEE` -- a
|
|
13
|
+
* line you register rather than read. Newtone has one role for a dividing line and it resolves to
|
|
14
|
+
* `#B0B0B1`, a mid grey, so a faint stack becomes a ruled table. **card-box.css has been painting
|
|
15
|
+
* its ring from that same role since the first cards shipped**, so this is one absence with two
|
|
16
|
+
* writers rather than a new one, and the consuming site's own knowledge entry now
|
|
17
|
+
* carries it with both values. The alternative -- a surface role, which is nearer the right colour
|
|
18
|
+
* -- would be painting a line from a vocabulary about grounds, and the day the roles are retuned
|
|
19
|
+
* the line would move with the wrong thing.
|
|
20
|
+
*
|
|
21
|
+
* ---- the four properties, and the one thing they are NOT ------------------
|
|
22
|
+
*
|
|
23
|
+
* **This sheet grew on 2026-09-06 and it did not gain a size scale.** The second call site --
|
|
24
|
+
* the other -- a numbered column of five steps -- wants a looser rhythm and a lane for the
|
|
25
|
+
* ordinals, and the served `Accordion-module` says in four custom properties exactly what the
|
|
26
|
+
* difference between the two rhythms is: **8 -> 16 of row padding, 4 -> 8 open, a 32px track, and
|
|
27
|
+
* a 40 indent that is the track plus the gutter.** Nothing else moves. `key-pad` and `key-radius`
|
|
28
|
+
* are the same at both, so the marker's rule below is still written literally and the chevron is
|
|
29
|
+
* 48 x 48 at radius 12 at both call sites.
|
|
30
|
+
*
|
|
31
|
+
* **There is no `size` prop and the lane is derived from the content**, which is the blueprint's
|
|
32
|
+
* 4.1.14, answer C: `lg` and the lane co-occur two call sites out of two, so a scale would be a
|
|
33
|
+
* second name for something `items` already says. The argument that lost is written down there
|
|
34
|
+
* rather than deleted -- the rhythm really does follow what HOLDS the list rather than whether the
|
|
35
|
+
* rows are numbered, and the two are only accidentally aligned here. **Trigger:** a call site wants
|
|
36
|
+
* a lane at the tight rhythm, or the loose rhythm without a lane.
|
|
37
|
+
*
|
|
38
|
+
* **What that buys is `structure`'s list rendering byte for byte what it rendered before, by
|
|
39
|
+
* construction rather than by care.** With no `leading` anywhere in `items` the lane class is
|
|
40
|
+
* absent and every property resolves to the value this sheet already declared. It was checked in a
|
|
41
|
+
* browser all the same -- governance/evidence/verify-what-renders-not-what-was-written.md, and the seven
|
|
42
|
+
* numbers are in the blueprint's 4.1.14.
|
|
43
|
+
*
|
|
44
|
+
* **One declaration in the reference's block is deliberately not taken.** `.description` there
|
|
45
|
+
* carries `margin-inline-end: var(--newtone-accordion-gutter)`, 8px of right inset. Ours has never had it,
|
|
46
|
+
* it is neither the lane nor the rhythm, and adding it would move the one paragraph this growth was
|
|
47
|
+
* not allowed to move. The cap below reaches first anyway.
|
|
48
|
+
*
|
|
49
|
+
* ---- the summary is two columns, or three when there is a lane ------------
|
|
50
|
+
*
|
|
51
|
+
* `minmax(0, 1fr) auto`. The `0` minimum is what lets a long title wrap instead of pushing the
|
|
52
|
+
* marker off the row. The trailing cell holds the caller's slot AND the marker together, because a
|
|
53
|
+
* track per detail hands the grid an empty column and its gutter on every row that has none.
|
|
54
|
+
*
|
|
55
|
+
* **The lane is the one case where a track per detail is right**, and it is right for the reason
|
|
56
|
+
* the empty one is wrong: every row gets the cell whether or not it has anything in it, because a
|
|
57
|
+
* numbered row and an unnumbered one would otherwise start their titles in different columns. So
|
|
58
|
+
* the emptiness is the point rather than the cost.
|
|
59
|
+
*
|
|
60
|
+
* `cursor: pointer` is the affordance; there is no `list-style: none` here because `display: grid`
|
|
61
|
+
* replaces `list-item` and takes the browser's own disclosure triangle with it.
|
|
62
|
+
*
|
|
63
|
+
* **The open row tightens its bottom padding** rather than keeping the closed rhythm, so the
|
|
64
|
+
* disclosed paragraph reads as belonging to the title above it rather than floating between two
|
|
65
|
+
* rows.
|
|
66
|
+
*
|
|
67
|
+
* ---- the marker is a control's shape and not a control -------------------
|
|
68
|
+
*
|
|
69
|
+
* accordion.tsx has the argument: the `<summary>` is the pressable, so a button in here would be
|
|
70
|
+
* two tab stops for one action. What is left is the LOOK of one, driven from the row: a corner, a
|
|
71
|
+
* padding, and a ground that arrives on hover.
|
|
72
|
+
*
|
|
73
|
+
* **The live page gives it two grounds, one for hover and a darker one for press.** There is no
|
|
74
|
+
* third neutral ground in Newtone's role list, so both states take the one there is and the press
|
|
75
|
+
* reads as a hover that has not changed. That is a small thing and it is the sort of small thing
|
|
76
|
+
* this sheet is supposed to say out loud.
|
|
77
|
+
*
|
|
78
|
+
* The corner is `radius-md`, which is the corner give-way again -- the live page's 12px lands on
|
|
79
|
+
* Newtone's 8px, the same collapse the cards already record, and it does not get a new entry.
|
|
80
|
+
*
|
|
81
|
+
* ---- the open transition -------------------------------------------------
|
|
82
|
+
*
|
|
83
|
+
* `interpolate-size: allow-keywords` is what makes `block-size` animatable to `auto`, and
|
|
84
|
+
* `::details-content` is the box that grows. `overflow: clip` keeps the paragraph from painting
|
|
85
|
+
* outside the row while it is still short. `content-visibility` transitions `allow-discrete` so the
|
|
86
|
+
* content is not hidden the instant the row starts closing.
|
|
87
|
+
*
|
|
88
|
+
* **Both transitions are switched off under `prefers-reduced-motion`**, which is not decoration:
|
|
89
|
+
* the marker's rotation and the row's growth are the two things on this page that move.
|
|
90
|
+
*
|
|
91
|
+
* ---- the disclosed paragraph --------------------------------------------
|
|
92
|
+
*
|
|
93
|
+
* `40rem` is 640px, the live page's `--container-xs` resolved. It is a block's CAP rather than a
|
|
94
|
+
* slot's minimum, which makes it the second of that kind in this repo after master-page.css's
|
|
95
|
+
* reading measure, and **the sixth block width written here by hand** --
|
|
96
|
+
* issues/done/030-the-block-width-family.md counts them. */
|
|
97
|
+
|
|
98
|
+
.newtone-accordion {
|
|
99
|
+
/* The rhythm, as four properties, because the second call site moves four numbers and nothing
|
|
100
|
+
else. See the block above. */
|
|
101
|
+
/* Three locals, and they are locals because a VARIANT changes them -- a token is one value and
|
|
102
|
+
`.newtone-accordion-with-lane` needs a second. Everything invariant is read straight from this
|
|
103
|
+
component's own group instead. */
|
|
104
|
+
--newtone-accordion-indent: 0;
|
|
105
|
+
--newtone-accordion-pad: var(--newtone-accordion-row-pad);
|
|
106
|
+
--newtone-accordion-pad-open: var(--newtone-accordion-row-pad-open);
|
|
107
|
+
interpolate-size: allow-keywords;
|
|
108
|
+
width: 100%;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/* The lane, and the rhythm that comes with it. **One class carries both** -- accordion.tsx derives
|
|
112
|
+
it from the content and there is no size prop; the blueprint's 4.1.14, answer C, has why, and the
|
|
113
|
+
trigger for a real scale is written there.
|
|
114
|
+
|
|
115
|
+
The indent is what makes the disclosed paragraph land under the TITLE and never under the number,
|
|
116
|
+
and it is the lane plus the gutter rather than a fifth number, so a lane that changed width would
|
|
117
|
+
take the paragraph with it. */
|
|
118
|
+
.newtone-accordion-with-lane {
|
|
119
|
+
--newtone-accordion-indent: calc(
|
|
120
|
+
var(--newtone-accordion-lane) + var(--newtone-accordion-gutter)
|
|
121
|
+
);
|
|
122
|
+
--newtone-accordion-pad: var(--newtone-accordion-row-pad-lane);
|
|
123
|
+
--newtone-accordion-pad-open: var(--newtone-accordion-row-pad-open-lane);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/* The lane's cell. `min-width: 0` for the summary's own reason one rule down: a track that refuses
|
|
127
|
+
to shrink pushes the row out. It is rendered on every row once any row has a `leading`, empty or
|
|
128
|
+
not, so the titles all start in the same column. */
|
|
129
|
+
.newtone-accordion-leading {
|
|
130
|
+
display: flex;
|
|
131
|
+
align-items: center;
|
|
132
|
+
min-width: 0;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.newtone-accordion-row {
|
|
136
|
+
border-block-start: 1px solid var(--newtone-accordion-divider);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.newtone-accordion-row:last-child {
|
|
140
|
+
border-block-end: 1px solid var(--newtone-accordion-divider);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.newtone-accordion-summary {
|
|
144
|
+
display: grid;
|
|
145
|
+
grid-template-columns: minmax(0, 1fr) auto;
|
|
146
|
+
align-items: center;
|
|
147
|
+
column-gap: var(--newtone-accordion-gutter);
|
|
148
|
+
padding-block: var(--newtone-accordion-pad);
|
|
149
|
+
cursor: pointer;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.newtone-accordion-with-lane .newtone-accordion-summary {
|
|
153
|
+
grid-template-columns: var(--newtone-accordion-lane) minmax(0, 1fr) auto;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.newtone-accordion-row[open] .newtone-accordion-summary {
|
|
157
|
+
padding-block-end: var(--newtone-accordion-pad-open);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/* :focus-visible, not :focus, so a mouse click does not leave a ring behind --
|
|
161
|
+
* governance/code/focus-is-not-optional.md, and `2px solid` at an offset is the expression Newtone's own
|
|
162
|
+
* link, button and navbar all use. **The offset is INWARD here where theirs is outward**, because
|
|
163
|
+
* the row runs the full width of the card it sits in and a ring outside it would be clipped by the
|
|
164
|
+
* card's own edge. This is the first thing in this repo a keyboard can reach. */
|
|
165
|
+
.newtone-accordion-summary:focus-visible {
|
|
166
|
+
outline: 2px solid;
|
|
167
|
+
outline-offset: -2px;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.newtone-accordion-trailing {
|
|
171
|
+
display: flex;
|
|
172
|
+
align-items: center;
|
|
173
|
+
column-gap: var(--newtone-accordion-trailing-gap);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/* The marker is the BUTTON: a padded, rounded box that paints a ground on the row's hover. It does
|
|
177
|
+
* NOT rotate -- see the rule below the hover one. */
|
|
178
|
+
.newtone-accordion-marker {
|
|
179
|
+
display: flex;
|
|
180
|
+
padding: var(--newtone-accordion-marker-padding);
|
|
181
|
+
border-radius: var(--newtone-accordion-marker-radius);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.newtone-accordion-summary:hover .newtone-accordion-marker {
|
|
185
|
+
background: var(--newtone-accordion-marker-hover);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/* THE GLYPH ROTATES AND THE BUTTON AROUND IT DOES NOT, 2026-09-14. Joshua: "the whole button should
|
|
189
|
+
* not rotate, but instead, only the icon."
|
|
190
|
+
*
|
|
191
|
+
* BOTH DECLARATIONS WERE ON `.newtone-accordion-marker` AND THAT ELEMENT IS THE BUTTON -- 48x48,
|
|
192
|
+
* padded, `radius-md` at 8px, and painting a ground on the row's hover. IT SURVIVED REVIEW BECAUSE
|
|
193
|
+
* THE ROTATION IS A NO-OP AT BOTH ENDS: 180 degrees maps a rounded square onto itself, so the closed
|
|
194
|
+
* and open frames are identical. THE 0.15s BETWEEN THEM IS NOT -- at 45 and 135 degrees the box is a
|
|
195
|
+
* DIAMOND -- and the hover ground is what puts it on screen, because a mouse user is always hovering
|
|
196
|
+
* the row they just clicked.
|
|
197
|
+
*
|
|
198
|
+
* `> *` AND NOT `.newtone-icon`. accordion.tsx says the marker is a wrapper because *the rotation and
|
|
199
|
+
* the pressed ground belong to this component and `Icon`'s own class is not this file's to write
|
|
200
|
+
* rules against*, and that second clause is still binding. THE CHILD IS ADDRESSED AS A SLOT RATHER
|
|
201
|
+
* THAN BY WHAT IS IN IT: a caller who one day puts a different glyph there gets the rotation, and
|
|
202
|
+
* this file still writes no rule against another component's class.
|
|
203
|
+
*
|
|
204
|
+
* THE TRANSITION MOVED WITH THE TRANSFORM. Leaving it on the marker would animate a property that
|
|
205
|
+
* element no longer sets -- a declaration whose subject has gone, which is the shape this house
|
|
206
|
+
* keeps meeting. Blueprint components/accordion.md carries the pass. */
|
|
207
|
+
.newtone-accordion-marker > * {
|
|
208
|
+
transition: transform 0.15s ease-out;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.newtone-accordion-row[open] .newtone-accordion-marker > * {
|
|
212
|
+
transform: rotate(180deg);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.newtone-accordion-row::details-content {
|
|
216
|
+
block-size: 0;
|
|
217
|
+
overflow: clip;
|
|
218
|
+
transition:
|
|
219
|
+
block-size 0.15s ease-out,
|
|
220
|
+
content-visibility 0.15s ease-out allow-discrete;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.newtone-accordion-row[open]::details-content {
|
|
224
|
+
block-size: auto;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.newtone-accordion-description {
|
|
228
|
+
max-width: 40rem;
|
|
229
|
+
margin-inline-start: var(--newtone-accordion-indent);
|
|
230
|
+
padding-block-end: var(--newtone-accordion-pad);
|
|
231
|
+
color: var(--newtone-accordion-description);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
@media (prefers-reduced-motion: reduce) {
|
|
235
|
+
.newtone-accordion-marker,
|
|
236
|
+
.newtone-accordion-row::details-content {
|
|
237
|
+
transition: none;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* A list of rows that open one at a time, each disclosing a paragraph.
|
|
4
|
+
*
|
|
5
|
+
* ---- it is `<details>`, and that is the point rather than a detail --------
|
|
6
|
+
*
|
|
7
|
+
* A native `<details name>` per row. The toggle, the keyboard handling, the announced expanded
|
|
8
|
+
* state, find-in-page reaching a closed answer and the whole thing working with JavaScript off all
|
|
9
|
+
* come free and correct, and **there is no `open` flag that can fall out of step with what the
|
|
10
|
+
* reader can see**.
|
|
11
|
+
*
|
|
12
|
+
* **This repo has no client components and this must not be the first one** -- see the repo
|
|
13
|
+
* blueprint, section 4.3. Exclusivity is `name`, the platform's own accordion grouping, so one row
|
|
14
|
+
* at a time with no state anywhere; a browser without it degrades to independent disclosures rather
|
|
15
|
+
* than breaking.
|
|
16
|
+
*
|
|
17
|
+
* ---- the group's name is a prop, and the counting rule does not decide it --
|
|
18
|
+
*
|
|
19
|
+
* The reference reaches for `useId()`. A hook is not available in a server component, so the
|
|
20
|
+
* candidates were a required prop or a constant in this file -- and
|
|
21
|
+
* `governance/evidence/size-an-api-from-call-sites-not-from-the-type.md` counts one call site, which would
|
|
22
|
+
* ordinarily say constant.
|
|
23
|
+
*
|
|
24
|
+
* **A name is not a value, it is an identity.** A constant means two accordions on one page close
|
|
25
|
+
* each other's rows: no error, no type failure, and no tell beyond the wrong row shutting. So it is
|
|
26
|
+
* a required prop and the one call site types a string.
|
|
27
|
+
*
|
|
28
|
+
* ---- the trailing slot, and why it is named for its position -------------
|
|
29
|
+
*
|
|
30
|
+
* `trailing` takes a node and the caller composes what goes in it. **That is what keeps this
|
|
31
|
+
* component out of its consumer's business** -- a pill saying `Core` is the page's fact, not the
|
|
32
|
+
* list's -- and it is the same arrangement feature-card's `media` already uses here.
|
|
33
|
+
*
|
|
34
|
+
* Naming it for its position rather than its content is the right way round for once: `media` is a
|
|
35
|
+
* kind of content, and this is a place. Calling it `tag` would be this file learning what a core
|
|
36
|
+
* module is.
|
|
37
|
+
*
|
|
38
|
+
* **It is one grid cell holding the slot and the marker, not two tracks.** A track per detail hands
|
|
39
|
+
* the grid an empty column and its gutter on every row that has none.
|
|
40
|
+
*
|
|
41
|
+
* ---- and `leading`, which is the same shape at the opposite end -----------
|
|
42
|
+
*
|
|
43
|
+
* Added 2026-09-06 for a numbered column of five steps. **The caller composes it**, for
|
|
44
|
+
* `trailing`'s reason exactly: a two-digit ordinal is the page's fact about a sequence, not the
|
|
45
|
+
* list's fact about itself. **What this file must not learn is that a step has a number** -- an
|
|
46
|
+
* `ordinals` boolean, or an `index` it formatted, would be this component learning that one of its
|
|
47
|
+
* two call sites is a walkthrough. See the blueprint, section 4.1.14.
|
|
48
|
+
*
|
|
49
|
+
* **The lane is derived and never passed.** `withLane` is `items.some(i => i.leading !== undefined)`
|
|
50
|
+
* and there is no prop for it, because a lane a caller could set independently of the content is a
|
|
51
|
+
* lane that can be switched on with nothing in it -- and, worse, off with something in it. The
|
|
52
|
+
* reference derives it the same way and gives the same reason.
|
|
53
|
+
*
|
|
54
|
+
* **It drives the rhythm too, and that is the decision rather than a side effect.** There is no
|
|
55
|
+
* `size` prop: the numbered column wants the looser rhythm and the lane, the other caller wants
|
|
56
|
+
* neither, and two
|
|
57
|
+
* call sites out of two is what this repo sizes an API from --
|
|
58
|
+
* governance/evidence/size-an-api-from-call-sites-not-from-the-type.md. accordion.css carries the numbers and
|
|
59
|
+
* the trigger for the day the two come apart.
|
|
60
|
+
*
|
|
61
|
+
* **Once any row has a `leading`, every row renders the cell**, empty or not, so all five titles
|
|
62
|
+
* start in the same column. That is the whole reason the derivation is worth copying.
|
|
63
|
+
*
|
|
64
|
+
* ---- the chevron is drawn as a control and is not one ---------------------
|
|
65
|
+
*
|
|
66
|
+
* The row is the pressable -- a native `<summary>` -- and a `<button>` inside it would be nested
|
|
67
|
+
* interactive content: two tab stops and two announced controls for one action. So the marker is a
|
|
68
|
+
* plain element whose states are driven from the row's own `:hover`, in accordion.css.
|
|
69
|
+
*
|
|
70
|
+
* ---- the title is an h3, stated rather than passed ------------------------
|
|
71
|
+
*
|
|
72
|
+
* stat-card's and feature-card's reason: a heading level is a fact about where the thing sits in
|
|
73
|
+
* the document outline, the band's own head is the `h2`, and a module row's depth on this template
|
|
74
|
+
* does not vary.
|
|
75
|
+
*
|
|
76
|
+
* ---- no Markdown ---------------------------------------------------------
|
|
77
|
+
*
|
|
78
|
+
* The reference runs its full rich-text engine on every disclosed paragraph. Six paragraphs of
|
|
79
|
+
* plain prose is not that, and a Markdown dependency would be
|
|
80
|
+
* `governance/code/minimize-third-party-dependence.md` bought for nothing. **Trigger:** a description
|
|
81
|
+
* needs a list or a link.
|
|
82
|
+
*/
|
|
83
|
+
export interface AccordionItem {
|
|
84
|
+
/** The row, closed. An `h3` -- see above. */
|
|
85
|
+
title: string;
|
|
86
|
+
/** The paragraph it discloses. A string, deliberately: no markup, no Markdown. */
|
|
87
|
+
description: string;
|
|
88
|
+
/** What sits beside the title on the closed row, before the marker. Composed at the call site. */
|
|
89
|
+
trailing?: ReactNode;
|
|
90
|
+
/**
|
|
91
|
+
* What sits before the title, in the lane. Composed at the call site -- an ordinal is the page's
|
|
92
|
+
* fact, not this list's. **One row carrying it gives every row the cell**, and it is what
|
|
93
|
+
* switches the list to the looser rhythm: see above.
|
|
94
|
+
*/
|
|
95
|
+
leading?: ReactNode;
|
|
96
|
+
}
|
|
97
|
+
export interface AccordionProps extends HTMLAttributes<HTMLElement> {
|
|
98
|
+
/**
|
|
99
|
+
* The group these rows belong to -- the value of every row's `name`, which is what makes them
|
|
100
|
+
* exclusive. Required, and not a constant: see above.
|
|
101
|
+
*/
|
|
102
|
+
name: string;
|
|
103
|
+
items: readonly AccordionItem[];
|
|
104
|
+
}
|
|
105
|
+
export declare function Accordion({ name, items, className, ...rest }: AccordionProps): import("react").JSX.Element;
|
|
106
|
+
//# sourceMappingURL=accordion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accordion.d.ts","sourceRoot":"","sources":["../../src/accordion/accordion.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgFG;AAEH,MAAM,WAAW,aAAa;IAC1B,6CAA6C;IAC7C,KAAK,EAAE,MAAM,CAAA;IACb,kFAAkF;IAClF,WAAW,EAAE,MAAM,CAAA;IACnB,kGAAkG;IAClG,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB;;;;OAIG;IACH,OAAO,CAAC,EAAE,SAAS,CAAA;CACtB;AAED,MAAM,WAAW,cAAe,SAAQ,cAAc,CAAC,WAAW,CAAC;IAC/D;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,SAAS,aAAa,EAAE,CAAA;CAClC;AAED,wBAAgB,SAAS,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,EAAE,cAAc,+BAwC5E"}
|
|
@@ -0,0 +1,15 @@
|
|
|
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 { Icon } from '../icon/index.js';
|
|
6
|
+
export function Accordion({ name, items, className, ...rest }) {
|
|
7
|
+
const withLane = items.some((item) => item.leading !== undefined);
|
|
8
|
+
return (_jsx("div", { className: [
|
|
9
|
+
withLane ? 'newtone-accordion newtone-accordion-with-lane' : 'newtone-accordion',
|
|
10
|
+
className,
|
|
11
|
+
]
|
|
12
|
+
.filter(Boolean)
|
|
13
|
+
.join(' '), ...rest, children: items.map(({ title, description, trailing, leading }) => (_jsxs("details", { name: name, className: "newtone-accordion-row", children: [_jsxs("summary", { className: "newtone-accordion-summary", children: [withLane ? (_jsx("span", { className: "newtone-accordion-leading", children: leading })) : null, _jsx(Text, { as: "h3", scale: "heading-sm", children: title }), _jsxs("span", { className: "newtone-accordion-trailing", children: [trailing, _jsx("span", { className: "newtone-accordion-marker", children: _jsx(Icon, { name: "expand_more" }) })] })] }), _jsx("div", { className: "newtone-accordion-description", children: _jsx(Text, { scale: "body", children: description }) })] }, title))) }));
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=accordion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accordion.js","sourceRoot":"","sources":["../../src/accordion/accordion.tsx"],"names":[],"mappings":";AAAA,uGAAuG;AACvG,qEAAqE;AACrE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAEvC,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AA4GvC,MAAM,UAAU,SAAS,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,IAAI,EAAkB;IACzE,MAAM,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,KAAK,SAAS,CAAC,CAAA;IACjE,OAAO,CACH,cACI,SAAS,EAAE;YACP,QAAQ,CAAC,CAAC,CAAC,+CAA+C,CAAC,CAAC,CAAC,mBAAmB;YAChF,SAAS;SACZ;aACI,MAAM,CAAC,OAAO,CAAC;aACf,IAAI,CAAC,GAAG,CAAC,KACV,IAAI,YAEP,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CACtD,mBAAqB,IAAI,EAAE,IAAI,EAAE,SAAS,EAAC,uBAAuB,aAC9D,mBAAS,SAAS,EAAC,2BAA2B,aAGzC,QAAQ,CAAC,CAAC,CAAC,CACR,eAAM,SAAS,EAAC,2BAA2B,YAAE,OAAO,GAAQ,CAC/D,CAAC,CAAC,CAAC,IAAI,EACR,KAAC,IAAI,IAAC,EAAE,EAAC,IAAI,EAAC,KAAK,EAAC,YAAY,YAC3B,KAAK,GACH,EACP,gBAAM,SAAS,EAAC,4BAA4B,aACvC,QAAQ,EAIT,eAAM,SAAS,EAAC,0BAA0B,YACtC,KAAC,IAAI,IAAC,IAAI,EAAC,aAAa,GAAG,GACxB,IACJ,IACD,EACV,cAAK,SAAS,EAAC,+BAA+B,YAC1C,KAAC,IAAI,IAAC,KAAK,EAAC,MAAM,YAAE,WAAW,GAAQ,GACrC,KAtBI,KAAK,CAuBT,CACb,CAAC,GACA,CACT,CAAA;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/accordion/index.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/accordion/index.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/* Action -- the one thing a page is asking for. See the repo blueprint, section 3, and
|
|
2
|
+
* blueprints/newtone/repos/newtone_ui_react-web/components/action.md.
|
|
3
|
+
*
|
|
4
|
+
* ---- the corner is a literal and it is not a missing radius step ----------
|
|
5
|
+
*
|
|
6
|
+
* `--newtone-action-radius` resolves to `999px`, stated in `action.json` rather than pointing at
|
|
7
|
+
* `radius.sm` or `radius.md`. **A pill is an infinity, not a length somebody chose**, so there is
|
|
8
|
+
* nothing for a step to stand in for and nothing a retune of the radius scale should move here.
|
|
9
|
+
* `icon-link.json` writes the same literal for the same reason, and `newtone_ui_tokens.md` section
|
|
10
|
+
* 3 carries the argument and the trigger that would make it a real third step.
|
|
11
|
+
*
|
|
12
|
+
* ---- one variant, so one block of state rules -----------------------------
|
|
13
|
+
*
|
|
14
|
+
* There is no `--primary` / `--secondary` split because there is no hierarchy to express. That is
|
|
15
|
+
* the component's whole subject, and it is why this sheet is a third the length of `button.css`.
|
|
16
|
+
*
|
|
17
|
+
* ---- no transition, same as everything else here -------------------------
|
|
18
|
+
*
|
|
19
|
+
* Newtone has no motion vocabulary. The reference's states are animated; these are instant.
|
|
20
|
+
*
|
|
21
|
+
* ---- with a trailing glyph the GLYPH side shrinks, and the word's holds --
|
|
22
|
+
*
|
|
23
|
+
* The rule is `control.css`'s and the sentence is the same one: a word needs one gap more clearance
|
|
24
|
+
* than a glyph, because a glyph carries bearing inside its own box and a word does not.
|
|
25
|
+
* governance/code/an-icon-and-the-text-beside-it-do-not-take-the-same-padding.md.
|
|
26
|
+
*
|
|
27
|
+
* **What differs is which of the two sides moves, and it is not a preference.** The inline padding
|
|
28
|
+
* `--newtone-action-padding-x` was set on 2026-09-16 for a pill holding nothing but a label, and every Action
|
|
29
|
+
* rendered to date is that pill -- so 24 is the WORD's correct inset, it is the number that must not
|
|
30
|
+
* move, and a trailing glyph's side comes down to 16. Growing the word's side to 32 would satisfy
|
|
31
|
+
* the same difference by pushing the one edge that was already right. `control.css` anchors the
|
|
32
|
+
* opposite side because ITS padding is the square's. Same rule, two anchors, and each one states
|
|
33
|
+
* which of its numbers was chosen for which content.
|
|
34
|
+
*
|
|
35
|
+
* **And that is why this is a padding and not `control.css`'s margin.** A margin can add clearance
|
|
36
|
+
* and cannot take it away, and here the side that moves is the one that gets smaller. The other
|
|
37
|
+
* reason that sheet has for using a margin -- a consumer that hides the word and needs the asymmetry
|
|
38
|
+
* to vanish with it -- does not exist here: an Action's label is always rendered. */
|
|
39
|
+
|
|
40
|
+
.newtone-action {
|
|
41
|
+
display: inline-flex;
|
|
42
|
+
align-items: center;
|
|
43
|
+
justify-content: center;
|
|
44
|
+
gap: var(--newtone-action-gap);
|
|
45
|
+
padding: var(--newtone-action-padding-y) var(--newtone-action-padding-x);
|
|
46
|
+
font-family: var(--newtone-action-label-family);
|
|
47
|
+
font-size: var(--newtone-action-label-size);
|
|
48
|
+
font-weight: var(--newtone-action-label-weight);
|
|
49
|
+
line-height: var(--newtone-action-label-line-height);
|
|
50
|
+
border: 1px solid;
|
|
51
|
+
border-radius: var(--newtone-action-radius);
|
|
52
|
+
cursor: pointer;
|
|
53
|
+
text-decoration: none;
|
|
54
|
+
text-align: center;
|
|
55
|
+
background: var(--newtone-action-rest-fill);
|
|
56
|
+
color: var(--newtone-action-rest-text);
|
|
57
|
+
border-color: var(--newtone-action-rest-border);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.newtone-action:hover {
|
|
61
|
+
background: var(--newtone-action-hover-fill);
|
|
62
|
+
color: var(--newtone-action-hover-text);
|
|
63
|
+
border-color: var(--newtone-action-hover-border);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.newtone-action:active {
|
|
67
|
+
background: var(--newtone-action-pressed-fill);
|
|
68
|
+
color: var(--newtone-action-pressed-text);
|
|
69
|
+
border-color: var(--newtone-action-pressed-border);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.newtone-action:focus-visible {
|
|
73
|
+
outline: 2px solid var(--newtone-action-focus-ring);
|
|
74
|
+
outline-offset: 2px;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/* One class, so it publishes at the same 0,1,0 as everything else here, and it touches a property
|
|
78
|
+
* `--fill` does not -- the two compose in either order. */
|
|
79
|
+
.newtone-action--icon-end {
|
|
80
|
+
padding-inline-end: calc(var(--newtone-action-padding-x) - var(--newtone-action-gap));
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.newtone-action--fill {
|
|
84
|
+
display: flex;
|
|
85
|
+
inline-size: 100%;
|
|
86
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { AnchorHTMLAttributes, ButtonHTMLAttributes } from 'react';
|
|
2
|
+
interface ActionCommon {
|
|
3
|
+
/** The action's words. Required and always rendered -- an action is a specific, named ask. */
|
|
4
|
+
label: string;
|
|
5
|
+
/** Overrides the accessible name where the visible words are not the whole of it. */
|
|
6
|
+
ariaLabel?: string;
|
|
7
|
+
/**
|
|
8
|
+
* A trailing glyph. There is no leading slot: a glyph here points ONWARD, at the thing the
|
|
9
|
+
* action leads to, and a label that always starts in the same place is easier to find.
|
|
10
|
+
*
|
|
11
|
+
* **Its presence also takes one gap off the padding on its own side** -- 24 becomes 16, while
|
|
12
|
+
* the label's 24 holds, because a word needs more clearance from a rim than a glyph does. See
|
|
13
|
+
* `action.css` and governance/code/an-icon-and-the-text-beside-it-do-not-take-the-same-padding.md.
|
|
14
|
+
*/
|
|
15
|
+
iconEnd?: string;
|
|
16
|
+
/** Stretch to the container's inline size -- a phone's call to action, a card's footer. */
|
|
17
|
+
fill?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export type ActionProps = ActionCommon & ((Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'aria-label'> & {
|
|
20
|
+
href?: undefined;
|
|
21
|
+
}) | (Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'children' | 'href' | 'aria-label'> & {
|
|
22
|
+
/** Where it goes. Its presence turns the rendered element into an `<a>`. */
|
|
23
|
+
href: string;
|
|
24
|
+
}));
|
|
25
|
+
/**
|
|
26
|
+
* The one thing a page is asking for.
|
|
27
|
+
*
|
|
28
|
+
* ---- it has no `variant`, and that absence IS the component ---------------
|
|
29
|
+
*
|
|
30
|
+
* A `Button` offers three tiers because a page has many buttons and they need an order. This offers
|
|
31
|
+
* none, because **a second action would mean neither is the action**. Where a page genuinely needs a
|
|
32
|
+
* quieter companion beside it, that companion is an ordinary `Button` -- which is what
|
|
33
|
+
* `adenario_website`'s hero does with its two doors, the first call site this ever had.
|
|
34
|
+
*
|
|
35
|
+
* ---- what makes it reserved is shape, not hue -----------------------------
|
|
36
|
+
*
|
|
37
|
+
* **Ported 2026-09-16 from `~/Projects/Harbour Space/-harbour-space-design-system`, where it is
|
|
38
|
+
* `Task` and paints from a `success` ramp** -- green, deliberately a colour no ordinary button there
|
|
39
|
+
* uses. That did not survive the crossing, and the reason is a rule rather than a preference:
|
|
40
|
+
* Newtone's `success` is a ROLE, `contracts/roles.md` section 3 forbids a component borrowing a
|
|
41
|
+
* role's answer for its own ink over its own fill, and a control that has not been pressed yet has
|
|
42
|
+
* no outcome to report. So this paints from `accent` like a primary `Button`, and what separates it
|
|
43
|
+
* is that it is a pill, larger, and that there is one of it.
|
|
44
|
+
*
|
|
45
|
+
* ---- it is NOT a Button at a second size ---------------------------------
|
|
46
|
+
*
|
|
47
|
+
* `contracts/button.md` defers a size axis and this does not discharge it. A size prop is a caller
|
|
48
|
+
* choosing emphasis among many controls; this is a different component with one tier. The repo
|
|
49
|
+
* blueprint's section 8 carries the row, because *the size already exists, it is just called
|
|
50
|
+
* Action* is the cheap misreading available from here.
|
|
51
|
+
*
|
|
52
|
+
* ---- no `disabled`, deliberately ------------------------------------------
|
|
53
|
+
*
|
|
54
|
+
* An action is the single thing a page is asking for. If the ask is unavailable, do not render it,
|
|
55
|
+
* rather than rendering the page's loudest element as an inert no -- a conditionally available ask
|
|
56
|
+
* is a `Button`. Without an `href` this renders a `<button>` that carries no handler and therefore
|
|
57
|
+
* does nothing, which is an honest placeholder and not a form control: `type="button"` is
|
|
58
|
+
* hardcoded, so it cannot submit a form it happens to be standing in.
|
|
59
|
+
*/
|
|
60
|
+
export declare function Action({ label, ariaLabel, iconEnd, fill, className, ...rest }: ActionProps): import("react").JSX.Element;
|
|
61
|
+
export {};
|
|
62
|
+
//# sourceMappingURL=action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../src/action/action.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAA;AAGvE,UAAU,YAAY;IAClB,8FAA8F;IAC9F,KAAK,EAAE,MAAM,CAAA;IACb,qFAAqF;IACrF,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,2FAA2F;IAC3F,IAAI,CAAC,EAAE,OAAO,CAAA;CACjB;AAED,MAAM,MAAM,WAAW,GAAG,YAAY,GAClC,CACM,CAAC,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,UAAU,GAAG,YAAY,CAAC,GAAG;IACxE,IAAI,CAAC,EAAE,SAAS,CAAA;CACnB,CAAC,GACF,CAAC,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,YAAY,CAAC,GAAG;IACjF,4EAA4E;IAC5E,IAAI,EAAE,MAAM,CAAA;CACf,CAAC,CACP,CAAA;AAEL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,MAAM,CAAC,EACnB,KAAK,EACL,SAAS,EACT,OAAO,EACP,IAAY,EACZ,SAAS,EACT,GAAG,IAAI,EACV,EAAE,WAAW,+BA4Cb"}
|