@doneisbetter/gds-core 2.6.6 → 2.6.7
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-4YTMKBGW.mjs → chunk-IUYPELGQ.mjs} +193 -70
- package/dist/{chunk-IAP3JU55.mjs → chunk-LH2KMMXT.mjs} +483 -272
- package/dist/client.d.mts +17 -3
- package/dist/client.d.ts +17 -3
- package/dist/client.js +710 -365
- package/dist/client.mjs +16 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +710 -365
- package/dist/index.mjs +16 -2
- package/dist/{server-CF4gCYQ-.d.mts → server-BSuY9Qx6.d.mts} +92 -6
- package/dist/{server-CF4gCYQ-.d.ts → server-BSuY9Qx6.d.ts} +92 -6
- package/dist/server.d.mts +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.js +491 -270
- package/dist/server.mjs +13 -1
- package/package.json +2 -2
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
StateBlock,
|
|
8
8
|
getSemanticActionLabel,
|
|
9
9
|
resolveSemanticActionConfig
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-LH2KMMXT.mjs";
|
|
11
11
|
|
|
12
12
|
// src/SemanticButton.tsx
|
|
13
13
|
import { useEffect, useState } from "react";
|
|
@@ -141,42 +141,60 @@ import {
|
|
|
141
141
|
gdsTheme
|
|
142
142
|
} from "@doneisbetter/gds-theme";
|
|
143
143
|
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
144
|
+
function resolvePreviewColorScheme(presetId, requestedScheme) {
|
|
145
|
+
if (presetId === "dark-public") {
|
|
146
|
+
return "dark";
|
|
147
|
+
}
|
|
148
|
+
return requestedScheme;
|
|
149
|
+
}
|
|
144
150
|
var themePresetCatalog = {
|
|
145
151
|
default: {
|
|
146
152
|
label: "Default runtime theme",
|
|
147
153
|
bestFor: "Balanced multi-surface products that need the baseline GDS system.",
|
|
148
154
|
summary: "The default shared runtime lane for most adopters.",
|
|
149
|
-
themeKey: "gdsTheme"
|
|
155
|
+
themeKey: "gdsTheme",
|
|
156
|
+
supportedUse: "Starter products, hybrid public/admin apps, and teams adopting all canonical contracts.",
|
|
157
|
+
avoidFor: "Avoid for products requiring a distinct editorial voice or guaranteed dark-first brand contrast."
|
|
150
158
|
},
|
|
151
159
|
"dark-public": {
|
|
152
160
|
label: "Dark public theme",
|
|
153
161
|
bestFor: "Dark-first public experiences and campaign-style landing surfaces.",
|
|
154
162
|
summary: "A darker public presentation lane with the shipped runtime rhythm intact.",
|
|
155
|
-
themeKey: "gdsDarkPublicTheme"
|
|
163
|
+
themeKey: "gdsDarkPublicTheme",
|
|
164
|
+
supportedUse: "Products with a deliberate dark visual baseline, low-light UX, or premium media-first surfaces.",
|
|
165
|
+
avoidFor: "Avoid when mixed mode and editorial readability are core requirements."
|
|
156
166
|
},
|
|
157
167
|
"flat-surface": {
|
|
158
168
|
label: "Flat surface theme",
|
|
159
169
|
bestFor: "Operational products that prefer quieter elevation and flatter surface contrast.",
|
|
160
170
|
summary: "Removes some visual weight without creating a second token authority.",
|
|
161
|
-
themeKey: "gdsFlatSurfaceTheme"
|
|
171
|
+
themeKey: "gdsFlatSurfaceTheme",
|
|
172
|
+
supportedUse: "Dashboards, admin surfaces, and dense content where elevation becomes distracting.",
|
|
173
|
+
avoidFor: "Avoid for brand-first storytelling or high-expressiveness hero-first pages."
|
|
162
174
|
},
|
|
163
175
|
editorial: {
|
|
164
176
|
label: "Editorial serif theme",
|
|
165
177
|
bestFor: "Documentation, editorial, and content-led experiences.",
|
|
166
178
|
summary: "Adds a more expressive public reading tone while staying inside GDS contracts.",
|
|
167
|
-
themeKey: "gdsEditorialPublicTheme"
|
|
179
|
+
themeKey: "gdsEditorialPublicTheme",
|
|
180
|
+
supportedUse: "Guides, docs, and catalog content where reading comfort matters more than impact.",
|
|
181
|
+
avoidFor: "Avoid for dense transactional or data-first workflows with strict minimal contrast."
|
|
168
182
|
},
|
|
169
183
|
brand: {
|
|
170
184
|
label: "Brand theme generator",
|
|
171
185
|
bestFor: "Consumer teams that need controlled brand expression without forking the system.",
|
|
172
186
|
summary: "Composes the shipped helpers into a governed product-authored theme lane.",
|
|
173
|
-
themeKey: "createPublicBrandTheme(...)"
|
|
187
|
+
themeKey: "createPublicBrandTheme(...)",
|
|
188
|
+
supportedUse: "Whitelisted public branding programs with narrow product-authored intent and policy guardrails.",
|
|
189
|
+
avoidFor: "Avoid for local style experiments or temporary visual fixes without compliance approval."
|
|
174
190
|
}
|
|
175
191
|
};
|
|
176
192
|
function ThemePreviewSurface({
|
|
177
193
|
preset,
|
|
178
|
-
colorScheme
|
|
194
|
+
colorScheme,
|
|
195
|
+
requestedColorScheme
|
|
179
196
|
}) {
|
|
197
|
+
const forcedScheme = requestedColorScheme && requestedColorScheme !== colorScheme;
|
|
180
198
|
return /* @__PURE__ */ jsx4(Paper, { withBorder: true, radius: "xl", p: "lg", children: /* @__PURE__ */ jsxs2(Stack, { gap: "lg", children: [
|
|
181
199
|
/* @__PURE__ */ jsxs2(Group2, { justify: "space-between", align: "flex-start", wrap: "wrap", children: [
|
|
182
200
|
/* @__PURE__ */ jsxs2(Stack, { gap: 4, children: [
|
|
@@ -191,7 +209,8 @@ function ThemePreviewSurface({
|
|
|
191
209
|
/* @__PURE__ */ jsx4("strong", { children: "Color scheme:" }),
|
|
192
210
|
" ",
|
|
193
211
|
colorScheme
|
|
194
|
-
] })
|
|
212
|
+
] }),
|
|
213
|
+
forcedScheme ? /* @__PURE__ */ jsx4(Text2, { size: "sm", c: "dimmed", children: "This lane always previews in dark mode so the runtime stays inside its sanctioned contrast contract." }) : null
|
|
195
214
|
] }),
|
|
196
215
|
/* @__PURE__ */ jsx4(ThemeToggle, {})
|
|
197
216
|
] }),
|
|
@@ -258,8 +277,10 @@ function ReferenceThemeExplorer() {
|
|
|
258
277
|
const comparisonSummary = themePresetCatalog[comparisonPreset];
|
|
259
278
|
const selectedTheme = useMemo(() => resolveTheme(preset), [preset, brandPrimary, brandFlatSurfaces, brandEditorialSerif]);
|
|
260
279
|
const comparedTheme = useMemo(() => resolveTheme(comparisonPreset), [comparisonPreset, brandPrimary, brandFlatSurfaces, brandEditorialSerif]);
|
|
261
|
-
const
|
|
262
|
-
const
|
|
280
|
+
const effectiveColorScheme = resolvePreviewColorScheme(preset, colorScheme);
|
|
281
|
+
const effectiveComparisonScheme = resolvePreviewColorScheme(comparisonPreset, colorScheme);
|
|
282
|
+
const previewKey = `${preset}-${effectiveColorScheme}-${brandPrimary}-${brandFlatSurfaces}-${brandEditorialSerif}`;
|
|
283
|
+
const comparisonPreviewKey = `${comparisonPreset}-${effectiveComparisonScheme}-${brandPrimary}-${brandFlatSurfaces}-${brandEditorialSerif}`;
|
|
263
284
|
const reset = () => {
|
|
264
285
|
setPreset("default");
|
|
265
286
|
setColorScheme("light");
|
|
@@ -354,7 +375,8 @@ function ReferenceThemeExplorer() {
|
|
|
354
375
|
/* @__PURE__ */ jsx4("strong", { children: "Color scheme:" }),
|
|
355
376
|
" ",
|
|
356
377
|
colorScheme
|
|
357
|
-
] })
|
|
378
|
+
] }),
|
|
379
|
+
preset === "dark-public" && colorScheme !== effectiveColorScheme ? /* @__PURE__ */ jsx4(Text2, { size: "sm", c: "dimmed", children: "gdsDarkPublicTheme always renders in dark mode inside the live preview." }) : null
|
|
358
380
|
] }),
|
|
359
381
|
/* @__PURE__ */ jsx4(
|
|
360
382
|
Checkbox,
|
|
@@ -387,7 +409,17 @@ function ReferenceThemeExplorer() {
|
|
|
387
409
|
children: /* @__PURE__ */ jsx4(SimpleGrid, { cols: { base: 1, md: 2, xl: 5 }, spacing: "md", children: Object.values(themePresetCatalog).map((lane) => /* @__PURE__ */ jsx4(Paper, { withBorder: true, radius: "lg", p: "md", children: /* @__PURE__ */ jsxs2(Stack, { gap: 6, children: [
|
|
388
410
|
/* @__PURE__ */ jsx4(Text2, { fw: 700, size: "sm", children: lane.label }),
|
|
389
411
|
/* @__PURE__ */ jsx4(Text2, { size: "sm", c: "dimmed", children: lane.summary }),
|
|
390
|
-
/* @__PURE__ */
|
|
412
|
+
/* @__PURE__ */ jsxs2(Text2, { size: "xs", children: [
|
|
413
|
+
/* @__PURE__ */ jsx4("strong", { children: "Best for:" }),
|
|
414
|
+
" ",
|
|
415
|
+
lane.supportedUse
|
|
416
|
+
] }),
|
|
417
|
+
/* @__PURE__ */ jsx4(Code, { block: true, fz: "10px", children: lane.themeKey }),
|
|
418
|
+
/* @__PURE__ */ jsxs2(Text2, { size: "xs", c: "dimmed", children: [
|
|
419
|
+
/* @__PURE__ */ jsx4("strong", { children: "Avoid for:" }),
|
|
420
|
+
" ",
|
|
421
|
+
lane.avoidFor ?? "No special exclusion noted for this lane."
|
|
422
|
+
] })
|
|
391
423
|
] }) }, lane.themeKey)) })
|
|
392
424
|
}
|
|
393
425
|
),
|
|
@@ -397,8 +429,15 @@ function ReferenceThemeExplorer() {
|
|
|
397
429
|
title: "Live Theme Preview",
|
|
398
430
|
description: "Visitors can test the shipped presets, compare lanes, and inspect actual GDS surfaces under each theme.",
|
|
399
431
|
children: /* @__PURE__ */ jsxs2(SimpleGrid, { cols: { base: 1, xl: comparisonEnabled ? 2 : 1 }, spacing: "lg", children: [
|
|
400
|
-
/* @__PURE__ */ jsx4(GdsProvider, { theme: selectedTheme, defaultColorScheme:
|
|
401
|
-
|
|
432
|
+
/* @__PURE__ */ jsx4(GdsProvider, { theme: selectedTheme, defaultColorScheme: effectiveColorScheme, children: /* @__PURE__ */ jsx4(
|
|
433
|
+
ThemePreviewSurface,
|
|
434
|
+
{
|
|
435
|
+
preset: selectionSummary,
|
|
436
|
+
colorScheme: effectiveColorScheme,
|
|
437
|
+
requestedColorScheme: colorScheme
|
|
438
|
+
}
|
|
439
|
+
) }, previewKey),
|
|
440
|
+
comparisonEnabled ? /* @__PURE__ */ jsx4(GdsProvider, { theme: comparedTheme, defaultColorScheme: effectiveComparisonScheme, children: /* @__PURE__ */ jsx4(Paper, { withBorder: true, radius: "xl", p: "lg", children: /* @__PURE__ */ jsxs2(Stack, { gap: "md", children: [
|
|
402
441
|
/* @__PURE__ */ jsxs2(Group2, { justify: "space-between", align: "flex-start", wrap: "wrap", children: [
|
|
403
442
|
/* @__PURE__ */ jsxs2(Stack, { gap: 4, children: [
|
|
404
443
|
/* @__PURE__ */ jsx4(Text2, { fw: 700, children: "Comparison Preview Surface" }),
|
|
@@ -406,7 +445,14 @@ function ReferenceThemeExplorer() {
|
|
|
406
445
|
] }),
|
|
407
446
|
/* @__PURE__ */ jsx4(Badge, { color: "violet", variant: "light", children: comparisonSummary.label })
|
|
408
447
|
] }),
|
|
409
|
-
/* @__PURE__ */ jsx4(
|
|
448
|
+
/* @__PURE__ */ jsx4(
|
|
449
|
+
ThemePreviewSurface,
|
|
450
|
+
{
|
|
451
|
+
preset: comparisonSummary,
|
|
452
|
+
colorScheme: effectiveComparisonScheme,
|
|
453
|
+
requestedColorScheme: colorScheme
|
|
454
|
+
}
|
|
455
|
+
)
|
|
410
456
|
] }) }) }, comparisonPreviewKey) : null
|
|
411
457
|
] })
|
|
412
458
|
}
|
|
@@ -529,18 +575,94 @@ function DiscoveryShell({
|
|
|
529
575
|
);
|
|
530
576
|
}
|
|
531
577
|
|
|
578
|
+
// src/DocsShell.tsx
|
|
579
|
+
import { useState as useState3 } from "react";
|
|
580
|
+
import { Box as Box2, Burger as Burger2, Container, Divider, Group as Group4, Stack as Stack2, Text as Text4, Transition } from "@mantine/core";
|
|
581
|
+
import { Fragment, jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
582
|
+
function DocsShellSidebar({ primaryNavigation, secondaryNavigation }) {
|
|
583
|
+
return /* @__PURE__ */ jsxs4(Stack2, { gap: "md", h: "100%", children: [
|
|
584
|
+
primaryNavigation ? /* @__PURE__ */ jsxs4(Stack2, { gap: "xs", children: [
|
|
585
|
+
/* @__PURE__ */ jsx7(Text4, { size: "xs", fw: 700, c: "dimmed", children: "Primary" }),
|
|
586
|
+
primaryNavigation
|
|
587
|
+
] }) : null,
|
|
588
|
+
secondaryNavigation ? /* @__PURE__ */ jsxs4(Fragment, { children: [
|
|
589
|
+
/* @__PURE__ */ jsx7(Divider, {}),
|
|
590
|
+
/* @__PURE__ */ jsxs4(Stack2, { gap: "xs", children: [
|
|
591
|
+
/* @__PURE__ */ jsx7(Text4, { size: "xs", fw: 700, c: "dimmed", children: "More" }),
|
|
592
|
+
secondaryNavigation
|
|
593
|
+
] })
|
|
594
|
+
] }) : null
|
|
595
|
+
] });
|
|
596
|
+
}
|
|
597
|
+
function resolveContentContainerSize(value) {
|
|
598
|
+
if (value === "full") {
|
|
599
|
+
return "100%";
|
|
600
|
+
}
|
|
601
|
+
return value ?? "lg";
|
|
602
|
+
}
|
|
603
|
+
function DocsShell({
|
|
604
|
+
brand,
|
|
605
|
+
primaryNavigation,
|
|
606
|
+
secondaryNavigation,
|
|
607
|
+
headerContext,
|
|
608
|
+
actions,
|
|
609
|
+
mobileNavigation,
|
|
610
|
+
mobileNavigationMode = "drawer",
|
|
611
|
+
footer,
|
|
612
|
+
children,
|
|
613
|
+
contentWidth = "full"
|
|
614
|
+
}) {
|
|
615
|
+
const [mobileNavOpen, setMobileNavOpen] = useState3(false);
|
|
616
|
+
return /* @__PURE__ */ jsx7(
|
|
617
|
+
DiscoveryShell,
|
|
618
|
+
{
|
|
619
|
+
header: /* @__PURE__ */ jsxs4(Group4, { h: "100%", justify: "space-between", align: "center", wrap: "nowrap", gap: "md", children: [
|
|
620
|
+
/* @__PURE__ */ jsxs4(Group4, { gap: "sm", align: "center", wrap: "nowrap", style: { minWidth: 0 }, children: [
|
|
621
|
+
mobileNavigationMode === "inline-collapse" && mobileNavigation ? /* @__PURE__ */ jsxs4(Fragment, { children: [
|
|
622
|
+
/* @__PURE__ */ jsx7(
|
|
623
|
+
Burger2,
|
|
624
|
+
{
|
|
625
|
+
opened: mobileNavOpen,
|
|
626
|
+
onClick: () => setMobileNavOpen((value) => !value),
|
|
627
|
+
hiddenFrom: "sm",
|
|
628
|
+
size: "sm",
|
|
629
|
+
"aria-label": "Toggle docs navigation"
|
|
630
|
+
}
|
|
631
|
+
),
|
|
632
|
+
/* @__PURE__ */ jsx7(Transition, { mounted: mobileNavOpen, transition: "pop", duration: 120, children: (styles) => /* @__PURE__ */ jsx7(Box2, { style: styles, children: /* @__PURE__ */ jsx7(Box2, { mt: "xs", p: "sm", style: { borderRadius: 8, border: "1px solid var(--mantine-color-default-border)" }, children: mobileNavigation }) }) })
|
|
633
|
+
] }) : null,
|
|
634
|
+
/* @__PURE__ */ jsx7(Box2, { style: { minWidth: 0 }, children: brand }),
|
|
635
|
+
headerContext ? /* @__PURE__ */ jsx7(Text4, { size: "sm", c: "dimmed", lineClamp: 1, children: headerContext }) : null
|
|
636
|
+
] }),
|
|
637
|
+
/* @__PURE__ */ jsx7(Group4, { gap: "sm", wrap: "nowrap", style: { minWidth: 0 }, children: actions })
|
|
638
|
+
] }),
|
|
639
|
+
sidebar: /* @__PURE__ */ jsx7(
|
|
640
|
+
DocsShellSidebar,
|
|
641
|
+
{
|
|
642
|
+
primaryNavigation,
|
|
643
|
+
secondaryNavigation
|
|
644
|
+
}
|
|
645
|
+
),
|
|
646
|
+
footer,
|
|
647
|
+
mobileNavigationLabel: "Open docs navigation",
|
|
648
|
+
headerHeight: 72,
|
|
649
|
+
children: /* @__PURE__ */ jsx7(Container, { size: resolveContentContainerSize(contentWidth), px: "md", py: "lg", w: "100%", children })
|
|
650
|
+
}
|
|
651
|
+
);
|
|
652
|
+
}
|
|
653
|
+
|
|
532
654
|
// src/SidebarNav.tsx
|
|
533
655
|
import { forwardRef } from "react";
|
|
534
|
-
import { Box as
|
|
656
|
+
import { Box as Box3, NavLink, Stack as Stack3, Text as Text5, createPolymorphicComponent } from "@mantine/core";
|
|
535
657
|
import { useGdsTranslation as useGdsTranslation3 } from "@doneisbetter/gds-theme";
|
|
536
|
-
import { jsx as
|
|
658
|
+
import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
537
659
|
function SidebarNav({ children, ariaLabel = "Primary navigation", gap = "md" }) {
|
|
538
|
-
return /* @__PURE__ */
|
|
660
|
+
return /* @__PURE__ */ jsx8(Stack3, { component: "nav", "aria-label": ariaLabel, gap, h: "100%", children });
|
|
539
661
|
}
|
|
540
662
|
function SidebarNavSection({ label, children, pushToBottom = false }) {
|
|
541
|
-
return /* @__PURE__ */
|
|
542
|
-
label ? /* @__PURE__ */
|
|
543
|
-
/* @__PURE__ */
|
|
663
|
+
return /* @__PURE__ */ jsxs5(Stack3, { gap: "xs", mt: pushToBottom ? "auto" : void 0, children: [
|
|
664
|
+
label ? /* @__PURE__ */ jsx8(Text5, { size: "xs", fw: 700, c: "dimmed", children: label }) : null,
|
|
665
|
+
/* @__PURE__ */ jsx8(Stack3, { gap: 4, children })
|
|
544
666
|
] });
|
|
545
667
|
}
|
|
546
668
|
var _SidebarNavItem = forwardRef(
|
|
@@ -559,14 +681,14 @@ var _SidebarNavItem = forwardRef(
|
|
|
559
681
|
const config = action ? resolveSemanticActionConfig(action, vocabularyPacks) : null;
|
|
560
682
|
const Icon = config?.icon;
|
|
561
683
|
const resolvedLabel = label ?? (action ? getSemanticActionLabel(action, t, vocabularyPacks) : void 0);
|
|
562
|
-
return /* @__PURE__ */
|
|
684
|
+
return /* @__PURE__ */ jsx8(
|
|
563
685
|
NavLink,
|
|
564
686
|
{
|
|
565
687
|
ref,
|
|
566
688
|
label: resolvedLabel,
|
|
567
689
|
description,
|
|
568
|
-
leftSection: icon ?? (Icon ? /* @__PURE__ */
|
|
569
|
-
rightSection: badge ? /* @__PURE__ */
|
|
690
|
+
leftSection: icon ?? (Icon ? /* @__PURE__ */ jsx8(Icon, { size: "1rem", stroke: 1.5 }) : void 0),
|
|
691
|
+
rightSection: badge ? /* @__PURE__ */ jsx8(Box3, { children: badge }) : props.rightSection,
|
|
570
692
|
"aria-label": ariaLabel ?? (typeof resolvedLabel === "string" ? resolvedLabel : void 0),
|
|
571
693
|
"aria-current": props.active ? "page" : ariaCurrent,
|
|
572
694
|
...props
|
|
@@ -577,11 +699,11 @@ var _SidebarNavItem = forwardRef(
|
|
|
577
699
|
var SidebarNavItem = createPolymorphicComponent(_SidebarNavItem);
|
|
578
700
|
|
|
579
701
|
// src/DocsCodeBlock.tsx
|
|
580
|
-
import { useState as
|
|
581
|
-
import { ActionIcon as ActionIcon2, Code as Code2, Group as
|
|
582
|
-
import { jsx as
|
|
702
|
+
import { useState as useState4 } from "react";
|
|
703
|
+
import { ActionIcon as ActionIcon2, Code as Code2, Group as Group5, Paper as Paper3, Stack as Stack4, Text as Text6 } from "@mantine/core";
|
|
704
|
+
import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
583
705
|
function DocsCodeBlock({ code, language, title, withCopy = true }) {
|
|
584
|
-
const [copied, setCopied] =
|
|
706
|
+
const [copied, setCopied] = useState4(false);
|
|
585
707
|
const handleCopy = async () => {
|
|
586
708
|
if (!navigator?.clipboard) {
|
|
587
709
|
return;
|
|
@@ -590,13 +712,13 @@ function DocsCodeBlock({ code, language, title, withCopy = true }) {
|
|
|
590
712
|
setCopied(true);
|
|
591
713
|
window.setTimeout(() => setCopied(false), 1200);
|
|
592
714
|
};
|
|
593
|
-
return /* @__PURE__ */
|
|
594
|
-
title || withCopy ? /* @__PURE__ */
|
|
595
|
-
/* @__PURE__ */
|
|
596
|
-
title ? /* @__PURE__ */
|
|
597
|
-
language ? /* @__PURE__ */
|
|
715
|
+
return /* @__PURE__ */ jsx9(Paper3, { withBorder: true, radius: "lg", p: "md", children: /* @__PURE__ */ jsxs6(Stack4, { gap: "sm", children: [
|
|
716
|
+
title || withCopy ? /* @__PURE__ */ jsxs6(Group5, { justify: "space-between", align: "center", children: [
|
|
717
|
+
/* @__PURE__ */ jsxs6(Stack4, { gap: 0, children: [
|
|
718
|
+
title ? /* @__PURE__ */ jsx9(Text6, { fw: 600, children: title }) : null,
|
|
719
|
+
language ? /* @__PURE__ */ jsx9(Text6, { size: "xs", c: "dimmed", children: language }) : null
|
|
598
720
|
] }),
|
|
599
|
-
withCopy ? /* @__PURE__ */
|
|
721
|
+
withCopy ? /* @__PURE__ */ jsx9(
|
|
600
722
|
ActionIcon2,
|
|
601
723
|
{
|
|
602
724
|
variant: "subtle",
|
|
@@ -604,18 +726,18 @@ function DocsCodeBlock({ code, language, title, withCopy = true }) {
|
|
|
604
726
|
onClick: () => {
|
|
605
727
|
void handleCopy();
|
|
606
728
|
},
|
|
607
|
-
children: /* @__PURE__ */
|
|
729
|
+
children: /* @__PURE__ */ jsx9(GdsIcons.Copy, { size: "1rem" })
|
|
608
730
|
}
|
|
609
731
|
) : null
|
|
610
732
|
] }) : null,
|
|
611
|
-
/* @__PURE__ */
|
|
733
|
+
/* @__PURE__ */ jsx9(Code2, { block: true, children: code })
|
|
612
734
|
] }) });
|
|
613
735
|
}
|
|
614
736
|
|
|
615
737
|
// src/ShareButtonGroup.tsx
|
|
616
|
-
import { useState as
|
|
617
|
-
import { ActionIcon as ActionIcon3, Button as Button3, Group as
|
|
618
|
-
import { jsx as
|
|
738
|
+
import { useState as useState5 } from "react";
|
|
739
|
+
import { ActionIcon as ActionIcon3, Button as Button3, Group as Group6, Stack as Stack5, Text as Text7 } from "@mantine/core";
|
|
740
|
+
import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
619
741
|
var channelLabels = {
|
|
620
742
|
native: "Share",
|
|
621
743
|
copy: "Copy link",
|
|
@@ -650,9 +772,9 @@ function ShareAction({
|
|
|
650
772
|
const label = channelLabels[channel];
|
|
651
773
|
const Icon = channel === "copy" ? GdsIcons.Copy : channel === "mail" ? GdsIcons.Mail : channel === "message" ? GdsIcons.Message : GdsIcons.Refer;
|
|
652
774
|
if (compact) {
|
|
653
|
-
return href ? /* @__PURE__ */
|
|
775
|
+
return href ? /* @__PURE__ */ jsx10(ActionIcon3, { component: "a", href, target: "_blank", rel: "noreferrer", variant: "subtle", size: "lg", "aria-label": label, children: /* @__PURE__ */ jsx10(Icon, { size: "1rem", stroke: 1.75 }) }) : /* @__PURE__ */ jsx10(ActionIcon3, { variant: "subtle", size: "lg", "aria-label": label, onClick, children: /* @__PURE__ */ jsx10(Icon, { size: "1rem", stroke: 1.75 }) });
|
|
654
776
|
}
|
|
655
|
-
return href ? /* @__PURE__ */
|
|
777
|
+
return href ? /* @__PURE__ */ jsx10(Button3, { component: "a", href, target: "_blank", rel: "noreferrer", variant: "default", leftSection: /* @__PURE__ */ jsx10(Icon, { size: "1rem", stroke: 1.75 }), children: label }) : /* @__PURE__ */ jsx10(Button3, { variant: "default", leftSection: /* @__PURE__ */ jsx10(Icon, { size: "1rem", stroke: 1.75 }), onClick, children: label });
|
|
656
778
|
}
|
|
657
779
|
function ShareButtonGroup({
|
|
658
780
|
url,
|
|
@@ -663,8 +785,8 @@ function ShareButtonGroup({
|
|
|
663
785
|
label = "Share this",
|
|
664
786
|
description
|
|
665
787
|
}) {
|
|
666
|
-
const [copied, setCopied] =
|
|
667
|
-
const [shared, setShared] =
|
|
788
|
+
const [copied, setCopied] = useState5(false);
|
|
789
|
+
const [shared, setShared] = useState5(false);
|
|
668
790
|
const hrefs = encodeShare(url, title, text);
|
|
669
791
|
async function handleCopy() {
|
|
670
792
|
await navigator.clipboard?.writeText?.(url);
|
|
@@ -680,29 +802,29 @@ function ShareButtonGroup({
|
|
|
680
802
|
}
|
|
681
803
|
await handleCopy();
|
|
682
804
|
}
|
|
683
|
-
return /* @__PURE__ */
|
|
684
|
-
/* @__PURE__ */
|
|
685
|
-
/* @__PURE__ */
|
|
686
|
-
description ? /* @__PURE__ */
|
|
805
|
+
return /* @__PURE__ */ jsxs7(Stack5, { gap: "sm", children: [
|
|
806
|
+
/* @__PURE__ */ jsxs7(Stack5, { gap: 2, children: [
|
|
807
|
+
/* @__PURE__ */ jsx10(Text7, { fw: 600, children: label }),
|
|
808
|
+
description ? /* @__PURE__ */ jsx10(Text7, { size: "sm", c: "dimmed", children: description }) : null
|
|
687
809
|
] }),
|
|
688
|
-
/* @__PURE__ */
|
|
810
|
+
/* @__PURE__ */ jsx10(Group6, { gap: "sm", wrap: "wrap", children: channels.map((channel) => {
|
|
689
811
|
if (channel === "copy") {
|
|
690
|
-
return /* @__PURE__ */
|
|
812
|
+
return /* @__PURE__ */ jsx10(ShareAction, { channel, compact, onClick: () => void handleCopy() }, channel);
|
|
691
813
|
}
|
|
692
814
|
if (channel === "native") {
|
|
693
|
-
return /* @__PURE__ */
|
|
815
|
+
return /* @__PURE__ */ jsx10(ShareAction, { channel, compact, onClick: () => void handleNativeShare() }, channel);
|
|
694
816
|
}
|
|
695
|
-
return /* @__PURE__ */
|
|
817
|
+
return /* @__PURE__ */ jsx10(ShareAction, { channel, compact, href: hrefs[channel] }, channel);
|
|
696
818
|
}) }),
|
|
697
|
-
copied ? /* @__PURE__ */
|
|
698
|
-
shared ? /* @__PURE__ */
|
|
819
|
+
copied ? /* @__PURE__ */ jsx10(Text7, { size: "sm", c: "teal", children: "Link copied." }) : null,
|
|
820
|
+
shared ? /* @__PURE__ */ jsx10(Text7, { size: "sm", c: "teal", children: "Share sheet opened." }) : null
|
|
699
821
|
] });
|
|
700
822
|
}
|
|
701
823
|
|
|
702
824
|
// src/UploadDropzone.tsx
|
|
703
|
-
import { useRef, useState as
|
|
704
|
-
import { Box as
|
|
705
|
-
import { jsx as
|
|
825
|
+
import { useRef, useState as useState6 } from "react";
|
|
826
|
+
import { Box as Box4, Button as Button4, Group as Group7, Stack as Stack6, Text as Text8 } from "@mantine/core";
|
|
827
|
+
import { jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
706
828
|
function UploadDropzone({
|
|
707
829
|
title,
|
|
708
830
|
description,
|
|
@@ -713,7 +835,7 @@ function UploadDropzone({
|
|
|
713
835
|
mode = "panel"
|
|
714
836
|
}) {
|
|
715
837
|
const inputRef = useRef(null);
|
|
716
|
-
const [dragging, setDragging] =
|
|
838
|
+
const [dragging, setDragging] = useState6(false);
|
|
717
839
|
const UploadIcon = GdsIcons.Upload;
|
|
718
840
|
const forwardFiles = (files) => {
|
|
719
841
|
if (!files?.length || !onFilesSelected) {
|
|
@@ -721,8 +843,8 @@ function UploadDropzone({
|
|
|
721
843
|
}
|
|
722
844
|
onFilesSelected(Array.from(files));
|
|
723
845
|
};
|
|
724
|
-
return /* @__PURE__ */
|
|
725
|
-
|
|
846
|
+
return /* @__PURE__ */ jsxs8(
|
|
847
|
+
Box4,
|
|
726
848
|
{
|
|
727
849
|
onDragOver: (event) => {
|
|
728
850
|
event.preventDefault();
|
|
@@ -741,7 +863,7 @@ function UploadDropzone({
|
|
|
741
863
|
background: dragging ? "var(--mantine-color-violet-light)" : "transparent"
|
|
742
864
|
},
|
|
743
865
|
children: [
|
|
744
|
-
/* @__PURE__ */
|
|
866
|
+
/* @__PURE__ */ jsx11(
|
|
745
867
|
"input",
|
|
746
868
|
{
|
|
747
869
|
ref: inputRef,
|
|
@@ -752,11 +874,11 @@ function UploadDropzone({
|
|
|
752
874
|
onChange: (event) => forwardFiles(event.currentTarget.files)
|
|
753
875
|
}
|
|
754
876
|
),
|
|
755
|
-
/* @__PURE__ */
|
|
756
|
-
/* @__PURE__ */
|
|
757
|
-
/* @__PURE__ */
|
|
758
|
-
description ? /* @__PURE__ */
|
|
759
|
-
/* @__PURE__ */
|
|
877
|
+
/* @__PURE__ */ jsxs8(Stack6, { align: mode === "inline" ? "flex-start" : "center", ta: mode === "inline" ? "left" : "center", gap: "sm", children: [
|
|
878
|
+
/* @__PURE__ */ jsx11(UploadIcon, { size: "1.5rem" }),
|
|
879
|
+
/* @__PURE__ */ jsx11(Text8, { fw: 600, children: title }),
|
|
880
|
+
description ? /* @__PURE__ */ jsx11(Text8, { size: "sm", c: "dimmed", children: description }) : null,
|
|
881
|
+
/* @__PURE__ */ jsx11(Group7, { children: /* @__PURE__ */ jsx11(Button4, { variant: "light", onClick: () => inputRef.current?.click(), children: actionLabel }) })
|
|
760
882
|
] })
|
|
761
883
|
]
|
|
762
884
|
}
|
|
@@ -764,9 +886,9 @@ function UploadDropzone({
|
|
|
764
886
|
}
|
|
765
887
|
|
|
766
888
|
// src/AccessRecoveryPanel.tsx
|
|
767
|
-
import { Group as
|
|
889
|
+
import { Group as Group8 } from "@mantine/core";
|
|
768
890
|
import { useGdsTranslation as useGdsTranslation4 } from "@doneisbetter/gds-theme";
|
|
769
|
-
import { jsx as
|
|
891
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
770
892
|
var stateBlockVariantByState = {
|
|
771
893
|
unauthenticated: "permission",
|
|
772
894
|
"expired-session": "info",
|
|
@@ -835,7 +957,7 @@ function ActionGroup({
|
|
|
835
957
|
if (actions.length === 0) {
|
|
836
958
|
return null;
|
|
837
959
|
}
|
|
838
|
-
return /* @__PURE__ */
|
|
960
|
+
return /* @__PURE__ */ jsx12(Group8, { gap: "sm", justify: "center", wrap: "wrap", children: actions.map((actionConfig, index) => /* @__PURE__ */ jsx12(
|
|
839
961
|
SemanticButton,
|
|
840
962
|
{
|
|
841
963
|
action: actionConfig.action,
|
|
@@ -869,14 +991,14 @@ function AccessRecoveryPanel({
|
|
|
869
991
|
onBack,
|
|
870
992
|
supportAction
|
|
871
993
|
});
|
|
872
|
-
return /* @__PURE__ */
|
|
994
|
+
return /* @__PURE__ */ jsx12(
|
|
873
995
|
StateBlock,
|
|
874
996
|
{
|
|
875
997
|
variant: stateBlockVariantByState[state],
|
|
876
998
|
compact,
|
|
877
999
|
title: title ?? t(`gds.accessRecovery.${state}.title`, defaultCopy.title),
|
|
878
1000
|
description: description ?? t(`gds.accessRecovery.${state}.description`, defaultCopy.description),
|
|
879
|
-
action: /* @__PURE__ */
|
|
1001
|
+
action: /* @__PURE__ */ jsx12(
|
|
880
1002
|
ActionGroup,
|
|
881
1003
|
{
|
|
882
1004
|
primaryAction: primaryAction ?? defaults.primary,
|
|
@@ -895,6 +1017,7 @@ export {
|
|
|
895
1017
|
ReferenceThemeExplorer,
|
|
896
1018
|
GameBoardTile,
|
|
897
1019
|
DiscoveryShell,
|
|
1020
|
+
DocsShell,
|
|
898
1021
|
SidebarNav,
|
|
899
1022
|
SidebarNavSection,
|
|
900
1023
|
SidebarNavItem,
|