@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,125 @@
|
|
|
1
|
+
import { cn } from "../lib/utils.js";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { CheckIcon, ChevronRightIcon, CircleIcon } from "lucide-react";
|
|
4
|
+
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
5
|
+
|
|
6
|
+
//#region src/web/base/dropdown-menu.tsx
|
|
7
|
+
function DropdownMenu({ ...props }) {
|
|
8
|
+
return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Root, {
|
|
9
|
+
"data-slot": "dropdown-menu",
|
|
10
|
+
...props
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
function DropdownMenuPortal({ ...props }) {
|
|
14
|
+
return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Portal, {
|
|
15
|
+
"data-slot": "dropdown-menu-portal",
|
|
16
|
+
...props
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
function DropdownMenuTrigger({ ...props }) {
|
|
20
|
+
return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Trigger, {
|
|
21
|
+
"data-slot": "dropdown-menu-trigger",
|
|
22
|
+
...props
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function DropdownMenuContent({ className, sideOffset = 4, portal = true, ...props }) {
|
|
26
|
+
const comp = /* @__PURE__ */ jsx(DropdownMenuPrimitive.Content, {
|
|
27
|
+
"data-slot": "dropdown-menu-content",
|
|
28
|
+
sideOffset,
|
|
29
|
+
className: cn("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-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 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-surface border border-border p-1 shadow-md", className),
|
|
30
|
+
...props
|
|
31
|
+
});
|
|
32
|
+
if (!portal) return comp;
|
|
33
|
+
return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Portal, { children: comp });
|
|
34
|
+
}
|
|
35
|
+
function DropdownMenuGroup({ ...props }) {
|
|
36
|
+
return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Group, {
|
|
37
|
+
"data-slot": "dropdown-menu-group",
|
|
38
|
+
...props
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
function DropdownMenuItem({ className, inset, variant = "default", ...props }) {
|
|
42
|
+
return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Item, {
|
|
43
|
+
"data-slot": "dropdown-menu-item",
|
|
44
|
+
"data-inset": inset,
|
|
45
|
+
"data-variant": variant,
|
|
46
|
+
className: cn("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-pointer items-center gap-2 rounded-control px-2 py-1.5 text-[13px] outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
47
|
+
...props
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
function DropdownMenuCheckboxItem({ className, children, checked, ...props }) {
|
|
51
|
+
return /* @__PURE__ */ jsxs(DropdownMenuPrimitive.CheckboxItem, {
|
|
52
|
+
"data-slot": "dropdown-menu-checkbox-item",
|
|
53
|
+
className: cn("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-control py-1.5 pr-2 pl-8 text-[13px] outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
54
|
+
checked,
|
|
55
|
+
...props,
|
|
56
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
57
|
+
className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",
|
|
58
|
+
children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, { className: "size-4" }) })
|
|
59
|
+
}), children]
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
function DropdownMenuRadioGroup({ ...props }) {
|
|
63
|
+
return /* @__PURE__ */ jsx(DropdownMenuPrimitive.RadioGroup, {
|
|
64
|
+
"data-slot": "dropdown-menu-radio-group",
|
|
65
|
+
...props
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
function DropdownMenuRadioItem({ className, children, ...props }) {
|
|
69
|
+
return /* @__PURE__ */ jsxs(DropdownMenuPrimitive.RadioItem, {
|
|
70
|
+
"data-slot": "dropdown-menu-radio-item",
|
|
71
|
+
className: cn("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-control py-1.5 pr-2 pl-8 text-[13px] outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
72
|
+
...props,
|
|
73
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
74
|
+
className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",
|
|
75
|
+
children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(CircleIcon, { className: "size-2 fill-current" }) })
|
|
76
|
+
}), children]
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
function DropdownMenuLabel({ className, inset, ...props }) {
|
|
80
|
+
return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Label, {
|
|
81
|
+
"data-slot": "dropdown-menu-label",
|
|
82
|
+
"data-inset": inset,
|
|
83
|
+
className: cn("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8", className),
|
|
84
|
+
...props
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
function DropdownMenuSeparator({ className, ...props }) {
|
|
88
|
+
return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Separator, {
|
|
89
|
+
"data-slot": "dropdown-menu-separator",
|
|
90
|
+
className: cn("bg-border -mx-1 my-1 h-px", className),
|
|
91
|
+
...props
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
function DropdownMenuShortcut({ className, ...props }) {
|
|
95
|
+
return /* @__PURE__ */ jsx("span", {
|
|
96
|
+
"data-slot": "dropdown-menu-shortcut",
|
|
97
|
+
className: cn("text-muted-foreground ml-auto text-xs tracking-widest", className),
|
|
98
|
+
...props
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
function DropdownMenuSub({ ...props }) {
|
|
102
|
+
return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Sub, {
|
|
103
|
+
"data-slot": "dropdown-menu-sub",
|
|
104
|
+
...props
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
function DropdownMenuSubTrigger({ className, inset, children, ...props }) {
|
|
108
|
+
return /* @__PURE__ */ jsxs(DropdownMenuPrimitive.SubTrigger, {
|
|
109
|
+
"data-slot": "dropdown-menu-sub-trigger",
|
|
110
|
+
"data-inset": inset,
|
|
111
|
+
className: cn("focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-control px-2 py-1.5 text-[13px] outline-hidden select-none data-[inset]:pl-8", className),
|
|
112
|
+
...props,
|
|
113
|
+
children: [children, /* @__PURE__ */ jsx(ChevronRightIcon, { className: "ml-auto size-4" })]
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
function DropdownMenuSubContent({ className, ...props }) {
|
|
117
|
+
return /* @__PURE__ */ jsx(DropdownMenuPrimitive.SubContent, {
|
|
118
|
+
"data-slot": "dropdown-menu-sub-content",
|
|
119
|
+
className: cn("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-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 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-surface border border-border p-1 shadow-md", className),
|
|
120
|
+
...props
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
//#endregion
|
|
125
|
+
export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Label } from "./label.js";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { VariantProps } from "class-variance-authority";
|
|
4
|
+
//#region src/web/base/field.d.ts
|
|
5
|
+
declare function FieldSet({ className, ...props }: React.ComponentProps<"fieldset">): React.JSX.Element;
|
|
6
|
+
declare function FieldLegend({ className, variant, ...props }: React.ComponentProps<"legend"> & {
|
|
7
|
+
variant?: "legend" | "label";
|
|
8
|
+
}): React.JSX.Element;
|
|
9
|
+
declare function FieldGroup({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
10
|
+
declare const fieldVariants: (props?: ({
|
|
11
|
+
orientation?: "horizontal" | "responsive" | "vertical" | null | undefined;
|
|
12
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
13
|
+
declare function Field({ className, orientation, ...props }: React.ComponentProps<"div"> & VariantProps<typeof fieldVariants>): React.JSX.Element;
|
|
14
|
+
declare function FieldContent({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
15
|
+
declare function FieldLabel({ className, ...props }: React.ComponentProps<typeof Label>): React.JSX.Element;
|
|
16
|
+
declare function FieldTitle({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
17
|
+
declare function FieldDescription({ className, ...props }: React.ComponentProps<"p">): React.JSX.Element;
|
|
18
|
+
declare function FieldSeparator({ children, className, ...props }: React.ComponentProps<"div"> & {
|
|
19
|
+
children?: React.ReactNode;
|
|
20
|
+
}): React.JSX.Element;
|
|
21
|
+
declare function FieldError({ className, children, errors, ...props }: React.ComponentProps<"div"> & {
|
|
22
|
+
errors?: Array<{
|
|
23
|
+
message?: string;
|
|
24
|
+
} | undefined>;
|
|
25
|
+
}): React.JSX.Element | null;
|
|
26
|
+
//#endregion
|
|
27
|
+
export { Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle };
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { cn } from "../lib/utils.js";
|
|
2
|
+
import { Label } from "./label.js";
|
|
3
|
+
import { Separator } from "./separator.js";
|
|
4
|
+
import { useMemo } from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { cva } from "class-variance-authority";
|
|
7
|
+
|
|
8
|
+
//#region src/web/base/field.tsx
|
|
9
|
+
function FieldSet({ className, ...props }) {
|
|
10
|
+
return /* @__PURE__ */ jsx("fieldset", {
|
|
11
|
+
"data-slot": "field-set",
|
|
12
|
+
className: cn("flex flex-col gap-6", "has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3", className),
|
|
13
|
+
...props
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
function FieldLegend({ className, variant = "legend", ...props }) {
|
|
17
|
+
return /* @__PURE__ */ jsx("legend", {
|
|
18
|
+
"data-slot": "field-legend",
|
|
19
|
+
"data-variant": variant,
|
|
20
|
+
className: cn("mb-3 font-medium", "data-[variant=legend]:text-base", "data-[variant=label]:text-sm", className),
|
|
21
|
+
...props
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
function FieldGroup({ className, ...props }) {
|
|
25
|
+
return /* @__PURE__ */ jsx("div", {
|
|
26
|
+
"data-slot": "field-group",
|
|
27
|
+
className: cn("group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 [&>[data-slot=field-group]]:gap-4", className),
|
|
28
|
+
...props
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
const fieldVariants = cva("group/field flex w-full gap-3 data-[invalid=true]:text-destructive", {
|
|
32
|
+
variants: { orientation: {
|
|
33
|
+
vertical: ["flex-col [&>*]:w-full [&>.sr-only]:w-auto"],
|
|
34
|
+
horizontal: [
|
|
35
|
+
"flex-row items-center",
|
|
36
|
+
"[&>[data-slot=field-label]]:flex-auto",
|
|
37
|
+
"has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"
|
|
38
|
+
],
|
|
39
|
+
responsive: [
|
|
40
|
+
"flex-col [&>*]:w-full [&>.sr-only]:w-auto @md/field-group:flex-row @md/field-group:items-center @md/field-group:[&>*]:w-auto",
|
|
41
|
+
"@md/field-group:[&>[data-slot=field-label]]:flex-auto",
|
|
42
|
+
"@md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"
|
|
43
|
+
]
|
|
44
|
+
} },
|
|
45
|
+
defaultVariants: { orientation: "vertical" }
|
|
46
|
+
});
|
|
47
|
+
function Field({ className, orientation = "vertical", ...props }) {
|
|
48
|
+
return /* @__PURE__ */ jsx("div", {
|
|
49
|
+
"data-slot": "field",
|
|
50
|
+
"data-orientation": orientation,
|
|
51
|
+
className: cn(fieldVariants({ orientation }), className),
|
|
52
|
+
...props
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
function FieldContent({ className, ...props }) {
|
|
56
|
+
return /* @__PURE__ */ jsx("div", {
|
|
57
|
+
"data-slot": "field-content",
|
|
58
|
+
className: cn("group/field-content flex flex-1 flex-col gap-1.5 leading-snug", className),
|
|
59
|
+
...props
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
function FieldLabel({ className, ...props }) {
|
|
63
|
+
return /* @__PURE__ */ jsx(Label, {
|
|
64
|
+
"data-slot": "field-label",
|
|
65
|
+
className: cn("group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50", "has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col has-[>[data-slot=field]]:rounded-control has-[>[data-slot=field]]:border [&>*]:data-[slot=field]:p-4", "has-data-[state=checked]:bg-action/5 has-data-[state=checked]:border-action dark:has-data-[state=checked]:bg-action/10", className),
|
|
66
|
+
...props
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
function FieldTitle({ className, ...props }) {
|
|
70
|
+
return /* @__PURE__ */ jsx("div", {
|
|
71
|
+
"data-slot": "field-label",
|
|
72
|
+
className: cn("flex w-fit items-center gap-2 text-sm leading-snug font-medium group-data-[disabled=true]/field:opacity-50", className),
|
|
73
|
+
...props
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
function FieldDescription({ className, ...props }) {
|
|
77
|
+
return /* @__PURE__ */ jsx("p", {
|
|
78
|
+
"data-slot": "field-description",
|
|
79
|
+
className: cn("text-muted-foreground text-sm leading-normal font-normal group-has-[[data-orientation=horizontal]]/field:text-balance", "last:mt-0 nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5", "[&>a:hover]:text-action-ink [&>a]:underline [&>a]:underline-offset-4", className),
|
|
80
|
+
...props
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
function FieldSeparator({ children, className, ...props }) {
|
|
84
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
85
|
+
"data-slot": "field-separator",
|
|
86
|
+
"data-content": !!children,
|
|
87
|
+
className: cn("relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2", className),
|
|
88
|
+
...props,
|
|
89
|
+
children: [/* @__PURE__ */ jsx(Separator, { className: "absolute inset-0 top-1/2" }), children && /* @__PURE__ */ jsx("span", {
|
|
90
|
+
className: "bg-background text-muted-foreground relative mx-auto block w-fit px-2",
|
|
91
|
+
"data-slot": "field-separator-content",
|
|
92
|
+
children
|
|
93
|
+
})]
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
function FieldError({ className, children, errors, ...props }) {
|
|
97
|
+
const content = useMemo(() => {
|
|
98
|
+
if (children) return children;
|
|
99
|
+
if (!errors?.length) return null;
|
|
100
|
+
const uniqueErrors = [...new Map(errors.map((error) => [error?.message, error])).values()];
|
|
101
|
+
if (uniqueErrors?.length === 1) return uniqueErrors[0]?.message;
|
|
102
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
103
|
+
className: "ml-4 flex list-disc flex-col gap-1",
|
|
104
|
+
children: uniqueErrors.map((error, index) => error?.message && /* @__PURE__ */ jsx("li", { children: error.message }, index.toString()))
|
|
105
|
+
});
|
|
106
|
+
}, [children, errors]);
|
|
107
|
+
if (!content) return null;
|
|
108
|
+
return /* @__PURE__ */ jsx("div", {
|
|
109
|
+
role: "alert",
|
|
110
|
+
"data-slot": "field-error",
|
|
111
|
+
className: cn("text-destructive text-sm font-normal", className),
|
|
112
|
+
...props,
|
|
113
|
+
children: content
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
//#endregion
|
|
118
|
+
export { Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as React$1 from "react";
|
|
2
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
3
|
+
import * as LabelPrimitive from "@radix-ui/react-label";
|
|
4
|
+
//#region src/web/base/form.d.ts
|
|
5
|
+
declare const useFormField: () => {
|
|
6
|
+
id: string;
|
|
7
|
+
formItemId: string;
|
|
8
|
+
formLabelId: string;
|
|
9
|
+
formDescriptionId: string;
|
|
10
|
+
formMessageId: string;
|
|
11
|
+
errors: readonly unknown[];
|
|
12
|
+
};
|
|
13
|
+
declare function FormItem({ className, errors, ...props }: React$1.ComponentProps<"div"> & {
|
|
14
|
+
/**
|
|
15
|
+
* フィールド(TanStack Form)の外で使うときのエラー。入力欄の `aria-invalid` と `aria-describedby`、
|
|
16
|
+
* ラベルの `data-error`、`FormMessage` の表示に使う。フィールドの中では不要(field のエラーを読む)。
|
|
17
|
+
*/
|
|
18
|
+
errors?: readonly unknown[];
|
|
19
|
+
}): React$1.JSX.Element;
|
|
20
|
+
declare function FormLabel({ required, helpText, helpLabel, className, ...props }: {
|
|
21
|
+
required?: boolean;
|
|
22
|
+
helpText?: React$1.ReactNode;
|
|
23
|
+
/** ヘルプのトリガーの読み上げ名 */
|
|
24
|
+
helpLabel?: string;
|
|
25
|
+
} & React$1.ComponentProps<typeof LabelPrimitive.Root>): React$1.JSX.Element;
|
|
26
|
+
/**
|
|
27
|
+
* 入力欄に id・aria-describedby・aria-invalid を渡す。
|
|
28
|
+
* 既定の id はラベルの `htmlFor` が指す `formItemId`。**1 つの field に control が複数あるとき**(radio の選択肢など)は、
|
|
29
|
+
* 同じ id が重なるので、2 つ目以降は `id` を渡して分ける(aria-describedby と aria-invalid は、どの control にも付く)。
|
|
30
|
+
*/
|
|
31
|
+
declare function FormControl({ className: _className, id, ...props }: React$1.ComponentProps<typeof Slot>): React$1.JSX.Element;
|
|
32
|
+
declare function FormDescription({ className, ...props }: React$1.ComponentProps<"p">): React$1.JSX.Element;
|
|
33
|
+
declare function FormMessage({ className, errors: overriddenErrors, ...props }: React$1.ComponentProps<"p"> & {
|
|
34
|
+
/** このメッセージだけに出すエラー。入力欄の aria-invalid には効かない(それは FormItem の errors) */
|
|
35
|
+
errors?: readonly unknown[];
|
|
36
|
+
}): React$1.JSX.Element | null;
|
|
37
|
+
//#endregion
|
|
38
|
+
export { FormControl, FormDescription, FormItem, FormLabel, FormMessage, useFormField };
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { useOptionalFieldContext } from "../../shared/form.js";
|
|
2
|
+
import { HELP_LABEL } from "../lib/labels.js";
|
|
3
|
+
import { cn } from "../lib/utils.js";
|
|
4
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from "./tooltip.js";
|
|
5
|
+
import { Field, FieldDescription, FieldError, FieldLabel } from "./field.js";
|
|
6
|
+
import * as React$1 from "react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { CircleQuestionMark } from "lucide-react";
|
|
9
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
10
|
+
|
|
11
|
+
//#region src/web/base/form.tsx
|
|
12
|
+
const useFormField = () => {
|
|
13
|
+
const itemContext = React$1.useContext(FormItemContext);
|
|
14
|
+
const field = useOptionalFieldContext();
|
|
15
|
+
const errors = itemContext.errors ?? field?.state.meta.errors ?? [];
|
|
16
|
+
const { id } = itemContext;
|
|
17
|
+
return {
|
|
18
|
+
id,
|
|
19
|
+
formItemId: `${id}-form-item`,
|
|
20
|
+
formLabelId: `${id}-form-item-label`,
|
|
21
|
+
formDescriptionId: `${id}-form-item-description`,
|
|
22
|
+
formMessageId: `${id}-form-item-message`,
|
|
23
|
+
errors
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
const FormItemContext = React$1.createContext({ id: "" });
|
|
27
|
+
function FormItem({ className, errors, ...props }) {
|
|
28
|
+
const id = React$1.useId();
|
|
29
|
+
const isValidating = useOptionalFieldContext()?.state.meta.isValidating ?? false;
|
|
30
|
+
return /* @__PURE__ */ jsx(FormItemContext.Provider, {
|
|
31
|
+
value: {
|
|
32
|
+
id,
|
|
33
|
+
errors
|
|
34
|
+
},
|
|
35
|
+
children: /* @__PURE__ */ jsx(Field, {
|
|
36
|
+
"data-slot": "form-item",
|
|
37
|
+
className: cn("gap-2", isValidating && "animate-pulse pointer-events-none", className),
|
|
38
|
+
orientation: "responsive",
|
|
39
|
+
...props
|
|
40
|
+
})
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
function FormLabel({ required, helpText, helpLabel = HELP_LABEL, className, ...props }) {
|
|
44
|
+
const { errors, formItemId, formLabelId } = useFormField();
|
|
45
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
46
|
+
className: "flex items-center gap-2",
|
|
47
|
+
children: [
|
|
48
|
+
/* @__PURE__ */ jsx(FieldLabel, {
|
|
49
|
+
id: formLabelId,
|
|
50
|
+
"data-slot": "form-label",
|
|
51
|
+
"data-error": errors.length > 0,
|
|
52
|
+
className: cn("font-semibold text-xs opacity-80 data-[error=true]:text-destructive data-[error=true]:opacity-100", className),
|
|
53
|
+
htmlFor: formItemId,
|
|
54
|
+
...props
|
|
55
|
+
}),
|
|
56
|
+
required && /* @__PURE__ */ jsx("p", {
|
|
57
|
+
"data-slot": "form-required",
|
|
58
|
+
className: "text-state-error text-sm",
|
|
59
|
+
children: "*"
|
|
60
|
+
}),
|
|
61
|
+
helpText && /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
|
|
62
|
+
"aria-label": helpLabel,
|
|
63
|
+
children: /* @__PURE__ */ jsx(CircleQuestionMark, {
|
|
64
|
+
className: "h-4 w-4",
|
|
65
|
+
"aria-hidden": true
|
|
66
|
+
})
|
|
67
|
+
}), /* @__PURE__ */ jsx(TooltipContent, { children: helpText })] })
|
|
68
|
+
]
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* 入力欄に id・aria-describedby・aria-invalid を渡す。
|
|
73
|
+
* 既定の id はラベルの `htmlFor` が指す `formItemId`。**1 つの field に control が複数あるとき**(radio の選択肢など)は、
|
|
74
|
+
* 同じ id が重なるので、2 つ目以降は `id` を渡して分ける(aria-describedby と aria-invalid は、どの control にも付く)。
|
|
75
|
+
*/
|
|
76
|
+
function FormControl({ className: _className, id, ...props }) {
|
|
77
|
+
const { errors, formItemId, formDescriptionId, formMessageId } = useFormField();
|
|
78
|
+
return /* @__PURE__ */ jsx(Slot, {
|
|
79
|
+
"data-slot": "form-control",
|
|
80
|
+
id: id ?? formItemId,
|
|
81
|
+
"aria-describedby": errors.length === 0 ? formDescriptionId : `${formDescriptionId} ${formMessageId}`,
|
|
82
|
+
"aria-invalid": errors.length > 0,
|
|
83
|
+
...props
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
function FormDescription({ className, ...props }) {
|
|
87
|
+
const { formDescriptionId } = useFormField();
|
|
88
|
+
return /* @__PURE__ */ jsx(FieldDescription, {
|
|
89
|
+
"data-slot": "form-description",
|
|
90
|
+
id: formDescriptionId,
|
|
91
|
+
className: cn("text-muted-foreground text-sm whitespace-pre-wrap", className),
|
|
92
|
+
...props
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
function FormMessage({ className, errors: overriddenErrors, ...props }) {
|
|
96
|
+
const { errors, formMessageId } = useFormField();
|
|
97
|
+
const list = overriddenErrors ?? errors;
|
|
98
|
+
const body = list.length > 0 ? list.join("\n") : null;
|
|
99
|
+
if (!body) return null;
|
|
100
|
+
return /* @__PURE__ */ jsx(FieldError, {
|
|
101
|
+
"data-slot": "form-message",
|
|
102
|
+
id: formMessageId,
|
|
103
|
+
className: cn("text-destructive text-sm pb-3 whitespace-pre-wrap", className),
|
|
104
|
+
...props,
|
|
105
|
+
children: body
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
//#endregion
|
|
110
|
+
export { FormControl, FormDescription, FormItem, FormLabel, FormMessage, useFormField };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
import { VariantProps } from "class-variance-authority";
|
|
3
|
+
//#region src/web/base/input.d.ts
|
|
4
|
+
declare const inputVariants: (props?: ({
|
|
5
|
+
variant?: "<3" | "default" | null | undefined;
|
|
6
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
|
+
declare function Input({ className, type, variant, ...props }: ComponentProps<"input"> & VariantProps<typeof inputVariants>): import("react").JSX.Element;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { Input, inputVariants };
|
|
@@ -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/input.tsx
|
|
6
|
+
const inputVariants = cva("file:text-foreground placeholder:text-muted-foreground selection:bg-action selection:text-action-foreground flex transition-[border-color,box-shadow] w-full min-w-0 outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive", {
|
|
7
|
+
variants: { variant: {
|
|
8
|
+
default: "border-input h-8 rounded-control border bg-card px-2.5 py-1 text-base focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/25 aria-invalid:focus-visible:ring-destructive/25 md:text-[13px]",
|
|
9
|
+
"<3": "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
|
+
} },
|
|
11
|
+
defaultVariants: { variant: "default" }
|
|
12
|
+
});
|
|
13
|
+
function Input({ className, type, variant, ...props }) {
|
|
14
|
+
return /* @__PURE__ */ jsx("input", {
|
|
15
|
+
type,
|
|
16
|
+
"data-slot": "input",
|
|
17
|
+
className: cn(inputVariants({ variant }), className),
|
|
18
|
+
...props
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
export { Input, inputVariants };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as React$1 from "react";
|
|
2
|
+
import * as LabelPrimitive from "@radix-ui/react-label";
|
|
3
|
+
//#region src/web/base/label.d.ts
|
|
4
|
+
declare function Label({ className, ...props }: React$1.ComponentProps<typeof LabelPrimitive.Root>): React$1.JSX.Element;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { Label };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { cn } from "../lib/utils.js";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as LabelPrimitive from "@radix-ui/react-label";
|
|
4
|
+
|
|
5
|
+
//#region src/web/base/label.tsx
|
|
6
|
+
function Label({ className, ...props }) {
|
|
7
|
+
return /* @__PURE__ */ jsx(LabelPrimitive.Root, {
|
|
8
|
+
"data-slot": "label",
|
|
9
|
+
className: cn("flex items-center gap-2 text-[13px] leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50", className),
|
|
10
|
+
...props
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
export { Label };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Button } from "./button.js";
|
|
2
|
+
import * as React$1 from "react";
|
|
3
|
+
//#region src/web/base/pagination.d.ts
|
|
4
|
+
declare function Pagination({ className, ...props }: React$1.ComponentProps<"nav">): React$1.JSX.Element;
|
|
5
|
+
declare function PaginationContent({ className, ...props }: React$1.ComponentProps<"ul">): React$1.JSX.Element;
|
|
6
|
+
declare function PaginationItem({ ...props }: React$1.ComponentProps<"li">): React$1.JSX.Element;
|
|
7
|
+
type PaginationLinkCommonProps = {
|
|
8
|
+
isActive?: boolean;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
} & Pick<React$1.ComponentProps<typeof Button>, "size">;
|
|
11
|
+
/**
|
|
12
|
+
* `href` があればリンク(`<a>`)、**無ければボタン(`<button type="button">`)**。クライアントの状態でページを替える画面では
|
|
13
|
+
* href を持たないので、`<a>` のままだとフォーカスもキーボードの操作もできない(href の無い `<a>` はリンクではない)。
|
|
14
|
+
*/
|
|
15
|
+
type PaginationLinkProps = PaginationLinkCommonProps & (({
|
|
16
|
+
href: string;
|
|
17
|
+
} & Omit<React$1.ComponentProps<"a">, "href">) | ({
|
|
18
|
+
href?: undefined;
|
|
19
|
+
} & Omit<React$1.ComponentProps<"button">, "type">));
|
|
20
|
+
declare function PaginationLink(props: PaginationLinkProps): React$1.JSX.Element;
|
|
21
|
+
declare function PaginationPrevious({ className, previousLabel, ...props }: React$1.ComponentProps<typeof PaginationLink> & {
|
|
22
|
+
/** 読み上げ名(アイコンだけの表示なので、名前はここで付ける) */
|
|
23
|
+
previousLabel?: string;
|
|
24
|
+
}): React$1.JSX.Element;
|
|
25
|
+
declare function PaginationNext({ className, nextLabel, ...props }: React$1.ComponentProps<typeof PaginationLink> & {
|
|
26
|
+
/** 読み上げ名(アイコンだけの表示なので、名前はここで付ける) */
|
|
27
|
+
nextLabel?: string;
|
|
28
|
+
}): React$1.JSX.Element;
|
|
29
|
+
declare function PaginationEllipsis({ className, moreLabel, ...props }: React$1.ComponentProps<"span"> & {
|
|
30
|
+
/** 省略されたページの読み上げ名 */
|
|
31
|
+
moreLabel?: string;
|
|
32
|
+
}): React$1.JSX.Element;
|
|
33
|
+
//#endregion
|
|
34
|
+
export { Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious };
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { MORE_PAGES_LABEL, NEXT_PAGE_LABEL, PAGINATION_LABEL, PREVIOUS_PAGE_LABEL } from "../lib/labels.js";
|
|
2
|
+
import { cn } from "../lib/utils.js";
|
|
3
|
+
import { buttonVariants } from "./button.js";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { ChevronLeftIcon, ChevronRightIcon, MoreHorizontalIcon } from "lucide-react";
|
|
6
|
+
|
|
7
|
+
//#region src/web/base/pagination.tsx
|
|
8
|
+
function Pagination({ className, ...props }) {
|
|
9
|
+
return /* @__PURE__ */ jsx("nav", {
|
|
10
|
+
"aria-label": PAGINATION_LABEL,
|
|
11
|
+
"data-slot": "pagination",
|
|
12
|
+
className: cn("mx-auto flex w-full justify-center", className),
|
|
13
|
+
...props
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
function PaginationContent({ className, ...props }) {
|
|
17
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
18
|
+
"data-slot": "pagination-content",
|
|
19
|
+
className: cn("flex flex-row items-center gap-1", className),
|
|
20
|
+
...props
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
function PaginationItem({ ...props }) {
|
|
24
|
+
return /* @__PURE__ */ jsx("li", {
|
|
25
|
+
"data-slot": "pagination-item",
|
|
26
|
+
className: "select-none",
|
|
27
|
+
...props
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
function PaginationLink(props) {
|
|
31
|
+
const { isActive, disabled, size = "icon" } = props;
|
|
32
|
+
const className = cn(buttonVariants({
|
|
33
|
+
variant: isActive ? "outline" : "ghost",
|
|
34
|
+
size
|
|
35
|
+
}), disabled && "cursor-none opacity-50 pointer-events-none", props.className);
|
|
36
|
+
const common = {
|
|
37
|
+
"aria-current": isActive ? "page" : void 0,
|
|
38
|
+
"data-slot": "pagination-link",
|
|
39
|
+
"data-active": isActive
|
|
40
|
+
};
|
|
41
|
+
if (props.href !== void 0) {
|
|
42
|
+
const { isActive: _a, disabled: _d, size: _s, className: _c, ...anchor } = props;
|
|
43
|
+
return /* @__PURE__ */ jsx("a", {
|
|
44
|
+
...common,
|
|
45
|
+
...anchor,
|
|
46
|
+
className
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
const { isActive: _a, disabled: _d, size: _s, className: _c, href: _h, ...button } = props;
|
|
50
|
+
return /* @__PURE__ */ jsx("button", {
|
|
51
|
+
type: "button",
|
|
52
|
+
...common,
|
|
53
|
+
...button,
|
|
54
|
+
disabled,
|
|
55
|
+
className
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
function PaginationPrevious({ className, previousLabel = PREVIOUS_PAGE_LABEL, ...props }) {
|
|
59
|
+
return /* @__PURE__ */ jsx(PaginationLink, {
|
|
60
|
+
"aria-label": previousLabel,
|
|
61
|
+
size: "default",
|
|
62
|
+
className: cn("gap-1 px-2.5 sm:pl-2.5", className),
|
|
63
|
+
...props,
|
|
64
|
+
children: /* @__PURE__ */ jsx(ChevronLeftIcon, {})
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
function PaginationNext({ className, nextLabel = NEXT_PAGE_LABEL, ...props }) {
|
|
68
|
+
return /* @__PURE__ */ jsx(PaginationLink, {
|
|
69
|
+
"aria-label": nextLabel,
|
|
70
|
+
size: "default",
|
|
71
|
+
className: cn("gap-1 px-2.5 sm:pr-2.5", className),
|
|
72
|
+
...props,
|
|
73
|
+
children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
function PaginationEllipsis({ className, moreLabel = MORE_PAGES_LABEL, ...props }) {
|
|
77
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
78
|
+
"aria-hidden": true,
|
|
79
|
+
"data-slot": "pagination-ellipsis",
|
|
80
|
+
className: cn("flex size-9 items-center justify-center", className),
|
|
81
|
+
...props,
|
|
82
|
+
children: [/* @__PURE__ */ jsx(MoreHorizontalIcon, { className: "size-4" }), /* @__PURE__ */ jsx("span", {
|
|
83
|
+
className: "sr-only",
|
|
84
|
+
children: moreLabel
|
|
85
|
+
})]
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
//#endregion
|
|
90
|
+
export { Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React$1 from "react";
|
|
2
|
+
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
3
|
+
//#region src/web/base/popover.d.ts
|
|
4
|
+
declare function Popover({ ...props }: React$1.ComponentProps<typeof PopoverPrimitive.Root>): React$1.JSX.Element;
|
|
5
|
+
declare function PopoverTrigger({ ...props }: React$1.ComponentProps<typeof PopoverPrimitive.Trigger>): React$1.JSX.Element;
|
|
6
|
+
declare function PopoverContent({ className, align, sideOffset, portal, ...props }: React$1.ComponentProps<typeof PopoverPrimitive.Content> & {
|
|
7
|
+
portal?: boolean;
|
|
8
|
+
}): React$1.JSX.Element;
|
|
9
|
+
declare function PopoverAnchor({ ...props }: React$1.ComponentProps<typeof PopoverPrimitive.Anchor>): React$1.JSX.Element;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { Popover, PopoverAnchor, PopoverContent, PopoverTrigger };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { cn } from "../lib/utils.js";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
4
|
+
|
|
5
|
+
//#region src/web/base/popover.tsx
|
|
6
|
+
function Popover({ ...props }) {
|
|
7
|
+
return /* @__PURE__ */ jsx(PopoverPrimitive.Root, {
|
|
8
|
+
"data-slot": "popover",
|
|
9
|
+
...props
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
function PopoverTrigger({ ...props }) {
|
|
13
|
+
return /* @__PURE__ */ jsx(PopoverPrimitive.Trigger, {
|
|
14
|
+
"data-slot": "popover-trigger",
|
|
15
|
+
...props
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
function PopoverContent({ className, align = "center", sideOffset = 4, portal = true, ...props }) {
|
|
19
|
+
const comp = /* @__PURE__ */ jsx(PopoverPrimitive.Content, {
|
|
20
|
+
"data-slot": "popover-content",
|
|
21
|
+
align,
|
|
22
|
+
sideOffset,
|
|
23
|
+
className: cn("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-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-72 origin-(--radix-popover-content-transform-origin) rounded-surface border border-border p-4 shadow-md outline-hidden", className),
|
|
24
|
+
...props
|
|
25
|
+
});
|
|
26
|
+
if (!portal) return comp;
|
|
27
|
+
return /* @__PURE__ */ jsx(PopoverPrimitive.Portal, { children: comp });
|
|
28
|
+
}
|
|
29
|
+
function PopoverAnchor({ ...props }) {
|
|
30
|
+
return /* @__PURE__ */ jsx(PopoverPrimitive.Anchor, {
|
|
31
|
+
"data-slot": "popover-anchor",
|
|
32
|
+
...props
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
//#endregion
|
|
37
|
+
export { Popover, PopoverAnchor, PopoverContent, PopoverTrigger };
|