@impulse-ui-native/theme 1.0.10 → 2.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.
Files changed (42) hide show
  1. package/dist/index.d.mts +446 -101
  2. package/dist/index.js +1052 -0
  3. package/dist/index.js.map +1 -0
  4. package/package.json +21 -16
  5. package/dist/index.cjs.js +0 -429
  6. package/dist/index.cjs.js.map +0 -1
  7. package/dist/index.d.ts +0 -209
  8. package/dist/index.esm.js +0 -406
  9. package/dist/index.esm.js.map +0 -1
  10. package/src/constants/index.ts +0 -2
  11. package/src/constants/style.constants.ts +0 -80
  12. package/src/constants/typography.constants.ts +0 -25
  13. package/src/hooks/index.ts +0 -8
  14. package/src/hooks/use-border.hook.ts +0 -10
  15. package/src/hooks/use-colors.hook.ts +0 -10
  16. package/src/hooks/use-components-theme.hook.ts +0 -13
  17. package/src/hooks/use-radii.hook.ts +0 -10
  18. package/src/hooks/use-space.hook.ts +0 -10
  19. package/src/hooks/use-style-props.hook.ts +0 -9
  20. package/src/hooks/use-theme.hook.ts +0 -10
  21. package/src/hooks/use-themed-styles.ts +0 -25
  22. package/src/index.ts +0 -6
  23. package/src/providers/index.ts +0 -1
  24. package/src/providers/theme.provider.tsx +0 -113
  25. package/src/theme/dark.theme.ts +0 -40
  26. package/src/theme/index.ts +0 -4
  27. package/src/theme/light.theme.ts +0 -40
  28. package/src/theme/tokens.theme.ts +0 -64
  29. package/src/types/border.types.ts +0 -8
  30. package/src/types/color.types.ts +0 -7
  31. package/src/types/components.types.ts +0 -1
  32. package/src/types/dimension.types.ts +0 -11
  33. package/src/types/flex.types.ts +0 -27
  34. package/src/types/index.ts +0 -11
  35. package/src/types/shadow.types.ts +0 -9
  36. package/src/types/spacing.types.ts +0 -19
  37. package/src/types/style.types.ts +0 -19
  38. package/src/types/theme-provider.types.ts +0 -65
  39. package/src/types/tokens.types.ts +0 -88
  40. package/src/types/typography.types.ts +0 -66
  41. package/src/utils/index.ts +0 -1
  42. package/src/utils/style.utils.ts +0 -31
@@ -1,19 +0,0 @@
1
- import { BorderProps } from "./border.types";
2
- import { ColorProps } from "./color.types";
3
- import { DimensionProps } from "./dimension.types";
4
- import { FlexProps } from "./flex.types";
5
- import { ShadowProps } from "./shadow.types";
6
- import { SpacingProps } from "./spacing.types";
7
- import { TypographyProps } from "./typography.types";
8
-
9
- export type StyleProps = Partial<
10
- SpacingProps &
11
- ColorProps &
12
- ShadowProps &
13
- BorderProps &
14
- TypographyProps &
15
- FlexProps &
16
- DimensionProps
17
- >;
18
-
19
- export type StylePropKey = keyof StyleProps;
@@ -1,65 +0,0 @@
1
- import { DeepPartial } from "@impulse-ui-native/core";
2
-
3
- import {
4
- BorderSizes,
5
- FontSizes,
6
- NeutralColors,
7
- Radii,
8
- Space,
9
- } from "./tokens.types";
10
- import {
11
- FontWeightKey,
12
- TypographyPresetKey,
13
- TypographyProps,
14
- } from "./typography.types";
15
-
16
- export interface ThemeContextData {
17
- loaded: boolean;
18
- theme: AppTheme;
19
- components?: DeepPartial<ComponentsThemes>;
20
- }
21
-
22
- export type ColorScheme = "light" | "dark";
23
-
24
- export type ThemeColors = {
25
- primary: string;
26
- secondary: string;
27
- neutral: NeutralColors;
28
-
29
- white: string;
30
- black: string;
31
-
32
- error: string;
33
- warning: string;
34
- success: string;
35
- info: string;
36
-
37
- text: {
38
- primary: string;
39
- secondary: string;
40
- };
41
-
42
- background: {
43
- primary: string;
44
- secondary: string;
45
- };
46
- } & ExtendedThemeColors;
47
-
48
- export interface ExtendedThemeColors {}
49
-
50
- export interface ComponentsThemes {
51
- typography: Record<TypographyPresetKey, TypographyProps>;
52
- }
53
-
54
- export interface AppTheme {
55
- colors: ThemeColors;
56
- spacing: Space;
57
- radii: Radii;
58
- borderSize: BorderSizes;
59
- fontWeights: Record<"normal" | "italic", Record<FontWeightKey, string>>;
60
- fontSize: FontSizes;
61
- }
62
-
63
- export type CustomComponentsTheme =
64
- | ((theme: AppTheme) => DeepPartial<ComponentsThemes>)
65
- | DeepPartial<ComponentsThemes>;
@@ -1,88 +0,0 @@
1
- import { DimensionValue } from "react-native";
2
-
3
- export type SpaceSizesKeys =
4
- | "none"
5
- | "auto"
6
- | "xxs"
7
- | "xs"
8
- | "mxs"
9
- | "sm"
10
- | "msm"
11
- | "md"
12
- | "lg"
13
- | "xl"
14
- | "xxl";
15
- export type Space = Record<SpaceSizesKeys, DimensionValue>;
16
-
17
- export type FontSizesKeys =
18
- | "xxs"
19
- | "xs"
20
- | "xsm"
21
- | "sm"
22
- | "md"
23
- | "lg"
24
- | "xl"
25
- | "xxl"
26
- | "xxxl"
27
- | "huge"
28
- | "massive";
29
- export type FontSizes = Record<FontSizesKeys, number>;
30
-
31
- export type LineHeightKeys = "xxs" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
32
- export type LineHeights = Record<LineHeightKeys, string>;
33
-
34
- export type LetterSpacingKey =
35
- | "tightest"
36
- | "tighter"
37
- | "tight"
38
- | "normal"
39
- | "wide"
40
- | "wider"
41
- | "widest"
42
- | "ultraWide";
43
- export type LetterSpacings = Record<LetterSpacingKey, number>;
44
-
45
- export type BorderSizeKey = "sm" | "md" | "lg" | "xl" | "xxl";
46
- export type BorderSizes = Record<BorderSizeKey, number>;
47
-
48
- export type RadiusKey = "sm" | "md" | "lg" | "xl" | "xxl" | "xxxl" | "round";
49
- export type Radii = Record<RadiusKey, number>;
50
-
51
- export type RadiusDrawnKey =
52
- | "drawn1"
53
- | "drawn2"
54
- | "drawn3"
55
- | "drawn4"
56
- | "drawn5"
57
- | "drawn6";
58
- export type RadiiDrawn = Record<RadiusDrawnKey, string>;
59
-
60
- export type RadiusBlobKey = "blob1" | "blob2" | "blob3" | "blob4" | "blob5";
61
- export type RadiiBlob = Record<RadiusBlobKey, string>;
62
-
63
- export type RadiusConditionalKey =
64
- | "conditional1"
65
- | "conditional2"
66
- | "conditional3"
67
- | "conditional4"
68
- | "conditional5"
69
- | "conditional6";
70
- export type RadiiConditional = Record<RadiusConditionalKey, string>;
71
-
72
- export type NeutralColorKey =
73
- | "0"
74
- | "1"
75
- | "2"
76
- | "3"
77
- | "4"
78
- | "5"
79
- | "6"
80
- | "7"
81
- | "8"
82
- | "9"
83
- | "10"
84
- | "11"
85
- | "12"
86
- | "13";
87
-
88
- export type NeutralColors = Record<NeutralColorKey, string>;
@@ -1,66 +0,0 @@
1
- import { TextStyle } from "react-native";
2
-
3
- export type TypographyProps = {
4
- fontSize?: TextStyle["fontSize"];
5
- fontFamily?: TextStyle["fontFamily"];
6
- fontWeight?: FontWeightKey;
7
- fontStyle?: TextStyle["fontStyle"];
8
- letterSpacing?: TextStyle["letterSpacing"];
9
- lineHeight?: TextStyle["lineHeight"];
10
- textAlign?: TextStyle["textAlign"];
11
- textDecorationLine?: TextStyle["textDecorationLine"];
12
- textDecorationStyle?: TextStyle["textDecorationStyle"];
13
- textDecorationColor?: TextStyle["textDecorationColor"];
14
- textTransform?: TextStyle["textTransform"];
15
- includeFontPadding?: TextStyle["includeFontPadding"]; // Android only
16
- textAlignVertical?: TextStyle["textAlignVertical"]; // Android only
17
- writingDirection?: TextStyle["writingDirection"];
18
- };
19
-
20
- export type TypographyPresetKey =
21
- | "Master"
22
- | "DisplayLarge"
23
- | "DisplayMedium"
24
- | "DisplaySmall"
25
- | "Title1"
26
- | "Title2"
27
- | "Title3"
28
- | "Title4"
29
- | "Title5"
30
- | "Title6"
31
- | "Subtitle1"
32
- | "Subtitle2"
33
- | "BodyLarge"
34
- | "Body"
35
- | "BodySmall"
36
- | "Caption"
37
- | "Label"
38
- | "Overline"
39
- | "Helper"
40
- | "Code"
41
- | "Quote"
42
- | "Eyebrow";
43
-
44
- export type FontWeightNormal =
45
- | "Montserrat_100Thin"
46
- | "Montserrat_200ExtraLight"
47
- | "Montserrat_300Light"
48
- | "Montserrat_400Regular"
49
- | "Montserrat_500Medium"
50
- | "Montserrat_600SemiBold"
51
- | "Montserrat_700Bold"
52
- | "Montserrat_800ExtraBold"
53
- | "Montserrat_900Black";
54
-
55
- export type FontWeightItalic =
56
- | "Montserrat_100Thin_Italic"
57
- | "Montserrat_200ExtraLight_Italic"
58
- | "Montserrat_300Light_Italic"
59
- | "Montserrat_400Regular_Italic"
60
- | "Montserrat_500Medium_Italic"
61
- | "Montserrat_600SemiBold_Italic"
62
- | "Montserrat_700Bold_Italic"
63
- | "Montserrat_800ExtraBold_Italic"
64
- | "Montserrat_900Black_Italic";
65
-
66
- export type FontWeightKey = 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900;
@@ -1 +0,0 @@
1
- export * from './style.utils';
@@ -1,31 +0,0 @@
1
- import { StylePropsSet } from '../constants';
2
- import { StylePropKey, StyleProps } from '../types';
3
-
4
- const isStylePropKey = (k: string): k is StylePropKey =>
5
- StylePropsSet.has(k as StylePropKey);
6
-
7
- export const extractStyleProps = <Props extends object>(
8
- props: Props
9
- ): StyleProps => {
10
- const style: StyleProps = {};
11
-
12
- for (const k in props) {
13
- if (isStylePropKey(k) && props[k] !== undefined) {
14
- style[k] = props[k] as any;
15
- }
16
- }
17
-
18
- return style;
19
- };
20
-
21
- export const createStyleKey = <Props extends object>(props: Props) => {
22
- let key = '';
23
-
24
- for (const k in props) {
25
- if (isStylePropKey(k)) {
26
- key += String(props[k as keyof Props]);
27
- }
28
- }
29
-
30
- return key;
31
- };