@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.
- package/README.md +44 -1
- package/dist/brand.js +36 -0
- package/dist/contexts.js +63 -59
- package/dist/hirobius-ui.js +22641 -3700
- package/dist/manifest.js +9 -9
- package/dist/scroll.js +42 -0
- package/dist/styles.css +1 -1
- package/dist/tokens.css +1 -1
- package/dist/tokens.js +26 -5
- package/dist/types/src/app/components/activity-feed.d.ts +24 -2
- package/dist/types/src/app/components/alert-dialog.d.ts +56 -0
- package/dist/types/src/app/components/app-shell.d.ts +38 -0
- package/dist/types/src/app/components/aspect-ratio.d.ts +25 -0
- package/dist/types/src/app/components/avatar-group.d.ts +22 -0
- package/dist/types/src/app/components/bleed.d.ts +39 -0
- package/dist/types/src/app/components/blockquote.d.ts +20 -0
- package/dist/types/src/app/components/box-sx.d.ts +69 -0
- package/dist/types/src/app/components/box.d.ts +42 -0
- package/dist/types/src/app/components/breadcrumb.d.ts +5 -0
- package/dist/types/src/app/components/button-group.d.ts +18 -0
- package/dist/types/src/app/components/calendar.d.ts +20 -0
- package/dist/types/src/app/components/card.d.ts +29 -13
- package/dist/types/src/app/components/carousel.d.ts +24 -0
- package/dist/types/src/app/components/center.d.ts +36 -0
- package/dist/types/src/app/components/circular-progress.d.ts +28 -0
- package/dist/types/src/app/components/cluster.d.ts +39 -0
- package/dist/types/src/app/components/code-block.d.ts +19 -1
- package/dist/types/src/app/components/command-palette.d.ts +44 -0
- package/dist/types/src/app/components/container.d.ts +10 -0
- package/dist/types/src/app/components/context-menu.d.ts +55 -0
- package/dist/types/src/app/components/cover.d.ts +43 -0
- package/dist/types/src/app/components/date-input.d.ts +31 -0
- package/dist/types/src/app/components/date-range-input.d.ts +34 -0
- package/dist/types/src/app/components/date-time-input.d.ts +30 -0
- package/dist/types/src/app/components/disclosure.d.ts +5 -1
- package/dist/types/src/app/components/divider.d.ts +14 -10
- package/dist/types/src/app/components/doc-link-card.d.ts +5 -1
- package/dist/types/src/app/components/field.d.ts +9 -11
- package/dist/types/src/app/components/file-input.d.ts +28 -0
- package/dist/types/src/app/components/frame.d.ts +38 -0
- package/dist/types/src/app/components/hds-tooltip.d.ts +45 -0
- package/dist/types/src/app/components/heading-stack.d.ts +15 -5
- package/dist/types/src/app/components/hover-card.d.ts +31 -0
- package/dist/types/src/app/components/image-lightbox.d.ts +13 -0
- package/dist/types/src/app/components/inline-code.d.ts +14 -3
- package/dist/types/src/app/components/input-group.d.ts +23 -0
- package/dist/types/src/app/components/kbd.d.ts +18 -0
- package/dist/types/src/app/components/metadata-list.d.ts +43 -0
- package/dist/types/src/app/components/multi-selector.d.ts +40 -0
- package/dist/types/src/app/components/nav-group.d.ts +7 -2
- package/dist/types/src/app/components/nav-item.d.ts +12 -2
- package/dist/types/src/app/components/overflow-list.d.ts +19 -0
- package/dist/types/src/app/components/pin.d.ts +30 -0
- package/dist/types/src/app/components/reveal.d.ts +31 -0
- package/dist/types/src/app/components/segmented-control.d.ts +37 -3
- package/dist/types/src/app/components/selectable-card.d.ts +29 -0
- package/dist/types/src/app/components/side-nav.d.ts +21 -0
- package/dist/types/src/app/components/sidebar.d.ts +45 -0
- package/dist/types/src/app/components/stat.d.ts +8 -10
- package/dist/types/src/app/components/status-dot.d.ts +25 -0
- package/dist/types/src/app/components/status-list-item.d.ts +10 -11
- package/dist/types/src/app/components/stepper.d.ts +31 -0
- package/dist/types/src/app/components/switcher.d.ts +41 -0
- package/dist/types/src/app/components/table.d.ts +12 -1
- package/dist/types/src/app/components/tag.d.ts +19 -18
- package/dist/types/src/app/components/text.d.ts +8 -2
- package/dist/types/src/app/components/textarea.d.ts +38 -0
- package/dist/types/src/app/components/time-input.d.ts +24 -0
- package/dist/types/src/app/components/timestamp.d.ts +24 -0
- package/dist/types/src/app/components/toast.d.ts +8 -2
- package/dist/types/src/app/components/toggle-button.d.ts +32 -0
- package/dist/types/src/app/components/token.d.ts +26 -1
- package/dist/types/src/app/components/tokenizer.d.ts +24 -0
- package/dist/types/src/app/components/toolbar.d.ts +36 -0
- package/dist/types/src/app/components/top-nav.d.ts +21 -0
- package/dist/types/src/app/components/tree-list.d.ts +28 -0
- package/dist/types/src/app/components/visually-hidden.d.ts +17 -0
- package/dist/types/src/app/context/TenantContext.d.ts +1 -1
- package/dist/types/src/app/context/hds-theme.d.ts +68 -0
- package/dist/types/src/app/data/nav-model.d.ts +39 -0
- package/dist/types/src/app/design-system/generated-token-refs.d.ts +20 -0
- package/dist/types/src/app/design-system/generated-token-values.d.ts +14 -1
- package/dist/types/src/app/{pages/hds → layouts}/HdsSystemDocLayout.d.ts +1 -1
- package/dist/types/src/app/lib/hds-search.d.ts +45 -0
- package/dist/types/src/brand/index.d.ts +9 -0
- package/dist/types/src/brand/overlay.d.ts +71 -0
- package/dist/types/src/index.d.ts +109 -2
- package/dist/types/src/scroll/index.d.ts +16 -0
- package/dist/types/src/scroll/smooth-scroll.d.ts +48 -0
- package/dist/types/src/scroll/use-scroll-progress.d.ts +34 -0
- package/dist/variables.css +22 -5
- package/hirobius.tokens.json +70 -10
- package/package.json +41 -68
- package/public/hds-manifest.json +6057 -4732
- 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)**.
|
|
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
|
|
2
|
-
import { useState as
|
|
3
|
-
import { F as
|
|
4
|
-
const
|
|
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
|
|
17
|
+
function T() {
|
|
18
18
|
try {
|
|
19
19
|
const t = localStorage.getItem(m);
|
|
20
|
-
if (t &&
|
|
20
|
+
if (t && L.includes(t)) return t;
|
|
21
21
|
} catch {
|
|
22
22
|
}
|
|
23
23
|
return "system";
|
|
24
24
|
}
|
|
25
|
-
function
|
|
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 :
|
|
30
|
+
return t === "dark" ? !0 : t === "light" ? !1 : P();
|
|
31
31
|
}
|
|
32
|
-
function
|
|
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
|
|
41
|
-
const [n,
|
|
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(
|
|
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
|
-
|
|
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]),
|
|
56
|
-
|
|
57
|
-
}, [r,
|
|
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
|
-
|
|
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
|
|
66
|
+
const A = s(() => {
|
|
67
67
|
const e = !r, o = e ? "dark" : "light";
|
|
68
|
-
|
|
68
|
+
g(o), i(e);
|
|
69
69
|
try {
|
|
70
70
|
localStorage.setItem(m, o);
|
|
71
71
|
} catch {
|
|
72
72
|
}
|
|
73
|
-
}, [r]),
|
|
74
|
-
|
|
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
|
-
}, []),
|
|
80
|
-
() =>
|
|
79
|
+
}, []), I = s(
|
|
80
|
+
() => h((e) => e === "comfortable" ? "compact" : "comfortable"),
|
|
81
81
|
[]
|
|
82
|
-
),
|
|
83
|
-
return /* @__PURE__ */
|
|
84
|
-
|
|
82
|
+
), w = s((e) => h(e), []);
|
|
83
|
+
return /* @__PURE__ */ f(
|
|
84
|
+
_.Provider,
|
|
85
85
|
{
|
|
86
|
-
value: { isDark: r, toggleDark:
|
|
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
|
|
92
|
-
return
|
|
91
|
+
function G() {
|
|
92
|
+
return S(_);
|
|
93
93
|
}
|
|
94
|
-
const d = {},
|
|
95
|
-
function
|
|
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
|
|
103
|
+
return a(() => {
|
|
98
104
|
if (n)
|
|
99
|
-
return
|
|
100
|
-
|
|
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
|
|
105
|
-
return
|
|
108
|
+
function B() {
|
|
109
|
+
return S(v);
|
|
106
110
|
}
|
|
107
|
-
function
|
|
108
|
-
|
|
109
|
-
const n = document.documentElement.getAttribute("data-
|
|
110
|
-
return
|
|
111
|
-
n !== null ?
|
|
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
|
|
116
|
-
return /* @__PURE__ */
|
|
119
|
+
function V({ children: t }) {
|
|
120
|
+
return /* @__PURE__ */ f(M, { children: t });
|
|
117
121
|
}
|
|
118
122
|
export {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
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
|
};
|