@clerk/ui 0.1.9 → 0.1.10
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/dist/{chunk-GJNJVJGS.mjs → chunk-LLOUIL3Z.mjs} +1074 -2170
- package/dist/chunk-LLOUIL3Z.mjs.map +1 -0
- package/dist/chunk-TVTJKSVH.mjs +1811 -0
- package/dist/chunk-TVTJKSVH.mjs.map +1 -0
- package/dist/components/sign-in.d.mts +1 -1
- package/dist/components/sign-in.d.ts +1 -1
- package/dist/components/sign-in.js +2663 -2296
- package/dist/components/sign-in.js.map +1 -1
- package/dist/components/sign-in.mjs +68 -30
- package/dist/components/sign-in.mjs.map +1 -1
- package/dist/components/sign-up.js +4674 -4326
- package/dist/components/sign-up.js.map +1 -1
- package/dist/components/sign-up.mjs +27 -8
- package/dist/components/sign-up.mjs.map +1 -1
- package/dist/contexts.d.mts +5 -4
- package/dist/contexts.d.ts +5 -4
- package/dist/contexts.js +993 -40
- package/dist/contexts.js.map +1 -1
- package/dist/contexts.mjs +1 -1
- package/dist/styles.css +1 -1
- package/package.json +15 -14
- package/dist/chunk-GJNJVJGS.mjs.map +0 -1
- package/dist/chunk-RVVUA25B.mjs +0 -383
- package/dist/chunk-RVVUA25B.mjs.map +0 -1
package/dist/chunk-RVVUA25B.mjs
DELETED
|
@@ -1,383 +0,0 @@
|
|
|
1
|
-
import { createContextAndHook, useDeepEqualMemo } from '@clerk/shared/react';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
|
-
|
|
5
|
-
// src/contexts/AppearanceContext.tsx
|
|
6
|
-
var $bdb11010cef70236$var$idsUpdaterMap = /* @__PURE__ */ new Map();
|
|
7
|
-
function $bdb11010cef70236$export$cd8c9cb68f842629(idA, idB) {
|
|
8
|
-
if (idA === idB) return idA;
|
|
9
|
-
let setIdA = $bdb11010cef70236$var$idsUpdaterMap.get(idA);
|
|
10
|
-
if (setIdA) {
|
|
11
|
-
setIdA(idB);
|
|
12
|
-
return idB;
|
|
13
|
-
}
|
|
14
|
-
let setIdB = $bdb11010cef70236$var$idsUpdaterMap.get(idB);
|
|
15
|
-
if (setIdB) {
|
|
16
|
-
setIdB(idA);
|
|
17
|
-
return idA;
|
|
18
|
-
}
|
|
19
|
-
return idB;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// ../../node_modules/@react-aria/utils/dist/chain.mjs
|
|
23
|
-
function $ff5963eb1fccf552$export$e08e3b67e392101e(...callbacks) {
|
|
24
|
-
return (...args) => {
|
|
25
|
-
for (let callback of callbacks) if (typeof callback === "function") callback(...args);
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// ../../node_modules/clsx/dist/clsx.mjs
|
|
30
|
-
function r(e) {
|
|
31
|
-
var t, f, n = "";
|
|
32
|
-
if ("string" == typeof e || "number" == typeof e) n += e;
|
|
33
|
-
else if ("object" == typeof e) if (Array.isArray(e)) {
|
|
34
|
-
var o = e.length;
|
|
35
|
-
for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
|
|
36
|
-
} else for (f in e) e[f] && (n && (n += " "), n += f);
|
|
37
|
-
return n;
|
|
38
|
-
}
|
|
39
|
-
function clsx() {
|
|
40
|
-
for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
|
|
41
|
-
return n;
|
|
42
|
-
}
|
|
43
|
-
var clsx_default = clsx;
|
|
44
|
-
|
|
45
|
-
// ../../node_modules/@react-aria/utils/dist/mergeProps.mjs
|
|
46
|
-
function $3ef42575df84b30b$export$9d1611c77c2fe928(...args) {
|
|
47
|
-
let result = {
|
|
48
|
-
...args[0]
|
|
49
|
-
};
|
|
50
|
-
for (let i = 1; i < args.length; i++) {
|
|
51
|
-
let props = args[i];
|
|
52
|
-
for (let key in props) {
|
|
53
|
-
let a = result[key];
|
|
54
|
-
let b = props[key];
|
|
55
|
-
if (typeof a === "function" && typeof b === "function" && // This is a lot faster than a regex.
|
|
56
|
-
key[0] === "o" && key[1] === "n" && key.charCodeAt(2) >= /* 'A' */
|
|
57
|
-
65 && key.charCodeAt(2) <= /* 'Z' */
|
|
58
|
-
90) result[key] = ($ff5963eb1fccf552$export$e08e3b67e392101e)(a, b);
|
|
59
|
-
else if ((key === "className" || key === "UNSAFE_className") && typeof a === "string" && typeof b === "string") result[key] = (clsx_default)(a, b);
|
|
60
|
-
else if (key === "id" && a && b) result.id = ($bdb11010cef70236$export$cd8c9cb68f842629)(a, b);
|
|
61
|
-
else result[key] = b !== void 0 ? b : a;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
return result;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// src/primitives/icons/icon.tsx
|
|
68
|
-
var Icon = React.forwardRef(
|
|
69
|
-
function Icon2(props, ref) {
|
|
70
|
-
const { children, "aria-label": ariaLabel, "aria-hidden": ariaHidden, ...restProps } = props;
|
|
71
|
-
return React.cloneElement(children, {
|
|
72
|
-
...$3ef42575df84b30b$export$9d1611c77c2fe928(children.props, restProps),
|
|
73
|
-
ref,
|
|
74
|
-
width: "1em",
|
|
75
|
-
height: "1em",
|
|
76
|
-
fill: "none",
|
|
77
|
-
focusable: "false",
|
|
78
|
-
"aria-label": ariaLabel,
|
|
79
|
-
"aria-hidden": ariaLabel ? ariaHidden || void 0 : true,
|
|
80
|
-
role: "img"
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
);
|
|
84
|
-
function ExclamationOctagonSm(props) {
|
|
85
|
-
return /* @__PURE__ */ jsx(Icon, { ...props, children: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 16 16", children: [
|
|
86
|
-
/* @__PURE__ */ jsx(
|
|
87
|
-
"path",
|
|
88
|
-
{
|
|
89
|
-
d: "M8 5.75V7.25",
|
|
90
|
-
stroke: "currentColor",
|
|
91
|
-
strokeWidth: "1.5",
|
|
92
|
-
strokeLinecap: "round",
|
|
93
|
-
strokeLinejoin: "round"
|
|
94
|
-
}
|
|
95
|
-
),
|
|
96
|
-
/* @__PURE__ */ jsx(
|
|
97
|
-
"path",
|
|
98
|
-
{
|
|
99
|
-
d: "M8 10V10.01",
|
|
100
|
-
stroke: "currentColor",
|
|
101
|
-
strokeWidth: "1.5",
|
|
102
|
-
strokeLinecap: "round",
|
|
103
|
-
strokeLinejoin: "round"
|
|
104
|
-
}
|
|
105
|
-
),
|
|
106
|
-
/* @__PURE__ */ jsx(
|
|
107
|
-
"path",
|
|
108
|
-
{
|
|
109
|
-
d: "M10.25 2.75H5.75L2.75 5.75V10.25L5.75 13.25H10.25L13.25 10.25V5.75L10.25 2.75Z",
|
|
110
|
-
stroke: "currentColor",
|
|
111
|
-
strokeWidth: "1.5",
|
|
112
|
-
strokeLinecap: "round",
|
|
113
|
-
strokeLinejoin: "round"
|
|
114
|
-
}
|
|
115
|
-
)
|
|
116
|
-
] }) });
|
|
117
|
-
}
|
|
118
|
-
function ExclamationTriangleSm(props) {
|
|
119
|
-
return /* @__PURE__ */ jsx(Icon, { ...props, children: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 16 16", children: [
|
|
120
|
-
/* @__PURE__ */ jsx(
|
|
121
|
-
"path",
|
|
122
|
-
{
|
|
123
|
-
d: "M8 6.75V8.25",
|
|
124
|
-
stroke: "currentColor",
|
|
125
|
-
strokeWidth: "1.5",
|
|
126
|
-
strokeLinecap: "round",
|
|
127
|
-
strokeLinejoin: "round"
|
|
128
|
-
}
|
|
129
|
-
),
|
|
130
|
-
/* @__PURE__ */ jsx(
|
|
131
|
-
"path",
|
|
132
|
-
{
|
|
133
|
-
d: "M8 10.5V10.51",
|
|
134
|
-
stroke: "currentColor",
|
|
135
|
-
strokeWidth: "1.5",
|
|
136
|
-
strokeLinecap: "round",
|
|
137
|
-
strokeLinejoin: "round"
|
|
138
|
-
}
|
|
139
|
-
),
|
|
140
|
-
/* @__PURE__ */ jsx(
|
|
141
|
-
"path",
|
|
142
|
-
{
|
|
143
|
-
d: "M2.95652 10.4518L6.27146 3.8188C6.98366 2.39373 9.01635 2.39373 9.72855 3.81881L13.0435 10.4518C13.686 11.7374 12.7516 13.25 11.3149 13.25H4.68506C3.24842 13.25 2.31404 11.7374 2.95652 10.4518Z",
|
|
144
|
-
stroke: "currentColor",
|
|
145
|
-
strokeWidth: "1.5",
|
|
146
|
-
strokeLinecap: "round",
|
|
147
|
-
strokeLinejoin: "round"
|
|
148
|
-
}
|
|
149
|
-
)
|
|
150
|
-
] }) });
|
|
151
|
-
}
|
|
152
|
-
var layoutStyle = {
|
|
153
|
-
alert: {
|
|
154
|
-
className: "cl-fbddaa7d"
|
|
155
|
-
},
|
|
156
|
-
alert__warning: {},
|
|
157
|
-
alert__error: {},
|
|
158
|
-
alertIcon: {
|
|
159
|
-
className: "cl-af4e251c"
|
|
160
|
-
}
|
|
161
|
-
};
|
|
162
|
-
var visualStyle = {
|
|
163
|
-
alert: {
|
|
164
|
-
className: "cl-15c02a47"
|
|
165
|
-
},
|
|
166
|
-
alert__warning: {
|
|
167
|
-
className: "cl-a992fcfc"
|
|
168
|
-
},
|
|
169
|
-
alert__error: {
|
|
170
|
-
className: "cl-66ef3405"
|
|
171
|
-
},
|
|
172
|
-
alertIcon: {}
|
|
173
|
-
};
|
|
174
|
-
var Alert = React.forwardRef(function Alert2({ children, descriptors, intent = "error", ...props }, forwardedRef) {
|
|
175
|
-
const { elements } = useAppearance().parsedAppearance;
|
|
176
|
-
return /* @__PURE__ */ jsxs(
|
|
177
|
-
"div",
|
|
178
|
-
{
|
|
179
|
-
ref: forwardedRef,
|
|
180
|
-
...props,
|
|
181
|
-
...mergeDescriptors(
|
|
182
|
-
elements.alert,
|
|
183
|
-
intent === "error" && elements.alert__error,
|
|
184
|
-
intent === "warning" && elements.alert__warning,
|
|
185
|
-
...descriptors != null ? descriptors : []
|
|
186
|
-
),
|
|
187
|
-
children: [
|
|
188
|
-
{
|
|
189
|
-
error: /* @__PURE__ */ jsx(ExclamationOctagonSm, { ...mergeDescriptors(elements.alertIcon) }),
|
|
190
|
-
warning: /* @__PURE__ */ jsx(ExclamationTriangleSm, { ...mergeDescriptors(elements.alertIcon) })
|
|
191
|
-
}[intent],
|
|
192
|
-
children
|
|
193
|
-
]
|
|
194
|
-
}
|
|
195
|
-
);
|
|
196
|
-
});
|
|
197
|
-
var layoutStyle2 = {
|
|
198
|
-
separator: {
|
|
199
|
-
className: "cl-c53048bf"
|
|
200
|
-
}
|
|
201
|
-
};
|
|
202
|
-
var visualStyle2 = {
|
|
203
|
-
separator: {
|
|
204
|
-
className: "cl-77b14b2e"
|
|
205
|
-
}
|
|
206
|
-
};
|
|
207
|
-
var Separator = React.forwardRef(function Separator2({ children, descriptors, ...props }, forwardedRef) {
|
|
208
|
-
const { elements } = useAppearance().parsedAppearance;
|
|
209
|
-
return /* @__PURE__ */ jsx(
|
|
210
|
-
"div",
|
|
211
|
-
{
|
|
212
|
-
ref: forwardedRef,
|
|
213
|
-
...props,
|
|
214
|
-
...mergeDescriptors(elements.separator, ...descriptors != null ? descriptors : []),
|
|
215
|
-
children
|
|
216
|
-
}
|
|
217
|
-
);
|
|
218
|
-
});
|
|
219
|
-
|
|
220
|
-
// src/themes/buildTheme.ts
|
|
221
|
-
function buildTheme(p) {
|
|
222
|
-
const theme = {};
|
|
223
|
-
for (const descriptor in p) {
|
|
224
|
-
if (p[descriptor]) {
|
|
225
|
-
const { className, style } = p[descriptor];
|
|
226
|
-
theme[descriptor] = {
|
|
227
|
-
descriptor: `cl-${descriptor}`,
|
|
228
|
-
className: className != null ? className : "",
|
|
229
|
-
style: style != null ? style : {}
|
|
230
|
-
};
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
return theme;
|
|
234
|
-
}
|
|
235
|
-
function mergeTheme(a, b) {
|
|
236
|
-
const mergedTheme = { ...a };
|
|
237
|
-
for (const d in mergedTheme) {
|
|
238
|
-
const descriptor = d;
|
|
239
|
-
mergedTheme[descriptor].className = [mergedTheme[descriptor].className, b[descriptor].className].join(" ");
|
|
240
|
-
mergedTheme[descriptor].style = { ...mergedTheme[descriptor].style, ...b[descriptor].style };
|
|
241
|
-
}
|
|
242
|
-
return mergedTheme;
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
// src/themes/layout.ts
|
|
246
|
-
var layoutTheme = buildTheme({ ...layoutStyle, ...layoutStyle2 });
|
|
247
|
-
|
|
248
|
-
// src/themes/full.ts
|
|
249
|
-
var visualTheme = buildTheme({ ...visualStyle, ...visualStyle2 });
|
|
250
|
-
var fullTheme = mergeTheme(layoutTheme, visualTheme);
|
|
251
|
-
function mergeDescriptors(...descriptors) {
|
|
252
|
-
return descriptors.reduce(
|
|
253
|
-
(acc, el) => {
|
|
254
|
-
if (typeof el === "boolean") {
|
|
255
|
-
return acc;
|
|
256
|
-
}
|
|
257
|
-
acc.className = [el.descriptor, acc.className, el.className].join(" ");
|
|
258
|
-
acc.style = { ...acc.style, ...el.style };
|
|
259
|
-
return acc;
|
|
260
|
-
},
|
|
261
|
-
{ className: "", style: {} }
|
|
262
|
-
);
|
|
263
|
-
}
|
|
264
|
-
function mergeElementsAppearanceConfig(a, b) {
|
|
265
|
-
let result;
|
|
266
|
-
if (typeof a === "string" && typeof b === "string") {
|
|
267
|
-
result = [a, b].join(" ");
|
|
268
|
-
} else if (typeof a === "string" && typeof b === "object") {
|
|
269
|
-
result = { ...b };
|
|
270
|
-
result.className = [result.className, a].join(" ");
|
|
271
|
-
} else if (typeof a === "object" && typeof b === "string") {
|
|
272
|
-
result = { ...a };
|
|
273
|
-
result.className = [result.className, b].join(" ");
|
|
274
|
-
} else if (typeof a === "object" && typeof b === "object") {
|
|
275
|
-
result = {
|
|
276
|
-
...a,
|
|
277
|
-
...b
|
|
278
|
-
};
|
|
279
|
-
if (a.className || b.className) {
|
|
280
|
-
result.className = [a.className, b.className].filter(Boolean).join(" ");
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
if (!result) {
|
|
284
|
-
throw new Error(`Unable to merge ElementsAppearanceConfigs: ${a} and ${b}`);
|
|
285
|
-
}
|
|
286
|
-
return result;
|
|
287
|
-
}
|
|
288
|
-
function mergeAppearance(a, b) {
|
|
289
|
-
if (!a && !b) {
|
|
290
|
-
return null;
|
|
291
|
-
}
|
|
292
|
-
if (!a) {
|
|
293
|
-
return b;
|
|
294
|
-
}
|
|
295
|
-
if (!b) {
|
|
296
|
-
return a;
|
|
297
|
-
}
|
|
298
|
-
const result = { ...a, options: { ...a.options, ...b.options } };
|
|
299
|
-
if (b.theme) {
|
|
300
|
-
result.theme = b.theme;
|
|
301
|
-
}
|
|
302
|
-
if (!result.elements && b.elements) {
|
|
303
|
-
result.elements = { ...b.elements };
|
|
304
|
-
} else if (result.elements && b.elements) {
|
|
305
|
-
Object.entries(b.elements).forEach(([element, config]) => {
|
|
306
|
-
const el = element;
|
|
307
|
-
if (el in result.elements) {
|
|
308
|
-
result.elements[el] = mergeElementsAppearanceConfig(result.elements[el], config);
|
|
309
|
-
} else {
|
|
310
|
-
result.elements[el] = config;
|
|
311
|
-
}
|
|
312
|
-
});
|
|
313
|
-
}
|
|
314
|
-
return result;
|
|
315
|
-
}
|
|
316
|
-
function applyTheme(theme, appearance) {
|
|
317
|
-
const baseTheme = theme != null ? theme : fullTheme;
|
|
318
|
-
if (!appearance) {
|
|
319
|
-
return { theme: baseTheme, elements: structuredClone(baseTheme), options: defaultAppearance.options };
|
|
320
|
-
}
|
|
321
|
-
const result = {
|
|
322
|
-
theme: baseTheme,
|
|
323
|
-
// because we're going to perform modifications to deeply nested objects, we need to create a structuredClone of
|
|
324
|
-
// the theme or else subsequent usage of the baseTheme will contain our merged changes.
|
|
325
|
-
elements: structuredClone(baseTheme),
|
|
326
|
-
options: { ...defaultAppearance.options, ...appearance.options }
|
|
327
|
-
};
|
|
328
|
-
if (appearance.elements) {
|
|
329
|
-
Object.entries(appearance.elements).forEach(([element, config]) => {
|
|
330
|
-
const el = element;
|
|
331
|
-
if (el in appearance.elements) {
|
|
332
|
-
if (typeof config === "string") {
|
|
333
|
-
result.elements[el].className = [result.elements[el].className, config].join(" ");
|
|
334
|
-
} else {
|
|
335
|
-
const { className, ...style } = config;
|
|
336
|
-
if (className) {
|
|
337
|
-
result.elements[el].className = [result.elements[el].className, className].join(" ");
|
|
338
|
-
}
|
|
339
|
-
result.elements[el].style = { ...result.elements[el].style, ...style };
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
});
|
|
343
|
-
}
|
|
344
|
-
return result;
|
|
345
|
-
}
|
|
346
|
-
var defaultAppearance = {
|
|
347
|
-
theme: fullTheme,
|
|
348
|
-
elements: fullTheme,
|
|
349
|
-
options: {
|
|
350
|
-
logoVisibility: "visible",
|
|
351
|
-
socialButtonsPlacement: "top",
|
|
352
|
-
socialButtonsVariant: "auto",
|
|
353
|
-
logoImageUrl: "",
|
|
354
|
-
logoLinkUrl: "",
|
|
355
|
-
showOptionalFields: true,
|
|
356
|
-
helpPageUrl: "",
|
|
357
|
-
privacyPageUrl: "",
|
|
358
|
-
termsPageUrl: "",
|
|
359
|
-
shimmer: true,
|
|
360
|
-
animations: true,
|
|
361
|
-
unsafe_disableDevelopmentModeWarnings: false
|
|
362
|
-
}
|
|
363
|
-
};
|
|
364
|
-
var [AppearanceContext, useAppearance, usePartialAppearance] = createContextAndHook("AppearanceContext");
|
|
365
|
-
var AppearanceProvider = (props) => {
|
|
366
|
-
const {
|
|
367
|
-
parsedAppearance: globalAppearance,
|
|
368
|
-
themelessAppearance: globalThemelessAppearance,
|
|
369
|
-
theme: globalTheme
|
|
370
|
-
} = usePartialAppearance();
|
|
371
|
-
const ctxValue = useDeepEqualMemo(() => {
|
|
372
|
-
var _a, _b;
|
|
373
|
-
const theme = (_a = props.theme) != null ? _a : globalTheme;
|
|
374
|
-
const themelessAppearance = mergeAppearance(globalThemelessAppearance, props.appearance);
|
|
375
|
-
const parsedAppearance = applyTheme(theme, themelessAppearance);
|
|
376
|
-
return { value: { parsedAppearance, themelessAppearance, theme: (_b = props.theme) != null ? _b : globalTheme } };
|
|
377
|
-
}, [props.appearance, props.theme, globalAppearance, globalThemelessAppearance, globalTheme]);
|
|
378
|
-
return /* @__PURE__ */ jsx(AppearanceContext.Provider, { value: ctxValue, children: props.children });
|
|
379
|
-
};
|
|
380
|
-
|
|
381
|
-
export { Alert, AppearanceProvider, ExclamationOctagonSm, ExclamationTriangleSm, Icon, Separator, mergeDescriptors, useAppearance };
|
|
382
|
-
//# sourceMappingURL=out.js.map
|
|
383
|
-
//# sourceMappingURL=chunk-RVVUA25B.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/contexts/AppearanceContext.tsx","../src/primitives/alert.tsx","../src/primitives/icons/icon.tsx","../../../node_modules/@react-aria/utils/dist/packages/@react-aria/utils/src/useId.ts","../../../node_modules/@react-aria/utils/dist/packages/@react-aria/utils/src/chain.ts","../../../node_modules/clsx/dist/clsx.mjs","../../../node_modules/@react-aria/utils/dist/packages/@react-aria/utils/src/mergeProps.ts","../src/primitives/icons/exclamation-octagon-sm.tsx","../src/primitives/icons/exclamation-triangle-sm.tsx","../src/primitives/separator.tsx","../src/themes/buildTheme.ts","../src/themes/layout.ts","../src/themes/full.ts"],"names":["React","Icon","jsx","jsxs","Alert","layoutStyle","visualStyle","Separator"],"mappings":";AAAA,SAAS,sBAAsB,wBAAwB;;;ACAvD,YAAYA,YAAW;;;ACAvB,YAAY,WAAW;;;;ACkBvB,IAAI,kCAAY,QACd,OAAO,WAAW,eAClB,OAAO,YACP,OAAO,SAAS,aAAa;AAG/B,IAAI,sCAAkD,oBAAI,IAAA;AA4CnD,SAAS,0CAAS,KAAa,KAAW;AAC/C,MAAI,QAAQ,IACV,QAAO;AAGT,MAAI,SAAS,oCAAc,IAAI,GAAA;AAC/B,MAAI,QAAQ;AACV,WAAO,GAAA;AACP,WAAO;EACT;AAEA,MAAI,SAAS,oCAAc,IAAI,GAAA;AAC/B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H,CAAC;AAED,OAAG,kCAAkC,MAAM;AACzC,YAAM,IAAI,EAAE,WAAW,qBAAqB,OAAO,MAAM;AACzD,YAAM,IAAI,EAAE,WAAW,qBAAqB,iBAAiB,SAAS;AACtE,aAAO,8BAA8B,GAAG,CAAC,CAAC,EAAE,cAAc;AAAA,QACxD,WAAW;AAAA,QACX,OAAO;AAAA,QACP,iBAAiB;AAAA,MACnB,CAAC;AAAA,IACH,CAAC;AAED,OAAG,4CAA4C,MAAM;AACnD,YAAM,IAAI,EAAE,OAAO,MAAM;AACzB,YAAM,IAAI,EAAE,iBAAiB,SAAS;AACtC,aAAO,8BAA8B,GAAG,CAAC,CAAC,EAAE,cAAc;AAAA,QACxD,OAAO;AAAA,QACP,iBAAiB;AAAA,MACnB,CAAC;AAAA,IACH,CAAC;AAAA,EACH,CAAC;AAED,WAAS,cAAc,MAAM;AAC3B,OAAG,8BAA8B,MAAM;AACrC,YAAM,aAAa;AAAA,QACjB,UAAU;AAAA,UACR,gBAAgB;AAAA,QAClB;AAAA,MACF;AACA,YAAM,QAAQ;AAAA,QACZ,GAAG;AAAA,QACH,gBAAgB,EAAE,YAAY,QAAQ,WAAW,iBAAiB,OAAO,EAAE,OAAO,MAAM,EAAE;AAAA,MAC5F;AACA,aAAO,WAAW,OAAO,UAAU,CAAC,EAAE,cAAc;AAAA,QAClD;AAAA,QACA,SAAS,kBAAkB;AAAA,QAC3B,UAAU;AAAA,UACR,GAAG;AAAA,UACH,gBAAgB;AAAA,YACd,WAAW;AAAA,YACX,YAAY;AAAA,YACZ,OAAO,EAAE,OAAO,MAAM;AAAA,UACxB;AAAA,QACF;AAAA,MACF,CAAC;AAAA,IACH,CAAC;AAAA,EACH,CAAC;AACH","sourcesContent":["import { createContextAndHook, useDeepEqualMemo } from '@clerk/shared/react';\nimport type { Appearance as CurrentAppearance, Layout as CurrentLayout } from '@clerk/types';\nimport React from 'react';\n\nimport { fullTheme } from '~/themes';\n\ntype AlertDescriptorIdentifier = 'alert' | 'alert__error' | 'alert__warning' | 'alertRoot' | 'alertIcon';\ntype SeparatorDescriptorIdentifier = 'separator';\n\n/**\n * Union of all valid descriptors used throughout the components.\n */\nexport type DescriptorIdentifier = AlertDescriptorIdentifier | SeparatorDescriptorIdentifier;\n\n/**\n * The final resulting descriptor that gets passed to mergeDescriptors and spread on the element.\n */\nexport type ParsedDescriptor = { descriptor: string; className: string; style: React.CSSProperties };\n\n/**\n * The authoring format value type for styles written within a component. Essentially { className?: string, style?: CSSProperties }\n */\nexport type PartialDescriptor = Omit<Partial<ParsedDescriptor>, 'descriptor'>;\n\n/**\n * A full theme generated from merging ParsedElementsFragments. Has entries for each descriptor, but they're not complete.\n */\nexport type PartialTheme = Record<DescriptorIdentifier, PartialDescriptor>;\n\n/**\n * A subset of a partial theme. This is the type used when authoring style objects within a component.\n */\nexport type ParsedElementsFragment = Partial<PartialTheme>;\n\n/**\n * A full theme, complete with descriptors. This is the value returned from useAppearance().parsedAppearance, and is\n * the main type interacted with within components.\n */\nexport type ParsedElements = Record<DescriptorIdentifier, ParsedDescriptor>;\nexport type ParsedOptions = Omit<CurrentLayout, 'logoPlacement'> & {\n logoVisibility?: 'visible' | 'hidden';\n};\n\ntype ElementsAppearanceConfig = string | (React.CSSProperties & { className?: string });\n\nexport type Appearance = Omit<CurrentAppearance, 'elements' | 'baseTheme' | 'layout'> & {\n theme?: ParsedElements;\n elements?: Partial<Record<DescriptorIdentifier, ElementsAppearanceConfig>>;\n options?: ParsedOptions;\n};\n\nexport type AppearanceCascade = {\n globalAppearance?: ParsedAppearance;\n appearance?: Appearance;\n};\n\n/**\n * The generated appearance calculated from defaults and user-provided values. This is the type used to access computed\n * appearance values, and as such will always have a value for a given key.\n */\nexport type ParsedAppearance = {\n theme: ParsedElements;\n elements: ParsedElements;\n options: ParsedOptions;\n};\n\ntype AppearanceContextValue = {\n /**\n * The calculated appearance value based on the provided `appearance` and `globalAppearance`.\n *\n * Example:\n * ```tsx\n * function Help() {\n * const { options } = useAppearance().parsedAppearance;\n * return <p>{options.helpPageUrl}</p>\n * }\n * ```\n */\n parsedAppearance: ParsedAppearance;\n themelessAppearance: Appearance | null;\n theme?: ParsedElements;\n};\n\n/**\n * Used to merge full themes with ParsedElementsFragments. Allows you to combine optionsStyle with multiple visualStyle\n * elements.\n */\nexport function mergeParsedElementsFragment(...fragments: ParsedElementsFragment[]): ParsedElementsFragment {\n const acc: ParsedElementsFragment = {};\n\n fragments.forEach(fragment => {\n for (const k in fragment) {\n const key = k as keyof ParsedElementsFragment;\n if (key in acc) {\n acc[key]!.className = [acc[key]?.className, fragment[key]?.className].join(' ');\n acc[key]!.style = {\n ...acc[key]!.style,\n ...fragment[key]?.style,\n };\n } else {\n acc[key] = {\n className: fragment[key]?.className,\n style: fragment[key]?.style,\n };\n }\n }\n });\n\n return acc;\n}\n\n/**\n * Used within components to merge multiple descriptors onto a single element. Result is directly spread onto the element.\n */\nexport function mergeDescriptors(...descriptors: (ParsedDescriptor | boolean)[]): PartialDescriptor {\n return descriptors.reduce<PartialDescriptor>(\n (acc, el) => {\n if (typeof el === 'boolean') {\n return acc;\n }\n acc.className = [el.descriptor, acc.className, el.className].join(' ');\n acc.style = { ...acc.style, ...el.style };\n return acc;\n },\n { className: '', style: {} },\n );\n}\n\nfunction mergeElementsAppearanceConfig(\n a: ElementsAppearanceConfig,\n b: ElementsAppearanceConfig,\n): ElementsAppearanceConfig {\n let result: ElementsAppearanceConfig | undefined;\n if (typeof a === 'string' && typeof b === 'string') {\n result = [a, b].join(' ');\n } else if (typeof a === 'string' && typeof b === 'object') {\n result = { ...b };\n result.className = [result.className, a].join(' ');\n } else if (typeof a === 'object' && typeof b === 'string') {\n result = { ...a };\n result.className = [result.className, b].join(' ');\n } else if (typeof a === 'object' && typeof b === 'object') {\n result = {\n ...a,\n ...b,\n };\n if (a.className || b.className) {\n result.className = [a.className, b.className].filter(Boolean).join(' ');\n }\n }\n\n if (!result) {\n throw new Error(`Unable to merge ElementsAppearanceConfigs: ${a} and ${b}`);\n }\n\n return result;\n}\n\nfunction mergeAppearance(a: Appearance | null | undefined, b: Appearance | null | undefined): Appearance | null {\n if (!a && !b) {\n return null;\n }\n if (!a) {\n return b!;\n }\n if (!b) {\n return a;\n }\n\n const result = { ...a, options: { ...a.options, ...b.options } }; // Ensure options are merged\n\n if (b.theme) {\n result.theme = b.theme;\n }\n\n if (!result.elements && b.elements) {\n result.elements = { ...b.elements };\n } else if (result.elements && b.elements) {\n Object.entries(b.elements).forEach(([element, config]) => {\n const el = element as DescriptorIdentifier;\n if (el in result.elements!) {\n result.elements![el] = mergeElementsAppearanceConfig(result.elements![el]!, config);\n } else {\n result.elements![el] = config;\n }\n });\n }\n\n return result;\n}\n\nfunction applyTheme(theme: ParsedElements | undefined, appearance: Appearance | null): ParsedAppearance {\n const baseTheme = theme ?? fullTheme;\n if (!appearance) {\n return { theme: baseTheme, elements: structuredClone(baseTheme), options: defaultAppearance.options };\n }\n\n const result = {\n theme: baseTheme,\n // because we're going to perform modifications to deeply nested objects, we need to create a structuredClone of\n // the theme or else subsequent usage of the baseTheme will contain our merged changes.\n elements: structuredClone(baseTheme),\n options: { ...defaultAppearance.options, ...appearance.options },\n };\n\n if (appearance.elements) {\n Object.entries(appearance.elements).forEach(([element, config]) => {\n const el = element as DescriptorIdentifier;\n if (el in appearance.elements!) {\n if (typeof config === 'string') {\n result.elements[el].className = [result.elements[el].className, config].join(' ');\n } else {\n const { className, ...style } = config;\n if (className) {\n result.elements[el].className = [result.elements[el].className, className].join(' ');\n }\n result.elements[el].style = { ...result.elements[el].style, ...style };\n }\n }\n });\n }\n\n return result;\n}\n\nexport const defaultAppearance: ParsedAppearance = {\n theme: fullTheme,\n elements: fullTheme,\n options: {\n logoVisibility: 'visible',\n socialButtonsPlacement: 'top',\n socialButtonsVariant: 'auto',\n logoImageUrl: '',\n logoLinkUrl: '',\n showOptionalFields: true,\n helpPageUrl: '',\n privacyPageUrl: '',\n termsPageUrl: '',\n shimmer: true,\n animations: true,\n unsafe_disableDevelopmentModeWarnings: false,\n },\n};\n\nconst [AppearanceContext, useAppearance, usePartialAppearance] =\n createContextAndHook<AppearanceContextValue>('AppearanceContext');\n\ntype AppearanceProviderProps = React.PropsWithChildren<{ appearance?: Appearance; theme?: ParsedElements }>;\n\n/**\n * Used to provide appearance values throughout an application. In typical usage, the entire application will be\n * wrapped in an `AppearanceProvider` to provide global configuration. Each top-level AIO component that accepts an\n * `appearance` prop will wrap its children in `AppearanceProvider`. The provider handles the merging of attributes,\n * and makes them available via the `useAppearance` hook.\n */\nconst AppearanceProvider = (props: AppearanceProviderProps) => {\n // Access the parsedAppearance of the parent context provider. `undefined` if this is the top-most\n // AppearanceProvider.\n const {\n parsedAppearance: globalAppearance,\n themelessAppearance: globalThemelessAppearance,\n theme: globalTheme,\n } = usePartialAppearance();\n\n const ctxValue = useDeepEqualMemo(() => {\n const theme = props.theme ?? globalTheme;\n const themelessAppearance = mergeAppearance(globalThemelessAppearance, props.appearance);\n const parsedAppearance = applyTheme(theme, themelessAppearance);\n\n return { value: { parsedAppearance, themelessAppearance, theme: props.theme ?? globalTheme } };\n }, [props.appearance, props.theme, globalAppearance, globalThemelessAppearance, globalTheme]);\n\n return <AppearanceContext.Provider value={ctxValue}>{props.children}</AppearanceContext.Provider>;\n};\n\nexport { AppearanceProvider, useAppearance };\n\nif (import.meta.vitest) {\n const { it, expect, describe } = import.meta.vitest;\n\n describe('mergeAppearance', () => {\n it('retains keys from both appearances', () => {\n const a = { elements: { alert__warning: 'cl-test-class-one' } };\n const b = { elements: { alertIcon: 'cl-test-class-two' } };\n expect(mergeAppearance(a, b)).toStrictEqual({\n options: {},\n elements: {\n alert__warning: 'cl-test-class-one',\n alertIcon: 'cl-test-class-two',\n },\n });\n });\n\n it('retains the theme prop', () => {\n const a = { theme: fullTheme, elements: { alert__warning: 'cl-test-class-one' } };\n const b = {\n elements: { alertIcon: 'cl-test-class-two' },\n };\n expect(mergeAppearance(a, b)).toStrictEqual({\n options: {},\n theme: a.theme,\n elements: {\n alert__warning: 'cl-test-class-one',\n alertIcon: 'cl-test-class-two',\n },\n });\n });\n\n it('overrides the theme prop', () => {\n const a = { theme: fullTheme, elements: { alert__warning: 'cl-test-class-one' } };\n const b = {\n theme: { ...fullTheme, alertIcon: { descriptor: 'test', className: 'cl-test-class', style: {} } },\n elements: { alertIcon: 'cl-test-class-two' },\n };\n expect(mergeAppearance(a, b)).toStrictEqual({\n options: {},\n theme: b.theme,\n elements: {\n alert__warning: 'cl-test-class-one',\n alertIcon: 'cl-test-class-two',\n },\n });\n });\n\n it('merges string values for the same element', () => {\n const a = { elements: { alert__warning: 'cl-test-class-one' } };\n const b = { elements: { alert__warning: 'cl-test-class-two' } };\n expect(mergeAppearance(a, b)).toStrictEqual({\n options: {},\n elements: {\n alert__warning: 'cl-test-class-one cl-test-class-two',\n },\n });\n });\n\n it('merges object values for the same element', () => {\n const a = { elements: { alert__warning: { background: 'tomato' } } };\n const b = { elements: { alert__warning: { color: 'red' } } };\n expect(mergeAppearance(a, b)).toStrictEqual({\n options: {},\n elements: {\n alert__warning: { color: 'red', background: 'tomato' },\n },\n });\n });\n\n it('overrides same style properties', () => {\n const a = { elements: { alert__warning: { background: 'tomato' } } };\n const b = { elements: { alert__warning: { background: 'red' } } };\n expect(mergeAppearance(a, b)).toStrictEqual({\n options: {},\n elements: {\n alert__warning: { background: 'red' },\n },\n });\n });\n });\n\n describe('mergeElementsAppearanceConfig', () => {\n it('merges two strings', () => {\n const a = 'cl-test-class-one';\n const b = 'cl-test-class-two';\n expect(mergeElementsAppearanceConfig(a, b)).toBe('cl-test-class-one cl-test-class-two');\n });\n\n it('merges a string and an object', () => {\n const a = 'cl-test-class-one';\n const b = { className: 'cl-test-class-two' };\n expect(mergeElementsAppearanceConfig(a, b)).toStrictEqual({ className: 'cl-test-class-two cl-test-class-one' });\n });\n\n it('merges an object and a string', () => {\n const a = { className: 'cl-test-class-one' };\n const b = 'cl-test-class-two';\n expect(mergeElementsAppearanceConfig(a, b)).toStrictEqual({ className: 'cl-test-class-one cl-test-class-two' });\n });\n\n it('merges two objects', () => {\n const a = { className: 'cl-test-class-one' };\n const b = { className: 'cl-test-class-two' };\n expect(mergeElementsAppearanceConfig(a, b)).toStrictEqual({ className: 'cl-test-class-one cl-test-class-two' });\n });\n\n it('merges a string and an object with style', () => {\n const a = 'cl-test-class-one';\n const b = { className: 'cl-test-class-two', backgroundColor: 'tomato' };\n expect(mergeElementsAppearanceConfig(a, b)).toStrictEqual({\n className: 'cl-test-class-two cl-test-class-one',\n backgroundColor: 'tomato',\n });\n });\n\n it('merges two objects with styles', () => {\n const a = { className: 'cl-test-class-one', color: 'red' };\n const b = { className: 'cl-test-class-two', backgroundColor: 'tomato' };\n expect(mergeElementsAppearanceConfig(a, b)).toStrictEqual({\n className: 'cl-test-class-one cl-test-class-two',\n color: 'red',\n backgroundColor: 'tomato',\n });\n });\n\n it('correctly omits className if not present', () => {\n const a = { color: 'red' };\n const b = { backgroundColor: 'tomato' };\n expect(mergeElementsAppearanceConfig(a, b)).toStrictEqual({\n color: 'red',\n backgroundColor: 'tomato',\n });\n });\n });\n\n describe('applyTheme', () => {\n it('adds classNames from theme', () => {\n const appearance = {\n elements: {\n alert__warning: 'cl-test-1',\n },\n };\n const theme = {\n ...fullTheme,\n alert__warning: { descriptor: 'test', className: 'cl-test-class', style: { color: 'red' } },\n };\n expect(applyTheme(theme, appearance)).toStrictEqual({\n theme,\n options: defaultAppearance.options,\n elements: {\n ...fullTheme,\n alert__warning: {\n className: 'cl-test-class cl-test-1',\n descriptor: 'test',\n style: { color: 'red' },\n },\n },\n });\n });\n });\n}\n","import * as React from 'react';\n\nimport {\n mergeDescriptors,\n type ParsedDescriptor,\n type ParsedElementsFragment,\n useAppearance,\n} from '~/contexts/AppearanceContext';\n\nimport ExclamationOctagonSm from './icons/exclamation-octagon-sm';\nimport ExclamationTriangleSm from './icons/exclamation-triangle-sm';\n\nexport const layoutStyle = {\n alert: {\n className: \"cl-fbddaa7d\",\n },\n alert__warning: {},\n alert__error: {},\n alertIcon: {\n className: \"cl-af4e251c\",\n },\n} satisfies ParsedElementsFragment;\n\nexport const visualStyle = {\n alert: {\n className: \"cl-15c02a47\",\n },\n alert__warning: {\n className: \"cl-a992fcfc\",\n },\n alert__error: {\n className: \"cl-66ef3405\",\n },\n alertIcon: {},\n} satisfies ParsedElementsFragment;\n\nexport const Alert = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement> & {\n intent?: 'warning' | 'error';\n descriptors?: ParsedDescriptor[];\n }\n>(function Alert({ children, descriptors, intent = 'error', ...props }, forwardedRef) {\n const { elements } = useAppearance().parsedAppearance;\n\n return (\n <div\n ref={forwardedRef}\n {...props}\n {...mergeDescriptors(\n elements.alert,\n intent === 'error' && elements.alert__error,\n intent === 'warning' && elements.alert__warning,\n ...(descriptors ?? []),\n )}\n >\n {\n {\n error: <ExclamationOctagonSm {...mergeDescriptors(elements.alertIcon)} />,\n warning: <ExclamationTriangleSm {...mergeDescriptors(elements.alertIcon)} />,\n }[intent]\n }\n {children}\n </div>\n );\n});\n","import * as React from 'react';\nimport { mergeProps } from 'react-aria';\n\nexport interface IconProps extends React.SVGProps<SVGSVGElement> {}\n\nexport const Icon = React.forwardRef<SVGSVGElement, IconProps & { children: React.ReactElement }>(\n function Icon(props, ref) {\n const { children, 'aria-label': ariaLabel, 'aria-hidden': ariaHidden, ...restProps } = props;\n return React.cloneElement(children, {\n ...mergeProps(children.props, restProps),\n ref,\n width: '1em',\n height: '1em',\n fill: 'none',\n focusable: 'false',\n 'aria-label': ariaLabel,\n 'aria-hidden': ariaLabel ? ariaHidden || undefined : true,\n role: 'img',\n });\n },\n);\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {useCallback, useEffect, useRef, useState} from 'react';\nimport {useLayoutEffect} from './useLayoutEffect';\nimport {useSSRSafeId} from '@react-aria/ssr';\nimport {useValueEffect} from './';\n\n// copied from SSRProvider.tsx to reduce exports, if needed again, consider sharing\nlet canUseDOM = Boolean(\n typeof window !== 'undefined' &&\n window.document &&\n window.document.createElement\n);\n\nlet idsUpdaterMap: Map<string, (v: string) => void> = new Map();\n\n/**\n * If a default is not provided, generate an id.\n * @param defaultId - Default component id.\n */\nexport function useId(defaultId?: string): string {\n let [value, setValue] = useState(defaultId);\n let nextId = useRef(null);\n\n let res = useSSRSafeId(value);\n\n let updateValue = useCallback((val) => {\n nextId.current = val;\n }, []);\n\n if (canUseDOM) {\n idsUpdaterMap.set(res, updateValue);\n }\n\n useLayoutEffect(() => {\n let r = res;\n return () => {\n idsUpdaterMap.delete(r);\n };\n }, [res]);\n\n // This cannot cause an infinite loop because the ref is updated first.\n // eslint-disable-next-line\n useEffect(() => {\n let newId = nextId.current;\n if (newId) {\n nextId.current = null;\n setValue(newId);\n }\n });\n\n return res;\n}\n\n/**\n * Merges two ids.\n * Different ids will trigger a side-effect and re-render components hooked up with `useId`.\n */\nexport function mergeIds(idA: string, idB: string): string {\n if (idA === idB) {\n return idA;\n }\n\n let setIdA = idsUpdaterMap.get(idA);\n if (setIdA) {\n setIdA(idB);\n return idB;\n }\n\n let setIdB = idsUpdaterMap.get(idB);\n if (setIdB) {\n setIdB(idA);\n return idA;\n }\n\n return idB;\n}\n\n/**\n * Used to generate an id, and after render, check if that id is rendered so we know\n * if we can use it in places such as labelledby.\n * @param depArray - When to recalculate if the id is in the DOM.\n */\nexport function useSlotId(depArray: ReadonlyArray<any> = []): string {\n let id = useId();\n let [resolvedId, setResolvedId] = useValueEffect(id);\n let updateId = useCallback(() => {\n setResolvedId(function *() {\n yield id;\n\n yield document.getElementById(id) ? id : undefined;\n });\n }, [id, setResolvedId]);\n\n useLayoutEffect(updateId, [id, updateId, ...depArray]);\n\n return resolvedId;\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n/**\n * Calls all functions in the order they were chained with the same arguments.\n */\nexport function chain(...callbacks: any[]): (...args: any[]) => void {\n return (...args: any[]) => {\n for (let callback of callbacks) {\n if (typeof callback === 'function') {\n callback(...args);\n }\n }\n };\n}\n","function r(e){var t,f,n=\"\";if(\"string\"==typeof e||\"number\"==typeof e)n+=e;else if(\"object\"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=\" \"),n+=f)}else for(f in e)e[f]&&(n&&(n+=\" \"),n+=f);return n}export function clsx(){for(var e,t,f=0,n=\"\",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=\" \"),n+=t);return n}export default clsx;","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {chain} from './chain';\nimport clsx from 'clsx';\nimport {mergeIds} from './useId';\n\ninterface Props {\n [key: string]: any\n}\n\ntype PropsArg = Props | null | undefined;\n\n// taken from: https://stackoverflow.com/questions/51603250/typescript-3-parameter-list-intersection-type/51604379#51604379\ntype TupleTypes<T> = { [P in keyof T]: T[P] } extends { [key: number]: infer V } ? NullToObject<V> : never;\ntype NullToObject<T> = T extends (null | undefined) ? {} : T;\n// eslint-disable-next-line no-undef, @typescript-eslint/no-unused-vars\ntype UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;\n\n/**\n * Merges multiple props objects together. Event handlers are chained,\n * classNames are combined, and ids are deduplicated - different ids\n * will trigger a side-effect and re-render components hooked up with `useId`.\n * For all other props, the last prop object overrides all previous ones.\n * @param args - Multiple sets of props to merge together.\n */\nexport function mergeProps<T extends PropsArg[]>(...args: T): UnionToIntersection<TupleTypes<T>> {\n // Start with a base clone of the first argument. This is a lot faster than starting\n // with an empty object and adding properties as we go.\n let result: Props = {...args[0]};\n for (let i = 1; i < args.length; i++) {\n let props = args[i];\n for (let key in props) {\n let a = result[key];\n let b = props[key];\n\n // Chain events\n if (\n typeof a === 'function' &&\n typeof b === 'function' &&\n // This is a lot faster than a regex.\n key[0] === 'o' &&\n key[1] === 'n' &&\n key.charCodeAt(2) >= /* 'A' */ 65 &&\n key.charCodeAt(2) <= /* 'Z' */ 90\n ) {\n result[key] = chain(a, b);\n\n // Merge classnames, sometimes classNames are empty string which eval to false, so we just need to do a type check\n } else if (\n (key === 'className' || key === 'UNSAFE_className') &&\n typeof a === 'string' &&\n typeof b === 'string'\n ) {\n result[key] = clsx(a, b);\n } else if (key === 'id' && a && b) {\n result.id = mergeIds(a, b);\n // Override others\n } else {\n result[key] = b !== undefined ? b : a;\n }\n }\n }\n\n return result as UnionToIntersection<TupleTypes<T>>;\n}\n","import { Icon, type IconProps } from './icon';\n\nexport default function ExclamationOctagonSm(props: IconProps) {\n return (\n <Icon {...props}>\n <svg viewBox='0 0 16 16'>\n <path\n d='M8 5.75V7.25'\n stroke='currentColor'\n strokeWidth='1.5'\n strokeLinecap='round'\n strokeLinejoin='round'\n />\n <path\n d='M8 10V10.01'\n stroke='currentColor'\n strokeWidth='1.5'\n strokeLinecap='round'\n strokeLinejoin='round'\n />\n <path\n d='M10.25 2.75H5.75L2.75 5.75V10.25L5.75 13.25H10.25L13.25 10.25V5.75L10.25 2.75Z'\n stroke='currentColor'\n strokeWidth='1.5'\n strokeLinecap='round'\n strokeLinejoin='round'\n />\n </svg>\n </Icon>\n );\n}\n","import { Icon, type IconProps } from './icon';\n\nexport default function ExclamationTriangleSm(props: IconProps) {\n return (\n <Icon {...props}>\n <svg viewBox='0 0 16 16'>\n <path\n d='M8 6.75V8.25'\n stroke='currentColor'\n strokeWidth='1.5'\n strokeLinecap='round'\n strokeLinejoin='round'\n />\n <path\n d='M8 10.5V10.51'\n stroke='currentColor'\n strokeWidth='1.5'\n strokeLinecap='round'\n strokeLinejoin='round'\n />\n <path\n d='M2.95652 10.4518L6.27146 3.8188C6.98366 2.39373 9.01635 2.39373 9.72855 3.81881L13.0435 10.4518C13.686 11.7374 12.7516 13.25 11.3149 13.25H4.68506C3.24842 13.25 2.31404 11.7374 2.95652 10.4518Z'\n stroke='currentColor'\n strokeWidth='1.5'\n strokeLinecap='round'\n strokeLinejoin='round'\n />\n </svg>\n </Icon>\n );\n}\n","import * as React from 'react';\n\nimport {\n mergeDescriptors,\n type ParsedDescriptor,\n type ParsedElementsFragment,\n useAppearance,\n} from '~/contexts/AppearanceContext';\n\nexport const layoutStyle = {\n separator: {\n className: \"cl-c53048bf\",\n },\n} satisfies ParsedElementsFragment;\n\nexport const visualStyle = {\n separator: {\n className: \"cl-77b14b2e\",\n },\n} satisfies ParsedElementsFragment;\n\nexport const Separator = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement> & {\n descriptors?: ParsedDescriptor[];\n }\n>(function Separator({ children, descriptors, ...props }, forwardedRef) {\n const { elements } = useAppearance().parsedAppearance;\n return (\n <div\n ref={forwardedRef}\n {...props}\n {...mergeDescriptors(elements.separator, ...(descriptors ?? []))}\n >\n {children}\n </div>\n );\n});\n","import type { PartialTheme, ParsedElements } from '~/contexts/AppearanceContext';\n\n/**\n * Given a complete theme object minus descriptors, returns a full ParsedElements object with generated descriptors.\n */\nexport function buildTheme(p: PartialTheme): ParsedElements {\n const theme: Partial<ParsedElements> = {};\n\n for (const descriptor in p) {\n if (p[descriptor as keyof PartialTheme]) {\n const { className, style } = p[descriptor as keyof PartialTheme]!;\n theme[descriptor as keyof ParsedElements] = {\n descriptor: `cl-${descriptor}`,\n className: className ?? '',\n style: style ?? {},\n };\n }\n }\n\n return theme as ParsedElements;\n}\n\n/**\n * Given two complete theme objects, merge their className and style properties to create a new merged theme.\n */\nexport function mergeTheme(a: ParsedElements, b: ParsedElements): ParsedElements {\n const mergedTheme = { ...a };\n\n for (const d in mergedTheme) {\n const descriptor = d as keyof ParsedElements;\n mergedTheme[descriptor].className = [mergedTheme[descriptor].className, b[descriptor].className].join(' ');\n mergedTheme[descriptor].style = { ...mergedTheme[descriptor].style, ...b[descriptor].style };\n }\n\n return mergedTheme;\n}\n","import { layoutStyle as alertLayoutStyle } from '~/primitives/alert';\nimport { layoutStyle as separatorStyle } from '~/primitives/separator';\n\nimport { buildTheme } from './buildTheme';\n\nexport const layoutTheme = buildTheme({ ...alertLayoutStyle, ...separatorStyle });\n","import { visualStyle as alertVisualStyle } from '~/primitives/alert';\nimport { visualStyle as separatorVisualStyle } from '~/primitives/separator';\n\nimport { buildTheme, mergeTheme } from './buildTheme';\nimport { layoutTheme } from './layout';\n\nconst visualTheme = buildTheme({ ...alertVisualStyle, ...separatorVisualStyle });\nexport const fullTheme = mergeTheme(layoutTheme, visualTheme);\n"]}
|