react-native-mantine 0.1.11 → 0.1.15
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/lib/commonjs/components/Button/Button.styles.js +224 -0
- package/lib/commonjs/components/Button/Button.styles.js.map +1 -0
- package/lib/commonjs/components/Button/index.js +108 -0
- package/lib/commonjs/components/Button/index.js.map +1 -0
- package/lib/commonjs/components/Input/Input.styles.js +218 -0
- package/lib/commonjs/components/Input/Input.styles.js.map +1 -0
- package/lib/commonjs/components/Input/index.js +13 -0
- package/lib/commonjs/components/Input/index.js.map +1 -0
- package/lib/commonjs/components/index.js +13 -2
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/theme/create-styles.js +2 -2
- package/lib/commonjs/theme/create-styles.js.map +1 -1
- package/lib/commonjs/theme/{generate-theme.js → create-theme.js} +4 -4
- package/lib/commonjs/theme/create-theme.js.map +1 -0
- package/lib/commonjs/theme/default-theme.js.map +1 -1
- package/lib/commonjs/theme/index.js +7 -0
- package/lib/commonjs/theme/index.js.map +1 -1
- package/lib/commonjs/theme/theme-provider.js +2 -2
- package/lib/commonjs/theme/theme-provider.js.map +1 -1
- package/lib/commonjs/theme/utils/rem.js +23 -0
- package/lib/commonjs/theme/utils/rem.js.map +1 -0
- package/lib/module/components/Button/Button.styles.js +220 -0
- package/lib/module/components/Button/Button.styles.js.map +1 -0
- package/lib/module/components/Button/index.js +101 -0
- package/lib/module/components/Button/index.js.map +1 -0
- package/lib/module/components/Input/Input.styles.js +214 -0
- package/lib/module/components/Input/Input.styles.js.map +1 -0
- package/lib/module/components/Input/index.js +4 -0
- package/lib/module/components/Input/index.js.map +1 -0
- package/lib/module/components/index.js +1 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/theme/create-styles.js +2 -2
- package/lib/module/theme/create-styles.js.map +1 -1
- package/lib/module/theme/{generate-theme.js → create-theme.js} +2 -2
- package/lib/module/theme/create-theme.js.map +1 -0
- package/lib/module/theme/default-theme.js.map +1 -1
- package/lib/module/theme/index.js +1 -0
- package/lib/module/theme/index.js.map +1 -1
- package/lib/module/theme/theme-provider.js +2 -2
- package/lib/module/theme/theme-provider.js.map +1 -1
- package/lib/module/theme/utils/rem.js +19 -0
- package/lib/module/theme/utils/rem.js.map +1 -0
- package/lib/typescript/commonjs/src/components/ActionIcon/ActionIcon.d.ts +1 -1
- package/lib/typescript/commonjs/src/components/ActionIcon/ActionIcon.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Button/Button.styles.d.ts +26 -0
- package/lib/typescript/commonjs/src/components/Button/Button.styles.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/Button/index.d.ts +42 -0
- package/lib/typescript/commonjs/src/components/Button/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/Input/Input.styles.d.ts +20 -0
- package/lib/typescript/commonjs/src/components/Input/Input.styles.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/Input/index.d.ts +2 -0
- package/lib/typescript/commonjs/src/components/Input/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/UnstyledButton/UnstyledButton.styles.d.ts +2 -2
- package/lib/typescript/commonjs/src/components/index.d.ts +1 -0
- package/lib/typescript/commonjs/src/components/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/theme/create-styles.d.ts +7 -3
- package/lib/typescript/commonjs/src/theme/create-styles.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/theme/create-theme.d.ts +3 -0
- package/lib/typescript/commonjs/src/theme/create-theme.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/theme/default-theme.d.ts +2 -2
- package/lib/typescript/commonjs/src/theme/default-theme.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/theme/index.d.ts +1 -0
- package/lib/typescript/commonjs/src/theme/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/theme/theme-provider.d.ts +4 -4
- package/lib/typescript/commonjs/src/theme/theme-provider.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/theme/types/DefaultProps.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/theme/utils/rem.d.ts +3 -0
- package/lib/typescript/commonjs/src/theme/utils/rem.d.ts.map +1 -0
- package/lib/typescript/module/src/components/ActionIcon/ActionIcon.d.ts +1 -1
- package/lib/typescript/module/src/components/ActionIcon/ActionIcon.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Button/Button.styles.d.ts +26 -0
- package/lib/typescript/module/src/components/Button/Button.styles.d.ts.map +1 -0
- package/lib/typescript/module/src/components/Button/index.d.ts +42 -0
- package/lib/typescript/module/src/components/Button/index.d.ts.map +1 -0
- package/lib/typescript/module/src/components/Input/Input.styles.d.ts +20 -0
- package/lib/typescript/module/src/components/Input/Input.styles.d.ts.map +1 -0
- package/lib/typescript/module/src/components/Input/index.d.ts +2 -0
- package/lib/typescript/module/src/components/Input/index.d.ts.map +1 -0
- package/lib/typescript/module/src/components/UnstyledButton/UnstyledButton.styles.d.ts +2 -2
- package/lib/typescript/module/src/components/index.d.ts +1 -0
- package/lib/typescript/module/src/components/index.d.ts.map +1 -1
- package/lib/typescript/module/src/theme/create-styles.d.ts +7 -3
- package/lib/typescript/module/src/theme/create-styles.d.ts.map +1 -1
- package/lib/typescript/module/src/theme/create-theme.d.ts +3 -0
- package/lib/typescript/module/src/theme/create-theme.d.ts.map +1 -0
- package/lib/typescript/module/src/theme/default-theme.d.ts +2 -2
- package/lib/typescript/module/src/theme/default-theme.d.ts.map +1 -1
- package/lib/typescript/module/src/theme/index.d.ts +1 -0
- package/lib/typescript/module/src/theme/index.d.ts.map +1 -1
- package/lib/typescript/module/src/theme/theme-provider.d.ts +4 -4
- package/lib/typescript/module/src/theme/theme-provider.d.ts.map +1 -1
- package/lib/typescript/module/src/theme/types/DefaultProps.d.ts.map +1 -1
- package/lib/typescript/module/src/theme/utils/rem.d.ts +3 -0
- package/lib/typescript/module/src/theme/utils/rem.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/components/ActionIcon/ActionIcon.tsx +1 -1
- package/src/components/Button/Button.styles.ts +232 -0
- package/src/components/Button/index.tsx +175 -0
- package/src/components/Input/Input.styles.ts +225 -0
- package/src/components/Input/index.ts +1 -0
- package/src/components/index.tsx +1 -0
- package/src/theme/create-styles.ts +15 -4
- package/src/theme/{generate-theme.ts → create-theme.ts} +3 -2
- package/src/theme/default-theme.ts +3 -3
- package/src/theme/index.tsx +1 -0
- package/src/theme/theme-provider.tsx +6 -6
- package/src/theme/theme.d.ts +2 -0
- package/src/theme/types/DefaultProps.ts +9 -4
- package/src/theme/utils/rem.ts +19 -0
- package/lib/commonjs/theme/generate-theme.js.map +0 -1
- package/lib/module/theme/generate-theme.js.map +0 -1
- package/lib/typescript/commonjs/src/theme/generate-theme.d.ts +0 -3
- package/lib/typescript/commonjs/src/theme/generate-theme.d.ts.map +0 -1
- package/lib/typescript/module/src/theme/generate-theme.d.ts +0 -3
- package/lib/typescript/module/src/theme/generate-theme.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/theme/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/theme/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { ReactNode } from 'react';
|
|
3
|
-
import type {
|
|
3
|
+
import type { MantineTheme } from './default-theme';
|
|
4
4
|
type ThemeProps = {
|
|
5
5
|
children: ReactNode;
|
|
6
|
-
theme?: Partial<
|
|
6
|
+
theme?: Partial<MantineTheme>;
|
|
7
7
|
forceMode?: 'light' | 'dark';
|
|
8
8
|
};
|
|
9
9
|
export declare const ThemeContext: React.Context<any>;
|
|
10
10
|
export declare const ThemeProvider: ({ children, theme, forceMode, }: {
|
|
11
11
|
children: React.ReactNode;
|
|
12
|
-
theme:
|
|
12
|
+
theme: MantineTheme;
|
|
13
13
|
forceMode?: "light" | "dark";
|
|
14
14
|
}) => React.ReactElement;
|
|
15
|
-
export declare const useTheme: () =>
|
|
15
|
+
export declare const useTheme: () => MantineTheme;
|
|
16
16
|
export declare const Theme: ({ children, theme: themeOverwrite, forceMode, }: ThemeProps) => React.ReactElement;
|
|
17
17
|
export declare function useComponentDefaultProps<T extends Record<string, any>, U extends Partial<T> = {}>(component: string, defaultProps: U, props: T): T & {
|
|
18
18
|
[Key in Extract<keyof T, keyof U>]-?: U[Key] | NonNullable<T[Key]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme-provider.d.ts","sourceRoot":"","sources":["../../../../../src/theme/theme-provider.tsx"],"names":[],"mappings":"AACA,OAAO,KAMN,MAAM,OAAO,CAAC;AAKf,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"theme-provider.d.ts","sourceRoot":"","sources":["../../../../../src/theme/theme-provider.tsx"],"names":[],"mappings":"AACA,OAAO,KAMN,MAAM,OAAO,CAAC;AAKf,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAMpD,KAAK,UAAU,GAAG;IAChB,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAC9B,SAAS,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;CAC9B,CAAC;AAEF,eAAO,MAAM,YAAY,oBAA2B,CAAC;AAErD,eAAO,MAAM,aAAa,oCAIvB;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,EAAE,YAAY,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;CAC9B,KAAG,KAAK,CAAC,YAkDT,CAAC;AAEF,eAAO,MAAM,QAAQ,QAAO,YAAwC,CAAC;AAErE,eAAO,MAAM,KAAK,oDAIf,UAAU,KAAG,KAAK,CAAC,YAerB,CAAC;AAEF,wBAAgB,wBAAwB,CACtC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC7B,CAAC,SAAS,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,EAEzB,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,CAAC,EACf,KAAK,EAAE,CAAC,GACP,CAAC,GAAG;KACJ,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;CACnE,CASA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultProps.d.ts","sourceRoot":"","sources":["../../../../../../src/theme/types/DefaultProps.ts"],"names":[],"mappings":"AAAA,KAAK,SAAS,GAAG,GAAG,
|
|
1
|
+
{"version":3,"file":"DefaultProps.d.ts","sourceRoot":"","sources":["../../../../../../src/theme/types/DefaultProps.ts"],"names":[],"mappings":"AAAA,KAAK,SAAS,GAAG,GAAG,CAAC;AACrB,MAAM,MAAM,UAAU,CAAC,WAAW,SAAS,MAAM,IAAI,OAAO,CAC1D,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,CAC5B,CAAC;AACF,MAAM,MAAM,MAAM,CAChB,WAAW,SAAS,MAAM,EAC1B,YAAY,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,KAAK,IAE9C,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC,GACvC,CAAC,CACC,KAAK,EAAE,GAAG,EACV,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,GAAG,KACT,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;AAElD,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,EAAE,GAAG,CAAC;CACb"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rem.d.ts","sourceRoot":"","sources":["../../../../../../src/theme/utils/rem.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,GAAG,OAhBF,OAAO,WAgBoB,CAAC;AAC1C,eAAO,MAAM,EAAE,OAjBD,OAAO,WAiBkB,CAAC"}
|
|
@@ -4,7 +4,7 @@ export type ActionIconProps = {
|
|
|
4
4
|
icon: React.ReactNode;
|
|
5
5
|
minWidth?: number;
|
|
6
6
|
style?: any;
|
|
7
|
-
size
|
|
7
|
+
size?: any;
|
|
8
8
|
};
|
|
9
9
|
export declare const ActionIcon: ({ onPress, children, icon, minWidth, style, size, }: ActionIconProps) => React.ReactElement;
|
|
10
10
|
export declare const sizes: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionIcon.d.ts","sourceRoot":"","sources":["../../../../../../src/components/ActionIcon/ActionIcon.tsx"],"names":[],"mappings":"AAMA,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,IAAI,CAAC;IACjC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,IAAI,EAAE,GAAG,CAAC;
|
|
1
|
+
{"version":3,"file":"ActionIcon.d.ts","sourceRoot":"","sources":["../../../../../../src/components/ActionIcon/ActionIcon.tsx"],"names":[],"mappings":"AAMA,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,IAAI,CAAC;IACjC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,IAAI,CAAC,EAAE,GAAG,CAAC;CACZ,CAAC;AAEF,eAAO,MAAM,UAAU,wDAOpB,eAAe,KAAG,KAAK,CAAC,YAa1B,CAAC;AAEF,eAAO,MAAM,KAAK;;;;;;CAMjB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { MantineColor, MantineNumberSize } from '../../theme/types';
|
|
2
|
+
export declare const BUTTON_VARIANTS: string[];
|
|
3
|
+
export interface ButtonStylesParams {
|
|
4
|
+
color: MantineColor;
|
|
5
|
+
radius: MantineNumberSize;
|
|
6
|
+
fullWidth: boolean;
|
|
7
|
+
compact: boolean;
|
|
8
|
+
withRightIcon: boolean;
|
|
9
|
+
withLeftIcon: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const sizes: any;
|
|
12
|
+
declare const useStyles: (params?: any, variations?: any) => {
|
|
13
|
+
styles: {
|
|
14
|
+
root: import("react-native").ViewStyle | import("react-native").TextStyle | import("react-native").ImageStyle;
|
|
15
|
+
icon: import("react-native").ViewStyle | import("react-native").TextStyle | import("react-native").ImageStyle;
|
|
16
|
+
leftIcon: import("react-native").ViewStyle | import("react-native").TextStyle | import("react-native").ImageStyle;
|
|
17
|
+
rightIcon: import("react-native").ViewStyle | import("react-native").TextStyle | import("react-native").ImageStyle;
|
|
18
|
+
centerLoader: import("react-native").ViewStyle | import("react-native").TextStyle | import("react-native").ImageStyle;
|
|
19
|
+
inner: import("react-native").ViewStyle | import("react-native").TextStyle | import("react-native").ImageStyle;
|
|
20
|
+
label: import("react-native").ViewStyle | import("react-native").TextStyle | import("react-native").ImageStyle;
|
|
21
|
+
};
|
|
22
|
+
theme: import("../../theme/default-theme").MantineTheme;
|
|
23
|
+
sx: (...args: any) => any;
|
|
24
|
+
};
|
|
25
|
+
export default useStyles;
|
|
26
|
+
//# sourceMappingURL=Button.styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.styles.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Button/Button.styles.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAIzE,eAAO,MAAM,eAAe,UAQ3B,CAAC;AAEF,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,YAAY,CAAC;IACpB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,OAAO,CAAC;IACvB,YAAY,EAAE,OAAO,CAAC;CACvB;AAED,eAAO,MAAM,KAAK,EAuBb,GAAG,CAAC;AA6ET,QAAA,MAAM,SAAS;;;;;;;;;;;;CA0Gd,CAAC;AACF,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { DefaultProps, MantineColor, MantineNumberSize, MantineSize, Variants } from '../../theme/types';
|
|
3
|
+
import type { MantineGradient } from '../../theme/theme';
|
|
4
|
+
import type { LoaderProps } from '../Loader';
|
|
5
|
+
export type ButtonStylesNames = any;
|
|
6
|
+
export interface ButtonProps extends DefaultProps {
|
|
7
|
+
/** Predefined button size */
|
|
8
|
+
size?: MantineSize;
|
|
9
|
+
/** Button type attribute */
|
|
10
|
+
type?: 'submit' | 'button' | 'reset';
|
|
11
|
+
/** Button color from theme */
|
|
12
|
+
color?: MantineColor;
|
|
13
|
+
/** Adds icon before button label */
|
|
14
|
+
leftIcon?: React.ReactNode;
|
|
15
|
+
/** Adds icon after button label */
|
|
16
|
+
rightIcon?: React.ReactNode;
|
|
17
|
+
/** Sets button width to 100% of parent element */
|
|
18
|
+
fullWidth?: boolean;
|
|
19
|
+
/** Key of theme.radius or any valid CSS value to set border-radius, theme.defaultRadius by default */
|
|
20
|
+
radius?: MantineNumberSize;
|
|
21
|
+
/** Controls button appearance */
|
|
22
|
+
variant?: Variants<'filled' | 'outline' | 'light' | 'white' | 'default' | 'subtle' | 'gradient'>;
|
|
23
|
+
/** Controls gradient settings in gradient variant only */
|
|
24
|
+
gradient?: MantineGradient;
|
|
25
|
+
/** Set text-transform to uppercase */
|
|
26
|
+
uppercase?: boolean;
|
|
27
|
+
/** Reduces vertical and horizontal spacing */
|
|
28
|
+
compact?: boolean;
|
|
29
|
+
/** Indicate loading state */
|
|
30
|
+
loading?: boolean;
|
|
31
|
+
/** Props spread to Loader component */
|
|
32
|
+
loaderProps?: LoaderProps;
|
|
33
|
+
/** Loader position relative to button label */
|
|
34
|
+
loaderPosition?: 'left' | 'right' | 'center';
|
|
35
|
+
/** Button label */
|
|
36
|
+
children?: React.ReactNode;
|
|
37
|
+
/** Disabled state */
|
|
38
|
+
disabled?: boolean;
|
|
39
|
+
style?: any;
|
|
40
|
+
}
|
|
41
|
+
export declare const _Button: any;
|
|
42
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Button/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAE1C,OAAO,KAAK,EACV,YAAY,EACZ,YAAY,EACZ,iBAAiB,EACjB,WAAW,EACX,QAAQ,EACT,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAM7C,MAAM,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAEpC,MAAM,WAAW,WAAY,SAAQ,YAAY;IAC/C,6BAA6B;IAC7B,IAAI,CAAC,EAAE,WAAW,CAAC;IAEnB,4BAA4B;IAC5B,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;IAErC,8BAA8B;IAC9B,KAAK,CAAC,EAAE,YAAY,CAAC;IAErB,qCAAqC;IACrC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B,oCAAoC;IACpC,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE5B,kDAAkD;IAClD,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,sGAAsG;IACtG,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAE3B,iCAAiC;IACjC,OAAO,CAAC,EAAE,QAAQ,CAChB,QAAQ,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,GAAG,SAAS,GAAG,QAAQ,GAAG,UAAU,CAC7E,CAAC;IAEF,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,eAAe,CAAC;IAE3B,sCAAsC;IACtC,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,8CAA8C;IAC9C,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,6BAA6B;IAC7B,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,uCAAuC;IACvC,WAAW,CAAC,EAAE,WAAW,CAAC;IAE1B,+CAA+C;IAC/C,cAAc,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;IAE7C,mBAAmB;IACnB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B,qBAAqB;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,KAAK,CAAC,EAAE,GAAG,CAAC;CACb;AASD,eAAO,MAAM,OAAO,EA+Ff,GAAG,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { MantineNumberSize } from '../../theme/types';
|
|
2
|
+
export interface InputStylesParams {
|
|
3
|
+
radius: MantineNumberSize;
|
|
4
|
+
multiline: boolean;
|
|
5
|
+
invalid: boolean;
|
|
6
|
+
rightSectionWidth: string | number;
|
|
7
|
+
withRightSection: boolean;
|
|
8
|
+
iconWidth: string | number;
|
|
9
|
+
offsetBottom: boolean;
|
|
10
|
+
offsetTop: boolean;
|
|
11
|
+
pointer: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare const sizes: {
|
|
14
|
+
xs: string;
|
|
15
|
+
sm: string;
|
|
16
|
+
md: string;
|
|
17
|
+
lg: string;
|
|
18
|
+
xl: string;
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=Input.styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Input.styles.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Input/Input.styles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAG3D,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,iBAAiB,CAAC;IAC1B,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,iBAAiB,EAAE,MAAM,GAAG,MAAM,CAAC;IACnC,gBAAgB,EAAE,OAAO,CAAC;IAC1B,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,YAAY,EAAE,OAAO,CAAC;IACtB,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,eAAO,MAAM,KAAK;;;;;;CAMjB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Input/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,WAAW,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
declare const _default: (params?: any) => {
|
|
1
|
+
declare const _default: (params?: any, variations?: any) => {
|
|
2
2
|
styles: {
|
|
3
3
|
root: import("react-native").ViewStyle | import("react-native").TextStyle | import("react-native").ImageStyle;
|
|
4
4
|
};
|
|
5
|
-
theme: import("../../theme/default-theme").
|
|
5
|
+
theme: import("../../theme/default-theme").MantineTheme;
|
|
6
6
|
sx: (...args: any) => any;
|
|
7
7
|
};
|
|
8
8
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/index.tsx"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/index.tsx"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC"}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import type { ImageStyle, TextStyle, ViewStyle } from 'react-native';
|
|
2
|
-
import type {
|
|
2
|
+
import type { MantineTheme } from './default-theme';
|
|
3
3
|
type NamedStyles<T> = {
|
|
4
4
|
[P in keyof T]: ViewStyle | TextStyle | ImageStyle;
|
|
5
5
|
};
|
|
6
|
-
|
|
6
|
+
type Variations = {
|
|
7
|
+
variant?: string;
|
|
8
|
+
size: string | number;
|
|
9
|
+
} | any;
|
|
10
|
+
export declare function createStyles<T = any>(input: (theme: MantineTheme, params: any, variations?: Variations) => NamedStyles<T>): (params?: any, variations?: Variations) => {
|
|
7
11
|
styles: NamedStyles<T>;
|
|
8
|
-
theme:
|
|
12
|
+
theme: MantineTheme;
|
|
9
13
|
sx: (...args: any) => any;
|
|
10
14
|
};
|
|
11
15
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-styles.d.ts","sourceRoot":"","sources":["../../../../../src/theme/create-styles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAMrE,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"create-styles.d.ts","sourceRoot":"","sources":["../../../../../src/theme/create-styles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAMrE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpD,KAAK,WAAW,CAAC,CAAC,IAAI;KACnB,CAAC,IAAI,MAAM,CAAC,GAAG,SAAS,GAAG,SAAS,GAAG,UAAU;CACnD,CAAC;AAEF,KAAK,UAAU,GACX;IACE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;CACvB,GACD,GAAG,CAAC;AAER,wBAAgB,YAAY,CAAC,CAAC,GAAG,GAAG,EAClC,KAAK,EAAE,CACL,KAAK,EAAE,YAAY,EACnB,MAAM,EAAE,GAAG,EACX,UAAU,CAAC,EAAE,UAAU,KACpB,WAAW,CAAC,CAAC,CAAC,aAGS,GAAG,eAAe,UAAU;;;kBAGjC,GAAG;EAW3B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-theme.d.ts","sourceRoot":"","sources":["../../../../../src/theme/create-theme.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpD,eAAO,MAAM,WAAW,WAAY,OAAO,CAAC,YAAY,CAAC,KAAG,YAiB3D,CAAC"}
|
|
@@ -2,7 +2,7 @@ import type { Palette } from './theme';
|
|
|
2
2
|
export declare const DEFAULT_COLORS: {
|
|
3
3
|
[key: string]: Palette;
|
|
4
4
|
};
|
|
5
|
-
export declare const _DEFAULT_THEME:
|
|
5
|
+
export declare const _DEFAULT_THEME: MantineTheme;
|
|
6
6
|
export declare const DEFAULT_THEME: any;
|
|
7
7
|
type ColorScheme = {
|
|
8
8
|
text: string;
|
|
@@ -21,7 +21,7 @@ export type ThemeSize = {
|
|
|
21
21
|
xl: number;
|
|
22
22
|
};
|
|
23
23
|
export type themeMode = 'dark' | 'light';
|
|
24
|
-
export type
|
|
24
|
+
export type MantineTheme = {
|
|
25
25
|
fontFamily: string;
|
|
26
26
|
fontFamilyBold: string;
|
|
27
27
|
localColor: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default-theme.d.ts","sourceRoot":"","sources":["../../../../../src/theme/default-theme.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,eAAO,MAAM,cAAc,EAAE;IAC3B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CA+MxB,CAAC;AAKF,eAAO,MAAM,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"default-theme.d.ts","sourceRoot":"","sources":["../../../../../src/theme/default-theme.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,eAAO,MAAM,cAAc,EAAE;IAC3B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CA+MxB,CAAC;AAKF,eAAO,MAAM,cAAc,EAAE,YAiF5B,CAAC;AAEF,eAAO,MAAM,aAAa,KAAkC,CAAC;AAE7D,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,OAAO,CAAC;AAEzC,MAAM,MAAM,YAAY,GAAG;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IAEvB,UAAU,EAAE,MAAM,CAAC;IAEnB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IACnC,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,MAAM,CAAC;IAEzB,KAAK,EAAE,WAAW,CAAC;IACnB,IAAI,EAAE,WAAW,CAAC;IAElB,KAAK,EAAE;QACL,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB,CAAC;IACF,OAAO,EAAE;QACP,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;KACvB,CAAC;IACF,MAAM,EAAE,SAAS,CAAC;IAClB,SAAS,EAAE,SAAS,CAAC;IACrB,MAAM,EAAE;QACN,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,MAAM,CAAC;IAEzB,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,SAAS,CAAC,EAAE,GAAG,CAAC;IAEhB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB,CAAC"}
|
|
@@ -2,4 +2,5 @@ export { ThemeProvider, useTheme, Theme } from './theme-provider';
|
|
|
2
2
|
export { createStyles } from './create-styles';
|
|
3
3
|
export { filterProps } from './filter-props';
|
|
4
4
|
export { getSize } from './get-size';
|
|
5
|
+
export { createTheme } from './create-theme';
|
|
5
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/theme/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/theme/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { ReactNode } from 'react';
|
|
3
|
-
import type {
|
|
3
|
+
import type { MantineTheme } from './default-theme';
|
|
4
4
|
type ThemeProps = {
|
|
5
5
|
children: ReactNode;
|
|
6
|
-
theme?: Partial<
|
|
6
|
+
theme?: Partial<MantineTheme>;
|
|
7
7
|
forceMode?: 'light' | 'dark';
|
|
8
8
|
};
|
|
9
9
|
export declare const ThemeContext: React.Context<any>;
|
|
10
10
|
export declare const ThemeProvider: ({ children, theme, forceMode, }: {
|
|
11
11
|
children: React.ReactNode;
|
|
12
|
-
theme:
|
|
12
|
+
theme: MantineTheme;
|
|
13
13
|
forceMode?: "light" | "dark";
|
|
14
14
|
}) => React.ReactElement;
|
|
15
|
-
export declare const useTheme: () =>
|
|
15
|
+
export declare const useTheme: () => MantineTheme;
|
|
16
16
|
export declare const Theme: ({ children, theme: themeOverwrite, forceMode, }: ThemeProps) => React.ReactElement;
|
|
17
17
|
export declare function useComponentDefaultProps<T extends Record<string, any>, U extends Partial<T> = {}>(component: string, defaultProps: U, props: T): T & {
|
|
18
18
|
[Key in Extract<keyof T, keyof U>]-?: U[Key] | NonNullable<T[Key]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme-provider.d.ts","sourceRoot":"","sources":["../../../../../src/theme/theme-provider.tsx"],"names":[],"mappings":"AACA,OAAO,KAMN,MAAM,OAAO,CAAC;AAKf,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"theme-provider.d.ts","sourceRoot":"","sources":["../../../../../src/theme/theme-provider.tsx"],"names":[],"mappings":"AACA,OAAO,KAMN,MAAM,OAAO,CAAC;AAKf,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAMpD,KAAK,UAAU,GAAG;IAChB,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAC9B,SAAS,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;CAC9B,CAAC;AAEF,eAAO,MAAM,YAAY,oBAA2B,CAAC;AAErD,eAAO,MAAM,aAAa,oCAIvB;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,EAAE,YAAY,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;CAC9B,KAAG,KAAK,CAAC,YAkDT,CAAC;AAEF,eAAO,MAAM,QAAQ,QAAO,YAAwC,CAAC;AAErE,eAAO,MAAM,KAAK,oDAIf,UAAU,KAAG,KAAK,CAAC,YAerB,CAAC;AAEF,wBAAgB,wBAAwB,CACtC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC7B,CAAC,SAAS,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,EAEzB,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,CAAC,EACf,KAAK,EAAE,CAAC,GACP,CAAC,GAAG;KACJ,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;CACnE,CASA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultProps.d.ts","sourceRoot":"","sources":["../../../../../../src/theme/types/DefaultProps.ts"],"names":[],"mappings":"AAAA,KAAK,SAAS,GAAG,GAAG,
|
|
1
|
+
{"version":3,"file":"DefaultProps.d.ts","sourceRoot":"","sources":["../../../../../../src/theme/types/DefaultProps.ts"],"names":[],"mappings":"AAAA,KAAK,SAAS,GAAG,GAAG,CAAC;AACrB,MAAM,MAAM,UAAU,CAAC,WAAW,SAAS,MAAM,IAAI,OAAO,CAC1D,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,CAC5B,CAAC;AACF,MAAM,MAAM,MAAM,CAChB,WAAW,SAAS,MAAM,EAC1B,YAAY,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,KAAK,IAE9C,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC,GACvC,CAAC,CACC,KAAK,EAAE,GAAG,EACV,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,GAAG,KACT,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;AAElD,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,EAAE,GAAG,CAAC;CACb"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rem.d.ts","sourceRoot":"","sources":["../../../../../../src/theme/utils/rem.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,GAAG,OAhBF,OAAO,WAgBoB,CAAC;AAC1C,eAAO,MAAM,EAAE,OAjBD,OAAO,WAiBkB,CAAC"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
import { createStyles, getSize } from '../../theme';
|
|
2
|
+
import type { MantineColor, MantineNumberSize } from '../../theme/types';
|
|
3
|
+
import { rem } from '../../theme/utils/rem';
|
|
4
|
+
import { INPUT_SIZES } from '../Input';
|
|
5
|
+
|
|
6
|
+
export const BUTTON_VARIANTS = [
|
|
7
|
+
'filled',
|
|
8
|
+
'outline',
|
|
9
|
+
'light',
|
|
10
|
+
'white',
|
|
11
|
+
'default',
|
|
12
|
+
'subtle',
|
|
13
|
+
'gradient',
|
|
14
|
+
];
|
|
15
|
+
|
|
16
|
+
export interface ButtonStylesParams {
|
|
17
|
+
color: MantineColor;
|
|
18
|
+
radius: MantineNumberSize;
|
|
19
|
+
fullWidth: boolean;
|
|
20
|
+
compact: boolean;
|
|
21
|
+
withRightIcon: boolean;
|
|
22
|
+
withLeftIcon: boolean;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const sizes = {
|
|
26
|
+
'xs': { height: INPUT_SIZES.xs, paddingLeft: rem(14), paddingRight: rem(14) },
|
|
27
|
+
'sm': { height: INPUT_SIZES.sm, paddingLeft: rem(18), paddingRight: rem(18) },
|
|
28
|
+
'md': { height: INPUT_SIZES.md, paddingLeft: rem(22), paddingRight: rem(22) },
|
|
29
|
+
'lg': { height: INPUT_SIZES.lg, paddingLeft: rem(26), paddingRight: rem(26) },
|
|
30
|
+
'xl': { height: INPUT_SIZES.xl, paddingLeft: rem(32), paddingRight: rem(32) },
|
|
31
|
+
'compact-xs': { height: rem(22), paddingLeft: rem(7), paddingRight: rem(7) },
|
|
32
|
+
'compact-sm': { height: rem(26), paddingLeft: rem(8), paddingRight: rem(8) },
|
|
33
|
+
'compact-md': {
|
|
34
|
+
height: rem(30),
|
|
35
|
+
paddingLeft: rem(10),
|
|
36
|
+
paddingRight: rem(10),
|
|
37
|
+
},
|
|
38
|
+
'compact-lg': {
|
|
39
|
+
height: rem(34),
|
|
40
|
+
paddingLeft: rem(12),
|
|
41
|
+
paddingRight: rem(12),
|
|
42
|
+
},
|
|
43
|
+
'compact-xl': {
|
|
44
|
+
height: rem(40),
|
|
45
|
+
paddingLeft: rem(14),
|
|
46
|
+
paddingRight: rem(14),
|
|
47
|
+
},
|
|
48
|
+
} as any;
|
|
49
|
+
|
|
50
|
+
interface GetSizeStyles {
|
|
51
|
+
compact: boolean;
|
|
52
|
+
size: string | number;
|
|
53
|
+
withLeftIcon: boolean;
|
|
54
|
+
withRightIcon: boolean;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function getSizeStyles({
|
|
58
|
+
// compact,
|
|
59
|
+
size,
|
|
60
|
+
withLeftIcon,
|
|
61
|
+
withRightIcon,
|
|
62
|
+
}: GetSizeStyles): any {
|
|
63
|
+
// if (compact) {
|
|
64
|
+
// return sizes[`compact-${size}`];
|
|
65
|
+
// }
|
|
66
|
+
|
|
67
|
+
const _sizes: (typeof sizes)[keyof typeof sizes] = sizes[size];
|
|
68
|
+
|
|
69
|
+
if (!_sizes) {
|
|
70
|
+
return {};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return {
|
|
74
|
+
..._sizes,
|
|
75
|
+
paddingLeft: withLeftIcon
|
|
76
|
+
? `calc(${_sizes.paddingLeft} / 1.5)`
|
|
77
|
+
: _sizes.paddingLeft,
|
|
78
|
+
paddingRight: withRightIcon
|
|
79
|
+
? `calc(${_sizes.paddingRight} / 1.5)`
|
|
80
|
+
: _sizes.paddingRight,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const getWidthStyles = (fullWidth: boolean) => ({
|
|
85
|
+
display: fullWidth ? 'block' : 'inline-block',
|
|
86
|
+
width: fullWidth ? '100%' : 'auto',
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
// interface GetVariantStyles {
|
|
90
|
+
// theme: MantineTheme;
|
|
91
|
+
// color: MantineColor;
|
|
92
|
+
// variant: string;
|
|
93
|
+
// gradient: MantineGradient;
|
|
94
|
+
// }
|
|
95
|
+
|
|
96
|
+
// function getVariantStyles({
|
|
97
|
+
// variant,
|
|
98
|
+
// theme,
|
|
99
|
+
// color,
|
|
100
|
+
// gradient,
|
|
101
|
+
// }: GetVariantStyles) {
|
|
102
|
+
// if (!BUTTON_VARIANTS.includes(variant)) {
|
|
103
|
+
// return null;
|
|
104
|
+
// }
|
|
105
|
+
|
|
106
|
+
// const colors = theme.fn.variant({ color, variant, gradient });
|
|
107
|
+
|
|
108
|
+
// if (variant === 'gradient') {
|
|
109
|
+
// return {
|
|
110
|
+
// border: 0,
|
|
111
|
+
// backgroundImage: colors.background,
|
|
112
|
+
// color: colors.color,
|
|
113
|
+
// ...theme.fn.hover({ backgroundSize: '200%' }),
|
|
114
|
+
// };
|
|
115
|
+
// }
|
|
116
|
+
|
|
117
|
+
// return {
|
|
118
|
+
// border: `${rem(1)} solid ${colors.border}`,
|
|
119
|
+
// backgroundColor: colors.background,
|
|
120
|
+
// color: colors.color,
|
|
121
|
+
// ...theme.fn.hover({ backgroundColor: colors.hover }),
|
|
122
|
+
// };
|
|
123
|
+
// }
|
|
124
|
+
|
|
125
|
+
const useStyles = createStyles(
|
|
126
|
+
(
|
|
127
|
+
theme,
|
|
128
|
+
{
|
|
129
|
+
radius,
|
|
130
|
+
fullWidth,
|
|
131
|
+
compact,
|
|
132
|
+
withLeftIcon,
|
|
133
|
+
withRightIcon,
|
|
134
|
+
// color,
|
|
135
|
+
// gradient,
|
|
136
|
+
}: ButtonStylesParams,
|
|
137
|
+
{
|
|
138
|
+
// variant,
|
|
139
|
+
size,
|
|
140
|
+
}
|
|
141
|
+
) => {
|
|
142
|
+
return {
|
|
143
|
+
root: {
|
|
144
|
+
...getSizeStyles({ compact, size, withLeftIcon, withRightIcon }),
|
|
145
|
+
...theme.fn.fontStyles(),
|
|
146
|
+
...theme.fn.focusStyles(),
|
|
147
|
+
...getWidthStyles(fullWidth),
|
|
148
|
+
'borderRadius': theme.fn.radius(radius),
|
|
149
|
+
'fontWeight': 600,
|
|
150
|
+
'position': 'relative',
|
|
151
|
+
'lineHeight': 1,
|
|
152
|
+
'fontSize': getSize({ size, sizes: theme.fontSizes }),
|
|
153
|
+
'userSelect': 'none',
|
|
154
|
+
'cursor': 'pointer',
|
|
155
|
+
// ...getVariantStyles({ variant, theme, color, gradient }),
|
|
156
|
+
|
|
157
|
+
'&:active': theme.activeStyles,
|
|
158
|
+
|
|
159
|
+
'&:disabled, &[data-disabled]': {
|
|
160
|
+
'borderColor': 'transparent',
|
|
161
|
+
// 'backgroundColor':
|
|
162
|
+
// theme.colorScheme === 'dark'
|
|
163
|
+
// ? theme.colors.dark[4]
|
|
164
|
+
// : theme.colors.gray[2],
|
|
165
|
+
// 'color':
|
|
166
|
+
// theme.colorScheme === 'dark'
|
|
167
|
+
// ? theme.colors.dark[6]
|
|
168
|
+
// : theme.colors.gray[5],
|
|
169
|
+
'cursor': 'not-allowed',
|
|
170
|
+
'backgroundImage': 'none',
|
|
171
|
+
'pointerEvents': 'none',
|
|
172
|
+
|
|
173
|
+
'&:active': {
|
|
174
|
+
transform: 'none',
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
|
|
178
|
+
'&[data-loading]': {
|
|
179
|
+
'pointerEvents': 'none',
|
|
180
|
+
|
|
181
|
+
'&::before': {
|
|
182
|
+
content: '""',
|
|
183
|
+
...theme.fn.cover(rem(-1)),
|
|
184
|
+
// backgroundColor:
|
|
185
|
+
// theme.colorScheme === 'dark'
|
|
186
|
+
// ? theme.fn.rgba(theme.colors.dark[7], 0.5)
|
|
187
|
+
// : 'rgba(255, 255, 255, .5)',
|
|
188
|
+
borderRadius: theme.fn.radius(radius),
|
|
189
|
+
cursor: 'not-allowed',
|
|
190
|
+
},
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
|
|
194
|
+
icon: {
|
|
195
|
+
display: 'flex',
|
|
196
|
+
alignItems: 'center',
|
|
197
|
+
},
|
|
198
|
+
|
|
199
|
+
leftIcon: {
|
|
200
|
+
marginRight: theme.spacing.xs,
|
|
201
|
+
},
|
|
202
|
+
|
|
203
|
+
rightIcon: {
|
|
204
|
+
marginLeft: theme.spacing.xs,
|
|
205
|
+
},
|
|
206
|
+
|
|
207
|
+
centerLoader: {
|
|
208
|
+
position: 'absolute',
|
|
209
|
+
left: '50%',
|
|
210
|
+
transform: 'translateX(-50%)',
|
|
211
|
+
opacity: 0.5,
|
|
212
|
+
},
|
|
213
|
+
|
|
214
|
+
inner: {
|
|
215
|
+
display: 'flex',
|
|
216
|
+
alignItems: 'center',
|
|
217
|
+
justifyContent: 'center',
|
|
218
|
+
height: '100%',
|
|
219
|
+
overflow: 'visible',
|
|
220
|
+
},
|
|
221
|
+
|
|
222
|
+
label: {
|
|
223
|
+
whiteSpace: 'nowrap',
|
|
224
|
+
height: '100%',
|
|
225
|
+
overflow: 'hidden',
|
|
226
|
+
display: 'flex',
|
|
227
|
+
alignItems: 'center',
|
|
228
|
+
},
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
);
|
|
232
|
+
export default useStyles;
|