@alfadocs/ui-kit 0.34.0 → 0.36.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.
@@ -0,0 +1,295 @@
1
+ import { jsxs as s, jsx as e, Fragment as M } from "react/jsx-runtime";
2
+ import { forwardRef as h, useState as H } from "react";
3
+ import { useTranslation as I } from "react-i18next";
4
+ import { A as T } from "./app-frame-BYx1gcV7.js";
5
+ import { A as L } from "./avatar-BNQNhoyL.js";
6
+ import { A as O } from "./alert-ywPR59NE.js";
7
+ import { B as k } from "./button-DD_0Xdmr.js";
8
+ import { C as b } from "./card-DPmk26CL.js";
9
+ import { D as d } from "./dropdown-menu-BC5ZdOMo.js";
10
+ import { H as P, g as j, f as W, e as R, a as $, c as D, d as E } from "./header-CTZWX-tm.js";
11
+ import { S as F, a as V, h as q, j as G, k as J, i as K } from "./sidebar-BbR8f6oe.js";
12
+ import { T as Q } from "./theme-root-BOO73p5t.js";
13
+ import { a as U } from "./tooltip-DvmfrNvB.js";
14
+ import { u as X } from "./use-theme-C2dHKUAN.js";
15
+ import { c as N } from "./index-D2ZczOXr.js";
16
+ import { L as Y } from "./logo-_Z-jLq80.js";
17
+ const Z = N("ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]"), _ = N(
18
+ [
19
+ "ds:[font-family:var(--font-serif)]",
20
+ "ds:font-semibold",
21
+ "ds:leading-none",
22
+ "ds:tracking-[0.01em]",
23
+ "ds:whitespace-nowrap",
24
+ // Forced-colors: drop the transparent text-fill and paint the label
25
+ // as solid CanvasText so it never disappears under Windows HCM —
26
+ // a gradient/transparent fill has no meaning there.
27
+ "ds:forced-colors:text-[CanvasText]",
28
+ "ds:forced-colors:[-webkit-text-fill-color:CanvasText]"
29
+ ],
30
+ {
31
+ variants: {
32
+ size: {
33
+ sm: "ds:text-[calc(var(--logo-size-sm)*0.95)]",
34
+ md: "ds:text-[calc(var(--logo-size-md)*0.95)]",
35
+ lg: "ds:text-[calc(var(--logo-size-lg)*0.95)]",
36
+ xl: "ds:text-[calc(var(--logo-size-xl)*0.95)]"
37
+ },
38
+ tone: {
39
+ // Brand gradient filled into the glyphs via background-clip:text.
40
+ // `--gradient-wordmark` rides the theme aliases, so it stays
41
+ // AA-safe and adapts per theme on its own (and flattens to a solid
42
+ // ink in the accessible / forced-colors blocks — see tokens).
43
+ gradient: [
44
+ "ds:italic",
45
+ "ds:bg-[image:var(--gradient-wordmark)]",
46
+ "ds:bg-clip-text",
47
+ "ds:text-transparent",
48
+ "ds:[-webkit-text-fill-color:transparent]"
49
+ ],
50
+ // Monochrome: solid `--foreground` ink, upright, no gradient — for
51
+ // print, single-colour reproductions, and constrained contexts.
52
+ solid: "ds:text-[color:var(--foreground)]"
53
+ }
54
+ },
55
+ defaultVariants: { size: "md", tone: "gradient" }
56
+ }
57
+ ), f = h(
58
+ ({ name: t, monochrome: a = !1, size: r = "md", className: n, ...l }, o) => /* @__PURE__ */ s(
59
+ "span",
60
+ {
61
+ ref: o,
62
+ role: "img",
63
+ "aria-label": `Alfadocs ${t}`.trim(),
64
+ className: Z({ className: n }),
65
+ "data-component": "product-lockup",
66
+ ...l,
67
+ children: [
68
+ /* @__PURE__ */ e(
69
+ Y,
70
+ {
71
+ variant: a ? "monochrome" : "wordmark",
72
+ size: r,
73
+ decorative: !0
74
+ }
75
+ ),
76
+ /* @__PURE__ */ e(
77
+ "span",
78
+ {
79
+ "aria-hidden": !0,
80
+ className: _({
81
+ size: r,
82
+ tone: a ? "solid" : "gradient"
83
+ }),
84
+ children: t
85
+ }
86
+ )
87
+ ]
88
+ }
89
+ )
90
+ );
91
+ f.displayName = "ProductLockup";
92
+ function ee(t) {
93
+ return t > 99 ? "99+" : String(t);
94
+ }
95
+ function ae({
96
+ user: t,
97
+ labels: a,
98
+ onSignOut: r,
99
+ onToggleFullscreen: n
100
+ }) {
101
+ return (
102
+ // Non-modal: an account menu shouldn't inert/aria-hide the whole shell
103
+ // behind it (which leaves the still-focusable chrome inside an
104
+ // aria-hidden region — an `aria-hidden-focus` violation).
105
+ /* @__PURE__ */ s(d.Root, { modal: !1, children: [
106
+ /* @__PURE__ */ e(d.Trigger, { asChild: !0, children: /* @__PURE__ */ e(
107
+ k,
108
+ {
109
+ intent: "ghost",
110
+ "aria-label": a.accountMenu,
111
+ startIcon: /* @__PURE__ */ e(
112
+ L,
113
+ {
114
+ name: t.name,
115
+ src: t.avatarSrc,
116
+ size: "sm",
117
+ "aria-hidden": "true"
118
+ }
119
+ ),
120
+ "data-testid": "marketplace-account-trigger",
121
+ children: /* @__PURE__ */ e("span", { className: "ds:hidden ds:sm:inline", children: t.name })
122
+ }
123
+ ) }),
124
+ /* @__PURE__ */ s(d.Content, { align: "end", children: [
125
+ /* @__PURE__ */ e(d.Label, { children: /* @__PURE__ */ s("span", { className: "ds:flex ds:flex-col", children: [
126
+ /* @__PURE__ */ e("span", { className: "ds:font-medium", children: t.name }),
127
+ t.email ? /* @__PURE__ */ e("span", { className: "ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--muted-foreground)]", children: t.email }) : null
128
+ ] }) }),
129
+ n && a.fullscreen ? /* @__PURE__ */ s(M, { children: [
130
+ /* @__PURE__ */ e(d.Separator, {}),
131
+ /* @__PURE__ */ e(
132
+ d.Item,
133
+ {
134
+ onSelect: n,
135
+ "data-testid": "marketplace-fullscreen",
136
+ children: a.fullscreen
137
+ }
138
+ )
139
+ ] }) : null,
140
+ /* @__PURE__ */ e(d.Separator, {}),
141
+ /* @__PURE__ */ e(
142
+ d.Item,
143
+ {
144
+ onSelect: r,
145
+ "data-testid": "marketplace-sign-out",
146
+ children: a.signOut
147
+ }
148
+ )
149
+ ] })
150
+ ] })
151
+ );
152
+ }
153
+ function te({ nav: t }) {
154
+ return /* @__PURE__ */ e(V, { children: t.map((a) => {
155
+ const r = typeof a.badgeCount == "number" && a.badgeCount > 0 ? a.badgeCount : void 0;
156
+ return /* @__PURE__ */ s(
157
+ q,
158
+ {
159
+ href: a.href,
160
+ "aria-label": a.label,
161
+ isActive: a.isActive,
162
+ children: [
163
+ a.icon ? /* @__PURE__ */ e(G, { children: a.icon }) : null,
164
+ /* @__PURE__ */ e(J, { children: a.label }),
165
+ r !== void 0 ? /* @__PURE__ */ e(K, { children: ee(r) }) : null
166
+ ]
167
+ },
168
+ a.id
169
+ );
170
+ }) });
171
+ }
172
+ const re = h(
173
+ ({
174
+ productName: t,
175
+ productHref: a = "/",
176
+ nav: r,
177
+ user: n,
178
+ labels: l,
179
+ onSignOut: o,
180
+ onToggleFullscreen: c,
181
+ sidebarState: i,
182
+ mainAriaLabel: m,
183
+ children: p
184
+ }, u) => {
185
+ const { t: S } = I(), { theme: y, accessibility: A, resolvedTheme: g } = X(), C = y !== "system" || A !== "system", w = g.startsWith("dark") ? "dark" : "light", z = g.endsWith("-accessible"), [B, v] = H(!1), x = /* @__PURE__ */ e(U, { children: /* @__PURE__ */ e(
186
+ T,
187
+ {
188
+ mainAriaLabel: m,
189
+ header: /* @__PURE__ */ s(P, { children: [
190
+ /* @__PURE__ */ s(j, { children: [
191
+ /* @__PURE__ */ e(W, { href: "#main-content" }),
192
+ /* @__PURE__ */ e(R, { onMenuOpen: () => v(!0) }),
193
+ /* @__PURE__ */ e(
194
+ $,
195
+ {
196
+ logo: /* @__PURE__ */ e(f, { name: t, size: "md" }),
197
+ href: a,
198
+ "aria-label": `Alfadocs ${t}`
199
+ }
200
+ )
201
+ ] }),
202
+ /* @__PURE__ */ e(D, {}),
203
+ /* @__PURE__ */ e(E, { children: /* @__PURE__ */ e(
204
+ ae,
205
+ {
206
+ user: n,
207
+ labels: l,
208
+ onSignOut: o,
209
+ onToggleFullscreen: c
210
+ }
211
+ ) })
212
+ ] }),
213
+ sidebar: /* @__PURE__ */ e(
214
+ F,
215
+ {
216
+ ...i !== void 0 ? { state: i } : { defaultState: "expanded" },
217
+ open: B,
218
+ onOpenChange: v,
219
+ "aria-label": S("navigation.sidebar.label"),
220
+ "data-testid": "marketplace-app-shell-sidebar",
221
+ children: /* @__PURE__ */ e(te, { nav: r })
222
+ }
223
+ ),
224
+ children: p
225
+ }
226
+ ) });
227
+ return C ? /* @__PURE__ */ e(
228
+ Q,
229
+ {
230
+ ref: u,
231
+ theme: w,
232
+ accessible: z,
233
+ className: "ds:contents",
234
+ "data-component": "marketplace-app-shell",
235
+ children: x
236
+ }
237
+ ) : /* @__PURE__ */ e(
238
+ "div",
239
+ {
240
+ ref: u,
241
+ className: "ds:contents",
242
+ "data-component": "marketplace-app-shell",
243
+ children: x
244
+ }
245
+ );
246
+ }
247
+ );
248
+ re.displayName = "MarketplaceAppShell";
249
+ const se = h(
250
+ ({
251
+ productName: t,
252
+ title: a,
253
+ description: r,
254
+ connectLabel: n,
255
+ status: l = "idle",
256
+ error: o,
257
+ onConnect: c,
258
+ footer: i,
259
+ className: m
260
+ }, p) => /* @__PURE__ */ e(
261
+ "div",
262
+ {
263
+ ref: p,
264
+ "data-component": "connect-with-alfadocs",
265
+ className: `ds:flex ds:min-h-dvh ds:items-center ds:justify-center ds:bg-[color:var(--background)] ds:p-[var(--spacing-lg)] ${m ?? ""}`,
266
+ children: /* @__PURE__ */ e(b, { className: "ds:w-full ds:max-w-[400px]", children: /* @__PURE__ */ s(b.Body, { className: "ds:flex ds:flex-col ds:items-center ds:gap-[var(--spacing-lg)] ds:text-center", children: [
267
+ /* @__PURE__ */ e(f, { name: t, size: "lg" }),
268
+ /* @__PURE__ */ s("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
269
+ /* @__PURE__ */ e("h1", { className: "type-title-card", children: a }),
270
+ /* @__PURE__ */ e("p", { className: "type-body-sm ds:text-[color:var(--muted-foreground)]", children: r })
271
+ ] }),
272
+ l === "error" && o ? /* @__PURE__ */ e(O, { variant: "error", className: "ds:w-full ds:text-start", children: o }) : null,
273
+ /* @__PURE__ */ e(
274
+ k,
275
+ {
276
+ intent: "primary",
277
+ className: "ds:w-full",
278
+ loading: l === "connecting",
279
+ onClick: c,
280
+ "data-testid": "connect-with-alfadocs-button",
281
+ children: n
282
+ }
283
+ ),
284
+ i ? /* @__PURE__ */ e("div", { className: "type-meta ds:text-[color:var(--muted-foreground)]", children: i }) : null
285
+ ] }) })
286
+ }
287
+ )
288
+ );
289
+ se.displayName = "ConnectWithAlfadocs";
290
+ export {
291
+ se as C,
292
+ re as M,
293
+ f as P
294
+ };
295
+ //# sourceMappingURL=marketplace-app-shell-DXHxy9dj.js.map
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "packageVersion": "0.34.0",
3
+ "packageVersion": "0.36.0",
4
4
  "components": [
5
5
  {
6
6
  "kind": "component",
@@ -0,0 +1,3 @@
1
+ export { ProductLockup } from './product-lockup';
2
+ export type { ProductLockupProps } from './product-lockup';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,54 @@
1
+ import { type ComponentPropsWithoutRef } from 'react';
2
+ import { type VariantProps } from 'class-variance-authority';
3
+ declare const productName: (props?: ({
4
+ size?: "sm" | "md" | "lg" | "xl" | null | undefined;
5
+ tone?: "gradient" | "solid" | null | undefined;
6
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
7
+ type LockupSize = NonNullable<VariantProps<typeof productName>['size']>;
8
+ export type ProductLockupProps = {
9
+ /**
10
+ * The product name paired with the Alfadocs wordmark — e.g. `"Builders"`
11
+ * renders as "Alfadocs Builders". Passed verbatim (product names are not
12
+ * translated); the lockup's accessible name becomes `Alfadocs <name>`.
13
+ */
14
+ name: string;
15
+ /**
16
+ * Render the name as a solid `--foreground` ink, upright (no gradient, no
17
+ * italic), and pair it with the monochrome wordmark. Use for print,
18
+ * single-colour reproductions, or any constrained context where the
19
+ * gradient/serif treatment is inappropriate.
20
+ */
21
+ monochrome?: boolean;
22
+ /** Lockup size. Drives both the wordmark and the name's cap height. */
23
+ size?: LockupSize;
24
+ className?: string;
25
+ } & Omit<ComponentPropsWithoutRef<'span'>, 'role' | 'aria-label' | 'aria-hidden' | 'children' | 'className'>;
26
+ /**
27
+ * The standard lockup pairing the Alfadocs wordmark with a product name
28
+ * ("Alfadocs Builders", "Alfadocs MyApp"). Every marketplace app should use
29
+ * this rather than hand-rolling a wordmark + typed span.
30
+ *
31
+ * The whole lockup is exposed to assistive tech as a single `img` named
32
+ * `Alfadocs <name>`; the inner wordmark and the visible name are both
33
+ * decorative so the brand isn't announced twice.
34
+ */
35
+ export declare const ProductLockup: import("react").ForwardRefExoticComponent<{
36
+ /**
37
+ * The product name paired with the Alfadocs wordmark — e.g. `"Builders"`
38
+ * renders as "Alfadocs Builders". Passed verbatim (product names are not
39
+ * translated); the lockup's accessible name becomes `Alfadocs <name>`.
40
+ */
41
+ name: string;
42
+ /**
43
+ * Render the name as a solid `--foreground` ink, upright (no gradient, no
44
+ * italic), and pair it with the monochrome wordmark. Use for print,
45
+ * single-colour reproductions, or any constrained context where the
46
+ * gradient/serif treatment is inappropriate.
47
+ */
48
+ monochrome?: boolean;
49
+ /** Lockup size. Drives both the wordmark and the name's cap height. */
50
+ size?: LockupSize;
51
+ className?: string;
52
+ } & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref">, "aria-hidden" | "className" | "role" | "children" | "aria-label"> & import("react").RefAttributes<HTMLSpanElement>>;
53
+ export {};
54
+ //# sourceMappingURL=product-lockup.d.ts.map
@@ -51,6 +51,7 @@ export * from './kbd';
51
51
  export * from './key-value-pair';
52
52
  export * from './list';
53
53
  export * from './logo';
54
+ export * from '../brand/product-lockup';
54
55
  export * from './map-view';
55
56
  export * from './rating';
56
57
  export * from './skeleton';
@@ -133,4 +134,5 @@ export * from './whatsapp-button';
133
134
  export * from './workflow';
134
135
  export * from '../patterns/alia-assistant';
135
136
  export * from '../patterns/patient-shell';
137
+ export * from '../patterns/marketplace-app-shell';
136
138
  //# sourceMappingURL=index.d.ts.map