@alfadocs/ui-kit 1.54.0 → 1.54.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alfadocs/ui-kit",
3
- "version": "1.54.0",
3
+ "version": "1.54.2",
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",
@@ -1,275 +0,0 @@
1
- import { jsx as r, jsxs as x } from "react/jsx-runtime";
2
- import { forwardRef as H, useMemo as K, useState as R, useEffect as _, useRef as C } from "react";
3
- import { useTranslation as Q } from "react-i18next";
4
- import { c as W } from "./index-D2ZczOXr.js";
5
- import { B as T } from "./button-CYPx2xFq.js";
6
- import { L as J } from "./logo-CuaqxTGK.js";
7
- import { i as X } from "./safe-href-5dbsfbQn.js";
8
- import { E as Z } from "./error-page-illustration-QGJAvuFB.js";
9
- import { loadLocale as ee, LOCALES_WITH_BUNDLES as re } from "../i18n/config.js";
10
- import { R as oe } from "./rotate-ccw-BBQnIVTr.js";
11
- import { L as te } from "./log-in-OQUEoGhX.js";
12
- import { c as D } from "./createLucideIcon-DhHxpK9K.js";
13
- /**
14
- * @license lucide-react v1.22.0 - ISC
15
- *
16
- * This source code is licensed under the ISC license.
17
- * See the LICENSE file in the root directory of this source tree.
18
- */
19
- const ae = [
20
- ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
21
- ["path", { d: "M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3", key: "1u773s" }],
22
- ["path", { d: "M12 17h.01", key: "p32p05" }]
23
- ], ne = D("circle-question-mark", ae);
24
- /**
25
- * @license lucide-react v1.22.0 - ISC
26
- *
27
- * This source code is licensed under the ISC license.
28
- * See the LICENSE file in the root directory of this source tree.
29
- */
30
- const se = [
31
- ["path", { d: "M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8", key: "5wwlr5" }],
32
- [
33
- "path",
34
- {
35
- d: "M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",
36
- key: "r6nss1"
37
- }
38
- ]
39
- ], ie = D("house", se), de = [
40
- 400,
41
- 401,
42
- 403,
43
- 404,
44
- 405,
45
- 410,
46
- 419,
47
- 429,
48
- 500,
49
- 502,
50
- 503,
51
- 504,
52
- "offline",
53
- "maintenance"
54
- ], I = {
55
- 400: { key: "badRequest", mood: "jumbled", primary: "home" },
56
- 401: { key: "unauthorised", mood: "locked", primary: "login" },
57
- 403: { key: "forbidden", mood: "roped", primary: "home" },
58
- 404: { key: "notFound", mood: "lost", primary: "home" },
59
- 405: { key: "methodNotAllowed", mood: "wrong-way", primary: "home" },
60
- 410: { key: "gone", mood: "vanished", primary: "home" },
61
- 419: { key: "expired", mood: "asleep", primary: "login" },
62
- 429: { key: "tooManyRequests", mood: "melt", primary: "retry" },
63
- 500: { key: "serverError", mood: "patched", primary: "retry" },
64
- 502: { key: "badGateway", mood: "unplugged", primary: "retry" },
65
- 503: { key: "maintenance", mood: "rebuild", primary: "retry" },
66
- 504: { key: "timeout", mood: "snail", primary: "retry" },
67
- offline: { key: "offline", mood: "adrift", primary: "retry" },
68
- maintenance: { key: "maintenance", mood: "rebuild", primary: "retry" },
69
- generic: { key: "generic", mood: "puzzled", primary: "home" }
70
- };
71
- function ce(e) {
72
- return de.includes(e) ? I[e] : I.generic;
73
- }
74
- const le = "alfadocs-ui.locale", me = "it", ue = (e) => {
75
- if (!e) return;
76
- const o = e.toLowerCase().replaceAll("_", "-").split("-")[0], t = o === "cn" ? "zh" : o;
77
- return re.includes(t) ? t : void 0;
78
- }, pe = () => {
79
- try {
80
- return window.localStorage.getItem(le);
81
- } catch {
82
- return null;
83
- }
84
- };
85
- function ye(e = {}) {
86
- var p;
87
- const o = typeof window < "u", t = e.saved !== void 0 ? e.saved : o ? pe() : null, i = e.browser ?? (o && typeof navigator < "u" ? (p = navigator.languages) != null && p.length ? navigator.languages : [navigator.language] : []), u = e.document ?? (typeof document < "u" ? document.documentElement.lang : ""), f = [
88
- e.locale,
89
- t,
90
- ...i,
91
- e.hostLocaleIsDefault ? void 0 : u
92
- ];
93
- for (const h of f) {
94
- const y = ue(h);
95
- if (y) return y;
96
- }
97
- return me;
98
- }
99
- const z = (e, o) => ee(e, o), ge = W(
100
- "ds:flex ds:flex-col ds:items-center ds:justify-center ds:bg-[var(--background)] ds:text-[var(--foreground)] ds:px-[var(--spacing-md)] ds:py-[var(--spacing-2xl)]",
101
- {
102
- variants: {
103
- layout: {
104
- /** Fills the viewport: the whole page is the error. */
105
- page: "ds:min-h-screen",
106
- /** Fills its container, under the host's own header. */
107
- embedded: "ds:[min-block-size:100%]"
108
- }
109
- },
110
- defaultVariants: { layout: "page" }
111
- }
112
- ), fe = /* @__PURE__ */ new Set(["ar"]), he = 1500;
113
- function ve(e, o) {
114
- const t = e instanceof Date ? e : new Date(e);
115
- if (Number.isNaN(t.getTime())) return;
116
- const i = /* @__PURE__ */ new Date(), u = i.toDateString() === t.toDateString() ? {} : {
117
- day: "numeric",
118
- month: "short",
119
- ...i.getFullYear() === t.getFullYear() ? {} : { year: "numeric" }
120
- };
121
- return new Intl.DateTimeFormat(o === "en" ? "en-GB" : o, {
122
- ...u,
123
- hour: "2-digit",
124
- minute: "2-digit"
125
- }).format(t);
126
- }
127
- const B = (e, o) => !!e.getResource(o, "ui", "errorPage"), ke = (e) => X(e) ? e : "#", be = H(
128
- ({
129
- status: e,
130
- homeHref: o = "/",
131
- loginHref: t,
132
- supportHref: i,
133
- onRetry: u,
134
- requestId: f,
135
- backAt: p,
136
- locale: h,
137
- hostLocaleIsDefault: y = !1,
138
- title: M,
139
- message: F,
140
- showLogo: G = !0,
141
- as: j = "main",
142
- focusHeading: N = !0,
143
- layout: O,
144
- className: $,
145
- ...U
146
- }, V) => {
147
- const { i18n: l } = Q("ui"), d = K(
148
- () => ye({ locale: h, hostLocaleIsDefault: y }),
149
- [h, y]
150
- ), [n, v] = R(
151
- () => B(l, d) ? d : null
152
- ), [, Y] = R(0);
153
- _(() => {
154
- let a = !0;
155
- const k = B(l, d);
156
- v(k ? d : null);
157
- const b = () => a && Y((g) => g + 1);
158
- z("en", l).then(b).catch(() => {
159
- });
160
- const L = k ? void 0 : setTimeout(
161
- () => a && v((g) => g ?? "en"),
162
- he
163
- );
164
- return z(d, l).then(() => {
165
- a && (v(d), b());
166
- }).catch(() => a && v((g) => g ?? "en")), () => {
167
- a = !1, clearTimeout(L);
168
- };
169
- }, [l, d]);
170
- const s = l.getFixedT(
171
- n && n !== "en" ? [n, "en"] : "en",
172
- "ui"
173
- ), c = ce(e), P = c.key === "maintenance" && p ? ve(p, n ?? "en") : void 0, S = C(null), A = C(!1);
174
- _(() => {
175
- var a;
176
- !n || !N || A.current || (A.current = !0, (a = S.current) == null || a.focus({ preventScroll: !0 }));
177
- }, [n, N]);
178
- const q = u ?? (() => window.location.reload()), w = c.primary === "login" && !t ? "retry" : c.primary, E = (a, k, b, L) => /* @__PURE__ */ r(
179
- T,
180
- {
181
- intent: L,
182
- size: "lg",
183
- flipIconInRtl: a === "login",
184
- asChild: !0,
185
- startIcon: b,
186
- "data-action": a,
187
- children: /* @__PURE__ */ r("a", { href: ke(k), children: s(`errorPage.actions.${a}`) })
188
- },
189
- a
190
- ), m = [];
191
- return w === "retry" ? m.push(
192
- /* @__PURE__ */ r(
193
- T,
194
- {
195
- intent: "primary",
196
- size: "lg",
197
- startIcon: /* @__PURE__ */ r(oe, { "aria-hidden": "true" }),
198
- onClick: q,
199
- "data-action": "retry",
200
- children: s("errorPage.actions.retry")
201
- },
202
- "retry"
203
- )
204
- ) : w === "login" && t && m.push(
205
- E("login", t, /* @__PURE__ */ r(te, { "aria-hidden": "true" }), "primary")
206
- ), e !== "offline" && c.key !== "maintenance" && m.push(
207
- E(
208
- "home",
209
- o,
210
- /* @__PURE__ */ r(ie, { "aria-hidden": "true" }),
211
- w === "home" ? "primary" : "secondary"
212
- )
213
- ), i && m.push(
214
- E(
215
- "support",
216
- i,
217
- /* @__PURE__ */ r(ne, { "aria-hidden": "true" }),
218
- "ghost"
219
- )
220
- ), /* @__PURE__ */ r(
221
- j,
222
- {
223
- ref: V,
224
- "data-component": "error-page",
225
- "data-status": String(e),
226
- lang: n ?? void 0,
227
- "aria-busy": n ? void 0 : !0,
228
- dir: n && fe.has(n) ? "rtl" : "ltr",
229
- className: ge({ layout: O, className: $ }),
230
- ...U,
231
- children: /* @__PURE__ */ x(
232
- "div",
233
- {
234
- className: n ? "ds:flex ds:flex-col ds:items-center ds:gap-[var(--spacing-lg)] ds:text-center ds:[max-inline-size:32rem]" : "ds:invisible",
235
- children: [
236
- /* @__PURE__ */ r(Z, { mood: c.mood }),
237
- /* @__PURE__ */ x("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
238
- /* @__PURE__ */ x(
239
- "h1",
240
- {
241
- ref: S,
242
- tabIndex: -1,
243
- className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)] ds:outline-none",
244
- children: [
245
- typeof e == "number" && /* @__PURE__ */ r("span", { className: "type-label ds:text-[var(--muted-foreground)]", children: s("errorPage.statusLabel", { status: e }) }),
246
- /* @__PURE__ */ r("span", { className: "type-title-page", children: M ?? s(`errorPage.status.${c.key}.title`) })
247
- ]
248
- }
249
- ),
250
- /* @__PURE__ */ r("p", { className: "type-body ds:text-[var(--muted-foreground)]", children: F ?? s(`errorPage.status.${c.key}.message`) }),
251
- P && /* @__PURE__ */ r("p", { className: "type-body ds:font-semibold", children: s("errorPage.backAt", { time: P }) })
252
- ] }),
253
- m.length > 0 && /* @__PURE__ */ r("div", { className: "ds:flex ds:flex-wrap ds:items-center ds:justify-center ds:gap-[var(--spacing-sm)]", children: m }),
254
- f && /* @__PURE__ */ x("p", { className: "type-body-sm ds:text-[var(--muted-foreground)]", children: [
255
- s("errorPage.reference", { id: f }),
256
- /* @__PURE__ */ r("br", {}),
257
- s("errorPage.referenceHint")
258
- ] }),
259
- G && /* @__PURE__ */ r(J, { decorative: !0, size: "sm", className: "ds:opacity-70" })
260
- ]
261
- }
262
- )
263
- }
264
- );
265
- }
266
- );
267
- be.displayName = "ErrorPage";
268
- export {
269
- me as E,
270
- de as a,
271
- be as b,
272
- ce as e,
273
- ye as r
274
- };
275
- //# sourceMappingURL=error-page-CKFJlekz.js.map