@trama-ui/react-native 0.0.0-stage → 0.7.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.
Files changed (111) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +198 -2
  3. package/dist/accordion.d.ts +29 -0
  4. package/dist/accordion.js +137 -0
  5. package/dist/alert.d.ts +30 -0
  6. package/dist/alert.js +95 -0
  7. package/dist/avatar.d.ts +36 -0
  8. package/dist/avatar.js +91 -0
  9. package/dist/bars.d.ts +44 -0
  10. package/dist/bars.js +74 -0
  11. package/dist/button.d.ts +30 -0
  12. package/dist/button.js +90 -0
  13. package/dist/calendar.d.ts +71 -0
  14. package/dist/calendar.js +276 -0
  15. package/dist/card.d.ts +41 -0
  16. package/dist/card.js +139 -0
  17. package/dist/choices.d.ts +87 -0
  18. package/dist/choices.js +228 -0
  19. package/dist/collections.d.ts +131 -0
  20. package/dist/collections.js +230 -0
  21. package/dist/color-code.d.ts +37 -0
  22. package/dist/color-code.js +158 -0
  23. package/dist/compositions.d.ts +110 -0
  24. package/dist/compositions.js +190 -0
  25. package/dist/controls.d.ts +85 -0
  26. package/dist/controls.js +221 -0
  27. package/dist/drag-drop.d.ts +65 -0
  28. package/dist/drag-drop.js +482 -0
  29. package/dist/feedback.d.ts +30 -0
  30. package/dist/feedback.js +81 -0
  31. package/dist/file-upload.d.ts +67 -0
  32. package/dist/file-upload.js +251 -0
  33. package/dist/generated/icons.d.ts +1037 -0
  34. package/dist/generated/icons.js +3 -0
  35. package/dist/generated/tokens.d.ts +64 -0
  36. package/dist/generated/tokens.js +65 -0
  37. package/dist/icon.d.ts +31 -0
  38. package/dist/icon.js +28 -0
  39. package/dist/index.d.ts +43 -0
  40. package/dist/index.js +43 -0
  41. package/dist/input.d.ts +43 -0
  42. package/dist/input.js +115 -0
  43. package/dist/interactive-layout.d.ts +26 -0
  44. package/dist/interactive-layout.js +117 -0
  45. package/dist/internal/content.d.ts +17 -0
  46. package/dist/internal/content.js +24 -0
  47. package/dist/internal/drag-geometry.d.ts +16 -0
  48. package/dist/internal/drag-geometry.js +25 -0
  49. package/dist/internal/keyboard.d.ts +20 -0
  50. package/dist/internal/keyboard.js +101 -0
  51. package/dist/internal/motion.d.ts +1 -0
  52. package/dist/internal/motion.js +24 -0
  53. package/dist/internal/number-format.d.ts +4 -0
  54. package/dist/internal/number-format.js +25 -0
  55. package/dist/internal/pointer-capture.d.ts +1 -0
  56. package/dist/internal/pointer-capture.js +16 -0
  57. package/dist/internal/state.d.ts +6 -0
  58. package/dist/internal/state.js +28 -0
  59. package/dist/internal/system-drag.d.ts +48 -0
  60. package/dist/internal/system-drag.js +93 -0
  61. package/dist/internal/table-drag.d.ts +56 -0
  62. package/dist/internal/table-drag.js +237 -0
  63. package/dist/internal/table-editing.d.ts +49 -0
  64. package/dist/internal/table-editing.js +278 -0
  65. package/dist/internal/table-editor.d.ts +11 -0
  66. package/dist/internal/table-editor.js +31 -0
  67. package/dist/internal/table-grid.d.ts +44 -0
  68. package/dist/internal/table-grid.js +153 -0
  69. package/dist/internal/table-model.d.ts +132 -0
  70. package/dist/internal/table-model.js +231 -0
  71. package/dist/internal/table-source.d.ts +9 -0
  72. package/dist/internal/table-source.js +80 -0
  73. package/dist/internal/tour-target.d.ts +23 -0
  74. package/dist/internal/tour-target.js +81 -0
  75. package/dist/keyboard.d.ts +14 -0
  76. package/dist/keyboard.js +27 -0
  77. package/dist/layout.d.ts +35 -0
  78. package/dist/layout.js +77 -0
  79. package/dist/loader.d.ts +18 -0
  80. package/dist/loader.js +79 -0
  81. package/dist/localization.d.ts +106 -0
  82. package/dist/localization.js +310 -0
  83. package/dist/media.d.ts +35 -0
  84. package/dist/media.js +96 -0
  85. package/dist/menus.d.ts +103 -0
  86. package/dist/menus.js +422 -0
  87. package/dist/navigation.d.ts +111 -0
  88. package/dist/navigation.js +255 -0
  89. package/dist/overlays.d.ts +97 -0
  90. package/dist/overlays.js +364 -0
  91. package/dist/pill.d.ts +33 -0
  92. package/dist/pill.js +90 -0
  93. package/dist/progress.d.ts +27 -0
  94. package/dist/progress.js +154 -0
  95. package/dist/responsive.d.ts +15 -0
  96. package/dist/responsive.js +27 -0
  97. package/dist/select.d.ts +74 -0
  98. package/dist/select.js +181 -0
  99. package/dist/separator.d.ts +13 -0
  100. package/dist/separator.js +34 -0
  101. package/dist/switch.d.ts +26 -0
  102. package/dist/switch.js +69 -0
  103. package/dist/table.d.ts +122 -0
  104. package/dist/table.js +928 -0
  105. package/dist/text-fields.d.ts +39 -0
  106. package/dist/text-fields.js +134 -0
  107. package/dist/theme.d.ts +47 -0
  108. package/dist/theme.js +71 -0
  109. package/dist/transient.d.ts +80 -0
  110. package/dist/transient.js +273 -0
  111. package/package.json +50 -4
@@ -0,0 +1,81 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useRef, useState } from 'react';
3
+ import { StyleSheet, View, useWindowDimensions } from 'react-native';
4
+ import { useTramaTheme } from '../theme.js';
5
+ export function useTourTarget(step, active, onMissing) {
6
+ const { width, height } = useWindowDimensions();
7
+ const [measured, setMeasured] = useState();
8
+ const target = step?.target;
9
+ const value = step?.value;
10
+ const callbacks = useRef({ prepare: step?.prepareTarget, onMissing });
11
+ callbacks.current = { prepare: step?.prepareTarget, onMissing };
12
+ useEffect(() => {
13
+ if (!active || !target || value === undefined)
14
+ return;
15
+ const lifetime = new AbortController();
16
+ const { signal } = lifetime;
17
+ setMeasured(undefined);
18
+ let timer;
19
+ let finished = false;
20
+ const finish = (box) => {
21
+ if (finished || signal.aborted)
22
+ return;
23
+ finished = true;
24
+ clearInterval(timer);
25
+ if (box)
26
+ setMeasured({ value, target, box });
27
+ else
28
+ callbacks.current.onMissing?.(value);
29
+ };
30
+ void Promise.resolve()
31
+ .then(() => !signal.aborted && callbacks.current.prepare?.(signal))
32
+ .then(() => {
33
+ if (signal.aborted)
34
+ return;
35
+ let attempts = 0;
36
+ function measure() {
37
+ if (attempts++ >= 12) {
38
+ finish();
39
+ return;
40
+ }
41
+ target?.current?.measureInWindow((x, y, w, h) => {
42
+ if (w > 0 && h > 0 && x < width && y < height && x + w > 0 && y + h > 0)
43
+ finish({ x, y, width: w, height: h });
44
+ });
45
+ }
46
+ timer = setInterval(measure, 42);
47
+ measure();
48
+ })
49
+ .catch(() => finish());
50
+ return () => {
51
+ lifetime.abort();
52
+ clearInterval(timer);
53
+ };
54
+ }, [active, target, value, width, height]);
55
+ return active && measured && measured.value === value && measured.target === target ? measured.box : undefined;
56
+ }
57
+ export function TourMask({ target, gap, color, testID }) {
58
+ const theme = useTramaTheme();
59
+ const surface = useRef(null);
60
+ const [frame, setFrame] = useState();
61
+ const fits = (value, max) => Math.min(max, Math.max(0, value));
62
+ const inset = Number.isFinite(gap) ? Math.max(0, gap) : theme.space * 2;
63
+ const left = frame ? fits(target.x - frame.x - inset, frame.width) : 0;
64
+ const top = frame ? fits(target.y - frame.y - inset, frame.height) : 0;
65
+ const right = frame ? fits(target.x - frame.x + target.width + inset, frame.width) : 0;
66
+ const bottom = frame ? fits(target.y - frame.y + target.height + inset, frame.height) : 0;
67
+ const shade = { position: 'absolute', backgroundColor: color };
68
+ return (_jsx(View, { ref: surface, collapsable: false, pointerEvents: "none", style: [StyleSheet.absoluteFill, { direction: 'ltr' }], onLayout: () => surface.current?.measureInWindow((x, y, width, height) => {
69
+ if (width > 0 && height > 0)
70
+ setFrame({ x, y, width, height });
71
+ }), children: right > left && bottom > top ? (_jsxs(_Fragment, { children: [_jsx(View, { style: [shade, { start: 0, end: 0, top: 0, height: top }] }), _jsx(View, { style: [shade, { start: 0, end: 0, top: bottom, bottom: 0 }] }), _jsx(View, { style: [shade, { start: 0, width: left, top, height: bottom - top }] }), _jsx(View, { style: [shade, { start: right, end: 0, top, height: bottom - top }] }), _jsx(View, { testID: testID, style: {
72
+ position: 'absolute',
73
+ start: left,
74
+ top,
75
+ width: right - left,
76
+ height: bottom - top,
77
+ borderColor: theme.colors.accent,
78
+ borderWidth: 2,
79
+ borderRadius: theme.radius,
80
+ } })] })) : (_jsx(View, { style: [StyleSheet.absoluteFill, { backgroundColor: color }] })) }));
81
+ }
@@ -0,0 +1,14 @@
1
+ import type { ComponentType, ReactNode } from 'react';
2
+ import { type NativeSyntheticEvent } from 'react-native';
3
+ import type { TableKeyboardCellProps } from './table.js';
4
+ import { type NativeKeyboardPayload } from './internal/keyboard.js';
5
+ export { nativeKeyboardEvent, type NativeKeyboardPayload, type KeyboardCommandEvent } from './internal/keyboard.js';
6
+ type NativeKeyboardPressableProps = Omit<TableKeyboardCellProps, 'focusRef' | 'handleKey' | 'children' | 'tabIndex'> & {
7
+ children?: ReactNode;
8
+ focusable?: boolean;
9
+ ref?: (host: unknown) => void;
10
+ lockFocus?: ('up' | 'down' | 'left' | 'right')[];
11
+ triggerCodes?: number[];
12
+ onKeyDownPress?: (event: NativeSyntheticEvent<NativeKeyboardPayload>) => void;
13
+ };
14
+ export declare function createTableKeyboardCell(KeyboardPressable: ComponentType<NativeKeyboardPressableProps>): ({ focusRef, handleKey, tabIndex, ...props }: TableKeyboardCellProps) => import("react").JSX.Element;
@@ -0,0 +1,27 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Platform } from 'react-native';
3
+ import { nativeKeyboardEvent } from './internal/keyboard.js';
4
+ export { nativeKeyboardEvent } from './internal/keyboard.js';
5
+ export function createTableKeyboardCell(KeyboardPressable) {
6
+ return function NativeTableKeyboardCell({ focusRef, handleKey, tabIndex, ...props }) {
7
+ return (_jsx(KeyboardPressable, { ...props, focusable: tabIndex !== -1, lockFocus: ['up', 'down', 'left', 'right'], triggerCodes: [], ref: (host) => {
8
+ if (host && typeof host === 'object') {
9
+ if ('keyboardFocus' in host && typeof host.keyboardFocus === 'function') {
10
+ focusRef({ focus: host.keyboardFocus.bind(host) });
11
+ return;
12
+ }
13
+ if ('focus' in host && typeof host.focus === 'function') {
14
+ focusRef({ focus: host.focus.bind(host) });
15
+ return;
16
+ }
17
+ }
18
+ focusRef(null);
19
+ }, onKeyDownPress: ({ nativeEvent }) => {
20
+ if (Platform.OS !== 'ios' && Platform.OS !== 'android')
21
+ return;
22
+ const event = nativeKeyboardEvent(nativeEvent, Platform.OS);
23
+ if (event)
24
+ handleKey(event);
25
+ } }));
26
+ };
27
+ }
@@ -0,0 +1,35 @@
1
+ import { type ViewProps } from 'react-native';
2
+ import type { TramaResponsive } from './responsive.js';
3
+ export type LayoutSpace = 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
4
+ export type LayoutAlign = 'stretch' | 'start' | 'center' | 'end' | 'baseline';
5
+ export type LayoutJustify = 'start' | 'center' | 'end' | 'between' | 'around' | 'evenly';
6
+ export type LayoutDirection = 'row' | 'column' | 'row-reverse' | 'column-reverse';
7
+ export type LayoutWrap = 'nowrap' | 'wrap' | 'wrap-reverse';
8
+ export type ContainerWidth = 'sm' | 'md' | 'lg' | 'xl' | '2xl' | 'full';
9
+ export type GridColumns = number | 'auto-fit' | 'auto-fill';
10
+ export declare const spacingSteps: Record<LayoutSpace, number>;
11
+ export interface ContainerProps extends ViewProps {
12
+ maxWidth?: TramaResponsive<ContainerWidth>;
13
+ gutter?: TramaResponsive<LayoutSpace>;
14
+ centered?: TramaResponsive<boolean>;
15
+ }
16
+ export declare function Container({ maxWidth, gutter, centered, style, ...props }: ContainerProps): import("react").JSX.Element;
17
+ export interface StackProps extends ViewProps {
18
+ direction?: TramaResponsive<LayoutDirection>;
19
+ gap?: TramaResponsive<LayoutSpace>;
20
+ align?: TramaResponsive<LayoutAlign>;
21
+ justify?: TramaResponsive<LayoutJustify>;
22
+ wrap?: TramaResponsive<LayoutWrap>;
23
+ }
24
+ export declare function Stack({ direction: layout, gap, align, justify, wrap, style, ...props }: StackProps): import("react").JSX.Element;
25
+ export type ClusterProps = Omit<StackProps, 'direction'>;
26
+ export declare function Cluster({ align, wrap, gap, ...props }: ClusterProps): import("react").JSX.Element;
27
+ export interface GridProps extends ViewProps {
28
+ columns?: TramaResponsive<GridColumns>;
29
+ minItemWidth?: TramaResponsive<number>;
30
+ gap?: TramaResponsive<LayoutSpace>;
31
+ rowGap?: TramaResponsive<LayoutSpace>;
32
+ columnGap?: TramaResponsive<LayoutSpace>;
33
+ align?: TramaResponsive<LayoutAlign>;
34
+ }
35
+ export declare function Grid({ columns, minItemWidth, gap, rowGap, columnGap, align, onLayout, children, style, ...props }: GridProps): import("react").JSX.Element;
package/dist/layout.js ADDED
@@ -0,0 +1,77 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Children, useState } from 'react';
3
+ import { View } from 'react-native';
4
+ import { useTramaAppearance } from './theme.js';
5
+ export const spacingSteps = { none: 0, xs: 1, sm: 2, md: 4, lg: 6, xl: 8 };
6
+ const maxWidths = { sm: 640, md: 768, lg: 1024, xl: 1280, '2xl': 1536, full: undefined };
7
+ const alignments = {
8
+ stretch: 'stretch',
9
+ start: 'flex-start',
10
+ center: 'center',
11
+ end: 'flex-end',
12
+ baseline: 'baseline',
13
+ };
14
+ const justifications = {
15
+ start: 'flex-start',
16
+ center: 'center',
17
+ end: 'flex-end',
18
+ between: 'space-between',
19
+ around: 'space-around',
20
+ evenly: 'space-evenly',
21
+ };
22
+ export function Container({ maxWidth, gutter, centered, style, ...props }) {
23
+ const { direction, theme, resolve } = useTramaAppearance();
24
+ return (_jsx(View, { ...props, style: [
25
+ {
26
+ direction,
27
+ width: '100%',
28
+ maxWidth: maxWidths[resolve(maxWidth, 'lg')],
29
+ paddingHorizontal: theme.space * spacingSteps[resolve(gutter, 'md')],
30
+ alignSelf: resolve(centered, true) ? 'center' : 'flex-start',
31
+ },
32
+ style,
33
+ ] }));
34
+ }
35
+ export function Stack({ direction: layout, gap, align, justify, wrap, style, ...props }) {
36
+ const { direction, theme, resolve } = useTramaAppearance();
37
+ return (_jsx(View, { ...props, style: [
38
+ {
39
+ direction,
40
+ flexDirection: resolve(layout, 'column'),
41
+ alignItems: alignments[resolve(align, 'stretch')],
42
+ flexWrap: resolve(wrap, 'nowrap'),
43
+ justifyContent: justifications[resolve(justify, 'start')],
44
+ gap: theme.space * spacingSteps[resolve(gap, 'md')],
45
+ },
46
+ style,
47
+ ] }));
48
+ }
49
+ export function Cluster({ align = 'center', wrap = 'wrap', gap = 'sm', ...props }) {
50
+ return _jsx(Stack, { ...props, gap: gap, align: align, wrap: wrap, direction: "row" });
51
+ }
52
+ export function Grid({ columns, minItemWidth, gap, rowGap, columnGap, align, onLayout, children, style, ...props }) {
53
+ const { direction, theme, resolve } = useTramaAppearance();
54
+ const [width, setWidth] = useState(0);
55
+ const items = Children.toArray(children);
56
+ const configured = resolve(columns, 'auto-fit');
57
+ const overallGap = resolve(gap, 'md');
58
+ const inlineGap = theme.space * spacingSteps[resolve(columnGap, overallGap)];
59
+ const blockGap = theme.space * spacingSteps[resolve(rowGap, overallGap)];
60
+ const minimum = resolve(minItemWidth, 240);
61
+ const safeMinimum = Number.isFinite(minimum) && minimum > 0 ? minimum : 240;
62
+ const fitting = Math.max(1, Math.floor((width + inlineGap) / (safeMinimum + inlineGap)));
63
+ const count = typeof configured === 'number' && Number.isFinite(configured)
64
+ ? Math.max(1, Math.min(24, Math.floor(configured)))
65
+ : configured === 'auto-fit'
66
+ ? Math.min(fitting, Math.max(items.length, 1))
67
+ : fitting;
68
+ const extent = Math.max(0, Math.floor(((width - inlineGap * (count - 1)) / count) * 100) / 100);
69
+ return (_jsx(View, { ...props, style: style, onLayout: onLayout, children: _jsx(View, { onLayout: ({ nativeEvent }) => setWidth(nativeEvent.layout.width), style: {
70
+ direction,
71
+ flexDirection: 'row',
72
+ flexWrap: 'wrap',
73
+ rowGap: blockGap,
74
+ columnGap: inlineGap,
75
+ alignItems: alignments[resolve(align, 'stretch')],
76
+ }, children: Children.map(items, (item) => (_jsx(View, { style: { width: width > 0 ? extent : '100%', minWidth: 0 }, children: item }))) }) }));
77
+ }
@@ -0,0 +1,18 @@
1
+ import { type ReactNode } from 'react';
2
+ import { type ViewProps } from 'react-native';
3
+ import type { TramaResponsive } from './responsive.js';
4
+ import { type TramaColor, type TramaSize } from './theme.js';
5
+ export type LoaderVariant = 'ring' | 'dots' | 'bars';
6
+ export interface LoaderProps extends Omit<ViewProps, 'children'> {
7
+ active?: boolean;
8
+ delay?: number;
9
+ label?: string;
10
+ decorative?: boolean;
11
+ showLabel?: TramaResponsive<boolean>;
12
+ labelPosition?: TramaResponsive<'start' | 'end' | 'top' | 'bottom'>;
13
+ size?: TramaResponsive<TramaSize>;
14
+ color?: TramaResponsive<TramaColor>;
15
+ variant?: TramaResponsive<LoaderVariant>;
16
+ children?: ReactNode;
17
+ }
18
+ export declare function Loader({ active, delay, label, decorative, showLabel, labelPosition, size, color, variant, children, accessibilityLabel, style, ...props }: LoaderProps): import("react").JSX.Element | null;
package/dist/loader.js ADDED
@@ -0,0 +1,79 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useRef, useState } from 'react';
3
+ import { ActivityIndicator, Animated, Easing, Text, View } from 'react-native';
4
+ import { useReducedMotion } from './internal/motion.js';
5
+ import { useTramaMessages } from './localization.js';
6
+ import { getTone, sizeStep, useTramaAppearance } from './theme.js';
7
+ function LoadingArtwork({ variant, color, size }) {
8
+ const reduced = useReducedMotion();
9
+ const phase = useRef(new Animated.Value(0)).current;
10
+ useEffect(() => {
11
+ if (reduced || variant === 'ring')
12
+ return;
13
+ const motion = Animated.loop(Animated.timing(phase, { toValue: 1, duration: 1150, easing: Easing.linear, useNativeDriver: true }));
14
+ motion.start();
15
+ return () => {
16
+ motion.stop();
17
+ phase.setValue(0);
18
+ };
19
+ }, [phase, reduced, variant]);
20
+ if (variant === 'ring') {
21
+ return reduced ? (_jsx(View, { accessible: false, style: {
22
+ width: size,
23
+ height: size,
24
+ borderRadius: size / 2,
25
+ borderWidth: 3,
26
+ borderColor: color,
27
+ borderTopColor: 'transparent',
28
+ } })) : (_jsx(ActivityIndicator, { accessible: false, color: color, style: { width: size, height: size }, size: size >= 30 ? 'large' : 'small' }));
29
+ }
30
+ const bars = variant === 'bars';
31
+ return (_jsx(View, { style: {
32
+ minWidth: size,
33
+ height: size,
34
+ flexDirection: 'row',
35
+ alignItems: 'center',
36
+ justifyContent: 'center',
37
+ gap: size / 9,
38
+ }, children: [0, 1, 2].map((index) => {
39
+ const start = index * 0.15;
40
+ const progress = phase.interpolate({
41
+ inputRange: [0, start + 0.05, start + 0.24, start + 0.62, 1],
42
+ outputRange: [0.45, 0.45, 1, 0.45, 0.45],
43
+ });
44
+ return (_jsx(Animated.View, { accessible: false, style: {
45
+ width: size / 5,
46
+ height: bars ? size * 0.76 : size / 5,
47
+ borderRadius: size / 10,
48
+ backgroundColor: color,
49
+ opacity: reduced ? 1 : progress,
50
+ transform: bars ? [{ scaleY: reduced ? 0.65 + index * 0.12 : progress }] : undefined,
51
+ } }, index));
52
+ }) }));
53
+ }
54
+ export function Loader({ active = true, delay = 0, label, decorative, showLabel, labelPosition, size, color, variant, children, accessibilityLabel, style, ...props }) {
55
+ const { theme, direction, resolve } = useTramaAppearance();
56
+ const messages = useTramaMessages();
57
+ const [delayed, setDelayed] = useState(false);
58
+ useEffect(() => {
59
+ setDelayed(false);
60
+ if (!active || !(delay > 0) || !Number.isFinite(delay))
61
+ return;
62
+ const timer = setTimeout(() => setDelayed(true), delay);
63
+ return () => clearTimeout(timer);
64
+ }, [active, delay]);
65
+ if (!active || (delay > 0 && Number.isFinite(delay) && !delayed))
66
+ return null;
67
+ const step = sizeStep[resolve(size, 'md')];
68
+ const text = label ?? messages.loading;
69
+ const flexDirection = { start: 'row-reverse', end: 'row', top: 'column-reverse', bottom: 'column' };
70
+ return (_jsxs(View, { ...props, accessible: !decorative, accessibilityRole: decorative ? undefined : 'progressbar', accessibilityLabel: decorative ? undefined : (accessibilityLabel ?? text), accessibilityState: decorative ? undefined : { busy: true }, importantForAccessibility: decorative ? 'no-hide-descendants' : 'yes', accessibilityElementsHidden: Boolean(decorative), style: [
71
+ {
72
+ direction,
73
+ flexDirection: flexDirection[resolve(labelPosition, 'end')],
74
+ alignItems: 'center',
75
+ gap: theme.space * 2,
76
+ },
77
+ style,
78
+ ], children: [children ?? (_jsx(LoadingArtwork, { variant: resolve(variant, 'ring'), color: getTone(theme, resolve(color, 'accent')).text, size: 26 + step * 6 })), resolve(showLabel, false) && (_jsx(Text, { style: { color: theme.colors.text, fontSize: theme.fontSize + step, fontFamily: theme.fontFamily }, children: text }))] }));
79
+ }
@@ -0,0 +1,106 @@
1
+ import { type ReactNode } from 'react';
2
+ export interface TramaNativeMessages {
3
+ reviewField: string;
4
+ requiredLabel: string;
5
+ enterValue: string;
6
+ turnOn: string;
7
+ minLength: (length: number) => string;
8
+ maxLength: (length: number) => string;
9
+ removeItem: string;
10
+ dismissMessage: string;
11
+ loading: string;
12
+ selectedCount: (count: number) => string;
13
+ clearSelection: string;
14
+ chooseOption: string;
15
+ closeSurface: string;
16
+ back: string;
17
+ search: string;
18
+ noResults: string;
19
+ openMenu: string;
20
+ enterNumber: string;
21
+ minNumber: (value: number) => string;
22
+ maxNumber: (value: number) => string;
23
+ increaseValue: string;
24
+ decreaseValue: string;
25
+ enterTime: string;
26
+ pagination: string;
27
+ previous: string;
28
+ next: string;
29
+ pageNumber: (page: number) => string;
30
+ pageOf: (page: number, total: number) => string;
31
+ breadcrumb: string;
32
+ moreItems: string;
33
+ addSelected: string;
34
+ removeSelected: string;
35
+ availableItems: string;
36
+ chosenItems: string;
37
+ expandItem: (label: string) => string;
38
+ collapseItem: (label: string) => string;
39
+ addOption: (label: string) => string;
40
+ cancel: string;
41
+ saveValue: string;
42
+ editValue: string;
43
+ resetFilters: string;
44
+ resultsCount: (count: number) => string;
45
+ ratingValue: (value: number, max: number) => string;
46
+ minimum: string;
47
+ maximum: string;
48
+ signIn: string;
49
+ email: string;
50
+ password: string;
51
+ tableBooleanValue: string;
52
+ tableCellUnavailable: string;
53
+ tableCellChanged: string;
54
+ tableEditRejected: string;
55
+ tableClipboardError: string;
56
+ tablePasteDoesNotFit: string;
57
+ tablePasteCoveredCell: string;
58
+ tableDragSelection: string;
59
+ tableSortPriority: (priority: number) => string;
60
+ tableCellLabel: (column: string, id: string | number) => string;
61
+ tableExtendSelection: string;
62
+ tableCopyCells: string;
63
+ tablePasteCells: string;
64
+ tableFillCells: string;
65
+ tableUndo: string;
66
+ tableRedo: string;
67
+ tableDataError: string;
68
+ progress: string;
69
+ skipTour: string;
70
+ finishTour: string;
71
+ resizePanels: string;
72
+ color: string;
73
+ colorChannels: Readonly<Record<'r' | 'g' | 'b' | 'a', string>>;
74
+ enterColor: string;
75
+ copyCode: string;
76
+ copied: string;
77
+ moveItem: string;
78
+ chooseFile: string;
79
+ browseFiles: string;
80
+ clearFiles: string;
81
+ filePickerError: string;
82
+ fileDropError: string;
83
+ fileRejected: (count: number) => string;
84
+ previewFile: (name: string) => string;
85
+ retry: string;
86
+ selectAll: string;
87
+ selectRow: (id: string | number) => string;
88
+ sortedColumn: (label: string, direction: 'ascending' | 'descending') => string;
89
+ resizeColumn: (label: string) => string;
90
+ actions: string;
91
+ chooseDate: string;
92
+ previousMonth: string;
93
+ nextMonth: string;
94
+ month: string;
95
+ year: string;
96
+ time: string;
97
+ }
98
+ export declare const tramaNativeLocales: Readonly<Record<'en' | 'it' | 'de', Readonly<TramaNativeMessages>>>;
99
+ export interface LocalizationProviderProps {
100
+ children?: ReactNode;
101
+ locale?: string;
102
+ messages?: Partial<TramaNativeMessages>;
103
+ }
104
+ export declare function LocalizationProvider({ children, locale, messages }: LocalizationProviderProps): import("react").JSX.Element;
105
+ export declare function useTramaLocale(): string;
106
+ export declare function useTramaMessages(): Readonly<TramaNativeMessages>;