@molecule/app-ui-react-native 1.0.9 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +172 -327
- package/dist/components/Button.d.ts +2 -2
- package/dist/components/Button.d.ts.map +1 -1
- package/dist/components/Button.js +2 -2
- package/dist/components/Card.d.ts +3 -2
- package/dist/components/Card.d.ts.map +1 -1
- package/dist/components/Card.js +11 -3
- package/dist/components/Checkbox.d.ts +2 -2
- package/dist/components/Checkbox.d.ts.map +1 -1
- package/dist/components/Checkbox.js +4 -7
- package/dist/components/Input.d.ts +13 -2
- package/dist/components/Input.d.ts.map +1 -1
- package/dist/components/Input.js +5 -11
- package/dist/components/Layout.d.ts +3 -2
- package/dist/components/Layout.d.ts.map +1 -1
- package/dist/components/Layout.js +2 -2
- package/dist/components/Select.d.ts +2 -2
- package/dist/components/Select.d.ts.map +1 -1
- package/dist/components/Select.js +4 -6
- package/dist/components/Skeleton.d.ts.map +1 -1
- package/dist/components/Skeleton.js +4 -2
- package/dist/components/Switch.d.ts +2 -2
- package/dist/components/Switch.d.ts.map +1 -1
- package/dist/components/Switch.js +3 -7
- package/dist/components/Textarea.d.ts +13 -2
- package/dist/components/Textarea.d.ts.map +1 -1
- package/dist/components/Textarea.js +2 -6
- package/dist/components/Toast.d.ts.map +1 -1
- package/dist/components/Toast.js +4 -2
- package/dist/index.d.ts +6 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -3
- package/dist/types.d.ts +25 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +1 -0
- package/package.json +5 -5
|
@@ -16,11 +16,11 @@ import { getClassMap } from '@molecule/app-ui';
|
|
|
16
16
|
* @param root0.className - CSS class name override.
|
|
17
17
|
* @param root0.testId - Test identifier.
|
|
18
18
|
* @param root0.disabled - Whether disabled.
|
|
19
|
-
* @param root0.onClick -
|
|
19
|
+
* @param root0.onClick - Called when the button is pressed.
|
|
20
20
|
* @returns The rendered Button element.
|
|
21
21
|
*/
|
|
22
22
|
export const Button = ({ children, variant = 'solid', color = 'primary', size = 'md', loading = false, loadingText, fullWidth = false, leftIcon, rightIcon, className, testId, disabled, onClick, }) => {
|
|
23
23
|
const cm = getClassMap();
|
|
24
24
|
const classes = cm.cn(cm.button({ variant, color, size, fullWidth }), className);
|
|
25
|
-
return (_jsxs(Pressable, { className: classes, disabled: disabled || loading, onPress: onClick, testID: testId, accessibilityRole: "button", accessibilityState: { disabled: disabled || loading, busy: loading }, children: [loading && _jsx(ActivityIndicator, { size: "small", className: cm.buttonIconLeft }), !loading && !!leftIcon && (_jsx(View, { className: cm.buttonIconLeft, children: leftIcon })), _jsx(Text, { children: loading && loadingText ? loadingText : children }), !loading && !!rightIcon && (_jsx(View, { className: cm.buttonIconRight, children: rightIcon }))] }));
|
|
25
|
+
return (_jsxs(Pressable, { className: classes, disabled: disabled || loading, onPress: onClick ? () => onClick() : undefined, testID: testId, accessibilityRole: "button", accessibilityState: { disabled: disabled || loading, busy: loading }, children: [loading && _jsx(ActivityIndicator, { size: "small", className: cm.buttonIconLeft }), !loading && !!leftIcon && (_jsx(View, { className: cm.buttonIconLeft, children: leftIcon })), _jsx(Text, { children: loading && loadingText ? loadingText : children }), !loading && !!rightIcon && (_jsx(View, { className: cm.buttonIconRight, children: rightIcon }))] }));
|
|
26
26
|
};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
6
|
import React from 'react';
|
|
7
|
-
import type { CardProps } from '
|
|
7
|
+
import type { CardProps } from '../types.js';
|
|
8
8
|
/**
|
|
9
9
|
* Renders a Card component.
|
|
10
10
|
* @param root0 - Component props.
|
|
@@ -15,7 +15,8 @@ import type { CardProps } from '@molecule/app-ui';
|
|
|
15
15
|
* @param root0.className - CSS class name override.
|
|
16
16
|
* @param root0.style - Inline style object.
|
|
17
17
|
* @param root0.testId - Test identifier.
|
|
18
|
-
* @param root0.onClick -
|
|
18
|
+
* @param root0.onClick - Called when the card is pressed.
|
|
19
|
+
* @param root0.disabled - Whether the card is disabled.
|
|
19
20
|
* @returns The rendered Card element.
|
|
20
21
|
*/
|
|
21
22
|
export declare const Card: React.FC<CardProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../../src/components/Card.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../../src/components/Card.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAE5C;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,CAsCpC,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,QAAQ,EAAE,OAAO,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,CAM1E,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,QAAQ,EAAE,OAAO,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,CAMzE,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,QAAQ,EAAE,OAAO,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,CAM/E,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,QAAQ,EAAE,OAAO,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,CAM3E,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,QAAQ,EAAE,OAAO,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,CAM1E,CAAA"}
|
package/dist/components/Card.js
CHANGED
|
@@ -11,14 +11,22 @@ import { getClassMap } from '@molecule/app-ui';
|
|
|
11
11
|
* @param root0.className - CSS class name override.
|
|
12
12
|
* @param root0.style - Inline style object.
|
|
13
13
|
* @param root0.testId - Test identifier.
|
|
14
|
-
* @param root0.onClick -
|
|
14
|
+
* @param root0.onClick - Called when the card is pressed.
|
|
15
|
+
* @param root0.disabled - Whether the card is disabled.
|
|
15
16
|
* @returns The rendered Card element.
|
|
16
17
|
*/
|
|
17
|
-
export const Card = ({ children, variant = 'elevated', padding = 'md', interactive, className, style, testId, onClick, }) => {
|
|
18
|
+
export const Card = ({ children, variant = 'elevated', padding = 'md', interactive, className, style, testId, onClick, disabled, }) => {
|
|
18
19
|
const cm = getClassMap();
|
|
19
20
|
const classes = cm.cn(cm.card({ variant: variant }), cm.cardPadding(padding), interactive && cm.cardInteractive, className);
|
|
20
21
|
const Wrapper = onClick || interactive ? Pressable : View;
|
|
21
|
-
return (_jsx(Wrapper, { className: classes, style: style, testID: testId, ...(onClick
|
|
22
|
+
return (_jsx(Wrapper, { className: classes, style: style, testID: testId, ...(onClick
|
|
23
|
+
? {
|
|
24
|
+
onPress: () => onClick(),
|
|
25
|
+
disabled,
|
|
26
|
+
accessibilityRole: 'button',
|
|
27
|
+
accessibilityState: { disabled },
|
|
28
|
+
}
|
|
29
|
+
: {}), children: children }));
|
|
22
30
|
};
|
|
23
31
|
/**
|
|
24
32
|
* Renders a CardHeader component.
|
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
6
|
import React from 'react';
|
|
7
|
-
import type { CheckboxProps } from '
|
|
7
|
+
import type { CheckboxProps } from '../types.js';
|
|
8
8
|
/**
|
|
9
9
|
* Renders a Checkbox component.
|
|
10
10
|
* @param root0 - Component props.
|
|
11
11
|
* @param root0.label - Checkbox label text.
|
|
12
12
|
* @param root0.checked - Whether checked.
|
|
13
13
|
* @param root0.indeterminate - Whether indeterminate.
|
|
14
|
-
* @param root0.
|
|
14
|
+
* @param root0.onCheckedChange - Receives the new checked state.
|
|
15
15
|
* @param root0.error - Error message.
|
|
16
16
|
* @param root0.disabled - Whether disabled.
|
|
17
17
|
* @param root0.className - CSS class name override.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../src/components/Checkbox.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../src/components/Checkbox.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAA;AAMzB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAEhD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAyC5C,CAAA"}
|
|
@@ -8,23 +8,20 @@ import { getClassMap } from '@molecule/app-ui';
|
|
|
8
8
|
* @param root0.label - Checkbox label text.
|
|
9
9
|
* @param root0.checked - Whether checked.
|
|
10
10
|
* @param root0.indeterminate - Whether indeterminate.
|
|
11
|
-
* @param root0.
|
|
11
|
+
* @param root0.onCheckedChange - Receives the new checked state.
|
|
12
12
|
* @param root0.error - Error message.
|
|
13
13
|
* @param root0.disabled - Whether disabled.
|
|
14
14
|
* @param root0.className - CSS class name override.
|
|
15
15
|
* @param root0.testId - Test identifier.
|
|
16
16
|
* @returns The rendered Checkbox element.
|
|
17
17
|
*/
|
|
18
|
-
export const Checkbox = ({ label, checked, indeterminate,
|
|
18
|
+
export const Checkbox = ({ label, checked, indeterminate, onCheckedChange, error, disabled, className, testId, }) => {
|
|
19
19
|
const { t } = useTranslation();
|
|
20
20
|
const cm = getClassMap();
|
|
21
21
|
const boxClasses = cm.cn(cm.checkbox({ error: !!error }), className);
|
|
22
22
|
return (_jsxs(Pressable, { className: cm.controlLabel, onPress: () => {
|
|
23
|
-
if (!disabled
|
|
24
|
-
|
|
25
|
-
target: { checked: !checked },
|
|
26
|
-
});
|
|
27
|
-
}
|
|
23
|
+
if (!disabled)
|
|
24
|
+
onCheckedChange?.(!checked);
|
|
28
25
|
}, disabled: disabled, testID: testId, accessibilityRole: "checkbox", accessibilityState: {
|
|
29
26
|
checked: indeterminate ? 'mixed' : !!checked,
|
|
30
27
|
disabled,
|
|
@@ -5,9 +5,20 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import React from 'react';
|
|
7
7
|
import { TextInput } from 'react-native';
|
|
8
|
-
import type { InputProps } from '@molecule/app-ui';
|
|
9
8
|
/**
|
|
10
9
|
* Text input component.
|
|
11
10
|
*/
|
|
12
|
-
export declare const Input: React.ForwardRefExoticComponent<InputProps &
|
|
11
|
+
export declare const Input: React.ForwardRefExoticComponent<Omit<import("@molecule/app-ui").InputProps, "onChange" | "onClick" | "onDoubleClick" | "onMouseEnter" | "onMouseLeave" | "onFocus" | "onBlur" | "onKeyDown" | "onKeyUp" | "onKeyPress" | "onInput"> & {
|
|
12
|
+
onChange?: undefined;
|
|
13
|
+
onClick?: undefined;
|
|
14
|
+
onDoubleClick?: undefined;
|
|
15
|
+
onMouseEnter?: undefined;
|
|
16
|
+
onMouseLeave?: undefined;
|
|
17
|
+
onFocus?: (() => void) | undefined;
|
|
18
|
+
onBlur?: (() => void) | undefined;
|
|
19
|
+
onKeyDown?: undefined;
|
|
20
|
+
onKeyUp?: undefined;
|
|
21
|
+
onKeyPress?: undefined;
|
|
22
|
+
onInput?: undefined;
|
|
23
|
+
} & React.RefAttributes<TextInput>>;
|
|
13
24
|
//# sourceMappingURL=Input.d.ts.map
|
|
@@ -1 +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;
|
|
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;AAO/D;;GAEG;AACH,eAAO,MAAM,KAAK;;;;;;;;;;;;mCAmGjB,CAAA"}
|
package/dist/components/Input.js
CHANGED
|
@@ -11,16 +11,14 @@ import { getClassMap } from '@molecule/app-ui';
|
|
|
11
11
|
/**
|
|
12
12
|
* Text input component.
|
|
13
13
|
*/
|
|
14
|
-
export const Input = forwardRef(({ label, error, hint, size = 'md', leftElement, rightElement, clearable, className, style, testId, disabled, type, placeholder, value,
|
|
14
|
+
export const Input = forwardRef(({ label, error, hint, size = 'md', leftElement, rightElement, clearable, clearLabel, onClear, className, style, testId, disabled, type, placeholder, value, onValueChange, onFocus, onBlur, required, ..._rest }, ref) => {
|
|
15
15
|
const { t } = useTranslation();
|
|
16
16
|
const cm = getClassMap();
|
|
17
17
|
const inputClasses = cm.cn(cm.input({ error: !!error, size }), !!leftElement && cm.inputPadLeft, !!(rightElement || clearable) && cm.inputPadRight, className);
|
|
18
18
|
const handleClear = useCallback(() => {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
}, [onChange]);
|
|
19
|
+
onClear?.();
|
|
20
|
+
onValueChange?.('');
|
|
21
|
+
}, [onClear, onValueChange]);
|
|
24
22
|
const secureTextEntry = type === 'password';
|
|
25
23
|
const keyboardType = type === 'email'
|
|
26
24
|
? 'email-address'
|
|
@@ -29,9 +27,5 @@ export const Input = forwardRef(({ label, error, hint, size = 'md', leftElement,
|
|
|
29
27
|
: type === 'url'
|
|
30
28
|
? 'url'
|
|
31
29
|
: 'default';
|
|
32
|
-
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: (
|
|
33
|
-
if (onChange) {
|
|
34
|
-
onChange({ target: { value: text } });
|
|
35
|
-
}
|
|
36
|
-
}, onFocus: onFocus, onBlur: onBlur, secureTextEntry: secureTextEntry, keyboardType: keyboardType, accessibilityLabel: typeof label === 'string' ? label : undefined }), clearable && !!value && (_jsx(Pressable, { className: cm.inputClearButton, onPress: handleClear, accessibilityRole: "button", accessibilityLabel: t('ui.input.clear', undefined, { defaultValue: 'Clear' }), children: _jsx(Text, { children: t('ui.icon.close', 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 })] }));
|
|
30
|
+
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 === undefined ? undefined : String(value), onChangeText: onValueChange, onFocus: onFocus ? () => onFocus() : undefined, onBlur: onBlur ? () => onBlur() : undefined, secureTextEntry: secureTextEntry, keyboardType: keyboardType, accessibilityLabel: typeof label === 'string' ? label : undefined }), clearable && !!value && (_jsx(Pressable, { className: cm.inputClearButton, onPress: handleClear, disabled: disabled, accessibilityRole: "button", accessibilityLabel: clearLabel ?? t('ui.input.clear', undefined, { defaultValue: 'Clear' }), children: _jsx(Text, { children: t('ui.icon.close', 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 })] }));
|
|
37
31
|
});
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
6
|
import React from 'react';
|
|
7
|
-
import type { ContainerProps,
|
|
7
|
+
import type { ContainerProps, GridProps, SpacerProps } from '@molecule/app-ui';
|
|
8
|
+
import type { FlexProps } from '../types.js';
|
|
8
9
|
/**
|
|
9
10
|
* Renders a Container component.
|
|
10
11
|
* @param root0 - Component props.
|
|
@@ -29,7 +30,7 @@ export declare const Container: React.FC<ContainerProps>;
|
|
|
29
30
|
* @param root0.className - CSS class name override.
|
|
30
31
|
* @param root0.style - Inline style object.
|
|
31
32
|
* @param root0.testId - Test identifier.
|
|
32
|
-
* @param root0.onClick -
|
|
33
|
+
* @param root0.onClick - Called on touch release.
|
|
33
34
|
* @returns The rendered Flex element.
|
|
34
35
|
*/
|
|
35
36
|
export declare const Flex: React.FC<FlexProps>;
|
|
@@ -1 +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,
|
|
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,EAAQ,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAGpF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAE5C;;;;;;;;;;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"}
|
|
@@ -29,7 +29,7 @@ export const Container = ({ children, maxWidth = 'lg', centered = true, classNam
|
|
|
29
29
|
* @param root0.className - CSS class name override.
|
|
30
30
|
* @param root0.style - Inline style object.
|
|
31
31
|
* @param root0.testId - Test identifier.
|
|
32
|
-
* @param root0.onClick -
|
|
32
|
+
* @param root0.onClick - Called on touch release.
|
|
33
33
|
* @returns The rendered Flex element.
|
|
34
34
|
*/
|
|
35
35
|
export const Flex = ({ children, direction = 'row', justify, align, wrap, gap, className, style, testId, onClick, }) => {
|
|
@@ -51,7 +51,7 @@ export const Flex = ({ children, direction = 'row', justify, align, wrap, gap, c
|
|
|
51
51
|
wrap: wrap,
|
|
52
52
|
gap: cmGap,
|
|
53
53
|
}), className);
|
|
54
|
-
return (_jsx(View, { className: flexClasses, style: style, testID: testId,
|
|
54
|
+
return (_jsx(View, { className: flexClasses, style: style, testID: testId, onTouchEnd: onClick ? () => onClick() : undefined, children: children }));
|
|
55
55
|
};
|
|
56
56
|
/**
|
|
57
57
|
* Renders a Grid component.
|
|
@@ -7,14 +7,14 @@
|
|
|
7
7
|
* @module
|
|
8
8
|
*/
|
|
9
9
|
import React from 'react';
|
|
10
|
-
import type { SelectProps } from '
|
|
10
|
+
import type { SelectProps } from '../types.js';
|
|
11
11
|
/**
|
|
12
12
|
* Renders a Select component.
|
|
13
13
|
* @param root0 - Component props.
|
|
14
14
|
* @param root0.label - Select label text.
|
|
15
15
|
* @param root0.options - Select options array.
|
|
16
16
|
* @param root0.value - Selected value.
|
|
17
|
-
* @param root0.
|
|
17
|
+
* @param root0.onValueChange - Receives the selected value.
|
|
18
18
|
* @param root0.placeholder - Placeholder text.
|
|
19
19
|
* @param root0.error - Error message.
|
|
20
20
|
* @param root0.hint - Hint text.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../src/components/Select.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAmB,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../src/components/Select.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAmB,MAAM,OAAO,CAAA;AAMvC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAE9C;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CA6FxC,CAAA"}
|
|
@@ -17,7 +17,7 @@ import { getClassMap } from '@molecule/app-ui';
|
|
|
17
17
|
* @param root0.label - Select label text.
|
|
18
18
|
* @param root0.options - Select options array.
|
|
19
19
|
* @param root0.value - Selected value.
|
|
20
|
-
* @param root0.
|
|
20
|
+
* @param root0.onValueChange - Receives the selected value.
|
|
21
21
|
* @param root0.placeholder - Placeholder text.
|
|
22
22
|
* @param root0.error - Error message.
|
|
23
23
|
* @param root0.hint - Hint text.
|
|
@@ -28,7 +28,7 @@ import { getClassMap } from '@molecule/app-ui';
|
|
|
28
28
|
* @param root0.testId - Test identifier.
|
|
29
29
|
* @returns The rendered Select element.
|
|
30
30
|
*/
|
|
31
|
-
export const Select = ({ label, options = [], value,
|
|
31
|
+
export const Select = ({ label, options = [], value, onValueChange, placeholder, error, hint, size = 'md', disabled, required, className, testId, }) => {
|
|
32
32
|
const { t } = useTranslation();
|
|
33
33
|
const cm = getClassMap();
|
|
34
34
|
const [isOpen, setIsOpen] = useState(false);
|
|
@@ -44,10 +44,8 @@ export const Select = ({ label, options = [], value, onChange, placeholder, erro
|
|
|
44
44
|
const optLabel = typeof item === 'string' ? item : item.label;
|
|
45
45
|
const isSelected = optValue === value;
|
|
46
46
|
return (_jsx(Pressable, { className: cm.cn(cm.dropdownItem, isSelected && cm.textPrimary), onPress: () => {
|
|
47
|
-
|
|
48
|
-
onChange({ target: { value: optValue } });
|
|
49
|
-
}
|
|
47
|
+
onValueChange?.(optValue);
|
|
50
48
|
setIsOpen(false);
|
|
51
|
-
}, children: _jsx(Text, { children: optLabel }) }));
|
|
49
|
+
}, disabled: disabled || (typeof item !== 'string' && item.disabled), children: _jsx(Text, { children: optLabel }) }));
|
|
52
50
|
} })] }) }) }), !!error && typeof error === 'string' && _jsx(Text, { className: cm.formError, children: error }), !!hint && !error && _jsx(Text, { className: cm.formHint, children: hint })] }));
|
|
53
51
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Skeleton.d.ts","sourceRoot":"","sources":["../../src/components/Skeleton.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"Skeleton.d.ts","sourceRoot":"","sources":["../../src/components/Skeleton.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAA8B,MAAM,OAAO,CAAA;AAGlD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAGrD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAgD5C,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"}
|
|
@@ -4,7 +4,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
4
4
|
*
|
|
5
5
|
* @module
|
|
6
6
|
*/
|
|
7
|
-
import { useEffect,
|
|
7
|
+
import { useEffect, useState } from 'react';
|
|
8
8
|
import { Animated, View } from 'react-native';
|
|
9
9
|
import { getClassMap } from '@molecule/app-ui';
|
|
10
10
|
/**
|
|
@@ -20,7 +20,9 @@ import { getClassMap } from '@molecule/app-ui';
|
|
|
20
20
|
*/
|
|
21
21
|
export const Skeleton = ({ width, height, circle, animation = 'pulse', className, testId, }) => {
|
|
22
22
|
const cm = getClassMap();
|
|
23
|
-
|
|
23
|
+
// The animated value is created once per mount and kept in state; a ref would
|
|
24
|
+
// have to be read while rendering.
|
|
25
|
+
const [opacity] = useState(() => new Animated.Value(1));
|
|
24
26
|
useEffect(() => {
|
|
25
27
|
if (animation === 'pulse') {
|
|
26
28
|
const pulse = Animated.loop(Animated.sequence([
|
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
6
|
import React from 'react';
|
|
7
|
-
import type { SwitchProps } from '
|
|
7
|
+
import type { SwitchProps } from '../types.js';
|
|
8
8
|
/**
|
|
9
9
|
* Renders a Switch component.
|
|
10
10
|
* @param root0 - Component props.
|
|
11
11
|
* @param root0.label - Switch label text.
|
|
12
12
|
* @param root0.checked - Whether checked.
|
|
13
|
-
* @param root0.
|
|
13
|
+
* @param root0.onCheckedChange - Receives the new checked state.
|
|
14
14
|
* @param root0.size - Switch size (unused in RN).
|
|
15
15
|
* @param root0.disabled - Whether disabled.
|
|
16
16
|
* @param root0.className - CSS class name override.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Switch.d.ts","sourceRoot":"","sources":["../../src/components/Switch.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"Switch.d.ts","sourceRoot":"","sources":["../../src/components/Switch.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAE9C;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CA2BxC,CAAA"}
|
|
@@ -6,18 +6,14 @@ import { getClassMap } from '@molecule/app-ui';
|
|
|
6
6
|
* @param root0 - Component props.
|
|
7
7
|
* @param root0.label - Switch label text.
|
|
8
8
|
* @param root0.checked - Whether checked.
|
|
9
|
-
* @param root0.
|
|
9
|
+
* @param root0.onCheckedChange - Receives the new checked state.
|
|
10
10
|
* @param root0.size - Switch size (unused in RN).
|
|
11
11
|
* @param root0.disabled - Whether disabled.
|
|
12
12
|
* @param root0.className - CSS class name override.
|
|
13
13
|
* @param root0.testId - Test identifier.
|
|
14
14
|
* @returns The rendered Switch element.
|
|
15
15
|
*/
|
|
16
|
-
export const Switch = ({ label, checked,
|
|
16
|
+
export const Switch = ({ label, checked, onCheckedChange, size: _size = 'md', disabled, className, testId, }) => {
|
|
17
17
|
const cm = getClassMap();
|
|
18
|
-
return (_jsxs(View, { className: cm.cn(cm.controlLabel, className), testID: testId, children: [_jsx(RNSwitch, { value: !!checked, onValueChange: (
|
|
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 }))] }));
|
|
18
|
+
return (_jsxs(View, { className: cm.cn(cm.controlLabel, className), testID: testId, children: [_jsx(RNSwitch, { value: !!checked, onValueChange: onCheckedChange, disabled: disabled, accessibilityRole: "switch", accessibilityState: { checked: !!checked, disabled } }), !!label && (_jsx(Text, { className: cm.cn(cm.controlText, disabled && cm.controlDisabled), children: label }))] }));
|
|
23
19
|
};
|
|
@@ -5,9 +5,20 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import React from 'react';
|
|
7
7
|
import { TextInput } from 'react-native';
|
|
8
|
-
import type { TextareaProps } from '@molecule/app-ui';
|
|
9
8
|
/**
|
|
10
9
|
* Multi-line text input component.
|
|
11
10
|
*/
|
|
12
|
-
export declare const Textarea: React.ForwardRefExoticComponent<TextareaProps &
|
|
11
|
+
export declare const Textarea: React.ForwardRefExoticComponent<Omit<import("@molecule/app-ui").TextareaProps, "onChange" | "onClick" | "onDoubleClick" | "onMouseEnter" | "onMouseLeave" | "onFocus" | "onBlur" | "onKeyDown" | "onKeyUp" | "onKeyPress" | "onInput"> & {
|
|
12
|
+
onChange?: undefined;
|
|
13
|
+
onClick?: undefined;
|
|
14
|
+
onDoubleClick?: undefined;
|
|
15
|
+
onMouseEnter?: undefined;
|
|
16
|
+
onMouseLeave?: undefined;
|
|
17
|
+
onFocus?: (() => void) | undefined;
|
|
18
|
+
onBlur?: (() => void) | undefined;
|
|
19
|
+
onKeyDown?: undefined;
|
|
20
|
+
onKeyUp?: undefined;
|
|
21
|
+
onKeyPress?: undefined;
|
|
22
|
+
onInput?: undefined;
|
|
23
|
+
} & React.RefAttributes<TextInput>>;
|
|
13
24
|
//# sourceMappingURL=Textarea.d.ts.map
|
|
@@ -1 +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;
|
|
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;AAMpD;;GAEG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;;mCAmDpB,CAAA"}
|
|
@@ -10,12 +10,8 @@ import { getClassMap } from '@molecule/app-ui';
|
|
|
10
10
|
/**
|
|
11
11
|
* Multi-line text input component.
|
|
12
12
|
*/
|
|
13
|
-
export const Textarea = forwardRef(({ label, error, hint, rows = 3, className, style, testId, disabled, placeholder, value,
|
|
13
|
+
export const Textarea = forwardRef(({ label, error, hint, rows = 3, className, style, testId, disabled, placeholder, value, onValueChange, onFocus, onBlur, required, }, ref) => {
|
|
14
14
|
const cm = getClassMap();
|
|
15
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: (
|
|
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 })] }));
|
|
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: onValueChange, onFocus: onFocus ? () => onFocus() : undefined, onBlur: onBlur ? () => onBlur() : undefined, 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
17
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toast.d.ts","sourceRoot":"","sources":["../../src/components/Toast.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"Toast.d.ts","sourceRoot":"","sources":["../../src/components/Toast.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAsE,MAAM,OAAO,CAAA;AAI1F,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAGlD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CAwDtC,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,CAW5C"}
|
package/dist/components/Toast.js
CHANGED
|
@@ -4,7 +4,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
4
4
|
*
|
|
5
5
|
* @module
|
|
6
6
|
*/
|
|
7
|
-
import { createContext, useCallback, useContext, useEffect,
|
|
7
|
+
import { createContext, useCallback, useContext, useEffect, useState } from 'react';
|
|
8
8
|
import { Animated, Pressable, Text, View } from 'react-native';
|
|
9
9
|
import { useTranslation } from '@molecule/app-react';
|
|
10
10
|
import { getClassMap } from '@molecule/app-ui';
|
|
@@ -27,7 +27,9 @@ export const Toast = ({ title, description, status, duration = 5000, dismissible
|
|
|
27
27
|
const classes = cm.cn(cm.toast({
|
|
28
28
|
variant: (status || 'default'),
|
|
29
29
|
}), className);
|
|
30
|
-
|
|
30
|
+
// The animated value is created once per mount and kept in state; a ref would
|
|
31
|
+
// have to be read while rendering.
|
|
32
|
+
const [opacity] = useState(() => new Animated.Value(1));
|
|
31
33
|
useEffect(() => {
|
|
32
34
|
if (duration > 0) {
|
|
33
35
|
const timer = setTimeout(() => {
|
package/dist/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* FormField, Grid, Input, Label, Modal, Pagination, Progress, RadioGroup,
|
|
9
9
|
* Select, Separator, Skeleton, Spacer, Spinner, Switch, Table, Tabs,
|
|
10
10
|
* Textarea, Toast (+ ToastProvider / ToastContainer / useToast), Tooltip.
|
|
11
|
-
* Prop types
|
|
11
|
+
* Prop types build on `@molecule/app-ui`. Web-only extras (Icon,
|
|
12
12
|
* UserMenu, ThemeToggle, PageHeader, …) live in `@molecule/app-ui-react` and
|
|
13
13
|
* are NOT available here.
|
|
14
14
|
*
|
|
@@ -39,12 +39,14 @@
|
|
|
39
39
|
* babel preset + Tailwind config are wired into the app AND `setClassMap(classMap)` from
|
|
40
40
|
* `@molecule/app-ui-nativewind` has run. Missing either half renders the whole UI unstyled
|
|
41
41
|
* with NO error. `getClassMap()` itself throws until `setClassMap` is called.
|
|
42
|
-
* -
|
|
43
|
-
*
|
|
42
|
+
* - Fields report text and choices with `onValueChange` and checked state with
|
|
43
|
+
* `onCheckedChange`. Use eventless `onClick`, `onFocus`, `onBlur` and `onClear` callbacks
|
|
44
|
+
* to share handlers with the web kits.
|
|
44
45
|
* - Toasts need `ToastProvider` mounted at the root; `useToast()` throws outside it.
|
|
45
46
|
*
|
|
46
47
|
* @module
|
|
47
48
|
*/
|
|
48
49
|
export { Accordion, Alert, Avatar, Badge, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Container, Dropdown, DropdownLabel, DropdownSeparator, Flex, Form, FormField, Grid, Input, Label, Modal, Pagination, Progress, RadioGroup, Select, Separator, Skeleton, SkeletonCircle, SkeletonText, Spacer, Spinner, Switch, Table, Tabs, Textarea, Toast, ToastContainer, ToastProvider, Tooltip, useToast, } from './components/index.js';
|
|
49
|
-
export type
|
|
50
|
+
export type * from './types.js';
|
|
51
|
+
export type { AccordionProps, AlertProps, AvatarProps, BadgeProps, BaseProps, DropdownProps, FormFieldProps, FormProps, ModalProps, PaginationProps, RadioGroupProps, SkeletonProps, SpinnerProps, TableProps, TabsProps, ToastProps, TooltipProps, } from '@molecule/app-ui';
|
|
50
52
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAEH,OAAO,EACL,SAAS,EACT,KAAK,EACL,MAAM,EACN,KAAK,EACL,MAAM,EACN,IAAI,EACJ,WAAW,EACX,eAAe,EACf,UAAU,EACV,UAAU,EACV,SAAS,EACT,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,aAAa,EACb,iBAAiB,EACjB,IAAI,EACJ,IAAI,EACJ,SAAS,EACT,IAAI,EACJ,KAAK,EACL,KAAK,EACL,KAAK,EACL,UAAU,EACV,QAAQ,EACR,UAAU,EACV,MAAM,EACN,SAAS,EACT,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,MAAM,EACN,OAAO,EACP,MAAM,EACN,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,KAAK,EACL,cAAc,EACd,aAAa,EACb,OAAO,EACP,QAAQ,GACT,MAAM,uBAAuB,CAAA;AAC9B,mBAAmB,YAAY,CAAA;AAC/B,YAAY,EACV,cAAc,EACd,UAAU,EACV,WAAW,EACX,UAAU,EACV,SAAS,EACT,aAAa,EACb,cAAc,EACd,SAAS,EACT,UAAU,EACV,eAAe,EACf,eAAe,EACf,aAAa,EACb,YAAY,EACZ,UAAU,EACV,SAAS,EACT,UAAU,EACV,YAAY,GACb,MAAM,kBAAkB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* FormField, Grid, Input, Label, Modal, Pagination, Progress, RadioGroup,
|
|
9
9
|
* Select, Separator, Skeleton, Spacer, Spinner, Switch, Table, Tabs,
|
|
10
10
|
* Textarea, Toast (+ ToastProvider / ToastContainer / useToast), Tooltip.
|
|
11
|
-
* Prop types
|
|
11
|
+
* Prop types build on `@molecule/app-ui`. Web-only extras (Icon,
|
|
12
12
|
* UserMenu, ThemeToggle, PageHeader, …) live in `@molecule/app-ui-react` and
|
|
13
13
|
* are NOT available here.
|
|
14
14
|
*
|
|
@@ -39,8 +39,9 @@
|
|
|
39
39
|
* babel preset + Tailwind config are wired into the app AND `setClassMap(classMap)` from
|
|
40
40
|
* `@molecule/app-ui-nativewind` has run. Missing either half renders the whole UI unstyled
|
|
41
41
|
* with NO error. `getClassMap()` itself throws until `setClassMap` is called.
|
|
42
|
-
* -
|
|
43
|
-
*
|
|
42
|
+
* - Fields report text and choices with `onValueChange` and checked state with
|
|
43
|
+
* `onCheckedChange`. Use eventless `onClick`, `onFocus`, `onBlur` and `onClear` callbacks
|
|
44
|
+
* to share handlers with the web kits.
|
|
44
45
|
* - Toasts need `ToastProvider` mounted at the root; `useToast()` throws outside it.
|
|
45
46
|
*
|
|
46
47
|
* @module
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** Prop types for controls that deliver renderer-neutral callbacks on React Native. */
|
|
2
|
+
import type * as UI from '@molecule/app-ui';
|
|
3
|
+
type WebHandler = Extract<keyof UI.HTMLElementProps, `on${string}`> | 'onChange' | 'onInput';
|
|
4
|
+
/** Exposes the supported notifications and rejects web handlers even in spread props. */
|
|
5
|
+
type NativeControlProps<Props, Notification extends WebHandler = never> = Omit<Props, WebHandler> & {
|
|
6
|
+
[Name in Extract<keyof Props, WebHandler>]?: Name extends Notification ? () => void : never;
|
|
7
|
+
};
|
|
8
|
+
/** Native button props. `onClick` signals activation. */
|
|
9
|
+
export type ButtonProps = NativeControlProps<UI.ButtonProps, 'onClick'>;
|
|
10
|
+
/** Native card props. `onClick` signals activation. */
|
|
11
|
+
export type CardProps = NativeControlProps<UI.CardProps, 'onClick'>;
|
|
12
|
+
/** Native checkbox props. Use `onCheckedChange` to receive the new checked state. */
|
|
13
|
+
export type CheckboxProps = NativeControlProps<UI.CheckboxProps>;
|
|
14
|
+
/** Native layout props. `onClick` signals touch release. */
|
|
15
|
+
export type FlexProps = NativeControlProps<UI.FlexProps, 'onClick'>;
|
|
16
|
+
/** Native input props. `onValueChange` receives the text, including an empty string on clear. */
|
|
17
|
+
export type InputProps = NativeControlProps<UI.InputProps, 'onFocus' | 'onBlur'>;
|
|
18
|
+
/** Native picker props. Use `onValueChange` to receive the selected value. */
|
|
19
|
+
export type SelectProps<T = string> = NativeControlProps<UI.SelectProps<T>>;
|
|
20
|
+
/** Native switch props. Use `onCheckedChange` to receive the new checked state. */
|
|
21
|
+
export type SwitchProps = NativeControlProps<UI.SwitchProps>;
|
|
22
|
+
/** Native textarea props. Use `onValueChange` to receive the new text. */
|
|
23
|
+
export type TextareaProps = NativeControlProps<UI.TextareaProps, 'onFocus' | 'onBlur'>;
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,OAAO,KAAK,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAE3C,KAAK,UAAU,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,KAAK,MAAM,EAAE,CAAC,GAAG,UAAU,GAAG,SAAS,CAAA;AAE5F,yFAAyF;AACzF,KAAK,kBAAkB,CAAC,KAAK,EAAE,YAAY,SAAS,UAAU,GAAG,KAAK,IAAI,IAAI,CAC5E,KAAK,EACL,UAAU,CACX,GAAG;KACD,IAAI,IAAI,OAAO,CAAC,MAAM,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,IAAI,SAAS,YAAY,GAAG,MAAM,IAAI,GAAG,KAAK;CAC5F,CAAA;AAED,yDAAyD;AACzD,MAAM,MAAM,WAAW,GAAG,kBAAkB,CAAC,EAAE,CAAC,WAAW,EAAE,SAAS,CAAC,CAAA;AAEvE,uDAAuD;AACvD,MAAM,MAAM,SAAS,GAAG,kBAAkB,CAAC,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC,CAAA;AAEnE,qFAAqF;AACrF,MAAM,MAAM,aAAa,GAAG,kBAAkB,CAAC,EAAE,CAAC,aAAa,CAAC,CAAA;AAEhE,4DAA4D;AAC5D,MAAM,MAAM,SAAS,GAAG,kBAAkB,CAAC,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC,CAAA;AAEnE,iGAAiG;AACjG,MAAM,MAAM,UAAU,GAAG,kBAAkB,CAAC,EAAE,CAAC,UAAU,EAAE,SAAS,GAAG,QAAQ,CAAC,CAAA;AAEhF,8EAA8E;AAC9E,MAAM,MAAM,WAAW,CAAC,CAAC,GAAG,MAAM,IAAI,kBAAkB,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAA;AAE3E,mFAAmF;AACnF,MAAM,MAAM,WAAW,GAAG,kBAAkB,CAAC,EAAE,CAAC,WAAW,CAAC,CAAA;AAE5D,0EAA0E;AAC1E,MAAM,MAAM,aAAa,GAAG,kBAAkB,CAAC,EAAE,CAAC,aAAa,EAAE,SAAS,GAAG,QAAQ,CAAC,CAAA"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/app-ui-react-native",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "React Native UI component implementations for molecule.dev",
|
|
5
5
|
"homepage": "https://www.molecule.dev/packages/app-ui-react-native",
|
|
6
6
|
"type": "module",
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
"directory": "packages/app/frameworks/react-native-ui"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@molecule/app-i18n": "1.
|
|
37
|
+
"@molecule/app-i18n": "1.3.0",
|
|
38
38
|
"@molecule/app-icons": "1.0.4",
|
|
39
|
-
"@molecule/app-react": "4.
|
|
40
|
-
"@molecule/app-ui": "1.
|
|
39
|
+
"@molecule/app-react": "4.17.0",
|
|
40
|
+
"@molecule/app-ui": "1.14.0",
|
|
41
41
|
"@types/node": "26.6.5",
|
|
42
42
|
"react": "19.3.1",
|
|
43
43
|
"react-dom": "19.3.1",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@molecule/app-i18n": "^1.0.1",
|
|
49
49
|
"@molecule/app-icons": "^1.0.1",
|
|
50
50
|
"@molecule/app-react": "^4.4.0",
|
|
51
|
-
"@molecule/app-ui": "^1.
|
|
51
|
+
"@molecule/app-ui": "^1.13.0",
|
|
52
52
|
"react": "^18.0.0 || ^19.0.0",
|
|
53
53
|
"react-native": ">=0.72.0"
|
|
54
54
|
},
|