@cloudgrid-io/ui 0.64.0 → 0.66.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/README.md +1 -1
- package/dist/blocks/add-tile.d.ts +16 -1
- package/dist/blocks/add-tile.d.ts.map +1 -1
- package/dist/blocks/add-tile.js +20 -3
- package/dist/blocks/add-tile.js.map +1 -1
- package/dist/blocks/avatar-picker.d.ts +50 -4
- package/dist/blocks/avatar-picker.d.ts.map +1 -1
- package/dist/blocks/avatar-picker.js +56 -10
- package/dist/blocks/avatar-picker.js.map +1 -1
- package/dist/blocks/bento-card-hint.d.ts +16 -0
- package/dist/blocks/bento-card-hint.d.ts.map +1 -0
- package/dist/blocks/bento-card-hint.js +23 -0
- package/dist/blocks/bento-card-hint.js.map +1 -0
- package/dist/blocks/bento-card.d.ts +59 -0
- package/dist/blocks/bento-card.d.ts.map +1 -0
- package/dist/blocks/bento-card.js +59 -0
- package/dist/blocks/bento-card.js.map +1 -0
- package/dist/blocks/coming-soon-hint.d.ts.map +1 -1
- package/dist/blocks/coming-soon-hint.js +110 -7
- package/dist/blocks/coming-soon-hint.js.map +1 -1
- package/dist/blocks/creation-search.d.ts +147 -0
- package/dist/blocks/creation-search.d.ts.map +1 -0
- package/dist/blocks/creation-search.js +239 -0
- package/dist/blocks/creation-search.js.map +1 -0
- package/dist/blocks/entity-card.d.ts +82 -2
- package/dist/blocks/entity-card.d.ts.map +1 -1
- package/dist/blocks/entity-card.js +176 -17
- package/dist/blocks/entity-card.js.map +1 -1
- package/dist/blocks/from-your-grid.d.ts +66 -0
- package/dist/blocks/from-your-grid.d.ts.map +1 -0
- package/dist/blocks/from-your-grid.js +63 -0
- package/dist/blocks/from-your-grid.js.map +1 -0
- package/dist/blocks/grid-profile.d.ts +25 -4
- package/dist/blocks/grid-profile.d.ts.map +1 -1
- package/dist/blocks/grid-profile.js +69 -7
- package/dist/blocks/grid-profile.js.map +1 -1
- package/dist/blocks/help-menu.d.ts +58 -0
- package/dist/blocks/help-menu.d.ts.map +1 -0
- package/dist/blocks/help-menu.js +64 -0
- package/dist/blocks/help-menu.js.map +1 -0
- package/dist/blocks/home-bento.d.ts +86 -0
- package/dist/blocks/home-bento.d.ts.map +1 -0
- package/dist/blocks/home-bento.js +87 -0
- package/dist/blocks/home-bento.js.map +1 -0
- package/dist/blocks/home-empty-illustrations.d.ts +37 -0
- package/dist/blocks/home-empty-illustrations.d.ts.map +1 -0
- package/dist/blocks/home-empty-illustrations.js +47 -0
- package/dist/blocks/home-empty-illustrations.js.map +1 -0
- package/dist/blocks/home-pinned.d.ts +168 -0
- package/dist/blocks/home-pinned.d.ts.map +1 -0
- package/dist/blocks/home-pinned.js +100 -0
- package/dist/blocks/home-pinned.js.map +1 -0
- package/dist/blocks/icons.d.ts +46 -0
- package/dist/blocks/icons.d.ts.map +1 -1
- package/dist/blocks/icons.js +46 -0
- package/dist/blocks/icons.js.map +1 -1
- package/dist/blocks/image-adjust-dialog.d.ts +68 -11
- package/dist/blocks/image-adjust-dialog.d.ts.map +1 -1
- package/dist/blocks/image-adjust-dialog.js +68 -16
- package/dist/blocks/image-adjust-dialog.js.map +1 -1
- package/dist/blocks/inspiration-cards.d.ts +241 -0
- package/dist/blocks/inspiration-cards.d.ts.map +1 -0
- package/dist/blocks/inspiration-cards.js +234 -0
- package/dist/blocks/inspiration-cards.js.map +1 -0
- package/dist/blocks/invite-popup.d.ts +63 -5
- package/dist/blocks/invite-popup.d.ts.map +1 -1
- package/dist/blocks/invite-popup.js +60 -20
- package/dist/blocks/invite-popup.js.map +1 -1
- package/dist/blocks/liquid-glass.d.ts +106 -0
- package/dist/blocks/liquid-glass.d.ts.map +1 -0
- package/dist/blocks/liquid-glass.js +283 -0
- package/dist/blocks/liquid-glass.js.map +1 -0
- package/dist/blocks/meter.d.ts +5 -2
- package/dist/blocks/meter.d.ts.map +1 -1
- package/dist/blocks/meter.js +4 -0
- package/dist/blocks/meter.js.map +1 -1
- package/dist/blocks/motion.d.ts +48 -0
- package/dist/blocks/motion.d.ts.map +1 -0
- package/dist/blocks/motion.js +148 -0
- package/dist/blocks/motion.js.map +1 -0
- package/dist/blocks/need-help-line.d.ts +21 -0
- package/dist/blocks/need-help-line.d.ts.map +1 -0
- package/dist/blocks/need-help-line.js +24 -0
- package/dist/blocks/need-help-line.js.map +1 -0
- package/dist/blocks/needs-attention.d.ts +89 -0
- package/dist/blocks/needs-attention.d.ts.map +1 -0
- package/dist/blocks/needs-attention.js +32 -0
- package/dist/blocks/needs-attention.js.map +1 -0
- package/dist/blocks/phosphor-marks.d.ts +16 -0
- package/dist/blocks/phosphor-marks.d.ts.map +1 -1
- package/dist/blocks/phosphor-marks.js +24 -0
- package/dist/blocks/phosphor-marks.js.map +1 -1
- package/dist/blocks/picture-menu.d.ts +26 -0
- package/dist/blocks/picture-menu.d.ts.map +1 -0
- package/dist/blocks/picture-menu.js +22 -0
- package/dist/blocks/picture-menu.js.map +1 -0
- package/dist/blocks/ranked-list.d.ts +7 -1
- package/dist/blocks/ranked-list.d.ts.map +1 -1
- package/dist/blocks/ranked-list.js +8 -6
- package/dist/blocks/ranked-list.js.map +1 -1
- package/dist/blocks/recent-plugs.d.ts +74 -0
- package/dist/blocks/recent-plugs.d.ts.map +1 -0
- package/dist/blocks/recent-plugs.js +20 -0
- package/dist/blocks/recent-plugs.js.map +1 -0
- package/dist/blocks/shared-grid-illustration.d.ts +55 -0
- package/dist/blocks/shared-grid-illustration.d.ts.map +1 -0
- package/dist/blocks/shared-grid-illustration.js +81 -0
- package/dist/blocks/shared-grid-illustration.js.map +1 -0
- package/dist/blocks/shelf-strip.d.ts +36 -0
- package/dist/blocks/shelf-strip.d.ts.map +1 -0
- package/dist/blocks/shelf-strip.js +32 -0
- package/dist/blocks/shelf-strip.js.map +1 -0
- package/dist/blocks/stat-tile.d.ts +17 -1
- package/dist/blocks/stat-tile.d.ts.map +1 -1
- package/dist/blocks/stat-tile.js +4 -1
- package/dist/blocks/stat-tile.js.map +1 -1
- package/dist/blocks/top-creations.d.ts +76 -0
- package/dist/blocks/top-creations.d.ts.map +1 -0
- package/dist/blocks/top-creations.js +54 -0
- package/dist/blocks/top-creations.js.map +1 -0
- package/dist/brand/email/headline-1-invitation-left.png +0 -0
- package/dist/brand/email/headline-2-invitations-left.png +0 -0
- package/dist/brand/email/headline-3-invitations-left.png +0 -0
- package/dist/brand/email/headline-4-invitations-left.png +0 -0
- package/dist/brand/email/headline-5-invitations-left.png +0 -0
- package/dist/brand/email/headline-6-invitations-left.png +0 -0
- package/dist/brand/email/headline-7-invitations-left.png +0 -0
- package/dist/brand/email/headline-8-invitations-left.png +0 -0
- package/dist/brand/email/headline-9-invitations-left.png +0 -0
- package/dist/brand/email/headline-you-have-1-invitation.png +0 -0
- package/dist/brand/email/headline-you-have-2-invitations.png +0 -0
- package/dist/brand/email/headline-you-have-3-invitations.png +0 -0
- package/dist/brand/email/headline-you-have-4-invitations.png +0 -0
- package/dist/brand/email/headline-you-have-5-invitations.png +0 -0
- package/dist/brand/email/headline-you-have-6-invitations.png +0 -0
- package/dist/brand/email/headline-you-have-7-invitations.png +0 -0
- package/dist/brand/email/headline-you-have-8-invitations.png +0 -0
- package/dist/brand/email/headline-you-have-9-invitations.png +0 -0
- package/dist/email/assets.d.ts +108 -0
- package/dist/email/assets.d.ts.map +1 -1
- package/dist/email/assets.js +18 -0
- package/dist/email/assets.js.map +1 -1
- package/dist/email/index.d.ts +71 -0
- package/dist/email/index.d.ts.map +1 -1
- package/dist/email/index.js +110 -5
- package/dist/email/index.js.map +1 -1
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/fit.d.ts +39 -0
- package/dist/lib/fit.d.ts.map +1 -0
- package/dist/lib/fit.js +92 -0
- package/dist/lib/fit.js.map +1 -0
- package/dist/lib/motion.d.ts +165 -0
- package/dist/lib/motion.d.ts.map +1 -0
- package/dist/lib/motion.js +196 -0
- package/dist/lib/motion.js.map +1 -0
- package/dist/lib/touch-hover.d.ts +63 -0
- package/dist/lib/touch-hover.d.ts.map +1 -0
- package/dist/lib/touch-hover.js +164 -0
- package/dist/lib/touch-hover.js.map +1 -0
- package/dist/ui/dialog.d.ts +7 -1
- package/dist/ui/dialog.d.ts.map +1 -1
- package/dist/ui/dialog.js +2 -2
- package/dist/ui/dialog.js.map +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* LIQUID GLASS (ui#541), Asaf's design of 2026-11-20: the full-width band under
|
|
4
|
+
* the Console's floating header that appears once the page is scrolled.
|
|
5
|
+
*
|
|
6
|
+
* Content slides under the header's clusters (the grid menu, the centred pill,
|
|
7
|
+
* the bell and the person) as the page scrolls. The band sits UNDER those
|
|
8
|
+
* clusters and bends what passes behind it like a lens:
|
|
9
|
+
*
|
|
10
|
+
* - **Bend** (where `backdrop-filter: url()` is drawn, i.e. Chromium): an SVG
|
|
11
|
+
* displacement filter as the backdrop filter, pushing most near the top and
|
|
12
|
+
* bottom edges and not at all in the middle (scale 40), then a 6px blur and
|
|
13
|
+
* saturation 1.9, so colours glow through and the header's words read
|
|
14
|
+
* cleanly over busy content.
|
|
15
|
+
* - **Glass** (everywhere else, under reduced motion or reduced transparency,
|
|
16
|
+
* and when `fallback` is set): the clear glass, the scrim's blur token and the
|
|
17
|
+
* same saturation.
|
|
18
|
+
*
|
|
19
|
+
* Both: a sheen of the page colour, 55% at the top, held near half through the
|
|
20
|
+
* header's line and easing to 8% at the bottom, a 1px white highlight along
|
|
21
|
+
* the very top, and a mask that fades the bottom 28% into the page. No border
|
|
22
|
+
* line. Lower down the band it stays see-through and liquid.
|
|
23
|
+
*
|
|
24
|
+
* `active` fades it in (the slow duration, ease out) and out again; the fade is
|
|
25
|
+
* instant under reduced motion. Once faded out it is `visibility: hidden`, so a
|
|
26
|
+
* band at the top of the page costs nothing to draw. Pass `useScrolled()`:
|
|
27
|
+
*
|
|
28
|
+
* const scrolled = useScrolled() // the window
|
|
29
|
+
* const scrolled = useScrolled(4, mainRef) // a scrolling element
|
|
30
|
+
* <LiquidGlass active={scrolled} className="fixed inset-x-0 top-0 z-44" />
|
|
31
|
+
*
|
|
32
|
+
* The caller places it (position, inset, z-index under the clusters) and may
|
|
33
|
+
* change its height (64 by default). It is decorative: `aria-hidden`, no
|
|
34
|
+
* pointer events, never focused.
|
|
35
|
+
*
|
|
36
|
+
* The filter is defined once per page for each band height (one, in the
|
|
37
|
+
* Console: 64 on the desktop, 56 on the phone), in a hidden `<svg>` at the end
|
|
38
|
+
* of `<body>` that the first band to mount adds; the band measures itself to
|
|
39
|
+
* pick it. Until React runs, and in an engine that cannot draw it, the band is
|
|
40
|
+
* the clear glass.
|
|
41
|
+
*/
|
|
42
|
+
/**
|
|
43
|
+
* The design's numbers, strengthened from the mockup's (scale 26, blur 2, a
|
|
44
|
+
* straight 55% to 8% white) so the header reads cleanly over busy content.
|
|
45
|
+
*/
|
|
46
|
+
declare const LIQUID_GLASS: {
|
|
47
|
+
/** The band's height, px: about the header's. */
|
|
48
|
+
readonly height: 64;
|
|
49
|
+
/** The displacement's scale, px, at the edges. */
|
|
50
|
+
readonly scale: 40;
|
|
51
|
+
/** The blur after the bending, px. */
|
|
52
|
+
readonly blur: 6;
|
|
53
|
+
/** The saturation, both modes. */
|
|
54
|
+
readonly saturate: 1.9;
|
|
55
|
+
/** The page-colour sheen, top to bottom: [alpha %, at %]. */
|
|
56
|
+
readonly sheen: readonly [readonly [55, 0], readonly [48, 50], readonly [30, 75], readonly [8, 100]];
|
|
57
|
+
/** The 1px highlight's alpha along the very top, %. */
|
|
58
|
+
readonly highlight: 80;
|
|
59
|
+
/** The share of the band at the bottom that fades into the page, %. */
|
|
60
|
+
readonly fade: 28;
|
|
61
|
+
/** `useScrolled`'s default: "a few pixels". */
|
|
62
|
+
readonly threshold: 4;
|
|
63
|
+
};
|
|
64
|
+
/** The filter for a band `height` px tall: one per height on a page, shared by every band of it. */
|
|
65
|
+
declare const liquidGlassFilterId: (height?: number) => string;
|
|
66
|
+
type LiquidGlassMode = "bend" | "glass";
|
|
67
|
+
/**
|
|
68
|
+
* Which glass an environment gets. Bend only where the bending is drawn and
|
|
69
|
+
* nothing asks for less.
|
|
70
|
+
*/
|
|
71
|
+
declare function liquidGlassMode(env: {
|
|
72
|
+
bendSupported: boolean;
|
|
73
|
+
reducedMotion: boolean;
|
|
74
|
+
reducedTransparency: boolean;
|
|
75
|
+
fallback?: boolean;
|
|
76
|
+
}): LiquidGlassMode;
|
|
77
|
+
/**
|
|
78
|
+
* The `<filter>` the bend mode's backdrop filter points at, for a band
|
|
79
|
+
* `height` px tall. sRGB, so the map's 0.5 means "no shift" (in the default
|
|
80
|
+
* linearRGB it would shift everything).
|
|
81
|
+
*
|
|
82
|
+
* The map is drawn 1px wide and exactly the band's height, in pixels, then
|
|
83
|
+
* tiled across the band, so one filter serves a band of any width. Pixels, not
|
|
84
|
+
* percentages: Chromium draws a percentage-sized `feImage` in a backdrop
|
|
85
|
+
* filter as nothing, which reads as a map of zeros (a flat 20px shift); and
|
|
86
|
+
* bounding-box units scale the shift by the band's width.
|
|
87
|
+
*/
|
|
88
|
+
declare function liquidGlassFilterMarkup(height?: number): string;
|
|
89
|
+
/** Scrolled means past the threshold, not at it; an overscroll bounce above the top is not. */
|
|
90
|
+
declare function scrolledPast(offset: number, threshold: number): boolean;
|
|
91
|
+
/**
|
|
92
|
+
* True once `target` (or the window) has scrolled past `threshold` px, false
|
|
93
|
+
* again at the top. Passive listener; re-renders only when the answer changes.
|
|
94
|
+
* False on the server and until the first effect.
|
|
95
|
+
*/
|
|
96
|
+
declare function useScrolled(threshold?: number, target?: React.RefObject<HTMLElement | null>): boolean;
|
|
97
|
+
type LiquidGlassProps = Omit<React.ComponentProps<"div">, "children" | "ref"> & {
|
|
98
|
+
/** Shown (faded in) while true. Pass `useScrolled()`. */
|
|
99
|
+
active?: boolean;
|
|
100
|
+
/** Forces the clear glass, as an engine without the bending draws it. */
|
|
101
|
+
fallback?: boolean;
|
|
102
|
+
};
|
|
103
|
+
declare function LiquidGlass({ active, fallback, className, style, ...props }: LiquidGlassProps): React.JSX.Element;
|
|
104
|
+
export { LIQUID_GLASS, LiquidGlass, liquidGlassFilterId, liquidGlassFilterMarkup, liquidGlassMode, scrolledPast, useScrolled, };
|
|
105
|
+
export type { LiquidGlassMode, LiquidGlassProps };
|
|
106
|
+
//# sourceMappingURL=liquid-glass.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"liquid-glass.d.ts","sourceRoot":"","sources":["../../src/blocks/liquid-glass.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH;;;GAGG;AACH,QAAA,MAAM,YAAY;IAChB,iDAAiD;;IAEjD,kDAAkD;;IAElD,sCAAsC;;IAEtC,kCAAkC;;IAElC,6DAA6D;;IAO7D,uDAAuD;;IAEvD,uEAAuE;;IAEvE,+CAA+C;;CAEvC,CAAA;AAEV,oGAAoG;AACpG,QAAA,MAAM,mBAAmB,GAAI,SAAQ,MAA4B,WAAgC,CAAA;AAEjG,KAAK,eAAe,GAAG,MAAM,GAAG,OAAO,CAAA;AAEvC;;;GAGG;AACH,iBAAS,eAAe,CAAC,GAAG,EAAE;IAC5B,aAAa,EAAE,OAAO,CAAA;IACtB,aAAa,EAAE,OAAO,CAAA;IACtB,mBAAmB,EAAE,OAAO,CAAA;IAC5B,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,GAAG,eAAe,CAGlB;AAmCD;;;;;;;;;;GAUG;AACH,iBAAS,uBAAuB,CAAC,MAAM,GAAE,MAA4B,UASpE;AA6DD,+FAA+F;AAC/F,iBAAS,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,WAEtD;AAED;;;;GAIG;AACH,iBAAS,WAAW,CAAC,SAAS,GAAE,MAA+B,EAAE,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,WAW5G;AAoDD,KAAK,gBAAgB,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,UAAU,GAAG,KAAK,CAAC,GAAG;IAC9E,yDAAyD;IACzD,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,yEAAyE;IACzE,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,iBAAS,WAAW,CAAC,EAAE,MAAc,EAAE,QAAgB,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,gBAAgB,qBA0CtG;AAED,OAAO,EACL,YAAY,EACZ,WAAW,EACX,mBAAmB,EACnB,uBAAuB,EACvB,eAAe,EACf,YAAY,EACZ,WAAW,GACZ,CAAA;AACD,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,CAAA"}
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cn } from "../lib/cloudgrid-cn.js";
|
|
5
|
+
/**
|
|
6
|
+
* LIQUID GLASS (ui#541), Asaf's design of 2026-11-20: the full-width band under
|
|
7
|
+
* the Console's floating header that appears once the page is scrolled.
|
|
8
|
+
*
|
|
9
|
+
* Content slides under the header's clusters (the grid menu, the centred pill,
|
|
10
|
+
* the bell and the person) as the page scrolls. The band sits UNDER those
|
|
11
|
+
* clusters and bends what passes behind it like a lens:
|
|
12
|
+
*
|
|
13
|
+
* - **Bend** (where `backdrop-filter: url()` is drawn, i.e. Chromium): an SVG
|
|
14
|
+
* displacement filter as the backdrop filter, pushing most near the top and
|
|
15
|
+
* bottom edges and not at all in the middle (scale 40), then a 6px blur and
|
|
16
|
+
* saturation 1.9, so colours glow through and the header's words read
|
|
17
|
+
* cleanly over busy content.
|
|
18
|
+
* - **Glass** (everywhere else, under reduced motion or reduced transparency,
|
|
19
|
+
* and when `fallback` is set): the clear glass, the scrim's blur token and the
|
|
20
|
+
* same saturation.
|
|
21
|
+
*
|
|
22
|
+
* Both: a sheen of the page colour, 55% at the top, held near half through the
|
|
23
|
+
* header's line and easing to 8% at the bottom, a 1px white highlight along
|
|
24
|
+
* the very top, and a mask that fades the bottom 28% into the page. No border
|
|
25
|
+
* line. Lower down the band it stays see-through and liquid.
|
|
26
|
+
*
|
|
27
|
+
* `active` fades it in (the slow duration, ease out) and out again; the fade is
|
|
28
|
+
* instant under reduced motion. Once faded out it is `visibility: hidden`, so a
|
|
29
|
+
* band at the top of the page costs nothing to draw. Pass `useScrolled()`:
|
|
30
|
+
*
|
|
31
|
+
* const scrolled = useScrolled() // the window
|
|
32
|
+
* const scrolled = useScrolled(4, mainRef) // a scrolling element
|
|
33
|
+
* <LiquidGlass active={scrolled} className="fixed inset-x-0 top-0 z-44" />
|
|
34
|
+
*
|
|
35
|
+
* The caller places it (position, inset, z-index under the clusters) and may
|
|
36
|
+
* change its height (64 by default). It is decorative: `aria-hidden`, no
|
|
37
|
+
* pointer events, never focused.
|
|
38
|
+
*
|
|
39
|
+
* The filter is defined once per page for each band height (one, in the
|
|
40
|
+
* Console: 64 on the desktop, 56 on the phone), in a hidden `<svg>` at the end
|
|
41
|
+
* of `<body>` that the first band to mount adds; the band measures itself to
|
|
42
|
+
* pick it. Until React runs, and in an engine that cannot draw it, the band is
|
|
43
|
+
* the clear glass.
|
|
44
|
+
*/
|
|
45
|
+
/**
|
|
46
|
+
* The design's numbers, strengthened from the mockup's (scale 26, blur 2, a
|
|
47
|
+
* straight 55% to 8% white) so the header reads cleanly over busy content.
|
|
48
|
+
*/
|
|
49
|
+
const LIQUID_GLASS = {
|
|
50
|
+
/** The band's height, px: about the header's. */
|
|
51
|
+
height: 64,
|
|
52
|
+
/** The displacement's scale, px, at the edges. */
|
|
53
|
+
scale: 40,
|
|
54
|
+
/** The blur after the bending, px. */
|
|
55
|
+
blur: 6,
|
|
56
|
+
/** The saturation, both modes. */
|
|
57
|
+
saturate: 1.9,
|
|
58
|
+
/** The page-colour sheen, top to bottom: [alpha %, at %]. */
|
|
59
|
+
sheen: [
|
|
60
|
+
[55, 0],
|
|
61
|
+
[48, 50],
|
|
62
|
+
[30, 75],
|
|
63
|
+
[8, 100],
|
|
64
|
+
],
|
|
65
|
+
/** The 1px highlight's alpha along the very top, %. */
|
|
66
|
+
highlight: 80,
|
|
67
|
+
/** The share of the band at the bottom that fades into the page, %. */
|
|
68
|
+
fade: 28,
|
|
69
|
+
/** `useScrolled`'s default: "a few pixels". */
|
|
70
|
+
threshold: 4,
|
|
71
|
+
};
|
|
72
|
+
/** The filter for a band `height` px tall: one per height on a page, shared by every band of it. */
|
|
73
|
+
const liquidGlassFilterId = (height = LIQUID_GLASS.height) => `cg-liquid-glass-${height}`;
|
|
74
|
+
/**
|
|
75
|
+
* Which glass an environment gets. Bend only where the bending is drawn and
|
|
76
|
+
* nothing asks for less.
|
|
77
|
+
*/
|
|
78
|
+
function liquidGlassMode(env) {
|
|
79
|
+
if (!env.bendSupported || env.reducedMotion || env.reducedTransparency || env.fallback)
|
|
80
|
+
return "glass";
|
|
81
|
+
return "bend";
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* The displacement map, as an opacity down the band: 1 at the top, 0.5 in the
|
|
85
|
+
* middle, 0 at the bottom, steeper near the edges. The filter turns it into the
|
|
86
|
+
* map's channels (G is the opacity, R stays at 0.5), so the content is pushed
|
|
87
|
+
* most near the top and bottom, sideways not at all, and in the middle not at
|
|
88
|
+
* all. At the top a pixel is drawn from below it and at the bottom from above
|
|
89
|
+
* it, so the band never samples past its own edges.
|
|
90
|
+
*
|
|
91
|
+
* Opacities, not colours: only the numbers matter, and no colour is painted.
|
|
92
|
+
*/
|
|
93
|
+
const MAP_STOPS = [
|
|
94
|
+
[0, 1],
|
|
95
|
+
[0.3, 0.59],
|
|
96
|
+
[0.5, 0.5],
|
|
97
|
+
[0.7, 0.41],
|
|
98
|
+
[1, 0],
|
|
99
|
+
];
|
|
100
|
+
function displacementMap() {
|
|
101
|
+
const stops = MAP_STOPS.map(([at, o]) => `<stop offset="${at}" stop-opacity="${o}"/>`).join("");
|
|
102
|
+
const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="1" height="64" viewBox="0 0 1 64" preserveAspectRatio="none">` +
|
|
103
|
+
`<linearGradient id="g" x1="0" y1="0" x2="0" y2="1">${stops}</linearGradient>` +
|
|
104
|
+
`<rect width="1" height="64" fill="url(#g)"/></svg>`;
|
|
105
|
+
return `data:image/svg+xml,${encodeURIComponent(svg)}`;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* The map's opacity into its channels: R and B 0.5, G the opacity, A 1. Rows
|
|
109
|
+
* are R, G, B, A; columns R, G, B, A and a constant.
|
|
110
|
+
*/
|
|
111
|
+
const MAP_CHANNELS = "0 0 0 0 0.5 0 0 0 1 0 0 0 0 0 0.5 0 0 0 0 1";
|
|
112
|
+
/**
|
|
113
|
+
* The `<filter>` the bend mode's backdrop filter points at, for a band
|
|
114
|
+
* `height` px tall. sRGB, so the map's 0.5 means "no shift" (in the default
|
|
115
|
+
* linearRGB it would shift everything).
|
|
116
|
+
*
|
|
117
|
+
* The map is drawn 1px wide and exactly the band's height, in pixels, then
|
|
118
|
+
* tiled across the band, so one filter serves a band of any width. Pixels, not
|
|
119
|
+
* percentages: Chromium draws a percentage-sized `feImage` in a backdrop
|
|
120
|
+
* filter as nothing, which reads as a map of zeros (a flat 20px shift); and
|
|
121
|
+
* bounding-box units scale the shift by the band's width.
|
|
122
|
+
*/
|
|
123
|
+
function liquidGlassFilterMarkup(height = LIQUID_GLASS.height) {
|
|
124
|
+
return (`<filter id="${liquidGlassFilterId(height)}" x="0" y="0" width="100%" height="100%" color-interpolation-filters="sRGB">` +
|
|
125
|
+
`<feImage href="${displacementMap()}" x="0" y="0" width="1" height="${height}" preserveAspectRatio="none" result="tile"/>` +
|
|
126
|
+
`<feTile in="tile" result="ramp"/>` +
|
|
127
|
+
`<feColorMatrix in="ramp" type="matrix" values="${MAP_CHANNELS}" result="map"/>` +
|
|
128
|
+
`<feDisplacementMap in="SourceGraphic" in2="map" scale="${LIQUID_GLASS.scale}" xChannelSelector="R" yChannelSelector="G"/>` +
|
|
129
|
+
`</filter>`);
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Adds the filter for `height` to the page once; every band that tall shares
|
|
133
|
+
* it. All of them live in one hidden `<svg>` at the end of `<body>`.
|
|
134
|
+
*/
|
|
135
|
+
function ensureFilter(height) {
|
|
136
|
+
if (document.getElementById(liquidGlassFilterId(height)))
|
|
137
|
+
return;
|
|
138
|
+
let svg = document.querySelector('svg[data-slot="liquid-glass-filter"]');
|
|
139
|
+
if (!svg) {
|
|
140
|
+
svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
141
|
+
svg.setAttribute("data-slot", "liquid-glass-filter");
|
|
142
|
+
svg.setAttribute("aria-hidden", "true");
|
|
143
|
+
svg.setAttribute("width", "0");
|
|
144
|
+
svg.setAttribute("height", "0");
|
|
145
|
+
svg.setAttribute("style", "position:absolute;width:0;height:0;overflow:hidden");
|
|
146
|
+
document.body.appendChild(svg);
|
|
147
|
+
}
|
|
148
|
+
svg.insertAdjacentHTML("beforeend", liquidGlassFilterMarkup(height));
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Whether the engine draws an SVG filter as a backdrop filter. Feature queries
|
|
152
|
+
* only, no user agent. WebKit parses `url()` in `backdrop-filter` and answers
|
|
153
|
+
* yes, but does not draw it; it is also the one engine that still answers for
|
|
154
|
+
* the prefixed `-webkit-backdrop-filter`, so a yes there means the clear glass.
|
|
155
|
+
* Should Chromium ever add the prefix, the band falls back, never breaks.
|
|
156
|
+
*/
|
|
157
|
+
function bendSupported() {
|
|
158
|
+
if (typeof CSS === "undefined" || typeof CSS.supports !== "function")
|
|
159
|
+
return false;
|
|
160
|
+
return CSS.supports("backdrop-filter", `url(#${liquidGlassFilterId()})`) && !CSS.supports("-webkit-backdrop-filter", "none");
|
|
161
|
+
}
|
|
162
|
+
const REDUCED_MOTION = "(prefers-reduced-motion: reduce)";
|
|
163
|
+
const REDUCED_TRANSPARENCY = "(prefers-reduced-transparency: reduce)";
|
|
164
|
+
function subscribeToPreferences(onChange) {
|
|
165
|
+
if (typeof window === "undefined" || typeof window.matchMedia !== "function")
|
|
166
|
+
return () => { };
|
|
167
|
+
const queries = [window.matchMedia(REDUCED_MOTION), window.matchMedia(REDUCED_TRANSPARENCY)];
|
|
168
|
+
for (const q of queries)
|
|
169
|
+
q.addEventListener("change", onChange);
|
|
170
|
+
return () => {
|
|
171
|
+
for (const q of queries)
|
|
172
|
+
q.removeEventListener("change", onChange);
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
const matches = (query) => typeof window.matchMedia === "function" && window.matchMedia(query).matches;
|
|
176
|
+
function useLiquidGlassMode(fallback) {
|
|
177
|
+
return React.useSyncExternalStore(subscribeToPreferences, () => liquidGlassMode({
|
|
178
|
+
bendSupported: bendSupported(),
|
|
179
|
+
reducedMotion: matches(REDUCED_MOTION),
|
|
180
|
+
reducedTransparency: matches(REDUCED_TRANSPARENCY),
|
|
181
|
+
fallback,
|
|
182
|
+
}), () => "glass");
|
|
183
|
+
}
|
|
184
|
+
/** Scrolled means past the threshold, not at it; an overscroll bounce above the top is not. */
|
|
185
|
+
function scrolledPast(offset, threshold) {
|
|
186
|
+
return offset > threshold;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* True once `target` (or the window) has scrolled past `threshold` px, false
|
|
190
|
+
* again at the top. Passive listener; re-renders only when the answer changes.
|
|
191
|
+
* False on the server and until the first effect.
|
|
192
|
+
*/
|
|
193
|
+
function useScrolled(threshold = LIQUID_GLASS.threshold, target) {
|
|
194
|
+
const [scrolled, setScrolled] = React.useState(false);
|
|
195
|
+
React.useEffect(() => {
|
|
196
|
+
const el = target?.current ?? null;
|
|
197
|
+
const source = el ?? window;
|
|
198
|
+
const read = () => setScrolled(scrolledPast(el ? el.scrollTop : window.scrollY, threshold));
|
|
199
|
+
read();
|
|
200
|
+
source.addEventListener("scroll", read, { passive: true });
|
|
201
|
+
return () => source.removeEventListener("scroll", read);
|
|
202
|
+
}, [threshold, target]);
|
|
203
|
+
return scrolled;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Everything a utility class cannot carry cleanly: the two backdrop filters,
|
|
207
|
+
* the sheen and highlight, the mask, and the fade with its reduced-motion
|
|
208
|
+
* override. Emitted as a React 19 hoistable stylesheet (`href` + `precedence`),
|
|
209
|
+
* once however many bands render, in `@layer components` under the consumer's
|
|
210
|
+
* utilities, so a `className` can set the position and the height. It declares
|
|
211
|
+
* Tailwind v4's layer order first, as `ShowcaseScroll`'s does.
|
|
212
|
+
*
|
|
213
|
+
* The sheen is the page colour (--cg-surface-page, the same on every surface)
|
|
214
|
+
* and the highlight white (--cg-neutral-0), each at its alpha through
|
|
215
|
+
* `color-mix`, so the band melts into the Console's page.
|
|
216
|
+
*/
|
|
217
|
+
const white = (alpha) => `color-mix(in srgb, var(--cg-neutral-0) ${alpha}%, transparent)`;
|
|
218
|
+
const page = (alpha) => `color-mix(in srgb, var(--cg-surface-page) ${alpha}%, transparent)`;
|
|
219
|
+
const L = LIQUID_GLASS;
|
|
220
|
+
const STYLES = `
|
|
221
|
+
@layer theme, base, components, utilities;
|
|
222
|
+
@layer components {
|
|
223
|
+
[data-slot="liquid-glass"] {
|
|
224
|
+
height: ${L.height}px;
|
|
225
|
+
pointer-events: none;
|
|
226
|
+
opacity: 0;
|
|
227
|
+
visibility: hidden;
|
|
228
|
+
background-image: linear-gradient(to bottom, ${L.sheen.map(([alpha, at]) => `${page(alpha)} ${at}%`).join(", ")});
|
|
229
|
+
box-shadow: inset 0 1px 0 ${white(L.highlight)};
|
|
230
|
+
-webkit-mask-image: linear-gradient(to bottom, black ${100 - L.fade}%, transparent);
|
|
231
|
+
mask-image: linear-gradient(to bottom, black ${100 - L.fade}%, transparent);
|
|
232
|
+
transition: opacity var(--cg-duration-slow) var(--cg-ease-out), visibility 0s linear var(--cg-duration-slow);
|
|
233
|
+
}
|
|
234
|
+
[data-slot="liquid-glass"][data-active] {
|
|
235
|
+
opacity: 1;
|
|
236
|
+
visibility: visible;
|
|
237
|
+
transition: opacity var(--cg-duration-slow) var(--cg-ease-out), visibility 0s;
|
|
238
|
+
}
|
|
239
|
+
[data-slot="liquid-glass"][data-mode="glass"] {
|
|
240
|
+
-webkit-backdrop-filter: blur(var(--cg-scrim-blur)) saturate(${L.saturate});
|
|
241
|
+
backdrop-filter: blur(var(--cg-scrim-blur)) saturate(${L.saturate});
|
|
242
|
+
}
|
|
243
|
+
[data-slot="liquid-glass"][data-mode="bend"] {
|
|
244
|
+
backdrop-filter: var(--cg-liquid-glass-filter) blur(${L.blur}px) saturate(${L.saturate});
|
|
245
|
+
}
|
|
246
|
+
@media (prefers-reduced-motion: reduce) {
|
|
247
|
+
[data-slot="liquid-glass"],
|
|
248
|
+
[data-slot="liquid-glass"][data-active] {
|
|
249
|
+
transition: none;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
`;
|
|
254
|
+
function LiquidGlass({ active = false, fallback = false, className, style, ...props }) {
|
|
255
|
+
const mode = useLiquidGlassMode(fallback);
|
|
256
|
+
const ref = React.useRef(null);
|
|
257
|
+
// The band's own height, whole pixels: the filter's map is drawn to it. Null
|
|
258
|
+
// until measured, so no filter is added for a height the band does not have;
|
|
259
|
+
// the layout effect's update lands before the first paint.
|
|
260
|
+
const [height, setHeight] = React.useState(null);
|
|
261
|
+
React.useLayoutEffect(() => {
|
|
262
|
+
const el = ref.current;
|
|
263
|
+
if (mode !== "bend" || !el)
|
|
264
|
+
return;
|
|
265
|
+
const measure = () => setHeight(Math.max(1, Math.round(el.getBoundingClientRect().height)));
|
|
266
|
+
measure();
|
|
267
|
+
if (typeof ResizeObserver === "undefined")
|
|
268
|
+
return;
|
|
269
|
+
const observer = new ResizeObserver(measure);
|
|
270
|
+
observer.observe(el);
|
|
271
|
+
return () => observer.disconnect();
|
|
272
|
+
}, [mode]);
|
|
273
|
+
// Before the band's new mode reaches the DOM, so `url()` never points at nothing.
|
|
274
|
+
React.useInsertionEffect(() => {
|
|
275
|
+
if (mode === "bend" && height !== null)
|
|
276
|
+
ensureFilter(height);
|
|
277
|
+
}, [mode, height]);
|
|
278
|
+
return (_jsxs(_Fragment, { children: [_jsx("style", { href: "cg-liquid-glass", precedence: "medium", children: STYLES }), _jsx("div", { ref: ref, "data-slot": "liquid-glass", "data-mode": mode, "data-active": active ? "" : undefined, "aria-hidden": "true", className: cn(className), style: mode === "bend" && height !== null
|
|
279
|
+
? { ...style, "--cg-liquid-glass-filter": `url(#${liquidGlassFilterId(height)})` }
|
|
280
|
+
: style, ...props })] }));
|
|
281
|
+
}
|
|
282
|
+
export { LIQUID_GLASS, LiquidGlass, liquidGlassFilterId, liquidGlassFilterMarkup, liquidGlassMode, scrolledPast, useScrolled, };
|
|
283
|
+
//# sourceMappingURL=liquid-glass.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"liquid-glass.js","sourceRoot":"","sources":["../../src/blocks/liquid-glass.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAA;AAEvC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH;;;GAGG;AACH,MAAM,YAAY,GAAG;IACnB,iDAAiD;IACjD,MAAM,EAAE,EAAE;IACV,kDAAkD;IAClD,KAAK,EAAE,EAAE;IACT,sCAAsC;IACtC,IAAI,EAAE,CAAC;IAC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KAAK,WAAW;YAAE,OAAM;QACjD,MAAM,QAAQ,GAAG,IAAI,cAAc,CAAC,OAAO,CAAC,CAAA;QAC5C,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;QACpB,OAAO,GAAG,EAAE,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAA;IACpC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAA;IACV,kFAAkF;IAClF,KAAK,CAAC,kBAAkB,CAAC,GAAG,EAAE;QAC5B,IAAI,IAAI,KAAK,MAAM,IAAI,MAAM,KAAK,IAAI;YAAE,YAAY,CAAC,MAAM,CAAC,CAAA;IAC9D,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAA;IAClB,OAAO,CACL,8BACE,gBAAO,IAAI,EAAC,iBAAiB,EAAC,UAAU,EAAC,QAAQ,YAC9C,MAAM,GACD,EACR,cACE,GAAG,EAAE,GAAG,eACE,cAAc,eACb,IAAI,iBACF,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,iBACxB,MAAM,EAClB,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,EACxB,KAAK,EACH,IAAI,KAAK,MAAM,IAAI,MAAM,KAAK,IAAI;oBAChC,CAAC,CAAE,EAAE,GAAG,KAAK,EAAE,0BAA0B,EAAE,QAAQ,mBAAmB,CAAC,MAAM,CAAC,GAAG,EAA0B;oBAC3G,CAAC,CAAC,KAAK,KAEP,KAAK,GACT,IACD,CACJ,CAAA;AACH,CAAC;AAED,OAAO,EACL,YAAY,EACZ,WAAW,EACX,mBAAmB,EACnB,uBAAuB,EACvB,eAAe,EACf,YAAY,EACZ,WAAW,GACZ,CAAA"}
|
package/dist/blocks/meter.d.ts
CHANGED
|
@@ -79,9 +79,12 @@ export declare function meterShare(value: number, min?: number, max?: number): n
|
|
|
79
79
|
/**
|
|
80
80
|
* The bar's palette (#382). `accent` is the default: the accent text role on a
|
|
81
81
|
* hairline track. `secondary` is Home's three boxes (spec §4.6, Figma
|
|
82
|
-
* `11323:8966`): the lime Secondary fill on a page-coloured track.
|
|
82
|
+
* `11323:8966`): the lime Secondary fill on a page-coloured track. `home` is
|
|
83
|
+
* the 2026 Home's My top creations (ui#539): the same lime on a soft violet
|
|
84
|
+
* track (`--cg-violet-100`), which is a raw rung and does not flip, so on the
|
|
85
|
+
* panel and on ink the track is the hairline, a step off the surface there.
|
|
83
86
|
*/
|
|
84
|
-
export type MeterTone = "accent" | "secondary";
|
|
87
|
+
export type MeterTone = "accent" | "secondary" | "home";
|
|
85
88
|
declare function Meter({ value, min, max, label, valueText, locale, size, tone, pending, levels, className, ...props }: Omit<React.ComponentProps<"div">, "children" | "role"> & {
|
|
86
89
|
/** The measurement. Clamped to `min`..`max`. */
|
|
87
90
|
value: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meter.d.ts","sourceRoot":"","sources":["../../src/blocks/meter.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAM9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AAEH,2FAA2F;AAC3F,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,IAAI,GAAG,IAAI,CAAA;AAQ/C,wDAAwD;AACxD,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,CAAA;AAEtD,wDAAwD;AACxD,MAAM,MAAM,oBAAoB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAA;AAEpE,uEAAuE;AACvE,eAAO,MAAM,sBAAsB,EAAE,oBAAgD,CAAA;AAErF,uDAAuD;AACvD,wBAAgB,UAAU,CACxB,KAAK,EAAE,MAAM,EACb,UAAU,GAAE,oBAA6C,GACxD,UAAU,CAIZ;AAED;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC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SAAS,EACT,MAAgB,EAChB,IAAgB,EAChB,IAAe,EACf,OAAe,EACf,MAAM,EACN,SAAS,EACT,GAAG,KAAK,EACT,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC,GAAG;IAC1D,gDAAgD;IAChD,KAAK,EAAE,MAAM,CAAA;IACb,iBAAiB;IACjB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,mBAAmB;IACnB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,4CAA4C;IAC5C,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,6EAA6E;IAC7E,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,yDAAyD;IACzD,MAAM,CAAC,EAAE,IAAI,CAAC,eAAe,CAAA;IAC7B,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,wEAAwE;IACxE,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,mEAAmE;IACnE,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,GAAG,oBAAoB,CAAA;CACxC,qBAuDA;AAED,OAAO,EAAE,KAAK,EAAE,CAAA"}
|
package/dist/blocks/meter.js
CHANGED
|
@@ -36,6 +36,10 @@ export function meterShare(value, min = 0, max = 100) {
|
|
|
36
36
|
const TONE = {
|
|
37
37
|
accent: { track: "bg-hairline", fill: "bg-(--cg-text-accent)" },
|
|
38
38
|
secondary: { track: "bg-page", fill: "bg-lime" },
|
|
39
|
+
home: {
|
|
40
|
+
track: "bg-brand-100 in-data-[cg-surface=panel]:bg-hairline in-data-[cg-surface=ink]:bg-hairline",
|
|
41
|
+
fill: "bg-lime",
|
|
42
|
+
},
|
|
39
43
|
};
|
|
40
44
|
function Meter({ value, min = 0, max = 100, label, valueText, locale = "en-US", size = "default", tone = "accent", pending = false, levels, className, ...props }) {
|
|
41
45
|
if (pending) {
|
package/dist/blocks/meter.js.map
CHANGED
|
@@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
+
/**
|
|
3
|
+
* Three small motion pieces for the Console's Home (ui#533). Each renders its
|
|
4
|
+
* final state and moves into it once, when it mounts; under reduced motion it
|
|
5
|
+
* shows the final state at once. The how and the why are in `lib/motion.ts`,
|
|
6
|
+
* which fetches gsap the first time one of them moves (ui#554).
|
|
7
|
+
*
|
|
8
|
+
* Every root carries `data-motion`: `running`, then `done`; or `static` when
|
|
9
|
+
* there was nothing to move or the reader asked for reduced motion. A piece
|
|
10
|
+
* still waiting for gsap, on a page's first motion, carries none yet.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* A figure that counts up from 0 to the caller's value when it mounts, in the
|
|
14
|
+
* caller's own format: give it "214", "12 min" or "1.2K" and it counts
|
|
15
|
+
* 0 → 214, 0 min → 12 min, 0.0K → 1.2K. Words ("—", "Static") stay words.
|
|
16
|
+
* A later value counts from the one on screen.
|
|
17
|
+
*
|
|
18
|
+
* Three copies of the text, one job each: a hidden one holds the final width,
|
|
19
|
+
* so the figure never pushes its neighbours while it counts; the visible one
|
|
20
|
+
* counts and is hidden from a screen reader; and a screen reader hears the
|
|
21
|
+
* final text once, never the frames in between. Type, colour and alignment are
|
|
22
|
+
* the parent's: the counting copy inherits `text-align`, so a right-aligned
|
|
23
|
+
* column counts right-aligned.
|
|
24
|
+
*/
|
|
25
|
+
declare function AnimatedNumber({ value, className, ...props }: Omit<React.ComponentProps<"span">, "children"> & {
|
|
26
|
+
/** The figure as the caller formats it, or a number to print as it is. */
|
|
27
|
+
value: string | number;
|
|
28
|
+
}): React.JSX.Element;
|
|
29
|
+
/**
|
|
30
|
+
* Fills every `Meter` inside it from 0 to its width when it mounts, in the time
|
|
31
|
+
* an `AnimatedNumber` counts, so a bar and its number land together. The
|
|
32
|
+
* wrapper is `display: contents`: the meter lays out exactly as it would
|
|
33
|
+
* without it, and its value, label and markup are unchanged. The fill grows
|
|
34
|
+
* from the start edge (the right, in a right-to-left page) and leaves no inline
|
|
35
|
+
* style behind.
|
|
36
|
+
*/
|
|
37
|
+
declare function MeterFill({ children }: {
|
|
38
|
+
children: React.ReactNode;
|
|
39
|
+
}): React.JSX.Element;
|
|
40
|
+
/**
|
|
41
|
+
* Its children appear one by one when it mounts: each fades in and rises 8px,
|
|
42
|
+
* 0.08s after the one before. Used on the cards of an empty Home. The
|
|
43
|
+
* children are laid out by the caller's classes on this div (a grid, a row);
|
|
44
|
+
* once they are in, nothing is left inline.
|
|
45
|
+
*/
|
|
46
|
+
declare function StaggerReveal({ className, children, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
47
|
+
export { AnimatedNumber, MeterFill, StaggerReveal };
|
|
48
|
+
//# sourceMappingURL=motion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"motion.d.ts","sourceRoot":"","sources":["../../src/blocks/motion.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAgB9B;;;;;;;;;GASG;AAEH;;;;;;;;;;;;GAYG;AACH,iBAAS,cAAc,CAAC,EACtB,KAAK,EACL,SAAS,EACT,GAAG,KAAK,EACT,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC,GAAG;IAClD,0EAA0E;IAC1E,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;CACvB,qBAsDA;AAED;;;;;;;GAOG;AACH,iBAAS,SAAS,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,qBAqC7D;AAED;;;;;GAKG;AACH,iBAAS,aAAa,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAmCpF;AAED,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,aAAa,EAAE,CAAA"}
|