@metamask-previews/design-system-react-native 0.0.0-preview.ff8ed96 → 0.2.0-preview.a7d80d5
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/CHANGELOG.md +38 -1
- package/dist/components/AvatarBase/AvatarBase.types.d.cts +0 -1
- package/dist/components/AvatarBase/AvatarBase.types.d.cts.map +1 -1
- package/dist/components/AvatarBase/AvatarBase.types.d.mts +0 -1
- package/dist/components/AvatarBase/AvatarBase.types.d.mts.map +1 -1
- package/dist/components/AvatarFavicon/AvatarFavicon.cjs.map +1 -1
- package/dist/components/AvatarFavicon/AvatarFavicon.mjs.map +1 -1
- package/dist/components/AvatarGroup/AvatarGroup.cjs +2 -2
- package/dist/components/AvatarGroup/AvatarGroup.cjs.map +1 -1
- package/dist/components/AvatarGroup/AvatarGroup.mjs +3 -3
- package/dist/components/AvatarGroup/AvatarGroup.mjs.map +1 -1
- package/dist/components/AvatarNetwork/AvatarNetwork.cjs.map +1 -1
- package/dist/components/AvatarNetwork/AvatarNetwork.mjs.map +1 -1
- package/dist/components/AvatarToken/AvatarToken.cjs.map +1 -1
- package/dist/components/AvatarToken/AvatarToken.mjs.map +1 -1
- package/dist/components/BadgeWrapper/BadgeWrapper.cjs +1 -1
- package/dist/components/BadgeWrapper/BadgeWrapper.cjs.map +1 -1
- package/dist/components/BadgeWrapper/BadgeWrapper.mjs +1 -1
- package/dist/components/BadgeWrapper/BadgeWrapper.mjs.map +1 -1
- package/dist/components/BadgeWrapper/BadgeWrapper.types.d.cts +0 -1
- package/dist/components/BadgeWrapper/BadgeWrapper.types.d.cts.map +1 -1
- package/dist/components/BadgeWrapper/BadgeWrapper.types.d.mts +0 -1
- package/dist/components/BadgeWrapper/BadgeWrapper.types.d.mts.map +1 -1
- package/dist/components/Box/Box.cjs +22 -5
- package/dist/components/Box/Box.cjs.map +1 -1
- package/dist/components/Box/Box.constants.cjs +218 -1
- package/dist/components/Box/Box.constants.cjs.map +1 -1
- package/dist/components/Box/Box.constants.d.cts +16 -1
- package/dist/components/Box/Box.constants.d.cts.map +1 -1
- package/dist/components/Box/Box.constants.d.mts +16 -1
- package/dist/components/Box/Box.constants.d.mts.map +1 -1
- package/dist/components/Box/Box.constants.mjs +217 -0
- package/dist/components/Box/Box.constants.mjs.map +1 -1
- package/dist/components/Box/Box.d.cts +1 -1
- package/dist/components/Box/Box.d.cts.map +1 -1
- package/dist/components/Box/Box.d.mts +1 -1
- package/dist/components/Box/Box.d.mts.map +1 -1
- package/dist/components/Box/Box.mjs +23 -6
- package/dist/components/Box/Box.mjs.map +1 -1
- package/dist/components/Box/Box.types.cjs.map +1 -1
- package/dist/components/Box/Box.types.d.cts +84 -1
- package/dist/components/Box/Box.types.d.cts.map +1 -1
- package/dist/components/Box/Box.types.d.mts +84 -1
- package/dist/components/Box/Box.types.d.mts.map +1 -1
- package/dist/components/Box/Box.types.mjs.map +1 -1
- package/dist/components/Box/index.cjs.map +1 -1
- package/dist/components/Box/index.d.cts +1 -1
- package/dist/components/Box/index.d.cts.map +1 -1
- package/dist/components/Box/index.d.mts +1 -1
- package/dist/components/Box/index.d.mts.map +1 -1
- package/dist/components/Box/index.mjs.map +1 -1
- package/dist/components/Button/Button.cjs +1 -1
- package/dist/components/Button/Button.cjs.map +1 -1
- package/dist/components/Button/Button.mjs +1 -1
- package/dist/components/Button/Button.mjs.map +1 -1
- package/dist/components/Button/variants/ButtonPrimary/ButtonPrimary.cjs +29 -57
- package/dist/components/Button/variants/ButtonPrimary/ButtonPrimary.cjs.map +1 -1
- package/dist/components/Button/variants/ButtonPrimary/ButtonPrimary.d.cts +1 -1
- package/dist/components/Button/variants/ButtonPrimary/ButtonPrimary.d.cts.map +1 -1
- package/dist/components/Button/variants/ButtonPrimary/ButtonPrimary.d.mts +1 -1
- package/dist/components/Button/variants/ButtonPrimary/ButtonPrimary.d.mts.map +1 -1
- package/dist/components/Button/variants/ButtonPrimary/ButtonPrimary.mjs +30 -58
- package/dist/components/Button/variants/ButtonPrimary/ButtonPrimary.mjs.map +1 -1
- package/dist/components/Button/variants/ButtonSecondary/ButtonSecondary.cjs +46 -53
- package/dist/components/Button/variants/ButtonSecondary/ButtonSecondary.cjs.map +1 -1
- package/dist/components/Button/variants/ButtonSecondary/ButtonSecondary.d.cts +1 -1
- package/dist/components/Button/variants/ButtonSecondary/ButtonSecondary.d.cts.map +1 -1
- package/dist/components/Button/variants/ButtonSecondary/ButtonSecondary.d.mts +1 -1
- package/dist/components/Button/variants/ButtonSecondary/ButtonSecondary.d.mts.map +1 -1
- package/dist/components/Button/variants/ButtonSecondary/ButtonSecondary.mjs +47 -54
- package/dist/components/Button/variants/ButtonSecondary/ButtonSecondary.mjs.map +1 -1
- package/dist/components/Button/variants/ButtonTertiary/ButtonTertiary.cjs +53 -59
- package/dist/components/Button/variants/ButtonTertiary/ButtonTertiary.cjs.map +1 -1
- package/dist/components/Button/variants/ButtonTertiary/ButtonTertiary.d.cts +1 -1
- package/dist/components/Button/variants/ButtonTertiary/ButtonTertiary.d.cts.map +1 -1
- package/dist/components/Button/variants/ButtonTertiary/ButtonTertiary.d.mts +1 -1
- package/dist/components/Button/variants/ButtonTertiary/ButtonTertiary.d.mts.map +1 -1
- package/dist/components/Button/variants/ButtonTertiary/ButtonTertiary.mjs +54 -60
- package/dist/components/Button/variants/ButtonTertiary/ButtonTertiary.mjs.map +1 -1
- package/dist/components/ButtonBase/ButtonBase.cjs +110 -28
- package/dist/components/ButtonBase/ButtonBase.cjs.map +1 -1
- package/dist/components/ButtonBase/ButtonBase.constants.cjs +10 -0
- package/dist/components/ButtonBase/ButtonBase.constants.cjs.map +1 -0
- package/dist/components/ButtonBase/ButtonBase.constants.d.cts +3 -0
- package/dist/components/ButtonBase/ButtonBase.constants.d.cts.map +1 -0
- package/dist/components/ButtonBase/ButtonBase.constants.d.mts +3 -0
- package/dist/components/ButtonBase/ButtonBase.constants.d.mts.map +1 -0
- package/dist/components/ButtonBase/ButtonBase.constants.mjs +7 -0
- package/dist/components/ButtonBase/ButtonBase.constants.mjs.map +1 -0
- package/dist/components/ButtonBase/ButtonBase.d.cts +1 -1
- package/dist/components/ButtonBase/ButtonBase.d.cts.map +1 -1
- package/dist/components/ButtonBase/ButtonBase.d.mts +1 -1
- package/dist/components/ButtonBase/ButtonBase.d.mts.map +1 -1
- package/dist/components/ButtonBase/ButtonBase.mjs +88 -26
- package/dist/components/ButtonBase/ButtonBase.mjs.map +1 -1
- package/dist/components/ButtonBase/ButtonBase.types.cjs.map +1 -1
- package/dist/components/ButtonBase/ButtonBase.types.d.cts +42 -3
- package/dist/components/ButtonBase/ButtonBase.types.d.cts.map +1 -1
- package/dist/components/ButtonBase/ButtonBase.types.d.mts +42 -3
- package/dist/components/ButtonBase/ButtonBase.types.d.mts.map +1 -1
- package/dist/components/ButtonBase/ButtonBase.types.mjs.map +1 -1
- package/dist/components/ButtonBase/index.cjs +3 -1
- package/dist/components/ButtonBase/index.cjs.map +1 -1
- package/dist/components/ButtonBase/index.d.cts +1 -0
- package/dist/components/ButtonBase/index.d.cts.map +1 -1
- package/dist/components/ButtonBase/index.d.mts +1 -0
- package/dist/components/ButtonBase/index.d.mts.map +1 -1
- package/dist/components/ButtonBase/index.mjs +1 -0
- package/dist/components/ButtonBase/index.mjs.map +1 -1
- package/dist/components/ButtonIcon/ButtonIcon.cjs +9 -1
- package/dist/components/ButtonIcon/ButtonIcon.cjs.map +1 -1
- package/dist/components/ButtonIcon/ButtonIcon.d.cts.map +1 -1
- package/dist/components/ButtonIcon/ButtonIcon.d.mts.map +1 -1
- package/dist/components/ButtonIcon/ButtonIcon.mjs +9 -1
- package/dist/components/ButtonIcon/ButtonIcon.mjs.map +1 -1
- package/dist/components/Checkbox/Checkbox.cjs +1 -1
- package/dist/components/Checkbox/Checkbox.cjs.map +1 -1
- package/dist/components/Checkbox/Checkbox.mjs +1 -1
- package/dist/components/Checkbox/Checkbox.mjs.map +1 -1
- package/dist/components/Checkbox/Checkbox.types.d.cts +0 -1
- package/dist/components/Checkbox/Checkbox.types.d.cts.map +1 -1
- package/dist/components/Checkbox/Checkbox.types.d.mts +0 -1
- package/dist/components/Checkbox/Checkbox.types.d.mts.map +1 -1
- package/dist/components/Icon/Icon.assets.cjs +2 -3
- package/dist/components/Icon/Icon.assets.cjs.map +1 -1
- package/dist/components/Icon/Icon.assets.mjs +2 -3
- package/dist/components/Icon/Icon.assets.mjs.map +1 -1
- package/dist/components/Text/Text.constants.cjs +9 -0
- package/dist/components/Text/Text.constants.cjs.map +1 -1
- package/dist/components/Text/Text.constants.d.cts.map +1 -1
- package/dist/components/Text/Text.constants.d.mts.map +1 -1
- package/dist/components/Text/Text.constants.mjs +9 -0
- package/dist/components/Text/Text.constants.mjs.map +1 -1
- package/dist/components/Text/Text.types.cjs.map +1 -1
- package/dist/components/Text/Text.types.d.cts +1 -2
- package/dist/components/Text/Text.types.d.cts.map +1 -1
- package/dist/components/Text/Text.types.d.mts +1 -2
- package/dist/components/Text/Text.types.d.mts.map +1 -1
- package/dist/components/Text/Text.types.mjs.map +1 -1
- package/dist/components/TextButton/TextButton.cjs +1 -0
- package/dist/components/TextButton/TextButton.cjs.map +1 -1
- package/dist/components/TextButton/TextButton.d.cts.map +1 -1
- package/dist/components/TextButton/TextButton.d.mts.map +1 -1
- package/dist/components/TextButton/TextButton.mjs +1 -0
- package/dist/components/TextButton/TextButton.mjs.map +1 -1
- package/dist/components/TextButton/TextButton.types.d.cts +0 -1
- package/dist/components/TextButton/TextButton.types.d.cts.map +1 -1
- package/dist/components/TextButton/TextButton.types.d.mts +0 -1
- package/dist/components/TextButton/TextButton.types.d.mts.map +1 -1
- package/dist/components/temp-components/ImageOrSvg/ImageOrSvg.types.d.cts +0 -1
- package/dist/components/temp-components/ImageOrSvg/ImageOrSvg.types.d.cts.map +1 -1
- package/dist/components/temp-components/ImageOrSvg/ImageOrSvg.types.d.mts +0 -1
- package/dist/components/temp-components/ImageOrSvg/ImageOrSvg.types.d.mts.map +1 -1
- package/dist/components/temp-components/TextOrChildren/TextOrChildren.types.d.cts +0 -1
- package/dist/components/temp-components/TextOrChildren/TextOrChildren.types.d.cts.map +1 -1
- package/dist/components/temp-components/TextOrChildren/TextOrChildren.types.d.mts +0 -1
- package/dist/components/temp-components/TextOrChildren/TextOrChildren.types.d.mts.map +1 -1
- package/dist/types/index.cjs +143 -4
- package/dist/types/index.cjs.map +1 -1
- package/dist/types/index.d.cts +141 -4
- package/dist/types/index.d.cts.map +1 -1
- package/dist/types/index.d.mts +141 -4
- package/dist/types/index.d.mts.map +1 -1
- package/dist/types/index.mjs +142 -3
- package/dist/types/index.mjs.map +1 -1
- package/package.json +13 -13
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Box.types.cjs","sourceRoot":"","sources":["../../../src/components/Box/Box.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ViewProps } from 'react-native';\n\nimport type {\n BoxFlexDirection,\n BoxFlexWrap,\n BoxSpacing,\n BoxAlignItems,\n BoxJustifyContent,\n} from '../../types';\n\nexport type BoxProps = {\n /**\n * The flexDirection style of the component.\n */\n flexDirection?: BoxFlexDirection;\n /**\n * The flexWrap style of the component.\n */\n flexWrap?: BoxFlexWrap;\n /**\n * The gap between the component's children.\n * Use 1-12 for a gap of 4px-48px.\n */\n gap?: BoxSpacing;\n /**\n * The alignItems style of the component.\n */\n alignItems?: BoxAlignItems;\n /**\n * The justifyContent style of the component.\n */\n justifyContent?: BoxJustifyContent;\n /**\n * Optional prop to add twrnc overriding classNames.\n */\n twClassName?: string;\n} & ViewProps;\n"]}
|
|
1
|
+
{"version":3,"file":"Box.types.cjs","sourceRoot":"","sources":["../../../src/components/Box/Box.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ViewProps } from 'react-native';\n\nimport type {\n BoxFlexDirection,\n BoxFlexWrap,\n BoxSpacing,\n BoxBorderWidth,\n BoxAlignItems,\n BoxJustifyContent,\n BoxBackgroundColor,\n BoxBorderColor,\n} from '../../types';\n\nexport type BoxProps = {\n /**\n * The flexDirection style of the component.\n */\n flexDirection?: BoxFlexDirection;\n /**\n * The flexWrap style of the component.\n */\n flexWrap?: BoxFlexWrap;\n /**\n * The gap between the component's children.\n * Use 1-12 for a gap of 4px-48px.\n */\n gap?: BoxSpacing;\n /**\n * The alignItems style of the component.\n */\n alignItems?: BoxAlignItems;\n /**\n * The justifyContent style of the component.\n */\n justifyContent?: BoxJustifyContent;\n /**\n * The margin of the component.\n * Use 1-12 for margin of 4px-48px.\n */\n margin?: BoxSpacing;\n /**\n * The top margin of the component.\n * Use 1-12 for margin of 4px-48px.\n */\n marginTop?: BoxSpacing;\n /**\n * The right margin of the component.\n * Use 1-12 for margin of 4px-48px.\n */\n marginRight?: BoxSpacing;\n /**\n * The bottom margin of the component.\n * Use 1-12 for margin of 4px-48px.\n */\n marginBottom?: BoxSpacing;\n /**\n * The left margin of the component.\n * Use 1-12 for margin of 4px-48px.\n */\n marginLeft?: BoxSpacing;\n /**\n * The horizontal margin of the component.\n * Use 1-12 for margin of 4px-48px.\n */\n marginHorizontal?: BoxSpacing;\n /**\n * The vertical margin of the component.\n * Use 1-12 for margin of 4px-48px.\n */\n marginVertical?: BoxSpacing;\n /**\n * The padding of the component.\n * Use 1-12 for padding of 4px-48px.\n */\n padding?: BoxSpacing;\n /**\n * The top padding of the component.\n * Use 1-12 for padding of 4px-48px.\n */\n paddingTop?: BoxSpacing;\n /**\n * The right padding of the component.\n * Use 1-12 for padding of 4px-48px.\n */\n paddingRight?: BoxSpacing;\n /**\n * The bottom padding of the component.\n * Use 1-12 for padding of 4px-48px.\n */\n paddingBottom?: BoxSpacing;\n /**\n * The left padding of the component.\n * Use 1-12 for padding of 4px-48px.\n */\n paddingLeft?: BoxSpacing;\n /**\n * The horizontal padding of the component.\n * Use 1-12 for padding of 4px-48px.\n */\n paddingHorizontal?: BoxSpacing;\n /**\n * The vertical padding of the component.\n * Use 1-12 for padding of 4px-48px.\n */\n paddingVertical?: BoxSpacing;\n /**\n * The border width of the component.\n * Use 0, 1, 2, 4, or 8 for border width of 0px, 1px, 2px, 4px, or 8px.\n */\n borderWidth?: BoxBorderWidth;\n /**\n * The border color of the component.\n */\n borderColor?: BoxBorderColor;\n /**\n * The background color of the component.\n */\n backgroundColor?: BoxBackgroundColor;\n /**\n * Optional prop to add twrnc overriding classNames.\n */\n twClassName?: string;\n} & ViewProps;\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ViewProps } from "react-native/index.js";
|
|
2
|
-
import type { BoxFlexDirection, BoxFlexWrap, BoxSpacing, BoxAlignItems, BoxJustifyContent } from "../../types/index.cjs";
|
|
2
|
+
import type { BoxFlexDirection, BoxFlexWrap, BoxSpacing, BoxBorderWidth, BoxAlignItems, BoxJustifyContent, BoxBackgroundColor, BoxBorderColor } from "../../types/index.cjs";
|
|
3
3
|
export type BoxProps = {
|
|
4
4
|
/**
|
|
5
5
|
* The flexDirection style of the component.
|
|
@@ -22,6 +22,89 @@ export type BoxProps = {
|
|
|
22
22
|
* The justifyContent style of the component.
|
|
23
23
|
*/
|
|
24
24
|
justifyContent?: BoxJustifyContent;
|
|
25
|
+
/**
|
|
26
|
+
* The margin of the component.
|
|
27
|
+
* Use 1-12 for margin of 4px-48px.
|
|
28
|
+
*/
|
|
29
|
+
margin?: BoxSpacing;
|
|
30
|
+
/**
|
|
31
|
+
* The top margin of the component.
|
|
32
|
+
* Use 1-12 for margin of 4px-48px.
|
|
33
|
+
*/
|
|
34
|
+
marginTop?: BoxSpacing;
|
|
35
|
+
/**
|
|
36
|
+
* The right margin of the component.
|
|
37
|
+
* Use 1-12 for margin of 4px-48px.
|
|
38
|
+
*/
|
|
39
|
+
marginRight?: BoxSpacing;
|
|
40
|
+
/**
|
|
41
|
+
* The bottom margin of the component.
|
|
42
|
+
* Use 1-12 for margin of 4px-48px.
|
|
43
|
+
*/
|
|
44
|
+
marginBottom?: BoxSpacing;
|
|
45
|
+
/**
|
|
46
|
+
* The left margin of the component.
|
|
47
|
+
* Use 1-12 for margin of 4px-48px.
|
|
48
|
+
*/
|
|
49
|
+
marginLeft?: BoxSpacing;
|
|
50
|
+
/**
|
|
51
|
+
* The horizontal margin of the component.
|
|
52
|
+
* Use 1-12 for margin of 4px-48px.
|
|
53
|
+
*/
|
|
54
|
+
marginHorizontal?: BoxSpacing;
|
|
55
|
+
/**
|
|
56
|
+
* The vertical margin of the component.
|
|
57
|
+
* Use 1-12 for margin of 4px-48px.
|
|
58
|
+
*/
|
|
59
|
+
marginVertical?: BoxSpacing;
|
|
60
|
+
/**
|
|
61
|
+
* The padding of the component.
|
|
62
|
+
* Use 1-12 for padding of 4px-48px.
|
|
63
|
+
*/
|
|
64
|
+
padding?: BoxSpacing;
|
|
65
|
+
/**
|
|
66
|
+
* The top padding of the component.
|
|
67
|
+
* Use 1-12 for padding of 4px-48px.
|
|
68
|
+
*/
|
|
69
|
+
paddingTop?: BoxSpacing;
|
|
70
|
+
/**
|
|
71
|
+
* The right padding of the component.
|
|
72
|
+
* Use 1-12 for padding of 4px-48px.
|
|
73
|
+
*/
|
|
74
|
+
paddingRight?: BoxSpacing;
|
|
75
|
+
/**
|
|
76
|
+
* The bottom padding of the component.
|
|
77
|
+
* Use 1-12 for padding of 4px-48px.
|
|
78
|
+
*/
|
|
79
|
+
paddingBottom?: BoxSpacing;
|
|
80
|
+
/**
|
|
81
|
+
* The left padding of the component.
|
|
82
|
+
* Use 1-12 for padding of 4px-48px.
|
|
83
|
+
*/
|
|
84
|
+
paddingLeft?: BoxSpacing;
|
|
85
|
+
/**
|
|
86
|
+
* The horizontal padding of the component.
|
|
87
|
+
* Use 1-12 for padding of 4px-48px.
|
|
88
|
+
*/
|
|
89
|
+
paddingHorizontal?: BoxSpacing;
|
|
90
|
+
/**
|
|
91
|
+
* The vertical padding of the component.
|
|
92
|
+
* Use 1-12 for padding of 4px-48px.
|
|
93
|
+
*/
|
|
94
|
+
paddingVertical?: BoxSpacing;
|
|
95
|
+
/**
|
|
96
|
+
* The border width of the component.
|
|
97
|
+
* Use 0, 1, 2, 4, or 8 for border width of 0px, 1px, 2px, 4px, or 8px.
|
|
98
|
+
*/
|
|
99
|
+
borderWidth?: BoxBorderWidth;
|
|
100
|
+
/**
|
|
101
|
+
* The border color of the component.
|
|
102
|
+
*/
|
|
103
|
+
borderColor?: BoxBorderColor;
|
|
104
|
+
/**
|
|
105
|
+
* The background color of the component.
|
|
106
|
+
*/
|
|
107
|
+
backgroundColor?: BoxBackgroundColor;
|
|
25
108
|
/**
|
|
26
109
|
* Optional prop to add twrnc overriding classNames.
|
|
27
110
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Box.types.d.cts","sourceRoot":"","sources":["../../../src/components/Box/Box.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,8BAAqB;AAE9C,OAAO,KAAK,EACV,gBAAgB,EAChB,WAAW,EACX,UAAU,EACV,aAAa,EACb,iBAAiB,EAClB,8BAAoB;AAErB,MAAM,MAAM,QAAQ,GAAG;IACrB;;OAEG;IACH,aAAa,CAAC,EAAE,gBAAgB,CAAC;IACjC;;OAEG;IACH,QAAQ,CAAC,EAAE,WAAW,CAAC;IACvB;;;OAGG;IACH,GAAG,CAAC,EAAE,UAAU,CAAC;IACjB;;OAEG;IACH,UAAU,CAAC,EAAE,aAAa,CAAC;IAC3B;;OAEG;IACH,cAAc,CAAC,EAAE,iBAAiB,CAAC;IACnC;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,GAAG,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"Box.types.d.cts","sourceRoot":"","sources":["../../../src/components/Box/Box.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,8BAAqB;AAE9C,OAAO,KAAK,EACV,gBAAgB,EAChB,WAAW,EACX,UAAU,EACV,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EACf,8BAAoB;AAErB,MAAM,MAAM,QAAQ,GAAG;IACrB;;OAEG;IACH,aAAa,CAAC,EAAE,gBAAgB,CAAC;IACjC;;OAEG;IACH,QAAQ,CAAC,EAAE,WAAW,CAAC;IACvB;;;OAGG;IACH,GAAG,CAAC,EAAE,UAAU,CAAC;IACjB;;OAEG;IACH,UAAU,CAAC,EAAE,aAAa,CAAC;IAC3B;;OAEG;IACH,cAAc,CAAC,EAAE,iBAAiB,CAAC;IACnC;;;OAGG;IACH,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB;;;OAGG;IACH,SAAS,CAAC,EAAE,UAAU,CAAC;IACvB;;;OAGG;IACH,WAAW,CAAC,EAAE,UAAU,CAAC;IACzB;;;OAGG;IACH,YAAY,CAAC,EAAE,UAAU,CAAC;IAC1B;;;OAGG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,UAAU,CAAC;IAC9B;;;OAGG;IACH,cAAc,CAAC,EAAE,UAAU,CAAC;IAC5B;;;OAGG;IACH,OAAO,CAAC,EAAE,UAAU,CAAC;IACrB;;;OAGG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB;;;OAGG;IACH,YAAY,CAAC,EAAE,UAAU,CAAC;IAC1B;;;OAGG;IACH,aAAa,CAAC,EAAE,UAAU,CAAC;IAC3B;;;OAGG;IACH,WAAW,CAAC,EAAE,UAAU,CAAC;IACzB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,UAAU,CAAC;IAC/B;;;OAGG;IACH,eAAe,CAAC,EAAE,UAAU,CAAC;IAC7B;;;OAGG;IACH,WAAW,CAAC,EAAE,cAAc,CAAC;IAC7B;;OAEG;IACH,WAAW,CAAC,EAAE,cAAc,CAAC;IAC7B;;OAEG;IACH,eAAe,CAAC,EAAE,kBAAkB,CAAC;IACrC;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,GAAG,SAAS,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ViewProps } from "react-native/index.js";
|
|
2
|
-
import type { BoxFlexDirection, BoxFlexWrap, BoxSpacing, BoxAlignItems, BoxJustifyContent } from "../../types/index.mjs";
|
|
2
|
+
import type { BoxFlexDirection, BoxFlexWrap, BoxSpacing, BoxBorderWidth, BoxAlignItems, BoxJustifyContent, BoxBackgroundColor, BoxBorderColor } from "../../types/index.mjs";
|
|
3
3
|
export type BoxProps = {
|
|
4
4
|
/**
|
|
5
5
|
* The flexDirection style of the component.
|
|
@@ -22,6 +22,89 @@ export type BoxProps = {
|
|
|
22
22
|
* The justifyContent style of the component.
|
|
23
23
|
*/
|
|
24
24
|
justifyContent?: BoxJustifyContent;
|
|
25
|
+
/**
|
|
26
|
+
* The margin of the component.
|
|
27
|
+
* Use 1-12 for margin of 4px-48px.
|
|
28
|
+
*/
|
|
29
|
+
margin?: BoxSpacing;
|
|
30
|
+
/**
|
|
31
|
+
* The top margin of the component.
|
|
32
|
+
* Use 1-12 for margin of 4px-48px.
|
|
33
|
+
*/
|
|
34
|
+
marginTop?: BoxSpacing;
|
|
35
|
+
/**
|
|
36
|
+
* The right margin of the component.
|
|
37
|
+
* Use 1-12 for margin of 4px-48px.
|
|
38
|
+
*/
|
|
39
|
+
marginRight?: BoxSpacing;
|
|
40
|
+
/**
|
|
41
|
+
* The bottom margin of the component.
|
|
42
|
+
* Use 1-12 for margin of 4px-48px.
|
|
43
|
+
*/
|
|
44
|
+
marginBottom?: BoxSpacing;
|
|
45
|
+
/**
|
|
46
|
+
* The left margin of the component.
|
|
47
|
+
* Use 1-12 for margin of 4px-48px.
|
|
48
|
+
*/
|
|
49
|
+
marginLeft?: BoxSpacing;
|
|
50
|
+
/**
|
|
51
|
+
* The horizontal margin of the component.
|
|
52
|
+
* Use 1-12 for margin of 4px-48px.
|
|
53
|
+
*/
|
|
54
|
+
marginHorizontal?: BoxSpacing;
|
|
55
|
+
/**
|
|
56
|
+
* The vertical margin of the component.
|
|
57
|
+
* Use 1-12 for margin of 4px-48px.
|
|
58
|
+
*/
|
|
59
|
+
marginVertical?: BoxSpacing;
|
|
60
|
+
/**
|
|
61
|
+
* The padding of the component.
|
|
62
|
+
* Use 1-12 for padding of 4px-48px.
|
|
63
|
+
*/
|
|
64
|
+
padding?: BoxSpacing;
|
|
65
|
+
/**
|
|
66
|
+
* The top padding of the component.
|
|
67
|
+
* Use 1-12 for padding of 4px-48px.
|
|
68
|
+
*/
|
|
69
|
+
paddingTop?: BoxSpacing;
|
|
70
|
+
/**
|
|
71
|
+
* The right padding of the component.
|
|
72
|
+
* Use 1-12 for padding of 4px-48px.
|
|
73
|
+
*/
|
|
74
|
+
paddingRight?: BoxSpacing;
|
|
75
|
+
/**
|
|
76
|
+
* The bottom padding of the component.
|
|
77
|
+
* Use 1-12 for padding of 4px-48px.
|
|
78
|
+
*/
|
|
79
|
+
paddingBottom?: BoxSpacing;
|
|
80
|
+
/**
|
|
81
|
+
* The left padding of the component.
|
|
82
|
+
* Use 1-12 for padding of 4px-48px.
|
|
83
|
+
*/
|
|
84
|
+
paddingLeft?: BoxSpacing;
|
|
85
|
+
/**
|
|
86
|
+
* The horizontal padding of the component.
|
|
87
|
+
* Use 1-12 for padding of 4px-48px.
|
|
88
|
+
*/
|
|
89
|
+
paddingHorizontal?: BoxSpacing;
|
|
90
|
+
/**
|
|
91
|
+
* The vertical padding of the component.
|
|
92
|
+
* Use 1-12 for padding of 4px-48px.
|
|
93
|
+
*/
|
|
94
|
+
paddingVertical?: BoxSpacing;
|
|
95
|
+
/**
|
|
96
|
+
* The border width of the component.
|
|
97
|
+
* Use 0, 1, 2, 4, or 8 for border width of 0px, 1px, 2px, 4px, or 8px.
|
|
98
|
+
*/
|
|
99
|
+
borderWidth?: BoxBorderWidth;
|
|
100
|
+
/**
|
|
101
|
+
* The border color of the component.
|
|
102
|
+
*/
|
|
103
|
+
borderColor?: BoxBorderColor;
|
|
104
|
+
/**
|
|
105
|
+
* The background color of the component.
|
|
106
|
+
*/
|
|
107
|
+
backgroundColor?: BoxBackgroundColor;
|
|
25
108
|
/**
|
|
26
109
|
* Optional prop to add twrnc overriding classNames.
|
|
27
110
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Box.types.d.mts","sourceRoot":"","sources":["../../../src/components/Box/Box.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,8BAAqB;AAE9C,OAAO,KAAK,EACV,gBAAgB,EAChB,WAAW,EACX,UAAU,EACV,aAAa,EACb,iBAAiB,EAClB,8BAAoB;AAErB,MAAM,MAAM,QAAQ,GAAG;IACrB;;OAEG;IACH,aAAa,CAAC,EAAE,gBAAgB,CAAC;IACjC;;OAEG;IACH,QAAQ,CAAC,EAAE,WAAW,CAAC;IACvB;;;OAGG;IACH,GAAG,CAAC,EAAE,UAAU,CAAC;IACjB;;OAEG;IACH,UAAU,CAAC,EAAE,aAAa,CAAC;IAC3B;;OAEG;IACH,cAAc,CAAC,EAAE,iBAAiB,CAAC;IACnC;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,GAAG,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"Box.types.d.mts","sourceRoot":"","sources":["../../../src/components/Box/Box.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,8BAAqB;AAE9C,OAAO,KAAK,EACV,gBAAgB,EAChB,WAAW,EACX,UAAU,EACV,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EACf,8BAAoB;AAErB,MAAM,MAAM,QAAQ,GAAG;IACrB;;OAEG;IACH,aAAa,CAAC,EAAE,gBAAgB,CAAC;IACjC;;OAEG;IACH,QAAQ,CAAC,EAAE,WAAW,CAAC;IACvB;;;OAGG;IACH,GAAG,CAAC,EAAE,UAAU,CAAC;IACjB;;OAEG;IACH,UAAU,CAAC,EAAE,aAAa,CAAC;IAC3B;;OAEG;IACH,cAAc,CAAC,EAAE,iBAAiB,CAAC;IACnC;;;OAGG;IACH,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB;;;OAGG;IACH,SAAS,CAAC,EAAE,UAAU,CAAC;IACvB;;;OAGG;IACH,WAAW,CAAC,EAAE,UAAU,CAAC;IACzB;;;OAGG;IACH,YAAY,CAAC,EAAE,UAAU,CAAC;IAC1B;;;OAGG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,UAAU,CAAC;IAC9B;;;OAGG;IACH,cAAc,CAAC,EAAE,UAAU,CAAC;IAC5B;;;OAGG;IACH,OAAO,CAAC,EAAE,UAAU,CAAC;IACrB;;;OAGG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB;;;OAGG;IACH,YAAY,CAAC,EAAE,UAAU,CAAC;IAC1B;;;OAGG;IACH,aAAa,CAAC,EAAE,UAAU,CAAC;IAC3B;;;OAGG;IACH,WAAW,CAAC,EAAE,UAAU,CAAC;IACzB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,UAAU,CAAC;IAC/B;;;OAGG;IACH,eAAe,CAAC,EAAE,UAAU,CAAC;IAC7B;;;OAGG;IACH,WAAW,CAAC,EAAE,cAAc,CAAC;IAC7B;;OAEG;IACH,WAAW,CAAC,EAAE,cAAc,CAAC;IAC7B;;OAEG;IACH,eAAe,CAAC,EAAE,kBAAkB,CAAC;IACrC;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,GAAG,SAAS,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Box.types.mjs","sourceRoot":"","sources":["../../../src/components/Box/Box.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ViewProps } from 'react-native';\n\nimport type {\n BoxFlexDirection,\n BoxFlexWrap,\n BoxSpacing,\n BoxAlignItems,\n BoxJustifyContent,\n} from '../../types';\n\nexport type BoxProps = {\n /**\n * The flexDirection style of the component.\n */\n flexDirection?: BoxFlexDirection;\n /**\n * The flexWrap style of the component.\n */\n flexWrap?: BoxFlexWrap;\n /**\n * The gap between the component's children.\n * Use 1-12 for a gap of 4px-48px.\n */\n gap?: BoxSpacing;\n /**\n * The alignItems style of the component.\n */\n alignItems?: BoxAlignItems;\n /**\n * The justifyContent style of the component.\n */\n justifyContent?: BoxJustifyContent;\n /**\n * Optional prop to add twrnc overriding classNames.\n */\n twClassName?: string;\n} & ViewProps;\n"]}
|
|
1
|
+
{"version":3,"file":"Box.types.mjs","sourceRoot":"","sources":["../../../src/components/Box/Box.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ViewProps } from 'react-native';\n\nimport type {\n BoxFlexDirection,\n BoxFlexWrap,\n BoxSpacing,\n BoxBorderWidth,\n BoxAlignItems,\n BoxJustifyContent,\n BoxBackgroundColor,\n BoxBorderColor,\n} from '../../types';\n\nexport type BoxProps = {\n /**\n * The flexDirection style of the component.\n */\n flexDirection?: BoxFlexDirection;\n /**\n * The flexWrap style of the component.\n */\n flexWrap?: BoxFlexWrap;\n /**\n * The gap between the component's children.\n * Use 1-12 for a gap of 4px-48px.\n */\n gap?: BoxSpacing;\n /**\n * The alignItems style of the component.\n */\n alignItems?: BoxAlignItems;\n /**\n * The justifyContent style of the component.\n */\n justifyContent?: BoxJustifyContent;\n /**\n * The margin of the component.\n * Use 1-12 for margin of 4px-48px.\n */\n margin?: BoxSpacing;\n /**\n * The top margin of the component.\n * Use 1-12 for margin of 4px-48px.\n */\n marginTop?: BoxSpacing;\n /**\n * The right margin of the component.\n * Use 1-12 for margin of 4px-48px.\n */\n marginRight?: BoxSpacing;\n /**\n * The bottom margin of the component.\n * Use 1-12 for margin of 4px-48px.\n */\n marginBottom?: BoxSpacing;\n /**\n * The left margin of the component.\n * Use 1-12 for margin of 4px-48px.\n */\n marginLeft?: BoxSpacing;\n /**\n * The horizontal margin of the component.\n * Use 1-12 for margin of 4px-48px.\n */\n marginHorizontal?: BoxSpacing;\n /**\n * The vertical margin of the component.\n * Use 1-12 for margin of 4px-48px.\n */\n marginVertical?: BoxSpacing;\n /**\n * The padding of the component.\n * Use 1-12 for padding of 4px-48px.\n */\n padding?: BoxSpacing;\n /**\n * The top padding of the component.\n * Use 1-12 for padding of 4px-48px.\n */\n paddingTop?: BoxSpacing;\n /**\n * The right padding of the component.\n * Use 1-12 for padding of 4px-48px.\n */\n paddingRight?: BoxSpacing;\n /**\n * The bottom padding of the component.\n * Use 1-12 for padding of 4px-48px.\n */\n paddingBottom?: BoxSpacing;\n /**\n * The left padding of the component.\n * Use 1-12 for padding of 4px-48px.\n */\n paddingLeft?: BoxSpacing;\n /**\n * The horizontal padding of the component.\n * Use 1-12 for padding of 4px-48px.\n */\n paddingHorizontal?: BoxSpacing;\n /**\n * The vertical padding of the component.\n * Use 1-12 for padding of 4px-48px.\n */\n paddingVertical?: BoxSpacing;\n /**\n * The border width of the component.\n * Use 0, 1, 2, 4, or 8 for border width of 0px, 1px, 2px, 4px, or 8px.\n */\n borderWidth?: BoxBorderWidth;\n /**\n * The border color of the component.\n */\n borderColor?: BoxBorderColor;\n /**\n * The background color of the component.\n */\n backgroundColor?: BoxBackgroundColor;\n /**\n * Optional prop to add twrnc overriding classNames.\n */\n twClassName?: string;\n} & ViewProps;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../src/components/Box/index.ts"],"names":[],"mappings":";;;AAAA,+CAKqB;AAJnB,yGAAA,gBAAgB,OAAA;AAChB,oGAAA,WAAW,OAAA;AACX,sGAAA,aAAa,OAAA;AACb,0GAAA,iBAAiB,OAAA;AAGnB,iCAA4B;AAAnB,0FAAA,GAAG,OAAA","sourcesContent":["export {\n BoxFlexDirection,\n BoxFlexWrap,\n BoxAlignItems,\n BoxJustifyContent,\n} from '../../types';\nexport type { BoxSpacing } from '../../types';\nexport { Box } from './Box';\nexport type { BoxProps } from './Box.types';\n"]}
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../src/components/Box/index.ts"],"names":[],"mappings":";;;AAAA,+CAKqB;AAJnB,yGAAA,gBAAgB,OAAA;AAChB,oGAAA,WAAW,OAAA;AACX,sGAAA,aAAa,OAAA;AACb,0GAAA,iBAAiB,OAAA;AAGnB,iCAA4B;AAAnB,0FAAA,GAAG,OAAA","sourcesContent":["export {\n BoxFlexDirection,\n BoxFlexWrap,\n BoxAlignItems,\n BoxJustifyContent,\n} from '../../types';\nexport type { BoxSpacing, BoxBorderWidth } from '../../types';\nexport { Box } from './Box';\nexport type { BoxProps } from './Box.types';\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { BoxFlexDirection, BoxFlexWrap, BoxAlignItems, BoxJustifyContent, } from "../../types/index.cjs";
|
|
2
|
-
export type { BoxSpacing } from "../../types/index.cjs";
|
|
2
|
+
export type { BoxSpacing, BoxBorderWidth } from "../../types/index.cjs";
|
|
3
3
|
export { Box } from "./Box.cjs";
|
|
4
4
|
export type { BoxProps } from "./Box.types.cjs";
|
|
5
5
|
//# sourceMappingURL=index.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/components/Box/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,WAAW,EACX,aAAa,EACb,iBAAiB,GAClB,8BAAoB;AACrB,YAAY,EAAE,UAAU,EAAE,8BAAoB;
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/components/Box/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,WAAW,EACX,aAAa,EACb,iBAAiB,GAClB,8BAAoB;AACrB,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,8BAAoB;AAC9D,OAAO,EAAE,GAAG,EAAE,kBAAc;AAC5B,YAAY,EAAE,QAAQ,EAAE,wBAAoB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { BoxFlexDirection, BoxFlexWrap, BoxAlignItems, BoxJustifyContent, } from "../../types/index.mjs";
|
|
2
|
-
export type { BoxSpacing } from "../../types/index.mjs";
|
|
2
|
+
export type { BoxSpacing, BoxBorderWidth } from "../../types/index.mjs";
|
|
3
3
|
export { Box } from "./Box.mjs";
|
|
4
4
|
export type { BoxProps } from "./Box.types.mjs";
|
|
5
5
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/components/Box/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,WAAW,EACX,aAAa,EACb,iBAAiB,GAClB,8BAAoB;AACrB,YAAY,EAAE,UAAU,EAAE,8BAAoB;
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/components/Box/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,WAAW,EACX,aAAa,EACb,iBAAiB,GAClB,8BAAoB;AACrB,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,8BAAoB;AAC9D,OAAO,EAAE,GAAG,EAAE,kBAAc;AAC5B,YAAY,EAAE,QAAQ,EAAE,wBAAoB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/components/Box/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,WAAW,EACX,aAAa,EACb,iBAAiB,EAClB,8BAAoB;AAErB,OAAO,EAAE,GAAG,EAAE,kBAAc","sourcesContent":["export {\n BoxFlexDirection,\n BoxFlexWrap,\n BoxAlignItems,\n BoxJustifyContent,\n} from '../../types';\nexport type { BoxSpacing } from '../../types';\nexport { Box } from './Box';\nexport type { BoxProps } from './Box.types';\n"]}
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/components/Box/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,WAAW,EACX,aAAa,EACb,iBAAiB,EAClB,8BAAoB;AAErB,OAAO,EAAE,GAAG,EAAE,kBAAc","sourcesContent":["export {\n BoxFlexDirection,\n BoxFlexWrap,\n BoxAlignItems,\n BoxJustifyContent,\n} from '../../types';\nexport type { BoxSpacing, BoxBorderWidth } from '../../types';\nexport { Box } from './Box';\nexport type { BoxProps } from './Box.types';\n"]}
|
|
@@ -19,7 +19,7 @@ const Button = (buttonProps) => {
|
|
|
19
19
|
case types_1.ButtonVariant.Secondary:
|
|
20
20
|
return <ButtonSecondary_1.ButtonSecondary {...restProps}/>;
|
|
21
21
|
default:
|
|
22
|
-
throw new Error(`Invalid Button Variant: ${variant}. Expected one of: ${Object.values(types_1.ButtonVariant).join(', ')}`);
|
|
22
|
+
throw new Error(`Invalid Button Variant: ${String(variant)}. Expected one of: ${Object.values(types_1.ButtonVariant).join(', ')}`);
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
25
|
exports.Button = Button;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.cjs","sourceRoot":"","sources":["../../../src/components/Button/Button.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAE1B,iDAA4C;AAG5C,sEAAyD;AACzD,0EAA6D;AAC7D,wEAA2D;AAEpD,MAAM,MAAM,GAAG,CAAC,WAAwB,EAAE,EAAE;IACjD,MAAM,EAAE,OAAO,EAAE,GAAG,SAAS,EAAE,GAAG,WAAW,CAAC;IAE9C,QAAQ,OAAO,EAAE;QACf,KAAK,qBAAa,CAAC,QAAQ;YACzB,OAAO,CAAC,+BAAc,CAAC,IAAI,SAAS,CAAC,EAAG,CAAC;QAC3C,KAAK,qBAAa,CAAC,OAAO;YACxB,OAAO,CAAC,6BAAa,CAAC,IAAI,SAAS,CAAC,EAAG,CAAC;QAC1C,KAAK,qBAAa,CAAC,SAAS;YAC1B,OAAO,CAAC,iCAAe,CAAC,IAAI,SAAS,CAAC,EAAG,CAAC;QAC5C;YACE,MAAM,IAAI,KAAK,CACb,2BAA2B,OAAO,sBAAsB,MAAM,CAAC,MAAM,CAAC,qBAAa,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"Button.cjs","sourceRoot":"","sources":["../../../src/components/Button/Button.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAE1B,iDAA4C;AAG5C,sEAAyD;AACzD,0EAA6D;AAC7D,wEAA2D;AAEpD,MAAM,MAAM,GAAG,CAAC,WAAwB,EAAE,EAAE;IACjD,MAAM,EAAE,OAAO,EAAE,GAAG,SAAS,EAAE,GAAG,WAAW,CAAC;IAE9C,QAAQ,OAAO,EAAE;QACf,KAAK,qBAAa,CAAC,QAAQ;YACzB,OAAO,CAAC,+BAAc,CAAC,IAAI,SAAS,CAAC,EAAG,CAAC;QAC3C,KAAK,qBAAa,CAAC,OAAO;YACxB,OAAO,CAAC,6BAAa,CAAC,IAAI,SAAS,CAAC,EAAG,CAAC;QAC1C,KAAK,qBAAa,CAAC,SAAS;YAC1B,OAAO,CAAC,iCAAe,CAAC,IAAI,SAAS,CAAC,EAAG,CAAC;QAC5C;YACE,MAAM,IAAI,KAAK,CACb,2BAA2B,MAAM,CAAC,OAAO,CAAC,sBAAsB,MAAM,CAAC,MAAM,CAAC,qBAAa,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAC1G,CAAC;KACL;AACH,CAAC,CAAC;AAfW,QAAA,MAAM,UAejB","sourcesContent":["import React from 'react';\n\nimport { ButtonVariant } from '../../types';\n\nimport type { ButtonProps } from './Button.types';\nimport { ButtonPrimary } from './variants/ButtonPrimary';\nimport { ButtonSecondary } from './variants/ButtonSecondary';\nimport { ButtonTertiary } from './variants/ButtonTertiary';\n\nexport const Button = (buttonProps: ButtonProps) => {\n const { variant, ...restProps } = buttonProps;\n\n switch (variant) {\n case ButtonVariant.Tertiary:\n return <ButtonTertiary {...restProps} />;\n case ButtonVariant.Primary:\n return <ButtonPrimary {...restProps} />;\n case ButtonVariant.Secondary:\n return <ButtonSecondary {...restProps} />;\n default:\n throw new Error(\n `Invalid Button Variant: ${String(variant)}. Expected one of: ${Object.values(ButtonVariant).join(', ')}`,\n );\n }\n};\n"]}
|
|
@@ -20,7 +20,7 @@ export const Button = (buttonProps) => {
|
|
|
20
20
|
case ButtonVariant.Secondary:
|
|
21
21
|
return <ButtonSecondary {...restProps}/>;
|
|
22
22
|
default:
|
|
23
|
-
throw new Error(`Invalid Button Variant: ${variant}. Expected one of: ${Object.values(ButtonVariant).join(', ')}`);
|
|
23
|
+
throw new Error(`Invalid Button Variant: ${String(variant)}. Expected one of: ${Object.values(ButtonVariant).join(', ')}`);
|
|
24
24
|
}
|
|
25
25
|
};
|
|
26
26
|
//# sourceMappingURL=Button.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.mjs","sourceRoot":"","sources":["../../../src/components/Button/Button.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,MAAK,cAAc;;AAE1B,OAAO,EAAE,aAAa,EAAE,8BAAoB;AAG5C,OAAO,EAAE,aAAa,EAAE,2CAAiC;AACzD,OAAO,EAAE,eAAe,EAAE,6CAAmC;AAC7D,OAAO,EAAE,cAAc,EAAE,4CAAkC;AAE3D,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,WAAwB,EAAE,EAAE;IACjD,MAAM,EAAE,OAAO,EAAE,GAAG,SAAS,EAAE,GAAG,WAAW,CAAC;IAE9C,QAAQ,OAAO,EAAE;QACf,KAAK,aAAa,CAAC,QAAQ;YACzB,OAAO,CAAC,cAAc,CAAC,IAAI,SAAS,CAAC,EAAG,CAAC;QAC3C,KAAK,aAAa,CAAC,OAAO;YACxB,OAAO,CAAC,aAAa,CAAC,IAAI,SAAS,CAAC,EAAG,CAAC;QAC1C,KAAK,aAAa,CAAC,SAAS;YAC1B,OAAO,CAAC,eAAe,CAAC,IAAI,SAAS,CAAC,EAAG,CAAC;QAC5C;YACE,MAAM,IAAI,KAAK,CACb,2BAA2B,OAAO,sBAAsB,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"Button.mjs","sourceRoot":"","sources":["../../../src/components/Button/Button.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,MAAK,cAAc;;AAE1B,OAAO,EAAE,aAAa,EAAE,8BAAoB;AAG5C,OAAO,EAAE,aAAa,EAAE,2CAAiC;AACzD,OAAO,EAAE,eAAe,EAAE,6CAAmC;AAC7D,OAAO,EAAE,cAAc,EAAE,4CAAkC;AAE3D,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,WAAwB,EAAE,EAAE;IACjD,MAAM,EAAE,OAAO,EAAE,GAAG,SAAS,EAAE,GAAG,WAAW,CAAC;IAE9C,QAAQ,OAAO,EAAE;QACf,KAAK,aAAa,CAAC,QAAQ;YACzB,OAAO,CAAC,cAAc,CAAC,IAAI,SAAS,CAAC,EAAG,CAAC;QAC3C,KAAK,aAAa,CAAC,OAAO;YACxB,OAAO,CAAC,aAAa,CAAC,IAAI,SAAS,CAAC,EAAG,CAAC;QAC1C,KAAK,aAAa,CAAC,SAAS;YAC1B,OAAO,CAAC,eAAe,CAAC,IAAI,SAAS,CAAC,EAAG,CAAC;QAC5C;YACE,MAAM,IAAI,KAAK,CACb,2BAA2B,MAAM,CAAC,OAAO,CAAC,sBAAsB,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAC1G,CAAC;KACL;AACH,CAAC,CAAC","sourcesContent":["import React from 'react';\n\nimport { ButtonVariant } from '../../types';\n\nimport type { ButtonProps } from './Button.types';\nimport { ButtonPrimary } from './variants/ButtonPrimary';\nimport { ButtonSecondary } from './variants/ButtonSecondary';\nimport { ButtonTertiary } from './variants/ButtonTertiary';\n\nexport const Button = (buttonProps: ButtonProps) => {\n const { variant, ...restProps } = buttonProps;\n\n switch (variant) {\n case ButtonVariant.Tertiary:\n return <ButtonTertiary {...restProps} />;\n case ButtonVariant.Primary:\n return <ButtonPrimary {...restProps} />;\n case ButtonVariant.Secondary:\n return <ButtonSecondary {...restProps} />;\n default:\n throw new Error(\n `Invalid Button Variant: ${String(variant)}. Expected one of: ${Object.values(ButtonVariant).join(', ')}`,\n );\n }\n};\n"]}
|
|
@@ -24,83 +24,55 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.ButtonPrimary = void 0;
|
|
27
|
-
const design_system_twrnc_preset_1 = require("@metamask-previews/design-system-twrnc-preset");
|
|
28
27
|
const react_1 = __importStar(require("react"));
|
|
29
28
|
const ButtonBase_1 = require("../../../ButtonBase/index.cjs");
|
|
30
29
|
const Icon_1 = require("../../../Icon/index.cjs");
|
|
31
30
|
const Text_1 = require("../../../Text/index.cjs");
|
|
32
|
-
const
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
: 'bg-default'
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
? 'text-default'
|
|
61
|
-
: 'text-primary-inverse';
|
|
62
|
-
const onPressInHandler = (event) => {
|
|
63
|
-
setIsPressed(true);
|
|
64
|
-
onPressIn?.(event);
|
|
65
|
-
};
|
|
66
|
-
const onPressOutHandler = (event) => {
|
|
67
|
-
setIsPressed(false);
|
|
68
|
-
onPressOut?.(event);
|
|
69
|
-
};
|
|
31
|
+
const ButtonPrimary = ({ children, textProps, spinnerProps, startIconProps, endIconProps, isDanger = false, isInverse = false, isLoading = false, twClassName = '', style, ...props }) => {
|
|
32
|
+
const getContainerClassName = (0, react_1.useCallback)((pressed) => {
|
|
33
|
+
const classNameStr = typeof twClassName === 'function' ? twClassName(pressed) : twClassName;
|
|
34
|
+
if (isInverse && isDanger) {
|
|
35
|
+
return `${pressed || isLoading ? 'bg-default-pressed' : 'bg-default'} ${classNameStr}`;
|
|
36
|
+
}
|
|
37
|
+
if (isDanger) {
|
|
38
|
+
return `${pressed || isLoading ? 'bg-error-default-pressed' : 'bg-error-default'} ${classNameStr}`;
|
|
39
|
+
}
|
|
40
|
+
if (isInverse) {
|
|
41
|
+
return `${pressed || isLoading ? 'bg-default-pressed' : 'bg-default'} ${classNameStr}`;
|
|
42
|
+
}
|
|
43
|
+
return `${pressed || isLoading ? 'bg-icon-default-pressed' : 'bg-icon-default'} ${classNameStr}`;
|
|
44
|
+
}, [isInverse, isDanger, isLoading, twClassName]);
|
|
45
|
+
const getTextClassName = (0, react_1.useCallback)((pressed) => {
|
|
46
|
+
if (isInverse && isDanger) {
|
|
47
|
+
return pressed || isLoading
|
|
48
|
+
? 'text-error-default-pressed'
|
|
49
|
+
: 'text-error-default';
|
|
50
|
+
}
|
|
51
|
+
if (isDanger) {
|
|
52
|
+
return 'text-primary-inverse';
|
|
53
|
+
}
|
|
54
|
+
if (isInverse) {
|
|
55
|
+
return 'text-default';
|
|
56
|
+
}
|
|
57
|
+
return 'text-primary-inverse';
|
|
58
|
+
}, [isInverse, isDanger, isLoading]);
|
|
70
59
|
return (<ButtonBase_1.ButtonBase textProps={{
|
|
71
60
|
variant: Text_1.TextVariant.BodyMd,
|
|
72
61
|
fontWeight: Text_1.FontWeight.Medium,
|
|
73
62
|
numberOfLines: 1,
|
|
74
63
|
ellipsizeMode: 'clip',
|
|
75
64
|
...textProps,
|
|
76
|
-
twClassName: `${twTextClassNames} ${textProps?.twClassName ?? ''}`,
|
|
77
65
|
}} spinnerProps={{
|
|
78
|
-
color: twTextClassNames,
|
|
79
|
-
loadingTextProps: {
|
|
80
|
-
twClassName: twTextClassNames,
|
|
81
|
-
},
|
|
82
66
|
...spinnerProps,
|
|
83
67
|
}} startIconProps={{
|
|
84
68
|
size: Icon_1.IconSize.Sm,
|
|
85
69
|
...startIconProps,
|
|
86
|
-
twClassName: `${twTextClassNames} ${startIconProps?.twClassName ?? ''}`,
|
|
87
70
|
}} endIconProps={{
|
|
88
71
|
size: Icon_1.IconSize.Sm,
|
|
89
72
|
...endIconProps,
|
|
90
|
-
|
|
91
|
-
}} isLoading={isLoading} onPressIn={onPressInHandler} onPressOut={onPressOutHandler} style={[tw `${twContainerClassNames}`, style]} {...props}>
|
|
73
|
+
}} isLoading={isLoading} twClassName={getContainerClassName} textClassName={getTextClassName} iconClassName={getTextClassName} style={style} {...props}>
|
|
92
74
|
{children}
|
|
93
75
|
</ButtonBase_1.ButtonBase>);
|
|
94
76
|
};
|
|
95
|
-
const ButtonPrimary = ({ isInverse = false, ...props }) => {
|
|
96
|
-
// If inverse, use the current theme context
|
|
97
|
-
if (isInverse) {
|
|
98
|
-
return <ButtonPrimaryBase isInverse {...props}/>;
|
|
99
|
-
}
|
|
100
|
-
// Otherwise, force light theme
|
|
101
|
-
return (<design_system_twrnc_preset_1.ThemeProvider theme={design_system_twrnc_preset_1.Theme.Light}>
|
|
102
|
-
<ButtonPrimaryBase isInverse={false} {...props}/>
|
|
103
|
-
</design_system_twrnc_preset_1.ThemeProvider>);
|
|
104
|
-
};
|
|
105
77
|
exports.ButtonPrimary = ButtonPrimary;
|
|
106
78
|
//# sourceMappingURL=ButtonPrimary.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonPrimary.cjs","sourceRoot":"","sources":["../../../../../src/components/Button/variants/ButtonPrimary/ButtonPrimary.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA
|
|
1
|
+
{"version":3,"file":"ButtonPrimary.cjs","sourceRoot":"","sources":["../../../../../src/components/Button/variants/ButtonPrimary/ButtonPrimary.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA2C;AAE3C,8DAAiD;AACjD,kDAAyC;AACzC,kDAAwD;AAIjD,MAAM,aAAa,GAAG,CAAC,EAC5B,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,QAAQ,GAAG,KAAK,EAChB,SAAS,GAAG,KAAK,EACjB,SAAS,GAAG,KAAK,EACjB,WAAW,GAAG,EAAE,EAChB,KAAK,EACL,GAAG,KAAK,EACW,EAAE,EAAE;IACvB,MAAM,qBAAqB,GAAG,IAAA,mBAAW,EACvC,CAAC,OAAgB,EAAU,EAAE;QAC3B,MAAM,YAAY,GAChB,OAAO,WAAW,KAAK,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC;QAEzE,IAAI,SAAS,IAAI,QAAQ,EAAE;YACzB,OAAO,GAAG,OAAO,IAAI,SAAS,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,YAAY,IAAI,YAAY,EAAE,CAAC;SACxF;QACD,IAAI,QAAQ,EAAE;YACZ,OAAO,GAAG,OAAO,IAAI,SAAS,CAAC,CAAC,CAAC,0BAA0B,CAAC,CAAC,CAAC,kBAAkB,IAAI,YAAY,EAAE,CAAC;SACpG;QACD,IAAI,SAAS,EAAE;YACb,OAAO,GAAG,OAAO,IAAI,SAAS,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,YAAY,IAAI,YAAY,EAAE,CAAC;SACxF;QACD,OAAO,GAAG,OAAO,IAAI,SAAS,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC,CAAC,iBAAiB,IAAI,YAAY,EAAE,CAAC;IACnG,CAAC,EACD,CAAC,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,CAAC,CAC9C,CAAC;IAEF,MAAM,gBAAgB,GAAG,IAAA,mBAAW,EAClC,CAAC,OAAgB,EAAU,EAAE;QAC3B,IAAI,SAAS,IAAI,QAAQ,EAAE;YACzB,OAAO,OAAO,IAAI,SAAS;gBACzB,CAAC,CAAC,4BAA4B;gBAC9B,CAAC,CAAC,oBAAoB,CAAC;SAC1B;QACD,IAAI,QAAQ,EAAE;YACZ,OAAO,sBAAsB,CAAC;SAC/B;QACD,IAAI,SAAS,EAAE;YACb,OAAO,cAAc,CAAC;SACvB;QACD,OAAO,sBAAsB,CAAC;IAChC,CAAC,EACD,CAAC,SAAS,EAAE,QAAQ,EAAE,SAAS,CAAC,CACjC,CAAC;IAEF,OAAO,CACL,CAAC,uBAAU,CACT,SAAS,CAAC,CAAC;YACT,OAAO,EAAE,kBAAW,CAAC,MAAM;YAC3B,UAAU,EAAE,iBAAU,CAAC,MAAM;YAC7B,aAAa,EAAE,CAAC;YAChB,aAAa,EAAE,MAAM;YACrB,GAAG,SAAS;SACb,CAAC,CACF,YAAY,CAAC,CAAC;YACZ,GAAG,YAAY;SAChB,CAAC,CACF,cAAc,CAAC,CAAC;YACd,IAAI,EAAE,eAAQ,CAAC,EAAE;YACjB,GAAG,cAAc;SAClB,CAAC,CACF,YAAY,CAAC,CAAC;YACZ,IAAI,EAAE,eAAQ,CAAC,EAAE;YACjB,GAAG,YAAY;SAChB,CAAC,CACF,SAAS,CAAC,CAAC,SAAS,CAAC,CACrB,WAAW,CAAC,CAAC,qBAAqB,CAAC,CACnC,aAAa,CAAC,CAAC,gBAAgB,CAAC,CAChC,aAAa,CAAC,CAAC,gBAAgB,CAAC,CAChC,KAAK,CAAC,CAAC,KAAK,CAAC,CACb,IAAI,KAAK,CAAC,CAEV;MAAA,CAAC,QAAQ,CACX;IAAA,EAAE,uBAAU,CAAC,CACd,CAAC;AACJ,CAAC,CAAC;AAhFW,QAAA,aAAa,iBAgFxB","sourcesContent":["import React, { useCallback } from 'react';\n\nimport { ButtonBase } from '../../../ButtonBase';\nimport { IconSize } from '../../../Icon';\nimport { TextVariant, FontWeight } from '../../../Text';\n\nimport type { ButtonPrimaryProps } from './ButtonPrimary.types';\n\nexport const ButtonPrimary = ({\n children,\n textProps,\n spinnerProps,\n startIconProps,\n endIconProps,\n isDanger = false,\n isInverse = false,\n isLoading = false,\n twClassName = '',\n style,\n ...props\n}: ButtonPrimaryProps) => {\n const getContainerClassName = useCallback(\n (pressed: boolean): string => {\n const classNameStr =\n typeof twClassName === 'function' ? twClassName(pressed) : twClassName;\n\n if (isInverse && isDanger) {\n return `${pressed || isLoading ? 'bg-default-pressed' : 'bg-default'} ${classNameStr}`;\n }\n if (isDanger) {\n return `${pressed || isLoading ? 'bg-error-default-pressed' : 'bg-error-default'} ${classNameStr}`;\n }\n if (isInverse) {\n return `${pressed || isLoading ? 'bg-default-pressed' : 'bg-default'} ${classNameStr}`;\n }\n return `${pressed || isLoading ? 'bg-icon-default-pressed' : 'bg-icon-default'} ${classNameStr}`;\n },\n [isInverse, isDanger, isLoading, twClassName],\n );\n\n const getTextClassName = useCallback(\n (pressed: boolean): string => {\n if (isInverse && isDanger) {\n return pressed || isLoading\n ? 'text-error-default-pressed'\n : 'text-error-default';\n }\n if (isDanger) {\n return 'text-primary-inverse';\n }\n if (isInverse) {\n return 'text-default';\n }\n return 'text-primary-inverse';\n },\n [isInverse, isDanger, isLoading],\n );\n\n return (\n <ButtonBase\n textProps={{\n variant: TextVariant.BodyMd,\n fontWeight: FontWeight.Medium,\n numberOfLines: 1,\n ellipsizeMode: 'clip',\n ...textProps,\n }}\n spinnerProps={{\n ...spinnerProps,\n }}\n startIconProps={{\n size: IconSize.Sm,\n ...startIconProps,\n }}\n endIconProps={{\n size: IconSize.Sm,\n ...endIconProps,\n }}\n isLoading={isLoading}\n twClassName={getContainerClassName}\n textClassName={getTextClassName}\n iconClassName={getTextClassName}\n style={style}\n {...props}\n >\n {children}\n </ButtonBase>\n );\n};\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { ButtonPrimaryProps } from "./ButtonPrimary.types.cjs";
|
|
3
|
-
export declare const ButtonPrimary: ({ isInverse, ...props }: ButtonPrimaryProps) => React.JSX.Element;
|
|
3
|
+
export declare const ButtonPrimary: ({ children, textProps, spinnerProps, startIconProps, endIconProps, isDanger, isInverse, isLoading, twClassName, style, ...props }: ButtonPrimaryProps) => React.JSX.Element;
|
|
4
4
|
//# sourceMappingURL=ButtonPrimary.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonPrimary.d.cts","sourceRoot":"","sources":["../../../../../src/components/Button/variants/ButtonPrimary/ButtonPrimary.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ButtonPrimary.d.cts","sourceRoot":"","sources":["../../../../../src/components/Button/variants/ButtonPrimary/ButtonPrimary.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsB,cAAc;AAM3C,OAAO,KAAK,EAAE,kBAAkB,EAAE,kCAA8B;AAEhE,eAAO,MAAM,aAAa,sIAYvB,kBAAkB,sBAoEpB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { ButtonPrimaryProps } from "./ButtonPrimary.types.mjs";
|
|
3
|
-
export declare const ButtonPrimary: ({ isInverse, ...props }: ButtonPrimaryProps) => React.JSX.Element;
|
|
3
|
+
export declare const ButtonPrimary: ({ children, textProps, spinnerProps, startIconProps, endIconProps, isDanger, isInverse, isLoading, twClassName, style, ...props }: ButtonPrimaryProps) => React.JSX.Element;
|
|
4
4
|
//# sourceMappingURL=ButtonPrimary.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonPrimary.d.mts","sourceRoot":"","sources":["../../../../../src/components/Button/variants/ButtonPrimary/ButtonPrimary.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ButtonPrimary.d.mts","sourceRoot":"","sources":["../../../../../src/components/Button/variants/ButtonPrimary/ButtonPrimary.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsB,cAAc;AAM3C,OAAO,KAAK,EAAE,kBAAkB,EAAE,kCAA8B;AAEhE,eAAO,MAAM,aAAa,sIAYvB,kBAAkB,sBAoEpB,CAAC"}
|
|
@@ -4,83 +4,55 @@ function $importDefault(module) {
|
|
|
4
4
|
}
|
|
5
5
|
return module;
|
|
6
6
|
}
|
|
7
|
-
import
|
|
8
|
-
import $React, { useState } from "react";
|
|
7
|
+
import $React, { useCallback } from "react";
|
|
9
8
|
const React = $importDefault($React);
|
|
10
9
|
import { ButtonBase } from "../../../ButtonBase/index.mjs";
|
|
11
10
|
import { IconSize } from "../../../Icon/index.mjs";
|
|
12
11
|
import { TextVariant, FontWeight } from "../../../Text/index.mjs";
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
: 'bg-default'
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
? 'text-default'
|
|
42
|
-
: 'text-primary-inverse';
|
|
43
|
-
const onPressInHandler = (event) => {
|
|
44
|
-
setIsPressed(true);
|
|
45
|
-
onPressIn?.(event);
|
|
46
|
-
};
|
|
47
|
-
const onPressOutHandler = (event) => {
|
|
48
|
-
setIsPressed(false);
|
|
49
|
-
onPressOut?.(event);
|
|
50
|
-
};
|
|
12
|
+
export const ButtonPrimary = ({ children, textProps, spinnerProps, startIconProps, endIconProps, isDanger = false, isInverse = false, isLoading = false, twClassName = '', style, ...props }) => {
|
|
13
|
+
const getContainerClassName = useCallback((pressed) => {
|
|
14
|
+
const classNameStr = typeof twClassName === 'function' ? twClassName(pressed) : twClassName;
|
|
15
|
+
if (isInverse && isDanger) {
|
|
16
|
+
return `${pressed || isLoading ? 'bg-default-pressed' : 'bg-default'} ${classNameStr}`;
|
|
17
|
+
}
|
|
18
|
+
if (isDanger) {
|
|
19
|
+
return `${pressed || isLoading ? 'bg-error-default-pressed' : 'bg-error-default'} ${classNameStr}`;
|
|
20
|
+
}
|
|
21
|
+
if (isInverse) {
|
|
22
|
+
return `${pressed || isLoading ? 'bg-default-pressed' : 'bg-default'} ${classNameStr}`;
|
|
23
|
+
}
|
|
24
|
+
return `${pressed || isLoading ? 'bg-icon-default-pressed' : 'bg-icon-default'} ${classNameStr}`;
|
|
25
|
+
}, [isInverse, isDanger, isLoading, twClassName]);
|
|
26
|
+
const getTextClassName = useCallback((pressed) => {
|
|
27
|
+
if (isInverse && isDanger) {
|
|
28
|
+
return pressed || isLoading
|
|
29
|
+
? 'text-error-default-pressed'
|
|
30
|
+
: 'text-error-default';
|
|
31
|
+
}
|
|
32
|
+
if (isDanger) {
|
|
33
|
+
return 'text-primary-inverse';
|
|
34
|
+
}
|
|
35
|
+
if (isInverse) {
|
|
36
|
+
return 'text-default';
|
|
37
|
+
}
|
|
38
|
+
return 'text-primary-inverse';
|
|
39
|
+
}, [isInverse, isDanger, isLoading]);
|
|
51
40
|
return (<ButtonBase textProps={{
|
|
52
41
|
variant: TextVariant.BodyMd,
|
|
53
42
|
fontWeight: FontWeight.Medium,
|
|
54
43
|
numberOfLines: 1,
|
|
55
44
|
ellipsizeMode: 'clip',
|
|
56
45
|
...textProps,
|
|
57
|
-
twClassName: `${twTextClassNames} ${textProps?.twClassName ?? ''}`,
|
|
58
46
|
}} spinnerProps={{
|
|
59
|
-
color: twTextClassNames,
|
|
60
|
-
loadingTextProps: {
|
|
61
|
-
twClassName: twTextClassNames,
|
|
62
|
-
},
|
|
63
47
|
...spinnerProps,
|
|
64
48
|
}} startIconProps={{
|
|
65
49
|
size: IconSize.Sm,
|
|
66
50
|
...startIconProps,
|
|
67
|
-
twClassName: `${twTextClassNames} ${startIconProps?.twClassName ?? ''}`,
|
|
68
51
|
}} endIconProps={{
|
|
69
52
|
size: IconSize.Sm,
|
|
70
53
|
...endIconProps,
|
|
71
|
-
|
|
72
|
-
}} isLoading={isLoading} onPressIn={onPressInHandler} onPressOut={onPressOutHandler} style={[tw `${twContainerClassNames}`, style]} {...props}>
|
|
54
|
+
}} isLoading={isLoading} twClassName={getContainerClassName} textClassName={getTextClassName} iconClassName={getTextClassName} style={style} {...props}>
|
|
73
55
|
{children}
|
|
74
56
|
</ButtonBase>);
|
|
75
57
|
};
|
|
76
|
-
export const ButtonPrimary = ({ isInverse = false, ...props }) => {
|
|
77
|
-
// If inverse, use the current theme context
|
|
78
|
-
if (isInverse) {
|
|
79
|
-
return <ButtonPrimaryBase isInverse {...props}/>;
|
|
80
|
-
}
|
|
81
|
-
// Otherwise, force light theme
|
|
82
|
-
return (<ThemeProvider theme={Theme.Light}>
|
|
83
|
-
<ButtonPrimaryBase isInverse={false} {...props}/>
|
|
84
|
-
</ThemeProvider>);
|
|
85
|
-
};
|
|
86
58
|
//# sourceMappingURL=ButtonPrimary.mjs.map
|