@gntik-ai/blocks 0.9.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +426 -55
- package/dist/index.js +2275 -639
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
- package/src/auth/ForgotPasswordForm/ForgotPasswordForm.labels.test.tsx +179 -0
- package/src/auth/ForgotPasswordForm/ForgotPasswordForm.tsx +59 -24
- package/src/auth/ForgotPasswordForm/block.meta.ts +22 -1
- package/src/auth/ForgotPasswordForm/examples/Labels.tsx +29 -0
- package/src/auth/MfaChallenge/MfaChallenge.labels.test.tsx +139 -0
- package/src/auth/MfaChallenge/MfaChallenge.tsx +69 -23
- package/src/auth/MfaChallenge/block.meta.ts +29 -1
- package/src/auth/MfaChallenge/examples/Labels.tsx +28 -0
- package/src/auth/ResetPasswordForm/ResetPasswordForm.labels.test.tsx +104 -0
- package/src/auth/ResetPasswordForm/ResetPasswordForm.tsx +42 -15
- package/src/auth/ResetPasswordForm/block.meta.ts +17 -1
- package/src/auth/ResetPasswordForm/examples/Labels.tsx +28 -0
- package/src/auth/SignInForm/SignInForm.labels.test.tsx +137 -0
- package/src/auth/SignInForm/SignInForm.tsx +43 -16
- package/src/auth/SignInForm/block.meta.ts +22 -1
- package/src/auth/SignInForm/examples/Labels.tsx +29 -0
- package/src/auth/SignUpForm/SignUpForm.labels.test.tsx +217 -0
- package/src/auth/SignUpForm/SignUpForm.tsx +65 -26
- package/src/auth/SignUpForm/block.meta.ts +27 -1
- package/src/auth/SignUpForm/examples/Labels.tsx +29 -0
- package/src/auth/SsoButtons/SsoButtons.labels.test.tsx +30 -0
- package/src/auth/SsoButtons/SsoButtons.tsx +10 -2
- package/src/auth/SsoButtons/block.meta.ts +8 -1
- package/src/auth/SsoButtons/examples/Labels.tsx +24 -0
- package/src/auth/shared.i18n.test.tsx +71 -0
- package/src/auth/shared.tsx +48 -11
- package/src/billing/CostBreakdown/CostBreakdown.test.tsx +10 -0
- package/src/billing/CostBreakdown/CostBreakdown.tsx +50 -43
- package/src/billing/SpendVsBudget/SpendVsBudget.test.tsx +10 -0
- package/src/billing/SpendVsBudget/SpendVsBudget.tsx +35 -31
- package/src/builders/FlowBuilder/FlowBuilder.test.tsx +237 -2
- package/src/builders/FlowBuilder/FlowBuilder.tsx +101 -29
- package/src/builders/FlowBuilder/block.meta.ts +1 -1
- package/src/builders/FlowBuilder/connections.ts +30 -12
- package/src/builders/FlowBuilder/examples/ControlledGraph.tsx +8 -0
- package/src/builders/FlowBuilder/graph-state.ts +78 -0
- package/src/builders/LogViewer/LogViewer.labels.test.tsx +90 -0
- package/src/builders/LogViewer/LogViewer.levels.test.tsx +49 -0
- package/src/builders/LogViewer/LogViewer.tsx +72 -18
- package/src/builders/LogViewer/LogViewer.wrap.test.tsx +181 -0
- package/src/builders/LogViewer/block.meta.ts +19 -1
- package/src/builders/LogViewer/examples/Spanish.tsx +30 -0
- package/src/builders/LogViewer/examples/Wrap.tsx +62 -0
- package/src/builders/LogViewer/use-wrapped-log-rows.ts +42 -0
- package/src/data-display/ChartCard/ChartCard.locale.test.tsx +15 -0
- package/src/data-display/ChartCard/ChartCard.test.tsx +9 -0
- package/src/data-display/ChartCard/ChartCard.tsx +81 -67
- package/src/data-display/ChartCard/block.meta.ts +1 -1
- package/src/data-display/DescriptionListCard/DescriptionListCard.labels.test.tsx +73 -0
- package/src/data-display/DescriptionListCard/DescriptionListCard.options.test.tsx +64 -0
- package/src/data-display/DescriptionListCard/DescriptionListCard.tsx +74 -23
- package/src/data-display/DescriptionListCard/block.meta.ts +11 -1
- package/src/data-display/DescriptionListCard/examples/Spanish.tsx +29 -0
- package/src/feedback/EmptyStates/EmptyStates.labels.test.tsx +185 -0
- package/src/feedback/EmptyStates/EmptyStates.tsx +101 -30
- package/src/feedback/EmptyStates/NoAccessEmpty.options.test.tsx +38 -0
- package/src/feedback/EmptyStates/block.meta.ts +73 -1
- package/src/feedback/EmptyStates/examples/Spanish.tsx +48 -0
- package/src/feedback/ErrorPanel/ErrorPanel.labels.test.tsx +99 -0
- package/src/feedback/ErrorPanel/ErrorPanel.tsx +38 -9
- package/src/feedback/ErrorPanel/block.meta.ts +19 -1
- package/src/feedback/ErrorPanel/examples/Spanish.tsx +30 -0
- package/src/feedback/InlineCallout/InlineCallout.labels.test.tsx +62 -0
- package/src/feedback/InlineCallout/InlineCallout.tsx +22 -9
- package/src/feedback/InlineCallout/block.meta.ts +9 -1
- package/src/feedback/InlineCallout/examples/Spanish.tsx +19 -0
- package/src/feedback/Skeletons/Skeletons.labels.test.tsx +24 -0
- package/src/forms/CreateApiKeyDialog/CreateApiKeyDialog.labels.test.tsx +115 -0
- package/src/forms/CreateApiKeyDialog/CreateApiKeyDialog.tsx +63 -21
- package/src/forms/CreateApiKeyDialog/block.meta.ts +22 -1
- package/src/forms/CreateApiKeyDialog/examples/Labels.tsx +29 -0
- package/src/forms/CredentialDisclosureDialog/CredentialDisclosureDialog.labels.test.tsx +165 -0
- package/src/forms/CredentialDisclosureDialog/CredentialDisclosureDialog.tsx +31 -8
- package/src/forms/CredentialDisclosureDialog/SecretCopy.tsx +16 -8
- package/src/forms/CredentialDisclosureDialog/block.meta.ts +19 -1
- package/src/forms/CredentialDisclosureDialog/examples/Labels.tsx +38 -0
- package/src/forms/DangerZone/ConfirmDestructiveDialog.tsx +17 -3
- package/src/forms/DangerZone/DangerZone.labels.test.tsx +87 -0
- package/src/forms/DangerZone/DangerZone.tsx +20 -5
- package/src/forms/DangerZone/block.meta.ts +10 -1
- package/src/forms/DangerZone/examples/Labels.tsx +29 -0
- package/src/forms/DateRangeFilter/DateRangeFilter.labels.test.tsx +52 -0
- package/src/forms/DateRangeFilter/DateRangeFilter.tsx +11 -3
- package/src/forms/DateRangeFilter/block.meta.ts +8 -1
- package/src/forms/DateRangeFilter/examples/Labels.tsx +28 -0
- package/src/forms/DialogWizard/DialogWizard.labels.test.tsx +37 -0
- package/src/forms/DialogWizard/DialogWizard.tsx +13 -2
- package/src/forms/DialogWizard/block.meta.ts +7 -1
- package/src/forms/DialogWizard/examples/Labels.tsx +39 -0
- package/src/forms/FileUploadPanel/FileUploadPanel.labels.test.tsx +126 -0
- package/src/forms/FileUploadPanel/FileUploadPanel.test.tsx +22 -1
- package/src/forms/FileUploadPanel/FileUploadPanel.tsx +85 -22
- package/src/forms/FileUploadPanel/block.meta.ts +22 -1
- package/src/forms/FileUploadPanel/examples/Labels.tsx +29 -0
- package/src/forms/FileUploadPanel/fixtures.ts +0 -12
- package/src/forms/FileUploadPanel/format-bytes.test.ts +8 -0
- package/src/forms/FormSection/FormSection.labels.test.tsx +37 -0
- package/src/forms/FormSection/FormSection.tsx +14 -3
- package/src/forms/FormSection/block.meta.ts +7 -1
- package/src/forms/FormSection/examples/Labels.tsx +27 -0
- package/src/forms/InviteMembersDialog/InviteMembersDialog.labels.test.tsx +87 -0
- package/src/forms/InviteMembersDialog/InviteMembersDialog.tsx +51 -16
- package/src/forms/InviteMembersDialog/block.meta.ts +20 -1
- package/src/forms/InviteMembersDialog/examples/Labels.tsx +28 -0
- package/src/forms/SettingsRow/SettingsRow.labels.test.tsx +33 -0
- package/src/forms/SettingsRow/SettingsRow.tsx +14 -3
- package/src/forms/SettingsRow/block.meta.ts +7 -1
- package/src/forms/SettingsRow/examples/Labels.tsx +27 -0
- package/src/forms/ValidationSummary/ValidationSummary.labels.test.tsx +47 -0
- package/src/forms/ValidationSummary/ValidationSummary.tsx +9 -3
- package/src/forms/ValidationSummary/block.meta.ts +6 -1
- package/src/forms/ValidationSummary/examples/Labels.tsx +24 -0
- package/src/forms/index.ts +5 -1
- package/src/forms/translated-content.tsx +12 -0
- package/src/page-chrome/PageHeader/PageHeader.labels.test.tsx +56 -0
- package/src/page-chrome/PageHeader/PageHeader.options.test.tsx +34 -0
- package/src/page-chrome/PageHeader/PageHeader.tsx +26 -5
- package/src/page-chrome/PageHeader/block.meta.ts +8 -1
- package/src/page-chrome/PageHeader/examples/Labels.tsx +16 -0
- package/src/page-chrome/PageHeader/examples/Spanish.tsx +11 -0
- package/src/scheduling/AgendaList/AgendaList.test.tsx +25 -0
- package/src/scheduling/AgendaList/AgendaList.tsx +7 -2
- package/src/scheduling/AgendaList/AgendaListLocale.test.tsx +11 -0
- package/src/scheduling/AgendaList/block.meta.ts +1 -1
- package/src/scheduling/AgendaList/examples/Locale.tsx +29 -0
- package/src/scheduling/MonthCalendar/MonthCalendar.test.tsx +111 -1
- package/src/scheduling/MonthCalendar/MonthCalendar.tsx +19 -9
- package/src/scheduling/MonthCalendar/block.meta.ts +1 -1
- package/src/scheduling/MonthCalendar/examples/Locale.tsx +19 -0
- package/src/scheduling/WeekCalendar/WeekCalendar.test.tsx +73 -2
- package/src/scheduling/WeekCalendar/WeekCalendar.tsx +26 -12
- package/src/scheduling/WeekCalendar/block.meta.ts +1 -1
- package/src/scheduling/WeekCalendar/examples/Locale.tsx +19 -0
- package/src/scheduling/shared/dates.test.ts +75 -0
- package/src/scheduling/shared/dates.ts +46 -22
- package/src/scheduling/shared/useSchedulingClock.ts +13 -0
- package/src/shell/GlobalSearch/GlobalSearch.test.tsx +12 -0
- package/src/shell/GlobalSearch/fixtures.ts +2 -2
- package/src/tables/DataTable/DataTable.cross-page-selection.test.tsx +322 -0
- package/src/tables/DataTable/DataTable.labels.test.tsx +74 -0
- package/src/tables/DataTable/DataTable.server-pagination.test.tsx +1 -1
- package/src/tables/DataTable/DataTable.single-select.test.tsx +47 -7
- package/src/tables/DataTable/DataTable.test.tsx +55 -0
- package/src/tables/DataTable/DataTable.tsx +134 -67
- package/src/tables/DataTable/block.meta.ts +21 -3
- package/src/tables/DataTable/data-table-props.ts +14 -5
- package/src/tables/DataTable/data-table-row.tsx +7 -3
- package/src/tables/DataTable/data-table-utils.ts +2 -0
- package/src/tables/DataTable/examples/client-selection.tsx +33 -0
- package/src/tables/DataTable/examples/paginated-single-selection.tsx +46 -0
- package/src/tables/DataTable/examples/server-pagination.tsx +55 -15
- package/src/tables/DataTable/labels.ts +4 -0
- package/src/tables/DataTable/selection-strip.tsx +31 -0
- package/src/tables/DataTable/single-selection.tsx +0 -7
- package/src/tables/DataTable/use-multiple-selection.ts +86 -0
- package/src/tables/PaginationFooter/PaginationFooter.i18n.test.tsx +26 -0
- package/src/test/OptInDefaults.test.tsx +27 -0
- package/src/test/fixtures/opt-in-defaults.json +10 -0
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { Fragment, createElement, useCallback, useEffect, useEffectEvent, useId, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
3
3
|
import { Activity, Archive, ArrowDown, ArrowLeft, ArrowRight, ArrowUp, BarChart3, Bookmark, Bot, Boxes, Braces, Building2, CalendarCheck, CalendarDays, Camera, Check, ChevronDown, ChevronLeft, ChevronRight, ChevronsUpDown, CircleAlert, CircleCheck, CircleHelp, CircleX, Clock, Cog, Columns3, Copy, CreditCard, Database, Download, ExternalLink, Eye, FileCode, FileText, FolderKanban, FolderPlus, Gauge, GitBranch, Globe, HardDrive, Home, Inbox, Info, KeyRound, Layers, LayoutGrid, List, ListFilter, Lock, LogOut, Mail, MailCheck, MapPin, Minus, Monitor, MousePointerClick, Pencil, Play, PlugZap, Plus, RefreshCw, Rocket, RotateCcw, RotateCw, Rows2, Rows3, Search, SearchX, Server, ServerCrash, Settings, ShieldCheck, SlidersHorizontal, Smartphone, Sparkles, Table2, Tablet, Trash2, TriangleAlert, Upload, User, UserMinus, UserPlus, Users, Workflow, Wrench, X, Zap } from "@gntik-ai/icons";
|
|
4
|
-
import { Accordion, AccordionItem, AccordionPanel, AccordionTrigger, Alert, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, Avatar, Badge, Breadcrumbs, Button, Card, CardAction, CardBody, CardDescription, CardHeader, CardTitle, Checkbox, CheckboxGroup, ClickableCard, CodeBlock, Collapsible, CollapsiblePanel, CollapsibleTrigger, CommandPalette, CommandPaletteTrigger, CopyButton, CursorPagination, DEFAULT_DATE_RANGE_PRESETS, DateRangePicker, DensityProvider, Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, EmptyState, Field, FieldDescription, FieldError, FieldLabel, Fieldset, FieldsetLegend, IconButton, Input, Link, LiveAnnouncer, Logo, Menu, MenuCheckboxItem, MenuContent, MenuGroup, MenuGroupLabel, MenuItem, MenuRadioGroup, MenuRadioItem, MenuSeparator, MenuSub, MenuSubContent, MenuSubTrigger, MenuTrigger, Meter, MoreMenu, NavList, NotificationsPopover, OtpInput, Pagination, PasswordInput, Progress, Radio, RadioGroup, ResizablePanel, ResizablePanelGroup, ResizeHandle, SecretField, Select, SelectContent, SelectItem, SelectTrigger, SimpleSelect, Skeleton, Slider, Sparkline, Spinner, StatusDot, StatusTag, Switch, Table, TableBody, TableCaption, TableCell, TableHead, TableHeader, TableRow, Tabs, TabsList, TabsPanel, TabsTab, Textarea, ThemeCycleButton, ThemeSwitcher, Timestamp, Toggle, ToggleGroup, Token, TokenInput, Toolbar, ToolbarButton, ToolbarEnd, ToolbarInput, ToolbarSeparator, ToolbarStart, UserMenu, WizardLayout, WorkspaceSwitcher, buttonVariants, cn, foldText, matchRanges, nextSortDirection, tableVariants, toDate, useAnnounce, useDensity, useHasLiveAnnouncer, useI18n, useOptionalI18n } from "@gntik-ai/ui";
|
|
4
|
+
import { Accordion, AccordionItem, AccordionPanel, AccordionTrigger, Alert, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, Avatar, Badge, Breadcrumbs, Button, Card, CardAction, CardBody, CardDescription, CardHeader, CardTitle, Checkbox, CheckboxGroup, ClickableCard, CodeBlock, Collapsible, CollapsiblePanel, CollapsibleTrigger, CommandPalette, CommandPaletteTrigger, CopyButton, CursorPagination, DEFAULT_DATE_RANGE_PRESETS, DateRangePicker, DensityProvider, Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, EmptyState, Field, FieldDescription, FieldError, FieldLabel, Fieldset, FieldsetLegend, IconButton, Input, Link, LiveAnnouncer, Logo, Menu, MenuCheckboxItem, MenuContent, MenuGroup, MenuGroupLabel, MenuItem, MenuRadioGroup, MenuRadioItem, MenuSeparator, MenuSub, MenuSubContent, MenuSubTrigger, MenuTrigger, Meter, MoreMenu, NavList, NotificationsPopover, OtpInput, Pagination, PasswordInput, Progress, Radio, RadioGroup, ResizablePanel, ResizablePanelGroup, ResizeHandle, SecretField, Select, SelectContent, SelectItem, SelectTrigger, SimpleSelect, Skeleton, Slider, Sparkline, Spinner, StatusDot, StatusTag, Switch, Table, TableBody, TableCaption, TableCell, TableHead, TableHeader, TableRow, Tabs, TabsList, TabsPanel, TabsTab, Textarea, ThemeCycleButton, ThemeSwitcher, Timestamp, Toggle, ToggleGroup, Token, TokenInput, Toolbar, ToolbarButton, ToolbarEnd, ToolbarInput, ToolbarSeparator, ToolbarStart, UserMenu, WizardLayout, WorkspaceSwitcher, buttonVariants, cn, computeOffsets, en, foldText, localeHourCycle, localeWeekStart, matchRanges, nextSortDirection, tableVariants, toDate, useAnnounce, useDensity, useHasLiveAnnouncer, useI18n, useOptionalI18n, useVirtualWindow } from "@gntik-ai/ui";
|
|
5
5
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
-
import { AreaChart, BarChart, CHART_COLORS, DonutChart, Heatmap, LineChart, chartFmt } from "@gntik-ai/charts";
|
|
6
|
+
import { AreaChart, BarChart, CHART_COLORS, ChartLocaleProvider, DonutChart, Heatmap, LineChart, chartFmt } from "@gntik-ai/charts";
|
|
7
7
|
import { FLOW_TONES, FlowCanvas, KIND_CHIP, KindGlyph, useFlowState } from "@gntik-ai/flow";
|
|
8
8
|
import { CodeEditor, DiffEditor } from "@gntik-ai/editor";
|
|
9
9
|
//#region src/ai/AssistantCardGrid/fixtures.ts
|
|
@@ -1601,6 +1601,12 @@ const meta$42 = {
|
|
|
1601
1601
|
]
|
|
1602
1602
|
};
|
|
1603
1603
|
//#endregion
|
|
1604
|
+
//#region src/forms/translated-content.tsx
|
|
1605
|
+
/** Keep caller-owned rich content in place while the catalog controls sentence order. */
|
|
1606
|
+
function translatedContent(message, values) {
|
|
1607
|
+
return message.split(/(\{\w+\})/).map((part, index) => /* @__PURE__ */ jsx(Fragment, { children: part.startsWith("{") && part.endsWith("}") ? values[part.slice(1, -1)] ?? part : part }, index));
|
|
1608
|
+
}
|
|
1609
|
+
//#endregion
|
|
1604
1610
|
//#region src/auth/shared.tsx
|
|
1605
1611
|
/** Eyebrow + title + supporting line used at the top of every auth form. */
|
|
1606
1612
|
function AuthHeader({ eyebrow, title, description, headingLevel: Heading = "h1", className }) {
|
|
@@ -1639,7 +1645,8 @@ function AuthDivider({ children }) {
|
|
|
1639
1645
|
}
|
|
1640
1646
|
const authFormClass = "w-full max-w-[392px]";
|
|
1641
1647
|
/** Loading + error state around an async submit handler. A rejection's message becomes the error. */
|
|
1642
|
-
function useAsyncSubmit(fallbackError
|
|
1648
|
+
function useAsyncSubmit(fallbackError) {
|
|
1649
|
+
const { t } = useI18n();
|
|
1643
1650
|
const [loading, setLoading] = useState(false);
|
|
1644
1651
|
const [error, setError] = useState(null);
|
|
1645
1652
|
const run = async (fn) => {
|
|
@@ -1651,7 +1658,7 @@ function useAsyncSubmit(fallbackError = "Something went wrong. Try again.") {
|
|
|
1651
1658
|
return true;
|
|
1652
1659
|
} catch (e) {
|
|
1653
1660
|
setLoading(false);
|
|
1654
|
-
setError(e instanceof Error ? e.message : fallbackError);
|
|
1661
|
+
setError(e instanceof Error ? e.message : fallbackError ?? t("authValidation.fallbackError"));
|
|
1655
1662
|
return false;
|
|
1656
1663
|
}
|
|
1657
1664
|
};
|
|
@@ -1663,32 +1670,39 @@ function useAsyncSubmit(fallbackError = "Something went wrong. Try again.") {
|
|
|
1663
1670
|
};
|
|
1664
1671
|
}
|
|
1665
1672
|
const EMAIL_RE$1 = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
1666
|
-
function authIdentifierError(value, config, messages) {
|
|
1673
|
+
function authIdentifierError(value, config, messages, t, labels) {
|
|
1667
1674
|
const trimmed = value.trim();
|
|
1668
|
-
const fallback = config?.type === "text" ? "
|
|
1669
|
-
if (!trimmed) return messages?.identifierRequired ?? fallback;
|
|
1670
|
-
if (config?.minLength !== void 0 && trimmed.length < config.minLength) return messages?.identifierTooShort ?? messages?.identifierInvalid ?? fallback;
|
|
1671
|
-
if ((config?.type ?? "email") === "email" && !EMAIL_RE$1.test(trimmed) || config?.maxLength !== void 0 && trimmed.length > config.maxLength) return messages?.identifierInvalid ?? fallback;
|
|
1675
|
+
const fallback = config?.type === "text" ? t?.("authValidation.identifierInvalid") ?? en["authValidation.identifierInvalid"] : t?.("authValidation.emailInvalid") ?? en["authValidation.emailInvalid"];
|
|
1676
|
+
if (!trimmed) return messages?.identifierRequired ?? labels?.identifierRequired ?? fallback;
|
|
1677
|
+
if (config?.minLength !== void 0 && trimmed.length < config.minLength) return messages?.identifierTooShort ?? messages?.identifierInvalid ?? labels?.identifierTooShort ?? labels?.identifierInvalid ?? fallback;
|
|
1678
|
+
if ((config?.type ?? "email") === "email" && !EMAIL_RE$1.test(trimmed) || config?.maxLength !== void 0 && trimmed.length > config.maxLength) return messages?.identifierInvalid ?? labels?.identifierInvalid ?? fallback;
|
|
1672
1679
|
return null;
|
|
1673
1680
|
}
|
|
1674
|
-
function authSignUpFieldError(value, field) {
|
|
1681
|
+
function authSignUpFieldError(value, field, t, labels) {
|
|
1675
1682
|
const trimmed = value.trim();
|
|
1676
|
-
if (!trimmed) return field.required ? field.messages?.required ??
|
|
1677
|
-
if (field.type === "email" && !EMAIL_RE$1.test(trimmed)) return field.messages?.invalid ??
|
|
1683
|
+
if (!trimmed) return field.required ? field.messages?.required ?? labels?.fieldRequired?.(field.label) ?? t?.("authValidation.fieldRequired", { label: field.label }) ?? en["authValidation.fieldRequired"].replace("{label}", () => field.label) : null;
|
|
1684
|
+
if (field.type === "email" && !EMAIL_RE$1.test(trimmed)) return field.messages?.invalid ?? labels?.fieldInvalid ?? t?.("authValidation.emailInvalid") ?? en["authValidation.emailInvalid"];
|
|
1678
1685
|
return null;
|
|
1679
1686
|
}
|
|
1680
1687
|
//#endregion
|
|
1681
1688
|
//#region src/auth/ForgotPasswordForm/ForgotPasswordForm.tsx
|
|
1682
1689
|
/** Request a reset link by email, then a "check your inbox" state with resend and a way back. */
|
|
1683
|
-
function ForgotPasswordForm({ identifier, messages, ref, fieldInvalid, feedbackId, "aria-describedby": describedBy, "aria-label":
|
|
1690
|
+
function ForgotPasswordForm({ labels, identifier, messages, ref, fieldInvalid, feedbackId, "aria-describedby": describedBy, "aria-label": ariaLabelProp, "aria-labelledby": labelledBy, onSubmit, error: errorProp, defaultEmail = "", defaultSent = false, signInHref = "#", onBackToSignIn, eyebrow: eyebrowProp, title: titleProp, description: descriptionProp, sentTitle: sentTitleProp, sentDescription, sentStatus: sentStatusProp, resendActions, headingLevel, className }) {
|
|
1691
|
+
const { t } = useI18n();
|
|
1692
|
+
const eyebrow = eyebrowProp === void 0 ? labels?.eyebrow ?? t("forgotPassword.eyebrow") : eyebrowProp;
|
|
1693
|
+
const title = titleProp === void 0 ? labels?.title ?? t("forgotPassword.title") : titleProp;
|
|
1694
|
+
const description = descriptionProp === void 0 ? labels?.description ?? t("forgotPassword.description") : descriptionProp;
|
|
1695
|
+
const sentTitle = sentTitleProp === void 0 ? labels?.sentTitle ?? t("forgotPassword.sentTitle") : sentTitleProp;
|
|
1696
|
+
const sentStatus = sentStatusProp === void 0 ? labels?.sentStatus ?? t("forgotPassword.sentStatus") : sentStatusProp;
|
|
1697
|
+
const ariaLabel = ariaLabelProp ?? labels?.formLabel ?? t("forgotPassword.formLabel");
|
|
1684
1698
|
const [email, setEmail] = useState(defaultEmail);
|
|
1685
1699
|
const [submitted, setSubmitted] = useState(false);
|
|
1686
1700
|
const [sent, setSent] = useState(defaultSent);
|
|
1687
|
-
const { loading, error, run } = useAsyncSubmit(
|
|
1701
|
+
const { loading, error, run } = useAsyncSubmit(labels?.fallbackError ?? t("forgotPassword.fallbackError"));
|
|
1688
1702
|
const alert = errorProp ?? error;
|
|
1689
1703
|
const identifierInput = useRef(null);
|
|
1690
1704
|
useImperativeHandle(ref, () => ({ focus: () => identifierInput.current?.focus() }), []);
|
|
1691
|
-
const identifierError = authIdentifierError(email, identifier, messages);
|
|
1705
|
+
const identifierError = authIdentifierError(email, identifier, messages, t, labels);
|
|
1692
1706
|
const emailInvalid = submitted && identifierError !== null;
|
|
1693
1707
|
const send = async () => {
|
|
1694
1708
|
if (await run(() => onSubmit?.(email.trim()))) setSent(true);
|
|
@@ -1705,7 +1719,7 @@ function ForgotPasswordForm({ identifier, messages, ref, fieldInvalid, feedbackI
|
|
|
1705
1719
|
size: 14,
|
|
1706
1720
|
"aria-hidden": true,
|
|
1707
1721
|
className: "rtl:-scale-x-100"
|
|
1708
|
-
}),
|
|
1722
|
+
}), labels?.backToSignIn ?? t("forgotPassword.backToSignIn")]
|
|
1709
1723
|
});
|
|
1710
1724
|
if (sent) return /* @__PURE__ */ jsxs("div", {
|
|
1711
1725
|
className: cn(authFormClass, className),
|
|
@@ -1721,15 +1735,10 @@ function ForgotPasswordForm({ identifier, messages, ref, fieldInvalid, feedbackI
|
|
|
1721
1735
|
eyebrow,
|
|
1722
1736
|
title: sentTitle,
|
|
1723
1737
|
headingLevel,
|
|
1724
|
-
description: sentDescription === void 0 ? /* @__PURE__ */
|
|
1725
|
-
"
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
className: "font-medium text-foreground",
|
|
1729
|
-
children: email.trim() || "that address"
|
|
1730
|
-
}),
|
|
1731
|
-
", you will receive a link to reset your password. It expires in 1 hour."
|
|
1732
|
-
] }) : sentDescription
|
|
1738
|
+
description: sentDescription === void 0 ? labels?.sentDescription?.(email.trim() || (labels?.addressFallback ?? t("forgotPassword.addressFallback"))) ?? translatedContent(t("forgotPassword.sentDescription"), { email: /* @__PURE__ */ jsx("span", {
|
|
1739
|
+
className: "font-medium text-foreground",
|
|
1740
|
+
children: email.trim() || (labels?.addressFallback ?? t("forgotPassword.addressFallback"))
|
|
1741
|
+
}) }) : sentDescription
|
|
1733
1742
|
}),
|
|
1734
1743
|
sentStatus != null && /* @__PURE__ */ jsx("div", {
|
|
1735
1744
|
role: "status",
|
|
@@ -1750,7 +1759,7 @@ function ForgotPasswordForm({ identifier, messages, ref, fieldInvalid, feedbackI
|
|
|
1750
1759
|
loading,
|
|
1751
1760
|
className: "w-full",
|
|
1752
1761
|
onClick: () => void send(),
|
|
1753
|
-
children:
|
|
1762
|
+
children: labels?.resend ?? t("forgotPassword.resend")
|
|
1754
1763
|
}), /* @__PURE__ */ jsx(Button, {
|
|
1755
1764
|
variant: "ghost",
|
|
1756
1765
|
size: "lg",
|
|
@@ -1759,7 +1768,7 @@ function ForgotPasswordForm({ identifier, messages, ref, fieldInvalid, feedbackI
|
|
|
1759
1768
|
setSent(false);
|
|
1760
1769
|
setSubmitted(false);
|
|
1761
1770
|
},
|
|
1762
|
-
children:
|
|
1771
|
+
children: labels?.changeEmail ?? t("forgotPassword.changeEmail")
|
|
1763
1772
|
})] }) : resendActions
|
|
1764
1773
|
}),
|
|
1765
1774
|
/* @__PURE__ */ jsx("p", {
|
|
@@ -1801,14 +1810,14 @@ function ForgotPasswordForm({ identifier, messages, ref, fieldInvalid, feedbackI
|
|
|
1801
1810
|
/* @__PURE__ */ jsxs(Field, {
|
|
1802
1811
|
invalid: emailInvalid || fieldInvalid?.identifier === true,
|
|
1803
1812
|
children: [
|
|
1804
|
-
/* @__PURE__ */ jsx(FieldLabel, { children: identifier?.label ?? "
|
|
1813
|
+
/* @__PURE__ */ jsx(FieldLabel, { children: identifier?.label ?? labels?.identifierLabel ?? t("forgotPassword.identifierLabel") }),
|
|
1805
1814
|
/* @__PURE__ */ jsx(Input, {
|
|
1806
1815
|
ref: identifierInput,
|
|
1807
1816
|
"aria-describedby": fieldInvalid?.identifier ? feedbackId : void 0,
|
|
1808
1817
|
type: identifier?.type ?? "email",
|
|
1809
1818
|
leadingIcon: Mail,
|
|
1810
1819
|
autoComplete: identifier?.autoComplete ?? "email",
|
|
1811
|
-
placeholder: identifier?.placeholder ?? "
|
|
1820
|
+
placeholder: identifier?.placeholder ?? labels?.identifierPlaceholder ?? t("forgotPassword.identifierPlaceholder"),
|
|
1812
1821
|
minLength: identifier?.minLength,
|
|
1813
1822
|
maxLength: identifier?.maxLength,
|
|
1814
1823
|
value: email,
|
|
@@ -1831,7 +1840,7 @@ function ForgotPasswordForm({ identifier, messages, ref, fieldInvalid, feedbackI
|
|
|
1831
1840
|
size: "lg",
|
|
1832
1841
|
loading,
|
|
1833
1842
|
className: "mt-2 w-full",
|
|
1834
|
-
children:
|
|
1843
|
+
children: labels?.submit ?? t("forgotPassword.submit")
|
|
1835
1844
|
})
|
|
1836
1845
|
]
|
|
1837
1846
|
}),
|
|
@@ -1848,7 +1857,99 @@ const meta$29 = {
|
|
|
1848
1857
|
name: "Forgot password form",
|
|
1849
1858
|
family: "auth",
|
|
1850
1859
|
status: "stable",
|
|
1851
|
-
description: "Email (default) or username-or-email password recovery; onSubmit receives the trimmed identifier. Supports identifier (type, autoComplete, label, help/helpId, placeholder, minLength/maxLength), messages (identifierRequired/identifierInvalid/identifierTooShort/passwordRequired), and React 19 ref.focus. The kit owns inline validation and focuses the first invalid field; consumers supply messages, not a second inline validator. Server errors use error + fieldInvalid + feedbackId; aria-describedby describes the form, while flagged inputs also retain their help and error ids. headingLevel (h1/h2/h3/null) suppresses the heading without losing the form name; aria-label/aria-labelledby override the default name. ref.focus accepts identifier. title/description and sentTitle/sentDescription configure request and sent copy; sentTitle, sentDescription, sentStatus and resendActions accept null to hide inbox copy, announcements and resend/change-identifier actions. Preview: forgot-password-form--username-or-email.",
|
|
1860
|
+
description: "Email (default) or username-or-email password recovery; onSubmit receives the trimmed identifier. Supports identifier (type, autoComplete, label, help/helpId, placeholder, minLength/maxLength), messages (identifierRequired/identifierInvalid/identifierTooShort/passwordRequired), and React 19 ref.focus. The kit owns inline validation and focuses the first invalid field; consumers supply messages, not a second inline validator. Server errors use error + fieldInvalid + feedbackId; aria-describedby describes the form, while flagged inputs also retain their help and error ids. headingLevel (h1/h2/h3/null) suppresses the heading without losing the form name; aria-label/aria-labelledby override the default name. ref.focus accepts identifier. title/description and sentTitle/sentDescription configure request and sent copy; sentTitle, sentDescription, sentStatus and resendActions accept null to hide inbox copy, announcements and resend/change-identifier actions. Preview: forgot-password-form--username-or-email. Optional labels?: Partial<ForgotPasswordFormLabels> overrides built-in copy; explicit props and validation messages win, then labels, then I18nProvider (en/es). No provider preserves English; fixtures and caller content stay unchanged. Interactive preview: /preview.html?kind=block&id=forgot-password-form--labels.",
|
|
1861
|
+
labels: [
|
|
1862
|
+
{
|
|
1863
|
+
key: "formLabel",
|
|
1864
|
+
type: "string",
|
|
1865
|
+
state: "Default content and accessible names"
|
|
1866
|
+
},
|
|
1867
|
+
{
|
|
1868
|
+
key: "eyebrow",
|
|
1869
|
+
type: "string",
|
|
1870
|
+
state: "Default content and accessible names"
|
|
1871
|
+
},
|
|
1872
|
+
{
|
|
1873
|
+
key: "title",
|
|
1874
|
+
type: "string",
|
|
1875
|
+
state: "Default content and accessible names"
|
|
1876
|
+
},
|
|
1877
|
+
{
|
|
1878
|
+
key: "description",
|
|
1879
|
+
type: "string",
|
|
1880
|
+
state: "Default content and accessible names"
|
|
1881
|
+
},
|
|
1882
|
+
{
|
|
1883
|
+
key: "sentTitle",
|
|
1884
|
+
type: "string",
|
|
1885
|
+
state: "Async feedback"
|
|
1886
|
+
},
|
|
1887
|
+
{
|
|
1888
|
+
key: "sentDescription",
|
|
1889
|
+
type: "(email: string) => ReactNode",
|
|
1890
|
+
state: "Async feedback"
|
|
1891
|
+
},
|
|
1892
|
+
{
|
|
1893
|
+
key: "addressFallback",
|
|
1894
|
+
type: "string",
|
|
1895
|
+
state: "Async feedback"
|
|
1896
|
+
},
|
|
1897
|
+
{
|
|
1898
|
+
key: "sentStatus",
|
|
1899
|
+
type: "string",
|
|
1900
|
+
state: "Async feedback"
|
|
1901
|
+
},
|
|
1902
|
+
{
|
|
1903
|
+
key: "fallbackError",
|
|
1904
|
+
type: "string",
|
|
1905
|
+
state: "Validation feedback"
|
|
1906
|
+
},
|
|
1907
|
+
{
|
|
1908
|
+
key: "backToSignIn",
|
|
1909
|
+
type: "string",
|
|
1910
|
+
state: "Default content and accessible names"
|
|
1911
|
+
},
|
|
1912
|
+
{
|
|
1913
|
+
key: "resend",
|
|
1914
|
+
type: "string",
|
|
1915
|
+
state: "Default content and accessible names"
|
|
1916
|
+
},
|
|
1917
|
+
{
|
|
1918
|
+
key: "changeEmail",
|
|
1919
|
+
type: "string",
|
|
1920
|
+
state: "Default content and accessible names"
|
|
1921
|
+
},
|
|
1922
|
+
{
|
|
1923
|
+
key: "identifierLabel",
|
|
1924
|
+
type: "string",
|
|
1925
|
+
state: "Default content and accessible names"
|
|
1926
|
+
},
|
|
1927
|
+
{
|
|
1928
|
+
key: "identifierPlaceholder",
|
|
1929
|
+
type: "string",
|
|
1930
|
+
state: "Default content and accessible names"
|
|
1931
|
+
},
|
|
1932
|
+
{
|
|
1933
|
+
key: "submit",
|
|
1934
|
+
type: "string",
|
|
1935
|
+
state: "Default content and accessible names"
|
|
1936
|
+
},
|
|
1937
|
+
{
|
|
1938
|
+
key: "identifierRequired",
|
|
1939
|
+
type: "string",
|
|
1940
|
+
state: "Validation feedback"
|
|
1941
|
+
},
|
|
1942
|
+
{
|
|
1943
|
+
key: "identifierInvalid",
|
|
1944
|
+
type: "string",
|
|
1945
|
+
state: "Validation feedback"
|
|
1946
|
+
},
|
|
1947
|
+
{
|
|
1948
|
+
key: "identifierTooShort",
|
|
1949
|
+
type: "string",
|
|
1950
|
+
state: "Validation feedback"
|
|
1951
|
+
}
|
|
1952
|
+
],
|
|
1852
1953
|
uses: [
|
|
1853
1954
|
"Field",
|
|
1854
1955
|
"FieldLabel",
|
|
@@ -1866,7 +1967,10 @@ const meta$29 = {
|
|
|
1866
1967
|
* Second-factor step: a one-time code (auto-submits when complete), a switch to a backup code,
|
|
1867
1968
|
* and a resend button with a countdown.
|
|
1868
1969
|
*/
|
|
1869
|
-
function MfaChallenge({ onVerify, onResend, resendCooldown = 30, initialCooldown, length = 6, destination, error: errorProp, loading: loadingProp, onCancel, eyebrow
|
|
1970
|
+
function MfaChallenge({ labels, onVerify, onResend, resendCooldown = 30, initialCooldown, length = 6, destination, error: errorProp, loading: loadingProp, onCancel, eyebrow: eyebrowProp, title: titleProp, className }) {
|
|
1971
|
+
const { t } = useI18n();
|
|
1972
|
+
const eyebrow = eyebrowProp === void 0 ? labels?.eyebrow ?? t("mfaChallenge.eyebrow") : eyebrowProp;
|
|
1973
|
+
const title = titleProp === void 0 ? labels?.title ?? t("mfaChallenge.title") : titleProp;
|
|
1870
1974
|
const [method, setMethod] = useState("code");
|
|
1871
1975
|
const [code, setCode] = useState("");
|
|
1872
1976
|
const [backup, setBackup] = useState("");
|
|
@@ -1875,7 +1979,7 @@ function MfaChallenge({ onVerify, onResend, resendCooldown = 30, initialCooldown
|
|
|
1875
1979
|
const [now, setNow] = useState(start);
|
|
1876
1980
|
const [resendAt, setResendAt] = useState(() => start + (initialCooldown ?? resendCooldown) * 1e3);
|
|
1877
1981
|
const [resent, setResent] = useState(false);
|
|
1878
|
-
const { loading, error, run } = useAsyncSubmit(
|
|
1982
|
+
const { loading, error, run } = useAsyncSubmit(labels?.fallbackError ?? t("mfaChallenge.fallbackError"));
|
|
1879
1983
|
const busy = loadingProp ?? loading;
|
|
1880
1984
|
const alert = errorProp ?? error;
|
|
1881
1985
|
const remaining = Math.max(0, Math.ceil((resendAt - now) / 1e3));
|
|
@@ -1892,24 +1996,27 @@ function MfaChallenge({ onVerify, onResend, resendCooldown = 30, initialCooldown
|
|
|
1892
1996
|
run(() => onVerify?.(v, method));
|
|
1893
1997
|
};
|
|
1894
1998
|
const resend = async () => {
|
|
1895
|
-
const
|
|
1896
|
-
setNow(
|
|
1897
|
-
setResendAt(
|
|
1999
|
+
const time = Date.now();
|
|
2000
|
+
setNow(time);
|
|
2001
|
+
setResendAt(time + resendCooldown * 1e3);
|
|
1898
2002
|
setResent(true);
|
|
1899
2003
|
await onResend?.();
|
|
1900
2004
|
};
|
|
1901
|
-
const description = method === "backup" ?
|
|
2005
|
+
const description = method === "backup" ? labels?.backupDescription ?? t("mfaChallenge.backupDescription") : destination ? labels?.destinationDescription?.(length, destination) ?? t("mfaChallenge.destinationDescription", {
|
|
2006
|
+
length,
|
|
2007
|
+
destination
|
|
2008
|
+
}) : labels?.description?.(length) ?? t("mfaChallenge.description", { length });
|
|
1902
2009
|
return /* @__PURE__ */ jsxs("div", {
|
|
1903
2010
|
className: cn(authFormClass, className),
|
|
1904
2011
|
children: [
|
|
1905
2012
|
/* @__PURE__ */ jsx(AuthHeader, {
|
|
1906
2013
|
eyebrow,
|
|
1907
|
-
title: method === "backup" ?
|
|
2014
|
+
title: method === "backup" ? labels?.backupTitle ?? t("mfaChallenge.backupTitle") : title,
|
|
1908
2015
|
description
|
|
1909
2016
|
}),
|
|
1910
2017
|
/* @__PURE__ */ jsxs("form", {
|
|
1911
2018
|
noValidate: true,
|
|
1912
|
-
"aria-label":
|
|
2019
|
+
"aria-label": labels?.formLabel ?? t("mfaChallenge.formLabel"),
|
|
1913
2020
|
className: "flex flex-col gap-5",
|
|
1914
2021
|
onSubmit: (e) => {
|
|
1915
2022
|
e.preventDefault();
|
|
@@ -1923,7 +2030,7 @@ function MfaChallenge({ onVerify, onResend, resendCooldown = 30, initialCooldown
|
|
|
1923
2030
|
method === "code" ? /* @__PURE__ */ jsxs(Field, {
|
|
1924
2031
|
invalid,
|
|
1925
2032
|
children: [
|
|
1926
|
-
/* @__PURE__ */ jsx(FieldLabel, { children:
|
|
2033
|
+
/* @__PURE__ */ jsx(FieldLabel, { children: labels?.codeLabel ?? t("mfaChallenge.codeLabel") }),
|
|
1927
2034
|
/* @__PURE__ */ jsx(OtpInput, {
|
|
1928
2035
|
length,
|
|
1929
2036
|
value: code,
|
|
@@ -1933,31 +2040,27 @@ function MfaChallenge({ onVerify, onResend, resendCooldown = 30, initialCooldown
|
|
|
1933
2040
|
groupSize: length / 2,
|
|
1934
2041
|
disabled: busy
|
|
1935
2042
|
}),
|
|
1936
|
-
/* @__PURE__ */
|
|
2043
|
+
/* @__PURE__ */ jsx(FieldError, {
|
|
1937
2044
|
match: invalid,
|
|
1938
|
-
children:
|
|
1939
|
-
"Enter all ",
|
|
1940
|
-
length,
|
|
1941
|
-
" digits."
|
|
1942
|
-
]
|
|
2045
|
+
children: labels?.codeRequired?.(length) ?? t("mfaChallenge.codeRequired", { length })
|
|
1943
2046
|
})
|
|
1944
2047
|
]
|
|
1945
2048
|
}) : /* @__PURE__ */ jsxs(Field, {
|
|
1946
2049
|
invalid,
|
|
1947
2050
|
children: [
|
|
1948
|
-
/* @__PURE__ */ jsx(FieldLabel, { children:
|
|
2051
|
+
/* @__PURE__ */ jsx(FieldLabel, { children: labels?.backupLabel ?? t("mfaChallenge.backupLabel") }),
|
|
1949
2052
|
/* @__PURE__ */ jsx(Input, {
|
|
1950
2053
|
value: backup,
|
|
1951
2054
|
onValueChange: setBackup,
|
|
1952
|
-
placeholder: "
|
|
2055
|
+
placeholder: labels?.backupPlaceholder ?? t("mfaChallenge.backupPlaceholder"),
|
|
1953
2056
|
autoComplete: "one-time-code",
|
|
1954
2057
|
spellCheck: false,
|
|
1955
2058
|
inputClassName: "font-mono tracking-wider"
|
|
1956
2059
|
}),
|
|
1957
|
-
/* @__PURE__ */ jsx(FieldDescription, { children:
|
|
2060
|
+
/* @__PURE__ */ jsx(FieldDescription, { children: labels?.backupHint ?? t("mfaChallenge.backupHint") }),
|
|
1958
2061
|
/* @__PURE__ */ jsx(FieldError, {
|
|
1959
2062
|
match: invalid,
|
|
1960
|
-
children:
|
|
2063
|
+
children: labels?.backupRequired ?? t("mfaChallenge.backupRequired")
|
|
1961
2064
|
})
|
|
1962
2065
|
]
|
|
1963
2066
|
}),
|
|
@@ -1966,7 +2069,7 @@ function MfaChallenge({ onVerify, onResend, resendCooldown = 30, initialCooldown
|
|
|
1966
2069
|
size: "lg",
|
|
1967
2070
|
loading: busy,
|
|
1968
2071
|
className: "w-full",
|
|
1969
|
-
children: "
|
|
2072
|
+
children: labels?.submit ?? t("mfaChallenge.submit")
|
|
1970
2073
|
})
|
|
1971
2074
|
]
|
|
1972
2075
|
}),
|
|
@@ -1980,19 +2083,19 @@ function MfaChallenge({ onVerify, onResend, resendCooldown = 30, initialCooldown
|
|
|
1980
2083
|
setMethod(method === "code" ? "backup" : "code");
|
|
1981
2084
|
setSubmitted(false);
|
|
1982
2085
|
},
|
|
1983
|
-
children: method === "code" ?
|
|
2086
|
+
children: method === "code" ? labels?.backupTitle ?? t("mfaChallenge.backupTitle") : labels?.useCode ?? t("mfaChallenge.useCode")
|
|
1984
2087
|
}), method === "code" && onResend !== void 0 && /* @__PURE__ */ jsx(Button, {
|
|
1985
2088
|
variant: "ghost",
|
|
1986
2089
|
size: "sm",
|
|
1987
2090
|
disabled: remaining > 0,
|
|
1988
2091
|
onClick: () => void resend(),
|
|
1989
|
-
children: remaining > 0 ?
|
|
2092
|
+
children: remaining > 0 ? labels?.resendIn?.(remaining) ?? t("mfaChallenge.resendIn", { remaining }) : labels?.resend ?? t("mfaChallenge.resend")
|
|
1990
2093
|
})]
|
|
1991
2094
|
}),
|
|
1992
2095
|
/* @__PURE__ */ jsx("span", {
|
|
1993
2096
|
role: "status",
|
|
1994
2097
|
className: "sr-only",
|
|
1995
|
-
children: resent ?
|
|
2098
|
+
children: resent ? labels?.resent ?? t("mfaChallenge.resent") : ""
|
|
1996
2099
|
}),
|
|
1997
2100
|
onCancel && /* @__PURE__ */ jsx("p", {
|
|
1998
2101
|
className: "mt-6 text-center",
|
|
@@ -2000,7 +2103,7 @@ function MfaChallenge({ onVerify, onResend, resendCooldown = 30, initialCooldown
|
|
|
2000
2103
|
variant: "ghost",
|
|
2001
2104
|
size: "sm",
|
|
2002
2105
|
onClick: onCancel,
|
|
2003
|
-
children:
|
|
2106
|
+
children: labels?.backToSignIn ?? t("mfaChallenge.backToSignIn")
|
|
2004
2107
|
})
|
|
2005
2108
|
})
|
|
2006
2109
|
]
|
|
@@ -2012,7 +2115,109 @@ const meta$41 = {
|
|
|
2012
2115
|
name: "MFA challenge",
|
|
2013
2116
|
family: "auth",
|
|
2014
2117
|
status: "stable",
|
|
2015
|
-
description: "Second-factor step with a one-time code (auto-submit), a backup-code mode and resend with a countdown.",
|
|
2118
|
+
description: "Second-factor step with a one-time code (auto-submit), a backup-code mode and resend with a countdown. Optional labels?: Partial<MfaChallengeLabels> overrides built-in copy; explicit props and validation messages win, then labels, then I18nProvider (en/es). No provider preserves English; fixtures and caller content stay unchanged. Interactive preview: /preview.html?kind=block&id=mfa-challenge--labels.",
|
|
2119
|
+
labels: [
|
|
2120
|
+
{
|
|
2121
|
+
key: "eyebrow",
|
|
2122
|
+
type: "string",
|
|
2123
|
+
state: "Default content and accessible names"
|
|
2124
|
+
},
|
|
2125
|
+
{
|
|
2126
|
+
key: "title",
|
|
2127
|
+
type: "string",
|
|
2128
|
+
state: "Default content and accessible names"
|
|
2129
|
+
},
|
|
2130
|
+
{
|
|
2131
|
+
key: "backupTitle",
|
|
2132
|
+
type: "string",
|
|
2133
|
+
state: "Default content and accessible names"
|
|
2134
|
+
},
|
|
2135
|
+
{
|
|
2136
|
+
key: "backupDescription",
|
|
2137
|
+
type: "string",
|
|
2138
|
+
state: "Default content and accessible names"
|
|
2139
|
+
},
|
|
2140
|
+
{
|
|
2141
|
+
key: "destinationDescription",
|
|
2142
|
+
type: "(length: number, destination: string) => string",
|
|
2143
|
+
state: "Default content and accessible names"
|
|
2144
|
+
},
|
|
2145
|
+
{
|
|
2146
|
+
key: "description",
|
|
2147
|
+
type: "(length: number) => string",
|
|
2148
|
+
state: "Default content and accessible names"
|
|
2149
|
+
},
|
|
2150
|
+
{
|
|
2151
|
+
key: "formLabel",
|
|
2152
|
+
type: "string",
|
|
2153
|
+
state: "Default content and accessible names"
|
|
2154
|
+
},
|
|
2155
|
+
{
|
|
2156
|
+
key: "codeLabel",
|
|
2157
|
+
type: "string",
|
|
2158
|
+
state: "Default content and accessible names"
|
|
2159
|
+
},
|
|
2160
|
+
{
|
|
2161
|
+
key: "codeRequired",
|
|
2162
|
+
type: "(length: number) => string",
|
|
2163
|
+
state: "Validation feedback"
|
|
2164
|
+
},
|
|
2165
|
+
{
|
|
2166
|
+
key: "backupLabel",
|
|
2167
|
+
type: "string",
|
|
2168
|
+
state: "Default content and accessible names"
|
|
2169
|
+
},
|
|
2170
|
+
{
|
|
2171
|
+
key: "backupPlaceholder",
|
|
2172
|
+
type: "string",
|
|
2173
|
+
state: "Default content and accessible names"
|
|
2174
|
+
},
|
|
2175
|
+
{
|
|
2176
|
+
key: "backupHint",
|
|
2177
|
+
type: "string",
|
|
2178
|
+
state: "Default content and accessible names"
|
|
2179
|
+
},
|
|
2180
|
+
{
|
|
2181
|
+
key: "backupRequired",
|
|
2182
|
+
type: "string",
|
|
2183
|
+
state: "Validation feedback"
|
|
2184
|
+
},
|
|
2185
|
+
{
|
|
2186
|
+
key: "submit",
|
|
2187
|
+
type: "string",
|
|
2188
|
+
state: "Default content and accessible names"
|
|
2189
|
+
},
|
|
2190
|
+
{
|
|
2191
|
+
key: "useCode",
|
|
2192
|
+
type: "string",
|
|
2193
|
+
state: "Default content and accessible names"
|
|
2194
|
+
},
|
|
2195
|
+
{
|
|
2196
|
+
key: "resendIn",
|
|
2197
|
+
type: "(remaining: number) => string",
|
|
2198
|
+
state: "Default content and accessible names"
|
|
2199
|
+
},
|
|
2200
|
+
{
|
|
2201
|
+
key: "resend",
|
|
2202
|
+
type: "string",
|
|
2203
|
+
state: "Default content and accessible names"
|
|
2204
|
+
},
|
|
2205
|
+
{
|
|
2206
|
+
key: "resent",
|
|
2207
|
+
type: "string",
|
|
2208
|
+
state: "Async feedback"
|
|
2209
|
+
},
|
|
2210
|
+
{
|
|
2211
|
+
key: "backToSignIn",
|
|
2212
|
+
type: "string",
|
|
2213
|
+
state: "Default content and accessible names"
|
|
2214
|
+
},
|
|
2215
|
+
{
|
|
2216
|
+
key: "fallbackError",
|
|
2217
|
+
type: "string",
|
|
2218
|
+
state: "Validation feedback"
|
|
2219
|
+
}
|
|
2220
|
+
],
|
|
2016
2221
|
uses: [
|
|
2017
2222
|
"OtpInput",
|
|
2018
2223
|
"Field",
|
|
@@ -2024,13 +2229,15 @@ const meta$41 = {
|
|
|
2024
2229
|
//#endregion
|
|
2025
2230
|
//#region src/auth/ResetPasswordForm/ResetPasswordForm.tsx
|
|
2026
2231
|
/** New password + confirmation with length and mismatch validation, then a success state. */
|
|
2027
|
-
function ResetPasswordForm({ onSubmit, error: errorProp, minPasswordLength = 8, onContinue, eyebrow
|
|
2232
|
+
function ResetPasswordForm({ labels, onSubmit, error: errorProp, minPasswordLength = 8, onContinue, eyebrow: eyebrowProp, className }) {
|
|
2233
|
+
const { t } = useI18n();
|
|
2234
|
+
const eyebrow = eyebrowProp === void 0 ? labels?.eyebrow ?? t("resetPassword.eyebrow") : eyebrowProp;
|
|
2028
2235
|
const [password, setPassword] = useState("");
|
|
2029
2236
|
const [confirm, setConfirm] = useState("");
|
|
2030
2237
|
const [confirmTouched, setConfirmTouched] = useState(false);
|
|
2031
2238
|
const [submitted, setSubmitted] = useState(false);
|
|
2032
2239
|
const [done, setDone] = useState(false);
|
|
2033
|
-
const { loading, error, run } = useAsyncSubmit(
|
|
2240
|
+
const { loading, error, run } = useAsyncSubmit(labels?.fallbackError ?? t("resetPassword.fallbackError"));
|
|
2034
2241
|
const alert = errorProp ?? error;
|
|
2035
2242
|
const tooShort = password.length < minPasswordLength;
|
|
2036
2243
|
const mismatch = confirm !== password;
|
|
@@ -2048,19 +2255,19 @@ function ResetPasswordForm({ onSubmit, error: errorProp, minPasswordLength = 8,
|
|
|
2048
2255
|
}),
|
|
2049
2256
|
/* @__PURE__ */ jsx(AuthHeader, {
|
|
2050
2257
|
eyebrow,
|
|
2051
|
-
title:
|
|
2052
|
-
description:
|
|
2258
|
+
title: labels?.successTitle ?? t("resetPassword.successTitle"),
|
|
2259
|
+
description: labels?.successDescription ?? t("resetPassword.successDescription")
|
|
2053
2260
|
}),
|
|
2054
2261
|
/* @__PURE__ */ jsx("div", {
|
|
2055
2262
|
role: "status",
|
|
2056
2263
|
className: "sr-only",
|
|
2057
|
-
children: "
|
|
2264
|
+
children: labels?.successStatus ?? t("resetPassword.successStatus")
|
|
2058
2265
|
}),
|
|
2059
2266
|
/* @__PURE__ */ jsx(Button, {
|
|
2060
2267
|
size: "lg",
|
|
2061
2268
|
className: "w-full",
|
|
2062
2269
|
onClick: onContinue,
|
|
2063
|
-
children:
|
|
2270
|
+
children: labels?.continue ?? t("resetPassword.continue")
|
|
2064
2271
|
})
|
|
2065
2272
|
]
|
|
2066
2273
|
});
|
|
@@ -2068,11 +2275,11 @@ function ResetPasswordForm({ onSubmit, error: errorProp, minPasswordLength = 8,
|
|
|
2068
2275
|
className: cn(authFormClass, className),
|
|
2069
2276
|
children: [/* @__PURE__ */ jsx(AuthHeader, {
|
|
2070
2277
|
eyebrow,
|
|
2071
|
-
title:
|
|
2072
|
-
description:
|
|
2278
|
+
title: labels?.title ?? t("resetPassword.title"),
|
|
2279
|
+
description: labels?.description?.(minPasswordLength) ?? t("resetPassword.description", { minimum: minPasswordLength })
|
|
2073
2280
|
}), /* @__PURE__ */ jsxs("form", {
|
|
2074
2281
|
noValidate: true,
|
|
2075
|
-
"aria-label":
|
|
2282
|
+
"aria-label": labels?.title ?? t("resetPassword.title"),
|
|
2076
2283
|
className: "flex flex-col gap-4",
|
|
2077
2284
|
onSubmit: (e) => {
|
|
2078
2285
|
e.preventDefault();
|
|
@@ -2088,27 +2295,23 @@ function ResetPasswordForm({ onSubmit, error: errorProp, minPasswordLength = 8,
|
|
|
2088
2295
|
/* @__PURE__ */ jsxs(Field, {
|
|
2089
2296
|
invalid: passwordInvalid,
|
|
2090
2297
|
children: [
|
|
2091
|
-
/* @__PURE__ */ jsx(FieldLabel, { children:
|
|
2298
|
+
/* @__PURE__ */ jsx(FieldLabel, { children: labels?.newPassword ?? t("resetPassword.newPassword") }),
|
|
2092
2299
|
/* @__PURE__ */ jsx(PasswordInput, {
|
|
2093
2300
|
showStrength: true,
|
|
2094
2301
|
value: password,
|
|
2095
2302
|
onValueChange: setPassword,
|
|
2096
2303
|
required: true
|
|
2097
2304
|
}),
|
|
2098
|
-
/* @__PURE__ */
|
|
2305
|
+
/* @__PURE__ */ jsx(FieldError, {
|
|
2099
2306
|
match: passwordInvalid,
|
|
2100
|
-
children:
|
|
2101
|
-
"Use at least ",
|
|
2102
|
-
minPasswordLength,
|
|
2103
|
-
" characters."
|
|
2104
|
-
]
|
|
2307
|
+
children: labels?.passwordTooShort?.(minPasswordLength) ?? t("resetPassword.passwordTooShort", { minimum: minPasswordLength })
|
|
2105
2308
|
})
|
|
2106
2309
|
]
|
|
2107
2310
|
}),
|
|
2108
2311
|
/* @__PURE__ */ jsxs(Field, {
|
|
2109
2312
|
invalid: confirmInvalid,
|
|
2110
2313
|
children: [
|
|
2111
|
-
/* @__PURE__ */ jsx(FieldLabel, { children:
|
|
2314
|
+
/* @__PURE__ */ jsx(FieldLabel, { children: labels?.confirmPassword ?? t("resetPassword.confirmPassword") }),
|
|
2112
2315
|
/* @__PURE__ */ jsx(PasswordInput, {
|
|
2113
2316
|
autoComplete: "new-password",
|
|
2114
2317
|
value: confirm,
|
|
@@ -2118,7 +2321,7 @@ function ResetPasswordForm({ onSubmit, error: errorProp, minPasswordLength = 8,
|
|
|
2118
2321
|
}),
|
|
2119
2322
|
/* @__PURE__ */ jsx(FieldError, {
|
|
2120
2323
|
match: confirmInvalid,
|
|
2121
|
-
children:
|
|
2324
|
+
children: labels?.passwordMismatch ?? t("resetPassword.passwordMismatch")
|
|
2122
2325
|
})
|
|
2123
2326
|
]
|
|
2124
2327
|
}),
|
|
@@ -2127,7 +2330,7 @@ function ResetPasswordForm({ onSubmit, error: errorProp, minPasswordLength = 8,
|
|
|
2127
2330
|
size: "lg",
|
|
2128
2331
|
loading,
|
|
2129
2332
|
className: "mt-2 w-full",
|
|
2130
|
-
children:
|
|
2333
|
+
children: labels?.submit ?? t("resetPassword.submit")
|
|
2131
2334
|
})
|
|
2132
2335
|
]
|
|
2133
2336
|
})]
|
|
@@ -2139,7 +2342,74 @@ const meta$56 = {
|
|
|
2139
2342
|
name: "Reset password form",
|
|
2140
2343
|
family: "auth",
|
|
2141
2344
|
status: "stable",
|
|
2142
|
-
description: "New password with a strength meter and a confirmation field with mismatch validation, then a success state.",
|
|
2345
|
+
description: "New password with a strength meter and a confirmation field with mismatch validation, then a success state. Optional labels?: Partial<ResetPasswordFormLabels> overrides built-in copy; explicit props and validation messages win, then labels, then I18nProvider (en/es). No provider preserves English; fixtures and caller content stay unchanged. Interactive preview: /preview.html?kind=block&id=reset-password-form--labels.",
|
|
2346
|
+
labels: [
|
|
2347
|
+
{
|
|
2348
|
+
key: "eyebrow",
|
|
2349
|
+
type: "string",
|
|
2350
|
+
state: "Default content and accessible names"
|
|
2351
|
+
},
|
|
2352
|
+
{
|
|
2353
|
+
key: "title",
|
|
2354
|
+
type: "string",
|
|
2355
|
+
state: "Default content and accessible names"
|
|
2356
|
+
},
|
|
2357
|
+
{
|
|
2358
|
+
key: "description",
|
|
2359
|
+
type: "(minimum: number) => string",
|
|
2360
|
+
state: "Default content and accessible names"
|
|
2361
|
+
},
|
|
2362
|
+
{
|
|
2363
|
+
key: "newPassword",
|
|
2364
|
+
type: "string",
|
|
2365
|
+
state: "Default content and accessible names"
|
|
2366
|
+
},
|
|
2367
|
+
{
|
|
2368
|
+
key: "confirmPassword",
|
|
2369
|
+
type: "string",
|
|
2370
|
+
state: "Default content and accessible names"
|
|
2371
|
+
},
|
|
2372
|
+
{
|
|
2373
|
+
key: "passwordTooShort",
|
|
2374
|
+
type: "(minimum: number) => string",
|
|
2375
|
+
state: "Validation feedback"
|
|
2376
|
+
},
|
|
2377
|
+
{
|
|
2378
|
+
key: "passwordMismatch",
|
|
2379
|
+
type: "string",
|
|
2380
|
+
state: "Validation feedback"
|
|
2381
|
+
},
|
|
2382
|
+
{
|
|
2383
|
+
key: "submit",
|
|
2384
|
+
type: "string",
|
|
2385
|
+
state: "Default content and accessible names"
|
|
2386
|
+
},
|
|
2387
|
+
{
|
|
2388
|
+
key: "successTitle",
|
|
2389
|
+
type: "string",
|
|
2390
|
+
state: "Async feedback"
|
|
2391
|
+
},
|
|
2392
|
+
{
|
|
2393
|
+
key: "successDescription",
|
|
2394
|
+
type: "string",
|
|
2395
|
+
state: "Async feedback"
|
|
2396
|
+
},
|
|
2397
|
+
{
|
|
2398
|
+
key: "successStatus",
|
|
2399
|
+
type: "string",
|
|
2400
|
+
state: "Async feedback"
|
|
2401
|
+
},
|
|
2402
|
+
{
|
|
2403
|
+
key: "continue",
|
|
2404
|
+
type: "string",
|
|
2405
|
+
state: "Default content and accessible names"
|
|
2406
|
+
},
|
|
2407
|
+
{
|
|
2408
|
+
key: "fallbackError",
|
|
2409
|
+
type: "string",
|
|
2410
|
+
state: "Validation feedback"
|
|
2411
|
+
}
|
|
2412
|
+
],
|
|
2143
2413
|
uses: [
|
|
2144
2414
|
"Field",
|
|
2145
2415
|
"PasswordInput",
|
|
@@ -2169,7 +2439,9 @@ const ssoProviders = [
|
|
|
2169
2439
|
//#endregion
|
|
2170
2440
|
//#region src/auth/SsoButtons/SsoButtons.tsx
|
|
2171
2441
|
/** Neutral single-sign-on buttons: text labels and lucide icons, no brand colours or logos. */
|
|
2172
|
-
function SsoButtons({ providers = ssoProviders, onSelect, loadingId = null, disabled = false, layout = "stack", label
|
|
2442
|
+
function SsoButtons({ labels, providers = ssoProviders, onSelect, loadingId = null, disabled = false, layout = "stack", label: labelProp, className }) {
|
|
2443
|
+
const { t } = useI18n();
|
|
2444
|
+
const label = labelProp ?? labels?.label ?? t("ssoButtons.label");
|
|
2173
2445
|
return /* @__PURE__ */ jsx("div", {
|
|
2174
2446
|
role: "group",
|
|
2175
2447
|
"aria-label": label,
|
|
@@ -2193,18 +2465,23 @@ const linkHandler = (fn) => fn ? (e) => {
|
|
|
2193
2465
|
fn();
|
|
2194
2466
|
} : void 0;
|
|
2195
2467
|
/** Email + password sign-in with remember me, forgot-password link, SSO slot, error alert and loading. */
|
|
2196
|
-
function SignInForm({ identifier, messages, passwordHelp, passwordHelpId, ref, fieldInvalid, feedbackId, "aria-describedby": describedBy, "aria-label":
|
|
2468
|
+
function SignInForm({ labels, identifier, messages, passwordHelp, passwordHelpId, ref, fieldInvalid, feedbackId, "aria-describedby": describedBy, "aria-label": ariaLabelProp, "aria-labelledby": labelledBy, onSubmit, error: errorProp, loading: loadingProp, defaultEmail = "", forgotPasswordHref = "#", onForgotPassword, signUpHref = "#", onSignUp, signUpPrompt, sso = /* @__PURE__ */ jsx(SsoButtons, {}), eyebrow: eyebrowProp, title: titleProp, description: descriptionProp, headingLevel, className }) {
|
|
2469
|
+
const { t } = useI18n();
|
|
2470
|
+
const eyebrow = eyebrowProp === void 0 ? labels?.eyebrow ?? t("signIn.eyebrow") : eyebrowProp;
|
|
2471
|
+
const title = titleProp === void 0 ? labels?.title ?? t("signIn.title") : titleProp;
|
|
2472
|
+
const description = descriptionProp === void 0 ? labels?.description ?? t("signIn.description") : descriptionProp;
|
|
2473
|
+
const ariaLabel = ariaLabelProp ?? labels?.formLabel ?? t("signIn.formLabel");
|
|
2197
2474
|
const [email, setEmail] = useState(defaultEmail);
|
|
2198
2475
|
const [password, setPassword] = useState("");
|
|
2199
2476
|
const [remember, setRemember] = useState(true);
|
|
2200
2477
|
const [submitted, setSubmitted] = useState(false);
|
|
2201
|
-
const { loading, error, run } = useAsyncSubmit(
|
|
2478
|
+
const { loading, error, run } = useAsyncSubmit(labels?.fallbackError ?? t("signIn.fallbackError"));
|
|
2202
2479
|
const busy = loadingProp ?? loading;
|
|
2203
2480
|
const alert = errorProp ?? error;
|
|
2204
2481
|
const identifierInput = useRef(null);
|
|
2205
2482
|
const passwordInput = useRef(null);
|
|
2206
2483
|
useImperativeHandle(ref, () => ({ focus: (field) => (field === "password" ? passwordInput : identifierInput).current?.focus() }), []);
|
|
2207
|
-
const identifierError = authIdentifierError(email, identifier, messages);
|
|
2484
|
+
const identifierError = authIdentifierError(email, identifier, messages, t, labels);
|
|
2208
2485
|
const emailInvalid = submitted && identifierError !== null;
|
|
2209
2486
|
const passwordInvalid = submitted && password === "";
|
|
2210
2487
|
return /* @__PURE__ */ jsxs("div", {
|
|
@@ -2249,14 +2526,14 @@ function SignInForm({ identifier, messages, passwordHelp, passwordHelpId, ref, f
|
|
|
2249
2526
|
/* @__PURE__ */ jsxs(Field, {
|
|
2250
2527
|
invalid: emailInvalid || fieldInvalid?.identifier === true,
|
|
2251
2528
|
children: [
|
|
2252
|
-
/* @__PURE__ */ jsx(FieldLabel, { children: identifier?.label ?? "
|
|
2529
|
+
/* @__PURE__ */ jsx(FieldLabel, { children: identifier?.label ?? labels?.identifierLabel ?? t("signIn.identifierLabel") }),
|
|
2253
2530
|
/* @__PURE__ */ jsx(Input, {
|
|
2254
2531
|
ref: identifierInput,
|
|
2255
2532
|
"aria-describedby": fieldInvalid?.identifier ? feedbackId : void 0,
|
|
2256
2533
|
type: identifier?.type ?? "email",
|
|
2257
2534
|
leadingIcon: Mail,
|
|
2258
2535
|
autoComplete: identifier?.autoComplete ?? "email",
|
|
2259
|
-
placeholder: identifier?.placeholder ?? "
|
|
2536
|
+
placeholder: identifier?.placeholder ?? labels?.identifierPlaceholder ?? t("signIn.identifierPlaceholder"),
|
|
2260
2537
|
minLength: identifier?.minLength,
|
|
2261
2538
|
maxLength: identifier?.maxLength,
|
|
2262
2539
|
value: email,
|
|
@@ -2279,11 +2556,11 @@ function SignInForm({ identifier, messages, passwordHelp, passwordHelpId, ref, f
|
|
|
2279
2556
|
children: [
|
|
2280
2557
|
/* @__PURE__ */ jsxs("div", {
|
|
2281
2558
|
className: "flex items-center justify-between gap-3",
|
|
2282
|
-
children: [/* @__PURE__ */ jsx(FieldLabel, { children: "
|
|
2559
|
+
children: [/* @__PURE__ */ jsx(FieldLabel, { children: labels?.password ?? t("signIn.password") }), /* @__PURE__ */ jsx(Link, {
|
|
2283
2560
|
href: forgotPasswordHref,
|
|
2284
2561
|
onClick: linkHandler(onForgotPassword),
|
|
2285
2562
|
className: "text-[12.5px]",
|
|
2286
|
-
children:
|
|
2563
|
+
children: labels?.forgotPassword ?? t("signIn.forgotPassword")
|
|
2287
2564
|
})]
|
|
2288
2565
|
}),
|
|
2289
2566
|
/* @__PURE__ */ jsx(PasswordInput, {
|
|
@@ -2301,12 +2578,12 @@ function SignInForm({ identifier, messages, passwordHelp, passwordHelpId, ref, f
|
|
|
2301
2578
|
/* @__PURE__ */ jsx(FieldError, {
|
|
2302
2579
|
role: "alert",
|
|
2303
2580
|
match: passwordInvalid,
|
|
2304
|
-
children: messages?.passwordRequired ??
|
|
2581
|
+
children: messages?.passwordRequired ?? labels?.passwordRequired ?? t("signIn.passwordRequired")
|
|
2305
2582
|
})
|
|
2306
2583
|
]
|
|
2307
2584
|
}),
|
|
2308
2585
|
/* @__PURE__ */ jsx(Checkbox, {
|
|
2309
|
-
label:
|
|
2586
|
+
label: labels?.remember ?? t("signIn.remember"),
|
|
2310
2587
|
checked: remember,
|
|
2311
2588
|
onCheckedChange: setRemember
|
|
2312
2589
|
}),
|
|
@@ -2315,20 +2592,20 @@ function SignInForm({ identifier, messages, passwordHelp, passwordHelpId, ref, f
|
|
|
2315
2592
|
size: "lg",
|
|
2316
2593
|
loading: busy,
|
|
2317
2594
|
className: "mt-2 w-full",
|
|
2318
|
-
children:
|
|
2595
|
+
children: labels?.submit ?? t("signIn.submit")
|
|
2319
2596
|
})
|
|
2320
2597
|
]
|
|
2321
2598
|
}),
|
|
2322
|
-
sso != null && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(AuthDivider, { children:
|
|
2599
|
+
sso != null && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(AuthDivider, { children: labels?.divider ?? t("signIn.divider") }), sso] }),
|
|
2323
2600
|
signUpPrompt !== null && /* @__PURE__ */ jsx("p", {
|
|
2324
2601
|
className: "mt-7 text-center text-[13px] text-muted-foreground",
|
|
2325
2602
|
children: signUpPrompt === void 0 ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
2326
|
-
|
|
2603
|
+
labels?.signUpPrompt ?? t("signIn.signUpPrompt"),
|
|
2327
2604
|
" ",
|
|
2328
2605
|
/* @__PURE__ */ jsx(Link, {
|
|
2329
2606
|
href: signUpHref,
|
|
2330
2607
|
onClick: linkHandler(onSignUp),
|
|
2331
|
-
children:
|
|
2608
|
+
children: labels?.signUp ?? t("signIn.signUp")
|
|
2332
2609
|
})
|
|
2333
2610
|
] }) : signUpPrompt
|
|
2334
2611
|
})
|
|
@@ -2341,7 +2618,99 @@ const meta$61 = {
|
|
|
2341
2618
|
name: "Sign-in form",
|
|
2342
2619
|
family: "auth",
|
|
2343
2620
|
status: "stable",
|
|
2344
|
-
description: "Email (default) or text identifier and password sign-in. Supports identifier (type, autoComplete, label, help/helpId, placeholder, minLength/maxLength), messages (identifierRequired/identifierInvalid/identifierTooShort/passwordRequired), and React 19 ref.focus. The kit owns inline validation and focuses the first invalid field; consumers supply messages, not a second inline validator. Server errors use error + fieldInvalid + feedbackId; aria-describedby describes the form, while flagged inputs also retain their help and error ids. headingLevel (h1/h2/h3/null) suppresses the heading without losing the form name; aria-label/aria-labelledby override the default name. passwordHelp/passwordHelpId describe the password. Text submissions add values.identifier and retain values.email; email-mode payloads are unchanged. sso and signUpPrompt accept replacements or null. Preview: sign-in-form--username.",
|
|
2621
|
+
description: "Email (default) or text identifier and password sign-in. Supports identifier (type, autoComplete, label, help/helpId, placeholder, minLength/maxLength), messages (identifierRequired/identifierInvalid/identifierTooShort/passwordRequired), and React 19 ref.focus. The kit owns inline validation and focuses the first invalid field; consumers supply messages, not a second inline validator. Server errors use error + fieldInvalid + feedbackId; aria-describedby describes the form, while flagged inputs also retain their help and error ids. headingLevel (h1/h2/h3/null) suppresses the heading without losing the form name; aria-label/aria-labelledby override the default name. passwordHelp/passwordHelpId describe the password. Text submissions add values.identifier and retain values.email; email-mode payloads are unchanged. sso and signUpPrompt accept replacements or null. Preview: sign-in-form--username. Optional labels?: Partial<SignInFormLabels> overrides built-in copy; explicit props and validation messages win, then labels, then I18nProvider (en/es). No provider preserves English; fixtures and caller content stay unchanged. Interactive preview: /preview.html?kind=block&id=sign-in-form--labels.",
|
|
2622
|
+
labels: [
|
|
2623
|
+
{
|
|
2624
|
+
key: "eyebrow",
|
|
2625
|
+
type: "string",
|
|
2626
|
+
state: "Default content and accessible names"
|
|
2627
|
+
},
|
|
2628
|
+
{
|
|
2629
|
+
key: "title",
|
|
2630
|
+
type: "string",
|
|
2631
|
+
state: "Default content and accessible names"
|
|
2632
|
+
},
|
|
2633
|
+
{
|
|
2634
|
+
key: "description",
|
|
2635
|
+
type: "string",
|
|
2636
|
+
state: "Default content and accessible names"
|
|
2637
|
+
},
|
|
2638
|
+
{
|
|
2639
|
+
key: "formLabel",
|
|
2640
|
+
type: "string",
|
|
2641
|
+
state: "Default content and accessible names"
|
|
2642
|
+
},
|
|
2643
|
+
{
|
|
2644
|
+
key: "identifierLabel",
|
|
2645
|
+
type: "string",
|
|
2646
|
+
state: "Default content and accessible names"
|
|
2647
|
+
},
|
|
2648
|
+
{
|
|
2649
|
+
key: "identifierPlaceholder",
|
|
2650
|
+
type: "string",
|
|
2651
|
+
state: "Default content and accessible names"
|
|
2652
|
+
},
|
|
2653
|
+
{
|
|
2654
|
+
key: "password",
|
|
2655
|
+
type: "string",
|
|
2656
|
+
state: "Default content and accessible names"
|
|
2657
|
+
},
|
|
2658
|
+
{
|
|
2659
|
+
key: "forgotPassword",
|
|
2660
|
+
type: "string",
|
|
2661
|
+
state: "Default content and accessible names"
|
|
2662
|
+
},
|
|
2663
|
+
{
|
|
2664
|
+
key: "passwordRequired",
|
|
2665
|
+
type: "string",
|
|
2666
|
+
state: "Validation feedback"
|
|
2667
|
+
},
|
|
2668
|
+
{
|
|
2669
|
+
key: "remember",
|
|
2670
|
+
type: "string",
|
|
2671
|
+
state: "Default content and accessible names"
|
|
2672
|
+
},
|
|
2673
|
+
{
|
|
2674
|
+
key: "submit",
|
|
2675
|
+
type: "string",
|
|
2676
|
+
state: "Default content and accessible names"
|
|
2677
|
+
},
|
|
2678
|
+
{
|
|
2679
|
+
key: "divider",
|
|
2680
|
+
type: "string",
|
|
2681
|
+
state: "Default content and accessible names"
|
|
2682
|
+
},
|
|
2683
|
+
{
|
|
2684
|
+
key: "signUpPrompt",
|
|
2685
|
+
type: "string",
|
|
2686
|
+
state: "Default content and accessible names"
|
|
2687
|
+
},
|
|
2688
|
+
{
|
|
2689
|
+
key: "signUp",
|
|
2690
|
+
type: "string",
|
|
2691
|
+
state: "Default content and accessible names"
|
|
2692
|
+
},
|
|
2693
|
+
{
|
|
2694
|
+
key: "fallbackError",
|
|
2695
|
+
type: "string",
|
|
2696
|
+
state: "Validation feedback"
|
|
2697
|
+
},
|
|
2698
|
+
{
|
|
2699
|
+
key: "identifierRequired",
|
|
2700
|
+
type: "string",
|
|
2701
|
+
state: "Validation feedback"
|
|
2702
|
+
},
|
|
2703
|
+
{
|
|
2704
|
+
key: "identifierInvalid",
|
|
2705
|
+
type: "string",
|
|
2706
|
+
state: "Validation feedback"
|
|
2707
|
+
},
|
|
2708
|
+
{
|
|
2709
|
+
key: "identifierTooShort",
|
|
2710
|
+
type: "string",
|
|
2711
|
+
state: "Validation feedback"
|
|
2712
|
+
}
|
|
2713
|
+
],
|
|
2345
2714
|
uses: [
|
|
2346
2715
|
"Field",
|
|
2347
2716
|
"FieldLabel",
|
|
@@ -2387,14 +2756,15 @@ const focusField = (fieldId) => {
|
|
|
2387
2756
|
* Error summary for long forms: lists every problem with a link that moves focus to the field.
|
|
2388
2757
|
* After a failed submit it takes focus, so screen readers announce it.
|
|
2389
2758
|
*/
|
|
2390
|
-
function ValidationSummary({ errors = validationIssues, submitCount = 0, title, className }) {
|
|
2759
|
+
function ValidationSummary({ labels, errors = validationIssues, submitCount = 0, title, className }) {
|
|
2760
|
+
const { t } = useI18n();
|
|
2391
2761
|
const ref = useRef(null);
|
|
2392
2762
|
const hasErrors = errors.length > 0;
|
|
2393
2763
|
useEffect(() => {
|
|
2394
2764
|
if (submitCount > 0 && hasErrors) ref.current?.focus();
|
|
2395
2765
|
}, [submitCount, hasErrors]);
|
|
2396
2766
|
if (!hasErrors) return null;
|
|
2397
|
-
const heading = title ??
|
|
2767
|
+
const heading = title ?? labels?.title?.(errors.length) ?? t("validationSummary.title", { count: errors.length });
|
|
2398
2768
|
return /* @__PURE__ */ jsx(Alert, {
|
|
2399
2769
|
ref,
|
|
2400
2770
|
tabIndex: -1,
|
|
@@ -2420,7 +2790,11 @@ function ValidationSummary({ errors = validationIssues, submitCount = 0, title,
|
|
|
2420
2790
|
//#endregion
|
|
2421
2791
|
//#region src/auth/SignUpForm/SignUpForm.tsx
|
|
2422
2792
|
/** Account creation: name, work email, password with a strength meter and a required terms checkbox. */
|
|
2423
|
-
function SignUpForm({ fields, messages, unavailable, policyLoading = false, onSubmit, error: errorProp, loading: loadingProp, minPasswordLength = 8, passwordHelp, terms: termsProp, termsHref = "#", privacyHref = "#", signInHref = "#", onSignIn, sso = /* @__PURE__ */ jsx(SsoButtons, {}), eyebrow
|
|
2793
|
+
function SignUpForm({ labels, fields, messages, unavailable, policyLoading = false, onSubmit, error: errorProp, loading: loadingProp, minPasswordLength = 8, passwordHelp, terms: termsProp, termsHref = "#", privacyHref = "#", signInHref = "#", onSignIn, sso = /* @__PURE__ */ jsx(SsoButtons, {}), eyebrow: eyebrowProp, title: titleProp, description: descriptionProp, className }) {
|
|
2794
|
+
const { t } = useI18n();
|
|
2795
|
+
const eyebrow = eyebrowProp === void 0 ? labels?.eyebrow ?? t("signUp.eyebrow") : eyebrowProp;
|
|
2796
|
+
const title = titleProp === void 0 ? labels?.title ?? t("signUp.title") : titleProp;
|
|
2797
|
+
const description = descriptionProp === void 0 ? labels?.description ?? t("signUp.description") : descriptionProp;
|
|
2424
2798
|
const termsErrorId = useId();
|
|
2425
2799
|
const fieldPrefix = useId();
|
|
2426
2800
|
const passwordId = `${fieldPrefix}-password`;
|
|
@@ -2429,7 +2803,7 @@ function SignUpForm({ fields, messages, unavailable, policyLoading = false, onSu
|
|
|
2429
2803
|
const [submitCount, setSubmitCount] = useState(0);
|
|
2430
2804
|
const fieldValue = (id) => Object.hasOwn(fieldValues, id) ? fieldValues[id] ?? "" : "";
|
|
2431
2805
|
const configuredErrors = (fields ?? []).flatMap((field) => {
|
|
2432
|
-
const message = authSignUpFieldError(fieldValue(field.id), field);
|
|
2806
|
+
const message = authSignUpFieldError(fieldValue(field.id), field, t, labels);
|
|
2433
2807
|
return message ? [{
|
|
2434
2808
|
fieldId: `${fieldPrefix}-field-${field.id}`,
|
|
2435
2809
|
label: field.label,
|
|
@@ -2441,25 +2815,33 @@ function SignUpForm({ fields, messages, unavailable, policyLoading = false, onSu
|
|
|
2441
2815
|
const [password, setPassword] = useState("");
|
|
2442
2816
|
const [terms, setTerms] = useState(false);
|
|
2443
2817
|
const [submitted, setSubmitted] = useState(false);
|
|
2444
|
-
const { loading, error, run } = useAsyncSubmit(
|
|
2818
|
+
const { loading, error, run } = useAsyncSubmit(labels?.fallbackError ?? t("signUp.fallbackError"));
|
|
2445
2819
|
const busy = loadingProp ?? loading;
|
|
2446
2820
|
const alert = errorProp ?? error;
|
|
2447
2821
|
const nameInvalid = submitted && name.trim() === "";
|
|
2448
2822
|
const emailInvalid = submitted && !EMAIL_RE$1.test(email.trim());
|
|
2449
2823
|
const passwordInvalid = (submitted || fields !== void 0 && password.length > 0) && password.length < minPasswordLength;
|
|
2450
2824
|
const termsInvalid = submitted && termsProp !== false && !terms;
|
|
2451
|
-
const passwordError = messages?.passwordTooShort?.(minPasswordLength) ??
|
|
2452
|
-
const termsError = messages?.termsRequired ??
|
|
2825
|
+
const passwordError = messages?.passwordTooShort?.(minPasswordLength) ?? labels?.passwordTooShort?.(minPasswordLength) ?? t("signUp.passwordTooShort", { minimum: minPasswordLength });
|
|
2826
|
+
const termsError = messages?.termsRequired ?? labels?.termsRequired ?? t("signUp.termsRequired");
|
|
2827
|
+
const termsLink = /* @__PURE__ */ jsx(Link, {
|
|
2828
|
+
href: termsHref,
|
|
2829
|
+
children: labels?.terms ?? t("signUp.terms")
|
|
2830
|
+
});
|
|
2831
|
+
const privacyLink = /* @__PURE__ */ jsx(Link, {
|
|
2832
|
+
href: privacyHref,
|
|
2833
|
+
children: labels?.privacy ?? t("signUp.privacy")
|
|
2834
|
+
});
|
|
2453
2835
|
const summaryErrors = [
|
|
2454
2836
|
...configuredErrors,
|
|
2455
2837
|
...password.length < minPasswordLength ? [{
|
|
2456
2838
|
fieldId: passwordId,
|
|
2457
|
-
label: "
|
|
2839
|
+
label: labels?.password ?? t("signUp.password"),
|
|
2458
2840
|
message: passwordError
|
|
2459
2841
|
}] : [],
|
|
2460
2842
|
...termsProp !== false && !terms ? [{
|
|
2461
2843
|
fieldId: termsId,
|
|
2462
|
-
label: "
|
|
2844
|
+
label: labels?.terms ?? t("signUp.terms"),
|
|
2463
2845
|
message: termsError
|
|
2464
2846
|
}] : []
|
|
2465
2847
|
];
|
|
@@ -2478,7 +2860,7 @@ function SignUpForm({ fields, messages, unavailable, policyLoading = false, onSu
|
|
|
2478
2860
|
/* @__PURE__ */ jsx("span", {
|
|
2479
2861
|
role: "status",
|
|
2480
2862
|
className: "sr-only",
|
|
2481
|
-
children:
|
|
2863
|
+
children: labels?.policyLoading ?? t("signUp.policyLoading")
|
|
2482
2864
|
}),
|
|
2483
2865
|
/* @__PURE__ */ jsx(Skeleton, {
|
|
2484
2866
|
"aria-hidden": true,
|
|
@@ -2512,7 +2894,7 @@ function SignUpForm({ fields, messages, unavailable, policyLoading = false, onSu
|
|
|
2512
2894
|
}),
|
|
2513
2895
|
/* @__PURE__ */ jsxs("form", {
|
|
2514
2896
|
noValidate: true,
|
|
2515
|
-
"aria-label":
|
|
2897
|
+
"aria-label": labels?.submit ?? t("signUp.submit"),
|
|
2516
2898
|
className: "flex flex-col gap-4",
|
|
2517
2899
|
onSubmit: (e) => {
|
|
2518
2900
|
e.preventDefault();
|
|
@@ -2547,7 +2929,7 @@ function SignUpForm({ fields, messages, unavailable, policyLoading = false, onSu
|
|
|
2547
2929
|
className: "bg-background"
|
|
2548
2930
|
}),
|
|
2549
2931
|
fields !== void 0 ? fields.map((field) => {
|
|
2550
|
-
const message = authSignUpFieldError(fieldValue(field.id), field);
|
|
2932
|
+
const message = authSignUpFieldError(fieldValue(field.id), field, t, labels);
|
|
2551
2933
|
const invalid = submitted && message !== null;
|
|
2552
2934
|
return /* @__PURE__ */ jsxs(Field, {
|
|
2553
2935
|
invalid,
|
|
@@ -2575,43 +2957,43 @@ function SignUpForm({ fields, messages, unavailable, policyLoading = false, onSu
|
|
|
2575
2957
|
}) : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs(Field, {
|
|
2576
2958
|
invalid: nameInvalid,
|
|
2577
2959
|
children: [
|
|
2578
|
-
/* @__PURE__ */ jsx(FieldLabel, { children: "
|
|
2960
|
+
/* @__PURE__ */ jsx(FieldLabel, { children: labels?.name ?? t("signUp.name") }),
|
|
2579
2961
|
/* @__PURE__ */ jsx(Input, {
|
|
2580
2962
|
leadingIcon: User,
|
|
2581
2963
|
autoComplete: "name",
|
|
2582
|
-
placeholder:
|
|
2964
|
+
placeholder: labels?.namePlaceholder ?? t("signUp.namePlaceholder"),
|
|
2583
2965
|
value: name,
|
|
2584
2966
|
onValueChange: setName,
|
|
2585
2967
|
required: true
|
|
2586
2968
|
}),
|
|
2587
2969
|
/* @__PURE__ */ jsx(FieldError, {
|
|
2588
2970
|
match: nameInvalid,
|
|
2589
|
-
children:
|
|
2971
|
+
children: labels?.nameRequired ?? t("signUp.nameRequired")
|
|
2590
2972
|
})
|
|
2591
2973
|
]
|
|
2592
2974
|
}), /* @__PURE__ */ jsxs(Field, {
|
|
2593
2975
|
invalid: emailInvalid,
|
|
2594
2976
|
children: [
|
|
2595
|
-
/* @__PURE__ */ jsx(FieldLabel, { children: "
|
|
2977
|
+
/* @__PURE__ */ jsx(FieldLabel, { children: labels?.email ?? t("signUp.email") }),
|
|
2596
2978
|
/* @__PURE__ */ jsx(Input, {
|
|
2597
2979
|
type: "email",
|
|
2598
2980
|
leadingIcon: Mail,
|
|
2599
2981
|
autoComplete: "email",
|
|
2600
|
-
placeholder: "
|
|
2982
|
+
placeholder: labels?.emailPlaceholder ?? t("signUp.emailPlaceholder"),
|
|
2601
2983
|
value: email,
|
|
2602
2984
|
onValueChange: setEmail,
|
|
2603
2985
|
required: true
|
|
2604
2986
|
}),
|
|
2605
2987
|
/* @__PURE__ */ jsx(FieldError, {
|
|
2606
2988
|
match: emailInvalid,
|
|
2607
|
-
children:
|
|
2989
|
+
children: labels?.emailInvalid ?? t("authValidation.emailInvalid")
|
|
2608
2990
|
})
|
|
2609
2991
|
]
|
|
2610
2992
|
})] }),
|
|
2611
2993
|
/* @__PURE__ */ jsxs(Field, {
|
|
2612
2994
|
invalid: passwordInvalid,
|
|
2613
2995
|
children: [
|
|
2614
|
-
/* @__PURE__ */ jsx(FieldLabel, { children: "
|
|
2996
|
+
/* @__PURE__ */ jsx(FieldLabel, { children: labels?.password ?? t("signUp.password") }),
|
|
2615
2997
|
/* @__PURE__ */ jsx(PasswordInput, {
|
|
2616
2998
|
id: fields !== void 0 ? passwordId : void 0,
|
|
2617
2999
|
showStrength: true,
|
|
@@ -2633,19 +3015,10 @@ function SignUpForm({ fields, messages, unavailable, policyLoading = false, onSu
|
|
|
2633
3015
|
onCheckedChange: setTerms,
|
|
2634
3016
|
"aria-invalid": termsInvalid || void 0,
|
|
2635
3017
|
"aria-describedby": termsInvalid ? termsErrorId : void 0,
|
|
2636
|
-
label:
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
children: "Terms"
|
|
2641
|
-
}),
|
|
2642
|
-
" and ",
|
|
2643
|
-
/* @__PURE__ */ jsx(Link, {
|
|
2644
|
-
href: privacyHref,
|
|
2645
|
-
children: "Privacy Policy"
|
|
2646
|
-
}),
|
|
2647
|
-
"."
|
|
2648
|
-
] })
|
|
3018
|
+
label: labels?.termsConsent?.(termsLink, privacyLink) ?? translatedContent(t("signUp.termsConsent"), {
|
|
3019
|
+
terms: termsLink,
|
|
3020
|
+
privacy: privacyLink
|
|
3021
|
+
})
|
|
2649
3022
|
}), termsInvalid && /* @__PURE__ */ jsx("p", {
|
|
2650
3023
|
id: termsErrorId,
|
|
2651
3024
|
className: "mt-1.5 text-[12.5px] text-destructive-text",
|
|
@@ -2656,15 +3029,15 @@ function SignUpForm({ fields, messages, unavailable, policyLoading = false, onSu
|
|
|
2656
3029
|
size: "lg",
|
|
2657
3030
|
loading: busy,
|
|
2658
3031
|
className: "mt-2 w-full",
|
|
2659
|
-
children:
|
|
3032
|
+
children: labels?.submit ?? t("signUp.submit")
|
|
2660
3033
|
})
|
|
2661
3034
|
]
|
|
2662
3035
|
}),
|
|
2663
|
-
sso != null && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(AuthDivider, { children:
|
|
3036
|
+
sso != null && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(AuthDivider, { children: labels?.divider ?? t("signUp.divider") }), sso] }),
|
|
2664
3037
|
/* @__PURE__ */ jsxs("p", {
|
|
2665
3038
|
className: "mt-7 text-center text-[13px] text-muted-foreground",
|
|
2666
3039
|
children: [
|
|
2667
|
-
|
|
3040
|
+
labels?.signInPrompt ?? t("signUp.signInPrompt"),
|
|
2668
3041
|
" ",
|
|
2669
3042
|
/* @__PURE__ */ jsx(Link, {
|
|
2670
3043
|
href: signInHref,
|
|
@@ -2672,7 +3045,7 @@ function SignUpForm({ fields, messages, unavailable, policyLoading = false, onSu
|
|
|
2672
3045
|
e.preventDefault();
|
|
2673
3046
|
onSignIn();
|
|
2674
3047
|
} : void 0,
|
|
2675
|
-
children:
|
|
3048
|
+
children: labels?.signIn ?? t("signUp.signIn")
|
|
2676
3049
|
})
|
|
2677
3050
|
]
|
|
2678
3051
|
})
|
|
@@ -2685,7 +3058,124 @@ const meta$62 = {
|
|
|
2685
3058
|
name: "Sign-up form",
|
|
2686
3059
|
family: "auth",
|
|
2687
3060
|
status: "stable",
|
|
2688
|
-
description: "Account creation with default name/email fields or ordered text/email fields (values.fields), a password strength meter and required consent (terms=false opts out). minPasswordLength defaults to 8 and drives length validation and the insufficient-length meter; optional passwordHelp can receive the minimum. Configured fields support help, required, autoComplete and validation messages, with a linked validation summary on invalid submit. policyLoading renders skeletons without a form; unavailable replaces the form with consumer title, message and optional action. loading remains submitting; error is form-level feedback. Examples: custom-fields, no-terms, unavailable, loading, submitting and error.",
|
|
3061
|
+
description: "Account creation with default name/email fields or ordered text/email fields (values.fields), a password strength meter and required consent (terms=false opts out). minPasswordLength defaults to 8 and drives length validation and the insufficient-length meter; optional passwordHelp can receive the minimum. Configured fields support help, required, autoComplete and validation messages, with a linked validation summary on invalid submit. policyLoading renders skeletons without a form; unavailable replaces the form with consumer title, message and optional action. loading remains submitting; error is form-level feedback. Examples: custom-fields, no-terms, unavailable, loading, submitting and error. Optional labels?: Partial<SignUpFormLabels> overrides built-in copy; explicit props and validation messages win, then labels, then I18nProvider (en/es). No provider preserves English; fixtures and caller content stay unchanged. Interactive preview: /preview.html?kind=block&id=sign-up-form--labels.",
|
|
3062
|
+
labels: [
|
|
3063
|
+
{
|
|
3064
|
+
key: "eyebrow",
|
|
3065
|
+
type: "string",
|
|
3066
|
+
state: "Default content and accessible names"
|
|
3067
|
+
},
|
|
3068
|
+
{
|
|
3069
|
+
key: "title",
|
|
3070
|
+
type: "string",
|
|
3071
|
+
state: "Default content and accessible names"
|
|
3072
|
+
},
|
|
3073
|
+
{
|
|
3074
|
+
key: "description",
|
|
3075
|
+
type: "string",
|
|
3076
|
+
state: "Default content and accessible names"
|
|
3077
|
+
},
|
|
3078
|
+
{
|
|
3079
|
+
key: "name",
|
|
3080
|
+
type: "string",
|
|
3081
|
+
state: "Default content and accessible names"
|
|
3082
|
+
},
|
|
3083
|
+
{
|
|
3084
|
+
key: "namePlaceholder",
|
|
3085
|
+
type: "string",
|
|
3086
|
+
state: "Default content and accessible names"
|
|
3087
|
+
},
|
|
3088
|
+
{
|
|
3089
|
+
key: "nameRequired",
|
|
3090
|
+
type: "string",
|
|
3091
|
+
state: "Validation feedback"
|
|
3092
|
+
},
|
|
3093
|
+
{
|
|
3094
|
+
key: "email",
|
|
3095
|
+
type: "string",
|
|
3096
|
+
state: "Default content and accessible names"
|
|
3097
|
+
},
|
|
3098
|
+
{
|
|
3099
|
+
key: "emailPlaceholder",
|
|
3100
|
+
type: "string",
|
|
3101
|
+
state: "Default content and accessible names"
|
|
3102
|
+
},
|
|
3103
|
+
{
|
|
3104
|
+
key: "password",
|
|
3105
|
+
type: "string",
|
|
3106
|
+
state: "Default content and accessible names"
|
|
3107
|
+
},
|
|
3108
|
+
{
|
|
3109
|
+
key: "passwordTooShort",
|
|
3110
|
+
type: "(minimum: number) => string",
|
|
3111
|
+
state: "Validation feedback"
|
|
3112
|
+
},
|
|
3113
|
+
{
|
|
3114
|
+
key: "termsRequired",
|
|
3115
|
+
type: "string",
|
|
3116
|
+
state: "Validation feedback"
|
|
3117
|
+
},
|
|
3118
|
+
{
|
|
3119
|
+
key: "terms",
|
|
3120
|
+
type: "string",
|
|
3121
|
+
state: "Default content and accessible names"
|
|
3122
|
+
},
|
|
3123
|
+
{
|
|
3124
|
+
key: "privacy",
|
|
3125
|
+
type: "string",
|
|
3126
|
+
state: "Default content and accessible names"
|
|
3127
|
+
},
|
|
3128
|
+
{
|
|
3129
|
+
key: "termsConsent",
|
|
3130
|
+
type: "(terms: ReactNode, privacy: ReactNode) => ReactNode",
|
|
3131
|
+
state: "Async feedback"
|
|
3132
|
+
},
|
|
3133
|
+
{
|
|
3134
|
+
key: "submit",
|
|
3135
|
+
type: "string",
|
|
3136
|
+
state: "Default content and accessible names"
|
|
3137
|
+
},
|
|
3138
|
+
{
|
|
3139
|
+
key: "divider",
|
|
3140
|
+
type: "string",
|
|
3141
|
+
state: "Default content and accessible names"
|
|
3142
|
+
},
|
|
3143
|
+
{
|
|
3144
|
+
key: "signInPrompt",
|
|
3145
|
+
type: "string",
|
|
3146
|
+
state: "Default content and accessible names"
|
|
3147
|
+
},
|
|
3148
|
+
{
|
|
3149
|
+
key: "signIn",
|
|
3150
|
+
type: "string",
|
|
3151
|
+
state: "Default content and accessible names"
|
|
3152
|
+
},
|
|
3153
|
+
{
|
|
3154
|
+
key: "policyLoading",
|
|
3155
|
+
type: "string",
|
|
3156
|
+
state: "Async feedback"
|
|
3157
|
+
},
|
|
3158
|
+
{
|
|
3159
|
+
key: "fallbackError",
|
|
3160
|
+
type: "string",
|
|
3161
|
+
state: "Validation feedback"
|
|
3162
|
+
},
|
|
3163
|
+
{
|
|
3164
|
+
key: "emailInvalid",
|
|
3165
|
+
type: "string",
|
|
3166
|
+
state: "Validation feedback"
|
|
3167
|
+
},
|
|
3168
|
+
{
|
|
3169
|
+
key: "fieldRequired",
|
|
3170
|
+
type: "(label: string) => string",
|
|
3171
|
+
state: "Validation feedback"
|
|
3172
|
+
},
|
|
3173
|
+
{
|
|
3174
|
+
key: "fieldInvalid",
|
|
3175
|
+
type: "string",
|
|
3176
|
+
state: "Validation feedback"
|
|
3177
|
+
}
|
|
3178
|
+
],
|
|
2689
3179
|
uses: [
|
|
2690
3180
|
"Field",
|
|
2691
3181
|
"Input",
|
|
@@ -2706,7 +3196,12 @@ const meta$65 = {
|
|
|
2706
3196
|
name: "SSO buttons",
|
|
2707
3197
|
family: "auth",
|
|
2708
3198
|
status: "stable",
|
|
2709
|
-
description: "Neutral \"Continue with …\" provider buttons with lucide icons and a per-provider loading state.",
|
|
3199
|
+
description: "Neutral \"Continue with …\" provider buttons with lucide icons and a per-provider loading state. Optional labels?: Partial<SsoButtonsLabels> overrides built-in copy; explicit props and validation messages win, then labels, then I18nProvider (en/es). No provider preserves English; fixtures and caller content stay unchanged. Interactive preview: /preview.html?kind=block&id=sso-buttons--labels.",
|
|
3200
|
+
labels: [{
|
|
3201
|
+
key: "label",
|
|
3202
|
+
type: "string",
|
|
3203
|
+
state: "Default content and accessible names"
|
|
3204
|
+
}],
|
|
2710
3205
|
uses: ["Button"]
|
|
2711
3206
|
};
|
|
2712
3207
|
//#endregion
|
|
@@ -3333,55 +3828,59 @@ function SpendVsBudget({ data = sampleSpend, budget = sampleBudget, currency = "
|
|
|
3333
3828
|
value: formatMoney(budget, currency)
|
|
3334
3829
|
}
|
|
3335
3830
|
];
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
className: "mt-4 grid grid-cols-3 gap-4",
|
|
3355
|
-
children: stats.map((s) => /* @__PURE__ */ jsxs("div", {
|
|
3356
|
-
className: "min-w-0",
|
|
3357
|
-
children: [/* @__PURE__ */ jsx("dt", {
|
|
3358
|
-
className: "text-[11.5px] text-muted-foreground",
|
|
3359
|
-
children: s.label
|
|
3360
|
-
}), /* @__PURE__ */ jsx("dd", {
|
|
3361
|
-
className: "mt-1 truncate font-mono text-[14px] font-semibold text-foreground tabular-nums",
|
|
3362
|
-
children: s.value
|
|
3831
|
+
const { locale } = useI18n();
|
|
3832
|
+
return /* @__PURE__ */ jsx(ChartLocaleProvider, {
|
|
3833
|
+
locale,
|
|
3834
|
+
children: /* @__PURE__ */ jsxs(Card, {
|
|
3835
|
+
className: cn("p-6", className),
|
|
3836
|
+
children: [
|
|
3837
|
+
/* @__PURE__ */ jsxs("div", {
|
|
3838
|
+
className: "flex flex-wrap items-start justify-between gap-3",
|
|
3839
|
+
children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(TitleTag, {
|
|
3840
|
+
className: "text-[15px] font-semibold tracking-tight text-foreground",
|
|
3841
|
+
children: title
|
|
3842
|
+
}), period && /* @__PURE__ */ jsx("p", {
|
|
3843
|
+
className: "mt-0.5 text-[12.5px] text-muted-foreground",
|
|
3844
|
+
children: period
|
|
3845
|
+
})] }), /* @__PURE__ */ jsx(Badge, {
|
|
3846
|
+
tone: over ? "warning" : "success",
|
|
3847
|
+
dot: true,
|
|
3848
|
+
children: over ? "Forecast over budget" : "Within budget"
|
|
3363
3849
|
})]
|
|
3364
|
-
},
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3850
|
+
}),
|
|
3851
|
+
/* @__PURE__ */ jsx("dl", {
|
|
3852
|
+
className: "mt-4 grid grid-cols-3 gap-4",
|
|
3853
|
+
children: stats.map((s) => /* @__PURE__ */ jsxs("div", {
|
|
3854
|
+
className: "min-w-0",
|
|
3855
|
+
children: [/* @__PURE__ */ jsx("dt", {
|
|
3856
|
+
className: "text-[11.5px] text-muted-foreground",
|
|
3857
|
+
children: s.label
|
|
3858
|
+
}), /* @__PURE__ */ jsx("dd", {
|
|
3859
|
+
className: "mt-1 truncate font-mono text-[14px] font-semibold text-foreground tabular-nums",
|
|
3860
|
+
children: s.value
|
|
3861
|
+
})]
|
|
3862
|
+
}, s.label))
|
|
3863
|
+
}),
|
|
3864
|
+
/* @__PURE__ */ jsx(LineChart, {
|
|
3865
|
+
className: "mt-5",
|
|
3866
|
+
data: rows,
|
|
3867
|
+
index: "day",
|
|
3868
|
+
categories: [
|
|
3869
|
+
"Spend",
|
|
3870
|
+
"Forecast",
|
|
3871
|
+
"Budget"
|
|
3872
|
+
],
|
|
3873
|
+
colors: [
|
|
3874
|
+
"primary",
|
|
3875
|
+
"cyan",
|
|
3876
|
+
"amber"
|
|
3877
|
+
],
|
|
3878
|
+
valueFormatter: money,
|
|
3879
|
+
height,
|
|
3880
|
+
"aria-label": `${title}: ${formatMoney(toDate, currency)} spent, ${formatMoney(forecast, currency)} forecast against a ${formatMoney(budget, currency)} budget`
|
|
3881
|
+
})
|
|
3882
|
+
]
|
|
3883
|
+
})
|
|
3385
3884
|
});
|
|
3386
3885
|
}
|
|
3387
3886
|
//#endregion
|
|
@@ -3712,79 +4211,83 @@ function CostBreakdown({ items = sampleCosts, currency = "USD", title = "Cost br
|
|
|
3712
4211
|
const total = ranked.reduce((sum, i) => sum + i.amount, 0);
|
|
3713
4212
|
const money = (n) => formatMoney(n, currency);
|
|
3714
4213
|
const colorAt = (i) => CHART_COLORS[i % CHART_COLORS.length] ?? "primary";
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
4214
|
+
const { locale } = useI18n();
|
|
4215
|
+
return /* @__PURE__ */ jsx(ChartLocaleProvider, {
|
|
4216
|
+
locale,
|
|
4217
|
+
children: /* @__PURE__ */ jsxs(Card, {
|
|
4218
|
+
className: cn("p-6", className),
|
|
4219
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
4220
|
+
className: "flex items-baseline justify-between gap-3",
|
|
4221
|
+
children: [/* @__PURE__ */ jsx(TitleTag, {
|
|
4222
|
+
className: "text-[15px] font-semibold tracking-tight text-foreground",
|
|
4223
|
+
children: title
|
|
4224
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
4225
|
+
className: "font-mono text-[13px] font-semibold text-foreground tabular-nums",
|
|
4226
|
+
children: money(total)
|
|
4227
|
+
})]
|
|
4228
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
4229
|
+
className: "mt-5 flex flex-col items-center gap-6 sm:flex-row sm:items-center",
|
|
4230
|
+
children: [/* @__PURE__ */ jsx(DonutChart, {
|
|
4231
|
+
data: ranked,
|
|
4232
|
+
index: "label",
|
|
4233
|
+
category: "amount",
|
|
4234
|
+
showLegend: false,
|
|
4235
|
+
centerLabel,
|
|
4236
|
+
valueFormatter: (n) => formatMoney(n, currency, true),
|
|
4237
|
+
height: size,
|
|
4238
|
+
"aria-label": `${title}: ${ranked.map((i) => `${i.label} ${money(i.amount)}`).join(", ")}`,
|
|
4239
|
+
className: "shrink-0"
|
|
4240
|
+
}), /* @__PURE__ */ jsx("ol", {
|
|
4241
|
+
"aria-label": "Categories by cost",
|
|
4242
|
+
className: "grid w-full min-w-0 flex-1 gap-3",
|
|
4243
|
+
children: ranked.map((item, i) => {
|
|
4244
|
+
const pct = total > 0 ? item.amount / total * 100 : 0;
|
|
4245
|
+
return /* @__PURE__ */ jsxs("li", {
|
|
4246
|
+
className: "grid gap-1.5",
|
|
4247
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
4248
|
+
className: "flex items-center justify-between gap-3",
|
|
4249
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
4250
|
+
className: "flex min-w-0 items-center gap-2 text-[13px] text-foreground",
|
|
4251
|
+
children: [
|
|
4252
|
+
/* @__PURE__ */ jsx("span", {
|
|
4253
|
+
"aria-hidden": true,
|
|
4254
|
+
className: "w-4 shrink-0 font-mono text-[11px] text-muted-foreground tabular-nums",
|
|
4255
|
+
children: i + 1
|
|
4256
|
+
}),
|
|
4257
|
+
/* @__PURE__ */ jsx("span", {
|
|
4258
|
+
"aria-hidden": true,
|
|
4259
|
+
className: cn("size-2.5 shrink-0 rounded-[3px]", SWATCH[colorAt(i)])
|
|
4260
|
+
}),
|
|
4261
|
+
/* @__PURE__ */ jsx("span", {
|
|
4262
|
+
className: "truncate",
|
|
4263
|
+
children: item.label
|
|
4264
|
+
})
|
|
4265
|
+
]
|
|
4266
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
4267
|
+
className: "shrink-0 font-mono text-[12.5px] whitespace-nowrap text-muted-foreground tabular-nums",
|
|
4268
|
+
children: [
|
|
4269
|
+
/* @__PURE__ */ jsx("span", {
|
|
4270
|
+
className: "font-semibold text-foreground",
|
|
4271
|
+
children: money(item.amount)
|
|
4272
|
+
}),
|
|
4273
|
+
" · ",
|
|
4274
|
+
pct.toFixed(1),
|
|
4275
|
+
"%"
|
|
4276
|
+
]
|
|
4277
|
+
})]
|
|
4278
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
4279
|
+
"aria-hidden": true,
|
|
4280
|
+
className: "h-1.5 overflow-hidden rounded-full bg-secondary",
|
|
4281
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
4282
|
+
className: cn("h-full rounded-full", SWATCH[colorAt(i)]),
|
|
4283
|
+
style: { width: `${pct}%` }
|
|
4284
|
+
})
|
|
3775
4285
|
})]
|
|
3776
|
-
}
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
3780
|
-
className: cn("h-full rounded-full", SWATCH[colorAt(i)]),
|
|
3781
|
-
style: { width: `${pct}%` }
|
|
3782
|
-
})
|
|
3783
|
-
})]
|
|
3784
|
-
}, item.label);
|
|
3785
|
-
})
|
|
4286
|
+
}, item.label);
|
|
4287
|
+
})
|
|
4288
|
+
})]
|
|
3786
4289
|
})]
|
|
3787
|
-
})
|
|
4290
|
+
})
|
|
3788
4291
|
});
|
|
3789
4292
|
}
|
|
3790
4293
|
//#endregion
|
|
@@ -3995,7 +4498,7 @@ function useDecoratedNodes(nodes, issues, statuses, runMode) {
|
|
|
3995
4498
|
}
|
|
3996
4499
|
//#endregion
|
|
3997
4500
|
//#region src/builders/FlowBuilder/connections.ts
|
|
3998
|
-
function useConnections(nodes,
|
|
4501
|
+
function useConnections(nodes, edges, commit, props) {
|
|
3999
4502
|
const pending = useRef(null);
|
|
4000
4503
|
const seq = useRef(0);
|
|
4001
4504
|
const describe = (c) => ({
|
|
@@ -4034,12 +4537,26 @@ function useConnections(nodes, setEdges, defaultConnect, props) {
|
|
|
4034
4537
|
}
|
|
4035
4538
|
if (props.onConnectEdge) {
|
|
4036
4539
|
const mapped = props.onConnectEdge(describe(c));
|
|
4037
|
-
|
|
4540
|
+
let id;
|
|
4541
|
+
do
|
|
4542
|
+
id = `edge-${++seq.current}-${c.source}-${c.target}`;
|
|
4543
|
+
while (edges.some((edge) => edge.id === id));
|
|
4544
|
+
commit({
|
|
4038
4545
|
...c,
|
|
4039
4546
|
...mapped,
|
|
4040
|
-
id
|
|
4041
|
-
}
|
|
4042
|
-
} else
|
|
4547
|
+
id
|
|
4548
|
+
});
|
|
4549
|
+
} else if (c.source && c.target && !edges.some((edge) => edge.source === c.source && edge.target === c.target && (edge.sourceHandle || null) === (c.sourceHandle || null) && (edge.targetHandle || null) === (c.targetHandle || null))) {
|
|
4550
|
+
const edge = {
|
|
4551
|
+
...c,
|
|
4552
|
+
id: `xy-edge__${c.source}${c.sourceHandle || ""}-${c.target}${c.targetHandle || ""}`,
|
|
4553
|
+
type: "smoothstep",
|
|
4554
|
+
animated: true
|
|
4555
|
+
};
|
|
4556
|
+
if (edge.sourceHandle === null) delete edge.sourceHandle;
|
|
4557
|
+
if (edge.targetHandle === null) delete edge.targetHandle;
|
|
4558
|
+
commit(edge);
|
|
4559
|
+
}
|
|
4043
4560
|
props.onConnect?.(describe(c));
|
|
4044
4561
|
};
|
|
4045
4562
|
return {
|
|
@@ -4050,6 +4567,87 @@ function useConnections(nodes, setEdges, defaultConnect, props) {
|
|
|
4050
4567
|
};
|
|
4051
4568
|
}
|
|
4052
4569
|
//#endregion
|
|
4570
|
+
//#region src/builders/FlowBuilder/graph-state.ts
|
|
4571
|
+
/** Parent graph content with a local overlay for canvas-only state. */
|
|
4572
|
+
function useBuilderGraph(initial, graph) {
|
|
4573
|
+
const local = useFlowState(initial.nodes, initial.edges);
|
|
4574
|
+
const [overlay, setOverlay] = useState({});
|
|
4575
|
+
const [edgeSelection, setEdgeSelection] = useState({});
|
|
4576
|
+
const nodes = useMemo(() => graph ? graph.nodes.map((node) => overlay[node.id] ? {
|
|
4577
|
+
...node,
|
|
4578
|
+
...overlay[node.id]
|
|
4579
|
+
} : node) : local.nodes, [
|
|
4580
|
+
graph,
|
|
4581
|
+
overlay,
|
|
4582
|
+
local.nodes
|
|
4583
|
+
]);
|
|
4584
|
+
const edges = useMemo(() => graph ? graph.edges.map((edge) => edge.id in edgeSelection ? {
|
|
4585
|
+
...edge,
|
|
4586
|
+
selected: edgeSelection[edge.id]
|
|
4587
|
+
} : edge) : local.edges, [
|
|
4588
|
+
graph,
|
|
4589
|
+
edgeSelection,
|
|
4590
|
+
local.edges
|
|
4591
|
+
]);
|
|
4592
|
+
const setNodes = (action) => {
|
|
4593
|
+
if (!graph) return local.setNodes(action);
|
|
4594
|
+
const next = typeof action === "function" ? action(nodes) : action;
|
|
4595
|
+
setOverlay(Object.fromEntries(next.map((node) => [node.id, {
|
|
4596
|
+
selected: node.selected,
|
|
4597
|
+
measured: node.measured,
|
|
4598
|
+
dragging: node.dragging,
|
|
4599
|
+
...node.dragging ? { position: node.position } : {}
|
|
4600
|
+
}])));
|
|
4601
|
+
};
|
|
4602
|
+
const setEdges = (action) => {
|
|
4603
|
+
if (!graph) return local.setEdges(action);
|
|
4604
|
+
const next = typeof action === "function" ? action(edges) : action;
|
|
4605
|
+
setEdgeSelection(Object.fromEntries(next.map((edge) => [edge.id, edge.selected ?? false])));
|
|
4606
|
+
};
|
|
4607
|
+
const onNodesChange = (changes) => {
|
|
4608
|
+
if (!graph) return local.onNodesChange(changes);
|
|
4609
|
+
setOverlay((previous) => {
|
|
4610
|
+
const next = { ...previous };
|
|
4611
|
+
for (const change of changes) {
|
|
4612
|
+
if (change.type === "select") next[change.id] = {
|
|
4613
|
+
...next[change.id],
|
|
4614
|
+
selected: change.selected
|
|
4615
|
+
};
|
|
4616
|
+
if (change.type === "dimensions" && change.dimensions) next[change.id] = {
|
|
4617
|
+
...next[change.id],
|
|
4618
|
+
measured: change.dimensions
|
|
4619
|
+
};
|
|
4620
|
+
if (change.type === "position") {
|
|
4621
|
+
const rest = { ...next[change.id] };
|
|
4622
|
+
delete rest.position;
|
|
4623
|
+
next[change.id] = {
|
|
4624
|
+
...rest,
|
|
4625
|
+
dragging: change.dragging,
|
|
4626
|
+
...change.dragging && change.position ? { position: change.position } : {}
|
|
4627
|
+
};
|
|
4628
|
+
}
|
|
4629
|
+
}
|
|
4630
|
+
return next;
|
|
4631
|
+
});
|
|
4632
|
+
};
|
|
4633
|
+
const onEdgesChange = (changes) => {
|
|
4634
|
+
if (!graph) return local.onEdgesChange(changes);
|
|
4635
|
+
setEdgeSelection((previous) => {
|
|
4636
|
+
const next = { ...previous };
|
|
4637
|
+
for (const change of changes) if (change.type === "select") next[change.id] = change.selected;
|
|
4638
|
+
return next;
|
|
4639
|
+
});
|
|
4640
|
+
};
|
|
4641
|
+
return {
|
|
4642
|
+
nodes,
|
|
4643
|
+
edges,
|
|
4644
|
+
setNodes,
|
|
4645
|
+
setEdges,
|
|
4646
|
+
onNodesChange,
|
|
4647
|
+
onEdgesChange
|
|
4648
|
+
};
|
|
4649
|
+
}
|
|
4650
|
+
//#endregion
|
|
4053
4651
|
//#region src/builders/FlowBuilder/problems.tsx
|
|
4054
4652
|
function FlowProblems({ issues, onSelect, titleAs: Title = "h3" }) {
|
|
4055
4653
|
if (!issues.length) return null;
|
|
@@ -4278,6 +4876,19 @@ function RunConsole({ entries, onClear, titleAs: TitleTag = "h3" }) {
|
|
|
4278
4876
|
}
|
|
4279
4877
|
//#endregion
|
|
4280
4878
|
//#region src/builders/FlowBuilder/FlowBuilder.tsx
|
|
4879
|
+
/** Persist graph content without canvas selection, drag or measurement state. */
|
|
4880
|
+
function cleanFlowGraph(graph) {
|
|
4881
|
+
return {
|
|
4882
|
+
...graph,
|
|
4883
|
+
nodes: graph.nodes.map((original) => {
|
|
4884
|
+
const node = { ...original };
|
|
4885
|
+
delete node.selected;
|
|
4886
|
+
delete node.dragging;
|
|
4887
|
+
delete node.measured;
|
|
4888
|
+
return node;
|
|
4889
|
+
})
|
|
4890
|
+
};
|
|
4891
|
+
}
|
|
4281
4892
|
const NO_ISSUES = [];
|
|
4282
4893
|
const WIDE_QUERY = "(min-width: 768px)";
|
|
4283
4894
|
function subscribeWide(onChange) {
|
|
@@ -4297,12 +4908,16 @@ function clock() {
|
|
|
4297
4908
|
* inspector for the selected node and a run console, in resizable panels. On small screens
|
|
4298
4909
|
* the panels stack.
|
|
4299
4910
|
*/
|
|
4300
|
-
function FlowBuilder({ title = "Untitled flow", nodes: initialNodes = builderNodes, edges: initialEdges = builderEdges, palette = builderPalette, consoleEntries, defaultConsoleEntries = builderConsole, onConsoleChange, onConsoleClear, titleAs: TitleTag = "h2", height = 600, onRun, nodeTypes, onConnectEdge, onConnect: onConnected, isValidConnection, onConnectionRejected, validationIssues, mode = "edit", nodeStatus, onNodeSelect, className }) {
|
|
4911
|
+
function FlowBuilder({ title = "Untitled flow", nodes: initialNodes = builderNodes, edges: initialEdges = builderEdges, graph, onGraphChange, palette = builderPalette, consoleEntries, defaultConsoleEntries = builderConsole, onConsoleChange, onConsoleClear, titleAs: TitleTag = "h2", height = 600, onRun, nodeTypes, onConnectEdge, onConnect: onConnected, isValidConnection, onConnectionRejected, validationIssues, mode = "edit", nodeStatus, onNodeSelect, className }) {
|
|
4301
4912
|
const runMode = mode === "run";
|
|
4302
4913
|
const root = useRef(null);
|
|
4914
|
+
const flow = useRef(null);
|
|
4303
4915
|
const wide = useIsWide();
|
|
4304
4916
|
const panelAs = TitleTag === "h2" ? "h3" : TitleTag === "h3" ? "h4" : "h5";
|
|
4305
|
-
const { nodes, edges, setNodes, setEdges, onNodesChange, onEdgesChange
|
|
4917
|
+
const { nodes, edges, setNodes, setEdges, onNodesChange, onEdgesChange } = useBuilderGraph({
|
|
4918
|
+
nodes: initialNodes,
|
|
4919
|
+
edges: initialEdges
|
|
4920
|
+
}, graph);
|
|
4306
4921
|
const [innerLog, setInnerLog] = useState(defaultConsoleEntries);
|
|
4307
4922
|
const log = consoleEntries ?? innerLog;
|
|
4308
4923
|
const latestLog = useRef(log);
|
|
@@ -4315,7 +4930,9 @@ function FlowBuilder({ title = "Untitled flow", nodes: initialNodes = builderNod
|
|
|
4315
4930
|
const selected = nodes.find((n) => n.selected);
|
|
4316
4931
|
const addNode = (item) => {
|
|
4317
4932
|
seq.current += 1;
|
|
4318
|
-
|
|
4933
|
+
let suffix = 1;
|
|
4934
|
+
while (nodes.some((node) => node.id === `${item.kind}-${suffix}`)) suffix += 1;
|
|
4935
|
+
const id = `${item.kind}-${suffix}`;
|
|
4319
4936
|
const right = nodes.reduce((max, n) => Math.max(max, n.position.x), -256);
|
|
4320
4937
|
const slim = item.kind === "trigger" || item.kind === "router";
|
|
4321
4938
|
const node = {
|
|
@@ -4333,21 +4950,40 @@ function FlowBuilder({ title = "Untitled flow", nodes: initialNodes = builderNod
|
|
|
4333
4950
|
subtitle: item.description
|
|
4334
4951
|
}
|
|
4335
4952
|
};
|
|
4336
|
-
|
|
4953
|
+
const next = [...nodes.map((n) => n.selected ? {
|
|
4337
4954
|
...n,
|
|
4338
4955
|
selected: false
|
|
4339
|
-
} : n), node]
|
|
4956
|
+
} : n), node];
|
|
4957
|
+
setNodes(next);
|
|
4958
|
+
onGraphChange?.(cleanFlowGraph({
|
|
4959
|
+
nodes: next,
|
|
4960
|
+
edges
|
|
4961
|
+
}), {
|
|
4962
|
+
type: "add",
|
|
4963
|
+
nodeIds: [id],
|
|
4964
|
+
edgeIds: []
|
|
4965
|
+
});
|
|
4966
|
+
};
|
|
4967
|
+
const updateNode = (id, patch) => {
|
|
4968
|
+
const next = nodes.map((n) => n.id === id ? {
|
|
4969
|
+
...n,
|
|
4970
|
+
data: {
|
|
4971
|
+
...n.data,
|
|
4972
|
+
...patch
|
|
4973
|
+
}
|
|
4974
|
+
} : n);
|
|
4975
|
+
setNodes(next);
|
|
4976
|
+
onGraphChange?.(cleanFlowGraph({
|
|
4977
|
+
nodes: next,
|
|
4978
|
+
edges
|
|
4979
|
+
}), {
|
|
4980
|
+
type: "update",
|
|
4981
|
+
nodeIds: [id],
|
|
4982
|
+
edgeIds: []
|
|
4983
|
+
});
|
|
4340
4984
|
};
|
|
4341
|
-
const updateNode = (id, patch) => setNodes((ns) => ns.map((n) => n.id === id ? {
|
|
4342
|
-
...n,
|
|
4343
|
-
data: {
|
|
4344
|
-
...n.data,
|
|
4345
|
-
...patch
|
|
4346
|
-
}
|
|
4347
|
-
} : n));
|
|
4348
4985
|
const deleteNode = (id) => {
|
|
4349
|
-
|
|
4350
|
-
setEdges((es) => es.filter((e) => e.source !== id && e.target !== id));
|
|
4986
|
+
flow.current?.deleteElements({ nodes: [{ id }] });
|
|
4351
4987
|
};
|
|
4352
4988
|
const commitLog = (next) => {
|
|
4353
4989
|
latestLog.current = next;
|
|
@@ -4408,7 +5044,18 @@ function FlowBuilder({ title = "Untitled flow", nodes: initialNodes = builderNod
|
|
|
4408
5044
|
onConsoleClear?.();
|
|
4409
5045
|
commitLog([]);
|
|
4410
5046
|
};
|
|
4411
|
-
const connections = useConnections(nodes,
|
|
5047
|
+
const connections = useConnections(nodes, edges, (edge) => {
|
|
5048
|
+
const next = [...edges, edge];
|
|
5049
|
+
setEdges(next);
|
|
5050
|
+
onGraphChange?.(cleanFlowGraph({
|
|
5051
|
+
nodes,
|
|
5052
|
+
edges: next
|
|
5053
|
+
}), {
|
|
5054
|
+
type: "connect",
|
|
5055
|
+
nodeIds: [],
|
|
5056
|
+
edgeIds: [edge.id]
|
|
5057
|
+
});
|
|
5058
|
+
}, {
|
|
4412
5059
|
onConnect: onConnected,
|
|
4413
5060
|
onConnectEdge,
|
|
4414
5061
|
isValidConnection,
|
|
@@ -4429,7 +5076,46 @@ function FlowBuilder({ title = "Untitled flow", nodes: initialNodes = builderNod
|
|
|
4429
5076
|
height: h,
|
|
4430
5077
|
nodes: displayedNodes,
|
|
4431
5078
|
edges,
|
|
4432
|
-
|
|
5079
|
+
onInit: (instance) => {
|
|
5080
|
+
flow.current = instance;
|
|
5081
|
+
},
|
|
5082
|
+
onDelete: ({ nodes: deletedNodes, edges: deletedEdges }) => {
|
|
5083
|
+
if (runMode) return;
|
|
5084
|
+
const nodeIds = deletedNodes.map((node) => node.id);
|
|
5085
|
+
const edgeIds = deletedEdges.map((edge) => edge.id);
|
|
5086
|
+
const next = {
|
|
5087
|
+
nodes: nodes.filter((node) => !nodeIds.includes(node.id)),
|
|
5088
|
+
edges: edges.filter((edge) => !edgeIds.includes(edge.id))
|
|
5089
|
+
};
|
|
5090
|
+
setNodes(next.nodes);
|
|
5091
|
+
setEdges(next.edges);
|
|
5092
|
+
onGraphChange?.(cleanFlowGraph(next), {
|
|
5093
|
+
type: "delete",
|
|
5094
|
+
nodeIds,
|
|
5095
|
+
edgeIds
|
|
5096
|
+
});
|
|
5097
|
+
},
|
|
5098
|
+
onNodesChange: (changes) => {
|
|
5099
|
+
onNodesChange(runMode ? changes.filter((change) => change.type === "select" || change.type === "dimensions") : changes);
|
|
5100
|
+
if (runMode) return;
|
|
5101
|
+
const moves = changes.filter((change) => change.type === "position").filter((change) => change.dragging === false);
|
|
5102
|
+
if (!moves.length) return;
|
|
5103
|
+
const next = nodes.map((node) => {
|
|
5104
|
+
const move = moves.find((change) => change.id === node.id);
|
|
5105
|
+
return move?.type === "position" && move.position ? {
|
|
5106
|
+
...node,
|
|
5107
|
+
position: move.position
|
|
5108
|
+
} : node;
|
|
5109
|
+
});
|
|
5110
|
+
onGraphChange?.(cleanFlowGraph({
|
|
5111
|
+
nodes: next,
|
|
5112
|
+
edges
|
|
5113
|
+
}), {
|
|
5114
|
+
type: "move",
|
|
5115
|
+
nodeIds: moves.map((move) => move.id),
|
|
5116
|
+
edgeIds: []
|
|
5117
|
+
});
|
|
5118
|
+
},
|
|
4433
5119
|
onEdgesChange: (changes) => onEdgesChange(runMode ? changes.filter((change) => change.type === "select") : changes),
|
|
4434
5120
|
nodeRenderers: nodeTypes,
|
|
4435
5121
|
showInteractiveControls: !runMode,
|
|
@@ -4578,7 +5264,7 @@ const meta$28 = {
|
|
|
4578
5264
|
name: "Flow builder",
|
|
4579
5265
|
family: "builders",
|
|
4580
5266
|
status: "beta",
|
|
4581
|
-
description: "Visual flow editor with optional nodeTypes for named handles (branch-arm, parallel and sequence examples), onConnectEdge for edge type/data mapping, isValidConnection and onConnectionRejected for rules, onConnect for accepted connections, validationIssues for node/flow problems, mode=\"run\" for a read-only canvas, nodeStatus for live badges, and onNodeSelect for pointer/keyboard selection. Optional nodeTypes registers kit-owned {type, handles:[{id,kind,position?,label?}], render, decorations?} definitions (no React Flow NodeProps). Keep nodeTypes and its renderer definitions stable (module scope or useMemo) across nodeStatus updates: recreating the array rebuilds custom node components and remounts them, defeating per-node memoization. onConnectEdge({source,target,sourceType,targetType,sourceHandle,targetHandle}) returns {type,data}; examples/extensions.tsx maps branch arm-0 to {kind: \"branch-arm\", armIndex: 0}, parallel branch to {kind: \"parallel\"}, and sequence next to {kind: \"sequence\"}. isValidConnection returns true, false, or {code,nodeId?,message}; onConnectionRejected reports {code,nodeId,message} once (nodeId defaults to the source) so consumers can forward it into validationIssues and control its lifetime, while onConnect reports accepted connections only. validationIssues decorates nodes with an icon and accessible text; node issues select and focus their node, and flow issues have no node link. mode=\"run\" removes the Run action, palette, inspector and graph mutation while keeping labelled keyboard-selectable nodes, pan/zoom, fit controls and the wide-screen minimap. nodeStatus maps node IDs to FlowTone badges (running, degraded, failed, paused, done, handoff, review); onNodeSelect(id) handles pointer and keyboard selection. RunFlowExample shows live updates with per-node memoization. FlowNode defaults to the built-in FlowNodeKind union; use FlowNode<string> (or a custom kind union) for custom graphs, inferred by FlowBuilder and WorkflowBuilderPage. Custom renderers use kit status overlays and issue decorations by default; set decorations:\"consumer\" when render owns them, using data.decoration with accessible text and icons (for example, render:({data}) => <NodeCard title={data.title} tone={data.decoration?.status} />). FlowCanvas showInteractiveControls=false retains zoom/fit without the editing toggle. Named handles are keyboard controls: Enter or Space starts or completes a connection in edit mode; handles are disabled in run mode.",
|
|
5267
|
+
description: "FlowGraph<Kind> is {nodes,edges}; FlowGraphChange names the edit type and affected nodeIds/edgeIds. Optional onGraphChange(graph, change) reports each committed add, delete, move, connect or inspector update once, omitting selected, dragging and measured from nodes. Inspector updates report every value change: hosts persisting every call should debounce. Selection, measurement, panel resizing, rejected connections and run mode report nothing. Optional graph controls content: render the parent graph without applying edits locally, while selection, measured sizes and active drag positions stay internal by stable node id. nodes/edges remain initial values when uncontrolled. onRun keeps the canvas node objects. builderNodes and builderEdges expose the shared starter graph; cleanFlowGraph(graph) returns a graph without transient node fields for persistence. examples/ControlledGraph.tsx shows graph={graph} onGraphChange={setGraph}. Palette ids skip existing kind-n ids. Visual flow editor with optional nodeTypes for named handles (branch-arm, parallel and sequence examples), onConnectEdge for edge type/data mapping, isValidConnection and onConnectionRejected for rules, onConnect for accepted connections, validationIssues for node/flow problems, mode=\"run\" for a read-only canvas, nodeStatus for live badges, and onNodeSelect for pointer/keyboard selection. Optional nodeTypes registers kit-owned {type, handles:[{id,kind,position?,label?}], render, decorations?} definitions (no React Flow NodeProps). Keep nodeTypes and its renderer definitions stable (module scope or useMemo) across nodeStatus updates: recreating the array rebuilds custom node components and remounts them, defeating per-node memoization. onConnectEdge({source,target,sourceType,targetType,sourceHandle,targetHandle}) returns {type,data}; examples/extensions.tsx maps branch arm-0 to {kind: \"branch-arm\", armIndex: 0}, parallel branch to {kind: \"parallel\"}, and sequence next to {kind: \"sequence\"}. isValidConnection returns true, false, or {code,nodeId?,message}; onConnectionRejected reports {code,nodeId,message} once (nodeId defaults to the source) so consumers can forward it into validationIssues and control its lifetime, while onConnect reports accepted connections only. validationIssues decorates nodes with an icon and accessible text; node issues select and focus their node, and flow issues have no node link. mode=\"run\" removes the Run action, palette, inspector and graph mutation while keeping labelled keyboard-selectable nodes, pan/zoom, fit controls and the wide-screen minimap. nodeStatus maps node IDs to FlowTone badges (running, degraded, failed, paused, done, handoff, review); onNodeSelect(id) handles pointer and keyboard selection. RunFlowExample shows live updates with per-node memoization. FlowNode defaults to the built-in FlowNodeKind union; use FlowNode<string> (or a custom kind union) for custom graphs, inferred by FlowBuilder and WorkflowBuilderPage. Custom renderers use kit status overlays and issue decorations by default; set decorations:\"consumer\" when render owns them, using data.decoration with accessible text and icons (for example, render:({data}) => <NodeCard title={data.title} tone={data.decoration?.status} />). FlowCanvas showInteractiveControls=false retains zoom/fit without the editing toggle. Named handles are keyboard controls: Enter or Space starts or completes a connection in edit mode; handles are disabled in run mode.",
|
|
4582
5268
|
uses: [
|
|
4583
5269
|
"FlowCanvas",
|
|
4584
5270
|
"useFlowState",
|
|
@@ -5028,6 +5714,38 @@ const meta$7 = {
|
|
|
5028
5714
|
]
|
|
5029
5715
|
};
|
|
5030
5716
|
//#endregion
|
|
5717
|
+
//#region src/builders/LogViewer/use-wrapped-log-rows.ts
|
|
5718
|
+
/** Measurements belong to line IDs, independent of the current filtered indices. */
|
|
5719
|
+
function useWrappedLogRows(enabled, lines, rowHeight, height, overscan, scrollTop, follow) {
|
|
5720
|
+
const [sizes, setSizes] = useState(/* @__PURE__ */ new Map());
|
|
5721
|
+
const count = enabled ? lines.length : 0;
|
|
5722
|
+
const sizeOf = useCallback((index) => sizes.get(lines[index]?.id ?? "") ?? rowHeight, [
|
|
5723
|
+
lines,
|
|
5724
|
+
sizes,
|
|
5725
|
+
rowHeight
|
|
5726
|
+
]);
|
|
5727
|
+
const total = useMemo(() => computeOffsets(count, sizeOf), [count, sizeOf])[count] ?? 0;
|
|
5728
|
+
const maxScroll = Math.max(0, total - height);
|
|
5729
|
+
const win = useVirtualWindow(count, sizeOf, follow ? maxScroll : Math.min(scrollTop, maxScroll), height, overscan);
|
|
5730
|
+
const measureRow = useCallback((node, id) => {
|
|
5731
|
+
if (!node) return;
|
|
5732
|
+
const measure = () => {
|
|
5733
|
+
const measured = node.getBoundingClientRect().height;
|
|
5734
|
+
if (measured > 0) setSizes((previous) => previous.get(id) === measured ? previous : new Map(previous).set(id, measured));
|
|
5735
|
+
};
|
|
5736
|
+
measure();
|
|
5737
|
+
if (typeof ResizeObserver === "undefined") return;
|
|
5738
|
+
const observer = new ResizeObserver(measure);
|
|
5739
|
+
observer.observe(node);
|
|
5740
|
+
return () => observer.disconnect();
|
|
5741
|
+
}, []);
|
|
5742
|
+
return {
|
|
5743
|
+
...win,
|
|
5744
|
+
end: win.end + 1,
|
|
5745
|
+
measureRow
|
|
5746
|
+
};
|
|
5747
|
+
}
|
|
5748
|
+
//#endregion
|
|
5031
5749
|
//#region src/builders/LogViewer/fixtures.ts
|
|
5032
5750
|
const MESSAGES = [
|
|
5033
5751
|
[
|
|
@@ -5081,7 +5799,7 @@ const MESSAGES = [
|
|
|
5081
5799
|
"job 91ab completed in 3.4s"
|
|
5082
5800
|
]
|
|
5083
5801
|
];
|
|
5084
|
-
function pad$
|
|
5802
|
+
function pad$1(n, width = 2) {
|
|
5085
5803
|
return String(n).padStart(width, "0");
|
|
5086
5804
|
}
|
|
5087
5805
|
/** Deterministic sample stream of `count` lines (neutral service logs). */
|
|
@@ -5095,7 +5813,7 @@ function makeLogLines(count = 480, startSecond = 43200) {
|
|
|
5095
5813
|
const ms = Math.floor(t % 1 * 1e3);
|
|
5096
5814
|
return {
|
|
5097
5815
|
id: `log-${i}`,
|
|
5098
|
-
timestamp: `${pad$
|
|
5816
|
+
timestamp: `${pad$1(h)}:${pad$1(m)}:${pad$1(s)}.${pad$1(ms, 3)}`,
|
|
5099
5817
|
level: entry[0],
|
|
5100
5818
|
source: entry[1],
|
|
5101
5819
|
message: entry[2]
|
|
@@ -5152,8 +5870,9 @@ function lineText(line) {
|
|
|
5152
5870
|
* so it stays fast with thousands of lines. Level filter, search with highlighted matches,
|
|
5153
5871
|
* follow-tail and per-line copy.
|
|
5154
5872
|
*/
|
|
5155
|
-
function LogViewer({ lines = logLines, title
|
|
5156
|
-
const { locale } = useI18n();
|
|
5873
|
+
function LogViewer({ lines = logLines, title: titleProp, labels, height = 360, rowHeight = 24, wrap = false, overscan = 8, defaultLevels = LOG_LEVELS, defaultFollow = true, onCopyLine, onSelectLine, selectedLineId, announceLines = true, titleAs: TitleTag = "h3", className }) {
|
|
5874
|
+
const { locale, t } = useI18n();
|
|
5875
|
+
const title = titleProp ?? labels?.title ?? t("logViewer.title");
|
|
5157
5876
|
const titleId = useId();
|
|
5158
5877
|
const viewport = useRef(null);
|
|
5159
5878
|
const copyTimer = useRef(void 0);
|
|
@@ -5186,11 +5905,12 @@ function LogViewer({ lines = logLines, title = "Logs", height = 360, rowHeight =
|
|
|
5186
5905
|
query,
|
|
5187
5906
|
locale
|
|
5188
5907
|
]);
|
|
5189
|
-
const
|
|
5908
|
+
const wrapped = useWrappedLogRows(wrap, visible, rowHeight, height, overscan, scrollTop, follow);
|
|
5909
|
+
const total = wrap ? wrapped.total : visible.length * rowHeight;
|
|
5190
5910
|
const maxScroll = Math.max(0, total - height);
|
|
5191
5911
|
const offset = follow ? maxScroll : Math.min(scrollTop, maxScroll);
|
|
5192
|
-
const start = Math.max(0, Math.floor(offset / rowHeight) - overscan);
|
|
5193
|
-
const end = Math.min(visible.length, Math.ceil((offset + height) / rowHeight) + overscan);
|
|
5912
|
+
const start = wrap ? wrapped.start : Math.max(0, Math.floor(offset / rowHeight) - overscan);
|
|
5913
|
+
const end = wrap ? wrapped.end : Math.min(visible.length, Math.ceil((offset + height) / rowHeight) + overscan);
|
|
5194
5914
|
const rows = visible.slice(start, end);
|
|
5195
5915
|
useEffect(() => {
|
|
5196
5916
|
if (follow && viewport.current) viewport.current.scrollTop = maxScroll;
|
|
@@ -5219,26 +5939,25 @@ function LogViewer({ lines = logLines, title = "Logs", height = 360, rowHeight =
|
|
|
5219
5939
|
id: titleId,
|
|
5220
5940
|
className: "text-[13px] font-semibold text-foreground",
|
|
5221
5941
|
children: title
|
|
5222
|
-
}), /* @__PURE__ */
|
|
5942
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
5223
5943
|
className: "font-mono text-[11px] text-muted-foreground",
|
|
5224
|
-
children:
|
|
5225
|
-
visible.length,
|
|
5226
|
-
|
|
5227
|
-
|
|
5228
|
-
]
|
|
5944
|
+
children: labels?.count?.(visible.length, lines.length) ?? t("logViewer.count", {
|
|
5945
|
+
visible: visible.length,
|
|
5946
|
+
total: lines.length
|
|
5947
|
+
})
|
|
5229
5948
|
})]
|
|
5230
5949
|
}), /* @__PURE__ */ jsxs("div", {
|
|
5231
5950
|
className: "flex flex-wrap items-center gap-2 lg:ms-auto",
|
|
5232
5951
|
children: [
|
|
5233
5952
|
/* @__PURE__ */ jsx(ToggleGroup, {
|
|
5234
|
-
"aria-label":
|
|
5953
|
+
"aria-label": labels?.levelFilter ?? t("logViewer.levelFilter"),
|
|
5235
5954
|
size: "sm",
|
|
5236
5955
|
multiple: true,
|
|
5237
5956
|
value: levels,
|
|
5238
5957
|
onValueChange: (v) => setLevels(v),
|
|
5239
5958
|
children: LOG_LEVELS.map((lv) => /* @__PURE__ */ jsxs(Toggle, {
|
|
5240
5959
|
value: lv,
|
|
5241
|
-
children: [lv, /* @__PURE__ */ jsx("span", {
|
|
5960
|
+
children: [labels?.levels?.[lv] ?? t(`logViewer.levelFilterOption.${lv}`), /* @__PURE__ */ jsx("span", {
|
|
5242
5961
|
className: "font-mono text-[10.5px] opacity-70",
|
|
5243
5962
|
children: counts[lv]
|
|
5244
5963
|
})]
|
|
@@ -5247,8 +5966,8 @@ function LogViewer({ lines = logLines, title = "Logs", height = 360, rowHeight =
|
|
|
5247
5966
|
/* @__PURE__ */ jsx(Input, {
|
|
5248
5967
|
size: "sm",
|
|
5249
5968
|
type: "search",
|
|
5250
|
-
"aria-label":
|
|
5251
|
-
placeholder: "
|
|
5969
|
+
"aria-label": labels?.searchLabel ?? t("logViewer.searchLabel"),
|
|
5970
|
+
placeholder: labels?.searchPlaceholder ?? t("logViewer.searchPlaceholder"),
|
|
5252
5971
|
leadingIcon: Search,
|
|
5253
5972
|
value: query,
|
|
5254
5973
|
onValueChange: (v) => setQuery(String(v)),
|
|
@@ -5256,7 +5975,7 @@ function LogViewer({ lines = logLines, title = "Logs", height = 360, rowHeight =
|
|
|
5256
5975
|
}),
|
|
5257
5976
|
/* @__PURE__ */ jsx(Switch, {
|
|
5258
5977
|
size: "sm",
|
|
5259
|
-
label: "
|
|
5978
|
+
label: labels?.follow ?? t("logViewer.follow"),
|
|
5260
5979
|
checked: follow,
|
|
5261
5980
|
onCheckedChange: setFollow
|
|
5262
5981
|
})
|
|
@@ -5273,7 +5992,7 @@ function LogViewer({ lines = logLines, title = "Logs", height = 360, rowHeight =
|
|
|
5273
5992
|
style: { height },
|
|
5274
5993
|
children: visible.length === 0 ? /* @__PURE__ */ jsx("p", {
|
|
5275
5994
|
className: "px-4 py-6 text-center font-sans text-[13px] text-muted-foreground",
|
|
5276
|
-
children:
|
|
5995
|
+
children: labels?.empty ?? t("logViewer.empty")
|
|
5277
5996
|
}) : /* @__PURE__ */ jsx("div", {
|
|
5278
5997
|
className: "relative w-full",
|
|
5279
5998
|
style: { height: total },
|
|
@@ -5281,9 +6000,13 @@ function LogViewer({ lines = logLines, title = "Logs", height = 360, rowHeight =
|
|
|
5281
6000
|
const lv = LEVEL_STYLE[line.level];
|
|
5282
6001
|
return /* @__PURE__ */ jsxs("div", {
|
|
5283
6002
|
"data-slot": "log-line",
|
|
6003
|
+
ref: wrap ? (node) => wrapped.measureRow(node, line.id) : void 0,
|
|
5284
6004
|
onClick: onSelectLine ? () => onSelectLine(line) : void 0,
|
|
5285
|
-
className: "group absolute inset-x-0 flex items-center gap-2.5 px-3 hover:bg-secondary/50",
|
|
5286
|
-
style: {
|
|
6005
|
+
className: wrap ? "group absolute inset-x-0 flex items-start gap-2.5 px-3 hover:bg-secondary/50" : "group absolute inset-x-0 flex items-center gap-2.5 px-3 hover:bg-secondary/50",
|
|
6006
|
+
style: wrap ? {
|
|
6007
|
+
top: wrapped.offsets[start + i],
|
|
6008
|
+
minHeight: rowHeight
|
|
6009
|
+
} : {
|
|
5287
6010
|
top: (start + i) * rowHeight,
|
|
5288
6011
|
height: rowHeight
|
|
5289
6012
|
},
|
|
@@ -5294,7 +6017,7 @@ function LogViewer({ lines = logLines, title = "Logs", height = 360, rowHeight =
|
|
|
5294
6017
|
}),
|
|
5295
6018
|
/* @__PURE__ */ jsx("span", {
|
|
5296
6019
|
className: cn("inline-flex h-4 w-12 shrink-0 items-center justify-center rounded text-[10px] font-semibold", lv.className),
|
|
5297
|
-
children:
|
|
6020
|
+
children: labels?.levels?.[line.level] ?? t(`logViewer.level.${line.level}`)
|
|
5298
6021
|
}),
|
|
5299
6022
|
line.source && /* @__PURE__ */ jsxs("span", {
|
|
5300
6023
|
className: "hidden shrink-0 text-muted-foreground sm:inline",
|
|
@@ -5305,13 +6028,13 @@ function LogViewer({ lines = logLines, title = "Logs", height = 360, rowHeight =
|
|
|
5305
6028
|
]
|
|
5306
6029
|
}),
|
|
5307
6030
|
/* @__PURE__ */ jsx("span", {
|
|
5308
|
-
className: "min-w-0 flex-1 truncate text-foreground",
|
|
6031
|
+
className: wrap ? "min-w-0 flex-1 whitespace-pre-wrap break-words text-foreground" : "min-w-0 flex-1 truncate text-foreground",
|
|
5309
6032
|
children: highlight(line.message, query, locale)
|
|
5310
6033
|
}),
|
|
5311
6034
|
onSelectLine && /* @__PURE__ */ jsx(IconButton, {
|
|
5312
6035
|
size: "sm",
|
|
5313
6036
|
icon: Eye,
|
|
5314
|
-
label:
|
|
6037
|
+
label: labels?.inspect?.(line.timestamp) ?? t("logViewer.inspect", { timestamp: line.timestamp }),
|
|
5315
6038
|
"aria-pressed": line.id === selectedLineId,
|
|
5316
6039
|
onClick: (event) => {
|
|
5317
6040
|
event.stopPropagation();
|
|
@@ -5322,7 +6045,7 @@ function LogViewer({ lines = logLines, title = "Logs", height = 360, rowHeight =
|
|
|
5322
6045
|
/* @__PURE__ */ jsx(IconButton, {
|
|
5323
6046
|
size: "sm",
|
|
5324
6047
|
icon: copied === line.id ? Check : Copy,
|
|
5325
|
-
label: copied === line.id ? "
|
|
6048
|
+
label: copied === line.id ? labels?.copied ?? t("common.copied") : labels?.copy?.(line.timestamp) ?? t("logViewer.copy", { timestamp: line.timestamp }),
|
|
5326
6049
|
onClick: (event) => {
|
|
5327
6050
|
if (onSelectLine) event.stopPropagation();
|
|
5328
6051
|
copy(line);
|
|
@@ -5342,7 +6065,64 @@ const meta$39 = {
|
|
|
5342
6065
|
name: "Log viewer",
|
|
5343
6066
|
family: "builders",
|
|
5344
6067
|
status: "beta",
|
|
5345
|
-
description: "Windowed log stream (role=\"log\"): level filter, search with highlighted matches, follow-tail and per-line copy. Renders only the visible rows.",
|
|
6068
|
+
description: "Windowed log stream (role=\"log\"): level filter, search with highlighted matches, follow-tail and per-line copy. Renders only the visible rows. Optional wrap (default false) shows full messages in measured, variable-height rows; rowHeight estimates unmeasured rows. Optional labels?: Partial<LogViewerLabels> overrides each built-in label, including per-level chip and filter names through labels.levels. Explicit content props win over labels, then I18nProvider (en/es); no provider keeps English. Copied log text and imported fixtures stay unchanged. See the Catalog labels and Full messages and level names live previews.",
|
|
6069
|
+
labels: [
|
|
6070
|
+
{
|
|
6071
|
+
key: "title",
|
|
6072
|
+
type: "string",
|
|
6073
|
+
state: "Visible heading and log region name; title prop wins"
|
|
6074
|
+
},
|
|
6075
|
+
{
|
|
6076
|
+
key: "levelFilter",
|
|
6077
|
+
type: "string",
|
|
6078
|
+
state: "Level filter group name"
|
|
6079
|
+
},
|
|
6080
|
+
{
|
|
6081
|
+
key: "levels",
|
|
6082
|
+
type: "Partial<Record<LogLevel, string>>",
|
|
6083
|
+
state: "Per-level chip and filter names; omitted levels use the catalog"
|
|
6084
|
+
},
|
|
6085
|
+
{
|
|
6086
|
+
key: "searchLabel",
|
|
6087
|
+
type: "string",
|
|
6088
|
+
state: "Searchbox name"
|
|
6089
|
+
},
|
|
6090
|
+
{
|
|
6091
|
+
key: "searchPlaceholder",
|
|
6092
|
+
type: "string",
|
|
6093
|
+
state: "Searchbox placeholder"
|
|
6094
|
+
},
|
|
6095
|
+
{
|
|
6096
|
+
key: "follow",
|
|
6097
|
+
type: "string",
|
|
6098
|
+
state: "Follow switch name"
|
|
6099
|
+
},
|
|
6100
|
+
{
|
|
6101
|
+
key: "count",
|
|
6102
|
+
type: "(visible: number, total: number) => string",
|
|
6103
|
+
state: "Filtered line count"
|
|
6104
|
+
},
|
|
6105
|
+
{
|
|
6106
|
+
key: "empty",
|
|
6107
|
+
type: "string",
|
|
6108
|
+
state: "No matching lines"
|
|
6109
|
+
},
|
|
6110
|
+
{
|
|
6111
|
+
key: "inspect",
|
|
6112
|
+
type: "(timestamp: string) => string",
|
|
6113
|
+
state: "Inspect button name when onSelectLine exists"
|
|
6114
|
+
},
|
|
6115
|
+
{
|
|
6116
|
+
key: "copy",
|
|
6117
|
+
type: "(timestamp: string) => string",
|
|
6118
|
+
state: "Copy button before copying"
|
|
6119
|
+
},
|
|
6120
|
+
{
|
|
6121
|
+
key: "copied",
|
|
6122
|
+
type: "string",
|
|
6123
|
+
state: "Copy button after copying"
|
|
6124
|
+
}
|
|
6125
|
+
],
|
|
5346
6126
|
uses: [
|
|
5347
6127
|
"ToggleGroup",
|
|
5348
6128
|
"Toggle",
|
|
@@ -5938,78 +6718,82 @@ function ChartCard({ title = "Infrastructure cost", description = "Spend by reso
|
|
|
5938
6718
|
"aria-label": chartLabel,
|
|
5939
6719
|
...states
|
|
5940
6720
|
};
|
|
5941
|
-
|
|
5942
|
-
|
|
5943
|
-
|
|
5944
|
-
|
|
5945
|
-
|
|
5946
|
-
|
|
5947
|
-
|
|
5948
|
-
|
|
5949
|
-
|
|
5950
|
-
|
|
5951
|
-
|
|
5952
|
-
|
|
5953
|
-
|
|
5954
|
-
|
|
5955
|
-
|
|
5956
|
-
|
|
5957
|
-
|
|
5958
|
-
|
|
5959
|
-
|
|
5960
|
-
|
|
5961
|
-
event
|
|
5962
|
-
|
|
5963
|
-
|
|
5964
|
-
|
|
5965
|
-
|
|
5966
|
-
|
|
5967
|
-
|
|
5968
|
-
|
|
5969
|
-
|
|
5970
|
-
|
|
5971
|
-
|
|
5972
|
-
children: r
|
|
5973
|
-
|
|
5974
|
-
|
|
6721
|
+
const { locale } = useI18n();
|
|
6722
|
+
return /* @__PURE__ */ jsx(ChartLocaleProvider, {
|
|
6723
|
+
locale,
|
|
6724
|
+
children: /* @__PURE__ */ jsxs(Card, {
|
|
6725
|
+
className,
|
|
6726
|
+
children: [
|
|
6727
|
+
/* @__PURE__ */ jsxs(CardHeader, {
|
|
6728
|
+
className: "pb-2",
|
|
6729
|
+
children: [
|
|
6730
|
+
/* @__PURE__ */ jsx(CardTitle, {
|
|
6731
|
+
as: titleAs,
|
|
6732
|
+
children: title
|
|
6733
|
+
}),
|
|
6734
|
+
description && /* @__PURE__ */ jsx(CardDescription, { children: description }),
|
|
6735
|
+
/* @__PURE__ */ jsxs(CardAction, {
|
|
6736
|
+
className: "flex items-center gap-2",
|
|
6737
|
+
children: [showRangeToggle && ranges.length > 1 && /* @__PURE__ */ jsx(ToggleGroup, {
|
|
6738
|
+
"aria-label": `${title} range`,
|
|
6739
|
+
size: "sm",
|
|
6740
|
+
value: active ? [active.value] : [],
|
|
6741
|
+
onFocus: (event) => {
|
|
6742
|
+
if (!tabEntry.current) return;
|
|
6743
|
+
if (event.relatedTarget instanceof Node && event.currentTarget.contains(event.relatedTarget)) return;
|
|
6744
|
+
event.currentTarget.querySelector("[aria-pressed=\"true\"]")?.focus();
|
|
6745
|
+
},
|
|
6746
|
+
onValueChange: (v) => {
|
|
6747
|
+
const next = v[0];
|
|
6748
|
+
if (!next) return;
|
|
6749
|
+
if (rangeProp === void 0) setInner(next);
|
|
6750
|
+
onRangeChange?.(next);
|
|
6751
|
+
},
|
|
6752
|
+
children: ranges.map((r) => /* @__PURE__ */ jsx(Toggle, {
|
|
6753
|
+
value: r.value,
|
|
6754
|
+
className: "font-mono",
|
|
6755
|
+
children: r.label
|
|
6756
|
+
}, r.value))
|
|
6757
|
+
}), action]
|
|
6758
|
+
})
|
|
6759
|
+
]
|
|
6760
|
+
}),
|
|
6761
|
+
active?.summary && /* @__PURE__ */ jsxs("p", {
|
|
6762
|
+
className: "flex flex-wrap items-baseline gap-x-2 px-5",
|
|
6763
|
+
"aria-live": "polite",
|
|
6764
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
6765
|
+
className: "text-[24px] font-semibold tracking-tight text-foreground tabular-nums",
|
|
6766
|
+
children: active.summary.value
|
|
6767
|
+
}), active.summary.delta && /* @__PURE__ */ jsx(TrendDelta, { ...active.summary.delta })]
|
|
6768
|
+
}),
|
|
6769
|
+
/* @__PURE__ */ jsx("div", {
|
|
6770
|
+
className: cn("px-3 pb-4 pt-3 sm:px-4", !footer && "pb-5"),
|
|
6771
|
+
children: kind === "heatmap" ? /* @__PURE__ */ jsx(Heatmap, {
|
|
6772
|
+
data,
|
|
6773
|
+
index,
|
|
6774
|
+
categories,
|
|
6775
|
+
color: colors[0] ?? "primary",
|
|
6776
|
+
valueFormatter,
|
|
6777
|
+
showScale: showLegend,
|
|
6778
|
+
height,
|
|
6779
|
+
"aria-label": chartLabel,
|
|
6780
|
+
...heatmap,
|
|
6781
|
+
...states,
|
|
6782
|
+
dataTable: dataTable ?? true
|
|
6783
|
+
}) : kind === "bar" ? /* @__PURE__ */ jsx(BarChart, {
|
|
6784
|
+
...common,
|
|
6785
|
+
stacked
|
|
6786
|
+
}) : kind === "line" ? /* @__PURE__ */ jsx(LineChart, { ...common }) : /* @__PURE__ */ jsx(AreaChart, {
|
|
6787
|
+
...common,
|
|
6788
|
+
stacked
|
|
5975
6789
|
})
|
|
5976
|
-
|
|
5977
|
-
|
|
5978
|
-
|
|
5979
|
-
|
|
5980
|
-
"aria-live": "polite",
|
|
5981
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
5982
|
-
className: "text-[24px] font-semibold tracking-tight text-foreground tabular-nums",
|
|
5983
|
-
children: active.summary.value
|
|
5984
|
-
}), active.summary.delta && /* @__PURE__ */ jsx(TrendDelta, { ...active.summary.delta })]
|
|
5985
|
-
}),
|
|
5986
|
-
/* @__PURE__ */ jsx("div", {
|
|
5987
|
-
className: cn("px-3 pb-4 pt-3 sm:px-4", !footer && "pb-5"),
|
|
5988
|
-
children: kind === "heatmap" ? /* @__PURE__ */ jsx(Heatmap, {
|
|
5989
|
-
data,
|
|
5990
|
-
index,
|
|
5991
|
-
categories,
|
|
5992
|
-
color: colors[0] ?? "primary",
|
|
5993
|
-
valueFormatter,
|
|
5994
|
-
showScale: showLegend,
|
|
5995
|
-
height,
|
|
5996
|
-
"aria-label": chartLabel,
|
|
5997
|
-
...heatmap,
|
|
5998
|
-
...states,
|
|
5999
|
-
dataTable: dataTable ?? true
|
|
6000
|
-
}) : kind === "bar" ? /* @__PURE__ */ jsx(BarChart, {
|
|
6001
|
-
...common,
|
|
6002
|
-
stacked
|
|
6003
|
-
}) : kind === "line" ? /* @__PURE__ */ jsx(LineChart, { ...common }) : /* @__PURE__ */ jsx(AreaChart, {
|
|
6004
|
-
...common,
|
|
6005
|
-
stacked
|
|
6790
|
+
}),
|
|
6791
|
+
footer && /* @__PURE__ */ jsx("div", {
|
|
6792
|
+
className: "border-t border-border px-5 py-3 text-[12.5px] text-muted-foreground",
|
|
6793
|
+
children: footer
|
|
6006
6794
|
})
|
|
6007
|
-
|
|
6008
|
-
|
|
6009
|
-
className: "border-t border-border px-5 py-3 text-[12.5px] text-muted-foreground",
|
|
6010
|
-
children: footer
|
|
6011
|
-
})
|
|
6012
|
-
]
|
|
6795
|
+
]
|
|
6796
|
+
})
|
|
6013
6797
|
});
|
|
6014
6798
|
}
|
|
6015
6799
|
//#endregion
|
|
@@ -6018,7 +6802,7 @@ const meta$6 = {
|
|
|
6018
6802
|
name: "Chart card",
|
|
6019
6803
|
family: "data-display",
|
|
6020
6804
|
status: "beta",
|
|
6021
|
-
description: "A Card with chart and legend: default 7d/30d/90d or custom ranges via ranges, controlled range/onRangeChange, and showRangeToggle={false} when a toolbar owns the range (pass its window as range). Supports title, optional headline and delta, area/line/bar/heatmap charts, and loading, empty and error states. Supply matching dataByRange keys and use defaultRange for initial uncontrolled selection; the toolbar is the only range control when the toggle is hidden. Unknown range/defaultRange keys fall back to the first option for selection, data and label, with a development-only warning.",
|
|
6805
|
+
description: "A Card with chart and legend: default 7d/30d/90d or custom ranges via ranges, controlled range/onRangeChange, and showRangeToggle={false} when a toolbar owns the range (pass its window as range). Supports title, optional headline and delta, area/line/bar/heatmap charts, and loading, empty and error states. Supply matching dataByRange keys and use defaultRange for initial uncontrolled selection; the toolbar is the only range control when the toggle is hidden. Unknown range/defaultRange keys fall back to the first option for selection, data and label, with a development-only warning. Chart states follow the kit I18nProvider locale automatically through ChartLocaleProvider; standalone charts need their own ChartLocaleProvider (en/es, per-key labels overrides). Number/date formatting stays caller-controlled.",
|
|
6022
6806
|
uses: [
|
|
6023
6807
|
"Card",
|
|
6024
6808
|
"ToggleGroup",
|
|
@@ -6077,7 +6861,8 @@ const DEPLOYMENT_DETAILS = [
|
|
|
6077
6861
|
];
|
|
6078
6862
|
//#endregion
|
|
6079
6863
|
//#region src/data-display/DescriptionListCard/DescriptionListCard.tsx
|
|
6080
|
-
function CopyButton$1({ item, onCopy }) {
|
|
6864
|
+
function CopyButton$1({ item, onCopy, labels }) {
|
|
6865
|
+
const { t } = useI18n();
|
|
6081
6866
|
const [copied, setCopied] = useState(false);
|
|
6082
6867
|
const timer = useRef(void 0);
|
|
6083
6868
|
useEffect(() => () => window.clearTimeout(timer.current), []);
|
|
@@ -6093,7 +6878,7 @@ function CopyButton$1({ item, onCopy }) {
|
|
|
6093
6878
|
};
|
|
6094
6879
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(IconButton, {
|
|
6095
6880
|
icon: copied ? Check : Copy,
|
|
6096
|
-
label: copied ?
|
|
6881
|
+
label: copied ? labels?.copied?.(item.label) ?? t("descriptionList.copied", { label: item.label }) : labels?.copy?.(item.label) ?? t("descriptionList.copy", { label: item.label }),
|
|
6097
6882
|
size: "sm",
|
|
6098
6883
|
variant: "ghost",
|
|
6099
6884
|
className: cn("size-7 shrink-0", copied && "text-success-text"),
|
|
@@ -6101,11 +6886,33 @@ function CopyButton$1({ item, onCopy }) {
|
|
|
6101
6886
|
}), /* @__PURE__ */ jsx("span", {
|
|
6102
6887
|
className: "sr-only",
|
|
6103
6888
|
"aria-live": "polite",
|
|
6104
|
-
children: copied ?
|
|
6889
|
+
children: copied ? labels?.copiedToClipboard ?? t("common.copiedToClipboard") : ""
|
|
6105
6890
|
})] });
|
|
6106
6891
|
}
|
|
6107
6892
|
/** Key–value detail card: label column, values (mono, status or rich), copy buttons and an Edit action. */
|
|
6108
|
-
function DescriptionListCard({ title
|
|
6893
|
+
function DescriptionListCard({ title: titleProp, labels, description: descriptionProp, items = DEPLOYMENT_DETAILS, wrap = false, columns = 1, onEdit, editLabel: editLabelProp, onCopy, titleAs = "h3", className }) {
|
|
6894
|
+
const { t } = useI18n();
|
|
6895
|
+
const title = titleProp ?? labels?.title ?? t("descriptionList.title");
|
|
6896
|
+
const description = descriptionProp ?? labels?.description ?? t("descriptionList.description");
|
|
6897
|
+
const editLabel = editLabelProp ?? labels?.edit ?? t("descriptionList.edit");
|
|
6898
|
+
const renderItem = (item) => /* @__PURE__ */ jsxs("div", {
|
|
6899
|
+
className: cn("grid grid-cols-1 gap-1 py-3.5", columns === 1 && "sm:grid-cols-[160px_minmax(0,1fr)] sm:gap-4"),
|
|
6900
|
+
children: [/* @__PURE__ */ jsx("dt", {
|
|
6901
|
+
className: "text-[13px] text-muted-foreground",
|
|
6902
|
+
children: item.label
|
|
6903
|
+
}), /* @__PURE__ */ jsxs("dd", {
|
|
6904
|
+
className: "flex min-w-0 items-center gap-2 text-[13px] text-foreground",
|
|
6905
|
+
children: [item.status ? /* @__PURE__ */ jsx(StatusTag, { status: item.status }) : /* @__PURE__ */ jsx("span", {
|
|
6906
|
+
className: cn(wrap ? "min-w-0 wrap-anywhere" : "min-w-0 truncate", item.mono && "font-mono text-[12.5px]"),
|
|
6907
|
+
children: item.render ?? item.value
|
|
6908
|
+
}), item.copyable && /* @__PURE__ */ jsx(CopyButton$1, {
|
|
6909
|
+
item,
|
|
6910
|
+
onCopy,
|
|
6911
|
+
labels
|
|
6912
|
+
})]
|
|
6913
|
+
})]
|
|
6914
|
+
}, item.id);
|
|
6915
|
+
const chunkSize = Math.ceil(items.length / columns);
|
|
6109
6916
|
return /* @__PURE__ */ jsxs(Card, {
|
|
6110
6917
|
className,
|
|
6111
6918
|
children: [/* @__PURE__ */ jsxs(CardHeader, {
|
|
@@ -6124,24 +6931,15 @@ function DescriptionListCard({ title = "Configuration", description = "Settings
|
|
|
6124
6931
|
children: editLabel
|
|
6125
6932
|
}) })
|
|
6126
6933
|
]
|
|
6127
|
-
}), /* @__PURE__ */ jsx("dl", {
|
|
6934
|
+
}), columns === 1 ? /* @__PURE__ */ jsx("dl", {
|
|
6128
6935
|
className: "divide-y divide-border px-5",
|
|
6129
|
-
children: items.map(
|
|
6130
|
-
|
|
6131
|
-
|
|
6132
|
-
|
|
6133
|
-
|
|
6134
|
-
|
|
6135
|
-
|
|
6136
|
-
children: [item.status ? /* @__PURE__ */ jsx(StatusTag, { status: item.status }) : /* @__PURE__ */ jsx("span", {
|
|
6137
|
-
className: cn("min-w-0 truncate", item.mono && "font-mono text-[12.5px]"),
|
|
6138
|
-
children: item.render ?? item.value
|
|
6139
|
-
}), item.copyable && /* @__PURE__ */ jsx(CopyButton$1, {
|
|
6140
|
-
item,
|
|
6141
|
-
onCopy
|
|
6142
|
-
})]
|
|
6143
|
-
})]
|
|
6144
|
-
}, item.id))
|
|
6936
|
+
children: items.map(renderItem)
|
|
6937
|
+
}) : /* @__PURE__ */ jsx("div", {
|
|
6938
|
+
className: cn("grid grid-cols-1 gap-x-6 px-5", columns === 2 ? "sm:grid-cols-2" : "sm:grid-cols-3"),
|
|
6939
|
+
children: Array.from({ length: columns }, (_, column) => /* @__PURE__ */ jsx("dl", {
|
|
6940
|
+
className: "min-w-0 divide-y divide-border",
|
|
6941
|
+
children: items.slice(column * chunkSize, (column + 1) * chunkSize).map(renderItem)
|
|
6942
|
+
}, column))
|
|
6145
6943
|
})]
|
|
6146
6944
|
});
|
|
6147
6945
|
}
|
|
@@ -6151,7 +6949,39 @@ const meta$18 = {
|
|
|
6151
6949
|
name: "Description list card",
|
|
6152
6950
|
family: "data-display",
|
|
6153
6951
|
status: "beta",
|
|
6154
|
-
description: "Key–value detail card with mono, status and rich values, copy-to-clipboard buttons and an Edit action.",
|
|
6952
|
+
description: "Key–value detail card with mono, status and rich values, copy-to-clipboard buttons and an Edit action. Optional labels?: Partial<DescriptionListCardLabels> overrides each built-in label. Explicit content props win over labels, then I18nProvider (en/es); no provider keeps English. Imported fixtures and machine data stay unchanged. See the Catalog labels live preview. wrap?: boolean (default false) shows full values and breaks long unbroken strings. columns?: 1 | 2 | 3 (default 1) stacks terms above values in two or three columns from sm, with one column below sm; items fill contiguous top-to-bottom chunks of ceil(item count / columns), and dividers stay within each column. Defaults preserve the original single-column rows. See the Spanish live preview for wrapping and both column layouts.",
|
|
6953
|
+
labels: [
|
|
6954
|
+
{
|
|
6955
|
+
key: "title",
|
|
6956
|
+
type: "string",
|
|
6957
|
+
state: "Card heading; title prop wins"
|
|
6958
|
+
},
|
|
6959
|
+
{
|
|
6960
|
+
key: "description",
|
|
6961
|
+
type: "string",
|
|
6962
|
+
state: "Card description; description prop wins"
|
|
6963
|
+
},
|
|
6964
|
+
{
|
|
6965
|
+
key: "edit",
|
|
6966
|
+
type: "string",
|
|
6967
|
+
state: "Edit button; editLabel prop wins"
|
|
6968
|
+
},
|
|
6969
|
+
{
|
|
6970
|
+
key: "copy",
|
|
6971
|
+
type: "(label: string) => string",
|
|
6972
|
+
state: "Copy button name; original item label"
|
|
6973
|
+
},
|
|
6974
|
+
{
|
|
6975
|
+
key: "copied",
|
|
6976
|
+
type: "(label: string) => string",
|
|
6977
|
+
state: "Copy button name after copying; original item label"
|
|
6978
|
+
},
|
|
6979
|
+
{
|
|
6980
|
+
key: "copiedToClipboard",
|
|
6981
|
+
type: "string",
|
|
6982
|
+
state: "Polite copy announcement"
|
|
6983
|
+
}
|
|
6984
|
+
],
|
|
6155
6985
|
uses: [
|
|
6156
6986
|
"Card",
|
|
6157
6987
|
"Button",
|
|
@@ -6915,15 +7745,18 @@ const meta$70 = {
|
|
|
6915
7745
|
};
|
|
6916
7746
|
//#endregion
|
|
6917
7747
|
//#region src/feedback/InlineCallout/InlineCallout.tsx
|
|
6918
|
-
const inlineCalloutDefaultActions = [{
|
|
6919
|
-
label: "Upgrade plan",
|
|
6920
|
-
variant: "secondary"
|
|
6921
|
-
}, {
|
|
6922
|
-
label: "View usage",
|
|
6923
|
-
href: "#usage"
|
|
6924
|
-
}];
|
|
6925
7748
|
/** In-content callout built on Alert: tone, title, body and a row of actions. */
|
|
6926
|
-
function InlineCallout({ tone = "warning", title
|
|
7749
|
+
function InlineCallout({ tone = "warning", title: titleProp, labels, description: descriptionProp, actions: actionsProp, icon, dismissible = false, open, onDismiss, className }) {
|
|
7750
|
+
const { t } = useI18n();
|
|
7751
|
+
const title = titleProp === void 0 ? labels?.title ?? t("callout.title") : titleProp;
|
|
7752
|
+
const description = descriptionProp === void 0 ? labels?.description ?? t("callout.description") : descriptionProp;
|
|
7753
|
+
const actions = actionsProp ?? [{
|
|
7754
|
+
label: labels?.upgrade ?? t("callout.upgrade"),
|
|
7755
|
+
variant: "secondary"
|
|
7756
|
+
}, {
|
|
7757
|
+
label: labels?.viewUsage ?? t("callout.viewUsage"),
|
|
7758
|
+
href: "#usage"
|
|
7759
|
+
}];
|
|
6927
7760
|
const [dismissed, setDismissed] = useState(false);
|
|
6928
7761
|
if (!(open ?? !dismissed)) return null;
|
|
6929
7762
|
return /* @__PURE__ */ jsx(Alert, {
|
|
@@ -6956,7 +7789,29 @@ const meta$33 = {
|
|
|
6956
7789
|
name: "Inline callout",
|
|
6957
7790
|
family: "feedback",
|
|
6958
7791
|
status: "beta",
|
|
6959
|
-
description: "Alert-based in-content callout with a tone, title, body, action buttons or links and optional dismiss.",
|
|
7792
|
+
description: "Alert-based in-content callout with a tone, title, body, action buttons or links and optional dismiss. Optional labels?: Partial<InlineCalloutLabels> overrides each built-in label. Explicit content props win over labels, then I18nProvider (en/es); no provider keeps English. Imported fixtures and machine data stay unchanged. See the Catalog labels live preview.",
|
|
7793
|
+
labels: [
|
|
7794
|
+
{
|
|
7795
|
+
key: "title",
|
|
7796
|
+
type: "string",
|
|
7797
|
+
state: "Callout title; explicit title prop wins, including null"
|
|
7798
|
+
},
|
|
7799
|
+
{
|
|
7800
|
+
key: "description",
|
|
7801
|
+
type: "string",
|
|
7802
|
+
state: "Callout body; explicit description prop wins, including null"
|
|
7803
|
+
},
|
|
7804
|
+
{
|
|
7805
|
+
key: "upgrade",
|
|
7806
|
+
type: "string",
|
|
7807
|
+
state: "Default primary action; explicit actions win"
|
|
7808
|
+
},
|
|
7809
|
+
{
|
|
7810
|
+
key: "viewUsage",
|
|
7811
|
+
type: "string",
|
|
7812
|
+
state: "Default usage link; explicit actions win"
|
|
7813
|
+
}
|
|
7814
|
+
],
|
|
6960
7815
|
uses: [
|
|
6961
7816
|
"Alert",
|
|
6962
7817
|
"Button",
|
|
@@ -6999,10 +7854,15 @@ function NotFoundEmpty({ icon = SearchX, title = notFoundSample.title, descripti
|
|
|
6999
7854
|
});
|
|
7000
7855
|
}
|
|
7001
7856
|
/** First-run state: nothing created yet; explains the value and offers the first action. */
|
|
7002
|
-
function FirstRunEmpty({ icon = FolderPlus, title
|
|
7003
|
-
|
|
7004
|
-
|
|
7005
|
-
|
|
7857
|
+
function FirstRunEmpty({ icon = FolderPlus, title: titleProp, labels, description: descriptionProp, actionLabel: actionLabelProp, onAction, secondary: secondaryProp, steps = firstRunSteps, titleAs, bordered = true, className }) {
|
|
7858
|
+
const { t } = useI18n();
|
|
7859
|
+
const title = titleProp === void 0 ? labels?.title ?? t("emptyState.firstRun.title") : titleProp;
|
|
7860
|
+
const description = descriptionProp === void 0 ? labels?.description ?? t("emptyState.firstRun.description") : descriptionProp;
|
|
7861
|
+
const actionLabel = actionLabelProp ?? labels?.action ?? t("emptyState.firstRun.action");
|
|
7862
|
+
const secondary = secondaryProp === void 0 ? {
|
|
7863
|
+
label: labels?.guide ?? t("emptyState.firstRun.guide"),
|
|
7864
|
+
href: "#guide"
|
|
7865
|
+
} : secondaryProp;
|
|
7006
7866
|
return /* @__PURE__ */ jsx(EmptyState, {
|
|
7007
7867
|
icon,
|
|
7008
7868
|
title,
|
|
@@ -7033,41 +7893,40 @@ function FirstRunEmpty({ icon = FolderPlus, title = "Create your first project",
|
|
|
7033
7893
|
});
|
|
7034
7894
|
}
|
|
7035
7895
|
/** No-results state for a filtered list or table: echoes the query and offers ways out. */
|
|
7036
|
-
function NoResultsEmpty({ query = noResultsSample.query, filterCount = noResultsSample.filterCount, entity = noResultsSample.entity, onClearFilters, onClearSearch, titleAs, bordered = false, className }) {
|
|
7037
|
-
const
|
|
7896
|
+
function NoResultsEmpty({ query = noResultsSample.query, labels, filterCount = noResultsSample.filterCount, entity = noResultsSample.entity, onClearFilters, onClearSearch, titleAs, bordered = false, className }) {
|
|
7897
|
+
const { t } = useI18n();
|
|
7038
7898
|
return /* @__PURE__ */ jsx(EmptyState, {
|
|
7039
7899
|
icon: SearchX,
|
|
7040
7900
|
size: "sm",
|
|
7041
7901
|
titleAs,
|
|
7042
7902
|
bordered,
|
|
7043
7903
|
className: cn("mx-auto", className),
|
|
7044
|
-
title: query ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
7045
|
-
"
|
|
7046
|
-
entity,
|
|
7047
|
-
" match “",
|
|
7904
|
+
title: query ? labels?.queryTitle?.(entity, query) ?? /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
7905
|
+
t("emptyState.noResults.queryTitleBefore", { entity }),
|
|
7048
7906
|
/* @__PURE__ */ jsx("span", {
|
|
7049
7907
|
className: "font-mono",
|
|
7050
7908
|
children: query
|
|
7051
7909
|
}),
|
|
7052
|
-
"
|
|
7053
|
-
] }) :
|
|
7054
|
-
description:
|
|
7910
|
+
t("emptyState.noResults.queryTitleAfter")
|
|
7911
|
+
] }) : labels?.title?.(entity) ?? t("emptyState.noResults.title", { entity }),
|
|
7912
|
+
description: labels?.description?.(filterCount) ?? t("emptyState.noResults.description", { count: filterCount > 0 ? filterCount : 0 }),
|
|
7055
7913
|
primaryAction: filterCount > 0 ? /* @__PURE__ */ jsx(Button, {
|
|
7056
7914
|
variant: "secondary",
|
|
7057
7915
|
size: "sm",
|
|
7058
7916
|
onClick: onClearFilters,
|
|
7059
|
-
children:
|
|
7917
|
+
children: labels?.clearFilters ?? t("emptyState.noResults.clearFilters")
|
|
7060
7918
|
}) : void 0,
|
|
7061
7919
|
secondaryAction: query ? /* @__PURE__ */ jsx(Button, {
|
|
7062
7920
|
variant: "ghost",
|
|
7063
7921
|
size: "sm",
|
|
7064
7922
|
onClick: onClearSearch,
|
|
7065
|
-
children:
|
|
7923
|
+
children: labels?.clearSearch ?? t("emptyState.noResults.clearSearch")
|
|
7066
7924
|
}) : void 0
|
|
7067
7925
|
});
|
|
7068
7926
|
}
|
|
7069
7927
|
/** Permission state: the viewer lacks access; explains who can grant it and lets them ask. */
|
|
7070
|
-
function NoAccessEmpty({ resource = noAccessSample.resource, owner = noAccessSample.owner, onRequestAccess, defaultRequested = false, titleAs, bordered = true, className }) {
|
|
7928
|
+
function NoAccessEmpty({ resource = noAccessSample.resource, labels, owner = noAccessSample.owner, onRequestAccess, showRequestAccess = true, action, defaultRequested = false, titleAs, bordered = true, className }) {
|
|
7929
|
+
const { t } = useI18n();
|
|
7071
7930
|
const [state, setState] = useState(defaultRequested ? "requested" : "idle");
|
|
7072
7931
|
const request = async () => {
|
|
7073
7932
|
setState("pending");
|
|
@@ -7078,25 +7937,35 @@ function NoAccessEmpty({ resource = noAccessSample.resource, owner = noAccessSam
|
|
|
7078
7937
|
setState("idle");
|
|
7079
7938
|
}
|
|
7080
7939
|
};
|
|
7940
|
+
const actionLink = action ? /* @__PURE__ */ jsx(Link, {
|
|
7941
|
+
underline: "hover",
|
|
7942
|
+
href: action.href,
|
|
7943
|
+
className: "inline-flex h-9 items-center px-2 text-[13px] font-semibold",
|
|
7944
|
+
children: action.label
|
|
7945
|
+
}) : void 0;
|
|
7081
7946
|
return /* @__PURE__ */ jsx(EmptyState, {
|
|
7082
7947
|
icon: Lock,
|
|
7083
7948
|
titleAs,
|
|
7084
7949
|
bordered,
|
|
7085
7950
|
className: cn("mx-auto", className),
|
|
7086
|
-
title:
|
|
7087
|
-
description:
|
|
7088
|
-
|
|
7951
|
+
title: labels?.title?.(resource) ?? t("emptyState.noAccess.title", { resource }),
|
|
7952
|
+
description: labels?.description?.(resource, owner) ?? t("emptyState.noAccess.description", {
|
|
7953
|
+
resource: resource.toLowerCase(),
|
|
7954
|
+
owner
|
|
7955
|
+
}),
|
|
7956
|
+
primaryAction: showRequestAccess ? /* @__PURE__ */ jsx(Button, {
|
|
7089
7957
|
variant: state === "requested" ? "secondary" : "primary",
|
|
7090
7958
|
icon: state === "requested" ? Check : void 0,
|
|
7091
7959
|
loading: state === "pending",
|
|
7092
7960
|
disabled: state === "requested",
|
|
7093
7961
|
onClick: () => void request(),
|
|
7094
|
-
children: state === "requested" ? "
|
|
7095
|
-
}),
|
|
7096
|
-
|
|
7962
|
+
children: state === "requested" ? labels?.requested ?? t("emptyState.noAccess.requested") : labels?.request ?? t("emptyState.noAccess.request")
|
|
7963
|
+
}) : actionLink,
|
|
7964
|
+
secondaryAction: showRequestAccess ? actionLink : void 0,
|
|
7965
|
+
children: showRequestAccess && /* @__PURE__ */ jsx("p", {
|
|
7097
7966
|
role: "status",
|
|
7098
7967
|
className: "sr-only",
|
|
7099
|
-
children: state === "requested" ?
|
|
7968
|
+
children: state === "requested" ? labels?.sent ?? t("emptyState.noAccess.sent") : ""
|
|
7100
7969
|
})
|
|
7101
7970
|
});
|
|
7102
7971
|
}
|
|
@@ -7106,7 +7975,79 @@ const meta$20 = {
|
|
|
7106
7975
|
name: "Empty states",
|
|
7107
7976
|
family: "feedback",
|
|
7108
7977
|
status: "beta",
|
|
7109
|
-
description: "Four canonical empty states: first run (with checklist), no results (clear filters/search), no access (request access) and not found (optional action).",
|
|
7978
|
+
description: "Four canonical empty states: first run (with checklist), no results (clear filters/search), no access (request access) and not found (optional action). FirstRunEmpty, NoResultsEmpty and NoAccessEmpty accept labels?: Partial<FirstRunEmptyLabels>, Partial<NoResultsEmptyLabels> and Partial<NoAccessEmptyLabels> respectively. Each type has its own keys below; explicit title, description, actionLabel and secondary props win. Defaults follow I18nProvider (en/es). NoResultsEmpty keeps the query in a mono span unless queryTitle replaces the heading. NotFoundEmpty and all imported fixtures stay English. See the Catalog labels live preview. NoAccessEmpty accepts showRequestAccess?: boolean (default true): false hides both the request button and its status announcement, so defaultRequested has no visible effect. action?: { label: string; href: string } renders one kit Link, styled like FirstRunEmpty’s secondary link; it is secondaryAction after the request button, or primaryAction when showRequestAccess is false. With showRequestAccess=false and no action, it renders no actions. Omitting onRequestAccess still shows the button by default. See the Spanish live preview for no actions, a link alone, and a link with the request button.",
|
|
7979
|
+
labels: [
|
|
7980
|
+
{
|
|
7981
|
+
key: "FirstRunEmpty.labels.title",
|
|
7982
|
+
type: "string",
|
|
7983
|
+
state: "FirstRunEmpty: per-key override; formatters receive original data. Explicit props win."
|
|
7984
|
+
},
|
|
7985
|
+
{
|
|
7986
|
+
key: "FirstRunEmpty.labels.description",
|
|
7987
|
+
type: "string",
|
|
7988
|
+
state: "FirstRunEmpty: per-key override; formatters receive original data. Explicit props win."
|
|
7989
|
+
},
|
|
7990
|
+
{
|
|
7991
|
+
key: "FirstRunEmpty.labels.action",
|
|
7992
|
+
type: "string",
|
|
7993
|
+
state: "FirstRunEmpty: per-key override; formatters receive original data. Explicit props win."
|
|
7994
|
+
},
|
|
7995
|
+
{
|
|
7996
|
+
key: "FirstRunEmpty.labels.guide",
|
|
7997
|
+
type: "string",
|
|
7998
|
+
state: "FirstRunEmpty: per-key override; formatters receive original data. Explicit props win."
|
|
7999
|
+
},
|
|
8000
|
+
{
|
|
8001
|
+
key: "NoResultsEmpty.labels.queryTitle",
|
|
8002
|
+
type: "(entity: string, query: string) => string",
|
|
8003
|
+
state: "NoResultsEmpty: per-key override; formatters receive original data. Explicit props win."
|
|
8004
|
+
},
|
|
8005
|
+
{
|
|
8006
|
+
key: "NoResultsEmpty.labels.title",
|
|
8007
|
+
type: "(entity: string) => string",
|
|
8008
|
+
state: "NoResultsEmpty: per-key override; formatters receive original data. Explicit props win."
|
|
8009
|
+
},
|
|
8010
|
+
{
|
|
8011
|
+
key: "NoResultsEmpty.labels.description",
|
|
8012
|
+
type: "(filterCount: number) => string",
|
|
8013
|
+
state: "NoResultsEmpty: per-key override; formatters receive original data. Explicit props win."
|
|
8014
|
+
},
|
|
8015
|
+
{
|
|
8016
|
+
key: "NoResultsEmpty.labels.clearFilters",
|
|
8017
|
+
type: "string",
|
|
8018
|
+
state: "NoResultsEmpty: per-key override; formatters receive original data. Explicit props win."
|
|
8019
|
+
},
|
|
8020
|
+
{
|
|
8021
|
+
key: "NoResultsEmpty.labels.clearSearch",
|
|
8022
|
+
type: "string",
|
|
8023
|
+
state: "NoResultsEmpty: per-key override; formatters receive original data. Explicit props win."
|
|
8024
|
+
},
|
|
8025
|
+
{
|
|
8026
|
+
key: "NoAccessEmpty.labels.title",
|
|
8027
|
+
type: "(resource: string) => string",
|
|
8028
|
+
state: "NoAccessEmpty: per-key override; formatters receive original data. Explicit props win."
|
|
8029
|
+
},
|
|
8030
|
+
{
|
|
8031
|
+
key: "NoAccessEmpty.labels.description",
|
|
8032
|
+
type: "(resource: string, owner: string) => string",
|
|
8033
|
+
state: "NoAccessEmpty: per-key override; formatters receive original data. Explicit props win."
|
|
8034
|
+
},
|
|
8035
|
+
{
|
|
8036
|
+
key: "NoAccessEmpty.labels.request",
|
|
8037
|
+
type: "string",
|
|
8038
|
+
state: "NoAccessEmpty: per-key override; formatters receive original data. Explicit props win."
|
|
8039
|
+
},
|
|
8040
|
+
{
|
|
8041
|
+
key: "NoAccessEmpty.labels.requested",
|
|
8042
|
+
type: "string",
|
|
8043
|
+
state: "NoAccessEmpty: per-key override; formatters receive original data. Explicit props win."
|
|
8044
|
+
},
|
|
8045
|
+
{
|
|
8046
|
+
key: "NoAccessEmpty.labels.sent",
|
|
8047
|
+
type: "string",
|
|
8048
|
+
state: "NoAccessEmpty: per-key override; formatters receive original data. Explicit props win."
|
|
8049
|
+
}
|
|
8050
|
+
],
|
|
7110
8051
|
uses: [
|
|
7111
8052
|
"EmptyState",
|
|
7112
8053
|
"Button",
|
|
@@ -7260,12 +8201,15 @@ const meta$63 = {
|
|
|
7260
8201
|
//#endregion
|
|
7261
8202
|
//#region src/feedback/ErrorPanel/ErrorPanel.tsx
|
|
7262
8203
|
/** Error summary for a failed load or action: what happened, request id, retry and technical details. */
|
|
7263
|
-
function ErrorPanel({ icon: Icon = ServerCrash, title
|
|
7264
|
-
label: "Contact support",
|
|
7265
|
-
variant: "ghost"
|
|
7266
|
-
}, titleAs: Heading = "h3", className, announce = true }) {
|
|
8204
|
+
function ErrorPanel({ icon: Icon = ServerCrash, title: titleProp, labels, message: messageProp, code = 503, requestId = "req_8f2c41d07a9b", details = "GET /v1/projects/acme-web/deployments\n503 Service Unavailable\nupstream timed out after 30000 ms (pool: api-eu-west-1)", onRetry, retrying, retryLabel: retryLabelProp, secondaryAction: secondaryActionProp, titleAs: Heading = "h3", className, announce = true }) {
|
|
7267
8205
|
const { t } = useI18n();
|
|
7268
|
-
const
|
|
8206
|
+
const title = titleProp === void 0 ? labels?.title ?? t("error.title") : titleProp;
|
|
8207
|
+
const message = messageProp === void 0 ? labels?.message ?? t("error.message") : messageProp;
|
|
8208
|
+
const secondaryAction = secondaryActionProp === void 0 ? {
|
|
8209
|
+
label: labels?.support ?? t("error.support"),
|
|
8210
|
+
variant: "ghost"
|
|
8211
|
+
} : secondaryActionProp;
|
|
8212
|
+
const retryLabel = retryLabelProp ?? labels?.retry ?? t("error.retry");
|
|
7269
8213
|
const id = useId();
|
|
7270
8214
|
const [innerRetrying, setInnerRetrying] = useState(false);
|
|
7271
8215
|
const [copied, setCopied] = useState(false);
|
|
@@ -7323,14 +8267,14 @@ function ErrorPanel({ icon: Icon = ServerCrash, title = "We couldn’t load depl
|
|
|
7323
8267
|
requestId && /* @__PURE__ */ jsxs("div", {
|
|
7324
8268
|
className: "mt-3 flex items-center gap-1.5 text-[12px] text-muted-foreground",
|
|
7325
8269
|
children: [
|
|
7326
|
-
/* @__PURE__ */ jsx("span", { children: t("error.requestId") }),
|
|
8270
|
+
/* @__PURE__ */ jsx("span", { children: labels?.requestId ?? t("error.requestId") }),
|
|
7327
8271
|
/* @__PURE__ */ jsx("code", {
|
|
7328
8272
|
className: "rounded bg-muted px-1.5 py-0.5 font-mono text-[11.5px] text-foreground",
|
|
7329
8273
|
children: requestId
|
|
7330
8274
|
}),
|
|
7331
8275
|
/* @__PURE__ */ jsx(IconButton, {
|
|
7332
8276
|
icon: copied ? Check : Copy,
|
|
7333
|
-
label: copied ? t("common.copied") : t("error.copyRequestId"),
|
|
8277
|
+
label: copied ? labels?.copied ?? t("common.copied") : labels?.copyRequestId ?? t("error.copyRequestId"),
|
|
7334
8278
|
size: "sm",
|
|
7335
8279
|
variant: "ghost",
|
|
7336
8280
|
className: "size-7",
|
|
@@ -7346,7 +8290,7 @@ function ErrorPanel({ icon: Icon = ServerCrash, title = "We couldn’t load depl
|
|
|
7346
8290
|
icon: RotateCw,
|
|
7347
8291
|
loading: busy,
|
|
7348
8292
|
onClick: () => void retry(),
|
|
7349
|
-
children: busy ? t("error.retrying") : retryLabel
|
|
8293
|
+
children: busy ? labels?.retrying ?? t("error.retrying") : retryLabel
|
|
7350
8294
|
}), secondaryAction && /* @__PURE__ */ jsx(Button, {
|
|
7351
8295
|
size: "sm",
|
|
7352
8296
|
variant: secondaryAction.variant ?? "ghost",
|
|
@@ -7360,7 +8304,7 @@ function ErrorPanel({ icon: Icon = ServerCrash, title = "We couldn’t load depl
|
|
|
7360
8304
|
className: "mt-4",
|
|
7361
8305
|
children: [/* @__PURE__ */ jsx(CollapsibleTrigger, {
|
|
7362
8306
|
className: "text-[12.5px]",
|
|
7363
|
-
children: t("error.details")
|
|
8307
|
+
children: labels?.details ?? t("error.details")
|
|
7364
8308
|
}), /* @__PURE__ */ jsx(CollapsiblePanel, { children: /* @__PURE__ */ jsx("pre", {
|
|
7365
8309
|
className: "mt-2 max-h-60 overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-[11.5px] leading-5 whitespace-pre-wrap text-foreground",
|
|
7366
8310
|
children: details
|
|
@@ -7369,7 +8313,7 @@ function ErrorPanel({ icon: Icon = ServerCrash, title = "We couldn’t load depl
|
|
|
7369
8313
|
announce && /* @__PURE__ */ jsx("p", {
|
|
7370
8314
|
role: "status",
|
|
7371
8315
|
className: "sr-only",
|
|
7372
|
-
children: busy ? t("error.retryingStatus") : copied ? t("error.requestIdCopied") : ""
|
|
8316
|
+
children: busy ? labels?.retryingStatus ?? t("error.retryingStatus") : copied ? labels?.requestIdCopied ?? t("error.requestIdCopied") : ""
|
|
7373
8317
|
})
|
|
7374
8318
|
]
|
|
7375
8319
|
})]
|
|
@@ -7645,7 +8589,64 @@ const meta$22 = {
|
|
|
7645
8589
|
name: "Error panel",
|
|
7646
8590
|
family: "feedback",
|
|
7647
8591
|
status: "beta",
|
|
7648
|
-
description: "Error summary with status code, copyable request id, retry with loading state and a technical-details disclosure.",
|
|
8592
|
+
description: "Error summary with status code, copyable request id, retry with loading state and a technical-details disclosure. Optional labels?: Partial<ErrorPanelLabels> overrides each built-in label. Explicit content props win over labels, then I18nProvider (en/es); no provider keeps English. Imported fixtures and machine data stay unchanged. See the Catalog labels live preview.",
|
|
8593
|
+
labels: [
|
|
8594
|
+
{
|
|
8595
|
+
key: "title",
|
|
8596
|
+
type: "string",
|
|
8597
|
+
state: "Panel heading; explicit title prop wins, including null"
|
|
8598
|
+
},
|
|
8599
|
+
{
|
|
8600
|
+
key: "message",
|
|
8601
|
+
type: "string",
|
|
8602
|
+
state: "Summary; explicit message prop wins, including null"
|
|
8603
|
+
},
|
|
8604
|
+
{
|
|
8605
|
+
key: "support",
|
|
8606
|
+
type: "string",
|
|
8607
|
+
state: "Default secondary action; explicit secondaryAction wins, including null"
|
|
8608
|
+
},
|
|
8609
|
+
{
|
|
8610
|
+
key: "retry",
|
|
8611
|
+
type: "string",
|
|
8612
|
+
state: "Retry button; retryLabel prop wins"
|
|
8613
|
+
},
|
|
8614
|
+
{
|
|
8615
|
+
key: "retrying",
|
|
8616
|
+
type: "string",
|
|
8617
|
+
state: "Busy retry button"
|
|
8618
|
+
},
|
|
8619
|
+
{
|
|
8620
|
+
key: "retryingStatus",
|
|
8621
|
+
type: "string",
|
|
8622
|
+
state: "Busy status announcement"
|
|
8623
|
+
},
|
|
8624
|
+
{
|
|
8625
|
+
key: "requestId",
|
|
8626
|
+
type: "string",
|
|
8627
|
+
state: "Request ID caption"
|
|
8628
|
+
},
|
|
8629
|
+
{
|
|
8630
|
+
key: "copyRequestId",
|
|
8631
|
+
type: "string",
|
|
8632
|
+
state: "Copy request ID button"
|
|
8633
|
+
},
|
|
8634
|
+
{
|
|
8635
|
+
key: "copied",
|
|
8636
|
+
type: "string",
|
|
8637
|
+
state: "Copy button after copying"
|
|
8638
|
+
},
|
|
8639
|
+
{
|
|
8640
|
+
key: "requestIdCopied",
|
|
8641
|
+
type: "string",
|
|
8642
|
+
state: "Copied status announcement"
|
|
8643
|
+
},
|
|
8644
|
+
{
|
|
8645
|
+
key: "details",
|
|
8646
|
+
type: "string",
|
|
8647
|
+
state: "Technical details disclosure"
|
|
8648
|
+
}
|
|
8649
|
+
],
|
|
7649
8650
|
uses: [
|
|
7650
8651
|
"Button",
|
|
7651
8652
|
"IconButton",
|
|
@@ -7655,7 +8656,8 @@ const meta$22 = {
|
|
|
7655
8656
|
//#endregion
|
|
7656
8657
|
//#region src/forms/DangerZone/ConfirmDestructiveDialog.tsx
|
|
7657
8658
|
/** Destructive confirmation (alertdialog) that can require typing the resource name first. */
|
|
7658
|
-
function ConfirmDestructiveDialog({ open, onOpenChange, title, description, confirmText, confirmLabel, onConfirm }) {
|
|
8659
|
+
function ConfirmDestructiveDialog({ labels, open, onOpenChange, title, description, confirmText, confirmLabel, onConfirm }) {
|
|
8660
|
+
const { t } = useI18n();
|
|
7659
8661
|
const [typed, setTyped] = useState("");
|
|
7660
8662
|
const [loading, setLoading] = useState(false);
|
|
7661
8663
|
const [error, setError] = useState(null);
|
|
@@ -7679,7 +8681,7 @@ function ConfirmDestructiveDialog({ open, onOpenChange, title, description, conf
|
|
|
7679
8681
|
onOpenChange(false);
|
|
7680
8682
|
} catch (e) {
|
|
7681
8683
|
setLoading(false);
|
|
7682
|
-
setError(e instanceof Error ? e.message :
|
|
8684
|
+
setError(e instanceof Error ? e.message : labels?.fallbackError ?? t("dangerZone.fallbackError"));
|
|
7683
8685
|
}
|
|
7684
8686
|
};
|
|
7685
8687
|
return /* @__PURE__ */ jsx(AlertDialog, {
|
|
@@ -7697,14 +8699,10 @@ function ConfirmDestructiveDialog({ open, onOpenChange, title, description, conf
|
|
|
7697
8699
|
confirm();
|
|
7698
8700
|
},
|
|
7699
8701
|
children: [
|
|
7700
|
-
confirmText != null && /* @__PURE__ */ jsxs(Field, { children: [/* @__PURE__ */
|
|
7701
|
-
"
|
|
7702
|
-
|
|
7703
|
-
|
|
7704
|
-
children: confirmText
|
|
7705
|
-
}),
|
|
7706
|
-
" to confirm"
|
|
7707
|
-
] }), /* @__PURE__ */ jsx(Input, {
|
|
8702
|
+
confirmText != null && /* @__PURE__ */ jsxs(Field, { children: [/* @__PURE__ */ jsx(FieldLabel, { children: labels?.confirmPrompt?.(confirmText) ?? translatedContent(t("dangerZone.confirmPrompt"), { text: /* @__PURE__ */ jsx("span", {
|
|
8703
|
+
className: "font-mono font-semibold text-foreground",
|
|
8704
|
+
children: confirmText
|
|
8705
|
+
}) }) }), /* @__PURE__ */ jsx(Input, {
|
|
7708
8706
|
value: typed,
|
|
7709
8707
|
onValueChange: setTyped,
|
|
7710
8708
|
autoComplete: "off",
|
|
@@ -7719,7 +8717,7 @@ function ConfirmDestructiveDialog({ open, onOpenChange, title, description, conf
|
|
|
7719
8717
|
className: "mt-1",
|
|
7720
8718
|
children: [/* @__PURE__ */ jsx(AlertDialogCancel, {
|
|
7721
8719
|
disabled: loading,
|
|
7722
|
-
children: "
|
|
8720
|
+
children: labels?.cancel ?? t("dangerZone.cancel")
|
|
7723
8721
|
}), /* @__PURE__ */ jsx(Button, {
|
|
7724
8722
|
type: "submit",
|
|
7725
8723
|
variant: "destructive",
|
|
@@ -7764,7 +8762,10 @@ const dangerZoneActions = [
|
|
|
7764
8762
|
* Bordered destructive section. Each action opens a confirmation dialog; actions with
|
|
7765
8763
|
* `confirmText` require typing it (e.g. the project name) before the confirm button enables.
|
|
7766
8764
|
*/
|
|
7767
|
-
function DangerZone({ title
|
|
8765
|
+
function DangerZone({ labels, title: titleProp, description: descriptionProp, actions = dangerZoneActions, onConfirm, headingLevel: Heading = "h2", className }) {
|
|
8766
|
+
const { t } = useI18n();
|
|
8767
|
+
const title = titleProp === void 0 ? labels?.title ?? t("dangerZone.title") : titleProp;
|
|
8768
|
+
const description = descriptionProp === void 0 ? labels?.description ?? t("dangerZone.description") : descriptionProp;
|
|
7768
8769
|
const id = useId();
|
|
7769
8770
|
const [pending, setPending] = useState(null);
|
|
7770
8771
|
const [open, setOpen] = useState(false);
|
|
@@ -7810,7 +8811,8 @@ function DangerZone({ title = "Danger zone", description = "These actions affect
|
|
|
7810
8811
|
pending && /* @__PURE__ */ jsx(ConfirmDestructiveDialog, {
|
|
7811
8812
|
open,
|
|
7812
8813
|
onOpenChange: setOpen,
|
|
7813
|
-
|
|
8814
|
+
labels,
|
|
8815
|
+
title: labels?.confirmationTitle?.(pending.title) ?? t("dangerZone.confirmationTitle", { title: pending.title }),
|
|
7814
8816
|
description: pending.description,
|
|
7815
8817
|
confirmText: pending.confirmText,
|
|
7816
8818
|
confirmLabel: pending.actionLabel,
|
|
@@ -7825,7 +8827,39 @@ const meta$15 = {
|
|
|
7825
8827
|
name: "Danger zone",
|
|
7826
8828
|
family: "forms",
|
|
7827
8829
|
status: "stable",
|
|
7828
|
-
description: "Bordered destructive section whose actions open an alert dialog that can require typing the resource name.",
|
|
8830
|
+
description: "Bordered destructive section whose actions open an alert dialog that can require typing the resource name. Optional labels?: Partial<DangerZoneLabels> overrides built-in copy; explicit props and validation messages win, then labels, then I18nProvider (en/es). No provider preserves English; fixtures and caller content stay unchanged. Interactive preview: /preview.html?kind=block&id=danger-zone--labels.",
|
|
8831
|
+
labels: [
|
|
8832
|
+
{
|
|
8833
|
+
key: "title",
|
|
8834
|
+
type: "string",
|
|
8835
|
+
state: "Default content and accessible names"
|
|
8836
|
+
},
|
|
8837
|
+
{
|
|
8838
|
+
key: "description",
|
|
8839
|
+
type: "string",
|
|
8840
|
+
state: "Default content and accessible names"
|
|
8841
|
+
},
|
|
8842
|
+
{
|
|
8843
|
+
key: "confirmationTitle",
|
|
8844
|
+
type: "(title: string) => string",
|
|
8845
|
+
state: "Destructive confirmation dialog"
|
|
8846
|
+
},
|
|
8847
|
+
{
|
|
8848
|
+
key: "confirmPrompt",
|
|
8849
|
+
type: "(text: ReactNode) => ReactNode",
|
|
8850
|
+
state: "Destructive confirmation dialog"
|
|
8851
|
+
},
|
|
8852
|
+
{
|
|
8853
|
+
key: "cancel",
|
|
8854
|
+
type: "string",
|
|
8855
|
+
state: "Destructive confirmation dialog"
|
|
8856
|
+
},
|
|
8857
|
+
{
|
|
8858
|
+
key: "fallbackError",
|
|
8859
|
+
type: "string",
|
|
8860
|
+
state: "Destructive confirmation dialog"
|
|
8861
|
+
}
|
|
8862
|
+
],
|
|
7829
8863
|
uses: [
|
|
7830
8864
|
"Button",
|
|
7831
8865
|
"AlertDialog",
|
|
@@ -7888,7 +8922,8 @@ function generateDemoSecret(prefix = "sk_live_") {
|
|
|
7888
8922
|
* Two-step API key dialog: name, scopes and expiry, then the secret shown once in a CodeBlock
|
|
7889
8923
|
* with copy. Closing the dialog discards the secret; it can't be shown again.
|
|
7890
8924
|
*/
|
|
7891
|
-
function CreateApiKeyDialog({ scopes = apiKeyScopes, expiries = apiKeyExpiries, defaultExpiry = "90d", onCreate = () => generateDemoSecret(), open: openProp, defaultOpen = false, onOpenChange, trigger = /* @__PURE__ */ jsx(Button, { icon: KeyRound }) }) {
|
|
8925
|
+
function CreateApiKeyDialog({ labels, scopes = apiKeyScopes, expiries = apiKeyExpiries, defaultExpiry = "90d", onCreate = () => generateDemoSecret(), open: openProp, defaultOpen = false, onOpenChange, trigger = /* @__PURE__ */ jsx(Button, { icon: KeyRound }) }) {
|
|
8926
|
+
const { t } = useI18n();
|
|
7892
8927
|
const [innerOpen, setInnerOpen] = useState(defaultOpen);
|
|
7893
8928
|
const [name, setName] = useState("");
|
|
7894
8929
|
const [selected, setSelected] = useState([]);
|
|
@@ -7926,7 +8961,7 @@ function CreateApiKeyDialog({ scopes = apiKeyScopes, expiries = apiKeyExpiries,
|
|
|
7926
8961
|
});
|
|
7927
8962
|
setSecret(value);
|
|
7928
8963
|
} catch (e) {
|
|
7929
|
-
setError(e instanceof Error ? e.message :
|
|
8964
|
+
setError(e instanceof Error ? e.message : labels?.fallbackError ?? t("createApiKey.fallbackError"));
|
|
7930
8965
|
}
|
|
7931
8966
|
setLoading(false);
|
|
7932
8967
|
};
|
|
@@ -7935,10 +8970,10 @@ function CreateApiKeyDialog({ scopes = apiKeyScopes, expiries = apiKeyExpiries,
|
|
|
7935
8970
|
onOpenChange: setOpen,
|
|
7936
8971
|
children: [trigger && /* @__PURE__ */ jsx(DialogTrigger, {
|
|
7937
8972
|
render: trigger,
|
|
7938
|
-
children:
|
|
8973
|
+
children: labels?.title ?? t("createApiKey.title")
|
|
7939
8974
|
}), /* @__PURE__ */ jsx(DialogContent, {
|
|
7940
8975
|
size: "lg",
|
|
7941
|
-
children: secret == null ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs(DialogHeader, { children: [/* @__PURE__ */ jsx(DialogTitle, { children:
|
|
8976
|
+
children: secret == null ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs(DialogHeader, { children: [/* @__PURE__ */ jsx(DialogTitle, { children: labels?.title ?? t("createApiKey.title") }), /* @__PURE__ */ jsx(DialogDescription, { children: labels?.description ?? t("createApiKey.description") })] }), /* @__PURE__ */ jsxs("form", {
|
|
7942
8977
|
noValidate: true,
|
|
7943
8978
|
onSubmit: (e) => {
|
|
7944
8979
|
e.preventDefault();
|
|
@@ -7952,18 +8987,18 @@ function CreateApiKeyDialog({ scopes = apiKeyScopes, expiries = apiKeyExpiries,
|
|
|
7952
8987
|
children: [
|
|
7953
8988
|
/* @__PURE__ */ jsx(FieldLabel, {
|
|
7954
8989
|
required: true,
|
|
7955
|
-
children: "
|
|
8990
|
+
children: labels?.name ?? t("createApiKey.name")
|
|
7956
8991
|
}),
|
|
7957
8992
|
/* @__PURE__ */ jsx(Input, {
|
|
7958
8993
|
value: name,
|
|
7959
8994
|
onValueChange: setName,
|
|
7960
|
-
placeholder: "
|
|
8995
|
+
placeholder: labels?.namePlaceholder ?? t("createApiKey.namePlaceholder"),
|
|
7961
8996
|
required: true,
|
|
7962
8997
|
autoComplete: "off"
|
|
7963
8998
|
}),
|
|
7964
8999
|
/* @__PURE__ */ jsx(FieldError, {
|
|
7965
9000
|
match: nameInvalid,
|
|
7966
|
-
children:
|
|
9001
|
+
children: labels?.nameRequired ?? t("createApiKey.nameRequired")
|
|
7967
9002
|
})
|
|
7968
9003
|
]
|
|
7969
9004
|
}),
|
|
@@ -7974,7 +9009,7 @@ function CreateApiKeyDialog({ scopes = apiKeyScopes, expiries = apiKeyExpiries,
|
|
|
7974
9009
|
}),
|
|
7975
9010
|
"aria-invalid": scopesInvalid || void 0,
|
|
7976
9011
|
children: [
|
|
7977
|
-
/* @__PURE__ */ jsx(FieldsetLegend, { children: "
|
|
9012
|
+
/* @__PURE__ */ jsx(FieldsetLegend, { children: labels?.scopes ?? t("createApiKey.scopes") }),
|
|
7978
9013
|
scopes.map((s) => /* @__PURE__ */ jsx(Checkbox, {
|
|
7979
9014
|
value: s.value,
|
|
7980
9015
|
label: /* @__PURE__ */ jsx("span", {
|
|
@@ -7985,11 +9020,11 @@ function CreateApiKeyDialog({ scopes = apiKeyScopes, expiries = apiKeyExpiries,
|
|
|
7985
9020
|
}, s.value)),
|
|
7986
9021
|
scopesInvalid && /* @__PURE__ */ jsx("p", {
|
|
7987
9022
|
className: "text-[12.5px] text-destructive-text",
|
|
7988
|
-
children:
|
|
9023
|
+
children: labels?.scopesRequired ?? t("createApiKey.scopesRequired")
|
|
7989
9024
|
})
|
|
7990
9025
|
]
|
|
7991
9026
|
}),
|
|
7992
|
-
/* @__PURE__ */ jsxs(Field, { children: [/* @__PURE__ */ jsx(FieldLabel, { children: "
|
|
9027
|
+
/* @__PURE__ */ jsxs(Field, { children: [/* @__PURE__ */ jsx(FieldLabel, { children: labels?.expiration ?? t("createApiKey.expiration") }), /* @__PURE__ */ jsxs(Select, {
|
|
7993
9028
|
value: expiry,
|
|
7994
9029
|
onValueChange: (v) => v != null && setExpiry(v),
|
|
7995
9030
|
items: expiries,
|
|
@@ -8000,7 +9035,7 @@ function CreateApiKeyDialog({ scopes = apiKeyScopes, expiries = apiKeyExpiries,
|
|
|
8000
9035
|
})] }),
|
|
8001
9036
|
error && /* @__PURE__ */ jsx(Alert, {
|
|
8002
9037
|
tone: "destructive",
|
|
8003
|
-
title:
|
|
9038
|
+
title: labels?.errorTitle ?? t("createApiKey.errorTitle"),
|
|
8004
9039
|
description: error
|
|
8005
9040
|
})
|
|
8006
9041
|
]
|
|
@@ -8009,30 +9044,30 @@ function CreateApiKeyDialog({ scopes = apiKeyScopes, expiries = apiKeyExpiries,
|
|
|
8009
9044
|
variant: "ghost",
|
|
8010
9045
|
disabled: loading
|
|
8011
9046
|
}),
|
|
8012
|
-
children: "
|
|
9047
|
+
children: labels?.cancel ?? t("createApiKey.cancel")
|
|
8013
9048
|
}), /* @__PURE__ */ jsx(Button, {
|
|
8014
9049
|
type: "submit",
|
|
8015
9050
|
loading,
|
|
8016
|
-
children:
|
|
9051
|
+
children: labels?.submit ?? t("createApiKey.submit")
|
|
8017
9052
|
})] })]
|
|
8018
9053
|
})] }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
8019
|
-
/* @__PURE__ */ jsxs(DialogHeader, { children: [/* @__PURE__ */ jsx(DialogTitle, { children:
|
|
9054
|
+
/* @__PURE__ */ jsxs(DialogHeader, { children: [/* @__PURE__ */ jsx(DialogTitle, { children: labels?.successTitle ?? t("createApiKey.successTitle") }), /* @__PURE__ */ jsx(DialogDescription, { children: labels?.successDescription ?? t("createApiKey.successDescription") })] }),
|
|
8020
9055
|
/* @__PURE__ */ jsxs(DialogBody, {
|
|
8021
9056
|
className: "grid gap-4",
|
|
8022
9057
|
children: [/* @__PURE__ */ jsx(Alert, {
|
|
8023
9058
|
tone: "warning",
|
|
8024
|
-
title:
|
|
8025
|
-
description:
|
|
9059
|
+
title: labels?.warningTitle ?? t("createApiKey.warningTitle"),
|
|
9060
|
+
description: labels?.warningDescription ?? t("createApiKey.warningDescription")
|
|
8026
9061
|
}), /* @__PURE__ */ jsx(CodeBlock, {
|
|
8027
9062
|
code: secret,
|
|
8028
|
-
label:
|
|
9063
|
+
label: labels?.secretLabel ?? t("createApiKey.secretLabel"),
|
|
8029
9064
|
wrapToggle: false,
|
|
8030
9065
|
defaultWrap: true
|
|
8031
9066
|
})]
|
|
8032
9067
|
}),
|
|
8033
9068
|
/* @__PURE__ */ jsx(DialogFooter, { children: /* @__PURE__ */ jsx(DialogClose, {
|
|
8034
9069
|
render: /* @__PURE__ */ jsx(Button, {}),
|
|
8035
|
-
children: "
|
|
9070
|
+
children: labels?.done ?? t("createApiKey.done")
|
|
8036
9071
|
}) })
|
|
8037
9072
|
] })
|
|
8038
9073
|
})]
|
|
@@ -8044,7 +9079,99 @@ const meta$12 = {
|
|
|
8044
9079
|
name: "Create API key dialog",
|
|
8045
9080
|
family: "forms",
|
|
8046
9081
|
status: "stable",
|
|
8047
|
-
description: "Two-step dialog: name, scopes and expiry, then the secret shown once in a copyable CodeBlock with a warning.",
|
|
9082
|
+
description: "Two-step dialog: name, scopes and expiry, then the secret shown once in a copyable CodeBlock with a warning. Optional labels?: Partial<CreateApiKeyDialogLabels> overrides built-in copy; explicit props and validation messages win, then labels, then I18nProvider (en/es). No provider preserves English; fixtures and caller content stay unchanged. Interactive preview: /preview.html?kind=block&id=create-api-key-dialog--labels.",
|
|
9083
|
+
labels: [
|
|
9084
|
+
{
|
|
9085
|
+
key: "title",
|
|
9086
|
+
type: "string",
|
|
9087
|
+
state: "Default content and accessible names"
|
|
9088
|
+
},
|
|
9089
|
+
{
|
|
9090
|
+
key: "description",
|
|
9091
|
+
type: "string",
|
|
9092
|
+
state: "Default content and accessible names"
|
|
9093
|
+
},
|
|
9094
|
+
{
|
|
9095
|
+
key: "name",
|
|
9096
|
+
type: "string",
|
|
9097
|
+
state: "Default content and accessible names"
|
|
9098
|
+
},
|
|
9099
|
+
{
|
|
9100
|
+
key: "namePlaceholder",
|
|
9101
|
+
type: "string",
|
|
9102
|
+
state: "Default content and accessible names"
|
|
9103
|
+
},
|
|
9104
|
+
{
|
|
9105
|
+
key: "nameRequired",
|
|
9106
|
+
type: "string",
|
|
9107
|
+
state: "Validation feedback"
|
|
9108
|
+
},
|
|
9109
|
+
{
|
|
9110
|
+
key: "scopes",
|
|
9111
|
+
type: "string",
|
|
9112
|
+
state: "Default content and accessible names"
|
|
9113
|
+
},
|
|
9114
|
+
{
|
|
9115
|
+
key: "scopesRequired",
|
|
9116
|
+
type: "string",
|
|
9117
|
+
state: "Validation feedback"
|
|
9118
|
+
},
|
|
9119
|
+
{
|
|
9120
|
+
key: "expiration",
|
|
9121
|
+
type: "string",
|
|
9122
|
+
state: "Default content and accessible names"
|
|
9123
|
+
},
|
|
9124
|
+
{
|
|
9125
|
+
key: "errorTitle",
|
|
9126
|
+
type: "string",
|
|
9127
|
+
state: "Validation feedback"
|
|
9128
|
+
},
|
|
9129
|
+
{
|
|
9130
|
+
key: "fallbackError",
|
|
9131
|
+
type: "string",
|
|
9132
|
+
state: "Validation feedback"
|
|
9133
|
+
},
|
|
9134
|
+
{
|
|
9135
|
+
key: "cancel",
|
|
9136
|
+
type: "string",
|
|
9137
|
+
state: "Default content and accessible names"
|
|
9138
|
+
},
|
|
9139
|
+
{
|
|
9140
|
+
key: "submit",
|
|
9141
|
+
type: "string",
|
|
9142
|
+
state: "Default content and accessible names"
|
|
9143
|
+
},
|
|
9144
|
+
{
|
|
9145
|
+
key: "successTitle",
|
|
9146
|
+
type: "string",
|
|
9147
|
+
state: "Async feedback"
|
|
9148
|
+
},
|
|
9149
|
+
{
|
|
9150
|
+
key: "successDescription",
|
|
9151
|
+
type: "string",
|
|
9152
|
+
state: "Async feedback"
|
|
9153
|
+
},
|
|
9154
|
+
{
|
|
9155
|
+
key: "warningTitle",
|
|
9156
|
+
type: "string",
|
|
9157
|
+
state: "Default content and accessible names"
|
|
9158
|
+
},
|
|
9159
|
+
{
|
|
9160
|
+
key: "warningDescription",
|
|
9161
|
+
type: "string",
|
|
9162
|
+
state: "Default content and accessible names"
|
|
9163
|
+
},
|
|
9164
|
+
{
|
|
9165
|
+
key: "secretLabel",
|
|
9166
|
+
type: "string",
|
|
9167
|
+
state: "Default content and accessible names"
|
|
9168
|
+
},
|
|
9169
|
+
{
|
|
9170
|
+
key: "done",
|
|
9171
|
+
type: "string",
|
|
9172
|
+
state: "Async feedback"
|
|
9173
|
+
}
|
|
9174
|
+
],
|
|
8048
9175
|
uses: [
|
|
8049
9176
|
"Dialog",
|
|
8050
9177
|
"Field",
|
|
@@ -8063,7 +9190,7 @@ const meta$12 = {
|
|
|
8063
9190
|
function SecretCopy({ secret, options, grouped = false, masked = true, warning }) {
|
|
8064
9191
|
const { t } = useI18n();
|
|
8065
9192
|
const [pending, setPending] = useState(false);
|
|
8066
|
-
const copied = options.copiedLabel ?? t("credentialDisclosure.copied");
|
|
9193
|
+
const copied = options.copiedLabel ?? options.labels?.copiedLabel ?? t("credentialDisclosure.copied");
|
|
8067
9194
|
const content = /* @__PURE__ */ jsxs(LiveAnnouncer, { children: [
|
|
8068
9195
|
warning,
|
|
8069
9196
|
/* @__PURE__ */ jsx("div", {
|
|
@@ -8072,8 +9199,8 @@ function SecretCopy({ secret, options, grouped = false, masked = true, warning }
|
|
|
8072
9199
|
value: secret.value,
|
|
8073
9200
|
copyable: false,
|
|
8074
9201
|
"aria-label": secret.label,
|
|
8075
|
-
showLabel: options.showLabel ?? t("credentialDisclosure.show"),
|
|
8076
|
-
hideLabel: options.hideLabel ?? t("credentialDisclosure.hide")
|
|
9202
|
+
showLabel: options.showLabel ?? options.labels?.showLabel ?? t("credentialDisclosure.show"),
|
|
9203
|
+
hideLabel: options.hideLabel ?? options.labels?.hideLabel ?? t("credentialDisclosure.hide")
|
|
8077
9204
|
}) : /* @__PURE__ */ jsx(CodeBlock, {
|
|
8078
9205
|
code: secret.value,
|
|
8079
9206
|
copyable: false,
|
|
@@ -8089,11 +9216,14 @@ function SecretCopy({ secret, options, grouped = false, masked = true, warning }
|
|
|
8089
9216
|
},
|
|
8090
9217
|
loading: grouped && pending,
|
|
8091
9218
|
display: "label",
|
|
8092
|
-
label: options.copyLabel ?? t("credentialDisclosure.copy"),
|
|
9219
|
+
label: options.copyLabel ?? options.labels?.copyLabel ?? t("credentialDisclosure.copy"),
|
|
8093
9220
|
copiedLabel: copied,
|
|
8094
|
-
announcement: grouped ? options.copiedAnnouncementFor?.(secret.label) ??
|
|
8095
|
-
|
|
8096
|
-
|
|
9221
|
+
announcement: grouped ? options.copiedAnnouncementFor?.(secret.label) ?? options.labels?.copiedAnnouncementFor?.(secret.label, copied) ?? t("credentialDisclosure.copiedFor", {
|
|
9222
|
+
label: secret.label,
|
|
9223
|
+
copied
|
|
9224
|
+
}) : options.successAnnouncement ?? options.labels?.successAnnouncement ?? t("credentialDisclosure.success"),
|
|
9225
|
+
failureLabel: options.failureAnnouncement ?? options.labels?.failureAnnouncement ?? t("credentialDisclosure.failure"),
|
|
9226
|
+
failureAnnouncement: options.failureAnnouncement ?? options.labels?.failureAnnouncement ?? t("credentialDisclosure.failure"),
|
|
8097
9227
|
failurePoliteness: "polite",
|
|
8098
9228
|
onCopy: () => {
|
|
8099
9229
|
if (grouped) setPending(false);
|
|
@@ -8227,15 +9357,15 @@ function DisclosureSession(props) {
|
|
|
8227
9357
|
setOpen(false);
|
|
8228
9358
|
props.onClose();
|
|
8229
9359
|
};
|
|
8230
|
-
const closeLabel = props.closeLabel ?? t("credentialDisclosure.close");
|
|
8231
|
-
const title = props.title ?? t("credentialDisclosure.title");
|
|
8232
|
-
const description = props.description ?? t("credentialDisclosure.description");
|
|
8233
|
-
const secretLabel = props.secretLabel ?? t("credentialDisclosure.secret");
|
|
9360
|
+
const closeLabel = props.closeLabel ?? props.labels?.closeLabel ?? t("credentialDisclosure.close");
|
|
9361
|
+
const title = props.title ?? props.labels?.title ?? t("credentialDisclosure.title");
|
|
9362
|
+
const description = props.description ?? props.labels?.description ?? t("credentialDisclosure.description");
|
|
9363
|
+
const secretLabel = props.secretLabel ?? props.labels?.secretLabel ?? t("credentialDisclosure.secret");
|
|
8234
9364
|
const warning = disclosure.variant === "fresh" ? /* @__PURE__ */ jsx(Alert, {
|
|
8235
9365
|
role: presentation === "inline" ? "note" : "alert",
|
|
8236
9366
|
tone: "warning",
|
|
8237
|
-
title: props.warningTitle ?? t("credentialDisclosure.warningTitle"),
|
|
8238
|
-
description: props.warningText ?? t("credentialDisclosure.warningText")
|
|
9367
|
+
title: props.warningTitle ?? props.labels?.warningTitle ?? t("credentialDisclosure.warningTitle"),
|
|
9368
|
+
description: props.warningText ?? props.labels?.warningText ?? t("credentialDisclosure.warningText")
|
|
8239
9369
|
}) : null;
|
|
8240
9370
|
const body = /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
8241
9371
|
/* @__PURE__ */ jsxs("dl", {
|
|
@@ -8243,7 +9373,7 @@ function DisclosureSession(props) {
|
|
|
8243
9373
|
children: [
|
|
8244
9374
|
/* @__PURE__ */ jsx("dt", {
|
|
8245
9375
|
className: "text-muted-foreground",
|
|
8246
|
-
children: props.credentialIdLabel ?? t("credentialDisclosure.credentialId")
|
|
9376
|
+
children: props.credentialIdLabel ?? props.labels?.credentialIdLabel ?? t("credentialDisclosure.credentialId")
|
|
8247
9377
|
}),
|
|
8248
9378
|
/* @__PURE__ */ jsx("dd", {
|
|
8249
9379
|
className: "break-all font-mono",
|
|
@@ -8251,7 +9381,7 @@ function DisclosureSession(props) {
|
|
|
8251
9381
|
}),
|
|
8252
9382
|
/* @__PURE__ */ jsx("dt", {
|
|
8253
9383
|
className: "text-muted-foreground",
|
|
8254
|
-
children: props.expiryLabel ?? t("credentialDisclosure.expiry")
|
|
9384
|
+
children: props.expiryLabel ?? props.labels?.expiryLabel ?? t("credentialDisclosure.expiry")
|
|
8255
9385
|
}),
|
|
8256
9386
|
/* @__PURE__ */ jsx("dd", { children: disclosure.expiresAt })
|
|
8257
9387
|
]
|
|
@@ -8331,7 +9461,84 @@ const meta$13 = {
|
|
|
8331
9461
|
name: "Credential disclosure dialog",
|
|
8332
9462
|
family: "forms",
|
|
8333
9463
|
status: "beta",
|
|
8334
|
-
description: "Controlled disclosure for an existing credential. Set disclosure ({variant: stored | fresh, credentialId, expiresAt: caller-formatted ReactNode, secret}) only after a successful response; null renders nothing while pending or on failure. Clear disclosure, additionalSecrets and secret-bearing revealContent in onClose to drop every secret; a fresh secret requires a new successful response before showing it again. No pending/error state or internal secret retention. Stored values start masked; each null-to-value opening or changed credentialId/secret resets masking and copy feedback. Fresh values use a non-copyable CodeBlock with a kit CopyButton and a replacement warning, or a masked SecretField when maskFresh is set at session start. Optional additionalSecrets ({id, label, value}) are always masked and use independent toggles and serialized copy actions; ids must be non-empty, unique and not secret, with the first duplicate winning. Multi-secret groups announce label plus copiedLabel, or copiedAnnouncementFor(label); onCopy(id) never receives a value. Every secret and the optional revealContent slot have data-kit-redact. The session key includes additional ids and values. presentation is dialog by default or inline, fixed until the next opening: inline is a named section, never traps focus or handles Escape, and its warning is a non-live note. Surviving focus stays; removing the focused slot or session control focuses the popup or inline heading. Focused inline unmounts return focus through the same resolvers. Dismissed retained props stay hidden; clear and re-set or change a session value to reopen. Optional English defaults through en/es i18n for title, description, credentialIdLabel, expiryLabel, secretLabel, showLabel, hideLabel, copyLabel, copiedLabel, successAnnouncement, failureAnnouncement, warningTitle, warningText and closeLabel. Copy results are announced politely, including manual-selection fallback. Popup initial focus and focus trapping use Base UI; at close, resolveReturnFocus() is validated for connection, visibility, enabled state and focusability, then fallbackFocus(), then the original opener. Synthetic fixtures only; the default Stored preview is masked and the Fresh preview starts closed.",
|
|
9464
|
+
description: "Controlled disclosure for an existing credential. Set disclosure ({variant: stored | fresh, credentialId, expiresAt: caller-formatted ReactNode, secret}) only after a successful response; null renders nothing while pending or on failure. Clear disclosure, additionalSecrets and secret-bearing revealContent in onClose to drop every secret; a fresh secret requires a new successful response before showing it again. No pending/error state or internal secret retention. Stored values start masked; each null-to-value opening or changed credentialId/secret resets masking and copy feedback. Fresh values use a non-copyable CodeBlock with a kit CopyButton and a replacement warning, or a masked SecretField when maskFresh is set at session start. Optional additionalSecrets ({id, label, value}) are always masked and use independent toggles and serialized copy actions; ids must be non-empty, unique and not secret, with the first duplicate winning. Multi-secret groups announce label plus copiedLabel, or copiedAnnouncementFor(label); onCopy(id) never receives a value. Every secret and the optional revealContent slot have data-kit-redact. The session key includes additional ids and values. presentation is dialog by default or inline, fixed until the next opening: inline is a named section, never traps focus or handles Escape, and its warning is a non-live note. Surviving focus stays; removing the focused slot or session control focuses the popup or inline heading. Focused inline unmounts return focus through the same resolvers. Dismissed retained props stay hidden; clear and re-set or change a session value to reopen. Optional English defaults through en/es i18n for title, description, credentialIdLabel, expiryLabel, secretLabel, showLabel, hideLabel, copyLabel, copiedLabel, successAnnouncement, failureAnnouncement, warningTitle, warningText and closeLabel. Copy results are announced politely, including manual-selection fallback. Popup initial focus and focus trapping use Base UI; at close, resolveReturnFocus() is validated for connection, visibility, enabled state and focusability, then fallbackFocus(), then the original opener. Synthetic fixtures only; the default Stored preview is masked and the Fresh preview starts closed. Optional labels?: Partial<CredentialDisclosureDialogLabels> overrides built-in copy; explicit props and validation messages win, then labels, then I18nProvider (en/es). No provider preserves English; fixtures and caller content stay unchanged. Interactive preview: /preview.html?kind=block&id=credential-disclosure-dialog--labels.",
|
|
9465
|
+
labels: [
|
|
9466
|
+
{
|
|
9467
|
+
key: "title",
|
|
9468
|
+
type: "string",
|
|
9469
|
+
state: "Default content and accessible names"
|
|
9470
|
+
},
|
|
9471
|
+
{
|
|
9472
|
+
key: "description",
|
|
9473
|
+
type: "string",
|
|
9474
|
+
state: "Default content and accessible names"
|
|
9475
|
+
},
|
|
9476
|
+
{
|
|
9477
|
+
key: "credentialIdLabel",
|
|
9478
|
+
type: "string",
|
|
9479
|
+
state: "Default content and accessible names"
|
|
9480
|
+
},
|
|
9481
|
+
{
|
|
9482
|
+
key: "expiryLabel",
|
|
9483
|
+
type: "string",
|
|
9484
|
+
state: "Default content and accessible names"
|
|
9485
|
+
},
|
|
9486
|
+
{
|
|
9487
|
+
key: "secretLabel",
|
|
9488
|
+
type: "string",
|
|
9489
|
+
state: "Default content and accessible names"
|
|
9490
|
+
},
|
|
9491
|
+
{
|
|
9492
|
+
key: "showLabel",
|
|
9493
|
+
type: "string",
|
|
9494
|
+
state: "Default content and accessible names"
|
|
9495
|
+
},
|
|
9496
|
+
{
|
|
9497
|
+
key: "hideLabel",
|
|
9498
|
+
type: "string",
|
|
9499
|
+
state: "Default content and accessible names"
|
|
9500
|
+
},
|
|
9501
|
+
{
|
|
9502
|
+
key: "copyLabel",
|
|
9503
|
+
type: "string",
|
|
9504
|
+
state: "Default content and accessible names"
|
|
9505
|
+
},
|
|
9506
|
+
{
|
|
9507
|
+
key: "copiedLabel",
|
|
9508
|
+
type: "string",
|
|
9509
|
+
state: "Async feedback"
|
|
9510
|
+
},
|
|
9511
|
+
{
|
|
9512
|
+
key: "successAnnouncement",
|
|
9513
|
+
type: "string",
|
|
9514
|
+
state: "Async feedback"
|
|
9515
|
+
},
|
|
9516
|
+
{
|
|
9517
|
+
key: "failureAnnouncement",
|
|
9518
|
+
type: "string",
|
|
9519
|
+
state: "Async feedback"
|
|
9520
|
+
},
|
|
9521
|
+
{
|
|
9522
|
+
key: "warningTitle",
|
|
9523
|
+
type: "string",
|
|
9524
|
+
state: "Default content and accessible names"
|
|
9525
|
+
},
|
|
9526
|
+
{
|
|
9527
|
+
key: "warningText",
|
|
9528
|
+
type: "string",
|
|
9529
|
+
state: "Default content and accessible names"
|
|
9530
|
+
},
|
|
9531
|
+
{
|
|
9532
|
+
key: "closeLabel",
|
|
9533
|
+
type: "string",
|
|
9534
|
+
state: "Default content and accessible names"
|
|
9535
|
+
},
|
|
9536
|
+
{
|
|
9537
|
+
key: "copiedAnnouncementFor",
|
|
9538
|
+
type: "(label: string, copied: string) => string",
|
|
9539
|
+
state: "Async feedback"
|
|
9540
|
+
}
|
|
9541
|
+
],
|
|
8335
9542
|
uses: [
|
|
8336
9543
|
"Dialog",
|
|
8337
9544
|
"SecretField",
|
|
@@ -8353,10 +9560,10 @@ const SHORT = {
|
|
|
8353
9560
|
day: "numeric"
|
|
8354
9561
|
};
|
|
8355
9562
|
/** Compact DateRangePicker for toolbars: small trigger, short dates, presets and a clear button. */
|
|
8356
|
-
function DateRangeFilter({ value, defaultValue, onValueChange, presets = DEFAULT_DATE_RANGE_PRESETS, today, label: labelProp, placeholder: placeholderProp, clearable = true, disabled, className }) {
|
|
9563
|
+
function DateRangeFilter({ labels, value, defaultValue, onValueChange, presets = DEFAULT_DATE_RANGE_PRESETS, today, label: labelProp, placeholder: placeholderProp, clearable = true, disabled, className }) {
|
|
8357
9564
|
const { t } = useI18n();
|
|
8358
|
-
const label = labelProp ?? t("dateRange.label");
|
|
8359
|
-
const placeholder = placeholderProp ?? t("dateRange.any");
|
|
9565
|
+
const label = labelProp ?? labels?.label ?? t("dateRange.label");
|
|
9566
|
+
const placeholder = placeholderProp ?? labels?.placeholder ?? t("dateRange.any");
|
|
8360
9567
|
const [inner, setInner] = useState(() => defaultValue ?? presets.find((p) => p.id === "last-7")?.range?.(today ?? /* @__PURE__ */ new Date()) ?? EMPTY);
|
|
8361
9568
|
const range = value ?? inner;
|
|
8362
9569
|
const set = (next) => {
|
|
@@ -8379,7 +9586,7 @@ function DateRangeFilter({ value, defaultValue, onValueChange, presets = DEFAULT
|
|
|
8379
9586
|
}), clearable && range.start && /* @__PURE__ */ jsx(IconButton, {
|
|
8380
9587
|
icon: X,
|
|
8381
9588
|
size: "sm",
|
|
8382
|
-
label: t("common.clearItem", { label: label.toLowerCase() }),
|
|
9589
|
+
label: labels?.clear?.(label.toLowerCase()) ?? t("common.clearItem", { label: label.toLowerCase() }),
|
|
8383
9590
|
disabled,
|
|
8384
9591
|
onClick: () => set(EMPTY)
|
|
8385
9592
|
})]
|
|
@@ -8391,7 +9598,24 @@ const meta$17 = {
|
|
|
8391
9598
|
name: "Date range filter",
|
|
8392
9599
|
family: "forms",
|
|
8393
9600
|
status: "stable",
|
|
8394
|
-
description: "Compact date range picker for toolbars: small trigger with short dates, presets and a clear button.",
|
|
9601
|
+
description: "Compact date range picker for toolbars: small trigger with short dates, presets and a clear button. Optional labels?: Partial<DateRangeFilterLabels> overrides built-in copy; explicit props and validation messages win, then labels, then I18nProvider (en/es). No provider preserves English; fixtures and caller content stay unchanged. Interactive preview: /preview.html?kind=block&id=date-range-filter--labels.",
|
|
9602
|
+
labels: [
|
|
9603
|
+
{
|
|
9604
|
+
key: "label",
|
|
9605
|
+
type: "string",
|
|
9606
|
+
state: "Default content and accessible names"
|
|
9607
|
+
},
|
|
9608
|
+
{
|
|
9609
|
+
key: "placeholder",
|
|
9610
|
+
type: "string",
|
|
9611
|
+
state: "Default content and accessible names"
|
|
9612
|
+
},
|
|
9613
|
+
{
|
|
9614
|
+
key: "clear",
|
|
9615
|
+
type: "(label: string) => string",
|
|
9616
|
+
state: "Default content and accessible names"
|
|
9617
|
+
}
|
|
9618
|
+
],
|
|
8395
9619
|
uses: ["DateRangePicker", "IconButton"]
|
|
8396
9620
|
};
|
|
8397
9621
|
//#endregion
|
|
@@ -8433,22 +9657,6 @@ function simulateUpload(_file, onProgress) {
|
|
|
8433
9657
|
setTimeout(step, 250);
|
|
8434
9658
|
});
|
|
8435
9659
|
}
|
|
8436
|
-
function formatBytes(bytes) {
|
|
8437
|
-
if (bytes < 1024) return `${bytes} B`;
|
|
8438
|
-
const units = [
|
|
8439
|
-
"KB",
|
|
8440
|
-
"MB",
|
|
8441
|
-
"GB",
|
|
8442
|
-
"TB"
|
|
8443
|
-
];
|
|
8444
|
-
let v = bytes / 1024;
|
|
8445
|
-
let i = 0;
|
|
8446
|
-
while (v >= 1024 && i < units.length - 1) {
|
|
8447
|
-
v /= 1024;
|
|
8448
|
-
i++;
|
|
8449
|
-
}
|
|
8450
|
-
return `${v >= 10 ? Math.round(v) : v.toFixed(1)} ${units[i]}`;
|
|
8451
|
-
}
|
|
8452
9660
|
/** Matches a file against an `accept` list (".csv", "image/*", "application/pdf"). */
|
|
8453
9661
|
function acceptsFile(file, accept) {
|
|
8454
9662
|
if (!accept) return true;
|
|
@@ -8464,16 +9672,16 @@ const nextId = () => `upload-${++uid}`;
|
|
|
8464
9672
|
* Drop zone with a Browse button, accept and size validation, and a file list with progress,
|
|
8465
9673
|
* retry and remove. Rejected files stay in the list with the reason.
|
|
8466
9674
|
*/
|
|
8467
|
-
function FileUploadPanel({ accept = ".csv,.json,.jsonl,.yaml,.pdf", maxSize =
|
|
8468
|
-
const { t } = useI18n();
|
|
8469
|
-
const label = labelProp ?? t("upload.label");
|
|
9675
|
+
function FileUploadPanel({ labels, accept = ".csv,.json,.jsonl,.yaml,.pdf", maxSize = 25e6, multiple = true, defaultFiles = uploadItems, onUpload = simulateUpload, onRemove, label: labelProp, hint, disabled = false, className }) {
|
|
9676
|
+
const { t, formatBytes } = useI18n();
|
|
9677
|
+
const label = labelProp ?? labels?.label ?? t("upload.label");
|
|
8470
9678
|
const id = useId();
|
|
8471
9679
|
const inputRef = useRef(null);
|
|
8472
9680
|
const [sources, setSources] = useState({});
|
|
8473
9681
|
const [items, setItems] = useState(defaultFiles);
|
|
8474
9682
|
const [dragging, setDragging] = useState(false);
|
|
8475
9683
|
const [announcement, setAnnouncement] = useState("");
|
|
8476
|
-
const hintText = hint ?? t("upload.hint", {
|
|
9684
|
+
const hintText = hint ?? labels?.hint?.(accept.split(",").map((a) => a.replace(".", "").toUpperCase()).join(" · "), formatBytes(maxSize)) ?? t("upload.hint", {
|
|
8477
9685
|
types: accept.split(",").map((a) => a.replace(".", "").toUpperCase()).join(" · "),
|
|
8478
9686
|
size: formatBytes(maxSize)
|
|
8479
9687
|
});
|
|
@@ -8492,13 +9700,13 @@ function FileUploadPanel({ accept = ".csv,.json,.jsonl,.yaml,.pdf", maxSize = 26
|
|
|
8492
9700
|
status: "done",
|
|
8493
9701
|
progress: 100
|
|
8494
9702
|
});
|
|
8495
|
-
setAnnouncement(t("upload.done", { name: file.name }));
|
|
9703
|
+
setAnnouncement(labels?.done?.(file.name) ?? t("upload.done", { name: file.name }));
|
|
8496
9704
|
}, (e) => {
|
|
8497
9705
|
patch(itemId, {
|
|
8498
9706
|
status: "error",
|
|
8499
|
-
error: e instanceof Error ? e.message : t("upload.failed")
|
|
9707
|
+
error: e instanceof Error ? e.message : labels?.failed ?? t("upload.failed")
|
|
8500
9708
|
});
|
|
8501
|
-
setAnnouncement(t("upload.error", { name: file.name }));
|
|
9709
|
+
setAnnouncement(labels?.error?.(file.name) ?? t("upload.error", { name: file.name }));
|
|
8502
9710
|
});
|
|
8503
9711
|
};
|
|
8504
9712
|
const addFiles = (list) => {
|
|
@@ -8508,7 +9716,7 @@ function FileUploadPanel({ accept = ".csv,.json,.jsonl,.yaml,.pdf", maxSize = 26
|
|
|
8508
9716
|
const kept = {};
|
|
8509
9717
|
for (const file of files) {
|
|
8510
9718
|
const itemId = nextId();
|
|
8511
|
-
const error = !acceptsFile(file, accept) ? t("upload.typeRejected") : file.size > maxSize ? t("upload.tooLarge", { size: formatBytes(maxSize) }) : void 0;
|
|
9719
|
+
const error = !acceptsFile(file, accept) ? labels?.typeRejected ?? t("upload.typeRejected") : file.size > maxSize ? labels?.tooLarge?.(formatBytes(maxSize)) ?? t("upload.tooLarge", { size: formatBytes(maxSize) }) : void 0;
|
|
8512
9720
|
added.push({
|
|
8513
9721
|
id: itemId,
|
|
8514
9722
|
name: file.name,
|
|
@@ -8528,13 +9736,13 @@ function FileUploadPanel({ accept = ".csv,.json,.jsonl,.yaml,.pdf", maxSize = 26
|
|
|
8528
9736
|
...kept
|
|
8529
9737
|
}));
|
|
8530
9738
|
const rejected = added.filter((a) => a.error).length;
|
|
8531
|
-
setAnnouncement([t("upload.added", { count: added.length - rejected }), rejected ? t("upload.rejected", { count: rejected }) : ""].filter(Boolean).join(" "));
|
|
9739
|
+
setAnnouncement([labels?.added?.(added.length - rejected) ?? t("upload.added", { count: added.length - rejected }), rejected ? labels?.rejected?.(rejected) ?? t("upload.rejected", { count: rejected }) : ""].filter(Boolean).join(" "));
|
|
8532
9740
|
for (const [itemId, file] of toStart) start(itemId, file);
|
|
8533
9741
|
};
|
|
8534
9742
|
const remove = (item) => {
|
|
8535
9743
|
setSources((current) => Object.fromEntries(Object.entries(current).filter(([k]) => k !== item.id)));
|
|
8536
9744
|
setItems((list) => list.filter((x) => x.id !== item.id));
|
|
8537
|
-
setAnnouncement(t("upload.removed", { name: item.name }));
|
|
9745
|
+
setAnnouncement(labels?.removed?.(item.name) ?? t("upload.removed", { name: item.name }));
|
|
8538
9746
|
onRemove?.(item);
|
|
8539
9747
|
};
|
|
8540
9748
|
const retryFor = (itemId) => {
|
|
@@ -8576,7 +9784,7 @@ function FileUploadPanel({ accept = ".csv,.json,.jsonl,.yaml,.pdf", maxSize = 26
|
|
|
8576
9784
|
}),
|
|
8577
9785
|
/* @__PURE__ */ jsx("p", {
|
|
8578
9786
|
className: "mt-4 text-[13.5px] text-foreground",
|
|
8579
|
-
children: t("upload.drop")
|
|
9787
|
+
children: labels?.drop ?? t("upload.drop")
|
|
8580
9788
|
}),
|
|
8581
9789
|
/* @__PURE__ */ jsx(Button, {
|
|
8582
9790
|
variant: "secondary",
|
|
@@ -8585,7 +9793,7 @@ function FileUploadPanel({ accept = ".csv,.json,.jsonl,.yaml,.pdf", maxSize = 26
|
|
|
8585
9793
|
disabled,
|
|
8586
9794
|
onClick: () => inputRef.current?.click(),
|
|
8587
9795
|
"aria-describedby": `${id}-hint`,
|
|
8588
|
-
children: t("upload.browse")
|
|
9796
|
+
children: labels?.browse ?? t("upload.browse")
|
|
8589
9797
|
}),
|
|
8590
9798
|
/* @__PURE__ */ jsx("p", {
|
|
8591
9799
|
id: `${id}-hint`,
|
|
@@ -8607,9 +9815,10 @@ function FileUploadPanel({ accept = ".csv,.json,.jsonl,.yaml,.pdf", maxSize = 26
|
|
|
8607
9815
|
]
|
|
8608
9816
|
}),
|
|
8609
9817
|
items.length > 0 && /* @__PURE__ */ jsx("ul", {
|
|
8610
|
-
"aria-label": t("upload.files"),
|
|
9818
|
+
"aria-label": labels?.files ?? t("upload.files"),
|
|
8611
9819
|
className: "mt-4 space-y-2",
|
|
8612
9820
|
children: items.map((item) => /* @__PURE__ */ jsx(FileRow, {
|
|
9821
|
+
labels,
|
|
8613
9822
|
item,
|
|
8614
9823
|
onRemove: () => remove(item),
|
|
8615
9824
|
onRetry: retryFor(item.id)
|
|
@@ -8623,8 +9832,8 @@ function FileUploadPanel({ accept = ".csv,.json,.jsonl,.yaml,.pdf", maxSize = 26
|
|
|
8623
9832
|
]
|
|
8624
9833
|
});
|
|
8625
9834
|
}
|
|
8626
|
-
function FileRow({ item, onRemove, onRetry }) {
|
|
8627
|
-
const { t } = useI18n();
|
|
9835
|
+
function FileRow({ item, onRemove, onRetry, labels }) {
|
|
9836
|
+
const { t, formatBytes } = useI18n();
|
|
8628
9837
|
const err = item.status === "error";
|
|
8629
9838
|
const done = item.status === "done";
|
|
8630
9839
|
return /* @__PURE__ */ jsxs("li", {
|
|
@@ -8648,11 +9857,11 @@ function FileRow({ item, onRemove, onRetry }) {
|
|
|
8648
9857
|
}), item.status === "uploading" ? /* @__PURE__ */ jsx(Progress, {
|
|
8649
9858
|
value: item.progress,
|
|
8650
9859
|
size: "sm",
|
|
8651
|
-
"aria-label": t("upload.uploading", { name: item.name }),
|
|
9860
|
+
"aria-label": labels?.uploading?.(item.name) ?? t("upload.uploading", { name: item.name }),
|
|
8652
9861
|
className: "mt-1.5"
|
|
8653
9862
|
}) : /* @__PURE__ */ jsx("div", {
|
|
8654
9863
|
className: cn("mt-0.5 font-mono text-[11px]", err ? "text-destructive-text" : "text-muted-foreground"),
|
|
8655
|
-
children: err ? t("upload.notUploaded", { error: item.error ?? t("upload.failed") }) : t("upload.uploaded", { size: formatBytes(item.size) })
|
|
9864
|
+
children: err ? labels?.notUploaded?.(item.error ?? labels?.failed ?? t("upload.failed")) ?? t("upload.notUploaded", { error: item.error ?? labels?.failed ?? t("upload.failed") }) : labels?.uploaded?.(formatBytes(item.size)) ?? t("upload.uploaded", { size: formatBytes(item.size) })
|
|
8656
9865
|
})]
|
|
8657
9866
|
}),
|
|
8658
9867
|
item.status === "uploading" && /* @__PURE__ */ jsxs("span", {
|
|
@@ -8662,13 +9871,13 @@ function FileRow({ item, onRemove, onRetry }) {
|
|
|
8662
9871
|
err && onRetry && /* @__PURE__ */ jsx(IconButton, {
|
|
8663
9872
|
icon: RotateCcw,
|
|
8664
9873
|
size: "sm",
|
|
8665
|
-
label: t("upload.retry", { name: item.name }),
|
|
9874
|
+
label: labels?.retry?.(item.name) ?? t("upload.retry", { name: item.name }),
|
|
8666
9875
|
onClick: onRetry
|
|
8667
9876
|
}),
|
|
8668
9877
|
/* @__PURE__ */ jsx(IconButton, {
|
|
8669
9878
|
icon: X,
|
|
8670
9879
|
size: "sm",
|
|
8671
|
-
label: t("common.removeItem", { label: item.name }),
|
|
9880
|
+
label: labels?.remove?.(item.name) ?? t("common.removeItem", { label: item.name }),
|
|
8672
9881
|
onClick: onRemove
|
|
8673
9882
|
})
|
|
8674
9883
|
]
|
|
@@ -8680,7 +9889,99 @@ const meta$26 = {
|
|
|
8680
9889
|
name: "File upload panel",
|
|
8681
9890
|
family: "forms",
|
|
8682
9891
|
status: "stable",
|
|
8683
|
-
description: "Drag-and-drop zone with a Browse button, type and size validation, and a file list with progress, retry and remove.",
|
|
9892
|
+
description: "Drag-and-drop zone with a Browse button, type and size validation, and a file list with progress, retry and remove. Optional labels?: Partial<FileUploadPanelLabels> overrides built-in copy; explicit props and validation messages win, then labels, then I18nProvider (en/es). No provider preserves English; fixtures and caller content stay unchanged. Interactive preview: /preview.html?kind=block&id=file-upload-panel--labels.",
|
|
9893
|
+
labels: [
|
|
9894
|
+
{
|
|
9895
|
+
key: "label",
|
|
9896
|
+
type: "string",
|
|
9897
|
+
state: "Default content and accessible names"
|
|
9898
|
+
},
|
|
9899
|
+
{
|
|
9900
|
+
key: "drop",
|
|
9901
|
+
type: "string",
|
|
9902
|
+
state: "Default content and accessible names"
|
|
9903
|
+
},
|
|
9904
|
+
{
|
|
9905
|
+
key: "browse",
|
|
9906
|
+
type: "string",
|
|
9907
|
+
state: "Default content and accessible names"
|
|
9908
|
+
},
|
|
9909
|
+
{
|
|
9910
|
+
key: "files",
|
|
9911
|
+
type: "string",
|
|
9912
|
+
state: "Default content and accessible names"
|
|
9913
|
+
},
|
|
9914
|
+
{
|
|
9915
|
+
key: "failed",
|
|
9916
|
+
type: "string",
|
|
9917
|
+
state: "Default content and accessible names"
|
|
9918
|
+
},
|
|
9919
|
+
{
|
|
9920
|
+
key: "typeRejected",
|
|
9921
|
+
type: "string",
|
|
9922
|
+
state: "Default content and accessible names"
|
|
9923
|
+
},
|
|
9924
|
+
{
|
|
9925
|
+
key: "hint",
|
|
9926
|
+
type: "(types: string, size: string) => string",
|
|
9927
|
+
state: "Default content and accessible names"
|
|
9928
|
+
},
|
|
9929
|
+
{
|
|
9930
|
+
key: "tooLarge",
|
|
9931
|
+
type: "(size: string) => string",
|
|
9932
|
+
state: "Default content and accessible names"
|
|
9933
|
+
},
|
|
9934
|
+
{
|
|
9935
|
+
key: "done",
|
|
9936
|
+
type: "(name: string) => string",
|
|
9937
|
+
state: "Async feedback"
|
|
9938
|
+
},
|
|
9939
|
+
{
|
|
9940
|
+
key: "error",
|
|
9941
|
+
type: "(name: string) => string",
|
|
9942
|
+
state: "Validation feedback"
|
|
9943
|
+
},
|
|
9944
|
+
{
|
|
9945
|
+
key: "added",
|
|
9946
|
+
type: "(count: number) => string",
|
|
9947
|
+
state: "Default content and accessible names"
|
|
9948
|
+
},
|
|
9949
|
+
{
|
|
9950
|
+
key: "rejected",
|
|
9951
|
+
type: "(count: number) => string",
|
|
9952
|
+
state: "Default content and accessible names"
|
|
9953
|
+
},
|
|
9954
|
+
{
|
|
9955
|
+
key: "removed",
|
|
9956
|
+
type: "(name: string) => string",
|
|
9957
|
+
state: "Default content and accessible names"
|
|
9958
|
+
},
|
|
9959
|
+
{
|
|
9960
|
+
key: "uploading",
|
|
9961
|
+
type: "(name: string) => string",
|
|
9962
|
+
state: "Async feedback"
|
|
9963
|
+
},
|
|
9964
|
+
{
|
|
9965
|
+
key: "notUploaded",
|
|
9966
|
+
type: "(error: string) => string",
|
|
9967
|
+
state: "Async feedback"
|
|
9968
|
+
},
|
|
9969
|
+
{
|
|
9970
|
+
key: "uploaded",
|
|
9971
|
+
type: "(size: string) => string",
|
|
9972
|
+
state: "Async feedback"
|
|
9973
|
+
},
|
|
9974
|
+
{
|
|
9975
|
+
key: "retry",
|
|
9976
|
+
type: "(name: string) => string",
|
|
9977
|
+
state: "Default content and accessible names"
|
|
9978
|
+
},
|
|
9979
|
+
{
|
|
9980
|
+
key: "remove",
|
|
9981
|
+
type: "(name: string) => string",
|
|
9982
|
+
state: "Default content and accessible names"
|
|
9983
|
+
}
|
|
9984
|
+
],
|
|
8684
9985
|
uses: [
|
|
8685
9986
|
"Button",
|
|
8686
9987
|
"IconButton",
|
|
@@ -8712,7 +10013,10 @@ function SampleFields() {
|
|
|
8712
10013
|
* Two-column form section: title and help on the left, fields on the right. Stacks into a
|
|
8713
10014
|
* single column on small screens.
|
|
8714
10015
|
*/
|
|
8715
|
-
function FormSection({ title
|
|
10016
|
+
function FormSection({ labels, title: titleProp, description: descriptionProp, children, actions, headingLevel: Heading = "h2", divided = false, className, ...props }) {
|
|
10017
|
+
const { t } = useI18n();
|
|
10018
|
+
const title = titleProp === void 0 ? labels?.title ?? t("formSection.title") : titleProp;
|
|
10019
|
+
const description = descriptionProp === void 0 ? labels?.description ?? t("formSection.description") : descriptionProp;
|
|
8716
10020
|
const id = useId();
|
|
8717
10021
|
return /* @__PURE__ */ jsxs("section", {
|
|
8718
10022
|
"aria-labelledby": title != null ? `${id}-title` : void 0,
|
|
@@ -8743,7 +10047,16 @@ const meta$30 = {
|
|
|
8743
10047
|
name: "Form section",
|
|
8744
10048
|
family: "forms",
|
|
8745
10049
|
status: "stable",
|
|
8746
|
-
description: "Two-column settings section: title and help on the left, fields on the right; stacks on small screens.",
|
|
10050
|
+
description: "Two-column settings section: title and help on the left, fields on the right; stacks on small screens. Optional labels?: Partial<FormSectionLabels> overrides built-in copy; explicit props and validation messages win, then labels, then I18nProvider (en/es). No provider preserves English; fixtures and caller content stay unchanged. Interactive preview: /preview.html?kind=block&id=form-section--labels.",
|
|
10051
|
+
labels: [{
|
|
10052
|
+
key: "title",
|
|
10053
|
+
type: "string",
|
|
10054
|
+
state: "Default content and accessible names"
|
|
10055
|
+
}, {
|
|
10056
|
+
key: "description",
|
|
10057
|
+
type: "string",
|
|
10058
|
+
state: "Default content and accessible names"
|
|
10059
|
+
}],
|
|
8747
10060
|
uses: [
|
|
8748
10061
|
"Field",
|
|
8749
10062
|
"Input",
|
|
@@ -8777,9 +10090,12 @@ const memberRoles = [
|
|
|
8777
10090
|
const EMAIL_RE = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
8778
10091
|
//#endregion
|
|
8779
10092
|
//#region src/forms/InviteMembersDialog/InviteMembersDialog.tsx
|
|
8780
|
-
const emailError = (t) => EMAIL_RE.test(t) ? null : `${t} is not a valid email address`;
|
|
8781
10093
|
/** Invite dialog: email chips with validation, a role and an optional message; submit with loading. */
|
|
8782
|
-
function InviteMembersDialog({ roles = memberRoles, defaultRole = "member", onInvite, maxInvites = 20, open: openProp, defaultOpen = false, onOpenChange, trigger = /* @__PURE__ */ jsx(Button, { icon: UserPlus }), title
|
|
10094
|
+
function InviteMembersDialog({ labels, roles = memberRoles, defaultRole = "member", onInvite, maxInvites = 20, open: openProp, defaultOpen = false, onOpenChange, trigger = /* @__PURE__ */ jsx(Button, { icon: UserPlus }), title: titleProp, description: descriptionProp }) {
|
|
10095
|
+
const { t } = useI18n();
|
|
10096
|
+
const title = titleProp ?? labels?.title ?? t("inviteMembers.title");
|
|
10097
|
+
const description = descriptionProp ?? labels?.description ?? t("inviteMembers.description");
|
|
10098
|
+
const emailError = (email) => EMAIL_RE.test(email) ? null : labels?.emailInvalid?.(email) ?? t("inviteMembers.emailInvalid", { email });
|
|
8783
10099
|
const [innerOpen, setInnerOpen] = useState(defaultOpen);
|
|
8784
10100
|
const [emails, setEmails] = useState([]);
|
|
8785
10101
|
const [role, setRole] = useState(defaultRole);
|
|
@@ -8789,7 +10105,7 @@ function InviteMembersDialog({ roles = memberRoles, defaultRole = "member", onIn
|
|
|
8789
10105
|
const [error, setError] = useState(null);
|
|
8790
10106
|
const open = openProp ?? innerOpen;
|
|
8791
10107
|
const invalidCount = emails.filter((e) => emailError(e)).length;
|
|
8792
|
-
const emailsProblem = emails.length === 0 ?
|
|
10108
|
+
const emailsProblem = emails.length === 0 ? labels?.emailRequired ?? t("inviteMembers.emailRequired") : invalidCount > 0 ? labels?.fixInvalid?.(invalidCount) ?? t("inviteMembers.fixInvalid", { count: invalidCount }) : null;
|
|
8793
10109
|
const showEmailError = submitted && emailsProblem != null;
|
|
8794
10110
|
const setOpen = (next) => {
|
|
8795
10111
|
if (loading && !next) return;
|
|
@@ -8818,7 +10134,7 @@ function InviteMembersDialog({ roles = memberRoles, defaultRole = "member", onIn
|
|
|
8818
10134
|
setOpen(false);
|
|
8819
10135
|
} catch (e) {
|
|
8820
10136
|
setLoading(false);
|
|
8821
|
-
setError(e instanceof Error ? e.message :
|
|
10137
|
+
setError(e instanceof Error ? e.message : labels?.fallbackError ?? t("inviteMembers.fallbackError"));
|
|
8822
10138
|
}
|
|
8823
10139
|
};
|
|
8824
10140
|
const roleLabel = roles.find((r) => r.value === role)?.description;
|
|
@@ -8844,15 +10160,15 @@ function InviteMembersDialog({ roles = memberRoles, defaultRole = "member", onIn
|
|
|
8844
10160
|
children: [
|
|
8845
10161
|
/* @__PURE__ */ jsx(FieldLabel, {
|
|
8846
10162
|
required: true,
|
|
8847
|
-
children:
|
|
10163
|
+
children: labels?.emails ?? t("inviteMembers.emails")
|
|
8848
10164
|
}),
|
|
8849
10165
|
/* @__PURE__ */ jsx(TokenInput, {
|
|
8850
10166
|
value: emails,
|
|
8851
10167
|
onValueChange: setEmails,
|
|
8852
10168
|
validate: emailError,
|
|
8853
10169
|
maxItems: maxInvites,
|
|
8854
|
-
placeholder: "
|
|
8855
|
-
listLabel:
|
|
10170
|
+
placeholder: labels?.placeholder ?? t("inviteMembers.placeholder"),
|
|
10171
|
+
listLabel: labels?.listLabel ?? t("inviteMembers.listLabel"),
|
|
8856
10172
|
invalid: showEmailError
|
|
8857
10173
|
}),
|
|
8858
10174
|
/* @__PURE__ */ jsx(FieldError, {
|
|
@@ -8862,7 +10178,7 @@ function InviteMembersDialog({ roles = memberRoles, defaultRole = "member", onIn
|
|
|
8862
10178
|
]
|
|
8863
10179
|
}),
|
|
8864
10180
|
/* @__PURE__ */ jsxs(Field, { children: [
|
|
8865
|
-
/* @__PURE__ */ jsx(FieldLabel, { children: "
|
|
10181
|
+
/* @__PURE__ */ jsx(FieldLabel, { children: labels?.role ?? t("inviteMembers.role") }),
|
|
8866
10182
|
/* @__PURE__ */ jsxs(Select, {
|
|
8867
10183
|
value: role,
|
|
8868
10184
|
onValueChange: (v) => v != null && setRole(v),
|
|
@@ -8877,15 +10193,15 @@ function InviteMembersDialog({ roles = memberRoles, defaultRole = "member", onIn
|
|
|
8877
10193
|
}),
|
|
8878
10194
|
roleLabel && /* @__PURE__ */ jsx(FieldDescription, { children: roleLabel })
|
|
8879
10195
|
] }),
|
|
8880
|
-
/* @__PURE__ */ jsxs(Field, { children: [/* @__PURE__ */ jsx(FieldLabel, { children:
|
|
10196
|
+
/* @__PURE__ */ jsxs(Field, { children: [/* @__PURE__ */ jsx(FieldLabel, { children: labels?.message ?? t("inviteMembers.message") }), /* @__PURE__ */ jsx(Textarea, {
|
|
8881
10197
|
rows: 3,
|
|
8882
10198
|
value: message,
|
|
8883
10199
|
onValueChange: setMessage,
|
|
8884
|
-
placeholder:
|
|
10200
|
+
placeholder: labels?.messagePlaceholder ?? t("inviteMembers.messagePlaceholder")
|
|
8885
10201
|
})] }),
|
|
8886
10202
|
error && /* @__PURE__ */ jsx(Alert, {
|
|
8887
10203
|
tone: "destructive",
|
|
8888
|
-
title:
|
|
10204
|
+
title: labels?.errorTitle ?? t("inviteMembers.errorTitle"),
|
|
8889
10205
|
description: error
|
|
8890
10206
|
})
|
|
8891
10207
|
]
|
|
@@ -8894,11 +10210,11 @@ function InviteMembersDialog({ roles = memberRoles, defaultRole = "member", onIn
|
|
|
8894
10210
|
variant: "ghost",
|
|
8895
10211
|
disabled: loading
|
|
8896
10212
|
}),
|
|
8897
|
-
children: "
|
|
10213
|
+
children: labels?.cancel ?? t("inviteMembers.cancel")
|
|
8898
10214
|
}), /* @__PURE__ */ jsx(Button, {
|
|
8899
10215
|
type: "submit",
|
|
8900
10216
|
loading,
|
|
8901
|
-
children: emails.length > 1 ?
|
|
10217
|
+
children: emails.length > 1 ? labels?.submitMany?.(emails.length) ?? t("inviteMembers.submitMany", { count: emails.length }) : labels?.submit ?? t("inviteMembers.submit")
|
|
8902
10218
|
})] })]
|
|
8903
10219
|
})]
|
|
8904
10220
|
})]
|
|
@@ -8910,7 +10226,89 @@ const meta$35 = {
|
|
|
8910
10226
|
name: "Invite members dialog",
|
|
8911
10227
|
family: "forms",
|
|
8912
10228
|
status: "stable",
|
|
8913
|
-
description: "Dialog to invite people by email (validated chips) with a role and an optional message; submits with a loading state.",
|
|
10229
|
+
description: "Dialog to invite people by email (validated chips) with a role and an optional message; submits with a loading state. Optional labels?: Partial<InviteMembersDialogLabels> overrides built-in copy; explicit props and validation messages win, then labels, then I18nProvider (en/es). No provider preserves English; fixtures and caller content stay unchanged. Interactive preview: /preview.html?kind=block&id=invite-members-dialog--labels.",
|
|
10230
|
+
labels: [
|
|
10231
|
+
{
|
|
10232
|
+
key: "title",
|
|
10233
|
+
type: "string",
|
|
10234
|
+
state: "Default content and accessible names"
|
|
10235
|
+
},
|
|
10236
|
+
{
|
|
10237
|
+
key: "description",
|
|
10238
|
+
type: "string",
|
|
10239
|
+
state: "Default content and accessible names"
|
|
10240
|
+
},
|
|
10241
|
+
{
|
|
10242
|
+
key: "emails",
|
|
10243
|
+
type: "string",
|
|
10244
|
+
state: "Default content and accessible names"
|
|
10245
|
+
},
|
|
10246
|
+
{
|
|
10247
|
+
key: "placeholder",
|
|
10248
|
+
type: "string",
|
|
10249
|
+
state: "Default content and accessible names"
|
|
10250
|
+
},
|
|
10251
|
+
{
|
|
10252
|
+
key: "listLabel",
|
|
10253
|
+
type: "string",
|
|
10254
|
+
state: "Default content and accessible names"
|
|
10255
|
+
},
|
|
10256
|
+
{
|
|
10257
|
+
key: "role",
|
|
10258
|
+
type: "string",
|
|
10259
|
+
state: "Default content and accessible names"
|
|
10260
|
+
},
|
|
10261
|
+
{
|
|
10262
|
+
key: "message",
|
|
10263
|
+
type: "string",
|
|
10264
|
+
state: "Default content and accessible names"
|
|
10265
|
+
},
|
|
10266
|
+
{
|
|
10267
|
+
key: "messagePlaceholder",
|
|
10268
|
+
type: "string",
|
|
10269
|
+
state: "Default content and accessible names"
|
|
10270
|
+
},
|
|
10271
|
+
{
|
|
10272
|
+
key: "emailRequired",
|
|
10273
|
+
type: "string",
|
|
10274
|
+
state: "Validation feedback"
|
|
10275
|
+
},
|
|
10276
|
+
{
|
|
10277
|
+
key: "emailInvalid",
|
|
10278
|
+
type: "(email: string) => string",
|
|
10279
|
+
state: "Validation feedback"
|
|
10280
|
+
},
|
|
10281
|
+
{
|
|
10282
|
+
key: "fixInvalid",
|
|
10283
|
+
type: "(count: number) => string",
|
|
10284
|
+
state: "Validation feedback"
|
|
10285
|
+
},
|
|
10286
|
+
{
|
|
10287
|
+
key: "errorTitle",
|
|
10288
|
+
type: "string",
|
|
10289
|
+
state: "Validation feedback"
|
|
10290
|
+
},
|
|
10291
|
+
{
|
|
10292
|
+
key: "fallbackError",
|
|
10293
|
+
type: "string",
|
|
10294
|
+
state: "Validation feedback"
|
|
10295
|
+
},
|
|
10296
|
+
{
|
|
10297
|
+
key: "cancel",
|
|
10298
|
+
type: "string",
|
|
10299
|
+
state: "Default content and accessible names"
|
|
10300
|
+
},
|
|
10301
|
+
{
|
|
10302
|
+
key: "submit",
|
|
10303
|
+
type: "string",
|
|
10304
|
+
state: "Default content and accessible names"
|
|
10305
|
+
},
|
|
10306
|
+
{
|
|
10307
|
+
key: "submitMany",
|
|
10308
|
+
type: "(count: number) => string",
|
|
10309
|
+
state: "Default content and accessible names"
|
|
10310
|
+
}
|
|
10311
|
+
],
|
|
8914
10312
|
uses: [
|
|
8915
10313
|
"Dialog",
|
|
8916
10314
|
"TokenInput",
|
|
@@ -8924,7 +10322,10 @@ const meta$35 = {
|
|
|
8924
10322
|
//#endregion
|
|
8925
10323
|
//#region src/forms/SettingsRow/SettingsRow.tsx
|
|
8926
10324
|
/** One setting: label and description on the left, its control (a Switch by default) on the right. */
|
|
8927
|
-
function SettingsRow({ label
|
|
10325
|
+
function SettingsRow({ labels, label: labelProp, description: descriptionProp, control, checked, defaultChecked = true, onCheckedChange, disabled, children, className }) {
|
|
10326
|
+
const { t } = useI18n();
|
|
10327
|
+
const label = labelProp === void 0 ? labels?.label ?? t("settingsRow.label") : labelProp;
|
|
10328
|
+
const description = descriptionProp === void 0 ? labels?.description ?? t("settingsRow.description") : descriptionProp;
|
|
8928
10329
|
const id = useId();
|
|
8929
10330
|
const labelId = `${id}-label`;
|
|
8930
10331
|
const descriptionId = description != null ? `${id}-desc` : void 0;
|
|
@@ -8968,22 +10369,31 @@ const meta$60 = {
|
|
|
8968
10369
|
name: "Settings row",
|
|
8969
10370
|
family: "forms",
|
|
8970
10371
|
status: "stable",
|
|
8971
|
-
description: "A setting with its label and description on the left and a control (Switch by default) on the right.",
|
|
10372
|
+
description: "A setting with its label and description on the left and a control (Switch by default) on the right. Optional labels?: Partial<SettingsRowLabels> overrides built-in copy; explicit props and validation messages win, then labels, then I18nProvider (en/es). No provider preserves English; fixtures and caller content stay unchanged. Interactive preview: /preview.html?kind=block&id=settings-row--labels.",
|
|
10373
|
+
labels: [{
|
|
10374
|
+
key: "label",
|
|
10375
|
+
type: "string",
|
|
10376
|
+
state: "Default content and accessible names"
|
|
10377
|
+
}, {
|
|
10378
|
+
key: "description",
|
|
10379
|
+
type: "string",
|
|
10380
|
+
state: "Default content and accessible names"
|
|
10381
|
+
}],
|
|
8972
10382
|
uses: ["Switch"]
|
|
8973
10383
|
};
|
|
8974
10384
|
//#endregion
|
|
8975
10385
|
//#region src/forms/DialogWizard/DialogWizard.tsx
|
|
8976
10386
|
/** Modal variant of create-wizard for a flow over its parent page. State stays consumer-owned. */
|
|
8977
|
-
function DialogWizard({ steps, current = 0, size = "dialog", stepError, reviewStep, children, title, ...props }) {
|
|
10387
|
+
function DialogWizard({ labels, steps, current = 0, size = "dialog", stepError, reviewStep, children, title, ...props }) {
|
|
8978
10388
|
const { t } = useI18n();
|
|
8979
|
-
const items = steps ?? [{ label: t("wizard.details") }, { label: t("wizard.review") }];
|
|
10389
|
+
const items = steps ?? [{ label: labels?.details ?? t("wizard.details") }, { label: labels?.review ?? t("wizard.review") }];
|
|
8980
10390
|
return /* @__PURE__ */ jsxs(WizardLayout, {
|
|
8981
10391
|
...props,
|
|
8982
10392
|
mode: "overlay",
|
|
8983
10393
|
size,
|
|
8984
10394
|
steps: items,
|
|
8985
10395
|
current,
|
|
8986
|
-
title: title ?? t("wizard.title"),
|
|
10396
|
+
title: title ?? labels?.title ?? t("wizard.title"),
|
|
8987
10397
|
children: [stepError, current >= items.length - 1 && reviewStep != null ? reviewStep : children]
|
|
8988
10398
|
});
|
|
8989
10399
|
}
|
|
@@ -8993,7 +10403,24 @@ const meta$19 = {
|
|
|
8993
10403
|
name: "Dialog wizard",
|
|
8994
10404
|
family: "forms",
|
|
8995
10405
|
status: "beta",
|
|
8996
|
-
description: "Modal variant of create-wizard for create flows over their parent page, without a route change. Defaults to dialog size (fullscreen on mobile); size=\"fullscreen\" fills every viewport. Consumer-controlled step state survives closing. Use the create-wizard page template for a dedicated page flow, or WizardLayout mode=\"overlay\" for a fullscreen flow. Supply all labels, pendingLabel and stepAnnouncement from your own i18n; stepError accepts ValidationSummary and reviewStep accepts DescriptionListCard.",
|
|
10406
|
+
description: "Modal variant of create-wizard for create flows over their parent page, without a route change. Defaults to dialog size (fullscreen on mobile); size=\"fullscreen\" fills every viewport. Consumer-controlled step state survives closing. Use the create-wizard page template for a dedicated page flow, or WizardLayout mode=\"overlay\" for a fullscreen flow. Supply all labels, pendingLabel and stepAnnouncement from your own i18n; stepError accepts ValidationSummary and reviewStep accepts DescriptionListCard. Optional labels?: Partial<DialogWizardLabels> overrides built-in copy; explicit props and validation messages win, then labels, then I18nProvider (en/es). No provider preserves English; fixtures and caller content stay unchanged. Interactive preview: /preview.html?kind=block&id=dialog-wizard--labels.",
|
|
10407
|
+
labels: [
|
|
10408
|
+
{
|
|
10409
|
+
key: "title",
|
|
10410
|
+
type: "string",
|
|
10411
|
+
state: "Default content and accessible names"
|
|
10412
|
+
},
|
|
10413
|
+
{
|
|
10414
|
+
key: "details",
|
|
10415
|
+
type: "string",
|
|
10416
|
+
state: "Default content and accessible names"
|
|
10417
|
+
},
|
|
10418
|
+
{
|
|
10419
|
+
key: "review",
|
|
10420
|
+
type: "string",
|
|
10421
|
+
state: "Default content and accessible names"
|
|
10422
|
+
}
|
|
10423
|
+
],
|
|
8997
10424
|
uses: [
|
|
8998
10425
|
"WizardLayout",
|
|
8999
10426
|
"Dialog",
|
|
@@ -9032,7 +10459,12 @@ const meta$75 = {
|
|
|
9032
10459
|
name: "Validation summary",
|
|
9033
10460
|
family: "forms",
|
|
9034
10461
|
status: "stable",
|
|
9035
|
-
description: "Error summary that lists every problem with a link to its field and takes focus after a failed submit.",
|
|
10462
|
+
description: "Error summary that lists every problem with a link to its field and takes focus after a failed submit. Optional labels?: Partial<ValidationSummaryLabels> overrides built-in copy; explicit props and validation messages win, then labels, then I18nProvider (en/es). No provider preserves English; fixtures and caller content stay unchanged. Interactive preview: /preview.html?kind=block&id=validation-summary--labels.",
|
|
10463
|
+
labels: [{
|
|
10464
|
+
key: "title",
|
|
10465
|
+
type: "(count: number) => string",
|
|
10466
|
+
state: "Default content and accessible names"
|
|
10467
|
+
}],
|
|
9036
10468
|
uses: ["Alert", "Link"]
|
|
9037
10469
|
};
|
|
9038
10470
|
//#endregion
|
|
@@ -10073,8 +11505,10 @@ const pageHeaderTabs = [
|
|
|
10073
11505
|
//#endregion
|
|
10074
11506
|
//#region src/page-chrome/PageHeader/PageHeader.tsx
|
|
10075
11507
|
/** Screen header: breadcrumb, title + status, description, meta row, actions and optional tabs. */
|
|
10076
|
-
function PageHeader({ as: Root = "header", breadcrumbs = pageHeaderBreadcrumbs, title =
|
|
11508
|
+
function PageHeader({ as: Root = "header", breadcrumbs = pageHeaderBreadcrumbs, title: titleProp, wrapTitle = false, labels, titleRef, description: descriptionProp, status = "active", statuses, meta = pageHeaderMeta, actions = pageHeaderActions, tabs = pageHeaderTabs, tab, defaultTab, onTabChange, className }) {
|
|
10077
11509
|
const { t } = useI18n();
|
|
11510
|
+
const title = titleProp === void 0 ? labels?.title ?? t("pageHeader.title") : titleProp;
|
|
11511
|
+
const description = descriptionProp === void 0 ? labels?.description ?? t("pageHeader.description") : descriptionProp;
|
|
10078
11512
|
const explicitPrimary = actions.findIndex((a) => a.variant === "primary");
|
|
10079
11513
|
const primaryIndex = explicitPrimary >= 0 ? explicitPrimary : actions.length - 1;
|
|
10080
11514
|
const primary = actions[primaryIndex];
|
|
@@ -10104,7 +11538,7 @@ function PageHeader({ as: Root = "header", breadcrumbs = pageHeaderBreadcrumbs,
|
|
|
10104
11538
|
children: [/* @__PURE__ */ jsx("h1", {
|
|
10105
11539
|
ref: titleRef,
|
|
10106
11540
|
tabIndex: titleRef != null ? -1 : void 0,
|
|
10107
|
-
className: "min-w-0 truncate text-2xl font-bold tracking-tight text-foreground",
|
|
11541
|
+
className: cn(wrapTitle ? "min-w-0 wrap-anywhere" : "min-w-0 truncate", "text-2xl font-bold tracking-tight text-foreground"),
|
|
10108
11542
|
children: title
|
|
10109
11543
|
}), status && /* @__PURE__ */ jsx(StatusTag, {
|
|
10110
11544
|
status,
|
|
@@ -10143,7 +11577,7 @@ function PageHeader({ as: Root = "header", breadcrumbs = pageHeaderBreadcrumbs,
|
|
|
10143
11577
|
className: "flex shrink-0 items-center gap-2 sm:hidden",
|
|
10144
11578
|
children: [folded.length > 0 && /* @__PURE__ */ jsx(MoreMenu, {
|
|
10145
11579
|
items: folded.map(toMenuAction),
|
|
10146
|
-
label:
|
|
11580
|
+
label: labels?.moreActions ?? t("pageHeader.moreActions")
|
|
10147
11581
|
}), primary && renderAction(primary, primaryIndex)]
|
|
10148
11582
|
})] })]
|
|
10149
11583
|
}),
|
|
@@ -10153,7 +11587,7 @@ function PageHeader({ as: Root = "header", breadcrumbs = pageHeaderBreadcrumbs,
|
|
|
10153
11587
|
onValueChange: (value) => onTabChange?.(String(value)),
|
|
10154
11588
|
className: "mt-5",
|
|
10155
11589
|
children: /* @__PURE__ */ jsx(TabsList, {
|
|
10156
|
-
"aria-label": t("pageHeader.sections"),
|
|
11590
|
+
"aria-label": labels?.sections ?? t("pageHeader.sections"),
|
|
10157
11591
|
className: "overflow-x-auto",
|
|
10158
11592
|
children: tabs.map((t) => /* @__PURE__ */ jsx(TabsTab, {
|
|
10159
11593
|
value: t.value,
|
|
@@ -10171,7 +11605,29 @@ const meta$45 = {
|
|
|
10171
11605
|
name: "Page header",
|
|
10172
11606
|
family: "page-chrome",
|
|
10173
11607
|
status: "beta",
|
|
10174
|
-
description: "Screen header with breadcrumb, title and status, description, meta row, actions that fold into a MoreMenu on small screens, and optional navigation tabs. titleRef targets the h1 for titleRef.current.focus(), adding tabIndex=-1 only when supplied so the title stays outside the Tab order. In a StatusLayout heading slot use as=\"div\" and disable breadcrumb, meta, tabs, actions, status and description fixtures; the slot supplies the page’s only h1. The tablist name follows I18nProvider (en/es); the Spanish preview keeps caller content unchanged.",
|
|
11608
|
+
description: "Screen header with breadcrumb, title and status, description, meta row, actions that fold into a MoreMenu on small screens, and optional navigation tabs. titleRef targets the h1 for titleRef.current.focus(), adding tabIndex=-1 only when supplied so the title stays outside the Tab order. In a StatusLayout heading slot use as=\"div\" and disable breadcrumb, meta, tabs, actions, status and description fixtures; the slot supplies the page’s only h1. The tablist name follows I18nProvider (en/es); the Spanish preview keeps caller content unchanged. Optional labels?: Partial<PageHeaderLabels> overrides each built-in label. Explicit content props win over labels, then I18nProvider (en/es); no provider keeps English. Imported fixtures and machine data stay unchanged. See the Catalog labels live preview. wrapTitle?: boolean (default false) wraps the full title, including long words, while preserving titleRef focus behavior. The default title remains truncated. See the Spanish live preview for a wrapping title.",
|
|
11609
|
+
labels: [
|
|
11610
|
+
{
|
|
11611
|
+
key: "title",
|
|
11612
|
+
type: "string",
|
|
11613
|
+
state: "Heading; explicit title prop wins, including null"
|
|
11614
|
+
},
|
|
11615
|
+
{
|
|
11616
|
+
key: "description",
|
|
11617
|
+
type: "string",
|
|
11618
|
+
state: "Description; explicit description prop wins, including null"
|
|
11619
|
+
},
|
|
11620
|
+
{
|
|
11621
|
+
key: "moreActions",
|
|
11622
|
+
type: "string",
|
|
11623
|
+
state: "Compact actions menu name"
|
|
11624
|
+
},
|
|
11625
|
+
{
|
|
11626
|
+
key: "sections",
|
|
11627
|
+
type: "string",
|
|
11628
|
+
state: "Tablist name"
|
|
11629
|
+
}
|
|
11630
|
+
],
|
|
10175
11631
|
uses: [
|
|
10176
11632
|
"Breadcrumbs",
|
|
10177
11633
|
"Button",
|
|
@@ -10452,6 +11908,20 @@ const meta$5 = {
|
|
|
10452
11908
|
uses: ["Toolbar", "ToolbarButton"]
|
|
10453
11909
|
};
|
|
10454
11910
|
//#endregion
|
|
11911
|
+
//#region src/scheduling/shared/useSchedulingClock.ts
|
|
11912
|
+
/** Map the existing public numeric clock API to scheduling's Intl options. */
|
|
11913
|
+
function resolveHourCycle(locale) {
|
|
11914
|
+
return localeHourCycle(locale) === 12 ? "h12" : "h23";
|
|
11915
|
+
}
|
|
11916
|
+
/** Undefined outside a provider lets Intl use the runtime locale, as ui Calendar does. */
|
|
11917
|
+
function useSchedulingClock(override) {
|
|
11918
|
+
const locale = useOptionalI18n()?.locale;
|
|
11919
|
+
return {
|
|
11920
|
+
locale,
|
|
11921
|
+
hourCycle: override ?? resolveHourCycle(locale)
|
|
11922
|
+
};
|
|
11923
|
+
}
|
|
11924
|
+
//#endregion
|
|
10455
11925
|
//#region src/scheduling/shared/CalendarHeader.tsx
|
|
10456
11926
|
/** Title + previous / today / next navigation + caller actions. */
|
|
10457
11927
|
function CalendarHeader({ titleId, title, subtitle, prevLabel, nextLabel, onPrev, onNext, onToday, actions }) {
|
|
@@ -10501,11 +11971,10 @@ function CalendarHeader({ titleId, title, subtitle, prevLabel, nextLabel, onPrev
|
|
|
10501
11971
|
}
|
|
10502
11972
|
//#endregion
|
|
10503
11973
|
//#region src/scheduling/shared/dates.ts
|
|
10504
|
-
|
|
10505
|
-
const pad$1 = (n) => String(n).padStart(2, "0");
|
|
11974
|
+
const pad = (n) => String(n).padStart(2, "0");
|
|
10506
11975
|
/** Local calendar key "YYYY-MM-DD". */
|
|
10507
11976
|
function dayKey(d) {
|
|
10508
|
-
return `${d.getFullYear()}-${pad
|
|
11977
|
+
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`;
|
|
10509
11978
|
}
|
|
10510
11979
|
function startOfDay(d) {
|
|
10511
11980
|
return new Date(d.getFullYear(), d.getMonth(), d.getDate());
|
|
@@ -10525,17 +11994,17 @@ function sameDay(a, b) {
|
|
|
10525
11994
|
function sameMonth(a, b) {
|
|
10526
11995
|
return a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth();
|
|
10527
11996
|
}
|
|
10528
|
-
/**
|
|
10529
|
-
function startOfWeek(d) {
|
|
10530
|
-
return addDays(startOfDay(d), -((d.getDay() +
|
|
11997
|
+
/** First day of the week containing `d`. */
|
|
11998
|
+
function startOfWeek(d, weekStartsOn) {
|
|
11999
|
+
return addDays(startOfDay(d), -((d.getDay() - weekStartsOn + 7) % 7));
|
|
10531
12000
|
}
|
|
10532
|
-
function weekDays(d) {
|
|
10533
|
-
const
|
|
10534
|
-
return Array.from({ length: 7 }, (_, i) => addDays(
|
|
12001
|
+
function weekDays(d, weekStartsOn) {
|
|
12002
|
+
const first = startOfWeek(d, weekStartsOn);
|
|
12003
|
+
return Array.from({ length: 7 }, (_, i) => addDays(first, i));
|
|
10535
12004
|
}
|
|
10536
|
-
/** Six
|
|
10537
|
-
function monthGrid(d) {
|
|
10538
|
-
const start = startOfWeek(startOfMonth(d));
|
|
12005
|
+
/** Six weeks covering the month of `d`, starting on `weekStartsOn`. */
|
|
12006
|
+
function monthGrid(d, weekStartsOn) {
|
|
12007
|
+
const start = startOfWeek(startOfMonth(d), weekStartsOn);
|
|
10539
12008
|
return Array.from({ length: 6 }, (_, w) => Array.from({ length: 7 }, (_, i) => addDays(start, w * 7 + i)));
|
|
10540
12009
|
}
|
|
10541
12010
|
/** Decimal hour of the day: 10:30 → 10.5. */
|
|
@@ -10543,24 +12012,30 @@ function hourOf(d) {
|
|
|
10543
12012
|
return d.getHours() + d.getMinutes() / 60;
|
|
10544
12013
|
}
|
|
10545
12014
|
const cache = /* @__PURE__ */ new Map();
|
|
10546
|
-
/** Cached Intl formatter;
|
|
12015
|
+
/** Cached Intl formatter; an omitted locale uses the runtime locale. */
|
|
10547
12016
|
const fmt = (locale, opts) => {
|
|
10548
|
-
const key = `${locale ??
|
|
12017
|
+
const key = `${locale ?? new Intl.DateTimeFormat().resolvedOptions().locale}|${JSON.stringify(opts)}`;
|
|
10549
12018
|
let f = cache.get(key);
|
|
10550
12019
|
if (!f) {
|
|
10551
|
-
f = new Intl.DateTimeFormat(locale
|
|
12020
|
+
f = new Intl.DateTimeFormat(locale, opts);
|
|
10552
12021
|
cache.set(key, f);
|
|
10553
12022
|
}
|
|
10554
12023
|
return f;
|
|
10555
12024
|
};
|
|
10556
|
-
/** "09:30". */
|
|
10557
|
-
const formatTime = (d, locale) => fmt(locale, {
|
|
10558
|
-
hour: "2-digit",
|
|
12025
|
+
/** "9:30 AM" or "09:30". */
|
|
12026
|
+
const formatTime = (d, locale, hourCycle) => fmt(locale, {
|
|
12027
|
+
hour: hourCycle === "h12" ? "numeric" : "2-digit",
|
|
10559
12028
|
minute: "2-digit",
|
|
10560
|
-
hourCycle
|
|
12029
|
+
hourCycle
|
|
10561
12030
|
}).format(d);
|
|
10562
|
-
/** "09:30–10:00". */
|
|
10563
|
-
const formatRange = (start, end, locale) => `${formatTime(start, locale)}–${formatTime(end, locale)}`;
|
|
12031
|
+
/** "9:30 AM–10:00 AM" or "09:30–10:00". */
|
|
12032
|
+
const formatRange = (start, end, locale, hourCycle) => `${formatTime(start, locale, hourCycle)}–${formatTime(end, locale, hourCycle)}`;
|
|
12033
|
+
/** Compact gutter label: "9 AM" or "09:00". */
|
|
12034
|
+
const formatHour = (hour, locale, hourCycle) => fmt(locale, {
|
|
12035
|
+
hour: hourCycle === "h12" ? "numeric" : "2-digit",
|
|
12036
|
+
...hourCycle === "h23" ? { minute: "2-digit" } : {},
|
|
12037
|
+
hourCycle
|
|
12038
|
+
}).format(new Date(2026, 0, 1, hour));
|
|
10564
12039
|
/** "Wednesday, April 15, 2026". */
|
|
10565
12040
|
const formatFullDate = (d, locale) => fmt(locale, {
|
|
10566
12041
|
weekday: "long",
|
|
@@ -10596,9 +12071,18 @@ function formatWeekRange(days, locale) {
|
|
|
10596
12071
|
day: "numeric",
|
|
10597
12072
|
year: "numeric"
|
|
10598
12073
|
}).formatRange(first, last);
|
|
10599
|
-
if (sameMonth(first, last)) return `${formatShort(first)} – ${last.getDate()}, ${last.getFullYear()}`;
|
|
10600
|
-
if (first.getFullYear() === last.getFullYear()) return `${formatShort(first)} – ${formatShort(last)}, ${last.getFullYear()}`;
|
|
10601
|
-
return `${formatShort(first)}, ${first.getFullYear()} – ${formatShort(last)}, ${last.getFullYear()}`;
|
|
12074
|
+
if (sameMonth(first, last)) return `${formatShort(first, "en-US")} – ${last.getDate()}, ${last.getFullYear()}`;
|
|
12075
|
+
if (first.getFullYear() === last.getFullYear()) return `${formatShort(first, "en-US")} – ${formatShort(last, "en-US")}, ${last.getFullYear()}`;
|
|
12076
|
+
return `${formatShort(first, "en-US")}, ${first.getFullYear()} – ${formatShort(last, "en-US")}, ${last.getFullYear()}`;
|
|
12077
|
+
}
|
|
12078
|
+
/** Internal to blocks: Intl weekdays 1–7 become JS weekdays 0–6. */
|
|
12079
|
+
function weekendDays(locale) {
|
|
12080
|
+
try {
|
|
12081
|
+
const loc = new Intl.Locale(locale ?? new Intl.DateTimeFormat().resolvedOptions().locale);
|
|
12082
|
+
const info = loc.getWeekInfo?.() ?? loc.weekInfo;
|
|
12083
|
+
if (info) return info.weekend.map((day) => day % 7);
|
|
12084
|
+
} catch {}
|
|
12085
|
+
return [6, 0];
|
|
10602
12086
|
}
|
|
10603
12087
|
//#endregion
|
|
10604
12088
|
//#region src/scheduling/shared/events.ts
|
|
@@ -10947,15 +12431,15 @@ const sampleEvents = ROWS.map(([day, kind, title, start, hours, location], i) =>
|
|
|
10947
12431
|
}));
|
|
10948
12432
|
//#endregion
|
|
10949
12433
|
//#region src/scheduling/MonthCalendar/MonthCalendar.tsx
|
|
10950
|
-
/** Monday-first weekdays (2026-01-05 is a Monday). */
|
|
10951
|
-
const WEEK = Array.from({ length: 7 }, (_, i) => new Date(2026, 0, 5 + i));
|
|
10952
12434
|
/**
|
|
10953
|
-
* Month view of scheduled work: a
|
|
12435
|
+
* Month view of scheduled work: a locale-first grid with up to N events per day.
|
|
10954
12436
|
* Keyboard: arrows move by day/week, Home/End to the week edges, PageUp/PageDown by month,
|
|
10955
12437
|
* Enter/Space selects.
|
|
10956
12438
|
*/
|
|
10957
|
-
function MonthCalendar({ events = sampleEvents, today = sampleToday, defaultMonth, onMonthChange, defaultSelected, onSelectDate, kinds = defaultEventKinds, maxEventsPerDay = 2, actions, className }) {
|
|
12439
|
+
function MonthCalendar({ events = sampleEvents, hourCycle: hourCycleProp, weekStartsOn: weekStartsOnProp, today = sampleToday, defaultMonth, onMonthChange, defaultSelected, onSelectDate, kinds = defaultEventKinds, maxEventsPerDay = 2, actions, className }) {
|
|
10958
12440
|
const { t, locale, dir } = useI18n();
|
|
12441
|
+
const clock = useSchedulingClock(hourCycleProp);
|
|
12442
|
+
const weekStartsOn = weekStartsOnProp ?? localeWeekStart(clock.locale);
|
|
10959
12443
|
const titleId = useId();
|
|
10960
12444
|
const [selected, setSelected] = useState(() => startOfDay(defaultSelected ?? today));
|
|
10961
12445
|
const [focused, setFocused] = useState(() => startOfDay(defaultSelected ?? defaultMonth ?? today));
|
|
@@ -10963,7 +12447,8 @@ function MonthCalendar({ events = sampleEvents, today = sampleToday, defaultMont
|
|
|
10963
12447
|
const gridRef = useRef(null);
|
|
10964
12448
|
const moveFocus = useRef(false);
|
|
10965
12449
|
const byDay = useMemo(() => groupByDay(events), [events]);
|
|
10966
|
-
const weeks = monthGrid(month);
|
|
12450
|
+
const weeks = monthGrid(month, weekStartsOn);
|
|
12451
|
+
const weekend = weekendDays(clock.locale);
|
|
10967
12452
|
const tabStop = sameMonth(focused, month) ? focused : sameMonth(selected, month) ? selected : month;
|
|
10968
12453
|
useEffect(() => {
|
|
10969
12454
|
if (!moveFocus.current) return;
|
|
@@ -10986,7 +12471,7 @@ function MonthCalendar({ events = sampleEvents, today = sampleToday, defaultMont
|
|
|
10986
12471
|
onSelectDate?.(date, byDay.get(dayKey(date)) ?? []);
|
|
10987
12472
|
};
|
|
10988
12473
|
const onKeyDown = (event, date) => {
|
|
10989
|
-
const weekStart = startOfWeek(date);
|
|
12474
|
+
const weekStart = startOfWeek(date, weekStartsOn);
|
|
10990
12475
|
const next = {
|
|
10991
12476
|
ArrowLeft: () => addDays(date, dir === "rtl" ? 1 : -1),
|
|
10992
12477
|
ArrowRight: () => addDays(date, dir === "rtl" ? -1 : 1),
|
|
@@ -11022,7 +12507,7 @@ function MonthCalendar({ events = sampleEvents, today = sampleToday, defaultMont
|
|
|
11022
12507
|
children: [/* @__PURE__ */ jsx("div", {
|
|
11023
12508
|
role: "row",
|
|
11024
12509
|
className: "grid grid-cols-7 border-b border-border bg-secondary/30",
|
|
11025
|
-
children:
|
|
12510
|
+
children: (weeks[0] ?? []).map((day) => /* @__PURE__ */ jsx("div", {
|
|
11026
12511
|
role: "columnheader",
|
|
11027
12512
|
"aria-label": formatWeekday(day, locale, "long"),
|
|
11028
12513
|
className: "py-2 text-center text-[11px] font-medium tracking-wide text-muted-foreground uppercase",
|
|
@@ -11040,6 +12525,7 @@ function MonthCalendar({ events = sampleEvents, today = sampleToday, defaultMont
|
|
|
11040
12525
|
const extra = list.length - maxEventsPerDay;
|
|
11041
12526
|
return /* @__PURE__ */ jsx("div", {
|
|
11042
12527
|
role: "gridcell",
|
|
12528
|
+
"data-weekend": weekend.includes(date.getDay()) ? "" : void 0,
|
|
11043
12529
|
"aria-selected": isSelected,
|
|
11044
12530
|
className: "min-w-0 border-e border-b border-border/70 [&:nth-child(7)]:border-e-0",
|
|
11045
12531
|
children: /* @__PURE__ */ jsxs("button", {
|
|
@@ -11080,7 +12566,7 @@ function MonthCalendar({ events = sampleEvents, today = sampleToday, defaultMont
|
|
|
11080
12566
|
}),
|
|
11081
12567
|
/* @__PURE__ */ jsx("span", {
|
|
11082
12568
|
className: "ms-auto hidden shrink-0 font-mono text-[10px] text-muted-foreground xl:block",
|
|
11083
|
-
children: formatTime(e.start, locale)
|
|
12569
|
+
children: formatTime(e.start, clock.locale, clock.hourCycle)
|
|
11084
12570
|
})
|
|
11085
12571
|
]
|
|
11086
12572
|
}, e.id)), extra > 0 && /* @__PURE__ */ jsxs("span", {
|
|
@@ -11102,13 +12588,12 @@ const meta$43 = {
|
|
|
11102
12588
|
name: "Month calendar",
|
|
11103
12589
|
family: "scheduling",
|
|
11104
12590
|
status: "beta",
|
|
11105
|
-
description: "
|
|
12591
|
+
description: "Locale-first month grid of scheduled work with per-day event lines, today/selected states, month navigation and full grid keyboard support. weekStartsOn and hourCycle override provider/runtime defaults; data-weekend marks locale weekends without styling. Locale examples show en-US, es-ES, then en-US with Monday-first and 24-hour overrides.",
|
|
11106
12592
|
uses: ["Button", "IconButton"]
|
|
11107
12593
|
};
|
|
11108
12594
|
//#endregion
|
|
11109
12595
|
//#region src/scheduling/WeekCalendar/WeekCalendar.tsx
|
|
11110
12596
|
const HOURS = Array.from({ length: 24 }, (_, h) => h);
|
|
11111
|
-
const pad = (n) => String(n).padStart(2, "0");
|
|
11112
12597
|
/** Side-by-side lanes for overlapping events within one day. */
|
|
11113
12598
|
function layoutDay(list, hourHeight) {
|
|
11114
12599
|
const placed = [];
|
|
@@ -11144,13 +12629,17 @@ function layoutDay(list, hourHeight) {
|
|
|
11144
12629
|
return placed;
|
|
11145
12630
|
}
|
|
11146
12631
|
/** Week view: seven day columns over a scrolling 24-hour time grid, with a "now" line. */
|
|
11147
|
-
function WeekCalendar({ events = sampleEvents, today = sampleToday, now, defaultWeek, onWeekChange, onEventClick, kinds = defaultEventKinds, scrollToHour = 7, hourHeight = 52, height = 480, actions, className }) {
|
|
12632
|
+
function WeekCalendar({ events = sampleEvents, weekStartsOn: weekStartsOnProp, hourCycle: hourCycleProp, today = sampleToday, now, defaultWeek, onWeekChange, onEventClick, kinds = defaultEventKinds, scrollToHour = 7, hourHeight = 52, height = 480, actions, className }) {
|
|
11148
12633
|
const { t, locale } = useI18n();
|
|
12634
|
+
const clock = useSchedulingClock(hourCycleProp);
|
|
12635
|
+
const weekStartsOn = weekStartsOnProp ?? localeWeekStart(clock.locale);
|
|
11149
12636
|
const titleId = useId();
|
|
11150
|
-
const [weekStart, setWeekStart] = useState(() => startOfWeek(defaultWeek ?? today));
|
|
12637
|
+
const [weekStart, setWeekStart] = useState(() => startOfWeek(defaultWeek ?? today, weekStartsOn));
|
|
11151
12638
|
const scrollRef = useRef(null);
|
|
11152
12639
|
const byDay = useMemo(() => groupByDay(events), [events]);
|
|
11153
|
-
const days = weekDays(weekStart);
|
|
12640
|
+
const days = weekDays(weekStart, weekStartsOn);
|
|
12641
|
+
const visibleStart = days[0] ?? weekStart;
|
|
12642
|
+
const weekend = weekendDays(clock.locale);
|
|
11154
12643
|
const nowAt = now ?? today;
|
|
11155
12644
|
const nowVisible = days.some((d) => sameDay(d, nowAt));
|
|
11156
12645
|
useEffect(() => {
|
|
@@ -11167,9 +12656,9 @@ function WeekCalendar({ events = sampleEvents, today = sampleToday, now, default
|
|
|
11167
12656
|
title: formatWeekRange(days, locale),
|
|
11168
12657
|
prevLabel: t("calendar.previousWeek"),
|
|
11169
12658
|
nextLabel: t("calendar.nextWeek"),
|
|
11170
|
-
onPrev: () => show(addDays(
|
|
11171
|
-
onNext: () => show(addDays(
|
|
11172
|
-
onToday: () => show(startOfWeek(today)),
|
|
12659
|
+
onPrev: () => show(addDays(visibleStart, -7)),
|
|
12660
|
+
onNext: () => show(addDays(visibleStart, 7)),
|
|
12661
|
+
onToday: () => show(startOfWeek(today, weekStartsOn)),
|
|
11173
12662
|
actions
|
|
11174
12663
|
}), /* @__PURE__ */ jsx("div", {
|
|
11175
12664
|
className: "overflow-x-auto",
|
|
@@ -11207,10 +12696,10 @@ function WeekCalendar({ events = sampleEvents, today = sampleToday, now, default
|
|
|
11207
12696
|
children: [/* @__PURE__ */ jsx("div", {
|
|
11208
12697
|
"aria-hidden": true,
|
|
11209
12698
|
className: "relative w-14 shrink-0 border-e border-border/70",
|
|
11210
|
-
children: HOURS.slice(1).map((h) => /* @__PURE__ */
|
|
12699
|
+
children: HOURS.slice(1).map((h) => /* @__PURE__ */ jsx("span", {
|
|
11211
12700
|
className: "absolute end-2 font-mono text-[10px] text-muted-foreground",
|
|
11212
12701
|
style: { top: h * hourHeight - 6 },
|
|
11213
|
-
children:
|
|
12702
|
+
children: formatHour(h, clock.locale, clock.hourCycle)
|
|
11214
12703
|
}, h))
|
|
11215
12704
|
}), /* @__PURE__ */ jsxs("div", {
|
|
11216
12705
|
className: "relative flex-1",
|
|
@@ -11228,18 +12717,19 @@ function WeekCalendar({ events = sampleEvents, today = sampleToday, now, default
|
|
|
11228
12717
|
children: days.map((d) => {
|
|
11229
12718
|
const list = byDay.get(dayKey(d)) ?? [];
|
|
11230
12719
|
return /* @__PURE__ */ jsx("ul", {
|
|
12720
|
+
"data-weekend": weekend.includes(d.getDay()) ? "" : void 0,
|
|
11231
12721
|
"aria-label": formatDay(d, locale),
|
|
11232
12722
|
className: "relative border-s border-border/70 first:border-s-0",
|
|
11233
12723
|
children: layoutDay(list, hourHeight).map(({ event, top, height: h, lane, lanes }) => {
|
|
11234
12724
|
const kind = kindOf(event, kinds);
|
|
11235
12725
|
const tone = TONE[kind.tone];
|
|
11236
|
-
const range = formatRange(event.start, event.end, locale);
|
|
12726
|
+
const range = formatRange(event.start, event.end, clock.locale, clock.hourCycle);
|
|
11237
12727
|
const body = /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
|
|
11238
12728
|
className: "block truncate text-[11px] leading-tight font-semibold text-foreground",
|
|
11239
12729
|
children: event.title
|
|
11240
12730
|
}), /* @__PURE__ */ jsx("span", {
|
|
11241
|
-
className: "block truncate font-mono text-[10px] text-
|
|
11242
|
-
children: formatTime(event.start, locale)
|
|
12731
|
+
className: "block truncate font-mono text-[10px] text-foreground",
|
|
12732
|
+
children: formatTime(event.start, clock.locale, clock.hourCycle)
|
|
11243
12733
|
})] });
|
|
11244
12734
|
const box = cn("block h-full w-full overflow-hidden rounded-md border-s-2 px-2 py-1 text-start", tone.soft, tone.bar);
|
|
11245
12735
|
return /* @__PURE__ */ jsx("li", {
|
|
@@ -11296,7 +12786,7 @@ const meta$76 = {
|
|
|
11296
12786
|
name: "Week calendar",
|
|
11297
12787
|
family: "scheduling",
|
|
11298
12788
|
status: "beta",
|
|
11299
|
-
description: "
|
|
12789
|
+
description: "Locale-first seven-day time grid with positioned events (overlaps side by side), a now line, week navigation and optional clickable events. weekStartsOn and hourCycle override provider/runtime defaults; data-weekend marks locale weekends without styling. Locale examples show en-US, es-ES, then en-US with Monday-first and 24-hour overrides.",
|
|
11300
12790
|
uses: ["Button", "IconButton"]
|
|
11301
12791
|
};
|
|
11302
12792
|
//#endregion
|
|
@@ -11314,8 +12804,9 @@ function EventTile({ kind, className }) {
|
|
|
11314
12804
|
//#endregion
|
|
11315
12805
|
//#region src/scheduling/AgendaList/AgendaList.tsx
|
|
11316
12806
|
/** Upcoming scheduled work grouped by day, each row with a kind tile, time range and location. */
|
|
11317
|
-
function AgendaList({ events = sampleEvents, today = sampleToday, from, days = 7, onEventClick, kinds = defaultEventKinds, title: titleProp, maxHeight, emptyTitle: emptyTitleProp, emptyDescription: emptyDescriptionProp, titleAs: TitleTag = "h3", className }) {
|
|
12807
|
+
function AgendaList({ events = sampleEvents, hourCycle: hourCycleProp, today = sampleToday, from, days = 7, onEventClick, kinds = defaultEventKinds, title: titleProp, maxHeight, emptyTitle: emptyTitleProp, emptyDescription: emptyDescriptionProp, titleAs: TitleTag = "h3", className }) {
|
|
11318
12808
|
const { t, locale } = useI18n();
|
|
12809
|
+
const clock = useSchedulingClock(hourCycleProp);
|
|
11319
12810
|
const title = titleProp ?? t("calendar.agenda");
|
|
11320
12811
|
const emptyTitle = emptyTitleProp ?? t("calendar.emptyTitle");
|
|
11321
12812
|
const emptyDescription = emptyDescriptionProp ?? t("calendar.emptyDescription");
|
|
@@ -11373,7 +12864,7 @@ function AgendaList({ events = sampleEvents, today = sampleToday, from, days = 7
|
|
|
11373
12864
|
className: "divide-y divide-border border-b border-border last:border-b-0",
|
|
11374
12865
|
children: list.map((event) => {
|
|
11375
12866
|
const kind = kindOf(event, kinds);
|
|
11376
|
-
const range = formatRange(event.start, event.end, locale);
|
|
12867
|
+
const range = formatRange(event.start, event.end, clock.locale, clock.hourCycle);
|
|
11377
12868
|
const content = /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
11378
12869
|
/* @__PURE__ */ jsx(EventTile, { kind }),
|
|
11379
12870
|
/* @__PURE__ */ jsxs("span", {
|
|
@@ -11433,7 +12924,7 @@ const meta$1 = {
|
|
|
11433
12924
|
name: "Agenda list",
|
|
11434
12925
|
family: "scheduling",
|
|
11435
12926
|
status: "beta",
|
|
11436
|
-
description: "Upcoming scheduled work grouped by day (Today/Tomorrow labels), each row with a kind tile, time range, location and kind badge; empty state included.",
|
|
12927
|
+
description: "Upcoming scheduled work grouped by day (Today/Tomorrow labels), each row with a kind tile, locale-formatted time range, location and kind badge; empty state included. hourCycle overrides the provider/runtime clock. Locale examples show en-US, es-ES, then en-US with the 24-hour override.",
|
|
11437
12928
|
uses: ["Badge", "EmptyState"]
|
|
11438
12929
|
};
|
|
11439
12930
|
//#endregion
|
|
@@ -11833,7 +13324,7 @@ const globalSearchPages = [
|
|
|
11833
13324
|
id: "page-settings",
|
|
11834
13325
|
label: "Settings",
|
|
11835
13326
|
icon: Settings,
|
|
11836
|
-
shortcut: ["
|
|
13327
|
+
shortcut: ["mod", ","]
|
|
11837
13328
|
}
|
|
11838
13329
|
];
|
|
11839
13330
|
const globalSearchRecords = [
|
|
@@ -11871,7 +13362,7 @@ const globalSearchActions = [
|
|
|
11871
13362
|
id: "action-new-project",
|
|
11872
13363
|
label: "Create project",
|
|
11873
13364
|
icon: FolderPlus,
|
|
11874
|
-
shortcut: ["
|
|
13365
|
+
shortcut: ["mod", "N"],
|
|
11875
13366
|
keywords: ["new"]
|
|
11876
13367
|
},
|
|
11877
13368
|
{
|
|
@@ -12680,7 +14171,7 @@ function isCellEditable(column, row) {
|
|
|
12680
14171
|
}
|
|
12681
14172
|
//#endregion
|
|
12682
14173
|
//#region src/tables/DataTable/data-table-row.tsx
|
|
12683
|
-
function DataTableRow({ labels, row, columns, getRowId, getRowLabel, selectable, selected, singleSelection, onToggleRow, rowActions, layout, onCellEdit, editHintId, ariaRowIndex, style }) {
|
|
14174
|
+
function DataTableRow({ labels, row, columns, getRowId, getRowLabel, selectable, isRowDisabled, selected, singleSelection, onToggleRow, rowActions, layout, onCellEdit, editHintId, ariaRowIndex, style }) {
|
|
12684
14175
|
const { t } = useI18n();
|
|
12685
14176
|
const locale = useOptionalI18n()?.locale;
|
|
12686
14177
|
const id = getRowId(row);
|
|
@@ -12707,6 +14198,7 @@ function DataTableRow({ labels, row, columns, getRowId, getRowLabel, selectable,
|
|
|
12707
14198
|
}) : /* @__PURE__ */ jsx(Checkbox, {
|
|
12708
14199
|
"aria-label": labels?.selectRow?.(label) ?? t("table.selectRow", { label }),
|
|
12709
14200
|
checked: isSelected,
|
|
14201
|
+
disabled: isRowDisabled?.(row),
|
|
12710
14202
|
onCheckedChange: () => onToggleRow(id)
|
|
12711
14203
|
})
|
|
12712
14204
|
}),
|
|
@@ -12751,7 +14243,7 @@ const groupHeadClass = "h-9 bg-secondary/50 text-[12.5px] font-semibold tracking
|
|
|
12751
14243
|
/** The header row of a group: group checkbox, collapse button, label and count. */
|
|
12752
14244
|
function GroupHeaderRow({ labels, group, open, selectable, selected, span, collapsible, onToggle, onToggleRows, ariaRowIndex, style }) {
|
|
12753
14245
|
const { t } = useI18n();
|
|
12754
|
-
const state = selectionState(group.
|
|
14246
|
+
const state = selectionState(group.selectableIds, selected);
|
|
12755
14247
|
const count = group.ids.length;
|
|
12756
14248
|
const heading = /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
12757
14249
|
/* @__PURE__ */ jsx("span", {
|
|
@@ -12780,8 +14272,8 @@ function GroupHeaderRow({ labels, group, open, selectable, selected, span, colla
|
|
|
12780
14272
|
"aria-label": labels?.selectGroup?.(group.name) ?? t("table.selectRow", { label: `all in ${group.name}` }),
|
|
12781
14273
|
checked: state.checked,
|
|
12782
14274
|
indeterminate: state.indeterminate,
|
|
12783
|
-
disabled:
|
|
12784
|
-
onCheckedChange: () => onToggleRows?.(group.
|
|
14275
|
+
disabled: group.selectableIds.length === 0,
|
|
14276
|
+
onCheckedChange: () => onToggleRows?.(group.selectableIds)
|
|
12785
14277
|
})
|
|
12786
14278
|
}), /* @__PURE__ */ jsx(TableHead, {
|
|
12787
14279
|
scope: "rowgroup",
|
|
@@ -13291,10 +14783,7 @@ function useSingleSelection(options) {
|
|
|
13291
14783
|
}
|
|
13292
14784
|
};
|
|
13293
14785
|
}
|
|
13294
|
-
function useSingleSelectionWarnings({ single, selectionName,
|
|
13295
|
-
useEffect(() => {
|
|
13296
|
-
if (single && paginated === true && process.env.NODE_ENV === "development") console.warn("DataTable single selection: paginated=true is unsupported; rendering all rows without pagination.");
|
|
13297
|
-
}, [single, paginated]);
|
|
14786
|
+
function useSingleSelectionWarnings({ single, selectionName, hasLabel }) {
|
|
13298
14787
|
useEffect(() => {
|
|
13299
14788
|
if (!single || process.env.NODE_ENV !== "development") return;
|
|
13300
14789
|
if (!hasLabel) console.warn("DataTable single selection: supply legend, aria-label or aria-labelledby.");
|
|
@@ -13323,6 +14812,24 @@ function SelectionGroup({ single, legend, children, ...label }) {
|
|
|
13323
14812
|
});
|
|
13324
14813
|
}
|
|
13325
14814
|
//#endregion
|
|
14815
|
+
//#region src/tables/DataTable/selection-strip.tsx
|
|
14816
|
+
/** The same button stays mounted as the announcement and action change. */
|
|
14817
|
+
function SelectionStrip({ all, message, total, onSelectAll, onClear, labels }) {
|
|
14818
|
+
const { t, formatNumber } = useI18n();
|
|
14819
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
14820
|
+
className: "flex flex-wrap items-center gap-2 border-b border-border bg-secondary/30 px-3 py-2 text-sm text-foreground",
|
|
14821
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
14822
|
+
"aria-hidden": "true",
|
|
14823
|
+
children: message
|
|
14824
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
14825
|
+
variant: "soft",
|
|
14826
|
+
size: "sm",
|
|
14827
|
+
onClick: all ? onClear : onSelectAll,
|
|
14828
|
+
children: all ? labels?.clearSelection ?? t("common.clearSelection") : labels?.selectAllMatching?.(total) ?? t("table.selectAllMatching", { count: formatNumber(total) })
|
|
14829
|
+
})]
|
|
14830
|
+
});
|
|
14831
|
+
}
|
|
14832
|
+
//#endregion
|
|
13326
14833
|
//#region src/tables/DataTable/views.tsx
|
|
13327
14834
|
const norm = (s) => JSON.stringify({
|
|
13328
14835
|
filters: s.filters ?? null,
|
|
@@ -13523,6 +15030,83 @@ function useTableViews({ views: viewsProp, defaultViews = [], onViewsChange, act
|
|
|
13523
15030
|
};
|
|
13524
15031
|
}
|
|
13525
15032
|
//#endregion
|
|
15033
|
+
//#region src/tables/DataTable/use-multiple-selection.ts
|
|
15034
|
+
/** Owns include/exclude selection independently of the currently supplied server page. */
|
|
15035
|
+
function useMultipleSelection(options) {
|
|
15036
|
+
const needsModelCallback = options.serverMode && options.selectAllMatching && !options.onSelectionModelChange;
|
|
15037
|
+
useEffect(() => {
|
|
15038
|
+
if (needsModelCallback && process.env.NODE_ENV === "development") console.warn("DataTable selectAllMatching with server pagination requires onSelectionModelChange.");
|
|
15039
|
+
}, [needsModelCallback]);
|
|
15040
|
+
const [inner, setInner] = useState(() => ({
|
|
15041
|
+
type: "include",
|
|
15042
|
+
ids: [...options.defaultSelectedIds]
|
|
15043
|
+
}));
|
|
15044
|
+
const model = options.selectionModel ?? (options.selectedIds ? {
|
|
15045
|
+
type: "include",
|
|
15046
|
+
ids: [...options.selectedIds]
|
|
15047
|
+
} : inner);
|
|
15048
|
+
const modelIds = new Set(model.ids);
|
|
15049
|
+
const selected = new Set(model.type === "exclude" ? options.enabledIds.filter((id) => !modelIds.has(id)) : model.ids);
|
|
15050
|
+
const report = (next) => {
|
|
15051
|
+
const ids = new Set(next.ids);
|
|
15052
|
+
if (next.type === "exclude") return options.enabledIds.filter((id) => !ids.has(id));
|
|
15053
|
+
return options.preserveSelection ? [...next.ids] : options.rowIds.filter((id) => ids.has(id));
|
|
15054
|
+
};
|
|
15055
|
+
const selectedList = report(model);
|
|
15056
|
+
const change = (next) => {
|
|
15057
|
+
setInner(next);
|
|
15058
|
+
options.onSelectionChange?.(report(next));
|
|
15059
|
+
options.onSelectionModelChange?.(next);
|
|
15060
|
+
};
|
|
15061
|
+
const filterKey = JSON.stringify(options.filters);
|
|
15062
|
+
const previousFilters = useRef(filterKey);
|
|
15063
|
+
const resetForFilters = useEffectEvent(() => {
|
|
15064
|
+
if (model.type === "exclude") change({
|
|
15065
|
+
type: "include",
|
|
15066
|
+
ids: []
|
|
15067
|
+
});
|
|
15068
|
+
});
|
|
15069
|
+
useEffect(() => {
|
|
15070
|
+
if (previousFilters.current !== filterKey) {
|
|
15071
|
+
previousFilters.current = filterKey;
|
|
15072
|
+
resetForFilters();
|
|
15073
|
+
}
|
|
15074
|
+
}, [filterKey]);
|
|
15075
|
+
return {
|
|
15076
|
+
selected,
|
|
15077
|
+
selectedList,
|
|
15078
|
+
model,
|
|
15079
|
+
selectedCount: model.type === "exclude" ? Math.max(0, options.total - model.ids.length) : selectedList.length,
|
|
15080
|
+
allMatchingSelected: model.type === "exclude" || options.enabledIds.length > 0 && options.enabledIds.every((id) => selected.has(id)),
|
|
15081
|
+
selectAllMatching: () => change(options.serverMode ? {
|
|
15082
|
+
type: "exclude",
|
|
15083
|
+
ids: options.rowIds.filter((id) => !options.enabledIds.includes(id))
|
|
15084
|
+
} : {
|
|
15085
|
+
type: "include",
|
|
15086
|
+
ids: options.enabledIds
|
|
15087
|
+
}),
|
|
15088
|
+
clear: () => change({
|
|
15089
|
+
type: "include",
|
|
15090
|
+
ids: []
|
|
15091
|
+
}),
|
|
15092
|
+
setSelected: (next) => {
|
|
15093
|
+
if (model.type === "include") change({
|
|
15094
|
+
type: "include",
|
|
15095
|
+
ids: [...next]
|
|
15096
|
+
});
|
|
15097
|
+
else {
|
|
15098
|
+
const excluded = new Set(model.ids);
|
|
15099
|
+
for (const id of options.enabledIds) if (next.has(id)) excluded.delete(id);
|
|
15100
|
+
else excluded.add(id);
|
|
15101
|
+
change({
|
|
15102
|
+
type: "exclude",
|
|
15103
|
+
ids: [...excluded]
|
|
15104
|
+
});
|
|
15105
|
+
}
|
|
15106
|
+
}
|
|
15107
|
+
};
|
|
15108
|
+
}
|
|
15109
|
+
//#endregion
|
|
13526
15110
|
//#region src/tables/DataTable/use-virtual-rows.ts
|
|
13527
15111
|
/** Computes a virtual window from the table container's scroll position. */
|
|
13528
15112
|
function windowFor(count, scrollTop, viewport, rowHeight, overscan) {
|
|
@@ -13594,25 +15178,25 @@ const ROW_HEIGHT = {
|
|
|
13594
15178
|
* and empty states, client-side sort + pagination, optional collapsible row groups (`groupBy`),
|
|
13595
15179
|
* column resize and pinning, row virtualization, inline cell editing and saved views.
|
|
13596
15180
|
*/
|
|
13597
|
-
function DataTable({ rows = DEPLOYMENT_ROWS, columns = DEPLOYMENT_COLUMNS, getRowId = defaultRowId, getRowLabel, caption = "Deployments", showCaption = false, selectable: selectableProp = true, selectionMode, selectionName, legend, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, selectedId, defaultSelectedId, onSelectedIdChange, isRowDisabled, selectedIds, defaultSelectedIds = [], onSelectionChange, bulkActions, selectionSummary = true, rowActions, sort: sortProp, defaultSort = null, onSortChange, manualSorting = false, paginated: paginatedProp, paginationMode = "client", rowCount, page: controlledPage, pageSize: controlledPageSize, onPageChange, onPageSizeChange, defaultPageSize = 10, pageSizeOptions = [
|
|
15181
|
+
function DataTable({ rows = DEPLOYMENT_ROWS, columns = DEPLOYMENT_COLUMNS, getRowId = defaultRowId, getRowLabel, caption = "Deployments", showCaption = false, selectable: selectableProp = true, selectionMode, selectionName, legend, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, selectedId, defaultSelectedId, onSelectedIdChange, isRowDisabled, selectedIds, defaultSelectedIds = [], onSelectionChange, preserveSelection, selectAllMatching = false, hideSelectAll = false, selectionModel, onSelectionModelChange, bulkActions, selectionSummary = true, rowActions, sort: sortProp, defaultSort = null, onSortChange, manualSorting = false, paginated: paginatedProp, paginationMode = "client", rowCount, page: controlledPage, pageSize: controlledPageSize, onPageChange, onPageSizeChange, defaultPageSize = 10, pageSizeOptions = [
|
|
13598
15182
|
10,
|
|
13599
15183
|
25,
|
|
13600
15184
|
50
|
|
13601
15185
|
], density: densityProp, defaultDensity, onDensityChange, showDensityToggle = true, showColumnMenu = true, loading = false, loadingRows = 5, emptyState, groupBy, groupLabel, collapsibleGroups = true, collapsedGroups: collapsedProp, defaultCollapsedGroups = [], onCollapsedGroupsChange, onGroupByChange, hiddenColumns: hiddenProp, onHiddenColumnsChange, resizable = false, columnWidths: widthsProp, defaultColumnWidths = EMPTY_WIDTHS, onColumnWidthsChange, pinnedColumns: pinnedProp, defaultPinnedColumns = EMPTY_PINNED, onPinnedColumnsChange, showPinMenu, virtualize = "auto", virtualizeThreshold = 100, rowHeight: rowHeightProp, virtualContainerClassName = "max-h-[32rem]", onCellEdit, views: viewsProp, defaultViews, onViewsChange, activeViewId, defaultActiveViewId, onActiveViewChange, showViewSwitcher, filters, onFiltersChange, toolbar, className, labels }) {
|
|
13602
|
-
const { t } = useI18n();
|
|
15186
|
+
const { t, formatNumber } = useI18n();
|
|
13603
15187
|
const singleMode = selectionMode === "single";
|
|
13604
15188
|
const serverMode = paginationMode === "server";
|
|
13605
15189
|
const selectable = selectionMode === void 0 ? selectableProp : selectionMode === "multiple";
|
|
13606
15190
|
const selectionColumn = selectable || singleMode;
|
|
13607
|
-
const paginated =
|
|
15191
|
+
const paginated = paginatedProp ?? (serverMode || !singleMode);
|
|
13608
15192
|
const editHintId = useId();
|
|
13609
15193
|
const tableRef = useRef(null);
|
|
15194
|
+
const pageCheckboxRef = useRef(null);
|
|
13610
15195
|
const [initialView] = useState(() => (viewsProp ?? defaultViews ?? []).find((v) => v.id === (activeViewId ?? defaultActiveViewId)));
|
|
13611
15196
|
const [initialFilters] = useState(() => filters);
|
|
13612
15197
|
const seed = initialView?.state ?? {};
|
|
13613
15198
|
const defaultHidden = columns.filter((c) => c.defaultHidden).map((c) => c.id);
|
|
13614
15199
|
const [innerSort, setInnerSort] = useState(seed.sort !== void 0 ? seed.sort : defaultSort);
|
|
13615
|
-
const [innerSelected, setInnerSelected] = useState(() => new Set(defaultSelectedIds));
|
|
13616
15200
|
const [innerDensity, setInnerDensity] = useState(defaultDensity ?? null);
|
|
13617
15201
|
const contextDensity = useDensity();
|
|
13618
15202
|
const [hiddenList, setHiddenList] = useControllable(hiddenProp, () => seed.hiddenColumns ?? defaultHidden, (ids) => onHiddenColumnsChange?.([...ids]));
|
|
@@ -13624,7 +15208,21 @@ function DataTable({ rows = DEPLOYMENT_ROWS, columns = DEPLOYMENT_COLUMNS, getRo
|
|
|
13624
15208
|
const hidden = new Set(hiddenList);
|
|
13625
15209
|
const effectiveGroupBy = groupOverride === void 0 ? groupBy : groupOverride ?? void 0;
|
|
13626
15210
|
const sort = sortProp === void 0 ? innerSort : sortProp;
|
|
13627
|
-
const
|
|
15211
|
+
const enabledIds = rows.filter((row) => !isRowDisabled?.(row)).map(getRowId);
|
|
15212
|
+
const { selected, selectedList, setSelected, model, selectedCount, allMatchingSelected, selectAllMatching: selectMatching, clear } = useMultipleSelection({
|
|
15213
|
+
rowIds: rows.map(getRowId),
|
|
15214
|
+
selectedIds,
|
|
15215
|
+
defaultSelectedIds,
|
|
15216
|
+
onSelectionChange,
|
|
15217
|
+
preserveSelection: preserveSelection ?? serverMode,
|
|
15218
|
+
enabledIds,
|
|
15219
|
+
selectionModel,
|
|
15220
|
+
onSelectionModelChange,
|
|
15221
|
+
serverMode,
|
|
15222
|
+
selectAllMatching: selectable && selectAllMatching,
|
|
15223
|
+
total: rowCount ?? rows.length,
|
|
15224
|
+
filters
|
|
15225
|
+
});
|
|
13628
15226
|
const density = densityProp ?? innerDensity ?? contextDensity;
|
|
13629
15227
|
const visibleColumns = orderColumns(columns.filter((c) => !hidden.has(c.id)), pinned);
|
|
13630
15228
|
const labelOf = getRowLabel ?? ((row) => {
|
|
@@ -13637,13 +15235,8 @@ function DataTable({ rows = DEPLOYMENT_ROWS, columns = DEPLOYMENT_COLUMNS, getRo
|
|
|
13637
15235
|
const allGroups = effectiveGroupBy ? groupRows(sortedRows, effectiveGroupBy, rows) : null;
|
|
13638
15236
|
const sorted = allGroups ? allGroups.flatMap((g) => g.rows) : sortedRows;
|
|
13639
15237
|
const pageRows = serverMode ? rows : paginated ? paginate(sorted, page, pageSize) : sorted;
|
|
13640
|
-
const pageIds = (effectiveGroupBy ? pageRows.filter((row) => !collapsed.has(groupKeyOf(row, effectiveGroupBy))) : pageRows).map(getRowId);
|
|
15238
|
+
const pageIds = (effectiveGroupBy ? pageRows.filter((row) => !collapsed.has(groupKeyOf(row, effectiveGroupBy))) : pageRows).filter((row) => !isRowDisabled?.(row)).map(getRowId);
|
|
13641
15239
|
const header = selectionState(pageIds, selected);
|
|
13642
|
-
const selectedList = rows.map(getRowId).filter((id) => selected.has(id));
|
|
13643
|
-
const setSelected = (next) => {
|
|
13644
|
-
setInnerSelected(next);
|
|
13645
|
-
onSelectionChange?.(rows.map(getRowId).filter((id) => next.has(id)));
|
|
13646
|
-
};
|
|
13647
15240
|
const changeSort = (columnId, direction) => {
|
|
13648
15241
|
if (serverMode) return;
|
|
13649
15242
|
const next = {
|
|
@@ -13667,7 +15260,8 @@ function DataTable({ rows = DEPLOYMENT_ROWS, columns = DEPLOYMENT_COLUMNS, getRo
|
|
|
13667
15260
|
label: groupLabel ? groupLabel(g.key, g.rows) : nameOf(g.key),
|
|
13668
15261
|
name: nameOf(g.key),
|
|
13669
15262
|
rows: pageRows.filter((row) => groupKeyOf(row, effectiveGroupBy) === g.key),
|
|
13670
|
-
ids: g.rows.map(getRowId)
|
|
15263
|
+
ids: g.rows.map(getRowId),
|
|
15264
|
+
selectableIds: g.rows.filter((row) => !isRowDisabled?.(row)).map(getRowId)
|
|
13671
15265
|
})).filter((g) => g.rows.length > 0) : void 0;
|
|
13672
15266
|
const groupsForBody = bodyGroups && bodyGroups.length > 0 ? bodyGroups : void 0;
|
|
13673
15267
|
const singleSelection = useSingleSelection({
|
|
@@ -13683,7 +15277,6 @@ function DataTable({ rows = DEPLOYMENT_ROWS, columns = DEPLOYMENT_COLUMNS, getRo
|
|
|
13683
15277
|
useSingleSelectionWarnings({
|
|
13684
15278
|
single: singleMode,
|
|
13685
15279
|
selectionName,
|
|
13686
|
-
paginated: paginatedProp,
|
|
13687
15280
|
hasLabel: Boolean(legend || ariaLabel?.trim() || ariaLabelledBy?.trim()) || typeof legend === "number" || typeof legend === "bigint"
|
|
13688
15281
|
});
|
|
13689
15282
|
const changeDensity = (next) => {
|
|
@@ -13755,28 +15348,37 @@ function DataTable({ rows = DEPLOYMENT_ROWS, columns = DEPLOYMENT_COLUMNS, getRo
|
|
|
13755
15348
|
tableRef,
|
|
13756
15349
|
viewportHeight: 512
|
|
13757
15350
|
});
|
|
13758
|
-
const hasSelection = selectable &&
|
|
15351
|
+
const hasSelection = selectable && selectedCount > 0 && (selectionSummary || bulkActions != null);
|
|
13759
15352
|
const showToolbar = toolbar != null || showDensityToggle || showColumnMenu || showViews || hasSelection;
|
|
13760
15353
|
const anyEditable = onCellEdit != null && columns.some((c) => c.editable);
|
|
15354
|
+
const showSelectionStrip = selectable && selectAllMatching && (!serverMode || !!onSelectionModelChange) && (header.checked || model.type === "exclude" || !serverMode && allMatchingSelected) && (serverMode ? (rowCount ?? 0) > rows.length : enabledIds.length > pageIds.length);
|
|
15355
|
+
const allMatching = serverMode ? model.type === "exclude" : allMatchingSelected;
|
|
15356
|
+
const matchingCount = serverMode ? selectedCount : enabledIds.length;
|
|
15357
|
+
const stripMessage = allMatching ? labels?.allMatchingSelected?.(matchingCount) ?? t("table.allMatchingSelected", { count: formatNumber(matchingCount) }) : labels?.pageSelected?.(pageIds.length) ?? t("table.pageSelected", { count: formatNumber(pageIds.length) });
|
|
15358
|
+
const selectionCount = labels?.selectionCount ? labels.selectionCount(selectedCount) : /* @__PURE__ */ jsxs(Fragment$1, { children: [selectedCount, " selected"] });
|
|
13761
15359
|
return /* @__PURE__ */ jsxs("div", {
|
|
13762
15360
|
className: cn("overflow-hidden rounded-xl border border-border bg-card shadow-sm", className),
|
|
13763
15361
|
children: [
|
|
13764
|
-
|
|
13765
|
-
className: cn("flex min-h-12 flex-wrap items-center gap-2 border-b border-border px-3 py-2 transition-colors motion-reduce:transition-none", hasSelection ? "bg-primary/8" : "bg-secondary/30"),
|
|
13766
|
-
children: [/* @__PURE__ */
|
|
15362
|
+
/* @__PURE__ */ jsxs("div", {
|
|
15363
|
+
className: cn(!showToolbar && "sr-only", "flex min-h-12 flex-wrap items-center gap-2 border-b border-border px-3 py-2 transition-colors motion-reduce:transition-none", hasSelection ? "bg-primary/8" : "bg-secondary/30"),
|
|
15364
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
13767
15365
|
className: "flex min-w-0 flex-1 flex-wrap items-center gap-2",
|
|
13768
|
-
children: hasSelection
|
|
13769
|
-
selectionSummary &&
|
|
15366
|
+
children: [selectable && (selectAllMatching || hasSelection && selectionSummary) && /* @__PURE__ */ jsx("span", {
|
|
15367
|
+
className: hasSelection && selectionSummary && !showSelectionStrip ? "text-[12.5px] font-semibold text-foreground" : "sr-only",
|
|
15368
|
+
"aria-live": "polite",
|
|
15369
|
+
"aria-atomic": "true",
|
|
15370
|
+
children: showSelectionStrip ? stripMessage : hasSelection && selectionSummary ? selectionCount : null
|
|
15371
|
+
}), hasSelection ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
15372
|
+
selectionSummary && showSelectionStrip && /* @__PURE__ */ jsx("span", {
|
|
13770
15373
|
className: "text-[12.5px] font-semibold text-foreground",
|
|
13771
|
-
|
|
13772
|
-
children: labels?.selectionCount ? labels.selectionCount(selectedList.length) : /* @__PURE__ */ jsxs(Fragment$1, { children: [selectedList.length, " selected"] })
|
|
15374
|
+
children: selectionCount
|
|
13773
15375
|
}),
|
|
13774
15376
|
selectionSummary && bulkActions && /* @__PURE__ */ jsx("span", {
|
|
13775
15377
|
"aria-hidden": true,
|
|
13776
15378
|
className: "h-4 w-px bg-border"
|
|
13777
15379
|
}),
|
|
13778
|
-
bulkActions?.(selectedList)
|
|
13779
|
-
] }) : toolbar
|
|
15380
|
+
bulkActions?.(selectedList, model)
|
|
15381
|
+
] }) : toolbar]
|
|
13780
15382
|
}), /* @__PURE__ */ jsxs("div", {
|
|
13781
15383
|
className: "flex items-center gap-2",
|
|
13782
15384
|
children: [
|
|
@@ -13808,6 +15410,17 @@ function DataTable({ rows = DEPLOYMENT_ROWS, columns = DEPLOYMENT_COLUMNS, getRo
|
|
|
13808
15410
|
]
|
|
13809
15411
|
})]
|
|
13810
15412
|
}),
|
|
15413
|
+
showSelectionStrip && /* @__PURE__ */ jsx(SelectionStrip, {
|
|
15414
|
+
labels,
|
|
15415
|
+
all: allMatching,
|
|
15416
|
+
message: stripMessage,
|
|
15417
|
+
total: serverMode ? rowCount ?? 0 : enabledIds.length,
|
|
15418
|
+
onSelectAll: selectMatching,
|
|
15419
|
+
onClear: () => {
|
|
15420
|
+
(hideSelectAll || loading || pageIds.length === 0 ? tableRef : pageCheckboxRef).current?.focus();
|
|
15421
|
+
clear();
|
|
15422
|
+
}
|
|
15423
|
+
}),
|
|
13811
15424
|
anyEditable && /* @__PURE__ */ jsx("span", {
|
|
13812
15425
|
id: editHintId,
|
|
13813
15426
|
className: "sr-only",
|
|
@@ -13822,12 +15435,13 @@ function DataTable({ rows = DEPLOYMENT_ROWS, columns = DEPLOYMENT_COLUMNS, getRo
|
|
|
13822
15435
|
density,
|
|
13823
15436
|
children: /* @__PURE__ */ jsxs(Table, {
|
|
13824
15437
|
ref: tableRef,
|
|
15438
|
+
tabIndex: selectable && selectAllMatching ? -1 : void 0,
|
|
13825
15439
|
"aria-busy": loading || void 0,
|
|
13826
15440
|
"aria-rowcount": virtual ? items + 1 : void 0,
|
|
13827
15441
|
stickyHeader: virtualOn,
|
|
13828
15442
|
containerClassName: virtualOn ? virtualContainerClassName : void 0,
|
|
13829
15443
|
containerLabel: virtualOn ? caption : labels?.scrollRegion,
|
|
13830
|
-
className: cn(layout.tableClassName, singleMode && "[&_[data-column-resizer]]:end-0 [&_[data-column-resizer]]:justify-end"),
|
|
15444
|
+
className: cn(layout.tableClassName, selectable && selectAllMatching && "focus-visible:outline-2 focus-visible:outline-focus-ring", singleMode && "[&_[data-column-resizer]]:end-0 [&_[data-column-resizer]]:justify-end"),
|
|
13831
15445
|
style: layout.tableStyle,
|
|
13832
15446
|
"data-virtualized": virtualOn || void 0,
|
|
13833
15447
|
children: [
|
|
@@ -13842,10 +15456,11 @@ function DataTable({ rows = DEPLOYMENT_ROWS, columns = DEPLOYMENT_COLUMNS, getRo
|
|
|
13842
15456
|
selectionColumn && /* @__PURE__ */ jsxs(TableHead, {
|
|
13843
15457
|
className: cn("w-10 pe-0", layout.lead.className, layout.lead.pinned && "z-[11] bg-card", stickyTint(layout.lead, { head: true })),
|
|
13844
15458
|
style: layout.lead.style,
|
|
13845
|
-
children: [singleMode && /* @__PURE__ */ jsx("span", {
|
|
15459
|
+
children: [(singleMode || hideSelectAll) && /* @__PURE__ */ jsx("span", {
|
|
13846
15460
|
className: "sr-only",
|
|
13847
15461
|
children: labels?.selection ?? t("table.selection")
|
|
13848
|
-
}), selectable && /* @__PURE__ */ jsx(Checkbox, {
|
|
15462
|
+
}), selectable && !hideSelectAll && /* @__PURE__ */ jsx(Checkbox, {
|
|
15463
|
+
ref: pageCheckboxRef,
|
|
13849
15464
|
"aria-label": labels?.selectAll ?? t("table.selectAllPage"),
|
|
13850
15465
|
checked: header.checked,
|
|
13851
15466
|
indeterminate: header.indeterminate,
|
|
@@ -13889,6 +15504,7 @@ function DataTable({ rows = DEPLOYMENT_ROWS, columns = DEPLOYMENT_COLUMNS, getRo
|
|
|
13889
15504
|
getRowId,
|
|
13890
15505
|
getRowLabel: labelOf,
|
|
13891
15506
|
selectable,
|
|
15507
|
+
isRowDisabled,
|
|
13892
15508
|
selected,
|
|
13893
15509
|
singleSelection: singleMode ? singleSelection : void 0,
|
|
13894
15510
|
onToggleRow: (id) => setSelected(toggleOne(id, selected)),
|
|
@@ -13939,7 +15555,7 @@ const meta$16 = {
|
|
|
13939
15555
|
name: "Data table",
|
|
13940
15556
|
family: "tables",
|
|
13941
15557
|
status: "beta",
|
|
13942
|
-
description: "Generic typed table: sortable headers with aria-sort, row selection with select-all and indeterminate by default (selectionMode=\"multiple\"), selectionMode=\"none\" to hide selection, column visibility menu, density toggle, row actions, loading and empty states, client-side sort and pagination, optional row groups (groupBy) with rowgroup header rows, counts, keyboard-accessible collapse buttons and group selection; column resize (pointer drag or a focusable role=\"separator\" handle with arrow keys, min/max widths, controlled columnWidths), column pinning to either edge with sticky cells (column menu or pinnedColumns), row virtualization for large datasets (aria-rowcount/aria-rowindex, works with selection and grouping), inline cell editing (text, number and select editors; Enter/F2 to edit, Enter/Tab to commit, Escape to cancel, onCellEdit can reject with an inline error) and saved views (filters, sort, visible columns, widths, pinning and grouping) with a view switcher to save as, rename, delete and reset. Opt-in selectionMode=\"single\" uses native radios in a labelled fieldset (never
|
|
15558
|
+
description: "Generic typed table: sortable headers with aria-sort, row selection with select-all and indeterminate by default (selectionMode=\"multiple\"), selectionMode=\"none\" to hide selection, column visibility menu, density toggle, row actions, loading and empty states, client-side sort and pagination, optional row groups (groupBy) with rowgroup header rows, counts, keyboard-accessible collapse buttons and group selection; column resize (pointer drag or a focusable role=\"separator\" handle with arrow keys, min/max widths, controlled columnWidths), column pinning to either edge with sticky cells (column menu or pinnedColumns), row virtualization for large datasets (aria-rowcount/aria-rowindex, works with selection and grouping), inline cell editing (text, number and select editors; Enter/F2 to edit, Enter/Tab to commit, Escape to cancel, onCellEdit can reject with an inline error) and saved views (filters, sort, visible columns, widths, pinning and grouping) with a view switcher to save as, rename, delete and reset. Opt-in selectionMode=\"single\" uses native radios in a labelled fieldset (never virtualized; client pagination defaults to false, and paginated=true or paginationMode=\"server\" enables pagination). Single mode uses selectedId/onSelectedIdChange or defaultSelectedId; isRowDisabled skips unavailable rows and preserves a checked disabled choice without callbacks. Supply legend, aria-label or aria-labelledby for the group and getRowLabel for each radio (otherwise the first column labels it). selectionName is used verbatim and must be unique per page; omitted names use an instance-unique useId name, and duplicate supplied names or missing group labels warn in development. Tab enters once on the checked enabled row or first enabled row; arrows wrap and skip disabled rows, Space selects, Shift+Tab exits, and all-disabled groups have no tab stop. No select-all, group checkboxes, bulk actions or selection summary appear in single mode. Examples in examples/single-selection.tsx: an uncontrolled non-paginated list with legend=\"Available items\" and a controlled versions table with legend=\"Available versions\", selectedId=\"v2\" and a checked disabled version. Opt-in paginationMode=\"server\" accepts a controlled 1-based page, pageSize and required rowCount (known total), with onPageChange/onPageSizeChange requests. Supplied rows render in order without client sorting or slicing, and headers have no sort affordance. Single selection keeps its chosen id across pages. Off-page choices leave every visible radio unchecked and the first enabled radio is the tab stop; name the current choice in the legend. See examples/paginated-single-selection.tsx for client and server pagination. The footer stays visible for empty results, clamps stale pages for display without callbacks, and hides during loading. Page-size changes may also request a page to keep the first visible row on screen. The consumer owns fetching and reconciles stale pages. See examples/server-pagination.tsx for an items/total/page/pageSize envelope consumer that handles both callbacks. Multiple selection preserves ids from other server pages by default; preserveSelection=false restores page-only reporting, and client tables can opt in with preserveSelection=true. selectedIds remains supported. A controlled selectionModel takes precedence and uses { type: \"include\", ids: string[] } for selected ids or { type: \"exclude\", ids: string[] } for every match except those ids. bulkActions(ids, model) receives the full include list; in exclude mode ids contains enabled selections in the current rows and the model is authoritative. One-argument actions remain compatible. selectAllMatching defaults to false and offers a strip after the page is fully selected: client mode includes every enabled row, while server mode requires onSelectionModelChange and reports an exclude model. The same button becomes Clear selection without moving focus; clearing returns focus to the page checkbox, or to the table when the checkbox is hidden or unavailable. An exclude model resets through both callbacks when filters changes by JSON value; filters must include every narrowing input, including search text. Paging, page size and sorting preserve selection. An exclude action covers the matching result set at action time, including later-created rows; the consumer executes it. isRowDisabled disables multiple-selection checkboxes and page/group/all-matching toggles skip known disabled rows. Server counts use rowCount minus explicit excluded ids, including disabled ids on the page where Select all is activated. isRowDisabled cannot evaluate unloaded rows, so the server must enforce eligibility for the complete matching result set; return only eligible matches and their rowCount when counts must exclude all unavailable rows. hideSelectAll defaults to false and hides just the header checkbox, retaining an accessible Selection heading. See examples/client-selection.tsx for client preservation, disabled rows and select-all-matching, and examples/server-pagination.tsx for controlled models, cross-page actions and the preservation/header options.",
|
|
13943
15559
|
labels: [
|
|
13944
15560
|
{
|
|
13945
15561
|
key: "booleanTrue",
|
|
@@ -13961,6 +15577,26 @@ const meta$16 = {
|
|
|
13961
15577
|
type: "(count: number) => string",
|
|
13962
15578
|
state: "Multiple selection: toolbar count and polite live region"
|
|
13963
15579
|
},
|
|
15580
|
+
{
|
|
15581
|
+
key: "pageSelected",
|
|
15582
|
+
type: "(count: number) => string",
|
|
15583
|
+
state: "Matching-selection strip: selected page announcement"
|
|
15584
|
+
},
|
|
15585
|
+
{
|
|
15586
|
+
key: "selectAllMatching",
|
|
15587
|
+
type: "(count: number) => string",
|
|
15588
|
+
state: "Matching-selection strip: select every enabled match"
|
|
15589
|
+
},
|
|
15590
|
+
{
|
|
15591
|
+
key: "allMatchingSelected",
|
|
15592
|
+
type: "(count: number) => string",
|
|
15593
|
+
state: "Matching-selection strip: all-matching announcement"
|
|
15594
|
+
},
|
|
15595
|
+
{
|
|
15596
|
+
key: "clearSelection",
|
|
15597
|
+
type: "string",
|
|
15598
|
+
state: "Matching-selection strip: clear action"
|
|
15599
|
+
},
|
|
13964
15600
|
{
|
|
13965
15601
|
key: "columns",
|
|
13966
15602
|
type: "string",
|
|
@@ -14109,7 +15745,7 @@ const meta$16 = {
|
|
|
14109
15745
|
{
|
|
14110
15746
|
key: "selection",
|
|
14111
15747
|
type: "string",
|
|
14112
|
-
state: "Single selection: screen reader column heading"
|
|
15748
|
+
state: "Single selection or hideSelectAll: screen reader column heading"
|
|
14113
15749
|
},
|
|
14114
15750
|
{
|
|
14115
15751
|
key: "selectAll",
|
|
@@ -16007,6 +17643,6 @@ const meta$59 = {
|
|
|
16007
17643
|
]
|
|
16008
17644
|
};
|
|
16009
17645
|
//#endregion
|
|
16010
|
-
export { ASSISTANT_STATUSES, ActivityFeed, AgendaList, AppSidebar, AppSidebarFooter, AppSidebarHeader, AppSidebarNav, AppTopbar, AssistantCardGrid, AuthDivider, AuthHeader, BulkActionBar, COLUMN_VARIANT_CLASSES, COMMENT_AUTHOR, COST_BY_RANGE, COST_RANGES, ChartCard, CodePanel, ColumnResizeHandle, ColumnVisibilityMenu, CommentThread, ComparisonTable, ConfirmDestructive, ConfirmDestructiveDialog, CostBreakdown, CreateApiKeyDialog, CredentialDisclosureDialog, CursorPagerFooter, DEFAULT_COLUMN_WIDTH, DEPLOYMENT_COLUMNS, DEPLOYMENT_DEFAULT_FILTERS, DEPLOYMENT_DETAILS, DEPLOYMENT_EVENTS, DEPLOYMENT_FILTER_FIELDS, DEPLOYMENT_ROWS, DEPLOYMENT_SAVED_VIEWS, DangerZone, DataTable, ViewSwitcher as DataTableViewSwitcher, DateRangeFilter, DensityToggle, DescriptionListCard, DialogWizard, EDITABLE_MEMBERS, EDITABLE_MEMBER_FIELDS, EditableCell, EnvironmentBadge, ErrorPanel, EvaluationScorecard, Faq, FeatureGrid, FileUploadPanel, FilterBar, FirstRunEmpty, FlowBuilder, ForgotPasswordForm, FormSection, GlobalSearch, Hero, HeroScreenshotPlaceholder, InlineCallout, InlineEditRow, InlineEditTable, InviteMembersDialog, InvoiceTable, KPI_ITEMS, KpiRow, LOG_LEVELS, ListSkeleton, LoadMoreFooter, LogViewer, MAX_COLUMN_WIDTH, MIN_COLUMN_WIDTH, MODEL_KEY_STATUSES, MembersTable, MfaChallenge, ModelKeysList, MonthCalendar, NoAccessEmpty, NoResultsEmpty, NodeInspector, NodePalette, NotFoundEmpty, NotificationMatrix, PROJECT_ACTIVITY, PageHeader, PageSkeleton, PageToolbar, PaginationFooter, PaymentMethodCard, PendingInvitations, PlanCard, PlanDefinitionCard, PricingTable, ProfileHeader, PromptEditor, QuotaMeters, RESOURCE_CARDS, REVIEW_COMMENTS, ResetPasswordForm, ResourceCardGrid, RunConsole, SPAN_STATUSES, STAT_RANGES, SectionHeader, SessionsDevices, SettingsRow, SignInForm, SignUpForm, SpanDetails, SpendVsBudget, SsoButtons, StatCard, StatusTimeline, StickyActionBar, SubordinateList, SystemBanner, TRAFFIC_BUCKETS, TRAFFIC_BY_RANGE, TRAFFIC_RANGES, TableSkeleton, TimeSlotPicker, TokenCostCard, TraceWaterfall, TrendDelta, TruncatedCollectionFooter, ValidationSummary, WeekCalendar, meta as activityFeedMeta, meta$1 as agendaListMeta, apiKeyExpiries, apiKeyScopes, meta$2 as appSidebarMeta, appSidebarNavGroups, appSidebarUsage, appSidebarUser, appSidebarWorkspaces, appTopbarBreadcrumbs, meta$3 as appTopbarMeta, appTopbarNotifications, meta$4 as assistantCardGridMeta, meta$5 as bulkActionBarMeta, meta$6 as chartCardMeta, clampColumnWidth, meta$7 as codePanelMeta, columnAlign, columnWidthOf, meta$8 as commentThreadMeta, compareValues, meta$9 as comparisonTableMeta, meta$10 as confirmDestructiveMeta, meta$11 as costBreakdownMeta, meta$12 as createApiKeyDialogMeta, meta$13 as credentialDisclosureDialogMeta, meta$14 as cursorPagerFooterMeta, dangerZoneActions, meta$15 as dangerZoneMeta, meta$16 as dataTableMeta, meta$17 as dateRangeFilterMeta, defaultEventKinds, meta$18 as descriptionListCardMeta, dialogWizardCopy, meta$19 as dialogWizardMeta, dialogWizardSteps, meta$20 as emptyStatesMeta, meta$21 as environmentBadgeMeta, environmentTones, meta$22 as errorPanelMeta, meta$23 as evaluationScorecardMeta, extractPromptVariables, meta$24 as faqMeta, meta$25 as featureGridMeta, meta$26 as fileUploadPanelMeta, meta$27 as filterBarMeta, firstRunSteps, meta$28 as flowBuilderMeta, meta$29 as forgotPasswordFormMeta, meta$30 as formSectionMeta, formatCell, formatSpanDuration, generateDemoSecret, generateDeployments, globalSearchActions, meta$31 as globalSearchMeta, globalSearchPages, globalSearchRecent, globalSearchRecords, groupActivityByDay, groupKeyOf, groupRows, meta$32 as heroMeta, meta$33 as inlineCalloutMeta, meta$34 as inlineEditRowMeta, meta$35 as inviteMembersDialogMeta, meta$36 as invoiceTableMeta, meta$37 as kpiRowMeta, meta$38 as loadMoreFooterMeta, meta$39 as logViewerMeta, memberRoles, meta$40 as membersTableMeta, meta$41 as mfaChallengeMeta, meta$42 as modelKeysListMeta, meta$43 as monthCalendarMeta, noAccessSample, noResultsSample, notFoundSample, notificationChannels, notificationDefaults, notificationEvents, meta$44 as notificationMatrixMeta, orderColumns, pageCountOf, pageHeaderActions, pageHeaderBreadcrumbs, meta$45 as pageHeaderMeta, pageHeaderTabs, meta$46 as pageToolbarMeta, pageToolbarViews, paginate, meta$47 as paginationFooterMeta, meta$48 as paymentMethodCardMeta, meta$49 as pendingInvitationsMeta, meta$50 as planCardMeta, meta$51 as planDefinitionCardMeta, meta$52 as pricingTableMeta, meta$53 as profileHeaderMeta, meta$54 as promptEditorMeta, meta$55 as quotaMetersMeta, meta$56 as resetPasswordFormMeta, meta$57 as resourceCardGridMeta, runningTraceSpans, sameViewState, sampleBudget, sampleComparisonPlans, sampleComparisonSections, sampleCosts, deviceSessions as sampleDeviceSessions, sampleFaqs, sampleFeatures, invitations as sampleInvitations, sampleInvoices, members as sampleMembers, samplePaymentMethod, samplePlan, samplePlanDefinition, samplePricingTiers, profile as sampleProfile, sampleQuotas, sampleEvents as sampleScheduleEvents, sampleToday as sampleScheduleToday, sampleSpend, sampleTimeSlots, meta$58 as sectionHeaderMeta, selectionState, meta$59 as sessionsDevicesMeta, setColumnPin, meta$60 as settingsRowMeta, meta$61 as signInFormMeta, meta$62 as signUpFormMeta, simulateUpload, meta$63 as skeletonsMeta, sortRows, meta$64 as spendVsBudgetMeta, meta$65 as ssoButtonsMeta, ssoProviders, meta$66 as statCardMeta, meta$67 as statusTimelineMeta, meta$68 as stickyActionBarMeta, meta$69 as subordinateListMeta, meta$70 as systemBannerMeta, meta$71 as timeSlotPickerMeta, toggleAll, toggleOne, meta$72 as tokenCostCardMeta, traceSpans, meta$73 as traceWaterfallMeta, meta$74 as truncatedCollectionFooterMeta, uploadItems, validationIssues, meta$75 as validationSummaryMeta, meta$76 as weekCalendarMeta };
|
|
17646
|
+
export { ASSISTANT_STATUSES, ActivityFeed, AgendaList, AppSidebar, AppSidebarFooter, AppSidebarHeader, AppSidebarNav, AppTopbar, AssistantCardGrid, AuthDivider, AuthHeader, BulkActionBar, COLUMN_VARIANT_CLASSES, COMMENT_AUTHOR, COST_BY_RANGE, COST_RANGES, ChartCard, CodePanel, ColumnResizeHandle, ColumnVisibilityMenu, CommentThread, ComparisonTable, ConfirmDestructive, ConfirmDestructiveDialog, CostBreakdown, CreateApiKeyDialog, CredentialDisclosureDialog, CursorPagerFooter, DEFAULT_COLUMN_WIDTH, DEPLOYMENT_COLUMNS, DEPLOYMENT_DEFAULT_FILTERS, DEPLOYMENT_DETAILS, DEPLOYMENT_EVENTS, DEPLOYMENT_FILTER_FIELDS, DEPLOYMENT_ROWS, DEPLOYMENT_SAVED_VIEWS, DangerZone, DataTable, ViewSwitcher as DataTableViewSwitcher, DateRangeFilter, DensityToggle, DescriptionListCard, DialogWizard, EDITABLE_MEMBERS, EDITABLE_MEMBER_FIELDS, EditableCell, EnvironmentBadge, ErrorPanel, EvaluationScorecard, Faq, FeatureGrid, FileUploadPanel, FilterBar, FirstRunEmpty, FlowBuilder, ForgotPasswordForm, FormSection, GlobalSearch, Hero, HeroScreenshotPlaceholder, InlineCallout, InlineEditRow, InlineEditTable, InviteMembersDialog, InvoiceTable, KPI_ITEMS, KpiRow, LOG_LEVELS, ListSkeleton, LoadMoreFooter, LogViewer, MAX_COLUMN_WIDTH, MIN_COLUMN_WIDTH, MODEL_KEY_STATUSES, MembersTable, MfaChallenge, ModelKeysList, MonthCalendar, NoAccessEmpty, NoResultsEmpty, NodeInspector, NodePalette, NotFoundEmpty, NotificationMatrix, PROJECT_ACTIVITY, PageHeader, PageSkeleton, PageToolbar, PaginationFooter, PaymentMethodCard, PendingInvitations, PlanCard, PlanDefinitionCard, PricingTable, ProfileHeader, PromptEditor, QuotaMeters, RESOURCE_CARDS, REVIEW_COMMENTS, ResetPasswordForm, ResourceCardGrid, RunConsole, SPAN_STATUSES, STAT_RANGES, SectionHeader, SessionsDevices, SettingsRow, SignInForm, SignUpForm, SpanDetails, SpendVsBudget, SsoButtons, StatCard, StatusTimeline, StickyActionBar, SubordinateList, SystemBanner, TRAFFIC_BUCKETS, TRAFFIC_BY_RANGE, TRAFFIC_RANGES, TableSkeleton, TimeSlotPicker, TokenCostCard, TraceWaterfall, TrendDelta, TruncatedCollectionFooter, ValidationSummary, WeekCalendar, meta as activityFeedMeta, meta$1 as agendaListMeta, apiKeyExpiries, apiKeyScopes, meta$2 as appSidebarMeta, appSidebarNavGroups, appSidebarUsage, appSidebarUser, appSidebarWorkspaces, appTopbarBreadcrumbs, meta$3 as appTopbarMeta, appTopbarNotifications, meta$4 as assistantCardGridMeta, builderEdges, builderNodes, meta$5 as bulkActionBarMeta, meta$6 as chartCardMeta, clampColumnWidth, cleanFlowGraph, meta$7 as codePanelMeta, columnAlign, columnWidthOf, meta$8 as commentThreadMeta, compareValues, meta$9 as comparisonTableMeta, meta$10 as confirmDestructiveMeta, meta$11 as costBreakdownMeta, meta$12 as createApiKeyDialogMeta, meta$13 as credentialDisclosureDialogMeta, meta$14 as cursorPagerFooterMeta, dangerZoneActions, meta$15 as dangerZoneMeta, meta$16 as dataTableMeta, meta$17 as dateRangeFilterMeta, defaultEventKinds, meta$18 as descriptionListCardMeta, dialogWizardCopy, meta$19 as dialogWizardMeta, dialogWizardSteps, meta$20 as emptyStatesMeta, meta$21 as environmentBadgeMeta, environmentTones, meta$22 as errorPanelMeta, meta$23 as evaluationScorecardMeta, extractPromptVariables, meta$24 as faqMeta, meta$25 as featureGridMeta, meta$26 as fileUploadPanelMeta, meta$27 as filterBarMeta, firstRunSteps, meta$28 as flowBuilderMeta, meta$29 as forgotPasswordFormMeta, meta$30 as formSectionMeta, formatCell, formatSpanDuration, generateDemoSecret, generateDeployments, globalSearchActions, meta$31 as globalSearchMeta, globalSearchPages, globalSearchRecent, globalSearchRecords, groupActivityByDay, groupKeyOf, groupRows, meta$32 as heroMeta, meta$33 as inlineCalloutMeta, meta$34 as inlineEditRowMeta, meta$35 as inviteMembersDialogMeta, meta$36 as invoiceTableMeta, meta$37 as kpiRowMeta, meta$38 as loadMoreFooterMeta, meta$39 as logViewerMeta, memberRoles, meta$40 as membersTableMeta, meta$41 as mfaChallengeMeta, meta$42 as modelKeysListMeta, meta$43 as monthCalendarMeta, noAccessSample, noResultsSample, notFoundSample, notificationChannels, notificationDefaults, notificationEvents, meta$44 as notificationMatrixMeta, orderColumns, pageCountOf, pageHeaderActions, pageHeaderBreadcrumbs, meta$45 as pageHeaderMeta, pageHeaderTabs, meta$46 as pageToolbarMeta, pageToolbarViews, paginate, meta$47 as paginationFooterMeta, meta$48 as paymentMethodCardMeta, meta$49 as pendingInvitationsMeta, meta$50 as planCardMeta, meta$51 as planDefinitionCardMeta, meta$52 as pricingTableMeta, meta$53 as profileHeaderMeta, meta$54 as promptEditorMeta, meta$55 as quotaMetersMeta, meta$56 as resetPasswordFormMeta, meta$57 as resourceCardGridMeta, runningTraceSpans, sameViewState, sampleBudget, sampleComparisonPlans, sampleComparisonSections, sampleCosts, deviceSessions as sampleDeviceSessions, sampleFaqs, sampleFeatures, invitations as sampleInvitations, sampleInvoices, members as sampleMembers, samplePaymentMethod, samplePlan, samplePlanDefinition, samplePricingTiers, profile as sampleProfile, sampleQuotas, sampleEvents as sampleScheduleEvents, sampleToday as sampleScheduleToday, sampleSpend, sampleTimeSlots, meta$58 as sectionHeaderMeta, selectionState, meta$59 as sessionsDevicesMeta, setColumnPin, meta$60 as settingsRowMeta, meta$61 as signInFormMeta, meta$62 as signUpFormMeta, simulateUpload, meta$63 as skeletonsMeta, sortRows, meta$64 as spendVsBudgetMeta, meta$65 as ssoButtonsMeta, ssoProviders, meta$66 as statCardMeta, meta$67 as statusTimelineMeta, meta$68 as stickyActionBarMeta, meta$69 as subordinateListMeta, meta$70 as systemBannerMeta, meta$71 as timeSlotPickerMeta, toggleAll, toggleOne, meta$72 as tokenCostCardMeta, traceSpans, meta$73 as traceWaterfallMeta, meta$74 as truncatedCollectionFooterMeta, uploadItems, validationIssues, meta$75 as validationSummaryMeta, meta$76 as weekCalendarMeta };
|
|
16011
17647
|
|
|
16012
17648
|
//# sourceMappingURL=index.js.map
|