@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 @@
|
|
|
1
|
+
{"version":3,"file":"navbar.d.ts","sourceRoot":"","sources":["../../src/navbar/navbar.tsx"],"names":[],"mappings":"AAAA,OAAO,EAMH,KAAK,cAAc,EACnB,KAAK,SAAS,EACjB,MAAM,OAAO,CAAA;AAEd,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAM/D;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,MAAM,WAAW,WAAY,SAAQ,cAAc,CAAC,WAAW,CAAC;IAC5D,2EAA2E;IAC3E,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACtC,QAAQ,CAAC,EAAE,SAAS,CAAA;CACvB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,MAAM,CAAC,EACnB,IAAI,EAAE,QAAQ,EACd,YAAY,EACZ,SAAS,EACT,QAAQ,EACR,GAAG,IAAI,EACV,EAAE,WAAW,+BA+Eb;yBArFe,MAAM;aA+FP,WAAW;aACX,WAAW;aACZ,UAAU;aACP,aAAa;aACV,gBAAgB"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useEffect, useId, useRef, useState, } from 'react';
|
|
3
|
+
import { NavbarContext } from './context.js';
|
|
4
|
+
import { NavbarBrand } from './brand/brand.js';
|
|
5
|
+
import { NavbarLinks } from './links/links.js';
|
|
6
|
+
import { NavbarLink } from './link/link.js';
|
|
7
|
+
import { NavbarActions } from './actions/actions.js';
|
|
8
|
+
import { NavbarMenuButton } from './menu-button/menu-button.js';
|
|
9
|
+
/**
|
|
10
|
+
* The bar. Sticky, and that is not a prop: `data-newtone-navbar-scrolled` has nothing to report
|
|
11
|
+
* on a bar that scrolls away.
|
|
12
|
+
*
|
|
13
|
+
* **The threshold is a CSS custom property, not a number this file picks.** The sentinel below
|
|
14
|
+
* is absolutely positioned against the document origin -- it has no positioned ancestor -- so it
|
|
15
|
+
* sits at the top of the page, out of flow, taking up no space. Its height is
|
|
16
|
+
* `--newtone-navbar-threshold`, default `1px`, and the attribute appears when it scrolls out of
|
|
17
|
+
* view. A site that wants the swap to happen after the first screenful sets that property to
|
|
18
|
+
* `100vh`. Picking the number here would be this component deciding what a fold is for layouts
|
|
19
|
+
* it has never seen.
|
|
20
|
+
*
|
|
21
|
+
* An IntersectionObserver rather than a scroll handler: a scroll handler runs on every frame of
|
|
22
|
+
* every scroll to answer a question whose answer changes twice a page.
|
|
23
|
+
*/
|
|
24
|
+
export function Navbar({ open: openProp, onOpenChange, className, children, ...rest }) {
|
|
25
|
+
const [openState, setOpenState] = useState(false);
|
|
26
|
+
const [scrolled, setScrolled] = useState(false);
|
|
27
|
+
const [collapsible, setCollapsible] = useState(false);
|
|
28
|
+
const sentinelRef = useRef(null);
|
|
29
|
+
const triggerRef = useRef(null);
|
|
30
|
+
const panelId = useId();
|
|
31
|
+
// **Whether the links collapse is decided by whether the site rendered a MenuButton**, not by
|
|
32
|
+
// the media query alone. The first version collapsed them at every narrow width, which meant a
|
|
33
|
+
// site with no menu button lost its navigation entirely on a phone -- the links were display:
|
|
34
|
+
// none and nothing existed to open them. Found by measuring, not by reading.
|
|
35
|
+
//
|
|
36
|
+
// Still no prop: the site says "collapse these" by putting a disclosure in the bar, which is
|
|
37
|
+
// the same thing it would have had to do anyway. A `collapsible` prop would have been a second
|
|
38
|
+
// way to say it, and two ways to say one thing is the shape this component exists to avoid.
|
|
39
|
+
const registerTrigger = useCallback((present) => setCollapsible(present), []);
|
|
40
|
+
const open = openProp ?? openState;
|
|
41
|
+
const setOpen = useCallback((next) => {
|
|
42
|
+
if (openProp === undefined)
|
|
43
|
+
setOpenState(next);
|
|
44
|
+
onOpenChange?.(next);
|
|
45
|
+
}, [openProp, onOpenChange]);
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
const sentinel = sentinelRef.current;
|
|
48
|
+
if (!sentinel)
|
|
49
|
+
return;
|
|
50
|
+
const observer = new IntersectionObserver(([entry]) => setScrolled(!entry.isIntersecting), {
|
|
51
|
+
threshold: 0,
|
|
52
|
+
});
|
|
53
|
+
observer.observe(sentinel);
|
|
54
|
+
return () => observer.disconnect();
|
|
55
|
+
}, []);
|
|
56
|
+
// Escape closes and focus goes back where it came from. A menu that swallows the focus it
|
|
57
|
+
// borrowed is the failure a keyboard finds immediately and a pointer never does.
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
if (!open)
|
|
60
|
+
return;
|
|
61
|
+
const onKeyDown = (event) => {
|
|
62
|
+
if (event.key !== 'Escape')
|
|
63
|
+
return;
|
|
64
|
+
setOpen(false);
|
|
65
|
+
triggerRef.current?.focus();
|
|
66
|
+
};
|
|
67
|
+
document.addEventListener('keydown', onKeyDown);
|
|
68
|
+
return () => document.removeEventListener('keydown', onKeyDown);
|
|
69
|
+
}, [open, setOpen]);
|
|
70
|
+
// The page behind an open panel does not scroll. Restored to whatever was there rather than
|
|
71
|
+
// to `''`, so a site that locks scrolling for its own reasons is not overruled on the way out.
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
if (!open)
|
|
74
|
+
return;
|
|
75
|
+
const previous = document.body.style.overflow;
|
|
76
|
+
document.body.style.overflow = 'hidden';
|
|
77
|
+
return () => {
|
|
78
|
+
document.body.style.overflow = previous;
|
|
79
|
+
};
|
|
80
|
+
}, [open]);
|
|
81
|
+
return (_jsxs(NavbarContext.Provider, { value: { open, setOpen, panelId, triggerRef, registerTrigger }, children: [_jsx("div", { ref: sentinelRef, className: "newtone-navbar-sentinel", "aria-hidden": "true" }), _jsx("header", { ...rest, className: ['newtone-navbar', className].filter(Boolean).join(' '), "data-newtone-navbar-scrolled": scrolled ? '' : undefined, "data-newtone-navbar-menu-open": open ? '' : undefined, "data-newtone-navbar-collapsible": collapsible ? '' : undefined, children: children })] }));
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* The parts hang off `Navbar` and are exported nowhere else.
|
|
85
|
+
*
|
|
86
|
+
* **That is the boundary, and it is the test this component had to pass.** A nav link only means
|
|
87
|
+
* anything inside the thing that navigates -- nobody puts one in a hero section -- so it ships
|
|
88
|
+
* from this library and cannot be imported from it. `index.ts` exports `Navbar` and nothing
|
|
89
|
+
* below it.
|
|
90
|
+
*/
|
|
91
|
+
Navbar.Brand = NavbarBrand;
|
|
92
|
+
Navbar.Links = NavbarLinks;
|
|
93
|
+
Navbar.Link = NavbarLink;
|
|
94
|
+
Navbar.Actions = NavbarActions;
|
|
95
|
+
Navbar.MenuButton = NavbarMenuButton;
|
|
96
|
+
//# sourceMappingURL=navbar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"navbar.js","sourceRoot":"","sources":["../../src/navbar/navbar.tsx"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/numbered-list/index.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,YAAY,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/numbered-list/index.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/* A counted list.
|
|
2
|
+
*
|
|
3
|
+
* THE NUMERAL IS A COUNTER AND NOT A LIST MARKER, because a list marker cannot be given a colour,
|
|
4
|
+
* a weight or a column of its own. `list-style: none` plus a counter is the standard trade and it
|
|
5
|
+
* costs one thing worth naming: some screen readers stop announcing the list as a list. The `<ol>`
|
|
6
|
+
* is kept precisely so that the semantics survive the styling. */
|
|
7
|
+
.newtone-numbered-list {
|
|
8
|
+
margin: 0;
|
|
9
|
+
padding: 0;
|
|
10
|
+
list-style: none;
|
|
11
|
+
counter-reset: newtone-numbered-list;
|
|
12
|
+
display: flex;
|
|
13
|
+
flex-direction: column;
|
|
14
|
+
gap: var(--newtone-numbered-list-gap);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.newtone-numbered-list-item {
|
|
18
|
+
counter-increment: newtone-numbered-list;
|
|
19
|
+
|
|
20
|
+
/* A fixed first track, so every numeral shares a left edge and every step shares a second one.
|
|
21
|
+
A `list-style-position` cannot do this -- the text of a wrapped step would run back under the
|
|
22
|
+
numeral. */
|
|
23
|
+
display: grid;
|
|
24
|
+
grid-template-columns: var(--newtone-numbered-list-indent) 1fr;
|
|
25
|
+
align-items: baseline;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.newtone-numbered-list-item::before {
|
|
29
|
+
content: counter(newtone-numbered-list) '.';
|
|
30
|
+
color: var(--newtone-numbered-list-marker);
|
|
31
|
+
|
|
32
|
+
/* Tabular figures so 9 and 10 do not shift the column. Silently ignored by a family with no
|
|
33
|
+
`tnum`, which is the same no-op `Text figures="tabular"` documents. */
|
|
34
|
+
font-variant-numeric: tabular-nums;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/* NO NUMERALS, AND THE TRACK GOES WITH THEM. A list of one does not need a "1.", and a column
|
|
38
|
+
reserved for a marker that is not drawn is an indent with no cause. The `<ol>` stays an `<ol>`:
|
|
39
|
+
the items are still ordered, they are just not counted out loud. */
|
|
40
|
+
.newtone-numbered-list--unmarked .newtone-numbered-list-item {
|
|
41
|
+
grid-template-columns: 1fr;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.newtone-numbered-list--unmarked .newtone-numbered-list-item::before {
|
|
45
|
+
content: none;
|
|
46
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export interface NumberedListProps extends HTMLAttributes<HTMLElement> {
|
|
3
|
+
/** One entry per step. */
|
|
4
|
+
items: readonly ReactNode[];
|
|
5
|
+
/**
|
|
6
|
+
* Draw the numerals. Defaults to `true`.
|
|
7
|
+
*
|
|
8
|
+
* **`false` is a real call site rather than a symmetry**: one of the three this was sized from
|
|
9
|
+
* is a list of ONE question, where a solitary "1." is noise. It collapses the marker column too
|
|
10
|
+
* -- a track reserved for nothing is an indent nobody asked for -- so the two things the caller
|
|
11
|
+
* means by *no numbers* happen together and cannot come apart.
|
|
12
|
+
*/
|
|
13
|
+
markers?: boolean;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* A list whose steps are counted.
|
|
17
|
+
*
|
|
18
|
+
* **The numerals are drawn by CSS counters and are not in the markup**, which is the whole of why
|
|
19
|
+
* this is a component rather than a class. An `<ol>` already numbers itself; what a designed list
|
|
20
|
+
* wants is a numeral in the accent, at a fixed column, set in tabular figures so that 9 and 10 have
|
|
21
|
+
* the same left edge. Getting the marker out of the flow and into a `::before` is four rules, and
|
|
22
|
+
* both hand-written copies this replaced wrote all four.
|
|
23
|
+
*
|
|
24
|
+
* **There is no `start` and no `marker` prop.** Neither call site has one, and a list that begins at
|
|
25
|
+
* four is a list that is really two lists -- governance/evidence/size-an-api-from-call-sites-not-from-the-type.md.
|
|
26
|
+
*
|
|
27
|
+
* **An item is a `ReactNode` rather than a `string`**, because one of the two call sites this came
|
|
28
|
+
* from puts emphasis inside a step. The same reason `Button`'s label is a slot.
|
|
29
|
+
*/
|
|
30
|
+
export declare function NumberedList({ items, markers, className, ...rest }: NumberedListProps): import("react").JSX.Element;
|
|
31
|
+
//# sourceMappingURL=numbered-list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"numbered-list.d.ts","sourceRoot":"","sources":["../../src/numbered-list/numbered-list.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtD,MAAM,WAAW,iBAAkB,SAAQ,cAAc,CAAC,WAAW,CAAC;IAClE,0BAA0B;IAC1B,KAAK,EAAE,SAAS,SAAS,EAAE,CAAA;IAC3B;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;CACpB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,YAAY,CAAC,EAAE,KAAK,EAAE,OAAc,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,EAAE,iBAAiB,+BAsB5F"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* A list whose steps are counted.
|
|
4
|
+
*
|
|
5
|
+
* **The numerals are drawn by CSS counters and are not in the markup**, which is the whole of why
|
|
6
|
+
* this is a component rather than a class. An `<ol>` already numbers itself; what a designed list
|
|
7
|
+
* wants is a numeral in the accent, at a fixed column, set in tabular figures so that 9 and 10 have
|
|
8
|
+
* the same left edge. Getting the marker out of the flow and into a `::before` is four rules, and
|
|
9
|
+
* both hand-written copies this replaced wrote all four.
|
|
10
|
+
*
|
|
11
|
+
* **There is no `start` and no `marker` prop.** Neither call site has one, and a list that begins at
|
|
12
|
+
* four is a list that is really two lists -- governance/evidence/size-an-api-from-call-sites-not-from-the-type.md.
|
|
13
|
+
*
|
|
14
|
+
* **An item is a `ReactNode` rather than a `string`**, because one of the two call sites this came
|
|
15
|
+
* from puts emphasis inside a step. The same reason `Button`'s label is a slot.
|
|
16
|
+
*/
|
|
17
|
+
export function NumberedList({ items, markers = true, className, ...rest }) {
|
|
18
|
+
return (_jsx("ol", { className: [
|
|
19
|
+
'newtone-numbered-list',
|
|
20
|
+
markers ? null : 'newtone-numbered-list--unmarked',
|
|
21
|
+
className,
|
|
22
|
+
]
|
|
23
|
+
.filter(Boolean)
|
|
24
|
+
.join(' '), ...rest, children: items.map((item, index) => (_jsx("li", { className: "newtone-numbered-list-item", children: item }, index))) }));
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=numbered-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"numbered-list.js","sourceRoot":"","sources":["../../src/numbered-list/numbered-list.tsx"],"names":[],"mappings":";AAgBA;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,YAAY,CAAC,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,EAAE,SAAS,EAAE,GAAG,IAAI,EAAqB;IACzF,OAAO,CACH,aACI,SAAS,EAAE;YACP,uBAAuB;YACvB,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,iCAAiC;YAClD,SAAS;SACZ;aACI,MAAM,CAAC,OAAO,CAAC;aACf,IAAI,CAAC,GAAG,CAAC,KACV,IAAI,YAEP,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAIxB,aAAgB,SAAS,EAAC,4BAA4B,YACjD,IAAI,IADA,KAAK,CAET,CACR,CAAC,GACD,CACR,CAAA;AACL,CAAC"}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
/* The colour that refers to nothing: what a control, a button, a word or a mark looks like when it
|
|
2
|
+
* is standing on a photograph. See the repo blueprint, sections 3, 4.1 and 5.
|
|
3
|
+
*
|
|
4
|
+
* ---- why this file exists, and why it has no component beside it ----------
|
|
5
|
+
*
|
|
6
|
+
* Every other stylesheet here sits next to the component that emits its markup. This one does not,
|
|
7
|
+
* because there is no element to render and no prop for a caller to pass: what it publishes is a
|
|
8
|
+
* VOCABULARY -- five class names and the states under them -- worn by markup in this library and in
|
|
9
|
+
* the sites that consume it. `on-media/` is the only folder in `src/` with no `index.ts`, and the
|
|
10
|
+
* blueprint's section 4.1 says why that absence is the design rather than an oversight.
|
|
11
|
+
*
|
|
12
|
+
* ---- why the colours are literals ----------------------------------------
|
|
13
|
+
*
|
|
14
|
+
* A Newtone role is RELATIVE. It resolves against the surface, so a box painted from one recedes
|
|
15
|
+
* with the ground behind it, which is what every piece of chrome wants. **A thing standing on a
|
|
16
|
+
* photograph has no surface under it.** The picture is whatever somebody uploaded; it can be white
|
|
17
|
+
* sky in one slide and night tarmac in the next, and a fill resolved through the theme would be
|
|
18
|
+
* legible or invisible depending on which. In one sentence: *a photograph is not a surface to be
|
|
19
|
+
* relative to.*
|
|
20
|
+
*
|
|
21
|
+
* So none of these values resolves against anything, and there is no role this could have been --
|
|
22
|
+
* `blueprints/newtone/contracts/roles.md` section 1 already answers it, because a role may exist
|
|
23
|
+
* only where the area is fixed by what the thing is, and a photograph fixes nothing.
|
|
24
|
+
*
|
|
25
|
+
* ---- and why this sheet still declares no colour -------------------------
|
|
26
|
+
*
|
|
27
|
+
* The nineteen channels are a token group, `newtone_ui_tokens/src/semantic/on-media.json`, emitted
|
|
28
|
+
* once at `:root` because a literal has no facet to vary on. This file reads them and writes none,
|
|
29
|
+
* which is section 5's *a component reads only its own tokens* holding here exactly as it holds
|
|
30
|
+
* everywhere else. **What has to exist once is each ALPHA**: bare `white` and bare `black` appear
|
|
31
|
+
* more than once below and a keyword cannot drift from itself, where `62%` written in two places is
|
|
32
|
+
* a number somebody can retune in one of them.
|
|
33
|
+
*
|
|
34
|
+
* ---- where it came from ---------------------------------------------------
|
|
35
|
+
*
|
|
36
|
+
* A consuming site's own stylesheet, 2026-09-07, under
|
|
37
|
+
* `issues/open/051-the-media-and-control-components.md`. It moved because two components wearing it
|
|
38
|
+
* were sorted into this library and a component cannot travel to a repository that does not hold
|
|
39
|
+
* the class its own markup names. **The argument for every one of the thirteen values is the
|
|
40
|
+
* consumer's** and is kept in the consumer's own blueprint -- this file expresses them and did not
|
|
41
|
+
* decide them, and the repo blueprint's section 3 is where the crossing is written down. Three of
|
|
42
|
+
* the five consumers are still that site's components; they import this sheet by subpath and wear
|
|
43
|
+
* these class names, which is what section 8's refusal of scoped class names has always promised.
|
|
44
|
+
*
|
|
45
|
+
* **Which site is deliberately not named here.** The charter's split says an agnostic component
|
|
46
|
+
* leaves its origin behind entirely and *Newtone must never learn where it came from*, and a
|
|
47
|
+
* comment naming it is this library learning exactly that. Section 5's *no component here names a
|
|
48
|
+
* client* is the check, and it is the reason this paragraph is worded the way it is rather than
|
|
49
|
+
* the obvious way. */
|
|
50
|
+
|
|
51
|
+
/* A 48px disc of frosted white with a dark glyph in it.
|
|
52
|
+
*
|
|
53
|
+
* **The blur is load-bearing rather than decorative and the trade travels with it.** A photograph
|
|
54
|
+
* carries high-frequency detail and a translucent plate inherits it straight through, so a glyph on
|
|
55
|
+
* the plate competes with whatever texture happens to be behind it. Blurring the backdrop removes
|
|
56
|
+
* the frequency and keeps the colour, and that is what lets the fill sit at 45% instead of the
|
|
57
|
+
* ~100% an unblurred plate would need. **Where `backdrop-filter` is unsupported this degrades to a
|
|
58
|
+
* black glyph on a flat 45% wash**, which is legible by luck rather than by arithmetic.
|
|
59
|
+
*
|
|
60
|
+
* **The rim is authored as `transparent` rather than left out.** Every control here carries a 1px
|
|
61
|
+
* line so its box is the same whether or not a variant paints one; a border with no colour falls
|
|
62
|
+
* back to `currentColor`, which here is the glyph -- the loudest rim available. This is the only way
|
|
63
|
+
* to say *no rim* without changing the box, and a removed border would be a layout shift where a
|
|
64
|
+
* transparent one is a rim that is not there.
|
|
65
|
+
*
|
|
66
|
+
* `50%` is the corner and the box is square, so this draws a circle and not an ellipse. `3rem` is
|
|
67
|
+
* written as a length rather than through `--newtone-space-12`, which is `framed-icon.css`'s
|
|
68
|
+
* arrangement for its own two sizes: geometry that IS the component is not a step a caller chose. */
|
|
69
|
+
.newtone-on-media-control {
|
|
70
|
+
display: grid;
|
|
71
|
+
place-items: center;
|
|
72
|
+
width: 3rem;
|
|
73
|
+
height: 3rem;
|
|
74
|
+
padding: 0;
|
|
75
|
+
background-color: var(--newtone-on-media-control-bg);
|
|
76
|
+
color: var(--newtone-on-media-control-fg);
|
|
77
|
+
border: 1px solid transparent;
|
|
78
|
+
border-radius: 50%;
|
|
79
|
+
-webkit-backdrop-filter: blur(16px);
|
|
80
|
+
backdrop-filter: blur(16px);
|
|
81
|
+
cursor: pointer;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.newtone-on-media-control:hover {
|
|
85
|
+
background-color: var(--newtone-on-media-control-bg-hover);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.newtone-on-media-control:active {
|
|
89
|
+
background-color: var(--newtone-on-media-control-bg-press);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/* The filled action, and it is three declarations because it is PAINT and not a box.
|
|
93
|
+
*
|
|
94
|
+
* **The box belongs to whoever wears this class and stays theirs.** The padding, the rim's width and
|
|
95
|
+
* style, the corner, the label's four declarations, `text-decoration` and the cursor are all things
|
|
96
|
+
* a filled action shares with every other filled action on its page, whatever it is standing on --
|
|
97
|
+
* so they are the consumer's shape, and what is left here is the only part that could never have
|
|
98
|
+
* been read out of Newtone: what a filled button on a PHOTOGRAPH looks like. In
|
|
99
|
+
* the consuming site that brought this vocabulary here, that shape is a `.control-box` in its own
|
|
100
|
+
* shared-shapes sheet, worn beside this class.
|
|
101
|
+
*
|
|
102
|
+
* **`border-color: transparent` is here and not left out, and that is not tidiness.** A consumer's
|
|
103
|
+
* box class will set `border-width` and `border-style`; if it sets them with a `border` SHORTHAND at
|
|
104
|
+
* equal specificity and later in the order, the shorthand also sets `border-color` and **silently
|
|
105
|
+
* erases the white rim on `.newtone-on-media-button-outline`** -- the whole of that variant. The
|
|
106
|
+
* shape states that a rim exists; both palettes state what colour it is, including this one saying
|
|
107
|
+
* *none*. **The consuming site must import this sheet ABOVE its own**, which is the same relation
|
|
108
|
+
* the site's own import list already gave it.
|
|
109
|
+
*
|
|
110
|
+
* The radius is the consumer's for the same reason the rest of the box is. */
|
|
111
|
+
.newtone-on-media-button {
|
|
112
|
+
background-color: var(--newtone-on-media-button-bg);
|
|
113
|
+
color: var(--newtone-on-media-button-fg);
|
|
114
|
+
border-color: transparent;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.newtone-on-media-button:hover {
|
|
118
|
+
background-color: var(--newtone-on-media-button-bg-hover);
|
|
119
|
+
color: var(--newtone-on-media-button-fg);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.newtone-on-media-button:active {
|
|
123
|
+
background-color: var(--newtone-on-media-button-bg-press);
|
|
124
|
+
color: var(--newtone-on-media-button-fg);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/* The same box, outlined. **It is a modifier and not a second class**, worn beside the one above: a
|
|
128
|
+
* standalone rule would repeat whatever the consumer's box already says, which is
|
|
129
|
+
* `governance/documents/staleness/a-second-copy-is-a-thing-that-drifts.md` across a repository boundary.
|
|
130
|
+
*
|
|
131
|
+
* **What that costs is a word: `.newtone-on-media-button` is the PAINT, and the fill is what it
|
|
132
|
+
* happens to paint when nothing modifies it.**
|
|
133
|
+
*
|
|
134
|
+
* **Its states move a third way, and that is the finding rather than the shape.** The disc above
|
|
135
|
+
* fills IN as it is pressed, 45 to 62 to 80; the filled button lets the picture back THROUGH, 100
|
|
136
|
+
* to 92 to 84; and this one has no fill to move, so pressure is the ground ARRIVING, 0 to 15 to 25.
|
|
137
|
+
* Three controls and no two of them say the same thing the same way, because there is no hue here
|
|
138
|
+
* to shift against.
|
|
139
|
+
*
|
|
140
|
+
* **The base rule needed no change to make this work**, because of the transparent rim it already
|
|
141
|
+
* carries for the disc's reason: both variants are the same size because the rim is always drawn,
|
|
142
|
+
* and this one only gives it a colour. A `border` added here instead would be a layout shift between
|
|
143
|
+
* two buttons that are supposed to be interchangeable.
|
|
144
|
+
*
|
|
145
|
+
* These three rules come AFTER the three above at the same specificity, which is what makes the
|
|
146
|
+
* modifier win. Inside one file that ordering is a constraint rather than a taste. */
|
|
147
|
+
.newtone-on-media-button-outline {
|
|
148
|
+
background-color: var(--newtone-on-media-button-outline-bg);
|
|
149
|
+
color: var(--newtone-on-media-button-outline-fg);
|
|
150
|
+
border-color: var(--newtone-on-media-button-outline-border);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.newtone-on-media-button-outline:hover {
|
|
154
|
+
background-color: var(--newtone-on-media-button-outline-bg-hover);
|
|
155
|
+
color: var(--newtone-on-media-button-outline-fg);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.newtone-on-media-button-outline:active {
|
|
159
|
+
background-color: var(--newtone-on-media-button-outline-bg-press);
|
|
160
|
+
color: var(--newtone-on-media-button-outline-fg);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/* Words on a picture. It sets `color` and nothing else, so a heading is still a heading and a
|
|
164
|
+
* paragraph is still a paragraph -- every scale, weight and measure stays `Text`'s. */
|
|
165
|
+
.newtone-on-media-text {
|
|
166
|
+
color: var(--newtone-on-media-text);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/* One mark on a rail. **The current one is wider as well as brighter**, and that is not decoration:
|
|
170
|
+
* a difference of alpha alone is the one distinction a reader with low contrast vision may not
|
|
171
|
+
* have, so the mark that says *you are here* also changes shape. `aria-current` is what carries the
|
|
172
|
+
* same fact to a reader who is not looking at it, and the attribute is the selector so the two
|
|
173
|
+
* cannot come apart. */
|
|
174
|
+
.newtone-on-media-mark {
|
|
175
|
+
display: block;
|
|
176
|
+
width: 0.5rem;
|
|
177
|
+
height: 0.5rem;
|
|
178
|
+
padding: 0;
|
|
179
|
+
background-color: var(--newtone-on-media-mark);
|
|
180
|
+
border: 0;
|
|
181
|
+
border-radius: calc(infinity * 1px);
|
|
182
|
+
cursor: pointer;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.newtone-on-media-mark[aria-current] {
|
|
186
|
+
width: 1.5rem;
|
|
187
|
+
background-color: var(--newtone-on-media-mark-current);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/* The one ring, for everything above. A focus ring on a photograph has the same problem as a fill
|
|
191
|
+
* on one and takes the same answer. `2px solid` is the expression this library's link, button and
|
|
192
|
+
* navbar all already use. */
|
|
193
|
+
.newtone-on-media-control:focus-visible,
|
|
194
|
+
.newtone-on-media-button:focus-visible,
|
|
195
|
+
.newtone-on-media-mark:focus-visible {
|
|
196
|
+
outline: 2px solid var(--newtone-on-media-ring);
|
|
197
|
+
outline-offset: 2px;
|
|
198
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/quick-action/index.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/quick-action/index.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/* QuickAction -- one round action a page keeps within reach. See the repo blueprint, section 3, and
|
|
2
|
+
* blueprints/newtone/repos/newtone_ui_react-web/components/quick-action.md.
|
|
3
|
+
*
|
|
4
|
+
* ---- the size is one custom property, not a ladder -----------------------
|
|
5
|
+
*
|
|
6
|
+
* `--newtone-quick-action-size` is 3.5rem by default and a caller retunes it in its own scope --
|
|
7
|
+
* `Avatar`'s arrangement, taken rather than re-derived. The reference narrows its circle on a phone
|
|
8
|
+
* inside the media query that hands its dock back, which is a fact about that shell and not about
|
|
9
|
+
* this component: whatever pins the circle owns that number.
|
|
10
|
+
*
|
|
11
|
+
* ---- 50% is the corner, and the box is square, so this is a disc ---------
|
|
12
|
+
*
|
|
13
|
+
* Not an ellipse. `--newtone-quick-action-radius` is `50%` and both axes are the same length, which
|
|
14
|
+
* is `on-media.css`'s arrangement for the same shape. It is a PROPORTION rather than a length
|
|
15
|
+
* somebody chose, so it is stated in the token layer as a literal and does not belong on the two-
|
|
16
|
+
* step radius scale -- `newtone_ui_tokens.md` section 3.
|
|
17
|
+
*
|
|
18
|
+
* ---- the mark is the caller's, and this sheet sizes whatever arrives -----
|
|
19
|
+
*
|
|
20
|
+
* `> *` rather than a class, because the slot takes an `<Icon>` (a `<span>`) or a vendored `<svg>`
|
|
21
|
+
* and neither wears a name this file gets to choose. `fill: currentColor` is what lets a brand mark
|
|
22
|
+
* follow the circle's ink through every state without the caller painting it -- the same three
|
|
23
|
+
* lines `icon-link.css` spends for the same reason.
|
|
24
|
+
*
|
|
25
|
+
* ---- THERE IS NO SHADOW, and the component is weaker for it --------------
|
|
26
|
+
*
|
|
27
|
+
* The reference lifts this circle on `--shadow-l` at rest and further on hover, on the argument
|
|
28
|
+
* that a control on screen for a whole visit must separate itself by depth rather than by hue.
|
|
29
|
+
* **Newtone has no shadow vocabulary and no motion vocabulary**, so the lift and the 2px translate
|
|
30
|
+
* are both gone rather than hard-coded here. What separates the disc instead is a 1px rim, present
|
|
31
|
+
* in every state so the box never changes size. On a busy ground that is genuinely less separation
|
|
32
|
+
* than the reference achieves, and the fix is a token group rather than a declaration in this file. */
|
|
33
|
+
|
|
34
|
+
.newtone-quick-action {
|
|
35
|
+
display: inline-grid;
|
|
36
|
+
place-items: center;
|
|
37
|
+
inline-size: var(--newtone-quick-action-size);
|
|
38
|
+
block-size: var(--newtone-quick-action-size);
|
|
39
|
+
padding: 0;
|
|
40
|
+
border: 1px solid;
|
|
41
|
+
border-radius: var(--newtone-quick-action-radius);
|
|
42
|
+
cursor: pointer;
|
|
43
|
+
text-decoration: none;
|
|
44
|
+
background: var(--newtone-quick-action-rest-fill);
|
|
45
|
+
color: var(--newtone-quick-action-rest-text);
|
|
46
|
+
border-color: var(--newtone-quick-action-rest-border);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.newtone-quick-action > * {
|
|
50
|
+
inline-size: 1.5rem;
|
|
51
|
+
block-size: 1.5rem;
|
|
52
|
+
fill: currentColor;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.newtone-quick-action:hover {
|
|
56
|
+
background: var(--newtone-quick-action-hover-fill);
|
|
57
|
+
color: var(--newtone-quick-action-hover-text);
|
|
58
|
+
border-color: var(--newtone-quick-action-hover-border);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.newtone-quick-action:active {
|
|
62
|
+
background: var(--newtone-quick-action-pressed-fill);
|
|
63
|
+
color: var(--newtone-quick-action-pressed-text);
|
|
64
|
+
border-color: var(--newtone-quick-action-pressed-border);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.newtone-quick-action:focus-visible {
|
|
68
|
+
outline: 2px solid var(--newtone-quick-action-focus-ring);
|
|
69
|
+
outline-offset: 2px;
|
|
70
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { AnchorHTMLAttributes, ButtonHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
interface QuickActionCommon {
|
|
3
|
+
/**
|
|
4
|
+
* The accessible name, and the only name this control has. **Never rendered** -- the mark is
|
|
5
|
+
* the whole content, so without this the control reaches a screen reader as *button*.
|
|
6
|
+
*/
|
|
7
|
+
label: string;
|
|
8
|
+
/**
|
|
9
|
+
* The mark. A slot rather than an `icon` name, for the reason `icon-link.tsx` already found by
|
|
10
|
+
* trying it the other way: **Material Symbols has no WhatsApp and no Instagram**, and every
|
|
11
|
+
* persistent round action anybody has drawn carries either a brand mark as inline SVG or a
|
|
12
|
+
* ligature. A slot renders both; a name prop renders one.
|
|
13
|
+
*/
|
|
14
|
+
children: ReactNode;
|
|
15
|
+
}
|
|
16
|
+
export type QuickActionProps = QuickActionCommon & ((Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'aria-label'> & {
|
|
17
|
+
href?: undefined;
|
|
18
|
+
}) | (Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'children' | 'href' | 'aria-label'> & {
|
|
19
|
+
/** Where it goes. Its presence turns the rendered element into an `<a>`. */
|
|
20
|
+
href: string;
|
|
21
|
+
}));
|
|
22
|
+
/**
|
|
23
|
+
* One round action a page keeps within reach for a whole visit -- a chat entry, a back to top, a
|
|
24
|
+
* help button. `Action`'s persistent sibling: an action is a moment a reader arrives at, this is on
|
|
25
|
+
* screen for the entire scroll.
|
|
26
|
+
*
|
|
27
|
+
* ---- it does not position itself, and is not named for where it sits ------
|
|
28
|
+
*
|
|
29
|
+
* Whatever pins it -- a corner, a safe-area inset, a dock -- belongs to the page that placed it.
|
|
30
|
+
* `--newtone-quick-action-size` is the one property a caller retunes, which is `Avatar`'s
|
|
31
|
+
* arrangement and arrived for `Avatar`'s reason: a `sm`/`md`/`lg` ladder sized from the call sites
|
|
32
|
+
* a library happens to know about leaves the next one off every rung. A component called
|
|
33
|
+
* `FloatingButton` would be carrying a word about a slot it does not own.
|
|
34
|
+
*
|
|
35
|
+
* ---- NOTHING RENDERS ONE, and that is recorded rather than smoothed over --
|
|
36
|
+
*
|
|
37
|
+
* **Ported 2026-09-16 from `~/Projects/Harbour Space/-harbour-space-design-system` with zero call
|
|
38
|
+
* sites anywhere in this house.** It is the only component in this library in that position, and
|
|
39
|
+
* the only one whose shape was settled by reading a reference rather than by a consumer pushing on
|
|
40
|
+
* it -- which is the thing the preamble refuses, built anyway on an explicit decision after the
|
|
41
|
+
* cost was put on the table. `issues/open/154-the-round-action-nothing-presses.md`.
|
|
42
|
+
*
|
|
43
|
+
* **So every refusal below is argued from the reference and from sibling components, and none of
|
|
44
|
+
* them has been tested.** They may all be right. Whoever gives this a consumer should expect to
|
|
45
|
+
* change some of them, which is what happened to `Control` within hours of it landing.
|
|
46
|
+
*
|
|
47
|
+
* ---- no brand variant ----------------------------------------------------
|
|
48
|
+
*
|
|
49
|
+
* The reference's is a union whose `whatsapp` arm carries Meta's inline SVG and four hard-coded
|
|
50
|
+
* hexes. Two rules forbid that here and either would be enough: no component in this library names
|
|
51
|
+
* a client, and a licensed asset lives with its licence holder -- *the library learns to express a
|
|
52
|
+
* thing, it never carries it.* The slot above is what replaces it.
|
|
53
|
+
*
|
|
54
|
+
* ---- no `disabled`, and no shadow ----------------------------------------
|
|
55
|
+
*
|
|
56
|
+
* `disabled` is absent for `Action`'s reason, which is stronger here: an unavailable action that is
|
|
57
|
+
* on screen for the entire visit is worse than one that is not there.
|
|
58
|
+
*
|
|
59
|
+
* **The shadow is the one thing this visibly lost.** The reference's whole colour argument is that
|
|
60
|
+
* the circle takes the surface's own ground and is lifted by depth rather than by hue, because it
|
|
61
|
+
* must not compete with the page for a whole scroll. Newtone has no shadow vocabulary, so the lift
|
|
62
|
+
* is dropped rather than hard-coded, and a rim does the separating instead. On a busy ground this
|
|
63
|
+
* is genuinely weaker than the component it came from, and the fix is a vocabulary rather than
|
|
64
|
+
* anything in this folder -- `newtone_ui_tokens.md` section 8, *Shadows, blur, spread*.
|
|
65
|
+
*/
|
|
66
|
+
export declare function QuickAction({ label, children, className, ...rest }: QuickActionProps): import("react").JSX.Element;
|
|
67
|
+
export {};
|
|
68
|
+
//# sourceMappingURL=quick-action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quick-action.d.ts","sourceRoot":"","sources":["../../src/quick-action/quick-action.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAElF,UAAU,iBAAiB;IACvB;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAA;IACb;;;;;OAKG;IACH,QAAQ,EAAE,SAAS,CAAA;CACtB;AAED,MAAM,MAAM,gBAAgB,GAAG,iBAAiB,GAC5C,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,wBAAgB,WAAW,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,EAAE,gBAAgB,+BAyBpF"}
|