@knk1313/plain-ui 0.0.0-stage → 0.2.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 +86 -2
- package/dist/components/accordion/Accordion.d.ts +27 -0
- package/dist/components/accordion/Accordion.js +18 -0
- package/dist/components/accordion/index.d.ts +1 -0
- package/dist/components/accordion/index.js +1 -0
- package/dist/components/agent-form/AgentForm.d.ts +40 -0
- package/dist/components/agent-form/AgentForm.js +100 -0
- package/dist/components/agent-form/index.d.ts +1 -0
- package/dist/components/agent-form/index.js +1 -0
- package/dist/components/agent-steps/AgentSteps.d.ts +21 -0
- package/dist/components/agent-steps/AgentSteps.js +42 -0
- package/dist/components/agent-steps/index.d.ts +1 -0
- package/dist/components/agent-steps/index.js +1 -0
- package/dist/components/agent-thinking/AgentThinking.d.ts +12 -0
- package/dist/components/agent-thinking/AgentThinking.js +18 -0
- package/dist/components/agent-thinking/index.d.ts +1 -0
- package/dist/components/agent-thinking/index.js +1 -0
- package/dist/components/area-chart/AreaChart.d.ts +10 -0
- package/dist/components/area-chart/AreaChart.js +83 -0
- package/dist/components/area-chart/index.d.ts +1 -0
- package/dist/components/area-chart/index.js +1 -0
- package/dist/components/auth-card/AuthCard.d.ts +14 -0
- package/dist/components/auth-card/AuthCard.js +9 -0
- package/dist/components/auth-card/PasswordInput.d.ts +13 -0
- package/dist/components/auth-card/PasswordInput.js +26 -0
- package/dist/components/auth-card/index.d.ts +2 -0
- package/dist/components/auth-card/index.js +2 -0
- package/dist/components/avatar/Avatar.d.ts +14 -0
- package/dist/components/avatar/Avatar.js +42 -0
- package/dist/components/avatar/index.d.ts +1 -0
- package/dist/components/avatar/index.js +1 -0
- package/dist/components/badge/Badge.d.ts +9 -0
- package/dist/components/badge/Badge.js +15 -0
- package/dist/components/badge/index.d.ts +1 -0
- package/dist/components/badge/index.js +1 -0
- package/dist/components/banner/Banner.d.ts +9 -0
- package/dist/components/banner/Banner.js +36 -0
- package/dist/components/banner/index.d.ts +1 -0
- package/dist/components/banner/index.js +1 -0
- package/dist/components/bar-chart/BarChart.d.ts +3 -0
- package/dist/components/bar-chart/BarChart.js +47 -0
- package/dist/components/bar-chart/index.d.ts +1 -0
- package/dist/components/bar-chart/index.js +1 -0
- package/dist/components/bar-list/BarList.d.ts +26 -0
- package/dist/components/bar-list/BarList.js +24 -0
- package/dist/components/bar-list/index.d.ts +1 -0
- package/dist/components/bar-list/index.js +1 -0
- package/dist/components/breadcrumb/Breadcrumb.d.ts +12 -0
- package/dist/components/breadcrumb/Breadcrumb.js +9 -0
- package/dist/components/breadcrumb/index.d.ts +1 -0
- package/dist/components/breadcrumb/index.js +1 -0
- package/dist/components/button/Button.d.ts +24 -0
- package/dist/components/button/Button.js +31 -0
- package/dist/components/button/buttonStyle.d.ts +9 -0
- package/dist/components/button/buttonStyle.js +41 -0
- package/dist/components/button/index.d.ts +1 -0
- package/dist/components/button/index.js +1 -0
- package/dist/components/button-group/ButtonGroup.d.ts +18 -0
- package/dist/components/button-group/ButtonGroup.js +26 -0
- package/dist/components/button-group/index.d.ts +1 -0
- package/dist/components/button-group/index.js +1 -0
- package/dist/components/calendar/Calendar.d.ts +20 -0
- package/dist/components/calendar/Calendar.js +98 -0
- package/dist/components/calendar/index.d.ts +1 -0
- package/dist/components/calendar/index.js +1 -0
- package/dist/components/calendar-view/CalendarView.d.ts +34 -0
- package/dist/components/calendar-view/CalendarView.js +111 -0
- package/dist/components/calendar-view/index.d.ts +1 -0
- package/dist/components/calendar-view/index.js +1 -0
- package/dist/components/card/Card.d.ts +6 -0
- package/dist/components/card/Card.js +6 -0
- package/dist/components/card/index.d.ts +1 -0
- package/dist/components/card/index.js +1 -0
- package/dist/components/carousel/Carousel.d.ts +18 -0
- package/dist/components/carousel/Carousel.js +58 -0
- package/dist/components/carousel/index.d.ts +1 -0
- package/dist/components/carousel/index.js +1 -0
- package/dist/components/chart/Axis.d.ts +51 -0
- package/dist/components/chart/Axis.js +127 -0
- package/dist/components/chart/ChartFrame.d.ts +79 -0
- package/dist/components/chart/ChartFrame.js +80 -0
- package/dist/components/chart/ChartTooltip.d.ts +12 -0
- package/dist/components/chart/ChartTooltip.js +57 -0
- package/dist/components/chart/Legend.d.ts +11 -0
- package/dist/components/chart/Legend.js +6 -0
- package/dist/components/chart/Sparkline.d.ts +5 -0
- package/dist/components/chart/Sparkline.js +20 -0
- package/dist/components/chart/format.d.ts +2 -0
- package/dist/components/chart/format.js +17 -0
- package/dist/components/chart/heatmap.d.ts +18 -0
- package/dist/components/chart/heatmap.js +47 -0
- package/dist/components/chart/index.d.ts +1 -0
- package/dist/components/chart/index.js +1 -0
- package/dist/components/chart/line.d.ts +1 -0
- package/dist/components/chart/line.js +15 -0
- package/dist/components/chart/scale.d.ts +15 -0
- package/dist/components/chart/scale.js +100 -0
- package/dist/components/chart/series.d.ts +44 -0
- package/dist/components/chart/series.js +86 -0
- package/dist/components/chart/spacing.d.ts +29 -0
- package/dist/components/chart/spacing.js +34 -0
- package/dist/components/chart/types.d.ts +29 -0
- package/dist/components/chart/types.js +2 -0
- package/dist/components/chart/useChartHover.d.ts +34 -0
- package/dist/components/chart/useChartHover.js +97 -0
- package/dist/components/checkbox/Checkbox.d.ts +10 -0
- package/dist/components/checkbox/Checkbox.js +38 -0
- package/dist/components/checkbox/index.d.ts +1 -0
- package/dist/components/checkbox/index.js +1 -0
- package/dist/components/chip/Chip.d.ts +21 -0
- package/dist/components/chip/Chip.js +10 -0
- package/dist/components/chip/index.d.ts +1 -0
- package/dist/components/chip/index.js +1 -0
- package/dist/components/close-button/CloseButton.d.ts +14 -0
- package/dist/components/close-button/CloseButton.js +9 -0
- package/dist/components/close-button/index.d.ts +1 -0
- package/dist/components/close-button/index.js +1 -0
- package/dist/components/color-picker/ColorPicker.d.ts +21 -0
- package/dist/components/color-picker/ColorPicker.js +20 -0
- package/dist/components/color-picker/index.d.ts +1 -0
- package/dist/components/color-picker/index.js +1 -0
- package/dist/components/combo-chart/ComboChart.d.ts +12 -0
- package/dist/components/combo-chart/ComboChart.js +84 -0
- package/dist/components/combo-chart/index.d.ts +1 -0
- package/dist/components/combo-chart/index.js +1 -0
- package/dist/components/combobox/Combobox.d.ts +33 -0
- package/dist/components/combobox/Combobox.js +246 -0
- package/dist/components/combobox/index.d.ts +1 -0
- package/dist/components/combobox/index.js +1 -0
- package/dist/components/command-palette/CommandPalette.d.ts +36 -0
- package/dist/components/command-palette/CommandPalette.js +156 -0
- package/dist/components/command-palette/index.d.ts +1 -0
- package/dist/components/command-palette/index.js +1 -0
- package/dist/components/composer/Composer.d.ts +32 -0
- package/dist/components/composer/Composer.js +101 -0
- package/dist/components/composer/index.d.ts +1 -0
- package/dist/components/composer/index.js +1 -0
- package/dist/components/composer-attachments/ComposerAttachments.d.ts +25 -0
- package/dist/components/composer-attachments/ComposerAttachments.js +52 -0
- package/dist/components/composer-attachments/index.d.ts +1 -0
- package/dist/components/composer-attachments/index.js +1 -0
- package/dist/components/composer-panel/ComposerPanel.d.ts +26 -0
- package/dist/components/composer-panel/ComposerPanel.js +154 -0
- package/dist/components/composer-panel/index.d.ts +1 -0
- package/dist/components/composer-panel/index.js +1 -0
- package/dist/components/contribution-chart/ContributionChart.d.ts +25 -0
- package/dist/components/contribution-chart/ContributionChart.js +127 -0
- package/dist/components/contribution-chart/index.d.ts +1 -0
- package/dist/components/contribution-chart/index.js +1 -0
- package/dist/components/data-grid/DataGrid.d.ts +40 -0
- package/dist/components/data-grid/DataGrid.js +157 -0
- package/dist/components/data-grid/index.d.ts +1 -0
- package/dist/components/data-grid/index.js +1 -0
- package/dist/components/data-table/DataTable.d.ts +87 -0
- package/dist/components/data-table/DataTable.js +150 -0
- package/dist/components/data-table/index.d.ts +2 -0
- package/dist/components/data-table/index.js +2 -0
- package/dist/components/data-table/query.d.ts +54 -0
- package/dist/components/data-table/query.js +70 -0
- package/dist/components/date-picker/DatePicker.d.ts +25 -0
- package/dist/components/date-picker/DatePicker.js +154 -0
- package/dist/components/date-picker/index.d.ts +1 -0
- package/dist/components/date-picker/index.js +1 -0
- package/dist/components/dialog/ConfirmDialog.d.ts +25 -0
- package/dist/components/dialog/ConfirmDialog.js +69 -0
- package/dist/components/dialog/Dialog.d.ts +25 -0
- package/dist/components/dialog/Dialog.js +11 -0
- package/dist/components/dialog/DialogFrame.d.ts +22 -0
- package/dist/components/dialog/DialogFrame.js +21 -0
- package/dist/components/dialog/DiscardChangesDialog.d.ts +10 -0
- package/dist/components/dialog/DiscardChangesDialog.js +10 -0
- package/dist/components/dialog/index.d.ts +2 -0
- package/dist/components/dialog/index.js +2 -0
- package/dist/components/dialog/useDiscardOnClose.d.ts +20 -0
- package/dist/components/dialog/useDiscardOnClose.js +26 -0
- package/dist/components/dialog/useModalDialog.d.ts +20 -0
- package/dist/components/dialog/useModalDialog.js +85 -0
- package/dist/components/drawer/Drawer.d.ts +14 -0
- package/dist/components/drawer/Drawer.js +22 -0
- package/dist/components/drawer/index.d.ts +1 -0
- package/dist/components/drawer/index.js +1 -0
- package/dist/components/empty-state/EmptyState.d.ts +11 -0
- package/dist/components/empty-state/EmptyState.js +7 -0
- package/dist/components/empty-state/index.d.ts +1 -0
- package/dist/components/empty-state/index.js +1 -0
- package/dist/components/error-state/ErrorState.d.ts +8 -0
- package/dist/components/error-state/ErrorState.js +7 -0
- package/dist/components/error-state/index.d.ts +1 -0
- package/dist/components/error-state/index.js +1 -0
- package/dist/components/error-summary/ErrorSummary.d.ts +21 -0
- package/dist/components/error-summary/ErrorSummary.js +16 -0
- package/dist/components/error-summary/index.d.ts +1 -0
- package/dist/components/error-summary/index.js +1 -0
- package/dist/components/field/Field.d.ts +23 -0
- package/dist/components/field/Field.js +20 -0
- package/dist/components/field/index.d.ts +1 -0
- package/dist/components/field/index.js +1 -0
- package/dist/components/field-error/FieldError.d.ts +10 -0
- package/dist/components/field-error/FieldError.js +52 -0
- package/dist/components/field-error/index.d.ts +1 -0
- package/dist/components/field-error/index.js +1 -0
- package/dist/components/file-upload/FileUpload.d.ts +50 -0
- package/dist/components/file-upload/FileUpload.js +169 -0
- package/dist/components/file-upload/fileSize.d.ts +1 -0
- package/dist/components/file-upload/fileSize.js +13 -0
- package/dist/components/file-upload/index.d.ts +1 -0
- package/dist/components/file-upload/index.js +1 -0
- package/dist/components/form-section/FormSection.d.ts +16 -0
- package/dist/components/form-section/FormSection.js +14 -0
- package/dist/components/form-section/index.d.ts +1 -0
- package/dist/components/form-section/index.js +1 -0
- package/dist/components/form-steps/FormSteps.d.ts +18 -0
- package/dist/components/form-steps/FormSteps.js +26 -0
- package/dist/components/form-steps/index.d.ts +1 -0
- package/dist/components/form-steps/index.js +1 -0
- package/dist/components/funnel-chart/FunnelChart.d.ts +12 -0
- package/dist/components/funnel-chart/FunnelChart.js +69 -0
- package/dist/components/funnel-chart/index.d.ts +1 -0
- package/dist/components/funnel-chart/index.js +1 -0
- package/dist/components/header/Header.d.ts +14 -0
- package/dist/components/header/Header.js +31 -0
- package/dist/components/header/index.d.ts +1 -0
- package/dist/components/header/index.js +1 -0
- package/dist/components/heatmap-chart/HeatmapChart.d.ts +10 -0
- package/dist/components/heatmap-chart/HeatmapChart.js +76 -0
- package/dist/components/heatmap-chart/index.d.ts +1 -0
- package/dist/components/heatmap-chart/index.js +1 -0
- package/dist/components/image-error/ImageError.d.ts +11 -0
- package/dist/components/image-error/ImageError.js +16 -0
- package/dist/components/image-error/index.d.ts +1 -0
- package/dist/components/image-error/index.js +1 -0
- package/dist/components/image-loader/ImageLoader.d.ts +9 -0
- package/dist/components/image-loader/ImageLoader.js +10 -0
- package/dist/components/image-loader/index.d.ts +1 -0
- package/dist/components/image-loader/index.js +1 -0
- package/dist/components/index.d.ts +98 -0
- package/dist/components/index.js +97 -0
- package/dist/components/input/Input.d.ts +6 -0
- package/dist/components/input/Input.js +8 -0
- package/dist/components/input/index.d.ts +1 -0
- package/dist/components/input/index.js +1 -0
- package/dist/components/input/inputStyle.d.ts +14 -0
- package/dist/components/input/inputStyle.js +35 -0
- package/dist/components/item-range/ItemRange.d.ts +11 -0
- package/dist/components/item-range/ItemRange.js +13 -0
- package/dist/components/item-range/index.d.ts +1 -0
- package/dist/components/item-range/index.js +1 -0
- package/dist/components/label/Label.d.ts +8 -0
- package/dist/components/label/Label.js +5 -0
- package/dist/components/label/index.d.ts +1 -0
- package/dist/components/label/index.js +1 -0
- package/dist/components/line-chart/LineChart.d.ts +10 -0
- package/dist/components/line-chart/LineChart.js +29 -0
- package/dist/components/line-chart/index.d.ts +1 -0
- package/dist/components/line-chart/index.js +1 -0
- package/dist/components/link-button/LinkButton.d.ts +29 -0
- package/dist/components/link-button/LinkButton.js +15 -0
- package/dist/components/link-button/index.d.ts +1 -0
- package/dist/components/link-button/index.js +1 -0
- package/dist/components/menu/Menu.d.ts +33 -0
- package/dist/components/menu/Menu.js +113 -0
- package/dist/components/menu/index.d.ts +1 -0
- package/dist/components/menu/index.js +1 -0
- package/dist/components/meter/Meter.d.ts +24 -0
- package/dist/components/meter/Meter.js +65 -0
- package/dist/components/meter/index.d.ts +1 -0
- package/dist/components/meter/index.js +1 -0
- package/dist/components/nav-group/NavGroup.d.ts +24 -0
- package/dist/components/nav-group/NavGroup.js +23 -0
- package/dist/components/nav-group/index.d.ts +1 -0
- package/dist/components/nav-group/index.js +1 -0
- package/dist/components/notification/Notification.d.ts +25 -0
- package/dist/components/notification/Notification.js +13 -0
- package/dist/components/notification/index.d.ts +1 -0
- package/dist/components/notification/index.js +1 -0
- package/dist/components/notification-center/NotificationCenter.d.ts +33 -0
- package/dist/components/notification-center/NotificationCenter.js +29 -0
- package/dist/components/notification-center/index.d.ts +1 -0
- package/dist/components/notification-center/index.js +1 -0
- package/dist/components/number-field/NumberField.d.ts +28 -0
- package/dist/components/number-field/NumberField.js +155 -0
- package/dist/components/number-field/index.d.ts +1 -0
- package/dist/components/number-field/index.js +1 -0
- package/dist/components/otp-input/OtpInput.d.ts +14 -0
- package/dist/components/otp-input/OtpInput.js +70 -0
- package/dist/components/otp-input/index.d.ts +1 -0
- package/dist/components/otp-input/index.js +1 -0
- package/dist/components/pagination/Pagination.d.ts +21 -0
- package/dist/components/pagination/Pagination.js +51 -0
- package/dist/components/pagination/index.d.ts +1 -0
- package/dist/components/pagination/index.js +1 -0
- package/dist/components/popover/Popover.d.ts +23 -0
- package/dist/components/popover/Popover.js +83 -0
- package/dist/components/popover/index.d.ts +1 -0
- package/dist/components/popover/index.js +1 -0
- package/dist/components/progress/Progress.d.ts +12 -0
- package/dist/components/progress/Progress.js +30 -0
- package/dist/components/progress/index.d.ts +1 -0
- package/dist/components/progress/index.js +1 -0
- package/dist/components/question-form/QuestionForm.d.ts +59 -0
- package/dist/components/question-form/QuestionForm.js +128 -0
- package/dist/components/question-form/index.d.ts +1 -0
- package/dist/components/question-form/index.js +1 -0
- package/dist/components/radar-chart/RadarChart.d.ts +3 -0
- package/dist/components/radar-chart/RadarChart.js +72 -0
- package/dist/components/radar-chart/geometry.d.ts +16 -0
- package/dist/components/radar-chart/geometry.js +56 -0
- package/dist/components/radar-chart/index.d.ts +1 -0
- package/dist/components/radar-chart/index.js +1 -0
- package/dist/components/radial-chart/RadialChart.d.ts +39 -0
- package/dist/components/radial-chart/RadialChart.js +135 -0
- package/dist/components/radial-chart/index.d.ts +1 -0
- package/dist/components/radial-chart/index.js +1 -0
- package/dist/components/radio/Radio.d.ts +31 -0
- package/dist/components/radio/Radio.js +24 -0
- package/dist/components/radio/index.d.ts +1 -0
- package/dist/components/radio/index.js +1 -0
- package/dist/components/reply-loader/ReplyLoader.d.ts +10 -0
- package/dist/components/reply-loader/ReplyLoader.js +9 -0
- package/dist/components/reply-loader/index.d.ts +1 -0
- package/dist/components/reply-loader/index.js +1 -0
- package/dist/components/sankey-chart/SankeyChart.d.ts +35 -0
- package/dist/components/sankey-chart/SankeyChart.js +218 -0
- package/dist/components/sankey-chart/index.d.ts +1 -0
- package/dist/components/sankey-chart/index.js +1 -0
- package/dist/components/scatter-chart/ScatterChart.d.ts +38 -0
- package/dist/components/scatter-chart/ScatterChart.js +69 -0
- package/dist/components/scatter-chart/index.d.ts +1 -0
- package/dist/components/scatter-chart/index.js +1 -0
- package/dist/components/search-field/SearchField.d.ts +17 -0
- package/dist/components/search-field/SearchField.js +92 -0
- package/dist/components/search-field/index.d.ts +1 -0
- package/dist/components/search-field/index.js +1 -0
- package/dist/components/segmented-control/SegmentedControl.d.ts +26 -0
- package/dist/components/segmented-control/SegmentedControl.js +38 -0
- package/dist/components/segmented-control/index.d.ts +1 -0
- package/dist/components/segmented-control/index.js +1 -0
- package/dist/components/select/Select.d.ts +11 -0
- package/dist/components/select/Select.js +30 -0
- package/dist/components/select/index.d.ts +1 -0
- package/dist/components/select/index.js +1 -0
- package/dist/components/separator/Separator.d.ts +14 -0
- package/dist/components/separator/Separator.js +12 -0
- package/dist/components/separator/index.d.ts +1 -0
- package/dist/components/separator/index.js +1 -0
- package/dist/components/settings-modal/SettingsModal.d.ts +35 -0
- package/dist/components/settings-modal/SettingsModal.js +120 -0
- package/dist/components/settings-modal/index.d.ts +1 -0
- package/dist/components/settings-modal/index.js +1 -0
- package/dist/components/sidebar/Sidebar.d.ts +30 -0
- package/dist/components/sidebar/Sidebar.js +30 -0
- package/dist/components/sidebar/index.d.ts +1 -0
- package/dist/components/sidebar/index.js +1 -0
- package/dist/components/skeleton/Skeleton.d.ts +6 -0
- package/dist/components/skeleton/Skeleton.js +6 -0
- package/dist/components/skeleton/index.d.ts +1 -0
- package/dist/components/skeleton/index.js +1 -0
- package/dist/components/skip-link/SkipLink.d.ts +8 -0
- package/dist/components/skip-link/SkipLink.js +10 -0
- package/dist/components/skip-link/index.d.ts +1 -0
- package/dist/components/skip-link/index.js +1 -0
- package/dist/components/slider/Slider.d.ts +19 -0
- package/dist/components/slider/Slider.js +49 -0
- package/dist/components/slider/index.d.ts +1 -0
- package/dist/components/slider/index.js +1 -0
- package/dist/components/spinner/Spinner.d.ts +5 -0
- package/dist/components/spinner/Spinner.js +7 -0
- package/dist/components/spinner/index.d.ts +1 -0
- package/dist/components/spinner/index.js +1 -0
- package/dist/components/stacked-bar/StackedBar.d.ts +29 -0
- package/dist/components/stacked-bar/StackedBar.js +77 -0
- package/dist/components/stacked-bar/index.d.ts +1 -0
- package/dist/components/stacked-bar/index.js +1 -0
- package/dist/components/stat-card/StatCard.d.ts +19 -0
- package/dist/components/stat-card/StatCard.js +32 -0
- package/dist/components/stat-card/index.d.ts +1 -0
- package/dist/components/stat-card/index.js +1 -0
- package/dist/components/switch/Switch.d.ts +10 -0
- package/dist/components/switch/Switch.js +22 -0
- package/dist/components/switch/index.d.ts +1 -0
- package/dist/components/switch/index.js +1 -0
- package/dist/components/table/SortableHeader.d.ts +12 -0
- package/dist/components/table/SortableHeader.js +11 -0
- package/dist/components/table/Table.d.ts +15 -0
- package/dist/components/table/Table.js +26 -0
- package/dist/components/table/align.d.ts +1 -0
- package/dist/components/table/align.js +5 -0
- package/dist/components/table/index.d.ts +4 -0
- package/dist/components/table/index.js +2 -0
- package/dist/components/tabs/Tabs.d.ts +38 -0
- package/dist/components/tabs/Tabs.js +137 -0
- package/dist/components/tabs/fitTabs.d.ts +18 -0
- package/dist/components/tabs/fitTabs.js +46 -0
- package/dist/components/tabs/index.d.ts +1 -0
- package/dist/components/tabs/index.js +1 -0
- package/dist/components/tag-group/TagGroup.d.ts +29 -0
- package/dist/components/tag-group/TagGroup.js +82 -0
- package/dist/components/tag-group/index.d.ts +1 -0
- package/dist/components/tag-group/index.js +1 -0
- package/dist/components/task-list/TaskList.d.ts +46 -0
- package/dist/components/task-list/TaskList.js +30 -0
- package/dist/components/task-list/index.d.ts +1 -0
- package/dist/components/task-list/index.js +1 -0
- package/dist/components/text-link/TextLink.d.ts +27 -0
- package/dist/components/text-link/TextLink.js +22 -0
- package/dist/components/text-link/index.d.ts +1 -0
- package/dist/components/text-link/index.js +1 -0
- package/dist/components/textarea/Textarea.d.ts +6 -0
- package/dist/components/textarea/Textarea.js +9 -0
- package/dist/components/textarea/index.d.ts +1 -0
- package/dist/components/textarea/index.js +1 -0
- package/dist/components/time-field/TimeField.d.ts +6 -0
- package/dist/components/time-field/TimeField.js +9 -0
- package/dist/components/time-field/index.d.ts +1 -0
- package/dist/components/time-field/index.js +1 -0
- package/dist/components/toast/Toast.d.ts +19 -0
- package/dist/components/toast/Toast.js +190 -0
- package/dist/components/toast/index.d.ts +1 -0
- package/dist/components/toast/index.js +1 -0
- package/dist/components/token-input/TokenInput.d.ts +27 -0
- package/dist/components/token-input/TokenInput.js +153 -0
- package/dist/components/token-input/index.d.ts +1 -0
- package/dist/components/token-input/index.js +1 -0
- package/dist/components/tooltip/Tooltip.d.ts +17 -0
- package/dist/components/tooltip/Tooltip.js +144 -0
- package/dist/components/tooltip/index.d.ts +1 -0
- package/dist/components/tooltip/index.js +1 -0
- package/dist/components/tree-view/TreeView.d.ts +29 -0
- package/dist/components/tree-view/TreeView.js +140 -0
- package/dist/components/tree-view/index.d.ts +1 -0
- package/dist/components/tree-view/index.js +1 -0
- package/dist/components/unsaved-changes/index.d.ts +1 -0
- package/dist/components/unsaved-changes/index.js +1 -0
- package/dist/components/unsaved-changes/useUnsavedChanges.d.ts +12 -0
- package/dist/components/unsaved-changes/useUnsavedChanges.js +45 -0
- package/dist/components/usage-limit/UsageLimit.d.ts +15 -0
- package/dist/components/usage-limit/UsageLimit.js +21 -0
- package/dist/components/usage-limit/index.d.ts +1 -0
- package/dist/components/usage-limit/index.js +1 -0
- package/dist/components/web-search-results/WebSearchResults.d.ts +21 -0
- package/dist/components/web-search-results/WebSearchResults.js +17 -0
- package/dist/components/web-search-results/index.d.ts +1 -0
- package/dist/components/web-search-results/index.js +1 -0
- package/dist/lib/anchor.d.ts +21 -0
- package/dist/lib/anchor.js +50 -0
- package/dist/lib/cn.d.ts +1 -0
- package/dist/lib/cn.js +5 -0
- package/dist/lib/date.d.ts +77 -0
- package/dist/lib/date.js +165 -0
- package/dist/lib/icon-message.d.ts +16 -0
- package/dist/lib/icon-message.js +7 -0
- package/dist/lib/number.d.ts +1 -0
- package/dist/lib/number.js +5 -0
- package/dist/lib/slot.d.ts +8 -0
- package/dist/lib/slot.js +53 -0
- package/dist/lib/variant.d.ts +1 -0
- package/dist/lib/variant.js +1 -0
- package/docs/a11y.md +320 -0
- package/docs/chart/axis.md +82 -0
- package/docs/chart/color.md +120 -0
- package/docs/chart/drawing.md +283 -0
- package/docs/chart/reading.md +79 -0
- package/docs/chart/size-and-spacing.md +85 -0
- package/docs/chart.md +47 -0
- package/docs/color/contrast.md +80 -0
- package/docs/color/data-viz.md +66 -0
- package/docs/color/foundation.md +91 -0
- package/docs/color/neutral.md +88 -0
- package/docs/color/state.md +111 -0
- package/docs/color.md +22 -0
- package/docs/components/accordion.md +51 -0
- package/docs/components/agent-form.md +56 -0
- package/docs/components/agent-steps.md +75 -0
- package/docs/components/agent-thinking.md +70 -0
- package/docs/components/area-chart.md +55 -0
- package/docs/components/auth-card.md +126 -0
- package/docs/components/avatar.md +38 -0
- package/docs/components/badge.md +28 -0
- package/docs/components/banner.md +19 -0
- package/docs/components/bar-list.md +77 -0
- package/docs/components/button-group.md +74 -0
- package/docs/components/button.md +49 -0
- package/docs/components/calendar-view.md +106 -0
- package/docs/components/calendar.md +44 -0
- package/docs/components/carousel.md +81 -0
- package/docs/components/chart.md +45 -0
- package/docs/components/chat-message.md +199 -0
- package/docs/components/checkbox.md +27 -0
- package/docs/components/chip.md +34 -0
- package/docs/components/choosing.md +26 -0
- package/docs/components/close-button.md +17 -0
- package/docs/components/color-picker.md +52 -0
- package/docs/components/combo-chart.md +74 -0
- package/docs/components/combobox.md +60 -0
- package/docs/components/command-palette.md +151 -0
- package/docs/components/composer-attachments.md +116 -0
- package/docs/components/composer-panel.md +106 -0
- package/docs/components/composer.md +163 -0
- package/docs/components/contribution-chart.md +70 -0
- package/docs/components/data-grid.md +132 -0
- package/docs/components/data-table.md +165 -0
- package/docs/components/date-picker.md +120 -0
- package/docs/components/dialog.md +211 -0
- package/docs/components/drawer.md +38 -0
- package/docs/components/empty-state.md +17 -0
- package/docs/components/error-state.md +13 -0
- package/docs/components/error-summary.md +49 -0
- package/docs/components/field.md +84 -0
- package/docs/components/file-upload.md +161 -0
- package/docs/components/focus.md +25 -0
- package/docs/components/form-section.md +49 -0
- package/docs/components/form-steps.md +63 -0
- package/docs/components/funnel-chart.md +49 -0
- package/docs/components/heatmap-chart.md +64 -0
- package/docs/components/image-error.md +73 -0
- package/docs/components/image-loader.md +53 -0
- package/docs/components/input.md +21 -0
- package/docs/components/item-range.md +10 -0
- package/docs/components/link-button.md +16 -0
- package/docs/components/menu.md +115 -0
- package/docs/components/meter.md +83 -0
- package/docs/components/nav-group.md +33 -0
- package/docs/components/notification-center.md +100 -0
- package/docs/components/notification.md +127 -0
- package/docs/components/number-field.md +128 -0
- package/docs/components/otp-input.md +86 -0
- package/docs/components/pagination.md +29 -0
- package/docs/components/popover.md +43 -0
- package/docs/components/progress.md +25 -0
- package/docs/components/prohibitions.md +58 -0
- package/docs/components/props.md +20 -0
- package/docs/components/question-form.md +125 -0
- package/docs/components/radar-chart.md +61 -0
- package/docs/components/radial-chart.md +74 -0
- package/docs/components/radio.md +24 -0
- package/docs/components/reply-loader.md +80 -0
- package/docs/components/sankey-chart.md +71 -0
- package/docs/components/scatter-chart.md +61 -0
- package/docs/components/search-field.md +44 -0
- package/docs/components/segmented-control.md +35 -0
- package/docs/components/select.md +28 -0
- package/docs/components/separator.md +23 -0
- package/docs/components/settings-modal.md +128 -0
- package/docs/components/sidebar.md +145 -0
- package/docs/components/skeleton.md +27 -0
- package/docs/components/skip-link.md +17 -0
- package/docs/components/slider.md +82 -0
- package/docs/components/spinner.md +8 -0
- package/docs/components/stacked-bar.md +66 -0
- package/docs/components/stat-card.md +78 -0
- package/docs/components/switch.md +61 -0
- package/docs/components/table.md +43 -0
- package/docs/components/tabs.md +104 -0
- package/docs/components/tag-group.md +115 -0
- package/docs/components/task-list.md +99 -0
- package/docs/components/text-link.md +17 -0
- package/docs/components/textarea.md +27 -0
- package/docs/components/time-field.md +97 -0
- package/docs/components/toast.md +73 -0
- package/docs/components/token-input.md +135 -0
- package/docs/components/tooltip.md +41 -0
- package/docs/components/tree-view.md +71 -0
- package/docs/components/usage-limit.md +47 -0
- package/docs/components/web-search-results.md +60 -0
- package/docs/components.md +234 -0
- package/docs/design.md +31 -0
- package/docs/form/clearing-errors.md +28 -0
- package/docs/form/error-announcement.md +69 -0
- package/docs/form/long-forms.md +103 -0
- package/docs/form/placeholder.md +40 -0
- package/docs/form/submit-errors.md +102 -0
- package/docs/form/submitting.md +72 -0
- package/docs/form/unsaved-changes.md +146 -0
- package/docs/form/validation-timing.md +44 -0
- package/docs/form.md +39 -0
- package/docs/glossary.md +169 -0
- package/docs/icon.md +245 -0
- package/docs/interaction/before.md +64 -0
- package/docs/interaction/motion.md +38 -0
- package/docs/interaction/pending.md +38 -0
- package/docs/interaction/permissions.md +133 -0
- package/docs/interaction/result.md +38 -0
- package/docs/interaction/states.md +159 -0
- package/docs/interaction.md +31 -0
- package/docs/layout/alignment.md +145 -0
- package/docs/layout/hit-area.md +58 -0
- package/docs/layout/mobile.md +200 -0
- package/docs/layout/responsive.md +73 -0
- package/docs/layout/scroll.md +51 -0
- package/docs/layout/surface.md +110 -0
- package/docs/layout.md +31 -0
- package/docs/list/board.md +85 -0
- package/docs/list/paging.md +146 -0
- package/docs/list/search.md +98 -0
- package/docs/list/toolbar.md +91 -0
- package/docs/list.md +39 -0
- package/docs/log.md +94 -0
- package/docs/manual.md +183 -0
- package/docs/navigation/header-and-transition.md +82 -0
- package/docs/navigation/location.md +68 -0
- package/docs/navigation/menu-items.md +152 -0
- package/docs/navigation/menu-structure.md +68 -0
- package/docs/navigation.md +23 -0
- package/docs/publish.md +26 -0
- package/docs/rules.md +246 -0
- package/docs/scenario.md +218 -0
- package/docs/spacing/placement.md +219 -0
- package/docs/spacing/radius.md +45 -0
- package/docs/spacing/scale.md +91 -0
- package/docs/spacing.md +17 -0
- package/docs/typography.md +233 -0
- package/docs/writing/date-and-number.md +25 -0
- package/docs/writing/error-and-empty.md +58 -0
- package/docs/writing/label-and-button.md +124 -0
- package/docs/writing/tone.md +156 -0
- package/docs/writing.md +27 -0
- package/icons/index.d.ts +1 -0
- package/icons/index.js +3 -0
- package/package.json +117 -4
- package/scripts/lint/colors.mjs +103 -0
- package/scripts/lint/deps.mjs +33 -0
- package/scripts/lint/icons.mjs +177 -0
- package/scripts/lint/interaction.mjs +163 -0
- package/scripts/lint/layout.mjs +103 -0
- package/scripts/lint/markup.mjs +271 -0
- package/scripts/lint/shared.mjs +340 -0
- package/scripts/lint/spacing.mjs +70 -0
- package/scripts/lint/typography.mjs +141 -0
- package/scripts/lint/writing.mjs +107 -0
- package/scripts/lint.mjs +166 -0
- package/scripts/plain-ui-lint.mjs +33 -0
- package/tokens/tokens.css +482 -0
- package/tokens/tokens.values.json +234 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect } from "react";
|
|
4
|
+
import { Drawer } from "../drawer/Drawer.js";
|
|
5
|
+
import { cn } from "../../lib/cn.js";
|
|
6
|
+
// 768px(Tailwind の md)以上かどうか。md: のクラスと同じ境目で、ドロワーを閉じる
|
|
7
|
+
const WIDE_QUERY = "(min-width: 48rem)";
|
|
8
|
+
// 画面の左に置くメニューの区画(docs/components/sidebar.md)。
|
|
9
|
+
// 768px以上では、畳まずに名前つきの項目をいつも出す。アイコンだけの細い帯には畳まない(NAVIGATION-018)。
|
|
10
|
+
// 768px未満では区画を隠し、open と onClose を渡したときだけ、同じ項目を左から出すドロワーで開く
|
|
11
|
+
export function Sidebar({ label = "メニュー", open, onClose, belowHeader = false, sticky = true, children, className }) {
|
|
12
|
+
const hasDrawer = onClose !== undefined;
|
|
13
|
+
// ドロワーを開いたまま画面が768px以上に広がったら閉じる。広い画面では区画がいつも出ているので、ドロワーは要らない
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
if (!open || !onClose || typeof matchMedia !== "function")
|
|
16
|
+
return;
|
|
17
|
+
const query = matchMedia(WIDE_QUERY);
|
|
18
|
+
const closeIfWide = () => {
|
|
19
|
+
if (query.matches)
|
|
20
|
+
onClose();
|
|
21
|
+
};
|
|
22
|
+
closeIfWide();
|
|
23
|
+
query.addEventListener("change", closeIfWide);
|
|
24
|
+
return () => query.removeEventListener("change", closeIfWide);
|
|
25
|
+
}, [open, onClose]);
|
|
26
|
+
return (_jsxs(_Fragment, { children: [_jsx("nav", { "aria-label": label, className: cn("hidden w-60 shrink-0 self-start p-4 md:block", sticky && "sticky overflow-y-auto", sticky && (belowHeader ? "top-14 max-h-[calc(100dvh-3.5rem)]" : "top-0 max-h-dvh"), className), children: _jsx("div", { className: "space-y-1", children: children }) }), hasDrawer && (_jsx(Drawer, { open: open, onClose: onClose, title: label, side: "left", children: _jsx("nav", { "aria-label": label, className: "space-y-1", onClick: event => {
|
|
27
|
+
if (event.target.closest("a[href]"))
|
|
28
|
+
onClose();
|
|
29
|
+
}, children: children }) }))] }));
|
|
30
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Sidebar.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Sidebar.js";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { HTMLAttributes } from "react";
|
|
2
|
+
export interface SkeletonProps extends HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
/** 読み込んだ後と同じ大きさ(h-4 w-48 など)を渡す */
|
|
4
|
+
className?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function Skeleton({ className, ...props }: SkeletonProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../../lib/cn.js";
|
|
3
|
+
// 読み込み中に、読み込んだ後と同じ配置を保つ面。読み込み中であることは、親の aria-busy で伝える
|
|
4
|
+
export function Skeleton({ className, ...props }) {
|
|
5
|
+
return _jsx("div", { "aria-hidden": "true", className: cn("rounded-sm bg-muted", className), ...props });
|
|
6
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Skeleton.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Skeleton.js";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AnchorHTMLAttributes } from "react";
|
|
2
|
+
export interface SkipLinkProps extends Omit<AnchorHTMLAttributes<HTMLAnchorElement>, "href" | "children"> {
|
|
3
|
+
/** 移動先の本文の領域(`main`)の id を、`#` を付けて渡す(例:`#main`) */
|
|
4
|
+
href: `#${string}`;
|
|
5
|
+
/** 外側の配置だけに使う。部品の見た目は上書きしない */
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function SkipLink({ href, className, ...props }: SkipLinkProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../../lib/cn.js";
|
|
3
|
+
// ページの先頭に置く「本文へ移動」のリンク。ふだんは見えず、フォーカスしたときだけ左上に出る。
|
|
4
|
+
// 置く場所と、移動先の main の id は、使う側のレイアウトで決める(docs/a11y.md の「ページの構造」)。
|
|
5
|
+
// focus:not-sr-only は位置、余白、幅を打ち消すので、それと重なる性質のクラスには focus: を付ける。
|
|
6
|
+
// 付けないと、フォーカスしたときに not-sr-only の値が効いてしまう。
|
|
7
|
+
// 重なり順は、固定のヘッダー(z-10)より手前に出すため z-50 にする(docs/layout/surface.md の重なり順の表)
|
|
8
|
+
export function SkipLink({ href, className, ...props }) {
|
|
9
|
+
return (_jsx("a", { href: href, className: cn("sr-only rounded-md bg-popover text-sm font-medium text-popover-foreground shadow-md outline-none focus-visible:ring-2 focus-visible:ring-ring", "focus:not-sr-only focus:fixed focus:left-4 focus:top-4 focus:z-50 focus:inline-flex focus:min-h-11 focus:items-center focus:whitespace-nowrap focus:px-4 focus:py-2", className), ...props, children: "\u672C\u6587\u3078\u79FB\u52D5" }));
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./SkipLink.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./SkipLink.js";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type InputHTMLAttributes } from "react";
|
|
2
|
+
export interface SliderProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "value" | "defaultValue" | "onChange" | "min" | "max" | "step" | "children" | "aria-valuetext"> {
|
|
3
|
+
/** 今の値。状態は使う側で持つ */
|
|
4
|
+
value: number;
|
|
5
|
+
/** つまみを動かしたとき(押す、ドラッグする、矢印キー)に、動かした後の値で呼ぶ */
|
|
6
|
+
onChange: (value: number) => void;
|
|
7
|
+
/** いちばん小さい値。省いたときは0 */
|
|
8
|
+
min?: number;
|
|
9
|
+
/** いちばん大きい値。省いたときは100 */
|
|
10
|
+
max?: number;
|
|
11
|
+
/** 刻み。省いたときは1 */
|
|
12
|
+
step?: number;
|
|
13
|
+
/** 値の単位(「%」「件」「px」)。値の表示と読み上げ(aria-valuetext)の両方に付ける。英字で始まる単位だけ、数値との間に半角スペースを入れる */
|
|
14
|
+
unit?: string;
|
|
15
|
+
/** 外側の配置(余白と幅)だけに使う */
|
|
16
|
+
className?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare function formatSliderValue(value: number, unit?: string): string;
|
|
19
|
+
export declare function Slider({ value, onChange, min, max, step, unit, className, ...props }: SliderProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef } from "react";
|
|
3
|
+
import { cn } from "../../lib/cn.js";
|
|
4
|
+
import { formatNumber } from "../../lib/number.js";
|
|
5
|
+
// 数値に単位を付けて書く(docs/writing/date-and-number.md の「日付、数値、単位」)。
|
|
6
|
+
// 「12 px」のような英字の単位は半角スペースを挟み、「75%」「12件」のような記号と日本語の助数詞は続けて書く
|
|
7
|
+
export function formatSliderValue(value, unit = "") {
|
|
8
|
+
const space = /^[A-Za-z]/.test(unit) ? " " : "";
|
|
9
|
+
return `${formatNumber(value)}${space}${unit}`;
|
|
10
|
+
}
|
|
11
|
+
// 値の割合(0〜1)。範囲の外の値は、ネイティブの type="range" と同じく端に寄せる
|
|
12
|
+
function ratioOf(value, min, max) {
|
|
13
|
+
if (max <= min)
|
|
14
|
+
return 0;
|
|
15
|
+
return (Math.min(Math.max(value, min), max) - min) / (max - min);
|
|
16
|
+
}
|
|
17
|
+
// つまみ。ネイティブの type="range" のつまみを、ブラウザごとの擬似要素で描く。
|
|
18
|
+
// 箱は44×44px(size-11)にして押せる範囲を取り、12pxの透明な枠の内側だけに色を塗って、見た目は20pxの円にする。
|
|
19
|
+
// 擬似要素には Tailwind の box-sizing の初期設定が効かないので、box-border を付けて枠を44pxの中に収める。
|
|
20
|
+
// フォーカスの輪は、見た目の円の2px外に、outline を内側へずらして描く(outline は角の丸みに沿う)
|
|
21
|
+
const thumb = [
|
|
22
|
+
"[&::-webkit-slider-thumb]:box-border [&::-webkit-slider-thumb]:size-11 [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:border-12 [&::-webkit-slider-thumb]:border-transparent [&::-webkit-slider-thumb]:bg-background [&::-webkit-slider-thumb]:bg-clip-padding [&::-webkit-slider-thumb]:inset-ring-2 [&::-webkit-slider-thumb]:inset-ring-primary",
|
|
23
|
+
"[&::-moz-range-thumb]:box-border [&::-moz-range-thumb]:size-11 [&::-moz-range-thumb]:appearance-none [&::-moz-range-thumb]:rounded-full [&::-moz-range-thumb]:border-12 [&::-moz-range-thumb]:border-transparent [&::-moz-range-thumb]:bg-background [&::-moz-range-thumb]:bg-clip-padding [&::-moz-range-thumb]:inset-ring-2 [&::-moz-range-thumb]:inset-ring-primary",
|
|
24
|
+
"focus-visible:[&::-webkit-slider-thumb]:outline-2 focus-visible:[&::-webkit-slider-thumb]:-outline-offset-10 focus-visible:[&::-webkit-slider-thumb]:outline-ring",
|
|
25
|
+
"focus-visible:[&::-moz-range-thumb]:outline-2 focus-visible:[&::-moz-range-thumb]:-outline-offset-10 focus-visible:[&::-moz-range-thumb]:outline-ring",
|
|
26
|
+
].join(" ");
|
|
27
|
+
// 溝。ブラウザの溝と、Firefox の済んだ量(::-moz-range-progress)は透明にし、見た目は後ろに重ねた要素で描く。
|
|
28
|
+
// つまみの箱が見た目より12pxずつ大きいので、擬似要素の溝に色を塗ると、端でつまみの外に溝がはみ出すため
|
|
29
|
+
const track = "[&::-webkit-slider-runnable-track]:h-11 [&::-webkit-slider-runnable-track]:bg-transparent [&::-moz-range-track]:h-11 [&::-moz-range-track]:bg-transparent [&::-moz-range-progress]:bg-transparent";
|
|
30
|
+
// 値を範囲の中で選ぶスライダー。ネイティブの <input type="range">(role="slider")で作り、
|
|
31
|
+
// 矢印キー、PageUp と PageDown、Home と End での操作と、min、max、step は、ブラウザに任せる。
|
|
32
|
+
// 名前は <Label htmlFor> か aria-label、aria-labelledby で付ける。値の表示は aria-valuetext と同じことを言うので、読み上げからは外す
|
|
33
|
+
export function Slider({ value, onChange, min = 0, max = 100, step = 1, unit, className, ...props }) {
|
|
34
|
+
const ref = useRef(null);
|
|
35
|
+
const named = Boolean(props["aria-label"] || props["aria-labelledby"]);
|
|
36
|
+
// 描くたびではなく、名前のないスライダーになったときに1回だけ知らせる。<label htmlFor> は描いた後でないと分からない
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
if (!named && !ref.current?.labels?.length)
|
|
39
|
+
console.warn("Slider: <Label htmlFor> か aria-label で名前を付ける");
|
|
40
|
+
}, [named]);
|
|
41
|
+
const text = formatSliderValue(value, unit);
|
|
42
|
+
const ratio = ratioOf(value, min, max);
|
|
43
|
+
function handleChange(event) {
|
|
44
|
+
onChange(event.currentTarget.valueAsNumber);
|
|
45
|
+
}
|
|
46
|
+
return (_jsxs("div", { className: cn("flex items-center gap-4 has-disabled:opacity-50", className), children: [_jsxs("div", { className: "relative flex h-11 min-w-0 flex-1 items-center", children: [_jsx("div", { "aria-hidden": "true", className: "pointer-events-none absolute inset-x-3 h-2 overflow-hidden rounded-full bg-muted", children: _jsx("div", { className: "h-full rounded-full bg-primary", style: { width: `calc(10px + ${ratio} * (100% - 20px))` } }) }), _jsx("input", { ref: ref, type: "range", ...props, min: min, max: max, step: step, value: value, "aria-valuetext": text, onChange: handleChange,
|
|
47
|
+
// lint-ignore INTERACTION-013 輪は thumb のクラスで、つまみに outline で描く(docs/components/slider.md の「スライダーの作り方」)
|
|
48
|
+
className: cn("relative m-0 h-11 w-full cursor-pointer appearance-none bg-transparent outline-none disabled:cursor-not-allowed", track, thumb) })] }), _jsxs("span", { "aria-hidden": "true", className: "grid shrink-0 text-right text-sm tabular-nums text-foreground", children: [_jsx("span", { className: "invisible col-start-1 row-start-1", children: formatSliderValue(min, unit) }), _jsx("span", { className: "invisible col-start-1 row-start-1", children: formatSliderValue(max, unit) }), _jsx("span", { className: "col-start-1 row-start-1", children: text })] })] }));
|
|
49
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Slider.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Slider.js";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { LoaderCircleIcon } from "lucide-react";
|
|
3
|
+
import { cn } from "../../lib/cn.js";
|
|
4
|
+
// 処理中を示す。文言と一緒に出すので、スピナー自体は読み上げない。動きを減らす設定では回さない
|
|
5
|
+
export function Spinner({ className }) {
|
|
6
|
+
return _jsx(LoaderCircleIcon, { "aria-hidden": "true", className: cn("size-4 animate-spin motion-reduce:animate-none", className) });
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Spinner.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Spinner.js";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** 段階の横棒の1つの段階 */
|
|
2
|
+
export interface StackedBarItem {
|
|
3
|
+
/** 段階の名前。凡例、ツールチップ、値の表の1列目に出す */
|
|
4
|
+
name: string;
|
|
5
|
+
/** 量。0以上にする。値のない段階は null にする */
|
|
6
|
+
value: number | null;
|
|
7
|
+
}
|
|
8
|
+
export interface StackedBarProps {
|
|
9
|
+
/** グラフの名前。図の上に出し、図と値の表の名前にもする */
|
|
10
|
+
label: string;
|
|
11
|
+
/** グラフが伝える要点を、1〜2文で書く。「容量の半分を、動画が使っています。」のようにする */
|
|
12
|
+
description: string;
|
|
13
|
+
/**
|
|
14
|
+
* 段階。左から、渡した順に並べる。部品は並べ替えない。5つまで(docs/chart/color.md の CHART-031)。
|
|
15
|
+
* 足し合わせると全体になる量だけを渡す(docs/chart/drawing.md の CHART-030)
|
|
16
|
+
*/
|
|
17
|
+
items: readonly StackedBarItem[];
|
|
18
|
+
/** 量の単位(「件」「GB」)。値の書き方は docs/writing/date-and-number.md の「日付、数値、単位」に従う */
|
|
19
|
+
unit?: string;
|
|
20
|
+
/** 量の名前(「使っている容量」)。値の表の列の見出しと、ツールチップに出す。省いたときは「値」 */
|
|
21
|
+
valueLabel?: string;
|
|
22
|
+
/** 段階の名前の列の見出し。値の表の1列目の見出しにする。省いたときは「項目」 */
|
|
23
|
+
categoryLabel?: string;
|
|
24
|
+
/** 値が1つもないときの文。省いたときは「まだデータがありません。」 */
|
|
25
|
+
emptyMessage?: string;
|
|
26
|
+
/** 外側の配置(余白と幅)だけに使う */
|
|
27
|
+
className?: string;
|
|
28
|
+
}
|
|
29
|
+
export declare function StackedBar({ items, unit, valueLabel, categoryLabel, ...props }: StackedBarProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useId } from "react";
|
|
4
|
+
import { Table, TableBody, TableCell, TableHead, TableHeaderCell, TableRow } from "../table/Table.js";
|
|
5
|
+
import { ChartLayout } from "../chart/ChartFrame.js";
|
|
6
|
+
import { ChartTooltip } from "../chart/ChartTooltip.js";
|
|
7
|
+
import { formatValue } from "../chart/format.js";
|
|
8
|
+
import { Legend } from "../chart/Legend.js";
|
|
9
|
+
import { BarSwatch, MAX_SERIES, SeriesPattern, barPaint, safeId } from "../chart/series.js";
|
|
10
|
+
import { BAR_GAP } from "../chart/spacing.js";
|
|
11
|
+
import { ChartTooltipContent, usePointerPick } from "../chart/useChartHover.js";
|
|
12
|
+
// 棒の太さ(px)。ファネルの棒と同じにする。間隔ではなく形の値(docs/chart/size-and-spacing.md の「間隔」の表の外)
|
|
13
|
+
const BAR_HEIGHT = 24;
|
|
14
|
+
const RATIO_LABEL = "全体に対する割合";
|
|
15
|
+
const isValue = (v) => typeof v === "number" && Number.isFinite(v);
|
|
16
|
+
// 全体(値のある段階の和)に対する割合の文字(%)。小数第1位まで。
|
|
17
|
+
// 値のない段階は「値なし」、値はあるが全体が0で割合を考えられないときは「—」にする(docs/chart/reading.md の「値の書き方」)
|
|
18
|
+
function ratioText(value, total) {
|
|
19
|
+
if (!isValue(value))
|
|
20
|
+
return formatValue(null);
|
|
21
|
+
return total > 0 ? formatValue(Math.round((value / total) * 1000) / 10, "%") : "—";
|
|
22
|
+
}
|
|
23
|
+
// 開発時の知らせ。段階が多すぎるとき(CHART-031)と、負の値を渡したとき(CHART-030)
|
|
24
|
+
function useStackedWarning(items) {
|
|
25
|
+
const tooMany = items.length > MAX_SERIES;
|
|
26
|
+
const negative = items.some(item => isValue(item.value) && item.value < 0);
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
if (tooMany)
|
|
29
|
+
console.warn(`StackedBar: 段階は${MAX_SERIES}つまでにする。小さい段階は「その他」にまとめる(docs/chart/color.md の CHART-031)`);
|
|
30
|
+
}, [tooMany]);
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
if (negative)
|
|
33
|
+
console.warn("StackedBar: 値は0以上にする。足し合わせて全体になる量だけを積み上げる(docs/chart/drawing.md の CHART-030)");
|
|
34
|
+
}, [negative]);
|
|
35
|
+
}
|
|
36
|
+
// 全体を、段階ごとの割合で分けた1本の横棒(積み上げの横棒)。容量の内訳や、対応の状況ごとの件数のように、全体の中の割合を見せる。
|
|
37
|
+
// 段階は、渡した順に左から並べ、系列の色に加えて棒の模様で描き分ける(docs/chart/color.md の CHART-002)。
|
|
38
|
+
// 段階どうしは XS の隙間で区切る。凡例に、名前と全体に対する割合をいつも出す
|
|
39
|
+
export function StackedBar({ items, unit, valueLabel = "値", categoryLabel = "項目", ...props }) {
|
|
40
|
+
useStackedWarning(items);
|
|
41
|
+
const id = safeId(useId());
|
|
42
|
+
const total = items.reduce((sum, item) => sum + (isValue(item.value) && item.value > 0 ? item.value : 0), 0);
|
|
43
|
+
return (_jsx(ChartLayout, { ...props, component: "StackedBar", seriesNames: items.map(item => item.name), empty: !items.some(item => isValue(item.value)), height: BAR_HEIGHT, maxSeries: Infinity, swatch: i => _jsx(BarSwatch, { id: `${id}-legend-${i}`, index: i }),
|
|
44
|
+
// 棒の上に文字を書けないので、段階が1つでも、凡例に名前と割合を出す
|
|
45
|
+
legend: _jsx(Legend, { items: items.map((item, i) => ({
|
|
46
|
+
name: item.name,
|
|
47
|
+
value: ratioText(item.value, total),
|
|
48
|
+
swatch: _jsx(BarSwatch, { id: `${id}-legend-${i}`, index: i }),
|
|
49
|
+
})) }), table: _jsxs(Table, { children: [_jsx("caption", { className: "sr-only", children: props.label }), _jsx(TableHead, { children: _jsxs(TableRow, { children: [_jsx(TableHeaderCell, { children: categoryLabel }), _jsx(TableHeaderCell, { className: "text-right", children: valueLabel }), _jsx(TableHeaderCell, { className: "text-right", children: RATIO_LABEL })] }) }), _jsx(TableBody, { children: items.map((item, i) => (_jsxs(TableRow, { children: [_jsx(TableHeaderCell, { scope: "row", children: item.name }), _jsx(TableCell, { className: "whitespace-nowrap text-right tabular-nums", children: formatValue(item.value, unit) }), _jsx(TableCell, { className: "whitespace-nowrap text-right tabular-nums", children: ratioText(item.value, total) })] }, i))) })] }), children: size => _jsx(StackedPlot, { id: id, items: items, total: total, unit: unit, valueLabel: valueLabel, width: size.width }) }));
|
|
50
|
+
}
|
|
51
|
+
function StackedPlot({ id, items, total, unit, valueLabel, width }) {
|
|
52
|
+
const patternId = (i) => `${id}-segment-${i}`;
|
|
53
|
+
// 描く段階(0より大きい値)だけを並べる。隙間(XS)の分を幅から引き、残りを割合で分ける
|
|
54
|
+
const drawn = items.map((item, index) => ({ item, index })).filter(({ item }) => isValue(item.value) && item.value > 0);
|
|
55
|
+
const room = Math.max(0, width - BAR_GAP * Math.max(drawn.length - 1, 0));
|
|
56
|
+
let x = 0;
|
|
57
|
+
const segments = drawn.map(({ item, index }) => {
|
|
58
|
+
const w = total > 0 ? (item.value / total) * room : 0;
|
|
59
|
+
const segment = { index, x, width: w };
|
|
60
|
+
x += w + BAR_GAP;
|
|
61
|
+
return segment;
|
|
62
|
+
});
|
|
63
|
+
const hover = usePointerPick(px => segments.find(s => px >= s.x - BAR_GAP / 2 && px <= s.x + s.width + BAR_GAP / 2)?.index ?? null);
|
|
64
|
+
const active = hover.index !== null ? items[hover.index] : undefined;
|
|
65
|
+
return (_jsxs(_Fragment, { children: [_jsxs("svg", { "aria-hidden": "true", width: width, height: BAR_HEIGHT, className: "block overflow-visible", children: [_jsx("defs", { children: items.map((_, i) => _jsx(SeriesPattern, { id: patternId(i), index: i }, i)) }), segments.map(segment => {
|
|
66
|
+
const paint = barPaint(patternId(segment.index), segment.index);
|
|
67
|
+
// 模様の段階は、周りを系列の色の線(1.5px)で囲む。線が隣の隙間にはみ出さないように、線の太さの半分だけ内側に描く
|
|
68
|
+
const inset = paint.fill ? 0.75 : 0;
|
|
69
|
+
return (_jsx("rect", { x: segment.x + inset, y: inset, width: Math.max(1, segment.width - inset * 2), height: BAR_HEIGHT - inset * 2, fill: paint.fill, strokeWidth: paint.fill ? 1.5 : undefined, className: paint.className }, segment.index));
|
|
70
|
+
}), hover.index !== null &&
|
|
71
|
+
segments
|
|
72
|
+
.filter(segment => segment.index === hover.index)
|
|
73
|
+
.map(segment => (_jsx("rect", { x: segment.x - 1, y: -1, width: segment.width + 2, height: BAR_HEIGHT + 2, fill: "none", strokeWidth: "2", className: "stroke-foreground" }, "active"))), _jsx("rect", { x: 0, y: 0, width: width, height: BAR_HEIGHT, fill: "transparent", ...hover.handlers })] }), _jsx(ChartTooltip, { position: hover.position, onDismiss: hover.dismiss, children: active && hover.index !== null && (_jsx(ChartTooltipContent, { label: active.name, rows: [
|
|
74
|
+
{ name: valueLabel, swatch: _jsx(BarSwatch, { id: `${id}-tooltip`, index: hover.index }), value: formatValue(active.value, unit) },
|
|
75
|
+
{ name: RATIO_LABEL, value: ratioText(active.value, total) },
|
|
76
|
+
] })) })] }));
|
|
77
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./StackedBar.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./StackedBar.js";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface StatCardProps {
|
|
2
|
+
/** 何の数値か(「今月の問い合わせ」)。数値の上に出す */
|
|
3
|
+
label: string;
|
|
4
|
+
/** 主役の数値。値がないときは null にし、「値なし」と出す */
|
|
5
|
+
value: number | null;
|
|
6
|
+
/** 値の単位(「件」「%」「MB」)。値の書き方は docs/writing/date-and-number.md の「日付、数値、単位」に従う */
|
|
7
|
+
unit?: string;
|
|
8
|
+
/** 前の期間との差(今の値から前の期間の値を引いた数)。省いたときと null のときは、差の行を出さない */
|
|
9
|
+
change?: number | null;
|
|
10
|
+
/** 差の単位。省いたときは unit と同じ。率の差は「ポイント」にする */
|
|
11
|
+
changeUnit?: string;
|
|
12
|
+
/** 比べた前の期間の名前(「先月」「前の週」)。「先月から」の形で、差の後ろに出す。省いたときは「前の期間」 */
|
|
13
|
+
comparison?: string;
|
|
14
|
+
/** 小さな折れ線に描く、古い順の値。今の値を最後に入れる。省いたときは、折れ線を出さない */
|
|
15
|
+
trend?: ReadonlyArray<number | null>;
|
|
16
|
+
/** 外側の配置(余白と幅)だけに使う */
|
|
17
|
+
className?: string;
|
|
18
|
+
}
|
|
19
|
+
export declare function StatCard({ label, value, unit, change, changeUnit, comparison, trend, className }: StatCardProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ArrowDownIcon, ArrowUpIcon, MinusIcon } from "lucide-react";
|
|
3
|
+
import { cn } from "../../lib/cn.js";
|
|
4
|
+
import { Card } from "../card/Card.js";
|
|
5
|
+
import { formatValue } from "../chart/format.js";
|
|
6
|
+
import { Sparkline } from "../chart/Sparkline.js";
|
|
7
|
+
const icons = {
|
|
8
|
+
up: ArrowUpIcon,
|
|
9
|
+
down: ArrowDownIcon,
|
|
10
|
+
flat: MinusIcon,
|
|
11
|
+
};
|
|
12
|
+
// 見せる差の符号。マイナスは、ハイフンではなく負の記号(U+2212)で書く
|
|
13
|
+
const signs = {
|
|
14
|
+
up: "+",
|
|
15
|
+
down: "−",
|
|
16
|
+
flat: "±",
|
|
17
|
+
};
|
|
18
|
+
// 読み上げる差の文。符号や矢印を読ませず、増えたか減ったかを言葉で伝える
|
|
19
|
+
function spokenChange(direction, amount, comparison) {
|
|
20
|
+
if (direction === "flat")
|
|
21
|
+
return `${comparison}から変わりません。`;
|
|
22
|
+
return `${comparison}から${amount}${direction === "up" ? "増えました" : "減りました"}。`;
|
|
23
|
+
}
|
|
24
|
+
// 数値、単位、前の期間との差、小さな折れ線を1枚のカードにまとめる。
|
|
25
|
+
// 増えるのが良いとは限らないので、差を良し悪しの色で塗らない。向きは、矢印のアイコンと符号と、読み上げの文で伝える
|
|
26
|
+
export function StatCard({ label, value, unit, change, changeUnit = unit, comparison = "前の期間", trend, className }) {
|
|
27
|
+
const delta = typeof change === "number" && Number.isFinite(change) ? change : null;
|
|
28
|
+
const direction = delta === null || delta === 0 ? "flat" : delta > 0 ? "up" : "down";
|
|
29
|
+
const Icon = icons[direction];
|
|
30
|
+
const amount = delta === null ? "" : formatValue(Math.abs(delta), changeUnit);
|
|
31
|
+
return (_jsxs(Card, { className: cn("space-y-4", className), children: [_jsxs("div", { className: "space-y-2", children: [_jsx("p", { className: "text-sm text-muted-foreground", children: label }), _jsx("p", { className: "text-4xl font-bold leading-none", children: formatValue(value, unit) })] }), delta !== null && (_jsxs("p", { className: "text-sm", children: [_jsxs("span", { "aria-hidden": "true", className: "flex flex-wrap items-center gap-x-2", children: [_jsxs("span", { className: "inline-flex items-center gap-2", children: [_jsx(Icon, { className: "size-4 text-icon" }), _jsx("span", { className: "text-trim", children: `${signs[direction]}${amount}` })] }), _jsx("span", { className: "text-trim text-muted-foreground", children: `${comparison}から` })] }), _jsx("span", { className: "sr-only", children: spokenChange(direction, amount, comparison) })] })), trend && trend.length > 1 && _jsx(Sparkline, { values: trend })] }));
|
|
32
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./StatCard.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./StatCard.js";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type ButtonHTMLAttributes } from "react";
|
|
2
|
+
export interface SwitchProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "onChange" | "role" | "aria-checked" | "children"> {
|
|
3
|
+
/** オンか。状態は使う側で持つ */
|
|
4
|
+
checked: boolean;
|
|
5
|
+
/** 押したときに、切り替えた後の値で呼ぶ。押した時点で設定に反映する */
|
|
6
|
+
onChange: (checked: boolean) => void;
|
|
7
|
+
/** 外側の配置(余白)だけに使う。部品の見た目は上書きしない */
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function Switch({ checked, onChange, type, className, onClick, ...props }: SwitchProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef } from "react";
|
|
3
|
+
import { cn } from "../../lib/cn.js";
|
|
4
|
+
// WAI-ARIA の Switch パターン。押した時点で反映する設定に使い、フォームで送る入力にはしない。
|
|
5
|
+
// 見た目は aria-checked から決める(aria-checked: と group-aria-checked: のクラス)。
|
|
6
|
+
// 溝は 44×24px。押せる範囲は、見えない ::after を上下に広げて 44×44px にする(docs/layout/hit-area.md の押せる範囲)。
|
|
7
|
+
// 溝の色だけでなく、つまみの位置と色でもオンとオフを示す
|
|
8
|
+
export function Switch({ checked, onChange, type = "button", className, onClick, ...props }) {
|
|
9
|
+
const ref = useRef(null);
|
|
10
|
+
const named = Boolean(props["aria-label"] || props["aria-labelledby"]);
|
|
11
|
+
// 描くたびではなく、名前のないスイッチになったときに1回だけ知らせる。<label htmlFor> は描いた後でないと分からない
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
if (!named && !ref.current?.labels?.length)
|
|
14
|
+
console.warn("Switch: <Label htmlFor> か aria-label で名前を付ける");
|
|
15
|
+
}, [named]);
|
|
16
|
+
function handleClick(event) {
|
|
17
|
+
onClick?.(event);
|
|
18
|
+
if (!event.defaultPrevented)
|
|
19
|
+
onChange(!checked);
|
|
20
|
+
}
|
|
21
|
+
return (_jsx("button", { ref: ref, type: type, ...props, role: "switch", "aria-checked": checked, onClick: handleClick, className: cn("group relative inline-flex h-6 w-11 shrink-0 items-center rounded-full border-2 border-transparent bg-input outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 aria-checked:bg-primary after:absolute after:-inset-x-0.5 after:-inset-y-3", className), children: _jsx("span", { "aria-hidden": "true", className: "block size-5 rounded-full bg-background transition-transform duration-150 motion-reduce:transition-none group-aria-checked:translate-x-5 group-aria-checked:bg-primary-icon" }) }));
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Switch.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Switch.js";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type SortDirection = "ascending" | "descending" | "none";
|
|
2
|
+
export interface SortableHeaderProps {
|
|
3
|
+
/** 列の名前 */
|
|
4
|
+
children: string;
|
|
5
|
+
/** 並べ替えの向き。並べ替えていない列は none */
|
|
6
|
+
direction: SortDirection;
|
|
7
|
+
/** 見出しを押したとき。次の向きは使う側で決める */
|
|
8
|
+
onSort: () => void;
|
|
9
|
+
/** 隠す列の条件や揃えだけに使う */
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function SortableHeader({ children, direction, onSort, className }: SortableHeaderProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ArrowDownIcon, ArrowUpDownIcon, ArrowUpIcon } from "lucide-react";
|
|
3
|
+
import { Button } from "../button/Button.js";
|
|
4
|
+
import { cn } from "../../lib/cn.js";
|
|
5
|
+
import { headerAlign } from "./align.js";
|
|
6
|
+
const icons = { ascending: ArrowUpIcon, descending: ArrowDownIcon, none: ArrowUpDownIcon };
|
|
7
|
+
// 並べ替えのできる列の見出し。向きを矢印のアイコンと aria-sort で示す
|
|
8
|
+
export function SortableHeader({ children, direction, onSort, className }) {
|
|
9
|
+
const Icon = icons[direction];
|
|
10
|
+
return (_jsx("th", { scope: "col", "aria-sort": direction, className: cn("whitespace-nowrap px-2 py-0 text-sm font-medium leading-tight text-muted-foreground", headerAlign(className), className), children: _jsxs(Button, { variant: "muted", size: "sm", onClick: onSort, children: [children, _jsx(Icon, { "aria-hidden": "true", className: "size-4" })] }) }));
|
|
11
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type HTMLAttributes, type TdHTMLAttributes, type ThHTMLAttributes } from "react";
|
|
2
|
+
export declare const Table: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLTableElement> & import("react").RefAttributes<HTMLTableElement>>;
|
|
3
|
+
export declare const TableHead: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLTableSectionElement> & import("react").RefAttributes<HTMLTableSectionElement>>;
|
|
4
|
+
export declare const TableBody: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLTableSectionElement> & import("react").RefAttributes<HTMLTableSectionElement>>;
|
|
5
|
+
export declare const TableRow: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLTableRowElement> & import("react").RefAttributes<HTMLTableRowElement>>;
|
|
6
|
+
export interface TableHeaderCellProps extends ThHTMLAttributes<HTMLTableCellElement> {
|
|
7
|
+
/** 隠す列の条件(hidden @3xl:table-cell など)や、揃え(text-right)だけに使う */
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare const TableHeaderCell: import("react").ForwardRefExoticComponent<TableHeaderCellProps & import("react").RefAttributes<HTMLTableCellElement>>;
|
|
11
|
+
export interface TableCellProps extends TdHTMLAttributes<HTMLTableCellElement> {
|
|
12
|
+
/** 折り返す列の最小の幅(min-w-48)、短い値の whitespace-nowrap、揃え、隠す列の条件だけに使う */
|
|
13
|
+
className?: string;
|
|
14
|
+
}
|
|
15
|
+
export declare const TableCell: import("react").ForwardRefExoticComponent<TableCellProps & import("react").RefAttributes<HTMLTableCellElement>>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { cn } from "../../lib/cn.js";
|
|
4
|
+
import { headerAlign } from "./align.js";
|
|
5
|
+
// 表。行と行の間は border-b の線で区切り、縞模様は付けない(docs/components/table.md の表)。
|
|
6
|
+
// どの部品も、ref はそれぞれの要素(table、thead、tbody、tr、th、td)に渡す。
|
|
7
|
+
// React 18 でも ref を受け取れるように、forwardRef で包む(LinkButton と同じ形)
|
|
8
|
+
export const Table = forwardRef(function Table({ className, ...props }, ref) {
|
|
9
|
+
return _jsx("table", { ref: ref, className: cn("w-full border-collapse text-sm", className), ...props });
|
|
10
|
+
});
|
|
11
|
+
export const TableHead = forwardRef(function TableHead(props, ref) {
|
|
12
|
+
return _jsx("thead", { ref: ref, className: "bg-muted", ...props });
|
|
13
|
+
});
|
|
14
|
+
export const TableBody = forwardRef(function TableBody(props, ref) {
|
|
15
|
+
return _jsx("tbody", { ref: ref, ...props });
|
|
16
|
+
});
|
|
17
|
+
export const TableRow = forwardRef(function TableRow(props, ref) {
|
|
18
|
+
return _jsx("tr", { ref: ref, className: "border-b", ...props });
|
|
19
|
+
});
|
|
20
|
+
// 列の見出しは折り返さない
|
|
21
|
+
export const TableHeaderCell = forwardRef(function TableHeaderCell({ className, scope = "col", ...props }, ref) {
|
|
22
|
+
return (_jsx("th", { ref: ref, scope: scope, className: cn("whitespace-nowrap px-4 py-2 text-sm font-medium leading-tight text-muted-foreground", headerAlign(className), className), ...props }));
|
|
23
|
+
});
|
|
24
|
+
export const TableCell = forwardRef(function TableCell({ className, ...props }, ref) {
|
|
25
|
+
return _jsx("td", { ref: ref, className: cn("px-4 py-2 leading-tight", className), ...props });
|
|
26
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function headerAlign(className: string | undefined): string;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { Table, TableHead, TableBody, TableRow, TableHeaderCell, TableCell } from "./Table.js";
|
|
2
|
+
export type { TableHeaderCellProps, TableCellProps } from "./Table.js";
|
|
3
|
+
export { SortableHeader } from "./SortableHeader.js";
|
|
4
|
+
export type { SortableHeaderProps, SortDirection } from "./SortableHeader.js";
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
export interface TabsProps {
|
|
3
|
+
/** 選択中のタブの value。URLのクエリなどから読んだ値を渡す */
|
|
4
|
+
value: string;
|
|
5
|
+
/** タブを選んだとき(押したとき、矢印キー・Home・Endで移ったとき)。選んだタブの value を受け取り、URLに書く */
|
|
6
|
+
onChange: (value: string) => void;
|
|
7
|
+
/** TabList と TabPanel を並べる */
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
/** 外側の配置(余白と幅)だけに使う */
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function Tabs({ value, onChange, children, className }: TabsProps): import("react").JSX.Element;
|
|
13
|
+
export interface TabListProps {
|
|
14
|
+
/** Tab を直下に並べる。横幅に入りきらないタブは、末尾の「その他のタブ」のメニューにまとめる */
|
|
15
|
+
children: ReactNode;
|
|
16
|
+
/** タブの並びの名前。見える見出しがあれば aria-labelledby で結ぶ */
|
|
17
|
+
"aria-label"?: string;
|
|
18
|
+
"aria-labelledby"?: string;
|
|
19
|
+
/** 外側の配置(余白と幅)だけに使う */
|
|
20
|
+
className?: string;
|
|
21
|
+
}
|
|
22
|
+
export declare function TabList({ children, className, ...props }: TabListProps): import("react").JSX.Element;
|
|
23
|
+
export interface TabProps {
|
|
24
|
+
/** タブを見分ける値。TabPanel の value と同じにする。空白を含めない */
|
|
25
|
+
value: string;
|
|
26
|
+
/** タブの名前。パネルの中で同じ名前の見出しを繰り返さない。入りきらないときは、そのまま「その他のタブ」のメニューの項目の名前になる */
|
|
27
|
+
children: ReactNode;
|
|
28
|
+
}
|
|
29
|
+
export declare function Tab({ value, children }: TabProps): import("react").JSX.Element;
|
|
30
|
+
export interface TabPanelProps {
|
|
31
|
+
/** 対応する Tab の value */
|
|
32
|
+
value: string;
|
|
33
|
+
/** パネルの中身。タブの名前と同じ見出しは置かない */
|
|
34
|
+
children: ReactNode;
|
|
35
|
+
/** 外側の配置(余白と幅)だけに使う */
|
|
36
|
+
className?: string;
|
|
37
|
+
}
|
|
38
|
+
export declare function TabPanel({ value, children, className }: TabPanelProps): import("react").JSX.Element;
|