@impulse-ui-native/primitives 2.1.0 → 2.1.2
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/dist/components/atoms/button.d.mts +10 -0
- package/dist/components/atoms/button.js +60 -0
- package/dist/components/atoms/button.js.map +1 -0
- package/dist/components/atoms/icon-button.d.mts +12 -0
- package/dist/components/atoms/icon-button.js +51 -0
- package/dist/components/atoms/icon-button.js.map +1 -0
- package/dist/components/atoms/index.d.mts +18 -0
- package/dist/components/atoms/index.js +17 -0
- package/dist/components/atoms/index.js.map +1 -0
- package/dist/components/atoms/pressable.d.mts +9 -0
- package/dist/components/atoms/pressable.js +52 -0
- package/dist/components/atoms/pressable.js.map +1 -0
- package/dist/components/atoms/safe-area-view.d.mts +8 -0
- package/dist/components/atoms/safe-area-view.js +103 -0
- package/dist/components/atoms/safe-area-view.js.map +1 -0
- package/dist/components/atoms/tag.d.mts +9 -0
- package/dist/components/atoms/tag.js +82 -0
- package/dist/components/atoms/tag.js.map +1 -0
- package/dist/components/atoms/typography.d.mts +99 -0
- package/dist/components/atoms/typography.js +184 -0
- package/dist/components/atoms/typography.js.map +1 -0
- package/dist/components/atoms/view.d.mts +8 -0
- package/dist/components/atoms/view.js +27 -0
- package/dist/components/atoms/view.js.map +1 -0
- package/dist/components/controls/addon.d.mts +11 -0
- package/dist/components/controls/addon.js +72 -0
- package/dist/components/controls/addon.js.map +1 -0
- package/dist/components/controls/container.d.mts +11 -0
- package/dist/components/controls/container.js +54 -0
- package/dist/components/controls/container.js.map +1 -0
- package/dist/components/controls/control.d.mts +23 -0
- package/dist/components/controls/control.js +26 -0
- package/dist/components/controls/control.js.map +1 -0
- package/dist/components/controls/error.d.mts +11 -0
- package/dist/components/controls/error.js +33 -0
- package/dist/components/controls/error.js.map +1 -0
- package/dist/components/controls/index.d.mts +10 -0
- package/dist/components/controls/index.js +7 -0
- package/dist/components/controls/index.js.map +1 -0
- package/dist/components/controls/input.d.mts +11 -0
- package/dist/components/controls/input.js +63 -0
- package/dist/components/controls/input.js.map +1 -0
- package/dist/components/controls/label.d.mts +11 -0
- package/dist/components/controls/label.js +42 -0
- package/dist/components/controls/label.js.map +1 -0
- package/dist/components/controls/loader.d.mts +6 -0
- package/dist/components/controls/loader.js +10 -0
- package/dist/components/controls/loader.js.map +1 -0
- package/dist/components/controls/placeholder.d.mts +11 -0
- package/dist/components/controls/placeholder.js +51 -0
- package/dist/components/controls/placeholder.js.map +1 -0
- package/dist/components/controls/provider.d.mts +13 -0
- package/dist/components/controls/provider.js +19 -0
- package/dist/components/controls/provider.js.map +1 -0
- package/dist/components/controls/root.d.mts +9 -0
- package/dist/components/controls/root.js +18 -0
- package/dist/components/controls/root.js.map +1 -0
- package/dist/components/controls/value.d.mts +11 -0
- package/dist/components/controls/value.js +36 -0
- package/dist/components/controls/value.js.map +1 -0
- package/dist/components/index.d.mts +22 -0
- package/dist/components/index.js +3 -0
- package/dist/components/index.js.map +1 -0
- package/dist/constants/control-container.constants.d.mts +6 -0
- package/dist/constants/control-container.constants.js +15 -0
- package/dist/constants/control-container.constants.js.map +1 -0
- package/dist/constants/index.d.mts +3 -0
- package/dist/constants/index.js +3 -0
- package/dist/constants/index.js.map +1 -0
- package/dist/constants/safe-area-view.constants.d.mts +14 -0
- package/dist/constants/safe-area-view.constants.js +17 -0
- package/dist/constants/safe-area-view.constants.js.map +1 -0
- package/dist/hocs/create-preset.hoc.d.mts +12 -0
- package/dist/hocs/create-preset.hoc.js +38 -0
- package/dist/hocs/create-preset.hoc.js.map +1 -0
- package/dist/hocs/index.d.mts +6 -0
- package/dist/hocs/index.js +5 -0
- package/dist/hocs/index.js.map +1 -0
- package/dist/index.d.mts +25 -241
- package/dist/index.js +4 -998
- package/dist/index.js.map +1 -1
- package/dist/types/button.types.d.mts +21 -0
- package/dist/types/button.types.js +1 -0
- package/dist/types/button.types.js.map +1 -0
- package/dist/types/control-components.types.d.mts +45 -0
- package/dist/types/control-components.types.js +1 -0
- package/dist/types/control-components.types.js.map +1 -0
- package/dist/types/icon-button.types.d.mts +15 -0
- package/dist/types/icon-button.types.js +1 -0
- package/dist/types/icon-button.types.js.map +1 -0
- package/dist/types/index.d.mts +12 -0
- package/dist/types/index.js +9 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/safe-area-view.types.d.mts +5 -0
- package/dist/types/safe-area-view.types.js +1 -0
- package/dist/types/safe-area-view.types.js.map +1 -0
- package/dist/types/tag.types.d.mts +22 -0
- package/dist/types/tag.types.js +1 -0
- package/dist/types/tag.types.js.map +1 -0
- package/dist/types/typography.types.d.mts +8 -0
- package/dist/types/typography.types.js +1 -0
- package/dist/types/typography.types.js.map +1 -0
- package/dist/types/view.types.d.mts +6 -0
- package/dist/types/view.types.js +1 -0
- package/dist/types/view.types.js.map +1 -0
- package/dist/utils/controls.utils.d.mts +13 -0
- package/dist/utils/controls.utils.js +18 -0
- package/dist/utils/controls.utils.js.map +1 -0
- package/dist/utils/index.d.mts +2 -0
- package/dist/utils/index.js +2 -0
- package/dist/utils/index.js.map +1 -0
- package/package.json +7 -6
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo, useMemo } from "react";
|
|
3
|
+
import { StyleSheet } from "react-native";
|
|
4
|
+
import { useThemedStyles } from "@impulse-ui-native/theme";
|
|
5
|
+
import { Typography } from "../atoms";
|
|
6
|
+
import { useControlContext } from "./provider";
|
|
7
|
+
const ControlLabel = memo(function ControlLabel2(props) {
|
|
8
|
+
const { children, disabled, style, ...rest } = props;
|
|
9
|
+
const { error } = useControlContext();
|
|
10
|
+
const styles = useThemedStyles(
|
|
11
|
+
themedStyles,
|
|
12
|
+
{
|
|
13
|
+
disabled,
|
|
14
|
+
error
|
|
15
|
+
},
|
|
16
|
+
[disabled, error]
|
|
17
|
+
);
|
|
18
|
+
const labelStyle = useMemo(
|
|
19
|
+
() => [styles.label, style],
|
|
20
|
+
[styles.label, style]
|
|
21
|
+
);
|
|
22
|
+
if (!children) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
return /* @__PURE__ */ jsx(Typography.Label, { ...rest, style: labelStyle, children });
|
|
26
|
+
});
|
|
27
|
+
function themedStyles(theme, props) {
|
|
28
|
+
const { disabled, error } = props;
|
|
29
|
+
const controlLabelTokens = theme.components.controlLabel;
|
|
30
|
+
const color = disabled ? controlLabelTokens.disabledColor : error ? controlLabelTokens.errorColor : controlLabelTokens.color;
|
|
31
|
+
return StyleSheet.create({
|
|
32
|
+
label: {
|
|
33
|
+
marginBottom: controlLabelTokens.marginBottom,
|
|
34
|
+
fontSize: controlLabelTokens.fontSize,
|
|
35
|
+
color
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
export {
|
|
40
|
+
ControlLabel
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=label.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/controls/label.tsx"],"sourcesContent":["import { memo, useMemo } from \"react\";\nimport { StyleSheet } from \"react-native\";\n\nimport { AppTheme, useThemedStyles } from \"@impulse-ui-native/theme\";\n\nimport { ControlLabelProps } from \"../../types\";\nimport { Typography } from \"../atoms\";\nimport { useControlContext } from \"./provider\";\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(\n theme: AppTheme,\n props: {\n disabled?: boolean;\n error?: string;\n },\n) {\n const { disabled, error } = props;\n\n const controlLabelTokens = theme.components.controlLabel;\n\n const color = disabled\n ? controlLabelTokens.disabledColor\n : error\n ? controlLabelTokens.errorColor\n : controlLabelTokens.color;\n\n return StyleSheet.create({\n label: {\n marginBottom: controlLabelTokens.marginBottom,\n fontSize: controlLabelTokens.fontSize,\n color,\n },\n });\n}\n"],"mappings":"AAmCI;AAnCJ,SAAS,MAAM,eAAe;AAC9B,SAAS,kBAAkB;AAE3B,SAAmB,uBAAuB;AAG1C,SAAS,kBAAkB;AAC3B,SAAS,yBAAyB;AAE3B,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,aACP,OACA,OAIA;AACA,QAAM,EAAE,UAAU,MAAM,IAAI;AAE5B,QAAM,qBAAqB,MAAM,WAAW;AAE5C,QAAM,QAAQ,WACV,mBAAmB,gBACnB,QACE,mBAAmB,aACnB,mBAAmB;AAEzB,SAAO,WAAW,OAAO;AAAA,IACvB,OAAO;AAAA,MACL,cAAc,mBAAmB;AAAA,MACjC,UAAU,mBAAmB;AAAA,MAC7B;AAAA,IACF;AAAA,EACF,CAAC;AACH;","names":["ControlLabel"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo } from "react";
|
|
3
|
+
import { ActivityIndicator } from "react-native";
|
|
4
|
+
const ControlLoader = memo(function ControlLoader2() {
|
|
5
|
+
return /* @__PURE__ */ jsx(ActivityIndicator, {});
|
|
6
|
+
});
|
|
7
|
+
export {
|
|
8
|
+
ControlLoader
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/controls/loader.tsx"],"sourcesContent":["import { memo } from \"react\";\nimport { ActivityIndicator } from \"react-native\";\n\nexport const ControlLoader = memo(function ControlLoader() {\n return <ActivityIndicator />;\n});\n"],"mappings":"AAIS;AAJT,SAAS,YAAY;AACrB,SAAS,yBAAyB;AAE3B,MAAM,gBAAgB,KAAK,SAASA,iBAAgB;AACzD,SAAO,oBAAC,qBAAkB;AAC5B,CAAC;","names":["ControlLoader"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
+
import { ControlPlaceholderProps } from '../../types/control-components.types.mjs';
|
|
4
|
+
import 'react-native';
|
|
5
|
+
import '@impulse-ui-native/icon/types';
|
|
6
|
+
import '@impulse-ui-native/theme';
|
|
7
|
+
import '../../types/button.types.mjs';
|
|
8
|
+
|
|
9
|
+
declare const ControlPlaceholder: react.MemoExoticComponent<(props: ControlPlaceholderProps) => react_jsx_runtime.JSX.Element>;
|
|
10
|
+
|
|
11
|
+
export { ControlPlaceholder };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo, useMemo } from "react";
|
|
3
|
+
import { StyleSheet } from "react-native";
|
|
4
|
+
import {
|
|
5
|
+
useThemedStyles
|
|
6
|
+
} from "@impulse-ui-native/theme";
|
|
7
|
+
import { Typography } from "../atoms";
|
|
8
|
+
import { useControlContext } from "./provider";
|
|
9
|
+
const ControlPlaceholder = memo(function ControlPlaceholder2(props) {
|
|
10
|
+
const { style, ...rest } = props;
|
|
11
|
+
const { size, variant, disabled, error } = useControlContext();
|
|
12
|
+
const styles = useThemedStyles(
|
|
13
|
+
themedStyles,
|
|
14
|
+
{
|
|
15
|
+
size,
|
|
16
|
+
variant,
|
|
17
|
+
disabled,
|
|
18
|
+
error
|
|
19
|
+
},
|
|
20
|
+
[size, variant, disabled, error]
|
|
21
|
+
);
|
|
22
|
+
const placeholderStyle = useMemo(
|
|
23
|
+
() => [styles.placeholder, style],
|
|
24
|
+
[styles.placeholder, style]
|
|
25
|
+
);
|
|
26
|
+
return /* @__PURE__ */ jsx(Typography.Master, { numberOfLines: 1, ...rest, style: placeholderStyle });
|
|
27
|
+
});
|
|
28
|
+
function themedStyles(theme, {
|
|
29
|
+
size,
|
|
30
|
+
variant,
|
|
31
|
+
disabled,
|
|
32
|
+
error
|
|
33
|
+
}) {
|
|
34
|
+
const controlInputTokens = theme.components.controlInput;
|
|
35
|
+
const sizeTokens = controlInputTokens.sizes[size];
|
|
36
|
+
const variantTokens = controlInputTokens.variants[variant];
|
|
37
|
+
const color = disabled ? variantTokens.disabledPlaceholderColor : error ? variantTokens.errorPlaceholderColor : variantTokens.placeholderColor;
|
|
38
|
+
return StyleSheet.create({
|
|
39
|
+
placeholder: {
|
|
40
|
+
flex: controlInputTokens.flex,
|
|
41
|
+
color,
|
|
42
|
+
fontFamily: controlInputTokens.fontFamily,
|
|
43
|
+
fontSize: sizeTokens.fontSize,
|
|
44
|
+
paddingHorizontal: controlInputTokens.paddingHorizontal
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
export {
|
|
49
|
+
ControlPlaceholder
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=placeholder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/controls/placeholder.tsx"],"sourcesContent":["import { memo, useMemo } from \"react\";\nimport { StyleSheet } from \"react-native\";\n\nimport {\n AppTheme,\n ComponentSize,\n ComponentVariant,\n useThemedStyles,\n} from \"@impulse-ui-native/theme\";\n\nimport { ControlPlaceholderProps } from \"../../types\";\nimport { Typography } from \"../atoms\";\nimport { useControlContext } from \"./provider\";\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 {\n size,\n variant,\n disabled,\n error,\n }: {\n size: ComponentSize;\n variant: ComponentVariant;\n disabled?: boolean;\n error?: string;\n },\n) {\n const controlInputTokens = theme.components.controlInput;\n const sizeTokens = controlInputTokens.sizes[size];\n const variantTokens = controlInputTokens.variants[variant];\n\n const color = disabled\n ? variantTokens.disabledPlaceholderColor\n : error\n ? variantTokens.errorPlaceholderColor\n : variantTokens.placeholderColor;\n\n return StyleSheet.create({\n placeholder: {\n flex: controlInputTokens.flex,\n color,\n fontFamily: controlInputTokens.fontFamily,\n fontSize: sizeTokens.fontSize,\n paddingHorizontal: controlInputTokens.paddingHorizontal,\n },\n });\n}\n"],"mappings":"AAsCI;AAtCJ,SAAS,MAAM,eAAe;AAC9B,SAAS,kBAAkB;AAE3B;AAAA,EAIE;AAAA,OACK;AAGP,SAAS,kBAAkB;AAC3B,SAAS,yBAAyB;AAE3B,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;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAMA;AACA,QAAM,qBAAqB,MAAM,WAAW;AAC5C,QAAM,aAAa,mBAAmB,MAAM,IAAI;AAChD,QAAM,gBAAgB,mBAAmB,SAAS,OAAO;AAEzD,QAAM,QAAQ,WACV,cAAc,2BACd,QACE,cAAc,wBACd,cAAc;AAEpB,SAAO,WAAW,OAAO;AAAA,IACvB,aAAa;AAAA,MACX,MAAM,mBAAmB;AAAA,MACzB;AAAA,MACA,YAAY,mBAAmB;AAAA,MAC/B,UAAU,WAAW;AAAA,MACrB,mBAAmB,mBAAmB;AAAA,IACxC;AAAA,EACF,CAAC;AACH;","names":["ControlPlaceholder"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { PropsWithChildren } from 'react';
|
|
3
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
+
import { ControlContextData } from '../../types/control-components.types.mjs';
|
|
5
|
+
import 'react-native';
|
|
6
|
+
import '@impulse-ui-native/icon/types';
|
|
7
|
+
import '@impulse-ui-native/theme';
|
|
8
|
+
import '../../types/button.types.mjs';
|
|
9
|
+
|
|
10
|
+
declare const ControlProvider: react.MemoExoticComponent<(props: PropsWithChildren<ControlContextData>) => react_jsx_runtime.JSX.Element>;
|
|
11
|
+
declare function useControlContext(): ControlContextData;
|
|
12
|
+
|
|
13
|
+
export { ControlProvider, useControlContext };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, memo, useContext } from "react";
|
|
3
|
+
const ControlContext = createContext(void 0);
|
|
4
|
+
const ControlProvider = memo(function ControlProvider2(props) {
|
|
5
|
+
const { children, ...context } = props;
|
|
6
|
+
return /* @__PURE__ */ jsx(ControlContext.Provider, { value: context, children });
|
|
7
|
+
});
|
|
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
|
+
export {
|
|
16
|
+
ControlProvider,
|
|
17
|
+
useControlContext
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/controls/provider.tsx"],"sourcesContent":["import { createContext, memo, PropsWithChildren, useContext } from \"react\";\n\nimport { ControlContextData } from \"../../types\";\n\nconst ControlContext = createContext<ControlContextData | undefined>(undefined);\n\nexport const ControlProvider = memo(function ControlProvider(\n props: PropsWithChildren<ControlContextData>,\n) {\n const { children, ...context } = props;\n\n return (\n <ControlContext.Provider value={context}>\n {children}\n </ControlContext.Provider>\n );\n});\n\nexport function useControlContext() {\n const context = useContext(ControlContext);\n\n if (!context) {\n throw new Error(\"useControlContext must be used within ControlProvider\");\n }\n\n return context;\n}\n"],"mappings":"AAYI;AAZJ,SAAS,eAAe,MAAyB,kBAAkB;AAInE,MAAM,iBAAiB,cAA8C,MAAS;AAEvE,MAAM,kBAAkB,KAAK,SAASA,iBAC3C,OACA;AACA,QAAM,EAAE,UAAU,GAAG,QAAQ,IAAI;AAEjC,SACE,oBAAC,eAAe,UAAf,EAAwB,OAAO,SAC7B,UACH;AAEJ,CAAC;AAEM,SAAS,oBAAoB;AAClC,QAAM,UAAU,WAAW,cAAc;AAEzC,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,uDAAuD;AAAA,EACzE;AAEA,SAAO;AACT;","names":["ControlProvider"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
+
import { ViewProps } from '../../types/view.types.mjs';
|
|
4
|
+
import 'react-native';
|
|
5
|
+
import '@impulse-ui-native/theme';
|
|
6
|
+
|
|
7
|
+
declare const ControlRoot: react.MemoExoticComponent<(props: ViewProps) => react_jsx_runtime.JSX.Element>;
|
|
8
|
+
|
|
9
|
+
export { ControlRoot };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo, useMemo } from "react";
|
|
3
|
+
import { StyleSheet } from "react-native";
|
|
4
|
+
import { View } from "../atoms";
|
|
5
|
+
const ControlRoot = memo(function ControlRoot2(props) {
|
|
6
|
+
const { style, ...rest } = props;
|
|
7
|
+
const containerStyle = useMemo(() => [styles.container, style], [style]);
|
|
8
|
+
return /* @__PURE__ */ jsx(View, { ...rest, style: containerStyle });
|
|
9
|
+
});
|
|
10
|
+
const styles = StyleSheet.create({
|
|
11
|
+
container: {
|
|
12
|
+
width: "100%"
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
export {
|
|
16
|
+
ControlRoot
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=root.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/controls/root.tsx"],"sourcesContent":["import { memo, useMemo } from \"react\";\nimport { StyleSheet } from \"react-native\";\n\nimport { ViewProps } from \"../../types\";\nimport { View } from \"../atoms\";\n\nexport const ControlRoot = memo(function ControlRoot(props: ViewProps) {\n const { style, ...rest } = props;\n\n const containerStyle = useMemo(() => [styles.container, style], [style]);\n\n return <View {...rest} style={containerStyle} />;\n});\n\nconst styles = StyleSheet.create({\n container: {\n width: \"100%\",\n },\n});\n"],"mappings":"AAWS;AAXT,SAAS,MAAM,eAAe;AAC9B,SAAS,kBAAkB;AAG3B,SAAS,YAAY;AAEd,MAAM,cAAc,KAAK,SAASA,aAAY,OAAkB;AACrE,QAAM,EAAE,OAAO,GAAG,KAAK,IAAI;AAE3B,QAAM,iBAAiB,QAAQ,MAAM,CAAC,OAAO,WAAW,KAAK,GAAG,CAAC,KAAK,CAAC;AAEvE,SAAO,oBAAC,QAAM,GAAG,MAAM,OAAO,gBAAgB;AAChD,CAAC;AAED,MAAM,SAAS,WAAW,OAAO;AAAA,EAC/B,WAAW;AAAA,IACT,OAAO;AAAA,EACT;AACF,CAAC;","names":["ControlRoot"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
+
import { ControlValueProps } from '../../types/control-components.types.mjs';
|
|
4
|
+
import 'react-native';
|
|
5
|
+
import '@impulse-ui-native/icon/types';
|
|
6
|
+
import '@impulse-ui-native/theme';
|
|
7
|
+
import '../../types/button.types.mjs';
|
|
8
|
+
|
|
9
|
+
declare const ControlValue: react.MemoExoticComponent<(props: ControlValueProps) => react_jsx_runtime.JSX.Element>;
|
|
10
|
+
|
|
11
|
+
export { ControlValue };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo, useMemo } from "react";
|
|
3
|
+
import { StyleSheet } from "react-native";
|
|
4
|
+
import {
|
|
5
|
+
useThemedStyles
|
|
6
|
+
} from "@impulse-ui-native/theme";
|
|
7
|
+
import { Typography } from "../atoms";
|
|
8
|
+
import { useControlContext } from "./provider";
|
|
9
|
+
const ControlValue = memo(function ControlValue2(props) {
|
|
10
|
+
const { style, ...rest } = props;
|
|
11
|
+
const { size } = useControlContext();
|
|
12
|
+
const styles = useThemedStyles(themedStyles, { size }, [size]);
|
|
13
|
+
const valueStyle = useMemo(
|
|
14
|
+
() => [styles.value, style],
|
|
15
|
+
[styles.value, style]
|
|
16
|
+
);
|
|
17
|
+
return /* @__PURE__ */ jsx(Typography.Master, { numberOfLines: 1, ...rest, style: valueStyle });
|
|
18
|
+
});
|
|
19
|
+
function themedStyles(theme, {
|
|
20
|
+
size
|
|
21
|
+
}) {
|
|
22
|
+
const controlInputTokens = theme.components.controlInput;
|
|
23
|
+
const sizeTokens = controlInputTokens.sizes[size];
|
|
24
|
+
return StyleSheet.create({
|
|
25
|
+
value: {
|
|
26
|
+
flex: controlInputTokens.flex,
|
|
27
|
+
fontFamily: controlInputTokens.fontFamily,
|
|
28
|
+
fontSize: sizeTokens.fontSize,
|
|
29
|
+
paddingHorizontal: controlInputTokens.paddingHorizontal
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
ControlValue
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=value.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/controls/value.tsx"],"sourcesContent":["import { memo, useMemo } from \"react\";\nimport { StyleSheet } from \"react-native\";\n\nimport {\n AppTheme,\n ComponentSize,\n useThemedStyles,\n} from \"@impulse-ui-native/theme\";\n\nimport { ControlValueProps } from \"../../types\";\nimport { Typography } from \"../atoms\";\nimport { useControlContext } from \"./provider\";\n\nexport const ControlValue = memo(function ControlValue(\n props: ControlValueProps,\n) {\n const { style, ...rest } = props;\n\n const { size } = useControlContext();\n\n const styles = useThemedStyles(themedStyles, { size }, [size]);\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 {\n size,\n }: {\n size: ComponentSize;\n },\n) {\n const controlInputTokens = theme.components.controlInput;\n const sizeTokens = controlInputTokens.sizes[size];\n\n return StyleSheet.create({\n value: {\n flex: controlInputTokens.flex,\n fontFamily: controlInputTokens.fontFamily,\n fontSize: sizeTokens.fontSize,\n paddingHorizontal: controlInputTokens.paddingHorizontal,\n },\n });\n}\n"],"mappings":"AA2BS;AA3BT,SAAS,MAAM,eAAe;AAC9B,SAAS,kBAAkB;AAE3B;AAAA,EAGE;AAAA,OACK;AAGP,SAAS,kBAAkB;AAC3B,SAAS,yBAAyB;AAE3B,MAAM,eAAe,KAAK,SAASA,cACxC,OACA;AACA,QAAM,EAAE,OAAO,GAAG,KAAK,IAAI;AAE3B,QAAM,EAAE,KAAK,IAAI,kBAAkB;AAEnC,QAAM,SAAS,gBAAgB,cAAc,EAAE,KAAK,GAAG,CAAC,IAAI,CAAC;AAE7D,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;AAAA,EACE;AACF,GAGA;AACA,QAAM,qBAAqB,MAAM,WAAW;AAC5C,QAAM,aAAa,mBAAmB,MAAM,IAAI;AAEhD,SAAO,WAAW,OAAO;AAAA,IACvB,OAAO;AAAA,MACL,MAAM,mBAAmB;AAAA,MACzB,YAAY,mBAAmB;AAAA,MAC/B,UAAU,WAAW;AAAA,MACrB,mBAAmB,mBAAmB;AAAA,IACxC;AAAA,EACF,CAAC;AACH;","names":["ControlValue"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export { View } from './atoms/view.mjs';
|
|
2
|
+
export { SafeAreaView } from './atoms/safe-area-view.mjs';
|
|
3
|
+
export { Typography, TypographyComponent } from './atoms/typography.mjs';
|
|
4
|
+
export { Button } from './atoms/button.mjs';
|
|
5
|
+
export { IconButton } from './atoms/icon-button.mjs';
|
|
6
|
+
export { Pressable } from './atoms/pressable.mjs';
|
|
7
|
+
export { Tag } from './atoms/tag.mjs';
|
|
8
|
+
export { Control } from './controls/control.mjs';
|
|
9
|
+
export { useControlContext } from './controls/provider.mjs';
|
|
10
|
+
import 'react';
|
|
11
|
+
import '@impulse-ui-native/theme';
|
|
12
|
+
import 'react-native';
|
|
13
|
+
import 'react/jsx-runtime';
|
|
14
|
+
import '../types/safe-area-view.types.mjs';
|
|
15
|
+
import 'react-native-safe-area-context';
|
|
16
|
+
import '../types/typography.types.mjs';
|
|
17
|
+
import '../types/button.types.mjs';
|
|
18
|
+
import '../types/icon-button.types.mjs';
|
|
19
|
+
import '@impulse-ui-native/icon/types';
|
|
20
|
+
import '../types/tag.types.mjs';
|
|
21
|
+
import '../types/view.types.mjs';
|
|
22
|
+
import '../types/control-components.types.mjs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/index.ts"],"sourcesContent":["export * from \"./atoms\";\nexport * from \"./controls\";\n"],"mappings":"AAAA,cAAc;AACd,cAAc;","names":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const ControlContainerHeight = {
|
|
2
|
+
small: 36,
|
|
3
|
+
medium: 44,
|
|
4
|
+
large: 52
|
|
5
|
+
};
|
|
6
|
+
const ControlFontSize = {
|
|
7
|
+
small: 14,
|
|
8
|
+
medium: 16,
|
|
9
|
+
large: 18
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
ControlContainerHeight,
|
|
13
|
+
ControlFontSize
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=control-container.constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/constants/control-container.constants.ts"],"sourcesContent":["import { ComponentSize } from \"@impulse-ui-native/theme\";\n\nexport const ControlContainerHeight: Record<ComponentSize, number> = {\n small: 36,\n medium: 44,\n large: 52,\n};\n\nexport const ControlFontSize: Record<ComponentSize, number> = {\n small: 14,\n medium: 16,\n large: 18,\n};\n"],"mappings":"AAEO,MAAM,yBAAwD;AAAA,EACnE,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,OAAO;AACT;AAEO,MAAM,kBAAiD;AAAA,EAC5D,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,OAAO;AACT;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/constants/index.ts"],"sourcesContent":["export * from \"./safe-area-view.constants\";\nexport * from \"./control-container.constants\";\n"],"mappings":"AAAA,cAAc;AACd,cAAc;","names":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare const EdgeToSpacingKeyMap: {
|
|
2
|
+
readonly top: "Top";
|
|
3
|
+
readonly bottom: "Bottom";
|
|
4
|
+
readonly left: "Left";
|
|
5
|
+
readonly right: "Right";
|
|
6
|
+
};
|
|
7
|
+
declare const EdgeToShorthandKeyMap: {
|
|
8
|
+
readonly top: "Vertical";
|
|
9
|
+
readonly bottom: "Vertical";
|
|
10
|
+
readonly left: "Horizontal";
|
|
11
|
+
readonly right: "Horizontal";
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export { EdgeToShorthandKeyMap, EdgeToSpacingKeyMap };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const EdgeToSpacingKeyMap = {
|
|
2
|
+
top: "Top",
|
|
3
|
+
bottom: "Bottom",
|
|
4
|
+
left: "Left",
|
|
5
|
+
right: "Right"
|
|
6
|
+
};
|
|
7
|
+
const EdgeToShorthandKeyMap = {
|
|
8
|
+
top: "Vertical",
|
|
9
|
+
bottom: "Vertical",
|
|
10
|
+
left: "Horizontal",
|
|
11
|
+
right: "Horizontal"
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
EdgeToShorthandKeyMap,
|
|
15
|
+
EdgeToSpacingKeyMap
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=safe-area-view.constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/constants/safe-area-view.constants.ts"],"sourcesContent":["export const EdgeToSpacingKeyMap = {\n top: \"Top\",\n bottom: \"Bottom\",\n left: \"Left\",\n right: \"Right\",\n} as const;\n\nexport const EdgeToShorthandKeyMap = {\n top: \"Vertical\",\n bottom: \"Vertical\",\n left: \"Horizontal\",\n right: \"Horizontal\",\n} as const;\n"],"mappings":"AAAO,MAAM,sBAAsB;AAAA,EACjC,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,OAAO;AACT;AAEO,MAAM,wBAAwB;AAAA,EACnC,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,OAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
+
import { AppTheme, TypographyProps, TypographyPresetKey } from '@impulse-ui-native/theme';
|
|
4
|
+
import { TextProps } from '../types/typography.types.mjs';
|
|
5
|
+
import 'react-native';
|
|
6
|
+
|
|
7
|
+
declare function createPreset(config: (theme: AppTheme) => TypographyProps, key: TypographyPresetKey): react.MemoExoticComponent<{
|
|
8
|
+
(props: TextProps): react_jsx_runtime.JSX.Element;
|
|
9
|
+
displayName: string;
|
|
10
|
+
}>;
|
|
11
|
+
|
|
12
|
+
export { createPreset };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo, useMemo } from "react";
|
|
3
|
+
import { StyleSheet, Text } from "react-native";
|
|
4
|
+
import {
|
|
5
|
+
useStyleProps,
|
|
6
|
+
useTheme
|
|
7
|
+
} from "@impulse-ui-native/theme";
|
|
8
|
+
const numericFontVariant = ["tabular-nums"];
|
|
9
|
+
const defaultFontVariant = [];
|
|
10
|
+
function createPreset(config, key) {
|
|
11
|
+
const Component = (props) => {
|
|
12
|
+
const { style, numeric, fontStyle, fontWeight, ...rest } = props;
|
|
13
|
+
const theme = useTheme();
|
|
14
|
+
const extractedStyleProps = useStyleProps(props);
|
|
15
|
+
const typographyStyle = useMemo(() => {
|
|
16
|
+
const themedConfig = config(theme);
|
|
17
|
+
const resolvedFontStyle = fontStyle ?? themedConfig.fontStyle ?? "normal";
|
|
18
|
+
const resolvedFontWeight = fontWeight ?? themedConfig.fontWeight ?? 400;
|
|
19
|
+
const fontFamily = theme.fontFamily[resolvedFontStyle][resolvedFontWeight];
|
|
20
|
+
return StyleSheet.flatten([
|
|
21
|
+
themedConfig,
|
|
22
|
+
extractedStyleProps,
|
|
23
|
+
{
|
|
24
|
+
fontFamily,
|
|
25
|
+
fontVariant: numeric ? numericFontVariant : defaultFontVariant
|
|
26
|
+
},
|
|
27
|
+
style
|
|
28
|
+
]);
|
|
29
|
+
}, [theme, extractedStyleProps, style, numeric, fontStyle, fontWeight]);
|
|
30
|
+
return /* @__PURE__ */ jsx(Text, { ...rest, style: typographyStyle });
|
|
31
|
+
};
|
|
32
|
+
Component.displayName = `Typography.${key}`;
|
|
33
|
+
return memo(Component);
|
|
34
|
+
}
|
|
35
|
+
export {
|
|
36
|
+
createPreset
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=create-preset.hoc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/hocs/create-preset.hoc.tsx"],"sourcesContent":["import { memo, useMemo } from \"react\";\nimport { StyleSheet, Text, TextStyle } from \"react-native\";\n\nimport {\n AppTheme,\n TypographyPresetKey,\n TypographyProps,\n useStyleProps,\n useTheme,\n} from \"@impulse-ui-native/theme\";\n\nimport { TextProps } from \"../types\";\n\nconst numericFontVariant: TextStyle[\"fontVariant\"] = [\"tabular-nums\"];\nconst defaultFontVariant: TextStyle[\"fontVariant\"] = [];\n\nexport function createPreset(\n config: (theme: AppTheme) => TypographyProps,\n key: TypographyPresetKey,\n) {\n const Component = (props: TextProps) => {\n const { style, numeric, fontStyle, fontWeight, ...rest } = props;\n\n const theme = useTheme();\n const extractedStyleProps = useStyleProps(props);\n\n const typographyStyle = useMemo(() => {\n const themedConfig = config(theme);\n\n const resolvedFontStyle = fontStyle ?? themedConfig.fontStyle ?? \"normal\";\n const resolvedFontWeight = fontWeight ?? themedConfig.fontWeight ?? 400;\n\n const fontFamily =\n theme.fontFamily[resolvedFontStyle][resolvedFontWeight];\n\n return StyleSheet.flatten([\n themedConfig,\n extractedStyleProps,\n {\n fontFamily,\n fontVariant: numeric ? numericFontVariant : defaultFontVariant,\n },\n style,\n ]);\n }, [theme, extractedStyleProps, style, numeric, fontStyle, fontWeight]);\n\n return <Text {...rest} style={typographyStyle} />;\n };\n\n Component.displayName = `Typography.${key}`;\n\n return memo(Component);\n}\n"],"mappings":"AA8CW;AA9CX,SAAS,MAAM,eAAe;AAC9B,SAAS,YAAY,YAAuB;AAE5C;AAAA,EAIE;AAAA,EACA;AAAA,OACK;AAIP,MAAM,qBAA+C,CAAC,cAAc;AACpE,MAAM,qBAA+C,CAAC;AAE/C,SAAS,aACd,QACA,KACA;AACA,QAAM,YAAY,CAAC,UAAqB;AACtC,UAAM,EAAE,OAAO,SAAS,WAAW,YAAY,GAAG,KAAK,IAAI;AAE3D,UAAM,QAAQ,SAAS;AACvB,UAAM,sBAAsB,cAAc,KAAK;AAE/C,UAAM,kBAAkB,QAAQ,MAAM;AACpC,YAAM,eAAe,OAAO,KAAK;AAEjC,YAAM,oBAAoB,aAAa,aAAa,aAAa;AACjE,YAAM,qBAAqB,cAAc,aAAa,cAAc;AAEpE,YAAM,aACJ,MAAM,WAAW,iBAAiB,EAAE,kBAAkB;AAExD,aAAO,WAAW,QAAQ;AAAA,QACxB;AAAA,QACA;AAAA,QACA;AAAA,UACE;AAAA,UACA,aAAa,UAAU,qBAAqB;AAAA,QAC9C;AAAA,QACA;AAAA,MACF,CAAC;AAAA,IACH,GAAG,CAAC,OAAO,qBAAqB,OAAO,SAAS,WAAW,UAAU,CAAC;AAEtE,WAAO,oBAAC,QAAM,GAAG,MAAM,OAAO,iBAAiB;AAAA,EACjD;AAEA,YAAU,cAAc,cAAc,GAAG;AAEzC,SAAO,KAAK,SAAS;AACvB;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/hocs/index.ts"],"sourcesContent":["export { createPreset } from \"./create-preset.hoc\";\n"],"mappings":"AAAA,SAAS,oBAAoB;","names":[]}
|