@impulse-ui-native/primitives 2.8.0 → 2.9.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.
Files changed (36) hide show
  1. package/README.md +9 -1
  2. package/dist/components/atoms/avatar.js +55 -72
  3. package/dist/components/atoms/avatar.js.map +1 -1
  4. package/dist/components/atoms/badge/addon.d.mts +19 -0
  5. package/dist/components/atoms/badge/addon.js +28 -0
  6. package/dist/components/atoms/badge/addon.js.map +1 -0
  7. package/dist/components/atoms/badge/index.d.mts +11 -0
  8. package/dist/components/atoms/badge/index.js +5 -0
  9. package/dist/components/atoms/badge/index.js.map +1 -0
  10. package/dist/components/atoms/badge/root.d.mts +14 -0
  11. package/dist/components/atoms/badge/root.js +113 -0
  12. package/dist/components/atoms/badge/root.js.map +1 -0
  13. package/dist/components/atoms/divider.js +29 -27
  14. package/dist/components/atoms/divider.js.map +1 -1
  15. package/dist/components/atoms/index.d.mts +6 -3
  16. package/dist/components/atoms/index.js +2 -0
  17. package/dist/components/atoms/index.js.map +1 -1
  18. package/dist/components/atoms/spinner.js +27 -26
  19. package/dist/components/atoms/spinner.js.map +1 -1
  20. package/dist/components/card/content.js +14 -11
  21. package/dist/components/card/content.js.map +1 -1
  22. package/dist/components/card/footer.js +14 -11
  23. package/dist/components/card/footer.js.map +1 -1
  24. package/dist/components/card/header.js +14 -11
  25. package/dist/components/card/header.js.map +1 -1
  26. package/dist/components/card/media.js +13 -15
  27. package/dist/components/card/media.js.map +1 -1
  28. package/dist/components/index.d.mts +6 -4
  29. package/dist/index.d.mts +2 -0
  30. package/dist/types/badge.types.d.mts +24 -0
  31. package/dist/types/badge.types.js +1 -0
  32. package/dist/types/badge.types.js.map +1 -0
  33. package/dist/types/index.d.mts +1 -0
  34. package/dist/types/index.js +1 -0
  35. package/dist/types/index.js.map +1 -1
  36. package/package.json +5 -5
package/README.md CHANGED
@@ -21,7 +21,9 @@ pnpm add react-native-safe-area-context react-native-svg
21
21
  - `View` adds theme spacing, dimensions, flex, borders, colors, and shadow props to React Native's view.
22
22
  - `SafeAreaView` maps safe-area edges to the theme spacing scale.
23
23
  - `Typography` exposes named text presets such as `DisplayLarge`, `Title1`, `Body`, `Caption`, and `Code`.
24
- - `Button`, `IconButton`, `Pressable`, and `Tag` provide themed interaction primitives.
24
+ - `Button`, `IconButton`, and `Pressable` provide themed interaction primitives.
25
+ - `Tag` labels categories, filters, and metadata, with optional press and close behavior.
26
+ - `Badge` provides compact semantic labels with visual variants and Input-style prefix and suffix addons.
25
27
  - `Spinner` provides token-aware sizes and semantic colors for indeterminate loading states.
26
28
  - `Progress` provides accessible linear and circular determinate or indeterminate progress.
27
29
  - `Card` provides compound `Root`, `Pressable`, `Header`, `Content`, `Footer`, and `Media` surfaces.
@@ -36,6 +38,7 @@ pnpm add react-native-safe-area-context react-native-svg
36
38
  ```tsx
37
39
  import {
38
40
  Avatar,
41
+ Badge,
39
42
  Button,
40
43
  Card,
41
44
  Divider,
@@ -57,6 +60,9 @@ export function ProfileSummary() {
57
60
  accessibilityLabel="Alex Kim, online"
58
61
  />
59
62
  <Tag label="Active" color="success" />
63
+ <Badge tone="success" variant="soft">
64
+ Active
65
+ </Badge>
60
66
  <Spinner
61
67
  size="small"
62
68
  tone="secondary"
@@ -93,3 +99,5 @@ Use `Card.Root` for a static surface and `Card.Pressable` when the whole card ha
93
99
  `Divider` defaults to a subtle horizontal separator and exposes `role="separator"`. Use logical start/end insets to preserve RTL alignment, switch to vertical orientation inside a container with a defined height, and use `color` only when the semantic tones do not fit the surrounding surface.
94
100
 
95
101
  `Avatar` supports the same `filled`, `outlined`, `soft`, `ghost`, and `plain` variants as the control family. It renders fallback content below its image so initials or a custom fallback remain visible while the image loads or when it fails. Provide an `accessibilityLabel` when the represented identity is meaningful, and include presence status in that label when `status` conveys useful information. Avatar grouping and overflow counts are intentionally handled separately.
102
+
103
+ Use `Badge` for compact states and metadata. It supports the same `filled`, `outlined`, `soft`, `ghost`, and `plain` visual variants as controls and semantic tones. Its addons follow Input: use `PrefixIcon` or `Prefix`, `SuffixIcon` or `Suffix`, and optionally `onPressPrefix` or `onPressSuffix`. A custom component takes precedence over its corresponding icon. Use `Tag` when the whole label needs built-in press or close behavior.
@@ -1,7 +1,7 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { memo, useCallback, useMemo, useState } from "react";
3
3
  import { Image, StyleSheet, Text } from "react-native";
4
- import { useComponentsTokens, useStyleProps } from "@impulse-ui-native/theme";
4
+ import { useStyleProps, useThemedStyles } from "@impulse-ui-native/theme";
5
5
  import { View } from "./view";
6
6
  const Avatar = memo(function Avatar2({
7
7
  accessibilityLabel,
@@ -18,58 +18,18 @@ const Avatar = memo(function Avatar2({
18
18
  variant = "filled",
19
19
  ...props
20
20
  }) {
21
- const tokens = useComponentsTokens().avatar;
22
21
  const extractedStyleProps = useStyleProps(props);
23
- const sizeTokens = tokens.sizes[size];
24
- const variantTokens = tokens.variants[variant];
22
+ const styles = useThemedStyles(
23
+ themedStyles,
24
+ { size, status, statusColor, variant },
25
+ [size, status, statusColor, variant]
26
+ );
25
27
  const resolvedAccessible = accessible ?? Boolean(accessibilityLabel);
26
28
  const resolvedRole = role ?? (resolvedAccessible ? "img" : "none");
27
29
  const sourceKey = useMemo(() => JSON.stringify(source), [source]);
28
30
  const containerStyle = useMemo(
29
- () => [
30
- styles.container,
31
- { height: sizeTokens.size, width: sizeTokens.size },
32
- extractedStyleProps,
33
- style
34
- ],
35
- [extractedStyleProps, sizeTokens.size, style]
36
- );
37
- const contentStyle = useMemo(
38
- () => [
39
- styles.content,
40
- {
41
- backgroundColor: variantTokens.backgroundColor,
42
- borderColor: variantTokens.borderColor,
43
- borderRadius: sizeTokens.size / 2,
44
- borderWidth: tokens.borderWidth
45
- }
46
- ],
47
- [sizeTokens.size, tokens.borderWidth, variantTokens]
48
- );
49
- const initialsStyle = useMemo(
50
- () => [
51
- styles.initials,
52
- {
53
- color: variantTokens.color,
54
- fontFamily: tokens.fontFamily,
55
- fontSize: sizeTokens.fontSize
56
- }
57
- ],
58
- [sizeTokens.fontSize, tokens.fontFamily, variantTokens.color]
59
- );
60
- const statusStyle = useMemo(
61
- () => [
62
- styles.status,
63
- {
64
- backgroundColor: statusColor ?? (status ? tokens.statusColors[status] : void 0),
65
- borderColor: tokens.statusBorderColor,
66
- borderRadius: sizeTokens.statusSize / 2,
67
- borderWidth: sizeTokens.statusBorderWidth,
68
- height: sizeTokens.statusSize,
69
- width: sizeTokens.statusSize
70
- }
71
- ],
72
- [sizeTokens, status, statusColor, tokens]
31
+ () => [styles.container, extractedStyleProps, style],
32
+ [extractedStyleProps, style, styles.container]
73
33
  );
74
34
  return /* @__PURE__ */ jsxs(
75
35
  View,
@@ -80,8 +40,8 @@ const Avatar = memo(function Avatar2({
80
40
  role: resolvedRole,
81
41
  style: containerStyle,
82
42
  children: [
83
- /* @__PURE__ */ jsxs(View, { style: contentStyle, children: [
84
- fallback ?? (initials ? /* @__PURE__ */ jsx(Text, { style: initialsStyle, children: initials }) : null),
43
+ /* @__PURE__ */ jsxs(View, { style: styles.content, children: [
44
+ fallback ?? (initials ? /* @__PURE__ */ jsx(Text, { style: styles.initials, children: initials }) : null),
85
45
  source ? /* @__PURE__ */ jsx(
86
46
  AvatarImageLayer,
87
47
  {
@@ -91,7 +51,7 @@ const Avatar = memo(function Avatar2({
91
51
  sourceKey
92
52
  ) : null
93
53
  ] }),
94
- status ? /* @__PURE__ */ jsx(View, { accessible: false, style: statusStyle }) : null
54
+ status ? /* @__PURE__ */ jsx(View, { accessible: false, style: styles.status }) : null
95
55
  ]
96
56
  }
97
57
  );
@@ -109,7 +69,7 @@ const AvatarImageLayer = memo(function AvatarImageLayer2({
109
69
  [imageProps]
110
70
  );
111
71
  const imageStyle = useMemo(
112
- () => [styles.image, imageProps?.style],
72
+ () => [staticStyles.image, imageProps?.style],
113
73
  [imageProps?.style]
114
74
  );
115
75
  if (hasError) return null;
@@ -125,18 +85,49 @@ const AvatarImageLayer = memo(function AvatarImageLayer2({
125
85
  }
126
86
  );
127
87
  });
128
- const styles = StyleSheet.create({
129
- container: {
130
- flexShrink: 0,
131
- position: "relative"
132
- },
133
- content: {
134
- alignItems: "center",
135
- height: "100%",
136
- justifyContent: "center",
137
- overflow: "hidden",
138
- width: "100%"
139
- },
88
+ function themedStyles(theme, props) {
89
+ const { size, status, statusColor, variant } = props;
90
+ const avatarTokens = theme.components.avatar;
91
+ const sizeTokens = avatarTokens.sizes[size];
92
+ const variantTokens = avatarTokens.variants[variant];
93
+ return StyleSheet.create({
94
+ container: {
95
+ flexShrink: 0,
96
+ height: sizeTokens.size,
97
+ position: "relative",
98
+ width: sizeTokens.size
99
+ },
100
+ content: {
101
+ alignItems: "center",
102
+ backgroundColor: variantTokens.backgroundColor,
103
+ borderColor: variantTokens.borderColor,
104
+ borderRadius: sizeTokens.size / 2,
105
+ borderWidth: avatarTokens.borderWidth,
106
+ height: "100%",
107
+ justifyContent: "center",
108
+ overflow: "hidden",
109
+ width: "100%"
110
+ },
111
+ initials: {
112
+ color: variantTokens.color,
113
+ fontFamily: avatarTokens.fontFamily,
114
+ fontSize: sizeTokens.fontSize,
115
+ textAlign: "center"
116
+ },
117
+ status: {
118
+ backgroundColor: statusColor ?? (status ? avatarTokens.statusColors[status] : void 0),
119
+ borderColor: avatarTokens.statusBorderColor,
120
+ borderRadius: sizeTokens.statusSize / 2,
121
+ borderWidth: sizeTokens.statusBorderWidth,
122
+ bottom: 0,
123
+ height: sizeTokens.statusSize,
124
+ position: "absolute",
125
+ right: 0,
126
+ width: sizeTokens.statusSize
127
+ }
128
+ });
129
+ }
130
+ const staticStyles = StyleSheet.create({
140
131
  image: {
141
132
  bottom: 0,
142
133
  height: "100%",
@@ -145,14 +136,6 @@ const styles = StyleSheet.create({
145
136
  right: 0,
146
137
  top: 0,
147
138
  width: "100%"
148
- },
149
- initials: {
150
- textAlign: "center"
151
- },
152
- status: {
153
- bottom: 0,
154
- position: "absolute",
155
- right: 0
156
139
  }
157
140
  });
158
141
  export {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/atoms/avatar.tsx"],"sourcesContent":["import type { ImageProps } from \"react-native\";\nimport { memo, useCallback, useMemo, useState } from \"react\";\nimport { Image, StyleSheet, Text } from \"react-native\";\n\nimport { useComponentsTokens, useStyleProps } from \"@impulse-ui-native/theme\";\n\nimport type { AvatarProps } from \"../../types\";\nimport { View } from \"./view\";\n\nexport const Avatar = memo(function Avatar({\n accessibilityLabel,\n accessible,\n fallback,\n imageProps,\n initials,\n role,\n size = \"medium\",\n source,\n status,\n statusColor,\n style,\n variant = \"filled\",\n ...props\n}: AvatarProps) {\n const tokens = useComponentsTokens().avatar;\n const extractedStyleProps = useStyleProps(props);\n const sizeTokens = tokens.sizes[size];\n const variantTokens = tokens.variants[variant];\n const resolvedAccessible = accessible ?? Boolean(accessibilityLabel);\n const resolvedRole = role ?? (resolvedAccessible ? \"img\" : \"none\");\n const sourceKey = useMemo(() => JSON.stringify(source), [source]);\n\n const containerStyle = useMemo(\n () => [\n styles.container,\n { height: sizeTokens.size, width: sizeTokens.size },\n extractedStyleProps,\n style,\n ],\n [extractedStyleProps, sizeTokens.size, style],\n );\n\n const contentStyle = useMemo(\n () => [\n styles.content,\n {\n backgroundColor: variantTokens.backgroundColor,\n borderColor: variantTokens.borderColor,\n borderRadius: sizeTokens.size / 2,\n borderWidth: tokens.borderWidth,\n },\n ],\n [sizeTokens.size, tokens.borderWidth, variantTokens],\n );\n\n const initialsStyle = useMemo(\n () => [\n styles.initials,\n {\n color: variantTokens.color,\n fontFamily: tokens.fontFamily,\n fontSize: sizeTokens.fontSize,\n },\n ],\n [sizeTokens.fontSize, tokens.fontFamily, variantTokens.color],\n );\n\n const statusStyle = useMemo(\n () => [\n styles.status,\n {\n backgroundColor:\n statusColor ?? (status ? tokens.statusColors[status] : undefined),\n borderColor: tokens.statusBorderColor,\n borderRadius: sizeTokens.statusSize / 2,\n borderWidth: sizeTokens.statusBorderWidth,\n height: sizeTokens.statusSize,\n width: sizeTokens.statusSize,\n },\n ],\n [sizeTokens, status, statusColor, tokens],\n );\n\n return (\n <View\n {...props}\n accessibilityLabel={accessibilityLabel}\n accessible={resolvedAccessible}\n role={resolvedRole}\n style={containerStyle}\n >\n <View style={contentStyle}>\n {fallback ??\n (initials ? <Text style={initialsStyle}>{initials}</Text> : null)}\n\n {source ? (\n <AvatarImageLayer\n key={sourceKey}\n imageProps={imageProps}\n source={source}\n />\n ) : null}\n </View>\n\n {status ? <View accessible={false} style={statusStyle} /> : null}\n </View>\n );\n});\n\ninterface AvatarImageLayerProps {\n imageProps: AvatarProps[\"imageProps\"];\n source: NonNullable<AvatarProps[\"source\"]>;\n}\n\nconst AvatarImageLayer = memo(function AvatarImageLayer({\n imageProps,\n source,\n}: AvatarImageLayerProps) {\n const [hasError, setHasError] = useState(false);\n\n const handleError = useCallback<NonNullable<ImageProps[\"onError\"]>>(\n (event) => {\n setHasError(true);\n imageProps?.onError?.(event);\n },\n [imageProps],\n );\n\n const imageStyle = useMemo(\n () => [styles.image, imageProps?.style],\n [imageProps?.style],\n );\n\n if (hasError) return null;\n\n return (\n <Image\n resizeMode=\"cover\"\n {...imageProps}\n accessible={false}\n onError={handleError}\n source={source}\n style={imageStyle}\n />\n );\n});\n\nconst styles = StyleSheet.create({\n container: {\n flexShrink: 0,\n position: \"relative\",\n },\n content: {\n alignItems: \"center\",\n height: \"100%\",\n justifyContent: \"center\",\n overflow: \"hidden\",\n width: \"100%\",\n },\n image: {\n bottom: 0,\n height: \"100%\",\n left: 0,\n position: \"absolute\",\n right: 0,\n top: 0,\n width: \"100%\",\n },\n initials: {\n textAlign: \"center\",\n },\n status: {\n bottom: 0,\n position: \"absolute\",\n right: 0,\n },\n});\n"],"mappings":"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","names":["Avatar","AvatarImageLayer"]}
1
+ {"version":3,"sources":["../../../src/components/atoms/avatar.tsx"],"sourcesContent":["import type { ImageProps } from \"react-native\";\nimport { memo, useCallback, useMemo, useState } from \"react\";\nimport { Image, StyleSheet, Text } from \"react-native\";\n\nimport type { AppTheme } from \"@impulse-ui-native/theme\";\nimport { useStyleProps, useThemedStyles } from \"@impulse-ui-native/theme\";\n\nimport type { AvatarProps } from \"../../types\";\nimport { View } from \"./view\";\n\nexport const Avatar = memo(function Avatar({\n accessibilityLabel,\n accessible,\n fallback,\n imageProps,\n initials,\n role,\n size = \"medium\",\n source,\n status,\n statusColor,\n style,\n variant = \"filled\",\n ...props\n}: AvatarProps) {\n const extractedStyleProps = useStyleProps(props);\n const styles = useThemedStyles(\n themedStyles,\n { size, status, statusColor, variant },\n [size, status, statusColor, variant],\n );\n const resolvedAccessible = accessible ?? Boolean(accessibilityLabel);\n const resolvedRole = role ?? (resolvedAccessible ? \"img\" : \"none\");\n const sourceKey = useMemo(() => JSON.stringify(source), [source]);\n\n const containerStyle = useMemo(\n () => [styles.container, extractedStyleProps, style],\n [extractedStyleProps, style, styles.container],\n );\n\n return (\n <View\n {...props}\n accessibilityLabel={accessibilityLabel}\n accessible={resolvedAccessible}\n role={resolvedRole}\n style={containerStyle}\n >\n <View style={styles.content}>\n {fallback ??\n (initials ? <Text style={styles.initials}>{initials}</Text> : null)}\n\n {source ? (\n <AvatarImageLayer\n key={sourceKey}\n imageProps={imageProps}\n source={source}\n />\n ) : null}\n </View>\n\n {status ? <View accessible={false} style={styles.status} /> : null}\n </View>\n );\n});\n\ninterface AvatarImageLayerProps {\n imageProps: AvatarProps[\"imageProps\"];\n source: NonNullable<AvatarProps[\"source\"]>;\n}\n\nconst AvatarImageLayer = memo(function AvatarImageLayer({\n imageProps,\n source,\n}: AvatarImageLayerProps) {\n const [hasError, setHasError] = useState(false);\n\n const handleError = useCallback<NonNullable<ImageProps[\"onError\"]>>(\n (event) => {\n setHasError(true);\n imageProps?.onError?.(event);\n },\n [imageProps],\n );\n\n const imageStyle = useMemo(\n () => [staticStyles.image, imageProps?.style],\n [imageProps?.style],\n );\n\n if (hasError) return null;\n\n return (\n <Image\n resizeMode=\"cover\"\n {...imageProps}\n accessible={false}\n onError={handleError}\n source={source}\n style={imageStyle}\n />\n );\n});\n\ninterface AvatarThemeProps {\n size: NonNullable<AvatarProps[\"size\"]>;\n status: AvatarProps[\"status\"];\n statusColor: AvatarProps[\"statusColor\"];\n variant: NonNullable<AvatarProps[\"variant\"]>;\n}\n\nfunction themedStyles(theme: AppTheme, props: AvatarThemeProps) {\n const { size, status, statusColor, variant } = props;\n const avatarTokens = theme.components.avatar;\n const sizeTokens = avatarTokens.sizes[size];\n const variantTokens = avatarTokens.variants[variant];\n\n return StyleSheet.create({\n container: {\n flexShrink: 0,\n height: sizeTokens.size,\n position: \"relative\",\n width: sizeTokens.size,\n },\n content: {\n alignItems: \"center\",\n backgroundColor: variantTokens.backgroundColor,\n borderColor: variantTokens.borderColor,\n borderRadius: sizeTokens.size / 2,\n borderWidth: avatarTokens.borderWidth,\n height: \"100%\",\n justifyContent: \"center\",\n overflow: \"hidden\",\n width: \"100%\",\n },\n initials: {\n color: variantTokens.color,\n fontFamily: avatarTokens.fontFamily,\n fontSize: sizeTokens.fontSize,\n textAlign: \"center\",\n },\n status: {\n backgroundColor:\n statusColor ?? (status ? avatarTokens.statusColors[status] : undefined),\n borderColor: avatarTokens.statusBorderColor,\n borderRadius: sizeTokens.statusSize / 2,\n borderWidth: sizeTokens.statusBorderWidth,\n bottom: 0,\n height: sizeTokens.statusSize,\n position: \"absolute\",\n right: 0,\n width: sizeTokens.statusSize,\n },\n });\n}\n\nconst staticStyles = StyleSheet.create({\n image: {\n bottom: 0,\n height: \"100%\",\n left: 0,\n position: \"absolute\",\n right: 0,\n top: 0,\n width: \"100%\",\n },\n});\n"],"mappings":"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","names":["Avatar","AvatarImageLayer"]}
@@ -0,0 +1,19 @@
1
+ import * as react from 'react';
2
+ import { ComponentType } from 'react';
3
+ import * as react_jsx_runtime from 'react/jsx-runtime';
4
+ import { IconProps } from '@impulse-ui-native/icon/types';
5
+ import { PressableCoreProps } from '../../../types/button.types.mjs';
6
+ import 'react-native';
7
+ import '@impulse-ui-native/theme';
8
+
9
+ interface BadgeAddonProps {
10
+ color: string | undefined;
11
+ Content: ComponentType | undefined;
12
+ hitSlop: number;
13
+ iconSize: number;
14
+ IconComponent: IconProps["icon"] | undefined;
15
+ onPress: PressableCoreProps["onPress"] | undefined;
16
+ }
17
+ declare const BadgeAddon: react.MemoExoticComponent<({ color, Content, hitSlop, iconSize, IconComponent, onPress, }: BadgeAddonProps) => react_jsx_runtime.JSX.Element | null>;
18
+
19
+ export { BadgeAddon };
@@ -0,0 +1,28 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { memo, useMemo } from "react";
3
+ import { Icon } from "@impulse-ui-native/icon/components/icon";
4
+ import { Pressable } from "../pressable";
5
+ import { View } from "../view";
6
+ const BadgeAddon = memo(function BadgeAddon2({
7
+ color,
8
+ Content,
9
+ hitSlop,
10
+ iconSize,
11
+ IconComponent,
12
+ onPress
13
+ }) {
14
+ const Container = useMemo(() => onPress ? Pressable : View, [onPress]);
15
+ const content = useMemo(() => {
16
+ if (Content) return /* @__PURE__ */ jsx(Content, {});
17
+ if (IconComponent) {
18
+ return /* @__PURE__ */ jsx(Icon, { color, icon: IconComponent, size: iconSize });
19
+ }
20
+ return null;
21
+ }, [color, Content, iconSize, IconComponent]);
22
+ if (!content) return null;
23
+ return /* @__PURE__ */ jsx(Container, { hitSlop, onPress, children: content });
24
+ });
25
+ export {
26
+ BadgeAddon
27
+ };
28
+ //# sourceMappingURL=addon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components/atoms/badge/addon.tsx"],"sourcesContent":["import type { ComponentType } from \"react\";\nimport { memo, useMemo } from \"react\";\n\nimport type { IconProps } from \"@impulse-ui-native/icon/types\";\nimport { Icon } from \"@impulse-ui-native/icon/components/icon\";\n\nimport type { PressableCoreProps } from \"../../../types\";\nimport { Pressable } from \"../pressable\";\nimport { View } from \"../view\";\n\ninterface BadgeAddonProps {\n color: string | undefined;\n Content: ComponentType | undefined;\n hitSlop: number;\n iconSize: number;\n IconComponent: IconProps[\"icon\"] | undefined;\n onPress: PressableCoreProps[\"onPress\"] | undefined;\n}\n\nexport const BadgeAddon = memo(function BadgeAddon({\n color,\n Content,\n hitSlop,\n iconSize,\n IconComponent,\n onPress,\n}: BadgeAddonProps) {\n const Container = useMemo(() => (onPress ? Pressable : View), [onPress]);\n const content = useMemo(() => {\n if (Content) return <Content />;\n\n if (IconComponent) {\n return <Icon color={color} icon={IconComponent} size={iconSize} />;\n }\n\n return null;\n }, [color, Content, iconSize, IconComponent]);\n\n if (!content) return null;\n\n return (\n <Container hitSlop={hitSlop} onPress={onPress}>\n {content}\n </Container>\n );\n});\n"],"mappings":"AA6BwB;AA5BxB,SAAS,MAAM,eAAe;AAG9B,SAAS,YAAY;AAGrB,SAAS,iBAAiB;AAC1B,SAAS,YAAY;AAWd,MAAM,aAAa,KAAK,SAASA,YAAW;AAAA,EACjD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAoB;AAClB,QAAM,YAAY,QAAQ,MAAO,UAAU,YAAY,MAAO,CAAC,OAAO,CAAC;AACvE,QAAM,UAAU,QAAQ,MAAM;AAC5B,QAAI,QAAS,QAAO,oBAAC,WAAQ;AAE7B,QAAI,eAAe;AACjB,aAAO,oBAAC,QAAK,OAAc,MAAM,eAAe,MAAM,UAAU;AAAA,IAClE;AAEA,WAAO;AAAA,EACT,GAAG,CAAC,OAAO,SAAS,UAAU,aAAa,CAAC;AAE5C,MAAI,CAAC,QAAS,QAAO;AAErB,SACE,oBAAC,aAAU,SAAkB,SAC1B,mBACH;AAEJ,CAAC;","names":["BadgeAddon"]}
@@ -0,0 +1,11 @@
1
+ export { BadgeRoot as Badge } from './root.mjs';
2
+ import 'react';
3
+ import 'react/jsx-runtime';
4
+ import '../../../types/badge.types.mjs';
5
+ import 'react-native';
6
+ import '@impulse-ui-native/theme';
7
+ import '../../../types/control-components.types.mjs';
8
+ import '@impulse-ui-native/icon/types';
9
+ import '../../../types/spinner.types.mjs';
10
+ import '../../../types/button.types.mjs';
11
+ import '../../../types/view.types.mjs';
@@ -0,0 +1,5 @@
1
+ import { BadgeRoot } from "./root";
2
+ export {
3
+ BadgeRoot as Badge
4
+ };
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components/atoms/badge/index.ts"],"sourcesContent":["export { BadgeRoot as Badge } from \"./root\";\n"],"mappings":"AAAA,SAAsB,iBAAa;","names":[]}
@@ -0,0 +1,14 @@
1
+ import * as react from 'react';
2
+ import * as react_jsx_runtime from 'react/jsx-runtime';
3
+ import { BadgeProps } from '../../../types/badge.types.mjs';
4
+ import 'react-native';
5
+ import '@impulse-ui-native/theme';
6
+ import '../../../types/control-components.types.mjs';
7
+ import '@impulse-ui-native/icon/types';
8
+ import '../../../types/spinner.types.mjs';
9
+ import '../../../types/button.types.mjs';
10
+ import '../../../types/view.types.mjs';
11
+
12
+ declare const BadgeRoot: react.MemoExoticComponent<({ accessible, accessibilityLabel, backgroundColor, children, color, Prefix, PrefixIcon, onPressPrefix, onPressSuffix, role, size, style, Suffix, SuffixIcon, tone, variant, ...props }: BadgeProps) => react_jsx_runtime.JSX.Element>;
13
+
14
+ export { BadgeRoot };
@@ -0,0 +1,113 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { memo, useMemo } from "react";
3
+ import { StyleSheet, Text } from "react-native";
4
+ import {
5
+ useComponentsTokens,
6
+ useStyleProps,
7
+ useThemedStyles
8
+ } from "@impulse-ui-native/theme";
9
+ import { View } from "../view";
10
+ import { BadgeAddon } from "./addon";
11
+ const BadgeRoot = memo(function BadgeRoot2({
12
+ accessible,
13
+ accessibilityLabel,
14
+ backgroundColor,
15
+ children,
16
+ color,
17
+ Prefix,
18
+ PrefixIcon,
19
+ onPressPrefix,
20
+ onPressSuffix,
21
+ role,
22
+ size = "medium",
23
+ style,
24
+ Suffix,
25
+ SuffixIcon,
26
+ tone = "primary",
27
+ variant = "filled",
28
+ ...props
29
+ }) {
30
+ const tokens = useComponentsTokens();
31
+ const badgeTokens = tokens.badge;
32
+ const sizeTokens = badgeTokens.sizes[size];
33
+ const extractedStyleProps = useStyleProps(props);
34
+ const styles = useThemedStyles(
35
+ themedStyles,
36
+ { backgroundColor, color, size, tone, variant },
37
+ [backgroundColor, color, size, tone, variant]
38
+ );
39
+ const containerStyle = useMemo(
40
+ () => [styles.container, extractedStyleProps, style],
41
+ [extractedStyleProps, style, styles.container]
42
+ );
43
+ const affixColor = typeof styles.label.color === "string" ? styles.label.color : void 0;
44
+ return /* @__PURE__ */ jsxs(
45
+ View,
46
+ {
47
+ ...props,
48
+ accessibilityLabel,
49
+ accessible: accessible ?? Boolean(accessibilityLabel),
50
+ role,
51
+ style: containerStyle,
52
+ children: [
53
+ /* @__PURE__ */ jsx(
54
+ BadgeAddon,
55
+ {
56
+ Content: Prefix,
57
+ IconComponent: PrefixIcon,
58
+ color: affixColor,
59
+ hitSlop: badgeTokens.addonHitSlop,
60
+ iconSize: sizeTokens.iconSize,
61
+ onPress: onPressPrefix
62
+ }
63
+ ),
64
+ typeof children === "string" || typeof children === "number" ? /* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: styles.label, children }) : children,
65
+ /* @__PURE__ */ jsx(
66
+ BadgeAddon,
67
+ {
68
+ Content: Suffix,
69
+ IconComponent: SuffixIcon,
70
+ color: affixColor,
71
+ hitSlop: badgeTokens.addonHitSlop,
72
+ iconSize: sizeTokens.iconSize,
73
+ onPress: onPressSuffix
74
+ }
75
+ )
76
+ ]
77
+ }
78
+ );
79
+ });
80
+ function themedStyles(theme, props) {
81
+ const { backgroundColor, color, size, tone, variant } = props;
82
+ const badgeTokens = theme.components.badge;
83
+ const sizeTokens = badgeTokens.sizes[size];
84
+ const variantTokens = badgeTokens.colors[tone][variant];
85
+ return StyleSheet.create({
86
+ container: {
87
+ alignItems: "center",
88
+ alignSelf: "flex-start",
89
+ flexDirection: "row",
90
+ flexShrink: 0,
91
+ justifyContent: "center",
92
+ borderRadius: badgeTokens.borderRadius,
93
+ borderWidth: badgeTokens.borderWidth,
94
+ gap: badgeTokens.gap,
95
+ height: sizeTokens.height,
96
+ minWidth: sizeTokens.minWidth,
97
+ paddingHorizontal: sizeTokens.paddingHorizontal,
98
+ backgroundColor: backgroundColor ?? variantTokens.backgroundColor,
99
+ borderColor: variantTokens.borderColor
100
+ },
101
+ label: {
102
+ textAlign: "center",
103
+ fontFamily: badgeTokens.fontFamily,
104
+ fontSize: sizeTokens.fontSize,
105
+ lineHeight: sizeTokens.lineHeight,
106
+ color: color ?? variantTokens.color
107
+ }
108
+ });
109
+ }
110
+ export {
111
+ BadgeRoot
112
+ };
113
+ //# sourceMappingURL=root.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components/atoms/badge/root.tsx"],"sourcesContent":["import { memo, useMemo } from \"react\";\nimport { StyleSheet, Text } from \"react-native\";\n\nimport type { AppTheme } from \"@impulse-ui-native/theme\";\nimport {\n useComponentsTokens,\n useStyleProps,\n useThemedStyles,\n} from \"@impulse-ui-native/theme\";\n\nimport type { BadgeProps, BadgeThemeProps } from \"../../../types\";\nimport { View } from \"../view\";\nimport { BadgeAddon } from \"./addon\";\n\nexport const BadgeRoot = memo(function BadgeRoot({\n accessible,\n accessibilityLabel,\n backgroundColor,\n children,\n color,\n Prefix,\n PrefixIcon,\n onPressPrefix,\n onPressSuffix,\n role,\n size = \"medium\",\n style,\n Suffix,\n SuffixIcon,\n tone = \"primary\",\n variant = \"filled\",\n ...props\n}: BadgeProps) {\n const tokens = useComponentsTokens();\n const badgeTokens = tokens.badge;\n const sizeTokens = badgeTokens.sizes[size];\n const extractedStyleProps = useStyleProps(props);\n const styles = useThemedStyles(\n themedStyles,\n { backgroundColor, color, size, tone, variant },\n [backgroundColor, color, size, tone, variant],\n );\n\n const containerStyle = useMemo(\n () => [styles.container, extractedStyleProps, style],\n [extractedStyleProps, style, styles.container],\n );\n const affixColor =\n typeof styles.label.color === \"string\" ? styles.label.color : undefined;\n\n return (\n <View\n {...props}\n accessibilityLabel={accessibilityLabel}\n accessible={accessible ?? Boolean(accessibilityLabel)}\n role={role}\n style={containerStyle}\n >\n <BadgeAddon\n Content={Prefix}\n IconComponent={PrefixIcon}\n color={affixColor}\n hitSlop={badgeTokens.addonHitSlop}\n iconSize={sizeTokens.iconSize}\n onPress={onPressPrefix}\n />\n\n {typeof children === \"string\" || typeof children === \"number\" ? (\n <Text numberOfLines={1} style={styles.label}>\n {children}\n </Text>\n ) : (\n children\n )}\n\n <BadgeAddon\n Content={Suffix}\n IconComponent={SuffixIcon}\n color={affixColor}\n hitSlop={badgeTokens.addonHitSlop}\n iconSize={sizeTokens.iconSize}\n onPress={onPressSuffix}\n />\n </View>\n );\n});\n\nfunction themedStyles(theme: AppTheme, props: BadgeThemeProps) {\n const { backgroundColor, color, size, tone, variant } = props;\n\n const badgeTokens = theme.components.badge;\n const sizeTokens = badgeTokens.sizes[size];\n const variantTokens = badgeTokens.colors[tone][variant];\n\n return StyleSheet.create({\n container: {\n alignItems: \"center\",\n alignSelf: \"flex-start\",\n flexDirection: \"row\",\n flexShrink: 0,\n justifyContent: \"center\",\n\n borderRadius: badgeTokens.borderRadius,\n borderWidth: badgeTokens.borderWidth,\n gap: badgeTokens.gap,\n height: sizeTokens.height,\n minWidth: sizeTokens.minWidth,\n paddingHorizontal: sizeTokens.paddingHorizontal,\n\n backgroundColor: backgroundColor ?? variantTokens.backgroundColor,\n borderColor: variantTokens.borderColor,\n },\n\n label: {\n textAlign: \"center\",\n\n fontFamily: badgeTokens.fontFamily,\n fontSize: sizeTokens.fontSize,\n lineHeight: sizeTokens.lineHeight,\n\n color: color ?? variantTokens.color,\n },\n });\n}\n"],"mappings":"AAmDI,SAOE,KAPF;AAnDJ,SAAS,MAAM,eAAe;AAC9B,SAAS,YAAY,YAAY;AAGjC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGP,SAAS,YAAY;AACrB,SAAS,kBAAkB;AAEpB,MAAM,YAAY,KAAK,SAASA,WAAU;AAAA,EAC/C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP,UAAU;AAAA,EACV,GAAG;AACL,GAAe;AACb,QAAM,SAAS,oBAAoB;AACnC,QAAM,cAAc,OAAO;AAC3B,QAAM,aAAa,YAAY,MAAM,IAAI;AACzC,QAAM,sBAAsB,cAAc,KAAK;AAC/C,QAAM,SAAS;AAAA,IACb;AAAA,IACA,EAAE,iBAAiB,OAAO,MAAM,MAAM,QAAQ;AAAA,IAC9C,CAAC,iBAAiB,OAAO,MAAM,MAAM,OAAO;AAAA,EAC9C;AAEA,QAAM,iBAAiB;AAAA,IACrB,MAAM,CAAC,OAAO,WAAW,qBAAqB,KAAK;AAAA,IACnD,CAAC,qBAAqB,OAAO,OAAO,SAAS;AAAA,EAC/C;AACA,QAAM,aACJ,OAAO,OAAO,MAAM,UAAU,WAAW,OAAO,MAAM,QAAQ;AAEhE,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ;AAAA,MACA,YAAY,cAAc,QAAQ,kBAAkB;AAAA,MACpD;AAAA,MACA,OAAO;AAAA,MAEP;AAAA;AAAA,UAAC;AAAA;AAAA,YACC,SAAS;AAAA,YACT,eAAe;AAAA,YACf,OAAO;AAAA,YACP,SAAS,YAAY;AAAA,YACrB,UAAU,WAAW;AAAA,YACrB,SAAS;AAAA;AAAA,QACX;AAAA,QAEC,OAAO,aAAa,YAAY,OAAO,aAAa,WACnD,oBAAC,QAAK,eAAe,GAAG,OAAO,OAAO,OACnC,UACH,IAEA;AAAA,QAGF;AAAA,UAAC;AAAA;AAAA,YACC,SAAS;AAAA,YACT,eAAe;AAAA,YACf,OAAO;AAAA,YACP,SAAS,YAAY;AAAA,YACrB,UAAU,WAAW;AAAA,YACrB,SAAS;AAAA;AAAA,QACX;AAAA;AAAA;AAAA,EACF;AAEJ,CAAC;AAED,SAAS,aAAa,OAAiB,OAAwB;AAC7D,QAAM,EAAE,iBAAiB,OAAO,MAAM,MAAM,QAAQ,IAAI;AAExD,QAAM,cAAc,MAAM,WAAW;AACrC,QAAM,aAAa,YAAY,MAAM,IAAI;AACzC,QAAM,gBAAgB,YAAY,OAAO,IAAI,EAAE,OAAO;AAEtD,SAAO,WAAW,OAAO;AAAA,IACvB,WAAW;AAAA,MACT,YAAY;AAAA,MACZ,WAAW;AAAA,MACX,eAAe;AAAA,MACf,YAAY;AAAA,MACZ,gBAAgB;AAAA,MAEhB,cAAc,YAAY;AAAA,MAC1B,aAAa,YAAY;AAAA,MACzB,KAAK,YAAY;AAAA,MACjB,QAAQ,WAAW;AAAA,MACnB,UAAU,WAAW;AAAA,MACrB,mBAAmB,WAAW;AAAA,MAE9B,iBAAiB,mBAAmB,cAAc;AAAA,MAClD,aAAa,cAAc;AAAA,IAC7B;AAAA,IAEA,OAAO;AAAA,MACL,WAAW;AAAA,MAEX,YAAY,YAAY;AAAA,MACxB,UAAU,WAAW;AAAA,MACrB,YAAY,WAAW;AAAA,MAEvB,OAAO,SAAS,cAAc;AAAA,IAChC;AAAA,EACF,CAAC;AACH;","names":["BadgeRoot"]}
@@ -1,7 +1,7 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { memo, useMemo } from "react";
3
3
  import { StyleSheet } from "react-native";
4
- import { useComponentsTokens, useStyleProps } from "@impulse-ui-native/theme";
4
+ import { useStyleProps, useThemedStyles } from "@impulse-ui-native/theme";
5
5
  import { View } from "./view";
6
6
  const Divider = memo(function Divider2({
7
7
  accessible = true,
@@ -13,35 +13,37 @@ const Divider = memo(function Divider2({
13
13
  tone = "subtle",
14
14
  ...props
15
15
  }) {
16
- const tokens = useComponentsTokens().divider;
17
16
  const extractedStyleProps = useStyleProps(props);
18
- const dividerStyle = useMemo(() => {
19
- const insetStart = inset === "start" || inset === "both";
20
- const insetEnd = inset === "end" || inset === "both";
21
- return StyleSheet.flatten([
22
- styles.base,
23
- orientation === "horizontal" ? {
24
- height: tokens.thickness,
25
- marginEnd: insetEnd ? tokens.inset : 0,
26
- marginStart: insetStart ? tokens.inset : 0
27
- } : {
28
- marginBottom: insetEnd ? tokens.inset : 0,
29
- marginTop: insetStart ? tokens.inset : 0,
30
- width: tokens.thickness
31
- },
32
- { backgroundColor: color ?? tokens.colors[tone] },
33
- extractedStyleProps,
34
- style
35
- ]);
36
- }, [color, extractedStyleProps, inset, orientation, style, tone, tokens]);
17
+ const styles = useThemedStyles(
18
+ themedStyles,
19
+ { color, inset, orientation, tone },
20
+ [color, inset, orientation, tone]
21
+ );
22
+ const dividerStyle = useMemo(
23
+ () => [styles.divider, extractedStyleProps, style],
24
+ [extractedStyleProps, style, styles.divider]
25
+ );
37
26
  return /* @__PURE__ */ jsx(View, { ...props, accessible, role, style: dividerStyle });
38
27
  });
39
- const styles = StyleSheet.create({
40
- base: {
41
- alignSelf: "stretch",
42
- flexShrink: 0
43
- }
44
- });
28
+ function themedStyles(theme, props) {
29
+ const { color, inset, orientation, tone } = props;
30
+ const dividerTokens = theme.components.divider;
31
+ const insetStart = inset === "start" || inset === "both";
32
+ const insetEnd = inset === "end" || inset === "both";
33
+ return StyleSheet.create({
34
+ divider: {
35
+ alignSelf: "stretch",
36
+ flexShrink: 0,
37
+ height: orientation === "horizontal" ? dividerTokens.thickness : void 0,
38
+ marginBottom: orientation === "vertical" && insetEnd ? dividerTokens.inset : 0,
39
+ marginEnd: orientation === "horizontal" && insetEnd ? dividerTokens.inset : 0,
40
+ marginStart: orientation === "horizontal" && insetStart ? dividerTokens.inset : 0,
41
+ marginTop: orientation === "vertical" && insetStart ? dividerTokens.inset : 0,
42
+ width: orientation === "vertical" ? dividerTokens.thickness : void 0,
43
+ backgroundColor: color ?? dividerTokens.colors[tone]
44
+ }
45
+ });
46
+ }
45
47
  export {
46
48
  Divider
47
49
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/atoms/divider.tsx"],"sourcesContent":["import { memo, useMemo } from \"react\";\nimport { StyleSheet } from \"react-native\";\n\nimport { useComponentsTokens, useStyleProps } from \"@impulse-ui-native/theme\";\n\nimport type { DividerProps } from \"../../types\";\nimport { View } from \"./view\";\n\nexport const Divider = memo(function Divider({\n accessible = true,\n color,\n inset = \"none\",\n orientation = \"horizontal\",\n role = \"separator\",\n style,\n tone = \"subtle\",\n ...props\n}: DividerProps) {\n const tokens = useComponentsTokens().divider;\n const extractedStyleProps = useStyleProps(props);\n\n const dividerStyle = useMemo(() => {\n const insetStart = inset === \"start\" || inset === \"both\";\n const insetEnd = inset === \"end\" || inset === \"both\";\n\n return StyleSheet.flatten([\n styles.base,\n orientation === \"horizontal\"\n ? {\n height: tokens.thickness,\n marginEnd: insetEnd ? tokens.inset : 0,\n marginStart: insetStart ? tokens.inset : 0,\n }\n : {\n marginBottom: insetEnd ? tokens.inset : 0,\n marginTop: insetStart ? tokens.inset : 0,\n width: tokens.thickness,\n },\n { backgroundColor: color ?? tokens.colors[tone] },\n extractedStyleProps,\n style,\n ]);\n }, [color, extractedStyleProps, inset, orientation, style, tone, tokens]);\n\n return (\n <View {...props} accessible={accessible} role={role} style={dividerStyle} />\n );\n});\n\nconst styles = StyleSheet.create({\n base: {\n alignSelf: \"stretch\",\n flexShrink: 0,\n },\n});\n"],"mappings":"AA6CI;AA7CJ,SAAS,MAAM,eAAe;AAC9B,SAAS,kBAAkB;AAE3B,SAAS,qBAAqB,qBAAqB;AAGnD,SAAS,YAAY;AAEd,MAAM,UAAU,KAAK,SAASA,SAAQ;AAAA,EAC3C,aAAa;AAAA,EACb;AAAA,EACA,QAAQ;AAAA,EACR,cAAc;AAAA,EACd,OAAO;AAAA,EACP;AAAA,EACA,OAAO;AAAA,EACP,GAAG;AACL,GAAiB;AACf,QAAM,SAAS,oBAAoB,EAAE;AACrC,QAAM,sBAAsB,cAAc,KAAK;AAE/C,QAAM,eAAe,QAAQ,MAAM;AACjC,UAAM,aAAa,UAAU,WAAW,UAAU;AAClD,UAAM,WAAW,UAAU,SAAS,UAAU;AAE9C,WAAO,WAAW,QAAQ;AAAA,MACxB,OAAO;AAAA,MACP,gBAAgB,eACZ;AAAA,QACE,QAAQ,OAAO;AAAA,QACf,WAAW,WAAW,OAAO,QAAQ;AAAA,QACrC,aAAa,aAAa,OAAO,QAAQ;AAAA,MAC3C,IACA;AAAA,QACE,cAAc,WAAW,OAAO,QAAQ;AAAA,QACxC,WAAW,aAAa,OAAO,QAAQ;AAAA,QACvC,OAAO,OAAO;AAAA,MAChB;AAAA,MACJ,EAAE,iBAAiB,SAAS,OAAO,OAAO,IAAI,EAAE;AAAA,MAChD;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACH,GAAG,CAAC,OAAO,qBAAqB,OAAO,aAAa,OAAO,MAAM,MAAM,CAAC;AAExE,SACE,oBAAC,QAAM,GAAG,OAAO,YAAwB,MAAY,OAAO,cAAc;AAE9E,CAAC;AAED,MAAM,SAAS,WAAW,OAAO;AAAA,EAC/B,MAAM;AAAA,IACJ,WAAW;AAAA,IACX,YAAY;AAAA,EACd;AACF,CAAC;","names":["Divider"]}
1
+ {"version":3,"sources":["../../../src/components/atoms/divider.tsx"],"sourcesContent":["import { memo, useMemo } from \"react\";\nimport { StyleSheet } from \"react-native\";\n\nimport type { AppTheme } from \"@impulse-ui-native/theme\";\nimport { useStyleProps, useThemedStyles } from \"@impulse-ui-native/theme\";\n\nimport type { DividerProps } from \"../../types\";\nimport { View } from \"./view\";\n\nexport const Divider = memo(function Divider({\n accessible = true,\n color,\n inset = \"none\",\n orientation = \"horizontal\",\n role = \"separator\",\n style,\n tone = \"subtle\",\n ...props\n}: DividerProps) {\n const extractedStyleProps = useStyleProps(props);\n const styles = useThemedStyles(\n themedStyles,\n { color, inset, orientation, tone },\n [color, inset, orientation, tone],\n );\n const dividerStyle = useMemo(\n () => [styles.divider, extractedStyleProps, style],\n [extractedStyleProps, style, styles.divider],\n );\n\n return (\n <View {...props} accessible={accessible} role={role} style={dividerStyle} />\n );\n});\n\ninterface DividerThemeProps {\n color: DividerProps[\"color\"];\n inset: NonNullable<DividerProps[\"inset\"]>;\n orientation: NonNullable<DividerProps[\"orientation\"]>;\n tone: NonNullable<DividerProps[\"tone\"]>;\n}\n\nfunction themedStyles(theme: AppTheme, props: DividerThemeProps) {\n const { color, inset, orientation, tone } = props;\n const dividerTokens = theme.components.divider;\n const insetStart = inset === \"start\" || inset === \"both\";\n const insetEnd = inset === \"end\" || inset === \"both\";\n\n return StyleSheet.create({\n divider: {\n alignSelf: \"stretch\",\n flexShrink: 0,\n height:\n orientation === \"horizontal\" ? dividerTokens.thickness : undefined,\n marginBottom:\n orientation === \"vertical\" && insetEnd ? dividerTokens.inset : 0,\n marginEnd:\n orientation === \"horizontal\" && insetEnd ? dividerTokens.inset : 0,\n marginStart:\n orientation === \"horizontal\" && insetStart ? dividerTokens.inset : 0,\n marginTop:\n orientation === \"vertical\" && insetStart ? dividerTokens.inset : 0,\n width: orientation === \"vertical\" ? dividerTokens.thickness : undefined,\n backgroundColor: color ?? dividerTokens.colors[tone],\n },\n });\n}\n"],"mappings":"AA+BI;AA/BJ,SAAS,MAAM,eAAe;AAC9B,SAAS,kBAAkB;AAG3B,SAAS,eAAe,uBAAuB;AAG/C,SAAS,YAAY;AAEd,MAAM,UAAU,KAAK,SAASA,SAAQ;AAAA,EAC3C,aAAa;AAAA,EACb;AAAA,EACA,QAAQ;AAAA,EACR,cAAc;AAAA,EACd,OAAO;AAAA,EACP;AAAA,EACA,OAAO;AAAA,EACP,GAAG;AACL,GAAiB;AACf,QAAM,sBAAsB,cAAc,KAAK;AAC/C,QAAM,SAAS;AAAA,IACb;AAAA,IACA,EAAE,OAAO,OAAO,aAAa,KAAK;AAAA,IAClC,CAAC,OAAO,OAAO,aAAa,IAAI;AAAA,EAClC;AACA,QAAM,eAAe;AAAA,IACnB,MAAM,CAAC,OAAO,SAAS,qBAAqB,KAAK;AAAA,IACjD,CAAC,qBAAqB,OAAO,OAAO,OAAO;AAAA,EAC7C;AAEA,SACE,oBAAC,QAAM,GAAG,OAAO,YAAwB,MAAY,OAAO,cAAc;AAE9E,CAAC;AASD,SAAS,aAAa,OAAiB,OAA0B;AAC/D,QAAM,EAAE,OAAO,OAAO,aAAa,KAAK,IAAI;AAC5C,QAAM,gBAAgB,MAAM,WAAW;AACvC,QAAM,aAAa,UAAU,WAAW,UAAU;AAClD,QAAM,WAAW,UAAU,SAAS,UAAU;AAE9C,SAAO,WAAW,OAAO;AAAA,IACvB,SAAS;AAAA,MACP,WAAW;AAAA,MACX,YAAY;AAAA,MACZ,QACE,gBAAgB,eAAe,cAAc,YAAY;AAAA,MAC3D,cACE,gBAAgB,cAAc,WAAW,cAAc,QAAQ;AAAA,MACjE,WACE,gBAAgB,gBAAgB,WAAW,cAAc,QAAQ;AAAA,MACnE,aACE,gBAAgB,gBAAgB,aAAa,cAAc,QAAQ;AAAA,MACrE,WACE,gBAAgB,cAAc,aAAa,cAAc,QAAQ;AAAA,MACnE,OAAO,gBAAgB,aAAa,cAAc,YAAY;AAAA,MAC9D,iBAAiB,SAAS,cAAc,OAAO,IAAI;AAAA,IACrD;AAAA,EACF,CAAC;AACH;","names":["Divider"]}
@@ -1,4 +1,5 @@
1
1
  export { Avatar } from './avatar.mjs';
2
+ export { BadgeRoot as Badge } from './badge/root.mjs';
2
3
  export { View } from './view.mjs';
3
4
  export { SafeAreaView } from './safe-area-view.mjs';
4
5
  export { Typography, TypographyComponent } from './typography.mjs';
@@ -15,13 +16,15 @@ import '../../types/avatar.types.mjs';
15
16
  import 'react-native';
16
17
  import '@impulse-ui-native/theme';
17
18
  import '../../types/view.types.mjs';
19
+ import '../../types/badge.types.mjs';
20
+ import '../../types/control-components.types.mjs';
21
+ import '@impulse-ui-native/icon/types';
22
+ import '../../types/spinner.types.mjs';
23
+ import '../../types/button.types.mjs';
18
24
  import '../../types/safe-area-view.types.mjs';
19
25
  import 'react-native-safe-area-context';
20
26
  import '../../types/typography.types.mjs';
21
- import '../../types/button.types.mjs';
22
27
  import '../../types/divider.types.mjs';
23
28
  import '../../types/icon-button.types.mjs';
24
- import '@impulse-ui-native/icon/types';
25
29
  import '../../types/progress.types.mjs';
26
- import '../../types/spinner.types.mjs';
27
30
  import '../../types/tag.types.mjs';
@@ -1,4 +1,5 @@
1
1
  import { Avatar } from "./avatar";
2
+ import { Badge } from "./badge";
2
3
  import { View } from "./view";
3
4
  import { SafeAreaView } from "./safe-area-view";
4
5
  import { Typography } from "./typography";
@@ -11,6 +12,7 @@ import { Spinner } from "./spinner";
11
12
  import { Tag } from "./tag";
12
13
  export {
13
14
  Avatar,
15
+ Badge,
14
16
  Button,
15
17
  Divider,
16
18
  IconButton,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/atoms/index.ts"],"sourcesContent":["export { Avatar } from \"./avatar\";\nexport { View } from \"./view\";\nexport { SafeAreaView } from \"./safe-area-view\";\nexport { Typography, type TypographyComponent } from \"./typography\";\nexport { Button } from \"./button\";\nexport { Divider } from \"./divider\";\nexport { IconButton } from \"./icon-button\";\nexport { Pressable } from \"./pressable\";\nexport { Progress } from \"./progress\";\nexport { Spinner } from \"./spinner\";\nexport { Tag } from \"./tag\";\n"],"mappings":"AAAA,SAAS,cAAc;AACvB,SAAS,YAAY;AACrB,SAAS,oBAAoB;AAC7B,SAAS,kBAA4C;AACrD,SAAS,cAAc;AACvB,SAAS,eAAe;AACxB,SAAS,kBAAkB;AAC3B,SAAS,iBAAiB;AAC1B,SAAS,gBAAgB;AACzB,SAAS,eAAe;AACxB,SAAS,WAAW;","names":[]}
1
+ {"version":3,"sources":["../../../src/components/atoms/index.ts"],"sourcesContent":["export { Avatar } from \"./avatar\";\nexport { Badge } from \"./badge\";\nexport { View } from \"./view\";\nexport { SafeAreaView } from \"./safe-area-view\";\nexport { Typography, type TypographyComponent } from \"./typography\";\nexport { Button } from \"./button\";\nexport { Divider } from \"./divider\";\nexport { IconButton } from \"./icon-button\";\nexport { Pressable } from \"./pressable\";\nexport { Progress } from \"./progress\";\nexport { Spinner } from \"./spinner\";\nexport { Tag } from \"./tag\";\n"],"mappings":"AAAA,SAAS,cAAc;AACvB,SAAS,aAAa;AACtB,SAAS,YAAY;AACrB,SAAS,oBAAoB;AAC7B,SAAS,kBAA4C;AACrD,SAAS,cAAc;AACvB,SAAS,eAAe;AACxB,SAAS,kBAAkB;AAC3B,SAAS,iBAAiB;AAC1B,SAAS,gBAAgB;AACzB,SAAS,eAAe;AACxB,SAAS,WAAW;","names":[]}
@@ -1,7 +1,7 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { memo, useMemo } from "react";
3
3
  import { ActivityIndicator, StyleSheet, View } from "react-native";
4
- import { useComponentsTokens } from "@impulse-ui-native/theme";
4
+ import { useThemedStyles } from "@impulse-ui-native/theme";
5
5
  const Spinner = memo(function Spinner2({
6
6
  accessibilityRole = "progressbar",
7
7
  accessibilityState,
@@ -14,8 +14,11 @@ const Spinner = memo(function Spinner2({
14
14
  tone = "primary",
15
15
  ...props
16
16
  }) {
17
- const tokens = useComponentsTokens().spinner;
18
- const resolvedSize = tokens.sizes[size];
17
+ const styles = useThemedStyles(themedStyles, { color, size, tone }, [
18
+ color,
19
+ size,
20
+ tone
21
+ ]);
19
22
  const resolvedAccessibilityState = useMemo(
20
23
  () => ({
21
24
  ...accessibilityState,
@@ -24,21 +27,8 @@ const Spinner = memo(function Spinner2({
24
27
  [accessibilityState, animating]
25
28
  );
26
29
  const containerStyle = useMemo(
27
- () => [
28
- styles.container,
29
- {
30
- width: resolvedSize,
31
- height: resolvedSize
32
- },
33
- style
34
- ],
35
- [resolvedSize, style]
36
- );
37
- const indicatorStyle = useMemo(
38
- () => ({
39
- transform: [{ scale: resolvedSize / tokens.baseSize }]
40
- }),
41
- [resolvedSize, tokens.baseSize]
30
+ () => [styles.container, style],
31
+ [style, styles.container]
42
32
  );
43
33
  return /* @__PURE__ */ jsx(
44
34
  View,
@@ -53,21 +43,32 @@ const Spinner = memo(function Spinner2({
53
43
  {
54
44
  accessible: false,
55
45
  animating,
56
- color: color ?? tokens.colors[tone],
46
+ color: styles.indicator.color,
57
47
  hidesWhenStopped,
58
48
  size: "small",
59
- style: indicatorStyle
49
+ style: styles.indicator
60
50
  }
61
51
  )
62
52
  }
63
53
  );
64
54
  });
65
- const styles = StyleSheet.create({
66
- container: {
67
- alignItems: "center",
68
- justifyContent: "center"
69
- }
70
- });
55
+ function themedStyles(theme, props) {
56
+ const { color, size, tone } = props;
57
+ const spinnerTokens = theme.components.spinner;
58
+ const resolvedSize = spinnerTokens.sizes[size];
59
+ return StyleSheet.create({
60
+ container: {
61
+ alignItems: "center",
62
+ height: resolvedSize,
63
+ justifyContent: "center",
64
+ width: resolvedSize
65
+ },
66
+ indicator: {
67
+ color: color ?? spinnerTokens.colors[tone],
68
+ transform: [{ scale: resolvedSize / spinnerTokens.baseSize }]
69
+ }
70
+ });
71
+ }
71
72
  export {
72
73
  Spinner
73
74
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/atoms/spinner.tsx"],"sourcesContent":["import type { AccessibilityState } from \"react-native\";\nimport { memo, useMemo } from \"react\";\nimport { ActivityIndicator, StyleSheet, View } from \"react-native\";\n\nimport { useComponentsTokens } from \"@impulse-ui-native/theme\";\n\nimport type { SpinnerProps } from \"../../types\";\n\nexport const Spinner = memo(function Spinner({\n accessibilityRole = \"progressbar\",\n accessibilityState,\n accessible = true,\n animating = true,\n color,\n hidesWhenStopped,\n size = \"medium\",\n style,\n tone = \"primary\",\n ...props\n}: SpinnerProps) {\n const tokens = useComponentsTokens().spinner;\n const resolvedSize = tokens.sizes[size];\n\n const resolvedAccessibilityState = useMemo<AccessibilityState>(\n () => ({\n ...accessibilityState,\n busy: animating,\n }),\n [accessibilityState, animating],\n );\n\n const containerStyle = useMemo(\n () => [\n styles.container,\n {\n width: resolvedSize,\n height: resolvedSize,\n },\n style,\n ],\n [resolvedSize, style],\n );\n\n const indicatorStyle = useMemo(\n () => ({\n transform: [{ scale: resolvedSize / tokens.baseSize }],\n }),\n [resolvedSize, tokens.baseSize],\n );\n\n return (\n <View\n {...props}\n accessibilityRole={accessibilityRole}\n accessibilityState={resolvedAccessibilityState}\n accessible={accessible}\n style={containerStyle}\n >\n <ActivityIndicator\n accessible={false}\n animating={animating}\n color={color ?? tokens.colors[tone]}\n hidesWhenStopped={hidesWhenStopped}\n size=\"small\"\n style={indicatorStyle}\n />\n </View>\n );\n});\n\nconst styles = StyleSheet.create({\n container: {\n alignItems: \"center\",\n justifyContent: \"center\",\n },\n});\n"],"mappings":"AA0DM;AAzDN,SAAS,MAAM,eAAe;AAC9B,SAAS,mBAAmB,YAAY,YAAY;AAEpD,SAAS,2BAA2B;AAI7B,MAAM,UAAU,KAAK,SAASA,SAAQ;AAAA,EAC3C,oBAAoB;AAAA,EACpB;AAAA,EACA,aAAa;AAAA,EACb,YAAY;AAAA,EACZ;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP;AAAA,EACA,OAAO;AAAA,EACP,GAAG;AACL,GAAiB;AACf,QAAM,SAAS,oBAAoB,EAAE;AACrC,QAAM,eAAe,OAAO,MAAM,IAAI;AAEtC,QAAM,6BAA6B;AAAA,IACjC,OAAO;AAAA,MACL,GAAG;AAAA,MACH,MAAM;AAAA,IACR;AAAA,IACA,CAAC,oBAAoB,SAAS;AAAA,EAChC;AAEA,QAAM,iBAAiB;AAAA,IACrB,MAAM;AAAA,MACJ,OAAO;AAAA,MACP;AAAA,QACE,OAAO;AAAA,QACP,QAAQ;AAAA,MACV;AAAA,MACA;AAAA,IACF;AAAA,IACA,CAAC,cAAc,KAAK;AAAA,EACtB;AAEA,QAAM,iBAAiB;AAAA,IACrB,OAAO;AAAA,MACL,WAAW,CAAC,EAAE,OAAO,eAAe,OAAO,SAAS,CAAC;AAAA,IACvD;AAAA,IACA,CAAC,cAAc,OAAO,QAAQ;AAAA,EAChC;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ;AAAA,MACA,oBAAoB;AAAA,MACpB;AAAA,MACA,OAAO;AAAA,MAEP;AAAA,QAAC;AAAA;AAAA,UACC,YAAY;AAAA,UACZ;AAAA,UACA,OAAO,SAAS,OAAO,OAAO,IAAI;AAAA,UAClC;AAAA,UACA,MAAK;AAAA,UACL,OAAO;AAAA;AAAA,MACT;AAAA;AAAA,EACF;AAEJ,CAAC;AAED,MAAM,SAAS,WAAW,OAAO;AAAA,EAC/B,WAAW;AAAA,IACT,YAAY;AAAA,IACZ,gBAAgB;AAAA,EAClB;AACF,CAAC;","names":["Spinner"]}
1
+ {"version":3,"sources":["../../../src/components/atoms/spinner.tsx"],"sourcesContent":["import type { AccessibilityState } from \"react-native\";\nimport { memo, useMemo } from \"react\";\nimport { ActivityIndicator, StyleSheet, View } from \"react-native\";\n\nimport type { AppTheme } from \"@impulse-ui-native/theme\";\nimport { useThemedStyles } from \"@impulse-ui-native/theme\";\n\nimport type { SpinnerProps } from \"../../types\";\n\nexport const Spinner = memo(function Spinner({\n accessibilityRole = \"progressbar\",\n accessibilityState,\n accessible = true,\n animating = true,\n color,\n hidesWhenStopped,\n size = \"medium\",\n style,\n tone = \"primary\",\n ...props\n}: SpinnerProps) {\n const styles = useThemedStyles(themedStyles, { color, size, tone }, [\n color,\n size,\n tone,\n ]);\n\n const resolvedAccessibilityState = useMemo<AccessibilityState>(\n () => ({\n ...accessibilityState,\n busy: animating,\n }),\n [accessibilityState, animating],\n );\n\n const containerStyle = useMemo(\n () => [styles.container, style],\n [style, styles.container],\n );\n\n return (\n <View\n {...props}\n accessibilityRole={accessibilityRole}\n accessibilityState={resolvedAccessibilityState}\n accessible={accessible}\n style={containerStyle}\n >\n <ActivityIndicator\n accessible={false}\n animating={animating}\n color={styles.indicator.color}\n hidesWhenStopped={hidesWhenStopped}\n size=\"small\"\n style={styles.indicator}\n />\n </View>\n );\n});\n\ninterface SpinnerThemeProps {\n color: SpinnerProps[\"color\"];\n size: NonNullable<SpinnerProps[\"size\"]>;\n tone: NonNullable<SpinnerProps[\"tone\"]>;\n}\n\nfunction themedStyles(theme: AppTheme, props: SpinnerThemeProps) {\n const { color, size, tone } = props;\n const spinnerTokens = theme.components.spinner;\n const resolvedSize = spinnerTokens.sizes[size];\n\n return StyleSheet.create({\n container: {\n alignItems: \"center\",\n height: resolvedSize,\n justifyContent: \"center\",\n width: resolvedSize,\n },\n indicator: {\n color: color ?? spinnerTokens.colors[tone],\n transform: [{ scale: resolvedSize / spinnerTokens.baseSize }],\n },\n });\n}\n"],"mappings":"AAgDM;AA/CN,SAAS,MAAM,eAAe;AAC9B,SAAS,mBAAmB,YAAY,YAAY;AAGpD,SAAS,uBAAuB;AAIzB,MAAM,UAAU,KAAK,SAASA,SAAQ;AAAA,EAC3C,oBAAoB;AAAA,EACpB;AAAA,EACA,aAAa;AAAA,EACb,YAAY;AAAA,EACZ;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP;AAAA,EACA,OAAO;AAAA,EACP,GAAG;AACL,GAAiB;AACf,QAAM,SAAS,gBAAgB,cAAc,EAAE,OAAO,MAAM,KAAK,GAAG;AAAA,IAClE;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAED,QAAM,6BAA6B;AAAA,IACjC,OAAO;AAAA,MACL,GAAG;AAAA,MACH,MAAM;AAAA,IACR;AAAA,IACA,CAAC,oBAAoB,SAAS;AAAA,EAChC;AAEA,QAAM,iBAAiB;AAAA,IACrB,MAAM,CAAC,OAAO,WAAW,KAAK;AAAA,IAC9B,CAAC,OAAO,OAAO,SAAS;AAAA,EAC1B;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ;AAAA,MACA,oBAAoB;AAAA,MACpB;AAAA,MACA,OAAO;AAAA,MAEP;AAAA,QAAC;AAAA;AAAA,UACC,YAAY;AAAA,UACZ;AAAA,UACA,OAAO,OAAO,UAAU;AAAA,UACxB;AAAA,UACA,MAAK;AAAA,UACL,OAAO,OAAO;AAAA;AAAA,MAChB;AAAA;AAAA,EACF;AAEJ,CAAC;AAQD,SAAS,aAAa,OAAiB,OAA0B;AAC/D,QAAM,EAAE,OAAO,MAAM,KAAK,IAAI;AAC9B,QAAM,gBAAgB,MAAM,WAAW;AACvC,QAAM,eAAe,cAAc,MAAM,IAAI;AAE7C,SAAO,WAAW,OAAO;AAAA,IACvB,WAAW;AAAA,MACT,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,gBAAgB;AAAA,MAChB,OAAO;AAAA,IACT;AAAA,IACA,WAAW;AAAA,MACT,OAAO,SAAS,cAAc,OAAO,IAAI;AAAA,MACzC,WAAW,CAAC,EAAE,OAAO,eAAe,cAAc,SAAS,CAAC;AAAA,IAC9D;AAAA,EACF,CAAC;AACH;","names":["Spinner"]}
@@ -1,26 +1,29 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { memo, useMemo } from "react";
3
- import { useComponentsTokens, useStyleProps } from "@impulse-ui-native/theme";
3
+ import { StyleSheet } from "react-native";
4
+ import { useStyleProps, useThemedStyles } from "@impulse-ui-native/theme";
4
5
  import { View } from "../atoms/view";
5
6
  const CardContent = memo(function CardContent2({
6
7
  style,
7
8
  ...props
8
9
  }) {
9
- const tokens = useComponentsTokens().card.content;
10
10
  const extractedStyleProps = useStyleProps(props);
11
+ const styles = useThemedStyles(themedStyles);
11
12
  const contentStyle = useMemo(
12
- () => [
13
- {
14
- gap: tokens.gap,
15
- padding: tokens.padding
16
- },
17
- extractedStyleProps,
18
- style
19
- ],
20
- [extractedStyleProps, style, tokens]
13
+ () => [styles.content, extractedStyleProps, style],
14
+ [extractedStyleProps, style, styles.content]
21
15
  );
22
16
  return /* @__PURE__ */ jsx(View, { ...props, style: contentStyle });
23
17
  });
18
+ function themedStyles(theme) {
19
+ const contentTokens = theme.components.card.content;
20
+ return StyleSheet.create({
21
+ content: {
22
+ gap: contentTokens.gap,
23
+ padding: contentTokens.padding
24
+ }
25
+ });
26
+ }
24
27
  export {
25
28
  CardContent
26
29
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/card/content.tsx"],"sourcesContent":["import { memo, useMemo } from \"react\";\n\nimport { useComponentsTokens, useStyleProps } from \"@impulse-ui-native/theme\";\n\nimport type { CardContentProps } from \"../../types\";\nimport { View } from \"../atoms/view\";\n\nexport const CardContent = memo(function CardContent({\n style,\n ...props\n}: CardContentProps) {\n const tokens = useComponentsTokens().card.content;\n const extractedStyleProps = useStyleProps(props);\n const contentStyle = useMemo(\n () => [\n {\n gap: tokens.gap,\n padding: tokens.padding,\n },\n extractedStyleProps,\n style,\n ],\n [extractedStyleProps, style, tokens],\n );\n\n return <View {...props} style={contentStyle} />;\n});\n"],"mappings":"AAyBS;AAzBT,SAAS,MAAM,eAAe;AAE9B,SAAS,qBAAqB,qBAAqB;AAGnD,SAAS,YAAY;AAEd,MAAM,cAAc,KAAK,SAASA,aAAY;AAAA,EACnD;AAAA,EACA,GAAG;AACL,GAAqB;AACnB,QAAM,SAAS,oBAAoB,EAAE,KAAK;AAC1C,QAAM,sBAAsB,cAAc,KAAK;AAC/C,QAAM,eAAe;AAAA,IACnB,MAAM;AAAA,MACJ;AAAA,QACE,KAAK,OAAO;AAAA,QACZ,SAAS,OAAO;AAAA,MAClB;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,CAAC,qBAAqB,OAAO,MAAM;AAAA,EACrC;AAEA,SAAO,oBAAC,QAAM,GAAG,OAAO,OAAO,cAAc;AAC/C,CAAC;","names":["CardContent"]}
1
+ {"version":3,"sources":["../../../src/components/card/content.tsx"],"sourcesContent":["import { memo, useMemo } from \"react\";\nimport { StyleSheet } from \"react-native\";\n\nimport type { AppTheme } from \"@impulse-ui-native/theme\";\nimport { useStyleProps, useThemedStyles } from \"@impulse-ui-native/theme\";\n\nimport type { CardContentProps } from \"../../types\";\nimport { View } from \"../atoms/view\";\n\nexport const CardContent = memo(function CardContent({\n style,\n ...props\n}: CardContentProps) {\n const extractedStyleProps = useStyleProps(props);\n const styles = useThemedStyles(themedStyles);\n const contentStyle = useMemo(\n () => [styles.content, extractedStyleProps, style],\n [extractedStyleProps, style, styles.content],\n );\n\n return <View {...props} style={contentStyle} />;\n});\n\nfunction themedStyles(theme: AppTheme) {\n const contentTokens = theme.components.card.content;\n\n return StyleSheet.create({\n content: {\n gap: contentTokens.gap,\n padding: contentTokens.padding,\n },\n });\n}\n"],"mappings":"AAoBS;AApBT,SAAS,MAAM,eAAe;AAC9B,SAAS,kBAAkB;AAG3B,SAAS,eAAe,uBAAuB;AAG/C,SAAS,YAAY;AAEd,MAAM,cAAc,KAAK,SAASA,aAAY;AAAA,EACnD;AAAA,EACA,GAAG;AACL,GAAqB;AACnB,QAAM,sBAAsB,cAAc,KAAK;AAC/C,QAAM,SAAS,gBAAgB,YAAY;AAC3C,QAAM,eAAe;AAAA,IACnB,MAAM,CAAC,OAAO,SAAS,qBAAqB,KAAK;AAAA,IACjD,CAAC,qBAAqB,OAAO,OAAO,OAAO;AAAA,EAC7C;AAEA,SAAO,oBAAC,QAAM,GAAG,OAAO,OAAO,cAAc;AAC/C,CAAC;AAED,SAAS,aAAa,OAAiB;AACrC,QAAM,gBAAgB,MAAM,WAAW,KAAK;AAE5C,SAAO,WAAW,OAAO;AAAA,IACvB,SAAS;AAAA,MACP,KAAK,cAAc;AAAA,MACnB,SAAS,cAAc;AAAA,IACzB;AAAA,EACF,CAAC;AACH;","names":["CardContent"]}
@@ -1,26 +1,29 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { memo, useMemo } from "react";
3
- import { useComponentsTokens, useStyleProps } from "@impulse-ui-native/theme";
3
+ import { StyleSheet } from "react-native";
4
+ import { useStyleProps, useThemedStyles } from "@impulse-ui-native/theme";
4
5
  import { View } from "../atoms/view";
5
6
  const CardFooter = memo(function CardFooter2({
6
7
  style,
7
8
  ...props
8
9
  }) {
9
- const tokens = useComponentsTokens().card.footer;
10
10
  const extractedStyleProps = useStyleProps(props);
11
+ const styles = useThemedStyles(themedStyles);
11
12
  const footerStyle = useMemo(
12
- () => [
13
- {
14
- gap: tokens.gap,
15
- padding: tokens.padding
16
- },
17
- extractedStyleProps,
18
- style
19
- ],
20
- [extractedStyleProps, style, tokens]
13
+ () => [styles.footer, extractedStyleProps, style],
14
+ [extractedStyleProps, style, styles.footer]
21
15
  );
22
16
  return /* @__PURE__ */ jsx(View, { ...props, style: footerStyle });
23
17
  });
18
+ function themedStyles(theme) {
19
+ const footerTokens = theme.components.card.footer;
20
+ return StyleSheet.create({
21
+ footer: {
22
+ gap: footerTokens.gap,
23
+ padding: footerTokens.padding
24
+ }
25
+ });
26
+ }
24
27
  export {
25
28
  CardFooter
26
29
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/card/footer.tsx"],"sourcesContent":["import { memo, useMemo } from \"react\";\n\nimport { useComponentsTokens, useStyleProps } from \"@impulse-ui-native/theme\";\n\nimport type { CardFooterProps } from \"../../types\";\nimport { View } from \"../atoms/view\";\n\nexport const CardFooter = memo(function CardFooter({\n style,\n ...props\n}: CardFooterProps) {\n const tokens = useComponentsTokens().card.footer;\n const extractedStyleProps = useStyleProps(props);\n const footerStyle = useMemo(\n () => [\n {\n gap: tokens.gap,\n padding: tokens.padding,\n },\n extractedStyleProps,\n style,\n ],\n [extractedStyleProps, style, tokens],\n );\n\n return <View {...props} style={footerStyle} />;\n});\n"],"mappings":"AAyBS;AAzBT,SAAS,MAAM,eAAe;AAE9B,SAAS,qBAAqB,qBAAqB;AAGnD,SAAS,YAAY;AAEd,MAAM,aAAa,KAAK,SAASA,YAAW;AAAA,EACjD;AAAA,EACA,GAAG;AACL,GAAoB;AAClB,QAAM,SAAS,oBAAoB,EAAE,KAAK;AAC1C,QAAM,sBAAsB,cAAc,KAAK;AAC/C,QAAM,cAAc;AAAA,IAClB,MAAM;AAAA,MACJ;AAAA,QACE,KAAK,OAAO;AAAA,QACZ,SAAS,OAAO;AAAA,MAClB;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,CAAC,qBAAqB,OAAO,MAAM;AAAA,EACrC;AAEA,SAAO,oBAAC,QAAM,GAAG,OAAO,OAAO,aAAa;AAC9C,CAAC;","names":["CardFooter"]}
1
+ {"version":3,"sources":["../../../src/components/card/footer.tsx"],"sourcesContent":["import { memo, useMemo } from \"react\";\nimport { StyleSheet } from \"react-native\";\n\nimport type { AppTheme } from \"@impulse-ui-native/theme\";\nimport { useStyleProps, useThemedStyles } from \"@impulse-ui-native/theme\";\n\nimport type { CardFooterProps } from \"../../types\";\nimport { View } from \"../atoms/view\";\n\nexport const CardFooter = memo(function CardFooter({\n style,\n ...props\n}: CardFooterProps) {\n const extractedStyleProps = useStyleProps(props);\n const styles = useThemedStyles(themedStyles);\n const footerStyle = useMemo(\n () => [styles.footer, extractedStyleProps, style],\n [extractedStyleProps, style, styles.footer],\n );\n\n return <View {...props} style={footerStyle} />;\n});\n\nfunction themedStyles(theme: AppTheme) {\n const footerTokens = theme.components.card.footer;\n\n return StyleSheet.create({\n footer: {\n gap: footerTokens.gap,\n padding: footerTokens.padding,\n },\n });\n}\n"],"mappings":"AAoBS;AApBT,SAAS,MAAM,eAAe;AAC9B,SAAS,kBAAkB;AAG3B,SAAS,eAAe,uBAAuB;AAG/C,SAAS,YAAY;AAEd,MAAM,aAAa,KAAK,SAASA,YAAW;AAAA,EACjD;AAAA,EACA,GAAG;AACL,GAAoB;AAClB,QAAM,sBAAsB,cAAc,KAAK;AAC/C,QAAM,SAAS,gBAAgB,YAAY;AAC3C,QAAM,cAAc;AAAA,IAClB,MAAM,CAAC,OAAO,QAAQ,qBAAqB,KAAK;AAAA,IAChD,CAAC,qBAAqB,OAAO,OAAO,MAAM;AAAA,EAC5C;AAEA,SAAO,oBAAC,QAAM,GAAG,OAAO,OAAO,aAAa;AAC9C,CAAC;AAED,SAAS,aAAa,OAAiB;AACrC,QAAM,eAAe,MAAM,WAAW,KAAK;AAE3C,SAAO,WAAW,OAAO;AAAA,IACvB,QAAQ;AAAA,MACN,KAAK,aAAa;AAAA,MAClB,SAAS,aAAa;AAAA,IACxB;AAAA,EACF,CAAC;AACH;","names":["CardFooter"]}
@@ -1,26 +1,29 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { memo, useMemo } from "react";
3
- import { useComponentsTokens, useStyleProps } from "@impulse-ui-native/theme";
3
+ import { StyleSheet } from "react-native";
4
+ import { useStyleProps, useThemedStyles } from "@impulse-ui-native/theme";
4
5
  import { View } from "../atoms/view";
5
6
  const CardHeader = memo(function CardHeader2({
6
7
  style,
7
8
  ...props
8
9
  }) {
9
- const tokens = useComponentsTokens().card.header;
10
10
  const extractedStyleProps = useStyleProps(props);
11
+ const styles = useThemedStyles(themedStyles);
11
12
  const headerStyle = useMemo(
12
- () => [
13
- {
14
- gap: tokens.gap,
15
- padding: tokens.padding
16
- },
17
- extractedStyleProps,
18
- style
19
- ],
20
- [extractedStyleProps, style, tokens]
13
+ () => [styles.header, extractedStyleProps, style],
14
+ [extractedStyleProps, style, styles.header]
21
15
  );
22
16
  return /* @__PURE__ */ jsx(View, { ...props, style: headerStyle });
23
17
  });
18
+ function themedStyles(theme) {
19
+ const headerTokens = theme.components.card.header;
20
+ return StyleSheet.create({
21
+ header: {
22
+ gap: headerTokens.gap,
23
+ padding: headerTokens.padding
24
+ }
25
+ });
26
+ }
24
27
  export {
25
28
  CardHeader
26
29
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/card/header.tsx"],"sourcesContent":["import { memo, useMemo } from \"react\";\n\nimport { useComponentsTokens, useStyleProps } from \"@impulse-ui-native/theme\";\n\nimport type { CardHeaderProps } from \"../../types\";\nimport { View } from \"../atoms/view\";\n\nexport const CardHeader = memo(function CardHeader({\n style,\n ...props\n}: CardHeaderProps) {\n const tokens = useComponentsTokens().card.header;\n const extractedStyleProps = useStyleProps(props);\n const headerStyle = useMemo(\n () => [\n {\n gap: tokens.gap,\n padding: tokens.padding,\n },\n extractedStyleProps,\n style,\n ],\n [extractedStyleProps, style, tokens],\n );\n\n return <View {...props} style={headerStyle} />;\n});\n"],"mappings":"AAyBS;AAzBT,SAAS,MAAM,eAAe;AAE9B,SAAS,qBAAqB,qBAAqB;AAGnD,SAAS,YAAY;AAEd,MAAM,aAAa,KAAK,SAASA,YAAW;AAAA,EACjD;AAAA,EACA,GAAG;AACL,GAAoB;AAClB,QAAM,SAAS,oBAAoB,EAAE,KAAK;AAC1C,QAAM,sBAAsB,cAAc,KAAK;AAC/C,QAAM,cAAc;AAAA,IAClB,MAAM;AAAA,MACJ;AAAA,QACE,KAAK,OAAO;AAAA,QACZ,SAAS,OAAO;AAAA,MAClB;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,CAAC,qBAAqB,OAAO,MAAM;AAAA,EACrC;AAEA,SAAO,oBAAC,QAAM,GAAG,OAAO,OAAO,aAAa;AAC9C,CAAC;","names":["CardHeader"]}
1
+ {"version":3,"sources":["../../../src/components/card/header.tsx"],"sourcesContent":["import { memo, useMemo } from \"react\";\nimport { StyleSheet } from \"react-native\";\n\nimport type { AppTheme } from \"@impulse-ui-native/theme\";\nimport { useStyleProps, useThemedStyles } from \"@impulse-ui-native/theme\";\n\nimport type { CardHeaderProps } from \"../../types\";\nimport { View } from \"../atoms/view\";\n\nexport const CardHeader = memo(function CardHeader({\n style,\n ...props\n}: CardHeaderProps) {\n const extractedStyleProps = useStyleProps(props);\n const styles = useThemedStyles(themedStyles);\n const headerStyle = useMemo(\n () => [styles.header, extractedStyleProps, style],\n [extractedStyleProps, style, styles.header],\n );\n\n return <View {...props} style={headerStyle} />;\n});\n\nfunction themedStyles(theme: AppTheme) {\n const headerTokens = theme.components.card.header;\n\n return StyleSheet.create({\n header: {\n gap: headerTokens.gap,\n padding: headerTokens.padding,\n },\n });\n}\n"],"mappings":"AAoBS;AApBT,SAAS,MAAM,eAAe;AAC9B,SAAS,kBAAkB;AAG3B,SAAS,eAAe,uBAAuB;AAG/C,SAAS,YAAY;AAEd,MAAM,aAAa,KAAK,SAASA,YAAW;AAAA,EACjD;AAAA,EACA,GAAG;AACL,GAAoB;AAClB,QAAM,sBAAsB,cAAc,KAAK;AAC/C,QAAM,SAAS,gBAAgB,YAAY;AAC3C,QAAM,cAAc;AAAA,IAClB,MAAM,CAAC,OAAO,QAAQ,qBAAqB,KAAK;AAAA,IAChD,CAAC,qBAAqB,OAAO,OAAO,MAAM;AAAA,EAC5C;AAEA,SAAO,oBAAC,QAAM,GAAG,OAAO,OAAO,aAAa;AAC9C,CAAC;AAED,SAAS,aAAa,OAAiB;AACrC,QAAM,eAAe,MAAM,WAAW,KAAK;AAE3C,SAAO,WAAW,OAAO;AAAA,IACvB,QAAQ;AAAA,MACN,KAAK,aAAa;AAAA,MAClB,SAAS,aAAa;AAAA,IACxB;AAAA,EACF,CAAC;AACH;","names":["CardHeader"]}
@@ -1,31 +1,29 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { memo, useMemo } from "react";
3
3
  import { StyleSheet } from "react-native";
4
- import { useComponentsTokens, useStyleProps } from "@impulse-ui-native/theme";
4
+ import { useStyleProps, useThemedStyles } from "@impulse-ui-native/theme";
5
5
  import { View } from "../atoms/view";
6
6
  const CardMedia = memo(function CardMedia2({
7
7
  style,
8
8
  ...props
9
9
  }) {
10
- const tokens = useComponentsTokens().card;
11
10
  const extractedStyleProps = useStyleProps(props);
11
+ const styles = useThemedStyles(themedStyles);
12
12
  const mediaStyle = useMemo(
13
- () => [
14
- styles.media,
15
- { backgroundColor: tokens.mediaBackgroundColor },
16
- extractedStyleProps,
17
- style
18
- ],
19
- [extractedStyleProps, style, tokens.mediaBackgroundColor]
13
+ () => [styles.media, extractedStyleProps, style],
14
+ [extractedStyleProps, style, styles.media]
20
15
  );
21
16
  return /* @__PURE__ */ jsx(View, { ...props, style: mediaStyle });
22
17
  });
23
- const styles = StyleSheet.create({
24
- media: {
25
- overflow: "hidden",
26
- width: "100%"
27
- }
28
- });
18
+ function themedStyles(theme) {
19
+ return StyleSheet.create({
20
+ media: {
21
+ backgroundColor: theme.components.card.mediaBackgroundColor,
22
+ overflow: "hidden",
23
+ width: "100%"
24
+ }
25
+ });
26
+ }
29
27
  export {
30
28
  CardMedia
31
29
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/card/media.tsx"],"sourcesContent":["import { memo, useMemo } from \"react\";\nimport { StyleSheet } from \"react-native\";\n\nimport { useComponentsTokens, useStyleProps } from \"@impulse-ui-native/theme\";\n\nimport type { CardMediaProps } from \"../../types\";\nimport { View } from \"../atoms/view\";\n\nexport const CardMedia = memo(function CardMedia({\n style,\n ...props\n}: CardMediaProps) {\n const tokens = useComponentsTokens().card;\n const extractedStyleProps = useStyleProps(props);\n const mediaStyle = useMemo(\n () => [\n styles.media,\n { backgroundColor: tokens.mediaBackgroundColor },\n extractedStyleProps,\n style,\n ],\n [extractedStyleProps, style, tokens.mediaBackgroundColor],\n );\n\n return <View {...props} style={mediaStyle} />;\n});\n\nconst styles = StyleSheet.create({\n media: {\n overflow: \"hidden\",\n width: \"100%\",\n },\n});\n"],"mappings":"AAwBS;AAxBT,SAAS,MAAM,eAAe;AAC9B,SAAS,kBAAkB;AAE3B,SAAS,qBAAqB,qBAAqB;AAGnD,SAAS,YAAY;AAEd,MAAM,YAAY,KAAK,SAASA,WAAU;AAAA,EAC/C;AAAA,EACA,GAAG;AACL,GAAmB;AACjB,QAAM,SAAS,oBAAoB,EAAE;AACrC,QAAM,sBAAsB,cAAc,KAAK;AAC/C,QAAM,aAAa;AAAA,IACjB,MAAM;AAAA,MACJ,OAAO;AAAA,MACP,EAAE,iBAAiB,OAAO,qBAAqB;AAAA,MAC/C;AAAA,MACA;AAAA,IACF;AAAA,IACA,CAAC,qBAAqB,OAAO,OAAO,oBAAoB;AAAA,EAC1D;AAEA,SAAO,oBAAC,QAAM,GAAG,OAAO,OAAO,YAAY;AAC7C,CAAC;AAED,MAAM,SAAS,WAAW,OAAO;AAAA,EAC/B,OAAO;AAAA,IACL,UAAU;AAAA,IACV,OAAO;AAAA,EACT;AACF,CAAC;","names":["CardMedia"]}
1
+ {"version":3,"sources":["../../../src/components/card/media.tsx"],"sourcesContent":["import { memo, useMemo } from \"react\";\nimport { StyleSheet } from \"react-native\";\n\nimport type { AppTheme } from \"@impulse-ui-native/theme\";\nimport { useStyleProps, useThemedStyles } from \"@impulse-ui-native/theme\";\n\nimport type { CardMediaProps } from \"../../types\";\nimport { View } from \"../atoms/view\";\n\nexport const CardMedia = memo(function CardMedia({\n style,\n ...props\n}: CardMediaProps) {\n const extractedStyleProps = useStyleProps(props);\n const styles = useThemedStyles(themedStyles);\n const mediaStyle = useMemo(\n () => [styles.media, extractedStyleProps, style],\n [extractedStyleProps, style, styles.media],\n );\n\n return <View {...props} style={mediaStyle} />;\n});\n\nfunction themedStyles(theme: AppTheme) {\n return StyleSheet.create({\n media: {\n backgroundColor: theme.components.card.mediaBackgroundColor,\n overflow: \"hidden\",\n width: \"100%\",\n },\n });\n}\n"],"mappings":"AAoBS;AApBT,SAAS,MAAM,eAAe;AAC9B,SAAS,kBAAkB;AAG3B,SAAS,eAAe,uBAAuB;AAG/C,SAAS,YAAY;AAEd,MAAM,YAAY,KAAK,SAASA,WAAU;AAAA,EAC/C;AAAA,EACA,GAAG;AACL,GAAmB;AACjB,QAAM,sBAAsB,cAAc,KAAK;AAC/C,QAAM,SAAS,gBAAgB,YAAY;AAC3C,QAAM,aAAa;AAAA,IACjB,MAAM,CAAC,OAAO,OAAO,qBAAqB,KAAK;AAAA,IAC/C,CAAC,qBAAqB,OAAO,OAAO,KAAK;AAAA,EAC3C;AAEA,SAAO,oBAAC,QAAM,GAAG,OAAO,OAAO,YAAY;AAC7C,CAAC;AAED,SAAS,aAAa,OAAiB;AACrC,SAAO,WAAW,OAAO;AAAA,IACvB,OAAO;AAAA,MACL,iBAAiB,MAAM,WAAW,KAAK;AAAA,MACvC,UAAU;AAAA,MACV,OAAO;AAAA,IACT;AAAA,EACF,CAAC;AACH;","names":["CardMedia"]}
@@ -1,4 +1,5 @@
1
1
  export { Avatar } from './atoms/avatar.mjs';
2
+ export { BadgeRoot as Badge } from './atoms/badge/root.mjs';
2
3
  export { View } from './atoms/view.mjs';
3
4
  export { SafeAreaView } from './atoms/safe-area-view.mjs';
4
5
  export { Typography, TypographyComponent } from './atoms/typography.mjs';
@@ -18,15 +19,16 @@ import '../types/avatar.types.mjs';
18
19
  import 'react-native';
19
20
  import '@impulse-ui-native/theme';
20
21
  import '../types/view.types.mjs';
22
+ import '../types/badge.types.mjs';
23
+ import '../types/control-components.types.mjs';
24
+ import '@impulse-ui-native/icon/types';
25
+ import '../types/spinner.types.mjs';
26
+ import '../types/button.types.mjs';
21
27
  import '../types/safe-area-view.types.mjs';
22
28
  import 'react-native-safe-area-context';
23
29
  import '../types/typography.types.mjs';
24
- import '../types/button.types.mjs';
25
30
  import '../types/divider.types.mjs';
26
31
  import '../types/icon-button.types.mjs';
27
- import '@impulse-ui-native/icon/types';
28
32
  import '../types/progress.types.mjs';
29
- import '../types/spinner.types.mjs';
30
33
  import '../types/tag.types.mjs';
31
34
  import '../types/card.types.mjs';
32
- import '../types/control-components.types.mjs';
package/dist/index.d.mts CHANGED
@@ -1,4 +1,5 @@
1
1
  export { Avatar } from './components/atoms/avatar.mjs';
2
+ export { BadgeRoot as Badge } from './components/atoms/badge/root.mjs';
2
3
  export { View } from './components/atoms/view.mjs';
3
4
  export { SafeAreaView } from './components/atoms/safe-area-view.mjs';
4
5
  export { Typography, TypographyComponent } from './components/atoms/typography.mjs';
@@ -15,6 +16,7 @@ export { useControlContext } from './components/controls/provider.mjs';
15
16
  export { createPreset } from './hocs/create-preset.hoc.mjs';
16
17
  export { EdgeToShorthandKeyMap, EdgeToSpacingKeyMap } from './constants/safe-area-view.constants.mjs';
17
18
  export { AvatarImageProps, AvatarProps } from './types/avatar.types.mjs';
19
+ export { BadgeProps, BadgeThemeProps } from './types/badge.types.mjs';
18
20
  export { ViewProps } from './types/view.types.mjs';
19
21
  export { SafeAreaViewProps } from './types/safe-area-view.types.mjs';
20
22
  export { TextProps } from './types/typography.types.mjs';
@@ -0,0 +1,24 @@
1
+ import { ReactNode } from 'react';
2
+ import { ColorValue } from 'react-native';
3
+ import { ComponentSize, BadgeTone, ComponentVariant } from '@impulse-ui-native/theme';
4
+ import { ControlComponentCommonProps } from './control-components.types.mjs';
5
+ import { ViewProps } from './view.types.mjs';
6
+ import '@impulse-ui-native/icon/types';
7
+ import './spinner.types.mjs';
8
+ import './button.types.mjs';
9
+
10
+ interface BadgeProps extends Omit<ViewProps, "children">, Pick<ControlComponentCommonProps, "PrefixIcon" | "Prefix" | "onPressPrefix" | "SuffixIcon" | "Suffix" | "onPressSuffix"> {
11
+ children: ReactNode;
12
+ size?: ComponentSize;
13
+ tone?: BadgeTone;
14
+ variant?: ComponentVariant;
15
+ }
16
+ interface BadgeThemeProps {
17
+ backgroundColor?: ColorValue;
18
+ color?: ColorValue;
19
+ size: ComponentSize;
20
+ tone: BadgeTone;
21
+ variant: ComponentVariant;
22
+ }
23
+
24
+ export type { BadgeProps, BadgeThemeProps };
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=badge.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,4 +1,5 @@
1
1
  export { AvatarImageProps, AvatarProps } from './avatar.types.mjs';
2
+ export { BadgeProps, BadgeThemeProps } from './badge.types.mjs';
2
3
  export { ViewProps } from './view.types.mjs';
3
4
  export { SafeAreaViewProps } from './safe-area-view.types.mjs';
4
5
  export { TextProps } from './typography.types.mjs';
@@ -1,4 +1,5 @@
1
1
  export * from "./avatar.types";
2
+ export * from "./badge.types";
2
3
  export * from "./view.types";
3
4
  export * from "./safe-area-view.types";
4
5
  export * from "./typography.types";
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/types/index.ts"],"sourcesContent":["export * from \"./avatar.types\";\nexport * from \"./view.types\";\nexport * from \"./safe-area-view.types\";\nexport * from \"./typography.types\";\nexport * from \"./typography.types\";\nexport * from \"./button.types\";\nexport * from \"./card.types\";\nexport * from \"./divider.types\";\nexport * from \"./icon-button.types\";\nexport * from \"./progress.types\";\nexport * from \"./spinner.types\";\nexport * from \"./tag.types\";\nexport * from \"./control-components.types\";\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
1
+ {"version":3,"sources":["../../src/types/index.ts"],"sourcesContent":["export * from \"./avatar.types\";\nexport * from \"./badge.types\";\nexport * from \"./view.types\";\nexport * from \"./safe-area-view.types\";\nexport * from \"./typography.types\";\nexport * from \"./typography.types\";\nexport * from \"./button.types\";\nexport * from \"./card.types\";\nexport * from \"./divider.types\";\nexport * from \"./icon-button.types\";\nexport * from \"./progress.types\";\nexport * from \"./spinner.types\";\nexport * from \"./tag.types\";\nexport * from \"./control-components.types\";\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@impulse-ui-native/primitives",
3
- "version": "2.8.0",
3
+ "version": "2.9.0",
4
4
  "description": "Foundational UI primitives for building ImpulseUI Native components.",
5
5
  "keywords": [
6
6
  "react-native",
@@ -28,9 +28,9 @@
28
28
  ],
29
29
  "sideEffects": false,
30
30
  "dependencies": {
31
- "@impulse-ui-native/theme": "2.8.0",
32
- "@impulse-ui-native/icon": "2.8.0",
33
- "@impulse-ui-native/core": "2.8.0"
31
+ "@impulse-ui-native/theme": "2.9.0",
32
+ "@impulse-ui-native/icon": "2.9.0",
33
+ "@impulse-ui-native/core": "2.9.0"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@types/react": "~19.2.14",
@@ -41,8 +41,8 @@
41
41
  "react-native-safe-area-context": "~5.7.0",
42
42
  "react-native-svg": "15.15.4",
43
43
  "typescript": "~6.0.3",
44
- "@impulse-ui-native/prettier-config": "1.0.0",
45
44
  "@impulse-ui-native/eslint-config": "1.0.0",
45
+ "@impulse-ui-native/prettier-config": "1.0.0",
46
46
  "@impulse-ui-native/tsconfig": "1.0.0"
47
47
  },
48
48
  "peerDependencies": {