@hirobius/design-system 0.10.0 → 0.12.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 (95) hide show
  1. package/README.md +44 -1
  2. package/dist/brand.js +36 -0
  3. package/dist/contexts.js +63 -59
  4. package/dist/hirobius-ui.js +22641 -3700
  5. package/dist/manifest.js +9 -9
  6. package/dist/scroll.js +42 -0
  7. package/dist/styles.css +1 -1
  8. package/dist/tokens.css +1 -1
  9. package/dist/tokens.js +26 -5
  10. package/dist/types/src/app/components/activity-feed.d.ts +24 -2
  11. package/dist/types/src/app/components/alert-dialog.d.ts +56 -0
  12. package/dist/types/src/app/components/app-shell.d.ts +38 -0
  13. package/dist/types/src/app/components/aspect-ratio.d.ts +25 -0
  14. package/dist/types/src/app/components/avatar-group.d.ts +22 -0
  15. package/dist/types/src/app/components/bleed.d.ts +39 -0
  16. package/dist/types/src/app/components/blockquote.d.ts +20 -0
  17. package/dist/types/src/app/components/box-sx.d.ts +69 -0
  18. package/dist/types/src/app/components/box.d.ts +42 -0
  19. package/dist/types/src/app/components/breadcrumb.d.ts +5 -0
  20. package/dist/types/src/app/components/button-group.d.ts +18 -0
  21. package/dist/types/src/app/components/calendar.d.ts +20 -0
  22. package/dist/types/src/app/components/card.d.ts +29 -13
  23. package/dist/types/src/app/components/carousel.d.ts +24 -0
  24. package/dist/types/src/app/components/center.d.ts +36 -0
  25. package/dist/types/src/app/components/circular-progress.d.ts +28 -0
  26. package/dist/types/src/app/components/cluster.d.ts +39 -0
  27. package/dist/types/src/app/components/code-block.d.ts +19 -1
  28. package/dist/types/src/app/components/command-palette.d.ts +44 -0
  29. package/dist/types/src/app/components/container.d.ts +10 -0
  30. package/dist/types/src/app/components/context-menu.d.ts +55 -0
  31. package/dist/types/src/app/components/cover.d.ts +43 -0
  32. package/dist/types/src/app/components/date-input.d.ts +31 -0
  33. package/dist/types/src/app/components/date-range-input.d.ts +34 -0
  34. package/dist/types/src/app/components/date-time-input.d.ts +30 -0
  35. package/dist/types/src/app/components/disclosure.d.ts +5 -1
  36. package/dist/types/src/app/components/divider.d.ts +14 -10
  37. package/dist/types/src/app/components/doc-link-card.d.ts +5 -1
  38. package/dist/types/src/app/components/field.d.ts +9 -11
  39. package/dist/types/src/app/components/file-input.d.ts +28 -0
  40. package/dist/types/src/app/components/frame.d.ts +38 -0
  41. package/dist/types/src/app/components/hds-tooltip.d.ts +45 -0
  42. package/dist/types/src/app/components/heading-stack.d.ts +15 -5
  43. package/dist/types/src/app/components/hover-card.d.ts +31 -0
  44. package/dist/types/src/app/components/image-lightbox.d.ts +13 -0
  45. package/dist/types/src/app/components/inline-code.d.ts +14 -3
  46. package/dist/types/src/app/components/input-group.d.ts +23 -0
  47. package/dist/types/src/app/components/kbd.d.ts +18 -0
  48. package/dist/types/src/app/components/metadata-list.d.ts +43 -0
  49. package/dist/types/src/app/components/multi-selector.d.ts +40 -0
  50. package/dist/types/src/app/components/nav-group.d.ts +7 -2
  51. package/dist/types/src/app/components/nav-item.d.ts +12 -2
  52. package/dist/types/src/app/components/overflow-list.d.ts +19 -0
  53. package/dist/types/src/app/components/pin.d.ts +30 -0
  54. package/dist/types/src/app/components/reveal.d.ts +31 -0
  55. package/dist/types/src/app/components/segmented-control.d.ts +37 -3
  56. package/dist/types/src/app/components/selectable-card.d.ts +29 -0
  57. package/dist/types/src/app/components/side-nav.d.ts +21 -0
  58. package/dist/types/src/app/components/sidebar.d.ts +45 -0
  59. package/dist/types/src/app/components/stat.d.ts +8 -10
  60. package/dist/types/src/app/components/status-dot.d.ts +25 -0
  61. package/dist/types/src/app/components/status-list-item.d.ts +10 -11
  62. package/dist/types/src/app/components/stepper.d.ts +31 -0
  63. package/dist/types/src/app/components/switcher.d.ts +41 -0
  64. package/dist/types/src/app/components/table.d.ts +12 -1
  65. package/dist/types/src/app/components/tag.d.ts +19 -18
  66. package/dist/types/src/app/components/text.d.ts +8 -2
  67. package/dist/types/src/app/components/textarea.d.ts +38 -0
  68. package/dist/types/src/app/components/time-input.d.ts +24 -0
  69. package/dist/types/src/app/components/timestamp.d.ts +24 -0
  70. package/dist/types/src/app/components/toast.d.ts +8 -2
  71. package/dist/types/src/app/components/toggle-button.d.ts +32 -0
  72. package/dist/types/src/app/components/token.d.ts +26 -1
  73. package/dist/types/src/app/components/tokenizer.d.ts +24 -0
  74. package/dist/types/src/app/components/toolbar.d.ts +36 -0
  75. package/dist/types/src/app/components/top-nav.d.ts +21 -0
  76. package/dist/types/src/app/components/tree-list.d.ts +28 -0
  77. package/dist/types/src/app/components/visually-hidden.d.ts +17 -0
  78. package/dist/types/src/app/context/TenantContext.d.ts +1 -1
  79. package/dist/types/src/app/context/hds-theme.d.ts +68 -0
  80. package/dist/types/src/app/data/nav-model.d.ts +39 -0
  81. package/dist/types/src/app/design-system/generated-token-refs.d.ts +20 -0
  82. package/dist/types/src/app/design-system/generated-token-values.d.ts +14 -1
  83. package/dist/types/src/app/{pages/hds → layouts}/HdsSystemDocLayout.d.ts +1 -1
  84. package/dist/types/src/app/lib/hds-search.d.ts +45 -0
  85. package/dist/types/src/brand/index.d.ts +9 -0
  86. package/dist/types/src/brand/overlay.d.ts +71 -0
  87. package/dist/types/src/index.d.ts +109 -2
  88. package/dist/types/src/scroll/index.d.ts +16 -0
  89. package/dist/types/src/scroll/smooth-scroll.d.ts +48 -0
  90. package/dist/types/src/scroll/use-scroll-progress.d.ts +34 -0
  91. package/dist/variables.css +22 -5
  92. package/hirobius.tokens.json +70 -10
  93. package/package.json +41 -68
  94. package/public/hds-manifest.json +6057 -4732
  95. package/dist/types/src/app/components/info-page.d.ts +0 -10
package/README.md CHANGED
@@ -6,7 +6,17 @@ A publishable React + TypeScript component library, backed by a governed design-
6
6
 
7
7
  Installing HDS in another project? It ships to the **public npm registry** as
8
8
  `@hirobius/design-system` (ESM) — no `.npmrc`, no token, no registry config. Full
9
- guide: **[docs/CONSUMING.md](docs/CONSUMING.md)**. The short version:
9
+ guide: **[docs/CONSUMING.md](docs/CONSUMING.md)**.
10
+
11
+ > **Not on GitHub Packages.** This repo's **Packages** sidebar still shows an old
12
+ > `@hirobius/design-system` entry under GitHub Packages
13
+ > (`/pkgs/npm/design-system`). That listing is **frozen and no longer updated** —
14
+ > publishing moved to the public npm registry in
15
+ > [#39](https://github.com/hirobius/hirobius-design-system/pull/39). Always
16
+ > install from npm:
17
+ > **[npmjs.com/package/@hirobius/design-system](https://www.npmjs.com/package/@hirobius/design-system)**.
18
+
19
+ The short version:
10
20
 
11
21
  ```bash
12
22
  npm install @hirobius/design-system react react-dom
@@ -30,6 +40,39 @@ No router, Tailwind config, or font files needed. With a router, inject it once
30
40
  via `<HdsRouterProvider>`. See **[docs/CONSUMING.md](docs/CONSUMING.md)** for the
31
41
  router seam, `data-hds` scoping, and MUI coexistence.
32
42
 
43
+ ### Theming: the four dials
44
+
45
+ HDS theming is driven by root attributes + CSS variables, so it works with **zero
46
+ JavaScript** — set them on any element (React, Astro, plain HTML) and every HDS
47
+ descendant re-skins:
48
+
49
+ | Dial | Attribute / var | Values | Default |
50
+ | --- | --- | --- | --- |
51
+ | theme | `data-theme` | `dark` | light (unset) |
52
+ | density | `data-density` | `compact` | comfortable (unset) |
53
+ | brand | `data-brand` (+ `data-tenant` alias) | overlay slug | base (unset) |
54
+ | font | `--hds-font-family` / `--hds-font-family-mono` | any font-family | Satoshi / Geist Mono |
55
+
56
+ ```html
57
+ <!-- zero-JS: static markup (e.g. an Astro layout) -->
58
+ <div data-hds data-theme="dark" data-density="compact" data-brand="acme"
59
+ style="--hds-font-family: 'Inter', sans-serif">
60
+ …
61
+ </div>
62
+ ```
63
+
64
+ React apps can set the same contract declaratively with the typed
65
+ `<HdsThemeProvider>` (renders the `data-hds` scope wrapper) and read it back with
66
+ `useHdsTheme()` — it is a convenience, not a requirement:
67
+
68
+ ```tsx
69
+ import { HdsThemeProvider } from '@hirobius/design-system';
70
+
71
+ <HdsThemeProvider theme="dark" density="compact" brand="acme">
72
+ <App />
73
+ </HdsThemeProvider>;
74
+ ```
75
+
33
76
  ## Developing this repo
34
77
 
35
78
  ```bash
package/dist/brand.js ADDED
@@ -0,0 +1,36 @@
1
+ const l = (c, n) => `color-mix(in srgb, ${c} ${n}%, #000)`, E = (c, n) => `color-mix(in srgb, ${c} ${n}%, #fff)`, C = (c, n, t) => `color-mix(in srgb, ${c} ${t}%, ${n})`;
2
+ function d(c) {
3
+ const { primary: n, onPrimary: t, bg: r, fg: a, muted: f, accent: i, radius: o, fontHeading: s, fontBody: m } = c, e = {
4
+ // ── accent ramp (rest + derived interactive states) ──
5
+ "--semantic-accent-rest": n,
6
+ "--semantic-accent-hover": l(n, 88),
7
+ "--semantic-accent-pressed": l(n, 76),
8
+ "--semantic-accent-subtle": E(n, 12),
9
+ "--semantic-accent-content": n,
10
+ "--semantic-color-surface-accent": n,
11
+ "--semantic-color-surface-accentSubtle": E(n, 12),
12
+ "--semantic-color-border-accent": n,
13
+ "--semantic-color-content-onAccent": t,
14
+ // ── page + content ──
15
+ "--semantic-color-surface-page": r,
16
+ "--semantic-color-surface-raised": f,
17
+ "--semantic-color-content-primary": a,
18
+ "--semantic-color-content-secondary": C(a, r, 66)
19
+ };
20
+ return i && (e["--brand-accent"] = i), o && (e["--semantic-radius-action"] = o, e["--brand-radius"] = o), s && (e["--primitive-typography-family-display"] = s), m && (e["--primitive-typography-family-primary"] = m), e;
21
+ }
22
+ function y(c) {
23
+ return Object.entries(d(c)).map(([n, t]) => `${n}:${t}`).join(";");
24
+ }
25
+ function _(c, n) {
26
+ const t = Object.entries(d(n)).map(([r, a]) => ` ${r}: ${a};`).join(`
27
+ `);
28
+ return `${c} {
29
+ ${t}
30
+ }`;
31
+ }
32
+ export {
33
+ _ as brandOverlayCss,
34
+ y as brandOverlayStyle,
35
+ d as brandOverlayVars
36
+ };
package/dist/contexts.js CHANGED
@@ -1,7 +1,7 @@
1
- import { jsx as l, Fragment as A } from "react/jsx-runtime";
2
- import { useState as i, useCallback as a, useEffect as s, useContext as T, createContext as v } from "react";
3
- import { F as U, H as z, L as K, T as Y, b as j, u as q, a as B, c as J } from "./chunks/TokenDisplayContext-B3gxyQN7.js";
4
- const I = ["system", "light", "dark"], m = "hds-theme-mode", w = "hds-theme", S = v({
1
+ import { jsx as f, Fragment as M } from "react/jsx-runtime";
2
+ import { useState as u, useCallback as s, useEffect as a, useContext as S, createContext as D } from "react";
3
+ import { F as K, H as Y, L as j, T as q, b as J, u as Q, a as W, c as X } from "./chunks/TokenDisplayContext-B3gxyQN7.js";
4
+ const L = ["system", "light", "dark"], m = "hds-theme-mode", x = "hds-theme", _ = D({
5
5
  isDark: !0,
6
6
  toggleDark: () => {
7
7
  },
@@ -14,22 +14,22 @@ const I = ["system", "light", "dark"], m = "hds-theme-mode", w = "hds-theme", S
14
14
  setDensity: () => {
15
15
  }
16
16
  });
17
- function y() {
17
+ function T() {
18
18
  try {
19
19
  const t = localStorage.getItem(m);
20
- if (t && I.includes(t)) return t;
20
+ if (t && L.includes(t)) return t;
21
21
  } catch {
22
22
  }
23
23
  return "system";
24
24
  }
25
- function M() {
25
+ function P() {
26
26
  var t;
27
27
  return typeof window > "u" ? !1 : !!((t = window.matchMedia) != null && t.call(window, "(prefers-color-scheme: dark)").matches);
28
28
  }
29
29
  function E(t) {
30
- return t === "dark" ? !0 : t === "light" ? !1 : M();
30
+ return t === "dark" ? !0 : t === "light" ? !1 : P();
31
31
  }
32
- function L() {
32
+ function N() {
33
33
  try {
34
34
  const t = localStorage.getItem("hds-density");
35
35
  if (t === "compact" || t === "comfortable") return t;
@@ -37,97 +37,101 @@ function L() {
37
37
  }
38
38
  return "comfortable";
39
39
  }
40
- function C({ children: t }) {
41
- const [n, f] = i(y), [r, u] = i(() => E(y())), [c, g] = i(L), h = a((e) => {
40
+ function F({ children: t }) {
41
+ const [n, g] = u(T), [r, i] = u(() => E(T())), [c, h] = u(N), y = s((e) => {
42
42
  const o = e ? "dark" : "light";
43
43
  try {
44
- localStorage.setItem(w, o);
44
+ localStorage.setItem(x, o);
45
45
  } catch {
46
46
  }
47
47
  document.documentElement.setAttribute("data-theme", o), document.documentElement.classList.toggle("dark", e);
48
48
  }, []);
49
- s(() => {
49
+ a(() => {
50
50
  try {
51
51
  localStorage.setItem("hds-density", c);
52
52
  } catch {
53
53
  }
54
54
  document.documentElement.setAttribute("data-density", c);
55
- }, [c]), s(() => {
56
- h(r);
57
- }, [r, h]), s(() => {
55
+ }, [c]), a(() => {
56
+ y(r);
57
+ }, [r, y]), a(() => {
58
58
  if (n !== "system" || typeof window > "u" || !window.matchMedia) return;
59
59
  const e = window.matchMedia("(prefers-color-scheme: dark)"), o = () => {
60
- u(e.matches);
60
+ i(e.matches);
61
61
  };
62
62
  return e.addEventListener("change", o), () => {
63
63
  e.removeEventListener("change", o);
64
64
  };
65
65
  }, [n]);
66
- const _ = a(() => {
66
+ const A = s(() => {
67
67
  const e = !r, o = e ? "dark" : "light";
68
- f(o), u(e);
68
+ g(o), i(e);
69
69
  try {
70
70
  localStorage.setItem(m, o);
71
71
  } catch {
72
72
  }
73
- }, [r]), k = a((e) => {
74
- f(e), u(E(e));
73
+ }, [r]), b = s((e) => {
74
+ g(e), i(E(e));
75
75
  try {
76
76
  localStorage.setItem(m, e);
77
77
  } catch {
78
78
  }
79
- }, []), b = a(
80
- () => g((e) => e === "comfortable" ? "compact" : "comfortable"),
79
+ }, []), I = s(
80
+ () => h((e) => e === "comfortable" ? "compact" : "comfortable"),
81
81
  []
82
- ), p = a((e) => g(e), []);
83
- return /* @__PURE__ */ l(
84
- S.Provider,
82
+ ), w = s((e) => h(e), []);
83
+ return /* @__PURE__ */ f(
84
+ _.Provider,
85
85
  {
86
- value: { isDark: r, toggleDark: _, mode: n, setMode: k, density: c, toggleDensity: b, setDensity: p },
86
+ value: { isDark: r, toggleDark: A, mode: n, setMode: b, density: c, toggleDensity: I, setDensity: w },
87
87
  children: t
88
88
  }
89
89
  );
90
90
  }
91
- function N() {
92
- return T(S);
91
+ function G() {
92
+ return S(_);
93
93
  }
94
- const d = {}, D = v({ tenantSlug: null });
95
- function F({ children: t }) {
94
+ const d = {}, v = D({ tenantSlug: null }), p = ["data-brand", "data-tenant"];
95
+ function l(t) {
96
+ for (const n of p) document.documentElement.setAttribute(n, t);
97
+ }
98
+ function k() {
99
+ for (const t of p) document.documentElement.removeAttribute(t);
100
+ }
101
+ function O({ children: t }) {
96
102
  const n = typeof d.VITE_TENANT_SLUG == "string" && d.VITE_TENANT_SLUG.trim().length > 0 ? d.VITE_TENANT_SLUG.trim() : null;
97
- return s(() => {
103
+ return a(() => {
98
104
  if (n)
99
- return document.documentElement.setAttribute("data-tenant", n), () => {
100
- document.documentElement.removeAttribute("data-tenant");
101
- };
102
- }, [n]), /* @__PURE__ */ l(D.Provider, { value: { tenantSlug: n }, children: t });
105
+ return l(n), () => k();
106
+ }, [n]), /* @__PURE__ */ f(v.Provider, { value: { tenantSlug: n }, children: t });
103
107
  }
104
- function G() {
105
- return T(D);
108
+ function B() {
109
+ return S(v);
106
110
  }
107
- function O(t) {
108
- s(() => {
109
- const n = document.documentElement.getAttribute("data-tenant");
110
- return document.documentElement.setAttribute("data-tenant", t), () => {
111
- n !== null ? document.documentElement.setAttribute("data-tenant", n) : document.documentElement.removeAttribute("data-tenant");
111
+ function H(t) {
112
+ a(() => {
113
+ const n = document.documentElement.getAttribute("data-brand");
114
+ return l(t), () => {
115
+ n !== null ? l(n) : k();
112
116
  };
113
117
  }, [t]);
114
118
  }
115
- function H({ children: t }) {
116
- return /* @__PURE__ */ l(A, { children: t });
119
+ function V({ children: t }) {
120
+ return /* @__PURE__ */ f(M, { children: t });
117
121
  }
118
122
  export {
119
- H as FontProvider,
120
- U as FreezeState,
121
- z as HdsRouterProvider,
122
- K as LanguageProvider,
123
- F as TenantProvider,
124
- C as ThemeProvider,
125
- Y as TokenDisplayProvider,
126
- j as useFrozenState,
127
- q as useHdsRouter,
128
- B as useLanguage,
129
- G as useTenant,
130
- O as useTenantOnDocument,
131
- N as useTheme,
132
- J as useTokenDisplay
123
+ V as FontProvider,
124
+ K as FreezeState,
125
+ Y as HdsRouterProvider,
126
+ j as LanguageProvider,
127
+ O as TenantProvider,
128
+ F as ThemeProvider,
129
+ q as TokenDisplayProvider,
130
+ J as useFrozenState,
131
+ Q as useHdsRouter,
132
+ W as useLanguage,
133
+ B as useTenant,
134
+ H as useTenantOnDocument,
135
+ G as useTheme,
136
+ X as useTokenDisplay
133
137
  };