@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,48 @@
1
+ /**
2
+ * Form components for React Native.
3
+ *
4
+ * @module
5
+ */
6
+ import React from 'react';
7
+ import type { BaseProps, FormFieldProps, FormProps } from '@molecule/app-ui';
8
+ /** Local label props (not exported from `@molecule/app-ui`). */
9
+ interface LabelProps extends BaseProps {
10
+ children?: unknown;
11
+ required?: boolean;
12
+ }
13
+ /**
14
+ * Renders a Form component.
15
+ *
16
+ * In React Native there is no `<form>` element. This is a View wrapper
17
+ * that provides consistent spacing.
18
+ * @param root0 - Component props.
19
+ * @param root0.children - Form content.
20
+ * @param root0.onSubmit - Submit handler (unused in RN).
21
+ * @param root0.className - CSS class name override.
22
+ * @param root0.testId - Test identifier.
23
+ * @returns The rendered Form element.
24
+ */
25
+ export declare const Form: React.FC<FormProps>;
26
+ /**
27
+ * Renders a FormField component.
28
+ * @param root0 - Component props.
29
+ * @param root0.children - Field input content.
30
+ * @param root0.label - Field label text.
31
+ * @param root0.error - Error message.
32
+ * @param root0.hint - Hint text.
33
+ * @param root0.required - Whether required.
34
+ * @param root0.className - CSS class name override.
35
+ * @returns The rendered FormField element.
36
+ */
37
+ export declare const FormField: React.FC<FormFieldProps>;
38
+ /**
39
+ * Renders a Label component.
40
+ * @param root0 - Component props.
41
+ * @param root0.children - Label content.
42
+ * @param root0.required - Whether required.
43
+ * @param root0.className - CSS class name override.
44
+ * @returns The rendered Label element.
45
+ */
46
+ export declare const Label: React.FC<LabelProps>;
47
+ export {};
48
+ //# sourceMappingURL=Form.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Form.d.ts","sourceRoot":"","sources":["../../src/components/Form.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAG5E,gEAAgE;AAChE,UAAU,UAAW,SAAQ,SAAS;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,CAOpC,CAAA;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAqB9C,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CAOtC,CAAA"}
@@ -0,0 +1,46 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Text, View } from 'react-native';
3
+ import { getClassMap } from '@molecule/app-ui';
4
+ /**
5
+ * Renders a Form component.
6
+ *
7
+ * In React Native there is no `<form>` element. This is a View wrapper
8
+ * that provides consistent spacing.
9
+ * @param root0 - Component props.
10
+ * @param root0.children - Form content.
11
+ * @param root0.onSubmit - Submit handler (unused in RN).
12
+ * @param root0.className - CSS class name override.
13
+ * @param root0.testId - Test identifier.
14
+ * @returns The rendered Form element.
15
+ */
16
+ export const Form = ({ children, onSubmit: _onSubmit, className, testId }) => {
17
+ const cm = getClassMap();
18
+ return (_jsx(View, { className: cm.cn(cm.formFieldset, className), testID: testId, children: children }));
19
+ };
20
+ /**
21
+ * Renders a FormField component.
22
+ * @param root0 - Component props.
23
+ * @param root0.children - Field input content.
24
+ * @param root0.label - Field label text.
25
+ * @param root0.error - Error message.
26
+ * @param root0.hint - Hint text.
27
+ * @param root0.required - Whether required.
28
+ * @param root0.className - CSS class name override.
29
+ * @returns The rendered FormField element.
30
+ */
31
+ export const FormField = ({ children, label, error, hint, required, className, }) => {
32
+ const cm = getClassMap();
33
+ return (_jsxs(View, { className: cm.cn(cm.formField, className), children: [!!label && (_jsx(Text, { className: cm.cn(cm.labelBlock, cm.label({ required: !!required })), children: label })), _jsx(View, { className: cm.formFieldWrapper, children: children }), !!error && typeof error === 'string' && _jsx(Text, { className: cm.formError, children: error }), !!hint && !error && _jsx(Text, { className: cm.formHint, children: hint })] }));
34
+ };
35
+ /**
36
+ * Renders a Label component.
37
+ * @param root0 - Component props.
38
+ * @param root0.children - Label content.
39
+ * @param root0.required - Whether required.
40
+ * @param root0.className - CSS class name override.
41
+ * @returns The rendered Label element.
42
+ */
43
+ export const Label = ({ children, required, className }) => {
44
+ const cm = getClassMap();
45
+ return (_jsx(Text, { className: cm.cn(cm.label({ required: !!required }), className), children: children }));
46
+ };
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Input component for React Native.
3
+ *
4
+ * @module
5
+ */
6
+ import React from 'react';
7
+ import { TextInput } from 'react-native';
8
+ import type { InputProps } from '@molecule/app-ui';
9
+ /**
10
+ * Text input component.
11
+ */
12
+ export declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<TextInput>>;
13
+ //# sourceMappingURL=Input.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../src/components/Input.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAkC,MAAM,OAAO,CAAA;AACtD,OAAO,EAAmB,SAAS,EAAQ,MAAM,cAAc,CAAA;AAG/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAGlD;;GAEG;AACH,eAAO,MAAM,KAAK,8EA8FjB,CAAA"}
@@ -0,0 +1,36 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * Input component for React Native.
4
+ *
5
+ * @module
6
+ */
7
+ import { forwardRef, useCallback } from 'react';
8
+ import { Pressable, Text, TextInput, View } from 'react-native';
9
+ import { t } from '@molecule/app-i18n';
10
+ import { getClassMap } from '@molecule/app-ui';
11
+ /**
12
+ * Text input component.
13
+ */
14
+ export const Input = forwardRef(({ label, error, hint, size = 'md', leftElement, rightElement, clearable, className, style, testId, disabled, type, placeholder, value, onChange, onFocus, onBlur, required, ..._rest }, ref) => {
15
+ const cm = getClassMap();
16
+ const inputClasses = cm.cn(cm.input({ error: !!error, size }), !!leftElement && cm.inputPadLeft, !!(rightElement || clearable) && cm.inputPadRight, className);
17
+ const handleClear = useCallback(() => {
18
+ if (onChange) {
19
+ // Simulate a change event with empty value
20
+ onChange({ target: { value: '' } });
21
+ }
22
+ }, [onChange]);
23
+ const secureTextEntry = type === 'password';
24
+ const keyboardType = type === 'email'
25
+ ? 'email-address'
26
+ : type === 'number' || type === 'tel'
27
+ ? 'numeric'
28
+ : type === 'url'
29
+ ? 'url'
30
+ : 'default';
31
+ return (_jsxs(View, { className: cm.inputWrapper, children: [!!label && (_jsx(Text, { className: cm.cn(cm.labelBlock, cm.label({ required: !!required })), children: label })), _jsxs(View, { className: cm.inputInner, children: [!!leftElement && (_jsx(View, { className: cm.inputLeftElement, children: leftElement })), _jsx(TextInput, { ref: ref, className: inputClasses, style: style, testID: testId, editable: !disabled, placeholder: placeholder, value: value, onChangeText: (text) => {
32
+ if (onChange) {
33
+ onChange({ target: { value: text } });
34
+ }
35
+ }, onFocus: onFocus, onBlur: onBlur, secureTextEntry: secureTextEntry, keyboardType: keyboardType, accessibilityLabel: typeof label === 'string' ? label : undefined }), clearable && !!value && (_jsx(Pressable, { className: cm.inputClearButton, onPress: handleClear, children: _jsx(Text, { children: t('ui.input.clear', undefined, { defaultValue: '×' }) }) })), !!rightElement && !clearable && (_jsx(View, { className: cm.inputRightElement, children: rightElement }))] }), !!error && typeof error === 'string' && _jsx(Text, { className: cm.formError, children: error }), !!hint && !error && _jsx(Text, { className: cm.formHint, children: hint })] }));
36
+ });
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Layout components for React Native.
3
+ *
4
+ * @module
5
+ */
6
+ import React from 'react';
7
+ import type { ContainerProps, FlexProps, GridProps, SpacerProps } from '@molecule/app-ui';
8
+ /**
9
+ * Renders a Container component.
10
+ * @param root0 - Component props.
11
+ * @param root0.children - Container content.
12
+ * @param root0.maxWidth - Maximum width constraint.
13
+ * @param root0.centered - Whether centered.
14
+ * @param root0.className - CSS class name override.
15
+ * @param root0.style - Inline style object.
16
+ * @param root0.testId - Test identifier.
17
+ * @returns The rendered Container element.
18
+ */
19
+ export declare const Container: React.FC<ContainerProps>;
20
+ /**
21
+ * Renders a Flex component.
22
+ * @param root0 - Component props.
23
+ * @param root0.children - Flex content.
24
+ * @param root0.direction - Flex direction.
25
+ * @param root0.justify - Justify content.
26
+ * @param root0.align - Align items.
27
+ * @param root0.wrap - Flex wrap behavior.
28
+ * @param root0.gap - Gap between items.
29
+ * @param root0.className - CSS class name override.
30
+ * @param root0.style - Inline style object.
31
+ * @param root0.testId - Test identifier.
32
+ * @param root0.onClick - Click handler.
33
+ * @returns The rendered Flex element.
34
+ */
35
+ export declare const Flex: React.FC<FlexProps>;
36
+ /**
37
+ * Renders a Grid component.
38
+ * @param root0 - Component props.
39
+ * @param root0.children - Grid content.
40
+ * @param root0.columns - Number of columns.
41
+ * @param root0.gap - Gap between items.
42
+ * @param root0.className - CSS class name override.
43
+ * @param root0.style - Inline style object.
44
+ * @param root0.testId - Test identifier.
45
+ * @returns The rendered Grid element.
46
+ */
47
+ export declare const Grid: React.FC<GridProps>;
48
+ /**
49
+ * Renders a Spacer component.
50
+ * @param root0 - Component props.
51
+ * @param root0.size - Spacer size.
52
+ * @param root0.horizontal - Whether horizontal.
53
+ * @param root0.className - CSS class name override.
54
+ * @param root0.style - Inline style object.
55
+ * @param root0.testId - Test identifier.
56
+ * @returns The rendered Spacer element.
57
+ */
58
+ export declare const Spacer: React.FC<SpacerProps>;
59
+ //# sourceMappingURL=Layout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Layout.d.ts","sourceRoot":"","sources":["../../src/components/Layout.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,SAAS,EAAQ,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAG/F;;;;;;;;;;GAUG;AACH,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAoB9C,CAAA;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,CAgDpC,CAAA;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,CAgBpC,CAAA;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CA0BxC,CAAA"}
@@ -0,0 +1,92 @@
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 Container component.
6
+ * @param root0 - Component props.
7
+ * @param root0.children - Container content.
8
+ * @param root0.maxWidth - Maximum width constraint.
9
+ * @param root0.centered - Whether centered.
10
+ * @param root0.className - CSS class name override.
11
+ * @param root0.style - Inline style object.
12
+ * @param root0.testId - Test identifier.
13
+ * @returns The rendered Container element.
14
+ */
15
+ export const Container = ({ children, maxWidth = 'lg', centered = true, className, style, testId, }) => {
16
+ const cm = getClassMap();
17
+ const containerClasses = cm.cn(cm.container({ size: maxWidth }), centered && cm.mxAuto, className);
18
+ return (_jsx(View, { className: containerClasses, style: style, testID: testId, children: children }));
19
+ };
20
+ /**
21
+ * Renders a Flex component.
22
+ * @param root0 - Component props.
23
+ * @param root0.children - Flex content.
24
+ * @param root0.direction - Flex direction.
25
+ * @param root0.justify - Justify content.
26
+ * @param root0.align - Align items.
27
+ * @param root0.wrap - Flex wrap behavior.
28
+ * @param root0.gap - Gap between items.
29
+ * @param root0.className - CSS class name override.
30
+ * @param root0.style - Inline style object.
31
+ * @param root0.testId - Test identifier.
32
+ * @param root0.onClick - Click handler.
33
+ * @returns The rendered Flex element.
34
+ */
35
+ export const Flex = ({ children, direction = 'row', justify, align, wrap, gap, className, style, testId, onClick, }) => {
36
+ const cm = getClassMap();
37
+ const dirMap = {
38
+ row: 'row',
39
+ column: 'col',
40
+ 'row-reverse': 'row-reverse',
41
+ 'column-reverse': 'col-reverse',
42
+ };
43
+ const cmDirection = dirMap[direction] || 'row';
44
+ const cmGap = typeof gap === 'string' && ['none', 'xs', 'sm', 'md', 'lg', 'xl'].includes(gap)
45
+ ? gap
46
+ : undefined;
47
+ const flexClasses = cm.cn(cm.flex({
48
+ direction: cmDirection,
49
+ align: align,
50
+ justify: justify,
51
+ wrap: wrap,
52
+ gap: cmGap,
53
+ }), className);
54
+ return (_jsx(View, { className: flexClasses, style: style, testID: testId, ...(onClick ? { onTouchEnd: onClick } : {}), children: children }));
55
+ };
56
+ /**
57
+ * Renders a Grid component.
58
+ * @param root0 - Component props.
59
+ * @param root0.children - Grid content.
60
+ * @param root0.columns - Number of columns.
61
+ * @param root0.gap - Gap between items.
62
+ * @param root0.className - CSS class name override.
63
+ * @param root0.style - Inline style object.
64
+ * @param root0.testId - Test identifier.
65
+ * @returns The rendered Grid element.
66
+ */
67
+ export const Grid = ({ children, columns, gap, className, style, testId }) => {
68
+ const cm = getClassMap();
69
+ const cmCols = typeof columns === 'number' ? columns : undefined;
70
+ const cmGap = typeof gap === 'string' && ['none', 'xs', 'sm', 'md', 'lg', 'xl'].includes(gap)
71
+ ? gap
72
+ : undefined;
73
+ const gridClasses = cm.cn(cm.grid({ cols: cmCols, gap: cmGap }), className);
74
+ return (_jsx(View, { className: gridClasses, style: style, testID: testId, children: children }));
75
+ };
76
+ /**
77
+ * Renders a Spacer component.
78
+ * @param root0 - Component props.
79
+ * @param root0.size - Spacer size.
80
+ * @param root0.horizontal - Whether horizontal.
81
+ * @param root0.className - CSS class name override.
82
+ * @param root0.style - Inline style object.
83
+ * @param root0.testId - Test identifier.
84
+ * @returns The rendered Spacer element.
85
+ */
86
+ export const Spacer = ({ size = 'md', horizontal, className, style, testId, }) => {
87
+ const cm = getClassMap();
88
+ const isNamedSize = typeof size === 'string' && ['xs', 'sm', 'md', 'lg', 'xl'].includes(size);
89
+ const spacerClasses = cm.cn(isNamedSize ? cm.spacer({ size: size, horizontal: !!horizontal }) : '', className);
90
+ const sizeStyle = typeof size === 'number' ? (horizontal ? { width: size } : { height: size }) : undefined;
91
+ return (_jsx(View, { className: spacerClasses, style: { ...style, ...sizeStyle }, testID: testId }));
92
+ };
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Modal component for React Native.
3
+ *
4
+ * @module
5
+ */
6
+ import React from 'react';
7
+ import type { ModalProps } from '@molecule/app-ui';
8
+ /**
9
+ * Renders a Modal component.
10
+ * @param root0 - Component props.
11
+ * @param root0.children - Modal body content.
12
+ * @param root0.open - Whether open.
13
+ * @param root0.onClose - Close handler.
14
+ * @param root0.title - Modal title text.
15
+ * @param root0.size - Modal size.
16
+ * @param root0.footer - Footer content.
17
+ * @param root0.className - CSS class name override.
18
+ * @param root0.testId - Test identifier.
19
+ * @returns The rendered Modal element.
20
+ */
21
+ export declare const Modal: React.FC<ModalProps>;
22
+ //# sourceMappingURL=Modal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../src/components/Modal.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAGlD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CA0CtC,CAAA"}
@@ -0,0 +1,22 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Modal as RNModal, Pressable, ScrollView, Text, View } from 'react-native';
3
+ import { t } from '@molecule/app-i18n';
4
+ import { getClassMap } from '@molecule/app-ui';
5
+ /**
6
+ * Renders a Modal component.
7
+ * @param root0 - Component props.
8
+ * @param root0.children - Modal body content.
9
+ * @param root0.open - Whether open.
10
+ * @param root0.onClose - Close handler.
11
+ * @param root0.title - Modal title text.
12
+ * @param root0.size - Modal size.
13
+ * @param root0.footer - Footer content.
14
+ * @param root0.className - CSS class name override.
15
+ * @param root0.testId - Test identifier.
16
+ * @returns The rendered Modal element.
17
+ */
18
+ export const Modal = ({ children, open, onClose, title, size = 'md', footer, className, testId, }) => {
19
+ const cm = getClassMap();
20
+ const contentClasses = cm.cn(cm.modal({ size }), className);
21
+ return (_jsx(RNModal, { visible: !!open, transparent: true, animationType: "fade", onRequestClose: onClose, testID: testId, children: _jsx(Pressable, { className: cm.dialogOverlay, onPress: onClose, accessibilityRole: "none", children: _jsx(View, { className: cm.cn(cm.dialogWrapper, 'pointer-events-auto'), children: _jsxs(Pressable, { className: contentClasses, onPress: (e) => e.stopPropagation(), children: [_jsxs(View, { className: cm.dialogHeader, children: [!!title && _jsx(Text, { className: cm.dialogTitle, children: title }), _jsx(Pressable, { className: cm.dialogClose, onPress: onClose, accessibilityLabel: t('ui.modal.close', undefined, { defaultValue: 'Close' }), accessibilityRole: "button", children: _jsx(Text, { children: t('ui.icon.close', undefined, { defaultValue: '✕' }) }) })] }), _jsx(ScrollView, { className: cm.dialogBody, children: children }), !!footer && _jsx(View, { className: cm.dialogFooter, children: footer })] }) }) }) }));
22
+ };
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Pagination component for React Native.
3
+ *
4
+ * @module
5
+ */
6
+ import React from 'react';
7
+ import type { PaginationProps } from '@molecule/app-ui';
8
+ /**
9
+ * Renders a Pagination component.
10
+ * @param root0 - Component props.
11
+ * @param root0.page - Current page number.
12
+ * @param root0.totalPages - Total number of pages.
13
+ * @param root0.onChange - Page change handler.
14
+ * @param root0.siblings - Visible sibling pages.
15
+ * @param root0.boundaries - Boundary page count.
16
+ * @param root0.size - Pagination size.
17
+ * @param root0.showFirstLast - Show first/last buttons.
18
+ * @param root0.className - CSS class name override.
19
+ * @param root0.testId - Test identifier.
20
+ * @returns The rendered Pagination element.
21
+ */
22
+ export declare const Pagination: React.FC<PaginationProps>;
23
+ //# sourceMappingURL=Pagination.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Pagination.d.ts","sourceRoot":"","sources":["../../src/components/Pagination.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAGvD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAyHhD,CAAA"}
@@ -0,0 +1,46 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Pressable, Text, View } from 'react-native';
3
+ import { t } from '@molecule/app-i18n';
4
+ import { getClassMap } from '@molecule/app-ui';
5
+ /**
6
+ * Renders a Pagination component.
7
+ * @param root0 - Component props.
8
+ * @param root0.page - Current page number.
9
+ * @param root0.totalPages - Total number of pages.
10
+ * @param root0.onChange - Page change handler.
11
+ * @param root0.siblings - Visible sibling pages.
12
+ * @param root0.boundaries - Boundary page count.
13
+ * @param root0.size - Pagination size.
14
+ * @param root0.showFirstLast - Show first/last buttons.
15
+ * @param root0.className - CSS class name override.
16
+ * @param root0.testId - Test identifier.
17
+ * @returns The rendered Pagination element.
18
+ */
19
+ export const Pagination = ({ page, totalPages, onChange, siblings = 1, boundaries = 1, size = 'md', showFirstLast, className, testId, }) => {
20
+ const cm = getClassMap();
21
+ const range = (start, end) => Array.from({ length: end - start + 1 }, (_, i) => start + i);
22
+ const buildPaginationRange = () => {
23
+ const total = totalPages;
24
+ const sibling = siblings;
25
+ const boundary = boundaries;
26
+ const leftBoundary = range(1, Math.min(boundary, total));
27
+ const rightBoundary = range(Math.max(total - boundary + 1, boundary + 1), total);
28
+ const siblingsStart = Math.max(Math.min(page - sibling, total - boundary - sibling * 2 - 1), boundary + 2);
29
+ const siblingsEnd = Math.min(Math.max(page + sibling, boundary + sibling * 2 + 2), total - boundary - 1);
30
+ const items = [];
31
+ items.push(...leftBoundary);
32
+ if (siblingsStart > boundary + 2)
33
+ items.push('ellipsis');
34
+ else if (boundary + 1 < siblingsStart)
35
+ items.push(boundary + 1);
36
+ items.push(...range(siblingsStart, siblingsEnd));
37
+ if (siblingsEnd < total - boundary - 1)
38
+ items.push('ellipsis');
39
+ else if (total - boundary > siblingsEnd)
40
+ items.push(total - boundary);
41
+ items.push(...rightBoundary);
42
+ return [...new Set(items)];
43
+ };
44
+ const pages = buildPaginationRange();
45
+ return (_jsx(View, { className: cm.cn(cm.paginationRoot, className), testID: testId, accessibilityRole: "toolbar", accessibilityLabel: t('ui.pagination.nav', undefined, { defaultValue: 'Pagination' }), children: _jsxs(View, { className: cm.paginationContent, children: [showFirstLast && (_jsx(Pressable, { className: cm.paginationPrevious, onPress: () => onChange?.(1), disabled: page <= 1, accessibilityLabel: t('ui.pagination.first', undefined, { defaultValue: 'First' }), children: _jsx(Text, { children: t('ui.icon.chevronsLeft', undefined, { defaultValue: '«' }) }) })), _jsx(Pressable, { className: cm.paginationPrevious, onPress: () => onChange?.(page - 1), disabled: page <= 1, accessibilityLabel: t('ui.pagination.previous', undefined, { defaultValue: 'Previous' }), children: _jsx(Text, { children: t('ui.icon.chevronLeft', undefined, { defaultValue: '‹' }) }) }), pages.map((item, i) => item === 'ellipsis' ? (_jsx(View, { className: cm.paginationEllipsis, children: _jsx(Text, { children: t('ui.icon.ellipsis', undefined, { defaultValue: '…' }) }) }, `ellipsis-${i}`)) : (_jsx(Pressable, { className: cm.cn(cm.paginationLink, cm.pagination({ active: item === page, size })), onPress: () => onChange?.(item), accessibilityRole: "button", accessibilityState: { selected: item === page }, accessibilityLabel: t('ui.pagination.goToPage', { page: String(item) }, { defaultValue: `Page ${item}` }), children: _jsx(Text, { children: item }) }, item))), _jsx(Pressable, { className: cm.paginationNext, onPress: () => onChange?.(page + 1), disabled: page >= totalPages, accessibilityLabel: t('ui.pagination.next', undefined, { defaultValue: 'Next' }), children: _jsx(Text, { children: t('ui.icon.chevronRight', undefined, { defaultValue: '›' }) }) }), showFirstLast && (_jsx(Pressable, { className: cm.paginationNext, onPress: () => onChange?.(totalPages), disabled: page >= totalPages, accessibilityLabel: t('ui.pagination.last', undefined, { defaultValue: 'Last' }), children: _jsx(Text, { children: t('ui.icon.chevronsRight', undefined, { defaultValue: '»' }) }) }))] }) }));
46
+ };
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Progress component for React Native.
3
+ *
4
+ * @module
5
+ */
6
+ import React from 'react';
7
+ import type { BaseProps, ColorVariant, Size } from '@molecule/app-ui';
8
+ /** Local progress props (not exported from `@molecule/app-ui`). */
9
+ interface ProgressProps extends BaseProps {
10
+ value?: number;
11
+ max?: number;
12
+ label?: unknown;
13
+ showValue?: boolean;
14
+ color?: ColorVariant;
15
+ size?: Size;
16
+ indeterminate?: boolean;
17
+ }
18
+ /**
19
+ * Renders a Progress component.
20
+ * @param root0 - Component props.
21
+ * @param root0.value - Current progress value.
22
+ * @param root0.max - Maximum progress value.
23
+ * @param root0.label - Progress label text.
24
+ * @param root0.showValue - Whether to show value.
25
+ * @param root0.color - Progress bar color.
26
+ * @param root0.size - Progress bar size.
27
+ * @param root0.indeterminate - Whether indeterminate.
28
+ * @param root0.className - CSS class name override.
29
+ * @param root0.testId - Test identifier.
30
+ * @returns The rendered Progress element.
31
+ */
32
+ export declare const Progress: React.FC<ProgressProps>;
33
+ export {};
34
+ //# sourceMappingURL=Progress.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Progress.d.ts","sourceRoot":"","sources":["../../src/components/Progress.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAGrE,mEAAmE;AACnE,UAAU,aAAc,SAAQ,SAAS;IACvC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,KAAK,CAAC,EAAE,YAAY,CAAA;IACpB,IAAI,CAAC,EAAE,IAAI,CAAA;IACX,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAuD5C,CAAA"}
@@ -0,0 +1,29 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Text, View } from 'react-native';
3
+ import { t } from '@molecule/app-i18n';
4
+ import { getClassMap } from '@molecule/app-ui';
5
+ /**
6
+ * Renders a Progress component.
7
+ * @param root0 - Component props.
8
+ * @param root0.value - Current progress value.
9
+ * @param root0.max - Maximum progress value.
10
+ * @param root0.label - Progress label text.
11
+ * @param root0.showValue - Whether to show value.
12
+ * @param root0.color - Progress bar color.
13
+ * @param root0.size - Progress bar size.
14
+ * @param root0.indeterminate - Whether indeterminate.
15
+ * @param root0.className - CSS class name override.
16
+ * @param root0.testId - Test identifier.
17
+ * @returns The rendered Progress element.
18
+ */
19
+ export const Progress = ({ value = 0, max = 100, label, showValue, color = 'primary', size = 'md', indeterminate, className, testId, }) => {
20
+ const cm = getClassMap();
21
+ const percentage = Math.min(Math.max((value / max) * 100, 0), 100);
22
+ return (_jsxs(View, { className: cm.cn(cm.progressWrapper, className), testID: testId, children: [(label || showValue) && (_jsxs(View, { className: cm.progressLabelContainer, children: [!!label && _jsx(Text, { className: cm.progressLabelText, children: label }), showValue && (_jsx(Text, { className: cm.progressLabelText, children: t('ui.progress.value', { value: String(Math.round(percentage)) }, { defaultValue: '{{value}}%' }) }))] })), _jsx(View, { className: cm.cn(cm.progress(), cm.progressHeight(size)), accessibilityRole: "progressbar", accessibilityLabel: typeof label === 'string'
23
+ ? label
24
+ : t('ui.progress.label', undefined, { defaultValue: 'Progress' }), accessibilityValue: {
25
+ min: 0,
26
+ max,
27
+ now: indeterminate ? undefined : value,
28
+ }, children: _jsx(View, { className: cm.cn(cm.progressBar(), cm.progressColor(color), indeterminate && cm.progressIndeterminate), style: indeterminate ? { width: '50%' } : { width: `${percentage}%` } }) })] }));
29
+ };
@@ -0,0 +1,23 @@
1
+ /**
2
+ * RadioGroup component for React Native.
3
+ *
4
+ * @module
5
+ */
6
+ import React from 'react';
7
+ import type { RadioGroupProps } from '@molecule/app-ui';
8
+ /**
9
+ * Renders a RadioGroup component.
10
+ * @param root0 - Component props.
11
+ * @param root0.label - Group label text.
12
+ * @param root0.options - Radio options array.
13
+ * @param root0.value - Selected value.
14
+ * @param root0.onChange - Change handler.
15
+ * @param root0.direction - Layout direction.
16
+ * @param root0.error - Error message.
17
+ * @param root0.disabled - Whether disabled.
18
+ * @param root0.className - CSS class name override.
19
+ * @param root0.testId - Test identifier.
20
+ * @returns The rendered RadioGroup element.
21
+ */
22
+ export declare const RadioGroup: React.FC<RadioGroupProps>;
23
+ //# sourceMappingURL=RadioGroup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RadioGroup.d.ts","sourceRoot":"","sources":["../../src/components/RadioGroup.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAGvD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CA2DhD,CAAA"}
@@ -0,0 +1,35 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Pressable, Text, View } from 'react-native';
3
+ import { t } from '@molecule/app-i18n';
4
+ import { getClassMap } from '@molecule/app-ui';
5
+ /**
6
+ * Renders a RadioGroup component.
7
+ * @param root0 - Component props.
8
+ * @param root0.label - Group label text.
9
+ * @param root0.options - Radio options array.
10
+ * @param root0.value - Selected value.
11
+ * @param root0.onChange - Change handler.
12
+ * @param root0.direction - Layout direction.
13
+ * @param root0.error - Error message.
14
+ * @param root0.disabled - Whether disabled.
15
+ * @param root0.className - CSS class name override.
16
+ * @param root0.testId - Test identifier.
17
+ * @returns The rendered RadioGroup element.
18
+ */
19
+ export const RadioGroup = ({ label, options = [], value, onChange, direction = 'vertical', error, disabled, className, testId, }) => {
20
+ const cm = getClassMap();
21
+ const layoutClasses = cm.radioGroupLayout(direction);
22
+ return (_jsxs(View, { className: className, testID: testId, accessibilityRole: "radiogroup", accessibilityLabel: typeof label === 'string'
23
+ ? label
24
+ : t('ui.radioGroup.label', undefined, { defaultValue: 'Radio group' }), children: [!!label && _jsx(Text, { className: cm.radioGroupLabel, children: label }), _jsx(View, { className: layoutClasses, children: options.map((option) => {
25
+ const optValue = typeof option === 'string' ? option : option.value;
26
+ const optLabel = typeof option === 'string' ? option : option.label;
27
+ const optDisabled = disabled || (typeof option === 'object' && option.disabled);
28
+ const isSelected = optValue === value;
29
+ return (_jsxs(Pressable, { className: cm.controlLabel, onPress: () => {
30
+ if (!optDisabled && onChange) {
31
+ onChange(optValue);
32
+ }
33
+ }, disabled: !!optDisabled, accessibilityRole: "radio", accessibilityState: { selected: isSelected, disabled: !!optDisabled }, children: [_jsx(View, { className: cm.radio({ error: !!error }), children: isSelected && _jsx(View, { className: cm.roundedFull }) }), _jsx(Text, { className: cm.cn(cm.controlText, optDisabled && cm.controlDisabled), children: optLabel })] }, optValue));
34
+ }) }), !!error && typeof error === 'string' && _jsx(Text, { className: cm.formError, children: error })] }));
35
+ };
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Select component for React Native.
3
+ *
4
+ * Uses a Pressable that opens a Modal picker since React Native
5
+ * has no native `<select>` element.
6
+ *
7
+ * @module
8
+ */
9
+ import React from 'react';
10
+ import type { SelectProps } from '@molecule/app-ui';
11
+ /**
12
+ * Renders a Select component.
13
+ * @param root0 - Component props.
14
+ * @param root0.label - Select label text.
15
+ * @param root0.options - Select options array.
16
+ * @param root0.value - Selected value.
17
+ * @param root0.onChange - Change handler.
18
+ * @param root0.placeholder - Placeholder text.
19
+ * @param root0.error - Error message.
20
+ * @param root0.hint - Hint text.
21
+ * @param root0.size - Select size.
22
+ * @param root0.disabled - Whether disabled.
23
+ * @param root0.required - Whether required.
24
+ * @param root0.className - CSS class name override.
25
+ * @param root0.testId - Test identifier.
26
+ * @returns The rendered Select element.
27
+ */
28
+ export declare const Select: React.FC<SelectProps>;
29
+ //# sourceMappingURL=Select.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../src/components/Select.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAmB,MAAM,OAAO,CAAA;AAIvC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAGnD;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CA6FxC,CAAA"}