@lt-three/love3 0.0.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +18 -0
- package/dist/native/analytics/multi-line-chart.js +216 -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 +12 -0
- package/dist/native/atom/separator.js +16 -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 +22 -0
- package/dist/native/form/form.js +44 -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 +48 -0
- package/dist/native/lib/confirm.js +69 -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 +16 -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 +11 -0
- package/dist/native/lib/network.js +20 -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 +45 -0
- package/dist/native/lib/snackbar.js +59 -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 +39 -0
- package/dist/web/atom/segmented-control.js +42 -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 +23 -0
- package/dist/web/atom/text-area.js +27 -0
- package/dist/web/atom/text-field.d.ts +18 -0
- package/dist/web/atom/text-field.js +22 -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 +32 -0
- package/dist/web/layout/titled-modal.js +58 -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,45 @@
|
|
|
1
|
+
import { AnyFieldApi } from "@tanstack/react-form";
|
|
2
|
+
import React from "react";
|
|
3
|
+
//#region src/shared/form.d.ts
|
|
4
|
+
export declare const fieldContext: React.Context<AnyFieldApi>, formContext: React.Context<import("@tanstack/react-form").AnyFormApi>, useFormContext: () => import("@tanstack/react-form").ReactFormExtendedApi<Record<string, never>, any, any, any, any, any, any, any, any, any, any, any>, useFieldContext: <TData>() => import("@tanstack/react-form").FieldApi<any, string, TData, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any>;
|
|
5
|
+
/**
|
|
6
|
+
* Returns the field inside a field and null outside (`useFieldContext` throws outside).
|
|
7
|
+
* The return type includes null, so tsc fails if a caller forgets `?.`.
|
|
8
|
+
*/
|
|
9
|
+
export declare function useOptionalFieldContext(): AnyFieldApi | null;
|
|
10
|
+
/**
|
|
11
|
+
* The props that every field-type input (`form/*`) accepts. The value is held by the field context (TanStack Form),
|
|
12
|
+
* so `value` / `onValueChange` are not accepted (rather than accepting them and silently ignoring them).
|
|
13
|
+
*/
|
|
14
|
+
export type FieldInputProps = {
|
|
15
|
+
label?: React.ReactNode;
|
|
16
|
+
required?: boolean;
|
|
17
|
+
placeholder?: string;
|
|
18
|
+
description?: string;
|
|
19
|
+
className?: string;
|
|
20
|
+
wrapperClassName?: string;
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
helpText?: React.ReactNode;
|
|
23
|
+
debounce?: number;
|
|
24
|
+
/** A data-testid for tests. It is applied as is to the actual input element. */
|
|
25
|
+
"data-testid"?: string;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* `FieldInputProps` plus a controlled mode (passing `value` / `onValueChange` skips the field context).
|
|
29
|
+
* Used only by inputs that implement the controlled mode (`form/checkbox`, `form/switch`).
|
|
30
|
+
*/
|
|
31
|
+
export type BaseInputProps<T> = FieldInputProps & ({
|
|
32
|
+
value: T;
|
|
33
|
+
onValueChange: (value: T) => void;
|
|
34
|
+
} | {
|
|
35
|
+
value?: never;
|
|
36
|
+
onValueChange?: never;
|
|
37
|
+
});
|
|
38
|
+
type UseFieldValueProps<T> = {
|
|
39
|
+
emptyValue?: T;
|
|
40
|
+
debounce?: number;
|
|
41
|
+
onChange?: (prevValue: T, newValue: T) => void;
|
|
42
|
+
};
|
|
43
|
+
export declare const useFieldValue: <T>(props?: UseFieldValueProps<T>) => readonly [T, React.Dispatch<React.SetStateAction<T>>, import("@tanstack/react-form").FieldApi<any, string, T, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any>];
|
|
44
|
+
//#endregion
|
|
45
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { createFormHookContexts, useStore } from "@tanstack/react-form";
|
|
2
|
+
import { useDebouncedCallback } from "@tanstack/react-pacer";
|
|
3
|
+
import { isEqual } from "es-toolkit/compat";
|
|
4
|
+
import { useContext, useState } from "react";
|
|
5
|
+
|
|
6
|
+
//#region src/shared/form.ts
|
|
7
|
+
const { fieldContext, formContext, useFormContext, useFieldContext } = createFormHookContexts();
|
|
8
|
+
/**
|
|
9
|
+
* Returns the field inside a field and null outside (`useFieldContext` throws outside).
|
|
10
|
+
* The return type includes null, so tsc fails if a caller forgets `?.`.
|
|
11
|
+
*/
|
|
12
|
+
function useOptionalFieldContext() {
|
|
13
|
+
return useContext(fieldContext);
|
|
14
|
+
}
|
|
15
|
+
function isUpdater(action) {
|
|
16
|
+
return typeof action === "function";
|
|
17
|
+
}
|
|
18
|
+
const useFieldValue = (props) => {
|
|
19
|
+
const field = useFieldContext();
|
|
20
|
+
const formValue = useStore(field.store, (state) => state.value == null && props?.emptyValue != null ? props.emptyValue : state.value);
|
|
21
|
+
const setDebouncedValue = useDebouncedCallback((value) => {
|
|
22
|
+
field.handleChange((current) => {
|
|
23
|
+
if (!isEqual(current, value)) props?.onChange?.(current, value);
|
|
24
|
+
return value;
|
|
25
|
+
});
|
|
26
|
+
}, { wait: props?.debounce ?? 0 });
|
|
27
|
+
const [instantValue, setInstantValue] = useState(formValue);
|
|
28
|
+
const [syncedFormValue, setSyncedFormValue] = useState(formValue);
|
|
29
|
+
if (!Object.is(syncedFormValue, formValue)) {
|
|
30
|
+
setSyncedFormValue(formValue);
|
|
31
|
+
setInstantValue(formValue);
|
|
32
|
+
}
|
|
33
|
+
const setValue = (action) => {
|
|
34
|
+
const resolved = isUpdater(action) ? action(instantValue) : action;
|
|
35
|
+
setInstantValue(resolved);
|
|
36
|
+
setDebouncedValue(resolved);
|
|
37
|
+
};
|
|
38
|
+
return [
|
|
39
|
+
instantValue,
|
|
40
|
+
setValue,
|
|
41
|
+
field
|
|
42
|
+
];
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
//#endregion
|
|
46
|
+
export { fieldContext, formContext, useFieldContext, useFieldValue, useFormContext, useOptionalFieldContext };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ChartCommonProps, ColoredValueSharedProps, LineChartSharedProps, LinePoint, LineSeries, MetricCardSharedProps, MultiLineChartSharedProps } from "./analytics.js";
|
|
2
|
+
import { BUTTON_SIZES, BUTTON_VARIANTS, ButtonSize, ButtonVariant } from "./button.js";
|
|
3
|
+
export { BUTTON_SIZES, BUTTON_VARIANTS, type ButtonSize, type ButtonVariant, type ChartCommonProps, type ColoredValueSharedProps, type LineChartSharedProps, type LinePoint, type LineSeries, type MetricCardSharedProps, type MultiLineChartSharedProps };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//#region src/tokens/contrast-pairs.d.ts
|
|
2
|
+
export type ContrastKind = "text" | "ui";
|
|
3
|
+
/** The foreground / background pairs to check. `text` is 4.5:1 for body text; `ui` is 3:1 for large text and UI components and graphics. */
|
|
4
|
+
export declare const CONTRAST_PAIRS: ReadonlyArray<{
|
|
5
|
+
kind: ContrastKind;
|
|
6
|
+
fg: string;
|
|
7
|
+
bg: string;
|
|
8
|
+
}>;
|
|
9
|
+
/**
|
|
10
|
+
* Pairs that are known not to meet the criterion and are allowed for a stated reason. The key is `<mode>:<foreground>/<background>`.
|
|
11
|
+
*
|
|
12
|
+
* **Write a reason when adding here.** Exception pairs are also checked to still be below the criterion
|
|
13
|
+
* (once they meet it, the test fails and asks for them to be removed from the exceptions, so the list does not drift from reality).
|
|
14
|
+
* A disabled `ink-300` is out of scope in WCAG, so it is not in the pairs at all.
|
|
15
|
+
*/
|
|
16
|
+
export declare const KNOWN_CONTRAST_EXCEPTIONS: Readonly<Record<string, string>>;
|
|
17
|
+
/**
|
|
18
|
+
* Text of the same state on a light fill (such as `bg-state-error/5`, a fill that mixes the state color into the surface by `alpha` only), at 4.5:1 for 12px body text.
|
|
19
|
+
* A translucent composite does not fit in `CONTRAST_PAIRS` (pairs of tokens), so the fill is composited onto the surface color before the ratio is computed (contrast.test.ts).
|
|
20
|
+
* The test also checks that the files in `usedIn` use `tintClass` (when you change alpha, fix this and the components together).
|
|
21
|
+
*/
|
|
22
|
+
export declare const TINTED_STATE_PAIRS: ReadonlyArray<{
|
|
23
|
+
token: string;
|
|
24
|
+
alpha: number;
|
|
25
|
+
tintClass: string;
|
|
26
|
+
usedIn: readonly string[];
|
|
27
|
+
}>;
|
|
28
|
+
/** The surfaces a light fill is placed on (the 4 background levels and wash). */
|
|
29
|
+
export declare const TINT_SURFACES: readonly ["frame", "paper", "raised", "overlay", "wash"];
|
|
30
|
+
//#endregion
|
|
@@ -0,0 +1,404 @@
|
|
|
1
|
+
//#region src/tokens/contrast-pairs.ts
|
|
2
|
+
/** The foreground / background pairs to check. `text` is 4.5:1 for body text; `ui` is 3:1 for large text and UI components and graphics. */
|
|
3
|
+
const CONTRAST_PAIRS = [
|
|
4
|
+
{
|
|
5
|
+
kind: "text",
|
|
6
|
+
fg: "foreground",
|
|
7
|
+
bg: "background"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
kind: "text",
|
|
11
|
+
fg: "card-foreground",
|
|
12
|
+
bg: "card"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
kind: "text",
|
|
16
|
+
fg: "popover-foreground",
|
|
17
|
+
bg: "popover"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
kind: "text",
|
|
21
|
+
fg: "primary-foreground",
|
|
22
|
+
bg: "primary"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
kind: "text",
|
|
26
|
+
fg: "secondary-foreground",
|
|
27
|
+
bg: "secondary"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
kind: "text",
|
|
31
|
+
fg: "accent-foreground",
|
|
32
|
+
bg: "accent"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
kind: "text",
|
|
36
|
+
fg: "destructive-foreground",
|
|
37
|
+
bg: "destructive"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
kind: "text",
|
|
41
|
+
fg: "sidebar-foreground",
|
|
42
|
+
bg: "sidebar"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
kind: "text",
|
|
46
|
+
fg: "sidebar-primary-foreground",
|
|
47
|
+
bg: "sidebar-primary"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
kind: "text",
|
|
51
|
+
fg: "sidebar-accent-foreground",
|
|
52
|
+
bg: "sidebar-accent"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
kind: "text",
|
|
56
|
+
fg: "action-foreground",
|
|
57
|
+
bg: "action"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
kind: "text",
|
|
61
|
+
fg: "action-foreground",
|
|
62
|
+
bg: "action-hover"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
kind: "text",
|
|
66
|
+
fg: "destructive-solid-foreground",
|
|
67
|
+
bg: "destructive-solid"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
kind: "text",
|
|
71
|
+
fg: "ink-900",
|
|
72
|
+
bg: "frame"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
kind: "text",
|
|
76
|
+
fg: "ink-900",
|
|
77
|
+
bg: "paper"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
kind: "text",
|
|
81
|
+
fg: "ink-900",
|
|
82
|
+
bg: "raised"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
kind: "text",
|
|
86
|
+
fg: "ink-900",
|
|
87
|
+
bg: "overlay"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
kind: "text",
|
|
91
|
+
fg: "ink-900",
|
|
92
|
+
bg: "wash"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
kind: "text",
|
|
96
|
+
fg: "ink-700",
|
|
97
|
+
bg: "frame"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
kind: "text",
|
|
101
|
+
fg: "ink-700",
|
|
102
|
+
bg: "paper"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
kind: "text",
|
|
106
|
+
fg: "ink-700",
|
|
107
|
+
bg: "raised"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
kind: "text",
|
|
111
|
+
fg: "ink-700",
|
|
112
|
+
bg: "overlay"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
kind: "text",
|
|
116
|
+
fg: "ink-700",
|
|
117
|
+
bg: "wash"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
kind: "text",
|
|
121
|
+
fg: "muted-foreground",
|
|
122
|
+
bg: "frame"
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
kind: "text",
|
|
126
|
+
fg: "muted-foreground",
|
|
127
|
+
bg: "background"
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
kind: "text",
|
|
131
|
+
fg: "muted-foreground",
|
|
132
|
+
bg: "raised"
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
kind: "text",
|
|
136
|
+
fg: "muted-foreground",
|
|
137
|
+
bg: "overlay"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
kind: "text",
|
|
141
|
+
fg: "muted-foreground",
|
|
142
|
+
bg: "muted"
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
kind: "text",
|
|
146
|
+
fg: "action-ink",
|
|
147
|
+
bg: "frame"
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
kind: "text",
|
|
151
|
+
fg: "action-ink",
|
|
152
|
+
bg: "paper"
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
kind: "text",
|
|
156
|
+
fg: "action-ink",
|
|
157
|
+
bg: "raised"
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
kind: "text",
|
|
161
|
+
fg: "action-ink",
|
|
162
|
+
bg: "overlay"
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
kind: "text",
|
|
166
|
+
fg: "action-ink",
|
|
167
|
+
bg: "wash"
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
kind: "text",
|
|
171
|
+
fg: "state-success",
|
|
172
|
+
bg: "frame"
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
kind: "text",
|
|
176
|
+
fg: "state-success",
|
|
177
|
+
bg: "paper"
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
kind: "text",
|
|
181
|
+
fg: "state-success",
|
|
182
|
+
bg: "raised"
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
kind: "text",
|
|
186
|
+
fg: "state-success",
|
|
187
|
+
bg: "overlay"
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
kind: "text",
|
|
191
|
+
fg: "state-success",
|
|
192
|
+
bg: "wash"
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
kind: "text",
|
|
196
|
+
fg: "state-error",
|
|
197
|
+
bg: "frame"
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
kind: "text",
|
|
201
|
+
fg: "state-error",
|
|
202
|
+
bg: "paper"
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
kind: "text",
|
|
206
|
+
fg: "state-error",
|
|
207
|
+
bg: "raised"
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
kind: "text",
|
|
211
|
+
fg: "state-error",
|
|
212
|
+
bg: "overlay"
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
kind: "text",
|
|
216
|
+
fg: "state-error",
|
|
217
|
+
bg: "wash"
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
kind: "text",
|
|
221
|
+
fg: "state-warning",
|
|
222
|
+
bg: "frame"
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
kind: "text",
|
|
226
|
+
fg: "state-warning",
|
|
227
|
+
bg: "paper"
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
kind: "text",
|
|
231
|
+
fg: "state-warning",
|
|
232
|
+
bg: "raised"
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
kind: "text",
|
|
236
|
+
fg: "state-warning",
|
|
237
|
+
bg: "overlay"
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
kind: "text",
|
|
241
|
+
fg: "state-warning",
|
|
242
|
+
bg: "wash"
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
kind: "text",
|
|
246
|
+
fg: "lt-three-foreground",
|
|
247
|
+
bg: "lt-three"
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
kind: "ui",
|
|
251
|
+
fg: "ring",
|
|
252
|
+
bg: "frame"
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
kind: "ui",
|
|
256
|
+
fg: "ring",
|
|
257
|
+
bg: "background"
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
kind: "ui",
|
|
261
|
+
fg: "ring",
|
|
262
|
+
bg: "raised"
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
kind: "ui",
|
|
266
|
+
fg: "ring",
|
|
267
|
+
bg: "overlay"
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
kind: "ui",
|
|
271
|
+
fg: "ring",
|
|
272
|
+
bg: "wash"
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
kind: "ui",
|
|
276
|
+
fg: "line-control",
|
|
277
|
+
bg: "frame"
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
kind: "ui",
|
|
281
|
+
fg: "line-control",
|
|
282
|
+
bg: "background"
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
kind: "ui",
|
|
286
|
+
fg: "line-control",
|
|
287
|
+
bg: "raised"
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
kind: "ui",
|
|
291
|
+
fg: "line-control",
|
|
292
|
+
bg: "overlay"
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
kind: "ui",
|
|
296
|
+
fg: "line-control",
|
|
297
|
+
bg: "wash"
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
kind: "ui",
|
|
301
|
+
fg: "action",
|
|
302
|
+
bg: "frame"
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
kind: "ui",
|
|
306
|
+
fg: "action",
|
|
307
|
+
bg: "paper"
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
kind: "ui",
|
|
311
|
+
fg: "action",
|
|
312
|
+
bg: "raised"
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
kind: "ui",
|
|
316
|
+
fg: "action",
|
|
317
|
+
bg: "overlay"
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
kind: "ui",
|
|
321
|
+
fg: "action",
|
|
322
|
+
bg: "wash"
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
kind: "ui",
|
|
326
|
+
fg: "border",
|
|
327
|
+
bg: "background"
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
kind: "ui",
|
|
331
|
+
fg: "input",
|
|
332
|
+
bg: "background"
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
kind: "ui",
|
|
336
|
+
fg: "lt-three",
|
|
337
|
+
bg: "paper"
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
kind: "ui",
|
|
341
|
+
fg: "chart-1",
|
|
342
|
+
bg: "paper"
|
|
343
|
+
},
|
|
344
|
+
{
|
|
345
|
+
kind: "ui",
|
|
346
|
+
fg: "chart-2",
|
|
347
|
+
bg: "paper"
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
kind: "ui",
|
|
351
|
+
fg: "chart-3",
|
|
352
|
+
bg: "paper"
|
|
353
|
+
},
|
|
354
|
+
{
|
|
355
|
+
kind: "ui",
|
|
356
|
+
fg: "chart-4",
|
|
357
|
+
bg: "paper"
|
|
358
|
+
},
|
|
359
|
+
{
|
|
360
|
+
kind: "ui",
|
|
361
|
+
fg: "chart-5",
|
|
362
|
+
bg: "paper"
|
|
363
|
+
}
|
|
364
|
+
];
|
|
365
|
+
/**
|
|
366
|
+
* Pairs that are known not to meet the criterion and are allowed for a stated reason. The key is `<mode>:<foreground>/<background>`.
|
|
367
|
+
*
|
|
368
|
+
* **Write a reason when adding here.** Exception pairs are also checked to still be below the criterion
|
|
369
|
+
* (once they meet it, the test fails and asks for them to be removed from the exceptions, so the list does not drift from reality).
|
|
370
|
+
* A disabled `ink-300` is out of scope in WCAG, so it is not in the pairs at all.
|
|
371
|
+
*/
|
|
372
|
+
const KNOWN_CONTRAST_EXCEPTIONS = {
|
|
373
|
+
"light:border/background": "1px の極薄の枠(#e6e7eb)は面の区切りで、情報は文字と余白・面の明るさの差が持つ。カードや区切り線の輪郭は 3:1 に届かない(1.23:1)。「枠は極めて薄く」を意図した値",
|
|
374
|
+
"dark:border/background": "同上(ダークは 1.24:1)",
|
|
375
|
+
"light:input/background": "**テキスト入力(Input・Textarea・Select のトリガー)の枠だけ**の例外。枠(line-strong #d5d7dd)は 3:1 に届かない(1.4:1)が、入力欄はラベル・プレースホルダ・フォーカス時のインディゴの枠(4.7:1)でも識別できる。Checkbox・Radio・Switch の枠は、文字を持たず形だけで識別されるので例外にせず line-control(3:1 以上)にした",
|
|
376
|
+
"dark:input/background": "同上(ダークは 1.54:1)",
|
|
377
|
+
"light:lt-three/paper": "ブランドのピンク(#ff5c76)は塗りとして使い、必ず黒文字を載せる(7.04:1)。紙の上の単独の図形としては 2.98:1 で 3:1 にわずかに届かない"
|
|
378
|
+
};
|
|
379
|
+
/**
|
|
380
|
+
* Text of the same state on a light fill (such as `bg-state-error/5`, a fill that mixes the state color into the surface by `alpha` only), at 4.5:1 for 12px body text.
|
|
381
|
+
* A translucent composite does not fit in `CONTRAST_PAIRS` (pairs of tokens), so the fill is composited onto the surface color before the ratio is computed (contrast.test.ts).
|
|
382
|
+
* The test also checks that the files in `usedIn` use `tintClass` (when you change alpha, fix this and the components together).
|
|
383
|
+
*/
|
|
384
|
+
const TINTED_STATE_PAIRS = [{
|
|
385
|
+
token: "state-error",
|
|
386
|
+
alpha: .05,
|
|
387
|
+
tintClass: "bg-state-error/5",
|
|
388
|
+
usedIn: [
|
|
389
|
+
"../web/base/badge.tsx",
|
|
390
|
+
"../web/base/alert.tsx",
|
|
391
|
+
"../native/atom/badge.tsx"
|
|
392
|
+
]
|
|
393
|
+
}];
|
|
394
|
+
/** The surfaces a light fill is placed on (the 4 background levels and wash). */
|
|
395
|
+
const TINT_SURFACES = [
|
|
396
|
+
"frame",
|
|
397
|
+
"paper",
|
|
398
|
+
"raised",
|
|
399
|
+
"overlay",
|
|
400
|
+
"wash"
|
|
401
|
+
];
|
|
402
|
+
|
|
403
|
+
//#endregion
|
|
404
|
+
export { CONTRAST_PAIRS, KNOWN_CONTRAST_EXCEPTIONS, TINTED_STATE_PAIRS, TINT_SURFACES };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { TokenName, TokenValues, tokenNames, tokens } from "./tokens.gen.js";
|
|
2
|
+
//#region src/tokens/index.d.ts
|
|
3
|
+
/** A CSS variable reference (`var(--ink-500)`). When you need the actual value, use `tokens.light[name]` / `tokens.dark[name]`. */
|
|
4
|
+
export declare function cssVar(name: TokenName): string;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { type TokenName, type TokenValues, tokenNames, tokens };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { tokenNames, tokens } from "./tokens.gen.js";
|
|
2
|
+
|
|
3
|
+
//#region src/tokens/index.ts
|
|
4
|
+
/** A CSS variable reference (`var(--ink-500)`). When you need the actual value, use `tokens.light[name]` / `tokens.dark[name]`. */
|
|
5
|
+
function cssVar(name) {
|
|
6
|
+
return `var(--${name})`;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
//#endregion
|
|
10
|
+
export { cssVar, tokenNames, tokens };
|