@alfadocs/ui-kit 0.15.1 → 0.17.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 (32) hide show
  1. package/dist/_chunks/benefit-card-DXmrAyfn.js +219 -0
  2. package/dist/_chunks/copy-field-BCHAZ8QV.js +298 -0
  3. package/dist/_chunks/{navigation-menu-Bav1d_wA.js → navigation-menu-DdufF-_4.js} +18 -18
  4. package/dist/_chunks/{pagination-OQBlnb1H.js → pagination-F1ei4khE.js} +180 -158
  5. package/dist/_chunks/public-header.agent-sDi9N9su.js +562 -0
  6. package/dist/agent-catalog.json +51 -1
  7. package/dist/components/benefit-card/benefit-card.d.ts +35 -0
  8. package/dist/components/benefit-card/index.d.ts +3 -0
  9. package/dist/components/benefit-card/index.js +5 -0
  10. package/dist/components/card/card.d.ts +1 -1
  11. package/dist/components/copy-field/copy-field.agent.d.ts +16 -0
  12. package/dist/components/copy-field/copy-field.d.ts +50 -0
  13. package/dist/components/copy-field/index.d.ts +5 -0
  14. package/dist/components/copy-field/index.js +6 -0
  15. package/dist/components/index.d.ts +2 -0
  16. package/dist/components/navigation-menu/index.js +1 -1
  17. package/dist/components/pagination/index.js +1 -1
  18. package/dist/components/public-header/index.d.ts +1 -1
  19. package/dist/components/public-header/index.js +1 -1
  20. package/dist/components/public-header/public-header.d.ts +36 -1
  21. package/dist/components/stat/stat.d.ts +1 -1
  22. package/dist/hooks/use-controllable-state.d.ts +10 -0
  23. package/dist/hooks/use-copy-to-clipboard.d.ts +45 -0
  24. package/dist/i18n/config.js +21 -0
  25. package/dist/i18n/resources.d.ts +21 -0
  26. package/dist/index.js +458 -453
  27. package/dist/locales/de.json +7 -0
  28. package/dist/locales/en.json +7 -0
  29. package/dist/locales/it.json +7 -0
  30. package/dist/tokens.css +1 -1
  31. package/package.json +9 -1
  32. package/dist/_chunks/public-header.agent-ZLBAQ30j.js +0 -242
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alfadocs/ui-kit",
3
- "version": "0.15.1",
3
+ "version": "0.17.0",
4
4
  "type": "module",
5
5
  "description": "AlfaDocs shared design system — tokens, components, patterns, and translations for platform, booking, and alfascribe.",
6
6
  "license": "BUSL-1.1",
@@ -83,6 +83,10 @@
83
83
  "types": "./dist/components/badge/index.d.ts",
84
84
  "import": "./dist/components/badge/index.js"
85
85
  },
86
+ "./benefit-card": {
87
+ "types": "./dist/components/benefit-card/index.d.ts",
88
+ "import": "./dist/components/benefit-card/index.js"
89
+ },
86
90
  "./breadcrumb": {
87
91
  "types": "./dist/components/breadcrumb/index.d.ts",
88
92
  "import": "./dist/components/breadcrumb/index.js"
@@ -151,6 +155,10 @@
151
155
  "types": "./dist/components/contact-card/index.d.ts",
152
156
  "import": "./dist/components/contact-card/index.js"
153
157
  },
158
+ "./copy-field": {
159
+ "types": "./dist/components/copy-field/index.d.ts",
160
+ "import": "./dist/components/copy-field/index.js"
161
+ },
154
162
  "./data-table": {
155
163
  "types": "./dist/components/data-table/index.d.ts",
156
164
  "import": "./dist/components/data-table/index.js"
@@ -1,242 +0,0 @@
1
- import { jsxs as g, jsx as s } from "react/jsx-runtime";
2
- import { forwardRef as P, useId as Y, useState as b, useCallback as N, useImperativeHandle as q, useEffect as j, useRef as L } from "react";
3
- import { c as C } from "./index-D2ZczOXr.js";
4
- import { useTranslation as S } from "react-i18next";
5
- import { I as D } from "./icon-button-C4CGcYuz.js";
6
- import { S as c } from "./sheet-BT0izeoI.js";
7
- import { X as F } from "./x-CCcI3eJp.js";
8
- import { M as W } from "./menu-XRhW3_99.js";
9
- const X = C(
10
- [
11
- "ds:flex ds:items-center ds:gap-[var(--spacing-md)]",
12
- "ds:w-full ds:z-[var(--z-sticky)]",
13
- "ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)] ds:sm:ps-[var(--spacing-lg)] ds:sm:pe-[var(--spacing-lg)]",
14
- "ds:h-14 ds:md:h-16",
15
- "ds:transition-[background-color,box-shadow,transform] ds:duration-[var(--animation-duration)]",
16
- "ds:motion-reduce:transition-none"
17
- ].join(" "),
18
- {
19
- variants: {
20
- variant: {
21
- default: "ds:bg-[var(--card)] ds:text-[var(--foreground)] ds:border-b ds:border-[color:var(--border)]",
22
- // Transparent fades to default once data-stuck="true" (set by the
23
- // rAF scroll listener). The fade is handled via the same
24
- // background utility so `data-stuck` swaps cleanly between states.
25
- transparent: [
26
- "ds:bg-transparent ds:text-[var(--foreground)]",
27
- "ds:data-[stuck=true]:bg-[var(--card)]",
28
- "ds:data-[stuck=true]:shadow-[var(--shadow-md)]",
29
- "ds:forced-colors:border-b ds:forced-colors:border-[CanvasText]"
30
- ].join(" "),
31
- // `dark` flips its own scope into the dark token set so nav
32
- // links + buttons inside read off-white text on the blue-800
33
- // surface. Without the `theme-dark` scope the children inherit
34
- // the light-theme `--foreground` (blue-500) and fail
35
- // color-contrast at ~1.3:1.
36
- dark: "theme-dark ds:bg-[var(--color-blue-800)] ds:text-[var(--foreground)]"
37
- },
38
- sticky: {
39
- none: "",
40
- top: "ds:sticky ds:top-0",
41
- // `scroll-up` is sticky but translates off-screen when scrolling
42
- // down past `stickyOffset` (handled by data-hidden="true") and
43
- // slides back in when scrolling up.
44
- "scroll-up": [
45
- "ds:sticky ds:top-0",
46
- "ds:data-[hidden=true]:-translate-y-full"
47
- ].join(" ")
48
- }
49
- },
50
- defaultVariants: { variant: "default", sticky: "none" }
51
- }
52
- ), $ = C(
53
- [
54
- "ds:inline-flex ds:items-center",
55
- "ds:type-body-sm ds:font-medium",
56
- "ds:text-[var(--foreground)]",
57
- "ds:rounded-[var(--radius-sm)]",
58
- "ds:ps-[var(--spacing-xs)] ds:pe-[var(--spacing-xs)] ds:py-[var(--spacing-2xs)]",
59
- "ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid",
60
- "ds:focus-visible:outline-ring ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
61
- "ds:hover:text-[var(--primary)]",
62
- "ds:transition-colors ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none",
63
- "ds:data-[active=true]:text-[var(--primary)]",
64
- "ds:data-[active=true]:[box-shadow:inset_0_-2px_0_var(--primary)]"
65
- ].join(" ")
66
- );
67
- function G() {
68
- const [e, d] = b(() => typeof window > "u" || !window.matchMedia ? !1 : window.matchMedia("(prefers-reduced-motion: reduce)").matches);
69
- return j(() => {
70
- if (typeof window > "u" || !window.matchMedia) return;
71
- const r = window.matchMedia("(prefers-reduced-motion: reduce)"), n = () => d(r.matches);
72
- return r.addEventListener("change", n), () => r.removeEventListener("change", n);
73
- }, []), e;
74
- }
75
- function J(e, d, r) {
76
- const [n, a] = b(!1), [p, o] = b(!1), l = L(0), u = L(!1);
77
- return j(() => {
78
- if (!e || typeof window > "u") return;
79
- l.current = window.scrollY;
80
- const f = () => {
81
- const t = window.scrollY;
82
- if (a(t > r), d === "scroll-up") {
83
- const v = t - l.current;
84
- v > 4 && t > r ? o(!0) : (v < -4 || t <= r) && o(!1);
85
- }
86
- l.current = t, u.current = !1;
87
- }, m = () => {
88
- u.current || (u.current = !0, window.requestAnimationFrame(f));
89
- };
90
- return window.addEventListener("scroll", m, { passive: !0 }), f(), () => {
91
- window.removeEventListener("scroll", m);
92
- };
93
- }, [e, d, r]), { stuck: n, hidden: p };
94
- }
95
- const I = P(
96
- ({
97
- logo: e,
98
- homeHref: d = "/",
99
- homeLabel: r,
100
- navSlot: n,
101
- actionsSlot: a,
102
- variant: p = "default",
103
- sticky: o = "none",
104
- stickyOffset: l = 80,
105
- menuLabel: u,
106
- navLabel: f,
107
- id: m,
108
- className: t,
109
- ...v
110
- }, E) => {
111
- const { t: h } = S(), y = G(), O = Y(), H = `${m ?? O}-sheet`, [i, w] = b(!1), _ = p === "transparent" || o === "scroll-up", { stuck: z, hidden: T } = J(
112
- _,
113
- o,
114
- l
115
- ), A = y ? !1 : T, k = N(() => w(!0), []), M = N(() => w(!1), []);
116
- q(
117
- E,
118
- () => ({
119
- openMenu: k,
120
- closeMenu: M,
121
- getMenuOpen: () => i
122
- }),
123
- [k, M, i]
124
- );
125
- const B = r ?? h("publicHeader.homeLabel", "AlfaDocs — home"), x = f ?? h("publicHeader.primaryNavLabel", "Primary"), V = u ?? (i ? h("publicHeader.closeMenu", "Close menu") : h("publicHeader.openMenu", "Open menu"));
126
- return /* @__PURE__ */ g(
127
- "header",
128
- {
129
- ...v,
130
- "data-component": "public-header",
131
- "data-component-id": m,
132
- "data-stuck": z ? "true" : void 0,
133
- "data-hidden": A ? "true" : void 0,
134
- "data-state": y ? "reduced-motion" : void 0,
135
- className: X({ variant: p, sticky: o, className: t }),
136
- children: [
137
- /* @__PURE__ */ s(
138
- "a",
139
- {
140
- href: d,
141
- "aria-label": B,
142
- className: "ds:inline-flex ds:items-center ds:rounded-[var(--radius-sm)] ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid ds:focus-visible:outline-ring ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
143
- children: e
144
- }
145
- ),
146
- n ? /* @__PURE__ */ s(
147
- "nav",
148
- {
149
- "aria-label": x,
150
- className: "ds:hidden ds:md:flex ds:items-center ds:gap-[var(--spacing-md)] ds:ms-[var(--spacing-lg)]",
151
- children: n
152
- }
153
- ) : null,
154
- a ? /* @__PURE__ */ s("div", { className: "ds:hidden ds:md:flex ds:items-center ds:gap-[var(--spacing-sm)] ds:ms-auto", children: a }) : null,
155
- /* @__PURE__ */ g(c, { open: i, onOpenChange: w, children: [
156
- /* @__PURE__ */ s(c.Trigger, { asChild: !0, children: /* @__PURE__ */ s(
157
- D,
158
- {
159
- size: "md",
160
- intent: "ghost",
161
- className: "ds:ms-auto ds:md:hidden",
162
- icon: i ? /* @__PURE__ */ s(F, { "aria-hidden": "true" }) : /* @__PURE__ */ s(W, { "aria-hidden": "true" }),
163
- "aria-controls": H,
164
- "aria-expanded": i,
165
- "aria-label": V
166
- }
167
- ) }),
168
- /* @__PURE__ */ g(c.Content, { side: "end", size: "md", id: H, children: [
169
- /* @__PURE__ */ s(c.Header, { children: /* @__PURE__ */ s(c.Title, { children: x }) }),
170
- /* @__PURE__ */ s(c.Body, { children: /* @__PURE__ */ g("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
171
- n ? /* @__PURE__ */ s(
172
- "nav",
173
- {
174
- "aria-label": x,
175
- className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]",
176
- children: n
177
- }
178
- ) : null,
179
- a ? /* @__PURE__ */ s("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)] ds:mt-[var(--spacing-md)]", children: a }) : null
180
- ] }) })
181
- ] })
182
- ] })
183
- ]
184
- }
185
- );
186
- }
187
- );
188
- I.displayName = "PublicHeader";
189
- const R = P(({ active: e, className: d, children: r, ...n }, a) => /* @__PURE__ */ s(
190
- "a",
191
- {
192
- ref: a,
193
- ...n,
194
- "data-active": e ? "true" : void 0,
195
- "aria-current": e ? "page" : void 0,
196
- className: [$(), d].filter(Boolean).join(" "),
197
- children: r
198
- }
199
- ));
200
- R.displayName = "PublicHeader.NavLink";
201
- const de = Object.assign(I, {
202
- NavLink: R
203
- }), ae = {
204
- id: "public-header",
205
- capabilities: ["open", "close"],
206
- state: {
207
- menuOpen: {
208
- type: "boolean",
209
- description: "Whether the mobile drawer is currently open.",
210
- read: (e) => e.getMenuOpen()
211
- }
212
- },
213
- actions: {
214
- open_menu: {
215
- safety: "read",
216
- description: "Open the mobile drawer.",
217
- invoke: (e) => {
218
- e.openMenu();
219
- }
220
- },
221
- close_menu: {
222
- safety: "read",
223
- description: "Close the mobile drawer.",
224
- invoke: (e) => {
225
- e.closeMenu();
226
- }
227
- }
228
- },
229
- domHooks: {
230
- root: { attr: "data-component", value: "public-header" },
231
- instanceId: {
232
- attr: "data-component-id",
233
- sourceProp: "id",
234
- description: "Sourced from the id prop on PublicHeader."
235
- }
236
- }
237
- };
238
- export {
239
- de as P,
240
- ae as p
241
- };
242
- //# sourceMappingURL=public-header.agent-ZLBAQ30j.js.map