@impulse-ui-native/primitives 9.1.2 → 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/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/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 +10 -10
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 };
|
|
@@ -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 };
|
|
@@ -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;AAExC,QAAM,YAAY,YAAY,CAAC,YAAY;AAE3C,SACE,qBAAC,aAAU,SAAkB,UAAoB,OAAO,OAAO,WAC7D;AAAA,wBAAC,WAAW,SAAX,EAAmB,OAAO,OAAO,OAAQ,iBAAM;AAAA,IAE/C,YACC,oBAAC,aAAU,SAAS,SAAS,SAAS,UAAU,cAC9C;AAAA,MAAC;AAAA;AAAA,QACC,MAAM;AAAA,QACN,MAAK;AAAA,QACL,OAAO,OAAO,KAAK;AAAA,QACnB,OAAO,OAAO;AAAA;AAAA,IAChB,GACF,IACE;AAAA,KACN;AAEJ,CAAC;AAED,SAAS,aAAa,OAAiB,OAAsB;AAC3D,QAAM,EAAE,MAAM,SAAS,OAAO,SAAS,IAAI;AAE3C,QAAM,YAAY,MAAM,WAAW;AACnC,QAAM,aAAa,UAAU,MAAM,IAAI;AACvC,QAAM,mBAAmB;AAAA,IACvB,UAAU,OAAO,KAAK,EAAE,OAAO;AAAA,IAC/B,EAAE,SAAS;AAAA,EACb;AAEA,SAAO,WAAW,OAAO;AAAA,IACvB,WAAW;AAAA,MACT,eAAe;AAAA,MACf,YAAY;AAAA,MACZ,gBAAgB;AAAA,MAChB,WAAW;AAAA,MAEX,QAAQ,WAAW;AAAA,MACnB,mBAAmB,WAAW;AAAA,MAC9B,UAAU,WAAW;AAAA,MAErB,cAAc,UAAU;AAAA,MACxB,KAAK,UAAU;AAAA,MACf,aAAa,UAAU;AAAA,MAEvB,aAAa,iBAAiB;AAAA,MAC9B,iBAAiB,iBAAiB;AAAA,IACpC;AAAA,IAEA,OAAO;AAAA,MACL,UAAU,WAAW;AAAA,MACrB,OAAO,iBAAiB;AAAA,IAC1B;AAAA,IAEA,MAAM;AAAA,MACJ,YAAY,UAAU;AAAA,MACtB,OAAO,iBAAiB;AAAA,IAC1B;AAAA,EACF,CAAC;AACH;","names":["Tag"]}
|
|
@@ -1,96 +1,95 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import * as react_jsx_runtime from 'react/jsx-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"]}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
2
|
import { ControlAddonProps } from '../../types/control-components.types.mjs';
|
|
4
3
|
import 'react-native';
|
|
5
4
|
import '@impulse-ui-native/icon/types';
|
|
@@ -7,6 +6,6 @@ import '@impulse-ui-native/theme';
|
|
|
7
6
|
import '../../types/button.types.mjs';
|
|
8
7
|
import '../../types/spinner.types.mjs';
|
|
9
8
|
|
|
10
|
-
declare const ControlAddon: react.MemoExoticComponent<({ children, disabled, hitSlop, onPress, style, ...props }: ControlAddonProps) =>
|
|
9
|
+
declare const ControlAddon: react.MemoExoticComponent<({ children, disabled, hitSlop, onPress, style, ...props }: ControlAddonProps) => react.JSX.Element>;
|
|
11
10
|
|
|
12
11
|
export { ControlAddon };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
2
|
import { ControlContainerProps } from '../../types/control-components.types.mjs';
|
|
4
3
|
import 'react-native';
|
|
5
4
|
import '@impulse-ui-native/icon/types';
|
|
@@ -7,6 +6,6 @@ import '@impulse-ui-native/theme';
|
|
|
7
6
|
import '../../types/button.types.mjs';
|
|
8
7
|
import '../../types/spinner.types.mjs';
|
|
9
8
|
|
|
10
|
-
declare const ControlContainer: react.MemoExoticComponent<(props: ControlContainerProps) =>
|
|
9
|
+
declare const ControlContainer: react.MemoExoticComponent<({ style, ...props }: ControlContainerProps) => react.JSX.Element>;
|
|
11
10
|
|
|
12
11
|
export { ControlContainer };
|
|
@@ -1,49 +1,25 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { memo, useMemo } from "react";
|
|
3
|
-
import {
|
|
4
|
-
import { getFieldStateTokens, useThemedStyles } from "@impulse-ui-native/theme";
|
|
3
|
+
import { useThemedStyles } from "@impulse-ui-native/theme";
|
|
5
4
|
import { useControlContext } from "../../hooks/use-control-context.hook";
|
|
6
5
|
import { View } from "../atoms/view";
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
import { controlContainerStyles } from "./container.styles";
|
|
7
|
+
const ControlContainer = memo(function ControlContainer2({
|
|
8
|
+
style,
|
|
9
|
+
...props
|
|
10
|
+
}) {
|
|
9
11
|
const { size, variant, disabled, error } = useControlContext();
|
|
10
12
|
const styles = useThemedStyles(
|
|
11
|
-
|
|
12
|
-
{
|
|
13
|
-
size,
|
|
14
|
-
variant,
|
|
15
|
-
disabled,
|
|
16
|
-
error
|
|
17
|
-
},
|
|
13
|
+
controlContainerStyles,
|
|
14
|
+
{ size, variant, disabled, error },
|
|
18
15
|
[size, variant, disabled, error]
|
|
19
16
|
);
|
|
20
17
|
const containerStyle = useMemo(
|
|
21
18
|
() => [styles.inputContainer, style],
|
|
22
19
|
[styles.inputContainer, style]
|
|
23
20
|
);
|
|
24
|
-
return /* @__PURE__ */ jsx(View, { style: containerStyle
|
|
21
|
+
return /* @__PURE__ */ jsx(View, { ...props, style: containerStyle });
|
|
25
22
|
});
|
|
26
|
-
function themedStyles(theme, { size, variant, disabled, error }) {
|
|
27
|
-
const controlContainerTokens = theme.components.controlContainer;
|
|
28
|
-
const sizeTokens = controlContainerTokens.sizes[size];
|
|
29
|
-
const appearanceTokens = getFieldStateTokens(
|
|
30
|
-
controlContainerTokens.variants[variant],
|
|
31
|
-
{ disabled, error: Boolean(error) }
|
|
32
|
-
);
|
|
33
|
-
return StyleSheet.create({
|
|
34
|
-
inputContainer: {
|
|
35
|
-
flexDirection: "row",
|
|
36
|
-
alignItems: "center",
|
|
37
|
-
height: sizeTokens.height,
|
|
38
|
-
paddingHorizontal: sizeTokens.paddingHorizontal,
|
|
39
|
-
borderRadius: controlContainerTokens.borderRadius,
|
|
40
|
-
borderWidth: controlContainerTokens.borderWidth,
|
|
41
|
-
opacity: appearanceTokens.opacity,
|
|
42
|
-
backgroundColor: appearanceTokens.backgroundColor,
|
|
43
|
-
borderColor: appearanceTokens.borderColor
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
23
|
export {
|
|
48
24
|
ControlContainer
|
|
49
25
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/controls/container.tsx"],"sourcesContent":["import { memo, useMemo } from \"react\";\
|
|
1
|
+
{"version":3,"sources":["../../../src/components/controls/container.tsx"],"sourcesContent":["import { memo, useMemo } from \"react\";\n\nimport { useThemedStyles } from \"@impulse-ui-native/theme\";\n\nimport type { ControlContainerProps } from \"../../types\";\nimport { useControlContext } from \"../../hooks/use-control-context.hook\";\nimport { View } from \"../atoms/view\";\nimport { controlContainerStyles } from \"./container.styles\";\n\nexport const ControlContainer = memo(function ControlContainer({\n style,\n ...props\n}: ControlContainerProps) {\n const { size, variant, disabled, error } = useControlContext();\n const styles = useThemedStyles(\n controlContainerStyles,\n { size, variant, disabled, error },\n [size, variant, disabled, error],\n );\n const containerStyle = useMemo(\n () => [styles.inputContainer, style],\n [styles.inputContainer, style],\n );\n\n return <View {...props} style={containerStyle} />;\n});\n"],"mappings":"AAwBS;AAxBT,SAAS,MAAM,eAAe;AAE9B,SAAS,uBAAuB;AAGhC,SAAS,yBAAyB;AAClC,SAAS,YAAY;AACrB,SAAS,8BAA8B;AAEhC,MAAM,mBAAmB,KAAK,SAASA,kBAAiB;AAAA,EAC7D;AAAA,EACA,GAAG;AACL,GAA0B;AACxB,QAAM,EAAE,MAAM,SAAS,UAAU,MAAM,IAAI,kBAAkB;AAC7D,QAAM,SAAS;AAAA,IACb;AAAA,IACA,EAAE,MAAM,SAAS,UAAU,MAAM;AAAA,IACjC,CAAC,MAAM,SAAS,UAAU,KAAK;AAAA,EACjC;AACA,QAAM,iBAAiB;AAAA,IACrB,MAAM,CAAC,OAAO,gBAAgB,KAAK;AAAA,IACnC,CAAC,OAAO,gBAAgB,KAAK;AAAA,EAC/B;AAEA,SAAO,oBAAC,QAAM,GAAG,OAAO,OAAO,gBAAgB;AACjD,CAAC;","names":["ControlContainer"]}
|