@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,24 @@
|
|
|
1
|
+
import { Dialog, DialogContent, DialogHeader, DialogTitle } from "../base/dialog.js";
|
|
2
|
+
import { ScrollArea } from "../base/scroll-area.js";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region src/web/layout/simple-dialog.tsx
|
|
6
|
+
function SimpleDialog({ open, onOpenChange, title, children }) {
|
|
7
|
+
return /* @__PURE__ */ jsx(Dialog, {
|
|
8
|
+
open,
|
|
9
|
+
onOpenChange,
|
|
10
|
+
children: /* @__PURE__ */ jsxs(DialogContent, {
|
|
11
|
+
className: "max-h-[calc(100dvh-2rem)] grid-rows-[auto_minmax(0,1fr)]",
|
|
12
|
+
children: [/* @__PURE__ */ jsx(DialogHeader, { children: /* @__PURE__ */ jsx(DialogTitle, { children: title }) }), /* @__PURE__ */ jsx(ScrollArea, {
|
|
13
|
+
className: "h-full",
|
|
14
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
15
|
+
className: "pr-3",
|
|
16
|
+
children
|
|
17
|
+
})
|
|
18
|
+
})]
|
|
19
|
+
})
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
export { SimpleDialog };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { TableRow } from "../base/table.js";
|
|
2
|
+
import React from "react";
|
|
3
|
+
//#region src/web/layout/simple-table.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* 宣言的な薄い罫線のデータテーブル。columns / data を渡すだけで使える。
|
|
6
|
+
* ヘッダは frame の淡い面、行罫線は 1px の極薄の線(base/table を踏襲)。
|
|
7
|
+
* 数値列は mono + tabular-nums + 右寄せにする。
|
|
8
|
+
*
|
|
9
|
+
* TanStack ベースの DataTable(ページネーション/選択つき・layout/table)とは別物で、
|
|
10
|
+
* ソートやページングが不要な短い表(ダッシュボードのサマリ等)向けの軽量版。
|
|
11
|
+
*/
|
|
12
|
+
export type SimpleColumn<T> = {
|
|
13
|
+
/** 列キー(行内で一意)。 */
|
|
14
|
+
key: string;
|
|
15
|
+
header: React.ReactNode;
|
|
16
|
+
/** セル / ヘッダの揃え(既定 left)。 */
|
|
17
|
+
align?: "left" | "right" | "center";
|
|
18
|
+
/** 等幅 + tabular-nums(数値・ID 向け)。 */
|
|
19
|
+
mono?: boolean;
|
|
20
|
+
/** 強調(font-medium)。 */
|
|
21
|
+
strong?: boolean;
|
|
22
|
+
/** セルの追加クラス。 */
|
|
23
|
+
cellClassName?: string;
|
|
24
|
+
/** ヘッダの追加クラス。 */
|
|
25
|
+
headClassName?: string;
|
|
26
|
+
/** セルの描画。未指定時は row[key] を表示する。 */
|
|
27
|
+
render?: (row: T) => React.ReactNode;
|
|
28
|
+
/**
|
|
29
|
+
* この幅(Tailwind のブレークポイント)より狭いときは列ごと隠す。狭い幅で重要でない列(ID・補足など)を畳んで、
|
|
30
|
+
* 横スクロールを避けるために使う。未指定なら常に出す。
|
|
31
|
+
*/
|
|
32
|
+
hideBelow?: "sm" | "md" | "lg";
|
|
33
|
+
};
|
|
34
|
+
export declare function SimpleTable<T extends object>({ columns, data, getRowKey, onRowClick, getRowProps, className, wrapperClassName }: {
|
|
35
|
+
columns: SimpleColumn<T>[];
|
|
36
|
+
data: T[];
|
|
37
|
+
/** 行キーの導出。未指定時は index を使う。 */
|
|
38
|
+
getRowKey?: (row: T, index: number) => string;
|
|
39
|
+
/**
|
|
40
|
+
* 行クリック(任意)。渡すと行にフォーカスでき(tabIndex=0)、Enter・Space でも押せる。
|
|
41
|
+
* 行の中のボタンやリンクのキー操作は奪わない(行そのものにフォーカスがあるときだけ反応する)。
|
|
42
|
+
*/
|
|
43
|
+
onRowClick?: (row: T) => void;
|
|
44
|
+
/** 行ごとの追加属性(data-* / className 等)。行全体クリックや e2e セレクタ付与に使う。 */
|
|
45
|
+
getRowProps?: (row: T, index: number) => Omit<React.ComponentPropsWithoutRef<typeof TableRow>, "key">;
|
|
46
|
+
className?: string;
|
|
47
|
+
wrapperClassName?: string;
|
|
48
|
+
}): React.JSX.Element;
|
|
49
|
+
//#endregion
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { cn } from "../lib/utils.js";
|
|
2
|
+
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "../base/table.js";
|
|
3
|
+
import { isValidElement } from "react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
|
|
6
|
+
//#region src/web/layout/simple-table.tsx
|
|
7
|
+
/** Tailwind はクラス名を静的に拾うので、文字列を組み立てず表にしておく。 */
|
|
8
|
+
const hideBelowClass = {
|
|
9
|
+
sm: "hidden sm:table-cell",
|
|
10
|
+
md: "hidden md:table-cell",
|
|
11
|
+
lg: "hidden lg:table-cell"
|
|
12
|
+
};
|
|
13
|
+
const alignClass = {
|
|
14
|
+
left: "text-left",
|
|
15
|
+
right: "text-right",
|
|
16
|
+
center: "text-center"
|
|
17
|
+
};
|
|
18
|
+
/** `render` が無い列の既定の描画。行の `key` の値が、文字・数値・要素のときだけ表示する。 */
|
|
19
|
+
function cellValue(row, key) {
|
|
20
|
+
const value = Reflect.get(row, key);
|
|
21
|
+
if (typeof value === "string" || typeof value === "number" || isValidElement(value)) return value;
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
function SimpleTable({ columns, data, getRowKey, onRowClick, getRowProps, className, wrapperClassName }) {
|
|
25
|
+
return /* @__PURE__ */ jsxs(Table, {
|
|
26
|
+
className,
|
|
27
|
+
wrapperClassName,
|
|
28
|
+
children: [/* @__PURE__ */ jsx(TableHeader, { children: /* @__PURE__ */ jsx(TableRow, { children: columns.map((col) => /* @__PURE__ */ jsx(TableHead, {
|
|
29
|
+
className: cn(col.hideBelow && hideBelowClass[col.hideBelow], col.align && alignClass[col.align], col.headClassName),
|
|
30
|
+
children: col.header
|
|
31
|
+
}, col.key)) }) }), /* @__PURE__ */ jsx(TableBody, { children: data.map((row, index) => {
|
|
32
|
+
const { onClick, onKeyDown, tabIndex, className: rowClassName, ...rest } = getRowProps?.(row, index) ?? {};
|
|
33
|
+
return /* @__PURE__ */ jsx(TableRow, {
|
|
34
|
+
...rest,
|
|
35
|
+
tabIndex: tabIndex ?? (onRowClick ? 0 : void 0),
|
|
36
|
+
onClick: (event) => {
|
|
37
|
+
onRowClick?.(row);
|
|
38
|
+
onClick?.(event);
|
|
39
|
+
},
|
|
40
|
+
onKeyDown: (event) => {
|
|
41
|
+
if (onRowClick && event.target === event.currentTarget && (event.key === "Enter" || event.key === " ")) {
|
|
42
|
+
event.preventDefault();
|
|
43
|
+
onRowClick(row);
|
|
44
|
+
}
|
|
45
|
+
onKeyDown?.(event);
|
|
46
|
+
},
|
|
47
|
+
className: cn(onRowClick && "focus-visible:outline-ring cursor-pointer focus-visible:outline-2 focus-visible:-outline-offset-2", rowClassName),
|
|
48
|
+
children: columns.map((col) => /* @__PURE__ */ jsx(TableCell, {
|
|
49
|
+
className: cn(col.hideBelow && hideBelowClass[col.hideBelow], col.align && alignClass[col.align], col.mono && "font-mono tabular-nums", col.strong && "text-foreground font-medium", col.cellClassName),
|
|
50
|
+
children: col.render ? col.render(row) : cellValue(row, col.key)
|
|
51
|
+
}, col.key))
|
|
52
|
+
}, getRowKey ? getRowKey(row, index) : index);
|
|
53
|
+
}) })]
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
//#endregion
|
|
58
|
+
export { SimpleTable };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
//#region src/web/layout/tabs.d.ts
|
|
3
|
+
export type TabType = {
|
|
4
|
+
[value: string]: {
|
|
5
|
+
name: string;
|
|
6
|
+
render?: () => React.ReactNode;
|
|
7
|
+
onSelect?: () => void;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
export type TabsProps = {
|
|
11
|
+
tabs: TabType;
|
|
12
|
+
full?: boolean;
|
|
13
|
+
defaultValue?: string;
|
|
14
|
+
/** 制御モード: 外部から値を管理する場合に指定 */
|
|
15
|
+
value?: string;
|
|
16
|
+
onValueChange?: (value: string) => void;
|
|
17
|
+
/** TabsList と同じ高さで横並びに配置する右側のスロット(ツールバー的に利用する) */
|
|
18
|
+
trailing?: React.ReactNode;
|
|
19
|
+
/**
|
|
20
|
+
* DEV-E2E: 各トリガーに `${testIdPrefix}-${value}` の data-testid を付与する。
|
|
21
|
+
* 省略時は data-testid を出力しない。
|
|
22
|
+
*/
|
|
23
|
+
testIdPrefix?: string;
|
|
24
|
+
};
|
|
25
|
+
export declare function Tabs(props: TabsProps): React.JSX.Element;
|
|
26
|
+
//#endregion
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { cn } from "../lib/utils.js";
|
|
2
|
+
import { Tabs as Tabs$1, TabsContent, TabsList, TabsTrigger } from "../base/tabs.js";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
|
|
6
|
+
//#region src/web/layout/tabs.tsx
|
|
7
|
+
function Tabs(props) {
|
|
8
|
+
const [internalValue, setInternalValue] = useState(props.defaultValue ?? Object.keys(props.tabs)[0] ?? "");
|
|
9
|
+
const tabValue = props.value ?? internalValue;
|
|
10
|
+
const setTabValue = (value) => {
|
|
11
|
+
props.onValueChange?.(value);
|
|
12
|
+
if (props.value === void 0) setInternalValue(value);
|
|
13
|
+
};
|
|
14
|
+
const hasContent = Object.values(props.tabs).some((tab) => tab.render);
|
|
15
|
+
return /* @__PURE__ */ jsxs(Tabs$1, {
|
|
16
|
+
value: tabValue,
|
|
17
|
+
onValueChange: (value) => {
|
|
18
|
+
props.tabs[value]?.onSelect?.();
|
|
19
|
+
setTabValue(value);
|
|
20
|
+
},
|
|
21
|
+
className: hasContent ? "gap-4" : void 0,
|
|
22
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
23
|
+
className: cn("flex items-center gap-2", props.trailing && "justify-between"),
|
|
24
|
+
children: [/* @__PURE__ */ jsx(TabsList, {
|
|
25
|
+
className: cn(props.full && "w-full"),
|
|
26
|
+
children: Object.keys(props.tabs).map((tab) => /* @__PURE__ */ jsx(TabsTrigger, {
|
|
27
|
+
value: tab,
|
|
28
|
+
className: "cursor-pointer",
|
|
29
|
+
...hasContent ? {} : { "aria-controls": void 0 },
|
|
30
|
+
"data-testid": props.testIdPrefix ? `${props.testIdPrefix}-${tab}` : void 0,
|
|
31
|
+
children: props.tabs[tab]?.name
|
|
32
|
+
}, tab))
|
|
33
|
+
}), props.trailing]
|
|
34
|
+
}), hasContent && /* @__PURE__ */ jsx(TabsContent, {
|
|
35
|
+
value: tabValue,
|
|
36
|
+
children: props.tabs[tabValue]?.render?.()
|
|
37
|
+
}, tabValue)]
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
//#endregion
|
|
42
|
+
export { Tabs };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as React$1 from "react";
|
|
2
|
+
//#region src/web/layout/titled-modal.d.ts
|
|
3
|
+
type TitledModalProps = {
|
|
4
|
+
open: boolean;
|
|
5
|
+
onOpenChange: (open: boolean) => void;
|
|
6
|
+
title: React$1.ReactNode;
|
|
7
|
+
/** 本文の先頭に置く説明。支援技術向けの description も兼ねる。 */
|
|
8
|
+
description?: React$1.ReactNode;
|
|
9
|
+
children?: React$1.ReactNode;
|
|
10
|
+
/** 右寄せで並べる操作。あると上に 1px の区切り線が入る。 */
|
|
11
|
+
footer?: React$1.ReactNode;
|
|
12
|
+
/** 閉じるボタンの読み上げ名。 */
|
|
13
|
+
closeLabel?: string;
|
|
14
|
+
/** × の中身(省略時は lucide の X)。 */
|
|
15
|
+
closeIcon?: React$1.ReactNode;
|
|
16
|
+
className?: string;
|
|
17
|
+
"data-testid"?: string;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* 見出しと × を持つ大きめのモーダル。
|
|
21
|
+
*
|
|
22
|
+
* overlay 面(枠もリングも無し・影だけ)・幅 560。見出し(16/24 semibold)と × の下に 1px の薄い区切り線、本文は p-5、
|
|
23
|
+
* フッターがあれば上に区切り線を引いて右寄せで操作を並べる。開閉状態は呼び出し側が持つ(制御専用)。
|
|
24
|
+
*
|
|
25
|
+
* 表示中は `data-modal-open` を持つので、浮いている常駐 UI を CSS で隠せる
|
|
26
|
+
* (`body:has([data-modal-open])`)。
|
|
27
|
+
*
|
|
28
|
+
* 開いたときの初期フォーカスは、キーボードで開いたときだけ最初の操作に置き、それ以外はモーダルの本体に置く
|
|
29
|
+
* (マウスで開いて最初のボタンに枠が出ないように。`useModalOpenAutoFocus`)。
|
|
30
|
+
*/
|
|
31
|
+
export declare function TitledModal({ open, onOpenChange, title, description, children, footer, closeLabel, closeIcon, className, "data-testid": testId }: TitledModalProps): React$1.JSX.Element;
|
|
32
|
+
//#endregion
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { CLOSE_LABEL } from "../lib/labels.js";
|
|
2
|
+
import { cn } from "../lib/utils.js";
|
|
3
|
+
import { Dialog, DialogClose, DialogContent, DialogDescription, DialogTitle } from "../base/dialog.js";
|
|
4
|
+
import { useModalOpenAutoFocus } from "../lib/modal-open-focus.js";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { XIcon } from "lucide-react";
|
|
7
|
+
|
|
8
|
+
//#region src/web/layout/titled-modal.tsx
|
|
9
|
+
/**
|
|
10
|
+
* 見出しと × を持つ大きめのモーダル。
|
|
11
|
+
*
|
|
12
|
+
* overlay 面(枠もリングも無し・影だけ)・幅 560。見出し(16/24 semibold)と × の下に 1px の薄い区切り線、本文は p-5、
|
|
13
|
+
* フッターがあれば上に区切り線を引いて右寄せで操作を並べる。開閉状態は呼び出し側が持つ(制御専用)。
|
|
14
|
+
*
|
|
15
|
+
* 表示中は `data-modal-open` を持つので、浮いている常駐 UI を CSS で隠せる
|
|
16
|
+
* (`body:has([data-modal-open])`)。
|
|
17
|
+
*
|
|
18
|
+
* 開いたときの初期フォーカスは、キーボードで開いたときだけ最初の操作に置き、それ以外はモーダルの本体に置く
|
|
19
|
+
* (マウスで開いて最初のボタンに枠が出ないように。`useModalOpenAutoFocus`)。
|
|
20
|
+
*/
|
|
21
|
+
function TitledModal({ open, onOpenChange, title, description, children, footer, closeLabel = CLOSE_LABEL, closeIcon, className, "data-testid": testId }) {
|
|
22
|
+
const { contentRef, onOpenAutoFocus } = useModalOpenAutoFocus();
|
|
23
|
+
return /* @__PURE__ */ jsx(Dialog, {
|
|
24
|
+
open,
|
|
25
|
+
onOpenChange,
|
|
26
|
+
children: /* @__PURE__ */ jsxs(DialogContent, {
|
|
27
|
+
ref: contentRef,
|
|
28
|
+
onOpenAutoFocus,
|
|
29
|
+
showCloseButton: false,
|
|
30
|
+
"data-modal-open": "",
|
|
31
|
+
"data-testid": testId,
|
|
32
|
+
className: cn("flex max-h-[calc(100vh-4rem)] w-[560px] outline-none max-w-[calc(100%-2rem)] flex-col gap-0 p-0 sm:max-w-[560px]", className),
|
|
33
|
+
children: [
|
|
34
|
+
/* @__PURE__ */ jsxs("header", {
|
|
35
|
+
className: "flex shrink-0 items-center justify-between gap-4 border-b border-border px-5 py-3.5",
|
|
36
|
+
children: [/* @__PURE__ */ jsx(DialogTitle, { children: title }), /* @__PURE__ */ jsx(DialogClose, {
|
|
37
|
+
"aria-label": closeLabel,
|
|
38
|
+
className: "text-muted-foreground hover:bg-accent hover:text-foreground grid size-7 shrink-0 cursor-pointer place-items-center rounded-control outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-popover [&_svg]:size-4",
|
|
39
|
+
children: closeIcon ?? /* @__PURE__ */ jsx(XIcon, {})
|
|
40
|
+
})]
|
|
41
|
+
}),
|
|
42
|
+
/* @__PURE__ */ jsxs("div", {
|
|
43
|
+
className: "min-h-0 flex-1 overflow-y-auto p-5",
|
|
44
|
+
children: [description && /* @__PURE__ */ jsx(DialogDescription, {
|
|
45
|
+
className: "mb-4",
|
|
46
|
+
children: description
|
|
47
|
+
}), children]
|
|
48
|
+
}),
|
|
49
|
+
footer && /* @__PURE__ */ jsx("footer", {
|
|
50
|
+
className: "flex shrink-0 items-center justify-end gap-2 border-t border-border px-5 py-3.5",
|
|
51
|
+
children: footer
|
|
52
|
+
})
|
|
53
|
+
]
|
|
54
|
+
})
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
//#endregion
|
|
59
|
+
export { TitledModal };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CSSProperties } from "react";
|
|
2
|
+
//#region src/web/lib/css-vars.d.ts
|
|
3
|
+
/** CSS カスタムプロパティ(`--foo`)だけを持つ style の部品。 */
|
|
4
|
+
export type CssVars = Record<`--${string}`, string | number>;
|
|
5
|
+
/**
|
|
6
|
+
* CSS カスタムプロパティを `style` に渡せる形にする。
|
|
7
|
+
*
|
|
8
|
+
* `CSSProperties` は `--foo` を知らないので、オブジェクトリテラルを直に渡すと tsc が
|
|
9
|
+
* 余剰プロパティとして落とす。`as CSSProperties` で黙らせると型の検査が消えるため、
|
|
10
|
+
* テンプレートリテラル型のキーで受けて `CSSProperties` として返す。
|
|
11
|
+
* `overrides` が後勝ち(呼び出し側から渡された `style` が既定の変数を上書きできる)。
|
|
12
|
+
*/
|
|
13
|
+
export declare function cssVars(vars: CssVars, overrides?: CSSProperties): CSSProperties;
|
|
14
|
+
//#endregion
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//#region src/web/lib/css-vars.ts
|
|
2
|
+
/**
|
|
3
|
+
* CSS カスタムプロパティを `style` に渡せる形にする。
|
|
4
|
+
*
|
|
5
|
+
* `CSSProperties` は `--foo` を知らないので、オブジェクトリテラルを直に渡すと tsc が
|
|
6
|
+
* 余剰プロパティとして落とす。`as CSSProperties` で黙らせると型の検査が消えるため、
|
|
7
|
+
* テンプレートリテラル型のキーで受けて `CSSProperties` として返す。
|
|
8
|
+
* `overrides` が後勝ち(呼び出し側から渡された `style` が既定の変数を上書きできる)。
|
|
9
|
+
*/
|
|
10
|
+
function cssVars(vars, overrides) {
|
|
11
|
+
return {
|
|
12
|
+
...vars,
|
|
13
|
+
...overrides
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
export { cssVars };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region src/web/lib/dialog.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* `Modal` / `Sheet` が開閉の状態を受け取る形(構造的な型)。
|
|
4
|
+
* `useState` で自前に作ってもよいし、アプリ側の未保存ガードつきの hook の戻り値をそのまま渡してもよい
|
|
5
|
+
* (love3 は i18n や form に依存しないので、hook そのものは持たない)。
|
|
6
|
+
*/
|
|
7
|
+
export type DialogController = {
|
|
8
|
+
isOpen: boolean;
|
|
9
|
+
close: () => void;
|
|
10
|
+
/** 外側のクリックで閉じてよいか決める。確認を挟みたいときはここで処理する(既定は `close` と同じ扱いにする) */
|
|
11
|
+
onOutsideClick: () => void;
|
|
12
|
+
};
|
|
13
|
+
//#endregion
|
|
File without changes
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { BaseInputProps, FieldInputProps, fieldContext, formContext, useFieldContext, useFieldValue, useFormContext, useOptionalFieldContext } from "../../shared/form.js";
|
|
2
|
+
export { type BaseInputProps, type FieldInputProps, fieldContext, formContext, useFieldContext, useFieldValue, useFormContext, useOptionalFieldContext };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
//#region src/web/lib/labels.d.ts
|
|
2
|
+
/** 閉じるボタン(Dialog・Sheet・TitledModal) */
|
|
3
|
+
export declare const CLOSE_LABEL = "閉じる";
|
|
4
|
+
/** ヘルプのトリガー(atom/help・base/form の FormLabel) */
|
|
5
|
+
export declare const HELP_LABEL = "ヘルプ";
|
|
6
|
+
/** 読み込み中の表示(Spinner) */
|
|
7
|
+
export declare const LOADING_LABEL = "読み込み中";
|
|
8
|
+
/** ページネーションの nav と、その中のボタン */
|
|
9
|
+
export declare const PAGINATION_LABEL = "ページネーション";
|
|
10
|
+
export declare const PREVIOUS_PAGE_LABEL = "前のページへ";
|
|
11
|
+
export declare const NEXT_PAGE_LABEL = "次のページへ";
|
|
12
|
+
/** 途中が省略されているページ番号 */
|
|
13
|
+
export declare const MORE_PAGES_LABEL = "他のページ";
|
|
14
|
+
/** パンくずリストの nav と、省略されている途中の階層 */
|
|
15
|
+
export declare const BREADCRUMB_LABEL = "パンくずリスト";
|
|
16
|
+
export declare const MORE_LEVELS_LABEL = "他の階層";
|
|
17
|
+
/** 折れ線の表の代替(読み上げ用に隠す表)の列名と、名前の既定 */
|
|
18
|
+
export declare const LINE_CHART_TABLE_SERIES_LABEL = "系列";
|
|
19
|
+
export declare const LINE_CHART_TABLE_POINT_LABEL = "見出し";
|
|
20
|
+
export declare const LINE_CHART_TABLE_VALUE_LABEL = "値";
|
|
21
|
+
export declare const LINE_CHART_DEFAULT_LABEL = "折れ線チャート";
|
|
22
|
+
export declare const LINE_CHART_SINGLE_SERIES_LABEL = "値";
|
|
23
|
+
export declare const LINE_CHART_EMPTY_TEXT = "データがありません";
|
|
24
|
+
/** 読み上げ用の表に添える注記(数でない点を除いたとき・点が多くて抜き出したとき) */
|
|
25
|
+
export declare const lineChartTableDropped: (count: number) => string;
|
|
26
|
+
export declare const lineChartTableThinned: (shown: number, total: number) => string;
|
|
27
|
+
//#endregion
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
//#region src/web/lib/labels.ts
|
|
2
|
+
/** 閉じるボタン(Dialog・Sheet・TitledModal) */
|
|
3
|
+
const CLOSE_LABEL = "閉じる";
|
|
4
|
+
/** ヘルプのトリガー(atom/help・base/form の FormLabel) */
|
|
5
|
+
const HELP_LABEL = "ヘルプ";
|
|
6
|
+
/** 読み込み中の表示(Spinner) */
|
|
7
|
+
const LOADING_LABEL = "読み込み中";
|
|
8
|
+
/** ページネーションの nav と、その中のボタン */
|
|
9
|
+
const PAGINATION_LABEL = "ページネーション";
|
|
10
|
+
const PREVIOUS_PAGE_LABEL = "前のページへ";
|
|
11
|
+
const NEXT_PAGE_LABEL = "次のページへ";
|
|
12
|
+
/** 途中が省略されているページ番号 */
|
|
13
|
+
const MORE_PAGES_LABEL = "他のページ";
|
|
14
|
+
/** パンくずリストの nav と、省略されている途中の階層 */
|
|
15
|
+
const BREADCRUMB_LABEL = "パンくずリスト";
|
|
16
|
+
const MORE_LEVELS_LABEL = "他の階層";
|
|
17
|
+
/** 折れ線の表の代替(読み上げ用に隠す表)の列名と、名前の既定 */
|
|
18
|
+
const LINE_CHART_TABLE_SERIES_LABEL = "系列";
|
|
19
|
+
const LINE_CHART_TABLE_POINT_LABEL = "見出し";
|
|
20
|
+
const LINE_CHART_TABLE_VALUE_LABEL = "値";
|
|
21
|
+
const LINE_CHART_DEFAULT_LABEL = "折れ線チャート";
|
|
22
|
+
const LINE_CHART_SINGLE_SERIES_LABEL = "値";
|
|
23
|
+
const LINE_CHART_EMPTY_TEXT = "データがありません";
|
|
24
|
+
/** 読み上げ用の表に添える注記(数でない点を除いたとき・点が多くて抜き出したとき) */
|
|
25
|
+
const lineChartTableDropped = (count) => `数でない値の点 ${count.toString()} 件は除いています。`;
|
|
26
|
+
const lineChartTableThinned = (shown, total) => `点が多いので、${total.toString()} 点のうち ${shown.toString()} 点を等間隔に抜き出しています。`;
|
|
27
|
+
|
|
28
|
+
//#endregion
|
|
29
|
+
export { BREADCRUMB_LABEL, CLOSE_LABEL, HELP_LABEL, LINE_CHART_DEFAULT_LABEL, LINE_CHART_EMPTY_TEXT, LINE_CHART_SINGLE_SERIES_LABEL, LINE_CHART_TABLE_POINT_LABEL, LINE_CHART_TABLE_SERIES_LABEL, LINE_CHART_TABLE_VALUE_LABEL, LOADING_LABEL, MORE_LEVELS_LABEL, MORE_PAGES_LABEL, NEXT_PAGE_LABEL, PAGINATION_LABEL, PREVIOUS_PAGE_LABEL, lineChartTableDropped, lineChartTableThinned };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region src/web/lib/modal-open-focus.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* モーダルを開いたときの初期フォーカスの置き先を、開いた手段で変える。
|
|
4
|
+
*
|
|
5
|
+
* - キーボードで開いた: Radix の既定どおり最初の操作(ボタン)に置く。フォーカスの枠も出る
|
|
6
|
+
* - ポインターで開いた / 操作なしで開いた(起動時に出るもの等): モーダルの本体に置く。
|
|
7
|
+
* 最初のボタンに枠が出ない(WebKit はスクリプトによるフォーカスにも `:focus-visible` を当てるため、
|
|
8
|
+
* ボタンに置くと枠が出てしまう)。フォーカスはモーダルの中にあるので、Tab で最初の操作へ進め、
|
|
9
|
+
* Esc で閉じられ、支援技術はダイアログとして読み上げる
|
|
10
|
+
*
|
|
11
|
+
* 返す `contentRef` と `onOpenAutoFocus` を DialogContent に渡す。本体には `outline-none` を付けること。
|
|
12
|
+
*/
|
|
13
|
+
export declare function useModalOpenAutoFocus(): {
|
|
14
|
+
contentRef: import("react").RefObject<HTMLDivElement | null>;
|
|
15
|
+
onOpenAutoFocus: (event: Event) => void;
|
|
16
|
+
};
|
|
17
|
+
//#endregion
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { useCallback, useRef } from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/web/lib/modal-open-focus.ts
|
|
4
|
+
let lastModality = "unknown";
|
|
5
|
+
let listening = false;
|
|
6
|
+
/**
|
|
7
|
+
* 直前の操作がキーボードかポインターかを覚える(document に 1 度だけ張る)。
|
|
8
|
+
* capture で拾うので、途中で stopPropagation されても取りこぼさない。
|
|
9
|
+
*/
|
|
10
|
+
function listenModality() {
|
|
11
|
+
if (listening || typeof document === "undefined") return;
|
|
12
|
+
listening = true;
|
|
13
|
+
document.addEventListener("keydown", (e) => {
|
|
14
|
+
if (e.metaKey || e.altKey || e.ctrlKey) return;
|
|
15
|
+
lastModality = "keyboard";
|
|
16
|
+
}, true);
|
|
17
|
+
document.addEventListener("pointerdown", () => lastModality = "pointer", true);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* モーダルを開いたときの初期フォーカスの置き先を、開いた手段で変える。
|
|
21
|
+
*
|
|
22
|
+
* - キーボードで開いた: Radix の既定どおり最初の操作(ボタン)に置く。フォーカスの枠も出る
|
|
23
|
+
* - ポインターで開いた / 操作なしで開いた(起動時に出るもの等): モーダルの本体に置く。
|
|
24
|
+
* 最初のボタンに枠が出ない(WebKit はスクリプトによるフォーカスにも `:focus-visible` を当てるため、
|
|
25
|
+
* ボタンに置くと枠が出てしまう)。フォーカスはモーダルの中にあるので、Tab で最初の操作へ進め、
|
|
26
|
+
* Esc で閉じられ、支援技術はダイアログとして読み上げる
|
|
27
|
+
*
|
|
28
|
+
* 返す `contentRef` と `onOpenAutoFocus` を DialogContent に渡す。本体には `outline-none` を付けること。
|
|
29
|
+
*/
|
|
30
|
+
function useModalOpenAutoFocus() {
|
|
31
|
+
listenModality();
|
|
32
|
+
const contentRef = useRef(null);
|
|
33
|
+
return {
|
|
34
|
+
contentRef,
|
|
35
|
+
onOpenAutoFocus: useCallback((event) => {
|
|
36
|
+
if (lastModality === "keyboard") return;
|
|
37
|
+
event.preventDefault();
|
|
38
|
+
contentRef.current?.focus({ preventScroll: true });
|
|
39
|
+
}, [])
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
//#endregion
|
|
44
|
+
export { useModalOpenAutoFocus };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/web/lib/restore-focus.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Radix の Dialog は、閉じたあとのフォーカスを `DialogTrigger` にしか戻さない。love3 の Modal・Sheet・AlertModal は `open` を状態で持つ
|
|
4
|
+
* (トリガーが無い)ので、そのままだとフォーカスが `body` に落ちる(キーボード・支援技術の利用者が、開いた場所を見失う)。
|
|
5
|
+
* 開いた時点でフォーカスのあった要素を覚えて、閉じたときにそこへ戻す。`DialogTrigger` で開いた場合など、覚えた要素が無いとき・
|
|
6
|
+
* 呼び出し側が `preventDefault` したときは、何もしない(Radix の既定の動きに任せる)。
|
|
7
|
+
*/
|
|
8
|
+
export declare function useRestoreFocus(onOpenAutoFocus: ((event: Event) => void) | undefined, onCloseAutoFocus: ((event: Event) => void) | undefined): {
|
|
9
|
+
onOpenAutoFocus: (event: Event) => void;
|
|
10
|
+
onCloseAutoFocus: (event: Event) => void;
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { useRef } from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/web/lib/restore-focus.ts
|
|
4
|
+
/**
|
|
5
|
+
* Radix の Dialog は、閉じたあとのフォーカスを `DialogTrigger` にしか戻さない。love3 の Modal・Sheet・AlertModal は `open` を状態で持つ
|
|
6
|
+
* (トリガーが無い)ので、そのままだとフォーカスが `body` に落ちる(キーボード・支援技術の利用者が、開いた場所を見失う)。
|
|
7
|
+
* 開いた時点でフォーカスのあった要素を覚えて、閉じたときにそこへ戻す。`DialogTrigger` で開いた場合など、覚えた要素が無いとき・
|
|
8
|
+
* 呼び出し側が `preventDefault` したときは、何もしない(Radix の既定の動きに任せる)。
|
|
9
|
+
*/
|
|
10
|
+
function useRestoreFocus(onOpenAutoFocus, onCloseAutoFocus) {
|
|
11
|
+
const previous = useRef(null);
|
|
12
|
+
return {
|
|
13
|
+
onOpenAutoFocus: (event) => {
|
|
14
|
+
const active = document.activeElement;
|
|
15
|
+
previous.current = active instanceof HTMLElement && active !== document.body ? active : null;
|
|
16
|
+
onOpenAutoFocus?.(event);
|
|
17
|
+
},
|
|
18
|
+
onCloseAutoFocus: (event) => {
|
|
19
|
+
onCloseAutoFocus?.(event);
|
|
20
|
+
if (event.defaultPrevented) return;
|
|
21
|
+
const target = previous.current;
|
|
22
|
+
previous.current = null;
|
|
23
|
+
if (target?.isConnected) {
|
|
24
|
+
event.preventDefault();
|
|
25
|
+
target.focus();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
32
|
+
export { useRestoreFocus };
|