@lt-three/love3 0.1.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 +40 -40
- package/dist/native/analytics/animation.d.ts +1 -1
- package/dist/native/analytics/animation.js +1 -1
- package/dist/native/analytics/chart.types.d.ts +3 -3
- package/dist/native/analytics/metric-card.d.ts +3 -3
- package/dist/native/analytics/metric-card.js +3 -3
- package/dist/native/analytics/multi-line-chart.d.ts +9 -8
- package/dist/native/analytics/multi-line-chart.js +14 -13
- package/dist/native/analytics/pie-chart.d.ts +7 -7
- package/dist/native/analytics/pie-chart.js +8 -8
- package/dist/native/analytics/single-number.d.ts +4 -4
- package/dist/native/analytics/single-number.js +2 -2
- package/dist/native/atom/avatar.d.ts +6 -6
- package/dist/native/atom/avatar.js +2 -2
- package/dist/native/atom/badge.d.ts +5 -5
- package/dist/native/atom/button.d.ts +12 -12
- package/dist/native/atom/button.js +8 -8
- package/dist/native/atom/checkbox.d.ts +4 -4
- package/dist/native/atom/checkbox.js +2 -2
- package/dist/native/atom/colored-value.d.ts +4 -4
- package/dist/native/atom/colored-value.js +4 -4
- package/dist/native/atom/image.d.ts +7 -7
- package/dist/native/atom/image.js +2 -2
- package/dist/native/atom/label.d.ts +5 -5
- package/dist/native/atom/label.js +2 -2
- package/dist/native/atom/link.d.ts +5 -5
- package/dist/native/atom/link.js +5 -5
- package/dist/native/atom/readout.d.ts +7 -7
- package/dist/native/atom/readout.js +3 -3
- package/dist/native/atom/search-input.d.ts +2 -2
- package/dist/native/atom/search-input.js +2 -2
- package/dist/native/atom/select.d.ts +14 -14
- package/dist/native/atom/select.js +8 -8
- package/dist/native/atom/separator.d.ts +2 -3
- package/dist/native/atom/separator.js +2 -3
- package/dist/native/atom/skeleton.d.ts +3 -3
- package/dist/native/atom/skeleton.js +3 -3
- package/dist/native/atom/slider.d.ts +6 -6
- package/dist/native/atom/slider.js +3 -3
- package/dist/native/atom/spinner.d.ts +4 -4
- package/dist/native/atom/spinner.js +2 -2
- package/dist/native/atom/switch.d.ts +4 -4
- package/dist/native/atom/switch.js +3 -3
- package/dist/native/atom/symbol.d.ts +7 -7
- package/dist/native/atom/symbol.js +7 -7
- package/dist/native/atom/symbol.types.d.ts +8 -8
- package/dist/native/atom/symbol.types.js +7 -7
- package/dist/native/atom/text-field.d.ts +15 -15
- package/dist/native/atom/text-field.js +5 -5
- package/dist/native/atom/theme-toggle.d.ts +7 -7
- package/dist/native/atom/theme-toggle.js +4 -4
- package/dist/native/atom/timezone-select.d.ts +5 -5
- package/dist/native/atom/timezone-select.js +4 -4
- package/dist/native/atom/typography.d.ts +2 -2
- package/dist/native/atom/typography.js +2 -2
- package/dist/native/base/button.d.ts +13 -13
- package/dist/native/base/button.js +4 -4
- package/dist/native/base/form.d.ts +15 -15
- package/dist/native/base/form.js +11 -11
- package/dist/native/base/glass-card.d.ts +3 -3
- package/dist/native/base/glass-card.js +3 -3
- package/dist/native/base/input.d.ts +8 -8
- package/dist/native/base/input.js +7 -7
- package/dist/native/base/sheet.d.ts +27 -27
- package/dist/native/base/sheet.js +15 -15
- package/dist/native/form/checkbox.d.ts +3 -3
- package/dist/native/form/checkbox.js +2 -2
- package/dist/native/form/date-picker.d.ts +9 -9
- package/dist/native/form/date-picker.js +9 -9
- package/dist/native/form/form.d.ts +5 -6
- package/dist/native/form/form.js +4 -5
- package/dist/native/form/radio-group.d.ts +5 -5
- package/dist/native/form/radio-group.js +4 -4
- package/dist/native/form/select.d.ts +2 -2
- package/dist/native/form/select.js +2 -2
- package/dist/native/form/slider.d.ts +2 -2
- package/dist/native/form/slider.js +2 -2
- package/dist/native/form/switch.d.ts +2 -2
- package/dist/native/form/switch.js +2 -2
- package/dist/native/form/text-area.d.ts +2 -2
- package/dist/native/form/text-area.js +1 -1
- package/dist/native/form/text-input.d.ts +5 -5
- package/dist/native/form/text-input.js +8 -8
- package/dist/native/layout/accordion.d.ts +5 -5
- package/dist/native/layout/accordion.js +2 -2
- package/dist/native/layout/card.d.ts +8 -8
- package/dist/native/layout/card.js +3 -3
- package/dist/native/layout/description.d.ts +2 -2
- package/dist/native/layout/description.js +2 -2
- package/dist/native/layout/error.d.ts +5 -5
- package/dist/native/layout/error.js +2 -2
- package/dist/native/layout/information.d.ts +4 -4
- package/dist/native/layout/information.js +3 -3
- package/dist/native/layout/locked.d.ts +15 -15
- package/dist/native/layout/locked.js +7 -7
- package/dist/native/layout/modal.d.ts +8 -8
- package/dist/native/layout/modal.js +5 -5
- package/dist/native/layout/not-found.d.ts +4 -4
- package/dist/native/layout/not-found.js +3 -3
- package/dist/native/layout/page-frame.d.ts +8 -8
- package/dist/native/layout/page-frame.js +3 -3
- package/dist/native/layout/panel.d.ts +5 -5
- package/dist/native/layout/panel.js +5 -5
- package/dist/native/layout/reorderable-list.d.ts +14 -14
- package/dist/native/layout/reorderable-list.js +10 -10
- package/dist/native/layout/sheet.d.ts +10 -10
- package/dist/native/layout/sheet.js +4 -4
- package/dist/native/layout/simple-dialog.d.ts +3 -3
- package/dist/native/layout/simple-dialog.js +2 -2
- package/dist/native/layout/simple-table.d.ts +18 -18
- package/dist/native/layout/simple-table.js +1 -1
- package/dist/native/layout/tab-bar.d.ts +10 -10
- package/dist/native/layout/tab-bar.js +4 -4
- package/dist/native/layout/tabs.d.ts +6 -6
- package/dist/native/layout/tabs.js +4 -4
- package/dist/native/layout/tuning-panel.d.ts +10 -10
- package/dist/native/layout/tuning-panel.js +15 -15
- package/dist/native/lib/autocomplete.d.ts +1 -1
- package/dist/native/lib/autocomplete.js +1 -1
- package/dist/native/lib/breakpoints.d.ts +3 -3
- package/dist/native/lib/breakpoints.js +3 -3
- package/dist/native/lib/chart-palette.d.ts +2 -2
- package/dist/native/lib/chart-palette.js +2 -2
- package/dist/native/lib/confirm.d.ts +15 -16
- package/dist/native/lib/confirm.js +9 -10
- package/dist/native/lib/control.d.ts +9 -9
- package/dist/native/lib/external-store.d.ts +4 -5
- package/dist/native/lib/keyboard.d.ts +7 -7
- package/dist/native/lib/keyboard.js +7 -7
- package/dist/native/lib/labels.d.ts +6 -6
- package/dist/native/lib/labels.js +6 -6
- package/dist/native/lib/loading.d.ts +3 -3
- package/dist/native/lib/loading.js +3 -3
- package/dist/native/lib/network.d.ts +5 -6
- package/dist/native/lib/network.js +5 -6
- package/dist/native/lib/scheme.d.ts +7 -7
- package/dist/native/lib/scheme.js +3 -3
- package/dist/native/lib/snackbar.d.ts +12 -13
- package/dist/native/lib/snackbar.js +7 -8
- package/dist/native/lib/theme.d.ts +15 -15
- package/dist/native/lib/theme.js +15 -15
- package/dist/native/lib/timezone.d.ts +13 -13
- package/dist/native/lib/timezone.js +13 -13
- package/dist/native/lib/token-color.d.ts +1 -1
- package/dist/native/lib/token-color.js +1 -1
- package/dist/native/lib/tuning-context.d.ts +2 -2
- package/dist/native/lib/tuning.d.ts +10 -10
- package/dist/native/lib/tuning.js +8 -8
- package/dist/native/lib/typography.d.ts +3 -3
- package/dist/native/lib/typography.js +3 -3
- package/dist/native/lib/utils.d.ts +3 -3
- package/dist/native/lib/utils.js +3 -3
- package/dist/native/once/confirm.d.ts +2 -2
- package/dist/native/once/confirm.js +2 -2
- package/dist/native/once/error-boundary.d.ts +3 -3
- package/dist/native/once/error-boundary.js +2 -2
- package/dist/native/once/loading-lock.d.ts +3 -3
- package/dist/native/once/loading-lock.js +3 -3
- package/dist/native/once/offline-banner.d.ts +6 -6
- package/dist/native/once/offline-banner.js +5 -5
- package/dist/native/once/snackbar.d.ts +7 -7
- package/dist/native/once/snackbar.js +5 -5
- package/dist/native/styles.css +21 -21
- package/dist/shared/analytics.d.ts +23 -23
- package/dist/shared/button.d.ts +1 -1
- package/dist/shared/form.d.ts +7 -7
- package/dist/shared/form.js +2 -2
- package/dist/tokens/contrast-pairs.d.ts +9 -9
- package/dist/tokens/contrast-pairs.js +10 -10
- package/dist/tokens/index.d.ts +1 -1
- package/dist/tokens/index.js +1 -1
- package/dist/tokens/styles.gen.css +87 -87
- package/dist/tokens/tokens.gen.d.ts +2 -2
- package/dist/tokens/tokens.gen.js +2 -2
- package/dist/tuning/catalog.d.ts +8 -8
- package/dist/tuning/catalog.js +9 -9
- package/dist/tuning/color.d.ts +4 -4
- package/dist/tuning/color.js +5 -5
- package/dist/tuning/css.d.ts +13 -13
- package/dist/tuning/css.js +17 -17
- package/dist/tuning/model.d.ts +11 -11
- package/dist/tuning/model.js +11 -11
- package/dist/tuning/native.d.ts +18 -18
- package/dist/tuning/native.js +18 -18
- package/dist/tuning/schema.d.ts +15 -15
- package/dist/tuning/schema.js +22 -22
- package/dist/tuning/types.d.ts +25 -25
- package/dist/tuning/types.js +6 -6
- package/dist/web/analytics/line-chart.d.ts +6 -6
- package/dist/web/analytics/line-chart.js +3 -3
- package/dist/web/analytics/metric-card.d.ts +6 -6
- package/dist/web/analytics/metric-card.js +5 -5
- package/dist/web/analytics/multi-line-chart.d.ts +23 -23
- package/dist/web/analytics/multi-line-chart.js +33 -33
- package/dist/web/atom/avatar.d.ts +1 -1
- package/dist/web/atom/checkbox.d.ts +6 -6
- package/dist/web/atom/checkbox.js +2 -2
- package/dist/web/atom/colored-value.d.ts +4 -4
- package/dist/web/atom/colored-value.js +4 -4
- package/dist/web/atom/help.d.ts +1 -1
- package/dist/web/atom/segmented-control.d.ts +13 -14
- package/dist/web/atom/segmented-control.js +6 -7
- package/dist/web/atom/select.d.ts +7 -7
- package/dist/web/atom/select.js +5 -5
- package/dist/web/atom/slider.d.ts +3 -3
- package/dist/web/atom/slider.js +2 -2
- package/dist/web/atom/switch.d.ts +3 -3
- package/dist/web/atom/text-area.d.ts +9 -8
- package/dist/web/atom/text-area.js +9 -8
- package/dist/web/atom/text-field.d.ts +5 -4
- package/dist/web/atom/text-field.js +5 -4
- package/dist/web/atom/toggle-chip.d.ts +6 -6
- package/dist/web/atom/toggle-chip.js +4 -4
- package/dist/web/atom/tooltip.d.ts +6 -6
- package/dist/web/atom/tooltip.js +2 -2
- package/dist/web/base/accordion.js +1 -1
- package/dist/web/base/breadcrumb.d.ts +1 -1
- package/dist/web/base/breadcrumb.js +1 -1
- package/dist/web/base/card.d.ts +3 -3
- package/dist/web/base/card.js +2 -2
- package/dist/web/base/dialog.d.ts +1 -1
- package/dist/web/base/dialog.js +1 -1
- package/dist/web/base/form.d.ts +7 -7
- package/dist/web/base/form.js +5 -5
- package/dist/web/base/pagination.d.ts +5 -5
- package/dist/web/base/pagination.js +1 -1
- package/dist/web/base/sheet.d.ts +1 -1
- package/dist/web/base/sheet.js +1 -1
- package/dist/web/base/slider.d.ts +1 -1
- package/dist/web/base/sonner.d.ts +2 -2
- package/dist/web/base/sonner.js +2 -2
- package/dist/web/base/spinner.js +1 -1
- package/dist/web/form/checkbox.d.ts +8 -8
- package/dist/web/form/checkbox.js +3 -3
- package/dist/web/form/radio-group.js +3 -3
- package/dist/web/form/select.js +1 -1
- package/dist/web/form/slider.d.ts +3 -3
- package/dist/web/form/slider.js +3 -3
- package/dist/web/form/switch.d.ts +3 -3
- package/dist/web/form/switch.js +4 -4
- package/dist/web/form/text-area.js +1 -1
- package/dist/web/form/text-input.d.ts +1 -1
- package/dist/web/form/text-input.js +1 -1
- package/dist/web/layout/accordion.d.ts +5 -5
- package/dist/web/layout/accordion.js +2 -2
- package/dist/web/layout/alert-modal.d.ts +11 -11
- package/dist/web/layout/alert-modal.js +7 -7
- package/dist/web/layout/card.d.ts +1 -1
- package/dist/web/layout/information.d.ts +9 -9
- package/dist/web/layout/information.js +7 -7
- package/dist/web/layout/modal.d.ts +1 -1
- package/dist/web/layout/page-frame.d.ts +14 -14
- package/dist/web/layout/page-frame.js +7 -7
- package/dist/web/layout/scroll-area.d.ts +1 -1
- package/dist/web/layout/sheet.d.ts +4 -4
- package/dist/web/layout/simple-table.d.ts +18 -18
- package/dist/web/layout/simple-table.js +2 -2
- package/dist/web/layout/tabs.d.ts +4 -4
- package/dist/web/layout/titled-modal.d.ts +10 -11
- package/dist/web/layout/titled-modal.js +7 -8
- package/dist/web/lib/css-vars.d.ts +6 -6
- package/dist/web/lib/css-vars.js +5 -5
- package/dist/web/lib/dialog.d.ts +4 -4
- package/dist/web/lib/labels.d.ts +8 -8
- package/dist/web/lib/labels.js +8 -8
- package/dist/web/lib/modal-open-focus.d.ts +7 -7
- package/dist/web/lib/modal-open-focus.js +9 -9
- package/dist/web/lib/restore-focus.d.ts +4 -4
- package/dist/web/lib/restore-focus.js +4 -4
- package/dist/web/styles.css +33 -33
- package/package.json +2 -2
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
//#region src/native/once/snackbar.d.ts
|
|
2
2
|
export type SnackbarProps = {
|
|
3
|
-
/**
|
|
3
|
+
/** Whether toasts appear from the top edge (default) or the bottom edge. */
|
|
4
4
|
position?: "top" | "bottom";
|
|
5
|
-
/**
|
|
5
|
+
/** Spoken name of each toast's close button (default "閉じる", i.e. "Close"). */
|
|
6
6
|
closeLabel?: string;
|
|
7
7
|
};
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
9
|
+
* The home for toasts. Place exactly one at the app root (make the parent a full-screen View; the position is the top or bottom edge of that parent).
|
|
10
|
+
* Corresponds to the web `once/snackbar` (sonner's Toaster).
|
|
11
|
+
* The root needs `react-native-safe-area-context`'s `SafeAreaProvider` (Expo Router includes it by default).
|
|
12
12
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
13
|
+
* Show toasts with `snackbar()` from `lib/snackbar.ts`. **Nothing appears unless this is mounted** (in development `snackbar()` warns).
|
|
14
|
+
* Errors use `role="alert"` and everything else `role="status"` (read out by assistive technology). iOS has no live region, so `announceForAccessibility` reads it out when a toast appears.
|
|
15
15
|
*/
|
|
16
16
|
export declare function Snackbar({ position, closeLabel }: SnackbarProps): import("react").JSX.Element | null;
|
|
17
17
|
//#endregion
|
|
@@ -16,12 +16,12 @@ const ICON = {
|
|
|
16
16
|
warning: "alert-triangle"
|
|
17
17
|
};
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
19
|
+
* The home for toasts. Place exactly one at the app root (make the parent a full-screen View; the position is the top or bottom edge of that parent).
|
|
20
|
+
* Corresponds to the web `once/snackbar` (sonner's Toaster).
|
|
21
|
+
* The root needs `react-native-safe-area-context`'s `SafeAreaProvider` (Expo Router includes it by default).
|
|
22
22
|
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
23
|
+
* Show toasts with `snackbar()` from `lib/snackbar.ts`. **Nothing appears unless this is mounted** (in development `snackbar()` warns).
|
|
24
|
+
* Errors use `role="alert"` and everything else `role="status"` (read out by assistive technology). iOS has no live region, so `announceForAccessibility` reads it out when a toast appears.
|
|
25
25
|
*/
|
|
26
26
|
function Snackbar({ position = "top", closeLabel = CLOSE_LABEL }) {
|
|
27
27
|
const items = snackbarStore.use();
|
package/dist/native/styles.css
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* love3
|
|
3
|
-
*
|
|
2
|
+
* love3's native styles (`@lt-three/love3/native/styles.css`). **The CSS entry point for Metro (real devices)**.
|
|
3
|
+
* Import it exactly once in the app's `global.css` (NativeWind v5 / react-native-css compiles it as Tailwind v4).
|
|
4
4
|
*
|
|
5
5
|
* @import "@lt-three/love3/native/styles.css";
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
7
|
+
* **Not the same as `native/web/styles.css`.** That one is the entry point used when preview and vitest draw with react-native-web
|
|
8
|
+
* (it rides on web Tailwind, so `nativewind/theme` is not needed, and dark is `<html class="dark">`). It is not used on real devices.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
10
|
+
* Contents: the Tailwind v4 core, the NativeWind theme, the tokens (`@lt-three/love3/styles.css`), and detection of component classes.
|
|
11
|
+
* Token values live in `src/tokens/definition.ts` (the single source of truth). No tokens are written here.
|
|
12
12
|
*/
|
|
13
13
|
@import "tailwindcss/theme.css" layer(theme);
|
|
14
14
|
@import "tailwindcss/preflight.css" layer(base);
|
|
@@ -16,31 +16,31 @@
|
|
|
16
16
|
|
|
17
17
|
@import "nativewind/theme";
|
|
18
18
|
|
|
19
|
-
/*
|
|
19
|
+
/* The token body (@theme, light, dark). It is generated, so to change values, edit definition.ts */
|
|
20
20
|
@import "@lt-three/love3/styles.css";
|
|
21
21
|
|
|
22
22
|
/*
|
|
23
|
-
* love3
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* `web/`
|
|
23
|
+
* Pick up the Tailwind classes used by love3's native components. node_modules (through the workspace symlink) is
|
|
24
|
+
* outside automatic detection, so it is listed explicitly here. The `@source` paths are relative to this CSS file's location.
|
|
25
|
+
* In the published package (`dist/`) components are `*.js`, so both `tsx` and `js` are picked up (the same files exist in both src and dist).
|
|
26
|
+
* `web/` is a helper for react-native-web (it has no classes), so it is excluded.
|
|
27
27
|
*/
|
|
28
28
|
@source "./**/*.{tsx,js}";
|
|
29
29
|
@source not "./**/*.test.tsx";
|
|
30
30
|
@source not "./web/**";
|
|
31
31
|
|
|
32
32
|
/*
|
|
33
|
-
* native
|
|
33
|
+
* On native, `dark:` is resolved **by the OS color scheme setting, not by a class**.
|
|
34
34
|
*
|
|
35
|
-
* `@lt-three/love3/styles.css`
|
|
36
|
-
*
|
|
37
|
-
* react-native-css
|
|
38
|
-
* hover/active/focus
|
|
39
|
-
*
|
|
40
|
-
*
|
|
35
|
+
* The default of `@lt-three/love3/styles.css` is `&:is(.dark *)` (it assumes web's `<html class="dark">`).
|
|
36
|
+
* Using that on native too would make `.dark` appear as an ancestor selector of rules that have `dark:`,
|
|
37
|
+
* so react-native-css would treat a view with `.dark` as a **container**
|
|
38
|
+
* and attach hover/active/focus tracking handlers. Then **a ScrollView among that view's descendants
|
|
39
|
+
* can no longer receive pan, and the whole app becomes unscrollable**
|
|
40
|
+
* (taps still go through, so it is easy to miss; confirmed on a real device).
|
|
41
41
|
*
|
|
42
|
-
* OS
|
|
43
|
-
*
|
|
44
|
-
* `lib/tokens-check.ts
|
|
42
|
+
* The OS color scheme can be switched with `Appearance.setColorScheme()` (`ThemeRoot` does this), so
|
|
43
|
+
* the app's in-app theme setting keeps working as before. `.dark` goes back to being a class that **only distributes variables**.
|
|
44
|
+
* `lib/tokens-check.ts` (`tokens.test.ts`) guards that no class creates a container.
|
|
45
45
|
*/
|
|
46
46
|
@custom-variant dark (@media (prefers-color-scheme: dark));
|
|
@@ -1,70 +1,70 @@
|
|
|
1
1
|
//#region src/shared/analytics.d.ts
|
|
2
2
|
export type LinePoint = {
|
|
3
|
-
/**
|
|
3
|
+
/** The heading shown in the readout (a date, for example). */
|
|
4
4
|
x: string | number;
|
|
5
5
|
y: number;
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* The value used for the horizontal position (a continuous quantity such as Unix seconds).
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
9
|
+
* **Always set it when overlaying multiple series.** When omitted, points are spaced evenly by order,
|
|
10
|
+
* so when series with different intervals (a daily balance and irregularly spaced equity) are overlaid,
|
|
11
|
+
* the same horizontal position would point to different times.
|
|
12
12
|
*/
|
|
13
13
|
t?: number;
|
|
14
14
|
};
|
|
15
|
-
/**
|
|
15
|
+
/** One line of a multi-series line chart. */
|
|
16
16
|
export type LineSeries = {
|
|
17
|
-
/** React
|
|
17
|
+
/** The React key and the identifier of the series. */
|
|
18
18
|
key: string;
|
|
19
|
-
/**
|
|
19
|
+
/** The name shown in the legend. */
|
|
20
20
|
label: string;
|
|
21
21
|
points: LinePoint[];
|
|
22
|
-
/**
|
|
22
|
+
/** The line color. A CSS color (a token reference such as `var(--chart-1)` is recommended). */
|
|
23
23
|
color: string;
|
|
24
|
-
/**
|
|
24
|
+
/** Draw the line dashed (to tell a secondary series from the primary one). */
|
|
25
25
|
dashed?: boolean;
|
|
26
26
|
};
|
|
27
|
-
/**
|
|
27
|
+
/** The line chart props for visual dimensions and the spoken summary (shared by web and native). */
|
|
28
28
|
export type ChartCommonProps = {
|
|
29
29
|
height?: number;
|
|
30
30
|
/**
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
31
|
+
* A summary of the chart for screen readers (for example: "The balance rose from $1,000 on January 1 to $1,210 on the 7th"). When passed, it becomes the
|
|
32
|
+
* name of `role="img"`. **The graphic (svg) itself has no name**, so this is how the values reach users who cannot read them
|
|
33
|
+
* (screen reader and keyboard users). This is a shared package, so the wording is left to the consumer.
|
|
34
34
|
*/
|
|
35
35
|
accessibilityLabel?: string;
|
|
36
36
|
};
|
|
37
|
-
/**
|
|
37
|
+
/** A single-series line chart (`LineChart`). */
|
|
38
38
|
export type LineChartSharedProps = {
|
|
39
39
|
data: LinePoint[];
|
|
40
40
|
color?: string;
|
|
41
41
|
};
|
|
42
|
-
/**
|
|
42
|
+
/** A multi-series line chart (`MultiLineChart`). */
|
|
43
43
|
export type MultiLineChartSharedProps = {
|
|
44
44
|
series: LineSeries[];
|
|
45
|
-
/**
|
|
45
|
+
/** Formats the vertical axis ticks. Currency symbols and the like are decided by the consumer. */
|
|
46
46
|
formatValue?: (value: number) => string;
|
|
47
|
-
/**
|
|
47
|
+
/** The text shown when every series is empty. */
|
|
48
48
|
emptyText?: string;
|
|
49
49
|
};
|
|
50
|
-
/**
|
|
50
|
+
/** A single metric on a surface (`MetricCard`). */
|
|
51
51
|
export type MetricCardSharedProps = {
|
|
52
52
|
label: string;
|
|
53
53
|
value: string;
|
|
54
54
|
subValue?: string;
|
|
55
|
-
/**
|
|
55
|
+
/** The sign of the change. The value is colored state-success when positive and state-error when negative (token colors; they follow dark mode too). */
|
|
56
56
|
trend?: number;
|
|
57
57
|
className?: string;
|
|
58
58
|
};
|
|
59
|
-
/**
|
|
59
|
+
/** A number whose color changes with its sign (`ColoredValue`). */
|
|
60
60
|
export interface ColoredValueSharedProps<TValue> {
|
|
61
61
|
value: TValue;
|
|
62
62
|
format?: (value: TValue) => string;
|
|
63
63
|
isPositive?: (value: TValue) => boolean;
|
|
64
64
|
isNegative?: (value: TValue) => boolean;
|
|
65
|
-
/**
|
|
65
|
+
/** The class for an increase. Defaults to `text-state-success` (a token; follows dark mode). */
|
|
66
66
|
positiveColor?: string;
|
|
67
|
-
/**
|
|
67
|
+
/** The class for a decrease. Defaults to `text-state-error`. */
|
|
68
68
|
negativeColor?: string;
|
|
69
69
|
className?: string;
|
|
70
70
|
}
|
package/dist/shared/button.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//#region src/shared/button.d.ts
|
|
2
2
|
export declare const BUTTON_VARIANTS: readonly ["default", "destructive", "outline", "secondary", "ghost", "link", "plate", "<3"];
|
|
3
|
-
/** `"<3"`
|
|
3
|
+
/** `"<3"` is the Less Than Three brand color (pink fill). Meant for a confirming action, placed only once per screen */
|
|
4
4
|
export type ButtonVariant = (typeof BUTTON_VARIANTS)[number];
|
|
5
5
|
export declare const BUTTON_SIZES: readonly ["default", "xs", "sm", "lg", "xl", "icon", "icon-xs"];
|
|
6
6
|
export type ButtonSize = (typeof BUTTON_SIZES)[number];
|
package/dist/shared/form.d.ts
CHANGED
|
@@ -3,13 +3,13 @@ import React from "react";
|
|
|
3
3
|
//#region src/shared/form.d.ts
|
|
4
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
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
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
8
|
*/
|
|
9
9
|
export declare function useOptionalFieldContext(): AnyFieldApi | null;
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
12
|
-
* `value` / `onValueChange`
|
|
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
13
|
*/
|
|
14
14
|
export type FieldInputProps = {
|
|
15
15
|
label?: React.ReactNode;
|
|
@@ -21,12 +21,12 @@ export type FieldInputProps = {
|
|
|
21
21
|
disabled?: boolean;
|
|
22
22
|
helpText?: React.ReactNode;
|
|
23
23
|
debounce?: number;
|
|
24
|
-
/**
|
|
24
|
+
/** A data-testid for tests. It is applied as is to the actual input element. */
|
|
25
25
|
"data-testid"?: string;
|
|
26
26
|
};
|
|
27
27
|
/**
|
|
28
|
-
* `FieldInputProps`
|
|
29
|
-
*
|
|
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
30
|
*/
|
|
31
31
|
export type BaseInputProps<T> = FieldInputProps & ({
|
|
32
32
|
value: T;
|
package/dist/shared/form.js
CHANGED
|
@@ -6,8 +6,8 @@ import { useContext, useState } from "react";
|
|
|
6
6
|
//#region src/shared/form.ts
|
|
7
7
|
const { fieldContext, formContext, useFormContext, useFieldContext } = createFormHookContexts();
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
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
11
|
*/
|
|
12
12
|
function useOptionalFieldContext() {
|
|
13
13
|
return useContext(fieldContext);
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
//#region src/tokens/contrast-pairs.d.ts
|
|
2
2
|
export type ContrastKind = "text" | "ui";
|
|
3
|
-
/**
|
|
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
4
|
export declare const CONTRAST_PAIRS: ReadonlyArray<{
|
|
5
5
|
kind: ContrastKind;
|
|
6
6
|
fg: string;
|
|
7
7
|
bg: string;
|
|
8
8
|
}>;
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* Pairs that are known not to meet the criterion and are allowed for a stated reason. The key is `<mode>:<foreground>/<background>`.
|
|
11
11
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
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
15
|
*/
|
|
16
16
|
export declare const KNOWN_CONTRAST_EXCEPTIONS: Readonly<Record<string, string>>;
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* `usedIn`
|
|
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
21
|
*/
|
|
22
22
|
export declare const TINTED_STATE_PAIRS: ReadonlyArray<{
|
|
23
23
|
token: string;
|
|
@@ -25,6 +25,6 @@ export declare const TINTED_STATE_PAIRS: ReadonlyArray<{
|
|
|
25
25
|
tintClass: string;
|
|
26
26
|
usedIn: readonly string[];
|
|
27
27
|
}>;
|
|
28
|
-
/**
|
|
28
|
+
/** The surfaces a light fill is placed on (the 4 background levels and wash). */
|
|
29
29
|
export declare const TINT_SURFACES: readonly ["frame", "paper", "raised", "overlay", "wash"];
|
|
30
30
|
//#endregion
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/tokens/contrast-pairs.ts
|
|
2
|
-
/**
|
|
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
3
|
const CONTRAST_PAIRS = [
|
|
4
4
|
{
|
|
5
5
|
kind: "text",
|
|
@@ -363,23 +363,23 @@ const CONTRAST_PAIRS = [
|
|
|
363
363
|
}
|
|
364
364
|
];
|
|
365
365
|
/**
|
|
366
|
-
*
|
|
366
|
+
* Pairs that are known not to meet the criterion and are allowed for a stated reason. The key is `<mode>:<foreground>/<background>`.
|
|
367
367
|
*
|
|
368
|
-
*
|
|
369
|
-
*
|
|
370
|
-
*
|
|
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
371
|
*/
|
|
372
372
|
const KNOWN_CONTRAST_EXCEPTIONS = {
|
|
373
|
-
"light:border/background": "1px の極薄の枠(#e6e7eb)は面の区切りで、情報は文字と余白・面の明るさの差が持つ。カードや区切り線の輪郭は 3:1 に届かない(1.23:1
|
|
373
|
+
"light:border/background": "1px の極薄の枠(#e6e7eb)は面の区切りで、情報は文字と余白・面の明るさの差が持つ。カードや区切り線の輪郭は 3:1 に届かない(1.23:1)。「枠は極めて薄く」を意図した値",
|
|
374
374
|
"dark:border/background": "同上(ダークは 1.24:1)",
|
|
375
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
376
|
"dark:input/background": "同上(ダークは 1.54:1)",
|
|
377
377
|
"light:lt-three/paper": "ブランドのピンク(#ff5c76)は塗りとして使い、必ず黒文字を載せる(7.04:1)。紙の上の単独の図形としては 2.98:1 で 3:1 にわずかに届かない"
|
|
378
378
|
};
|
|
379
379
|
/**
|
|
380
|
-
*
|
|
381
|
-
*
|
|
382
|
-
* `usedIn`
|
|
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
383
|
*/
|
|
384
384
|
const TINTED_STATE_PAIRS = [{
|
|
385
385
|
token: "state-error",
|
|
@@ -391,7 +391,7 @@ const TINTED_STATE_PAIRS = [{
|
|
|
391
391
|
"../native/atom/badge.tsx"
|
|
392
392
|
]
|
|
393
393
|
}];
|
|
394
|
-
/**
|
|
394
|
+
/** The surfaces a light fill is placed on (the 4 background levels and wash). */
|
|
395
395
|
const TINT_SURFACES = [
|
|
396
396
|
"frame",
|
|
397
397
|
"paper",
|
package/dist/tokens/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TokenName, TokenValues, tokenNames, tokens } from "./tokens.gen.js";
|
|
2
2
|
//#region src/tokens/index.d.ts
|
|
3
|
-
/** CSS
|
|
3
|
+
/** A CSS variable reference (`var(--ink-500)`). When you need the actual value, use `tokens.light[name]` / `tokens.dark[name]`. */
|
|
4
4
|
export declare function cssVar(name: TokenName): string;
|
|
5
5
|
//#endregion
|
|
6
6
|
export { type TokenName, type TokenValues, tokenNames, tokens };
|
package/dist/tokens/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { tokenNames, tokens } from "./tokens.gen.js";
|
|
2
2
|
|
|
3
3
|
//#region src/tokens/index.ts
|
|
4
|
-
/** CSS
|
|
4
|
+
/** A CSS variable reference (`var(--ink-500)`). When you need the actual value, use `tokens.light[name]` / `tokens.dark[name]`. */
|
|
5
5
|
function cssVar(name) {
|
|
6
6
|
return `var(--${name})`;
|
|
7
7
|
}
|