@gntik-ai/blocks 0.11.0 → 0.12.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 +1501 -1232
- package/dist/index.js +1884 -836
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
- package/src/ai/PromptEditor/PromptEditor.tsx +2 -2
- package/src/ai/PromptEditor/examples/controlled-variables.tsx +1 -1
- package/src/ai/TraceWaterfall/TraceWaterfall.tsx +2 -2
- package/src/auth/ForgotPasswordForm/ForgotPasswordForm.test.tsx +6 -0
- package/src/auth/ForgotPasswordForm/ForgotPasswordForm.tsx +4 -1
- package/src/auth/ForgotPasswordForm/block.meta.ts +1 -1
- package/src/auth/ForgotPasswordForm/examples/LargeFields.tsx +6 -0
- package/src/auth/MfaChallenge/MfaChallenge.test.tsx +9 -0
- package/src/auth/MfaChallenge/MfaChallenge.tsx +5 -2
- package/src/auth/MfaChallenge/block.meta.ts +1 -1
- package/src/auth/MfaChallenge/examples/LargeFields.tsx +6 -0
- package/src/auth/ResetPasswordForm/ResetPasswordForm.test.tsx +7 -0
- package/src/auth/ResetPasswordForm/ResetPasswordForm.tsx +5 -3
- package/src/auth/ResetPasswordForm/block.meta.ts +1 -1
- package/src/auth/ResetPasswordForm/examples/LargeFields.tsx +6 -0
- package/src/auth/SignInForm/SignInForm.test.tsx +7 -0
- package/src/auth/SignInForm/SignInForm.tsx +5 -1
- package/src/auth/SignInForm/block.meta.ts +1 -1
- package/src/auth/SignInForm/examples/LargeFields.tsx +6 -0
- package/src/auth/SignUpForm/SignUpForm.test.tsx +22 -0
- package/src/auth/SignUpForm/SignUpForm.tsx +7 -1
- package/src/auth/SignUpForm/block.meta.ts +1 -1
- package/src/auth/SignUpForm/examples/LargeFields.tsx +6 -0
- package/src/auth/__snapshots__/field-size.test.tsx.snap +11 -0
- package/src/auth/field-size.test.tsx +21 -0
- package/src/auth/large-examples.test.tsx +30 -0
- package/src/auth/shared.tsx +7 -2
- package/src/billing/PaymentMethodCard/PaymentMethodCard.tsx +1 -1
- package/src/billing/PlanCard/PlanCard.baseline.test.tsx +3 -2
- package/src/billing/PlanCard/__snapshots__/PlanCard.baseline.test.tsx.snap +2 -2
- package/src/billing/PlanDefinitionCard/examples/Compact.tsx +1 -4
- package/src/billing/PlanDefinitionCard/examples/Full.tsx +1 -4
- package/src/builders/CodePanel/CodePanel.tsx +2 -2
- package/src/builders/FlowBuilder/FlowBuilder.tsx +4 -19
- package/src/builders/FlowBuilder/parts.tsx +4 -4
- package/src/builders/LogViewer/LogViewer.follow.test.tsx +29 -0
- package/src/builders/LogViewer/LogViewer.test.tsx +24 -0
- package/src/builders/LogViewer/LogViewer.tsx +67 -20
- package/src/builders/LogViewer/block.meta.ts +2 -1
- package/src/builders/LogViewer/examples/Spanish.tsx +2 -1
- package/src/data-display/ActivityFeed/ActivityFeed.tsx +1 -1
- package/src/data-display/ChartCard/ChartCard.tsx +2 -2
- package/src/data-display/ChartCard/examples/ContainerPanel.tsx +16 -0
- package/src/data-display/CommentThread/CommentThread.test.tsx +70 -1
- package/src/data-display/CommentThread/CommentThread.tsx +22 -6
- package/src/data-display/CommentThread/block.meta.ts +1 -1
- package/src/data-display/CommentThread/examples/RenderedBody.tsx +20 -0
- package/src/data-display/DescriptionListCard/DescriptionListCard.test.tsx +24 -1
- package/src/data-display/DescriptionListCard/DescriptionListCard.tsx +14 -20
- package/src/data-display/DescriptionListCard/block.meta.ts +2 -1
- package/src/data-display/DescriptionListCard/examples/Spanish.tsx +2 -1
- package/src/data-display/KpiRow/KpiRow.doc.ts +14 -0
- package/src/data-display/KpiRow/KpiRow.test.tsx +11 -0
- package/src/data-display/KpiRow/KpiRow.tsx +72 -55
- package/src/data-display/KpiRow/examples/ContainerPanel.tsx +47 -0
- package/src/data-display/ResourceCardGrid/ResourceCardGrid.doc.ts +19 -0
- package/src/data-display/ResourceCardGrid/ResourceCardGrid.test.tsx +13 -0
- package/src/data-display/ResourceCardGrid/ResourceCardGrid.tsx +49 -40
- package/src/data-display/ResourceCardGrid/examples/ContainerPanel.tsx +18 -0
- package/src/data-display/StatusTimeline/StatusTimeline.tsx +1 -1
- package/src/feedback/EmptyStates/EmptyStates.test.tsx +42 -0
- package/src/feedback/EmptyStates/EmptyStates.tsx +5 -3
- package/src/feedback/EmptyStates/block.meta.ts +1 -1
- package/src/feedback/EmptyStates/examples/HiddenAction.tsx +13 -0
- package/src/feedback/ErrorPanel/ErrorPanel.tsx +13 -15
- package/src/forms/CreateApiKeyDialog/CreateApiKeyDialog.lifecycle.test.tsx +123 -0
- package/src/forms/CreateApiKeyDialog/CreateApiKeyDialog.tsx +128 -139
- package/src/forms/CreateApiKeyDialog/block.meta.ts +12 -1
- package/src/forms/FileUploadPanel/FileUploadPanel.controlled.test.tsx +482 -0
- package/src/forms/FileUploadPanel/FileUploadPanel.drag.test.tsx +60 -0
- package/src/forms/FileUploadPanel/FileUploadPanel.lifecycle.test.tsx +165 -0
- package/src/forms/FileUploadPanel/FileUploadPanel.tsx +267 -69
- package/src/forms/FileUploadPanel/block.meta.ts +5 -1
- package/src/forms/FileUploadPanel/examples/AutoCancel.tsx +38 -0
- package/src/forms/FileUploadPanel/examples/Labels.tsx +1 -1
- package/src/forms/FileUploadPanel/examples/ManualForm.tsx +36 -0
- package/src/forms/FileUploadPanel/fixtures.ts +31 -16
- package/src/forms/FileUploadPanel/simulate-upload.test.ts +24 -0
- package/src/forms/FormSection/FormSection.test.tsx +11 -0
- package/src/forms/FormSection/FormSection.tsx +20 -22
- package/src/forms/FormSection/block.meta.ts +1 -1
- package/src/forms/FormSection/examples/ContainerPanel.tsx +16 -0
- package/src/forms/InviteMembersDialog/InviteMembersDialog.lifecycle.test.tsx +80 -0
- package/src/forms/InviteMembersDialog/InviteMembersDialog.tsx +90 -109
- package/src/forms/InviteMembersDialog/block.meta.ts +1 -1
- package/src/forms/ValidationSummary/ValidationSummary.tsx +1 -4
- package/src/hooks/index.ts +2 -0
- package/src/hooks/useTableData.integration.test.tsx +89 -0
- package/src/hooks/useTableData.test.tsx +613 -0
- package/src/hooks/useTableData.ts +377 -0
- package/src/index.ts +1 -0
- package/src/marketing/ComparisonTable/ComparisonTable.tsx +2 -2
- package/src/marketing/FeatureGrid/FeatureGrid.tsx +1 -1
- package/src/marketing/LogoCloud/LogoCloud.doc.ts +13 -0
- package/src/marketing/LogoCloud/LogoCloud.test.tsx +155 -0
- package/src/marketing/LogoCloud/LogoCloud.tsx +89 -0
- package/src/marketing/LogoCloud/block.meta.ts +10 -0
- package/src/marketing/LogoCloud/examples/CaptionStart.tsx +6 -0
- package/src/marketing/LogoCloud/examples/Custom.tsx +25 -0
- package/src/marketing/LogoCloud/examples/Empty.tsx +6 -0
- package/src/marketing/LogoCloud/examples/Grid.tsx +13 -0
- package/src/marketing/LogoCloud/examples/Row.tsx +6 -0
- package/src/marketing/LogoCloud/examples/UnderHero.tsx +13 -0
- package/src/marketing/LogoCloud/fixtures.ts +23 -0
- package/src/marketing/PricingTable/PricingTable.tsx +1 -1
- package/src/marketing/SiteFooter/SiteFooter.doc.ts +18 -0
- package/src/marketing/SiteFooter/SiteFooter.test.tsx +236 -0
- package/src/marketing/SiteFooter/SiteFooter.tsx +160 -0
- package/src/marketing/SiteFooter/block.meta.ts +10 -0
- package/src/marketing/SiteFooter/examples/Centered.tsx +15 -0
- package/src/marketing/SiteFooter/examples/Columns.tsx +15 -0
- package/src/marketing/SiteFooter/examples/Custom.tsx +35 -0
- package/src/marketing/SiteFooter/examples/Empty.tsx +6 -0
- package/src/marketing/SiteFooter/examples/Simple.tsx +14 -0
- package/src/marketing/SiteFooter/fixtures.ts +36 -0
- package/src/marketing/index.ts +6 -0
- package/src/page-chrome/PageHeader/EditableTitle.test.tsx +26 -0
- package/src/page-chrome/PageHeader/PageHeader.tsx +4 -4
- package/src/page-chrome/PageHeader/block.meta.ts +1 -1
- package/src/page-chrome/PageHeader/examples/ContainerPanel.tsx +16 -0
- package/src/page-chrome/PageHeader/examples/EditableTitle.tsx +23 -0
- package/src/page-chrome/StickyActionBar/StickyActionBar.tsx +1 -1
- package/src/scheduling/AgendaList/AgendaList.tsx +39 -15
- package/src/scheduling/AgendaList/AgendaListZone.test.tsx +38 -0
- package/src/scheduling/AgendaList/block.meta.ts +1 -1
- package/src/scheduling/AgendaList/examples/TimeZone.tsx +28 -0
- package/src/scheduling/MonthCalendar/MonthCalendar.tsx +51 -40
- package/src/scheduling/MonthCalendar/MonthCalendarZone.test.tsx +44 -0
- package/src/scheduling/MonthCalendar/block.meta.ts +1 -1
- package/src/scheduling/MonthCalendar/examples/TimeZone.tsx +28 -0
- package/src/scheduling/WeekCalendar/WeekCalendar.tsx +37 -28
- package/src/scheduling/WeekCalendar/WeekCalendarZone.test.tsx +41 -0
- package/src/scheduling/WeekCalendar/block.meta.ts +1 -1
- package/src/scheduling/WeekCalendar/examples/TimeZone.tsx +28 -0
- package/src/scheduling/shared/CalendarHeader.tsx +26 -1
- package/src/scheduling/shared/dates.ts +102 -58
- package/src/scheduling/shared/events.ts +2 -2
- package/src/shell/AppSidebar/AppSidebar.context.test.tsx +175 -0
- package/src/shell/AppSidebar/AppSidebar.doc.ts +29 -0
- package/src/shell/AppSidebar/AppSidebar.tsx +97 -25
- package/src/shell/AppSidebar/block.meta.ts +1 -1
- package/src/shell/GlobalSearch/GlobalSearch.test.tsx +1 -0
- package/src/shell/GlobalSearch/GlobalSearch.tsx +1 -1
- package/src/tables/DataTable/DataTable.cursor-example.test.tsx +67 -0
- package/src/tables/DataTable/DataTable.export.test.tsx +511 -0
- package/src/tables/DataTable/DataTable.inline-edit-focus.test.tsx +32 -0
- package/src/tables/DataTable/DataTable.layout.test.tsx +6 -5
- package/src/tables/DataTable/DataTable.link-actions.test.tsx +18 -0
- package/src/tables/DataTable/DataTable.server-pagination.test.tsx +328 -14
- package/src/tables/DataTable/DataTable.test.tsx +85 -1
- package/src/tables/DataTable/DataTable.tsx +108 -14
- package/src/tables/DataTable/block.meta.ts +11 -1
- package/src/tables/DataTable/column-sizing.ts +2 -2
- package/src/tables/DataTable/data-table-props.ts +29 -1
- package/src/tables/DataTable/data-table-row.tsx +2 -2
- package/src/tables/DataTable/data-table-utils.ts +4 -0
- package/src/tables/DataTable/editable-cell.tsx +20 -79
- package/src/tables/DataTable/examples/csv-export.tsx +74 -0
- package/src/tables/DataTable/examples/cursor-load-more.tsx +87 -0
- package/src/tables/DataTable/examples/server-pagination.tsx +47 -40
- package/src/tables/DataTable/export-menu.tsx +58 -0
- package/src/tables/DataTable/header-cell.tsx +1 -1
- package/src/tables/DataTable/labels.ts +7 -0
- package/src/tables/DataTable/resize-handle.tsx +2 -2
- package/src/tables/DataTable/use-table-export.ts +117 -0
- package/src/tables/FilterBar/FilterBar.test.tsx +12 -0
- package/src/tables/FilterBar/FilterBar.tsx +5 -7
- package/src/team/ProfileHeader/ProfileHeader.picker.test.tsx +34 -0
- package/src/team/ProfileHeader/ProfileHeader.test.tsx +2 -2
- package/src/team/ProfileHeader/ProfileHeader.tsx +17 -24
- package/src/team/ProfileHeader/block.meta.ts +1 -1
- package/src/test/OptInDefaults.test.tsx +10 -1
- package/src/test/clipboard-fallback.test.tsx +49 -0
- package/src/test/copy-examples.test.tsx +29 -0
- package/src/test/copy-feedback.test.tsx +166 -0
- package/src/test/fixtures/opt-in-defaults.json +5 -5
- package/src/test/without-forced-colors.test.ts +44 -0
- package/src/test/without-forced-colors.ts +14 -0
package/dist/index.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { Fragment, createElement, useCallback, useEffect, useEffectEvent, useId, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
2
|
+
import { Children, Fragment, cloneElement, 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,
|
|
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, EmptyState, Field, FieldDescription, FieldError, FieldLabel, Fieldset, FieldsetLegend, FileTrigger, FormDialog, 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, SearchField, 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, copyToClipboard, downloadFile, en, foldText, formatTimeZoneLabel, fromZonedParts, localeHourCycle, localeWeekStart, matchRanges, nextSortDirection, tableVariants, toCsv, toDate, useAnnounce, useClipboard, useDensity, useDropzone, useHasLiveAnnouncer, useI18n, useInlineEdit, useMediaQuery, useOptionalI18n, useVirtualWindow, validateFiles, zonedParts } from "@gntik-ai/ui";
|
|
5
5
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { AreaChart, BarChart, CHART_COLORS, ChartLocaleProvider, DonutChart, Heatmap, LineChart, chartFmt } from "@gntik-ai/charts";
|
|
7
|
+
import { breakpointQuery } from "@gntik-ai/tokens/runtime";
|
|
7
8
|
import { FLOW_TONES, FlowCanvas, KIND_CHIP, KindGlyph, useFlowState } from "@gntik-ai/flow";
|
|
8
9
|
import { CodeEditor, DiffEditor } from "@gntik-ai/editor";
|
|
10
|
+
import { Download as Download$1, Mail as Mail$1, Rss } from "lucide-react";
|
|
9
11
|
//#region src/ai/AssistantCardGrid/fixtures.ts
|
|
10
12
|
const assistants = [
|
|
11
13
|
{
|
|
@@ -557,7 +559,7 @@ function TraceWaterfall({ spans = traceSpans, title = "Trace", selectedId: selec
|
|
|
557
559
|
"aria-expanded": open,
|
|
558
560
|
"aria-label": t(open ? "common.collapseItem" : "common.expandItem", { label: span.name }),
|
|
559
561
|
onClick: () => setOpen(span.id, !open),
|
|
560
|
-
className: "absolute top-1/2 z-
|
|
562
|
+
className: "absolute top-1/2 z-raised grid size-6 -translate-y-1/2 place-items-center rounded text-muted-foreground hover:bg-secondary hover:text-foreground focus-ring",
|
|
561
563
|
style: { insetInlineStart: indent - 4 },
|
|
562
564
|
children: /* @__PURE__ */ jsx(ChevronRight, {
|
|
563
565
|
size: 13,
|
|
@@ -577,7 +579,7 @@ function TraceWaterfall({ spans = traceSpans, title = "Trace", selectedId: selec
|
|
|
577
579
|
onClick: () => select(span),
|
|
578
580
|
onFocus: () => setFocusId(span.id),
|
|
579
581
|
onKeyDown: (e) => onKeyDown(e, index),
|
|
580
|
-
className: cn("grid h-8 w-full grid-cols-[minmax(0,2fr)_minmax(0,3fr)] items-center pe-3 text-start hover:bg-secondary/50", "focus-
|
|
582
|
+
className: cn("grid h-8 w-full grid-cols-[minmax(0,2fr)_minmax(0,3fr)] items-center pe-3 text-start hover:bg-secondary/50", "focus-ring-inset", isSelected && "bg-primary/8 hover:bg-primary/12"),
|
|
581
583
|
children: [/* @__PURE__ */ jsxs("span", {
|
|
582
584
|
className: "flex min-w-0 items-center gap-1.5 pe-3",
|
|
583
585
|
style: { paddingInlineStart: indent + 22 },
|
|
@@ -628,7 +630,7 @@ function TraceWaterfall({ spans = traceSpans, title = "Trace", selectedId: selec
|
|
|
628
630
|
}
|
|
629
631
|
//#endregion
|
|
630
632
|
//#region src/ai/TraceWaterfall/block.meta.ts
|
|
631
|
-
const meta$
|
|
633
|
+
const meta$75 = {
|
|
632
634
|
name: "Trace waterfall",
|
|
633
635
|
family: "ai",
|
|
634
636
|
status: "beta",
|
|
@@ -763,7 +765,7 @@ function TokenCostCard({ periods = tokenUsagePeriods, defaultPeriod, currency =
|
|
|
763
765
|
}
|
|
764
766
|
//#endregion
|
|
765
767
|
//#region src/ai/TokenCostCard/block.meta.ts
|
|
766
|
-
const meta$
|
|
768
|
+
const meta$74 = {
|
|
767
769
|
name: "Token cost card",
|
|
768
770
|
family: "ai",
|
|
769
771
|
status: "beta",
|
|
@@ -896,7 +898,7 @@ function PromptEditor({ title = "Prompt", defaultSystem = promptDefaults.system,
|
|
|
896
898
|
}), /* @__PURE__ */ jsxs("div", {
|
|
897
899
|
className: "flex flex-col gap-5 border-t border-border bg-secondary/20 p-4 md:border-t-0 md:border-s",
|
|
898
900
|
children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(SubTag, {
|
|
899
|
-
className: "text-[12px] font-semibold tracking-wide text-muted-foreground
|
|
901
|
+
className: "text-[12px] font-semibold tracking-wide text-muted-foreground label-case",
|
|
900
902
|
children: "Variables"
|
|
901
903
|
}), variables.length === 0 ? /* @__PURE__ */ jsx("p", {
|
|
902
904
|
className: "mt-2 text-[12.5px] text-muted-foreground",
|
|
@@ -939,7 +941,7 @@ function PromptEditor({ title = "Prompt", defaultSystem = promptDefaults.system,
|
|
|
939
941
|
className: "flex flex-col gap-4",
|
|
940
942
|
children: [
|
|
941
943
|
/* @__PURE__ */ jsx(SubTag, {
|
|
942
|
-
className: "text-[12px] font-semibold tracking-wide text-muted-foreground
|
|
944
|
+
className: "text-[12px] font-semibold tracking-wide text-muted-foreground label-case",
|
|
943
945
|
children: "Parameters"
|
|
944
946
|
}),
|
|
945
947
|
/* @__PURE__ */ jsx(Slider, {
|
|
@@ -976,7 +978,7 @@ function PromptEditor({ title = "Prompt", defaultSystem = promptDefaults.system,
|
|
|
976
978
|
}
|
|
977
979
|
//#endregion
|
|
978
980
|
//#region src/ai/PromptEditor/block.meta.ts
|
|
979
|
-
const meta$
|
|
981
|
+
const meta$55 = {
|
|
980
982
|
name: "Prompt editor",
|
|
981
983
|
family: "ai",
|
|
982
984
|
status: "beta",
|
|
@@ -1586,7 +1588,7 @@ function ModelKeysList({ keys = modelKeys, title = "Model provider keys", onTest
|
|
|
1586
1588
|
}
|
|
1587
1589
|
//#endregion
|
|
1588
1590
|
//#region src/ai/ModelKeysList/block.meta.ts
|
|
1589
|
-
const meta$
|
|
1591
|
+
const meta$43 = {
|
|
1590
1592
|
name: "Model keys list",
|
|
1591
1593
|
family: "ai",
|
|
1592
1594
|
status: "beta",
|
|
@@ -1614,7 +1616,7 @@ function AuthHeader({ eyebrow, title, description, headingLevel: Heading = "h1",
|
|
|
1614
1616
|
className: cn("mb-6", className),
|
|
1615
1617
|
children: [
|
|
1616
1618
|
eyebrow != null && /* @__PURE__ */ jsx("p", {
|
|
1617
|
-
className: "mb-2.5 font-mono text-[11px] tracking-[0.2em] text-primary-text
|
|
1619
|
+
className: "mb-2.5 font-mono text-[11px] tracking-[0.2em] text-primary-text label-case",
|
|
1618
1620
|
children: eyebrow
|
|
1619
1621
|
}),
|
|
1620
1622
|
Heading != null && title != null && /* @__PURE__ */ jsx(Heading, {
|
|
@@ -1636,7 +1638,7 @@ function AuthDivider({ children }) {
|
|
|
1636
1638
|
children: [
|
|
1637
1639
|
/* @__PURE__ */ jsx("span", { className: "h-px flex-1 bg-border" }),
|
|
1638
1640
|
/* @__PURE__ */ jsx("span", {
|
|
1639
|
-
className: "font-mono text-[10.5px] font-semibold tracking-[0.2em] text-muted-foreground
|
|
1641
|
+
className: "font-mono text-[10.5px] font-semibold tracking-[0.2em] text-muted-foreground label-case",
|
|
1640
1642
|
children
|
|
1641
1643
|
}),
|
|
1642
1644
|
/* @__PURE__ */ jsx("span", { className: "h-px flex-1 bg-border" })
|
|
@@ -1687,7 +1689,7 @@ function authSignUpFieldError(value, field, t, labels) {
|
|
|
1687
1689
|
//#endregion
|
|
1688
1690
|
//#region src/auth/ForgotPasswordForm/ForgotPasswordForm.tsx
|
|
1689
1691
|
/** Request a reset link by email, then a "check your inbox" state with resend and a way back. */
|
|
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 }) {
|
|
1692
|
+
function ForgotPasswordForm({ labels, fieldSize = "auto", 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
1693
|
const { t } = useI18n();
|
|
1692
1694
|
const eyebrow = eyebrowProp === void 0 ? labels?.eyebrow ?? t("forgotPassword.eyebrow") : eyebrowProp;
|
|
1693
1695
|
const title = titleProp === void 0 ? labels?.title ?? t("forgotPassword.title") : titleProp;
|
|
@@ -1812,6 +1814,7 @@ function ForgotPasswordForm({ labels, identifier, messages, ref, fieldInvalid, f
|
|
|
1812
1814
|
children: [
|
|
1813
1815
|
/* @__PURE__ */ jsx(FieldLabel, { children: identifier?.label ?? labels?.identifierLabel ?? t("forgotPassword.identifierLabel") }),
|
|
1814
1816
|
/* @__PURE__ */ jsx(Input, {
|
|
1817
|
+
size: fieldSize,
|
|
1815
1818
|
ref: identifierInput,
|
|
1816
1819
|
"aria-describedby": fieldInvalid?.identifier ? feedbackId : void 0,
|
|
1817
1820
|
type: identifier?.type ?? "email",
|
|
@@ -1857,7 +1860,7 @@ const meta$29 = {
|
|
|
1857
1860
|
name: "Forgot password form",
|
|
1858
1861
|
family: "auth",
|
|
1859
1862
|
status: "stable",
|
|
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.",
|
|
1863
|
+
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. Optional fieldSize: auto (default, follows density) or lg (44px fields matching the submit button). Preview: forgot-password-form--large-fields.",
|
|
1861
1864
|
labels: [
|
|
1862
1865
|
{
|
|
1863
1866
|
key: "formLabel",
|
|
@@ -1967,7 +1970,7 @@ const meta$29 = {
|
|
|
1967
1970
|
* Second-factor step: a one-time code (auto-submits when complete), a switch to a backup code,
|
|
1968
1971
|
* and a resend button with a countdown.
|
|
1969
1972
|
*/
|
|
1970
|
-
function MfaChallenge({ labels, onVerify, onResend, resendCooldown = 30, initialCooldown, length = 6, destination, error: errorProp, loading: loadingProp, onCancel, eyebrow: eyebrowProp, title: titleProp, className }) {
|
|
1973
|
+
function MfaChallenge({ labels, fieldSize = "auto", onVerify, onResend, resendCooldown = 30, initialCooldown, length = 6, destination, error: errorProp, loading: loadingProp, onCancel, eyebrow: eyebrowProp, title: titleProp, className }) {
|
|
1971
1974
|
const { t } = useI18n();
|
|
1972
1975
|
const eyebrow = eyebrowProp === void 0 ? labels?.eyebrow ?? t("mfaChallenge.eyebrow") : eyebrowProp;
|
|
1973
1976
|
const title = titleProp === void 0 ? labels?.title ?? t("mfaChallenge.title") : titleProp;
|
|
@@ -2032,6 +2035,7 @@ function MfaChallenge({ labels, onVerify, onResend, resendCooldown = 30, initial
|
|
|
2032
2035
|
children: [
|
|
2033
2036
|
/* @__PURE__ */ jsx(FieldLabel, { children: labels?.codeLabel ?? t("mfaChallenge.codeLabel") }),
|
|
2034
2037
|
/* @__PURE__ */ jsx(OtpInput, {
|
|
2038
|
+
size: fieldSize === "lg" ? "md" : void 0,
|
|
2035
2039
|
length,
|
|
2036
2040
|
value: code,
|
|
2037
2041
|
onValueChange: setCode,
|
|
@@ -2050,6 +2054,7 @@ function MfaChallenge({ labels, onVerify, onResend, resendCooldown = 30, initial
|
|
|
2050
2054
|
children: [
|
|
2051
2055
|
/* @__PURE__ */ jsx(FieldLabel, { children: labels?.backupLabel ?? t("mfaChallenge.backupLabel") }),
|
|
2052
2056
|
/* @__PURE__ */ jsx(Input, {
|
|
2057
|
+
size: fieldSize,
|
|
2053
2058
|
value: backup,
|
|
2054
2059
|
onValueChange: setBackup,
|
|
2055
2060
|
placeholder: labels?.backupPlaceholder ?? t("mfaChallenge.backupPlaceholder"),
|
|
@@ -2111,11 +2116,11 @@ function MfaChallenge({ labels, onVerify, onResend, resendCooldown = 30, initial
|
|
|
2111
2116
|
}
|
|
2112
2117
|
//#endregion
|
|
2113
2118
|
//#region src/auth/MfaChallenge/block.meta.ts
|
|
2114
|
-
const meta$
|
|
2119
|
+
const meta$42 = {
|
|
2115
2120
|
name: "MFA challenge",
|
|
2116
2121
|
family: "auth",
|
|
2117
2122
|
status: "stable",
|
|
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.",
|
|
2123
|
+
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. Optional fieldSize: auto (default, follows density) or lg (44px fields matching the submit button). Preview: mfa-challenge--large-fields. Large OTP slots use the existing md step (44px); backup-code inputs use lg.",
|
|
2119
2124
|
labels: [
|
|
2120
2125
|
{
|
|
2121
2126
|
key: "eyebrow",
|
|
@@ -2229,7 +2234,7 @@ const meta$41 = {
|
|
|
2229
2234
|
//#endregion
|
|
2230
2235
|
//#region src/auth/ResetPasswordForm/ResetPasswordForm.tsx
|
|
2231
2236
|
/** New password + confirmation with length and mismatch validation, then a success state. */
|
|
2232
|
-
function ResetPasswordForm({ labels, onSubmit, error: errorProp, minPasswordLength = 8, onContinue, eyebrow: eyebrowProp, className }) {
|
|
2237
|
+
function ResetPasswordForm({ labels, fieldSize = "auto", onSubmit, error: errorProp, minPasswordLength = 8, onContinue, eyebrow: eyebrowProp, className }) {
|
|
2233
2238
|
const { t } = useI18n();
|
|
2234
2239
|
const eyebrow = eyebrowProp === void 0 ? labels?.eyebrow ?? t("resetPassword.eyebrow") : eyebrowProp;
|
|
2235
2240
|
const [password, setPassword] = useState("");
|
|
@@ -2297,6 +2302,7 @@ function ResetPasswordForm({ labels, onSubmit, error: errorProp, minPasswordLeng
|
|
|
2297
2302
|
children: [
|
|
2298
2303
|
/* @__PURE__ */ jsx(FieldLabel, { children: labels?.newPassword ?? t("resetPassword.newPassword") }),
|
|
2299
2304
|
/* @__PURE__ */ jsx(PasswordInput, {
|
|
2305
|
+
size: fieldSize,
|
|
2300
2306
|
showStrength: true,
|
|
2301
2307
|
value: password,
|
|
2302
2308
|
onValueChange: setPassword,
|
|
@@ -2313,6 +2319,7 @@ function ResetPasswordForm({ labels, onSubmit, error: errorProp, minPasswordLeng
|
|
|
2313
2319
|
children: [
|
|
2314
2320
|
/* @__PURE__ */ jsx(FieldLabel, { children: labels?.confirmPassword ?? t("resetPassword.confirmPassword") }),
|
|
2315
2321
|
/* @__PURE__ */ jsx(PasswordInput, {
|
|
2322
|
+
size: fieldSize,
|
|
2316
2323
|
autoComplete: "new-password",
|
|
2317
2324
|
value: confirm,
|
|
2318
2325
|
onValueChange: setConfirm,
|
|
@@ -2338,11 +2345,11 @@ function ResetPasswordForm({ labels, onSubmit, error: errorProp, minPasswordLeng
|
|
|
2338
2345
|
}
|
|
2339
2346
|
//#endregion
|
|
2340
2347
|
//#region src/auth/ResetPasswordForm/block.meta.ts
|
|
2341
|
-
const meta$
|
|
2348
|
+
const meta$57 = {
|
|
2342
2349
|
name: "Reset password form",
|
|
2343
2350
|
family: "auth",
|
|
2344
2351
|
status: "stable",
|
|
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.",
|
|
2352
|
+
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. Optional fieldSize: auto (default, follows density) or lg (44px fields matching the submit button). Preview: reset-password-form--large-fields.",
|
|
2346
2353
|
labels: [
|
|
2347
2354
|
{
|
|
2348
2355
|
key: "eyebrow",
|
|
@@ -2465,7 +2472,7 @@ const linkHandler = (fn) => fn ? (e) => {
|
|
|
2465
2472
|
fn();
|
|
2466
2473
|
} : void 0;
|
|
2467
2474
|
/** Email + password sign-in with remember me, forgot-password link, SSO slot, error alert and loading. */
|
|
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 }) {
|
|
2475
|
+
function SignInForm({ labels, fieldSize = "auto", 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
2476
|
const { t } = useI18n();
|
|
2470
2477
|
const eyebrow = eyebrowProp === void 0 ? labels?.eyebrow ?? t("signIn.eyebrow") : eyebrowProp;
|
|
2471
2478
|
const title = titleProp === void 0 ? labels?.title ?? t("signIn.title") : titleProp;
|
|
@@ -2528,6 +2535,7 @@ function SignInForm({ labels, identifier, messages, passwordHelp, passwordHelpId
|
|
|
2528
2535
|
children: [
|
|
2529
2536
|
/* @__PURE__ */ jsx(FieldLabel, { children: identifier?.label ?? labels?.identifierLabel ?? t("signIn.identifierLabel") }),
|
|
2530
2537
|
/* @__PURE__ */ jsx(Input, {
|
|
2538
|
+
size: fieldSize,
|
|
2531
2539
|
ref: identifierInput,
|
|
2532
2540
|
"aria-describedby": fieldInvalid?.identifier ? feedbackId : void 0,
|
|
2533
2541
|
type: identifier?.type ?? "email",
|
|
@@ -2564,6 +2572,7 @@ function SignInForm({ labels, identifier, messages, passwordHelp, passwordHelpId
|
|
|
2564
2572
|
})]
|
|
2565
2573
|
}),
|
|
2566
2574
|
/* @__PURE__ */ jsx(PasswordInput, {
|
|
2575
|
+
size: fieldSize,
|
|
2567
2576
|
ref: passwordInput,
|
|
2568
2577
|
"aria-describedby": fieldInvalid?.password ? feedbackId : void 0,
|
|
2569
2578
|
leadingIcon: Lock,
|
|
@@ -2614,11 +2623,11 @@ function SignInForm({ labels, identifier, messages, passwordHelp, passwordHelpId
|
|
|
2614
2623
|
}
|
|
2615
2624
|
//#endregion
|
|
2616
2625
|
//#region src/auth/SignInForm/block.meta.ts
|
|
2617
|
-
const meta$
|
|
2626
|
+
const meta$62 = {
|
|
2618
2627
|
name: "Sign-in form",
|
|
2619
2628
|
family: "auth",
|
|
2620
2629
|
status: "stable",
|
|
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.",
|
|
2630
|
+
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. Optional fieldSize: auto (default, follows density) or lg (44px fields matching the submit button). Preview: sign-in-form--large-fields.",
|
|
2622
2631
|
labels: [
|
|
2623
2632
|
{
|
|
2624
2633
|
key: "eyebrow",
|
|
@@ -2771,7 +2780,7 @@ function ValidationSummary({ labels, errors = validationIssues, submitCount = 0,
|
|
|
2771
2780
|
role: "region",
|
|
2772
2781
|
tone: "destructive",
|
|
2773
2782
|
title: heading,
|
|
2774
|
-
className: cn("focus-
|
|
2783
|
+
className: cn("focus-ring", className),
|
|
2775
2784
|
children: /* @__PURE__ */ jsx("ul", {
|
|
2776
2785
|
className: "mt-1 list-disc space-y-1 ps-4",
|
|
2777
2786
|
children: errors.map((e) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(Link, {
|
|
@@ -2790,7 +2799,7 @@ function ValidationSummary({ labels, errors = validationIssues, submitCount = 0,
|
|
|
2790
2799
|
//#endregion
|
|
2791
2800
|
//#region src/auth/SignUpForm/SignUpForm.tsx
|
|
2792
2801
|
/** Account creation: name, work email, password with a strength meter and a required terms checkbox. */
|
|
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 }) {
|
|
2802
|
+
function SignUpForm({ labels, fieldSize = "auto", 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
2803
|
const { t } = useI18n();
|
|
2795
2804
|
const eyebrow = eyebrowProp === void 0 ? labels?.eyebrow ?? t("signUp.eyebrow") : eyebrowProp;
|
|
2796
2805
|
const title = titleProp === void 0 ? labels?.title ?? t("signUp.title") : titleProp;
|
|
@@ -2936,6 +2945,7 @@ function SignUpForm({ labels, fields, messages, unavailable, policyLoading = fal
|
|
|
2936
2945
|
children: [
|
|
2937
2946
|
/* @__PURE__ */ jsx(FieldLabel, { children: field.label }),
|
|
2938
2947
|
/* @__PURE__ */ jsx(Input, {
|
|
2948
|
+
size: fieldSize,
|
|
2939
2949
|
id: `${fieldPrefix}-field-${field.id}`,
|
|
2940
2950
|
type: field.type ?? "text",
|
|
2941
2951
|
autoComplete: field.autoComplete,
|
|
@@ -2959,6 +2969,7 @@ function SignUpForm({ labels, fields, messages, unavailable, policyLoading = fal
|
|
|
2959
2969
|
children: [
|
|
2960
2970
|
/* @__PURE__ */ jsx(FieldLabel, { children: labels?.name ?? t("signUp.name") }),
|
|
2961
2971
|
/* @__PURE__ */ jsx(Input, {
|
|
2972
|
+
size: fieldSize,
|
|
2962
2973
|
leadingIcon: User,
|
|
2963
2974
|
autoComplete: "name",
|
|
2964
2975
|
placeholder: labels?.namePlaceholder ?? t("signUp.namePlaceholder"),
|
|
@@ -2976,6 +2987,7 @@ function SignUpForm({ labels, fields, messages, unavailable, policyLoading = fal
|
|
|
2976
2987
|
children: [
|
|
2977
2988
|
/* @__PURE__ */ jsx(FieldLabel, { children: labels?.email ?? t("signUp.email") }),
|
|
2978
2989
|
/* @__PURE__ */ jsx(Input, {
|
|
2990
|
+
size: fieldSize,
|
|
2979
2991
|
type: "email",
|
|
2980
2992
|
leadingIcon: Mail,
|
|
2981
2993
|
autoComplete: "email",
|
|
@@ -2995,6 +3007,7 @@ function SignUpForm({ labels, fields, messages, unavailable, policyLoading = fal
|
|
|
2995
3007
|
children: [
|
|
2996
3008
|
/* @__PURE__ */ jsx(FieldLabel, { children: labels?.password ?? t("signUp.password") }),
|
|
2997
3009
|
/* @__PURE__ */ jsx(PasswordInput, {
|
|
3010
|
+
size: fieldSize,
|
|
2998
3011
|
id: fields !== void 0 ? passwordId : void 0,
|
|
2999
3012
|
showStrength: true,
|
|
3000
3013
|
strength: password.length > 0 && password.length < minPasswordLength ? 0 : void 0,
|
|
@@ -3054,11 +3067,11 @@ function SignUpForm({ labels, fields, messages, unavailable, policyLoading = fal
|
|
|
3054
3067
|
}
|
|
3055
3068
|
//#endregion
|
|
3056
3069
|
//#region src/auth/SignUpForm/block.meta.ts
|
|
3057
|
-
const meta$
|
|
3070
|
+
const meta$63 = {
|
|
3058
3071
|
name: "Sign-up form",
|
|
3059
3072
|
family: "auth",
|
|
3060
3073
|
status: "stable",
|
|
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.",
|
|
3074
|
+
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. Optional fieldSize: auto (default, follows density) or lg (44px fields matching the submit button). Preview: sign-up-form--large-fields.",
|
|
3062
3075
|
labels: [
|
|
3063
3076
|
{
|
|
3064
3077
|
key: "eyebrow",
|
|
@@ -3192,7 +3205,7 @@ const meta$62 = {
|
|
|
3192
3205
|
};
|
|
3193
3206
|
//#endregion
|
|
3194
3207
|
//#region src/auth/SsoButtons/block.meta.ts
|
|
3195
|
-
const meta$
|
|
3208
|
+
const meta$67 = {
|
|
3196
3209
|
name: "SSO buttons",
|
|
3197
3210
|
family: "auth",
|
|
3198
3211
|
status: "stable",
|
|
@@ -3494,7 +3507,7 @@ const documentation$1 = {
|
|
|
3494
3507
|
"summary-actions-only"
|
|
3495
3508
|
]
|
|
3496
3509
|
};
|
|
3497
|
-
const meta$
|
|
3510
|
+
const meta$51 = {
|
|
3498
3511
|
name: "Plan card",
|
|
3499
3512
|
family: "billing",
|
|
3500
3513
|
status: "beta",
|
|
@@ -3652,7 +3665,7 @@ const documentation = {
|
|
|
3652
3665
|
],
|
|
3653
3666
|
examples: ["compact", "full"]
|
|
3654
3667
|
};
|
|
3655
|
-
const meta$
|
|
3668
|
+
const meta$52 = {
|
|
3656
3669
|
name: "Plan definition card",
|
|
3657
3670
|
family: "billing",
|
|
3658
3671
|
status: "beta",
|
|
@@ -3766,7 +3779,7 @@ function QuotaMeters({ quotas = sampleQuotas, title = "Plan usage", thresholds,
|
|
|
3766
3779
|
}
|
|
3767
3780
|
//#endregion
|
|
3768
3781
|
//#region src/billing/QuotaMeters/block.meta.ts
|
|
3769
|
-
const meta$
|
|
3782
|
+
const meta$56 = {
|
|
3770
3783
|
name: "Quota meters",
|
|
3771
3784
|
family: "billing",
|
|
3772
3785
|
status: "beta",
|
|
@@ -3885,7 +3898,7 @@ function SpendVsBudget({ data = sampleSpend, budget = sampleBudget, currency = "
|
|
|
3885
3898
|
}
|
|
3886
3899
|
//#endregion
|
|
3887
3900
|
//#region src/billing/SpendVsBudget/block.meta.ts
|
|
3888
|
-
const meta$
|
|
3901
|
+
const meta$66 = {
|
|
3889
3902
|
name: "Spend vs budget",
|
|
3890
3903
|
family: "billing",
|
|
3891
3904
|
status: "beta",
|
|
@@ -4114,7 +4127,7 @@ function PaymentMethodCard({ method = samplePaymentMethod, title = "Payment meth
|
|
|
4114
4127
|
className: "flex flex-wrap items-center gap-4 px-5 py-4",
|
|
4115
4128
|
children: [/* @__PURE__ */ jsx("span", {
|
|
4116
4129
|
"aria-hidden": true,
|
|
4117
|
-
className: "grid h-10 w-14 shrink-0 place-items-center rounded-md border border-border bg-secondary font-mono text-[10.5px] font-semibold tracking-wide text-foreground
|
|
4130
|
+
className: "grid h-10 w-14 shrink-0 place-items-center rounded-md border border-border bg-secondary font-mono text-[10.5px] font-semibold tracking-wide text-foreground label-case",
|
|
4118
4131
|
children: method.brand.slice(0, 4)
|
|
4119
4132
|
}), /* @__PURE__ */ jsxs("div", {
|
|
4120
4133
|
className: "min-w-0 flex-1",
|
|
@@ -4161,7 +4174,7 @@ function PaymentMethodCard({ method = samplePaymentMethod, title = "Payment meth
|
|
|
4161
4174
|
}
|
|
4162
4175
|
//#endregion
|
|
4163
4176
|
//#region src/billing/PaymentMethodCard/block.meta.ts
|
|
4164
|
-
const meta$
|
|
4177
|
+
const meta$49 = {
|
|
4165
4178
|
name: "Payment method card",
|
|
4166
4179
|
family: "billing",
|
|
4167
4180
|
status: "beta",
|
|
@@ -4688,7 +4701,7 @@ function FlowProblems({ issues, onSelect, titleAs: Title = "h3" }) {
|
|
|
4688
4701
|
}
|
|
4689
4702
|
//#endregion
|
|
4690
4703
|
//#region src/builders/FlowBuilder/parts.tsx
|
|
4691
|
-
const panelTitle = "px-3 pt-3 pb-2 font-mono text-[10.5px] font-medium tracking-[0.12em] text-muted-foreground
|
|
4704
|
+
const panelTitle = "px-3 pt-3 pb-2 font-mono text-[10.5px] font-medium tracking-[0.12em] text-muted-foreground label-case";
|
|
4692
4705
|
/** Left rail: node kinds to add to the canvas. */
|
|
4693
4706
|
function NodePalette({ items, onAdd, titleAs: TitleTag = "h3" }) {
|
|
4694
4707
|
const titleId = useId();
|
|
@@ -4706,7 +4719,7 @@ function NodePalette({ items, onAdd, titleAs: TitleTag = "h3" }) {
|
|
|
4706
4719
|
onClick: () => onAdd(item),
|
|
4707
4720
|
"aria-label": `Add ${item.title}`,
|
|
4708
4721
|
title: item.description,
|
|
4709
|
-
className: "group flex w-full items-center gap-2.5 rounded-md px-2 py-2 text-start hover:bg-secondary/70 focus-
|
|
4722
|
+
className: "group flex w-full items-center gap-2.5 rounded-md px-2 py-2 text-start hover:bg-secondary/70 focus-ring",
|
|
4710
4723
|
children: [
|
|
4711
4724
|
/* @__PURE__ */ jsx("span", {
|
|
4712
4725
|
className: cn("grid size-7 shrink-0 place-items-center rounded-md", KIND_CHIP[item.kind]),
|
|
@@ -4850,7 +4863,7 @@ function RunConsole({ entries, onClear, titleAs: TitleTag = "h3" }) {
|
|
|
4850
4863
|
role: "log",
|
|
4851
4864
|
"aria-label": "Run console",
|
|
4852
4865
|
tabIndex: 0,
|
|
4853
|
-
className: "flex-1 overflow-y-auto px-3 py-2 font-mono text-[11.5px] focus-
|
|
4866
|
+
className: "flex-1 overflow-y-auto px-3 py-2 font-mono text-[11.5px] focus-ring-inset",
|
|
4854
4867
|
children: entries.length === 0 ? /* @__PURE__ */ jsx("p", {
|
|
4855
4868
|
className: "font-sans text-[12.5px] text-muted-foreground",
|
|
4856
4869
|
children: "No output yet. Run the flow to see its steps."
|
|
@@ -4862,7 +4875,7 @@ function RunConsole({ entries, onClear, titleAs: TitleTag = "h3" }) {
|
|
|
4862
4875
|
children: e.time
|
|
4863
4876
|
}),
|
|
4864
4877
|
/* @__PURE__ */ jsx("span", {
|
|
4865
|
-
className: cn("w-14 shrink-0
|
|
4878
|
+
className: cn("w-14 shrink-0 label-case", CONSOLE_LEVEL[e.level]),
|
|
4866
4879
|
children: e.level
|
|
4867
4880
|
}),
|
|
4868
4881
|
/* @__PURE__ */ jsx("span", {
|
|
@@ -4890,16 +4903,6 @@ function cleanFlowGraph(graph) {
|
|
|
4890
4903
|
};
|
|
4891
4904
|
}
|
|
4892
4905
|
const NO_ISSUES = [];
|
|
4893
|
-
const WIDE_QUERY = "(min-width: 768px)";
|
|
4894
|
-
function subscribeWide(onChange) {
|
|
4895
|
-
if (typeof window === "undefined" || !window.matchMedia) return () => {};
|
|
4896
|
-
const mql = window.matchMedia(WIDE_QUERY);
|
|
4897
|
-
mql.addEventListener?.("change", onChange);
|
|
4898
|
-
return () => mql.removeEventListener?.("change", onChange);
|
|
4899
|
-
}
|
|
4900
|
-
function useIsWide() {
|
|
4901
|
-
return useSyncExternalStore(subscribeWide, () => typeof window !== "undefined" && window.matchMedia ? window.matchMedia(WIDE_QUERY).matches : true, () => true);
|
|
4902
|
-
}
|
|
4903
4906
|
function clock() {
|
|
4904
4907
|
return (/* @__PURE__ */ new Date()).toLocaleTimeString("en-GB", { hour12: false });
|
|
4905
4908
|
}
|
|
@@ -4912,7 +4915,7 @@ function FlowBuilder({ title = "Untitled flow", nodes: initialNodes = builderNod
|
|
|
4912
4915
|
const runMode = mode === "run";
|
|
4913
4916
|
const root = useRef(null);
|
|
4914
4917
|
const flow = useRef(null);
|
|
4915
|
-
const wide =
|
|
4918
|
+
const wide = useMediaQuery(breakpointQuery("md"), true);
|
|
4916
4919
|
const panelAs = TitleTag === "h2" ? "h3" : TitleTag === "h3" ? "h4" : "h5";
|
|
4917
4920
|
const { nodes, edges, setNodes, setEdges, onNodesChange, onEdgesChange } = useBuilderGraph({
|
|
4918
4921
|
nodes: initialNodes,
|
|
@@ -5640,7 +5643,7 @@ function CodePanel({ files = codeFiles, problems: suppliedProblems = codeProblem
|
|
|
5640
5643
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
5641
5644
|
className: "flex items-center gap-3 bg-secondary/35 px-3 py-2",
|
|
5642
5645
|
children: [/* @__PURE__ */ jsx(ProblemsHeading, {
|
|
5643
|
-
className: "text-[12px] font-semibold tracking-wide text-foreground
|
|
5646
|
+
className: "text-[12px] font-semibold tracking-wide text-foreground label-case",
|
|
5644
5647
|
children: "Problems"
|
|
5645
5648
|
}), /* @__PURE__ */ jsxs("span", {
|
|
5646
5649
|
className: "font-mono text-[11px] text-muted-foreground",
|
|
@@ -5666,7 +5669,7 @@ function CodePanel({ files = codeFiles, problems: suppliedProblems = codeProblem
|
|
|
5666
5669
|
return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs("button", {
|
|
5667
5670
|
type: "button",
|
|
5668
5671
|
onClick: () => selectProblem(p),
|
|
5669
|
-
className: "flex w-full items-start gap-2 px-3 py-1.5 text-start text-[12.5px] hover:bg-secondary/60 focus-
|
|
5672
|
+
className: "flex w-full items-start gap-2 px-3 py-1.5 text-start text-[12.5px] hover:bg-secondary/60 focus-ring-inset",
|
|
5670
5673
|
children: [
|
|
5671
5674
|
/* @__PURE__ */ jsx(SevIcon, {
|
|
5672
5675
|
size: 14,
|
|
@@ -5875,12 +5878,15 @@ function LogViewer({ lines = logLines, title: titleProp, labels, height = 360, r
|
|
|
5875
5878
|
const title = titleProp ?? labels?.title ?? t("logViewer.title");
|
|
5876
5879
|
const titleId = useId();
|
|
5877
5880
|
const viewport = useRef(null);
|
|
5881
|
+
const lastFollowTop = useRef(null);
|
|
5878
5882
|
const copyTimer = useRef(void 0);
|
|
5879
5883
|
const [levels, setLevels] = useState(defaultLevels);
|
|
5880
5884
|
const [query, setQuery] = useState("");
|
|
5881
5885
|
const [follow, setFollow] = useState(defaultFollow);
|
|
5882
5886
|
const [scrollTop, setScrollTop] = useState(0);
|
|
5883
|
-
const [
|
|
5887
|
+
const [copyResult, setCopyResult] = useState(null);
|
|
5888
|
+
const mounted = useRef(true);
|
|
5889
|
+
const copyAttempt = useRef(0);
|
|
5884
5890
|
const counts = useMemo(() => {
|
|
5885
5891
|
const c = {
|
|
5886
5892
|
debug: 0,
|
|
@@ -5913,20 +5919,53 @@ function LogViewer({ lines = logLines, title: titleProp, labels, height = 360, r
|
|
|
5913
5919
|
const end = wrap ? wrapped.end : Math.min(visible.length, Math.ceil((offset + height) / rowHeight) + overscan);
|
|
5914
5920
|
const rows = visible.slice(start, end);
|
|
5915
5921
|
useEffect(() => {
|
|
5916
|
-
|
|
5917
|
-
|
|
5918
|
-
|
|
5922
|
+
const node = viewport.current;
|
|
5923
|
+
if (!follow || !node) {
|
|
5924
|
+
lastFollowTop.current = null;
|
|
5925
|
+
return;
|
|
5926
|
+
}
|
|
5927
|
+
if (lastFollowTop.current !== null && node.scrollTop < Math.min(lastFollowTop.current, maxScroll) - rowHeight) {
|
|
5928
|
+
setScrollTop(node.scrollTop);
|
|
5929
|
+
setFollow(false);
|
|
5930
|
+
return;
|
|
5931
|
+
}
|
|
5932
|
+
node.scrollTop = maxScroll;
|
|
5933
|
+
lastFollowTop.current = node.scrollTop;
|
|
5934
|
+
}, [
|
|
5935
|
+
follow,
|
|
5936
|
+
maxScroll,
|
|
5937
|
+
rowHeight
|
|
5938
|
+
]);
|
|
5939
|
+
useEffect(() => {
|
|
5940
|
+
mounted.current = true;
|
|
5941
|
+
return () => {
|
|
5942
|
+
mounted.current = false;
|
|
5943
|
+
copyAttempt.current += 1;
|
|
5944
|
+
clearTimeout(copyTimer.current);
|
|
5945
|
+
};
|
|
5946
|
+
}, []);
|
|
5919
5947
|
const onScroll = (event) => {
|
|
5920
5948
|
const top = event.currentTarget.scrollTop;
|
|
5921
5949
|
setScrollTop(top);
|
|
5922
5950
|
if (follow && top < maxScroll - rowHeight) setFollow(false);
|
|
5923
5951
|
};
|
|
5924
|
-
const copy = (line) => {
|
|
5925
|
-
navigator.clipboard?.writeText(lineText(line)).catch(() => void 0);
|
|
5926
|
-
onCopyLine?.(line);
|
|
5927
|
-
setCopied(line.id);
|
|
5952
|
+
const copy = async (line) => {
|
|
5928
5953
|
clearTimeout(copyTimer.current);
|
|
5929
|
-
|
|
5954
|
+
const current = ++copyAttempt.current;
|
|
5955
|
+
let status = "failed";
|
|
5956
|
+
try {
|
|
5957
|
+
await copyToClipboard(lineText(line));
|
|
5958
|
+
status = "copied";
|
|
5959
|
+
} catch {}
|
|
5960
|
+
if (!mounted.current) return;
|
|
5961
|
+
if (current === copyAttempt.current) {
|
|
5962
|
+
setCopyResult({
|
|
5963
|
+
id: line.id,
|
|
5964
|
+
status
|
|
5965
|
+
});
|
|
5966
|
+
copyTimer.current = setTimeout(() => setCopyResult(null), 1500);
|
|
5967
|
+
}
|
|
5968
|
+
if (status === "copied") onCopyLine?.(line);
|
|
5930
5969
|
};
|
|
5931
5970
|
return /* @__PURE__ */ jsxs("section", {
|
|
5932
5971
|
"aria-labelledby": titleId,
|
|
@@ -5963,12 +6002,10 @@ function LogViewer({ lines = logLines, title: titleProp, labels, height = 360, r
|
|
|
5963
6002
|
})]
|
|
5964
6003
|
}, lv))
|
|
5965
6004
|
}),
|
|
5966
|
-
/* @__PURE__ */ jsx(
|
|
6005
|
+
/* @__PURE__ */ jsx(SearchField, {
|
|
5967
6006
|
size: "sm",
|
|
5968
|
-
type: "search",
|
|
5969
6007
|
"aria-label": labels?.searchLabel ?? t("logViewer.searchLabel"),
|
|
5970
6008
|
placeholder: labels?.searchPlaceholder ?? t("logViewer.searchPlaceholder"),
|
|
5971
|
-
leadingIcon: Search,
|
|
5972
6009
|
value: query,
|
|
5973
6010
|
onValueChange: (v) => setQuery(String(v)),
|
|
5974
6011
|
className: "w-full sm:w-48"
|
|
@@ -5988,7 +6025,7 @@ function LogViewer({ lines = logLines, title: titleProp, labels, height = 360, r
|
|
|
5988
6025
|
"aria-live": announceLines && follow ? "polite" : "off",
|
|
5989
6026
|
tabIndex: 0,
|
|
5990
6027
|
onScroll,
|
|
5991
|
-
className: "relative overflow-auto bg-background font-mono text-[12px] focus-
|
|
6028
|
+
className: "relative overflow-auto bg-background font-mono text-[12px] focus-ring-inset",
|
|
5992
6029
|
style: { height },
|
|
5993
6030
|
children: visible.length === 0 ? /* @__PURE__ */ jsx("p", {
|
|
5994
6031
|
className: "px-4 py-6 text-center font-sans text-[13px] text-muted-foreground",
|
|
@@ -5998,6 +6035,7 @@ function LogViewer({ lines = logLines, title: titleProp, labels, height = 360, r
|
|
|
5998
6035
|
style: { height: total },
|
|
5999
6036
|
children: rows.map((line, i) => {
|
|
6000
6037
|
const lv = LEVEL_STYLE[line.level];
|
|
6038
|
+
const status = copyResult?.id === line.id ? copyResult.status : "idle";
|
|
6001
6039
|
return /* @__PURE__ */ jsxs("div", {
|
|
6002
6040
|
"data-slot": "log-line",
|
|
6003
6041
|
ref: wrap ? (node) => wrapped.measureRow(node, line.id) : void 0,
|
|
@@ -6044,8 +6082,8 @@ function LogViewer({ lines = logLines, title: titleProp, labels, height = 360, r
|
|
|
6044
6082
|
}),
|
|
6045
6083
|
/* @__PURE__ */ jsx(IconButton, {
|
|
6046
6084
|
size: "sm",
|
|
6047
|
-
icon:
|
|
6048
|
-
label:
|
|
6085
|
+
icon: status === "failed" ? X : status === "copied" ? Check : Copy,
|
|
6086
|
+
label: status === "failed" ? labels?.copyFailed ?? t("common.copyFailed") : status === "copied" ? labels?.copied ?? t("common.copied") : labels?.copy?.(line.timestamp) ?? t("logViewer.copy", { timestamp: line.timestamp }),
|
|
6049
6087
|
onClick: (event) => {
|
|
6050
6088
|
if (onSelectLine) event.stopPropagation();
|
|
6051
6089
|
copy(line);
|
|
@@ -6065,7 +6103,7 @@ const meta$39 = {
|
|
|
6065
6103
|
name: "Log viewer",
|
|
6066
6104
|
family: "builders",
|
|
6067
6105
|
status: "beta",
|
|
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.",
|
|
6106
|
+
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. Copy actions await the clipboard write; denied or unavailable access shows common.copyFailed (overridden by labels.copyFailed), and only a successful write calls onCopyLine. Both results reset after 1500ms. See the Catalog labels live preview.",
|
|
6069
6107
|
labels: [
|
|
6070
6108
|
{
|
|
6071
6109
|
key: "title",
|
|
@@ -6117,6 +6155,11 @@ const meta$39 = {
|
|
|
6117
6155
|
type: "(timestamp: string) => string",
|
|
6118
6156
|
state: "Copy button before copying"
|
|
6119
6157
|
},
|
|
6158
|
+
{
|
|
6159
|
+
key: "copyFailed",
|
|
6160
|
+
type: "string",
|
|
6161
|
+
state: "Copy button after a failed write, only on the affected line"
|
|
6162
|
+
},
|
|
6120
6163
|
{
|
|
6121
6164
|
key: "copied",
|
|
6122
6165
|
type: "string",
|
|
@@ -6284,54 +6327,64 @@ const KPI_ITEMS = [
|
|
|
6284
6327
|
//#endregion
|
|
6285
6328
|
//#region src/data-display/KpiRow/KpiRow.tsx
|
|
6286
6329
|
const COLS$3 = {
|
|
6287
|
-
1: "
|
|
6288
|
-
2: "
|
|
6289
|
-
3: "
|
|
6290
|
-
4: "
|
|
6291
|
-
5: "
|
|
6330
|
+
1: "@4xl:grid-cols-1",
|
|
6331
|
+
2: "@4xl:grid-cols-2",
|
|
6332
|
+
3: "@4xl:grid-cols-3",
|
|
6333
|
+
4: "@4xl:grid-cols-4",
|
|
6334
|
+
5: "@4xl:grid-cols-5"
|
|
6335
|
+
};
|
|
6336
|
+
const STRIP_DIVIDERS = {
|
|
6337
|
+
1: "",
|
|
6338
|
+
2: "@4xl:[&>div:not(:nth-child(2n)):not(:last-child)]:border-e",
|
|
6339
|
+
3: "@4xl:[&>div:not(:nth-child(3n)):not(:last-child)]:border-e",
|
|
6340
|
+
4: "@4xl:[&>div:not(:nth-child(4n)):not(:last-child)]:border-e",
|
|
6341
|
+
5: "@4xl:[&>div:not(:nth-child(5n)):not(:last-child)]:border-e"
|
|
6292
6342
|
};
|
|
6293
6343
|
/**
|
|
6294
6344
|
* KPI row: label, big number, delta (direction and sentiment are independent) and an optional
|
|
6295
6345
|
* Sparkline. A description list, so each label is announced with its value.
|
|
6296
6346
|
*/
|
|
6297
|
-
function KpiRow({ items = KPI_ITEMS, variant = "cards", showTrends = true, label = "Key metrics", className }) {
|
|
6347
|
+
function KpiRow({ items = KPI_ITEMS, variant = "cards", showTrends = true, label = "Key metrics", className, containerClassName }) {
|
|
6298
6348
|
const strip = variant === "strip";
|
|
6299
|
-
const cols = COLS$3[Math.min(items.length, 5)] ?? "
|
|
6300
|
-
return /* @__PURE__ */ jsx("
|
|
6301
|
-
"
|
|
6302
|
-
|
|
6303
|
-
|
|
6304
|
-
className: cn("
|
|
6305
|
-
children:
|
|
6306
|
-
|
|
6307
|
-
|
|
6308
|
-
|
|
6309
|
-
|
|
6310
|
-
|
|
6311
|
-
|
|
6312
|
-
|
|
6313
|
-
className:
|
|
6314
|
-
children:
|
|
6315
|
-
|
|
6316
|
-
|
|
6317
|
-
|
|
6318
|
-
|
|
6319
|
-
|
|
6320
|
-
|
|
6321
|
-
|
|
6322
|
-
|
|
6323
|
-
|
|
6324
|
-
|
|
6325
|
-
|
|
6326
|
-
|
|
6327
|
-
|
|
6328
|
-
|
|
6329
|
-
|
|
6330
|
-
|
|
6349
|
+
const cols = COLS$3[Math.min(items.length, 5)] ?? "@4xl:grid-cols-4";
|
|
6350
|
+
return /* @__PURE__ */ jsx("div", {
|
|
6351
|
+
className: cn("@container w-full min-w-0", containerClassName),
|
|
6352
|
+
children: /* @__PURE__ */ jsx("dl", {
|
|
6353
|
+
"aria-label": label,
|
|
6354
|
+
className: cn("grid grid-cols-1 @lg:grid-cols-2", cols, strip ? "overflow-hidden rounded-xl border border-border bg-card shadow-sm [&>div]:border-border @max-lg:[&>div:not(:last-child)]:border-b @lg:@max-4xl:[&>div:nth-child(odd):not(:last-child)]:border-e" : "gap-4", strip && (STRIP_DIVIDERS[Math.min(items.length, 5)] ?? STRIP_DIVIDERS[4]), className),
|
|
6355
|
+
children: items.map((item) => /* @__PURE__ */ jsxs("div", {
|
|
6356
|
+
className: cn("flex min-w-0 flex-col", strip ? "px-5 py-4" : "rounded-xl border border-border bg-card p-5 shadow-sm"),
|
|
6357
|
+
children: [
|
|
6358
|
+
/* @__PURE__ */ jsx("dt", {
|
|
6359
|
+
className: cn("truncate font-medium text-muted-foreground", strip ? "text-[12px]" : "text-[13px]"),
|
|
6360
|
+
children: item.label
|
|
6361
|
+
}),
|
|
6362
|
+
/* @__PURE__ */ jsxs("dd", {
|
|
6363
|
+
className: "mt-2 flex flex-wrap items-baseline gap-x-2 gap-y-1",
|
|
6364
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
6365
|
+
className: cn("font-semibold tracking-tight text-foreground tabular-nums", strip ? "text-[22px]" : "text-[26px]"),
|
|
6366
|
+
children: item.value
|
|
6367
|
+
}), item.delta && /* @__PURE__ */ jsx(TrendDelta, { ...item.delta })]
|
|
6368
|
+
}),
|
|
6369
|
+
item.delta?.note && !strip && /* @__PURE__ */ jsx("dd", {
|
|
6370
|
+
className: "mt-1 text-[12px] text-muted-foreground",
|
|
6371
|
+
children: item.delta.note
|
|
6372
|
+
}),
|
|
6373
|
+
showTrends && item.trend && item.trend.length > 1 && /* @__PURE__ */ jsx("dd", {
|
|
6374
|
+
className: "mt-3",
|
|
6375
|
+
children: /* @__PURE__ */ jsx(Sparkline, {
|
|
6376
|
+
data: item.trend,
|
|
6377
|
+
label: item.label,
|
|
6378
|
+
area: true,
|
|
6379
|
+
tone: item.trendTone ?? "primary",
|
|
6380
|
+
width: 240,
|
|
6381
|
+
height: 40,
|
|
6382
|
+
className: "block h-auto w-full"
|
|
6383
|
+
})
|
|
6331
6384
|
})
|
|
6332
|
-
|
|
6333
|
-
|
|
6334
|
-
}
|
|
6385
|
+
]
|
|
6386
|
+
}, item.id))
|
|
6387
|
+
})
|
|
6335
6388
|
});
|
|
6336
6389
|
}
|
|
6337
6390
|
//#endregion
|
|
@@ -6510,7 +6563,7 @@ function StatCard({ label = "Requests", icon: IconCmp = Activity, ranges = STAT_
|
|
|
6510
6563
|
}
|
|
6511
6564
|
//#endregion
|
|
6512
6565
|
//#region src/data-display/StatCard/block.meta.ts
|
|
6513
|
-
const meta$
|
|
6566
|
+
const meta$68 = {
|
|
6514
6567
|
name: "Stat card",
|
|
6515
6568
|
family: "data-display",
|
|
6516
6569
|
status: "beta",
|
|
@@ -6722,7 +6775,7 @@ function ChartCard({ title = "Infrastructure cost", description = "Spend by reso
|
|
|
6722
6775
|
return /* @__PURE__ */ jsx(ChartLocaleProvider, {
|
|
6723
6776
|
locale,
|
|
6724
6777
|
children: /* @__PURE__ */ jsxs(Card, {
|
|
6725
|
-
className,
|
|
6778
|
+
className: cn("@container w-full min-w-0", className),
|
|
6726
6779
|
children: [
|
|
6727
6780
|
/* @__PURE__ */ jsxs(CardHeader, {
|
|
6728
6781
|
className: "pb-2",
|
|
@@ -6767,7 +6820,7 @@ function ChartCard({ title = "Infrastructure cost", description = "Spend by reso
|
|
|
6767
6820
|
}), active.summary.delta && /* @__PURE__ */ jsx(TrendDelta, { ...active.summary.delta })]
|
|
6768
6821
|
}),
|
|
6769
6822
|
/* @__PURE__ */ jsx("div", {
|
|
6770
|
-
className: cn("px-3 pb-4 pt-3 sm:px-4", !footer && "pb-5"),
|
|
6823
|
+
className: cn("px-3 pb-4 pt-3 @sm:px-4", !footer && "pb-5"),
|
|
6771
6824
|
children: kind === "heatmap" ? /* @__PURE__ */ jsx(Heatmap, {
|
|
6772
6825
|
data,
|
|
6773
6826
|
index,
|
|
@@ -6863,22 +6916,15 @@ const DEPLOYMENT_DETAILS = [
|
|
|
6863
6916
|
//#region src/data-display/DescriptionListCard/DescriptionListCard.tsx
|
|
6864
6917
|
function CopyButton$1({ item, onCopy, labels }) {
|
|
6865
6918
|
const { t } = useI18n();
|
|
6866
|
-
const
|
|
6867
|
-
|
|
6868
|
-
|
|
6869
|
-
|
|
6870
|
-
|
|
6871
|
-
|
|
6872
|
-
await navigator.clipboard?.writeText(text);
|
|
6873
|
-
} catch {}
|
|
6874
|
-
setCopied(true);
|
|
6875
|
-
onCopy?.(item);
|
|
6876
|
-
window.clearTimeout(timer.current);
|
|
6877
|
-
timer.current = window.setTimeout(() => setCopied(false), 1500);
|
|
6878
|
-
};
|
|
6919
|
+
const { status, copied, copy: copyText } = useClipboard({
|
|
6920
|
+
timeout: 1500,
|
|
6921
|
+
onCopy: () => onCopy?.(item)
|
|
6922
|
+
});
|
|
6923
|
+
const failedText = labels?.copyFailed ?? t("common.copyFailed");
|
|
6924
|
+
const copy = () => copyText(item.copyValue ?? item.value ?? "");
|
|
6879
6925
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(IconButton, {
|
|
6880
|
-
icon: copied ? Check : Copy,
|
|
6881
|
-
label: copied ? labels?.copied?.(item.label) ?? t("descriptionList.copied", { label: item.label }) : labels?.copy?.(item.label) ?? t("descriptionList.copy", { label: item.label }),
|
|
6926
|
+
icon: status === "failed" ? X : copied ? Check : Copy,
|
|
6927
|
+
label: status === "failed" ? failedText : copied ? labels?.copied?.(item.label) ?? t("descriptionList.copied", { label: item.label }) : labels?.copy?.(item.label) ?? t("descriptionList.copy", { label: item.label }),
|
|
6882
6928
|
size: "sm",
|
|
6883
6929
|
variant: "ghost",
|
|
6884
6930
|
className: cn("size-7 shrink-0", copied && "text-success-text"),
|
|
@@ -6886,7 +6932,7 @@ function CopyButton$1({ item, onCopy, labels }) {
|
|
|
6886
6932
|
}), /* @__PURE__ */ jsx("span", {
|
|
6887
6933
|
className: "sr-only",
|
|
6888
6934
|
"aria-live": "polite",
|
|
6889
|
-
children: copied ? labels?.copiedToClipboard ?? t("common.copiedToClipboard") : ""
|
|
6935
|
+
children: status === "failed" ? failedText : copied ? labels?.copiedToClipboard ?? t("common.copiedToClipboard") : ""
|
|
6890
6936
|
})] });
|
|
6891
6937
|
}
|
|
6892
6938
|
/** Key–value detail card: label column, values (mono, status or rich), copy buttons and an Edit action. */
|
|
@@ -6949,7 +6995,7 @@ const meta$18 = {
|
|
|
6949
6995
|
name: "Description list card",
|
|
6950
6996
|
family: "data-display",
|
|
6951
6997
|
status: "beta",
|
|
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.",
|
|
6998
|
+
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. Copy actions await the clipboard write; denied or unavailable access shows common.copyFailed (overridden by labels.copyFailed), and only a successful write calls onCopy. Both results reset after 1500ms. See the Catalog labels live preview.",
|
|
6953
6999
|
labels: [
|
|
6954
7000
|
{
|
|
6955
7001
|
key: "title",
|
|
@@ -6976,6 +7022,11 @@ const meta$18 = {
|
|
|
6976
7022
|
type: "(label: string) => string",
|
|
6977
7023
|
state: "Copy button name after copying; original item label"
|
|
6978
7024
|
},
|
|
7025
|
+
{
|
|
7026
|
+
key: "copyFailed",
|
|
7027
|
+
type: "string",
|
|
7028
|
+
state: "Copy button name and polite announcement after a failed write"
|
|
7029
|
+
},
|
|
6979
7030
|
{
|
|
6980
7031
|
key: "copiedToClipboard",
|
|
6981
7032
|
type: "string",
|
|
@@ -7081,12 +7132,12 @@ const RESOURCE_CARDS = [
|
|
|
7081
7132
|
//#endregion
|
|
7082
7133
|
//#region src/data-display/ResourceCardGrid/ResourceCardGrid.tsx
|
|
7083
7134
|
const COLS$2 = {
|
|
7084
|
-
2: "
|
|
7085
|
-
3: "
|
|
7086
|
-
4: "
|
|
7135
|
+
2: "@xl:grid-cols-2",
|
|
7136
|
+
3: "@xl:grid-cols-2 @4xl:grid-cols-3",
|
|
7137
|
+
4: "@xl:grid-cols-2 @3xl:grid-cols-3 @4xl:grid-cols-4"
|
|
7087
7138
|
};
|
|
7088
7139
|
/** Responsive grid of resource cards: icon or avatar, name, status, meta figures and a row-actions MoreMenu. */
|
|
7089
|
-
function ResourceCardGrid({ items = RESOURCE_CARDS, label = "Resources", onAction, getActions, columns = 3, titleAs: TitleTag = "h3", className }) {
|
|
7140
|
+
function ResourceCardGrid({ items = RESOURCE_CARDS, label = "Resources", onAction, getActions, columns = 3, titleAs: TitleTag = "h3", className, containerClassName }) {
|
|
7090
7141
|
const defaults = (item) => [
|
|
7091
7142
|
{
|
|
7092
7143
|
label: "Open",
|
|
@@ -7111,69 +7162,72 @@ function ResourceCardGrid({ items = RESOURCE_CARDS, label = "Resources", onActio
|
|
|
7111
7162
|
onSelect: () => onAction?.("delete", item)
|
|
7112
7163
|
}
|
|
7113
7164
|
];
|
|
7114
|
-
return /* @__PURE__ */ jsx("
|
|
7115
|
-
"
|
|
7116
|
-
|
|
7117
|
-
|
|
7118
|
-
|
|
7119
|
-
|
|
7120
|
-
|
|
7121
|
-
|
|
7122
|
-
|
|
7123
|
-
|
|
7124
|
-
|
|
7125
|
-
|
|
7126
|
-
|
|
7127
|
-
|
|
7128
|
-
|
|
7129
|
-
|
|
7130
|
-
|
|
7131
|
-
|
|
7132
|
-
|
|
7133
|
-
|
|
7134
|
-
|
|
7135
|
-
|
|
7136
|
-
|
|
7137
|
-
|
|
7138
|
-
|
|
7139
|
-
|
|
7140
|
-
|
|
7141
|
-
|
|
7142
|
-
|
|
7165
|
+
return /* @__PURE__ */ jsx("div", {
|
|
7166
|
+
className: cn("@container w-full min-w-0", containerClassName),
|
|
7167
|
+
children: /* @__PURE__ */ jsx("ul", {
|
|
7168
|
+
"aria-label": label,
|
|
7169
|
+
className: cn("grid grid-cols-1 gap-4", COLS$2[columns], className),
|
|
7170
|
+
children: items.map((item) => {
|
|
7171
|
+
const actions = getActions ? getActions(item) : defaults(item);
|
|
7172
|
+
const IconCmp = item.icon;
|
|
7173
|
+
return /* @__PURE__ */ jsxs("li", {
|
|
7174
|
+
className: "flex min-w-0 flex-col rounded-xl border border-border bg-card p-5 shadow-sm",
|
|
7175
|
+
children: [
|
|
7176
|
+
/* @__PURE__ */ jsxs("div", {
|
|
7177
|
+
className: "flex items-start justify-between gap-3",
|
|
7178
|
+
children: [item.avatar ? /* @__PURE__ */ jsx(Avatar, {
|
|
7179
|
+
name: item.avatar.name,
|
|
7180
|
+
src: item.avatar.src,
|
|
7181
|
+
size: "md",
|
|
7182
|
+
shape: "rounded"
|
|
7183
|
+
}) : /* @__PURE__ */ jsx("span", {
|
|
7184
|
+
className: "inline-flex size-10 shrink-0 items-center justify-center rounded-lg bg-secondary text-muted-foreground",
|
|
7185
|
+
children: IconCmp && /* @__PURE__ */ jsx(IconCmp, {
|
|
7186
|
+
size: 20,
|
|
7187
|
+
"aria-hidden": true
|
|
7188
|
+
})
|
|
7189
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
7190
|
+
className: "flex items-center gap-2",
|
|
7191
|
+
children: [item.status && /* @__PURE__ */ jsx(StatusTag, { status: item.status }), actions.length > 0 && /* @__PURE__ */ jsx(MoreMenu, {
|
|
7192
|
+
items: actions,
|
|
7193
|
+
label: `Actions for ${item.name}`,
|
|
7194
|
+
variant: "ghost",
|
|
7195
|
+
size: "sm"
|
|
7196
|
+
})]
|
|
7143
7197
|
})]
|
|
7144
|
-
})
|
|
7145
|
-
|
|
7146
|
-
|
|
7147
|
-
|
|
7148
|
-
|
|
7149
|
-
|
|
7150
|
-
|
|
7151
|
-
|
|
7152
|
-
|
|
7153
|
-
children: item.description
|
|
7154
|
-
})]
|
|
7155
|
-
}),
|
|
7156
|
-
item.meta && item.meta.length > 0 && /* @__PURE__ */ jsx("dl", {
|
|
7157
|
-
className: "mt-4 grid grid-cols-2 gap-3 border-t border-border pt-4",
|
|
7158
|
-
children: item.meta.map((m) => /* @__PURE__ */ jsxs("div", {
|
|
7159
|
-
className: "flex min-w-0 flex-col-reverse",
|
|
7160
|
-
children: [/* @__PURE__ */ jsx("dt", {
|
|
7161
|
-
className: "truncate text-[11px] text-muted-foreground",
|
|
7162
|
-
children: m.label
|
|
7163
|
-
}), /* @__PURE__ */ jsx("dd", {
|
|
7164
|
-
className: "truncate font-mono text-[14px] text-foreground tabular-nums",
|
|
7165
|
-
children: m.value
|
|
7198
|
+
}),
|
|
7199
|
+
/* @__PURE__ */ jsxs("div", {
|
|
7200
|
+
className: "mt-4 min-w-0",
|
|
7201
|
+
children: [/* @__PURE__ */ jsx(TitleTag, {
|
|
7202
|
+
className: "truncate text-[14px] font-semibold text-foreground",
|
|
7203
|
+
children: item.name
|
|
7204
|
+
}), item.description && /* @__PURE__ */ jsx("p", {
|
|
7205
|
+
className: "mt-0.5 truncate text-[12.5px] text-muted-foreground",
|
|
7206
|
+
children: item.description
|
|
7166
7207
|
})]
|
|
7167
|
-
},
|
|
7168
|
-
|
|
7169
|
-
|
|
7170
|
-
|
|
7208
|
+
}),
|
|
7209
|
+
item.meta && item.meta.length > 0 && /* @__PURE__ */ jsx("dl", {
|
|
7210
|
+
className: "mt-4 grid grid-cols-2 gap-3 border-t border-border pt-4",
|
|
7211
|
+
children: item.meta.map((m) => /* @__PURE__ */ jsxs("div", {
|
|
7212
|
+
className: "flex min-w-0 flex-col-reverse",
|
|
7213
|
+
children: [/* @__PURE__ */ jsx("dt", {
|
|
7214
|
+
className: "truncate text-[11px] text-muted-foreground",
|
|
7215
|
+
children: m.label
|
|
7216
|
+
}), /* @__PURE__ */ jsx("dd", {
|
|
7217
|
+
className: "truncate font-mono text-[14px] text-foreground tabular-nums",
|
|
7218
|
+
children: m.value
|
|
7219
|
+
})]
|
|
7220
|
+
}, m.label))
|
|
7221
|
+
})
|
|
7222
|
+
]
|
|
7223
|
+
}, item.id);
|
|
7224
|
+
})
|
|
7171
7225
|
})
|
|
7172
7226
|
});
|
|
7173
7227
|
}
|
|
7174
7228
|
//#endregion
|
|
7175
7229
|
//#region src/data-display/ResourceCardGrid/block.meta.ts
|
|
7176
|
-
const meta$
|
|
7230
|
+
const meta$58 = {
|
|
7177
7231
|
name: "Resource card grid",
|
|
7178
7232
|
family: "data-display",
|
|
7179
7233
|
status: "beta",
|
|
@@ -7281,7 +7335,7 @@ function StatusTimeline({ events = DEPLOYMENT_EVENTS, label: labelProp, emptyLab
|
|
|
7281
7335
|
className: "absolute top-5 bottom-0 start-[9px] w-px bg-border"
|
|
7282
7336
|
}),
|
|
7283
7337
|
/* @__PURE__ */ jsx("span", {
|
|
7284
|
-
className: "relative z-
|
|
7338
|
+
className: "relative z-raised mt-1 flex size-5 shrink-0 items-center justify-center rounded-full bg-card",
|
|
7285
7339
|
children: /* @__PURE__ */ jsx(StatusDot, {
|
|
7286
7340
|
tone: event.tone,
|
|
7287
7341
|
pulse: event.live,
|
|
@@ -7334,7 +7388,7 @@ function StatusTimeline({ events = DEPLOYMENT_EVENTS, label: labelProp, emptyLab
|
|
|
7334
7388
|
}
|
|
7335
7389
|
//#endregion
|
|
7336
7390
|
//#region src/data-display/StatusTimeline/block.meta.ts
|
|
7337
|
-
const meta$
|
|
7391
|
+
const meta$69 = {
|
|
7338
7392
|
name: "Status timeline",
|
|
7339
7393
|
family: "data-display",
|
|
7340
7394
|
status: "beta",
|
|
@@ -7440,7 +7494,7 @@ function ActivityFeed({ items = PROJECT_ACTIVITY, label = "Recent activity", now
|
|
|
7440
7494
|
const headingId = `${id}-${group.key}`;
|
|
7441
7495
|
return /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(GroupTag, {
|
|
7442
7496
|
id: headingId,
|
|
7443
|
-
className: "mb-3 font-mono text-[10.5px] font-medium tracking-[0.12em] text-muted-foreground
|
|
7497
|
+
className: "mb-3 font-mono text-[10.5px] font-medium tracking-[0.12em] text-muted-foreground label-case",
|
|
7444
7498
|
children: group.label
|
|
7445
7499
|
}), /* @__PURE__ */ jsx("ul", {
|
|
7446
7500
|
"aria-labelledby": headingId,
|
|
@@ -7534,8 +7588,8 @@ const REVIEW_COMMENTS = [
|
|
|
7534
7588
|
];
|
|
7535
7589
|
//#endregion
|
|
7536
7590
|
//#region src/data-display/CommentThread/CommentThread.tsx
|
|
7537
|
-
/** Comment thread: avatar, author, plain
|
|
7538
|
-
function CommentThread({ comments = REVIEW_COMMENTS, currentUser = COMMENT_AUTHOR, onSubmit, appendOnSubmit = true, label: labelProp, placeholder: placeholderProp, submitLabel: submitLabelProp, className }) {
|
|
7591
|
+
/** Comment thread: avatar, author, plain text (or Markdown via renderBody) and Timestamp, with a reply composer (⌘/Ctrl+Enter posts). */
|
|
7592
|
+
function CommentThread({ comments = REVIEW_COMMENTS, renderBody, currentUser = COMMENT_AUTHOR, onSubmit, appendOnSubmit = true, label: labelProp, placeholder: placeholderProp, submitLabel: submitLabelProp, composerHint, className }) {
|
|
7539
7593
|
const { t } = useI18n();
|
|
7540
7594
|
const label = labelProp ?? t("comments.label");
|
|
7541
7595
|
const placeholder = placeholderProp ?? t("comments.placeholder");
|
|
@@ -7583,7 +7637,7 @@ function CommentThread({ comments = REVIEW_COMMENTS, currentUser = COMMENT_AUTHO
|
|
|
7583
7637
|
name: comment.author.name,
|
|
7584
7638
|
src: comment.author.src,
|
|
7585
7639
|
size: "sm",
|
|
7586
|
-
className: "relative z-
|
|
7640
|
+
className: "relative z-raised"
|
|
7587
7641
|
}),
|
|
7588
7642
|
/* @__PURE__ */ jsxs("article", {
|
|
7589
7643
|
className: "min-w-0 flex-1 rounded-lg border border-border bg-background/50 p-3",
|
|
@@ -7596,7 +7650,10 @@ function CommentThread({ comments = REVIEW_COMMENTS, currentUser = COMMENT_AUTHO
|
|
|
7596
7650
|
value: comment.at,
|
|
7597
7651
|
className: "font-mono text-[11px]"
|
|
7598
7652
|
})]
|
|
7599
|
-
}), /* @__PURE__ */ jsx("
|
|
7653
|
+
}), renderBody ? /* @__PURE__ */ jsx("div", {
|
|
7654
|
+
className: "mt-1 text-[13px] leading-relaxed text-foreground/85",
|
|
7655
|
+
children: renderBody(comment)
|
|
7656
|
+
}) : /* @__PURE__ */ jsx("p", {
|
|
7600
7657
|
className: "mt-1 text-[13px] leading-relaxed whitespace-pre-line text-foreground/85",
|
|
7601
7658
|
children: comment.body
|
|
7602
7659
|
})]
|
|
@@ -7627,7 +7684,7 @@ function CommentThread({ comments = REVIEW_COMMENTS, currentUser = COMMENT_AUTHO
|
|
|
7627
7684
|
children: [/* @__PURE__ */ jsx("span", {
|
|
7628
7685
|
id: hintId,
|
|
7629
7686
|
className: "text-[11.5px] text-muted-foreground",
|
|
7630
|
-
children:
|
|
7687
|
+
children: composerHint ?? t(renderBody ? "comments.hintMarkdown" : "comments.hintPlain")
|
|
7631
7688
|
}), /* @__PURE__ */ jsx(Button, {
|
|
7632
7689
|
type: "submit",
|
|
7633
7690
|
size: "sm",
|
|
@@ -7645,7 +7702,7 @@ const meta$8 = {
|
|
|
7645
7702
|
name: "Comment thread",
|
|
7646
7703
|
family: "data-display",
|
|
7647
7704
|
status: "beta",
|
|
7648
|
-
description: "Plain-text comments with avatar, author and Timestamp, plus a reply composer (Textarea + Button, ⌘/Ctrl+Enter posts).",
|
|
7705
|
+
description: "Plain-text comments by default, with optional renderBody for safe Markdown, avatar, author and Timestamp, plus a reply composer (Textarea + Button, ⌘/Ctrl+Enter posts). renderBody receives the raw comment; use a safe renderer such as @gntik-ai/chat Markdown (without allowHtml). Bodies are untrusted: never inject raw HTML. composerHint overrides the catalog hint and remains the textarea’s accessible description.",
|
|
7649
7706
|
uses: [
|
|
7650
7707
|
"Avatar",
|
|
7651
7708
|
"Timestamp",
|
|
@@ -7736,7 +7793,7 @@ function SystemBanner({ kind = "maintenance", title = "Scheduled maintenance.",
|
|
|
7736
7793
|
}
|
|
7737
7794
|
//#endregion
|
|
7738
7795
|
//#region src/feedback/SystemBanner/block.meta.ts
|
|
7739
|
-
const meta$
|
|
7796
|
+
const meta$72 = {
|
|
7740
7797
|
name: "System banner",
|
|
7741
7798
|
family: "feedback",
|
|
7742
7799
|
status: "beta",
|
|
@@ -7858,7 +7915,7 @@ function FirstRunEmpty({ icon = FolderPlus, title: titleProp, labels, descriptio
|
|
|
7858
7915
|
const { t } = useI18n();
|
|
7859
7916
|
const title = titleProp === void 0 ? labels?.title ?? t("emptyState.firstRun.title") : titleProp;
|
|
7860
7917
|
const description = descriptionProp === void 0 ? labels?.description ?? t("emptyState.firstRun.description") : descriptionProp;
|
|
7861
|
-
const actionLabel = actionLabelProp
|
|
7918
|
+
const actionLabel = actionLabelProp === void 0 ? labels?.action ?? t("emptyState.firstRun.action") : actionLabelProp;
|
|
7862
7919
|
const secondary = secondaryProp === void 0 ? {
|
|
7863
7920
|
label: labels?.guide ?? t("emptyState.firstRun.guide"),
|
|
7864
7921
|
href: "#guide"
|
|
@@ -7870,10 +7927,10 @@ function FirstRunEmpty({ icon = FolderPlus, title: titleProp, labels, descriptio
|
|
|
7870
7927
|
description,
|
|
7871
7928
|
bordered,
|
|
7872
7929
|
className: cn("mx-auto", className),
|
|
7873
|
-
primaryAction: /* @__PURE__ */ jsx(Button, {
|
|
7930
|
+
primaryAction: actionLabel ? /* @__PURE__ */ jsx(Button, {
|
|
7874
7931
|
onClick: onAction,
|
|
7875
7932
|
children: actionLabel
|
|
7876
|
-
}),
|
|
7933
|
+
}) : void 0,
|
|
7877
7934
|
secondaryAction: secondary ? /* @__PURE__ */ jsx(Link, {
|
|
7878
7935
|
underline: "hover",
|
|
7879
7936
|
href: secondary.href,
|
|
@@ -7975,7 +8032,7 @@ const meta$20 = {
|
|
|
7975
8032
|
name: "Empty states",
|
|
7976
8033
|
family: "feedback",
|
|
7977
8034
|
status: "beta",
|
|
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.",
|
|
8035
|
+
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. FirstRunEmpty accepts actionLabel?: string | null: omitting it uses labels.action or the localized default; actionLabel={null} or actionLabel=\"\" hides the primary action and ignores onAction. An empty labels.action also hides it. Combine actionLabel={null}, secondary={null} and steps={[]} for a state with no actions or checklist. See the Hidden action live preview. 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
8036
|
labels: [
|
|
7980
8037
|
{
|
|
7981
8038
|
key: "FirstRunEmpty.labels.title",
|
|
@@ -8191,7 +8248,7 @@ function PageSkeleton({ stats = 4, rows = 5, label: labelProp, className }) {
|
|
|
8191
8248
|
}
|
|
8192
8249
|
//#endregion
|
|
8193
8250
|
//#region src/feedback/Skeletons/block.meta.ts
|
|
8194
|
-
const meta$
|
|
8251
|
+
const meta$65 = {
|
|
8195
8252
|
name: "Skeletons",
|
|
8196
8253
|
family: "feedback",
|
|
8197
8254
|
status: "beta",
|
|
@@ -8212,8 +8269,7 @@ function ErrorPanel({ icon: Icon = ServerCrash, title: titleProp, labels, messag
|
|
|
8212
8269
|
const retryLabel = retryLabelProp ?? labels?.retry ?? t("error.retry");
|
|
8213
8270
|
const id = useId();
|
|
8214
8271
|
const [innerRetrying, setInnerRetrying] = useState(false);
|
|
8215
|
-
const
|
|
8216
|
-
const copyTimer = useRef(void 0);
|
|
8272
|
+
const { copied, copy: copyText } = useClipboard();
|
|
8217
8273
|
const busy = retrying ?? innerRetrying;
|
|
8218
8274
|
const retry = async () => {
|
|
8219
8275
|
if (!onRetry || busy) return;
|
|
@@ -8224,17 +8280,7 @@ function ErrorPanel({ icon: Icon = ServerCrash, title: titleProp, labels, messag
|
|
|
8224
8280
|
setInnerRetrying(false);
|
|
8225
8281
|
}
|
|
8226
8282
|
};
|
|
8227
|
-
const copy =
|
|
8228
|
-
if (!requestId) return;
|
|
8229
|
-
try {
|
|
8230
|
-
await navigator.clipboard.writeText(requestId);
|
|
8231
|
-
setCopied(true);
|
|
8232
|
-
clearTimeout(copyTimer.current);
|
|
8233
|
-
copyTimer.current = setTimeout(() => setCopied(false), 2e3);
|
|
8234
|
-
} catch {
|
|
8235
|
-
setCopied(false);
|
|
8236
|
-
}
|
|
8237
|
-
};
|
|
8283
|
+
const copy = () => requestId && copyText(requestId);
|
|
8238
8284
|
return /* @__PURE__ */ jsx("section", {
|
|
8239
8285
|
"aria-labelledby": `${id}-title`,
|
|
8240
8286
|
className: cn("rounded-lg border border-destructive/30 bg-card p-5 shadow-sm", className),
|
|
@@ -8922,155 +8968,136 @@ function generateDemoSecret(prefix = "sk_live_") {
|
|
|
8922
8968
|
* Two-step API key dialog: name, scopes and expiry, then the secret shown once in a CodeBlock
|
|
8923
8969
|
* with copy. Closing the dialog discards the secret; it can't be shown again.
|
|
8924
8970
|
*/
|
|
8925
|
-
function CreateApiKeyDialog({ labels, scopes = apiKeyScopes, expiries = apiKeyExpiries, defaultExpiry = "90d", onCreate = () => generateDemoSecret(), open
|
|
8971
|
+
function CreateApiKeyDialog({ labels, scopes = apiKeyScopes, expiries = apiKeyExpiries, defaultExpiry = "90d", onCreate = () => generateDemoSecret(), open, defaultOpen = false, onOpenChange, trigger = /* @__PURE__ */ jsx(Button, { icon: KeyRound }) }) {
|
|
8926
8972
|
const { t } = useI18n();
|
|
8927
|
-
const [innerOpen, setInnerOpen] = useState(defaultOpen);
|
|
8928
8973
|
const [name, setName] = useState("");
|
|
8929
8974
|
const [selected, setSelected] = useState([]);
|
|
8930
8975
|
const [expiry, setExpiry] = useState(defaultExpiry);
|
|
8931
8976
|
const [submitted, setSubmitted] = useState(false);
|
|
8932
|
-
const [loading, setLoading] = useState(false);
|
|
8933
8977
|
const [error, setError] = useState(null);
|
|
8934
8978
|
const [secret, setSecret] = useState(null);
|
|
8935
|
-
const
|
|
8979
|
+
const opening = useRef(0);
|
|
8980
|
+
useEffect(() => {
|
|
8981
|
+
opening.current += 1;
|
|
8982
|
+
}, [open]);
|
|
8936
8983
|
const nameInvalid = submitted && name.trim() === "";
|
|
8937
8984
|
const scopesInvalid = submitted && selected.length === 0;
|
|
8938
|
-
const
|
|
8939
|
-
|
|
8940
|
-
|
|
8941
|
-
|
|
8942
|
-
|
|
8943
|
-
|
|
8944
|
-
|
|
8945
|
-
setError(null);
|
|
8946
|
-
setSecret(null);
|
|
8947
|
-
}
|
|
8948
|
-
setInnerOpen(next);
|
|
8949
|
-
onOpenChange?.(next);
|
|
8950
|
-
};
|
|
8951
|
-
const submit = async () => {
|
|
8952
|
-
setSubmitted(true);
|
|
8985
|
+
const formTitle = labels?.title ?? t("createApiKey.title");
|
|
8986
|
+
const reset = () => {
|
|
8987
|
+
opening.current += 1;
|
|
8988
|
+
setName("");
|
|
8989
|
+
setSelected([]);
|
|
8990
|
+
setExpiry(defaultExpiry);
|
|
8991
|
+
setSubmitted(false);
|
|
8953
8992
|
setError(null);
|
|
8954
|
-
|
|
8955
|
-
|
|
8993
|
+
setSecret(null);
|
|
8994
|
+
};
|
|
8995
|
+
const create = async () => {
|
|
8996
|
+
const current = opening.current;
|
|
8956
8997
|
try {
|
|
8957
|
-
const
|
|
8998
|
+
const created = await onCreate({
|
|
8958
8999
|
name: name.trim(),
|
|
8959
9000
|
scopes: selected,
|
|
8960
9001
|
expiry
|
|
8961
9002
|
});
|
|
8962
|
-
setSecret(
|
|
9003
|
+
if (current === opening.current) setSecret(created);
|
|
8963
9004
|
} catch (e) {
|
|
8964
|
-
setError(e instanceof Error ? e.message : labels?.fallbackError ?? t("createApiKey.fallbackError"));
|
|
9005
|
+
if (current === opening.current) setError(e instanceof Error ? e.message : labels?.fallbackError ?? t("createApiKey.fallbackError"));
|
|
8965
9006
|
}
|
|
8966
|
-
|
|
9007
|
+
return false;
|
|
8967
9008
|
};
|
|
8968
|
-
|
|
9009
|
+
const submit = () => {
|
|
9010
|
+
if (secret != null) return false;
|
|
9011
|
+
setSubmitted(true);
|
|
9012
|
+
setError(null);
|
|
9013
|
+
if (name.trim() === "" || selected.length === 0) return false;
|
|
9014
|
+
return create();
|
|
9015
|
+
};
|
|
9016
|
+
const triggerHasChildren = trigger != null && Children.count(trigger.props.children) > 0;
|
|
9017
|
+
const labelledTrigger = trigger == null || triggerHasChildren ? trigger : cloneElement(trigger, void 0, formTitle);
|
|
9018
|
+
return /* @__PURE__ */ jsx(FormDialog, {
|
|
9019
|
+
size: "lg",
|
|
9020
|
+
title: secret == null ? formTitle : labels?.successTitle ?? t("createApiKey.successTitle"),
|
|
9021
|
+
description: secret == null ? labels?.description ?? t("createApiKey.description") : labels?.successDescription ?? t("createApiKey.successDescription"),
|
|
9022
|
+
trigger: labelledTrigger ?? void 0,
|
|
8969
9023
|
open,
|
|
8970
|
-
|
|
8971
|
-
|
|
8972
|
-
|
|
8973
|
-
|
|
8974
|
-
|
|
8975
|
-
|
|
8976
|
-
|
|
8977
|
-
|
|
8978
|
-
|
|
8979
|
-
|
|
8980
|
-
|
|
8981
|
-
|
|
8982
|
-
|
|
8983
|
-
|
|
8984
|
-
|
|
8985
|
-
|
|
8986
|
-
|
|
8987
|
-
|
|
8988
|
-
|
|
8989
|
-
|
|
8990
|
-
|
|
8991
|
-
|
|
8992
|
-
/* @__PURE__ */ jsx(Input, {
|
|
8993
|
-
value: name,
|
|
8994
|
-
onValueChange: setName,
|
|
8995
|
-
placeholder: labels?.namePlaceholder ?? t("createApiKey.namePlaceholder"),
|
|
8996
|
-
required: true,
|
|
8997
|
-
autoComplete: "off"
|
|
8998
|
-
}),
|
|
8999
|
-
/* @__PURE__ */ jsx(FieldError, {
|
|
9000
|
-
match: nameInvalid,
|
|
9001
|
-
children: labels?.nameRequired ?? t("createApiKey.nameRequired")
|
|
9002
|
-
})
|
|
9003
|
-
]
|
|
9004
|
-
}),
|
|
9005
|
-
/* @__PURE__ */ jsxs(Fieldset, {
|
|
9006
|
-
render: /* @__PURE__ */ jsx(CheckboxGroup, {
|
|
9007
|
-
value: selected,
|
|
9008
|
-
onValueChange: setSelected
|
|
9009
|
-
}),
|
|
9010
|
-
"aria-invalid": scopesInvalid || void 0,
|
|
9011
|
-
children: [
|
|
9012
|
-
/* @__PURE__ */ jsx(FieldsetLegend, { children: labels?.scopes ?? t("createApiKey.scopes") }),
|
|
9013
|
-
scopes.map((s) => /* @__PURE__ */ jsx(Checkbox, {
|
|
9014
|
-
value: s.value,
|
|
9015
|
-
label: /* @__PURE__ */ jsx("span", {
|
|
9016
|
-
className: "font-mono",
|
|
9017
|
-
children: s.label
|
|
9018
|
-
}),
|
|
9019
|
-
description: s.description
|
|
9020
|
-
}, s.value)),
|
|
9021
|
-
scopesInvalid && /* @__PURE__ */ jsx("p", {
|
|
9022
|
-
className: "text-[12.5px] text-destructive-text",
|
|
9023
|
-
children: labels?.scopesRequired ?? t("createApiKey.scopesRequired")
|
|
9024
|
-
})
|
|
9025
|
-
]
|
|
9026
|
-
}),
|
|
9027
|
-
/* @__PURE__ */ jsxs(Field, { children: [/* @__PURE__ */ jsx(FieldLabel, { children: labels?.expiration ?? t("createApiKey.expiration") }), /* @__PURE__ */ jsxs(Select, {
|
|
9028
|
-
value: expiry,
|
|
9029
|
-
onValueChange: (v) => v != null && setExpiry(v),
|
|
9030
|
-
items: expiries,
|
|
9031
|
-
children: [/* @__PURE__ */ jsx(SelectTrigger, { className: "w-full sm:w-56" }), /* @__PURE__ */ jsx(SelectContent, { children: expiries.map((x) => /* @__PURE__ */ jsx(SelectItem, {
|
|
9032
|
-
value: x.value,
|
|
9033
|
-
children: x.label
|
|
9034
|
-
}, x.value)) })]
|
|
9035
|
-
})] }),
|
|
9036
|
-
error && /* @__PURE__ */ jsx(Alert, {
|
|
9037
|
-
tone: "destructive",
|
|
9038
|
-
title: labels?.errorTitle ?? t("createApiKey.errorTitle"),
|
|
9039
|
-
description: error
|
|
9040
|
-
})
|
|
9041
|
-
]
|
|
9042
|
-
}), /* @__PURE__ */ jsxs(DialogFooter, { children: [/* @__PURE__ */ jsx(DialogClose, {
|
|
9043
|
-
render: /* @__PURE__ */ jsx(Button, {
|
|
9044
|
-
variant: "ghost",
|
|
9045
|
-
disabled: loading
|
|
9024
|
+
defaultOpen,
|
|
9025
|
+
onOpenChange,
|
|
9026
|
+
onSubmit: submit,
|
|
9027
|
+
onClosed: reset,
|
|
9028
|
+
cancelLabel: labels?.cancel ?? t("createApiKey.cancel"),
|
|
9029
|
+
submitLabel: labels?.submit ?? t("createApiKey.submit"),
|
|
9030
|
+
footer: secret == null ? void 0 : /* @__PURE__ */ jsx(DialogClose, {
|
|
9031
|
+
render: /* @__PURE__ */ jsx(Button, {}),
|
|
9032
|
+
children: labels?.done ?? t("createApiKey.done")
|
|
9033
|
+
}),
|
|
9034
|
+
summary: error && /* @__PURE__ */ jsx(Alert, {
|
|
9035
|
+
tone: "destructive",
|
|
9036
|
+
title: labels?.errorTitle ?? t("createApiKey.errorTitle"),
|
|
9037
|
+
description: error
|
|
9038
|
+
}),
|
|
9039
|
+
children: secret == null ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
9040
|
+
/* @__PURE__ */ jsxs(Field, {
|
|
9041
|
+
invalid: nameInvalid,
|
|
9042
|
+
children: [
|
|
9043
|
+
/* @__PURE__ */ jsx(FieldLabel, {
|
|
9044
|
+
required: true,
|
|
9045
|
+
children: labels?.name ?? t("createApiKey.name")
|
|
9046
9046
|
}),
|
|
9047
|
-
|
|
9048
|
-
|
|
9049
|
-
|
|
9050
|
-
|
|
9051
|
-
|
|
9052
|
-
|
|
9053
|
-
|
|
9054
|
-
|
|
9055
|
-
|
|
9056
|
-
|
|
9057
|
-
|
|
9058
|
-
|
|
9059
|
-
|
|
9060
|
-
|
|
9061
|
-
|
|
9062
|
-
|
|
9063
|
-
|
|
9064
|
-
wrapToggle: false,
|
|
9065
|
-
defaultWrap: true
|
|
9066
|
-
})]
|
|
9047
|
+
/* @__PURE__ */ jsx(Input, {
|
|
9048
|
+
value: name,
|
|
9049
|
+
onValueChange: setName,
|
|
9050
|
+
placeholder: labels?.namePlaceholder ?? t("createApiKey.namePlaceholder"),
|
|
9051
|
+
required: true,
|
|
9052
|
+
autoComplete: "off"
|
|
9053
|
+
}),
|
|
9054
|
+
/* @__PURE__ */ jsx(FieldError, {
|
|
9055
|
+
match: nameInvalid,
|
|
9056
|
+
children: labels?.nameRequired ?? t("createApiKey.nameRequired")
|
|
9057
|
+
})
|
|
9058
|
+
]
|
|
9059
|
+
}),
|
|
9060
|
+
/* @__PURE__ */ jsxs(Fieldset, {
|
|
9061
|
+
render: /* @__PURE__ */ jsx(CheckboxGroup, {
|
|
9062
|
+
value: selected,
|
|
9063
|
+
onValueChange: setSelected
|
|
9067
9064
|
}),
|
|
9068
|
-
|
|
9069
|
-
|
|
9070
|
-
children: labels?.
|
|
9071
|
-
|
|
9072
|
-
|
|
9073
|
-
|
|
9065
|
+
"aria-invalid": scopesInvalid || void 0,
|
|
9066
|
+
children: [
|
|
9067
|
+
/* @__PURE__ */ jsx(FieldsetLegend, { children: labels?.scopes ?? t("createApiKey.scopes") }),
|
|
9068
|
+
scopes.map((s) => /* @__PURE__ */ jsx(Checkbox, {
|
|
9069
|
+
value: s.value,
|
|
9070
|
+
label: /* @__PURE__ */ jsx("span", {
|
|
9071
|
+
className: "font-mono",
|
|
9072
|
+
children: s.label
|
|
9073
|
+
}),
|
|
9074
|
+
description: s.description
|
|
9075
|
+
}, s.value)),
|
|
9076
|
+
scopesInvalid && /* @__PURE__ */ jsx("p", {
|
|
9077
|
+
className: "text-[12.5px] text-destructive-text",
|
|
9078
|
+
children: labels?.scopesRequired ?? t("createApiKey.scopesRequired")
|
|
9079
|
+
})
|
|
9080
|
+
]
|
|
9081
|
+
}),
|
|
9082
|
+
/* @__PURE__ */ jsxs(Field, { children: [/* @__PURE__ */ jsx(FieldLabel, { children: labels?.expiration ?? t("createApiKey.expiration") }), /* @__PURE__ */ jsxs(Select, {
|
|
9083
|
+
value: expiry,
|
|
9084
|
+
onValueChange: (v) => v != null && setExpiry(v),
|
|
9085
|
+
items: expiries,
|
|
9086
|
+
children: [/* @__PURE__ */ jsx(SelectTrigger, { className: "w-full sm:w-56" }), /* @__PURE__ */ jsx(SelectContent, { children: expiries.map((x) => /* @__PURE__ */ jsx(SelectItem, {
|
|
9087
|
+
value: x.value,
|
|
9088
|
+
children: x.label
|
|
9089
|
+
}, x.value)) })]
|
|
9090
|
+
})] })
|
|
9091
|
+
] }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Alert, {
|
|
9092
|
+
tone: "warning",
|
|
9093
|
+
title: labels?.warningTitle ?? t("createApiKey.warningTitle"),
|
|
9094
|
+
description: labels?.warningDescription ?? t("createApiKey.warningDescription")
|
|
9095
|
+
}), /* @__PURE__ */ jsx(CodeBlock, {
|
|
9096
|
+
code: secret,
|
|
9097
|
+
label: labels?.secretLabel ?? t("createApiKey.secretLabel"),
|
|
9098
|
+
wrapToggle: false,
|
|
9099
|
+
defaultWrap: true
|
|
9100
|
+
})] })
|
|
9074
9101
|
});
|
|
9075
9102
|
}
|
|
9076
9103
|
//#endregion
|
|
@@ -9173,6 +9200,7 @@ const meta$12 = {
|
|
|
9173
9200
|
}
|
|
9174
9201
|
],
|
|
9175
9202
|
uses: [
|
|
9203
|
+
"FormDialog",
|
|
9176
9204
|
"Dialog",
|
|
9177
9205
|
"Field",
|
|
9178
9206
|
"Input",
|
|
@@ -9645,25 +9673,34 @@ const uploadItems = [
|
|
|
9645
9673
|
}
|
|
9646
9674
|
];
|
|
9647
9675
|
/** Demo uploader: reports progress in steps and resolves after ~1.5 s. */
|
|
9648
|
-
function simulateUpload(_file, onProgress) {
|
|
9649
|
-
return new Promise((resolve) => {
|
|
9676
|
+
function simulateUpload(_file, onProgress, context) {
|
|
9677
|
+
return new Promise((resolve, reject) => {
|
|
9678
|
+
const signal = context?.signal;
|
|
9679
|
+
let timer;
|
|
9680
|
+
const abort = () => {
|
|
9681
|
+
clearTimeout(timer);
|
|
9682
|
+
signal?.removeEventListener("abort", abort);
|
|
9683
|
+
reject(new DOMException("Aborted", "AbortError"));
|
|
9684
|
+
};
|
|
9685
|
+
if (signal?.aborted) {
|
|
9686
|
+
abort();
|
|
9687
|
+
return;
|
|
9688
|
+
}
|
|
9689
|
+
signal?.addEventListener("abort", abort, { once: true });
|
|
9650
9690
|
let pct = 0;
|
|
9651
9691
|
const step = () => {
|
|
9692
|
+
if (signal?.aborted) return;
|
|
9652
9693
|
pct = Math.min(100, pct + 20);
|
|
9653
9694
|
onProgress(pct);
|
|
9654
|
-
if (
|
|
9655
|
-
|
|
9695
|
+
if (signal?.aborted) return;
|
|
9696
|
+
if (pct >= 100) {
|
|
9697
|
+
signal?.removeEventListener("abort", abort);
|
|
9698
|
+
resolve();
|
|
9699
|
+
} else timer = setTimeout(step, 250);
|
|
9656
9700
|
};
|
|
9657
|
-
setTimeout(step, 250);
|
|
9701
|
+
timer = setTimeout(step, 250);
|
|
9658
9702
|
});
|
|
9659
9703
|
}
|
|
9660
|
-
/** Matches a file against an `accept` list (".csv", "image/*", "application/pdf"). */
|
|
9661
|
-
function acceptsFile(file, accept) {
|
|
9662
|
-
if (!accept) return true;
|
|
9663
|
-
const name = file.name.toLowerCase();
|
|
9664
|
-
const type = file.type.toLowerCase();
|
|
9665
|
-
return accept.split(",").map((a) => a.trim().toLowerCase()).filter(Boolean).some((a) => a.startsWith(".") ? name.endsWith(a) : a.endsWith("/*") ? type.startsWith(a.slice(0, -1)) : type === a);
|
|
9666
|
-
}
|
|
9667
9704
|
//#endregion
|
|
9668
9705
|
//#region src/forms/FileUploadPanel/FileUploadPanel.tsx
|
|
9669
9706
|
let uid = 0;
|
|
@@ -9672,90 +9709,219 @@ const nextId = () => `upload-${++uid}`;
|
|
|
9672
9709
|
* Drop zone with a Browse button, accept and size validation, and a file list with progress,
|
|
9673
9710
|
* retry and remove. Rejected files stay in the list with the reason.
|
|
9674
9711
|
*/
|
|
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 }) {
|
|
9712
|
+
function FileUploadPanel({ labels, accept = ".csv,.json,.jsonl,.yaml,.pdf", maxSize = 25e6, multiple = true, defaultFiles = uploadItems, files, onFilesChange, uploadMode = "auto", beforeUpload, onUpload = simulateUpload, onRemove, label: labelProp, hint, disabled = false, className }) {
|
|
9676
9713
|
const { t, formatBytes } = useI18n();
|
|
9677
9714
|
const label = labelProp ?? labels?.label ?? t("upload.label");
|
|
9678
9715
|
const id = useId();
|
|
9679
9716
|
const inputRef = useRef(null);
|
|
9680
9717
|
const [sources, setSources] = useState({});
|
|
9681
|
-
const [
|
|
9682
|
-
const
|
|
9718
|
+
const [internalItems, setItems] = useState(defaultFiles);
|
|
9719
|
+
const items = files ?? internalItems;
|
|
9720
|
+
const current = useRef(items);
|
|
9721
|
+
const rendered = useRef(items);
|
|
9722
|
+
const mounted = useRef(false);
|
|
9723
|
+
const attempts = useRef(/* @__PURE__ */ new Map());
|
|
9724
|
+
useLayoutEffect(() => {
|
|
9725
|
+
mounted.current = true;
|
|
9726
|
+
const active = attempts.current;
|
|
9727
|
+
return () => {
|
|
9728
|
+
mounted.current = false;
|
|
9729
|
+
for (const controller of active.values()) controller.abort();
|
|
9730
|
+
active.clear();
|
|
9731
|
+
};
|
|
9732
|
+
}, []);
|
|
9733
|
+
useLayoutEffect(() => {
|
|
9734
|
+
current.current = items;
|
|
9735
|
+
for (const item of rendered.current) {
|
|
9736
|
+
if (items.some((entry) => entry.id === item.id)) continue;
|
|
9737
|
+
attempts.current.get(item.id)?.abort();
|
|
9738
|
+
attempts.current.delete(item.id);
|
|
9739
|
+
}
|
|
9740
|
+
rendered.current = items;
|
|
9741
|
+
});
|
|
9742
|
+
const changeItems = (next, reason, ids) => {
|
|
9743
|
+
current.current = next;
|
|
9744
|
+
if (files === void 0) setItems(next);
|
|
9745
|
+
onFilesChange?.(next, {
|
|
9746
|
+
reason,
|
|
9747
|
+
ids
|
|
9748
|
+
});
|
|
9749
|
+
};
|
|
9750
|
+
const { rootProps, dragState } = useDropzone({
|
|
9751
|
+
accept,
|
|
9752
|
+
maxSize,
|
|
9753
|
+
disabled,
|
|
9754
|
+
activateOnClick: false
|
|
9755
|
+
});
|
|
9756
|
+
const dragging = dragState !== "idle";
|
|
9757
|
+
const [removing, setRemoving] = useState(/* @__PURE__ */ new Set());
|
|
9758
|
+
const removalRequests = useRef(/* @__PURE__ */ new Set());
|
|
9759
|
+
const [preparing, setPreparing] = useState(0);
|
|
9683
9760
|
const [announcement, setAnnouncement] = useState("");
|
|
9684
9761
|
const hintText = hint ?? labels?.hint?.(accept.split(",").map((a) => a.replace(".", "").toUpperCase()).join(" · "), formatBytes(maxSize)) ?? t("upload.hint", {
|
|
9685
9762
|
types: accept.split(",").map((a) => a.replace(".", "").toUpperCase()).join(" · "),
|
|
9686
9763
|
size: formatBytes(maxSize)
|
|
9687
9764
|
});
|
|
9688
|
-
const patch = (itemId, next) =>
|
|
9765
|
+
const patch = (itemId, next, reason) => changeItems(current.current.map((x) => x.id === itemId ? {
|
|
9689
9766
|
...x,
|
|
9690
9767
|
...next
|
|
9691
|
-
} : x));
|
|
9768
|
+
} : x), reason, [itemId]);
|
|
9692
9769
|
const start = (itemId, file) => {
|
|
9693
|
-
|
|
9694
|
-
|
|
9695
|
-
|
|
9696
|
-
|
|
9697
|
-
|
|
9698
|
-
|
|
9699
|
-
|
|
9700
|
-
|
|
9701
|
-
progress: 100
|
|
9702
|
-
});
|
|
9703
|
-
setAnnouncement(labels?.done?.(file.name) ?? t("upload.done", { name: file.name }));
|
|
9704
|
-
}, (e) => {
|
|
9770
|
+
attempts.current.get(itemId)?.abort();
|
|
9771
|
+
const controller = new AbortController();
|
|
9772
|
+
attempts.current.set(itemId, controller);
|
|
9773
|
+
const active = () => mounted.current && !controller.signal.aborted && attempts.current.get(itemId) === controller && current.current.some((item) => item.id === itemId);
|
|
9774
|
+
let previous = 0;
|
|
9775
|
+
const failed = (error) => {
|
|
9776
|
+
if (!active()) return;
|
|
9777
|
+
attempts.current.delete(itemId);
|
|
9705
9778
|
patch(itemId, {
|
|
9706
9779
|
status: "error",
|
|
9707
|
-
error:
|
|
9708
|
-
});
|
|
9780
|
+
error: error instanceof Error ? error.message : labels?.failed ?? t("upload.failed")
|
|
9781
|
+
}, "error");
|
|
9709
9782
|
setAnnouncement(labels?.error?.(file.name) ?? t("upload.error", { name: file.name }));
|
|
9710
|
-
}
|
|
9783
|
+
};
|
|
9784
|
+
try {
|
|
9785
|
+
onUpload(file, (pct) => {
|
|
9786
|
+
if (!active()) return;
|
|
9787
|
+
const progress = Math.floor(pct);
|
|
9788
|
+
const legacyProgress = files === void 0 && onFilesChange === void 0;
|
|
9789
|
+
if (previous === progress && !legacyProgress) return;
|
|
9790
|
+
previous = progress;
|
|
9791
|
+
patch(itemId, { progress: legacyProgress ? pct : progress }, "progress");
|
|
9792
|
+
}, {
|
|
9793
|
+
signal: controller.signal,
|
|
9794
|
+
id: itemId
|
|
9795
|
+
}).then(() => {
|
|
9796
|
+
if (!active()) return;
|
|
9797
|
+
attempts.current.delete(itemId);
|
|
9798
|
+
patch(itemId, {
|
|
9799
|
+
status: "done",
|
|
9800
|
+
progress: 100
|
|
9801
|
+
}, "done");
|
|
9802
|
+
setAnnouncement(labels?.done?.(file.name) ?? t("upload.done", { name: file.name }));
|
|
9803
|
+
}, failed);
|
|
9804
|
+
} catch (error) {
|
|
9805
|
+
failed(error);
|
|
9806
|
+
}
|
|
9711
9807
|
};
|
|
9712
9808
|
const addFiles = (list) => {
|
|
9713
|
-
const
|
|
9714
|
-
const
|
|
9715
|
-
|
|
9716
|
-
|
|
9717
|
-
|
|
9718
|
-
|
|
9719
|
-
|
|
9720
|
-
|
|
9721
|
-
|
|
9722
|
-
|
|
9723
|
-
|
|
9724
|
-
|
|
9725
|
-
|
|
9726
|
-
|
|
9727
|
-
}
|
|
9728
|
-
|
|
9729
|
-
|
|
9730
|
-
|
|
9809
|
+
const picked = Array.from(list).slice(0, multiple ? void 0 : 1);
|
|
9810
|
+
const { rejected: rejectedFiles } = validateFiles(picked, {
|
|
9811
|
+
accept,
|
|
9812
|
+
maxSize
|
|
9813
|
+
});
|
|
9814
|
+
const reasons = new Map(rejectedFiles.map((item) => [item.file, item.reasons]));
|
|
9815
|
+
const prepared = picked.map((file) => ({
|
|
9816
|
+
file,
|
|
9817
|
+
error: reasons.get(file)?.includes("type") ? labels?.typeRejected ?? t("upload.typeRejected") : reasons.get(file)?.includes("size") ? labels?.tooLarge?.(formatBytes(maxSize)) ?? t("upload.tooLarge", { size: formatBytes(maxSize) }) : void 0
|
|
9818
|
+
}));
|
|
9819
|
+
const append = (results) => {
|
|
9820
|
+
if (!mounted.current) return;
|
|
9821
|
+
const added = [];
|
|
9822
|
+
const toStart = [];
|
|
9823
|
+
const kept = {};
|
|
9824
|
+
for (const result of results) {
|
|
9825
|
+
if (!result) continue;
|
|
9826
|
+
const { file, error } = result;
|
|
9827
|
+
const itemId = nextId();
|
|
9828
|
+
added.push({
|
|
9829
|
+
id: itemId,
|
|
9830
|
+
file,
|
|
9831
|
+
name: file.name,
|
|
9832
|
+
size: file.size,
|
|
9833
|
+
progress: 0,
|
|
9834
|
+
status: error !== void 0 ? "error" : uploadMode === "manual" ? "pending" : "uploading",
|
|
9835
|
+
error
|
|
9836
|
+
});
|
|
9837
|
+
if (error === void 0) {
|
|
9838
|
+
kept[itemId] = file;
|
|
9839
|
+
if (uploadMode === "auto") toStart.push([itemId, file]);
|
|
9840
|
+
}
|
|
9731
9841
|
}
|
|
9842
|
+
if (!added.length) return;
|
|
9843
|
+
changeItems(multiple ? [...current.current, ...added] : added, "add", added.map((item) => item.id));
|
|
9844
|
+
setSources((current) => ({
|
|
9845
|
+
...current,
|
|
9846
|
+
...kept
|
|
9847
|
+
}));
|
|
9848
|
+
const rejected = added.filter((a) => a.status === "error").length;
|
|
9849
|
+
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(" "));
|
|
9850
|
+
for (const [itemId, file] of toStart) start(itemId, file);
|
|
9851
|
+
};
|
|
9852
|
+
if (!beforeUpload) {
|
|
9853
|
+
append(prepared);
|
|
9854
|
+
return;
|
|
9732
9855
|
}
|
|
9733
|
-
|
|
9734
|
-
|
|
9735
|
-
|
|
9736
|
-
|
|
9737
|
-
|
|
9738
|
-
|
|
9739
|
-
|
|
9740
|
-
|
|
9856
|
+
setPreparing((count) => count + 1);
|
|
9857
|
+
Promise.all(prepared.map(async (result) => {
|
|
9858
|
+
if (!result || result.error !== void 0) return result;
|
|
9859
|
+
try {
|
|
9860
|
+
const transformed = await beforeUpload(result.file);
|
|
9861
|
+
return transformed === false ? null : { file: transformed instanceof File ? transformed : result.file };
|
|
9862
|
+
} catch (error) {
|
|
9863
|
+
return {
|
|
9864
|
+
file: result.file,
|
|
9865
|
+
error: error instanceof Error ? error.message : labels?.failed ?? t("upload.failed")
|
|
9866
|
+
};
|
|
9867
|
+
}
|
|
9868
|
+
})).then((results) => {
|
|
9869
|
+
if (!mounted.current) return;
|
|
9870
|
+
setPreparing((count) => count - 1);
|
|
9871
|
+
append(results);
|
|
9872
|
+
});
|
|
9741
9873
|
};
|
|
9742
|
-
const
|
|
9874
|
+
const canCancel = (item) => item.status === "uploading" && (item.file !== void 0 || sources[item.id] !== void 0);
|
|
9875
|
+
const completeRemoval = (itemId) => {
|
|
9876
|
+
if (!mounted.current) return;
|
|
9877
|
+
const item = current.current.find((entry) => entry.id === itemId);
|
|
9878
|
+
if (!item) return;
|
|
9743
9879
|
setSources((current) => Object.fromEntries(Object.entries(current).filter(([k]) => k !== item.id)));
|
|
9744
|
-
|
|
9745
|
-
|
|
9746
|
-
|
|
9880
|
+
const cancelling = canCancel(item);
|
|
9881
|
+
attempts.current.get(item.id)?.abort();
|
|
9882
|
+
attempts.current.delete(item.id);
|
|
9883
|
+
changeItems(current.current.filter((x) => x.id !== item.id), cancelling ? "cancel" : "remove", [item.id]);
|
|
9884
|
+
setAnnouncement(cancelling ? labels?.cancelled?.(item.name) ?? t("upload.cancelled", { name: item.name }) : labels?.removed?.(item.name) ?? t("upload.removed", { name: item.name }));
|
|
9885
|
+
};
|
|
9886
|
+
const remove = (item) => {
|
|
9887
|
+
if (removalRequests.current.has(item.id)) return;
|
|
9888
|
+
const failed = () => {
|
|
9889
|
+
if (mounted.current) setAnnouncement(labels?.removeFailed?.(item.name) ?? t("upload.removeFailed", { name: item.name }));
|
|
9890
|
+
};
|
|
9891
|
+
try {
|
|
9892
|
+
const result = onRemove?.(item);
|
|
9893
|
+
if (result && typeof result === "object" && "then" in result) {
|
|
9894
|
+
removalRequests.current.add(item.id);
|
|
9895
|
+
setRemoving(new Set(removalRequests.current));
|
|
9896
|
+
result.then((allowed) => {
|
|
9897
|
+
if (allowed !== false) completeRemoval(item.id);
|
|
9898
|
+
}, failed).finally(() => {
|
|
9899
|
+
removalRequests.current.delete(item.id);
|
|
9900
|
+
if (mounted.current) setRemoving(new Set(removalRequests.current));
|
|
9901
|
+
});
|
|
9902
|
+
} else if (result !== false) completeRemoval(item.id);
|
|
9903
|
+
} catch {
|
|
9904
|
+
failed();
|
|
9905
|
+
}
|
|
9747
9906
|
};
|
|
9748
9907
|
const retryFor = (itemId) => {
|
|
9749
9908
|
const file = sources[itemId];
|
|
9750
|
-
return file ? () =>
|
|
9909
|
+
return file ? () => {
|
|
9910
|
+
patch(itemId, {
|
|
9911
|
+
status: "uploading",
|
|
9912
|
+
progress: 0,
|
|
9913
|
+
error: void 0
|
|
9914
|
+
}, "progress");
|
|
9915
|
+
start(itemId, file);
|
|
9916
|
+
} : void 0;
|
|
9751
9917
|
};
|
|
9752
9918
|
const onDrop = (e) => {
|
|
9753
|
-
|
|
9754
|
-
|
|
9755
|
-
if (!disabled && e.dataTransfer.files.length) addFiles(e.dataTransfer.files);
|
|
9919
|
+
rootProps.onDrop?.(e);
|
|
9920
|
+
if (!disabled && Array.from(e.dataTransfer?.types ?? []).includes("Files") && e.dataTransfer.files.length) addFiles(e.dataTransfer.files);
|
|
9756
9921
|
};
|
|
9757
9922
|
return /* @__PURE__ */ jsxs("div", {
|
|
9758
9923
|
role: "group",
|
|
9924
|
+
"aria-busy": preparing > 0 || void 0,
|
|
9759
9925
|
"aria-labelledby": `${id}-label`,
|
|
9760
9926
|
className: cn("w-full", className),
|
|
9761
9927
|
children: [
|
|
@@ -9765,15 +9931,11 @@ function FileUploadPanel({ labels, accept = ".csv,.json,.jsonl,.yaml,.pdf", maxS
|
|
|
9765
9931
|
children: label
|
|
9766
9932
|
}),
|
|
9767
9933
|
/* @__PURE__ */ jsxs("div", {
|
|
9934
|
+
...rootProps,
|
|
9768
9935
|
"data-dragging": dragging || void 0,
|
|
9769
9936
|
"data-disabled": disabled || void 0,
|
|
9770
|
-
onDragOver: (e) => {
|
|
9771
|
-
e.preventDefault();
|
|
9772
|
-
if (!disabled) setDragging(true);
|
|
9773
|
-
},
|
|
9774
|
-
onDragLeave: () => setDragging(false),
|
|
9775
9937
|
onDrop,
|
|
9776
|
-
className: cn("rounded-xl border-2 border-dashed border-border bg-background/40 px-6 py-8 text-center transition-colors motion-reduce:transition-none", "data-[
|
|
9938
|
+
className: cn("rounded-xl border-2 border-dashed border-border bg-background/40 px-6 py-8 text-center transition-colors motion-reduce:transition-none", "data-[disabled]:opacity-60", dragState === "accept" && "border-primary bg-primary/10", dragState === "reject" && "border-destructive bg-destructive/10 text-destructive-text"),
|
|
9777
9939
|
children: [
|
|
9778
9940
|
/* @__PURE__ */ jsx("div", {
|
|
9779
9941
|
className: "mx-auto grid size-12 place-items-center rounded-2xl bg-secondary/70 text-muted-foreground ring-1 ring-border",
|
|
@@ -9820,6 +9982,8 @@ function FileUploadPanel({ labels, accept = ".csv,.json,.jsonl,.yaml,.pdf", maxS
|
|
|
9820
9982
|
children: items.map((item) => /* @__PURE__ */ jsx(FileRow, {
|
|
9821
9983
|
labels,
|
|
9822
9984
|
item,
|
|
9985
|
+
cancellable: canCancel(item),
|
|
9986
|
+
removing: removing.has(item.id),
|
|
9823
9987
|
onRemove: () => remove(item),
|
|
9824
9988
|
onRetry: retryFor(item.id)
|
|
9825
9989
|
}, item.id))
|
|
@@ -9832,10 +9996,11 @@ function FileUploadPanel({ labels, accept = ".csv,.json,.jsonl,.yaml,.pdf", maxS
|
|
|
9832
9996
|
]
|
|
9833
9997
|
});
|
|
9834
9998
|
}
|
|
9835
|
-
function FileRow({ item, onRemove, onRetry, labels }) {
|
|
9999
|
+
function FileRow({ item, onRemove, onRetry, cancellable, removing, labels }) {
|
|
9836
10000
|
const { t, formatBytes } = useI18n();
|
|
9837
10001
|
const err = item.status === "error";
|
|
9838
10002
|
const done = item.status === "done";
|
|
10003
|
+
const readySize = item.status === "pending" ? formatBytes(item.size, { base: 1024 }).replace(/([KMGTPE])iB\b/, "$1B") : "";
|
|
9839
10004
|
return /* @__PURE__ */ jsxs("li", {
|
|
9840
10005
|
className: "flex items-center gap-3 rounded-lg border border-border bg-card px-3.5 py-2.5 shadow-sm",
|
|
9841
10006
|
children: [
|
|
@@ -9861,7 +10026,7 @@ function FileRow({ item, onRemove, onRetry, labels }) {
|
|
|
9861
10026
|
className: "mt-1.5"
|
|
9862
10027
|
}) : /* @__PURE__ */ jsx("div", {
|
|
9863
10028
|
className: cn("mt-0.5 font-mono text-[11px]", err ? "text-destructive-text" : "text-muted-foreground"),
|
|
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) })
|
|
10029
|
+
children: err ? labels?.notUploaded?.(item.error ?? labels?.failed ?? t("upload.failed")) ?? t("upload.notUploaded", { error: item.error ?? labels?.failed ?? t("upload.failed") }) : item.status === "pending" ? labels?.ready?.(readySize) ?? t("upload.ready", { size: readySize }) : labels?.uploaded?.(formatBytes(item.size)) ?? t("upload.uploaded", { size: formatBytes(item.size) })
|
|
9865
10030
|
})]
|
|
9866
10031
|
}),
|
|
9867
10032
|
item.status === "uploading" && /* @__PURE__ */ jsxs("span", {
|
|
@@ -9877,8 +10042,9 @@ function FileRow({ item, onRemove, onRetry, labels }) {
|
|
|
9877
10042
|
/* @__PURE__ */ jsx(IconButton, {
|
|
9878
10043
|
icon: X,
|
|
9879
10044
|
size: "sm",
|
|
9880
|
-
label: labels?.remove?.(item.name) ?? t("common.removeItem", { label: item.name }),
|
|
9881
|
-
onClick: onRemove
|
|
10045
|
+
label: cancellable ? labels?.cancel?.(item.name) ?? t("upload.cancel", { name: item.name }) : labels?.remove?.(item.name) ?? t("common.removeItem", { label: item.name }),
|
|
10046
|
+
onClick: onRemove,
|
|
10047
|
+
disabled: removing
|
|
9882
10048
|
})
|
|
9883
10049
|
]
|
|
9884
10050
|
});
|
|
@@ -9889,8 +10055,28 @@ const meta$26 = {
|
|
|
9889
10055
|
name: "File upload panel",
|
|
9890
10056
|
family: "forms",
|
|
9891
10057
|
status: "stable",
|
|
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.",
|
|
10058
|
+
description: "Controlled files/onFilesChange (add, progress, done, error, remove, cancel) or defaultFiles; manual uploadMode retains pending File objects for form submission. beforeUpload drops false, replaces a File or rejects without Retry; batches preserve pick order and expose aria-busy. onUpload receives {signal, id}: forward signal to fetch/XHR to stop the transport. Unmount and cancel abort; retry gets a fresh signal. onRemove runs before removal: false or rejection keeps a row, and promises disable its button. Pending rows use locale-aware binary sizes with compact unit labels (4,300 bytes: 4.2 KB); existing uploaded rows retain decimal sizes. Live examples: /preview.html?kind=block&id=file-upload-panel--manual-form and /preview.html?kind=block&id=file-upload-panel--auto-cancel. Drag-and-drop zone with accept/reject MIME feedback (demonstrated in the Labels preview), 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
10059
|
labels: [
|
|
10060
|
+
{
|
|
10061
|
+
key: "ready",
|
|
10062
|
+
type: "(size: string) => string",
|
|
10063
|
+
state: "Pending manual upload"
|
|
10064
|
+
},
|
|
10065
|
+
{
|
|
10066
|
+
key: "cancel",
|
|
10067
|
+
type: "(name: string) => string",
|
|
10068
|
+
state: "Uploading cancel action"
|
|
10069
|
+
},
|
|
10070
|
+
{
|
|
10071
|
+
key: "cancelled",
|
|
10072
|
+
type: "(name: string) => string",
|
|
10073
|
+
state: "Cancellation feedback"
|
|
10074
|
+
},
|
|
10075
|
+
{
|
|
10076
|
+
key: "removeFailed",
|
|
10077
|
+
type: "(name: string) => string",
|
|
10078
|
+
state: "Removal rejection"
|
|
10079
|
+
},
|
|
9894
10080
|
{
|
|
9895
10081
|
key: "label",
|
|
9896
10082
|
type: "string",
|
|
@@ -9992,16 +10178,16 @@ const meta$26 = {
|
|
|
9992
10178
|
//#region src/forms/FormSection/FormSection.tsx
|
|
9993
10179
|
function SampleFields() {
|
|
9994
10180
|
return /* @__PURE__ */ jsxs("div", {
|
|
9995
|
-
className: "grid grid-cols-1 gap-4
|
|
10181
|
+
className: "grid grid-cols-1 gap-4 @2xl:grid-cols-6",
|
|
9996
10182
|
children: [/* @__PURE__ */ jsxs(Field, {
|
|
9997
|
-
className: "
|
|
10183
|
+
className: "@2xl:col-span-4",
|
|
9998
10184
|
children: [
|
|
9999
10185
|
/* @__PURE__ */ jsx(FieldLabel, { children: "Project name" }),
|
|
10000
10186
|
/* @__PURE__ */ jsx(Input, { defaultValue: "billing-dashboard" }),
|
|
10001
10187
|
/* @__PURE__ */ jsx(FieldDescription, { children: "Lowercase letters, numbers and dashes." })
|
|
10002
10188
|
]
|
|
10003
10189
|
}), /* @__PURE__ */ jsxs(Field, {
|
|
10004
|
-
className: "
|
|
10190
|
+
className: "@2xl:col-span-6",
|
|
10005
10191
|
children: [/* @__PURE__ */ jsx(FieldLabel, { children: "Description" }), /* @__PURE__ */ jsx(Textarea, {
|
|
10006
10192
|
rows: 3,
|
|
10007
10193
|
defaultValue: "Usage and invoice reporting for every workspace."
|
|
@@ -10011,34 +10197,37 @@ function SampleFields() {
|
|
|
10011
10197
|
}
|
|
10012
10198
|
/**
|
|
10013
10199
|
* Two-column form section: title and help on the left, fields on the right. Stacks into a
|
|
10014
|
-
* single column
|
|
10200
|
+
* single column in narrow containers.
|
|
10015
10201
|
*/
|
|
10016
10202
|
function FormSection({ labels, title: titleProp, description: descriptionProp, children, actions, headingLevel: Heading = "h2", divided = false, className, ...props }) {
|
|
10017
10203
|
const { t } = useI18n();
|
|
10018
10204
|
const title = titleProp === void 0 ? labels?.title ?? t("formSection.title") : titleProp;
|
|
10019
10205
|
const description = descriptionProp === void 0 ? labels?.description ?? t("formSection.description") : descriptionProp;
|
|
10020
10206
|
const id = useId();
|
|
10021
|
-
return /* @__PURE__ */
|
|
10207
|
+
return /* @__PURE__ */ jsx("section", {
|
|
10022
10208
|
"aria-labelledby": title != null ? `${id}-title` : void 0,
|
|
10023
|
-
className: cn("
|
|
10209
|
+
className: cn("@container w-full min-w-0", divided && "border-t border-border pt-8", className),
|
|
10024
10210
|
...props,
|
|
10025
|
-
children:
|
|
10026
|
-
className: "
|
|
10027
|
-
children: [
|
|
10028
|
-
|
|
10029
|
-
|
|
10030
|
-
|
|
10031
|
-
|
|
10032
|
-
|
|
10033
|
-
|
|
10034
|
-
|
|
10035
|
-
|
|
10036
|
-
|
|
10037
|
-
|
|
10038
|
-
className: "
|
|
10039
|
-
children: actions
|
|
10211
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
10212
|
+
className: "grid grid-cols-1 gap-x-10 gap-y-5 @2xl:grid-cols-3",
|
|
10213
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
10214
|
+
className: "min-w-0",
|
|
10215
|
+
children: [title != null && /* @__PURE__ */ jsx(Heading, {
|
|
10216
|
+
id: `${id}-title`,
|
|
10217
|
+
className: "text-[14px] font-semibold tracking-tight text-foreground",
|
|
10218
|
+
children: title
|
|
10219
|
+
}), description != null && /* @__PURE__ */ jsx("p", {
|
|
10220
|
+
className: "mt-1 text-[13px] leading-6 text-pretty text-muted-foreground",
|
|
10221
|
+
children: description
|
|
10222
|
+
})]
|
|
10223
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
10224
|
+
className: "min-w-0 @2xl:col-span-2",
|
|
10225
|
+
children: [children ?? /* @__PURE__ */ jsx(SampleFields, {}), actions != null && /* @__PURE__ */ jsx("div", {
|
|
10226
|
+
className: "mt-6 flex flex-wrap items-center justify-end gap-2.5",
|
|
10227
|
+
children: actions
|
|
10228
|
+
})]
|
|
10040
10229
|
})]
|
|
10041
|
-
})
|
|
10230
|
+
})
|
|
10042
10231
|
});
|
|
10043
10232
|
}
|
|
10044
10233
|
//#endregion
|
|
@@ -10047,7 +10236,7 @@ const meta$30 = {
|
|
|
10047
10236
|
name: "Form section",
|
|
10048
10237
|
family: "forms",
|
|
10049
10238
|
status: "stable",
|
|
10050
|
-
description: "Two-column settings section: title and help on the left, fields on the right; stacks
|
|
10239
|
+
description: "Two-column settings section: title and help on the left, fields on the right; stacks in narrow containers. 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
10240
|
labels: [{
|
|
10052
10241
|
key: "title",
|
|
10053
10242
|
type: "string",
|
|
@@ -10091,133 +10280,113 @@ const EMAIL_RE = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
|
10091
10280
|
//#endregion
|
|
10092
10281
|
//#region src/forms/InviteMembersDialog/InviteMembersDialog.tsx
|
|
10093
10282
|
/** Invite dialog: email chips with validation, a role and an optional message; submit with loading. */
|
|
10094
|
-
function InviteMembersDialog({ labels, roles = memberRoles, defaultRole = "member", onInvite, maxInvites = 20, open
|
|
10283
|
+
function InviteMembersDialog({ labels, roles = memberRoles, defaultRole = "member", onInvite, maxInvites = 20, open, defaultOpen = false, onOpenChange, trigger = /* @__PURE__ */ jsx(Button, { icon: UserPlus }), title: titleProp, description: descriptionProp }) {
|
|
10095
10284
|
const { t } = useI18n();
|
|
10096
10285
|
const title = titleProp ?? labels?.title ?? t("inviteMembers.title");
|
|
10097
10286
|
const description = descriptionProp ?? labels?.description ?? t("inviteMembers.description");
|
|
10098
10287
|
const emailError = (email) => EMAIL_RE.test(email) ? null : labels?.emailInvalid?.(email) ?? t("inviteMembers.emailInvalid", { email });
|
|
10099
|
-
const [innerOpen, setInnerOpen] = useState(defaultOpen);
|
|
10100
10288
|
const [emails, setEmails] = useState([]);
|
|
10101
10289
|
const [role, setRole] = useState(defaultRole);
|
|
10102
10290
|
const [message, setMessage] = useState("");
|
|
10103
10291
|
const [submitted, setSubmitted] = useState(false);
|
|
10104
|
-
const [loading, setLoading] = useState(false);
|
|
10105
10292
|
const [error, setError] = useState(null);
|
|
10106
|
-
const
|
|
10293
|
+
const opening = useRef(0);
|
|
10294
|
+
useEffect(() => {
|
|
10295
|
+
opening.current += 1;
|
|
10296
|
+
}, [open]);
|
|
10107
10297
|
const invalidCount = emails.filter((e) => emailError(e)).length;
|
|
10108
10298
|
const emailsProblem = emails.length === 0 ? labels?.emailRequired ?? t("inviteMembers.emailRequired") : invalidCount > 0 ? labels?.fixInvalid?.(invalidCount) ?? t("inviteMembers.fixInvalid", { count: invalidCount }) : null;
|
|
10109
10299
|
const showEmailError = submitted && emailsProblem != null;
|
|
10110
|
-
const
|
|
10111
|
-
|
|
10112
|
-
|
|
10113
|
-
|
|
10114
|
-
|
|
10115
|
-
|
|
10116
|
-
setSubmitted(false);
|
|
10117
|
-
setError(null);
|
|
10118
|
-
}
|
|
10119
|
-
setInnerOpen(next);
|
|
10120
|
-
onOpenChange?.(next);
|
|
10121
|
-
};
|
|
10122
|
-
const submit = async () => {
|
|
10123
|
-
setSubmitted(true);
|
|
10300
|
+
const reset = () => {
|
|
10301
|
+
opening.current += 1;
|
|
10302
|
+
setEmails([]);
|
|
10303
|
+
setRole(defaultRole);
|
|
10304
|
+
setMessage("");
|
|
10305
|
+
setSubmitted(false);
|
|
10124
10306
|
setError(null);
|
|
10125
|
-
|
|
10126
|
-
|
|
10307
|
+
};
|
|
10308
|
+
const send = async () => {
|
|
10309
|
+
const current = opening.current;
|
|
10127
10310
|
try {
|
|
10128
10311
|
await onInvite?.({
|
|
10129
10312
|
emails,
|
|
10130
10313
|
role,
|
|
10131
10314
|
message: message.trim()
|
|
10132
10315
|
});
|
|
10133
|
-
setLoading(false);
|
|
10134
|
-
setOpen(false);
|
|
10135
10316
|
} catch (e) {
|
|
10136
|
-
|
|
10137
|
-
|
|
10317
|
+
if (current === opening.current) setError(e instanceof Error ? e.message : labels?.fallbackError ?? t("inviteMembers.fallbackError"));
|
|
10318
|
+
return false;
|
|
10138
10319
|
}
|
|
10139
10320
|
};
|
|
10321
|
+
const submit = () => {
|
|
10322
|
+
setSubmitted(true);
|
|
10323
|
+
setError(null);
|
|
10324
|
+
return emailsProblem ? false : send();
|
|
10325
|
+
};
|
|
10140
10326
|
const roleLabel = roles.find((r) => r.value === role)?.description;
|
|
10141
|
-
return /* @__PURE__ */ jsxs(
|
|
10327
|
+
return /* @__PURE__ */ jsxs(FormDialog, {
|
|
10328
|
+
size: "lg",
|
|
10329
|
+
title,
|
|
10330
|
+
description,
|
|
10331
|
+
trigger: trigger ?? void 0,
|
|
10142
10332
|
open,
|
|
10143
|
-
|
|
10144
|
-
|
|
10145
|
-
|
|
10146
|
-
|
|
10147
|
-
|
|
10148
|
-
|
|
10149
|
-
|
|
10150
|
-
|
|
10151
|
-
|
|
10152
|
-
|
|
10153
|
-
|
|
10154
|
-
|
|
10155
|
-
|
|
10156
|
-
|
|
10157
|
-
|
|
10158
|
-
|
|
10159
|
-
|
|
10160
|
-
|
|
10161
|
-
/* @__PURE__ */ jsx(FieldLabel, {
|
|
10162
|
-
required: true,
|
|
10163
|
-
children: labels?.emails ?? t("inviteMembers.emails")
|
|
10164
|
-
}),
|
|
10165
|
-
/* @__PURE__ */ jsx(TokenInput, {
|
|
10166
|
-
value: emails,
|
|
10167
|
-
onValueChange: setEmails,
|
|
10168
|
-
validate: emailError,
|
|
10169
|
-
maxItems: maxInvites,
|
|
10170
|
-
placeholder: labels?.placeholder ?? t("inviteMembers.placeholder"),
|
|
10171
|
-
listLabel: labels?.listLabel ?? t("inviteMembers.listLabel"),
|
|
10172
|
-
invalid: showEmailError
|
|
10173
|
-
}),
|
|
10174
|
-
/* @__PURE__ */ jsx(FieldError, {
|
|
10175
|
-
match: showEmailError,
|
|
10176
|
-
children: emailsProblem
|
|
10177
|
-
})
|
|
10178
|
-
]
|
|
10179
|
-
}),
|
|
10180
|
-
/* @__PURE__ */ jsxs(Field, { children: [
|
|
10181
|
-
/* @__PURE__ */ jsx(FieldLabel, { children: labels?.role ?? t("inviteMembers.role") }),
|
|
10182
|
-
/* @__PURE__ */ jsxs(Select, {
|
|
10183
|
-
value: role,
|
|
10184
|
-
onValueChange: (v) => v != null && setRole(v),
|
|
10185
|
-
items: roles.map(({ value, label }) => ({
|
|
10186
|
-
value,
|
|
10187
|
-
label
|
|
10188
|
-
})),
|
|
10189
|
-
children: [/* @__PURE__ */ jsx(SelectTrigger, { className: "w-full" }), /* @__PURE__ */ jsx(SelectContent, { children: roles.map((r) => /* @__PURE__ */ jsx(SelectItem, {
|
|
10190
|
-
value: r.value,
|
|
10191
|
-
children: r.label
|
|
10192
|
-
}, r.value)) })]
|
|
10193
|
-
}),
|
|
10194
|
-
roleLabel && /* @__PURE__ */ jsx(FieldDescription, { children: roleLabel })
|
|
10195
|
-
] }),
|
|
10196
|
-
/* @__PURE__ */ jsxs(Field, { children: [/* @__PURE__ */ jsx(FieldLabel, { children: labels?.message ?? t("inviteMembers.message") }), /* @__PURE__ */ jsx(Textarea, {
|
|
10197
|
-
rows: 3,
|
|
10198
|
-
value: message,
|
|
10199
|
-
onValueChange: setMessage,
|
|
10200
|
-
placeholder: labels?.messagePlaceholder ?? t("inviteMembers.messagePlaceholder")
|
|
10201
|
-
})] }),
|
|
10202
|
-
error && /* @__PURE__ */ jsx(Alert, {
|
|
10203
|
-
tone: "destructive",
|
|
10204
|
-
title: labels?.errorTitle ?? t("inviteMembers.errorTitle"),
|
|
10205
|
-
description: error
|
|
10206
|
-
})
|
|
10207
|
-
]
|
|
10208
|
-
}), /* @__PURE__ */ jsxs(DialogFooter, { children: [/* @__PURE__ */ jsx(DialogClose, {
|
|
10209
|
-
render: /* @__PURE__ */ jsx(Button, {
|
|
10210
|
-
variant: "ghost",
|
|
10211
|
-
disabled: loading
|
|
10333
|
+
defaultOpen,
|
|
10334
|
+
onOpenChange,
|
|
10335
|
+
onSubmit: submit,
|
|
10336
|
+
onClosed: reset,
|
|
10337
|
+
cancelLabel: labels?.cancel ?? t("inviteMembers.cancel"),
|
|
10338
|
+
submitLabel: emails.length > 1 ? labels?.submitMany?.(emails.length) ?? t("inviteMembers.submitMany", { count: emails.length }) : labels?.submit ?? t("inviteMembers.submit"),
|
|
10339
|
+
summary: error && /* @__PURE__ */ jsx(Alert, {
|
|
10340
|
+
tone: "destructive",
|
|
10341
|
+
title: labels?.errorTitle ?? t("inviteMembers.errorTitle"),
|
|
10342
|
+
description: error
|
|
10343
|
+
}),
|
|
10344
|
+
children: [
|
|
10345
|
+
/* @__PURE__ */ jsxs(Field, {
|
|
10346
|
+
invalid: showEmailError,
|
|
10347
|
+
children: [
|
|
10348
|
+
/* @__PURE__ */ jsx(FieldLabel, {
|
|
10349
|
+
required: true,
|
|
10350
|
+
children: labels?.emails ?? t("inviteMembers.emails")
|
|
10212
10351
|
}),
|
|
10213
|
-
|
|
10214
|
-
|
|
10215
|
-
|
|
10216
|
-
|
|
10217
|
-
|
|
10218
|
-
|
|
10219
|
-
|
|
10220
|
-
|
|
10352
|
+
/* @__PURE__ */ jsx(TokenInput, {
|
|
10353
|
+
value: emails,
|
|
10354
|
+
onValueChange: setEmails,
|
|
10355
|
+
validate: emailError,
|
|
10356
|
+
maxItems: maxInvites,
|
|
10357
|
+
placeholder: labels?.placeholder ?? t("inviteMembers.placeholder"),
|
|
10358
|
+
listLabel: labels?.listLabel ?? t("inviteMembers.listLabel"),
|
|
10359
|
+
invalid: showEmailError
|
|
10360
|
+
}),
|
|
10361
|
+
/* @__PURE__ */ jsx(FieldError, {
|
|
10362
|
+
match: showEmailError,
|
|
10363
|
+
children: emailsProblem
|
|
10364
|
+
})
|
|
10365
|
+
]
|
|
10366
|
+
}),
|
|
10367
|
+
/* @__PURE__ */ jsxs(Field, { children: [
|
|
10368
|
+
/* @__PURE__ */ jsx(FieldLabel, { children: labels?.role ?? t("inviteMembers.role") }),
|
|
10369
|
+
/* @__PURE__ */ jsxs(Select, {
|
|
10370
|
+
value: role,
|
|
10371
|
+
onValueChange: (v) => v != null && setRole(v),
|
|
10372
|
+
items: roles.map(({ value, label }) => ({
|
|
10373
|
+
value,
|
|
10374
|
+
label
|
|
10375
|
+
})),
|
|
10376
|
+
children: [/* @__PURE__ */ jsx(SelectTrigger, { className: "w-full" }), /* @__PURE__ */ jsx(SelectContent, { children: roles.map((r) => /* @__PURE__ */ jsx(SelectItem, {
|
|
10377
|
+
value: r.value,
|
|
10378
|
+
children: r.label
|
|
10379
|
+
}, r.value)) })]
|
|
10380
|
+
}),
|
|
10381
|
+
roleLabel && /* @__PURE__ */ jsx(FieldDescription, { children: roleLabel })
|
|
10382
|
+
] }),
|
|
10383
|
+
/* @__PURE__ */ jsxs(Field, { children: [/* @__PURE__ */ jsx(FieldLabel, { children: labels?.message ?? t("inviteMembers.message") }), /* @__PURE__ */ jsx(Textarea, {
|
|
10384
|
+
rows: 3,
|
|
10385
|
+
value: message,
|
|
10386
|
+
onValueChange: setMessage,
|
|
10387
|
+
placeholder: labels?.messagePlaceholder ?? t("inviteMembers.messagePlaceholder")
|
|
10388
|
+
})] })
|
|
10389
|
+
]
|
|
10221
10390
|
});
|
|
10222
10391
|
}
|
|
10223
10392
|
//#endregion
|
|
@@ -10310,6 +10479,7 @@ const meta$35 = {
|
|
|
10310
10479
|
}
|
|
10311
10480
|
],
|
|
10312
10481
|
uses: [
|
|
10482
|
+
"FormDialog",
|
|
10313
10483
|
"Dialog",
|
|
10314
10484
|
"TokenInput",
|
|
10315
10485
|
"Select",
|
|
@@ -10365,7 +10535,7 @@ function SettingsRow({ labels, label: labelProp, description: descriptionProp, c
|
|
|
10365
10535
|
}
|
|
10366
10536
|
//#endregion
|
|
10367
10537
|
//#region src/forms/SettingsRow/block.meta.ts
|
|
10368
|
-
const meta$
|
|
10538
|
+
const meta$61 = {
|
|
10369
10539
|
name: "Settings row",
|
|
10370
10540
|
family: "forms",
|
|
10371
10541
|
status: "stable",
|
|
@@ -10455,7 +10625,7 @@ const dialogWizardCopy = {
|
|
|
10455
10625
|
};
|
|
10456
10626
|
//#endregion
|
|
10457
10627
|
//#region src/forms/ValidationSummary/block.meta.ts
|
|
10458
|
-
const meta$
|
|
10628
|
+
const meta$77 = {
|
|
10459
10629
|
name: "Validation summary",
|
|
10460
10630
|
family: "forms",
|
|
10461
10631
|
status: "stable",
|
|
@@ -10468,6 +10638,320 @@ const meta$75 = {
|
|
|
10468
10638
|
uses: ["Alert", "Link"]
|
|
10469
10639
|
};
|
|
10470
10640
|
//#endregion
|
|
10641
|
+
//#region src/hooks/useTableData.ts
|
|
10642
|
+
/**
|
|
10643
|
+
* Map committed table queries to abortable requests. Callback identities do not trigger requests.
|
|
10644
|
+
* Spread tableProps into DataTable; use paginated={false} and loadMoreProps for cursor lists.
|
|
10645
|
+
* Available from the npm package only (not the copy-install registry).
|
|
10646
|
+
*/
|
|
10647
|
+
function useTableData(options) {
|
|
10648
|
+
const { enabled = true } = options;
|
|
10649
|
+
const filtersKey = JSON.stringify(options.filters);
|
|
10650
|
+
const [request, setRequest] = useState(() => ({
|
|
10651
|
+
query: {
|
|
10652
|
+
page: options.initialPage ?? 1,
|
|
10653
|
+
pageSize: options.initialPageSize ?? 20,
|
|
10654
|
+
sort: options.initialSort ?? null,
|
|
10655
|
+
filters: options.filters,
|
|
10656
|
+
cursor: null
|
|
10657
|
+
},
|
|
10658
|
+
filtersKey,
|
|
10659
|
+
revision: 0,
|
|
10660
|
+
force: false,
|
|
10661
|
+
prefix: []
|
|
10662
|
+
}));
|
|
10663
|
+
if (request.filtersKey !== filtersKey) setRequest({
|
|
10664
|
+
...request,
|
|
10665
|
+
filtersKey,
|
|
10666
|
+
force: false,
|
|
10667
|
+
prefix: [],
|
|
10668
|
+
revision: request.revision + 1,
|
|
10669
|
+
query: {
|
|
10670
|
+
...request.query,
|
|
10671
|
+
page: 1,
|
|
10672
|
+
cursor: null,
|
|
10673
|
+
filters: options.filters
|
|
10674
|
+
}
|
|
10675
|
+
});
|
|
10676
|
+
const params = request.query;
|
|
10677
|
+
const key = JSON.stringify(params);
|
|
10678
|
+
const [snapshot, setSnapshot] = useState(() => ({
|
|
10679
|
+
rows: [],
|
|
10680
|
+
rowCount: 0,
|
|
10681
|
+
nextCursor: void 0,
|
|
10682
|
+
page: params.page,
|
|
10683
|
+
pageSize: params.pageSize,
|
|
10684
|
+
sort: params.sort,
|
|
10685
|
+
isLoading: enabled,
|
|
10686
|
+
isFetching: false,
|
|
10687
|
+
footerLoading: false,
|
|
10688
|
+
error: null,
|
|
10689
|
+
lastAppend: {
|
|
10690
|
+
seq: 0,
|
|
10691
|
+
count: 0
|
|
10692
|
+
}
|
|
10693
|
+
}));
|
|
10694
|
+
const data = useRef(snapshot);
|
|
10695
|
+
const resolved = useRef(snapshot);
|
|
10696
|
+
const prefix = request.prefix;
|
|
10697
|
+
const latest = useRef({
|
|
10698
|
+
options,
|
|
10699
|
+
params,
|
|
10700
|
+
key,
|
|
10701
|
+
prefix
|
|
10702
|
+
});
|
|
10703
|
+
useEffect(() => {
|
|
10704
|
+
latest.current = {
|
|
10705
|
+
options,
|
|
10706
|
+
params,
|
|
10707
|
+
key,
|
|
10708
|
+
prefix
|
|
10709
|
+
};
|
|
10710
|
+
});
|
|
10711
|
+
const cache = useRef(/* @__PURE__ */ new Map());
|
|
10712
|
+
const active = useRef(null);
|
|
10713
|
+
const forcedRevision = useRef(-1);
|
|
10714
|
+
const mounted = useRef(false);
|
|
10715
|
+
const confirmedSort = useRef(params.sort);
|
|
10716
|
+
const confirmedKey = useRef(null);
|
|
10717
|
+
const abortedAppendKey = useRef(null);
|
|
10718
|
+
const hasData = useRef(false);
|
|
10719
|
+
const publish = useCallback((next) => {
|
|
10720
|
+
data.current = next;
|
|
10721
|
+
setSnapshot(next);
|
|
10722
|
+
}, []);
|
|
10723
|
+
const abort = useCallback(() => {
|
|
10724
|
+
active.current?.controller.abort();
|
|
10725
|
+
active.current = null;
|
|
10726
|
+
}, []);
|
|
10727
|
+
useEffect(() => {
|
|
10728
|
+
mounted.current = true;
|
|
10729
|
+
return () => {
|
|
10730
|
+
mounted.current = false;
|
|
10731
|
+
abort();
|
|
10732
|
+
};
|
|
10733
|
+
}, [abort]);
|
|
10734
|
+
const start = useCallback((force = false, background = false) => {
|
|
10735
|
+
const { options: current, params: query, key: queryKey, prefix: previousRows } = latest.current;
|
|
10736
|
+
if (current.enabled === false) {
|
|
10737
|
+
abort();
|
|
10738
|
+
publish({
|
|
10739
|
+
...resolved.current,
|
|
10740
|
+
error: data.current.error,
|
|
10741
|
+
isLoading: false,
|
|
10742
|
+
isFetching: false,
|
|
10743
|
+
footerLoading: false
|
|
10744
|
+
});
|
|
10745
|
+
return;
|
|
10746
|
+
}
|
|
10747
|
+
if (background && queryKey !== confirmedKey.current) return;
|
|
10748
|
+
if (!force && active.current?.key === queryKey) return;
|
|
10749
|
+
abort();
|
|
10750
|
+
abortedAppendKey.current = null;
|
|
10751
|
+
const cacheTime = current.cacheTime ?? 3e4;
|
|
10752
|
+
const cached = cacheTime > 0 ? cache.current.get(queryKey) : void 0;
|
|
10753
|
+
const addsSegment = query.cursor !== null && queryKey !== confirmedKey.current;
|
|
10754
|
+
if (cached && !force) {
|
|
10755
|
+
confirmedSort.current = cached.value.sort;
|
|
10756
|
+
confirmedKey.current = queryKey;
|
|
10757
|
+
hasData.current = true;
|
|
10758
|
+
const appended = query.cursor !== null;
|
|
10759
|
+
resolved.current = {
|
|
10760
|
+
...cached.value,
|
|
10761
|
+
rows: appended ? [...previousRows, ...cached.pageRows] : cached.pageRows,
|
|
10762
|
+
lastAppend: addsSegment && !background ? {
|
|
10763
|
+
seq: data.current.lastAppend.seq + 1,
|
|
10764
|
+
count: cached.pageRows.length
|
|
10765
|
+
} : data.current.lastAppend
|
|
10766
|
+
};
|
|
10767
|
+
publish(resolved.current);
|
|
10768
|
+
if (Date.now() - cached.at < cacheTime) return;
|
|
10769
|
+
}
|
|
10770
|
+
const attempt = {
|
|
10771
|
+
key: queryKey,
|
|
10772
|
+
controller: new AbortController()
|
|
10773
|
+
};
|
|
10774
|
+
active.current = attempt;
|
|
10775
|
+
const keep = query.cursor !== null || background || current.keepPreviousData !== false || Boolean(cached);
|
|
10776
|
+
publish({
|
|
10777
|
+
...data.current,
|
|
10778
|
+
...keep ? {} : {
|
|
10779
|
+
rows: [],
|
|
10780
|
+
page: query.page,
|
|
10781
|
+
pageSize: query.pageSize
|
|
10782
|
+
},
|
|
10783
|
+
sort: query.sort,
|
|
10784
|
+
isLoading: !keep || !hasData.current,
|
|
10785
|
+
isFetching: true,
|
|
10786
|
+
footerLoading: !background && !(cached && !force)
|
|
10787
|
+
});
|
|
10788
|
+
const valid = () => mounted.current && active.current === attempt && !attempt.controller.signal.aborted;
|
|
10789
|
+
const fail = (error) => {
|
|
10790
|
+
if (!valid()) return;
|
|
10791
|
+
active.current = null;
|
|
10792
|
+
cache.current.delete(queryKey);
|
|
10793
|
+
const aborted = typeof error === "object" && error !== null && "name" in error && error.name === "AbortError";
|
|
10794
|
+
if (aborted && query.cursor !== null) abortedAppendKey.current = queryKey;
|
|
10795
|
+
const failure = error ?? /* @__PURE__ */ new Error("Unable to load rows.");
|
|
10796
|
+
publish({
|
|
10797
|
+
...data.current,
|
|
10798
|
+
rows: resolved.current.rows,
|
|
10799
|
+
page: resolved.current.page,
|
|
10800
|
+
pageSize: resolved.current.pageSize,
|
|
10801
|
+
sort: confirmedSort.current,
|
|
10802
|
+
isLoading: false,
|
|
10803
|
+
isFetching: false,
|
|
10804
|
+
footerLoading: false,
|
|
10805
|
+
error: aborted ? null : failure
|
|
10806
|
+
});
|
|
10807
|
+
if (!aborted) latest.current.options.onError?.(failure);
|
|
10808
|
+
};
|
|
10809
|
+
try {
|
|
10810
|
+
Promise.resolve(current.getRows({
|
|
10811
|
+
...query,
|
|
10812
|
+
signal: attempt.controller.signal
|
|
10813
|
+
})).then((result) => {
|
|
10814
|
+
if (!valid()) return;
|
|
10815
|
+
active.current = null;
|
|
10816
|
+
confirmedSort.current = query.sort;
|
|
10817
|
+
confirmedKey.current = queryKey;
|
|
10818
|
+
hasData.current = true;
|
|
10819
|
+
const appended = query.cursor !== null;
|
|
10820
|
+
const next = {
|
|
10821
|
+
...data.current,
|
|
10822
|
+
rows: appended ? [...previousRows, ...result.rows] : result.rows,
|
|
10823
|
+
rowCount: result.rowCount ?? data.current.rowCount,
|
|
10824
|
+
nextCursor: result.nextCursor,
|
|
10825
|
+
page: query.page,
|
|
10826
|
+
pageSize: query.pageSize,
|
|
10827
|
+
sort: query.sort,
|
|
10828
|
+
lastAppend: addsSegment && !background && (!cached || force) ? {
|
|
10829
|
+
seq: data.current.lastAppend.seq + 1,
|
|
10830
|
+
count: result.rows.length
|
|
10831
|
+
} : data.current.lastAppend,
|
|
10832
|
+
isLoading: false,
|
|
10833
|
+
isFetching: false,
|
|
10834
|
+
footerLoading: false,
|
|
10835
|
+
error: null
|
|
10836
|
+
};
|
|
10837
|
+
if (cacheTime > 0) cache.current.set(queryKey, {
|
|
10838
|
+
value: next,
|
|
10839
|
+
pageRows: result.rows,
|
|
10840
|
+
at: Date.now()
|
|
10841
|
+
});
|
|
10842
|
+
resolved.current = next;
|
|
10843
|
+
publish(next);
|
|
10844
|
+
}, fail);
|
|
10845
|
+
} catch (error) {
|
|
10846
|
+
fail(error);
|
|
10847
|
+
}
|
|
10848
|
+
}, [abort, publish]);
|
|
10849
|
+
useEffect(() => {
|
|
10850
|
+
const force = request.force && forcedRevision.current !== request.revision;
|
|
10851
|
+
if (force && enabled) forcedRevision.current = request.revision;
|
|
10852
|
+
start(force);
|
|
10853
|
+
}, [
|
|
10854
|
+
key,
|
|
10855
|
+
request.revision,
|
|
10856
|
+
request.force,
|
|
10857
|
+
enabled,
|
|
10858
|
+
start
|
|
10859
|
+
]);
|
|
10860
|
+
const interval = options.revalidateInterval ?? 0;
|
|
10861
|
+
useEffect(() => {
|
|
10862
|
+
if (!enabled || interval <= 0) return;
|
|
10863
|
+
const timer = setInterval(() => {
|
|
10864
|
+
if (typeof document !== "undefined" && document.hidden) return;
|
|
10865
|
+
if (!active.current) start(true, true);
|
|
10866
|
+
}, interval);
|
|
10867
|
+
return () => clearInterval(timer);
|
|
10868
|
+
}, [
|
|
10869
|
+
enabled,
|
|
10870
|
+
interval,
|
|
10871
|
+
start
|
|
10872
|
+
]);
|
|
10873
|
+
const change = (update, force = false, prefix = []) => setRequest((before) => ({
|
|
10874
|
+
...before,
|
|
10875
|
+
filtersKey,
|
|
10876
|
+
force,
|
|
10877
|
+
prefix,
|
|
10878
|
+
revision: before.revision + 1,
|
|
10879
|
+
query: {
|
|
10880
|
+
...before.filtersKey === filtersKey ? before.query : {
|
|
10881
|
+
...before.query,
|
|
10882
|
+
page: 1,
|
|
10883
|
+
filters: options.filters
|
|
10884
|
+
},
|
|
10885
|
+
cursor: null,
|
|
10886
|
+
...update
|
|
10887
|
+
}
|
|
10888
|
+
}));
|
|
10889
|
+
const onQueryChange = (query) => change({
|
|
10890
|
+
page: query.cause === "sort" || query.cause === "view" && (JSON.stringify(query.sort) !== JSON.stringify(params.sort) || JSON.stringify(query.filters) !== JSON.stringify(params.filters)) ? 1 : query.page,
|
|
10891
|
+
pageSize: query.pageSize,
|
|
10892
|
+
sort: query.sort,
|
|
10893
|
+
...query.cause === "view" ? { filters: query.filters } : {}
|
|
10894
|
+
});
|
|
10895
|
+
const refetch = () => change(params.cursor === null ? {} : { page: 1 }, true);
|
|
10896
|
+
const retry = () => change(params, true, prefix);
|
|
10897
|
+
const invalidate = () => {
|
|
10898
|
+
cache.current.clear();
|
|
10899
|
+
refetch();
|
|
10900
|
+
};
|
|
10901
|
+
const loadMore = () => {
|
|
10902
|
+
if (active.current || data.current.error != null || !snapshot.nextCursor || !enabled) return;
|
|
10903
|
+
if (key !== confirmedKey.current) {
|
|
10904
|
+
if (key === abortedAppendKey.current) retry();
|
|
10905
|
+
return;
|
|
10906
|
+
}
|
|
10907
|
+
change({
|
|
10908
|
+
page: params.page + 1,
|
|
10909
|
+
cursor: snapshot.nextCursor
|
|
10910
|
+
}, false, snapshot.rows);
|
|
10911
|
+
};
|
|
10912
|
+
const hasMore = Boolean(snapshot.nextCursor);
|
|
10913
|
+
const { footerLoading, ...state } = snapshot;
|
|
10914
|
+
return {
|
|
10915
|
+
...state,
|
|
10916
|
+
params,
|
|
10917
|
+
hasMore,
|
|
10918
|
+
loadMore,
|
|
10919
|
+
refetch,
|
|
10920
|
+
invalidate,
|
|
10921
|
+
tableProps: {
|
|
10922
|
+
rows: snapshot.rows,
|
|
10923
|
+
paginationMode: "server",
|
|
10924
|
+
rowCount: snapshot.rowCount,
|
|
10925
|
+
page: snapshot.page,
|
|
10926
|
+
pageSize: snapshot.pageSize,
|
|
10927
|
+
sort: snapshot.sort,
|
|
10928
|
+
manualSorting: true,
|
|
10929
|
+
loading: snapshot.isLoading,
|
|
10930
|
+
filters: params.filters,
|
|
10931
|
+
onPageChange: (page) => change({ page }),
|
|
10932
|
+
onPageSizeChange: (pageSize) => change({
|
|
10933
|
+
page: 1,
|
|
10934
|
+
pageSize
|
|
10935
|
+
}),
|
|
10936
|
+
onSortChange: (sort) => change({
|
|
10937
|
+
page: 1,
|
|
10938
|
+
sort
|
|
10939
|
+
}),
|
|
10940
|
+
onQueryChange
|
|
10941
|
+
},
|
|
10942
|
+
loadMoreProps: {
|
|
10943
|
+
onLoadMore: loadMore,
|
|
10944
|
+
onRetry: retry,
|
|
10945
|
+
error: snapshot.error == null ? "" : snapshot.error instanceof Error && snapshot.error.message ? snapshot.error.message : "Unable to load rows.",
|
|
10946
|
+
nextCursor: snapshot.nextCursor,
|
|
10947
|
+
hasMore,
|
|
10948
|
+
loading: footerLoading,
|
|
10949
|
+
loadedCount: snapshot.rows.length,
|
|
10950
|
+
lastAppend: snapshot.lastAppend
|
|
10951
|
+
}
|
|
10952
|
+
};
|
|
10953
|
+
}
|
|
10954
|
+
//#endregion
|
|
10471
10955
|
//#region src/marketing/actions.tsx
|
|
10472
10956
|
function ActionButton({ action, variant, size = "lg", className }) {
|
|
10473
10957
|
const Trailing = action.icon;
|
|
@@ -10670,7 +11154,7 @@ function FeatureGrid({ features = sampleFeatures, eyebrow = "Everything included
|
|
|
10670
11154
|
className: "mx-auto max-w-2xl text-center",
|
|
10671
11155
|
children: [
|
|
10672
11156
|
eyebrow && /* @__PURE__ */ jsx("p", {
|
|
10673
|
-
className: "font-mono text-[12px] font-semibold tracking-wide text-primary-text
|
|
11157
|
+
className: "font-mono text-[12px] font-semibold tracking-wide text-primary-text label-case",
|
|
10674
11158
|
children: eyebrow
|
|
10675
11159
|
}),
|
|
10676
11160
|
title && /* @__PURE__ */ jsx(Heading, {
|
|
@@ -10825,7 +11309,7 @@ function PricingTable({ tiers = samplePricingTiers, eyebrow = "Pricing", title =
|
|
|
10825
11309
|
className: "mx-auto max-w-2xl text-center",
|
|
10826
11310
|
children: [
|
|
10827
11311
|
eyebrow && /* @__PURE__ */ jsx("p", {
|
|
10828
|
-
className: "font-mono text-[12px] font-semibold tracking-wide text-primary-text
|
|
11312
|
+
className: "font-mono text-[12px] font-semibold tracking-wide text-primary-text label-case",
|
|
10829
11313
|
children: eyebrow
|
|
10830
11314
|
}),
|
|
10831
11315
|
hasTitle && /* @__PURE__ */ jsx(Heading, {
|
|
@@ -10990,7 +11474,7 @@ function TierBody({ tier, tierId, cycle, money, TierHeading, currentTierId, curr
|
|
|
10990
11474
|
}
|
|
10991
11475
|
//#endregion
|
|
10992
11476
|
//#region src/marketing/PricingTable/block.meta.ts
|
|
10993
|
-
const meta$
|
|
11477
|
+
const meta$53 = {
|
|
10994
11478
|
name: "Pricing table",
|
|
10995
11479
|
family: "marketing",
|
|
10996
11480
|
status: "beta",
|
|
@@ -11259,7 +11743,7 @@ const sampleComparisonSections = [
|
|
|
11259
11743
|
//#endregion
|
|
11260
11744
|
//#region src/marketing/ComparisonTable/ComparisonTable.tsx
|
|
11261
11745
|
const number = new Intl.NumberFormat("en-US");
|
|
11262
|
-
const STICKY$1 = "sticky start-0 z-
|
|
11746
|
+
const STICKY$1 = "sticky start-0 z-sticky bg-card";
|
|
11263
11747
|
/**
|
|
11264
11748
|
* Feature comparison of plans or options: columns are plans, rows are features grouped by section.
|
|
11265
11749
|
* Booleans render as a check or a dash with screen-reader text; text and numbers render as is. The
|
|
@@ -11310,7 +11794,7 @@ function ComparisonTable({ plans = sampleComparisonPlans, sections = sampleCompa
|
|
|
11310
11794
|
className: "mx-auto mb-10 max-w-2xl text-center",
|
|
11311
11795
|
children: [
|
|
11312
11796
|
eyebrow && /* @__PURE__ */ jsx("p", {
|
|
11313
|
-
className: "font-mono text-[12px] font-semibold tracking-wide text-primary-text
|
|
11797
|
+
className: "font-mono text-[12px] font-semibold tracking-wide text-primary-text label-case",
|
|
11314
11798
|
children: eyebrow
|
|
11315
11799
|
}),
|
|
11316
11800
|
hasTitle && /* @__PURE__ */ jsx(Heading, {
|
|
@@ -11425,6 +11909,289 @@ const meta$9 = {
|
|
|
11425
11909
|
]
|
|
11426
11910
|
};
|
|
11427
11911
|
//#endregion
|
|
11912
|
+
//#region src/marketing/SiteFooter/SiteFooter.tsx
|
|
11913
|
+
function LinkList({ links, className }) {
|
|
11914
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
11915
|
+
className: cn("flex flex-wrap gap-x-4 gap-y-1", className),
|
|
11916
|
+
children: links.map((link) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(Link, {
|
|
11917
|
+
href: link.href,
|
|
11918
|
+
external: link.external,
|
|
11919
|
+
tone: "muted",
|
|
11920
|
+
underline: "hover",
|
|
11921
|
+
children: link.label
|
|
11922
|
+
}) }, link.href))
|
|
11923
|
+
});
|
|
11924
|
+
}
|
|
11925
|
+
/** Public-page footer. The default div fits inside a layout's existing footer landmark. */
|
|
11926
|
+
function SiteFooter({ layout = "columns", brand = /* @__PURE__ */ jsx(Logo, {
|
|
11927
|
+
size: 24,
|
|
11928
|
+
wordmark: true
|
|
11929
|
+
}), description, columns = [], links = [], legalLinks = [], social = [], copyright, headingLevel: Heading = "h2", navLabel, landmark = false, themeSwitcher = false, newsletter, className }) {
|
|
11930
|
+
const { t } = useI18n();
|
|
11931
|
+
const populatedColumns = columns.filter((column) => column.links.length > 0);
|
|
11932
|
+
const Root = landmark ? "footer" : "div";
|
|
11933
|
+
const copyrightContent = copyright === void 0 ? t("footer.copyright") : copyright;
|
|
11934
|
+
const centered = layout === "centered";
|
|
11935
|
+
const rowNav = links.length > 0 && /* @__PURE__ */ jsx("nav", {
|
|
11936
|
+
"aria-label": navLabel ?? t("footer.label"),
|
|
11937
|
+
children: /* @__PURE__ */ jsx(LinkList, {
|
|
11938
|
+
links,
|
|
11939
|
+
className: centered ? "justify-center" : void 0
|
|
11940
|
+
})
|
|
11941
|
+
});
|
|
11942
|
+
const legalNav = legalLinks.length > 0 && /* @__PURE__ */ jsx("nav", {
|
|
11943
|
+
"aria-label": t("footer.legal"),
|
|
11944
|
+
children: /* @__PURE__ */ jsx(LinkList, {
|
|
11945
|
+
links: legalLinks,
|
|
11946
|
+
className: centered ? "justify-center" : void 0
|
|
11947
|
+
})
|
|
11948
|
+
});
|
|
11949
|
+
const socialList = social.length > 0 && /* @__PURE__ */ jsx("ul", {
|
|
11950
|
+
"aria-label": t("footer.social"),
|
|
11951
|
+
className: cn("flex flex-wrap gap-2", centered && "justify-center"),
|
|
11952
|
+
children: social.map((link) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(IconButton, {
|
|
11953
|
+
icon: link.icon,
|
|
11954
|
+
label: link.label,
|
|
11955
|
+
render: /* @__PURE__ */ jsx("a", { href: link.href }),
|
|
11956
|
+
role: "link",
|
|
11957
|
+
nativeButton: false,
|
|
11958
|
+
size: "sm"
|
|
11959
|
+
}) }, link.href))
|
|
11960
|
+
});
|
|
11961
|
+
if (layout === "simple") return /* @__PURE__ */ jsxs(Root, {
|
|
11962
|
+
className: cn("flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between", className),
|
|
11963
|
+
children: [
|
|
11964
|
+
/* @__PURE__ */ jsx("span", { children: copyrightContent }),
|
|
11965
|
+
rowNav,
|
|
11966
|
+
legalNav,
|
|
11967
|
+
socialList,
|
|
11968
|
+
themeSwitcher && /* @__PURE__ */ jsx(ThemeSwitcher, {
|
|
11969
|
+
size: "sm",
|
|
11970
|
+
showLabels: false
|
|
11971
|
+
})
|
|
11972
|
+
]
|
|
11973
|
+
});
|
|
11974
|
+
if (centered) return /* @__PURE__ */ jsxs(Root, {
|
|
11975
|
+
className: cn("flex min-w-0 flex-col items-center gap-6 px-4 py-12 text-center text-sm wrap-anywhere text-muted-foreground sm:px-6 [&>*]:max-w-full", className),
|
|
11976
|
+
children: [
|
|
11977
|
+
brand,
|
|
11978
|
+
description && /* @__PURE__ */ jsx("div", { children: description }),
|
|
11979
|
+
newsletter && /* @__PURE__ */ jsx("div", { children: newsletter }),
|
|
11980
|
+
rowNav,
|
|
11981
|
+
legalNav,
|
|
11982
|
+
socialList,
|
|
11983
|
+
/* @__PURE__ */ jsx("span", { children: copyrightContent }),
|
|
11984
|
+
themeSwitcher && /* @__PURE__ */ jsx(ThemeSwitcher, {
|
|
11985
|
+
size: "sm",
|
|
11986
|
+
showLabels: false
|
|
11987
|
+
})
|
|
11988
|
+
]
|
|
11989
|
+
});
|
|
11990
|
+
return /* @__PURE__ */ jsxs(Root, {
|
|
11991
|
+
className: cn("min-w-0 px-4 py-12 text-sm wrap-anywhere text-muted-foreground sm:px-6", className),
|
|
11992
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
11993
|
+
className: "grid min-w-0 gap-8 lg:grid-cols-[minmax(0,1fr)_minmax(0,2fr)]",
|
|
11994
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
11995
|
+
className: "min-w-0 space-y-4",
|
|
11996
|
+
children: [
|
|
11997
|
+
brand,
|
|
11998
|
+
description && /* @__PURE__ */ jsx("div", { children: description }),
|
|
11999
|
+
newsletter && /* @__PURE__ */ jsx("div", { children: newsletter })
|
|
12000
|
+
]
|
|
12001
|
+
}), populatedColumns.length > 0 && /* @__PURE__ */ jsx("nav", {
|
|
12002
|
+
"aria-label": navLabel ?? t("footer.label"),
|
|
12003
|
+
className: "grid min-w-0 grid-cols-2 gap-8 lg:grid-cols-4",
|
|
12004
|
+
children: populatedColumns.map((column) => /* @__PURE__ */ jsxs("div", {
|
|
12005
|
+
className: "min-w-0",
|
|
12006
|
+
children: [/* @__PURE__ */ jsx(Heading, {
|
|
12007
|
+
className: "mb-3 text-sm font-semibold text-foreground",
|
|
12008
|
+
children: column.title
|
|
12009
|
+
}), /* @__PURE__ */ jsx(LinkList, {
|
|
12010
|
+
links: column.links,
|
|
12011
|
+
className: "flex-col gap-y-2"
|
|
12012
|
+
})]
|
|
12013
|
+
}, column.title))
|
|
12014
|
+
})]
|
|
12015
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
12016
|
+
className: "mt-8 flex flex-wrap items-center justify-between gap-3",
|
|
12017
|
+
children: [
|
|
12018
|
+
/* @__PURE__ */ jsx("span", { children: copyrightContent }),
|
|
12019
|
+
legalNav,
|
|
12020
|
+
socialList,
|
|
12021
|
+
themeSwitcher && /* @__PURE__ */ jsx(ThemeSwitcher, {
|
|
12022
|
+
size: "sm",
|
|
12023
|
+
showLabels: false
|
|
12024
|
+
})
|
|
12025
|
+
]
|
|
12026
|
+
})]
|
|
12027
|
+
});
|
|
12028
|
+
}
|
|
12029
|
+
//#endregion
|
|
12030
|
+
//#region src/marketing/SiteFooter/block.meta.ts
|
|
12031
|
+
const meta$64 = {
|
|
12032
|
+
name: "Site footer",
|
|
12033
|
+
family: "marketing",
|
|
12034
|
+
status: "beta",
|
|
12035
|
+
description: "Public footer with columns, centered and simple layouts. Optional brand, description, newsletter slot, legal and social links, and an icon-only theme switcher at every width. Uses a div by default inside a layout footer; opt into landmark for standalone pages. Empty groups stay absent; navigation names use the English/Spanish catalog or navLabel. Social labels must name the network. Simple mode preserves inherited typography and the public templates’ spacing.",
|
|
12036
|
+
uses: [
|
|
12037
|
+
"Link",
|
|
12038
|
+
"Logo",
|
|
12039
|
+
"IconButton",
|
|
12040
|
+
"ThemeSwitcher"
|
|
12041
|
+
]
|
|
12042
|
+
};
|
|
12043
|
+
//#endregion
|
|
12044
|
+
//#region src/marketing/SiteFooter/fixtures.ts
|
|
12045
|
+
const sampleFooterColumns = [
|
|
12046
|
+
{
|
|
12047
|
+
title: "Product",
|
|
12048
|
+
links: [{
|
|
12049
|
+
label: "Overview",
|
|
12050
|
+
href: "/product"
|
|
12051
|
+
}, {
|
|
12052
|
+
label: "Pricing",
|
|
12053
|
+
href: "/pricing"
|
|
12054
|
+
}]
|
|
12055
|
+
},
|
|
12056
|
+
{
|
|
12057
|
+
title: "Company",
|
|
12058
|
+
links: [{
|
|
12059
|
+
label: "About",
|
|
12060
|
+
href: "/about"
|
|
12061
|
+
}, {
|
|
12062
|
+
label: "Contact",
|
|
12063
|
+
href: "/contact"
|
|
12064
|
+
}]
|
|
12065
|
+
},
|
|
12066
|
+
{
|
|
12067
|
+
title: "Resources",
|
|
12068
|
+
links: [{
|
|
12069
|
+
label: "Documentation",
|
|
12070
|
+
href: "/docs"
|
|
12071
|
+
}, {
|
|
12072
|
+
label: "Status",
|
|
12073
|
+
href: "/status"
|
|
12074
|
+
}]
|
|
12075
|
+
}
|
|
12076
|
+
];
|
|
12077
|
+
const sampleLegalLinks = [{
|
|
12078
|
+
label: "Privacy",
|
|
12079
|
+
href: "/privacy"
|
|
12080
|
+
}, {
|
|
12081
|
+
label: "Terms",
|
|
12082
|
+
href: "/terms"
|
|
12083
|
+
}];
|
|
12084
|
+
const sampleSocialLinks = [{
|
|
12085
|
+
label: "Email",
|
|
12086
|
+
href: "mailto:hello@example.com",
|
|
12087
|
+
icon: Mail$1
|
|
12088
|
+
}, {
|
|
12089
|
+
label: "RSS feed",
|
|
12090
|
+
href: "/feed.xml",
|
|
12091
|
+
icon: Rss
|
|
12092
|
+
}];
|
|
12093
|
+
//#endregion
|
|
12094
|
+
//#region src/marketing/LogoCloud/LogoCloud.tsx
|
|
12095
|
+
const gridColumns = {
|
|
12096
|
+
3: "md:grid-cols-3",
|
|
12097
|
+
4: "md:grid-cols-4",
|
|
12098
|
+
6: "md:grid-cols-6"
|
|
12099
|
+
};
|
|
12100
|
+
/** Static social proof. Marks inherit the root token colour unless an item overrides it. */
|
|
12101
|
+
function LogoCloud({ logos, caption, captionPlacement = "above", layout = "row", columns = 4, logoHeight = 28, className }) {
|
|
12102
|
+
const captionId = useId();
|
|
12103
|
+
const { t } = useI18n();
|
|
12104
|
+
if (logos.length === 0) return null;
|
|
12105
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
12106
|
+
className: cn("flex min-w-0 flex-col items-center gap-6 px-4 py-10 text-muted-foreground sm:px-6", captionPlacement === "start" && "md:flex-row md:items-center", className),
|
|
12107
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
12108
|
+
id: captionId,
|
|
12109
|
+
className: cn("min-w-0 text-center text-sm wrap-anywhere", captionPlacement === "start" && "md:max-w-64 md:shrink-0 md:text-start"),
|
|
12110
|
+
children: caption ?? t("logoCloud.caption")
|
|
12111
|
+
}), /* @__PURE__ */ jsx("ul", {
|
|
12112
|
+
"aria-labelledby": captionId,
|
|
12113
|
+
className: cn("m-0 w-full min-w-0 list-none items-center gap-x-8 gap-y-6 p-0", layout === "grid" ? cn("grid grid-cols-2", gridColumns[columns]) : "flex flex-wrap justify-center"),
|
|
12114
|
+
children: logos.map((logo) => /* @__PURE__ */ jsx("li", {
|
|
12115
|
+
className: cn("flex min-w-0 max-w-full justify-center", logo.className),
|
|
12116
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
12117
|
+
role: "img",
|
|
12118
|
+
"aria-label": logo.name,
|
|
12119
|
+
className: "flex min-w-0 max-w-full justify-center",
|
|
12120
|
+
style: { height: logoHeight },
|
|
12121
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
12122
|
+
"aria-hidden": "true",
|
|
12123
|
+
className: "inline-flex h-full min-w-0 max-w-full [&_svg]:h-full [&_svg]:w-auto [&_svg]:max-w-full",
|
|
12124
|
+
children: logo.mark
|
|
12125
|
+
})
|
|
12126
|
+
})
|
|
12127
|
+
}, logo.id))
|
|
12128
|
+
})]
|
|
12129
|
+
});
|
|
12130
|
+
}
|
|
12131
|
+
//#endregion
|
|
12132
|
+
//#region src/marketing/LogoCloud/block.meta.ts
|
|
12133
|
+
const meta$40 = {
|
|
12134
|
+
name: "Logo cloud",
|
|
12135
|
+
family: "marketing",
|
|
12136
|
+
status: "beta",
|
|
12137
|
+
description: "Static customer marks in a centred wrapping row or responsive grid with a localized caption above or beside the logos. Apps supply single-colour currentColor SVGs. Marks inherit muted-foreground; use the high_contrast theme or text-foreground on the root or an item for thin marks. Empty logo arrays render nothing. No animation, filters or masks.",
|
|
12138
|
+
uses: []
|
|
12139
|
+
};
|
|
12140
|
+
//#endregion
|
|
12141
|
+
//#region src/marketing/LogoCloud/fixtures.ts
|
|
12142
|
+
/** Neutral placeholder marks, never customer assets. Supply your own currentColor SVGs. */
|
|
12143
|
+
const sampleLogos = [
|
|
12144
|
+
[
|
|
12145
|
+
"acme",
|
|
12146
|
+
"Acme",
|
|
12147
|
+
96,
|
|
12148
|
+
"M14 0 28 28H0z"
|
|
12149
|
+
],
|
|
12150
|
+
[
|
|
12151
|
+
"example",
|
|
12152
|
+
"Example",
|
|
12153
|
+
128,
|
|
12154
|
+
"M0 0h28v28H0z"
|
|
12155
|
+
],
|
|
12156
|
+
[
|
|
12157
|
+
"sample",
|
|
12158
|
+
"Sample",
|
|
12159
|
+
118,
|
|
12160
|
+
"M14 0 28 14 14 28 0 14z"
|
|
12161
|
+
],
|
|
12162
|
+
[
|
|
12163
|
+
"demo",
|
|
12164
|
+
"Demo",
|
|
12165
|
+
100,
|
|
12166
|
+
"M0 0h12v28H0zM16 0h12v28H16z"
|
|
12167
|
+
],
|
|
12168
|
+
[
|
|
12169
|
+
"placeholder",
|
|
12170
|
+
"Placeholder",
|
|
12171
|
+
166,
|
|
12172
|
+
"M0 0h28v12H0zM0 16h28v12H0z"
|
|
12173
|
+
],
|
|
12174
|
+
[
|
|
12175
|
+
"studio",
|
|
12176
|
+
"Studio",
|
|
12177
|
+
108,
|
|
12178
|
+
"M0 0h12v16h16v12H0z"
|
|
12179
|
+
]
|
|
12180
|
+
].map(([id, name, width, path]) => ({
|
|
12181
|
+
id,
|
|
12182
|
+
name,
|
|
12183
|
+
mark: createElement("svg", {
|
|
12184
|
+
viewBox: `0 0 ${width} 28`,
|
|
12185
|
+
fill: "currentColor",
|
|
12186
|
+
focusable: "false"
|
|
12187
|
+
}, createElement("path", { d: path }), createElement("text", {
|
|
12188
|
+
x: 36,
|
|
12189
|
+
y: 21,
|
|
12190
|
+
fontSize: 20,
|
|
12191
|
+
fontWeight: 600
|
|
12192
|
+
}, name))
|
|
12193
|
+
}));
|
|
12194
|
+
//#endregion
|
|
11428
12195
|
//#region src/page-chrome/types.ts
|
|
11429
12196
|
/** Maps a PageChromeAction to a MoreMenu item (destructive variant → destructive item). */
|
|
11430
12197
|
function toMenuAction(action) {
|
|
@@ -11521,7 +12288,7 @@ function PageHeader({ as: Root = "header", breadcrumbs = pageHeaderBreadcrumbs,
|
|
|
11521
12288
|
children: action.label
|
|
11522
12289
|
}, action.id ?? action.label);
|
|
11523
12290
|
return /* @__PURE__ */ jsxs(Root, {
|
|
11524
|
-
className: cn("min-w-0", className),
|
|
12291
|
+
className: cn("@container w-full min-w-0", className),
|
|
11525
12292
|
children: [
|
|
11526
12293
|
breadcrumbs && breadcrumbs.length > 0 && /* @__PURE__ */ jsx(Breadcrumbs, {
|
|
11527
12294
|
items: breadcrumbs,
|
|
@@ -11571,10 +12338,10 @@ function PageHeader({ as: Root = "header", breadcrumbs = pageHeaderBreadcrumbs,
|
|
|
11571
12338
|
})
|
|
11572
12339
|
]
|
|
11573
12340
|
}), actions.length > 0 && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("div", {
|
|
11574
|
-
className: "hidden shrink-0 items-center gap-2.5
|
|
12341
|
+
className: "hidden shrink-0 items-center gap-2.5 @xl:flex",
|
|
11575
12342
|
children: actions.map(renderAction)
|
|
11576
12343
|
}), /* @__PURE__ */ jsxs("div", {
|
|
11577
|
-
className: "flex shrink-0 items-center gap-2
|
|
12344
|
+
className: "flex shrink-0 items-center gap-2 @xl:hidden",
|
|
11578
12345
|
children: [folded.length > 0 && /* @__PURE__ */ jsx(MoreMenu, {
|
|
11579
12346
|
items: folded.map(toMenuAction),
|
|
11580
12347
|
label: labels?.moreActions ?? t("pageHeader.moreActions")
|
|
@@ -11601,11 +12368,11 @@ function PageHeader({ as: Root = "header", breadcrumbs = pageHeaderBreadcrumbs,
|
|
|
11601
12368
|
}
|
|
11602
12369
|
//#endregion
|
|
11603
12370
|
//#region src/page-chrome/PageHeader/block.meta.ts
|
|
11604
|
-
const meta$
|
|
12371
|
+
const meta$46 = {
|
|
11605
12372
|
name: "Page header",
|
|
11606
12373
|
family: "page-chrome",
|
|
11607
12374
|
status: "beta",
|
|
11608
|
-
description: "Screen header with breadcrumb, title and status, description, meta row, actions that fold into a MoreMenu
|
|
12375
|
+
description: "Screen header with breadcrumb, title and status, description, meta row, actions that fold into a MoreMenu in narrow containers, 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
12376
|
labels: [
|
|
11610
12377
|
{
|
|
11611
12378
|
key: "title",
|
|
@@ -11677,7 +12444,7 @@ function SectionHeader({ title = "Policies", description = "Guardrails applied t
|
|
|
11677
12444
|
}
|
|
11678
12445
|
//#endregion
|
|
11679
12446
|
//#region src/page-chrome/SectionHeader/block.meta.ts
|
|
11680
|
-
const meta$
|
|
12447
|
+
const meta$59 = {
|
|
11681
12448
|
name: "Section header",
|
|
11682
12449
|
family: "page-chrome",
|
|
11683
12450
|
status: "beta",
|
|
@@ -11770,7 +12537,7 @@ function PageToolbar({ search, defaultSearch = "", onSearchChange, searchLabel:
|
|
|
11770
12537
|
}
|
|
11771
12538
|
//#endregion
|
|
11772
12539
|
//#region src/page-chrome/PageToolbar/block.meta.ts
|
|
11773
|
-
const meta$
|
|
12540
|
+
const meta$47 = {
|
|
11774
12541
|
name: "Page toolbar",
|
|
11775
12542
|
family: "page-chrome",
|
|
11776
12543
|
status: "beta",
|
|
@@ -11796,7 +12563,7 @@ function StickyActionBar({ dirty = true, saving = false, onSave, onCancel, dirty
|
|
|
11796
12563
|
if (hideWhenClean && !dirty && !saving) return null;
|
|
11797
12564
|
return /* @__PURE__ */ jsx("section", {
|
|
11798
12565
|
"aria-label": ariaLabel,
|
|
11799
|
-
className: cn("sticky bottom-0 z-
|
|
12566
|
+
className: cn("sticky bottom-0 z-docked border-t border-border bg-card px-4 py-3 shadow-sm sm:px-6", className),
|
|
11800
12567
|
children: /* @__PURE__ */ jsxs("div", {
|
|
11801
12568
|
className: "mx-auto flex max-w-5xl flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",
|
|
11802
12569
|
children: [/* @__PURE__ */ jsxs("p", {
|
|
@@ -11826,7 +12593,7 @@ function StickyActionBar({ dirty = true, saving = false, onSave, onCancel, dirty
|
|
|
11826
12593
|
}
|
|
11827
12594
|
//#endregion
|
|
11828
12595
|
//#region src/page-chrome/StickyActionBar/block.meta.ts
|
|
11829
|
-
const meta$
|
|
12596
|
+
const meta$70 = {
|
|
11830
12597
|
name: "Sticky action bar",
|
|
11831
12598
|
family: "page-chrome",
|
|
11832
12599
|
status: "beta",
|
|
@@ -11924,21 +12691,29 @@ function useSchedulingClock(override) {
|
|
|
11924
12691
|
//#endregion
|
|
11925
12692
|
//#region src/scheduling/shared/CalendarHeader.tsx
|
|
11926
12693
|
/** Title + previous / today / next navigation + caller actions. */
|
|
11927
|
-
function CalendarHeader({ titleId, title, subtitle, prevLabel, nextLabel, onPrev, onNext, onToday, actions }) {
|
|
12694
|
+
function CalendarHeader({ timeZone = "system", referenceDate, titleId, title, subtitle, prevLabel, nextLabel, onPrev, onNext, onToday, actions }) {
|
|
11928
12695
|
const { t } = useI18n();
|
|
11929
12696
|
return /* @__PURE__ */ jsxs("div", {
|
|
11930
12697
|
className: "flex flex-wrap items-center justify-between gap-3 border-b border-border px-4 py-3 sm:px-5",
|
|
11931
12698
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
11932
12699
|
className: "min-w-0",
|
|
11933
|
-
children: [
|
|
11934
|
-
|
|
11935
|
-
|
|
11936
|
-
|
|
11937
|
-
|
|
11938
|
-
|
|
11939
|
-
|
|
11940
|
-
|
|
11941
|
-
|
|
12700
|
+
children: [
|
|
12701
|
+
/* @__PURE__ */ jsx("h3", {
|
|
12702
|
+
id: titleId,
|
|
12703
|
+
"aria-live": "polite",
|
|
12704
|
+
className: "truncate text-[15px] font-semibold tracking-tight text-foreground",
|
|
12705
|
+
children: title
|
|
12706
|
+
}),
|
|
12707
|
+
/* @__PURE__ */ jsx(TimeZoneLabel, {
|
|
12708
|
+
id: `${titleId}-zone`,
|
|
12709
|
+
timeZone,
|
|
12710
|
+
referenceDate
|
|
12711
|
+
}),
|
|
12712
|
+
subtitle && /* @__PURE__ */ jsx("p", {
|
|
12713
|
+
className: "mt-0.5 truncate font-mono text-[11px] text-muted-foreground",
|
|
12714
|
+
children: subtitle
|
|
12715
|
+
})
|
|
12716
|
+
]
|
|
11942
12717
|
}), /* @__PURE__ */ jsxs("div", {
|
|
11943
12718
|
className: "flex shrink-0 items-center gap-2",
|
|
11944
12719
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
@@ -11969,52 +12744,87 @@ function CalendarHeader({ titleId, title, subtitle, prevLabel, nextLabel, onPrev
|
|
|
11969
12744
|
})]
|
|
11970
12745
|
});
|
|
11971
12746
|
}
|
|
12747
|
+
/** Shared, wrapping zone caption for calendar and agenda headers. */
|
|
12748
|
+
function TimeZoneLabel({ id, timeZone, referenceDate }) {
|
|
12749
|
+
const { t } = useI18n();
|
|
12750
|
+
if (timeZone === "system") return null;
|
|
12751
|
+
const zone = timeZone === "UTC" ? "UTC" : `${timeZone} (${formatTimeZoneLabel(timeZone, referenceDate, "en-US")})`;
|
|
12752
|
+
return /* @__PURE__ */ jsx("p", {
|
|
12753
|
+
id,
|
|
12754
|
+
className: "mt-0.5 break-words text-[11px] text-muted-foreground",
|
|
12755
|
+
children: t("scheduling.timeZone", { zone })
|
|
12756
|
+
});
|
|
12757
|
+
}
|
|
11972
12758
|
//#endregion
|
|
11973
12759
|
//#region src/scheduling/shared/dates.ts
|
|
12760
|
+
/** Native-Date helpers for scheduling. All optional zones default to the runtime clock. */
|
|
11974
12761
|
const pad = (n) => String(n).padStart(2, "0");
|
|
11975
|
-
/**
|
|
11976
|
-
function
|
|
11977
|
-
|
|
12762
|
+
/** Midnight in the display zone, normalizing calendar arithmetic before DST conversion. */
|
|
12763
|
+
function calendarDate(year, month, day, zone = "system") {
|
|
12764
|
+
if (zone === "system") return new Date(year, month - 1, day);
|
|
12765
|
+
const normalized = /* @__PURE__ */ new Date(0);
|
|
12766
|
+
normalized.setUTCFullYear(year, month - 1, day);
|
|
12767
|
+
const parts = zonedParts(normalized, "UTC");
|
|
12768
|
+
return fromZonedParts(parts, zone);
|
|
12769
|
+
}
|
|
12770
|
+
function dayKey(d, zone = "system") {
|
|
12771
|
+
const p = zonedParts(d, zone);
|
|
12772
|
+
return `${p.year}-${pad(p.month)}-${pad(p.day)}`;
|
|
11978
12773
|
}
|
|
11979
|
-
function startOfDay(d) {
|
|
11980
|
-
|
|
12774
|
+
function startOfDay(d, zone = "system") {
|
|
12775
|
+
const p = zonedParts(d, zone);
|
|
12776
|
+
return calendarDate(p.year, p.month, p.day, zone);
|
|
11981
12777
|
}
|
|
11982
|
-
function addDays(d, n) {
|
|
11983
|
-
|
|
12778
|
+
function addDays(d, n, zone = "system") {
|
|
12779
|
+
const p = zonedParts(d, zone);
|
|
12780
|
+
return calendarDate(p.year, p.month, p.day + n, zone);
|
|
11984
12781
|
}
|
|
11985
|
-
function addMonths(d, n) {
|
|
11986
|
-
|
|
12782
|
+
function addMonths(d, n, zone = "system") {
|
|
12783
|
+
const p = zonedParts(d, zone);
|
|
12784
|
+
return calendarDate(p.year, p.month + n, 1, zone);
|
|
11987
12785
|
}
|
|
11988
|
-
function startOfMonth(d) {
|
|
11989
|
-
return
|
|
12786
|
+
function startOfMonth(d, zone = "system") {
|
|
12787
|
+
return addMonths(d, 0, zone);
|
|
11990
12788
|
}
|
|
11991
|
-
function sameDay(a, b) {
|
|
11992
|
-
return a
|
|
12789
|
+
function sameDay(a, b, zone = "system") {
|
|
12790
|
+
return dayKey(a, zone) === dayKey(b, zone);
|
|
11993
12791
|
}
|
|
11994
|
-
function sameMonth(a, b) {
|
|
11995
|
-
|
|
12792
|
+
function sameMonth(a, b, zone = "system") {
|
|
12793
|
+
const p = zonedParts(a, zone), q = zonedParts(b, zone);
|
|
12794
|
+
return p.year === q.year && p.month === q.month;
|
|
11996
12795
|
}
|
|
11997
|
-
|
|
11998
|
-
|
|
11999
|
-
return
|
|
12796
|
+
function weekday(d, zone = "system") {
|
|
12797
|
+
const p = zonedParts(d, zone);
|
|
12798
|
+
return new Date(Date.UTC(p.year, p.month - 1, p.day)).getUTCDay();
|
|
12000
12799
|
}
|
|
12001
|
-
function
|
|
12002
|
-
|
|
12003
|
-
return Array.from({ length: 7 }, (_, i) => addDays(first, i));
|
|
12800
|
+
function startOfWeek(d, weekStartsOn, zone = "system") {
|
|
12801
|
+
return addDays(d, -((weekday(d, zone) - weekStartsOn + 7) % 7), zone);
|
|
12004
12802
|
}
|
|
12005
|
-
|
|
12006
|
-
|
|
12007
|
-
|
|
12008
|
-
return Array.from({ length: 6 }, (_, w) => Array.from({ length: 7 }, (_, i) => addDays(start, w * 7 + i)));
|
|
12803
|
+
function weekDays(d, weekStartsOn, zone = "system") {
|
|
12804
|
+
const first = startOfWeek(d, weekStartsOn, zone);
|
|
12805
|
+
return Array.from({ length: 7 }, (_, i) => addDays(first, i, zone));
|
|
12009
12806
|
}
|
|
12010
|
-
|
|
12011
|
-
|
|
12012
|
-
return
|
|
12807
|
+
function monthGrid(d, weekStartsOn, zone = "system") {
|
|
12808
|
+
const start = startOfWeek(startOfMonth(d, zone), weekStartsOn, zone);
|
|
12809
|
+
return Array.from({ length: 6 }, (_, w) => Array.from({ length: 7 }, (_, i) => addDays(start, w * 7 + i, zone)));
|
|
12810
|
+
}
|
|
12811
|
+
function hourOf(d, zone = "system") {
|
|
12812
|
+
const p = zonedParts(d, zone);
|
|
12813
|
+
return p.hour + p.minute / 60;
|
|
12013
12814
|
}
|
|
12014
12815
|
const cache = /* @__PURE__ */ new Map();
|
|
12816
|
+
const runtimeLocales = /* @__PURE__ */ new WeakMap();
|
|
12817
|
+
function runtimeLocale() {
|
|
12818
|
+
let locale = runtimeLocales.get(Intl.DateTimeFormat);
|
|
12819
|
+
if (!locale) {
|
|
12820
|
+
locale = new Intl.DateTimeFormat().resolvedOptions().locale;
|
|
12821
|
+
runtimeLocales.set(Intl.DateTimeFormat, locale);
|
|
12822
|
+
}
|
|
12823
|
+
return locale;
|
|
12824
|
+
}
|
|
12015
12825
|
/** Cached Intl formatter; an omitted locale uses the runtime locale. */
|
|
12016
12826
|
const fmt = (locale, opts) => {
|
|
12017
|
-
const key = `${locale ??
|
|
12827
|
+
const key = `${locale ?? runtimeLocale()}|${JSON.stringify(opts)}`;
|
|
12018
12828
|
let f = cache.get(key);
|
|
12019
12829
|
if (!f) {
|
|
12020
12830
|
f = new Intl.DateTimeFormat(locale, opts);
|
|
@@ -12023,13 +12833,14 @@ const fmt = (locale, opts) => {
|
|
|
12023
12833
|
return f;
|
|
12024
12834
|
};
|
|
12025
12835
|
/** "9:30 AM" or "09:30". */
|
|
12026
|
-
const formatTime = (d, locale, hourCycle) => fmt(locale, {
|
|
12836
|
+
const formatTime = (d, locale, hourCycle, zone = "system") => fmt(locale, {
|
|
12837
|
+
timeZone: zone === "system" ? void 0 : zone,
|
|
12027
12838
|
hour: hourCycle === "h12" ? "numeric" : "2-digit",
|
|
12028
12839
|
minute: "2-digit",
|
|
12029
12840
|
hourCycle
|
|
12030
12841
|
}).format(d);
|
|
12031
12842
|
/** "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)}`;
|
|
12843
|
+
const formatRange = (start, end, locale, hourCycle, zone = "system") => `${formatTime(start, locale, hourCycle, zone)}–${formatTime(end, locale, hourCycle, zone)}`;
|
|
12033
12844
|
/** Compact gutter label: "9 AM" or "09:00". */
|
|
12034
12845
|
const formatHour = (hour, locale, hourCycle) => fmt(locale, {
|
|
12035
12846
|
hour: hourCycle === "h12" ? "numeric" : "2-digit",
|
|
@@ -12037,43 +12848,51 @@ const formatHour = (hour, locale, hourCycle) => fmt(locale, {
|
|
|
12037
12848
|
hourCycle
|
|
12038
12849
|
}).format(new Date(2026, 0, 1, hour));
|
|
12039
12850
|
/** "Wednesday, April 15, 2026". */
|
|
12040
|
-
const formatFullDate = (d, locale) => fmt(locale, {
|
|
12851
|
+
const formatFullDate = (d, locale, zone = "system") => fmt(locale, {
|
|
12852
|
+
timeZone: zone === "system" ? void 0 : zone,
|
|
12041
12853
|
weekday: "long",
|
|
12042
12854
|
month: "long",
|
|
12043
12855
|
day: "numeric",
|
|
12044
12856
|
year: "numeric"
|
|
12045
12857
|
}).format(d);
|
|
12046
12858
|
/** "Wednesday, April 15". */
|
|
12047
|
-
const formatDay = (d, locale) => fmt(locale, {
|
|
12859
|
+
const formatDay = (d, locale, zone = "system") => fmt(locale, {
|
|
12860
|
+
timeZone: zone === "system" ? void 0 : zone,
|
|
12048
12861
|
weekday: "long",
|
|
12049
12862
|
month: "long",
|
|
12050
12863
|
day: "numeric"
|
|
12051
12864
|
}).format(d);
|
|
12052
12865
|
/** "April 2026". */
|
|
12053
|
-
const formatMonth = (d, locale) => fmt(locale, {
|
|
12866
|
+
const formatMonth = (d, locale, zone = "system") => fmt(locale, {
|
|
12867
|
+
timeZone: zone === "system" ? void 0 : zone,
|
|
12054
12868
|
month: "long",
|
|
12055
12869
|
year: "numeric"
|
|
12056
12870
|
}).format(d);
|
|
12057
12871
|
/** "Apr 15". */
|
|
12058
|
-
const formatShort = (d, locale) => fmt(locale, {
|
|
12872
|
+
const formatShort = (d, locale, zone = "system") => fmt(locale, {
|
|
12873
|
+
timeZone: zone === "system" ? void 0 : zone,
|
|
12059
12874
|
month: "short",
|
|
12060
12875
|
day: "numeric"
|
|
12061
12876
|
}).format(d);
|
|
12062
12877
|
/** "Wed". */
|
|
12063
|
-
const formatWeekday = (d, locale, weekday = "short") => fmt(locale, {
|
|
12878
|
+
const formatWeekday = (d, locale, weekday = "short", zone = "system") => fmt(locale, {
|
|
12879
|
+
timeZone: zone === "system" ? void 0 : zone,
|
|
12880
|
+
weekday
|
|
12881
|
+
}).format(d);
|
|
12064
12882
|
/** "Apr 13 – 19, 2026" (or across months / years). */
|
|
12065
|
-
function formatWeekRange(days, locale) {
|
|
12883
|
+
function formatWeekRange(days, locale, zone = "system") {
|
|
12066
12884
|
const first = days[0];
|
|
12067
12885
|
const last = days[days.length - 1];
|
|
12068
12886
|
if (!first || !last) return "";
|
|
12069
12887
|
if (locale && !locale.toLowerCase().startsWith("en")) return fmt(locale, {
|
|
12888
|
+
timeZone: zone === "system" ? void 0 : zone,
|
|
12070
12889
|
month: "short",
|
|
12071
12890
|
day: "numeric",
|
|
12072
12891
|
year: "numeric"
|
|
12073
12892
|
}).formatRange(first, last);
|
|
12074
|
-
if (sameMonth(first, last)) return `${formatShort(first, "en-US")} – ${last.
|
|
12075
|
-
if (first.
|
|
12076
|
-
return `${formatShort(first, "en-US")}, ${first.
|
|
12893
|
+
if (sameMonth(first, last, zone)) return `${formatShort(first, "en-US", zone)} – ${zonedParts(last, zone).day}, ${zonedParts(last, zone).year}`;
|
|
12894
|
+
if (zonedParts(first, zone).year === zonedParts(last, zone).year) return `${formatShort(first, "en-US", zone)} – ${formatShort(last, "en-US", zone)}, ${zonedParts(last, zone).year}`;
|
|
12895
|
+
return `${formatShort(first, "en-US", zone)}, ${zonedParts(first, zone).year} – ${formatShort(last, "en-US", zone)}, ${zonedParts(last, zone).year}`;
|
|
12077
12896
|
}
|
|
12078
12897
|
/** Internal to blocks: Intl weekdays 1–7 become JS weekdays 0–6. */
|
|
12079
12898
|
function weekendDays(locale) {
|
|
@@ -12161,10 +12980,10 @@ const TONE = {
|
|
|
12161
12980
|
}
|
|
12162
12981
|
};
|
|
12163
12982
|
/** Events grouped by local day key, each day sorted by start. */
|
|
12164
|
-
function groupByDay(events) {
|
|
12983
|
+
function groupByDay(events, timeZone = "system") {
|
|
12165
12984
|
const map = /* @__PURE__ */ new Map();
|
|
12166
12985
|
for (const e of events) {
|
|
12167
|
-
const key = dayKey(e.start);
|
|
12986
|
+
const key = dayKey(e.start, timeZone);
|
|
12168
12987
|
const list = map.get(key);
|
|
12169
12988
|
if (list) list.push(e);
|
|
12170
12989
|
else map.set(key, [e]);
|
|
@@ -12436,51 +13255,52 @@ const sampleEvents = ROWS.map(([day, kind, title, start, hours, location], i) =>
|
|
|
12436
13255
|
* Keyboard: arrows move by day/week, Home/End to the week edges, PageUp/PageDown by month,
|
|
12437
13256
|
* Enter/Space selects.
|
|
12438
13257
|
*/
|
|
12439
|
-
function MonthCalendar({ events = sampleEvents, hourCycle: hourCycleProp, weekStartsOn: weekStartsOnProp, today = sampleToday, defaultMonth, onMonthChange, defaultSelected, onSelectDate, kinds = defaultEventKinds, maxEventsPerDay = 2, actions, className }) {
|
|
12440
|
-
const { t, locale, dir } = useI18n();
|
|
13258
|
+
function MonthCalendar({ events = sampleEvents, timeZone: timeZoneProp, hourCycle: hourCycleProp, weekStartsOn: weekStartsOnProp, today = sampleToday, defaultMonth, onMonthChange, defaultSelected, onSelectDate, kinds = defaultEventKinds, maxEventsPerDay = 2, actions, className }) {
|
|
13259
|
+
const { t, locale, dir, timeZone: providerZone } = useI18n();
|
|
13260
|
+
const timeZone = timeZoneProp ?? providerZone;
|
|
12441
13261
|
const clock = useSchedulingClock(hourCycleProp);
|
|
12442
13262
|
const weekStartsOn = weekStartsOnProp ?? localeWeekStart(clock.locale);
|
|
12443
13263
|
const titleId = useId();
|
|
12444
|
-
const [selected, setSelected] = useState(() => startOfDay(defaultSelected ?? today));
|
|
12445
|
-
const [focused, setFocused] = useState(() => startOfDay(defaultSelected ?? defaultMonth ?? today));
|
|
12446
|
-
const [month, setMonth] = useState(() => startOfMonth(defaultMonth ?? defaultSelected ?? today));
|
|
13264
|
+
const [selected, setSelected] = useState(() => startOfDay(defaultSelected ?? today, timeZone));
|
|
13265
|
+
const [focused, setFocused] = useState(() => startOfDay(defaultSelected ?? defaultMonth ?? today, timeZone));
|
|
13266
|
+
const [month, setMonth] = useState(() => startOfMonth(defaultMonth ?? defaultSelected ?? today, timeZone));
|
|
12447
13267
|
const gridRef = useRef(null);
|
|
12448
13268
|
const moveFocus = useRef(false);
|
|
12449
|
-
const byDay = useMemo(() => groupByDay(events), [events]);
|
|
12450
|
-
const weeks = monthGrid(month, weekStartsOn);
|
|
13269
|
+
const byDay = useMemo(() => groupByDay(events, timeZone), [events, timeZone]);
|
|
13270
|
+
const weeks = monthGrid(month, weekStartsOn, timeZone);
|
|
12451
13271
|
const weekend = weekendDays(clock.locale);
|
|
12452
|
-
const tabStop = sameMonth(focused, month) ? focused : sameMonth(selected, month) ? selected : month;
|
|
13272
|
+
const tabStop = sameMonth(focused, month, timeZone) ? focused : sameMonth(selected, month, timeZone) ? selected : month;
|
|
12453
13273
|
useEffect(() => {
|
|
12454
13274
|
if (!moveFocus.current) return;
|
|
12455
13275
|
moveFocus.current = false;
|
|
12456
|
-
gridRef.current?.querySelector(`[data-date="${dayKey(focused)}"]`)?.focus();
|
|
12457
|
-
}, [focused]);
|
|
13276
|
+
gridRef.current?.querySelector(`[data-date="${dayKey(focused, timeZone)}"]`)?.focus();
|
|
13277
|
+
}, [focused, timeZone]);
|
|
12458
13278
|
const showMonth = (next) => {
|
|
12459
|
-
const first = startOfMonth(next);
|
|
13279
|
+
const first = startOfMonth(next, timeZone);
|
|
12460
13280
|
setMonth(first);
|
|
12461
13281
|
onMonthChange?.(first);
|
|
12462
13282
|
};
|
|
12463
13283
|
const go = (date) => {
|
|
12464
13284
|
setFocused(date);
|
|
12465
|
-
if (!sameMonth(date, month)) showMonth(date);
|
|
13285
|
+
if (!sameMonth(date, month, timeZone)) showMonth(date);
|
|
12466
13286
|
moveFocus.current = true;
|
|
12467
13287
|
};
|
|
12468
13288
|
const select = (date) => {
|
|
12469
13289
|
setSelected(date);
|
|
12470
13290
|
setFocused(date);
|
|
12471
|
-
onSelectDate?.(date, byDay.get(dayKey(date)) ?? []);
|
|
13291
|
+
onSelectDate?.(date, byDay.get(dayKey(date, timeZone)) ?? []);
|
|
12472
13292
|
};
|
|
12473
13293
|
const onKeyDown = (event, date) => {
|
|
12474
|
-
const weekStart = startOfWeek(date, weekStartsOn);
|
|
13294
|
+
const weekStart = startOfWeek(date, weekStartsOn, timeZone);
|
|
12475
13295
|
const next = {
|
|
12476
|
-
ArrowLeft: () => addDays(date, dir === "rtl" ? 1 : -1),
|
|
12477
|
-
ArrowRight: () => addDays(date, dir === "rtl" ? -1 : 1),
|
|
12478
|
-
ArrowUp: () => addDays(date, -7),
|
|
12479
|
-
ArrowDown: () => addDays(date, 7),
|
|
13296
|
+
ArrowLeft: () => addDays(date, dir === "rtl" ? 1 : -1, timeZone),
|
|
13297
|
+
ArrowRight: () => addDays(date, dir === "rtl" ? -1 : 1, timeZone),
|
|
13298
|
+
ArrowUp: () => addDays(date, -7, timeZone),
|
|
13299
|
+
ArrowDown: () => addDays(date, 7, timeZone),
|
|
12480
13300
|
Home: () => weekStart,
|
|
12481
|
-
End: () => addDays(weekStart, 6),
|
|
12482
|
-
PageUp: () =>
|
|
12483
|
-
PageDown: () =>
|
|
13301
|
+
End: () => addDays(weekStart, 6, timeZone),
|
|
13302
|
+
PageUp: () => addDays(addMonths(date, -1, timeZone), Math.min(zonedParts(date, timeZone).day, 28) - 1, timeZone),
|
|
13303
|
+
PageDown: () => addDays(addMonths(date, 1, timeZone), Math.min(zonedParts(date, timeZone).day, 28) - 1, timeZone)
|
|
12484
13304
|
}[event.key];
|
|
12485
13305
|
if (!next) return;
|
|
12486
13306
|
event.preventDefault();
|
|
@@ -12489,15 +13309,17 @@ function MonthCalendar({ events = sampleEvents, hourCycle: hourCycleProp, weekSt
|
|
|
12489
13309
|
return /* @__PURE__ */ jsxs("div", {
|
|
12490
13310
|
className: cn("overflow-hidden rounded-xl border border-border bg-card", className),
|
|
12491
13311
|
children: [/* @__PURE__ */ jsx(CalendarHeader, {
|
|
13312
|
+
timeZone,
|
|
13313
|
+
referenceDate: month,
|
|
12492
13314
|
titleId,
|
|
12493
|
-
title: formatMonth(month, locale),
|
|
13315
|
+
title: formatMonth(month, locale, timeZone),
|
|
12494
13316
|
prevLabel: t("calendar.previousMonth"),
|
|
12495
13317
|
nextLabel: t("calendar.nextMonth"),
|
|
12496
|
-
onPrev: () => showMonth(addMonths(month, -1)),
|
|
12497
|
-
onNext: () => showMonth(addMonths(month, 1)),
|
|
13318
|
+
onPrev: () => showMonth(addMonths(month, -1, timeZone)),
|
|
13319
|
+
onNext: () => showMonth(addMonths(month, 1, timeZone)),
|
|
12498
13320
|
onToday: () => {
|
|
12499
13321
|
showMonth(today);
|
|
12500
|
-
setFocused(startOfDay(today));
|
|
13322
|
+
setFocused(startOfDay(today, timeZone));
|
|
12501
13323
|
},
|
|
12502
13324
|
actions
|
|
12503
13325
|
}), /* @__PURE__ */ jsxs("div", {
|
|
@@ -12509,40 +13331,40 @@ function MonthCalendar({ events = sampleEvents, hourCycle: hourCycleProp, weekSt
|
|
|
12509
13331
|
className: "grid grid-cols-7 border-b border-border bg-secondary/30",
|
|
12510
13332
|
children: (weeks[0] ?? []).map((day) => /* @__PURE__ */ jsx("div", {
|
|
12511
13333
|
role: "columnheader",
|
|
12512
|
-
"aria-label": formatWeekday(day, locale, "long"),
|
|
12513
|
-
className: "py-2 text-center text-[11px] font-medium tracking-wide text-muted-foreground
|
|
12514
|
-
children: formatWeekday(day, locale)
|
|
12515
|
-
}, day
|
|
13334
|
+
"aria-label": formatWeekday(day, locale, "long", timeZone),
|
|
13335
|
+
className: "py-2 text-center text-[11px] font-medium tracking-wide text-muted-foreground label-case",
|
|
13336
|
+
children: formatWeekday(day, locale, "short", timeZone)
|
|
13337
|
+
}, weekday(day, timeZone)))
|
|
12516
13338
|
}), weeks.map((week) => /* @__PURE__ */ jsx("div", {
|
|
12517
13339
|
role: "row",
|
|
12518
13340
|
className: "grid grid-cols-7",
|
|
12519
13341
|
children: week.map((date) => {
|
|
12520
|
-
const key = dayKey(date);
|
|
13342
|
+
const key = dayKey(date, timeZone);
|
|
12521
13343
|
const list = byDay.get(key) ?? [];
|
|
12522
|
-
const inMonth = sameMonth(date, month);
|
|
12523
|
-
const isToday = sameDay(date, today);
|
|
12524
|
-
const isSelected = sameDay(date, selected);
|
|
13344
|
+
const inMonth = sameMonth(date, month, timeZone);
|
|
13345
|
+
const isToday = sameDay(date, today, timeZone);
|
|
13346
|
+
const isSelected = sameDay(date, selected, timeZone);
|
|
12525
13347
|
const extra = list.length - maxEventsPerDay;
|
|
12526
13348
|
return /* @__PURE__ */ jsx("div", {
|
|
12527
13349
|
role: "gridcell",
|
|
12528
|
-
"data-weekend": weekend.includes(date
|
|
13350
|
+
"data-weekend": weekend.includes(weekday(date, timeZone)) ? "" : void 0,
|
|
12529
13351
|
"aria-selected": isSelected,
|
|
12530
13352
|
className: "min-w-0 border-e border-b border-border/70 [&:nth-child(7)]:border-e-0",
|
|
12531
13353
|
children: /* @__PURE__ */ jsxs("button", {
|
|
12532
13354
|
type: "button",
|
|
12533
13355
|
"data-date": key,
|
|
12534
|
-
tabIndex: sameDay(date, tabStop) ? 0 : -1,
|
|
12535
|
-
"aria-label": `${formatFullDate(date, locale)}${list.length ? `, ${t("calendar.events", { count: list.length })}` : ""}`,
|
|
13356
|
+
tabIndex: sameDay(date, tabStop, timeZone) ? 0 : -1,
|
|
13357
|
+
"aria-label": `${formatFullDate(date, locale, timeZone)}${list.length ? `, ${t("calendar.events", { count: list.length })}` : ""}`,
|
|
12536
13358
|
"aria-current": isToday ? "date" : void 0,
|
|
12537
13359
|
onClick: () => select(date),
|
|
12538
13360
|
onKeyDown: (e) => onKeyDown(e, date),
|
|
12539
|
-
className: cn("flex h-full min-h-14 w-full flex-col items-stretch p-1.5 text-start transition-colors motion-reduce:transition-none sm:min-h-[92px] sm:p-2", "hover:bg-accent/30 focus-
|
|
13361
|
+
className: cn("flex h-full min-h-14 w-full flex-col items-stretch p-1.5 text-start transition-colors motion-reduce:transition-none sm:min-h-[92px] sm:p-2", "hover:bg-accent/30 focus-ring-inset", inMonth ? "bg-card" : "bg-secondary/20"),
|
|
12540
13362
|
children: [
|
|
12541
13363
|
/* @__PURE__ */ jsxs("span", {
|
|
12542
13364
|
className: "flex items-center justify-between",
|
|
12543
13365
|
children: [/* @__PURE__ */ jsx("span", {
|
|
12544
13366
|
className: cn("inline-flex size-6 items-center justify-center rounded-full text-[12px] font-medium tabular-nums", isToday ? "bg-primary font-semibold text-primary-foreground" : isSelected ? "bg-secondary text-foreground ring-1 ring-border" : inMonth ? "text-foreground" : "text-muted-foreground"),
|
|
12545
|
-
children: date.
|
|
13367
|
+
children: zonedParts(date, timeZone).day
|
|
12546
13368
|
}), isSelected && !isToday && /* @__PURE__ */ jsx("span", {
|
|
12547
13369
|
"aria-hidden": true,
|
|
12548
13370
|
className: "size-1.5 rounded-full bg-primary"
|
|
@@ -12566,7 +13388,7 @@ function MonthCalendar({ events = sampleEvents, hourCycle: hourCycleProp, weekSt
|
|
|
12566
13388
|
}),
|
|
12567
13389
|
/* @__PURE__ */ jsx("span", {
|
|
12568
13390
|
className: "ms-auto hidden shrink-0 font-mono text-[10px] text-muted-foreground xl:block",
|
|
12569
|
-
children: formatTime(e.start, clock.locale, clock.hourCycle)
|
|
13391
|
+
children: formatTime(e.start, clock.locale, clock.hourCycle, timeZone)
|
|
12570
13392
|
})
|
|
12571
13393
|
]
|
|
12572
13394
|
}, e.id)), extra > 0 && /* @__PURE__ */ jsxs("span", {
|
|
@@ -12578,24 +13400,24 @@ function MonthCalendar({ events = sampleEvents, hourCycle: hourCycleProp, weekSt
|
|
|
12578
13400
|
})
|
|
12579
13401
|
}, key);
|
|
12580
13402
|
})
|
|
12581
|
-
}, dayKey(week[0] ?? month)))]
|
|
13403
|
+
}, dayKey(week[0] ?? month, timeZone)))]
|
|
12582
13404
|
})]
|
|
12583
13405
|
});
|
|
12584
13406
|
}
|
|
12585
13407
|
//#endregion
|
|
12586
13408
|
//#region src/scheduling/MonthCalendar/block.meta.ts
|
|
12587
|
-
const meta$
|
|
13409
|
+
const meta$44 = {
|
|
12588
13410
|
name: "Month calendar",
|
|
12589
13411
|
family: "scheduling",
|
|
12590
13412
|
status: "beta",
|
|
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.",
|
|
13413
|
+
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. timeZone defaults to I18nProvider (system when unset); TimeZone examples demonstrate UTC, an explicit New York override and a Spanish Madrid provider. Use the same zone on server and client. Locale examples show en-US, es-ES, then en-US with Monday-first and 24-hour overrides.",
|
|
12592
13414
|
uses: ["Button", "IconButton"]
|
|
12593
13415
|
};
|
|
12594
13416
|
//#endregion
|
|
12595
13417
|
//#region src/scheduling/WeekCalendar/WeekCalendar.tsx
|
|
12596
13418
|
const HOURS = Array.from({ length: 24 }, (_, h) => h);
|
|
12597
13419
|
/** Side-by-side lanes for overlapping events within one day. */
|
|
12598
|
-
function layoutDay(list, hourHeight) {
|
|
13420
|
+
function layoutDay(list, hourHeight, timeZone) {
|
|
12599
13421
|
const placed = [];
|
|
12600
13422
|
let cluster = [];
|
|
12601
13423
|
let clusterEnd = -1;
|
|
@@ -12606,8 +13428,8 @@ function layoutDay(list, hourHeight) {
|
|
|
12606
13428
|
laneEnds = [];
|
|
12607
13429
|
};
|
|
12608
13430
|
for (const event of list) {
|
|
12609
|
-
const start = hourOf(event.start);
|
|
12610
|
-
const end = Math.max(sameDay(event.start, event.end) ? hourOf(event.end) : 24, start + .25);
|
|
13431
|
+
const start = hourOf(event.start, timeZone);
|
|
13432
|
+
const end = Math.max(sameDay(event.start, event.end, timeZone) ? hourOf(event.end, timeZone) : 24, start + .25);
|
|
12611
13433
|
if (start >= clusterEnd) close();
|
|
12612
13434
|
let lane = laneEnds.findIndex((e) => e <= start);
|
|
12613
13435
|
if (lane === -1) {
|
|
@@ -12629,19 +13451,20 @@ function layoutDay(list, hourHeight) {
|
|
|
12629
13451
|
return placed;
|
|
12630
13452
|
}
|
|
12631
13453
|
/** Week view: seven day columns over a scrolling 24-hour time grid, with a "now" line. */
|
|
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 }) {
|
|
12633
|
-
const { t, locale } = useI18n();
|
|
13454
|
+
function WeekCalendar({ events = sampleEvents, timeZone: timeZoneProp, weekStartsOn: weekStartsOnProp, hourCycle: hourCycleProp, today = sampleToday, now, defaultWeek, onWeekChange, onEventClick, kinds = defaultEventKinds, scrollToHour = 7, hourHeight = 52, height = 480, actions, className }) {
|
|
13455
|
+
const { t, locale, timeZone: providerZone } = useI18n();
|
|
13456
|
+
const timeZone = timeZoneProp ?? providerZone;
|
|
12634
13457
|
const clock = useSchedulingClock(hourCycleProp);
|
|
12635
13458
|
const weekStartsOn = weekStartsOnProp ?? localeWeekStart(clock.locale);
|
|
12636
13459
|
const titleId = useId();
|
|
12637
|
-
const [weekStart, setWeekStart] = useState(() => startOfWeek(defaultWeek ?? today, weekStartsOn));
|
|
13460
|
+
const [weekStart, setWeekStart] = useState(() => startOfWeek(defaultWeek ?? today, weekStartsOn, timeZone));
|
|
12638
13461
|
const scrollRef = useRef(null);
|
|
12639
|
-
const byDay = useMemo(() => groupByDay(events), [events]);
|
|
12640
|
-
const days = weekDays(weekStart, weekStartsOn);
|
|
13462
|
+
const byDay = useMemo(() => groupByDay(events, timeZone), [events, timeZone]);
|
|
13463
|
+
const days = weekDays(weekStart, weekStartsOn, timeZone);
|
|
12641
13464
|
const visibleStart = days[0] ?? weekStart;
|
|
12642
13465
|
const weekend = weekendDays(clock.locale);
|
|
12643
13466
|
const nowAt = now ?? today;
|
|
12644
|
-
const nowVisible = days.some((d) => sameDay(d, nowAt));
|
|
13467
|
+
const nowVisible = days.some((d) => sameDay(d, nowAt, timeZone));
|
|
12645
13468
|
useEffect(() => {
|
|
12646
13469
|
if (scrollRef.current) scrollRef.current.scrollTop = Math.max(scrollToHour * hourHeight - 8, 0);
|
|
12647
13470
|
}, [scrollToHour, hourHeight]);
|
|
@@ -12652,13 +13475,15 @@ function WeekCalendar({ events = sampleEvents, weekStartsOn: weekStartsOnProp, h
|
|
|
12652
13475
|
return /* @__PURE__ */ jsxs("div", {
|
|
12653
13476
|
className: cn("overflow-hidden rounded-xl border border-border bg-card", className),
|
|
12654
13477
|
children: [/* @__PURE__ */ jsx(CalendarHeader, {
|
|
13478
|
+
timeZone,
|
|
13479
|
+
referenceDate: visibleStart,
|
|
12655
13480
|
titleId,
|
|
12656
|
-
title: formatWeekRange(days, locale),
|
|
13481
|
+
title: formatWeekRange(days, locale, timeZone),
|
|
12657
13482
|
prevLabel: t("calendar.previousWeek"),
|
|
12658
13483
|
nextLabel: t("calendar.nextWeek"),
|
|
12659
|
-
onPrev: () => show(addDays(visibleStart, -7)),
|
|
12660
|
-
onNext: () => show(addDays(visibleStart, 7)),
|
|
12661
|
-
onToday: () => show(startOfWeek(today, weekStartsOn)),
|
|
13484
|
+
onPrev: () => show(addDays(visibleStart, -7, timeZone)),
|
|
13485
|
+
onNext: () => show(addDays(visibleStart, 7, timeZone)),
|
|
13486
|
+
onToday: () => show(startOfWeek(today, weekStartsOn, timeZone)),
|
|
12662
13487
|
actions
|
|
12663
13488
|
}), /* @__PURE__ */ jsx("div", {
|
|
12664
13489
|
className: "overflow-x-auto",
|
|
@@ -12670,25 +13495,25 @@ function WeekCalendar({ events = sampleEvents, weekStartsOn: weekStartsOnProp, h
|
|
|
12670
13495
|
children: [/* @__PURE__ */ jsx("div", { className: "w-14 shrink-0 border-e border-border/70" }), /* @__PURE__ */ jsx("div", {
|
|
12671
13496
|
className: "grid flex-1 grid-cols-7",
|
|
12672
13497
|
children: days.map((d) => {
|
|
12673
|
-
const isToday = sameDay(d, today);
|
|
13498
|
+
const isToday = sameDay(d, today, timeZone);
|
|
12674
13499
|
return /* @__PURE__ */ jsxs("div", {
|
|
12675
13500
|
className: "flex flex-col items-center justify-center border-s border-border/70 py-2 first:border-s-0",
|
|
12676
13501
|
children: [/* @__PURE__ */ jsx("span", {
|
|
12677
13502
|
className: "text-[11px] text-muted-foreground",
|
|
12678
|
-
children: formatWeekday(d, locale)
|
|
13503
|
+
children: formatWeekday(d, locale, "short", timeZone)
|
|
12679
13504
|
}), /* @__PURE__ */ jsx("span", {
|
|
12680
13505
|
className: cn("mt-1 inline-flex size-7 items-center justify-center rounded-full text-[13px] tabular-nums", isToday ? "bg-primary font-semibold text-primary-foreground" : "font-medium text-foreground"),
|
|
12681
|
-
children: d.
|
|
13506
|
+
children: zonedParts(d, timeZone).day
|
|
12682
13507
|
})]
|
|
12683
|
-
}, dayKey(d));
|
|
13508
|
+
}, dayKey(d, timeZone));
|
|
12684
13509
|
})
|
|
12685
13510
|
})]
|
|
12686
13511
|
}), /* @__PURE__ */ jsx("div", {
|
|
12687
13512
|
ref: scrollRef,
|
|
12688
13513
|
tabIndex: 0,
|
|
12689
13514
|
role: "region",
|
|
12690
|
-
"aria-labelledby": titleId
|
|
12691
|
-
className: "overflow-y-auto focus-
|
|
13515
|
+
"aria-labelledby": timeZone === "system" ? titleId : `${titleId} ${titleId}-zone`,
|
|
13516
|
+
className: "overflow-y-auto focus-ring-inset",
|
|
12692
13517
|
style: { maxHeight: height },
|
|
12693
13518
|
children: /* @__PURE__ */ jsxs("div", {
|
|
12694
13519
|
className: "relative flex",
|
|
@@ -12715,21 +13540,21 @@ function WeekCalendar({ events = sampleEvents, weekStartsOn: weekStartsOnProp, h
|
|
|
12715
13540
|
/* @__PURE__ */ jsx("div", {
|
|
12716
13541
|
className: "relative grid h-full grid-cols-7",
|
|
12717
13542
|
children: days.map((d) => {
|
|
12718
|
-
const list = byDay.get(dayKey(d)) ?? [];
|
|
13543
|
+
const list = byDay.get(dayKey(d, timeZone)) ?? [];
|
|
12719
13544
|
return /* @__PURE__ */ jsx("ul", {
|
|
12720
|
-
"data-weekend": weekend.includes(d
|
|
12721
|
-
"aria-label": formatDay(d, locale),
|
|
13545
|
+
"data-weekend": weekend.includes(weekday(d, timeZone)) ? "" : void 0,
|
|
13546
|
+
"aria-label": formatDay(d, locale, timeZone),
|
|
12722
13547
|
className: "relative border-s border-border/70 first:border-s-0",
|
|
12723
|
-
children: layoutDay(list, hourHeight).map(({ event, top, height: h, lane, lanes }) => {
|
|
13548
|
+
children: layoutDay(list, hourHeight, timeZone).map(({ event, top, height: h, lane, lanes }) => {
|
|
12724
13549
|
const kind = kindOf(event, kinds);
|
|
12725
13550
|
const tone = TONE[kind.tone];
|
|
12726
|
-
const range = formatRange(event.start, event.end, clock.locale, clock.hourCycle);
|
|
13551
|
+
const range = formatRange(event.start, event.end, clock.locale, clock.hourCycle, timeZone);
|
|
12727
13552
|
const body = /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
|
|
12728
13553
|
className: "block truncate text-[11px] leading-tight font-semibold text-foreground",
|
|
12729
13554
|
children: event.title
|
|
12730
13555
|
}), /* @__PURE__ */ jsx("span", {
|
|
12731
13556
|
className: "block truncate font-mono text-[10px] text-foreground",
|
|
12732
|
-
children: formatTime(event.start, clock.locale, clock.hourCycle)
|
|
13557
|
+
children: formatTime(event.start, clock.locale, clock.hourCycle, timeZone)
|
|
12733
13558
|
})] });
|
|
12734
13559
|
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);
|
|
12735
13560
|
return /* @__PURE__ */ jsx("li", {
|
|
@@ -12756,13 +13581,13 @@ function WeekCalendar({ events = sampleEvents, weekStartsOn: weekStartsOnProp, h
|
|
|
12756
13581
|
})
|
|
12757
13582
|
}, event.id);
|
|
12758
13583
|
})
|
|
12759
|
-
}, dayKey(d));
|
|
13584
|
+
}, dayKey(d, timeZone));
|
|
12760
13585
|
})
|
|
12761
13586
|
}),
|
|
12762
13587
|
nowVisible && /* @__PURE__ */ jsxs("div", {
|
|
12763
13588
|
"aria-hidden": true,
|
|
12764
|
-
className: "pointer-events-none absolute inset-x-0 z-
|
|
12765
|
-
style: { top: hourOf(nowAt) * hourHeight },
|
|
13589
|
+
className: "pointer-events-none absolute inset-x-0 z-raised flex items-center",
|
|
13590
|
+
style: { top: hourOf(nowAt, timeZone) * hourHeight },
|
|
12766
13591
|
children: [
|
|
12767
13592
|
/* @__PURE__ */ jsx("span", { className: "-ms-1 size-2 shrink-0 rounded-full bg-primary" }),
|
|
12768
13593
|
/* @__PURE__ */ jsx("span", { className: "h-px flex-1 bg-primary" }),
|
|
@@ -12782,11 +13607,11 @@ function WeekCalendar({ events = sampleEvents, weekStartsOn: weekStartsOnProp, h
|
|
|
12782
13607
|
}
|
|
12783
13608
|
//#endregion
|
|
12784
13609
|
//#region src/scheduling/WeekCalendar/block.meta.ts
|
|
12785
|
-
const meta$
|
|
13610
|
+
const meta$78 = {
|
|
12786
13611
|
name: "Week calendar",
|
|
12787
13612
|
family: "scheduling",
|
|
12788
13613
|
status: "beta",
|
|
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.",
|
|
13614
|
+
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. timeZone defaults to I18nProvider (system when unset); TimeZone examples demonstrate UTC, an explicit New York override and a Spanish Madrid provider. Use the same zone on server and client. Locale examples show en-US, es-ES, then en-US with Monday-first and 24-hour overrides.",
|
|
12790
13615
|
uses: ["Button", "IconButton"]
|
|
12791
13616
|
};
|
|
12792
13617
|
//#endregion
|
|
@@ -12804,8 +13629,9 @@ function EventTile({ kind, className }) {
|
|
|
12804
13629
|
//#endregion
|
|
12805
13630
|
//#region src/scheduling/AgendaList/AgendaList.tsx
|
|
12806
13631
|
/** Upcoming scheduled work grouped by day, each row with a kind tile, time range and location. */
|
|
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 }) {
|
|
12808
|
-
const { t, locale } = useI18n();
|
|
13632
|
+
function AgendaList({ events = sampleEvents, timeZone: timeZoneProp, hourCycle: hourCycleProp, today = sampleToday, from, days = 7, onEventClick, kinds = defaultEventKinds, title: titleProp, maxHeight, emptyTitle: emptyTitleProp, emptyDescription: emptyDescriptionProp, titleAs: TitleTag = "h3", className }) {
|
|
13633
|
+
const { t, locale, timeZone: providerZone } = useI18n();
|
|
13634
|
+
const timeZone = timeZoneProp ?? providerZone;
|
|
12809
13635
|
const clock = useSchedulingClock(hourCycleProp);
|
|
12810
13636
|
const title = titleProp ?? t("calendar.agenda");
|
|
12811
13637
|
const emptyTitle = emptyTitleProp ?? t("calendar.emptyTitle");
|
|
@@ -12814,27 +13640,40 @@ function AgendaList({ events = sampleEvents, hourCycle: hourCycleProp, today = s
|
|
|
12814
13640
|
const uid = useId();
|
|
12815
13641
|
const start = from === void 0 ? today : from;
|
|
12816
13642
|
const groups = useMemo(() => {
|
|
12817
|
-
const first = start ? dayKey(start) : null;
|
|
12818
|
-
const last = start && days != null ? dayKey(addDays(start, days - 1)) : null;
|
|
12819
|
-
return [...groupByDay(events).entries()].filter(([key]) => (first == null || key >= first) && (last == null || key <= last)).sort(([a], [b]) => a.localeCompare(b));
|
|
13643
|
+
const first = start ? dayKey(start, timeZone) : null;
|
|
13644
|
+
const last = start && days != null ? dayKey(addDays(start, days - 1, timeZone), timeZone) : null;
|
|
13645
|
+
return [...groupByDay(events, timeZone).entries()].filter(([key]) => (first == null || key >= first) && (last == null || key <= last)).sort(([a], [b]) => a.localeCompare(b));
|
|
12820
13646
|
}, [
|
|
12821
13647
|
events,
|
|
12822
13648
|
start,
|
|
12823
|
-
days
|
|
13649
|
+
days,
|
|
13650
|
+
timeZone
|
|
12824
13651
|
]);
|
|
12825
13652
|
const dayLabel = (d) => {
|
|
12826
|
-
if (sameDay(d, today)) return `${t("calendar.today")} · ${formatDay(d, locale)}`;
|
|
12827
|
-
if (sameDay(d, addDays(today, 1))) return `${t("calendar.tomorrow")} · ${formatDay(d, locale)}`;
|
|
12828
|
-
return formatDay(d, locale);
|
|
13653
|
+
if (sameDay(d, today, timeZone)) return `${t("calendar.today")} · ${formatDay(d, locale, timeZone)}`;
|
|
13654
|
+
if (sameDay(d, addDays(today, 1, timeZone), timeZone)) return `${t("calendar.tomorrow")} · ${formatDay(d, locale, timeZone)}`;
|
|
13655
|
+
return formatDay(d, locale, timeZone);
|
|
12829
13656
|
};
|
|
12830
13657
|
return /* @__PURE__ */ jsxs("section", {
|
|
12831
|
-
"aria-label": title,
|
|
13658
|
+
"aria-label": timeZone === "system" ? title : void 0,
|
|
13659
|
+
"aria-labelledby": timeZone === "system" ? void 0 : `${uid}-title ${uid}-zone`,
|
|
12832
13660
|
className: cn("overflow-hidden rounded-xl border border-border bg-card", className),
|
|
12833
13661
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
12834
|
-
className: "flex items-center justify-between gap-3 border-b border-border px-4 py-3 sm:px-5",
|
|
12835
|
-
children: [/* @__PURE__ */ jsx(TitleTag, {
|
|
13662
|
+
className: cn("flex items-center justify-between gap-3 border-b border-border px-4 py-3 sm:px-5", timeZone !== "system" && "flex-wrap"),
|
|
13663
|
+
children: [timeZone === "system" ? /* @__PURE__ */ jsx(TitleTag, {
|
|
12836
13664
|
className: "text-[15px] font-semibold tracking-tight text-foreground",
|
|
12837
13665
|
children: title
|
|
13666
|
+
}) : /* @__PURE__ */ jsxs("div", {
|
|
13667
|
+
className: "min-w-0",
|
|
13668
|
+
children: [/* @__PURE__ */ jsx(TitleTag, {
|
|
13669
|
+
id: `${uid}-title`,
|
|
13670
|
+
className: "text-[15px] font-semibold tracking-tight text-foreground",
|
|
13671
|
+
children: title
|
|
13672
|
+
}), /* @__PURE__ */ jsx(TimeZoneLabel, {
|
|
13673
|
+
id: `${uid}-zone`,
|
|
13674
|
+
timeZone,
|
|
13675
|
+
referenceDate: start ?? today
|
|
13676
|
+
})]
|
|
12838
13677
|
}), /* @__PURE__ */ jsxs("span", {
|
|
12839
13678
|
className: "font-mono text-[11px] text-muted-foreground",
|
|
12840
13679
|
children: [groups.reduce((n, [, list]) => n + list.length, 0), " scheduled"]
|
|
@@ -12850,21 +13689,21 @@ function AgendaList({ events = sampleEvents, hourCycle: hourCycleProp, today = s
|
|
|
12850
13689
|
tabIndex: maxHeight ? 0 : void 0,
|
|
12851
13690
|
role: maxHeight ? "region" : void 0,
|
|
12852
13691
|
"aria-label": maxHeight ? `${title} list` : void 0,
|
|
12853
|
-
className: "overflow-y-auto focus-
|
|
13692
|
+
className: "overflow-y-auto focus-ring-inset",
|
|
12854
13693
|
children: groups.map(([key, list]) => {
|
|
12855
13694
|
const first = list[0];
|
|
12856
13695
|
if (!first) return null;
|
|
12857
13696
|
const headingId = `${uid}-${key}`;
|
|
12858
13697
|
return /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(SubTag, {
|
|
12859
13698
|
id: headingId,
|
|
12860
|
-
className: "border-b border-border bg-secondary/30 px-4 py-2 font-mono text-[11px] tracking-wide text-muted-foreground
|
|
13699
|
+
className: "border-b border-border bg-secondary/30 px-4 py-2 font-mono text-[11px] tracking-wide text-muted-foreground label-case sm:px-5",
|
|
12861
13700
|
children: dayLabel(first.start)
|
|
12862
13701
|
}), /* @__PURE__ */ jsx("ul", {
|
|
12863
13702
|
"aria-labelledby": headingId,
|
|
12864
13703
|
className: "divide-y divide-border border-b border-border last:border-b-0",
|
|
12865
13704
|
children: list.map((event) => {
|
|
12866
13705
|
const kind = kindOf(event, kinds);
|
|
12867
|
-
const range = formatRange(event.start, event.end, clock.locale, clock.hourCycle);
|
|
13706
|
+
const range = formatRange(event.start, event.end, clock.locale, clock.hourCycle, timeZone);
|
|
12868
13707
|
const content = /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
12869
13708
|
/* @__PURE__ */ jsx(EventTile, { kind }),
|
|
12870
13709
|
/* @__PURE__ */ jsxs("span", {
|
|
@@ -12902,7 +13741,7 @@ function AgendaList({ events = sampleEvents, hourCycle: hourCycleProp, today = s
|
|
|
12902
13741
|
return /* @__PURE__ */ jsx("li", { children: onEventClick ? /* @__PURE__ */ jsxs("button", {
|
|
12903
13742
|
type: "button",
|
|
12904
13743
|
onClick: () => onEventClick(event),
|
|
12905
|
-
className: cn(row, "group transition-colors hover:bg-accent/30 focus-
|
|
13744
|
+
className: cn(row, "group transition-colors hover:bg-accent/30 focus-ring-inset motion-reduce:transition-none"),
|
|
12906
13745
|
children: [content, /* @__PURE__ */ jsx(ChevronRight, {
|
|
12907
13746
|
size: 16,
|
|
12908
13747
|
"aria-hidden": true,
|
|
@@ -12924,7 +13763,7 @@ const meta$1 = {
|
|
|
12924
13763
|
name: "Agenda list",
|
|
12925
13764
|
family: "scheduling",
|
|
12926
13765
|
status: "beta",
|
|
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.",
|
|
13766
|
+
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. timeZone defaults to I18nProvider (system when unset); TimeZone examples demonstrate UTC, an explicit New York override and a Spanish Madrid provider. Use the same zone on server and client. Locale examples show en-US, es-ES, then en-US with the 24-hour override.",
|
|
12928
13767
|
uses: ["Badge", "EmptyState"]
|
|
12929
13768
|
};
|
|
12930
13769
|
//#endregion
|
|
@@ -13015,7 +13854,7 @@ function TimeSlotPicker({ slots = sampleTimeSlots, value, defaultValue = null, o
|
|
|
13015
13854
|
}
|
|
13016
13855
|
//#endregion
|
|
13017
13856
|
//#region src/scheduling/TimeSlotPicker/block.meta.ts
|
|
13018
|
-
const meta$
|
|
13857
|
+
const meta$73 = {
|
|
13019
13858
|
name: "Time slot picker",
|
|
13020
13859
|
family: "scheduling",
|
|
13021
13860
|
status: "beta",
|
|
@@ -13111,20 +13950,27 @@ const appSidebarUser = {
|
|
|
13111
13950
|
//#endregion
|
|
13112
13951
|
//#region src/shell/AppSidebar/AppSidebar.tsx
|
|
13113
13952
|
/** Sidebar top: workspace switcher (or the brand logo), the brand mark alone in the icon rail. */
|
|
13114
|
-
function AppSidebarHeader({ collapsed = false, workspaces = appSidebarWorkspaces, currentWorkspaceId, onWorkspaceChange, onCreateWorkspace, className }) {
|
|
13953
|
+
function AppSidebarHeader({ collapsed = false, workspaces = appSidebarWorkspaces, currentWorkspaceId, onWorkspaceChange, onCreateWorkspace, tenants, currentTenantId, onTenantSelect, tenantLabel = "Tenant", tenantEmptyText = "No tenants", workspaceLabel, workspaceEmptyText, hideWorkspaceContext, contextRegionLabel, contextBusy, contextStatus, brand, className }) {
|
|
13115
13954
|
const [current, setCurrent] = useState(currentWorkspaceId ?? workspaces?.[0]?.id ?? "");
|
|
13116
13955
|
const currentId = currentWorkspaceId ?? current;
|
|
13117
|
-
if (collapsed) return /* @__PURE__ */ jsx(Logo, {
|
|
13956
|
+
if (collapsed) return brand ?? /* @__PURE__ */ jsx(Logo, {
|
|
13118
13957
|
size: 26,
|
|
13119
13958
|
className
|
|
13120
13959
|
});
|
|
13121
|
-
if (
|
|
13960
|
+
if (hideWorkspaceContext) return brand ?? /* @__PURE__ */ jsx(Logo, {
|
|
13122
13961
|
size: 24,
|
|
13123
13962
|
wordmark: true,
|
|
13124
13963
|
className: cn("px-1", className)
|
|
13125
13964
|
});
|
|
13126
|
-
|
|
13127
|
-
|
|
13965
|
+
const stackParent = "[:has(>_&)]:flex-col [:has(>_&)]:items-stretch [:has(>_&)]:gap-2";
|
|
13966
|
+
const workspaceControl = !workspaces || workspaces.length === 0 ? brand == null && /* @__PURE__ */ jsx(Logo, {
|
|
13967
|
+
size: 24,
|
|
13968
|
+
wordmark: true,
|
|
13969
|
+
className: cn("px-1", contextStatus != null && stackParent, className)
|
|
13970
|
+
}) : /* @__PURE__ */ jsx(WorkspaceSwitcher, {
|
|
13971
|
+
label: workspaceLabel,
|
|
13972
|
+
emptyText: workspaceEmptyText,
|
|
13973
|
+
className: cn("w-full", (brand != null || contextStatus != null) && stackParent, className),
|
|
13128
13974
|
workspaces,
|
|
13129
13975
|
currentId,
|
|
13130
13976
|
onCreate: onCreateWorkspace,
|
|
@@ -13133,6 +13979,29 @@ function AppSidebarHeader({ collapsed = false, workspaces = appSidebarWorkspaces
|
|
|
13133
13979
|
onWorkspaceChange?.(w);
|
|
13134
13980
|
}
|
|
13135
13981
|
});
|
|
13982
|
+
if (!tenants && brand == null && !contextRegionLabel && contextStatus == null) return workspaceControl;
|
|
13983
|
+
const controls = /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
13984
|
+
tenants && /* @__PURE__ */ jsx(SimpleSelect, {
|
|
13985
|
+
items: tenants.map(({ id, name }) => ({
|
|
13986
|
+
value: id,
|
|
13987
|
+
label: name
|
|
13988
|
+
})),
|
|
13989
|
+
value: currentTenantId,
|
|
13990
|
+
onValueChange: (id) => onTenantSelect?.(id),
|
|
13991
|
+
"aria-label": tenantLabel,
|
|
13992
|
+
placeholder: tenants.length === 0 ? tenantEmptyText : "Select tenant",
|
|
13993
|
+
clearable: true,
|
|
13994
|
+
className: "w-full [&+button]:min-h-6 [&+button]:min-w-6 [:has(>_*_>_&)]:flex-col [:has(>_*_>_&)]:items-stretch [:has(>_*_>_&)]:gap-2"
|
|
13995
|
+
}),
|
|
13996
|
+
workspaceControl,
|
|
13997
|
+
contextStatus
|
|
13998
|
+
] });
|
|
13999
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [brand, contextRegionLabel ? /* @__PURE__ */ jsx("section", {
|
|
14000
|
+
"aria-label": contextRegionLabel,
|
|
14001
|
+
"aria-busy": contextBusy,
|
|
14002
|
+
className: cn("flex w-full min-w-0 flex-col gap-2", brand != null && stackParent),
|
|
14003
|
+
children: controls
|
|
14004
|
+
}) : controls] });
|
|
13136
14005
|
}
|
|
13137
14006
|
/** Sidebar body: the NavList (icon rail with tooltips when collapsed). */
|
|
13138
14007
|
function AppSidebarNav({ groups = appSidebarNavGroups, currentHref = "/projects", collapsed = false, label = "Main", onNavigate, className }) {
|
|
@@ -13146,7 +14015,7 @@ function AppSidebarNav({ groups = appSidebarNavGroups, currentHref = "/projects"
|
|
|
13146
14015
|
});
|
|
13147
14016
|
}
|
|
13148
14017
|
/** Sidebar bottom: usage meter, help link and the user menu (avatar only in the icon rail). */
|
|
13149
|
-
function AppSidebarFooter({ collapsed = false, usage = appSidebarUsage, helpHref = "#help", helpLabel = "Help & docs", user = appSidebarUser, userMenuItems, onSignOut, className }) {
|
|
14018
|
+
function AppSidebarFooter({ collapsed = false, usage = appSidebarUsage, helpHref = "#help", helpLabel = "Help & docs", user = appSidebarUser, userMenuItems, userMenuChildren, onSignOut, className }) {
|
|
13150
14019
|
return /* @__PURE__ */ jsxs("div", {
|
|
13151
14020
|
className: cn("flex flex-col gap-1.5", collapsed && "items-center", className),
|
|
13152
14021
|
children: [
|
|
@@ -13177,7 +14046,8 @@ function AppSidebarFooter({ collapsed = false, usage = appSidebarUsage, helpHref
|
|
|
13177
14046
|
items: userMenuItems,
|
|
13178
14047
|
onSignOut,
|
|
13179
14048
|
showName: !collapsed,
|
|
13180
|
-
className: collapsed ? void 0 : "w-full justify-start"
|
|
14049
|
+
className: collapsed ? void 0 : "w-full justify-start",
|
|
14050
|
+
children: userMenuChildren
|
|
13181
14051
|
})
|
|
13182
14052
|
]
|
|
13183
14053
|
});
|
|
@@ -13187,7 +14057,7 @@ function AppSidebarFooter({ collapsed = false, usage = appSidebarUsage, helpHref
|
|
|
13187
14057
|
* and a footer with usage, help and the user menu. Inside SidebarLayout, use the parts
|
|
13188
14058
|
* (AppSidebarHeader / AppSidebarNav / AppSidebarFooter) in its three slots.
|
|
13189
14059
|
*/
|
|
13190
|
-
function AppSidebar({ collapsed = false,
|
|
14060
|
+
function AppSidebar({ collapsed = false, navGroups, navLabel, currentHref, onNavigate, usage, helpHref, helpLabel, user, userMenuItems, userMenuChildren, onSignOut, className, ...headerProps }) {
|
|
13191
14061
|
return /* @__PURE__ */ jsxs("div", {
|
|
13192
14062
|
className: cn("flex h-full min-h-0 flex-col bg-chrome", collapsed ? "w-16" : "w-[248px]", className),
|
|
13193
14063
|
children: [
|
|
@@ -13195,10 +14065,7 @@ function AppSidebar({ collapsed = false, workspaces, currentWorkspaceId, onWorks
|
|
|
13195
14065
|
className: cn("flex shrink-0 items-center pt-4 pb-3", collapsed ? "justify-center px-2" : "px-3"),
|
|
13196
14066
|
children: /* @__PURE__ */ jsx(AppSidebarHeader, {
|
|
13197
14067
|
collapsed,
|
|
13198
|
-
|
|
13199
|
-
currentWorkspaceId,
|
|
13200
|
-
onWorkspaceChange,
|
|
13201
|
-
onCreateWorkspace
|
|
14068
|
+
...headerProps
|
|
13202
14069
|
})
|
|
13203
14070
|
}),
|
|
13204
14071
|
/* @__PURE__ */ jsx("div", {
|
|
@@ -13220,6 +14087,7 @@ function AppSidebar({ collapsed = false, workspaces, currentWorkspaceId, onWorks
|
|
|
13220
14087
|
helpLabel,
|
|
13221
14088
|
user,
|
|
13222
14089
|
userMenuItems,
|
|
14090
|
+
userMenuChildren,
|
|
13223
14091
|
onSignOut
|
|
13224
14092
|
})
|
|
13225
14093
|
})
|
|
@@ -13234,6 +14102,7 @@ const meta$2 = {
|
|
|
13234
14102
|
status: "beta",
|
|
13235
14103
|
description: "Application sidebar: workspace switcher (or logo) header, NavList body with icon-rail support, and a footer with plan usage, help link and user menu. Exposes header / nav / footer parts for the SidebarLayout slots.",
|
|
13236
14104
|
uses: [
|
|
14105
|
+
"SimpleSelect",
|
|
13237
14106
|
"WorkspaceSwitcher",
|
|
13238
14107
|
"Logo",
|
|
13239
14108
|
"NavList",
|
|
@@ -13757,7 +14626,7 @@ function orderColumns(columns, pinned) {
|
|
|
13757
14626
|
...right
|
|
13758
14627
|
];
|
|
13759
14628
|
}
|
|
13760
|
-
const STICKY = "sticky z-
|
|
14629
|
+
const STICKY = "sticky z-raised bg-card";
|
|
13761
14630
|
const START_EDGE = "border-e border-border";
|
|
13762
14631
|
const END_EDGE = "border-s border-border";
|
|
13763
14632
|
/**
|
|
@@ -13835,7 +14704,7 @@ function tableLayout({ columns, widths, pinned, sized, lead, trail }) {
|
|
|
13835
14704
|
/** Under-content tint for sticky cells of a hovered or selected row (and the header surface). */
|
|
13836
14705
|
function stickyTint(layout, { selected = false, head = false } = {}) {
|
|
13837
14706
|
if (!layout?.pinned) return void 0;
|
|
13838
|
-
const base = "before:pointer-events-none before:absolute before:inset-0 before
|
|
14707
|
+
const base = "before:pointer-events-none before:absolute before:inset-0 before:z-behind";
|
|
13839
14708
|
if (head) return `${base} before:bg-secondary/30`;
|
|
13840
14709
|
return `${base} ${selected ? "before:bg-primary/8" : "[tr:hover>&]:before:bg-accent/30"}`;
|
|
13841
14710
|
}
|
|
@@ -13986,39 +14855,15 @@ function focusSibling(from, dir) {
|
|
|
13986
14855
|
function EditableCell({ row, rowId, rowLabel, column, onCellEdit, hintId, children, labels }) {
|
|
13987
14856
|
const errorId = useId();
|
|
13988
14857
|
const editor = column.editor ?? { type: "text" };
|
|
13989
|
-
const [editing, setEditing] = useState(false);
|
|
13990
|
-
const [draft, setDraft] = useState("");
|
|
13991
|
-
const [error, setError] = useState(null);
|
|
13992
|
-
const [pending, setPending] = useState(false);
|
|
13993
14858
|
const trigger = useRef(null);
|
|
13994
14859
|
const field = useRef(null);
|
|
13995
|
-
const move = useRef(null);
|
|
13996
|
-
const busy = useRef(false);
|
|
13997
|
-
useEffect(() => {
|
|
13998
|
-
if (editing || !move.current) return;
|
|
13999
|
-
const dir = move.current;
|
|
14000
|
-
move.current = null;
|
|
14001
|
-
if (dir === "self") trigger.current?.focus();
|
|
14002
|
-
else focusSibling(trigger.current, dir);
|
|
14003
|
-
}, [editing]);
|
|
14004
14860
|
const focusOnMount = useCallback((el) => {
|
|
14005
14861
|
field.current = el;
|
|
14006
14862
|
if (!el) return;
|
|
14007
14863
|
el.focus();
|
|
14008
14864
|
if (el instanceof HTMLInputElement) el.select();
|
|
14009
14865
|
}, []);
|
|
14010
|
-
const
|
|
14011
|
-
const v = startValue(row, column);
|
|
14012
|
-
setDraft(v == null ? "" : String(v));
|
|
14013
|
-
setError(null);
|
|
14014
|
-
setEditing(true);
|
|
14015
|
-
};
|
|
14016
|
-
const cancel = () => {
|
|
14017
|
-
move.current = "self";
|
|
14018
|
-
setError(null);
|
|
14019
|
-
setEditing(false);
|
|
14020
|
-
};
|
|
14021
|
-
const parse = () => {
|
|
14866
|
+
const parse = (draft) => {
|
|
14022
14867
|
if (editor.type !== "number") return {
|
|
14023
14868
|
ok: true,
|
|
14024
14869
|
value: draft
|
|
@@ -14046,47 +14891,26 @@ function EditableCell({ row, rowId, rowLabel, column, onCellEdit, hintId, childr
|
|
|
14046
14891
|
value: n
|
|
14047
14892
|
};
|
|
14048
14893
|
};
|
|
14049
|
-
const commit =
|
|
14050
|
-
|
|
14051
|
-
|
|
14052
|
-
|
|
14053
|
-
|
|
14054
|
-
field.current?.focus();
|
|
14055
|
-
|
|
14056
|
-
|
|
14057
|
-
|
|
14058
|
-
|
|
14059
|
-
|
|
14060
|
-
|
|
14061
|
-
|
|
14062
|
-
|
|
14063
|
-
}
|
|
14064
|
-
|
|
14065
|
-
|
|
14066
|
-
|
|
14067
|
-
try {
|
|
14068
|
-
result = await onCellEdit({
|
|
14069
|
-
row,
|
|
14070
|
-
rowId,
|
|
14071
|
-
columnId: column.id,
|
|
14072
|
-
value: parsed.value,
|
|
14073
|
-
previous
|
|
14074
|
-
});
|
|
14075
|
-
} catch (err) {
|
|
14076
|
-
result = err instanceof Error && err.message ? err.message : labels?.editError ?? GENERIC_ERROR;
|
|
14077
|
-
}
|
|
14078
|
-
busy.current = false;
|
|
14079
|
-
setPending(false);
|
|
14080
|
-
if (result === false) result = labels?.editError ?? GENERIC_ERROR;
|
|
14081
|
-
if (typeof result === "string") {
|
|
14082
|
-
setError(result);
|
|
14083
|
-
if (after) field.current?.focus();
|
|
14084
|
-
return;
|
|
14894
|
+
const { editing, draft, setDraft, error, pending, busy, start, cancel, commit } = useInlineEdit({
|
|
14895
|
+
value: startValue(row, column),
|
|
14896
|
+
parse,
|
|
14897
|
+
genericError: labels?.editError ?? GENERIC_ERROR,
|
|
14898
|
+
focusEditor: (after) => {
|
|
14899
|
+
if (after !== null) field.current?.focus();
|
|
14900
|
+
},
|
|
14901
|
+
isEqual: (next, previous) => next === previous || previous != null && String(previous) === String(next) && editor.type !== "number",
|
|
14902
|
+
onSave: (value, previous) => onCellEdit({
|
|
14903
|
+
row,
|
|
14904
|
+
rowId,
|
|
14905
|
+
columnId: column.id,
|
|
14906
|
+
value,
|
|
14907
|
+
previous
|
|
14908
|
+
}),
|
|
14909
|
+
onMove: (dir) => {
|
|
14910
|
+
if (dir === "self") trigger.current?.focus();
|
|
14911
|
+
else focusSibling(trigger.current, dir);
|
|
14085
14912
|
}
|
|
14086
|
-
|
|
14087
|
-
setError(null);
|
|
14088
|
-
setEditing(false);
|
|
14089
|
-
};
|
|
14913
|
+
});
|
|
14090
14914
|
const onEditorKeyDown = (e) => {
|
|
14091
14915
|
if (e.key === "Escape") {
|
|
14092
14916
|
e.preventDefault();
|
|
@@ -14116,7 +14940,7 @@ function EditableCell({ row, rowId, rowLabel, column, onCellEdit, hintId, childr
|
|
|
14116
14940
|
start();
|
|
14117
14941
|
}
|
|
14118
14942
|
},
|
|
14119
|
-
className: cn("-mx-1.5 -my-1 block max-w-[calc(100%+0.75rem)] min-w-[calc(100%+0.75rem)] cursor-text truncate rounded-sm px-1.5 py-1 text-inherit", "hover:bg-secondary/60 focus-
|
|
14943
|
+
className: cn("-mx-1.5 -my-1 block max-w-[calc(100%+0.75rem)] min-w-[calc(100%+0.75rem)] cursor-text truncate rounded-sm px-1.5 py-1 text-inherit", "hover:bg-secondary/60 focus-ring-inset", column.align === "right" || column.variant === "numeric" ? "text-end" : "text-start"),
|
|
14120
14944
|
children
|
|
14121
14945
|
});
|
|
14122
14946
|
const common = {
|
|
@@ -14137,7 +14961,7 @@ function EditableCell({ row, rowId, rowLabel, column, onCellEdit, hintId, childr
|
|
|
14137
14961
|
onChange: (e) => {
|
|
14138
14962
|
if (!pending) setDraft(e.target.value);
|
|
14139
14963
|
},
|
|
14140
|
-
className: cn("h-8 w-full rounded-md border border-input bg-background px-2 text-[13px] text-foreground", "focus-
|
|
14964
|
+
className: cn("h-8 w-full rounded-md border border-input bg-background px-2 text-[13px] text-foreground", "focus-ring", error && "border-destructive"),
|
|
14141
14965
|
...common,
|
|
14142
14966
|
children: editor.options.map((o) => /* @__PURE__ */ jsx("option", {
|
|
14143
14967
|
value: o.value,
|
|
@@ -14193,7 +15017,7 @@ function DataTableRow({ labels, row, columns, getRowId, getRowLabel, selectable,
|
|
|
14193
15017
|
className: "inline-flex",
|
|
14194
15018
|
children: /* @__PURE__ */ jsx("input", {
|
|
14195
15019
|
...singleSelection.inputProps(row),
|
|
14196
|
-
className: "size-4 accent-primary focus-
|
|
15020
|
+
className: "size-4 accent-primary focus-ring disabled:cursor-not-allowed"
|
|
14197
15021
|
})
|
|
14198
15022
|
}) : /* @__PURE__ */ jsx(Checkbox, {
|
|
14199
15023
|
"aria-label": labels?.selectRow?.(label) ?? t("table.selectRow", { label }),
|
|
@@ -14283,7 +15107,7 @@ function GroupHeaderRow({ labels, group, open, selectable, selected, span, colla
|
|
|
14283
15107
|
type: "button",
|
|
14284
15108
|
"aria-expanded": open,
|
|
14285
15109
|
onClick: () => onToggle?.(group.key),
|
|
14286
|
-
className: "inline-flex max-w-full items-center gap-1.5 rounded-sm px-1 py-0.5 hover:bg-secondary focus-
|
|
15110
|
+
className: "inline-flex max-w-full items-center gap-1.5 rounded-sm px-1 py-0.5 hover:bg-secondary focus-ring",
|
|
14287
15111
|
children: [/* @__PURE__ */ jsx(ChevronRight, {
|
|
14288
15112
|
size: 14,
|
|
14289
15113
|
"aria-hidden": true,
|
|
@@ -14653,7 +15477,7 @@ function ColumnResizeHandle({ label, width, min, max, onResize, onResizeEnd, lab
|
|
|
14653
15477
|
onPointerUp,
|
|
14654
15478
|
onPointerCancel: onPointerUp,
|
|
14655
15479
|
onKeyDown,
|
|
14656
|
-
className: cn("group/resizer absolute inset-y-0 -end-1.5 z-
|
|
15480
|
+
className: cn("group/resizer absolute inset-y-0 -end-1.5 z-raised flex w-3 cursor-col-resize touch-none justify-center", "focus-ring-inset"),
|
|
14657
15481
|
children: /* @__PURE__ */ jsx("span", {
|
|
14658
15482
|
"aria-hidden": true,
|
|
14659
15483
|
className: "my-2 w-px bg-border transition-colors group-hover/resizer:w-0.5 group-hover/resizer:bg-primary group-focus-visible/resizer:w-0.5 group-focus-visible/resizer:bg-primary motion-reduce:transition-none"
|
|
@@ -14668,7 +15492,7 @@ function ColumnResizeHandle({ label, width, min, max, onResize, onResizeEnd, lab
|
|
|
14668
15492
|
*/
|
|
14669
15493
|
function DataTableHeadCell({ column, sortDirection, onSortChange, layout, resize, labels }) {
|
|
14670
15494
|
const align = columnAlign(column);
|
|
14671
|
-
const pinnedClass = layout?.pinned ? cn(layout.className, "z-
|
|
15495
|
+
const pinnedClass = layout?.pinned ? cn(layout.className, "z-sticky-pinned", stickyTint(layout, { head: true }), "bg-card") : void 0;
|
|
14672
15496
|
if (!resize) return /* @__PURE__ */ jsx(TableHead, {
|
|
14673
15497
|
align,
|
|
14674
15498
|
className: cn(column.headClassName, pinnedClass),
|
|
@@ -15161,6 +15985,120 @@ function useVirtualRows({ enabled, count, rowHeight, tableRef, viewportHeight, o
|
|
|
15161
15985
|
return windowFor(count, scroll.top, scroll.height, rowHeight, overscan);
|
|
15162
15986
|
}
|
|
15163
15987
|
//#endregion
|
|
15988
|
+
//#region src/tables/DataTable/export-menu.tsx
|
|
15989
|
+
function ExportMenu({ count, selectedCount, scopes, busy, onExport, onCopy, labels }) {
|
|
15990
|
+
const { t, formatNumber } = useI18n();
|
|
15991
|
+
return /* @__PURE__ */ jsxs(Menu, { children: [/* @__PURE__ */ jsx(MenuTrigger, {
|
|
15992
|
+
disabled: busy,
|
|
15993
|
+
"aria-busy": busy || void 0,
|
|
15994
|
+
render: /* @__PURE__ */ jsx(Button, {
|
|
15995
|
+
variant: "secondary",
|
|
15996
|
+
size: "sm",
|
|
15997
|
+
icon: Download$1,
|
|
15998
|
+
loading: busy
|
|
15999
|
+
}),
|
|
16000
|
+
children: labels?.export ?? t("table.export")
|
|
16001
|
+
}), /* @__PURE__ */ jsxs(MenuContent, {
|
|
16002
|
+
align: "end",
|
|
16003
|
+
children: [
|
|
16004
|
+
scopes.includes("rows") && /* @__PURE__ */ jsx(MenuItem, {
|
|
16005
|
+
disabled: busy,
|
|
16006
|
+
onClick: () => onExport("rows"),
|
|
16007
|
+
children: labels?.exportAll?.(count) ?? t("table.exportAll", { count: formatNumber(count) })
|
|
16008
|
+
}),
|
|
16009
|
+
scopes.includes("page") && /* @__PURE__ */ jsx(MenuItem, {
|
|
16010
|
+
disabled: busy,
|
|
16011
|
+
onClick: () => onExport("page"),
|
|
16012
|
+
children: labels?.exportPage ?? t("table.exportPage")
|
|
16013
|
+
}),
|
|
16014
|
+
scopes.includes("selected") && selectedCount > 0 && /* @__PURE__ */ jsx(MenuItem, {
|
|
16015
|
+
disabled: busy,
|
|
16016
|
+
onClick: () => onExport("selected"),
|
|
16017
|
+
children: labels?.exportSelected?.(selectedCount) ?? t("table.exportSelected", { count: formatNumber(selectedCount) })
|
|
16018
|
+
}),
|
|
16019
|
+
scopes.includes("selected") && selectedCount > 0 && onCopy && /* @__PURE__ */ jsx(MenuItem, {
|
|
16020
|
+
disabled: busy,
|
|
16021
|
+
onClick: onCopy,
|
|
16022
|
+
children: labels?.copySelected ?? t("table.copySelected")
|
|
16023
|
+
})
|
|
16024
|
+
]
|
|
16025
|
+
})] });
|
|
16026
|
+
}
|
|
16027
|
+
//#endregion
|
|
16028
|
+
//#region src/tables/DataTable/use-table-export.ts
|
|
16029
|
+
function useTableExport(options) {
|
|
16030
|
+
const { t } = useI18n();
|
|
16031
|
+
const pending = useRef(false);
|
|
16032
|
+
const [busy, setBusy] = useState(false);
|
|
16033
|
+
const [announcement, setAnnouncement] = useState("");
|
|
16034
|
+
const enabled = !!options.csvExport && (!options.serverMode || !!options.onExport);
|
|
16035
|
+
const config = typeof options.csvExport === "object" ? options.csvExport : {};
|
|
16036
|
+
const columns = enabled ? options.columns.filter((column) => column.exportable !== false && (column.accessor || column.exportValue)) : [];
|
|
16037
|
+
const fileName = config.fileName ?? `${options.caption.toLowerCase().normalize("NFKD").replace(/\p{M}/gu, "").replace(/[^\p{L}\p{N}]+/gu, "-").replace(/^-|-$/g, "") || "table"}.csv`;
|
|
16038
|
+
const selected = new Set(enabled && !options.serverMode ? options.selectedIds : []);
|
|
16039
|
+
const selectedRows = selected.size ? options.sortedRows.filter((row) => selected.has(options.getRowId(row))) : [];
|
|
16040
|
+
const csvColumns = columns.map((column) => ({
|
|
16041
|
+
header: column.header,
|
|
16042
|
+
value: (row) => column.exportValue?.(row) ?? column.accessor?.(row)
|
|
16043
|
+
}));
|
|
16044
|
+
const scopes = config.scopes ?? [
|
|
16045
|
+
"rows",
|
|
16046
|
+
"page",
|
|
16047
|
+
"selected"
|
|
16048
|
+
];
|
|
16049
|
+
const copySelected = async () => {
|
|
16050
|
+
if (!enabled || options.serverMode) return;
|
|
16051
|
+
setAnnouncement("");
|
|
16052
|
+
try {
|
|
16053
|
+
await copyToClipboard(toCsv(selectedRows, csvColumns, { delimiter: " " }));
|
|
16054
|
+
setAnnouncement(options.labels?.copiedToClipboard ?? t("common.copiedToClipboard"));
|
|
16055
|
+
} catch {
|
|
16056
|
+
setAnnouncement(options.labels?.copyFailed ?? t("common.copyFailed"));
|
|
16057
|
+
}
|
|
16058
|
+
};
|
|
16059
|
+
const onCopyKeyDown = (event) => {
|
|
16060
|
+
if (!enabled || options.serverMode || !scopes.includes("selected") || selectedRows.length === 0 || pending.current || event.defaultPrevented || event.altKey || !(event.ctrlKey || event.metaKey) || event.key.toLowerCase() !== "c") return;
|
|
16061
|
+
const target = event.target;
|
|
16062
|
+
if (!(target instanceof HTMLElement) || !target.closest("table") || target.closest("input, textarea, select") || target.isContentEditable) return;
|
|
16063
|
+
const editable = target.closest("[contenteditable]");
|
|
16064
|
+
if (editable && editable.getAttribute("contenteditable") !== "false") return;
|
|
16065
|
+
if (window.getSelection()?.isCollapsed === false) return;
|
|
16066
|
+
event.preventDefault();
|
|
16067
|
+
copySelected();
|
|
16068
|
+
};
|
|
16069
|
+
return {
|
|
16070
|
+
busy,
|
|
16071
|
+
selectedRowCount: selectedRows.length,
|
|
16072
|
+
announcement,
|
|
16073
|
+
copySelected,
|
|
16074
|
+
onCopyKeyDown,
|
|
16075
|
+
enabled,
|
|
16076
|
+
scopes,
|
|
16077
|
+
exportRows: async (scope) => {
|
|
16078
|
+
if (pending.current) return;
|
|
16079
|
+
if (options.onExport) {
|
|
16080
|
+
pending.current = true;
|
|
16081
|
+
setBusy(true);
|
|
16082
|
+
try {
|
|
16083
|
+
await options.onExport({
|
|
16084
|
+
scope,
|
|
16085
|
+
columns: columns.map((column) => column.id),
|
|
16086
|
+
selectedIds: [...options.selectedIds],
|
|
16087
|
+
sort: options.sort,
|
|
16088
|
+
filters: options.filters
|
|
16089
|
+
});
|
|
16090
|
+
} catch {} finally {
|
|
16091
|
+
pending.current = false;
|
|
16092
|
+
setBusy(false);
|
|
16093
|
+
}
|
|
16094
|
+
return;
|
|
16095
|
+
}
|
|
16096
|
+
const rows = scope === "rows" ? options.sortedRows : scope === "page" ? options.pageRows : selectedRows;
|
|
16097
|
+
downloadFile(toCsv(rows, csvColumns, { bom: true }), fileName, "text/csv;charset=utf-8");
|
|
16098
|
+
}
|
|
16099
|
+
};
|
|
16100
|
+
}
|
|
16101
|
+
//#endregion
|
|
15164
16102
|
//#region src/tables/DataTable/DataTable.tsx
|
|
15165
16103
|
const defaultRowId = (row) => {
|
|
15166
16104
|
const id = row.id;
|
|
@@ -15178,14 +16116,16 @@ const ROW_HEIGHT = {
|
|
|
15178
16116
|
* and empty states, client-side sort + pagination, optional collapsible row groups (`groupBy`),
|
|
15179
16117
|
* column resize and pinning, row virtualization, inline cell editing and saved views.
|
|
15180
16118
|
*/
|
|
15181
|
-
function DataTable({ rows = DEPLOYMENT_ROWS, columns = DEPLOYMENT_COLUMNS, getRowId = defaultRowId, getRowLabel, caption
|
|
16119
|
+
function DataTable({ rows = DEPLOYMENT_ROWS, columns = DEPLOYMENT_COLUMNS, getRowId = defaultRowId, getRowLabel, caption: captionProp, 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, onQueryChange, manualSorting = false, paginated: paginatedProp, paginationMode = "client", rowCount, page: controlledPage, pageSize: controlledPageSize, onPageChange, onPageSizeChange, defaultPageSize = 10, pageSizeOptions = [
|
|
15182
16120
|
10,
|
|
15183
16121
|
25,
|
|
15184
16122
|
50
|
|
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 }) {
|
|
16123
|
+
], 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, csvExport = false, onExport, className, labels }) {
|
|
16124
|
+
const caption = captionProp ?? "Deployments";
|
|
15186
16125
|
const { t, formatNumber } = useI18n();
|
|
15187
16126
|
const singleMode = selectionMode === "single";
|
|
15188
16127
|
const serverMode = paginationMode === "server";
|
|
16128
|
+
const sortingEnabled = !serverMode || onSortChange != null || onQueryChange != null;
|
|
15189
16129
|
const selectable = selectionMode === void 0 ? selectableProp : selectionMode === "multiple";
|
|
15190
16130
|
const selectionColumn = selectable || singleMode;
|
|
15191
16131
|
const paginated = paginatedProp ?? (serverMode || !singleMode);
|
|
@@ -15237,15 +16177,56 @@ function DataTable({ rows = DEPLOYMENT_ROWS, columns = DEPLOYMENT_COLUMNS, getRo
|
|
|
15237
16177
|
const pageRows = serverMode ? rows : paginated ? paginate(sorted, page, pageSize) : sorted;
|
|
15238
16178
|
const pageIds = (effectiveGroupBy ? pageRows.filter((row) => !collapsed.has(groupKeyOf(row, effectiveGroupBy))) : pageRows).filter((row) => !isRowDisabled?.(row)).map(getRowId);
|
|
15239
16179
|
const header = selectionState(pageIds, selected);
|
|
16180
|
+
const queryPage = serverMode ? controlledPage ?? 1 : page;
|
|
16181
|
+
const queryPageSize = serverMode ? controlledPageSize ?? defaultPageSize : pageSize;
|
|
16182
|
+
const reportQuery = (cause, next) => onQueryChange?.({
|
|
16183
|
+
page: queryPage,
|
|
16184
|
+
pageSize: queryPageSize,
|
|
16185
|
+
sort,
|
|
16186
|
+
filters,
|
|
16187
|
+
...next,
|
|
16188
|
+
cause
|
|
16189
|
+
});
|
|
16190
|
+
const resizingTo = useRef(void 0);
|
|
16191
|
+
const changePage = (next) => {
|
|
16192
|
+
if (serverMode) onPageChange?.(next);
|
|
16193
|
+
else setPage(next);
|
|
16194
|
+
const nextSize = resizingTo.current;
|
|
16195
|
+
resizingTo.current = void 0;
|
|
16196
|
+
reportQuery(nextSize === void 0 ? "page" : "pageSize", {
|
|
16197
|
+
page: next,
|
|
16198
|
+
pageSize: nextSize ?? queryPageSize
|
|
16199
|
+
});
|
|
16200
|
+
};
|
|
16201
|
+
const changePageSize = (next) => {
|
|
16202
|
+
const total = serverMode ? rowCount ?? 0 : rows.length;
|
|
16203
|
+
const pageCount = Math.max(1, Math.ceil(total / Math.max(1, queryPageSize)));
|
|
16204
|
+
const displayedPage = Math.min(Math.max(1, queryPage), pageCount);
|
|
16205
|
+
const from = total === 0 ? 0 : (displayedPage - 1) * queryPageSize + 1;
|
|
16206
|
+
const nextPage = Math.floor((from - 1) / next) + 1;
|
|
16207
|
+
if (serverMode) onPageSizeChange?.(next);
|
|
16208
|
+
else setPageSize(next);
|
|
16209
|
+
if (nextPage !== displayedPage) resizingTo.current = next;
|
|
16210
|
+
else reportQuery("pageSize", {
|
|
16211
|
+
page: nextPage,
|
|
16212
|
+
pageSize: next
|
|
16213
|
+
});
|
|
16214
|
+
};
|
|
15240
16215
|
const changeSort = (columnId, direction) => {
|
|
15241
|
-
if (
|
|
16216
|
+
if (!sortingEnabled) return;
|
|
15242
16217
|
const next = {
|
|
15243
16218
|
columnId,
|
|
15244
16219
|
direction: sort?.columnId === columnId ? direction : "ascending"
|
|
15245
16220
|
};
|
|
15246
16221
|
setInnerSort(next);
|
|
15247
16222
|
onSortChange?.(next);
|
|
15248
|
-
|
|
16223
|
+
if (serverMode) {
|
|
16224
|
+
if (queryPage !== 1) onPageChange?.(1);
|
|
16225
|
+
} else setPage(1);
|
|
16226
|
+
reportQuery("sort", {
|
|
16227
|
+
page: 1,
|
|
16228
|
+
sort: next
|
|
16229
|
+
});
|
|
15249
16230
|
};
|
|
15250
16231
|
const toggleGroup = (key) => {
|
|
15251
16232
|
const next = new Set(collapsed);
|
|
@@ -15308,7 +16289,8 @@ function DataTable({ rows = DEPLOYMENT_ROWS, columns = DEPLOYMENT_COLUMNS, getRo
|
|
|
15308
16289
|
const applyState = (state) => {
|
|
15309
16290
|
const nextSort = state.sort ?? null;
|
|
15310
16291
|
setInnerSort(nextSort);
|
|
15311
|
-
|
|
16292
|
+
const sortChanged = sortingEnabled && (sort?.columnId !== nextSort?.columnId || sort?.direction !== nextSort?.direction);
|
|
16293
|
+
if (nextSort && (!serverMode || sortChanged)) onSortChange?.(nextSort);
|
|
15312
16294
|
setHiddenList(state.hiddenColumns ?? defaultHidden);
|
|
15313
16295
|
setWidths(state.columnWidths ?? defaultColumnWidths);
|
|
15314
16296
|
setPinned(state.pinnedColumns ?? defaultPinnedColumns);
|
|
@@ -15317,6 +16299,12 @@ function DataTable({ rows = DEPLOYMENT_ROWS, columns = DEPLOYMENT_COLUMNS, getRo
|
|
|
15317
16299
|
if (nextGroup !== currentState.groupBy) onGroupByChange?.(nextGroup);
|
|
15318
16300
|
if (state.filters !== filters) onFiltersChange?.(state.filters);
|
|
15319
16301
|
if (!serverMode) setPage(1);
|
|
16302
|
+
else if (sortChanged && queryPage !== 1) onPageChange?.(1);
|
|
16303
|
+
reportQuery("view", {
|
|
16304
|
+
page: !serverMode || sortChanged ? 1 : queryPage,
|
|
16305
|
+
sort: nextSort,
|
|
16306
|
+
filters: state.filters
|
|
16307
|
+
});
|
|
15320
16308
|
};
|
|
15321
16309
|
const viewsApi = useTableViews({
|
|
15322
16310
|
views: viewsProp,
|
|
@@ -15348,8 +16336,24 @@ function DataTable({ rows = DEPLOYMENT_ROWS, columns = DEPLOYMENT_COLUMNS, getRo
|
|
|
15348
16336
|
tableRef,
|
|
15349
16337
|
viewportHeight: 512
|
|
15350
16338
|
});
|
|
16339
|
+
const exportSelectedIds = singleMode ? singleSelection.selectedId == null ? [] : [singleSelection.selectedId] : selectable ? selectedList : [];
|
|
16340
|
+
const exportSelectedCount = singleMode ? exportSelectedIds.length : selectable ? selectedCount : 0;
|
|
16341
|
+
const exportApi = useTableExport({
|
|
16342
|
+
csvExport,
|
|
16343
|
+
onExport,
|
|
16344
|
+
serverMode,
|
|
16345
|
+
caption: captionProp ?? "",
|
|
16346
|
+
columns: visibleColumns,
|
|
16347
|
+
sortedRows,
|
|
16348
|
+
pageRows,
|
|
16349
|
+
selectedIds: exportSelectedIds,
|
|
16350
|
+
getRowId,
|
|
16351
|
+
sort,
|
|
16352
|
+
filters,
|
|
16353
|
+
labels
|
|
16354
|
+
});
|
|
15351
16355
|
const hasSelection = selectable && selectedCount > 0 && (selectionSummary || bulkActions != null);
|
|
15352
|
-
const showToolbar = toolbar != null || showDensityToggle || showColumnMenu || showViews || hasSelection;
|
|
16356
|
+
const showToolbar = toolbar != null || showDensityToggle || showColumnMenu || showViews || hasSelection || exportApi.enabled;
|
|
15353
16357
|
const anyEditable = onCellEdit != null && columns.some((c) => c.editable);
|
|
15354
16358
|
const showSelectionStrip = selectable && selectAllMatching && (!serverMode || !!onSelectionModelChange) && (header.checked || model.type === "exclude" || !serverMode && allMatchingSelected) && (serverMode ? (rowCount ?? 0) > rows.length : enabledIds.length > pageIds.length);
|
|
15355
16359
|
const allMatching = serverMode ? model.type === "exclude" : allMatchingSelected;
|
|
@@ -15358,6 +16362,7 @@ function DataTable({ rows = DEPLOYMENT_ROWS, columns = DEPLOYMENT_COLUMNS, getRo
|
|
|
15358
16362
|
const selectionCount = labels?.selectionCount ? labels.selectionCount(selectedCount) : /* @__PURE__ */ jsxs(Fragment$1, { children: [selectedCount, " selected"] });
|
|
15359
16363
|
return /* @__PURE__ */ jsxs("div", {
|
|
15360
16364
|
className: cn("overflow-hidden rounded-xl border border-border bg-card shadow-sm", className),
|
|
16365
|
+
onKeyDown: exportApi.enabled ? exportApi.onCopyKeyDown : void 0,
|
|
15361
16366
|
children: [
|
|
15362
16367
|
/* @__PURE__ */ jsxs("div", {
|
|
15363
16368
|
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"),
|
|
@@ -15382,6 +16387,15 @@ function DataTable({ rows = DEPLOYMENT_ROWS, columns = DEPLOYMENT_COLUMNS, getRo
|
|
|
15382
16387
|
}), /* @__PURE__ */ jsxs("div", {
|
|
15383
16388
|
className: "flex items-center gap-2",
|
|
15384
16389
|
children: [
|
|
16390
|
+
exportApi.enabled && /* @__PURE__ */ jsx(ExportMenu, {
|
|
16391
|
+
count: rowCount ?? rows.length,
|
|
16392
|
+
selectedCount: serverMode ? exportSelectedCount : exportApi.selectedRowCount,
|
|
16393
|
+
scopes: exportApi.scopes,
|
|
16394
|
+
busy: exportApi.busy,
|
|
16395
|
+
onExport: exportApi.exportRows,
|
|
16396
|
+
onCopy: serverMode ? void 0 : exportApi.copySelected,
|
|
16397
|
+
labels
|
|
16398
|
+
}),
|
|
15385
16399
|
showViews && /* @__PURE__ */ jsx(ViewSwitcher, {
|
|
15386
16400
|
labels,
|
|
15387
16401
|
views: viewsApi.views,
|
|
@@ -15421,6 +16435,12 @@ function DataTable({ rows = DEPLOYMENT_ROWS, columns = DEPLOYMENT_COLUMNS, getRo
|
|
|
15421
16435
|
clear();
|
|
15422
16436
|
}
|
|
15423
16437
|
}),
|
|
16438
|
+
exportApi.enabled && /* @__PURE__ */ jsx("span", {
|
|
16439
|
+
role: "status",
|
|
16440
|
+
"aria-live": "polite",
|
|
16441
|
+
className: "sr-only",
|
|
16442
|
+
children: exportApi.announcement
|
|
16443
|
+
}),
|
|
15424
16444
|
anyEditable && /* @__PURE__ */ jsx("span", {
|
|
15425
16445
|
id: editHintId,
|
|
15426
16446
|
className: "sr-only",
|
|
@@ -15454,7 +16474,7 @@ function DataTable({ rows = DEPLOYMENT_ROWS, columns = DEPLOYMENT_COLUMNS, getRo
|
|
|
15454
16474
|
"aria-rowindex": virtual ? 1 : void 0,
|
|
15455
16475
|
children: [
|
|
15456
16476
|
selectionColumn && /* @__PURE__ */ jsxs(TableHead, {
|
|
15457
|
-
className: cn("w-10 pe-0", layout.lead.className, layout.lead.pinned && "z-
|
|
16477
|
+
className: cn("w-10 pe-0", layout.lead.className, layout.lead.pinned && "z-sticky-pinned bg-card", stickyTint(layout.lead, { head: true })),
|
|
15458
16478
|
style: layout.lead.style,
|
|
15459
16479
|
children: [(singleMode || hideSelectAll) && /* @__PURE__ */ jsx("span", {
|
|
15460
16480
|
className: "sr-only",
|
|
@@ -15472,12 +16492,12 @@ function DataTable({ rows = DEPLOYMENT_ROWS, columns = DEPLOYMENT_COLUMNS, getRo
|
|
|
15472
16492
|
const bounds = widthBounds(c);
|
|
15473
16493
|
return /* @__PURE__ */ jsx(DataTableHeadCell, {
|
|
15474
16494
|
labels,
|
|
15475
|
-
column:
|
|
16495
|
+
column: sortingEnabled ? c : {
|
|
15476
16496
|
...c,
|
|
15477
16497
|
sortable: false
|
|
15478
|
-
}
|
|
16498
|
+
},
|
|
15479
16499
|
layout: layout.columns.get(c.id),
|
|
15480
|
-
sortDirection:
|
|
16500
|
+
sortDirection: sortingEnabled && sort?.columnId === c.id ? sort.direction : "none",
|
|
15481
16501
|
onSortChange: (dir) => changeSort(c.id, dir),
|
|
15482
16502
|
resize: resizable && c.resizable !== false ? {
|
|
15483
16503
|
width: columnWidthOf(c, widths),
|
|
@@ -15488,7 +16508,7 @@ function DataTable({ rows = DEPLOYMENT_ROWS, columns = DEPLOYMENT_COLUMNS, getRo
|
|
|
15488
16508
|
}, c.id);
|
|
15489
16509
|
}),
|
|
15490
16510
|
rowActions && /* @__PURE__ */ jsx(TableHead, {
|
|
15491
|
-
className: cn("w-12", layout.trail.className, layout.trail.pinned && "z-
|
|
16511
|
+
className: cn("w-12", layout.trail.className, layout.trail.pinned && "z-sticky-pinned bg-card", stickyTint(layout.trail, { head: true })),
|
|
15492
16512
|
style: layout.trail.style,
|
|
15493
16513
|
children: /* @__PURE__ */ jsx("span", {
|
|
15494
16514
|
className: "sr-only",
|
|
@@ -15540,9 +16560,9 @@ function DataTable({ rows = DEPLOYMENT_ROWS, columns = DEPLOYMENT_COLUMNS, getRo
|
|
|
15540
16560
|
className: "border-t border-border px-4 py-3",
|
|
15541
16561
|
total: serverMode ? rowCount : rows.length,
|
|
15542
16562
|
page: serverMode ? controlledPage : page,
|
|
15543
|
-
onPageChange:
|
|
16563
|
+
onPageChange: changePage,
|
|
15544
16564
|
pageSize: serverMode ? controlledPageSize : pageSize,
|
|
15545
|
-
onPageSizeChange:
|
|
16565
|
+
onPageSizeChange: changePageSize,
|
|
15546
16566
|
pageSizeOptions,
|
|
15547
16567
|
noun: caption
|
|
15548
16568
|
})
|
|
@@ -15555,8 +16575,43 @@ const meta$16 = {
|
|
|
15555
16575
|
name: "Data table",
|
|
15556
16576
|
family: "tables",
|
|
15557
16577
|
status: "beta",
|
|
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.",
|
|
16578
|
+
description: "Typed data table with sorting, selection, pagination and saved views. Optional npm-only useTableData<T, F> from @gntik-ai/blocks owns abortable, per-instance cached server requests. Copy-install DataTable items do not include the hook. Supply getRows({ page, pageSize, sort, filters, cursor, signal }) returning a Promise of { rows, rowCount } for numbered pages or { rows, nextCursor } for cursor lists. Wrap another fetcher in getRows, for example async ({ signal, ...query }) => { const response = await fetchPage(query, { signal }); return { rows: response.items, rowCount: response.total }; }. Spread tableProps into DataTable: rows, server pagination, rowCount, page, pageSize, sort, manualSorting, loading, filters for selection/saved views and the query callbacks are included. Requests start after commit, so synchronous resize and sort callbacks coalesce into one call. Saved views can clear sort through onQueryChange. Options default to initialPage=1, initialPageSize=20, initialSort=null, cacheTime=30000 ms, keepPreviousData=true, revalidateInterval=0 and enabled=true. Filters compare by JSON.stringify value (key-order sensitive); use serialisable values without cycles or BigInt. Dates and class instances compare by their JSON form. Changing filters or sort requests page 1; resizing preserves the page computed by DataTable to keep the first visible row on screen. Changing callback identities does not refetch. rows, rowCount, nextCursor, isLoading, isFetching, error and params expose the request state. Retained rows keep their confirmed page and pageSize until success, while params describes the requested page and sort reflects the requested order immediately, rolling back on failure. There is no built-in fetching cue over retained rows yet. keepPreviousData=false shows empty rows for an uncached pending query; the last known total remains. Rejections and synchronous throws retain the last rows and call the latest onError once; nullish failures become an Error with the message Unable to load rows. Aborts stay silent. refetch retries the current failed params and bypasses fresh cache; repeating a failed page callback also retries. invalidate clears cache and reloads after edits. Both explicit reloads abort and replace any active request; their cache bypass applies only to that reload. Fresh cache hits clear errors and skip fetching; expired entries render immediately with one background refresh; cacheTime=0 disables caching. Cache entries, including expired ones, remain until invalidation or unmount, so memory grows with distinct queries. revalidateInterval pauses while document.hidden or a request is active, and polls only confirmed queries: failed query changes or cursor appends need an explicit retry. enabled=false aborts work, restores the last confirmed rows and sort, and clears loading; unmount aborts and ignores later settles. For cursors, use paginated=false and spread loadMoreProps into a separate LoadMoreFooter; loadMore appends, repeated calls in flight are ignored, and onRetry retries the failed cursor. An upstream AbortError stays silent and the next loadMore retries the aborted cursor. After a query failure, loadMore waits for a successful retry so a new sort or filter cannot use an old cursor. A null or empty nextCursor exhausts the list. lastAppend increases only when a successful append adds a segment, never when re-enabling or refreshing an already displayed segment, and footer result/loading settle together. Background polls and expired-cache refreshes set isFetching without showing Loading more in the footer; loadMore still ignores calls while any request is active. Cursor refetch starts from the first page; background revalidation preserves the prefix instead of appending duplicates. After a deletion empties an out-of-range page, the consumer chooses whether to request the last valid page: DataTable only clamps the displayed footer. See examples/server-pagination.tsx for endpoint wrapping, selection and errors, and examples/cursor-load-more.tsx for filters, enabled, keepPreviousData, polling, cache invalidation and retry, including a failed refresh after exhaustion. Opt-in csvExport adds an Export menu: All rows in current sort order across pages (before grouping), Current page in grouped display order, Selected rows and Copy selected rows (also Ctrl/Cmd+C on non-editable table content without a document text selection). csvExport accepts fileName and scopes (rows/page/selected). The filename defaults to the slugged caption, or table.csv without a supplied caption. Visible exportable columns keep display order; exportValue overrides accessor (nullish results fall back), columns without either are omitted, and exportable=false opts out. Values stay raw: ISO dates, booleans, numbers and empty null cells. CSV includes a BOM; CSV and clipboard TSV both use shared toCsv formula protection for headers and values. Single selection exports selectedId; multiple selection resolves include/exclude models across loaded rows. onExport receives scope, exported column ids, selected ids, sort and opaque filters; while pending the trigger stays focusable and busy and repeat exports are ignored. Use onExport for large result sets, and handle errors in the callback. Server pagination requires onExport and labels All rows with rowCount; clipboard copying and its shortcut are unavailable in server mode because unloaded selections cannot be copied completely. See examples/csv-export.tsx for client, delegated server and single-row previews. 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. Sortable columns show sort buttons and aria-sort when onSortChange or onQueryChange is supplied; without either, headers stay plain. Sorting toggles ascending/descending, updates uncontrolled sort (controlled sort waits for the prop), and requests page 1 when not already there. aria-sort reflects the requested order before rows arrive; reset controlled sort to the last confirmed order if a request fails. Saved views restore changed sort and request page 1; views that only change filters keep the current server page. Clearing sort is reported as null through onQueryChange, since onSortChange accepts only a non-null SortState. 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. onQueryChange receives one synchronous DataTableQuery per user page, pageSize, sort or view action in both modes: { page, pageSize, sort, filters, cause }. It includes the next page and size together on resize, and the restored filters on a view; consumer filter prop changes do not emit queries. Use onQueryChange OR the separate callbacks for fetching to avoid duplicate requests; existing callbacks retain their order and arguments. See examples/server-pagination.tsx for sortable columns and one request per query, with controlled sort reset on failure. 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.",
|
|
15559
16579
|
labels: [
|
|
16580
|
+
{
|
|
16581
|
+
key: "export",
|
|
16582
|
+
type: "string",
|
|
16583
|
+
state: "CSV export menu trigger text and name"
|
|
16584
|
+
},
|
|
16585
|
+
{
|
|
16586
|
+
key: "exportAll",
|
|
16587
|
+
type: "(count: number) => string",
|
|
16588
|
+
state: "CSV all rows item; server mode uses rowCount"
|
|
16589
|
+
},
|
|
16590
|
+
{
|
|
16591
|
+
key: "exportPage",
|
|
16592
|
+
type: "string",
|
|
16593
|
+
state: "CSV current page item"
|
|
16594
|
+
},
|
|
16595
|
+
{
|
|
16596
|
+
key: "exportSelected",
|
|
16597
|
+
type: "(count: number) => string",
|
|
16598
|
+
state: "CSV selected rows item, only with selection"
|
|
16599
|
+
},
|
|
16600
|
+
{
|
|
16601
|
+
key: "copySelected",
|
|
16602
|
+
type: "string",
|
|
16603
|
+
state: "Copy selected rows menu item, only with selection"
|
|
16604
|
+
},
|
|
16605
|
+
{
|
|
16606
|
+
key: "copiedToClipboard",
|
|
16607
|
+
type: "string",
|
|
16608
|
+
state: "Polite status after copying selected rows"
|
|
16609
|
+
},
|
|
16610
|
+
{
|
|
16611
|
+
key: "copyFailed",
|
|
16612
|
+
type: "string",
|
|
16613
|
+
state: "Polite status after clipboard failure"
|
|
16614
|
+
},
|
|
15560
16615
|
{
|
|
15561
16616
|
key: "booleanTrue",
|
|
15562
16617
|
type: "string",
|
|
@@ -15953,7 +17008,7 @@ const DEPLOYMENT_SAVED_VIEWS = [
|
|
|
15953
17008
|
//#region src/tables/FilterBar/FilterBar.tsx
|
|
15954
17009
|
const same = (a, b) => a.field === b.field && a.value === b.value;
|
|
15955
17010
|
/**
|
|
15956
|
-
* Filter bar:
|
|
17011
|
+
* Filter bar: SearchField, saved views Select, an "Add filter" Menu (multi-select per field),
|
|
15957
17012
|
* removable filter chips (Token) and Clear all.
|
|
15958
17013
|
*/
|
|
15959
17014
|
function FilterBar({ fields = DEPLOYMENT_FILTER_FIELDS, query: queryProp, defaultQuery = "", onQueryChange, filters: filtersProp, defaultFilters = DEPLOYMENT_DEFAULT_FILTERS, onFiltersChange, views = DEPLOYMENT_SAVED_VIEWS, defaultView = null, onViewChange, searchLabel: searchLabelProp, placeholder: placeholderProp, resultCount, className, labels }) {
|
|
@@ -15996,11 +17051,9 @@ function FilterBar({ fields = DEPLOYMENT_FILTER_FIELDS, query: queryProp, defaul
|
|
|
15996
17051
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
15997
17052
|
className: "flex flex-col gap-2 sm:flex-row sm:items-center",
|
|
15998
17053
|
children: [
|
|
15999
|
-
/* @__PURE__ */ jsx(
|
|
17054
|
+
/* @__PURE__ */ jsx(SearchField, {
|
|
16000
17055
|
"aria-label": searchLabel,
|
|
16001
|
-
type: "search",
|
|
16002
17056
|
size: "sm",
|
|
16003
|
-
leadingIcon: Search,
|
|
16004
17057
|
placeholder,
|
|
16005
17058
|
value: query,
|
|
16006
17059
|
onValueChange: (v) => setQuery(String(v)),
|
|
@@ -16058,7 +17111,7 @@ function FilterBar({ fields = DEPLOYMENT_FILTER_FIELDS, query: queryProp, defaul
|
|
|
16058
17111
|
className: "flex flex-wrap items-center gap-2",
|
|
16059
17112
|
children: [
|
|
16060
17113
|
/* @__PURE__ */ jsxs("span", {
|
|
16061
|
-
className: "inline-flex items-center gap-1.5 font-mono text-[10px] tracking-[0.14em] text-muted-foreground
|
|
17114
|
+
className: "inline-flex items-center gap-1.5 font-mono text-[10px] tracking-[0.14em] text-muted-foreground label-case",
|
|
16062
17115
|
children: [/* @__PURE__ */ jsx(ListFilter, {
|
|
16063
17116
|
size: 12,
|
|
16064
17117
|
"aria-hidden": true
|
|
@@ -16232,7 +17285,7 @@ const meta$14 = {
|
|
|
16232
17285
|
};
|
|
16233
17286
|
//#endregion
|
|
16234
17287
|
//#region src/tables/PaginationFooter/block.meta.ts
|
|
16235
|
-
const meta$
|
|
17288
|
+
const meta$48 = {
|
|
16236
17289
|
name: "Pagination footer",
|
|
16237
17290
|
family: "tables",
|
|
16238
17291
|
status: "beta",
|
|
@@ -16508,7 +17561,7 @@ function TruncatedCollectionFooter({ visibleCount = TRUNCATED_COLLECTION_PREVIEW
|
|
|
16508
17561
|
}
|
|
16509
17562
|
//#endregion
|
|
16510
17563
|
//#region src/tables/TruncatedCollectionFooter/block.meta.ts
|
|
16511
|
-
const meta$
|
|
17564
|
+
const meta$76 = {
|
|
16512
17565
|
name: "Truncated collection footer",
|
|
16513
17566
|
family: "tables",
|
|
16514
17567
|
status: "beta",
|
|
@@ -16814,7 +17867,7 @@ function SubordinateList({ title, headingLevel, count, columns, rows, getRowId,
|
|
|
16814
17867
|
}
|
|
16815
17868
|
//#endregion
|
|
16816
17869
|
//#region src/tables/SubordinateList/block.meta.ts
|
|
16817
|
-
const meta$
|
|
17870
|
+
const meta$71 = {
|
|
16818
17871
|
name: "Subordinate list",
|
|
16819
17872
|
family: "tables",
|
|
16820
17873
|
status: "beta",
|
|
@@ -16991,7 +18044,7 @@ function MembersTable({ members: members$1 = members, roles = memberRoles, curre
|
|
|
16991
18044
|
}
|
|
16992
18045
|
//#endregion
|
|
16993
18046
|
//#region src/team/MembersTable/block.meta.ts
|
|
16994
|
-
const meta$
|
|
18047
|
+
const meta$41 = {
|
|
16995
18048
|
name: "Members table",
|
|
16996
18049
|
family: "team",
|
|
16997
18050
|
status: "stable",
|
|
@@ -17169,7 +18222,7 @@ function NotificationMatrix({ channels = notificationChannels, events = notifica
|
|
|
17169
18222
|
}
|
|
17170
18223
|
//#endregion
|
|
17171
18224
|
//#region src/team/NotificationMatrix/block.meta.ts
|
|
17172
|
-
const meta$
|
|
18225
|
+
const meta$45 = {
|
|
17173
18226
|
name: "Notification matrix",
|
|
17174
18227
|
family: "team",
|
|
17175
18228
|
status: "stable",
|
|
@@ -17331,7 +18384,7 @@ function PendingInvitations({ invitations: invitations$1 = invitations, onResend
|
|
|
17331
18384
|
}
|
|
17332
18385
|
//#endregion
|
|
17333
18386
|
//#region src/team/PendingInvitations/block.meta.ts
|
|
17334
|
-
const meta$
|
|
18387
|
+
const meta$50 = {
|
|
17335
18388
|
name: "Pending invitations",
|
|
17336
18389
|
family: "team",
|
|
17337
18390
|
status: "stable",
|
|
@@ -17373,7 +18426,6 @@ const profile = {
|
|
|
17373
18426
|
//#region src/team/ProfileHeader/ProfileHeader.tsx
|
|
17374
18427
|
/** Profile header: large avatar with a change action, name, role, headline, meta row and edit button. */
|
|
17375
18428
|
function ProfileHeader({ profile: profile$1 = profile, onAvatarChange = () => {}, onEdit = () => {}, actions, headingLevel: Heading = "h1", className }) {
|
|
17376
|
-
const fileRef = useRef(null);
|
|
17377
18429
|
const [preview, setPreview] = useState(null);
|
|
17378
18430
|
const pick = (file) => {
|
|
17379
18431
|
onAvatarChange?.(file);
|
|
@@ -17392,24 +18444,19 @@ function ProfileHeader({ profile: profile$1 = profile, onAvatarChange = () => {}
|
|
|
17392
18444
|
size: "xl",
|
|
17393
18445
|
name: profile$1.name,
|
|
17394
18446
|
src: preview ?? profile$1.avatarUrl
|
|
17395
|
-
}), onAvatarChange && /* @__PURE__ */
|
|
17396
|
-
icon: Camera,
|
|
17397
|
-
label: "Change avatar",
|
|
17398
|
-
size: "sm",
|
|
17399
|
-
variant: "secondary",
|
|
17400
|
-
className: "absolute -end-1 -bottom-1 rounded-full",
|
|
17401
|
-
onClick: () => fileRef.current?.click()
|
|
17402
|
-
}), /* @__PURE__ */ jsx("input", {
|
|
17403
|
-
ref: fileRef,
|
|
17404
|
-
type: "file",
|
|
18447
|
+
}), onAvatarChange && /* @__PURE__ */ jsx(FileTrigger, {
|
|
17405
18448
|
accept: "image/*",
|
|
17406
|
-
|
|
17407
|
-
|
|
17408
|
-
|
|
17409
|
-
|
|
17410
|
-
|
|
17411
|
-
|
|
17412
|
-
|
|
18449
|
+
onSelect: (files) => {
|
|
18450
|
+
if (files[0]) pick(files[0]);
|
|
18451
|
+
},
|
|
18452
|
+
render: /* @__PURE__ */ jsx(IconButton, {
|
|
18453
|
+
icon: Camera,
|
|
18454
|
+
label: "Change avatar",
|
|
18455
|
+
size: "sm",
|
|
18456
|
+
variant: "secondary",
|
|
18457
|
+
className: "absolute -end-1 -bottom-1 rounded-full"
|
|
18458
|
+
})
|
|
18459
|
+
})]
|
|
17413
18460
|
}),
|
|
17414
18461
|
/* @__PURE__ */ jsxs("div", {
|
|
17415
18462
|
className: "min-w-0 flex-1",
|
|
@@ -17456,7 +18503,7 @@ function ProfileHeader({ profile: profile$1 = profile, onAvatarChange = () => {}
|
|
|
17456
18503
|
}
|
|
17457
18504
|
//#endregion
|
|
17458
18505
|
//#region src/team/ProfileHeader/block.meta.ts
|
|
17459
|
-
const meta$
|
|
18506
|
+
const meta$54 = {
|
|
17460
18507
|
name: "Profile header",
|
|
17461
18508
|
family: "team",
|
|
17462
18509
|
status: "stable",
|
|
@@ -17465,7 +18512,8 @@ const meta$53 = {
|
|
|
17465
18512
|
"Avatar",
|
|
17466
18513
|
"Badge",
|
|
17467
18514
|
"IconButton",
|
|
17468
|
-
"Button"
|
|
18515
|
+
"Button",
|
|
18516
|
+
"FileTrigger"
|
|
17469
18517
|
]
|
|
17470
18518
|
};
|
|
17471
18519
|
//#endregion
|
|
@@ -17631,7 +18679,7 @@ function SessionsDevices({ sessions = deviceSessions, onRevoke, onRevokeOthers,
|
|
|
17631
18679
|
}
|
|
17632
18680
|
//#endregion
|
|
17633
18681
|
//#region src/team/SessionsDevices/block.meta.ts
|
|
17634
|
-
const meta$
|
|
18682
|
+
const meta$60 = {
|
|
17635
18683
|
name: "Sessions and devices",
|
|
17636
18684
|
family: "team",
|
|
17637
18685
|
status: "stable",
|
|
@@ -17643,6 +18691,6 @@ const meta$59 = {
|
|
|
17643
18691
|
]
|
|
17644
18692
|
};
|
|
17645
18693
|
//#endregion
|
|
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$
|
|
18694
|
+
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, LogoCloud, 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, SiteFooter, 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, meta$40 as logoCloudMeta, memberRoles, meta$41 as membersTableMeta, meta$42 as mfaChallengeMeta, meta$43 as modelKeysListMeta, meta$44 as monthCalendarMeta, noAccessSample, noResultsSample, notFoundSample, notificationChannels, notificationDefaults, notificationEvents, meta$45 as notificationMatrixMeta, orderColumns, pageCountOf, pageHeaderActions, pageHeaderBreadcrumbs, meta$46 as pageHeaderMeta, pageHeaderTabs, meta$47 as pageToolbarMeta, pageToolbarViews, paginate, meta$48 as paginationFooterMeta, meta$49 as paymentMethodCardMeta, meta$50 as pendingInvitationsMeta, meta$51 as planCardMeta, meta$52 as planDefinitionCardMeta, meta$53 as pricingTableMeta, meta$54 as profileHeaderMeta, meta$55 as promptEditorMeta, meta$56 as quotaMetersMeta, meta$57 as resetPasswordFormMeta, meta$58 as resourceCardGridMeta, runningTraceSpans, sameViewState, sampleBudget, sampleComparisonPlans, sampleComparisonSections, sampleCosts, deviceSessions as sampleDeviceSessions, sampleFaqs, sampleFeatures, sampleFooterColumns, invitations as sampleInvitations, sampleInvoices, sampleLegalLinks, sampleLogos, members as sampleMembers, samplePaymentMethod, samplePlan, samplePlanDefinition, samplePricingTiers, profile as sampleProfile, sampleQuotas, sampleEvents as sampleScheduleEvents, sampleToday as sampleScheduleToday, sampleSocialLinks, sampleSpend, sampleTimeSlots, meta$59 as sectionHeaderMeta, selectionState, meta$60 as sessionsDevicesMeta, setColumnPin, meta$61 as settingsRowMeta, meta$62 as signInFormMeta, meta$63 as signUpFormMeta, simulateUpload, meta$64 as siteFooterMeta, meta$65 as skeletonsMeta, sortRows, meta$66 as spendVsBudgetMeta, meta$67 as ssoButtonsMeta, ssoProviders, meta$68 as statCardMeta, meta$69 as statusTimelineMeta, meta$70 as stickyActionBarMeta, meta$71 as subordinateListMeta, meta$72 as systemBannerMeta, meta$73 as timeSlotPickerMeta, toggleAll, toggleOne, meta$74 as tokenCostCardMeta, traceSpans, meta$75 as traceWaterfallMeta, meta$76 as truncatedCollectionFooterMeta, uploadItems, useTableData, validationIssues, meta$77 as validationSummaryMeta, meta$78 as weekCalendarMeta };
|
|
17647
18695
|
|
|
17648
18696
|
//# sourceMappingURL=index.js.map
|