native-pytech 1.0.32 → 1.0.34

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.
@@ -1,3 +1,4 @@
1
+ import { format as DateFormatter } from 'date-fns';
1
2
  const formatter = new Intl.NumberFormat('es-AR');
2
3
  const numberToText = (value) => {
3
4
  const abs = formatter.format(Math.abs(value));
@@ -67,16 +68,8 @@ const phoneToText = (phone) => {
67
68
  return extra ? `${base}${extra}` : base;
68
69
  };
69
70
  const dateToTextFormat = (date, format = 'YYYY-MM-DD') => {
70
- const values = {
71
- DD: String(date.getDate()).padStart(2, '0'),
72
- MM: String(date.getMonth() + 1).padStart(2, '0'),
73
- YYYY: String(date.getFullYear()),
74
- YY: String(date.getFullYear()).slice(-2),
75
- HH: String(date.getHours()).padStart(2, '0'),
76
- mm: String(date.getMinutes()).padStart(2, '0'),
77
- ss: String(date.getSeconds()).padStart(2, '0'),
78
- };
79
- return format.replace(/DD|MM|YYYY|YY|HH|mm|ss/g, match => values[match]);
71
+ const _format = format.replaceAll('Y', 'y').replaceAll('m', 'M').replaceAll('D', 'd');
72
+ return DateFormatter(date, _format);
80
73
  };
81
74
  // ------------------- Export -------------------
82
75
  const Formats = {
@@ -9,8 +9,8 @@ export default memo(({ label, defaultValue, minDate = new Date(new Date().setFul
9
9
  const { index } = useItem();
10
10
  const [selection, setSelection] = useState(defaultValue);
11
11
  const _modifiers = useMemo(() => [
12
- environment('locale', 'es_ES'),
13
12
  ...(modifiers ?? []),
13
+ environment('locale', 'es_ES'),
14
14
  ], [modifiers]);
15
15
  // ------------------- Hooks -------------------
16
16
  useEffect(() => setSelection(defaultValue), [defaultValue]);
@@ -9,7 +9,7 @@ export default memo(({ children, modifiers, ...vStackProps }) => {
9
9
  listRowInsets({ bottom: 0.1 })
10
10
  ];
11
11
  return (<Section>
12
- <VStack spacing={20} modifiers={[..._modifiers, ...(modifiers || [])]} {...vStackProps}>
12
+ <VStack spacing={20} modifiers={[...(modifiers || []), ..._modifiers]} {...vStackProps}>
13
13
  {children}
14
14
  </VStack>
15
15
  </Section>);
@@ -36,7 +36,7 @@ function Component({ children, data = [], keyExtractor, editMode = false, onDele
36
36
  });
37
37
  onMove?.({ listIndexes: sourceIndices, destinationIndex: adjustedDest });
38
38
  }, [onMove]);
39
- return (<List {...listProps} modifiers={[...modifiersList, ...(listProps?.modifiers || [])]}>
39
+ return (<List {...listProps} modifiers={[...(listProps?.modifiers || []), ...modifiersList]}>
40
40
  {children}
41
41
  <Section {...listSectionProps}>
42
42
  <List.ForEach {...listForEachProps} onDelete={handleDelete} onMove={handleMove} modifiers={[...modifiersListForEach, ...(listForEachProps?.modifiers || [])]}>
@@ -55,7 +55,7 @@ type Props<T> = {
55
55
  /**
56
56
  The props to be applied to the list.
57
57
  */
58
- listSectionProps?: SectionProps;
58
+ listSectionProps?: Omit<SectionProps, 'children'>;
59
59
  /**
60
60
  Whether to enable the move of the items.
61
61
  @default false
@@ -13,7 +13,7 @@ import Editable from './Editable';
13
13
  */
14
14
  const Component = memo(({ children, modifiers, ...listProps }) => {
15
15
  const _modifiers = useMemo(() => [padding({ top: -15 })], []);
16
- return (<List modifiers={[..._modifiers, ...(modifiers || [])]} {...listProps}>
16
+ return (<List modifiers={[...(modifiers || []), ..._modifiers]} {...listProps}>
17
17
  {children}
18
18
  </List>);
19
19
  });
@@ -11,7 +11,7 @@ export default memo(({ children, systemImage, label, modifiers, maintainButtonSt
11
11
  const buttonSystemImage = !renderLabel ? systemImage : undefined;
12
12
  const buttonLabel = !renderLabel ? label : undefined;
13
13
  return (<HStack>
14
- <Button modifiers={[..._modifiers, ...(modifiers || [])]} systemImage={buttonSystemImage} label={buttonLabel} {...buttonProps}>
14
+ <Button modifiers={[...(modifiers || []), ..._modifiers]} systemImage={buttonSystemImage} label={buttonLabel} {...buttonProps}>
15
15
  {children}
16
16
  </Button>
17
17
  {!children && renderLabel && (<Label title={label} systemImage={systemImage}/>)}
@@ -3,7 +3,7 @@ import { pickerStyle, tag } from "@expo/ui/swift-ui/modifiers";
3
3
  import React, { memo, useMemo } from 'react';
4
4
  export default memo(({ modifiers, data = [], ...pickerProps }) => {
5
5
  const _modifiers = useMemo(() => [pickerStyle('menu')], []);
6
- return (<Picker modifiers={[..._modifiers, ...(modifiers || [])]} {...pickerProps}>
6
+ return (<Picker modifiers={[...(modifiers || []), ..._modifiers]} {...pickerProps}>
7
7
  {data.map(item => (<Text key={item} modifiers={[tag(item)]}>
8
8
  {item}
9
9
  </Text>))}
@@ -3,5 +3,5 @@ import { foregroundStyle } from '@expo/ui/swift-ui/modifiers';
3
3
  import React, { memo, useMemo } from 'react';
4
4
  export default memo(({ modifiers, secondary = false, ...restProps }) => {
5
5
  const _modifiers = useMemo(() => secondary ? [foregroundStyle({ type: 'hierarchical', style: 'secondary' })] : [], [secondary]);
6
- return (<Text modifiers={[..._modifiers, ...(modifiers || [])]} {...restProps}/>);
6
+ return (<Text modifiers={[...(modifiers || []), ..._modifiers]} {...restProps}/>);
7
7
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "native-pytech",
3
- "version": "1.0.32",
3
+ "version": "1.0.34",
4
4
  "description": "Libreria de React Native Pytech",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -69,6 +69,7 @@
69
69
  }
70
70
  },
71
71
  "dependencies": {
72
- "@expo/ui": "~55.0.12"
72
+ "@expo/ui": "~55.0.12",
73
+ "date-fns": "^4.1.0"
73
74
  }
74
75
  }