@lt-three/love3 0.0.0 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +85 -1
- package/dist/native/analytics/animation.d.ts +4 -0
- package/dist/native/analytics/animation.js +6 -0
- package/dist/native/analytics/chart.types.d.ts +25 -0
- package/dist/native/analytics/chart.types.js +0 -0
- package/dist/native/analytics/line-chart.d.ts +4 -0
- package/dist/native/analytics/line-chart.ios.d.ts +4 -0
- package/dist/native/analytics/line-chart.ios.js +24 -0
- package/dist/native/analytics/line-chart.js +33 -0
- package/dist/native/analytics/metric-card.d.ts +10 -0
- package/dist/native/analytics/metric-card.js +29 -0
- package/dist/native/analytics/multi-line-chart.d.ts +17 -0
- package/dist/native/analytics/multi-line-chart.js +215 -0
- package/dist/native/analytics/pie-chart.d.ts +15 -0
- package/dist/native/analytics/pie-chart.ios.d.ts +4 -0
- package/dist/native/analytics/pie-chart.ios.js +24 -0
- package/dist/native/analytics/pie-chart.js +92 -0
- package/dist/native/analytics/single-number.d.ts +19 -0
- package/dist/native/analytics/single-number.js +101 -0
- package/dist/native/atom/avatar.d.ts +21 -0
- package/dist/native/atom/avatar.js +46 -0
- package/dist/native/atom/badge.d.ts +28 -0
- package/dist/native/atom/badge.js +51 -0
- package/dist/native/atom/button.d.ts +46 -0
- package/dist/native/atom/button.js +109 -0
- package/dist/native/atom/checkbox.d.ts +21 -0
- package/dist/native/atom/checkbox.js +47 -0
- package/dist/native/atom/colored-value.d.ts +12 -0
- package/dist/native/atom/colored-value.js +24 -0
- package/dist/native/atom/image.d.ts +21 -0
- package/dist/native/atom/image.js +72 -0
- package/dist/native/atom/label.d.ts +18 -0
- package/dist/native/atom/label.js +33 -0
- package/dist/native/atom/link.d.ts +18 -0
- package/dist/native/atom/link.js +25 -0
- package/dist/native/atom/readout.d.ts +22 -0
- package/dist/native/atom/readout.js +39 -0
- package/dist/native/atom/search-input.d.ts +12 -0
- package/dist/native/atom/search-input.js +36 -0
- package/dist/native/atom/select.d.ts +54 -0
- package/dist/native/atom/select.js +200 -0
- package/dist/native/atom/separator.d.ts +13 -0
- package/dist/native/atom/separator.js +17 -0
- package/dist/native/atom/skeleton.d.ts +12 -0
- package/dist/native/atom/skeleton.js +39 -0
- package/dist/native/atom/slider.d.ts +32 -0
- package/dist/native/atom/slider.js +75 -0
- package/dist/native/atom/spinner.d.ts +15 -0
- package/dist/native/atom/spinner.js +25 -0
- package/dist/native/atom/switch.d.ts +18 -0
- package/dist/native/atom/switch.js +52 -0
- package/dist/native/atom/symbol.d.ts +16 -0
- package/dist/native/atom/symbol.js +38 -0
- package/dist/native/atom/symbol.types.d.ts +25 -0
- package/dist/native/atom/symbol.types.js +49 -0
- package/dist/native/atom/text-field.d.ts +49 -0
- package/dist/native/atom/text-field.js +56 -0
- package/dist/native/atom/text.d.ts +2 -0
- package/dist/native/atom/text.js +3 -0
- package/dist/native/atom/theme-toggle.d.ts +21 -0
- package/dist/native/atom/theme-toggle.js +36 -0
- package/dist/native/atom/timezone-select.d.ts +16 -0
- package/dist/native/atom/timezone-select.js +28 -0
- package/dist/native/atom/typography.d.ts +13 -0
- package/dist/native/atom/typography.js +28 -0
- package/dist/native/base/button.d.ts +61 -0
- package/dist/native/base/button.js +92 -0
- package/dist/native/base/form.d.ts +72 -0
- package/dist/native/base/form.js +113 -0
- package/dist/native/base/glass-card.d.ts +15 -0
- package/dist/native/base/glass-card.js +38 -0
- package/dist/native/base/input.d.ts +29 -0
- package/dist/native/base/input.js +27 -0
- package/dist/native/base/sheet.d.ts +71 -0
- package/dist/native/base/sheet.js +187 -0
- package/dist/native/base/text.d.ts +14 -0
- package/dist/native/base/text.js +53 -0
- package/dist/native/form/checkbox.d.ts +13 -0
- package/dist/native/form/checkbox.js +55 -0
- package/dist/native/form/date-picker.d.ts +23 -0
- package/dist/native/form/date-picker.js +119 -0
- package/dist/native/form/form.d.ts +23 -0
- package/dist/native/form/form.js +45 -0
- package/dist/native/form/radio-group.d.ts +23 -0
- package/dist/native/form/radio-group.js +88 -0
- package/dist/native/form/select.d.ts +13 -0
- package/dist/native/form/select.js +45 -0
- package/dist/native/form/slider.d.ts +14 -0
- package/dist/native/form/slider.js +42 -0
- package/dist/native/form/switch.d.ts +9 -0
- package/dist/native/form/switch.js +59 -0
- package/dist/native/form/text-area.d.ts +11 -0
- package/dist/native/form/text-area.js +50 -0
- package/dist/native/form/text-input.d.ts +18 -0
- package/dist/native/form/text-input.js +90 -0
- package/dist/native/index.d.ts +1 -0
- package/dist/native/index.js +0 -0
- package/dist/native/layout/accordion.d.ts +25 -0
- package/dist/native/layout/accordion.js +54 -0
- package/dist/native/layout/card.d.ts +47 -0
- package/dist/native/layout/card.js +57 -0
- package/dist/native/layout/description.d.ts +16 -0
- package/dist/native/layout/description.js +32 -0
- package/dist/native/layout/error.d.ts +21 -0
- package/dist/native/layout/error.js +44 -0
- package/dist/native/layout/information.d.ts +25 -0
- package/dist/native/layout/information.js +35 -0
- package/dist/native/layout/locked.d.ts +38 -0
- package/dist/native/layout/locked.js +94 -0
- package/dist/native/layout/modal.d.ts +25 -0
- package/dist/native/layout/modal.js +93 -0
- package/dist/native/layout/not-found.d.ts +17 -0
- package/dist/native/layout/not-found.js +30 -0
- package/dist/native/layout/page-frame.d.ts +23 -0
- package/dist/native/layout/page-frame.js +46 -0
- package/dist/native/layout/panel.d.ts +18 -0
- package/dist/native/layout/panel.js +23 -0
- package/dist/native/layout/reorderable-list.d.ts +42 -0
- package/dist/native/layout/reorderable-list.js +52 -0
- package/dist/native/layout/sheet.d.ts +30 -0
- package/dist/native/layout/sheet.js +46 -0
- package/dist/native/layout/simple-dialog.d.ts +16 -0
- package/dist/native/layout/simple-dialog.js +20 -0
- package/dist/native/layout/simple-table.d.ts +50 -0
- package/dist/native/layout/simple-table.js +75 -0
- package/dist/native/layout/tab-bar.d.ts +33 -0
- package/dist/native/layout/tab-bar.js +48 -0
- package/dist/native/layout/tabs.d.ts +28 -0
- package/dist/native/layout/tabs.js +54 -0
- package/dist/native/layout/tuning-panel.d.ts +24 -0
- package/dist/native/layout/tuning-panel.js +246 -0
- package/dist/native/lib/autocomplete.d.ts +7 -0
- package/dist/native/lib/autocomplete.js +34 -0
- package/dist/native/lib/breakpoints.d.ts +14 -0
- package/dist/native/lib/breakpoints.js +17 -0
- package/dist/native/lib/chart-palette.d.ts +8 -0
- package/dist/native/lib/chart-palette.js +20 -0
- package/dist/native/lib/confirm.d.ts +49 -0
- package/dist/native/lib/confirm.js +70 -0
- package/dist/native/lib/control.d.ts +24 -0
- package/dist/native/lib/control.js +0 -0
- package/dist/native/lib/external-store.d.ts +17 -0
- package/dist/native/lib/external-store.js +30 -0
- package/dist/native/lib/keyboard.d.ts +15 -0
- package/dist/native/lib/keyboard.js +24 -0
- package/dist/native/lib/labels.d.ts +15 -0
- package/dist/native/lib/labels.js +17 -0
- package/dist/native/lib/loading.d.ts +10 -0
- package/dist/native/lib/loading.js +15 -0
- package/dist/native/lib/network.d.ts +12 -0
- package/dist/native/lib/network.js +21 -0
- package/dist/native/lib/scheme.d.ts +18 -0
- package/dist/native/lib/scheme.js +22 -0
- package/dist/native/lib/snackbar.d.ts +46 -0
- package/dist/native/lib/snackbar.js +60 -0
- package/dist/native/lib/theme.d.ts +34 -0
- package/dist/native/lib/theme.js +53 -0
- package/dist/native/lib/timezone.d.ts +26 -0
- package/dist/native/lib/timezone.js +95 -0
- package/dist/native/lib/token-color.d.ts +5 -0
- package/dist/native/lib/token-color.js +13 -0
- package/dist/native/lib/token-color.web.d.ts +4 -0
- package/dist/native/lib/token-color.web.js +7 -0
- package/dist/native/lib/tuning-context.d.ts +9 -0
- package/dist/native/lib/tuning-context.js +7 -0
- package/dist/native/lib/tuning.d.ts +24 -0
- package/dist/native/lib/tuning.js +42 -0
- package/dist/native/lib/typography.d.ts +10 -0
- package/dist/native/lib/typography.js +11 -0
- package/dist/native/lib/utils.d.ts +11 -0
- package/dist/native/lib/utils.js +21 -0
- package/dist/native/once/confirm.d.ts +7 -0
- package/dist/native/once/confirm.js +60 -0
- package/dist/native/once/error-boundary.d.ts +28 -0
- package/dist/native/once/error-boundary.js +55 -0
- package/dist/native/once/loading-lock.d.ts +8 -0
- package/dist/native/once/loading-lock.js +28 -0
- package/dist/native/once/offline-banner.d.ts +15 -0
- package/dist/native/once/offline-banner.js +35 -0
- package/dist/native/once/snackbar.d.ts +17 -0
- package/dist/native/once/snackbar.js +106 -0
- package/dist/native/styles.css +46 -0
- package/dist/shared/analytics.d.ts +71 -0
- package/dist/shared/analytics.js +0 -0
- package/dist/shared/button.d.ts +7 -0
- package/dist/shared/button.js +23 -0
- package/dist/shared/form.d.ts +45 -0
- package/dist/shared/form.js +46 -0
- package/dist/shared/index.d.ts +3 -0
- package/dist/shared/index.js +3 -0
- package/dist/tokens/contrast-pairs.d.ts +30 -0
- package/dist/tokens/contrast-pairs.js +404 -0
- package/dist/tokens/index.d.ts +6 -0
- package/dist/tokens/index.js +10 -0
- package/dist/tokens/styles.gen.css +250 -0
- package/dist/tokens/tokens.gen.d.ts +141 -0
- package/dist/tokens/tokens.gen.js +206 -0
- package/dist/tuning/catalog.d.ts +27 -0
- package/dist/tuning/catalog.gen.d.ts +4 -0
- package/dist/tuning/catalog.gen.js +397 -0
- package/dist/tuning/catalog.js +128 -0
- package/dist/tuning/color.d.ts +20 -0
- package/dist/tuning/color.js +80 -0
- package/dist/tuning/css.d.ts +35 -0
- package/dist/tuning/css.js +147 -0
- package/dist/tuning/index.d.ts +8 -0
- package/dist/tuning/index.js +9 -0
- package/dist/tuning/model.d.ts +33 -0
- package/dist/tuning/model.js +154 -0
- package/dist/tuning/native.d.ts +35 -0
- package/dist/tuning/native.js +80 -0
- package/dist/tuning/schema.d.ts +69 -0
- package/dist/tuning/schema.js +247 -0
- package/dist/tuning/types.d.ts +75 -0
- package/dist/tuning/types.js +39 -0
- package/dist/web/analytics/line-chart.d.ts +20 -0
- package/dist/web/analytics/line-chart.js +28 -0
- package/dist/web/analytics/metric-card.d.ts +18 -0
- package/dist/web/analytics/metric-card.js +40 -0
- package/dist/web/analytics/multi-line-chart.d.ts +39 -0
- package/dist/web/analytics/multi-line-chart.js +345 -0
- package/dist/web/atom/avatar.d.ts +11 -0
- package/dist/web/atom/avatar.js +24 -0
- package/dist/web/atom/badge.d.ts +2 -0
- package/dist/web/atom/badge.js +3 -0
- package/dist/web/atom/button.d.ts +23 -0
- package/dist/web/atom/button.js +35 -0
- package/dist/web/atom/checkbox.d.ts +19 -0
- package/dist/web/atom/checkbox.js +33 -0
- package/dist/web/atom/colored-value.d.ts +13 -0
- package/dist/web/atom/colored-value.js +24 -0
- package/dist/web/atom/help.d.ts +10 -0
- package/dist/web/atom/help.js +18 -0
- package/dist/web/atom/label.d.ts +2 -0
- package/dist/web/atom/label.js +3 -0
- package/dist/web/atom/segmented-control.d.ts +40 -0
- package/dist/web/atom/segmented-control.js +43 -0
- package/dist/web/atom/select.d.ts +43 -0
- package/dist/web/atom/select.js +93 -0
- package/dist/web/atom/separator.d.ts +2 -0
- package/dist/web/atom/separator.js +3 -0
- package/dist/web/atom/skeleton.d.ts +2 -0
- package/dist/web/atom/skeleton.js +3 -0
- package/dist/web/atom/slider.d.ts +33 -0
- package/dist/web/atom/slider.js +70 -0
- package/dist/web/atom/spinner.d.ts +8 -0
- package/dist/web/atom/spinner.js +14 -0
- package/dist/web/atom/switch.d.ts +11 -0
- package/dist/web/atom/switch.js +10 -0
- package/dist/web/atom/text-area.d.ts +22 -0
- package/dist/web/atom/text-area.js +26 -0
- package/dist/web/atom/text-field.d.ts +17 -0
- package/dist/web/atom/text-field.js +21 -0
- package/dist/web/atom/toggle-chip.d.ts +22 -0
- package/dist/web/atom/toggle-chip.js +28 -0
- package/dist/web/atom/tooltip.d.ts +23 -0
- package/dist/web/atom/tooltip.js +26 -0
- package/dist/web/atom/typography.d.ts +6 -0
- package/dist/web/atom/typography.js +23 -0
- package/dist/web/base/accordion.d.ts +9 -0
- package/dist/web/base/accordion.js +44 -0
- package/dist/web/base/alert.d.ts +11 -0
- package/dist/web/base/alert.js +37 -0
- package/dist/web/base/avatar.d.ts +8 -0
- package/dist/web/base/avatar.js +29 -0
- package/dist/web/base/badge.d.ts +12 -0
- package/dist/web/base/badge.js +26 -0
- package/dist/web/base/breadcrumb.d.ts +16 -0
- package/dist/web/base/breadcrumb.js +72 -0
- package/dist/web/base/button.d.ts +12 -0
- package/dist/web/base/button.js +47 -0
- package/dist/web/base/card.d.ts +19 -0
- package/dist/web/base/card.js +74 -0
- package/dist/web/base/checkbox.d.ts +6 -0
- package/dist/web/base/checkbox.js +21 -0
- package/dist/web/base/dialog.d.ts +20 -0
- package/dist/web/base/dialog.js +92 -0
- package/dist/web/base/dropdown-menu.d.ts +29 -0
- package/dist/web/base/dropdown-menu.js +125 -0
- package/dist/web/base/field.d.ts +27 -0
- package/dist/web/base/field.js +118 -0
- package/dist/web/base/form.d.ts +38 -0
- package/dist/web/base/form.js +110 -0
- package/dist/web/base/input.d.ts +9 -0
- package/dist/web/base/input.js +23 -0
- package/dist/web/base/label.d.ts +6 -0
- package/dist/web/base/label.js +15 -0
- package/dist/web/base/pagination.d.ts +34 -0
- package/dist/web/base/pagination.js +90 -0
- package/dist/web/base/popover.d.ts +11 -0
- package/dist/web/base/popover.js +37 -0
- package/dist/web/base/radio-group.d.ts +7 -0
- package/dist/web/base/radio-group.js +27 -0
- package/dist/web/base/scroll-area.d.ts +10 -0
- package/dist/web/base/scroll-area.js +41 -0
- package/dist/web/base/select.d.ts +17 -0
- package/dist/web/base/select.js +96 -0
- package/dist/web/base/separator.d.ts +6 -0
- package/dist/web/base/separator.js +17 -0
- package/dist/web/base/sheet.d.ts +19 -0
- package/dist/web/base/sheet.js +88 -0
- package/dist/web/base/skeleton.d.ts +5 -0
- package/dist/web/base/skeleton.js +14 -0
- package/dist/web/base/slider.d.ts +9 -0
- package/dist/web/base/slider.js +39 -0
- package/dist/web/base/sonner.d.ts +9 -0
- package/dist/web/base/sonner.js +25 -0
- package/dist/web/base/spinner.d.ts +5 -0
- package/dist/web/base/spinner.js +17 -0
- package/dist/web/base/switch.d.ts +6 -0
- package/dist/web/base/switch.js +19 -0
- package/dist/web/base/table.d.ts +14 -0
- package/dist/web/base/table.js +68 -0
- package/dist/web/base/tabs.d.ts +9 -0
- package/dist/web/base/tabs.js +36 -0
- package/dist/web/base/textarea.d.ts +9 -0
- package/dist/web/base/textarea.js +23 -0
- package/dist/web/base/tooltip.d.ts +9 -0
- package/dist/web/base/tooltip.js +36 -0
- package/dist/web/form/checkbox.d.ts +35 -0
- package/dist/web/form/checkbox.js +91 -0
- package/dist/web/form/radio-group.d.ts +24 -0
- package/dist/web/form/radio-group.js +75 -0
- package/dist/web/form/select.d.ts +16 -0
- package/dist/web/form/select.js +44 -0
- package/dist/web/form/slider.d.ts +19 -0
- package/dist/web/form/slider.js +51 -0
- package/dist/web/form/switch.d.ts +11 -0
- package/dist/web/form/switch.js +50 -0
- package/dist/web/form/text-area.d.ts +10 -0
- package/dist/web/form/text-area.js +31 -0
- package/dist/web/form/text-input.d.ts +10 -0
- package/dist/web/form/text-input.js +42 -0
- package/dist/web/index.d.ts +1 -0
- package/dist/web/index.js +0 -0
- package/dist/web/layout/accordion.d.ts +26 -0
- package/dist/web/layout/accordion.js +29 -0
- package/dist/web/layout/alert-modal.d.ts +41 -0
- package/dist/web/layout/alert-modal.js +71 -0
- package/dist/web/layout/card.d.ts +17 -0
- package/dist/web/layout/card.js +35 -0
- package/dist/web/layout/description.d.ts +12 -0
- package/dist/web/layout/description.js +20 -0
- package/dist/web/layout/information.d.ts +36 -0
- package/dist/web/layout/information.js +53 -0
- package/dist/web/layout/modal.d.ts +16 -0
- package/dist/web/layout/modal.js +37 -0
- package/dist/web/layout/page-frame.d.ts +37 -0
- package/dist/web/layout/page-frame.js +79 -0
- package/dist/web/layout/scroll-area.d.ts +10 -0
- package/dist/web/layout/scroll-area.js +13 -0
- package/dist/web/layout/sheet.d.ts +32 -0
- package/dist/web/layout/sheet.js +68 -0
- package/dist/web/layout/simple-dialog.d.ts +11 -0
- package/dist/web/layout/simple-dialog.js +24 -0
- package/dist/web/layout/simple-table.d.ts +49 -0
- package/dist/web/layout/simple-table.js +58 -0
- package/dist/web/layout/tabs.d.ts +26 -0
- package/dist/web/layout/tabs.js +42 -0
- package/dist/web/layout/titled-modal.d.ts +33 -0
- package/dist/web/layout/titled-modal.js +59 -0
- package/dist/web/lib/css-vars.d.ts +14 -0
- package/dist/web/lib/css-vars.js +18 -0
- package/dist/web/lib/dialog.d.ts +13 -0
- package/dist/web/lib/dialog.js +0 -0
- package/dist/web/lib/form.d.ts +2 -0
- package/dist/web/lib/form.js +3 -0
- package/dist/web/lib/labels.d.ts +27 -0
- package/dist/web/lib/labels.js +29 -0
- package/dist/web/lib/modal-open-focus.d.ts +17 -0
- package/dist/web/lib/modal-open-focus.js +44 -0
- package/dist/web/lib/restore-focus.d.ts +12 -0
- package/dist/web/lib/restore-focus.js +32 -0
- package/dist/web/lib/utils.d.ts +4 -0
- package/dist/web/lib/utils.js +10 -0
- package/dist/web/styles.css +162 -0
- package/package.json +203 -4
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { VariantProps } from "class-variance-authority";
|
|
3
|
+
//#region src/web/base/textarea.d.ts
|
|
4
|
+
declare const textareaVariants: (props?: ({
|
|
5
|
+
variant?: "<3" | "block" | "default" | null | undefined;
|
|
6
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
|
+
declare function Textarea({ className, variant, ...props }: React.ComponentProps<"textarea"> & VariantProps<typeof textareaVariants>): React.JSX.Element;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { Textarea, textareaVariants };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { cn } from "../lib/utils.js";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { cva } from "class-variance-authority";
|
|
4
|
+
|
|
5
|
+
//#region src/web/base/textarea.tsx
|
|
6
|
+
const textareaVariants = cva("field-sizing-content placeholder:text-muted-foreground w-full outline-none disabled:cursor-not-allowed disabled:opacity-50", {
|
|
7
|
+
variants: { variant: {
|
|
8
|
+
default: "border-input flex min-h-20 rounded-control border bg-card px-2.5 py-1.5 text-base transition-[border-color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/25 aria-invalid:border-destructive md:text-[13px]",
|
|
9
|
+
"<3": "min-h-0 resize-none border-0 border-b border-dashed border-border bg-transparent px-0 py-0.5 text-xs focus-visible:border-solid focus-visible:border-ring",
|
|
10
|
+
block: "min-h-0 resize-none border-0 bg-transparent px-1 py-0.5 text-sm leading-relaxed hover:bg-wash focus-visible:bg-wash"
|
|
11
|
+
} },
|
|
12
|
+
defaultVariants: { variant: "default" }
|
|
13
|
+
});
|
|
14
|
+
function Textarea({ className, variant, ...props }) {
|
|
15
|
+
return /* @__PURE__ */ jsx("textarea", {
|
|
16
|
+
"data-slot": "textarea",
|
|
17
|
+
className: cn(textareaVariants({ variant }), className),
|
|
18
|
+
...props
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
export { Textarea, textareaVariants };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
3
|
+
//#region src/web/base/tooltip.d.ts
|
|
4
|
+
declare function TooltipProvider({ delayDuration, ...props }: React.ComponentProps<typeof TooltipPrimitive.Provider>): React.JSX.Element;
|
|
5
|
+
declare function Tooltip({ ...props }: React.ComponentProps<typeof TooltipPrimitive.Root>): React.JSX.Element;
|
|
6
|
+
declare function TooltipTrigger({ ...props }: React.ComponentProps<typeof TooltipPrimitive.Trigger>): React.JSX.Element;
|
|
7
|
+
declare function TooltipContent({ className, sideOffset, children, ...props }: React.ComponentProps<typeof TooltipPrimitive.Content>): React.JSX.Element;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { cn } from "../lib/utils.js";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
4
|
+
|
|
5
|
+
//#region src/web/base/tooltip.tsx
|
|
6
|
+
function TooltipProvider({ delayDuration = 0, ...props }) {
|
|
7
|
+
return /* @__PURE__ */ jsx(TooltipPrimitive.Provider, {
|
|
8
|
+
"data-slot": "tooltip-provider",
|
|
9
|
+
delayDuration,
|
|
10
|
+
...props
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
function Tooltip({ ...props }) {
|
|
14
|
+
return /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsx(TooltipPrimitive.Root, {
|
|
15
|
+
"data-slot": "tooltip",
|
|
16
|
+
...props
|
|
17
|
+
}) });
|
|
18
|
+
}
|
|
19
|
+
function TooltipTrigger({ ...props }) {
|
|
20
|
+
return /* @__PURE__ */ jsx(TooltipPrimitive.Trigger, {
|
|
21
|
+
"data-slot": "tooltip-trigger",
|
|
22
|
+
...props
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function TooltipContent({ className, sideOffset = 0, children, ...props }) {
|
|
26
|
+
return /* @__PURE__ */ jsx(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsx(TooltipPrimitive.Content, {
|
|
27
|
+
"data-slot": "tooltip-content",
|
|
28
|
+
sideOffset,
|
|
29
|
+
className: cn("bg-popover text-popover-foreground border border-border shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-control px-2.5 py-1 text-xs text-balance", className),
|
|
30
|
+
...props,
|
|
31
|
+
children
|
|
32
|
+
}) });
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
//#endregion
|
|
36
|
+
export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { BaseInputProps } from "../../shared/form.js";
|
|
2
|
+
import { Checkbox as Checkbox$1 } from "../base/checkbox.js";
|
|
3
|
+
import "../lib/form.js";
|
|
4
|
+
import React, { ComponentProps } from "react";
|
|
5
|
+
//#region src/web/form/checkbox.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* チェックボックスの名前。次のどれかが要る(名前の無いチェックボックスにしない)。
|
|
8
|
+
* - `checkboxLabel`: 右に出す文字(押すと切り替わる)
|
|
9
|
+
* - `label`: 上に出すフィールドのラベル(単体のチェックボックスで、右に文字を置かないとき。ラベルが名前になる)
|
|
10
|
+
* - `aria-label` / `aria-labelledby`: 見えるラベルが無いとき(表の行の選択など)
|
|
11
|
+
*/
|
|
12
|
+
type CheckboxNameProps = {
|
|
13
|
+
checkboxLabel: React.ReactNode;
|
|
14
|
+
} | {
|
|
15
|
+
checkboxLabel?: undefined;
|
|
16
|
+
label: React.ReactNode;
|
|
17
|
+
} | {
|
|
18
|
+
checkboxLabel?: undefined;
|
|
19
|
+
"aria-label": string;
|
|
20
|
+
} | {
|
|
21
|
+
checkboxLabel?: undefined;
|
|
22
|
+
"aria-labelledby": string;
|
|
23
|
+
};
|
|
24
|
+
export type CheckboxProps = BaseInputProps<boolean> & Omit<ComponentProps<typeof Checkbox$1>, "checked" | "onCheckedChange" | "value" | "onChange"> & {
|
|
25
|
+
/** チェックボックスとラベルの垂直配置 */
|
|
26
|
+
align?: "center" | "start";
|
|
27
|
+
} & CheckboxNameProps;
|
|
28
|
+
/**
|
|
29
|
+
* Form / 制御の双方向対応の Checkbox。
|
|
30
|
+
* - `value` / `onValueChange` を渡すと制御モード (内部で `atom/checkbox` を使う)
|
|
31
|
+
* - 省略すると field context から取得する
|
|
32
|
+
*/
|
|
33
|
+
export declare function Checkbox(props: CheckboxProps): React.JSX.Element;
|
|
34
|
+
//#endregion
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { useFieldValue } from "../../shared/form.js";
|
|
2
|
+
import { cn } from "../lib/utils.js";
|
|
3
|
+
import { Checkbox as Checkbox$1 } from "../base/checkbox.js";
|
|
4
|
+
import { Label } from "../base/label.js";
|
|
5
|
+
import { FormControl, FormDescription, FormItem, FormLabel, FormMessage } from "../base/form.js";
|
|
6
|
+
import { useId } from "react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
|
|
9
|
+
//#region src/web/form/checkbox.tsx
|
|
10
|
+
/**
|
|
11
|
+
* Form / 制御の双方向対応の Checkbox。
|
|
12
|
+
* - `value` / `onValueChange` を渡すと制御モード (内部で `atom/checkbox` を使う)
|
|
13
|
+
* - 省略すると field context から取得する
|
|
14
|
+
*/
|
|
15
|
+
function Checkbox(props) {
|
|
16
|
+
if (props.value !== void 0 && props.onValueChange !== void 0) return /* @__PURE__ */ jsx(ControlledCheckbox, {
|
|
17
|
+
...props,
|
|
18
|
+
value: props.value,
|
|
19
|
+
onValueChange: props.onValueChange
|
|
20
|
+
});
|
|
21
|
+
return /* @__PURE__ */ jsx(FieldCheckbox, { ...props });
|
|
22
|
+
}
|
|
23
|
+
function ControlledCheckbox({ label, required, helpText, description, className, checkboxLabel, align = "center", wrapperClassName, disabled, value, onValueChange, ...rest }) {
|
|
24
|
+
return /* @__PURE__ */ jsx(Layout, {
|
|
25
|
+
label,
|
|
26
|
+
required,
|
|
27
|
+
helpText,
|
|
28
|
+
description,
|
|
29
|
+
className,
|
|
30
|
+
checkboxLabel,
|
|
31
|
+
align,
|
|
32
|
+
wrapperClassName,
|
|
33
|
+
disabled,
|
|
34
|
+
checked: value,
|
|
35
|
+
onCheckedChange: onValueChange,
|
|
36
|
+
rest
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
function FieldCheckbox({ label, required, helpText, description, debounce, className, checkboxLabel, align = "center", wrapperClassName, disabled, ...rest }) {
|
|
40
|
+
const [value, setValue] = useFieldValue({ debounce });
|
|
41
|
+
return /* @__PURE__ */ jsx(Layout, {
|
|
42
|
+
label,
|
|
43
|
+
required,
|
|
44
|
+
helpText,
|
|
45
|
+
description,
|
|
46
|
+
className,
|
|
47
|
+
checkboxLabel,
|
|
48
|
+
align,
|
|
49
|
+
wrapperClassName,
|
|
50
|
+
disabled,
|
|
51
|
+
checked: value ?? false,
|
|
52
|
+
onCheckedChange: setValue,
|
|
53
|
+
rest
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
function Layout({ label, required, helpText, description, className, checkboxLabel, align, wrapperClassName, disabled, checked, onCheckedChange, rest }) {
|
|
57
|
+
const id = useId();
|
|
58
|
+
return /* @__PURE__ */ jsxs(FormItem, {
|
|
59
|
+
className: wrapperClassName,
|
|
60
|
+
children: [
|
|
61
|
+
label && /* @__PURE__ */ jsx(FormLabel, {
|
|
62
|
+
required,
|
|
63
|
+
helpText,
|
|
64
|
+
children: label
|
|
65
|
+
}),
|
|
66
|
+
/* @__PURE__ */ jsx("div", {
|
|
67
|
+
className: cn("flex gap-3", align === "start" ? "items-start" : "items-center"),
|
|
68
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
69
|
+
className: "inline-flex items-center gap-1.5",
|
|
70
|
+
children: [/* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(Checkbox$1, {
|
|
71
|
+
...checkboxLabel === void 0 ? {} : { id },
|
|
72
|
+
checked,
|
|
73
|
+
onCheckedChange: (next) => onCheckedChange(next === true),
|
|
74
|
+
disabled,
|
|
75
|
+
className,
|
|
76
|
+
...rest
|
|
77
|
+
}) }), checkboxLabel === void 0 ? null : /* @__PURE__ */ jsx(Label, {
|
|
78
|
+
htmlFor: id,
|
|
79
|
+
className: "cursor-pointer",
|
|
80
|
+
children: checkboxLabel
|
|
81
|
+
})]
|
|
82
|
+
})
|
|
83
|
+
}),
|
|
84
|
+
description && /* @__PURE__ */ jsx(FormDescription, { children: description }),
|
|
85
|
+
/* @__PURE__ */ jsx(FormMessage, {})
|
|
86
|
+
]
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
//#endregion
|
|
91
|
+
export { Checkbox };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { FieldInputProps } from "../../shared/form.js";
|
|
2
|
+
import "../lib/form.js";
|
|
3
|
+
import React from "react";
|
|
4
|
+
//#region src/web/form/radio-group.d.ts
|
|
5
|
+
type Option = {
|
|
6
|
+
value: string;
|
|
7
|
+
label: string;
|
|
8
|
+
content?: React.ReactNode;
|
|
9
|
+
};
|
|
10
|
+
export type RadioGroupProps = FieldInputProps & {
|
|
11
|
+
options: Option[];
|
|
12
|
+
} & ({
|
|
13
|
+
type: "list";
|
|
14
|
+
full?: never;
|
|
15
|
+
} | {
|
|
16
|
+
type: "box";
|
|
17
|
+
full?: boolean;
|
|
18
|
+
} | {
|
|
19
|
+
type?: never;
|
|
20
|
+
full?: boolean;
|
|
21
|
+
});
|
|
22
|
+
export declare function RadioGroup({ label, description, required, helpText, ...rest }: RadioGroupProps): React.JSX.Element;
|
|
23
|
+
//#endregion
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { useFieldValue } from "../../shared/form.js";
|
|
2
|
+
import { cn } from "../lib/utils.js";
|
|
3
|
+
import { Label } from "../base/label.js";
|
|
4
|
+
import { FormControl, FormDescription, FormItem, FormLabel, FormMessage, useFormField } from "../base/form.js";
|
|
5
|
+
import { RadioGroup as RadioGroup$1, RadioGroupItem } from "../base/radio-group.js";
|
|
6
|
+
import { useId } from "react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
|
|
9
|
+
//#region src/web/form/radio-group.tsx
|
|
10
|
+
function RadioGroup({ label, description, required, helpText, ...rest }) {
|
|
11
|
+
return /* @__PURE__ */ jsxs(FormItem, { children: [
|
|
12
|
+
label && /* @__PURE__ */ jsx(FormLabel, {
|
|
13
|
+
required,
|
|
14
|
+
helpText,
|
|
15
|
+
children: label
|
|
16
|
+
}),
|
|
17
|
+
/* @__PURE__ */ jsx(RadioGroupBody, {
|
|
18
|
+
hasLabel: Boolean(label),
|
|
19
|
+
...rest
|
|
20
|
+
}),
|
|
21
|
+
description && /* @__PURE__ */ jsx(FormDescription, { children: description }),
|
|
22
|
+
/* @__PURE__ */ jsx(FormMessage, {})
|
|
23
|
+
] });
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* 選択肢の入れ物。FormItem の中(ラベルと同じ context)で描くので、ラベルの id を読める。
|
|
27
|
+
* グループ自身が `formItemId`(ラベルの `htmlFor` の行き先)を持ち、`aria-labelledby` でラベルを名前にする。
|
|
28
|
+
* 各選択肢の入力欄は FormControl に自分の id を渡す(同じ field に control が複数あるので、formItemId を使い回すと重複する)。
|
|
29
|
+
*/
|
|
30
|
+
function RadioGroupBody({ hasLabel, options, disabled, debounce, className, full, type = "list" }) {
|
|
31
|
+
const [value, setValue] = useFieldValue({ debounce });
|
|
32
|
+
const { formItemId, formLabelId } = useFormField();
|
|
33
|
+
return /* @__PURE__ */ jsx(RadioGroup$1, {
|
|
34
|
+
id: formItemId,
|
|
35
|
+
"aria-labelledby": hasLabel ? formLabelId : void 0,
|
|
36
|
+
onValueChange: (next) => setValue(next),
|
|
37
|
+
value,
|
|
38
|
+
className: cn(type === "box" && "flex flex-wrap gap-2", className),
|
|
39
|
+
disabled,
|
|
40
|
+
children: options.map((option) => /* @__PURE__ */ jsx(RadioOption, {
|
|
41
|
+
option,
|
|
42
|
+
type,
|
|
43
|
+
full
|
|
44
|
+
}, option.value))
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
function RadioOption({ option, type, full }) {
|
|
48
|
+
const id = useId();
|
|
49
|
+
return /* @__PURE__ */ jsxs(Label, {
|
|
50
|
+
className: cn("cursor-pointer hover:bg-accent/50 grid grid-cols-[min-content_1fr] p-1 gap-y-0 rounded-control px-3", type === "box" && "border py-0 px-3 h-fit", option.content && "pb-3", full && "grow"),
|
|
51
|
+
children: [
|
|
52
|
+
/* @__PURE__ */ jsx("div", {
|
|
53
|
+
className: cn("h-9 flex items-center"),
|
|
54
|
+
children: /* @__PURE__ */ jsx(FormControl, {
|
|
55
|
+
id,
|
|
56
|
+
children: /* @__PURE__ */ jsx(RadioGroupItem, {
|
|
57
|
+
className: cn("cursor-pointer"),
|
|
58
|
+
value: option.value
|
|
59
|
+
})
|
|
60
|
+
})
|
|
61
|
+
}),
|
|
62
|
+
/* @__PURE__ */ jsx("p", {
|
|
63
|
+
className: cn("text-sm leading-none font-medium"),
|
|
64
|
+
children: option.label
|
|
65
|
+
}),
|
|
66
|
+
/* @__PURE__ */ jsx("div", {
|
|
67
|
+
className: cn("flex gap-2", type === "box" && "col-span-full flex-col", type === "list" && "col-start-2"),
|
|
68
|
+
children: option.content
|
|
69
|
+
})
|
|
70
|
+
]
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
//#endregion
|
|
75
|
+
export { RadioGroup };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FieldInputProps } from "../../shared/form.js";
|
|
2
|
+
import "../lib/form.js";
|
|
3
|
+
//#region src/web/form/select.d.ts
|
|
4
|
+
export type SelectOption = {
|
|
5
|
+
value: string;
|
|
6
|
+
label: string;
|
|
7
|
+
};
|
|
8
|
+
export type SelectOptionGroup = {
|
|
9
|
+
label: string;
|
|
10
|
+
options: SelectOption[];
|
|
11
|
+
};
|
|
12
|
+
export type SelectProps = FieldInputProps & {
|
|
13
|
+
options: (SelectOption | SelectOptionGroup)[];
|
|
14
|
+
};
|
|
15
|
+
export declare function Select({ label, description, placeholder, disabled, debounce, required, helpText, options, className, wrapperClassName }: SelectProps): import("react").JSX.Element;
|
|
16
|
+
//#endregion
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { useFieldValue } from "../../shared/form.js";
|
|
2
|
+
import { cn } from "../lib/utils.js";
|
|
3
|
+
import { Select as Select$1, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectTrigger, SelectValue } from "../base/select.js";
|
|
4
|
+
import { FormControl, FormDescription, FormItem, FormLabel, FormMessage } from "../base/form.js";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
|
|
7
|
+
//#region src/web/form/select.tsx
|
|
8
|
+
const emptyValue = ":EMPTY:";
|
|
9
|
+
function isOptionGroup(option) {
|
|
10
|
+
return "options" in option;
|
|
11
|
+
}
|
|
12
|
+
function renderOption(option) {
|
|
13
|
+
return /* @__PURE__ */ jsx(SelectItem, {
|
|
14
|
+
value: option.value ? option.value : emptyValue,
|
|
15
|
+
children: option.label
|
|
16
|
+
}, option.value);
|
|
17
|
+
}
|
|
18
|
+
function Select({ label, description, placeholder, disabled, debounce, required, helpText, options, className, wrapperClassName }) {
|
|
19
|
+
const [value, setValue] = useFieldValue({ debounce });
|
|
20
|
+
return /* @__PURE__ */ jsxs(FormItem, {
|
|
21
|
+
className: wrapperClassName,
|
|
22
|
+
children: [
|
|
23
|
+
label && /* @__PURE__ */ jsx(FormLabel, {
|
|
24
|
+
required,
|
|
25
|
+
helpText,
|
|
26
|
+
children: label
|
|
27
|
+
}),
|
|
28
|
+
/* @__PURE__ */ jsxs(Select$1, {
|
|
29
|
+
value,
|
|
30
|
+
onValueChange: (next) => setValue(emptyValue === next ? "" : next),
|
|
31
|
+
disabled,
|
|
32
|
+
children: [/* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(SelectTrigger, {
|
|
33
|
+
className: cn("w-full cursor-pointer", className),
|
|
34
|
+
children: /* @__PURE__ */ jsx(SelectValue, { placeholder: placeholder ?? "選択してください" })
|
|
35
|
+
}) }), /* @__PURE__ */ jsx(SelectContent, { children: options.map((option) => isOptionGroup(option) ? /* @__PURE__ */ jsxs(SelectGroup, { children: [/* @__PURE__ */ jsx(SelectLabel, { children: option.label }), option.options.map(renderOption)] }, option.label) : renderOption(option)) })]
|
|
36
|
+
}),
|
|
37
|
+
description && /* @__PURE__ */ jsx(FormDescription, { children: description }),
|
|
38
|
+
/* @__PURE__ */ jsx(FormMessage, {})
|
|
39
|
+
]
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
//#endregion
|
|
44
|
+
export { Select };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { FieldInputProps } from "../../shared/form.js";
|
|
2
|
+
import "../lib/form.js";
|
|
3
|
+
import React from "react";
|
|
4
|
+
//#region src/web/form/slider.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Slider に対応するフィールド型は単一値 (`number`) と範囲 (`number[]`) の両方を許容する(どちらかは field の値で決まる)。
|
|
7
|
+
*/
|
|
8
|
+
export type SliderProps = FieldInputProps & {
|
|
9
|
+
min?: number;
|
|
10
|
+
max: number;
|
|
11
|
+
step?: number;
|
|
12
|
+
formattedValue?: React.ReactNode;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* TanStack Form 統合版 Slider。値は field context から取得する。
|
|
16
|
+
* 制御版が必要なら `atom/slider` を使う。
|
|
17
|
+
*/
|
|
18
|
+
export declare function Slider(props: SliderProps): React.JSX.Element;
|
|
19
|
+
//#endregion
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { useFieldValue } from "../../shared/form.js";
|
|
2
|
+
import { Slider as Slider$1 } from "../atom/slider.js";
|
|
3
|
+
import { FormControl, FormDescription, FormItem, FormMessage } from "../base/form.js";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
|
|
6
|
+
//#region src/web/form/slider.tsx
|
|
7
|
+
/**
|
|
8
|
+
* TanStack Form 統合版 Slider。値は field context から取得する。
|
|
9
|
+
* 制御版が必要なら `atom/slider` を使う。
|
|
10
|
+
*/
|
|
11
|
+
function Slider(props) {
|
|
12
|
+
const { label, required, description, helpText, min, max, step, debounce, disabled, className, wrapperClassName, formattedValue } = props;
|
|
13
|
+
const [value, setValue] = useFieldValue({ debounce });
|
|
14
|
+
return /* @__PURE__ */ jsxs(FormItem, {
|
|
15
|
+
className: wrapperClassName,
|
|
16
|
+
children: [
|
|
17
|
+
/* @__PURE__ */ jsx(FormControl, { children: Array.isArray(value) ? /* @__PURE__ */ jsx(Slider$1, {
|
|
18
|
+
value,
|
|
19
|
+
onValueChange: (next) => setValue(next),
|
|
20
|
+
label,
|
|
21
|
+
required,
|
|
22
|
+
helpText,
|
|
23
|
+
min,
|
|
24
|
+
max,
|
|
25
|
+
step,
|
|
26
|
+
disabled,
|
|
27
|
+
className,
|
|
28
|
+
formattedValue,
|
|
29
|
+
wrapperClassName: "contents"
|
|
30
|
+
}) : /* @__PURE__ */ jsx(Slider$1, {
|
|
31
|
+
value: typeof value === "number" ? value : 0,
|
|
32
|
+
onValueChange: (next) => setValue(next),
|
|
33
|
+
label,
|
|
34
|
+
required,
|
|
35
|
+
helpText,
|
|
36
|
+
min,
|
|
37
|
+
max,
|
|
38
|
+
step,
|
|
39
|
+
disabled,
|
|
40
|
+
className,
|
|
41
|
+
formattedValue,
|
|
42
|
+
wrapperClassName: "contents"
|
|
43
|
+
}) }),
|
|
44
|
+
description && /* @__PURE__ */ jsx(FormDescription, { children: description }),
|
|
45
|
+
/* @__PURE__ */ jsx(FormMessage, {})
|
|
46
|
+
]
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
//#endregion
|
|
51
|
+
export { Slider };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BaseInputProps } from "../../shared/form.js";
|
|
2
|
+
import "../lib/form.js";
|
|
3
|
+
//#region src/web/form/switch.d.ts
|
|
4
|
+
export type SwitchProps = BaseInputProps<boolean>;
|
|
5
|
+
/**
|
|
6
|
+
* Form / 制御の双方向対応の Switch。
|
|
7
|
+
* - `value` / `onValueChange` を渡すと制御モード(field context を読まないので、field の外でも使える)
|
|
8
|
+
* - 省略すると field context から取得する
|
|
9
|
+
*/
|
|
10
|
+
export declare function Switch(props: SwitchProps): import("react").JSX.Element;
|
|
11
|
+
//#endregion
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { useFieldValue } from "../../shared/form.js";
|
|
2
|
+
import { cn } from "../lib/utils.js";
|
|
3
|
+
import { Switch as Switch$1 } from "../base/switch.js";
|
|
4
|
+
import { FormControl, FormDescription, FormItem, FormLabel, FormMessage } from "../base/form.js";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
|
|
7
|
+
//#region src/web/form/switch.tsx
|
|
8
|
+
/**
|
|
9
|
+
* Form / 制御の双方向対応の Switch。
|
|
10
|
+
* - `value` / `onValueChange` を渡すと制御モード(field context を読まないので、field の外でも使える)
|
|
11
|
+
* - 省略すると field context から取得する
|
|
12
|
+
*/
|
|
13
|
+
function Switch(props) {
|
|
14
|
+
if (props.value !== void 0 && props.onValueChange !== void 0) return /* @__PURE__ */ jsx(Layout, {
|
|
15
|
+
...props,
|
|
16
|
+
checked: props.value,
|
|
17
|
+
onCheckedChange: props.onValueChange
|
|
18
|
+
});
|
|
19
|
+
return /* @__PURE__ */ jsx(FieldSwitch, { ...props });
|
|
20
|
+
}
|
|
21
|
+
function FieldSwitch(props) {
|
|
22
|
+
const [value, setValue] = useFieldValue({ debounce: props.debounce });
|
|
23
|
+
return /* @__PURE__ */ jsx(Layout, {
|
|
24
|
+
...props,
|
|
25
|
+
checked: value ?? false,
|
|
26
|
+
onCheckedChange: setValue
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function Layout({ label, required, description, disabled, helpText, className, checked, onCheckedChange }) {
|
|
30
|
+
return /* @__PURE__ */ jsxs(FormItem, { children: [
|
|
31
|
+
/* @__PURE__ */ jsxs("div", {
|
|
32
|
+
className: cn("h-9 flex items-center justify-between"),
|
|
33
|
+
children: [label && /* @__PURE__ */ jsx(FormLabel, {
|
|
34
|
+
required,
|
|
35
|
+
helpText,
|
|
36
|
+
children: label
|
|
37
|
+
}), /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(Switch$1, {
|
|
38
|
+
className: cn("h-fit cursor-pointer", className),
|
|
39
|
+
checked,
|
|
40
|
+
onCheckedChange,
|
|
41
|
+
disabled
|
|
42
|
+
}) })]
|
|
43
|
+
}),
|
|
44
|
+
description && /* @__PURE__ */ jsx(FormDescription, { children: description }),
|
|
45
|
+
/* @__PURE__ */ jsx(FormMessage, {})
|
|
46
|
+
] });
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
//#endregion
|
|
50
|
+
export { Switch };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FieldInputProps } from "../../shared/form.js";
|
|
2
|
+
import { Textarea as Textarea$1 } from "../base/textarea.js";
|
|
3
|
+
import "../lib/form.js";
|
|
4
|
+
import { ComponentProps } from "react";
|
|
5
|
+
//#region src/web/form/text-area.d.ts
|
|
6
|
+
export type TextareaProps = FieldInputProps & Omit<ComponentProps<typeof Textarea$1>, "name" | "className" | "value" | "defaultValue" | "onChange"> & {
|
|
7
|
+
fullHeight?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare function Textarea(props: TextareaProps): import("react").JSX.Element;
|
|
10
|
+
//#endregion
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { useFieldValue } from "../../shared/form.js";
|
|
2
|
+
import { cn } from "../lib/utils.js";
|
|
3
|
+
import { Textarea as Textarea$1 } from "../base/textarea.js";
|
|
4
|
+
import { FormControl, FormDescription, FormItem, FormLabel, FormMessage } from "../base/form.js";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
|
|
7
|
+
//#region src/web/form/text-area.tsx
|
|
8
|
+
function Textarea(props) {
|
|
9
|
+
const { label, required, description, debounce, className, fullHeight, ...remain } = props;
|
|
10
|
+
const [value, setValue] = useFieldValue({ debounce });
|
|
11
|
+
return /* @__PURE__ */ jsxs(FormItem, {
|
|
12
|
+
className: cn(fullHeight && "h-full"),
|
|
13
|
+
children: [
|
|
14
|
+
label && /* @__PURE__ */ jsx(FormLabel, {
|
|
15
|
+
required,
|
|
16
|
+
children: label
|
|
17
|
+
}),
|
|
18
|
+
/* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(Textarea$1, {
|
|
19
|
+
value: value ?? "",
|
|
20
|
+
onChange: (e) => setValue(e.currentTarget.value),
|
|
21
|
+
className: cn("min-h-[200px] text-sm", className),
|
|
22
|
+
...remain
|
|
23
|
+
}) }),
|
|
24
|
+
description && /* @__PURE__ */ jsx(FormDescription, { children: description }),
|
|
25
|
+
/* @__PURE__ */ jsx(FormMessage, {})
|
|
26
|
+
]
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
//#endregion
|
|
31
|
+
export { Textarea };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FieldInputProps } from "../../shared/form.js";
|
|
2
|
+
import "../lib/form.js";
|
|
3
|
+
//#region src/web/form/text-input.d.ts
|
|
4
|
+
export type TextInputProps = {
|
|
5
|
+
type?: "text" | "email" | "password" | "tel" | "url" | "number";
|
|
6
|
+
/** ブラウザの自動入力のヒント(`email`・`current-password`・`one-time-code` など。HTML の `autocomplete` 属性の値)。 */
|
|
7
|
+
autoComplete?: string;
|
|
8
|
+
} & FieldInputProps;
|
|
9
|
+
export declare function TextInput({ label, required, description, debounce, className, wrapperClassName, type, helpText, ...remain }: TextInputProps): import("react").JSX.Element;
|
|
10
|
+
//#endregion
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { useFieldValue } from "../../shared/form.js";
|
|
2
|
+
import { cn } from "../lib/utils.js";
|
|
3
|
+
import { Input } from "../base/input.js";
|
|
4
|
+
import { FormControl, FormDescription, FormItem, FormLabel, FormMessage } from "../base/form.js";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
|
|
7
|
+
//#region src/web/form/text-input.tsx
|
|
8
|
+
function TextInput({ label, required, description, debounce, className, wrapperClassName, type, helpText, ...remain }) {
|
|
9
|
+
const [value, setValue] = useFieldValue({ debounce });
|
|
10
|
+
return /* @__PURE__ */ jsxs(FormItem, {
|
|
11
|
+
className: wrapperClassName,
|
|
12
|
+
children: [
|
|
13
|
+
label && /* @__PURE__ */ jsx(FormLabel, {
|
|
14
|
+
required,
|
|
15
|
+
helpText,
|
|
16
|
+
children: label
|
|
17
|
+
}),
|
|
18
|
+
/* @__PURE__ */ jsx(FormControl, { children: type === "number" ? /* @__PURE__ */ jsx(Input, {
|
|
19
|
+
type,
|
|
20
|
+
value: value ?? "",
|
|
21
|
+
onChange: (e) => {
|
|
22
|
+
const next = e.currentTarget.valueAsNumber;
|
|
23
|
+
if (Number.isNaN(next)) setValue(null);
|
|
24
|
+
else setValue(next);
|
|
25
|
+
},
|
|
26
|
+
className: cn("text-sm", className),
|
|
27
|
+
...remain
|
|
28
|
+
}) : /* @__PURE__ */ jsx(Input, {
|
|
29
|
+
value: value ?? "",
|
|
30
|
+
type,
|
|
31
|
+
onChange: (e) => setValue(e.currentTarget.value),
|
|
32
|
+
className: cn("text-sm", className),
|
|
33
|
+
...remain
|
|
34
|
+
}) }),
|
|
35
|
+
description && /* @__PURE__ */ jsx(FormDescription, { children: description }),
|
|
36
|
+
/* @__PURE__ */ jsx(FormMessage, {})
|
|
37
|
+
]
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
//#endregion
|
|
42
|
+
export { TextInput };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {}
|
|
File without changes
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Accordion as Accordion$1 } from "../base/accordion.js";
|
|
2
|
+
import { ComponentProps, ReactNode } from "react";
|
|
3
|
+
//#region src/web/layout/accordion.d.ts
|
|
4
|
+
export type AccordionEntry = {
|
|
5
|
+
/** Radix の item の value に使う、変わらない ID。 */
|
|
6
|
+
value: string;
|
|
7
|
+
trigger: ReactNode;
|
|
8
|
+
content: ReactNode;
|
|
9
|
+
};
|
|
10
|
+
type RootProps = ComponentProps<typeof Accordion$1>;
|
|
11
|
+
/** Radix の single / multiple の判別共用体を保つための、分配する Omit。 */
|
|
12
|
+
type DistributedOmit<T, K extends keyof never> = T extends unknown ? Omit<T, K> : never;
|
|
13
|
+
export type AccordionProps = DistributedOmit<RootProps, "children"> & {
|
|
14
|
+
items: AccordionEntry[];
|
|
15
|
+
/** 各 item の外側に付ける追加のクラス。 */
|
|
16
|
+
itemClassName?: string;
|
|
17
|
+
triggerClassName?: string;
|
|
18
|
+
contentClassName?: string;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* shadcn のプリミティブを包んだ、データ駆動の Accordion。
|
|
22
|
+
* 呼び出し側が Item / Trigger / Content を自分で組まなくて済む。
|
|
23
|
+
*/
|
|
24
|
+
export declare function Accordion({ items, itemClassName, triggerClassName, contentClassName, className, ...rest }: AccordionProps): import("react").JSX.Element;
|
|
25
|
+
//#endregion
|
|
26
|
+
export {};
|