@ratio-ui/core 0.1.1 → 0.3.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/README.md +2 -0
- package/dist/catalogue.json +2829 -72
- package/dist/components/alert/Alert.d.ts +18 -0
- package/dist/components/alert/Alert.js +67 -0
- package/dist/components/alert/index.d.ts +2 -0
- package/dist/components/alert/index.js +1 -0
- package/dist/components/alert-dialog/AlertDialog.d.ts +48 -0
- package/dist/components/alert-dialog/AlertDialog.js +76 -0
- package/dist/components/alert-dialog/index.d.ts +2 -0
- package/dist/components/alert-dialog/index.js +1 -0
- package/dist/components/app-shell/AppShell.d.ts +22 -0
- package/dist/components/app-shell/AppShell.js +39 -0
- package/dist/components/app-shell/context.js +5 -0
- package/dist/components/app-shell/index.d.ts +2 -0
- package/dist/components/app-shell/index.js +1 -0
- package/dist/components/avatar/Avatar.d.ts +22 -0
- package/dist/components/avatar/Avatar.js +38 -0
- package/dist/components/avatar/index.d.ts +2 -0
- package/dist/components/avatar/index.js +1 -0
- package/dist/components/button/Button.d.ts +37 -0
- package/dist/components/button/Button.js +41 -0
- package/dist/components/button/index.d.ts +2 -0
- package/dist/components/button/index.js +1 -0
- package/dist/components/calendar/Calendar.d.ts +20 -0
- package/dist/components/calendar/Calendar.js +119 -0
- package/dist/components/calendar/index.d.ts +2 -0
- package/dist/components/calendar/index.js +1 -0
- package/dist/components/card/Card.d.ts +33 -0
- package/dist/components/card/Card.js +53 -0
- package/dist/components/card/index.d.ts +2 -0
- package/dist/components/card/index.js +1 -0
- package/dist/components/checkbox/Checkbox.d.ts +10 -0
- package/dist/components/checkbox/Checkbox.js +28 -0
- package/dist/components/checkbox/index.d.ts +2 -0
- package/dist/components/checkbox/index.js +1 -0
- package/dist/components/checkbox-list/CheckboxList.d.ts +36 -0
- package/dist/components/checkbox-list/CheckboxList.js +93 -0
- package/dist/components/checkbox-list/index.d.ts +2 -0
- package/dist/components/checkbox-list/index.js +1 -0
- package/dist/components/collapsible/Collapsible.d.ts +24 -0
- package/dist/components/collapsible/Collapsible.js +58 -0
- package/dist/components/collapsible/index.d.ts +2 -0
- package/dist/components/collapsible/index.js +1 -0
- package/dist/components/data-table/DataTable.d.ts +65 -0
- package/dist/components/data-table/DataTable.js +141 -0
- package/dist/components/data-table/index.d.ts +2 -0
- package/dist/components/data-table/index.js +1 -0
- package/dist/components/date-picker/DatePicker.d.ts +33 -0
- package/dist/components/date-picker/DatePicker.js +104 -0
- package/dist/components/date-picker/index.d.ts +2 -0
- package/dist/components/date-picker/index.js +1 -0
- package/dist/components/date-range-picker/DateRangePicker.d.ts +39 -0
- package/dist/components/date-range-picker/DateRangePicker.js +142 -0
- package/dist/components/date-range-picker/index.d.ts +2 -0
- package/dist/components/date-range-picker/index.js +1 -0
- package/dist/components/definition/Definition.d.ts +14 -0
- package/dist/components/definition/Definition.js +29 -0
- package/dist/components/definition/index.d.ts +2 -0
- package/dist/components/definition/index.js +1 -0
- package/dist/components/dialog/Dialog.d.ts +44 -0
- package/dist/components/dialog/Dialog.js +79 -0
- package/dist/components/dialog/index.d.ts +2 -0
- package/dist/components/dialog/index.js +1 -0
- package/dist/components/dropdown-menu/DropdownMenu.d.ts +73 -0
- package/dist/components/dropdown-menu/DropdownMenu.js +116 -0
- package/dist/components/dropdown-menu/index.d.ts +2 -0
- package/dist/components/dropdown-menu/index.js +1 -0
- package/dist/components/empty-state/EmptyState.d.ts +15 -0
- package/dist/components/empty-state/EmptyState.js +30 -0
- package/dist/components/empty-state/index.d.ts +2 -0
- package/dist/components/empty-state/index.js +1 -0
- package/dist/components/field/Field.d.ts +35 -0
- package/dist/components/field/Field.js +67 -0
- package/dist/components/field/Label.d.ts +8 -0
- package/dist/components/field/Label.js +13 -0
- package/dist/components/field/index.d.ts +3 -0
- package/dist/components/field/index.js +3 -0
- package/dist/components/filter-tabs/FilterTabs.d.ts +28 -0
- package/dist/components/filter-tabs/FilterTabs.js +37 -0
- package/dist/components/filter-tabs/index.d.ts +2 -0
- package/dist/components/filter-tabs/index.js +1 -0
- package/dist/components/global-search/GlobalSearch.d.ts +51 -0
- package/dist/components/global-search/GlobalSearch.js +144 -0
- package/dist/components/global-search/index.d.ts +2 -0
- package/dist/components/global-search/index.js +1 -0
- package/dist/components/icon/registry.d.ts +3 -2
- package/dist/components/icon/registry.js +57 -1
- package/dist/components/input/Input.d.ts +19 -0
- package/dist/components/input/Input.js +26 -0
- package/dist/components/input/index.d.ts +2 -0
- package/dist/components/input/index.js +1 -0
- package/dist/components/input-group/InputGroup.d.ts +42 -0
- package/dist/components/input-group/InputGroup.js +83 -0
- package/dist/components/input-group/index.d.ts +2 -0
- package/dist/components/input-group/index.js +1 -0
- package/dist/components/kbd/Kbd.d.ts +17 -0
- package/dist/components/kbd/Kbd.js +21 -0
- package/dist/components/kbd/index.d.ts +2 -0
- package/dist/components/kbd/index.js +1 -0
- package/dist/components/link/Link.d.ts +22 -0
- package/dist/components/link/Link.js +31 -0
- package/dist/components/link/index.d.ts +2 -0
- package/dist/components/link/index.js +1 -0
- package/dist/components/link-provider/LinkProvider.d.ts +29 -0
- package/dist/components/link-provider/LinkProvider.js +15 -0
- package/dist/components/link-provider/RatioLink.js +18 -0
- package/dist/components/link-provider/context.js +4 -0
- package/dist/components/link-provider/index.d.ts +2 -0
- package/dist/components/link-provider/index.js +1 -0
- package/dist/components/media-grid/MediaGrid.d.ts +49 -0
- package/dist/components/media-grid/MediaGrid.js +303 -0
- package/dist/components/media-grid/index.d.ts +2 -0
- package/dist/components/media-grid/index.js +1 -0
- package/dist/components/metric-strip/MetricStrip.d.ts +23 -0
- package/dist/components/metric-strip/MetricStrip.js +39 -0
- package/dist/components/metric-strip/index.d.ts +2 -0
- package/dist/components/metric-strip/index.js +1 -0
- package/dist/components/money-input/MoneyInput.d.ts +30 -0
- package/dist/components/money-input/MoneyInput.js +72 -0
- package/dist/components/money-input/index.d.ts +2 -0
- package/dist/components/money-input/index.js +1 -0
- package/dist/components/page-header/PageHeader.d.ts +37 -0
- package/dist/components/page-header/PageHeader.js +62 -0
- package/dist/components/page-header/index.d.ts +2 -0
- package/dist/components/page-header/index.js +1 -0
- package/dist/components/pagination/Pagination.d.ts +18 -0
- package/dist/components/pagination/Pagination.js +59 -0
- package/dist/components/pagination/index.d.ts +2 -0
- package/dist/components/pagination/index.js +1 -0
- package/dist/components/popover/Popover.d.ts +27 -0
- package/dist/components/popover/Popover.js +47 -0
- package/dist/components/popover/index.d.ts +2 -0
- package/dist/components/popover/index.js +1 -0
- package/dist/components/save-bar/SaveBar.d.ts +27 -0
- package/dist/components/save-bar/SaveBar.js +37 -0
- package/dist/components/save-bar/index.d.ts +2 -0
- package/dist/components/save-bar/index.js +1 -0
- package/dist/components/search-field/SearchField.d.ts +23 -0
- package/dist/components/search-field/SearchField.js +66 -0
- package/dist/components/search-field/index.d.ts +2 -0
- package/dist/components/search-field/index.js +1 -0
- package/dist/components/select/Select.d.ts +40 -0
- package/dist/components/select/Select.js +84 -0
- package/dist/components/select/index.d.ts +2 -0
- package/dist/components/select/index.js +1 -0
- package/dist/components/side-nav/SideNav.d.ts +64 -0
- package/dist/components/side-nav/SideNav.js +194 -0
- package/dist/components/side-nav/index.d.ts +2 -0
- package/dist/components/side-nav/index.js +1 -0
- package/dist/components/skeleton/Skeleton.d.ts +13 -0
- package/dist/components/skeleton/Skeleton.js +21 -0
- package/dist/components/skeleton/index.d.ts +2 -0
- package/dist/components/skeleton/index.js +1 -0
- package/dist/components/spinner/Spinner.d.ts +11 -0
- package/dist/components/spinner/Spinner.js +16 -0
- package/dist/components/spinner/index.d.ts +2 -0
- package/dist/components/spinner/index.js +1 -0
- package/dist/components/status-pill/StatusPill.d.ts +14 -0
- package/dist/components/status-pill/StatusPill.js +19 -0
- package/dist/components/status-pill/index.d.ts +2 -0
- package/dist/components/status-pill/index.js +1 -0
- package/dist/components/summary-chips/SummaryChips.d.ts +17 -0
- package/dist/components/summary-chips/SummaryChips.js +19 -0
- package/dist/components/summary-chips/index.d.ts +2 -0
- package/dist/components/summary-chips/index.js +1 -0
- package/dist/components/switch/Switch.d.ts +10 -0
- package/dist/components/switch/Switch.js +20 -0
- package/dist/components/switch/index.d.ts +2 -0
- package/dist/components/switch/index.js +1 -0
- package/dist/components/table/Table.d.ts +46 -0
- package/dist/components/table/Table.js +87 -0
- package/dist/components/table/index.d.ts +2 -0
- package/dist/components/table/index.js +1 -0
- package/dist/components/table-loader/TableLoader.d.ts +31 -0
- package/dist/components/table-loader/TableLoader.js +35 -0
- package/dist/components/table-loader/index.d.ts +2 -0
- package/dist/components/table-loader/index.js +1 -0
- package/dist/components/tabs/Tabs.d.ts +23 -0
- package/dist/components/tabs/Tabs.js +41 -0
- package/dist/components/tabs/index.d.ts +2 -0
- package/dist/components/tabs/index.js +1 -0
- package/dist/components/tag-input/TagInput.d.ts +44 -0
- package/dist/components/tag-input/TagInput.js +102 -0
- package/dist/components/tag-input/index.d.ts +2 -0
- package/dist/components/tag-input/index.js +1 -0
- package/dist/components/textarea/Textarea.d.ts +15 -0
- package/dist/components/textarea/Textarea.js +21 -0
- package/dist/components/textarea/index.d.ts +2 -0
- package/dist/components/textarea/index.js +1 -0
- package/dist/components/toaster/Toaster.d.ts +32 -0
- package/dist/components/toaster/Toaster.js +89 -0
- package/dist/components/toaster/index.d.ts +2 -0
- package/dist/components/toaster/index.js +1 -0
- package/dist/components/tooltip/Tooltip.d.ts +18 -0
- package/dist/components/tooltip/Tooltip.js +35 -0
- package/dist/components/tooltip/index.d.ts +2 -0
- package/dist/components/tooltip/index.js +1 -0
- package/dist/components/top-bar/StoreSwitcher.d.ts +26 -0
- package/dist/components/top-bar/StoreSwitcher.js +48 -0
- package/dist/components/top-bar/TopBar.d.ts +24 -0
- package/dist/components/top-bar/TopBar.js +53 -0
- package/dist/components/top-bar/index.d.ts +3 -0
- package/dist/components/top-bar/index.js +3 -0
- package/dist/components/unit-input/UnitInput.d.ts +33 -0
- package/dist/components/unit-input/UnitInput.js +47 -0
- package/dist/components/unit-input/index.d.ts +2 -0
- package/dist/components/unit-input/index.js +1 -0
- package/dist/index.d.ts +102 -1
- package/dist/index.js +54 -2
- package/dist/lib/cn.js +38 -27
- package/dist/lib/format.d.ts +92 -0
- package/dist/lib/format.js +222 -0
- package/dist/styles.css +1 -1
- package/package.json +205 -3
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { Icon } from "../icon/Icon.js";
|
|
2
|
+
import { Button } from "../button/Button.js";
|
|
3
|
+
import { FORMAT, formatDate, formatIsoDate, parseDate } from "../../lib/format.js";
|
|
4
|
+
import { Calendar } from "../calendar/Calendar.js";
|
|
5
|
+
import { InputGroup, InputGroupAddon, InputGroupInput } from "../input-group/InputGroup.js";
|
|
6
|
+
import { Popover, PopoverContent, PopoverTrigger } from "../popover/Popover.js";
|
|
7
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { useState } from "react";
|
|
9
|
+
// src/components/date-picker/DatePicker.tsx
|
|
10
|
+
/**
|
|
11
|
+
* A field that shows a day as DD/MM/YYYY, reads a typed date through the format module and opens a calendar in a popover
|
|
12
|
+
* from the button at its end. Text that is not a date is marked invalid when the field loses focus, and reports nothing.
|
|
13
|
+
* Under a name, a form submits the day as YYYY-MM-DD (empty when there is none), never the text on screen.
|
|
14
|
+
*/
|
|
15
|
+
function DatePicker({ value, defaultValue = null, onValueChange, disabledDays, startMonth, endMonth, size = 36, placeholder = FORMAT.datePattern, readOnly, disabled, onBlur, ref, name, "aria-invalid": ariaInvalid, ...rest }) {
|
|
16
|
+
const controlled = value !== void 0;
|
|
17
|
+
const [inner, setInner] = useState(defaultValue);
|
|
18
|
+
const day = controlled ? value : inner;
|
|
19
|
+
const [text, setText] = useState(() => day === null ? "" : formatDate(day));
|
|
20
|
+
const [seen, setSeen] = useState(day);
|
|
21
|
+
const [malformed, setMalformed] = useState(false);
|
|
22
|
+
const [open, setOpen] = useState(false);
|
|
23
|
+
if ((seen?.getTime() ?? null) !== (day?.getTime() ?? null)) {
|
|
24
|
+
setSeen(day);
|
|
25
|
+
if ((day?.getTime() ?? null) !== (parseDate(text)?.getTime() ?? null)) setText(day === null ? "" : formatDate(day));
|
|
26
|
+
setMalformed(false);
|
|
27
|
+
}
|
|
28
|
+
const commit = (next) => {
|
|
29
|
+
setSeen(next);
|
|
30
|
+
if (!controlled) setInner(next);
|
|
31
|
+
onValueChange?.(next);
|
|
32
|
+
};
|
|
33
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(InputGroup, {
|
|
34
|
+
size,
|
|
35
|
+
children: [/* @__PURE__ */ jsx(InputGroupInput, {
|
|
36
|
+
...rest,
|
|
37
|
+
ref,
|
|
38
|
+
type: "text",
|
|
39
|
+
autoComplete: "off",
|
|
40
|
+
placeholder,
|
|
41
|
+
readOnly,
|
|
42
|
+
disabled,
|
|
43
|
+
"aria-invalid": ariaInvalid ?? (malformed ? true : void 0),
|
|
44
|
+
value: text,
|
|
45
|
+
onChange: (event) => {
|
|
46
|
+
const next = event.target.value;
|
|
47
|
+
setText(next);
|
|
48
|
+
setMalformed(false);
|
|
49
|
+
if (next.trim() === "") return commit(null);
|
|
50
|
+
const parsed = parseDate(next);
|
|
51
|
+
if (parsed !== null) commit(parsed);
|
|
52
|
+
},
|
|
53
|
+
onBlur: (event) => {
|
|
54
|
+
onBlur?.(event);
|
|
55
|
+
const parsed = parseDate(text);
|
|
56
|
+
if (text.trim() === "") setMalformed(false);
|
|
57
|
+
else if (parsed === null) setMalformed(true);
|
|
58
|
+
else setText(formatDate(parsed));
|
|
59
|
+
}
|
|
60
|
+
}), readOnly ? null : /* @__PURE__ */ jsx(InputGroupAddon, {
|
|
61
|
+
align: "end",
|
|
62
|
+
children: /* @__PURE__ */ jsxs(Popover, {
|
|
63
|
+
open,
|
|
64
|
+
onOpenChange: setOpen,
|
|
65
|
+
children: [/* @__PURE__ */ jsx(PopoverTrigger, {
|
|
66
|
+
disabled,
|
|
67
|
+
render: /* @__PURE__ */ jsx(Button, {
|
|
68
|
+
variant: "ghost",
|
|
69
|
+
iconOnly: true,
|
|
70
|
+
"aria-label": "Open calendar",
|
|
71
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
72
|
+
name: "calendar",
|
|
73
|
+
size: 12
|
|
74
|
+
})
|
|
75
|
+
})
|
|
76
|
+
}), /* @__PURE__ */ jsx(PopoverContent, {
|
|
77
|
+
align: "end",
|
|
78
|
+
children: /* @__PURE__ */ jsx(Calendar, {
|
|
79
|
+
mode: "single",
|
|
80
|
+
required: true,
|
|
81
|
+
selected: day ?? void 0,
|
|
82
|
+
defaultMonth: day ?? void 0,
|
|
83
|
+
onSelect: (picked) => {
|
|
84
|
+
setText(formatDate(picked));
|
|
85
|
+
setMalformed(false);
|
|
86
|
+
commit(picked);
|
|
87
|
+
setOpen(false);
|
|
88
|
+
},
|
|
89
|
+
disabled: disabledDays,
|
|
90
|
+
startMonth,
|
|
91
|
+
endMonth
|
|
92
|
+
})
|
|
93
|
+
})]
|
|
94
|
+
})
|
|
95
|
+
})]
|
|
96
|
+
}), name !== void 0 && /* @__PURE__ */ jsx("input", {
|
|
97
|
+
type: "hidden",
|
|
98
|
+
name,
|
|
99
|
+
form: rest.form,
|
|
100
|
+
value: day === null ? "" : formatIsoDate(day),
|
|
101
|
+
disabled
|
|
102
|
+
})] });
|
|
103
|
+
}
|
|
104
|
+
export { DatePicker };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DatePicker } from "./DatePicker.js";
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { CalendarProps } from "../calendar/Calendar.js";
|
|
2
|
+
import "../calendar/index.js";
|
|
3
|
+
import { InputGroupSize } from "../input-group/InputGroup.js";
|
|
4
|
+
import "../input-group/index.js";
|
|
5
|
+
import { InputHTMLAttributes, JSX, Ref } from "react";
|
|
6
|
+
/** A complete range of days, the first day and the last day (the same day for a range of one). */
|
|
7
|
+
export type DateRangeValue = {
|
|
8
|
+
from: Date;
|
|
9
|
+
to: Date;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* The props of DateRangePicker: the HTML attributes of an input, except className, style, size and the ones the field sets
|
|
13
|
+
* itself, with the range as a first and a last day in and out. Mark an invalid field with aria-invalid.
|
|
14
|
+
*/
|
|
15
|
+
export type DateRangePickerProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'className' | 'style' | 'size' | 'type' | 'value' | 'defaultValue' | 'onChange' | 'min' | 'max'> & {
|
|
16
|
+
/** The range, or null for an empty field. Pass it to control the field. */
|
|
17
|
+
value?: DateRangeValue | null;
|
|
18
|
+
/** The starting range when the field is not controlled. Defaults to empty. */
|
|
19
|
+
defaultValue?: DateRangeValue | null;
|
|
20
|
+
/** Called with the range when a typed range is complete or two days are picked, and with null when the text is cleared. */
|
|
21
|
+
onValueChange?: (value: DateRangeValue | null) => void;
|
|
22
|
+
/** The days that cannot be picked in the calendar, for example { after: new Date() } for an analytics period. */
|
|
23
|
+
disabledDays?: CalendarProps['disabled'];
|
|
24
|
+
/** The first month the calendar can show. */
|
|
25
|
+
startMonth?: Date;
|
|
26
|
+
/** The last month the calendar can show. */
|
|
27
|
+
endMonth?: Date;
|
|
28
|
+
/** The height in px: 36 for forms, 32 for fields inside a table. Defaults to 36. */
|
|
29
|
+
size?: InputGroupSize;
|
|
30
|
+
/** Receives the input element. */
|
|
31
|
+
ref?: Ref<HTMLInputElement>;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* A field that shows a range as two DD/MM/YYYY days, reads a typed range through the format module and opens a calendar in
|
|
35
|
+
* a popover from the button at its end, for analytics periods. Pick the first day, then the last. Text that is not a range
|
|
36
|
+
* in order is marked invalid when the field loses focus, and reports nothing. Under a name, a form submits two fields,
|
|
37
|
+
* `name.from` and `name.to`, each as YYYY-MM-DD (empty when there is no range), never the text on screen.
|
|
38
|
+
*/
|
|
39
|
+
export declare function DateRangePicker({ value, defaultValue, onValueChange, disabledDays, startMonth, endMonth, size, placeholder, readOnly, disabled, onBlur, ref, name, 'aria-invalid': ariaInvalid, ...rest }: DateRangePickerProps): JSX.Element;
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { Icon } from "../icon/Icon.js";
|
|
2
|
+
import { Button } from "../button/Button.js";
|
|
3
|
+
import { FORMAT, formatDate, formatIsoDate, parseDate } from "../../lib/format.js";
|
|
4
|
+
import { Calendar } from "../calendar/Calendar.js";
|
|
5
|
+
import { InputGroup, InputGroupAddon, InputGroupInput } from "../input-group/InputGroup.js";
|
|
6
|
+
import { Popover, PopoverContent, PopoverTrigger } from "../popover/Popover.js";
|
|
7
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { useState } from "react";
|
|
9
|
+
// src/components/date-range-picker/DateRangePicker.tsx
|
|
10
|
+
const SEPARATOR = " – ";
|
|
11
|
+
const SPLIT = /\s+[-–—]\s+|\s*[–—]\s*/;
|
|
12
|
+
const same = (a, b) => a === null || b === null ? a === b : a.from.getTime() === b.from.getTime() && a.to.getTime() === b.to.getTime();
|
|
13
|
+
const write = (range) => range === null ? "" : `${formatDate(range.from)}${SEPARATOR}${formatDate(range.to)}`;
|
|
14
|
+
/** Reads "28/10/2026 – 03/11/2026" (a dash, en dash or em dash between) as a range, or null when it is not a range in order. */
|
|
15
|
+
function parseRange(text) {
|
|
16
|
+
const parts = text.trim().split(SPLIT);
|
|
17
|
+
if (parts.length !== 2) return null;
|
|
18
|
+
const from = parseDate(parts[0] ?? "");
|
|
19
|
+
const to = parseDate(parts[1] ?? "");
|
|
20
|
+
return from === null || to === null || to < from ? null : {
|
|
21
|
+
from,
|
|
22
|
+
to
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* A field that shows a range as two DD/MM/YYYY days, reads a typed range through the format module and opens a calendar in
|
|
27
|
+
* a popover from the button at its end, for analytics periods. Pick the first day, then the last. Text that is not a range
|
|
28
|
+
* in order is marked invalid when the field loses focus, and reports nothing. Under a name, a form submits two fields,
|
|
29
|
+
* `name.from` and `name.to`, each as YYYY-MM-DD (empty when there is no range), never the text on screen.
|
|
30
|
+
*/
|
|
31
|
+
function DateRangePicker({ value, defaultValue = null, onValueChange, disabledDays, startMonth, endMonth, size = 36, placeholder = `${FORMAT.datePattern}${SEPARATOR}${FORMAT.datePattern}`, readOnly, disabled, onBlur, ref, name, "aria-invalid": ariaInvalid, ...rest }) {
|
|
32
|
+
const controlled = value !== void 0;
|
|
33
|
+
const [inner, setInner] = useState(defaultValue);
|
|
34
|
+
const range = controlled ? value : inner;
|
|
35
|
+
const [text, setText] = useState(() => write(range));
|
|
36
|
+
const [seen, setSeen] = useState(range);
|
|
37
|
+
const [malformed, setMalformed] = useState(false);
|
|
38
|
+
const [open, setOpen] = useState(false);
|
|
39
|
+
const [draft, setDraft] = useState();
|
|
40
|
+
if (!same(seen, range)) {
|
|
41
|
+
setSeen(range);
|
|
42
|
+
if (!same(range, parseRange(text))) setText(write(range));
|
|
43
|
+
setMalformed(false);
|
|
44
|
+
}
|
|
45
|
+
const commit = (next) => {
|
|
46
|
+
setSeen(next);
|
|
47
|
+
if (!controlled) setInner(next);
|
|
48
|
+
onValueChange?.(next);
|
|
49
|
+
};
|
|
50
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(InputGroup, {
|
|
51
|
+
size,
|
|
52
|
+
children: [/* @__PURE__ */ jsx(InputGroupInput, {
|
|
53
|
+
...rest,
|
|
54
|
+
ref,
|
|
55
|
+
type: "text",
|
|
56
|
+
autoComplete: "off",
|
|
57
|
+
placeholder,
|
|
58
|
+
readOnly,
|
|
59
|
+
disabled,
|
|
60
|
+
"aria-invalid": ariaInvalid ?? (malformed ? true : void 0),
|
|
61
|
+
value: text,
|
|
62
|
+
onChange: (event) => {
|
|
63
|
+
const next = event.target.value;
|
|
64
|
+
setText(next);
|
|
65
|
+
setMalformed(false);
|
|
66
|
+
if (next.trim() === "") return commit(null);
|
|
67
|
+
const parsed = parseRange(next);
|
|
68
|
+
if (parsed !== null) commit(parsed);
|
|
69
|
+
},
|
|
70
|
+
onBlur: (event) => {
|
|
71
|
+
onBlur?.(event);
|
|
72
|
+
const parsed = parseRange(text);
|
|
73
|
+
if (text.trim() === "") setMalformed(false);
|
|
74
|
+
else if (parsed === null) setMalformed(true);
|
|
75
|
+
else setText(write(parsed));
|
|
76
|
+
}
|
|
77
|
+
}), readOnly ? null : /* @__PURE__ */ jsx(InputGroupAddon, {
|
|
78
|
+
align: "end",
|
|
79
|
+
children: /* @__PURE__ */ jsxs(Popover, {
|
|
80
|
+
open,
|
|
81
|
+
onOpenChange: (next) => {
|
|
82
|
+
setDraft(void 0);
|
|
83
|
+
setOpen(next);
|
|
84
|
+
},
|
|
85
|
+
children: [/* @__PURE__ */ jsx(PopoverTrigger, {
|
|
86
|
+
disabled,
|
|
87
|
+
render: /* @__PURE__ */ jsx(Button, {
|
|
88
|
+
variant: "ghost",
|
|
89
|
+
iconOnly: true,
|
|
90
|
+
"aria-label": "Open calendar",
|
|
91
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
92
|
+
name: "calendar",
|
|
93
|
+
size: 12
|
|
94
|
+
})
|
|
95
|
+
})
|
|
96
|
+
}), /* @__PURE__ */ jsx(PopoverContent, {
|
|
97
|
+
align: "end",
|
|
98
|
+
children: /* @__PURE__ */ jsx(Calendar, {
|
|
99
|
+
mode: "range",
|
|
100
|
+
selected: draft ?? range ?? void 0,
|
|
101
|
+
defaultMonth: range?.from,
|
|
102
|
+
onSelect: (_picked, triggerDate) => {
|
|
103
|
+
if (draft?.from === void 0) {
|
|
104
|
+
setDraft({
|
|
105
|
+
from: triggerDate,
|
|
106
|
+
to: void 0
|
|
107
|
+
});
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
const [from, to] = triggerDate < draft.from ? [triggerDate, draft.from] : [draft.from, triggerDate];
|
|
111
|
+
const next = {
|
|
112
|
+
from,
|
|
113
|
+
to
|
|
114
|
+
};
|
|
115
|
+
setText(write(next));
|
|
116
|
+
setMalformed(false);
|
|
117
|
+
commit(next);
|
|
118
|
+
setDraft(void 0);
|
|
119
|
+
setOpen(false);
|
|
120
|
+
},
|
|
121
|
+
disabled: disabledDays,
|
|
122
|
+
startMonth,
|
|
123
|
+
endMonth
|
|
124
|
+
})
|
|
125
|
+
})]
|
|
126
|
+
})
|
|
127
|
+
})]
|
|
128
|
+
}), name !== void 0 && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("input", {
|
|
129
|
+
type: "hidden",
|
|
130
|
+
name: `${name}.from`,
|
|
131
|
+
form: rest.form,
|
|
132
|
+
value: range === null ? "" : formatIsoDate(range.from),
|
|
133
|
+
disabled
|
|
134
|
+
}), /* @__PURE__ */ jsx("input", {
|
|
135
|
+
type: "hidden",
|
|
136
|
+
name: `${name}.to`,
|
|
137
|
+
form: rest.form,
|
|
138
|
+
value: range === null ? "" : formatIsoDate(range.to),
|
|
139
|
+
disabled
|
|
140
|
+
})] })] });
|
|
141
|
+
}
|
|
142
|
+
export { DateRangePicker };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DateRangePicker } from "./DateRangePicker.js";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
/** The props of Definition. */
|
|
3
|
+
export type DefinitionProps = {
|
|
4
|
+
/** The term, shown in the text with a dotted underline. */
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
/** The explanation shown when the term is opened. Keep it to a sentence. */
|
|
7
|
+
definition: ReactNode;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* A term that explains itself. It is a span with the button role and a dotted underline, so it takes the font of the text around it, so keyboard users reach it with Tab and open it with
|
|
11
|
+
* Enter or Space, touch users open it with a tap, and mouse users with hover or click. It does not use the browser's own
|
|
12
|
+
* title tooltip, which keyboard and touch users cannot open. Escape closes it.
|
|
13
|
+
*/
|
|
14
|
+
export declare function Definition({ children, definition }: DefinitionProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Popover } from "@base-ui/react/popover";
|
|
3
|
+
// src/components/definition/Definition.tsx
|
|
4
|
+
/**
|
|
5
|
+
* A term that explains itself. It is a span with the button role and a dotted underline, so it takes the font of the text around it, so keyboard users reach it with Tab and open it with
|
|
6
|
+
* Enter or Space, touch users open it with a tap, and mouse users with hover or click. It does not use the browser's own
|
|
7
|
+
* title tooltip, which keyboard and touch users cannot open. Escape closes it.
|
|
8
|
+
*/
|
|
9
|
+
function Definition({ children, definition }) {
|
|
10
|
+
return /* @__PURE__ */ jsxs(Popover.Root, { children: [/* @__PURE__ */ jsx(Popover.Trigger, {
|
|
11
|
+
openOnHover: true,
|
|
12
|
+
nativeButton: false,
|
|
13
|
+
render: /* @__PURE__ */ jsx("span", {}),
|
|
14
|
+
tabIndex: 0,
|
|
15
|
+
delay: 100,
|
|
16
|
+
className: "rt:cursor-help rt:rounded-sm rt:bg-transparent rt:p-0 rt:text-inherit rt:underline rt:decoration-dotted rt:decoration-1 rt:underline-offset-4 rt:focus-visible:focus-ring",
|
|
17
|
+
children
|
|
18
|
+
}), /* @__PURE__ */ jsx(Popover.Portal, { children: /* @__PURE__ */ jsx(Popover.Positioner, {
|
|
19
|
+
side: "top",
|
|
20
|
+
sideOffset: 4,
|
|
21
|
+
className: "rt:isolate rt:z-50",
|
|
22
|
+
children: /* @__PURE__ */ jsx(Popover.Popup, {
|
|
23
|
+
"aria-label": "Definition",
|
|
24
|
+
className: "rt:max-w-72 rt:rounded-md rt:border rt:border-border rt:bg-popover rt:px-3 rt:py-1.5 rt:text-b1 rt:text-popover-foreground rt:outline-hidden",
|
|
25
|
+
children: definition
|
|
26
|
+
})
|
|
27
|
+
}) })] });
|
|
28
|
+
}
|
|
29
|
+
export { Definition };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Definition } from "./Definition.js";
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ComponentProps, JSX } from "react";
|
|
2
|
+
import { Dialog } from "@base-ui/react/dialog";
|
|
3
|
+
/**
|
|
4
|
+
* The root of a dialog. It holds the open state and renders nothing itself. Pass `open` and `onOpenChange` to control it,
|
|
5
|
+
* or `defaultOpen` to leave it uncontrolled. The page behind is inert while it is open, with no scrim over it.
|
|
6
|
+
*/
|
|
7
|
+
declare function Dialog$1(props: Dialog.Root.Props): JSX.Element;
|
|
8
|
+
/** Props of DialogTrigger. */
|
|
9
|
+
export type DialogTriggerProps = Omit<Dialog.Trigger.Props, 'className' | 'style'>;
|
|
10
|
+
/** The button that opens the dialog. */
|
|
11
|
+
export declare function DialogTrigger(props: DialogTriggerProps): JSX.Element;
|
|
12
|
+
/** Props of DialogClose. */
|
|
13
|
+
export type DialogCloseProps = Omit<Dialog.Close.Props, 'className' | 'style'>;
|
|
14
|
+
/** A button that closes the dialog, such as Cancel in the footer. */
|
|
15
|
+
export declare function DialogClose(props: DialogCloseProps): JSX.Element;
|
|
16
|
+
/** Props of DialogContent. */
|
|
17
|
+
export interface DialogContentProps extends Omit<Dialog.Popup.Props, 'className' | 'style'> {
|
|
18
|
+
/** Whether the corner close button shows. Defaults to true. */
|
|
19
|
+
showCloseButton?: boolean;
|
|
20
|
+
/** The accessible name of the corner close button. Defaults to Close. */
|
|
21
|
+
closeLabel?: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The panel: 480px wide, white, drawn with the ring outline and no shadow, with no scrim behind it. Put DialogHeader,
|
|
25
|
+
* the form and DialogFooter inside.
|
|
26
|
+
*/
|
|
27
|
+
export declare function DialogContent({ children, showCloseButton, closeLabel, ...props }: DialogContentProps): JSX.Element;
|
|
28
|
+
/** Props of DialogHeader. */
|
|
29
|
+
export type DialogHeaderProps = Omit<ComponentProps<'div'>, 'className' | 'style'>;
|
|
30
|
+
/** The title and description, stacked. */
|
|
31
|
+
export declare function DialogHeader(props: DialogHeaderProps): JSX.Element;
|
|
32
|
+
/** Props of DialogFooter. */
|
|
33
|
+
export type DialogFooterProps = Omit<ComponentProps<'div'>, 'className' | 'style'>;
|
|
34
|
+
/** The row of actions at the bottom, aligned to the end. */
|
|
35
|
+
export declare function DialogFooter(props: DialogFooterProps): JSX.Element;
|
|
36
|
+
/** Props of DialogTitle. */
|
|
37
|
+
export type DialogTitleProps = Omit<Dialog.Title.Props, 'className' | 'style'>;
|
|
38
|
+
/** The dialog's name, in the b4 style. It names the dialog for assistive technology. */
|
|
39
|
+
export declare function DialogTitle(props: DialogTitleProps): JSX.Element;
|
|
40
|
+
/** Props of DialogDescription. */
|
|
41
|
+
export type DialogDescriptionProps = Omit<Dialog.Description.Props, 'className' | 'style'>;
|
|
42
|
+
/** One line that says what the dialog is for, in subdued body text. */
|
|
43
|
+
export declare function DialogDescription(props: DialogDescriptionProps): JSX.Element;
|
|
44
|
+
export { Dialog$1 as Dialog };
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { cn } from "../../lib/cn.js";
|
|
2
|
+
import { Icon } from "../icon/Icon.js";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { Dialog } from "@base-ui/react/dialog";
|
|
5
|
+
// src/components/dialog/Dialog.tsx
|
|
6
|
+
/**
|
|
7
|
+
* The root of a dialog. It holds the open state and renders nothing itself. Pass `open` and `onOpenChange` to control it,
|
|
8
|
+
* or `defaultOpen` to leave it uncontrolled. The page behind is inert while it is open, with no scrim over it.
|
|
9
|
+
*/
|
|
10
|
+
function Dialog$1(props) {
|
|
11
|
+
return /* @__PURE__ */ jsx(Dialog.Root, { ...props });
|
|
12
|
+
}
|
|
13
|
+
/** The button that opens the dialog. */
|
|
14
|
+
function DialogTrigger(props) {
|
|
15
|
+
return /* @__PURE__ */ jsx(Dialog.Trigger, {
|
|
16
|
+
"data-slot": "dialog-trigger",
|
|
17
|
+
...props
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
/** A button that closes the dialog, such as Cancel in the footer. */
|
|
21
|
+
function DialogClose(props) {
|
|
22
|
+
return /* @__PURE__ */ jsx(Dialog.Close, {
|
|
23
|
+
"data-slot": "dialog-close",
|
|
24
|
+
...props
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The panel: 480px wide, white, drawn with the ring outline and no shadow, with no scrim behind it. Put DialogHeader,
|
|
29
|
+
* the form and DialogFooter inside.
|
|
30
|
+
*/
|
|
31
|
+
function DialogContent({ children, showCloseButton = true, closeLabel = "Close", ...props }) {
|
|
32
|
+
return /* @__PURE__ */ jsx(Dialog.Portal, { children: /* @__PURE__ */ jsxs(Dialog.Popup, {
|
|
33
|
+
"data-slot": "dialog-content",
|
|
34
|
+
className: "rt:fixed rt:inset-0 rt:z-50 rt:m-auto rt:flex rt:h-fit rt:max-h-full rt:w-120 rt:max-w-full rt:overflow-y-auto rt:flex-col rt:gap-6 rt:rounded-lg rt:bg-popover rt:p-6 rt:text-b3 rt:text-popover-foreground rt:shadow-ring-strong rt:forced-outline rt:focus-visible:focus-ring",
|
|
35
|
+
...props,
|
|
36
|
+
children: [children, showCloseButton && /* @__PURE__ */ jsx(Dialog.Close, {
|
|
37
|
+
"data-slot": "dialog-close",
|
|
38
|
+
"aria-label": closeLabel,
|
|
39
|
+
className: "rt:absolute rt:top-4 rt:right-4 rt:flex rt:size-7 rt:items-center rt:justify-center rt:rounded-md rt:text-icon rt:transition-colors rt:hover:bg-primary-tint rt:focus-visible:focus-ring",
|
|
40
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
41
|
+
name: "x",
|
|
42
|
+
size: 12
|
|
43
|
+
})
|
|
44
|
+
})]
|
|
45
|
+
}) });
|
|
46
|
+
}
|
|
47
|
+
/** The title and description, stacked. */
|
|
48
|
+
function DialogHeader(props) {
|
|
49
|
+
return /* @__PURE__ */ jsx("div", {
|
|
50
|
+
"data-slot": "dialog-header",
|
|
51
|
+
className: "rt:flex rt:flex-col rt:gap-1",
|
|
52
|
+
...props
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
/** The row of actions at the bottom, aligned to the end. */
|
|
56
|
+
function DialogFooter(props) {
|
|
57
|
+
return /* @__PURE__ */ jsx("div", {
|
|
58
|
+
"data-slot": "dialog-footer",
|
|
59
|
+
className: "rt:flex rt:items-center rt:justify-end rt:gap-2",
|
|
60
|
+
...props
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
/** The dialog's name, in the b4 style. It names the dialog for assistive technology. */
|
|
64
|
+
function DialogTitle(props) {
|
|
65
|
+
return /* @__PURE__ */ jsx(Dialog.Title, {
|
|
66
|
+
"data-slot": "dialog-title",
|
|
67
|
+
className: cn("rt:text-b4 rt:text-foreground-strong"),
|
|
68
|
+
...props
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
/** One line that says what the dialog is for, in subdued body text. */
|
|
72
|
+
function DialogDescription(props) {
|
|
73
|
+
return /* @__PURE__ */ jsx(Dialog.Description, {
|
|
74
|
+
"data-slot": "dialog-description",
|
|
75
|
+
className: "rt:text-b3 rt:text-foreground-subdued",
|
|
76
|
+
...props
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
export { Dialog$1 as Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { Dialog, DialogClose, DialogCloseProps, DialogContent, DialogContentProps, DialogDescription, DialogDescriptionProps, DialogFooter, DialogFooterProps, DialogHeader, DialogHeaderProps, DialogTitle, DialogTitleProps, DialogTrigger, DialogTriggerProps } from "./Dialog.js";
|
|
2
|
+
export { Dialog, DialogClose, type DialogCloseProps, DialogContent, type DialogContentProps, DialogDescription, type DialogDescriptionProps, DialogFooter, type DialogFooterProps, DialogHeader, type DialogHeaderProps, DialogTitle, type DialogTitleProps, DialogTrigger, type DialogTriggerProps };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger } from "./Dialog.js";
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { JSX, ReactNode } from "react";
|
|
2
|
+
import { Menu } from "@base-ui/react/menu";
|
|
3
|
+
/** Props of DropdownMenu, the root that holds the open state. It renders no element. */
|
|
4
|
+
export type DropdownMenuProps = Menu.Root.Props;
|
|
5
|
+
/** The root of a menu of actions that opens from a trigger. Compose it with DropdownMenuTrigger and DropdownMenuContent. */
|
|
6
|
+
export declare function DropdownMenu(props: DropdownMenuProps): JSX.Element;
|
|
7
|
+
/** Props of DropdownMenuTrigger. The trigger is a button; pass `render` to draw another element. */
|
|
8
|
+
export type DropdownMenuTriggerProps = Omit<Menu.Trigger.Props, 'className' | 'style'>;
|
|
9
|
+
/** The control that opens the menu. It is a button, and carries aria-expanded and aria-haspopup. */
|
|
10
|
+
export declare function DropdownMenuTrigger(props: DropdownMenuTriggerProps): JSX.Element;
|
|
11
|
+
/** Props of DropdownMenuContent. */
|
|
12
|
+
export interface DropdownMenuContentProps extends Omit<Menu.Popup.Props, 'className' | 'style'> {
|
|
13
|
+
/** Which side of the trigger the menu opens on. Defaults to bottom. */
|
|
14
|
+
side?: Menu.Positioner.Props['side'];
|
|
15
|
+
/** How the menu lines up with the trigger along that side. Defaults to start. */
|
|
16
|
+
align?: Menu.Positioner.Props['align'];
|
|
17
|
+
/** The gap between the trigger and the menu in px. Defaults to 4. */
|
|
18
|
+
sideOffset?: number;
|
|
19
|
+
/** A shift along the side in px. Defaults to 0. */
|
|
20
|
+
alignOffset?: number;
|
|
21
|
+
}
|
|
22
|
+
/** The menu panel: a white popup with a hairline ring, 8px corners and no shadow. It opens in a portal. */
|
|
23
|
+
export declare function DropdownMenuContent({ side, align, sideOffset, alignOffset, ...props }: DropdownMenuContentProps): JSX.Element;
|
|
24
|
+
/** Props of DropdownMenuGroup: Base UI's group props, except className and style. */
|
|
25
|
+
export type DropdownMenuGroupProps = Omit<Menu.Group.Props, 'className' | 'style'>;
|
|
26
|
+
/** Groups items under one DropdownMenuLabel, so assistive technology announces the label with the group. */
|
|
27
|
+
export declare function DropdownMenuGroup(props: DropdownMenuGroupProps): JSX.Element;
|
|
28
|
+
/** Props of DropdownMenuLabel. */
|
|
29
|
+
export type DropdownMenuLabelProps = Omit<Menu.GroupLabel.Props, 'className' | 'style'>;
|
|
30
|
+
/** The caption of a group, in the design system's label style: 12px, uppercase, subdued. Place it inside DropdownMenuGroup. */
|
|
31
|
+
export declare function DropdownMenuLabel(props: DropdownMenuLabelProps): JSX.Element;
|
|
32
|
+
/** Props of DropdownMenuItem. */
|
|
33
|
+
export interface DropdownMenuItemProps extends Omit<Menu.Item.Props, 'className' | 'style'> {
|
|
34
|
+
/** What the item means. destructive is drawn in the destructive token; a delete action also needs a confirm step. Defaults to default. */
|
|
35
|
+
variant?: 'default' | 'destructive';
|
|
36
|
+
}
|
|
37
|
+
/** One action in the menu. It runs onClick and closes the menu; disabled is drawn at half opacity and cannot be chosen. */
|
|
38
|
+
export declare function DropdownMenuItem({ variant, ...props }: DropdownMenuItemProps): JSX.Element;
|
|
39
|
+
/** Props of DropdownMenuShortcut. */
|
|
40
|
+
export interface DropdownMenuShortcutProps {
|
|
41
|
+
/** The key hint, such as ⌘E. It is text only and does not bind a key. */
|
|
42
|
+
children: ReactNode;
|
|
43
|
+
}
|
|
44
|
+
/** A key hint pushed to the end of an item. It is a hint only: the host binds the key. */
|
|
45
|
+
export declare function DropdownMenuShortcut({ children }: DropdownMenuShortcutProps): JSX.Element;
|
|
46
|
+
/** Props of DropdownMenuSeparator. */
|
|
47
|
+
export type DropdownMenuSeparatorProps = Omit<Menu.Separator.Props, 'className' | 'style'>;
|
|
48
|
+
/** A hairline between groups of items. */
|
|
49
|
+
export declare function DropdownMenuSeparator(props: DropdownMenuSeparatorProps): JSX.Element;
|
|
50
|
+
/** Props of DropdownMenuSub, the root of a submenu. It renders no element. */
|
|
51
|
+
export type DropdownMenuSubProps = Menu.SubmenuRoot.Props;
|
|
52
|
+
/** The root of a nested menu. Hold a DropdownMenuSubTrigger and a DropdownMenuSubContent. */
|
|
53
|
+
export declare function DropdownMenuSub(props: DropdownMenuSubProps): JSX.Element;
|
|
54
|
+
/** Props of DropdownMenuSubTrigger. */
|
|
55
|
+
export type DropdownMenuSubTriggerProps = Omit<Menu.SubmenuTrigger.Props, 'className' | 'style'>;
|
|
56
|
+
/** The item that opens a submenu, on hover, click or ArrowRight. A chevron at its end marks it. */
|
|
57
|
+
export declare function DropdownMenuSubTrigger({ children, ...props }: DropdownMenuSubTriggerProps): JSX.Element;
|
|
58
|
+
/** Props of DropdownMenuSubContent. */
|
|
59
|
+
export type DropdownMenuSubContentProps = DropdownMenuContentProps;
|
|
60
|
+
/** The panel of a submenu. It opens to the side of its trigger. */
|
|
61
|
+
export declare function DropdownMenuSubContent({ side, alignOffset, sideOffset, ...props }: DropdownMenuSubContentProps): JSX.Element;
|
|
62
|
+
/** Props of DropdownMenuCheckboxItem. */
|
|
63
|
+
export type DropdownMenuCheckboxItemProps = Omit<Menu.CheckboxItem.Props, 'className' | 'style'>;
|
|
64
|
+
/** An item that toggles an option. A check shows at its start while it is on and keeps the menu open, so several options can be changed in one visit. */
|
|
65
|
+
export declare function DropdownMenuCheckboxItem({ children, ...props }: DropdownMenuCheckboxItemProps): JSX.Element;
|
|
66
|
+
/** Props of DropdownMenuRadioGroup: Base UI's radio group props, except className and style. */
|
|
67
|
+
export type DropdownMenuRadioGroupProps = Omit<Menu.RadioGroup.Props, 'className' | 'style'>;
|
|
68
|
+
/** Holds radio items and the one chosen value. */
|
|
69
|
+
export declare function DropdownMenuRadioGroup(props: DropdownMenuRadioGroupProps): JSX.Element;
|
|
70
|
+
/** Props of DropdownMenuRadioItem. */
|
|
71
|
+
export type DropdownMenuRadioItemProps = Omit<Menu.RadioItem.Props, 'className' | 'style'>;
|
|
72
|
+
/** One choice of a DropdownMenuRadioGroup. A dot shows at its start while it is the chosen value. */
|
|
73
|
+
export declare function DropdownMenuRadioItem({ children, ...props }: DropdownMenuRadioItemProps): JSX.Element;
|