@milktop/react-ui 0.0.0-stage → 0.1.2
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 +173 -2
- package/dist/accordion/Accordion.d.ts +65 -0
- package/dist/accordion/Accordion.js +61 -0
- package/dist/accordion/accordion.css +17 -0
- package/dist/action-bar/ActionBar.d.ts +33 -0
- package/dist/action-bar/ActionBar.js +48 -0
- package/dist/action-bar/action-bar.css +22 -0
- package/dist/alert/Alert.d.ts +28 -0
- package/dist/alert/Alert.js +12 -0
- package/dist/alert/alert.css +32 -0
- package/dist/app-shell/AppShell.d.ts +38 -0
- package/dist/app-shell/AppShell.js +92 -0
- package/dist/app-shell/Topbar.d.ts +20 -0
- package/dist/app-shell/Topbar.js +13 -0
- package/dist/app-shell/app-shell.css +41 -0
- package/dist/app-shell/shell.d.ts +9 -0
- package/dist/app-shell/shell.js +3 -0
- package/dist/attachments/Attachments.d.ts +84 -0
- package/dist/attachments/Attachments.js +235 -0
- package/dist/attachments/attachments.css +86 -0
- package/dist/avatar/Avatar.d.ts +31 -0
- package/dist/avatar/Avatar.js +41 -0
- package/dist/avatar/AvatarGroup.d.ts +41 -0
- package/dist/avatar/AvatarGroup.js +17 -0
- package/dist/avatar/avatar.css +73 -0
- package/dist/badge/Badge.d.ts +26 -0
- package/dist/badge/Badge.js +10 -0
- package/dist/badge/badge.css +24 -0
- package/dist/banner/Banner.d.ts +33 -0
- package/dist/banner/Banner.js +14 -0
- package/dist/banner/banner.css +25 -0
- package/dist/breadcrumbs/Breadcrumbs.d.ts +39 -0
- package/dist/breadcrumbs/Breadcrumbs.js +28 -0
- package/dist/breadcrumbs/breadcrumbs.css +18 -0
- package/dist/button/Button.d.ts +40 -0
- package/dist/button/Button.js +19 -0
- package/dist/button/button.css +63 -0
- package/dist/card/Card.d.ts +355 -0
- package/dist/card/Card.js +56 -0
- package/dist/card/card.css +43 -0
- package/dist/chart/AreaChart.d.ts +19 -0
- package/dist/chart/AreaChart.js +61 -0
- package/dist/chart/BarChart.d.ts +3 -0
- package/dist/chart/BarChart.js +60 -0
- package/dist/chart/ChartFrame.d.ts +25 -0
- package/dist/chart/ChartFrame.js +22 -0
- package/dist/chart/DonutChart.d.ts +20 -0
- package/dist/chart/DonutChart.js +41 -0
- package/dist/chart/Sparkline.d.ts +26 -0
- package/dist/chart/Sparkline.js +36 -0
- package/dist/chart/chart.css +51 -0
- package/dist/chart/chart.d.ts +23 -0
- package/dist/chart/chart.js +19 -0
- package/dist/checkbox/Checkbox.d.ts +50 -0
- package/dist/checkbox/Checkbox.js +19 -0
- package/dist/checkbox/CheckboxGroup.d.ts +44 -0
- package/dist/checkbox/CheckboxGroup.js +80 -0
- package/dist/checkbox/checkbox.css +49 -0
- package/dist/collapsible/Collapsible.d.ts +41 -0
- package/dist/collapsible/Collapsible.js +15 -0
- package/dist/collapsible/collapsible.css +20 -0
- package/dist/color-scheme.d.ts +18 -0
- package/dist/color-scheme.js +84 -0
- package/dist/command/Command.d.ts +64 -0
- package/dist/command/Command.js +162 -0
- package/dist/command/command.css +47 -0
- package/dist/confirm/confirm.css +5 -0
- package/dist/confirm/confirm.d.ts +42 -0
- package/dist/confirm/confirm.js +115 -0
- package/dist/copy-button/CopyButton.d.ts +30 -0
- package/dist/copy-button/CopyButton.js +23 -0
- package/dist/copy-button/copy-button.css +12 -0
- package/dist/css.d.ts +2 -0
- package/dist/data-list/DataList.d.ts +55 -0
- package/dist/data-list/DataList.js +43 -0
- package/dist/data-list/data-list.css +19 -0
- package/dist/date-picker/DatePicker.d.ts +95 -0
- package/dist/date-picker/DatePicker.js +237 -0
- package/dist/date-picker/date-picker.css +53 -0
- package/dist/dialog/Dialog.d.ts +98 -0
- package/dist/dialog/Dialog.js +92 -0
- package/dist/dialog/dialog.css +31 -0
- package/dist/divider/Divider.d.ts +27 -0
- package/dist/divider/Divider.js +8 -0
- package/dist/divider/divider.css +12 -0
- package/dist/editable/Editable.d.ts +47 -0
- package/dist/editable/Editable.js +51 -0
- package/dist/editable/editable.css +25 -0
- package/dist/editor/Editor.d.ts +59 -0
- package/dist/editor/Editor.js +220 -0
- package/dist/editor/editor.css +42 -0
- package/dist/editor/image.d.ts +1 -0
- package/dist/editor/image.js +23 -0
- package/dist/empty-state/EmptyState.d.ts +22 -0
- package/dist/empty-state/EmptyState.js +9 -0
- package/dist/empty-state/empty-state.css +14 -0
- package/dist/event-calendar/EventCalendar.d.ts +213 -0
- package/dist/event-calendar/EventCalendar.js +686 -0
- package/dist/event-calendar/dates.d.ts +8 -0
- package/dist/event-calendar/dates.js +21 -0
- package/dist/event-calendar/event-calendar.css +157 -0
- package/dist/field/Field.d.ts +66 -0
- package/dist/field/Field.js +23 -0
- package/dist/field/field.css +26 -0
- package/dist/file-upload/FileUpload.d.ts +60 -0
- package/dist/file-upload/FileUpload.js +102 -0
- package/dist/file-upload/file-upload.css +32 -0
- package/dist/format/FormatNumber.d.ts +42 -0
- package/dist/format/FormatNumber.js +59 -0
- package/dist/format/LocaleProvider.d.ts +33 -0
- package/dist/format/LocaleProvider.js +48 -0
- package/dist/format/format.d.ts +37 -0
- package/dist/format/format.js +74 -0
- package/dist/format/messages.d.ts +211 -0
- package/dist/format/messages.js +202 -0
- package/dist/highlight/Highlight.d.ts +11 -0
- package/dist/highlight/Highlight.js +14 -0
- package/dist/highlight/highlight.css +17 -0
- package/dist/hover-card/HoverCard.d.ts +47 -0
- package/dist/hover-card/HoverCard.js +18 -0
- package/dist/hover-card/hover-card.css +19 -0
- package/dist/index.d.ts +84 -0
- package/dist/index.js +85 -0
- package/dist/input/Input.d.ts +41 -0
- package/dist/input/Input.js +48 -0
- package/dist/input/input.css +25 -0
- package/dist/kbd/Kbd.d.ts +19 -0
- package/dist/kbd/Kbd.js +20 -0
- package/dist/kbd/kbd.css +8 -0
- package/dist/menu/Menu.d.ts +223 -0
- package/dist/menu/Menu.js +275 -0
- package/dist/menu/menu.css +38 -0
- package/dist/native-select/NativeSelect.d.ts +36 -0
- package/dist/native-select/NativeSelect.js +51 -0
- package/dist/native-select/native-select.css +16 -0
- package/dist/number-input/NumberInput.d.ts +56 -0
- package/dist/number-input/NumberInput.js +67 -0
- package/dist/number-input/number-input.css +21 -0
- package/dist/page/Page.d.ts +30 -0
- package/dist/page/Page.js +9 -0
- package/dist/page/page.css +17 -0
- package/dist/pagination/Pagination.d.ts +31 -0
- package/dist/pagination/Pagination.js +58 -0
- package/dist/pagination/pagination.css +15 -0
- package/dist/password-input/PasswordInput.d.ts +47 -0
- package/dist/password-input/PasswordInput.js +35 -0
- package/dist/password-input/password-input.css +18 -0
- package/dist/pin-input/PinInput.d.ts +45 -0
- package/dist/pin-input/PinInput.js +22 -0
- package/dist/pin-input/pin-input.css +13 -0
- package/dist/popover/Popover.d.ts +65 -0
- package/dist/popover/Popover.js +26 -0
- package/dist/popover/popover.css +16 -0
- package/dist/progress/Progress.d.ts +56 -0
- package/dist/progress/Progress.js +28 -0
- package/dist/progress/progress.css +24 -0
- package/dist/prose/Prose.d.ts +23 -0
- package/dist/prose/Prose.js +10 -0
- package/dist/prose/prose.css +29 -0
- package/dist/radio-group/RadioGroup.d.ts +59 -0
- package/dist/radio-group/RadioGroup.js +37 -0
- package/dist/radio-group/radio-group.css +30 -0
- package/dist/rolling-number/RollingNumber.d.ts +27 -0
- package/dist/rolling-number/RollingNumber.js +18 -0
- package/dist/rolling-number/rolling-number.css +10 -0
- package/dist/segment-group/Segmented.d.ts +68 -0
- package/dist/segment-group/Segmented.js +79 -0
- package/dist/segment-group/segment-group.css +25 -0
- package/dist/select/ListSelect.d.ts +5 -0
- package/dist/select/ListSelect.js +82 -0
- package/dist/select/SearchSelect.d.ts +43 -0
- package/dist/select/SearchSelect.js +219 -0
- package/dist/select/Select.d.ts +147 -0
- package/dist/select/Select.js +32 -0
- package/dist/select/items.d.ts +17 -0
- package/dist/select/items.js +14 -0
- package/dist/select/search-select.css +45 -0
- package/dist/select/select.css +52 -0
- package/dist/sheet/Sheet.d.ts +88 -0
- package/dist/sheet/Sheet.js +66 -0
- package/dist/sheet/sheet.css +44 -0
- package/dist/sidebar/NavGroup.d.ts +29 -0
- package/dist/sidebar/NavGroup.js +78 -0
- package/dist/sidebar/NavItem.d.ts +33 -0
- package/dist/sidebar/NavItem.js +50 -0
- package/dist/sidebar/NavSection.d.ts +20 -0
- package/dist/sidebar/NavSection.js +44 -0
- package/dist/sidebar/Sidebar.d.ts +65 -0
- package/dist/sidebar/Sidebar.js +59 -0
- package/dist/sidebar/SidebarUser.d.ts +31 -0
- package/dist/sidebar/SidebarUser.js +14 -0
- package/dist/sidebar/context.d.ts +13 -0
- package/dist/sidebar/context.js +6 -0
- package/dist/sidebar/sidebar.css +109 -0
- package/dist/skeleton/Skeleton.d.ts +25 -0
- package/dist/skeleton/Skeleton.js +8 -0
- package/dist/skeleton/skeleton.css +13 -0
- package/dist/slider/Slider.d.ts +70 -0
- package/dist/slider/Slider.js +65 -0
- package/dist/slider/slider.css +17 -0
- package/dist/sortable-list/SortableList.d.ts +46 -0
- package/dist/sortable-list/SortableList.js +85 -0
- package/dist/sortable-list/sortable-list.css +25 -0
- package/dist/spinner/Spinner.d.ts +18 -0
- package/dist/spinner/Spinner.js +11 -0
- package/dist/spinner/spinner.css +9 -0
- package/dist/stat/Stat.d.ts +42 -0
- package/dist/stat/Stat.js +21 -0
- package/dist/stat/Stats.d.ts +23 -0
- package/dist/stat/Stats.js +8 -0
- package/dist/stat/stat.css +34 -0
- package/dist/swatch-picker/SwatchPicker.d.ts +45 -0
- package/dist/swatch-picker/SwatchPicker.js +54 -0
- package/dist/swatch-picker/swatch-picker.css +38 -0
- package/dist/switch/Switch.d.ts +39 -0
- package/dist/switch/Switch.js +17 -0
- package/dist/switch/switch.css +13 -0
- package/dist/table/Table.d.ts +90 -0
- package/dist/table/Table.js +145 -0
- package/dist/table/table.css +44 -0
- package/dist/tabs/Tabs.d.ts +87 -0
- package/dist/tabs/Tabs.js +90 -0
- package/dist/tabs/tabs.css +53 -0
- package/dist/tags-input/TagsInput.d.ts +69 -0
- package/dist/tags-input/TagsInput.js +95 -0
- package/dist/tags-input/tags-input.css +37 -0
- package/dist/textarea/Textarea.d.ts +24 -0
- package/dist/textarea/Textarea.js +51 -0
- package/dist/textarea/textarea.css +14 -0
- package/dist/theme-toggle/ThemeToggle.d.ts +49 -0
- package/dist/theme-toggle/ThemeToggle.js +71 -0
- package/dist/theme-toggle/theme-toggle.css +23 -0
- package/dist/theme.css +121 -0
- package/dist/time-input/TimeInput.d.ts +25 -0
- package/dist/time-input/TimeInput.js +20 -0
- package/dist/timeline/Timeline.d.ts +50 -0
- package/dist/timeline/Timeline.js +15 -0
- package/dist/timeline/timeline.css +29 -0
- package/dist/toast/Toaster.d.ts +36 -0
- package/dist/toast/Toaster.js +25 -0
- package/dist/toast/toast.css +33 -0
- package/dist/tooltip/Tooltip.d.ts +55 -0
- package/dist/tooltip/Tooltip.js +48 -0
- package/dist/tooltip/tooltip.css +18 -0
- package/dist/tree-view/TreeView.d.ts +86 -0
- package/dist/tree-view/TreeView.js +74 -0
- package/dist/tree-view/tree-view.css +29 -0
- package/dist/utils.d.ts +19 -0
- package/dist/utils.js +59 -0
- package/package.json +99 -4
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A card: a surface grouping related content.
|
|
3
|
+
*
|
|
4
|
+
* <Card heading="Next lesson" description="Thursday at 16:00" icon="lucide:calendar"
|
|
5
|
+
* actions={<Button size="sm">Reschedule</Button>}>
|
|
6
|
+
* …body…
|
|
7
|
+
* </Card>
|
|
8
|
+
*
|
|
9
|
+
* - `heading`, `description`: the header; `icon`: an Iconify name in a
|
|
10
|
+
* tinted tile beside them
|
|
11
|
+
* - `actions`: beside the heading; `footer`: a tinted strip along the bottom
|
|
12
|
+
* - `variant`: 'default' (a bordered surface), 'elevated' (lifted, no
|
|
13
|
+
* border), 'outline' (a border, no fill or shadow) or 'subtle' (a tinted
|
|
14
|
+
* fill, for a panel inside a page or another card)
|
|
15
|
+
* - `size`: 'sm', 'md' (default) or 'lg': the padding
|
|
16
|
+
* - `divided`: a line between the header and the body
|
|
17
|
+
* - `href`: the whole card is a link, lifting on hover
|
|
18
|
+
* - `flush`: no padding round the body, for content that runs edge to edge (a table, a list)
|
|
19
|
+
*
|
|
20
|
+
* Or composed from Card.Header (which takes heading, description, icon and
|
|
21
|
+
* actions too), Card.Body and Card.Footer, placed as they are:
|
|
22
|
+
*
|
|
23
|
+
* <Card>
|
|
24
|
+
* <Card.Header heading="Invoices" actions={<Button size="sm">New</Button>} />
|
|
25
|
+
* <Card.Body>…</Card.Body>
|
|
26
|
+
* <Card.Footer>…</Card.Footer>
|
|
27
|
+
* </Card>
|
|
28
|
+
*/
|
|
29
|
+
import { type ComponentProps, type ReactNode } from 'react';
|
|
30
|
+
import 'iconify-icon';
|
|
31
|
+
import { type Classes } from '../utils.js';
|
|
32
|
+
import '../theme.css';
|
|
33
|
+
import './card.css';
|
|
34
|
+
type HeaderContent = {
|
|
35
|
+
heading?: ReactNode;
|
|
36
|
+
description?: ReactNode;
|
|
37
|
+
icon?: string | null;
|
|
38
|
+
actions?: ReactNode;
|
|
39
|
+
};
|
|
40
|
+
type CardPart = 'root' | 'header' | 'icon' | 'titles' | 'heading' | 'description' | 'actions' | 'body' | 'footer';
|
|
41
|
+
export type CardProps = Omit<ComponentProps<'div'>, 'title'> & HeaderContent & {
|
|
42
|
+
footer?: ReactNode;
|
|
43
|
+
variant?: 'default' | 'elevated' | 'outline' | 'subtle';
|
|
44
|
+
size?: 'sm' | 'md' | 'lg';
|
|
45
|
+
divided?: boolean;
|
|
46
|
+
href?: string | null;
|
|
47
|
+
flush?: boolean;
|
|
48
|
+
classes?: Classes<CardPart>;
|
|
49
|
+
};
|
|
50
|
+
type HeaderProps = ComponentProps<'div'> & HeaderContent & {
|
|
51
|
+
classes?: Classes<CardPart>;
|
|
52
|
+
};
|
|
53
|
+
declare function Header({ heading, description, icon, actions, classes, className, children, ...rest }: HeaderProps): import("react").JSX.Element;
|
|
54
|
+
declare function CardShortcut({ heading, description, icon, actions, footer, variant, size, divided, href, flush, className, classes, children, ...rest }: CardProps): import("react").DetailedReactHTMLElement<{
|
|
55
|
+
href: string | undefined;
|
|
56
|
+
className: string | undefined;
|
|
57
|
+
'data-variant': "default" | "outline" | "elevated" | "subtle";
|
|
58
|
+
'data-size': "sm" | "md" | "lg";
|
|
59
|
+
'data-flush': true | undefined;
|
|
60
|
+
'data-divided': true | undefined;
|
|
61
|
+
'data-link': string | undefined;
|
|
62
|
+
'data-scope': string;
|
|
63
|
+
'data-part': string;
|
|
64
|
+
slot?: string | undefined | undefined;
|
|
65
|
+
style?: import("react").CSSProperties | undefined;
|
|
66
|
+
ref?: import("react").Ref<HTMLDivElement> | undefined;
|
|
67
|
+
key?: import("react").Key | null | undefined;
|
|
68
|
+
defaultChecked?: boolean | undefined | undefined;
|
|
69
|
+
defaultValue?: string | number | readonly string[] | undefined;
|
|
70
|
+
suppressContentEditableWarning?: boolean | undefined | undefined;
|
|
71
|
+
suppressHydrationWarning?: boolean | undefined | undefined;
|
|
72
|
+
accessKey?: string | undefined | undefined;
|
|
73
|
+
autoCapitalize?: "off" | "none" | "on" | "sentences" | "words" | "characters" | undefined | (string & {}) | undefined;
|
|
74
|
+
autoFocus?: boolean | undefined | undefined;
|
|
75
|
+
contentEditable?: (boolean | "true" | "false") | "inherit" | "plaintext-only" | undefined;
|
|
76
|
+
contextMenu?: string | undefined | undefined;
|
|
77
|
+
dir?: string | undefined | undefined;
|
|
78
|
+
draggable?: (boolean | "true" | "false") | undefined;
|
|
79
|
+
enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined | undefined;
|
|
80
|
+
hidden?: boolean | undefined | undefined;
|
|
81
|
+
id?: string | undefined | undefined;
|
|
82
|
+
lang?: string | undefined | undefined;
|
|
83
|
+
nonce?: string | undefined | undefined;
|
|
84
|
+
spellCheck?: (boolean | "true" | "false") | undefined;
|
|
85
|
+
tabIndex?: number | undefined | undefined;
|
|
86
|
+
translate?: "yes" | "no" | undefined | undefined;
|
|
87
|
+
radioGroup?: string | undefined | undefined;
|
|
88
|
+
role?: import("react").AriaRole | undefined;
|
|
89
|
+
about?: string | undefined | undefined;
|
|
90
|
+
content?: string | undefined | undefined;
|
|
91
|
+
datatype?: string | undefined | undefined;
|
|
92
|
+
inlist?: any;
|
|
93
|
+
prefix?: string | undefined | undefined;
|
|
94
|
+
property?: string | undefined | undefined;
|
|
95
|
+
rel?: string | undefined | undefined;
|
|
96
|
+
resource?: string | undefined | undefined;
|
|
97
|
+
rev?: string | undefined | undefined;
|
|
98
|
+
typeof?: string | undefined | undefined;
|
|
99
|
+
vocab?: string | undefined | undefined;
|
|
100
|
+
autoCorrect?: string | undefined | undefined;
|
|
101
|
+
autoSave?: string | undefined | undefined;
|
|
102
|
+
color?: string | undefined | undefined;
|
|
103
|
+
itemProp?: string | undefined | undefined;
|
|
104
|
+
itemScope?: boolean | undefined | undefined;
|
|
105
|
+
itemType?: string | undefined | undefined;
|
|
106
|
+
itemID?: string | undefined | undefined;
|
|
107
|
+
itemRef?: string | undefined | undefined;
|
|
108
|
+
results?: number | undefined | undefined;
|
|
109
|
+
security?: string | undefined | undefined;
|
|
110
|
+
unselectable?: "on" | "off" | undefined | undefined;
|
|
111
|
+
popover?: "" | "auto" | "manual" | "hint" | undefined | undefined;
|
|
112
|
+
popoverTargetAction?: "toggle" | "show" | "hide" | undefined | undefined;
|
|
113
|
+
popoverTarget?: string | undefined | undefined;
|
|
114
|
+
inert?: boolean | undefined | undefined;
|
|
115
|
+
inputMode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined | undefined;
|
|
116
|
+
is?: string | undefined | undefined;
|
|
117
|
+
exportparts?: string | undefined | undefined;
|
|
118
|
+
part?: string | undefined | undefined;
|
|
119
|
+
"aria-activedescendant"?: string | undefined | undefined;
|
|
120
|
+
"aria-atomic"?: (boolean | "true" | "false") | undefined;
|
|
121
|
+
"aria-autocomplete"?: "none" | "inline" | "list" | "both" | undefined | undefined;
|
|
122
|
+
"aria-braillelabel"?: string | undefined | undefined;
|
|
123
|
+
"aria-brailleroledescription"?: string | undefined | undefined;
|
|
124
|
+
"aria-busy"?: (boolean | "true" | "false") | undefined;
|
|
125
|
+
"aria-checked"?: boolean | "false" | "mixed" | "true" | undefined | undefined;
|
|
126
|
+
"aria-colcount"?: number | undefined | undefined;
|
|
127
|
+
"aria-colindex"?: number | undefined | undefined;
|
|
128
|
+
"aria-colindextext"?: string | undefined | undefined;
|
|
129
|
+
"aria-colspan"?: number | undefined | undefined;
|
|
130
|
+
"aria-controls"?: string | undefined | undefined;
|
|
131
|
+
"aria-current"?: boolean | "false" | "true" | "page" | "step" | "location" | "date" | "time" | undefined | undefined;
|
|
132
|
+
"aria-describedby"?: string | undefined | undefined;
|
|
133
|
+
"aria-description"?: string | undefined | undefined;
|
|
134
|
+
"aria-details"?: string | undefined | undefined;
|
|
135
|
+
"aria-disabled"?: (boolean | "true" | "false") | undefined;
|
|
136
|
+
"aria-dropeffect"?: "none" | "copy" | "execute" | "link" | "move" | "popup" | undefined | undefined;
|
|
137
|
+
"aria-errormessage"?: string | undefined | undefined;
|
|
138
|
+
"aria-expanded"?: (boolean | "true" | "false") | undefined;
|
|
139
|
+
"aria-flowto"?: string | undefined | undefined;
|
|
140
|
+
"aria-grabbed"?: (boolean | "true" | "false") | undefined;
|
|
141
|
+
"aria-haspopup"?: boolean | "false" | "true" | "menu" | "listbox" | "tree" | "grid" | "dialog" | undefined | undefined;
|
|
142
|
+
"aria-hidden"?: (boolean | "true" | "false") | undefined;
|
|
143
|
+
"aria-invalid"?: boolean | "false" | "true" | "grammar" | "spelling" | undefined | undefined;
|
|
144
|
+
"aria-keyshortcuts"?: string | undefined | undefined;
|
|
145
|
+
"aria-label"?: string | undefined | undefined;
|
|
146
|
+
"aria-labelledby"?: string | undefined | undefined;
|
|
147
|
+
"aria-level"?: number | undefined | undefined;
|
|
148
|
+
"aria-live"?: "off" | "assertive" | "polite" | undefined | undefined;
|
|
149
|
+
"aria-modal"?: (boolean | "true" | "false") | undefined;
|
|
150
|
+
"aria-multiline"?: (boolean | "true" | "false") | undefined;
|
|
151
|
+
"aria-multiselectable"?: (boolean | "true" | "false") | undefined;
|
|
152
|
+
"aria-orientation"?: "horizontal" | "vertical" | undefined | undefined;
|
|
153
|
+
"aria-owns"?: string | undefined | undefined;
|
|
154
|
+
"aria-placeholder"?: string | undefined | undefined;
|
|
155
|
+
"aria-posinset"?: number | undefined | undefined;
|
|
156
|
+
"aria-pressed"?: boolean | "false" | "mixed" | "true" | undefined | undefined;
|
|
157
|
+
"aria-readonly"?: (boolean | "true" | "false") | undefined;
|
|
158
|
+
"aria-relevant"?: "additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text" | "text additions" | "text removals" | undefined | undefined;
|
|
159
|
+
"aria-required"?: (boolean | "true" | "false") | undefined;
|
|
160
|
+
"aria-roledescription"?: string | undefined | undefined;
|
|
161
|
+
"aria-rowcount"?: number | undefined | undefined;
|
|
162
|
+
"aria-rowindex"?: number | undefined | undefined;
|
|
163
|
+
"aria-rowindextext"?: string | undefined | undefined;
|
|
164
|
+
"aria-rowspan"?: number | undefined | undefined;
|
|
165
|
+
"aria-selected"?: (boolean | "true" | "false") | undefined;
|
|
166
|
+
"aria-setsize"?: number | undefined | undefined;
|
|
167
|
+
"aria-sort"?: "none" | "ascending" | "descending" | "other" | undefined | undefined;
|
|
168
|
+
"aria-valuemax"?: number | undefined | undefined;
|
|
169
|
+
"aria-valuemin"?: number | undefined | undefined;
|
|
170
|
+
"aria-valuenow"?: number | undefined | undefined;
|
|
171
|
+
"aria-valuetext"?: string | undefined | undefined;
|
|
172
|
+
dangerouslySetInnerHTML?: {
|
|
173
|
+
__html: string | TrustedHTML;
|
|
174
|
+
} | undefined | undefined;
|
|
175
|
+
onCopy?: import("react").ClipboardEventHandler<HTMLDivElement> | undefined;
|
|
176
|
+
onCopyCapture?: import("react").ClipboardEventHandler<HTMLDivElement> | undefined;
|
|
177
|
+
onCut?: import("react").ClipboardEventHandler<HTMLDivElement> | undefined;
|
|
178
|
+
onCutCapture?: import("react").ClipboardEventHandler<HTMLDivElement> | undefined;
|
|
179
|
+
onPaste?: import("react").ClipboardEventHandler<HTMLDivElement> | undefined;
|
|
180
|
+
onPasteCapture?: import("react").ClipboardEventHandler<HTMLDivElement> | undefined;
|
|
181
|
+
onCompositionEnd?: import("react").CompositionEventHandler<HTMLDivElement> | undefined;
|
|
182
|
+
onCompositionEndCapture?: import("react").CompositionEventHandler<HTMLDivElement> | undefined;
|
|
183
|
+
onCompositionStart?: import("react").CompositionEventHandler<HTMLDivElement> | undefined;
|
|
184
|
+
onCompositionStartCapture?: import("react").CompositionEventHandler<HTMLDivElement> | undefined;
|
|
185
|
+
onCompositionUpdate?: import("react").CompositionEventHandler<HTMLDivElement> | undefined;
|
|
186
|
+
onCompositionUpdateCapture?: import("react").CompositionEventHandler<HTMLDivElement> | undefined;
|
|
187
|
+
onFocus?: import("react").FocusEventHandler<HTMLDivElement> | undefined;
|
|
188
|
+
onFocusCapture?: import("react").FocusEventHandler<HTMLDivElement> | undefined;
|
|
189
|
+
onBlur?: import("react").FocusEventHandler<HTMLDivElement> | undefined;
|
|
190
|
+
onBlurCapture?: import("react").FocusEventHandler<HTMLDivElement> | undefined;
|
|
191
|
+
onChange?: import("react").ChangeEventHandler<HTMLDivElement, Element> | undefined;
|
|
192
|
+
onChangeCapture?: import("react").ChangeEventHandler<HTMLDivElement, Element> | undefined;
|
|
193
|
+
onBeforeInput?: import("react").InputEventHandler<HTMLDivElement> | undefined;
|
|
194
|
+
onBeforeInputCapture?: import("react").InputEventHandler<HTMLDivElement> | undefined;
|
|
195
|
+
onInput?: import("react").InputEventHandler<HTMLDivElement> | undefined;
|
|
196
|
+
onInputCapture?: import("react").InputEventHandler<HTMLDivElement> | undefined;
|
|
197
|
+
onReset?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
198
|
+
onResetCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
199
|
+
onSubmit?: import("react").SubmitEventHandler<HTMLDivElement> | undefined;
|
|
200
|
+
onSubmitCapture?: import("react").SubmitEventHandler<HTMLDivElement> | undefined;
|
|
201
|
+
onInvalid?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
202
|
+
onInvalidCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
203
|
+
onLoad?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
204
|
+
onLoadCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
205
|
+
onError?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
206
|
+
onErrorCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
207
|
+
onKeyDown?: import("react").KeyboardEventHandler<HTMLDivElement> | undefined;
|
|
208
|
+
onKeyDownCapture?: import("react").KeyboardEventHandler<HTMLDivElement> | undefined;
|
|
209
|
+
onKeyPress?: import("react").KeyboardEventHandler<HTMLDivElement> | undefined;
|
|
210
|
+
onKeyPressCapture?: import("react").KeyboardEventHandler<HTMLDivElement> | undefined;
|
|
211
|
+
onKeyUp?: import("react").KeyboardEventHandler<HTMLDivElement> | undefined;
|
|
212
|
+
onKeyUpCapture?: import("react").KeyboardEventHandler<HTMLDivElement> | undefined;
|
|
213
|
+
onAbort?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
214
|
+
onAbortCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
215
|
+
onCanPlay?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
216
|
+
onCanPlayCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
217
|
+
onCanPlayThrough?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
218
|
+
onCanPlayThroughCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
219
|
+
onDurationChange?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
220
|
+
onDurationChangeCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
221
|
+
onEmptied?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
222
|
+
onEmptiedCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
223
|
+
onEncrypted?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
224
|
+
onEncryptedCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
225
|
+
onEnded?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
226
|
+
onEndedCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
227
|
+
onLoadedData?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
228
|
+
onLoadedDataCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
229
|
+
onLoadedMetadata?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
230
|
+
onLoadedMetadataCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
231
|
+
onLoadStart?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
232
|
+
onLoadStartCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
233
|
+
onPause?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
234
|
+
onPauseCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
235
|
+
onPlay?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
236
|
+
onPlayCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
237
|
+
onPlaying?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
238
|
+
onPlayingCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
239
|
+
onProgress?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
240
|
+
onProgressCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
241
|
+
onRateChange?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
242
|
+
onRateChangeCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
243
|
+
onSeeked?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
244
|
+
onSeekedCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
245
|
+
onSeeking?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
246
|
+
onSeekingCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
247
|
+
onStalled?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
248
|
+
onStalledCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
249
|
+
onSuspend?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
250
|
+
onSuspendCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
251
|
+
onTimeUpdate?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
252
|
+
onTimeUpdateCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
253
|
+
onVolumeChange?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
254
|
+
onVolumeChangeCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
255
|
+
onWaiting?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
256
|
+
onWaitingCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
257
|
+
onAuxClick?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
258
|
+
onAuxClickCapture?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
259
|
+
onClick?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
260
|
+
onClickCapture?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
261
|
+
onContextMenu?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
262
|
+
onContextMenuCapture?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
263
|
+
onDoubleClick?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
264
|
+
onDoubleClickCapture?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
265
|
+
onDrag?: import("react").DragEventHandler<HTMLDivElement> | undefined;
|
|
266
|
+
onDragCapture?: import("react").DragEventHandler<HTMLDivElement> | undefined;
|
|
267
|
+
onDragEnd?: import("react").DragEventHandler<HTMLDivElement> | undefined;
|
|
268
|
+
onDragEndCapture?: import("react").DragEventHandler<HTMLDivElement> | undefined;
|
|
269
|
+
onDragEnter?: import("react").DragEventHandler<HTMLDivElement> | undefined;
|
|
270
|
+
onDragEnterCapture?: import("react").DragEventHandler<HTMLDivElement> | undefined;
|
|
271
|
+
onDragExit?: import("react").DragEventHandler<HTMLDivElement> | undefined;
|
|
272
|
+
onDragExitCapture?: import("react").DragEventHandler<HTMLDivElement> | undefined;
|
|
273
|
+
onDragLeave?: import("react").DragEventHandler<HTMLDivElement> | undefined;
|
|
274
|
+
onDragLeaveCapture?: import("react").DragEventHandler<HTMLDivElement> | undefined;
|
|
275
|
+
onDragOver?: import("react").DragEventHandler<HTMLDivElement> | undefined;
|
|
276
|
+
onDragOverCapture?: import("react").DragEventHandler<HTMLDivElement> | undefined;
|
|
277
|
+
onDragStart?: import("react").DragEventHandler<HTMLDivElement> | undefined;
|
|
278
|
+
onDragStartCapture?: import("react").DragEventHandler<HTMLDivElement> | undefined;
|
|
279
|
+
onDrop?: import("react").DragEventHandler<HTMLDivElement> | undefined;
|
|
280
|
+
onDropCapture?: import("react").DragEventHandler<HTMLDivElement> | undefined;
|
|
281
|
+
onMouseDown?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
282
|
+
onMouseDownCapture?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
283
|
+
onMouseEnter?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
284
|
+
onMouseLeave?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
285
|
+
onMouseMove?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
286
|
+
onMouseMoveCapture?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
287
|
+
onMouseOut?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
288
|
+
onMouseOutCapture?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
289
|
+
onMouseOver?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
290
|
+
onMouseOverCapture?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
291
|
+
onMouseUp?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
292
|
+
onMouseUpCapture?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
293
|
+
onSelect?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
294
|
+
onSelectCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
295
|
+
onTouchCancel?: import("react").TouchEventHandler<HTMLDivElement> | undefined;
|
|
296
|
+
onTouchCancelCapture?: import("react").TouchEventHandler<HTMLDivElement> | undefined;
|
|
297
|
+
onTouchEnd?: import("react").TouchEventHandler<HTMLDivElement> | undefined;
|
|
298
|
+
onTouchEndCapture?: import("react").TouchEventHandler<HTMLDivElement> | undefined;
|
|
299
|
+
onTouchMove?: import("react").TouchEventHandler<HTMLDivElement> | undefined;
|
|
300
|
+
onTouchMoveCapture?: import("react").TouchEventHandler<HTMLDivElement> | undefined;
|
|
301
|
+
onTouchStart?: import("react").TouchEventHandler<HTMLDivElement> | undefined;
|
|
302
|
+
onTouchStartCapture?: import("react").TouchEventHandler<HTMLDivElement> | undefined;
|
|
303
|
+
onPointerDown?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
|
|
304
|
+
onPointerDownCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
|
|
305
|
+
onPointerMove?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
|
|
306
|
+
onPointerMoveCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
|
|
307
|
+
onPointerUp?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
|
|
308
|
+
onPointerUpCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
|
|
309
|
+
onPointerCancel?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
|
|
310
|
+
onPointerCancelCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
|
|
311
|
+
onPointerEnter?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
|
|
312
|
+
onPointerLeave?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
|
|
313
|
+
onPointerOver?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
|
|
314
|
+
onPointerOverCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
|
|
315
|
+
onPointerOut?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
|
|
316
|
+
onPointerOutCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
|
|
317
|
+
onGotPointerCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
|
|
318
|
+
onGotPointerCaptureCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
|
|
319
|
+
onLostPointerCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
|
|
320
|
+
onLostPointerCaptureCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
|
|
321
|
+
onScroll?: import("react").UIEventHandler<HTMLDivElement> | undefined;
|
|
322
|
+
onScrollCapture?: import("react").UIEventHandler<HTMLDivElement> | undefined;
|
|
323
|
+
onScrollEnd?: import("react").UIEventHandler<HTMLDivElement> | undefined;
|
|
324
|
+
onScrollEndCapture?: import("react").UIEventHandler<HTMLDivElement> | undefined;
|
|
325
|
+
onWheel?: import("react").WheelEventHandler<HTMLDivElement> | undefined;
|
|
326
|
+
onWheelCapture?: import("react").WheelEventHandler<HTMLDivElement> | undefined;
|
|
327
|
+
onAnimationStart?: import("react").AnimationEventHandler<HTMLDivElement> | undefined;
|
|
328
|
+
onAnimationStartCapture?: import("react").AnimationEventHandler<HTMLDivElement> | undefined;
|
|
329
|
+
onAnimationEnd?: import("react").AnimationEventHandler<HTMLDivElement> | undefined;
|
|
330
|
+
onAnimationEndCapture?: import("react").AnimationEventHandler<HTMLDivElement> | undefined;
|
|
331
|
+
onAnimationIteration?: import("react").AnimationEventHandler<HTMLDivElement> | undefined;
|
|
332
|
+
onAnimationIterationCapture?: import("react").AnimationEventHandler<HTMLDivElement> | undefined;
|
|
333
|
+
onToggle?: import("react").ToggleEventHandler<HTMLDivElement> | undefined;
|
|
334
|
+
onBeforeToggle?: import("react").ToggleEventHandler<HTMLDivElement> | undefined;
|
|
335
|
+
onTransitionCancel?: import("react").TransitionEventHandler<HTMLDivElement> | undefined;
|
|
336
|
+
onTransitionCancelCapture?: import("react").TransitionEventHandler<HTMLDivElement> | undefined;
|
|
337
|
+
onTransitionEnd?: import("react").TransitionEventHandler<HTMLDivElement> | undefined;
|
|
338
|
+
onTransitionEndCapture?: import("react").TransitionEventHandler<HTMLDivElement> | undefined;
|
|
339
|
+
onTransitionRun?: import("react").TransitionEventHandler<HTMLDivElement> | undefined;
|
|
340
|
+
onTransitionRunCapture?: import("react").TransitionEventHandler<HTMLDivElement> | undefined;
|
|
341
|
+
onTransitionStart?: import("react").TransitionEventHandler<HTMLDivElement> | undefined;
|
|
342
|
+
onTransitionStartCapture?: import("react").TransitionEventHandler<HTMLDivElement> | undefined;
|
|
343
|
+
}, HTMLDivElement>;
|
|
344
|
+
export declare const Card: typeof CardShortcut & {
|
|
345
|
+
Header: typeof Header;
|
|
346
|
+
Body: {
|
|
347
|
+
(props: import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
348
|
+
displayName: string;
|
|
349
|
+
};
|
|
350
|
+
Footer: {
|
|
351
|
+
(props: import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
352
|
+
displayName: string;
|
|
353
|
+
};
|
|
354
|
+
};
|
|
355
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* A card: a surface grouping related content.
|
|
4
|
+
*
|
|
5
|
+
* <Card heading="Next lesson" description="Thursday at 16:00" icon="lucide:calendar"
|
|
6
|
+
* actions={<Button size="sm">Reschedule</Button>}>
|
|
7
|
+
* …body…
|
|
8
|
+
* </Card>
|
|
9
|
+
*
|
|
10
|
+
* - `heading`, `description`: the header; `icon`: an Iconify name in a
|
|
11
|
+
* tinted tile beside them
|
|
12
|
+
* - `actions`: beside the heading; `footer`: a tinted strip along the bottom
|
|
13
|
+
* - `variant`: 'default' (a bordered surface), 'elevated' (lifted, no
|
|
14
|
+
* border), 'outline' (a border, no fill or shadow) or 'subtle' (a tinted
|
|
15
|
+
* fill, for a panel inside a page or another card)
|
|
16
|
+
* - `size`: 'sm', 'md' (default) or 'lg': the padding
|
|
17
|
+
* - `divided`: a line between the header and the body
|
|
18
|
+
* - `href`: the whole card is a link, lifting on hover
|
|
19
|
+
* - `flush`: no padding round the body, for content that runs edge to edge (a table, a list)
|
|
20
|
+
*
|
|
21
|
+
* Or composed from Card.Header (which takes heading, description, icon and
|
|
22
|
+
* actions too), Card.Body and Card.Footer, placed as they are:
|
|
23
|
+
*
|
|
24
|
+
* <Card>
|
|
25
|
+
* <Card.Header heading="Invoices" actions={<Button size="sm">New</Button>} />
|
|
26
|
+
* <Card.Body>…</Card.Body>
|
|
27
|
+
* <Card.Footer>…</Card.Footer>
|
|
28
|
+
* </Card>
|
|
29
|
+
*/
|
|
30
|
+
import { Children, createElement, isValidElement } from 'react';
|
|
31
|
+
import 'iconify-icon';
|
|
32
|
+
import { cx, partOf, partsOf, withParts } from '../utils.js';
|
|
33
|
+
import '../theme.css';
|
|
34
|
+
import './card.css';
|
|
35
|
+
// The header's content, shared by the props version and Card.Header.
|
|
36
|
+
function headerContent({ heading, description, icon, actions }, part) {
|
|
37
|
+
return _jsxs(_Fragment, { children: [icon && _jsx("span", { ...part('icon'), "aria-hidden": "true", children: _jsx("iconify-icon", { icon: icon }) }), (heading || description) && (_jsxs("div", { ...part('titles'), children: [heading && _jsx("h3", { ...part('heading'), children: heading }), description && _jsx("p", { ...part('description'), children: description })] })), actions && _jsx("div", { ...part('actions'), children: actions })] });
|
|
38
|
+
}
|
|
39
|
+
function Header({ heading = null, description = null, icon = null, actions = null, classes, className, children, ...rest }) {
|
|
40
|
+
const part = partsOf('card', classes);
|
|
41
|
+
return (_jsxs("div", { ...rest, ...part('header'), className: cx(className, classes?.header), children: [headerContent({ heading, description, icon, actions }, part), children] }));
|
|
42
|
+
}
|
|
43
|
+
const Body = partOf('card', 'body');
|
|
44
|
+
const Footer = partOf('card', 'footer');
|
|
45
|
+
const layout = [Header, Body, Footer];
|
|
46
|
+
function CardShortcut({ heading = null, description = null, icon = null, actions = null, footer = null, variant = 'default', size = 'md', divided = false, href = null, flush = false, className, classes, children, ...rest }) {
|
|
47
|
+
const part = partsOf('card', classes);
|
|
48
|
+
// Composed from Card.Header, Body and Footer: they go in as they are.
|
|
49
|
+
const composed = Children.toArray(children).some((node) => isValidElement(node) && layout.includes(node.type));
|
|
50
|
+
return createElement(href ? 'a' : 'div', {
|
|
51
|
+
...rest, ...part('root'), href: href ?? undefined, className: cx(className, classes?.root),
|
|
52
|
+
'data-variant': variant, 'data-size': size, 'data-flush': flush || undefined, 'data-divided': divided || undefined,
|
|
53
|
+
'data-link': href ? '' : undefined,
|
|
54
|
+
}, composed ? children : _jsxs(_Fragment, { children: [(heading || description || actions || icon) && (_jsx("div", { ...part('header'), children: headerContent({ heading, description, icon, actions }, part) })), children != null && _jsx("div", { ...part('body'), children: children }), footer && _jsx("div", { ...part('footer'), children: footer })] }));
|
|
55
|
+
}
|
|
56
|
+
export const Card = withParts(CardShortcut, { Header, Body, Footer });
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/* A card holds other components, so its rules use > to stay off them. */
|
|
2
|
+
@layer ui {
|
|
3
|
+
[data-scope=card][data-part=root] {
|
|
4
|
+
display: flex; flex-direction: column; width: 100%; min-width: 0; box-sizing: border-box;
|
|
5
|
+
background: var(--ui-surface); color: var(--ui-text); font-family: var(--ui-font); font-size: 14px; text-decoration: none;
|
|
6
|
+
border: 1px solid var(--ui-border); border-radius: calc(var(--ui-radius) + 4px); box-shadow: var(--ui-card-shadow);
|
|
7
|
+
--card-pad: 1.25rem;
|
|
8
|
+
/* Clipped only when flush, so a picker's popup inside isn't cut off. */
|
|
9
|
+
&[data-flush] { overflow: hidden; }
|
|
10
|
+
&[data-size=sm] { --card-pad: 0.875rem; }
|
|
11
|
+
&[data-size=lg] { --card-pad: 1.75rem; }
|
|
12
|
+
/* Lifted off the page: a soft shadow does the border's work. */
|
|
13
|
+
&[data-variant=elevated] { border-color: transparent;
|
|
14
|
+
box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 4px 12px -2px rgba(16, 24, 40, 0.08); }
|
|
15
|
+
&[data-variant=outline] { background: transparent; box-shadow: none; }
|
|
16
|
+
/* A tinted fill, for a panel inside a page or another card. */
|
|
17
|
+
&[data-variant=subtle] { background: color-mix(in srgb, var(--ui-hover) 70%, var(--ui-surface)); border-color: transparent; box-shadow: none; }
|
|
18
|
+
:is(.dark, [data-theme=dark]) &[data-variant=elevated] { border-color: var(--ui-border); box-shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.6); }
|
|
19
|
+
/* A link: lifts and darkens its border on hover. */
|
|
20
|
+
&[data-link] { cursor: pointer; transition: border-color 150ms, box-shadow 150ms, translate 150ms;
|
|
21
|
+
&:hover { border-color: color-mix(in srgb, var(--ui-muted) 50%, var(--ui-border)); translate: 0 -1px;
|
|
22
|
+
box-shadow: 0 2px 4px rgba(16, 24, 40, 0.06), 0 8px 20px -6px rgba(16, 24, 40, 0.12); }
|
|
23
|
+
&:focus-visible { outline: 2px solid var(--ui-ring); outline-offset: 2px; } }
|
|
24
|
+
}
|
|
25
|
+
[data-scope=card][data-part=header] { display: flex; align-items: flex-start; gap: 0.75rem; padding: var(--card-pad) var(--card-pad) 0;
|
|
26
|
+
[data-divided] > &, [data-flush] > & { padding-bottom: calc(var(--card-pad) * 0.8); border-bottom: 1px solid var(--ui-border); }
|
|
27
|
+
/* A card that is all header (a link card): padded all round. */
|
|
28
|
+
&:last-child { padding-bottom: var(--card-pad); border-bottom: none; } }
|
|
29
|
+
[data-scope=card][data-part=icon] { display: grid; place-items: center; width: 2.25rem; height: 2.25rem; flex-shrink: 0; margin-top: -0.125rem;
|
|
30
|
+
border-radius: var(--ui-radius); background: var(--ui-accent-soft); color: var(--ui-accent-soft-text); font-size: 18px; }
|
|
31
|
+
[data-scope=card][data-part=titles] { flex: 1; min-width: 0; }
|
|
32
|
+
[data-scope=card][data-part=heading] { margin: 0; font-size: 16px; font-weight: 600; line-height: 1.35; }
|
|
33
|
+
[data-scope=card][data-part=description] { margin: 0.25rem 0 0; color: var(--ui-muted); }
|
|
34
|
+
[data-scope=card][data-part=actions] { display: flex; gap: 0.5rem; flex-shrink: 0; }
|
|
35
|
+
[data-scope=card][data-part=body] { padding: var(--card-pad); flex-grow: 1;
|
|
36
|
+
[data-part=header] + & { padding-top: calc(var(--card-pad) * 0.8); }
|
|
37
|
+
[data-flush] > & { padding: 0; } }
|
|
38
|
+
/* The footer on a faint band, so actions read as the card's own. */
|
|
39
|
+
[data-scope=card][data-part=footer] { display: flex; align-items: center; justify-content: flex-end; gap: 0.5rem;
|
|
40
|
+
padding: calc(var(--card-pad) * 0.6) var(--card-pad); border-top: 1px solid var(--ui-border);
|
|
41
|
+
background: color-mix(in srgb, var(--ui-hover) 55%, var(--ui-surface)); border-radius: 0 0 calc(var(--ui-radius) + 3px) calc(var(--ui-radius) + 3px);
|
|
42
|
+
[data-variant=outline] > &, [data-variant=subtle] > & { background: transparent; } }
|
|
43
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type HTMLAttributes } from 'react';
|
|
2
|
+
import { type ChartClasses } from './ChartFrame.js';
|
|
3
|
+
import { type ChartRow, type ChartSeries } from './chart.js';
|
|
4
|
+
export type ChartProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {
|
|
5
|
+
data?: ChartRow[];
|
|
6
|
+
x?: string;
|
|
7
|
+
y?: string | null;
|
|
8
|
+
series?: ChartSeries[] | null;
|
|
9
|
+
height?: number;
|
|
10
|
+
format?: ((value: number) => string) | null;
|
|
11
|
+
label?: string;
|
|
12
|
+
grid?: boolean;
|
|
13
|
+
stacked?: boolean;
|
|
14
|
+
classes?: ChartClasses;
|
|
15
|
+
};
|
|
16
|
+
export type AreaChartProps = ChartProps & {
|
|
17
|
+
curve?: 'smooth' | 'linear';
|
|
18
|
+
};
|
|
19
|
+
export declare function AreaChart({ data, x, y, series, height, format, label: labelProp, grid, curve, stacked, classes, ...rest }: AreaChartProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* A filled line chart, drawn to its width, with a tooltip on hover.
|
|
4
|
+
*
|
|
5
|
+
* <AreaChart data={months} x="month" y="revenue" format={(v) => `£${v}`} />
|
|
6
|
+
* <AreaChart data={months} x="month" series={[{ key: 'maths', label: 'Maths' }, { key: 'english', label: 'English' }]} />
|
|
7
|
+
*
|
|
8
|
+
* - `data`: rows of objects; `x` names the label property ('label')
|
|
9
|
+
* - `y`: the value property, or `series` for several, each `{ key, label, color }`
|
|
10
|
+
* (colours from the theme's --ui-chart-1…5 by default)
|
|
11
|
+
* - `curve`: 'smooth' (default) or 'linear'; `stacked`: series sit on top of one another
|
|
12
|
+
* - `height` (240 px), `format(value)` for ticks and tooltips, `grid` (lines; true)
|
|
13
|
+
* - `label`: what it shows, for assistive tech (a hidden table of the data)
|
|
14
|
+
*/
|
|
15
|
+
import { useLocale, useMessages } from '../format/LocaleProvider.js';
|
|
16
|
+
import { useId, useState } from 'react';
|
|
17
|
+
import { scalePoint } from 'd3-scale';
|
|
18
|
+
import { area, line, curveMonotoneX, curveLinear } from 'd3-shape';
|
|
19
|
+
import { ChartFrame } from './ChartFrame.js';
|
|
20
|
+
import { seriesOf, formatter, pad, yScale, leftFor, labelStep, num } from './chart.js';
|
|
21
|
+
import { partsOf } from '../utils.js';
|
|
22
|
+
export function AreaChart({ data = [], x = 'label', y = null, series = null, height = 240, format = null, label: labelProp, grid = true, curve = 'smooth', stacked = false, classes, ...rest }) {
|
|
23
|
+
const t = useMessages();
|
|
24
|
+
const label = labelProp ?? t.chart.label;
|
|
25
|
+
const part = partsOf('chart', classes);
|
|
26
|
+
// Safe inside url(#…), whatever React's ids look like.
|
|
27
|
+
const id = useId().replace(/[^\w-]/g, '');
|
|
28
|
+
const [hover, setHover] = useState(null);
|
|
29
|
+
const [width, setWidth] = useState(0);
|
|
30
|
+
const rows = data ?? [];
|
|
31
|
+
const list = seriesOf(series, y);
|
|
32
|
+
const fmt = formatter(format, useLocale());
|
|
33
|
+
const innerH = Math.max(0, height - pad.top - pad.bottom);
|
|
34
|
+
// Each series' [low, high] per row: from 0, or stacked on the ones before.
|
|
35
|
+
const base = rows.map(() => 0);
|
|
36
|
+
const bands = list.map((s) => rows.map((row, i) => {
|
|
37
|
+
const value = num(row[s.key]);
|
|
38
|
+
const low = stacked ? base[i] : 0;
|
|
39
|
+
if (stacked)
|
|
40
|
+
base[i] = low + value;
|
|
41
|
+
return [low, low + value];
|
|
42
|
+
}));
|
|
43
|
+
const ys = yScale(Math.max(0, ...bands.flatMap((b) => b.map((v) => v[1]))), innerH);
|
|
44
|
+
const ticks = ys.ticks(4);
|
|
45
|
+
const left = leftFor(ticks, fmt);
|
|
46
|
+
const innerW = Math.max(0, width - left - pad.right);
|
|
47
|
+
const xs = scalePoint().domain(rows.map((_, i) => i)).range([0, innerW]);
|
|
48
|
+
const at = (i) => xs(i) ?? 0;
|
|
49
|
+
const shape = curve === 'linear' ? curveLinear : curveMonotoneX;
|
|
50
|
+
const fill = area().x((_, i) => at(i)).y0((d) => ys(d[0])).y1((d) => ys(d[1])).curve(shape);
|
|
51
|
+
const stroke = line().x((_, i) => at(i)).y((d) => ys(d[1])).curve(shape);
|
|
52
|
+
const step = labelStep(rows.length, innerW);
|
|
53
|
+
function move(e) {
|
|
54
|
+
if (!rows.length)
|
|
55
|
+
return;
|
|
56
|
+
const pos = e.clientX - e.currentTarget.getBoundingClientRect().left - left;
|
|
57
|
+
const gap = rows.length > 1 ? innerW / (rows.length - 1) : 0;
|
|
58
|
+
setHover(Math.max(0, Math.min(rows.length - 1, gap ? Math.round(pos / gap) : 0)));
|
|
59
|
+
}
|
|
60
|
+
return (_jsx(ChartFrame, { ...rest, rows: rows, x: x, list: list, fmt: fmt, height: height, label: label, classes: classes, hover: hover, onHover: setHover, onMove: move, width: width, onWidth: setWidth, tipLeft: hover == null ? 0 : left + at(hover), flip: hover != null && at(hover) > innerW * 0.6, children: _jsxs("svg", { ...part('svg'), width: width, height: height, "aria-hidden": "true", children: [_jsx("defs", { children: list.map((s, i) => (_jsxs("linearGradient", { id: `${id}-${i}`, x1: "0", x2: "0", y1: "0", y2: "1", children: [_jsx("stop", { offset: "0%", stopColor: s.color, stopOpacity: "0.28" }), _jsx("stop", { offset: "100%", stopColor: s.color, stopOpacity: "0.02" })] }, s.key))) }), _jsxs("g", { transform: `translate(${left},${pad.top})`, children: [ticks.map((tick) => (_jsxs("g", { children: [grid && _jsx("line", { ...part('grid'), x1: "0", x2: innerW, y1: ys(tick), y2: ys(tick) }), _jsx("text", { ...part('tick'), x: "-8", y: ys(tick), dy: "0.32em", textAnchor: "end", children: fmt(tick) })] }, tick))), rows.map((row, i) => i % step === 0 && (_jsx("text", { ...part('tick'), x: at(i), y: innerH + 18, textAnchor: i === 0 ? 'start' : i === rows.length - 1 ? 'end' : 'middle', children: String(row[x] ?? '') }, i))), list.map((s, i) => (_jsxs("g", { children: [_jsx("path", { ...part('area'), d: fill(bands[i]) ?? '', fill: `url(#${id}-${i})` }), _jsx("path", { ...part('line'), d: stroke(bands[i]) ?? '', stroke: s.color })] }, s.key))), hover != null && _jsxs(_Fragment, { children: [_jsx("line", { ...part('cursor'), x1: at(hover), x2: at(hover), y1: "0", y2: innerH }), list.map((s, i) => _jsx("circle", { ...part('dot'), cx: at(hover), cy: ys(bands[i][hover][1]), r: "4", fill: s.color }, s.key))] })] })] }) }));
|
|
61
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Vertical bars, one per row (or a group per row for several series), drawn
|
|
4
|
+
* to its width, with a tooltip on hover.
|
|
5
|
+
*
|
|
6
|
+
* <BarChart data={weeks} x="week" y="lessons" />
|
|
7
|
+
* <BarChart data={months} x="month" series={subjects} stacked />
|
|
8
|
+
*
|
|
9
|
+
* - `data`, `x`, `y`, `series`, `height`, `format`, `grid`, `label`: as for AreaChart
|
|
10
|
+
* - `stacked`: series sit on top of one another instead of side by side
|
|
11
|
+
*/
|
|
12
|
+
import { useLocale, useMessages } from '../format/LocaleProvider.js';
|
|
13
|
+
import { useState } from 'react';
|
|
14
|
+
import { scaleBand } from 'd3-scale';
|
|
15
|
+
import { ChartFrame } from './ChartFrame.js';
|
|
16
|
+
import { seriesOf, formatter, pad, yScale, leftFor, labelStep, num } from './chart.js';
|
|
17
|
+
import { partsOf } from '../utils.js';
|
|
18
|
+
export function BarChart({ data = [], x = 'label', y = null, series = null, height = 240, format = null, label: labelProp, grid = true, stacked = false, classes, ...rest }) {
|
|
19
|
+
const t = useMessages();
|
|
20
|
+
const label = labelProp ?? t.chart.label;
|
|
21
|
+
const part = partsOf('chart', classes);
|
|
22
|
+
const [hover, setHover] = useState(null);
|
|
23
|
+
const [width, setWidth] = useState(0);
|
|
24
|
+
const rows = data ?? [];
|
|
25
|
+
const list = seriesOf(series, y);
|
|
26
|
+
const fmt = formatter(format, useLocale());
|
|
27
|
+
const innerH = Math.max(0, height - pad.top - pad.bottom);
|
|
28
|
+
const sum = (row) => list.reduce((total, s) => total + num(row[s.key]), 0);
|
|
29
|
+
const max = Math.max(0, ...rows.map((row) => (stacked ? sum(row) : Math.max(0, ...list.map((s) => num(row[s.key]))))));
|
|
30
|
+
const ys = yScale(max, innerH);
|
|
31
|
+
const ticks = ys.ticks(4);
|
|
32
|
+
const left = leftFor(ticks, fmt);
|
|
33
|
+
const innerW = Math.max(0, width - left - pad.right);
|
|
34
|
+
const xs = scaleBand().domain(rows.map((_, i) => i)).range([0, innerW]).padding(0.3);
|
|
35
|
+
const at = (i) => xs(i) ?? 0;
|
|
36
|
+
const inner = scaleBand().domain(list.map((s) => s.key)).range([0, xs.bandwidth()]).padding(0.12);
|
|
37
|
+
const step = labelStep(rows.length, innerW);
|
|
38
|
+
// Each bar's box: side by side, or stacked.
|
|
39
|
+
const bars = rows.map((row, i) => {
|
|
40
|
+
let base = 0;
|
|
41
|
+
return list.map((s) => {
|
|
42
|
+
const value = num(row[s.key]);
|
|
43
|
+
const low = stacked ? base : 0;
|
|
44
|
+
if (stacked)
|
|
45
|
+
base += value;
|
|
46
|
+
return {
|
|
47
|
+
key: s.key, x: stacked ? at(i) : at(i) + (inner(s.key) ?? 0), y: ys(low + value), color: s.color,
|
|
48
|
+
w: stacked ? xs.bandwidth() : inner.bandwidth(), h: Math.max(0, ys(low) - ys(low + value)),
|
|
49
|
+
};
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
function move(e) {
|
|
53
|
+
if (!rows.length)
|
|
54
|
+
return;
|
|
55
|
+
const pos = e.clientX - e.currentTarget.getBoundingClientRect().left - left;
|
|
56
|
+
setHover(Math.max(0, Math.min(rows.length - 1, Math.floor(pos / (innerW / rows.length)))));
|
|
57
|
+
}
|
|
58
|
+
const flip = hover != null && at(hover) > innerW * 0.6;
|
|
59
|
+
return (_jsx(ChartFrame, { ...rest, rows: rows, x: x, list: list, fmt: fmt, height: height, label: label, classes: classes, hover: hover, onHover: setHover, onMove: move, width: width, onWidth: setWidth, tipLeft: hover == null ? 0 : left + at(hover) + (flip ? 0 : xs.bandwidth()), flip: flip, children: _jsx("svg", { ...part('svg'), width: width, height: height, "aria-hidden": "true", children: _jsxs("g", { transform: `translate(${left},${pad.top})`, children: [ticks.map((tick) => (_jsxs("g", { children: [grid && _jsx("line", { ...part('grid'), x1: "0", x2: innerW, y1: ys(tick), y2: ys(tick) }), _jsx("text", { ...part('tick'), x: "-8", y: ys(tick), dy: "0.32em", textAnchor: "end", children: fmt(tick) })] }, tick))), hover != null && (_jsx("rect", { ...part('band'), x: at(hover) - (xs.step() * xs.paddingInner()) / 2, y: "0", width: xs.step(), height: innerH })), rows.map((row, i) => (_jsxs("g", { children: [i % step === 0 && _jsx("text", { ...part('tick'), x: at(i) + xs.bandwidth() / 2, y: innerH + 18, textAnchor: "middle", children: String(row[x] ?? '') }), bars[i].map((bar) => (_jsx("rect", { ...part('bar'), x: bar.x, y: bar.y, width: bar.w, height: bar.h, rx: stacked ? 0 : 3, fill: bar.color, "data-dim": (hover != null && hover !== i) || undefined }, bar.key)))] }, i)))] }) }) }));
|
|
60
|
+
}
|