@impulse-ui-native/primitives 7.0.1 → 8.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 +23 -0
- package/dist/components/atoms/badge/index.d.mts +1 -1
- package/dist/components/atoms/badge/root.d.mts +1 -1
- package/dist/components/atoms/index.d.mts +1 -1
- package/dist/components/controls/addon.d.mts +2 -2
- package/dist/components/controls/addon.js +21 -53
- package/dist/components/controls/addon.js.map +1 -1
- package/dist/components/controls/container.d.mts +1 -1
- package/dist/components/controls/container.js +3 -11
- package/dist/components/controls/container.js.map +1 -1
- package/dist/components/controls/control.d.mts +3 -3
- package/dist/components/controls/error.d.mts +2 -2
- package/dist/components/controls/error.js +2 -7
- package/dist/components/controls/error.js.map +1 -1
- package/dist/components/controls/index.d.mts +2 -2
- package/dist/components/controls/index.js +1 -1
- package/dist/components/controls/index.js.map +1 -1
- package/dist/components/controls/input.d.mts +1 -1
- package/dist/components/controls/input.js +4 -12
- package/dist/components/controls/input.js.map +1 -1
- package/dist/components/controls/label.d.mts +1 -1
- package/dist/components/controls/label.js +2 -5
- package/dist/components/controls/label.js.map +1 -1
- package/dist/components/controls/loader.d.mts +1 -1
- package/dist/components/controls/placeholder.d.mts +1 -1
- package/dist/components/controls/placeholder.js +3 -11
- package/dist/components/controls/placeholder.js.map +1 -1
- package/dist/components/controls/provider.d.mts +2 -3
- package/dist/components/controls/provider.js +8 -12
- package/dist/components/controls/provider.js.map +1 -1
- package/dist/components/controls/root.js +5 -7
- package/dist/components/controls/root.js.map +1 -1
- package/dist/components/controls/value.d.mts +1 -1
- package/dist/components/controls/value.js +3 -11
- package/dist/components/controls/value.js.map +1 -1
- package/dist/components/index.d.mts +2 -2
- package/dist/constants/control-root.constants.d.mts +7 -0
- package/dist/constants/control-root.constants.js +10 -0
- package/dist/constants/control-root.constants.js.map +1 -0
- package/dist/contexts/control.context.d.mts +11 -0
- package/dist/contexts/control.context.js +8 -0
- package/dist/contexts/control.context.js.map +1 -0
- package/dist/hooks/use-control-context.hook.d.mts +11 -0
- package/dist/hooks/use-control-context.hook.js +13 -0
- package/dist/hooks/use-control-context.hook.js.map +1 -0
- package/dist/index.d.mts +1 -1
- package/dist/types/badge.types.d.mts +1 -1
- package/dist/types/control-components.types.d.mts +13 -21
- package/dist/types/control-theme.types.d.mts +12 -0
- package/dist/types/control-theme.types.js +1 -0
- package/dist/types/control-theme.types.js.map +1 -0
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -93,6 +93,29 @@ 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.Addon` and `Control.Error` render supplied children. Addons own spacing
|
|
97
|
+
and optional press behavior, including group/local disabling; the parent chooses
|
|
98
|
+
and renders icons or custom content. Error owns error-label styling; the parent
|
|
99
|
+
chooses the text and whether to render the slot. `Input`, `Select`, date/time
|
|
100
|
+
pickers, `Textarea`, and `FormField` assemble these children explicitly.
|
|
101
|
+
|
|
102
|
+
For direct composition, migrate `icon` and `Content` props to addon children and
|
|
103
|
+
supply error text instead of relying on `Control.Provider.error` to render it:
|
|
104
|
+
|
|
105
|
+
```tsx
|
|
106
|
+
<>
|
|
107
|
+
<Control.Addon onPress={onPressPrefix}>
|
|
108
|
+
<Icon icon={PrefixIcon} color={addonColor} />
|
|
109
|
+
</Control.Addon>
|
|
110
|
+
{error ? <Control.Error>{error}</Control.Error> : null}
|
|
111
|
+
</>
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Resolve `addonColor` from
|
|
115
|
+
`getFieldStateTokens(theme.components.controlAddon.variants[variant], { disabled, error: Boolean(error) }).iconColor`
|
|
116
|
+
using the current theme. The provider's error value continues to drive field
|
|
117
|
+
appearance, but does not inject label content.
|
|
118
|
+
|
|
96
119
|
`Button` and `IconButton` replace their content with a loading indicator when `loading` is true. Loading controls block interaction until loading ends.
|
|
97
120
|
|
|
98
121
|
`Spinner` defaults to the primary theme tone and medium size. Use `tone="inverse"` on inverse surfaces, or provide `color` when the indicator must match contextual content.
|
|
@@ -6,6 +6,6 @@ import 'react-native';
|
|
|
6
6
|
import '@impulse-ui-native/theme';
|
|
7
7
|
import '../../../types/control-components.types.mjs';
|
|
8
8
|
import '@impulse-ui-native/icon/types';
|
|
9
|
-
import '../../../types/spinner.types.mjs';
|
|
10
9
|
import '../../../types/button.types.mjs';
|
|
10
|
+
import '../../../types/spinner.types.mjs';
|
|
11
11
|
import '../../../types/view.types.mjs';
|
|
@@ -5,8 +5,8 @@ import 'react-native';
|
|
|
5
5
|
import '@impulse-ui-native/theme';
|
|
6
6
|
import '../../../types/control-components.types.mjs';
|
|
7
7
|
import '@impulse-ui-native/icon/types';
|
|
8
|
-
import '../../../types/spinner.types.mjs';
|
|
9
8
|
import '../../../types/button.types.mjs';
|
|
9
|
+
import '../../../types/spinner.types.mjs';
|
|
10
10
|
import '../../../types/view.types.mjs';
|
|
11
11
|
|
|
12
12
|
declare const BadgeRoot: react.MemoExoticComponent<({ backgroundColor, children, color, Prefix, PrefixIcon, onPressPrefix, onPressSuffix, size, style, Suffix, SuffixIcon, tone, variant, ...props }: BadgeProps) => react_jsx_runtime.JSX.Element>;
|
|
@@ -18,8 +18,8 @@ import '../../types/view.types.mjs';
|
|
|
18
18
|
import '../../types/badge.types.mjs';
|
|
19
19
|
import '../../types/control-components.types.mjs';
|
|
20
20
|
import '@impulse-ui-native/icon/types';
|
|
21
|
-
import '../../types/spinner.types.mjs';
|
|
22
21
|
import '../../types/button.types.mjs';
|
|
22
|
+
import '../../types/spinner.types.mjs';
|
|
23
23
|
import '../../types/safe-area-view.types.mjs';
|
|
24
24
|
import 'react-native-safe-area-context';
|
|
25
25
|
import '../../types/typography.types.mjs';
|
|
@@ -4,9 +4,9 @@ import { ControlAddonProps } from '../../types/control-components.types.mjs';
|
|
|
4
4
|
import 'react-native';
|
|
5
5
|
import '@impulse-ui-native/icon/types';
|
|
6
6
|
import '@impulse-ui-native/theme';
|
|
7
|
-
import '../../types/spinner.types.mjs';
|
|
8
7
|
import '../../types/button.types.mjs';
|
|
8
|
+
import '../../types/spinner.types.mjs';
|
|
9
9
|
|
|
10
|
-
declare const ControlAddon: react.MemoExoticComponent<(props: ControlAddonProps) => react_jsx_runtime.JSX.Element
|
|
10
|
+
declare const ControlAddon: react.MemoExoticComponent<({ children, disabled, hitSlop, onPress, style, ...props }: ControlAddonProps) => react_jsx_runtime.JSX.Element>;
|
|
11
11
|
|
|
12
12
|
export { ControlAddon };
|
|
@@ -1,74 +1,42 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { memo, useMemo } from "react";
|
|
3
3
|
import { StyleSheet } from "react-native";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
getFieldStateTokens,
|
|
7
|
-
useComponentsTokens,
|
|
8
|
-
useThemedStyles
|
|
9
|
-
} from "@impulse-ui-native/theme";
|
|
4
|
+
import { useComponentsTokens, useThemedStyles } from "@impulse-ui-native/theme";
|
|
5
|
+
import { useControlContext } from "../../hooks/use-control-context.hook";
|
|
10
6
|
import { Pressable, View } from "../atoms";
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
);
|
|
25
|
-
const Container = useMemo(() => {
|
|
26
|
-
if (onPress) {
|
|
27
|
-
return Pressable;
|
|
28
|
-
}
|
|
29
|
-
return View;
|
|
30
|
-
}, [onPress]);
|
|
31
|
-
const children = useMemo(() => {
|
|
32
|
-
if (Content) {
|
|
33
|
-
return /* @__PURE__ */ jsx(Content, {});
|
|
34
|
-
}
|
|
35
|
-
if (AddonIcon) {
|
|
36
|
-
return /* @__PURE__ */ jsx(Icon, { color: styles.icon.color, icon: AddonIcon });
|
|
37
|
-
}
|
|
38
|
-
return null;
|
|
39
|
-
}, [AddonIcon, Content, styles.icon.color]);
|
|
7
|
+
const ControlAddon = memo(function ControlAddon2({
|
|
8
|
+
children,
|
|
9
|
+
disabled = false,
|
|
10
|
+
hitSlop,
|
|
11
|
+
onPress,
|
|
12
|
+
style,
|
|
13
|
+
...props
|
|
14
|
+
}) {
|
|
15
|
+
const { disabled: groupDisabled } = useControlContext();
|
|
16
|
+
const tokens = useComponentsTokens().controlAddon;
|
|
17
|
+
const styles = useThemedStyles(themedStyles);
|
|
18
|
+
const resolvedDisabled = Boolean(groupDisabled) || disabled;
|
|
19
|
+
const Container = onPress ? Pressable : View;
|
|
40
20
|
const containerStyle = useMemo(
|
|
41
21
|
() => [styles.container, style],
|
|
42
22
|
[styles.container, style]
|
|
43
23
|
);
|
|
44
|
-
if (!children) {
|
|
45
|
-
return null;
|
|
46
|
-
}
|
|
47
24
|
return /* @__PURE__ */ jsx(
|
|
48
25
|
Container,
|
|
49
26
|
{
|
|
50
|
-
...
|
|
51
|
-
|
|
52
|
-
hitSlop: tokens.
|
|
27
|
+
...props,
|
|
28
|
+
disabled: resolvedDisabled,
|
|
29
|
+
hitSlop: hitSlop ?? tokens.hitSlop,
|
|
53
30
|
onPress,
|
|
54
|
-
|
|
31
|
+
style: containerStyle,
|
|
55
32
|
children
|
|
56
33
|
}
|
|
57
34
|
);
|
|
58
35
|
});
|
|
59
|
-
function themedStyles(theme
|
|
60
|
-
const { variant, disabled, error } = props;
|
|
61
|
-
const controlAddonTokens = theme.components.controlAddon;
|
|
62
|
-
const appearanceTokens = getFieldStateTokens(
|
|
63
|
-
controlAddonTokens.variants[variant],
|
|
64
|
-
{ disabled, error: Boolean(error) }
|
|
65
|
-
);
|
|
36
|
+
function themedStyles(theme) {
|
|
66
37
|
return StyleSheet.create({
|
|
67
38
|
container: {
|
|
68
|
-
marginHorizontal:
|
|
69
|
-
},
|
|
70
|
-
icon: {
|
|
71
|
-
color: appearanceTokens.iconColor
|
|
39
|
+
marginHorizontal: theme.components.controlAddon.marginHorizontal
|
|
72
40
|
}
|
|
73
41
|
});
|
|
74
42
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/controls/addon.tsx"],"sourcesContent":["import { memo, useMemo } from \"react\";\nimport { StyleSheet } from \"react-native\";\n\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../src/components/controls/addon.tsx"],"sourcesContent":["import { memo, useMemo } from \"react\";\nimport { StyleSheet } from \"react-native\";\n\nimport type { AppTheme } from \"@impulse-ui-native/theme\";\nimport { useComponentsTokens, useThemedStyles } from \"@impulse-ui-native/theme\";\n\nimport type { ControlAddonProps } from \"../../types\";\nimport { useControlContext } from \"../../hooks/use-control-context.hook\";\nimport { Pressable, View } from \"../atoms\";\n\nexport const ControlAddon = memo(function ControlAddon({\n children,\n disabled = false,\n hitSlop,\n onPress,\n style,\n ...props\n}: ControlAddonProps) {\n const { disabled: groupDisabled } = useControlContext();\n const tokens = useComponentsTokens().controlAddon;\n const styles = useThemedStyles(themedStyles);\n\n const resolvedDisabled = Boolean(groupDisabled) || disabled;\n const Container = onPress ? Pressable : View;\n const containerStyle = useMemo(\n () => [styles.container, style],\n [styles.container, style],\n );\n\n return (\n <Container\n {...props}\n disabled={resolvedDisabled}\n hitSlop={hitSlop ?? tokens.hitSlop}\n onPress={onPress}\n style={containerStyle}\n >\n {children}\n </Container>\n );\n});\n\nfunction themedStyles(theme: AppTheme) {\n return StyleSheet.create({\n container: {\n marginHorizontal: theme.components.controlAddon.marginHorizontal,\n },\n });\n}\n"],"mappings":"AA8BI;AA9BJ,SAAS,MAAM,eAAe;AAC9B,SAAS,kBAAkB;AAG3B,SAAS,qBAAqB,uBAAuB;AAGrD,SAAS,yBAAyB;AAClC,SAAS,WAAW,YAAY;AAEzB,MAAM,eAAe,KAAK,SAASA,cAAa;AAAA,EACrD;AAAA,EACA,WAAW;AAAA,EACX;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAsB;AACpB,QAAM,EAAE,UAAU,cAAc,IAAI,kBAAkB;AACtD,QAAM,SAAS,oBAAoB,EAAE;AACrC,QAAM,SAAS,gBAAgB,YAAY;AAE3C,QAAM,mBAAmB,QAAQ,aAAa,KAAK;AACnD,QAAM,YAAY,UAAU,YAAY;AACxC,QAAM,iBAAiB;AAAA,IACrB,MAAM,CAAC,OAAO,WAAW,KAAK;AAAA,IAC9B,CAAC,OAAO,WAAW,KAAK;AAAA,EAC1B;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,UAAU;AAAA,MACV,SAAS,WAAW,OAAO;AAAA,MAC3B;AAAA,MACA,OAAO;AAAA,MAEN;AAAA;AAAA,EACH;AAEJ,CAAC;AAED,SAAS,aAAa,OAAiB;AACrC,SAAO,WAAW,OAAO;AAAA,IACvB,WAAW;AAAA,MACT,kBAAkB,MAAM,WAAW,aAAa;AAAA,IAClD;AAAA,EACF,CAAC;AACH;","names":["ControlAddon"]}
|
|
@@ -4,8 +4,8 @@ import { ControlContainerProps } from '../../types/control-components.types.mjs'
|
|
|
4
4
|
import 'react-native';
|
|
5
5
|
import '@impulse-ui-native/icon/types';
|
|
6
6
|
import '@impulse-ui-native/theme';
|
|
7
|
-
import '../../types/spinner.types.mjs';
|
|
8
7
|
import '../../types/button.types.mjs';
|
|
8
|
+
import '../../types/spinner.types.mjs';
|
|
9
9
|
|
|
10
10
|
declare const ControlContainer: react.MemoExoticComponent<(props: ControlContainerProps) => react_jsx_runtime.JSX.Element>;
|
|
11
11
|
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { memo, useMemo } from "react";
|
|
3
3
|
import { StyleSheet } from "react-native";
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
useThemedStyles
|
|
7
|
-
} from "@impulse-ui-native/theme";
|
|
4
|
+
import { getFieldStateTokens, useThemedStyles } from "@impulse-ui-native/theme";
|
|
5
|
+
import { useControlContext } from "../../hooks/use-control-context.hook";
|
|
8
6
|
import { View } from "../atoms/view";
|
|
9
|
-
import { useControlContext } from "./provider";
|
|
10
7
|
const ControlContainer = memo(function ControlContainer2(props) {
|
|
11
8
|
const { style, ...rest } = props;
|
|
12
9
|
const { size, variant, disabled, error } = useControlContext();
|
|
@@ -26,12 +23,7 @@ const ControlContainer = memo(function ControlContainer2(props) {
|
|
|
26
23
|
);
|
|
27
24
|
return /* @__PURE__ */ jsx(View, { style: containerStyle, ...rest });
|
|
28
25
|
});
|
|
29
|
-
function themedStyles(theme, {
|
|
30
|
-
size,
|
|
31
|
-
variant,
|
|
32
|
-
disabled,
|
|
33
|
-
error
|
|
34
|
-
}) {
|
|
26
|
+
function themedStyles(theme, { size, variant, disabled, error }) {
|
|
35
27
|
const controlContainerTokens = theme.components.controlContainer;
|
|
36
28
|
const sizeTokens = controlContainerTokens.sizes[size];
|
|
37
29
|
const appearanceTokens = getFieldStateTokens(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/controls/container.tsx"],"sourcesContent":["import { memo, useMemo } from \"react\";\nimport { StyleSheet } from \"react-native\";\n\nimport {\
|
|
1
|
+
{"version":3,"sources":["../../../src/components/controls/container.tsx"],"sourcesContent":["import { memo, useMemo } from \"react\";\nimport { StyleSheet } from \"react-native\";\n\nimport type { AppTheme } from \"@impulse-ui-native/theme\";\nimport { getFieldStateTokens, useThemedStyles } from \"@impulse-ui-native/theme\";\n\nimport type { ControlContainerProps } from \"../../types\";\nimport type { ControlFieldThemeProps } from \"../../types/control-theme.types\";\nimport { useControlContext } from \"../../hooks/use-control-context.hook\";\nimport { View } from \"../atoms/view\";\n\nexport const ControlContainer = memo(function ControlContainer(\n props: ControlContainerProps,\n) {\n const { style, ...rest } = props;\n\n const { size, variant, disabled, error } = useControlContext();\n\n const styles = useThemedStyles(\n themedStyles,\n {\n size,\n variant,\n disabled,\n error,\n },\n [size, variant, disabled, error],\n );\n\n const containerStyle = useMemo(\n () => [styles.inputContainer, style],\n [styles.inputContainer, style],\n );\n\n return <View style={containerStyle} {...rest} />;\n});\n\nfunction themedStyles(\n theme: AppTheme,\n { size, variant, disabled, error }: ControlFieldThemeProps,\n) {\n const controlContainerTokens = theme.components.controlContainer;\n const sizeTokens = controlContainerTokens.sizes[size];\n const appearanceTokens = getFieldStateTokens(\n controlContainerTokens.variants[variant],\n { disabled, error: Boolean(error) },\n );\n\n return StyleSheet.create({\n inputContainer: {\n flexDirection: \"row\",\n alignItems: \"center\",\n\n height: sizeTokens.height,\n paddingHorizontal: sizeTokens.paddingHorizontal,\n\n borderRadius: controlContainerTokens.borderRadius,\n borderWidth: controlContainerTokens.borderWidth,\n\n opacity: appearanceTokens.opacity,\n backgroundColor: appearanceTokens.backgroundColor,\n borderColor: appearanceTokens.borderColor,\n },\n });\n}\n"],"mappings":"AAkCS;AAlCT,SAAS,MAAM,eAAe;AAC9B,SAAS,kBAAkB;AAG3B,SAAS,qBAAqB,uBAAuB;AAIrD,SAAS,yBAAyB;AAClC,SAAS,YAAY;AAEd,MAAM,mBAAmB,KAAK,SAASA,kBAC5C,OACA;AACA,QAAM,EAAE,OAAO,GAAG,KAAK,IAAI;AAE3B,QAAM,EAAE,MAAM,SAAS,UAAU,MAAM,IAAI,kBAAkB;AAE7D,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,iBAAiB;AAAA,IACrB,MAAM,CAAC,OAAO,gBAAgB,KAAK;AAAA,IACnC,CAAC,OAAO,gBAAgB,KAAK;AAAA,EAC/B;AAEA,SAAO,oBAAC,QAAK,OAAO,gBAAiB,GAAG,MAAM;AAChD,CAAC;AAED,SAAS,aACP,OACA,EAAE,MAAM,SAAS,UAAU,MAAM,GACjC;AACA,QAAM,yBAAyB,MAAM,WAAW;AAChD,QAAM,aAAa,uBAAuB,MAAM,IAAI;AACpD,QAAM,mBAAmB;AAAA,IACvB,uBAAuB,SAAS,OAAO;AAAA,IACvC,EAAE,UAAU,OAAO,QAAQ,KAAK,EAAE;AAAA,EACpC;AAEA,SAAO,WAAW,OAAO;AAAA,IACvB,gBAAgB;AAAA,MACd,eAAe;AAAA,MACf,YAAY;AAAA,MAEZ,QAAQ,WAAW;AAAA,MACnB,mBAAmB,WAAW;AAAA,MAE9B,cAAc,uBAAuB;AAAA,MACrC,aAAa,uBAAuB;AAAA,MAEpC,SAAS,iBAAiB;AAAA,MAC1B,iBAAiB,iBAAiB;AAAA,MAClC,aAAa,iBAAiB;AAAA,IAChC;AAAA,EACF,CAAC;AACH;","names":["ControlContainer"]}
|
|
@@ -5,16 +5,16 @@ import { ControlContainerProps, ControlContextData, ControlLabelProps, ControlEr
|
|
|
5
5
|
import 'react-native';
|
|
6
6
|
import '@impulse-ui-native/theme';
|
|
7
7
|
import '@impulse-ui-native/icon/types';
|
|
8
|
-
import '../../types/spinner.types.mjs';
|
|
9
8
|
import '../../types/button.types.mjs';
|
|
9
|
+
import '../../types/spinner.types.mjs';
|
|
10
10
|
|
|
11
11
|
declare const Control: {
|
|
12
12
|
Container: react.MemoExoticComponent<(props: ControlContainerProps) => react_jsx_runtime.JSX.Element>;
|
|
13
13
|
Provider: react.MemoExoticComponent<(props: react.PropsWithChildren<ControlContextData>) => react_jsx_runtime.JSX.Element>;
|
|
14
14
|
Root: react.MemoExoticComponent<(props: ViewProps) => react_jsx_runtime.JSX.Element>;
|
|
15
15
|
Label: react.MemoExoticComponent<(props: ControlLabelProps) => react_jsx_runtime.JSX.Element | null>;
|
|
16
|
-
Error: react.MemoExoticComponent<(props: ControlErrorLabelProps) => react_jsx_runtime.JSX.Element
|
|
17
|
-
Addon: react.MemoExoticComponent<(props: ControlAddonProps) => react_jsx_runtime.JSX.Element
|
|
16
|
+
Error: react.MemoExoticComponent<(props: ControlErrorLabelProps) => react_jsx_runtime.JSX.Element>;
|
|
17
|
+
Addon: react.MemoExoticComponent<({ children, disabled, hitSlop, onPress, style, ...props }: ControlAddonProps) => react_jsx_runtime.JSX.Element>;
|
|
18
18
|
Input: react.MemoExoticComponent<(props: ControlInputProps) => react_jsx_runtime.JSX.Element>;
|
|
19
19
|
Placeholder: react.MemoExoticComponent<(props: ControlPlaceholderProps) => react_jsx_runtime.JSX.Element>;
|
|
20
20
|
Value: react.MemoExoticComponent<(props: ControlValueProps) => react_jsx_runtime.JSX.Element>;
|
|
@@ -4,9 +4,9 @@ import { ControlErrorLabelProps } from '../../types/control-components.types.mjs
|
|
|
4
4
|
import 'react-native';
|
|
5
5
|
import '@impulse-ui-native/icon/types';
|
|
6
6
|
import '@impulse-ui-native/theme';
|
|
7
|
-
import '../../types/spinner.types.mjs';
|
|
8
7
|
import '../../types/button.types.mjs';
|
|
8
|
+
import '../../types/spinner.types.mjs';
|
|
9
9
|
|
|
10
|
-
declare const ControlError: react.MemoExoticComponent<(props: ControlErrorLabelProps) => react_jsx_runtime.JSX.Element
|
|
10
|
+
declare const ControlError: react.MemoExoticComponent<(props: ControlErrorLabelProps) => react_jsx_runtime.JSX.Element>;
|
|
11
11
|
|
|
12
12
|
export { ControlError };
|
|
@@ -3,19 +3,14 @@ import { memo, useMemo } from "react";
|
|
|
3
3
|
import { StyleSheet } from "react-native";
|
|
4
4
|
import { useThemedStyles } from "@impulse-ui-native/theme";
|
|
5
5
|
import { Typography } from "../atoms";
|
|
6
|
-
import { useControlContext } from "./provider";
|
|
7
6
|
const ControlError = memo(function ControlError2(props) {
|
|
8
|
-
const { style, ...rest } = props;
|
|
9
|
-
const { error } = useControlContext();
|
|
7
|
+
const { children, style, ...rest } = props;
|
|
10
8
|
const styles = useThemedStyles(themedStyles);
|
|
11
9
|
const errorStyle = useMemo(
|
|
12
10
|
() => [styles.error, style],
|
|
13
11
|
[styles.error, style]
|
|
14
12
|
);
|
|
15
|
-
|
|
16
|
-
return null;
|
|
17
|
-
}
|
|
18
|
-
return /* @__PURE__ */ jsx(Typography.Caption, { ...rest, style: errorStyle, children: error });
|
|
13
|
+
return /* @__PURE__ */ jsx(Typography.Caption, { ...rest, style: errorStyle, children });
|
|
19
14
|
});
|
|
20
15
|
function themedStyles(theme) {
|
|
21
16
|
const controlErrorTokens = theme.components.controlError;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/controls/error.tsx"],"sourcesContent":["import { memo, useMemo } from \"react\";\nimport { StyleSheet } from \"react-native\";\n\nimport { AppTheme
|
|
1
|
+
{"version":3,"sources":["../../../src/components/controls/error.tsx"],"sourcesContent":["import { memo, useMemo } from \"react\";\nimport { StyleSheet } from \"react-native\";\n\nimport type { AppTheme } from \"@impulse-ui-native/theme\";\nimport { useThemedStyles } from \"@impulse-ui-native/theme\";\n\nimport type { ControlErrorLabelProps } from \"../../types\";\nimport { Typography } from \"../atoms\";\n\nexport const ControlError = memo(function ControlError(\n props: ControlErrorLabelProps,\n) {\n const { children, style, ...rest } = props;\n\n const styles = useThemedStyles(themedStyles);\n\n const errorStyle = useMemo(\n () => [styles.error, style],\n [styles.error, style],\n );\n\n return (\n <Typography.Caption {...rest} style={errorStyle}>\n {children}\n </Typography.Caption>\n );\n});\n\nfunction themedStyles(theme: AppTheme) {\n const controlErrorTokens = theme.components.controlError;\n\n return StyleSheet.create({\n error: {\n marginTop: controlErrorTokens.marginTop,\n color: controlErrorTokens.color,\n fontSize: controlErrorTokens.fontSize,\n },\n });\n}\n"],"mappings":"AAsBI;AAtBJ,SAAS,MAAM,eAAe;AAC9B,SAAS,kBAAkB;AAG3B,SAAS,uBAAuB;AAGhC,SAAS,kBAAkB;AAEpB,MAAM,eAAe,KAAK,SAASA,cACxC,OACA;AACA,QAAM,EAAE,UAAU,OAAO,GAAG,KAAK,IAAI;AAErC,QAAM,SAAS,gBAAgB,YAAY;AAE3C,QAAM,aAAa;AAAA,IACjB,MAAM,CAAC,OAAO,OAAO,KAAK;AAAA,IAC1B,CAAC,OAAO,OAAO,KAAK;AAAA,EACtB;AAEA,SACE,oBAAC,WAAW,SAAX,EAAoB,GAAG,MAAM,OAAO,YAClC,UACH;AAEJ,CAAC;AAED,SAAS,aAAa,OAAiB;AACrC,QAAM,qBAAqB,MAAM,WAAW;AAE5C,SAAO,WAAW,OAAO;AAAA,IACvB,OAAO;AAAA,MACL,WAAW,mBAAmB;AAAA,MAC9B,OAAO,mBAAmB;AAAA,MAC1B,UAAU,mBAAmB;AAAA,IAC/B;AAAA,EACF,CAAC;AACH;","names":["ControlError"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { Control } from './control.mjs';
|
|
2
|
-
export { useControlContext } from '
|
|
2
|
+
export { useControlContext } from '../../hooks/use-control-context.hook.mjs';
|
|
3
3
|
import 'react';
|
|
4
4
|
import 'react/jsx-runtime';
|
|
5
5
|
import '../../types/view.types.mjs';
|
|
@@ -7,5 +7,5 @@ import 'react-native';
|
|
|
7
7
|
import '@impulse-ui-native/theme';
|
|
8
8
|
import '../../types/control-components.types.mjs';
|
|
9
9
|
import '@impulse-ui-native/icon/types';
|
|
10
|
-
import '../../types/spinner.types.mjs';
|
|
11
10
|
import '../../types/button.types.mjs';
|
|
11
|
+
import '../../types/spinner.types.mjs';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/controls/index.ts"],"sourcesContent":["export { Control } from \"./control\";\nexport { useControlContext } from \"
|
|
1
|
+
{"version":3,"sources":["../../../src/components/controls/index.ts"],"sourcesContent":["export { Control } from \"./control\";\nexport { useControlContext } from \"../../hooks/use-control-context.hook\";\n"],"mappings":"AAAA,SAAS,eAAe;AACxB,SAAS,yBAAyB;","names":[]}
|
|
@@ -4,8 +4,8 @@ import { ControlInputProps } from '../../types/control-components.types.mjs';
|
|
|
4
4
|
import 'react-native';
|
|
5
5
|
import '@impulse-ui-native/icon/types';
|
|
6
6
|
import '@impulse-ui-native/theme';
|
|
7
|
-
import '../../types/spinner.types.mjs';
|
|
8
7
|
import '../../types/button.types.mjs';
|
|
8
|
+
import '../../types/spinner.types.mjs';
|
|
9
9
|
|
|
10
10
|
declare const ControlInput: react.MemoExoticComponent<(props: ControlInputProps) => react_jsx_runtime.JSX.Element>;
|
|
11
11
|
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { memo, useMemo } from "react";
|
|
3
3
|
import { StyleSheet, TextInput } from "react-native";
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
useThemedStyles
|
|
7
|
-
} from "@impulse-ui-native/theme";
|
|
8
|
-
import { useControlContext } from "./provider";
|
|
4
|
+
import { getFieldStateTokens, useThemedStyles } from "@impulse-ui-native/theme";
|
|
5
|
+
import { useControlContext } from "../../hooks/use-control-context.hook";
|
|
9
6
|
const ControlInput = memo(function ControlInput2(props) {
|
|
10
|
-
const { onPress, style, ...rest } = props;
|
|
7
|
+
const { onPress: _onPress, style, ...rest } = props;
|
|
11
8
|
const { size, variant, disabled, error } = useControlContext();
|
|
12
9
|
const styles = useThemedStyles(
|
|
13
10
|
themedStyles,
|
|
@@ -33,12 +30,7 @@ const ControlInput = memo(function ControlInput2(props) {
|
|
|
33
30
|
}
|
|
34
31
|
);
|
|
35
32
|
});
|
|
36
|
-
function themedStyles(theme, {
|
|
37
|
-
size,
|
|
38
|
-
variant,
|
|
39
|
-
disabled,
|
|
40
|
-
error
|
|
41
|
-
}) {
|
|
33
|
+
function themedStyles(theme, { size, variant, disabled, error }) {
|
|
42
34
|
const controlInputTokens = theme.components.controlInput;
|
|
43
35
|
const sizeTokens = controlInputTokens.sizes[size];
|
|
44
36
|
const appearanceTokens = getFieldStateTokens(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/controls/input.tsx"],"sourcesContent":["import { memo, useMemo } from \"react\";\nimport { StyleSheet, TextInput } from \"react-native\";\n\nimport {\
|
|
1
|
+
{"version":3,"sources":["../../../src/components/controls/input.tsx"],"sourcesContent":["import { memo, useMemo } from \"react\";\nimport { StyleSheet, TextInput } from \"react-native\";\n\nimport type { AppTheme } from \"@impulse-ui-native/theme\";\nimport { getFieldStateTokens, useThemedStyles } from \"@impulse-ui-native/theme\";\n\nimport type { ControlInputProps } from \"../../types\";\nimport type { ControlFieldThemeProps } from \"../../types/control-theme.types\";\nimport { useControlContext } from \"../../hooks/use-control-context.hook\";\n\nexport const ControlInput = memo(function ControlInput(\n props: ControlInputProps,\n) {\n const { onPress: _onPress, style, ...rest } = props;\n\n const { size, variant, disabled, error } = useControlContext();\n\n const styles = useThemedStyles(\n themedStyles,\n {\n size,\n variant,\n disabled,\n error,\n },\n [size, variant, disabled, error],\n );\n\n const inputStyles = useMemo(\n () => [styles.input, style],\n [styles.input, style],\n );\n\n return (\n <TextInput\n {...rest}\n style={inputStyles}\n placeholderTextColor={styles.placeholder.color}\n editable={!disabled}\n />\n );\n});\n\nfunction themedStyles(\n theme: AppTheme,\n { size, variant, disabled, error }: ControlFieldThemeProps,\n) {\n const controlInputTokens = theme.components.controlInput;\n const sizeTokens = controlInputTokens.sizes[size];\n const appearanceTokens = getFieldStateTokens(\n controlInputTokens.variants[variant],\n { disabled, error: Boolean(error) },\n );\n\n return StyleSheet.create({\n input: {\n flex: controlInputTokens.flex,\n color: appearanceTokens.color,\n fontSize: sizeTokens.fontSize,\n fontFamily: controlInputTokens.fontFamily,\n paddingHorizontal: controlInputTokens.paddingHorizontal,\n height: \"100%\",\n },\n\n placeholder: {\n color: appearanceTokens.placeholderColor,\n },\n });\n}\n"],"mappings":"AAkCI;AAlCJ,SAAS,MAAM,eAAe;AAC9B,SAAS,YAAY,iBAAiB;AAGtC,SAAS,qBAAqB,uBAAuB;AAIrD,SAAS,yBAAyB;AAE3B,MAAM,eAAe,KAAK,SAASA,cACxC,OACA;AACA,QAAM,EAAE,SAAS,UAAU,OAAO,GAAG,KAAK,IAAI;AAE9C,QAAM,EAAE,MAAM,SAAS,UAAU,MAAM,IAAI,kBAAkB;AAE7D,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,cAAc;AAAA,IAClB,MAAM,CAAC,OAAO,OAAO,KAAK;AAAA,IAC1B,CAAC,OAAO,OAAO,KAAK;AAAA,EACtB;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,OAAO;AAAA,MACP,sBAAsB,OAAO,YAAY;AAAA,MACzC,UAAU,CAAC;AAAA;AAAA,EACb;AAEJ,CAAC;AAED,SAAS,aACP,OACA,EAAE,MAAM,SAAS,UAAU,MAAM,GACjC;AACA,QAAM,qBAAqB,MAAM,WAAW;AAC5C,QAAM,aAAa,mBAAmB,MAAM,IAAI;AAChD,QAAM,mBAAmB;AAAA,IACvB,mBAAmB,SAAS,OAAO;AAAA,IACnC,EAAE,UAAU,OAAO,QAAQ,KAAK,EAAE;AAAA,EACpC;AAEA,SAAO,WAAW,OAAO;AAAA,IACvB,OAAO;AAAA,MACL,MAAM,mBAAmB;AAAA,MACzB,OAAO,iBAAiB;AAAA,MACxB,UAAU,WAAW;AAAA,MACrB,YAAY,mBAAmB;AAAA,MAC/B,mBAAmB,mBAAmB;AAAA,MACtC,QAAQ;AAAA,IACV;AAAA,IAEA,aAAa;AAAA,MACX,OAAO,iBAAiB;AAAA,IAC1B;AAAA,EACF,CAAC;AACH;","names":["ControlInput"]}
|
|
@@ -4,8 +4,8 @@ import { ControlLabelProps } from '../../types/control-components.types.mjs';
|
|
|
4
4
|
import 'react-native';
|
|
5
5
|
import '@impulse-ui-native/icon/types';
|
|
6
6
|
import '@impulse-ui-native/theme';
|
|
7
|
-
import '../../types/spinner.types.mjs';
|
|
8
7
|
import '../../types/button.types.mjs';
|
|
8
|
+
import '../../types/spinner.types.mjs';
|
|
9
9
|
|
|
10
10
|
declare const ControlLabel: react.MemoExoticComponent<(props: ControlLabelProps) => react_jsx_runtime.JSX.Element | null>;
|
|
11
11
|
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { memo, useMemo } from "react";
|
|
3
3
|
import { StyleSheet } from "react-native";
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
useThemedStyles
|
|
7
|
-
} from "@impulse-ui-native/theme";
|
|
4
|
+
import { getFieldStateTokens, useThemedStyles } from "@impulse-ui-native/theme";
|
|
5
|
+
import { useControlContext } from "../../hooks/use-control-context.hook";
|
|
8
6
|
import { Typography } from "../atoms";
|
|
9
|
-
import { useControlContext } from "./provider";
|
|
10
7
|
const ControlLabel = memo(function ControlLabel2(props) {
|
|
11
8
|
const { children, disabled, style, ...rest } = props;
|
|
12
9
|
const { error } = useControlContext();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/controls/label.tsx"],"sourcesContent":["import { memo, useMemo } from \"react\";\nimport { StyleSheet } from \"react-native\";\n\nimport {\
|
|
1
|
+
{"version":3,"sources":["../../../src/components/controls/label.tsx"],"sourcesContent":["import { memo, useMemo } from \"react\";\nimport { StyleSheet } from \"react-native\";\n\nimport type { AppTheme } from \"@impulse-ui-native/theme\";\nimport { getFieldStateTokens, useThemedStyles } from \"@impulse-ui-native/theme\";\n\nimport type { ControlLabelProps } from \"../../types\";\nimport type { ControlStateThemeProps } from \"../../types/control-theme.types\";\nimport { useControlContext } from \"../../hooks/use-control-context.hook\";\nimport { Typography } from \"../atoms\";\n\nexport const ControlLabel = memo(function ControlLabel(\n props: ControlLabelProps,\n) {\n const { children, disabled, style, ...rest } = props;\n\n const { error } = useControlContext();\n\n const styles = useThemedStyles(\n themedStyles,\n {\n disabled,\n error,\n },\n [disabled, error],\n );\n\n const labelStyle = useMemo(\n () => [styles.label, style],\n [styles.label, style],\n );\n\n if (!children) {\n return null;\n }\n\n return (\n <Typography.Label {...rest} style={labelStyle}>\n {children}\n </Typography.Label>\n );\n});\n\nfunction themedStyles(theme: AppTheme, props: ControlStateThemeProps) {\n const { disabled, error } = props;\n\n const controlLabelTokens = theme.components.controlLabel;\n const appearanceTokens = getFieldStateTokens(controlLabelTokens.states, {\n disabled,\n error: Boolean(error),\n });\n\n return StyleSheet.create({\n label: {\n marginBottom: controlLabelTokens.marginBottom,\n fontSize: controlLabelTokens.fontSize,\n color: appearanceTokens.color,\n },\n });\n}\n"],"mappings":"AAqCI;AArCJ,SAAS,MAAM,eAAe;AAC9B,SAAS,kBAAkB;AAG3B,SAAS,qBAAqB,uBAAuB;AAIrD,SAAS,yBAAyB;AAClC,SAAS,kBAAkB;AAEpB,MAAM,eAAe,KAAK,SAASA,cACxC,OACA;AACA,QAAM,EAAE,UAAU,UAAU,OAAO,GAAG,KAAK,IAAI;AAE/C,QAAM,EAAE,MAAM,IAAI,kBAAkB;AAEpC,QAAM,SAAS;AAAA,IACb;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,IACF;AAAA,IACA,CAAC,UAAU,KAAK;AAAA,EAClB;AAEA,QAAM,aAAa;AAAA,IACjB,MAAM,CAAC,OAAO,OAAO,KAAK;AAAA,IAC1B,CAAC,OAAO,OAAO,KAAK;AAAA,EACtB;AAEA,MAAI,CAAC,UAAU;AACb,WAAO;AAAA,EACT;AAEA,SACE,oBAAC,WAAW,OAAX,EAAkB,GAAG,MAAM,OAAO,YAChC,UACH;AAEJ,CAAC;AAED,SAAS,aAAa,OAAiB,OAA+B;AACpE,QAAM,EAAE,UAAU,MAAM,IAAI;AAE5B,QAAM,qBAAqB,MAAM,WAAW;AAC5C,QAAM,mBAAmB,oBAAoB,mBAAmB,QAAQ;AAAA,IACtE;AAAA,IACA,OAAO,QAAQ,KAAK;AAAA,EACtB,CAAC;AAED,SAAO,WAAW,OAAO;AAAA,IACvB,OAAO;AAAA,MACL,cAAc,mBAAmB;AAAA,MACjC,UAAU,mBAAmB;AAAA,MAC7B,OAAO,iBAAiB;AAAA,IAC1B;AAAA,EACF,CAAC;AACH;","names":["ControlLabel"]}
|
|
@@ -4,8 +4,8 @@ import { ControlLoaderProps } from '../../types/control-components.types.mjs';
|
|
|
4
4
|
import 'react-native';
|
|
5
5
|
import '@impulse-ui-native/icon/types';
|
|
6
6
|
import '@impulse-ui-native/theme';
|
|
7
|
-
import '../../types/spinner.types.mjs';
|
|
8
7
|
import '../../types/button.types.mjs';
|
|
8
|
+
import '../../types/spinner.types.mjs';
|
|
9
9
|
|
|
10
10
|
declare const ControlLoader: react.MemoExoticComponent<(props: ControlLoaderProps) => react_jsx_runtime.JSX.Element>;
|
|
11
11
|
|
|
@@ -4,8 +4,8 @@ import { ControlPlaceholderProps } from '../../types/control-components.types.mj
|
|
|
4
4
|
import 'react-native';
|
|
5
5
|
import '@impulse-ui-native/icon/types';
|
|
6
6
|
import '@impulse-ui-native/theme';
|
|
7
|
-
import '../../types/spinner.types.mjs';
|
|
8
7
|
import '../../types/button.types.mjs';
|
|
8
|
+
import '../../types/spinner.types.mjs';
|
|
9
9
|
|
|
10
10
|
declare const ControlPlaceholder: react.MemoExoticComponent<(props: ControlPlaceholderProps) => react_jsx_runtime.JSX.Element>;
|
|
11
11
|
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { memo, useMemo } from "react";
|
|
3
3
|
import { StyleSheet } from "react-native";
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
useThemedStyles
|
|
7
|
-
} from "@impulse-ui-native/theme";
|
|
4
|
+
import { getFieldStateTokens, useThemedStyles } from "@impulse-ui-native/theme";
|
|
5
|
+
import { useControlContext } from "../../hooks/use-control-context.hook";
|
|
8
6
|
import { Typography } from "../atoms";
|
|
9
|
-
import { useControlContext } from "./provider";
|
|
10
7
|
const ControlPlaceholder = memo(function ControlPlaceholder2(props) {
|
|
11
8
|
const { style, ...rest } = props;
|
|
12
9
|
const { size, variant, disabled, error } = useControlContext();
|
|
@@ -26,12 +23,7 @@ const ControlPlaceholder = memo(function ControlPlaceholder2(props) {
|
|
|
26
23
|
);
|
|
27
24
|
return /* @__PURE__ */ jsx(Typography.Master, { numberOfLines: 1, ...rest, style: placeholderStyle });
|
|
28
25
|
});
|
|
29
|
-
function themedStyles(theme, {
|
|
30
|
-
size,
|
|
31
|
-
variant,
|
|
32
|
-
disabled,
|
|
33
|
-
error
|
|
34
|
-
}) {
|
|
26
|
+
function themedStyles(theme, { size, variant, disabled, error }) {
|
|
35
27
|
const controlInputTokens = theme.components.controlInput;
|
|
36
28
|
const sizeTokens = controlInputTokens.sizes[size];
|
|
37
29
|
const appearanceTokens = getFieldStateTokens(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/controls/placeholder.tsx"],"sourcesContent":["import { memo, useMemo } from \"react\";\nimport { StyleSheet } from \"react-native\";\n\nimport {\
|
|
1
|
+
{"version":3,"sources":["../../../src/components/controls/placeholder.tsx"],"sourcesContent":["import { memo, useMemo } from \"react\";\nimport { StyleSheet } from \"react-native\";\n\nimport type { AppTheme } from \"@impulse-ui-native/theme\";\nimport { getFieldStateTokens, useThemedStyles } from \"@impulse-ui-native/theme\";\n\nimport type { ControlPlaceholderProps } from \"../../types\";\nimport type { ControlFieldThemeProps } from \"../../types/control-theme.types\";\nimport { useControlContext } from \"../../hooks/use-control-context.hook\";\nimport { Typography } from \"../atoms\";\n\nexport const ControlPlaceholder = memo(function ControlPlaceholder(\n props: ControlPlaceholderProps,\n) {\n const { style, ...rest } = props;\n\n const { size, variant, disabled, error } = useControlContext();\n\n const styles = useThemedStyles(\n themedStyles,\n {\n size,\n variant,\n disabled,\n error,\n },\n [size, variant, disabled, error],\n );\n\n const placeholderStyle = useMemo(\n () => [styles.placeholder, style],\n [styles.placeholder, style],\n );\n\n return (\n <Typography.Master numberOfLines={1} {...rest} style={placeholderStyle} />\n );\n});\n\nfunction themedStyles(\n theme: AppTheme,\n { size, variant, disabled, error }: ControlFieldThemeProps,\n) {\n const controlInputTokens = theme.components.controlInput;\n const sizeTokens = controlInputTokens.sizes[size];\n const appearanceTokens = getFieldStateTokens(\n controlInputTokens.variants[variant],\n { disabled, error: Boolean(error) },\n );\n\n return StyleSheet.create({\n placeholder: {\n flex: controlInputTokens.flex,\n color: appearanceTokens.placeholderColor,\n fontFamily: controlInputTokens.fontFamily,\n fontSize: sizeTokens.fontSize,\n paddingHorizontal: controlInputTokens.paddingHorizontal,\n },\n });\n}\n"],"mappings":"AAmCI;AAnCJ,SAAS,MAAM,eAAe;AAC9B,SAAS,kBAAkB;AAG3B,SAAS,qBAAqB,uBAAuB;AAIrD,SAAS,yBAAyB;AAClC,SAAS,kBAAkB;AAEpB,MAAM,qBAAqB,KAAK,SAASA,oBAC9C,OACA;AACA,QAAM,EAAE,OAAO,GAAG,KAAK,IAAI;AAE3B,QAAM,EAAE,MAAM,SAAS,UAAU,MAAM,IAAI,kBAAkB;AAE7D,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,mBAAmB;AAAA,IACvB,MAAM,CAAC,OAAO,aAAa,KAAK;AAAA,IAChC,CAAC,OAAO,aAAa,KAAK;AAAA,EAC5B;AAEA,SACE,oBAAC,WAAW,QAAX,EAAkB,eAAe,GAAI,GAAG,MAAM,OAAO,kBAAkB;AAE5E,CAAC;AAED,SAAS,aACP,OACA,EAAE,MAAM,SAAS,UAAU,MAAM,GACjC;AACA,QAAM,qBAAqB,MAAM,WAAW;AAC5C,QAAM,aAAa,mBAAmB,MAAM,IAAI;AAChD,QAAM,mBAAmB;AAAA,IACvB,mBAAmB,SAAS,OAAO;AAAA,IACnC,EAAE,UAAU,OAAO,QAAQ,KAAK,EAAE;AAAA,EACpC;AAEA,SAAO,WAAW,OAAO;AAAA,IACvB,aAAa;AAAA,MACX,MAAM,mBAAmB;AAAA,MACzB,OAAO,iBAAiB;AAAA,MACxB,YAAY,mBAAmB;AAAA,MAC/B,UAAU,WAAW;AAAA,MACrB,mBAAmB,mBAAmB;AAAA,IACxC;AAAA,EACF,CAAC;AACH;","names":["ControlPlaceholder"]}
|
|
@@ -5,10 +5,9 @@ import { ControlContextData } from '../../types/control-components.types.mjs';
|
|
|
5
5
|
import 'react-native';
|
|
6
6
|
import '@impulse-ui-native/icon/types';
|
|
7
7
|
import '@impulse-ui-native/theme';
|
|
8
|
-
import '../../types/spinner.types.mjs';
|
|
9
8
|
import '../../types/button.types.mjs';
|
|
9
|
+
import '../../types/spinner.types.mjs';
|
|
10
10
|
|
|
11
11
|
declare const ControlProvider: react.MemoExoticComponent<(props: PropsWithChildren<ControlContextData>) => react_jsx_runtime.JSX.Element>;
|
|
12
|
-
declare function useControlContext(): ControlContextData;
|
|
13
12
|
|
|
14
|
-
export { ControlProvider
|
|
13
|
+
export { ControlProvider };
|
|
@@ -1,19 +1,15 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { memo, useMemo } from "react";
|
|
3
|
+
import { ControlContext } from "../../contexts/control.context";
|
|
4
4
|
const ControlProvider = memo(function ControlProvider2(props) {
|
|
5
|
-
const { children,
|
|
5
|
+
const { children, disabled, error, size, variant } = props;
|
|
6
|
+
const context = useMemo(
|
|
7
|
+
() => ({ disabled, error, size, variant }),
|
|
8
|
+
[disabled, error, size, variant]
|
|
9
|
+
);
|
|
6
10
|
return /* @__PURE__ */ jsx(ControlContext.Provider, { value: context, children });
|
|
7
11
|
});
|
|
8
|
-
function useControlContext() {
|
|
9
|
-
const context = useContext(ControlContext);
|
|
10
|
-
if (!context) {
|
|
11
|
-
throw new Error("useControlContext must be used within ControlProvider");
|
|
12
|
-
}
|
|
13
|
-
return context;
|
|
14
|
-
}
|
|
15
12
|
export {
|
|
16
|
-
ControlProvider
|
|
17
|
-
useControlContext
|
|
13
|
+
ControlProvider
|
|
18
14
|
};
|
|
19
15
|
//# sourceMappingURL=provider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/controls/provider.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../../../src/components/controls/provider.tsx"],"sourcesContent":["import type { PropsWithChildren } from \"react\";\nimport { memo, useMemo } from \"react\";\n\nimport type { ControlContextData } from \"../../types\";\nimport { ControlContext } from \"../../contexts/control.context\";\n\nexport const ControlProvider = memo(function ControlProvider(\n props: PropsWithChildren<ControlContextData>,\n) {\n const { children, disabled, error, size, variant } = props;\n\n const context = useMemo<ControlContextData>(\n () => ({ disabled, error, size, variant }),\n [disabled, error, size, variant],\n );\n\n return (\n <ControlContext.Provider value={context}>\n {children}\n </ControlContext.Provider>\n );\n});\n"],"mappings":"AAiBI;AAhBJ,SAAS,MAAM,eAAe;AAG9B,SAAS,sBAAsB;AAExB,MAAM,kBAAkB,KAAK,SAASA,iBAC3C,OACA;AACA,QAAM,EAAE,UAAU,UAAU,OAAO,MAAM,QAAQ,IAAI;AAErD,QAAM,UAAU;AAAA,IACd,OAAO,EAAE,UAAU,OAAO,MAAM,QAAQ;AAAA,IACxC,CAAC,UAAU,OAAO,MAAM,OAAO;AAAA,EACjC;AAEA,SACE,oBAAC,eAAe,UAAf,EAAwB,OAAO,SAC7B,UACH;AAEJ,CAAC;","names":["ControlProvider"]}
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { memo, useMemo } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { ControlRootStyles } from "../../constants/control-root.constants";
|
|
4
4
|
import { View } from "../atoms";
|
|
5
5
|
const ControlRoot = memo(function ControlRoot2(props) {
|
|
6
6
|
const { style, ...rest } = props;
|
|
7
|
-
const containerStyle = useMemo(
|
|
7
|
+
const containerStyle = useMemo(
|
|
8
|
+
() => [ControlRootStyles.container, style],
|
|
9
|
+
[style]
|
|
10
|
+
);
|
|
8
11
|
return /* @__PURE__ */ jsx(View, { ...rest, style: containerStyle });
|
|
9
12
|
});
|
|
10
|
-
const styles = StyleSheet.create({
|
|
11
|
-
container: {
|
|
12
|
-
width: "100%"
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
13
|
export {
|
|
16
14
|
ControlRoot
|
|
17
15
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/controls/root.tsx"],"sourcesContent":["import { memo, useMemo } from \"react\";\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../src/components/controls/root.tsx"],"sourcesContent":["import { memo, useMemo } from \"react\";\n\nimport type { ViewProps } from \"../../types\";\nimport { ControlRootStyles } from \"../../constants/control-root.constants\";\nimport { View } from \"../atoms\";\n\nexport const ControlRoot = memo(function ControlRoot(props: ViewProps) {\n const { style, ...rest } = props;\n\n const containerStyle = useMemo(\n () => [ControlRootStyles.container, style],\n [style],\n );\n\n return <View {...rest} style={containerStyle} />;\n});\n"],"mappings":"AAcS;AAdT,SAAS,MAAM,eAAe;AAG9B,SAAS,yBAAyB;AAClC,SAAS,YAAY;AAEd,MAAM,cAAc,KAAK,SAASA,aAAY,OAAkB;AACrE,QAAM,EAAE,OAAO,GAAG,KAAK,IAAI;AAE3B,QAAM,iBAAiB;AAAA,IACrB,MAAM,CAAC,kBAAkB,WAAW,KAAK;AAAA,IACzC,CAAC,KAAK;AAAA,EACR;AAEA,SAAO,oBAAC,QAAM,GAAG,MAAM,OAAO,gBAAgB;AAChD,CAAC;","names":["ControlRoot"]}
|
|
@@ -4,8 +4,8 @@ import { ControlValueProps } from '../../types/control-components.types.mjs';
|
|
|
4
4
|
import 'react-native';
|
|
5
5
|
import '@impulse-ui-native/icon/types';
|
|
6
6
|
import '@impulse-ui-native/theme';
|
|
7
|
-
import '../../types/spinner.types.mjs';
|
|
8
7
|
import '../../types/button.types.mjs';
|
|
8
|
+
import '../../types/spinner.types.mjs';
|
|
9
9
|
|
|
10
10
|
declare const ControlValue: react.MemoExoticComponent<(props: ControlValueProps) => react_jsx_runtime.JSX.Element>;
|
|
11
11
|
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { memo, useMemo } from "react";
|
|
3
3
|
import { StyleSheet } from "react-native";
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
useThemedStyles
|
|
7
|
-
} from "@impulse-ui-native/theme";
|
|
4
|
+
import { getFieldStateTokens, useThemedStyles } from "@impulse-ui-native/theme";
|
|
5
|
+
import { useControlContext } from "../../hooks/use-control-context.hook";
|
|
8
6
|
import { Typography } from "../atoms";
|
|
9
|
-
import { useControlContext } from "./provider";
|
|
10
7
|
const ControlValue = memo(function ControlValue2(props) {
|
|
11
8
|
const { style, ...rest } = props;
|
|
12
9
|
const { size, variant, disabled, error } = useControlContext();
|
|
@@ -21,12 +18,7 @@ const ControlValue = memo(function ControlValue2(props) {
|
|
|
21
18
|
);
|
|
22
19
|
return /* @__PURE__ */ jsx(Typography.Master, { numberOfLines: 1, ...rest, style: valueStyle });
|
|
23
20
|
});
|
|
24
|
-
function themedStyles(theme, {
|
|
25
|
-
size,
|
|
26
|
-
variant,
|
|
27
|
-
disabled,
|
|
28
|
-
error
|
|
29
|
-
}) {
|
|
21
|
+
function themedStyles(theme, { size, variant, disabled, error }) {
|
|
30
22
|
const controlInputTokens = theme.components.controlInput;
|
|
31
23
|
const sizeTokens = controlInputTokens.sizes[size];
|
|
32
24
|
const appearanceTokens = getFieldStateTokens(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/controls/value.tsx"],"sourcesContent":["import { memo, useMemo } from \"react\";\nimport { StyleSheet } from \"react-native\";\n\nimport {\
|
|
1
|
+
{"version":3,"sources":["../../../src/components/controls/value.tsx"],"sourcesContent":["import { memo, useMemo } from \"react\";\nimport { StyleSheet } from \"react-native\";\n\nimport type { AppTheme } from \"@impulse-ui-native/theme\";\nimport { getFieldStateTokens, useThemedStyles } from \"@impulse-ui-native/theme\";\n\nimport type { ControlValueProps } from \"../../types\";\nimport type { ControlFieldThemeProps } from \"../../types/control-theme.types\";\nimport { useControlContext } from \"../../hooks/use-control-context.hook\";\nimport { Typography } from \"../atoms\";\n\nexport const ControlValue = memo(function ControlValue(\n props: ControlValueProps,\n) {\n const { style, ...rest } = props;\n\n const { size, variant, disabled, error } = useControlContext();\n\n const styles = useThemedStyles(\n themedStyles,\n { size, variant, disabled, error },\n [size, variant, disabled, error],\n );\n\n const valueStyle = useMemo(\n () => [styles.value, style],\n [styles.value, style],\n );\n\n return <Typography.Master numberOfLines={1} {...rest} style={valueStyle} />;\n});\n\nfunction themedStyles(\n theme: AppTheme,\n { size, variant, disabled, error }: ControlFieldThemeProps,\n) {\n const controlInputTokens = theme.components.controlInput;\n const sizeTokens = controlInputTokens.sizes[size];\n const appearanceTokens = getFieldStateTokens(\n controlInputTokens.variants[variant],\n { disabled, error: Boolean(error) },\n );\n\n return StyleSheet.create({\n value: {\n flex: controlInputTokens.flex,\n color: appearanceTokens.color,\n fontFamily: controlInputTokens.fontFamily,\n fontSize: sizeTokens.fontSize,\n paddingHorizontal: controlInputTokens.paddingHorizontal,\n },\n });\n}\n"],"mappings":"AA6BS;AA7BT,SAAS,MAAM,eAAe;AAC9B,SAAS,kBAAkB;AAG3B,SAAS,qBAAqB,uBAAuB;AAIrD,SAAS,yBAAyB;AAClC,SAAS,kBAAkB;AAEpB,MAAM,eAAe,KAAK,SAASA,cACxC,OACA;AACA,QAAM,EAAE,OAAO,GAAG,KAAK,IAAI;AAE3B,QAAM,EAAE,MAAM,SAAS,UAAU,MAAM,IAAI,kBAAkB;AAE7D,QAAM,SAAS;AAAA,IACb;AAAA,IACA,EAAE,MAAM,SAAS,UAAU,MAAM;AAAA,IACjC,CAAC,MAAM,SAAS,UAAU,KAAK;AAAA,EACjC;AAEA,QAAM,aAAa;AAAA,IACjB,MAAM,CAAC,OAAO,OAAO,KAAK;AAAA,IAC1B,CAAC,OAAO,OAAO,KAAK;AAAA,EACtB;AAEA,SAAO,oBAAC,WAAW,QAAX,EAAkB,eAAe,GAAI,GAAG,MAAM,OAAO,YAAY;AAC3E,CAAC;AAED,SAAS,aACP,OACA,EAAE,MAAM,SAAS,UAAU,MAAM,GACjC;AACA,QAAM,qBAAqB,MAAM,WAAW;AAC5C,QAAM,aAAa,mBAAmB,MAAM,IAAI;AAChD,QAAM,mBAAmB;AAAA,IACvB,mBAAmB,SAAS,OAAO;AAAA,IACnC,EAAE,UAAU,OAAO,QAAQ,KAAK,EAAE;AAAA,EACpC;AAEA,SAAO,WAAW,OAAO;AAAA,IACvB,OAAO;AAAA,MACL,MAAM,mBAAmB;AAAA,MACzB,OAAO,iBAAiB;AAAA,MACxB,YAAY,mBAAmB;AAAA,MAC/B,UAAU,WAAW;AAAA,MACrB,mBAAmB,mBAAmB;AAAA,IACxC;AAAA,EACF,CAAC;AACH;","names":["ControlValue"]}
|
|
@@ -10,7 +10,7 @@ export { Pressable } from './atoms/pressable.mjs';
|
|
|
10
10
|
export { Spinner } from './atoms/spinner.mjs';
|
|
11
11
|
export { Tag } from './atoms/tag.mjs';
|
|
12
12
|
export { Control } from './controls/control.mjs';
|
|
13
|
-
export { useControlContext } from '
|
|
13
|
+
export { useControlContext } from '../hooks/use-control-context.hook.mjs';
|
|
14
14
|
import 'react';
|
|
15
15
|
import 'react/jsx-runtime';
|
|
16
16
|
import '../types/avatar.types.mjs';
|
|
@@ -20,8 +20,8 @@ import '../types/view.types.mjs';
|
|
|
20
20
|
import '../types/badge.types.mjs';
|
|
21
21
|
import '../types/control-components.types.mjs';
|
|
22
22
|
import '@impulse-ui-native/icon/types';
|
|
23
|
-
import '../types/spinner.types.mjs';
|
|
24
23
|
import '../types/button.types.mjs';
|
|
24
|
+
import '../types/spinner.types.mjs';
|
|
25
25
|
import '../types/safe-area-view.types.mjs';
|
|
26
26
|
import 'react-native-safe-area-context';
|
|
27
27
|
import '../types/typography.types.mjs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/constants/control-root.constants.ts"],"sourcesContent":["import { StyleSheet } from \"react-native\";\n\nexport const ControlRootStyles = StyleSheet.create({\n container: {\n width: \"100%\",\n },\n});\n"],"mappings":"AAAA,SAAS,kBAAkB;AAEpB,MAAM,oBAAoB,WAAW,OAAO;AAAA,EACjD,WAAW;AAAA,IACT,OAAO;AAAA,EACT;AACF,CAAC;","names":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ControlComponentProps } from '../types/control-components.types.mjs';
|
|
3
|
+
import 'react-native';
|
|
4
|
+
import '@impulse-ui-native/icon/types';
|
|
5
|
+
import '@impulse-ui-native/theme';
|
|
6
|
+
import '../types/button.types.mjs';
|
|
7
|
+
import '../types/spinner.types.mjs';
|
|
8
|
+
|
|
9
|
+
declare const ControlContext: react.Context<ControlComponentProps | undefined>;
|
|
10
|
+
|
|
11
|
+
export { ControlContext };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/contexts/control.context.ts"],"sourcesContent":["import { createContext } from \"react\";\n\nimport type { ControlContextData } from \"../types\";\n\nexport const ControlContext = createContext<ControlContextData | undefined>(\n undefined,\n);\n"],"mappings":"AAAA,SAAS,qBAAqB;AAIvB,MAAM,iBAAiB;AAAA,EAC5B;AACF;","names":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ControlContextData } from '../types/control-components.types.mjs';
|
|
2
|
+
import 'react';
|
|
3
|
+
import 'react-native';
|
|
4
|
+
import '@impulse-ui-native/icon/types';
|
|
5
|
+
import '@impulse-ui-native/theme';
|
|
6
|
+
import '../types/button.types.mjs';
|
|
7
|
+
import '../types/spinner.types.mjs';
|
|
8
|
+
|
|
9
|
+
declare function useControlContext(): ControlContextData;
|
|
10
|
+
|
|
11
|
+
export { useControlContext };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useContext } from "react";
|
|
2
|
+
import { ControlContext } from "../contexts/control.context";
|
|
3
|
+
function useControlContext() {
|
|
4
|
+
const context = useContext(ControlContext);
|
|
5
|
+
if (!context) {
|
|
6
|
+
throw new Error("Control parts must be used within Control.Provider");
|
|
7
|
+
}
|
|
8
|
+
return context;
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
useControlContext
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=use-control-context.hook.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/use-control-context.hook.ts"],"sourcesContent":["import { useContext } from \"react\";\n\nimport type { ControlContextData } from \"../types\";\nimport { ControlContext } from \"../contexts/control.context\";\n\nexport function useControlContext(): ControlContextData {\n const context = useContext(ControlContext);\n\n if (!context) {\n throw new Error(\"Control parts must be used within Control.Provider\");\n }\n\n return context;\n}\n"],"mappings":"AAAA,SAAS,kBAAkB;AAG3B,SAAS,sBAAsB;AAExB,SAAS,oBAAwC;AACtD,QAAM,UAAU,WAAW,cAAc;AAEzC,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,oDAAoD;AAAA,EACtE;AAEA,SAAO;AACT;","names":[]}
|
package/dist/index.d.mts
CHANGED
|
@@ -10,7 +10,7 @@ export { Pressable } from './components/atoms/pressable.mjs';
|
|
|
10
10
|
export { Spinner } from './components/atoms/spinner.mjs';
|
|
11
11
|
export { Tag } from './components/atoms/tag.mjs';
|
|
12
12
|
export { Control } from './components/controls/control.mjs';
|
|
13
|
-
export { useControlContext } from './
|
|
13
|
+
export { useControlContext } from './hooks/use-control-context.hook.mjs';
|
|
14
14
|
export { createPreset } from './hocs/create-preset.hoc.mjs';
|
|
15
15
|
export { EdgeToShorthandKeyMap, EdgeToSpacingKeyMap } from './constants/safe-area-view.constants.mjs';
|
|
16
16
|
export { AvatarImageProps, AvatarProps } from './types/avatar.types.mjs';
|
|
@@ -4,8 +4,8 @@ import { ComponentSize, BadgeTone, DisplayVariant } from '@impulse-ui-native/the
|
|
|
4
4
|
import { ControlComponentCommonProps } from './control-components.types.mjs';
|
|
5
5
|
import { ViewProps } from './view.types.mjs';
|
|
6
6
|
import '@impulse-ui-native/icon/types';
|
|
7
|
-
import './spinner.types.mjs';
|
|
8
7
|
import './button.types.mjs';
|
|
8
|
+
import './spinner.types.mjs';
|
|
9
9
|
|
|
10
10
|
interface BadgeProps extends Omit<ViewProps, "children">, Pick<ControlComponentCommonProps, "PrefixIcon" | "Prefix" | "onPressPrefix" | "SuffixIcon" | "Suffix" | "onPressSuffix"> {
|
|
11
11
|
children: ReactNode;
|
|
@@ -2,8 +2,8 @@ import { ComponentType } from 'react';
|
|
|
2
2
|
import { ViewProps, TextProps, TextInputProps } from 'react-native';
|
|
3
3
|
import { IconProps } from '@impulse-ui-native/icon/types';
|
|
4
4
|
import { ComponentSize, FieldVariant } from '@impulse-ui-native/theme';
|
|
5
|
-
import { SpinnerProps } from './spinner.types.mjs';
|
|
6
5
|
import { PressableCoreProps } from './button.types.mjs';
|
|
6
|
+
import { SpinnerProps } from './spinner.types.mjs';
|
|
7
7
|
|
|
8
8
|
interface ControlComponentCommonProps {
|
|
9
9
|
placeholder?: string;
|
|
@@ -21,26 +21,18 @@ interface ControlComponentProps {
|
|
|
21
21
|
error: string | undefined;
|
|
22
22
|
disabled: boolean | undefined;
|
|
23
23
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
interface ControlLabelProps extends TextProps {
|
|
29
|
-
}
|
|
30
|
-
interface ControlErrorLabelProps extends TextProps {
|
|
31
|
-
}
|
|
24
|
+
type ControlContextData = ControlComponentProps;
|
|
25
|
+
type ControlContainerProps = ViewProps;
|
|
26
|
+
type ControlLabelProps = TextProps;
|
|
27
|
+
type ControlErrorLabelProps = TextProps;
|
|
32
28
|
interface ControlAddonProps extends ViewProps {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
interface ControlValueProps extends TextProps {
|
|
42
|
-
}
|
|
43
|
-
interface ControlLoaderProps extends SpinnerProps {
|
|
44
|
-
}
|
|
29
|
+
disabled?: boolean;
|
|
30
|
+
hitSlop?: PressableCoreProps["hitSlop"];
|
|
31
|
+
onPress?: PressableCoreProps["onPress"];
|
|
32
|
+
}
|
|
33
|
+
type ControlInputProps = TextInputProps;
|
|
34
|
+
type ControlPlaceholderProps = TextProps;
|
|
35
|
+
type ControlValueProps = TextProps;
|
|
36
|
+
type ControlLoaderProps = SpinnerProps;
|
|
45
37
|
|
|
46
38
|
export type { ControlAddonProps, ControlComponentCommonProps, ControlComponentProps, ControlContainerProps, ControlContextData, ControlErrorLabelProps, ControlInputProps, ControlLabelProps, ControlLoaderProps, ControlPlaceholderProps, ControlValueProps };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ComponentSize, FieldVariant } from '@impulse-ui-native/theme';
|
|
2
|
+
|
|
3
|
+
interface ControlStateThemeProps {
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
error?: string;
|
|
6
|
+
}
|
|
7
|
+
interface ControlFieldThemeProps extends ControlStateThemeProps {
|
|
8
|
+
size: ComponentSize;
|
|
9
|
+
variant: FieldVariant;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type { ControlFieldThemeProps, ControlStateThemeProps };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=control-theme.types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@impulse-ui-native/primitives",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.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/icon": "
|
|
32
|
-
"@impulse-ui-native/theme": "
|
|
33
|
-
"@impulse-ui-native/core": "
|
|
31
|
+
"@impulse-ui-native/icon": "8.0.0",
|
|
32
|
+
"@impulse-ui-native/theme": "8.0.0",
|
|
33
|
+
"@impulse-ui-native/core": "8.0.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/eslint-config": "1.0.0",
|
|
45
44
|
"@impulse-ui-native/prettier-config": "1.0.0",
|
|
45
|
+
"@impulse-ui-native/eslint-config": "1.0.0",
|
|
46
46
|
"@impulse-ui-native/tsconfig": "1.0.0"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|