@seanyeh77/ui 0.44.0 → 0.45.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/LICENSE +21 -0
- package/README.md +1 -1
- package/dist/bundle.js +20 -20
- package/dist/components/AccentPicker/AccentPicker.d.ts +1 -0
- package/dist/components/AccentPicker/AccentPicker.js +92 -72
- package/dist/components/AccentPicker/AccentPicker.js.map +1 -1
- package/dist/components/ActionBar/ActionBar.d.ts +2 -0
- package/dist/components/ActionBar/ActionBar.js.map +1 -1
- package/dist/components/AiMark/AiMark.d.ts +1 -0
- package/dist/components/AiMark/AiMark.js.map +1 -1
- package/dist/components/Alert/Alert.d.ts +5 -2
- package/dist/components/Alert/Alert.js +17 -14
- package/dist/components/Alert/Alert.js.map +1 -1
- package/dist/components/AppShell/AppShell.d.ts +10 -4
- package/dist/components/AppShell/AppShell.js +30 -19
- package/dist/components/AppShell/AppShell.js.map +1 -1
- package/dist/components/Badge/Badge.d.ts +24 -7
- package/dist/components/Badge/Badge.js +78 -21
- package/dist/components/Badge/Badge.js.map +1 -1
- package/dist/components/BarChart/BarChart.d.ts +14 -1
- package/dist/components/BarChart/BarChart.js +88 -59
- package/dist/components/BarChart/BarChart.js.map +1 -1
- package/dist/components/Breadcrumb/Breadcrumb.d.ts +1 -0
- package/dist/components/Breadcrumb/Breadcrumb.js.map +1 -1
- package/dist/components/Button/Button.d.ts +4 -1
- package/dist/components/Button/Button.js +17 -3
- package/dist/components/Button/Button.js.map +1 -1
- package/dist/components/Calendar/Calendar.d.ts +11 -2
- package/dist/components/Calendar/Calendar.js +16 -5
- package/dist/components/Calendar/Calendar.js.map +1 -1
- package/dist/components/Card/Card.d.ts +1 -0
- package/dist/components/Card/Card.js.map +1 -1
- package/dist/components/Checkbox/Checkbox.d.ts +24 -8
- package/dist/components/Checkbox/Checkbox.js +22 -9
- package/dist/components/Checkbox/Checkbox.js.map +1 -1
- package/dist/components/CodeView/CodeView.d.ts +3 -0
- package/dist/components/CodeView/CodeView.js +6 -6
- package/dist/components/CodeView/CodeView.js.map +1 -1
- package/dist/components/CommandPalette/CommandPalette.d.ts +16 -4
- package/dist/components/CommandPalette/CommandPalette.js +38 -11
- package/dist/components/CommandPalette/CommandPalette.js.map +1 -1
- package/dist/components/ConsoleLayout/ConsoleLayout.d.ts +2 -3
- package/dist/components/ConsoleLayout/ConsoleLayout.js +4 -1
- package/dist/components/ConsoleLayout/ConsoleLayout.js.map +1 -1
- package/dist/components/DangerZone/DangerZone.d.ts +2 -1
- package/dist/components/DangerZone/DangerZone.js +1 -1
- package/dist/components/DangerZone/DangerZone.js.map +1 -1
- package/dist/components/DataTable/DataTable.d.ts +8 -1
- package/dist/components/DataTable/DataTable.js +213 -167
- package/dist/components/DataTable/DataTable.js.map +1 -1
- package/dist/components/DataTable/SortButton.js +48 -5
- package/dist/components/DataTable/SortButton.js.map +1 -1
- package/dist/components/DataTable/filters.js +2 -1
- package/dist/components/DataTable/filters.js.map +1 -1
- package/dist/components/DataTable/parts.js +1 -1
- package/dist/components/DataTable/parts.js.map +1 -1
- package/dist/components/DataTable/types.d.ts +10 -3
- package/dist/components/DatePicker/DatePicker.d.ts +7 -5
- package/dist/components/DatePicker/DatePicker.js +16 -6
- package/dist/components/DatePicker/DatePicker.js.map +1 -1
- package/dist/components/DateRangePicker/DateRangePicker.d.ts +12 -7
- package/dist/components/DateRangePicker/DateRangePicker.js +81 -45
- package/dist/components/DateRangePicker/DateRangePicker.js.map +1 -1
- package/dist/components/DetailList/DetailList.d.ts +2 -0
- package/dist/components/DetailList/DetailList.js.map +1 -1
- package/dist/components/Dialog/Dialog.d.ts +56 -20
- package/dist/components/Dialog/Dialog.js +45 -14
- package/dist/components/Dialog/Dialog.js.map +1 -1
- package/dist/components/Drawer/Drawer.d.ts +17 -5
- package/dist/components/Drawer/Drawer.js +86 -24
- package/dist/components/Drawer/Drawer.js.map +1 -1
- package/dist/components/ErrorPage/ErrorPage.d.ts +3 -0
- package/dist/components/ErrorPage/ErrorPage.js.map +1 -1
- package/dist/components/EventTimeline/EventTimeline.d.ts +22 -4
- package/dist/components/EventTimeline/EventTimeline.js +63 -20
- package/dist/components/EventTimeline/EventTimeline.js.map +1 -1
- package/dist/components/FileUpload/FileUpload.d.ts +9 -1
- package/dist/components/FileUpload/FileUpload.js +3 -1
- package/dist/components/FileUpload/FileUpload.js.map +1 -1
- package/dist/components/FormGrid/FormGrid.d.ts +3 -1
- package/dist/components/FormGrid/FormGrid.js +5 -2
- package/dist/components/FormGrid/FormGrid.js.map +1 -1
- package/dist/components/Graph/Graph.d.ts +1 -0
- package/dist/components/Graph/Graph.js +8 -4
- package/dist/components/Graph/Graph.js.map +1 -1
- package/dist/components/Grid/Grid.d.ts +11 -4
- package/dist/components/Grid/Grid.js +14 -2
- package/dist/components/Grid/Grid.js.map +1 -1
- package/dist/components/IconButton/IconButton.d.ts +2 -1
- package/dist/components/IconButton/IconButton.js +10 -1
- package/dist/components/IconButton/IconButton.js.map +1 -1
- package/dist/components/InlineCode/InlineCode.d.ts +6 -0
- package/dist/components/InlineCode/InlineCode.js.map +1 -1
- package/dist/components/KpiCard/KpiCard.d.ts +5 -1
- package/dist/components/KpiCard/KpiCard.js +35 -21
- package/dist/components/KpiCard/KpiCard.js.map +1 -1
- package/dist/components/LayerGraph/LayerGraph.d.ts +68 -23
- package/dist/components/LayerGraph/LayerGraph.js +159 -88
- package/dist/components/LayerGraph/LayerGraph.js.map +1 -1
- package/dist/components/LineChart/LineChart.d.ts +10 -3
- package/dist/components/LineChart/LineChart.js +55 -23
- package/dist/components/LineChart/LineChart.js.map +1 -1
- package/dist/components/Link/Link.d.ts +17 -0
- package/dist/components/Link/Link.js +47 -0
- package/dist/components/Link/Link.js.map +1 -0
- package/dist/components/LoadingBar/LoadingBar.d.ts +1 -0
- package/dist/components/LoadingBar/LoadingBar.js.map +1 -1
- package/dist/components/LoginCard/LoginCard.d.ts +9 -3
- package/dist/components/LoginCard/LoginCard.js +99 -78
- package/dist/components/LoginCard/LoginCard.js.map +1 -1
- package/dist/components/Markdown/Markdown.d.ts +1 -0
- package/dist/components/Markdown/Markdown.js +1 -1
- package/dist/components/Markdown/Markdown.js.map +1 -1
- package/dist/components/Menu/Menu.d.ts +4 -2
- package/dist/components/Menu/Menu.js +43 -33
- package/dist/components/Menu/Menu.js.map +1 -1
- package/dist/components/Meter/Meter.d.ts +4 -0
- package/dist/components/Meter/Meter.js.map +1 -1
- package/dist/components/MobileTabBar/MobileTabBar.d.ts +3 -0
- package/dist/components/MobileTabBar/MobileTabBar.js.map +1 -1
- package/dist/components/MultiSelect/MultiSelect.d.ts +7 -6
- package/dist/components/MultiSelect/MultiSelect.js +27 -9
- package/dist/components/MultiSelect/MultiSelect.js.map +1 -1
- package/dist/components/NotificationBell/NotificationBell.d.ts +3 -0
- package/dist/components/NotificationBell/NotificationBell.js +2 -2
- package/dist/components/NotificationBell/NotificationBell.js.map +1 -1
- package/dist/components/PageHeader/PageHeader.d.ts +34 -0
- package/dist/components/PageHeader/PageHeader.js +68 -0
- package/dist/components/PageHeader/PageHeader.js.map +1 -0
- package/dist/components/Popover/Popover.d.ts +11 -4
- package/dist/components/Popover/Popover.js +17 -7
- package/dist/components/Popover/Popover.js.map +1 -1
- package/dist/components/ProgressBar/ProgressBar.d.ts +2 -0
- package/dist/components/ProgressBar/ProgressBar.js.map +1 -1
- package/dist/components/ProgressRing/ProgressRing.d.ts +1 -0
- package/dist/components/ProgressRing/ProgressRing.js.map +1 -1
- package/dist/components/ProjectSwitcher/ProjectSwitcher.d.ts +5 -1
- package/dist/components/ProjectSwitcher/ProjectSwitcher.js +16 -3
- package/dist/components/ProjectSwitcher/ProjectSwitcher.js.map +1 -1
- package/dist/components/RadioGroup/RadioGroup.d.ts +22 -5
- package/dist/components/RadioGroup/RadioGroup.js +48 -47
- package/dist/components/RadioGroup/RadioGroup.js.map +1 -1
- package/dist/components/RelativeTime/RelativeTime.d.ts +10 -0
- package/dist/components/RelativeTime/RelativeTime.js +44 -0
- package/dist/components/RelativeTime/RelativeTime.js.map +1 -0
- package/dist/components/SearchField/SearchField.d.ts +2 -0
- package/dist/components/SearchField/SearchField.js.map +1 -1
- package/dist/components/Section/Section.d.ts +4 -0
- package/dist/components/Section/Section.js +8 -22
- package/dist/components/Section/Section.js.map +1 -1
- package/dist/components/SegmentedControl/SegmentedControl.d.ts +22 -9
- package/dist/components/SegmentedControl/SegmentedControl.js +20 -19
- package/dist/components/SegmentedControl/SegmentedControl.js.map +1 -1
- package/dist/components/Select/Select.d.ts +7 -11
- package/dist/components/Select/Select.js +7 -3
- package/dist/components/Select/Select.js.map +1 -1
- package/dist/components/SettingsLayout/SettingsLayout.d.ts +32 -3
- package/dist/components/SettingsLayout/SettingsLayout.js +60 -13
- package/dist/components/SettingsLayout/SettingsLayout.js.map +1 -1
- package/dist/components/SideNav/SideNav.d.ts +2 -0
- package/dist/components/SideNav/SideNav.js +3 -3
- package/dist/components/SideNav/SideNav.js.map +1 -1
- package/dist/components/SplitPane/SplitPane.d.ts +1 -0
- package/dist/components/SplitPane/SplitPane.js.map +1 -1
- package/dist/components/StatusBand/StatusBand.d.ts +1 -0
- package/dist/components/StatusBand/StatusBand.js.map +1 -1
- package/dist/components/Suggestion/Suggestion.d.ts +6 -0
- package/dist/components/Suggestion/Suggestion.js.map +1 -1
- package/dist/components/Switch/Switch.d.ts +13 -3
- package/dist/components/Switch/Switch.js +16 -7
- package/dist/components/Switch/Switch.js.map +1 -1
- package/dist/components/Tabs/Tabs.d.ts +4 -0
- package/dist/components/Tabs/Tabs.js +1 -1
- package/dist/components/Tabs/Tabs.js.map +1 -1
- package/dist/components/Tag/Tag.d.ts +15 -7
- package/dist/components/Tag/Tag.js +22 -10
- package/dist/components/Tag/Tag.js.map +1 -1
- package/dist/components/Term/Term.d.ts +8 -3
- package/dist/components/Term/Term.js +1 -1
- package/dist/components/Term/Term.js.map +1 -1
- package/dist/components/TextArea/TextArea.d.ts +6 -10
- package/dist/components/TextArea/TextArea.js +22 -10
- package/dist/components/TextArea/TextArea.js.map +1 -1
- package/dist/components/TextField/TextField.d.ts +8 -11
- package/dist/components/TextField/TextField.js +9 -7
- package/dist/components/TextField/TextField.js.map +1 -1
- package/dist/components/ThemePicker/ThemePicker.d.ts +1 -0
- package/dist/components/ThemePicker/ThemePicker.js +35 -34
- package/dist/components/ThemePicker/ThemePicker.js.map +1 -1
- package/dist/components/TimeControl/TimeControl.d.ts +1 -0
- package/dist/components/TimeControl/TimeControl.js.map +1 -1
- package/dist/components/Toast/Toast.d.ts +55 -2
- package/dist/components/Toast/Toast.js +190 -8
- package/dist/components/Toast/Toast.js.map +1 -1
- package/dist/components/TopBar/TopBar.d.ts +6 -2
- package/dist/components/TopBar/TopBar.js +7 -1
- package/dist/components/TopBar/TopBar.js.map +1 -1
- package/dist/components/Tour/Tour.d.ts +14 -3
- package/dist/components/Tour/Tour.js +26 -14
- package/dist/components/Tour/Tour.js.map +1 -1
- package/dist/components/TreeList/TreeList.d.ts +28 -4
- package/dist/components/TreeList/TreeList.js +32 -20
- package/dist/components/TreeList/TreeList.js.map +1 -1
- package/dist/components/Workbench/Workbench.d.ts +1 -0
- package/dist/components/Workbench/Workbench.js +24 -12
- package/dist/components/Workbench/Workbench.js.map +1 -1
- package/dist/components/ZoneMap/ZoneMap.d.ts +12 -2
- package/dist/components/ZoneMap/ZoneMap.js +13 -5
- package/dist/components/ZoneMap/ZoneMap.js.map +1 -1
- package/dist/components/useFormErrors/useFormErrors.d.ts +20 -0
- package/dist/components/useFormErrors/useFormErrors.js +55 -0
- package/dist/components/useFormErrors/useFormErrors.js.map +1 -0
- package/dist/css/AccentPicker.css +1 -0
- package/dist/css/Alert.css +7 -19
- package/dist/css/AppShell.css +1 -0
- package/dist/css/Badge.css +19 -45
- package/dist/css/BarChart.css +21 -3
- package/dist/css/Button.css +5 -1
- package/dist/css/Card.css +8 -8
- package/dist/css/Checkbox.css +19 -0
- package/dist/css/CodeView.css +2 -1
- package/dist/css/DangerZone.css +4 -3
- package/dist/css/DataTable.css +129 -34
- package/dist/css/DateRangePicker.css +23 -2
- package/dist/css/Drawer.css +30 -0
- package/dist/css/ErrorPage.css +3 -1
- package/dist/css/EventTimeline.css +33 -5
- package/dist/css/FormGrid.css +12 -3
- package/dist/css/Graph.css +9 -1
- package/dist/css/Grid.css +8 -0
- package/dist/css/KpiCard.css +12 -1
- package/dist/css/LayerGraph.css +40 -15
- package/dist/css/Link.css +23 -0
- package/dist/css/LoginCard.css +16 -11
- package/dist/css/Markdown.css +2 -1
- package/dist/css/Menu.css +0 -2
- package/dist/css/Meter.css +16 -0
- package/dist/css/PageHeader.css +50 -0
- package/dist/css/ProgressBar.css +12 -0
- package/dist/css/ProjectSwitcher.css +23 -26
- package/dist/css/RelativeTime.css +2 -0
- package/dist/css/SegmentedControl.css +38 -10
- package/dist/css/SettingsLayout.css +28 -8
- package/dist/css/SideNav.css +4 -1
- package/dist/css/Skeleton.css +22 -1
- package/dist/css/Switch.css +27 -0
- package/dist/css/Tabs.css +2 -1
- package/dist/css/Tag.css +19 -12
- package/dist/css/Toast.css +100 -4
- package/dist/css/TopBar.css +21 -2
- package/dist/css/TreeList.css +6 -3
- package/dist/css/Workbench.css +1 -1
- package/dist/css/ZoneMap.css +0 -1
- package/dist/css/base.css +45 -0
- package/dist/css/end.css +119 -5
- package/dist/deprecated.d.ts +3 -0
- package/dist/deprecated.js +13 -0
- package/dist/deprecated.js.map +1 -0
- package/dist/fonts.css +2 -7543
- package/dist/format.d.ts +3 -1
- package/dist/format.js +12 -4
- package/dist/format.js.map +1 -1
- package/dist/generated/themeDefaults.d.ts +8 -0
- package/dist/generated/themeDefaults.js +35 -0
- package/dist/generated/themeDefaults.js.map +1 -0
- package/dist/i18n.d.ts +7 -2
- package/dist/i18n.js +65 -10
- package/dist/i18n.js.map +1 -1
- package/dist/icons/Icon.d.ts +3 -1
- package/dist/icons/Icon.js.map +1 -1
- package/dist/index.d.ts +23 -14
- package/dist/index.js +14 -8
- package/dist/internal/Field.d.ts +19 -0
- package/dist/internal/Field.js +10 -4
- package/dist/internal/Field.js.map +1 -1
- package/dist/internal/FloatingPanel.js +2 -1
- package/dist/internal/FloatingPanel.js.map +1 -1
- package/dist/internal/chart.d.ts +4 -0
- package/dist/internal/chart.js +89 -19
- package/dist/internal/chart.js.map +1 -1
- package/dist/internal/dev.js +9 -4
- package/dist/internal/dev.js.map +1 -1
- package/dist/internal/focus.js +27 -3
- package/dist/internal/focus.js.map +1 -1
- package/dist/internal/focusMain.js +6 -2
- package/dist/internal/focusMain.js.map +1 -1
- package/dist/internal/open.d.ts +14 -0
- package/dist/internal/open.js +28 -0
- package/dist/internal/open.js.map +1 -0
- package/dist/internal/roving.js +37 -0
- package/dist/internal/roving.js.map +1 -0
- package/dist/internal/shell.js +12 -0
- package/dist/internal/shell.js.map +1 -0
- package/dist/internal/stored.js +89 -0
- package/dist/internal/stored.js.map +1 -0
- package/dist/internal/tableTools.js +46 -4
- package/dist/internal/tableTools.js.map +1 -1
- package/dist/internal/util.js +8 -17
- package/dist/internal/util.js.map +1 -1
- package/dist/locale.d.ts +17 -0
- package/dist/locale.js +29 -0
- package/dist/locale.js.map +1 -0
- package/dist/styles.css +944 -231
- package/dist/theme.d.ts +23 -5
- package/dist/theme.js +85 -25
- package/dist/theme.js.map +1 -1
- package/dist/tokens.css +3 -0
- package/docs/AccentPicker.md +3 -1
- package/docs/Alert.md +4 -4
- package/docs/AppShell.md +11 -10
- package/docs/Badge.md +26 -16
- package/docs/BarChart.md +7 -4
- package/docs/Button.md +4 -5
- package/docs/Calendar.md +2 -2
- package/docs/Card.md +8 -7
- package/docs/Checkbox.md +4 -1
- package/docs/CodeView.md +30 -43
- package/docs/CommandPalette.md +3 -2
- package/docs/ConsoleLayout.md +5 -5
- package/docs/DangerZone.md +3 -3
- package/docs/DataColors.md +2 -2
- package/docs/DataTable.md +26 -148
- package/docs/DatePicker.md +1 -1
- package/docs/DateRangePicker.md +3 -0
- package/docs/DetailList.md +9 -9
- package/docs/Dialog.md +8 -5
- package/docs/Drawer.md +7 -5
- package/docs/EmptyState.md +0 -1
- package/docs/ErrorPage.md +1 -2
- package/docs/EventTimeline.md +23 -13
- package/docs/FileUpload.md +1 -2
- package/docs/FormGrid.md +2 -1
- package/docs/Format.md +4 -2
- package/docs/Graph.md +1 -1
- package/docs/Grid.md +5 -1
- package/docs/KpiCard.md +6 -5
- package/docs/LayerGraph.md +18 -53
- package/docs/LineChart.md +5 -3
- package/docs/Link.md +22 -0
- package/docs/LoginCard.md +7 -4
- package/docs/Markdown.md +2 -15
- package/docs/Menu.md +2 -0
- package/docs/Meter.md +1 -0
- package/docs/MultiSelect.md +2 -2
- package/docs/NotificationBell.md +1 -1
- package/docs/PageHeader.md +34 -0
- package/docs/Popover.md +3 -1
- package/docs/ProgressBar.md +3 -1
- package/docs/ProjectSwitcher.md +14 -14
- package/docs/RadioGroup.md +2 -0
- package/docs/RelativeTime.md +23 -0
- package/docs/Section.md +1 -1
- package/docs/SegmentedControl.md +9 -6
- package/docs/Select.md +2 -2
- package/docs/SettingsLayout.md +19 -5
- package/docs/SideNav.md +1 -1
- package/docs/Skeleton.md +2 -1
- package/docs/Switch.md +3 -1
- package/docs/Tabs.md +2 -1
- package/docs/Tag.md +9 -7
- package/docs/Term.md +3 -4
- package/docs/TextArea.md +2 -2
- package/docs/TextField.md +5 -4
- package/docs/ThemePicker.md +3 -1
- package/docs/Toast.md +17 -6
- package/docs/TopBar.md +8 -5
- package/docs/Tour.md +3 -2
- package/docs/TreeList.md +10 -37
- package/docs/Workbench.md +1 -48
- package/docs/ZoneMap.md +5 -5
- package/docs/agents.md +82 -0
- package/docs/code.md +2 -2
- package/docs/components.json +314 -0
- package/docs/data.md +9 -19
- package/docs/forms.md +6 -5
- package/docs/guidelines.md +39 -31
- package/docs/icons.md +9 -0
- package/docs/layout.md +16 -20
- package/docs/motion.md +31 -56
- package/docs/theme.md +15 -18
- package/docs/useFormErrors.md +35 -0
- package/package.json +8 -7
- package/dist/bundle.js.map +0 -1
- package/dist/fonts/LICENSE-OFL.txt +0 -93
- package/dist/fonts/geist-mono-cyrillic-400-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-cyrillic-500-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-cyrillic-600-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-cyrillic-700-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-cyrillic-ext-400-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-cyrillic-ext-500-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-cyrillic-ext-600-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-cyrillic-ext-700-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-latin-400-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-latin-500-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-latin-600-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-latin-700-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-latin-ext-400-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-latin-ext-500-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-latin-ext-600-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-latin-ext-700-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-symbols2-400-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-symbols2-500-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-symbols2-600-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-symbols2-700-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-vietnamese-400-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-vietnamese-500-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-vietnamese-600-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-vietnamese-700-normal.woff2 +0 -0
- package/dist/fonts/inter-cyrillic-400-normal.woff2 +0 -0
- package/dist/fonts/inter-cyrillic-500-normal.woff2 +0 -0
- package/dist/fonts/inter-cyrillic-600-normal.woff2 +0 -0
- package/dist/fonts/inter-cyrillic-700-normal.woff2 +0 -0
- package/dist/fonts/inter-cyrillic-ext-400-normal.woff2 +0 -0
- package/dist/fonts/inter-cyrillic-ext-500-normal.woff2 +0 -0
- package/dist/fonts/inter-cyrillic-ext-600-normal.woff2 +0 -0
- package/dist/fonts/inter-cyrillic-ext-700-normal.woff2 +0 -0
- package/dist/fonts/inter-greek-400-normal.woff2 +0 -0
- package/dist/fonts/inter-greek-500-normal.woff2 +0 -0
- package/dist/fonts/inter-greek-600-normal.woff2 +0 -0
- package/dist/fonts/inter-greek-700-normal.woff2 +0 -0
- package/dist/fonts/inter-greek-ext-400-normal.woff2 +0 -0
- package/dist/fonts/inter-greek-ext-500-normal.woff2 +0 -0
- package/dist/fonts/inter-greek-ext-600-normal.woff2 +0 -0
- package/dist/fonts/inter-greek-ext-700-normal.woff2 +0 -0
- package/dist/fonts/inter-latin-400-normal.woff2 +0 -0
- package/dist/fonts/inter-latin-500-normal.woff2 +0 -0
- package/dist/fonts/inter-latin-600-normal.woff2 +0 -0
- package/dist/fonts/inter-latin-700-normal.woff2 +0 -0
- package/dist/fonts/inter-latin-ext-400-normal.woff2 +0 -0
- package/dist/fonts/inter-latin-ext-500-normal.woff2 +0 -0
- package/dist/fonts/inter-latin-ext-600-normal.woff2 +0 -0
- package/dist/fonts/inter-latin-ext-700-normal.woff2 +0 -0
- package/dist/fonts/inter-vietnamese-400-normal.woff2 +0 -0
- package/dist/fonts/inter-vietnamese-500-normal.woff2 +0 -0
- package/dist/fonts/inter-vietnamese-600-normal.woff2 +0 -0
- package/dist/fonts/inter-vietnamese-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-0-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-0-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-0-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-0-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-1-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-1-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-1-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-1-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-10-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-10-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-10-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-10-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-101-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-101-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-101-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-101-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-102-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-102-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-102-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-102-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-103-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-103-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-103-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-103-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-104-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-104-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-104-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-104-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-105-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-105-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-105-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-105-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-106-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-106-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-106-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-106-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-107-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-107-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-107-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-107-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-108-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-108-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-108-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-108-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-109-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-109-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-109-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-109-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-11-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-11-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-11-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-11-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-110-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-110-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-110-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-110-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-111-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-111-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-111-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-111-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-112-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-112-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-112-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-112-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-113-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-113-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-113-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-113-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-114-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-114-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-114-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-114-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-115-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-115-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-115-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-115-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-116-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-116-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-116-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-116-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-117-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-117-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-117-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-117-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-118-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-118-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-118-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-118-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-119-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-119-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-119-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-119-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-12-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-12-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-12-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-12-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-120-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-120-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-120-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-120-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-121-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-121-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-121-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-121-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-122-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-122-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-122-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-122-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-123-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-123-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-123-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-123-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-2-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-2-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-2-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-2-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-23-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-23-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-23-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-23-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-24-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-24-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-24-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-24-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-25-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-25-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-25-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-25-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-26-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-26-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-26-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-26-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-27-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-27-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-27-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-27-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-28-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-28-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-28-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-28-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-29-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-29-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-29-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-29-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-30-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-30-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-30-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-30-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-31-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-31-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-31-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-31-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-32-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-32-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-32-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-32-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-33-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-33-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-33-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-33-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-34-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-34-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-34-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-34-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-35-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-35-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-35-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-35-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-36-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-36-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-36-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-36-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-37-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-37-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-37-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-37-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-38-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-38-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-38-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-38-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-39-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-39-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-39-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-39-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-4-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-4-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-4-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-4-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-40-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-40-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-40-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-40-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-41-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-41-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-41-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-41-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-42-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-42-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-42-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-42-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-43-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-43-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-43-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-43-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-44-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-44-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-44-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-44-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-45-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-45-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-45-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-45-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-46-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-46-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-46-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-46-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-47-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-47-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-47-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-47-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-48-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-48-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-48-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-48-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-49-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-49-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-49-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-49-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-50-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-50-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-50-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-50-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-51-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-51-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-51-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-51-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-52-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-52-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-52-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-52-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-53-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-53-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-53-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-53-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-54-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-54-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-54-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-54-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-55-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-55-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-55-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-55-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-56-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-56-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-56-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-56-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-57-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-57-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-57-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-57-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-58-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-58-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-58-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-58-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-59-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-59-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-59-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-59-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-60-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-60-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-60-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-60-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-61-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-61-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-61-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-61-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-62-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-62-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-62-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-62-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-63-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-63-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-63-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-63-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-64-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-64-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-64-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-64-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-65-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-65-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-65-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-65-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-66-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-66-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-66-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-66-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-67-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-67-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-67-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-67-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-68-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-68-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-68-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-68-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-69-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-69-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-69-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-69-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-70-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-70-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-70-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-70-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-71-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-71-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-71-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-71-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-72-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-72-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-72-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-72-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-73-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-73-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-73-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-73-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-74-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-74-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-74-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-74-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-75-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-75-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-75-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-75-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-76-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-76-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-76-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-76-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-77-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-77-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-77-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-77-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-78-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-78-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-78-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-78-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-79-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-79-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-79-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-79-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-80-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-80-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-80-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-80-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-81-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-81-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-81-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-81-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-82-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-82-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-82-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-82-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-83-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-83-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-83-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-83-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-84-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-84-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-84-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-84-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-85-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-85-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-85-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-85-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-86-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-86-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-86-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-86-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-87-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-87-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-87-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-87-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-88-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-88-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-88-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-88-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-89-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-89-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-89-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-89-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-90-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-90-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-90-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-90-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-91-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-91-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-91-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-91-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-92-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-92-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-92-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-92-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-93-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-93-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-93-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-93-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-94-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-94-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-94-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-94-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-95-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-95-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-95-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-95-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-96-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-96-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-96-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-96-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-cyrillic-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-cyrillic-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-cyrillic-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-cyrillic-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-latin-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-latin-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-latin-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-latin-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-latin-ext-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-latin-ext-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-latin-ext-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-latin-ext-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-vietnamese-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-vietnamese-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-vietnamese-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-vietnamese-700-normal.woff2 +0 -0
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { IconSource } from "../../icons/Icon.js";
|
|
2
|
+
import { OpenChangeReason } from "../../internal/open.js";
|
|
2
3
|
import * as React from "react";
|
|
3
4
|
export interface PaletteItem {
|
|
4
5
|
id?: string | number;
|
|
5
6
|
label: string;
|
|
6
7
|
/** Under the label; `backticks` are code. */
|
|
7
8
|
detail?: string;
|
|
8
|
-
/** What it is:
|
|
9
|
-
|
|
9
|
+
/** What it is: 'page', 'setting', 'command', 'file' (icon and name built in, the name read in the current language), or
|
|
10
|
+
* your own kinds (with `kinds`), shown as written. Picks the icon. */
|
|
11
|
+
kind?: PaletteKind | (string & {});
|
|
10
12
|
/** Overrides the kind's icon. */
|
|
11
13
|
icon?: IconSource;
|
|
12
14
|
/** The label is code: Geist Mono. */
|
|
@@ -14,10 +16,18 @@ export interface PaletteItem {
|
|
|
14
16
|
/** More words that find it. */
|
|
15
17
|
keywords?: string[];
|
|
16
18
|
}
|
|
19
|
+
/** The built-in kinds: a stable id, its icon and its name (through tr()). */
|
|
20
|
+
export type PaletteKind = 'page' | 'setting' | 'command' | 'file';
|
|
17
21
|
export interface CommandPaletteProps<T extends PaletteItem = PaletteItem> {
|
|
18
|
-
|
|
19
|
-
|
|
22
|
+
/** Controlled: shown while true. Leave it out to let the palette keep its own state (Ctrl K still opens it). */
|
|
23
|
+
open?: boolean;
|
|
24
|
+
/** Uncontrolled: whether it starts open. */
|
|
25
|
+
defaultOpen?: boolean;
|
|
26
|
+
/** Called with the new state and why: 'hotkey' (Ctrl K), 'select' (a result was chosen), 'escape', 'outside'. */
|
|
27
|
+
onOpenChange?: (open: boolean, reason?: OpenChangeReason) => void;
|
|
28
|
+
/** Every item that can be found. */
|
|
20
29
|
items: T[];
|
|
30
|
+
/** Called with the item the person opens (Enter or a press). */
|
|
21
31
|
onSelect?: (item: T) => void;
|
|
22
32
|
/** Default 「搜尋」. */
|
|
23
33
|
placeholder?: string;
|
|
@@ -34,6 +44,7 @@ export interface CommandPaletteProps<T extends PaletteItem = PaletteItem> {
|
|
|
34
44
|
kinds?: Record<string, IconSource>;
|
|
35
45
|
/** false: items are already filtered (server search with onQueryChange). */
|
|
36
46
|
filter?: boolean;
|
|
47
|
+
/** Called on every change of the search text, for results the app fetches itself. */
|
|
37
48
|
onQueryChange?: (query: string) => void;
|
|
38
49
|
/** Shows 「搜尋中」 when there are no items yet. */
|
|
39
50
|
loading?: boolean;
|
|
@@ -44,6 +55,7 @@ export interface CommandPaletteProps<T extends PaletteItem = PaletteItem> {
|
|
|
44
55
|
limit?: number;
|
|
45
56
|
/** Ctrl K / ⌘K toggles it. Default true. */
|
|
46
57
|
hotkey?: boolean;
|
|
58
|
+
/** The search text when the palette opens. */
|
|
47
59
|
defaultQuery?: string;
|
|
48
60
|
/** Default 「搜尋」. */
|
|
49
61
|
label?: string;
|
|
@@ -5,6 +5,8 @@ import { CodeText } from "../InlineCode/InlineCode.js";
|
|
|
5
5
|
import { tr } from "../../i18n.js";
|
|
6
6
|
import { Icon, IconOf } from "../../icons/Icon.js";
|
|
7
7
|
import { cx } from "../../internal/util.js";
|
|
8
|
+
import { devWarn } from "../../internal/dev.js";
|
|
9
|
+
import { baseReason, useOpenState } from "../../internal/open.js";
|
|
8
10
|
import { includeIcons } from "../../icons/store.js";
|
|
9
11
|
import command_default from "../../icons/ph/command.js";
|
|
10
12
|
import file_default from "../../icons/ph/file.js";
|
|
@@ -17,12 +19,31 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
17
19
|
import { Dialog } from "@base-ui/react/dialog";
|
|
18
20
|
// src/components/CommandPalette/CommandPalette.tsx
|
|
19
21
|
includeIcons(command_default, file_default, file_code_default, file_text_default, gear_default, magnifying_glass_default);
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
const KINDS = {
|
|
23
|
+
page: ["file-text", "頁面"],
|
|
24
|
+
setting: ["gear", "設定"],
|
|
25
|
+
command: ["command", "指令"],
|
|
26
|
+
file: ["file-code", "檔案"]
|
|
27
|
+
};
|
|
28
|
+
const OLD_KINDS = {
|
|
29
|
+
頁面: "page",
|
|
30
|
+
設定: "setting",
|
|
23
31
|
指令: "command",
|
|
24
|
-
檔案: "file
|
|
32
|
+
檔案: "file"
|
|
25
33
|
};
|
|
34
|
+
/** A kind's icon and the name shown and read for it: your kinds as written, the built-in ones translated. */
|
|
35
|
+
function kindOf(kind, kinds) {
|
|
36
|
+
if (kinds?.[kind]) return {
|
|
37
|
+
icon: kinds[kind],
|
|
38
|
+
name: kind
|
|
39
|
+
};
|
|
40
|
+
const id = Object.hasOwn(KINDS, kind) ? kind : OLD_KINDS[kind];
|
|
41
|
+
devWarn(!!OLD_KINDS[kind], "CommandPalette", `kind '${kind}' is the old Chinese name of a built-in kind, which cannot be translated. Pass kind: '${OLD_KINDS[kind]}' instead.`);
|
|
42
|
+
return id ? {
|
|
43
|
+
icon: KINDS[id][0],
|
|
44
|
+
name: tr(KINDS[id][1])
|
|
45
|
+
} : { name: kind };
|
|
46
|
+
}
|
|
26
47
|
/** The score of an item for a query: label starts with it, label contains it, other text contains it; null: no match. */
|
|
27
48
|
function score(it, q) {
|
|
28
49
|
const i = it.label.toLowerCase().indexOf(q);
|
|
@@ -31,12 +52,18 @@ function score(it, q) {
|
|
|
31
52
|
return [
|
|
32
53
|
it.detail,
|
|
33
54
|
it.kind,
|
|
55
|
+
it.kind && kindOf(it.kind, void 0).name,
|
|
34
56
|
...it.keywords ?? []
|
|
35
57
|
].join(" ").toLowerCase().includes(q) ? [2, -1] : null;
|
|
36
58
|
}
|
|
37
59
|
/** One search for everything, opened with Ctrl K (⌘K). A panel in the middle of the screen; results sorted by relevance. */
|
|
38
60
|
function CommandPalette(props) {
|
|
39
|
-
const { open, onOpenChange, items, onSelect, placeholder, recent, recentLabel, emptyText, noResultsText, kinds, filter = true, onQueryChange, loading, total, limit = 50, hotkey = true, defaultQuery = "", label } = props;
|
|
61
|
+
const { open: openProp, defaultOpen, onOpenChange: reportOpen, items, onSelect, placeholder, recent, recentLabel, emptyText, noResultsText, kinds, filter = true, onQueryChange, loading, total, limit = 50, hotkey = true, defaultQuery = "", label } = props;
|
|
62
|
+
const [open, onOpenChange] = useOpenState({
|
|
63
|
+
open: openProp,
|
|
64
|
+
defaultOpen,
|
|
65
|
+
onOpenChange: reportOpen
|
|
66
|
+
});
|
|
40
67
|
const [q, setQ] = React.useState(defaultQuery);
|
|
41
68
|
const [active, setActive] = React.useState(0);
|
|
42
69
|
useReturnFocus(open);
|
|
@@ -64,7 +91,7 @@ function CommandPalette(props) {
|
|
|
64
91
|
const key = (e) => {
|
|
65
92
|
if ((e.ctrlKey || e.metaKey) && !e.altKey && !e.shiftKey && e.key.toLowerCase() === "k") {
|
|
66
93
|
e.preventDefault();
|
|
67
|
-
toggle.current(!open);
|
|
94
|
+
toggle.current(!open, "hotkey");
|
|
68
95
|
}
|
|
69
96
|
};
|
|
70
97
|
document.addEventListener("keydown", key);
|
|
@@ -91,7 +118,7 @@ function CommandPalette(props) {
|
|
|
91
118
|
list.current?.querySelector(".is-active")?.scrollIntoView?.({ block: "nearest" });
|
|
92
119
|
}, [act, open]);
|
|
93
120
|
const pick = (it) => {
|
|
94
|
-
onOpenChange(false);
|
|
121
|
+
onOpenChange(false, "select");
|
|
95
122
|
onSelect?.(it);
|
|
96
123
|
};
|
|
97
124
|
const onKey = (e) => {
|
|
@@ -138,7 +165,7 @@ function CommandPalette(props) {
|
|
|
138
165
|
]);
|
|
139
166
|
return /* @__PURE__ */ jsx(Dialog.Root, {
|
|
140
167
|
open,
|
|
141
|
-
onOpenChange,
|
|
168
|
+
onOpenChange: (next, details) => onOpenChange(next, baseReason(details?.reason)),
|
|
142
169
|
children: /* @__PURE__ */ jsxs(Dialog.Portal, { children: [/* @__PURE__ */ jsx(Dialog.Backdrop, { className: "ui-pal-backdrop" }), /* @__PURE__ */ jsxs(Dialog.Popup, {
|
|
143
170
|
className: "ui-pal",
|
|
144
171
|
"aria-label": label || tr("搜尋"),
|
|
@@ -196,9 +223,9 @@ function CommandPalette(props) {
|
|
|
196
223
|
onClick: () => pick(it),
|
|
197
224
|
children: [/* @__PURE__ */ jsx("span", {
|
|
198
225
|
className: "ui-pal-kind",
|
|
199
|
-
title: it.kind,
|
|
226
|
+
title: it.kind ? kindOf(it.kind, kinds).name : void 0,
|
|
200
227
|
children: /* @__PURE__ */ jsx(IconOf, {
|
|
201
|
-
icon: it.icon ?? (it.kind ?
|
|
228
|
+
icon: it.icon ?? (it.kind ? kindOf(it.kind, kinds).icon : void 0) ?? "file",
|
|
202
229
|
size: 16
|
|
203
230
|
})
|
|
204
231
|
}), /* @__PURE__ */ jsxs("span", {
|
|
@@ -207,7 +234,7 @@ function CommandPalette(props) {
|
|
|
207
234
|
className: "ui-pal-line",
|
|
208
235
|
children: [it.kind ? /* @__PURE__ */ jsx("span", {
|
|
209
236
|
className: "ui-visually-hidden",
|
|
210
|
-
children: it.kind + " "
|
|
237
|
+
children: kindOf(it.kind, kinds).name + " "
|
|
211
238
|
}) : null, labelOf(it, at)]
|
|
212
239
|
}), it.detail ? /* @__PURE__ */ jsx(CodeText, {
|
|
213
240
|
className: "ui-pal-detail",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommandPalette.js","names":["phCommand","phFile","phFileCode","phFileText","phGear","phMagnifyingGlass"],"sources":["../../../src/components/CommandPalette/CommandPalette.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useReturnFocus } from '../../internal/focus';\nimport { announce } from '../../announce';\nimport { Dialog } from '@base-ui/react/dialog';\nimport { CodeText } from '../InlineCode/InlineCode';\nimport { tr } from '../../i18n';\nimport { Icon, IconOf, type IconSource } from '../../icons/Icon';\nimport { cx } from '../../internal/util';\nimport { includeIcons } from '../../icons/store';\nimport phCommand from '../../icons/ph/command';\nimport phFile from '../../icons/ph/file';\nimport phFileCode from '../../icons/ph/file-code';\nimport phFileText from '../../icons/ph/file-text';\nimport phGear from '../../icons/ph/gear';\nimport phMagnifyingGlass from '../../icons/ph/magnifying-glass';\n\nincludeIcons(phCommand, phFile, phFileCode, phFileText, phGear, phMagnifyingGlass);\n\nexport interface PaletteItem {\n id?: string | number;\n label: string;\n /** Under the label; `backticks` are code. */\n detail?: string;\n /** What it is: 頁面, 設定, 指令, 檔案, or your own kinds (with `kinds`). Picks the icon. */\n kind?: string;\n /** Overrides the kind's icon. */\n icon?: IconSource;\n /** The label is code: Geist Mono. */\n code?: boolean;\n /** More words that find it. */\n keywords?: string[];\n}\n\nconst KIND_ICONS: Record<string, IconSource> = { 頁面: 'file-text', 設定: 'gear', 指令: 'command', 檔案: 'file-code' };\n\nexport interface CommandPaletteProps<T extends PaletteItem = PaletteItem> {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n items: T[];\n onSelect?: (item: T) => void;\n /** Default 「搜尋」. */\n placeholder?: string;\n /** Shown before anything is typed. */\n recent?: T[];\n /** Default 「最近開啟」. */\n recentLabel?: string;\n /** Shown with nothing typed and no recent items. Default 「輸入名稱開始搜尋」. */\n emptyText?: string;\n /** Shown and read out when the typed text finds nothing, e.g. what else to try. `{q}` is the typed text; a function\n * gets it. Default 「找不到符合「{q}」的結果」. Not an item, so it is never counted as a result. */\n noResultsText?: string | ((query: string) => string);\n /** Icon for each of your own kinds: { 函式: 'brackets-curly' }. */\n kinds?: Record<string, IconSource>;\n /** false: items are already filtered (server search with onQueryChange). */\n filter?: boolean;\n onQueryChange?: (query: string) => void;\n /** Shows 「搜尋中」 when there are no items yet. */\n loading?: boolean;\n /** How many matched before you cut the list down to items (RA): the line under the results then says how many\n * more there are, e.g. 「顯示 30 筆,另有 17 筆,請輸入更長的字」. Without it the line says 「共 30 筆」. */\n total?: number;\n /** Most results shown. Default 50. */\n limit?: number;\n /** Ctrl K / ⌘K toggles it. Default true. */\n hotkey?: boolean;\n defaultQuery?: string;\n /** Default 「搜尋」. */\n label?: string;\n}\n\n/** The score of an item for a query: label starts with it, label contains it, other text contains it; null: no match. */\nfunction score(it: PaletteItem, q: string): [rank: number, at: number] | null {\n const i = it.label.toLowerCase().indexOf(q);\n if (i === 0) return [0, 0];\n if (i > 0) return [1, i];\n const more = [it.detail, it.kind, ...(it.keywords ?? [])].join(' ').toLowerCase();\n return more.includes(q) ? [2, -1] : null;\n}\n\n/** One search for everything, opened with Ctrl K (⌘K). A panel in the middle of the screen; results sorted by relevance. */\nexport function CommandPalette<T extends PaletteItem = PaletteItem>(props: CommandPaletteProps<T>) {\n const {\n open,\n onOpenChange,\n items,\n onSelect,\n placeholder,\n recent,\n recentLabel,\n emptyText,\n noResultsText,\n kinds,\n filter = true,\n onQueryChange,\n loading,\n total,\n limit = 50,\n hotkey = true,\n defaultQuery = '',\n label,\n } = props;\n const [q, setQ] = React.useState(defaultQuery);\n const [active, setActive] = React.useState(0);\n useReturnFocus(open);\n // Every open starts from the default query; opens come from the open prop, so compare during render.\n const [wasOpen, setWasOpen] = React.useState(open);\n if (open !== wasOpen) {\n setWasOpen(open);\n if (open) {\n setQ(defaultQuery);\n setActive(0);\n }\n }\n const list = React.useRef<HTMLUListElement>(null);\n const id = React.useId();\n const toggle = React.useRef(onOpenChange);\n const reportQuery = React.useRef(onQueryChange);\n React.useLayoutEffect(() => {\n toggle.current = onOpenChange;\n reportQuery.current = onQueryChange;\n });\n React.useEffect(() => {\n if (open) reportQuery.current?.(defaultQuery);\n }, [open, defaultQuery]);\n React.useEffect(() => {\n if (!hotkey) return;\n const key = (e: KeyboardEvent) => {\n if ((e.ctrlKey || e.metaKey) && !e.altKey && !e.shiftKey && e.key.toLowerCase() === 'k') {\n e.preventDefault();\n toggle.current(!open);\n }\n };\n document.addEventListener('keydown', key);\n return () => document.removeEventListener('keydown', key);\n }, [hotkey, open]);\n const query = q.trim().toLowerCase();\n const shown: { it: T; at: number }[] = (\n filter === false\n ? items.map((it) => ({ it, at: -1 }))\n : !query\n ? (recent ?? []).map((it) => ({ it, at: -1 }))\n : items\n .map((it, i) => {\n const r = score(it, query);\n return r ? { it, rank: r[0], at: r[1], i } : null;\n })\n .filter((x) => x !== null)\n .sort((a, b) => a.rank - b.rank || a.i - b.i)\n ).slice(0, limit);\n const act = Math.min(active, Math.max(0, shown.length - 1));\n React.useEffect(() => {\n list.current?.querySelector('.is-active')?.scrollIntoView?.({ block: 'nearest' });\n }, [act, open]);\n const pick = (it: T) => {\n onOpenChange(false);\n onSelect?.(it);\n };\n const onKey = (e: React.KeyboardEvent) => {\n // Enter and arrows during IME composition (注音, 倉頡) belong to the input method.\n if (e.nativeEvent.isComposing || e.keyCode === 229) return;\n if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {\n e.preventDefault();\n const d = e.key === 'ArrowDown' ? 1 : -1;\n setActive(shown.length ? (act + d + shown.length) % shown.length : 0);\n } else if (e.key === 'Enter') {\n e.preventDefault();\n if (shown[act]) pick(shown[act].it);\n }\n };\n const labelOf = (it: T, at: number) => {\n const t = it.label;\n return (\n <span className={cx('ui-pal-label', it.code && 'is-code')}>\n {at >= 0 && query ? (\n <>\n {t.slice(0, at)}\n <mark className=\"ui-pal-hit\">{t.slice(at, at + query.length)}</mark>\n {t.slice(at + query.length)}\n </>\n ) : (\n t\n )}\n </span>\n );\n };\n const none = (t: string) => (typeof noResultsText === 'function' ? noResultsText(t) : (noResultsText ?? tr('找不到符合「{q}」的結果')).replace('{q}', t));\n const empty = query ? none(q.trim()) : emptyText || tr('輸入名稱開始搜尋');\n // The page's live region reads the result count (or 「找不到…」) after typing settles; a message inserted fresh\n // into the dialog is not read by most screen readers.\n // RA: a line under the results with the count, and how many were cut off; a cut list is read out the same way.\n const more = total != null && total > shown.length ? total - shown.length : 0;\n const count = more ? tr('顯示 {n} 筆,另有 {m} 筆,請輸入更長的字', { n: shown.length, m: more }) : tr('共 {n} 筆', { n: shown.length });\n const said = !open ? '' : !query ? '' : loading ? tr('搜尋中') : shown.length ? (more ? count : tr('找到 {n} 筆結果', { n: shown.length })) : empty;\n // Read again for every new query and every end of loading, also when the text is the same (「找到 2 筆結果」 for\n // 「IB」 and then for 「IBT」).\n React.useEffect(() => {\n if (!said) return;\n const t = setTimeout(() => announce(said), 400);\n return () => clearTimeout(t);\n }, [said, query, loading]);\n return (\n <Dialog.Root open={open} onOpenChange={onOpenChange}>\n <Dialog.Portal>\n <Dialog.Backdrop className=\"ui-pal-backdrop\" />\n <Dialog.Popup className=\"ui-pal\" aria-label={label || tr('搜尋')}>\n <div className=\"ui-pal-head\">\n <Icon name=\"magnifying-glass\" className=\"ui-pal-icon\" />\n <input\n className=\"ui-pal-input\"\n type=\"text\"\n value={q}\n placeholder={placeholder || tr('搜尋')}\n role=\"combobox\"\n aria-expanded={shown.length > 0}\n aria-controls={shown.length ? id : undefined}\n aria-autocomplete=\"list\"\n aria-activedescendant={shown[act] ? `${id}-${act}` : undefined}\n autoComplete=\"off\"\n spellCheck={false}\n enterKeyHint=\"go\"\n onChange={(e) => {\n setQ(e.target.value);\n setActive(0);\n onQueryChange?.(e.target.value);\n }}\n onKeyDown={onKey}\n />\n <Dialog.Close className=\"ui-pal-cancel\">{tr('取消')}</Dialog.Close>\n </div>\n {!query && shown.length && recent ? <div className=\"ui-pal-group\">{recentLabel || tr('最近開啟')}</div> : null}\n {shown.length ? (\n <ul ref={list} id={id} className=\"ui-pal-list\" role=\"listbox\" aria-label={tr('搜尋結果')}>\n {shown.map(({ it, at }, i) => (\n <li\n key={it.id ?? i}\n id={`${id}-${i}`}\n role=\"option\"\n aria-selected={i === act}\n className={cx('ui-pal-item', i === act && 'is-active')}\n onMouseMove={() => act !== i && setActive(i)}\n onMouseDown={(e) => e.preventDefault()}\n onClick={() => pick(it)}\n >\n <span className=\"ui-pal-kind\" title={it.kind}>\n <IconOf icon={it.icon ?? (it.kind ? (kinds?.[it.kind] ?? KIND_ICONS[it.kind]) : undefined) ?? 'file'} size={16} />\n </span>\n <span className=\"ui-pal-text\">\n <span className=\"ui-pal-line\">\n {/* Read as 「環境變數 APP_SHM」: the kind first, as it is said, then the name. */}\n {it.kind ? <span className=\"ui-visually-hidden\">{it.kind + ' '}</span> : null}\n {labelOf(it, at)}\n </span>\n {it.detail ? <CodeText className=\"ui-pal-detail\" text={it.detail} /> : null}\n </span>\n </li>\n ))}\n </ul>\n ) : (\n <p className=\"ui-pal-empty\">{loading ? tr('搜尋中') : empty}</p>\n )}\n {/* Results already listed while more are on their way: say so in the page text too, not only to a screen\n reader, so whoever reads the list (a person or a script) knows it is not final yet. */}\n {loading && shown.length ? <p className=\"ui-pal-loading\">{tr('搜尋中')}</p> : null}\n {query && !loading && shown.length ? (\n // Read out through the live region already (said): here for the eyes only.\n <p className=\"ui-pal-count\" aria-hidden=\"true\">\n {count}\n </p>\n ) : null}\n <div className=\"ui-pal-keys\" aria-hidden=\"true\">\n <span>\n <kbd>↑</kbd>\n <kbd>↓</kbd>\n {tr('選擇')}\n </span>\n <span>\n <kbd>Enter</kbd>\n {tr('打開')}\n </span>\n <span>\n <kbd>Esc</kbd>\n {tr('關閉')}\n </span>\n </div>\n </Dialog.Popup>\n </Dialog.Portal>\n </Dialog.Root>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAgBA,aAAaA,iBAAWC,cAAQC,mBAAYC,mBAAYC,cAAQC,wBAAiB;AAiBjF,MAAM,aAAyC;CAAE,IAAI;CAAa,IAAI;CAAQ,IAAI;CAAW,IAAI;AAAY;;AAsC7G,SAAS,MAAM,IAAiB,GAA8C;CAC5E,MAAM,IAAI,GAAG,MAAM,YAAY,CAAC,CAAC,QAAQ,CAAC;CAC1C,IAAI,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;CACzB,IAAI,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC;CAEvB,OADa;EAAC,GAAG;EAAQ,GAAG;EAAM,GAAI,GAAG,YAAY,CAAC;CAAE,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,YAC1D,CAAC,CAAC,SAAS,CAAC,IAAI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,QAAD;SAAM,WAAU;SAAsB,UAAA,GAAG,OAAO;QAAU,CAAA,IAAI,MACxE,QAAQ,IAAI,EAAE,CACX;OACL,CAAA,GAAA,GAAG,SAAS,oBAAC,UAAD;QAAU,WAAU;QAAgB,MAAM,GAAG;OAAS,CAAA,IAAI,IACnE;MACJ,CAAA,CAAA;KApBG,GAAA,GAAG,MAAM,CAoBZ,CACL;IACC,CAAA,IAEJ,oBAAC,KAAD;KAAG,WAAU;KAAgB,UAAA,UAAU,GAAG,KAAK,IAAI;IAAS,CAAA;IAI7D,WAAW,MAAM,SAAS,oBAAC,KAAD;KAAG,WAAU;KAAkB,UAAA,GAAG,KAAK;IAAK,CAAA,IAAI;IAC1E,SAAS,CAAC,WAAW,MAAM,SAE1B,oBAAC,KAAD;KAAG,WAAU;KAAe,eAAY;KACrC,UAAA;IACA,CAAA,IACD;IACJ,qBAAC,OAAD;KAAK,WAAU;KAAc,eAAY;KAAzC,UAAA;MACE,qBAAC,QAAD,EAAA,UAAA;OACE,oBAAC,OAAD,EAAA,UAAK,IAAM,CAAA;OACX,oBAAC,OAAD,EAAA,UAAK,IAAM,CAAA;OACV,GAAG,IAAI;MACJ,EAAA,CAAA;MACN,qBAAC,QAAD,EAAA,UAAA,CACE,oBAAC,OAAD,EAAA,UAAK,QAAU,CAAA,GACd,GAAG,IAAI,CACJ,EAAA,CAAA;MACN,qBAAC,QAAD,EAAA,UAAA,CACE,oBAAC,OAAD,EAAA,UAAK,MAAQ,CAAA,GACZ,GAAG,IAAI,CACJ,EAAA,CAAA;KACH;;GACO;EACD,CAAA,CAAA,EAAA,CAAA;CACJ,CAAA;AAEjB"}
|
|
1
|
+
{"version":3,"file":"CommandPalette.js","names":["phCommand","phFile","phFileCode","phFileText","phGear","phMagnifyingGlass"],"sources":["../../../src/components/CommandPalette/CommandPalette.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useReturnFocus } from '../../internal/focus';\nimport { announce } from '../../announce';\nimport { Dialog } from '@base-ui/react/dialog';\nimport { CodeText } from '../InlineCode/InlineCode';\nimport { tr } from '../../i18n';\nimport { Icon, IconOf, type IconSource } from '../../icons/Icon';\nimport { cx } from '../../internal/util';\nimport { devWarn } from '../../internal/dev';\nimport { baseReason, useOpenState, type OpenChangeReason } from '../../internal/open';\nimport { includeIcons } from '../../icons/store';\nimport phCommand from '../../icons/ph/command';\nimport phFile from '../../icons/ph/file';\nimport phFileCode from '../../icons/ph/file-code';\nimport phFileText from '../../icons/ph/file-text';\nimport phGear from '../../icons/ph/gear';\nimport phMagnifyingGlass from '../../icons/ph/magnifying-glass';\n\nincludeIcons(phCommand, phFile, phFileCode, phFileText, phGear, phMagnifyingGlass);\n\nexport interface PaletteItem {\n id?: string | number;\n label: string;\n /** Under the label; `backticks` are code. */\n detail?: string;\n /** What it is: 'page', 'setting', 'command', 'file' (icon and name built in, the name read in the current language), or\n * your own kinds (with `kinds`), shown as written. Picks the icon. */\n kind?: PaletteKind | (string & {});\n /** Overrides the kind's icon. */\n icon?: IconSource;\n /** The label is code: Geist Mono. */\n code?: boolean;\n /** More words that find it. */\n keywords?: string[];\n}\n\n/** The built-in kinds: a stable id, its icon and its name (through tr()). */\nexport type PaletteKind = 'page' | 'setting' | 'command' | 'file';\nconst KINDS: Record<PaletteKind, [icon: IconSource, name: string]> = {\n page: ['file-text', '頁面'],\n setting: ['gear', '設定'],\n command: ['command', '指令'],\n file: ['file-code', '檔案'],\n};\n// The Chinese names used as kinds before the ids: they still work, with a warning.\nconst OLD_KINDS: Record<string, PaletteKind> = { 頁面: 'page', 設定: 'setting', 指令: 'command', 檔案: 'file' };\n\n/** A kind's icon and the name shown and read for it: your kinds as written, the built-in ones translated. */\nfunction kindOf(kind: string, kinds: Record<string, IconSource> | undefined): { icon?: IconSource; name: string } {\n if (kinds?.[kind]) return { icon: kinds[kind], name: kind };\n const id = Object.hasOwn(KINDS, kind) ? (kind as PaletteKind) : OLD_KINDS[kind];\n devWarn(\n !!OLD_KINDS[kind],\n 'CommandPalette',\n `kind '${kind}' is the old Chinese name of a built-in kind, which cannot be translated. Pass kind: '${OLD_KINDS[kind]}' instead.`,\n );\n return id ? { icon: KINDS[id][0], name: tr(KINDS[id][1]) } : { name: kind };\n}\n\nexport interface CommandPaletteProps<T extends PaletteItem = PaletteItem> {\n /** Controlled: shown while true. Leave it out to let the palette keep its own state (Ctrl K still opens it). */\n open?: boolean;\n /** Uncontrolled: whether it starts open. */\n defaultOpen?: boolean;\n /** Called with the new state and why: 'hotkey' (Ctrl K), 'select' (a result was chosen), 'escape', 'outside'. */\n onOpenChange?: (open: boolean, reason?: OpenChangeReason) => void;\n /** Every item that can be found. */\n items: T[];\n /** Called with the item the person opens (Enter or a press). */\n onSelect?: (item: T) => void;\n /** Default 「搜尋」. */\n placeholder?: string;\n /** Shown before anything is typed. */\n recent?: T[];\n /** Default 「最近開啟」. */\n recentLabel?: string;\n /** Shown with nothing typed and no recent items. Default 「輸入名稱開始搜尋」. */\n emptyText?: string;\n /** Shown and read out when the typed text finds nothing, e.g. what else to try. `{q}` is the typed text; a function\n * gets it. Default 「找不到符合「{q}」的結果」. Not an item, so it is never counted as a result. */\n noResultsText?: string | ((query: string) => string);\n /** Icon for each of your own kinds: { 函式: 'brackets-curly' }. */\n kinds?: Record<string, IconSource>;\n /** false: items are already filtered (server search with onQueryChange). */\n filter?: boolean;\n /** Called on every change of the search text, for results the app fetches itself. */\n onQueryChange?: (query: string) => void;\n /** Shows 「搜尋中」 when there are no items yet. */\n loading?: boolean;\n /** How many matched before you cut the list down to items (RA): the line under the results then says how many\n * more there are, e.g. 「顯示 30 筆,另有 17 筆,請輸入更長的字」. Without it the line says 「共 30 筆」. */\n total?: number;\n /** Most results shown. Default 50. */\n limit?: number;\n /** Ctrl K / ⌘K toggles it. Default true. */\n hotkey?: boolean;\n /** The search text when the palette opens. */\n defaultQuery?: string;\n /** Default 「搜尋」. */\n label?: string;\n}\n\n/** The score of an item for a query: label starts with it, label contains it, other text contains it; null: no match. */\nfunction score(it: PaletteItem, q: string): [rank: number, at: number] | null {\n const i = it.label.toLowerCase().indexOf(q);\n if (i === 0) return [0, 0];\n if (i > 0) return [1, i];\n const more = [it.detail, it.kind, it.kind && kindOf(it.kind, undefined).name, ...(it.keywords ?? [])].join(' ').toLowerCase();\n return more.includes(q) ? [2, -1] : null;\n}\n\n/** One search for everything, opened with Ctrl K (⌘K). A panel in the middle of the screen; results sorted by relevance. */\nexport function CommandPalette<T extends PaletteItem = PaletteItem>(props: CommandPaletteProps<T>) {\n const {\n open: openProp,\n defaultOpen,\n onOpenChange: reportOpen,\n items,\n onSelect,\n placeholder,\n recent,\n recentLabel,\n emptyText,\n noResultsText,\n kinds,\n filter = true,\n onQueryChange,\n loading,\n total,\n limit = 50,\n hotkey = true,\n defaultQuery = '',\n label,\n } = props;\n const [open, onOpenChange] = useOpenState({ open: openProp, defaultOpen, onOpenChange: reportOpen });\n const [q, setQ] = React.useState(defaultQuery);\n const [active, setActive] = React.useState(0);\n useReturnFocus(open);\n // Every open starts from the default query; opens come from the open prop, so compare during render.\n const [wasOpen, setWasOpen] = React.useState(open);\n if (open !== wasOpen) {\n setWasOpen(open);\n if (open) {\n setQ(defaultQuery);\n setActive(0);\n }\n }\n const list = React.useRef<HTMLUListElement>(null);\n const id = React.useId();\n const toggle = React.useRef(onOpenChange);\n const reportQuery = React.useRef(onQueryChange);\n React.useLayoutEffect(() => {\n toggle.current = onOpenChange;\n reportQuery.current = onQueryChange;\n });\n React.useEffect(() => {\n if (open) reportQuery.current?.(defaultQuery);\n }, [open, defaultQuery]);\n React.useEffect(() => {\n if (!hotkey) return;\n const key = (e: KeyboardEvent) => {\n if ((e.ctrlKey || e.metaKey) && !e.altKey && !e.shiftKey && e.key.toLowerCase() === 'k') {\n e.preventDefault();\n toggle.current(!open, 'hotkey');\n }\n };\n document.addEventListener('keydown', key);\n return () => document.removeEventListener('keydown', key);\n }, [hotkey, open]);\n const query = q.trim().toLowerCase();\n const shown: { it: T; at: number }[] = (\n filter === false\n ? items.map((it) => ({ it, at: -1 }))\n : !query\n ? (recent ?? []).map((it) => ({ it, at: -1 }))\n : items\n .map((it, i) => {\n const r = score(it, query);\n return r ? { it, rank: r[0], at: r[1], i } : null;\n })\n .filter((x) => x !== null)\n .sort((a, b) => a.rank - b.rank || a.i - b.i)\n ).slice(0, limit);\n const act = Math.min(active, Math.max(0, shown.length - 1));\n React.useEffect(() => {\n list.current?.querySelector('.is-active')?.scrollIntoView?.({ block: 'nearest' });\n }, [act, open]);\n const pick = (it: T) => {\n onOpenChange(false, 'select');\n onSelect?.(it);\n };\n const onKey = (e: React.KeyboardEvent) => {\n // Enter and arrows during IME composition (注音, 倉頡) belong to the input method.\n if (e.nativeEvent.isComposing || e.keyCode === 229) return;\n if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {\n e.preventDefault();\n const d = e.key === 'ArrowDown' ? 1 : -1;\n setActive(shown.length ? (act + d + shown.length) % shown.length : 0);\n } else if (e.key === 'Enter') {\n e.preventDefault();\n if (shown[act]) pick(shown[act].it);\n }\n };\n const labelOf = (it: T, at: number) => {\n const t = it.label;\n return (\n <span className={cx('ui-pal-label', it.code && 'is-code')}>\n {at >= 0 && query ? (\n <>\n {t.slice(0, at)}\n <mark className=\"ui-pal-hit\">{t.slice(at, at + query.length)}</mark>\n {t.slice(at + query.length)}\n </>\n ) : (\n t\n )}\n </span>\n );\n };\n const none = (t: string) => (typeof noResultsText === 'function' ? noResultsText(t) : (noResultsText ?? tr('找不到符合「{q}」的結果')).replace('{q}', t));\n const empty = query ? none(q.trim()) : emptyText || tr('輸入名稱開始搜尋');\n // The page's live region reads the result count (or 「找不到…」) after typing settles; a message inserted fresh\n // into the dialog is not read by most screen readers.\n // RA: a line under the results with the count, and how many were cut off; a cut list is read out the same way.\n const more = total != null && total > shown.length ? total - shown.length : 0;\n const count = more ? tr('顯示 {n} 筆,另有 {m} 筆,請輸入更長的字', { n: shown.length, m: more }) : tr('共 {n} 筆', { n: shown.length });\n const said = !open ? '' : !query ? '' : loading ? tr('搜尋中') : shown.length ? (more ? count : tr('找到 {n} 筆結果', { n: shown.length })) : empty;\n // Read again for every new query and every end of loading, also when the text is the same (「找到 2 筆結果」 for\n // 「IB」 and then for 「IBT」).\n React.useEffect(() => {\n if (!said) return;\n const t = setTimeout(() => announce(said), 400);\n return () => clearTimeout(t);\n }, [said, query, loading]);\n return (\n <Dialog.Root open={open} onOpenChange={(next, details) => onOpenChange(next, baseReason(details?.reason))}>\n <Dialog.Portal>\n <Dialog.Backdrop className=\"ui-pal-backdrop\" />\n <Dialog.Popup className=\"ui-pal\" aria-label={label || tr('搜尋')}>\n <div className=\"ui-pal-head\">\n <Icon name=\"magnifying-glass\" className=\"ui-pal-icon\" />\n <input\n className=\"ui-pal-input\"\n type=\"text\"\n value={q}\n placeholder={placeholder || tr('搜尋')}\n role=\"combobox\"\n aria-expanded={shown.length > 0}\n aria-controls={shown.length ? id : undefined}\n aria-autocomplete=\"list\"\n aria-activedescendant={shown[act] ? `${id}-${act}` : undefined}\n autoComplete=\"off\"\n spellCheck={false}\n enterKeyHint=\"go\"\n onChange={(e) => {\n setQ(e.target.value);\n setActive(0);\n onQueryChange?.(e.target.value);\n }}\n onKeyDown={onKey}\n />\n <Dialog.Close className=\"ui-pal-cancel\">{tr('取消')}</Dialog.Close>\n </div>\n {!query && shown.length && recent ? <div className=\"ui-pal-group\">{recentLabel || tr('最近開啟')}</div> : null}\n {shown.length ? (\n <ul ref={list} id={id} className=\"ui-pal-list\" role=\"listbox\" aria-label={tr('搜尋結果')}>\n {shown.map(({ it, at }, i) => (\n <li\n key={it.id ?? i}\n id={`${id}-${i}`}\n role=\"option\"\n aria-selected={i === act}\n className={cx('ui-pal-item', i === act && 'is-active')}\n onMouseMove={() => act !== i && setActive(i)}\n onMouseDown={(e) => e.preventDefault()}\n onClick={() => pick(it)}\n >\n <span className=\"ui-pal-kind\" title={it.kind ? kindOf(it.kind, kinds).name : undefined}>\n <IconOf icon={it.icon ?? (it.kind ? kindOf(it.kind, kinds).icon : undefined) ?? 'file'} size={16} />\n </span>\n <span className=\"ui-pal-text\">\n <span className=\"ui-pal-line\">\n {/* Read as 「環境變數 APP_SHM」: the kind first, as it is said, then the name. */}\n {it.kind ? <span className=\"ui-visually-hidden\">{kindOf(it.kind, kinds).name + ' '}</span> : null}\n {labelOf(it, at)}\n </span>\n {it.detail ? <CodeText className=\"ui-pal-detail\" text={it.detail} /> : null}\n </span>\n </li>\n ))}\n </ul>\n ) : (\n <p className=\"ui-pal-empty\">{loading ? tr('搜尋中') : empty}</p>\n )}\n {/* Results already listed while more are on their way: say so in the page text too, not only to a screen\n reader, so whoever reads the list (a person or a script) knows it is not final yet. */}\n {loading && shown.length ? <p className=\"ui-pal-loading\">{tr('搜尋中')}</p> : null}\n {query && !loading && shown.length ? (\n // Read out through the live region already (said): here for the eyes only.\n <p className=\"ui-pal-count\" aria-hidden=\"true\">\n {count}\n </p>\n ) : null}\n <div className=\"ui-pal-keys\" aria-hidden=\"true\">\n <span>\n <kbd>↑</kbd>\n <kbd>↓</kbd>\n {tr('選擇')}\n </span>\n <span>\n <kbd>Enter</kbd>\n {tr('打開')}\n </span>\n <span>\n <kbd>Esc</kbd>\n {tr('關閉')}\n </span>\n </div>\n </Dialog.Popup>\n </Dialog.Portal>\n </Dialog.Root>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAkBA,aAAaA,iBAAWC,cAAQC,mBAAYC,mBAAYC,cAAQC,wBAAiB;AAoBjF,MAAM,QAA+D;CACnE,MAAM,CAAC,aAAa,IAAI;CACxB,SAAS,CAAC,QAAQ,IAAI;CACtB,SAAS,CAAC,WAAW,IAAI;CACzB,MAAM,CAAC,aAAa,IAAI;AAC1B;AAEA,MAAM,YAAyC;CAAE,IAAI;CAAQ,IAAI;CAAW,IAAI;CAAW,IAAI;AAAO;;AAGtG,SAAS,OAAO,MAAc,OAAoF;CAChH,IAAI,QAAQ,OAAO,OAAO;EAAE,MAAM,MAAM;EAAO,MAAM;CAAK;C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,GAAG,KAAK,IAAI;IAAS,CAAA;IAI7D,WAAW,MAAM,SAAS,oBAAC,KAAD;KAAG,WAAU;KAAkB,UAAA,GAAG,KAAK;IAAK,CAAA,IAAI;IAC1E,SAAS,CAAC,WAAW,MAAM,SAE1B,oBAAC,KAAD;KAAG,WAAU;KAAe,eAAY;KACrC,UAAA;IACA,CAAA,IACD;IACJ,qBAAC,OAAD;KAAK,WAAU;KAAc,eAAY;KAAzC,UAAA;MACE,qBAAC,QAAD,EAAA,UAAA;OACE,oBAAC,OAAD,EAAA,UAAK,IAAM,CAAA;OACX,oBAAC,OAAD,EAAA,UAAK,IAAM,CAAA;OACV,GAAG,IAAI;MACJ,EAAA,CAAA;MACN,qBAAC,QAAD,EAAA,UAAA,CACE,oBAAC,OAAD,EAAA,UAAK,QAAU,CAAA,GACd,GAAG,IAAI,CACJ,EAAA,CAAA;MACN,qBAAC,QAAD,EAAA,UAAA,CACE,oBAAC,OAAD,EAAA,UAAK,MAAQ,CAAA,GACZ,GAAG,IAAI,CACJ,EAAA,CAAA;KACH;;GACO;EACD,CAAA,CAAA,EAAA,CAAA;CACJ,CAAA;AAEjB"}
|
|
@@ -12,7 +12,7 @@ export interface ConsoleExtra {
|
|
|
12
12
|
export interface ConsoleLayoutProps {
|
|
13
13
|
/** The product or screen name, the page's only heading: 「設施監控」. */
|
|
14
14
|
title: string;
|
|
15
|
-
/** Right after the title:
|
|
15
|
+
/** Right after the title: a Tag 「示範資料」 with the info icon. Same size and color as the text around it. */
|
|
16
16
|
tags?: React.ReactNode;
|
|
17
17
|
/** Right side, before the KPIs: one short state in plain words, 「AI 最佳化中」. Shown in body size and ink color;
|
|
18
18
|
* pass plain text, not a Badge. */
|
|
@@ -34,10 +34,9 @@ export interface ConsoleLayoutProps {
|
|
|
34
34
|
bottom?: React.ReactNode;
|
|
35
35
|
/** Cards added at the end of the side panel on tall screens: `[{ id, minHeight: 1040, node }]`. */
|
|
36
36
|
extras?: ConsoleExtra[];
|
|
37
|
+
/** Extra class on the root element. */
|
|
37
38
|
className?: string;
|
|
38
39
|
}
|
|
39
|
-
/** Zoom for a screen of w × h px: 1 up to 1440 × 900, then grows with the screen, at most 1.5. */
|
|
40
|
-
export declare function consoleZoom(w: number, h: number): number;
|
|
41
40
|
/** A full-screen monitoring layout: a top bar (title, tags, then status, KPIs, clock and full screen on the right),
|
|
42
41
|
* the main view with a side panel beside it and a bottom row under it, filling the screen without scrolling. From
|
|
43
42
|
* 1440 × 900 up everything zooms with the screen (at most 1.5×). Phones (under 600 px) get one scrolling column. */
|
|
@@ -14,6 +14,9 @@ const BASE_W = 1440;
|
|
|
14
14
|
const BASE_H = 900;
|
|
15
15
|
const MAX_ZOOM = 1.5;
|
|
16
16
|
const PHONE = 600;
|
|
17
|
+
const noSubscribe = () => () => {};
|
|
18
|
+
const fullscreenEnabled = () => typeof document !== "undefined" && document.fullscreenEnabled === true;
|
|
19
|
+
const serverFalse = () => false;
|
|
17
20
|
/** Zoom for a screen of w × h px: 1 up to 1440 × 900, then grows with the screen, at most 1.5. */
|
|
18
21
|
function consoleZoom(w, h) {
|
|
19
22
|
return Math.max(1, Math.min(MAX_ZOOM, Math.min(w / BASE_W, h / BASE_H)));
|
|
@@ -25,7 +28,7 @@ function ConsoleLayout({ title, tags, status, kpis, clock, fullscreen = true, ma
|
|
|
25
28
|
const ref = React.useRef(null);
|
|
26
29
|
const [size, setSize] = React.useState(null);
|
|
27
30
|
const [full, setFull] = React.useState(false);
|
|
28
|
-
const canFull =
|
|
31
|
+
const canFull = React.useSyncExternalStore(noSubscribe, fullscreenEnabled, serverFalse);
|
|
29
32
|
React.useLayoutEffect(() => {
|
|
30
33
|
const el = ref.current;
|
|
31
34
|
if (!el) return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConsoleLayout.js","names":["phCornersIn","phCornersOut"],"sources":["../../../src/components/ConsoleLayout/ConsoleLayout.tsx"],"sourcesContent":["import * as React from 'react';\nimport { IconButton } from '../IconButton/IconButton';\nimport { cx } from '../../internal/util';\nimport { tr } from '../../i18n';\nimport { includeIcons } from '../../icons/store';\nimport phCornersIn from '../../icons/ph/corners-in';\nimport phCornersOut from '../../icons/ph/corners-out';\n\nincludeIcons(phCornersIn, phCornersOut);\n\n/** A card that shows only when the screen is tall enough. */\nexport interface ConsoleExtra {\n /** Stable key for the card. */\n id: string;\n /** The card shows when the layout's logical height (the screen height divided by the zoom) is at least this many\n * px, e.g. 1040. */\n minHeight: number;\n /** The card: usually a Card. */\n node: React.ReactNode;\n}\n\nexport interface ConsoleLayoutProps {\n /** The product or screen name, the page's only heading: 「設施監控」. */\n title: string;\n /** Right after the title:
|
|
1
|
+
{"version":3,"file":"ConsoleLayout.js","names":["phCornersIn","phCornersOut"],"sources":["../../../src/components/ConsoleLayout/ConsoleLayout.tsx"],"sourcesContent":["import * as React from 'react';\nimport { IconButton } from '../IconButton/IconButton';\nimport { cx } from '../../internal/util';\nimport { tr } from '../../i18n';\nimport { includeIcons } from '../../icons/store';\nimport phCornersIn from '../../icons/ph/corners-in';\nimport phCornersOut from '../../icons/ph/corners-out';\n\nincludeIcons(phCornersIn, phCornersOut);\n\n/** A card that shows only when the screen is tall enough. */\nexport interface ConsoleExtra {\n /** Stable key for the card. */\n id: string;\n /** The card shows when the layout's logical height (the screen height divided by the zoom) is at least this many\n * px, e.g. 1040. */\n minHeight: number;\n /** The card: usually a Card. */\n node: React.ReactNode;\n}\n\nexport interface ConsoleLayoutProps {\n /** The product or screen name, the page's only heading: 「設施監控」. */\n title: string;\n /** Right after the title: a Tag 「示範資料」 with the info icon. Same size and color as the text around it. */\n tags?: React.ReactNode;\n /** Right side, before the KPIs: one short state in plain words, 「AI 最佳化中」. Shown in body size and ink color;\n * pass plain text, not a Badge. */\n status?: React.ReactNode;\n /** Right side: `<KpiCard size=\"compact\" />` side by side. In the top bar they lose their card look and sit between\n * 1 px lines. */\n kpis?: React.ReactNode;\n /** Right side, after the KPIs: the time and whether it is live, 「16:24 即時」. */\n clock?: React.ReactNode;\n /** A 「全螢幕」 button at the right end (Fullscreen API). Default true; hidden where the browser has no full screen. */\n fullscreen?: boolean;\n /** The main view, left of the side panel; it fills its cell (pass one Card, e.g. with a ZoneMap). */\n main: React.ReactNode;\n /** The side panel, 400 px (360 px under 1280 px): cards from top to bottom (TimeControl, EventTimeline). When they\n * do not fit, the side panel scrolls on its own; the page never does. */\n side?: React.ReactNode;\n /** The bottom row under the main view, as tall as its content: e.g. a LineChart in a Card. The main view takes the\n * height that is left. */\n bottom?: React.ReactNode;\n /** Cards added at the end of the side panel on tall screens: `[{ id, minHeight: 1040, node }]`. */\n extras?: ConsoleExtra[];\n /** Extra class on the root element. */\n className?: string;\n}\n\n/** Design size: at this size and up the layout zooms in. */\nconst BASE_W = 1440;\nconst BASE_H = 900;\nconst MAX_ZOOM = 1.5;\nconst PHONE = 600;\n\nconst noSubscribe = () => () => {};\nconst fullscreenEnabled = () => typeof document !== 'undefined' && document.fullscreenEnabled === true;\nconst serverFalse = () => false;\n\n/** Zoom for a screen of w × h px: 1 up to 1440 × 900, then grows with the screen, at most 1.5. */\nexport function consoleZoom(w: number, h: number): number {\n return Math.max(1, Math.min(MAX_ZOOM, Math.min(w / BASE_W, h / BASE_H)));\n}\n\n/** A full-screen monitoring layout: a top bar (title, tags, then status, KPIs, clock and full screen on the right),\n * the main view with a side panel beside it and a bottom row under it, filling the screen without scrolling. From\n * 1440 × 900 up everything zooms with the screen (at most 1.5×). Phones (under 600 px) get one scrolling column. */\nexport function ConsoleLayout({ title, tags, status, kpis, clock, fullscreen = true, main, side, bottom, extras, className }: ConsoleLayoutProps) {\n const ref = React.useRef<HTMLDivElement>(null);\n const [size, setSize] = React.useState<{ w: number; h: number } | null>(null);\n const [full, setFull] = React.useState(false);\n // false on the server and the first browser render, so the markup matches; then whether full screen is allowed.\n const canFull = React.useSyncExternalStore(noSubscribe, fullscreenEnabled, serverFalse);\n\n React.useLayoutEffect(() => {\n const el = ref.current;\n if (!el) return;\n const measure = () => setSize({ w: el.clientWidth, h: el.clientHeight });\n measure();\n if (typeof ResizeObserver === 'undefined') return;\n const ro = new ResizeObserver(measure);\n ro.observe(el);\n return () => ro.disconnect();\n }, []);\n\n React.useEffect(() => {\n const f = () => setFull(document.fullscreenElement != null && document.fullscreenElement === ref.current);\n document.addEventListener('fullscreenchange', f);\n return () => document.removeEventListener('fullscreenchange', f);\n }, []);\n\n const toggleFull = () => {\n const el = ref.current;\n if (!el) return;\n if (document.fullscreenElement) void document.exitFullscreen().catch(() => undefined);\n else void el.requestFullscreen().catch(() => undefined);\n };\n\n const phone = size != null && size.w < PHONE;\n const zoom = size && !phone ? consoleZoom(size.w, size.h) : 1;\n const logicalH = size ? size.h / zoom : 0;\n const shown = (extras ?? []).filter((x) => phone || logicalH >= x.minHeight);\n const frameStyle: React.CSSProperties | undefined =\n size && !phone && zoom !== 1 ? ({ zoom, width: size.w / zoom, height: size.h / zoom } as React.CSSProperties) : undefined;\n\n const top = (\n <header className=\"ui-console-top\">\n <div className=\"ui-console-start\">\n <h1 className=\"ui-console-title\">{title}</h1>\n {tags}\n </div>\n <div className=\"ui-console-end\">\n {status != null ? <span className=\"ui-console-status\">{status}</span> : null}\n {kpis != null ? <div className=\"ui-console-kpis\">{kpis}</div> : null}\n {clock != null ? <span className=\"ui-console-clock\">{clock}</span> : null}\n {fullscreen && canFull && !phone ? (\n <IconButton label={full ? tr('離開全螢幕') : tr('全螢幕')} icon={full ? 'corners-in' : 'corners-out'} onClick={toggleFull} />\n ) : null}\n </div>\n </header>\n );\n\n return (\n <div ref={ref} className={cx('ui-console', phone && 'is-stacked', className)}>\n <div className=\"ui-console-frame\" style={frameStyle}>\n {top}\n <main className=\"ui-console-main\">{main}</main>\n {phone ? (\n <>\n {side}\n {bottom}\n {shown.map((x) => (\n <React.Fragment key={x.id}>{x.node}</React.Fragment>\n ))}\n </>\n ) : (\n <>\n <aside className=\"ui-console-side\" aria-label={tr('側欄')}>\n {side}\n {shown.map((x) => (\n <React.Fragment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AAD;EAAU;EAAK,WAAW,GAAG,cAAc,SAAS,cAAc,SAAS;EACzE,UAAA,qBAAC,OAAD;GAAK,WAAU;GAAmB,OAAO;GAAzC,UAAA;IACG;IACD,oBAAC,QAAD;KAAM,WAAU;KAAmB,UAAA;IAAW,CAAA;IAC7C,QACC,qBAAA,UAAA,EAAA,UAAA;KACG;KACA;KACA,MAAM,KAAK,MACV,oBAAC,MAAM,UAAP,EAAA,UAA4B,EAAE,KAAqB,GAA9B,EAAE,EAA4B,CACpD;IACD,EAAA,CAAA,IAEF,qBAAA,UAAA,EAAA,UAAA,CACE,qBAAC,SAAD;KAAO,WAAU;KAAkB,cAAY,GAAG,IAAI;KAAtD,UAAA,CACG,MACA,MAAM,KAAK,MACV,oBAAC,MAAM,UAAP,EAAA,UAA4B,EAAE,KAAqB,GAA9B,EAAE,EAA4B,CACpD,CACI;IACN,CAAA,GAAA,UAAU,OAAO,oBAAC,OAAD;KAAK,WAAU;KAAqB,UAAA;IAAY,CAAA,IAAI,IACtE,EAAA,CAAA;GAED;;CACF,CAAA;AAET"}
|
|
@@ -10,7 +10,8 @@ export interface DangerZoneProps {
|
|
|
10
10
|
onAction: () => void;
|
|
11
11
|
/** The confirm dialog: name the object in the title. */
|
|
12
12
|
confirm: DangerConfirm;
|
|
13
|
+
/** Extra class on the root element. */
|
|
13
14
|
className?: string;
|
|
14
15
|
}
|
|
15
|
-
/**
|
|
16
|
+
/** The last block of a settings page for delete-type actions: a card with a red title; the button asks to confirm. */
|
|
16
17
|
export declare function DangerZone({ title, description, actionLabel, onAction, confirm, className }: DangerZoneProps): import("react").JSX.Element;
|
|
@@ -5,7 +5,7 @@ import { Button } from "../Button/Button.js";
|
|
|
5
5
|
import { codeText } from "../InlineCode/InlineCode.js";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
// src/components/DangerZone/DangerZone.tsx
|
|
8
|
-
/**
|
|
8
|
+
/** The last block of a settings page for delete-type actions: a card with a red title; the button asks to confirm. */
|
|
9
9
|
function DangerZone({ title, description, actionLabel, onAction, confirm, className }) {
|
|
10
10
|
const label = actionLabel || tr("刪除");
|
|
11
11
|
return /* @__PURE__ */ jsxs("section", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DangerZone.js","names":[],"sources":["../../../src/components/DangerZone/DangerZone.tsx"],"sourcesContent":["import { tr } from '../../i18n';\nimport { cx } from '../../internal/util';\nimport { Button, type DangerConfirm } from '../Button/Button';\nimport { codeText } from '../InlineCode/InlineCode';\n\nexport interface DangerZoneProps {\n /** Default 「危險操作」. */\n title?: string;\n /** What the action destroys; `backticks` are code. */\n description: string;\n /** Default 「刪除」. */\n actionLabel?: string;\n /** Runs after the person confirms. */\n onAction: () => void;\n /** The confirm dialog: name the object in the title. */\n confirm: DangerConfirm;\n className?: string;\n}\n\n/**
|
|
1
|
+
{"version":3,"file":"DangerZone.js","names":[],"sources":["../../../src/components/DangerZone/DangerZone.tsx"],"sourcesContent":["import { tr } from '../../i18n';\nimport { cx } from '../../internal/util';\nimport { Button, type DangerConfirm } from '../Button/Button';\nimport { codeText } from '../InlineCode/InlineCode';\n\nexport interface DangerZoneProps {\n /** Default 「危險操作」. */\n title?: string;\n /** What the action destroys; `backticks` are code. */\n description: string;\n /** Default 「刪除」. */\n actionLabel?: string;\n /** Runs after the person confirms. */\n onAction: () => void;\n /** The confirm dialog: name the object in the title. */\n confirm: DangerConfirm;\n /** Extra class on the root element. */\n className?: string;\n}\n\n/** The last block of a settings page for delete-type actions: a card with a red title; the button asks to confirm. */\nexport function DangerZone({ title, description, actionLabel, onAction, confirm, className }: DangerZoneProps) {\n const label = actionLabel || tr('刪除');\n return (\n <section className={cx('ui-danger', className)}>\n <h2 className=\"ui-danger-title\">{title || tr('危險操作')}</h2>\n <div className=\"ui-danger-row\">\n <p>{codeText(description)}</p>\n {/* Without a build step nothing enforces confirm: ask anyway. */}\n <Button variant=\"danger\" confirm={confirm ?? { title: tr('{label}?', { label }) }} onClick={onAction}>\n {label}\n </Button>\n </div>\n </section>\n );\n}\n"],"mappings":";;;;;;;;AAqBA,SAAgB,WAAW,EAAE,OAAO,aAAa,aAAa,UAAU,SAAS,aAA8B;CAC7G,MAAM,QAAQ,eAAe,GAAG,IAAI;CACpC,OACE,qBAAC,WAAD;EAAS,WAAW,GAAG,aAAa,SAAS;EAA7C,UAAA,CACE,oBAAC,MAAD;GAAI,WAAU;GAAmB,UAAA,SAAS,GAAG,MAAM;EAAM,CAAA,GACzD,qBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACE,oBAAC,KAAD,EAAA,UAAI,SAAS,WAAW,EAAK,CAAA,GAE7B,oBAAC,QAAD;IAAQ,SAAQ;IAAS,SAAS,WAAW,EAAE,OAAO,GAAG,YAAY,EAAE,MAAM,CAAC,EAAE;IAAG,SAAS;IACzF,UAAA;GACK,CAAA,CACL;EACE,CAAA,CAAA;;AAEb"}
|
|
@@ -2,6 +2,7 @@ import { CountUnit } from "../../i18n.js";
|
|
|
2
2
|
import { DataTableColumn, DataTableFilter, DataTableView, FilterOption, FilterValue, RangeValue, Row, RowKey, Total } from "./types.js";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
export interface DataTableProps<R extends Row = Record<string, unknown>> {
|
|
5
|
+
/** The columns, in order; key names a field of the row (checked by TypeScript). */
|
|
5
6
|
columns: DataTableColumn<R>[];
|
|
6
7
|
/** Give each row an `id` so selection and animations follow the row, not its position. */
|
|
7
8
|
rows: R[];
|
|
@@ -37,6 +38,9 @@ export interface DataTableProps<R extends Row = Record<string, unknown>> {
|
|
|
37
38
|
/** px kept free at the end of each row's last cell for the row actions, so they never cover its content. Default:
|
|
38
39
|
* the width the actions take, measured. */
|
|
39
40
|
actionsWidth?: number;
|
|
41
|
+
/** false: no toolbar row at all (no search, 「篩選」, 「排序」, 「⋯」 or count), for a small table of a few rows that
|
|
42
|
+
* needs none of them. Headings still sort on click. Default true. */
|
|
43
|
+
toolbar?: boolean;
|
|
40
44
|
/** Search box (default on; false hides it). Searches every column unless keys is given. */
|
|
41
45
|
search?: false | {
|
|
42
46
|
placeholder?: string;
|
|
@@ -82,8 +86,10 @@ export interface DataTableProps<R extends Row = Record<string, unknown>> {
|
|
|
82
86
|
/** 「欄位」 in the 「⋯」 menu, to hide columns. Default true. */
|
|
83
87
|
columnMenu?: boolean;
|
|
84
88
|
/** Remembers the column widths readers drag (the borders in the header) and the columns they hide or show, in
|
|
85
|
-
* localStorage under this name (ui-dt-width:<
|
|
89
|
+
* localStorage under this name (ui-dt-width:<storageKey>, ui-dt-cols:<storageKey>). Without it they go back to the
|
|
86
90
|
* defaults when the page reloads. resetKey does not clear them: they are the reader's own; 「欄位」 → 「還原預設」 does. */
|
|
91
|
+
storageKey?: string;
|
|
92
|
+
/** @deprecated Renamed `storageKey`, like every other component that remembers a choice; the stored values carry over. */
|
|
87
93
|
widthKey?: string;
|
|
88
94
|
/** 「放大表格」 in the 「⋯」 menu: the whole table, with its search, filters, sort and pages, in a dialog up to
|
|
89
95
|
* 1200 px wide. A click on a link inside closes the dialog. Not on phones. Default true. */
|
|
@@ -97,6 +103,7 @@ export interface DataTableProps<R extends Row = Record<string, unknown>> {
|
|
|
97
103
|
onCopyError?: () => void;
|
|
98
104
|
/** Default 「沒有符合的資料」. */
|
|
99
105
|
emptyText?: string;
|
|
106
|
+
/** Extra class on the root element. */
|
|
100
107
|
className?: string;
|
|
101
108
|
}
|
|
102
109
|
/** The table for records: sort, search, filters, page numbers, selection with a bulk bar, row actions; cards on phones. */
|