@cloudgrid-io/ui 0.51.0 → 0.52.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.
Files changed (55) hide show
  1. package/dist/blocks/avatar.d.ts +1 -1
  2. package/dist/blocks/avatar.d.ts.map +1 -1
  3. package/dist/blocks/avatar.js +13 -5
  4. package/dist/blocks/avatar.js.map +1 -1
  5. package/dist/blocks/celebration.d.ts.map +1 -1
  6. package/dist/blocks/celebration.js +10 -3
  7. package/dist/blocks/celebration.js.map +1 -1
  8. package/dist/blocks/entity-card-meta.d.ts +4 -2
  9. package/dist/blocks/entity-card-meta.d.ts.map +1 -1
  10. package/dist/blocks/entity-card-meta.js +1 -1
  11. package/dist/blocks/entity-card-meta.js.map +1 -1
  12. package/dist/blocks/filter-tabs.d.ts +17 -1
  13. package/dist/blocks/filter-tabs.d.ts.map +1 -1
  14. package/dist/blocks/filter-tabs.js +20 -4
  15. package/dist/blocks/filter-tabs.js.map +1 -1
  16. package/dist/blocks/header-menu.d.ts +9 -1
  17. package/dist/blocks/header-menu.d.ts.map +1 -1
  18. package/dist/blocks/header-menu.js +12 -2
  19. package/dist/blocks/header-menu.js.map +1 -1
  20. package/dist/blocks/ranked-list.d.ts +15 -1
  21. package/dist/blocks/ranked-list.d.ts.map +1 -1
  22. package/dist/blocks/ranked-list.js +6 -2
  23. package/dist/blocks/ranked-list.js.map +1 -1
  24. package/dist/blocks/scatter.d.ts +17 -2
  25. package/dist/blocks/scatter.d.ts.map +1 -1
  26. package/dist/blocks/scatter.js +3 -2
  27. package/dist/blocks/scatter.js.map +1 -1
  28. package/dist/blocks/side-nav.d.ts +8 -1
  29. package/dist/blocks/side-nav.d.ts.map +1 -1
  30. package/dist/blocks/side-nav.js +47 -22
  31. package/dist/blocks/side-nav.js.map +1 -1
  32. package/dist/console.css +12 -0
  33. package/dist/index.d.ts +2 -0
  34. package/dist/index.d.ts.map +1 -1
  35. package/dist/index.js +2 -0
  36. package/dist/index.js.map +1 -1
  37. package/dist/lib/cloudgrid-cn.d.ts +1 -1
  38. package/dist/lib/cloudgrid-cn.d.ts.map +1 -1
  39. package/dist/lib/cloudgrid-cn.js +2 -0
  40. package/dist/lib/cloudgrid-cn.js.map +1 -1
  41. package/dist/theme.css +10 -0
  42. package/dist/tokens/base.json +50 -1
  43. package/dist/tokens/surface-ink.json +9 -0
  44. package/dist/tokens/surface-panel.json +9 -0
  45. package/dist/tokens.css +52 -1
  46. package/dist/tokens.json +8 -1
  47. package/dist/ui/count-bubble.d.ts +68 -0
  48. package/dist/ui/count-bubble.d.ts.map +1 -0
  49. package/dist/ui/count-bubble.js +89 -0
  50. package/dist/ui/count-bubble.js.map +1 -0
  51. package/dist/ui/kbd.d.ts +38 -0
  52. package/dist/ui/kbd.d.ts.map +1 -0
  53. package/dist/ui/kbd.js +45 -0
  54. package/dist/ui/kbd.js.map +1 -0
  55. package/package.json +1 -1
@@ -0,0 +1,68 @@
1
+ import { useRender } from "@base-ui/react/use-render";
2
+ /**
3
+ * A small count in a pill: on an icon (the notifications bell) or inline
4
+ * beside a row (pending vault grant requests). ui#478.
5
+ *
6
+ * ## What it replaces, copied as drawn
7
+ *
8
+ * The Console drew both of these itself, each with a hand-set 10px, because no
9
+ * library piece or type role could draw a count this small: `text-caption`,
10
+ * 13px, overflows a 16px bubble carrying two characters.
11
+ *
12
+ * the bell 16px tall, 16 at least wide, 4px aside, medium, the CTA teal
13
+ * with its ink word, on the glyph's top right
14
+ * the vault 18px tall, 18 at least wide, 6px aside, bold, danger with a
15
+ * white word, capped at "9+"
16
+ *
17
+ * Both are here as they were. The size is the `micro` role (`--cg-micro-size`,
18
+ * 10px at leading 1), so the number is the library's and not the caller's.
19
+ * The weight goes with the size rather than with the role, because the two
20
+ * bubbles disagree on it and each was drawn on purpose.
21
+ *
22
+ * ## The tone
23
+ *
24
+ * `cta` is the teal of the Console's New button, its default: an access request
25
+ * is somebody asking politely, and red would file it as an incident. `danger`
26
+ * is for counts that need action. Both come from tokens, and the danger word
27
+ * flips to ink on the panel and on ink, where `--cg-danger` is a pale red.
28
+ *
29
+ * ## What a screen reader hears
30
+ *
31
+ * The caller's `label`, never the bare digits: "9+" means nothing read aloud,
32
+ * and the number alone does not say what is counted. The digits are
33
+ * `aria-hidden`; the label sits beside them in an `sr-only` span. Inside a
34
+ * control that carries its own `aria-label` (the bell's trigger) that name
35
+ * wins and the bubble is silent, which is what the trigger wants.
36
+ *
37
+ * ## No count, no bubble
38
+ *
39
+ * Zero, a negative number or `NaN` renders nothing, as both Console bubbles did.
40
+ *
41
+ * ## As a button
42
+ *
43
+ * `render={<button type="button" onClick={...} />}` makes it the control (the
44
+ * vault's top-nav count). It then takes the label as its name and the library's
45
+ * Tab-only frame (`focus-line`, ui#441).
46
+ */
47
+ export declare const COUNT_BUBBLE_SIZES: readonly [16, 18];
48
+ /** 16 (the bell) or 18 (the vault's pending requests) tall. */
49
+ export type CountBubbleSize = (typeof COUNT_BUBBLE_SIZES)[number];
50
+ export type CountBubbleTone = "cta" | "danger";
51
+ /** `inline` beside text, or `corner`: on an icon's top right, inside a positioned target. */
52
+ export type CountBubblePlacement = "inline" | "corner";
53
+ declare function CountBubble({ count, label, max, size, tone, placement, className, render, ...props }: Omit<useRender.ComponentProps<"span">, "children"> & {
54
+ /** The number. Zero or less draws nothing. */
55
+ count: number;
56
+ /** What a screen reader hears instead of the digits, e.g. "3 pending vault grant requests". */
57
+ label: string;
58
+ /** Above this the bubble reads `max+`. Defaults to 9, so ten is "9+". */
59
+ max?: number;
60
+ /** 16 (the default, the bell) or 18 (the vault). */
61
+ size?: CountBubbleSize;
62
+ /** `cta` (the default, the teal) or `danger`. */
63
+ tone?: CountBubbleTone;
64
+ /** `inline` (the default) or `corner`, on an icon's top right. */
65
+ placement?: CountBubblePlacement;
66
+ }): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | null;
67
+ export { CountBubble };
68
+ //# sourceMappingURL=count-bubble.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"count-bubble.d.ts","sourceRoot":"","sources":["../../src/ui/count-bubble.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AAIrD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAEH,eAAO,MAAM,kBAAkB,mBAAoB,CAAA;AAEnD,+DAA+D;AAC/D,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAA;AACjE,MAAM,MAAM,eAAe,GAAG,KAAK,GAAG,QAAQ,CAAA;AAC9C,6FAA6F;AAC7F,MAAM,MAAM,oBAAoB,GAAG,QAAQ,GAAG,QAAQ,CAAA;AAsBtD,iBAAS,WAAW,CAAC,EACnB,KAAK,EACL,KAAK,EACL,GAAO,EACP,IAAS,EACT,IAAY,EACZ,SAAoB,EACpB,SAAS,EACT,MAAM,EACN,GAAG,KAAK,EACT,EAAE,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC,GAAG;IACtD,8CAA8C;IAC9C,KAAK,EAAE,MAAM,CAAA;IACb,+FAA+F;IAC/F,KAAK,EAAE,MAAM,CAAA;IACb,yEAAyE;IACzE,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,oDAAoD;IACpD,IAAI,CAAC,EAAE,eAAe,CAAA;IACtB,iDAAiD;IACjD,IAAI,CAAC,EAAE,eAAe,CAAA;IACtB,kEAAkE;IAClE,SAAS,CAAC,EAAE,oBAAoB,CAAA;CACjC,qGAiCA;AAED,OAAO,EAAE,WAAW,EAAE,CAAA"}
@@ -0,0 +1,89 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { mergeProps } from "@base-ui/react/merge-props";
3
+ import { useRender } from "@base-ui/react/use-render";
4
+ import { cn } from "../lib/cloudgrid-cn.js";
5
+ /**
6
+ * A small count in a pill: on an icon (the notifications bell) or inline
7
+ * beside a row (pending vault grant requests). ui#478.
8
+ *
9
+ * ## What it replaces, copied as drawn
10
+ *
11
+ * The Console drew both of these itself, each with a hand-set 10px, because no
12
+ * library piece or type role could draw a count this small: `text-caption`,
13
+ * 13px, overflows a 16px bubble carrying two characters.
14
+ *
15
+ * the bell 16px tall, 16 at least wide, 4px aside, medium, the CTA teal
16
+ * with its ink word, on the glyph's top right
17
+ * the vault 18px tall, 18 at least wide, 6px aside, bold, danger with a
18
+ * white word, capped at "9+"
19
+ *
20
+ * Both are here as they were. The size is the `micro` role (`--cg-micro-size`,
21
+ * 10px at leading 1), so the number is the library's and not the caller's.
22
+ * The weight goes with the size rather than with the role, because the two
23
+ * bubbles disagree on it and each was drawn on purpose.
24
+ *
25
+ * ## The tone
26
+ *
27
+ * `cta` is the teal of the Console's New button, its default: an access request
28
+ * is somebody asking politely, and red would file it as an incident. `danger`
29
+ * is for counts that need action. Both come from tokens, and the danger word
30
+ * flips to ink on the panel and on ink, where `--cg-danger` is a pale red.
31
+ *
32
+ * ## What a screen reader hears
33
+ *
34
+ * The caller's `label`, never the bare digits: "9+" means nothing read aloud,
35
+ * and the number alone does not say what is counted. The digits are
36
+ * `aria-hidden`; the label sits beside them in an `sr-only` span. Inside a
37
+ * control that carries its own `aria-label` (the bell's trigger) that name
38
+ * wins and the bubble is silent, which is what the trigger wants.
39
+ *
40
+ * ## No count, no bubble
41
+ *
42
+ * Zero, a negative number or `NaN` renders nothing, as both Console bubbles did.
43
+ *
44
+ * ## As a button
45
+ *
46
+ * `render={<button type="button" onClick={...} />}` makes it the control (the
47
+ * vault's top-nav count). It then takes the label as its name and the library's
48
+ * Tab-only frame (`focus-line`, ui#441).
49
+ */
50
+ export const COUNT_BUBBLE_SIZES = [16, 18];
51
+ const SIZE = {
52
+ 16: "h-4 min-w-4 px-1 font-medium",
53
+ 18: "h-4.5 min-w-4.5 px-1.5 font-bold",
54
+ };
55
+ const TONE = {
56
+ cta: "bg-cyan text-on-accent",
57
+ danger: "bg-danger text-on-danger",
58
+ };
59
+ const PLACEMENT = {
60
+ // `relative` so the sr-only label is clipped to the bubble, not to some
61
+ // ancestor further up.
62
+ inline: "relative",
63
+ // The bell's 32px target put the bubble at top 0, left 16: the target's top
64
+ // edge and its middle, which is the glyph's top right. As fractions of the
65
+ // target it stays there for any target size.
66
+ corner: "absolute top-0 left-1/2",
67
+ };
68
+ function CountBubble({ count, label, max = 9, size = 16, tone = "cta", placement = "inline", className, render, ...props }) {
69
+ const element = useRender({
70
+ defaultTagName: "span",
71
+ props: mergeProps({
72
+ className: cn("inline-flex shrink-0 items-center justify-center whitespace-nowrap rounded-full text-micro tabular-nums focus-line", SIZE[size], TONE[tone], PLACEMENT[placement], className),
73
+ children: (_jsxs(_Fragment, { children: [_jsx("span", { "aria-hidden": "true", children: count > max ? `${max}+` : String(count) }), _jsx("span", { className: "sr-only", children: label })] })),
74
+ }, props),
75
+ render,
76
+ state: {
77
+ slot: "count-bubble",
78
+ size,
79
+ tone,
80
+ placement,
81
+ },
82
+ });
83
+ // After the hook, so the hook order never depends on the count.
84
+ if (!(count > 0))
85
+ return null;
86
+ return element;
87
+ }
88
+ export { CountBubble };
89
+ //# sourceMappingURL=count-bubble.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"count-bubble.js","sourceRoot":"","sources":["../../src/ui/count-bubble.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAA;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AAErD,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAA;AAEvC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,EAAE,EAAE,EAAE,CAAU,CAAA;AAQnD,MAAM,IAAI,GAAoC;IAC5C,EAAE,EAAE,8BAA8B;IAClC,EAAE,EAA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board key: the `/` hint in a search field, a shortcut in a tooltip.
3
+ * ui#482.
4
+ *
5
+ * ## The Console's key cap, moved in
6
+ *
7
+ * The Console drew every `<kbd>` from one rule in its own globals.css: the mono
8
+ * face at a hand-set 11px, the secondary text colour, a 1px control line, the
9
+ * small corner (`--cg-radius-xs`), 1px by 5px of padding and the page ground.
10
+ * That is this piece, with one change: the size is the `micro` role,
11
+ * `--cg-micro-size` (10px at leading 1), the library's smallest rung and one
12
+ * pixel under the 11px it replaces. No role is 11px; the next one up, caption,
13
+ * is 13px, which would be the larger change.
14
+ *
15
+ * The box stays the 20px the 11px key drew at the body leading (20.05px): the
16
+ * height is fixed (`h-5`) and the key centred in it, so swapping the leading
17
+ * for the role's 1 does not shrink the cap.
18
+ *
19
+ * ## On the panel and on ink
20
+ *
21
+ * The Console only ever drew a key on its light page. `--cg-surface-page` does
22
+ * not flip, while the secondary word does, so on a purple panel or on ink the
23
+ * key would be white on near-white. There the key takes the surface's own
24
+ * ground and its ink, as `EmptyCreations` does for its tiles; the line already
25
+ * flips.
26
+ *
27
+ * ## Ligatures off
28
+ *
29
+ * The mono face, JetBrains Mono, fuses `--` and `->` into one glyph by default.
30
+ * A key reads as typed, so they are off here, as the Console's rule had them.
31
+ *
32
+ * ## In a tooltip
33
+ *
34
+ * `data-slot="kbd"` is the hook `TooltipContent` already styles a key by.
35
+ */
36
+ declare function Kbd({ className, ...props }: React.ComponentProps<"kbd">): import("react").JSX.Element;
37
+ export { Kbd };
38
+ //# sourceMappingURL=kbd.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kbd.d.ts","sourceRoot":"","sources":["../../src/ui/kbd.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,iBAAS,GAAG,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,+BAchE;AAED,OAAO,EAAE,GAAG,EAAE,CAAA"}
package/dist/ui/kbd.js ADDED
@@ -0,0 +1,45 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { cn } from "../lib/cloudgrid-cn.js";
3
+ /**
4
+ * A keyboard key: the `/` hint in a search field, a shortcut in a tooltip.
5
+ * ui#482.
6
+ *
7
+ * ## The Console's key cap, moved in
8
+ *
9
+ * The Console drew every `<kbd>` from one rule in its own globals.css: the mono
10
+ * face at a hand-set 11px, the secondary text colour, a 1px control line, the
11
+ * small corner (`--cg-radius-xs`), 1px by 5px of padding and the page ground.
12
+ * That is this piece, with one change: the size is the `micro` role,
13
+ * `--cg-micro-size` (10px at leading 1), the library's smallest rung and one
14
+ * pixel under the 11px it replaces. No role is 11px; the next one up, caption,
15
+ * is 13px, which would be the larger change.
16
+ *
17
+ * The box stays the 20px the 11px key drew at the body leading (20.05px): the
18
+ * height is fixed (`h-5`) and the key centred in it, so swapping the leading
19
+ * for the role's 1 does not shrink the cap.
20
+ *
21
+ * ## On the panel and on ink
22
+ *
23
+ * The Console only ever drew a key on its light page. `--cg-surface-page` does
24
+ * not flip, while the secondary word does, so on a purple panel or on ink the
25
+ * key would be white on near-white. There the key takes the surface's own
26
+ * ground and its ink, as `EmptyCreations` does for its tiles; the line already
27
+ * flips.
28
+ *
29
+ * ## Ligatures off
30
+ *
31
+ * The mono face, JetBrains Mono, fuses `--` and `->` into one glyph by default.
32
+ * A key reads as typed, so they are off here, as the Console's rule had them.
33
+ *
34
+ * ## In a tooltip
35
+ *
36
+ * `data-slot="kbd"` is the hook `TooltipContent` already styles a key by.
37
+ */
38
+ function Kbd({ className, ...props }) {
39
+ return (_jsx("kbd", { "data-slot": "kbd", className: cn("inline-flex h-5 shrink-0 items-center justify-center rounded-xs border border-line bg-page px-1.25 font-mono text-micro text-body [font-variant-ligatures:none]",
40
+ // The page ground does not flip, and the secondary word does: on the
41
+ // panel or on ink the key takes the surface's own ground and its ink.
42
+ "in-data-[cg-surface=panel]:bg-panel in-data-[cg-surface=panel]:text-ink in-data-[cg-surface=ink]:bg-code in-data-[cg-surface=ink]:text-ink", className), ...props }));
43
+ }
44
+ export { Kbd };
45
+ //# sourceMappingURL=kbd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kbd.js","sourceRoot":"","sources":["../../src/ui/kbd.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAA;AAEvC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,SAAS,GAAG,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAA+B;IAC/D,OAAO,CACL,2BACY,KAAK,EACf,SAAS,EAAE,EAAE,CACX,iKAAiK;QACjK,qEAAqE;QACrE,sEAAsE;QACtE,4IAA4I,EAC5I,SAAS,CACV,KACG,KAAK,GACT,CACH,CAAA;AACH,CAAC;AAED,OAAO,EAAE,GAAG,EAAE,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudgrid-io/ui",
3
- "version": "0.51.0",
3
+ "version": "0.52.0",
4
4
  "description": "CloudGrid design system: React components, brand design tokens, Tailwind theme, self-hosted fonts.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/",