@cloudgrid-io/ui 0.33.0 → 0.34.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 +25 -0
- package/dist/badge/css-live.d.ts +7 -4
- package/dist/badge/css-live.d.ts.map +1 -1
- package/dist/badge/css-live.js +9 -6
- package/dist/badge/css-live.js.map +1 -1
- package/dist/badge/palette.d.ts +1 -1
- package/dist/badge/palette.d.ts.map +1 -1
- package/dist/badge/palette.js +2 -1
- package/dist/badge/palette.js.map +1 -1
- package/dist/blocks/bar-chart.d.ts +97 -0
- package/dist/blocks/bar-chart.d.ts.map +1 -0
- package/dist/blocks/bar-chart.js +25 -0
- package/dist/blocks/bar-chart.js.map +1 -0
- package/dist/blocks/chart-parts.d.ts +101 -0
- package/dist/blocks/chart-parts.d.ts.map +1 -0
- package/dist/blocks/chart-parts.js +96 -0
- package/dist/blocks/chart-parts.js.map +1 -0
- package/dist/blocks/coming-soon-tag.d.ts +34 -0
- package/dist/blocks/coming-soon-tag.d.ts.map +1 -0
- package/dist/blocks/coming-soon-tag.js +37 -0
- package/dist/blocks/coming-soon-tag.js.map +1 -0
- package/dist/blocks/disabled-button.d.ts +43 -0
- package/dist/blocks/disabled-button.d.ts.map +1 -0
- package/dist/blocks/disabled-button.js +50 -0
- package/dist/blocks/disabled-button.js.map +1 -0
- package/dist/blocks/entity-card.d.ts.map +1 -1
- package/dist/blocks/entity-card.js +3 -1
- package/dist/blocks/entity-card.js.map +1 -1
- package/dist/blocks/full-screen-button.d.ts +9 -0
- package/dist/blocks/full-screen-button.d.ts.map +1 -0
- package/dist/blocks/full-screen-button.js +51 -0
- package/dist/blocks/full-screen-button.js.map +1 -0
- package/dist/blocks/icons.d.ts +30 -0
- package/dist/blocks/icons.d.ts.map +1 -1
- package/dist/blocks/icons.js +30 -0
- package/dist/blocks/icons.js.map +1 -1
- package/dist/blocks/meter.d.ts +57 -0
- package/dist/blocks/meter.d.ts.map +1 -0
- package/dist/blocks/meter.js +19 -0
- package/dist/blocks/meter.js.map +1 -0
- package/dist/blocks/notice.d.ts +87 -0
- package/dist/blocks/notice.d.ts.map +1 -0
- package/dist/blocks/notice.js +26 -0
- package/dist/blocks/notice.js.map +1 -0
- package/dist/blocks/pager.d.ts +76 -0
- package/dist/blocks/pager.d.ts.map +1 -0
- package/dist/blocks/pager.js +86 -0
- package/dist/blocks/pager.js.map +1 -0
- package/dist/blocks/phosphor-marks.d.ts +20 -0
- package/dist/blocks/phosphor-marks.d.ts.map +1 -1
- package/dist/blocks/phosphor-marks.js +30 -0
- package/dist/blocks/phosphor-marks.js.map +1 -1
- package/dist/blocks/ranked-list.d.ts +67 -0
- package/dist/blocks/ranked-list.d.ts.map +1 -0
- package/dist/blocks/ranked-list.js +32 -0
- package/dist/blocks/ranked-list.js.map +1 -0
- package/dist/blocks/side-nav.d.ts.map +1 -1
- package/dist/blocks/side-nav.js +3 -1
- package/dist/blocks/side-nav.js.map +1 -1
- package/dist/blocks/sign-in-options.d.ts.map +1 -1
- package/dist/blocks/sign-in-options.js +3 -1
- package/dist/blocks/sign-in-options.js.map +1 -1
- package/dist/blocks/stacked-bar.d.ts +64 -0
- package/dist/blocks/stacked-bar.d.ts.map +1 -0
- package/dist/blocks/stacked-bar.js +18 -0
- package/dist/blocks/stacked-bar.js.map +1 -0
- package/dist/blocks/stat-tile.d.ts +42 -1
- package/dist/blocks/stat-tile.d.ts.map +1 -1
- package/dist/blocks/stat-tile.js +23 -4
- package/dist/blocks/stat-tile.js.map +1 -1
- package/dist/blocks/tab-bar.d.ts.map +1 -1
- package/dist/blocks/tab-bar.js +3 -1
- package/dist/blocks/tab-bar.js.map +1 -1
- package/dist/blocks/timeline.d.ts +53 -0
- package/dist/blocks/timeline.d.ts.map +1 -0
- package/dist/blocks/timeline.js +18 -0
- package/dist/blocks/timeline.js.map +1 -0
- package/dist/blocks/tool-setup.d.ts.map +1 -1
- package/dist/blocks/tool-setup.js +3 -1
- package/dist/blocks/tool-setup.js.map +1 -1
- package/dist/blocks/trend.d.ts +33 -0
- package/dist/blocks/trend.d.ts.map +1 -0
- package/dist/blocks/trend.js +13 -0
- package/dist/blocks/trend.js.map +1 -0
- package/dist/claim-banner/css.d.ts +39 -0
- package/dist/claim-banner/css.d.ts.map +1 -0
- package/dist/claim-banner/css.js +87 -0
- package/dist/claim-banner/css.js.map +1 -0
- package/dist/claim-banner/index.d.ts +122 -0
- package/dist/claim-banner/index.d.ts.map +1 -0
- package/dist/claim-banner/index.js +135 -0
- package/dist/claim-banner/index.js.map +1 -0
- package/dist/docs.css +466 -0
- package/dist/expressive-code-palette.d.ts +5 -0
- package/dist/expressive-code-palette.d.ts.map +1 -0
- package/dist/expressive-code-palette.js +10 -0
- package/dist/expressive-code-palette.js.map +1 -0
- package/dist/expressive-code.d.ts +57 -0
- package/dist/expressive-code.d.ts.map +1 -0
- package/dist/expressive-code.js +101 -0
- package/dist/expressive-code.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -1
- package/dist/tokens/base.json +13 -0
- package/dist/tokens/surface-ink.json +13 -0
- package/dist/tokens/surface-panel.json +13 -0
- package/dist/tokens.css +36 -0
- package/dist/tokens.json +6 -3
- package/dist/ui/card.d.ts +23 -2
- package/dist/ui/card.d.ts.map +1 -1
- package/dist/ui/card.js +16 -5
- package/dist/ui/card.js.map +1 -1
- package/dist/ui/drawer.d.ts +37 -6
- package/dist/ui/drawer.d.ts.map +1 -1
- package/dist/ui/drawer.js +31 -7
- package/dist/ui/drawer.js.map +1 -1
- package/dist/ui/input-group.d.ts.map +1 -1
- package/dist/ui/input-group.js +3 -1
- package/dist/ui/input-group.js.map +1 -1
- package/package.json +18 -3
package/README.md
CHANGED
|
@@ -62,6 +62,29 @@ The order matters, and getting it wrong fails quietly rather than loudly.
|
|
|
62
62
|
Not using the Console's face: skip the `console.css` line. Not using shadcn: skip the last line. Not using Tailwind: `tokens.css` alone gives you every
|
|
63
63
|
value as a custom property.
|
|
64
64
|
|
|
65
|
+
### The docs site (Starlight)
|
|
66
|
+
|
|
67
|
+
The docs site is not Tailwind. It takes three stylesheets through Starlight's `customCss`, in this
|
|
68
|
+
order, and the code-block configuration in one line:
|
|
69
|
+
|
|
70
|
+
```js
|
|
71
|
+
import { cloudgridExpressiveCode } from "@cloudgrid-io/ui/expressive-code"
|
|
72
|
+
|
|
73
|
+
starlight({
|
|
74
|
+
customCss: [
|
|
75
|
+
"@cloudgrid-io/ui/fonts.css",
|
|
76
|
+
"@cloudgrid-io/ui/tokens.css",
|
|
77
|
+
"@cloudgrid-io/ui/docs.css",
|
|
78
|
+
],
|
|
79
|
+
expressiveCode: cloudgridExpressiveCode,
|
|
80
|
+
})
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
`docs.css` maps Starlight's `--sl-*` variables onto the tokens and adds a few targeted rules. It
|
|
84
|
+
is light only: it styles no dark scope, so the site must force the light theme and drop the
|
|
85
|
+
theme picker (override Starlight's `ThemeProvider` and `ThemeSelect`). It has to come after
|
|
86
|
+
`tokens.css`, which every value in it reads.
|
|
87
|
+
|
|
65
88
|
## Point Tailwind at the package
|
|
66
89
|
|
|
67
90
|
Tailwind v4 ignores `node_modules` when it scans for classes, so utilities used only inside
|
|
@@ -128,6 +151,8 @@ rest).
|
|
|
128
151
|
|---|---|
|
|
129
152
|
| `@cloudgrid-io/ui/tokens.css` | every value as a CSS custom property |
|
|
130
153
|
| `@cloudgrid-io/ui/console.css` | product preset: body and display type set to Manrope |
|
|
154
|
+
| `@cloudgrid-io/ui/docs.css` | product preset: the Starlight docs site, light only, see below |
|
|
155
|
+
| `@cloudgrid-io/ui/expressive-code` | the docs site's code blocks: Expressive Code theme and overrides, monochrome on ink |
|
|
131
156
|
| `@cloudgrid-io/ui/theme.css` | maps Tailwind utilities onto the tokens |
|
|
132
157
|
| `@cloudgrid-io/ui/shadcn.css` | maps shadcn's variables onto the tokens |
|
|
133
158
|
| `@cloudgrid-io/ui/fonts.css` | the three self-hosted families |
|
package/dist/badge/css-live.d.ts
CHANGED
|
@@ -6,10 +6,13 @@
|
|
|
6
6
|
* caption size (13px, the type floor; the design draws 12) in the UI face.
|
|
7
7
|
*
|
|
8
8
|
* The sign is ONE white box under three mask layers: the plug glyph, a cover
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
9
|
+
* and a disc. The mask is glyph + (cover x disc). The cover is twice the box's
|
|
10
|
+
* height, opaque on top and clear below. At rest its clear half sits over the
|
|
11
|
+
* box, so only the glyph shows; the arrival starts its opaque half over the box,
|
|
12
|
+
* so the whole disc is white, and slides it up, which cuts the plug out of the
|
|
13
|
+
* disc from the bottom up. The cover always paints over the box: WebKit leaves
|
|
14
|
+
* the layers below untouched wherever a layer paints nothing, so a cover parked
|
|
15
|
+
* outside the box kept the whole disc white there (ui issue 346).
|
|
13
16
|
*
|
|
14
17
|
* Arrival (from `--cgb-start`, default 300ms): the pill rises 500ms; the sign
|
|
15
18
|
* swells from 70% at +150ms and the cut starts at +200ms; the pill opens to
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"css-live.d.ts","sourceRoot":"","sources":["../../src/badge/css-live.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"css-live.d.ts","sourceRoot":"","sources":["../../src/badge/css-live.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAoBH,eAAO,MAAM,cAAc,EAAE,MAwBpB,CAAA"}
|
package/dist/badge/css-live.js
CHANGED
|
@@ -6,10 +6,13 @@
|
|
|
6
6
|
* caption size (13px, the type floor; the design draws 12) in the UI face.
|
|
7
7
|
*
|
|
8
8
|
* The sign is ONE white box under three mask layers: the plug glyph, a cover
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
9
|
+
* and a disc. The mask is glyph + (cover x disc). The cover is twice the box's
|
|
10
|
+
* height, opaque on top and clear below. At rest its clear half sits over the
|
|
11
|
+
* box, so only the glyph shows; the arrival starts its opaque half over the box,
|
|
12
|
+
* so the whole disc is white, and slides it up, which cuts the plug out of the
|
|
13
|
+
* disc from the bottom up. The cover always paints over the box: WebKit leaves
|
|
14
|
+
* the layers below untouched wherever a layer paints nothing, so a cover parked
|
|
15
|
+
* outside the box kept the whole disc white there (ui issue 346).
|
|
13
16
|
*
|
|
14
17
|
* Arrival (from `--cgb-start`, default 300ms): the pill rises 500ms; the sign
|
|
15
18
|
* swells from 70% at +150ms and the cut starts at +200ms; the pill opens to
|
|
@@ -36,13 +39,13 @@ const GLYPH_MASK = 'url("data:image/svg+xml,' +
|
|
|
36
39
|
encodeURIComponent(`<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='53 14.977 41 41'><path d='${SIGN_GLYPH_PATH}'/></svg>`) +
|
|
37
40
|
'")';
|
|
38
41
|
// A mask reads only alpha, so any opaque token draws "keep"; the ink is one.
|
|
39
|
-
const MASK = `${GLYPH_MASK},linear-gradient(var(--cg-text-primary)
|
|
42
|
+
const MASK = `${GLYPH_MASK},linear-gradient(var(--cg-text-primary) 50%,transparent 50%),radial-gradient(circle at 10.04px 10.1px,var(--cg-text-primary) 9.25px,transparent 9.75px)`;
|
|
40
43
|
export const BADGE_LIVE_CSS = /* @__PURE__ */ (() => `.cgb-live-wrap{--cgb-t0:var(--cgb-start,300ms);position:absolute;left:calc(12px + env(safe-area-inset-left,0px));bottom:calc(12px + env(safe-area-inset-bottom,0px));padding-top:22px}
|
|
41
44
|
.cgb-live{position:relative;display:flex;align-items:center;width:max-content;height:28px;padding:4px;border-radius:var(--cg-radius-pill);background:var(--cg-primary);color:var(--cg-text-on-primary);` +
|
|
42
45
|
`text-decoration:none;box-shadow:var(--cg-shadow-card);cursor:pointer;animation:cgb-rise 500ms var(--cg-ease-out-expo) var(--cgb-t0) both}
|
|
43
46
|
.cgb-live:focus-visible{outline:2px solid var(--cg-primary);outline-offset:2px}
|
|
44
47
|
.cgb-live-icon{flex:none;width:20px;height:20px;background:var(--cg-text-on-primary);` +
|
|
45
|
-
`-webkit-mask-image:${MASK};mask-image:${MASK};-webkit-mask-size:20px 20px;mask-size:20px 20px;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;` +
|
|
48
|
+
`-webkit-mask-image:${MASK};mask-image:${MASK};-webkit-mask-size:20px 20px,20px 40px,20px 20px;mask-size:20px 20px,20px 40px,20px 20px;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;` +
|
|
46
49
|
`-webkit-mask-composite:source-over,source-in,source-over;mask-composite:add,intersect,add;-webkit-mask-position:0 0,0 -20px,0 0;mask-position:0 0,0 -20px,0 0;` +
|
|
47
50
|
`animation:cgb-plug 480ms var(--cg-ease-in-out-cubic) calc(var(--cgb-t0) + 200ms) both,cgb-swell 560ms var(--cg-ease-spring) calc(var(--cgb-t0) + 150ms) both;` +
|
|
48
51
|
`transition:transform 420ms var(--cg-ease-spring)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"css-live.js","sourceRoot":"","sources":["../../src/badge/css-live.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"css-live.js","sourceRoot":"","sources":["../../src/badge/css-live.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAE1C;;;;GAIG;AACH,MAAM,UAAU,GACd,0BAA0B;IAC1B,kBAAkB,CAChB,qGAAqG,eAAe,WAAW,CAChI;IACD,IAAI,CAAA;AAEN,6EAA6E;AAC7E,MAAM,IAAI,GAAG,GAAG,UAAU,yJAAyJ,CAAA;AAEnL,MAAM,CAAC,MAAM,cAAc,GAAW,eAAe,CAAC,CAAC,GAAG,EAAE,CAC1D;wMACsM;IACtM;;sFAEoF;IACpF,sBAAsB,IAAI,eAAe,IAAI,+IAA+I;IAC5L,gKAAgK;IAChK,+JAA+J;IAC/J;;;;;;qLAMmL;IACnL;;;;;;CAMD;IACC,UAAU,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,+FAA+F,CAAC;IACtH,IAAI,CAAC,EAAE,CAAA"}
|
package/dist/badge/palette.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Every badge token as one declaration list, for the badge root's rule. */
|
|
2
|
-
export declare const BADGE_TOKEN_DECLARATIONS = "--cg-primary:#5a47f0;--cg-primary-press:#4b39db;--cg-primary-tint:#eeecfe;--cg-secondary:#b6de68;--cg-tertiary:#60e9f0;--cg-tertiary-press:#4dd8e0;--cg-accent:#0061f0;--cg-cyan-200:#dffbfc;--cg-lime-200:#eef7dc;--cg-surface-card:#ffffff;--cg-surface-raised:#f4f6f8;--cg-surface-control:#e3e3e3;--cg-surface-subtle:#f2f1f7;--cg-hover:rgba(34, 34, 34, 0.045);--cg-scrim:rgba(34, 34, 34, 0.4);--cg-text-primary:#222222;--cg-text-secondary:#595959;--cg-text-muted:#858585;--cg-text-muted-strong:#6a6a6a;--cg-text-placeholder:#acacac;--cg-text-accent:#5a47f0;--cg-text-on-primary:#ffffff;--cg-text-on-accent:#222222;--cg-border-hairline:#e6e8ea;--cg-border-control:#e3e3e3;--cg-border-accent:#5a47f0;--cg-focus-ring:rgba(90, 71, 240, 0.28);--cg-online:#00a05c;--cg-online-fill:#e6f7ef;--cg-online-strong:#085d3a;--cg-expired-fill:#fdf3e0;--cg-expired-border:#fedf89;--cg-expired-strong:#7a3d0a;--cg-font-ui:'Manrope Variable', 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;--cg-font-body:'Space Grotesk Variable', 'Space Grotesk', 'Manrope Variable', 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;--cg-font-mono:'JetBrains Mono Variable', 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;--cg-weight-regular:400;--cg-weight-medium:500;--cg-weight-bold:600;--cg-body-18:18px;--cg-body-md:16px;--cg-body-sm:15px;--cg-body-14:14px;--cg-caption:13px;--cg-body-line:1.46;--cg-mono-size:14px;--cg-mono-line:1.7;--cg-radius-xs:8px;--cg-radius-sm:10px;--cg-radius-md:12px;--cg-radius-lg:14px;--cg-radius-xl:16px;--cg-radius-container:20px;--cg-radius-pill:999px;--cg-shadow-card:0 4px 16px rgba(34, 34, 34, 0.04), 0 4px 4px rgba(34, 34, 34, 0.04);--cg-shadow-hover:0 8px 24px rgba(34, 34, 34, 0.08);--cg-shadow-card-hover:0 8px 24px rgba(34, 34, 34, 0.08), 0 4px 6px rgba(34, 34, 34, 0.06);--cg-shadow-panel:0 10px 40px rgba(90, 71, 240, 0.18);--cg-duration-fast:120ms;--cg-duration:180ms;--cg-duration-slow:280ms;--cg-ease-out:cubic-bezier(0, 0, 0.2, 1);--cg-ease-out-expo:cubic-bezier(0.16, 1, 0.3, 1);--cg-ease-out-quint:cubic-bezier(0.22, 1, 0.36, 1);--cg-ease-out-quart:cubic-bezier(0.25, 1, 0.5, 1);--cg-ease-in-out-cubic:cubic-bezier(0.65, 0, 0.35, 1);--cg-ease-in:cubic-bezier(0.5, 0, 0.75, 0);--cg-ease-spring:cubic-bezier(0.34, 1.56, 0.64, 1);--cg-ease-spring-damped:linear(0, 0.034, 0.122, 0.244, 0.383, 0.526, 0.662, 0.785, 0.889, 0.974, 1.038, 1.083, 1.111, 1.124, 1.126, 1.119, 1.106, 1.09, 1.072, 1.054, 1.038, 1.023, 1.01, 1, 0.993, 0.988, 0.985, 0.984, 0.984, 0.985, 0.987, 0.989, 0.992, 0.994, 0.996, 0.998, 0.999, 1, 1.001, 1.002, 1);";
|
|
2
|
+
export declare const BADGE_TOKEN_DECLARATIONS = "--cg-primary:#5a47f0;--cg-primary-press:#4b39db;--cg-primary-tint:#eeecfe;--cg-secondary:#b6de68;--cg-secondary-press:#a6cf57;--cg-tertiary:#60e9f0;--cg-tertiary-press:#4dd8e0;--cg-accent:#0061f0;--cg-cyan-200:#dffbfc;--cg-lime-200:#eef7dc;--cg-surface-card:#ffffff;--cg-surface-raised:#f4f6f8;--cg-surface-control:#e3e3e3;--cg-surface-subtle:#f2f1f7;--cg-hover:rgba(34, 34, 34, 0.045);--cg-scrim:rgba(34, 34, 34, 0.4);--cg-text-primary:#222222;--cg-text-secondary:#595959;--cg-text-muted:#858585;--cg-text-muted-strong:#6a6a6a;--cg-text-placeholder:#acacac;--cg-text-accent:#5a47f0;--cg-text-on-primary:#ffffff;--cg-text-on-accent:#222222;--cg-border-hairline:#e6e8ea;--cg-border-control:#e3e3e3;--cg-border-accent:#5a47f0;--cg-focus-ring:rgba(90, 71, 240, 0.28);--cg-online:#00a05c;--cg-online-fill:#e6f7ef;--cg-online-strong:#085d3a;--cg-expired-fill:#fdf3e0;--cg-expired-border:#fedf89;--cg-expired-strong:#7a3d0a;--cg-font-ui:'Manrope Variable', 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;--cg-font-body:'Space Grotesk Variable', 'Space Grotesk', 'Manrope Variable', 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;--cg-font-mono:'JetBrains Mono Variable', 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;--cg-weight-regular:400;--cg-weight-medium:500;--cg-weight-bold:600;--cg-body-18:18px;--cg-body-md:16px;--cg-body-sm:15px;--cg-body-14:14px;--cg-caption:13px;--cg-body-line:1.46;--cg-mono-size:14px;--cg-mono-line:1.7;--cg-radius-xs:8px;--cg-radius-sm:10px;--cg-radius-md:12px;--cg-radius-lg:14px;--cg-radius-xl:16px;--cg-radius-container:20px;--cg-radius-pill:999px;--cg-shadow-card:0 4px 16px rgba(34, 34, 34, 0.04), 0 4px 4px rgba(34, 34, 34, 0.04);--cg-shadow-hover:0 8px 24px rgba(34, 34, 34, 0.08);--cg-shadow-card-hover:0 8px 24px rgba(34, 34, 34, 0.08), 0 4px 6px rgba(34, 34, 34, 0.06);--cg-shadow-panel:0 10px 40px rgba(90, 71, 240, 0.18);--cg-duration-fast:120ms;--cg-duration:180ms;--cg-duration-slow:280ms;--cg-ease-out:cubic-bezier(0, 0, 0.2, 1);--cg-ease-out-expo:cubic-bezier(0.16, 1, 0.3, 1);--cg-ease-out-quint:cubic-bezier(0.22, 1, 0.36, 1);--cg-ease-out-quart:cubic-bezier(0.25, 1, 0.5, 1);--cg-ease-in-out-cubic:cubic-bezier(0.65, 0, 0.35, 1);--cg-ease-in:cubic-bezier(0.5, 0, 0.75, 0);--cg-ease-spring:cubic-bezier(0.34, 1.56, 0.64, 1);--cg-ease-spring-damped:linear(0, 0.034, 0.122, 0.244, 0.383, 0.526, 0.662, 0.785, 0.889, 0.974, 1.038, 1.083, 1.111, 1.124, 1.126, 1.119, 1.106, 1.09, 1.072, 1.054, 1.038, 1.023, 1.01, 1, 0.993, 0.988, 0.985, 0.984, 0.984, 0.985, 0.987, 0.989, 0.992, 0.994, 0.996, 0.998, 0.999, 1, 1.001, 1.002, 1);";
|
|
3
3
|
/** The same values as a map, for tests and the gallery. Not needed at runtime. */
|
|
4
4
|
export declare const BADGE_TOKENS: Readonly<Record<string, string>>;
|
|
5
5
|
/** `--cg-font-ui`: Manrope. The tab label and button labels. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"palette.d.ts","sourceRoot":"","sources":["../../src/badge/palette.ts"],"names":[],"mappings":"AAMA,4EAA4E;AAC5E,eAAO,MAAM,wBAAwB
|
|
1
|
+
{"version":3,"file":"palette.d.ts","sourceRoot":"","sources":["../../src/badge/palette.ts"],"names":[],"mappings":"AAMA,4EAA4E;AAC5E,eAAO,MAAM,wBAAwB,4kFACsiF,CAAA;AAE3kF,kFAAkF;AAClF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAuEzD,CAAA;AAED,gEAAgE;AAChE,eAAO,MAAM,aAAa,6FAA6F,CAAA;AAEvH,iEAAiE;AACjE,eAAO,MAAM,eAAe,wIAAwI,CAAA;AAEpK;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,EAAE,aAAa,CAAC;IAC3C,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,YAAY,EAAE,MAAM,CAAA;CACrB,CAGA,CAAA"}
|
package/dist/badge/palette.js
CHANGED
|
@@ -4,13 +4,14 @@
|
|
|
4
4
|
// carries its token values with it. Each is the resolved value of the token of
|
|
5
5
|
// the same name at :root. Retune the token and rebuild; this file follows.
|
|
6
6
|
/** Every badge token as one declaration list, for the badge root's rule. */
|
|
7
|
-
export const BADGE_TOKEN_DECLARATIONS = "--cg-primary:#5a47f0;--cg-primary-press:#4b39db;--cg-primary-tint:#eeecfe;--cg-secondary:#b6de68;--cg-tertiary:#60e9f0;--cg-tertiary-press:#4dd8e0;--cg-accent:#0061f0;--cg-cyan-200:#dffbfc;--cg-lime-200:#eef7dc;--cg-surface-card:#ffffff;--cg-surface-raised:#f4f6f8;--cg-surface-control:#e3e3e3;--cg-surface-subtle:#f2f1f7;--cg-hover:rgba(34, 34, 34, 0.045);--cg-scrim:rgba(34, 34, 34, 0.4);--cg-text-primary:#222222;--cg-text-secondary:#595959;--cg-text-muted:#858585;--cg-text-muted-strong:#6a6a6a;--cg-text-placeholder:#acacac;--cg-text-accent:#5a47f0;--cg-text-on-primary:#ffffff;--cg-text-on-accent:#222222;--cg-border-hairline:#e6e8ea;--cg-border-control:#e3e3e3;--cg-border-accent:#5a47f0;--cg-focus-ring:rgba(90, 71, 240, 0.28);--cg-online:#00a05c;--cg-online-fill:#e6f7ef;--cg-online-strong:#085d3a;--cg-expired-fill:#fdf3e0;--cg-expired-border:#fedf89;--cg-expired-strong:#7a3d0a;--cg-font-ui:'Manrope Variable', 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;--cg-font-body:'Space Grotesk Variable', 'Space Grotesk', 'Manrope Variable', 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;--cg-font-mono:'JetBrains Mono Variable', 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;--cg-weight-regular:400;--cg-weight-medium:500;--cg-weight-bold:600;--cg-body-18:18px;--cg-body-md:16px;--cg-body-sm:15px;--cg-body-14:14px;--cg-caption:13px;--cg-body-line:1.46;--cg-mono-size:14px;--cg-mono-line:1.7;--cg-radius-xs:8px;--cg-radius-sm:10px;--cg-radius-md:12px;--cg-radius-lg:14px;--cg-radius-xl:16px;--cg-radius-container:20px;--cg-radius-pill:999px;--cg-shadow-card:0 4px 16px rgba(34, 34, 34, 0.04), 0 4px 4px rgba(34, 34, 34, 0.04);--cg-shadow-hover:0 8px 24px rgba(34, 34, 34, 0.08);--cg-shadow-card-hover:0 8px 24px rgba(34, 34, 34, 0.08), 0 4px 6px rgba(34, 34, 34, 0.06);--cg-shadow-panel:0 10px 40px rgba(90, 71, 240, 0.18);--cg-duration-fast:120ms;--cg-duration:180ms;--cg-duration-slow:280ms;--cg-ease-out:cubic-bezier(0, 0, 0.2, 1);--cg-ease-out-expo:cubic-bezier(0.16, 1, 0.3, 1);--cg-ease-out-quint:cubic-bezier(0.22, 1, 0.36, 1);--cg-ease-out-quart:cubic-bezier(0.25, 1, 0.5, 1);--cg-ease-in-out-cubic:cubic-bezier(0.65, 0, 0.35, 1);--cg-ease-in:cubic-bezier(0.5, 0, 0.75, 0);--cg-ease-spring:cubic-bezier(0.34, 1.56, 0.64, 1);--cg-ease-spring-damped:linear(0, 0.034, 0.122, 0.244, 0.383, 0.526, 0.662, 0.785, 0.889, 0.974, 1.038, 1.083, 1.111, 1.124, 1.126, 1.119, 1.106, 1.09, 1.072, 1.054, 1.038, 1.023, 1.01, 1, 0.993, 0.988, 0.985, 0.984, 0.984, 0.985, 0.987, 0.989, 0.992, 0.994, 0.996, 0.998, 0.999, 1, 1.001, 1.002, 1);";
|
|
7
|
+
export const BADGE_TOKEN_DECLARATIONS = "--cg-primary:#5a47f0;--cg-primary-press:#4b39db;--cg-primary-tint:#eeecfe;--cg-secondary:#b6de68;--cg-secondary-press:#a6cf57;--cg-tertiary:#60e9f0;--cg-tertiary-press:#4dd8e0;--cg-accent:#0061f0;--cg-cyan-200:#dffbfc;--cg-lime-200:#eef7dc;--cg-surface-card:#ffffff;--cg-surface-raised:#f4f6f8;--cg-surface-control:#e3e3e3;--cg-surface-subtle:#f2f1f7;--cg-hover:rgba(34, 34, 34, 0.045);--cg-scrim:rgba(34, 34, 34, 0.4);--cg-text-primary:#222222;--cg-text-secondary:#595959;--cg-text-muted:#858585;--cg-text-muted-strong:#6a6a6a;--cg-text-placeholder:#acacac;--cg-text-accent:#5a47f0;--cg-text-on-primary:#ffffff;--cg-text-on-accent:#222222;--cg-border-hairline:#e6e8ea;--cg-border-control:#e3e3e3;--cg-border-accent:#5a47f0;--cg-focus-ring:rgba(90, 71, 240, 0.28);--cg-online:#00a05c;--cg-online-fill:#e6f7ef;--cg-online-strong:#085d3a;--cg-expired-fill:#fdf3e0;--cg-expired-border:#fedf89;--cg-expired-strong:#7a3d0a;--cg-font-ui:'Manrope Variable', 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;--cg-font-body:'Space Grotesk Variable', 'Space Grotesk', 'Manrope Variable', 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;--cg-font-mono:'JetBrains Mono Variable', 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;--cg-weight-regular:400;--cg-weight-medium:500;--cg-weight-bold:600;--cg-body-18:18px;--cg-body-md:16px;--cg-body-sm:15px;--cg-body-14:14px;--cg-caption:13px;--cg-body-line:1.46;--cg-mono-size:14px;--cg-mono-line:1.7;--cg-radius-xs:8px;--cg-radius-sm:10px;--cg-radius-md:12px;--cg-radius-lg:14px;--cg-radius-xl:16px;--cg-radius-container:20px;--cg-radius-pill:999px;--cg-shadow-card:0 4px 16px rgba(34, 34, 34, 0.04), 0 4px 4px rgba(34, 34, 34, 0.04);--cg-shadow-hover:0 8px 24px rgba(34, 34, 34, 0.08);--cg-shadow-card-hover:0 8px 24px rgba(34, 34, 34, 0.08), 0 4px 6px rgba(34, 34, 34, 0.06);--cg-shadow-panel:0 10px 40px rgba(90, 71, 240, 0.18);--cg-duration-fast:120ms;--cg-duration:180ms;--cg-duration-slow:280ms;--cg-ease-out:cubic-bezier(0, 0, 0.2, 1);--cg-ease-out-expo:cubic-bezier(0.16, 1, 0.3, 1);--cg-ease-out-quint:cubic-bezier(0.22, 1, 0.36, 1);--cg-ease-out-quart:cubic-bezier(0.25, 1, 0.5, 1);--cg-ease-in-out-cubic:cubic-bezier(0.65, 0, 0.35, 1);--cg-ease-in:cubic-bezier(0.5, 0, 0.75, 0);--cg-ease-spring:cubic-bezier(0.34, 1.56, 0.64, 1);--cg-ease-spring-damped:linear(0, 0.034, 0.122, 0.244, 0.383, 0.526, 0.662, 0.785, 0.889, 0.974, 1.038, 1.083, 1.111, 1.124, 1.126, 1.119, 1.106, 1.09, 1.072, 1.054, 1.038, 1.023, 1.01, 1, 0.993, 0.988, 0.985, 0.984, 0.984, 0.985, 0.987, 0.989, 0.992, 0.994, 0.996, 0.998, 0.999, 1, 1.001, 1.002, 1);";
|
|
8
8
|
/** The same values as a map, for tests and the gallery. Not needed at runtime. */
|
|
9
9
|
export const BADGE_TOKENS = {
|
|
10
10
|
"--cg-primary": "#5a47f0",
|
|
11
11
|
"--cg-primary-press": "#4b39db",
|
|
12
12
|
"--cg-primary-tint": "#eeecfe",
|
|
13
13
|
"--cg-secondary": "#b6de68",
|
|
14
|
+
"--cg-secondary-press": "#a6cf57",
|
|
14
15
|
"--cg-tertiary": "#60e9f0",
|
|
15
16
|
"--cg-tertiary-press": "#4dd8e0",
|
|
16
17
|
"--cg-accent": "#0061f0",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"palette.js","sourceRoot":"","sources":["../../src/badge/palette.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,EAAE;AACF,2EAA2E;AAC3E,+EAA+E;AAC/E,2EAA2E;AAE3E,4EAA4E;AAC5E,MAAM,CAAC,MAAM,wBAAwB,GACnC,
|
|
1
|
+
{"version":3,"file":"palette.js","sourceRoot":"","sources":["../../src/badge/palette.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,EAAE;AACF,2EAA2E;AAC3E,+EAA+E;AAC/E,2EAA2E;AAE3E,4EAA4E;AAC5E,MAAM,CAAC,MAAM,wBAAwB,GACnC,ykFAAykF,CAAA;AAE3kF,kFAAkF;AAClF,MAAM,CAAC,MAAM,YAAY,GAAqC;IAC5D,cAAc,EAAE,SAAS;IACzB,oBAAoB,EAAE,SAAS;IAC/B,mBAAmB,EAAE,SAAS;IAC9B,gBAAgB,EAAE,SAAS;IAC3B,sBAAsB,EAAE,SAAS;IACjC,eAAe,EAAE,SAAS;IAC1B,qBAAqB,EAAE,SAAS;IAChC,aAAa,EAAE,SAAS;IACxB,eAAe,EAAE,SAAS;IAC1B,eAAe,EAAE,SAAS;IAC1B,mBAAmB,EAAE,SAAS;IAC9B,qBAAqB,EAAE,SAAS;IAChC,sBAAsB,EAAE,SAAS;IACjC,qBAAqB,EAAE,SAAS;IAChC,YAAY,EAAE,yBAAyB;IACvC,YAAY,EAAE,uBAAuB;IACrC,mBAAmB,EAAE,SAAS;IAC9B,qBAAqB,EAAE,SAAS;IAChC,iBAAiB,EAAE,SAAS;IAC5B,wBAAwB,EAAE,SAAS;IACnC,uBAAuB,EAAE,SAAS;IAClC,kBAAkB,EAAE,SAAS;IAC7B,sBAAsB,EAAE,SAAS;IACjC,qBAAqB,EAAE,SAAS;IAChC,sBAAsB,EAAE,SAAS;IACjC,qBAAqB,EAAE,SAAS;IAChC,oBAAoB,EAAE,SAAS;IAC/B,iBA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F,CAAA;AAEvH,iEAAiE;AACjE,MAAM,CAAC,MAAM,eAAe,GAAG,qIAAqI,CAAA;AAEpK;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAMxB;IACH,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,iCAAiC,EAAE,YAAY,EAAE,0JAA0J,EAAE;IACrR,EAAE,MAAM,EAAE,wBAAwB,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,uCAAuC,EAAE,YAAY,EAAE,0JAA0J,EAAE;CAClS,CAAA"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type ChartDatum } from "./chart-parts.js";
|
|
3
|
+
/**
|
|
4
|
+
* Daily bars, for the App page's Views over time and the Coming soon Time saved
|
|
5
|
+
* over time (#332, Figma "App page: final cut", frames 01 and 02).
|
|
6
|
+
*
|
|
7
|
+
* The Console hand-builds its Views chart today (`AppViewsChart`), with 11px axis
|
|
8
|
+
* text. This is that chart moved into the library with the frames' additions: an
|
|
9
|
+
* optional value label over each bar, and a version marker.
|
|
10
|
+
*
|
|
11
|
+
* ## Plain data in, nothing fetched
|
|
12
|
+
*
|
|
13
|
+
* `data` is an array of `{ label, value }`, and the label is printed as given:
|
|
14
|
+
* the chart never parses a date, so it never disagrees with the Console about a
|
|
15
|
+
* time zone. Empty (`data` is `[]`) and pending (`pending`) are states of the
|
|
16
|
+
* block, so a caller does not draw its own.
|
|
17
|
+
*
|
|
18
|
+
* - **Empty** prints `emptyLabel` where the plot goes. An empty series is a real
|
|
19
|
+
* measurement of nothing; a series of zeros is a real measurement of zero, and
|
|
20
|
+
* that one IS drawn, as a hairline stub per day, the frame's dashed baseline.
|
|
21
|
+
* - **Pending** draws a skeleton the plot's size and says "Loading" to a screen
|
|
22
|
+
* reader. It never draws a zero, which a reader would take for a measurement.
|
|
23
|
+
*
|
|
24
|
+
* ## What it draws
|
|
25
|
+
*
|
|
26
|
+
* - **The peak callout** (`peak`): "Peak 57 · Sep 10", from the first highest
|
|
27
|
+
* point. Left out when nothing is above zero, since "Peak 0" is not a peak.
|
|
28
|
+
* - **The value axis** (`valueAxis`, on by default): 0 and three steps on a
|
|
29
|
+
* 1/2/5 ladder, so 57 draws 0, 20, 40, 60. The Time saved frame has none and
|
|
30
|
+
* labels its bars instead.
|
|
31
|
+
* - **Value labels** (`valueLabels`): the value over each bar, and none over a
|
|
32
|
+
* zero, as the Time saved frame draws its first week. The plot keeps 20px
|
|
33
|
+
* clear above the tallest bar so its label is not cut off.
|
|
34
|
+
* - **The date axis**: the first and last label and evenly spaced ones between,
|
|
35
|
+
* `dateTicks` in all (5 by default, the frame's count).
|
|
36
|
+
* - **The version marker** (`marker`): a dashed rule through the middle of one
|
|
37
|
+
* day and a chip such as "v11", found by the point's `key` (or `label`). The
|
|
38
|
+
* chip sits right of the rule, or left of it in the last fifth of the plot so it
|
|
39
|
+
* stays inside the card.
|
|
40
|
+
*
|
|
41
|
+
* ## Colour and marks
|
|
42
|
+
*
|
|
43
|
+
* Bars are `--cg-text-accent`: purple on the page, white on the purple panel,
|
|
44
|
+
* lime on ink, the pair `Spinner` and `ProgressBar` use. A single series, so no
|
|
45
|
+
* legend: the title names it. Bars take at most 24px and two thirds of their
|
|
46
|
+
* slot, with a 4px rounded top and a square foot. The zero stub, the rule and
|
|
47
|
+
* the chip read the hairline and muted tokens, which flip per surface.
|
|
48
|
+
*
|
|
49
|
+
* ## For a screen reader
|
|
50
|
+
*
|
|
51
|
+
* The drawn plot is `aria-hidden`, and a visually hidden table carries every
|
|
52
|
+
* point (`labelName` and `valueName` head its columns), with the marker's chip on
|
|
53
|
+
* its row. A pointer gets each day's value from the bar's native tooltip, on a
|
|
54
|
+
* hit area the full height of the plot. Nothing in the chart takes focus.
|
|
55
|
+
*
|
|
56
|
+
* ## The heading is the caller's words
|
|
57
|
+
*
|
|
58
|
+
* `title` renders in the chart's header, beside the peak callout, as the frame
|
|
59
|
+
* draws them. It is a `figcaption`, so it names the figure.
|
|
60
|
+
*/
|
|
61
|
+
/** A dashed rule and a chip at one point of the chart: the version that went live that day. */
|
|
62
|
+
export type BarChartMarker = {
|
|
63
|
+
/** The `key` (or `label`) of the point the rule goes through. */
|
|
64
|
+
at: string;
|
|
65
|
+
/** The chip's text, such as "v11". */
|
|
66
|
+
label: string;
|
|
67
|
+
};
|
|
68
|
+
declare function BarChart({ data, title, peak, valueAxis, valueLabels, marker, dateTicks, height, formatValue, labelName, valueName, emptyLabel, pending, className, ...props }: Omit<React.ComponentProps<"figure">, "children" | "title"> & {
|
|
69
|
+
/** One bar per point, in order. */
|
|
70
|
+
data: readonly ChartDatum[];
|
|
71
|
+
/** The chart's heading, such as "Views over time". Rendered as the figure's caption. */
|
|
72
|
+
title?: React.ReactNode;
|
|
73
|
+
/** Show the "Peak 57 · Sep 10" callout in the header. */
|
|
74
|
+
peak?: boolean;
|
|
75
|
+
/** Draw the value axis down the left. On by default. */
|
|
76
|
+
valueAxis?: boolean;
|
|
77
|
+
/** Print each bar's value over it. */
|
|
78
|
+
valueLabels?: boolean;
|
|
79
|
+
/** A version marker at one point. Ignored when no point has that key. */
|
|
80
|
+
marker?: BarChartMarker;
|
|
81
|
+
/** How many date labels to print under the plot, first and last included. */
|
|
82
|
+
dateTicks?: number;
|
|
83
|
+
/** The plot's height in px, value labels included. */
|
|
84
|
+
height?: number;
|
|
85
|
+
/** Formats every value the chart prints. Defaults to grouped digits. */
|
|
86
|
+
formatValue?: (value: number) => string;
|
|
87
|
+
/** The table's first column heading, for a screen reader. */
|
|
88
|
+
labelName?: string;
|
|
89
|
+
/** The table's second column heading, for a screen reader, such as "Views". */
|
|
90
|
+
valueName?: string;
|
|
91
|
+
/** Printed in place of the plot when `data` is empty. */
|
|
92
|
+
emptyLabel?: React.ReactNode;
|
|
93
|
+
/** The data is on its way: draw a skeleton, never a zero. */
|
|
94
|
+
pending?: boolean;
|
|
95
|
+
}): React.JSX.Element;
|
|
96
|
+
export { BarChart };
|
|
97
|
+
//# sourceMappingURL=bar-chart.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bar-chart.d.ts","sourceRoot":"","sources":["../../src/blocks/bar-chart.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,OAAO,EAUL,KAAK,UAAU,EAChB,MAAM,2BAA2B,CAAA;AAElC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AAEH,+FAA+F;AAC/F,MAAM,MAAM,cAAc,GAAG;IAC3B,iEAAiE;IACjE,EAAE,EAAE,MAAM,CAAA;IACV,sCAAsC;IACtC,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAQD,iBAAS,QAAQ,CAAC,EAChB,IAAI,EACJ,KAAK,EACL,IAAY,EACZ,SAAgB,EAChB,WAAmB,EACnB,MAAM,EACN,SAAa,EACb,MAAY,EACZ,WAA+B,EAC/B,SAAkB,EAClB,SAAmB,EACnB,UAAsC,EACtC,OAAe,EACf,SAAS,EACT,GAAG,KAAK,EACT,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,GAAG;IAC9D,mCAAmC;IACnC,IAAI,EAAE,SAAS,UAAU,EAAE,CAAA;IAC3B,wFAAwF;IACxF,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACvB,yDAAyD;IACzD,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,wDAAwD;IACxD,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,sCAAsC;IACtC,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,yEAAyE;IACzE,MAAM,CAAC,EAAE,cAAc,CAAA;IACvB,6EAA6E;IAC7E,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,sDAAsD;IACtD,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,wEAAwE;IACxE,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;IACvC,6DAA6D;IAC7D,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,+EAA+E;IAC/E,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,yDAAyD;IACzD,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC5B,6DAA6D;IAC7D,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,qBAoHA;AAED,OAAO,EAAE,QAAQ,EAAE,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { cn } from "../lib/cloudgrid-cn.js";
|
|
4
|
+
import { Skeleton } from "../ui/skeleton.js";
|
|
5
|
+
import { CHART_LOADING_TEXT, ChartDateAxis, ChartEmpty, ChartTable, ChartValueAxis, chartAxisTop, chartPeak, chartValue, formatChartNumber, } from "./chart-parts.js";
|
|
6
|
+
/** Space kept clear above the bars for value labels, in px. */
|
|
7
|
+
const VALUE_LABEL_ROOM = 20;
|
|
8
|
+
/** Bar width as a share of its slot: the frame's 15.5px bar in a 23px slot. */
|
|
9
|
+
const BAR_SHARE = "67%";
|
|
10
|
+
function BarChart({ data, title, peak = false, valueAxis = true, valueLabels = false, marker, dateTicks = 5, height = 160, formatValue = formatChartNumber, labelName = "Date", valueName = "Value", emptyLabel = "Nothing in this window.", pending = false, className, ...props }) {
|
|
11
|
+
const empty = !pending && data.length === 0;
|
|
12
|
+
const top = chartAxisTop(Math.max(0, ...data.map((d) => chartValue(d.value))));
|
|
13
|
+
const peakDatum = peak && !pending ? chartPeak(data) : undefined;
|
|
14
|
+
const markerIndex = marker ? data.findIndex((d) => (d.key ?? d.label) === marker.at) : -1;
|
|
15
|
+
const inset = valueLabels ? VALUE_LABEL_ROOM : 0;
|
|
16
|
+
const slot = (i, n) => (i + 0.5) / n;
|
|
17
|
+
return (_jsxs("figure", { "data-slot": "bar-chart", "data-pending": pending ? "" : undefined, "data-empty": empty ? "" : undefined, "aria-busy": pending || undefined,
|
|
18
|
+
// text-ink on the root, because text does not flip by inheritance (rule 3).
|
|
19
|
+
className: cn("m-0 grid min-w-0 gap-3 text-ink", className), ...props, children: [title || peakDatum ? (_jsxs("figcaption", { "data-slot": "bar-chart-header", className: "flex items-baseline justify-between gap-3", children: [title ? (_jsx("span", { "data-slot": "bar-chart-title", className: "text-body-md font-medium", children: title })) : null, peakDatum ? (_jsxs("span", { "data-slot": "bar-chart-peak", className: "ml-auto text-caption text-faint-strong tabular-nums", children: ["Peak ", formatValue(peakDatum.value), " \u00B7 ", peakDatum.label] })) : null] })) : null, pending ? (_jsxs("div", { "data-slot": "bar-chart-pending", children: [_jsx("span", { className: "sr-only", children: CHART_LOADING_TEXT }), _jsx(Skeleton, { "aria-hidden": "true", className: "w-full", style: { height } })] })) : empty ? (_jsx(ChartEmpty, { children: emptyLabel })) : (_jsxs(_Fragment, { children: [_jsxs("div", { "data-slot": "bar-chart-plot", "aria-hidden": "true", className: cn("grid min-w-0 gap-x-3 gap-y-2", valueAxis ? "grid-cols-[auto_minmax(0,1fr)]" : "grid-cols-1"), children: [valueAxis ? _jsx(ChartValueAxis, { top: top, height: height, inset: inset, format: formatValue }) : null, _jsxs("div", { className: "relative flex min-w-0 items-end", style: { height, paddingTop: inset }, children: [data.map((d, i) => {
|
|
20
|
+
const value = chartValue(d.value);
|
|
21
|
+
return (_jsx("div", { "data-slot": "bar-chart-column", title: `${d.label}: ${formatValue(value)}`, className: "flex h-full min-w-0 flex-1 flex-col items-center justify-end", children: _jsx("span", { "data-slot": "bar-chart-bar", "data-value": value, className: cn("relative block max-w-6", value > 0 ? "min-h-0.5 rounded-t-[4px] bg-(--cg-text-accent)" : "h-px bg-hairline"), style: { width: BAR_SHARE, ...(value > 0 ? { height: `${(value / top) * 100}%` } : {}) }, children: valueLabels && value > 0 ? (_jsx("span", { "data-slot": "bar-chart-value", className: "absolute bottom-full left-1/2 mb-1 -translate-x-1/2 whitespace-nowrap text-caption leading-none text-faint-strong tabular-nums", children: formatValue(value) })) : null }) }, d.key ?? `${d.label}-${i}`));
|
|
22
|
+
}), markerIndex >= 0 && marker ? (_jsx("div", { "data-slot": "bar-chart-marker", className: "pointer-events-none absolute inset-y-0 border-l border-dashed border-faint", style: { left: `${slot(markerIndex, data.length) * 100}%` }, children: _jsx("span", { "data-slot": "bar-chart-marker-chip", className: cn("absolute top-0 whitespace-nowrap rounded-pill bg-hairline px-1.5 text-caption leading-5 text-ink", slot(markerIndex, data.length) > 0.8 ? "right-full mr-1" : "left-full ml-1"), children: marker.label }) })) : null] }), valueAxis ? _jsx("span", {}) : null, _jsx(ChartDateAxis, { data: data, ticks: dateTicks })] }), _jsx(ChartTable, { data: data, labelName: labelName, valueName: valueName, format: formatValue, note: markerIndex >= 0 && marker ? { index: markerIndex, text: marker.label } : undefined })] }))] }));
|
|
23
|
+
}
|
|
24
|
+
export { BarChart };
|
|
25
|
+
//# sourceMappingURL=bar-chart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bar-chart.js","sourceRoot":"","sources":["../../src/blocks/bar-chart.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAA;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AACjD,OAAO,EACL,kBAAkB,EAClB,aAAa,EACb,UAAU,EACV,UAAU,EACV,cAAc,EACd,YAAY,EACZ,SAAS,EACT,UAAU,EACV,iBAAiB,GAElB,MAAM,2BAA2B,CAAA;AAqElC,+DAA+D;AAC/D,MAAM,gBAAgB,GAAG,EAAE,CAAA;AAE3B,+EAA+E;AAC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CAAC,MAAM,CAAC,GAAG,GAAG,GAAG,EAAE,YAE3D,4BACY,uBAAuB,EACjC,SAAS,EAAE,EAAE,CACX,kGAAkG,EAClG,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,gBAAgB,CAC5E,YAEA,MAAM,CAAC,KAAK,GACR,GACH,CACP,CAAC,CAAC,CAAC,IAAI,IACJ,EACL,SAAS,CAAC,CAAC,CAAC,gBAAQ,CAAC,CAAC,CAAC,IAAI,EAC5B,KAAC,aAAa,IAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,GAAI,IAC3C,EAEN,KAAC,UAAU,IACT,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,WAAW,EACnB,IAAI,EAAE,WAAW,IAAI,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,GACzF,IACD,CACJ,IACM,CACV,CAAA;AACH,CAAC;AAED,OAAO,EAAE,QAAQ,EAAE,CAAA"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* The parts of `BarChart` (#332) that are not the bars: the value axis, the
|
|
4
|
+
* date axis, the screen-reader table and the scale arithmetic.
|
|
5
|
+
*
|
|
6
|
+
* They are kept apart from the bars so the axis arithmetic is written once and
|
|
7
|
+
* can be tested on its own. Exported with the package, as every component module is
|
|
8
|
+
* (the barrel test requires it), so a caller can also use the arithmetic on its
|
|
9
|
+
* own: `chartPeak` to put the peak somewhere else, `chartAxisTop` to match an
|
|
10
|
+
* axis drawn beside a chart. The axis, table and empty pieces are building
|
|
11
|
+
* blocks of the charts rather than components to compose on their own.
|
|
12
|
+
*
|
|
13
|
+
* ## Text is 13px and reads the strong muted rung
|
|
14
|
+
*
|
|
15
|
+
* The Console's hand-built Views chart set its axis in 11px `--cg-text-muted`,
|
|
16
|
+
* which is under the brand's 13px floor and under 4.5:1 on the card. Every label
|
|
17
|
+
* here is `text-caption` (13px) in `text-faint-strong` (`--cg-text-muted-strong`),
|
|
18
|
+
* the rung #232 added for content captions.
|
|
19
|
+
*/
|
|
20
|
+
/** One point on a chart: what the axis and the tooltip call it, and its value. */
|
|
21
|
+
export type ChartDatum = {
|
|
22
|
+
/** The label the axis, the tooltip and the table print, such as "Sep 10". */
|
|
23
|
+
label: string;
|
|
24
|
+
/** The measurement. Negative values are drawn as zero. */
|
|
25
|
+
value: number;
|
|
26
|
+
/**
|
|
27
|
+
* A stable key, such as an ISO date. Defaults to `label`. A version marker
|
|
28
|
+
* finds its point by this.
|
|
29
|
+
*/
|
|
30
|
+
key?: string;
|
|
31
|
+
};
|
|
32
|
+
export declare function formatChartNumber(value: number): string;
|
|
33
|
+
/**
|
|
34
|
+
* The top of the value axis: the smallest `3 x step` that covers the peak,
|
|
35
|
+
* stepping 1, 2, 5 per decade. Three steps, because the frames draw four labels
|
|
36
|
+
* (0, 20, 40, 60 for a peak of 57).
|
|
37
|
+
*
|
|
38
|
+
* The same ladder as the Console's `AppViewsChart`, moved here so the axis is
|
|
39
|
+
* derived in one place. Rounding the peak itself to a friendlier number would
|
|
40
|
+
* put a gridline where no measurement is.
|
|
41
|
+
*/
|
|
42
|
+
export declare function chartAxisTop(peak: number): number;
|
|
43
|
+
/**
|
|
44
|
+
* Which points the date axis labels: the first, the last, and `count - 2`
|
|
45
|
+
* evenly between them, rounded down. For 30 days and 5 labels that is days 1,
|
|
46
|
+
* 8, 15, 22 and 30, which is Aug 17, Aug 24, Aug 31, Sep 7 and Sep 15 in the
|
|
47
|
+
* frame. Fewer points than labels labels every point.
|
|
48
|
+
*/
|
|
49
|
+
export declare function chartTickIndices(length: number, count: number): number[];
|
|
50
|
+
/** The point a chart's peak callout names: the first highest value. `undefined` when nothing is above zero. */
|
|
51
|
+
export declare function chartPeak(data: readonly ChartDatum[]): ChartDatum | undefined;
|
|
52
|
+
/** Clamp to the drawable range: a negative or non-finite value draws as zero. */
|
|
53
|
+
export declare function chartValue(value: number): number;
|
|
54
|
+
/**
|
|
55
|
+
* The value axis: top, two thirds, one third, zero, spaced to the plot's height.
|
|
56
|
+
* Decorative; the table carries the values.
|
|
57
|
+
*/
|
|
58
|
+
export declare function ChartValueAxis({ top, height, inset, format, }: {
|
|
59
|
+
top: number;
|
|
60
|
+
height: number;
|
|
61
|
+
/** Space kept clear above the plot, so the axis lines up with the bars under value labels. */
|
|
62
|
+
inset?: number;
|
|
63
|
+
format: (value: number) => string;
|
|
64
|
+
}): React.JSX.Element;
|
|
65
|
+
/**
|
|
66
|
+
* The date axis: the picked labels spread edge to edge, the first flush left and
|
|
67
|
+
* the last flush right, with at least 8px between neighbours.
|
|
68
|
+
*
|
|
69
|
+
* Spread rather than pinned under each point, which is what the frames do too
|
|
70
|
+
* (their "Date range" row is evenly spaced). The picks are evenly spaced, so a
|
|
71
|
+
* label lands within a slot of its point, and two labels can never overlap the
|
|
72
|
+
* way pinned ones do once the card narrows to the side panel.
|
|
73
|
+
*/
|
|
74
|
+
export declare function ChartDateAxis({ data, ticks }: {
|
|
75
|
+
data: readonly ChartDatum[];
|
|
76
|
+
ticks: number;
|
|
77
|
+
}): React.JSX.Element;
|
|
78
|
+
/**
|
|
79
|
+
* The chart, as a table, for a screen reader. The drawn plot is `aria-hidden`:
|
|
80
|
+
* thirty bars announced as thirty unlabelled images tell nobody anything, and a
|
|
81
|
+
* table can be read row by row, which is what a sighted reader does with the
|
|
82
|
+
* tooltip.
|
|
83
|
+
*/
|
|
84
|
+
export declare function ChartTable({ data, labelName, valueName, format, note, }: {
|
|
85
|
+
data: readonly ChartDatum[];
|
|
86
|
+
labelName: string;
|
|
87
|
+
valueName: string;
|
|
88
|
+
format: (value: number) => string;
|
|
89
|
+
/** A remark on one row, by its index: the version marker's chip. */
|
|
90
|
+
note?: {
|
|
91
|
+
index: number;
|
|
92
|
+
text: string;
|
|
93
|
+
};
|
|
94
|
+
}): React.JSX.Element;
|
|
95
|
+
/** The words a component prints when it has nothing to draw, in one place. */
|
|
96
|
+
export declare function ChartEmpty({ children }: {
|
|
97
|
+
children: React.ReactNode;
|
|
98
|
+
}): React.JSX.Element;
|
|
99
|
+
/** What a screen reader hears while a component's data is on its way. */
|
|
100
|
+
export declare const CHART_LOADING_TEXT = "Loading";
|
|
101
|
+
//# sourceMappingURL=chart-parts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chart-parts.d.ts","sourceRoot":"","sources":["../../src/blocks/chart-parts.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B;;;;;;;;;;;;;;;;;GAiBG;AAEH,kFAAkF;AAClF,MAAM,MAAM,UAAU,GAAG;IACvB,6EAA6E;IAC7E,KAAK,EAAE,MAAM,CAAA;IACb,0DAA0D;IAC1D,KAAK,EAAE,MAAM,CAAA;IACb;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;CACb,CAAA;AAKD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CASjD;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAQxE;AAED,+GAA+G;AAC/G,wBAAgB,SAAS,CAAC,IAAI,EAAE,SAAS,UAAU,EAAE,GAAG,UAAU,GAAG,SAAS,CAI7E;AAED,iFAAiF;AACjF,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,EAC7B,GAAG,EACH,MAAM,EACN,KAAS,EACT,MAAM,GACP,EAAE;IACD,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,MAAM,CAAA;IACd,8FAA8F;IAC9F,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;CAClC,qBAaA;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;IAAE,IAAI,EAAE,SAAS,UAAU,EAAE,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,qBAiB5F;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,EACzB,IAAI,EACJ,SAAS,EACT,SAAS,EACT,MAAM,EACN,IAAI,GACL,EAAE;IACD,IAAI,EAAE,SAAS,UAAU,EAAE,CAAA;IAC3B,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;IACjC,oEAAoE;IACpE,IAAI,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAA;CACvC,qBAsBA;AAED,8EAA8E;AAC9E,wBAAgB,UAAU,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,qBAMrE;AAED,yEAAyE;AACzE,eAAO,MAAM,kBAAkB,YAAY,CAAA"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { cn } from "../lib/cloudgrid-cn.js";
|
|
4
|
+
/** The default number format: grouped digits, "7,112". Fixed locale, so a server render and a hydrated one agree. */
|
|
5
|
+
const DEFAULT_NUMBER_FORMAT = new Intl.NumberFormat("en-US");
|
|
6
|
+
export function formatChartNumber(value) {
|
|
7
|
+
return DEFAULT_NUMBER_FORMAT.format(value);
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The top of the value axis: the smallest `3 x step` that covers the peak,
|
|
11
|
+
* stepping 1, 2, 5 per decade. Three steps, because the frames draw four labels
|
|
12
|
+
* (0, 20, 40, 60 for a peak of 57).
|
|
13
|
+
*
|
|
14
|
+
* The same ladder as the Console's `AppViewsChart`, moved here so the axis is
|
|
15
|
+
* derived in one place. Rounding the peak itself to a friendlier number would
|
|
16
|
+
* put a gridline where no measurement is.
|
|
17
|
+
*/
|
|
18
|
+
export function chartAxisTop(peak) {
|
|
19
|
+
if (!(peak > 0))
|
|
20
|
+
return 3;
|
|
21
|
+
let step = 1;
|
|
22
|
+
while (step * 3 < peak) {
|
|
23
|
+
const digits = Math.floor(Math.log10(step));
|
|
24
|
+
const lead = Math.round(step / 10 ** digits);
|
|
25
|
+
step = (lead === 1 ? 2 : lead === 2 ? 5 : 10) * 10 ** digits;
|
|
26
|
+
}
|
|
27
|
+
return step * 3;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Which points the date axis labels: the first, the last, and `count - 2`
|
|
31
|
+
* evenly between them, rounded down. For 30 days and 5 labels that is days 1,
|
|
32
|
+
* 8, 15, 22 and 30, which is Aug 17, Aug 24, Aug 31, Sep 7 and Sep 15 in the
|
|
33
|
+
* frame. Fewer points than labels labels every point.
|
|
34
|
+
*/
|
|
35
|
+
export function chartTickIndices(length, count) {
|
|
36
|
+
if (length <= 0)
|
|
37
|
+
return [];
|
|
38
|
+
if (length <= count)
|
|
39
|
+
return Array.from({ length }, (_, i) => i);
|
|
40
|
+
if (count <= 1)
|
|
41
|
+
return [0];
|
|
42
|
+
const picks = new Set();
|
|
43
|
+
for (let i = 0; i < count - 1; i++)
|
|
44
|
+
picks.add(Math.floor((i * (length - 1)) / (count - 1)));
|
|
45
|
+
picks.add(length - 1);
|
|
46
|
+
return [...picks].sort((a, b) => a - b);
|
|
47
|
+
}
|
|
48
|
+
/** The point a chart's peak callout names: the first highest value. `undefined` when nothing is above zero. */
|
|
49
|
+
export function chartPeak(data) {
|
|
50
|
+
let best;
|
|
51
|
+
for (const d of data)
|
|
52
|
+
if (d.value > 0 && (!best || d.value > best.value))
|
|
53
|
+
best = d;
|
|
54
|
+
return best;
|
|
55
|
+
}
|
|
56
|
+
/** Clamp to the drawable range: a negative or non-finite value draws as zero. */
|
|
57
|
+
export function chartValue(value) {
|
|
58
|
+
return Number.isFinite(value) && value > 0 ? value : 0;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* The value axis: top, two thirds, one third, zero, spaced to the plot's height.
|
|
62
|
+
* Decorative; the table carries the values.
|
|
63
|
+
*/
|
|
64
|
+
export function ChartValueAxis({ top, height, inset = 0, format, }) {
|
|
65
|
+
const ticks = [top, (top / 3) * 2, top / 3, 0];
|
|
66
|
+
return (_jsx("div", { "data-slot": "chart-value-axis", className: "flex shrink-0 flex-col justify-between text-caption leading-none text-faint-strong tabular-nums", style: { height: height - inset, marginTop: inset }, children: ticks.map((t) => (_jsx("span", { children: format(t) }, t))) }));
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* The date axis: the picked labels spread edge to edge, the first flush left and
|
|
70
|
+
* the last flush right, with at least 8px between neighbours.
|
|
71
|
+
*
|
|
72
|
+
* Spread rather than pinned under each point, which is what the frames do too
|
|
73
|
+
* (their "Date range" row is evenly spaced). The picks are evenly spaced, so a
|
|
74
|
+
* label lands within a slot of its point, and two labels can never overlap the
|
|
75
|
+
* way pinned ones do once the card narrows to the side panel.
|
|
76
|
+
*/
|
|
77
|
+
export function ChartDateAxis({ data, ticks }) {
|
|
78
|
+
const picks = chartTickIndices(data.length, ticks);
|
|
79
|
+
return (_jsx("div", { "data-slot": "chart-date-axis", className: cn("flex min-w-0 gap-2 text-caption leading-5 text-faint-strong", picks.length === 1 ? "justify-center" : "justify-between"), children: picks.map((i) => (_jsx("span", { "data-slot": "chart-date-tick", className: "whitespace-nowrap", children: data[i].label }, i))) }));
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* The chart, as a table, for a screen reader. The drawn plot is `aria-hidden`:
|
|
83
|
+
* thirty bars announced as thirty unlabelled images tell nobody anything, and a
|
|
84
|
+
* table can be read row by row, which is what a sighted reader does with the
|
|
85
|
+
* tooltip.
|
|
86
|
+
*/
|
|
87
|
+
export function ChartTable({ data, labelName, valueName, format, note, }) {
|
|
88
|
+
return (_jsxs("table", { "data-slot": "chart-table", className: "sr-only", children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { scope: "col", children: labelName }), _jsx("th", { scope: "col", children: valueName })] }) }), _jsx("tbody", { children: data.map((d, i) => (_jsxs("tr", { children: [_jsxs("th", { scope: "row", children: [d.label, note && note.index === i ? `, ${note.text}` : null] }), _jsx("td", { children: format(chartValue(d.value)) })] }, d.key ?? `${d.label}-${i}`))) })] }));
|
|
89
|
+
}
|
|
90
|
+
/** The words a component prints when it has nothing to draw, in one place. */
|
|
91
|
+
export function ChartEmpty({ children }) {
|
|
92
|
+
return (_jsx("p", { "data-slot": "chart-empty", className: "m-0 text-body-sm text-faint-strong", children: children }));
|
|
93
|
+
}
|
|
94
|
+
/** What a screen reader hears while a component's data is on its way. */
|
|
95
|
+
export const CHART_LOADING_TEXT = "Loading";
|
|
96
|
+
//# sourceMappingURL=chart-parts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chart-parts.js","sourceRoot":"","sources":["../../src/blocks/chart-parts.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAA;AAkCvC,qHAAqH;AACrH,MAAM,qBAAqB,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAA;AAE5D,MAAM,UAAU,iBAAiB,CAAC,KAAa;IAC7C,OA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AAC,CAAC,KAAK,CAAC,CAAC,GAAM,KAL/B,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,IAAI,CAAC,EAAE,CAM9B,CACN,CAAC,GACI,IACF,CACT,CAAA;AACH,CAAC;AAED,8EAA8E;AAC9E,MAAM,UAAU,UAAU,CAAC,EAAE,QAAQ,EAAiC;IACpE,OAAO,CACL,yBAAa,aAAa,EAAC,SAAS,EAAC,oCAAoC,YACtE,QAAQ,GACP,CACL,CAAA;AACH,CAAC;AAED,yEAAyE;AACzE,MAAM,CAAC,MAAM,kBAAkB,GAAG,SAAS,CAAA"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Badge } from "../ui/badge.js";
|
|
3
|
+
/**
|
|
4
|
+
* THE COMING SOON TAG (#334, Figma "App final / Parts" 10780:9225).
|
|
5
|
+
*
|
|
6
|
+
* The one mark that says a card is a preview of something not built yet. The
|
|
7
|
+
* App page v2 shows a few such cards with example values (App Score, Time Saved
|
|
8
|
+
* over Time, Grid tokens, the Insights summary line) and a few disabled
|
|
9
|
+
* controls (Answer, Track, Dismiss). Each says so with this tag, and with
|
|
10
|
+
* nothing else: the founder ruled against an "Example data" footer.
|
|
11
|
+
*
|
|
12
|
+
* It is `Badge` outline (20px, `text-caption`, medium, `border-border`) with
|
|
13
|
+
* fixed words. The words are the block's rather than the caller's, because
|
|
14
|
+
* "Coming soon" is the canonical text and a tag that took children would drift
|
|
15
|
+
* to "Soon", "Preview" and "Beta" one card at a time.
|
|
16
|
+
*
|
|
17
|
+
* ## Where it goes
|
|
18
|
+
*
|
|
19
|
+
* The frames' rule, from the annotation: at most one per card, in the header of
|
|
20
|
+
* a preview card (`CardAction` is the slot), never on a card whose values are
|
|
21
|
+
* real and never on an inner tile. Pair it with `example` on the `Card` and on
|
|
22
|
+
* any `StatTile` inside, which mutes the values.
|
|
23
|
+
*
|
|
24
|
+
* ## Accessibility
|
|
25
|
+
*
|
|
26
|
+
* Plain text, read in order. A screen reader reaches "App Score, Coming soon"
|
|
27
|
+
* through the card header, which is the reason the tag sits there rather than
|
|
28
|
+
* floating over the values.
|
|
29
|
+
*/
|
|
30
|
+
/** The canonical text. Exported so a test or a consumer's string check reads one spelling. */
|
|
31
|
+
export declare const COMING_SOON_LABEL = "Coming soon";
|
|
32
|
+
declare function ComingSoonTag({ className, ...props }: Omit<React.ComponentProps<typeof Badge>, "children" | "variant" | "render">): React.JSX.Element;
|
|
33
|
+
export { ComingSoonTag };
|
|
34
|
+
//# sourceMappingURL=coming-soon-tag.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coming-soon-tag.d.ts","sourceRoot":"","sources":["../../src/blocks/coming-soon-tag.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAE3C;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,8FAA8F;AAC9F,eAAO,MAAM,iBAAiB,gBAAgB,CAAA;AAE9C,iBAAS,aAAa,CAAC,EACrB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,KAAK,CAAC,EAAE,UAAU,GAAG,SAAS,GAAG,QAAQ,CAAC,qBAW7E;AAED,OAAO,EAAE,aAAa,EAAE,CAAA"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { Badge } from "../ui/badge.js";
|
|
4
|
+
/**
|
|
5
|
+
* THE COMING SOON TAG (#334, Figma "App final / Parts" 10780:9225).
|
|
6
|
+
*
|
|
7
|
+
* The one mark that says a card is a preview of something not built yet. The
|
|
8
|
+
* App page v2 shows a few such cards with example values (App Score, Time Saved
|
|
9
|
+
* over Time, Grid tokens, the Insights summary line) and a few disabled
|
|
10
|
+
* controls (Answer, Track, Dismiss). Each says so with this tag, and with
|
|
11
|
+
* nothing else: the founder ruled against an "Example data" footer.
|
|
12
|
+
*
|
|
13
|
+
* It is `Badge` outline (20px, `text-caption`, medium, `border-border`) with
|
|
14
|
+
* fixed words. The words are the block's rather than the caller's, because
|
|
15
|
+
* "Coming soon" is the canonical text and a tag that took children would drift
|
|
16
|
+
* to "Soon", "Preview" and "Beta" one card at a time.
|
|
17
|
+
*
|
|
18
|
+
* ## Where it goes
|
|
19
|
+
*
|
|
20
|
+
* The frames' rule, from the annotation: at most one per card, in the header of
|
|
21
|
+
* a preview card (`CardAction` is the slot), never on a card whose values are
|
|
22
|
+
* real and never on an inner tile. Pair it with `example` on the `Card` and on
|
|
23
|
+
* any `StatTile` inside, which mutes the values.
|
|
24
|
+
*
|
|
25
|
+
* ## Accessibility
|
|
26
|
+
*
|
|
27
|
+
* Plain text, read in order. A screen reader reaches "App Score, Coming soon"
|
|
28
|
+
* through the card header, which is the reason the tag sits there rather than
|
|
29
|
+
* floating over the values.
|
|
30
|
+
*/
|
|
31
|
+
/** The canonical text. Exported so a test or a consumer's string check reads one spelling. */
|
|
32
|
+
export const COMING_SOON_LABEL = "Coming soon";
|
|
33
|
+
function ComingSoonTag({ className, ...props }) {
|
|
34
|
+
return (_jsx(Badge, { variant: "outline", "data-slot": "coming-soon-tag", className: className, ...props, children: COMING_SOON_LABEL }));
|
|
35
|
+
}
|
|
36
|
+
export { ComingSoonTag };
|
|
37
|
+
//# sourceMappingURL=coming-soon-tag.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coming-soon-tag.js","sourceRoot":"","sources":["../../src/blocks/coming-soon-tag.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAE3C;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,8FAA8F;AAC9F,MAAM,CAAC,MAAM,iBAAiB,GAAG,aAAa,CAAA;AAE9C,SAAS,aAAa,CAAC,EACrB,SAAS,EACT,GAAG,KAAK,EACoE;IAC5E,OAAO,CACL,KAAC,KAAK,IACJ,OAAO,EAAC,SAAS,eACP,iBAAiB,EAC3B,SAAS,EAAE,SAAS,KAChB,KAAK,YAER,iBAAiB,GACZ,CACT,CAAA;AACH,CAAC;AAED,OAAO,EAAE,aAAa,EAAE,CAAA"}
|