@jack.winter/pancake-ui 0.0.0-stage → 0.1.1
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/CHANGELOG.md +73 -0
- package/LICENSE +21 -0
- package/README.md +93 -2
- package/dist/components/Button/Button.d.ts +7 -0
- package/dist/components/Button/ButtonLink.d.ts +8 -0
- package/dist/components/Button/IconButton.d.ts +7 -0
- package/dist/components/Checkbox/Checkbox.d.ts +6 -0
- package/dist/components/Dialog/Dialog.d.ts +9 -0
- package/dist/components/Disclosure/Disclosure.d.ts +17 -0
- package/dist/components/DropdownMenu/DropdownMenu.d.ts +25 -0
- package/dist/components/DropdownMenu/menuKeyboard.d.ts +3 -0
- package/dist/components/FileField/FileField.d.ts +7 -0
- package/dist/components/Pagination/Pagination.d.ts +22 -0
- package/dist/components/Pagination/paginationPages.d.ts +5 -0
- package/dist/components/Popover/Popover.d.ts +7 -0
- package/dist/components/RadioGroup/RadioGroup.d.ts +18 -0
- package/dist/components/Select/Select.d.ts +9 -0
- package/dist/components/Surface/Surface.d.ts +3 -0
- package/dist/components/Switch/Switch.d.ts +6 -0
- package/dist/components/Table/Table.d.ts +6 -0
- package/dist/components/Tabs/Tabs.d.ts +17 -0
- package/dist/components/TextField/TextField.d.ts +8 -0
- package/dist/components/Textarea/Textarea.d.ts +7 -0
- package/dist/components/Tooltip/Tooltip.d.ts +7 -0
- package/dist/components/Tooltip/useTooltip.d.ts +12 -0
- package/dist/components/feedback/BannerToast.d.ts +8 -0
- package/dist/components/feedback/EmptyState.d.ts +8 -0
- package/dist/components/feedback/StatusChip.d.ts +6 -0
- package/dist/components/identity/Avatar.d.ts +9 -0
- package/dist/components/identity/AvatarGroup.d.ts +13 -0
- package/dist/components/layout/Inline.d.ts +5 -0
- package/dist/components/layout/Stack.d.ts +10 -0
- package/dist/components/layout/Text.d.ts +8 -0
- package/dist/components/layout/layout.shared.d.ts +16 -0
- package/dist/components/navigation/AppHeader.d.ts +11 -0
- package/dist/components/navigation/BottomNavigation.d.ts +12 -0
- package/dist/components/navigation/SectionHeader.d.ts +11 -0
- package/dist/components/navigation/SegmentedControl.d.ts +15 -0
- package/dist/components/navigation/StepProgress.d.ts +6 -0
- package/dist/components/progress/LoadingIndicator.d.ts +5 -0
- package/dist/components/progress/Progress.d.ts +8 -0
- package/dist/fonts/Inter-Bold.ttf +0 -0
- package/dist/fonts/Inter-Regular.ttf +0 -0
- package/dist/fonts/Inter-SemiBold.ttf +0 -0
- package/dist/fonts/OFL.txt +92 -0
- package/dist/fonts/inter-4.1.provenance.json +41 -0
- package/dist/fonts.css +21 -0
- package/dist/foundations/tokens.d.ts +168 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.js +1121 -0
- package/dist/styles.css +3 -0
- package/dist/theme.css +97 -0
- package/docs/components.md +182 -0
- package/docs/installation.md +145 -0
- package/docs/styling.md +92 -0
- package/docs/verification.md +80 -0
- package/package.json +107 -4
package/dist/index.js
ADDED
|
@@ -0,0 +1,1121 @@
|
|
|
1
|
+
import { Fragment as e, jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
2
|
+
import { cloneElement as r, createElement as i, useEffect as a, useId as o, useImperativeHandle as s, useLayoutEffect as c, useRef as l, useState as u } from "react";
|
|
3
|
+
// src/foundations/tokens.ts
|
|
4
|
+
var d = Object.freeze({
|
|
5
|
+
accent: "#ade533",
|
|
6
|
+
accentDisabledLayer: "rgba(173, 229, 51, 0.8)",
|
|
7
|
+
border: "#edede8",
|
|
8
|
+
canvas: "#fbf8f0",
|
|
9
|
+
controlBorder: "#7e8c70",
|
|
10
|
+
controlFocus: "#647a45",
|
|
11
|
+
errorStrong: "#a34c3e",
|
|
12
|
+
danger: "#ffd6d6",
|
|
13
|
+
dangerHover: "#ffc2c2",
|
|
14
|
+
deep: "#384540",
|
|
15
|
+
info: "#d6edfa",
|
|
16
|
+
ink: "#0e1716",
|
|
17
|
+
muted: "#636b6e",
|
|
18
|
+
olive: "#636657",
|
|
19
|
+
surface: "#ffffff",
|
|
20
|
+
surfaceAccent: "#d1f28a",
|
|
21
|
+
surfaceMuted: "#f0f0eb",
|
|
22
|
+
textSecondary: "#3b4742",
|
|
23
|
+
transparent: "transparent",
|
|
24
|
+
warning: "#ffeb9e",
|
|
25
|
+
focusRing: "#ADE533"
|
|
26
|
+
}), f = Object.freeze({
|
|
27
|
+
space0: 0,
|
|
28
|
+
space12: 12,
|
|
29
|
+
space16: 16,
|
|
30
|
+
space20: 20,
|
|
31
|
+
space24: 24,
|
|
32
|
+
space32: 32,
|
|
33
|
+
space4: 4,
|
|
34
|
+
space40: 40,
|
|
35
|
+
space8: 8
|
|
36
|
+
}), p = Object.freeze({
|
|
37
|
+
radius12: 12,
|
|
38
|
+
radius16: 16,
|
|
39
|
+
radius20: 20,
|
|
40
|
+
radius28: 28,
|
|
41
|
+
radius36: 36,
|
|
42
|
+
radius8: 8,
|
|
43
|
+
radiusFull: 999
|
|
44
|
+
}), m = Object.freeze({
|
|
45
|
+
size0: 0,
|
|
46
|
+
size4: 4,
|
|
47
|
+
size8: 8,
|
|
48
|
+
size12: 12,
|
|
49
|
+
size16: 16,
|
|
50
|
+
size20: 20,
|
|
51
|
+
size24: 24,
|
|
52
|
+
size28: 28,
|
|
53
|
+
size32: 32,
|
|
54
|
+
size36: 36,
|
|
55
|
+
size40: 40,
|
|
56
|
+
size44: 44,
|
|
57
|
+
size48: 48,
|
|
58
|
+
size52: 52,
|
|
59
|
+
size56: 56,
|
|
60
|
+
size64: 64,
|
|
61
|
+
size72: 72,
|
|
62
|
+
size76: 76,
|
|
63
|
+
size80: 80,
|
|
64
|
+
size88: 88,
|
|
65
|
+
size92: 92,
|
|
66
|
+
size104: 104,
|
|
67
|
+
size112: 112,
|
|
68
|
+
size320: 320,
|
|
69
|
+
size560: 560
|
|
70
|
+
}), h = Object.freeze({
|
|
71
|
+
borderDefault: 1,
|
|
72
|
+
focusRingWidth: 2
|
|
73
|
+
}), g = Object.freeze({
|
|
74
|
+
opacityDisabled: .4,
|
|
75
|
+
opacityOverlay: .5
|
|
76
|
+
}), _ = (e) => Object.freeze(e), v = Object.freeze({
|
|
77
|
+
body: _({
|
|
78
|
+
fontFamily: "Inter, sans-serif",
|
|
79
|
+
fontSize: 14,
|
|
80
|
+
fontWeight: "400",
|
|
81
|
+
fontStyle: "normal",
|
|
82
|
+
lineHeight: "16.8px",
|
|
83
|
+
letterSpacing: 0
|
|
84
|
+
}),
|
|
85
|
+
bodyStrong: _({
|
|
86
|
+
fontFamily: "Inter, sans-serif",
|
|
87
|
+
fontSize: 15,
|
|
88
|
+
fontWeight: "600",
|
|
89
|
+
fontStyle: "normal",
|
|
90
|
+
lineHeight: "18px",
|
|
91
|
+
letterSpacing: 0
|
|
92
|
+
}),
|
|
93
|
+
caption: _({
|
|
94
|
+
fontFamily: "Inter, sans-serif",
|
|
95
|
+
fontSize: 11,
|
|
96
|
+
fontWeight: "400",
|
|
97
|
+
fontStyle: "normal",
|
|
98
|
+
lineHeight: "13.2px",
|
|
99
|
+
letterSpacing: 0
|
|
100
|
+
}),
|
|
101
|
+
display: _({
|
|
102
|
+
fontFamily: "Inter, sans-serif",
|
|
103
|
+
fontSize: 28,
|
|
104
|
+
fontWeight: "700",
|
|
105
|
+
fontStyle: "normal",
|
|
106
|
+
lineHeight: "33.6px",
|
|
107
|
+
letterSpacing: 0
|
|
108
|
+
}),
|
|
109
|
+
heading: _({
|
|
110
|
+
fontFamily: "Inter, sans-serif",
|
|
111
|
+
fontSize: 18,
|
|
112
|
+
fontWeight: "700",
|
|
113
|
+
fontStyle: "normal",
|
|
114
|
+
lineHeight: "21.6px",
|
|
115
|
+
letterSpacing: 0
|
|
116
|
+
}),
|
|
117
|
+
label: _({
|
|
118
|
+
fontFamily: "Inter, sans-serif",
|
|
119
|
+
fontSize: 12,
|
|
120
|
+
fontWeight: "600",
|
|
121
|
+
fontStyle: "normal",
|
|
122
|
+
lineHeight: "14.4px",
|
|
123
|
+
letterSpacing: 0
|
|
124
|
+
}),
|
|
125
|
+
micro: _({
|
|
126
|
+
fontFamily: "Inter, sans-serif",
|
|
127
|
+
fontSize: 10,
|
|
128
|
+
fontWeight: "600",
|
|
129
|
+
fontStyle: "normal",
|
|
130
|
+
lineHeight: "12px",
|
|
131
|
+
letterSpacing: 0
|
|
132
|
+
}),
|
|
133
|
+
section: _({
|
|
134
|
+
fontFamily: "Inter, sans-serif",
|
|
135
|
+
fontSize: 20,
|
|
136
|
+
fontWeight: "700",
|
|
137
|
+
fontStyle: "normal",
|
|
138
|
+
lineHeight: "24px",
|
|
139
|
+
letterSpacing: 0
|
|
140
|
+
}),
|
|
141
|
+
title: _({
|
|
142
|
+
fontFamily: "Inter, sans-serif",
|
|
143
|
+
fontSize: 25,
|
|
144
|
+
fontWeight: "700",
|
|
145
|
+
fontStyle: "normal",
|
|
146
|
+
lineHeight: "30px",
|
|
147
|
+
letterSpacing: 0
|
|
148
|
+
})
|
|
149
|
+
});
|
|
150
|
+
// src/components/Surface/Surface.tsx
|
|
151
|
+
function y({ className: e = "", ...n }) {
|
|
152
|
+
return /* @__PURE__ */ t("div", {
|
|
153
|
+
className: `pancake-surface ${e}`,
|
|
154
|
+
...n
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
// src/components/Button/Button.tsx
|
|
158
|
+
function b({ variant: e = "primary", size: r = 48, loading: i = !1, disabled: a = !1, type: o = "button", className: s = "", children: c, ...l }) {
|
|
159
|
+
return /* @__PURE__ */ n("button", {
|
|
160
|
+
...l,
|
|
161
|
+
type: o,
|
|
162
|
+
disabled: a || i,
|
|
163
|
+
"aria-busy": i || l["aria-busy"],
|
|
164
|
+
className: `pancake-button pancake-button--${e} pancake-button--${r} ${s}`,
|
|
165
|
+
children: [i ? /* @__PURE__ */ t("span", {
|
|
166
|
+
"aria-hidden": "true",
|
|
167
|
+
children: "•••"
|
|
168
|
+
}) : null, c]
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
// src/components/Checkbox/Checkbox.tsx
|
|
172
|
+
function x({ label: e, onCheckedChange: r, onChange: i, id: a, className: s = "", ...c }) {
|
|
173
|
+
let l = o(), u = a ?? l;
|
|
174
|
+
return /* @__PURE__ */ n("label", {
|
|
175
|
+
className: "pancake-checkbox-label",
|
|
176
|
+
htmlFor: u,
|
|
177
|
+
children: [/* @__PURE__ */ t("input", {
|
|
178
|
+
...c,
|
|
179
|
+
id: u,
|
|
180
|
+
type: "checkbox",
|
|
181
|
+
className: `pancake-checkbox ${s}`,
|
|
182
|
+
onChange: (e) => {
|
|
183
|
+
i?.(e), r?.(e.currentTarget.checked);
|
|
184
|
+
}
|
|
185
|
+
}), /* @__PURE__ */ t("span", { children: e })]
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
// src/components/TextField/TextField.tsx
|
|
189
|
+
function S({ label: e, type: r = "text", helperText: i, error: a, id: s, className: c = "", required: l, "aria-describedby": u, "aria-invalid": d, ...f }) {
|
|
190
|
+
let p = o(), m = s ?? p, h = `${p}-description`, g = a || i;
|
|
191
|
+
return /* @__PURE__ */ n("div", {
|
|
192
|
+
className: "pancake-field",
|
|
193
|
+
children: [
|
|
194
|
+
/* @__PURE__ */ n("label", {
|
|
195
|
+
className: "pancake-field-label",
|
|
196
|
+
htmlFor: m,
|
|
197
|
+
children: [e, l && /* @__PURE__ */ t("span", {
|
|
198
|
+
"aria-hidden": "true",
|
|
199
|
+
children: " *"
|
|
200
|
+
})]
|
|
201
|
+
}),
|
|
202
|
+
/* @__PURE__ */ t("input", {
|
|
203
|
+
...f,
|
|
204
|
+
id: m,
|
|
205
|
+
type: r,
|
|
206
|
+
required: l,
|
|
207
|
+
"aria-invalid": a ? !0 : d,
|
|
208
|
+
"aria-describedby": [u, g ? h : void 0].filter(Boolean).join(" ") || void 0,
|
|
209
|
+
className: `pancake-field-input ${c}`
|
|
210
|
+
}),
|
|
211
|
+
g && /* @__PURE__ */ t("p", {
|
|
212
|
+
id: h,
|
|
213
|
+
className: "pancake-field-description",
|
|
214
|
+
"aria-live": a ? "assertive" : "polite",
|
|
215
|
+
children: g
|
|
216
|
+
})
|
|
217
|
+
]
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
// src/components/layout/layout.shared.ts
|
|
221
|
+
var C = {
|
|
222
|
+
start: "flex-start",
|
|
223
|
+
center: "center",
|
|
224
|
+
end: "flex-end",
|
|
225
|
+
stretch: "stretch"
|
|
226
|
+
}, w = {
|
|
227
|
+
start: "flex-start",
|
|
228
|
+
center: "center",
|
|
229
|
+
end: "flex-end",
|
|
230
|
+
"space-between": "space-between"
|
|
231
|
+
}, T = (e) => `var(--spacing-pancake-${f[e]})`;
|
|
232
|
+
// src/components/layout/Stack.tsx
|
|
233
|
+
function E({ gap: e = "space16", padding: n, align: r = "stretch", justify: i = "start", className: a = "", style: o, ...s }) {
|
|
234
|
+
return /* @__PURE__ */ t("div", {
|
|
235
|
+
...s,
|
|
236
|
+
className: `pancake-stack ${a}`,
|
|
237
|
+
style: {
|
|
238
|
+
gap: T(e),
|
|
239
|
+
padding: n ? T(n) : void 0,
|
|
240
|
+
alignItems: C[r],
|
|
241
|
+
justifyContent: w[i],
|
|
242
|
+
...o
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
// src/components/layout/Inline.tsx
|
|
247
|
+
function D({ gap: e = "space12", padding: n, align: r = "center", justify: i = "start", wrap: a = !0, className: o = "", style: s, ...c }) {
|
|
248
|
+
return /* @__PURE__ */ t("div", {
|
|
249
|
+
...c,
|
|
250
|
+
className: `pancake-inline ${o}`,
|
|
251
|
+
style: {
|
|
252
|
+
gap: T(e),
|
|
253
|
+
padding: n ? T(n) : void 0,
|
|
254
|
+
alignItems: C[r],
|
|
255
|
+
justifyContent: w[i],
|
|
256
|
+
flexWrap: a ? "wrap" : "nowrap",
|
|
257
|
+
...s
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
// src/components/layout/Text.tsx
|
|
262
|
+
var O = (e) => e.replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`);
|
|
263
|
+
function k({ as: e = "span", variant: t = "body", color: n = "ink", className: r = "", style: a, ...o }) {
|
|
264
|
+
let s = `--text-pancake-${O(t)}`, c = {
|
|
265
|
+
fontFamily: "var(--font-pancake)",
|
|
266
|
+
fontSize: `var(${s})`,
|
|
267
|
+
lineHeight: `var(${s}--line-height)`,
|
|
268
|
+
fontWeight: `var(${s}--font-weight)`,
|
|
269
|
+
letterSpacing: `var(${s}--letter-spacing)`,
|
|
270
|
+
color: `var(--color-pancake-${O(n)})`,
|
|
271
|
+
...a
|
|
272
|
+
};
|
|
273
|
+
return i(e, {
|
|
274
|
+
...o,
|
|
275
|
+
className: `pancake-text ${r}`,
|
|
276
|
+
style: c
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
// src/components/identity/Avatar.tsx
|
|
280
|
+
function A(e) {
|
|
281
|
+
return e.trim().split(/\s+/).filter(Boolean).slice(0, 2).map((e) => Array.from(e)[0]).join("").toLocaleUpperCase() || "?";
|
|
282
|
+
}
|
|
283
|
+
function j({ src: e, name: n }) {
|
|
284
|
+
let [r, i] = u(!1);
|
|
285
|
+
return r ? A(n) : /* @__PURE__ */ t("img", {
|
|
286
|
+
src: e,
|
|
287
|
+
alt: "",
|
|
288
|
+
onError: () => i(!0)
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
function M({ name: e, src: n, size: r = 40, decorative: i = !1, className: a = "", style: o, ...s }) {
|
|
292
|
+
return /* @__PURE__ */ t("span", {
|
|
293
|
+
...s,
|
|
294
|
+
className: `pancake-avatar ${a}`,
|
|
295
|
+
style: {
|
|
296
|
+
width: `var(--spacing-pancake-${r})`,
|
|
297
|
+
height: `var(--spacing-pancake-${r})`,
|
|
298
|
+
...o
|
|
299
|
+
},
|
|
300
|
+
role: i ? void 0 : "img",
|
|
301
|
+
"aria-label": i ? void 0 : e,
|
|
302
|
+
"aria-hidden": i || void 0,
|
|
303
|
+
children: n ? /* @__PURE__ */ t(j, {
|
|
304
|
+
src: n,
|
|
305
|
+
name: e
|
|
306
|
+
}, n) : A(e)
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
// src/components/identity/AvatarGroup.tsx
|
|
310
|
+
function N({ items: e, max: r = 4, size: i = 40, className: a = "", "aria-label": o = "People", ...s }) {
|
|
311
|
+
if (!Number.isInteger(r) || r < 1) throw RangeError("AvatarGroup max must be a positive integer.");
|
|
312
|
+
let c = e.slice(0, r), l = e.slice(r);
|
|
313
|
+
return /* @__PURE__ */ n("ul", {
|
|
314
|
+
...s,
|
|
315
|
+
"aria-label": o,
|
|
316
|
+
className: `pancake-avatar-group ${a}`,
|
|
317
|
+
children: [c.map((e) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(M, {
|
|
318
|
+
name: e.name,
|
|
319
|
+
src: e.src,
|
|
320
|
+
size: i
|
|
321
|
+
}) }, e.id)), l.length > 0 && /* @__PURE__ */ t("li", { children: /* @__PURE__ */ n("span", {
|
|
322
|
+
className: "pancake-avatar pancake-avatar-overflow",
|
|
323
|
+
style: {
|
|
324
|
+
width: `var(--spacing-pancake-${i})`,
|
|
325
|
+
height: `var(--spacing-pancake-${i})`
|
|
326
|
+
},
|
|
327
|
+
role: "img",
|
|
328
|
+
"aria-label": `${l.length} more: ${l.map((e) => e.name).join(", ")}`,
|
|
329
|
+
children: ["+", l.length]
|
|
330
|
+
}) })]
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
// src/components/feedback/StatusChip.tsx
|
|
334
|
+
function P({ tone: e = "neutral", className: n = "", ...r }) {
|
|
335
|
+
return /* @__PURE__ */ t("span", {
|
|
336
|
+
...r,
|
|
337
|
+
className: `pancake-status-chip pancake-tone-${e} ${n}`
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
// src/components/feedback/BannerToast.tsx
|
|
341
|
+
function ee({ title: e, children: r, tone: i = "info", onDismiss: a, dismissLabel: o = "Dismiss notification", className: s = "", ...c }) {
|
|
342
|
+
return /* @__PURE__ */ n("div", {
|
|
343
|
+
...c,
|
|
344
|
+
role: i === "error" ? "alert" : "status",
|
|
345
|
+
"aria-live": i === "error" ? "assertive" : "polite",
|
|
346
|
+
"aria-atomic": "true",
|
|
347
|
+
className: `pancake-banner pancake-tone-${i === "error" ? "danger" : i} ${s}`,
|
|
348
|
+
children: [/* @__PURE__ */ n("div", {
|
|
349
|
+
className: "pancake-banner-copy",
|
|
350
|
+
children: [/* @__PURE__ */ t("strong", {
|
|
351
|
+
className: "pancake-banner-title",
|
|
352
|
+
children: e
|
|
353
|
+
}), r && /* @__PURE__ */ t("div", {
|
|
354
|
+
className: "pancake-banner-description",
|
|
355
|
+
children: r
|
|
356
|
+
})]
|
|
357
|
+
}), a && /* @__PURE__ */ t("button", {
|
|
358
|
+
type: "button",
|
|
359
|
+
className: "pancake-banner-dismiss",
|
|
360
|
+
"aria-label": o,
|
|
361
|
+
onClick: a,
|
|
362
|
+
children: /* @__PURE__ */ t("span", {
|
|
363
|
+
"aria-hidden": "true",
|
|
364
|
+
children: "×"
|
|
365
|
+
})
|
|
366
|
+
})]
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
// src/components/feedback/EmptyState.tsx
|
|
370
|
+
function te({ title: e, description: r, icon: i, action: a, className: o = "", ...s }) {
|
|
371
|
+
return /* @__PURE__ */ n("div", {
|
|
372
|
+
...s,
|
|
373
|
+
className: `pancake-empty-state ${o}`,
|
|
374
|
+
children: [
|
|
375
|
+
i && /* @__PURE__ */ t("div", {
|
|
376
|
+
className: "pancake-empty-icon",
|
|
377
|
+
"aria-hidden": "true",
|
|
378
|
+
children: i
|
|
379
|
+
}),
|
|
380
|
+
/* @__PURE__ */ t("h3", {
|
|
381
|
+
className: "pancake-empty-title",
|
|
382
|
+
children: e
|
|
383
|
+
}),
|
|
384
|
+
r && /* @__PURE__ */ t("div", {
|
|
385
|
+
className: "pancake-empty-description",
|
|
386
|
+
children: r
|
|
387
|
+
}),
|
|
388
|
+
a && /* @__PURE__ */ t("div", {
|
|
389
|
+
className: "pancake-empty-action",
|
|
390
|
+
children: a
|
|
391
|
+
})
|
|
392
|
+
]
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
// src/components/navigation/SectionHeader.tsx
|
|
396
|
+
function ne({ title: e, description: r, action: i, headingLevel: a = 2, className: o = "", ...s }) {
|
|
397
|
+
let c = `h${a}`;
|
|
398
|
+
return /* @__PURE__ */ n("div", {
|
|
399
|
+
...s,
|
|
400
|
+
className: `pancake-section-header ${o}`,
|
|
401
|
+
children: [/* @__PURE__ */ n("div", {
|
|
402
|
+
className: "pancake-header-copy",
|
|
403
|
+
children: [/* @__PURE__ */ t(c, {
|
|
404
|
+
className: "pancake-section-title",
|
|
405
|
+
children: e
|
|
406
|
+
}), r && /* @__PURE__ */ t("p", {
|
|
407
|
+
className: "pancake-header-description",
|
|
408
|
+
children: r
|
|
409
|
+
})]
|
|
410
|
+
}), i && /* @__PURE__ */ t("div", {
|
|
411
|
+
className: "pancake-header-action",
|
|
412
|
+
children: i
|
|
413
|
+
})]
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
// src/components/navigation/AppHeader.tsx
|
|
417
|
+
function F({ title: e, description: r, leading: i, trailing: a, className: o = "", ...s }) {
|
|
418
|
+
return /* @__PURE__ */ n("header", {
|
|
419
|
+
...s,
|
|
420
|
+
className: `pancake-app-header ${o}`,
|
|
421
|
+
children: [
|
|
422
|
+
i && /* @__PURE__ */ t("div", {
|
|
423
|
+
className: "pancake-header-action",
|
|
424
|
+
children: i
|
|
425
|
+
}),
|
|
426
|
+
/* @__PURE__ */ n("div", {
|
|
427
|
+
className: "pancake-header-copy",
|
|
428
|
+
children: [/* @__PURE__ */ t("h1", {
|
|
429
|
+
className: "pancake-app-title",
|
|
430
|
+
children: e
|
|
431
|
+
}), r && /* @__PURE__ */ t("p", {
|
|
432
|
+
className: "pancake-header-description",
|
|
433
|
+
children: r
|
|
434
|
+
})]
|
|
435
|
+
}),
|
|
436
|
+
a && /* @__PURE__ */ t("div", {
|
|
437
|
+
className: "pancake-header-action",
|
|
438
|
+
children: a
|
|
439
|
+
})
|
|
440
|
+
]
|
|
441
|
+
});
|
|
442
|
+
}
|
|
443
|
+
// src/components/navigation/BottomNavigation.tsx
|
|
444
|
+
function I({ items: e, activeId: r, className: i = "", "aria-label": a = "Main navigation", ...o }) {
|
|
445
|
+
return /* @__PURE__ */ t("nav", {
|
|
446
|
+
...o,
|
|
447
|
+
"aria-label": a,
|
|
448
|
+
className: `pancake-bottom-navigation ${i}`,
|
|
449
|
+
children: /* @__PURE__ */ t("ul", { children: e.map((e) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ n("a", {
|
|
450
|
+
href: e.href,
|
|
451
|
+
"aria-current": e.id === r ? "page" : void 0,
|
|
452
|
+
children: [e.icon && /* @__PURE__ */ t("span", {
|
|
453
|
+
"aria-hidden": "true",
|
|
454
|
+
children: e.icon
|
|
455
|
+
}), /* @__PURE__ */ t("span", { children: e.label })]
|
|
456
|
+
}) }, e.id)) })
|
|
457
|
+
});
|
|
458
|
+
}
|
|
459
|
+
// src/components/navigation/SegmentedControl.tsx
|
|
460
|
+
function L({ label: e, options: r, value: i, defaultValue: a, onValueChange: s, name: c, disabled: l, required: u, className: d = "", ...f }) {
|
|
461
|
+
let p = o();
|
|
462
|
+
return /* @__PURE__ */ n("fieldset", {
|
|
463
|
+
...f,
|
|
464
|
+
disabled: l,
|
|
465
|
+
className: `pancake-segmented-control ${d}`,
|
|
466
|
+
children: [/* @__PURE__ */ t("legend", { children: e }), /* @__PURE__ */ t("div", {
|
|
467
|
+
className: "pancake-segments",
|
|
468
|
+
children: r.map((e) => /* @__PURE__ */ n("label", {
|
|
469
|
+
className: "pancake-segment",
|
|
470
|
+
children: [/* @__PURE__ */ t("input", {
|
|
471
|
+
type: "radio",
|
|
472
|
+
form: f.form,
|
|
473
|
+
name: c ?? p,
|
|
474
|
+
value: e.value,
|
|
475
|
+
disabled: e.disabled,
|
|
476
|
+
required: u,
|
|
477
|
+
checked: i === void 0 ? void 0 : i === e.value,
|
|
478
|
+
defaultChecked: i === void 0 ? a === e.value : void 0,
|
|
479
|
+
onChange: (t) => {
|
|
480
|
+
t.currentTarget.checked && s?.(e.value);
|
|
481
|
+
}
|
|
482
|
+
}), /* @__PURE__ */ t("span", { children: e.label })]
|
|
483
|
+
}, e.value))
|
|
484
|
+
})]
|
|
485
|
+
});
|
|
486
|
+
}
|
|
487
|
+
// src/components/navigation/StepProgress.tsx
|
|
488
|
+
function R({ steps: e, currentStep: r, className: i = "", "aria-label": a = "Progress", ...o }) {
|
|
489
|
+
if (!Number.isInteger(r) || r < 0 || r > e.length || e.length === 0) throw Error("StepProgress requires steps and a currentStep from 0 through steps.length (complete).");
|
|
490
|
+
return /* @__PURE__ */ t("ol", {
|
|
491
|
+
...o,
|
|
492
|
+
"aria-label": a,
|
|
493
|
+
className: `pancake-step-progress ${i}`,
|
|
494
|
+
children: e.map((e, i) => /* @__PURE__ */ n("li", {
|
|
495
|
+
"aria-current": r === i ? "step" : void 0,
|
|
496
|
+
"data-complete": i < r || void 0,
|
|
497
|
+
children: [/* @__PURE__ */ t("span", {
|
|
498
|
+
className: "pancake-step-number",
|
|
499
|
+
"aria-hidden": "true",
|
|
500
|
+
children: i < r ? "✓" : i + 1
|
|
501
|
+
}), /* @__PURE__ */ n("span", { children: [e, i < r && /* @__PURE__ */ t("span", {
|
|
502
|
+
className: "pancake-navigation-sr-only",
|
|
503
|
+
children: " (complete)"
|
|
504
|
+
})] })]
|
|
505
|
+
}, `${i}-${e}`))
|
|
506
|
+
});
|
|
507
|
+
}
|
|
508
|
+
// src/components/Textarea/Textarea.tsx
|
|
509
|
+
function z({ label: e, rows: r = 4, helperText: i, error: a, id: s, className: c = "", required: l, "aria-describedby": u, "aria-invalid": d, ...f }) {
|
|
510
|
+
let p = o(), m = s ?? p, h = `${p}-description`, g = a || i;
|
|
511
|
+
return /* @__PURE__ */ n("div", {
|
|
512
|
+
className: "pancake-field",
|
|
513
|
+
children: [
|
|
514
|
+
/* @__PURE__ */ n("label", {
|
|
515
|
+
className: "pancake-field-label",
|
|
516
|
+
htmlFor: m,
|
|
517
|
+
children: [e, l && /* @__PURE__ */ t("span", {
|
|
518
|
+
"aria-hidden": "true",
|
|
519
|
+
children: " *"
|
|
520
|
+
})]
|
|
521
|
+
}),
|
|
522
|
+
/* @__PURE__ */ t("textarea", {
|
|
523
|
+
...f,
|
|
524
|
+
id: m,
|
|
525
|
+
rows: r,
|
|
526
|
+
required: l,
|
|
527
|
+
"aria-invalid": a ? !0 : d,
|
|
528
|
+
"aria-describedby": [u, g ? h : void 0].filter(Boolean).join(" ") || void 0,
|
|
529
|
+
className: `pancake-field-input pancake-textarea ${c}`
|
|
530
|
+
}),
|
|
531
|
+
g && /* @__PURE__ */ t("p", {
|
|
532
|
+
id: h,
|
|
533
|
+
className: "pancake-field-description",
|
|
534
|
+
"aria-live": a ? "assertive" : "polite",
|
|
535
|
+
children: g
|
|
536
|
+
})
|
|
537
|
+
]
|
|
538
|
+
});
|
|
539
|
+
}
|
|
540
|
+
// src/components/Select/Select.tsx
|
|
541
|
+
function B({ label: e, helperText: r, error: i, id: a, className: s = "", required: c, "aria-describedby": l, "aria-invalid": u, ...d }) {
|
|
542
|
+
let f = o(), p = a ?? f, m = `${f}-description`, h = i || r;
|
|
543
|
+
return /* @__PURE__ */ n("div", {
|
|
544
|
+
className: "pancake-field",
|
|
545
|
+
children: [
|
|
546
|
+
/* @__PURE__ */ n("label", {
|
|
547
|
+
className: "pancake-field-label",
|
|
548
|
+
htmlFor: p,
|
|
549
|
+
children: [e, c && /* @__PURE__ */ t("span", {
|
|
550
|
+
"aria-hidden": "true",
|
|
551
|
+
children: " *"
|
|
552
|
+
})]
|
|
553
|
+
}),
|
|
554
|
+
/* @__PURE__ */ n("div", {
|
|
555
|
+
className: "pancake-select-control",
|
|
556
|
+
children: [/* @__PURE__ */ t("select", {
|
|
557
|
+
...d,
|
|
558
|
+
id: p,
|
|
559
|
+
required: c,
|
|
560
|
+
"aria-invalid": i ? !0 : u,
|
|
561
|
+
"aria-describedby": [l, h ? m : void 0].filter(Boolean).join(" ") || void 0,
|
|
562
|
+
className: `pancake-field-input pancake-select ${s}`
|
|
563
|
+
}), /* @__PURE__ */ t("span", {
|
|
564
|
+
className: "pancake-select-chevron",
|
|
565
|
+
"aria-hidden": "true",
|
|
566
|
+
children: "⌄"
|
|
567
|
+
})]
|
|
568
|
+
}),
|
|
569
|
+
h && /* @__PURE__ */ t("p", {
|
|
570
|
+
id: m,
|
|
571
|
+
className: "pancake-field-description",
|
|
572
|
+
"aria-live": i ? "assertive" : "polite",
|
|
573
|
+
children: h
|
|
574
|
+
})
|
|
575
|
+
]
|
|
576
|
+
});
|
|
577
|
+
}
|
|
578
|
+
// src/components/Button/IconButton.tsx
|
|
579
|
+
function V({ label: e, children: n, loading: r = !1, className: i = "", ...a }) {
|
|
580
|
+
return /* @__PURE__ */ t(b, {
|
|
581
|
+
...a,
|
|
582
|
+
loading: r,
|
|
583
|
+
"aria-label": e,
|
|
584
|
+
className: `pancake-icon-button ${i}`,
|
|
585
|
+
children: !r && /* @__PURE__ */ t("span", {
|
|
586
|
+
className: "pancake-icon-button-icon",
|
|
587
|
+
"aria-hidden": "true",
|
|
588
|
+
children: n
|
|
589
|
+
})
|
|
590
|
+
});
|
|
591
|
+
}
|
|
592
|
+
// src/components/Button/ButtonLink.tsx
|
|
593
|
+
function H({ variant: e = "primary", size: n = 48, className: r = "", ...i }) {
|
|
594
|
+
return /* @__PURE__ */ t("a", {
|
|
595
|
+
...i,
|
|
596
|
+
className: `pancake-button pancake-button--${e} pancake-button--${n} pancake-button-link ${r}`
|
|
597
|
+
});
|
|
598
|
+
}
|
|
599
|
+
// src/components/Dialog/Dialog.tsx
|
|
600
|
+
function U({ open: e, onOpenChange: r, title: i, description: a, closeLabel: u = "Close dialog", children: d, ref: f, className: p = "", onCancel: m, onClose: h, "aria-describedby": g, ..._ }) {
|
|
601
|
+
let v = l(null), y = o();
|
|
602
|
+
return s(f, () => v.current, []), c(() => {
|
|
603
|
+
let t = v.current;
|
|
604
|
+
if (t) return e && !t.open ? t.showModal() : !e && t.open && t.close(), () => {
|
|
605
|
+
t.open && t.close();
|
|
606
|
+
};
|
|
607
|
+
}, [e]), /* @__PURE__ */ t("dialog", {
|
|
608
|
+
..._,
|
|
609
|
+
ref: v,
|
|
610
|
+
className: `pancake-dialog ${p}`,
|
|
611
|
+
"aria-labelledby": `${y}-title`,
|
|
612
|
+
"aria-describedby": [g, a ? `${y}-description` : void 0].filter(Boolean).join(" ") || void 0,
|
|
613
|
+
onCancel: (e) => {
|
|
614
|
+
m?.(e);
|
|
615
|
+
let t = e.defaultPrevented;
|
|
616
|
+
e.preventDefault(), t || r(!1);
|
|
617
|
+
},
|
|
618
|
+
onClose: (t) => {
|
|
619
|
+
h?.(t), e && !t.currentTarget.open && r(!1);
|
|
620
|
+
},
|
|
621
|
+
children: /* @__PURE__ */ n(E, { children: [
|
|
622
|
+
/* @__PURE__ */ n(D, {
|
|
623
|
+
justify: "space-between",
|
|
624
|
+
align: "start",
|
|
625
|
+
wrap: !1,
|
|
626
|
+
children: [/* @__PURE__ */ t(k, {
|
|
627
|
+
id: `${y}-title`,
|
|
628
|
+
as: "h2",
|
|
629
|
+
variant: "heading",
|
|
630
|
+
children: i
|
|
631
|
+
}), /* @__PURE__ */ t(V, {
|
|
632
|
+
label: u,
|
|
633
|
+
variant: "ghost",
|
|
634
|
+
size: 40,
|
|
635
|
+
onClick: () => r(!1),
|
|
636
|
+
children: "×"
|
|
637
|
+
})]
|
|
638
|
+
}),
|
|
639
|
+
a && /* @__PURE__ */ t(k, {
|
|
640
|
+
id: `${y}-description`,
|
|
641
|
+
as: "p",
|
|
642
|
+
color: "muted",
|
|
643
|
+
children: a
|
|
644
|
+
}),
|
|
645
|
+
d
|
|
646
|
+
] })
|
|
647
|
+
});
|
|
648
|
+
}
|
|
649
|
+
// src/components/RadioGroup/RadioGroup.tsx
|
|
650
|
+
function W({ label: e, options: r, value: i, defaultValue: a, onValueChange: s, required: c, helperText: l, error: u, name: d, disabled: f, className: p = "", "aria-describedby": m, "aria-invalid": h, ...g }) {
|
|
651
|
+
let _ = o(), v = `${_}-description`, y = u || l, b = [m, y ? v : void 0].filter(Boolean).join(" ") || void 0;
|
|
652
|
+
return /* @__PURE__ */ n("fieldset", {
|
|
653
|
+
...g,
|
|
654
|
+
disabled: f,
|
|
655
|
+
"aria-describedby": b,
|
|
656
|
+
"aria-invalid": u ? !0 : h,
|
|
657
|
+
className: `pancake-radio-group ${p}`,
|
|
658
|
+
children: [
|
|
659
|
+
/* @__PURE__ */ t("legend", {
|
|
660
|
+
className: "pancake-radio-legend",
|
|
661
|
+
children: e
|
|
662
|
+
}),
|
|
663
|
+
/* @__PURE__ */ t("div", {
|
|
664
|
+
className: "pancake-radio-options",
|
|
665
|
+
children: r.map((e, r) => {
|
|
666
|
+
let o = `${_}-option-${r}`;
|
|
667
|
+
return /* @__PURE__ */ n("label", {
|
|
668
|
+
className: "pancake-radio-option",
|
|
669
|
+
children: [/* @__PURE__ */ t("input", {
|
|
670
|
+
className: "pancake-radio-input",
|
|
671
|
+
type: "radio",
|
|
672
|
+
name: d ?? _,
|
|
673
|
+
form: g.form,
|
|
674
|
+
value: e.value,
|
|
675
|
+
disabled: e.disabled,
|
|
676
|
+
required: c,
|
|
677
|
+
"aria-labelledby": `${_}-label-${r}`,
|
|
678
|
+
"aria-describedby": e.description ? o : void 0,
|
|
679
|
+
checked: i === void 0 ? void 0 : i === e.value,
|
|
680
|
+
defaultChecked: i === void 0 ? a === e.value : void 0,
|
|
681
|
+
onChange: (t) => {
|
|
682
|
+
t.currentTarget.checked && s?.(e.value);
|
|
683
|
+
}
|
|
684
|
+
}), /* @__PURE__ */ n("span", {
|
|
685
|
+
className: "pancake-radio-copy",
|
|
686
|
+
children: [/* @__PURE__ */ t("span", {
|
|
687
|
+
id: `${_}-label-${r}`,
|
|
688
|
+
children: e.label
|
|
689
|
+
}), e.description && /* @__PURE__ */ t("span", {
|
|
690
|
+
id: o,
|
|
691
|
+
className: "pancake-radio-description",
|
|
692
|
+
children: e.description
|
|
693
|
+
})]
|
|
694
|
+
})]
|
|
695
|
+
}, e.value);
|
|
696
|
+
})
|
|
697
|
+
}),
|
|
698
|
+
y && /* @__PURE__ */ t("span", {
|
|
699
|
+
id: v,
|
|
700
|
+
className: "pancake-radio-description",
|
|
701
|
+
children: y
|
|
702
|
+
})
|
|
703
|
+
]
|
|
704
|
+
});
|
|
705
|
+
}
|
|
706
|
+
// src/components/Switch/Switch.tsx
|
|
707
|
+
function G({ label: e, onChange: r, onCheckedChange: i, id: a, className: s = "", ...c }) {
|
|
708
|
+
let l = o(), u = a ?? l;
|
|
709
|
+
return /* @__PURE__ */ n("label", {
|
|
710
|
+
className: "pancake-switch-label",
|
|
711
|
+
htmlFor: u,
|
|
712
|
+
children: [/* @__PURE__ */ t("input", {
|
|
713
|
+
...c,
|
|
714
|
+
id: u,
|
|
715
|
+
type: "checkbox",
|
|
716
|
+
role: "switch",
|
|
717
|
+
className: `pancake-switch ${s}`,
|
|
718
|
+
onChange: (e) => {
|
|
719
|
+
r?.(e), i?.(e.currentTarget.checked);
|
|
720
|
+
}
|
|
721
|
+
}), /* @__PURE__ */ t("span", { children: e })]
|
|
722
|
+
});
|
|
723
|
+
}
|
|
724
|
+
// src/components/Tabs/Tabs.tsx
|
|
725
|
+
function K({ label: e, items: r, value: i, defaultValue: a, onValueChange: s, orientation: c = "horizontal", activation: l = "automatic", className: d = "", ...f }) {
|
|
726
|
+
let p = o(), [m, h] = u(a), [g, _] = u(), v = r.filter((e) => !e.disabled), y = i ?? m, b = v.find((e) => e.value === y)?.value ?? v[0]?.value, x = v.find((e) => e.value === g)?.value ?? b, S = (e) => {
|
|
727
|
+
e !== b && (i === void 0 && h(e), s?.(e));
|
|
728
|
+
};
|
|
729
|
+
return /* @__PURE__ */ n("div", {
|
|
730
|
+
...f,
|
|
731
|
+
className: `pancake-tabs ${d}`,
|
|
732
|
+
children: [/* @__PURE__ */ t("div", {
|
|
733
|
+
className: `pancake-tabs-list pancake-tabs-list--${c}`,
|
|
734
|
+
role: "tablist",
|
|
735
|
+
"aria-label": e,
|
|
736
|
+
"aria-orientation": c,
|
|
737
|
+
onBlur: (e) => {
|
|
738
|
+
e.currentTarget.contains(e.relatedTarget) || _(void 0);
|
|
739
|
+
},
|
|
740
|
+
children: r.map((e, n) => /* @__PURE__ */ t("button", {
|
|
741
|
+
id: `${p}-tab-${n}`,
|
|
742
|
+
className: "pancake-tabs-tab",
|
|
743
|
+
type: "button",
|
|
744
|
+
role: "tab",
|
|
745
|
+
"aria-selected": e.value === b,
|
|
746
|
+
"aria-controls": `${p}-panel-${n}`,
|
|
747
|
+
tabIndex: !e.disabled && e.value === x ? 0 : -1,
|
|
748
|
+
disabled: e.disabled,
|
|
749
|
+
onFocus: () => _(e.value),
|
|
750
|
+
onClick: () => S(e.value),
|
|
751
|
+
onKeyDown: (t) => {
|
|
752
|
+
let n = c === "vertical", i = getComputedStyle(t.currentTarget).direction === "rtl", a = n ? "ArrowUp" : i ? "ArrowRight" : "ArrowLeft", o = n ? "ArrowDown" : i ? "ArrowLeft" : "ArrowRight", s = v.findIndex((t) => t.value === e.value), u;
|
|
753
|
+
if (t.key === "Home" ? u = v[0] : t.key === "End" ? u = v.at(-1) : t.key === o ? u = v[(s + 1) % v.length] : t.key === a && (u = v[(s - 1 + v.length) % v.length]), !u) return;
|
|
754
|
+
t.preventDefault();
|
|
755
|
+
let d = r.indexOf(u);
|
|
756
|
+
t.currentTarget.ownerDocument.getElementById(`${p}-tab-${d}`)?.focus(), l === "automatic" && S(u.value);
|
|
757
|
+
},
|
|
758
|
+
children: e.label
|
|
759
|
+
}, e.value))
|
|
760
|
+
}), r.map((e, n) => /* @__PURE__ */ t("div", {
|
|
761
|
+
id: `${p}-panel-${n}`,
|
|
762
|
+
className: "pancake-tabs-panel",
|
|
763
|
+
role: "tabpanel",
|
|
764
|
+
"aria-labelledby": `${p}-tab-${n}`,
|
|
765
|
+
hidden: e.value !== b,
|
|
766
|
+
tabIndex: 0,
|
|
767
|
+
children: e.content
|
|
768
|
+
}, e.value))]
|
|
769
|
+
});
|
|
770
|
+
}
|
|
771
|
+
// src/components/Disclosure/Disclosure.tsx
|
|
772
|
+
function q({ summary: e, children: r, open: i, defaultOpen: a = !1, onOpenChange: o, onToggle: s, onClick: c, className: d = "", ...f }) {
|
|
773
|
+
let [p] = u(a), m = l(p);
|
|
774
|
+
return /* @__PURE__ */ n("details", {
|
|
775
|
+
...f,
|
|
776
|
+
open: i ?? p,
|
|
777
|
+
className: `pancake-disclosure ${d}`,
|
|
778
|
+
onClick: (e) => {
|
|
779
|
+
c?.(e);
|
|
780
|
+
let t = e.target;
|
|
781
|
+
i === void 0 || e.defaultPrevented || e.button !== 0 || !(t instanceof Element) || t.closest("summary") !== e.currentTarget.firstElementChild || t.closest("a, button, input, select, textarea, [contenteditable]") || (e.preventDefault(), o?.(!i));
|
|
782
|
+
},
|
|
783
|
+
onToggle: (e) => {
|
|
784
|
+
let t = e.currentTarget.open;
|
|
785
|
+
i === void 0 ? t !== m.current && (m.current = t, o?.(t)) : e.currentTarget.open = i, s?.(e);
|
|
786
|
+
},
|
|
787
|
+
children: [/* @__PURE__ */ t("summary", {
|
|
788
|
+
className: "pancake-disclosure-summary",
|
|
789
|
+
children: e
|
|
790
|
+
}), /* @__PURE__ */ t("div", {
|
|
791
|
+
className: "pancake-disclosure-content",
|
|
792
|
+
children: r
|
|
793
|
+
})]
|
|
794
|
+
});
|
|
795
|
+
}
|
|
796
|
+
// src/components/progress/Progress.tsx
|
|
797
|
+
function J({ label: e, value: r, max: i = 100, id: a, className: s = "", ...c }) {
|
|
798
|
+
let l = o(), u = a ?? l;
|
|
799
|
+
return /* @__PURE__ */ n("div", {
|
|
800
|
+
className: "pancake-progress-field",
|
|
801
|
+
children: [/* @__PURE__ */ t("label", {
|
|
802
|
+
className: "pancake-progress-label",
|
|
803
|
+
htmlFor: u,
|
|
804
|
+
children: e
|
|
805
|
+
}), /* @__PURE__ */ t("progress", {
|
|
806
|
+
...c,
|
|
807
|
+
id: u,
|
|
808
|
+
value: r,
|
|
809
|
+
max: i,
|
|
810
|
+
className: `pancake-progress ${s}`
|
|
811
|
+
})]
|
|
812
|
+
});
|
|
813
|
+
}
|
|
814
|
+
// src/components/progress/LoadingIndicator.tsx
|
|
815
|
+
function Y({ label: e, className: r = "", ...i }) {
|
|
816
|
+
return /* @__PURE__ */ n("div", {
|
|
817
|
+
"aria-atomic": "true",
|
|
818
|
+
...i,
|
|
819
|
+
role: "status",
|
|
820
|
+
className: `pancake-loading-indicator ${r}`,
|
|
821
|
+
children: [/* @__PURE__ */ n("span", {
|
|
822
|
+
className: "pancake-loading-dots",
|
|
823
|
+
"aria-hidden": "true",
|
|
824
|
+
children: [
|
|
825
|
+
/* @__PURE__ */ t("span", { className: "pancake-loading-dot" }),
|
|
826
|
+
/* @__PURE__ */ t("span", { className: "pancake-loading-dot" }),
|
|
827
|
+
/* @__PURE__ */ t("span", { className: "pancake-loading-dot" })
|
|
828
|
+
]
|
|
829
|
+
}), /* @__PURE__ */ t("span", { children: e })]
|
|
830
|
+
});
|
|
831
|
+
}
|
|
832
|
+
// src/components/FileField/FileField.tsx
|
|
833
|
+
function X({ label: e, helperText: r, error: i, id: a, className: s = "", required: c, "aria-describedby": l, "aria-invalid": u, ...d }) {
|
|
834
|
+
let f = o(), p = a ?? f, m = `${f}-description`, h = i || r;
|
|
835
|
+
return /* @__PURE__ */ n("div", {
|
|
836
|
+
className: "pancake-field",
|
|
837
|
+
children: [
|
|
838
|
+
/* @__PURE__ */ n("label", {
|
|
839
|
+
className: "pancake-field-label",
|
|
840
|
+
htmlFor: p,
|
|
841
|
+
children: [e, c && /* @__PURE__ */ t("span", {
|
|
842
|
+
"aria-hidden": "true",
|
|
843
|
+
children: " *"
|
|
844
|
+
})]
|
|
845
|
+
}),
|
|
846
|
+
/* @__PURE__ */ t("input", {
|
|
847
|
+
...d,
|
|
848
|
+
id: p,
|
|
849
|
+
type: "file",
|
|
850
|
+
required: c,
|
|
851
|
+
"aria-invalid": i ? !0 : u,
|
|
852
|
+
"aria-describedby": [l, h ? m : void 0].filter(Boolean).join(" ") || void 0,
|
|
853
|
+
className: `pancake-field-input pancake-file-field ${s}`
|
|
854
|
+
}),
|
|
855
|
+
h && /* @__PURE__ */ t("p", {
|
|
856
|
+
id: m,
|
|
857
|
+
className: "pancake-field-description",
|
|
858
|
+
"aria-live": i ? "assertive" : "polite",
|
|
859
|
+
children: h
|
|
860
|
+
})
|
|
861
|
+
]
|
|
862
|
+
});
|
|
863
|
+
}
|
|
864
|
+
// src/components/Popover/Popover.tsx
|
|
865
|
+
function re({ label: e, onOpenChange: n, onToggle: r, className: i = "", ...a }) {
|
|
866
|
+
let o = l(!1);
|
|
867
|
+
return /* @__PURE__ */ t("div", {
|
|
868
|
+
...a,
|
|
869
|
+
popover: "auto",
|
|
870
|
+
role: "region",
|
|
871
|
+
"aria-label": e,
|
|
872
|
+
className: `pancake-popover ${i}`,
|
|
873
|
+
onToggle: (e) => {
|
|
874
|
+
let t = e.currentTarget.matches(":popover-open");
|
|
875
|
+
t !== o.current && (o.current = t, n?.(t)), r?.(e);
|
|
876
|
+
}
|
|
877
|
+
});
|
|
878
|
+
}
|
|
879
|
+
// src/components/DropdownMenu/menuKeyboard.ts
|
|
880
|
+
function Z(e) {
|
|
881
|
+
return Array.from(e.querySelectorAll("[role=\"menuitem\"]"));
|
|
882
|
+
}
|
|
883
|
+
function Q() {
|
|
884
|
+
let e = "", t = 0;
|
|
885
|
+
return (n, r) => {
|
|
886
|
+
if (n.defaultPrevented) return;
|
|
887
|
+
let i = n.currentTarget, a = Z(i), o = a.indexOf(i.ownerDocument.activeElement), s;
|
|
888
|
+
if (n.key === "Tab") i.hidePopover(), r?.focus();
|
|
889
|
+
else {
|
|
890
|
+
if (n.key === "ArrowDown") s = a[(o + 1) % a.length];
|
|
891
|
+
else if (n.key === "ArrowUp") s = a[(o - 1 + a.length) % a.length];
|
|
892
|
+
else if (n.key === "Home") s = a[0];
|
|
893
|
+
else if (n.key === "End") s = a.at(-1);
|
|
894
|
+
else if (n.key === " " && n.target instanceof HTMLAnchorElement) {
|
|
895
|
+
n.preventDefault(), n.target.click();
|
|
896
|
+
return;
|
|
897
|
+
} else if (n.key.length === 1 && !n.ctrlKey && !n.metaKey && !n.altKey && n.key !== " ") {
|
|
898
|
+
let r = Date.now();
|
|
899
|
+
e = r - t > 500 ? n.key : e + n.key, t = r;
|
|
900
|
+
let i = [...e].every((t) => t === e[0]) ? e[0] : e;
|
|
901
|
+
s = a.slice(o + 1).concat(a.slice(0, o + 1)).find((e) => e.textContent?.trim().toLocaleLowerCase().startsWith(i.toLocaleLowerCase())), n.preventDefault();
|
|
902
|
+
}
|
|
903
|
+
s && (n.preventDefault(), s.focus());
|
|
904
|
+
}
|
|
905
|
+
};
|
|
906
|
+
}
|
|
907
|
+
// src/components/DropdownMenu/DropdownMenu.tsx
|
|
908
|
+
function ie({ label: r, items: a, triggerProps: d = {}, onOpenChange: f, onToggle: p, onKeyDown: m, ref: h, className: g = "", ..._ }) {
|
|
909
|
+
let v = o(), y = l(null), x = l(null), [S, C] = u(!1), w = l(!1), T = l(Q()), E = l(void 0);
|
|
910
|
+
return c(() => {
|
|
911
|
+
y.current?.matches(":popover-open") && E.current !== void 0 && !a.some((e) => e.id === E.current) && (Z(y.current)[0]?.focus(), a.length || y.current.hidePopover());
|
|
912
|
+
}, [a]), s(h, () => y.current, []), s(d.ref, () => x.current, []), /* @__PURE__ */ n(e, { children: [/* @__PURE__ */ t(b, {
|
|
913
|
+
...d,
|
|
914
|
+
ref: x,
|
|
915
|
+
type: "button",
|
|
916
|
+
disabled: d.disabled || a.length === 0,
|
|
917
|
+
popoverTarget: v,
|
|
918
|
+
"aria-haspopup": "menu",
|
|
919
|
+
"aria-expanded": S,
|
|
920
|
+
"aria-controls": v,
|
|
921
|
+
onClick: (e) => {
|
|
922
|
+
d.onClick?.(e), !e.defaultPrevented && y.current && (e.preventDefault(), y.current.matches(":popover-open") ? y.current.hidePopover() : (e.currentTarget.focus(), y.current.showPopover({ source: e.currentTarget }), y.current.matches(":popover-open") && Z(y.current)[0]?.focus()));
|
|
923
|
+
},
|
|
924
|
+
onKeyDown: (e) => {
|
|
925
|
+
if (d.onKeyDown?.(e), !e.defaultPrevented && ["ArrowDown", "ArrowUp"].includes(e.key) && (e.preventDefault(), y.current?.showPopover({ source: e.currentTarget }), y.current?.matches(":popover-open"))) {
|
|
926
|
+
let t = Z(y.current);
|
|
927
|
+
(e.key === "ArrowUp" ? t.at(-1) : t[0])?.focus();
|
|
928
|
+
}
|
|
929
|
+
},
|
|
930
|
+
children: r
|
|
931
|
+
}), /* @__PURE__ */ t("div", {
|
|
932
|
+
..._,
|
|
933
|
+
ref: y,
|
|
934
|
+
id: v,
|
|
935
|
+
popover: "auto",
|
|
936
|
+
role: "menu",
|
|
937
|
+
"aria-label": r,
|
|
938
|
+
className: `pancake-popover pancake-dropdown-menu ${g}`,
|
|
939
|
+
onToggle: (e) => {
|
|
940
|
+
let t = e.currentTarget.matches(":popover-open");
|
|
941
|
+
C(t), t || (T.current = Q()), t && e.currentTarget.ownerDocument.activeElement === x.current && Z(e.currentTarget)[0]?.focus(), t !== w.current && (w.current = t, f?.(t)), p?.(e);
|
|
942
|
+
},
|
|
943
|
+
onKeyDown: (e) => {
|
|
944
|
+
m?.(e), T.current(e, x.current);
|
|
945
|
+
},
|
|
946
|
+
children: a.map((e) => {
|
|
947
|
+
let t = {
|
|
948
|
+
role: "menuitem",
|
|
949
|
+
tabIndex: -1,
|
|
950
|
+
"aria-disabled": e.disabled || void 0,
|
|
951
|
+
className: "pancake-dropdown-menu-item",
|
|
952
|
+
onFocus: () => {
|
|
953
|
+
E.current = e.id;
|
|
954
|
+
},
|
|
955
|
+
onClick: (t) => {
|
|
956
|
+
e.disabled ? t.preventDefault() : (y.current?.hidePopover(), x.current?.focus(), e.type === "action" && e.onSelect());
|
|
957
|
+
}
|
|
958
|
+
};
|
|
959
|
+
return e.type === "link" ? /* @__PURE__ */ i("a", {
|
|
960
|
+
...t,
|
|
961
|
+
key: e.id,
|
|
962
|
+
href: e.disabled ? void 0 : e.href,
|
|
963
|
+
target: e.target,
|
|
964
|
+
rel: e.rel,
|
|
965
|
+
download: e.download
|
|
966
|
+
}, e.label) : /* @__PURE__ */ i("button", {
|
|
967
|
+
...t,
|
|
968
|
+
key: e.id,
|
|
969
|
+
type: "button"
|
|
970
|
+
}, e.label);
|
|
971
|
+
})
|
|
972
|
+
})] });
|
|
973
|
+
}
|
|
974
|
+
// src/components/Tooltip/useTooltip.ts
|
|
975
|
+
function $() {
|
|
976
|
+
let e = l(null), t = l(null), n = l(!1), r = l(!1), i = l(!1), o = l(!1), s = l(void 0), c = () => clearTimeout(s.current), u = () => {
|
|
977
|
+
c(), t.current?.matches(":popover-open") && t.current.hidePopover();
|
|
978
|
+
}, d = () => {
|
|
979
|
+
c(), !i.current && !o.current && e.current && t.current && t.current.showPopover({ source: e.current });
|
|
980
|
+
}, f = () => {
|
|
981
|
+
c(), !n.current && !r.current && (i.current = !1, s.current = setTimeout(u, 150));
|
|
982
|
+
};
|
|
983
|
+
return a(() => {
|
|
984
|
+
let n = e.current.ownerDocument, r = (e) => {
|
|
985
|
+
o.current = !1, e.key === "Escape" && t.current?.matches(":popover-open") && (e.preventDefault(), e.stopPropagation(), i.current = !0, t.current.hidePopover());
|
|
986
|
+
};
|
|
987
|
+
return n.addEventListener("keydown", r, !0), () => {
|
|
988
|
+
clearTimeout(s.current), n.removeEventListener("keydown", r, !0);
|
|
989
|
+
};
|
|
990
|
+
}, []), {
|
|
991
|
+
anchor: e,
|
|
992
|
+
panel: t,
|
|
993
|
+
handlers: {
|
|
994
|
+
onFocus: (e) => {
|
|
995
|
+
n.current = !0, e.defaultPrevented || d();
|
|
996
|
+
},
|
|
997
|
+
onBlur: (e) => {
|
|
998
|
+
e.currentTarget.contains(e.relatedTarget) || (n.current = !1, o.current = !1, f());
|
|
999
|
+
},
|
|
1000
|
+
onPointerEnter: (e) => {
|
|
1001
|
+
e.pointerType !== "touch" && (r.current = !0, o.current = !1, d());
|
|
1002
|
+
},
|
|
1003
|
+
onPointerLeave: (e) => {
|
|
1004
|
+
e.pointerType !== "touch" && (r.current = !1, f());
|
|
1005
|
+
},
|
|
1006
|
+
onPointerDown: (e) => {
|
|
1007
|
+
e.pointerType === "touch" && (o.current = !0, r.current = !1, u());
|
|
1008
|
+
}
|
|
1009
|
+
}
|
|
1010
|
+
};
|
|
1011
|
+
}
|
|
1012
|
+
// src/components/Tooltip/Tooltip.tsx
|
|
1013
|
+
function ae({ content: e, children: i, onOpenChange: a, onToggle: c, ref: u, className: d = "", ...f }) {
|
|
1014
|
+
let p = o(), { anchor: m, panel: h, handlers: g } = $(), _ = l(!1);
|
|
1015
|
+
return s(u, () => h.current, [h]), /* @__PURE__ */ n("span", {
|
|
1016
|
+
ref: m,
|
|
1017
|
+
className: "pancake-tooltip-anchor",
|
|
1018
|
+
onFocus: g.onFocus,
|
|
1019
|
+
onBlur: g.onBlur,
|
|
1020
|
+
onPointerEnter: g.onPointerEnter,
|
|
1021
|
+
onPointerLeave: g.onPointerLeave,
|
|
1022
|
+
onPointerDown: g.onPointerDown,
|
|
1023
|
+
children: [r(i, { "aria-describedby": [i.props["aria-describedby"], p].filter(Boolean).join(" ") }), /* @__PURE__ */ t("span", {
|
|
1024
|
+
...f,
|
|
1025
|
+
ref: h,
|
|
1026
|
+
id: p,
|
|
1027
|
+
role: "tooltip",
|
|
1028
|
+
popover: "manual",
|
|
1029
|
+
className: `pancake-popover pancake-tooltip ${d}`,
|
|
1030
|
+
onToggle: (e) => {
|
|
1031
|
+
let t = e.currentTarget.matches(":popover-open");
|
|
1032
|
+
t !== _.current && (_.current = t, a?.(t)), c?.(e);
|
|
1033
|
+
},
|
|
1034
|
+
children: e
|
|
1035
|
+
})]
|
|
1036
|
+
});
|
|
1037
|
+
}
|
|
1038
|
+
// src/components/Table/Table.tsx
|
|
1039
|
+
function oe({ caption: e, children: r, className: i = "", ...a }) {
|
|
1040
|
+
let s = o();
|
|
1041
|
+
return /* @__PURE__ */ t("div", {
|
|
1042
|
+
className: "pancake-table-scroll",
|
|
1043
|
+
role: "region",
|
|
1044
|
+
"aria-labelledby": s,
|
|
1045
|
+
tabIndex: 0,
|
|
1046
|
+
children: /* @__PURE__ */ n("table", {
|
|
1047
|
+
...a,
|
|
1048
|
+
className: `pancake-table ${i}`,
|
|
1049
|
+
children: [/* @__PURE__ */ t("caption", {
|
|
1050
|
+
id: s,
|
|
1051
|
+
children: e
|
|
1052
|
+
}), r]
|
|
1053
|
+
})
|
|
1054
|
+
});
|
|
1055
|
+
}
|
|
1056
|
+
// src/components/Pagination/paginationPages.ts
|
|
1057
|
+
function se(e, t) {
|
|
1058
|
+
let n = Number.isFinite(t) ? Math.min(2 ** 53 - 1, Math.max(0, Math.trunc(t))) : 0, r = n ? Math.min(n, Math.max(1, Math.trunc(Number.isFinite(e) ? e : 1))) : 0;
|
|
1059
|
+
return {
|
|
1060
|
+
count: n,
|
|
1061
|
+
current: r,
|
|
1062
|
+
pages: n <= 7 ? Array.from({ length: n }, (e, t) => t + 1) : [.../* @__PURE__ */ new Set([
|
|
1063
|
+
1,
|
|
1064
|
+
r - 1,
|
|
1065
|
+
r,
|
|
1066
|
+
r + 1,
|
|
1067
|
+
n
|
|
1068
|
+
])].filter((e) => e >= 1 && e <= n).sort((e, t) => e - t)
|
|
1069
|
+
};
|
|
1070
|
+
}
|
|
1071
|
+
// src/components/Pagination/Pagination.tsx
|
|
1072
|
+
function ce({ label: e, page: r, pageCount: i, labels: a = {}, getPageHref: o, onPageChange: s, linkProps: c, className: l = "", ...u }) {
|
|
1073
|
+
let { count: d, current: f, pages: p } = se(r, i), m = a.page ?? ((e) => `Page ${e}`), h = a.previous ?? "Previous", g = a.next ?? "Next", _ = (e, n, r, i = !1, a = !1) => {
|
|
1074
|
+
let l = a && e === f;
|
|
1075
|
+
return o ? i ? /* @__PURE__ */ t("span", {
|
|
1076
|
+
className: "pancake-button pancake-button--secondary pancake-button--40 pancake-pagination-control pancake-pagination-unavailable",
|
|
1077
|
+
"aria-disabled": "true",
|
|
1078
|
+
children: n
|
|
1079
|
+
}) : /* @__PURE__ */ t(H, {
|
|
1080
|
+
target: c?.target,
|
|
1081
|
+
rel: c?.rel,
|
|
1082
|
+
href: o(e),
|
|
1083
|
+
size: 40,
|
|
1084
|
+
variant: l ? "primary" : "secondary",
|
|
1085
|
+
className: "pancake-pagination-control",
|
|
1086
|
+
"aria-label": r,
|
|
1087
|
+
"aria-current": l ? "page" : void 0,
|
|
1088
|
+
children: n
|
|
1089
|
+
}) : /* @__PURE__ */ t(b, {
|
|
1090
|
+
type: "button",
|
|
1091
|
+
size: 40,
|
|
1092
|
+
variant: l ? "primary" : "secondary",
|
|
1093
|
+
className: "pancake-pagination-control",
|
|
1094
|
+
disabled: i,
|
|
1095
|
+
"aria-label": r,
|
|
1096
|
+
"aria-current": l ? "page" : void 0,
|
|
1097
|
+
onClick: () => {
|
|
1098
|
+
e !== f && s?.(e);
|
|
1099
|
+
},
|
|
1100
|
+
children: n
|
|
1101
|
+
});
|
|
1102
|
+
};
|
|
1103
|
+
return /* @__PURE__ */ t("nav", {
|
|
1104
|
+
...u,
|
|
1105
|
+
"aria-label": e,
|
|
1106
|
+
className: `pancake-pagination ${l}`,
|
|
1107
|
+
children: /* @__PURE__ */ n("ul", {
|
|
1108
|
+
className: "pancake-pagination-list",
|
|
1109
|
+
children: [
|
|
1110
|
+
/* @__PURE__ */ t("li", { children: _(f - 1, h, h, f <= 1) }),
|
|
1111
|
+
p.flatMap((e, n) => [...n > 0 && e - p[n - 1] > 1 ? [/* @__PURE__ */ t("li", {
|
|
1112
|
+
"aria-hidden": "true",
|
|
1113
|
+
className: "pancake-pagination-gap",
|
|
1114
|
+
children: "…"
|
|
1115
|
+
}, `gap-${e}`)] : [], /* @__PURE__ */ t("li", { children: _(e, e, m(e), !1, !0) }, e)]),
|
|
1116
|
+
/* @__PURE__ */ t("li", { children: _(f + 1, g, g, f >= d) })
|
|
1117
|
+
]
|
|
1118
|
+
})
|
|
1119
|
+
});
|
|
1120
|
+
}
|
|
1121
|
+
export { F as AppHeader, M as Avatar, N as AvatarGroup, ee as BannerToast, I as BottomNavigation, b as Button, H as ButtonLink, x as Checkbox, U as Dialog, q as Disclosure, ie as DropdownMenu, te as EmptyState, X as FileField, V as IconButton, D as Inline, Y as LoadingIndicator, ce as Pagination, re as Popover, J as Progress, W as RadioGroup, ne as SectionHeader, L as SegmentedControl, B as Select, E as Stack, P as StatusChip, R as StepProgress, y as Surface, G as Switch, oe as Table, K as Tabs, k as Text, S as TextField, z as Textarea, ae as Tooltip, h as borders, d as colors, g as opacity, p as radii, m as sizing, f as spacing, v as typography };
|