@amberstack/comp-lib 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 +21 -0
- package/README.md +68 -2
- package/dist/amberstack.css +2 -0
- package/dist/components/Accordion/Accordion.d.ts +18 -0
- package/dist/components/Accordion/AccordionContext.d.ts +10 -0
- package/dist/components/Accordion/AccordionItem.d.ts +11 -0
- package/dist/components/Accordion/index.d.ts +2 -0
- package/dist/components/ActivityItem/ActivityItem.d.ts +15 -0
- package/dist/components/ActivityItem/index.d.ts +1 -0
- package/dist/components/AreaChart/AreaChart.d.ts +4 -0
- package/dist/components/AreaChart/index.d.ts +1 -0
- package/dist/components/AssetField/AssetField.d.ts +26 -0
- package/dist/components/AssetField/index.d.ts +1 -0
- package/dist/components/Avatar/Avatar.d.ts +19 -0
- package/dist/components/Avatar/AvatarContext.d.ts +3 -0
- package/dist/components/Avatar/AvatarGroup.d.ts +12 -0
- package/dist/components/Avatar/index.d.ts +2 -0
- package/dist/components/Banner/Banner.d.ts +18 -0
- package/dist/components/Banner/index.d.ts +1 -0
- package/dist/components/BarChart/BarChart.d.ts +25 -0
- package/dist/components/BarChart/index.d.ts +1 -0
- package/dist/components/BlockHeader/BlockHeader.d.ts +22 -0
- package/dist/components/BlockHeader/index.d.ts +1 -0
- package/dist/components/Breadcrumb/Breadcrumb.d.ts +9 -0
- package/dist/components/Breadcrumb/BreadcrumbItem.d.ts +11 -0
- package/dist/components/Breadcrumb/index.d.ts +2 -0
- package/dist/components/Button/Button.d.ts +16 -0
- package/dist/components/Button/index.d.ts +1 -0
- package/dist/components/Calendar/Calendar.d.ts +49 -0
- package/dist/components/Calendar/CalendarDay.d.ts +25 -0
- package/dist/components/Calendar/CalendarHeader.d.ts +27 -0
- package/dist/components/Calendar/DateTriggerInternal.d.ts +30 -0
- package/dist/components/Calendar/dateUtils.d.ts +95 -0
- package/dist/components/Calendar/index.d.ts +4 -0
- package/dist/components/Calendar/useDatePopup.d.ts +22 -0
- package/dist/components/Card/Card.d.ts +10 -0
- package/dist/components/Card/CardFooter.d.ts +8 -0
- package/dist/components/Card/CardHeader.d.ts +14 -0
- package/dist/components/Card/index.d.ts +3 -0
- package/dist/components/CatalogCard/CatalogCard.d.ts +18 -0
- package/dist/components/CatalogCard/index.d.ts +1 -0
- package/dist/components/ChartCard/ChartCard.d.ts +30 -0
- package/dist/components/ChartCard/index.d.ts +1 -0
- package/dist/components/ChartCore/ChartAxes.d.ts +24 -0
- package/dist/components/ChartCore/ChartDataTable.d.ts +19 -0
- package/dist/components/ChartCore/ChartFrame.d.ts +11 -0
- package/dist/components/ChartCore/ChartHoverLayer.d.ts +21 -0
- package/dist/components/ChartCore/chartPlayHelpers.d.ts +11 -0
- package/dist/components/ChartCore/index.d.ts +10 -0
- package/dist/components/ChartCore/paths.d.ts +23 -0
- package/dist/components/ChartCore/scales.d.ts +40 -0
- package/dist/components/ChartCore/series.d.ts +4 -0
- package/dist/components/ChartCore/types.d.ts +38 -0
- package/dist/components/ChartCore/useChartHover.d.ts +25 -0
- package/dist/components/ChartCore/useChartSize.d.ts +6 -0
- package/dist/components/ChartLegend/ChartLegend.d.ts +20 -0
- package/dist/components/ChartLegend/ChartLegendItem.d.ts +19 -0
- package/dist/components/ChartLegend/index.d.ts +4 -0
- package/dist/components/ChartLegend/legendHelpers.d.ts +20 -0
- package/dist/components/ChartLegend/useLegendState.d.ts +10 -0
- package/dist/components/ChartTooltip/ChartTooltip.d.ts +20 -0
- package/dist/components/ChartTooltip/index.d.ts +1 -0
- package/dist/components/Checkbox/Checkbox.d.ts +11 -0
- package/dist/components/Checkbox/index.d.ts +1 -0
- package/dist/components/ChecklistItem/ChecklistItem.d.ts +14 -0
- package/dist/components/ChecklistItem/index.d.ts +1 -0
- package/dist/components/CommandPalette/CommandPalette.d.ts +32 -0
- package/dist/components/CommandPalette/CommandPaletteItem.d.ts +14 -0
- package/dist/components/CommandPalette/index.d.ts +2 -0
- package/dist/components/ConfirmDialog/ConfirmDialog.d.ts +27 -0
- package/dist/components/ConfirmDialog/index.d.ts +1 -0
- package/dist/components/ContentRow/ContentRow.d.ts +20 -0
- package/dist/components/ContentRow/index.d.ts +1 -0
- package/dist/components/CredentialRow/CredentialRow.d.ts +18 -0
- package/dist/components/CredentialRow/index.d.ts +1 -0
- package/dist/components/DataTable/DataTable.d.ts +115 -0
- package/dist/components/DataTable/index.d.ts +1 -0
- package/dist/components/DataTable/useControllable.d.ts +2 -0
- package/dist/components/DateField/DateField.d.ts +4 -0
- package/dist/components/DateField/index.d.ts +1 -0
- package/dist/components/DatePicker/DatePicker.d.ts +42 -0
- package/dist/components/DatePicker/index.d.ts +1 -0
- package/dist/components/DateRangePicker/DateRangePicker.d.ts +87 -0
- package/dist/components/DateRangePicker/DateRangePresets.d.ts +24 -0
- package/dist/components/DateRangePicker/DateRangeTrigger.d.ts +10 -0
- package/dist/components/DateRangePicker/index.d.ts +3 -0
- package/dist/components/Dialog/Dialog.d.ts +23 -0
- package/dist/components/Dialog/DialogBody.d.ts +4 -0
- package/dist/components/Dialog/DialogFooter.d.ts +4 -0
- package/dist/components/Dialog/DialogHeader.d.ts +15 -0
- package/dist/components/Dialog/dialogContext.d.ts +23 -0
- package/dist/components/Dialog/index.d.ts +5 -0
- package/dist/components/Dialog/useModalBehaviour.d.ts +27 -0
- package/dist/components/Divider/Divider.d.ts +10 -0
- package/dist/components/Divider/index.d.ts +1 -0
- package/dist/components/DonutChart/DonutChart.d.ts +20 -0
- package/dist/components/DonutChart/index.d.ts +1 -0
- package/dist/components/Drawer/Drawer.d.ts +21 -0
- package/dist/components/Drawer/index.d.ts +1 -0
- package/dist/components/DropdownMenu/DropdownMenu.d.ts +32 -0
- package/dist/components/DropdownMenu/DropdownMenuCheckboxItem.d.ts +13 -0
- package/dist/components/DropdownMenu/DropdownMenuContext.d.ts +5 -0
- package/dist/components/DropdownMenu/DropdownMenuItem.d.ts +16 -0
- package/dist/components/DropdownMenu/DropdownMenuLabel.d.ts +4 -0
- package/dist/components/DropdownMenu/DropdownMenuSeparator.d.ts +4 -0
- package/dist/components/DropdownMenu/index.d.ts +5 -0
- package/dist/components/EmptyState/EmptyState.d.ts +14 -0
- package/dist/components/EmptyState/index.d.ts +1 -0
- package/dist/components/EnvironmentLabel/EnvironmentLabel.d.ts +10 -0
- package/dist/components/EnvironmentLabel/index.d.ts +1 -0
- package/dist/components/Field/Field.d.ts +26 -0
- package/dist/components/Field/FieldContext.d.ts +17 -0
- package/dist/components/Field/index.d.ts +2 -0
- package/dist/components/Field/useFieldControl.d.ts +34 -0
- package/dist/components/Filters/FilterBar.d.ts +9 -0
- package/dist/components/Filters/FilterChip.d.ts +18 -0
- package/dist/components/Filters/FilterMenu.d.ts +37 -0
- package/dist/components/Filters/index.d.ts +3 -0
- package/dist/components/IconButton/IconButton.d.ts +16 -0
- package/dist/components/IconButton/index.d.ts +1 -0
- package/dist/components/Input/Input.d.ts +14 -0
- package/dist/components/Input/LockedTagInternal.d.ts +2 -0
- package/dist/components/Input/index.d.ts +1 -0
- package/dist/components/KPI/KPI.d.ts +24 -0
- package/dist/components/KPI/index.d.ts +1 -0
- package/dist/components/KPIGraph/KPIGraph.d.ts +12 -0
- package/dist/components/KPIGraph/index.d.ts +1 -0
- package/dist/components/Kbd/Kbd.d.ts +4 -0
- package/dist/components/Kbd/index.d.ts +1 -0
- package/dist/components/Label/Label.d.ts +14 -0
- package/dist/components/Label/index.d.ts +1 -0
- package/dist/components/LineChart/LineChart.d.ts +4 -0
- package/dist/components/LineChart/SeriesChartInternal.d.ts +30 -0
- package/dist/components/LineChart/index.d.ts +2 -0
- package/dist/components/Link/Link.d.ts +20 -0
- package/dist/components/Link/index.d.ts +1 -0
- package/dist/components/MediaTile/MediaTile.d.ts +13 -0
- package/dist/components/MediaTile/index.d.ts +1 -0
- package/dist/components/Menu/Menu.d.ts +7 -0
- package/dist/components/Menu/MenuItem.d.ts +20 -0
- package/dist/components/Menu/index.d.ts +3 -0
- package/dist/components/Menu/usePopup.d.ts +46 -0
- package/dist/components/MetricCard/MetricCard.d.ts +26 -0
- package/dist/components/MetricCard/index.d.ts +1 -0
- package/dist/components/MultiSelect/MultiSelect.d.ts +42 -0
- package/dist/components/MultiSelect/index.d.ts +1 -0
- package/dist/components/NavGroup/NavGroup.d.ts +17 -0
- package/dist/components/NavGroup/index.d.ts +1 -0
- package/dist/components/NavItem/NavItem.d.ts +28 -0
- package/dist/components/NavItem/index.d.ts +1 -0
- package/dist/components/NodeGraph/GraphNode.d.ts +15 -0
- package/dist/components/NodeGraph/NodeGraph.d.ts +34 -0
- package/dist/components/NodeGraph/index.d.ts +2 -0
- package/dist/components/NodeReference/NodeReference.d.ts +12 -0
- package/dist/components/NodeReference/index.d.ts +1 -0
- package/dist/components/NumberField/NumberField.d.ts +28 -0
- package/dist/components/NumberField/index.d.ts +1 -0
- package/dist/components/PageHeader/PageHeader.d.ts +20 -0
- package/dist/components/PageHeader/index.d.ts +1 -0
- package/dist/components/Pagination/Pagination.d.ts +21 -0
- package/dist/components/Pagination/index.d.ts +1 -0
- package/dist/components/PickerItem/PickerItem.d.ts +14 -0
- package/dist/components/PickerItem/index.d.ts +1 -0
- package/dist/components/Popover/Popover.d.ts +24 -0
- package/dist/components/Popover/index.d.ts +1 -0
- package/dist/components/ProgressBar/ProgressBar.d.ts +16 -0
- package/dist/components/ProgressBar/index.d.ts +1 -0
- package/dist/components/ProposedNote/ProposedNote.d.ts +9 -0
- package/dist/components/ProposedNote/index.d.ts +1 -0
- package/dist/components/Radio/Radio.d.ts +11 -0
- package/dist/components/Radio/RadioGroup.d.ts +22 -0
- package/dist/components/Radio/RadioGroupContext.d.ts +11 -0
- package/dist/components/Radio/index.d.ts +2 -0
- package/dist/components/RangeTabs/RangeTabs.d.ts +21 -0
- package/dist/components/RangeTabs/Segment.d.ts +7 -0
- package/dist/components/RangeTabs/index.d.ts +2 -0
- package/dist/components/ResourceCard/ResourceCard.d.ts +29 -0
- package/dist/components/ResourceCard/index.d.ts +1 -0
- package/dist/components/RichTextField/RichTextField.d.ts +26 -0
- package/dist/components/RichTextField/RichTextTool.d.ts +9 -0
- package/dist/components/RichTextField/RichTextToolbar.d.ts +12 -0
- package/dist/components/RichTextField/index.d.ts +4 -0
- package/dist/components/RichTextField/richTextCommands.d.ts +18 -0
- package/dist/components/ScatterPlot/ScatterPlot.d.ts +41 -0
- package/dist/components/ScatterPlot/index.d.ts +1 -0
- package/dist/components/Search/Search.d.ts +15 -0
- package/dist/components/Search/index.d.ts +1 -0
- package/dist/components/Select/Select.d.ts +38 -0
- package/dist/components/Select/index.d.ts +1 -0
- package/dist/components/Select/useListbox.d.ts +38 -0
- package/dist/components/SetupStep/SetupStep.d.ts +18 -0
- package/dist/components/SetupStep/index.d.ts +1 -0
- package/dist/components/Sidebar/Sidebar.d.ts +17 -0
- package/dist/components/Sidebar/SidebarBrand.d.ts +11 -0
- package/dist/components/Sidebar/SidebarUser.d.ts +13 -0
- package/dist/components/Sidebar/index.d.ts +3 -0
- package/dist/components/Skeleton/Skeleton.d.ts +12 -0
- package/dist/components/Skeleton/index.d.ts +1 -0
- package/dist/components/SortableRow/SortableRow.d.ts +24 -0
- package/dist/components/SortableRow/index.d.ts +1 -0
- package/dist/components/Sparkline/Sparkline.d.ts +18 -0
- package/dist/components/Sparkline/index.d.ts +1 -0
- package/dist/components/Spinner/Spinner.d.ts +10 -0
- package/dist/components/Spinner/index.d.ts +1 -0
- package/dist/components/Status/Status.d.ts +8 -0
- package/dist/components/Status/index.d.ts +1 -0
- package/dist/components/StatusIcon/StatusIcon.d.ts +13 -0
- package/dist/components/StatusIcon/index.d.ts +1 -0
- package/dist/components/Stepper/Step.d.ts +19 -0
- package/dist/components/Stepper/Stepper.d.ts +28 -0
- package/dist/components/Stepper/index.d.ts +2 -0
- package/dist/components/SwitchField/SwitchField.d.ts +10 -0
- package/dist/components/SwitchField/index.d.ts +1 -0
- package/dist/components/Table/Table.d.ts +9 -0
- package/dist/components/Table/TableCell.d.ts +10 -0
- package/dist/components/Table/TableCellActions.d.ts +11 -0
- package/dist/components/Table/TableCellCheckbox.d.ts +7 -0
- package/dist/components/Table/TableCellNumber.d.ts +11 -0
- package/dist/components/Table/TableCellStatus.d.ts +4 -0
- package/dist/components/Table/TableCellText.d.ts +7 -0
- package/dist/components/Table/TableCellTwoLine.d.ts +9 -0
- package/dist/components/Table/TableCellUser.d.ts +11 -0
- package/dist/components/Table/TableContext.d.ts +3 -0
- package/dist/components/Table/TableFooter.d.ts +9 -0
- package/dist/components/Table/TableHeaderCell.d.ts +17 -0
- package/dist/components/Table/TableHeaderRow.d.ts +4 -0
- package/dist/components/Table/TableRow.d.ts +7 -0
- package/dist/components/Table/TableToolbar.d.ts +13 -0
- package/dist/components/Table/index.d.ts +14 -0
- package/dist/components/Table/storyHelpers.d.ts +12 -0
- package/dist/components/Tabs/Tab.d.ts +9 -0
- package/dist/components/Tabs/TabList.d.ts +4 -0
- package/dist/components/Tabs/TabPanel.d.ts +7 -0
- package/dist/components/Tabs/Tabs.d.ts +11 -0
- package/dist/components/Tabs/TabsContext.d.ts +12 -0
- package/dist/components/Tabs/index.d.ts +4 -0
- package/dist/components/Textarea/Textarea.d.ts +9 -0
- package/dist/components/Textarea/index.d.ts +1 -0
- package/dist/components/Toast/Toast.d.ts +23 -0
- package/dist/components/Toast/ToastProvider.d.ts +12 -0
- package/dist/components/Toast/ToastStack.d.ts +11 -0
- package/dist/components/Toast/index.d.ts +4 -0
- package/dist/components/Toast/useToast.d.ts +25 -0
- package/dist/components/Toggle/Toggle.d.ts +14 -0
- package/dist/components/Toggle/index.d.ts +1 -0
- package/dist/components/Tooltip/Tooltip.d.ts +17 -0
- package/dist/components/Tooltip/index.d.ts +1 -0
- package/dist/components/Tooltip/useAnchoredPosition.d.ts +13 -0
- package/dist/components/TopBar/ContextSwitcher.d.ts +10 -0
- package/dist/components/TopBar/TopBar.d.ts +9 -0
- package/dist/components/TopBar/TopBarSeparator.d.ts +4 -0
- package/dist/components/TopBar/index.d.ts +3 -0
- package/dist/components/UnavailableState/UnavailableState.d.ts +18 -0
- package/dist/components/UnavailableState/index.d.ts +1 -0
- package/dist/icons/index.d.ts +57 -0
- package/dist/index.d.ts +86 -0
- package/dist/index.js +6774 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/cx.d.ts +2 -0
- package/package.json +87 -4
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type HTMLAttributes } from 'react';
|
|
2
|
+
import { type ChartLegendEntry } from './legendHelpers';
|
|
3
|
+
export interface ChartLegendProps extends HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
/** The series, in chart order. Past five, the rest fold into Other. */
|
|
5
|
+
items: ChartLegendEntry[];
|
|
6
|
+
/** Hidden series ids, when controlled. */
|
|
7
|
+
hiddenIds?: string[];
|
|
8
|
+
/** Hidden series ids at first, when uncontrolled. */
|
|
9
|
+
defaultHiddenIds?: string[];
|
|
10
|
+
/** Called with the new hidden ids. */
|
|
11
|
+
onHiddenChange?: (hiddenIds: string[]) => void;
|
|
12
|
+
/** Whether chips can hide and isolate series. Turn off to only name them. */
|
|
13
|
+
interactive?: boolean;
|
|
14
|
+
/** Name of the chip that gathers the series past five. */
|
|
15
|
+
otherLabel?: string;
|
|
16
|
+
/** Accessible name of the group. */
|
|
17
|
+
'aria-label'?: string;
|
|
18
|
+
}
|
|
19
|
+
/** Row of series chips. Click a chip to hide its series, or "Only" to isolate it. Colour follows the series, so hiding one never repaints the others. */
|
|
20
|
+
export declare const ChartLegend: import("react").ForwardRefExoticComponent<ChartLegendProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type HTMLAttributes } from 'react';
|
|
2
|
+
export interface ChartLegendItemProps extends HTMLAttributes<HTMLSpanElement> {
|
|
3
|
+
/** Series name. */
|
|
4
|
+
label: string;
|
|
5
|
+
/** Position of the series, which sets the swatch colour. It stays the same while other series are hidden. */
|
|
6
|
+
colorIndex?: number;
|
|
7
|
+
/** Whether the series is hidden: the swatch becomes a hollow ring and the text recedes. */
|
|
8
|
+
seriesHidden?: boolean;
|
|
9
|
+
/** Whether this is the only series showing. */
|
|
10
|
+
isolated?: boolean;
|
|
11
|
+
/** Called when the chip is clicked. Without it, the chip only names the series. */
|
|
12
|
+
onToggle?: () => void;
|
|
13
|
+
/** Called when "Only" is clicked. Without it, there is no "Only" button. */
|
|
14
|
+
onOnly?: () => void;
|
|
15
|
+
/** Word on the isolate button. */
|
|
16
|
+
onlyLabel?: string;
|
|
17
|
+
}
|
|
18
|
+
/** Names a series. With `onToggle` it is a chip that shows or hides the series, and with `onOnly` it can isolate it. */
|
|
19
|
+
export declare const ChartLegendItem: import("react").ForwardRefExoticComponent<ChartLegendItemProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** A series as the legend sees it. */
|
|
2
|
+
export interface ChartLegendEntry {
|
|
3
|
+
/** Stable identifier, matching the series. */
|
|
4
|
+
id: string;
|
|
5
|
+
/** Series name. */
|
|
6
|
+
label: string;
|
|
7
|
+
}
|
|
8
|
+
/** A chip in the legend. Other stands in for several series. */
|
|
9
|
+
export interface LegendChip extends ChartLegendEntry {
|
|
10
|
+
/** The series this chip controls. */
|
|
11
|
+
memberIds: string[];
|
|
12
|
+
/** Position of the chip, which sets its colour. */
|
|
13
|
+
colorIndex: number;
|
|
14
|
+
}
|
|
15
|
+
/** Turns series into chips, folding the rest into Other when there are more than five. */
|
|
16
|
+
export declare function legendChips(items: ChartLegendEntry[], otherLabel?: string): LegendChip[];
|
|
17
|
+
/** Hidden ids after clicking a chip. Clicking the only series still showing brings all of them back, so a chart is never left blank. */
|
|
18
|
+
export declare function toggleHidden(allIds: string[], hidden: string[], memberIds: string[]): string[];
|
|
19
|
+
/** Hidden ids after clicking "Only". Clicking it again on the isolated series brings all of them back. */
|
|
20
|
+
export declare function isolateHidden(allIds: string[], hidden: string[], memberIds: string[]): string[];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface UseLegendStateOptions {
|
|
2
|
+
/** Hidden series ids, when controlled. */
|
|
3
|
+
hiddenIds?: string[];
|
|
4
|
+
/** Hidden series ids at first, when uncontrolled. */
|
|
5
|
+
defaultHiddenIds?: string[];
|
|
6
|
+
/** Called with the new hidden ids. */
|
|
7
|
+
onHiddenChange?: (hiddenIds: string[]) => void;
|
|
8
|
+
}
|
|
9
|
+
/** Controlled or uncontrolled record of which series are hidden. */
|
|
10
|
+
export declare function useLegendState({ hiddenIds, defaultHiddenIds, onHiddenChange }: UseLegendStateOptions): readonly [string[], (next: string[]) => void];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactNode } from 'react';
|
|
2
|
+
/** One line of a chart tooltip. */
|
|
3
|
+
export interface ChartTooltipRow {
|
|
4
|
+
/** Stable identifier. */
|
|
5
|
+
id: string;
|
|
6
|
+
/** Series name. */
|
|
7
|
+
name: string;
|
|
8
|
+
/** Formatted value. */
|
|
9
|
+
value: string;
|
|
10
|
+
/** Position of the series, which sets the swatch colour. Defaults to the row's position. */
|
|
11
|
+
colorIndex?: number;
|
|
12
|
+
}
|
|
13
|
+
export interface ChartTooltipProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
14
|
+
/** What the values belong to, such as a date or category. */
|
|
15
|
+
title: ReactNode;
|
|
16
|
+
/** One row per visible series. */
|
|
17
|
+
rows: ChartTooltipRow[];
|
|
18
|
+
}
|
|
19
|
+
/** Exact values for one point across the visible series. The value is the strong element, and text stays in text tokens. */
|
|
20
|
+
export declare const ChartTooltip: import("react").ForwardRefExoticComponent<ChartTooltipProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ChartTooltip';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type InputHTMLAttributes, type ReactNode } from 'react';
|
|
2
|
+
export interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type'> {
|
|
3
|
+
/** The visible label. Leave it out for a bare box, and give the box an `aria-label`. */
|
|
4
|
+
label?: ReactNode;
|
|
5
|
+
/** Longer text below the label. */
|
|
6
|
+
description?: ReactNode;
|
|
7
|
+
/** Shows the mixed state, for a parent whose children are only partly selected. */
|
|
8
|
+
indeterminate?: boolean;
|
|
9
|
+
}
|
|
10
|
+
/** Selects any number of options, applied on save. Built on a native checkbox. */
|
|
11
|
+
export declare const Checkbox: import("react").ForwardRefExoticComponent<CheckboxProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Checkbox';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactNode } from 'react';
|
|
2
|
+
export type ChecklistItemResult = 'pass' | 'fail' | 'warn' | 'pending';
|
|
3
|
+
export interface ChecklistItemProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
4
|
+
/** The outcome of the check. */
|
|
5
|
+
result?: ChecklistItemResult;
|
|
6
|
+
/** What is being checked. */
|
|
7
|
+
title: ReactNode;
|
|
8
|
+
/** More about the check. */
|
|
9
|
+
detail?: ReactNode;
|
|
10
|
+
/** The outcome in words. Defaults to Passed, Blocked, Review or Checking. */
|
|
11
|
+
resultLabel?: ReactNode;
|
|
12
|
+
}
|
|
13
|
+
/** One check in a list, with its outcome as an icon and text. */
|
|
14
|
+
export declare const ChecklistItem: import("react").ForwardRefExoticComponent<ChecklistItemProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ChecklistItem';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type HTMLAttributes } from 'react';
|
|
2
|
+
import { type IconName } from '../../icons';
|
|
3
|
+
export interface CommandPaletteCommand {
|
|
4
|
+
/** Unique id. */
|
|
5
|
+
id: string;
|
|
6
|
+
/** What the command does. Searched against the query. */
|
|
7
|
+
label: string;
|
|
8
|
+
/** Heading the command is listed under. Commands without one go in an unnamed group. */
|
|
9
|
+
group?: string;
|
|
10
|
+
/** Icon before the label. */
|
|
11
|
+
icon?: IconName;
|
|
12
|
+
}
|
|
13
|
+
export interface CommandPaletteProps extends Omit<HTMLAttributes<HTMLDivElement>, 'role'> {
|
|
14
|
+
/** Whether the palette is showing. Leave undefined to use `defaultOpen` and let the palette manage itself. */
|
|
15
|
+
open?: boolean;
|
|
16
|
+
/** Initial open state when uncontrolled. */
|
|
17
|
+
defaultOpen?: boolean;
|
|
18
|
+
/** Called when the palette closes, whether from Escape, a backdrop press or a command running. */
|
|
19
|
+
onClose?: () => void;
|
|
20
|
+
/** The commands to search. */
|
|
21
|
+
commands: readonly CommandPaletteCommand[];
|
|
22
|
+
/** Called with the command the user runs. */
|
|
23
|
+
onRun?: (command: CommandPaletteCommand) => void;
|
|
24
|
+
/** Placeholder and accessible name of the search input. */
|
|
25
|
+
searchLabel?: string;
|
|
26
|
+
/** Accessible name of the results list. */
|
|
27
|
+
resultsLabel?: string;
|
|
28
|
+
/** Shown when nothing matches. */
|
|
29
|
+
emptyMessage?: string;
|
|
30
|
+
}
|
|
31
|
+
/** A searchable list of commands in a Dialog. Arrow keys move the highlight, Enter runs it and Escape closes the palette. */
|
|
32
|
+
export declare const CommandPalette: import("react").ForwardRefExoticComponent<CommandPaletteProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type HTMLAttributes } from 'react';
|
|
2
|
+
import { type IconName } from '../../icons';
|
|
3
|
+
export interface CommandPaletteItemProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onSelect'> {
|
|
4
|
+
/** What the command does. */
|
|
5
|
+
label: string;
|
|
6
|
+
/** Icon before the label. */
|
|
7
|
+
icon?: IconName;
|
|
8
|
+
/** Whether this option has the keyboard highlight. */
|
|
9
|
+
active?: boolean;
|
|
10
|
+
/** Called when the option is pressed. */
|
|
11
|
+
onSelect?: () => void;
|
|
12
|
+
}
|
|
13
|
+
/** One option in a CommandPalette. Must sit inside an element with `role="listbox"` or `role="group"`. */
|
|
14
|
+
export declare const CommandPaletteItem: import("react").ForwardRefExoticComponent<CommandPaletteItemProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactNode } from 'react';
|
|
2
|
+
import { type DialogSize } from '../Dialog';
|
|
3
|
+
export type ConfirmDialogTone = 'default' | 'danger';
|
|
4
|
+
export interface ConfirmDialogProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title' | 'role'> {
|
|
5
|
+
/** Whether the dialog is showing. Leave undefined to use `defaultOpen` and let the dialog manage itself. */
|
|
6
|
+
open?: boolean;
|
|
7
|
+
/** Initial open state when uncontrolled. */
|
|
8
|
+
defaultOpen?: boolean;
|
|
9
|
+
/** The question being asked. */
|
|
10
|
+
title: ReactNode;
|
|
11
|
+
/** What happens if the user confirms. */
|
|
12
|
+
description?: ReactNode;
|
|
13
|
+
/** Label of the confirm button. */
|
|
14
|
+
confirmLabel?: string;
|
|
15
|
+
/** Label of the cancel button. */
|
|
16
|
+
cancelLabel?: string;
|
|
17
|
+
/** `danger` is for destructive actions: the confirm button turns red and focus starts on cancel. */
|
|
18
|
+
tone?: ConfirmDialogTone;
|
|
19
|
+
/** Called when the user confirms. */
|
|
20
|
+
onConfirm?: () => void;
|
|
21
|
+
/** Called when the user cancels, including with Escape or a backdrop press. */
|
|
22
|
+
onCancel?: () => void;
|
|
23
|
+
/** Panel width. */
|
|
24
|
+
size?: DialogSize;
|
|
25
|
+
}
|
|
26
|
+
/** Asks the user to confirm or cancel an action. Built on Dialog with the `alertdialog` role. */
|
|
27
|
+
export declare const ConfirmDialog: import("react").ForwardRefExoticComponent<ConfirmDialogProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ConfirmDialog';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactNode } from 'react';
|
|
2
|
+
import { type StatusTone } from '../Status';
|
|
3
|
+
export interface ContentRowProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
4
|
+
/** The name of the content. */
|
|
5
|
+
title: ReactNode;
|
|
6
|
+
/** A quieter line below the name, such as its path. */
|
|
7
|
+
subtitle?: ReactNode;
|
|
8
|
+
/** The kind of content. */
|
|
9
|
+
type?: ReactNode;
|
|
10
|
+
/** Short tags, such as languages. */
|
|
11
|
+
tags?: ReactNode;
|
|
12
|
+
/** Tone of the status dot. */
|
|
13
|
+
statusTone?: StatusTone;
|
|
14
|
+
/** The status text. */
|
|
15
|
+
statusLabel?: ReactNode;
|
|
16
|
+
/** When it last changed. */
|
|
17
|
+
updated?: ReactNode;
|
|
18
|
+
}
|
|
19
|
+
/** One item in a list of content. */
|
|
20
|
+
export declare const ContentRow: import("react").ForwardRefExoticComponent<ContentRowProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ContentRow';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactNode } from 'react';
|
|
2
|
+
import { type IconName } from '../../icons';
|
|
3
|
+
export interface CredentialRowProps extends HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
/** The name of the credential. */
|
|
5
|
+
name: ReactNode;
|
|
6
|
+
/** Where it is stored. Never put the secret itself here. */
|
|
7
|
+
reference?: ReactNode;
|
|
8
|
+
/** Icon at the left. */
|
|
9
|
+
icon?: IconName;
|
|
10
|
+
/** The state of the value, such as `Value hidden`. */
|
|
11
|
+
valueState?: ReactNode;
|
|
12
|
+
/** A short fact, such as when it was last rotated. */
|
|
13
|
+
meta?: ReactNode;
|
|
14
|
+
/** The control at the right, normally a ghost Button. */
|
|
15
|
+
action?: ReactNode;
|
|
16
|
+
}
|
|
17
|
+
/** One stored credential, showing where it is kept and never its value. */
|
|
18
|
+
export declare const CredentialRow: import("react").ForwardRefExoticComponent<CredentialRowProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './CredentialRow';
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactElement, type ReactNode, type RefAttributes } from 'react';
|
|
2
|
+
import { type FilterOption } from '../Filters';
|
|
3
|
+
import { type TableCellAlign, type TableDensity } from '../Table';
|
|
4
|
+
export type DataTableSortDirection = 'ascending' | 'descending';
|
|
5
|
+
export interface DataTableSort {
|
|
6
|
+
/** The `id` of the sorted column. */
|
|
7
|
+
columnId: string;
|
|
8
|
+
/** The direction. */
|
|
9
|
+
direction: DataTableSortDirection;
|
|
10
|
+
}
|
|
11
|
+
/** The chosen values of each filter, by filter `id`. */
|
|
12
|
+
export type DataTableFilterValues = Record<string, string[]>;
|
|
13
|
+
export interface DataTableColumn<T> {
|
|
14
|
+
/** Unique within the table. */
|
|
15
|
+
id: string;
|
|
16
|
+
/** The column heading. */
|
|
17
|
+
header: ReactNode;
|
|
18
|
+
/** Renders the content of a cell. */
|
|
19
|
+
cell: (row: T) => ReactNode;
|
|
20
|
+
/** Lets the person sort by this column. Requires `sortAccessor`. */
|
|
21
|
+
sortable?: boolean;
|
|
22
|
+
/** The value to sort by. Numbers sort numerically, and strings by natural order. It also feeds the default search. */
|
|
23
|
+
sortAccessor?: (row: T) => string | number;
|
|
24
|
+
/** Column width, in pixels or any CSS length. */
|
|
25
|
+
width?: number | string;
|
|
26
|
+
/** Horizontal alignment of the heading and cells. */
|
|
27
|
+
align?: TableCellAlign;
|
|
28
|
+
/** Keeps the heading for assistive technology only, for a column such as row actions. */
|
|
29
|
+
hideHeader?: boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface DataTableFilter<T> {
|
|
32
|
+
/** Unique within the table. */
|
|
33
|
+
id: string;
|
|
34
|
+
/** The name of the filter, such as `Status`. */
|
|
35
|
+
label: string;
|
|
36
|
+
/** The value of a row for this filter. */
|
|
37
|
+
accessor: (row: T) => string;
|
|
38
|
+
/** The options to offer. Defaults to the values found in `rows`. Counts default to the matching rows. */
|
|
39
|
+
options?: FilterOption[];
|
|
40
|
+
}
|
|
41
|
+
export interface DataTableProps<T> extends Omit<HTMLAttributes<HTMLElement>, 'title' | 'children'> {
|
|
42
|
+
/** The columns, in order. */
|
|
43
|
+
columns: DataTableColumn<T>[];
|
|
44
|
+
/** All of the rows. Sorting, filtering, search and pagination happen here, on the client. */
|
|
45
|
+
rows: T[];
|
|
46
|
+
/** A stable, unique ID for a row. */
|
|
47
|
+
getRowId: (row: T) => string;
|
|
48
|
+
/** Text naming the row, used for the accessible name of its checkbox. Defaults to its ID. */
|
|
49
|
+
getRowLabel?: (row: T) => string;
|
|
50
|
+
/** The heading in the toolbar, which also names the table. */
|
|
51
|
+
title?: ReactNode;
|
|
52
|
+
/** What the rows are, in the plural, such as `projects`. Used in default messages. */
|
|
53
|
+
itemLabel?: string;
|
|
54
|
+
/** Row height. */
|
|
55
|
+
density?: TableDensity;
|
|
56
|
+
/** The sort, when controlled. Use `null` for no sort. */
|
|
57
|
+
sort?: DataTableSort | null;
|
|
58
|
+
/** The first sort, when uncontrolled. */
|
|
59
|
+
defaultSort?: DataTableSort | null;
|
|
60
|
+
/** Called when the sort changes. */
|
|
61
|
+
onSortChange?: (sort: DataTableSort | null) => void;
|
|
62
|
+
/** The filters on offer. */
|
|
63
|
+
filters?: DataTableFilter<T>[];
|
|
64
|
+
/** The chosen filter values, when controlled. */
|
|
65
|
+
filterValues?: DataTableFilterValues;
|
|
66
|
+
/** The first chosen filter values, when uncontrolled. */
|
|
67
|
+
defaultFilterValues?: DataTableFilterValues;
|
|
68
|
+
/** Called when the chosen filter values change. */
|
|
69
|
+
onFilterValuesChange?: (values: DataTableFilterValues) => void;
|
|
70
|
+
/** Shows the search box. */
|
|
71
|
+
searchable?: boolean;
|
|
72
|
+
/** The search text, when controlled. */
|
|
73
|
+
search?: string;
|
|
74
|
+
/** The first search text, when uncontrolled. */
|
|
75
|
+
defaultSearch?: string;
|
|
76
|
+
/** Called when the search text changes. */
|
|
77
|
+
onSearchChange?: (search: string) => void;
|
|
78
|
+
/** The text a row is searched by. Defaults to the sort values of its columns. */
|
|
79
|
+
getSearchText?: (row: T) => string;
|
|
80
|
+
/** Placeholder and accessible name of the search box. Defaults to one built from `itemLabel`. */
|
|
81
|
+
searchPlaceholder?: string;
|
|
82
|
+
/** The one-based page, when controlled. */
|
|
83
|
+
page?: number;
|
|
84
|
+
/** The first one-based page, when uncontrolled. */
|
|
85
|
+
defaultPage?: number;
|
|
86
|
+
/** Called when the page changes. */
|
|
87
|
+
onPageChange?: (page: number) => void;
|
|
88
|
+
/** How many rows a page holds. */
|
|
89
|
+
pageSize?: number;
|
|
90
|
+
/** Adds a checkbox to each row. The header checkbox selects every row on the current page. */
|
|
91
|
+
selectable?: boolean;
|
|
92
|
+
/** The IDs of the selected rows, when controlled. */
|
|
93
|
+
selectedRowIds?: string[];
|
|
94
|
+
/** The IDs of the first selected rows, when uncontrolled. */
|
|
95
|
+
defaultSelectedRowIds?: string[];
|
|
96
|
+
/** Called when the selection changes. */
|
|
97
|
+
onSelectedRowIdsChange?: (ids: string[]) => void;
|
|
98
|
+
/** Shows placeholder rows while the data loads. */
|
|
99
|
+
loading?: boolean;
|
|
100
|
+
/** Title of the empty state, shown when `rows` is empty. */
|
|
101
|
+
emptyTitle?: ReactNode;
|
|
102
|
+
/** Description of the empty state. */
|
|
103
|
+
emptyDescription?: ReactNode;
|
|
104
|
+
/** The next step in the empty state, normally a Button. */
|
|
105
|
+
emptyAction?: ReactNode;
|
|
106
|
+
/** Title shown when filters and search match nothing. */
|
|
107
|
+
noResultsTitle?: ReactNode;
|
|
108
|
+
/** Description shown when filters and search match nothing. */
|
|
109
|
+
noResultsDescription?: ReactNode;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* A complete table: sort, search, column filters, row selection, pagination, and loading, empty and no-results states.
|
|
113
|
+
* Everything runs on the client. Sort, filters, search and page each work controlled or uncontrolled.
|
|
114
|
+
*/
|
|
115
|
+
export declare const DataTable: <T>(props: DataTableProps<T> & RefAttributes<HTMLElement>) => ReactElement;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './DataTable';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type InputProps } from '../Input';
|
|
2
|
+
export type DateFieldProps = Omit<InputProps, 'type' | 'leadingIcon' | 'trailingIcon'>;
|
|
3
|
+
/** A native date input styled like Input. Values use the native `YYYY-MM-DD` format, and `min` and `max` apply. */
|
|
4
|
+
export declare const DateField: import("react").ForwardRefExoticComponent<DateFieldProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './DateField';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type ButtonHTMLAttributes } from 'react';
|
|
2
|
+
import { type WeekStart } from '../Calendar/dateUtils';
|
|
3
|
+
export interface DatePickerProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'value' | 'defaultValue' | 'onChange' | 'children'> {
|
|
4
|
+
/** The chosen day, when controlled. Use a Date at local midnight, or null for none. */
|
|
5
|
+
value?: Date | null;
|
|
6
|
+
/** The first chosen day, when uncontrolled. */
|
|
7
|
+
defaultValue?: Date | null;
|
|
8
|
+
/** Called with the day, at local midnight, when one is chosen. Called with null when it is cleared. */
|
|
9
|
+
onChange?: (date: Date | null) => void;
|
|
10
|
+
/** Text shown when no day is chosen. */
|
|
11
|
+
placeholder?: string;
|
|
12
|
+
/** Shows the error state and sets `aria-invalid`. */
|
|
13
|
+
invalid?: boolean;
|
|
14
|
+
/** Read-only look with a "Locked" tag. It can be focused but not opened. */
|
|
15
|
+
locked?: boolean;
|
|
16
|
+
/** Marks the control as required. */
|
|
17
|
+
required?: boolean;
|
|
18
|
+
/** The earliest day that can be chosen. */
|
|
19
|
+
min?: Date;
|
|
20
|
+
/** The latest day that can be chosen. */
|
|
21
|
+
max?: Date;
|
|
22
|
+
/** Returns true for a day that can't be chosen. */
|
|
23
|
+
isDateDisabled?: (date: Date) => boolean;
|
|
24
|
+
/** BCP 47 locale for names and numbers. Leave out to use the browser's locale. */
|
|
25
|
+
locale?: string;
|
|
26
|
+
/** The first column of the grid: 0 is Sunday and 1 is Monday. */
|
|
27
|
+
weekStartsOn?: WeekStart;
|
|
28
|
+
/** The day marked as today. Defaults to now. Pass it for repeatable tests. */
|
|
29
|
+
today?: Date;
|
|
30
|
+
/** Shows a clear button while a day is chosen. */
|
|
31
|
+
clearable?: boolean;
|
|
32
|
+
/** Accessible name of the clear button. */
|
|
33
|
+
clearLabel?: string;
|
|
34
|
+
/** Accessible name of the popup. */
|
|
35
|
+
popupLabel?: string;
|
|
36
|
+
/** Accessible name of the previous month button. */
|
|
37
|
+
previousMonthLabel?: string;
|
|
38
|
+
/** Accessible name of the next month button. */
|
|
39
|
+
nextMonthLabel?: string;
|
|
40
|
+
}
|
|
41
|
+
/** A single date: a trigger shaped like Select, and a popup calendar that closes once a day is picked. */
|
|
42
|
+
export declare const DatePicker: import("react").ForwardRefExoticComponent<DatePickerProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './DatePicker';
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { type ButtonHTMLAttributes } from 'react';
|
|
2
|
+
import { type DateRange, type WeekStart } from '../Calendar/dateUtils';
|
|
3
|
+
import { type DateRangePreset } from './DateRangePresets';
|
|
4
|
+
/** The words of a DateRangePicker, for translating it. */
|
|
5
|
+
export interface DateRangePickerLabels {
|
|
6
|
+
/** Helper text while waiting for the first date. */
|
|
7
|
+
selectStart: string;
|
|
8
|
+
/** Helper text while waiting for the second date. */
|
|
9
|
+
selectEnd: string;
|
|
10
|
+
/** Helper text when a full range waits for Apply. */
|
|
11
|
+
confirm: string;
|
|
12
|
+
/** Explains `minDays` and `maxDays`. */
|
|
13
|
+
limit: (minDays: number | undefined, maxDays: number | undefined) => string;
|
|
14
|
+
/** Explains why a range can't reach past a disabled date. */
|
|
15
|
+
noDisabledInRange: string;
|
|
16
|
+
/** Announced when the first date is chosen. */
|
|
17
|
+
announceStart: (date: string) => string;
|
|
18
|
+
/** Announced when the range is complete. */
|
|
19
|
+
announceRange: (start: string, end: string) => string;
|
|
20
|
+
/** Announced when a selection is dropped. */
|
|
21
|
+
announceCancel: string;
|
|
22
|
+
/** Announced when the range is cleared. */
|
|
23
|
+
announceClear: string;
|
|
24
|
+
/** The Apply button. */
|
|
25
|
+
apply: string;
|
|
26
|
+
/** The Cancel button. */
|
|
27
|
+
cancel: string;
|
|
28
|
+
/** Accessible name of the clear button. */
|
|
29
|
+
clear: string;
|
|
30
|
+
/** Accessible name of the popup. */
|
|
31
|
+
popup: string;
|
|
32
|
+
/** Accessible name of the preset list. */
|
|
33
|
+
presets: string;
|
|
34
|
+
/** Accessible name of the previous month button. */
|
|
35
|
+
previousMonth: string;
|
|
36
|
+
/** Accessible name of the next month button. */
|
|
37
|
+
nextMonth: string;
|
|
38
|
+
}
|
|
39
|
+
export interface DateRangePickerProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'value' | 'defaultValue' | 'onChange' | 'children'> {
|
|
40
|
+
/** The chosen range, when controlled. Use Dates at local midnight. */
|
|
41
|
+
value?: DateRange;
|
|
42
|
+
/** The first chosen range, when uncontrolled. */
|
|
43
|
+
defaultValue?: DateRange;
|
|
44
|
+
/** Called with the range, in order and at local midnight, when it is complete. Both ends are null when it is cleared. */
|
|
45
|
+
onChange?: (range: DateRange) => void;
|
|
46
|
+
/** Text shown when no range is chosen. */
|
|
47
|
+
placeholder?: string;
|
|
48
|
+
/** Shows the error state and sets `aria-invalid`. */
|
|
49
|
+
invalid?: boolean;
|
|
50
|
+
/** Read-only look with a "Locked" tag. It can be focused but not opened. */
|
|
51
|
+
locked?: boolean;
|
|
52
|
+
/** Marks the control as required. */
|
|
53
|
+
required?: boolean;
|
|
54
|
+
/** The earliest day that can be chosen. */
|
|
55
|
+
min?: Date;
|
|
56
|
+
/** The latest day that can be chosen. */
|
|
57
|
+
max?: Date;
|
|
58
|
+
/** Returns true for a day that can't be chosen. */
|
|
59
|
+
isDateDisabled?: (date: Date) => boolean;
|
|
60
|
+
/** The fewest days a range can include, counting both ends. Shorter choices are disabled once a start date is chosen. */
|
|
61
|
+
minDays?: number;
|
|
62
|
+
/** The most days a range can include, counting both ends. Longer choices are disabled once a start date is chosen. */
|
|
63
|
+
maxDays?: number;
|
|
64
|
+
/** Lets a range run across a disabled day. Neither end can be on one. */
|
|
65
|
+
allowDisabledInRange?: boolean;
|
|
66
|
+
/** Keeps the popup open after the second date, until Apply or Cancel. */
|
|
67
|
+
requireApply?: boolean;
|
|
68
|
+
/** Ranges to offer in a side list. */
|
|
69
|
+
presets?: DateRangePreset[];
|
|
70
|
+
/** How many months to show. Two sit side by side, and stack when there isn't room. */
|
|
71
|
+
months?: 1 | 2;
|
|
72
|
+
/** BCP 47 locale for names and numbers. Leave out to use the browser's locale. */
|
|
73
|
+
locale?: string;
|
|
74
|
+
/** The first column of the grid: 0 is Sunday and 1 is Monday. */
|
|
75
|
+
weekStartsOn?: WeekStart;
|
|
76
|
+
/** The day marked as today and used by `presets`. Defaults to now. Pass it for repeatable tests. */
|
|
77
|
+
today?: Date;
|
|
78
|
+
/** Shows a clear button while a range is chosen. */
|
|
79
|
+
clearable?: boolean;
|
|
80
|
+
/** Replaces any of the words, for translating. */
|
|
81
|
+
labels?: Partial<DateRangePickerLabels>;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Picks two dates: the first click sets the start, the second sets the end. Moving the pointer or keyboard focus previews
|
|
85
|
+
* the range, reversed dates are swapped, and Escape or an outside press drops the selection and keeps the previous value.
|
|
86
|
+
*/
|
|
87
|
+
export declare const DateRangePicker: import("react").ForwardRefExoticComponent<DateRangePickerProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type HTMLAttributes } from 'react';
|
|
2
|
+
import { type DateRange } from '../Calendar/dateUtils';
|
|
3
|
+
export interface DateRangePreset {
|
|
4
|
+
/** The text shown for the preset. */
|
|
5
|
+
label: string;
|
|
6
|
+
/** Works out the range, relative to the day given as today. */
|
|
7
|
+
getRange: (today: Date) => DateRange;
|
|
8
|
+
}
|
|
9
|
+
export interface DateRangePresetsProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onSelect'> {
|
|
10
|
+
/** The presets, in order. */
|
|
11
|
+
presets: DateRangePreset[];
|
|
12
|
+
/** The day the presets are worked out from. */
|
|
13
|
+
today: Date;
|
|
14
|
+
/** The current range. The preset that matches it is marked. */
|
|
15
|
+
value?: DateRange;
|
|
16
|
+
/** Called with the preset and its range when one is chosen. */
|
|
17
|
+
onSelect?: (range: DateRange, preset: DateRangePreset) => void;
|
|
18
|
+
/** Returns true for a range that can't be used. Its preset is disabled. */
|
|
19
|
+
isRangeDisabled?: (range: DateRange) => boolean;
|
|
20
|
+
/** Accessible name of the list. */
|
|
21
|
+
'aria-label'?: string;
|
|
22
|
+
}
|
|
23
|
+
/** The side list of a DateRangePicker: ranges such as "Last 7 days", worked out from `today`. */
|
|
24
|
+
export declare const DateRangePresets: import("react").ForwardRefExoticComponent<DateRangePresetsProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type DateRange } from '../Calendar/dateUtils';
|
|
2
|
+
import { type DateTriggerInternalProps } from '../Calendar/DateTriggerInternal';
|
|
3
|
+
export interface DateRangeTriggerProps extends Omit<DateTriggerInternalProps, 'text'> {
|
|
4
|
+
/** The range to show, as `12 Mar 2026 – 18 Mar 2026`. */
|
|
5
|
+
value?: DateRange | null;
|
|
6
|
+
/** BCP 47 locale for the dates. Leave out to use the browser's locale. */
|
|
7
|
+
locale?: string;
|
|
8
|
+
}
|
|
9
|
+
/** The control that opens a DateRangePicker. It looks like Select and reads a surrounding Field. */
|
|
10
|
+
export declare const DateRangeTrigger: import("react").ForwardRefExoticComponent<DateRangeTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type HTMLAttributes, type RefObject } from 'react';
|
|
2
|
+
export type DialogSize = 'sm' | 'md' | 'lg';
|
|
3
|
+
export interface DialogProps extends HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
/** Whether the dialog is showing. Leave undefined to use `defaultOpen` and let the dialog manage itself. */
|
|
5
|
+
open?: boolean;
|
|
6
|
+
/** Initial open state when uncontrolled. */
|
|
7
|
+
defaultOpen?: boolean;
|
|
8
|
+
/** Called when the user closes the dialog. */
|
|
9
|
+
onClose?: () => void;
|
|
10
|
+
/** Whether Escape, a backdrop press and the header's close button can close the dialog. */
|
|
11
|
+
dismissible?: boolean;
|
|
12
|
+
/** Panel width: `sm` is 400 px, `md` is 560 px and `lg` is 720 px. */
|
|
13
|
+
size?: DialogSize;
|
|
14
|
+
/** Element to focus on open. Defaults to the first focusable element. */
|
|
15
|
+
initialFocusRef?: RefObject<HTMLElement | null>;
|
|
16
|
+
/** `alertdialog` for a message that interrupts and needs a response. */
|
|
17
|
+
role?: 'dialog' | 'alertdialog';
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* A modal window. Compose it from DialogHeader, DialogBody and DialogFooter. Traps focus, restores it on close,
|
|
21
|
+
* locks body scroll and renders in a portal. A DialogHeader names and describes the dialog automatically.
|
|
22
|
+
*/
|
|
23
|
+
export declare const Dialog: import("react").ForwardRefExoticComponent<DialogProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type HTMLAttributes } from 'react';
|
|
2
|
+
export type DialogBodyProps = HTMLAttributes<HTMLDivElement>;
|
|
3
|
+
/** The main content of a Dialog or Drawer. Scrolls when the content is taller than the space available. */
|
|
4
|
+
export declare const DialogBody: import("react").ForwardRefExoticComponent<DialogBodyProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type HTMLAttributes } from 'react';
|
|
2
|
+
export type DialogFooterProps = HTMLAttributes<HTMLDivElement>;
|
|
3
|
+
/** Right-aligned actions at the bottom of a Dialog or Drawer. Use at most one primary Button. */
|
|
4
|
+
export declare const DialogFooter: import("react").ForwardRefExoticComponent<DialogFooterProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactNode } from 'react';
|
|
2
|
+
export interface DialogHeaderProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
3
|
+
/** The title, which also becomes the modal's accessible name. */
|
|
4
|
+
title: ReactNode;
|
|
5
|
+
/** Supporting text, which also becomes the modal's accessible description. */
|
|
6
|
+
description?: ReactNode;
|
|
7
|
+
/** Called by the close button. Defaults to closing the surrounding modal, when it is dismissible. */
|
|
8
|
+
onClose?: () => void;
|
|
9
|
+
/** Accessible name of the close button. */
|
|
10
|
+
closeLabel?: string;
|
|
11
|
+
/** Hides the close button even when the modal can be closed. */
|
|
12
|
+
hideClose?: boolean;
|
|
13
|
+
}
|
|
14
|
+
/** Title, optional description and close button at the top of a Dialog or Drawer. */
|
|
15
|
+
export declare const DialogHeader: import("react").ForwardRefExoticComponent<DialogHeaderProps & import("react").RefAttributes<HTMLDivElement>>;
|