@seanyeh77/ui 0.41.0 → 0.43.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -0
- package/dist/announce.d.ts +3 -0
- package/dist/announce.js +35 -0
- package/dist/announce.js.map +1 -0
- package/dist/bundle.js +24 -24
- package/dist/bundle.js.map +1 -1
- package/dist/components/AccentPicker/AccentPicker.d.ts +12 -0
- package/dist/components/AccentPicker/AccentPicker.js +99 -0
- package/dist/components/AccentPicker/AccentPicker.js.map +1 -0
- package/dist/components/ActionBar/ActionBar.d.ts +27 -0
- package/dist/components/ActionBar/ActionBar.js +62 -0
- package/dist/components/ActionBar/ActionBar.js.map +1 -0
- package/dist/components/AiMark/AiMark.d.ts +10 -0
- package/dist/components/AiMark/AiMark.js +21 -0
- package/dist/components/AiMark/AiMark.js.map +1 -0
- package/dist/components/Alert/Alert.d.ts +17 -0
- package/dist/components/Alert/Alert.js +59 -0
- package/dist/components/Alert/Alert.js.map +1 -0
- package/dist/components/AppShell/AppShell.d.ts +36 -0
- package/dist/components/AppShell/AppShell.js +198 -0
- package/dist/components/AppShell/AppShell.js.map +1 -0
- package/dist/components/Badge/Badge.d.ts +12 -0
- package/dist/components/Badge/Badge.js +58 -0
- package/dist/components/Badge/Badge.js.map +1 -0
- package/dist/components/BarChart/BarChart.d.ts +19 -0
- package/dist/components/BarChart/BarChart.js +78 -0
- package/dist/components/BarChart/BarChart.js.map +1 -0
- package/dist/components/Breadcrumb/Breadcrumb.d.ts +11 -0
- package/dist/components/Breadcrumb/Breadcrumb.js +29 -0
- package/dist/components/Breadcrumb/Breadcrumb.js.map +1 -0
- package/dist/components/Button/Button.d.ts +39 -0
- package/dist/components/Button/Button.js +55 -0
- package/dist/components/Button/Button.js.map +1 -0
- package/dist/components/Calendar/Calendar.d.ts +18 -0
- package/dist/components/Calendar/Calendar.js +129 -0
- package/dist/components/Calendar/Calendar.js.map +1 -0
- package/dist/components/Card/Card.d.ts +14 -0
- package/dist/components/Card/Card.js +33 -0
- package/dist/components/Card/Card.js.map +1 -0
- package/dist/components/Checkbox/Checkbox.d.ts +14 -0
- package/dist/components/Checkbox/Checkbox.js +27 -0
- package/dist/components/Checkbox/Checkbox.js.map +1 -0
- package/dist/components/CodeView/CodeView.d.ts +111 -0
- package/dist/components/CodeView/CodeView.js +794 -0
- package/dist/components/CodeView/CodeView.js.map +1 -0
- package/dist/components/CodeView/tokens.d.ts +5 -0
- package/dist/components/CodeView/tokens.js +70 -0
- package/dist/components/CodeView/tokens.js.map +1 -0
- package/dist/components/CommandPalette/CommandPalette.d.ts +52 -0
- package/dist/components/CommandPalette/CommandPalette.js +250 -0
- package/dist/components/CommandPalette/CommandPalette.js.map +1 -0
- package/dist/components/ConsoleLayout/ConsoleLayout.d.ts +44 -0
- package/dist/components/ConsoleLayout/ConsoleLayout.js +123 -0
- package/dist/components/ConsoleLayout/ConsoleLayout.js.map +1 -0
- package/dist/components/DangerZone/DangerZone.d.ts +16 -0
- package/dist/components/DangerZone/DangerZone.js +28 -0
- package/dist/components/DangerZone/DangerZone.js.map +1 -0
- package/dist/components/DataTable/DataTable.d.ts +99 -0
- package/dist/components/DataTable/DataTable.js +1272 -0
- package/dist/components/DataTable/DataTable.js.map +1 -0
- package/dist/components/DataTable/SortButton.js +228 -0
- package/dist/components/DataTable/SortButton.js.map +1 -0
- package/dist/components/DataTable/filters.js +147 -0
- package/dist/components/DataTable/filters.js.map +1 -0
- package/dist/components/DataTable/parts.js +383 -0
- package/dist/components/DataTable/parts.js.map +1 -0
- package/dist/components/DataTable/types.d.ts +85 -0
- package/dist/components/DatePicker/DatePicker.d.ts +15 -0
- package/dist/components/DatePicker/DatePicker.js +107 -0
- package/dist/components/DatePicker/DatePicker.js.map +1 -0
- package/dist/components/DateRangePicker/DateRangePicker.d.ts +11 -0
- package/dist/components/DateRangePicker/DateRangePicker.js +91 -0
- package/dist/components/DateRangePicker/DateRangePicker.js.map +1 -0
- package/dist/components/DetailList/DetailList.d.ts +17 -0
- package/dist/components/DetailList/DetailList.js +18 -0
- package/dist/components/DetailList/DetailList.js.map +1 -0
- package/dist/components/Dialog/Dialog.d.ts +30 -0
- package/dist/components/Dialog/Dialog.js +90 -0
- package/dist/components/Dialog/Dialog.js.map +1 -0
- package/dist/components/Drawer/Drawer.d.ts +20 -0
- package/dist/components/Drawer/Drawer.js +67 -0
- package/dist/components/Drawer/Drawer.js.map +1 -0
- package/dist/components/EmptyState/EmptyState.d.ts +15 -0
- package/dist/components/EmptyState/EmptyState.js +34 -0
- package/dist/components/EmptyState/EmptyState.js.map +1 -0
- package/dist/components/ErrorPage/ErrorPage.d.ts +14 -0
- package/dist/components/ErrorPage/ErrorPage.js +47 -0
- package/dist/components/ErrorPage/ErrorPage.js.map +1 -0
- package/dist/components/EventTimeline/EventTimeline.d.ts +19 -0
- package/dist/components/EventTimeline/EventTimeline.js +69 -0
- package/dist/components/EventTimeline/EventTimeline.js.map +1 -0
- package/dist/components/FileUpload/FileUpload.d.ts +27 -0
- package/dist/components/FileUpload/FileUpload.js +126 -0
- package/dist/components/FileUpload/FileUpload.js.map +1 -0
- package/dist/components/FormGrid/FormGrid.d.ts +7 -0
- package/dist/components/FormGrid/FormGrid.js +14 -0
- package/dist/components/FormGrid/FormGrid.js.map +1 -0
- package/dist/components/Graph/Graph.d.ts +18 -0
- package/dist/components/Graph/Graph.js +97 -0
- package/dist/components/Graph/Graph.js.map +1 -0
- package/dist/components/Grid/Grid.d.ts +16 -0
- package/dist/components/Grid/Grid.js +21 -0
- package/dist/components/Grid/Grid.js.map +1 -0
- package/dist/components/IconButton/IconButton.d.ts +32 -0
- package/dist/components/IconButton/IconButton.js +107 -0
- package/dist/components/IconButton/IconButton.js.map +1 -0
- package/dist/components/InlineCode/InlineCode.d.ts +46 -0
- package/dist/components/InlineCode/InlineCode.js +71 -0
- package/dist/components/InlineCode/InlineCode.js.map +1 -0
- package/dist/components/KpiCard/KpiCard.d.ts +38 -0
- package/dist/components/KpiCard/KpiCard.js +116 -0
- package/dist/components/KpiCard/KpiCard.js.map +1 -0
- package/dist/components/LayerGraph/LayerGraph.d.ts +117 -0
- package/dist/components/LayerGraph/LayerGraph.js +1648 -0
- package/dist/components/LayerGraph/LayerGraph.js.map +1 -0
- package/dist/components/LineChart/LineChart.d.ts +73 -0
- package/dist/components/LineChart/LineChart.js +337 -0
- package/dist/components/LineChart/LineChart.js.map +1 -0
- package/dist/components/LoadingBar/LoadingBar.d.ts +7 -0
- package/dist/components/LoadingBar/LoadingBar.js +18 -0
- package/dist/components/LoadingBar/LoadingBar.js.map +1 -0
- package/dist/components/LoginCard/LoginCard.d.ts +23 -0
- package/dist/components/LoginCard/LoginCard.js +117 -0
- package/dist/components/LoginCard/LoginCard.js.map +1 -0
- package/dist/components/Markdown/Markdown.d.ts +38 -0
- package/dist/components/Markdown/Markdown.js +719 -0
- package/dist/components/Markdown/Markdown.js.map +1 -0
- package/dist/components/Menu/Menu.d.ts +33 -0
- package/dist/components/Menu/Menu.js +78 -0
- package/dist/components/Menu/Menu.js.map +1 -0
- package/dist/components/Meter/Meter.d.ts +20 -0
- package/dist/components/Meter/Meter.js +120 -0
- package/dist/components/Meter/Meter.js.map +1 -0
- package/dist/components/MobileTabBar/MobileTabBar.d.ts +21 -0
- package/dist/components/MobileTabBar/MobileTabBar.js +47 -0
- package/dist/components/MobileTabBar/MobileTabBar.js.map +1 -0
- package/dist/components/MultiSelect/MultiSelect.d.ts +25 -0
- package/dist/components/MultiSelect/MultiSelect.js +119 -0
- package/dist/components/MultiSelect/MultiSelect.js.map +1 -0
- package/dist/components/NotificationBell/NotificationBell.d.ts +20 -0
- package/dist/components/NotificationBell/NotificationBell.js +95 -0
- package/dist/components/NotificationBell/NotificationBell.js.map +1 -0
- package/dist/components/Popover/Popover.d.ts +20 -0
- package/dist/components/Popover/Popover.js +48 -0
- package/dist/components/Popover/Popover.js.map +1 -0
- package/dist/components/ProgressBar/ProgressBar.d.ts +10 -0
- package/dist/components/ProgressBar/ProgressBar.js +38 -0
- package/dist/components/ProgressBar/ProgressBar.js.map +1 -0
- package/dist/components/ProgressRing/ProgressRing.d.ts +11 -0
- package/dist/components/ProgressRing/ProgressRing.js +53 -0
- package/dist/components/ProgressRing/ProgressRing.js.map +1 -0
- package/dist/components/ProjectSwitcher/ProjectSwitcher.d.ts +25 -0
- package/dist/components/ProjectSwitcher/ProjectSwitcher.js +100 -0
- package/dist/components/ProjectSwitcher/ProjectSwitcher.js.map +1 -0
- package/dist/components/RadioGroup/RadioGroup.d.ts +18 -0
- package/dist/components/RadioGroup/RadioGroup.js +63 -0
- package/dist/components/RadioGroup/RadioGroup.js.map +1 -0
- package/dist/components/SearchField/SearchField.d.ts +9 -0
- package/dist/components/SearchField/SearchField.js +50 -0
- package/dist/components/SearchField/SearchField.js.map +1 -0
- package/dist/components/Section/Section.d.ts +50 -0
- package/dist/components/Section/Section.js +225 -0
- package/dist/components/Section/Section.js.map +1 -0
- package/dist/components/SegmentedControl/SegmentedControl.d.ts +23 -0
- package/dist/components/SegmentedControl/SegmentedControl.js +86 -0
- package/dist/components/SegmentedControl/SegmentedControl.js.map +1 -0
- package/dist/components/Select/Select.d.ts +31 -0
- package/dist/components/Select/Select.js +143 -0
- package/dist/components/Select/Select.js.map +1 -0
- package/dist/components/SettingsLayout/SettingsLayout.d.ts +27 -0
- package/dist/components/SettingsLayout/SettingsLayout.js +69 -0
- package/dist/components/SettingsLayout/SettingsLayout.js.map +1 -0
- package/dist/components/SideNav/SideNav.d.ts +48 -0
- package/dist/components/SideNav/SideNav.js +225 -0
- package/dist/components/SideNav/SideNav.js.map +1 -0
- package/dist/components/Skeleton/Skeleton.d.ts +8 -0
- package/dist/components/Skeleton/Skeleton.js +17 -0
- package/dist/components/Skeleton/Skeleton.js.map +1 -0
- package/dist/components/SplitPane/SplitPane.d.ts +23 -0
- package/dist/components/SplitPane/SplitPane.js +140 -0
- package/dist/components/SplitPane/SplitPane.js.map +1 -0
- package/dist/components/StatusBand/StatusBand.d.ts +31 -0
- package/dist/components/StatusBand/StatusBand.js +43 -0
- package/dist/components/StatusBand/StatusBand.js.map +1 -0
- package/dist/components/Suggestion/Suggestion.d.ts +22 -0
- package/dist/components/Suggestion/Suggestion.js +75 -0
- package/dist/components/Suggestion/Suggestion.js.map +1 -0
- package/dist/components/Switch/Switch.d.ts +11 -0
- package/dist/components/Switch/Switch.js +56 -0
- package/dist/components/Switch/Switch.js.map +1 -0
- package/dist/components/Tabs/Tabs.d.ts +23 -0
- package/dist/components/Tabs/Tabs.js +117 -0
- package/dist/components/Tabs/Tabs.js.map +1 -0
- package/dist/components/Tag/Tag.d.ts +13 -0
- package/dist/components/Tag/Tag.js +26 -0
- package/dist/components/Tag/Tag.js.map +1 -0
- package/dist/components/Term/Term.d.ts +34 -0
- package/dist/components/Term/Term.js +143 -0
- package/dist/components/Term/Term.js.map +1 -0
- package/dist/components/TextArea/TextArea.d.ts +15 -0
- package/dist/components/TextArea/TextArea.js +75 -0
- package/dist/components/TextArea/TextArea.js.map +1 -0
- package/dist/components/TextField/TextField.d.ts +15 -0
- package/dist/components/TextField/TextField.js +43 -0
- package/dist/components/TextField/TextField.js.map +1 -0
- package/dist/components/ThemePicker/ThemePicker.d.ts +13 -0
- package/dist/components/ThemePicker/ThemePicker.js +66 -0
- package/dist/components/ThemePicker/ThemePicker.js.map +1 -0
- package/dist/components/TimeControl/TimeControl.d.ts +19 -0
- package/dist/components/TimeControl/TimeControl.js +47 -0
- package/dist/components/TimeControl/TimeControl.js.map +1 -0
- package/dist/components/Toast/Toast.d.ts +10 -0
- package/dist/components/Toast/Toast.js +30 -0
- package/dist/components/Toast/Toast.js.map +1 -0
- package/dist/components/Tooltip/Tooltip.d.ts +17 -0
- package/dist/components/Tooltip/Tooltip.js +69 -0
- package/dist/components/Tooltip/Tooltip.js.map +1 -0
- package/dist/components/TopBar/TopBar.d.ts +18 -0
- package/dist/components/TopBar/TopBar.js +59 -0
- package/dist/components/TopBar/TopBar.js.map +1 -0
- package/dist/components/Tour/Tour.d.ts +44 -0
- package/dist/components/Tour/Tour.js +440 -0
- package/dist/components/Tour/Tour.js.map +1 -0
- package/dist/components/TreeList/TreeList.d.ts +90 -0
- package/dist/components/TreeList/TreeList.js +594 -0
- package/dist/components/TreeList/TreeList.js.map +1 -0
- package/dist/components/TreeList/helpers.d.ts +2 -0
- package/dist/components/TreeList/helpers.js +104 -0
- package/dist/components/TreeList/helpers.js.map +1 -0
- package/dist/components/Workbench/Workbench.d.ts +100 -0
- package/dist/components/Workbench/Workbench.js +1142 -0
- package/dist/components/Workbench/Workbench.js.map +1 -0
- package/dist/components/ZoneMap/ZoneMap.d.ts +49 -0
- package/dist/components/ZoneMap/ZoneMap.js +89 -0
- package/dist/components/ZoneMap/ZoneMap.js.map +1 -0
- package/dist/css/AccentPicker.css +49 -0
- package/dist/css/ActionBar.css +36 -0
- package/dist/css/AiMark.css +14 -0
- package/dist/css/Alert.css +80 -0
- package/dist/css/AppShell.css +81 -0
- package/dist/css/Badge.css +68 -0
- package/dist/css/BarChart.css +66 -0
- package/dist/css/Breadcrumb.css +33 -0
- package/dist/css/Button.css +190 -0
- package/dist/css/Calendar.css +96 -0
- package/dist/css/Card.css +70 -0
- package/dist/css/Checkbox.css +38 -0
- package/dist/css/CodeView.css +302 -0
- package/dist/css/CommandPalette.css +232 -0
- package/dist/css/ConsoleLayout.css +131 -0
- package/dist/css/DangerZone.css +32 -0
- package/dist/css/DataTable.css +1195 -0
- package/dist/css/DatePicker.css +38 -0
- package/dist/css/DateRangePicker.css +70 -0
- package/dist/css/DetailList.css +69 -0
- package/dist/css/Dialog.css +3 -0
- package/dist/css/Drawer.css +90 -0
- package/dist/css/EmptyState.css +61 -0
- package/dist/css/ErrorPage.css +40 -0
- package/dist/css/EventTimeline.css +43 -0
- package/dist/css/FileUpload.css +92 -0
- package/dist/css/FormGrid.css +17 -0
- package/dist/css/Graph.css +99 -0
- package/dist/css/Grid.css +48 -0
- package/dist/css/IconButton.css +149 -0
- package/dist/css/InlineCode.css +92 -0
- package/dist/css/KpiCard.css +121 -0
- package/dist/css/LayerGraph.css +575 -0
- package/dist/css/LineChart.css +3 -0
- package/dist/css/LoadingBar.css +45 -0
- package/dist/css/LoginCard.css +65 -0
- package/dist/css/Markdown.css +266 -0
- package/dist/css/Menu.css +88 -0
- package/dist/css/Meter.css +110 -0
- package/dist/css/MobileTabBar.css +63 -0
- package/dist/css/MultiSelect.css +78 -0
- package/dist/css/NotificationBell.css +129 -0
- package/dist/css/Popover.css +57 -0
- package/dist/css/ProgressBar.css +42 -0
- package/dist/css/ProgressRing.css +19 -0
- package/dist/css/ProjectSwitcher.css +153 -0
- package/dist/css/RadioGroup.css +52 -0
- package/dist/css/SearchField.css +79 -0
- package/dist/css/Section.css +115 -0
- package/dist/css/SegmentedControl.css +67 -0
- package/dist/css/Select.css +136 -0
- package/dist/css/SettingsLayout.css +110 -0
- package/dist/css/SideNav.css +281 -0
- package/dist/css/Skeleton.css +19 -0
- package/dist/css/SplitPane.css +108 -0
- package/dist/css/StatusBand.css +23 -0
- package/dist/css/Suggestion.css +82 -0
- package/dist/css/Switch.css +46 -0
- package/dist/css/Tabs.css +91 -0
- package/dist/css/Tag.css +36 -0
- package/dist/css/Term.css +160 -0
- package/dist/css/TextArea.css +22 -0
- package/dist/css/TextField.css +2 -0
- package/dist/css/ThemePicker.css +70 -0
- package/dist/css/TimeControl.css +33 -0
- package/dist/css/Toast.css +47 -0
- package/dist/css/Tooltip.css +58 -0
- package/dist/css/TopBar.css +86 -0
- package/dist/css/Tour.css +90 -0
- package/dist/css/TreeList.css +532 -0
- package/dist/css/Workbench.css +652 -0
- package/dist/css/ZoneMap.css +203 -0
- package/dist/css/base.css +556 -0
- package/dist/css/end.css +273 -0
- package/dist/format-entry.d.ts +3 -0
- package/dist/format-entry.js +3 -0
- package/dist/format.d.ts +68 -2
- package/dist/format.js +237 -1
- package/dist/format.js.map +1 -0
- package/dist/i18n.d.ts +11 -0
- package/dist/{format-entry-CyChe8bk.js → i18n.js} +2 -235
- package/dist/i18n.js.map +1 -0
- package/dist/icons/Icon.d.ts +24 -0
- package/dist/icons/Icon.js +66 -0
- package/dist/icons/Icon.js.map +1 -0
- package/dist/icons/Spinner.js +18 -0
- package/dist/icons/Spinner.js.map +1 -0
- package/dist/icons/all.js +212 -0
- package/dist/icons/all.js.map +1 -0
- package/dist/icons/map.d.ts +3 -0
- package/dist/icons/map.js +31 -0
- package/dist/icons/map.js.map +1 -0
- package/dist/icons/names.d.ts +253 -0
- package/dist/icons/names.js +153 -0
- package/dist/icons/names.js.map +1 -0
- package/dist/icons/ph/archive.d.ts +10 -0
- package/dist/icons/ph/archive.js +11 -0
- package/dist/icons/ph/archive.js.map +1 -0
- package/dist/icons/ph/arrow-down.d.ts +10 -0
- package/dist/icons/ph/arrow-down.js +11 -0
- package/dist/icons/ph/arrow-down.js.map +1 -0
- package/dist/icons/ph/arrow-left.d.ts +10 -0
- package/dist/icons/ph/arrow-left.js +11 -0
- package/dist/icons/ph/arrow-left.js.map +1 -0
- package/dist/icons/ph/arrow-right.d.ts +10 -0
- package/dist/icons/ph/arrow-right.js +11 -0
- package/dist/icons/ph/arrow-right.js.map +1 -0
- package/dist/icons/ph/arrow-square-out.d.ts +10 -0
- package/dist/icons/ph/arrow-square-out.js +11 -0
- package/dist/icons/ph/arrow-square-out.js.map +1 -0
- package/dist/icons/ph/arrow-u-up-left.d.ts +10 -0
- package/dist/icons/ph/arrow-u-up-left.js +11 -0
- package/dist/icons/ph/arrow-u-up-left.js.map +1 -0
- package/dist/icons/ph/arrow-u-up-right.d.ts +10 -0
- package/dist/icons/ph/arrow-u-up-right.js +11 -0
- package/dist/icons/ph/arrow-u-up-right.js.map +1 -0
- package/dist/icons/ph/arrow-up.d.ts +10 -0
- package/dist/icons/ph/arrow-up.js +11 -0
- package/dist/icons/ph/arrow-up.js.map +1 -0
- package/dist/icons/ph/arrows-clockwise.d.ts +10 -0
- package/dist/icons/ph/arrows-clockwise.js +11 -0
- package/dist/icons/ph/arrows-clockwise.js.map +1 -0
- package/dist/icons/ph/arrows-in-line-vertical.d.ts +10 -0
- package/dist/icons/ph/arrows-in-line-vertical.js +11 -0
- package/dist/icons/ph/arrows-in-line-vertical.js.map +1 -0
- package/dist/icons/ph/arrows-left-right.d.ts +10 -0
- package/dist/icons/ph/arrows-left-right.js +11 -0
- package/dist/icons/ph/arrows-left-right.js.map +1 -0
- package/dist/icons/ph/arrows-out-line-vertical.d.ts +10 -0
- package/dist/icons/ph/arrows-out-line-vertical.js +11 -0
- package/dist/icons/ph/arrows-out-line-vertical.js.map +1 -0
- package/dist/icons/ph/bell.d.ts +10 -0
- package/dist/icons/ph/bell.js +11 -0
- package/dist/icons/ph/bell.js.map +1 -0
- package/dist/icons/ph/brackets-curly.d.ts +10 -0
- package/dist/icons/ph/brackets-curly.js +11 -0
- package/dist/icons/ph/brackets-curly.js.map +1 -0
- package/dist/icons/ph/calendar-blank.d.ts +10 -0
- package/dist/icons/ph/calendar-blank.js +11 -0
- package/dist/icons/ph/calendar-blank.js.map +1 -0
- package/dist/icons/ph/caret-down.d.ts +10 -0
- package/dist/icons/ph/caret-down.js +11 -0
- package/dist/icons/ph/caret-down.js.map +1 -0
- package/dist/icons/ph/caret-left.d.ts +10 -0
- package/dist/icons/ph/caret-left.js +11 -0
- package/dist/icons/ph/caret-left.js.map +1 -0
- package/dist/icons/ph/caret-right.d.ts +10 -0
- package/dist/icons/ph/caret-right.js +11 -0
- package/dist/icons/ph/caret-right.js.map +1 -0
- package/dist/icons/ph/caret-up.d.ts +10 -0
- package/dist/icons/ph/caret-up.js +11 -0
- package/dist/icons/ph/caret-up.js.map +1 -0
- package/dist/icons/ph/chart-bar.d.ts +10 -0
- package/dist/icons/ph/chart-bar.js +11 -0
- package/dist/icons/ph/chart-bar.js.map +1 -0
- package/dist/icons/ph/chart-line.d.ts +10 -0
- package/dist/icons/ph/chart-line.js +11 -0
- package/dist/icons/ph/chart-line.js.map +1 -0
- package/dist/icons/ph/chart-pie.d.ts +10 -0
- package/dist/icons/ph/chart-pie.js +11 -0
- package/dist/icons/ph/chart-pie.js.map +1 -0
- package/dist/icons/ph/chat-centered.d.ts +10 -0
- package/dist/icons/ph/chat-centered.js +11 -0
- package/dist/icons/ph/chat-centered.js.map +1 -0
- package/dist/icons/ph/check-circle.d.ts +10 -0
- package/dist/icons/ph/check-circle.js +11 -0
- package/dist/icons/ph/check-circle.js.map +1 -0
- package/dist/icons/ph/check-square.d.ts +10 -0
- package/dist/icons/ph/check-square.js +11 -0
- package/dist/icons/ph/check-square.js.map +1 -0
- package/dist/icons/ph/check.d.ts +10 -0
- package/dist/icons/ph/check.js +11 -0
- package/dist/icons/ph/check.js.map +1 -0
- package/dist/icons/ph/circle-notch.d.ts +10 -0
- package/dist/icons/ph/circle-notch.js +11 -0
- package/dist/icons/ph/circle-notch.js.map +1 -0
- package/dist/icons/ph/clock.d.ts +10 -0
- package/dist/icons/ph/clock.js +11 -0
- package/dist/icons/ph/clock.js.map +1 -0
- package/dist/icons/ph/cloud.d.ts +10 -0
- package/dist/icons/ph/cloud.js +11 -0
- package/dist/icons/ph/cloud.js.map +1 -0
- package/dist/icons/ph/columns.d.ts +10 -0
- package/dist/icons/ph/columns.js +11 -0
- package/dist/icons/ph/columns.js.map +1 -0
- package/dist/icons/ph/command.d.ts +10 -0
- package/dist/icons/ph/command.js +11 -0
- package/dist/icons/ph/command.js.map +1 -0
- package/dist/icons/ph/copy.d.ts +10 -0
- package/dist/icons/ph/copy.js +11 -0
- package/dist/icons/ph/copy.js.map +1 -0
- package/dist/icons/ph/corners-in.d.ts +10 -0
- package/dist/icons/ph/corners-in.js +11 -0
- package/dist/icons/ph/corners-in.js.map +1 -0
- package/dist/icons/ph/corners-out.d.ts +10 -0
- package/dist/icons/ph/corners-out.js +11 -0
- package/dist/icons/ph/corners-out.js.map +1 -0
- package/dist/icons/ph/cpu.d.ts +10 -0
- package/dist/icons/ph/cpu.js +11 -0
- package/dist/icons/ph/cpu.js.map +1 -0
- package/dist/icons/ph/database.d.ts +10 -0
- package/dist/icons/ph/database.js +11 -0
- package/dist/icons/ph/database.js.map +1 -0
- package/dist/icons/ph/dots-six-vertical.d.ts +10 -0
- package/dist/icons/ph/dots-six-vertical.js +11 -0
- package/dist/icons/ph/dots-six-vertical.js.map +1 -0
- package/dist/icons/ph/dots-three-vertical.d.ts +10 -0
- package/dist/icons/ph/dots-three-vertical.js +11 -0
- package/dist/icons/ph/dots-three-vertical.js.map +1 -0
- package/dist/icons/ph/dots-three.d.ts +10 -0
- package/dist/icons/ph/dots-three.js +11 -0
- package/dist/icons/ph/dots-three.js.map +1 -0
- package/dist/icons/ph/download-simple.d.ts +10 -0
- package/dist/icons/ph/download-simple.js +11 -0
- package/dist/icons/ph/download-simple.js.map +1 -0
- package/dist/icons/ph/envelope-simple.d.ts +10 -0
- package/dist/icons/ph/envelope-simple.js +11 -0
- package/dist/icons/ph/envelope-simple.js.map +1 -0
- package/dist/icons/ph/eye-slash.d.ts +10 -0
- package/dist/icons/ph/eye-slash.js +11 -0
- package/dist/icons/ph/eye-slash.js.map +1 -0
- package/dist/icons/ph/eye.d.ts +10 -0
- package/dist/icons/ph/eye.js +11 -0
- package/dist/icons/ph/eye.js.map +1 -0
- package/dist/icons/ph/file-code.d.ts +10 -0
- package/dist/icons/ph/file-code.js +11 -0
- package/dist/icons/ph/file-code.js.map +1 -0
- package/dist/icons/ph/file-text.d.ts +10 -0
- package/dist/icons/ph/file-text.js +11 -0
- package/dist/icons/ph/file-text.js.map +1 -0
- package/dist/icons/ph/file.d.ts +10 -0
- package/dist/icons/ph/file.js +11 -0
- package/dist/icons/ph/file.js.map +1 -0
- package/dist/icons/ph/floppy-disk.d.ts +10 -0
- package/dist/icons/ph/floppy-disk.js +11 -0
- package/dist/icons/ph/floppy-disk.js.map +1 -0
- package/dist/icons/ph/folder-open.d.ts +10 -0
- package/dist/icons/ph/folder-open.js +11 -0
- package/dist/icons/ph/folder-open.js.map +1 -0
- package/dist/icons/ph/folder.d.ts +10 -0
- package/dist/icons/ph/folder.js +11 -0
- package/dist/icons/ph/folder.js.map +1 -0
- package/dist/icons/ph/function.d.ts +10 -0
- package/dist/icons/ph/function.js +11 -0
- package/dist/icons/ph/function.js.map +1 -0
- package/dist/icons/ph/funnel.d.ts +10 -0
- package/dist/icons/ph/funnel.js +11 -0
- package/dist/icons/ph/funnel.js.map +1 -0
- package/dist/icons/ph/gauge.d.ts +10 -0
- package/dist/icons/ph/gauge.js +11 -0
- package/dist/icons/ph/gauge.js.map +1 -0
- package/dist/icons/ph/gear.d.ts +10 -0
- package/dist/icons/ph/gear.js +11 -0
- package/dist/icons/ph/gear.js.map +1 -0
- package/dist/icons/ph/globe.d.ts +10 -0
- package/dist/icons/ph/globe.js +11 -0
- package/dist/icons/ph/globe.js.map +1 -0
- package/dist/icons/ph/hard-drives.d.ts +10 -0
- package/dist/icons/ph/hard-drives.js +11 -0
- package/dist/icons/ph/hard-drives.js.map +1 -0
- package/dist/icons/ph/hash.d.ts +10 -0
- package/dist/icons/ph/hash.js +11 -0
- package/dist/icons/ph/hash.js.map +1 -0
- package/dist/icons/ph/heart.d.ts +10 -0
- package/dist/icons/ph/heart.js +11 -0
- package/dist/icons/ph/heart.js.map +1 -0
- package/dist/icons/ph/house.d.ts +10 -0
- package/dist/icons/ph/house.js +11 -0
- package/dist/icons/ph/house.js.map +1 -0
- package/dist/icons/ph/image.d.ts +10 -0
- package/dist/icons/ph/image.js +11 -0
- package/dist/icons/ph/image.js.map +1 -0
- package/dist/icons/ph/info.d.ts +10 -0
- package/dist/icons/ph/info.js +11 -0
- package/dist/icons/ph/info.js.map +1 -0
- package/dist/icons/ph/key.d.ts +10 -0
- package/dist/icons/ph/key.js +11 -0
- package/dist/icons/ph/key.js.map +1 -0
- package/dist/icons/ph/keyboard.d.ts +10 -0
- package/dist/icons/ph/keyboard.js +11 -0
- package/dist/icons/ph/keyboard.js.map +1 -0
- package/dist/icons/ph/layout.d.ts +10 -0
- package/dist/icons/ph/layout.js +11 -0
- package/dist/icons/ph/layout.js.map +1 -0
- package/dist/icons/ph/link.d.ts +10 -0
- package/dist/icons/ph/link.js +11 -0
- package/dist/icons/ph/link.js.map +1 -0
- package/dist/icons/ph/list-bullets.d.ts +10 -0
- package/dist/icons/ph/list-bullets.js +11 -0
- package/dist/icons/ph/list-bullets.js.map +1 -0
- package/dist/icons/ph/list.d.ts +10 -0
- package/dist/icons/ph/list.js +11 -0
- package/dist/icons/ph/list.js.map +1 -0
- package/dist/icons/ph/lock.d.ts +10 -0
- package/dist/icons/ph/lock.js +11 -0
- package/dist/icons/ph/lock.js.map +1 -0
- package/dist/icons/ph/magnifying-glass.d.ts +10 -0
- package/dist/icons/ph/magnifying-glass.js +11 -0
- package/dist/icons/ph/magnifying-glass.js.map +1 -0
- package/dist/icons/ph/minus.d.ts +10 -0
- package/dist/icons/ph/minus.js +11 -0
- package/dist/icons/ph/minus.js.map +1 -0
- package/dist/icons/ph/monitor.d.ts +10 -0
- package/dist/icons/ph/monitor.js +11 -0
- package/dist/icons/ph/monitor.js.map +1 -0
- package/dist/icons/ph/moon.d.ts +10 -0
- package/dist/icons/ph/moon.js +11 -0
- package/dist/icons/ph/moon.js.map +1 -0
- package/dist/icons/ph/paper-plane-tilt.d.ts +10 -0
- package/dist/icons/ph/paper-plane-tilt.js +11 -0
- package/dist/icons/ph/paper-plane-tilt.js.map +1 -0
- package/dist/icons/ph/pencil-simple.d.ts +10 -0
- package/dist/icons/ph/pencil-simple.js +11 -0
- package/dist/icons/ph/pencil-simple.js.map +1 -0
- package/dist/icons/ph/plus.d.ts +10 -0
- package/dist/icons/ph/plus.js +11 -0
- package/dist/icons/ph/plus.js.map +1 -0
- package/dist/icons/ph/printer.d.ts +10 -0
- package/dist/icons/ph/printer.js +11 -0
- package/dist/icons/ph/printer.js.map +1 -0
- package/dist/icons/ph/pulse.d.ts +10 -0
- package/dist/icons/ph/pulse.js +11 -0
- package/dist/icons/ph/pulse.js.map +1 -0
- package/dist/icons/ph/push-pin.d.ts +10 -0
- package/dist/icons/ph/push-pin.js +11 -0
- package/dist/icons/ph/push-pin.js.map +1 -0
- package/dist/icons/ph/question.d.ts +10 -0
- package/dist/icons/ph/question.js +11 -0
- package/dist/icons/ph/question.js.map +1 -0
- package/dist/icons/ph/share-network.d.ts +10 -0
- package/dist/icons/ph/share-network.js +11 -0
- package/dist/icons/ph/share-network.js.map +1 -0
- package/dist/icons/ph/shield.d.ts +10 -0
- package/dist/icons/ph/shield.js +11 -0
- package/dist/icons/ph/shield.js.map +1 -0
- package/dist/icons/ph/sidebar-simple.d.ts +10 -0
- package/dist/icons/ph/sidebar-simple.js +11 -0
- package/dist/icons/ph/sidebar-simple.js.map +1 -0
- package/dist/icons/ph/sign-in.d.ts +10 -0
- package/dist/icons/ph/sign-in.js +11 -0
- package/dist/icons/ph/sign-in.js.map +1 -0
- package/dist/icons/ph/sign-out.d.ts +10 -0
- package/dist/icons/ph/sign-out.js +11 -0
- package/dist/icons/ph/sign-out.js.map +1 -0
- package/dist/icons/ph/sliders-horizontal.d.ts +10 -0
- package/dist/icons/ph/sliders-horizontal.js +11 -0
- package/dist/icons/ph/sliders-horizontal.js.map +1 -0
- package/dist/icons/ph/sort-ascending.d.ts +10 -0
- package/dist/icons/ph/sort-ascending.js +11 -0
- package/dist/icons/ph/sort-ascending.js.map +1 -0
- package/dist/icons/ph/sparkle.d.ts +10 -0
- package/dist/icons/ph/sparkle.js +11 -0
- package/dist/icons/ph/sparkle.js.map +1 -0
- package/dist/icons/ph/square.d.ts +10 -0
- package/dist/icons/ph/square.js +11 -0
- package/dist/icons/ph/square.js.map +1 -0
- package/dist/icons/ph/squares-four.d.ts +10 -0
- package/dist/icons/ph/squares-four.js +11 -0
- package/dist/icons/ph/squares-four.js.map +1 -0
- package/dist/icons/ph/stack.d.ts +10 -0
- package/dist/icons/ph/stack.js +11 -0
- package/dist/icons/ph/stack.js.map +1 -0
- package/dist/icons/ph/star.d.ts +10 -0
- package/dist/icons/ph/star.js +11 -0
- package/dist/icons/ph/star.js.map +1 -0
- package/dist/icons/ph/sun.d.ts +10 -0
- package/dist/icons/ph/sun.js +11 -0
- package/dist/icons/ph/sun.js.map +1 -0
- package/dist/icons/ph/tag.d.ts +10 -0
- package/dist/icons/ph/tag.js +11 -0
- package/dist/icons/ph/tag.js.map +1 -0
- package/dist/icons/ph/terminal-window.d.ts +10 -0
- package/dist/icons/ph/terminal-window.js +11 -0
- package/dist/icons/ph/terminal-window.js.map +1 -0
- package/dist/icons/ph/trash.d.ts +10 -0
- package/dist/icons/ph/trash.js +11 -0
- package/dist/icons/ph/trash.js.map +1 -0
- package/dist/icons/ph/trend-up.d.ts +10 -0
- package/dist/icons/ph/trend-up.js +11 -0
- package/dist/icons/ph/trend-up.js.map +1 -0
- package/dist/icons/ph/upload-simple.d.ts +10 -0
- package/dist/icons/ph/upload-simple.js +11 -0
- package/dist/icons/ph/upload-simple.js.map +1 -0
- package/dist/icons/ph/user.d.ts +10 -0
- package/dist/icons/ph/user.js +11 -0
- package/dist/icons/ph/user.js.map +1 -0
- package/dist/icons/ph/users.d.ts +10 -0
- package/dist/icons/ph/users.js +11 -0
- package/dist/icons/ph/users.js.map +1 -0
- package/dist/icons/ph/warning-circle.d.ts +10 -0
- package/dist/icons/ph/warning-circle.js +11 -0
- package/dist/icons/ph/warning-circle.js.map +1 -0
- package/dist/icons/ph/warning.d.ts +10 -0
- package/dist/icons/ph/warning.js +11 -0
- package/dist/icons/ph/warning.js.map +1 -0
- package/dist/icons/ph/x-circle.d.ts +10 -0
- package/dist/icons/ph/x-circle.js +11 -0
- package/dist/icons/ph/x-circle.js.map +1 -0
- package/dist/icons/ph/x.d.ts +10 -0
- package/dist/icons/ph/x.js +11 -0
- package/dist/icons/ph/x.js.map +1 -0
- package/dist/icons/store.d.ts +6 -0
- package/dist/icons/store.js +77 -0
- package/dist/icons/store.js.map +1 -0
- package/dist/index.d.ts +86 -2293
- package/dist/index.js +82 -13349
- package/dist/internal/Field.js +74 -0
- package/dist/internal/Field.js.map +1 -0
- package/dist/internal/FloatingPanel.js +41 -0
- package/dist/internal/FloatingPanel.js.map +1 -0
- package/dist/internal/chart.js +131 -0
- package/dist/internal/chart.js.map +1 -0
- package/dist/internal/dev.js +21 -0
- package/dist/internal/dev.js.map +1 -0
- package/dist/internal/focus.js +94 -0
- package/dist/internal/focus.js.map +1 -0
- package/dist/internal/focusMain.d.ts +4 -0
- package/dist/internal/focusMain.js +22 -0
- package/dist/internal/focusMain.js.map +1 -0
- package/dist/internal/scrollHint.js +78 -0
- package/dist/internal/scrollHint.js.map +1 -0
- package/dist/internal/tableTools.js +114 -0
- package/dist/internal/tableTools.js.map +1 -0
- package/dist/internal/terms.d.ts +18 -0
- package/dist/internal/terms.js +64 -0
- package/dist/internal/terms.js.map +1 -0
- package/dist/internal/util.js +107 -0
- package/dist/internal/util.js.map +1 -0
- package/dist/motion.d.ts +5 -0
- package/dist/motion.js +29 -0
- package/dist/motion.js.map +1 -0
- package/dist/styles.css +4280 -4265
- package/dist/theme.d.ts +20 -0
- package/dist/theme.js +210 -0
- package/dist/theme.js.map +1 -0
- package/dist/tokens.css +4 -0
- package/docs/guidelines.md +1 -0
- package/docs/theme.md +51 -0
- package/package.json +5 -4
- package/dist/format-entry-CgMBtkni.d.ts +0 -79
- package/dist/format-entry-CyChe8bk.js.map +0 -1
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tag.js","names":["phInfo","phTrendUp"],"sources":["../../../src/components/Tag/Tag.tsx"],"sourcesContent":["import type * as React from 'react';\nimport { Icon } from '../../icons/Icon';\nimport { cx } from '../../internal/util';\nimport { includeIcons } from '../../icons/store';\nimport phInfo from '../../icons/ph/info';\nimport phTrendUp from '../../icons/ph/trend-up';\n\nincludeIcons(phInfo, phTrendUp);\n\nexport interface TagProps {\n children?: React.ReactNode;\n /** `plain` (default): small gray text. `forecast`: marks a value as forecast, not measured: a trend icon and the\n * words in accent text, e.g. 「預測」 beside it. `demo`: a whole page of sample values: an info icon and the words in\n * the color of the text beside them, e.g. 「示範資料」 beside the brand; one per page. Both take the size of the text\n * beside them. */\n variant?: 'plain' | 'forecast' | 'demo';\n className?: string;\n}\n\n/** What kind of thing an item is (「外部」「範本」): small gray text. Status uses Badge instead. Two kinds say where\n * numbers come from, with an icon and no fill: forecast and demo. */\nexport function Tag({ children, variant = 'plain', className }: TagProps) {\n return (\n <span className={cx('ui-tag', variant !== 'plain' && 'is-' + variant, className)}>\n {variant === 'forecast' ? <Icon name=\"trend-up\" size={16} /> : variant === 'demo' ? <Icon name=\"info\" size={16} /> : null}\n {children}\n </span>\n );\n}\n"],"mappings":";;;;;;;;AAOA,aAAaA,cAAQC,gBAAS;;;AAc9B,SAAgB,IAAI,EAAE,UAAU,UAAU,SAAS,aAAuB;CACxE,OACE,qBAAC,QAAD;EAAM,WAAW,GAAG,UAAU,YAAY,WAAW,QAAQ,SAAS,SAAS;EAA/E,UAAA,CACG,YAAY,aAAa,oBAAC,MAAD;GAAM,MAAK;GAAW,MAAM;EAAK,CAAA,IAAI,YAAY,SAAS,oBAAC,MAAD;GAAM,MAAK;GAAO,MAAM;EAAK,CAAA,IAAI,MACpH,QACG;;AAEV"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { OnRef, RefHref } from "../InlineCode/InlineCode.js";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
export interface TermProps {
|
|
4
|
+
/** The word or label that needs explaining. */
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
/** Heading of the explanation. Default: children when it is text. */
|
|
7
|
+
title?: string;
|
|
8
|
+
/** The explanation, at most 2 short sentences; `backticks` are code. */
|
|
9
|
+
text?: string;
|
|
10
|
+
/** Other content instead of text. */
|
|
11
|
+
content?: React.ReactNode;
|
|
12
|
+
/** An evidence line, shown as a code block. */
|
|
13
|
+
code?: string;
|
|
14
|
+
/** One link-style action at the bottom. */
|
|
15
|
+
action?: {
|
|
16
|
+
label: string;
|
|
17
|
+
onClick?: () => void;
|
|
18
|
+
};
|
|
19
|
+
refHref?: RefHref;
|
|
20
|
+
onRef?: OnRef;
|
|
21
|
+
isRef?: (span: string) => boolean;
|
|
22
|
+
/** `icon` (default): the word with a small question mark, opened by a press. `inline`: a dashed underline inside a
|
|
23
|
+
* sentence; the card opens after resting on the word for 500 ms, at once on keyboard focus, and as a sheet on phones. */
|
|
24
|
+
variant?: 'icon' | 'inline';
|
|
25
|
+
/** inline only: keyboard focus opens the card at once. Default true; false where arrow keys move between words and
|
|
26
|
+
* Enter opens (CodeView). */
|
|
27
|
+
openOnFocus?: boolean;
|
|
28
|
+
/** -1 inside a widget that moves focus with its own keys (CodeView). */
|
|
29
|
+
tabIndex?: number;
|
|
30
|
+
className?: string;
|
|
31
|
+
}
|
|
32
|
+
/** A word that opens its explanation: a floating card from 600 px, a sheet from the bottom on phones. `icon` adds a small
|
|
33
|
+
* question mark; `inline` marks the word with a dashed underline and opens on hover or keyboard focus. */
|
|
34
|
+
export declare function Term({ children, title, text, content, code, action, refHref, onRef, isRef, variant, openOnFocus, tabIndex, className }: TermProps): React.JSX.Element;
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { CodeText } from "../InlineCode/InlineCode.js";
|
|
3
|
+
import { tr } from "../../i18n.js";
|
|
4
|
+
import { Icon } from "../../icons/Icon.js";
|
|
5
|
+
import { cx, useNarrow } from "../../internal/util.js";
|
|
6
|
+
import { FloatingPanel } from "../../internal/FloatingPanel.js";
|
|
7
|
+
import { includeIcons } from "../../icons/store.js";
|
|
8
|
+
import question_default from "../../icons/ph/question.js";
|
|
9
|
+
import x_default from "../../icons/ph/x.js";
|
|
10
|
+
import * as React from "react";
|
|
11
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
import { Dialog } from "@base-ui/react/dialog";
|
|
13
|
+
import { Popover } from "@base-ui/react/popover";
|
|
14
|
+
// src/components/Term/Term.tsx
|
|
15
|
+
includeIcons(question_default, x_default);
|
|
16
|
+
/** A word that opens its explanation: a floating card from 600 px, a sheet from the bottom on phones. `icon` adds a small
|
|
17
|
+
* question mark; `inline` marks the word with a dashed underline and opens on hover or keyboard focus. */
|
|
18
|
+
function Term({ children, title, text, content, code, action, refHref, onRef, isRef, variant = "icon", openOnFocus = true, tabIndex, className }) {
|
|
19
|
+
const [open, setOpen] = React.useState(false);
|
|
20
|
+
const narrow = useNarrow();
|
|
21
|
+
const inlineV = variant === "inline";
|
|
22
|
+
const cardId = React.useId();
|
|
23
|
+
const ref = React.useRef(null);
|
|
24
|
+
const [inline, setInline] = React.useState(false);
|
|
25
|
+
React.useLayoutEffect(() => {
|
|
26
|
+
const par = ref.current?.parentNode;
|
|
27
|
+
const txt = !!par && Array.from(par.childNodes).some((n) => n.nodeType === 3 && !!n.textContent?.trim());
|
|
28
|
+
setInline(txt);
|
|
29
|
+
}, [children]);
|
|
30
|
+
const block = React.useRef(null);
|
|
31
|
+
const toggle = (next) => {
|
|
32
|
+
if (next) {
|
|
33
|
+
const el = ref.current?.closest(".ui-card, .ui-split-a, .ui-split-b, .ui-shell-main, main") ?? null;
|
|
34
|
+
block.current = el && el.getBoundingClientRect().width >= 240 ? el : null;
|
|
35
|
+
}
|
|
36
|
+
setOpen(next);
|
|
37
|
+
};
|
|
38
|
+
const heading = title || (typeof children === "string" ? children : "");
|
|
39
|
+
const onFocus = (e) => {
|
|
40
|
+
if (openOnFocus && !narrow && e.currentTarget.matches(":focus-visible")) toggle(true);
|
|
41
|
+
};
|
|
42
|
+
const onBlur = (e) => {
|
|
43
|
+
const to = e.relatedTarget;
|
|
44
|
+
if (to && (ref.current?.contains(to) || document.getElementById(cardId)?.contains(to))) return;
|
|
45
|
+
if (!narrow) setOpen(false);
|
|
46
|
+
};
|
|
47
|
+
const trigger = inlineV ? /* @__PURE__ */ jsxs("button", {
|
|
48
|
+
type: "button",
|
|
49
|
+
ref,
|
|
50
|
+
className: cx("ui-term", "is-word", open && "is-open", className),
|
|
51
|
+
tabIndex,
|
|
52
|
+
"aria-describedby": open && !narrow ? cardId : void 0,
|
|
53
|
+
onFocus,
|
|
54
|
+
onBlur,
|
|
55
|
+
children: [children, /* @__PURE__ */ jsx("span", {
|
|
56
|
+
className: "ui-visually-hidden",
|
|
57
|
+
children: tr(",有說明")
|
|
58
|
+
})]
|
|
59
|
+
}) : /* @__PURE__ */ jsxs("button", {
|
|
60
|
+
type: "button",
|
|
61
|
+
ref,
|
|
62
|
+
className: cx("ui-term", inline && "is-inline", open && "is-open", className),
|
|
63
|
+
children: [
|
|
64
|
+
/* @__PURE__ */ jsx("span", {
|
|
65
|
+
className: "ui-visually-hidden",
|
|
66
|
+
children: tr("說明") + " "
|
|
67
|
+
}),
|
|
68
|
+
children,
|
|
69
|
+
/* @__PURE__ */ jsx(Icon, {
|
|
70
|
+
name: "question",
|
|
71
|
+
size: 14,
|
|
72
|
+
className: "ui-term-q"
|
|
73
|
+
})
|
|
74
|
+
]
|
|
75
|
+
});
|
|
76
|
+
const body = (Title, Close) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
77
|
+
/* @__PURE__ */ jsxs("div", {
|
|
78
|
+
className: "ui-term-head",
|
|
79
|
+
children: [/* @__PURE__ */ jsx(Title, {
|
|
80
|
+
className: "ui-term-title",
|
|
81
|
+
children: heading
|
|
82
|
+
}), /* @__PURE__ */ jsx(Close, {
|
|
83
|
+
className: "ui-dialog-close ui-term-close",
|
|
84
|
+
"aria-label": tr("關閉說明"),
|
|
85
|
+
children: /* @__PURE__ */ jsx(Icon, { name: "x" })
|
|
86
|
+
})]
|
|
87
|
+
}),
|
|
88
|
+
text ? /* @__PURE__ */ jsx(CodeText, {
|
|
89
|
+
as: "div",
|
|
90
|
+
className: "ui-term-body",
|
|
91
|
+
text,
|
|
92
|
+
refHref,
|
|
93
|
+
onRef,
|
|
94
|
+
isRef
|
|
95
|
+
}) : null,
|
|
96
|
+
content ? /* @__PURE__ */ jsx("div", {
|
|
97
|
+
className: "ui-term-body",
|
|
98
|
+
children: content
|
|
99
|
+
}) : null,
|
|
100
|
+
code ? /* @__PURE__ */ jsx("pre", {
|
|
101
|
+
className: "ui-term-code",
|
|
102
|
+
children: code
|
|
103
|
+
}) : null,
|
|
104
|
+
action ? /* @__PURE__ */ jsx("button", {
|
|
105
|
+
type: "button",
|
|
106
|
+
className: "ui-link-btn ui-term-action",
|
|
107
|
+
onClick: () => {
|
|
108
|
+
setOpen(false);
|
|
109
|
+
action.onClick?.();
|
|
110
|
+
},
|
|
111
|
+
children: action.label
|
|
112
|
+
}) : null
|
|
113
|
+
] });
|
|
114
|
+
if (narrow) return /* @__PURE__ */ jsxs(Dialog.Root, {
|
|
115
|
+
open,
|
|
116
|
+
onOpenChange: setOpen,
|
|
117
|
+
children: [/* @__PURE__ */ jsx(Dialog.Trigger, { render: trigger }), /* @__PURE__ */ jsxs(Dialog.Portal, { children: [/* @__PURE__ */ jsx(Dialog.Backdrop, { className: "ui-term-backdrop" }), /* @__PURE__ */ jsx(Dialog.Popup, {
|
|
118
|
+
className: "ui-term-sheet",
|
|
119
|
+
children: body(Dialog.Title, Dialog.Close)
|
|
120
|
+
})] })]
|
|
121
|
+
});
|
|
122
|
+
return /* @__PURE__ */ jsx(FloatingPanel, {
|
|
123
|
+
open,
|
|
124
|
+
onOpenChange: toggle,
|
|
125
|
+
sideOffset: 8,
|
|
126
|
+
className: "ui-term-pop",
|
|
127
|
+
trigger,
|
|
128
|
+
boundary: block,
|
|
129
|
+
...inlineV ? {
|
|
130
|
+
openOnHover: true,
|
|
131
|
+
delay: 500,
|
|
132
|
+
id: cardId,
|
|
133
|
+
focusOnOpen: false
|
|
134
|
+
} : {},
|
|
135
|
+
children: inlineV ? /* @__PURE__ */ jsx("div", {
|
|
136
|
+
onBlur,
|
|
137
|
+
children: body(Popover.Title, Popover.Close)
|
|
138
|
+
}) : body(Popover.Title, Popover.Close)
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
export { Term };
|
|
142
|
+
|
|
143
|
+
//# sourceMappingURL=Term.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Term.js","names":["phQuestion","phX"],"sources":["../../../src/components/Term/Term.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Popover } from '@base-ui/react/popover';\nimport { Dialog } from '@base-ui/react/dialog';\nimport { CodeText, type OnRef, type RefHref } from '../InlineCode/InlineCode';\nimport { tr } from '../../i18n';\nimport { Icon } from '../../icons/Icon';\nimport { cx, useNarrow } from '../../internal/util';\nimport { FloatingPanel } from '../../internal/FloatingPanel';\nimport { includeIcons } from '../../icons/store';\nimport phQuestion from '../../icons/ph/question';\nimport phX from '../../icons/ph/x';\n\nincludeIcons(phQuestion, phX);\n\nexport interface TermProps {\n /** The word or label that needs explaining. */\n children?: React.ReactNode;\n /** Heading of the explanation. Default: children when it is text. */\n title?: string;\n /** The explanation, at most 2 short sentences; `backticks` are code. */\n text?: string;\n /** Other content instead of text. */\n content?: React.ReactNode;\n /** An evidence line, shown as a code block. */\n code?: string;\n /** One link-style action at the bottom. */\n action?: { label: string; onClick?: () => void };\n refHref?: RefHref;\n onRef?: OnRef;\n isRef?: (span: string) => boolean;\n /** `icon` (default): the word with a small question mark, opened by a press. `inline`: a dashed underline inside a\n * sentence; the card opens after resting on the word for 500 ms, at once on keyboard focus, and as a sheet on phones. */\n variant?: 'icon' | 'inline';\n /** inline only: keyboard focus opens the card at once. Default true; false where arrow keys move between words and\n * Enter opens (CodeView). */\n openOnFocus?: boolean;\n /** -1 inside a widget that moves focus with its own keys (CodeView). */\n tabIndex?: number;\n className?: string;\n}\n\n/** Hover delay of `Term variant=\"inline\"`, in ms. */\nexport const TERM_HOVER_DELAY = 500;\n\n/** A word that opens its explanation: a floating card from 600 px, a sheet from the bottom on phones. `icon` adds a small\n * question mark; `inline` marks the word with a dashed underline and opens on hover or keyboard focus. */\nexport function Term({\n children,\n title,\n text,\n content,\n code,\n action,\n refHref,\n onRef,\n isRef,\n variant = 'icon',\n openOnFocus = true,\n tabIndex,\n className,\n}: TermProps) {\n const [open, setOpen] = React.useState(false);\n const narrow = useNarrow();\n const inlineV = variant === 'inline';\n const cardId = React.useId();\n const ref = React.useRef<HTMLButtonElement>(null);\n // Inside a sentence (text beside it) the term keeps its line height; on its own it gets the 48 px touch area.\n const [inline, setInline] = React.useState(false);\n React.useLayoutEffect(() => {\n const par = ref.current?.parentNode;\n const txt = !!par && Array.from(par.childNodes).some((n) => n.nodeType === 3 && !!n.textContent?.trim());\n setInline(txt);\n }, [children]);\n // The block the term sits in (a card, a side panel, the main area): the explanation stays inside it, shifted\n // sideways or narrower, so it does not cover the panel beside it. A block narrower than 240 px: the window instead.\n const block = React.useRef<Element | null>(null);\n const toggle = (next: boolean) => {\n if (next) {\n const el = ref.current?.closest('.ui-card, .ui-split-a, .ui-split-b, .ui-shell-main, main') ?? null;\n block.current = el && el.getBoundingClientRect().width >= 240 ? el : null;\n }\n setOpen(next);\n };\n const heading = title || (typeof children === 'string' ? children : '');\n // Inline: keyboard focus opens the card at once; it closes when focus leaves both the word and the card.\n const onFocus = (e: React.FocusEvent<HTMLButtonElement>) => {\n if (openOnFocus && !narrow && e.currentTarget.matches(':focus-visible')) toggle(true);\n };\n const onBlur = (e: React.FocusEvent<HTMLElement>) => {\n const to = e.relatedTarget as Node | null;\n if (to && (ref.current?.contains(to) || document.getElementById(cardId)?.contains(to))) return;\n if (!narrow) setOpen(false);\n };\n const trigger = inlineV ? (\n <button\n type=\"button\"\n ref={ref}\n className={cx('ui-term', 'is-word', open && 'is-open', className)}\n tabIndex={tabIndex}\n aria-describedby={open && !narrow ? cardId : undefined}\n onFocus={onFocus}\n onBlur={onBlur}\n >\n {children}\n {/* Read as 「cookie,有說明」: the word, then that it has an explanation. */}\n <span className=\"ui-visually-hidden\">{tr(',有說明')}</span>\n </button>\n ) : (\n <button type=\"button\" ref={ref} className={cx('ui-term', inline && 'is-inline', open && 'is-open', className)}>\n {/* Read as 「說明 caller」: what the button does, then the word. */}\n <span className=\"ui-visually-hidden\">{tr('說明') + ' '}</span>\n {children}\n <Icon name=\"question\" size={14} className=\"ui-term-q\" />\n </button>\n );\n const body = (Title: typeof Popover.Title | typeof Dialog.Title, Close: typeof Popover.Close | typeof Dialog.Close) => (\n <>\n <div className=\"ui-term-head\">\n <Title className=\"ui-term-title\">{heading}</Title>\n <Close className=\"ui-dialog-close ui-term-close\" aria-label={tr('關閉說明')}>\n <Icon name=\"x\" />\n </Close>\n </div>\n {text ? <CodeText as=\"div\" className=\"ui-term-body\" text={text} refHref={refHref} onRef={onRef} isRef={isRef} /> : null}\n {content ? <div className=\"ui-term-body\">{content}</div> : null}\n {code ? <pre className=\"ui-term-code\">{code}</pre> : null}\n {action ? (\n <button\n type=\"button\"\n className=\"ui-link-btn ui-term-action\"\n onClick={() => {\n setOpen(false);\n action.onClick?.();\n }}\n >\n {action.label}\n </button>\n ) : null}\n </>\n );\n if (narrow)\n return (\n <Dialog.Root open={open} onOpenChange={setOpen}>\n <Dialog.Trigger render={trigger} />\n <Dialog.Portal>\n <Dialog.Backdrop className=\"ui-term-backdrop\" />\n <Dialog.Popup className=\"ui-term-sheet\">{body(Dialog.Title, Dialog.Close)}</Dialog.Popup>\n </Dialog.Portal>\n </Dialog.Root>\n );\n return (\n <FloatingPanel\n open={open}\n onOpenChange={toggle}\n sideOffset={8}\n className=\"ui-term-pop\"\n trigger={trigger}\n boundary={block}\n {...(inlineV ? { openOnHover: true, delay: TERM_HOVER_DELAY, id: cardId, focusOnOpen: false } : {})}\n >\n {inlineV ? <div onBlur={onBlur}>{body(Popover.Title, Popover.Close)}</div> : body(Popover.Title, Popover.Close)}\n </FloatingPanel>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAYA,aAAaA,kBAAYC,SAAG;;;AAkC5B,SAAgB,KAAK,EACnB,UACA,OACA,MACA,SACA,MACA,QACA,SACA,OACA,OACA,UAAU,QACV,cAAc,MACd,UACA,aACY;CACZ,MAAM,CAAC,MAAM,WAAW,MAAM,SAAS,KAAK;CAC5C,MAAM,SAAS,UAAU;CACzB,MAAM,UAAU,YAAY;CAC5B,MAAM,SAAS,MAAM,MAAM;CAC3B,MAAM,MAAM,MAAM,OAA0B,IAAI;CAEhD,MAAM,CAAC,QAAQ,aAAa,MAAM,SAAS,KAAK;CAChD,MAAM,sBAAsB;EAC1B,MAAM,MAAM,IAAI,SAAS;EACzB,MAAM,MAAM,CAAC,CAAC,OAAO,MAAM,KAAK,IAAI,UAAU,CAAC,CAAC,MAAM,MAAM,EAAE,aAAa,KAAK,CAAC,CAAC,EAAE,aAAa,KAAK,CAAC;EACvG,UAAU,GAAG;CACf,GAAG,CAAC,QAAQ,CAAC;CAGb,MAAM,QAAQ,MAAM,OAAuB,IAAI;CAC/C,MAAM,UAAU,SAAkB;EAChC,IAAI,MAAM;GACR,MAAM,KAAK,IAAI,SAAS,QAAQ,0DAA0D,KAAK;GAC/F,MAAM,UAAU,MAAM,GAAG,sBAAsB,CAAC,CAAC,SAAS,MAAM,KAAK;EACvE;EACA,QAAQ,IAAI;CACd;CACA,MAAM,UAAU,UAAU,OAAO,aAAa,WAAW,WAAW;CAEpE,MAAM,WAAW,MAA2C;EAC1D,IAAI,eAAe,CAAC,UAAU,EAAE,cAAc,QAAQ,gBAAgB,GAAG,OAAO,IAAI;CACtF;CACA,MAAM,UAAU,MAAqC;EACnD,MAAM,KAAK,EAAE;EACb,IAAI,OAAO,IAAI,SAAS,SAAS,EAAE,KAAK,SAAS,eAAe,MAAM,CAAC,EAAE,SAAS,EAAE,IAAI;EACxF,IAAI,CAAC,QAAQ,QAAQ,KAAK;CAC5B;CACA,MAAM,UAAU,UACd,qBAAC,UAAD;EACE,MAAK;EACA;EACL,WAAW,GAAG,WAAW,WAAW,QAAQ,WAAW,SAAS;EACtD;EACV,oBAAkB,QAAQ,CAAC,SAAS,SAAS,KAAA;EACpC;EACD;EAPV,UAAA,CASG,UAED,oBAAC,QAAD;GAAM,WAAU;GAAsB,UAAA,GAAG,MAAM;EAAQ,CAAA,CACjD;CAER,CAAA,IAAA,qBAAC,UAAD;EAAQ,MAAK;EAAc;EAAK,WAAW,GAAG,WAAW,UAAU,aAAa,QAAQ,WAAW,SAAS;EAA5G,UAAA;GAEE,oBAAC,QAAD;IAAM,WAAU;IAAsB,UAAA,GAAG,IAAI,IAAI;GAAU,CAAA;GAC1D;GACD,oBAAC,MAAD;IAAM,MAAK;IAAW,MAAM;IAAI,WAAU;GAAa,CAAA;EACjD;;CAEV,MAAM,QAAQ,OAAmD,UAC/D,qBAAA,UAAA,EAAA,UAAA;EACE,qBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACE,oBAAC,OAAD;IAAO,WAAU;IAAiB,UAAA;GAAe,CAAA,GACjD,oBAAC,OAAD;IAAO,WAAU;IAAgC,cAAY,GAAG,MAAM;IACpE,UAAA,oBAAC,MAAD,EAAM,MAAK,IAAK,CAAA;GACX,CAAA,CACJ;;EACJ,OAAO,oBAAC,UAAD;GAAU,IAAG;GAAM,WAAU;GAAqB;GAAe;GAAgB;GAAc;EAAQ,CAAA,IAAI;EAClH,UAAU,oBAAC,OAAD;GAAK,WAAU;GAAgB,UAAA;EAAa,CAAA,IAAI;EAC1D,OAAO,oBAAC,OAAD;GAAK,WAAU;GAAgB,UAAA;EAAU,CAAA,IAAI;EACpD,SACC,oBAAC,UAAD;GACE,MAAK;GACL,WAAU;GACV,eAAe;IACb,QAAQ,KAAK;IACb,OAAO,UAAU;GACnB;GAEC,UAAA,OAAO;EACF,CAAA,IACN;CACJ,EAAA,CAAA;CAEJ,IAAI,QACF,OACE,qBAAC,OAAO,MAAR;EAAmB;EAAM,cAAc;EAAvC,UAAA,CACE,oBAAC,OAAO,SAAR,EAAgB,QAAQ,QAAU,CAAA,GAClC,qBAAC,OAAO,QAAR,EAAA,UAAA,CACE,oBAAC,OAAO,UAAR,EAAiB,WAAU,mBAAoB,CAAA,GAC/C,oBAAC,OAAO,OAAR;GAAc,WAAU;GAAiB,UAAA,KAAK,OAAO,OAAO,OAAO,KAAK;EAAgB,CAAA,CAC3E,EAAA,CAAA,CACJ;;CAEjB,OACE,oBAAC,eAAD;EACQ;EACN,cAAc;EACd,YAAY;EACZ,WAAU;EACD;EACT,UAAU;EACV,GAAK,UAAU;GAAE,aAAa;GAAM,OAAA;GAAyB,IAAI;GAAQ,aAAa;EAAM,IAAI,CAAC;EAEhG,UAAA,UAAU,oBAAC,OAAD;GAAa;GAAS,UAAA,KAAK,QAAQ,OAAO,QAAQ,KAAK;EAAO,CAAA,IAAI,KAAK,QAAQ,OAAO,QAAQ,KAAK;CACjG,CAAA;AAEnB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface TextAreaProps extends Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, 'onChange' | 'value'> {
|
|
3
|
+
label?: string;
|
|
4
|
+
hint?: string;
|
|
5
|
+
value: string;
|
|
6
|
+
onChange: (value: string) => void;
|
|
7
|
+
/** Shown as a counter. Default 200. */
|
|
8
|
+
maxLength?: number;
|
|
9
|
+
required?: boolean;
|
|
10
|
+
/** The cause and the fix (「請寫下退款原因」). Red border, the warning icon and this line in place of the hint, announced
|
|
11
|
+
* when it appears. Set it when the field is left or the form is sent. */
|
|
12
|
+
error?: string;
|
|
13
|
+
}
|
|
14
|
+
/** Multi-line text that grows up to 8 lines, with a character counter. */
|
|
15
|
+
export declare function TextArea({ label, hint, error, value, onChange, maxLength, className, id, required, ...native }: TextAreaProps): React.JSX.Element;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cx } from "../../internal/util.js";
|
|
3
|
+
import { FieldErrorIcon, FieldLabel } from "../../internal/Field.js";
|
|
4
|
+
import { format } from "../../format.js";
|
|
5
|
+
import { tr } from "../../i18n.js";
|
|
6
|
+
import * as React from "react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
// src/components/TextArea/TextArea.tsx
|
|
9
|
+
/** Multi-line text that grows up to 8 lines, with a character counter. */
|
|
10
|
+
function TextArea({ label, hint, error, value, onChange, maxLength = 200, className, id, required, ...native }) {
|
|
11
|
+
const auto = React.useId();
|
|
12
|
+
const fieldId = id || auto;
|
|
13
|
+
const hintId = error ? fieldId + "-err" : hint ? fieldId + "-hint" : void 0;
|
|
14
|
+
const ref = React.useRef(null);
|
|
15
|
+
React.useLayoutEffect(() => {
|
|
16
|
+
const el = ref.current;
|
|
17
|
+
if (!el) return;
|
|
18
|
+
el.style.height = "auto";
|
|
19
|
+
el.style.height = Math.min(el.scrollHeight + 2, 230) + "px";
|
|
20
|
+
}, [value]);
|
|
21
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
22
|
+
className: cx("ui-field", error && "has-error", className),
|
|
23
|
+
children: [
|
|
24
|
+
label ? /* @__PURE__ */ jsx(FieldLabel, {
|
|
25
|
+
htmlFor: fieldId,
|
|
26
|
+
required,
|
|
27
|
+
children: label
|
|
28
|
+
}) : null,
|
|
29
|
+
/* @__PURE__ */ jsxs("div", {
|
|
30
|
+
className: "ui-field-box",
|
|
31
|
+
children: [/* @__PURE__ */ jsx("textarea", {
|
|
32
|
+
rows: 3,
|
|
33
|
+
...native,
|
|
34
|
+
ref,
|
|
35
|
+
id: fieldId,
|
|
36
|
+
className: "ui-input ui-textarea",
|
|
37
|
+
maxLength,
|
|
38
|
+
value: value || "",
|
|
39
|
+
"aria-required": required || void 0,
|
|
40
|
+
"aria-describedby": [native["aria-describedby"], hintId].filter(Boolean).join(" ") || void 0,
|
|
41
|
+
"aria-invalid": error ? true : void 0,
|
|
42
|
+
onChange: (e) => onChange(e.target.value)
|
|
43
|
+
}), error ? /* @__PURE__ */ jsx(FieldErrorIcon, {}) : null]
|
|
44
|
+
}),
|
|
45
|
+
/* @__PURE__ */ jsxs("div", {
|
|
46
|
+
className: "ui-field-foot",
|
|
47
|
+
children: [error ? /* @__PURE__ */ jsx("span", {
|
|
48
|
+
id: hintId,
|
|
49
|
+
className: "ui-field-error",
|
|
50
|
+
role: "alert",
|
|
51
|
+
children: error
|
|
52
|
+
}, error) : /* @__PURE__ */ jsx("span", {
|
|
53
|
+
id: hintId,
|
|
54
|
+
className: "ui-field-hint",
|
|
55
|
+
children: hint || ""
|
|
56
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
57
|
+
className: "ui-count",
|
|
58
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
59
|
+
"aria-hidden": "true",
|
|
60
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
61
|
+
className: "ui-seen",
|
|
62
|
+
"data-text": format.fraction((value || "").length, maxLength)
|
|
63
|
+
})
|
|
64
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
65
|
+
className: "ui-visually-hidden",
|
|
66
|
+
children: format.fractionLabel((value || "").length, maxLength, tr("字"))
|
|
67
|
+
})]
|
|
68
|
+
})]
|
|
69
|
+
})
|
|
70
|
+
]
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
export { TextArea };
|
|
74
|
+
|
|
75
|
+
//# sourceMappingURL=TextArea.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextArea.js","names":[],"sources":["../../../src/components/TextArea/TextArea.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cx } from '../../internal/util';\nimport { FieldErrorIcon, FieldLabel } from '../../internal/Field';\nimport { format } from '../../format';\nimport { tr } from '../../i18n';\n\nexport interface TextAreaProps extends Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, 'onChange' | 'value'> {\n label?: string;\n hint?: string;\n value: string;\n onChange: (value: string) => void;\n /** Shown as a counter. Default 200. */\n maxLength?: number;\n required?: boolean;\n /** The cause and the fix (「請寫下退款原因」). Red border, the warning icon and this line in place of the hint, announced\n * when it appears. Set it when the field is left or the form is sent. */\n error?: string;\n}\n\n/** Multi-line text that grows up to 8 lines, with a character counter. */\nexport function TextArea({ label, hint, error, value, onChange, maxLength = 200, className, id, required, ...native }: TextAreaProps) {\n const auto = React.useId();\n const fieldId = id || auto;\n const hintId = error ? fieldId + '-err' : hint ? fieldId + '-hint' : undefined;\n const ref = React.useRef<HTMLTextAreaElement>(null);\n React.useLayoutEffect(() => {\n const el = ref.current;\n if (!el) return;\n el.style.height = 'auto';\n el.style.height = Math.min(el.scrollHeight + 2, 8 * 26 + 22) + 'px';\n }, [value]);\n return (\n <div className={cx('ui-field', error && 'has-error', className)}>\n {label ? (\n <FieldLabel htmlFor={fieldId} required={required}>\n {label}\n </FieldLabel>\n ) : null}\n <div className=\"ui-field-box\">\n <textarea\n rows={3}\n {...native}\n ref={ref}\n id={fieldId}\n className=\"ui-input ui-textarea\"\n maxLength={maxLength}\n value={value || ''}\n aria-required={required || undefined}\n aria-describedby={[native['aria-describedby'], hintId].filter(Boolean).join(' ') || undefined}\n aria-invalid={error ? true : undefined}\n onChange={(e) => onChange(e.target.value)}\n />\n {error ? <FieldErrorIcon /> : null}\n </div>\n <div className=\"ui-field-foot\">\n {error ? (\n <span key={error} id={hintId} className=\"ui-field-error\" role=\"alert\">\n {error}\n </span>\n ) : (\n <span id={hintId} className=\"ui-field-hint\">\n {hint || ''}\n </span>\n )}\n <span className=\"ui-count\">\n {/* Shown 「12 / 200」, drawn by CSS; read and copied as 「200 字中的 12 字」, not 「12 斜線 200」. */}\n <span aria-hidden=\"true\">\n <span className=\"ui-seen\" data-text={format.fraction((value || '').length, maxLength)} />\n </span>\n <span className=\"ui-visually-hidden\">{format.fractionLabel((value || '').length, maxLength, tr('字'))}</span>\n </span>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;AAoBA,SAAgB,SAAS,EAAE,OAAO,MAAM,OAAO,OAAO,UAAU,YAAY,KAAK,WAAW,IAAI,UAAU,GAAG,UAAyB;CACpI,MAAM,OAAO,MAAM,MAAM;CACzB,MAAM,UAAU,MAAM;CACtB,MAAM,SAAS,QAAQ,UAAU,SAAS,OAAO,UAAU,UAAU,KAAA;CACrE,MAAM,MAAM,MAAM,OAA4B,IAAI;CAClD,MAAM,sBAAsB;EAC1B,MAAM,KAAK,IAAI;EACf,IAAI,CAAC,IAAI;EACT,GAAG,MAAM,SAAS;EAClB,GAAG,MAAM,SAAS,KAAK,IAAI,GAAG,eAAe,GAAG,GAAW,IAAI;CACjE,GAAG,CAAC,KAAK,CAAC;CACV,OACE,qBAAC,OAAD;EAAK,WAAW,GAAG,YAAY,SAAS,aAAa,SAAS;EAA9D,UAAA;GACG,QACC,oBAAC,YAAD;IAAY,SAAS;IAAmB;IACrC,UAAA;GACS,CAAA,IACV;GACJ,qBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACE,oBAAC,YAAD;KACE,MAAM;KACN,GAAI;KACC;KACL,IAAI;KACJ,WAAU;KACC;KACX,OAAO,SAAS;KAChB,iBAAe,YAAY,KAAA;KAC3B,oBAAkB,CAAC,OAAO,qBAAqB,MAAM,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,KAAK,KAAA;KACpF,gBAAc,QAAQ,OAAO,KAAA;KAC7B,WAAW,MAAM,SAAS,EAAE,OAAO,KAAK;IACzC,CAAA,GACA,QAAQ,oBAAC,gBAAD,CAAiB,CAAA,IAAI,IAC3B;;GACL,qBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACG,QACC,oBAAC,QAAD;KAAkB,IAAI;KAAQ,WAAU;KAAiB,MAAK;KAC3D,UAAA;IACG,GAFK,KAEL,IAEN,oBAAC,QAAD;KAAM,IAAI;KAAQ,WAAU;KACzB,UAAA,QAAQ;IACL,CAAA,GAER,qBAAC,QAAD;KAAM,WAAU;KAAhB,UAAA,CAEE,oBAAC,QAAD;MAAM,eAAY;MAChB,UAAA,oBAAC,QAAD;OAAM,WAAU;OAAU,aAAW,OAAO,UAAU,SAAS,GAAA,CAAI,QAAQ,SAAS;MAAI,CAAA;KACpF,CAAA,GACN,oBAAC,QAAD;MAAM,WAAU;MAAsB,UAAA,OAAO,eAAe,SAAS,GAAA,CAAI,QAAQ,WAAW,GAAG,GAAG,CAAC;KAAQ,CAAA,CACvG;IACH,CAAA,CAAA;;EACF;;AAET"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface TextFieldProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
3
|
+
/** Above the field, always visible. Never only a placeholder. */
|
|
4
|
+
label: string;
|
|
5
|
+
/** Red asterisk after the label. */
|
|
6
|
+
required?: boolean;
|
|
7
|
+
/** One short line under the field. */
|
|
8
|
+
hint?: string;
|
|
9
|
+
/** The cause and the fix: 「日期格式不正確,請寫成 2026/11/14」. Turns the border red and is announced when it appears.
|
|
10
|
+
* Set it when the field is left (blur) or the form is sent, not on every key; clear it as soon as the value is right. */
|
|
11
|
+
error?: string;
|
|
12
|
+
ref?: React.Ref<HTMLInputElement>;
|
|
13
|
+
}
|
|
14
|
+
/** A labelled one-line input with a hint or an error under it. */
|
|
15
|
+
export declare function TextField({ label, hint, error, id, className, required, disabled, ...native }: TextFieldProps): React.JSX.Element;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cx } from "../../internal/util.js";
|
|
3
|
+
import { FieldErrorIcon, FieldLabel, FieldMessage } from "../../internal/Field.js";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
// src/components/TextField/TextField.tsx
|
|
7
|
+
/** A labelled one-line input with a hint or an error under it. */
|
|
8
|
+
function TextField({ label, hint, error, id, className, required, disabled, ...native }) {
|
|
9
|
+
const auto = React.useId();
|
|
10
|
+
const fieldId = id || auto;
|
|
11
|
+
const desc = error ? fieldId + "-err" : hint ? fieldId + "-hint" : void 0;
|
|
12
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
13
|
+
className: cx("ui-field", error && "has-error", disabled && "is-disabled", className),
|
|
14
|
+
children: [
|
|
15
|
+
/* @__PURE__ */ jsx(FieldLabel, {
|
|
16
|
+
htmlFor: fieldId,
|
|
17
|
+
required,
|
|
18
|
+
children: label
|
|
19
|
+
}),
|
|
20
|
+
/* @__PURE__ */ jsxs("div", {
|
|
21
|
+
className: "ui-field-box",
|
|
22
|
+
children: [/* @__PURE__ */ jsx("input", {
|
|
23
|
+
type: "text",
|
|
24
|
+
...native,
|
|
25
|
+
required,
|
|
26
|
+
disabled,
|
|
27
|
+
id: fieldId,
|
|
28
|
+
className: "ui-input",
|
|
29
|
+
"aria-invalid": error ? true : void 0,
|
|
30
|
+
"aria-describedby": desc
|
|
31
|
+
}), error ? /* @__PURE__ */ jsx(FieldErrorIcon, {}) : null]
|
|
32
|
+
}),
|
|
33
|
+
desc ? /* @__PURE__ */ jsx(FieldMessage, {
|
|
34
|
+
id: desc,
|
|
35
|
+
error,
|
|
36
|
+
hint
|
|
37
|
+
}) : null
|
|
38
|
+
]
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
export { TextField };
|
|
42
|
+
|
|
43
|
+
//# sourceMappingURL=TextField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextField.js","names":[],"sources":["../../../src/components/TextField/TextField.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cx } from '../../internal/util';\nimport { FieldErrorIcon, FieldLabel, FieldMessage } from '../../internal/Field';\n\nexport interface TextFieldProps extends React.InputHTMLAttributes<HTMLInputElement> {\n /** Above the field, always visible. Never only a placeholder. */\n label: string;\n /** Red asterisk after the label. */\n required?: boolean;\n /** One short line under the field. */\n hint?: string;\n /** The cause and the fix: 「日期格式不正確,請寫成 2026/11/14」. Turns the border red and is announced when it appears.\n * Set it when the field is left (blur) or the form is sent, not on every key; clear it as soon as the value is right. */\n error?: string;\n ref?: React.Ref<HTMLInputElement>;\n}\n\n/** A labelled one-line input with a hint or an error under it. */\nexport function TextField({ label, hint, error, id, className, required, disabled, ...native }: TextFieldProps) {\n const auto = React.useId();\n const fieldId = id || auto;\n const desc = error ? fieldId + '-err' : hint ? fieldId + '-hint' : undefined;\n return (\n <div className={cx('ui-field', error && 'has-error', disabled && 'is-disabled', className)}>\n <FieldLabel htmlFor={fieldId} required={required}>\n {label}\n </FieldLabel>\n <div className=\"ui-field-box\">\n <input\n type=\"text\"\n {...native}\n required={required}\n disabled={disabled}\n id={fieldId}\n className=\"ui-input\"\n aria-invalid={error ? true : undefined}\n aria-describedby={desc}\n />\n {error ? <FieldErrorIcon /> : null}\n </div>\n {desc ? <FieldMessage id={desc} error={error} hint={hint} /> : null}\n </div>\n );\n}\n"],"mappings":";;;;;;;AAkBA,SAAgB,UAAU,EAAE,OAAO,MAAM,OAAO,IAAI,WAAW,UAAU,UAAU,GAAG,UAA0B;CAC9G,MAAM,OAAO,MAAM,MAAM;CACzB,MAAM,UAAU,MAAM;CACtB,MAAM,OAAO,QAAQ,UAAU,SAAS,OAAO,UAAU,UAAU,KAAA;CACnE,OACE,qBAAC,OAAD;EAAK,WAAW,GAAG,YAAY,SAAS,aAAa,YAAY,eAAe,SAAS;EAAzF,UAAA;GACE,oBAAC,YAAD;IAAY,SAAS;IAAmB;IACrC,UAAA;GACS,CAAA;GACZ,qBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACE,oBAAC,SAAD;KACE,MAAK;KACL,GAAI;KACM;KACA;KACV,IAAI;KACJ,WAAU;KACV,gBAAc,QAAQ,OAAO,KAAA;KAC7B,oBAAkB;IACnB,CAAA,GACA,QAAQ,oBAAC,gBAAD,CAAiB,CAAA,IAAI,IAC3B;;GACJ,OAAO,oBAAC,cAAD;IAAc,IAAI;IAAa;IAAa;GAAO,CAAA,IAAI;EAC5D;;AAET"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ThemeSetting } from "../../theme.js";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
export interface ThemePickerProps {
|
|
4
|
+
/** Controlled value. Without it, the picker reads and sets the stored theme itself. */
|
|
5
|
+
value?: ThemeSetting;
|
|
6
|
+
/** Without it, picking applies the theme with setTheme. */
|
|
7
|
+
onChange?: (theme: ThemeSetting) => void;
|
|
8
|
+
/** Default 「主題」. */
|
|
9
|
+
label?: string;
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
/** Three preview cards (自動、淺色、深色) for the settings page under 外觀. */
|
|
13
|
+
export declare function ThemePicker({ value, onChange, label, className }: ThemePickerProps): React.JSX.Element;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { tr } from "../../i18n.js";
|
|
3
|
+
import { browserKey, cx } from "../../internal/util.js";
|
|
4
|
+
import { setTheme, storedTheme } from "../../theme.js";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
// src/components/ThemePicker/ThemePicker.tsx
|
|
8
|
+
const THEMES = [
|
|
9
|
+
{
|
|
10
|
+
id: "auto",
|
|
11
|
+
label: "自動"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
id: "light",
|
|
15
|
+
label: "淺色"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
id: "dark",
|
|
19
|
+
label: "深色"
|
|
20
|
+
}
|
|
21
|
+
];
|
|
22
|
+
/** Three preview cards (自動、淺色、深色) for the settings page under 外觀. */
|
|
23
|
+
function ThemePicker({ value, onChange, label, className }) {
|
|
24
|
+
const [own, setOwn] = React.useState(() => value ?? storedTheme());
|
|
25
|
+
const cur = value ?? own;
|
|
26
|
+
const refs = React.useRef([]);
|
|
27
|
+
const pick = (id) => {
|
|
28
|
+
setOwn(id);
|
|
29
|
+
if (onChange) onChange(id);
|
|
30
|
+
else setTheme(id);
|
|
31
|
+
};
|
|
32
|
+
const tabStop = Math.max(0, THEMES.findIndex((t) => t.id === cur));
|
|
33
|
+
return /* @__PURE__ */ jsx("div", {
|
|
34
|
+
role: "radiogroup",
|
|
35
|
+
"aria-label": label || tr("主題"),
|
|
36
|
+
className: cx("ui-themepick", className),
|
|
37
|
+
children: THEMES.map((t, i) => /* @__PURE__ */ jsxs("button", {
|
|
38
|
+
ref: (el) => {
|
|
39
|
+
refs.current[i] = el;
|
|
40
|
+
},
|
|
41
|
+
type: "button",
|
|
42
|
+
role: "radio",
|
|
43
|
+
"aria-checked": cur === t.id,
|
|
44
|
+
tabIndex: i === tabStop ? 0 : -1,
|
|
45
|
+
className: cx("ui-themepick-opt", cur === t.id && "is-on"),
|
|
46
|
+
onClick: () => pick(t.id),
|
|
47
|
+
onKeyDown: (e) => {
|
|
48
|
+
if (browserKey(e)) return;
|
|
49
|
+
const n = THEMES.length;
|
|
50
|
+
const to = e.key === "ArrowRight" || e.key === "ArrowDown" ? (i + 1) % n : e.key === "ArrowLeft" || e.key === "ArrowUp" ? (i - 1 + n) % n : -1;
|
|
51
|
+
if (to < 0) return;
|
|
52
|
+
e.preventDefault();
|
|
53
|
+
refs.current[to]?.focus();
|
|
54
|
+
pick(THEMES[to].id);
|
|
55
|
+
},
|
|
56
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
57
|
+
className: "ui-themepick-mini is-" + t.id,
|
|
58
|
+
"aria-hidden": "true",
|
|
59
|
+
children: [/* @__PURE__ */ jsx("span", {}), /* @__PURE__ */ jsx("span", {})]
|
|
60
|
+
}), tr(t.label)]
|
|
61
|
+
}, t.id))
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
export { ThemePicker };
|
|
65
|
+
|
|
66
|
+
//# sourceMappingURL=ThemePicker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemePicker.js","names":[],"sources":["../../../src/components/ThemePicker/ThemePicker.tsx"],"sourcesContent":["import * as React from 'react';\nimport { tr } from '../../i18n';\nimport { browserKey, cx } from '../../internal/util';\nimport { setTheme, storedTheme, type ThemeSetting } from '../../theme';\n\nconst THEMES: { id: ThemeSetting; label: string }[] = [\n { id: 'auto', label: '自動' },\n { id: 'light', label: '淺色' },\n { id: 'dark', label: '深色' },\n];\n\nexport interface ThemePickerProps {\n /** Controlled value. Without it, the picker reads and sets the stored theme itself. */\n value?: ThemeSetting;\n /** Without it, picking applies the theme with setTheme. */\n onChange?: (theme: ThemeSetting) => void;\n /** Default 「主題」. */\n label?: string;\n className?: string;\n}\n\n/** Three preview cards (自動、淺色、深色) for the settings page under 外觀. */\nexport function ThemePicker({ value, onChange, label, className }: ThemePickerProps) {\n const [own, setOwn] = React.useState<ThemeSetting>(() => value ?? storedTheme());\n const cur = value ?? own;\n const refs = React.useRef<(HTMLButtonElement | null)[]>([]);\n const pick = (id: ThemeSetting) => {\n setOwn(id);\n if (onChange) onChange(id);\n else setTheme(id);\n };\n // One Tab stop (the chosen card); arrow keys move to the next card and choose it, as in RadioGroup.\n const tabStop = Math.max(\n 0,\n THEMES.findIndex((t) => t.id === cur),\n );\n return (\n <div role=\"radiogroup\" aria-label={label || tr('主題')} className={cx('ui-themepick', className)}>\n {THEMES.map((t, i) => (\n <button\n key={t.id}\n ref={(el) => {\n refs.current[i] = el;\n }}\n type=\"button\"\n role=\"radio\"\n aria-checked={cur === t.id}\n tabIndex={i === tabStop ? 0 : -1}\n className={cx('ui-themepick-opt', cur === t.id && 'is-on')}\n onClick={() => pick(t.id)}\n onKeyDown={(e) => {\n if (browserKey(e)) return;\n const n = THEMES.length;\n const to = e.key === 'ArrowRight' || e.key === 'ArrowDown' ? (i + 1) % n : e.key === 'ArrowLeft' || e.key === 'ArrowUp' ? (i - 1 + n) % n : -1;\n if (to < 0) return;\n e.preventDefault();\n refs.current[to]?.focus();\n pick(THEMES[to].id);\n }}\n >\n <span className={'ui-themepick-mini is-' + t.id} aria-hidden=\"true\">\n <span />\n <span />\n </span>\n {tr(t.label)}\n </button>\n ))}\n </div>\n );\n}\n"],"mappings":";;;;;;;AAKA,MAAM,SAAgD;CACpD;EAAE,IAAI;EAAQ,OAAO;CAAK;CAC1B;EAAE,IAAI;EAAS,OAAO;CAAK;CAC3B;EAAE,IAAI;EAAQ,OAAO;CAAK;AAC5B;;AAaA,SAAgB,YAAY,EAAE,OAAO,UAAU,OAAO,aAA+B;CACnF,MAAM,CAAC,KAAK,UAAU,MAAM,eAA6B,SAAS,YAAY,CAAC;CAC/E,MAAM,MAAM,SAAS;CACrB,MAAM,OAAO,MAAM,OAAqC,CAAC,CAAC;CAC1D,MAAM,QAAQ,OAAqB;EACjC,OAAO,EAAE;EACT,IAAI,UAAU,SAAS,EAAE;OACpB,SAAS,EAAE;CAClB;CAEA,MAAM,UAAU,KAAK,IACnB,GACA,OAAO,WAAW,MAAM,EAAE,OAAO,GAAG,CACtC;CACA,OACE,oBAAC,OAAD;EAAK,MAAK;EAAa,cAAY,SAAS,GAAG,IAAI;EAAG,WAAW,GAAG,gBAAgB,SAAS;EAC1F,UAAA,OAAO,KAAK,GAAG,MACd,qBAAC,UAAD;GAEE,MAAM,OAAO;IACX,KAAK,QAAQ,KAAK;GACpB;GACA,MAAK;GACL,MAAK;GACL,gBAAc,QAAQ,EAAE;GACxB,UAAU,MAAM,UAAU,IAAI;GAC9B,WAAW,GAAG,oBAAoB,QAAQ,EAAE,MAAM,OAAO;GACzD,eAAe,KAAK,EAAE,EAAE;GACxB,YAAY,MAAM;IAChB,IAAI,WAAW,CAAC,GAAG;IACnB,MAAM,IAAI,OAAO;IACjB,MAAM,KAAK,EAAE,QAAQ,gBAAgB,EAAE,QAAQ,eAAe,IAAI,KAAK,IAAI,EAAE,QAAQ,eAAe,EAAE,QAAQ,aAAa,IAAI,IAAI,KAAK,IAAI;IAC5I,IAAI,KAAK,GAAG;IACZ,EAAE,eAAe;IACjB,KAAK,QAAQ,GAAG,EAAE,MAAM;IACxB,KAAK,OAAO,GAAG,CAAC,EAAE;GACpB;GAnBF,UAAA,CAqBE,qBAAC,QAAD;IAAM,WAAW,0BAA0B,EAAE;IAAI,eAAY;IAA7D,UAAA,CACE,oBAAC,QAAD,CAAO,CAAA,GACP,oBAAC,QAAD,CAAO,CAAA,CACH;GACL,CAAA,GAAA,GAAG,EAAE,KAAK,CACL;EAzBD,GAAA,EAAE,EAyBD,CACT;CACE,CAAA;AAET"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface TimeControlProps {
|
|
2
|
+
/** The time on show: now when live, the replayed moment during a replay. */
|
|
3
|
+
time: Date;
|
|
4
|
+
/** Replaying past records instead of showing live data. */
|
|
5
|
+
replaying: boolean;
|
|
6
|
+
/** 「回放」 starts a replay, 「停止回放」 stops it. */
|
|
7
|
+
onReplayChange: (replaying: boolean) => void;
|
|
8
|
+
/** 「回到現在」: back to live data; cannot be pressed while live. */
|
|
9
|
+
onNow: () => void;
|
|
10
|
+
/** First line: what is on show, e.g. 「即時:每 10 秒更新一次。」 or 「回放中:14:10 起的紀錄。」. */
|
|
11
|
+
status: string;
|
|
12
|
+
/** Second line, smaller and gray: e.g. the range of the records or the last update. */
|
|
13
|
+
detail?: string;
|
|
14
|
+
className?: string;
|
|
15
|
+
}
|
|
16
|
+
/** The clock of a monitoring screen with replay: the time in 28 px Geist Mono, two lines on what is on show, and
|
|
17
|
+
* 「回放」 (「停止回放」 while replaying) and 「回到現在」. Laid out as a column for a 400 px side panel. Moving within
|
|
18
|
+
* the replay is LineChart's playhead. */
|
|
19
|
+
export declare function TimeControl({ time, replaying, onReplayChange, onNow, status, detail, className }: TimeControlProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cx } from "../../internal/util.js";
|
|
3
|
+
import { format } from "../../format.js";
|
|
4
|
+
import { tr } from "../../i18n.js";
|
|
5
|
+
import { Button } from "../Button/Button.js";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
// src/components/TimeControl/TimeControl.tsx
|
|
8
|
+
/** The clock of a monitoring screen with replay: the time in 28 px Geist Mono, two lines on what is on show, and
|
|
9
|
+
* 「回放」 (「停止回放」 while replaying) and 「回到現在」. Laid out as a column for a 400 px side panel. Moving within
|
|
10
|
+
* the replay is LineChart's playhead. */
|
|
11
|
+
function TimeControl({ time, replaying, onReplayChange, onNow, status, detail, className }) {
|
|
12
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
13
|
+
className: cx("ui-timecontrol", className),
|
|
14
|
+
"aria-label": tr("時間控制"),
|
|
15
|
+
children: [
|
|
16
|
+
/* @__PURE__ */ jsx("time", {
|
|
17
|
+
className: "ui-timecontrol-clock",
|
|
18
|
+
dateTime: time.toISOString(),
|
|
19
|
+
"aria-live": "off",
|
|
20
|
+
children: format.time(time)
|
|
21
|
+
}),
|
|
22
|
+
/* @__PURE__ */ jsx("p", {
|
|
23
|
+
className: "ui-timecontrol-status",
|
|
24
|
+
"aria-live": "polite",
|
|
25
|
+
children: status
|
|
26
|
+
}),
|
|
27
|
+
detail ? /* @__PURE__ */ jsx("p", {
|
|
28
|
+
className: "ui-timecontrol-detail",
|
|
29
|
+
children: detail
|
|
30
|
+
}) : null,
|
|
31
|
+
/* @__PURE__ */ jsxs("div", {
|
|
32
|
+
className: "ui-timecontrol-actions",
|
|
33
|
+
children: [/* @__PURE__ */ jsx(Button, {
|
|
34
|
+
onClick: () => onReplayChange(!replaying),
|
|
35
|
+
children: replaying ? tr("停止回放") : tr("回放")
|
|
36
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
37
|
+
onClick: onNow,
|
|
38
|
+
disabled: !replaying,
|
|
39
|
+
children: tr("回到現在")
|
|
40
|
+
})]
|
|
41
|
+
})
|
|
42
|
+
]
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
export { TimeControl };
|
|
46
|
+
|
|
47
|
+
//# sourceMappingURL=TimeControl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TimeControl.js","names":[],"sources":["../../../src/components/TimeControl/TimeControl.tsx"],"sourcesContent":["import { cx } from '../../internal/util';\nimport { format } from '../../format';\nimport { tr } from '../../i18n';\nimport { Button } from '../Button/Button';\n\nexport interface TimeControlProps {\n /** The time on show: now when live, the replayed moment during a replay. */\n time: Date;\n /** Replaying past records instead of showing live data. */\n replaying: boolean;\n /** 「回放」 starts a replay, 「停止回放」 stops it. */\n onReplayChange: (replaying: boolean) => void;\n /** 「回到現在」: back to live data; cannot be pressed while live. */\n onNow: () => void;\n /** First line: what is on show, e.g. 「即時:每 10 秒更新一次。」 or 「回放中:14:10 起的紀錄。」. */\n status: string;\n /** Second line, smaller and gray: e.g. the range of the records or the last update. */\n detail?: string;\n className?: string;\n}\n\n/** The clock of a monitoring screen with replay: the time in 28 px Geist Mono, two lines on what is on show, and\n * 「回放」 (「停止回放」 while replaying) and 「回到現在」. Laid out as a column for a 400 px side panel. Moving within\n * the replay is LineChart's playhead. */\nexport function TimeControl({ time, replaying, onReplayChange, onNow, status, detail, className }: TimeControlProps) {\n return (\n <section className={cx('ui-timecontrol', className)} aria-label={tr('時間控制')}>\n <time className=\"ui-timecontrol-clock\" dateTime={time.toISOString()} aria-live=\"off\">\n {format.time(time)}\n </time>\n <p className=\"ui-timecontrol-status\" aria-live=\"polite\">\n {status}\n </p>\n {detail ? <p className=\"ui-timecontrol-detail\">{detail}</p> : null}\n <div className=\"ui-timecontrol-actions\">\n <Button onClick={() => onReplayChange(!replaying)}>{replaying ? tr('停止回放') : tr('回放')}</Button>\n <Button onClick={onNow} disabled={!replaying}>\n {tr('回到現在')}\n </Button>\n </div>\n </section>\n );\n}\n"],"mappings":";;;;;;;;;;AAwBA,SAAgB,YAAY,EAAE,MAAM,WAAW,gBAAgB,OAAO,QAAQ,QAAQ,aAA+B;CACnH,OACE,qBAAC,WAAD;EAAS,WAAW,GAAG,kBAAkB,SAAS;EAAG,cAAY,GAAG,MAAM;EAA1E,UAAA;GACE,oBAAC,QAAD;IAAM,WAAU;IAAuB,UAAU,KAAK,YAAY;IAAG,aAAU;IAC5E,UAAA,OAAO,KAAK,IAAI;GACb,CAAA;GACN,oBAAC,KAAD;IAAG,WAAU;IAAwB,aAAU;IAC5C,UAAA;GACA,CAAA;GACF,SAAS,oBAAC,KAAD;IAAG,WAAU;IAAyB,UAAA;GAAU,CAAA,IAAI;GAC9D,qBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACE,oBAAC,QAAD;KAAQ,eAAe,eAAe,CAAC,SAAS;KAAI,UAAA,YAAY,GAAG,MAAM,IAAI,GAAG,IAAI;IAAU,CAAA,GAC9F,oBAAC,QAAD;KAAQ,SAAS;KAAO,UAAU,CAAC;KAChC,UAAA,GAAG,MAAM;IACJ,CAAA,CACL;;EACE;;AAEb"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface ToastProps {
|
|
3
|
+
/** What happened, in the past tense: 「已刪除 3 筆」. */
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
/** Usually 「復原」. */
|
|
6
|
+
actionLabel?: string;
|
|
7
|
+
onAction?: () => void;
|
|
8
|
+
}
|
|
9
|
+
/** A short confirmation at the bottom right. The caller shows it for 3 s. */
|
|
10
|
+
export declare function Toast({ children, actionLabel, onAction }: ToastProps): React.JSX.Element;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Icon } from "../../icons/Icon.js";
|
|
3
|
+
import { includeIcons } from "../../icons/store.js";
|
|
4
|
+
import check_default from "../../icons/ph/check.js";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
// src/components/Toast/Toast.tsx
|
|
7
|
+
includeIcons(check_default);
|
|
8
|
+
/** A short confirmation at the bottom right. The caller shows it for 3 s. */
|
|
9
|
+
function Toast({ children, actionLabel, onAction }) {
|
|
10
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
11
|
+
className: "ui-toast",
|
|
12
|
+
role: "status",
|
|
13
|
+
children: [
|
|
14
|
+
/* @__PURE__ */ jsx(Icon, {
|
|
15
|
+
name: "check",
|
|
16
|
+
className: "ui-toast-icon"
|
|
17
|
+
}),
|
|
18
|
+
/* @__PURE__ */ jsx("span", { children }),
|
|
19
|
+
actionLabel ? /* @__PURE__ */ jsx("button", {
|
|
20
|
+
type: "button",
|
|
21
|
+
className: "ui-toast-action",
|
|
22
|
+
onClick: onAction,
|
|
23
|
+
children: actionLabel
|
|
24
|
+
}) : null
|
|
25
|
+
]
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
export { Toast };
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=Toast.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toast.js","names":["phCheck"],"sources":["../../../src/components/Toast/Toast.tsx"],"sourcesContent":["import type * as React from 'react';\nimport { Icon } from '../../icons/Icon';\nimport { includeIcons } from '../../icons/store';\nimport phCheck from '../../icons/ph/check';\n\nincludeIcons(phCheck);\n\nexport interface ToastProps {\n /** What happened, in the past tense: 「已刪除 3 筆」. */\n children?: React.ReactNode;\n /** Usually 「復原」. */\n actionLabel?: string;\n onAction?: () => void;\n}\n\n/** A short confirmation at the bottom right. The caller shows it for 3 s. */\nexport function Toast({ children, actionLabel, onAction }: ToastProps) {\n return (\n <div className=\"ui-toast\" role=\"status\">\n <Icon name=\"check\" className=\"ui-toast-icon\" />\n <span>{children}</span>\n {actionLabel ? (\n <button type=\"button\" className=\"ui-toast-action\" onClick={onAction}>\n {actionLabel}\n </button>\n ) : null}\n </div>\n );\n}\n"],"mappings":";;;;;;AAKA,aAAaA,aAAO;;AAWpB,SAAgB,MAAM,EAAE,UAAU,aAAa,YAAwB;CACrE,OACE,qBAAC,OAAD;EAAK,WAAU;EAAW,MAAK;EAA/B,UAAA;GACE,oBAAC,MAAD;IAAM,MAAK;IAAQ,WAAU;GAAiB,CAAA;GAC9C,oBAAC,QAAD,EAAO,SAAe,CAAA;GACrB,cACC,oBAAC,UAAD;IAAQ,MAAK;IAAS,WAAU;IAAkB,SAAS;IACxD,UAAA;GACK,CAAA,IACN;EACD;;AAET"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface TooltipProps {
|
|
3
|
+
/** Short text, also announced as the trigger's description. Never the only place important information lives. */
|
|
4
|
+
label: string;
|
|
5
|
+
/** Preferred side; flips when there is no room. 'right' for controls at a sidebar's edge. Default 'top'. */
|
|
6
|
+
side?: 'top' | 'bottom' | 'right';
|
|
7
|
+
/** One focusable element that accepts a ref (a button, IconButton, Button, a link). */
|
|
8
|
+
children: React.ReactElement;
|
|
9
|
+
/** false: the label only repeats the trigger's own name (an IconButton's aria-label), so it is not added as its description. Default true. */
|
|
10
|
+
describe?: boolean;
|
|
11
|
+
/** Long text (a cut-off table cell): wraps at 360 px in regular weight instead of one bold line. */
|
|
12
|
+
wrap?: boolean;
|
|
13
|
+
/** Turns it off without unmounting the trigger, e.g. while a cell's text still fits. */
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
}
|
|
16
|
+
/** Dark label above the element (below when there is no room), with an arrow. Appears at once on hover and focus. */
|
|
17
|
+
export declare function Tooltip({ label, side, describe, wrap, disabled, children }: TooltipProps): React.JSX.Element;
|