@hewnui/ui 0.0.0-stage → 0.1.1
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 +69 -2
- package/dist/chart/axes.d.ts +31 -0
- package/dist/chart/axes.js +20 -0
- package/dist/chart/colors.d.ts +1 -0
- package/dist/chart/colors.js +13 -0
- package/dist/chart/frame.d.ts +13 -0
- package/dist/chart/frame.js +17 -0
- package/dist/chart/interaction.d.ts +22 -0
- package/dist/chart/interaction.js +22 -0
- package/dist/chart/path.d.ts +10 -0
- package/dist/chart/path.js +24 -0
- package/dist/chart/scales.d.ts +34 -0
- package/dist/chart/scales.js +66 -0
- package/dist/chart/status.d.ts +3 -0
- package/dist/chart/status.js +15 -0
- package/dist/chart/types.d.ts +34 -0
- package/dist/chart/types.js +6 -0
- package/dist/components/area-chart/area-chart.d.ts +17 -0
- package/dist/components/area-chart/area-chart.js +54 -0
- package/dist/components/area-chart/index.d.ts +1 -0
- package/dist/components/area-chart/index.js +1 -0
- package/dist/components/badge/badge.d.ts +2 -0
- package/dist/components/badge/badge.js +5 -0
- package/dist/components/badge/badge.styles.d.ts +8 -0
- package/dist/components/badge/badge.styles.js +57 -0
- package/dist/components/badge/badge.types.d.ts +11 -0
- package/dist/components/badge/badge.types.js +1 -0
- package/dist/components/badge/index.d.ts +3 -0
- package/dist/components/badge/index.js +2 -0
- package/dist/components/bar-chart/bar-chart.d.ts +17 -0
- package/dist/components/bar-chart/bar-chart.js +73 -0
- package/dist/components/bar-chart/index.d.ts +1 -0
- package/dist/components/bar-chart/index.js +1 -0
- package/dist/components/breadcrumbs/breadcrumbs.d.ts +3 -0
- package/dist/components/breadcrumbs/breadcrumbs.js +13 -0
- package/dist/components/breadcrumbs/breadcrumbs.styles.d.ts +5 -0
- package/dist/components/breadcrumbs/breadcrumbs.styles.js +10 -0
- package/dist/components/breadcrumbs/breadcrumbs.types.d.ts +16 -0
- package/dist/components/breadcrumbs/breadcrumbs.types.js +1 -0
- package/dist/components/breadcrumbs/index.d.ts +2 -0
- package/dist/components/breadcrumbs/index.js +1 -0
- package/dist/components/button/button.d.ts +2 -0
- package/dist/components/button/button.js +18 -0
- package/dist/components/button/button.motion.d.ts +23 -0
- package/dist/components/button/button.motion.js +11 -0
- package/dist/components/button/button.styles.d.ts +10 -0
- package/dist/components/button/button.styles.js +24 -0
- package/dist/components/button/button.types.d.ts +11 -0
- package/dist/components/button/button.types.js +1 -0
- package/dist/components/button/index.d.ts +2 -0
- package/dist/components/button/index.js +1 -0
- package/dist/components/card/card.d.ts +21 -0
- package/dist/components/card/card.js +19 -0
- package/dist/components/card/card.styles.d.ts +4 -0
- package/dist/components/card/card.styles.js +13 -0
- package/dist/components/card/card.types.d.ts +4 -0
- package/dist/components/card/card.types.js +1 -0
- package/dist/components/card/index.d.ts +2 -0
- package/dist/components/card/index.js +1 -0
- package/dist/components/checkbox/checkbox.d.ts +2 -0
- package/dist/components/checkbox/checkbox.js +17 -0
- package/dist/components/checkbox/checkbox.styles.d.ts +3 -0
- package/dist/components/checkbox/checkbox.styles.js +6 -0
- package/dist/components/checkbox/checkbox.types.d.ts +6 -0
- package/dist/components/checkbox/checkbox.types.js +1 -0
- package/dist/components/checkbox/index.d.ts +2 -0
- package/dist/components/checkbox/index.js +1 -0
- package/dist/components/checkbox-group/checkbox-group.d.ts +2 -0
- package/dist/components/checkbox-group/checkbox-group.js +8 -0
- package/dist/components/checkbox-group/checkbox-group.styles.d.ts +2 -0
- package/dist/components/checkbox-group/checkbox-group.styles.js +5 -0
- package/dist/components/checkbox-group/checkbox-group.types.d.ts +9 -0
- package/dist/components/checkbox-group/checkbox-group.types.js +1 -0
- package/dist/components/checkbox-group/index.d.ts +2 -0
- package/dist/components/checkbox-group/index.js +1 -0
- package/dist/components/color-picker/color-picker.d.ts +2 -0
- package/dist/components/color-picker/color-picker.js +27 -0
- package/dist/components/color-picker/color-picker.oklch.d.ts +2 -0
- package/dist/components/color-picker/color-picker.oklch.js +54 -0
- package/dist/components/color-picker/color-picker.panel.d.ts +2 -0
- package/dist/components/color-picker/color-picker.panel.js +15 -0
- package/dist/components/color-picker/color-picker.styles.d.ts +16 -0
- package/dist/components/color-picker/color-picker.styles.js +28 -0
- package/dist/components/color-picker/color-picker.types.d.ts +36 -0
- package/dist/components/color-picker/color-picker.types.js +1 -0
- package/dist/components/color-picker/index.d.ts +4 -0
- package/dist/components/color-picker/index.js +3 -0
- package/dist/components/combobox/combobox.d.ts +15 -0
- package/dist/components/combobox/combobox.js +11 -0
- package/dist/components/combobox/index.d.ts +1 -0
- package/dist/components/combobox/index.js +1 -0
- package/dist/components/command-palette/command-palette-items.d.ts +4 -0
- package/dist/components/command-palette/command-palette-items.js +14 -0
- package/dist/components/command-palette/command-palette.d.ts +15 -0
- package/dist/components/command-palette/command-palette.hotkey.d.ts +8 -0
- package/dist/components/command-palette/command-palette.hotkey.js +51 -0
- package/dist/components/command-palette/command-palette.js +33 -0
- package/dist/components/command-palette/command-palette.styles.d.ts +13 -0
- package/dist/components/command-palette/command-palette.styles.js +25 -0
- package/dist/components/command-palette/command-palette.types.d.ts +65 -0
- package/dist/components/command-palette/command-palette.types.js +1 -0
- package/dist/components/command-palette/index.d.ts +14 -0
- package/dist/components/command-palette/index.js +13 -0
- package/dist/components/data-table/data-table.d.ts +7 -0
- package/dist/components/data-table/data-table.js +31 -0
- package/dist/components/data-table/index.d.ts +1 -0
- package/dist/components/data-table/index.js +1 -0
- package/dist/components/date-picker/date-picker.d.ts +7 -0
- package/dist/components/date-picker/date-picker.js +8 -0
- package/dist/components/date-picker/index.d.ts +1 -0
- package/dist/components/date-picker/index.js +1 -0
- package/dist/components/date-range-picker/date-range-picker.calendar.d.ts +5 -0
- package/dist/components/date-range-picker/date-range-picker.calendar.js +21 -0
- package/dist/components/date-range-picker/date-range-picker.d.ts +2 -0
- package/dist/components/date-range-picker/date-range-picker.js +9 -0
- package/dist/components/date-range-picker/date-range-picker.presets.d.ts +3 -0
- package/dist/components/date-range-picker/date-range-picker.presets.js +53 -0
- package/dist/components/date-range-picker/date-range-picker.styles.d.ts +11 -0
- package/dist/components/date-range-picker/date-range-picker.styles.js +14 -0
- package/dist/components/date-range-picker/date-range-picker.types.d.ts +28 -0
- package/dist/components/date-range-picker/date-range-picker.types.js +1 -0
- package/dist/components/date-range-picker/index.d.ts +2 -0
- package/dist/components/date-range-picker/index.js +1 -0
- package/dist/components/dialog/dialog.d.ts +18 -0
- package/dist/components/dialog/dialog.js +16 -0
- package/dist/components/dialog/dialog.styles.d.ts +6 -0
- package/dist/components/dialog/dialog.styles.js +9 -0
- package/dist/components/dialog/index.d.ts +7 -0
- package/dist/components/dialog/index.js +7 -0
- package/dist/components/donut-chart/donut-chart.d.ts +17 -0
- package/dist/components/donut-chart/donut-chart.js +65 -0
- package/dist/components/donut-chart/index.d.ts +1 -0
- package/dist/components/donut-chart/index.js +1 -0
- package/dist/components/drawer/drawer.d.ts +13 -0
- package/dist/components/drawer/drawer.js +14 -0
- package/dist/components/drawer/index.d.ts +1 -0
- package/dist/components/drawer/index.js +1 -0
- package/dist/components/empty/empty.d.ts +7 -0
- package/dist/components/empty/empty.js +5 -0
- package/dist/components/empty/index.d.ts +1 -0
- package/dist/components/empty/index.js +1 -0
- package/dist/components/file-upload/file-upload.d.ts +2 -0
- package/dist/components/file-upload/file-upload.js +44 -0
- package/dist/components/file-upload/file-upload.styles.d.ts +12 -0
- package/dist/components/file-upload/file-upload.styles.js +14 -0
- package/dist/components/file-upload/file-upload.types.d.ts +16 -0
- package/dist/components/file-upload/file-upload.types.js +1 -0
- package/dist/components/file-upload/index.d.ts +2 -0
- package/dist/components/file-upload/index.js +1 -0
- package/dist/components/form/form.d.ts +2 -0
- package/dist/components/form/form.js +7 -0
- package/dist/components/form/form.styles.d.ts +1 -0
- package/dist/components/form/form.styles.js +4 -0
- package/dist/components/form/form.types.d.ts +6 -0
- package/dist/components/form/form.types.js +1 -0
- package/dist/components/form/index.d.ts +2 -0
- package/dist/components/form/index.js +1 -0
- package/dist/components/input-group/index.d.ts +2 -0
- package/dist/components/input-group/index.js +1 -0
- package/dist/components/input-group/input-group.d.ts +14 -0
- package/dist/components/input-group/input-group.js +24 -0
- package/dist/components/input-group/input-group.styles.d.ts +8 -0
- package/dist/components/input-group/input-group.styles.js +9 -0
- package/dist/components/input-group/input-group.types.d.ts +22 -0
- package/dist/components/input-group/input-group.types.js +1 -0
- package/dist/components/input-otp/index.d.ts +2 -0
- package/dist/components/input-otp/index.js +1 -0
- package/dist/components/input-otp/input-otp.d.ts +2 -0
- package/dist/components/input-otp/input-otp.js +76 -0
- package/dist/components/input-otp/input-otp.styles.d.ts +8 -0
- package/dist/components/input-otp/input-otp.styles.js +11 -0
- package/dist/components/input-otp/input-otp.types.d.ts +23 -0
- package/dist/components/input-otp/input-otp.types.js +1 -0
- package/dist/components/line-chart/index.d.ts +1 -0
- package/dist/components/line-chart/index.js +1 -0
- package/dist/components/line-chart/line-chart.d.ts +17 -0
- package/dist/components/line-chart/line-chart.js +53 -0
- package/dist/components/link/index.d.ts +2 -0
- package/dist/components/link/index.js +1 -0
- package/dist/components/link/link.d.ts +2 -0
- package/dist/components/link/link.js +7 -0
- package/dist/components/link/link.styles.d.ts +5 -0
- package/dist/components/link/link.styles.js +9 -0
- package/dist/components/link/link.types.d.ts +8 -0
- package/dist/components/link/link.types.js +1 -0
- package/dist/components/menu/index.d.ts +8 -0
- package/dist/components/menu/index.js +8 -0
- package/dist/components/menu/menu.d.ts +20 -0
- package/dist/components/menu/menu.js +26 -0
- package/dist/components/number-field/index.d.ts +2 -0
- package/dist/components/number-field/index.js +1 -0
- package/dist/components/number-field/number-field.d.ts +2 -0
- package/dist/components/number-field/number-field.js +14 -0
- package/dist/components/number-field/number-field.styles.d.ts +8 -0
- package/dist/components/number-field/number-field.styles.js +7 -0
- package/dist/components/number-field/number-field.types.d.ts +14 -0
- package/dist/components/number-field/number-field.types.js +1 -0
- package/dist/components/pagination/index.d.ts +3 -0
- package/dist/components/pagination/index.js +2 -0
- package/dist/components/pagination/pagination.d.ts +2 -0
- package/dist/components/pagination/pagination.js +49 -0
- package/dist/components/pagination/pagination.styles.d.ts +8 -0
- package/dist/components/pagination/pagination.styles.js +19 -0
- package/dist/components/pagination/pagination.types.d.ts +35 -0
- package/dist/components/pagination/pagination.types.js +1 -0
- package/dist/components/pagination/pagination.utils.d.ts +6 -0
- package/dist/components/pagination/pagination.utils.js +51 -0
- package/dist/components/password-field/index.d.ts +2 -0
- package/dist/components/password-field/index.js +1 -0
- package/dist/components/password-field/password-field.d.ts +2 -0
- package/dist/components/password-field/password-field.js +17 -0
- package/dist/components/password-field/password-field.styles.d.ts +8 -0
- package/dist/components/password-field/password-field.styles.js +7 -0
- package/dist/components/password-field/password-field.types.d.ts +16 -0
- package/dist/components/password-field/password-field.types.js +1 -0
- package/dist/components/popover/index.d.ts +2 -0
- package/dist/components/popover/index.js +1 -0
- package/dist/components/popover/popover.d.ts +10 -0
- package/dist/components/popover/popover.js +16 -0
- package/dist/components/popover/popover.styles.d.ts +3 -0
- package/dist/components/popover/popover.styles.js +7 -0
- package/dist/components/popover/popover.types.d.ts +14 -0
- package/dist/components/popover/popover.types.js +1 -0
- package/dist/components/progress/index.d.ts +2 -0
- package/dist/components/progress/index.js +1 -0
- package/dist/components/progress/progress.d.ts +12 -0
- package/dist/components/progress/progress.js +26 -0
- package/dist/components/radio-group/index.d.ts +2 -0
- package/dist/components/radio-group/index.js +1 -0
- package/dist/components/radio-group/radio-group.d.ts +3 -0
- package/dist/components/radio-group/radio-group.js +21 -0
- package/dist/components/radio-group/radio-group.styles.d.ts +5 -0
- package/dist/components/radio-group/radio-group.styles.js +14 -0
- package/dist/components/radio-group/radio-group.types.d.ts +14 -0
- package/dist/components/radio-group/radio-group.types.js +1 -0
- package/dist/components/search-field/index.d.ts +2 -0
- package/dist/components/search-field/index.js +1 -0
- package/dist/components/search-field/search-field.d.ts +2 -0
- package/dist/components/search-field/search-field.js +15 -0
- package/dist/components/search-field/search-field.styles.d.ts +8 -0
- package/dist/components/search-field/search-field.styles.js +7 -0
- package/dist/components/search-field/search-field.types.d.ts +15 -0
- package/dist/components/search-field/search-field.types.js +1 -0
- package/dist/components/select/index.d.ts +5 -0
- package/dist/components/select/index.js +5 -0
- package/dist/components/select/select.d.ts +16 -0
- package/dist/components/select/select.js +11 -0
- package/dist/components/select/select.styles.d.ts +5 -0
- package/dist/components/select/select.styles.js +13 -0
- package/dist/components/skeleton/index.d.ts +1 -0
- package/dist/components/skeleton/index.js +1 -0
- package/dist/components/skeleton/skeleton.d.ts +3 -0
- package/dist/components/skeleton/skeleton.js +5 -0
- package/dist/components/slider/index.d.ts +2 -0
- package/dist/components/slider/index.js +1 -0
- package/dist/components/slider/slider.d.ts +2 -0
- package/dist/components/slider/slider.js +8 -0
- package/dist/components/slider/slider.styles.d.ts +6 -0
- package/dist/components/slider/slider.styles.js +9 -0
- package/dist/components/slider/slider.types.d.ts +8 -0
- package/dist/components/slider/slider.types.js +1 -0
- package/dist/components/sparkline/index.d.ts +1 -0
- package/dist/components/sparkline/index.js +1 -0
- package/dist/components/sparkline/sparkline.d.ts +11 -0
- package/dist/components/sparkline/sparkline.js +34 -0
- package/dist/components/spinner/index.d.ts +1 -0
- package/dist/components/spinner/index.js +1 -0
- package/dist/components/spinner/spinner.d.ts +4 -0
- package/dist/components/spinner/spinner.js +6 -0
- package/dist/components/stepper/index.d.ts +3 -0
- package/dist/components/stepper/index.js +2 -0
- package/dist/components/stepper/stepper-step.d.ts +15 -0
- package/dist/components/stepper/stepper-step.js +46 -0
- package/dist/components/stepper/stepper.d.ts +4 -0
- package/dist/components/stepper/stepper.js +17 -0
- package/dist/components/stepper/stepper.styles.d.ts +10 -0
- package/dist/components/stepper/stepper.styles.js +37 -0
- package/dist/components/stepper/stepper.types.d.ts +50 -0
- package/dist/components/stepper/stepper.types.js +1 -0
- package/dist/components/stepper/use-stepper.d.ts +6 -0
- package/dist/components/stepper/use-stepper.js +40 -0
- package/dist/components/switch/index.d.ts +2 -0
- package/dist/components/switch/index.js +1 -0
- package/dist/components/switch/switch.d.ts +2 -0
- package/dist/components/switch/switch.js +7 -0
- package/dist/components/switch/switch.styles.d.ts +3 -0
- package/dist/components/switch/switch.styles.js +6 -0
- package/dist/components/switch/switch.types.d.ts +6 -0
- package/dist/components/switch/switch.types.js +1 -0
- package/dist/components/table/index.d.ts +11 -0
- package/dist/components/table/index.js +11 -0
- package/dist/components/table/table-sort-glyph.d.ts +3 -0
- package/dist/components/table/table-sort-glyph.js +5 -0
- package/dist/components/table/table.d.ts +33 -0
- package/dist/components/table/table.js +31 -0
- package/dist/components/table/table.styles.d.ts +8 -0
- package/dist/components/table/table.styles.js +19 -0
- package/dist/components/tabs/index.d.ts +7 -0
- package/dist/components/tabs/index.js +7 -0
- package/dist/components/tabs/tabs.d.ts +20 -0
- package/dist/components/tabs/tabs.js +29 -0
- package/dist/components/tabs/tabs.styles.d.ts +5 -0
- package/dist/components/tabs/tabs.styles.js +30 -0
- package/dist/components/tag-field/index.d.ts +2 -0
- package/dist/components/tag-field/index.js +1 -0
- package/dist/components/tag-field/tag-field-icons.d.ts +2 -0
- package/dist/components/tag-field/tag-field-icons.js +7 -0
- package/dist/components/tag-field/tag-field-tags.d.ts +7 -0
- package/dist/components/tag-field/tag-field-tags.js +19 -0
- package/dist/components/tag-field/tag-field.d.ts +6 -0
- package/dist/components/tag-field/tag-field.js +46 -0
- package/dist/components/tag-field/tag-field.styles.d.ts +14 -0
- package/dist/components/tag-field/tag-field.styles.js +42 -0
- package/dist/components/tag-field/tag-field.types.d.ts +32 -0
- package/dist/components/tag-field/tag-field.types.js +1 -0
- package/dist/components/text-area/index.d.ts +2 -0
- package/dist/components/text-area/index.js +1 -0
- package/dist/components/text-area/text-area.d.ts +2 -0
- package/dist/components/text-area/text-area.js +9 -0
- package/dist/components/text-area/text-area.styles.d.ts +6 -0
- package/dist/components/text-area/text-area.styles.js +5 -0
- package/dist/components/text-area/text-area.types.d.ts +16 -0
- package/dist/components/text-area/text-area.types.js +1 -0
- package/dist/components/text-field/index.d.ts +2 -0
- package/dist/components/text-field/index.js +1 -0
- package/dist/components/text-field/text-field.d.ts +2 -0
- package/dist/components/text-field/text-field.js +8 -0
- package/dist/components/text-field/text-field.styles.d.ts +1 -0
- package/dist/components/text-field/text-field.styles.js +1 -0
- package/dist/components/text-field/text-field.types.d.ts +15 -0
- package/dist/components/text-field/text-field.types.js +1 -0
- package/dist/components/toast/index.d.ts +2 -0
- package/dist/components/toast/index.js +1 -0
- package/dist/components/toast/toast-glyph.d.ts +4 -0
- package/dist/components/toast/toast-glyph.js +23 -0
- package/dist/components/toast/toast-item.d.ts +14 -0
- package/dist/components/toast/toast-item.js +21 -0
- package/dist/components/toast/toast.d.ts +16 -0
- package/dist/components/toast/toast.js +50 -0
- package/dist/components/toast/toast.styles.d.ts +13 -0
- package/dist/components/toast/toast.styles.js +50 -0
- package/dist/components/tooltip/index.d.ts +2 -0
- package/dist/components/tooltip/index.js +1 -0
- package/dist/components/tooltip/tooltip.d.ts +3 -0
- package/dist/components/tooltip/tooltip.js +10 -0
- package/dist/components/tooltip/tooltip.styles.d.ts +1 -0
- package/dist/components/tooltip/tooltip.styles.js +6 -0
- package/dist/components/tooltip/tooltip.types.d.ts +18 -0
- package/dist/components/tooltip/tooltip.types.js +1 -0
- package/dist/index.d.ts +54 -0
- package/dist/index.js +51 -0
- package/dist/providers/material-provider.d.ts +12 -0
- package/dist/providers/material-provider.js +30 -0
- package/dist/providers/motion-provider.d.ts +20 -0
- package/dist/providers/motion-provider.js +45 -0
- package/dist/providers/radius-provider.d.ts +13 -0
- package/dist/providers/radius-provider.js +73 -0
- package/dist/providers/theme-provider.d.ts +25 -0
- package/dist/providers/theme-provider.js +66 -0
- package/dist/styles/field.d.ts +24 -0
- package/dist/styles/field.js +36 -0
- package/dist/styles/overlays.d.ts +3 -0
- package/dist/styles/overlays.js +4 -0
- package/dist/utils/cn.d.ts +1 -0
- package/dist/utils/cn.js +3 -0
- package/package.json +276 -3
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { ChartTooltip } from "../../chart/interaction.js";
|
|
3
|
+
import type { ChartSeries, ChartStatus } from "../../chart/types.js";
|
|
4
|
+
export type BarChartProps = {
|
|
5
|
+
series: ChartSeries[];
|
|
6
|
+
summary: string;
|
|
7
|
+
className?: string;
|
|
8
|
+
width?: number;
|
|
9
|
+
height?: number;
|
|
10
|
+
status?: ChartStatus;
|
|
11
|
+
children?: ReactNode;
|
|
12
|
+
};
|
|
13
|
+
declare function BarChartRoot({ series, summary, className, width, height, status, children, }: BarChartProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export declare const BarChart: typeof BarChartRoot & {
|
|
15
|
+
Tooltip: typeof ChartTooltip;
|
|
16
|
+
};
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { springs } from "@hewnui/motion";
|
|
4
|
+
import { m } from "motion/react";
|
|
5
|
+
import { AxisLabels, GridLines } from "../../chart/axes.js";
|
|
6
|
+
import { seriesColor } from "../../chart/colors.js";
|
|
7
|
+
import { ChartFrame } from "../../chart/frame.js";
|
|
8
|
+
import { ChartInteractionProvider, ChartTooltip, useChartInteraction, } from "../../chart/interaction.js";
|
|
9
|
+
import { createBandScales, flattenSeries } from "../../chart/scales.js";
|
|
10
|
+
import { resolveStatus } from "../../chart/status.js";
|
|
11
|
+
import { useMotionMode } from "../../providers/motion-provider.js";
|
|
12
|
+
function BarChartRoot({ series, summary, className, width = 480, height = 240, status, children, }) {
|
|
13
|
+
const resolved = resolveStatus(series, status);
|
|
14
|
+
if (resolved !== "ready") {
|
|
15
|
+
return (_jsx(ChartFrame, { className: className, width: width, height: height, summary: summary, status: resolved }));
|
|
16
|
+
}
|
|
17
|
+
return (_jsx(ChartInteractionProvider, { series: series, children: _jsxs("div", { className: "relative", style: { maxWidth: width }, children: [_jsx(BarChartSvg, { series: series, summary: summary, className: className, width: width, height: height }), children] }) }));
|
|
18
|
+
}
|
|
19
|
+
function BarChartSvg({ series, summary, className, width, height, }) {
|
|
20
|
+
const { motionEnabled } = useMotionMode();
|
|
21
|
+
const { setHover } = useChartInteraction();
|
|
22
|
+
const flat = flattenSeries(series);
|
|
23
|
+
const { x, y, pad, categories } = createBandScales(flat, { width, height });
|
|
24
|
+
const baseline = y(0) ?? height - pad.bottom;
|
|
25
|
+
const groupCount = Math.max(1, series.length);
|
|
26
|
+
const band = x.bandwidth();
|
|
27
|
+
const barW = band / groupCount;
|
|
28
|
+
return (_jsxs(ChartFrame, { className: className, width: width, height: height, summary: summary, interactive: true, children: [_jsx(GridLines, { x: x, y: y, width: width, height: height, pad: pad }), _jsx(AxisLabels, { x: x, y: y, height: height, pad: pad, xIsBand: true }), series.map((item, seriesIndex) => {
|
|
29
|
+
const color = seriesColor(seriesIndex, item.color);
|
|
30
|
+
return (_jsx("g", { children: item.data.map((point) => {
|
|
31
|
+
const category = String(point.x);
|
|
32
|
+
if (!categories.includes(category))
|
|
33
|
+
return null;
|
|
34
|
+
const px = (x(category) ?? 0) + barW * seriesIndex;
|
|
35
|
+
const py = y(point.y) ?? baseline;
|
|
36
|
+
const barH = Math.max(0, baseline - py);
|
|
37
|
+
const barProps = {
|
|
38
|
+
x: px,
|
|
39
|
+
y: py,
|
|
40
|
+
width: Math.max(1, barW - 2),
|
|
41
|
+
height: barH,
|
|
42
|
+
rx: 4,
|
|
43
|
+
fill: color,
|
|
44
|
+
tabIndex: 0,
|
|
45
|
+
role: "button",
|
|
46
|
+
"aria-label": `${item.label}: ${category}, ${point.y}`,
|
|
47
|
+
className: "cursor-pointer outline-none focus-visible:stroke-ring",
|
|
48
|
+
onFocus: () => setHover({
|
|
49
|
+
seriesId: item.id,
|
|
50
|
+
label: item.label,
|
|
51
|
+
point,
|
|
52
|
+
color,
|
|
53
|
+
px: px + barW / 2,
|
|
54
|
+
py,
|
|
55
|
+
}),
|
|
56
|
+
onBlur: () => setHover(null),
|
|
57
|
+
onMouseEnter: () => setHover({
|
|
58
|
+
seriesId: item.id,
|
|
59
|
+
label: item.label,
|
|
60
|
+
point,
|
|
61
|
+
color,
|
|
62
|
+
px: px + barW / 2,
|
|
63
|
+
py,
|
|
64
|
+
}),
|
|
65
|
+
onMouseLeave: () => setHover(null),
|
|
66
|
+
};
|
|
67
|
+
return motionEnabled ? (_jsx(m.rect, { ...barProps, initial: { opacity: 0.4 }, animate: { opacity: 1 }, transition: springs.snappy }, `${item.id}-${category}`)) : (_jsx("rect", { ...barProps }, `${item.id}-${category}`));
|
|
68
|
+
}) }, item.id));
|
|
69
|
+
})] }));
|
|
70
|
+
}
|
|
71
|
+
export const BarChart = Object.assign(BarChartRoot, {
|
|
72
|
+
Tooltip: ChartTooltip,
|
|
73
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { BarChart, type BarChartProps } from "./bar-chart.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { BarChart } from "./bar-chart.js";
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { BreadcrumbItemProps, BreadcrumbsProps } from "./breadcrumbs.types.js";
|
|
2
|
+
export declare function Breadcrumbs({ "aria-label": ariaLabel, children, className, ...props }: BreadcrumbsProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare function Breadcrumb({ children, className, href, id, isCurrent, }: BreadcrumbItemProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Breadcrumb as AriaBreadcrumb, Breadcrumbs as AriaBreadcrumbs, Link, } from "react-aria-components";
|
|
4
|
+
import { breadcrumbCurrentClass, breadcrumbItemClassName, breadcrumbLinkClass, breadcrumbSeparatorClass, breadcrumbsClassName, } from "./breadcrumbs.styles.js";
|
|
5
|
+
export function Breadcrumbs({ "aria-label": ariaLabel = "Breadcrumbs", children, className, ...props }) {
|
|
6
|
+
return (_jsx(AriaBreadcrumbs, { "aria-label": ariaLabel, className: breadcrumbsClassName(className), ...props, children: children }));
|
|
7
|
+
}
|
|
8
|
+
export function Breadcrumb({ children, className, href, id, isCurrent, }) {
|
|
9
|
+
return (_jsx(AriaBreadcrumb, { className: breadcrumbItemClassName(className), ...(id !== undefined ? { id } : {}), children: ({ isCurrent: current }) => {
|
|
10
|
+
const atCurrent = isCurrent ?? current;
|
|
11
|
+
return (_jsxs(_Fragment, { children: [atCurrent || !href ? (_jsx("span", { className: breadcrumbCurrentClass, "aria-current": atCurrent ? "page" : undefined, children: children })) : (_jsx(Link, { href: href, className: breadcrumbLinkClass, children: children })), !atCurrent ? (_jsx("span", { "aria-hidden": true, className: breadcrumbSeparatorClass, children: "/" })) : null] }));
|
|
12
|
+
} }));
|
|
13
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function breadcrumbsClassName(className?: string | undefined): string;
|
|
2
|
+
export declare function breadcrumbItemClassName(className?: string | undefined): string;
|
|
3
|
+
export declare const breadcrumbSeparatorClass = "text-muted-foreground/70 select-none";
|
|
4
|
+
export declare const breadcrumbLinkClass: string;
|
|
5
|
+
export declare const breadcrumbCurrentClass = "px-1.5 font-medium text-foreground";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { cn } from "../../utils/cn.js";
|
|
2
|
+
export function breadcrumbsClassName(className) {
|
|
3
|
+
return cn("flex flex-wrap items-center gap-1.5 text-sm text-muted-foreground", className);
|
|
4
|
+
}
|
|
5
|
+
export function breadcrumbItemClassName(className) {
|
|
6
|
+
return cn("inline-flex min-h-10 items-center gap-1.5", className);
|
|
7
|
+
}
|
|
8
|
+
export const breadcrumbSeparatorClass = "text-muted-foreground/70 select-none";
|
|
9
|
+
export const breadcrumbLinkClass = cn("inline-flex min-h-10 items-center rounded-[calc(var(--kp-radius-sm)-0.05rem)] px-1.5", "text-muted-foreground outline-none transition-[color,transform,background-color]", "duration-[var(--kp-motion-duration)] ease-[var(--kp-motion-ease-standard)]", "hover:bg-muted/60 hover:text-foreground", "pressed:scale-[0.96] data-[pressed]:scale-[0.96]", "focus-visible:ring-2 focus-visible:ring-ring/40", "data-[current]:pointer-events-none data-[current]:font-medium data-[current]:text-foreground", "data-[disabled]:opacity-45");
|
|
10
|
+
export const breadcrumbCurrentClass = "px-1.5 font-medium text-foreground";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { Key } from "react-aria-components";
|
|
3
|
+
export type BreadcrumbsProps = {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
className?: string;
|
|
6
|
+
"aria-label"?: string;
|
|
7
|
+
isDisabled?: boolean;
|
|
8
|
+
onAction?: (key: Key) => void;
|
|
9
|
+
};
|
|
10
|
+
export type BreadcrumbItemProps = {
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
className?: string;
|
|
13
|
+
id?: Key;
|
|
14
|
+
href?: string;
|
|
15
|
+
isCurrent?: boolean;
|
|
16
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Breadcrumb, Breadcrumbs } from "./breadcrumbs.js";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Button as AriaButton } from "react-aria-components";
|
|
4
|
+
import { useMotionMode } from "../../providers/motion-provider.js";
|
|
5
|
+
import { Spinner } from "../spinner/index.js";
|
|
6
|
+
import { buttonClassName, buttonControlAttr } from "./button.styles.js";
|
|
7
|
+
export function Button({ children, className, isDisabled, isLoading = false, size = "md", variant = "primary", ...props }) {
|
|
8
|
+
const { motionEnabled } = useMotionMode();
|
|
9
|
+
const disabled = Boolean(isDisabled || isLoading);
|
|
10
|
+
return (_jsxs(AriaButton, { ...props, "data-kp-control": buttonControlAttr(variant), isDisabled: disabled, "aria-busy": isLoading || undefined, className: buttonClassName({
|
|
11
|
+
className,
|
|
12
|
+
isDisabled: disabled,
|
|
13
|
+
isLoading,
|
|
14
|
+
pressScale: motionEnabled,
|
|
15
|
+
size,
|
|
16
|
+
variant,
|
|
17
|
+
}), children: [isLoading ? _jsx(Spinner, {}) : null, _jsx("span", { className: isLoading ? "opacity-90" : undefined, children: children })] }));
|
|
18
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare const buttonPressTransition: {
|
|
2
|
+
readonly type: "spring";
|
|
3
|
+
readonly stiffness: 420;
|
|
4
|
+
readonly damping: 30;
|
|
5
|
+
readonly mass: 0.7;
|
|
6
|
+
};
|
|
7
|
+
export declare const loadingIconVariants: {
|
|
8
|
+
hidden: {
|
|
9
|
+
opacity: number;
|
|
10
|
+
scale: number;
|
|
11
|
+
filter: string;
|
|
12
|
+
};
|
|
13
|
+
visible: {
|
|
14
|
+
opacity: number;
|
|
15
|
+
scale: number;
|
|
16
|
+
filter: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export declare const loadingIconTransition: {
|
|
20
|
+
type: "spring";
|
|
21
|
+
duration: 0.2;
|
|
22
|
+
bounce: number;
|
|
23
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { durations, springs } from "@hewnui/motion";
|
|
2
|
+
export const buttonPressTransition = springs.snappy;
|
|
3
|
+
export const loadingIconVariants = {
|
|
4
|
+
hidden: { opacity: 0, scale: 0.25, filter: "blur(4px)" },
|
|
5
|
+
visible: { opacity: 1, scale: 1, filter: "blur(0px)" },
|
|
6
|
+
};
|
|
7
|
+
export const loadingIconTransition = {
|
|
8
|
+
type: "spring",
|
|
9
|
+
duration: durations.base,
|
|
10
|
+
bounce: 0,
|
|
11
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ButtonSize, ButtonVariant } from "./button.types.js";
|
|
2
|
+
export declare function buttonClassName({ className, isDisabled, isLoading, pressScale, size, variant, }: {
|
|
3
|
+
className?: string | undefined;
|
|
4
|
+
isDisabled?: boolean | undefined;
|
|
5
|
+
isLoading?: boolean | undefined;
|
|
6
|
+
pressScale: boolean;
|
|
7
|
+
size?: ButtonSize | undefined;
|
|
8
|
+
variant?: ButtonVariant | undefined;
|
|
9
|
+
}): string;
|
|
10
|
+
export declare function buttonControlAttr(variant?: ButtonVariant): "button-glass" | "button-soft" | "button-outline" | "button-primary" | "button-secondary" | "button-ghost" | "button-glow" | "button-danger" | "button-danger-outline" | "button-danger-soft";
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { cn } from "../../utils/cn.js";
|
|
2
|
+
const variants = {
|
|
3
|
+
primary: cn("bg-accent text-accent-foreground", "shadow-[0_1px_2px_oklch(0_0_0/14%),0_8px_20px_-12px_color-mix(in_oklch,var(--kp-accent)_55%,transparent),inset_0_1px_0_oklch(1_0_0/28%)]", "hover:brightness-[1.05] hover:shadow-[0_1px_2px_oklch(0_0_0/16%),0_12px_28px_-14px_color-mix(in_oklch,var(--kp-accent)_62%,transparent),inset_0_1px_0_oklch(1_0_0/34%)]"),
|
|
4
|
+
secondary: cn("border border-[color-mix(in_oklch,var(--kp-foreground)_14%,transparent)]", "bg-[color-mix(in_oklch,var(--kp-surface)_94%,var(--kp-foreground)_3%)] text-foreground", "shadow-[0_1px_2px_oklch(0_0_0/8%),inset_0_1px_0_oklch(1_0_0/55%)]", "hover:bg-muted hover:border-[color-mix(in_oklch,var(--kp-foreground)_20%,transparent)]"),
|
|
5
|
+
outline: cn("border border-[color-mix(in_oklch,var(--kp-foreground)_20%,transparent)]", "bg-transparent text-foreground", "hover:bg-[color-mix(in_oklch,var(--kp-foreground)_6%,transparent)] hover:border-[color-mix(in_oklch,var(--kp-foreground)_30%,transparent)]"),
|
|
6
|
+
ghost: cn("bg-transparent text-foreground", "hover:bg-[color-mix(in_oklch,var(--kp-muted)_80%,transparent)]", "hover:shadow-[inset_0_1px_0_oklch(1_0_0/35%)]"),
|
|
7
|
+
glass: cn("border border-[color-mix(in_oklch,var(--kp-foreground)_16%,transparent)]", "bg-[color-mix(in_oklch,var(--kp-surface)_45%,transparent)] text-foreground", "backdrop-blur-md backdrop-saturate-150", "shadow-[inset_0_1px_0_oklch(1_0_0/30%),0_4px_16px_-4px_oklch(0_0_0/12%)]", "hover:bg-[color-mix(in_oklch,var(--kp-surface)_60%,transparent)] hover:border-[color-mix(in_oklch,var(--kp-foreground)_25%,transparent)]"),
|
|
8
|
+
soft: cn("bg-[color-mix(in_oklch,var(--kp-accent)_14%,transparent)] text-accent font-semibold", "hover:bg-[color-mix(in_oklch,var(--kp-accent)_22%,transparent)]"),
|
|
9
|
+
glow: cn("bg-accent text-accent-foreground font-semibold", "shadow-[0_0_20px_-3px_color-mix(in_oklch,var(--kp-accent)_65%,transparent),0_1px_2px_oklch(0_0_0/14%),inset_0_1px_0_oklch(1_0_0/28%)]", "hover:shadow-[0_0_28px_0px_color-mix(in_oklch,var(--kp-accent)_80%,transparent),0_1px_2px_oklch(0_0_0/16%),inset_0_1px_0_oklch(1_0_0/34%)] hover:brightness-[1.05]"),
|
|
10
|
+
danger: cn("bg-danger text-accent-foreground", "shadow-[0_1px_2px_oklch(0_0_0/14%),0_8px_20px_-12px_color-mix(in_oklch,var(--kp-danger)_50%,transparent),inset_0_1px_0_oklch(1_0_0/24%)]", "hover:brightness-[1.05]"),
|
|
11
|
+
"danger-outline": cn("border border-[color-mix(in_oklch,var(--kp-danger)_40%,transparent)]", "bg-transparent text-danger", "hover:bg-[color-mix(in_oklch,var(--kp-danger)_10%,transparent)] hover:border-danger"),
|
|
12
|
+
"danger-soft": cn("bg-[color-mix(in_oklch,var(--kp-danger)_14%,transparent)] text-danger font-semibold", "hover:bg-[color-mix(in_oklch,var(--kp-danger)_22%,transparent)]"),
|
|
13
|
+
};
|
|
14
|
+
const sizes = {
|
|
15
|
+
sm: "min-h-10 gap-1.5 rounded-[var(--kp-radius-sm)] px-3 text-sm",
|
|
16
|
+
md: "min-h-11 gap-2 rounded-[var(--kp-radius-md)] px-4 text-sm",
|
|
17
|
+
lg: "min-h-12 gap-2.5 rounded-[var(--kp-radius-md)] px-5 text-base",
|
|
18
|
+
};
|
|
19
|
+
export function buttonClassName({ className, isDisabled, isLoading, pressScale, size = "md", variant = "primary", }) {
|
|
20
|
+
return cn("relative inline-flex items-center justify-center font-medium outline-none", "transition-[transform,background-color,color,box-shadow,filter,opacity,border-color]", "duration-[var(--kp-motion-duration)] ease-[var(--kp-motion-ease-standard)]", "focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", "focus-visible:ring-offset-background", "disabled:pointer-events-none disabled:opacity-45", pressScale && "active:scale-[0.96]", variants[variant], sizes[size], (isDisabled || isLoading) && "pointer-events-none", isLoading && "opacity-80", className);
|
|
21
|
+
}
|
|
22
|
+
export function buttonControlAttr(variant = "primary") {
|
|
23
|
+
return `button-${variant}`;
|
|
24
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ButtonProps as AriaButtonProps } from "react-aria-components";
|
|
2
|
+
import type { ReactNode } from "react";
|
|
3
|
+
export type ButtonVariant = "primary" | "secondary" | "outline" | "ghost" | "glass" | "soft" | "glow" | "danger" | "danger-outline" | "danger-soft";
|
|
4
|
+
export type ButtonSize = "sm" | "md" | "lg";
|
|
5
|
+
export type ButtonProps = Omit<AriaButtonProps, "className" | "children"> & {
|
|
6
|
+
variant?: ButtonVariant;
|
|
7
|
+
size?: ButtonSize;
|
|
8
|
+
isLoading?: boolean;
|
|
9
|
+
className?: string;
|
|
10
|
+
children?: ReactNode;
|
|
11
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Button } from "./button.js";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { CardProps } from "./card.types.js";
|
|
3
|
+
declare function CardRoot({ children, className, ...props }: CardProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare function CardHeader({ children, className, }: {
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
className?: string | undefined;
|
|
7
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare function CardBody({ children, className, }: {
|
|
9
|
+
children?: ReactNode;
|
|
10
|
+
className?: string | undefined;
|
|
11
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare function CardFooter({ children, className, }: {
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
className?: string | undefined;
|
|
15
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export declare const Card: typeof CardRoot & {
|
|
17
|
+
Header: typeof CardHeader;
|
|
18
|
+
Body: typeof CardBody;
|
|
19
|
+
Footer: typeof CardFooter;
|
|
20
|
+
};
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cardBodyClassName, cardClassName, cardFooterClassName, cardHeaderClassName, } from "./card.styles.js";
|
|
3
|
+
function CardRoot({ children, className, ...props }) {
|
|
4
|
+
return (_jsx("div", { "data-kp-surface": true, className: cardClassName(className), ...props, children: children }));
|
|
5
|
+
}
|
|
6
|
+
export function CardHeader({ children, className, }) {
|
|
7
|
+
return _jsx("div", { className: cardHeaderClassName(className), children: children });
|
|
8
|
+
}
|
|
9
|
+
export function CardBody({ children, className, }) {
|
|
10
|
+
return _jsx("div", { className: cardBodyClassName(className), children: children });
|
|
11
|
+
}
|
|
12
|
+
export function CardFooter({ children, className, }) {
|
|
13
|
+
return _jsx("div", { className: cardFooterClassName(className), children: children });
|
|
14
|
+
}
|
|
15
|
+
export const Card = Object.assign(CardRoot, {
|
|
16
|
+
Header: CardHeader,
|
|
17
|
+
Body: CardBody,
|
|
18
|
+
Footer: CardFooter,
|
|
19
|
+
});
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function cardClassName(className?: string): string;
|
|
2
|
+
export declare function cardHeaderClassName(className?: string): string;
|
|
3
|
+
export declare function cardBodyClassName(className?: string): string;
|
|
4
|
+
export declare function cardFooterClassName(className?: string): string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { cn } from "../../utils/cn.js";
|
|
2
|
+
export function cardClassName(className) {
|
|
3
|
+
return cn("rounded-[var(--kp-radius-lg)] border border-border bg-surface text-foreground", "shadow-[var(--kp-shadow-surface)]", className);
|
|
4
|
+
}
|
|
5
|
+
export function cardHeaderClassName(className) {
|
|
6
|
+
return cn("flex flex-col gap-1 px-4 pb-0 pt-4", className);
|
|
7
|
+
}
|
|
8
|
+
export function cardBodyClassName(className) {
|
|
9
|
+
return cn("px-4 py-3 text-sm leading-relaxed text-pretty", className);
|
|
10
|
+
}
|
|
11
|
+
export function cardFooterClassName(className) {
|
|
12
|
+
return cn("flex flex-wrap items-center gap-2 border-t border-border/70 px-4 py-3", className);
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Card, CardBody, CardFooter, CardHeader, } from "./card.js";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { AnimatePresence, m } from "motion/react";
|
|
4
|
+
import { Checkbox as AriaCheckbox } from "react-aria-components";
|
|
5
|
+
import { iconPop, iconState } from "@hewnui/motion";
|
|
6
|
+
import { useMotionMode } from "../../providers/motion-provider.js";
|
|
7
|
+
import { checkboxBoxClass, checkboxClassName, checkboxMarkClass, } from "./checkbox.styles.js";
|
|
8
|
+
function CheckMark({ animate }) {
|
|
9
|
+
const mark = (_jsx("svg", { viewBox: "0 0 12 12", className: checkboxMarkClass, "aria-hidden": true, children: _jsx("path", { d: "M2.5 6.2 4.8 8.5 9.5 3.5", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
10
|
+
if (!animate)
|
|
11
|
+
return mark;
|
|
12
|
+
return (_jsx(m.span, { className: "flex", variants: iconState, initial: "hidden", animate: "visible", exit: "hidden", transition: iconPop, children: mark }));
|
|
13
|
+
}
|
|
14
|
+
export function Checkbox({ children, className, ...props }) {
|
|
15
|
+
const { motionEnabled } = useMotionMode();
|
|
16
|
+
return (_jsx(AriaCheckbox, { ...props, className: checkboxClassName(className), children: ({ isSelected }) => (_jsxs(_Fragment, { children: [_jsx("span", { className: checkboxBoxClass, "data-kp-control": "checkbox", children: _jsx(AnimatePresence, { initial: false, children: isSelected ? (_jsx(CheckMark, { animate: motionEnabled }, "check")) : null }) }), children ? _jsx("span", { children: children }) : null] })) }));
|
|
17
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { cn } from "../../utils/cn.js";
|
|
2
|
+
export function checkboxClassName(className) {
|
|
3
|
+
return cn("group flex min-h-10 items-center gap-3 text-sm text-foreground outline-none", "disabled:cursor-not-allowed disabled:opacity-45", className);
|
|
4
|
+
}
|
|
5
|
+
export const checkboxBoxClass = cn("relative flex size-5 shrink-0 items-center justify-center", "rounded-[calc(var(--kp-radius-sm)-0.125rem)] border", "border-[color-mix(in_oklch,var(--kp-foreground)_22%,transparent)]", "bg-[color-mix(in_oklch,var(--kp-surface)_88%,var(--kp-foreground)_4%)]", "shadow-[inset_0_1px_0_oklch(1_0_0/55%),0_1px_2px_oklch(0_0_0/8%)]", "transition-[background-color,border-color,box-shadow,transform]", "duration-[var(--kp-motion-duration)] ease-[var(--kp-motion-ease-standard)]", "group-data-[selected]:border-accent group-data-[selected]:bg-accent", "group-data-[selected]:shadow-[inset_0_1px_0_oklch(1_0_0/30%),0_0_0_3px_color-mix(in_oklch,var(--kp-accent)_20%,transparent)]", "group-data-[focus-visible]:ring-2 group-data-[focus-visible]:ring-ring", "group-data-[focus-visible]:ring-offset-2 group-data-[focus-visible]:ring-offset-background", "group-data-[pressed]:scale-[0.96]");
|
|
6
|
+
export const checkboxMarkClass = "size-3 text-accent-foreground drop-shadow-[0_1px_0_oklch(0_0_0/20%)]";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Checkbox } from "./checkbox.js";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { CheckboxGroup as AriaCheckboxGroup, FieldError, Label, Text, } from "react-aria-components";
|
|
4
|
+
import { fieldDescriptionClass, fieldErrorClass, fieldLabelClass, } from "../../styles/field.js";
|
|
5
|
+
import { checkboxGroupClassName, checkboxGroupItemsClass, } from "./checkbox-group.styles.js";
|
|
6
|
+
export function CheckboxGroup({ children, className, description, errorMessage, label, ...props }) {
|
|
7
|
+
return (_jsxs(AriaCheckboxGroup, { ...props, className: checkboxGroupClassName(className), children: [label ? _jsx(Label, { className: fieldLabelClass, children: label }) : null, _jsx("div", { className: checkboxGroupItemsClass, children: children }), description ? (_jsx(Text, { slot: "description", className: fieldDescriptionClass, children: description })) : null, _jsx(FieldError, { className: fieldErrorClass, children: errorMessage })] }));
|
|
8
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { CheckboxGroupProps as AriaCheckboxGroupProps } from "react-aria-components";
|
|
2
|
+
import type { ReactNode } from "react";
|
|
3
|
+
export type CheckboxGroupProps = Omit<AriaCheckboxGroupProps, "className" | "children"> & {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
label?: ReactNode;
|
|
6
|
+
description?: ReactNode;
|
|
7
|
+
errorMessage?: ReactNode;
|
|
8
|
+
className?: string;
|
|
9
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CheckboxGroup } from "./checkbox-group.js";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import type { ColorPickerProps } from "./color-picker.types.js";
|
|
2
|
+
export declare function ColorPicker({ className, defaultValue, description, errorMessage, isDisabled, isRequired, label, name, onChange, presets, showAlpha, showOklch, value, variant, }: ColorPickerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Button, ColorPicker as AriaColorPicker, ColorSwatch, Dialog, DialogTrigger, Label, Popover, Text, parseColor, } from "react-aria-components";
|
|
4
|
+
import { fieldDescriptionClass, fieldErrorClass, fieldLabelClass, } from "../../styles/field.js";
|
|
5
|
+
import { ColorPickerPanel } from "./color-picker.panel.js";
|
|
6
|
+
import { colorPickerClassName, colorPickerPopoverClass, colorPickerSwatchPreviewClass, colorPickerTriggerClass, defaultColorPresets, } from "./color-picker.styles.js";
|
|
7
|
+
function toHex(color) {
|
|
8
|
+
if (typeof color === "string") {
|
|
9
|
+
try {
|
|
10
|
+
return parseColor(color).toString("hex");
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
return color;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return color.toString("hex");
|
|
17
|
+
}
|
|
18
|
+
export function ColorPicker({ className, defaultValue = "#1a6b4a", description, errorMessage, isDisabled, isRequired, label, name, onChange, presets = defaultColorPresets, showAlpha = true, showOklch = true, value, variant = "popover", }) {
|
|
19
|
+
const handleChange = (color) => {
|
|
20
|
+
onChange?.(toHex(color));
|
|
21
|
+
};
|
|
22
|
+
const panel = (_jsx(ColorPickerPanel, { showAlpha: showAlpha, showOklch: showOklch, presets: presets, isDisabled: isDisabled }));
|
|
23
|
+
return (_jsx(AriaColorPicker, { ...(value !== undefined ? { value } : {}), ...(value === undefined ? { defaultValue } : {}), onChange: handleChange, children: ({ color }) => {
|
|
24
|
+
const hex = toHex(color);
|
|
25
|
+
return (_jsxs("div", { className: colorPickerClassName(className), children: [label ? _jsx(Label, { className: fieldLabelClass, children: label }) : null, variant === "inline" ? (panel) : (_jsxs(DialogTrigger, { children: [_jsxs(Button, { className: colorPickerTriggerClass, "data-kp-surface": true, ...(isDisabled ? { isDisabled: true } : {}), ...(isRequired ? { "aria-required": true } : {}), children: [_jsx(ColorSwatch, { className: colorPickerSwatchPreviewClass, color: color }), _jsx("span", { className: "font-mono text-sm tabular-nums", children: hex })] }), _jsx(Popover, { className: colorPickerPopoverClass, "data-kp-surface": true, children: _jsx(Dialog, { className: "outline-none", children: panel }) })] })), description ? (_jsx(Text, { slot: "description", className: fieldDescriptionClass, children: description })) : null, errorMessage ? (_jsx("p", { className: fieldErrorClass, role: "alert", children: errorMessage })) : null, name ? (_jsx("input", { type: "hidden", name: name, value: hex, readOnly: true, required: isRequired })) : null] }));
|
|
26
|
+
} }));
|
|
27
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/** Display-only RGB → OKLCH. React Aria does not parse or edit OKLCH natively. */
|
|
2
|
+
function srgbToLinear(channel) {
|
|
3
|
+
const c = channel / 255;
|
|
4
|
+
return c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
|
|
5
|
+
}
|
|
6
|
+
function rgbToOklab(r, g, b) {
|
|
7
|
+
const lr = srgbToLinear(r);
|
|
8
|
+
const lg = srgbToLinear(g);
|
|
9
|
+
const lb = srgbToLinear(b);
|
|
10
|
+
const l = 0.4122214708 * lr + 0.5363325363 * lg + 0.0514459929 * lb;
|
|
11
|
+
const m = 0.2119034982 * lr + 0.6806995451 * lg + 0.1073969566 * lb;
|
|
12
|
+
const s = 0.0883024619 * lr + 0.2817188376 * lg + 0.6299787005 * lb;
|
|
13
|
+
const l_ = Math.cbrt(l);
|
|
14
|
+
const m_ = Math.cbrt(m);
|
|
15
|
+
const s_ = Math.cbrt(s);
|
|
16
|
+
return [
|
|
17
|
+
0.2104542553 * l_ + 0.793617785 * m_ - 0.0040720468 * s_,
|
|
18
|
+
1.9779984951 * l_ - 2.428592205 * m_ + 0.4505937099 * s_,
|
|
19
|
+
0.0259040371 * l_ + 0.7827717662 * m_ - 0.808675766 * s_,
|
|
20
|
+
];
|
|
21
|
+
}
|
|
22
|
+
function parseHex(hex) {
|
|
23
|
+
const raw = hex.replace("#", "").trim();
|
|
24
|
+
const full = raw.length === 3
|
|
25
|
+
? raw
|
|
26
|
+
.split("")
|
|
27
|
+
.map((c) => c + c)
|
|
28
|
+
.join("")
|
|
29
|
+
: raw.slice(0, 6);
|
|
30
|
+
if (!/^[0-9a-fA-F]{6}$/.test(full)) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
return [
|
|
34
|
+
Number.parseInt(full.slice(0, 2), 16),
|
|
35
|
+
Number.parseInt(full.slice(2, 4), 16),
|
|
36
|
+
Number.parseInt(full.slice(4, 6), 16),
|
|
37
|
+
];
|
|
38
|
+
}
|
|
39
|
+
export function hexToOklchDisplay(hex) {
|
|
40
|
+
const rgb = parseHex(hex);
|
|
41
|
+
if (!rgb) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
const [L, a, b] = rgbToOklab(rgb[0], rgb[1], rgb[2]);
|
|
45
|
+
const C = Math.sqrt(a * a + b * b);
|
|
46
|
+
let H = (Math.atan2(b, a) * 180) / Math.PI;
|
|
47
|
+
if (H < 0) {
|
|
48
|
+
H += 360;
|
|
49
|
+
}
|
|
50
|
+
const l = (L * 100).toFixed(1);
|
|
51
|
+
const c = C.toFixed(3);
|
|
52
|
+
const h = H.toFixed(1);
|
|
53
|
+
return `oklch(${l}% ${c} ${h})`;
|
|
54
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useContext, useId } from "react";
|
|
4
|
+
import { ColorArea, ColorField, ColorPickerStateContext, ColorSlider, ColorSwatch, ColorSwatchPicker, ColorSwatchPickerItem, ColorThumb, Input, Label, SliderTrack, } from "react-aria-components";
|
|
5
|
+
import { fieldLabelClass } from "../../styles/field.js";
|
|
6
|
+
import { hexToOklchDisplay } from "./color-picker.oklch.js";
|
|
7
|
+
import { colorAreaClass, colorFieldClass, colorFieldInputClass, colorOklchReadoutClass, colorPickerPanelClass, colorSliderClass, colorSliderTrackClass, colorSwatchClass, colorSwatchItemClass, colorSwatchPickerClass, colorThumbClass, } from "./color-picker.styles.js";
|
|
8
|
+
export function ColorPickerPanel({ showAlpha, showOklch, presets, isDisabled, }) {
|
|
9
|
+
const oklchId = useId();
|
|
10
|
+
const colorState = useContext(ColorPickerStateContext);
|
|
11
|
+
const hex = colorState?.color.toString("hex") ?? "#000000";
|
|
12
|
+
const oklch = showOklch ? hexToOklchDisplay(hex) : null;
|
|
13
|
+
const disabledProps = isDisabled ? { isDisabled: true } : {};
|
|
14
|
+
return (_jsxs("div", { className: colorPickerPanelClass, children: [_jsx(ColorArea, { "aria-label": "Saturation and brightness", colorSpace: "hsb", xChannel: "saturation", yChannel: "brightness", className: colorAreaClass, ...disabledProps, children: _jsx(ColorThumb, { className: colorThumbClass }) }), _jsxs(ColorSlider, { channel: "hue", colorSpace: "hsb", className: colorSliderClass, ...disabledProps, children: [_jsx(Label, { className: fieldLabelClass, children: "Hue" }), _jsx(SliderTrack, { className: colorSliderTrackClass, children: _jsx(ColorThumb, { className: colorThumbClass }) })] }), showAlpha ? (_jsxs(ColorSlider, { channel: "alpha", className: colorSliderClass, ...disabledProps, children: [_jsx(Label, { className: fieldLabelClass, children: "Alpha" }), _jsx(SliderTrack, { className: colorSliderTrackClass, children: _jsx(ColorThumb, { className: colorThumbClass }) })] })) : null, _jsxs(ColorField, { className: colorFieldClass, ...disabledProps, children: [_jsx(Label, { className: fieldLabelClass, children: "Hex" }), _jsx(Input, { className: colorFieldInputClass })] }), showOklch ? (_jsxs("div", { className: "flex flex-col gap-1", children: [_jsx("span", { className: fieldLabelClass, id: oklchId, children: "OKLCH" }), _jsx("output", { className: colorOklchReadoutClass, "aria-labelledby": oklchId, "aria-live": "polite", children: oklch ?? "—" })] })) : null, presets.length > 0 ? (_jsx(ColorSwatchPicker, { "aria-label": "Color presets", className: colorSwatchPickerClass, children: presets.map((color) => (_jsx(ColorSwatchPickerItem, { color: color, className: colorSwatchItemClass, children: _jsx(ColorSwatch, { className: colorSwatchClass }) }, color))) })) : null] }));
|
|
15
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare function colorPickerClassName(className?: string | undefined): string;
|
|
2
|
+
export declare const colorPickerTriggerClass: string;
|
|
3
|
+
export declare const colorPickerSwatchPreviewClass: string;
|
|
4
|
+
export declare const colorPickerPopoverClass: string;
|
|
5
|
+
export declare const colorPickerPanelClass = "flex w-[16.5rem] flex-col gap-3 outline-none";
|
|
6
|
+
export declare const colorAreaClass: string;
|
|
7
|
+
export declare const colorThumbClass: string;
|
|
8
|
+
export declare const colorSliderClass = "flex flex-col gap-1.5";
|
|
9
|
+
export declare const colorSliderTrackClass: string;
|
|
10
|
+
export declare const colorFieldClass = "flex flex-col gap-1.5";
|
|
11
|
+
export declare const colorFieldInputClass: string;
|
|
12
|
+
export declare const colorSwatchPickerClass = "flex flex-wrap gap-2";
|
|
13
|
+
export declare const colorSwatchItemClass: string;
|
|
14
|
+
export declare const colorSwatchClass: string;
|
|
15
|
+
export declare const colorOklchReadoutClass = "font-mono text-xs tabular-nums text-muted-foreground";
|
|
16
|
+
export declare const defaultColorPresets: string[];
|