@molecule/app-ui-react-native 1.0.5 → 1.0.7

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.
@@ -22,7 +22,7 @@ import { getClassMap } from '@molecule/app-ui';
22
22
  export const Dropdown = ({ trigger, items = [], onSelect, className, testId, }) => {
23
23
  const cm = getClassMap();
24
24
  const [isOpen, setIsOpen] = useState(false);
25
- return (_jsxs(View, { className: className, testID: testId, children: [_jsx(Pressable, { className: cm.dropdownTrigger, onPress: () => setIsOpen(true), children: trigger }), _jsx(RNModal, { visible: isOpen, transparent: true, animationType: "fade", onRequestClose: () => setIsOpen(false), children: _jsx(Pressable, { className: cm.dialogOverlay, onPress: () => setIsOpen(false), children: _jsx(View, { className: cm.cn(cm.actionSheet, 'pointer-events-auto'), children: _jsx(FlatList, { data: items, keyExtractor: (item, index) => String(item.value ?? index), renderItem: ({ item }) => {
25
+ return (_jsxs(View, { className: className, testID: testId, children: [_jsx(Pressable, { className: cm.dropdownTrigger, onPress: () => setIsOpen(true), children: trigger }), _jsx(RNModal, { visible: isOpen, transparent: true, animationType: "fade", onRequestClose: () => setIsOpen(false), children: _jsx(Pressable, { className: cm.dialogOverlay, onPress: () => setIsOpen(false), children: _jsx(View, { className: cm.cn(cm.actionSheet, cm.pointerEventsAuto), children: _jsx(FlatList, { data: items, keyExtractor: (item, index) => String(item.value ?? index), renderItem: ({ item }) => {
26
26
  if (item.separator) {
27
27
  return _jsx(View, { className: cm.dropdownSeparator });
28
28
  }
@@ -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;AAG/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAGlD;;GAEG;AACH,eAAO,MAAM,KAAK,8EA8FjB,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;AAG/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAGlD;;GAEG;AACH,eAAO,MAAM,KAAK,8EAmGjB,CAAA"}
@@ -32,5 +32,5 @@ export const Input = forwardRef(({ label, error, hint, size = 'md', leftElement,
32
32
  if (onChange) {
33
33
  onChange({ target: { value: text } });
34
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 })] }));
35
+ }, 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 })] }));
36
36
  });
@@ -18,5 +18,5 @@ import { getClassMap } from '@molecule/app-ui';
18
18
  export const Modal = ({ children, open, onClose, title, size = 'md', footer, className, testId, }) => {
19
19
  const cm = getClassMap();
20
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 })] }) }) }) }));
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, cm.pointerEventsAuto), 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
22
  };
@@ -1 +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"}
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,CAiIhD,CAAA"}
@@ -42,5 +42,13 @@ export const Pagination = ({ page, totalPages, onChange, siblings = 1, boundarie
42
42
  return [...new Set(items)];
43
43
  };
44
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: '»' }) }) }))] }) }));
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, {
46
+ defaultValue: 'Go to first page',
47
+ }), 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, {
48
+ defaultValue: 'Go to previous page',
49
+ }), 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, {
50
+ defaultValue: 'Go to next page',
51
+ }), 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, {
52
+ defaultValue: 'Go to last page',
53
+ }), children: _jsx(Text, { children: t('ui.icon.chevronsRight', undefined, { defaultValue: '»' }) }) }))] }) }));
46
54
  };
@@ -38,7 +38,7 @@ export const Select = ({ label, options = [], value, onChange, placeholder, erro
38
38
  ? selectedOption
39
39
  : selectedOption.label
40
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 }) => {
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, cm.pointerEventsAuto), 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
42
  const optValue = typeof item === 'string' ? item : item.value;
43
43
  const optLabel = typeof item === 'string' ? item : item.label;
44
44
  const isSelected = optValue === value;
@@ -35,7 +35,7 @@ export const Table = ({ columns = [], data = [], rowKey, onRowClick, striped, bo
35
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
36
  ? t('ui.icon.sortAsc', undefined, { defaultValue: '↑' })
37
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 }) => {
38
+ t('ui.table.empty', undefined, { defaultValue: 'No data available' }) }) })) : (_jsx(FlatList, { data: data, keyExtractor: (item, index) => getRowKey(item, index), renderItem: ({ item, index }) => {
39
39
  const row = item;
40
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
41
  const cellValue = row[col.key];
@@ -25,5 +25,5 @@ export const Tooltip = ({ children, content, className, testId }) => {
25
25
  // RN has no onClick; a normal press (the click analog) hides the tooltip —
26
26
  // pressing a tooltip-wrapped control shouldn't leave its long-press tooltip
27
27
  // lingering. `onPressOut` also clears it when the press is released.
28
- onPress: () => setIsVisible(false), onPressOut: () => setIsVisible(false), children: children }), _jsx(RNModal, { visible: isVisible, transparent: true, animationType: "fade", children: _jsx(Pressable, { className: cm.dialogOverlay, onPress: () => setIsVisible(false), children: _jsx(View, { className: cm.cn(cm.dialogWrapper, 'pointer-events-auto'), children: _jsx(View, { className: cm.tooltip(), children: _jsx(Text, { children: content }) }) }) }) })] }));
28
+ onPress: () => setIsVisible(false), onPressOut: () => setIsVisible(false), children: children }), _jsx(RNModal, { visible: isVisible, transparent: true, animationType: "fade", children: _jsx(Pressable, { className: cm.dialogOverlay, onPress: () => setIsVisible(false), children: _jsx(View, { className: cm.cn(cm.dialogWrapper, cm.pointerEventsAuto), children: _jsx(View, { className: cm.tooltip(), children: _jsx(Text, { children: content }) }) }) }) })] }));
29
29
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molecule/app-ui-react-native",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
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",
@@ -36,9 +36,10 @@
36
36
  "devDependencies": {
37
37
  "@molecule/app-i18n": "1.1.2",
38
38
  "@molecule/app-icons": "1.0.3",
39
- "@molecule/app-ui": "1.3.9",
39
+ "@molecule/app-ui": "1.3.11",
40
40
  "@types/node": "26.6.5",
41
41
  "react": "19.3.1",
42
+ "react-dom": "19.3.1",
42
43
  "typescript": "6.0.3",
43
44
  "vitest": "4.1.12"
44
45
  },