@forte-ui/react 1.0.0-alpha.1
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 +240 -0
- package/dist/Accordion-9JunkjgY.js +111 -0
- package/dist/Alert-Cn_WUF3L.js +183 -0
- package/dist/AspectRatio-gSjpTVk-.js +39 -0
- package/dist/Avatar-BuitDluH.js +87 -0
- package/dist/Badge-sArNWMre.js +33 -0
- package/dist/Breadcrumb-Cq7tFtMX.js +170 -0
- package/dist/Button-AiyKnx5I.js +42 -0
- package/dist/ButtonGroup-C-CrwPXP.js +54 -0
- package/dist/Calendar-D7Q-QJ_e.js +503 -0
- package/dist/Checkbox-DfNbmOed.js +56 -0
- package/dist/Collapsible-D8UKiGip.js +86 -0
- package/dist/ColorPicker-B-eCI31W.js +612 -0
- package/dist/Combobox-D-BN-Tvp.js +302 -0
- package/dist/ContextMenu-D81uDaMG.js +44 -0
- package/dist/DatePicker-CfkMsaI-.js +192 -0
- package/dist/Dialog-_n8FpFs5.js +432 -0
- package/dist/Drawer-DKQF3OO7.js +158 -0
- package/dist/Field-FLFEO70D.js +58 -0
- package/dist/Fieldset-CYhh71Qt.js +28 -0
- package/dist/Form-DVPmW9XV.js +17 -0
- package/dist/Input-BgGWhO2q.js +18 -0
- package/dist/InputGroup-DsZyDXNn.js +89 -0
- package/dist/Menu-CKu9xE2h.js +261 -0
- package/dist/Menubar-Dax027Db.js +19 -0
- package/dist/NavList-DGvcIoJm.js +176 -0
- package/dist/NavigationMenu-BayQkUUb.js +209 -0
- package/dist/NumberField-P55SA8T7.js +191 -0
- package/dist/OTPField-CjHvBNSN.js +55 -0
- package/dist/Popover-BXhn2Wwt.js +142 -0
- package/dist/PreviewCard-Dnitrky0.js +99 -0
- package/dist/Progress-BlomDp-X.js +81 -0
- package/dist/ProgressCircle-j6XBl0fk.js +112 -0
- package/dist/Radio-BIcX4INJ.js +37 -0
- package/dist/Resizable-7nJJM97e.js +609 -0
- package/dist/ScrollArea-CBMGJ6hh.js +83 -0
- package/dist/Select-BP-zvdXm.js +237 -0
- package/dist/Separator-DewJBzaJ.js +21 -0
- package/dist/Skeleton-zr6ObCCq.js +79 -0
- package/dist/Slider-Bh8_cti1.js +104 -0
- package/dist/Spinner-BF0uD4hR.js +53 -0
- package/dist/Switch-OBewMMvM.js +39 -0
- package/dist/Tabs-LgkSbPSF.js +132 -0
- package/dist/Textarea-CqZJL41e.js +51 -0
- package/dist/Toast-BWayxAcd.js +304 -0
- package/dist/Toggle-BrhMnkF5.js +45 -0
- package/dist/Toolbar-OmOVCk3i.js +88 -0
- package/dist/Tooltip-CI4chsRw.js +101 -0
- package/dist/clsx-By2n9mTe.js +16 -0
- package/dist/cn.d.ts +8 -0
- package/dist/cn.js +11 -0
- package/dist/components/accordion/Accordion.d.ts +117 -0
- package/dist/components/accordion/Accordion.js +3 -0
- package/dist/components/accordion/index.d.ts +2 -0
- package/dist/components/accordion/index.js +2 -0
- package/dist/components/alert/Alert.d.ts +167 -0
- package/dist/components/alert/Alert.js +3 -0
- package/dist/components/alert/index.d.ts +2 -0
- package/dist/components/alert/index.js +2 -0
- package/dist/components/aspect-ratio/AspectRatio.d.ts +128 -0
- package/dist/components/aspect-ratio/AspectRatio.js +3 -0
- package/dist/components/aspect-ratio/index.d.ts +2 -0
- package/dist/components/aspect-ratio/index.js +2 -0
- package/dist/components/avatar/Avatar.d.ts +176 -0
- package/dist/components/avatar/Avatar.js +3 -0
- package/dist/components/avatar/index.d.ts +2 -0
- package/dist/components/avatar/index.js +2 -0
- package/dist/components/badge/Badge.d.ts +117 -0
- package/dist/components/badge/Badge.js +3 -0
- package/dist/components/badge/index.d.ts +2 -0
- package/dist/components/badge/index.js +2 -0
- package/dist/components/breadcrumb/Breadcrumb.d.ts +244 -0
- package/dist/components/breadcrumb/Breadcrumb.js +3 -0
- package/dist/components/breadcrumb/index.d.ts +2 -0
- package/dist/components/breadcrumb/index.js +2 -0
- package/dist/components/button/Button.d.ts +73 -0
- package/dist/components/button/Button.js +3 -0
- package/dist/components/button/index.d.ts +2 -0
- package/dist/components/button/index.js +2 -0
- package/dist/components/button-group/ButtonGroup.d.ts +113 -0
- package/dist/components/button-group/ButtonGroup.js +3 -0
- package/dist/components/button-group/index.d.ts +2 -0
- package/dist/components/button-group/index.js +2 -0
- package/dist/components/calendar/Calendar.d.ts +201 -0
- package/dist/components/calendar/Calendar.js +3 -0
- package/dist/components/calendar/index.d.ts +2 -0
- package/dist/components/calendar/index.js +2 -0
- package/dist/components/checkbox/Checkbox.d.ts +130 -0
- package/dist/components/checkbox/Checkbox.js +3 -0
- package/dist/components/checkbox/index.d.ts +2 -0
- package/dist/components/checkbox/index.js +2 -0
- package/dist/components/collapsible/Collapsible.d.ts +91 -0
- package/dist/components/collapsible/Collapsible.js +3 -0
- package/dist/components/collapsible/index.d.ts +2 -0
- package/dist/components/collapsible/index.js +2 -0
- package/dist/components/color-picker/ColorPicker.d.ts +553 -0
- package/dist/components/color-picker/ColorPicker.js +4 -0
- package/dist/components/color-picker/color.d.ts +102 -0
- package/dist/components/color-picker/color.js +249 -0
- package/dist/components/color-picker/index.d.ts +2 -0
- package/dist/components/color-picker/index.js +3 -0
- package/dist/components/combobox/Combobox.d.ts +553 -0
- package/dist/components/combobox/Combobox.js +3 -0
- package/dist/components/combobox/index.d.ts +2 -0
- package/dist/components/combobox/index.js +2 -0
- package/dist/components/context-menu/ContextMenu.d.ts +103 -0
- package/dist/components/context-menu/ContextMenu.js +3 -0
- package/dist/components/context-menu/index.d.ts +3 -0
- package/dist/components/context-menu/index.js +2 -0
- package/dist/components/date-picker/DatePicker.d.ts +268 -0
- package/dist/components/date-picker/DatePicker.js +3 -0
- package/dist/components/date-picker/index.d.ts +2 -0
- package/dist/components/date-picker/index.js +2 -0
- package/dist/components/dialog/Dialog.d.ts +567 -0
- package/dist/components/dialog/Dialog.js +3 -0
- package/dist/components/dialog/index.d.ts +2 -0
- package/dist/components/dialog/index.js +2 -0
- package/dist/components/drawer/Drawer.d.ts +351 -0
- package/dist/components/drawer/Drawer.js +3 -0
- package/dist/components/drawer/index.d.ts +2 -0
- package/dist/components/drawer/index.js +2 -0
- package/dist/components/field/Field.d.ts +170 -0
- package/dist/components/field/Field.js +3 -0
- package/dist/components/field/index.d.ts +2 -0
- package/dist/components/field/index.js +2 -0
- package/dist/components/fieldset/Fieldset.d.ts +60 -0
- package/dist/components/fieldset/Fieldset.js +3 -0
- package/dist/components/fieldset/index.d.ts +2 -0
- package/dist/components/fieldset/index.js +2 -0
- package/dist/components/form/Form.d.ts +76 -0
- package/dist/components/form/Form.js +3 -0
- package/dist/components/form/index.d.ts +2 -0
- package/dist/components/form/index.js +2 -0
- package/dist/components/input/Input.d.ts +67 -0
- package/dist/components/input/Input.js +3 -0
- package/dist/components/input/index.d.ts +2 -0
- package/dist/components/input/index.js +2 -0
- package/dist/components/input-group/InputGroup.d.ts +214 -0
- package/dist/components/input-group/InputGroup.js +3 -0
- package/dist/components/input-group/index.d.ts +2 -0
- package/dist/components/input-group/index.js +2 -0
- package/dist/components/menu/Menu.d.ts +587 -0
- package/dist/components/menu/Menu.js +3 -0
- package/dist/components/menu/index.d.ts +2 -0
- package/dist/components/menu/index.js +2 -0
- package/dist/components/menubar/Menubar.d.ts +104 -0
- package/dist/components/menubar/Menubar.js +3 -0
- package/dist/components/menubar/index.d.ts +2 -0
- package/dist/components/menubar/index.js +2 -0
- package/dist/components/nav-list/NavList.d.ts +290 -0
- package/dist/components/nav-list/NavList.js +3 -0
- package/dist/components/nav-list/index.d.ts +2 -0
- package/dist/components/nav-list/index.js +2 -0
- package/dist/components/navigation-menu/NavigationMenu.d.ts +483 -0
- package/dist/components/navigation-menu/NavigationMenu.js +3 -0
- package/dist/components/navigation-menu/index.d.ts +2 -0
- package/dist/components/navigation-menu/index.js +2 -0
- package/dist/components/number-field/NumberField.d.ts +303 -0
- package/dist/components/number-field/NumberField.js +3 -0
- package/dist/components/number-field/index.d.ts +2 -0
- package/dist/components/number-field/index.js +2 -0
- package/dist/components/otp-field/OTPField.d.ts +206 -0
- package/dist/components/otp-field/OTPField.js +3 -0
- package/dist/components/otp-field/index.d.ts +2 -0
- package/dist/components/otp-field/index.js +2 -0
- package/dist/components/popover/Popover.d.ts +394 -0
- package/dist/components/popover/Popover.js +3 -0
- package/dist/components/popover/index.d.ts +2 -0
- package/dist/components/popover/index.js +2 -0
- package/dist/components/preview-card/PreviewCard.d.ts +307 -0
- package/dist/components/preview-card/PreviewCard.js +3 -0
- package/dist/components/preview-card/index.d.ts +2 -0
- package/dist/components/preview-card/index.js +2 -0
- package/dist/components/progress/Progress.d.ts +156 -0
- package/dist/components/progress/Progress.js +3 -0
- package/dist/components/progress/ProgressCircle.d.ts +166 -0
- package/dist/components/progress/ProgressCircle.js +3 -0
- package/dist/components/progress/index.d.ts +4 -0
- package/dist/components/progress/index.js +3 -0
- package/dist/components/radio/Radio.d.ts +144 -0
- package/dist/components/radio/Radio.js +3 -0
- package/dist/components/radio/index.d.ts +2 -0
- package/dist/components/radio/index.js +2 -0
- package/dist/components/resizable/Resizable.d.ts +211 -0
- package/dist/components/resizable/Resizable.js +3 -0
- package/dist/components/resizable/index.d.ts +2 -0
- package/dist/components/resizable/index.js +2 -0
- package/dist/components/scroll-area/ScrollArea.d.ts +113 -0
- package/dist/components/scroll-area/ScrollArea.js +3 -0
- package/dist/components/scroll-area/index.d.ts +2 -0
- package/dist/components/scroll-area/index.js +2 -0
- package/dist/components/select/Select.d.ts +345 -0
- package/dist/components/select/Select.js +3 -0
- package/dist/components/select/index.d.ts +2 -0
- package/dist/components/select/index.js +2 -0
- package/dist/components/separator/Separator.d.ts +75 -0
- package/dist/components/separator/Separator.js +3 -0
- package/dist/components/separator/index.d.ts +2 -0
- package/dist/components/separator/index.js +2 -0
- package/dist/components/skeleton/Skeleton.d.ts +169 -0
- package/dist/components/skeleton/Skeleton.js +3 -0
- package/dist/components/skeleton/index.d.ts +2 -0
- package/dist/components/skeleton/index.js +2 -0
- package/dist/components/slider/Slider.d.ts +208 -0
- package/dist/components/slider/Slider.js +3 -0
- package/dist/components/slider/index.d.ts +2 -0
- package/dist/components/slider/index.js +2 -0
- package/dist/components/spinner/Spinner.d.ts +92 -0
- package/dist/components/spinner/Spinner.js +3 -0
- package/dist/components/spinner/index.d.ts +2 -0
- package/dist/components/spinner/index.js +2 -0
- package/dist/components/switch/Switch.d.ts +80 -0
- package/dist/components/switch/Switch.js +3 -0
- package/dist/components/switch/index.d.ts +2 -0
- package/dist/components/switch/index.js +2 -0
- package/dist/components/tabs/Tabs.d.ts +125 -0
- package/dist/components/tabs/Tabs.js +3 -0
- package/dist/components/tabs/index.d.ts +2 -0
- package/dist/components/tabs/index.js +2 -0
- package/dist/components/textarea/Textarea.d.ts +119 -0
- package/dist/components/textarea/Textarea.js +3 -0
- package/dist/components/textarea/index.d.ts +2 -0
- package/dist/components/textarea/index.js +2 -0
- package/dist/components/toast/Toast.d.ts +517 -0
- package/dist/components/toast/Toast.js +3 -0
- package/dist/components/toast/index.d.ts +2 -0
- package/dist/components/toast/index.js +2 -0
- package/dist/components/toggle/Toggle.d.ts +171 -0
- package/dist/components/toggle/Toggle.js +3 -0
- package/dist/components/toggle/index.d.ts +2 -0
- package/dist/components/toggle/index.js +2 -0
- package/dist/components/toolbar/Toolbar.d.ts +318 -0
- package/dist/components/toolbar/Toolbar.js +3 -0
- package/dist/components/toolbar/index.d.ts +2 -0
- package/dist/components/toolbar/index.js +2 -0
- package/dist/components/tooltip/Tooltip.d.ts +361 -0
- package/dist/components/tooltip/Tooltip.js +3 -0
- package/dist/components/tooltip/index.d.ts +2 -0
- package/dist/components/tooltip/index.js +2 -0
- package/dist/index.d.ts +92 -0
- package/dist/index.js +86 -0
- package/dist/styles/Accordion.css +1 -0
- package/dist/styles/Alert.css +1 -0
- package/dist/styles/AspectRatio.css +1 -0
- package/dist/styles/Avatar.css +1 -0
- package/dist/styles/Badge.css +1 -0
- package/dist/styles/Breadcrumb.css +1 -0
- package/dist/styles/Button.css +1 -0
- package/dist/styles/ButtonGroup.css +1 -0
- package/dist/styles/Calendar.css +1 -0
- package/dist/styles/Checkbox.css +1 -0
- package/dist/styles/Collapsible.css +1 -0
- package/dist/styles/ColorPicker.css +1 -0
- package/dist/styles/Combobox.css +1 -0
- package/dist/styles/ContextMenu.css +1 -0
- package/dist/styles/DatePicker.css +1 -0
- package/dist/styles/Dialog.css +1 -0
- package/dist/styles/Drawer.css +1 -0
- package/dist/styles/Field.css +1 -0
- package/dist/styles/Fieldset.css +1 -0
- package/dist/styles/Form.css +1 -0
- package/dist/styles/Input.css +1 -0
- package/dist/styles/InputGroup.css +1 -0
- package/dist/styles/Menu.css +1 -0
- package/dist/styles/Menubar.css +1 -0
- package/dist/styles/NavList.css +1 -0
- package/dist/styles/NavigationMenu.css +1 -0
- package/dist/styles/NumberField.css +1 -0
- package/dist/styles/OTPField.css +1 -0
- package/dist/styles/Popover.css +1 -0
- package/dist/styles/PreviewCard.css +1 -0
- package/dist/styles/Progress.css +1 -0
- package/dist/styles/ProgressCircle.css +1 -0
- package/dist/styles/Radio.css +1 -0
- package/dist/styles/Resizable.css +1 -0
- package/dist/styles/ScrollArea.css +1 -0
- package/dist/styles/Select.css +1 -0
- package/dist/styles/Separator.css +1 -0
- package/dist/styles/Skeleton.css +1 -0
- package/dist/styles/Slider.css +1 -0
- package/dist/styles/Spinner.css +1 -0
- package/dist/styles/Switch.css +1 -0
- package/dist/styles/Tabs.css +1 -0
- package/dist/styles/Textarea.css +1 -0
- package/dist/styles/Toast.css +1 -0
- package/dist/styles/Toggle.css +1 -0
- package/dist/styles/Toolbar.css +1 -0
- package/dist/styles/Tooltip.css +1 -0
- package/dist/styles/a11y.css +119 -0
- package/dist/styles/layers.css +39 -0
- package/dist/styles/motion.css +194 -0
- package/dist/styles/patterns.css +236 -0
- package/dist/styles/properties.css +62 -0
- package/dist/styles/reset.css +11 -0
- package/dist/styles/tailwind.css +281 -0
- package/dist/styles/theme.css +57 -0
- package/dist/styles/tokens.color.css +223 -0
- package/dist/styles/tokens.css +460 -0
- package/dist/tailwind-merge.d.ts +52 -0
- package/dist/tailwind-merge.js +52 -0
- package/docs-data/props.json +8047 -0
- package/docs-data/theming.json +9600 -0
- package/docs-data/tokens.json +4070 -0
- package/package.json +78 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { ButtonVariant } from '../button';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
export type CalendarMode = "single" | "multiple" | "range";
|
|
4
|
+
export type CalendarSize = "sm" | "md" | "lg";
|
|
5
|
+
export type CalendarCaptionLayout = "label" | "dropdown" | "dropdown-months" | "dropdown-years";
|
|
6
|
+
/** A contiguous span of days. `to` is absent while the second end is still being picked. */
|
|
7
|
+
export interface CalendarRange {
|
|
8
|
+
from: Date;
|
|
9
|
+
to?: Date | undefined;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* What `selected` holds for a given `mode`. This is the type that makes
|
|
13
|
+
* `onSelect={setDate}` typecheck against a plain `useState<Date>()` — the
|
|
14
|
+
* component is generic over its mode so the callback is not widened to the
|
|
15
|
+
* union of all three shapes.
|
|
16
|
+
*/
|
|
17
|
+
export type CalendarSelection<M extends CalendarMode = "single"> = M extends "single" ? Date : M extends "multiple" ? Date[] : CalendarRange;
|
|
18
|
+
/**
|
|
19
|
+
* Describes a SET of days — what `disabled` takes.
|
|
20
|
+
*
|
|
21
|
+
* `{ before, after }` given together is the exclusive interval between them —
|
|
22
|
+
* after `after` AND before `before` — which is how you disable a gap in the
|
|
23
|
+
* middle. Either one alone is the open-ended half you would expect.
|
|
24
|
+
*/
|
|
25
|
+
export type CalendarMatcher = boolean | Date | CalendarRange | {
|
|
26
|
+
before?: Date;
|
|
27
|
+
after?: Date;
|
|
28
|
+
} | {
|
|
29
|
+
dayOfWeek: number | number[];
|
|
30
|
+
} | ((date: Date) => boolean) | readonly CalendarMatcher[];
|
|
31
|
+
/** Strings the component speaks. Override them to localise the chrome. */
|
|
32
|
+
export interface CalendarLabels {
|
|
33
|
+
/** Accessible name of the whole calendar. @default "Calendar" */
|
|
34
|
+
calendar?: string;
|
|
35
|
+
/** Accessible name of the back arrow. @default "Previous month" */
|
|
36
|
+
previousMonth?: string;
|
|
37
|
+
/** Accessible name of the forward arrow. @default "Next month" */
|
|
38
|
+
nextMonth?: string;
|
|
39
|
+
/** Accessible name of the month dropdown. @default "Month" */
|
|
40
|
+
monthDropdown?: string;
|
|
41
|
+
/** Accessible name of the year dropdown. @default "Year" */
|
|
42
|
+
yearDropdown?: string;
|
|
43
|
+
/** Accessible name of the week-number column. @default "Week" */
|
|
44
|
+
weekNumber?: string;
|
|
45
|
+
}
|
|
46
|
+
export interface CalendarProps<M extends CalendarMode = "single"> extends Omit<React.ComponentPropsWithoutRef<"div">, "className" | "onSelect" | "defaultValue" | "children"> {
|
|
47
|
+
/**
|
|
48
|
+
* How many days can be picked at once. `"single"` selects one `Date`,
|
|
49
|
+
* `"multiple"` a `Date[]`, `"range"` a `{ from, to }` object.
|
|
50
|
+
* @default "single"
|
|
51
|
+
*/
|
|
52
|
+
mode?: M;
|
|
53
|
+
/**
|
|
54
|
+
* The current selection. Pass it with `onSelect` to control the calendar;
|
|
55
|
+
* leave it off entirely to let the calendar own its state.
|
|
56
|
+
*/
|
|
57
|
+
selected?: CalendarSelection<M> | null;
|
|
58
|
+
/** The selection an uncontrolled calendar starts with. */
|
|
59
|
+
defaultSelected?: CalendarSelection<M> | null;
|
|
60
|
+
/**
|
|
61
|
+
* Called with the next selection and the day that was clicked. The
|
|
62
|
+
* selection is `null` once the last pick is cleared, so a controlled
|
|
63
|
+
* `useState<Date>()` takes it directly.
|
|
64
|
+
*/
|
|
65
|
+
onSelect?: (selection: CalendarSelection<M> | null, day: Date) => void;
|
|
66
|
+
/**
|
|
67
|
+
* Keep at least one day selected: clicking the current selection no longer
|
|
68
|
+
* clears it.
|
|
69
|
+
* @default false
|
|
70
|
+
*/
|
|
71
|
+
required?: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* The month on display, as any date within it. Pass it with `onMonthChange`
|
|
74
|
+
* to drive navigation yourself.
|
|
75
|
+
*/
|
|
76
|
+
month?: Date;
|
|
77
|
+
/**
|
|
78
|
+
* The month an uncontrolled calendar opens on.
|
|
79
|
+
* @default the month of the selection, or the current month
|
|
80
|
+
*/
|
|
81
|
+
defaultMonth?: Date;
|
|
82
|
+
/** Called with the first day of the new leading month whenever navigation moves. */
|
|
83
|
+
onMonthChange?: (month: Date) => void;
|
|
84
|
+
/**
|
|
85
|
+
* How many months to show side by side.
|
|
86
|
+
* @default 1
|
|
87
|
+
*/
|
|
88
|
+
numberOfMonths?: number;
|
|
89
|
+
/**
|
|
90
|
+
* Move a whole page at a time — with `numberOfMonths={2}`, the arrows jump
|
|
91
|
+
* two months instead of one.
|
|
92
|
+
* @default false
|
|
93
|
+
*/
|
|
94
|
+
pagedNavigation?: boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Earliest selectable day. Also stops navigation and trims the year
|
|
97
|
+
* dropdown, so one prop bounds the calendar in every direction at once.
|
|
98
|
+
*/
|
|
99
|
+
minDate?: Date;
|
|
100
|
+
/** Latest selectable day. The upper half of `minDate`. */
|
|
101
|
+
maxDate?: Date;
|
|
102
|
+
/**
|
|
103
|
+
* Days that cannot be picked, as a date, a range, `{ before }` / `{ after }`,
|
|
104
|
+
* `{ dayOfWeek }`, a predicate, or an array of any of those. Disabled days
|
|
105
|
+
* stay focusable so keyboard navigation can cross them.
|
|
106
|
+
*/
|
|
107
|
+
disabled?: CalendarMatcher;
|
|
108
|
+
/**
|
|
109
|
+
* BCP 47 tag used for every month, weekday and day name.
|
|
110
|
+
*
|
|
111
|
+
* Pinned rather than left to the runtime on purpose: `undefined` resolves
|
|
112
|
+
* to the server's locale during SSR and the browser's on the client, and
|
|
113
|
+
* "August" hydrating over "août" is a mismatch React can only fix by
|
|
114
|
+
* throwing the markup away.
|
|
115
|
+
* @default "en-US"
|
|
116
|
+
*/
|
|
117
|
+
locale?: string;
|
|
118
|
+
/**
|
|
119
|
+
* First column of the week — 0 is Sunday, 1 Monday, 6 Saturday. Not derived
|
|
120
|
+
* from `locale`: `Intl` cannot be asked for it in every browser, and a
|
|
121
|
+
* silent fallback would move the columns under some of your users and not
|
|
122
|
+
* others.
|
|
123
|
+
* @default 0
|
|
124
|
+
*/
|
|
125
|
+
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
126
|
+
/**
|
|
127
|
+
* Fill the first and last rows with the neighbouring months' days instead
|
|
128
|
+
* of leaving them blank.
|
|
129
|
+
* @default true
|
|
130
|
+
*/
|
|
131
|
+
showOutsideDays?: boolean;
|
|
132
|
+
/**
|
|
133
|
+
* Always render six rows, so the calendar keeps one height all year and a
|
|
134
|
+
* popover containing it never resizes as you page through it.
|
|
135
|
+
* @default false
|
|
136
|
+
*/
|
|
137
|
+
fixedWeeks?: boolean;
|
|
138
|
+
/**
|
|
139
|
+
* Add a leading column of ISO 8601 week numbers.
|
|
140
|
+
* @default false
|
|
141
|
+
*/
|
|
142
|
+
showWeekNumbers?: boolean;
|
|
143
|
+
/**
|
|
144
|
+
* What sits between the arrows: a static month and year, or dropdowns for
|
|
145
|
+
* one or both. Dropdowns turn a birthday twenty years back into two clicks
|
|
146
|
+
* instead of two hundred and forty.
|
|
147
|
+
* @default "label"
|
|
148
|
+
*/
|
|
149
|
+
captionLayout?: CalendarCaptionLayout;
|
|
150
|
+
/**
|
|
151
|
+
* Cell size and text size. Follows the ambient `data-forte-density` too.
|
|
152
|
+
* @default "md"
|
|
153
|
+
*/
|
|
154
|
+
size?: CalendarSize;
|
|
155
|
+
/**
|
|
156
|
+
* Visual weight of the two navigation arrows — any `Button` variant.
|
|
157
|
+
* @default "ghost"
|
|
158
|
+
*/
|
|
159
|
+
navVariant?: ButtonVariant;
|
|
160
|
+
/**
|
|
161
|
+
* Rendered under the grid inside a `role="status"` region, so a summary
|
|
162
|
+
* like "3 nights selected" is announced as it changes.
|
|
163
|
+
*/
|
|
164
|
+
footer?: React.ReactNode;
|
|
165
|
+
/**
|
|
166
|
+
* Focus the calendar's active day on mount. Use it when the calendar opens
|
|
167
|
+
* in a popover, not on a calendar sitting in the page.
|
|
168
|
+
* @default false
|
|
169
|
+
*/
|
|
170
|
+
autoFocus?: boolean;
|
|
171
|
+
/** Today's date. Override it to pin the "today" marker in tests or stories. */
|
|
172
|
+
today?: Date;
|
|
173
|
+
/** Chrome strings — arrow and dropdown labels. Merged over the English defaults. */
|
|
174
|
+
labels?: CalendarLabels;
|
|
175
|
+
/**
|
|
176
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
177
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
178
|
+
*/
|
|
179
|
+
className?: string;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* A month grid for picking one day, several days, or a range.
|
|
183
|
+
*
|
|
184
|
+
* ```tsx
|
|
185
|
+
* const [date, setDate] = React.useState<Date>();
|
|
186
|
+
*
|
|
187
|
+
* <Calendar mode="single" selected={date} onSelect={setDate} />
|
|
188
|
+
* ```
|
|
189
|
+
*
|
|
190
|
+
* It owns no date library. Month arithmetic goes through the `Date`
|
|
191
|
+
* constructor (DST-safe by construction) and every name on screen comes from
|
|
192
|
+
* `Intl.DateTimeFormat`, so the whole component adds nothing to a consumer's
|
|
193
|
+
* bundle beyond itself.
|
|
194
|
+
*
|
|
195
|
+
* The grid is a real `<table role="grid">` with a roving tabindex: one Tab
|
|
196
|
+
* stop for the whole calendar, arrows to move a day, <kbd>Page Up</kbd> /
|
|
197
|
+
* <kbd>Page Down</kbd> to move a month, and <kbd>Shift</kbd> with either to
|
|
198
|
+
* move a year. Days that cannot be picked are `aria-disabled` rather than
|
|
199
|
+
* `disabled`, so navigation can cross them.
|
|
200
|
+
*/
|
|
201
|
+
export declare const Calendar: <M extends CalendarMode = "single">(props: CalendarProps<M> & React.RefAttributes<HTMLDivElement>) => React.ReactElement;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { Checkbox as BaseCheckbox } from '@base-ui/react/checkbox';
|
|
2
|
+
import { CheckboxGroup as BaseCheckboxGroup } from '@base-ui/react/checkbox-group';
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
export type CheckboxSize = "sm" | "md" | "lg";
|
|
5
|
+
export type CheckboxTone = "primary" | "secondary" | "danger" | "neutral";
|
|
6
|
+
export type CheckboxGroupOrientation = "vertical" | "horizontal";
|
|
7
|
+
type BaseCheckboxRootProps = React.ComponentPropsWithoutRef<typeof BaseCheckbox.Root>;
|
|
8
|
+
type BaseCheckboxGroupProps = React.ComponentPropsWithoutRef<typeof BaseCheckboxGroup>;
|
|
9
|
+
export interface CheckboxProps extends Omit<BaseCheckboxRootProps, "className" | "children"> {
|
|
10
|
+
/**
|
|
11
|
+
* Size of the box. The tick scales with it, so the mark keeps its optical
|
|
12
|
+
* weight at every size.
|
|
13
|
+
* @default "md"
|
|
14
|
+
*/
|
|
15
|
+
size?: CheckboxSize;
|
|
16
|
+
/**
|
|
17
|
+
* Which semantic colour set the checked fill draws from. Inside a
|
|
18
|
+
* `Field.Root` an invalid field overrides this with the danger palette, so
|
|
19
|
+
* a validation error always reads as an error.
|
|
20
|
+
* @default "primary"
|
|
21
|
+
*/
|
|
22
|
+
tone?: CheckboxTone;
|
|
23
|
+
/**
|
|
24
|
+
* Whether the checkbox is currently ticked. Pairs with `onCheckedChange` for
|
|
25
|
+
* a controlled checkbox; use `defaultChecked` for an uncontrolled one.
|
|
26
|
+
* @default undefined
|
|
27
|
+
*/
|
|
28
|
+
checked?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Whether the checkbox starts ticked when uncontrolled.
|
|
31
|
+
* @default false
|
|
32
|
+
*/
|
|
33
|
+
defaultChecked?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Mixed state: neither ticked nor unticked. Renders a dash instead of a
|
|
36
|
+
* tick and sets `data-indeterminate` on both the root and the indicator.
|
|
37
|
+
* Independent of `checked` — a checkbox that is indeterminate submits
|
|
38
|
+
* whatever `checked` says it submits.
|
|
39
|
+
* @default false
|
|
40
|
+
*/
|
|
41
|
+
indeterminate?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Marks this checkbox as the one that controls every other checkbox in the
|
|
44
|
+
* group. Only works inside a `CheckboxGroup` that has been given `value`
|
|
45
|
+
* and `allValues`; outside one it does nothing at all. The group drives the
|
|
46
|
+
* indeterminate state when only some children are ticked.
|
|
47
|
+
* @default false
|
|
48
|
+
*/
|
|
49
|
+
parent?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Set to `true` when `render` replaces the root with a real `<button>`.
|
|
52
|
+
* The root is a `<span>` by default so that an enclosing `<label>` stays
|
|
53
|
+
* valid HTML; for the sibling-label pattern (`<label htmlFor>` + `id`) pass
|
|
54
|
+
* `nativeButton render={<button />}` instead. With `nativeButton`, `id`
|
|
55
|
+
* lands on the root element rather than on the hidden input.
|
|
56
|
+
* @default false
|
|
57
|
+
*/
|
|
58
|
+
nativeButton?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Additional class name(s) for the indicator — the element that holds the
|
|
61
|
+
* tick. Applied after the internal styles.
|
|
62
|
+
*/
|
|
63
|
+
indicatorClassName?: string;
|
|
64
|
+
/**
|
|
65
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
66
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
67
|
+
*/
|
|
68
|
+
className?: string;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* A checkbox built on Base UI's unstyled `Checkbox` primitive.
|
|
72
|
+
*
|
|
73
|
+
* The root renders a `<span>` plus a hidden `<input>` beside it, so it carries
|
|
74
|
+
* no accessible name of its own — wrap it in a `<label>`, pair it with a
|
|
75
|
+
* `<label htmlFor>` (see `nativeButton`), or put it inside a `Field.Root`.
|
|
76
|
+
*
|
|
77
|
+
* State is exposed on `data-*` attributes (`data-checked`, `data-unchecked`,
|
|
78
|
+
* `data-indeterminate`, `data-disabled`, `data-readonly`, and the `Field`
|
|
79
|
+
* validity attributes) on both the root and the indicator, and every visual
|
|
80
|
+
* decision is a `--forte-checkbox-*` custom property, so it can be re-skinned
|
|
81
|
+
* from plain CSS or targeted with Tailwind arbitrary variants
|
|
82
|
+
* (`data-[indeterminate]:...`) without wrapping.
|
|
83
|
+
*/
|
|
84
|
+
export declare const Checkbox: React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<HTMLElement>>;
|
|
85
|
+
export interface CheckboxGroupProps extends Omit<BaseCheckboxGroupProps, "className"> {
|
|
86
|
+
/**
|
|
87
|
+
* Direction the checkboxes are laid out in. Horizontal groups wrap.
|
|
88
|
+
* @default "vertical"
|
|
89
|
+
*/
|
|
90
|
+
orientation?: CheckboxGroupOrientation;
|
|
91
|
+
/**
|
|
92
|
+
* Values of the checkboxes that are ticked. Pairs with `onValueChange` for
|
|
93
|
+
* a controlled group; use `defaultValue` for an uncontrolled one. Required
|
|
94
|
+
* if any child uses the `parent` prop.
|
|
95
|
+
* @default undefined
|
|
96
|
+
*/
|
|
97
|
+
value?: string[];
|
|
98
|
+
/**
|
|
99
|
+
* Values of the checkboxes that start ticked when uncontrolled.
|
|
100
|
+
* @default undefined
|
|
101
|
+
*/
|
|
102
|
+
defaultValue?: string[];
|
|
103
|
+
/**
|
|
104
|
+
* Values of *all* checkboxes in the group, ticked or not. Needed only for a
|
|
105
|
+
* parent checkbox: it is how the group knows the difference between "some"
|
|
106
|
+
* and "all" and therefore when the parent is indeterminate.
|
|
107
|
+
* @default undefined
|
|
108
|
+
*/
|
|
109
|
+
allValues?: string[];
|
|
110
|
+
/**
|
|
111
|
+
* Disables every checkbox in the group.
|
|
112
|
+
* @default false
|
|
113
|
+
*/
|
|
114
|
+
disabled?: boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
117
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
118
|
+
*/
|
|
119
|
+
className?: string;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Shared state for a series of `Checkbox`es, built on Base UI's
|
|
123
|
+
* `CheckboxGroup` primitive.
|
|
124
|
+
*
|
|
125
|
+
* The group has no implicit accessible name — give it `aria-labelledby`
|
|
126
|
+
* pointing at a heading, or render it as a `Fieldset.Root` with a
|
|
127
|
+
* `Fieldset.Legend`.
|
|
128
|
+
*/
|
|
129
|
+
export declare const CheckboxGroup: React.ForwardRefExoticComponent<CheckboxGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
130
|
+
export {};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { Collapsible as BaseCollapsible } from '@base-ui/react/collapsible';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
export type CollapsibleVariant = "plain" | "contained";
|
|
4
|
+
type BaseRootProps = React.ComponentPropsWithoutRef<typeof BaseCollapsible.Root>;
|
|
5
|
+
type BaseTriggerProps = React.ComponentPropsWithoutRef<typeof BaseCollapsible.Trigger>;
|
|
6
|
+
type BasePanelProps = React.ComponentPropsWithoutRef<typeof BaseCollapsible.Panel>;
|
|
7
|
+
export interface CollapsibleRootProps extends Omit<BaseRootProps, "className"> {
|
|
8
|
+
/**
|
|
9
|
+
* How much visual weight the disclosure carries. `"plain"` contributes no
|
|
10
|
+
* box of its own — a bare text button over its panel, for a "Show more" that
|
|
11
|
+
* lives inside a page. `"contained"` turns the pair into a card sized and
|
|
12
|
+
* coloured to match one item of a `contained` Accordion. Both are the same
|
|
13
|
+
* three parts with different knobs — nothing moves.
|
|
14
|
+
* @default "plain"
|
|
15
|
+
*/
|
|
16
|
+
variant?: CollapsibleVariant;
|
|
17
|
+
/**
|
|
18
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
19
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
20
|
+
*/
|
|
21
|
+
className?: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Groups the trigger and the panel, and owns whether the panel is open.
|
|
25
|
+
*
|
|
26
|
+
* Uncontrolled with `defaultOpen`, controlled with `open` plus `onOpenChange`.
|
|
27
|
+
* Unlike `Accordion.Root`, this is a boolean rather than a list — there is only
|
|
28
|
+
* ever one panel to open.
|
|
29
|
+
*
|
|
30
|
+
* Reach for `Accordion` instead when there are several of these in a row: it
|
|
31
|
+
* puts each section into the page's heading outline and can close the others
|
|
32
|
+
* as one opens, neither of which a stack of collapsibles does.
|
|
33
|
+
*/
|
|
34
|
+
declare function CollapsibleRoot({ variant, className, children, ...props }: CollapsibleRootProps): React.JSX.Element;
|
|
35
|
+
export interface CollapsibleTriggerProps extends Omit<BaseTriggerProps, "className"> {
|
|
36
|
+
/**
|
|
37
|
+
* The affordance next to the label. Defaults to a chevron that rotates when
|
|
38
|
+
* the panel opens. Pass your own node to replace it — it is wrapped in the
|
|
39
|
+
* same rotating, `aria-hidden` box, so a plus or a caret needs no extra
|
|
40
|
+
* wiring — or `null` to drop it entirely.
|
|
41
|
+
* @default a chevron
|
|
42
|
+
*/
|
|
43
|
+
icon?: React.ReactNode;
|
|
44
|
+
/**
|
|
45
|
+
* Additional class name(s) for the label box that wraps `children`.
|
|
46
|
+
* Applied after the internal styles.
|
|
47
|
+
*/
|
|
48
|
+
labelClassName?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
51
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
52
|
+
*/
|
|
53
|
+
className?: string;
|
|
54
|
+
}
|
|
55
|
+
export interface CollapsiblePanelProps extends Omit<BasePanelProps, "className"> {
|
|
56
|
+
/**
|
|
57
|
+
* Additional class name(s) for the inner element that holds the padding and
|
|
58
|
+
* the content. Applied after the internal styles.
|
|
59
|
+
*/
|
|
60
|
+
contentClassName?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
63
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
64
|
+
*/
|
|
65
|
+
className?: string;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* A disclosure built on Base UI's unstyled `Collapsible` primitive.
|
|
69
|
+
*
|
|
70
|
+
* ```tsx
|
|
71
|
+
* <Collapsible.Root>
|
|
72
|
+
* <Collapsible.Trigger>Advanced settings</Collapsible.Trigger>
|
|
73
|
+
* <Collapsible.Panel>Nothing in here is required.</Collapsible.Panel>
|
|
74
|
+
* </Collapsible.Root>
|
|
75
|
+
* ```
|
|
76
|
+
*
|
|
77
|
+
* One trigger, one panel, and a height animation that runs without a frame of
|
|
78
|
+
* JavaScript. The panel is unmounted while closed unless `keepMounted` or
|
|
79
|
+
* `hiddenUntilFound` says otherwise.
|
|
80
|
+
*
|
|
81
|
+
* Styling is driven entirely by `data-*` attributes and `--forte-collapsible-*`
|
|
82
|
+
* custom properties, so it can be re-skinned from plain CSS or targeted with
|
|
83
|
+
* Tailwind arbitrary variants (`data-[variant=contained]:...`) without
|
|
84
|
+
* wrapping.
|
|
85
|
+
*/
|
|
86
|
+
export declare const Collapsible: {
|
|
87
|
+
Root: typeof CollapsibleRoot;
|
|
88
|
+
Trigger: React.ForwardRefExoticComponent<CollapsibleTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
89
|
+
Panel: React.ForwardRefExoticComponent<CollapsiblePanelProps & React.RefAttributes<HTMLDivElement>>;
|
|
90
|
+
};
|
|
91
|
+
export {};
|