@timefoldai/viz-react 0.0.0-stage → 0.1.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/LICENSE +202 -0
- package/README.md +240 -2
- package/dist/THIRD-PARTY-NOTICES.txt +99 -0
- package/dist/a11y/AccessibleTable.d.mts +42 -0
- package/dist/a11y/AccessibleTable.mjs +82 -0
- package/dist/a11y/activation.d.mts +4 -0
- package/dist/a11y/activation.mjs +0 -0
- package/dist/analytics/AnalyticsProvider.d.mts +16 -0
- package/dist/analytics/AnalyticsProvider.mjs +32 -0
- package/dist/assets/Inter-latin-ext.woff2 +0 -0
- package/dist/badge/Badge.css +122 -0
- package/dist/badge/Badge.d.mts +50 -0
- package/dist/badge/Badge.mjs +145 -0
- package/dist/badge/Badge.module.css.mjs +15 -0
- package/dist/badge/BadgeFacetGroup.d.mts +23 -0
- package/dist/badge/BadgeFacetGroup.mjs +220 -0
- package/dist/badge/BadgeGroup.d.mts +13 -0
- package/dist/badge/BadgeGroup.mjs +53 -0
- package/dist/badge/BadgeList.d.mts +14 -0
- package/dist/badge/BadgeList.mjs +15 -0
- package/dist/badge/badge-facet-fit.d.mts +18 -0
- package/dist/badge/badge-facet-fit.mjs +50 -0
- package/dist/badge/badge-item.d.mts +19 -0
- package/dist/badge/badge-item.mjs +23 -0
- package/dist/button/CopyButton.d.mts +12 -0
- package/dist/button/CopyButton.mjs +52 -0
- package/dist/button/ShowAllButton.d.mts +14 -0
- package/dist/button/ShowAllButton.mjs +61 -0
- package/dist/button/ShowMoreButton.d.mts +13 -0
- package/dist/button/ShowMoreButton.mjs +51 -0
- package/dist/button/SolveButton.d.mts +16 -0
- package/dist/button/SolveButton.mjs +56 -0
- package/dist/charts/BarChart.css +59 -0
- package/dist/charts/BarChart.d.mts +26 -0
- package/dist/charts/BarChart.mjs +167 -0
- package/dist/charts/BarChart.module.css.mjs +10 -0
- package/dist/charts/ChartGrid.d.mts +8 -0
- package/dist/charts/ChartGrid.mjs +47 -0
- package/dist/charts/DistributionChart.d.mts +60 -0
- package/dist/charts/DistributionChart.mjs +151 -0
- package/dist/code/CodeBlock.d.mts +13 -0
- package/dist/code/CodeBlock.mjs +71 -0
- package/dist/composition-bar/CompositionBar.d.mts +24 -0
- package/dist/composition-bar/CompositionBar.mjs +124 -0
- package/dist/composition-bar/composition-shares.d.mts +8 -0
- package/dist/composition-bar/composition-shares.mjs +30 -0
- package/dist/data-gate/DataGate.d.mts +34 -0
- package/dist/data-gate/DataGate.mjs +80 -0
- package/dist/date-scope/DateScope.d.mts +30 -0
- package/dist/date-scope/DateScope.mjs +285 -0
- package/dist/design-system/part-props.d.mts +39 -0
- package/dist/design-system/part-props.mjs +0 -0
- package/dist/detail-panel/DetailPanel.d.mts +22 -0
- package/dist/detail-panel/DetailPanel.mjs +80 -0
- package/dist/detail-panel/DetailPanelSection.d.mts +20 -0
- package/dist/detail-panel/DetailPanelSection.mjs +27 -0
- package/dist/detail-panel/micro-label.d.mts +7 -0
- package/dist/detail-panel/micro-label.mjs +9 -0
- package/dist/env.d.mts +2 -0
- package/dist/env.mjs +4 -0
- package/dist/export/ExportCsvButton.d.mts +19 -0
- package/dist/export/ExportCsvButton.mjs +73 -0
- package/dist/export/download-csv.d.mts +5 -0
- package/dist/export/download-csv.mjs +11 -0
- package/dist/export/download-file.d.mts +11 -0
- package/dist/export/download-file.mjs +32 -0
- package/dist/export/download-json.d.mts +2 -0
- package/dist/export/download-json.mjs +8 -0
- package/dist/filter/FilterGroup.d.mts +24 -0
- package/dist/filter/FilterGroup.mjs +71 -0
- package/dist/filter/FilterGroupTitle.d.mts +3 -0
- package/dist/filter/FilterGroupTitle.mjs +18 -0
- package/dist/filter/FilterItem.d.mts +17 -0
- package/dist/filter/FilterItem.mjs +94 -0
- package/dist/filter/FilterPanel.d.mts +22 -0
- package/dist/filter/FilterPanel.mjs +158 -0
- package/dist/filter/FilterToggleButton.d.mts +15 -0
- package/dist/filter/FilterToggleButton.mjs +30 -0
- package/dist/filter/date-range.d.mts +8 -0
- package/dist/filter/date-range.mjs +13 -0
- package/dist/filter/filter-facet.d.mts +7 -0
- package/dist/filter/filter-facet.mjs +0 -0
- package/dist/heatmap/Heatmap.css +138 -0
- package/dist/heatmap/Heatmap.d.mts +10 -0
- package/dist/heatmap/Heatmap.mjs +370 -0
- package/dist/heatmap/Heatmap.module.css.mjs +17 -0
- package/dist/heatmap/HeatmapCell.d.mts +25 -0
- package/dist/heatmap/HeatmapCell.mjs +124 -0
- package/dist/heatmap/heatmap-scale.d.mts +19 -0
- package/dist/heatmap/heatmap-scale.mjs +43 -0
- package/dist/heatmap/heatmap-types.d.mts +49 -0
- package/dist/heatmap/heatmap-types.mjs +0 -0
- package/dist/hooks/use-controllable-state.d.mts +9 -0
- package/dist/hooks/use-controllable-state.mjs +44 -0
- package/dist/hooks/use-debounced-value.d.mts +1 -0
- package/dist/hooks/use-debounced-value.mjs +27 -0
- package/dist/hooks/use-detail-panel-layout.d.mts +18 -0
- package/dist/hooks/use-detail-panel-layout.mjs +94 -0
- package/dist/hooks/use-hover-card.d.mts +47 -0
- package/dist/hooks/use-hover-card.mjs +190 -0
- package/dist/hooks/use-hover-focus-card.d.mts +38 -0
- package/dist/hooks/use-hover-focus-card.mjs +321 -0
- package/dist/hooks/use-hover-intent.d.mts +6 -0
- package/dist/hooks/use-hover-intent.mjs +55 -0
- package/dist/hooks/use-merged-ref.d.mts +2 -0
- package/dist/hooks/use-merged-ref.mjs +36 -0
- package/dist/hooks/use-tracked-anchor.d.mts +14 -0
- package/dist/hooks/use-tracked-anchor.mjs +42 -0
- package/dist/index.d.mts +97 -0
- package/dist/index.mjs +88 -0
- package/dist/input/MenuButton.d.mts +47 -0
- package/dist/input/MenuButton.mjs +152 -0
- package/dist/interval-strip/IntervalStrip.css +7 -0
- package/dist/interval-strip/IntervalStrip.d.mts +39 -0
- package/dist/interval-strip/IntervalStrip.mjs +233 -0
- package/dist/interval-strip/IntervalStrip.module.css.mjs +4 -0
- package/dist/interval-strip/IntervalStripAxis.d.mts +18 -0
- package/dist/interval-strip/IntervalStripAxis.mjs +73 -0
- package/dist/interval-strip/interval-fill.d.mts +2 -0
- package/dist/interval-strip/interval-fill.mjs +13 -0
- package/dist/interval-strip/interval-layout.d.mts +33 -0
- package/dist/interval-strip/interval-layout.mjs +79 -0
- package/dist/layout/AppShell.css +103 -0
- package/dist/layout/AppShell.d.mts +73 -0
- package/dist/layout/AppShell.mjs +397 -0
- package/dist/layout/AppShell.module.css.mjs +16 -0
- package/dist/layout/ColorSchemeMenu.d.mts +14 -0
- package/dist/layout/ColorSchemeMenu.mjs +92 -0
- package/dist/layout/DemoDataPicker.d.mts +17 -0
- package/dist/layout/DemoDataPicker.mjs +150 -0
- package/dist/layout/OverflowMenu.d.mts +11 -0
- package/dist/layout/OverflowMenu.mjs +94 -0
- package/dist/layout/SidebarLayout.css +70 -0
- package/dist/layout/SidebarLayout.d.mts +33 -0
- package/dist/layout/SidebarLayout.mjs +129 -0
- package/dist/layout/SidebarLayout.module.css.mjs +8 -0
- package/dist/layout/use-date-scope-day.d.mts +23 -0
- package/dist/layout/use-date-scope-day.mjs +63 -0
- package/dist/layout/use-fill-height.d.mts +7 -0
- package/dist/layout/use-fill-height.mjs +50 -0
- package/dist/layout/use-followed-state.d.mts +5 -0
- package/dist/layout/use-followed-state.mjs +75 -0
- package/dist/layout/use-page-route.d.mts +10 -0
- package/dist/layout/use-page-route.mjs +65 -0
- package/dist/legend/Legend.d.mts +54 -0
- package/dist/legend/Legend.mjs +132 -0
- package/dist/map/MapLayersControl.d.mts +11 -0
- package/dist/map/MapLayersControl.mjs +157 -0
- package/dist/map/MapLocator.css +9 -0
- package/dist/map/MapLocator.d.mts +18 -0
- package/dist/map/MapLocator.mjs +97 -0
- package/dist/map/MapLocator.module.css.mjs +4 -0
- package/dist/map/MapMarker.d.mts +29 -0
- package/dist/map/MapMarker.mjs +265 -0
- package/dist/map/MapStops.d.mts +19 -0
- package/dist/map/MapStops.mjs +355 -0
- package/dist/map/MapView.css +24 -0
- package/dist/map/MapView.d.mts +11 -0
- package/dist/map/MapView.mjs +141 -0
- package/dist/map/MapWebgl.d.mts +9 -0
- package/dist/map/MapWebgl.mjs +727 -0
- package/dist/map/area-layers.d.mts +33 -0
- package/dist/map/area-layers.mjs +96 -0
- package/dist/map/control-group.d.mts +6 -0
- package/dist/map/control-group.mjs +12 -0
- package/dist/map/for-each-chunk.d.mts +4 -0
- package/dist/map/for-each-chunk.mjs +14 -0
- package/dist/map/highlight.d.mts +30 -0
- package/dist/map/highlight.mjs +99 -0
- package/dist/map/locator-tile.d.mts +24 -0
- package/dist/map/locator-tile.mjs +41 -0
- package/dist/map/map-sites.d.mts +12 -0
- package/dist/map/map-sites.mjs +39 -0
- package/dist/map/map-style.d.mts +24 -0
- package/dist/map/map-style.mjs +79 -0
- package/dist/map/marker-geometry.d.mts +5 -0
- package/dist/map/marker-geometry.mjs +13 -0
- package/dist/map/marker-icon.d.mts +26 -0
- package/dist/map/marker-icon.mjs +223 -0
- package/dist/map/observe-color-scheme.d.mts +5 -0
- package/dist/map/observe-color-scheme.mjs +19 -0
- package/dist/map/popup-placement.d.mts +20 -0
- package/dist/map/popup-placement.mjs +20 -0
- package/dist/map/route-layers.d.mts +28 -0
- package/dist/map/route-layers.mjs +73 -0
- package/dist/map/types.d.mts +97 -0
- package/dist/map/types.mjs +0 -0
- package/dist/map/use-painted-color-scheme.d.mts +6 -0
- package/dist/map/use-painted-color-scheme.mjs +43 -0
- package/dist/map/use-resolved-colors.d.mts +5 -0
- package/dist/map/use-resolved-colors.mjs +63 -0
- package/dist/pagination/paginationLabels.d.mts +6 -0
- package/dist/pagination/paginationLabels.mjs +8 -0
- package/dist/popover/Popover.css +176 -0
- package/dist/popover/Popover.d.mts +239 -0
- package/dist/popover/Popover.mjs +672 -0
- package/dist/popover/Popover.module.css.mjs +18 -0
- package/dist/popover/PopoverFacts.d.mts +24 -0
- package/dist/popover/PopoverFacts.mjs +63 -0
- package/dist/readout/Readout.d.mts +15 -0
- package/dist/readout/Readout.mjs +53 -0
- package/dist/readout/TimeZoneReadout.d.mts +11 -0
- package/dist/readout/TimeZoneReadout.mjs +46 -0
- package/dist/score-box/ScoreBox.css +62 -0
- package/dist/score-box/ScoreBox.d.mts +12 -0
- package/dist/score-box/ScoreBox.mjs +143 -0
- package/dist/score-box/ScoreBox.module.css.mjs +15 -0
- package/dist/segment-bar/Segment.d.mts +23 -0
- package/dist/segment-bar/Segment.mjs +27 -0
- package/dist/segment-bar/SegmentBar.css +44 -0
- package/dist/segment-bar/SegmentBar.d.mts +35 -0
- package/dist/segment-bar/SegmentBar.mjs +57 -0
- package/dist/segment-bar/SegmentBar.module.css.mjs +9 -0
- package/dist/segment-bar/segment-box.d.mts +10 -0
- package/dist/segment-bar/segment-box.mjs +30 -0
- package/dist/stat/Stat.d.mts +25 -0
- package/dist/stat/Stat.mjs +36 -0
- package/dist/stat/StatTile.d.mts +18 -0
- package/dist/stat/StatTile.mjs +37 -0
- package/dist/styles.css +1 -0
- package/dist/swatch/Swatch.d.mts +8 -0
- package/dist/swatch/Swatch.mjs +30 -0
- package/dist/swatch/legend-swatch.d.mts +3 -0
- package/dist/swatch/legend-swatch.mjs +0 -0
- package/dist/tab-bar/FilteredTabBar.d.mts +32 -0
- package/dist/tab-bar/FilteredTabBar.mjs +181 -0
- package/dist/tab-bar/TabBar.d.mts +22 -0
- package/dist/tab-bar/TabBar.mjs +151 -0
- package/dist/tab-bar/TabPanel.d.mts +9 -0
- package/dist/tab-bar/TabPanel.mjs +55 -0
- package/dist/tab-bar/assert-named-value.d.mts +4 -0
- package/dist/tab-bar/assert-named-value.mjs +6 -0
- package/dist/table/DataTable.d.mts +31 -0
- package/dist/table/DataTable.mjs +43 -0
- package/dist/theme/use-color-scheme.d.mts +14 -0
- package/dist/theme/use-color-scheme.mjs +92 -0
- package/dist/theme.css +58 -0
- package/dist/timeline/Timeline.d.mts +54 -0
- package/dist/timeline/Timeline.mjs +220 -0
- package/dist/timeline/TimelineBand.d.mts +18 -0
- package/dist/timeline/TimelineBand.mjs +30 -0
- package/dist/timeline/TimelineGroup.d.mts +7 -0
- package/dist/timeline/TimelineGroup.mjs +50 -0
- package/dist/timeline/TimelineItem.d.mts +19 -0
- package/dist/timeline/TimelineItem.mjs +64 -0
- package/dist/timeline/TimelineItemChip.css +153 -0
- package/dist/timeline/TimelineItemChip.d.mts +23 -0
- package/dist/timeline/TimelineItemChip.mjs +74 -0
- package/dist/timeline/TimelineItemChip.module.css.mjs +15 -0
- package/dist/timeline/TimelineItemMark.css +38 -0
- package/dist/timeline/TimelineItemMark.d.mts +15 -0
- package/dist/timeline/TimelineItemMark.mjs +129 -0
- package/dist/timeline/TimelineItemMark.module.css.mjs +4 -0
- package/dist/timeline/TimelineRoot.d.mts +19 -0
- package/dist/timeline/TimelineRoot.mjs +742 -0
- package/dist/timeline/TimelineRowHeader.d.mts +23 -0
- package/dist/timeline/TimelineRowHeader.mjs +244 -0
- package/dist/timeline/TimelineZoomHint.d.mts +9 -0
- package/dist/timeline/TimelineZoomHint.mjs +32 -0
- package/dist/timeline/axis-label.d.mts +5 -0
- package/dist/timeline/axis-label.mjs +53 -0
- package/dist/timeline/batched-dataset-writer.d.mts +29 -0
- package/dist/timeline/batched-dataset-writer.mjs +58 -0
- package/dist/timeline/row-card-side.d.mts +7 -0
- package/dist/timeline/row-card-side.mjs +6 -0
- package/dist/timeline/timeline-a11y.d.mts +33 -0
- package/dist/timeline/timeline-a11y.mjs +96 -0
- package/dist/timeline/timeline-context.d.mts +33 -0
- package/dist/timeline/timeline-context.mjs +40 -0
- package/dist/timeline/timeline-types.d.mts +126 -0
- package/dist/timeline/timeline-types.mjs +0 -0
- package/dist/timeline/timeline-utils.d.mts +52 -0
- package/dist/timeline/timeline-utils.mjs +130 -0
- package/dist/timeline/zoom-modifier.d.mts +21 -0
- package/dist/timeline/zoom-modifier.mjs +25 -0
- package/dist/toast/ToastProvider.d.mts +33 -0
- package/dist/toast/ToastProvider.mjs +257 -0
- package/dist/toast/toast-context.d.mts +2 -0
- package/dist/toast/toast-context.mjs +5 -0
- package/dist/tokens.css +1 -0
- package/dist/tooltip/Tooltip.d.mts +17 -0
- package/dist/tooltip/Tooltip.mjs +41 -0
- package/dist/tooltip/hover-open-delay.d.mts +2 -0
- package/dist/tooltip/hover-open-delay.mjs +4 -0
- package/dist/tooltip/is-text-cut.d.mts +1 -0
- package/dist/tooltip/is-text-cut.mjs +5 -0
- package/dist/vendor/components.d.mts +664 -0
- package/dist/vendor/components.mjs +2060 -0
- package/package.json +61 -3
|
@@ -0,0 +1,2060 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { clsx } from "clsx";
|
|
3
|
+
import { TbAlertTriangle, TbCalendar, TbCheck, TbChevronDown, TbChevronLeft, TbChevronRight, TbChevronUp, TbCircleCheck, TbCopy, TbExternalLink, TbHelpCircleFilled, TbInfoCircle, TbLoader2, TbSearch, TbSelector, TbX } from "react-icons/tb";
|
|
4
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { Slot, Slottable } from "@radix-ui/react-slot";
|
|
7
|
+
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
8
|
+
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
9
|
+
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
10
|
+
var Alert_module_default = {
|
|
11
|
+
alert: "_alert_oa4cx_1",
|
|
12
|
+
alert__icon: "_alert__icon_oa4cx_13 _icon_gih1f_35",
|
|
13
|
+
alert__body: "_alert__body_oa4cx_21",
|
|
14
|
+
alert__dismiss: "_alert__dismiss_oa4cx_29 _interactive_gih1f_10",
|
|
15
|
+
"alert__dismiss-icon": "_alert__dismiss-icon_oa4cx_51 _icon_gih1f_35",
|
|
16
|
+
alert__title: "_alert__title_oa4cx_56",
|
|
17
|
+
"alert--info": "_alert--info_oa4cx_63",
|
|
18
|
+
"alert--warning": "_alert--warning_oa4cx_68",
|
|
19
|
+
"alert--success": "_alert--success_oa4cx_73",
|
|
20
|
+
"alert--error": "_alert--error_oa4cx_78"
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* ████████╗██╗███╗ ███╗███████╗███████╗ ██████╗ ██╗ ██████╗
|
|
24
|
+
* ╚══██╔══╝██║████╗ ████║██╔════╝██╔════╝██╔═══██╗██║ ██╔══██╗
|
|
25
|
+
* ██║ ██║██╔████╔██║█████╗ █████╗ ██║ ██║██║ ██║ ██║
|
|
26
|
+
* ██║ ██║██║╚██╔╝██║██╔══╝ ██╔══╝ ██║ ██║██║ ██║ ██║
|
|
27
|
+
* ██║ ██║██║ ╚═╝ ██║███████╗██║ ╚██████╔╝███████╗██████╔╝
|
|
28
|
+
* ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═════╝ ╚══════╝╚═════╝
|
|
29
|
+
*
|
|
30
|
+
* @timefoldai/components v0.12.0
|
|
31
|
+
* Timefold design system, licensed under the Apache License, Version 2.0.
|
|
32
|
+
*/
|
|
33
|
+
var variantClass$3 = {
|
|
34
|
+
info: Alert_module_default["alert--info"],
|
|
35
|
+
warning: Alert_module_default["alert--warning"],
|
|
36
|
+
error: Alert_module_default["alert--error"],
|
|
37
|
+
success: Alert_module_default["alert--success"]
|
|
38
|
+
};
|
|
39
|
+
var variantIcon = {
|
|
40
|
+
info: TbInfoCircle,
|
|
41
|
+
warning: TbAlertTriangle,
|
|
42
|
+
error: TbAlertTriangle,
|
|
43
|
+
success: TbCircleCheck
|
|
44
|
+
};
|
|
45
|
+
var variantRole = {
|
|
46
|
+
info: "status",
|
|
47
|
+
warning: "alert",
|
|
48
|
+
error: "alert",
|
|
49
|
+
success: "status"
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Inline banner for feedback that belongs to the surrounding content: a
|
|
53
|
+
* failed save, a read-only notice, an expired trial.
|
|
54
|
+
*
|
|
55
|
+
* @remarks
|
|
56
|
+
* Plain children render as the message body; compose `AlertTitle` and
|
|
57
|
+
* `AlertDescription` when the message needs a heading.
|
|
58
|
+
*/
|
|
59
|
+
function Alert({ className, variant = "info", onDismiss, dismissLabel = "Dismiss", children, ...props }) {
|
|
60
|
+
const VariantIcon = variantIcon[variant];
|
|
61
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
62
|
+
role: variantRole[variant],
|
|
63
|
+
"data-variant": variant,
|
|
64
|
+
className: clsx(Alert_module_default["alert"], variantClass$3[variant], className),
|
|
65
|
+
...props,
|
|
66
|
+
children: [
|
|
67
|
+
/* @__PURE__ */ jsx(VariantIcon, {
|
|
68
|
+
"aria-hidden": true,
|
|
69
|
+
className: Alert_module_default["alert__icon"]
|
|
70
|
+
}),
|
|
71
|
+
/* @__PURE__ */ jsx("div", {
|
|
72
|
+
className: Alert_module_default["alert__body"],
|
|
73
|
+
children
|
|
74
|
+
}),
|
|
75
|
+
onDismiss ? /* @__PURE__ */ jsx("button", {
|
|
76
|
+
type: "button",
|
|
77
|
+
"aria-label": dismissLabel,
|
|
78
|
+
className: Alert_module_default["alert__dismiss"],
|
|
79
|
+
onClick: onDismiss,
|
|
80
|
+
children: /* @__PURE__ */ jsx(TbX, {
|
|
81
|
+
"aria-hidden": true,
|
|
82
|
+
className: Alert_module_default["alert__dismiss-icon"]
|
|
83
|
+
})
|
|
84
|
+
}) : null
|
|
85
|
+
]
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
function AlertTitle({ className, ...props }) {
|
|
89
|
+
return /* @__PURE__ */ jsx("p", {
|
|
90
|
+
className: clsx(Alert_module_default["alert__title"], className),
|
|
91
|
+
...props
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
function AlertDescription(props) {
|
|
95
|
+
return /* @__PURE__ */ jsx("div", { ...props });
|
|
96
|
+
}
|
|
97
|
+
var Icon_module_default = {
|
|
98
|
+
icon: "_icon_1eqbq_1",
|
|
99
|
+
"slot-icon": "_slot-icon_1eqbq_27 _icon_gih1f_35"
|
|
100
|
+
};
|
|
101
|
+
/** Renders a leading or trailing icon at the shared icon-size-sm (16px), hidden from assistive tech. */
|
|
102
|
+
function renderSlotIcon(Icon) {
|
|
103
|
+
return Icon ? /* @__PURE__ */ jsx(Icon, {
|
|
104
|
+
"aria-hidden": true,
|
|
105
|
+
className: Icon_module_default["slot-icon"]
|
|
106
|
+
}) : null;
|
|
107
|
+
}
|
|
108
|
+
var Badge_module_default = {
|
|
109
|
+
badge: "_badge_10ayf_1",
|
|
110
|
+
"badge--neutral": "_badge--neutral_10ayf_15",
|
|
111
|
+
"badge--green": "_badge--green_10ayf_21",
|
|
112
|
+
"badge--yellow": "_badge--yellow_10ayf_27",
|
|
113
|
+
"badge--purple": "_badge--purple_10ayf_33",
|
|
114
|
+
"badge--red": "_badge--red_10ayf_39",
|
|
115
|
+
"badge--border": "_badge--border_10ayf_45"
|
|
116
|
+
};
|
|
117
|
+
var colorClass = {
|
|
118
|
+
green: Badge_module_default["badge--green"],
|
|
119
|
+
yellow: Badge_module_default["badge--yellow"],
|
|
120
|
+
purple: Badge_module_default["badge--purple"],
|
|
121
|
+
red: Badge_module_default["badge--red"],
|
|
122
|
+
neutral: Badge_module_default["badge--neutral"]
|
|
123
|
+
};
|
|
124
|
+
function Badge({ className, color = "neutral", border, leadingIcon: LeadingIcon, trailingIcon: TrailingIcon, children, ...props }) {
|
|
125
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
126
|
+
"data-color": color,
|
|
127
|
+
"data-border": border ? "" : void 0,
|
|
128
|
+
className: clsx(Badge_module_default["badge"], colorClass[color], className, border && Badge_module_default["badge--border"]),
|
|
129
|
+
...props,
|
|
130
|
+
children: [
|
|
131
|
+
renderSlotIcon(LeadingIcon),
|
|
132
|
+
children,
|
|
133
|
+
renderSlotIcon(TrailingIcon)
|
|
134
|
+
]
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
var Button_module_default = {
|
|
138
|
+
button: "_button_k6txl_3 _interactive_gih1f_10",
|
|
139
|
+
"button--default": "_button--default_k6txl_31",
|
|
140
|
+
"button--destructive": "_button--destructive_k6txl_37",
|
|
141
|
+
"button--outline": "_button--outline_k6txl_42",
|
|
142
|
+
"button--soft": "_button--soft_k6txl_49",
|
|
143
|
+
"button--ghost": "_button--ghost_k6txl_54",
|
|
144
|
+
"button--icon": "_button--icon_k6txl_105",
|
|
145
|
+
"button--sm": "_button--sm_k6txl_118",
|
|
146
|
+
"button--xs": "_button--xs_k6txl_119",
|
|
147
|
+
button__icon: "_button__icon_k6txl_155 _icon_gih1f_35",
|
|
148
|
+
"button__label--hidden": "_button__label--hidden_k6txl_160",
|
|
149
|
+
button__spinner: "_button__spinner_k6txl_178",
|
|
150
|
+
"button-spin": "_button-spin_k6txl_1",
|
|
151
|
+
"button__content--covered": "_button__content--covered_k6txl_183",
|
|
152
|
+
"button__spinner--cover": "_button__spinner--cover_k6txl_188 _icon_gih1f_35"
|
|
153
|
+
};
|
|
154
|
+
var variantClass$2 = {
|
|
155
|
+
default: Button_module_default["button--default"],
|
|
156
|
+
destructive: Button_module_default["button--destructive"],
|
|
157
|
+
outline: Button_module_default["button--outline"],
|
|
158
|
+
ghost: Button_module_default["button--ghost"],
|
|
159
|
+
soft: Button_module_default["button--soft"]
|
|
160
|
+
};
|
|
161
|
+
var sizeClass = {
|
|
162
|
+
default: void 0,
|
|
163
|
+
sm: Button_module_default["button--sm"],
|
|
164
|
+
xs: Button_module_default["button--xs"]
|
|
165
|
+
};
|
|
166
|
+
/** TbLoader2 turning, in the slot or solo icon's place. */
|
|
167
|
+
function Spinner({ className, ...props }) {
|
|
168
|
+
return /* @__PURE__ */ jsx(TbLoader2, {
|
|
169
|
+
...props,
|
|
170
|
+
className: clsx(className, Button_module_default["button__spinner"])
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
function Button({ className, variant = "default", size = "default", asChild = false, leadingIcon, trailingIcon, soloIcon: SoloIcon, loading: loadingProp = false, children, ref, onClick, ...props }) {
|
|
174
|
+
const Comp = asChild ? Slot : "button";
|
|
175
|
+
const loading = loadingProp && !asChild;
|
|
176
|
+
const SoloShown = SoloIcon && loading ? Spinner : SoloIcon;
|
|
177
|
+
const content = asChild ? /* @__PURE__ */ jsx(Slottable, { children }) : SoloShown ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(SoloShown, {
|
|
178
|
+
"aria-hidden": true,
|
|
179
|
+
className: Button_module_default["button__icon"]
|
|
180
|
+
}), children != null && children !== false && /* @__PURE__ */ jsx("span", {
|
|
181
|
+
className: Button_module_default["button__label--hidden"],
|
|
182
|
+
children
|
|
183
|
+
})] }) : loading && !leadingIcon ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("span", {
|
|
184
|
+
className: Button_module_default["button__content--covered"],
|
|
185
|
+
children: [children, renderSlotIcon(trailingIcon)]
|
|
186
|
+
}), /* @__PURE__ */ jsx(Spinner, {
|
|
187
|
+
"aria-hidden": true,
|
|
188
|
+
className: Button_module_default["button__spinner--cover"]
|
|
189
|
+
})] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
190
|
+
renderSlotIcon(loading ? Spinner : leadingIcon),
|
|
191
|
+
children,
|
|
192
|
+
renderSlotIcon(trailingIcon)
|
|
193
|
+
] });
|
|
194
|
+
return /* @__PURE__ */ jsxs(Comp, {
|
|
195
|
+
ref,
|
|
196
|
+
"data-variant": variant,
|
|
197
|
+
"data-size": size,
|
|
198
|
+
"data-icon-only": SoloIcon ? "" : void 0,
|
|
199
|
+
"data-loading": loading ? "" : void 0,
|
|
200
|
+
"aria-busy": loading || void 0,
|
|
201
|
+
"aria-disabled": loading || props["aria-disabled"] || void 0,
|
|
202
|
+
onClick: (event) => {
|
|
203
|
+
if (loading) {
|
|
204
|
+
event.preventDefault();
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
onClick?.(event);
|
|
208
|
+
},
|
|
209
|
+
className: clsx(Button_module_default.button, variantClass$2[variant], SoloIcon && Button_module_default["button--icon"], sizeClass[size], className),
|
|
210
|
+
...props,
|
|
211
|
+
children: [
|
|
212
|
+
asChild && renderSlotIcon(leadingIcon),
|
|
213
|
+
content,
|
|
214
|
+
asChild && renderSlotIcon(trailingIcon)
|
|
215
|
+
]
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
Button.displayName = "Button";
|
|
219
|
+
var Checkbox_module_default = { checkbox: "_checkbox_4ndvi_1 _interactive_gih1f_10" };
|
|
220
|
+
/** Native checkbox styled with design tokens; supports controlled, uncontrolled and indeterminate state. */
|
|
221
|
+
function Checkbox({ className, checked, defaultChecked = false, onCheckedChange, onChange, ref, ...props }) {
|
|
222
|
+
const [uncontrolled, setUncontrolled] = React.useState(defaultChecked);
|
|
223
|
+
const inputRef = React.useRef(null);
|
|
224
|
+
const isIndeterminate = checked === "indeterminate";
|
|
225
|
+
const isChecked = !isIndeterminate && (checked ?? uncontrolled);
|
|
226
|
+
const state = isIndeterminate ? "indeterminate" : isChecked ? "checked" : "unchecked";
|
|
227
|
+
React.useEffect(() => {
|
|
228
|
+
if (inputRef.current) inputRef.current.indeterminate = isIndeterminate;
|
|
229
|
+
}, [isIndeterminate]);
|
|
230
|
+
const setRefs = React.useCallback((node) => {
|
|
231
|
+
inputRef.current = node;
|
|
232
|
+
if (typeof ref === "function") return ref(node);
|
|
233
|
+
if (ref) ref.current = node;
|
|
234
|
+
}, [ref]);
|
|
235
|
+
return /* @__PURE__ */ jsx("input", {
|
|
236
|
+
ref: setRefs,
|
|
237
|
+
type: "checkbox",
|
|
238
|
+
checked: isChecked,
|
|
239
|
+
className: clsx(Checkbox_module_default.checkbox, className),
|
|
240
|
+
onChange: (event) => {
|
|
241
|
+
const next = event.target.checked;
|
|
242
|
+
event.target.indeterminate = isIndeterminate;
|
|
243
|
+
if (checked === void 0) setUncontrolled(next);
|
|
244
|
+
onCheckedChange?.(next);
|
|
245
|
+
onChange?.(event);
|
|
246
|
+
},
|
|
247
|
+
...props,
|
|
248
|
+
"aria-checked": isIndeterminate ? "mixed" : void 0,
|
|
249
|
+
"data-state": state
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
var Input_module_default = {
|
|
253
|
+
input: "_input_1w5fl_1 _interactive_gih1f_10",
|
|
254
|
+
"input--content": "_input--content_1w5fl_22",
|
|
255
|
+
input__number: "_input__number_1w5fl_55",
|
|
256
|
+
"input__number--content": "_input__number--content_1w5fl_60",
|
|
257
|
+
input__steppers: "_input__steppers_1w5fl_77",
|
|
258
|
+
input__stepper: "_input__stepper_1w5fl_77 _interactive_gih1f_10",
|
|
259
|
+
"input__stepper-icon": "_input__stepper-icon_1w5fl_126 _icon_gih1f_35"
|
|
260
|
+
};
|
|
261
|
+
function Input({ className, width = "full", ref, ...props }) {
|
|
262
|
+
const input = /* @__PURE__ */ jsx("input", {
|
|
263
|
+
ref,
|
|
264
|
+
"data-width": width,
|
|
265
|
+
className: clsx(Input_module_default.input, width === "content" && Input_module_default["input--content"], className),
|
|
266
|
+
...props
|
|
267
|
+
});
|
|
268
|
+
if (props.type !== "number") return input;
|
|
269
|
+
return /* @__PURE__ */ jsx(NumberSteppers, {
|
|
270
|
+
width,
|
|
271
|
+
disabled: props.disabled || props.readOnly,
|
|
272
|
+
forwardedRef: ref,
|
|
273
|
+
input
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Up and down buttons for `type="number"`, drawn like NumberInput's, in place
|
|
278
|
+
* of the browser's spinner (which Safari and Firefox won't let us restyle).
|
|
279
|
+
* They step the native input, so its own `min`, `max`, `step` and change
|
|
280
|
+
* events (and form libraries listening to them) keep working. Keyboard users
|
|
281
|
+
* keep the arrow keys, so the buttons stay out of the tab order.
|
|
282
|
+
*/
|
|
283
|
+
function NumberSteppers({ width, disabled, forwardedRef, input }) {
|
|
284
|
+
const inputRef = React.useRef(null);
|
|
285
|
+
const setRef = (el) => {
|
|
286
|
+
inputRef.current = el;
|
|
287
|
+
if (typeof forwardedRef === "function") forwardedRef(el);
|
|
288
|
+
else if (forwardedRef) forwardedRef.current = el;
|
|
289
|
+
};
|
|
290
|
+
const step = (direction) => {
|
|
291
|
+
const el = inputRef.current;
|
|
292
|
+
if (!el || el.disabled || el.readOnly) return;
|
|
293
|
+
if (direction === 1) el.stepUp();
|
|
294
|
+
else el.stepDown();
|
|
295
|
+
el.dispatchEvent(new Event("input", { bubbles: true }));
|
|
296
|
+
el.dispatchEvent(new Event("change", { bubbles: true }));
|
|
297
|
+
};
|
|
298
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
299
|
+
className: clsx(Input_module_default.input__number, width === "content" && Input_module_default["input__number--content"]),
|
|
300
|
+
children: [React.cloneElement(input, { ref: setRef }), /* @__PURE__ */ jsxs("span", {
|
|
301
|
+
className: Input_module_default.input__steppers,
|
|
302
|
+
"aria-hidden": "true",
|
|
303
|
+
children: [/* @__PURE__ */ jsx("button", {
|
|
304
|
+
type: "button",
|
|
305
|
+
tabIndex: -1,
|
|
306
|
+
className: Input_module_default.input__stepper,
|
|
307
|
+
disabled,
|
|
308
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
309
|
+
onClick: () => step(1),
|
|
310
|
+
children: /* @__PURE__ */ jsx(TbChevronUp, { className: Input_module_default["input__stepper-icon"] })
|
|
311
|
+
}), /* @__PURE__ */ jsx("button", {
|
|
312
|
+
type: "button",
|
|
313
|
+
tabIndex: -1,
|
|
314
|
+
className: Input_module_default.input__stepper,
|
|
315
|
+
disabled,
|
|
316
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
317
|
+
onClick: () => step(-1),
|
|
318
|
+
children: /* @__PURE__ */ jsx(TbChevronDown, { className: Input_module_default["input__stepper-icon"] })
|
|
319
|
+
})]
|
|
320
|
+
})]
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
var Popover_module_default = {
|
|
324
|
+
popover__content: "_popover__content_f8dly_1",
|
|
325
|
+
"popover__content--flush": "_popover__content--flush_f8dly_19",
|
|
326
|
+
"popover-in": "_popover-in_f8dly_1",
|
|
327
|
+
"popover-out": "_popover-out_f8dly_1",
|
|
328
|
+
"popover-fade-in": "_popover-fade-in_f8dly_1",
|
|
329
|
+
"popover-fade-out": "_popover-fade-out_f8dly_1"
|
|
330
|
+
};
|
|
331
|
+
var Popover = PopoverPrimitive.Root;
|
|
332
|
+
var PopoverTrigger = PopoverPrimitive.Trigger;
|
|
333
|
+
var PopoverAnchor = PopoverPrimitive.Anchor;
|
|
334
|
+
/** Non-modal floating panel anchored to its trigger. */
|
|
335
|
+
function PopoverContent({ className, align = "center", sideOffset = 4, padding = "default", ...props }) {
|
|
336
|
+
return /* @__PURE__ */ jsx(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx(PopoverPrimitive.Content, {
|
|
337
|
+
align,
|
|
338
|
+
sideOffset,
|
|
339
|
+
"data-padding": padding,
|
|
340
|
+
className: clsx(Popover_module_default["popover__content"], padding === "none" && Popover_module_default["popover__content--flush"], className),
|
|
341
|
+
...props
|
|
342
|
+
}) });
|
|
343
|
+
}
|
|
344
|
+
var ControlRow_module_default = {
|
|
345
|
+
"control-row": "_control-row_1kh4s_1",
|
|
346
|
+
"control-row--start": "_control-row--start_1kh4s_7"
|
|
347
|
+
};
|
|
348
|
+
var alignClass = {
|
|
349
|
+
center: void 0,
|
|
350
|
+
start: ControlRow_module_default["control-row--start"]
|
|
351
|
+
};
|
|
352
|
+
/**
|
|
353
|
+
* Row that puts a `RadioGroupItem` or `Checkbox` before its label, with the design system's spacing between them.
|
|
354
|
+
*
|
|
355
|
+
* @example
|
|
356
|
+
* <ControlRow>
|
|
357
|
+
* <Checkbox id="terms" />
|
|
358
|
+
* <label htmlFor="terms">Accept the terms</label>
|
|
359
|
+
* </ControlRow>
|
|
360
|
+
*/
|
|
361
|
+
function ControlRow({ className, align = "center", ...props }) {
|
|
362
|
+
return /* @__PURE__ */ jsx("div", {
|
|
363
|
+
"data-align": align,
|
|
364
|
+
className: clsx(ControlRow_module_default["control-row"], alignClass[align], className),
|
|
365
|
+
...props
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* Copies text to the clipboard and exposes a short-lived `isCopied` flag for
|
|
370
|
+
* "copied" feedback. `copy` rejects when the clipboard refuses, so callers
|
|
371
|
+
* that want to surface a failure can catch it.
|
|
372
|
+
*/
|
|
373
|
+
function useCopyToClipboard({ resetAfterMs = 2e3 } = {}) {
|
|
374
|
+
const [isCopied, setIsCopied] = React.useState(false);
|
|
375
|
+
const resetTimeout = React.useRef(void 0);
|
|
376
|
+
React.useEffect(() => () => clearTimeout(resetTimeout.current), []);
|
|
377
|
+
return {
|
|
378
|
+
copy: React.useCallback(async (text) => {
|
|
379
|
+
await navigator.clipboard.writeText(text);
|
|
380
|
+
setIsCopied(true);
|
|
381
|
+
clearTimeout(resetTimeout.current);
|
|
382
|
+
resetTimeout.current = setTimeout(() => setIsCopied(false), resetAfterMs);
|
|
383
|
+
}, [resetAfterMs]),
|
|
384
|
+
isCopied
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
var InputGroup_module_default = {
|
|
388
|
+
"input-group": "_input-group_v6c5c_2",
|
|
389
|
+
"input-group__prefix": "_input-group__prefix_v6c5c_9",
|
|
390
|
+
"input-group__suffix": "_input-group__suffix_v6c5c_13"
|
|
391
|
+
};
|
|
392
|
+
/**
|
|
393
|
+
* Puts adornments (icons, small buttons) inside an Input's frame, or a text prefix before a NativeSelect's value.
|
|
394
|
+
* With a NativeSelect the frame fits its content; a `Label` in the prefix names the select:
|
|
395
|
+
*
|
|
396
|
+
* <InputGroup>
|
|
397
|
+
* <InputGroupPrefix><Label htmlFor="group-by">Group by</Label></InputGroupPrefix>
|
|
398
|
+
* <NativeSelect id="group-by">…</NativeSelect>
|
|
399
|
+
* </InputGroup>
|
|
400
|
+
*/
|
|
401
|
+
function InputGroup({ className, ...props }) {
|
|
402
|
+
return /* @__PURE__ */ jsx("div", {
|
|
403
|
+
className: clsx(InputGroup_module_default["input-group"], className),
|
|
404
|
+
...props
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
var groupField = "input:not([type=hidden]), select, textarea";
|
|
408
|
+
function focusGroupField(event) {
|
|
409
|
+
if (event.button !== 0) return;
|
|
410
|
+
const control = event.currentTarget.parentElement?.querySelector(groupField);
|
|
411
|
+
if (!control) return;
|
|
412
|
+
event.preventDefault();
|
|
413
|
+
control.focus();
|
|
414
|
+
}
|
|
415
|
+
function InputGroupPrefix({ className, onMouseDown, ...props }) {
|
|
416
|
+
return /* @__PURE__ */ jsx("div", {
|
|
417
|
+
"data-slot": "prefix",
|
|
418
|
+
role: "presentation",
|
|
419
|
+
className: clsx(InputGroup_module_default["input-group__prefix"], className),
|
|
420
|
+
onMouseDown: (event) => {
|
|
421
|
+
onMouseDown?.(event);
|
|
422
|
+
if (!event.defaultPrevented) focusGroupField(event);
|
|
423
|
+
},
|
|
424
|
+
...props
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
function InputGroupSuffix({ className, ...props }) {
|
|
428
|
+
return /* @__PURE__ */ jsx("div", {
|
|
429
|
+
"data-slot": "suffix",
|
|
430
|
+
className: clsx(InputGroup_module_default["input-group__suffix"], className),
|
|
431
|
+
...props
|
|
432
|
+
});
|
|
433
|
+
}
|
|
434
|
+
var CopyValue_module_default = {
|
|
435
|
+
"copy-value__actions": "_copy-value__actions_39wi3_1",
|
|
436
|
+
"copy-value__action": "_copy-value__action_39wi3_1 _interactive_gih1f_10 _field-action_gih1f_48",
|
|
437
|
+
"copy-value__icon": "_copy-value__icon_39wi3_10 _icon_gih1f_35",
|
|
438
|
+
"copy-value__announcement": "_copy-value__announcement_39wi3_15 _visually-hidden_gih1f_71"
|
|
439
|
+
};
|
|
440
|
+
function reportCopyError(error) {
|
|
441
|
+
if (typeof reportError === "function") reportError(error);
|
|
442
|
+
else console.error(error);
|
|
443
|
+
}
|
|
444
|
+
function useCopyValue({ onError }) {
|
|
445
|
+
const { copy, isCopied } = useCopyToClipboard();
|
|
446
|
+
const copyValue = (value) => copy(value).catch(onError ?? reportCopyError);
|
|
447
|
+
return {
|
|
448
|
+
copyValue,
|
|
449
|
+
isCopied
|
|
450
|
+
};
|
|
451
|
+
}
|
|
452
|
+
function CopiedAnnouncement({ isCopied, children }) {
|
|
453
|
+
return /* @__PURE__ */ jsx("span", {
|
|
454
|
+
role: "status",
|
|
455
|
+
"aria-live": "polite",
|
|
456
|
+
className: CopyValue_module_default["copy-value__announcement"],
|
|
457
|
+
children: isCopied ? children : null
|
|
458
|
+
});
|
|
459
|
+
}
|
|
460
|
+
/**
|
|
461
|
+
* Button that copies a value to the clipboard and shows copied feedback.
|
|
462
|
+
* Children render as the visible click target in front of the copy icon,
|
|
463
|
+
* so a whole label (e.g. an id) can be made copyable, not just the icon.
|
|
464
|
+
*/
|
|
465
|
+
function CopyValueButton({ value, label, children, variant = "ghost", onClick, onError, copiedLabel = "Copied", ...props }) {
|
|
466
|
+
const { copyValue, isCopied } = useCopyValue({ onError });
|
|
467
|
+
const CopyIcon = isCopied ? TbCheck : TbCopy;
|
|
468
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(CopiedAnnouncement, {
|
|
469
|
+
isCopied,
|
|
470
|
+
children: copiedLabel
|
|
471
|
+
}), /* @__PURE__ */ jsxs(Button, {
|
|
472
|
+
type: "button",
|
|
473
|
+
variant,
|
|
474
|
+
soloIcon: children ? void 0 : CopyIcon,
|
|
475
|
+
"aria-label": label,
|
|
476
|
+
"data-copied": isCopied,
|
|
477
|
+
...props,
|
|
478
|
+
onClick: (event) => {
|
|
479
|
+
onClick?.(event);
|
|
480
|
+
if (!event.defaultPrevented) copyValue(value);
|
|
481
|
+
},
|
|
482
|
+
children: [children, children && /* @__PURE__ */ jsx(CopyIcon, {
|
|
483
|
+
"aria-hidden": true,
|
|
484
|
+
className: CopyValue_module_default["copy-value__icon"]
|
|
485
|
+
})]
|
|
486
|
+
})] });
|
|
487
|
+
}
|
|
488
|
+
var pad = (n, width = 2) => String(n).padStart(width, "0");
|
|
489
|
+
var toIso = ({ y, m, d }) => `${pad(y, 4)}-${pad(m)}-${pad(d)}`;
|
|
490
|
+
var daysIn = (y, m) => new Date(y, m, 0).getDate();
|
|
491
|
+
var compareDates = (a, b) => toIso(a).localeCompare(toIso(b));
|
|
492
|
+
function parseIsoDate(iso) {
|
|
493
|
+
const match = iso?.match(/^(\d{4})-(\d{2})-(\d{2})/);
|
|
494
|
+
if (!match) return null;
|
|
495
|
+
const [y, m, d] = [
|
|
496
|
+
Number(match[1]),
|
|
497
|
+
Number(match[2]),
|
|
498
|
+
Number(match[3])
|
|
499
|
+
];
|
|
500
|
+
return m >= 1 && m <= 12 && d >= 1 && d <= daysIn(y, m) ? {
|
|
501
|
+
y,
|
|
502
|
+
m,
|
|
503
|
+
d
|
|
504
|
+
} : null;
|
|
505
|
+
}
|
|
506
|
+
function addDays(date, days) {
|
|
507
|
+
const next = new Date(date.y, date.m - 1, date.d + days);
|
|
508
|
+
return {
|
|
509
|
+
y: next.getFullYear(),
|
|
510
|
+
m: next.getMonth() + 1,
|
|
511
|
+
d: next.getDate()
|
|
512
|
+
};
|
|
513
|
+
}
|
|
514
|
+
/** Same day of another month, clamped to its last day (Jan 31 → Feb 28). */
|
|
515
|
+
function addMonths(date, months) {
|
|
516
|
+
const index = date.y * 12 + (date.m - 1) + months;
|
|
517
|
+
const y = Math.floor(index / 12);
|
|
518
|
+
const m = index % 12 + 1;
|
|
519
|
+
return {
|
|
520
|
+
y,
|
|
521
|
+
m,
|
|
522
|
+
d: Math.min(date.d, daysIn(y, m))
|
|
523
|
+
};
|
|
524
|
+
}
|
|
525
|
+
/** @returns The number of days from `start` to `end`, both included. */
|
|
526
|
+
function daysSpanned(start, end) {
|
|
527
|
+
const dayNumber = ({ y, m, d }) => Date.UTC(y, m - 1, d) / 864e5;
|
|
528
|
+
return Math.abs(dayNumber(end) - dayNumber(start)) + 1;
|
|
529
|
+
}
|
|
530
|
+
function today() {
|
|
531
|
+
const now = /* @__PURE__ */ new Date();
|
|
532
|
+
return {
|
|
533
|
+
y: now.getFullYear(),
|
|
534
|
+
m: now.getMonth() + 1,
|
|
535
|
+
d: now.getDate()
|
|
536
|
+
};
|
|
537
|
+
}
|
|
538
|
+
function dateOrder(locale) {
|
|
539
|
+
return new Intl.DateTimeFormat(locale, {
|
|
540
|
+
day: "numeric",
|
|
541
|
+
month: "numeric",
|
|
542
|
+
year: "numeric"
|
|
543
|
+
}).formatToParts(new Date(2026, 11, 31)).map((part) => part.type).filter((type) => type === "day" || type === "month" || type === "year");
|
|
544
|
+
}
|
|
545
|
+
function monthNames(locale) {
|
|
546
|
+
const names = /* @__PURE__ */ new Map();
|
|
547
|
+
for (const month of ["long", "short"]) {
|
|
548
|
+
const format = new Intl.DateTimeFormat(locale, { month });
|
|
549
|
+
for (let m = 1; m <= 12; m++) names.set(format.format(new Date(2026, m - 1, 1)).toLowerCase().replace(".", ""), m);
|
|
550
|
+
}
|
|
551
|
+
return names;
|
|
552
|
+
}
|
|
553
|
+
function weekdayNames(locale) {
|
|
554
|
+
const names = /* @__PURE__ */ new Set();
|
|
555
|
+
for (const weekday of ["long", "short"]) {
|
|
556
|
+
const format = new Intl.DateTimeFormat(locale, { weekday });
|
|
557
|
+
for (let d = 4; d <= 10; d++) names.add(format.format(new Date(2026, 0, d)).toLowerCase().replace(".", ""));
|
|
558
|
+
}
|
|
559
|
+
return names;
|
|
560
|
+
}
|
|
561
|
+
/** Reads a typed date: ISO, numbers in the locale's order, or with a month name and an optional weekday. */
|
|
562
|
+
function parseTypedDate(text, locale) {
|
|
563
|
+
const trimmed = text.trim();
|
|
564
|
+
if (!trimmed) return null;
|
|
565
|
+
const iso = parseIsoDate(trimmed);
|
|
566
|
+
if (iso && /^\d{4}-\d{2}-\d{2}$/.test(trimmed)) return iso;
|
|
567
|
+
const tokens = trimmed.toLowerCase().replace(/,/g, " ").split(/[\s/.-]+/).filter(Boolean);
|
|
568
|
+
const weekdays = weekdayNames(locale);
|
|
569
|
+
const weekdayAt = tokens.length === 4 ? tokens.findIndex((token) => weekdays.has(token)) : -1;
|
|
570
|
+
if (weekdayAt !== -1) tokens.splice(weekdayAt, 1);
|
|
571
|
+
if (tokens.length !== 3) return null;
|
|
572
|
+
let ymd = {};
|
|
573
|
+
const names = monthNames(locale);
|
|
574
|
+
const named = tokens.findIndex((token) => names.has(token.replace(".", "")));
|
|
575
|
+
if (named !== -1) {
|
|
576
|
+
const rest = tokens.filter((_, i) => i !== named).map(Number);
|
|
577
|
+
if (rest.some(Number.isNaN)) return null;
|
|
578
|
+
const year = rest.find((n) => n > 31) ?? rest[1];
|
|
579
|
+
ymd = {
|
|
580
|
+
m: names.get((tokens[named] ?? "").replace(".", "")),
|
|
581
|
+
y: year,
|
|
582
|
+
d: rest.find((n) => n !== year)
|
|
583
|
+
};
|
|
584
|
+
} else {
|
|
585
|
+
const numbers = tokens.map(Number);
|
|
586
|
+
if (numbers.some(Number.isNaN)) return null;
|
|
587
|
+
(tokens[0]?.length === 4 ? [
|
|
588
|
+
"year",
|
|
589
|
+
"month",
|
|
590
|
+
"day"
|
|
591
|
+
] : dateOrder(locale)).forEach((type, i) => {
|
|
592
|
+
ymd[type === "year" ? "y" : type === "month" ? "m" : "d"] = numbers[i];
|
|
593
|
+
});
|
|
594
|
+
}
|
|
595
|
+
const { y, m, d } = ymd;
|
|
596
|
+
if (y === void 0 || m === void 0 || d === void 0) return null;
|
|
597
|
+
const year = y < 100 ? 2e3 + y : y;
|
|
598
|
+
if (year < 1e3 || year > 9999) return null;
|
|
599
|
+
return parseIsoDate(toIso({
|
|
600
|
+
y: year,
|
|
601
|
+
m,
|
|
602
|
+
d
|
|
603
|
+
}));
|
|
604
|
+
}
|
|
605
|
+
var dropWeekdayComma = (part, index, parts) => part.type === "literal" && parts[index - 1]?.type === "weekday" ? part.value.replace(",", "") : part.value;
|
|
606
|
+
function dateFormatter(locale, weekday) {
|
|
607
|
+
const format = new Intl.DateTimeFormat(locale, {
|
|
608
|
+
weekday,
|
|
609
|
+
day: "numeric",
|
|
610
|
+
month: "short",
|
|
611
|
+
year: "numeric"
|
|
612
|
+
});
|
|
613
|
+
return (date) => format.formatToParts(new Date(date.y, date.m - 1, date.d)).map(dropWeekdayComma).join("");
|
|
614
|
+
}
|
|
615
|
+
function formatDate(date, locale, weekday) {
|
|
616
|
+
return date ? dateFormatter(locale, weekday)(date) : "";
|
|
617
|
+
}
|
|
618
|
+
/** Every day of a leap year, formatted: covers each month, weekday and day number in any calendar. */
|
|
619
|
+
function formatLeapYearDates(locale, weekday) {
|
|
620
|
+
const format = dateFormatter(locale, weekday);
|
|
621
|
+
return Array.from({ length: 366 }, (_, index) => {
|
|
622
|
+
const date = new Date(2028, 0, 1 + index);
|
|
623
|
+
return format({
|
|
624
|
+
y: date.getFullYear(),
|
|
625
|
+
m: date.getMonth() + 1,
|
|
626
|
+
d: date.getDate()
|
|
627
|
+
});
|
|
628
|
+
});
|
|
629
|
+
}
|
|
630
|
+
var DateField_module_default = {
|
|
631
|
+
"date-field": "_date-field_16efd_7",
|
|
632
|
+
"date-field__date": "_date-field__date_16efd_13",
|
|
633
|
+
"date-field--content": "_date-field--content_16efd_18",
|
|
634
|
+
"date-field__input": "_date-field__input_16efd_28",
|
|
635
|
+
"date-field--fixed": "_date-field--fixed_16efd_34",
|
|
636
|
+
"date-field__sizer": "_date-field__sizer_16efd_52",
|
|
637
|
+
"date-field--fixed-clearable": "_date-field--fixed-clearable_16efd_67",
|
|
638
|
+
"date-field__time": "_date-field__time_16efd_72",
|
|
639
|
+
"date-field__action": "_date-field__action_16efd_78 _interactive_gih1f_10 _field-action_gih1f_48",
|
|
640
|
+
"date-field__icon": "_date-field__icon_16efd_82 _icon_gih1f_35",
|
|
641
|
+
"date-field__popover": "_date-field__popover_16efd_89",
|
|
642
|
+
"date-field__calendar": "_date-field__calendar_16efd_93",
|
|
643
|
+
"date-field__calendar-header": "_date-field__calendar-header_16efd_105",
|
|
644
|
+
"date-field__title": "_date-field__title_16efd_112",
|
|
645
|
+
"date-field__nav": "_date-field__nav_16efd_118 _interactive_gih1f_10",
|
|
646
|
+
"date-field__day": "_date-field__day_16efd_119 _interactive_gih1f_10",
|
|
647
|
+
"date-field__today": "_date-field__today_16efd_120 _interactive_gih1f_10",
|
|
648
|
+
"date-field__grid": "_date-field__grid_16efd_144",
|
|
649
|
+
"date-field__week": "_date-field__week_16efd_150",
|
|
650
|
+
"date-field__weekday": "_date-field__weekday_16efd_156",
|
|
651
|
+
"date-field__footer": "_date-field__footer_16efd_220"
|
|
652
|
+
};
|
|
653
|
+
/** The month grid that DateField and DateRangeField open in their popover. */
|
|
654
|
+
function Calendar({ selection, min, max, isDisabled, locale, weekStartsOn, onSelect, onPreview, previousMonthLabel, nextMonthLabel, todayLabel, gridRef }) {
|
|
655
|
+
const clampDay = (date) => min && compareDates(date, min) < 0 ? min : max && compareDates(date, max) > 0 ? max : date;
|
|
656
|
+
const [focused, setFocused] = React.useState(() => clampDay(selection?.start ?? today()));
|
|
657
|
+
const moveFocus = React.useRef(false);
|
|
658
|
+
const now = today();
|
|
659
|
+
const unavailable = (date) => min !== null && compareDates(date, min) < 0 || max !== null && compareDates(date, max) > 0 || (isDisabled?.(date) ?? false);
|
|
660
|
+
React.useEffect(() => {
|
|
661
|
+
if (!moveFocus.current) return;
|
|
662
|
+
moveFocus.current = false;
|
|
663
|
+
gridRef.current?.querySelector("[tabindex=\"0\"]")?.focus();
|
|
664
|
+
}, [focused, gridRef]);
|
|
665
|
+
const first = {
|
|
666
|
+
y: focused.y,
|
|
667
|
+
m: focused.m,
|
|
668
|
+
d: 1
|
|
669
|
+
};
|
|
670
|
+
const start = addDays(first, -((new Date(first.y, first.m - 1, 1).getDay() - weekStartsOn + 7) % 7));
|
|
671
|
+
const days = Array.from({ length: 42 }, (_, i) => addDays(start, i));
|
|
672
|
+
const weekdays = days.slice(0, 7);
|
|
673
|
+
const title = new Intl.DateTimeFormat(locale, {
|
|
674
|
+
month: "long",
|
|
675
|
+
year: "numeric"
|
|
676
|
+
}).format(new Date(focused.y, focused.m - 1, 1));
|
|
677
|
+
const prevMonth = addMonths(focused, -1);
|
|
678
|
+
const nextMonth = addMonths(focused, 1);
|
|
679
|
+
const prevDisabled = min !== null && compareDates({
|
|
680
|
+
...prevMonth,
|
|
681
|
+
d: daysIn(prevMonth.y, prevMonth.m)
|
|
682
|
+
}, min) < 0;
|
|
683
|
+
const nextDisabled = max !== null && compareDates({
|
|
684
|
+
...nextMonth,
|
|
685
|
+
d: 1
|
|
686
|
+
}, max) > 0;
|
|
687
|
+
const onKeyDown = (event) => {
|
|
688
|
+
const weekdayOf = (date) => (new Date(date.y, date.m - 1, date.d).getDay() - weekStartsOn + 7) % 7;
|
|
689
|
+
const move = {
|
|
690
|
+
ArrowLeft: (from) => addDays(from, -1),
|
|
691
|
+
ArrowRight: (from) => addDays(from, 1),
|
|
692
|
+
ArrowUp: (from) => addDays(from, -7),
|
|
693
|
+
ArrowDown: (from) => addDays(from, 7),
|
|
694
|
+
Home: (from) => addDays(from, -weekdayOf(from)),
|
|
695
|
+
End: (from) => addDays(from, 6 - weekdayOf(from)),
|
|
696
|
+
PageUp: (from) => addMonths(from, event.shiftKey ? -12 : -1),
|
|
697
|
+
PageDown: (from) => addMonths(from, event.shiftKey ? 12 : 1)
|
|
698
|
+
}[event.key];
|
|
699
|
+
if (!move) return;
|
|
700
|
+
event.preventDefault();
|
|
701
|
+
let target = clampDay(move(focused));
|
|
702
|
+
for (let step = 0; unavailable(target) && step < 42; step++) target = clampDay(move(target));
|
|
703
|
+
moveFocus.current = true;
|
|
704
|
+
setFocused(target);
|
|
705
|
+
};
|
|
706
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
707
|
+
className: DateField_module_default["date-field__calendar"],
|
|
708
|
+
children: [
|
|
709
|
+
/* @__PURE__ */ jsxs("div", {
|
|
710
|
+
className: DateField_module_default["date-field__calendar-header"],
|
|
711
|
+
children: [
|
|
712
|
+
/* @__PURE__ */ jsx("button", {
|
|
713
|
+
type: "button",
|
|
714
|
+
"aria-label": previousMonthLabel,
|
|
715
|
+
className: DateField_module_default["date-field__nav"],
|
|
716
|
+
disabled: prevDisabled,
|
|
717
|
+
onClick: () => setFocused(clampDay(prevMonth)),
|
|
718
|
+
children: /* @__PURE__ */ jsx(TbChevronLeft, {
|
|
719
|
+
"aria-hidden": true,
|
|
720
|
+
className: DateField_module_default["date-field__icon"]
|
|
721
|
+
})
|
|
722
|
+
}),
|
|
723
|
+
/* @__PURE__ */ jsx("span", {
|
|
724
|
+
"aria-live": "polite",
|
|
725
|
+
className: DateField_module_default["date-field__title"],
|
|
726
|
+
children: title
|
|
727
|
+
}),
|
|
728
|
+
/* @__PURE__ */ jsx("button", {
|
|
729
|
+
type: "button",
|
|
730
|
+
"aria-label": nextMonthLabel,
|
|
731
|
+
className: DateField_module_default["date-field__nav"],
|
|
732
|
+
disabled: nextDisabled,
|
|
733
|
+
onClick: () => setFocused(clampDay(nextMonth)),
|
|
734
|
+
children: /* @__PURE__ */ jsx(TbChevronRight, {
|
|
735
|
+
"aria-hidden": true,
|
|
736
|
+
className: DateField_module_default["date-field__icon"]
|
|
737
|
+
})
|
|
738
|
+
})
|
|
739
|
+
]
|
|
740
|
+
}),
|
|
741
|
+
/* @__PURE__ */ jsxs("div", {
|
|
742
|
+
ref: gridRef,
|
|
743
|
+
role: "grid",
|
|
744
|
+
"aria-label": title,
|
|
745
|
+
className: DateField_module_default["date-field__grid"],
|
|
746
|
+
onKeyDown,
|
|
747
|
+
onMouseLeave: () => onPreview?.(null),
|
|
748
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
749
|
+
role: "row",
|
|
750
|
+
className: DateField_module_default["date-field__week"],
|
|
751
|
+
children: weekdays.map((day) => {
|
|
752
|
+
const date = new Date(day.y, day.m - 1, day.d);
|
|
753
|
+
return /* @__PURE__ */ jsx("span", {
|
|
754
|
+
role: "columnheader",
|
|
755
|
+
"aria-label": new Intl.DateTimeFormat(locale, { weekday: "long" }).format(date),
|
|
756
|
+
className: DateField_module_default["date-field__weekday"],
|
|
757
|
+
children: new Intl.DateTimeFormat(locale, { weekday: "narrow" }).format(date)
|
|
758
|
+
}, toIso(day));
|
|
759
|
+
})
|
|
760
|
+
}), Array.from({ length: 6 }, (_, week) => /* @__PURE__ */ jsx("div", {
|
|
761
|
+
role: "row",
|
|
762
|
+
className: DateField_module_default["date-field__week"],
|
|
763
|
+
children: days.slice(week * 7, week * 7 + 7).map((day) => {
|
|
764
|
+
const iso = toIso(day);
|
|
765
|
+
const isEndpoint = selection !== null && (compareDates(day, selection.start) === 0 || compareDates(day, selection.end) === 0);
|
|
766
|
+
const isBetween = selection !== null && compareDates(day, selection.start) > 0 && compareDates(day, selection.end) < 0;
|
|
767
|
+
const isFocused = compareDates(day, focused) === 0;
|
|
768
|
+
return /* @__PURE__ */ jsx("span", {
|
|
769
|
+
role: "gridcell",
|
|
770
|
+
"aria-selected": isEndpoint || isBetween || void 0,
|
|
771
|
+
children: /* @__PURE__ */ jsx("button", {
|
|
772
|
+
type: "button",
|
|
773
|
+
tabIndex: isFocused ? 0 : -1,
|
|
774
|
+
disabled: unavailable(day),
|
|
775
|
+
"aria-current": compareDates(day, now) === 0 ? "date" : void 0,
|
|
776
|
+
"aria-label": new Intl.DateTimeFormat(locale, { dateStyle: "full" }).format(new Date(day.y, day.m - 1, day.d)),
|
|
777
|
+
"data-selected": isEndpoint || void 0,
|
|
778
|
+
"data-in-range": isBetween || void 0,
|
|
779
|
+
"data-outside": day.m !== focused.m || void 0,
|
|
780
|
+
className: DateField_module_default["date-field__day"],
|
|
781
|
+
onClick: () => onSelect(day),
|
|
782
|
+
onMouseEnter: () => onPreview?.(day),
|
|
783
|
+
onFocus: () => {
|
|
784
|
+
if (!isFocused) setFocused(day);
|
|
785
|
+
onPreview?.(day);
|
|
786
|
+
},
|
|
787
|
+
children: day.d
|
|
788
|
+
})
|
|
789
|
+
}, iso);
|
|
790
|
+
})
|
|
791
|
+
}, week))]
|
|
792
|
+
}),
|
|
793
|
+
!unavailable(now) ? /* @__PURE__ */ jsx("div", {
|
|
794
|
+
className: DateField_module_default["date-field__footer"],
|
|
795
|
+
children: /* @__PURE__ */ jsx("button", {
|
|
796
|
+
type: "button",
|
|
797
|
+
className: DateField_module_default["date-field__today"],
|
|
798
|
+
onClick: () => onSelect(now),
|
|
799
|
+
children: todayLabel
|
|
800
|
+
})
|
|
801
|
+
}) : null
|
|
802
|
+
]
|
|
803
|
+
});
|
|
804
|
+
}
|
|
805
|
+
var datePart = (iso) => iso?.slice(0, 10) ?? "";
|
|
806
|
+
var timePart = (iso) => iso && iso.length >= 16 ? iso.slice(11, 16) : "";
|
|
807
|
+
/** Reads a typed time: 17:00, 1700, 5pm, 5:30 pm. */
|
|
808
|
+
function parseTypedTime(text) {
|
|
809
|
+
const match = text.trim().toLowerCase().match(/^(\d{1,2})(?::?(\d{2}))?\s*(a|p)?\.?\s*m?\.?$/);
|
|
810
|
+
if (!match) return null;
|
|
811
|
+
let hours = Number(match[1]);
|
|
812
|
+
const minutes = Number(match[2] ?? 0);
|
|
813
|
+
if (match[3]) {
|
|
814
|
+
if (hours < 1 || hours > 12) return null;
|
|
815
|
+
hours = hours % 12 + (match[3] === "p" ? 12 : 0);
|
|
816
|
+
}
|
|
817
|
+
return hours <= 23 && minutes <= 59 ? `${pad(hours)}:${pad(minutes)}` : null;
|
|
818
|
+
}
|
|
819
|
+
function formatTime(time, locale) {
|
|
820
|
+
if (!time) return "";
|
|
821
|
+
const [h, m] = time.split(":").map(Number);
|
|
822
|
+
return new Intl.DateTimeFormat(locale, {
|
|
823
|
+
hour: "2-digit",
|
|
824
|
+
minute: "2-digit"
|
|
825
|
+
}).format(new Date(2026, 0, 1, h, m));
|
|
826
|
+
}
|
|
827
|
+
/**
|
|
828
|
+
* A date field with a calendar, or date and time with `withTime`. People can
|
|
829
|
+
* type a date (ISO, 12/31/2026 in the locale's order, or "31 Dec 2026") or
|
|
830
|
+
* pick one; the value stays an ISO string, so forms that store `YYYY-MM-DD` /
|
|
831
|
+
* `YYYY-MM-DDTHH:mm` keep working. Pass `name` to submit it with a form.
|
|
832
|
+
*/
|
|
833
|
+
function DateField({ value: valueProp, defaultValue = null, onValueChange, withTime = false, min, max, clearable = false, width = "full", locale = "en-US", weekday, weekStartsOn = 1, defaultTime = "00:00", calendarLabel = "Choose date", calendarProps, clearLabel = "Clear date", timeLabel = "Time", previousMonthLabel = "Previous month", nextMonthLabel = "Next month", todayLabel = "Today", name, id, disabled, readOnly, className, style, onBlur, onKeyDown, "aria-invalid": ariaInvalid, ...props }) {
|
|
834
|
+
const [uncontrolled, setUncontrolled] = React.useState(defaultValue);
|
|
835
|
+
const value = valueProp !== void 0 ? valueProp : uncontrolled;
|
|
836
|
+
const date = parseIsoDate(value);
|
|
837
|
+
const time = timePart(value);
|
|
838
|
+
const [dateText, setDateText] = React.useState(() => formatDate(date, locale, weekday));
|
|
839
|
+
const [timeText, setTimeText] = React.useState(() => formatTime(time, locale));
|
|
840
|
+
const [dateInvalid, setDateInvalid] = React.useState(false);
|
|
841
|
+
const [timeInvalid, setTimeInvalid] = React.useState(false);
|
|
842
|
+
const [open, setOpen] = React.useState(false);
|
|
843
|
+
const gridRef = React.useRef(null);
|
|
844
|
+
const autoId = React.useId();
|
|
845
|
+
const fieldId = id ?? autoId;
|
|
846
|
+
const [shown, setShown] = React.useState({
|
|
847
|
+
value,
|
|
848
|
+
locale,
|
|
849
|
+
weekday
|
|
850
|
+
});
|
|
851
|
+
const showValue = (next) => {
|
|
852
|
+
setShown({
|
|
853
|
+
value: next,
|
|
854
|
+
locale,
|
|
855
|
+
weekday
|
|
856
|
+
});
|
|
857
|
+
setDateText(formatDate(parseIsoDate(next), locale, weekday));
|
|
858
|
+
setTimeText(formatTime(timePart(next), locale));
|
|
859
|
+
setDateInvalid(false);
|
|
860
|
+
setTimeInvalid(false);
|
|
861
|
+
};
|
|
862
|
+
if (shown.value !== value || shown.locale !== locale || shown.weekday !== weekday) showValue(value);
|
|
863
|
+
const inRange = (iso) => (!min || iso.localeCompare(min.slice(0, iso.length)) >= 0) && (!max || iso.localeCompare(max.slice(0, iso.length)) <= 0);
|
|
864
|
+
const commit = (next) => {
|
|
865
|
+
showValue(next);
|
|
866
|
+
if (next === value) return;
|
|
867
|
+
if (valueProp === void 0) setUncontrolled(next);
|
|
868
|
+
onValueChange?.(next);
|
|
869
|
+
};
|
|
870
|
+
const compose = (nextDate, nextTime) => nextDate ? withTime ? `${toIso(nextDate)}T${nextTime || defaultTime}` : toIso(nextDate) : null;
|
|
871
|
+
const commitDateText = () => {
|
|
872
|
+
if (!dateText.trim()) {
|
|
873
|
+
commit(null);
|
|
874
|
+
return;
|
|
875
|
+
}
|
|
876
|
+
const parsed = parseTypedDate(dateText, locale);
|
|
877
|
+
const next = parsed ? compose(parsed, time) : null;
|
|
878
|
+
if (!next || !inRange(datePart(next))) {
|
|
879
|
+
setDateInvalid(true);
|
|
880
|
+
return;
|
|
881
|
+
}
|
|
882
|
+
commit(next);
|
|
883
|
+
};
|
|
884
|
+
const commitTimeText = () => {
|
|
885
|
+
const parsed = timeText.trim() ? parseTypedTime(timeText) : "";
|
|
886
|
+
if (parsed === null || parsed && date && !inRange(`${toIso(date)}T${parsed}`)) {
|
|
887
|
+
setTimeInvalid(true);
|
|
888
|
+
return;
|
|
889
|
+
}
|
|
890
|
+
if (!date) {
|
|
891
|
+
setTimeInvalid(false);
|
|
892
|
+
setTimeText(formatTime(parsed, locale));
|
|
893
|
+
return;
|
|
894
|
+
}
|
|
895
|
+
commit(compose(date, parsed || defaultTime));
|
|
896
|
+
};
|
|
897
|
+
const select = (picked) => {
|
|
898
|
+
commit(compose(picked, time));
|
|
899
|
+
setOpen(false);
|
|
900
|
+
};
|
|
901
|
+
const minDate = parseIsoDate(min);
|
|
902
|
+
const maxDate = parseIsoDate(max);
|
|
903
|
+
const locked = disabled || readOnly;
|
|
904
|
+
const fixedWidthDates = React.useMemo(() => width === "fixed" ? formatLeapYearDates(locale, weekday) : [], [
|
|
905
|
+
width,
|
|
906
|
+
locale,
|
|
907
|
+
weekday
|
|
908
|
+
]);
|
|
909
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
910
|
+
className: clsx(DateField_module_default["date-field"], width === "content" && DateField_module_default["date-field--content"], width === "fixed" && DateField_module_default["date-field--fixed"], width === "fixed" && clearable && DateField_module_default["date-field--fixed-clearable"], className),
|
|
911
|
+
style,
|
|
912
|
+
"data-width": width,
|
|
913
|
+
"data-with-time": withTime || void 0,
|
|
914
|
+
children: [
|
|
915
|
+
/* @__PURE__ */ jsxs(Popover, {
|
|
916
|
+
open: open && !locked,
|
|
917
|
+
onOpenChange: setOpen,
|
|
918
|
+
children: [/* @__PURE__ */ jsx(PopoverAnchor, {
|
|
919
|
+
asChild: true,
|
|
920
|
+
children: /* @__PURE__ */ jsxs(InputGroup, {
|
|
921
|
+
className: DateField_module_default["date-field__date"],
|
|
922
|
+
children: [
|
|
923
|
+
/* @__PURE__ */ jsx(Input, {
|
|
924
|
+
id: fieldId,
|
|
925
|
+
width: width === "fixed" ? "full" : width,
|
|
926
|
+
size: width === "content" ? Math.max(dateText.length, props.placeholder?.length ?? 0, 1) : void 0,
|
|
927
|
+
className: DateField_module_default["date-field__input"],
|
|
928
|
+
autoComplete: "off",
|
|
929
|
+
value: dateText,
|
|
930
|
+
disabled,
|
|
931
|
+
readOnly,
|
|
932
|
+
"aria-invalid": ariaInvalid ?? (dateInvalid || void 0),
|
|
933
|
+
onChange: (event) => setDateText(event.target.value),
|
|
934
|
+
onBlur: (event) => {
|
|
935
|
+
commitDateText();
|
|
936
|
+
onBlur?.(event);
|
|
937
|
+
},
|
|
938
|
+
onKeyDown: (event) => {
|
|
939
|
+
if (event.key === "Enter") commitDateText();
|
|
940
|
+
if (event.key === "ArrowDown" && event.altKey) {
|
|
941
|
+
event.preventDefault();
|
|
942
|
+
setOpen(true);
|
|
943
|
+
}
|
|
944
|
+
onKeyDown?.(event);
|
|
945
|
+
},
|
|
946
|
+
...props
|
|
947
|
+
}),
|
|
948
|
+
width === "fixed" ? /* @__PURE__ */ jsx("span", {
|
|
949
|
+
"aria-hidden": true,
|
|
950
|
+
className: DateField_module_default["date-field__sizer"],
|
|
951
|
+
children: [...fixedWidthDates, props.placeholder ?? ""].join("\n")
|
|
952
|
+
}) : null,
|
|
953
|
+
/* @__PURE__ */ jsxs(InputGroupSuffix, { children: [clearable && value && !locked ? /* @__PURE__ */ jsx("button", {
|
|
954
|
+
type: "button",
|
|
955
|
+
"aria-label": clearLabel,
|
|
956
|
+
className: DateField_module_default["date-field__action"],
|
|
957
|
+
onClick: () => commit(null),
|
|
958
|
+
children: /* @__PURE__ */ jsx(TbX, {
|
|
959
|
+
"aria-hidden": true,
|
|
960
|
+
className: DateField_module_default["date-field__icon"]
|
|
961
|
+
})
|
|
962
|
+
}) : null, /* @__PURE__ */ jsx(PopoverTrigger, {
|
|
963
|
+
asChild: true,
|
|
964
|
+
children: /* @__PURE__ */ jsx("button", {
|
|
965
|
+
type: "button",
|
|
966
|
+
"aria-label": calendarLabel,
|
|
967
|
+
"aria-controls": open ? `${fieldId}-calendar` : void 0,
|
|
968
|
+
className: DateField_module_default["date-field__action"],
|
|
969
|
+
disabled: locked,
|
|
970
|
+
children: /* @__PURE__ */ jsx(TbCalendar, {
|
|
971
|
+
"aria-hidden": true,
|
|
972
|
+
className: DateField_module_default["date-field__icon"]
|
|
973
|
+
})
|
|
974
|
+
})
|
|
975
|
+
})] })
|
|
976
|
+
]
|
|
977
|
+
})
|
|
978
|
+
}), /* @__PURE__ */ jsx(PopoverContent, {
|
|
979
|
+
"aria-label": calendarLabel,
|
|
980
|
+
...calendarProps,
|
|
981
|
+
id: `${fieldId}-calendar`,
|
|
982
|
+
align: "start",
|
|
983
|
+
padding: "none",
|
|
984
|
+
className: clsx(DateField_module_default["date-field__popover"], calendarProps?.className),
|
|
985
|
+
onOpenAutoFocus: (event) => {
|
|
986
|
+
event.preventDefault();
|
|
987
|
+
requestAnimationFrame(() => gridRef.current?.querySelector("[tabindex=\"0\"]")?.focus());
|
|
988
|
+
},
|
|
989
|
+
children: /* @__PURE__ */ jsx(Calendar, {
|
|
990
|
+
selection: date && {
|
|
991
|
+
start: date,
|
|
992
|
+
end: date
|
|
993
|
+
},
|
|
994
|
+
min: minDate,
|
|
995
|
+
max: maxDate,
|
|
996
|
+
locale,
|
|
997
|
+
weekStartsOn,
|
|
998
|
+
onSelect: select,
|
|
999
|
+
previousMonthLabel,
|
|
1000
|
+
nextMonthLabel,
|
|
1001
|
+
todayLabel,
|
|
1002
|
+
gridRef
|
|
1003
|
+
})
|
|
1004
|
+
})]
|
|
1005
|
+
}),
|
|
1006
|
+
withTime ? /* @__PURE__ */ jsx(Input, {
|
|
1007
|
+
id: `${fieldId}-time`,
|
|
1008
|
+
"aria-label": timeLabel,
|
|
1009
|
+
autoComplete: "off",
|
|
1010
|
+
inputMode: "numeric",
|
|
1011
|
+
placeholder: formatTime("00:00", locale).replace(/\d/g, "0"),
|
|
1012
|
+
className: DateField_module_default["date-field__time"],
|
|
1013
|
+
value: timeText,
|
|
1014
|
+
disabled,
|
|
1015
|
+
readOnly,
|
|
1016
|
+
"aria-invalid": ariaInvalid ?? (timeInvalid || void 0),
|
|
1017
|
+
onChange: (event) => setTimeText(event.target.value),
|
|
1018
|
+
onBlur: commitTimeText,
|
|
1019
|
+
onKeyDown: (event) => event.key === "Enter" && commitTimeText()
|
|
1020
|
+
}) : null,
|
|
1021
|
+
name ? /* @__PURE__ */ jsx("input", {
|
|
1022
|
+
type: "hidden",
|
|
1023
|
+
name,
|
|
1024
|
+
value: value ?? ""
|
|
1025
|
+
}) : null
|
|
1026
|
+
]
|
|
1027
|
+
});
|
|
1028
|
+
}
|
|
1029
|
+
var DateRangeField_module_default = {
|
|
1030
|
+
"date-range-field": "_date-range-field_1kans_1",
|
|
1031
|
+
"date-range-field__input": "_date-range-field__input_1kans_19",
|
|
1032
|
+
"date-range-field__input--end": "_date-range-field__input--end_1kans_53",
|
|
1033
|
+
"date-range-field--fixed": "_date-range-field--fixed_1kans_64",
|
|
1034
|
+
"date-range-field__sizer": "_date-range-field__sizer_1kans_86",
|
|
1035
|
+
"date-range-field__sizer--end": "_date-range-field__sizer--end_1kans_96",
|
|
1036
|
+
"date-range-field__clear-space": "_date-range-field__clear-space_1kans_101",
|
|
1037
|
+
"date-range-field__separator": "_date-range-field__separator_1kans_109",
|
|
1038
|
+
"date-range-field__action": "_date-range-field__action_1kans_114 _interactive_gih1f_10 _field-action_gih1f_48",
|
|
1039
|
+
"date-range-field__icon": "_date-range-field__icon_1kans_120 _icon_gih1f_35",
|
|
1040
|
+
"date-range-field__popover": "_date-range-field__popover_1kans_125"
|
|
1041
|
+
};
|
|
1042
|
+
var rangeKey = (range) => range ? `${range[0]}/${range[1]}` : "";
|
|
1043
|
+
var ordered = (a, b) => compareDates(a, b) <= 0 ? [a, b] : [b, a];
|
|
1044
|
+
function spanning(a, b) {
|
|
1045
|
+
const [start, end] = ordered(a, b);
|
|
1046
|
+
return {
|
|
1047
|
+
start,
|
|
1048
|
+
end
|
|
1049
|
+
};
|
|
1050
|
+
}
|
|
1051
|
+
/**
|
|
1052
|
+
* A start and an end date in one field, typed or picked in a calendar (first click starts, second ends).
|
|
1053
|
+
* Name it with `aria-labelledby` or `aria-label`; a `Label` whose `htmlFor` is `id` focuses the start.
|
|
1054
|
+
*/
|
|
1055
|
+
function DateRangeField({ value: valueProp, defaultValue = null, onValueChange, min, max, maxDays, isDateDisabled, clearable = false, disabled, readOnly, placeholder, width = "content", locale = "en-US", weekStartsOn = 1, startLabel = "Start date", endLabel = "End date", calendarLabel = "Choose dates", calendarProps, clearLabel = "Clear dates", previousMonthLabel = "Previous month", nextMonthLabel = "Next month", todayLabel = "Today", id, className, "aria-invalid": ariaInvalid, ...props }) {
|
|
1056
|
+
const [uncontrolled, setUncontrolled] = React.useState(defaultValue);
|
|
1057
|
+
const value = valueProp !== void 0 ? valueProp : uncontrolled;
|
|
1058
|
+
const startDate = parseIsoDate(value?.[0]);
|
|
1059
|
+
const endDate = parseIsoDate(value?.[1]);
|
|
1060
|
+
const [startText, setStartText] = React.useState(() => formatDate(startDate, locale));
|
|
1061
|
+
const [endText, setEndText] = React.useState(() => formatDate(endDate, locale));
|
|
1062
|
+
const [startInvalid, setStartInvalid] = React.useState(false);
|
|
1063
|
+
const [endInvalid, setEndInvalid] = React.useState(false);
|
|
1064
|
+
const [open, setOpen] = React.useState(false);
|
|
1065
|
+
const [pendingStart, setPendingStart] = React.useState(null);
|
|
1066
|
+
const [preview, setPreview] = React.useState(null);
|
|
1067
|
+
const gridRef = React.useRef(null);
|
|
1068
|
+
const popoverRef = React.useRef(null);
|
|
1069
|
+
const autoId = React.useId();
|
|
1070
|
+
const fieldId = id ?? autoId;
|
|
1071
|
+
const [shown, setShown] = React.useState({
|
|
1072
|
+
key: rangeKey(value),
|
|
1073
|
+
locale
|
|
1074
|
+
});
|
|
1075
|
+
if (shown.key !== rangeKey(value) || shown.locale !== locale) {
|
|
1076
|
+
setShown({
|
|
1077
|
+
key: rangeKey(value),
|
|
1078
|
+
locale
|
|
1079
|
+
});
|
|
1080
|
+
setStartText(formatDate(startDate, locale));
|
|
1081
|
+
setEndText(formatDate(endDate, locale));
|
|
1082
|
+
setStartInvalid(false);
|
|
1083
|
+
setEndInvalid(false);
|
|
1084
|
+
}
|
|
1085
|
+
const minDate = parseIsoDate(min);
|
|
1086
|
+
const maxDate = parseIsoDate(max);
|
|
1087
|
+
const locked = disabled || readOnly;
|
|
1088
|
+
const isFixed = width === "fixed";
|
|
1089
|
+
const fixedWidthDates = React.useMemo(() => isFixed ? [...formatLeapYearDates(locale), placeholder ?? ""].join("\n") : "", [
|
|
1090
|
+
isFixed,
|
|
1091
|
+
locale,
|
|
1092
|
+
placeholder
|
|
1093
|
+
]);
|
|
1094
|
+
const showsClear = clearable && value && !locked;
|
|
1095
|
+
const isAllowed = (date) => (!minDate || compareDates(date, minDate) >= 0) && (!maxDate || compareDates(date, maxDate) <= 0) && !isDateDisabled?.(toIso(date));
|
|
1096
|
+
const isTooLong = (start, end) => maxDays !== void 0 && daysSpanned(start, end) > maxDays;
|
|
1097
|
+
const commit = (next) => {
|
|
1098
|
+
setShown({
|
|
1099
|
+
key: rangeKey(next),
|
|
1100
|
+
locale
|
|
1101
|
+
});
|
|
1102
|
+
setStartText(formatDate(parseIsoDate(next?.[0]), locale));
|
|
1103
|
+
setEndText(formatDate(parseIsoDate(next?.[1]), locale));
|
|
1104
|
+
setStartInvalid(false);
|
|
1105
|
+
setEndInvalid(false);
|
|
1106
|
+
if (rangeKey(next) === rangeKey(value)) return;
|
|
1107
|
+
if (valueProp === void 0) setUncontrolled(next);
|
|
1108
|
+
onValueChange?.(next);
|
|
1109
|
+
};
|
|
1110
|
+
const commitTexts = ({ whenIncomplete }) => {
|
|
1111
|
+
const hasStart = startText.trim() !== "";
|
|
1112
|
+
const hasEnd = endText.trim() !== "";
|
|
1113
|
+
if (!hasStart && !hasEnd) {
|
|
1114
|
+
commit(null);
|
|
1115
|
+
return;
|
|
1116
|
+
}
|
|
1117
|
+
const start = hasStart ? parseTypedDate(startText, locale) : null;
|
|
1118
|
+
const end = hasEnd ? parseTypedDate(endText, locale) : null;
|
|
1119
|
+
const startRejected = hasStart && (!start || !isAllowed(start));
|
|
1120
|
+
const endRejected = hasEnd && (!end || !isAllowed(end));
|
|
1121
|
+
if (startRejected || endRejected || !start || !end) {
|
|
1122
|
+
const markEmpty = whenIncomplete === "mark";
|
|
1123
|
+
setStartInvalid(startRejected || markEmpty && !hasStart);
|
|
1124
|
+
setEndInvalid(endRejected || markEmpty && !hasEnd);
|
|
1125
|
+
return;
|
|
1126
|
+
}
|
|
1127
|
+
const [from, to] = ordered(start, end);
|
|
1128
|
+
if (isTooLong(from, to)) {
|
|
1129
|
+
setStartInvalid(false);
|
|
1130
|
+
setEndInvalid(true);
|
|
1131
|
+
return;
|
|
1132
|
+
}
|
|
1133
|
+
commit([toIso(from), toIso(to)]);
|
|
1134
|
+
};
|
|
1135
|
+
const changeOpen = (next) => {
|
|
1136
|
+
setOpen(next);
|
|
1137
|
+
if (next) return;
|
|
1138
|
+
setPendingStart(null);
|
|
1139
|
+
setPreview(null);
|
|
1140
|
+
};
|
|
1141
|
+
const select = (picked) => {
|
|
1142
|
+
if (!pendingStart) {
|
|
1143
|
+
setPendingStart(picked);
|
|
1144
|
+
return;
|
|
1145
|
+
}
|
|
1146
|
+
const [from, to] = ordered(pendingStart, picked);
|
|
1147
|
+
commit([toIso(from), toIso(to)]);
|
|
1148
|
+
changeOpen(false);
|
|
1149
|
+
};
|
|
1150
|
+
const selection = pendingStart ? spanning(pendingStart, preview ?? pendingStart) : startDate && endDate ? {
|
|
1151
|
+
start: startDate,
|
|
1152
|
+
end: endDate
|
|
1153
|
+
} : null;
|
|
1154
|
+
const isCalendarDayDisabled = (date) => !isAllowed(date) || pendingStart !== null && isTooLong(pendingStart, date);
|
|
1155
|
+
const textInput = (part) => {
|
|
1156
|
+
const isStart = part === "start";
|
|
1157
|
+
const invalid = isStart ? startInvalid : endInvalid;
|
|
1158
|
+
return /* @__PURE__ */ jsx("input", {
|
|
1159
|
+
id: isStart ? fieldId : `${fieldId}-end`,
|
|
1160
|
+
"aria-label": isStart ? startLabel : endLabel,
|
|
1161
|
+
autoComplete: "off",
|
|
1162
|
+
placeholder,
|
|
1163
|
+
className: clsx(DateRangeField_module_default["date-range-field__input"], !isStart && DateRangeField_module_default["date-range-field__input--end"]),
|
|
1164
|
+
value: isStart ? startText : endText,
|
|
1165
|
+
disabled,
|
|
1166
|
+
readOnly,
|
|
1167
|
+
"aria-invalid": ariaInvalid ?? (invalid || void 0),
|
|
1168
|
+
onChange: (event) => (isStart ? setStartText : setEndText)(event.target.value),
|
|
1169
|
+
onBlur: (event) => {
|
|
1170
|
+
const next = event.relatedTarget;
|
|
1171
|
+
const staysInField = next instanceof Node && ((event.currentTarget.parentElement?.contains(next) ?? false) || (popoverRef.current?.contains(next) ?? false));
|
|
1172
|
+
commitTexts({ whenIncomplete: staysInField ? "wait" : "mark" });
|
|
1173
|
+
},
|
|
1174
|
+
onKeyDown: (event) => {
|
|
1175
|
+
if (event.key === "Enter") commitTexts({ whenIncomplete: "mark" });
|
|
1176
|
+
if (event.key === "ArrowDown" && event.altKey) {
|
|
1177
|
+
event.preventDefault();
|
|
1178
|
+
changeOpen(true);
|
|
1179
|
+
}
|
|
1180
|
+
}
|
|
1181
|
+
});
|
|
1182
|
+
};
|
|
1183
|
+
return /* @__PURE__ */ jsxs(Popover, {
|
|
1184
|
+
open: open && !locked,
|
|
1185
|
+
onOpenChange: changeOpen,
|
|
1186
|
+
children: [/* @__PURE__ */ jsx(PopoverAnchor, {
|
|
1187
|
+
asChild: true,
|
|
1188
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
1189
|
+
role: "group",
|
|
1190
|
+
className: clsx(DateRangeField_module_default["date-range-field"], isFixed && DateRangeField_module_default["date-range-field--fixed"], className),
|
|
1191
|
+
"data-width": width,
|
|
1192
|
+
"data-disabled": disabled || void 0,
|
|
1193
|
+
"data-readonly": readOnly || void 0,
|
|
1194
|
+
...props,
|
|
1195
|
+
children: [
|
|
1196
|
+
textInput("start"),
|
|
1197
|
+
isFixed ? /* @__PURE__ */ jsx("span", {
|
|
1198
|
+
"aria-hidden": true,
|
|
1199
|
+
className: DateRangeField_module_default["date-range-field__sizer"],
|
|
1200
|
+
children: fixedWidthDates
|
|
1201
|
+
}) : null,
|
|
1202
|
+
/* @__PURE__ */ jsx("span", {
|
|
1203
|
+
"aria-hidden": true,
|
|
1204
|
+
className: DateRangeField_module_default["date-range-field__separator"],
|
|
1205
|
+
children: "–"
|
|
1206
|
+
}),
|
|
1207
|
+
textInput("end"),
|
|
1208
|
+
isFixed ? /* @__PURE__ */ jsx("span", {
|
|
1209
|
+
"aria-hidden": true,
|
|
1210
|
+
className: clsx(DateRangeField_module_default["date-range-field__sizer"], DateRangeField_module_default["date-range-field__sizer--end"]),
|
|
1211
|
+
children: fixedWidthDates
|
|
1212
|
+
}) : null,
|
|
1213
|
+
isFixed && clearable && !showsClear ? /* @__PURE__ */ jsx("span", {
|
|
1214
|
+
"aria-hidden": true,
|
|
1215
|
+
className: DateRangeField_module_default["date-range-field__clear-space"]
|
|
1216
|
+
}) : null,
|
|
1217
|
+
showsClear ? /* @__PURE__ */ jsx("button", {
|
|
1218
|
+
type: "button",
|
|
1219
|
+
"aria-label": clearLabel,
|
|
1220
|
+
className: DateRangeField_module_default["date-range-field__action"],
|
|
1221
|
+
onClick: () => commit(null),
|
|
1222
|
+
children: /* @__PURE__ */ jsx(TbX, {
|
|
1223
|
+
"aria-hidden": true,
|
|
1224
|
+
className: DateRangeField_module_default["date-range-field__icon"]
|
|
1225
|
+
})
|
|
1226
|
+
}) : null,
|
|
1227
|
+
/* @__PURE__ */ jsx(PopoverTrigger, {
|
|
1228
|
+
asChild: true,
|
|
1229
|
+
children: /* @__PURE__ */ jsx("button", {
|
|
1230
|
+
type: "button",
|
|
1231
|
+
"aria-label": calendarLabel,
|
|
1232
|
+
"aria-controls": open ? `${fieldId}-calendar` : void 0,
|
|
1233
|
+
className: DateRangeField_module_default["date-range-field__action"],
|
|
1234
|
+
disabled: locked,
|
|
1235
|
+
children: /* @__PURE__ */ jsx(TbCalendar, {
|
|
1236
|
+
"aria-hidden": true,
|
|
1237
|
+
className: DateRangeField_module_default["date-range-field__icon"]
|
|
1238
|
+
})
|
|
1239
|
+
})
|
|
1240
|
+
})
|
|
1241
|
+
]
|
|
1242
|
+
})
|
|
1243
|
+
}), /* @__PURE__ */ jsx(PopoverContent, {
|
|
1244
|
+
"aria-label": calendarLabel,
|
|
1245
|
+
...calendarProps,
|
|
1246
|
+
ref: popoverRef,
|
|
1247
|
+
id: `${fieldId}-calendar`,
|
|
1248
|
+
align: "start",
|
|
1249
|
+
padding: "none",
|
|
1250
|
+
className: clsx(DateRangeField_module_default["date-range-field__popover"], calendarProps?.className),
|
|
1251
|
+
onOpenAutoFocus: (event) => {
|
|
1252
|
+
event.preventDefault();
|
|
1253
|
+
requestAnimationFrame(() => gridRef.current?.querySelector("[tabindex=\"0\"]")?.focus());
|
|
1254
|
+
},
|
|
1255
|
+
children: /* @__PURE__ */ jsx(Calendar, {
|
|
1256
|
+
selection,
|
|
1257
|
+
min: minDate,
|
|
1258
|
+
max: maxDate,
|
|
1259
|
+
isDisabled: isCalendarDayDisabled,
|
|
1260
|
+
locale,
|
|
1261
|
+
weekStartsOn,
|
|
1262
|
+
onSelect: select,
|
|
1263
|
+
onPreview: setPreview,
|
|
1264
|
+
previousMonthLabel,
|
|
1265
|
+
nextMonthLabel,
|
|
1266
|
+
todayLabel,
|
|
1267
|
+
gridRef
|
|
1268
|
+
})
|
|
1269
|
+
})]
|
|
1270
|
+
});
|
|
1271
|
+
}
|
|
1272
|
+
var Tooltip_module_default = {
|
|
1273
|
+
tooltip__content: "_tooltip__content_8con6_1",
|
|
1274
|
+
"tooltip-in": "_tooltip-in_8con6_1",
|
|
1275
|
+
"tooltip-out": "_tooltip-out_8con6_1",
|
|
1276
|
+
"tooltip-fade-in": "_tooltip-fade-in_8con6_1",
|
|
1277
|
+
"tooltip-fade-out": "_tooltip-fade-out_8con6_1"
|
|
1278
|
+
};
|
|
1279
|
+
var HasProviderContext = React.createContext(false);
|
|
1280
|
+
/**
|
|
1281
|
+
* Shares the show delay across every tooltip below it and lets a neighbouring
|
|
1282
|
+
* tooltip open instantly while one is already showing. Mount one near the app
|
|
1283
|
+
* root; a `Tooltip` rendered outside any provider falls back to its own.
|
|
1284
|
+
*/
|
|
1285
|
+
function TooltipProvider(props) {
|
|
1286
|
+
return /* @__PURE__ */ jsx(HasProviderContext.Provider, {
|
|
1287
|
+
value: true,
|
|
1288
|
+
children: /* @__PURE__ */ jsx(TooltipPrimitive.Provider, { ...props })
|
|
1289
|
+
});
|
|
1290
|
+
}
|
|
1291
|
+
function Tooltip(props) {
|
|
1292
|
+
const hasProvider = React.useContext(HasProviderContext);
|
|
1293
|
+
const root = /* @__PURE__ */ jsx(TooltipPrimitive.Root, { ...props });
|
|
1294
|
+
return hasProvider ? root : /* @__PURE__ */ jsx(TooltipPrimitive.Provider, { children: root });
|
|
1295
|
+
}
|
|
1296
|
+
/**
|
|
1297
|
+
* Element that opens the tooltip on hover or focus. While open, it points to the content
|
|
1298
|
+
* with `aria-describedby`, so do not repeat the same fact in `sr-only` text.
|
|
1299
|
+
*/
|
|
1300
|
+
var TooltipTrigger = TooltipPrimitive.Trigger;
|
|
1301
|
+
/** Light surface hint shown on hover or focus of its trigger. */
|
|
1302
|
+
function TooltipContent({ className, sideOffset = 6, children, ...props }) {
|
|
1303
|
+
return /* @__PURE__ */ jsx(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsx(TooltipPrimitive.Content, {
|
|
1304
|
+
sideOffset,
|
|
1305
|
+
className: clsx(Tooltip_module_default["tooltip__content"], className),
|
|
1306
|
+
...props,
|
|
1307
|
+
children
|
|
1308
|
+
}) });
|
|
1309
|
+
}
|
|
1310
|
+
var DropdownMenu_module_default = {
|
|
1311
|
+
"dropdown-menu__content": "_dropdown-menu__content_arqsp_1",
|
|
1312
|
+
"dropdown-menu-in": "_dropdown-menu-in_arqsp_1",
|
|
1313
|
+
"dropdown-menu-out": "_dropdown-menu-out_arqsp_1",
|
|
1314
|
+
"dropdown-menu__item": "_dropdown-menu__item_arqsp_28",
|
|
1315
|
+
"dropdown-menu__item--destructive": "_dropdown-menu__item--destructive_arqsp_54",
|
|
1316
|
+
"dropdown-menu__indicator": "_dropdown-menu__indicator_arqsp_68",
|
|
1317
|
+
"dropdown-menu__sub-chevron": "_dropdown-menu__sub-chevron_arqsp_77 _icon_gih1f_35",
|
|
1318
|
+
"dropdown-menu__label": "_dropdown-menu__label_arqsp_84",
|
|
1319
|
+
"dropdown-menu__separator": "_dropdown-menu__separator_arqsp_91",
|
|
1320
|
+
"dropdown-menu-fade-in": "_dropdown-menu-fade-in_arqsp_1",
|
|
1321
|
+
"dropdown-menu-fade-out": "_dropdown-menu-fade-out_arqsp_1",
|
|
1322
|
+
"dropdown-menu__check-icon": "_dropdown-menu__check-icon_arqsp_139 _icon_gih1f_35"
|
|
1323
|
+
};
|
|
1324
|
+
/**
|
|
1325
|
+
* A modal menu (the default) locks page scroll and sets `pointer-events: none` on `body`.
|
|
1326
|
+
* Pass `modal={false}` inside an iframe sized to its content.
|
|
1327
|
+
*/
|
|
1328
|
+
var DropdownMenu = DropdownMenuPrimitive.Root;
|
|
1329
|
+
var DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
|
|
1330
|
+
var DropdownMenuGroup = DropdownMenuPrimitive.Group;
|
|
1331
|
+
var DropdownMenuPortal = DropdownMenuPrimitive.Portal;
|
|
1332
|
+
var DropdownMenuSub = DropdownMenuPrimitive.Sub;
|
|
1333
|
+
/** Menu surface, portalled and positioned against the trigger. */
|
|
1334
|
+
function DropdownMenuContent({ className, sideOffset = 4, ref, onPointerDownOutside, ...props }) {
|
|
1335
|
+
const contentRef = React.useRef(null);
|
|
1336
|
+
const setContentRef = React.useCallback((node) => {
|
|
1337
|
+
contentRef.current = node;
|
|
1338
|
+
if (typeof ref === "function") ref(node);
|
|
1339
|
+
else if (ref) ref.current = node;
|
|
1340
|
+
}, [ref]);
|
|
1341
|
+
return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.Content, {
|
|
1342
|
+
ref: setContentRef,
|
|
1343
|
+
onPointerDownOutside: (event) => {
|
|
1344
|
+
onPointerDownOutside?.(event);
|
|
1345
|
+
if (isTogglePressOnOwnTrigger(contentRef.current, event)) event.preventDefault();
|
|
1346
|
+
},
|
|
1347
|
+
sideOffset,
|
|
1348
|
+
className: clsx(DropdownMenu_module_default["dropdown-menu__content"], className),
|
|
1349
|
+
...props
|
|
1350
|
+
}) });
|
|
1351
|
+
}
|
|
1352
|
+
function isTogglePressOnOwnTrigger(content, event) {
|
|
1353
|
+
const { button, ctrlKey } = event.detail.originalEvent;
|
|
1354
|
+
if (!content || button !== 0 || ctrlKey) return false;
|
|
1355
|
+
const target = event.target;
|
|
1356
|
+
return target instanceof Node && Boolean(findTrigger(content)?.contains(target));
|
|
1357
|
+
}
|
|
1358
|
+
function findTrigger(content) {
|
|
1359
|
+
const triggerId = content.getAttribute("aria-labelledby");
|
|
1360
|
+
return triggerId && content.ownerDocument.getElementById(triggerId) || content.ownerDocument.querySelector(`[aria-controls="${CSS.escape(content.id)}"]`);
|
|
1361
|
+
}
|
|
1362
|
+
function DropdownMenuSubContent({ className, ...props }) {
|
|
1363
|
+
return /* @__PURE__ */ jsx(DropdownMenuPrimitive.SubContent, {
|
|
1364
|
+
className: clsx(DropdownMenu_module_default["dropdown-menu__content"], className),
|
|
1365
|
+
...props
|
|
1366
|
+
});
|
|
1367
|
+
}
|
|
1368
|
+
function DropdownMenuSubTrigger({ className, children, ...props }) {
|
|
1369
|
+
return /* @__PURE__ */ jsxs(DropdownMenuPrimitive.SubTrigger, {
|
|
1370
|
+
className: clsx(DropdownMenu_module_default["dropdown-menu__item"], className),
|
|
1371
|
+
...props,
|
|
1372
|
+
children: [children, /* @__PURE__ */ jsx(TbChevronRight, {
|
|
1373
|
+
"aria-hidden": true,
|
|
1374
|
+
className: DropdownMenu_module_default["dropdown-menu__sub-chevron"]
|
|
1375
|
+
})]
|
|
1376
|
+
});
|
|
1377
|
+
}
|
|
1378
|
+
function DropdownMenuItem({ className, variant = "default", selected = false, leadingIcon, trailingIcon, children, ...props }) {
|
|
1379
|
+
return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Item, {
|
|
1380
|
+
"data-variant": variant,
|
|
1381
|
+
"data-selected": selected ? "true" : void 0,
|
|
1382
|
+
"aria-current": selected ? "true" : void 0,
|
|
1383
|
+
className: clsx(DropdownMenu_module_default["dropdown-menu__item"], variant === "destructive" && DropdownMenu_module_default["dropdown-menu__item--destructive"], className),
|
|
1384
|
+
...props,
|
|
1385
|
+
children: props.asChild ? children : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1386
|
+
renderSlotIcon(leadingIcon),
|
|
1387
|
+
children,
|
|
1388
|
+
renderSlotIcon(trailingIcon),
|
|
1389
|
+
selected ? /* @__PURE__ */ jsx("span", {
|
|
1390
|
+
className: DropdownMenu_module_default["dropdown-menu__indicator"],
|
|
1391
|
+
children: /* @__PURE__ */ jsx(TbCheck, {
|
|
1392
|
+
"aria-hidden": true,
|
|
1393
|
+
className: DropdownMenu_module_default["dropdown-menu__check-icon"]
|
|
1394
|
+
})
|
|
1395
|
+
}) : null
|
|
1396
|
+
] })
|
|
1397
|
+
});
|
|
1398
|
+
}
|
|
1399
|
+
function DropdownMenuSeparator({ className, ...props }) {
|
|
1400
|
+
return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Separator, {
|
|
1401
|
+
className: clsx(DropdownMenu_module_default["dropdown-menu__separator"], className),
|
|
1402
|
+
...props
|
|
1403
|
+
});
|
|
1404
|
+
}
|
|
1405
|
+
var HelpIcon_module_default = { "help-icon": "_help-icon_1761w_1 _interactive_gih1f_10" };
|
|
1406
|
+
/**
|
|
1407
|
+
* Help icon that explains its subject in a tooltip; a real button, so the
|
|
1408
|
+
* explanation is reachable by keyboard as well as on hover.
|
|
1409
|
+
*/
|
|
1410
|
+
function HelpIcon({ text, size = "xs", side = "top", align = "end" }) {
|
|
1411
|
+
return /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
|
|
1412
|
+
"aria-label": text,
|
|
1413
|
+
"data-size": size,
|
|
1414
|
+
className: HelpIcon_module_default["help-icon"],
|
|
1415
|
+
children: /* @__PURE__ */ jsx(TbHelpCircleFilled, { "aria-hidden": true })
|
|
1416
|
+
}), /* @__PURE__ */ jsx(TooltipContent, {
|
|
1417
|
+
side,
|
|
1418
|
+
align,
|
|
1419
|
+
children: text
|
|
1420
|
+
})] });
|
|
1421
|
+
}
|
|
1422
|
+
var Label_module_default = {
|
|
1423
|
+
label: "_label_11cjn_1",
|
|
1424
|
+
label__required: "_label__required_11cjn_9"
|
|
1425
|
+
};
|
|
1426
|
+
/**
|
|
1427
|
+
* Text label for a form control. Use it on its own next to any control, or
|
|
1428
|
+
* inside `Field`, which adds the description and error around it.
|
|
1429
|
+
*/
|
|
1430
|
+
function Label({ className, required = false, children, ...props }) {
|
|
1431
|
+
return /* @__PURE__ */ jsxs("label", {
|
|
1432
|
+
className: clsx(Label_module_default.label, className),
|
|
1433
|
+
...props,
|
|
1434
|
+
children: [children, required ? /* @__PURE__ */ jsx(RequiredMarker, {}) : null]
|
|
1435
|
+
});
|
|
1436
|
+
}
|
|
1437
|
+
/**
|
|
1438
|
+
* Asterisk marking a control as required.
|
|
1439
|
+
*
|
|
1440
|
+
* @remarks
|
|
1441
|
+
* `Label required` renders it; labels built by hand place it themselves so
|
|
1442
|
+
* every required field looks the same.
|
|
1443
|
+
*/
|
|
1444
|
+
function RequiredMarker({ className, ...props }) {
|
|
1445
|
+
return /* @__PURE__ */ jsx("span", {
|
|
1446
|
+
className: clsx(Label_module_default.label__required, className),
|
|
1447
|
+
...props,
|
|
1448
|
+
children: "*"
|
|
1449
|
+
});
|
|
1450
|
+
}
|
|
1451
|
+
var Link_module_default = {
|
|
1452
|
+
link: "_link_1usjv_6 _interactive_gih1f_10",
|
|
1453
|
+
"link--inherit": "_link--inherit_1usjv_24",
|
|
1454
|
+
"link--button": "_link--button_1usjv_30",
|
|
1455
|
+
link__icon: "_link__icon_1usjv_39 _icon_gih1f_35",
|
|
1456
|
+
link__sr: "_link__sr_1usjv_46"
|
|
1457
|
+
};
|
|
1458
|
+
function ExternalIcon({ label }) {
|
|
1459
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1460
|
+
" ",
|
|
1461
|
+
/* @__PURE__ */ jsx(TbExternalLink, {
|
|
1462
|
+
"aria-hidden": true,
|
|
1463
|
+
className: Link_module_default["link__icon"]
|
|
1464
|
+
}),
|
|
1465
|
+
/* @__PURE__ */ jsx("span", {
|
|
1466
|
+
className: Link_module_default["link__sr"],
|
|
1467
|
+
children: label
|
|
1468
|
+
})
|
|
1469
|
+
] });
|
|
1470
|
+
}
|
|
1471
|
+
/**
|
|
1472
|
+
* A link inside text: the link colour, an underline that strengthens on
|
|
1473
|
+
* hover, and the focus ring. Use `asChild` for a router link, `external` for
|
|
1474
|
+
* another site. For an action inside a sentence (opening a dialog), use
|
|
1475
|
+
* `LinkButton`.
|
|
1476
|
+
*/
|
|
1477
|
+
function Link({ className, color = "primary", asChild = false, external = false, externalLabel = "(opens in a new tab)", target, rel, children, ...props }) {
|
|
1478
|
+
return /* @__PURE__ */ jsxs(asChild ? Slot : "a", {
|
|
1479
|
+
"data-color": color,
|
|
1480
|
+
className: clsx(Link_module_default.link, color === "inherit" && Link_module_default["link--inherit"], className),
|
|
1481
|
+
target: external ? "_blank" : target,
|
|
1482
|
+
rel: external ? rel ?? "noopener noreferrer" : rel,
|
|
1483
|
+
...props,
|
|
1484
|
+
children: [/* @__PURE__ */ jsx(Slottable, { children }), external ? /* @__PURE__ */ jsx(ExternalIcon, { label: externalLabel }) : null]
|
|
1485
|
+
});
|
|
1486
|
+
}
|
|
1487
|
+
var NativeSelect_module_default = {
|
|
1488
|
+
"native-select": "_native-select_1l5sa_1",
|
|
1489
|
+
"native-select__select": "_native-select__select_1l5sa_7 _interactive_gih1f_10",
|
|
1490
|
+
"native-select__chevron": "_native-select__chevron_1l5sa_43 _icon_gih1f_35"
|
|
1491
|
+
};
|
|
1492
|
+
var blockOpening = {
|
|
1493
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
1494
|
+
onKeyDown: (event) => {
|
|
1495
|
+
if (event.key !== "Tab") event.preventDefault();
|
|
1496
|
+
}
|
|
1497
|
+
};
|
|
1498
|
+
/**
|
|
1499
|
+
* Styled native `<select>`; the browser owns the option list.
|
|
1500
|
+
*
|
|
1501
|
+
* @remarks
|
|
1502
|
+
* `className` lands on the wrapping element so callers can size the control;
|
|
1503
|
+
* every other prop goes to the `<select>`. An `aria-invalid` select shows the
|
|
1504
|
+
* error border. Use `Select` when the option list needs custom rendering.
|
|
1505
|
+
*/
|
|
1506
|
+
function NativeSelect({ className, children, readOnly = false, ...props }) {
|
|
1507
|
+
const focusedValue = React.useRef("");
|
|
1508
|
+
const readOnlyHandlers = {
|
|
1509
|
+
...blockOpening,
|
|
1510
|
+
onFocus: (event) => {
|
|
1511
|
+
focusedValue.current = event.currentTarget.value;
|
|
1512
|
+
props.onFocus?.(event);
|
|
1513
|
+
},
|
|
1514
|
+
onChange: (event) => {
|
|
1515
|
+
event.currentTarget.value = focusedValue.current;
|
|
1516
|
+
}
|
|
1517
|
+
};
|
|
1518
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1519
|
+
className: clsx(NativeSelect_module_default["native-select"], className),
|
|
1520
|
+
children: [/* @__PURE__ */ jsx("select", {
|
|
1521
|
+
className: NativeSelect_module_default["native-select__select"],
|
|
1522
|
+
"aria-readonly": readOnly || void 0,
|
|
1523
|
+
...props,
|
|
1524
|
+
...readOnly && readOnlyHandlers,
|
|
1525
|
+
children
|
|
1526
|
+
}), !readOnly && /* @__PURE__ */ jsx(TbSelector, {
|
|
1527
|
+
"aria-hidden": true,
|
|
1528
|
+
className: NativeSelect_module_default["native-select__chevron"]
|
|
1529
|
+
})]
|
|
1530
|
+
});
|
|
1531
|
+
}
|
|
1532
|
+
function NativeSelectOption(props) {
|
|
1533
|
+
return /* @__PURE__ */ jsx("option", { ...props });
|
|
1534
|
+
}
|
|
1535
|
+
var Pagination_module_default = {
|
|
1536
|
+
pagination: "_pagination_7of02_1",
|
|
1537
|
+
"pagination__nav-button": "_pagination__nav-button_7of02_7 _interactive_gih1f_10",
|
|
1538
|
+
pagination__ellipsis: "_pagination__ellipsis_7of02_31",
|
|
1539
|
+
pagination__page: "_pagination__page_7of02_39 _interactive_gih1f_10",
|
|
1540
|
+
"pagination__page--active": "_pagination__page--active_7of02_61",
|
|
1541
|
+
pagination__icon: "_pagination__icon_7of02_71 _icon_gih1f_35"
|
|
1542
|
+
};
|
|
1543
|
+
function pageWindow(current, pageCount) {
|
|
1544
|
+
const inRange = (page) => page >= 1 && page <= pageCount;
|
|
1545
|
+
const pages = [.../* @__PURE__ */ new Set([...[
|
|
1546
|
+
1,
|
|
1547
|
+
current - 1,
|
|
1548
|
+
current + 1,
|
|
1549
|
+
pageCount
|
|
1550
|
+
].filter(inRange), current])].sort((a, b) => a - b);
|
|
1551
|
+
return pages.flatMap((page, index) => {
|
|
1552
|
+
const previous = pages[index - 1];
|
|
1553
|
+
if (previous === void 0 || page - previous === 1) return [page];
|
|
1554
|
+
if (page - previous === 2) return [previous + 1, page];
|
|
1555
|
+
return ["ellipsis", page];
|
|
1556
|
+
});
|
|
1557
|
+
}
|
|
1558
|
+
/**
|
|
1559
|
+
* Previous/next page navigation, with the first and last page when `pageCount` is set.
|
|
1560
|
+
* Renders nothing for one page; the end buttons stay focusable (`aria-disabled`).
|
|
1561
|
+
*/
|
|
1562
|
+
function Pagination({ className, current, pageCount, hasPrevious: cursorHasPrevious, hasNext: cursorHasNext, onPageChange, previousLabel, nextLabel, pageLabel, ...props }) {
|
|
1563
|
+
if (pageCount !== void 0 && pageCount <= 1) return null;
|
|
1564
|
+
if (pageCount !== void 0 && (current < 1 || current > pageCount)) throw new RangeError(`Pagination current (${current}) must be between 1 and pageCount (${pageCount})`);
|
|
1565
|
+
const hasPrevious = pageCount === void 0 ? cursorHasPrevious : current > 1;
|
|
1566
|
+
const hasNext = pageCount === void 0 ? cursorHasNext : current < pageCount;
|
|
1567
|
+
if (!hasPrevious && !hasNext) return null;
|
|
1568
|
+
const entries = pageCount === void 0 ? [
|
|
1569
|
+
...hasPrevious ? [current - 1] : [],
|
|
1570
|
+
current,
|
|
1571
|
+
...hasNext ? [current + 1] : []
|
|
1572
|
+
] : pageWindow(current, pageCount);
|
|
1573
|
+
return /* @__PURE__ */ jsxs("nav", {
|
|
1574
|
+
className: clsx(Pagination_module_default.pagination, className),
|
|
1575
|
+
...props,
|
|
1576
|
+
children: [
|
|
1577
|
+
/* @__PURE__ */ jsx(PaginationEnd, {
|
|
1578
|
+
label: previousLabel,
|
|
1579
|
+
unavailable: !hasPrevious,
|
|
1580
|
+
onPress: () => onPageChange(current - 1),
|
|
1581
|
+
children: /* @__PURE__ */ jsx(TbChevronLeft, {
|
|
1582
|
+
"aria-hidden": true,
|
|
1583
|
+
className: Pagination_module_default["pagination__icon"]
|
|
1584
|
+
})
|
|
1585
|
+
}),
|
|
1586
|
+
entries.map((entry, index) => entry === "ellipsis" ? /* @__PURE__ */ jsx("span", {
|
|
1587
|
+
className: Pagination_module_default["pagination__ellipsis"],
|
|
1588
|
+
"data-ellipsis": true,
|
|
1589
|
+
"aria-hidden": "true",
|
|
1590
|
+
children: "…"
|
|
1591
|
+
}, `ellipsis-${index}`) : /* @__PURE__ */ jsx("button", {
|
|
1592
|
+
type: "button",
|
|
1593
|
+
className: clsx(Pagination_module_default["pagination__page"], entry === current && Pagination_module_default["pagination__page--active"]),
|
|
1594
|
+
"aria-label": pageLabel(entry),
|
|
1595
|
+
"aria-current": entry === current ? "page" : void 0,
|
|
1596
|
+
onClick: () => onPageChange(entry),
|
|
1597
|
+
children: entry
|
|
1598
|
+
}, entry)),
|
|
1599
|
+
/* @__PURE__ */ jsx(PaginationEnd, {
|
|
1600
|
+
label: nextLabel,
|
|
1601
|
+
unavailable: !hasNext,
|
|
1602
|
+
onPress: () => onPageChange(current + 1),
|
|
1603
|
+
children: /* @__PURE__ */ jsx(TbChevronRight, {
|
|
1604
|
+
"aria-hidden": true,
|
|
1605
|
+
className: Pagination_module_default["pagination__icon"]
|
|
1606
|
+
})
|
|
1607
|
+
})
|
|
1608
|
+
]
|
|
1609
|
+
});
|
|
1610
|
+
}
|
|
1611
|
+
function PaginationEnd({ label, unavailable, onPress, children }) {
|
|
1612
|
+
return /* @__PURE__ */ jsx("button", {
|
|
1613
|
+
type: "button",
|
|
1614
|
+
className: Pagination_module_default["pagination__nav-button"],
|
|
1615
|
+
"aria-label": label,
|
|
1616
|
+
"aria-disabled": unavailable || void 0,
|
|
1617
|
+
onClick: unavailable ? void 0 : onPress,
|
|
1618
|
+
children
|
|
1619
|
+
});
|
|
1620
|
+
}
|
|
1621
|
+
var SearchInput_module_default = {
|
|
1622
|
+
"search-input": "_search-input_1aj0i_1",
|
|
1623
|
+
"search-input__icon": "_search-input__icon_1aj0i_7 _icon_gih1f_35",
|
|
1624
|
+
"search-input__input": "_search-input__input_1aj0i_18"
|
|
1625
|
+
};
|
|
1626
|
+
function SearchInput({ className, containerProps, ...props }) {
|
|
1627
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1628
|
+
...containerProps,
|
|
1629
|
+
className: clsx(SearchInput_module_default["search-input"], containerProps?.className),
|
|
1630
|
+
children: [/* @__PURE__ */ jsx(TbSearch, {
|
|
1631
|
+
"aria-hidden": true,
|
|
1632
|
+
className: SearchInput_module_default["search-input__icon"]
|
|
1633
|
+
}), /* @__PURE__ */ jsx(Input, {
|
|
1634
|
+
type: "search",
|
|
1635
|
+
className: clsx(SearchInput_module_default["search-input__input"], className),
|
|
1636
|
+
...props
|
|
1637
|
+
})]
|
|
1638
|
+
});
|
|
1639
|
+
}
|
|
1640
|
+
SearchInput.displayName = "SearchInput";
|
|
1641
|
+
var Skeleton_module_default = {
|
|
1642
|
+
skeleton: "_skeleton_toeup_1",
|
|
1643
|
+
"skeleton-pulse": "_skeleton-pulse_toeup_1",
|
|
1644
|
+
"skeleton--pill": "_skeleton--pill_toeup_7"
|
|
1645
|
+
};
|
|
1646
|
+
var shapeClass = {
|
|
1647
|
+
rounded: void 0,
|
|
1648
|
+
pill: Skeleton_module_default["skeleton--pill"]
|
|
1649
|
+
};
|
|
1650
|
+
/** Pulsing placeholder block for content that is still loading; size it with `className`. */
|
|
1651
|
+
function Skeleton({ className, shape = "rounded", ...props }) {
|
|
1652
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1653
|
+
"aria-hidden": true,
|
|
1654
|
+
"data-shape": shape,
|
|
1655
|
+
className: clsx(Skeleton_module_default["skeleton"], shapeClass[shape], className),
|
|
1656
|
+
...props
|
|
1657
|
+
});
|
|
1658
|
+
}
|
|
1659
|
+
var StatusScreen_module_default = {
|
|
1660
|
+
"status-screen": "_status-screen_e429y_1",
|
|
1661
|
+
"status-screen--page": "_status-screen--page_e429y_12",
|
|
1662
|
+
"status-screen--inline": "_status-screen--inline_e429y_16",
|
|
1663
|
+
"status-screen__content": "_status-screen__content_e429y_20",
|
|
1664
|
+
"status-screen__icon": "_status-screen__icon_e429y_29",
|
|
1665
|
+
"status-screen__title": "_status-screen__title_e429y_50",
|
|
1666
|
+
"status-screen__description": "_status-screen__description_e429y_59",
|
|
1667
|
+
"status-screen__actions": "_status-screen__actions_e429y_66"
|
|
1668
|
+
};
|
|
1669
|
+
var variantClass$1 = {
|
|
1670
|
+
page: StatusScreen_module_default["status-screen--page"],
|
|
1671
|
+
inline: StatusScreen_module_default["status-screen--inline"]
|
|
1672
|
+
};
|
|
1673
|
+
/**
|
|
1674
|
+
* Centred status/empty state: icon tile, title, description and actions.
|
|
1675
|
+
*
|
|
1676
|
+
* @remarks
|
|
1677
|
+
* Compose with `StatusScreenIcon`, `StatusScreenTitle`,
|
|
1678
|
+
* `StatusScreenDescription` and `StatusScreenActions` (plus any extra
|
|
1679
|
+
* children). The sub-components are named exports, not `StatusScreen.Icon`
|
|
1680
|
+
* static properties: the module is shared by React Server and Client
|
|
1681
|
+
* Components, and properties assigned onto a function do not survive an RSC
|
|
1682
|
+
* client-reference boundary (they arrive as `undefined` and crash the render
|
|
1683
|
+
* with React error #130).
|
|
1684
|
+
*/
|
|
1685
|
+
function StatusScreen({ className, contentClassName, variant = "page", children, ...props }) {
|
|
1686
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1687
|
+
"data-variant": variant,
|
|
1688
|
+
className: clsx(StatusScreen_module_default["status-screen"], variantClass$1[variant], className),
|
|
1689
|
+
...props,
|
|
1690
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
1691
|
+
className: clsx(StatusScreen_module_default["status-screen__content"], contentClassName),
|
|
1692
|
+
children
|
|
1693
|
+
})
|
|
1694
|
+
});
|
|
1695
|
+
}
|
|
1696
|
+
/** Bordered tile that frames the status glyph passed as children. */
|
|
1697
|
+
function StatusScreenIcon({ className, ...props }) {
|
|
1698
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1699
|
+
className: clsx(StatusScreen_module_default["status-screen__icon"], className),
|
|
1700
|
+
...props
|
|
1701
|
+
});
|
|
1702
|
+
}
|
|
1703
|
+
function StatusScreenTitle({ as: Heading = "h1", className, ...props }) {
|
|
1704
|
+
return /* @__PURE__ */ jsx(Heading, {
|
|
1705
|
+
className: clsx(StatusScreen_module_default["status-screen__title"], className),
|
|
1706
|
+
...props
|
|
1707
|
+
});
|
|
1708
|
+
}
|
|
1709
|
+
function StatusScreenDescription({ className, ...props }) {
|
|
1710
|
+
return /* @__PURE__ */ jsx("p", {
|
|
1711
|
+
className: clsx(StatusScreen_module_default["status-screen__description"], className),
|
|
1712
|
+
...props
|
|
1713
|
+
});
|
|
1714
|
+
}
|
|
1715
|
+
/** Row of calls to action below the description; stacks on narrow viewports. */
|
|
1716
|
+
function StatusScreenActions({ className, ...props }) {
|
|
1717
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1718
|
+
className: clsx(StatusScreen_module_default["status-screen__actions"], className),
|
|
1719
|
+
...props
|
|
1720
|
+
});
|
|
1721
|
+
}
|
|
1722
|
+
var Switch_module_default = {
|
|
1723
|
+
"switch": "_switch_i2ch3_1 _interactive_gih1f_10",
|
|
1724
|
+
switch__thumb: "_switch__thumb_i2ch3_35"
|
|
1725
|
+
};
|
|
1726
|
+
function Switch({ className, checked, defaultChecked, onCheckedChange, onClick, readOnly = false, ...props }) {
|
|
1727
|
+
const [uncontrolled, setUncontrolled] = React.useState(defaultChecked ?? false);
|
|
1728
|
+
const isChecked = checked ?? uncontrolled;
|
|
1729
|
+
const state = isChecked ? "checked" : "unchecked";
|
|
1730
|
+
return /* @__PURE__ */ jsx("button", {
|
|
1731
|
+
type: "button",
|
|
1732
|
+
role: "switch",
|
|
1733
|
+
"aria-readonly": readOnly || void 0,
|
|
1734
|
+
className: clsx(Switch_module_default["switch"], className),
|
|
1735
|
+
onClick: (event) => {
|
|
1736
|
+
onClick?.(event);
|
|
1737
|
+
if (readOnly) return;
|
|
1738
|
+
const next = !isChecked;
|
|
1739
|
+
if (checked === void 0) setUncontrolled(next);
|
|
1740
|
+
onCheckedChange?.(next);
|
|
1741
|
+
},
|
|
1742
|
+
...props,
|
|
1743
|
+
"aria-checked": isChecked,
|
|
1744
|
+
"data-state": state,
|
|
1745
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
1746
|
+
className: Switch_module_default["switch__thumb"],
|
|
1747
|
+
"data-state": state
|
|
1748
|
+
})
|
|
1749
|
+
});
|
|
1750
|
+
}
|
|
1751
|
+
var Table_module_default = {
|
|
1752
|
+
table: "_table_n2jrp_1",
|
|
1753
|
+
table__table: "_table__table_n2jrp_11",
|
|
1754
|
+
"table--plain": "_table--plain_n2jrp_19",
|
|
1755
|
+
"table--styled": "_table--styled_n2jrp_24",
|
|
1756
|
+
"table__head-cell": "_table__head-cell_n2jrp_37",
|
|
1757
|
+
table__row: "_table__row_n2jrp_54",
|
|
1758
|
+
table__cell: "_table__cell_n2jrp_36",
|
|
1759
|
+
"row-actions-button": "_row-actions-button_n2jrp_144 _interactive_gih1f_10",
|
|
1760
|
+
"table--borderless": "_table--borderless_n2jrp_162",
|
|
1761
|
+
"table-card": "_table-card_n2jrp_167",
|
|
1762
|
+
"table-toolbar": "_table-toolbar_n2jrp_186",
|
|
1763
|
+
"table-footer": "_table-footer_n2jrp_194",
|
|
1764
|
+
"table__row--expandable": "_table__row--expandable_n2jrp_230",
|
|
1765
|
+
"table__expander-cell": "_table__expander-cell_n2jrp_234",
|
|
1766
|
+
table__expander: "_table__expander_n2jrp_234 _interactive_gih1f_10",
|
|
1767
|
+
"table__expanded-row": "_table__expanded-row_n2jrp_266",
|
|
1768
|
+
"table__expanded-cell": "_table__expanded-cell_n2jrp_270",
|
|
1769
|
+
table__expanded: "_table__expanded_n2jrp_266",
|
|
1770
|
+
"table-expand-in": "_table-expand-in_n2jrp_1",
|
|
1771
|
+
"table__expander-icon": "_table__expander-icon_n2jrp_302 _icon_gih1f_35",
|
|
1772
|
+
"table__actions-icon": "_table__actions-icon_n2jrp_307 _icon_gih1f_35"
|
|
1773
|
+
};
|
|
1774
|
+
function Table({ className, containerProps, bordered = true, variant = "default", ...props }) {
|
|
1775
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1776
|
+
...containerProps,
|
|
1777
|
+
"data-variant": variant,
|
|
1778
|
+
className: clsx(Table_module_default["table"], variant === "default" ? Table_module_default["table--styled"] : Table_module_default["table--plain"], !bordered && Table_module_default["table--borderless"], containerProps?.className),
|
|
1779
|
+
children: /* @__PURE__ */ jsx("table", {
|
|
1780
|
+
className: clsx(Table_module_default["table__table"], className),
|
|
1781
|
+
...props
|
|
1782
|
+
})
|
|
1783
|
+
});
|
|
1784
|
+
}
|
|
1785
|
+
function TableHeader({ className, ...props }) {
|
|
1786
|
+
return /* @__PURE__ */ jsx("thead", {
|
|
1787
|
+
className,
|
|
1788
|
+
...props
|
|
1789
|
+
});
|
|
1790
|
+
}
|
|
1791
|
+
function TableBody({ className, ...props }) {
|
|
1792
|
+
return /* @__PURE__ */ jsx("tbody", {
|
|
1793
|
+
className,
|
|
1794
|
+
...props
|
|
1795
|
+
});
|
|
1796
|
+
}
|
|
1797
|
+
function TableRow({ className, selected, ...props }) {
|
|
1798
|
+
return /* @__PURE__ */ jsx("tr", {
|
|
1799
|
+
className: clsx(Table_module_default["table__row"], className),
|
|
1800
|
+
"data-selected": selected ? "" : void 0,
|
|
1801
|
+
...props
|
|
1802
|
+
});
|
|
1803
|
+
}
|
|
1804
|
+
function TableHeadCell({ className, ...props }) {
|
|
1805
|
+
return /* @__PURE__ */ jsx("th", {
|
|
1806
|
+
className: clsx(Table_module_default["table__head-cell"], className),
|
|
1807
|
+
...props
|
|
1808
|
+
});
|
|
1809
|
+
}
|
|
1810
|
+
function TableCell({ className, ...props }) {
|
|
1811
|
+
return /* @__PURE__ */ jsx("td", {
|
|
1812
|
+
className: clsx(Table_module_default["table__cell"], className),
|
|
1813
|
+
...props
|
|
1814
|
+
});
|
|
1815
|
+
}
|
|
1816
|
+
var Tabs_module_default = {
|
|
1817
|
+
tabs: "_tabs_1g4md_1",
|
|
1818
|
+
tabs__list: "_tabs__list_1g4md_6",
|
|
1819
|
+
tabs__trigger: "_tabs__trigger_1g4md_18 _interactive_gih1f_10",
|
|
1820
|
+
tabs__content: "_tabs__content_1g4md_66 _interactive_gih1f_10"
|
|
1821
|
+
};
|
|
1822
|
+
var TabsContext = React.createContext(null);
|
|
1823
|
+
function useTabsContext(component) {
|
|
1824
|
+
const context = React.use(TabsContext);
|
|
1825
|
+
if (!context) throw new Error(`<${component}> must be rendered inside <Tabs>`);
|
|
1826
|
+
return context;
|
|
1827
|
+
}
|
|
1828
|
+
function triggerId(baseId, value) {
|
|
1829
|
+
return `${baseId}-trigger-${value}`;
|
|
1830
|
+
}
|
|
1831
|
+
function contentId(baseId, value) {
|
|
1832
|
+
return `${baseId}-content-${value}`;
|
|
1833
|
+
}
|
|
1834
|
+
var nextKeys = {
|
|
1835
|
+
horizontal: "ArrowRight",
|
|
1836
|
+
vertical: "ArrowDown"
|
|
1837
|
+
};
|
|
1838
|
+
var previousKeys = {
|
|
1839
|
+
horizontal: "ArrowLeft",
|
|
1840
|
+
vertical: "ArrowUp"
|
|
1841
|
+
};
|
|
1842
|
+
function targetTabIndex(key, orientation, currentIndex, count) {
|
|
1843
|
+
if (key === "Home") return 0;
|
|
1844
|
+
if (key === "End") return count - 1;
|
|
1845
|
+
if (key === nextKeys[orientation]) return (currentIndex + 1) % count;
|
|
1846
|
+
if (key === previousKeys[orientation]) return (currentIndex - 1 + count) % count;
|
|
1847
|
+
return null;
|
|
1848
|
+
}
|
|
1849
|
+
/**
|
|
1850
|
+
* Accessible tab set with automatic activation: arrow keys, Home and End
|
|
1851
|
+
* move focus and select in one step.
|
|
1852
|
+
*/
|
|
1853
|
+
function Tabs({ className, value, defaultValue, onValueChange, orientation = "horizontal", ...props }) {
|
|
1854
|
+
const baseId = React.useId();
|
|
1855
|
+
const [uncontrolled, setUncontrolled] = React.useState(defaultValue);
|
|
1856
|
+
const select = (next) => {
|
|
1857
|
+
if (value === void 0) setUncontrolled(next);
|
|
1858
|
+
onValueChange?.(next);
|
|
1859
|
+
};
|
|
1860
|
+
return /* @__PURE__ */ jsx(TabsContext, {
|
|
1861
|
+
value: {
|
|
1862
|
+
baseId,
|
|
1863
|
+
value: value ?? uncontrolled,
|
|
1864
|
+
orientation,
|
|
1865
|
+
select
|
|
1866
|
+
},
|
|
1867
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
1868
|
+
"data-orientation": orientation,
|
|
1869
|
+
className: clsx(Tabs_module_default.tabs, className),
|
|
1870
|
+
...props
|
|
1871
|
+
})
|
|
1872
|
+
});
|
|
1873
|
+
}
|
|
1874
|
+
function TabsList({ className, onKeyDown, ...props }) {
|
|
1875
|
+
const { orientation } = useTabsContext("TabsList");
|
|
1876
|
+
const handleKeyDown = (event) => {
|
|
1877
|
+
onKeyDown?.(event);
|
|
1878
|
+
if (event.defaultPrevented) return;
|
|
1879
|
+
const tabs = Array.from(event.currentTarget.querySelectorAll("[role=\"tab\"]:not(:disabled)"));
|
|
1880
|
+
const currentIndex = tabs.findIndex((tab) => tab === event.target);
|
|
1881
|
+
if (currentIndex === -1) return;
|
|
1882
|
+
const nextIndex = targetTabIndex(event.key, orientation, currentIndex, tabs.length);
|
|
1883
|
+
const nextTab = nextIndex === null ? void 0 : tabs[nextIndex];
|
|
1884
|
+
if (!nextTab) return;
|
|
1885
|
+
event.preventDefault();
|
|
1886
|
+
nextTab.focus();
|
|
1887
|
+
nextTab.click();
|
|
1888
|
+
};
|
|
1889
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1890
|
+
role: "tablist",
|
|
1891
|
+
"aria-orientation": orientation,
|
|
1892
|
+
"data-orientation": orientation,
|
|
1893
|
+
className: clsx(Tabs_module_default.tabs__list, className),
|
|
1894
|
+
onKeyDown: handleKeyDown,
|
|
1895
|
+
...props
|
|
1896
|
+
});
|
|
1897
|
+
}
|
|
1898
|
+
function TabsTrigger({ className, value, onClick, leadingIcon, trailingIcon, children, ...props }) {
|
|
1899
|
+
const context = useTabsContext("TabsTrigger");
|
|
1900
|
+
const isActive = context.value === value;
|
|
1901
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
1902
|
+
...props,
|
|
1903
|
+
type: "button",
|
|
1904
|
+
role: "tab",
|
|
1905
|
+
id: triggerId(context.baseId, value),
|
|
1906
|
+
"aria-selected": isActive,
|
|
1907
|
+
"aria-controls": contentId(context.baseId, value),
|
|
1908
|
+
tabIndex: isActive ? 0 : -1,
|
|
1909
|
+
"data-state": isActive ? "active" : "inactive",
|
|
1910
|
+
"data-orientation": context.orientation,
|
|
1911
|
+
className: clsx(Tabs_module_default.tabs__trigger, className),
|
|
1912
|
+
onClick: (event) => {
|
|
1913
|
+
onClick?.(event);
|
|
1914
|
+
if (!event.defaultPrevented) context.select(value);
|
|
1915
|
+
},
|
|
1916
|
+
children: [
|
|
1917
|
+
renderSlotIcon(leadingIcon),
|
|
1918
|
+
children,
|
|
1919
|
+
renderSlotIcon(trailingIcon)
|
|
1920
|
+
]
|
|
1921
|
+
});
|
|
1922
|
+
}
|
|
1923
|
+
function TabsContent({ className, value, forceMount = false, ...props }) {
|
|
1924
|
+
const context = useTabsContext("TabsContent");
|
|
1925
|
+
const isActive = context.value === value;
|
|
1926
|
+
if (!isActive && !forceMount) return null;
|
|
1927
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1928
|
+
role: "tabpanel",
|
|
1929
|
+
id: contentId(context.baseId, value),
|
|
1930
|
+
"aria-labelledby": triggerId(context.baseId, value),
|
|
1931
|
+
tabIndex: 0,
|
|
1932
|
+
hidden: !isActive,
|
|
1933
|
+
"data-state": isActive ? "active" : "inactive",
|
|
1934
|
+
"data-orientation": context.orientation,
|
|
1935
|
+
className: clsx(Tabs_module_default.tabs__content, className),
|
|
1936
|
+
...props
|
|
1937
|
+
});
|
|
1938
|
+
}
|
|
1939
|
+
var Toast_module_default = {
|
|
1940
|
+
toast__viewport: "_toast__viewport_xo491_2",
|
|
1941
|
+
toast__list: "_toast__list_xo491_33",
|
|
1942
|
+
toast__announcer: "_toast__announcer_xo491_42 _visually-hidden_gih1f_71",
|
|
1943
|
+
toast: "_toast_xo491_2",
|
|
1944
|
+
"toast-in": "_toast-in_xo491_1",
|
|
1945
|
+
"toast-out": "_toast-out_xo491_1",
|
|
1946
|
+
toast__body: "_toast__body_xo491_60",
|
|
1947
|
+
"toast--info": "_toast--info_xo491_69",
|
|
1948
|
+
"toast--success": "_toast--success_xo491_74",
|
|
1949
|
+
"toast--error": "_toast--error_xo491_79",
|
|
1950
|
+
toast__description: "_toast__description_xo491_91",
|
|
1951
|
+
toast__close: "_toast__close_xo491_96 _interactive_gih1f_10"
|
|
1952
|
+
};
|
|
1953
|
+
var variantClass = {
|
|
1954
|
+
info: Toast_module_default["toast--info"],
|
|
1955
|
+
success: Toast_module_default["toast--success"],
|
|
1956
|
+
error: Toast_module_default["toast--error"]
|
|
1957
|
+
};
|
|
1958
|
+
var AnnounceContext = React.createContext(null);
|
|
1959
|
+
function useAnnounce() {
|
|
1960
|
+
const announce = React.use(AnnounceContext);
|
|
1961
|
+
if (!announce) throw new Error("<Toast> must be rendered inside <ToastViewport>");
|
|
1962
|
+
return announce;
|
|
1963
|
+
}
|
|
1964
|
+
var AnnounceMessageContext = React.createContext(null);
|
|
1965
|
+
function useAnnounceMessage() {
|
|
1966
|
+
const announceMessage = React.use(AnnounceMessageContext);
|
|
1967
|
+
if (!announceMessage) throw new Error("<ToastDescription> must be rendered inside <Toast>");
|
|
1968
|
+
return announceMessage;
|
|
1969
|
+
}
|
|
1970
|
+
/**
|
|
1971
|
+
* Fixed-position stack that holds the app's toasts; render the open toasts as its children.
|
|
1972
|
+
* Mount it before the first toast: its live regions must be in the page before a message arrives.
|
|
1973
|
+
*/
|
|
1974
|
+
function ToastViewport({ label, position = "bottom-right", className, ...props }) {
|
|
1975
|
+
const [announcements, setAnnouncements] = React.useState([]);
|
|
1976
|
+
const announce = React.useCallback((announcement) => {
|
|
1977
|
+
setAnnouncements((current) => [...current, announcement]);
|
|
1978
|
+
return () => setAnnouncements((current) => current.filter((entry) => entry !== announcement));
|
|
1979
|
+
}, []);
|
|
1980
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1981
|
+
role: "region",
|
|
1982
|
+
"aria-label": label,
|
|
1983
|
+
"data-position": position,
|
|
1984
|
+
className: clsx(Toast_module_default["toast__viewport"], className),
|
|
1985
|
+
children: [
|
|
1986
|
+
/* @__PURE__ */ jsx(AnnounceContext, {
|
|
1987
|
+
value: announce,
|
|
1988
|
+
children: /* @__PURE__ */ jsx("ol", {
|
|
1989
|
+
className: Toast_module_default["toast__list"],
|
|
1990
|
+
...props
|
|
1991
|
+
})
|
|
1992
|
+
}),
|
|
1993
|
+
/* @__PURE__ */ jsx(LiveRegion, {
|
|
1994
|
+
role: "status",
|
|
1995
|
+
politeness: "polite",
|
|
1996
|
+
announcements: announcements.filter((entry) => entry.variant !== "error")
|
|
1997
|
+
}),
|
|
1998
|
+
/* @__PURE__ */ jsx(LiveRegion, {
|
|
1999
|
+
role: "alert",
|
|
2000
|
+
politeness: "assertive",
|
|
2001
|
+
announcements: announcements.filter((entry) => entry.variant === "error")
|
|
2002
|
+
})
|
|
2003
|
+
]
|
|
2004
|
+
});
|
|
2005
|
+
}
|
|
2006
|
+
function LiveRegion({ role, politeness, announcements }) {
|
|
2007
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2008
|
+
role,
|
|
2009
|
+
"aria-live": politeness,
|
|
2010
|
+
"aria-atomic": "false",
|
|
2011
|
+
className: Toast_module_default["toast__announcer"],
|
|
2012
|
+
children: announcements.map((entry) => /* @__PURE__ */ jsx("div", { children: entry.message }, entry.id))
|
|
2013
|
+
});
|
|
2014
|
+
}
|
|
2015
|
+
/**
|
|
2016
|
+
* Brief message; the viewport announces the text of its `ToastDescription` when it opens,
|
|
2017
|
+
* an error assertively and every other variant politely.
|
|
2018
|
+
*/
|
|
2019
|
+
function Toast({ variant = "info", open = true, className, children, ...props }) {
|
|
2020
|
+
const announce = useAnnounce();
|
|
2021
|
+
const id = React.useId();
|
|
2022
|
+
const announceMessage = React.useCallback((description) => announce({
|
|
2023
|
+
id,
|
|
2024
|
+
variant,
|
|
2025
|
+
message: description.textContent
|
|
2026
|
+
}), [
|
|
2027
|
+
announce,
|
|
2028
|
+
id,
|
|
2029
|
+
variant
|
|
2030
|
+
]);
|
|
2031
|
+
return /* @__PURE__ */ jsx("li", {
|
|
2032
|
+
"data-variant": variant,
|
|
2033
|
+
className: clsx(Toast_module_default.toast, variantClass[variant], className),
|
|
2034
|
+
...props,
|
|
2035
|
+
"data-state": open ? "open" : "closed",
|
|
2036
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
2037
|
+
className: Toast_module_default["toast__body"],
|
|
2038
|
+
children: /* @__PURE__ */ jsx(AnnounceMessageContext, {
|
|
2039
|
+
value: announceMessage,
|
|
2040
|
+
children
|
|
2041
|
+
})
|
|
2042
|
+
})
|
|
2043
|
+
});
|
|
2044
|
+
}
|
|
2045
|
+
function ToastDescription({ className, ...props }) {
|
|
2046
|
+
const announceMessage = useAnnounceMessage();
|
|
2047
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2048
|
+
ref: announceMessage,
|
|
2049
|
+
className: clsx(Toast_module_default["toast__description"], className),
|
|
2050
|
+
...props
|
|
2051
|
+
});
|
|
2052
|
+
}
|
|
2053
|
+
function ToastClose({ className, ...props }) {
|
|
2054
|
+
return /* @__PURE__ */ jsx("button", {
|
|
2055
|
+
type: "button",
|
|
2056
|
+
className: clsx(Toast_module_default["toast__close"], className),
|
|
2057
|
+
...props
|
|
2058
|
+
});
|
|
2059
|
+
}
|
|
2060
|
+
export { Alert, AlertDescription, AlertTitle, Badge, Button, Checkbox, ControlRow, CopyValueButton, DateField, DateRangeField, DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuPortal, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, HelpIcon, InputGroup, InputGroupPrefix, Label, Link, NativeSelect, NativeSelectOption, Pagination, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, SearchInput, Skeleton, StatusScreen, StatusScreenActions, StatusScreenDescription, StatusScreenIcon, StatusScreenTitle, Switch, Table, TableBody, TableCell, TableHeadCell, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Toast, ToastClose, ToastDescription, ToastViewport, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger };
|