@seanyeh77/ui 0.40.0 → 0.42.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 +19 -19
- package/dist/bundle.js.map +1 -1
- package/dist/components/AccentPicker/AccentPicker.d.ts +12 -0
- package/dist/components/AccentPicker/AccentPicker.js +96 -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 +56 -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 +195 -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 +54 -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 +125 -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 +790 -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 +242 -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 +119 -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 +1267 -0
- package/dist/components/DataTable/DataTable.js.map +1 -0
- package/dist/components/DataTable/SortButton.js +222 -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 +373 -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 +104 -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 +88 -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 +87 -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 +64 -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 +63 -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 +121 -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 +104 -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 +1644 -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 +113 -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 +716 -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 +75 -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 +116 -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 +92 -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 +97 -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 +46 -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 +220 -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 +138 -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 +220 -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 +72 -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 +22 -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 +138 -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 +27 -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 +55 -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 +588 -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 +1137 -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-C7iBqN3J.js → i18n.js} +10 -225
- package/dist/i18n.js.map +1 -0
- package/dist/icons/Icon.d.ts +23 -0
- package/dist/icons/Icon.js +90 -0
- package/dist/icons/Icon.js.map +1 -0
- package/dist/icons/data.d.ts +150 -0
- package/dist/icons/data.js +256 -0
- package/dist/icons/data.js.map +1 -0
- package/dist/index.d.ts +84 -2258
- package/dist/index.js +79 -12715
- package/dist/internal/Field.js +71 -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 +75 -0
- package/dist/internal/scrollHint.js.map +1 -0
- package/dist/internal/tableTools.js +109 -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 +4419 -4195
- package/dist/theme.d.ts +20 -0
- package/dist/theme.js +210 -0
- package/dist/theme.js.map +1 -0
- package/dist/tokens.css +78 -19
- package/docs/AccentPicker.md +17 -2
- package/docs/ActionBar.md +6 -4
- package/docs/AiMark.md +12 -6
- package/docs/Alert.md +17 -5
- package/docs/AppShell.md +20 -11
- package/docs/Badge.md +20 -9
- package/docs/BarChart.md +21 -3
- package/docs/Breadcrumb.md +9 -4
- package/docs/Button.md +18 -8
- package/docs/Calendar.md +10 -5
- package/docs/Card.md +17 -9
- package/docs/Checkbox.md +15 -4
- package/docs/CodeView.md +16 -13
- package/docs/CommandPalette.md +18 -10
- package/docs/ConsoleLayout.md +24 -2
- package/docs/DangerZone.md +9 -3
- package/docs/DataColors.md +11 -4
- package/docs/DataTable.md +77 -28
- package/docs/DatePicker.md +16 -2
- package/docs/DateRangePicker.md +13 -1
- package/docs/DetailList.md +17 -12
- package/docs/Dialog.md +11 -6
- package/docs/Drawer.md +13 -7
- package/docs/EmptyState.md +13 -1
- package/docs/ErrorPage.md +6 -0
- package/docs/EventTimeline.md +11 -5
- package/docs/FileUpload.md +21 -5
- package/docs/FormGrid.md +11 -2
- package/docs/Format.md +19 -1
- package/docs/Graph.md +17 -2
- package/docs/Grid.md +13 -4
- package/docs/IconButton.md +16 -13
- package/docs/InlineCode.md +18 -8
- package/docs/KpiCard.md +21 -7
- package/docs/LayerGraph.md +36 -23
- package/docs/LineChart.md +22 -1
- package/docs/LoadingBar.md +7 -1
- package/docs/LoginCard.md +19 -3
- package/docs/Markdown.md +18 -2
- package/docs/Menu.md +13 -7
- package/docs/Meter.md +12 -5
- package/docs/MobileTabBar.md +18 -2
- package/docs/MultiSelect.md +13 -3
- package/docs/NotificationBell.md +13 -3
- package/docs/Popover.md +12 -2
- package/docs/ProgressBar.md +8 -2
- package/docs/ProgressRing.md +8 -2
- package/docs/ProjectSwitcher.md +15 -9
- package/docs/RadioGroup.md +21 -3
- package/docs/SearchField.md +8 -2
- package/docs/Section.md +16 -4
- package/docs/SegmentedControl.md +21 -19
- package/docs/Select.md +16 -1
- package/docs/SettingsLayout.md +19 -4
- package/docs/SideNav.md +20 -2
- package/docs/Skeleton.md +7 -1
- package/docs/SplitPane.md +7 -1
- package/docs/StatusBand.md +12 -6
- package/docs/Suggestion.md +12 -5
- package/docs/Switch.md +15 -2
- package/docs/Tabs.md +25 -6
- package/docs/Tag.md +16 -12
- package/docs/Term.md +18 -1
- package/docs/TextArea.md +12 -1
- package/docs/TextField.md +15 -5
- package/docs/ThemePicker.md +16 -4
- package/docs/TimeControl.md +10 -5
- package/docs/Toast.md +13 -3
- package/docs/Tooltip.md +17 -5
- package/docs/TopBar.md +16 -3
- package/docs/Tour.md +25 -1
- package/docs/TreeList.md +16 -9
- package/docs/Workbench.md +12 -6
- package/docs/ZoneMap.md +17 -10
- package/docs/code.md +28 -0
- package/docs/data.md +45 -0
- package/docs/forms.md +29 -0
- package/docs/guidelines.md +65 -315
- package/docs/layout.md +24 -4
- package/docs/monitoring.md +30 -0
- package/docs/motion.md +1 -1
- package/docs/theme.md +153 -0
- package/package.json +6 -5
- package/dist/format-entry-BJI8MU2K.d.ts +0 -75
- package/dist/format-entry-C7iBqN3J.js.map +0 -1
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface AccentPickerProps {
|
|
3
|
+
/** Controlled #rrggbb. Without it, the picker reads and sets the stored accent itself. */
|
|
4
|
+
value?: string;
|
|
5
|
+
/** Without it, picking applies the color with setAccent. */
|
|
6
|
+
onChange?: (hex: string) => void;
|
|
7
|
+
/** Default 「強調色」. */
|
|
8
|
+
label?: string;
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
/** 8 swatches plus a hex field for any color. */
|
|
12
|
+
export declare function AccentPicker({ value, onChange, label, className }: AccentPickerProps): React.JSX.Element;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { tr } from "../../i18n.js";
|
|
3
|
+
import { Icon } from "../../icons/Icon.js";
|
|
4
|
+
import { browserKey, cx } from "../../internal/util.js";
|
|
5
|
+
import { ACCENT_SWATCHES, setAccent, storedAccent } from "../../theme.js";
|
|
6
|
+
import * as React from "react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
// src/components/AccentPicker/AccentPicker.tsx
|
|
9
|
+
const SWATCHES = ACCENT_SWATCHES;
|
|
10
|
+
const HEX = /^#[0-9a-fA-F]{6}$/;
|
|
11
|
+
/** 8 swatches plus a hex field for any color. */
|
|
12
|
+
function AccentPicker({ value, onChange, label, className }) {
|
|
13
|
+
const [own, setOwn] = React.useState(() => (value || storedAccent()).toLowerCase());
|
|
14
|
+
const [hexIn, setHexIn] = React.useState("");
|
|
15
|
+
const cur = (value || own).toLowerCase();
|
|
16
|
+
const pick = (c) => {
|
|
17
|
+
setOwn(c);
|
|
18
|
+
if (onChange) onChange(c);
|
|
19
|
+
else setAccent(c);
|
|
20
|
+
};
|
|
21
|
+
const bad = !!hexIn && !HEX.test(hexIn);
|
|
22
|
+
const refs = React.useRef([]);
|
|
23
|
+
const tabStop = Math.max(0, SWATCHES.findIndex(([, hex]) => hex === cur));
|
|
24
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
25
|
+
className: cx("ui-accentpick", className),
|
|
26
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
27
|
+
role: "radiogroup",
|
|
28
|
+
"aria-label": label || tr("強調色"),
|
|
29
|
+
className: "ui-accentpick-swatches",
|
|
30
|
+
children: SWATCHES.map(([name, hex], i) => {
|
|
31
|
+
const on = cur === hex;
|
|
32
|
+
return /* @__PURE__ */ jsx("button", {
|
|
33
|
+
ref: (el) => {
|
|
34
|
+
refs.current[i] = el;
|
|
35
|
+
},
|
|
36
|
+
type: "button",
|
|
37
|
+
role: "radio",
|
|
38
|
+
"aria-checked": on,
|
|
39
|
+
tabIndex: i === tabStop ? 0 : -1,
|
|
40
|
+
"aria-label": tr(name),
|
|
41
|
+
title: tr(name),
|
|
42
|
+
className: cx("ui-swatch", on && "is-on"),
|
|
43
|
+
style: {
|
|
44
|
+
background: hex,
|
|
45
|
+
color: hex
|
|
46
|
+
},
|
|
47
|
+
onClick: () => {
|
|
48
|
+
setHexIn("");
|
|
49
|
+
pick(hex);
|
|
50
|
+
},
|
|
51
|
+
onKeyDown: (e) => {
|
|
52
|
+
if (browserKey(e)) return;
|
|
53
|
+
const n = SWATCHES.length;
|
|
54
|
+
const to = e.key === "ArrowRight" || e.key === "ArrowDown" ? (i + 1) % n : e.key === "ArrowLeft" || e.key === "ArrowUp" ? (i - 1 + n) % n : -1;
|
|
55
|
+
if (to < 0) return;
|
|
56
|
+
e.preventDefault();
|
|
57
|
+
refs.current[to]?.focus();
|
|
58
|
+
setHexIn("");
|
|
59
|
+
pick(SWATCHES[to][1]);
|
|
60
|
+
},
|
|
61
|
+
children: on ? /* @__PURE__ */ jsx(Icon, {
|
|
62
|
+
name: "check",
|
|
63
|
+
size: 14
|
|
64
|
+
}) : null
|
|
65
|
+
}, hex);
|
|
66
|
+
})
|
|
67
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
68
|
+
className: "ui-accentpick-hex",
|
|
69
|
+
children: [
|
|
70
|
+
/* @__PURE__ */ jsx("span", {
|
|
71
|
+
className: "ui-accentpick-preview",
|
|
72
|
+
style: { background: !bad && hexIn ? hexIn : cur }
|
|
73
|
+
}),
|
|
74
|
+
/* @__PURE__ */ jsx("input", {
|
|
75
|
+
className: cx("ui-input", bad && "is-invalid"),
|
|
76
|
+
"aria-label": tr("自訂強調色(色碼)"),
|
|
77
|
+
"aria-invalid": bad || void 0,
|
|
78
|
+
value: hexIn,
|
|
79
|
+
placeholder: cur,
|
|
80
|
+
onChange: (e) => {
|
|
81
|
+
const x = e.target.value.trim();
|
|
82
|
+
setHexIn(x);
|
|
83
|
+
if (HEX.test(x)) pick(x.toLowerCase());
|
|
84
|
+
}
|
|
85
|
+
}),
|
|
86
|
+
/* @__PURE__ */ jsx("span", {
|
|
87
|
+
className: cx("ui-field-hint", bad && "is-error"),
|
|
88
|
+
children: bad ? tr("色碼格式不正確,例如 #2457d6") : tr("輸入 # 加 6 碼")
|
|
89
|
+
})
|
|
90
|
+
]
|
|
91
|
+
})]
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
export { AccentPicker };
|
|
95
|
+
|
|
96
|
+
//# sourceMappingURL=AccentPicker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccentPicker.js","names":[],"sources":["../../../src/components/AccentPicker/AccentPicker.tsx"],"sourcesContent":["import * as React from 'react';\nimport { tr } from '../../i18n';\nimport { Icon } from '../../icons/Icon';\nimport { browserKey, cx } from '../../internal/util';\nimport { ACCENT_SWATCHES, setAccent, storedAccent } from '../../theme';\n\nconst SWATCHES = ACCENT_SWATCHES;\nconst HEX = /^#[0-9a-fA-F]{6}$/;\n\nexport interface AccentPickerProps {\n /** Controlled #rrggbb. Without it, the picker reads and sets the stored accent itself. */\n value?: string;\n /** Without it, picking applies the color with setAccent. */\n onChange?: (hex: string) => void;\n /** Default 「強調色」. */\n label?: string;\n className?: string;\n}\n\n/** 8 swatches plus a hex field for any color. */\nexport function AccentPicker({ value, onChange, label, className }: AccentPickerProps) {\n const [own, setOwn] = React.useState(() => (value || storedAccent()).toLowerCase());\n const [hexIn, setHexIn] = React.useState('');\n const cur = (value || own).toLowerCase();\n const pick = (c: string) => {\n setOwn(c);\n if (onChange) onChange(c);\n else setAccent(c);\n };\n const bad = !!hexIn && !HEX.test(hexIn);\n const refs = React.useRef<(HTMLButtonElement | null)[]>([]);\n // One Tab stop in the swatches (the chosen one, or the first for a custom color); arrow keys move and choose.\n const tabStop = Math.max(\n 0,\n SWATCHES.findIndex(([, hex]) => hex === cur),\n );\n return (\n <div className={cx('ui-accentpick', className)}>\n <div role=\"radiogroup\" aria-label={label || tr('強調色')} className=\"ui-accentpick-swatches\">\n {SWATCHES.map(([name, hex], i) => {\n const on = cur === hex;\n return (\n <button\n key={hex}\n ref={(el) => {\n refs.current[i] = el;\n }}\n type=\"button\"\n role=\"radio\"\n aria-checked={on}\n tabIndex={i === tabStop ? 0 : -1}\n aria-label={tr(name)}\n title={tr(name)}\n className={cx('ui-swatch', on && 'is-on')}\n style={{ background: hex, color: hex }}\n onClick={() => {\n setHexIn('');\n pick(hex);\n }}\n onKeyDown={(e) => {\n if (browserKey(e)) return;\n const n = SWATCHES.length;\n const to = e.key === 'ArrowRight' || e.key === 'ArrowDown' ? (i + 1) % n : e.key === 'ArrowLeft' || e.key === 'ArrowUp' ? (i - 1 + n) % n : -1;\n if (to < 0) return;\n e.preventDefault();\n refs.current[to]?.focus();\n setHexIn('');\n pick(SWATCHES[to][1]);\n }}\n >\n {on ? <Icon name=\"check\" size={14} /> : null}\n </button>\n );\n })}\n </div>\n <div className=\"ui-accentpick-hex\">\n <span className=\"ui-accentpick-preview\" style={{ background: !bad && hexIn ? hexIn : cur }} />\n <input\n className={cx('ui-input', bad && 'is-invalid')}\n aria-label={tr('自訂強調色(色碼)')}\n aria-invalid={bad || undefined}\n value={hexIn}\n placeholder={cur}\n onChange={(e) => {\n const x = e.target.value.trim();\n setHexIn(x);\n if (HEX.test(x)) pick(x.toLowerCase());\n }}\n />\n <span className={cx('ui-field-hint', bad && 'is-error')}>{bad ? tr('色碼格式不正確,例如 #2457d6') : tr('輸入 # 加 6 碼')}</span>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;AAMA,MAAM,WAAW;AACjB,MAAM,MAAM;;AAaZ,SAAgB,aAAa,EAAE,OAAO,UAAU,OAAO,aAAgC;CACrF,MAAM,CAAC,KAAK,UAAU,MAAM,gBAAgB,SAAS,aAAa,EAAA,CAAG,YAAY,CAAC;CAClF,MAAM,CAAC,OAAO,YAAY,MAAM,SAAS,EAAE;CAC3C,MAAM,OAAO,SAAS,IAAA,CAAK,YAAY;CACvC,MAAM,QAAQ,MAAc;EAC1B,OAAO,CAAC;EACR,IAAI,UAAU,SAAS,CAAC;OACnB,UAAU,CAAC;CAClB;CACA,MAAM,MAAM,CAAC,CAAC,SAAS,CAAC,IAAI,KAAK,KAAK;CACtC,MAAM,OAAO,MAAM,OAAqC,CAAC,CAAC;CAE1D,MAAM,UAAU,KAAK,IACnB,GACA,SAAS,WAAW,GAAG,SAAS,QAAQ,GAAG,CAC7C;CACA,OACE,qBAAC,OAAD;EAAK,WAAW,GAAG,iBAAiB,SAAS;EAA7C,UAAA,CACE,oBAAC,OAAD;GAAK,MAAK;GAAa,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S,CAAC;MACV,IAAI,IAAI,KAAK,CAAC,GAAG,KAAK,EAAE,YAAY,CAAC;KACvC;IACD,CAAA;IACD,oBAAC,QAAD;KAAM,WAAW,GAAG,iBAAiB,OAAO,UAAU;KAAI,UAAA,MAAM,GAAG,oBAAoB,IAAI,GAAG,YAAY;IAAQ,CAAA;GAC/G;EACF,CAAA,CAAA;;AAET"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { IconSource } from "../../icons/Icon.js";
|
|
2
|
+
import { DangerConfirm } from "../Button/Button.js";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
interface ActionBase {
|
|
5
|
+
/** A verb. */
|
|
6
|
+
label: string;
|
|
7
|
+
onClick?: () => void;
|
|
8
|
+
icon?: IconSource;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export type ActionBarAction = (ActionBase & {
|
|
12
|
+
/** The one primary action. Default: the first action. */
|
|
13
|
+
primary?: boolean;
|
|
14
|
+
danger?: false;
|
|
15
|
+
}) | (ActionBase & {
|
|
16
|
+
/** Red in the 「更多」 menu, confirmed first. */
|
|
17
|
+
danger: true;
|
|
18
|
+
confirm: DangerConfirm;
|
|
19
|
+
primary?: false;
|
|
20
|
+
});
|
|
21
|
+
export interface ActionBarProps {
|
|
22
|
+
actions: ActionBarAction[];
|
|
23
|
+
className?: string;
|
|
24
|
+
}
|
|
25
|
+
/** A card's actions in a row. Under 600 px the primary one fills the width and the rest go into 「更多」. */
|
|
26
|
+
export declare function ActionBar({ actions, className }: ActionBarProps): React.JSX.Element;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { tr } from "../../i18n.js";
|
|
3
|
+
import { useFocusRescue } from "../../internal/focus.js";
|
|
4
|
+
import { cx } from "../../internal/util.js";
|
|
5
|
+
import { Button } from "../Button/Button.js";
|
|
6
|
+
import { Menu } from "../Menu/Menu.js";
|
|
7
|
+
import * as React from "react";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
// src/components/ActionBar/ActionBar.tsx
|
|
10
|
+
/** A card's actions in a row. Under 600 px the primary one fills the width and the rest go into 「更多」. */
|
|
11
|
+
function ActionBar({ actions, className }) {
|
|
12
|
+
const box = React.useRef(null);
|
|
13
|
+
useFocusRescue(box);
|
|
14
|
+
const main = actions.find((a) => a.primary) ?? actions.find((a) => !a.danger);
|
|
15
|
+
const others = actions.filter((a) => a !== main);
|
|
16
|
+
const button = (a, i, wide) => a.danger ? /* @__PURE__ */ jsx(Button, {
|
|
17
|
+
variant: "danger",
|
|
18
|
+
confirm: a.confirm,
|
|
19
|
+
icon: a.icon,
|
|
20
|
+
onClick: a.onClick,
|
|
21
|
+
disabled: a.disabled,
|
|
22
|
+
children: a.label
|
|
23
|
+
}, i) : /* @__PURE__ */ jsx(Button, {
|
|
24
|
+
variant: a === main ? "primary" : "secondary",
|
|
25
|
+
icon: a.icon,
|
|
26
|
+
onClick: a.onClick,
|
|
27
|
+
disabled: a.disabled,
|
|
28
|
+
className: wide ? "ui-actbar-main" : void 0,
|
|
29
|
+
children: a.label
|
|
30
|
+
}, i);
|
|
31
|
+
const menuItems = others.map((a) => a.danger ? {
|
|
32
|
+
label: a.label,
|
|
33
|
+
icon: a.icon,
|
|
34
|
+
onSelect: a.onClick,
|
|
35
|
+
disabled: a.disabled,
|
|
36
|
+
danger: true,
|
|
37
|
+
confirm: a.confirm
|
|
38
|
+
} : {
|
|
39
|
+
label: a.label,
|
|
40
|
+
icon: a.icon,
|
|
41
|
+
onSelect: a.onClick,
|
|
42
|
+
disabled: a.disabled
|
|
43
|
+
});
|
|
44
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
45
|
+
ref: box,
|
|
46
|
+
className: cx("ui-actbar", className),
|
|
47
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
48
|
+
className: "ui-actbar-wide",
|
|
49
|
+
children: (main ? [main, ...others] : others).map((a, i) => button(a, i, false))
|
|
50
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
51
|
+
className: "ui-actbar-narrow",
|
|
52
|
+
children: [main ? button(main, 0, true) : null, others.length ? /* @__PURE__ */ jsx(Menu, {
|
|
53
|
+
label: tr("更多操作"),
|
|
54
|
+
triggerClassName: "ui-actbar-more",
|
|
55
|
+
items: menuItems
|
|
56
|
+
}) : null]
|
|
57
|
+
})]
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
export { ActionBar };
|
|
61
|
+
|
|
62
|
+
//# sourceMappingURL=ActionBar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ActionBar.js","names":[],"sources":["../../../src/components/ActionBar/ActionBar.tsx"],"sourcesContent":["import * as React from 'react';\nimport { tr } from '../../i18n';\nimport type { IconSource } from '../../icons/Icon';\nimport { useFocusRescue } from '../../internal/focus';\nimport { cx } from '../../internal/util';\nimport { Button, type DangerConfirm } from '../Button/Button';\nimport { Menu, type MenuItem } from '../Menu/Menu';\n\ninterface ActionBase {\n /** A verb. */\n label: string;\n onClick?: () => void;\n icon?: IconSource;\n disabled?: boolean;\n}\n\nexport type ActionBarAction =\n | (ActionBase & {\n /** The one primary action. Default: the first action. */\n primary?: boolean;\n danger?: false;\n })\n | (ActionBase & {\n /** Red in the 「更多」 menu, confirmed first. */\n danger: true;\n confirm: DangerConfirm;\n primary?: false;\n });\n\nexport interface ActionBarProps {\n actions: ActionBarAction[];\n className?: string;\n}\n\n/** A card's actions in a row. Under 600 px the primary one fills the width and the rest go into 「更多」. */\nexport function ActionBar({ actions, className }: ActionBarProps) {\n // A button that is removed, replaced or disabled after a press hands focus to its neighbour.\n const box = React.useRef<HTMLDivElement>(null);\n useFocusRescue(box);\n const main = actions.find((a) => a.primary) ?? actions.find((a) => !a.danger);\n const others = actions.filter((a) => a !== main);\n const button = (a: ActionBarAction, i: number, wide: boolean) =>\n a.danger ? (\n <Button key={i} variant=\"danger\" confirm={a.confirm} icon={a.icon} onClick={a.onClick} disabled={a.disabled}>\n {a.label}\n </Button>\n ) : (\n <Button\n key={i}\n variant={a === main ? 'primary' : 'secondary'}\n icon={a.icon}\n onClick={a.onClick}\n disabled={a.disabled}\n className={wide ? 'ui-actbar-main' : undefined}\n >\n {a.label}\n </Button>\n );\n const menuItems = others.map((a): MenuItem =>\n a.danger\n ? { label: a.label, icon: a.icon, onSelect: a.onClick, disabled: a.disabled, danger: true, confirm: a.confirm }\n : { label: a.label, icon: a.icon, onSelect: a.onClick, disabled: a.disabled },\n );\n return (\n <div ref={box} className={cx('ui-actbar', className)}>\n <div className=\"ui-actbar-wide\">{(main ? [main, ...others] : others).map((a, i) => button(a, i, false))}</div>\n <div className=\"ui-actbar-narrow\">\n {main ? button(main, 0, true) : null}\n {others.length ? <Menu label={tr('更多操作')} triggerClassName=\"ui-actbar-more\" items={menuItems} /> : null}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;AAmCA,SAAgB,UAAU,EAAE,SAAS,aAA6B;CAEhE,MAAM,MAAM,MAAM,OAAuB,IAAI;CAC7C,eAAe,GAAG;CAClB,MAAM,OAAO,QAAQ,MAAM,MAAM,EAAE,OAAO,KAAK,QAAQ,MAAM,MAAM,CAAC,EAAE,MAAM;CAC5E,MAAM,SAAS,QAAQ,QAAQ,MAAM,MAAM,IAAI;CAC/C,MAAM,UAAU,GAAoB,GAAW,SAC7C,EAAE,SACA,oBAAC,QAAD;EAAgB,SAAQ;EAAS,SAAS,EAAE;EAAS,MAAM,EAAE;EAAM,SAAS,EAAE;EAAS,UAAU,EAAE;EAChG,UAAA,EAAE;CACG,GAFK,CAEL,IAER,oBAAC,QAAD;EAEE,SAAS,MAAM,OAAO,YAAY;EAClC,MAAM,EAAE;EACR,SAAS,EAAE;EACX,UAAU,EAAE;EACZ,WAAW,OAAO,mBAAmB,KAAA;EAEpC,UAAA,EAAE;CACG,GARD,CAQC;CAEZ,MAAM,YAAY,OAAO,KAAK,MAC5B,EAAE,SACE;EAAE,OAAO,EAAE;EAAO,MAAM,EAAE;EAAM,UAAU,EAAE;EAAS,UAAU,EAAE;EAAU,QAAQ;EAAM,SAAS,EAAE;CAAQ,IAC5G;EAAE,OAAO,EAAE;EAAO,MAAM,EAAE;EAAM,UAAU,EAAE;EAAS,UAAU,EAAE;CAAS,CAChF;CACA,OACE,qBAAC,OAAD;EAAK,KAAK;EAAK,WAAW,GAAG,aAAa,SAAS;EAAnD,UAAA,CACE,oBAAC,OAAD;GAAK,WAAU;GAAmB,WAAA,OAAO,CAAC,MAAM,GAAG,MAAM,IAAI,OAAA,CAAQ,KAAK,GAAG,MAAM,OAAO,GAAG,GAAG,KAAK,CAAC;EAAO,CAAA,GAC7G,qBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACG,OAAO,OAAO,MAAM,GAAG,IAAI,IAAI,MAC/B,OAAO,SAAS,oBAAC,MAAD;IAAM,OAAO,GAAG,MAAM;IAAG,kBAAiB;IAAiB,OAAO;GAAY,CAAA,IAAI,IAChG;EACF,CAAA,CAAA;;AAET"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface AiMarkProps {
|
|
2
|
+
/** The words shown. Default 「AI 撰寫」; another source mark in the same style, e.g. 「推測」. */
|
|
3
|
+
text?: string;
|
|
4
|
+
/** What screen readers say, when it should differ from text. Default: text in parentheses, 「(AI 撰寫)」. */
|
|
5
|
+
label?: string;
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
/** A small gray 「AI 撰寫」 at the end of a sentence, paragraph, list item or cell written by AI. Not a link and not a
|
|
9
|
+
* Tab stop; screen readers hear it in parentheses after the sentence. */
|
|
10
|
+
export declare function AiMark({ text, label, className }: AiMarkProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cx } from "../../internal/util.js";
|
|
3
|
+
import { tr } from "../../i18n.js";
|
|
4
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
// src/components/AiMark/AiMark.tsx
|
|
6
|
+
/** A small gray 「AI 撰寫」 at the end of a sentence, paragraph, list item or cell written by AI. Not a link and not a
|
|
7
|
+
* Tab stop; screen readers hear it in parentheses after the sentence. */
|
|
8
|
+
function AiMark({ text, label, className }) {
|
|
9
|
+
const words = text ?? tr("AI 撰寫");
|
|
10
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
|
|
11
|
+
className: cx("ui-aimark", className),
|
|
12
|
+
"aria-hidden": "true",
|
|
13
|
+
children: words
|
|
14
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
15
|
+
className: "ui-visually-hidden",
|
|
16
|
+
children: label ?? tr("({v})", { v: words })
|
|
17
|
+
})] });
|
|
18
|
+
}
|
|
19
|
+
export { AiMark };
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=AiMark.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AiMark.js","names":[],"sources":["../../../src/components/AiMark/AiMark.tsx"],"sourcesContent":["import { cx } from '../../internal/util';\nimport { tr } from '../../i18n';\n\nexport interface AiMarkProps {\n /** The words shown. Default 「AI 撰寫」; another source mark in the same style, e.g. 「推測」. */\n text?: string;\n /** What screen readers say, when it should differ from text. Default: text in parentheses, 「(AI 撰寫)」. */\n label?: string;\n className?: string;\n}\n\n/** A small gray 「AI 撰寫」 at the end of a sentence, paragraph, list item or cell written by AI. Not a link and not a\n * Tab stop; screen readers hear it in parentheses after the sentence. */\nexport function AiMark({ text, label, className }: AiMarkProps) {\n const words = text ?? tr('AI 撰寫');\n return (\n <>\n <span className={cx('ui-aimark', className)} aria-hidden=\"true\">\n {words}\n </span>\n <span className=\"ui-visually-hidden\">{label ?? tr('({v})', { v: words })}</span>\n </>\n );\n}\n"],"mappings":";;;;;;;AAaA,SAAgB,OAAO,EAAE,MAAM,OAAO,aAA0B;CAC9D,MAAM,QAAQ,QAAQ,GAAG,OAAO;CAChC,OACE,qBAAA,UAAA,EAAA,UAAA,CACE,oBAAC,QAAD;EAAM,WAAW,GAAG,aAAa,SAAS;EAAG,eAAY;EACtD,UAAA;CACG,CAAA,GACN,oBAAC,QAAD;EAAM,WAAU;EAAsB,UAAA,SAAS,GAAG,SAAS,EAAE,GAAG,MAAM,CAAC;CAAQ,CAAA,CAC/E,EAAA,CAAA;AAEN"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export type AlertTone = 'info' | 'success' | 'warning' | 'danger';
|
|
3
|
+
export interface AlertProps {
|
|
4
|
+
/** Default 'info'. danger is announced at once (role alert). */
|
|
5
|
+
tone?: AlertTone;
|
|
6
|
+
title?: string;
|
|
7
|
+
/** The cause and the fix, at most 2 short sentences. */
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
/** A verb, such as 重試. */
|
|
10
|
+
actionLabel?: string;
|
|
11
|
+
onAction?: () => void;
|
|
12
|
+
/** Adds × for info and success; warning and danger stay until the problem is solved. */
|
|
13
|
+
onDismiss?: () => void;
|
|
14
|
+
className?: string;
|
|
15
|
+
}
|
|
16
|
+
/** A message inside the page with a colored bar and icon. */
|
|
17
|
+
export declare function Alert({ tone, title, children, actionLabel, onAction, onDismiss, className }: AlertProps): React.JSX.Element;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { tr } from "../../i18n.js";
|
|
3
|
+
import { Icon } from "../../icons/Icon.js";
|
|
4
|
+
import { cx } from "../../internal/util.js";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
// src/components/Alert/Alert.tsx
|
|
7
|
+
const ALERT_ICONS = {
|
|
8
|
+
info: "M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0-18zM12 11v5M12 7.5v.5",
|
|
9
|
+
success: "M5 12.5l4.5 4.5L19 7",
|
|
10
|
+
warning: "M12 4l9 16H3zM12 10v4M12 17v.5",
|
|
11
|
+
danger: "M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0-18zM12 8v5M12 16.5v.5"
|
|
12
|
+
};
|
|
13
|
+
/** A message inside the page with a colored bar and icon. */
|
|
14
|
+
function Alert({ tone = "info", title, children, actionLabel, onAction, onDismiss, className }) {
|
|
15
|
+
const t = ALERT_ICONS[tone] ? tone : "info";
|
|
16
|
+
const canClose = (t === "info" || t === "success") && onDismiss;
|
|
17
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
18
|
+
className: cx("ui-alert", "ui-alert-" + t, className),
|
|
19
|
+
role: t === "danger" ? "alert" : "status",
|
|
20
|
+
children: [
|
|
21
|
+
/* @__PURE__ */ jsx(Icon, {
|
|
22
|
+
d: ALERT_ICONS[t],
|
|
23
|
+
className: "ui-alert-icon"
|
|
24
|
+
}),
|
|
25
|
+
/* @__PURE__ */ jsxs("div", {
|
|
26
|
+
className: "ui-alert-content",
|
|
27
|
+
children: [title ? /* @__PURE__ */ jsx("div", {
|
|
28
|
+
className: "ui-alert-title",
|
|
29
|
+
children: title
|
|
30
|
+
}) : null, children ? /* @__PURE__ */ jsx("div", {
|
|
31
|
+
className: "ui-alert-body",
|
|
32
|
+
children
|
|
33
|
+
}) : null]
|
|
34
|
+
}),
|
|
35
|
+
actionLabel ? /* @__PURE__ */ jsx("button", {
|
|
36
|
+
type: "button",
|
|
37
|
+
className: "ui-btn ui-btn-secondary ui-alert-action",
|
|
38
|
+
onClick: onAction,
|
|
39
|
+
children: actionLabel
|
|
40
|
+
}) : null,
|
|
41
|
+
canClose ? /* @__PURE__ */ jsx("button", {
|
|
42
|
+
type: "button",
|
|
43
|
+
className: "ui-alert-close",
|
|
44
|
+
"aria-label": tr("關閉提示"),
|
|
45
|
+
onClick: onDismiss,
|
|
46
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
47
|
+
name: "x",
|
|
48
|
+
size: 16
|
|
49
|
+
})
|
|
50
|
+
}) : null
|
|
51
|
+
]
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
export { Alert };
|
|
55
|
+
|
|
56
|
+
//# sourceMappingURL=Alert.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Alert.js","names":[],"sources":["../../../src/components/Alert/Alert.tsx"],"sourcesContent":["import type * as React from 'react';\nimport { tr } from '../../i18n';\nimport { Icon, type CustomIcon } from '../../icons/Icon';\nimport { cx } from '../../internal/util';\n\nexport type AlertTone = 'info' | 'success' | 'warning' | 'danger';\n\nconst ALERT_ICONS: Record<AlertTone, CustomIcon> = {\n info: 'M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0-18zM12 11v5M12 7.5v.5',\n success: 'M5 12.5l4.5 4.5L19 7',\n warning: 'M12 4l9 16H3zM12 10v4M12 17v.5',\n danger: 'M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0-18zM12 8v5M12 16.5v.5',\n};\n\nexport interface AlertProps {\n /** Default 'info'. danger is announced at once (role alert). */\n tone?: AlertTone;\n title?: string;\n /** The cause and the fix, at most 2 short sentences. */\n children?: React.ReactNode;\n /** A verb, such as 重試. */\n actionLabel?: string;\n onAction?: () => void;\n /** Adds × for info and success; warning and danger stay until the problem is solved. */\n onDismiss?: () => void;\n className?: string;\n}\n\n/** A message inside the page with a colored bar and icon. */\nexport function Alert({ tone = 'info', title, children, actionLabel, onAction, onDismiss, className }: AlertProps) {\n const t = ALERT_ICONS[tone] ? tone : 'info';\n const canClose = (t === 'info' || t === 'success') && onDismiss;\n return (\n <div className={cx('ui-alert', 'ui-alert-' + t, className)} role={t === 'danger' ? 'alert' : 'status'}>\n <Icon d={ALERT_ICONS[t]} className=\"ui-alert-icon\" />\n <div className=\"ui-alert-content\">\n {title ? <div className=\"ui-alert-title\">{title}</div> : null}\n {children ? <div className=\"ui-alert-body\">{children}</div> : null}\n </div>\n {actionLabel ? (\n <button type=\"button\" className=\"ui-btn ui-btn-secondary ui-alert-action\" onClick={onAction}>\n {actionLabel}\n </button>\n ) : null}\n {canClose ? (\n <button type=\"button\" className=\"ui-alert-close\" aria-label={tr('關閉提示')} onClick={onDismiss}>\n <Icon name=\"x\" size={16} />\n </button>\n ) : null}\n </div>\n );\n}\n"],"mappings":";;;;;;AAOA,MAAM,cAA6C;CACjD,MAAM;CACN,SAAS;CACT,SAAS;CACT,QAAQ;AACV;;AAiBA,SAAgB,MAAM,EAAE,OAAO,QAAQ,OAAO,UAAU,aAAa,UAAU,WAAW,aAAyB;CACjH,MAAM,IAAI,YAAY,QAAQ,OAAO;CACrC,MAAM,YAAY,MAAM,UAAU,MAAM,cAAc;CACtD,OACE,qBAAC,OAAD;EAAK,WAAW,GAAG,YAAY,cAAc,GAAG,SAAS;EAAG,MAAM,MAAM,WAAW,UAAU;EAA7F,UAAA;GACE,oBAAC,MAAD;IAAM,GAAG,YAAY;IAAI,WAAU;GAAiB,CAAA;GACpD,qBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACG,QAAQ,oBAAC,OAAD;KAAK,WAAU;KAAkB,UAAA;IAAW,CAAA,IAAI,MACxD,WAAW,oBAAC,OAAD;KAAK,WAAU;KAAiB;IAAc,CAAA,IAAI,IAC3D;;GACJ,cACC,oBAAC,UAAD;IAAQ,MAAK;IAAS,WAAU;IAA0C,SAAS;IAChF,UAAA;GACK,CAAA,IACN;GACH,WACC,oBAAC,UAAD;IAAQ,MAAK;IAAS,WAAU;IAAiB,cAAY,GAAG,MAAM;IAAG,SAAS;IAChF,UAAA,oBAAC,MAAD;KAAM,MAAK;KAAI,MAAM;IAAK,CAAA;GACpB,CAAA,IACN;EACD;;AAET"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { NavBrand, NavSection } from "../SideNav/SideNav.js";
|
|
2
|
+
import { BreadcrumbItem } from "../Breadcrumb/Breadcrumb.js";
|
|
3
|
+
import { focusMain } from "../../internal/focusMain.js";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
export interface AppShellProps {
|
|
6
|
+
/** Sidebar groups. On phones, top-level items with an icon become bottom tabs; pages they cannot reach go under 「更多」. */
|
|
7
|
+
nav: NavSection[];
|
|
8
|
+
/** Id of the current page. */
|
|
9
|
+
value: string;
|
|
10
|
+
onNavigate: (id: string) => void;
|
|
11
|
+
/** The product at the top of the sidebar: { mark, name, href } (see SideNav's NavBrand). Collapsed it shows the mark
|
|
12
|
+
* alone, a link named by `name`; open or pinned, the name fades in beside it. Plain text gets its first character as
|
|
13
|
+
* the mark. */
|
|
14
|
+
brand?: React.ReactNode | NavBrand;
|
|
15
|
+
/** The page title, shown once in the top bar. Do not repeat it as a heading in the page. */
|
|
16
|
+
title?: string;
|
|
17
|
+
breadcrumb?: BreadcrumbItem[];
|
|
18
|
+
/** Opens search (CommandPalette). */
|
|
19
|
+
onSearch?: () => void;
|
|
20
|
+
/** Right side of the top bar: NotificationBell, ProjectSwitcher, the account menu. */
|
|
21
|
+
actions?: React.ReactNode;
|
|
22
|
+
/** The page: Cards and sections, 32 px apart. */
|
|
23
|
+
children: React.ReactNode;
|
|
24
|
+
/** Labels under the phone tab bar's icons (MobileTabBar labels). Default true. */
|
|
25
|
+
tabLabels?: boolean;
|
|
26
|
+
/** Desktop: whether the sidebar starts pinned (240 px, or 72 px collapsed, beside the content) until the reader
|
|
27
|
+
* pins or unpins it; their choice is kept in the browser. Default false: a 72 px strip of icons that opens to
|
|
28
|
+
* 240 px over the content while the pointer or the keyboard focus is on it. */
|
|
29
|
+
defaultPinned?: boolean;
|
|
30
|
+
className?: string;
|
|
31
|
+
}
|
|
32
|
+
/** The dashboard frame: sidebar (240 px, 72 px collapsed) above 1024 px, a drawer from the top bar's menu button from
|
|
33
|
+
* 600 to 1024 px, and bottom tabs on phones.
|
|
34
|
+
* The top bar hides while scrolling down and returns when scrolling up. */
|
|
35
|
+
export declare function AppShell({ nav, value, onNavigate, brand, title, breadcrumb, onSearch, actions, children, tabLabels, defaultPinned, className }: AppShellProps): React.JSX.Element;
|
|
36
|
+
export { focusMain };
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { SideNav } from "../SideNav/SideNav.js";
|
|
3
|
+
import { TopBar } from "../TopBar/TopBar.js";
|
|
4
|
+
import { MobileTabBar } from "../MobileTabBar/MobileTabBar.js";
|
|
5
|
+
import { Drawer } from "../Drawer/Drawer.js";
|
|
6
|
+
import { tr } from "../../i18n.js";
|
|
7
|
+
import { cx, store, useMedia, useNarrow } from "../../internal/util.js";
|
|
8
|
+
import { devWarn } from "../../internal/dev.js";
|
|
9
|
+
import { ensureAnnouncer } from "../../announce.js";
|
|
10
|
+
import { focusMain } from "../../internal/focusMain.js";
|
|
11
|
+
import * as React from "react";
|
|
12
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
+
// src/components/AppShell/AppShell.tsx
|
|
14
|
+
const COLLAPSE_KEY = "ui-nav-collapsed";
|
|
15
|
+
const PIN_KEY = "ui-nav-pinned";
|
|
16
|
+
/** Pointer on the strip this long before it opens (passing over it on the way to the browser's edge does not). */
|
|
17
|
+
const OPEN_DELAY = 100;
|
|
18
|
+
/** Pointer away this long before it hides again (a slip off the edge does not). */
|
|
19
|
+
const CLOSE_DELAY = 300;
|
|
20
|
+
const MORE = "\0more";
|
|
21
|
+
/** The dashboard frame: sidebar (240 px, 72 px collapsed) above 1024 px, a drawer from the top bar's menu button from
|
|
22
|
+
* 600 to 1024 px, and bottom tabs on phones.
|
|
23
|
+
* The top bar hides while scrolling down and returns when scrolling up. */
|
|
24
|
+
function AppShell({ nav, value, onNavigate, brand, title, breadcrumb, onSearch, actions, children, tabLabels, defaultPinned = false, className }) {
|
|
25
|
+
const phone = useNarrow();
|
|
26
|
+
const tablet = useMedia("(min-width: 600px) and (max-width: 1024px)");
|
|
27
|
+
const [userCollapsed, setUserCollapsed] = React.useState(() => store(COLLAPSE_KEY) === "1");
|
|
28
|
+
const [pinned, setPinned] = React.useState(() => {
|
|
29
|
+
const v = store(PIN_KEY);
|
|
30
|
+
if (v != null) return v === "1";
|
|
31
|
+
return store(COLLAPSE_KEY) != null || defaultPinned;
|
|
32
|
+
});
|
|
33
|
+
const [open, setOpen] = React.useState(false);
|
|
34
|
+
const openTimer = React.useRef(void 0);
|
|
35
|
+
const closeTimer = React.useRef(void 0);
|
|
36
|
+
const later = (show) => {
|
|
37
|
+
clearTimeout(openTimer.current);
|
|
38
|
+
clearTimeout(closeTimer.current);
|
|
39
|
+
if (show) openTimer.current = setTimeout(() => setOpen(true), OPEN_DELAY);
|
|
40
|
+
else closeTimer.current = setTimeout(() => setOpen(false), CLOSE_DELAY);
|
|
41
|
+
};
|
|
42
|
+
React.useEffect(() => () => {
|
|
43
|
+
clearTimeout(openTimer.current);
|
|
44
|
+
clearTimeout(closeTimer.current);
|
|
45
|
+
}, []);
|
|
46
|
+
const collapsed = pinned ? userCollapsed : !open;
|
|
47
|
+
const togglePin = () => {
|
|
48
|
+
store(PIN_KEY, pinned ? "0" : "1");
|
|
49
|
+
setPinned(!pinned);
|
|
50
|
+
setOpen(false);
|
|
51
|
+
};
|
|
52
|
+
const top = nav.flatMap((s) => s.items);
|
|
53
|
+
const parentOf = (id) => top.find((it) => it.children?.some((c) => c.id === id));
|
|
54
|
+
const withIcon = top.filter((it) => !!it.icon);
|
|
55
|
+
const unreachable = top.some((it) => !it.icon || (it.children?.length ?? 0) > 1) || withIcon.length > 5;
|
|
56
|
+
const tabs = withIcon.slice(0, unreachable ? 4 : 5).map((it) => ({
|
|
57
|
+
id: it.id,
|
|
58
|
+
label: it.label,
|
|
59
|
+
icon: it.icon
|
|
60
|
+
}));
|
|
61
|
+
if (unreachable) tabs.push({
|
|
62
|
+
id: MORE,
|
|
63
|
+
label: tr("更多"),
|
|
64
|
+
icon: "dots-three"
|
|
65
|
+
});
|
|
66
|
+
const [moreOpen, setMoreOpen] = React.useState(false);
|
|
67
|
+
if (moreOpen && !phone && !tablet) setMoreOpen(false);
|
|
68
|
+
devWarn(phone && withIcon.length < 2, "AppShell", "phones show the top-level nav items as bottom tabs; give at least 2 of them an icon.");
|
|
69
|
+
const current = parentOf(value)?.id ?? value;
|
|
70
|
+
const tabValue = tabs.some((t) => t.id === current) ? current : MORE;
|
|
71
|
+
const onTab = (id) => {
|
|
72
|
+
if (id === MORE) return setMoreOpen(true);
|
|
73
|
+
if (id === current) return;
|
|
74
|
+
onNavigate(top.find((it) => it.id === id)?.children?.[0]?.id ?? id);
|
|
75
|
+
};
|
|
76
|
+
const main = React.useRef(null);
|
|
77
|
+
const [hidden, setHidden] = React.useState(false);
|
|
78
|
+
React.useEffect(() => {
|
|
79
|
+
const el = main.current;
|
|
80
|
+
if (!el) return;
|
|
81
|
+
let last = el.scrollTop;
|
|
82
|
+
const onScroll = () => {
|
|
83
|
+
const y = el.scrollTop;
|
|
84
|
+
if (Math.abs(y - last) < 8) return;
|
|
85
|
+
setHidden(y > last && y > 64);
|
|
86
|
+
last = y;
|
|
87
|
+
};
|
|
88
|
+
el.addEventListener("scroll", onScroll, { passive: true });
|
|
89
|
+
return () => el.removeEventListener("scroll", onScroll);
|
|
90
|
+
}, []);
|
|
91
|
+
React.useEffect(() => {
|
|
92
|
+
ensureAnnouncer();
|
|
93
|
+
}, []);
|
|
94
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
95
|
+
className: cx("ui-shell", phone && "is-phone", className),
|
|
96
|
+
children: [
|
|
97
|
+
/* @__PURE__ */ jsx("a", {
|
|
98
|
+
className: "ui-skip",
|
|
99
|
+
href: "#main",
|
|
100
|
+
onClick: (e) => {
|
|
101
|
+
e.preventDefault();
|
|
102
|
+
focusMain();
|
|
103
|
+
},
|
|
104
|
+
children: tr("跳到主要內容")
|
|
105
|
+
}),
|
|
106
|
+
phone || tablet ? null : pinned ? /* @__PURE__ */ jsx(SideNav, {
|
|
107
|
+
sections: nav,
|
|
108
|
+
value,
|
|
109
|
+
onChange: onNavigate,
|
|
110
|
+
brand,
|
|
111
|
+
collapsed,
|
|
112
|
+
pinned: true,
|
|
113
|
+
onPin: togglePin,
|
|
114
|
+
onToggle: () => {
|
|
115
|
+
store(COLLAPSE_KEY, userCollapsed ? "0" : "1");
|
|
116
|
+
setUserCollapsed(!userCollapsed);
|
|
117
|
+
}
|
|
118
|
+
}) : /* @__PURE__ */ jsx("div", {
|
|
119
|
+
className: cx("ui-shell-rail", open && "is-open"),
|
|
120
|
+
onPointerEnter: (e) => e.pointerType === "mouse" && later(true),
|
|
121
|
+
onPointerLeave: (e) => e.pointerType === "mouse" && later(false),
|
|
122
|
+
onFocus: (e) => {
|
|
123
|
+
if (!e.target.matches(":focus-visible")) return;
|
|
124
|
+
clearTimeout(closeTimer.current);
|
|
125
|
+
setOpen(true);
|
|
126
|
+
},
|
|
127
|
+
onBlur: (e) => {
|
|
128
|
+
if (!e.currentTarget.contains(e.relatedTarget)) setOpen(false);
|
|
129
|
+
},
|
|
130
|
+
onKeyDown: (e) => {
|
|
131
|
+
if (e.key === "Escape" && open) {
|
|
132
|
+
e.stopPropagation();
|
|
133
|
+
setOpen(false);
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
children: /* @__PURE__ */ jsx(SideNav, {
|
|
137
|
+
sections: nav,
|
|
138
|
+
value,
|
|
139
|
+
onChange: (id) => {
|
|
140
|
+
clearTimeout(openTimer.current);
|
|
141
|
+
setOpen(false);
|
|
142
|
+
onNavigate(id);
|
|
143
|
+
},
|
|
144
|
+
brand,
|
|
145
|
+
collapsed,
|
|
146
|
+
onPin: togglePin
|
|
147
|
+
})
|
|
148
|
+
}),
|
|
149
|
+
/* @__PURE__ */ jsxs("div", {
|
|
150
|
+
className: "ui-shell-body",
|
|
151
|
+
children: [
|
|
152
|
+
/* @__PURE__ */ jsx(TopBar, {
|
|
153
|
+
className: cx("ui-shell-top", hidden && "is-hidden"),
|
|
154
|
+
title,
|
|
155
|
+
breadcrumb,
|
|
156
|
+
onSearch: onSearch ?? false,
|
|
157
|
+
onMenu: tablet ? () => setMoreOpen(true) : void 0,
|
|
158
|
+
children: actions
|
|
159
|
+
}),
|
|
160
|
+
/* @__PURE__ */ jsx("main", {
|
|
161
|
+
ref: main,
|
|
162
|
+
className: "ui-shell-main",
|
|
163
|
+
tabIndex: -1,
|
|
164
|
+
children
|
|
165
|
+
}),
|
|
166
|
+
phone && tabs.length ? /* @__PURE__ */ jsx(MobileTabBar, {
|
|
167
|
+
items: tabs,
|
|
168
|
+
value: tabValue,
|
|
169
|
+
onChange: onTab,
|
|
170
|
+
labels: tabLabels
|
|
171
|
+
}) : null,
|
|
172
|
+
phone || tablet ? /* @__PURE__ */ jsx(Drawer, {
|
|
173
|
+
open: moreOpen,
|
|
174
|
+
onClose: () => setMoreOpen(false),
|
|
175
|
+
title: tr("全部頁面"),
|
|
176
|
+
side: tablet ? "left" : "right",
|
|
177
|
+
width: tablet ? 300 : void 0,
|
|
178
|
+
children: /* @__PURE__ */ jsx(SideNav, {
|
|
179
|
+
className: "ui-shell-allnav",
|
|
180
|
+
sections: nav,
|
|
181
|
+
value,
|
|
182
|
+
onChange: (id) => {
|
|
183
|
+
setMoreOpen(false);
|
|
184
|
+
onNavigate(id);
|
|
185
|
+
}
|
|
186
|
+
})
|
|
187
|
+
}) : null
|
|
188
|
+
]
|
|
189
|
+
})
|
|
190
|
+
]
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
export { AppShell, focusMain };
|
|
194
|
+
|
|
195
|
+
//# sourceMappingURL=AppShell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppShell.js","names":[],"sources":["../../../src/components/AppShell/AppShell.tsx"],"sourcesContent":["import * as React from 'react';\nimport { SideNav, type NavBrand, type NavItem, type NavSection } from '../SideNav/SideNav';\nimport { TopBar } from '../TopBar/TopBar';\nimport { MobileTabBar, type MobileTab } from '../MobileTabBar/MobileTabBar';\nimport { Drawer } from '../Drawer/Drawer';\nimport { tr } from '../../i18n';\nimport type { BreadcrumbItem } from '../Breadcrumb/Breadcrumb';\nimport { cx, store, useMedia, useNarrow } from '../../internal/util';\nimport { devWarn } from '../../internal/dev';\nimport { ensureAnnouncer } from '../../announce';\nimport { focusMain } from '../../internal/focusMain';\n\nexport interface AppShellProps {\n /** Sidebar groups. On phones, top-level items with an icon become bottom tabs; pages they cannot reach go under 「更多」. */\n nav: NavSection[];\n /** Id of the current page. */\n value: string;\n onNavigate: (id: string) => void;\n /** The product at the top of the sidebar: { mark, name, href } (see SideNav's NavBrand). Collapsed it shows the mark\n * alone, a link named by `name`; open or pinned, the name fades in beside it. Plain text gets its first character as\n * the mark. */\n brand?: React.ReactNode | NavBrand;\n /** The page title, shown once in the top bar. Do not repeat it as a heading in the page. */\n title?: string;\n breadcrumb?: BreadcrumbItem[];\n /** Opens search (CommandPalette). */\n onSearch?: () => void;\n /** Right side of the top bar: NotificationBell, ProjectSwitcher, the account menu. */\n actions?: React.ReactNode;\n /** The page: Cards and sections, 32 px apart. */\n children: React.ReactNode;\n /** Labels under the phone tab bar's icons (MobileTabBar labels). Default true. */\n tabLabels?: boolean;\n /** Desktop: whether the sidebar starts pinned (240 px, or 72 px collapsed, beside the content) until the reader\n * pins or unpins it; their choice is kept in the browser. Default false: a 72 px strip of icons that opens to\n * 240 px over the content while the pointer or the keyboard focus is on it. */\n defaultPinned?: boolean;\n className?: string;\n}\n\nconst COLLAPSE_KEY = 'ui-nav-collapsed';\nconst PIN_KEY = 'ui-nav-pinned';\n/** Pointer on the strip this long before it opens (passing over it on the way to the browser's edge does not). */\nconst OPEN_DELAY = 100;\n/** Pointer away this long before it hides again (a slip off the edge does not). */\nconst CLOSE_DELAY = 300;\n\nexport { focusMain };\nconst MORE = '\\u0000more';\n\n/** The dashboard frame: sidebar (240 px, 72 px collapsed) above 1024 px, a drawer from the top bar's menu button from\n * 600 to 1024 px, and bottom tabs on phones.\n * The top bar hides while scrolling down and returns when scrolling up. */\nexport function AppShell({\n nav,\n value,\n onNavigate,\n brand,\n title,\n breadcrumb,\n onSearch,\n actions,\n children,\n tabLabels,\n defaultPinned = false,\n className,\n}: AppShellProps) {\n const phone = useNarrow();\n // 600 to 1024 px (tablets, narrow windows): no sidebar; the top bar's menu button opens the whole nav in a drawer.\n const tablet = useMedia('(min-width: 600px) and (max-width: 1024px)');\n const [userCollapsed, setUserCollapsed] = React.useState(() => store(COLLAPSE_KEY) === '1');\n // Pinned: the sidebar sits beside the content as before (240 px, or 72 px collapsed). Not pinned: a 72 px strip of\n // icons that opens over the content. Someone who already chose collapsed or expanded keeps a pinned sidebar.\n const [pinned, setPinned] = React.useState(() => {\n const v = store(PIN_KEY);\n if (v != null) return v === '1';\n return store(COLLAPSE_KEY) != null || defaultPinned;\n });\n const [open, setOpen] = React.useState(false);\n const openTimer = React.useRef<ReturnType<typeof setTimeout>>(undefined);\n const closeTimer = React.useRef<ReturnType<typeof setTimeout>>(undefined);\n const later = (show: boolean) => {\n clearTimeout(openTimer.current);\n clearTimeout(closeTimer.current);\n if (show) openTimer.current = setTimeout(() => setOpen(true), OPEN_DELAY);\n else closeTimer.current = setTimeout(() => setOpen(false), CLOSE_DELAY);\n };\n React.useEffect(\n () => () => {\n clearTimeout(openTimer.current);\n clearTimeout(closeTimer.current);\n },\n [],\n );\n const collapsed = pinned ? userCollapsed : !open;\n const togglePin = () => {\n store(PIN_KEY, pinned ? '0' : '1');\n setPinned(!pinned);\n setOpen(false);\n };\n const top = nav.flatMap((s) => s.items);\n const parentOf = (id: string) => top.find((it) => it.children?.some((c) => c.id === id));\n // Phones: top-level items with an icon become tabs (a group opens its first page).\n // When some page is not reachable that way, the last tab becomes 「更多」 and opens the whole nav.\n const withIcon = top.filter((it): it is NavItem & { icon: NonNullable<NavItem['icon']> } => !!it.icon);\n const unreachable = top.some((it) => !it.icon || (it.children?.length ?? 0) > 1) || withIcon.length > 5;\n const tabs: MobileTab[] = withIcon.slice(0, unreachable ? 4 : 5).map((it) => ({ id: it.id, label: it.label, icon: it.icon }));\n if (unreachable) tabs.push({ id: MORE, label: tr('更多'), icon: 'dots-three' });\n const [moreOpen, setMoreOpen] = React.useState(false);\n // Widened past the drawer's layouts (to a desktop with the sidebar): closed, so it does not pop up again when the\n // window narrows later.\n if (moreOpen && !phone && !tablet) setMoreOpen(false);\n devWarn(phone && withIcon.length < 2, 'AppShell', 'phones show the top-level nav items as bottom tabs; give at least 2 of them an icon.');\n const current = parentOf(value)?.id ?? value;\n const tabValue = tabs.some((t) => t.id === current) ? current : MORE;\n const onTab = (id: string) => {\n if (id === MORE) return setMoreOpen(true);\n if (id === current) return;\n const item = top.find((it) => it.id === id);\n onNavigate(item?.children?.[0]?.id ?? id);\n };\n\n // Hide the top bar while scrolling down, show it again on the way up.\n const main = React.useRef<HTMLElement>(null);\n const [hidden, setHidden] = React.useState(false);\n React.useEffect(() => {\n const el = main.current;\n if (!el) return;\n let last = el.scrollTop;\n const onScroll = () => {\n const y = el.scrollTop;\n if (Math.abs(y - last) < 8) return;\n setHidden(y > last && y > 64);\n last = y;\n };\n el.addEventListener('scroll', onScroll, { passive: true });\n return () => el.removeEventListener('scroll', onScroll);\n }, []);\n\n React.useEffect(() => {\n ensureAnnouncer();\n }, []);\n return (\n <div className={cx('ui-shell', phone && 'is-phone', className)}>\n {/* First stop for the keyboard: skips the navigation. */}\n <a\n className=\"ui-skip\"\n href=\"#main\"\n onClick={(e) => {\n e.preventDefault();\n focusMain();\n }}\n >\n {tr('跳到主要內容')}\n </a>\n {phone || tablet ? null : pinned ? (\n <SideNav\n sections={nav}\n value={value}\n onChange={onNavigate}\n brand={brand}\n collapsed={collapsed}\n pinned\n onPin={togglePin}\n onToggle={() => {\n store(COLLAPSE_KEY, userCollapsed ? '0' : '1');\n setUserCollapsed(!userCollapsed);\n }}\n />\n ) : (\n // Not pinned: the strip keeps its 72 px in the layout; the sidebar inside opens over the content and closes\n // again when the pointer and the focus have left it, after a page is chosen, or on Esc.\n <div\n className={cx('ui-shell-rail', open && 'is-open')}\n onPointerEnter={(e) => e.pointerType === 'mouse' && later(true)}\n onPointerLeave={(e) => e.pointerType === 'mouse' && later(false)}\n onFocus={(e) => {\n if (!(e.target as Element).matches(':focus-visible')) return;\n clearTimeout(closeTimer.current);\n setOpen(true);\n }}\n onBlur={(e) => {\n if (!e.currentTarget.contains(e.relatedTarget as Node | null)) setOpen(false);\n }}\n onKeyDown={(e) => {\n if (e.key === 'Escape' && open) {\n e.stopPropagation();\n setOpen(false);\n }\n }}\n >\n <SideNav\n sections={nav}\n value={value}\n onChange={(id) => {\n clearTimeout(openTimer.current);\n setOpen(false);\n onNavigate(id);\n }}\n brand={brand}\n collapsed={collapsed}\n onPin={togglePin}\n />\n </div>\n )}\n <div className=\"ui-shell-body\">\n <TopBar\n className={cx('ui-shell-top', hidden && 'is-hidden')}\n title={title}\n breadcrumb={breadcrumb}\n onSearch={onSearch ?? false}\n onMenu={tablet ? () => setMoreOpen(true) : undefined}\n >\n {actions}\n </TopBar>\n <main ref={main} className=\"ui-shell-main\" tabIndex={-1}>\n {children}\n </main>\n {phone && tabs.length ? <MobileTabBar items={tabs} value={tabValue} onChange={onTab} labels={tabLabels} /> : null}\n {phone || tablet ? (\n <Drawer open={moreOpen} onClose={() => setMoreOpen(false)} title={tr('全部頁面')} side={tablet ? 'left' : 'right'} width={tablet ? 300 : undefined}>\n <SideNav\n className=\"ui-shell-allnav\"\n sections={nav}\n value={value}\n onChange={(id) => {\n setMoreOpen(false);\n onNavigate(id);\n }}\n />\n </Drawer>\n ) : null}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAwCA,MAAM,eAAe;AACrB,MAAM,UAAU;;AAEhB,MAAM,aAAa;;AAEnB,MAAM,cAAc;AAGpB,MAAM,OAAO;;;;AAKb,SAAgB,SAAS,EACvB,KACA,OACA,YACA,OACA,OACA,YACA,UACA,SACA,UACA,WACA,gBAAgB,OAChB,aACgB;CAChB,MAAM,QAAQ,UAAU;CAExB,MAAM,SAAS,SAAS,4CAA4C;CACpE,MAAM,CAAC,eAAe,oBAAoB,MAAM,eAAe,MAAM,YAAY,MAAM,GAAG;CAG1F,MAAM,CAAC,QAAQ,aAAa,MAAM,eAAe;EAC/C,MAAM,IAAI,MAAM,OAAO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MAAS,OAAO,SAAS,MAAM,KAAA;MACnI,UAAA,oBAAC,SAAD;OACE,WAAU;OACV,UAAU;OACH;OACP,WAAW,OAAO;QAChB,YAAY,KAAK;QACjB,WAAW,EAAE;OACf;MACD,CAAA;KACK,CAAA,IACN;IACD;;EACF;;AAET"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export type BadgeStatus = 'draft' | 'doing' | 'review' | 'done' | 'fail';
|
|
3
|
+
export interface BadgeProps {
|
|
4
|
+
status: BadgeStatus;
|
|
5
|
+
/** 'dot' on cards: a mark and colored text, no chip. Default 'chip'. */
|
|
6
|
+
variant?: 'chip' | 'dot';
|
|
7
|
+
/** Default: the status name (草稿, 進行中, 審核中, 完成, 失敗). */
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
/** Status of an item. The mark's shape carries the status too, so it never depends on color alone. */
|
|
12
|
+
export declare function Badge({ status, variant, children, className }: BadgeProps): React.JSX.Element;
|