@impulse-ui-native/primitives 9.1.1 → 10.0.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.
- package/README.md +21 -0
- package/dist/components/atoms/avatar.d.mts +1 -2
- package/dist/components/atoms/avatar.js +2 -1
- package/dist/components/atoms/avatar.js.map +1 -1
- package/dist/components/atoms/badge/addon.d.mts +1 -2
- package/dist/components/atoms/badge/addon.js +1 -1
- package/dist/components/atoms/badge/addon.js.map +1 -1
- package/dist/components/atoms/badge/index.d.mts +0 -1
- package/dist/components/atoms/badge/root.d.mts +1 -2
- package/dist/components/atoms/badge/root.js +2 -1
- package/dist/components/atoms/badge/root.js.map +1 -1
- package/dist/components/atoms/button.d.mts +1 -2
- package/dist/components/atoms/divider.d.mts +1 -2
- package/dist/components/atoms/icon-button.d.mts +1 -2
- package/dist/components/atoms/index.d.mts +0 -1
- package/dist/components/atoms/pressable.d.mts +3 -5
- package/dist/components/atoms/pressable.js +48 -46
- package/dist/components/atoms/pressable.js.map +1 -1
- package/dist/components/atoms/safe-area-view.d.mts +1 -2
- package/dist/components/atoms/spinner.d.mts +1 -2
- package/dist/components/atoms/tag.d.mts +1 -2
- package/dist/components/atoms/tag.js +2 -7
- package/dist/components/atoms/tag.js.map +1 -1
- package/dist/components/atoms/typography.d.mts +22 -23
- package/dist/components/atoms/view.d.mts +4 -4
- package/dist/components/atoms/view.js.map +1 -1
- package/dist/components/controls/addon.d.mts +1 -2
- package/dist/components/controls/container.d.mts +1 -2
- package/dist/components/controls/container.js +9 -33
- package/dist/components/controls/container.js.map +1 -1
- package/dist/components/controls/container.styles.d.mts +18 -0
- package/dist/components/controls/container.styles.js +27 -0
- package/dist/components/controls/container.styles.js.map +1 -0
- package/dist/components/controls/control.d.mts +14 -12
- package/dist/components/controls/control.js +6 -0
- package/dist/components/controls/control.js.map +1 -1
- package/dist/components/controls/error.d.mts +1 -2
- package/dist/components/controls/field.d.mts +11 -0
- package/dist/components/controls/field.js +46 -0
- package/dist/components/controls/field.js.map +1 -0
- package/dist/components/controls/icon.d.mts +11 -0
- package/dist/components/controls/icon.js +24 -0
- package/dist/components/controls/icon.js.map +1 -0
- package/dist/components/controls/index.d.mts +0 -1
- package/dist/components/controls/input.d.mts +1 -2
- package/dist/components/controls/label.d.mts +1 -2
- package/dist/components/controls/loader.d.mts +1 -2
- package/dist/components/controls/placeholder.d.mts +1 -2
- package/dist/components/controls/provider.d.mts +1 -2
- package/dist/components/controls/root.d.mts +1 -2
- package/dist/components/controls/trigger.d.mts +11 -0
- package/dist/components/controls/trigger.js +41 -0
- package/dist/components/controls/trigger.js.map +1 -0
- package/dist/components/controls/value.d.mts +1 -2
- package/dist/components/index.d.mts +0 -1
- package/dist/constants/control-root.constants.d.mts +3 -3
- package/dist/hocs/create-preset.hoc.d.mts +1 -2
- package/dist/hocs/index.d.mts +0 -1
- package/dist/index.d.mts +2 -3
- package/dist/types/control-components.types.d.mts +13 -2
- package/dist/types/index.d.mts +1 -1
- package/package.json +13 -13
package/README.md
CHANGED
|
@@ -93,6 +93,27 @@ export function ProfileSummary() {
|
|
|
93
93
|
|
|
94
94
|
Use the compound `Control` when building a custom field that should share the same label, addon, error, size, and variant behavior as `Input` and `Select`.
|
|
95
95
|
|
|
96
|
+
`Control.Trigger` combines the field container's themed geometry with a
|
|
97
|
+
Pressable. It respects group and local disabling and accepts supplied children,
|
|
98
|
+
style props, and function-valued pressable styles. `Control.Icon` renders a
|
|
99
|
+
caller-selected icon with the current field's addon color.
|
|
100
|
+
|
|
101
|
+
`Control.Field` assembles a label, trigger, optional prefix/suffix slots, and an
|
|
102
|
+
error label for a read-only selection field. The caller supplies the value,
|
|
103
|
+
placeholder, icons, and behavior; this convenience component does not choose
|
|
104
|
+
default icons or manage selection state.
|
|
105
|
+
|
|
106
|
+
```tsx
|
|
107
|
+
<Control.Field
|
|
108
|
+
label="Destination"
|
|
109
|
+
onPress={openDestinationPicker}
|
|
110
|
+
prefix={<Control.Icon icon={LocationIcon} />}
|
|
111
|
+
>
|
|
112
|
+
<Control.Value>{destination}</Control.Value>
|
|
113
|
+
</Control.Field>
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
|
|
96
117
|
`Control.Addon` and `Control.Error` render supplied children. Addons own spacing
|
|
97
118
|
and optional press behavior, including group/local disabling; the parent chooses
|
|
98
119
|
and renders icons or custom content. Error owns error-label styling; the parent
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
2
|
import { AvatarProps } from '../../types/avatar.types.mjs';
|
|
4
3
|
import 'react-native';
|
|
5
4
|
import '@impulse-ui-native/theme';
|
|
6
5
|
import '../../types/view.types.mjs';
|
|
7
6
|
|
|
8
|
-
declare const Avatar: react.MemoExoticComponent<({ fallback, imageProps, initials, size, source, status, statusColor, style, variant, ...props }: AvatarProps) =>
|
|
7
|
+
declare const Avatar: react.MemoExoticComponent<({ fallback, imageProps, initials, size, source, status, statusColor, style, variant, ...props }: AvatarProps) => react.JSX.Element>;
|
|
9
8
|
|
|
10
9
|
export { Avatar };
|
|
@@ -26,10 +26,11 @@ const Avatar = memo(function Avatar2({
|
|
|
26
26
|
() => [styles.container, extractedStyleProps, style],
|
|
27
27
|
[extractedStyleProps, style, styles.container]
|
|
28
28
|
);
|
|
29
|
+
const showInitials = (fallback === null || fallback === void 0) && initials;
|
|
29
30
|
return /* @__PURE__ */ jsxs(View, { ...props, style: containerStyle, children: [
|
|
30
31
|
/* @__PURE__ */ jsxs(View, { style: styles.content, children: [
|
|
31
32
|
fallback,
|
|
32
|
-
|
|
33
|
+
showInitials ? /* @__PURE__ */ jsx(Text, { style: styles.initials, children: initials }) : null,
|
|
33
34
|
source ? /* @__PURE__ */ jsx(
|
|
34
35
|
AvatarImageLayer,
|
|
35
36
|
{
|
|
@@ -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 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 fallback,\n imageProps,\n initials,\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\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 {...props} style={containerStyle}>\n <View style={styles.content}>\n {fallback}\n {
|
|
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 fallback,\n imageProps,\n initials,\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\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 const showInitials =\n (fallback === null || fallback === undefined) && initials;\n\n return (\n <View {...props} style={containerStyle}>\n <View style={styles.content}>\n {fallback}\n {showInitials ? <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 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) {\n return null;\n }\n\n return (\n <Image\n resizeMode=\"cover\"\n {...imageProps}\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":"AAyCM,SAEkB,KAFlB;AAxCN,SAAS,MAAM,aAAa,SAAS,gBAAgB;AACrD,SAAS,OAAO,YAAY,YAAY;AAGxC,SAAS,eAAe,uBAAuB;AAG/C,SAAS,YAAY;AAEd,MAAM,SAAS,KAAK,SAASA,QAAO;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV,GAAG;AACL,GAAgB;AACd,QAAM,sBAAsB,cAAc,KAAK;AAC/C,QAAM,SAAS;AAAA,IACb;AAAA,IACA,EAAE,MAAM,QAAQ,aAAa,QAAQ;AAAA,IACrC,CAAC,MAAM,QAAQ,aAAa,OAAO;AAAA,EACrC;AAEA,QAAM,YAAY,QAAQ,MAAM,KAAK,UAAU,MAAM,GAAG,CAAC,MAAM,CAAC;AAEhE,QAAM,iBAAiB;AAAA,IACrB,MAAM,CAAC,OAAO,WAAW,qBAAqB,KAAK;AAAA,IACnD,CAAC,qBAAqB,OAAO,OAAO,SAAS;AAAA,EAC/C;AAEA,QAAM,gBACH,aAAa,QAAQ,aAAa,WAAc;AAEnD,SACE,qBAAC,QAAM,GAAG,OAAO,OAAO,gBACtB;AAAA,yBAAC,QAAK,OAAO,OAAO,SACjB;AAAA;AAAA,MACA,eAAe,oBAAC,QAAK,OAAO,OAAO,UAAW,oBAAS,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AA,MACR,gBAAgB;AAAA,MAChB,UAAU;AAAA,MACV,OAAO;AAAA,IACT;AAAA,IACA,UAAU;AAAA,MACR,OAAO,cAAc;AAAA,MACrB,YAAY,aAAa;AAAA,MACzB,UAAU,WAAW;AAAA,MACrB,WAAW;AAAA,IACb;AAAA,IACA,QAAQ;AAAA,MACN,iBACE,gBAAgB,SAAS,aAAa,aAAa,MAAM,IAAI;AAAA,MAC/D,aAAa,aAAa;AAAA,MAC1B,cAAc,WAAW,aAAa;AAAA,MACtC,aAAa,WAAW;AAAA,MACxB,QAAQ;AAAA,MACR,QAAQ,WAAW;AAAA,MACnB,UAAU;AAAA,MACV,OAAO;AAAA,MACP,OAAO,WAAW;AAAA,IACpB;AAAA,EACF,CAAC;AACH;AAEA,MAAM,eAAe,WAAW,OAAO;AAAA,EACrC,OAAO;AAAA,IACL,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,UAAU;AAAA,IACV,OAAO;AAAA,IACP,KAAK;AAAA,IACL,OAAO;AAAA,EACT;AACF,CAAC;","names":["Avatar","AvatarImageLayer"]}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ComponentType } from 'react';
|
|
3
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
3
|
import { IconProps } from '@impulse-ui-native/icon/types';
|
|
5
4
|
import { PressableCoreProps } from '../../../types/button.types.mjs';
|
|
6
5
|
import 'react-native';
|
|
@@ -14,6 +13,6 @@ interface BadgeAddonProps {
|
|
|
14
13
|
IconComponent: IconProps["icon"] | undefined;
|
|
15
14
|
onPress: PressableCoreProps["onPress"] | undefined;
|
|
16
15
|
}
|
|
17
|
-
declare const BadgeAddon: react.MemoExoticComponent<({ color, Content, hitSlop, iconSize, IconComponent, onPress, }: BadgeAddonProps) =>
|
|
16
|
+
declare const BadgeAddon: react.MemoExoticComponent<({ color, Content, hitSlop, iconSize, IconComponent, onPress, }: BadgeAddonProps) => react.JSX.Element | null>;
|
|
18
17
|
|
|
19
18
|
export { BadgeAddon };
|
|
@@ -11,7 +11,7 @@ const BadgeAddon = memo(function BadgeAddon2({
|
|
|
11
11
|
IconComponent,
|
|
12
12
|
onPress
|
|
13
13
|
}) {
|
|
14
|
-
const Container =
|
|
14
|
+
const Container = onPress ? Pressable : View;
|
|
15
15
|
const content = useMemo(() => {
|
|
16
16
|
if (Content) {
|
|
17
17
|
return /* @__PURE__ */ jsx(Content, {});
|
|
@@ -1 +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\";\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 =
|
|
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\";\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 = onPress ? Pressable : View;\n const content = useMemo(() => {\n if (Content) {\n return <Content />;\n }\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) {\n return null;\n }\n\n return (\n <Container hitSlop={hitSlop} onPress={onPress}>\n {content}\n </Container>\n );\n});\n"],"mappings":"AA8Ba;AA7Bb,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,UAAU,YAAY;AACxC,QAAM,UAAU,QAAQ,MAAM;AAC5B,QAAI,SAAS;AACX,aAAO,oBAAC,WAAQ;AAAA,IAClB;AAEA,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,SAAS;AACZ,WAAO;AAAA,EACT;AAEA,SACE,oBAAC,aAAU,SAAkB,SAC1B,mBACH;AAEJ,CAAC;","names":["BadgeAddon"]}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
2
|
import { BadgeProps } from '../../../types/badge.types.mjs';
|
|
4
3
|
import 'react-native';
|
|
5
4
|
import '@impulse-ui-native/theme';
|
|
@@ -9,6 +8,6 @@ import '../../../types/button.types.mjs';
|
|
|
9
8
|
import '../../../types/spinner.types.mjs';
|
|
10
9
|
import '../../../types/view.types.mjs';
|
|
11
10
|
|
|
12
|
-
declare const BadgeRoot: react.MemoExoticComponent<({ backgroundColor, children, color, Prefix, PrefixIcon, onPressPrefix, onPressSuffix, size, style, Suffix, SuffixIcon, tone, variant, ...props }: BadgeProps) =>
|
|
11
|
+
declare const BadgeRoot: react.MemoExoticComponent<({ backgroundColor, children, color, Prefix, PrefixIcon, onPressPrefix, onPressSuffix, size, style, Suffix, SuffixIcon, tone, variant, ...props }: BadgeProps) => react.JSX.Element>;
|
|
13
12
|
|
|
14
13
|
export { BadgeRoot };
|
|
@@ -38,6 +38,7 @@ const BadgeRoot = memo(function BadgeRoot2({
|
|
|
38
38
|
[extractedStyleProps, style, styles.container]
|
|
39
39
|
);
|
|
40
40
|
const affixColor = typeof styles.label.color === "string" ? styles.label.color : void 0;
|
|
41
|
+
const isTextChild = typeof children === "string" || typeof children === "number";
|
|
41
42
|
return /* @__PURE__ */ jsxs(View, { ...props, style: containerStyle, children: [
|
|
42
43
|
/* @__PURE__ */ jsx(
|
|
43
44
|
BadgeAddon,
|
|
@@ -50,7 +51,7 @@ const BadgeRoot = memo(function BadgeRoot2({
|
|
|
50
51
|
onPress: onPressPrefix
|
|
51
52
|
}
|
|
52
53
|
),
|
|
53
|
-
|
|
54
|
+
isTextChild ? /* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: styles.label, children }) : children,
|
|
54
55
|
/* @__PURE__ */ jsx(
|
|
55
56
|
BadgeAddon,
|
|
56
57
|
{
|
|
@@ -1 +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 backgroundColor,\n children,\n color,\n Prefix,\n PrefixIcon,\n onPressPrefix,\n onPressSuffix,\n size = \"medium\",\n style,\n Suffix,\n SuffixIcon,\n tone = \"primary\",\n variant = \"filled\",\n ...props\n}: BadgeProps) {\n const tokens = useComponentsTokens();\n\n const badgeTokens = tokens.badge;\n const sizeTokens = badgeTokens.sizes[size];\n\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\n const affixColor =\n typeof styles.label.color === \"string\" ? styles.label.color : undefined;\n\n return (\n <View {...props} style={containerStyle}>\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 {
|
|
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 backgroundColor,\n children,\n color,\n Prefix,\n PrefixIcon,\n onPressPrefix,\n onPressSuffix,\n size = \"medium\",\n style,\n Suffix,\n SuffixIcon,\n tone = \"primary\",\n variant = \"filled\",\n ...props\n}: BadgeProps) {\n const tokens = useComponentsTokens();\n\n const badgeTokens = tokens.badge;\n const sizeTokens = badgeTokens.sizes[size];\n\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\n const affixColor =\n typeof styles.label.color === \"string\" ? styles.label.color : undefined;\n\n const isTextChild =\n typeof children === \"string\" || typeof children === \"number\";\n\n return (\n <View {...props} style={containerStyle}>\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 {isTextChild ? (\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":"AAsDI,SACE,KADF;AAtDJ,SAAS,MAAM,eAAe;AAC9B,SAAS,YAAY,YAAY;AAGjC;AAAA,EACE;AA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AAA;AAAA,IACX;AAAA,KACF;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,10 +1,9 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { PropsWithChildren } from 'react';
|
|
3
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
3
|
import { ButtonProps } from '../../types/button.types.mjs';
|
|
5
4
|
import 'react-native';
|
|
6
5
|
import '@impulse-ui-native/theme';
|
|
7
6
|
|
|
8
|
-
declare const Button: react.MemoExoticComponent<({ size, variant, disabled, loading, children, style, ...props }: PropsWithChildren<ButtonProps>) =>
|
|
7
|
+
declare const Button: react.MemoExoticComponent<({ size, variant, disabled, loading, children, style, ...props }: PropsWithChildren<ButtonProps>) => react.JSX.Element>;
|
|
9
8
|
|
|
10
9
|
export { Button };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
2
|
import { DividerProps } from '../../types/divider.types.mjs';
|
|
4
3
|
import 'react-native';
|
|
5
4
|
import '@impulse-ui-native/theme';
|
|
6
5
|
import '../../types/view.types.mjs';
|
|
7
6
|
|
|
8
|
-
declare const Divider: react.MemoExoticComponent<({ color, inset, orientation, style, tone, ...props }: DividerProps) =>
|
|
7
|
+
declare const Divider: react.MemoExoticComponent<({ color, inset, orientation, style, tone, ...props }: DividerProps) => react.JSX.Element>;
|
|
9
8
|
|
|
10
9
|
export { Divider };
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { PropsWithChildren } from 'react';
|
|
3
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
3
|
import { IconButtonProps } from '../../types/icon-button.types.mjs';
|
|
5
4
|
import '@impulse-ui-native/icon/types';
|
|
6
5
|
import '@impulse-ui-native/theme';
|
|
7
6
|
import '../../types/button.types.mjs';
|
|
8
7
|
import 'react-native';
|
|
9
8
|
|
|
10
|
-
declare const IconButton: react.MemoExoticComponent<({ size, variant, disabled, loading, style, icon, ...props }: PropsWithChildren<IconButtonProps>) =>
|
|
9
|
+
declare const IconButton: react.MemoExoticComponent<({ size, variant, disabled, loading, style, icon, ...props }: PropsWithChildren<IconButtonProps>) => react.JSX.Element>;
|
|
11
10
|
|
|
12
11
|
export { IconButton };
|
|
@@ -10,7 +10,6 @@ export { Pressable } from './pressable.mjs';
|
|
|
10
10
|
export { Spinner } from './spinner.mjs';
|
|
11
11
|
export { Tag } from './tag.mjs';
|
|
12
12
|
import 'react';
|
|
13
|
-
import 'react/jsx-runtime';
|
|
14
13
|
import '../../types/avatar.types.mjs';
|
|
15
14
|
import 'react-native';
|
|
16
15
|
import '@impulse-ui-native/theme';
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { NamedExoticComponent, PropsWithoutRef, RefAttributes, ComponentRef } from 'react';
|
|
2
|
+
import { Pressable as Pressable$1 } from 'react-native';
|
|
3
3
|
import { PressableCoreProps } from '../../types/button.types.mjs';
|
|
4
4
|
import '@impulse-ui-native/theme';
|
|
5
5
|
|
|
6
|
-
declare const Pressable:
|
|
7
|
-
children?: react.ReactNode | undefined;
|
|
8
|
-
} & react.RefAttributes<react_native.View>>;
|
|
6
|
+
declare const Pressable: NamedExoticComponent<PropsWithoutRef<PressableCoreProps> & RefAttributes<ComponentRef<typeof Pressable$1>>>;
|
|
9
7
|
|
|
10
8
|
export { Pressable };
|
|
@@ -11,53 +11,55 @@ import {
|
|
|
11
11
|
useTheme
|
|
12
12
|
} from "@impulse-ui-native/theme";
|
|
13
13
|
const Pressable = memo(
|
|
14
|
-
forwardRef(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
14
|
+
forwardRef(
|
|
15
|
+
function PressableCore({ children, disabled, pressedStyle, style, ...props }, ref) {
|
|
16
|
+
const { colors, shadows } = useTheme();
|
|
17
|
+
const tokens = useComponentsTokens();
|
|
18
|
+
const pressableTokens = tokens.pressable;
|
|
19
|
+
const extractedStyleProps = useStyleProps(props);
|
|
20
|
+
const pressableStyles = useCallback(
|
|
21
|
+
(state) => {
|
|
22
|
+
let overrideStyle;
|
|
23
|
+
if (typeof style === "function") {
|
|
24
|
+
overrideStyle = style(state);
|
|
25
|
+
} else {
|
|
26
|
+
overrideStyle = style;
|
|
27
|
+
}
|
|
28
|
+
return StyleSheet.flatten([
|
|
29
|
+
{
|
|
30
|
+
opacity: disabled ? pressableTokens.disabledOpacity : state.pressed ? pressableTokens.pressedOpacity : 1
|
|
31
|
+
},
|
|
32
|
+
getShadowStyle(props.shadow, props.shadowPosition, colors, shadows),
|
|
33
|
+
extractedStyleProps,
|
|
34
|
+
overrideStyle,
|
|
35
|
+
state.pressed ? pressedStyle : void 0
|
|
36
|
+
]);
|
|
37
|
+
},
|
|
38
|
+
[
|
|
39
|
+
style,
|
|
40
|
+
pressedStyle,
|
|
41
|
+
disabled,
|
|
32
42
|
extractedStyleProps,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
...props,
|
|
54
|
-
ref,
|
|
55
|
-
style: pressableStyles,
|
|
56
|
-
disabled,
|
|
57
|
-
children
|
|
58
|
-
}
|
|
59
|
-
);
|
|
60
|
-
})
|
|
43
|
+
props.shadow,
|
|
44
|
+
props.shadowPosition,
|
|
45
|
+
colors,
|
|
46
|
+
shadows,
|
|
47
|
+
pressableTokens.disabledOpacity,
|
|
48
|
+
pressableTokens.pressedOpacity
|
|
49
|
+
]
|
|
50
|
+
);
|
|
51
|
+
return /* @__PURE__ */ jsx(
|
|
52
|
+
RNPressable,
|
|
53
|
+
{
|
|
54
|
+
...props,
|
|
55
|
+
ref,
|
|
56
|
+
style: pressableStyles,
|
|
57
|
+
disabled,
|
|
58
|
+
children
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
)
|
|
61
63
|
);
|
|
62
64
|
export {
|
|
63
65
|
Pressable
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/atoms/pressable.tsx"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"sources":["../../../src/components/atoms/pressable.tsx"],"sourcesContent":["import type {\n ComponentRef,\n NamedExoticComponent,\n PropsWithoutRef,\n RefAttributes,\n} from \"react\";\nimport { forwardRef, memo, useCallback } from \"react\";\nimport {\n PressableStateCallbackType,\n Pressable as RNPressable,\n StyleProp,\n StyleSheet,\n ViewStyle,\n} from \"react-native\";\n\nimport {\n getShadowStyle,\n useComponentsTokens,\n useStyleProps,\n useTheme,\n} from \"@impulse-ui-native/theme\";\n\nimport { PressableCoreProps } from \"../../types\";\n\nexport const Pressable: NamedExoticComponent<\n PropsWithoutRef<PressableCoreProps> &\n RefAttributes<ComponentRef<typeof RNPressable>>\n> = memo(\n forwardRef<ComponentRef<typeof RNPressable>, PressableCoreProps>(\n function PressableCore(\n { children, disabled, pressedStyle, style, ...props },\n ref,\n ) {\n const { colors, shadows } = useTheme();\n const tokens = useComponentsTokens();\n\n const pressableTokens = tokens.pressable;\n\n const extractedStyleProps = useStyleProps(props);\n\n const pressableStyles = useCallback(\n (state: PressableStateCallbackType): StyleProp<ViewStyle> => {\n let overrideStyle: StyleProp<ViewStyle>;\n\n if (typeof style === \"function\") {\n overrideStyle = style(state);\n } else {\n overrideStyle = style;\n }\n\n return StyleSheet.flatten([\n {\n opacity: disabled\n ? pressableTokens.disabledOpacity\n : state.pressed\n ? pressableTokens.pressedOpacity\n : 1,\n },\n getShadowStyle(props.shadow, props.shadowPosition, colors, shadows),\n extractedStyleProps,\n overrideStyle,\n state.pressed ? pressedStyle : undefined,\n ]);\n },\n [\n style,\n pressedStyle,\n disabled,\n extractedStyleProps,\n props.shadow,\n props.shadowPosition,\n colors,\n shadows,\n pressableTokens.disabledOpacity,\n pressableTokens.pressedOpacity,\n ],\n );\n\n return (\n <RNPressable\n {...props}\n ref={ref}\n style={pressableStyles}\n disabled={disabled}\n >\n {children}\n </RNPressable>\n );\n },\n ),\n);\n"],"mappings":"AA+EQ;AAzER,SAAS,YAAY,MAAM,mBAAmB;AAC9C;AAAA,EAEE,aAAa;AAAA,EAEb;AAAA,OAEK;AAEP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAIA,MAAM,YAGT;AAAA,EACF;AAAA,IACE,SAAS,cACP,EAAE,UAAU,UAAU,cAAc,OAAO,GAAG,MAAM,GACpD,KACA;AACA,YAAM,EAAE,QAAQ,QAAQ,IAAI,SAAS;AACrC,YAAM,SAAS,oBAAoB;AAEnC,YAAM,kBAAkB,OAAO;AAE/B,YAAM,sBAAsB,cAAc,KAAK;AAE/C,YAAM,kBAAkB;AAAA,QACtB,CAAC,UAA4D;AAC3D,cAAI;AAEJ,cAAI,OAAO,UAAU,YAAY;AAC/B,4BAAgB,MAAM,KAAK;AAAA,UAC7B,OAAO;AACL,4BAAgB;AAAA,UAClB;AAEA,iBAAO,WAAW,QAAQ;AAAA,YACxB;AAAA,cACE,SAAS,WACL,gBAAgB,kBAChB,MAAM,UACJ,gBAAgB,iBAChB;AAAA,YACR;AAAA,YACA,eAAe,MAAM,QAAQ,MAAM,gBAAgB,QAAQ,OAAO;AAAA,YAClE;AAAA,YACA;AAAA,YACA,MAAM,UAAU,eAAe;AAAA,UACjC,CAAC;AAAA,QACH;AAAA,QACA;AAAA,UACE;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA,MAAM;AAAA,UACN,MAAM;AAAA,UACN;AAAA,UACA;AAAA,UACA,gBAAgB;AAAA,UAChB,gBAAgB;AAAA,QAClB;AAAA,MACF;AAEA,aACE;AAAA,QAAC;AAAA;AAAA,UACE,GAAG;AAAA,UACJ;AAAA,UACA,OAAO;AAAA,UACP;AAAA,UAEC;AAAA;AAAA,MACH;AAAA,IAEJ;AAAA,EACF;AACF;","names":[]}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
2
|
import { SafeAreaViewProps } from '../../types/safe-area-view.types.mjs';
|
|
4
3
|
import 'react-native-safe-area-context';
|
|
5
4
|
|
|
6
|
-
declare const SafeAreaView: react.MemoExoticComponent<(props: SafeAreaViewProps) =>
|
|
5
|
+
declare const SafeAreaView: react.MemoExoticComponent<(props: SafeAreaViewProps) => react.JSX.Element>;
|
|
7
6
|
|
|
8
7
|
export { SafeAreaView };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
2
|
import { SpinnerProps } from '../../types/spinner.types.mjs';
|
|
4
3
|
import 'react-native';
|
|
5
4
|
import '@impulse-ui-native/theme';
|
|
6
5
|
|
|
7
|
-
declare const Spinner: react.MemoExoticComponent<({ animating, color, hidesWhenStopped, size, style, tone, ...props }: SpinnerProps) =>
|
|
6
|
+
declare const Spinner: react.MemoExoticComponent<({ animating, color, hidesWhenStopped, size, style, tone, ...props }: SpinnerProps) => react.JSX.Element>;
|
|
8
7
|
|
|
9
8
|
export { Spinner };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
2
|
import { TagProps } from '../../types/tag.types.mjs';
|
|
4
3
|
import 'react-native';
|
|
5
4
|
import '@impulse-ui-native/theme';
|
|
6
5
|
|
|
7
|
-
declare const Tag: react.MemoExoticComponent<({ label, size, variant, color, closable, disabled, onClose, onPress, }: TagProps) =>
|
|
6
|
+
declare const Tag: react.MemoExoticComponent<({ label, size, variant, color, closable, disabled, onClose, onPress, }: TagProps) => react.JSX.Element>;
|
|
8
7
|
|
|
9
8
|
export { Tag };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { memo
|
|
2
|
+
import { memo } from "react";
|
|
3
3
|
import { StyleSheet, View } from "react-native";
|
|
4
4
|
import { Icon } from "@impulse-ui-native/icon";
|
|
5
5
|
import { XCircleIcon } from "@impulse-ui-native/icon/icons/x-circle";
|
|
@@ -32,12 +32,7 @@ const Tag = memo(function Tag2({
|
|
|
32
32
|
},
|
|
33
33
|
[size, variant, disabled, color]
|
|
34
34
|
);
|
|
35
|
-
const Container =
|
|
36
|
-
if (onPress) {
|
|
37
|
-
return Pressable;
|
|
38
|
-
}
|
|
39
|
-
return View;
|
|
40
|
-
}, [onPress]);
|
|
35
|
+
const Container = onPress ? Pressable : View;
|
|
41
36
|
const showClose = closable && !disabled && onClose;
|
|
42
37
|
return /* @__PURE__ */ jsxs(Container, { onPress, disabled, style: styles.container, children: [
|
|
43
38
|
/* @__PURE__ */ jsx(Typography.Caption, { style: styles.label, children: label }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/atoms/tag.tsx"],"sourcesContent":["import { memo
|
|
1
|
+
{"version":3,"sources":["../../../src/components/atoms/tag.tsx"],"sourcesContent":["import { memo } from \"react\";\nimport { StyleSheet, View } from \"react-native\";\n\nimport { Icon } from \"@impulse-ui-native/icon\";\nimport { XCircleIcon } from \"@impulse-ui-native/icon/icons/x-circle\";\nimport {\n AppTheme,\n getAvailabilityStateTokens,\n useComponentsTokens,\n useThemedStyles,\n} from \"@impulse-ui-native/theme\";\n\nimport { TagProps, TagThemeProps } from \"../../types\";\nimport { Pressable } from \"./pressable\";\nimport { Typography } from \"./typography\";\n\nexport const Tag = memo(function Tag({\n label,\n size = \"medium\",\n variant = \"filled\",\n color = \"primary\",\n closable,\n disabled,\n onClose,\n onPress,\n}: TagProps) {\n const tokens = useComponentsTokens();\n\n const tagTokens = tokens.tag;\n\n const styles = useThemedStyles(\n themedStyles,\n {\n size,\n variant,\n disabled,\n color,\n },\n [size, variant, disabled, color],\n );\n\n const Container = onPress ? Pressable : View;\n\n const showClose = closable && !disabled && onClose;\n\n return (\n <Container onPress={onPress} disabled={disabled} style={styles.container}>\n <Typography.Caption style={styles.label}>{label}</Typography.Caption>\n\n {showClose ? (\n <Pressable onPress={onClose} hitSlop={tagTokens.closeHitSlop}>\n <Icon\n icon={XCircleIcon}\n size=\"small\"\n color={styles.icon.color}\n style={styles.icon}\n />\n </Pressable>\n ) : null}\n </Container>\n );\n});\n\nfunction themedStyles(theme: AppTheme, props: TagThemeProps) {\n const { size, variant, color, disabled } = props;\n\n const tagTokens = theme.components.tag;\n const sizeTokens = tagTokens.sizes[size];\n const appearanceTokens = getAvailabilityStateTokens(\n tagTokens.colors[color][variant],\n { disabled },\n );\n\n return StyleSheet.create({\n container: {\n flexDirection: \"row\",\n alignItems: \"center\",\n justifyContent: \"center\",\n alignSelf: \"flex-start\",\n\n height: sizeTokens.height,\n paddingHorizontal: sizeTokens.paddingHorizontal,\n minWidth: sizeTokens.minWidth,\n\n borderRadius: tagTokens.borderRadius,\n gap: tagTokens.gap,\n borderWidth: tagTokens.borderWidth,\n\n borderColor: appearanceTokens.borderColor,\n backgroundColor: appearanceTokens.backgroundColor,\n },\n\n label: {\n fontSize: sizeTokens.fontSize,\n color: appearanceTokens.color,\n },\n\n icon: {\n marginLeft: tagTokens.iconMarginLeft,\n color: appearanceTokens.color,\n },\n });\n}\n"],"mappings":"AA8CI,SACE,KADF;AA9CJ,SAAS,YAAY;AACrB,SAAS,YAAY,YAAY;AAEjC,SAAS,YAAY;AACrB,SAAS,mBAAmB;AAC5B;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGP,SAAS,iBAAiB;AAC1B,SAAS,kBAAkB;AAEpB,MAAM,MAAM,KAAK,SAASA,KAAI;AAAA,EACnC;AAAA,EACA,OAAO;AAAA,EACP,UAAU;AAAA,EACV,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAa;AACX,QAAM,SAAS,oBAAoB;AAEnC,QAAM,YAAY,OAAO;AAEzB,QAAM,SAAS;AAAA,IACb;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,CAAC,MAAM,SAAS,UAAU,KAAK;AAAA,EACjC;AAEA,QAAM,YAAY,UAAU,YAAY;AAEx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-runtime';
|
|
3
2
|
import { TextProps } from '../../types/typography.types.mjs';
|
|
4
3
|
import 'react-native';
|
|
5
4
|
import '@impulse-ui-native/theme';
|
|
6
5
|
|
|
7
6
|
declare const Typography: {
|
|
8
7
|
Master: react.MemoExoticComponent<{
|
|
9
|
-
(props: TextProps):
|
|
8
|
+
(props: TextProps): react.JSX.Element;
|
|
10
9
|
displayName: string;
|
|
11
10
|
}>;
|
|
12
11
|
DisplayLarge: react.MemoExoticComponent<{
|
|
13
|
-
(props: TextProps):
|
|
12
|
+
(props: TextProps): react.JSX.Element;
|
|
14
13
|
displayName: string;
|
|
15
14
|
}>;
|
|
16
15
|
DisplayMedium: react.MemoExoticComponent<{
|
|
17
|
-
(props: TextProps):
|
|
16
|
+
(props: TextProps): react.JSX.Element;
|
|
18
17
|
displayName: string;
|
|
19
18
|
}>;
|
|
20
19
|
DisplaySmall: react.MemoExoticComponent<{
|
|
21
|
-
(props: TextProps):
|
|
20
|
+
(props: TextProps): react.JSX.Element;
|
|
22
21
|
displayName: string;
|
|
23
22
|
}>;
|
|
24
23
|
Title1: react.MemoExoticComponent<{
|
|
25
|
-
(props: TextProps):
|
|
24
|
+
(props: TextProps): react.JSX.Element;
|
|
26
25
|
displayName: string;
|
|
27
26
|
}>;
|
|
28
27
|
Title2: react.MemoExoticComponent<{
|
|
29
|
-
(props: TextProps):
|
|
28
|
+
(props: TextProps): react.JSX.Element;
|
|
30
29
|
displayName: string;
|
|
31
30
|
}>;
|
|
32
31
|
Title3: react.MemoExoticComponent<{
|
|
33
|
-
(props: TextProps):
|
|
32
|
+
(props: TextProps): react.JSX.Element;
|
|
34
33
|
displayName: string;
|
|
35
34
|
}>;
|
|
36
35
|
Title4: react.MemoExoticComponent<{
|
|
37
|
-
(props: TextProps):
|
|
36
|
+
(props: TextProps): react.JSX.Element;
|
|
38
37
|
displayName: string;
|
|
39
38
|
}>;
|
|
40
39
|
Title5: react.MemoExoticComponent<{
|
|
41
|
-
(props: TextProps):
|
|
40
|
+
(props: TextProps): react.JSX.Element;
|
|
42
41
|
displayName: string;
|
|
43
42
|
}>;
|
|
44
43
|
Title6: react.MemoExoticComponent<{
|
|
45
|
-
(props: TextProps):
|
|
44
|
+
(props: TextProps): react.JSX.Element;
|
|
46
45
|
displayName: string;
|
|
47
46
|
}>;
|
|
48
47
|
Subtitle1: react.MemoExoticComponent<{
|
|
49
|
-
(props: TextProps):
|
|
48
|
+
(props: TextProps): react.JSX.Element;
|
|
50
49
|
displayName: string;
|
|
51
50
|
}>;
|
|
52
51
|
Subtitle2: react.MemoExoticComponent<{
|
|
53
|
-
(props: TextProps):
|
|
52
|
+
(props: TextProps): react.JSX.Element;
|
|
54
53
|
displayName: string;
|
|
55
54
|
}>;
|
|
56
55
|
BodyLarge: react.MemoExoticComponent<{
|
|
57
|
-
(props: TextProps):
|
|
56
|
+
(props: TextProps): react.JSX.Element;
|
|
58
57
|
displayName: string;
|
|
59
58
|
}>;
|
|
60
59
|
Body: react.MemoExoticComponent<{
|
|
61
|
-
(props: TextProps):
|
|
60
|
+
(props: TextProps): react.JSX.Element;
|
|
62
61
|
displayName: string;
|
|
63
62
|
}>;
|
|
64
63
|
BodySmall: react.MemoExoticComponent<{
|
|
65
|
-
(props: TextProps):
|
|
64
|
+
(props: TextProps): react.JSX.Element;
|
|
66
65
|
displayName: string;
|
|
67
66
|
}>;
|
|
68
67
|
Caption: react.MemoExoticComponent<{
|
|
69
|
-
(props: TextProps):
|
|
68
|
+
(props: TextProps): react.JSX.Element;
|
|
70
69
|
displayName: string;
|
|
71
70
|
}>;
|
|
72
71
|
Label: react.MemoExoticComponent<{
|
|
73
|
-
(props: TextProps):
|
|
72
|
+
(props: TextProps): react.JSX.Element;
|
|
74
73
|
displayName: string;
|
|
75
74
|
}>;
|
|
76
75
|
Overline: react.MemoExoticComponent<{
|
|
77
|
-
(props: TextProps):
|
|
76
|
+
(props: TextProps): react.JSX.Element;
|
|
78
77
|
displayName: string;
|
|
79
78
|
}>;
|
|
80
79
|
Helper: react.MemoExoticComponent<{
|
|
81
|
-
(props: TextProps):
|
|
80
|
+
(props: TextProps): react.JSX.Element;
|
|
82
81
|
displayName: string;
|
|
83
82
|
}>;
|
|
84
83
|
Code: react.MemoExoticComponent<{
|
|
85
|
-
(props: TextProps):
|
|
84
|
+
(props: TextProps): react.JSX.Element;
|
|
86
85
|
displayName: string;
|
|
87
86
|
}>;
|
|
88
87
|
Quote: react.MemoExoticComponent<{
|
|
89
|
-
(props: TextProps):
|
|
88
|
+
(props: TextProps): react.JSX.Element;
|
|
90
89
|
displayName: string;
|
|
91
90
|
}>;
|
|
92
91
|
Eyebrow: react.MemoExoticComponent<{
|
|
93
|
-
(props: TextProps):
|
|
92
|
+
(props: TextProps): react.JSX.Element;
|
|
94
93
|
displayName: string;
|
|
95
94
|
}>;
|
|
96
95
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import * as _impulse_ui_native_theme from '@impulse-ui-native/theme';
|
|
3
|
-
import * as react_native from 'react-native';
|
|
1
|
+
import { NamedExoticComponent, PropsWithoutRef, RefAttributes, ComponentRef } from 'react';
|
|
4
2
|
import { View as View$1 } from 'react-native';
|
|
3
|
+
import { ViewProps } from '../../types/view.types.mjs';
|
|
4
|
+
import '@impulse-ui-native/theme';
|
|
5
5
|
|
|
6
|
-
declare const View:
|
|
6
|
+
declare const View: NamedExoticComponent<PropsWithoutRef<ViewProps> & RefAttributes<ComponentRef<typeof View$1>>>;
|
|
7
7
|
|
|
8
8
|
export { View };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/atoms/view.tsx"],"sourcesContent":["import { forwardRef, memo, useMemo } from \"react\";\nimport { View as NativeView, StyleSheet } from \"react-native\";\n\nimport {\n getShadowStyle,\n useStyleProps,\n useTheme,\n} from \"@impulse-ui-native/theme\";\n\nimport { ViewProps } from \"../../types\";\n\nexport const View = memo(\n forwardRef<NativeView
|
|
1
|
+
{"version":3,"sources":["../../../src/components/atoms/view.tsx"],"sourcesContent":["import type {\n ComponentRef,\n NamedExoticComponent,\n PropsWithoutRef,\n RefAttributes,\n} from \"react\";\nimport { forwardRef, memo, useMemo } from \"react\";\nimport { View as NativeView, StyleSheet } from \"react-native\";\n\nimport {\n getShadowStyle,\n useStyleProps,\n useTheme,\n} from \"@impulse-ui-native/theme\";\n\nimport { ViewProps } from \"../../types\";\n\nexport const View: NamedExoticComponent<\n PropsWithoutRef<ViewProps> & RefAttributes<ComponentRef<typeof NativeView>>\n> = memo(\n forwardRef<ComponentRef<typeof NativeView>, ViewProps>(function View(\n props: ViewProps,\n ref,\n ) {\n const { style, shadow, shadowPosition, ...rest } = props;\n\n const { colors, shadows } = useTheme();\n\n const extractedStyleProps = useStyleProps(props);\n\n const viewStyle = useMemo(() => {\n return StyleSheet.flatten([\n getShadowStyle(shadow, shadowPosition, colors, shadows),\n extractedStyleProps,\n style,\n ]);\n }, [extractedStyleProps, style, shadow, shadowPosition, colors, shadows]);\n\n return <NativeView {...rest} style={viewStyle} ref={ref} />;\n }),\n);\n"],"mappings":"AAsCW;AAhCX,SAAS,YAAY,MAAM,eAAe;AAC1C,SAAS,QAAQ,YAAY,kBAAkB;AAE/C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAIA,MAAM,OAET;AAAA,EACF,WAAuD,SAASA,MAC9D,OACA,KACA;AACA,UAAM,EAAE,OAAO,QAAQ,gBAAgB,GAAG,KAAK,IAAI;AAEnD,UAAM,EAAE,QAAQ,QAAQ,IAAI,SAAS;AAErC,UAAM,sBAAsB,cAAc,KAAK;AAE/C,UAAM,YAAY,QAAQ,MAAM;AAC9B,aAAO,WAAW,QAAQ;AAAA,QACxB,eAAe,QAAQ,gBAAgB,QAAQ,OAAO;AAAA,QACtD;AAAA,QACA;AAAA,MACF,CAAC;AAAA,IACH,GAAG,CAAC,qBAAqB,OAAO,QAAQ,gBAAgB,QAAQ,OAAO,CAAC;AAExE,WAAO,oBAAC,cAAY,GAAG,MAAM,OAAO,WAAW,KAAU;AAAA,EAC3D,CAAC;AACH;","names":["View"]}
|