@particle-network/ui-native 0.1.3 → 0.1.4-beta.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.
@@ -2,6 +2,7 @@ import { useMemo } from "react";
2
2
  import { StyleSheet } from "react-native";
3
3
  import { useColors, useMs } from "../../hooks/index.js";
4
4
  import { disabledOpacity } from "../../theme/index.js";
5
+ const isCustomColor = (color)=>'string' == typeof color && color.startsWith('#');
5
6
  const useStyles = ({ size = 'md', color = 'default', variant = 'flat', isDisabled, bg })=>{
6
7
  const { getColor } = useColors();
7
8
  const { ms } = useMs();
@@ -22,8 +23,11 @@ const useStyles = ({ size = 'md', color = 'default', variant = 'flat', isDisable
22
23
  size
23
24
  ]);
24
25
  const textColor = useMemo(()=>{
25
- if ('default' === color) return getColor('default');
26
- if ('secondary' === color) return getColor('secondary');
26
+ if (isCustomColor(color)) {
27
+ if ('solid' === variant) return 'white';
28
+ return color;
29
+ }
30
+ if ('default' === color) return getColor('secondary');
27
31
  if ('solid' === variant) return getColor('white');
28
32
  return getColor(color);
29
33
  }, [
@@ -33,18 +37,20 @@ const useStyles = ({ size = 'md', color = 'default', variant = 'flat', isDisable
33
37
  ]);
34
38
  const backgroundColor = useMemo(()=>{
35
39
  if (bg) return getColor(bg);
40
+ if (isCustomColor(color)) {
41
+ if ('solid' === variant) return color;
42
+ return `${color}20`;
43
+ }
36
44
  if ('solid' === variant) {
37
45
  if ([
38
- 'default',
39
- 'secondary'
46
+ 'default'
40
47
  ].includes(color)) return getColor('bg-200');
41
48
  return getColor(color);
42
49
  }
43
50
  if ('flat' === variant) {
44
51
  if ([
45
- 'default',
46
- 'secondary'
47
- ].includes(color)) return getColor('bg-200');
52
+ 'default'
53
+ ].includes(color)) return getColor('bg-300');
48
54
  return `${getColor(color)}20`;
49
55
  }
50
56
  return 'transparent';
@@ -2,7 +2,7 @@ import type React from 'react';
2
2
  import type { UXForegroundColor } from '@particle-network/ui-shared';
3
3
  import type { HStackProps } from '../layout/HStack';
4
4
  export interface UXChipProps extends HStackProps {
5
- color?: UXForegroundColor;
5
+ color?: UXForegroundColor | `#${string}`;
6
6
  size?: 'sm' | 'md' | 'lg';
7
7
  variant?: 'solid' | 'flat';
8
8
  isDisabled?: boolean;
@@ -42,7 +42,7 @@ const defaultComponentConfig = {
42
42
  bg: 'overlay',
43
43
  backdrop: {
44
44
  light: '#00000050',
45
- dark: '#00000050'
45
+ dark: '#00000070'
46
46
  }
47
47
  },
48
48
  tabs: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@particle-network/ui-native",
3
- "version": "0.1.3",
3
+ "version": "0.1.4-beta.0",
4
4
  "main": "./entry.js",
5
5
  "react-native": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -88,9 +88,9 @@
88
88
  "unfetch": "^4.2.0",
89
89
  "vite": "^6.3.5",
90
90
  "zustand": "^5.0.8",
91
- "@particle-network/icons": "0.1.2",
92
91
  "@particle-network/eslint-config": "0.3.0",
93
- "@particle-network/lintstaged-config": "0.1.0"
92
+ "@particle-network/lintstaged-config": "0.1.0",
93
+ "@particle-network/icons": "0.1.3-beta.1"
94
94
  },
95
95
  "overrides": {
96
96
  "react-docgen-typescript": "2.2.2",