@molecule/app-ui-react-native 1.0.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 (84) hide show
  1. package/LICENSE +115 -0
  2. package/README.md +1997 -0
  3. package/dist/components/Accordion.d.ts +22 -0
  4. package/dist/components/Accordion.d.ts.map +1 -0
  5. package/dist/components/Accordion.js +58 -0
  6. package/dist/components/Alert.d.ts +23 -0
  7. package/dist/components/Alert.d.ts.map +1 -0
  8. package/dist/components/Alert.js +25 -0
  9. package/dist/components/Avatar.d.ts +22 -0
  10. package/dist/components/Avatar.d.ts.map +1 -0
  11. package/dist/components/Avatar.js +38 -0
  12. package/dist/components/Badge.d.ts +21 -0
  13. package/dist/components/Badge.d.ts.map +1 -0
  14. package/dist/components/Badge.js +20 -0
  15. package/dist/components/Button.d.ts +27 -0
  16. package/dist/components/Button.d.ts.map +1 -0
  17. package/dist/components/Button.js +26 -0
  18. package/dist/components/Card.d.ts +77 -0
  19. package/dist/components/Card.d.ts.map +1 -0
  20. package/dist/components/Card.js +77 -0
  21. package/dist/components/Checkbox.d.ts +22 -0
  22. package/dist/components/Checkbox.d.ts.map +1 -0
  23. package/dist/components/Checkbox.js +31 -0
  24. package/dist/components/Dropdown.d.ts +35 -0
  25. package/dist/components/Dropdown.d.ts.map +1 -0
  26. package/dist/components/Dropdown.js +54 -0
  27. package/dist/components/Form.d.ts +48 -0
  28. package/dist/components/Form.d.ts.map +1 -0
  29. package/dist/components/Form.js +46 -0
  30. package/dist/components/Input.d.ts +13 -0
  31. package/dist/components/Input.d.ts.map +1 -0
  32. package/dist/components/Input.js +36 -0
  33. package/dist/components/Layout.d.ts +59 -0
  34. package/dist/components/Layout.d.ts.map +1 -0
  35. package/dist/components/Layout.js +92 -0
  36. package/dist/components/Modal.d.ts +22 -0
  37. package/dist/components/Modal.d.ts.map +1 -0
  38. package/dist/components/Modal.js +22 -0
  39. package/dist/components/Pagination.d.ts +23 -0
  40. package/dist/components/Pagination.d.ts.map +1 -0
  41. package/dist/components/Pagination.js +46 -0
  42. package/dist/components/Progress.d.ts +34 -0
  43. package/dist/components/Progress.d.ts.map +1 -0
  44. package/dist/components/Progress.js +29 -0
  45. package/dist/components/RadioGroup.d.ts +23 -0
  46. package/dist/components/RadioGroup.d.ts.map +1 -0
  47. package/dist/components/RadioGroup.js +35 -0
  48. package/dist/components/Select.d.ts +29 -0
  49. package/dist/components/Select.d.ts.map +1 -0
  50. package/dist/components/Select.js +52 -0
  51. package/dist/components/Separator.d.ts +18 -0
  52. package/dist/components/Separator.d.ts.map +1 -0
  53. package/dist/components/Separator.js +17 -0
  54. package/dist/components/Skeleton.d.ts +46 -0
  55. package/dist/components/Skeleton.d.ts.map +1 -0
  56. package/dist/components/Skeleton.js +65 -0
  57. package/dist/components/Spinner.d.ts +17 -0
  58. package/dist/components/Spinner.d.ts.map +1 -0
  59. package/dist/components/Spinner.js +24 -0
  60. package/dist/components/Switch.d.ts +21 -0
  61. package/dist/components/Switch.d.ts.map +1 -0
  62. package/dist/components/Switch.js +23 -0
  63. package/dist/components/Table.d.ts +29 -0
  64. package/dist/components/Table.d.ts.map +1 -0
  65. package/dist/components/Table.js +46 -0
  66. package/dist/components/Tabs.d.ts +21 -0
  67. package/dist/components/Tabs.d.ts.map +1 -0
  68. package/dist/components/Tabs.js +34 -0
  69. package/dist/components/Textarea.d.ts +13 -0
  70. package/dist/components/Textarea.d.ts.map +1 -0
  71. package/dist/components/Textarea.js +21 -0
  72. package/dist/components/Toast.d.ts +54 -0
  73. package/dist/components/Toast.d.ts.map +1 -0
  74. package/dist/components/Toast.js +89 -0
  75. package/dist/components/Tooltip.d.ts +20 -0
  76. package/dist/components/Tooltip.d.ts.map +1 -0
  77. package/dist/components/Tooltip.js +29 -0
  78. package/dist/components/index.d.ts +31 -0
  79. package/dist/components/index.d.ts.map +1 -0
  80. package/dist/components/index.js +30 -0
  81. package/dist/index.d.ts +50 -0
  82. package/dist/index.d.ts.map +1 -0
  83. package/dist/index.js +48 -0
  84. package/package.json +63 -0
@@ -0,0 +1,52 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * Select component for React Native.
4
+ *
5
+ * Uses a Pressable that opens a Modal picker since React Native
6
+ * has no native `<select>` element.
7
+ *
8
+ * @module
9
+ */
10
+ import { useState } from 'react';
11
+ import { FlatList, Modal as RNModal, Pressable, Text, View } from 'react-native';
12
+ import { t } from '@molecule/app-i18n';
13
+ import { getClassMap } from '@molecule/app-ui';
14
+ /**
15
+ * Renders a Select component.
16
+ * @param root0 - Component props.
17
+ * @param root0.label - Select label text.
18
+ * @param root0.options - Select options array.
19
+ * @param root0.value - Selected value.
20
+ * @param root0.onChange - Change handler.
21
+ * @param root0.placeholder - Placeholder text.
22
+ * @param root0.error - Error message.
23
+ * @param root0.hint - Hint text.
24
+ * @param root0.size - Select size.
25
+ * @param root0.disabled - Whether disabled.
26
+ * @param root0.required - Whether required.
27
+ * @param root0.className - CSS class name override.
28
+ * @param root0.testId - Test identifier.
29
+ * @returns The rendered Select element.
30
+ */
31
+ export const Select = ({ label, options = [], value, onChange, placeholder, error, hint, size = 'md', disabled, required, className, testId, }) => {
32
+ const cm = getClassMap();
33
+ const [isOpen, setIsOpen] = useState(false);
34
+ const classes = cm.cn(cm.select({ error: !!error, size }), className);
35
+ const selectedOption = options.find((opt) => typeof opt === 'string' ? opt === value : opt.value === value);
36
+ const displayLabel = selectedOption
37
+ ? typeof selectedOption === 'string'
38
+ ? selectedOption
39
+ : selectedOption.label
40
+ : placeholder || t('ui.select.placeholder', undefined, { defaultValue: 'Select…' });
41
+ return (_jsxs(View, { className: cm.inputWrapper, children: [!!label && (_jsx(Text, { className: cm.cn(cm.labelBlock, cm.label({ required: !!required })), children: label })), _jsxs(Pressable, { className: classes, onPress: () => !disabled && setIsOpen(true), testID: testId, accessibilityRole: "combobox", accessibilityState: { disabled, expanded: isOpen }, children: [_jsx(Text, { className: !selectedOption ? cm.textMuted : undefined, children: displayLabel }), _jsx(Text, { className: cm.selectNative, children: t('ui.icon.chevronDown', undefined, { defaultValue: '▼' }) })] }), _jsx(RNModal, { visible: isOpen, transparent: true, animationType: "slide", onRequestClose: () => setIsOpen(false), children: _jsx(Pressable, { className: cm.dialogOverlay, onPress: () => setIsOpen(false), children: _jsxs(View, { className: cm.cn(cm.actionSheet, 'pointer-events-auto'), children: [_jsx(View, { className: cm.actionSheetHeader, children: _jsx(Text, { className: cm.dialogTitle, children: label || t('ui.select.title', undefined, { defaultValue: 'Select' }) }) }), _jsx(FlatList, { data: options, keyExtractor: (item, index) => typeof item === 'string' ? item : (item.value ?? String(index)), renderItem: ({ item }) => {
42
+ const optValue = typeof item === 'string' ? item : item.value;
43
+ const optLabel = typeof item === 'string' ? item : item.label;
44
+ const isSelected = optValue === value;
45
+ return (_jsx(Pressable, { className: cm.cn(cm.dropdownItem, isSelected && cm.textPrimary), onPress: () => {
46
+ if (onChange) {
47
+ onChange({ target: { value: optValue } });
48
+ }
49
+ setIsOpen(false);
50
+ }, children: _jsx(Text, { children: optLabel }) }));
51
+ } })] }) }) }), !!error && typeof error === 'string' && _jsx(Text, { className: cm.formError, children: error }), !!hint && !error && _jsx(Text, { className: cm.formHint, children: hint })] }));
52
+ };
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Separator component for React Native.
3
+ *
4
+ * @module
5
+ */
6
+ import React from 'react';
7
+ import type { SeparatorProps } from '@molecule/app-ui';
8
+ /**
9
+ * Renders a Separator component.
10
+ * @param root0 - Component props.
11
+ * @param root0.orientation - Horizontal or vertical.
12
+ * @param root0.decorative - Whether purely decorative.
13
+ * @param root0.className - CSS class name override.
14
+ * @param root0.testId - Test identifier.
15
+ * @returns The rendered Separator element.
16
+ */
17
+ export declare const Separator: React.FC<SeparatorProps>;
18
+ //# sourceMappingURL=Separator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Separator.d.ts","sourceRoot":"","sources":["../../src/components/Separator.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAGtD;;;;;;;;GAQG;AACH,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAgB9C,CAAA"}
@@ -0,0 +1,17 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { View } from 'react-native';
3
+ import { getClassMap } from '@molecule/app-ui';
4
+ /**
5
+ * Renders a Separator component.
6
+ * @param root0 - Component props.
7
+ * @param root0.orientation - Horizontal or vertical.
8
+ * @param root0.decorative - Whether purely decorative.
9
+ * @param root0.className - CSS class name override.
10
+ * @param root0.testId - Test identifier.
11
+ * @returns The rendered Separator element.
12
+ */
13
+ export const Separator = ({ orientation = 'horizontal', decorative = true, className, testId, }) => {
14
+ const cm = getClassMap();
15
+ const classes = cm.cn(cm.separator({ orientation }), className);
16
+ return (_jsx(View, { className: classes, testID: testId, accessibilityRole: decorative ? 'none' : 'separator' }));
17
+ };
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Skeleton components for React Native.
3
+ *
4
+ * @module
5
+ */
6
+ import React from 'react';
7
+ import type { SkeletonProps } from '@molecule/app-ui';
8
+ /**
9
+ * Renders a Skeleton component.
10
+ * @param root0 - Component props.
11
+ * @param root0.width - Skeleton width.
12
+ * @param root0.height - Skeleton height.
13
+ * @param root0.circle - Whether circular.
14
+ * @param root0.animation - Animation type.
15
+ * @param root0.className - CSS class name override.
16
+ * @param root0.testId - Test identifier.
17
+ * @returns The rendered Skeleton element.
18
+ */
19
+ export declare const Skeleton: React.FC<SkeletonProps>;
20
+ /**
21
+ * Renders a SkeletonText component.
22
+ * @param root0 - Component props.
23
+ * @param root0.lines - Number of text lines.
24
+ * @param root0.className - CSS class name override.
25
+ * @param root0.testId - Test identifier.
26
+ * @returns The rendered SkeletonText element.
27
+ */
28
+ export declare const SkeletonText: React.FC<{
29
+ lines?: number;
30
+ className?: string;
31
+ testId?: string;
32
+ }>;
33
+ /**
34
+ * Renders a SkeletonCircle component.
35
+ * @param root0 - Component props.
36
+ * @param root0.size - Circle diameter.
37
+ * @param root0.className - CSS class name override.
38
+ * @param root0.testId - Test identifier.
39
+ * @returns The rendered SkeletonCircle element.
40
+ */
41
+ export declare const SkeletonCircle: React.FC<{
42
+ size?: number;
43
+ className?: string;
44
+ testId?: string;
45
+ }>;
46
+ //# sourceMappingURL=Skeleton.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Skeleton.d.ts","sourceRoot":"","sources":["../../src/components/Skeleton.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAA4B,MAAM,OAAO,CAAA;AAGhD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAGrD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CA8C5C,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CASA,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC;IACpC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAEA,CAAA"}
@@ -0,0 +1,65 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /**
3
+ * Skeleton components for React Native.
4
+ *
5
+ * @module
6
+ */
7
+ import { useEffect, useRef } from 'react';
8
+ import { Animated, View } from 'react-native';
9
+ import { getClassMap } from '@molecule/app-ui';
10
+ /**
11
+ * Renders a Skeleton component.
12
+ * @param root0 - Component props.
13
+ * @param root0.width - Skeleton width.
14
+ * @param root0.height - Skeleton height.
15
+ * @param root0.circle - Whether circular.
16
+ * @param root0.animation - Animation type.
17
+ * @param root0.className - CSS class name override.
18
+ * @param root0.testId - Test identifier.
19
+ * @returns The rendered Skeleton element.
20
+ */
21
+ export const Skeleton = ({ width, height, circle, animation = 'pulse', className, testId, }) => {
22
+ const cm = getClassMap();
23
+ const opacity = useRef(new Animated.Value(1)).current;
24
+ useEffect(() => {
25
+ if (animation === 'pulse') {
26
+ const pulse = Animated.loop(Animated.sequence([
27
+ Animated.timing(opacity, { toValue: 0.5, duration: 1000, useNativeDriver: true }),
28
+ Animated.timing(opacity, { toValue: 1, duration: 1000, useNativeDriver: true }),
29
+ ]));
30
+ pulse.start();
31
+ return () => pulse.stop();
32
+ }
33
+ return undefined;
34
+ }, [animation, opacity]);
35
+ const classes = cm.cn(cm.skeleton(), animation === 'wave' && cm.skeletonWave, animation === 'none' && cm.skeletonNone, circle && cm.skeletonCircle, className);
36
+ const sizeStyle = {
37
+ ...(width !== undefined ? { width: width } : {}),
38
+ ...(height !== undefined ? { height: height } : {}),
39
+ ...(circle && width ? { borderRadius: typeof width === 'number' ? width / 2 : undefined } : {}),
40
+ };
41
+ return (_jsx(Animated.View, { className: classes, style: [sizeStyle, { opacity: animation === 'pulse' ? opacity : 1 }], testID: testId }));
42
+ };
43
+ /**
44
+ * Renders a SkeletonText component.
45
+ * @param root0 - Component props.
46
+ * @param root0.lines - Number of text lines.
47
+ * @param root0.className - CSS class name override.
48
+ * @param root0.testId - Test identifier.
49
+ * @returns The rendered SkeletonText element.
50
+ */
51
+ export const SkeletonText = ({ lines = 3, className, testId }) => {
52
+ const cm = getClassMap();
53
+ return (_jsx(View, { className: cm.cn(cm.skeletonTextContainer, className), testID: testId, children: Array.from({ length: lines }, (_, i) => (_jsx(Skeleton, { height: 12, width: i === lines - 1 ? '75%' : '100%' }, i))) }));
54
+ };
55
+ /**
56
+ * Renders a SkeletonCircle component.
57
+ * @param root0 - Component props.
58
+ * @param root0.size - Circle diameter.
59
+ * @param root0.className - CSS class name override.
60
+ * @param root0.testId - Test identifier.
61
+ * @returns The rendered SkeletonCircle element.
62
+ */
63
+ export const SkeletonCircle = ({ size = 40, className, testId }) => {
64
+ return _jsx(Skeleton, { width: size, height: size, circle: true, className: className, testId: testId });
65
+ };
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Spinner component for React Native.
3
+ *
4
+ * @module
5
+ */
6
+ import React from 'react';
7
+ import type { SpinnerProps } from '@molecule/app-ui';
8
+ /**
9
+ * Renders a Spinner component.
10
+ * @param root0 - Component props.
11
+ * @param root0.size - Spinner size.
12
+ * @param root0.className - CSS class name override.
13
+ * @param root0.testId - Test identifier.
14
+ * @returns The rendered Spinner element.
15
+ */
16
+ export declare const Spinner: React.FC<SpinnerProps>;
17
+ //# sourceMappingURL=Spinner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Spinner.d.ts","sourceRoot":"","sources":["../../src/components/Spinner.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAWpD;;;;;;;GAOG;AACH,eAAO,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAc1C,CAAA"}
@@ -0,0 +1,24 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { ActivityIndicator, View } from 'react-native';
3
+ import { t } from '@molecule/app-i18n';
4
+ import { getClassMap } from '@molecule/app-ui';
5
+ const sizeMap = {
6
+ xs: 'small',
7
+ sm: 'small',
8
+ md: 'small',
9
+ lg: 'large',
10
+ xl: 'large',
11
+ };
12
+ /**
13
+ * Renders a Spinner component.
14
+ * @param root0 - Component props.
15
+ * @param root0.size - Spinner size.
16
+ * @param root0.className - CSS class name override.
17
+ * @param root0.testId - Test identifier.
18
+ * @returns The rendered Spinner element.
19
+ */
20
+ export const Spinner = ({ size = 'md', className, testId }) => {
21
+ const cm = getClassMap();
22
+ const classes = cm.cn(cm.spinner({ size }), className);
23
+ return (_jsx(View, { className: classes, testID: testId, accessibilityRole: "progressbar", accessibilityLabel: t('ui.spinner.loading', undefined, { defaultValue: 'Loading' }), children: _jsx(ActivityIndicator, { size: sizeMap[size] || 'small' }) }));
24
+ };
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Switch component for React Native.
3
+ *
4
+ * @module
5
+ */
6
+ import React from 'react';
7
+ import type { SwitchProps } from '@molecule/app-ui';
8
+ /**
9
+ * Renders a Switch component.
10
+ * @param root0 - Component props.
11
+ * @param root0.label - Switch label text.
12
+ * @param root0.checked - Whether checked.
13
+ * @param root0.onChange - Change handler.
14
+ * @param root0.size - Switch size (unused in RN).
15
+ * @param root0.disabled - Whether disabled.
16
+ * @param root0.className - CSS class name override.
17
+ * @param root0.testId - Test identifier.
18
+ * @returns The rendered Switch element.
19
+ */
20
+ export declare const Switch: React.FC<SwitchProps>;
21
+ //# sourceMappingURL=Switch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Switch.d.ts","sourceRoot":"","sources":["../../src/components/Switch.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAGnD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CA+BxC,CAAA"}
@@ -0,0 +1,23 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Switch as RNSwitch, Text, View } from 'react-native';
3
+ import { getClassMap } from '@molecule/app-ui';
4
+ /**
5
+ * Renders a Switch component.
6
+ * @param root0 - Component props.
7
+ * @param root0.label - Switch label text.
8
+ * @param root0.checked - Whether checked.
9
+ * @param root0.onChange - Change handler.
10
+ * @param root0.size - Switch size (unused in RN).
11
+ * @param root0.disabled - Whether disabled.
12
+ * @param root0.className - CSS class name override.
13
+ * @param root0.testId - Test identifier.
14
+ * @returns The rendered Switch element.
15
+ */
16
+ export const Switch = ({ label, checked, onChange, size: _size = 'md', disabled, className, testId, }) => {
17
+ const cm = getClassMap();
18
+ return (_jsxs(View, { className: cm.cn(cm.controlLabel, className), testID: testId, children: [_jsx(RNSwitch, { value: !!checked, onValueChange: (value) => {
19
+ if (onChange) {
20
+ onChange({ target: { checked: value } });
21
+ }
22
+ }, disabled: disabled, accessibilityRole: "switch", accessibilityState: { checked: !!checked, disabled } }), !!label && (_jsx(Text, { className: cm.cn(cm.controlText, disabled && cm.controlDisabled), children: label }))] }));
23
+ };
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Table component for React Native.
3
+ *
4
+ * Uses FlatList for performant scrollable tables instead of HTML table elements.
5
+ *
6
+ * @module
7
+ */
8
+ import React from 'react';
9
+ import type { TableProps } from '@molecule/app-ui';
10
+ /**
11
+ * Renders a Table component.
12
+ * @param root0 - Component props.
13
+ * @param root0.columns - Column definitions.
14
+ * @param root0.data - Table row data.
15
+ * @param root0.rowKey - Row key accessor.
16
+ * @param root0.onRowClick - Row click handler.
17
+ * @param root0.striped - Whether striped rows.
18
+ * @param root0.bordered - Whether bordered.
19
+ * @param root0.hoverable - Whether rows hoverable.
20
+ * @param root0.loading - Whether loading.
21
+ * @param root0.emptyContent - Empty state message.
22
+ * @param root0.sort - Active sort state.
23
+ * @param root0.onSort - Sort handler.
24
+ * @param root0.className - CSS class name override.
25
+ * @param root0.testId - Test identifier.
26
+ * @returns The rendered Table element.
27
+ */
28
+ export declare const Table: React.FC<TableProps<Record<string, unknown>>>;
29
+ //# sourceMappingURL=Table.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../src/components/Table.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAKlD;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAyG/D,CAAA"}
@@ -0,0 +1,46 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { FlatList, Pressable, Text, View } from 'react-native';
3
+ import { t } from '@molecule/app-i18n';
4
+ import { getClassMap } from '@molecule/app-ui';
5
+ import { Spinner } from './Spinner.js';
6
+ /**
7
+ * Renders a Table component.
8
+ * @param root0 - Component props.
9
+ * @param root0.columns - Column definitions.
10
+ * @param root0.data - Table row data.
11
+ * @param root0.rowKey - Row key accessor.
12
+ * @param root0.onRowClick - Row click handler.
13
+ * @param root0.striped - Whether striped rows.
14
+ * @param root0.bordered - Whether bordered.
15
+ * @param root0.hoverable - Whether rows hoverable.
16
+ * @param root0.loading - Whether loading.
17
+ * @param root0.emptyContent - Empty state message.
18
+ * @param root0.sort - Active sort state.
19
+ * @param root0.onSort - Sort handler.
20
+ * @param root0.className - CSS class name override.
21
+ * @param root0.testId - Test identifier.
22
+ * @returns The rendered Table element.
23
+ */
24
+ export const Table = ({ columns = [], data = [], rowKey, onRowClick, striped, bordered, hoverable, loading, emptyContent: emptyMessage, sort, onSort, className, testId, }) => {
25
+ const cm = getClassMap();
26
+ const getRowKey = (row, index) => {
27
+ if (typeof rowKey === 'function')
28
+ return String(rowKey(row));
29
+ if (typeof rowKey === 'string' && row[rowKey] !== undefined)
30
+ return String(row[rowKey]);
31
+ return String(index);
32
+ };
33
+ return (_jsxs(View, { className: cm.cn(cm.tableWrapper, bordered && cm.tableBordered, className), testID: testId, children: [_jsx(View, { className: cm.cn(cm.tableHeader, cm.tableRow), children: columns.map((col) => (_jsxs(Pressable, { className: cm.cn(cm.tableHead, col.sortable && cm.tableHeadSortable), onPress: () => col.sortable &&
34
+ onSort &&
35
+ onSort(String(col.key), sort?.key === String(col.key) && sort?.direction === 'asc' ? 'desc' : 'asc'), disabled: !col.sortable, children: [_jsx(Text, { children: col.header }), col.sortable && sort?.key === String(col.key) && (_jsx(Text, { className: cm.tableSortIcon, children: sort.direction === 'asc'
36
+ ? t('ui.icon.sortAsc', undefined, { defaultValue: '↑' })
37
+ : t('ui.icon.sortDesc', undefined, { defaultValue: '↓' }) }))] }, String(col.key)))) }), loading && (_jsx(View, { className: cm.tableLoadingOverlay, children: _jsx(Spinner, { size: "md" }) })), data.length === 0 && !loading ? (_jsx(View, { className: cm.tableEmptyCell, children: _jsx(Text, { className: cm.textMuted, children: emptyMessage ||
38
+ t('ui.table.empty', undefined, { defaultValue: 'No data' }) }) })) : (_jsx(FlatList, { data: data, keyExtractor: (item, index) => getRowKey(item, index), renderItem: ({ item, index }) => {
39
+ const row = item;
40
+ return (_jsx(Pressable, { className: cm.cn(cm.tableRow, striped && index % 2 === 1 && cm.tableRowStriped, hoverable && cm.tableRowHoverable, onRowClick && cm.tableRowClickable), onPress: () => onRowClick?.(row, index), disabled: !onRowClick, children: columns.map((col) => {
41
+ const cellValue = row[col.key];
42
+ const rendered = col.render ? col.render(cellValue, row, index) : cellValue;
43
+ return (_jsx(View, { className: cm.tableCell, children: _jsx(Text, { children: rendered }) }, String(col.key)));
44
+ }) }));
45
+ } }))] }));
46
+ };
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Tabs component for React Native.
3
+ *
4
+ * @module
5
+ */
6
+ import React from 'react';
7
+ import type { TabsProps } from '@molecule/app-ui';
8
+ /**
9
+ * Renders a Tabs component.
10
+ * @param root0 - Component props.
11
+ * @param root0.items - Tab items array.
12
+ * @param root0.value - Controlled active tab.
13
+ * @param root0.defaultValue - Default active tab.
14
+ * @param root0.onChange - Tab change handler.
15
+ * @param root0.fitted - Whether tabs fill width.
16
+ * @param root0.className - CSS class name override.
17
+ * @param root0.testId - Test identifier.
18
+ * @returns The rendered Tabs element.
19
+ */
20
+ export declare const Tabs: React.FC<TabsProps>;
21
+ //# sourceMappingURL=Tabs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Tabs.d.ts","sourceRoot":"","sources":["../../src/components/Tabs.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAmB,MAAM,OAAO,CAAA;AAGvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAGjD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,CAoDpC,CAAA"}
@@ -0,0 +1,34 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * Tabs component for React Native.
4
+ *
5
+ * @module
6
+ */
7
+ import { useState } from 'react';
8
+ import { Pressable, Text, View } from 'react-native';
9
+ import { getClassMap } from '@molecule/app-ui';
10
+ /**
11
+ * Renders a Tabs component.
12
+ * @param root0 - Component props.
13
+ * @param root0.items - Tab items array.
14
+ * @param root0.value - Controlled active tab.
15
+ * @param root0.defaultValue - Default active tab.
16
+ * @param root0.onChange - Tab change handler.
17
+ * @param root0.fitted - Whether tabs fill width.
18
+ * @param root0.className - CSS class name override.
19
+ * @param root0.testId - Test identifier.
20
+ * @returns The rendered Tabs element.
21
+ */
22
+ export const Tabs = ({ items = [], value: controlledValue, defaultValue, onChange, fitted, className, testId, }) => {
23
+ const cm = getClassMap();
24
+ const [uncontrolledValue, setUncontrolledValue] = useState(defaultValue || items[0]?.value || '');
25
+ const activeValue = controlledValue ?? uncontrolledValue;
26
+ const handleChange = (newValue) => {
27
+ if (controlledValue === undefined) {
28
+ setUncontrolledValue(newValue);
29
+ }
30
+ onChange?.(newValue);
31
+ };
32
+ const activeItem = items.find((item) => item.value === activeValue);
33
+ return (_jsxs(View, { className: className, testID: testId, children: [_jsx(View, { className: cm.cn(cm.tabsList(), fitted && cm.tabsFitted), children: items.map((item) => (_jsxs(Pressable, { className: cm.cn(cm.tabsTrigger(), fitted && cm.tabTriggerFitted, item.value === activeValue && cm.borderBPrimary), onPress: () => !item.disabled && handleChange(item.value), disabled: item.disabled, accessibilityRole: "tab", accessibilityState: { selected: item.value === activeValue, disabled: item.disabled }, children: [!!item.icon && (_jsx(View, { className: cm.tabTriggerIcon, children: item.icon })), _jsx(Text, { children: item.label })] }, item.value))) }), !!activeItem?.content && (_jsx(View, { className: cm.tabsContent(), accessibilityRole: "summary", children: activeItem.content }))] }));
34
+ };
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Textarea component for React Native.
3
+ *
4
+ * @module
5
+ */
6
+ import React from 'react';
7
+ import { TextInput } from 'react-native';
8
+ import type { TextareaProps } from '@molecule/app-ui';
9
+ /**
10
+ * Multi-line text input component.
11
+ */
12
+ export declare const Textarea: React.ForwardRefExoticComponent<TextareaProps & React.RefAttributes<TextInput>>;
13
+ //# sourceMappingURL=Textarea.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Textarea.d.ts","sourceRoot":"","sources":["../../src/components/Textarea.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAqB,MAAM,OAAO,CAAA;AACzC,OAAO,EAAQ,SAAS,EAAQ,MAAM,cAAc,CAAA;AAEpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAGrD;;GAEG;AACH,eAAO,MAAM,QAAQ,iFAuDpB,CAAA"}
@@ -0,0 +1,21 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * Textarea component for React Native.
4
+ *
5
+ * @module
6
+ */
7
+ import { forwardRef } from 'react';
8
+ import { Text, TextInput, View } from 'react-native';
9
+ import { getClassMap } from '@molecule/app-ui';
10
+ /**
11
+ * Multi-line text input component.
12
+ */
13
+ export const Textarea = forwardRef(({ label, error, hint, rows = 3, className, style, testId, disabled, placeholder, value, onChange, onFocus, onBlur, required, }, ref) => {
14
+ const cm = getClassMap();
15
+ const classes = cm.cn(cm.textarea({ error: !!error }), className);
16
+ return (_jsxs(View, { className: cm.inputWrapper, children: [!!label && (_jsx(Text, { className: cm.cn(cm.labelBlock, cm.label({ required: !!required })), children: label })), _jsx(TextInput, { ref: ref, className: classes, style: style, testID: testId, editable: !disabled, placeholder: placeholder, value: value, multiline: true, numberOfLines: rows, textAlignVertical: "top", onChangeText: (text) => {
17
+ if (onChange) {
18
+ onChange({ target: { value: text } });
19
+ }
20
+ }, onFocus: onFocus, onBlur: onBlur, accessibilityLabel: typeof label === 'string' ? label : undefined }), !!error && typeof error === 'string' && _jsx(Text, { className: cm.formError, children: error }), !!hint && !error && _jsx(Text, { className: cm.formHint, children: hint })] }));
21
+ });
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Toast notification components for React Native.
3
+ *
4
+ * @module
5
+ */
6
+ import React from 'react';
7
+ import type { ToastProps } from '@molecule/app-ui';
8
+ /**
9
+ * Renders a Toast component.
10
+ * @param root0 - Component props.
11
+ * @param root0.title - Toast title text.
12
+ * @param root0.description - Toast description text.
13
+ * @param root0.status - Status type.
14
+ * @param root0.duration - Auto-dismiss duration (ms).
15
+ * @param root0.dismissible - Whether dismissible.
16
+ * @param root0.onDismiss - Dismiss handler.
17
+ * @param root0.className - CSS class name override.
18
+ * @param root0.testId - Test identifier.
19
+ * @returns The rendered Toast element.
20
+ */
21
+ export declare const Toast: React.FC<ToastProps>;
22
+ /**
23
+ * Renders a ToastContainer component.
24
+ * @param root0 - Component props.
25
+ * @param root0.children - Toast elements.
26
+ * @param root0.position - Screen position.
27
+ * @returns The rendered ToastContainer element.
28
+ */
29
+ export declare const ToastContainer: React.FC<{
30
+ children: React.ReactNode;
31
+ position?: 'top' | 'top-right' | 'top-left' | 'bottom' | 'bottom-right' | 'bottom-left';
32
+ }>;
33
+ interface ToastContextValue {
34
+ toast: (props: Omit<ToastProps, 'onDismiss'>) => number;
35
+ dismiss: (id: number) => void;
36
+ }
37
+ /**
38
+ * Renders a ToastProvider component.
39
+ * @param root0 - Component props.
40
+ * @param root0.children - App content.
41
+ * @param root0.position - Toast position.
42
+ * @returns The rendered ToastProvider element.
43
+ */
44
+ export declare const ToastProvider: React.FC<{
45
+ children: React.ReactNode;
46
+ position?: 'top' | 'top-right' | 'top-left' | 'bottom' | 'bottom-right' | 'bottom-left';
47
+ }>;
48
+ /**
49
+ * Hook for toast notifications.
50
+ * @returns The toast context value.
51
+ */
52
+ export declare function useToast(): ToastContextValue;
53
+ export {};
54
+ //# sourceMappingURL=Toast.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Toast.d.ts","sourceRoot":"","sources":["../../src/components/Toast.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAA8E,MAAM,OAAO,CAAA;AAIlG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAGlD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CAqDtC,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC;IACpC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,QAAQ,CAAC,EAAE,KAAK,GAAG,WAAW,GAAG,UAAU,GAAG,QAAQ,GAAG,cAAc,GAAG,aAAa,CAAA;CACxF,CAGA,CAAA;AASD,UAAU,iBAAiB;IACzB,KAAK,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,EAAE,WAAW,CAAC,KAAK,MAAM,CAAA;IACvD,OAAO,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAA;CAC9B;AAMD;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC;IACnC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,QAAQ,CAAC,EAAE,KAAK,GAAG,WAAW,GAAG,UAAU,GAAG,QAAQ,GAAG,cAAc,GAAG,aAAa,CAAA;CACxF,CAuBA,CAAA;AAED;;;GAGG;AACH,wBAAgB,QAAQ,IAAI,iBAAiB,CAU5C"}
@@ -0,0 +1,89 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * Toast notification components for React Native.
4
+ *
5
+ * @module
6
+ */
7
+ import { createContext, useCallback, useContext, useEffect, useRef, useState } from 'react';
8
+ import { Animated, Pressable, Text, View } from 'react-native';
9
+ import { t } from '@molecule/app-i18n';
10
+ import { getClassMap } from '@molecule/app-ui';
11
+ /**
12
+ * Renders a Toast component.
13
+ * @param root0 - Component props.
14
+ * @param root0.title - Toast title text.
15
+ * @param root0.description - Toast description text.
16
+ * @param root0.status - Status type.
17
+ * @param root0.duration - Auto-dismiss duration (ms).
18
+ * @param root0.dismissible - Whether dismissible.
19
+ * @param root0.onDismiss - Dismiss handler.
20
+ * @param root0.className - CSS class name override.
21
+ * @param root0.testId - Test identifier.
22
+ * @returns The rendered Toast element.
23
+ */
24
+ export const Toast = ({ title, description, status, duration = 5000, dismissible = true, onDismiss, className, testId, }) => {
25
+ const cm = getClassMap();
26
+ const classes = cm.cn(cm.toast({
27
+ variant: (status || 'default'),
28
+ }), className);
29
+ const opacity = useRef(new Animated.Value(1)).current;
30
+ useEffect(() => {
31
+ if (duration > 0) {
32
+ const timer = setTimeout(() => {
33
+ Animated.timing(opacity, {
34
+ toValue: 0,
35
+ duration: 300,
36
+ useNativeDriver: true,
37
+ }).start(() => onDismiss?.());
38
+ }, duration);
39
+ return () => clearTimeout(timer);
40
+ }
41
+ return undefined;
42
+ }, [duration, onDismiss, opacity]);
43
+ return (_jsxs(Animated.View, { className: classes, style: { opacity }, testID: testId, children: [_jsxs(View, { className: cm.toastContentWrapper, children: [!!title && _jsx(Text, { className: cm.toastTitle, children: title }), !!description && (_jsx(Text, { className: cm.toastDescription, children: description }))] }), dismissible && (_jsx(Pressable, { className: cm.toastClose, onPress: onDismiss, accessibilityLabel: t('ui.toast.dismiss', undefined, { defaultValue: 'Dismiss' }), accessibilityRole: "button", children: _jsx(Text, { children: t('ui.icon.close', undefined, { defaultValue: '✕' }) }) }))] }));
44
+ };
45
+ /**
46
+ * Renders a ToastContainer component.
47
+ * @param root0 - Component props.
48
+ * @param root0.children - Toast elements.
49
+ * @param root0.position - Screen position.
50
+ * @returns The rendered ToastContainer element.
51
+ */
52
+ export const ToastContainer = ({ children, position = 'bottom-right' }) => {
53
+ const cm = getClassMap();
54
+ return _jsx(View, { className: cm.toastContainer({ position }), children: children });
55
+ };
56
+ const ToastContext = createContext(null);
57
+ let toastCounter = 0;
58
+ /**
59
+ * Renders a ToastProvider component.
60
+ * @param root0 - Component props.
61
+ * @param root0.children - App content.
62
+ * @param root0.position - Toast position.
63
+ * @returns The rendered ToastProvider element.
64
+ */
65
+ export const ToastProvider = ({ children, position = 'bottom-right' }) => {
66
+ const [toasts, setToasts] = useState([]);
67
+ const toast = useCallback((props) => {
68
+ const id = ++toastCounter;
69
+ setToasts((prev) => [...prev, { id, props: props }]);
70
+ return id;
71
+ }, []);
72
+ const dismiss = useCallback((id) => {
73
+ setToasts((prev) => prev.filter((t) => t.id !== id));
74
+ }, []);
75
+ return (_jsxs(ToastContext.Provider, { value: { toast, dismiss }, children: [children, _jsx(ToastContainer, { position: position, children: toasts.map((item) => (_jsx(Toast, { ...item.props, onDismiss: () => dismiss(item.id) }, item.id))) })] }));
76
+ };
77
+ /**
78
+ * Hook for toast notifications.
79
+ * @returns The toast context value.
80
+ */
81
+ export function useToast() {
82
+ const context = useContext(ToastContext);
83
+ if (!context) {
84
+ throw new Error(t('ui.toast.error.noProvider', undefined, {
85
+ defaultValue: 'useToast must be used within a ToastProvider',
86
+ }));
87
+ }
88
+ return context;
89
+ }