native-pytech 1.0.89 → 1.0.90

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,2 +1 @@
1
1
  export { default } from '../libs/colorPage';
2
- export * from '../libs/colorPage';
@@ -1,2 +1 @@
1
1
  export { default } from '../libs/colorPage';
2
- export * from '../libs/colorPage';
@@ -1,2 +1 @@
1
1
  export { default } from './src/Page';
2
- export { default as ColorPageProps, renderGradientProps } from './src/Page/types';
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
2
  import Props from './types';
3
- declare const _default: React.MemoExoticComponent<({ colorRows, renderGradient, ...pageProps }: Props) => React.JSX.Element>;
3
+ declare const _default: React.MemoExoticComponent<({ colorRows, ...pageProps }: Props) => React.JSX.Element>;
4
4
  export default _default;
@@ -1,49 +1,13 @@
1
1
  import React, { memo } from 'react';
2
- import { Shape, Surface, Box, Host, Column, Row } from '@expo/ui/jetpack-compose';
3
- import { background, clip, Shapes, clickable, paddingAll, alpha, size as sizeModifier, fillMaxWidth } from '@expo/ui/jetpack-compose/modifiers';
4
- import { colors } from '../../../../libs/components/Gradient';
5
- export default memo(({ colorRows, renderGradient, ...pageProps }) => {
2
+ import { Host, Column, Row } from '@expo/ui/jetpack-compose';
3
+ import { fillMaxWidth } from '@expo/ui/jetpack-compose/modifiers';
4
+ import Item from '../Item';
5
+ export default memo(({ colorRows, ...pageProps }) => {
6
6
  return (<Host style={{ flex: 1 }}>
7
7
  <Column verticalArrangement={{ spacedBy: 2 }}>
8
8
  {colorRows.map((row, index) => (<Row key={index} horizontalArrangement="spaceEvenly" verticalArrangement="center" modifiers={[fillMaxWidth()]}>
9
- {row.map((color, indexColor) => renderGradient == null ? null : (<ItemRenderer key={color} color={color} size={55} renderGradient={renderGradient} {...pageProps}/>))}
9
+ {row.map((color, indexColor) => (<Item key={color} color={color} size={55} {...pageProps}/>))}
10
10
  </Row>))}
11
11
  </Column>
12
12
  </Host>);
13
13
  });
14
- const ItemRenderer = memo(({ color, size, selectedColor, onSelectColor, renderGradient, }) => {
15
- if (!renderGradient)
16
- return null;
17
- const isSelected = color === selectedColor;
18
- const innerBorderWidth = 2;
19
- const outerBorderWidth = 3;
20
- return (<Surface color='#00000000' shape={Shape.RoundedCorner({
21
- cornerRadii: {
22
- topStart: size,
23
- topEnd: size,
24
- bottomStart: size,
25
- bottomEnd: size,
26
- },
27
- })} border={{ width: outerBorderWidth, color: isSelected ? colors[color].middle : '#00000000' }} modifiers={[clip(Shapes.Circle)]}>
28
- <Box contentAlignment="center" modifiers={[
29
- background('#00000000'),
30
- paddingAll(outerBorderWidth * 2),
31
- clip(Shapes.Circle),
32
- clickable(() => onSelectColor?.(color))
33
- ]}>
34
-
35
- <Box contentAlignment="center" modifiers={[sizeModifier(size, size)]}>
36
-
37
- {!isSelected &&
38
- <Box contentAlignment="center" modifiers={[sizeModifier(size, size)]}>
39
- {React.createElement(renderGradient, { color, size })}
40
- <Box modifiers={[sizeModifier(size, size), alpha(0.25), background('#FFFFFF')]}/>
41
- </Box>}
42
-
43
- {React.createElement(renderGradient, { color, size: size - (!isSelected ? innerBorderWidth * 2 : 0) })}
44
-
45
- </Box>
46
-
47
- </Box>
48
- </Surface>);
49
- });
@@ -1,5 +1,5 @@
1
1
  import type { ColorsType } from '../../../../libs/components/Gradient';
2
- import PropsPage, { renderGradientProps } from '../Page/types';
2
+ import PropsPage from '../Page/types';
3
3
  type Props = PropsPage & {
4
4
  /**
5
5
  List of rows of colors to display.
@@ -7,5 +7,4 @@ type Props = PropsPage & {
7
7
  */
8
8
  colorRows: ColorsType[][];
9
9
  };
10
- export type DecoratorProps = renderGradientProps & PropsPage;
11
10
  export default Props;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import Props from './types';
3
+ declare const _default: React.MemoExoticComponent<({ color, size, selectedColor, onSelectColor, renderGradient, }: Props) => React.JSX.Element>;
4
+ export default _default;
@@ -0,0 +1,40 @@
1
+ import React, { memo } from 'react';
2
+ import { Shape, Surface, Box } from '@expo/ui/jetpack-compose';
3
+ import { background, clip, Shapes, clickable, paddingAll, alpha, size as sizeModifier } from '@expo/ui/jetpack-compose/modifiers';
4
+ import { colors } from '../../../../libs/components/Gradient';
5
+ export default memo(({ color, size, selectedColor, onSelectColor, renderGradient, }) => {
6
+ if (!renderGradient)
7
+ return null;
8
+ const isSelected = color === selectedColor;
9
+ const innerBorderWidth = 2;
10
+ const outerBorderWidth = 3;
11
+ return (<Surface color='#00000000' shape={Shape.RoundedCorner({
12
+ cornerRadii: {
13
+ topStart: size,
14
+ topEnd: size,
15
+ bottomStart: size,
16
+ bottomEnd: size,
17
+ },
18
+ })} border={{ width: outerBorderWidth, color: isSelected ? colors[color].middle : '#00000000' }} modifiers={[clip(Shapes.Circle)]}>
19
+ <Box contentAlignment="center" modifiers={[
20
+ background('#00000000'),
21
+ paddingAll(outerBorderWidth * 2),
22
+ clip(Shapes.Circle),
23
+ clickable(() => onSelectColor?.(color))
24
+ ]}>
25
+
26
+ <Box contentAlignment="center" modifiers={[sizeModifier(size, size)]}>
27
+
28
+ {!isSelected &&
29
+ <Box contentAlignment="center" modifiers={[sizeModifier(size, size)]}>
30
+ {React.createElement(renderGradient, { color, size })}
31
+ <Box modifiers={[sizeModifier(size, size), alpha(0.25), background('#FFFFFF')]}/>
32
+ </Box>}
33
+
34
+ {React.createElement(renderGradient, { color, size: size - (!isSelected ? innerBorderWidth * 2 : 0) })}
35
+
36
+ </Box>
37
+
38
+ </Box>
39
+ </Surface>);
40
+ });
@@ -1,6 +1,6 @@
1
1
  import type { ColorsType } from '../../../../libs/components/Gradient';
2
- import { BaseProps } from '../Page/types';
3
- type Props = BaseProps & {
2
+ import PropsPage from '../Page/types';
3
+ type Props = PropsPage & {
4
4
  /**
5
5
  Color to display.
6
6
  */
@@ -1,5 +1,5 @@
1
1
  import type { ColorsType } from '../../../../libs/components/Gradient';
2
- export type BaseProps = {
2
+ type Props = {
3
3
  /**
4
4
  Title of the date picker.
5
5
  @default 'default'
@@ -9,8 +9,12 @@ export type BaseProps = {
9
9
  Function to be called when the user selects a color.
10
10
  */
11
11
  onSelectColor?: (color: ColorsType) => void;
12
+ /**
13
+ Function to render the item.
14
+ */
15
+ renderGradient?: (props: renderGradientProps) => React.ReactNode;
12
16
  };
13
- export type renderGradientProps = {
17
+ type renderGradientProps = {
14
18
  /**
15
19
  Color to display.
16
20
  */
@@ -20,10 +24,4 @@ export type renderGradientProps = {
20
24
  */
21
25
  size: number;
22
26
  };
23
- type Props = BaseProps & {
24
- /**
25
- Function to render the item.
26
- */
27
- renderGradient?: (props: renderGradientProps) => React.ReactNode;
28
- };
29
27
  export default Props;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "native-pytech",
3
- "version": "1.0.89",
3
+ "version": "1.0.90",
4
4
  "description": "Libreria de React Native Pytech",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",