@impulse-ui-native/primitives 3.0.0 → 5.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 +63 -21
- package/dist/components/atoms/avatar.d.mts +1 -1
- package/dist/components/atoms/avatar.js +14 -30
- package/dist/components/atoms/avatar.js.map +1 -1
- package/dist/components/atoms/badge/root.d.mts +1 -1
- package/dist/components/atoms/badge/root.js +25 -38
- package/dist/components/atoms/badge/root.js.map +1 -1
- package/dist/components/atoms/button.d.mts +1 -1
- package/dist/components/atoms/button.js +22 -31
- package/dist/components/atoms/button.js.map +1 -1
- package/dist/components/atoms/circular-progress.js +2 -2
- package/dist/components/atoms/circular-progress.js.map +1 -1
- package/dist/components/atoms/divider.d.mts +1 -1
- package/dist/components/atoms/divider.js +18 -14
- package/dist/components/atoms/divider.js.map +1 -1
- package/dist/components/atoms/icon-button.d.mts +1 -1
- package/dist/components/atoms/icon-button.js +18 -22
- package/dist/components/atoms/icon-button.js.map +1 -1
- package/dist/components/atoms/progress.d.mts +1 -1
- package/dist/components/atoms/progress.js +0 -28
- package/dist/components/atoms/progress.js.map +1 -1
- package/dist/components/atoms/spinner.d.mts +1 -1
- package/dist/components/atoms/spinner.js +8 -29
- package/dist/components/atoms/spinner.js.map +1 -1
- package/dist/components/atoms/tag.js +9 -5
- package/dist/components/atoms/tag.js.map +1 -1
- package/dist/components/atoms/typography.js +25 -1
- package/dist/components/atoms/typography.js.map +1 -1
- package/dist/components/card/card.d.mts +1 -1
- package/dist/components/card/pressable.d.mts +1 -1
- package/dist/components/card/pressable.js +2 -20
- package/dist/components/card/pressable.js.map +1 -1
- package/dist/components/controls/addon.js +6 -3
- package/dist/components/controls/addon.js.map +1 -1
- package/dist/components/controls/container.js +8 -4
- package/dist/components/controls/container.js.map +1 -1
- package/dist/components/controls/input.js +7 -5
- package/dist/components/controls/input.js.map +1 -1
- package/dist/components/controls/label.js +9 -3
- package/dist/components/controls/label.js.map +1 -1
- package/dist/components/controls/placeholder.js +6 -3
- package/dist/components/controls/placeholder.js.map +1 -1
- package/dist/components/controls/value.js +6 -3
- package/dist/components/controls/value.js.map +1 -1
- package/dist/components/index.d.mts +2 -0
- package/dist/components/index.js +1 -0
- package/dist/components/index.js.map +1 -1
- package/dist/components/list/content.d.mts +11 -0
- package/dist/components/list/content.js +27 -0
- package/dist/components/list/content.js.map +1 -0
- package/dist/components/list/index.d.mts +8 -0
- package/dist/components/list/index.js +5 -0
- package/dist/components/list/index.js.map +1 -0
- package/dist/components/list/item.d.mts +11 -0
- package/dist/components/list/item.js +32 -0
- package/dist/components/list/item.js.map +1 -0
- package/dist/components/list/leading.d.mts +11 -0
- package/dist/components/list/leading.js +32 -0
- package/dist/components/list/leading.js.map +1 -0
- package/dist/components/list/list.d.mts +18 -0
- package/dist/components/list/list.js +18 -0
- package/dist/components/list/list.js.map +1 -0
- package/dist/components/list/pressable.d.mts +11 -0
- package/dist/components/list/pressable.js +37 -0
- package/dist/components/list/pressable.js.map +1 -0
- package/dist/components/list/root.d.mts +11 -0
- package/dist/components/list/root.js +33 -0
- package/dist/components/list/root.js.map +1 -0
- package/dist/components/list/trailing.d.mts +11 -0
- package/dist/components/list/trailing.js +32 -0
- package/dist/components/list/trailing.js.map +1 -0
- package/dist/hocs/create-preset.hoc.d.mts +1 -1
- package/dist/hocs/create-preset.hoc.js +23 -8
- package/dist/hocs/create-preset.hoc.js.map +1 -1
- package/dist/hooks/use-indeterminate-progress-animation.hook.js +3 -24
- package/dist/hooks/use-indeterminate-progress-animation.hook.js.map +1 -1
- package/dist/index.d.mts +2 -0
- package/dist/types/avatar.types.d.mts +3 -3
- package/dist/types/badge.types.d.mts +3 -3
- package/dist/types/button.types.d.mts +4 -3
- package/dist/types/control-components.types.d.mts +2 -2
- package/dist/types/icon-button.types.d.mts +3 -2
- package/dist/types/index.d.mts +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/list.types.d.mts +21 -0
- package/dist/types/list.types.js +1 -0
- package/dist/types/list.types.js.map +1 -0
- package/dist/types/tag.types.d.mts +3 -3
- package/package.json +6 -6
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo, useCallback } from "react";
|
|
3
|
+
import { StyleSheet } from "react-native";
|
|
4
|
+
import { useStyleProps, useThemedStyles } from "@impulse-ui-native/theme";
|
|
5
|
+
import { Pressable } from "../atoms/pressable";
|
|
6
|
+
const ListPressable = memo(function ListPressable2({
|
|
7
|
+
disabled,
|
|
8
|
+
style,
|
|
9
|
+
...props
|
|
10
|
+
}) {
|
|
11
|
+
const styles = useThemedStyles(themedStyles);
|
|
12
|
+
const extractedStyleProps = useStyleProps(props);
|
|
13
|
+
const rootStyle = useCallback(
|
|
14
|
+
(state) => StyleSheet.flatten([
|
|
15
|
+
styles.root,
|
|
16
|
+
extractedStyleProps,
|
|
17
|
+
typeof style === "function" ? style(state) : style
|
|
18
|
+
]),
|
|
19
|
+
[extractedStyleProps, style, styles.root]
|
|
20
|
+
);
|
|
21
|
+
return /* @__PURE__ */ jsx(Pressable, { ...props, disabled: disabled === true, style: rootStyle });
|
|
22
|
+
});
|
|
23
|
+
function themedStyles(theme) {
|
|
24
|
+
const tokens = theme.components.list.item;
|
|
25
|
+
return StyleSheet.create({
|
|
26
|
+
root: {
|
|
27
|
+
flexDirection: "row",
|
|
28
|
+
alignItems: "center",
|
|
29
|
+
gap: tokens.gap,
|
|
30
|
+
padding: tokens.padding
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
export {
|
|
35
|
+
ListPressable
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=pressable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/list/pressable.tsx"],"sourcesContent":["import type {\n PressableStateCallbackType,\n StyleProp,\n ViewStyle,\n} from \"react-native\";\nimport { memo, useCallback } from \"react\";\nimport { StyleSheet } from \"react-native\";\n\nimport type { AppTheme } from \"@impulse-ui-native/theme\";\nimport { useStyleProps, useThemedStyles } from \"@impulse-ui-native/theme\";\n\nimport type { ListPressableProps } from \"../../types\";\nimport { Pressable } from \"../atoms/pressable\";\n\nexport const ListPressable = memo(function ListPressable({\n disabled,\n style,\n ...props\n}: ListPressableProps) {\n const styles = useThemedStyles(themedStyles);\n const extractedStyleProps = useStyleProps(props);\n\n const rootStyle = useCallback(\n (state: PressableStateCallbackType): StyleProp<ViewStyle> =>\n StyleSheet.flatten([\n styles.root,\n extractedStyleProps,\n typeof style === \"function\" ? style(state) : style,\n ]),\n [extractedStyleProps, style, styles.root],\n );\n\n return (\n <Pressable {...props} disabled={disabled === true} style={rootStyle} />\n );\n});\n\nfunction themedStyles(theme: AppTheme) {\n const tokens = theme.components.list.item;\n return StyleSheet.create({\n root: {\n flexDirection: \"row\",\n alignItems: \"center\",\n gap: tokens.gap,\n padding: tokens.padding,\n },\n });\n}\n"],"mappings":"AAiCI;AA5BJ,SAAS,MAAM,mBAAmB;AAClC,SAAS,kBAAkB;AAG3B,SAAS,eAAe,uBAAuB;AAG/C,SAAS,iBAAiB;AAEnB,MAAM,gBAAgB,KAAK,SAASA,eAAc;AAAA,EACvD;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAuB;AACrB,QAAM,SAAS,gBAAgB,YAAY;AAC3C,QAAM,sBAAsB,cAAc,KAAK;AAE/C,QAAM,YAAY;AAAA,IAChB,CAAC,UACC,WAAW,QAAQ;AAAA,MACjB,OAAO;AAAA,MACP;AAAA,MACA,OAAO,UAAU,aAAa,MAAM,KAAK,IAAI;AAAA,IAC/C,CAAC;AAAA,IACH,CAAC,qBAAqB,OAAO,OAAO,IAAI;AAAA,EAC1C;AAEA,SACE,oBAAC,aAAW,GAAG,OAAO,UAAU,aAAa,MAAM,OAAO,WAAW;AAEzE,CAAC;AAED,SAAS,aAAa,OAAiB;AACrC,QAAM,SAAS,MAAM,WAAW,KAAK;AACrC,SAAO,WAAW,OAAO;AAAA,IACvB,MAAM;AAAA,MACJ,eAAe;AAAA,MACf,YAAY;AAAA,MACZ,KAAK,OAAO;AAAA,MACZ,SAAS,OAAO;AAAA,IAClB;AAAA,EACF,CAAC;AACH;","names":["ListPressable"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
+
import { ListRootProps } from '../../types/list.types.mjs';
|
|
4
|
+
import '../../types/button.types.mjs';
|
|
5
|
+
import 'react-native';
|
|
6
|
+
import '@impulse-ui-native/theme';
|
|
7
|
+
import '../../types/view.types.mjs';
|
|
8
|
+
|
|
9
|
+
declare const ListRoot: react.MemoExoticComponent<({ style, ...props }: ListRootProps) => react_jsx_runtime.JSX.Element>;
|
|
10
|
+
|
|
11
|
+
export { ListRoot };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo, useMemo } from "react";
|
|
3
|
+
import { StyleSheet } from "react-native";
|
|
4
|
+
import { useStyleProps, useThemedStyles } from "@impulse-ui-native/theme";
|
|
5
|
+
import { View } from "../atoms/view";
|
|
6
|
+
const ListRoot = memo(function ListRoot2({
|
|
7
|
+
style,
|
|
8
|
+
...props
|
|
9
|
+
}) {
|
|
10
|
+
const extractedStyleProps = useStyleProps(props);
|
|
11
|
+
const styles = useThemedStyles(themedStyles);
|
|
12
|
+
const composedStyle = useMemo(
|
|
13
|
+
() => [styles.part, extractedStyleProps, style],
|
|
14
|
+
[styles.part, extractedStyleProps, style]
|
|
15
|
+
);
|
|
16
|
+
return /* @__PURE__ */ jsx(View, { ...props, style: composedStyle });
|
|
17
|
+
});
|
|
18
|
+
function themedStyles(theme) {
|
|
19
|
+
const tokens = theme.components.list;
|
|
20
|
+
return StyleSheet.create({
|
|
21
|
+
part: {
|
|
22
|
+
backgroundColor: tokens.backgroundColor,
|
|
23
|
+
borderColor: tokens.borderColor,
|
|
24
|
+
borderWidth: tokens.borderWidth,
|
|
25
|
+
borderRadius: tokens.borderRadius,
|
|
26
|
+
overflow: "hidden"
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
ListRoot
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=root.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/list/root.tsx"],"sourcesContent":["import { memo, useMemo } from \"react\";\nimport { StyleSheet } from \"react-native\";\n\nimport type { AppTheme } from \"@impulse-ui-native/theme\";\nimport { useStyleProps, useThemedStyles } from \"@impulse-ui-native/theme\";\n\nimport type { ListRootProps } from \"../../types\";\nimport { View } from \"../atoms/view\";\n\nexport const ListRoot = memo(function ListRoot({\n style,\n ...props\n}: ListRootProps) {\n const extractedStyleProps = useStyleProps(props);\n const styles = useThemedStyles(themedStyles);\n const composedStyle = useMemo(\n () => [styles.part, extractedStyleProps, style],\n [styles.part, extractedStyleProps, style],\n );\n return <View {...props} style={composedStyle} />;\n});\nfunction themedStyles(theme: AppTheme) {\n const tokens = theme.components.list;\n return StyleSheet.create({\n part: {\n backgroundColor: tokens.backgroundColor,\n borderColor: tokens.borderColor,\n borderWidth: tokens.borderWidth,\n borderRadius: tokens.borderRadius,\n overflow: \"hidden\",\n },\n });\n}\n"],"mappings":"AAmBS;AAnBT,SAAS,MAAM,eAAe;AAC9B,SAAS,kBAAkB;AAG3B,SAAS,eAAe,uBAAuB;AAG/C,SAAS,YAAY;AAEd,MAAM,WAAW,KAAK,SAASA,UAAS;AAAA,EAC7C;AAAA,EACA,GAAG;AACL,GAAkB;AAChB,QAAM,sBAAsB,cAAc,KAAK;AAC/C,QAAM,SAAS,gBAAgB,YAAY;AAC3C,QAAM,gBAAgB;AAAA,IACpB,MAAM,CAAC,OAAO,MAAM,qBAAqB,KAAK;AAAA,IAC9C,CAAC,OAAO,MAAM,qBAAqB,KAAK;AAAA,EAC1C;AACA,SAAO,oBAAC,QAAM,GAAG,OAAO,OAAO,eAAe;AAChD,CAAC;AACD,SAAS,aAAa,OAAiB;AACrC,QAAM,SAAS,MAAM,WAAW;AAChC,SAAO,WAAW,OAAO;AAAA,IACvB,MAAM;AAAA,MACJ,iBAAiB,OAAO;AAAA,MACxB,aAAa,OAAO;AAAA,MACpB,aAAa,OAAO;AAAA,MACpB,cAAc,OAAO;AAAA,MACrB,UAAU;AAAA,IACZ;AAAA,EACF,CAAC;AACH;","names":["ListRoot"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
+
import { ListTrailingProps } from '../../types/list.types.mjs';
|
|
4
|
+
import '../../types/button.types.mjs';
|
|
5
|
+
import 'react-native';
|
|
6
|
+
import '@impulse-ui-native/theme';
|
|
7
|
+
import '../../types/view.types.mjs';
|
|
8
|
+
|
|
9
|
+
declare const ListTrailing: react.MemoExoticComponent<({ style, ...props }: ListTrailingProps) => react_jsx_runtime.JSX.Element>;
|
|
10
|
+
|
|
11
|
+
export { ListTrailing };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo, useMemo } from "react";
|
|
3
|
+
import { StyleSheet } from "react-native";
|
|
4
|
+
import { useStyleProps, useThemedStyles } from "@impulse-ui-native/theme";
|
|
5
|
+
import { View } from "../atoms/view";
|
|
6
|
+
const ListTrailing = memo(function ListTrailing2({
|
|
7
|
+
style,
|
|
8
|
+
...props
|
|
9
|
+
}) {
|
|
10
|
+
const extractedStyleProps = useStyleProps(props);
|
|
11
|
+
const styles = useThemedStyles(themedStyles);
|
|
12
|
+
const composedStyle = useMemo(
|
|
13
|
+
() => [styles.part, extractedStyleProps, style],
|
|
14
|
+
[styles.part, extractedStyleProps, style]
|
|
15
|
+
);
|
|
16
|
+
return /* @__PURE__ */ jsx(View, { ...props, style: composedStyle });
|
|
17
|
+
});
|
|
18
|
+
function themedStyles(theme) {
|
|
19
|
+
const tokens = theme.components.list;
|
|
20
|
+
return StyleSheet.create({
|
|
21
|
+
part: {
|
|
22
|
+
flexShrink: 0,
|
|
23
|
+
flexDirection: "row",
|
|
24
|
+
alignItems: "center",
|
|
25
|
+
gap: tokens.item.gap
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
ListTrailing
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=trailing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/list/trailing.tsx"],"sourcesContent":["import { memo, useMemo } from \"react\";\nimport { StyleSheet } from \"react-native\";\n\nimport type { AppTheme } from \"@impulse-ui-native/theme\";\nimport { useStyleProps, useThemedStyles } from \"@impulse-ui-native/theme\";\n\nimport type { ListTrailingProps } from \"../../types\";\nimport { View } from \"../atoms/view\";\n\nexport const ListTrailing = memo(function ListTrailing({\n style,\n ...props\n}: ListTrailingProps) {\n const extractedStyleProps = useStyleProps(props);\n const styles = useThemedStyles(themedStyles);\n const composedStyle = useMemo(\n () => [styles.part, extractedStyleProps, style],\n [styles.part, extractedStyleProps, style],\n );\n return <View {...props} style={composedStyle} />;\n});\nfunction themedStyles(theme: AppTheme) {\n const tokens = theme.components.list;\n return StyleSheet.create({\n part: {\n flexShrink: 0,\n flexDirection: \"row\",\n alignItems: \"center\",\n gap: tokens.item.gap,\n },\n });\n}\n"],"mappings":"AAmBS;AAnBT,SAAS,MAAM,eAAe;AAC9B,SAAS,kBAAkB;AAG3B,SAAS,eAAe,uBAAuB;AAG/C,SAAS,YAAY;AAEd,MAAM,eAAe,KAAK,SAASA,cAAa;AAAA,EACrD;AAAA,EACA,GAAG;AACL,GAAsB;AACpB,QAAM,sBAAsB,cAAc,KAAK;AAC/C,QAAM,SAAS,gBAAgB,YAAY;AAC3C,QAAM,gBAAgB;AAAA,IACpB,MAAM,CAAC,OAAO,MAAM,qBAAqB,KAAK;AAAA,IAC9C,CAAC,OAAO,MAAM,qBAAqB,KAAK;AAAA,EAC1C;AACA,SAAO,oBAAC,QAAM,GAAG,OAAO,OAAO,eAAe;AAChD,CAAC;AACD,SAAS,aAAa,OAAiB;AACrC,QAAM,SAAS,MAAM,WAAW;AAChC,SAAO,WAAW,OAAO;AAAA,IACvB,MAAM;AAAA,MACJ,YAAY;AAAA,MACZ,eAAe;AAAA,MACf,YAAY;AAAA,MACZ,KAAK,OAAO,KAAK;AAAA,IACnB;AAAA,EACF,CAAC;AACH;","names":["ListTrailing"]}
|
|
@@ -4,7 +4,7 @@ import { AppTheme, TypographyProps, TypographyPresetKey } from '@impulse-ui-nati
|
|
|
4
4
|
import { TextProps } from '../types/typography.types.mjs';
|
|
5
5
|
import 'react-native';
|
|
6
6
|
|
|
7
|
-
declare function createPreset(config: (theme: AppTheme) => TypographyProps, key: TypographyPresetKey): react.MemoExoticComponent<{
|
|
7
|
+
declare function createPreset(config: (theme: AppTheme) => TypographyProps & Pick<TextProps, "color">, key: TypographyPresetKey): react.MemoExoticComponent<{
|
|
8
8
|
(props: TextProps): react_jsx_runtime.JSX.Element;
|
|
9
9
|
displayName: string;
|
|
10
10
|
}>;
|
|
@@ -1,32 +1,47 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { memo, useMemo } from "react";
|
|
3
3
|
import { StyleSheet, Text } from "react-native";
|
|
4
|
-
import {
|
|
5
|
-
useStyleProps,
|
|
6
|
-
useTheme
|
|
7
|
-
} from "@impulse-ui-native/theme";
|
|
4
|
+
import { useStyleProps, useTheme } from "@impulse-ui-native/theme";
|
|
8
5
|
const numericFontVariant = ["tabular-nums"];
|
|
9
6
|
const defaultFontVariant = [];
|
|
10
7
|
function createPreset(config, key) {
|
|
11
8
|
const Component = (props) => {
|
|
12
|
-
const {
|
|
9
|
+
const {
|
|
10
|
+
style,
|
|
11
|
+
numeric,
|
|
12
|
+
fontFamily: customFontFamily,
|
|
13
|
+
fontVariant: customFontVariant,
|
|
14
|
+
fontStyle,
|
|
15
|
+
fontWeight,
|
|
16
|
+
...rest
|
|
17
|
+
} = props;
|
|
13
18
|
const theme = useTheme();
|
|
14
19
|
const extractedStyleProps = useStyleProps(props);
|
|
15
20
|
const typographyStyle = useMemo(() => {
|
|
16
21
|
const themedConfig = config(theme);
|
|
17
22
|
const resolvedFontStyle = fontStyle ?? themedConfig.fontStyle ?? "normal";
|
|
18
23
|
const resolvedFontWeight = fontWeight ?? themedConfig.fontWeight ?? 400;
|
|
19
|
-
const fontFamily = theme.fontFamily[resolvedFontStyle][resolvedFontWeight];
|
|
24
|
+
const fontFamily = customFontFamily ?? themedConfig.fontFamily ?? theme.fontFamily[resolvedFontStyle][resolvedFontWeight];
|
|
20
25
|
return StyleSheet.flatten([
|
|
26
|
+
{ color: theme.colors.text.primary },
|
|
21
27
|
themedConfig,
|
|
22
28
|
extractedStyleProps,
|
|
23
29
|
{
|
|
24
30
|
fontFamily,
|
|
25
|
-
fontVariant: numeric ? numericFontVariant : defaultFontVariant
|
|
31
|
+
fontVariant: numeric ? numericFontVariant : customFontVariant ?? themedConfig.fontVariant ?? defaultFontVariant
|
|
26
32
|
},
|
|
27
33
|
style
|
|
28
34
|
]);
|
|
29
|
-
}, [
|
|
35
|
+
}, [
|
|
36
|
+
theme,
|
|
37
|
+
extractedStyleProps,
|
|
38
|
+
style,
|
|
39
|
+
numeric,
|
|
40
|
+
customFontFamily,
|
|
41
|
+
customFontVariant,
|
|
42
|
+
fontStyle,
|
|
43
|
+
fontWeight
|
|
44
|
+
]);
|
|
30
45
|
return /* @__PURE__ */ jsx(Text, { ...rest, style: typographyStyle });
|
|
31
46
|
};
|
|
32
47
|
Component.displayName = `Typography.${key}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/hocs/create-preset.hoc.tsx"],"sourcesContent":["import { memo, useMemo } from \"react\";\nimport { StyleSheet, Text
|
|
1
|
+
{"version":3,"sources":["../../src/hocs/create-preset.hoc.tsx"],"sourcesContent":["import type { TextStyle } from \"react-native\";\nimport { memo, useMemo } from \"react\";\nimport { StyleSheet, Text } from \"react-native\";\n\nimport type {\n AppTheme,\n TypographyPresetKey,\n TypographyProps,\n} from \"@impulse-ui-native/theme\";\nimport { useStyleProps, useTheme } from \"@impulse-ui-native/theme\";\n\nimport type { TextProps } from \"../types\";\n\nconst numericFontVariant: TextStyle[\"fontVariant\"] = [\"tabular-nums\"];\nconst defaultFontVariant: TextStyle[\"fontVariant\"] = [];\n\nexport function createPreset(\n config: (theme: AppTheme) => TypographyProps & Pick<TextProps, \"color\">,\n key: TypographyPresetKey,\n) {\n const Component = (props: TextProps) => {\n const {\n style,\n numeric,\n fontFamily: customFontFamily,\n fontVariant: customFontVariant,\n fontStyle,\n fontWeight,\n ...rest\n } = 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 customFontFamily ??\n themedConfig.fontFamily ??\n theme.fontFamily[resolvedFontStyle][resolvedFontWeight];\n\n return StyleSheet.flatten([\n { color: theme.colors.text.primary },\n themedConfig,\n extractedStyleProps,\n {\n fontFamily,\n fontVariant: numeric\n ? numericFontVariant\n : (customFontVariant ??\n themedConfig.fontVariant ??\n defaultFontVariant),\n },\n style,\n ]);\n }, [\n theme,\n extractedStyleProps,\n style,\n numeric,\n customFontFamily,\n customFontVariant,\n fontStyle,\n fontWeight,\n ]);\n\n return <Text {...rest} style={typographyStyle} />;\n };\n\n Component.displayName = `Typography.${key}`;\n\n return memo(Component);\n}\n"],"mappings":"AAsEW;AArEX,SAAS,MAAM,eAAe;AAC9B,SAAS,YAAY,YAAY;AAOjC,SAAS,eAAe,gBAAgB;AAIxC,MAAM,qBAA+C,CAAC,cAAc;AACpE,MAAM,qBAA+C,CAAC;AAE/C,SAAS,aACd,QACA,KACA;AACA,QAAM,YAAY,CAAC,UAAqB;AACtC,UAAM;AAAA,MACJ;AAAA,MACA;AAAA,MACA,YAAY;AAAA,MACZ,aAAa;AAAA,MACb;AAAA,MACA;AAAA,MACA,GAAG;AAAA,IACL,IAAI;AAEJ,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,oBACA,aAAa,cACb,MAAM,WAAW,iBAAiB,EAAE,kBAAkB;AAExD,aAAO,WAAW,QAAQ;AAAA,QACxB,EAAE,OAAO,MAAM,OAAO,KAAK,QAAQ;AAAA,QACnC;AAAA,QACA;AAAA,QACA;AAAA,UACE;AAAA,UACA,aAAa,UACT,qBACC,qBACD,aAAa,eACb;AAAA,QACN;AAAA,QACA;AAAA,MACF,CAAC;AAAA,IACH,GAAG;AAAA,MACD;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAED,WAAO,oBAAC,QAAM,GAAG,MAAM,OAAO,iBAAiB;AAAA,EACjD;AAEA,YAAU,cAAc,cAAc,GAAG;AAEzC,SAAO,KAAK,SAAS;AACvB;","names":[]}
|
|
@@ -1,30 +1,9 @@
|
|
|
1
|
-
import { useEffect, useRef
|
|
2
|
-
import {
|
|
1
|
+
import { useEffect, useRef } from "react";
|
|
2
|
+
import { Animated, Easing } from "react-native";
|
|
3
3
|
function useIndeterminateProgressAnimation(duration) {
|
|
4
|
-
const [reduceMotion, setReduceMotion] = useState(false);
|
|
5
4
|
const progress = useRef(new Animated.Value(0)).current;
|
|
6
|
-
useEffect(() => {
|
|
7
|
-
let mounted = true;
|
|
8
|
-
AccessibilityInfo.isReduceMotionEnabled().then((enabled) => {
|
|
9
|
-
if (mounted) {
|
|
10
|
-
setReduceMotion(enabled);
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
const subscription = AccessibilityInfo.addEventListener(
|
|
14
|
-
"reduceMotionChanged",
|
|
15
|
-
setReduceMotion
|
|
16
|
-
);
|
|
17
|
-
return () => {
|
|
18
|
-
mounted = false;
|
|
19
|
-
subscription.remove();
|
|
20
|
-
};
|
|
21
|
-
}, []);
|
|
22
5
|
useEffect(() => {
|
|
23
6
|
progress.stopAnimation();
|
|
24
|
-
if (reduceMotion) {
|
|
25
|
-
progress.setValue(0.5);
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
7
|
progress.setValue(0);
|
|
29
8
|
const animation = Animated.loop(
|
|
30
9
|
Animated.timing(progress, {
|
|
@@ -38,7 +17,7 @@ function useIndeterminateProgressAnimation(duration) {
|
|
|
38
17
|
return () => {
|
|
39
18
|
animation.stop();
|
|
40
19
|
};
|
|
41
|
-
}, [duration, progress
|
|
20
|
+
}, [duration, progress]);
|
|
42
21
|
return progress;
|
|
43
22
|
}
|
|
44
23
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/hooks/use-indeterminate-progress-animation.hook.ts"],"sourcesContent":["import { useEffect, useRef
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/use-indeterminate-progress-animation.hook.ts"],"sourcesContent":["import { useEffect, useRef } from \"react\";\nimport { Animated, Easing } from \"react-native\";\n\nexport function useIndeterminateProgressAnimation(duration: number) {\n const progress = useRef(new Animated.Value(0)).current;\n\n useEffect(() => {\n progress.stopAnimation();\n progress.setValue(0);\n\n const animation = Animated.loop(\n Animated.timing(progress, {\n duration,\n easing: Easing.linear,\n toValue: 1,\n useNativeDriver: true,\n }),\n );\n\n animation.start();\n\n return () => {\n animation.stop();\n };\n }, [duration, progress]);\n\n return progress;\n}\n"],"mappings":"AAAA,SAAS,WAAW,cAAc;AAClC,SAAS,UAAU,cAAc;AAE1B,SAAS,kCAAkC,UAAkB;AAClE,QAAM,WAAW,OAAO,IAAI,SAAS,MAAM,CAAC,CAAC,EAAE;AAE/C,YAAU,MAAM;AACd,aAAS,cAAc;AACvB,aAAS,SAAS,CAAC;AAEnB,UAAM,YAAY,SAAS;AAAA,MACzB,SAAS,OAAO,UAAU;AAAA,QACxB;AAAA,QACA,QAAQ,OAAO;AAAA,QACf,SAAS;AAAA,QACT,iBAAiB;AAAA,MACnB,CAAC;AAAA,IACH;AAEA,cAAU,MAAM;AAEhB,WAAO,MAAM;AACX,gBAAU,KAAK;AAAA,IACjB;AAAA,EACF,GAAG,CAAC,UAAU,QAAQ,CAAC;AAEvB,SAAO;AACT;","names":[]}
|
package/dist/index.d.mts
CHANGED
|
@@ -13,6 +13,7 @@ export { Tag } from './components/atoms/tag.mjs';
|
|
|
13
13
|
export { Card } from './components/card/card.mjs';
|
|
14
14
|
export { Control } from './components/controls/control.mjs';
|
|
15
15
|
export { useControlContext } from './components/controls/provider.mjs';
|
|
16
|
+
export { List } from './components/list/list.mjs';
|
|
16
17
|
export { createPreset } from './hocs/create-preset.hoc.mjs';
|
|
17
18
|
export { EdgeToShorthandKeyMap, EdgeToSpacingKeyMap } from './constants/safe-area-view.constants.mjs';
|
|
18
19
|
export { AvatarImageProps, AvatarProps } from './types/avatar.types.mjs';
|
|
@@ -28,6 +29,7 @@ export { ProgressProps } from './types/progress.types.mjs';
|
|
|
28
29
|
export { SpinnerProps } from './types/spinner.types.mjs';
|
|
29
30
|
export { TagProps, TagThemeProps } from './types/tag.types.mjs';
|
|
30
31
|
export { ControlAddonProps, ControlComponentCommonProps, ControlComponentProps, ControlContainerProps, ControlContextData, ControlErrorLabelProps, ControlInputProps, ControlLabelProps, ControlLoaderProps, ControlPlaceholderProps, ControlValueProps } from './types/control-components.types.mjs';
|
|
32
|
+
export { ListContentProps, ListItemProps, ListLeadingProps, ListPressableProps, ListRootProps, ListTrailingProps } from './types/list.types.mjs';
|
|
31
33
|
import 'react';
|
|
32
34
|
import 'react/jsx-runtime';
|
|
33
35
|
import '@impulse-ui-native/theme';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { ImageProps, StyleProp, ImageStyle, ImageSourcePropType, ViewStyle } from 'react-native';
|
|
3
|
-
import { ComponentSize, AvatarStatus,
|
|
3
|
+
import { ComponentSize, AvatarStatus, DisplayVariant } from '@impulse-ui-native/theme';
|
|
4
4
|
import { ViewProps } from './view.types.mjs';
|
|
5
5
|
|
|
6
|
-
interface AvatarImageProps extends Omit<ImageProps, "
|
|
6
|
+
interface AvatarImageProps extends Omit<ImageProps, "source" | "style"> {
|
|
7
7
|
style?: StyleProp<ImageStyle>;
|
|
8
8
|
}
|
|
9
9
|
interface AvatarProps extends Omit<ViewProps, "children"> {
|
|
@@ -14,7 +14,7 @@ interface AvatarProps extends Omit<ViewProps, "children"> {
|
|
|
14
14
|
source?: ImageSourcePropType;
|
|
15
15
|
status?: AvatarStatus;
|
|
16
16
|
statusColor?: ViewStyle["backgroundColor"];
|
|
17
|
-
variant?:
|
|
17
|
+
variant?: DisplayVariant;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
export type { AvatarImageProps, AvatarProps };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { ColorValue } from 'react-native';
|
|
3
|
-
import { ComponentSize, BadgeTone,
|
|
3
|
+
import { ComponentSize, BadgeTone, DisplayVariant } from '@impulse-ui-native/theme';
|
|
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';
|
|
@@ -11,14 +11,14 @@ interface BadgeProps extends Omit<ViewProps, "children">, Pick<ControlComponentC
|
|
|
11
11
|
children: ReactNode;
|
|
12
12
|
size?: ComponentSize;
|
|
13
13
|
tone?: BadgeTone;
|
|
14
|
-
variant?:
|
|
14
|
+
variant?: DisplayVariant;
|
|
15
15
|
}
|
|
16
16
|
interface BadgeThemeProps {
|
|
17
17
|
backgroundColor?: ColorValue;
|
|
18
18
|
color?: ColorValue;
|
|
19
19
|
size: ComponentSize;
|
|
20
20
|
tone: BadgeTone;
|
|
21
|
-
variant:
|
|
21
|
+
variant: DisplayVariant;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
export type { BadgeProps, BadgeThemeProps };
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { PressableProps, ViewStyle, StyleProp } from 'react-native';
|
|
2
|
-
import { DimensionProps, SpacingProps, ShadowProps, ComponentSize,
|
|
2
|
+
import { DimensionProps, SpacingProps, ShadowProps, ComponentSize, ActionVariant } from '@impulse-ui-native/theme';
|
|
3
3
|
|
|
4
4
|
interface ButtonProps extends PressableProps, DimensionProps, SpacingProps, ShadowProps {
|
|
5
5
|
size?: ComponentSize;
|
|
6
|
-
variant?:
|
|
6
|
+
variant?: ActionVariant;
|
|
7
7
|
disabled?: boolean;
|
|
8
8
|
style?: ViewStyle;
|
|
9
9
|
loading?: boolean;
|
|
10
10
|
}
|
|
11
11
|
interface ButtonThemeProps {
|
|
12
12
|
size: ComponentSize;
|
|
13
|
-
variant:
|
|
13
|
+
variant: ActionVariant;
|
|
14
14
|
disabled?: boolean;
|
|
15
|
+
loading: boolean;
|
|
15
16
|
}
|
|
16
17
|
interface PressableCoreProps extends PressableProps, Omit<ButtonProps, "style"> {
|
|
17
18
|
disabled?: boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ComponentType } from 'react';
|
|
2
2
|
import { ViewProps, TextProps, TextInputProps } from 'react-native';
|
|
3
3
|
import { IconProps } from '@impulse-ui-native/icon/types';
|
|
4
|
-
import { ComponentSize,
|
|
4
|
+
import { ComponentSize, FieldVariant } from '@impulse-ui-native/theme';
|
|
5
5
|
import { SpinnerProps } from './spinner.types.mjs';
|
|
6
6
|
import { PressableCoreProps } from './button.types.mjs';
|
|
7
7
|
|
|
@@ -17,7 +17,7 @@ interface ControlComponentCommonProps {
|
|
|
17
17
|
}
|
|
18
18
|
interface ControlComponentProps {
|
|
19
19
|
size: ComponentSize;
|
|
20
|
-
variant:
|
|
20
|
+
variant: FieldVariant;
|
|
21
21
|
error: string | undefined;
|
|
22
22
|
disabled: boolean | undefined;
|
|
23
23
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IconProps } from '@impulse-ui-native/icon/types';
|
|
2
|
-
import { ComponentSize,
|
|
2
|
+
import { ComponentSize, ActionVariant } from '@impulse-ui-native/theme';
|
|
3
3
|
import { ButtonProps } from './button.types.mjs';
|
|
4
4
|
import 'react-native';
|
|
5
5
|
|
|
@@ -8,8 +8,9 @@ interface IconButtonProps extends ButtonProps {
|
|
|
8
8
|
}
|
|
9
9
|
interface IconButtonThemeProps {
|
|
10
10
|
size: ComponentSize;
|
|
11
|
-
variant:
|
|
11
|
+
variant: ActionVariant;
|
|
12
12
|
disabled?: boolean;
|
|
13
|
+
loading: boolean;
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
export type { IconButtonProps, IconButtonThemeProps };
|
package/dist/types/index.d.mts
CHANGED
|
@@ -11,6 +11,7 @@ export { ProgressProps } from './progress.types.mjs';
|
|
|
11
11
|
export { SpinnerProps } from './spinner.types.mjs';
|
|
12
12
|
export { TagProps, TagThemeProps } from './tag.types.mjs';
|
|
13
13
|
export { ControlAddonProps, ControlComponentCommonProps, ControlComponentProps, ControlContainerProps, ControlContextData, ControlErrorLabelProps, ControlInputProps, ControlLabelProps, ControlLoaderProps, ControlPlaceholderProps, ControlValueProps } from './control-components.types.mjs';
|
|
14
|
+
export { ListContentProps, ListItemProps, ListLeadingProps, ListPressableProps, ListRootProps, ListTrailingProps } from './list.types.mjs';
|
|
14
15
|
import 'react';
|
|
15
16
|
import 'react-native';
|
|
16
17
|
import '@impulse-ui-native/theme';
|
package/dist/types/index.js
CHANGED
package/dist/types/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/types/index.ts"],"sourcesContent":["export * from \"./avatar.types\";\nexport * from \"./badge.types\";\nexport * from \"./view.types\";\nexport * from \"./safe-area-view.types\";\nexport * from \"./typography.types\";\nexport * from \"./typography.types\";\nexport * from \"./button.types\";\nexport * from \"./card.types\";\nexport * from \"./divider.types\";\nexport * from \"./icon-button.types\";\nexport * from \"./progress.types\";\nexport * from \"./spinner.types\";\nexport * from \"./tag.types\";\nexport * from \"./control-components.types\";\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/types/index.ts"],"sourcesContent":["export * from \"./avatar.types\";\nexport * from \"./badge.types\";\nexport * from \"./view.types\";\nexport * from \"./safe-area-view.types\";\nexport * from \"./typography.types\";\nexport * from \"./typography.types\";\nexport * from \"./button.types\";\nexport * from \"./card.types\";\nexport * from \"./divider.types\";\nexport * from \"./icon-button.types\";\nexport * from \"./progress.types\";\nexport * from \"./spinner.types\";\nexport * from \"./tag.types\";\nexport * from \"./control-components.types\";\n\nexport * from \"./list.types\";\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAEd,cAAc;","names":[]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { PressableCoreProps } from './button.types.mjs';
|
|
3
|
+
import { ViewProps } from './view.types.mjs';
|
|
4
|
+
import 'react-native';
|
|
5
|
+
import '@impulse-ui-native/theme';
|
|
6
|
+
|
|
7
|
+
interface ListRootProps extends ViewProps {
|
|
8
|
+
}
|
|
9
|
+
interface ListItemProps extends ViewProps {
|
|
10
|
+
}
|
|
11
|
+
interface ListPressableProps extends Omit<PressableCoreProps, "children" | "size" | "variant" | "loading"> {
|
|
12
|
+
children?: ReactNode;
|
|
13
|
+
}
|
|
14
|
+
interface ListLeadingProps extends ViewProps {
|
|
15
|
+
}
|
|
16
|
+
interface ListContentProps extends ViewProps {
|
|
17
|
+
}
|
|
18
|
+
interface ListTrailingProps extends ViewProps {
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type { ListContentProps, ListItemProps, ListLeadingProps, ListPressableProps, ListRootProps, ListTrailingProps };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=list.types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ViewStyle, PressableProps } from 'react-native';
|
|
2
|
-
import { ComponentSize,
|
|
2
|
+
import { ComponentSize, DisplayVariant, TagColor } from '@impulse-ui-native/theme';
|
|
3
3
|
|
|
4
4
|
interface TagProps {
|
|
5
5
|
label: string;
|
|
6
6
|
size?: ComponentSize;
|
|
7
|
-
variant?:
|
|
7
|
+
variant?: DisplayVariant;
|
|
8
8
|
color?: TagColor;
|
|
9
9
|
closable?: boolean;
|
|
10
10
|
disabled?: boolean;
|
|
@@ -14,7 +14,7 @@ interface TagProps {
|
|
|
14
14
|
}
|
|
15
15
|
interface TagThemeProps {
|
|
16
16
|
size: ComponentSize;
|
|
17
|
-
variant:
|
|
17
|
+
variant: DisplayVariant;
|
|
18
18
|
color: TagColor;
|
|
19
19
|
disabled?: boolean;
|
|
20
20
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@impulse-ui-native/primitives",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.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/theme": "
|
|
32
|
-
"@impulse-ui-native/icon": "
|
|
33
|
-
"@impulse-ui-native/core": "
|
|
31
|
+
"@impulse-ui-native/theme": "5.0.0",
|
|
32
|
+
"@impulse-ui-native/icon": "5.0.0",
|
|
33
|
+
"@impulse-ui-native/core": "5.0.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/react": "~19.2.14",
|
|
@@ -41,9 +41,9 @@
|
|
|
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/prettier-config": "1.0.0",
|
|
44
45
|
"@impulse-ui-native/eslint-config": "1.0.0",
|
|
45
|
-
"@impulse-ui-native/tsconfig": "1.0.0"
|
|
46
|
-
"@impulse-ui-native/prettier-config": "1.0.0"
|
|
46
|
+
"@impulse-ui-native/tsconfig": "1.0.0"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"react": ">=18",
|