@doneisbetter/gds-core 2.6.3 → 2.6.4
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-QEPN7PSA.mjs → chunk-BAS4ZGKL.mjs} +1124 -415
- package/dist/{chunk-E3QXLNZO.mjs → chunk-EN3TN22M.mjs} +246 -38
- package/dist/client.d.mts +72 -10
- package/dist/client.d.ts +72 -10
- package/dist/client.js +1402 -468
- package/dist/client.mjs +36 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1402 -468
- package/dist/index.mjs +36 -2
- package/dist/server-BqFksoV3.d.mts +5540 -0
- package/dist/server-BqFksoV3.d.ts +5540 -0
- package/dist/server.d.mts +5 -6074
- package/dist/server.d.ts +5 -6074
- package/dist/server.js +1031 -310
- package/dist/server.mjs +23 -1
- package/package.json +2 -2
|
@@ -1,19 +1,27 @@
|
|
|
1
1
|
import {
|
|
2
2
|
GdsIcons,
|
|
3
|
-
GdsVocabulary,
|
|
4
3
|
StateBlock,
|
|
5
|
-
getSemanticActionLabel
|
|
6
|
-
|
|
4
|
+
getSemanticActionLabel,
|
|
5
|
+
resolveSemanticActionConfig
|
|
6
|
+
} from "./chunk-BAS4ZGKL.mjs";
|
|
7
7
|
|
|
8
8
|
// src/SemanticButton.tsx
|
|
9
|
-
import {
|
|
9
|
+
import { useEffect, useState } from "react";
|
|
10
10
|
import { Button } from "@mantine/core";
|
|
11
11
|
import { useGdsTranslation } from "@doneisbetter/gds-theme";
|
|
12
12
|
import { IconCheck, IconX } from "@tabler/icons-react";
|
|
13
13
|
import { jsx } from "react/jsx-runtime";
|
|
14
|
-
function SemanticButton({
|
|
14
|
+
function SemanticButton({
|
|
15
|
+
action,
|
|
16
|
+
loading,
|
|
17
|
+
feedbackState,
|
|
18
|
+
feedbackText,
|
|
19
|
+
prerenderLabelOnly = true,
|
|
20
|
+
vocabularyPacks = [],
|
|
21
|
+
...props
|
|
22
|
+
}) {
|
|
15
23
|
const { t } = useGdsTranslation();
|
|
16
|
-
const config =
|
|
24
|
+
const config = resolveSemanticActionConfig(action, vocabularyPacks);
|
|
17
25
|
const [mounted, setMounted] = useState(!prerenderLabelOnly);
|
|
18
26
|
const [internalFeedback, setInternalFeedback] = useState(null);
|
|
19
27
|
useEffect(() => {
|
|
@@ -29,14 +37,14 @@ function SemanticButton({ action, loading, feedbackState, feedbackText, prerende
|
|
|
29
37
|
}
|
|
30
38
|
}, [feedbackState]);
|
|
31
39
|
let Icon = config.icon;
|
|
32
|
-
let label = getSemanticActionLabel(action, t);
|
|
40
|
+
let label = getSemanticActionLabel(action, t, vocabularyPacks);
|
|
33
41
|
let color = props.color;
|
|
34
42
|
if (!mounted) {
|
|
35
43
|
const { leftSection, ...buttonProps } = props;
|
|
36
|
-
return /* @__PURE__ */ jsx(Button, { loading, color, ...buttonProps, children: getSemanticActionLabel(action) });
|
|
44
|
+
return /* @__PURE__ */ jsx(Button, { loading, color, ...buttonProps, children: getSemanticActionLabel(action, void 0, vocabularyPacks) });
|
|
37
45
|
}
|
|
38
46
|
if (internalFeedback === "success") {
|
|
39
|
-
const defaultFeedback =
|
|
47
|
+
const defaultFeedback = config.feedback ?? { icon: IconCheck, color: "teal", messageId: "gds.feedback.saved" };
|
|
40
48
|
Icon = defaultFeedback.icon;
|
|
41
49
|
label = feedbackText || t(defaultFeedback.messageId, "Success");
|
|
42
50
|
color = defaultFeedback.color;
|
|
@@ -141,10 +149,118 @@ function GameBoardTile({
|
|
|
141
149
|
) });
|
|
142
150
|
}
|
|
143
151
|
|
|
152
|
+
// src/DiscoveryShell.tsx
|
|
153
|
+
import { AppShell as MantineAppShell, Box, Burger, Group as Group2, ScrollArea } from "@mantine/core";
|
|
154
|
+
import { useDisclosure } from "@mantine/hooks";
|
|
155
|
+
import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
156
|
+
function DiscoveryShell({
|
|
157
|
+
header,
|
|
158
|
+
sidebar,
|
|
159
|
+
footer,
|
|
160
|
+
children,
|
|
161
|
+
mobileNavigationLabel = "Toggle navigation",
|
|
162
|
+
defaultSidebarOpen = false,
|
|
163
|
+
stickySidebar = true,
|
|
164
|
+
sidebarWidth = 280,
|
|
165
|
+
headerHeight = 60,
|
|
166
|
+
shellPadding = "md",
|
|
167
|
+
collapseBreakpoint = "sm"
|
|
168
|
+
}) {
|
|
169
|
+
const [opened, { toggle, close }] = useDisclosure(defaultSidebarOpen);
|
|
170
|
+
return /* @__PURE__ */ jsxs2(
|
|
171
|
+
MantineAppShell,
|
|
172
|
+
{
|
|
173
|
+
header: { height: headerHeight },
|
|
174
|
+
footer: footer ? { height: 68 } : void 0,
|
|
175
|
+
navbar: {
|
|
176
|
+
width: sidebarWidth,
|
|
177
|
+
breakpoint: collapseBreakpoint,
|
|
178
|
+
collapsed: { mobile: !opened }
|
|
179
|
+
},
|
|
180
|
+
padding: shellPadding,
|
|
181
|
+
children: [
|
|
182
|
+
/* @__PURE__ */ jsx5(MantineAppShell.Header, { children: /* @__PURE__ */ jsxs2(Group2, { h: "100%", px: "md", gap: "sm", wrap: "nowrap", children: [
|
|
183
|
+
/* @__PURE__ */ jsx5(
|
|
184
|
+
Burger,
|
|
185
|
+
{
|
|
186
|
+
opened,
|
|
187
|
+
onClick: toggle,
|
|
188
|
+
hiddenFrom: collapseBreakpoint,
|
|
189
|
+
size: "sm",
|
|
190
|
+
"aria-label": mobileNavigationLabel
|
|
191
|
+
}
|
|
192
|
+
),
|
|
193
|
+
/* @__PURE__ */ jsx5(Box, { style: { flex: 1, minWidth: 0 }, children: header })
|
|
194
|
+
] }) }),
|
|
195
|
+
/* @__PURE__ */ jsx5(MantineAppShell.Navbar, { p: "md", "data-sticky-sidebar": stickySidebar || void 0, children: /* @__PURE__ */ jsx5(ScrollArea, { h: "100%", type: "auto", children: /* @__PURE__ */ jsx5(
|
|
196
|
+
Box,
|
|
197
|
+
{
|
|
198
|
+
h: "100%",
|
|
199
|
+
style: stickySidebar ? {
|
|
200
|
+
display: "flex",
|
|
201
|
+
flexDirection: "column"
|
|
202
|
+
} : void 0,
|
|
203
|
+
children: sidebar
|
|
204
|
+
}
|
|
205
|
+
) }) }),
|
|
206
|
+
footer ? /* @__PURE__ */ jsx5(MantineAppShell.Footer, { children: /* @__PURE__ */ jsx5(Group2, { h: "100%", px: "md", justify: "space-around", wrap: "nowrap", children: footer }) }) : null,
|
|
207
|
+
/* @__PURE__ */ jsx5(MantineAppShell.Main, { onClick: () => close(), children })
|
|
208
|
+
]
|
|
209
|
+
}
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// src/SidebarNav.tsx
|
|
214
|
+
import { forwardRef } from "react";
|
|
215
|
+
import { Box as Box2, NavLink, Stack, Text as Text3, createPolymorphicComponent } from "@mantine/core";
|
|
216
|
+
import { useGdsTranslation as useGdsTranslation3 } from "@doneisbetter/gds-theme";
|
|
217
|
+
import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
218
|
+
function SidebarNav({ children, ariaLabel = "Primary navigation", gap = "md" }) {
|
|
219
|
+
return /* @__PURE__ */ jsx6(Stack, { component: "nav", "aria-label": ariaLabel, gap, h: "100%", children });
|
|
220
|
+
}
|
|
221
|
+
function SidebarNavSection({ label, children, pushToBottom = false }) {
|
|
222
|
+
return /* @__PURE__ */ jsxs3(Stack, { gap: "xs", mt: pushToBottom ? "auto" : void 0, children: [
|
|
223
|
+
label ? /* @__PURE__ */ jsx6(Text3, { size: "xs", fw: 700, c: "dimmed", children: label }) : null,
|
|
224
|
+
/* @__PURE__ */ jsx6(Stack, { gap: 4, children })
|
|
225
|
+
] });
|
|
226
|
+
}
|
|
227
|
+
var _SidebarNavItem = forwardRef(
|
|
228
|
+
({
|
|
229
|
+
action,
|
|
230
|
+
label,
|
|
231
|
+
description,
|
|
232
|
+
badge,
|
|
233
|
+
icon,
|
|
234
|
+
"aria-label": ariaLabel,
|
|
235
|
+
"aria-current": ariaCurrent,
|
|
236
|
+
vocabularyPacks = [],
|
|
237
|
+
...props
|
|
238
|
+
}, ref) => {
|
|
239
|
+
const { t } = useGdsTranslation3();
|
|
240
|
+
const config = action ? resolveSemanticActionConfig(action, vocabularyPacks) : null;
|
|
241
|
+
const Icon = config?.icon;
|
|
242
|
+
const resolvedLabel = label ?? (action ? getSemanticActionLabel(action, t, vocabularyPacks) : void 0);
|
|
243
|
+
return /* @__PURE__ */ jsx6(
|
|
244
|
+
NavLink,
|
|
245
|
+
{
|
|
246
|
+
ref,
|
|
247
|
+
label: resolvedLabel,
|
|
248
|
+
description,
|
|
249
|
+
leftSection: icon ?? (Icon ? /* @__PURE__ */ jsx6(Icon, { size: "1rem", stroke: 1.5 }) : void 0),
|
|
250
|
+
rightSection: badge ? /* @__PURE__ */ jsx6(Box2, { children: badge }) : props.rightSection,
|
|
251
|
+
"aria-label": ariaLabel ?? (typeof resolvedLabel === "string" ? resolvedLabel : void 0),
|
|
252
|
+
"aria-current": props.active ? "page" : ariaCurrent,
|
|
253
|
+
...props
|
|
254
|
+
}
|
|
255
|
+
);
|
|
256
|
+
}
|
|
257
|
+
);
|
|
258
|
+
var SidebarNavItem = createPolymorphicComponent(_SidebarNavItem);
|
|
259
|
+
|
|
144
260
|
// src/DocsCodeBlock.tsx
|
|
145
261
|
import { useState as useState2 } from "react";
|
|
146
|
-
import { ActionIcon as ActionIcon2, Code, Group as
|
|
147
|
-
import { jsx as
|
|
262
|
+
import { ActionIcon as ActionIcon2, Code, Group as Group3, Paper as Paper2, Stack as Stack2, Text as Text4 } from "@mantine/core";
|
|
263
|
+
import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
148
264
|
function DocsCodeBlock({ code, language, title, withCopy = true }) {
|
|
149
265
|
const [copied, setCopied] = useState2(false);
|
|
150
266
|
const handleCopy = async () => {
|
|
@@ -155,13 +271,13 @@ function DocsCodeBlock({ code, language, title, withCopy = true }) {
|
|
|
155
271
|
setCopied(true);
|
|
156
272
|
window.setTimeout(() => setCopied(false), 1200);
|
|
157
273
|
};
|
|
158
|
-
return /* @__PURE__ */
|
|
159
|
-
title || withCopy ? /* @__PURE__ */
|
|
160
|
-
/* @__PURE__ */
|
|
161
|
-
title ? /* @__PURE__ */
|
|
162
|
-
language ? /* @__PURE__ */
|
|
274
|
+
return /* @__PURE__ */ jsx7(Paper2, { withBorder: true, radius: "lg", p: "md", children: /* @__PURE__ */ jsxs4(Stack2, { gap: "sm", children: [
|
|
275
|
+
title || withCopy ? /* @__PURE__ */ jsxs4(Group3, { justify: "space-between", align: "center", children: [
|
|
276
|
+
/* @__PURE__ */ jsxs4(Stack2, { gap: 0, children: [
|
|
277
|
+
title ? /* @__PURE__ */ jsx7(Text4, { fw: 600, children: title }) : null,
|
|
278
|
+
language ? /* @__PURE__ */ jsx7(Text4, { size: "xs", c: "dimmed", children: language }) : null
|
|
163
279
|
] }),
|
|
164
|
-
withCopy ? /* @__PURE__ */
|
|
280
|
+
withCopy ? /* @__PURE__ */ jsx7(
|
|
165
281
|
ActionIcon2,
|
|
166
282
|
{
|
|
167
283
|
variant: "subtle",
|
|
@@ -169,18 +285,105 @@ function DocsCodeBlock({ code, language, title, withCopy = true }) {
|
|
|
169
285
|
onClick: () => {
|
|
170
286
|
void handleCopy();
|
|
171
287
|
},
|
|
172
|
-
children: /* @__PURE__ */
|
|
288
|
+
children: /* @__PURE__ */ jsx7(GdsIcons.Copy, { size: "1rem" })
|
|
173
289
|
}
|
|
174
290
|
) : null
|
|
175
291
|
] }) : null,
|
|
176
|
-
/* @__PURE__ */
|
|
292
|
+
/* @__PURE__ */ jsx7(Code, { block: true, children: code })
|
|
177
293
|
] }) });
|
|
178
294
|
}
|
|
179
295
|
|
|
296
|
+
// src/ShareButtonGroup.tsx
|
|
297
|
+
import { useState as useState3 } from "react";
|
|
298
|
+
import { ActionIcon as ActionIcon3, Button as Button2, Group as Group4, Stack as Stack3, Text as Text5 } from "@mantine/core";
|
|
299
|
+
import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
300
|
+
var channelLabels = {
|
|
301
|
+
native: "Share",
|
|
302
|
+
copy: "Copy link",
|
|
303
|
+
mail: "Email",
|
|
304
|
+
message: "Message",
|
|
305
|
+
x: "Share on X",
|
|
306
|
+
facebook: "Share on Facebook",
|
|
307
|
+
linkedin: "Share on LinkedIn",
|
|
308
|
+
whatsapp: "Share on WhatsApp",
|
|
309
|
+
telegram: "Share on Telegram"
|
|
310
|
+
};
|
|
311
|
+
function encodeShare(url, title, text) {
|
|
312
|
+
const safeUrl = encodeURIComponent(url);
|
|
313
|
+
const safeTitle = encodeURIComponent(title ?? "");
|
|
314
|
+
const safeText = encodeURIComponent(text ?? title ?? "");
|
|
315
|
+
return {
|
|
316
|
+
mail: `mailto:?subject=${safeTitle}&body=${safeText ? `${safeText}%0A%0A` : ""}${safeUrl}`,
|
|
317
|
+
message: `sms:?&body=${safeText ? `${safeText}%20` : ""}${safeUrl}`,
|
|
318
|
+
x: `https://x.com/intent/tweet?text=${safeText ? `${safeText}%20` : ""}${safeUrl}`,
|
|
319
|
+
facebook: `https://www.facebook.com/sharer/sharer.php?u=${safeUrl}`,
|
|
320
|
+
linkedin: `https://www.linkedin.com/sharing/share-offsite/?url=${safeUrl}`,
|
|
321
|
+
whatsapp: `https://wa.me/?text=${safeText ? `${safeText}%20` : ""}${safeUrl}`,
|
|
322
|
+
telegram: `https://t.me/share/url?url=${safeUrl}&text=${safeText}`
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
function ShareAction({
|
|
326
|
+
channel,
|
|
327
|
+
compact,
|
|
328
|
+
href,
|
|
329
|
+
onClick
|
|
330
|
+
}) {
|
|
331
|
+
const label = channelLabels[channel];
|
|
332
|
+
const Icon = channel === "copy" ? GdsIcons.Copy : channel === "mail" ? GdsIcons.Mail : channel === "message" ? GdsIcons.Message : GdsIcons.Refer;
|
|
333
|
+
if (compact) {
|
|
334
|
+
return href ? /* @__PURE__ */ jsx8(ActionIcon3, { component: "a", href, target: "_blank", rel: "noreferrer", variant: "subtle", size: "lg", "aria-label": label, children: /* @__PURE__ */ jsx8(Icon, { size: "1rem", stroke: 1.75 }) }) : /* @__PURE__ */ jsx8(ActionIcon3, { variant: "subtle", size: "lg", "aria-label": label, onClick, children: /* @__PURE__ */ jsx8(Icon, { size: "1rem", stroke: 1.75 }) });
|
|
335
|
+
}
|
|
336
|
+
return href ? /* @__PURE__ */ jsx8(Button2, { component: "a", href, target: "_blank", rel: "noreferrer", variant: "default", leftSection: /* @__PURE__ */ jsx8(Icon, { size: "1rem", stroke: 1.75 }), children: label }) : /* @__PURE__ */ jsx8(Button2, { variant: "default", leftSection: /* @__PURE__ */ jsx8(Icon, { size: "1rem", stroke: 1.75 }), onClick, children: label });
|
|
337
|
+
}
|
|
338
|
+
function ShareButtonGroup({
|
|
339
|
+
url,
|
|
340
|
+
title,
|
|
341
|
+
text,
|
|
342
|
+
channels = ["native", "copy", "mail"],
|
|
343
|
+
compact = false,
|
|
344
|
+
label = "Share this",
|
|
345
|
+
description
|
|
346
|
+
}) {
|
|
347
|
+
const [copied, setCopied] = useState3(false);
|
|
348
|
+
const [shared, setShared] = useState3(false);
|
|
349
|
+
const hrefs = encodeShare(url, title, text);
|
|
350
|
+
async function handleCopy() {
|
|
351
|
+
await navigator.clipboard?.writeText?.(url);
|
|
352
|
+
setCopied(true);
|
|
353
|
+
setTimeout(() => setCopied(false), 1800);
|
|
354
|
+
}
|
|
355
|
+
async function handleNativeShare() {
|
|
356
|
+
if (navigator.share) {
|
|
357
|
+
await navigator.share({ url, title, text });
|
|
358
|
+
setShared(true);
|
|
359
|
+
setTimeout(() => setShared(false), 1800);
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
362
|
+
await handleCopy();
|
|
363
|
+
}
|
|
364
|
+
return /* @__PURE__ */ jsxs5(Stack3, { gap: "sm", children: [
|
|
365
|
+
/* @__PURE__ */ jsxs5(Stack3, { gap: 2, children: [
|
|
366
|
+
/* @__PURE__ */ jsx8(Text5, { fw: 600, children: label }),
|
|
367
|
+
description ? /* @__PURE__ */ jsx8(Text5, { size: "sm", c: "dimmed", children: description }) : null
|
|
368
|
+
] }),
|
|
369
|
+
/* @__PURE__ */ jsx8(Group4, { gap: "sm", wrap: "wrap", children: channels.map((channel) => {
|
|
370
|
+
if (channel === "copy") {
|
|
371
|
+
return /* @__PURE__ */ jsx8(ShareAction, { channel, compact, onClick: () => void handleCopy() }, channel);
|
|
372
|
+
}
|
|
373
|
+
if (channel === "native") {
|
|
374
|
+
return /* @__PURE__ */ jsx8(ShareAction, { channel, compact, onClick: () => void handleNativeShare() }, channel);
|
|
375
|
+
}
|
|
376
|
+
return /* @__PURE__ */ jsx8(ShareAction, { channel, compact, href: hrefs[channel] }, channel);
|
|
377
|
+
}) }),
|
|
378
|
+
copied ? /* @__PURE__ */ jsx8(Text5, { size: "sm", c: "teal", children: "Link copied." }) : null,
|
|
379
|
+
shared ? /* @__PURE__ */ jsx8(Text5, { size: "sm", c: "teal", children: "Share sheet opened." }) : null
|
|
380
|
+
] });
|
|
381
|
+
}
|
|
382
|
+
|
|
180
383
|
// src/UploadDropzone.tsx
|
|
181
|
-
import { useRef, useState as
|
|
182
|
-
import { Box, Button as
|
|
183
|
-
import { jsx as
|
|
384
|
+
import { useRef, useState as useState4 } from "react";
|
|
385
|
+
import { Box as Box3, Button as Button3, Group as Group5, Stack as Stack4, Text as Text6 } from "@mantine/core";
|
|
386
|
+
import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
184
387
|
function UploadDropzone({
|
|
185
388
|
title,
|
|
186
389
|
description,
|
|
@@ -191,7 +394,7 @@ function UploadDropzone({
|
|
|
191
394
|
mode = "panel"
|
|
192
395
|
}) {
|
|
193
396
|
const inputRef = useRef(null);
|
|
194
|
-
const [dragging, setDragging] =
|
|
397
|
+
const [dragging, setDragging] = useState4(false);
|
|
195
398
|
const UploadIcon = GdsIcons.Upload;
|
|
196
399
|
const forwardFiles = (files) => {
|
|
197
400
|
if (!files?.length || !onFilesSelected) {
|
|
@@ -199,8 +402,8 @@ function UploadDropzone({
|
|
|
199
402
|
}
|
|
200
403
|
onFilesSelected(Array.from(files));
|
|
201
404
|
};
|
|
202
|
-
return /* @__PURE__ */
|
|
203
|
-
|
|
405
|
+
return /* @__PURE__ */ jsxs6(
|
|
406
|
+
Box3,
|
|
204
407
|
{
|
|
205
408
|
onDragOver: (event) => {
|
|
206
409
|
event.preventDefault();
|
|
@@ -219,7 +422,7 @@ function UploadDropzone({
|
|
|
219
422
|
background: dragging ? "var(--mantine-color-violet-light)" : "transparent"
|
|
220
423
|
},
|
|
221
424
|
children: [
|
|
222
|
-
/* @__PURE__ */
|
|
425
|
+
/* @__PURE__ */ jsx9(
|
|
223
426
|
"input",
|
|
224
427
|
{
|
|
225
428
|
ref: inputRef,
|
|
@@ -230,11 +433,11 @@ function UploadDropzone({
|
|
|
230
433
|
onChange: (event) => forwardFiles(event.currentTarget.files)
|
|
231
434
|
}
|
|
232
435
|
),
|
|
233
|
-
/* @__PURE__ */
|
|
234
|
-
/* @__PURE__ */
|
|
235
|
-
/* @__PURE__ */
|
|
236
|
-
description ? /* @__PURE__ */
|
|
237
|
-
/* @__PURE__ */
|
|
436
|
+
/* @__PURE__ */ jsxs6(Stack4, { align: mode === "inline" ? "flex-start" : "center", ta: mode === "inline" ? "left" : "center", gap: "sm", children: [
|
|
437
|
+
/* @__PURE__ */ jsx9(UploadIcon, { size: "1.5rem" }),
|
|
438
|
+
/* @__PURE__ */ jsx9(Text6, { fw: 600, children: title }),
|
|
439
|
+
description ? /* @__PURE__ */ jsx9(Text6, { size: "sm", c: "dimmed", children: description }) : null,
|
|
440
|
+
/* @__PURE__ */ jsx9(Group5, { children: /* @__PURE__ */ jsx9(Button3, { variant: "light", onClick: () => inputRef.current?.click(), children: actionLabel }) })
|
|
238
441
|
] })
|
|
239
442
|
]
|
|
240
443
|
}
|
|
@@ -242,9 +445,9 @@ function UploadDropzone({
|
|
|
242
445
|
}
|
|
243
446
|
|
|
244
447
|
// src/AccessRecoveryPanel.tsx
|
|
245
|
-
import { Group as
|
|
246
|
-
import { useGdsTranslation as
|
|
247
|
-
import { jsx as
|
|
448
|
+
import { Group as Group6 } from "@mantine/core";
|
|
449
|
+
import { useGdsTranslation as useGdsTranslation4 } from "@doneisbetter/gds-theme";
|
|
450
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
248
451
|
var stateBlockVariantByState = {
|
|
249
452
|
unauthenticated: "permission",
|
|
250
453
|
"expired-session": "info",
|
|
@@ -313,7 +516,7 @@ function ActionGroup({
|
|
|
313
516
|
if (actions.length === 0) {
|
|
314
517
|
return null;
|
|
315
518
|
}
|
|
316
|
-
return /* @__PURE__ */
|
|
519
|
+
return /* @__PURE__ */ jsx10(Group6, { gap: "sm", justify: "center", wrap: "wrap", children: actions.map((actionConfig, index) => /* @__PURE__ */ jsx10(
|
|
317
520
|
SemanticButton,
|
|
318
521
|
{
|
|
319
522
|
action: actionConfig.action,
|
|
@@ -339,7 +542,7 @@ function AccessRecoveryPanel({
|
|
|
339
542
|
supportAction,
|
|
340
543
|
compact = false
|
|
341
544
|
}) {
|
|
342
|
-
const { t } =
|
|
545
|
+
const { t } = useGdsTranslation4();
|
|
343
546
|
const defaultCopy = defaultCopyByState[state];
|
|
344
547
|
const defaults = defaultActionsForState(state, {
|
|
345
548
|
onRetry,
|
|
@@ -347,14 +550,14 @@ function AccessRecoveryPanel({
|
|
|
347
550
|
onBack,
|
|
348
551
|
supportAction
|
|
349
552
|
});
|
|
350
|
-
return /* @__PURE__ */
|
|
553
|
+
return /* @__PURE__ */ jsx10(
|
|
351
554
|
StateBlock,
|
|
352
555
|
{
|
|
353
556
|
variant: stateBlockVariantByState[state],
|
|
354
557
|
compact,
|
|
355
558
|
title: title ?? t(`gds.accessRecovery.${state}.title`, defaultCopy.title),
|
|
356
559
|
description: description ?? t(`gds.accessRecovery.${state}.description`, defaultCopy.description),
|
|
357
|
-
action: /* @__PURE__ */
|
|
560
|
+
action: /* @__PURE__ */ jsx10(
|
|
358
561
|
ActionGroup,
|
|
359
562
|
{
|
|
360
563
|
primaryAction: primaryAction ?? defaults.primary,
|
|
@@ -371,7 +574,12 @@ export {
|
|
|
371
574
|
ConfirmDialog,
|
|
372
575
|
ThemeToggle,
|
|
373
576
|
GameBoardTile,
|
|
577
|
+
DiscoveryShell,
|
|
578
|
+
SidebarNav,
|
|
579
|
+
SidebarNavSection,
|
|
580
|
+
SidebarNavItem,
|
|
374
581
|
DocsCodeBlock,
|
|
582
|
+
ShareButtonGroup,
|
|
375
583
|
UploadDropzone,
|
|
376
584
|
AccessRecoveryPanel
|
|
377
585
|
};
|
package/dist/client.d.mts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { SemanticAction } from './server.mjs';
|
|
2
|
-
export { AccentPanel, AccentPanelProps, AccentPanelVariant, AccentTone, AccessSummary, AccessSummaryProps, ArticleShell, ArticleShellProps, AuthShell, AuthShellProps, BreadcrumbItem, BrowseSurface, BrowseSurfaceFilterChip, BrowseSurfaceProps, BrowseSurfaceScopeOption, ChoiceChip, ChoiceChipProps, ConsumerDashboardGrid, ConsumerDashboardGridProps, ConsumerSection, ConsumerSectionProps, CtaButtonGroup, CtaButtonGroupProps, DataToolbar, DataToolbarFilterChip, DataToolbarProps, DocsPageShell, DocsPageShellProps, EditorialCard, EditorialCardProps, EditorialHero, EditorialHeroAction, EditorialHeroMetaItem, EditorialHeroProps, EmptyState, EmptyStateProps, FeatureBand, FeatureBandItem, FeatureBandProps, FilterDrawer, FilterDrawerMode, FilterDrawerProps, FormField, FormFieldProps, GdsIcons, GdsLocale, GdsVocabulary, MediaCard, MediaCardAction, MediaCardProps, MediaField, MediaFieldProps, MetricCard, MetricCardProps, PageHeader, PageHeaderEyebrowVariant, PageHeaderProps, PlaceholderPanel, PlaceholderPanelProps, ProductCard, ProductCardAction, ProductCardMetaItem, ProductCardProps, ProgressCard, ProgressCardProps, PublicBrandFooter, PublicBrandFooterClassNames, PublicBrandFooterLayoutVariant, PublicBrandFooterProps, PublicNav, PublicNavItem, PublicNavProps, PublicProductCard, PublicProductCardHelperKind, PublicProductCardMetaItem, PublicProductCardProps, PublicProductCardState, PublicShell, PublicShellClassNames, PublicShellHeaderVariant, PublicShellMobileNavigationMode, PublicShellProps, PublicSiteFooter, PublicSiteFooterProps, SectionPanel, SectionPanelProps, SectionPanelTone, SimpleDataTable, SimpleDataTableProps, SimpleTableColumn, StateBlock, StateBlockProps, StateBlockVariant, StatsSection, StatsSectionProps, StatusBadge, StatusBadgeProps, StatusVariant, ar, de, en, es, fr, gdsLocales, getGdsMessages, getSemanticActionConfig, getSemanticActionLabel, he, hu, it, resolveAccentPanelStyles, ru } from './server.mjs';
|
|
1
|
+
import { b2 as SemanticAction, b4 as SemanticActionId, a7 as GdsVocabularyPack } from './server-BqFksoV3.mjs';
|
|
2
|
+
export { A as AccentPanel, a as AccentPanelProps, b as AccentPanelVariant, c as AccentTone, d as AccessSummary, e as AccessSummaryProps, f as ActionBar, g as ActionBarAction, h as ActionBarIconAction, i as ActionBarProps, j as ArticleShell, k as ArticleShellProps, l as AuthShell, m as AuthShellProps, B as BreadcrumbItem, n as BrowseSurface, o as BrowseSurfaceFilterChip, p as BrowseSurfaceProps, q as BrowseSurfaceScopeOption, C as ChoiceChip, r as ChoiceChipProps, s as ConsumerDashboardGrid, t as ConsumerDashboardGridProps, u as ConsumerSection, v as ConsumerSectionProps, w as CtaButtonGroup, x as CtaButtonGroupProps, D as DataToolbar, y as DataToolbarFilterChip, z as DataToolbarProps, E as DetailProfileShell, F as DetailProfileShellProps, G as DocsPageShell, H as DocsPageShellProps, I as EditorialCard, J as EditorialCardProps, K as EditorialHero, L as EditorialHeroAction, M as EditorialHeroMetaItem, N as EditorialHeroProps, O as EmptyState, P as EmptyStateProps, Q as FeatureBand, R as FeatureBandItem, S as FeatureBandProps, T as FilterDrawer, U as FilterDrawerMode, V as FilterDrawerProps, W as FoodCardAvailabilityState, X as FoodCardMarker, Y as FoodCardMediaRatio, Z as FoodCardMetadata, _ as FoodMenuCategory, $ as FoodMenuItem, a0 as FoodMenuSection, a1 as FoodMenuSectionProps, a2 as FormField, a3 as FormFieldProps, a4 as GdsIcons, a5 as GdsLocale, a6 as GdsVocabulary, a8 as ListingCard, a9 as ListingCardAffordance, aa as ListingCardMediaRatio, ab as ListingCardProps, ac as ListingMetadataRow, ad as MapPanel, ae as MapPanelProps, af as MediaCard, ag as MediaCardAction, ah as MediaCardProps, ai as MediaField, aj as MediaFieldProps, ak as MetricCard, al as MetricCardProps, am as PageHeader, an as PageHeaderEyebrowVariant, ao as PageHeaderProps, ap as PlaceholderPanel, aq as PlaceholderPanelProps, ar as PlaybackSurface, as as PlaybackSurfaceProps, at as PlaybackSurfaceState, au as ProductCard, av as ProductCardAction, aw as ProductCardMetaItem, ax as ProductCardProps, ay as ProgressCard, az as ProgressCardProps, aA as PublicBrandFooter, aB as PublicBrandFooterClassNames, aC as PublicBrandFooterLayoutVariant, aD as PublicBrandFooterProps, aE as PublicFlowAction, aF as PublicFlowActionPriority, aG as PublicFlowShell, aH as PublicFlowShellProps, aI as PublicFlowStage, aJ as PublicFlowStageStatus, aK as PublicFoodCard, aL as PublicFoodCardProps, aM as PublicNav, aN as PublicNavItem, aO as PublicNavProps, aP as PublicProductCard, aQ as PublicProductCardHelperKind, aR as PublicProductCardMetaItem, aS as PublicProductCardProps, aT as PublicProductCardState, aU as PublicShell, aV as PublicShellClassNames, aW as PublicShellHeaderVariant, aX as PublicShellMobileNavigationMode, aY as PublicShellProps, aZ as PublicSiteFooter, a_ as PublicSiteFooterProps, a$ as SectionPanel, b0 as SectionPanelProps, b1 as SectionPanelTone, b3 as SemanticActionDefinition, b5 as SimpleDataTable, b6 as SimpleDataTableProps, b7 as SimpleTableColumn, b8 as SocialAuthButtons, b9 as SocialAuthButtonsProps, ba as SocialAuthProviderId, bb as SocialAuthProviderOption, bc as StateBlock, bd as StateBlockProps, be as StateBlockVariant, bf as StatsSection, bg as StatsSectionProps, bh as StatusBadge, bi as StatusBadgeProps, bj as StatusVariant, bk as VocabularyResolver, bl as ar, bm as createGdsVocabularyPack, bn as de, bo as en, bp as es, bq as fr, br as gdsLocales, bs as getGdsMessages, bt as getSemanticActionConfig, bu as getSemanticActionLabel, bv as he, bw as hu, bx as it, by as mergeGdsVocabularyPacks, bz as resolveAccentPanelStyles, bA as resolveSemanticActionConfig, bB as ru } from './server-BqFksoV3.mjs';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
+
import * as react from 'react';
|
|
4
5
|
import react__default, { ReactNode } from 'react';
|
|
5
|
-
import
|
|
6
|
+
import * as _mantine_core from '@mantine/core';
|
|
7
|
+
import { ButtonProps, MantineColor, MantineSpacing, MantineBreakpoint, NavLinkProps } from '@mantine/core';
|
|
6
8
|
import '@tabler/icons-react';
|
|
7
9
|
|
|
8
10
|
interface ConfirmDialogProps {
|
|
@@ -31,17 +33,14 @@ interface ThemeToggleProps {
|
|
|
31
33
|
declare function ThemeToggle({ size }: ThemeToggleProps): react_jsx_runtime.JSX.Element;
|
|
32
34
|
|
|
33
35
|
interface SemanticButtonProps extends ButtonProps, Omit<react__default.ComponentPropsWithoutRef<'button'>, keyof ButtonProps | 'leftSection' | 'children'> {
|
|
34
|
-
action:
|
|
36
|
+
action: SemanticActionId;
|
|
35
37
|
loading?: boolean;
|
|
36
38
|
feedbackState?: 'success' | 'error' | null;
|
|
37
39
|
feedbackText?: string;
|
|
38
40
|
prerenderLabelOnly?: boolean;
|
|
41
|
+
vocabularyPacks?: GdsVocabularyPack[];
|
|
39
42
|
}
|
|
40
|
-
|
|
41
|
-
* SemanticButton strictly enforces ubiquitous language and standardized iconography.
|
|
42
|
-
* Developers cannot pass arbitrary text or icons; they must use a semantic action key.
|
|
43
|
-
*/
|
|
44
|
-
declare function SemanticButton({ action, loading, feedbackState, feedbackText, prerenderLabelOnly, ...props }: SemanticButtonProps): react_jsx_runtime.JSX.Element;
|
|
43
|
+
declare function SemanticButton({ action, loading, feedbackState, feedbackText, prerenderLabelOnly, vocabularyPacks, ...props }: SemanticButtonProps): react_jsx_runtime.JSX.Element;
|
|
45
44
|
|
|
46
45
|
interface GameBoardTileProps {
|
|
47
46
|
face: ReactNode;
|
|
@@ -58,6 +57,57 @@ interface GameBoardTileProps {
|
|
|
58
57
|
*/
|
|
59
58
|
declare function GameBoardTile({ face, revealed, matched, disabled, onPress, highlightColor, }: GameBoardTileProps): react_jsx_runtime.JSX.Element;
|
|
60
59
|
|
|
60
|
+
interface DiscoveryShellProps {
|
|
61
|
+
header?: ReactNode;
|
|
62
|
+
sidebar: ReactNode;
|
|
63
|
+
footer?: ReactNode;
|
|
64
|
+
children: ReactNode;
|
|
65
|
+
mobileNavigationLabel?: string;
|
|
66
|
+
defaultSidebarOpen?: boolean;
|
|
67
|
+
stickySidebar?: boolean;
|
|
68
|
+
sidebarWidth?: number | string;
|
|
69
|
+
headerHeight?: number | string;
|
|
70
|
+
shellPadding?: MantineSpacing | number;
|
|
71
|
+
collapseBreakpoint?: MantineBreakpoint;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* DiscoveryShell is the canonical sidebar-first application shell for GDS.
|
|
75
|
+
* It owns the responsive header, sidebar, and main-content layout contract.
|
|
76
|
+
*/
|
|
77
|
+
declare function DiscoveryShell({ header, sidebar, footer, children, mobileNavigationLabel, defaultSidebarOpen, stickySidebar, sidebarWidth, headerHeight, shellPadding, collapseBreakpoint, }: DiscoveryShellProps): react_jsx_runtime.JSX.Element;
|
|
78
|
+
|
|
79
|
+
interface SidebarNavProps {
|
|
80
|
+
children: ReactNode;
|
|
81
|
+
ariaLabel?: string;
|
|
82
|
+
gap?: string | number;
|
|
83
|
+
}
|
|
84
|
+
interface SidebarNavSectionProps {
|
|
85
|
+
label?: ReactNode;
|
|
86
|
+
children: ReactNode;
|
|
87
|
+
pushToBottom?: boolean;
|
|
88
|
+
}
|
|
89
|
+
interface SidebarNavItemProps extends Omit<NavLinkProps, 'label' | 'leftSection' | 'description'> {
|
|
90
|
+
action?: SemanticActionId;
|
|
91
|
+
label?: ReactNode;
|
|
92
|
+
description?: ReactNode;
|
|
93
|
+
badge?: ReactNode;
|
|
94
|
+
icon?: ReactNode;
|
|
95
|
+
'aria-label'?: string;
|
|
96
|
+
'aria-current'?: 'page' | 'step' | 'location' | 'date' | 'time' | 'true' | 'false';
|
|
97
|
+
vocabularyPacks?: GdsVocabularyPack[];
|
|
98
|
+
}
|
|
99
|
+
declare function SidebarNav({ children, ariaLabel, gap }: SidebarNavProps): react_jsx_runtime.JSX.Element;
|
|
100
|
+
declare function SidebarNavSection({ label, children, pushToBottom }: SidebarNavSectionProps): react_jsx_runtime.JSX.Element;
|
|
101
|
+
declare const SidebarNavItem: (<C = "a">(props: _mantine_core.PolymorphicComponentProps<C, SidebarNavItemProps>) => React.ReactElement) & Omit<react.FunctionComponent<(SidebarNavItemProps & {
|
|
102
|
+
component?: any;
|
|
103
|
+
} & Omit<Omit<any, "ref">, "component" | keyof SidebarNavItemProps> & {
|
|
104
|
+
ref?: any;
|
|
105
|
+
renderRoot?: (props: any) => any;
|
|
106
|
+
}) | (SidebarNavItemProps & {
|
|
107
|
+
component: React.ElementType;
|
|
108
|
+
renderRoot?: (props: Record<string, any>) => any;
|
|
109
|
+
})>, never> & Record<string, never>;
|
|
110
|
+
|
|
61
111
|
interface DocsCodeBlockProps {
|
|
62
112
|
code: string;
|
|
63
113
|
language?: string;
|
|
@@ -66,6 +116,18 @@ interface DocsCodeBlockProps {
|
|
|
66
116
|
}
|
|
67
117
|
declare function DocsCodeBlock({ code, language, title, withCopy }: DocsCodeBlockProps): react_jsx_runtime.JSX.Element;
|
|
68
118
|
|
|
119
|
+
type ShareChannel = 'native' | 'copy' | 'mail' | 'message' | 'x' | 'facebook' | 'linkedin' | 'whatsapp' | 'telegram';
|
|
120
|
+
interface ShareButtonGroupProps {
|
|
121
|
+
url: string;
|
|
122
|
+
title?: string;
|
|
123
|
+
text?: string;
|
|
124
|
+
channels?: ShareChannel[];
|
|
125
|
+
compact?: boolean;
|
|
126
|
+
label?: ReactNode;
|
|
127
|
+
description?: ReactNode;
|
|
128
|
+
}
|
|
129
|
+
declare function ShareButtonGroup({ url, title, text, channels, compact, label, description, }: ShareButtonGroupProps): react_jsx_runtime.JSX.Element;
|
|
130
|
+
|
|
69
131
|
interface UploadDropzoneProps {
|
|
70
132
|
title: string;
|
|
71
133
|
description?: string;
|
|
@@ -101,4 +163,4 @@ interface AccessRecoveryPanelProps {
|
|
|
101
163
|
}
|
|
102
164
|
declare function AccessRecoveryPanel({ state, title, description, primaryAction, secondaryAction, tertiaryAction, onRetry, onSignIn, onBack, supportAction, compact, }: AccessRecoveryPanelProps): react_jsx_runtime.JSX.Element;
|
|
103
165
|
|
|
104
|
-
export { type AccessRecoveryAction, AccessRecoveryPanel, type AccessRecoveryPanelProps, type AccessRecoveryState, ConfirmDialog, type ConfirmDialogProps, DocsCodeBlock, type DocsCodeBlockProps, GameBoardTile, type GameBoardTileProps, SemanticAction, SemanticButton, type SemanticButtonProps, ThemeToggle, type ThemeToggleProps, UploadDropzone, type UploadDropzoneProps };
|
|
166
|
+
export { type AccessRecoveryAction, AccessRecoveryPanel, type AccessRecoveryPanelProps, type AccessRecoveryState, ConfirmDialog, type ConfirmDialogProps, DiscoveryShell, type DiscoveryShellProps, DocsCodeBlock, type DocsCodeBlockProps, GameBoardTile, type GameBoardTileProps, GdsVocabularyPack, SemanticAction, SemanticActionId, SemanticButton, type SemanticButtonProps, ShareButtonGroup, type ShareButtonGroupProps, type ShareChannel, SidebarNav, SidebarNavItem, type SidebarNavItemProps, type SidebarNavProps, SidebarNavSection, type SidebarNavSectionProps, ThemeToggle, type ThemeToggleProps, UploadDropzone, type UploadDropzoneProps };
|