@lt-three/love3 0.0.0-stage → 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/LICENSE +21 -0
- package/README.md +86 -2
- 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 +205 -4
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { useFieldValue } from "../../shared/form.js";
|
|
2
|
+
import { NUMBER_INVALID_LABEL } from "../lib/labels.js";
|
|
3
|
+
import { TextField } from "../atom/text-field.js";
|
|
4
|
+
import { FormControl, FormDescription, FormItem, FormLabel, FormMessage } from "../base/form.js";
|
|
5
|
+
import { useState } from "react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
|
|
8
|
+
//#region src/native/form/text-input.tsx
|
|
9
|
+
const DECIMAL = /^[+-]?(?:\d+\.?\d*|\.\d+)$/;
|
|
10
|
+
/**
|
|
11
|
+
* 数値欄の入力中の文字を読む。
|
|
12
|
+
* - 前後の空白は無視し、空(`" "` を含む)は「値なし」(null)
|
|
13
|
+
* - 全角の数字・記号は半角にそろえる(`12.5` → `12.5`)。`,` は小数点として受ける(`1,5` → 1.5。ロケール)。
|
|
14
|
+
* 千の区切り(`1,000`)は区別できない(1 として読む)。桁の区切りは入れない前提
|
|
15
|
+
* - 読めない文字(`abc`・`-`・`0x10`・`Infinity`・桁あふれ)は `ok: false`
|
|
16
|
+
*/
|
|
17
|
+
function parseNumber(text) {
|
|
18
|
+
const normalized = text.normalize("NFKC").replaceAll("−", "-").replace(",", ".").trim();
|
|
19
|
+
if (normalized === "") return {
|
|
20
|
+
ok: true,
|
|
21
|
+
value: null
|
|
22
|
+
};
|
|
23
|
+
if (!DECIMAL.test(normalized)) return { ok: false };
|
|
24
|
+
const parsed = Number(normalized);
|
|
25
|
+
return Number.isFinite(parsed) ? {
|
|
26
|
+
ok: true,
|
|
27
|
+
value: parsed
|
|
28
|
+
} : { ok: false };
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* TanStack Form 統合のテキスト入力。web の `form/text-input` に対応する。
|
|
32
|
+
* 値は field context から取り、`debounce` の扱いも共通の `useFieldValue` に委ねる。
|
|
33
|
+
* 入力枠そのものは `atom/text-field`(web の `base/input` に相当)を使う。
|
|
34
|
+
*/
|
|
35
|
+
function TextInput({ label, required, description, helpText, placeholder, disabled, debounce, className, wrapperClassName, type = "text", autoComplete, autoCapitalize, multiline, "data-testid": testID }) {
|
|
36
|
+
const [value, setValue, field] = useFieldValue({ debounce });
|
|
37
|
+
const [draft, setDraft] = useState(null);
|
|
38
|
+
const parsed = draft === null ? null : parseNumber(draft);
|
|
39
|
+
const draftValue = parsed === null ? void 0 : parsed.ok ? parsed.value : null;
|
|
40
|
+
const touched = field.state.meta.isTouched;
|
|
41
|
+
const [wasTouched, setWasTouched] = useState(touched);
|
|
42
|
+
if (touched !== wasTouched) {
|
|
43
|
+
setWasTouched(touched);
|
|
44
|
+
if (!touched && draft !== null) setDraft(null);
|
|
45
|
+
}
|
|
46
|
+
const draftActive = draft !== null && draftValue === (value ?? null);
|
|
47
|
+
if (draft !== null && !draftActive) setDraft(null);
|
|
48
|
+
const numberUnreadable = type === "number" && draftActive && parsed !== null && !parsed.ok;
|
|
49
|
+
const shown = type === "number" && draftActive ? draft : value === null || value === void 0 ? "" : String(value);
|
|
50
|
+
return /* @__PURE__ */ jsxs(FormItem, {
|
|
51
|
+
className: wrapperClassName,
|
|
52
|
+
errors: numberUnreadable ? [NUMBER_INVALID_LABEL] : void 0,
|
|
53
|
+
children: [
|
|
54
|
+
label ? /* @__PURE__ */ jsx(FormLabel, {
|
|
55
|
+
required,
|
|
56
|
+
helpText,
|
|
57
|
+
children: label
|
|
58
|
+
}) : null,
|
|
59
|
+
/* @__PURE__ */ jsx(FormControl, {
|
|
60
|
+
labelled: Boolean(label),
|
|
61
|
+
described: Boolean(description),
|
|
62
|
+
children: (control) => /* @__PURE__ */ jsx(TextField, {
|
|
63
|
+
...control,
|
|
64
|
+
accessibilityLabel: typeof label === "string" ? label : void 0,
|
|
65
|
+
accessibilityHint: description,
|
|
66
|
+
value: shown,
|
|
67
|
+
onChangeText: (text) => {
|
|
68
|
+
if (type !== "number") return setValue(text);
|
|
69
|
+
setDraft(text);
|
|
70
|
+
const next = parseNumber(text);
|
|
71
|
+
setValue(next.ok ? next.value : null);
|
|
72
|
+
},
|
|
73
|
+
placeholder,
|
|
74
|
+
type,
|
|
75
|
+
disabled,
|
|
76
|
+
autoComplete,
|
|
77
|
+
autoCapitalize,
|
|
78
|
+
multiline,
|
|
79
|
+
testID,
|
|
80
|
+
className
|
|
81
|
+
})
|
|
82
|
+
}),
|
|
83
|
+
description ? /* @__PURE__ */ jsx(FormDescription, { children: description }) : null,
|
|
84
|
+
/* @__PURE__ */ jsx(FormMessage, {})
|
|
85
|
+
]
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
//#endregion
|
|
90
|
+
export { TextInput };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {}
|
|
File without changes
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
//#region src/native/layout/accordion.d.ts
|
|
3
|
+
export type AccordionEntry = {
|
|
4
|
+
/** 項目の識別子。 */
|
|
5
|
+
value: string;
|
|
6
|
+
trigger: ReactNode;
|
|
7
|
+
content: ReactNode;
|
|
8
|
+
};
|
|
9
|
+
export type AccordionProps = {
|
|
10
|
+
items: AccordionEntry[];
|
|
11
|
+
/** `single` は 1 つだけ開く、`multiple` は複数同時に開ける。 */
|
|
12
|
+
type?: "single" | "multiple";
|
|
13
|
+
defaultValue?: string[];
|
|
14
|
+
className?: string;
|
|
15
|
+
itemClassName?: string;
|
|
16
|
+
/** 開閉の行(トリガー)に付ける追加のクラス。 */
|
|
17
|
+
triggerClassName?: string;
|
|
18
|
+
contentClassName?: string;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* `@lt-three/web` の layout/accordion と同じ「items を渡すだけ」のデータ駆動アコーディオン。
|
|
22
|
+
* 区切りは 1px のヘアラインのみで、開閉のシェブロンだけが動く。
|
|
23
|
+
*/
|
|
24
|
+
export declare function Accordion({ items, type, defaultValue, className, itemClassName, triggerClassName, contentClassName }: AccordionProps): import("react").JSX.Element;
|
|
25
|
+
//#endregion
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { useTokenColor } from "../lib/token-color.js";
|
|
2
|
+
import { cn } from "../lib/utils.js";
|
|
3
|
+
import { Text as Text$1 } from "../base/text.js";
|
|
4
|
+
import { useState } from "react";
|
|
5
|
+
import { LayoutAnimation, Platform, Pressable, UIManager, View } from "react-native";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import Feather from "@expo/vector-icons/Feather";
|
|
8
|
+
|
|
9
|
+
//#region src/native/layout/accordion.tsx
|
|
10
|
+
if (Platform.OS === "android" && UIManager.setLayoutAnimationEnabledExperimental) UIManager.setLayoutAnimationEnabledExperimental(true);
|
|
11
|
+
/**
|
|
12
|
+
* `@lt-three/web` の layout/accordion と同じ「items を渡すだけ」のデータ駆動アコーディオン。
|
|
13
|
+
* 区切りは 1px のヘアラインのみで、開閉のシェブロンだけが動く。
|
|
14
|
+
*/
|
|
15
|
+
function Accordion({ items, type = "single", defaultValue = [], className, itemClassName, triggerClassName, contentClassName }) {
|
|
16
|
+
const [open, setOpen] = useState(defaultValue);
|
|
17
|
+
const ink = useTokenColor("--ink-500");
|
|
18
|
+
const toggle = (value) => {
|
|
19
|
+
LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
|
|
20
|
+
setOpen((prev) => {
|
|
21
|
+
if (prev.includes(value)) return prev.filter((v) => v !== value);
|
|
22
|
+
return type === "single" ? [value] : [...prev, value];
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
return /* @__PURE__ */ jsx(View, {
|
|
26
|
+
className,
|
|
27
|
+
children: items.map((item) => {
|
|
28
|
+
const isOpen = open.includes(item.value);
|
|
29
|
+
return /* @__PURE__ */ jsxs(View, {
|
|
30
|
+
className: cn("border-b border-line", itemClassName),
|
|
31
|
+
children: [/* @__PURE__ */ jsxs(Pressable, {
|
|
32
|
+
accessibilityRole: "button",
|
|
33
|
+
"aria-expanded": isOpen,
|
|
34
|
+
onPress: () => toggle(item.value),
|
|
35
|
+
className: cn("flex-row items-center justify-between gap-2 py-4", triggerClassName),
|
|
36
|
+
children: [typeof item.trigger === "string" ? /* @__PURE__ */ jsx(Text$1, {
|
|
37
|
+
className: "text-sm font-medium",
|
|
38
|
+
children: item.trigger
|
|
39
|
+
}) : item.trigger, /* @__PURE__ */ jsx(Feather, {
|
|
40
|
+
name: isOpen ? "chevron-up" : "chevron-down",
|
|
41
|
+
size: 16,
|
|
42
|
+
color: ink
|
|
43
|
+
})]
|
|
44
|
+
}), isOpen ? /* @__PURE__ */ jsx(View, {
|
|
45
|
+
className: cn("pb-4", contentClassName),
|
|
46
|
+
children: item.content
|
|
47
|
+
}) : null]
|
|
48
|
+
}, item.value);
|
|
49
|
+
})
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
//#endregion
|
|
54
|
+
export { Accordion };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
//#region src/native/layout/card.d.ts
|
|
3
|
+
/** 文字・数字のアクション(それ自体が読み上げ名になる)。 */
|
|
4
|
+
type TextAction = string | number;
|
|
5
|
+
/**
|
|
6
|
+
* ヘッダー右端のアクション。**タップできるアクション(`actionOnPress`)が文字でない(アイコンなど)ときは、
|
|
7
|
+
* 読み上げ名(`actionLabel`)が必須**(名前の無いボタンになるため)。
|
|
8
|
+
*/
|
|
9
|
+
type CardActionProps = {
|
|
10
|
+
action?: undefined;
|
|
11
|
+
actionOnPress?: undefined;
|
|
12
|
+
actionLabel?: undefined;
|
|
13
|
+
} | {
|
|
14
|
+
action: ReactNode;
|
|
15
|
+
actionOnPress?: undefined;
|
|
16
|
+
actionLabel?: string;
|
|
17
|
+
} | {
|
|
18
|
+
action: TextAction;
|
|
19
|
+
actionOnPress: () => void;
|
|
20
|
+
actionLabel?: string;
|
|
21
|
+
} | {
|
|
22
|
+
action: Exclude<ReactNode, TextAction | null | undefined>;
|
|
23
|
+
actionOnPress: () => void;
|
|
24
|
+
actionLabel: string;
|
|
25
|
+
};
|
|
26
|
+
export type CardProps = CardActionProps & {
|
|
27
|
+
title?: ReactNode;
|
|
28
|
+
/**
|
|
29
|
+
* タイトルを見出しにする(`role="heading"` と `aria-level`)。画面の見出し構造に入れたいときに渡す。
|
|
30
|
+
* 未指定ならただの文字(web の `headingLevel` と同じ意味)。
|
|
31
|
+
*/
|
|
32
|
+
headingLevel?: 2 | 3 | 4 | 5 | 6;
|
|
33
|
+
description?: ReactNode;
|
|
34
|
+
content: ReactNode;
|
|
35
|
+
footer?: ReactNode;
|
|
36
|
+
className?: string;
|
|
37
|
+
contentClassName?: string;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* `@lt-three/web` の layout/card と同じ「タイトル・説明・アクション・本文・フッター」の構成。
|
|
41
|
+
* 外装(surface 角丸・1px の極薄の罫線・raised 面)は `Panel` が持つ。
|
|
42
|
+
*
|
|
43
|
+
* 中身に自前の余白や区切り線を敷きたいだけなら、素の面である `Panel` を直接使う。
|
|
44
|
+
*/
|
|
45
|
+
export declare function Card({ title, headingLevel, description, action, actionOnPress, actionLabel, content, footer, className, contentClassName }: CardProps): import("react").JSX.Element;
|
|
46
|
+
//#endregion
|
|
47
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { cn } from "../lib/utils.js";
|
|
2
|
+
import { Text as Text$1 } from "../base/text.js";
|
|
3
|
+
import { Panel } from "./panel.js";
|
|
4
|
+
import { Pressable, View } from "react-native";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
|
|
7
|
+
//#region src/native/layout/card.tsx
|
|
8
|
+
/**
|
|
9
|
+
* `@lt-three/web` の layout/card と同じ「タイトル・説明・アクション・本文・フッター」の構成。
|
|
10
|
+
* 外装(surface 角丸・1px の極薄の罫線・raised 面)は `Panel` が持つ。
|
|
11
|
+
*
|
|
12
|
+
* 中身に自前の余白や区切り線を敷きたいだけなら、素の面である `Panel` を直接使う。
|
|
13
|
+
*/
|
|
14
|
+
function Card({ title, headingLevel, description, action, actionOnPress, actionLabel, content, footer, className, contentClassName }) {
|
|
15
|
+
const hasHeader = !!title || !!description || !!action;
|
|
16
|
+
const actionNode = typeof action === "string" || typeof action === "number" ? /* @__PURE__ */ jsx(Text$1, {
|
|
17
|
+
className: "text-sm",
|
|
18
|
+
children: action
|
|
19
|
+
}) : action;
|
|
20
|
+
return /* @__PURE__ */ jsxs(Panel, {
|
|
21
|
+
className,
|
|
22
|
+
children: [
|
|
23
|
+
hasHeader ? /* @__PURE__ */ jsxs(View, {
|
|
24
|
+
className: "flex-row items-start justify-between gap-2 border-b border-line px-4 py-3",
|
|
25
|
+
children: [/* @__PURE__ */ jsxs(View, {
|
|
26
|
+
className: "shrink gap-1",
|
|
27
|
+
children: [title ? /* @__PURE__ */ jsx(Text$1, {
|
|
28
|
+
role: headingLevel ? "heading" : void 0,
|
|
29
|
+
"aria-level": headingLevel ? String(headingLevel) : void 0,
|
|
30
|
+
className: "text-base font-semibold leading-none",
|
|
31
|
+
children: title
|
|
32
|
+
}) : null, description ? /* @__PURE__ */ jsx(Text$1, {
|
|
33
|
+
className: "text-muted-foreground text-sm",
|
|
34
|
+
children: description
|
|
35
|
+
}) : null]
|
|
36
|
+
}), action ? actionOnPress ? /* @__PURE__ */ jsx(Pressable, {
|
|
37
|
+
accessibilityRole: "button",
|
|
38
|
+
accessibilityLabel: actionLabel,
|
|
39
|
+
onPress: actionOnPress,
|
|
40
|
+
hitSlop: 12,
|
|
41
|
+
children: actionNode
|
|
42
|
+
}) : actionNode : null]
|
|
43
|
+
}) : null,
|
|
44
|
+
/* @__PURE__ */ jsx(View, {
|
|
45
|
+
className: cn("grow gap-4 p-4", contentClassName),
|
|
46
|
+
children: content
|
|
47
|
+
}),
|
|
48
|
+
footer ? /* @__PURE__ */ jsx(View, {
|
|
49
|
+
className: "flex-row justify-end gap-4 border-t border-line px-4 py-3",
|
|
50
|
+
children: footer
|
|
51
|
+
}) : null
|
|
52
|
+
]
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
//#endregion
|
|
57
|
+
export { Card };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
//#region src/native/layout/description.d.ts
|
|
3
|
+
export type DescriptionSection = {
|
|
4
|
+
title: string;
|
|
5
|
+
titleIcon?: ReactNode;
|
|
6
|
+
description: ReactNode;
|
|
7
|
+
};
|
|
8
|
+
export type DescriptionProps = {
|
|
9
|
+
sections: DescriptionSection[];
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* 見出し + 本文のセクションを 1px 罫線で区切って積む。
|
|
13
|
+
* `@lt-three/web` の layout/description に対応する(利用規約・説明画面など)。
|
|
14
|
+
*/
|
|
15
|
+
export declare function Description({ sections }: DescriptionProps): import("react").JSX.Element;
|
|
16
|
+
//#endregion
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Text as Text$1 } from "../base/text.js";
|
|
2
|
+
import { Separator } from "../atom/separator.js";
|
|
3
|
+
import { Fragment } from "react";
|
|
4
|
+
import { View } from "react-native";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
|
|
7
|
+
//#region src/native/layout/description.tsx
|
|
8
|
+
/**
|
|
9
|
+
* 見出し + 本文のセクションを 1px 罫線で区切って積む。
|
|
10
|
+
* `@lt-three/web` の layout/description に対応する(利用規約・説明画面など)。
|
|
11
|
+
*/
|
|
12
|
+
function Description({ sections }) {
|
|
13
|
+
return /* @__PURE__ */ jsx(View, {
|
|
14
|
+
className: "gap-8",
|
|
15
|
+
children: sections.map((section, index) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(View, { children: [/* @__PURE__ */ jsxs(View, {
|
|
16
|
+
className: "mb-2 flex-row items-center gap-2",
|
|
17
|
+
children: [section.titleIcon, /* @__PURE__ */ jsx(Text$1, {
|
|
18
|
+
className: "font-bold",
|
|
19
|
+
children: section.title
|
|
20
|
+
})]
|
|
21
|
+
}), /* @__PURE__ */ jsx(View, {
|
|
22
|
+
className: "gap-4",
|
|
23
|
+
children: typeof section.description === "string" ? /* @__PURE__ */ jsx(Text$1, {
|
|
24
|
+
className: "text-sm",
|
|
25
|
+
children: section.description
|
|
26
|
+
}) : section.description
|
|
27
|
+
})] }), index < sections.length - 1 ? /* @__PURE__ */ jsx(Separator, {}) : null] }, section.title))
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
32
|
+
export { Description };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//#region src/native/layout/error.d.ts
|
|
2
|
+
export type ErrorViewProps = {
|
|
3
|
+
/** 表示文言。共有パッケージなので使用側が持つ(i18n を持ち込まない)。 */
|
|
4
|
+
labels: {
|
|
5
|
+
title: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
retry: string;
|
|
8
|
+
};
|
|
9
|
+
onRetry: () => void;
|
|
10
|
+
/**
|
|
11
|
+
* 既定は画面いっぱいに中央寄せする。スクロール内の一部として差し込むときは
|
|
12
|
+
* `h-full` が解決できないので、`className` で高さの指定を上書きする。
|
|
13
|
+
*/
|
|
14
|
+
className?: string;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* エラー時の画面。`@lt-three/web` の layout/error(ErrorComponent)に対応する。
|
|
18
|
+
* `once/error-boundary` の中身としても使う。
|
|
19
|
+
*/
|
|
20
|
+
export declare function ErrorView({ labels, onRetry, className }: ErrorViewProps): import("react").JSX.Element;
|
|
21
|
+
//#endregion
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { useTokenColor } from "../lib/token-color.js";
|
|
2
|
+
import { cn } from "../lib/utils.js";
|
|
3
|
+
import { Text as Text$1 } from "../base/text.js";
|
|
4
|
+
import { Button } from "../atom/button.js";
|
|
5
|
+
import { View } from "react-native";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import Feather from "@expo/vector-icons/Feather";
|
|
8
|
+
|
|
9
|
+
//#region src/native/layout/error.tsx
|
|
10
|
+
/**
|
|
11
|
+
* エラー時の画面。`@lt-three/web` の layout/error(ErrorComponent)に対応する。
|
|
12
|
+
* `once/error-boundary` の中身としても使う。
|
|
13
|
+
*/
|
|
14
|
+
function ErrorView({ labels, onRetry, className }) {
|
|
15
|
+
const ink = useTokenColor("--ink-1000");
|
|
16
|
+
return /* @__PURE__ */ jsxs(View, {
|
|
17
|
+
className: cn("h-full w-full items-center justify-center gap-4 p-6", className),
|
|
18
|
+
children: [
|
|
19
|
+
/* @__PURE__ */ jsx(Feather, {
|
|
20
|
+
name: "alert-octagon",
|
|
21
|
+
size: 20,
|
|
22
|
+
color: ink
|
|
23
|
+
}),
|
|
24
|
+
/* @__PURE__ */ jsx(Text$1, {
|
|
25
|
+
className: "text-base font-semibold",
|
|
26
|
+
children: labels.title
|
|
27
|
+
}),
|
|
28
|
+
labels.description ? /* @__PURE__ */ jsx(Text$1, {
|
|
29
|
+
className: "text-muted-foreground text-center text-sm",
|
|
30
|
+
children: labels.description
|
|
31
|
+
}) : null,
|
|
32
|
+
/* @__PURE__ */ jsx(Button, {
|
|
33
|
+
className: "self-center",
|
|
34
|
+
variant: "outline",
|
|
35
|
+
size: "sm",
|
|
36
|
+
onPress: onRetry,
|
|
37
|
+
children: labels.retry
|
|
38
|
+
})
|
|
39
|
+
]
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
//#endregion
|
|
44
|
+
export { ErrorView };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
//#region src/native/layout/information.d.ts
|
|
3
|
+
export type InformationField = {
|
|
4
|
+
label: string;
|
|
5
|
+
value: ReactNode;
|
|
6
|
+
separator?: never;
|
|
7
|
+
} | {
|
|
8
|
+
label?: never;
|
|
9
|
+
value?: never;
|
|
10
|
+
separator: true;
|
|
11
|
+
};
|
|
12
|
+
export type InformationProps = {
|
|
13
|
+
fields: InformationField[];
|
|
14
|
+
/** 値を大きめに出す(詳細画面のヘッダー等)。 */
|
|
15
|
+
highlighted?: boolean;
|
|
16
|
+
className?: string;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* ラベルと値を並べる定義リスト。`@lt-three/web` の layout/information に対応する。
|
|
20
|
+
*
|
|
21
|
+
* web は画面が広いので複数カラムに分けられるが、native は幅が足りないので
|
|
22
|
+
* **常に 1 カラム**(ラベル左・値右の行)で描く。
|
|
23
|
+
*/
|
|
24
|
+
export declare function Information({ fields, highlighted, className }: InformationProps): import("react").JSX.Element;
|
|
25
|
+
//#endregion
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { cn } from "../lib/utils.js";
|
|
2
|
+
import { Text as Text$1 } from "../base/text.js";
|
|
3
|
+
import { Separator } from "../atom/separator.js";
|
|
4
|
+
import { Fragment } from "react";
|
|
5
|
+
import { View } from "react-native";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
|
|
8
|
+
//#region src/native/layout/information.tsx
|
|
9
|
+
/**
|
|
10
|
+
* ラベルと値を並べる定義リスト。`@lt-three/web` の layout/information に対応する。
|
|
11
|
+
*
|
|
12
|
+
* web は画面が広いので複数カラムに分けられるが、native は幅が足りないので
|
|
13
|
+
* **常に 1 カラム**(ラベル左・値右の行)で描く。
|
|
14
|
+
*/
|
|
15
|
+
function Information({ fields, highlighted, className }) {
|
|
16
|
+
return /* @__PURE__ */ jsx(View, {
|
|
17
|
+
className: cn("gap-3", className),
|
|
18
|
+
children: fields.map((field, index) => field.separator ? /* @__PURE__ */ jsx(Separator, {}, `separator-${index}`) : /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(View, {
|
|
19
|
+
className: "flex-row items-center justify-between gap-4",
|
|
20
|
+
children: [/* @__PURE__ */ jsx(Text$1, {
|
|
21
|
+
className: "text-muted-foreground shrink-0 text-xs font-semibold",
|
|
22
|
+
children: field.label
|
|
23
|
+
}), /* @__PURE__ */ jsx(View, {
|
|
24
|
+
className: cn("min-h-7 shrink flex-row items-center justify-end gap-2"),
|
|
25
|
+
children: typeof field.value === "string" || typeof field.value === "number" ? /* @__PURE__ */ jsx(Text$1, {
|
|
26
|
+
className: cn(highlighted ? "text-lg" : "text-sm"),
|
|
27
|
+
children: field.value
|
|
28
|
+
}) : field.value
|
|
29
|
+
})]
|
|
30
|
+
}) }, field.label))
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
//#endregion
|
|
35
|
+
export { Information };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
//#region src/native/layout/locked.d.ts
|
|
3
|
+
export type LockedProps = {
|
|
4
|
+
/**
|
|
5
|
+
* ロックの向こう側にあるものの形。**読ませない前提の見本**を渡す。
|
|
6
|
+
* 実データを渡してはいけない(覆いは表現であって遮蔽ではない)。
|
|
7
|
+
*/
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
/** 面に重ねる短い説明。例:「Pro で見られます」。 */
|
|
10
|
+
label: string;
|
|
11
|
+
/** 見本であることの断り書き。例:「見本」。省略すると出さない。 */
|
|
12
|
+
sampleLabel?: string;
|
|
13
|
+
/** 面全体を押せるようにする。鍵は押したくなるので、基本は渡す。 */
|
|
14
|
+
onPress?: () => void;
|
|
15
|
+
accessibilityLabel?: string;
|
|
16
|
+
/**
|
|
17
|
+
* 覆いの下に置く行き先(説明と出口のボタン)。**同じ面の中に入れる**ことで、
|
|
18
|
+
* 「見えないもの」と「その開け方」が 1 枚に収まる。
|
|
19
|
+
*/
|
|
20
|
+
footer?: ReactNode;
|
|
21
|
+
/** 見本の高さ。既定 160。 */
|
|
22
|
+
height?: number;
|
|
23
|
+
className?: string;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* ロックされた面。**中身の形は見せて、読めなくする。**
|
|
27
|
+
*
|
|
28
|
+
* 中身を丸ごと差し替えると「ロック」ではなく「不在」が伝わり、何が惜しいのか分からない。
|
|
29
|
+
* 形だけ残して覆うことで、そこに何があるかを示したまま手が届かないことを表す。
|
|
30
|
+
*
|
|
31
|
+
* **読み込み中の Skeleton とは別物**として作ってある。Skeleton は「待てば出てくる」を
|
|
32
|
+
* 意味するので、同じ見た目をロックに使ってはいけない(待っても出ないため)。
|
|
33
|
+
*
|
|
34
|
+
* 覆いは iOS 26 以上では `GlassView`(背後をぼかすガラス)、非対応環境(iOS 26 未満・Android・web)ではカード地で覆う。
|
|
35
|
+
* **見本はダミーなので、覆いの強さに機密性の要件は無い**。表現として選んでよい。
|
|
36
|
+
*/
|
|
37
|
+
export declare function Locked({ children, label, sampleLabel, onPress, accessibilityLabel, footer, height, className }: LockedProps): import("react").JSX.Element;
|
|
38
|
+
//#endregion
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { useTokenColor } from "../lib/token-color.js";
|
|
2
|
+
import { cn } from "../lib/utils.js";
|
|
3
|
+
import { Text as Text$1 } from "../base/text.js";
|
|
4
|
+
import { Panel } from "./panel.js";
|
|
5
|
+
import { Pressable, View } from "react-native";
|
|
6
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import Feather from "@expo/vector-icons/Feather";
|
|
8
|
+
import { GlassView, isLiquidGlassAvailable } from "expo-glass-effect";
|
|
9
|
+
|
|
10
|
+
//#region src/native/layout/locked.tsx
|
|
11
|
+
const FILL = {
|
|
12
|
+
position: "absolute",
|
|
13
|
+
top: 0,
|
|
14
|
+
right: 0,
|
|
15
|
+
bottom: 0,
|
|
16
|
+
left: 0,
|
|
17
|
+
alignItems: "center",
|
|
18
|
+
justifyContent: "center",
|
|
19
|
+
gap: 8,
|
|
20
|
+
padding: 16
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* ロックされた面。**中身の形は見せて、読めなくする。**
|
|
24
|
+
*
|
|
25
|
+
* 中身を丸ごと差し替えると「ロック」ではなく「不在」が伝わり、何が惜しいのか分からない。
|
|
26
|
+
* 形だけ残して覆うことで、そこに何があるかを示したまま手が届かないことを表す。
|
|
27
|
+
*
|
|
28
|
+
* **読み込み中の Skeleton とは別物**として作ってある。Skeleton は「待てば出てくる」を
|
|
29
|
+
* 意味するので、同じ見た目をロックに使ってはいけない(待っても出ないため)。
|
|
30
|
+
*
|
|
31
|
+
* 覆いは iOS 26 以上では `GlassView`(背後をぼかすガラス)、非対応環境(iOS 26 未満・Android・web)ではカード地で覆う。
|
|
32
|
+
* **見本はダミーなので、覆いの強さに機密性の要件は無い**。表現として選んでよい。
|
|
33
|
+
*/
|
|
34
|
+
function Locked({ children, label, sampleLabel, onPress, accessibilityLabel, footer, height = 160, className }) {
|
|
35
|
+
const ink = useTokenColor("--ink-900");
|
|
36
|
+
const cover = /* @__PURE__ */ jsxs(View, {
|
|
37
|
+
style: { height },
|
|
38
|
+
children: [
|
|
39
|
+
/* @__PURE__ */ jsx(View, {
|
|
40
|
+
pointerEvents: "none",
|
|
41
|
+
style: { height },
|
|
42
|
+
children
|
|
43
|
+
}),
|
|
44
|
+
isLiquidGlassAvailable() ? /* @__PURE__ */ jsx(GlassView, {
|
|
45
|
+
glassEffectStyle: "regular",
|
|
46
|
+
style: FILL
|
|
47
|
+
}) : /* @__PURE__ */ jsx(View, {
|
|
48
|
+
style: FILL,
|
|
49
|
+
className: "bg-card/85"
|
|
50
|
+
}),
|
|
51
|
+
/* @__PURE__ */ jsx(View, {
|
|
52
|
+
pointerEvents: "none",
|
|
53
|
+
style: FILL,
|
|
54
|
+
children: /* @__PURE__ */ jsx(LockBody, {
|
|
55
|
+
label,
|
|
56
|
+
sampleLabel,
|
|
57
|
+
ink
|
|
58
|
+
})
|
|
59
|
+
})
|
|
60
|
+
]
|
|
61
|
+
});
|
|
62
|
+
return /* @__PURE__ */ jsxs(Panel, {
|
|
63
|
+
className: cn("overflow-hidden", className),
|
|
64
|
+
children: [onPress ? /* @__PURE__ */ jsx(Pressable, {
|
|
65
|
+
onPress,
|
|
66
|
+
accessible: false,
|
|
67
|
+
accessibilityLabel: accessibilityLabel ?? label,
|
|
68
|
+
children: cover
|
|
69
|
+
}) : cover, footer ? /* @__PURE__ */ jsx(View, {
|
|
70
|
+
className: "border-t border-line",
|
|
71
|
+
children: footer
|
|
72
|
+
}) : null]
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
function LockBody({ label, sampleLabel, ink }) {
|
|
76
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
77
|
+
/* @__PURE__ */ jsx(Feather, {
|
|
78
|
+
name: "lock",
|
|
79
|
+
size: 20,
|
|
80
|
+
color: ink
|
|
81
|
+
}),
|
|
82
|
+
/* @__PURE__ */ jsx(Text$1, {
|
|
83
|
+
className: "text-foreground text-center text-[13px] font-semibold leading-[19px]",
|
|
84
|
+
children: label
|
|
85
|
+
}),
|
|
86
|
+
sampleLabel ? /* @__PURE__ */ jsx(Text$1, {
|
|
87
|
+
className: "text-muted-foreground text-center text-[11px] font-semibold tracking-widest",
|
|
88
|
+
children: sampleLabel
|
|
89
|
+
}) : null
|
|
90
|
+
] });
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
//#endregion
|
|
94
|
+
export { Locked };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
//#region src/native/layout/modal.d.ts
|
|
3
|
+
export type ModalProps = {
|
|
4
|
+
open: boolean;
|
|
5
|
+
onOpenChange: (open: boolean) => void;
|
|
6
|
+
/** 見出し。ダイアログの名前になる。 */
|
|
7
|
+
title: ReactNode;
|
|
8
|
+
description?: ReactNode;
|
|
9
|
+
content: ReactNode;
|
|
10
|
+
footer?: ReactNode;
|
|
11
|
+
/** 背面タップで閉じるか(既定 false = 明示的に閉じさせる)。Esc・Android の戻る操作では、この設定にかかわらず閉じる。 */
|
|
12
|
+
dismissOnBackdropPress?: boolean;
|
|
13
|
+
/** 閉じるボタンの読み上げ名(既定は「閉じる」)。共有パッケージなので、別の言語はここで渡す。 */
|
|
14
|
+
closeLabel?: string;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* 画面中央に出る確認・編集用のダイアログ。`@lt-three/web` の layout/modal に対応する。
|
|
18
|
+
* 外装は overlay 面(surface 角丸・shadow-lg。枠は付けない)で、本文だけがスクロールする。
|
|
19
|
+
*
|
|
20
|
+
* 見出しがダイアログの名前(`aria-labelledby`)、補足が説明(`aria-describedby`)になる。
|
|
21
|
+
* 役割(`role="dialog"`・`aria-modal`)・フォーカスの閉じ込め・Esc は `Modal` が持つ。
|
|
22
|
+
* web の `layout/modal` は `dialog`(`DialogController`)で開閉を受けるが、native は `open` / `onOpenChange`(移植元のまま)。
|
|
23
|
+
*/
|
|
24
|
+
export declare function Modal({ open, onOpenChange, title, description, content, footer, dismissOnBackdropPress, closeLabel }: ModalProps): import("react").JSX.Element;
|
|
25
|
+
//#endregion
|