@seanyeh77/ui 0.41.0 → 0.43.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -0
- package/dist/announce.d.ts +3 -0
- package/dist/announce.js +35 -0
- package/dist/announce.js.map +1 -0
- package/dist/bundle.js +24 -24
- package/dist/bundle.js.map +1 -1
- package/dist/components/AccentPicker/AccentPicker.d.ts +12 -0
- package/dist/components/AccentPicker/AccentPicker.js +99 -0
- package/dist/components/AccentPicker/AccentPicker.js.map +1 -0
- package/dist/components/ActionBar/ActionBar.d.ts +27 -0
- package/dist/components/ActionBar/ActionBar.js +62 -0
- package/dist/components/ActionBar/ActionBar.js.map +1 -0
- package/dist/components/AiMark/AiMark.d.ts +10 -0
- package/dist/components/AiMark/AiMark.js +21 -0
- package/dist/components/AiMark/AiMark.js.map +1 -0
- package/dist/components/Alert/Alert.d.ts +17 -0
- package/dist/components/Alert/Alert.js +59 -0
- package/dist/components/Alert/Alert.js.map +1 -0
- package/dist/components/AppShell/AppShell.d.ts +36 -0
- package/dist/components/AppShell/AppShell.js +198 -0
- package/dist/components/AppShell/AppShell.js.map +1 -0
- package/dist/components/Badge/Badge.d.ts +12 -0
- package/dist/components/Badge/Badge.js +58 -0
- package/dist/components/Badge/Badge.js.map +1 -0
- package/dist/components/BarChart/BarChart.d.ts +19 -0
- package/dist/components/BarChart/BarChart.js +78 -0
- package/dist/components/BarChart/BarChart.js.map +1 -0
- package/dist/components/Breadcrumb/Breadcrumb.d.ts +11 -0
- package/dist/components/Breadcrumb/Breadcrumb.js +29 -0
- package/dist/components/Breadcrumb/Breadcrumb.js.map +1 -0
- package/dist/components/Button/Button.d.ts +39 -0
- package/dist/components/Button/Button.js +55 -0
- package/dist/components/Button/Button.js.map +1 -0
- package/dist/components/Calendar/Calendar.d.ts +18 -0
- package/dist/components/Calendar/Calendar.js +129 -0
- package/dist/components/Calendar/Calendar.js.map +1 -0
- package/dist/components/Card/Card.d.ts +14 -0
- package/dist/components/Card/Card.js +33 -0
- package/dist/components/Card/Card.js.map +1 -0
- package/dist/components/Checkbox/Checkbox.d.ts +14 -0
- package/dist/components/Checkbox/Checkbox.js +27 -0
- package/dist/components/Checkbox/Checkbox.js.map +1 -0
- package/dist/components/CodeView/CodeView.d.ts +111 -0
- package/dist/components/CodeView/CodeView.js +794 -0
- package/dist/components/CodeView/CodeView.js.map +1 -0
- package/dist/components/CodeView/tokens.d.ts +5 -0
- package/dist/components/CodeView/tokens.js +70 -0
- package/dist/components/CodeView/tokens.js.map +1 -0
- package/dist/components/CommandPalette/CommandPalette.d.ts +52 -0
- package/dist/components/CommandPalette/CommandPalette.js +250 -0
- package/dist/components/CommandPalette/CommandPalette.js.map +1 -0
- package/dist/components/ConsoleLayout/ConsoleLayout.d.ts +44 -0
- package/dist/components/ConsoleLayout/ConsoleLayout.js +123 -0
- package/dist/components/ConsoleLayout/ConsoleLayout.js.map +1 -0
- package/dist/components/DangerZone/DangerZone.d.ts +16 -0
- package/dist/components/DangerZone/DangerZone.js +28 -0
- package/dist/components/DangerZone/DangerZone.js.map +1 -0
- package/dist/components/DataTable/DataTable.d.ts +99 -0
- package/dist/components/DataTable/DataTable.js +1272 -0
- package/dist/components/DataTable/DataTable.js.map +1 -0
- package/dist/components/DataTable/SortButton.js +228 -0
- package/dist/components/DataTable/SortButton.js.map +1 -0
- package/dist/components/DataTable/filters.js +147 -0
- package/dist/components/DataTable/filters.js.map +1 -0
- package/dist/components/DataTable/parts.js +383 -0
- package/dist/components/DataTable/parts.js.map +1 -0
- package/dist/components/DataTable/types.d.ts +85 -0
- package/dist/components/DatePicker/DatePicker.d.ts +15 -0
- package/dist/components/DatePicker/DatePicker.js +107 -0
- package/dist/components/DatePicker/DatePicker.js.map +1 -0
- package/dist/components/DateRangePicker/DateRangePicker.d.ts +11 -0
- package/dist/components/DateRangePicker/DateRangePicker.js +91 -0
- package/dist/components/DateRangePicker/DateRangePicker.js.map +1 -0
- package/dist/components/DetailList/DetailList.d.ts +17 -0
- package/dist/components/DetailList/DetailList.js +18 -0
- package/dist/components/DetailList/DetailList.js.map +1 -0
- package/dist/components/Dialog/Dialog.d.ts +30 -0
- package/dist/components/Dialog/Dialog.js +90 -0
- package/dist/components/Dialog/Dialog.js.map +1 -0
- package/dist/components/Drawer/Drawer.d.ts +20 -0
- package/dist/components/Drawer/Drawer.js +67 -0
- package/dist/components/Drawer/Drawer.js.map +1 -0
- package/dist/components/EmptyState/EmptyState.d.ts +15 -0
- package/dist/components/EmptyState/EmptyState.js +34 -0
- package/dist/components/EmptyState/EmptyState.js.map +1 -0
- package/dist/components/ErrorPage/ErrorPage.d.ts +14 -0
- package/dist/components/ErrorPage/ErrorPage.js +47 -0
- package/dist/components/ErrorPage/ErrorPage.js.map +1 -0
- package/dist/components/EventTimeline/EventTimeline.d.ts +19 -0
- package/dist/components/EventTimeline/EventTimeline.js +69 -0
- package/dist/components/EventTimeline/EventTimeline.js.map +1 -0
- package/dist/components/FileUpload/FileUpload.d.ts +27 -0
- package/dist/components/FileUpload/FileUpload.js +126 -0
- package/dist/components/FileUpload/FileUpload.js.map +1 -0
- package/dist/components/FormGrid/FormGrid.d.ts +7 -0
- package/dist/components/FormGrid/FormGrid.js +14 -0
- package/dist/components/FormGrid/FormGrid.js.map +1 -0
- package/dist/components/Graph/Graph.d.ts +18 -0
- package/dist/components/Graph/Graph.js +97 -0
- package/dist/components/Graph/Graph.js.map +1 -0
- package/dist/components/Grid/Grid.d.ts +16 -0
- package/dist/components/Grid/Grid.js +21 -0
- package/dist/components/Grid/Grid.js.map +1 -0
- package/dist/components/IconButton/IconButton.d.ts +32 -0
- package/dist/components/IconButton/IconButton.js +107 -0
- package/dist/components/IconButton/IconButton.js.map +1 -0
- package/dist/components/InlineCode/InlineCode.d.ts +46 -0
- package/dist/components/InlineCode/InlineCode.js +71 -0
- package/dist/components/InlineCode/InlineCode.js.map +1 -0
- package/dist/components/KpiCard/KpiCard.d.ts +38 -0
- package/dist/components/KpiCard/KpiCard.js +116 -0
- package/dist/components/KpiCard/KpiCard.js.map +1 -0
- package/dist/components/LayerGraph/LayerGraph.d.ts +117 -0
- package/dist/components/LayerGraph/LayerGraph.js +1648 -0
- package/dist/components/LayerGraph/LayerGraph.js.map +1 -0
- package/dist/components/LineChart/LineChart.d.ts +73 -0
- package/dist/components/LineChart/LineChart.js +337 -0
- package/dist/components/LineChart/LineChart.js.map +1 -0
- package/dist/components/LoadingBar/LoadingBar.d.ts +7 -0
- package/dist/components/LoadingBar/LoadingBar.js +18 -0
- package/dist/components/LoadingBar/LoadingBar.js.map +1 -0
- package/dist/components/LoginCard/LoginCard.d.ts +23 -0
- package/dist/components/LoginCard/LoginCard.js +117 -0
- package/dist/components/LoginCard/LoginCard.js.map +1 -0
- package/dist/components/Markdown/Markdown.d.ts +38 -0
- package/dist/components/Markdown/Markdown.js +719 -0
- package/dist/components/Markdown/Markdown.js.map +1 -0
- package/dist/components/Menu/Menu.d.ts +33 -0
- package/dist/components/Menu/Menu.js +78 -0
- package/dist/components/Menu/Menu.js.map +1 -0
- package/dist/components/Meter/Meter.d.ts +20 -0
- package/dist/components/Meter/Meter.js +120 -0
- package/dist/components/Meter/Meter.js.map +1 -0
- package/dist/components/MobileTabBar/MobileTabBar.d.ts +21 -0
- package/dist/components/MobileTabBar/MobileTabBar.js +47 -0
- package/dist/components/MobileTabBar/MobileTabBar.js.map +1 -0
- package/dist/components/MultiSelect/MultiSelect.d.ts +25 -0
- package/dist/components/MultiSelect/MultiSelect.js +119 -0
- package/dist/components/MultiSelect/MultiSelect.js.map +1 -0
- package/dist/components/NotificationBell/NotificationBell.d.ts +20 -0
- package/dist/components/NotificationBell/NotificationBell.js +95 -0
- package/dist/components/NotificationBell/NotificationBell.js.map +1 -0
- package/dist/components/Popover/Popover.d.ts +20 -0
- package/dist/components/Popover/Popover.js +48 -0
- package/dist/components/Popover/Popover.js.map +1 -0
- package/dist/components/ProgressBar/ProgressBar.d.ts +10 -0
- package/dist/components/ProgressBar/ProgressBar.js +38 -0
- package/dist/components/ProgressBar/ProgressBar.js.map +1 -0
- package/dist/components/ProgressRing/ProgressRing.d.ts +11 -0
- package/dist/components/ProgressRing/ProgressRing.js +53 -0
- package/dist/components/ProgressRing/ProgressRing.js.map +1 -0
- package/dist/components/ProjectSwitcher/ProjectSwitcher.d.ts +25 -0
- package/dist/components/ProjectSwitcher/ProjectSwitcher.js +100 -0
- package/dist/components/ProjectSwitcher/ProjectSwitcher.js.map +1 -0
- package/dist/components/RadioGroup/RadioGroup.d.ts +18 -0
- package/dist/components/RadioGroup/RadioGroup.js +63 -0
- package/dist/components/RadioGroup/RadioGroup.js.map +1 -0
- package/dist/components/SearchField/SearchField.d.ts +9 -0
- package/dist/components/SearchField/SearchField.js +50 -0
- package/dist/components/SearchField/SearchField.js.map +1 -0
- package/dist/components/Section/Section.d.ts +50 -0
- package/dist/components/Section/Section.js +225 -0
- package/dist/components/Section/Section.js.map +1 -0
- package/dist/components/SegmentedControl/SegmentedControl.d.ts +23 -0
- package/dist/components/SegmentedControl/SegmentedControl.js +86 -0
- package/dist/components/SegmentedControl/SegmentedControl.js.map +1 -0
- package/dist/components/Select/Select.d.ts +31 -0
- package/dist/components/Select/Select.js +143 -0
- package/dist/components/Select/Select.js.map +1 -0
- package/dist/components/SettingsLayout/SettingsLayout.d.ts +27 -0
- package/dist/components/SettingsLayout/SettingsLayout.js +69 -0
- package/dist/components/SettingsLayout/SettingsLayout.js.map +1 -0
- package/dist/components/SideNav/SideNav.d.ts +48 -0
- package/dist/components/SideNav/SideNav.js +225 -0
- package/dist/components/SideNav/SideNav.js.map +1 -0
- package/dist/components/Skeleton/Skeleton.d.ts +8 -0
- package/dist/components/Skeleton/Skeleton.js +17 -0
- package/dist/components/Skeleton/Skeleton.js.map +1 -0
- package/dist/components/SplitPane/SplitPane.d.ts +23 -0
- package/dist/components/SplitPane/SplitPane.js +140 -0
- package/dist/components/SplitPane/SplitPane.js.map +1 -0
- package/dist/components/StatusBand/StatusBand.d.ts +31 -0
- package/dist/components/StatusBand/StatusBand.js +43 -0
- package/dist/components/StatusBand/StatusBand.js.map +1 -0
- package/dist/components/Suggestion/Suggestion.d.ts +22 -0
- package/dist/components/Suggestion/Suggestion.js +75 -0
- package/dist/components/Suggestion/Suggestion.js.map +1 -0
- package/dist/components/Switch/Switch.d.ts +11 -0
- package/dist/components/Switch/Switch.js +56 -0
- package/dist/components/Switch/Switch.js.map +1 -0
- package/dist/components/Tabs/Tabs.d.ts +23 -0
- package/dist/components/Tabs/Tabs.js +117 -0
- package/dist/components/Tabs/Tabs.js.map +1 -0
- package/dist/components/Tag/Tag.d.ts +13 -0
- package/dist/components/Tag/Tag.js +26 -0
- package/dist/components/Tag/Tag.js.map +1 -0
- package/dist/components/Term/Term.d.ts +34 -0
- package/dist/components/Term/Term.js +143 -0
- package/dist/components/Term/Term.js.map +1 -0
- package/dist/components/TextArea/TextArea.d.ts +15 -0
- package/dist/components/TextArea/TextArea.js +75 -0
- package/dist/components/TextArea/TextArea.js.map +1 -0
- package/dist/components/TextField/TextField.d.ts +15 -0
- package/dist/components/TextField/TextField.js +43 -0
- package/dist/components/TextField/TextField.js.map +1 -0
- package/dist/components/ThemePicker/ThemePicker.d.ts +13 -0
- package/dist/components/ThemePicker/ThemePicker.js +66 -0
- package/dist/components/ThemePicker/ThemePicker.js.map +1 -0
- package/dist/components/TimeControl/TimeControl.d.ts +19 -0
- package/dist/components/TimeControl/TimeControl.js +47 -0
- package/dist/components/TimeControl/TimeControl.js.map +1 -0
- package/dist/components/Toast/Toast.d.ts +10 -0
- package/dist/components/Toast/Toast.js +30 -0
- package/dist/components/Toast/Toast.js.map +1 -0
- package/dist/components/Tooltip/Tooltip.d.ts +17 -0
- package/dist/components/Tooltip/Tooltip.js +69 -0
- package/dist/components/Tooltip/Tooltip.js.map +1 -0
- package/dist/components/TopBar/TopBar.d.ts +18 -0
- package/dist/components/TopBar/TopBar.js +59 -0
- package/dist/components/TopBar/TopBar.js.map +1 -0
- package/dist/components/Tour/Tour.d.ts +44 -0
- package/dist/components/Tour/Tour.js +440 -0
- package/dist/components/Tour/Tour.js.map +1 -0
- package/dist/components/TreeList/TreeList.d.ts +90 -0
- package/dist/components/TreeList/TreeList.js +594 -0
- package/dist/components/TreeList/TreeList.js.map +1 -0
- package/dist/components/TreeList/helpers.d.ts +2 -0
- package/dist/components/TreeList/helpers.js +104 -0
- package/dist/components/TreeList/helpers.js.map +1 -0
- package/dist/components/Workbench/Workbench.d.ts +100 -0
- package/dist/components/Workbench/Workbench.js +1142 -0
- package/dist/components/Workbench/Workbench.js.map +1 -0
- package/dist/components/ZoneMap/ZoneMap.d.ts +49 -0
- package/dist/components/ZoneMap/ZoneMap.js +89 -0
- package/dist/components/ZoneMap/ZoneMap.js.map +1 -0
- package/dist/css/AccentPicker.css +49 -0
- package/dist/css/ActionBar.css +36 -0
- package/dist/css/AiMark.css +14 -0
- package/dist/css/Alert.css +80 -0
- package/dist/css/AppShell.css +81 -0
- package/dist/css/Badge.css +68 -0
- package/dist/css/BarChart.css +66 -0
- package/dist/css/Breadcrumb.css +33 -0
- package/dist/css/Button.css +190 -0
- package/dist/css/Calendar.css +96 -0
- package/dist/css/Card.css +70 -0
- package/dist/css/Checkbox.css +38 -0
- package/dist/css/CodeView.css +302 -0
- package/dist/css/CommandPalette.css +232 -0
- package/dist/css/ConsoleLayout.css +131 -0
- package/dist/css/DangerZone.css +32 -0
- package/dist/css/DataTable.css +1195 -0
- package/dist/css/DatePicker.css +38 -0
- package/dist/css/DateRangePicker.css +70 -0
- package/dist/css/DetailList.css +69 -0
- package/dist/css/Dialog.css +3 -0
- package/dist/css/Drawer.css +90 -0
- package/dist/css/EmptyState.css +61 -0
- package/dist/css/ErrorPage.css +40 -0
- package/dist/css/EventTimeline.css +43 -0
- package/dist/css/FileUpload.css +92 -0
- package/dist/css/FormGrid.css +17 -0
- package/dist/css/Graph.css +99 -0
- package/dist/css/Grid.css +48 -0
- package/dist/css/IconButton.css +149 -0
- package/dist/css/InlineCode.css +92 -0
- package/dist/css/KpiCard.css +121 -0
- package/dist/css/LayerGraph.css +575 -0
- package/dist/css/LineChart.css +3 -0
- package/dist/css/LoadingBar.css +45 -0
- package/dist/css/LoginCard.css +65 -0
- package/dist/css/Markdown.css +266 -0
- package/dist/css/Menu.css +88 -0
- package/dist/css/Meter.css +110 -0
- package/dist/css/MobileTabBar.css +63 -0
- package/dist/css/MultiSelect.css +78 -0
- package/dist/css/NotificationBell.css +129 -0
- package/dist/css/Popover.css +57 -0
- package/dist/css/ProgressBar.css +42 -0
- package/dist/css/ProgressRing.css +19 -0
- package/dist/css/ProjectSwitcher.css +153 -0
- package/dist/css/RadioGroup.css +52 -0
- package/dist/css/SearchField.css +79 -0
- package/dist/css/Section.css +115 -0
- package/dist/css/SegmentedControl.css +67 -0
- package/dist/css/Select.css +136 -0
- package/dist/css/SettingsLayout.css +110 -0
- package/dist/css/SideNav.css +281 -0
- package/dist/css/Skeleton.css +19 -0
- package/dist/css/SplitPane.css +108 -0
- package/dist/css/StatusBand.css +23 -0
- package/dist/css/Suggestion.css +82 -0
- package/dist/css/Switch.css +46 -0
- package/dist/css/Tabs.css +91 -0
- package/dist/css/Tag.css +36 -0
- package/dist/css/Term.css +160 -0
- package/dist/css/TextArea.css +22 -0
- package/dist/css/TextField.css +2 -0
- package/dist/css/ThemePicker.css +70 -0
- package/dist/css/TimeControl.css +33 -0
- package/dist/css/Toast.css +47 -0
- package/dist/css/Tooltip.css +58 -0
- package/dist/css/TopBar.css +86 -0
- package/dist/css/Tour.css +90 -0
- package/dist/css/TreeList.css +532 -0
- package/dist/css/Workbench.css +652 -0
- package/dist/css/ZoneMap.css +203 -0
- package/dist/css/base.css +556 -0
- package/dist/css/end.css +273 -0
- package/dist/format-entry.d.ts +3 -0
- package/dist/format-entry.js +3 -0
- package/dist/format.d.ts +68 -2
- package/dist/format.js +237 -1
- package/dist/format.js.map +1 -0
- package/dist/i18n.d.ts +11 -0
- package/dist/{format-entry-CyChe8bk.js → i18n.js} +2 -235
- package/dist/i18n.js.map +1 -0
- package/dist/icons/Icon.d.ts +24 -0
- package/dist/icons/Icon.js +66 -0
- package/dist/icons/Icon.js.map +1 -0
- package/dist/icons/Spinner.js +18 -0
- package/dist/icons/Spinner.js.map +1 -0
- package/dist/icons/all.js +212 -0
- package/dist/icons/all.js.map +1 -0
- package/dist/icons/map.d.ts +3 -0
- package/dist/icons/map.js +31 -0
- package/dist/icons/map.js.map +1 -0
- package/dist/icons/names.d.ts +253 -0
- package/dist/icons/names.js +153 -0
- package/dist/icons/names.js.map +1 -0
- package/dist/icons/ph/archive.d.ts +10 -0
- package/dist/icons/ph/archive.js +11 -0
- package/dist/icons/ph/archive.js.map +1 -0
- package/dist/icons/ph/arrow-down.d.ts +10 -0
- package/dist/icons/ph/arrow-down.js +11 -0
- package/dist/icons/ph/arrow-down.js.map +1 -0
- package/dist/icons/ph/arrow-left.d.ts +10 -0
- package/dist/icons/ph/arrow-left.js +11 -0
- package/dist/icons/ph/arrow-left.js.map +1 -0
- package/dist/icons/ph/arrow-right.d.ts +10 -0
- package/dist/icons/ph/arrow-right.js +11 -0
- package/dist/icons/ph/arrow-right.js.map +1 -0
- package/dist/icons/ph/arrow-square-out.d.ts +10 -0
- package/dist/icons/ph/arrow-square-out.js +11 -0
- package/dist/icons/ph/arrow-square-out.js.map +1 -0
- package/dist/icons/ph/arrow-u-up-left.d.ts +10 -0
- package/dist/icons/ph/arrow-u-up-left.js +11 -0
- package/dist/icons/ph/arrow-u-up-left.js.map +1 -0
- package/dist/icons/ph/arrow-u-up-right.d.ts +10 -0
- package/dist/icons/ph/arrow-u-up-right.js +11 -0
- package/dist/icons/ph/arrow-u-up-right.js.map +1 -0
- package/dist/icons/ph/arrow-up.d.ts +10 -0
- package/dist/icons/ph/arrow-up.js +11 -0
- package/dist/icons/ph/arrow-up.js.map +1 -0
- package/dist/icons/ph/arrows-clockwise.d.ts +10 -0
- package/dist/icons/ph/arrows-clockwise.js +11 -0
- package/dist/icons/ph/arrows-clockwise.js.map +1 -0
- package/dist/icons/ph/arrows-in-line-vertical.d.ts +10 -0
- package/dist/icons/ph/arrows-in-line-vertical.js +11 -0
- package/dist/icons/ph/arrows-in-line-vertical.js.map +1 -0
- package/dist/icons/ph/arrows-left-right.d.ts +10 -0
- package/dist/icons/ph/arrows-left-right.js +11 -0
- package/dist/icons/ph/arrows-left-right.js.map +1 -0
- package/dist/icons/ph/arrows-out-line-vertical.d.ts +10 -0
- package/dist/icons/ph/arrows-out-line-vertical.js +11 -0
- package/dist/icons/ph/arrows-out-line-vertical.js.map +1 -0
- package/dist/icons/ph/bell.d.ts +10 -0
- package/dist/icons/ph/bell.js +11 -0
- package/dist/icons/ph/bell.js.map +1 -0
- package/dist/icons/ph/brackets-curly.d.ts +10 -0
- package/dist/icons/ph/brackets-curly.js +11 -0
- package/dist/icons/ph/brackets-curly.js.map +1 -0
- package/dist/icons/ph/calendar-blank.d.ts +10 -0
- package/dist/icons/ph/calendar-blank.js +11 -0
- package/dist/icons/ph/calendar-blank.js.map +1 -0
- package/dist/icons/ph/caret-down.d.ts +10 -0
- package/dist/icons/ph/caret-down.js +11 -0
- package/dist/icons/ph/caret-down.js.map +1 -0
- package/dist/icons/ph/caret-left.d.ts +10 -0
- package/dist/icons/ph/caret-left.js +11 -0
- package/dist/icons/ph/caret-left.js.map +1 -0
- package/dist/icons/ph/caret-right.d.ts +10 -0
- package/dist/icons/ph/caret-right.js +11 -0
- package/dist/icons/ph/caret-right.js.map +1 -0
- package/dist/icons/ph/caret-up.d.ts +10 -0
- package/dist/icons/ph/caret-up.js +11 -0
- package/dist/icons/ph/caret-up.js.map +1 -0
- package/dist/icons/ph/chart-bar.d.ts +10 -0
- package/dist/icons/ph/chart-bar.js +11 -0
- package/dist/icons/ph/chart-bar.js.map +1 -0
- package/dist/icons/ph/chart-line.d.ts +10 -0
- package/dist/icons/ph/chart-line.js +11 -0
- package/dist/icons/ph/chart-line.js.map +1 -0
- package/dist/icons/ph/chart-pie.d.ts +10 -0
- package/dist/icons/ph/chart-pie.js +11 -0
- package/dist/icons/ph/chart-pie.js.map +1 -0
- package/dist/icons/ph/chat-centered.d.ts +10 -0
- package/dist/icons/ph/chat-centered.js +11 -0
- package/dist/icons/ph/chat-centered.js.map +1 -0
- package/dist/icons/ph/check-circle.d.ts +10 -0
- package/dist/icons/ph/check-circle.js +11 -0
- package/dist/icons/ph/check-circle.js.map +1 -0
- package/dist/icons/ph/check-square.d.ts +10 -0
- package/dist/icons/ph/check-square.js +11 -0
- package/dist/icons/ph/check-square.js.map +1 -0
- package/dist/icons/ph/check.d.ts +10 -0
- package/dist/icons/ph/check.js +11 -0
- package/dist/icons/ph/check.js.map +1 -0
- package/dist/icons/ph/circle-notch.d.ts +10 -0
- package/dist/icons/ph/circle-notch.js +11 -0
- package/dist/icons/ph/circle-notch.js.map +1 -0
- package/dist/icons/ph/clock.d.ts +10 -0
- package/dist/icons/ph/clock.js +11 -0
- package/dist/icons/ph/clock.js.map +1 -0
- package/dist/icons/ph/cloud.d.ts +10 -0
- package/dist/icons/ph/cloud.js +11 -0
- package/dist/icons/ph/cloud.js.map +1 -0
- package/dist/icons/ph/columns.d.ts +10 -0
- package/dist/icons/ph/columns.js +11 -0
- package/dist/icons/ph/columns.js.map +1 -0
- package/dist/icons/ph/command.d.ts +10 -0
- package/dist/icons/ph/command.js +11 -0
- package/dist/icons/ph/command.js.map +1 -0
- package/dist/icons/ph/copy.d.ts +10 -0
- package/dist/icons/ph/copy.js +11 -0
- package/dist/icons/ph/copy.js.map +1 -0
- package/dist/icons/ph/corners-in.d.ts +10 -0
- package/dist/icons/ph/corners-in.js +11 -0
- package/dist/icons/ph/corners-in.js.map +1 -0
- package/dist/icons/ph/corners-out.d.ts +10 -0
- package/dist/icons/ph/corners-out.js +11 -0
- package/dist/icons/ph/corners-out.js.map +1 -0
- package/dist/icons/ph/cpu.d.ts +10 -0
- package/dist/icons/ph/cpu.js +11 -0
- package/dist/icons/ph/cpu.js.map +1 -0
- package/dist/icons/ph/database.d.ts +10 -0
- package/dist/icons/ph/database.js +11 -0
- package/dist/icons/ph/database.js.map +1 -0
- package/dist/icons/ph/dots-six-vertical.d.ts +10 -0
- package/dist/icons/ph/dots-six-vertical.js +11 -0
- package/dist/icons/ph/dots-six-vertical.js.map +1 -0
- package/dist/icons/ph/dots-three-vertical.d.ts +10 -0
- package/dist/icons/ph/dots-three-vertical.js +11 -0
- package/dist/icons/ph/dots-three-vertical.js.map +1 -0
- package/dist/icons/ph/dots-three.d.ts +10 -0
- package/dist/icons/ph/dots-three.js +11 -0
- package/dist/icons/ph/dots-three.js.map +1 -0
- package/dist/icons/ph/download-simple.d.ts +10 -0
- package/dist/icons/ph/download-simple.js +11 -0
- package/dist/icons/ph/download-simple.js.map +1 -0
- package/dist/icons/ph/envelope-simple.d.ts +10 -0
- package/dist/icons/ph/envelope-simple.js +11 -0
- package/dist/icons/ph/envelope-simple.js.map +1 -0
- package/dist/icons/ph/eye-slash.d.ts +10 -0
- package/dist/icons/ph/eye-slash.js +11 -0
- package/dist/icons/ph/eye-slash.js.map +1 -0
- package/dist/icons/ph/eye.d.ts +10 -0
- package/dist/icons/ph/eye.js +11 -0
- package/dist/icons/ph/eye.js.map +1 -0
- package/dist/icons/ph/file-code.d.ts +10 -0
- package/dist/icons/ph/file-code.js +11 -0
- package/dist/icons/ph/file-code.js.map +1 -0
- package/dist/icons/ph/file-text.d.ts +10 -0
- package/dist/icons/ph/file-text.js +11 -0
- package/dist/icons/ph/file-text.js.map +1 -0
- package/dist/icons/ph/file.d.ts +10 -0
- package/dist/icons/ph/file.js +11 -0
- package/dist/icons/ph/file.js.map +1 -0
- package/dist/icons/ph/floppy-disk.d.ts +10 -0
- package/dist/icons/ph/floppy-disk.js +11 -0
- package/dist/icons/ph/floppy-disk.js.map +1 -0
- package/dist/icons/ph/folder-open.d.ts +10 -0
- package/dist/icons/ph/folder-open.js +11 -0
- package/dist/icons/ph/folder-open.js.map +1 -0
- package/dist/icons/ph/folder.d.ts +10 -0
- package/dist/icons/ph/folder.js +11 -0
- package/dist/icons/ph/folder.js.map +1 -0
- package/dist/icons/ph/function.d.ts +10 -0
- package/dist/icons/ph/function.js +11 -0
- package/dist/icons/ph/function.js.map +1 -0
- package/dist/icons/ph/funnel.d.ts +10 -0
- package/dist/icons/ph/funnel.js +11 -0
- package/dist/icons/ph/funnel.js.map +1 -0
- package/dist/icons/ph/gauge.d.ts +10 -0
- package/dist/icons/ph/gauge.js +11 -0
- package/dist/icons/ph/gauge.js.map +1 -0
- package/dist/icons/ph/gear.d.ts +10 -0
- package/dist/icons/ph/gear.js +11 -0
- package/dist/icons/ph/gear.js.map +1 -0
- package/dist/icons/ph/globe.d.ts +10 -0
- package/dist/icons/ph/globe.js +11 -0
- package/dist/icons/ph/globe.js.map +1 -0
- package/dist/icons/ph/hard-drives.d.ts +10 -0
- package/dist/icons/ph/hard-drives.js +11 -0
- package/dist/icons/ph/hard-drives.js.map +1 -0
- package/dist/icons/ph/hash.d.ts +10 -0
- package/dist/icons/ph/hash.js +11 -0
- package/dist/icons/ph/hash.js.map +1 -0
- package/dist/icons/ph/heart.d.ts +10 -0
- package/dist/icons/ph/heart.js +11 -0
- package/dist/icons/ph/heart.js.map +1 -0
- package/dist/icons/ph/house.d.ts +10 -0
- package/dist/icons/ph/house.js +11 -0
- package/dist/icons/ph/house.js.map +1 -0
- package/dist/icons/ph/image.d.ts +10 -0
- package/dist/icons/ph/image.js +11 -0
- package/dist/icons/ph/image.js.map +1 -0
- package/dist/icons/ph/info.d.ts +10 -0
- package/dist/icons/ph/info.js +11 -0
- package/dist/icons/ph/info.js.map +1 -0
- package/dist/icons/ph/key.d.ts +10 -0
- package/dist/icons/ph/key.js +11 -0
- package/dist/icons/ph/key.js.map +1 -0
- package/dist/icons/ph/keyboard.d.ts +10 -0
- package/dist/icons/ph/keyboard.js +11 -0
- package/dist/icons/ph/keyboard.js.map +1 -0
- package/dist/icons/ph/layout.d.ts +10 -0
- package/dist/icons/ph/layout.js +11 -0
- package/dist/icons/ph/layout.js.map +1 -0
- package/dist/icons/ph/link.d.ts +10 -0
- package/dist/icons/ph/link.js +11 -0
- package/dist/icons/ph/link.js.map +1 -0
- package/dist/icons/ph/list-bullets.d.ts +10 -0
- package/dist/icons/ph/list-bullets.js +11 -0
- package/dist/icons/ph/list-bullets.js.map +1 -0
- package/dist/icons/ph/list.d.ts +10 -0
- package/dist/icons/ph/list.js +11 -0
- package/dist/icons/ph/list.js.map +1 -0
- package/dist/icons/ph/lock.d.ts +10 -0
- package/dist/icons/ph/lock.js +11 -0
- package/dist/icons/ph/lock.js.map +1 -0
- package/dist/icons/ph/magnifying-glass.d.ts +10 -0
- package/dist/icons/ph/magnifying-glass.js +11 -0
- package/dist/icons/ph/magnifying-glass.js.map +1 -0
- package/dist/icons/ph/minus.d.ts +10 -0
- package/dist/icons/ph/minus.js +11 -0
- package/dist/icons/ph/minus.js.map +1 -0
- package/dist/icons/ph/monitor.d.ts +10 -0
- package/dist/icons/ph/monitor.js +11 -0
- package/dist/icons/ph/monitor.js.map +1 -0
- package/dist/icons/ph/moon.d.ts +10 -0
- package/dist/icons/ph/moon.js +11 -0
- package/dist/icons/ph/moon.js.map +1 -0
- package/dist/icons/ph/paper-plane-tilt.d.ts +10 -0
- package/dist/icons/ph/paper-plane-tilt.js +11 -0
- package/dist/icons/ph/paper-plane-tilt.js.map +1 -0
- package/dist/icons/ph/pencil-simple.d.ts +10 -0
- package/dist/icons/ph/pencil-simple.js +11 -0
- package/dist/icons/ph/pencil-simple.js.map +1 -0
- package/dist/icons/ph/plus.d.ts +10 -0
- package/dist/icons/ph/plus.js +11 -0
- package/dist/icons/ph/plus.js.map +1 -0
- package/dist/icons/ph/printer.d.ts +10 -0
- package/dist/icons/ph/printer.js +11 -0
- package/dist/icons/ph/printer.js.map +1 -0
- package/dist/icons/ph/pulse.d.ts +10 -0
- package/dist/icons/ph/pulse.js +11 -0
- package/dist/icons/ph/pulse.js.map +1 -0
- package/dist/icons/ph/push-pin.d.ts +10 -0
- package/dist/icons/ph/push-pin.js +11 -0
- package/dist/icons/ph/push-pin.js.map +1 -0
- package/dist/icons/ph/question.d.ts +10 -0
- package/dist/icons/ph/question.js +11 -0
- package/dist/icons/ph/question.js.map +1 -0
- package/dist/icons/ph/share-network.d.ts +10 -0
- package/dist/icons/ph/share-network.js +11 -0
- package/dist/icons/ph/share-network.js.map +1 -0
- package/dist/icons/ph/shield.d.ts +10 -0
- package/dist/icons/ph/shield.js +11 -0
- package/dist/icons/ph/shield.js.map +1 -0
- package/dist/icons/ph/sidebar-simple.d.ts +10 -0
- package/dist/icons/ph/sidebar-simple.js +11 -0
- package/dist/icons/ph/sidebar-simple.js.map +1 -0
- package/dist/icons/ph/sign-in.d.ts +10 -0
- package/dist/icons/ph/sign-in.js +11 -0
- package/dist/icons/ph/sign-in.js.map +1 -0
- package/dist/icons/ph/sign-out.d.ts +10 -0
- package/dist/icons/ph/sign-out.js +11 -0
- package/dist/icons/ph/sign-out.js.map +1 -0
- package/dist/icons/ph/sliders-horizontal.d.ts +10 -0
- package/dist/icons/ph/sliders-horizontal.js +11 -0
- package/dist/icons/ph/sliders-horizontal.js.map +1 -0
- package/dist/icons/ph/sort-ascending.d.ts +10 -0
- package/dist/icons/ph/sort-ascending.js +11 -0
- package/dist/icons/ph/sort-ascending.js.map +1 -0
- package/dist/icons/ph/sparkle.d.ts +10 -0
- package/dist/icons/ph/sparkle.js +11 -0
- package/dist/icons/ph/sparkle.js.map +1 -0
- package/dist/icons/ph/square.d.ts +10 -0
- package/dist/icons/ph/square.js +11 -0
- package/dist/icons/ph/square.js.map +1 -0
- package/dist/icons/ph/squares-four.d.ts +10 -0
- package/dist/icons/ph/squares-four.js +11 -0
- package/dist/icons/ph/squares-four.js.map +1 -0
- package/dist/icons/ph/stack.d.ts +10 -0
- package/dist/icons/ph/stack.js +11 -0
- package/dist/icons/ph/stack.js.map +1 -0
- package/dist/icons/ph/star.d.ts +10 -0
- package/dist/icons/ph/star.js +11 -0
- package/dist/icons/ph/star.js.map +1 -0
- package/dist/icons/ph/sun.d.ts +10 -0
- package/dist/icons/ph/sun.js +11 -0
- package/dist/icons/ph/sun.js.map +1 -0
- package/dist/icons/ph/tag.d.ts +10 -0
- package/dist/icons/ph/tag.js +11 -0
- package/dist/icons/ph/tag.js.map +1 -0
- package/dist/icons/ph/terminal-window.d.ts +10 -0
- package/dist/icons/ph/terminal-window.js +11 -0
- package/dist/icons/ph/terminal-window.js.map +1 -0
- package/dist/icons/ph/trash.d.ts +10 -0
- package/dist/icons/ph/trash.js +11 -0
- package/dist/icons/ph/trash.js.map +1 -0
- package/dist/icons/ph/trend-up.d.ts +10 -0
- package/dist/icons/ph/trend-up.js +11 -0
- package/dist/icons/ph/trend-up.js.map +1 -0
- package/dist/icons/ph/upload-simple.d.ts +10 -0
- package/dist/icons/ph/upload-simple.js +11 -0
- package/dist/icons/ph/upload-simple.js.map +1 -0
- package/dist/icons/ph/user.d.ts +10 -0
- package/dist/icons/ph/user.js +11 -0
- package/dist/icons/ph/user.js.map +1 -0
- package/dist/icons/ph/users.d.ts +10 -0
- package/dist/icons/ph/users.js +11 -0
- package/dist/icons/ph/users.js.map +1 -0
- package/dist/icons/ph/warning-circle.d.ts +10 -0
- package/dist/icons/ph/warning-circle.js +11 -0
- package/dist/icons/ph/warning-circle.js.map +1 -0
- package/dist/icons/ph/warning.d.ts +10 -0
- package/dist/icons/ph/warning.js +11 -0
- package/dist/icons/ph/warning.js.map +1 -0
- package/dist/icons/ph/x-circle.d.ts +10 -0
- package/dist/icons/ph/x-circle.js +11 -0
- package/dist/icons/ph/x-circle.js.map +1 -0
- package/dist/icons/ph/x.d.ts +10 -0
- package/dist/icons/ph/x.js +11 -0
- package/dist/icons/ph/x.js.map +1 -0
- package/dist/icons/store.d.ts +6 -0
- package/dist/icons/store.js +77 -0
- package/dist/icons/store.js.map +1 -0
- package/dist/index.d.ts +86 -2293
- package/dist/index.js +82 -13349
- package/dist/internal/Field.js +74 -0
- package/dist/internal/Field.js.map +1 -0
- package/dist/internal/FloatingPanel.js +41 -0
- package/dist/internal/FloatingPanel.js.map +1 -0
- package/dist/internal/chart.js +131 -0
- package/dist/internal/chart.js.map +1 -0
- package/dist/internal/dev.js +21 -0
- package/dist/internal/dev.js.map +1 -0
- package/dist/internal/focus.js +94 -0
- package/dist/internal/focus.js.map +1 -0
- package/dist/internal/focusMain.d.ts +4 -0
- package/dist/internal/focusMain.js +22 -0
- package/dist/internal/focusMain.js.map +1 -0
- package/dist/internal/scrollHint.js +78 -0
- package/dist/internal/scrollHint.js.map +1 -0
- package/dist/internal/tableTools.js +114 -0
- package/dist/internal/tableTools.js.map +1 -0
- package/dist/internal/terms.d.ts +18 -0
- package/dist/internal/terms.js +64 -0
- package/dist/internal/terms.js.map +1 -0
- package/dist/internal/util.js +107 -0
- package/dist/internal/util.js.map +1 -0
- package/dist/motion.d.ts +5 -0
- package/dist/motion.js +29 -0
- package/dist/motion.js.map +1 -0
- package/dist/styles.css +4280 -4265
- package/dist/theme.d.ts +20 -0
- package/dist/theme.js +210 -0
- package/dist/theme.js.map +1 -0
- package/dist/tokens.css +4 -0
- package/docs/guidelines.md +1 -0
- package/docs/theme.md +51 -0
- package/package.json +5 -4
- package/dist/format-entry-CgMBtkni.d.ts +0 -79
- package/dist/format-entry-CyChe8bk.js.map +0 -1
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { tr } from "../../i18n.js";
|
|
3
|
+
import { cx } from "../../internal/util.js";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
// src/components/Badge/Badge.tsx
|
|
6
|
+
const STATUS = {
|
|
7
|
+
draft: {
|
|
8
|
+
label: "草稿",
|
|
9
|
+
fill: ""
|
|
10
|
+
},
|
|
11
|
+
doing: {
|
|
12
|
+
label: "進行中",
|
|
13
|
+
fill: "M12 4a8 8 0 0 1 0 16z"
|
|
14
|
+
},
|
|
15
|
+
review: {
|
|
16
|
+
label: "審核中",
|
|
17
|
+
fill: "M12 4a8 8 0 0 1 8 8h-8z"
|
|
18
|
+
},
|
|
19
|
+
done: {
|
|
20
|
+
label: "完成",
|
|
21
|
+
fill: "M12 4a8 8 0 1 1 0 16a8 8 0 1 1 0-16z"
|
|
22
|
+
},
|
|
23
|
+
fail: {
|
|
24
|
+
label: "失敗",
|
|
25
|
+
fill: "M12 4a8 8 0 1 1 0 16a8 8 0 1 1 0-16z"
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
/** Status of an item. The mark's shape carries the status too, so it never depends on color alone. */
|
|
29
|
+
function Badge({ status, variant = "chip", children, className }) {
|
|
30
|
+
const st = STATUS[status] ? status : "draft";
|
|
31
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
32
|
+
className: cx("ui-badge", "ui-badge-" + st, variant === "dot" && "is-dot", className),
|
|
33
|
+
children: [/* @__PURE__ */ jsxs("svg", {
|
|
34
|
+
className: "ui-badge-mark",
|
|
35
|
+
width: 15,
|
|
36
|
+
height: 15,
|
|
37
|
+
viewBox: "0 0 24 24",
|
|
38
|
+
"aria-hidden": "true",
|
|
39
|
+
children: [/* @__PURE__ */ jsx("circle", {
|
|
40
|
+
cx: 12,
|
|
41
|
+
cy: 12,
|
|
42
|
+
r: 8,
|
|
43
|
+
fill: "none",
|
|
44
|
+
stroke: "currentColor",
|
|
45
|
+
strokeWidth: 2.5
|
|
46
|
+
}), STATUS[st].fill ? /* @__PURE__ */ jsx("path", {
|
|
47
|
+
d: STATUS[st].fill,
|
|
48
|
+
fill: "currentColor"
|
|
49
|
+
}) : null]
|
|
50
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
51
|
+
className: "ui-badge-text",
|
|
52
|
+
children: children || tr(STATUS[st].label)
|
|
53
|
+
})]
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
export { Badge };
|
|
57
|
+
|
|
58
|
+
//# sourceMappingURL=Badge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Badge.js","names":[],"sources":["../../../src/components/Badge/Badge.tsx"],"sourcesContent":["import type * as React from 'react';\nimport { tr } from '../../i18n';\nimport { cx } from '../../internal/util';\n\nexport type BadgeStatus = 'draft' | 'doing' | 'review' | 'done' | 'fail';\n\nconst STATUS: Record<BadgeStatus, { label: string; fill: string }> = {\n draft: { label: '草稿', fill: '' },\n doing: { label: '進行中', fill: 'M12 4a8 8 0 0 1 0 16z' },\n review: { label: '審核中', fill: 'M12 4a8 8 0 0 1 8 8h-8z' },\n done: { label: '完成', fill: 'M12 4a8 8 0 1 1 0 16a8 8 0 1 1 0-16z' },\n fail: { label: '失敗', fill: 'M12 4a8 8 0 1 1 0 16a8 8 0 1 1 0-16z' },\n};\n\nexport interface BadgeProps {\n status: BadgeStatus;\n /** 'dot' on cards: a mark and colored text, no chip. Default 'chip'. */\n variant?: 'chip' | 'dot';\n /** Default: the status name (草稿, 進行中, 審核中, 完成, 失敗). */\n children?: React.ReactNode;\n className?: string;\n}\n\n/** Status of an item. The mark's shape carries the status too, so it never depends on color alone. */\nexport function Badge({ status, variant = 'chip', children, className }: BadgeProps) {\n const st = STATUS[status] ? status : 'draft';\n return (\n <span className={cx('ui-badge', 'ui-badge-' + st, variant === 'dot' && 'is-dot', className)}>\n <svg className=\"ui-badge-mark\" width={15} height={15} viewBox=\"0 0 24 24\" aria-hidden=\"true\">\n <circle cx={12} cy={12} r={8} fill=\"none\" stroke=\"currentColor\" strokeWidth={2.5} />\n {STATUS[st].fill ? <path d={STATUS[st].fill} fill=\"currentColor\" /> : null}\n </svg>\n <span className=\"ui-badge-text\">{children || tr(STATUS[st].label)}</span>\n </span>\n );\n}\n"],"mappings":";;;;;AAMA,MAAM,SAA+D;CACnE,OAAO;EAAE,OAAO;EAAM,MAAM;CAAG;CAC/B,OAAO;EAAE,OAAO;EAAO,MAAM;CAAwB;CACrD,QAAQ;EAAE,OAAO;EAAO,MAAM;CAA0B;CACxD,MAAM;EAAE,OAAO;EAAM,MAAM;CAAuC;CAClE,MAAM;EAAE,OAAO;EAAM,MAAM;CAAuC;AACpE;;AAYA,SAAgB,MAAM,EAAE,QAAQ,UAAU,QAAQ,UAAU,aAAyB;CACnF,MAAM,KAAK,OAAO,UAAU,SAAS;CACrC,OACE,qBAAC,QAAD;EAAM,WAAW,GAAG,YAAY,cAAc,IAAI,YAAY,SAAS,UAAU,SAAS;EAA1F,UAAA,CACE,qBAAC,OAAD;GAAK,WAAU;GAAgB,OAAO;GAAI,QAAQ;GAAI,SAAQ;GAAY,eAAY;GAAtF,UAAA,CACE,oBAAC,UAAD;IAAQ,IAAI;IAAI,IAAI;IAAI,GAAG;IAAG,MAAK;IAAO,QAAO;IAAe,aAAa;GAAM,CAAA,GAClF,OAAO,GAAG,CAAC,OAAO,oBAAC,QAAD;IAAM,GAAG,OAAO,GAAG,CAAC;IAAM,MAAK;GAAgB,CAAA,IAAI,IACnE;EACL,CAAA,GAAA,oBAAC,QAAD;GAAM,WAAU;GAAiB,UAAA,YAAY,GAAG,OAAO,GAAG,CAAC,KAAK;EAAQ,CAAA,CACpE;;AAEV"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface BarDatum {
|
|
3
|
+
label: string;
|
|
4
|
+
/** Shorter x-axis label when the full one would crowd. */
|
|
5
|
+
short?: string;
|
|
6
|
+
value: number;
|
|
7
|
+
}
|
|
8
|
+
export interface BarChartProps {
|
|
9
|
+
data: BarDatum[];
|
|
10
|
+
/** Describes the chart for screen readers. */
|
|
11
|
+
label: string;
|
|
12
|
+
unit?: string;
|
|
13
|
+
/** Decimals of the values in the tooltip. Default 0. */
|
|
14
|
+
decimals?: number;
|
|
15
|
+
max?: number;
|
|
16
|
+
className?: string;
|
|
17
|
+
}
|
|
18
|
+
/** Compares a few categories: rounded bars that grow in, a tooltip on hover. */
|
|
19
|
+
export declare function BarChart({ data, label, unit, decimals, max, className }: BarChartProps): React.JSX.Element;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { ChartTip, TICKS, chartKey, niceMax, tickDecimals } from "../../internal/chart.js";
|
|
3
|
+
import { cx, digits } from "../../internal/util.js";
|
|
4
|
+
import { format } from "../../format.js";
|
|
5
|
+
import { tr } from "../../i18n.js";
|
|
6
|
+
import { announce } from "../../announce.js";
|
|
7
|
+
import * as React from "react";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
// src/components/BarChart/BarChart.tsx
|
|
10
|
+
/** Compares a few categories: rounded bars that grow in, a tooltip on hover. */
|
|
11
|
+
function BarChart({ data, label, unit, decimals, max, className }) {
|
|
12
|
+
const [hi, setHi] = React.useState(-1);
|
|
13
|
+
const top = max || niceMax(Math.max(1, ...data.map((d) => d.value)));
|
|
14
|
+
const suffix = unit ? " " + unit : "";
|
|
15
|
+
const show = (i) => {
|
|
16
|
+
setHi(i);
|
|
17
|
+
announce(data[i].label + tr(":") + format.number(data[i].value, decimals) + suffix);
|
|
18
|
+
};
|
|
19
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
20
|
+
className: cx("ui-chart", className),
|
|
21
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
22
|
+
className: "ui-bars",
|
|
23
|
+
role: "img",
|
|
24
|
+
"aria-label": label,
|
|
25
|
+
"aria-description": tr("左右方向鍵查看每一項的數值"),
|
|
26
|
+
tabIndex: data.length ? 0 : void 0,
|
|
27
|
+
onMouseLeave: () => setHi(-1),
|
|
28
|
+
onFocus: () => hi < 0 && data.length && show(0),
|
|
29
|
+
onBlur: () => setHi(-1),
|
|
30
|
+
onKeyDown: (e) => {
|
|
31
|
+
const to = chartKey(e, hi, data.length);
|
|
32
|
+
if (to != null) show(to);
|
|
33
|
+
},
|
|
34
|
+
children: [TICKS.map((f, i) => /* @__PURE__ */ jsx("div", {
|
|
35
|
+
className: cx("ui-bars-grid", !i && "is-axis"),
|
|
36
|
+
style: { bottom: f * 100 + "%" },
|
|
37
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
38
|
+
className: "ui-chart-tick",
|
|
39
|
+
children: format.number(f * top, tickDecimals(top))
|
|
40
|
+
})
|
|
41
|
+
}, "g" + i)), /* @__PURE__ */ jsx("div", {
|
|
42
|
+
className: "ui-bars-row",
|
|
43
|
+
children: data.map((d, i) => {
|
|
44
|
+
const ht = d.value / top * 100 + "%";
|
|
45
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
46
|
+
className: "ui-bar-slot",
|
|
47
|
+
onMouseEnter: () => setHi(i),
|
|
48
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
49
|
+
className: "ui-bar",
|
|
50
|
+
style: {
|
|
51
|
+
height: ht,
|
|
52
|
+
animationDelay: i * 40 + "ms",
|
|
53
|
+
opacity: hi >= 0 && hi !== i ? .55 : 1
|
|
54
|
+
}
|
|
55
|
+
}), hi === i ? /* @__PURE__ */ jsx(ChartTip, {
|
|
56
|
+
style: {
|
|
57
|
+
bottom: `calc(${ht} + 8px)`,
|
|
58
|
+
left: "50%",
|
|
59
|
+
transform: "translateX(-50%)",
|
|
60
|
+
whiteSpace: "nowrap"
|
|
61
|
+
},
|
|
62
|
+
rows: [{
|
|
63
|
+
name: d.label,
|
|
64
|
+
value: format.number(d.value, decimals) + suffix
|
|
65
|
+
}]
|
|
66
|
+
}) : null]
|
|
67
|
+
}, i);
|
|
68
|
+
})
|
|
69
|
+
})]
|
|
70
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
71
|
+
className: "ui-bars-labels",
|
|
72
|
+
children: data.map((d, i) => /* @__PURE__ */ jsx("span", { children: digits(d.short || d.label) }, i))
|
|
73
|
+
})]
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
export { BarChart };
|
|
77
|
+
|
|
78
|
+
//# sourceMappingURL=BarChart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BarChart.js","names":[],"sources":["../../../src/components/BarChart/BarChart.tsx"],"sourcesContent":["import * as React from 'react';\nimport { ChartTip, TICKS, chartKey, tickDecimals, niceMax } from '../../internal/chart';\nimport { cx, digits } from '../../internal/util';\nimport { format } from '../../format';\nimport { tr } from '../../i18n';\nimport { announce } from '../../announce';\n\nexport interface BarDatum {\n label: string;\n /** Shorter x-axis label when the full one would crowd. */\n short?: string;\n value: number;\n}\n\nexport interface BarChartProps {\n data: BarDatum[];\n /** Describes the chart for screen readers. */\n label: string;\n unit?: string;\n /** Decimals of the values in the tooltip. Default 0. */\n decimals?: number;\n max?: number;\n className?: string;\n}\n\n/** Compares a few categories: rounded bars that grow in, a tooltip on hover. */\nexport function BarChart({ data, label, unit, decimals, max, className }: BarChartProps) {\n const [hi, setHi] = React.useState(-1);\n const top = max || niceMax(Math.max(1, ...data.map((d) => d.value)));\n const suffix = unit ? ' ' + unit : '';\n const show = (i: number) => {\n setHi(i);\n announce(data[i].label + tr(':') + format.number(data[i].value, decimals) + suffix);\n };\n return (\n <div className={cx('ui-chart', className)}>\n <div\n className=\"ui-bars\"\n role=\"img\"\n aria-label={label}\n aria-description={tr('左右方向鍵查看每一項的數值')}\n tabIndex={data.length ? 0 : undefined}\n onMouseLeave={() => setHi(-1)}\n // The keyboard sees the values too: ← → move between bars, each read aloud as it shows.\n onFocus={() => hi < 0 && data.length && show(0)}\n onBlur={() => setHi(-1)}\n onKeyDown={(e) => {\n const to = chartKey(e, hi, data.length);\n if (to != null) show(to);\n }}\n >\n {TICKS.map((f, i) => (\n <div key={'g' + i} className={cx('ui-bars-grid', !i && 'is-axis')} style={{ bottom: f * 100 + '%' }}>\n <span className=\"ui-chart-tick\">{format.number(f * top, tickDecimals(top))}</span>\n </div>\n ))}\n <div className=\"ui-bars-row\">\n {data.map((d, i) => {\n const ht = (d.value / top) * 100 + '%';\n return (\n <div key={i} className=\"ui-bar-slot\" onMouseEnter={() => setHi(i)}>\n <div className=\"ui-bar\" style={{ height: ht, animationDelay: i * 40 + 'ms', opacity: hi >= 0 && hi !== i ? 0.55 : 1 }} />\n {hi === i ? (\n <ChartTip\n style={{ bottom: `calc(${ht} + 8px)`, left: '50%', transform: 'translateX(-50%)', whiteSpace: 'nowrap' }}\n rows={[{ name: d.label, value: format.number(d.value, decimals) + suffix }]}\n />\n ) : null}\n </div>\n );\n })}\n </div>\n </div>\n <div className=\"ui-bars-labels\">\n {data.map((d, i) => (\n <span key={i}>{digits(d.short || d.label)}</span>\n ))}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;AA0BA,SAAgB,SAAS,EAAE,MAAM,OAAO,MAAM,UAAU,KAAK,aAA4B;CACvF,MAAM,CAAC,IAAI,SAAS,MAAM,SAAS,EAAE;CACrC,MAAM,MAAM,OAAO,QAAQ,KAAK,IAAI,GAAG,GAAG,KAAK,KAAK,MAAM,EAAE,KAAK,CAAC,CAAC;CACnE,MAAM,SAAS,OAAO,MAAM,OAAO;CACnC,MAAM,QAAQ,MAAc;EAC1B,MAAM,CAAC;EACP,SAAS,KAAK,EAAE,CAAC,QAAQ,GAAG,GAAG,IAAI,OAAO,OAAO,KAAK,EAAE,CAAC,OAAO,QAAQ,IAAI,MAAM;CACpF;CACA,OACE,qBAAC,OAAD;EAAK,WAAW,GAAG,YAAY,SAAS;EAAxC,UAAA,CACE,qBAAC,OAAD;GACE,WAAU;GACV,MAAK;GACL,cAAY;GACZ,oBAAkB,GAAG,eAAe;GACpC,UAAU,KAAK,SAAS,IAAI,KAAA;GAC5B,oBAAoB,MAAM,EAAE;GAE5B,eAAe,KAAK,KAAK,KAAK,UAAU,KAAK,CAAC;GAC9C,cAAc,MAAM,EAAE;GACtB,YAAY,MAAM;IAChB,MAAM,KAAK,SAAS,GAAG,IAAI,KAAK,MAAM;IACtC,IAAI,MAAM,MAAM,KAAK,EAAE;GACzB;GAbF,UAAA,CAeG,MAAM,KAAK,GAAG,MACb,oBAAC,OAAD;IAAmB,WAAW,GAAG,gBAAgB,CAAC,KAAK,SAAS;IAAG,OAAO,EAAE,QAAQ,IAAI,MAAM,IAAI;IAChG,UAAA,oBAAC,QAAD;KAAM,WAAU;KAAiB,UAAA,OAAO,OAAO,IAAI,KAAK,aAAa,GAAG,CAAC;IAAQ,CAAA;GAC9E,GAFK,MAAM,CAEX,CACN,GACD,oBAAC,OAAD;IAAK,WAAU;IACZ,UAAA,KAAK,KAAK,GAAG,MAAM;KAClB,MAAM,KAAM,EAAE,QAAQ,MAAO,MAAM;KACnC,OACE,qBAAC,OAAD;MAAa,WAAU;MAAc,oBAAoB,MAAM,CAAC;MAAhE,UAAA,CACE,oBAAC,OAAD;OAAK,WAAU;OAAS,OAAO;QAAE,QAAQ;QAAI,gBAAgB,IAAI,KAAK;QAAM,SAAS,MAAM,KAAK,OAAO,IAAI,MAAO;OAAE;MAAI,CAAA,GACvH,OAAO,IACN,oBAAC,UAAD;OACE,OAAO;QAAE,QAAQ,QAAQ,GAAG;QAAU,MAAM;QAAO,WAAW;QAAoB,YAAY;OAAS;OACvG,MAAM,CAAC;QAAE,MAAM,EAAE;QAAO,OAAO,OAAO,OAAO,EAAE,OAAO,QAAQ,IAAI;OAAO,CAAC;MAC3E,CAAA,IACC,IACD;KARK,GAAA,CAQL;IAET,CAAC;GACE,CAAA,CACF;EACL,CAAA,GAAA,oBAAC,OAAD;GAAK,WAAU;GACZ,UAAA,KAAK,KAAK,GAAG,MACZ,oBAAC,QAAD,EAAA,UAAe,OAAO,EAAE,SAAS,EAAE,KAAK,EAAQ,GAArC,CAAqC,CACjD;EACE,CAAA,CACF;;AAET"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface BreadcrumbItem {
|
|
2
|
+
label: string;
|
|
3
|
+
href?: string;
|
|
4
|
+
}
|
|
5
|
+
export interface BreadcrumbProps {
|
|
6
|
+
/** From the top level down; the last one is the current page. */
|
|
7
|
+
items: BreadcrumbItem[];
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
/** Where the page sits: links to each level, the current page last and not a link. */
|
|
11
|
+
export declare function Breadcrumb({ items, className }: BreadcrumbProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { tr } from "../../i18n.js";
|
|
3
|
+
import { cx } from "../../internal/util.js";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
// src/components/Breadcrumb/Breadcrumb.tsx
|
|
6
|
+
/** Where the page sits: links to each level, the current page last and not a link. */
|
|
7
|
+
function Breadcrumb({ items, className }) {
|
|
8
|
+
return /* @__PURE__ */ jsx("nav", {
|
|
9
|
+
className: cx("ui-crumb", className),
|
|
10
|
+
"aria-label": tr("路徑"),
|
|
11
|
+
children: /* @__PURE__ */ jsx("ol", { children: items.map((it, i) => {
|
|
12
|
+
const last = i === items.length - 1;
|
|
13
|
+
return /* @__PURE__ */ jsxs("li", { children: [last ? /* @__PURE__ */ jsx("span", {
|
|
14
|
+
"aria-current": "page",
|
|
15
|
+
children: it.label
|
|
16
|
+
}) : it.href ? /* @__PURE__ */ jsx("a", {
|
|
17
|
+
href: it.href,
|
|
18
|
+
children: it.label
|
|
19
|
+
}) : /* @__PURE__ */ jsx("span", { children: it.label }), last ? null : /* @__PURE__ */ jsx("span", {
|
|
20
|
+
className: "ui-crumb-sep",
|
|
21
|
+
"aria-hidden": "true",
|
|
22
|
+
children: "›"
|
|
23
|
+
})] }, i);
|
|
24
|
+
}) })
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
export { Breadcrumb };
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=Breadcrumb.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Breadcrumb.js","names":[],"sources":["../../../src/components/Breadcrumb/Breadcrumb.tsx"],"sourcesContent":["import { tr } from '../../i18n';\nimport { cx } from '../../internal/util';\n\nexport interface BreadcrumbItem {\n label: string;\n href?: string;\n}\n\nexport interface BreadcrumbProps {\n /** From the top level down; the last one is the current page. */\n items: BreadcrumbItem[];\n className?: string;\n}\n\n/** Where the page sits: links to each level, the current page last and not a link. */\nexport function Breadcrumb({ items, className }: BreadcrumbProps) {\n return (\n <nav className={cx('ui-crumb', className)} aria-label={tr('路徑')}>\n <ol>\n {items.map((it, i) => {\n const last = i === items.length - 1;\n return (\n <li key={i}>\n {last ? <span aria-current=\"page\">{it.label}</span> : it.href ? <a href={it.href}>{it.label}</a> : <span>{it.label}</span>}\n {last ? null : (\n <span className=\"ui-crumb-sep\" aria-hidden=\"true\">\n ›\n </span>\n )}\n </li>\n );\n })}\n </ol>\n </nav>\n );\n}\n"],"mappings":";;;;;;AAeA,SAAgB,WAAW,EAAE,OAAO,aAA8B;CAChE,OACE,oBAAC,OAAD;EAAK,WAAW,GAAG,YAAY,SAAS;EAAG,cAAY,GAAG,IAAI;EAC5D,UAAA,oBAAC,MAAD,EAAA,UACG,MAAM,KAAK,IAAI,MAAM;GACpB,MAAM,OAAO,MAAM,MAAM,SAAS;GAClC,OACE,qBAAC,MAAD,EAAA,UAAA,CACG,OAAO,oBAAC,QAAD;IAAM,gBAAa;IAAQ,UAAA,GAAG;GAAY,CAAA,IAAI,GAAG,OAAO,oBAAC,KAAD;IAAG,MAAM,GAAG;IAAO,UAAA,GAAG;GAAS,CAAA,IAAI,oBAAC,QAAD,EAAA,UAAO,GAAG,MAAY,CAAA,GACxH,OAAO,OACN,oBAAC,QAAD;IAAM,WAAU;IAAe,eAAY;IAAO,UAAA;GAE5C,CAAA,CAEN,EAAA,GAPK,CAOL;EAER,CAAC,EACC,CAAA;CACD,CAAA;AAET"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { IconSource } from "../../icons/Icon.js";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
interface ButtonBase extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children'> {
|
|
4
|
+
/** A verb: 儲存, 刪除, 匯出. No 「確定」or 「好」. */
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
/** Shows a spinner and disables the button; pair it with a progressive label such as 儲存中. */
|
|
7
|
+
loading?: boolean;
|
|
8
|
+
/** Leading icon: a built-in name such as 'plus', or custom path data. */
|
|
9
|
+
icon?: IconSource;
|
|
10
|
+
ref?: React.Ref<HTMLButtonElement>;
|
|
11
|
+
}
|
|
12
|
+
/** What the confirm dialog of a danger button says. */
|
|
13
|
+
export interface DangerConfirm {
|
|
14
|
+
/** Names the object: 「刪除 api-gateway?」. */
|
|
15
|
+
title: string;
|
|
16
|
+
/** What is lost and whether it can be undone. */
|
|
17
|
+
body?: React.ReactNode;
|
|
18
|
+
/** The danger button's label in the dialog. Default: the button's own label. */
|
|
19
|
+
confirmLabel?: string;
|
|
20
|
+
}
|
|
21
|
+
export type ButtonProps = (ButtonBase & {
|
|
22
|
+
/** primary: the one main action of a section (solid). secondary (default): everything else (outline). quiet:
|
|
23
|
+
* low-emphasis and toolbar actions, text only with no border, a gray background on hover. */
|
|
24
|
+
variant?: 'primary' | 'secondary' | 'quiet';
|
|
25
|
+
}) | (ButtonBase & {
|
|
26
|
+
/** Destructive. Must be confirmed: pass `confirm`, or `confirmed` when this button is itself inside the confirm Dialog. */
|
|
27
|
+
variant: 'danger';
|
|
28
|
+
/** Opens a Dialog first; onClick runs only after the person confirms. */
|
|
29
|
+
confirm: DangerConfirm;
|
|
30
|
+
confirmed?: never;
|
|
31
|
+
}) | (ButtonBase & {
|
|
32
|
+
variant: 'danger';
|
|
33
|
+
/** This button is the confirming button of a Dialog (or DangerZone), so it runs at once. */
|
|
34
|
+
confirmed: true;
|
|
35
|
+
confirm?: never;
|
|
36
|
+
});
|
|
37
|
+
/** Buttons. Labels are verbs; one primary per section; danger actions are always confirmed. */
|
|
38
|
+
export declare function Button(props: ButtonProps): React.JSX.Element;
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { IconOf } from "../../icons/Icon.js";
|
|
3
|
+
import { Spinner } from "../../icons/Spinner.js";
|
|
4
|
+
import { cx } from "../../internal/util.js";
|
|
5
|
+
import { devWarn } from "../../internal/dev.js";
|
|
6
|
+
import { tr } from "../../i18n.js";
|
|
7
|
+
import { Dialog } from "../Dialog/Dialog.js";
|
|
8
|
+
import * as React from "react";
|
|
9
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
// src/components/Button/Button.tsx
|
|
11
|
+
/** Buttons. Labels are verbs; one primary per section; danger actions are always confirmed. */
|
|
12
|
+
function Button(props) {
|
|
13
|
+
const { variant = "secondary", loading, icon, className, children, disabled, onClick, ...other } = props;
|
|
14
|
+
const { confirm, confirmed, ...native } = other;
|
|
15
|
+
const [asking, setAsking] = React.useState(false);
|
|
16
|
+
devWarn(variant === "danger" && !confirm && !confirmed, "Button", "a danger button needs confirm={{ title }} (or confirmed when it is the button inside the confirm Dialog).");
|
|
17
|
+
const ownEvent = React.useRef(null);
|
|
18
|
+
const button = /* @__PURE__ */ jsxs("button", {
|
|
19
|
+
type: "button",
|
|
20
|
+
...native,
|
|
21
|
+
className: cx("ui-btn", "ui-btn-" + variant, loading && "is-loading", className),
|
|
22
|
+
disabled: disabled || loading,
|
|
23
|
+
"aria-busy": loading || void 0,
|
|
24
|
+
onClick: (e) => {
|
|
25
|
+
if (confirm) {
|
|
26
|
+
e.preventDefault();
|
|
27
|
+
ownEvent.current = {
|
|
28
|
+
event: e,
|
|
29
|
+
button: e.currentTarget
|
|
30
|
+
};
|
|
31
|
+
setAsking(true);
|
|
32
|
+
} else onClick?.(e);
|
|
33
|
+
},
|
|
34
|
+
children: [loading ? /* @__PURE__ */ jsx(Spinner, {}) : icon ? /* @__PURE__ */ jsx(IconOf, { icon }) : null, children]
|
|
35
|
+
});
|
|
36
|
+
if (!confirm) return button;
|
|
37
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [button, /* @__PURE__ */ jsx(Dialog, {
|
|
38
|
+
open: asking,
|
|
39
|
+
onClose: () => setAsking(false),
|
|
40
|
+
title: confirm.title,
|
|
41
|
+
tone: "danger",
|
|
42
|
+
confirmLabel: confirm.confirmLabel ?? (typeof children === "string" ? children : tr("刪除")),
|
|
43
|
+
onConfirm: () => {
|
|
44
|
+
setAsking(false);
|
|
45
|
+
const own = ownEvent.current;
|
|
46
|
+
if (!own) return;
|
|
47
|
+
onClick?.(own.event);
|
|
48
|
+
if (own.button.type === "submit") own.button.form?.requestSubmit(own.button);
|
|
49
|
+
},
|
|
50
|
+
children: confirm.body
|
|
51
|
+
})] });
|
|
52
|
+
}
|
|
53
|
+
export { Button };
|
|
54
|
+
|
|
55
|
+
//# sourceMappingURL=Button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.js","names":[],"sources":["../../../src/components/Button/Button.tsx"],"sourcesContent":["import * as React from 'react';\nimport { IconOf, type IconSource } from '../../icons/Icon';\nimport { Spinner } from '../../icons/Spinner';\nimport { cx } from '../../internal/util';\nimport { devWarn } from '../../internal/dev';\nimport { tr } from '../../i18n';\nimport { Dialog } from '../Dialog/Dialog';\n\ninterface ButtonBase extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children'> {\n /** A verb: 儲存, 刪除, 匯出. No 「確定」or 「好」. */\n children: React.ReactNode;\n /** Shows a spinner and disables the button; pair it with a progressive label such as 儲存中. */\n loading?: boolean;\n /** Leading icon: a built-in name such as 'plus', or custom path data. */\n icon?: IconSource;\n ref?: React.Ref<HTMLButtonElement>;\n}\n\n/** What the confirm dialog of a danger button says. */\nexport interface DangerConfirm {\n /** Names the object: 「刪除 api-gateway?」. */\n title: string;\n /** What is lost and whether it can be undone. */\n body?: React.ReactNode;\n /** The danger button's label in the dialog. Default: the button's own label. */\n confirmLabel?: string;\n}\n\nexport type ButtonProps =\n | (ButtonBase & {\n /** primary: the one main action of a section (solid). secondary (default): everything else (outline). quiet:\n * low-emphasis and toolbar actions, text only with no border, a gray background on hover. */\n variant?: 'primary' | 'secondary' | 'quiet';\n })\n | (ButtonBase & {\n /** Destructive. Must be confirmed: pass `confirm`, or `confirmed` when this button is itself inside the confirm Dialog. */\n variant: 'danger';\n /** Opens a Dialog first; onClick runs only after the person confirms. */\n confirm: DangerConfirm;\n confirmed?: never;\n })\n | (ButtonBase & {\n variant: 'danger';\n /** This button is the confirming button of a Dialog (or DangerZone), so it runs at once. */\n confirmed: true;\n confirm?: never;\n });\n\n/** Buttons. Labels are verbs; one primary per section; danger actions are always confirmed. */\nexport function Button(props: ButtonProps) {\n const { variant = 'secondary', loading, icon, className, children, disabled, onClick, ...other } = props;\n const { confirm, confirmed, ...native } = other as typeof other & { confirm?: DangerConfirm; confirmed?: boolean };\n const [asking, setAsking] = React.useState(false);\n devWarn(\n variant === 'danger' && !confirm && !confirmed,\n 'Button',\n 'a danger button needs confirm={{ title }} (or confirmed when it is the button inside the confirm Dialog).',\n );\n const ownEvent = React.useRef<{ event: React.MouseEvent<HTMLButtonElement>; button: HTMLButtonElement } | null>(null);\n const button = (\n <button\n type=\"button\"\n {...native}\n className={cx('ui-btn', 'ui-btn-' + variant, loading && 'is-loading', className)}\n disabled={disabled || loading}\n aria-busy={loading || undefined}\n onClick={(e) => {\n if (confirm) {\n // A submit button must not submit before the person confirms.\n e.preventDefault();\n ownEvent.current = { event: e, button: e.currentTarget };\n setAsking(true);\n } else onClick?.(e);\n }}\n >\n {loading ? <Spinner /> : icon ? <IconOf icon={icon} /> : null}\n {children}\n </button>\n );\n if (!confirm) return button;\n return (\n <>\n {button}\n <Dialog\n open={asking}\n onClose={() => setAsking(false)}\n title={confirm.title}\n tone=\"danger\"\n confirmLabel={confirm.confirmLabel ?? (typeof children === 'string' ? children : tr('刪除'))}\n onConfirm={() => {\n setAsking(false);\n const own = ownEvent.current;\n if (!own) return;\n onClick?.(own.event);\n if (own.button.type === 'submit') own.button.form?.requestSubmit(own.button);\n }}\n >\n {confirm.body}\n </Dialog>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;AAiDA,SAAgB,OAAO,OAAoB;CACzC,MAAM,EAAE,UAAU,aAAa,SAAS,MAAM,WAAW,UAAU,UAAU,SAAS,GAAG,UAAU;CACnG,MAAM,EAAE,SAAS,WAAW,GAAG,WAAW;CAC1C,MAAM,CAAC,QAAQ,aAAa,MAAM,SAAS,KAAK;CAChD,QACE,YAAY,YAAY,CAAC,WAAW,CAAC,WACrC,UACA,2GACF;CACA,MAAM,WAAW,MAAM,OAAyF,IAAI;CACpH,MAAM,SACJ,qBAAC,UAAD;EACE,MAAK;EACL,GAAI;EACJ,WAAW,GAAG,UAAU,YAAY,SAAS,WAAW,cAAc,SAAS;EAC/E,UAAU,YAAY;EACtB,aAAW,WAAW,KAAA;EACtB,UAAU,MAAM;GACd,IAAI,SAAS;IAEX,EAAE,eAAe;IACjB,SAAS,UAAU;KAAE,OAAO;KAAG,QAAQ,EAAE;IAAc;IACvD,UAAU,IAAI;GAChB,OAAO,UAAU,CAAC;EACpB;EAbF,UAAA,CAeG,UAAU,oBAAC,SAAD,CAAU,CAAA,IAAI,OAAO,oBAAC,QAAD,EAAc,KAAO,CAAA,IAAI,MACxD,QACK;;CAEV,IAAI,CAAC,SAAS,OAAO;CACrB,OACE,qBAAA,UAAA,EAAA,UAAA,CACG,QACD,oBAAC,QAAD;EACE,MAAM;EACN,eAAe,UAAU,KAAK;EAC9B,OAAO,QAAQ;EACf,MAAK;EACL,cAAc,QAAQ,iBAAiB,OAAO,aAAa,WAAW,WAAW,GAAG,IAAI;EACxF,iBAAiB;GACf,UAAU,KAAK;GACf,MAAM,MAAM,SAAS;GACrB,IAAI,CAAC,KAAK;GACV,UAAU,IAAI,KAAK;GACnB,IAAI,IAAI,OAAO,SAAS,UAAU,IAAI,OAAO,MAAM,cAAc,IAAI,MAAM;EAC7E;EAEC,UAAA,QAAQ;CACH,CAAA,CACR,EAAA,CAAA;AAEN"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface DayState {
|
|
3
|
+
selected?: boolean;
|
|
4
|
+
inRange?: boolean;
|
|
5
|
+
start?: boolean;
|
|
6
|
+
end?: boolean;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface CalendarProps {
|
|
10
|
+
/** The month shown first. Default: this month. */
|
|
11
|
+
focus?: Date | null;
|
|
12
|
+
onPick?: (d: Date) => void;
|
|
13
|
+
onHover?: (d: Date | null) => void;
|
|
14
|
+
/** How each day looks: selected, inside a range, disabled. */
|
|
15
|
+
dayState?: (d: Date) => DayState | undefined;
|
|
16
|
+
}
|
|
17
|
+
/** A month grid: selected days are rounded squares, today has a dot under the number. */
|
|
18
|
+
export declare function Calendar({ focus, onPick, onHover, dayState }: CalendarProps): React.JSX.Element;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { dayAdd, format, sameDay } from "../../format.js";
|
|
3
|
+
import { tr } from "../../i18n.js";
|
|
4
|
+
import { Icon } from "../../icons/Icon.js";
|
|
5
|
+
import { browserKey, cx } from "../../internal/util.js";
|
|
6
|
+
import { includeIcons } from "../../icons/store.js";
|
|
7
|
+
import caret_left_default from "../../icons/ph/caret-left.js";
|
|
8
|
+
import caret_right_default from "../../icons/ph/caret-right.js";
|
|
9
|
+
import * as React from "react";
|
|
10
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
// src/components/Calendar/Calendar.tsx
|
|
12
|
+
includeIcons(caret_left_default, caret_right_default);
|
|
13
|
+
/** A month grid: selected days are rounded squares, today has a dot under the number. */
|
|
14
|
+
function Calendar({ focus, onPick, onHover, dayState }) {
|
|
15
|
+
const [month, setMonth] = React.useState(() => {
|
|
16
|
+
const b = focus || /* @__PURE__ */ new Date();
|
|
17
|
+
return new Date(b.getFullYear(), b.getMonth(), 1);
|
|
18
|
+
});
|
|
19
|
+
const today = /* @__PURE__ */ new Date();
|
|
20
|
+
const y = month.getFullYear();
|
|
21
|
+
const m = month.getMonth();
|
|
22
|
+
const [active, setActive] = React.useState(() => focus || today);
|
|
23
|
+
const cur = active.getFullYear() === y && active.getMonth() === m ? active : new Date(y, m, Math.min(active.getDate(), new Date(y, m + 1, 0).getDate()));
|
|
24
|
+
const grid = React.useRef(null);
|
|
25
|
+
const moveTo = React.useRef(false);
|
|
26
|
+
React.useEffect(() => {
|
|
27
|
+
if (!moveTo.current) return;
|
|
28
|
+
moveTo.current = false;
|
|
29
|
+
grid.current?.querySelector(".ui-cal-day[tabindex=\"0\"]")?.focus();
|
|
30
|
+
});
|
|
31
|
+
const go = (d) => {
|
|
32
|
+
const step = d < cur ? -1 : 1;
|
|
33
|
+
for (let k = 0; k < 31 && dayState?.(d)?.disabled; k++) d = dayAdd(d, step);
|
|
34
|
+
setActive(d);
|
|
35
|
+
if (d.getMonth() !== m || d.getFullYear() !== y) setMonth(new Date(d.getFullYear(), d.getMonth(), 1));
|
|
36
|
+
moveTo.current = true;
|
|
37
|
+
onHover?.(d);
|
|
38
|
+
};
|
|
39
|
+
const onKey = (e) => {
|
|
40
|
+
if (browserKey(e)) return;
|
|
41
|
+
const wd = (cur.getDay() - format.firstDay() + 7) % 7;
|
|
42
|
+
const sameDayIn = (dm) => {
|
|
43
|
+
const last = new Date(cur.getFullYear(), cur.getMonth() + dm + 1, 0).getDate();
|
|
44
|
+
return new Date(cur.getFullYear(), cur.getMonth() + dm, Math.min(cur.getDate(), last));
|
|
45
|
+
};
|
|
46
|
+
const to = {
|
|
47
|
+
ArrowLeft: () => dayAdd(cur, -1),
|
|
48
|
+
ArrowRight: () => dayAdd(cur, 1),
|
|
49
|
+
ArrowUp: () => dayAdd(cur, -7),
|
|
50
|
+
ArrowDown: () => dayAdd(cur, 7),
|
|
51
|
+
Home: () => dayAdd(cur, -wd),
|
|
52
|
+
End: () => dayAdd(cur, 6 - wd),
|
|
53
|
+
PageUp: () => sameDayIn(-1),
|
|
54
|
+
PageDown: () => sameDayIn(1)
|
|
55
|
+
};
|
|
56
|
+
if (!to[e.key]) return;
|
|
57
|
+
e.preventDefault();
|
|
58
|
+
go(to[e.key]());
|
|
59
|
+
};
|
|
60
|
+
const start = (new Date(y, m, 1).getDay() - format.firstDay() + 7) % 7;
|
|
61
|
+
const days = new Date(y, m + 1, 0).getDate();
|
|
62
|
+
const cells = [...Array(start).fill(null), ...Array.from({ length: days }, (_, i) => new Date(y, m, i + 1))];
|
|
63
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
64
|
+
className: "ui-cal",
|
|
65
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
66
|
+
className: "ui-cal-head",
|
|
67
|
+
children: [
|
|
68
|
+
/* @__PURE__ */ jsx("button", {
|
|
69
|
+
type: "button",
|
|
70
|
+
className: "ui-cal-nav",
|
|
71
|
+
"aria-label": tr("上個月"),
|
|
72
|
+
onClick: () => setMonth(new Date(y, m - 1, 1)),
|
|
73
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
74
|
+
name: "caret-left",
|
|
75
|
+
size: 16
|
|
76
|
+
})
|
|
77
|
+
}),
|
|
78
|
+
/* @__PURE__ */ jsx("span", {
|
|
79
|
+
className: "ui-cal-title",
|
|
80
|
+
"aria-live": "polite",
|
|
81
|
+
children: format.month(month)
|
|
82
|
+
}),
|
|
83
|
+
/* @__PURE__ */ jsx("button", {
|
|
84
|
+
type: "button",
|
|
85
|
+
className: "ui-cal-nav",
|
|
86
|
+
"aria-label": tr("下個月"),
|
|
87
|
+
onClick: () => setMonth(new Date(y, m + 1, 1)),
|
|
88
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
89
|
+
name: "caret-right",
|
|
90
|
+
size: 16
|
|
91
|
+
})
|
|
92
|
+
})
|
|
93
|
+
]
|
|
94
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
95
|
+
ref: grid,
|
|
96
|
+
className: "ui-cal-grid",
|
|
97
|
+
role: "group",
|
|
98
|
+
"aria-label": format.month(month),
|
|
99
|
+
onKeyDown: onKey,
|
|
100
|
+
children: [format.weekdays().map((w, i) => /* @__PURE__ */ jsx("span", {
|
|
101
|
+
className: "ui-cal-wk",
|
|
102
|
+
"aria-hidden": "true",
|
|
103
|
+
children: w
|
|
104
|
+
}, "w" + i)), cells.map((c, i) => {
|
|
105
|
+
if (!c) return /* @__PURE__ */ jsx("span", {}, "e" + i);
|
|
106
|
+
const st = dayState?.(c) ?? {};
|
|
107
|
+
const isToday = sameDay(c, today);
|
|
108
|
+
return /* @__PURE__ */ jsx("button", {
|
|
109
|
+
type: "button",
|
|
110
|
+
disabled: st.disabled,
|
|
111
|
+
className: cx("ui-cal-day", st.selected && "is-sel", st.inRange && "is-range", st.start && "is-start", st.end && "is-end", isToday && "is-today"),
|
|
112
|
+
"aria-pressed": !!st.selected,
|
|
113
|
+
"aria-label": format.date(c, {
|
|
114
|
+
weekday: false,
|
|
115
|
+
long: true
|
|
116
|
+
}) + (isToday ? tr("(今天)") : ""),
|
|
117
|
+
tabIndex: sameDay(c, cur) ? 0 : -1,
|
|
118
|
+
onFocus: () => !sameDay(c, cur) && setActive(c),
|
|
119
|
+
onClick: () => onPick?.(c),
|
|
120
|
+
onMouseEnter: onHover ? () => onHover(c) : void 0,
|
|
121
|
+
children: c.getDate()
|
|
122
|
+
}, i);
|
|
123
|
+
})]
|
|
124
|
+
})]
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
export { Calendar };
|
|
128
|
+
|
|
129
|
+
//# sourceMappingURL=Calendar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Calendar.js","names":["phCaretLeft","phCaretRight"],"sources":["../../../src/components/Calendar/Calendar.tsx"],"sourcesContent":["import * as React from 'react';\nimport { dayAdd, format, sameDay } from '../../format';\nimport { tr } from '../../i18n';\nimport { Icon } from '../../icons/Icon';\nimport { browserKey, cx } from '../../internal/util';\nimport { includeIcons } from '../../icons/store';\nimport phCaretLeft from '../../icons/ph/caret-left';\nimport phCaretRight from '../../icons/ph/caret-right';\n\nincludeIcons(phCaretLeft, phCaretRight);\n\nexport interface DayState {\n selected?: boolean;\n inRange?: boolean;\n start?: boolean;\n end?: boolean;\n disabled?: boolean;\n}\n\nexport interface CalendarProps {\n /** The month shown first. Default: this month. */\n focus?: Date | null;\n onPick?: (d: Date) => void;\n onHover?: (d: Date | null) => void;\n /** How each day looks: selected, inside a range, disabled. */\n dayState?: (d: Date) => DayState | undefined;\n}\n\n/** A month grid: selected days are rounded squares, today has a dot under the number. */\nexport function Calendar({ focus, onPick, onHover, dayState }: CalendarProps) {\n const [month, setMonth] = React.useState(() => {\n const b = focus || new Date();\n return new Date(b.getFullYear(), b.getMonth(), 1);\n });\n const today = new Date();\n const y = month.getFullYear();\n const m = month.getMonth();\n // The day the keyboard is on: the only day in the Tab order (the focused, else the selected, else today, else the\n // 1st), always in the month shown.\n const [active, setActive] = React.useState<Date>(() => focus || today);\n const cur = active.getFullYear() === y && active.getMonth() === m ? active : new Date(y, m, Math.min(active.getDate(), new Date(y, m + 1, 0).getDate()));\n const grid = React.useRef<HTMLDivElement>(null);\n const moveTo = React.useRef(false);\n React.useEffect(() => {\n if (!moveTo.current) return;\n moveTo.current = false;\n grid.current?.querySelector<HTMLButtonElement>('.ui-cal-day[tabindex=\"0\"]')?.focus();\n });\n const go = (d: Date) => {\n // Disabled days are passed over in the same direction, up to a month.\n const step = d < cur ? -1 : 1;\n for (let k = 0; k < 31 && dayState?.(d)?.disabled; k++) d = dayAdd(d, step);\n setActive(d);\n if (d.getMonth() !== m || d.getFullYear() !== y) setMonth(new Date(d.getFullYear(), d.getMonth(), 1));\n moveTo.current = true;\n onHover?.(d);\n };\n const onKey = (e: React.KeyboardEvent) => {\n if (browserKey(e)) return;\n const wd = (cur.getDay() - format.firstDay() + 7) % 7;\n const sameDayIn = (dm: number) => {\n const last = new Date(cur.getFullYear(), cur.getMonth() + dm + 1, 0).getDate();\n return new Date(cur.getFullYear(), cur.getMonth() + dm, Math.min(cur.getDate(), last));\n };\n const to: Record<string, () => Date> = {\n ArrowLeft: () => dayAdd(cur, -1),\n ArrowRight: () => dayAdd(cur, 1),\n ArrowUp: () => dayAdd(cur, -7),\n ArrowDown: () => dayAdd(cur, 7),\n Home: () => dayAdd(cur, -wd),\n End: () => dayAdd(cur, 6 - wd),\n PageUp: () => sameDayIn(-1),\n PageDown: () => sameDayIn(1),\n };\n if (!to[e.key]) return;\n e.preventDefault();\n go(to[e.key]());\n };\n const start = (new Date(y, m, 1).getDay() - format.firstDay() + 7) % 7;\n const days = new Date(y, m + 1, 0).getDate();\n const cells: (Date | null)[] = [...Array<null>(start).fill(null), ...Array.from({ length: days }, (_, i) => new Date(y, m, i + 1))];\n return (\n <div className=\"ui-cal\">\n <div className=\"ui-cal-head\">\n <button type=\"button\" className=\"ui-cal-nav\" aria-label={tr('上個月')} onClick={() => setMonth(new Date(y, m - 1, 1))}>\n <Icon name=\"caret-left\" size={16} />\n </button>\n <span className=\"ui-cal-title\" aria-live=\"polite\">\n {format.month(month)}\n </span>\n <button type=\"button\" className=\"ui-cal-nav\" aria-label={tr('下個月')} onClick={() => setMonth(new Date(y, m + 1, 1))}>\n <Icon name=\"caret-right\" size={16} />\n </button>\n </div>\n <div ref={grid} className=\"ui-cal-grid\" role=\"group\" aria-label={format.month(month)} onKeyDown={onKey}>\n {format.weekdays().map((w, i) => (\n <span key={'w' + i} className=\"ui-cal-wk\" aria-hidden=\"true\">\n {w}\n </span>\n ))}\n {cells.map((c, i) => {\n if (!c) return <span key={'e' + i} />;\n const st = dayState?.(c) ?? {};\n const isToday = sameDay(c, today);\n return (\n <button\n key={i}\n type=\"button\"\n disabled={st.disabled}\n className={cx('ui-cal-day', st.selected && 'is-sel', st.inRange && 'is-range', st.start && 'is-start', st.end && 'is-end', isToday && 'is-today')}\n aria-pressed={!!st.selected}\n aria-label={format.date(c, { weekday: false, long: true }) + (isToday ? tr('(今天)') : '')}\n tabIndex={sameDay(c, cur) ? 0 : -1}\n onFocus={() => !sameDay(c, cur) && setActive(c)}\n onClick={() => onPick?.(c)}\n onMouseEnter={onHover ? () => onHover(c) : undefined}\n >\n {c.getDate()}\n </button>\n );\n })}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;AASA,aAAaA,oBAAaC,mBAAY;;AAoBtC,SAAgB,SAAS,EAAE,OAAO,QAAQ,SAAS,YAA2B;CAC5E,MAAM,CAAC,OAAO,YAAY,MAAM,eAAe;EAC7C,MAAM,IAAI,yBAAS,IAAI,KAAK;EAC5B,OAAO,IAAI,KAAK,EAAE,YAAY,GAAG,EAAE,SAAS,GAAG,CAAC;CAClD,CAAC;CACD,MAAM,wBAAQ,IAAI,KAAK;CACvB,MAAM,IAAI,MAAM,YAAY;CAC5B,MAAM,IAAI,MAAM,SAAS;CAGzB,MAAM,CAAC,QAAQ,aAAa,MAAM,eAAqB,SAAS,KAAK;CACrE,MAAM,MAAM,OAAO,YAAY,MAAM,KAAK,OAAO,SAAS,MAAM,IAAI,SAAS,IAAI,KAAK,GAAG,GAAG,KAAK,IAAI,OAAO,QAAQ,GAAG,IAAI,KAAK,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;CACvJ,MAAM,OAAO,MAAM,OAAuB,IAAI;CAC9C,MAAM,SAAS,MAAM,OAAO,KAAK;CACjC,MAAM,gBAAgB;EACpB,IAAI,CAAC,OAAO,SAAS;EACrB,OAAO,UAAU;EACjB,KAAK,SAAS,cAAiC,6BAA2B,CAAC,EAAE,MAAM;CACrF,CAAC;CACD,MAAM,MAAM,MAAY;EAEtB,MAAM,OAAO,IAAI,MAAM,KAAK;EAC5B,KAAK,IAAI,IAAI,GAAG,IAAI,MAAM,WAAW,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,OAAO,GAAG,IAAI;EAC1E,UAAU,CAAC;EACX,IAAI,EAAE,SAAS,MAAM,KAAK,EAAE,YAAY,MAAM,GAAG,SAAS,IAAI,KAAK,EAAE,YAAY,GAAG,EAAE,SAAS,GAAG,CAAC,CAAC;EACpG,OAAO,UAAU;EACjB,UAAU,CAAC;CACb;CACA,MAAM,SAAS,MAA2B;EACxC,IAAI,WAAW,CAAC,GAAG;EACnB,MAAM,MAAM,IAAI,OAAO,IAAI,OAAO,SAAS,IAAI,KAAK;EACpD,MAAM,aAAa,OAAe;GAChC,MAAM,OAAO,IAAI,KAAK,IAAI,YAAY,GAAG,IAAI,SAAS,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,QAAQ;GAC7E,OAAO,IAAI,KAAK,IAAI,YAAY,GAAG,IAAI,SAAS,IAAI,IAAI,KAAK,IAAI,IAAI,QAAQ,GAAG,IAAI,CAAC;EACvF;EACA,MAAM,KAAiC;GACrC,iBAAiB,OAAO,KAAK,EAAE;GAC/B,kBAAkB,OAAO,KAAK,CAAC;GAC/B,eAAe,OAAO,KAAK,EAAE;GAC7B,iBAAiB,OAAO,KAAK,CAAC;GAC9B,YAAY,OAAO,KAAK,CAAC,EAAE;GAC3B,WAAW,OAAO,KAAK,IAAI,EAAE;GAC7B,cAAc,UAAU,EAAE;GAC1B,gBAAgB,UAAU,CAAC;EAC7B;EACA,IAAI,CAAC,GAAG,EAAE,MAAM;EAChB,EAAE,eAAe;EACjB,GAAG,GAAG,EAAE,IAAI,CAAC,CAAC;CAChB;CACA,MAAM,SAAS,IAAI,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC,OAAO,IAAI,OAAO,SAAS,IAAI,KAAK;CACrE,MAAM,OAAO,IAAI,KAAK,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,QAAQ;CAC3C,MAAM,QAAyB,CAAC,GAAG,MAAY,KAAK,CAAC,CAAC,KAAK,IAAI,GAAG,GAAG,MAAM,KAAK,EAAE,QAAQ,KAAK,IAAI,GAAG,MAAM,IAAI,KAAK,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC;CAClI,OACE,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,qBAAC,OAAD;GAAK,WAAU;GAAf,UAAA;IACE,oBAAC,UAAD;KAAQ,MAAK;KAAS,WAAU;KAAa,cAAY,GAAG,KAAK;KAAG,eAAe,SAAS,IAAI,KAAK,GAAG,IAAI,GAAG,CAAC,CAAC;KAC/G,UAAA,oBAAC,MAAD;MAAM,MAAK;MAAa,MAAM;KAAK,CAAA;IAC7B,CAAA;IACR,oBAAC,QAAD;KAAM,WAAU;KAAe,aAAU;KACtC,UAAA,OAAO,MAAM,KAAK;IACf,CAAA;IACN,oBAAC,UAAD;KAAQ,MAAK;KAAS,WAAU;KAAa,cAAY,GAAG,KAAK;KAAG,eAAe,SAAS,IAAI,KAAK,GAAG,IAAI,GAAG,CAAC,CAAC;KAC/G,UAAA,oBAAC,MAAD;MAAM,MAAK;MAAc,MAAM;KAAK,CAAA;IAC9B,CAAA;GACL;EACL,CAAA,GAAA,qBAAC,OAAD;GAAK,KAAK;GAAM,WAAU;GAAc,MAAK;GAAQ,cAAY,OAAO,MAAM,KAAK;GAAG,WAAW;GAAjG,UAAA,CACG,OAAO,SAAS,CAAC,CAAC,KAAK,GAAG,MACzB,oBAAC,QAAD;IAAoB,WAAU;IAAY,eAAY;IACnD,UAAA;GACG,GAFK,MAAM,CAEX,CACP,GACA,MAAM,KAAK,GAAG,MAAM;IACnB,IAAI,CAAC,GAAG,OAAO,oBAAC,QAAD,CAAqB,GAAV,MAAM,CAAI;IACpC,MAAM,KAAK,WAAW,CAAC,KAAK,CAAC;IAC7B,MAAM,UAAU,QAAQ,GAAG,KAAK;IAChC,OACE,oBAAC,UAAD;KAEE,MAAK;KACL,UAAU,GAAG;KACb,WAAW,GAAG,cAAc,GAAG,YAAY,UAAU,GAAG,WAAW,YAAY,GAAG,SAAS,YAAY,GAAG,OAAO,UAAU,WAAW,UAAU;KAChJ,gBAAc,CAAC,CAAC,GAAG;KACnB,cAAY,OAAO,KAAK,GAAG;MAAE,SAAS;MAAO,MAAM;KAAK,CAAC,KAAK,UAAU,GAAG,MAAM,IAAI;KACrF,UAAU,QAAQ,GAAG,GAAG,IAAI,IAAI;KAChC,eAAe,CAAC,QAAQ,GAAG,GAAG,KAAK,UAAU,CAAC;KAC9C,eAAe,SAAS,CAAC;KACzB,cAAc,gBAAgB,QAAQ,CAAC,IAAI,KAAA;KAE1C,UAAA,EAAE,QAAQ;IACL,GAZD,CAYC;GAEZ,CAAC,CACE;EACF,CAAA,CAAA;;AAET"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface CardProps extends Omit<React.HTMLAttributes<HTMLElement>, 'title'> {
|
|
3
|
+
/** Heading at the top left. */
|
|
4
|
+
title?: React.ReactNode;
|
|
5
|
+
/** Buttons at the top right. */
|
|
6
|
+
actions?: React.ReactNode;
|
|
7
|
+
/** false: no inner padding, for a table or a tree that fills the card. */
|
|
8
|
+
padding?: boolean;
|
|
9
|
+
/** Element to render. Default 'section'. */
|
|
10
|
+
as?: 'section' | 'div' | 'article' | 'aside' | 'form';
|
|
11
|
+
children?: React.ReactNode;
|
|
12
|
+
}
|
|
13
|
+
/** The one container with a shadow. Never put a Card inside a Card: split the content into sections with headings instead. */
|
|
14
|
+
export declare function Card({ as: Tag, title, actions, padding, className, children, ...native }: CardProps): React.JSX.Element;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cx } from "../../internal/util.js";
|
|
3
|
+
import { devWarn } from "../../internal/dev.js";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
// src/components/Card/Card.tsx
|
|
7
|
+
/** True inside a Card: card-styled components drop their own shadow there. */
|
|
8
|
+
const InCard = React.createContext(false);
|
|
9
|
+
/** The one container with a shadow. Never put a Card inside a Card: split the content into sections with headings instead. */
|
|
10
|
+
function Card({ as: Tag = "section", title, actions, padding = true, className, children, ...native }) {
|
|
11
|
+
const nested = React.useContext(InCard);
|
|
12
|
+
devWarn(nested, "Card", "a Card inside a Card gives two shadows. Use one Card and separate its parts with headings or a divider.");
|
|
13
|
+
return /* @__PURE__ */ jsx(InCard.Provider, {
|
|
14
|
+
value: true,
|
|
15
|
+
children: /* @__PURE__ */ jsxs(Tag, {
|
|
16
|
+
...native,
|
|
17
|
+
className: cx("ui-card", !padding && "is-flush", className),
|
|
18
|
+
children: [title || actions ? /* @__PURE__ */ jsxs("div", {
|
|
19
|
+
className: "ui-card-head",
|
|
20
|
+
children: [title ? /* @__PURE__ */ jsx("h2", {
|
|
21
|
+
className: "ui-card-title",
|
|
22
|
+
children: title
|
|
23
|
+
}) : null, actions ? /* @__PURE__ */ jsx("div", {
|
|
24
|
+
className: "ui-card-actions",
|
|
25
|
+
children: actions
|
|
26
|
+
}) : null]
|
|
27
|
+
}) : null, children]
|
|
28
|
+
})
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
export { Card };
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=Card.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Card.js","names":[],"sources":["../../../src/components/Card/Card.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cx } from '../../internal/util';\nimport { devWarn } from '../../internal/dev';\n\n/** True inside a Card: card-styled components drop their own shadow there. */\nconst InCard = React.createContext(false);\n\nexport interface CardProps extends Omit<React.HTMLAttributes<HTMLElement>, 'title'> {\n /** Heading at the top left. */\n title?: React.ReactNode;\n /** Buttons at the top right. */\n actions?: React.ReactNode;\n /** false: no inner padding, for a table or a tree that fills the card. */\n padding?: boolean;\n /** Element to render. Default 'section'. */\n as?: 'section' | 'div' | 'article' | 'aside' | 'form';\n children?: React.ReactNode;\n}\n\n/** The one container with a shadow. Never put a Card inside a Card: split the content into sections with headings instead. */\nexport function Card({ as: Tag = 'section', title, actions, padding = true, className, children, ...native }: CardProps) {\n const nested = React.useContext(InCard);\n devWarn(nested, 'Card', 'a Card inside a Card gives two shadows. Use one Card and separate its parts with headings or a divider.');\n return (\n <InCard.Provider value>\n <Tag {...native} className={cx('ui-card', !padding && 'is-flush', className)}>\n {title || actions ? (\n <div className=\"ui-card-head\">\n {title ? <h2 className=\"ui-card-title\">{title}</h2> : null}\n {actions ? <div className=\"ui-card-actions\">{actions}</div> : null}\n </div>\n ) : null}\n {children}\n </Tag>\n </InCard.Provider>\n );\n}\n"],"mappings":";;;;;;;AAKA,MAAM,SAAS,MAAM,cAAc,KAAK;;AAexC,SAAgB,KAAK,EAAE,IAAI,MAAM,WAAW,OAAO,SAAS,UAAU,MAAM,WAAW,UAAU,GAAG,UAAqB;CACvH,MAAM,SAAS,MAAM,WAAW,MAAM;CACtC,QAAQ,QAAQ,QAAQ,yGAAyG;CACjI,OACE,oBAAC,OAAO,UAAR;EAAiB,OAAA;EACf,UAAA,qBAAC,KAAD;GAAK,GAAI;GAAQ,WAAW,GAAG,WAAW,CAAC,WAAW,YAAY,SAAS;GAA3E,UAAA,CACG,SAAS,UACR,qBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACG,QAAQ,oBAAC,MAAD;KAAI,WAAU;KAAiB,UAAA;IAAU,CAAA,IAAI,MACrD,UAAU,oBAAC,OAAD;KAAK,WAAU;KAAmB,UAAA;IAAa,CAAA,IAAI,IAC3D;GACH,CAAA,IAAA,MACH,QACE;;CACU,CAAA;AAErB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface CheckboxProps {
|
|
3
|
+
/** 'mixed': some of a group are checked (shows a dash). */
|
|
4
|
+
checked?: boolean | 'mixed';
|
|
5
|
+
/** Receives the new state; from 'mixed' it goes to true. */
|
|
6
|
+
onChange?: (checked: boolean) => void;
|
|
7
|
+
/** Text to the right of the box. Without it, pass aria-label. */
|
|
8
|
+
label?: React.ReactNode;
|
|
9
|
+
'aria-label'?: string;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
13
|
+
/** A check box with a drawn check mark. The whole row is the touch target. */
|
|
14
|
+
export declare function Checkbox({ checked, onChange, label, disabled, className, ...aria }: CheckboxProps): React.JSX.Element;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cx } from "../../internal/util.js";
|
|
3
|
+
import { CheckMark } from "../../internal/Field.js";
|
|
4
|
+
import "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
// src/components/Checkbox/Checkbox.tsx
|
|
7
|
+
/** A check box with a drawn check mark. The whole row is the touch target. */
|
|
8
|
+
function Checkbox({ checked, onChange, label, disabled, className, ...aria }) {
|
|
9
|
+
const v = checked === "mixed" ? "mixed" : !!checked;
|
|
10
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
11
|
+
type: "button",
|
|
12
|
+
role: "checkbox",
|
|
13
|
+
"aria-checked": v,
|
|
14
|
+
"aria-label": aria["aria-label"],
|
|
15
|
+
disabled,
|
|
16
|
+
className: cx("ui-check", v && "is-on", className),
|
|
17
|
+
onClick: () => onChange?.(v !== true),
|
|
18
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
19
|
+
className: "ui-check-box",
|
|
20
|
+
"aria-hidden": "true",
|
|
21
|
+
children: /* @__PURE__ */ jsx(CheckMark, { v })
|
|
22
|
+
}), label ? /* @__PURE__ */ jsx("span", { children: label }) : null]
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
export { Checkbox };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=Checkbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Checkbox.js","names":[],"sources":["../../../src/components/Checkbox/Checkbox.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cx } from '../../internal/util';\nimport { CheckMark } from '../../internal/Field';\n\nexport interface CheckboxProps {\n /** 'mixed': some of a group are checked (shows a dash). */\n checked?: boolean | 'mixed';\n /** Receives the new state; from 'mixed' it goes to true. */\n onChange?: (checked: boolean) => void;\n /** Text to the right of the box. Without it, pass aria-label. */\n label?: React.ReactNode;\n 'aria-label'?: string;\n disabled?: boolean;\n className?: string;\n}\n\n/** A check box with a drawn check mark. The whole row is the touch target. */\nexport function Checkbox({ checked, onChange, label, disabled, className, ...aria }: CheckboxProps) {\n const v = checked === 'mixed' ? 'mixed' : !!checked;\n return (\n <button\n type=\"button\"\n role=\"checkbox\"\n aria-checked={v}\n aria-label={aria['aria-label']}\n disabled={disabled}\n className={cx('ui-check', v && 'is-on', className)}\n onClick={() => onChange?.(v !== true)}\n >\n <span className=\"ui-check-box\" aria-hidden=\"true\">\n <CheckMark v={v} />\n </span>\n {label ? <span>{label}</span> : null}\n </button>\n );\n}\n"],"mappings":";;;;;;;AAiBA,SAAgB,SAAS,EAAE,SAAS,UAAU,OAAO,UAAU,WAAW,GAAG,QAAuB;CAClG,MAAM,IAAI,YAAY,UAAU,UAAU,CAAC,CAAC;CAC5C,OACE,qBAAC,UAAD;EACE,MAAK;EACL,MAAK;EACL,gBAAc;EACd,cAAY,KAAK;EACP;EACV,WAAW,GAAG,YAAY,KAAK,SAAS,SAAS;EACjD,eAAe,WAAW,MAAM,IAAI;EAPtC,UAAA,CASE,oBAAC,QAAD;GAAM,WAAU;GAAe,eAAY;GACzC,UAAA,oBAAC,WAAD,EAAc,EAAI,CAAA;EACd,CAAA,GACL,QAAQ,oBAAC,QAAD,EAAA,UAAO,MAAY,CAAA,IAAI,IAC1B;;AAEZ"}
|