@gntik-ai/blocks 0.11.0 → 0.13.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 +1891 -840
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
- package/src/ai/EvaluationScorecard/EvaluationScorecard.test.tsx +10 -0
- package/src/ai/EvaluationScorecard/EvaluationScorecard.tsx +2 -1
- package/src/ai/PromptEditor/PromptEditor.tsx +2 -2
- package/src/ai/PromptEditor/examples/controlled-variables.tsx +1 -1
- package/src/ai/TokenCostCard/TokenCostCard.test.tsx +10 -0
- package/src/ai/TokenCostCard/TokenCostCard.tsx +2 -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.test.tsx +11 -0
- package/src/builders/CodePanel/CodePanel.tsx +4 -3
- 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/PageToolbar/PageToolbar.test.tsx +3 -1
- package/src/page-chrome/PageToolbar/PageToolbar.tsx +2 -2
- 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",
|
|
@@ -699,8 +701,9 @@ function TokenCostCard({ periods = tokenUsagePeriods, defaultPeriod, currency =
|
|
|
699
701
|
}), /* @__PURE__ */ jsx(CardDescription, { children: description })] }), periods.length > 1 && /* @__PURE__ */ jsx(CardAction, { children: /* @__PURE__ */ jsx(ToggleGroup, {
|
|
700
702
|
"aria-label": "Period",
|
|
701
703
|
size: "sm",
|
|
704
|
+
disallowEmptySelection: true,
|
|
702
705
|
value: [period.id],
|
|
703
|
-
onValueChange: (v) =>
|
|
706
|
+
onValueChange: (v) => setPeriodId(v[0]),
|
|
704
707
|
children: periods.map((p) => /* @__PURE__ */ jsx(Toggle, {
|
|
705
708
|
value: p.id,
|
|
706
709
|
children: p.label
|
|
@@ -763,7 +766,7 @@ function TokenCostCard({ periods = tokenUsagePeriods, defaultPeriod, currency =
|
|
|
763
766
|
}
|
|
764
767
|
//#endregion
|
|
765
768
|
//#region src/ai/TokenCostCard/block.meta.ts
|
|
766
|
-
const meta$
|
|
769
|
+
const meta$74 = {
|
|
767
770
|
name: "Token cost card",
|
|
768
771
|
family: "ai",
|
|
769
772
|
status: "beta",
|
|
@@ -896,7 +899,7 @@ function PromptEditor({ title = "Prompt", defaultSystem = promptDefaults.system,
|
|
|
896
899
|
}), /* @__PURE__ */ jsxs("div", {
|
|
897
900
|
className: "flex flex-col gap-5 border-t border-border bg-secondary/20 p-4 md:border-t-0 md:border-s",
|
|
898
901
|
children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(SubTag, {
|
|
899
|
-
className: "text-[12px] font-semibold tracking-wide text-muted-foreground
|
|
902
|
+
className: "text-[12px] font-semibold tracking-wide text-muted-foreground label-case",
|
|
900
903
|
children: "Variables"
|
|
901
904
|
}), variables.length === 0 ? /* @__PURE__ */ jsx("p", {
|
|
902
905
|
className: "mt-2 text-[12.5px] text-muted-foreground",
|
|
@@ -939,7 +942,7 @@ function PromptEditor({ title = "Prompt", defaultSystem = promptDefaults.system,
|
|
|
939
942
|
className: "flex flex-col gap-4",
|
|
940
943
|
children: [
|
|
941
944
|
/* @__PURE__ */ jsx(SubTag, {
|
|
942
|
-
className: "text-[12px] font-semibold tracking-wide text-muted-foreground
|
|
945
|
+
className: "text-[12px] font-semibold tracking-wide text-muted-foreground label-case",
|
|
943
946
|
children: "Parameters"
|
|
944
947
|
}),
|
|
945
948
|
/* @__PURE__ */ jsx(Slider, {
|
|
@@ -976,7 +979,7 @@ function PromptEditor({ title = "Prompt", defaultSystem = promptDefaults.system,
|
|
|
976
979
|
}
|
|
977
980
|
//#endregion
|
|
978
981
|
//#region src/ai/PromptEditor/block.meta.ts
|
|
979
|
-
const meta$
|
|
982
|
+
const meta$55 = {
|
|
980
983
|
name: "Prompt editor",
|
|
981
984
|
family: "ai",
|
|
982
985
|
status: "beta",
|
|
@@ -1248,8 +1251,9 @@ function EvaluationScorecard({ metrics = evalMetrics, rows = evalRows, title = "
|
|
|
1248
1251
|
})] }), /* @__PURE__ */ jsxs(ToggleGroup, {
|
|
1249
1252
|
"aria-label": "Show datasets",
|
|
1250
1253
|
size: "sm",
|
|
1254
|
+
disallowEmptySelection: true,
|
|
1251
1255
|
value: [filter],
|
|
1252
|
-
onValueChange: (v) =>
|
|
1256
|
+
onValueChange: (v) => setFilter(v[0]),
|
|
1253
1257
|
children: [/* @__PURE__ */ jsxs(Toggle, {
|
|
1254
1258
|
value: "all",
|
|
1255
1259
|
children: ["All ", /* @__PURE__ */ jsx("span", {
|
|
@@ -1586,7 +1590,7 @@ function ModelKeysList({ keys = modelKeys, title = "Model provider keys", onTest
|
|
|
1586
1590
|
}
|
|
1587
1591
|
//#endregion
|
|
1588
1592
|
//#region src/ai/ModelKeysList/block.meta.ts
|
|
1589
|
-
const meta$
|
|
1593
|
+
const meta$43 = {
|
|
1590
1594
|
name: "Model keys list",
|
|
1591
1595
|
family: "ai",
|
|
1592
1596
|
status: "beta",
|
|
@@ -1614,7 +1618,7 @@ function AuthHeader({ eyebrow, title, description, headingLevel: Heading = "h1",
|
|
|
1614
1618
|
className: cn("mb-6", className),
|
|
1615
1619
|
children: [
|
|
1616
1620
|
eyebrow != null && /* @__PURE__ */ jsx("p", {
|
|
1617
|
-
className: "mb-2.5 font-mono text-[11px] tracking-[0.2em] text-primary-text
|
|
1621
|
+
className: "mb-2.5 font-mono text-[11px] tracking-[0.2em] text-primary-text label-case",
|
|
1618
1622
|
children: eyebrow
|
|
1619
1623
|
}),
|
|
1620
1624
|
Heading != null && title != null && /* @__PURE__ */ jsx(Heading, {
|
|
@@ -1636,7 +1640,7 @@ function AuthDivider({ children }) {
|
|
|
1636
1640
|
children: [
|
|
1637
1641
|
/* @__PURE__ */ jsx("span", { className: "h-px flex-1 bg-border" }),
|
|
1638
1642
|
/* @__PURE__ */ jsx("span", {
|
|
1639
|
-
className: "font-mono text-[10.5px] font-semibold tracking-[0.2em] text-muted-foreground
|
|
1643
|
+
className: "font-mono text-[10.5px] font-semibold tracking-[0.2em] text-muted-foreground label-case",
|
|
1640
1644
|
children
|
|
1641
1645
|
}),
|
|
1642
1646
|
/* @__PURE__ */ jsx("span", { className: "h-px flex-1 bg-border" })
|
|
@@ -1687,7 +1691,7 @@ function authSignUpFieldError(value, field, t, labels) {
|
|
|
1687
1691
|
//#endregion
|
|
1688
1692
|
//#region src/auth/ForgotPasswordForm/ForgotPasswordForm.tsx
|
|
1689
1693
|
/** 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 }) {
|
|
1694
|
+
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
1695
|
const { t } = useI18n();
|
|
1692
1696
|
const eyebrow = eyebrowProp === void 0 ? labels?.eyebrow ?? t("forgotPassword.eyebrow") : eyebrowProp;
|
|
1693
1697
|
const title = titleProp === void 0 ? labels?.title ?? t("forgotPassword.title") : titleProp;
|
|
@@ -1812,6 +1816,7 @@ function ForgotPasswordForm({ labels, identifier, messages, ref, fieldInvalid, f
|
|
|
1812
1816
|
children: [
|
|
1813
1817
|
/* @__PURE__ */ jsx(FieldLabel, { children: identifier?.label ?? labels?.identifierLabel ?? t("forgotPassword.identifierLabel") }),
|
|
1814
1818
|
/* @__PURE__ */ jsx(Input, {
|
|
1819
|
+
size: fieldSize,
|
|
1815
1820
|
ref: identifierInput,
|
|
1816
1821
|
"aria-describedby": fieldInvalid?.identifier ? feedbackId : void 0,
|
|
1817
1822
|
type: identifier?.type ?? "email",
|
|
@@ -1857,7 +1862,7 @@ const meta$29 = {
|
|
|
1857
1862
|
name: "Forgot password form",
|
|
1858
1863
|
family: "auth",
|
|
1859
1864
|
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.",
|
|
1865
|
+
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
1866
|
labels: [
|
|
1862
1867
|
{
|
|
1863
1868
|
key: "formLabel",
|
|
@@ -1967,7 +1972,7 @@ const meta$29 = {
|
|
|
1967
1972
|
* Second-factor step: a one-time code (auto-submits when complete), a switch to a backup code,
|
|
1968
1973
|
* and a resend button with a countdown.
|
|
1969
1974
|
*/
|
|
1970
|
-
function MfaChallenge({ labels, onVerify, onResend, resendCooldown = 30, initialCooldown, length = 6, destination, error: errorProp, loading: loadingProp, onCancel, eyebrow: eyebrowProp, title: titleProp, className }) {
|
|
1975
|
+
function MfaChallenge({ labels, fieldSize = "auto", onVerify, onResend, resendCooldown = 30, initialCooldown, length = 6, destination, error: errorProp, loading: loadingProp, onCancel, eyebrow: eyebrowProp, title: titleProp, className }) {
|
|
1971
1976
|
const { t } = useI18n();
|
|
1972
1977
|
const eyebrow = eyebrowProp === void 0 ? labels?.eyebrow ?? t("mfaChallenge.eyebrow") : eyebrowProp;
|
|
1973
1978
|
const title = titleProp === void 0 ? labels?.title ?? t("mfaChallenge.title") : titleProp;
|
|
@@ -2032,6 +2037,7 @@ function MfaChallenge({ labels, onVerify, onResend, resendCooldown = 30, initial
|
|
|
2032
2037
|
children: [
|
|
2033
2038
|
/* @__PURE__ */ jsx(FieldLabel, { children: labels?.codeLabel ?? t("mfaChallenge.codeLabel") }),
|
|
2034
2039
|
/* @__PURE__ */ jsx(OtpInput, {
|
|
2040
|
+
size: fieldSize === "lg" ? "md" : void 0,
|
|
2035
2041
|
length,
|
|
2036
2042
|
value: code,
|
|
2037
2043
|
onValueChange: setCode,
|
|
@@ -2050,6 +2056,7 @@ function MfaChallenge({ labels, onVerify, onResend, resendCooldown = 30, initial
|
|
|
2050
2056
|
children: [
|
|
2051
2057
|
/* @__PURE__ */ jsx(FieldLabel, { children: labels?.backupLabel ?? t("mfaChallenge.backupLabel") }),
|
|
2052
2058
|
/* @__PURE__ */ jsx(Input, {
|
|
2059
|
+
size: fieldSize,
|
|
2053
2060
|
value: backup,
|
|
2054
2061
|
onValueChange: setBackup,
|
|
2055
2062
|
placeholder: labels?.backupPlaceholder ?? t("mfaChallenge.backupPlaceholder"),
|
|
@@ -2111,11 +2118,11 @@ function MfaChallenge({ labels, onVerify, onResend, resendCooldown = 30, initial
|
|
|
2111
2118
|
}
|
|
2112
2119
|
//#endregion
|
|
2113
2120
|
//#region src/auth/MfaChallenge/block.meta.ts
|
|
2114
|
-
const meta$
|
|
2121
|
+
const meta$42 = {
|
|
2115
2122
|
name: "MFA challenge",
|
|
2116
2123
|
family: "auth",
|
|
2117
2124
|
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.",
|
|
2125
|
+
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
2126
|
labels: [
|
|
2120
2127
|
{
|
|
2121
2128
|
key: "eyebrow",
|
|
@@ -2229,7 +2236,7 @@ const meta$41 = {
|
|
|
2229
2236
|
//#endregion
|
|
2230
2237
|
//#region src/auth/ResetPasswordForm/ResetPasswordForm.tsx
|
|
2231
2238
|
/** 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 }) {
|
|
2239
|
+
function ResetPasswordForm({ labels, fieldSize = "auto", onSubmit, error: errorProp, minPasswordLength = 8, onContinue, eyebrow: eyebrowProp, className }) {
|
|
2233
2240
|
const { t } = useI18n();
|
|
2234
2241
|
const eyebrow = eyebrowProp === void 0 ? labels?.eyebrow ?? t("resetPassword.eyebrow") : eyebrowProp;
|
|
2235
2242
|
const [password, setPassword] = useState("");
|
|
@@ -2297,6 +2304,7 @@ function ResetPasswordForm({ labels, onSubmit, error: errorProp, minPasswordLeng
|
|
|
2297
2304
|
children: [
|
|
2298
2305
|
/* @__PURE__ */ jsx(FieldLabel, { children: labels?.newPassword ?? t("resetPassword.newPassword") }),
|
|
2299
2306
|
/* @__PURE__ */ jsx(PasswordInput, {
|
|
2307
|
+
size: fieldSize,
|
|
2300
2308
|
showStrength: true,
|
|
2301
2309
|
value: password,
|
|
2302
2310
|
onValueChange: setPassword,
|
|
@@ -2313,6 +2321,7 @@ function ResetPasswordForm({ labels, onSubmit, error: errorProp, minPasswordLeng
|
|
|
2313
2321
|
children: [
|
|
2314
2322
|
/* @__PURE__ */ jsx(FieldLabel, { children: labels?.confirmPassword ?? t("resetPassword.confirmPassword") }),
|
|
2315
2323
|
/* @__PURE__ */ jsx(PasswordInput, {
|
|
2324
|
+
size: fieldSize,
|
|
2316
2325
|
autoComplete: "new-password",
|
|
2317
2326
|
value: confirm,
|
|
2318
2327
|
onValueChange: setConfirm,
|
|
@@ -2338,11 +2347,11 @@ function ResetPasswordForm({ labels, onSubmit, error: errorProp, minPasswordLeng
|
|
|
2338
2347
|
}
|
|
2339
2348
|
//#endregion
|
|
2340
2349
|
//#region src/auth/ResetPasswordForm/block.meta.ts
|
|
2341
|
-
const meta$
|
|
2350
|
+
const meta$57 = {
|
|
2342
2351
|
name: "Reset password form",
|
|
2343
2352
|
family: "auth",
|
|
2344
2353
|
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.",
|
|
2354
|
+
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
2355
|
labels: [
|
|
2347
2356
|
{
|
|
2348
2357
|
key: "eyebrow",
|
|
@@ -2465,7 +2474,7 @@ const linkHandler = (fn) => fn ? (e) => {
|
|
|
2465
2474
|
fn();
|
|
2466
2475
|
} : void 0;
|
|
2467
2476
|
/** 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 }) {
|
|
2477
|
+
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
2478
|
const { t } = useI18n();
|
|
2470
2479
|
const eyebrow = eyebrowProp === void 0 ? labels?.eyebrow ?? t("signIn.eyebrow") : eyebrowProp;
|
|
2471
2480
|
const title = titleProp === void 0 ? labels?.title ?? t("signIn.title") : titleProp;
|
|
@@ -2528,6 +2537,7 @@ function SignInForm({ labels, identifier, messages, passwordHelp, passwordHelpId
|
|
|
2528
2537
|
children: [
|
|
2529
2538
|
/* @__PURE__ */ jsx(FieldLabel, { children: identifier?.label ?? labels?.identifierLabel ?? t("signIn.identifierLabel") }),
|
|
2530
2539
|
/* @__PURE__ */ jsx(Input, {
|
|
2540
|
+
size: fieldSize,
|
|
2531
2541
|
ref: identifierInput,
|
|
2532
2542
|
"aria-describedby": fieldInvalid?.identifier ? feedbackId : void 0,
|
|
2533
2543
|
type: identifier?.type ?? "email",
|
|
@@ -2564,6 +2574,7 @@ function SignInForm({ labels, identifier, messages, passwordHelp, passwordHelpId
|
|
|
2564
2574
|
})]
|
|
2565
2575
|
}),
|
|
2566
2576
|
/* @__PURE__ */ jsx(PasswordInput, {
|
|
2577
|
+
size: fieldSize,
|
|
2567
2578
|
ref: passwordInput,
|
|
2568
2579
|
"aria-describedby": fieldInvalid?.password ? feedbackId : void 0,
|
|
2569
2580
|
leadingIcon: Lock,
|
|
@@ -2614,11 +2625,11 @@ function SignInForm({ labels, identifier, messages, passwordHelp, passwordHelpId
|
|
|
2614
2625
|
}
|
|
2615
2626
|
//#endregion
|
|
2616
2627
|
//#region src/auth/SignInForm/block.meta.ts
|
|
2617
|
-
const meta$
|
|
2628
|
+
const meta$62 = {
|
|
2618
2629
|
name: "Sign-in form",
|
|
2619
2630
|
family: "auth",
|
|
2620
2631
|
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.",
|
|
2632
|
+
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
2633
|
labels: [
|
|
2623
2634
|
{
|
|
2624
2635
|
key: "eyebrow",
|
|
@@ -2771,7 +2782,7 @@ function ValidationSummary({ labels, errors = validationIssues, submitCount = 0,
|
|
|
2771
2782
|
role: "region",
|
|
2772
2783
|
tone: "destructive",
|
|
2773
2784
|
title: heading,
|
|
2774
|
-
className: cn("focus-
|
|
2785
|
+
className: cn("focus-ring", className),
|
|
2775
2786
|
children: /* @__PURE__ */ jsx("ul", {
|
|
2776
2787
|
className: "mt-1 list-disc space-y-1 ps-4",
|
|
2777
2788
|
children: errors.map((e) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(Link, {
|
|
@@ -2790,7 +2801,7 @@ function ValidationSummary({ labels, errors = validationIssues, submitCount = 0,
|
|
|
2790
2801
|
//#endregion
|
|
2791
2802
|
//#region src/auth/SignUpForm/SignUpForm.tsx
|
|
2792
2803
|
/** 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 }) {
|
|
2804
|
+
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
2805
|
const { t } = useI18n();
|
|
2795
2806
|
const eyebrow = eyebrowProp === void 0 ? labels?.eyebrow ?? t("signUp.eyebrow") : eyebrowProp;
|
|
2796
2807
|
const title = titleProp === void 0 ? labels?.title ?? t("signUp.title") : titleProp;
|
|
@@ -2936,6 +2947,7 @@ function SignUpForm({ labels, fields, messages, unavailable, policyLoading = fal
|
|
|
2936
2947
|
children: [
|
|
2937
2948
|
/* @__PURE__ */ jsx(FieldLabel, { children: field.label }),
|
|
2938
2949
|
/* @__PURE__ */ jsx(Input, {
|
|
2950
|
+
size: fieldSize,
|
|
2939
2951
|
id: `${fieldPrefix}-field-${field.id}`,
|
|
2940
2952
|
type: field.type ?? "text",
|
|
2941
2953
|
autoComplete: field.autoComplete,
|
|
@@ -2959,6 +2971,7 @@ function SignUpForm({ labels, fields, messages, unavailable, policyLoading = fal
|
|
|
2959
2971
|
children: [
|
|
2960
2972
|
/* @__PURE__ */ jsx(FieldLabel, { children: labels?.name ?? t("signUp.name") }),
|
|
2961
2973
|
/* @__PURE__ */ jsx(Input, {
|
|
2974
|
+
size: fieldSize,
|
|
2962
2975
|
leadingIcon: User,
|
|
2963
2976
|
autoComplete: "name",
|
|
2964
2977
|
placeholder: labels?.namePlaceholder ?? t("signUp.namePlaceholder"),
|
|
@@ -2976,6 +2989,7 @@ function SignUpForm({ labels, fields, messages, unavailable, policyLoading = fal
|
|
|
2976
2989
|
children: [
|
|
2977
2990
|
/* @__PURE__ */ jsx(FieldLabel, { children: labels?.email ?? t("signUp.email") }),
|
|
2978
2991
|
/* @__PURE__ */ jsx(Input, {
|
|
2992
|
+
size: fieldSize,
|
|
2979
2993
|
type: "email",
|
|
2980
2994
|
leadingIcon: Mail,
|
|
2981
2995
|
autoComplete: "email",
|
|
@@ -2995,6 +3009,7 @@ function SignUpForm({ labels, fields, messages, unavailable, policyLoading = fal
|
|
|
2995
3009
|
children: [
|
|
2996
3010
|
/* @__PURE__ */ jsx(FieldLabel, { children: labels?.password ?? t("signUp.password") }),
|
|
2997
3011
|
/* @__PURE__ */ jsx(PasswordInput, {
|
|
3012
|
+
size: fieldSize,
|
|
2998
3013
|
id: fields !== void 0 ? passwordId : void 0,
|
|
2999
3014
|
showStrength: true,
|
|
3000
3015
|
strength: password.length > 0 && password.length < minPasswordLength ? 0 : void 0,
|
|
@@ -3054,11 +3069,11 @@ function SignUpForm({ labels, fields, messages, unavailable, policyLoading = fal
|
|
|
3054
3069
|
}
|
|
3055
3070
|
//#endregion
|
|
3056
3071
|
//#region src/auth/SignUpForm/block.meta.ts
|
|
3057
|
-
const meta$
|
|
3072
|
+
const meta$63 = {
|
|
3058
3073
|
name: "Sign-up form",
|
|
3059
3074
|
family: "auth",
|
|
3060
3075
|
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.",
|
|
3076
|
+
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
3077
|
labels: [
|
|
3063
3078
|
{
|
|
3064
3079
|
key: "eyebrow",
|
|
@@ -3192,7 +3207,7 @@ const meta$62 = {
|
|
|
3192
3207
|
};
|
|
3193
3208
|
//#endregion
|
|
3194
3209
|
//#region src/auth/SsoButtons/block.meta.ts
|
|
3195
|
-
const meta$
|
|
3210
|
+
const meta$67 = {
|
|
3196
3211
|
name: "SSO buttons",
|
|
3197
3212
|
family: "auth",
|
|
3198
3213
|
status: "stable",
|
|
@@ -3494,7 +3509,7 @@ const documentation$1 = {
|
|
|
3494
3509
|
"summary-actions-only"
|
|
3495
3510
|
]
|
|
3496
3511
|
};
|
|
3497
|
-
const meta$
|
|
3512
|
+
const meta$51 = {
|
|
3498
3513
|
name: "Plan card",
|
|
3499
3514
|
family: "billing",
|
|
3500
3515
|
status: "beta",
|
|
@@ -3652,7 +3667,7 @@ const documentation = {
|
|
|
3652
3667
|
],
|
|
3653
3668
|
examples: ["compact", "full"]
|
|
3654
3669
|
};
|
|
3655
|
-
const meta$
|
|
3670
|
+
const meta$52 = {
|
|
3656
3671
|
name: "Plan definition card",
|
|
3657
3672
|
family: "billing",
|
|
3658
3673
|
status: "beta",
|
|
@@ -3766,7 +3781,7 @@ function QuotaMeters({ quotas = sampleQuotas, title = "Plan usage", thresholds,
|
|
|
3766
3781
|
}
|
|
3767
3782
|
//#endregion
|
|
3768
3783
|
//#region src/billing/QuotaMeters/block.meta.ts
|
|
3769
|
-
const meta$
|
|
3784
|
+
const meta$56 = {
|
|
3770
3785
|
name: "Quota meters",
|
|
3771
3786
|
family: "billing",
|
|
3772
3787
|
status: "beta",
|
|
@@ -3885,7 +3900,7 @@ function SpendVsBudget({ data = sampleSpend, budget = sampleBudget, currency = "
|
|
|
3885
3900
|
}
|
|
3886
3901
|
//#endregion
|
|
3887
3902
|
//#region src/billing/SpendVsBudget/block.meta.ts
|
|
3888
|
-
const meta$
|
|
3903
|
+
const meta$66 = {
|
|
3889
3904
|
name: "Spend vs budget",
|
|
3890
3905
|
family: "billing",
|
|
3891
3906
|
status: "beta",
|
|
@@ -4114,7 +4129,7 @@ function PaymentMethodCard({ method = samplePaymentMethod, title = "Payment meth
|
|
|
4114
4129
|
className: "flex flex-wrap items-center gap-4 px-5 py-4",
|
|
4115
4130
|
children: [/* @__PURE__ */ jsx("span", {
|
|
4116
4131
|
"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
|
|
4132
|
+
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
4133
|
children: method.brand.slice(0, 4)
|
|
4119
4134
|
}), /* @__PURE__ */ jsxs("div", {
|
|
4120
4135
|
className: "min-w-0 flex-1",
|
|
@@ -4161,7 +4176,7 @@ function PaymentMethodCard({ method = samplePaymentMethod, title = "Payment meth
|
|
|
4161
4176
|
}
|
|
4162
4177
|
//#endregion
|
|
4163
4178
|
//#region src/billing/PaymentMethodCard/block.meta.ts
|
|
4164
|
-
const meta$
|
|
4179
|
+
const meta$49 = {
|
|
4165
4180
|
name: "Payment method card",
|
|
4166
4181
|
family: "billing",
|
|
4167
4182
|
status: "beta",
|
|
@@ -4688,7 +4703,7 @@ function FlowProblems({ issues, onSelect, titleAs: Title = "h3" }) {
|
|
|
4688
4703
|
}
|
|
4689
4704
|
//#endregion
|
|
4690
4705
|
//#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
|
|
4706
|
+
const panelTitle = "px-3 pt-3 pb-2 font-mono text-[10.5px] font-medium tracking-[0.12em] text-muted-foreground label-case";
|
|
4692
4707
|
/** Left rail: node kinds to add to the canvas. */
|
|
4693
4708
|
function NodePalette({ items, onAdd, titleAs: TitleTag = "h3" }) {
|
|
4694
4709
|
const titleId = useId();
|
|
@@ -4706,7 +4721,7 @@ function NodePalette({ items, onAdd, titleAs: TitleTag = "h3" }) {
|
|
|
4706
4721
|
onClick: () => onAdd(item),
|
|
4707
4722
|
"aria-label": `Add ${item.title}`,
|
|
4708
4723
|
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-
|
|
4724
|
+
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
4725
|
children: [
|
|
4711
4726
|
/* @__PURE__ */ jsx("span", {
|
|
4712
4727
|
className: cn("grid size-7 shrink-0 place-items-center rounded-md", KIND_CHIP[item.kind]),
|
|
@@ -4850,7 +4865,7 @@ function RunConsole({ entries, onClear, titleAs: TitleTag = "h3" }) {
|
|
|
4850
4865
|
role: "log",
|
|
4851
4866
|
"aria-label": "Run console",
|
|
4852
4867
|
tabIndex: 0,
|
|
4853
|
-
className: "flex-1 overflow-y-auto px-3 py-2 font-mono text-[11.5px] focus-
|
|
4868
|
+
className: "flex-1 overflow-y-auto px-3 py-2 font-mono text-[11.5px] focus-ring-inset",
|
|
4854
4869
|
children: entries.length === 0 ? /* @__PURE__ */ jsx("p", {
|
|
4855
4870
|
className: "font-sans text-[12.5px] text-muted-foreground",
|
|
4856
4871
|
children: "No output yet. Run the flow to see its steps."
|
|
@@ -4862,7 +4877,7 @@ function RunConsole({ entries, onClear, titleAs: TitleTag = "h3" }) {
|
|
|
4862
4877
|
children: e.time
|
|
4863
4878
|
}),
|
|
4864
4879
|
/* @__PURE__ */ jsx("span", {
|
|
4865
|
-
className: cn("w-14 shrink-0
|
|
4880
|
+
className: cn("w-14 shrink-0 label-case", CONSOLE_LEVEL[e.level]),
|
|
4866
4881
|
children: e.level
|
|
4867
4882
|
}),
|
|
4868
4883
|
/* @__PURE__ */ jsx("span", {
|
|
@@ -4890,16 +4905,6 @@ function cleanFlowGraph(graph) {
|
|
|
4890
4905
|
};
|
|
4891
4906
|
}
|
|
4892
4907
|
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
4908
|
function clock() {
|
|
4904
4909
|
return (/* @__PURE__ */ new Date()).toLocaleTimeString("en-GB", { hour12: false });
|
|
4905
4910
|
}
|
|
@@ -4912,7 +4917,7 @@ function FlowBuilder({ title = "Untitled flow", nodes: initialNodes = builderNod
|
|
|
4912
4917
|
const runMode = mode === "run";
|
|
4913
4918
|
const root = useRef(null);
|
|
4914
4919
|
const flow = useRef(null);
|
|
4915
|
-
const wide =
|
|
4920
|
+
const wide = useMediaQuery(breakpointQuery("md"), true);
|
|
4916
4921
|
const panelAs = TitleTag === "h2" ? "h3" : TitleTag === "h3" ? "h4" : "h5";
|
|
4917
4922
|
const { nodes, edges, setNodes, setEdges, onNodesChange, onEdgesChange } = useBuilderGraph({
|
|
4918
4923
|
nodes: initialNodes,
|
|
@@ -5591,8 +5596,9 @@ function CodePanel({ files = codeFiles, problems: suppliedProblems = codeProblem
|
|
|
5591
5596
|
}), /* @__PURE__ */ jsxs(ToggleGroup, {
|
|
5592
5597
|
"aria-label": "Editor view",
|
|
5593
5598
|
size: "sm",
|
|
5599
|
+
disallowEmptySelection: true,
|
|
5594
5600
|
value: [effectiveView],
|
|
5595
|
-
onValueChange: (v) =>
|
|
5601
|
+
onValueChange: (v) => setView(v[0]),
|
|
5596
5602
|
className: "mb-2 self-start sm:self-auto",
|
|
5597
5603
|
children: [/* @__PURE__ */ jsx(Toggle, {
|
|
5598
5604
|
value: "code",
|
|
@@ -5640,7 +5646,7 @@ function CodePanel({ files = codeFiles, problems: suppliedProblems = codeProblem
|
|
|
5640
5646
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
5641
5647
|
className: "flex items-center gap-3 bg-secondary/35 px-3 py-2",
|
|
5642
5648
|
children: [/* @__PURE__ */ jsx(ProblemsHeading, {
|
|
5643
|
-
className: "text-[12px] font-semibold tracking-wide text-foreground
|
|
5649
|
+
className: "text-[12px] font-semibold tracking-wide text-foreground label-case",
|
|
5644
5650
|
children: "Problems"
|
|
5645
5651
|
}), /* @__PURE__ */ jsxs("span", {
|
|
5646
5652
|
className: "font-mono text-[11px] text-muted-foreground",
|
|
@@ -5666,7 +5672,7 @@ function CodePanel({ files = codeFiles, problems: suppliedProblems = codeProblem
|
|
|
5666
5672
|
return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs("button", {
|
|
5667
5673
|
type: "button",
|
|
5668
5674
|
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-
|
|
5675
|
+
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
5676
|
children: [
|
|
5671
5677
|
/* @__PURE__ */ jsx(SevIcon, {
|
|
5672
5678
|
size: 14,
|
|
@@ -5875,12 +5881,15 @@ function LogViewer({ lines = logLines, title: titleProp, labels, height = 360, r
|
|
|
5875
5881
|
const title = titleProp ?? labels?.title ?? t("logViewer.title");
|
|
5876
5882
|
const titleId = useId();
|
|
5877
5883
|
const viewport = useRef(null);
|
|
5884
|
+
const lastFollowTop = useRef(null);
|
|
5878
5885
|
const copyTimer = useRef(void 0);
|
|
5879
5886
|
const [levels, setLevels] = useState(defaultLevels);
|
|
5880
5887
|
const [query, setQuery] = useState("");
|
|
5881
5888
|
const [follow, setFollow] = useState(defaultFollow);
|
|
5882
5889
|
const [scrollTop, setScrollTop] = useState(0);
|
|
5883
|
-
const [
|
|
5890
|
+
const [copyResult, setCopyResult] = useState(null);
|
|
5891
|
+
const mounted = useRef(true);
|
|
5892
|
+
const copyAttempt = useRef(0);
|
|
5884
5893
|
const counts = useMemo(() => {
|
|
5885
5894
|
const c = {
|
|
5886
5895
|
debug: 0,
|
|
@@ -5913,20 +5922,53 @@ function LogViewer({ lines = logLines, title: titleProp, labels, height = 360, r
|
|
|
5913
5922
|
const end = wrap ? wrapped.end : Math.min(visible.length, Math.ceil((offset + height) / rowHeight) + overscan);
|
|
5914
5923
|
const rows = visible.slice(start, end);
|
|
5915
5924
|
useEffect(() => {
|
|
5916
|
-
|
|
5917
|
-
|
|
5918
|
-
|
|
5925
|
+
const node = viewport.current;
|
|
5926
|
+
if (!follow || !node) {
|
|
5927
|
+
lastFollowTop.current = null;
|
|
5928
|
+
return;
|
|
5929
|
+
}
|
|
5930
|
+
if (lastFollowTop.current !== null && node.scrollTop < Math.min(lastFollowTop.current, maxScroll) - rowHeight) {
|
|
5931
|
+
setScrollTop(node.scrollTop);
|
|
5932
|
+
setFollow(false);
|
|
5933
|
+
return;
|
|
5934
|
+
}
|
|
5935
|
+
node.scrollTop = maxScroll;
|
|
5936
|
+
lastFollowTop.current = node.scrollTop;
|
|
5937
|
+
}, [
|
|
5938
|
+
follow,
|
|
5939
|
+
maxScroll,
|
|
5940
|
+
rowHeight
|
|
5941
|
+
]);
|
|
5942
|
+
useEffect(() => {
|
|
5943
|
+
mounted.current = true;
|
|
5944
|
+
return () => {
|
|
5945
|
+
mounted.current = false;
|
|
5946
|
+
copyAttempt.current += 1;
|
|
5947
|
+
clearTimeout(copyTimer.current);
|
|
5948
|
+
};
|
|
5949
|
+
}, []);
|
|
5919
5950
|
const onScroll = (event) => {
|
|
5920
5951
|
const top = event.currentTarget.scrollTop;
|
|
5921
5952
|
setScrollTop(top);
|
|
5922
5953
|
if (follow && top < maxScroll - rowHeight) setFollow(false);
|
|
5923
5954
|
};
|
|
5924
|
-
const copy = (line) => {
|
|
5925
|
-
navigator.clipboard?.writeText(lineText(line)).catch(() => void 0);
|
|
5926
|
-
onCopyLine?.(line);
|
|
5927
|
-
setCopied(line.id);
|
|
5955
|
+
const copy = async (line) => {
|
|
5928
5956
|
clearTimeout(copyTimer.current);
|
|
5929
|
-
|
|
5957
|
+
const current = ++copyAttempt.current;
|
|
5958
|
+
let status = "failed";
|
|
5959
|
+
try {
|
|
5960
|
+
await copyToClipboard(lineText(line));
|
|
5961
|
+
status = "copied";
|
|
5962
|
+
} catch {}
|
|
5963
|
+
if (!mounted.current) return;
|
|
5964
|
+
if (current === copyAttempt.current) {
|
|
5965
|
+
setCopyResult({
|
|
5966
|
+
id: line.id,
|
|
5967
|
+
status
|
|
5968
|
+
});
|
|
5969
|
+
copyTimer.current = setTimeout(() => setCopyResult(null), 1500);
|
|
5970
|
+
}
|
|
5971
|
+
if (status === "copied") onCopyLine?.(line);
|
|
5930
5972
|
};
|
|
5931
5973
|
return /* @__PURE__ */ jsxs("section", {
|
|
5932
5974
|
"aria-labelledby": titleId,
|
|
@@ -5963,12 +6005,10 @@ function LogViewer({ lines = logLines, title: titleProp, labels, height = 360, r
|
|
|
5963
6005
|
})]
|
|
5964
6006
|
}, lv))
|
|
5965
6007
|
}),
|
|
5966
|
-
/* @__PURE__ */ jsx(
|
|
6008
|
+
/* @__PURE__ */ jsx(SearchField, {
|
|
5967
6009
|
size: "sm",
|
|
5968
|
-
type: "search",
|
|
5969
6010
|
"aria-label": labels?.searchLabel ?? t("logViewer.searchLabel"),
|
|
5970
6011
|
placeholder: labels?.searchPlaceholder ?? t("logViewer.searchPlaceholder"),
|
|
5971
|
-
leadingIcon: Search,
|
|
5972
6012
|
value: query,
|
|
5973
6013
|
onValueChange: (v) => setQuery(String(v)),
|
|
5974
6014
|
className: "w-full sm:w-48"
|
|
@@ -5988,7 +6028,7 @@ function LogViewer({ lines = logLines, title: titleProp, labels, height = 360, r
|
|
|
5988
6028
|
"aria-live": announceLines && follow ? "polite" : "off",
|
|
5989
6029
|
tabIndex: 0,
|
|
5990
6030
|
onScroll,
|
|
5991
|
-
className: "relative overflow-auto bg-background font-mono text-[12px] focus-
|
|
6031
|
+
className: "relative overflow-auto bg-background font-mono text-[12px] focus-ring-inset",
|
|
5992
6032
|
style: { height },
|
|
5993
6033
|
children: visible.length === 0 ? /* @__PURE__ */ jsx("p", {
|
|
5994
6034
|
className: "px-4 py-6 text-center font-sans text-[13px] text-muted-foreground",
|
|
@@ -5998,6 +6038,7 @@ function LogViewer({ lines = logLines, title: titleProp, labels, height = 360, r
|
|
|
5998
6038
|
style: { height: total },
|
|
5999
6039
|
children: rows.map((line, i) => {
|
|
6000
6040
|
const lv = LEVEL_STYLE[line.level];
|
|
6041
|
+
const status = copyResult?.id === line.id ? copyResult.status : "idle";
|
|
6001
6042
|
return /* @__PURE__ */ jsxs("div", {
|
|
6002
6043
|
"data-slot": "log-line",
|
|
6003
6044
|
ref: wrap ? (node) => wrapped.measureRow(node, line.id) : void 0,
|
|
@@ -6044,8 +6085,8 @@ function LogViewer({ lines = logLines, title: titleProp, labels, height = 360, r
|
|
|
6044
6085
|
}),
|
|
6045
6086
|
/* @__PURE__ */ jsx(IconButton, {
|
|
6046
6087
|
size: "sm",
|
|
6047
|
-
icon:
|
|
6048
|
-
label:
|
|
6088
|
+
icon: status === "failed" ? X : status === "copied" ? Check : Copy,
|
|
6089
|
+
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
6090
|
onClick: (event) => {
|
|
6050
6091
|
if (onSelectLine) event.stopPropagation();
|
|
6051
6092
|
copy(line);
|
|
@@ -6065,7 +6106,7 @@ const meta$39 = {
|
|
|
6065
6106
|
name: "Log viewer",
|
|
6066
6107
|
family: "builders",
|
|
6067
6108
|
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.",
|
|
6109
|
+
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
6110
|
labels: [
|
|
6070
6111
|
{
|
|
6071
6112
|
key: "title",
|
|
@@ -6117,6 +6158,11 @@ const meta$39 = {
|
|
|
6117
6158
|
type: "(timestamp: string) => string",
|
|
6118
6159
|
state: "Copy button before copying"
|
|
6119
6160
|
},
|
|
6161
|
+
{
|
|
6162
|
+
key: "copyFailed",
|
|
6163
|
+
type: "string",
|
|
6164
|
+
state: "Copy button after a failed write, only on the affected line"
|
|
6165
|
+
},
|
|
6120
6166
|
{
|
|
6121
6167
|
key: "copied",
|
|
6122
6168
|
type: "string",
|
|
@@ -6284,54 +6330,64 @@ const KPI_ITEMS = [
|
|
|
6284
6330
|
//#endregion
|
|
6285
6331
|
//#region src/data-display/KpiRow/KpiRow.tsx
|
|
6286
6332
|
const COLS$3 = {
|
|
6287
|
-
1: "
|
|
6288
|
-
2: "
|
|
6289
|
-
3: "
|
|
6290
|
-
4: "
|
|
6291
|
-
5: "
|
|
6333
|
+
1: "@4xl:grid-cols-1",
|
|
6334
|
+
2: "@4xl:grid-cols-2",
|
|
6335
|
+
3: "@4xl:grid-cols-3",
|
|
6336
|
+
4: "@4xl:grid-cols-4",
|
|
6337
|
+
5: "@4xl:grid-cols-5"
|
|
6338
|
+
};
|
|
6339
|
+
const STRIP_DIVIDERS = {
|
|
6340
|
+
1: "",
|
|
6341
|
+
2: "@4xl:[&>div:not(:nth-child(2n)):not(:last-child)]:border-e",
|
|
6342
|
+
3: "@4xl:[&>div:not(:nth-child(3n)):not(:last-child)]:border-e",
|
|
6343
|
+
4: "@4xl:[&>div:not(:nth-child(4n)):not(:last-child)]:border-e",
|
|
6344
|
+
5: "@4xl:[&>div:not(:nth-child(5n)):not(:last-child)]:border-e"
|
|
6292
6345
|
};
|
|
6293
6346
|
/**
|
|
6294
6347
|
* KPI row: label, big number, delta (direction and sentiment are independent) and an optional
|
|
6295
6348
|
* Sparkline. A description list, so each label is announced with its value.
|
|
6296
6349
|
*/
|
|
6297
|
-
function KpiRow({ items = KPI_ITEMS, variant = "cards", showTrends = true, label = "Key metrics", className }) {
|
|
6350
|
+
function KpiRow({ items = KPI_ITEMS, variant = "cards", showTrends = true, label = "Key metrics", className, containerClassName }) {
|
|
6298
6351
|
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
|
-
|
|
6352
|
+
const cols = COLS$3[Math.min(items.length, 5)] ?? "@4xl:grid-cols-4";
|
|
6353
|
+
return /* @__PURE__ */ jsx("div", {
|
|
6354
|
+
className: cn("@container w-full min-w-0", containerClassName),
|
|
6355
|
+
children: /* @__PURE__ */ jsx("dl", {
|
|
6356
|
+
"aria-label": label,
|
|
6357
|
+
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),
|
|
6358
|
+
children: items.map((item) => /* @__PURE__ */ jsxs("div", {
|
|
6359
|
+
className: cn("flex min-w-0 flex-col", strip ? "px-5 py-4" : "rounded-xl border border-border bg-card p-5 shadow-sm"),
|
|
6360
|
+
children: [
|
|
6361
|
+
/* @__PURE__ */ jsx("dt", {
|
|
6362
|
+
className: cn("truncate font-medium text-muted-foreground", strip ? "text-[12px]" : "text-[13px]"),
|
|
6363
|
+
children: item.label
|
|
6364
|
+
}),
|
|
6365
|
+
/* @__PURE__ */ jsxs("dd", {
|
|
6366
|
+
className: "mt-2 flex flex-wrap items-baseline gap-x-2 gap-y-1",
|
|
6367
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
6368
|
+
className: cn("font-semibold tracking-tight text-foreground tabular-nums", strip ? "text-[22px]" : "text-[26px]"),
|
|
6369
|
+
children: item.value
|
|
6370
|
+
}), item.delta && /* @__PURE__ */ jsx(TrendDelta, { ...item.delta })]
|
|
6371
|
+
}),
|
|
6372
|
+
item.delta?.note && !strip && /* @__PURE__ */ jsx("dd", {
|
|
6373
|
+
className: "mt-1 text-[12px] text-muted-foreground",
|
|
6374
|
+
children: item.delta.note
|
|
6375
|
+
}),
|
|
6376
|
+
showTrends && item.trend && item.trend.length > 1 && /* @__PURE__ */ jsx("dd", {
|
|
6377
|
+
className: "mt-3",
|
|
6378
|
+
children: /* @__PURE__ */ jsx(Sparkline, {
|
|
6379
|
+
data: item.trend,
|
|
6380
|
+
label: item.label,
|
|
6381
|
+
area: true,
|
|
6382
|
+
tone: item.trendTone ?? "primary",
|
|
6383
|
+
width: 240,
|
|
6384
|
+
height: 40,
|
|
6385
|
+
className: "block h-auto w-full"
|
|
6386
|
+
})
|
|
6331
6387
|
})
|
|
6332
|
-
|
|
6333
|
-
|
|
6334
|
-
}
|
|
6388
|
+
]
|
|
6389
|
+
}, item.id))
|
|
6390
|
+
})
|
|
6335
6391
|
});
|
|
6336
6392
|
}
|
|
6337
6393
|
//#endregion
|
|
@@ -6510,7 +6566,7 @@ function StatCard({ label = "Requests", icon: IconCmp = Activity, ranges = STAT_
|
|
|
6510
6566
|
}
|
|
6511
6567
|
//#endregion
|
|
6512
6568
|
//#region src/data-display/StatCard/block.meta.ts
|
|
6513
|
-
const meta$
|
|
6569
|
+
const meta$68 = {
|
|
6514
6570
|
name: "Stat card",
|
|
6515
6571
|
family: "data-display",
|
|
6516
6572
|
status: "beta",
|
|
@@ -6722,7 +6778,7 @@ function ChartCard({ title = "Infrastructure cost", description = "Spend by reso
|
|
|
6722
6778
|
return /* @__PURE__ */ jsx(ChartLocaleProvider, {
|
|
6723
6779
|
locale,
|
|
6724
6780
|
children: /* @__PURE__ */ jsxs(Card, {
|
|
6725
|
-
className,
|
|
6781
|
+
className: cn("@container w-full min-w-0", className),
|
|
6726
6782
|
children: [
|
|
6727
6783
|
/* @__PURE__ */ jsxs(CardHeader, {
|
|
6728
6784
|
className: "pb-2",
|
|
@@ -6767,7 +6823,7 @@ function ChartCard({ title = "Infrastructure cost", description = "Spend by reso
|
|
|
6767
6823
|
}), active.summary.delta && /* @__PURE__ */ jsx(TrendDelta, { ...active.summary.delta })]
|
|
6768
6824
|
}),
|
|
6769
6825
|
/* @__PURE__ */ jsx("div", {
|
|
6770
|
-
className: cn("px-3 pb-4 pt-3 sm:px-4", !footer && "pb-5"),
|
|
6826
|
+
className: cn("px-3 pb-4 pt-3 @sm:px-4", !footer && "pb-5"),
|
|
6771
6827
|
children: kind === "heatmap" ? /* @__PURE__ */ jsx(Heatmap, {
|
|
6772
6828
|
data,
|
|
6773
6829
|
index,
|
|
@@ -6863,22 +6919,15 @@ const DEPLOYMENT_DETAILS = [
|
|
|
6863
6919
|
//#region src/data-display/DescriptionListCard/DescriptionListCard.tsx
|
|
6864
6920
|
function CopyButton$1({ item, onCopy, labels }) {
|
|
6865
6921
|
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
|
-
};
|
|
6922
|
+
const { status, copied, copy: copyText } = useClipboard({
|
|
6923
|
+
timeout: 1500,
|
|
6924
|
+
onCopy: () => onCopy?.(item)
|
|
6925
|
+
});
|
|
6926
|
+
const failedText = labels?.copyFailed ?? t("common.copyFailed");
|
|
6927
|
+
const copy = () => copyText(item.copyValue ?? item.value ?? "");
|
|
6879
6928
|
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 }),
|
|
6929
|
+
icon: status === "failed" ? X : copied ? Check : Copy,
|
|
6930
|
+
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
6931
|
size: "sm",
|
|
6883
6932
|
variant: "ghost",
|
|
6884
6933
|
className: cn("size-7 shrink-0", copied && "text-success-text"),
|
|
@@ -6886,7 +6935,7 @@ function CopyButton$1({ item, onCopy, labels }) {
|
|
|
6886
6935
|
}), /* @__PURE__ */ jsx("span", {
|
|
6887
6936
|
className: "sr-only",
|
|
6888
6937
|
"aria-live": "polite",
|
|
6889
|
-
children: copied ? labels?.copiedToClipboard ?? t("common.copiedToClipboard") : ""
|
|
6938
|
+
children: status === "failed" ? failedText : copied ? labels?.copiedToClipboard ?? t("common.copiedToClipboard") : ""
|
|
6890
6939
|
})] });
|
|
6891
6940
|
}
|
|
6892
6941
|
/** Key–value detail card: label column, values (mono, status or rich), copy buttons and an Edit action. */
|
|
@@ -6949,7 +6998,7 @@ const meta$18 = {
|
|
|
6949
6998
|
name: "Description list card",
|
|
6950
6999
|
family: "data-display",
|
|
6951
7000
|
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.",
|
|
7001
|
+
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
7002
|
labels: [
|
|
6954
7003
|
{
|
|
6955
7004
|
key: "title",
|
|
@@ -6976,6 +7025,11 @@ const meta$18 = {
|
|
|
6976
7025
|
type: "(label: string) => string",
|
|
6977
7026
|
state: "Copy button name after copying; original item label"
|
|
6978
7027
|
},
|
|
7028
|
+
{
|
|
7029
|
+
key: "copyFailed",
|
|
7030
|
+
type: "string",
|
|
7031
|
+
state: "Copy button name and polite announcement after a failed write"
|
|
7032
|
+
},
|
|
6979
7033
|
{
|
|
6980
7034
|
key: "copiedToClipboard",
|
|
6981
7035
|
type: "string",
|
|
@@ -7081,12 +7135,12 @@ const RESOURCE_CARDS = [
|
|
|
7081
7135
|
//#endregion
|
|
7082
7136
|
//#region src/data-display/ResourceCardGrid/ResourceCardGrid.tsx
|
|
7083
7137
|
const COLS$2 = {
|
|
7084
|
-
2: "
|
|
7085
|
-
3: "
|
|
7086
|
-
4: "
|
|
7138
|
+
2: "@xl:grid-cols-2",
|
|
7139
|
+
3: "@xl:grid-cols-2 @4xl:grid-cols-3",
|
|
7140
|
+
4: "@xl:grid-cols-2 @3xl:grid-cols-3 @4xl:grid-cols-4"
|
|
7087
7141
|
};
|
|
7088
7142
|
/** 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 }) {
|
|
7143
|
+
function ResourceCardGrid({ items = RESOURCE_CARDS, label = "Resources", onAction, getActions, columns = 3, titleAs: TitleTag = "h3", className, containerClassName }) {
|
|
7090
7144
|
const defaults = (item) => [
|
|
7091
7145
|
{
|
|
7092
7146
|
label: "Open",
|
|
@@ -7111,69 +7165,72 @@ function ResourceCardGrid({ items = RESOURCE_CARDS, label = "Resources", onActio
|
|
|
7111
7165
|
onSelect: () => onAction?.("delete", item)
|
|
7112
7166
|
}
|
|
7113
7167
|
];
|
|
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
|
-
|
|
7168
|
+
return /* @__PURE__ */ jsx("div", {
|
|
7169
|
+
className: cn("@container w-full min-w-0", containerClassName),
|
|
7170
|
+
children: /* @__PURE__ */ jsx("ul", {
|
|
7171
|
+
"aria-label": label,
|
|
7172
|
+
className: cn("grid grid-cols-1 gap-4", COLS$2[columns], className),
|
|
7173
|
+
children: items.map((item) => {
|
|
7174
|
+
const actions = getActions ? getActions(item) : defaults(item);
|
|
7175
|
+
const IconCmp = item.icon;
|
|
7176
|
+
return /* @__PURE__ */ jsxs("li", {
|
|
7177
|
+
className: "flex min-w-0 flex-col rounded-xl border border-border bg-card p-5 shadow-sm",
|
|
7178
|
+
children: [
|
|
7179
|
+
/* @__PURE__ */ jsxs("div", {
|
|
7180
|
+
className: "flex items-start justify-between gap-3",
|
|
7181
|
+
children: [item.avatar ? /* @__PURE__ */ jsx(Avatar, {
|
|
7182
|
+
name: item.avatar.name,
|
|
7183
|
+
src: item.avatar.src,
|
|
7184
|
+
size: "md",
|
|
7185
|
+
shape: "rounded"
|
|
7186
|
+
}) : /* @__PURE__ */ jsx("span", {
|
|
7187
|
+
className: "inline-flex size-10 shrink-0 items-center justify-center rounded-lg bg-secondary text-muted-foreground",
|
|
7188
|
+
children: IconCmp && /* @__PURE__ */ jsx(IconCmp, {
|
|
7189
|
+
size: 20,
|
|
7190
|
+
"aria-hidden": true
|
|
7191
|
+
})
|
|
7192
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
7193
|
+
className: "flex items-center gap-2",
|
|
7194
|
+
children: [item.status && /* @__PURE__ */ jsx(StatusTag, { status: item.status }), actions.length > 0 && /* @__PURE__ */ jsx(MoreMenu, {
|
|
7195
|
+
items: actions,
|
|
7196
|
+
label: `Actions for ${item.name}`,
|
|
7197
|
+
variant: "ghost",
|
|
7198
|
+
size: "sm"
|
|
7199
|
+
})]
|
|
7143
7200
|
})]
|
|
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
|
|
7201
|
+
}),
|
|
7202
|
+
/* @__PURE__ */ jsxs("div", {
|
|
7203
|
+
className: "mt-4 min-w-0",
|
|
7204
|
+
children: [/* @__PURE__ */ jsx(TitleTag, {
|
|
7205
|
+
className: "truncate text-[14px] font-semibold text-foreground",
|
|
7206
|
+
children: item.name
|
|
7207
|
+
}), item.description && /* @__PURE__ */ jsx("p", {
|
|
7208
|
+
className: "mt-0.5 truncate text-[12.5px] text-muted-foreground",
|
|
7209
|
+
children: item.description
|
|
7166
7210
|
})]
|
|
7167
|
-
},
|
|
7168
|
-
|
|
7169
|
-
|
|
7170
|
-
|
|
7211
|
+
}),
|
|
7212
|
+
item.meta && item.meta.length > 0 && /* @__PURE__ */ jsx("dl", {
|
|
7213
|
+
className: "mt-4 grid grid-cols-2 gap-3 border-t border-border pt-4",
|
|
7214
|
+
children: item.meta.map((m) => /* @__PURE__ */ jsxs("div", {
|
|
7215
|
+
className: "flex min-w-0 flex-col-reverse",
|
|
7216
|
+
children: [/* @__PURE__ */ jsx("dt", {
|
|
7217
|
+
className: "truncate text-[11px] text-muted-foreground",
|
|
7218
|
+
children: m.label
|
|
7219
|
+
}), /* @__PURE__ */ jsx("dd", {
|
|
7220
|
+
className: "truncate font-mono text-[14px] text-foreground tabular-nums",
|
|
7221
|
+
children: m.value
|
|
7222
|
+
})]
|
|
7223
|
+
}, m.label))
|
|
7224
|
+
})
|
|
7225
|
+
]
|
|
7226
|
+
}, item.id);
|
|
7227
|
+
})
|
|
7171
7228
|
})
|
|
7172
7229
|
});
|
|
7173
7230
|
}
|
|
7174
7231
|
//#endregion
|
|
7175
7232
|
//#region src/data-display/ResourceCardGrid/block.meta.ts
|
|
7176
|
-
const meta$
|
|
7233
|
+
const meta$58 = {
|
|
7177
7234
|
name: "Resource card grid",
|
|
7178
7235
|
family: "data-display",
|
|
7179
7236
|
status: "beta",
|
|
@@ -7281,7 +7338,7 @@ function StatusTimeline({ events = DEPLOYMENT_EVENTS, label: labelProp, emptyLab
|
|
|
7281
7338
|
className: "absolute top-5 bottom-0 start-[9px] w-px bg-border"
|
|
7282
7339
|
}),
|
|
7283
7340
|
/* @__PURE__ */ jsx("span", {
|
|
7284
|
-
className: "relative z-
|
|
7341
|
+
className: "relative z-raised mt-1 flex size-5 shrink-0 items-center justify-center rounded-full bg-card",
|
|
7285
7342
|
children: /* @__PURE__ */ jsx(StatusDot, {
|
|
7286
7343
|
tone: event.tone,
|
|
7287
7344
|
pulse: event.live,
|
|
@@ -7334,7 +7391,7 @@ function StatusTimeline({ events = DEPLOYMENT_EVENTS, label: labelProp, emptyLab
|
|
|
7334
7391
|
}
|
|
7335
7392
|
//#endregion
|
|
7336
7393
|
//#region src/data-display/StatusTimeline/block.meta.ts
|
|
7337
|
-
const meta$
|
|
7394
|
+
const meta$69 = {
|
|
7338
7395
|
name: "Status timeline",
|
|
7339
7396
|
family: "data-display",
|
|
7340
7397
|
status: "beta",
|
|
@@ -7440,7 +7497,7 @@ function ActivityFeed({ items = PROJECT_ACTIVITY, label = "Recent activity", now
|
|
|
7440
7497
|
const headingId = `${id}-${group.key}`;
|
|
7441
7498
|
return /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(GroupTag, {
|
|
7442
7499
|
id: headingId,
|
|
7443
|
-
className: "mb-3 font-mono text-[10.5px] font-medium tracking-[0.12em] text-muted-foreground
|
|
7500
|
+
className: "mb-3 font-mono text-[10.5px] font-medium tracking-[0.12em] text-muted-foreground label-case",
|
|
7444
7501
|
children: group.label
|
|
7445
7502
|
}), /* @__PURE__ */ jsx("ul", {
|
|
7446
7503
|
"aria-labelledby": headingId,
|
|
@@ -7534,8 +7591,8 @@ const REVIEW_COMMENTS = [
|
|
|
7534
7591
|
];
|
|
7535
7592
|
//#endregion
|
|
7536
7593
|
//#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 }) {
|
|
7594
|
+
/** Comment thread: avatar, author, plain text (or Markdown via renderBody) and Timestamp, with a reply composer (⌘/Ctrl+Enter posts). */
|
|
7595
|
+
function CommentThread({ comments = REVIEW_COMMENTS, renderBody, currentUser = COMMENT_AUTHOR, onSubmit, appendOnSubmit = true, label: labelProp, placeholder: placeholderProp, submitLabel: submitLabelProp, composerHint, className }) {
|
|
7539
7596
|
const { t } = useI18n();
|
|
7540
7597
|
const label = labelProp ?? t("comments.label");
|
|
7541
7598
|
const placeholder = placeholderProp ?? t("comments.placeholder");
|
|
@@ -7583,7 +7640,7 @@ function CommentThread({ comments = REVIEW_COMMENTS, currentUser = COMMENT_AUTHO
|
|
|
7583
7640
|
name: comment.author.name,
|
|
7584
7641
|
src: comment.author.src,
|
|
7585
7642
|
size: "sm",
|
|
7586
|
-
className: "relative z-
|
|
7643
|
+
className: "relative z-raised"
|
|
7587
7644
|
}),
|
|
7588
7645
|
/* @__PURE__ */ jsxs("article", {
|
|
7589
7646
|
className: "min-w-0 flex-1 rounded-lg border border-border bg-background/50 p-3",
|
|
@@ -7596,7 +7653,10 @@ function CommentThread({ comments = REVIEW_COMMENTS, currentUser = COMMENT_AUTHO
|
|
|
7596
7653
|
value: comment.at,
|
|
7597
7654
|
className: "font-mono text-[11px]"
|
|
7598
7655
|
})]
|
|
7599
|
-
}), /* @__PURE__ */ jsx("
|
|
7656
|
+
}), renderBody ? /* @__PURE__ */ jsx("div", {
|
|
7657
|
+
className: "mt-1 text-[13px] leading-relaxed text-foreground/85",
|
|
7658
|
+
children: renderBody(comment)
|
|
7659
|
+
}) : /* @__PURE__ */ jsx("p", {
|
|
7600
7660
|
className: "mt-1 text-[13px] leading-relaxed whitespace-pre-line text-foreground/85",
|
|
7601
7661
|
children: comment.body
|
|
7602
7662
|
})]
|
|
@@ -7627,7 +7687,7 @@ function CommentThread({ comments = REVIEW_COMMENTS, currentUser = COMMENT_AUTHO
|
|
|
7627
7687
|
children: [/* @__PURE__ */ jsx("span", {
|
|
7628
7688
|
id: hintId,
|
|
7629
7689
|
className: "text-[11.5px] text-muted-foreground",
|
|
7630
|
-
children:
|
|
7690
|
+
children: composerHint ?? t(renderBody ? "comments.hintMarkdown" : "comments.hintPlain")
|
|
7631
7691
|
}), /* @__PURE__ */ jsx(Button, {
|
|
7632
7692
|
type: "submit",
|
|
7633
7693
|
size: "sm",
|
|
@@ -7645,7 +7705,7 @@ const meta$8 = {
|
|
|
7645
7705
|
name: "Comment thread",
|
|
7646
7706
|
family: "data-display",
|
|
7647
7707
|
status: "beta",
|
|
7648
|
-
description: "Plain-text comments with avatar, author and Timestamp, plus a reply composer (Textarea + Button, ⌘/Ctrl+Enter posts).",
|
|
7708
|
+
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
7709
|
uses: [
|
|
7650
7710
|
"Avatar",
|
|
7651
7711
|
"Timestamp",
|
|
@@ -7736,7 +7796,7 @@ function SystemBanner({ kind = "maintenance", title = "Scheduled maintenance.",
|
|
|
7736
7796
|
}
|
|
7737
7797
|
//#endregion
|
|
7738
7798
|
//#region src/feedback/SystemBanner/block.meta.ts
|
|
7739
|
-
const meta$
|
|
7799
|
+
const meta$72 = {
|
|
7740
7800
|
name: "System banner",
|
|
7741
7801
|
family: "feedback",
|
|
7742
7802
|
status: "beta",
|
|
@@ -7858,7 +7918,7 @@ function FirstRunEmpty({ icon = FolderPlus, title: titleProp, labels, descriptio
|
|
|
7858
7918
|
const { t } = useI18n();
|
|
7859
7919
|
const title = titleProp === void 0 ? labels?.title ?? t("emptyState.firstRun.title") : titleProp;
|
|
7860
7920
|
const description = descriptionProp === void 0 ? labels?.description ?? t("emptyState.firstRun.description") : descriptionProp;
|
|
7861
|
-
const actionLabel = actionLabelProp
|
|
7921
|
+
const actionLabel = actionLabelProp === void 0 ? labels?.action ?? t("emptyState.firstRun.action") : actionLabelProp;
|
|
7862
7922
|
const secondary = secondaryProp === void 0 ? {
|
|
7863
7923
|
label: labels?.guide ?? t("emptyState.firstRun.guide"),
|
|
7864
7924
|
href: "#guide"
|
|
@@ -7870,10 +7930,10 @@ function FirstRunEmpty({ icon = FolderPlus, title: titleProp, labels, descriptio
|
|
|
7870
7930
|
description,
|
|
7871
7931
|
bordered,
|
|
7872
7932
|
className: cn("mx-auto", className),
|
|
7873
|
-
primaryAction: /* @__PURE__ */ jsx(Button, {
|
|
7933
|
+
primaryAction: actionLabel ? /* @__PURE__ */ jsx(Button, {
|
|
7874
7934
|
onClick: onAction,
|
|
7875
7935
|
children: actionLabel
|
|
7876
|
-
}),
|
|
7936
|
+
}) : void 0,
|
|
7877
7937
|
secondaryAction: secondary ? /* @__PURE__ */ jsx(Link, {
|
|
7878
7938
|
underline: "hover",
|
|
7879
7939
|
href: secondary.href,
|
|
@@ -7975,7 +8035,7 @@ const meta$20 = {
|
|
|
7975
8035
|
name: "Empty states",
|
|
7976
8036
|
family: "feedback",
|
|
7977
8037
|
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.",
|
|
8038
|
+
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
8039
|
labels: [
|
|
7980
8040
|
{
|
|
7981
8041
|
key: "FirstRunEmpty.labels.title",
|
|
@@ -8191,7 +8251,7 @@ function PageSkeleton({ stats = 4, rows = 5, label: labelProp, className }) {
|
|
|
8191
8251
|
}
|
|
8192
8252
|
//#endregion
|
|
8193
8253
|
//#region src/feedback/Skeletons/block.meta.ts
|
|
8194
|
-
const meta$
|
|
8254
|
+
const meta$65 = {
|
|
8195
8255
|
name: "Skeletons",
|
|
8196
8256
|
family: "feedback",
|
|
8197
8257
|
status: "beta",
|
|
@@ -8212,8 +8272,7 @@ function ErrorPanel({ icon: Icon = ServerCrash, title: titleProp, labels, messag
|
|
|
8212
8272
|
const retryLabel = retryLabelProp ?? labels?.retry ?? t("error.retry");
|
|
8213
8273
|
const id = useId();
|
|
8214
8274
|
const [innerRetrying, setInnerRetrying] = useState(false);
|
|
8215
|
-
const
|
|
8216
|
-
const copyTimer = useRef(void 0);
|
|
8275
|
+
const { copied, copy: copyText } = useClipboard();
|
|
8217
8276
|
const busy = retrying ?? innerRetrying;
|
|
8218
8277
|
const retry = async () => {
|
|
8219
8278
|
if (!onRetry || busy) return;
|
|
@@ -8224,17 +8283,7 @@ function ErrorPanel({ icon: Icon = ServerCrash, title: titleProp, labels, messag
|
|
|
8224
8283
|
setInnerRetrying(false);
|
|
8225
8284
|
}
|
|
8226
8285
|
};
|
|
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
|
-
};
|
|
8286
|
+
const copy = () => requestId && copyText(requestId);
|
|
8238
8287
|
return /* @__PURE__ */ jsx("section", {
|
|
8239
8288
|
"aria-labelledby": `${id}-title`,
|
|
8240
8289
|
className: cn("rounded-lg border border-destructive/30 bg-card p-5 shadow-sm", className),
|
|
@@ -8922,155 +8971,136 @@ function generateDemoSecret(prefix = "sk_live_") {
|
|
|
8922
8971
|
* Two-step API key dialog: name, scopes and expiry, then the secret shown once in a CodeBlock
|
|
8923
8972
|
* with copy. Closing the dialog discards the secret; it can't be shown again.
|
|
8924
8973
|
*/
|
|
8925
|
-
function CreateApiKeyDialog({ labels, scopes = apiKeyScopes, expiries = apiKeyExpiries, defaultExpiry = "90d", onCreate = () => generateDemoSecret(), open
|
|
8974
|
+
function CreateApiKeyDialog({ labels, scopes = apiKeyScopes, expiries = apiKeyExpiries, defaultExpiry = "90d", onCreate = () => generateDemoSecret(), open, defaultOpen = false, onOpenChange, trigger = /* @__PURE__ */ jsx(Button, { icon: KeyRound }) }) {
|
|
8926
8975
|
const { t } = useI18n();
|
|
8927
|
-
const [innerOpen, setInnerOpen] = useState(defaultOpen);
|
|
8928
8976
|
const [name, setName] = useState("");
|
|
8929
8977
|
const [selected, setSelected] = useState([]);
|
|
8930
8978
|
const [expiry, setExpiry] = useState(defaultExpiry);
|
|
8931
8979
|
const [submitted, setSubmitted] = useState(false);
|
|
8932
|
-
const [loading, setLoading] = useState(false);
|
|
8933
8980
|
const [error, setError] = useState(null);
|
|
8934
8981
|
const [secret, setSecret] = useState(null);
|
|
8935
|
-
const
|
|
8982
|
+
const opening = useRef(0);
|
|
8983
|
+
useEffect(() => {
|
|
8984
|
+
opening.current += 1;
|
|
8985
|
+
}, [open]);
|
|
8936
8986
|
const nameInvalid = submitted && name.trim() === "";
|
|
8937
8987
|
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);
|
|
8988
|
+
const formTitle = labels?.title ?? t("createApiKey.title");
|
|
8989
|
+
const reset = () => {
|
|
8990
|
+
opening.current += 1;
|
|
8991
|
+
setName("");
|
|
8992
|
+
setSelected([]);
|
|
8993
|
+
setExpiry(defaultExpiry);
|
|
8994
|
+
setSubmitted(false);
|
|
8953
8995
|
setError(null);
|
|
8954
|
-
|
|
8955
|
-
|
|
8996
|
+
setSecret(null);
|
|
8997
|
+
};
|
|
8998
|
+
const create = async () => {
|
|
8999
|
+
const current = opening.current;
|
|
8956
9000
|
try {
|
|
8957
|
-
const
|
|
9001
|
+
const created = await onCreate({
|
|
8958
9002
|
name: name.trim(),
|
|
8959
9003
|
scopes: selected,
|
|
8960
9004
|
expiry
|
|
8961
9005
|
});
|
|
8962
|
-
setSecret(
|
|
9006
|
+
if (current === opening.current) setSecret(created);
|
|
8963
9007
|
} catch (e) {
|
|
8964
|
-
setError(e instanceof Error ? e.message : labels?.fallbackError ?? t("createApiKey.fallbackError"));
|
|
9008
|
+
if (current === opening.current) setError(e instanceof Error ? e.message : labels?.fallbackError ?? t("createApiKey.fallbackError"));
|
|
8965
9009
|
}
|
|
8966
|
-
|
|
9010
|
+
return false;
|
|
8967
9011
|
};
|
|
8968
|
-
|
|
9012
|
+
const submit = () => {
|
|
9013
|
+
if (secret != null) return false;
|
|
9014
|
+
setSubmitted(true);
|
|
9015
|
+
setError(null);
|
|
9016
|
+
if (name.trim() === "" || selected.length === 0) return false;
|
|
9017
|
+
return create();
|
|
9018
|
+
};
|
|
9019
|
+
const triggerHasChildren = trigger != null && Children.count(trigger.props.children) > 0;
|
|
9020
|
+
const labelledTrigger = trigger == null || triggerHasChildren ? trigger : cloneElement(trigger, void 0, formTitle);
|
|
9021
|
+
return /* @__PURE__ */ jsx(FormDialog, {
|
|
9022
|
+
size: "lg",
|
|
9023
|
+
title: secret == null ? formTitle : labels?.successTitle ?? t("createApiKey.successTitle"),
|
|
9024
|
+
description: secret == null ? labels?.description ?? t("createApiKey.description") : labels?.successDescription ?? t("createApiKey.successDescription"),
|
|
9025
|
+
trigger: labelledTrigger ?? void 0,
|
|
8969
9026
|
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
|
|
9027
|
+
defaultOpen,
|
|
9028
|
+
onOpenChange,
|
|
9029
|
+
onSubmit: submit,
|
|
9030
|
+
onClosed: reset,
|
|
9031
|
+
cancelLabel: labels?.cancel ?? t("createApiKey.cancel"),
|
|
9032
|
+
submitLabel: labels?.submit ?? t("createApiKey.submit"),
|
|
9033
|
+
footer: secret == null ? void 0 : /* @__PURE__ */ jsx(DialogClose, {
|
|
9034
|
+
render: /* @__PURE__ */ jsx(Button, {}),
|
|
9035
|
+
children: labels?.done ?? t("createApiKey.done")
|
|
9036
|
+
}),
|
|
9037
|
+
summary: error && /* @__PURE__ */ jsx(Alert, {
|
|
9038
|
+
tone: "destructive",
|
|
9039
|
+
title: labels?.errorTitle ?? t("createApiKey.errorTitle"),
|
|
9040
|
+
description: error
|
|
9041
|
+
}),
|
|
9042
|
+
children: secret == null ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
9043
|
+
/* @__PURE__ */ jsxs(Field, {
|
|
9044
|
+
invalid: nameInvalid,
|
|
9045
|
+
children: [
|
|
9046
|
+
/* @__PURE__ */ jsx(FieldLabel, {
|
|
9047
|
+
required: true,
|
|
9048
|
+
children: labels?.name ?? t("createApiKey.name")
|
|
9046
9049
|
}),
|
|
9047
|
-
|
|
9048
|
-
|
|
9049
|
-
|
|
9050
|
-
|
|
9051
|
-
|
|
9052
|
-
|
|
9053
|
-
|
|
9054
|
-
|
|
9055
|
-
|
|
9056
|
-
|
|
9057
|
-
|
|
9058
|
-
|
|
9059
|
-
|
|
9060
|
-
|
|
9061
|
-
|
|
9062
|
-
|
|
9063
|
-
|
|
9064
|
-
wrapToggle: false,
|
|
9065
|
-
defaultWrap: true
|
|
9066
|
-
})]
|
|
9050
|
+
/* @__PURE__ */ jsx(Input, {
|
|
9051
|
+
value: name,
|
|
9052
|
+
onValueChange: setName,
|
|
9053
|
+
placeholder: labels?.namePlaceholder ?? t("createApiKey.namePlaceholder"),
|
|
9054
|
+
required: true,
|
|
9055
|
+
autoComplete: "off"
|
|
9056
|
+
}),
|
|
9057
|
+
/* @__PURE__ */ jsx(FieldError, {
|
|
9058
|
+
match: nameInvalid,
|
|
9059
|
+
children: labels?.nameRequired ?? t("createApiKey.nameRequired")
|
|
9060
|
+
})
|
|
9061
|
+
]
|
|
9062
|
+
}),
|
|
9063
|
+
/* @__PURE__ */ jsxs(Fieldset, {
|
|
9064
|
+
render: /* @__PURE__ */ jsx(CheckboxGroup, {
|
|
9065
|
+
value: selected,
|
|
9066
|
+
onValueChange: setSelected
|
|
9067
9067
|
}),
|
|
9068
|
-
|
|
9069
|
-
|
|
9070
|
-
children: labels?.
|
|
9071
|
-
|
|
9072
|
-
|
|
9073
|
-
|
|
9068
|
+
"aria-invalid": scopesInvalid || void 0,
|
|
9069
|
+
children: [
|
|
9070
|
+
/* @__PURE__ */ jsx(FieldsetLegend, { children: labels?.scopes ?? t("createApiKey.scopes") }),
|
|
9071
|
+
scopes.map((s) => /* @__PURE__ */ jsx(Checkbox, {
|
|
9072
|
+
value: s.value,
|
|
9073
|
+
label: /* @__PURE__ */ jsx("span", {
|
|
9074
|
+
className: "font-mono",
|
|
9075
|
+
children: s.label
|
|
9076
|
+
}),
|
|
9077
|
+
description: s.description
|
|
9078
|
+
}, s.value)),
|
|
9079
|
+
scopesInvalid && /* @__PURE__ */ jsx("p", {
|
|
9080
|
+
className: "text-[12.5px] text-destructive-text",
|
|
9081
|
+
children: labels?.scopesRequired ?? t("createApiKey.scopesRequired")
|
|
9082
|
+
})
|
|
9083
|
+
]
|
|
9084
|
+
}),
|
|
9085
|
+
/* @__PURE__ */ jsxs(Field, { children: [/* @__PURE__ */ jsx(FieldLabel, { children: labels?.expiration ?? t("createApiKey.expiration") }), /* @__PURE__ */ jsxs(Select, {
|
|
9086
|
+
value: expiry,
|
|
9087
|
+
onValueChange: (v) => v != null && setExpiry(v),
|
|
9088
|
+
items: expiries,
|
|
9089
|
+
children: [/* @__PURE__ */ jsx(SelectTrigger, { className: "w-full sm:w-56" }), /* @__PURE__ */ jsx(SelectContent, { children: expiries.map((x) => /* @__PURE__ */ jsx(SelectItem, {
|
|
9090
|
+
value: x.value,
|
|
9091
|
+
children: x.label
|
|
9092
|
+
}, x.value)) })]
|
|
9093
|
+
})] })
|
|
9094
|
+
] }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Alert, {
|
|
9095
|
+
tone: "warning",
|
|
9096
|
+
title: labels?.warningTitle ?? t("createApiKey.warningTitle"),
|
|
9097
|
+
description: labels?.warningDescription ?? t("createApiKey.warningDescription")
|
|
9098
|
+
}), /* @__PURE__ */ jsx(CodeBlock, {
|
|
9099
|
+
code: secret,
|
|
9100
|
+
label: labels?.secretLabel ?? t("createApiKey.secretLabel"),
|
|
9101
|
+
wrapToggle: false,
|
|
9102
|
+
defaultWrap: true
|
|
9103
|
+
})] })
|
|
9074
9104
|
});
|
|
9075
9105
|
}
|
|
9076
9106
|
//#endregion
|
|
@@ -9173,6 +9203,7 @@ const meta$12 = {
|
|
|
9173
9203
|
}
|
|
9174
9204
|
],
|
|
9175
9205
|
uses: [
|
|
9206
|
+
"FormDialog",
|
|
9176
9207
|
"Dialog",
|
|
9177
9208
|
"Field",
|
|
9178
9209
|
"Input",
|
|
@@ -9645,25 +9676,34 @@ const uploadItems = [
|
|
|
9645
9676
|
}
|
|
9646
9677
|
];
|
|
9647
9678
|
/** Demo uploader: reports progress in steps and resolves after ~1.5 s. */
|
|
9648
|
-
function simulateUpload(_file, onProgress) {
|
|
9649
|
-
return new Promise((resolve) => {
|
|
9679
|
+
function simulateUpload(_file, onProgress, context) {
|
|
9680
|
+
return new Promise((resolve, reject) => {
|
|
9681
|
+
const signal = context?.signal;
|
|
9682
|
+
let timer;
|
|
9683
|
+
const abort = () => {
|
|
9684
|
+
clearTimeout(timer);
|
|
9685
|
+
signal?.removeEventListener("abort", abort);
|
|
9686
|
+
reject(new DOMException("Aborted", "AbortError"));
|
|
9687
|
+
};
|
|
9688
|
+
if (signal?.aborted) {
|
|
9689
|
+
abort();
|
|
9690
|
+
return;
|
|
9691
|
+
}
|
|
9692
|
+
signal?.addEventListener("abort", abort, { once: true });
|
|
9650
9693
|
let pct = 0;
|
|
9651
9694
|
const step = () => {
|
|
9695
|
+
if (signal?.aborted) return;
|
|
9652
9696
|
pct = Math.min(100, pct + 20);
|
|
9653
9697
|
onProgress(pct);
|
|
9654
|
-
if (
|
|
9655
|
-
|
|
9698
|
+
if (signal?.aborted) return;
|
|
9699
|
+
if (pct >= 100) {
|
|
9700
|
+
signal?.removeEventListener("abort", abort);
|
|
9701
|
+
resolve();
|
|
9702
|
+
} else timer = setTimeout(step, 250);
|
|
9656
9703
|
};
|
|
9657
|
-
setTimeout(step, 250);
|
|
9704
|
+
timer = setTimeout(step, 250);
|
|
9658
9705
|
});
|
|
9659
9706
|
}
|
|
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
9707
|
//#endregion
|
|
9668
9708
|
//#region src/forms/FileUploadPanel/FileUploadPanel.tsx
|
|
9669
9709
|
let uid = 0;
|
|
@@ -9672,90 +9712,219 @@ const nextId = () => `upload-${++uid}`;
|
|
|
9672
9712
|
* Drop zone with a Browse button, accept and size validation, and a file list with progress,
|
|
9673
9713
|
* retry and remove. Rejected files stay in the list with the reason.
|
|
9674
9714
|
*/
|
|
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 }) {
|
|
9715
|
+
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
9716
|
const { t, formatBytes } = useI18n();
|
|
9677
9717
|
const label = labelProp ?? labels?.label ?? t("upload.label");
|
|
9678
9718
|
const id = useId();
|
|
9679
9719
|
const inputRef = useRef(null);
|
|
9680
9720
|
const [sources, setSources] = useState({});
|
|
9681
|
-
const [
|
|
9682
|
-
const
|
|
9721
|
+
const [internalItems, setItems] = useState(defaultFiles);
|
|
9722
|
+
const items = files ?? internalItems;
|
|
9723
|
+
const current = useRef(items);
|
|
9724
|
+
const rendered = useRef(items);
|
|
9725
|
+
const mounted = useRef(false);
|
|
9726
|
+
const attempts = useRef(/* @__PURE__ */ new Map());
|
|
9727
|
+
useLayoutEffect(() => {
|
|
9728
|
+
mounted.current = true;
|
|
9729
|
+
const active = attempts.current;
|
|
9730
|
+
return () => {
|
|
9731
|
+
mounted.current = false;
|
|
9732
|
+
for (const controller of active.values()) controller.abort();
|
|
9733
|
+
active.clear();
|
|
9734
|
+
};
|
|
9735
|
+
}, []);
|
|
9736
|
+
useLayoutEffect(() => {
|
|
9737
|
+
current.current = items;
|
|
9738
|
+
for (const item of rendered.current) {
|
|
9739
|
+
if (items.some((entry) => entry.id === item.id)) continue;
|
|
9740
|
+
attempts.current.get(item.id)?.abort();
|
|
9741
|
+
attempts.current.delete(item.id);
|
|
9742
|
+
}
|
|
9743
|
+
rendered.current = items;
|
|
9744
|
+
});
|
|
9745
|
+
const changeItems = (next, reason, ids) => {
|
|
9746
|
+
current.current = next;
|
|
9747
|
+
if (files === void 0) setItems(next);
|
|
9748
|
+
onFilesChange?.(next, {
|
|
9749
|
+
reason,
|
|
9750
|
+
ids
|
|
9751
|
+
});
|
|
9752
|
+
};
|
|
9753
|
+
const { rootProps, dragState } = useDropzone({
|
|
9754
|
+
accept,
|
|
9755
|
+
maxSize,
|
|
9756
|
+
disabled,
|
|
9757
|
+
activateOnClick: false
|
|
9758
|
+
});
|
|
9759
|
+
const dragging = dragState !== "idle";
|
|
9760
|
+
const [removing, setRemoving] = useState(/* @__PURE__ */ new Set());
|
|
9761
|
+
const removalRequests = useRef(/* @__PURE__ */ new Set());
|
|
9762
|
+
const [preparing, setPreparing] = useState(0);
|
|
9683
9763
|
const [announcement, setAnnouncement] = useState("");
|
|
9684
9764
|
const hintText = hint ?? labels?.hint?.(accept.split(",").map((a) => a.replace(".", "").toUpperCase()).join(" · "), formatBytes(maxSize)) ?? t("upload.hint", {
|
|
9685
9765
|
types: accept.split(",").map((a) => a.replace(".", "").toUpperCase()).join(" · "),
|
|
9686
9766
|
size: formatBytes(maxSize)
|
|
9687
9767
|
});
|
|
9688
|
-
const patch = (itemId, next) =>
|
|
9768
|
+
const patch = (itemId, next, reason) => changeItems(current.current.map((x) => x.id === itemId ? {
|
|
9689
9769
|
...x,
|
|
9690
9770
|
...next
|
|
9691
|
-
} : x));
|
|
9771
|
+
} : x), reason, [itemId]);
|
|
9692
9772
|
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) => {
|
|
9773
|
+
attempts.current.get(itemId)?.abort();
|
|
9774
|
+
const controller = new AbortController();
|
|
9775
|
+
attempts.current.set(itemId, controller);
|
|
9776
|
+
const active = () => mounted.current && !controller.signal.aborted && attempts.current.get(itemId) === controller && current.current.some((item) => item.id === itemId);
|
|
9777
|
+
let previous = 0;
|
|
9778
|
+
const failed = (error) => {
|
|
9779
|
+
if (!active()) return;
|
|
9780
|
+
attempts.current.delete(itemId);
|
|
9705
9781
|
patch(itemId, {
|
|
9706
9782
|
status: "error",
|
|
9707
|
-
error:
|
|
9708
|
-
});
|
|
9783
|
+
error: error instanceof Error ? error.message : labels?.failed ?? t("upload.failed")
|
|
9784
|
+
}, "error");
|
|
9709
9785
|
setAnnouncement(labels?.error?.(file.name) ?? t("upload.error", { name: file.name }));
|
|
9710
|
-
}
|
|
9786
|
+
};
|
|
9787
|
+
try {
|
|
9788
|
+
onUpload(file, (pct) => {
|
|
9789
|
+
if (!active()) return;
|
|
9790
|
+
const progress = Math.floor(pct);
|
|
9791
|
+
const legacyProgress = files === void 0 && onFilesChange === void 0;
|
|
9792
|
+
if (previous === progress && !legacyProgress) return;
|
|
9793
|
+
previous = progress;
|
|
9794
|
+
patch(itemId, { progress: legacyProgress ? pct : progress }, "progress");
|
|
9795
|
+
}, {
|
|
9796
|
+
signal: controller.signal,
|
|
9797
|
+
id: itemId
|
|
9798
|
+
}).then(() => {
|
|
9799
|
+
if (!active()) return;
|
|
9800
|
+
attempts.current.delete(itemId);
|
|
9801
|
+
patch(itemId, {
|
|
9802
|
+
status: "done",
|
|
9803
|
+
progress: 100
|
|
9804
|
+
}, "done");
|
|
9805
|
+
setAnnouncement(labels?.done?.(file.name) ?? t("upload.done", { name: file.name }));
|
|
9806
|
+
}, failed);
|
|
9807
|
+
} catch (error) {
|
|
9808
|
+
failed(error);
|
|
9809
|
+
}
|
|
9711
9810
|
};
|
|
9712
9811
|
const addFiles = (list) => {
|
|
9713
|
-
const
|
|
9714
|
-
const
|
|
9715
|
-
|
|
9716
|
-
|
|
9717
|
-
|
|
9718
|
-
|
|
9719
|
-
|
|
9720
|
-
|
|
9721
|
-
|
|
9722
|
-
|
|
9723
|
-
|
|
9724
|
-
|
|
9725
|
-
|
|
9726
|
-
|
|
9727
|
-
}
|
|
9728
|
-
|
|
9729
|
-
|
|
9730
|
-
|
|
9812
|
+
const picked = Array.from(list).slice(0, multiple ? void 0 : 1);
|
|
9813
|
+
const { rejected: rejectedFiles } = validateFiles(picked, {
|
|
9814
|
+
accept,
|
|
9815
|
+
maxSize
|
|
9816
|
+
});
|
|
9817
|
+
const reasons = new Map(rejectedFiles.map((item) => [item.file, item.reasons]));
|
|
9818
|
+
const prepared = picked.map((file) => ({
|
|
9819
|
+
file,
|
|
9820
|
+
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
|
|
9821
|
+
}));
|
|
9822
|
+
const append = (results) => {
|
|
9823
|
+
if (!mounted.current) return;
|
|
9824
|
+
const added = [];
|
|
9825
|
+
const toStart = [];
|
|
9826
|
+
const kept = {};
|
|
9827
|
+
for (const result of results) {
|
|
9828
|
+
if (!result) continue;
|
|
9829
|
+
const { file, error } = result;
|
|
9830
|
+
const itemId = nextId();
|
|
9831
|
+
added.push({
|
|
9832
|
+
id: itemId,
|
|
9833
|
+
file,
|
|
9834
|
+
name: file.name,
|
|
9835
|
+
size: file.size,
|
|
9836
|
+
progress: 0,
|
|
9837
|
+
status: error !== void 0 ? "error" : uploadMode === "manual" ? "pending" : "uploading",
|
|
9838
|
+
error
|
|
9839
|
+
});
|
|
9840
|
+
if (error === void 0) {
|
|
9841
|
+
kept[itemId] = file;
|
|
9842
|
+
if (uploadMode === "auto") toStart.push([itemId, file]);
|
|
9843
|
+
}
|
|
9731
9844
|
}
|
|
9845
|
+
if (!added.length) return;
|
|
9846
|
+
changeItems(multiple ? [...current.current, ...added] : added, "add", added.map((item) => item.id));
|
|
9847
|
+
setSources((current) => ({
|
|
9848
|
+
...current,
|
|
9849
|
+
...kept
|
|
9850
|
+
}));
|
|
9851
|
+
const rejected = added.filter((a) => a.status === "error").length;
|
|
9852
|
+
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(" "));
|
|
9853
|
+
for (const [itemId, file] of toStart) start(itemId, file);
|
|
9854
|
+
};
|
|
9855
|
+
if (!beforeUpload) {
|
|
9856
|
+
append(prepared);
|
|
9857
|
+
return;
|
|
9732
9858
|
}
|
|
9733
|
-
|
|
9734
|
-
|
|
9735
|
-
|
|
9736
|
-
|
|
9737
|
-
|
|
9738
|
-
|
|
9739
|
-
|
|
9740
|
-
|
|
9859
|
+
setPreparing((count) => count + 1);
|
|
9860
|
+
Promise.all(prepared.map(async (result) => {
|
|
9861
|
+
if (!result || result.error !== void 0) return result;
|
|
9862
|
+
try {
|
|
9863
|
+
const transformed = await beforeUpload(result.file);
|
|
9864
|
+
return transformed === false ? null : { file: transformed instanceof File ? transformed : result.file };
|
|
9865
|
+
} catch (error) {
|
|
9866
|
+
return {
|
|
9867
|
+
file: result.file,
|
|
9868
|
+
error: error instanceof Error ? error.message : labels?.failed ?? t("upload.failed")
|
|
9869
|
+
};
|
|
9870
|
+
}
|
|
9871
|
+
})).then((results) => {
|
|
9872
|
+
if (!mounted.current) return;
|
|
9873
|
+
setPreparing((count) => count - 1);
|
|
9874
|
+
append(results);
|
|
9875
|
+
});
|
|
9741
9876
|
};
|
|
9742
|
-
const
|
|
9877
|
+
const canCancel = (item) => item.status === "uploading" && (item.file !== void 0 || sources[item.id] !== void 0);
|
|
9878
|
+
const completeRemoval = (itemId) => {
|
|
9879
|
+
if (!mounted.current) return;
|
|
9880
|
+
const item = current.current.find((entry) => entry.id === itemId);
|
|
9881
|
+
if (!item) return;
|
|
9743
9882
|
setSources((current) => Object.fromEntries(Object.entries(current).filter(([k]) => k !== item.id)));
|
|
9744
|
-
|
|
9745
|
-
|
|
9746
|
-
|
|
9883
|
+
const cancelling = canCancel(item);
|
|
9884
|
+
attempts.current.get(item.id)?.abort();
|
|
9885
|
+
attempts.current.delete(item.id);
|
|
9886
|
+
changeItems(current.current.filter((x) => x.id !== item.id), cancelling ? "cancel" : "remove", [item.id]);
|
|
9887
|
+
setAnnouncement(cancelling ? labels?.cancelled?.(item.name) ?? t("upload.cancelled", { name: item.name }) : labels?.removed?.(item.name) ?? t("upload.removed", { name: item.name }));
|
|
9888
|
+
};
|
|
9889
|
+
const remove = (item) => {
|
|
9890
|
+
if (removalRequests.current.has(item.id)) return;
|
|
9891
|
+
const failed = () => {
|
|
9892
|
+
if (mounted.current) setAnnouncement(labels?.removeFailed?.(item.name) ?? t("upload.removeFailed", { name: item.name }));
|
|
9893
|
+
};
|
|
9894
|
+
try {
|
|
9895
|
+
const result = onRemove?.(item);
|
|
9896
|
+
if (result && typeof result === "object" && "then" in result) {
|
|
9897
|
+
removalRequests.current.add(item.id);
|
|
9898
|
+
setRemoving(new Set(removalRequests.current));
|
|
9899
|
+
result.then((allowed) => {
|
|
9900
|
+
if (allowed !== false) completeRemoval(item.id);
|
|
9901
|
+
}, failed).finally(() => {
|
|
9902
|
+
removalRequests.current.delete(item.id);
|
|
9903
|
+
if (mounted.current) setRemoving(new Set(removalRequests.current));
|
|
9904
|
+
});
|
|
9905
|
+
} else if (result !== false) completeRemoval(item.id);
|
|
9906
|
+
} catch {
|
|
9907
|
+
failed();
|
|
9908
|
+
}
|
|
9747
9909
|
};
|
|
9748
9910
|
const retryFor = (itemId) => {
|
|
9749
9911
|
const file = sources[itemId];
|
|
9750
|
-
return file ? () =>
|
|
9912
|
+
return file ? () => {
|
|
9913
|
+
patch(itemId, {
|
|
9914
|
+
status: "uploading",
|
|
9915
|
+
progress: 0,
|
|
9916
|
+
error: void 0
|
|
9917
|
+
}, "progress");
|
|
9918
|
+
start(itemId, file);
|
|
9919
|
+
} : void 0;
|
|
9751
9920
|
};
|
|
9752
9921
|
const onDrop = (e) => {
|
|
9753
|
-
|
|
9754
|
-
|
|
9755
|
-
if (!disabled && e.dataTransfer.files.length) addFiles(e.dataTransfer.files);
|
|
9922
|
+
rootProps.onDrop?.(e);
|
|
9923
|
+
if (!disabled && Array.from(e.dataTransfer?.types ?? []).includes("Files") && e.dataTransfer.files.length) addFiles(e.dataTransfer.files);
|
|
9756
9924
|
};
|
|
9757
9925
|
return /* @__PURE__ */ jsxs("div", {
|
|
9758
9926
|
role: "group",
|
|
9927
|
+
"aria-busy": preparing > 0 || void 0,
|
|
9759
9928
|
"aria-labelledby": `${id}-label`,
|
|
9760
9929
|
className: cn("w-full", className),
|
|
9761
9930
|
children: [
|
|
@@ -9765,15 +9934,11 @@ function FileUploadPanel({ labels, accept = ".csv,.json,.jsonl,.yaml,.pdf", maxS
|
|
|
9765
9934
|
children: label
|
|
9766
9935
|
}),
|
|
9767
9936
|
/* @__PURE__ */ jsxs("div", {
|
|
9937
|
+
...rootProps,
|
|
9768
9938
|
"data-dragging": dragging || void 0,
|
|
9769
9939
|
"data-disabled": disabled || void 0,
|
|
9770
|
-
onDragOver: (e) => {
|
|
9771
|
-
e.preventDefault();
|
|
9772
|
-
if (!disabled) setDragging(true);
|
|
9773
|
-
},
|
|
9774
|
-
onDragLeave: () => setDragging(false),
|
|
9775
9940
|
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-[
|
|
9941
|
+
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
9942
|
children: [
|
|
9778
9943
|
/* @__PURE__ */ jsx("div", {
|
|
9779
9944
|
className: "mx-auto grid size-12 place-items-center rounded-2xl bg-secondary/70 text-muted-foreground ring-1 ring-border",
|
|
@@ -9820,6 +9985,8 @@ function FileUploadPanel({ labels, accept = ".csv,.json,.jsonl,.yaml,.pdf", maxS
|
|
|
9820
9985
|
children: items.map((item) => /* @__PURE__ */ jsx(FileRow, {
|
|
9821
9986
|
labels,
|
|
9822
9987
|
item,
|
|
9988
|
+
cancellable: canCancel(item),
|
|
9989
|
+
removing: removing.has(item.id),
|
|
9823
9990
|
onRemove: () => remove(item),
|
|
9824
9991
|
onRetry: retryFor(item.id)
|
|
9825
9992
|
}, item.id))
|
|
@@ -9832,10 +9999,11 @@ function FileUploadPanel({ labels, accept = ".csv,.json,.jsonl,.yaml,.pdf", maxS
|
|
|
9832
9999
|
]
|
|
9833
10000
|
});
|
|
9834
10001
|
}
|
|
9835
|
-
function FileRow({ item, onRemove, onRetry, labels }) {
|
|
10002
|
+
function FileRow({ item, onRemove, onRetry, cancellable, removing, labels }) {
|
|
9836
10003
|
const { t, formatBytes } = useI18n();
|
|
9837
10004
|
const err = item.status === "error";
|
|
9838
10005
|
const done = item.status === "done";
|
|
10006
|
+
const readySize = item.status === "pending" ? formatBytes(item.size, { base: 1024 }).replace(/([KMGTPE])iB\b/, "$1B") : "";
|
|
9839
10007
|
return /* @__PURE__ */ jsxs("li", {
|
|
9840
10008
|
className: "flex items-center gap-3 rounded-lg border border-border bg-card px-3.5 py-2.5 shadow-sm",
|
|
9841
10009
|
children: [
|
|
@@ -9861,7 +10029,7 @@ function FileRow({ item, onRemove, onRetry, labels }) {
|
|
|
9861
10029
|
className: "mt-1.5"
|
|
9862
10030
|
}) : /* @__PURE__ */ jsx("div", {
|
|
9863
10031
|
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) })
|
|
10032
|
+
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
10033
|
})]
|
|
9866
10034
|
}),
|
|
9867
10035
|
item.status === "uploading" && /* @__PURE__ */ jsxs("span", {
|
|
@@ -9877,8 +10045,9 @@ function FileRow({ item, onRemove, onRetry, labels }) {
|
|
|
9877
10045
|
/* @__PURE__ */ jsx(IconButton, {
|
|
9878
10046
|
icon: X,
|
|
9879
10047
|
size: "sm",
|
|
9880
|
-
label: labels?.remove?.(item.name) ?? t("common.removeItem", { label: item.name }),
|
|
9881
|
-
onClick: onRemove
|
|
10048
|
+
label: cancellable ? labels?.cancel?.(item.name) ?? t("upload.cancel", { name: item.name }) : labels?.remove?.(item.name) ?? t("common.removeItem", { label: item.name }),
|
|
10049
|
+
onClick: onRemove,
|
|
10050
|
+
disabled: removing
|
|
9882
10051
|
})
|
|
9883
10052
|
]
|
|
9884
10053
|
});
|
|
@@ -9889,8 +10058,28 @@ const meta$26 = {
|
|
|
9889
10058
|
name: "File upload panel",
|
|
9890
10059
|
family: "forms",
|
|
9891
10060
|
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.",
|
|
10061
|
+
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
10062
|
labels: [
|
|
10063
|
+
{
|
|
10064
|
+
key: "ready",
|
|
10065
|
+
type: "(size: string) => string",
|
|
10066
|
+
state: "Pending manual upload"
|
|
10067
|
+
},
|
|
10068
|
+
{
|
|
10069
|
+
key: "cancel",
|
|
10070
|
+
type: "(name: string) => string",
|
|
10071
|
+
state: "Uploading cancel action"
|
|
10072
|
+
},
|
|
10073
|
+
{
|
|
10074
|
+
key: "cancelled",
|
|
10075
|
+
type: "(name: string) => string",
|
|
10076
|
+
state: "Cancellation feedback"
|
|
10077
|
+
},
|
|
10078
|
+
{
|
|
10079
|
+
key: "removeFailed",
|
|
10080
|
+
type: "(name: string) => string",
|
|
10081
|
+
state: "Removal rejection"
|
|
10082
|
+
},
|
|
9894
10083
|
{
|
|
9895
10084
|
key: "label",
|
|
9896
10085
|
type: "string",
|
|
@@ -9992,16 +10181,16 @@ const meta$26 = {
|
|
|
9992
10181
|
//#region src/forms/FormSection/FormSection.tsx
|
|
9993
10182
|
function SampleFields() {
|
|
9994
10183
|
return /* @__PURE__ */ jsxs("div", {
|
|
9995
|
-
className: "grid grid-cols-1 gap-4
|
|
10184
|
+
className: "grid grid-cols-1 gap-4 @2xl:grid-cols-6",
|
|
9996
10185
|
children: [/* @__PURE__ */ jsxs(Field, {
|
|
9997
|
-
className: "
|
|
10186
|
+
className: "@2xl:col-span-4",
|
|
9998
10187
|
children: [
|
|
9999
10188
|
/* @__PURE__ */ jsx(FieldLabel, { children: "Project name" }),
|
|
10000
10189
|
/* @__PURE__ */ jsx(Input, { defaultValue: "billing-dashboard" }),
|
|
10001
10190
|
/* @__PURE__ */ jsx(FieldDescription, { children: "Lowercase letters, numbers and dashes." })
|
|
10002
10191
|
]
|
|
10003
10192
|
}), /* @__PURE__ */ jsxs(Field, {
|
|
10004
|
-
className: "
|
|
10193
|
+
className: "@2xl:col-span-6",
|
|
10005
10194
|
children: [/* @__PURE__ */ jsx(FieldLabel, { children: "Description" }), /* @__PURE__ */ jsx(Textarea, {
|
|
10006
10195
|
rows: 3,
|
|
10007
10196
|
defaultValue: "Usage and invoice reporting for every workspace."
|
|
@@ -10011,34 +10200,37 @@ function SampleFields() {
|
|
|
10011
10200
|
}
|
|
10012
10201
|
/**
|
|
10013
10202
|
* Two-column form section: title and help on the left, fields on the right. Stacks into a
|
|
10014
|
-
* single column
|
|
10203
|
+
* single column in narrow containers.
|
|
10015
10204
|
*/
|
|
10016
10205
|
function FormSection({ labels, title: titleProp, description: descriptionProp, children, actions, headingLevel: Heading = "h2", divided = false, className, ...props }) {
|
|
10017
10206
|
const { t } = useI18n();
|
|
10018
10207
|
const title = titleProp === void 0 ? labels?.title ?? t("formSection.title") : titleProp;
|
|
10019
10208
|
const description = descriptionProp === void 0 ? labels?.description ?? t("formSection.description") : descriptionProp;
|
|
10020
10209
|
const id = useId();
|
|
10021
|
-
return /* @__PURE__ */
|
|
10210
|
+
return /* @__PURE__ */ jsx("section", {
|
|
10022
10211
|
"aria-labelledby": title != null ? `${id}-title` : void 0,
|
|
10023
|
-
className: cn("
|
|
10212
|
+
className: cn("@container w-full min-w-0", divided && "border-t border-border pt-8", className),
|
|
10024
10213
|
...props,
|
|
10025
|
-
children:
|
|
10026
|
-
className: "
|
|
10027
|
-
children: [
|
|
10028
|
-
|
|
10029
|
-
|
|
10030
|
-
|
|
10031
|
-
|
|
10032
|
-
|
|
10033
|
-
|
|
10034
|
-
|
|
10035
|
-
|
|
10036
|
-
|
|
10037
|
-
|
|
10038
|
-
className: "
|
|
10039
|
-
children: actions
|
|
10214
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
10215
|
+
className: "grid grid-cols-1 gap-x-10 gap-y-5 @2xl:grid-cols-3",
|
|
10216
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
10217
|
+
className: "min-w-0",
|
|
10218
|
+
children: [title != null && /* @__PURE__ */ jsx(Heading, {
|
|
10219
|
+
id: `${id}-title`,
|
|
10220
|
+
className: "text-[14px] font-semibold tracking-tight text-foreground",
|
|
10221
|
+
children: title
|
|
10222
|
+
}), description != null && /* @__PURE__ */ jsx("p", {
|
|
10223
|
+
className: "mt-1 text-[13px] leading-6 text-pretty text-muted-foreground",
|
|
10224
|
+
children: description
|
|
10225
|
+
})]
|
|
10226
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
10227
|
+
className: "min-w-0 @2xl:col-span-2",
|
|
10228
|
+
children: [children ?? /* @__PURE__ */ jsx(SampleFields, {}), actions != null && /* @__PURE__ */ jsx("div", {
|
|
10229
|
+
className: "mt-6 flex flex-wrap items-center justify-end gap-2.5",
|
|
10230
|
+
children: actions
|
|
10231
|
+
})]
|
|
10040
10232
|
})]
|
|
10041
|
-
})
|
|
10233
|
+
})
|
|
10042
10234
|
});
|
|
10043
10235
|
}
|
|
10044
10236
|
//#endregion
|
|
@@ -10047,7 +10239,7 @@ const meta$30 = {
|
|
|
10047
10239
|
name: "Form section",
|
|
10048
10240
|
family: "forms",
|
|
10049
10241
|
status: "stable",
|
|
10050
|
-
description: "Two-column settings section: title and help on the left, fields on the right; stacks
|
|
10242
|
+
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
10243
|
labels: [{
|
|
10052
10244
|
key: "title",
|
|
10053
10245
|
type: "string",
|
|
@@ -10091,133 +10283,113 @@ const EMAIL_RE = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
|
10091
10283
|
//#endregion
|
|
10092
10284
|
//#region src/forms/InviteMembersDialog/InviteMembersDialog.tsx
|
|
10093
10285
|
/** 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
|
|
10286
|
+
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
10287
|
const { t } = useI18n();
|
|
10096
10288
|
const title = titleProp ?? labels?.title ?? t("inviteMembers.title");
|
|
10097
10289
|
const description = descriptionProp ?? labels?.description ?? t("inviteMembers.description");
|
|
10098
10290
|
const emailError = (email) => EMAIL_RE.test(email) ? null : labels?.emailInvalid?.(email) ?? t("inviteMembers.emailInvalid", { email });
|
|
10099
|
-
const [innerOpen, setInnerOpen] = useState(defaultOpen);
|
|
10100
10291
|
const [emails, setEmails] = useState([]);
|
|
10101
10292
|
const [role, setRole] = useState(defaultRole);
|
|
10102
10293
|
const [message, setMessage] = useState("");
|
|
10103
10294
|
const [submitted, setSubmitted] = useState(false);
|
|
10104
|
-
const [loading, setLoading] = useState(false);
|
|
10105
10295
|
const [error, setError] = useState(null);
|
|
10106
|
-
const
|
|
10296
|
+
const opening = useRef(0);
|
|
10297
|
+
useEffect(() => {
|
|
10298
|
+
opening.current += 1;
|
|
10299
|
+
}, [open]);
|
|
10107
10300
|
const invalidCount = emails.filter((e) => emailError(e)).length;
|
|
10108
10301
|
const emailsProblem = emails.length === 0 ? labels?.emailRequired ?? t("inviteMembers.emailRequired") : invalidCount > 0 ? labels?.fixInvalid?.(invalidCount) ?? t("inviteMembers.fixInvalid", { count: invalidCount }) : null;
|
|
10109
10302
|
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);
|
|
10303
|
+
const reset = () => {
|
|
10304
|
+
opening.current += 1;
|
|
10305
|
+
setEmails([]);
|
|
10306
|
+
setRole(defaultRole);
|
|
10307
|
+
setMessage("");
|
|
10308
|
+
setSubmitted(false);
|
|
10124
10309
|
setError(null);
|
|
10125
|
-
|
|
10126
|
-
|
|
10310
|
+
};
|
|
10311
|
+
const send = async () => {
|
|
10312
|
+
const current = opening.current;
|
|
10127
10313
|
try {
|
|
10128
10314
|
await onInvite?.({
|
|
10129
10315
|
emails,
|
|
10130
10316
|
role,
|
|
10131
10317
|
message: message.trim()
|
|
10132
10318
|
});
|
|
10133
|
-
setLoading(false);
|
|
10134
|
-
setOpen(false);
|
|
10135
10319
|
} catch (e) {
|
|
10136
|
-
|
|
10137
|
-
|
|
10320
|
+
if (current === opening.current) setError(e instanceof Error ? e.message : labels?.fallbackError ?? t("inviteMembers.fallbackError"));
|
|
10321
|
+
return false;
|
|
10138
10322
|
}
|
|
10139
10323
|
};
|
|
10324
|
+
const submit = () => {
|
|
10325
|
+
setSubmitted(true);
|
|
10326
|
+
setError(null);
|
|
10327
|
+
return emailsProblem ? false : send();
|
|
10328
|
+
};
|
|
10140
10329
|
const roleLabel = roles.find((r) => r.value === role)?.description;
|
|
10141
|
-
return /* @__PURE__ */ jsxs(
|
|
10330
|
+
return /* @__PURE__ */ jsxs(FormDialog, {
|
|
10331
|
+
size: "lg",
|
|
10332
|
+
title,
|
|
10333
|
+
description,
|
|
10334
|
+
trigger: trigger ?? void 0,
|
|
10142
10335
|
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
|
|
10336
|
+
defaultOpen,
|
|
10337
|
+
onOpenChange,
|
|
10338
|
+
onSubmit: submit,
|
|
10339
|
+
onClosed: reset,
|
|
10340
|
+
cancelLabel: labels?.cancel ?? t("inviteMembers.cancel"),
|
|
10341
|
+
submitLabel: emails.length > 1 ? labels?.submitMany?.(emails.length) ?? t("inviteMembers.submitMany", { count: emails.length }) : labels?.submit ?? t("inviteMembers.submit"),
|
|
10342
|
+
summary: error && /* @__PURE__ */ jsx(Alert, {
|
|
10343
|
+
tone: "destructive",
|
|
10344
|
+
title: labels?.errorTitle ?? t("inviteMembers.errorTitle"),
|
|
10345
|
+
description: error
|
|
10346
|
+
}),
|
|
10347
|
+
children: [
|
|
10348
|
+
/* @__PURE__ */ jsxs(Field, {
|
|
10349
|
+
invalid: showEmailError,
|
|
10350
|
+
children: [
|
|
10351
|
+
/* @__PURE__ */ jsx(FieldLabel, {
|
|
10352
|
+
required: true,
|
|
10353
|
+
children: labels?.emails ?? t("inviteMembers.emails")
|
|
10212
10354
|
}),
|
|
10213
|
-
|
|
10214
|
-
|
|
10215
|
-
|
|
10216
|
-
|
|
10217
|
-
|
|
10218
|
-
|
|
10219
|
-
|
|
10220
|
-
|
|
10355
|
+
/* @__PURE__ */ jsx(TokenInput, {
|
|
10356
|
+
value: emails,
|
|
10357
|
+
onValueChange: setEmails,
|
|
10358
|
+
validate: emailError,
|
|
10359
|
+
maxItems: maxInvites,
|
|
10360
|
+
placeholder: labels?.placeholder ?? t("inviteMembers.placeholder"),
|
|
10361
|
+
listLabel: labels?.listLabel ?? t("inviteMembers.listLabel"),
|
|
10362
|
+
invalid: showEmailError
|
|
10363
|
+
}),
|
|
10364
|
+
/* @__PURE__ */ jsx(FieldError, {
|
|
10365
|
+
match: showEmailError,
|
|
10366
|
+
children: emailsProblem
|
|
10367
|
+
})
|
|
10368
|
+
]
|
|
10369
|
+
}),
|
|
10370
|
+
/* @__PURE__ */ jsxs(Field, { children: [
|
|
10371
|
+
/* @__PURE__ */ jsx(FieldLabel, { children: labels?.role ?? t("inviteMembers.role") }),
|
|
10372
|
+
/* @__PURE__ */ jsxs(Select, {
|
|
10373
|
+
value: role,
|
|
10374
|
+
onValueChange: (v) => v != null && setRole(v),
|
|
10375
|
+
items: roles.map(({ value, label }) => ({
|
|
10376
|
+
value,
|
|
10377
|
+
label
|
|
10378
|
+
})),
|
|
10379
|
+
children: [/* @__PURE__ */ jsx(SelectTrigger, { className: "w-full" }), /* @__PURE__ */ jsx(SelectContent, { children: roles.map((r) => /* @__PURE__ */ jsx(SelectItem, {
|
|
10380
|
+
value: r.value,
|
|
10381
|
+
children: r.label
|
|
10382
|
+
}, r.value)) })]
|
|
10383
|
+
}),
|
|
10384
|
+
roleLabel && /* @__PURE__ */ jsx(FieldDescription, { children: roleLabel })
|
|
10385
|
+
] }),
|
|
10386
|
+
/* @__PURE__ */ jsxs(Field, { children: [/* @__PURE__ */ jsx(FieldLabel, { children: labels?.message ?? t("inviteMembers.message") }), /* @__PURE__ */ jsx(Textarea, {
|
|
10387
|
+
rows: 3,
|
|
10388
|
+
value: message,
|
|
10389
|
+
onValueChange: setMessage,
|
|
10390
|
+
placeholder: labels?.messagePlaceholder ?? t("inviteMembers.messagePlaceholder")
|
|
10391
|
+
})] })
|
|
10392
|
+
]
|
|
10221
10393
|
});
|
|
10222
10394
|
}
|
|
10223
10395
|
//#endregion
|
|
@@ -10310,6 +10482,7 @@ const meta$35 = {
|
|
|
10310
10482
|
}
|
|
10311
10483
|
],
|
|
10312
10484
|
uses: [
|
|
10485
|
+
"FormDialog",
|
|
10313
10486
|
"Dialog",
|
|
10314
10487
|
"TokenInput",
|
|
10315
10488
|
"Select",
|
|
@@ -10365,7 +10538,7 @@ function SettingsRow({ labels, label: labelProp, description: descriptionProp, c
|
|
|
10365
10538
|
}
|
|
10366
10539
|
//#endregion
|
|
10367
10540
|
//#region src/forms/SettingsRow/block.meta.ts
|
|
10368
|
-
const meta$
|
|
10541
|
+
const meta$61 = {
|
|
10369
10542
|
name: "Settings row",
|
|
10370
10543
|
family: "forms",
|
|
10371
10544
|
status: "stable",
|
|
@@ -10455,7 +10628,7 @@ const dialogWizardCopy = {
|
|
|
10455
10628
|
};
|
|
10456
10629
|
//#endregion
|
|
10457
10630
|
//#region src/forms/ValidationSummary/block.meta.ts
|
|
10458
|
-
const meta$
|
|
10631
|
+
const meta$77 = {
|
|
10459
10632
|
name: "Validation summary",
|
|
10460
10633
|
family: "forms",
|
|
10461
10634
|
status: "stable",
|
|
@@ -10468,6 +10641,320 @@ const meta$75 = {
|
|
|
10468
10641
|
uses: ["Alert", "Link"]
|
|
10469
10642
|
};
|
|
10470
10643
|
//#endregion
|
|
10644
|
+
//#region src/hooks/useTableData.ts
|
|
10645
|
+
/**
|
|
10646
|
+
* Map committed table queries to abortable requests. Callback identities do not trigger requests.
|
|
10647
|
+
* Spread tableProps into DataTable; use paginated={false} and loadMoreProps for cursor lists.
|
|
10648
|
+
* Available from the npm package only (not the copy-install registry).
|
|
10649
|
+
*/
|
|
10650
|
+
function useTableData(options) {
|
|
10651
|
+
const { enabled = true } = options;
|
|
10652
|
+
const filtersKey = JSON.stringify(options.filters);
|
|
10653
|
+
const [request, setRequest] = useState(() => ({
|
|
10654
|
+
query: {
|
|
10655
|
+
page: options.initialPage ?? 1,
|
|
10656
|
+
pageSize: options.initialPageSize ?? 20,
|
|
10657
|
+
sort: options.initialSort ?? null,
|
|
10658
|
+
filters: options.filters,
|
|
10659
|
+
cursor: null
|
|
10660
|
+
},
|
|
10661
|
+
filtersKey,
|
|
10662
|
+
revision: 0,
|
|
10663
|
+
force: false,
|
|
10664
|
+
prefix: []
|
|
10665
|
+
}));
|
|
10666
|
+
if (request.filtersKey !== filtersKey) setRequest({
|
|
10667
|
+
...request,
|
|
10668
|
+
filtersKey,
|
|
10669
|
+
force: false,
|
|
10670
|
+
prefix: [],
|
|
10671
|
+
revision: request.revision + 1,
|
|
10672
|
+
query: {
|
|
10673
|
+
...request.query,
|
|
10674
|
+
page: 1,
|
|
10675
|
+
cursor: null,
|
|
10676
|
+
filters: options.filters
|
|
10677
|
+
}
|
|
10678
|
+
});
|
|
10679
|
+
const params = request.query;
|
|
10680
|
+
const key = JSON.stringify(params);
|
|
10681
|
+
const [snapshot, setSnapshot] = useState(() => ({
|
|
10682
|
+
rows: [],
|
|
10683
|
+
rowCount: 0,
|
|
10684
|
+
nextCursor: void 0,
|
|
10685
|
+
page: params.page,
|
|
10686
|
+
pageSize: params.pageSize,
|
|
10687
|
+
sort: params.sort,
|
|
10688
|
+
isLoading: enabled,
|
|
10689
|
+
isFetching: false,
|
|
10690
|
+
footerLoading: false,
|
|
10691
|
+
error: null,
|
|
10692
|
+
lastAppend: {
|
|
10693
|
+
seq: 0,
|
|
10694
|
+
count: 0
|
|
10695
|
+
}
|
|
10696
|
+
}));
|
|
10697
|
+
const data = useRef(snapshot);
|
|
10698
|
+
const resolved = useRef(snapshot);
|
|
10699
|
+
const prefix = request.prefix;
|
|
10700
|
+
const latest = useRef({
|
|
10701
|
+
options,
|
|
10702
|
+
params,
|
|
10703
|
+
key,
|
|
10704
|
+
prefix
|
|
10705
|
+
});
|
|
10706
|
+
useEffect(() => {
|
|
10707
|
+
latest.current = {
|
|
10708
|
+
options,
|
|
10709
|
+
params,
|
|
10710
|
+
key,
|
|
10711
|
+
prefix
|
|
10712
|
+
};
|
|
10713
|
+
});
|
|
10714
|
+
const cache = useRef(/* @__PURE__ */ new Map());
|
|
10715
|
+
const active = useRef(null);
|
|
10716
|
+
const forcedRevision = useRef(-1);
|
|
10717
|
+
const mounted = useRef(false);
|
|
10718
|
+
const confirmedSort = useRef(params.sort);
|
|
10719
|
+
const confirmedKey = useRef(null);
|
|
10720
|
+
const abortedAppendKey = useRef(null);
|
|
10721
|
+
const hasData = useRef(false);
|
|
10722
|
+
const publish = useCallback((next) => {
|
|
10723
|
+
data.current = next;
|
|
10724
|
+
setSnapshot(next);
|
|
10725
|
+
}, []);
|
|
10726
|
+
const abort = useCallback(() => {
|
|
10727
|
+
active.current?.controller.abort();
|
|
10728
|
+
active.current = null;
|
|
10729
|
+
}, []);
|
|
10730
|
+
useEffect(() => {
|
|
10731
|
+
mounted.current = true;
|
|
10732
|
+
return () => {
|
|
10733
|
+
mounted.current = false;
|
|
10734
|
+
abort();
|
|
10735
|
+
};
|
|
10736
|
+
}, [abort]);
|
|
10737
|
+
const start = useCallback((force = false, background = false) => {
|
|
10738
|
+
const { options: current, params: query, key: queryKey, prefix: previousRows } = latest.current;
|
|
10739
|
+
if (current.enabled === false) {
|
|
10740
|
+
abort();
|
|
10741
|
+
publish({
|
|
10742
|
+
...resolved.current,
|
|
10743
|
+
error: data.current.error,
|
|
10744
|
+
isLoading: false,
|
|
10745
|
+
isFetching: false,
|
|
10746
|
+
footerLoading: false
|
|
10747
|
+
});
|
|
10748
|
+
return;
|
|
10749
|
+
}
|
|
10750
|
+
if (background && queryKey !== confirmedKey.current) return;
|
|
10751
|
+
if (!force && active.current?.key === queryKey) return;
|
|
10752
|
+
abort();
|
|
10753
|
+
abortedAppendKey.current = null;
|
|
10754
|
+
const cacheTime = current.cacheTime ?? 3e4;
|
|
10755
|
+
const cached = cacheTime > 0 ? cache.current.get(queryKey) : void 0;
|
|
10756
|
+
const addsSegment = query.cursor !== null && queryKey !== confirmedKey.current;
|
|
10757
|
+
if (cached && !force) {
|
|
10758
|
+
confirmedSort.current = cached.value.sort;
|
|
10759
|
+
confirmedKey.current = queryKey;
|
|
10760
|
+
hasData.current = true;
|
|
10761
|
+
const appended = query.cursor !== null;
|
|
10762
|
+
resolved.current = {
|
|
10763
|
+
...cached.value,
|
|
10764
|
+
rows: appended ? [...previousRows, ...cached.pageRows] : cached.pageRows,
|
|
10765
|
+
lastAppend: addsSegment && !background ? {
|
|
10766
|
+
seq: data.current.lastAppend.seq + 1,
|
|
10767
|
+
count: cached.pageRows.length
|
|
10768
|
+
} : data.current.lastAppend
|
|
10769
|
+
};
|
|
10770
|
+
publish(resolved.current);
|
|
10771
|
+
if (Date.now() - cached.at < cacheTime) return;
|
|
10772
|
+
}
|
|
10773
|
+
const attempt = {
|
|
10774
|
+
key: queryKey,
|
|
10775
|
+
controller: new AbortController()
|
|
10776
|
+
};
|
|
10777
|
+
active.current = attempt;
|
|
10778
|
+
const keep = query.cursor !== null || background || current.keepPreviousData !== false || Boolean(cached);
|
|
10779
|
+
publish({
|
|
10780
|
+
...data.current,
|
|
10781
|
+
...keep ? {} : {
|
|
10782
|
+
rows: [],
|
|
10783
|
+
page: query.page,
|
|
10784
|
+
pageSize: query.pageSize
|
|
10785
|
+
},
|
|
10786
|
+
sort: query.sort,
|
|
10787
|
+
isLoading: !keep || !hasData.current,
|
|
10788
|
+
isFetching: true,
|
|
10789
|
+
footerLoading: !background && !(cached && !force)
|
|
10790
|
+
});
|
|
10791
|
+
const valid = () => mounted.current && active.current === attempt && !attempt.controller.signal.aborted;
|
|
10792
|
+
const fail = (error) => {
|
|
10793
|
+
if (!valid()) return;
|
|
10794
|
+
active.current = null;
|
|
10795
|
+
cache.current.delete(queryKey);
|
|
10796
|
+
const aborted = typeof error === "object" && error !== null && "name" in error && error.name === "AbortError";
|
|
10797
|
+
if (aborted && query.cursor !== null) abortedAppendKey.current = queryKey;
|
|
10798
|
+
const failure = error ?? /* @__PURE__ */ new Error("Unable to load rows.");
|
|
10799
|
+
publish({
|
|
10800
|
+
...data.current,
|
|
10801
|
+
rows: resolved.current.rows,
|
|
10802
|
+
page: resolved.current.page,
|
|
10803
|
+
pageSize: resolved.current.pageSize,
|
|
10804
|
+
sort: confirmedSort.current,
|
|
10805
|
+
isLoading: false,
|
|
10806
|
+
isFetching: false,
|
|
10807
|
+
footerLoading: false,
|
|
10808
|
+
error: aborted ? null : failure
|
|
10809
|
+
});
|
|
10810
|
+
if (!aborted) latest.current.options.onError?.(failure);
|
|
10811
|
+
};
|
|
10812
|
+
try {
|
|
10813
|
+
Promise.resolve(current.getRows({
|
|
10814
|
+
...query,
|
|
10815
|
+
signal: attempt.controller.signal
|
|
10816
|
+
})).then((result) => {
|
|
10817
|
+
if (!valid()) return;
|
|
10818
|
+
active.current = null;
|
|
10819
|
+
confirmedSort.current = query.sort;
|
|
10820
|
+
confirmedKey.current = queryKey;
|
|
10821
|
+
hasData.current = true;
|
|
10822
|
+
const appended = query.cursor !== null;
|
|
10823
|
+
const next = {
|
|
10824
|
+
...data.current,
|
|
10825
|
+
rows: appended ? [...previousRows, ...result.rows] : result.rows,
|
|
10826
|
+
rowCount: result.rowCount ?? data.current.rowCount,
|
|
10827
|
+
nextCursor: result.nextCursor,
|
|
10828
|
+
page: query.page,
|
|
10829
|
+
pageSize: query.pageSize,
|
|
10830
|
+
sort: query.sort,
|
|
10831
|
+
lastAppend: addsSegment && !background && (!cached || force) ? {
|
|
10832
|
+
seq: data.current.lastAppend.seq + 1,
|
|
10833
|
+
count: result.rows.length
|
|
10834
|
+
} : data.current.lastAppend,
|
|
10835
|
+
isLoading: false,
|
|
10836
|
+
isFetching: false,
|
|
10837
|
+
footerLoading: false,
|
|
10838
|
+
error: null
|
|
10839
|
+
};
|
|
10840
|
+
if (cacheTime > 0) cache.current.set(queryKey, {
|
|
10841
|
+
value: next,
|
|
10842
|
+
pageRows: result.rows,
|
|
10843
|
+
at: Date.now()
|
|
10844
|
+
});
|
|
10845
|
+
resolved.current = next;
|
|
10846
|
+
publish(next);
|
|
10847
|
+
}, fail);
|
|
10848
|
+
} catch (error) {
|
|
10849
|
+
fail(error);
|
|
10850
|
+
}
|
|
10851
|
+
}, [abort, publish]);
|
|
10852
|
+
useEffect(() => {
|
|
10853
|
+
const force = request.force && forcedRevision.current !== request.revision;
|
|
10854
|
+
if (force && enabled) forcedRevision.current = request.revision;
|
|
10855
|
+
start(force);
|
|
10856
|
+
}, [
|
|
10857
|
+
key,
|
|
10858
|
+
request.revision,
|
|
10859
|
+
request.force,
|
|
10860
|
+
enabled,
|
|
10861
|
+
start
|
|
10862
|
+
]);
|
|
10863
|
+
const interval = options.revalidateInterval ?? 0;
|
|
10864
|
+
useEffect(() => {
|
|
10865
|
+
if (!enabled || interval <= 0) return;
|
|
10866
|
+
const timer = setInterval(() => {
|
|
10867
|
+
if (typeof document !== "undefined" && document.hidden) return;
|
|
10868
|
+
if (!active.current) start(true, true);
|
|
10869
|
+
}, interval);
|
|
10870
|
+
return () => clearInterval(timer);
|
|
10871
|
+
}, [
|
|
10872
|
+
enabled,
|
|
10873
|
+
interval,
|
|
10874
|
+
start
|
|
10875
|
+
]);
|
|
10876
|
+
const change = (update, force = false, prefix = []) => setRequest((before) => ({
|
|
10877
|
+
...before,
|
|
10878
|
+
filtersKey,
|
|
10879
|
+
force,
|
|
10880
|
+
prefix,
|
|
10881
|
+
revision: before.revision + 1,
|
|
10882
|
+
query: {
|
|
10883
|
+
...before.filtersKey === filtersKey ? before.query : {
|
|
10884
|
+
...before.query,
|
|
10885
|
+
page: 1,
|
|
10886
|
+
filters: options.filters
|
|
10887
|
+
},
|
|
10888
|
+
cursor: null,
|
|
10889
|
+
...update
|
|
10890
|
+
}
|
|
10891
|
+
}));
|
|
10892
|
+
const onQueryChange = (query) => change({
|
|
10893
|
+
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,
|
|
10894
|
+
pageSize: query.pageSize,
|
|
10895
|
+
sort: query.sort,
|
|
10896
|
+
...query.cause === "view" ? { filters: query.filters } : {}
|
|
10897
|
+
});
|
|
10898
|
+
const refetch = () => change(params.cursor === null ? {} : { page: 1 }, true);
|
|
10899
|
+
const retry = () => change(params, true, prefix);
|
|
10900
|
+
const invalidate = () => {
|
|
10901
|
+
cache.current.clear();
|
|
10902
|
+
refetch();
|
|
10903
|
+
};
|
|
10904
|
+
const loadMore = () => {
|
|
10905
|
+
if (active.current || data.current.error != null || !snapshot.nextCursor || !enabled) return;
|
|
10906
|
+
if (key !== confirmedKey.current) {
|
|
10907
|
+
if (key === abortedAppendKey.current) retry();
|
|
10908
|
+
return;
|
|
10909
|
+
}
|
|
10910
|
+
change({
|
|
10911
|
+
page: params.page + 1,
|
|
10912
|
+
cursor: snapshot.nextCursor
|
|
10913
|
+
}, false, snapshot.rows);
|
|
10914
|
+
};
|
|
10915
|
+
const hasMore = Boolean(snapshot.nextCursor);
|
|
10916
|
+
const { footerLoading, ...state } = snapshot;
|
|
10917
|
+
return {
|
|
10918
|
+
...state,
|
|
10919
|
+
params,
|
|
10920
|
+
hasMore,
|
|
10921
|
+
loadMore,
|
|
10922
|
+
refetch,
|
|
10923
|
+
invalidate,
|
|
10924
|
+
tableProps: {
|
|
10925
|
+
rows: snapshot.rows,
|
|
10926
|
+
paginationMode: "server",
|
|
10927
|
+
rowCount: snapshot.rowCount,
|
|
10928
|
+
page: snapshot.page,
|
|
10929
|
+
pageSize: snapshot.pageSize,
|
|
10930
|
+
sort: snapshot.sort,
|
|
10931
|
+
manualSorting: true,
|
|
10932
|
+
loading: snapshot.isLoading,
|
|
10933
|
+
filters: params.filters,
|
|
10934
|
+
onPageChange: (page) => change({ page }),
|
|
10935
|
+
onPageSizeChange: (pageSize) => change({
|
|
10936
|
+
page: 1,
|
|
10937
|
+
pageSize
|
|
10938
|
+
}),
|
|
10939
|
+
onSortChange: (sort) => change({
|
|
10940
|
+
page: 1,
|
|
10941
|
+
sort
|
|
10942
|
+
}),
|
|
10943
|
+
onQueryChange
|
|
10944
|
+
},
|
|
10945
|
+
loadMoreProps: {
|
|
10946
|
+
onLoadMore: loadMore,
|
|
10947
|
+
onRetry: retry,
|
|
10948
|
+
error: snapshot.error == null ? "" : snapshot.error instanceof Error && snapshot.error.message ? snapshot.error.message : "Unable to load rows.",
|
|
10949
|
+
nextCursor: snapshot.nextCursor,
|
|
10950
|
+
hasMore,
|
|
10951
|
+
loading: footerLoading,
|
|
10952
|
+
loadedCount: snapshot.rows.length,
|
|
10953
|
+
lastAppend: snapshot.lastAppend
|
|
10954
|
+
}
|
|
10955
|
+
};
|
|
10956
|
+
}
|
|
10957
|
+
//#endregion
|
|
10471
10958
|
//#region src/marketing/actions.tsx
|
|
10472
10959
|
function ActionButton({ action, variant, size = "lg", className }) {
|
|
10473
10960
|
const Trailing = action.icon;
|
|
@@ -10670,7 +11157,7 @@ function FeatureGrid({ features = sampleFeatures, eyebrow = "Everything included
|
|
|
10670
11157
|
className: "mx-auto max-w-2xl text-center",
|
|
10671
11158
|
children: [
|
|
10672
11159
|
eyebrow && /* @__PURE__ */ jsx("p", {
|
|
10673
|
-
className: "font-mono text-[12px] font-semibold tracking-wide text-primary-text
|
|
11160
|
+
className: "font-mono text-[12px] font-semibold tracking-wide text-primary-text label-case",
|
|
10674
11161
|
children: eyebrow
|
|
10675
11162
|
}),
|
|
10676
11163
|
title && /* @__PURE__ */ jsx(Heading, {
|
|
@@ -10825,7 +11312,7 @@ function PricingTable({ tiers = samplePricingTiers, eyebrow = "Pricing", title =
|
|
|
10825
11312
|
className: "mx-auto max-w-2xl text-center",
|
|
10826
11313
|
children: [
|
|
10827
11314
|
eyebrow && /* @__PURE__ */ jsx("p", {
|
|
10828
|
-
className: "font-mono text-[12px] font-semibold tracking-wide text-primary-text
|
|
11315
|
+
className: "font-mono text-[12px] font-semibold tracking-wide text-primary-text label-case",
|
|
10829
11316
|
children: eyebrow
|
|
10830
11317
|
}),
|
|
10831
11318
|
hasTitle && /* @__PURE__ */ jsx(Heading, {
|
|
@@ -10990,7 +11477,7 @@ function TierBody({ tier, tierId, cycle, money, TierHeading, currentTierId, curr
|
|
|
10990
11477
|
}
|
|
10991
11478
|
//#endregion
|
|
10992
11479
|
//#region src/marketing/PricingTable/block.meta.ts
|
|
10993
|
-
const meta$
|
|
11480
|
+
const meta$53 = {
|
|
10994
11481
|
name: "Pricing table",
|
|
10995
11482
|
family: "marketing",
|
|
10996
11483
|
status: "beta",
|
|
@@ -11259,7 +11746,7 @@ const sampleComparisonSections = [
|
|
|
11259
11746
|
//#endregion
|
|
11260
11747
|
//#region src/marketing/ComparisonTable/ComparisonTable.tsx
|
|
11261
11748
|
const number = new Intl.NumberFormat("en-US");
|
|
11262
|
-
const STICKY$1 = "sticky start-0 z-
|
|
11749
|
+
const STICKY$1 = "sticky start-0 z-sticky bg-card";
|
|
11263
11750
|
/**
|
|
11264
11751
|
* Feature comparison of plans or options: columns are plans, rows are features grouped by section.
|
|
11265
11752
|
* Booleans render as a check or a dash with screen-reader text; text and numbers render as is. The
|
|
@@ -11310,7 +11797,7 @@ function ComparisonTable({ plans = sampleComparisonPlans, sections = sampleCompa
|
|
|
11310
11797
|
className: "mx-auto mb-10 max-w-2xl text-center",
|
|
11311
11798
|
children: [
|
|
11312
11799
|
eyebrow && /* @__PURE__ */ jsx("p", {
|
|
11313
|
-
className: "font-mono text-[12px] font-semibold tracking-wide text-primary-text
|
|
11800
|
+
className: "font-mono text-[12px] font-semibold tracking-wide text-primary-text label-case",
|
|
11314
11801
|
children: eyebrow
|
|
11315
11802
|
}),
|
|
11316
11803
|
hasTitle && /* @__PURE__ */ jsx(Heading, {
|
|
@@ -11425,6 +11912,289 @@ const meta$9 = {
|
|
|
11425
11912
|
]
|
|
11426
11913
|
};
|
|
11427
11914
|
//#endregion
|
|
11915
|
+
//#region src/marketing/SiteFooter/SiteFooter.tsx
|
|
11916
|
+
function LinkList({ links, className }) {
|
|
11917
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
11918
|
+
className: cn("flex flex-wrap gap-x-4 gap-y-1", className),
|
|
11919
|
+
children: links.map((link) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(Link, {
|
|
11920
|
+
href: link.href,
|
|
11921
|
+
external: link.external,
|
|
11922
|
+
tone: "muted",
|
|
11923
|
+
underline: "hover",
|
|
11924
|
+
children: link.label
|
|
11925
|
+
}) }, link.href))
|
|
11926
|
+
});
|
|
11927
|
+
}
|
|
11928
|
+
/** Public-page footer. The default div fits inside a layout's existing footer landmark. */
|
|
11929
|
+
function SiteFooter({ layout = "columns", brand = /* @__PURE__ */ jsx(Logo, {
|
|
11930
|
+
size: 24,
|
|
11931
|
+
wordmark: true
|
|
11932
|
+
}), description, columns = [], links = [], legalLinks = [], social = [], copyright, headingLevel: Heading = "h2", navLabel, landmark = false, themeSwitcher = false, newsletter, className }) {
|
|
11933
|
+
const { t } = useI18n();
|
|
11934
|
+
const populatedColumns = columns.filter((column) => column.links.length > 0);
|
|
11935
|
+
const Root = landmark ? "footer" : "div";
|
|
11936
|
+
const copyrightContent = copyright === void 0 ? t("footer.copyright") : copyright;
|
|
11937
|
+
const centered = layout === "centered";
|
|
11938
|
+
const rowNav = links.length > 0 && /* @__PURE__ */ jsx("nav", {
|
|
11939
|
+
"aria-label": navLabel ?? t("footer.label"),
|
|
11940
|
+
children: /* @__PURE__ */ jsx(LinkList, {
|
|
11941
|
+
links,
|
|
11942
|
+
className: centered ? "justify-center" : void 0
|
|
11943
|
+
})
|
|
11944
|
+
});
|
|
11945
|
+
const legalNav = legalLinks.length > 0 && /* @__PURE__ */ jsx("nav", {
|
|
11946
|
+
"aria-label": t("footer.legal"),
|
|
11947
|
+
children: /* @__PURE__ */ jsx(LinkList, {
|
|
11948
|
+
links: legalLinks,
|
|
11949
|
+
className: centered ? "justify-center" : void 0
|
|
11950
|
+
})
|
|
11951
|
+
});
|
|
11952
|
+
const socialList = social.length > 0 && /* @__PURE__ */ jsx("ul", {
|
|
11953
|
+
"aria-label": t("footer.social"),
|
|
11954
|
+
className: cn("flex flex-wrap gap-2", centered && "justify-center"),
|
|
11955
|
+
children: social.map((link) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(IconButton, {
|
|
11956
|
+
icon: link.icon,
|
|
11957
|
+
label: link.label,
|
|
11958
|
+
render: /* @__PURE__ */ jsx("a", { href: link.href }),
|
|
11959
|
+
role: "link",
|
|
11960
|
+
nativeButton: false,
|
|
11961
|
+
size: "sm"
|
|
11962
|
+
}) }, link.href))
|
|
11963
|
+
});
|
|
11964
|
+
if (layout === "simple") return /* @__PURE__ */ jsxs(Root, {
|
|
11965
|
+
className: cn("flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between", className),
|
|
11966
|
+
children: [
|
|
11967
|
+
/* @__PURE__ */ jsx("span", { children: copyrightContent }),
|
|
11968
|
+
rowNav,
|
|
11969
|
+
legalNav,
|
|
11970
|
+
socialList,
|
|
11971
|
+
themeSwitcher && /* @__PURE__ */ jsx(ThemeSwitcher, {
|
|
11972
|
+
size: "sm",
|
|
11973
|
+
showLabels: false
|
|
11974
|
+
})
|
|
11975
|
+
]
|
|
11976
|
+
});
|
|
11977
|
+
if (centered) return /* @__PURE__ */ jsxs(Root, {
|
|
11978
|
+
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),
|
|
11979
|
+
children: [
|
|
11980
|
+
brand,
|
|
11981
|
+
description && /* @__PURE__ */ jsx("div", { children: description }),
|
|
11982
|
+
newsletter && /* @__PURE__ */ jsx("div", { children: newsletter }),
|
|
11983
|
+
rowNav,
|
|
11984
|
+
legalNav,
|
|
11985
|
+
socialList,
|
|
11986
|
+
/* @__PURE__ */ jsx("span", { children: copyrightContent }),
|
|
11987
|
+
themeSwitcher && /* @__PURE__ */ jsx(ThemeSwitcher, {
|
|
11988
|
+
size: "sm",
|
|
11989
|
+
showLabels: false
|
|
11990
|
+
})
|
|
11991
|
+
]
|
|
11992
|
+
});
|
|
11993
|
+
return /* @__PURE__ */ jsxs(Root, {
|
|
11994
|
+
className: cn("min-w-0 px-4 py-12 text-sm wrap-anywhere text-muted-foreground sm:px-6", className),
|
|
11995
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
11996
|
+
className: "grid min-w-0 gap-8 lg:grid-cols-[minmax(0,1fr)_minmax(0,2fr)]",
|
|
11997
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
11998
|
+
className: "min-w-0 space-y-4",
|
|
11999
|
+
children: [
|
|
12000
|
+
brand,
|
|
12001
|
+
description && /* @__PURE__ */ jsx("div", { children: description }),
|
|
12002
|
+
newsletter && /* @__PURE__ */ jsx("div", { children: newsletter })
|
|
12003
|
+
]
|
|
12004
|
+
}), populatedColumns.length > 0 && /* @__PURE__ */ jsx("nav", {
|
|
12005
|
+
"aria-label": navLabel ?? t("footer.label"),
|
|
12006
|
+
className: "grid min-w-0 grid-cols-2 gap-8 lg:grid-cols-4",
|
|
12007
|
+
children: populatedColumns.map((column) => /* @__PURE__ */ jsxs("div", {
|
|
12008
|
+
className: "min-w-0",
|
|
12009
|
+
children: [/* @__PURE__ */ jsx(Heading, {
|
|
12010
|
+
className: "mb-3 text-sm font-semibold text-foreground",
|
|
12011
|
+
children: column.title
|
|
12012
|
+
}), /* @__PURE__ */ jsx(LinkList, {
|
|
12013
|
+
links: column.links,
|
|
12014
|
+
className: "flex-col gap-y-2"
|
|
12015
|
+
})]
|
|
12016
|
+
}, column.title))
|
|
12017
|
+
})]
|
|
12018
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
12019
|
+
className: "mt-8 flex flex-wrap items-center justify-between gap-3",
|
|
12020
|
+
children: [
|
|
12021
|
+
/* @__PURE__ */ jsx("span", { children: copyrightContent }),
|
|
12022
|
+
legalNav,
|
|
12023
|
+
socialList,
|
|
12024
|
+
themeSwitcher && /* @__PURE__ */ jsx(ThemeSwitcher, {
|
|
12025
|
+
size: "sm",
|
|
12026
|
+
showLabels: false
|
|
12027
|
+
})
|
|
12028
|
+
]
|
|
12029
|
+
})]
|
|
12030
|
+
});
|
|
12031
|
+
}
|
|
12032
|
+
//#endregion
|
|
12033
|
+
//#region src/marketing/SiteFooter/block.meta.ts
|
|
12034
|
+
const meta$64 = {
|
|
12035
|
+
name: "Site footer",
|
|
12036
|
+
family: "marketing",
|
|
12037
|
+
status: "beta",
|
|
12038
|
+
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.",
|
|
12039
|
+
uses: [
|
|
12040
|
+
"Link",
|
|
12041
|
+
"Logo",
|
|
12042
|
+
"IconButton",
|
|
12043
|
+
"ThemeSwitcher"
|
|
12044
|
+
]
|
|
12045
|
+
};
|
|
12046
|
+
//#endregion
|
|
12047
|
+
//#region src/marketing/SiteFooter/fixtures.ts
|
|
12048
|
+
const sampleFooterColumns = [
|
|
12049
|
+
{
|
|
12050
|
+
title: "Product",
|
|
12051
|
+
links: [{
|
|
12052
|
+
label: "Overview",
|
|
12053
|
+
href: "/product"
|
|
12054
|
+
}, {
|
|
12055
|
+
label: "Pricing",
|
|
12056
|
+
href: "/pricing"
|
|
12057
|
+
}]
|
|
12058
|
+
},
|
|
12059
|
+
{
|
|
12060
|
+
title: "Company",
|
|
12061
|
+
links: [{
|
|
12062
|
+
label: "About",
|
|
12063
|
+
href: "/about"
|
|
12064
|
+
}, {
|
|
12065
|
+
label: "Contact",
|
|
12066
|
+
href: "/contact"
|
|
12067
|
+
}]
|
|
12068
|
+
},
|
|
12069
|
+
{
|
|
12070
|
+
title: "Resources",
|
|
12071
|
+
links: [{
|
|
12072
|
+
label: "Documentation",
|
|
12073
|
+
href: "/docs"
|
|
12074
|
+
}, {
|
|
12075
|
+
label: "Status",
|
|
12076
|
+
href: "/status"
|
|
12077
|
+
}]
|
|
12078
|
+
}
|
|
12079
|
+
];
|
|
12080
|
+
const sampleLegalLinks = [{
|
|
12081
|
+
label: "Privacy",
|
|
12082
|
+
href: "/privacy"
|
|
12083
|
+
}, {
|
|
12084
|
+
label: "Terms",
|
|
12085
|
+
href: "/terms"
|
|
12086
|
+
}];
|
|
12087
|
+
const sampleSocialLinks = [{
|
|
12088
|
+
label: "Email",
|
|
12089
|
+
href: "mailto:hello@example.com",
|
|
12090
|
+
icon: Mail$1
|
|
12091
|
+
}, {
|
|
12092
|
+
label: "RSS feed",
|
|
12093
|
+
href: "/feed.xml",
|
|
12094
|
+
icon: Rss
|
|
12095
|
+
}];
|
|
12096
|
+
//#endregion
|
|
12097
|
+
//#region src/marketing/LogoCloud/LogoCloud.tsx
|
|
12098
|
+
const gridColumns = {
|
|
12099
|
+
3: "md:grid-cols-3",
|
|
12100
|
+
4: "md:grid-cols-4",
|
|
12101
|
+
6: "md:grid-cols-6"
|
|
12102
|
+
};
|
|
12103
|
+
/** Static social proof. Marks inherit the root token colour unless an item overrides it. */
|
|
12104
|
+
function LogoCloud({ logos, caption, captionPlacement = "above", layout = "row", columns = 4, logoHeight = 28, className }) {
|
|
12105
|
+
const captionId = useId();
|
|
12106
|
+
const { t } = useI18n();
|
|
12107
|
+
if (logos.length === 0) return null;
|
|
12108
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
12109
|
+
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),
|
|
12110
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
12111
|
+
id: captionId,
|
|
12112
|
+
className: cn("min-w-0 text-center text-sm wrap-anywhere", captionPlacement === "start" && "md:max-w-64 md:shrink-0 md:text-start"),
|
|
12113
|
+
children: caption ?? t("logoCloud.caption")
|
|
12114
|
+
}), /* @__PURE__ */ jsx("ul", {
|
|
12115
|
+
"aria-labelledby": captionId,
|
|
12116
|
+
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"),
|
|
12117
|
+
children: logos.map((logo) => /* @__PURE__ */ jsx("li", {
|
|
12118
|
+
className: cn("flex min-w-0 max-w-full justify-center", logo.className),
|
|
12119
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
12120
|
+
role: "img",
|
|
12121
|
+
"aria-label": logo.name,
|
|
12122
|
+
className: "flex min-w-0 max-w-full justify-center",
|
|
12123
|
+
style: { height: logoHeight },
|
|
12124
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
12125
|
+
"aria-hidden": "true",
|
|
12126
|
+
className: "inline-flex h-full min-w-0 max-w-full [&_svg]:h-full [&_svg]:w-auto [&_svg]:max-w-full",
|
|
12127
|
+
children: logo.mark
|
|
12128
|
+
})
|
|
12129
|
+
})
|
|
12130
|
+
}, logo.id))
|
|
12131
|
+
})]
|
|
12132
|
+
});
|
|
12133
|
+
}
|
|
12134
|
+
//#endregion
|
|
12135
|
+
//#region src/marketing/LogoCloud/block.meta.ts
|
|
12136
|
+
const meta$40 = {
|
|
12137
|
+
name: "Logo cloud",
|
|
12138
|
+
family: "marketing",
|
|
12139
|
+
status: "beta",
|
|
12140
|
+
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.",
|
|
12141
|
+
uses: []
|
|
12142
|
+
};
|
|
12143
|
+
//#endregion
|
|
12144
|
+
//#region src/marketing/LogoCloud/fixtures.ts
|
|
12145
|
+
/** Neutral placeholder marks, never customer assets. Supply your own currentColor SVGs. */
|
|
12146
|
+
const sampleLogos = [
|
|
12147
|
+
[
|
|
12148
|
+
"acme",
|
|
12149
|
+
"Acme",
|
|
12150
|
+
96,
|
|
12151
|
+
"M14 0 28 28H0z"
|
|
12152
|
+
],
|
|
12153
|
+
[
|
|
12154
|
+
"example",
|
|
12155
|
+
"Example",
|
|
12156
|
+
128,
|
|
12157
|
+
"M0 0h28v28H0z"
|
|
12158
|
+
],
|
|
12159
|
+
[
|
|
12160
|
+
"sample",
|
|
12161
|
+
"Sample",
|
|
12162
|
+
118,
|
|
12163
|
+
"M14 0 28 14 14 28 0 14z"
|
|
12164
|
+
],
|
|
12165
|
+
[
|
|
12166
|
+
"demo",
|
|
12167
|
+
"Demo",
|
|
12168
|
+
100,
|
|
12169
|
+
"M0 0h12v28H0zM16 0h12v28H16z"
|
|
12170
|
+
],
|
|
12171
|
+
[
|
|
12172
|
+
"placeholder",
|
|
12173
|
+
"Placeholder",
|
|
12174
|
+
166,
|
|
12175
|
+
"M0 0h28v12H0zM0 16h28v12H0z"
|
|
12176
|
+
],
|
|
12177
|
+
[
|
|
12178
|
+
"studio",
|
|
12179
|
+
"Studio",
|
|
12180
|
+
108,
|
|
12181
|
+
"M0 0h12v16h16v12H0z"
|
|
12182
|
+
]
|
|
12183
|
+
].map(([id, name, width, path]) => ({
|
|
12184
|
+
id,
|
|
12185
|
+
name,
|
|
12186
|
+
mark: createElement("svg", {
|
|
12187
|
+
viewBox: `0 0 ${width} 28`,
|
|
12188
|
+
fill: "currentColor",
|
|
12189
|
+
focusable: "false"
|
|
12190
|
+
}, createElement("path", { d: path }), createElement("text", {
|
|
12191
|
+
x: 36,
|
|
12192
|
+
y: 21,
|
|
12193
|
+
fontSize: 20,
|
|
12194
|
+
fontWeight: 600
|
|
12195
|
+
}, name))
|
|
12196
|
+
}));
|
|
12197
|
+
//#endregion
|
|
11428
12198
|
//#region src/page-chrome/types.ts
|
|
11429
12199
|
/** Maps a PageChromeAction to a MoreMenu item (destructive variant → destructive item). */
|
|
11430
12200
|
function toMenuAction(action) {
|
|
@@ -11521,7 +12291,7 @@ function PageHeader({ as: Root = "header", breadcrumbs = pageHeaderBreadcrumbs,
|
|
|
11521
12291
|
children: action.label
|
|
11522
12292
|
}, action.id ?? action.label);
|
|
11523
12293
|
return /* @__PURE__ */ jsxs(Root, {
|
|
11524
|
-
className: cn("min-w-0", className),
|
|
12294
|
+
className: cn("@container w-full min-w-0", className),
|
|
11525
12295
|
children: [
|
|
11526
12296
|
breadcrumbs && breadcrumbs.length > 0 && /* @__PURE__ */ jsx(Breadcrumbs, {
|
|
11527
12297
|
items: breadcrumbs,
|
|
@@ -11571,10 +12341,10 @@ function PageHeader({ as: Root = "header", breadcrumbs = pageHeaderBreadcrumbs,
|
|
|
11571
12341
|
})
|
|
11572
12342
|
]
|
|
11573
12343
|
}), actions.length > 0 && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("div", {
|
|
11574
|
-
className: "hidden shrink-0 items-center gap-2.5
|
|
12344
|
+
className: "hidden shrink-0 items-center gap-2.5 @xl:flex",
|
|
11575
12345
|
children: actions.map(renderAction)
|
|
11576
12346
|
}), /* @__PURE__ */ jsxs("div", {
|
|
11577
|
-
className: "flex shrink-0 items-center gap-2
|
|
12347
|
+
className: "flex shrink-0 items-center gap-2 @xl:hidden",
|
|
11578
12348
|
children: [folded.length > 0 && /* @__PURE__ */ jsx(MoreMenu, {
|
|
11579
12349
|
items: folded.map(toMenuAction),
|
|
11580
12350
|
label: labels?.moreActions ?? t("pageHeader.moreActions")
|
|
@@ -11601,11 +12371,11 @@ function PageHeader({ as: Root = "header", breadcrumbs = pageHeaderBreadcrumbs,
|
|
|
11601
12371
|
}
|
|
11602
12372
|
//#endregion
|
|
11603
12373
|
//#region src/page-chrome/PageHeader/block.meta.ts
|
|
11604
|
-
const meta$
|
|
12374
|
+
const meta$46 = {
|
|
11605
12375
|
name: "Page header",
|
|
11606
12376
|
family: "page-chrome",
|
|
11607
12377
|
status: "beta",
|
|
11608
|
-
description: "Screen header with breadcrumb, title and status, description, meta row, actions that fold into a MoreMenu
|
|
12378
|
+
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
12379
|
labels: [
|
|
11610
12380
|
{
|
|
11611
12381
|
key: "title",
|
|
@@ -11677,7 +12447,7 @@ function SectionHeader({ title = "Policies", description = "Guardrails applied t
|
|
|
11677
12447
|
}
|
|
11678
12448
|
//#endregion
|
|
11679
12449
|
//#region src/page-chrome/SectionHeader/block.meta.ts
|
|
11680
|
-
const meta$
|
|
12450
|
+
const meta$59 = {
|
|
11681
12451
|
name: "Section header",
|
|
11682
12452
|
family: "page-chrome",
|
|
11683
12453
|
status: "beta",
|
|
@@ -11742,10 +12512,10 @@ function PageToolbar({ search, defaultSearch = "", onSearchChange, searchLabel:
|
|
|
11742
12512
|
}), /* @__PURE__ */ jsxs(ToolbarEnd, { children: [views && views.length > 0 && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(ToggleGroup, {
|
|
11743
12513
|
"aria-label": t("toolbar.view"),
|
|
11744
12514
|
size: "sm",
|
|
12515
|
+
disallowEmptySelection: true,
|
|
11745
12516
|
value: [currentView],
|
|
11746
12517
|
onValueChange: (next) => {
|
|
11747
12518
|
const picked = next[0];
|
|
11748
|
-
if (!picked) return;
|
|
11749
12519
|
setInnerView(picked);
|
|
11750
12520
|
onViewChange?.(picked);
|
|
11751
12521
|
},
|
|
@@ -11770,7 +12540,7 @@ function PageToolbar({ search, defaultSearch = "", onSearchChange, searchLabel:
|
|
|
11770
12540
|
}
|
|
11771
12541
|
//#endregion
|
|
11772
12542
|
//#region src/page-chrome/PageToolbar/block.meta.ts
|
|
11773
|
-
const meta$
|
|
12543
|
+
const meta$47 = {
|
|
11774
12544
|
name: "Page toolbar",
|
|
11775
12545
|
family: "page-chrome",
|
|
11776
12546
|
status: "beta",
|
|
@@ -11796,7 +12566,7 @@ function StickyActionBar({ dirty = true, saving = false, onSave, onCancel, dirty
|
|
|
11796
12566
|
if (hideWhenClean && !dirty && !saving) return null;
|
|
11797
12567
|
return /* @__PURE__ */ jsx("section", {
|
|
11798
12568
|
"aria-label": ariaLabel,
|
|
11799
|
-
className: cn("sticky bottom-0 z-
|
|
12569
|
+
className: cn("sticky bottom-0 z-docked border-t border-border bg-card px-4 py-3 shadow-sm sm:px-6", className),
|
|
11800
12570
|
children: /* @__PURE__ */ jsxs("div", {
|
|
11801
12571
|
className: "mx-auto flex max-w-5xl flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",
|
|
11802
12572
|
children: [/* @__PURE__ */ jsxs("p", {
|
|
@@ -11826,7 +12596,7 @@ function StickyActionBar({ dirty = true, saving = false, onSave, onCancel, dirty
|
|
|
11826
12596
|
}
|
|
11827
12597
|
//#endregion
|
|
11828
12598
|
//#region src/page-chrome/StickyActionBar/block.meta.ts
|
|
11829
|
-
const meta$
|
|
12599
|
+
const meta$70 = {
|
|
11830
12600
|
name: "Sticky action bar",
|
|
11831
12601
|
family: "page-chrome",
|
|
11832
12602
|
status: "beta",
|
|
@@ -11924,21 +12694,29 @@ function useSchedulingClock(override) {
|
|
|
11924
12694
|
//#endregion
|
|
11925
12695
|
//#region src/scheduling/shared/CalendarHeader.tsx
|
|
11926
12696
|
/** Title + previous / today / next navigation + caller actions. */
|
|
11927
|
-
function CalendarHeader({ titleId, title, subtitle, prevLabel, nextLabel, onPrev, onNext, onToday, actions }) {
|
|
12697
|
+
function CalendarHeader({ timeZone = "system", referenceDate, titleId, title, subtitle, prevLabel, nextLabel, onPrev, onNext, onToday, actions }) {
|
|
11928
12698
|
const { t } = useI18n();
|
|
11929
12699
|
return /* @__PURE__ */ jsxs("div", {
|
|
11930
12700
|
className: "flex flex-wrap items-center justify-between gap-3 border-b border-border px-4 py-3 sm:px-5",
|
|
11931
12701
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
11932
12702
|
className: "min-w-0",
|
|
11933
|
-
children: [
|
|
11934
|
-
|
|
11935
|
-
|
|
11936
|
-
|
|
11937
|
-
|
|
11938
|
-
|
|
11939
|
-
|
|
11940
|
-
|
|
11941
|
-
|
|
12703
|
+
children: [
|
|
12704
|
+
/* @__PURE__ */ jsx("h3", {
|
|
12705
|
+
id: titleId,
|
|
12706
|
+
"aria-live": "polite",
|
|
12707
|
+
className: "truncate text-[15px] font-semibold tracking-tight text-foreground",
|
|
12708
|
+
children: title
|
|
12709
|
+
}),
|
|
12710
|
+
/* @__PURE__ */ jsx(TimeZoneLabel, {
|
|
12711
|
+
id: `${titleId}-zone`,
|
|
12712
|
+
timeZone,
|
|
12713
|
+
referenceDate
|
|
12714
|
+
}),
|
|
12715
|
+
subtitle && /* @__PURE__ */ jsx("p", {
|
|
12716
|
+
className: "mt-0.5 truncate font-mono text-[11px] text-muted-foreground",
|
|
12717
|
+
children: subtitle
|
|
12718
|
+
})
|
|
12719
|
+
]
|
|
11942
12720
|
}), /* @__PURE__ */ jsxs("div", {
|
|
11943
12721
|
className: "flex shrink-0 items-center gap-2",
|
|
11944
12722
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
@@ -11969,52 +12747,87 @@ function CalendarHeader({ titleId, title, subtitle, prevLabel, nextLabel, onPrev
|
|
|
11969
12747
|
})]
|
|
11970
12748
|
});
|
|
11971
12749
|
}
|
|
12750
|
+
/** Shared, wrapping zone caption for calendar and agenda headers. */
|
|
12751
|
+
function TimeZoneLabel({ id, timeZone, referenceDate }) {
|
|
12752
|
+
const { t } = useI18n();
|
|
12753
|
+
if (timeZone === "system") return null;
|
|
12754
|
+
const zone = timeZone === "UTC" ? "UTC" : `${timeZone} (${formatTimeZoneLabel(timeZone, referenceDate, "en-US")})`;
|
|
12755
|
+
return /* @__PURE__ */ jsx("p", {
|
|
12756
|
+
id,
|
|
12757
|
+
className: "mt-0.5 break-words text-[11px] text-muted-foreground",
|
|
12758
|
+
children: t("scheduling.timeZone", { zone })
|
|
12759
|
+
});
|
|
12760
|
+
}
|
|
11972
12761
|
//#endregion
|
|
11973
12762
|
//#region src/scheduling/shared/dates.ts
|
|
12763
|
+
/** Native-Date helpers for scheduling. All optional zones default to the runtime clock. */
|
|
11974
12764
|
const pad = (n) => String(n).padStart(2, "0");
|
|
11975
|
-
/**
|
|
11976
|
-
function
|
|
11977
|
-
|
|
12765
|
+
/** Midnight in the display zone, normalizing calendar arithmetic before DST conversion. */
|
|
12766
|
+
function calendarDate(year, month, day, zone = "system") {
|
|
12767
|
+
if (zone === "system") return new Date(year, month - 1, day);
|
|
12768
|
+
const normalized = /* @__PURE__ */ new Date(0);
|
|
12769
|
+
normalized.setUTCFullYear(year, month - 1, day);
|
|
12770
|
+
const parts = zonedParts(normalized, "UTC");
|
|
12771
|
+
return fromZonedParts(parts, zone);
|
|
12772
|
+
}
|
|
12773
|
+
function dayKey(d, zone = "system") {
|
|
12774
|
+
const p = zonedParts(d, zone);
|
|
12775
|
+
return `${p.year}-${pad(p.month)}-${pad(p.day)}`;
|
|
11978
12776
|
}
|
|
11979
|
-
function startOfDay(d) {
|
|
11980
|
-
|
|
12777
|
+
function startOfDay(d, zone = "system") {
|
|
12778
|
+
const p = zonedParts(d, zone);
|
|
12779
|
+
return calendarDate(p.year, p.month, p.day, zone);
|
|
11981
12780
|
}
|
|
11982
|
-
function addDays(d, n) {
|
|
11983
|
-
|
|
12781
|
+
function addDays(d, n, zone = "system") {
|
|
12782
|
+
const p = zonedParts(d, zone);
|
|
12783
|
+
return calendarDate(p.year, p.month, p.day + n, zone);
|
|
11984
12784
|
}
|
|
11985
|
-
function addMonths(d, n) {
|
|
11986
|
-
|
|
12785
|
+
function addMonths(d, n, zone = "system") {
|
|
12786
|
+
const p = zonedParts(d, zone);
|
|
12787
|
+
return calendarDate(p.year, p.month + n, 1, zone);
|
|
11987
12788
|
}
|
|
11988
|
-
function startOfMonth(d) {
|
|
11989
|
-
return
|
|
12789
|
+
function startOfMonth(d, zone = "system") {
|
|
12790
|
+
return addMonths(d, 0, zone);
|
|
11990
12791
|
}
|
|
11991
|
-
function sameDay(a, b) {
|
|
11992
|
-
return a
|
|
12792
|
+
function sameDay(a, b, zone = "system") {
|
|
12793
|
+
return dayKey(a, zone) === dayKey(b, zone);
|
|
11993
12794
|
}
|
|
11994
|
-
function sameMonth(a, b) {
|
|
11995
|
-
|
|
12795
|
+
function sameMonth(a, b, zone = "system") {
|
|
12796
|
+
const p = zonedParts(a, zone), q = zonedParts(b, zone);
|
|
12797
|
+
return p.year === q.year && p.month === q.month;
|
|
11996
12798
|
}
|
|
11997
|
-
|
|
11998
|
-
|
|
11999
|
-
return
|
|
12799
|
+
function weekday(d, zone = "system") {
|
|
12800
|
+
const p = zonedParts(d, zone);
|
|
12801
|
+
return new Date(Date.UTC(p.year, p.month - 1, p.day)).getUTCDay();
|
|
12000
12802
|
}
|
|
12001
|
-
function
|
|
12002
|
-
|
|
12003
|
-
return Array.from({ length: 7 }, (_, i) => addDays(first, i));
|
|
12803
|
+
function startOfWeek(d, weekStartsOn, zone = "system") {
|
|
12804
|
+
return addDays(d, -((weekday(d, zone) - weekStartsOn + 7) % 7), zone);
|
|
12004
12805
|
}
|
|
12005
|
-
|
|
12006
|
-
|
|
12007
|
-
|
|
12008
|
-
return Array.from({ length: 6 }, (_, w) => Array.from({ length: 7 }, (_, i) => addDays(start, w * 7 + i)));
|
|
12806
|
+
function weekDays(d, weekStartsOn, zone = "system") {
|
|
12807
|
+
const first = startOfWeek(d, weekStartsOn, zone);
|
|
12808
|
+
return Array.from({ length: 7 }, (_, i) => addDays(first, i, zone));
|
|
12009
12809
|
}
|
|
12010
|
-
|
|
12011
|
-
|
|
12012
|
-
return
|
|
12810
|
+
function monthGrid(d, weekStartsOn, zone = "system") {
|
|
12811
|
+
const start = startOfWeek(startOfMonth(d, zone), weekStartsOn, zone);
|
|
12812
|
+
return Array.from({ length: 6 }, (_, w) => Array.from({ length: 7 }, (_, i) => addDays(start, w * 7 + i, zone)));
|
|
12813
|
+
}
|
|
12814
|
+
function hourOf(d, zone = "system") {
|
|
12815
|
+
const p = zonedParts(d, zone);
|
|
12816
|
+
return p.hour + p.minute / 60;
|
|
12013
12817
|
}
|
|
12014
12818
|
const cache = /* @__PURE__ */ new Map();
|
|
12819
|
+
const runtimeLocales = /* @__PURE__ */ new WeakMap();
|
|
12820
|
+
function runtimeLocale() {
|
|
12821
|
+
let locale = runtimeLocales.get(Intl.DateTimeFormat);
|
|
12822
|
+
if (!locale) {
|
|
12823
|
+
locale = new Intl.DateTimeFormat().resolvedOptions().locale;
|
|
12824
|
+
runtimeLocales.set(Intl.DateTimeFormat, locale);
|
|
12825
|
+
}
|
|
12826
|
+
return locale;
|
|
12827
|
+
}
|
|
12015
12828
|
/** Cached Intl formatter; an omitted locale uses the runtime locale. */
|
|
12016
12829
|
const fmt = (locale, opts) => {
|
|
12017
|
-
const key = `${locale ??
|
|
12830
|
+
const key = `${locale ?? runtimeLocale()}|${JSON.stringify(opts)}`;
|
|
12018
12831
|
let f = cache.get(key);
|
|
12019
12832
|
if (!f) {
|
|
12020
12833
|
f = new Intl.DateTimeFormat(locale, opts);
|
|
@@ -12023,13 +12836,14 @@ const fmt = (locale, opts) => {
|
|
|
12023
12836
|
return f;
|
|
12024
12837
|
};
|
|
12025
12838
|
/** "9:30 AM" or "09:30". */
|
|
12026
|
-
const formatTime = (d, locale, hourCycle) => fmt(locale, {
|
|
12839
|
+
const formatTime = (d, locale, hourCycle, zone = "system") => fmt(locale, {
|
|
12840
|
+
timeZone: zone === "system" ? void 0 : zone,
|
|
12027
12841
|
hour: hourCycle === "h12" ? "numeric" : "2-digit",
|
|
12028
12842
|
minute: "2-digit",
|
|
12029
12843
|
hourCycle
|
|
12030
12844
|
}).format(d);
|
|
12031
12845
|
/** "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)}`;
|
|
12846
|
+
const formatRange = (start, end, locale, hourCycle, zone = "system") => `${formatTime(start, locale, hourCycle, zone)}–${formatTime(end, locale, hourCycle, zone)}`;
|
|
12033
12847
|
/** Compact gutter label: "9 AM" or "09:00". */
|
|
12034
12848
|
const formatHour = (hour, locale, hourCycle) => fmt(locale, {
|
|
12035
12849
|
hour: hourCycle === "h12" ? "numeric" : "2-digit",
|
|
@@ -12037,43 +12851,51 @@ const formatHour = (hour, locale, hourCycle) => fmt(locale, {
|
|
|
12037
12851
|
hourCycle
|
|
12038
12852
|
}).format(new Date(2026, 0, 1, hour));
|
|
12039
12853
|
/** "Wednesday, April 15, 2026". */
|
|
12040
|
-
const formatFullDate = (d, locale) => fmt(locale, {
|
|
12854
|
+
const formatFullDate = (d, locale, zone = "system") => fmt(locale, {
|
|
12855
|
+
timeZone: zone === "system" ? void 0 : zone,
|
|
12041
12856
|
weekday: "long",
|
|
12042
12857
|
month: "long",
|
|
12043
12858
|
day: "numeric",
|
|
12044
12859
|
year: "numeric"
|
|
12045
12860
|
}).format(d);
|
|
12046
12861
|
/** "Wednesday, April 15". */
|
|
12047
|
-
const formatDay = (d, locale) => fmt(locale, {
|
|
12862
|
+
const formatDay = (d, locale, zone = "system") => fmt(locale, {
|
|
12863
|
+
timeZone: zone === "system" ? void 0 : zone,
|
|
12048
12864
|
weekday: "long",
|
|
12049
12865
|
month: "long",
|
|
12050
12866
|
day: "numeric"
|
|
12051
12867
|
}).format(d);
|
|
12052
12868
|
/** "April 2026". */
|
|
12053
|
-
const formatMonth = (d, locale) => fmt(locale, {
|
|
12869
|
+
const formatMonth = (d, locale, zone = "system") => fmt(locale, {
|
|
12870
|
+
timeZone: zone === "system" ? void 0 : zone,
|
|
12054
12871
|
month: "long",
|
|
12055
12872
|
year: "numeric"
|
|
12056
12873
|
}).format(d);
|
|
12057
12874
|
/** "Apr 15". */
|
|
12058
|
-
const formatShort = (d, locale) => fmt(locale, {
|
|
12875
|
+
const formatShort = (d, locale, zone = "system") => fmt(locale, {
|
|
12876
|
+
timeZone: zone === "system" ? void 0 : zone,
|
|
12059
12877
|
month: "short",
|
|
12060
12878
|
day: "numeric"
|
|
12061
12879
|
}).format(d);
|
|
12062
12880
|
/** "Wed". */
|
|
12063
|
-
const formatWeekday = (d, locale, weekday = "short") => fmt(locale, {
|
|
12881
|
+
const formatWeekday = (d, locale, weekday = "short", zone = "system") => fmt(locale, {
|
|
12882
|
+
timeZone: zone === "system" ? void 0 : zone,
|
|
12883
|
+
weekday
|
|
12884
|
+
}).format(d);
|
|
12064
12885
|
/** "Apr 13 – 19, 2026" (or across months / years). */
|
|
12065
|
-
function formatWeekRange(days, locale) {
|
|
12886
|
+
function formatWeekRange(days, locale, zone = "system") {
|
|
12066
12887
|
const first = days[0];
|
|
12067
12888
|
const last = days[days.length - 1];
|
|
12068
12889
|
if (!first || !last) return "";
|
|
12069
12890
|
if (locale && !locale.toLowerCase().startsWith("en")) return fmt(locale, {
|
|
12891
|
+
timeZone: zone === "system" ? void 0 : zone,
|
|
12070
12892
|
month: "short",
|
|
12071
12893
|
day: "numeric",
|
|
12072
12894
|
year: "numeric"
|
|
12073
12895
|
}).formatRange(first, last);
|
|
12074
|
-
if (sameMonth(first, last)) return `${formatShort(first, "en-US")} – ${last.
|
|
12075
|
-
if (first.
|
|
12076
|
-
return `${formatShort(first, "en-US")}, ${first.
|
|
12896
|
+
if (sameMonth(first, last, zone)) return `${formatShort(first, "en-US", zone)} – ${zonedParts(last, zone).day}, ${zonedParts(last, zone).year}`;
|
|
12897
|
+
if (zonedParts(first, zone).year === zonedParts(last, zone).year) return `${formatShort(first, "en-US", zone)} – ${formatShort(last, "en-US", zone)}, ${zonedParts(last, zone).year}`;
|
|
12898
|
+
return `${formatShort(first, "en-US", zone)}, ${zonedParts(first, zone).year} – ${formatShort(last, "en-US", zone)}, ${zonedParts(last, zone).year}`;
|
|
12077
12899
|
}
|
|
12078
12900
|
/** Internal to blocks: Intl weekdays 1–7 become JS weekdays 0–6. */
|
|
12079
12901
|
function weekendDays(locale) {
|
|
@@ -12161,10 +12983,10 @@ const TONE = {
|
|
|
12161
12983
|
}
|
|
12162
12984
|
};
|
|
12163
12985
|
/** Events grouped by local day key, each day sorted by start. */
|
|
12164
|
-
function groupByDay(events) {
|
|
12986
|
+
function groupByDay(events, timeZone = "system") {
|
|
12165
12987
|
const map = /* @__PURE__ */ new Map();
|
|
12166
12988
|
for (const e of events) {
|
|
12167
|
-
const key = dayKey(e.start);
|
|
12989
|
+
const key = dayKey(e.start, timeZone);
|
|
12168
12990
|
const list = map.get(key);
|
|
12169
12991
|
if (list) list.push(e);
|
|
12170
12992
|
else map.set(key, [e]);
|
|
@@ -12436,51 +13258,52 @@ const sampleEvents = ROWS.map(([day, kind, title, start, hours, location], i) =>
|
|
|
12436
13258
|
* Keyboard: arrows move by day/week, Home/End to the week edges, PageUp/PageDown by month,
|
|
12437
13259
|
* Enter/Space selects.
|
|
12438
13260
|
*/
|
|
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();
|
|
13261
|
+
function MonthCalendar({ events = sampleEvents, timeZone: timeZoneProp, hourCycle: hourCycleProp, weekStartsOn: weekStartsOnProp, today = sampleToday, defaultMonth, onMonthChange, defaultSelected, onSelectDate, kinds = defaultEventKinds, maxEventsPerDay = 2, actions, className }) {
|
|
13262
|
+
const { t, locale, dir, timeZone: providerZone } = useI18n();
|
|
13263
|
+
const timeZone = timeZoneProp ?? providerZone;
|
|
12441
13264
|
const clock = useSchedulingClock(hourCycleProp);
|
|
12442
13265
|
const weekStartsOn = weekStartsOnProp ?? localeWeekStart(clock.locale);
|
|
12443
13266
|
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));
|
|
13267
|
+
const [selected, setSelected] = useState(() => startOfDay(defaultSelected ?? today, timeZone));
|
|
13268
|
+
const [focused, setFocused] = useState(() => startOfDay(defaultSelected ?? defaultMonth ?? today, timeZone));
|
|
13269
|
+
const [month, setMonth] = useState(() => startOfMonth(defaultMonth ?? defaultSelected ?? today, timeZone));
|
|
12447
13270
|
const gridRef = useRef(null);
|
|
12448
13271
|
const moveFocus = useRef(false);
|
|
12449
|
-
const byDay = useMemo(() => groupByDay(events), [events]);
|
|
12450
|
-
const weeks = monthGrid(month, weekStartsOn);
|
|
13272
|
+
const byDay = useMemo(() => groupByDay(events, timeZone), [events, timeZone]);
|
|
13273
|
+
const weeks = monthGrid(month, weekStartsOn, timeZone);
|
|
12451
13274
|
const weekend = weekendDays(clock.locale);
|
|
12452
|
-
const tabStop = sameMonth(focused, month) ? focused : sameMonth(selected, month) ? selected : month;
|
|
13275
|
+
const tabStop = sameMonth(focused, month, timeZone) ? focused : sameMonth(selected, month, timeZone) ? selected : month;
|
|
12453
13276
|
useEffect(() => {
|
|
12454
13277
|
if (!moveFocus.current) return;
|
|
12455
13278
|
moveFocus.current = false;
|
|
12456
|
-
gridRef.current?.querySelector(`[data-date="${dayKey(focused)}"]`)?.focus();
|
|
12457
|
-
}, [focused]);
|
|
13279
|
+
gridRef.current?.querySelector(`[data-date="${dayKey(focused, timeZone)}"]`)?.focus();
|
|
13280
|
+
}, [focused, timeZone]);
|
|
12458
13281
|
const showMonth = (next) => {
|
|
12459
|
-
const first = startOfMonth(next);
|
|
13282
|
+
const first = startOfMonth(next, timeZone);
|
|
12460
13283
|
setMonth(first);
|
|
12461
13284
|
onMonthChange?.(first);
|
|
12462
13285
|
};
|
|
12463
13286
|
const go = (date) => {
|
|
12464
13287
|
setFocused(date);
|
|
12465
|
-
if (!sameMonth(date, month)) showMonth(date);
|
|
13288
|
+
if (!sameMonth(date, month, timeZone)) showMonth(date);
|
|
12466
13289
|
moveFocus.current = true;
|
|
12467
13290
|
};
|
|
12468
13291
|
const select = (date) => {
|
|
12469
13292
|
setSelected(date);
|
|
12470
13293
|
setFocused(date);
|
|
12471
|
-
onSelectDate?.(date, byDay.get(dayKey(date)) ?? []);
|
|
13294
|
+
onSelectDate?.(date, byDay.get(dayKey(date, timeZone)) ?? []);
|
|
12472
13295
|
};
|
|
12473
13296
|
const onKeyDown = (event, date) => {
|
|
12474
|
-
const weekStart = startOfWeek(date, weekStartsOn);
|
|
13297
|
+
const weekStart = startOfWeek(date, weekStartsOn, timeZone);
|
|
12475
13298
|
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),
|
|
13299
|
+
ArrowLeft: () => addDays(date, dir === "rtl" ? 1 : -1, timeZone),
|
|
13300
|
+
ArrowRight: () => addDays(date, dir === "rtl" ? -1 : 1, timeZone),
|
|
13301
|
+
ArrowUp: () => addDays(date, -7, timeZone),
|
|
13302
|
+
ArrowDown: () => addDays(date, 7, timeZone),
|
|
12480
13303
|
Home: () => weekStart,
|
|
12481
|
-
End: () => addDays(weekStart, 6),
|
|
12482
|
-
PageUp: () =>
|
|
12483
|
-
PageDown: () =>
|
|
13304
|
+
End: () => addDays(weekStart, 6, timeZone),
|
|
13305
|
+
PageUp: () => addDays(addMonths(date, -1, timeZone), Math.min(zonedParts(date, timeZone).day, 28) - 1, timeZone),
|
|
13306
|
+
PageDown: () => addDays(addMonths(date, 1, timeZone), Math.min(zonedParts(date, timeZone).day, 28) - 1, timeZone)
|
|
12484
13307
|
}[event.key];
|
|
12485
13308
|
if (!next) return;
|
|
12486
13309
|
event.preventDefault();
|
|
@@ -12489,15 +13312,17 @@ function MonthCalendar({ events = sampleEvents, hourCycle: hourCycleProp, weekSt
|
|
|
12489
13312
|
return /* @__PURE__ */ jsxs("div", {
|
|
12490
13313
|
className: cn("overflow-hidden rounded-xl border border-border bg-card", className),
|
|
12491
13314
|
children: [/* @__PURE__ */ jsx(CalendarHeader, {
|
|
13315
|
+
timeZone,
|
|
13316
|
+
referenceDate: month,
|
|
12492
13317
|
titleId,
|
|
12493
|
-
title: formatMonth(month, locale),
|
|
13318
|
+
title: formatMonth(month, locale, timeZone),
|
|
12494
13319
|
prevLabel: t("calendar.previousMonth"),
|
|
12495
13320
|
nextLabel: t("calendar.nextMonth"),
|
|
12496
|
-
onPrev: () => showMonth(addMonths(month, -1)),
|
|
12497
|
-
onNext: () => showMonth(addMonths(month, 1)),
|
|
13321
|
+
onPrev: () => showMonth(addMonths(month, -1, timeZone)),
|
|
13322
|
+
onNext: () => showMonth(addMonths(month, 1, timeZone)),
|
|
12498
13323
|
onToday: () => {
|
|
12499
13324
|
showMonth(today);
|
|
12500
|
-
setFocused(startOfDay(today));
|
|
13325
|
+
setFocused(startOfDay(today, timeZone));
|
|
12501
13326
|
},
|
|
12502
13327
|
actions
|
|
12503
13328
|
}), /* @__PURE__ */ jsxs("div", {
|
|
@@ -12509,40 +13334,40 @@ function MonthCalendar({ events = sampleEvents, hourCycle: hourCycleProp, weekSt
|
|
|
12509
13334
|
className: "grid grid-cols-7 border-b border-border bg-secondary/30",
|
|
12510
13335
|
children: (weeks[0] ?? []).map((day) => /* @__PURE__ */ jsx("div", {
|
|
12511
13336
|
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
|
|
13337
|
+
"aria-label": formatWeekday(day, locale, "long", timeZone),
|
|
13338
|
+
className: "py-2 text-center text-[11px] font-medium tracking-wide text-muted-foreground label-case",
|
|
13339
|
+
children: formatWeekday(day, locale, "short", timeZone)
|
|
13340
|
+
}, weekday(day, timeZone)))
|
|
12516
13341
|
}), weeks.map((week) => /* @__PURE__ */ jsx("div", {
|
|
12517
13342
|
role: "row",
|
|
12518
13343
|
className: "grid grid-cols-7",
|
|
12519
13344
|
children: week.map((date) => {
|
|
12520
|
-
const key = dayKey(date);
|
|
13345
|
+
const key = dayKey(date, timeZone);
|
|
12521
13346
|
const list = byDay.get(key) ?? [];
|
|
12522
|
-
const inMonth = sameMonth(date, month);
|
|
12523
|
-
const isToday = sameDay(date, today);
|
|
12524
|
-
const isSelected = sameDay(date, selected);
|
|
13347
|
+
const inMonth = sameMonth(date, month, timeZone);
|
|
13348
|
+
const isToday = sameDay(date, today, timeZone);
|
|
13349
|
+
const isSelected = sameDay(date, selected, timeZone);
|
|
12525
13350
|
const extra = list.length - maxEventsPerDay;
|
|
12526
13351
|
return /* @__PURE__ */ jsx("div", {
|
|
12527
13352
|
role: "gridcell",
|
|
12528
|
-
"data-weekend": weekend.includes(date
|
|
13353
|
+
"data-weekend": weekend.includes(weekday(date, timeZone)) ? "" : void 0,
|
|
12529
13354
|
"aria-selected": isSelected,
|
|
12530
13355
|
className: "min-w-0 border-e border-b border-border/70 [&:nth-child(7)]:border-e-0",
|
|
12531
13356
|
children: /* @__PURE__ */ jsxs("button", {
|
|
12532
13357
|
type: "button",
|
|
12533
13358
|
"data-date": key,
|
|
12534
|
-
tabIndex: sameDay(date, tabStop) ? 0 : -1,
|
|
12535
|
-
"aria-label": `${formatFullDate(date, locale)}${list.length ? `, ${t("calendar.events", { count: list.length })}` : ""}`,
|
|
13359
|
+
tabIndex: sameDay(date, tabStop, timeZone) ? 0 : -1,
|
|
13360
|
+
"aria-label": `${formatFullDate(date, locale, timeZone)}${list.length ? `, ${t("calendar.events", { count: list.length })}` : ""}`,
|
|
12536
13361
|
"aria-current": isToday ? "date" : void 0,
|
|
12537
13362
|
onClick: () => select(date),
|
|
12538
13363
|
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-
|
|
13364
|
+
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
13365
|
children: [
|
|
12541
13366
|
/* @__PURE__ */ jsxs("span", {
|
|
12542
13367
|
className: "flex items-center justify-between",
|
|
12543
13368
|
children: [/* @__PURE__ */ jsx("span", {
|
|
12544
13369
|
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.
|
|
13370
|
+
children: zonedParts(date, timeZone).day
|
|
12546
13371
|
}), isSelected && !isToday && /* @__PURE__ */ jsx("span", {
|
|
12547
13372
|
"aria-hidden": true,
|
|
12548
13373
|
className: "size-1.5 rounded-full bg-primary"
|
|
@@ -12566,7 +13391,7 @@ function MonthCalendar({ events = sampleEvents, hourCycle: hourCycleProp, weekSt
|
|
|
12566
13391
|
}),
|
|
12567
13392
|
/* @__PURE__ */ jsx("span", {
|
|
12568
13393
|
className: "ms-auto hidden shrink-0 font-mono text-[10px] text-muted-foreground xl:block",
|
|
12569
|
-
children: formatTime(e.start, clock.locale, clock.hourCycle)
|
|
13394
|
+
children: formatTime(e.start, clock.locale, clock.hourCycle, timeZone)
|
|
12570
13395
|
})
|
|
12571
13396
|
]
|
|
12572
13397
|
}, e.id)), extra > 0 && /* @__PURE__ */ jsxs("span", {
|
|
@@ -12578,24 +13403,24 @@ function MonthCalendar({ events = sampleEvents, hourCycle: hourCycleProp, weekSt
|
|
|
12578
13403
|
})
|
|
12579
13404
|
}, key);
|
|
12580
13405
|
})
|
|
12581
|
-
}, dayKey(week[0] ?? month)))]
|
|
13406
|
+
}, dayKey(week[0] ?? month, timeZone)))]
|
|
12582
13407
|
})]
|
|
12583
13408
|
});
|
|
12584
13409
|
}
|
|
12585
13410
|
//#endregion
|
|
12586
13411
|
//#region src/scheduling/MonthCalendar/block.meta.ts
|
|
12587
|
-
const meta$
|
|
13412
|
+
const meta$44 = {
|
|
12588
13413
|
name: "Month calendar",
|
|
12589
13414
|
family: "scheduling",
|
|
12590
13415
|
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.",
|
|
13416
|
+
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
13417
|
uses: ["Button", "IconButton"]
|
|
12593
13418
|
};
|
|
12594
13419
|
//#endregion
|
|
12595
13420
|
//#region src/scheduling/WeekCalendar/WeekCalendar.tsx
|
|
12596
13421
|
const HOURS = Array.from({ length: 24 }, (_, h) => h);
|
|
12597
13422
|
/** Side-by-side lanes for overlapping events within one day. */
|
|
12598
|
-
function layoutDay(list, hourHeight) {
|
|
13423
|
+
function layoutDay(list, hourHeight, timeZone) {
|
|
12599
13424
|
const placed = [];
|
|
12600
13425
|
let cluster = [];
|
|
12601
13426
|
let clusterEnd = -1;
|
|
@@ -12606,8 +13431,8 @@ function layoutDay(list, hourHeight) {
|
|
|
12606
13431
|
laneEnds = [];
|
|
12607
13432
|
};
|
|
12608
13433
|
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);
|
|
13434
|
+
const start = hourOf(event.start, timeZone);
|
|
13435
|
+
const end = Math.max(sameDay(event.start, event.end, timeZone) ? hourOf(event.end, timeZone) : 24, start + .25);
|
|
12611
13436
|
if (start >= clusterEnd) close();
|
|
12612
13437
|
let lane = laneEnds.findIndex((e) => e <= start);
|
|
12613
13438
|
if (lane === -1) {
|
|
@@ -12629,19 +13454,20 @@ function layoutDay(list, hourHeight) {
|
|
|
12629
13454
|
return placed;
|
|
12630
13455
|
}
|
|
12631
13456
|
/** 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();
|
|
13457
|
+
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 }) {
|
|
13458
|
+
const { t, locale, timeZone: providerZone } = useI18n();
|
|
13459
|
+
const timeZone = timeZoneProp ?? providerZone;
|
|
12634
13460
|
const clock = useSchedulingClock(hourCycleProp);
|
|
12635
13461
|
const weekStartsOn = weekStartsOnProp ?? localeWeekStart(clock.locale);
|
|
12636
13462
|
const titleId = useId();
|
|
12637
|
-
const [weekStart, setWeekStart] = useState(() => startOfWeek(defaultWeek ?? today, weekStartsOn));
|
|
13463
|
+
const [weekStart, setWeekStart] = useState(() => startOfWeek(defaultWeek ?? today, weekStartsOn, timeZone));
|
|
12638
13464
|
const scrollRef = useRef(null);
|
|
12639
|
-
const byDay = useMemo(() => groupByDay(events), [events]);
|
|
12640
|
-
const days = weekDays(weekStart, weekStartsOn);
|
|
13465
|
+
const byDay = useMemo(() => groupByDay(events, timeZone), [events, timeZone]);
|
|
13466
|
+
const days = weekDays(weekStart, weekStartsOn, timeZone);
|
|
12641
13467
|
const visibleStart = days[0] ?? weekStart;
|
|
12642
13468
|
const weekend = weekendDays(clock.locale);
|
|
12643
13469
|
const nowAt = now ?? today;
|
|
12644
|
-
const nowVisible = days.some((d) => sameDay(d, nowAt));
|
|
13470
|
+
const nowVisible = days.some((d) => sameDay(d, nowAt, timeZone));
|
|
12645
13471
|
useEffect(() => {
|
|
12646
13472
|
if (scrollRef.current) scrollRef.current.scrollTop = Math.max(scrollToHour * hourHeight - 8, 0);
|
|
12647
13473
|
}, [scrollToHour, hourHeight]);
|
|
@@ -12652,13 +13478,15 @@ function WeekCalendar({ events = sampleEvents, weekStartsOn: weekStartsOnProp, h
|
|
|
12652
13478
|
return /* @__PURE__ */ jsxs("div", {
|
|
12653
13479
|
className: cn("overflow-hidden rounded-xl border border-border bg-card", className),
|
|
12654
13480
|
children: [/* @__PURE__ */ jsx(CalendarHeader, {
|
|
13481
|
+
timeZone,
|
|
13482
|
+
referenceDate: visibleStart,
|
|
12655
13483
|
titleId,
|
|
12656
|
-
title: formatWeekRange(days, locale),
|
|
13484
|
+
title: formatWeekRange(days, locale, timeZone),
|
|
12657
13485
|
prevLabel: t("calendar.previousWeek"),
|
|
12658
13486
|
nextLabel: t("calendar.nextWeek"),
|
|
12659
|
-
onPrev: () => show(addDays(visibleStart, -7)),
|
|
12660
|
-
onNext: () => show(addDays(visibleStart, 7)),
|
|
12661
|
-
onToday: () => show(startOfWeek(today, weekStartsOn)),
|
|
13487
|
+
onPrev: () => show(addDays(visibleStart, -7, timeZone)),
|
|
13488
|
+
onNext: () => show(addDays(visibleStart, 7, timeZone)),
|
|
13489
|
+
onToday: () => show(startOfWeek(today, weekStartsOn, timeZone)),
|
|
12662
13490
|
actions
|
|
12663
13491
|
}), /* @__PURE__ */ jsx("div", {
|
|
12664
13492
|
className: "overflow-x-auto",
|
|
@@ -12670,25 +13498,25 @@ function WeekCalendar({ events = sampleEvents, weekStartsOn: weekStartsOnProp, h
|
|
|
12670
13498
|
children: [/* @__PURE__ */ jsx("div", { className: "w-14 shrink-0 border-e border-border/70" }), /* @__PURE__ */ jsx("div", {
|
|
12671
13499
|
className: "grid flex-1 grid-cols-7",
|
|
12672
13500
|
children: days.map((d) => {
|
|
12673
|
-
const isToday = sameDay(d, today);
|
|
13501
|
+
const isToday = sameDay(d, today, timeZone);
|
|
12674
13502
|
return /* @__PURE__ */ jsxs("div", {
|
|
12675
13503
|
className: "flex flex-col items-center justify-center border-s border-border/70 py-2 first:border-s-0",
|
|
12676
13504
|
children: [/* @__PURE__ */ jsx("span", {
|
|
12677
13505
|
className: "text-[11px] text-muted-foreground",
|
|
12678
|
-
children: formatWeekday(d, locale)
|
|
13506
|
+
children: formatWeekday(d, locale, "short", timeZone)
|
|
12679
13507
|
}), /* @__PURE__ */ jsx("span", {
|
|
12680
13508
|
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.
|
|
13509
|
+
children: zonedParts(d, timeZone).day
|
|
12682
13510
|
})]
|
|
12683
|
-
}, dayKey(d));
|
|
13511
|
+
}, dayKey(d, timeZone));
|
|
12684
13512
|
})
|
|
12685
13513
|
})]
|
|
12686
13514
|
}), /* @__PURE__ */ jsx("div", {
|
|
12687
13515
|
ref: scrollRef,
|
|
12688
13516
|
tabIndex: 0,
|
|
12689
13517
|
role: "region",
|
|
12690
|
-
"aria-labelledby": titleId
|
|
12691
|
-
className: "overflow-y-auto focus-
|
|
13518
|
+
"aria-labelledby": timeZone === "system" ? titleId : `${titleId} ${titleId}-zone`,
|
|
13519
|
+
className: "overflow-y-auto focus-ring-inset",
|
|
12692
13520
|
style: { maxHeight: height },
|
|
12693
13521
|
children: /* @__PURE__ */ jsxs("div", {
|
|
12694
13522
|
className: "relative flex",
|
|
@@ -12715,21 +13543,21 @@ function WeekCalendar({ events = sampleEvents, weekStartsOn: weekStartsOnProp, h
|
|
|
12715
13543
|
/* @__PURE__ */ jsx("div", {
|
|
12716
13544
|
className: "relative grid h-full grid-cols-7",
|
|
12717
13545
|
children: days.map((d) => {
|
|
12718
|
-
const list = byDay.get(dayKey(d)) ?? [];
|
|
13546
|
+
const list = byDay.get(dayKey(d, timeZone)) ?? [];
|
|
12719
13547
|
return /* @__PURE__ */ jsx("ul", {
|
|
12720
|
-
"data-weekend": weekend.includes(d
|
|
12721
|
-
"aria-label": formatDay(d, locale),
|
|
13548
|
+
"data-weekend": weekend.includes(weekday(d, timeZone)) ? "" : void 0,
|
|
13549
|
+
"aria-label": formatDay(d, locale, timeZone),
|
|
12722
13550
|
className: "relative border-s border-border/70 first:border-s-0",
|
|
12723
|
-
children: layoutDay(list, hourHeight).map(({ event, top, height: h, lane, lanes }) => {
|
|
13551
|
+
children: layoutDay(list, hourHeight, timeZone).map(({ event, top, height: h, lane, lanes }) => {
|
|
12724
13552
|
const kind = kindOf(event, kinds);
|
|
12725
13553
|
const tone = TONE[kind.tone];
|
|
12726
|
-
const range = formatRange(event.start, event.end, clock.locale, clock.hourCycle);
|
|
13554
|
+
const range = formatRange(event.start, event.end, clock.locale, clock.hourCycle, timeZone);
|
|
12727
13555
|
const body = /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
|
|
12728
13556
|
className: "block truncate text-[11px] leading-tight font-semibold text-foreground",
|
|
12729
13557
|
children: event.title
|
|
12730
13558
|
}), /* @__PURE__ */ jsx("span", {
|
|
12731
13559
|
className: "block truncate font-mono text-[10px] text-foreground",
|
|
12732
|
-
children: formatTime(event.start, clock.locale, clock.hourCycle)
|
|
13560
|
+
children: formatTime(event.start, clock.locale, clock.hourCycle, timeZone)
|
|
12733
13561
|
})] });
|
|
12734
13562
|
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
13563
|
return /* @__PURE__ */ jsx("li", {
|
|
@@ -12756,13 +13584,13 @@ function WeekCalendar({ events = sampleEvents, weekStartsOn: weekStartsOnProp, h
|
|
|
12756
13584
|
})
|
|
12757
13585
|
}, event.id);
|
|
12758
13586
|
})
|
|
12759
|
-
}, dayKey(d));
|
|
13587
|
+
}, dayKey(d, timeZone));
|
|
12760
13588
|
})
|
|
12761
13589
|
}),
|
|
12762
13590
|
nowVisible && /* @__PURE__ */ jsxs("div", {
|
|
12763
13591
|
"aria-hidden": true,
|
|
12764
|
-
className: "pointer-events-none absolute inset-x-0 z-
|
|
12765
|
-
style: { top: hourOf(nowAt) * hourHeight },
|
|
13592
|
+
className: "pointer-events-none absolute inset-x-0 z-raised flex items-center",
|
|
13593
|
+
style: { top: hourOf(nowAt, timeZone) * hourHeight },
|
|
12766
13594
|
children: [
|
|
12767
13595
|
/* @__PURE__ */ jsx("span", { className: "-ms-1 size-2 shrink-0 rounded-full bg-primary" }),
|
|
12768
13596
|
/* @__PURE__ */ jsx("span", { className: "h-px flex-1 bg-primary" }),
|
|
@@ -12782,11 +13610,11 @@ function WeekCalendar({ events = sampleEvents, weekStartsOn: weekStartsOnProp, h
|
|
|
12782
13610
|
}
|
|
12783
13611
|
//#endregion
|
|
12784
13612
|
//#region src/scheduling/WeekCalendar/block.meta.ts
|
|
12785
|
-
const meta$
|
|
13613
|
+
const meta$78 = {
|
|
12786
13614
|
name: "Week calendar",
|
|
12787
13615
|
family: "scheduling",
|
|
12788
13616
|
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.",
|
|
13617
|
+
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
13618
|
uses: ["Button", "IconButton"]
|
|
12791
13619
|
};
|
|
12792
13620
|
//#endregion
|
|
@@ -12804,8 +13632,9 @@ function EventTile({ kind, className }) {
|
|
|
12804
13632
|
//#endregion
|
|
12805
13633
|
//#region src/scheduling/AgendaList/AgendaList.tsx
|
|
12806
13634
|
/** 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();
|
|
13635
|
+
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 }) {
|
|
13636
|
+
const { t, locale, timeZone: providerZone } = useI18n();
|
|
13637
|
+
const timeZone = timeZoneProp ?? providerZone;
|
|
12809
13638
|
const clock = useSchedulingClock(hourCycleProp);
|
|
12810
13639
|
const title = titleProp ?? t("calendar.agenda");
|
|
12811
13640
|
const emptyTitle = emptyTitleProp ?? t("calendar.emptyTitle");
|
|
@@ -12814,27 +13643,40 @@ function AgendaList({ events = sampleEvents, hourCycle: hourCycleProp, today = s
|
|
|
12814
13643
|
const uid = useId();
|
|
12815
13644
|
const start = from === void 0 ? today : from;
|
|
12816
13645
|
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));
|
|
13646
|
+
const first = start ? dayKey(start, timeZone) : null;
|
|
13647
|
+
const last = start && days != null ? dayKey(addDays(start, days - 1, timeZone), timeZone) : null;
|
|
13648
|
+
return [...groupByDay(events, timeZone).entries()].filter(([key]) => (first == null || key >= first) && (last == null || key <= last)).sort(([a], [b]) => a.localeCompare(b));
|
|
12820
13649
|
}, [
|
|
12821
13650
|
events,
|
|
12822
13651
|
start,
|
|
12823
|
-
days
|
|
13652
|
+
days,
|
|
13653
|
+
timeZone
|
|
12824
13654
|
]);
|
|
12825
13655
|
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);
|
|
13656
|
+
if (sameDay(d, today, timeZone)) return `${t("calendar.today")} · ${formatDay(d, locale, timeZone)}`;
|
|
13657
|
+
if (sameDay(d, addDays(today, 1, timeZone), timeZone)) return `${t("calendar.tomorrow")} · ${formatDay(d, locale, timeZone)}`;
|
|
13658
|
+
return formatDay(d, locale, timeZone);
|
|
12829
13659
|
};
|
|
12830
13660
|
return /* @__PURE__ */ jsxs("section", {
|
|
12831
|
-
"aria-label": title,
|
|
13661
|
+
"aria-label": timeZone === "system" ? title : void 0,
|
|
13662
|
+
"aria-labelledby": timeZone === "system" ? void 0 : `${uid}-title ${uid}-zone`,
|
|
12832
13663
|
className: cn("overflow-hidden rounded-xl border border-border bg-card", className),
|
|
12833
13664
|
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, {
|
|
13665
|
+
className: cn("flex items-center justify-between gap-3 border-b border-border px-4 py-3 sm:px-5", timeZone !== "system" && "flex-wrap"),
|
|
13666
|
+
children: [timeZone === "system" ? /* @__PURE__ */ jsx(TitleTag, {
|
|
12836
13667
|
className: "text-[15px] font-semibold tracking-tight text-foreground",
|
|
12837
13668
|
children: title
|
|
13669
|
+
}) : /* @__PURE__ */ jsxs("div", {
|
|
13670
|
+
className: "min-w-0",
|
|
13671
|
+
children: [/* @__PURE__ */ jsx(TitleTag, {
|
|
13672
|
+
id: `${uid}-title`,
|
|
13673
|
+
className: "text-[15px] font-semibold tracking-tight text-foreground",
|
|
13674
|
+
children: title
|
|
13675
|
+
}), /* @__PURE__ */ jsx(TimeZoneLabel, {
|
|
13676
|
+
id: `${uid}-zone`,
|
|
13677
|
+
timeZone,
|
|
13678
|
+
referenceDate: start ?? today
|
|
13679
|
+
})]
|
|
12838
13680
|
}), /* @__PURE__ */ jsxs("span", {
|
|
12839
13681
|
className: "font-mono text-[11px] text-muted-foreground",
|
|
12840
13682
|
children: [groups.reduce((n, [, list]) => n + list.length, 0), " scheduled"]
|
|
@@ -12850,21 +13692,21 @@ function AgendaList({ events = sampleEvents, hourCycle: hourCycleProp, today = s
|
|
|
12850
13692
|
tabIndex: maxHeight ? 0 : void 0,
|
|
12851
13693
|
role: maxHeight ? "region" : void 0,
|
|
12852
13694
|
"aria-label": maxHeight ? `${title} list` : void 0,
|
|
12853
|
-
className: "overflow-y-auto focus-
|
|
13695
|
+
className: "overflow-y-auto focus-ring-inset",
|
|
12854
13696
|
children: groups.map(([key, list]) => {
|
|
12855
13697
|
const first = list[0];
|
|
12856
13698
|
if (!first) return null;
|
|
12857
13699
|
const headingId = `${uid}-${key}`;
|
|
12858
13700
|
return /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(SubTag, {
|
|
12859
13701
|
id: headingId,
|
|
12860
|
-
className: "border-b border-border bg-secondary/30 px-4 py-2 font-mono text-[11px] tracking-wide text-muted-foreground
|
|
13702
|
+
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
13703
|
children: dayLabel(first.start)
|
|
12862
13704
|
}), /* @__PURE__ */ jsx("ul", {
|
|
12863
13705
|
"aria-labelledby": headingId,
|
|
12864
13706
|
className: "divide-y divide-border border-b border-border last:border-b-0",
|
|
12865
13707
|
children: list.map((event) => {
|
|
12866
13708
|
const kind = kindOf(event, kinds);
|
|
12867
|
-
const range = formatRange(event.start, event.end, clock.locale, clock.hourCycle);
|
|
13709
|
+
const range = formatRange(event.start, event.end, clock.locale, clock.hourCycle, timeZone);
|
|
12868
13710
|
const content = /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
12869
13711
|
/* @__PURE__ */ jsx(EventTile, { kind }),
|
|
12870
13712
|
/* @__PURE__ */ jsxs("span", {
|
|
@@ -12902,7 +13744,7 @@ function AgendaList({ events = sampleEvents, hourCycle: hourCycleProp, today = s
|
|
|
12902
13744
|
return /* @__PURE__ */ jsx("li", { children: onEventClick ? /* @__PURE__ */ jsxs("button", {
|
|
12903
13745
|
type: "button",
|
|
12904
13746
|
onClick: () => onEventClick(event),
|
|
12905
|
-
className: cn(row, "group transition-colors hover:bg-accent/30 focus-
|
|
13747
|
+
className: cn(row, "group transition-colors hover:bg-accent/30 focus-ring-inset motion-reduce:transition-none"),
|
|
12906
13748
|
children: [content, /* @__PURE__ */ jsx(ChevronRight, {
|
|
12907
13749
|
size: 16,
|
|
12908
13750
|
"aria-hidden": true,
|
|
@@ -12924,7 +13766,7 @@ const meta$1 = {
|
|
|
12924
13766
|
name: "Agenda list",
|
|
12925
13767
|
family: "scheduling",
|
|
12926
13768
|
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.",
|
|
13769
|
+
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
13770
|
uses: ["Badge", "EmptyState"]
|
|
12929
13771
|
};
|
|
12930
13772
|
//#endregion
|
|
@@ -13015,7 +13857,7 @@ function TimeSlotPicker({ slots = sampleTimeSlots, value, defaultValue = null, o
|
|
|
13015
13857
|
}
|
|
13016
13858
|
//#endregion
|
|
13017
13859
|
//#region src/scheduling/TimeSlotPicker/block.meta.ts
|
|
13018
|
-
const meta$
|
|
13860
|
+
const meta$73 = {
|
|
13019
13861
|
name: "Time slot picker",
|
|
13020
13862
|
family: "scheduling",
|
|
13021
13863
|
status: "beta",
|
|
@@ -13111,20 +13953,27 @@ const appSidebarUser = {
|
|
|
13111
13953
|
//#endregion
|
|
13112
13954
|
//#region src/shell/AppSidebar/AppSidebar.tsx
|
|
13113
13955
|
/** 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 }) {
|
|
13956
|
+
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
13957
|
const [current, setCurrent] = useState(currentWorkspaceId ?? workspaces?.[0]?.id ?? "");
|
|
13116
13958
|
const currentId = currentWorkspaceId ?? current;
|
|
13117
|
-
if (collapsed) return /* @__PURE__ */ jsx(Logo, {
|
|
13959
|
+
if (collapsed) return brand ?? /* @__PURE__ */ jsx(Logo, {
|
|
13118
13960
|
size: 26,
|
|
13119
13961
|
className
|
|
13120
13962
|
});
|
|
13121
|
-
if (
|
|
13963
|
+
if (hideWorkspaceContext) return brand ?? /* @__PURE__ */ jsx(Logo, {
|
|
13122
13964
|
size: 24,
|
|
13123
13965
|
wordmark: true,
|
|
13124
13966
|
className: cn("px-1", className)
|
|
13125
13967
|
});
|
|
13126
|
-
|
|
13127
|
-
|
|
13968
|
+
const stackParent = "[:has(>_&)]:flex-col [:has(>_&)]:items-stretch [:has(>_&)]:gap-2";
|
|
13969
|
+
const workspaceControl = !workspaces || workspaces.length === 0 ? brand == null && /* @__PURE__ */ jsx(Logo, {
|
|
13970
|
+
size: 24,
|
|
13971
|
+
wordmark: true,
|
|
13972
|
+
className: cn("px-1", contextStatus != null && stackParent, className)
|
|
13973
|
+
}) : /* @__PURE__ */ jsx(WorkspaceSwitcher, {
|
|
13974
|
+
label: workspaceLabel,
|
|
13975
|
+
emptyText: workspaceEmptyText,
|
|
13976
|
+
className: cn("w-full", (brand != null || contextStatus != null) && stackParent, className),
|
|
13128
13977
|
workspaces,
|
|
13129
13978
|
currentId,
|
|
13130
13979
|
onCreate: onCreateWorkspace,
|
|
@@ -13133,6 +13982,29 @@ function AppSidebarHeader({ collapsed = false, workspaces = appSidebarWorkspaces
|
|
|
13133
13982
|
onWorkspaceChange?.(w);
|
|
13134
13983
|
}
|
|
13135
13984
|
});
|
|
13985
|
+
if (!tenants && brand == null && !contextRegionLabel && contextStatus == null) return workspaceControl;
|
|
13986
|
+
const controls = /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
13987
|
+
tenants && /* @__PURE__ */ jsx(SimpleSelect, {
|
|
13988
|
+
items: tenants.map(({ id, name }) => ({
|
|
13989
|
+
value: id,
|
|
13990
|
+
label: name
|
|
13991
|
+
})),
|
|
13992
|
+
value: currentTenantId,
|
|
13993
|
+
onValueChange: (id) => onTenantSelect?.(id),
|
|
13994
|
+
"aria-label": tenantLabel,
|
|
13995
|
+
placeholder: tenants.length === 0 ? tenantEmptyText : "Select tenant",
|
|
13996
|
+
clearable: true,
|
|
13997
|
+
className: "w-full [&+button]:min-h-6 [&+button]:min-w-6 [:has(>_*_>_&)]:flex-col [:has(>_*_>_&)]:items-stretch [:has(>_*_>_&)]:gap-2"
|
|
13998
|
+
}),
|
|
13999
|
+
workspaceControl,
|
|
14000
|
+
contextStatus
|
|
14001
|
+
] });
|
|
14002
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [brand, contextRegionLabel ? /* @__PURE__ */ jsx("section", {
|
|
14003
|
+
"aria-label": contextRegionLabel,
|
|
14004
|
+
"aria-busy": contextBusy,
|
|
14005
|
+
className: cn("flex w-full min-w-0 flex-col gap-2", brand != null && stackParent),
|
|
14006
|
+
children: controls
|
|
14007
|
+
}) : controls] });
|
|
13136
14008
|
}
|
|
13137
14009
|
/** Sidebar body: the NavList (icon rail with tooltips when collapsed). */
|
|
13138
14010
|
function AppSidebarNav({ groups = appSidebarNavGroups, currentHref = "/projects", collapsed = false, label = "Main", onNavigate, className }) {
|
|
@@ -13146,7 +14018,7 @@ function AppSidebarNav({ groups = appSidebarNavGroups, currentHref = "/projects"
|
|
|
13146
14018
|
});
|
|
13147
14019
|
}
|
|
13148
14020
|
/** 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 }) {
|
|
14021
|
+
function AppSidebarFooter({ collapsed = false, usage = appSidebarUsage, helpHref = "#help", helpLabel = "Help & docs", user = appSidebarUser, userMenuItems, userMenuChildren, onSignOut, className }) {
|
|
13150
14022
|
return /* @__PURE__ */ jsxs("div", {
|
|
13151
14023
|
className: cn("flex flex-col gap-1.5", collapsed && "items-center", className),
|
|
13152
14024
|
children: [
|
|
@@ -13177,7 +14049,8 @@ function AppSidebarFooter({ collapsed = false, usage = appSidebarUsage, helpHref
|
|
|
13177
14049
|
items: userMenuItems,
|
|
13178
14050
|
onSignOut,
|
|
13179
14051
|
showName: !collapsed,
|
|
13180
|
-
className: collapsed ? void 0 : "w-full justify-start"
|
|
14052
|
+
className: collapsed ? void 0 : "w-full justify-start",
|
|
14053
|
+
children: userMenuChildren
|
|
13181
14054
|
})
|
|
13182
14055
|
]
|
|
13183
14056
|
});
|
|
@@ -13187,7 +14060,7 @@ function AppSidebarFooter({ collapsed = false, usage = appSidebarUsage, helpHref
|
|
|
13187
14060
|
* and a footer with usage, help and the user menu. Inside SidebarLayout, use the parts
|
|
13188
14061
|
* (AppSidebarHeader / AppSidebarNav / AppSidebarFooter) in its three slots.
|
|
13189
14062
|
*/
|
|
13190
|
-
function AppSidebar({ collapsed = false,
|
|
14063
|
+
function AppSidebar({ collapsed = false, navGroups, navLabel, currentHref, onNavigate, usage, helpHref, helpLabel, user, userMenuItems, userMenuChildren, onSignOut, className, ...headerProps }) {
|
|
13191
14064
|
return /* @__PURE__ */ jsxs("div", {
|
|
13192
14065
|
className: cn("flex h-full min-h-0 flex-col bg-chrome", collapsed ? "w-16" : "w-[248px]", className),
|
|
13193
14066
|
children: [
|
|
@@ -13195,10 +14068,7 @@ function AppSidebar({ collapsed = false, workspaces, currentWorkspaceId, onWorks
|
|
|
13195
14068
|
className: cn("flex shrink-0 items-center pt-4 pb-3", collapsed ? "justify-center px-2" : "px-3"),
|
|
13196
14069
|
children: /* @__PURE__ */ jsx(AppSidebarHeader, {
|
|
13197
14070
|
collapsed,
|
|
13198
|
-
|
|
13199
|
-
currentWorkspaceId,
|
|
13200
|
-
onWorkspaceChange,
|
|
13201
|
-
onCreateWorkspace
|
|
14071
|
+
...headerProps
|
|
13202
14072
|
})
|
|
13203
14073
|
}),
|
|
13204
14074
|
/* @__PURE__ */ jsx("div", {
|
|
@@ -13220,6 +14090,7 @@ function AppSidebar({ collapsed = false, workspaces, currentWorkspaceId, onWorks
|
|
|
13220
14090
|
helpLabel,
|
|
13221
14091
|
user,
|
|
13222
14092
|
userMenuItems,
|
|
14093
|
+
userMenuChildren,
|
|
13223
14094
|
onSignOut
|
|
13224
14095
|
})
|
|
13225
14096
|
})
|
|
@@ -13234,6 +14105,7 @@ const meta$2 = {
|
|
|
13234
14105
|
status: "beta",
|
|
13235
14106
|
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
14107
|
uses: [
|
|
14108
|
+
"SimpleSelect",
|
|
13237
14109
|
"WorkspaceSwitcher",
|
|
13238
14110
|
"Logo",
|
|
13239
14111
|
"NavList",
|
|
@@ -13757,7 +14629,7 @@ function orderColumns(columns, pinned) {
|
|
|
13757
14629
|
...right
|
|
13758
14630
|
];
|
|
13759
14631
|
}
|
|
13760
|
-
const STICKY = "sticky z-
|
|
14632
|
+
const STICKY = "sticky z-raised bg-card";
|
|
13761
14633
|
const START_EDGE = "border-e border-border";
|
|
13762
14634
|
const END_EDGE = "border-s border-border";
|
|
13763
14635
|
/**
|
|
@@ -13835,7 +14707,7 @@ function tableLayout({ columns, widths, pinned, sized, lead, trail }) {
|
|
|
13835
14707
|
/** Under-content tint for sticky cells of a hovered or selected row (and the header surface). */
|
|
13836
14708
|
function stickyTint(layout, { selected = false, head = false } = {}) {
|
|
13837
14709
|
if (!layout?.pinned) return void 0;
|
|
13838
|
-
const base = "before:pointer-events-none before:absolute before:inset-0 before
|
|
14710
|
+
const base = "before:pointer-events-none before:absolute before:inset-0 before:z-behind";
|
|
13839
14711
|
if (head) return `${base} before:bg-secondary/30`;
|
|
13840
14712
|
return `${base} ${selected ? "before:bg-primary/8" : "[tr:hover>&]:before:bg-accent/30"}`;
|
|
13841
14713
|
}
|
|
@@ -13986,39 +14858,15 @@ function focusSibling(from, dir) {
|
|
|
13986
14858
|
function EditableCell({ row, rowId, rowLabel, column, onCellEdit, hintId, children, labels }) {
|
|
13987
14859
|
const errorId = useId();
|
|
13988
14860
|
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
14861
|
const trigger = useRef(null);
|
|
13994
14862
|
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
14863
|
const focusOnMount = useCallback((el) => {
|
|
14005
14864
|
field.current = el;
|
|
14006
14865
|
if (!el) return;
|
|
14007
14866
|
el.focus();
|
|
14008
14867
|
if (el instanceof HTMLInputElement) el.select();
|
|
14009
14868
|
}, []);
|
|
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 = () => {
|
|
14869
|
+
const parse = (draft) => {
|
|
14022
14870
|
if (editor.type !== "number") return {
|
|
14023
14871
|
ok: true,
|
|
14024
14872
|
value: draft
|
|
@@ -14046,47 +14894,26 @@ function EditableCell({ row, rowId, rowLabel, column, onCellEdit, hintId, childr
|
|
|
14046
14894
|
value: n
|
|
14047
14895
|
};
|
|
14048
14896
|
};
|
|
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;
|
|
14897
|
+
const { editing, draft, setDraft, error, pending, busy, start, cancel, commit } = useInlineEdit({
|
|
14898
|
+
value: startValue(row, column),
|
|
14899
|
+
parse,
|
|
14900
|
+
genericError: labels?.editError ?? GENERIC_ERROR,
|
|
14901
|
+
focusEditor: (after) => {
|
|
14902
|
+
if (after !== null) field.current?.focus();
|
|
14903
|
+
},
|
|
14904
|
+
isEqual: (next, previous) => next === previous || previous != null && String(previous) === String(next) && editor.type !== "number",
|
|
14905
|
+
onSave: (value, previous) => onCellEdit({
|
|
14906
|
+
row,
|
|
14907
|
+
rowId,
|
|
14908
|
+
columnId: column.id,
|
|
14909
|
+
value,
|
|
14910
|
+
previous
|
|
14911
|
+
}),
|
|
14912
|
+
onMove: (dir) => {
|
|
14913
|
+
if (dir === "self") trigger.current?.focus();
|
|
14914
|
+
else focusSibling(trigger.current, dir);
|
|
14085
14915
|
}
|
|
14086
|
-
|
|
14087
|
-
setError(null);
|
|
14088
|
-
setEditing(false);
|
|
14089
|
-
};
|
|
14916
|
+
});
|
|
14090
14917
|
const onEditorKeyDown = (e) => {
|
|
14091
14918
|
if (e.key === "Escape") {
|
|
14092
14919
|
e.preventDefault();
|
|
@@ -14116,7 +14943,7 @@ function EditableCell({ row, rowId, rowLabel, column, onCellEdit, hintId, childr
|
|
|
14116
14943
|
start();
|
|
14117
14944
|
}
|
|
14118
14945
|
},
|
|
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-
|
|
14946
|
+
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
14947
|
children
|
|
14121
14948
|
});
|
|
14122
14949
|
const common = {
|
|
@@ -14137,7 +14964,7 @@ function EditableCell({ row, rowId, rowLabel, column, onCellEdit, hintId, childr
|
|
|
14137
14964
|
onChange: (e) => {
|
|
14138
14965
|
if (!pending) setDraft(e.target.value);
|
|
14139
14966
|
},
|
|
14140
|
-
className: cn("h-8 w-full rounded-md border border-input bg-background px-2 text-[13px] text-foreground", "focus-
|
|
14967
|
+
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
14968
|
...common,
|
|
14142
14969
|
children: editor.options.map((o) => /* @__PURE__ */ jsx("option", {
|
|
14143
14970
|
value: o.value,
|
|
@@ -14193,7 +15020,7 @@ function DataTableRow({ labels, row, columns, getRowId, getRowLabel, selectable,
|
|
|
14193
15020
|
className: "inline-flex",
|
|
14194
15021
|
children: /* @__PURE__ */ jsx("input", {
|
|
14195
15022
|
...singleSelection.inputProps(row),
|
|
14196
|
-
className: "size-4 accent-primary focus-
|
|
15023
|
+
className: "size-4 accent-primary focus-ring disabled:cursor-not-allowed"
|
|
14197
15024
|
})
|
|
14198
15025
|
}) : /* @__PURE__ */ jsx(Checkbox, {
|
|
14199
15026
|
"aria-label": labels?.selectRow?.(label) ?? t("table.selectRow", { label }),
|
|
@@ -14283,7 +15110,7 @@ function GroupHeaderRow({ labels, group, open, selectable, selected, span, colla
|
|
|
14283
15110
|
type: "button",
|
|
14284
15111
|
"aria-expanded": open,
|
|
14285
15112
|
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-
|
|
15113
|
+
className: "inline-flex max-w-full items-center gap-1.5 rounded-sm px-1 py-0.5 hover:bg-secondary focus-ring",
|
|
14287
15114
|
children: [/* @__PURE__ */ jsx(ChevronRight, {
|
|
14288
15115
|
size: 14,
|
|
14289
15116
|
"aria-hidden": true,
|
|
@@ -14653,7 +15480,7 @@ function ColumnResizeHandle({ label, width, min, max, onResize, onResizeEnd, lab
|
|
|
14653
15480
|
onPointerUp,
|
|
14654
15481
|
onPointerCancel: onPointerUp,
|
|
14655
15482
|
onKeyDown,
|
|
14656
|
-
className: cn("group/resizer absolute inset-y-0 -end-1.5 z-
|
|
15483
|
+
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
15484
|
children: /* @__PURE__ */ jsx("span", {
|
|
14658
15485
|
"aria-hidden": true,
|
|
14659
15486
|
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 +15495,7 @@ function ColumnResizeHandle({ label, width, min, max, onResize, onResizeEnd, lab
|
|
|
14668
15495
|
*/
|
|
14669
15496
|
function DataTableHeadCell({ column, sortDirection, onSortChange, layout, resize, labels }) {
|
|
14670
15497
|
const align = columnAlign(column);
|
|
14671
|
-
const pinnedClass = layout?.pinned ? cn(layout.className, "z-
|
|
15498
|
+
const pinnedClass = layout?.pinned ? cn(layout.className, "z-sticky-pinned", stickyTint(layout, { head: true }), "bg-card") : void 0;
|
|
14672
15499
|
if (!resize) return /* @__PURE__ */ jsx(TableHead, {
|
|
14673
15500
|
align,
|
|
14674
15501
|
className: cn(column.headClassName, pinnedClass),
|
|
@@ -15161,6 +15988,120 @@ function useVirtualRows({ enabled, count, rowHeight, tableRef, viewportHeight, o
|
|
|
15161
15988
|
return windowFor(count, scroll.top, scroll.height, rowHeight, overscan);
|
|
15162
15989
|
}
|
|
15163
15990
|
//#endregion
|
|
15991
|
+
//#region src/tables/DataTable/export-menu.tsx
|
|
15992
|
+
function ExportMenu({ count, selectedCount, scopes, busy, onExport, onCopy, labels }) {
|
|
15993
|
+
const { t, formatNumber } = useI18n();
|
|
15994
|
+
return /* @__PURE__ */ jsxs(Menu, { children: [/* @__PURE__ */ jsx(MenuTrigger, {
|
|
15995
|
+
disabled: busy,
|
|
15996
|
+
"aria-busy": busy || void 0,
|
|
15997
|
+
render: /* @__PURE__ */ jsx(Button, {
|
|
15998
|
+
variant: "secondary",
|
|
15999
|
+
size: "sm",
|
|
16000
|
+
icon: Download$1,
|
|
16001
|
+
loading: busy
|
|
16002
|
+
}),
|
|
16003
|
+
children: labels?.export ?? t("table.export")
|
|
16004
|
+
}), /* @__PURE__ */ jsxs(MenuContent, {
|
|
16005
|
+
align: "end",
|
|
16006
|
+
children: [
|
|
16007
|
+
scopes.includes("rows") && /* @__PURE__ */ jsx(MenuItem, {
|
|
16008
|
+
disabled: busy,
|
|
16009
|
+
onClick: () => onExport("rows"),
|
|
16010
|
+
children: labels?.exportAll?.(count) ?? t("table.exportAll", { count: formatNumber(count) })
|
|
16011
|
+
}),
|
|
16012
|
+
scopes.includes("page") && /* @__PURE__ */ jsx(MenuItem, {
|
|
16013
|
+
disabled: busy,
|
|
16014
|
+
onClick: () => onExport("page"),
|
|
16015
|
+
children: labels?.exportPage ?? t("table.exportPage")
|
|
16016
|
+
}),
|
|
16017
|
+
scopes.includes("selected") && selectedCount > 0 && /* @__PURE__ */ jsx(MenuItem, {
|
|
16018
|
+
disabled: busy,
|
|
16019
|
+
onClick: () => onExport("selected"),
|
|
16020
|
+
children: labels?.exportSelected?.(selectedCount) ?? t("table.exportSelected", { count: formatNumber(selectedCount) })
|
|
16021
|
+
}),
|
|
16022
|
+
scopes.includes("selected") && selectedCount > 0 && onCopy && /* @__PURE__ */ jsx(MenuItem, {
|
|
16023
|
+
disabled: busy,
|
|
16024
|
+
onClick: onCopy,
|
|
16025
|
+
children: labels?.copySelected ?? t("table.copySelected")
|
|
16026
|
+
})
|
|
16027
|
+
]
|
|
16028
|
+
})] });
|
|
16029
|
+
}
|
|
16030
|
+
//#endregion
|
|
16031
|
+
//#region src/tables/DataTable/use-table-export.ts
|
|
16032
|
+
function useTableExport(options) {
|
|
16033
|
+
const { t } = useI18n();
|
|
16034
|
+
const pending = useRef(false);
|
|
16035
|
+
const [busy, setBusy] = useState(false);
|
|
16036
|
+
const [announcement, setAnnouncement] = useState("");
|
|
16037
|
+
const enabled = !!options.csvExport && (!options.serverMode || !!options.onExport);
|
|
16038
|
+
const config = typeof options.csvExport === "object" ? options.csvExport : {};
|
|
16039
|
+
const columns = enabled ? options.columns.filter((column) => column.exportable !== false && (column.accessor || column.exportValue)) : [];
|
|
16040
|
+
const fileName = config.fileName ?? `${options.caption.toLowerCase().normalize("NFKD").replace(/\p{M}/gu, "").replace(/[^\p{L}\p{N}]+/gu, "-").replace(/^-|-$/g, "") || "table"}.csv`;
|
|
16041
|
+
const selected = new Set(enabled && !options.serverMode ? options.selectedIds : []);
|
|
16042
|
+
const selectedRows = selected.size ? options.sortedRows.filter((row) => selected.has(options.getRowId(row))) : [];
|
|
16043
|
+
const csvColumns = columns.map((column) => ({
|
|
16044
|
+
header: column.header,
|
|
16045
|
+
value: (row) => column.exportValue?.(row) ?? column.accessor?.(row)
|
|
16046
|
+
}));
|
|
16047
|
+
const scopes = config.scopes ?? [
|
|
16048
|
+
"rows",
|
|
16049
|
+
"page",
|
|
16050
|
+
"selected"
|
|
16051
|
+
];
|
|
16052
|
+
const copySelected = async () => {
|
|
16053
|
+
if (!enabled || options.serverMode) return;
|
|
16054
|
+
setAnnouncement("");
|
|
16055
|
+
try {
|
|
16056
|
+
await copyToClipboard(toCsv(selectedRows, csvColumns, { delimiter: " " }));
|
|
16057
|
+
setAnnouncement(options.labels?.copiedToClipboard ?? t("common.copiedToClipboard"));
|
|
16058
|
+
} catch {
|
|
16059
|
+
setAnnouncement(options.labels?.copyFailed ?? t("common.copyFailed"));
|
|
16060
|
+
}
|
|
16061
|
+
};
|
|
16062
|
+
const onCopyKeyDown = (event) => {
|
|
16063
|
+
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;
|
|
16064
|
+
const target = event.target;
|
|
16065
|
+
if (!(target instanceof HTMLElement) || !target.closest("table") || target.closest("input, textarea, select") || target.isContentEditable) return;
|
|
16066
|
+
const editable = target.closest("[contenteditable]");
|
|
16067
|
+
if (editable && editable.getAttribute("contenteditable") !== "false") return;
|
|
16068
|
+
if (window.getSelection()?.isCollapsed === false) return;
|
|
16069
|
+
event.preventDefault();
|
|
16070
|
+
copySelected();
|
|
16071
|
+
};
|
|
16072
|
+
return {
|
|
16073
|
+
busy,
|
|
16074
|
+
selectedRowCount: selectedRows.length,
|
|
16075
|
+
announcement,
|
|
16076
|
+
copySelected,
|
|
16077
|
+
onCopyKeyDown,
|
|
16078
|
+
enabled,
|
|
16079
|
+
scopes,
|
|
16080
|
+
exportRows: async (scope) => {
|
|
16081
|
+
if (pending.current) return;
|
|
16082
|
+
if (options.onExport) {
|
|
16083
|
+
pending.current = true;
|
|
16084
|
+
setBusy(true);
|
|
16085
|
+
try {
|
|
16086
|
+
await options.onExport({
|
|
16087
|
+
scope,
|
|
16088
|
+
columns: columns.map((column) => column.id),
|
|
16089
|
+
selectedIds: [...options.selectedIds],
|
|
16090
|
+
sort: options.sort,
|
|
16091
|
+
filters: options.filters
|
|
16092
|
+
});
|
|
16093
|
+
} catch {} finally {
|
|
16094
|
+
pending.current = false;
|
|
16095
|
+
setBusy(false);
|
|
16096
|
+
}
|
|
16097
|
+
return;
|
|
16098
|
+
}
|
|
16099
|
+
const rows = scope === "rows" ? options.sortedRows : scope === "page" ? options.pageRows : selectedRows;
|
|
16100
|
+
downloadFile(toCsv(rows, csvColumns, { bom: true }), fileName, "text/csv;charset=utf-8");
|
|
16101
|
+
}
|
|
16102
|
+
};
|
|
16103
|
+
}
|
|
16104
|
+
//#endregion
|
|
15164
16105
|
//#region src/tables/DataTable/DataTable.tsx
|
|
15165
16106
|
const defaultRowId = (row) => {
|
|
15166
16107
|
const id = row.id;
|
|
@@ -15178,14 +16119,16 @@ const ROW_HEIGHT = {
|
|
|
15178
16119
|
* and empty states, client-side sort + pagination, optional collapsible row groups (`groupBy`),
|
|
15179
16120
|
* column resize and pinning, row virtualization, inline cell editing and saved views.
|
|
15180
16121
|
*/
|
|
15181
|
-
function DataTable({ rows = DEPLOYMENT_ROWS, columns = DEPLOYMENT_COLUMNS, getRowId = defaultRowId, getRowLabel, caption
|
|
16122
|
+
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
16123
|
10,
|
|
15183
16124
|
25,
|
|
15184
16125
|
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 }) {
|
|
16126
|
+
], 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 }) {
|
|
16127
|
+
const caption = captionProp ?? "Deployments";
|
|
15186
16128
|
const { t, formatNumber } = useI18n();
|
|
15187
16129
|
const singleMode = selectionMode === "single";
|
|
15188
16130
|
const serverMode = paginationMode === "server";
|
|
16131
|
+
const sortingEnabled = !serverMode || onSortChange != null || onQueryChange != null;
|
|
15189
16132
|
const selectable = selectionMode === void 0 ? selectableProp : selectionMode === "multiple";
|
|
15190
16133
|
const selectionColumn = selectable || singleMode;
|
|
15191
16134
|
const paginated = paginatedProp ?? (serverMode || !singleMode);
|
|
@@ -15237,15 +16180,56 @@ function DataTable({ rows = DEPLOYMENT_ROWS, columns = DEPLOYMENT_COLUMNS, getRo
|
|
|
15237
16180
|
const pageRows = serverMode ? rows : paginated ? paginate(sorted, page, pageSize) : sorted;
|
|
15238
16181
|
const pageIds = (effectiveGroupBy ? pageRows.filter((row) => !collapsed.has(groupKeyOf(row, effectiveGroupBy))) : pageRows).filter((row) => !isRowDisabled?.(row)).map(getRowId);
|
|
15239
16182
|
const header = selectionState(pageIds, selected);
|
|
16183
|
+
const queryPage = serverMode ? controlledPage ?? 1 : page;
|
|
16184
|
+
const queryPageSize = serverMode ? controlledPageSize ?? defaultPageSize : pageSize;
|
|
16185
|
+
const reportQuery = (cause, next) => onQueryChange?.({
|
|
16186
|
+
page: queryPage,
|
|
16187
|
+
pageSize: queryPageSize,
|
|
16188
|
+
sort,
|
|
16189
|
+
filters,
|
|
16190
|
+
...next,
|
|
16191
|
+
cause
|
|
16192
|
+
});
|
|
16193
|
+
const resizingTo = useRef(void 0);
|
|
16194
|
+
const changePage = (next) => {
|
|
16195
|
+
if (serverMode) onPageChange?.(next);
|
|
16196
|
+
else setPage(next);
|
|
16197
|
+
const nextSize = resizingTo.current;
|
|
16198
|
+
resizingTo.current = void 0;
|
|
16199
|
+
reportQuery(nextSize === void 0 ? "page" : "pageSize", {
|
|
16200
|
+
page: next,
|
|
16201
|
+
pageSize: nextSize ?? queryPageSize
|
|
16202
|
+
});
|
|
16203
|
+
};
|
|
16204
|
+
const changePageSize = (next) => {
|
|
16205
|
+
const total = serverMode ? rowCount ?? 0 : rows.length;
|
|
16206
|
+
const pageCount = Math.max(1, Math.ceil(total / Math.max(1, queryPageSize)));
|
|
16207
|
+
const displayedPage = Math.min(Math.max(1, queryPage), pageCount);
|
|
16208
|
+
const from = total === 0 ? 0 : (displayedPage - 1) * queryPageSize + 1;
|
|
16209
|
+
const nextPage = Math.floor((from - 1) / next) + 1;
|
|
16210
|
+
if (serverMode) onPageSizeChange?.(next);
|
|
16211
|
+
else setPageSize(next);
|
|
16212
|
+
if (nextPage !== displayedPage) resizingTo.current = next;
|
|
16213
|
+
else reportQuery("pageSize", {
|
|
16214
|
+
page: nextPage,
|
|
16215
|
+
pageSize: next
|
|
16216
|
+
});
|
|
16217
|
+
};
|
|
15240
16218
|
const changeSort = (columnId, direction) => {
|
|
15241
|
-
if (
|
|
16219
|
+
if (!sortingEnabled) return;
|
|
15242
16220
|
const next = {
|
|
15243
16221
|
columnId,
|
|
15244
16222
|
direction: sort?.columnId === columnId ? direction : "ascending"
|
|
15245
16223
|
};
|
|
15246
16224
|
setInnerSort(next);
|
|
15247
16225
|
onSortChange?.(next);
|
|
15248
|
-
|
|
16226
|
+
if (serverMode) {
|
|
16227
|
+
if (queryPage !== 1) onPageChange?.(1);
|
|
16228
|
+
} else setPage(1);
|
|
16229
|
+
reportQuery("sort", {
|
|
16230
|
+
page: 1,
|
|
16231
|
+
sort: next
|
|
16232
|
+
});
|
|
15249
16233
|
};
|
|
15250
16234
|
const toggleGroup = (key) => {
|
|
15251
16235
|
const next = new Set(collapsed);
|
|
@@ -15308,7 +16292,8 @@ function DataTable({ rows = DEPLOYMENT_ROWS, columns = DEPLOYMENT_COLUMNS, getRo
|
|
|
15308
16292
|
const applyState = (state) => {
|
|
15309
16293
|
const nextSort = state.sort ?? null;
|
|
15310
16294
|
setInnerSort(nextSort);
|
|
15311
|
-
|
|
16295
|
+
const sortChanged = sortingEnabled && (sort?.columnId !== nextSort?.columnId || sort?.direction !== nextSort?.direction);
|
|
16296
|
+
if (nextSort && (!serverMode || sortChanged)) onSortChange?.(nextSort);
|
|
15312
16297
|
setHiddenList(state.hiddenColumns ?? defaultHidden);
|
|
15313
16298
|
setWidths(state.columnWidths ?? defaultColumnWidths);
|
|
15314
16299
|
setPinned(state.pinnedColumns ?? defaultPinnedColumns);
|
|
@@ -15317,6 +16302,12 @@ function DataTable({ rows = DEPLOYMENT_ROWS, columns = DEPLOYMENT_COLUMNS, getRo
|
|
|
15317
16302
|
if (nextGroup !== currentState.groupBy) onGroupByChange?.(nextGroup);
|
|
15318
16303
|
if (state.filters !== filters) onFiltersChange?.(state.filters);
|
|
15319
16304
|
if (!serverMode) setPage(1);
|
|
16305
|
+
else if (sortChanged && queryPage !== 1) onPageChange?.(1);
|
|
16306
|
+
reportQuery("view", {
|
|
16307
|
+
page: !serverMode || sortChanged ? 1 : queryPage,
|
|
16308
|
+
sort: nextSort,
|
|
16309
|
+
filters: state.filters
|
|
16310
|
+
});
|
|
15320
16311
|
};
|
|
15321
16312
|
const viewsApi = useTableViews({
|
|
15322
16313
|
views: viewsProp,
|
|
@@ -15348,8 +16339,24 @@ function DataTable({ rows = DEPLOYMENT_ROWS, columns = DEPLOYMENT_COLUMNS, getRo
|
|
|
15348
16339
|
tableRef,
|
|
15349
16340
|
viewportHeight: 512
|
|
15350
16341
|
});
|
|
16342
|
+
const exportSelectedIds = singleMode ? singleSelection.selectedId == null ? [] : [singleSelection.selectedId] : selectable ? selectedList : [];
|
|
16343
|
+
const exportSelectedCount = singleMode ? exportSelectedIds.length : selectable ? selectedCount : 0;
|
|
16344
|
+
const exportApi = useTableExport({
|
|
16345
|
+
csvExport,
|
|
16346
|
+
onExport,
|
|
16347
|
+
serverMode,
|
|
16348
|
+
caption: captionProp ?? "",
|
|
16349
|
+
columns: visibleColumns,
|
|
16350
|
+
sortedRows,
|
|
16351
|
+
pageRows,
|
|
16352
|
+
selectedIds: exportSelectedIds,
|
|
16353
|
+
getRowId,
|
|
16354
|
+
sort,
|
|
16355
|
+
filters,
|
|
16356
|
+
labels
|
|
16357
|
+
});
|
|
15351
16358
|
const hasSelection = selectable && selectedCount > 0 && (selectionSummary || bulkActions != null);
|
|
15352
|
-
const showToolbar = toolbar != null || showDensityToggle || showColumnMenu || showViews || hasSelection;
|
|
16359
|
+
const showToolbar = toolbar != null || showDensityToggle || showColumnMenu || showViews || hasSelection || exportApi.enabled;
|
|
15353
16360
|
const anyEditable = onCellEdit != null && columns.some((c) => c.editable);
|
|
15354
16361
|
const showSelectionStrip = selectable && selectAllMatching && (!serverMode || !!onSelectionModelChange) && (header.checked || model.type === "exclude" || !serverMode && allMatchingSelected) && (serverMode ? (rowCount ?? 0) > rows.length : enabledIds.length > pageIds.length);
|
|
15355
16362
|
const allMatching = serverMode ? model.type === "exclude" : allMatchingSelected;
|
|
@@ -15358,6 +16365,7 @@ function DataTable({ rows = DEPLOYMENT_ROWS, columns = DEPLOYMENT_COLUMNS, getRo
|
|
|
15358
16365
|
const selectionCount = labels?.selectionCount ? labels.selectionCount(selectedCount) : /* @__PURE__ */ jsxs(Fragment$1, { children: [selectedCount, " selected"] });
|
|
15359
16366
|
return /* @__PURE__ */ jsxs("div", {
|
|
15360
16367
|
className: cn("overflow-hidden rounded-xl border border-border bg-card shadow-sm", className),
|
|
16368
|
+
onKeyDown: exportApi.enabled ? exportApi.onCopyKeyDown : void 0,
|
|
15361
16369
|
children: [
|
|
15362
16370
|
/* @__PURE__ */ jsxs("div", {
|
|
15363
16371
|
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 +16390,15 @@ function DataTable({ rows = DEPLOYMENT_ROWS, columns = DEPLOYMENT_COLUMNS, getRo
|
|
|
15382
16390
|
}), /* @__PURE__ */ jsxs("div", {
|
|
15383
16391
|
className: "flex items-center gap-2",
|
|
15384
16392
|
children: [
|
|
16393
|
+
exportApi.enabled && /* @__PURE__ */ jsx(ExportMenu, {
|
|
16394
|
+
count: rowCount ?? rows.length,
|
|
16395
|
+
selectedCount: serverMode ? exportSelectedCount : exportApi.selectedRowCount,
|
|
16396
|
+
scopes: exportApi.scopes,
|
|
16397
|
+
busy: exportApi.busy,
|
|
16398
|
+
onExport: exportApi.exportRows,
|
|
16399
|
+
onCopy: serverMode ? void 0 : exportApi.copySelected,
|
|
16400
|
+
labels
|
|
16401
|
+
}),
|
|
15385
16402
|
showViews && /* @__PURE__ */ jsx(ViewSwitcher, {
|
|
15386
16403
|
labels,
|
|
15387
16404
|
views: viewsApi.views,
|
|
@@ -15421,6 +16438,12 @@ function DataTable({ rows = DEPLOYMENT_ROWS, columns = DEPLOYMENT_COLUMNS, getRo
|
|
|
15421
16438
|
clear();
|
|
15422
16439
|
}
|
|
15423
16440
|
}),
|
|
16441
|
+
exportApi.enabled && /* @__PURE__ */ jsx("span", {
|
|
16442
|
+
role: "status",
|
|
16443
|
+
"aria-live": "polite",
|
|
16444
|
+
className: "sr-only",
|
|
16445
|
+
children: exportApi.announcement
|
|
16446
|
+
}),
|
|
15424
16447
|
anyEditable && /* @__PURE__ */ jsx("span", {
|
|
15425
16448
|
id: editHintId,
|
|
15426
16449
|
className: "sr-only",
|
|
@@ -15454,7 +16477,7 @@ function DataTable({ rows = DEPLOYMENT_ROWS, columns = DEPLOYMENT_COLUMNS, getRo
|
|
|
15454
16477
|
"aria-rowindex": virtual ? 1 : void 0,
|
|
15455
16478
|
children: [
|
|
15456
16479
|
selectionColumn && /* @__PURE__ */ jsxs(TableHead, {
|
|
15457
|
-
className: cn("w-10 pe-0", layout.lead.className, layout.lead.pinned && "z-
|
|
16480
|
+
className: cn("w-10 pe-0", layout.lead.className, layout.lead.pinned && "z-sticky-pinned bg-card", stickyTint(layout.lead, { head: true })),
|
|
15458
16481
|
style: layout.lead.style,
|
|
15459
16482
|
children: [(singleMode || hideSelectAll) && /* @__PURE__ */ jsx("span", {
|
|
15460
16483
|
className: "sr-only",
|
|
@@ -15472,12 +16495,12 @@ function DataTable({ rows = DEPLOYMENT_ROWS, columns = DEPLOYMENT_COLUMNS, getRo
|
|
|
15472
16495
|
const bounds = widthBounds(c);
|
|
15473
16496
|
return /* @__PURE__ */ jsx(DataTableHeadCell, {
|
|
15474
16497
|
labels,
|
|
15475
|
-
column:
|
|
16498
|
+
column: sortingEnabled ? c : {
|
|
15476
16499
|
...c,
|
|
15477
16500
|
sortable: false
|
|
15478
|
-
}
|
|
16501
|
+
},
|
|
15479
16502
|
layout: layout.columns.get(c.id),
|
|
15480
|
-
sortDirection:
|
|
16503
|
+
sortDirection: sortingEnabled && sort?.columnId === c.id ? sort.direction : "none",
|
|
15481
16504
|
onSortChange: (dir) => changeSort(c.id, dir),
|
|
15482
16505
|
resize: resizable && c.resizable !== false ? {
|
|
15483
16506
|
width: columnWidthOf(c, widths),
|
|
@@ -15488,7 +16511,7 @@ function DataTable({ rows = DEPLOYMENT_ROWS, columns = DEPLOYMENT_COLUMNS, getRo
|
|
|
15488
16511
|
}, c.id);
|
|
15489
16512
|
}),
|
|
15490
16513
|
rowActions && /* @__PURE__ */ jsx(TableHead, {
|
|
15491
|
-
className: cn("w-12", layout.trail.className, layout.trail.pinned && "z-
|
|
16514
|
+
className: cn("w-12", layout.trail.className, layout.trail.pinned && "z-sticky-pinned bg-card", stickyTint(layout.trail, { head: true })),
|
|
15492
16515
|
style: layout.trail.style,
|
|
15493
16516
|
children: /* @__PURE__ */ jsx("span", {
|
|
15494
16517
|
className: "sr-only",
|
|
@@ -15540,9 +16563,9 @@ function DataTable({ rows = DEPLOYMENT_ROWS, columns = DEPLOYMENT_COLUMNS, getRo
|
|
|
15540
16563
|
className: "border-t border-border px-4 py-3",
|
|
15541
16564
|
total: serverMode ? rowCount : rows.length,
|
|
15542
16565
|
page: serverMode ? controlledPage : page,
|
|
15543
|
-
onPageChange:
|
|
16566
|
+
onPageChange: changePage,
|
|
15544
16567
|
pageSize: serverMode ? controlledPageSize : pageSize,
|
|
15545
|
-
onPageSizeChange:
|
|
16568
|
+
onPageSizeChange: changePageSize,
|
|
15546
16569
|
pageSizeOptions,
|
|
15547
16570
|
noun: caption
|
|
15548
16571
|
})
|
|
@@ -15555,8 +16578,43 @@ const meta$16 = {
|
|
|
15555
16578
|
name: "Data table",
|
|
15556
16579
|
family: "tables",
|
|
15557
16580
|
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.",
|
|
16581
|
+
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
16582
|
labels: [
|
|
16583
|
+
{
|
|
16584
|
+
key: "export",
|
|
16585
|
+
type: "string",
|
|
16586
|
+
state: "CSV export menu trigger text and name"
|
|
16587
|
+
},
|
|
16588
|
+
{
|
|
16589
|
+
key: "exportAll",
|
|
16590
|
+
type: "(count: number) => string",
|
|
16591
|
+
state: "CSV all rows item; server mode uses rowCount"
|
|
16592
|
+
},
|
|
16593
|
+
{
|
|
16594
|
+
key: "exportPage",
|
|
16595
|
+
type: "string",
|
|
16596
|
+
state: "CSV current page item"
|
|
16597
|
+
},
|
|
16598
|
+
{
|
|
16599
|
+
key: "exportSelected",
|
|
16600
|
+
type: "(count: number) => string",
|
|
16601
|
+
state: "CSV selected rows item, only with selection"
|
|
16602
|
+
},
|
|
16603
|
+
{
|
|
16604
|
+
key: "copySelected",
|
|
16605
|
+
type: "string",
|
|
16606
|
+
state: "Copy selected rows menu item, only with selection"
|
|
16607
|
+
},
|
|
16608
|
+
{
|
|
16609
|
+
key: "copiedToClipboard",
|
|
16610
|
+
type: "string",
|
|
16611
|
+
state: "Polite status after copying selected rows"
|
|
16612
|
+
},
|
|
16613
|
+
{
|
|
16614
|
+
key: "copyFailed",
|
|
16615
|
+
type: "string",
|
|
16616
|
+
state: "Polite status after clipboard failure"
|
|
16617
|
+
},
|
|
15560
16618
|
{
|
|
15561
16619
|
key: "booleanTrue",
|
|
15562
16620
|
type: "string",
|
|
@@ -15953,7 +17011,7 @@ const DEPLOYMENT_SAVED_VIEWS = [
|
|
|
15953
17011
|
//#region src/tables/FilterBar/FilterBar.tsx
|
|
15954
17012
|
const same = (a, b) => a.field === b.field && a.value === b.value;
|
|
15955
17013
|
/**
|
|
15956
|
-
* Filter bar:
|
|
17014
|
+
* Filter bar: SearchField, saved views Select, an "Add filter" Menu (multi-select per field),
|
|
15957
17015
|
* removable filter chips (Token) and Clear all.
|
|
15958
17016
|
*/
|
|
15959
17017
|
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 +17054,9 @@ function FilterBar({ fields = DEPLOYMENT_FILTER_FIELDS, query: queryProp, defaul
|
|
|
15996
17054
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
15997
17055
|
className: "flex flex-col gap-2 sm:flex-row sm:items-center",
|
|
15998
17056
|
children: [
|
|
15999
|
-
/* @__PURE__ */ jsx(
|
|
17057
|
+
/* @__PURE__ */ jsx(SearchField, {
|
|
16000
17058
|
"aria-label": searchLabel,
|
|
16001
|
-
type: "search",
|
|
16002
17059
|
size: "sm",
|
|
16003
|
-
leadingIcon: Search,
|
|
16004
17060
|
placeholder,
|
|
16005
17061
|
value: query,
|
|
16006
17062
|
onValueChange: (v) => setQuery(String(v)),
|
|
@@ -16058,7 +17114,7 @@ function FilterBar({ fields = DEPLOYMENT_FILTER_FIELDS, query: queryProp, defaul
|
|
|
16058
17114
|
className: "flex flex-wrap items-center gap-2",
|
|
16059
17115
|
children: [
|
|
16060
17116
|
/* @__PURE__ */ jsxs("span", {
|
|
16061
|
-
className: "inline-flex items-center gap-1.5 font-mono text-[10px] tracking-[0.14em] text-muted-foreground
|
|
17117
|
+
className: "inline-flex items-center gap-1.5 font-mono text-[10px] tracking-[0.14em] text-muted-foreground label-case",
|
|
16062
17118
|
children: [/* @__PURE__ */ jsx(ListFilter, {
|
|
16063
17119
|
size: 12,
|
|
16064
17120
|
"aria-hidden": true
|
|
@@ -16232,7 +17288,7 @@ const meta$14 = {
|
|
|
16232
17288
|
};
|
|
16233
17289
|
//#endregion
|
|
16234
17290
|
//#region src/tables/PaginationFooter/block.meta.ts
|
|
16235
|
-
const meta$
|
|
17291
|
+
const meta$48 = {
|
|
16236
17292
|
name: "Pagination footer",
|
|
16237
17293
|
family: "tables",
|
|
16238
17294
|
status: "beta",
|
|
@@ -16508,7 +17564,7 @@ function TruncatedCollectionFooter({ visibleCount = TRUNCATED_COLLECTION_PREVIEW
|
|
|
16508
17564
|
}
|
|
16509
17565
|
//#endregion
|
|
16510
17566
|
//#region src/tables/TruncatedCollectionFooter/block.meta.ts
|
|
16511
|
-
const meta$
|
|
17567
|
+
const meta$76 = {
|
|
16512
17568
|
name: "Truncated collection footer",
|
|
16513
17569
|
family: "tables",
|
|
16514
17570
|
status: "beta",
|
|
@@ -16814,7 +17870,7 @@ function SubordinateList({ title, headingLevel, count, columns, rows, getRowId,
|
|
|
16814
17870
|
}
|
|
16815
17871
|
//#endregion
|
|
16816
17872
|
//#region src/tables/SubordinateList/block.meta.ts
|
|
16817
|
-
const meta$
|
|
17873
|
+
const meta$71 = {
|
|
16818
17874
|
name: "Subordinate list",
|
|
16819
17875
|
family: "tables",
|
|
16820
17876
|
status: "beta",
|
|
@@ -16991,7 +18047,7 @@ function MembersTable({ members: members$1 = members, roles = memberRoles, curre
|
|
|
16991
18047
|
}
|
|
16992
18048
|
//#endregion
|
|
16993
18049
|
//#region src/team/MembersTable/block.meta.ts
|
|
16994
|
-
const meta$
|
|
18050
|
+
const meta$41 = {
|
|
16995
18051
|
name: "Members table",
|
|
16996
18052
|
family: "team",
|
|
16997
18053
|
status: "stable",
|
|
@@ -17169,7 +18225,7 @@ function NotificationMatrix({ channels = notificationChannels, events = notifica
|
|
|
17169
18225
|
}
|
|
17170
18226
|
//#endregion
|
|
17171
18227
|
//#region src/team/NotificationMatrix/block.meta.ts
|
|
17172
|
-
const meta$
|
|
18228
|
+
const meta$45 = {
|
|
17173
18229
|
name: "Notification matrix",
|
|
17174
18230
|
family: "team",
|
|
17175
18231
|
status: "stable",
|
|
@@ -17331,7 +18387,7 @@ function PendingInvitations({ invitations: invitations$1 = invitations, onResend
|
|
|
17331
18387
|
}
|
|
17332
18388
|
//#endregion
|
|
17333
18389
|
//#region src/team/PendingInvitations/block.meta.ts
|
|
17334
|
-
const meta$
|
|
18390
|
+
const meta$50 = {
|
|
17335
18391
|
name: "Pending invitations",
|
|
17336
18392
|
family: "team",
|
|
17337
18393
|
status: "stable",
|
|
@@ -17373,7 +18429,6 @@ const profile = {
|
|
|
17373
18429
|
//#region src/team/ProfileHeader/ProfileHeader.tsx
|
|
17374
18430
|
/** Profile header: large avatar with a change action, name, role, headline, meta row and edit button. */
|
|
17375
18431
|
function ProfileHeader({ profile: profile$1 = profile, onAvatarChange = () => {}, onEdit = () => {}, actions, headingLevel: Heading = "h1", className }) {
|
|
17376
|
-
const fileRef = useRef(null);
|
|
17377
18432
|
const [preview, setPreview] = useState(null);
|
|
17378
18433
|
const pick = (file) => {
|
|
17379
18434
|
onAvatarChange?.(file);
|
|
@@ -17392,24 +18447,19 @@ function ProfileHeader({ profile: profile$1 = profile, onAvatarChange = () => {}
|
|
|
17392
18447
|
size: "xl",
|
|
17393
18448
|
name: profile$1.name,
|
|
17394
18449
|
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",
|
|
18450
|
+
}), onAvatarChange && /* @__PURE__ */ jsx(FileTrigger, {
|
|
17405
18451
|
accept: "image/*",
|
|
17406
|
-
|
|
17407
|
-
|
|
17408
|
-
|
|
17409
|
-
|
|
17410
|
-
|
|
17411
|
-
|
|
17412
|
-
|
|
18452
|
+
onSelect: (files) => {
|
|
18453
|
+
if (files[0]) pick(files[0]);
|
|
18454
|
+
},
|
|
18455
|
+
render: /* @__PURE__ */ jsx(IconButton, {
|
|
18456
|
+
icon: Camera,
|
|
18457
|
+
label: "Change avatar",
|
|
18458
|
+
size: "sm",
|
|
18459
|
+
variant: "secondary",
|
|
18460
|
+
className: "absolute -end-1 -bottom-1 rounded-full"
|
|
18461
|
+
})
|
|
18462
|
+
})]
|
|
17413
18463
|
}),
|
|
17414
18464
|
/* @__PURE__ */ jsxs("div", {
|
|
17415
18465
|
className: "min-w-0 flex-1",
|
|
@@ -17456,7 +18506,7 @@ function ProfileHeader({ profile: profile$1 = profile, onAvatarChange = () => {}
|
|
|
17456
18506
|
}
|
|
17457
18507
|
//#endregion
|
|
17458
18508
|
//#region src/team/ProfileHeader/block.meta.ts
|
|
17459
|
-
const meta$
|
|
18509
|
+
const meta$54 = {
|
|
17460
18510
|
name: "Profile header",
|
|
17461
18511
|
family: "team",
|
|
17462
18512
|
status: "stable",
|
|
@@ -17465,7 +18515,8 @@ const meta$53 = {
|
|
|
17465
18515
|
"Avatar",
|
|
17466
18516
|
"Badge",
|
|
17467
18517
|
"IconButton",
|
|
17468
|
-
"Button"
|
|
18518
|
+
"Button",
|
|
18519
|
+
"FileTrigger"
|
|
17469
18520
|
]
|
|
17470
18521
|
};
|
|
17471
18522
|
//#endregion
|
|
@@ -17631,7 +18682,7 @@ function SessionsDevices({ sessions = deviceSessions, onRevoke, onRevokeOthers,
|
|
|
17631
18682
|
}
|
|
17632
18683
|
//#endregion
|
|
17633
18684
|
//#region src/team/SessionsDevices/block.meta.ts
|
|
17634
|
-
const meta$
|
|
18685
|
+
const meta$60 = {
|
|
17635
18686
|
name: "Sessions and devices",
|
|
17636
18687
|
family: "team",
|
|
17637
18688
|
status: "stable",
|
|
@@ -17643,6 +18694,6 @@ const meta$59 = {
|
|
|
17643
18694
|
]
|
|
17644
18695
|
};
|
|
17645
18696
|
//#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$
|
|
18697
|
+
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
18698
|
|
|
17648
18699
|
//# sourceMappingURL=index.js.map
|