react-native-mantine 0.4.0 → 0.5.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 (45) hide show
  1. package/lib/commonjs/components/Button/Button.styles.js +2 -43
  2. package/lib/commonjs/components/Button/Button.styles.js.map +1 -1
  3. package/lib/commonjs/components/Button/index.js +3 -25
  4. package/lib/commonjs/components/Button/index.js.map +1 -1
  5. package/lib/commonjs/components/Input/Input.styles.js +2 -204
  6. package/lib/commonjs/components/Input/Input.styles.js.map +1 -1
  7. package/lib/commonjs/components/Input/index.js +1 -1
  8. package/lib/commonjs/hooks/useCachedResources.js +1 -4
  9. package/lib/commonjs/hooks/useCachedResources.js.map +1 -1
  10. package/lib/commonjs/theme/theme-provider.js +6 -8
  11. package/lib/commonjs/theme/theme-provider.js.map +1 -1
  12. package/lib/module/components/Button/Button.styles.js +2 -43
  13. package/lib/module/components/Button/Button.styles.js.map +1 -1
  14. package/lib/module/components/Button/index.js +3 -25
  15. package/lib/module/components/Button/index.js.map +1 -1
  16. package/lib/module/components/Input/Input.styles.js +1 -203
  17. package/lib/module/components/Input/Input.styles.js.map +1 -1
  18. package/lib/module/components/Input/index.js +1 -1
  19. package/lib/module/components/Input/index.js.map +1 -1
  20. package/lib/module/hooks/useCachedResources.js +1 -4
  21. package/lib/module/hooks/useCachedResources.js.map +1 -1
  22. package/lib/module/theme/theme-provider.js +6 -8
  23. package/lib/module/theme/theme-provider.js.map +1 -1
  24. package/lib/typescript/commonjs/src/components/Button/Button.styles.d.ts.map +1 -1
  25. package/lib/typescript/commonjs/src/components/Button/index.d.ts.map +1 -1
  26. package/lib/typescript/commonjs/src/components/Input/Input.styles.d.ts +7 -0
  27. package/lib/typescript/commonjs/src/components/Input/Input.styles.d.ts.map +1 -1
  28. package/lib/typescript/commonjs/src/components/Input/index.d.ts +1 -1
  29. package/lib/typescript/commonjs/src/components/Input/index.d.ts.map +1 -1
  30. package/lib/typescript/commonjs/src/hooks/useCachedResources.d.ts.map +1 -1
  31. package/lib/typescript/module/src/components/Button/Button.styles.d.ts.map +1 -1
  32. package/lib/typescript/module/src/components/Button/index.d.ts.map +1 -1
  33. package/lib/typescript/module/src/components/Input/Input.styles.d.ts +7 -0
  34. package/lib/typescript/module/src/components/Input/Input.styles.d.ts.map +1 -1
  35. package/lib/typescript/module/src/components/Input/index.d.ts +1 -1
  36. package/lib/typescript/module/src/components/Input/index.d.ts.map +1 -1
  37. package/lib/typescript/module/src/hooks/useCachedResources.d.ts.map +1 -1
  38. package/package.json +1 -1
  39. package/src/components/Button/Button.styles.ts +2 -45
  40. package/src/components/Button/index.tsx +1 -21
  41. package/src/components/Input/Input.styles.ts +1 -202
  42. package/src/components/Input/index.ts +1 -1
  43. package/src/hooks/useCachedResources.ts +1 -4
  44. package/src/theme/theme-provider.tsx +6 -6
  45. package/src/theme/types/MantineStyleSystem.ts +0 -53
@@ -81,7 +81,6 @@ const defaultProps: Partial<ButtonProps> = {
81
81
  export const _Button = forwardRef<View, ButtonProps>(
82
82
  (props, ref) => {
83
83
  const {
84
- // className,
85
84
  size,
86
85
  color,
87
86
  type,
@@ -98,9 +97,6 @@ export const _Button = forwardRef<View, ButtonProps>(
98
97
  loaderPosition,
99
98
  loaderProps,
100
99
  gradient,
101
- // classNames,
102
- // styles,
103
- // unstyled,
104
100
  style,
105
101
  ...others
106
102
  } = useComponentDefaultProps('Button', defaultProps, props);
@@ -117,33 +113,20 @@ export const _Button = forwardRef<View, ButtonProps>(
117
113
  },
118
114
  {
119
115
  name: 'Button',
120
- // unstyled, classNames, styles,
121
116
  variant,
122
117
  size,
123
118
  }
124
119
  );
125
120
 
126
- // const colors = theme.fn.variant({ color, variant });
127
-
128
- // const loader = (
129
- // <Loader
130
- // color={colors.color}
131
- // size={`calc(${(getSize({ size, sizes }) as any).height} / 2)`}
132
- // {...loaderProps}
133
- // />
134
- // );
135
121
  const loader = <ActivityIndicator />;
136
122
 
137
123
  return (
138
124
  <UnstyledButton
139
125
  style={sx(styles.root, style)}
140
- // type={type}
141
- // disabled={disabled}
142
126
  data-button
143
127
  data-disabled={disabled || undefined}
144
128
  data-loading={loading || undefined}
145
129
  ref={ref}
146
- // unstyled={unstyled}
147
130
  {...others}
148
131
  >
149
132
  <BoxView style={styles.inner}>
@@ -157,10 +140,7 @@ export const _Button = forwardRef<View, ButtonProps>(
157
140
  <BoxView style={styles.centerLoader}>{loader}</BoxView>
158
141
  )}
159
142
 
160
- <BoxView
161
- style={styles.label}
162
- // style={{ textTransform: uppercase ? 'uppercase' : undefined }}
163
- >
143
+ <BoxView style={styles.label}>
164
144
  {typeof children === 'string' || typeof children === 'number' ? (
165
145
  <Text>{children}</Text>
166
146
  ) : (
@@ -21,205 +21,4 @@ export const sizes = {
21
21
  xl: rem(60),
22
22
  };
23
23
 
24
- // const INPUT_VARIANTS = ['default', 'filled', 'unstyled'];
25
-
26
- // interface GetVariantStylesInput {
27
- // theme: MantineTheme;
28
- // variant: string;
29
- // }
30
-
31
- // function getVariantStyles({ theme, variant }: GetVariantStylesInput) {
32
- // if (!INPUT_VARIANTS.includes(variant)) {
33
- // return null;
34
- // }
35
-
36
- // if (variant === 'default') {
37
- // return {
38
- // 'border': `${rem(1)} solid ${
39
- // theme.colorScheme === 'dark'
40
- // ? theme.colors.dark[4]
41
- // : theme.colors.gray[4]
42
- // }`,
43
- // 'backgroundColor':
44
- // theme.colorScheme === 'dark' ? theme.colors.dark[6] : theme.white,
45
- // 'transition': 'border-color 100ms ease',
46
- // '&:focus, &:focus-within': theme.focusRingStyles.inputStyles(theme),
47
- // };
48
- // }
49
-
50
- // if (variant === 'filled') {
51
- // return {
52
- // 'border': `${rem(1)} solid transparent`,
53
- // 'backgroundColor':
54
- // theme.colorScheme === 'dark'
55
- // ? theme.colors.dark[5]
56
- // : theme.colors.gray[1],
57
- // '&:focus, &:focus-within': theme.focusRingStyles.inputStyles(theme),
58
- // };
59
- // }
60
-
61
- // return {
62
- // 'borderWidth': 0,
63
- // 'color': theme.colorScheme === 'dark' ? theme.colors.dark[0] : theme.black,
64
- // 'backgroundColor': 'transparent',
65
- // 'minHeight': rem(28),
66
- // 'outline': 0,
67
-
68
- // '&:focus, &:focus-within': {
69
- // outline: 'none',
70
- // borderColor: 'transparent',
71
- // },
72
-
73
- // '&:disabled': {
74
- // 'backgroundColor': 'transparent',
75
-
76
- // '&:focus, &:focus-within': {
77
- // outline: 'none',
78
- // borderColor: 'transparent',
79
- // },
80
- // },
81
- // };
82
- // }
83
-
84
- // export default createStyles(
85
- // (
86
- // theme,
87
- // {
88
- // multiline,
89
- // radius,
90
- // invalid,
91
- // rightSectionWidth,
92
- // withRightSection,
93
- // iconWidth,
94
- // offsetBottom,
95
- // offsetTop,
96
- // pointer,
97
- // }: InputStylesParams,
98
- // { variant, size }
99
- // ) => {
100
- // const invalidColor = theme.fn.variant({
101
- // variant: 'filled',
102
- // color: 'red',
103
- // }).background;
104
- // const sizeStyles =
105
- // variant === 'default' || variant === 'filled'
106
- // ? {
107
- // minHeight: getSize({ size, sizes }),
108
- // paddingLeft: `calc(${getSize({ size, sizes })} / 3)`,
109
- // paddingRight: withRightSection
110
- // ? rightSectionWidth || getSize({ size, sizes })
111
- // : `calc(${getSize({ size, sizes })} / 3)`,
112
- // borderRadius: theme.fn.radius(radius),
113
- // }
114
- // : null;
115
-
116
- // return {
117
- // wrapper: {
118
- // position: 'relative',
119
- // marginTop: offsetTop ? `calc(${theme.spacing.xs} / 2)` : undefined,
120
- // marginBottom: offsetBottom
121
- // ? `calc(${theme.spacing.xs} / 2)`
122
- // : undefined,
123
- // },
124
-
125
- // input: {
126
- // ...theme.fn.fontStyles(),
127
- // 'height': multiline
128
- // ? variant === 'unstyled'
129
- // ? undefined
130
- // : 'auto'
131
- // : getSize({ size, sizes }),
132
- // 'WebkitTapHighlightColor': 'transparent',
133
- // 'lineHeight': multiline
134
- // ? theme.lineHeight
135
- // : `calc(${getSize({ size, sizes })} - ${rem(2)})`,
136
- // 'appearance': 'none',
137
- // 'resize': 'none',
138
- // 'boxSizing': 'border-box',
139
- // 'fontSize': getSize({ size, sizes: theme.fontSizes }),
140
- // 'width': '100%',
141
- // 'color':
142
- // theme.colorScheme === 'dark' ? theme.colors.dark[0] : theme.black,
143
- // 'display': 'block',
144
- // 'textAlign': 'left',
145
- // 'cursor': pointer ? 'pointer' : undefined,
146
- // ...getVariantStyles({ theme, variant }),
147
- // ...sizeStyles,
148
-
149
- // '&:disabled, &[data-disabled]': {
150
- // 'backgroundColor':
151
- // theme.colorScheme === 'dark'
152
- // ? theme.colors.dark[6]
153
- // : theme.colors.gray[1],
154
- // 'color': theme.colors.dark[2],
155
- // 'opacity': 0.6,
156
- // 'cursor': 'not-allowed',
157
-
158
- // '&::placeholder': {
159
- // color: theme.colors.dark[2],
160
- // },
161
- // },
162
-
163
- // '&[data-invalid]': {
164
- // 'color': invalidColor,
165
- // 'borderColor': invalidColor,
166
-
167
- // '&::placeholder': {
168
- // opacity: 1,
169
- // color: invalidColor,
170
- // },
171
- // },
172
-
173
- // '&[data-with-icon]': {
174
- // paddingLeft:
175
- // typeof iconWidth === 'number'
176
- // ? rem(iconWidth)
177
- // : getSize({ size, sizes }),
178
- // },
179
-
180
- // '&::placeholder': {
181
- // ...theme.fn.placeholderStyles(),
182
- // opacity: 1,
183
- // },
184
-
185
- // '&::-webkit-inner-spin-button, &::-webkit-outer-spin-button, &::-webkit-search-decoration, &::-webkit-search-cancel-button, &::-webkit-search-results-button, &::-webkit-search-results-decoration':
186
- // {
187
- // appearance: 'none',
188
- // },
189
-
190
- // '&[type=number]': {
191
- // MozAppearance: 'textfield',
192
- // },
193
- // },
194
-
195
- // icon: {
196
- // pointerEvents: 'none',
197
- // position: 'absolute',
198
- // zIndex: 1,
199
- // left: 0,
200
- // top: 0,
201
- // bottom: 0,
202
- // display: 'flex',
203
- // alignItems: 'center',
204
- // justifyContent: 'center',
205
- // width: iconWidth ? rem(iconWidth) : getSize({ size, sizes }),
206
- // color: invalid
207
- // ? theme.colors.red[theme.colorScheme === 'dark' ? 6 : 7]
208
- // : theme.colorScheme === 'dark'
209
- // ? theme.colors.dark[2]
210
- // : theme.colors.gray[5],
211
- // },
212
-
213
- // rightSection: {
214
- // position: 'absolute',
215
- // top: 0,
216
- // bottom: 0,
217
- // right: 0,
218
- // display: 'flex',
219
- // alignItems: 'center',
220
- // justifyContent: 'center',
221
- // width: rightSectionWidth || getSize({ size, sizes }),
222
- // },
223
- // };
224
- // }
225
- // );
24
+ export const INPUT_SIZES = sizes;
@@ -1 +1 @@
1
- export { sizes as INPUT_SIZES } from './Input.styles';
1
+ export { INPUT_SIZES } from './Input.styles';
@@ -8,16 +8,13 @@ export default function useCachedResources(): boolean {
8
8
  useEffect(() => {
9
9
  async function loadResourcesAndDataAsync(): Promise<void> {
10
10
  try {
11
- // SplashScreen.preventAutoHideAsync()
12
- // Load fonts
13
11
  await Font.loadAsync({
14
12
  Nunito: require('../fonts/Nunito-Regular.ttf'),
15
13
  'Nunito Bold': require('../fonts/Nunito-Bold.ttf'),
16
14
  'Nunito SemiBold': require('../fonts/Nunito-SemiBold.ttf'),
17
15
  })
18
16
  } catch (e) {
19
- // We might want to provide this error information to an error reporting service
20
- // console.warn(e)
17
+ // Error silently ignored - consider adding error reporting in production
21
18
  } finally {
22
19
  setLoadingComplete(true)
23
20
  }
@@ -6,7 +6,7 @@ import React, {
6
6
  useMemo,
7
7
  useState,
8
8
  } from 'react';
9
- import { Appearance, Platform } from 'react-native';
9
+ import { ActivityIndicator, Appearance, Platform } from 'react-native';
10
10
 
11
11
  import type { ColorSchemeName } from 'react-native';
12
12
 
@@ -17,7 +17,7 @@ import type { MantineTheme } from './default-theme';
17
17
  import { createTheme } from './create-theme';
18
18
 
19
19
  import { filterProps } from './filter-props';
20
- // import useCachedResources from '../hooks/useCachedResources';
20
+ import useCachedResources from '../hooks/useCachedResources';
21
21
 
22
22
  type ThemeProps = {
23
23
  children: ReactNode;
@@ -94,15 +94,15 @@ export const Theme = ({
94
94
  theme: themeOverwrite,
95
95
  forceMode,
96
96
  }: ThemeProps): React.ReactElement => {
97
- // const loaded = useCachedResources();
97
+ const loaded = useCachedResources();
98
98
 
99
99
  const theme = useMemo(() => {
100
100
  return createTheme(themeOverwrite);
101
101
  }, [themeOverwrite]);
102
102
 
103
- // if (!loaded) {
104
- // return <ActivityIndicator />;
105
- // }
103
+ if (!loaded) {
104
+ return <ActivityIndicator />;
105
+ }
106
106
  return (
107
107
  <ThemeProvider theme={theme} forceMode={forceMode}>
108
108
  {children}
@@ -7,56 +7,3 @@ export type SystemProp<Value> =
7
7
  export type SpacingValue = MantineNumberSize | (string & {});
8
8
 
9
9
  export type MantineStyleSystemProps = any;
10
-
11
- // export interface MantineStyleSystemProps {
12
- // m?: SystemProp<SpacingValue>;
13
- // my?: SystemProp<SpacingValue>;
14
- // mx?: SystemProp<SpacingValue>;
15
- // mt?: SystemProp<SpacingValue>;
16
- // mb?: SystemProp<SpacingValue>;
17
- // ml?: SystemProp<SpacingValue>;
18
- // mr?: SystemProp<SpacingValue>;
19
-
20
- // p?: SystemProp<SpacingValue>;
21
- // py?: SystemProp<SpacingValue>;
22
- // px?: SystemProp<SpacingValue>;
23
- // pt?: SystemProp<SpacingValue>;
24
- // pb?: SystemProp<SpacingValue>;
25
- // pl?: SystemProp<SpacingValue>;
26
- // pr?: SystemProp<SpacingValue>;
27
-
28
- // bg?: SystemProp<MantineColor>;
29
- // c?: SystemProp<MantineColor>;
30
- // opacity?: SystemProp<CSSProperties['opacity']>;
31
-
32
- // ff?: SystemProp<CSSProperties['fontFamily']>;
33
- // fz?: SystemProp<SpacingValue>;
34
- // fw?: SystemProp<CSSProperties['fontWeight']>;
35
- // lts?: SystemProp<CSSProperties['letterSpacing']>;
36
- // ta?: SystemProp<CSSProperties['textAlign']>;
37
- // lh?: SystemProp<CSSProperties['lineHeight']>;
38
- // fs?: SystemProp<CSSProperties['fontStyle']>;
39
- // tt?: SystemProp<CSSProperties['textTransform']>;
40
- // td?: SystemProp<CSSProperties['textDecoration']>;
41
-
42
- // w?: SystemProp<CSSProperties['width']>;
43
- // miw?: SystemProp<CSSProperties['minWidth']>;
44
- // maw?: SystemProp<CSSProperties['maxWidth']>;
45
- // h?: SystemProp<CSSProperties['height']>;
46
- // mih?: SystemProp<CSSProperties['minHeight']>;
47
- // mah?: SystemProp<CSSProperties['maxHeight']>;
48
-
49
- // bgsz?: SystemProp<CSSProperties['backgroundSize']>;
50
- // bgp?: SystemProp<CSSProperties['backgroundPosition']>;
51
- // bgr?: SystemProp<CSSProperties['backgroundRepeat']>;
52
- // bga?: SystemProp<CSSProperties['backgroundAttachment']>;
53
-
54
- // pos?: SystemProp<CSSProperties['position']>;
55
- // top?: SystemProp<CSSProperties['top']>;
56
- // left?: SystemProp<CSSProperties['left']>;
57
- // bottom?: SystemProp<CSSProperties['bottom']>;
58
- // right?: SystemProp<CSSProperties['right']>;
59
- // inset?: SystemProp<CSSProperties['inset']>;
60
-
61
- // display?: SystemProp<CSSProperties['display']>;
62
- // }