@impulse-ui-native/primitives 11.0.1 → 11.2.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 +20 -1
- package/dist/components/controls/control.d.mts +1 -1
- package/dist/components/controls/field.d.mts +1 -1
- package/dist/components/controls/field.js +5 -2
- package/dist/components/controls/field.js.map +1 -1
- package/dist/components/controls/root.js +2 -8
- package/dist/components/controls/root.js.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/types/button.types.d.mts +2 -2
- package/dist/types/control-components.types.d.mts +5 -4
- package/dist/types/index.d.mts +1 -1
- package/package.json +4 -4
- package/dist/constants/control-root.constants.d.mts +0 -7
- package/dist/constants/control-root.constants.js +0 -10
- package/dist/constants/control-root.constants.js.map +0 -1
package/README.md
CHANGED
|
@@ -113,7 +113,6 @@ default icons or manage selection state.
|
|
|
113
113
|
</Control.Field>
|
|
114
114
|
```
|
|
115
115
|
|
|
116
|
-
|
|
117
116
|
`Control.Addon` and `Control.Error` render supplied children. Addons own spacing
|
|
118
117
|
and optional press behavior, including group/local disabling; the parent chooses
|
|
119
118
|
and renders icons or custom content. Error owns error-label styling; the parent
|
|
@@ -157,3 +156,23 @@ Card, List, Progress, and their prop types are exported from `@impulse-ui-native
|
|
|
157
156
|
`theme.shadows` scale, including Android elevation. Explicit shadow style props
|
|
158
157
|
and style overrides still take precedence. Configure `theme.codeFontFamily`
|
|
159
158
|
to change `Typography.Code` globally; its default remains `monospace`.
|
|
159
|
+
|
|
160
|
+
## Field layout
|
|
161
|
+
|
|
162
|
+
`Control.Root` uses normal parent stretching rather than a forced width.
|
|
163
|
+
`Control.Field` accepts flex, dimension, and spacing props on its outer root.
|
|
164
|
+
In a column, fields stretch horizontally by default without growing vertically.
|
|
165
|
+
In a row, set `flex={1}` on each field to share the available width. If the
|
|
166
|
+
parent centers its children, use `alignSelf="stretch"` or an explicit `width`.
|
|
167
|
+
|
|
168
|
+
## Pressable layout
|
|
169
|
+
|
|
170
|
+
`Pressable` accepts flex and positioning props directly, alongside its existing
|
|
171
|
+
spacing, dimension, and shadow props. Native `style` objects or callbacks override
|
|
172
|
+
direct style props; `pressedStyle` applies last while pressed.
|
|
173
|
+
|
|
174
|
+
```tsx
|
|
175
|
+
<Pressable flex={1} flexDirection="row" alignItems="center" gap={8} padding={16}>
|
|
176
|
+
<Typography.Master>Continue</Typography.Master>
|
|
177
|
+
</Pressable>
|
|
178
|
+
```
|
|
@@ -8,7 +8,7 @@ import '../../types/button.types.mjs';
|
|
|
8
8
|
import '../../types/spinner.types.mjs';
|
|
9
9
|
|
|
10
10
|
declare const Control: {
|
|
11
|
-
Field: react.MemoExoticComponent<({ children, disabled, error, label, onPress, onPressPrefix, onPressSuffix, prefix, size, suffix, variant, }: ControlFieldProps) => react.JSX.Element>;
|
|
11
|
+
Field: react.MemoExoticComponent<({ children, disabled, error, label, onPress, onPressPrefix, onPressSuffix, prefix, size, suffix, variant, ...props }: ControlFieldProps) => react.JSX.Element>;
|
|
12
12
|
Trigger: react.MemoExoticComponent<({ disabled: disabledProp, style, ...props }: ControlTriggerProps) => react.JSX.Element>;
|
|
13
13
|
Icon: react.MemoExoticComponent<({ color, ...props }: ControlIconProps) => react.JSX.Element>;
|
|
14
14
|
Container: react.MemoExoticComponent<({ style, ...props }: ControlContainerProps) => react.JSX.Element>;
|
|
@@ -6,6 +6,6 @@ import '@impulse-ui-native/theme';
|
|
|
6
6
|
import '../../types/button.types.mjs';
|
|
7
7
|
import '../../types/spinner.types.mjs';
|
|
8
8
|
|
|
9
|
-
declare const ControlField: react.MemoExoticComponent<({ children, disabled, error, label, onPress, onPressPrefix, onPressSuffix, prefix, size, suffix, variant, }: ControlFieldProps) => react.JSX.Element>;
|
|
9
|
+
declare const ControlField: react.MemoExoticComponent<({ children, disabled, error, label, onPress, onPressPrefix, onPressSuffix, prefix, size, suffix, variant, ...props }: ControlFieldProps) => react.JSX.Element>;
|
|
10
10
|
|
|
11
11
|
export { ControlField };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { memo } from "react";
|
|
3
|
+
import { useStyleProps } from "@impulse-ui-native/theme";
|
|
3
4
|
import { ControlAddon } from "./addon";
|
|
4
5
|
import { ControlError } from "./error";
|
|
5
6
|
import { ControlLabel } from "./label";
|
|
@@ -17,8 +18,10 @@ const ControlField = memo(function ControlField2({
|
|
|
17
18
|
prefix,
|
|
18
19
|
size = "medium",
|
|
19
20
|
suffix,
|
|
20
|
-
variant = "outlined"
|
|
21
|
+
variant = "outlined",
|
|
22
|
+
...props
|
|
21
23
|
}) {
|
|
24
|
+
const layoutStyle = useStyleProps(props);
|
|
22
25
|
const hasPrefix = prefix !== null && prefix !== void 0;
|
|
23
26
|
const hasSuffix = suffix !== null && suffix !== void 0;
|
|
24
27
|
return /* @__PURE__ */ jsx(
|
|
@@ -28,7 +31,7 @@ const ControlField = memo(function ControlField2({
|
|
|
28
31
|
variant,
|
|
29
32
|
error,
|
|
30
33
|
disabled,
|
|
31
|
-
children: /* @__PURE__ */ jsxs(ControlRoot, { children: [
|
|
34
|
+
children: /* @__PURE__ */ jsxs(ControlRoot, { style: layoutStyle, children: [
|
|
32
35
|
/* @__PURE__ */ jsx(ControlLabel, { children: label }),
|
|
33
36
|
/* @__PURE__ */ jsxs(ControlTrigger, { onPress, children: [
|
|
34
37
|
hasPrefix ? /* @__PURE__ */ jsx(ControlAddon, { onPress: onPressPrefix, children: prefix }) : null,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/controls/field.tsx"],"sourcesContent":["import { memo } from \"react\";\n\nimport type { ControlFieldProps } from \"../../types\";\nimport { ControlAddon } from \"./addon\";\nimport { ControlError } from \"./error\";\nimport { ControlLabel } from \"./label\";\nimport { ControlProvider } from \"./provider\";\nimport { ControlRoot } from \"./root\";\nimport { ControlTrigger } from \"./trigger\";\n\nexport const ControlField = memo(function ControlField({\n children,\n disabled,\n error,\n label,\n onPress,\n onPressPrefix,\n onPressSuffix,\n prefix,\n size = \"medium\",\n suffix,\n variant = \"outlined\",\n}: ControlFieldProps) {\n const hasPrefix = prefix !== null && prefix !== undefined;\n const hasSuffix = suffix !== null && suffix !== undefined;\n\n return (\n <ControlProvider\n size={size}\n variant={variant}\n error={error}\n disabled={disabled}\n >\n <ControlRoot>\n <ControlLabel>{label}</ControlLabel>\n <ControlTrigger onPress={onPress}>\n {hasPrefix ? (\n <ControlAddon onPress={onPressPrefix}>{prefix}</ControlAddon>\n ) : null}\n {children}\n {hasSuffix ? (\n <ControlAddon onPress={onPressSuffix}>{suffix}</ControlAddon>\n ) : null}\n </ControlTrigger>\n {error ? <ControlError>{error}</ControlError> : null}\n </ControlRoot>\n </ControlProvider>\n );\n});\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/components/controls/field.tsx"],"sourcesContent":["import { memo } from \"react\";\n\nimport { useStyleProps } from \"@impulse-ui-native/theme\";\n\nimport type { ControlFieldProps } from \"../../types\";\nimport { ControlAddon } from \"./addon\";\nimport { ControlError } from \"./error\";\nimport { ControlLabel } from \"./label\";\nimport { ControlProvider } from \"./provider\";\nimport { ControlRoot } from \"./root\";\nimport { ControlTrigger } from \"./trigger\";\n\nexport const ControlField = memo(function ControlField({\n children,\n disabled,\n error,\n label,\n onPress,\n onPressPrefix,\n onPressSuffix,\n prefix,\n size = \"medium\",\n suffix,\n variant = \"outlined\",\n ...props\n}: ControlFieldProps) {\n const layoutStyle = useStyleProps(props);\n\n const hasPrefix = prefix !== null && prefix !== undefined;\n const hasSuffix = suffix !== null && suffix !== undefined;\n\n return (\n <ControlProvider\n size={size}\n variant={variant}\n error={error}\n disabled={disabled}\n >\n <ControlRoot style={layoutStyle}>\n <ControlLabel>{label}</ControlLabel>\n <ControlTrigger onPress={onPress}>\n {hasPrefix ? (\n <ControlAddon onPress={onPressPrefix}>{prefix}</ControlAddon>\n ) : null}\n {children}\n {hasSuffix ? (\n <ControlAddon onPress={onPressSuffix}>{suffix}</ControlAddon>\n ) : null}\n </ControlTrigger>\n {error ? <ControlError>{error}</ControlError> : null}\n </ControlRoot>\n </ControlProvider>\n );\n});\n"],"mappings":"AAuCQ,cACA,YADA;AAvCR,SAAS,YAAY;AAErB,SAAS,qBAAqB;AAG9B,SAAS,oBAAoB;AAC7B,SAAS,oBAAoB;AAC7B,SAAS,oBAAoB;AAC7B,SAAS,uBAAuB;AAChC,SAAS,mBAAmB;AAC5B,SAAS,sBAAsB;AAExB,MAAM,eAAe,KAAK,SAASA,cAAa;AAAA,EACrD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP;AAAA,EACA,UAAU;AAAA,EACV,GAAG;AACL,GAAsB;AACpB,QAAM,cAAc,cAAc,KAAK;AAEvC,QAAM,YAAY,WAAW,QAAQ,WAAW;AAChD,QAAM,YAAY,WAAW,QAAQ,WAAW;AAEhD,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MAEA,+BAAC,eAAY,OAAO,aAClB;AAAA,4BAAC,gBAAc,iBAAM;AAAA,QACrB,qBAAC,kBAAe,SACb;AAAA,sBACC,oBAAC,gBAAa,SAAS,eAAgB,kBAAO,IAC5C;AAAA,UACH;AAAA,UACA,YACC,oBAAC,gBAAa,SAAS,eAAgB,kBAAO,IAC5C;AAAA,WACN;AAAA,QACC,QAAQ,oBAAC,gBAAc,iBAAM,IAAkB;AAAA,SAClD;AAAA;AAAA,EACF;AAEJ,CAAC;","names":["ControlField"]}
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { memo
|
|
3
|
-
import { ControlRootStyles } from "../../constants/control-root.constants";
|
|
2
|
+
import { memo } from "react";
|
|
4
3
|
import { View } from "../atoms";
|
|
5
4
|
const ControlRoot = memo(function ControlRoot2(props) {
|
|
6
|
-
|
|
7
|
-
const containerStyle = useMemo(
|
|
8
|
-
() => [ControlRootStyles.container, style],
|
|
9
|
-
[style]
|
|
10
|
-
);
|
|
11
|
-
return /* @__PURE__ */ jsx(View, { ...rest, style: containerStyle });
|
|
5
|
+
return /* @__PURE__ */ jsx(View, { ...props });
|
|
12
6
|
});
|
|
13
7
|
export {
|
|
14
8
|
ControlRoot
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/controls/root.tsx"],"sourcesContent":["import { memo
|
|
1
|
+
{"version":3,"sources":["../../../src/components/controls/root.tsx"],"sourcesContent":["import { memo } from \"react\";\n\nimport type { ViewProps } from \"../../types\";\nimport { View } from \"../atoms\";\n\nexport const ControlRoot = memo(function ControlRoot(props: ViewProps) {\n return <View {...props} />;\n});\n"],"mappings":"AAMS;AANT,SAAS,YAAY;AAGrB,SAAS,YAAY;AAEd,MAAM,cAAc,KAAK,SAASA,aAAY,OAAkB;AACrE,SAAO,oBAAC,QAAM,GAAG,OAAO;AAC1B,CAAC;","names":["ControlRoot"]}
|
package/dist/index.d.mts
CHANGED
|
@@ -23,7 +23,7 @@ export { DividerInset, DividerOrientation, DividerProps } from './types/divider.
|
|
|
23
23
|
export { IconButtonProps, IconButtonThemeProps } from './types/icon-button.types.mjs';
|
|
24
24
|
export { SpinnerProps } from './types/spinner.types.mjs';
|
|
25
25
|
export { TagProps, TagThemeProps } from './types/tag.types.mjs';
|
|
26
|
-
export { ControlAddonProps, ControlComponentCommonProps, ControlComponentProps, ControlContainerProps, ControlContextData, ControlErrorLabelProps, ControlFieldProps, ControlIconProps, ControlInputProps, ControlLabelProps, ControlLoaderProps, ControlPlaceholderProps, ControlTriggerProps, ControlValueProps } from './types/control-components.types.mjs';
|
|
26
|
+
export { ControlAddonProps, ControlComponentCommonProps, ControlComponentProps, ControlContainerProps, ControlContextData, ControlErrorLabelProps, ControlFieldProps, ControlIconProps, ControlInputProps, ControlLabelProps, ControlLayoutProps, ControlLoaderProps, ControlPlaceholderProps, ControlTriggerProps, ControlValueProps } from './types/control-components.types.mjs';
|
|
27
27
|
import 'react';
|
|
28
28
|
import 'react-native';
|
|
29
29
|
import '@impulse-ui-native/theme';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PressableProps, ViewStyle, StyleProp } from 'react-native';
|
|
2
|
-
import { DimensionProps, SpacingProps, ShadowProps, ComponentSize, ActionVariant } from '@impulse-ui-native/theme';
|
|
2
|
+
import { DimensionProps, SpacingProps, ShadowProps, ComponentSize, ActionVariant, FlexProps } from '@impulse-ui-native/theme';
|
|
3
3
|
|
|
4
4
|
interface ButtonProps extends PressableProps, DimensionProps, SpacingProps, ShadowProps {
|
|
5
5
|
size?: ComponentSize;
|
|
@@ -14,7 +14,7 @@ interface ButtonThemeProps {
|
|
|
14
14
|
disabled?: boolean;
|
|
15
15
|
loading: boolean;
|
|
16
16
|
}
|
|
17
|
-
interface PressableCoreProps extends PressableProps, Omit<ButtonProps, "style"
|
|
17
|
+
interface PressableCoreProps extends PressableProps, Omit<ButtonProps, "style">, FlexProps {
|
|
18
18
|
disabled?: boolean;
|
|
19
19
|
pressedStyle?: StyleProp<ViewStyle>;
|
|
20
20
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { ComponentType, ReactNode } from 'react';
|
|
2
2
|
import { ViewProps, TextProps, TextInputProps } from 'react-native';
|
|
3
3
|
import { IconProps } from '@impulse-ui-native/icon/types';
|
|
4
|
-
import { ComponentSize, FieldVariant } from '@impulse-ui-native/theme';
|
|
4
|
+
import { FlexProps, DimensionProps, SpacingProps, ComponentSize, FieldVariant } from '@impulse-ui-native/theme';
|
|
5
5
|
import { PressableCoreProps } from './button.types.mjs';
|
|
6
6
|
import { SpinnerProps } from './spinner.types.mjs';
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
type ControlLayoutProps = FlexProps & DimensionProps & SpacingProps;
|
|
9
|
+
interface ControlComponentCommonProps extends ControlLayoutProps {
|
|
9
10
|
placeholder?: string;
|
|
10
11
|
label?: string;
|
|
11
12
|
PrefixIcon?: IconProps["icon"];
|
|
@@ -25,7 +26,7 @@ type ControlContextData = ControlComponentProps;
|
|
|
25
26
|
type ControlContainerProps = ViewProps;
|
|
26
27
|
type ControlTriggerProps = PressableCoreProps;
|
|
27
28
|
type ControlIconProps = IconProps;
|
|
28
|
-
interface ControlFieldProps extends Partial<ControlComponentProps
|
|
29
|
+
interface ControlFieldProps extends Partial<ControlComponentProps>, ControlLayoutProps {
|
|
29
30
|
children?: ReactNode;
|
|
30
31
|
label?: string;
|
|
31
32
|
onPress?: PressableCoreProps["onPress"];
|
|
@@ -46,4 +47,4 @@ type ControlPlaceholderProps = TextProps;
|
|
|
46
47
|
type ControlValueProps = TextProps;
|
|
47
48
|
type ControlLoaderProps = SpinnerProps;
|
|
48
49
|
|
|
49
|
-
export type { ControlAddonProps, ControlComponentCommonProps, ControlComponentProps, ControlContainerProps, ControlContextData, ControlErrorLabelProps, ControlFieldProps, ControlIconProps, ControlInputProps, ControlLabelProps, ControlLoaderProps, ControlPlaceholderProps, ControlTriggerProps, ControlValueProps };
|
|
50
|
+
export type { ControlAddonProps, ControlComponentCommonProps, ControlComponentProps, ControlContainerProps, ControlContextData, ControlErrorLabelProps, ControlFieldProps, ControlIconProps, ControlInputProps, ControlLabelProps, ControlLayoutProps, ControlLoaderProps, ControlPlaceholderProps, ControlTriggerProps, ControlValueProps };
|
package/dist/types/index.d.mts
CHANGED
|
@@ -8,7 +8,7 @@ export { DividerInset, DividerOrientation, DividerProps } from './divider.types.
|
|
|
8
8
|
export { IconButtonProps, IconButtonThemeProps } from './icon-button.types.mjs';
|
|
9
9
|
export { SpinnerProps } from './spinner.types.mjs';
|
|
10
10
|
export { TagProps, TagThemeProps } from './tag.types.mjs';
|
|
11
|
-
export { ControlAddonProps, ControlComponentCommonProps, ControlComponentProps, ControlContainerProps, ControlContextData, ControlErrorLabelProps, ControlFieldProps, ControlIconProps, ControlInputProps, ControlLabelProps, ControlLoaderProps, ControlPlaceholderProps, ControlTriggerProps, ControlValueProps } from './control-components.types.mjs';
|
|
11
|
+
export { ControlAddonProps, ControlComponentCommonProps, ControlComponentProps, ControlContainerProps, ControlContextData, ControlErrorLabelProps, ControlFieldProps, ControlIconProps, ControlInputProps, ControlLabelProps, ControlLayoutProps, ControlLoaderProps, ControlPlaceholderProps, ControlTriggerProps, ControlValueProps } from './control-components.types.mjs';
|
|
12
12
|
import 'react';
|
|
13
13
|
import 'react-native';
|
|
14
14
|
import '@impulse-ui-native/theme';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@impulse-ui-native/primitives",
|
|
3
|
-
"version": "11.0
|
|
3
|
+
"version": "11.2.0",
|
|
4
4
|
"description": "Foundational UI primitives for building ImpulseUI Native components.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
],
|
|
29
29
|
"sideEffects": false,
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@impulse-ui-native/theme": "11.0
|
|
32
|
-
"@impulse-ui-native/icon": "11.0
|
|
33
|
-
"@impulse-ui-native/core": "11.0
|
|
31
|
+
"@impulse-ui-native/theme": "11.2.0",
|
|
32
|
+
"@impulse-ui-native/icon": "11.2.0",
|
|
33
|
+
"@impulse-ui-native/core": "11.2.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@impulse-ui-native/eslint-config": "1.0.0",
|
|
@@ -1 +0,0 @@
|
|
|
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":[]}
|