@space-uy/pulsar-ui 0.9.1 → 0.10.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.
@@ -4,11 +4,15 @@ import { Pressable, StyleSheet, View } from 'react-native';
4
4
  import Text from "./Text.js";
5
5
  import useTheme from "../hooks/useTheme.js";
6
6
  import { convertHexToRgba } from "../utils/uiUtils.js";
7
- import { jsx as _jsx } from "react/jsx-runtime";
7
+ import Icon from "./Icon.js";
8
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
8
9
  export default function Chip({
9
10
  text,
10
11
  size = 'normal',
11
12
  disabled = false,
13
+ backgroundColor,
14
+ textColor,
15
+ iconName,
12
16
  ...rest
13
17
  }) {
14
18
  const {
@@ -20,20 +24,25 @@ export default function Chip({
20
24
  return /*#__PURE__*/_jsx(Pressable, {
21
25
  disabled: disabled,
22
26
  ...rest,
23
- children: /*#__PURE__*/_jsx(View, {
27
+ children: /*#__PURE__*/_jsxs(View, {
24
28
  style: [styles.container, {
25
- backgroundColor: convertHexToRgba(colors.foreground, 0.08),
29
+ backgroundColor: backgroundColor || convertHexToRgba(colors.foreground, 0.08),
26
30
  borderRadius: theme.roundness,
27
31
  height
28
32
  }, disabled && styles.disabled],
29
- children: /*#__PURE__*/_jsx(Text, {
33
+ children: [iconName && /*#__PURE__*/_jsx(Icon, {
34
+ style: styles.icon,
35
+ name: iconName,
36
+ size: size === 'small' ? 12 : 14,
37
+ color: textColor || colors.foreground
38
+ }), /*#__PURE__*/_jsx(Text, {
30
39
  variant: textVariant,
31
40
  style: {
32
- color: colors.foreground
41
+ color: textColor || colors.foreground
33
42
  },
34
43
  numberOfLines: 1,
35
44
  children: text
36
- })
45
+ })]
37
46
  })
38
47
  });
39
48
  }
@@ -41,7 +50,11 @@ const styles = StyleSheet.create({
41
50
  container: {
42
51
  justifyContent: 'center',
43
52
  alignItems: 'center',
44
- paddingHorizontal: 12
53
+ paddingHorizontal: 12,
54
+ flexDirection: 'row'
55
+ },
56
+ icon: {
57
+ marginEnd: 8
45
58
  },
46
59
  disabled: {
47
60
  opacity: 0.3
@@ -1 +1 @@
1
- {"version":3,"names":["Pressable","StyleSheet","View","Text","useTheme","convertHexToRgba","jsx","_jsx","Chip","text","size","disabled","rest","theme","colors","height","textVariant","children","style","styles","container","backgroundColor","foreground","borderRadius","roundness","variant","color","numberOfLines","create","justifyContent","alignItems","paddingHorizontal","opacity"],"sourceRoot":"../../../src","sources":["components/Chip.tsx"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,UAAU,EAAEC,IAAI,QAA6B,cAAc;AAE/E,OAAOC,IAAI,MAAM,WAAQ;AAEzB,OAAOC,QAAQ,MAAM,sBAAmB;AAExC,SAASC,gBAAgB,QAAQ,qBAAkB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAQpD,eAAe,SAASC,IAAIA,CAAC;EAC3BC,IAAI;EACJC,IAAI,GAAG,QAAQ;EACfC,QAAQ,GAAG,KAAK;EAChB,GAAGC;AACE,CAAC,EAAE;EACR,MAAM;IAAEC,KAAK;IAAEC;EAAO,CAAC,GAAGV,QAAQ,CAAC,CAAC;EAEpC,MAAMW,MAAM,GAAGL,IAAI,KAAK,OAAO,GAAG,EAAE,GAAG,EAAE;EACzC,MAAMM,WAAW,GAAGN,IAAI,KAAK,OAAO,GAAG,IAAI,GAAG,IAAI;EAElD,oBACEH,IAAA,CAACP,SAAS;IAACW,QAAQ,EAAEA,QAAS;IAAA,GAAKC,IAAI;IAAAK,QAAA,eACrCV,IAAA,CAACL,IAAI;MACHgB,KAAK,EAAE,CACLC,MAAM,CAACC,SAAS,EAChB;QACEC,eAAe,EAAEhB,gBAAgB,CAACS,MAAM,CAACQ,UAAU,EAAE,IAAI,CAAC;QAC1DC,YAAY,EAAEV,KAAK,CAACW,SAAS;QAC7BT;MACF,CAAC,EACDJ,QAAQ,IAAIQ,MAAM,CAACR,QAAQ,CAC3B;MAAAM,QAAA,eAEFV,IAAA,CAACJ,IAAI;QACHsB,OAAO,EAAET,WAAY;QACrBE,KAAK,EAAE;UAAEQ,KAAK,EAAEZ,MAAM,CAACQ;QAAW,CAAE;QACpCK,aAAa,EAAE,CAAE;QAAAV,QAAA,EAEhBR;MAAI,CACD;IAAC,CACH;EAAC,CACE,CAAC;AAEhB;AAEA,MAAMU,MAAM,GAAGlB,UAAU,CAAC2B,MAAM,CAAC;EAC/BR,SAAS,EAAE;IACTS,cAAc,EAAE,QAAQ;IACxBC,UAAU,EAAE,QAAQ;IACpBC,iBAAiB,EAAE;EACrB,CAAC;EACDpB,QAAQ,EAAE;IAAEqB,OAAO,EAAE;EAAI;AAC3B,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["Pressable","StyleSheet","View","Text","useTheme","convertHexToRgba","Icon","jsx","_jsx","jsxs","_jsxs","Chip","text","size","disabled","backgroundColor","textColor","iconName","rest","theme","colors","height","textVariant","children","style","styles","container","foreground","borderRadius","roundness","icon","name","color","variant","numberOfLines","create","justifyContent","alignItems","paddingHorizontal","flexDirection","marginEnd","opacity"],"sourceRoot":"../../../src","sources":["components/Chip.tsx"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,UAAU,EAAEC,IAAI,QAA6B,cAAc;AAE/E,OAAOC,IAAI,MAAM,WAAQ;AAEzB,OAAOC,QAAQ,MAAM,sBAAmB;AAExC,SAASC,gBAAgB,QAAQ,qBAAkB;AAEnD,OAAOC,IAAI,MAAM,WAAQ;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAW1B,eAAe,SAASC,IAAIA,CAAC;EAC3BC,IAAI;EACJC,IAAI,GAAG,QAAQ;EACfC,QAAQ,GAAG,KAAK;EAChBC,eAAe;EACfC,SAAS;EACTC,QAAQ;EACR,GAAGC;AACE,CAAC,EAAE;EACR,MAAM;IAAEC,KAAK;IAAEC;EAAO,CAAC,GAAGhB,QAAQ,CAAC,CAAC;EAEpC,MAAMiB,MAAM,GAAGR,IAAI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ignoreList":[]}
@@ -1,9 +1,13 @@
1
1
  import { type PressableProps } from 'react-native';
2
+ import type { IconName } from './Icon';
2
3
  type Props = PressableProps & {
3
4
  text: string;
4
5
  size?: 'normal' | 'small';
5
6
  disabled?: boolean;
7
+ iconName?: IconName;
8
+ textColor?: string;
9
+ backgroundColor?: string;
6
10
  };
7
- export default function Chip({ text, size, disabled, ...rest }: Props): import("react/jsx-runtime").JSX.Element;
11
+ export default function Chip({ text, size, disabled, backgroundColor, textColor, iconName, ...rest }: Props): import("react/jsx-runtime").JSX.Element;
8
12
  export {};
9
13
  //# sourceMappingURL=Chip.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Chip.d.ts","sourceRoot":"","sources":["../../../../src/components/Chip.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA+B,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAQhF,KAAK,KAAK,GAAG,cAAc,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,EAC3B,IAAI,EACJ,IAAe,EACf,QAAgB,EAChB,GAAG,IAAI,EACR,EAAE,KAAK,2CA6BP"}
1
+ {"version":3,"file":"Chip.d.ts","sourceRoot":"","sources":["../../../../src/components/Chip.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA+B,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAOhF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAGvC,KAAK,KAAK,GAAG,cAAc,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,EAC3B,IAAI,EACJ,IAAe,EACf,QAAgB,EAChB,eAAe,EACf,SAAS,EACT,QAAQ,EACR,GAAG,IAAI,EACR,EAAE,KAAK,2CAsCP"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@space-uy/pulsar-ui",
3
- "version": "0.9.1",
3
+ "version": "0.10.0",
4
4
  "description": "react native ui kit for spacedev",
5
5
  "source": "./src/index.tsx",
6
6
  "main": "./lib/module/index.js",
@@ -5,17 +5,25 @@ import Text from './Text';
5
5
  import useTheme from '../hooks/useTheme';
6
6
 
7
7
  import { convertHexToRgba } from '../utils/uiUtils';
8
+ import type { IconName } from './Icon';
9
+ import Icon from './Icon';
8
10
 
9
11
  type Props = PressableProps & {
10
12
  text: string;
11
13
  size?: 'normal' | 'small';
12
14
  disabled?: boolean;
15
+ iconName?: IconName;
16
+ textColor?: string;
17
+ backgroundColor?: string;
13
18
  };
14
19
 
15
20
  export default function Chip({
16
21
  text,
17
22
  size = 'normal',
18
23
  disabled = false,
24
+ backgroundColor,
25
+ textColor,
26
+ iconName,
19
27
  ...rest
20
28
  }: Props) {
21
29
  const { theme, colors } = useTheme();
@@ -29,16 +37,25 @@ export default function Chip({
29
37
  style={[
30
38
  styles.container,
31
39
  {
32
- backgroundColor: convertHexToRgba(colors.foreground, 0.08),
40
+ backgroundColor:
41
+ backgroundColor || convertHexToRgba(colors.foreground, 0.08),
33
42
  borderRadius: theme.roundness,
34
43
  height,
35
44
  },
36
45
  disabled && styles.disabled,
37
46
  ]}
38
47
  >
48
+ {iconName && (
49
+ <Icon
50
+ style={styles.icon}
51
+ name={iconName}
52
+ size={size === 'small' ? 12 : 14}
53
+ color={textColor || colors.foreground}
54
+ />
55
+ )}
39
56
  <Text
40
57
  variant={textVariant}
41
- style={{ color: colors.foreground }}
58
+ style={{ color: textColor || colors.foreground }}
42
59
  numberOfLines={1}
43
60
  >
44
61
  {text}
@@ -53,6 +70,8 @@ const styles = StyleSheet.create({
53
70
  justifyContent: 'center',
54
71
  alignItems: 'center',
55
72
  paddingHorizontal: 12,
73
+ flexDirection: 'row',
56
74
  },
75
+ icon: { marginEnd: 8 },
57
76
  disabled: { opacity: 0.3 },
58
77
  });