@metamask-previews/design-system-react-native 0.1.0-preview.a448767 → 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 +21 -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/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/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/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/types/index.cjs +140 -1
- package/dist/types/index.cjs.map +1 -1
- package/dist/types/index.d.cts +138 -1
- package/dist/types/index.d.cts.map +1 -1
- package/dist/types/index.d.mts +138 -1
- package/dist/types/index.d.mts.map +1 -1
- package/dist/types/index.mjs +139 -0
- package/dist/types/index.mjs.map +1 -1
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Box.d.cts","sourceRoot":"","sources":["../../../src/components/Box/Box.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,cAAc;
|
|
1
|
+
{"version":3,"file":"Box.d.cts","sourceRoot":"","sources":["../../../src/components/Box/Box.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,cAAc;AAqB1B,OAAO,KAAK,EAAE,QAAQ,EAAE,wBAAoB;AAE5C,eAAO,MAAM,GAAG,mVA2Bb,QAAQ,sBAiCV,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { BoxProps } from "./Box.types.mjs";
|
|
3
|
-
export declare const Box: ({ flexDirection, flexWrap, gap, alignItems, justifyContent, twClassName, style, children, ...props }: BoxProps) => React.JSX.Element;
|
|
3
|
+
export declare const Box: ({ flexDirection, flexWrap, gap, alignItems, justifyContent, margin, marginTop, marginRight, marginBottom, marginLeft, marginHorizontal, marginVertical, padding, paddingTop, paddingRight, paddingBottom, paddingLeft, paddingHorizontal, paddingVertical, borderWidth, borderColor, backgroundColor, twClassName, style, children, ...props }: BoxProps) => React.JSX.Element;
|
|
4
4
|
//# sourceMappingURL=Box.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Box.d.mts","sourceRoot":"","sources":["../../../src/components/Box/Box.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,cAAc;
|
|
1
|
+
{"version":3,"file":"Box.d.mts","sourceRoot":"","sources":["../../../src/components/Box/Box.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,cAAc;AAqB1B,OAAO,KAAK,EAAE,QAAQ,EAAE,wBAAoB;AAE5C,eAAO,MAAM,GAAG,mVA2Bb,QAAQ,sBAiCV,CAAC"}
|
|
@@ -8,18 +8,35 @@ import { useTailwind } from "@metamask-previews/design-system-twrnc-preset";
|
|
|
8
8
|
import $React from "react";
|
|
9
9
|
const React = $importDefault($React);
|
|
10
10
|
import { View } from "react-native/index.js";
|
|
11
|
-
import { TWCLASSMAP_BOX_GAP } from "./Box.constants.mjs";
|
|
12
|
-
export const Box = ({ flexDirection, flexWrap, gap, alignItems, justifyContent, twClassName = '', style, children, ...props }) => {
|
|
11
|
+
import { TWCLASSMAP_BOX_GAP, TWCLASSMAP_BOX_MARGIN, TWCLASSMAP_BOX_MARGIN_TOP, TWCLASSMAP_BOX_MARGIN_RIGHT, TWCLASSMAP_BOX_MARGIN_BOTTOM, TWCLASSMAP_BOX_MARGIN_LEFT, TWCLASSMAP_BOX_MARGIN_HORIZONTAL, TWCLASSMAP_BOX_MARGIN_VERTICAL, TWCLASSMAP_BOX_PADDING, TWCLASSMAP_BOX_PADDING_TOP, TWCLASSMAP_BOX_PADDING_RIGHT, TWCLASSMAP_BOX_PADDING_BOTTOM, TWCLASSMAP_BOX_PADDING_LEFT, TWCLASSMAP_BOX_PADDING_HORIZONTAL, TWCLASSMAP_BOX_PADDING_VERTICAL, TWCLASSMAP_BOX_BORDER_WIDTH } from "./Box.constants.mjs";
|
|
12
|
+
export const Box = ({ flexDirection, flexWrap, gap, alignItems, justifyContent, margin, marginTop, marginRight, marginBottom, marginLeft, marginHorizontal, marginVertical, padding, paddingTop, paddingRight, paddingBottom, paddingLeft, paddingHorizontal, paddingVertical, borderWidth, borderColor, backgroundColor, twClassName = '', style, children, ...props }) => {
|
|
13
13
|
const tw = useTailwind();
|
|
14
|
-
const twContainerClassNames = `
|
|
14
|
+
const twContainerClassNames = tw `
|
|
15
15
|
flex
|
|
16
16
|
${flexDirection ?? ''}
|
|
17
17
|
${flexWrap ?? ''}
|
|
18
18
|
${gap !== undefined ? TWCLASSMAP_BOX_GAP[gap] : ''}
|
|
19
19
|
${alignItems ?? ''}
|
|
20
|
-
${justifyContent ?? ''}
|
|
21
|
-
${
|
|
22
|
-
|
|
20
|
+
${justifyContent ?? ''}
|
|
21
|
+
${margin !== undefined ? TWCLASSMAP_BOX_MARGIN[margin] : ''}
|
|
22
|
+
${marginTop !== undefined ? TWCLASSMAP_BOX_MARGIN_TOP[marginTop] : ''}
|
|
23
|
+
${marginRight !== undefined ? TWCLASSMAP_BOX_MARGIN_RIGHT[marginRight] : ''}
|
|
24
|
+
${marginBottom !== undefined ? TWCLASSMAP_BOX_MARGIN_BOTTOM[marginBottom] : ''}
|
|
25
|
+
${marginLeft !== undefined ? TWCLASSMAP_BOX_MARGIN_LEFT[marginLeft] : ''}
|
|
26
|
+
${marginHorizontal !== undefined ? TWCLASSMAP_BOX_MARGIN_HORIZONTAL[marginHorizontal] : ''}
|
|
27
|
+
${marginVertical !== undefined ? TWCLASSMAP_BOX_MARGIN_VERTICAL[marginVertical] : ''}
|
|
28
|
+
${padding !== undefined ? TWCLASSMAP_BOX_PADDING[padding] : ''}
|
|
29
|
+
${paddingTop !== undefined ? TWCLASSMAP_BOX_PADDING_TOP[paddingTop] : ''}
|
|
30
|
+
${paddingRight !== undefined ? TWCLASSMAP_BOX_PADDING_RIGHT[paddingRight] : ''}
|
|
31
|
+
${paddingBottom !== undefined ? TWCLASSMAP_BOX_PADDING_BOTTOM[paddingBottom] : ''}
|
|
32
|
+
${paddingLeft !== undefined ? TWCLASSMAP_BOX_PADDING_LEFT[paddingLeft] : ''}
|
|
33
|
+
${paddingHorizontal !== undefined ? TWCLASSMAP_BOX_PADDING_HORIZONTAL[paddingHorizontal] : ''}
|
|
34
|
+
${paddingVertical !== undefined ? TWCLASSMAP_BOX_PADDING_VERTICAL[paddingVertical] : ''}
|
|
35
|
+
${borderWidth !== undefined ? TWCLASSMAP_BOX_BORDER_WIDTH[borderWidth] : ''}
|
|
36
|
+
${borderColor ?? ''}
|
|
37
|
+
${backgroundColor ?? ''}
|
|
38
|
+
${twClassName}`;
|
|
39
|
+
return (<View style={[twContainerClassNames, style]} {...props}>
|
|
23
40
|
{children}
|
|
24
41
|
</View>);
|
|
25
42
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Box.mjs","sourceRoot":"","sources":["../../../src/components/Box/Box.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,sDAAsD;AAC5E,OAAO,MAAK,cAAc;;AAC1B,OAAO,EAAE,IAAI,EAAE,8BAAqB;AAEpC,OAAO,
|
|
1
|
+
{"version":3,"file":"Box.mjs","sourceRoot":"","sources":["../../../src/components/Box/Box.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,sDAAsD;AAC5E,OAAO,MAAK,cAAc;;AAC1B,OAAO,EAAE,IAAI,EAAE,8BAAqB;AAEpC,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,yBAAyB,EACzB,2BAA2B,EAC3B,4BAA4B,EAC5B,0BAA0B,EAC1B,gCAAgC,EAChC,8BAA8B,EAC9B,sBAAsB,EACtB,0BAA0B,EAC1B,4BAA4B,EAC5B,6BAA6B,EAC7B,2BAA2B,EAC3B,iCAAiC,EACjC,+BAA+B,EAC/B,2BAA2B,EAC5B,4BAAwB;AAGzB,MAAM,CAAC,MAAM,GAAG,GAAG,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CAAC,CAAC,CAAC,CAAC,EAAE;MAClF,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE;MAC5D,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,0BAA0B,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE;MACtE,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,4BAA4B,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,EAAE;MAC5E,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC,6BAA6B,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,EAAE;MAC/E,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,2BAA2B,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,EAAE;MACzE,iBAAiB,KAAK,SAAS,CAAC,CAAC,CAAC,iCAAiC,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,EAAE;MAC3F,eAAe,KAAK,SAAS,CAAC,CAAC,CAAC,+BAA+B,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,EAAE;MACrF,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,2BAA2B,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,EAAE;MACzE,WAAW,IAAI,EAAE;MACjB,eAAe,IAAI,EAAE;MACrB,WAAW,EAAE,CAAC;IAElB,OAAO,CACL,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,qBAAqB,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CACrD;MAAA,CAAC,QAAQ,CACX;IAAA,EAAE,IAAI,CAAC,CACR,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { useTailwind } from '@metamask-previews/design-system-twrnc-preset';\nimport React from 'react';\nimport { View } from 'react-native';\n\nimport {\n TWCLASSMAP_BOX_GAP,\n TWCLASSMAP_BOX_MARGIN,\n TWCLASSMAP_BOX_MARGIN_TOP,\n TWCLASSMAP_BOX_MARGIN_RIGHT,\n TWCLASSMAP_BOX_MARGIN_BOTTOM,\n TWCLASSMAP_BOX_MARGIN_LEFT,\n TWCLASSMAP_BOX_MARGIN_HORIZONTAL,\n TWCLASSMAP_BOX_MARGIN_VERTICAL,\n TWCLASSMAP_BOX_PADDING,\n TWCLASSMAP_BOX_PADDING_TOP,\n TWCLASSMAP_BOX_PADDING_RIGHT,\n TWCLASSMAP_BOX_PADDING_BOTTOM,\n TWCLASSMAP_BOX_PADDING_LEFT,\n TWCLASSMAP_BOX_PADDING_HORIZONTAL,\n TWCLASSMAP_BOX_PADDING_VERTICAL,\n TWCLASSMAP_BOX_BORDER_WIDTH,\n} from './Box.constants';\nimport type { BoxProps } from './Box.types';\n\nexport const Box = ({\n flexDirection,\n flexWrap,\n gap,\n alignItems,\n justifyContent,\n margin,\n marginTop,\n marginRight,\n marginBottom,\n marginLeft,\n marginHorizontal,\n marginVertical,\n padding,\n paddingTop,\n paddingRight,\n paddingBottom,\n paddingLeft,\n paddingHorizontal,\n paddingVertical,\n borderWidth,\n borderColor,\n backgroundColor,\n twClassName = '',\n style,\n children,\n ...props\n}: BoxProps) => {\n const tw = useTailwind();\n const twContainerClassNames = tw`\n flex\n ${flexDirection ?? ''} \n ${flexWrap ?? ''} \n ${gap !== undefined ? TWCLASSMAP_BOX_GAP[gap] : ''} \n ${alignItems ?? ''} \n ${justifyContent ?? ''}\n ${margin !== undefined ? TWCLASSMAP_BOX_MARGIN[margin] : ''}\n ${marginTop !== undefined ? TWCLASSMAP_BOX_MARGIN_TOP[marginTop] : ''}\n ${marginRight !== undefined ? TWCLASSMAP_BOX_MARGIN_RIGHT[marginRight] : ''}\n ${marginBottom !== undefined ? TWCLASSMAP_BOX_MARGIN_BOTTOM[marginBottom] : ''}\n ${marginLeft !== undefined ? TWCLASSMAP_BOX_MARGIN_LEFT[marginLeft] : ''}\n ${marginHorizontal !== undefined ? TWCLASSMAP_BOX_MARGIN_HORIZONTAL[marginHorizontal] : ''}\n ${marginVertical !== undefined ? TWCLASSMAP_BOX_MARGIN_VERTICAL[marginVertical] : ''}\n ${padding !== undefined ? TWCLASSMAP_BOX_PADDING[padding] : ''}\n ${paddingTop !== undefined ? TWCLASSMAP_BOX_PADDING_TOP[paddingTop] : ''}\n ${paddingRight !== undefined ? TWCLASSMAP_BOX_PADDING_RIGHT[paddingRight] : ''}\n ${paddingBottom !== undefined ? TWCLASSMAP_BOX_PADDING_BOTTOM[paddingBottom] : ''}\n ${paddingLeft !== undefined ? TWCLASSMAP_BOX_PADDING_LEFT[paddingLeft] : ''}\n ${paddingHorizontal !== undefined ? TWCLASSMAP_BOX_PADDING_HORIZONTAL[paddingHorizontal] : ''}\n ${paddingVertical !== undefined ? TWCLASSMAP_BOX_PADDING_VERTICAL[paddingVertical] : ''}\n ${borderWidth !== undefined ? TWCLASSMAP_BOX_BORDER_WIDTH[borderWidth] : ''}\n ${borderColor ?? ''}\n ${backgroundColor ?? ''}\n ${twClassName}`;\n\n return (\n <View style={[twContainerClassNames, style]} {...props}>\n {children}\n </View>\n );\n};\n"]}
|
|
@@ -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,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"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"]}
|
|
@@ -103,7 +103,7 @@ exports.Checkbox = (0, react_1.forwardRef)(({ isSelected, isDisabled = false, is
|
|
|
103
103
|
]} disabled={isDisabled} {...props}>
|
|
104
104
|
{({ pressed }) => (<>
|
|
105
105
|
<AnimatedView {...checkboxContainerProps} style={[
|
|
106
|
-
tw `${getCheckboxContainerStyle(pressed)} flex
|
|
106
|
+
tw `${getCheckboxContainerStyle(pressed)} flex size-[22px] items-center justify-center rounded border-2`,
|
|
107
107
|
{ transform: [{ scale: scaleAnim }] },
|
|
108
108
|
]}>
|
|
109
109
|
{/* Always render icon, opacity driven by iconAnim */}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.cjs","sourceRoot":"","sources":["../../../src/components/Checkbox/Checkbox.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8FAA4E;AAC5E,+CAMe;AAEf,wDAA2D;AAE3D,4CAA8D;AAC9D,gFAAmE;AAInE,MAAM,YAAY,GAAG,uBAAQ,CAAC,IAAI,CAAC;AAEtB,QAAA,QAAQ,GAAG,IAAA,kBAAU,EAChC,CACE,EACE,UAAU,EACV,UAAU,GAAG,KAAK,EAClB,SAAS,GAAG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CAAC,IAAI,CACjB;YAAA,EAAE,YAAY,CACd;YAAA,CAAC,KAAK,CAAC,CAAC,CAAC,CACP,CAAC,+BAAc,CACb,SAAS,CAAC,CAAC,EAAE,GAAG,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC,CAElD;gBAAA,CAAC,KAAK,CACR;cAAA,EAAE,+BAAc,CAAC,CAClB,CAAC,CAAC,CAAC,IAAI,CACV;UAAA,GAAG,CACJ,CACH;MAAA,EAAE,wBAAS,CAAC,CACb,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["import { useTailwind } from '@metamask-previews/design-system-twrnc-preset';\nimport React, {\n forwardRef,\n useRef,\n useImperativeHandle,\n useCallback,\n useEffect,\n} from 'react';\nimport type { PressableStateCallbackType } from 'react-native';\nimport { Pressable, Animated, Easing } from 'react-native';\n\nimport { Icon, IconName, IconColor, IconSize } from '../Icon';\nimport { TextOrChildren } from '../temp-components/TextOrChildren';\n\nimport type { CheckboxProps } from './Checkbox.types';\n\nconst AnimatedView = Animated.View;\n\nexport const Checkbox = forwardRef<{ toggle: () => void }, CheckboxProps>(\n (\n {\n isSelected,\n isDisabled = false,\n isInvalid = false,\n label = '',\n labelProps,\n onChange,\n checkboxContainerProps,\n checkedIconProps,\n twClassName = '',\n style,\n ...props\n },\n ref,\n ) => {\n // Animation values\n const scaleAnim = useRef(new Animated.Value(1)).current;\n const iconAnim = useRef(new Animated.Value(isSelected ? 1 : 0)).current;\n\n // Sync icon opacity whenever selection changes\n useEffect(() => {\n Animated.timing(iconAnim, {\n toValue: isSelected ? 1 : 0,\n duration: 300,\n easing: Easing.ease,\n useNativeDriver: true,\n }).start();\n }, [isSelected, iconAnim]);\n\n // Bounce effect when toggling\n const animateScale = useCallback(() => {\n Animated.sequence([\n Animated.timing(scaleAnim, {\n toValue: 1.15,\n duration: 100,\n easing: Easing.ease,\n useNativeDriver: true,\n }),\n Animated.timing(scaleAnim, {\n toValue: 1,\n duration: 100,\n easing: Easing.ease,\n useNativeDriver: true,\n }),\n ]).start();\n }, [scaleAnim]);\n\n // Press handler: notify parent, then bounce\n const handlePress = () => {\n if (isDisabled) {\n return;\n }\n onChange?.(!isSelected);\n animateScale();\n };\n\n useImperativeHandle(ref, () => ({ toggle: handlePress }), [handlePress]);\n\n const tw = useTailwind();\n const twContainerClassNames = tw`flex-row items-center ${\n isDisabled ? 'opacity-50' : 'opacity-100'\n } ${twClassName}`;\n\n const getCheckboxContainerStyle = useCallback(\n (pressed: boolean): string => {\n const baseBg = isSelected ? 'bg-primary-default' : 'bg-default';\n let baseBorder = 'border-default';\n if (isSelected) {\n baseBorder = 'border-primary-default';\n } else if (isInvalid) {\n baseBorder = 'border-error-default';\n }\n const pressedBg = isSelected\n ? 'bg-primary-default-pressed'\n : 'bg-default-pressed';\n let pressedBorder = 'border-default';\n if (isSelected) {\n pressedBorder = 'border-primary-default-pressed';\n } else if (isInvalid) {\n pressedBorder = 'border-error-default';\n }\n return pressed\n ? `${pressedBg} ${pressedBorder}`\n : `${baseBg} ${baseBorder}`;\n },\n [isSelected, isInvalid],\n );\n\n return (\n <Pressable\n onPress={handlePress}\n accessible\n accessibilityRole=\"checkbox\"\n accessibilityState={{\n checked: isSelected,\n disabled: isDisabled,\n }}\n accessibilityLabel={typeof label === 'string' ? label : undefined}\n style={(state: PressableStateCallbackType) => [\n twContainerClassNames,\n typeof style === 'function' ? style(state) : style,\n ]}\n disabled={isDisabled}\n {...props}\n >\n {({ pressed }) => (\n <>\n <AnimatedView\n {...checkboxContainerProps}\n style={[\n tw`${getCheckboxContainerStyle(pressed)} flex size-[22px] items-center justify-center rounded border-2`,\n { transform: [{ scale: scaleAnim }] },\n ]}\n >\n {/* Always render icon, opacity driven by iconAnim */}\n <Animated.View style={{ opacity: iconAnim }}>\n <Icon\n name={IconName.Check}\n color={IconColor.PrimaryInverse}\n size={IconSize.Sm}\n {...checkedIconProps}\n />\n </Animated.View>\n </AnimatedView>\n {label ? (\n <TextOrChildren\n textProps={{ ...labelProps, twClassName: 'ml-3' }}\n >\n {label}\n </TextOrChildren>\n ) : null}\n </>\n )}\n </Pressable>\n );\n },\n);\n"]}
|
|
@@ -84,7 +84,7 @@ export const Checkbox = forwardRef(({ isSelected, isDisabled = false, isInvalid
|
|
|
84
84
|
]} disabled={isDisabled} {...props}>
|
|
85
85
|
{({ pressed }) => (<>
|
|
86
86
|
<AnimatedView {...checkboxContainerProps} style={[
|
|
87
|
-
tw `${getCheckboxContainerStyle(pressed)} flex
|
|
87
|
+
tw `${getCheckboxContainerStyle(pressed)} flex size-[22px] items-center justify-center rounded border-2`,
|
|
88
88
|
{ transform: [{ scale: scaleAnim }] },
|
|
89
89
|
]}>
|
|
90
90
|
{/* Always render icon, opacity driven by iconAnim */}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.mjs","sourceRoot":"","sources":["../../../src/components/Checkbox/Checkbox.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,sDAAsD;AAC5E,OAAO,QAAO,EACZ,UAAU,EACV,MAAM,EACN,mBAAmB,EACnB,WAAW,EACX,SAAS,EACV,cAAc;;AAEf,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,8BAAqB;AAE3D,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,0BAAgB;AAC9D,OAAO,EAAE,cAAc,EAAE,oDAA0C;AAInE,MAAM,YAAY,GAAG,QAAQ,CAAC,IAAI,CAAC;AAEnC,MAAM,CAAC,MAAM,QAAQ,GAAG,UAAU,CAChC,CACE,EACE,UAAU,EACV,UAAU,GAAG,KAAK,EAClB,SAAS,GAAG,KAAK,EACjB,KAAK,GAAG,EAAE,EACV,UAAU,EACV,QAAQ,EACR,sBAAsB,EACtB,gBAAgB,EAChB,WAAW,GAAG,EAAE,EAChB,KAAK,EACL,GAAG,KAAK,EACT,EACD,GAAG,EACH,EAAE;IACF,mBAAmB;IACnB,MAAM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c,CACb,SAAS,CAAC,CAAC,EAAE,GAAG,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC,CAElD;gBAAA,CAAC,KAAK,CACR;cAAA,EAAE,cAAc,CAAC,CAClB,CAAC,CAAC,CAAC,IAAI,CACV;UAAA,GAAG,CACJ,CACH;MAAA,EAAE,SAAS,CAAC,CACb,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["import { useTailwind } from '@metamask-previews/design-system-twrnc-preset';\nimport React, {\n forwardRef,\n useRef,\n useImperativeHandle,\n useCallback,\n useEffect,\n} from 'react';\nimport type { PressableStateCallbackType } from 'react-native';\nimport { Pressable, Animated, Easing } from 'react-native';\n\nimport { Icon, IconName, IconColor, IconSize } from '../Icon';\nimport { TextOrChildren } from '../temp-components/TextOrChildren';\n\nimport type { CheckboxProps } from './Checkbox.types';\n\nconst AnimatedView = Animated.View;\n\nexport const Checkbox = forwardRef<{ toggle: () => void }, CheckboxProps>(\n (\n {\n isSelected,\n isDisabled = false,\n isInvalid = false,\n label = '',\n labelProps,\n onChange,\n checkboxContainerProps,\n checkedIconProps,\n twClassName = '',\n style,\n ...props\n },\n ref,\n ) => {\n // Animation values\n const scaleAnim = useRef(new Animated.Value(1)).current;\n const iconAnim = useRef(new Animated.Value(isSelected ? 1 : 0)).current;\n\n // Sync icon opacity whenever selection changes\n useEffect(() => {\n Animated.timing(iconAnim, {\n toValue: isSelected ? 1 : 0,\n duration: 300,\n easing: Easing.ease,\n useNativeDriver: true,\n }).start();\n }, [isSelected, iconAnim]);\n\n // Bounce effect when toggling\n const animateScale = useCallback(() => {\n Animated.sequence([\n Animated.timing(scaleAnim, {\n toValue: 1.15,\n duration: 100,\n easing: Easing.ease,\n useNativeDriver: true,\n }),\n Animated.timing(scaleAnim, {\n toValue: 1,\n duration: 100,\n easing: Easing.ease,\n useNativeDriver: true,\n }),\n ]).start();\n }, [scaleAnim]);\n\n // Press handler: notify parent, then bounce\n const handlePress = () => {\n if (isDisabled) {\n return;\n }\n onChange?.(!isSelected);\n animateScale();\n };\n\n useImperativeHandle(ref, () => ({ toggle: handlePress }), [handlePress]);\n\n const tw = useTailwind();\n const twContainerClassNames = tw`flex-row items-center ${\n isDisabled ? 'opacity-50' : 'opacity-100'\n } ${twClassName}`;\n\n const getCheckboxContainerStyle = useCallback(\n (pressed: boolean): string => {\n const baseBg = isSelected ? 'bg-primary-default' : 'bg-default';\n let baseBorder = 'border-default';\n if (isSelected) {\n baseBorder = 'border-primary-default';\n } else if (isInvalid) {\n baseBorder = 'border-error-default';\n }\n const pressedBg = isSelected\n ? 'bg-primary-default-pressed'\n : 'bg-default-pressed';\n let pressedBorder = 'border-default';\n if (isSelected) {\n pressedBorder = 'border-primary-default-pressed';\n } else if (isInvalid) {\n pressedBorder = 'border-error-default';\n }\n return pressed\n ? `${pressedBg} ${pressedBorder}`\n : `${baseBg} ${baseBorder}`;\n },\n [isSelected, isInvalid],\n );\n\n return (\n <Pressable\n onPress={handlePress}\n accessible\n accessibilityRole=\"checkbox\"\n accessibilityState={{\n checked: isSelected,\n disabled: isDisabled,\n }}\n accessibilityLabel={typeof label === 'string' ? label : undefined}\n style={(state: PressableStateCallbackType) => [\n twContainerClassNames,\n typeof style === 'function' ? style(state) : style,\n ]}\n disabled={isDisabled}\n {...props}\n >\n {({ pressed }) => (\n <>\n <AnimatedView\n {...checkboxContainerProps}\n style={[\n tw`${getCheckboxContainerStyle(pressed)} flex size-[22px] items-center justify-center rounded border-2`,\n { transform: [{ scale: scaleAnim }] },\n ]}\n >\n {/* Always render icon, opacity driven by iconAnim */}\n <Animated.View style={{ opacity: iconAnim }}>\n <Icon\n name={IconName.Check}\n color={IconColor.PrimaryInverse}\n size={IconSize.Sm}\n {...checkedIconProps}\n />\n </Animated.View>\n </AnimatedView>\n {label ? (\n <TextOrChildren\n textProps={{ ...labelProps, twClassName: 'ml-3' }}\n >\n {label}\n </TextOrChildren>\n ) : null}\n </>\n )}\n </Pressable>\n );\n },\n);\n"]}
|
|
@@ -19,5 +19,14 @@ exports.MAP_TEXT_VARIANT_FONTWEIGHT = {
|
|
|
19
19
|
[types_1.TextVariant.BodyMd]: design_tokens_1.typography.sBodyMD.fontWeight,
|
|
20
20
|
[types_1.TextVariant.BodySm]: design_tokens_1.typography.sBodySM.fontWeight,
|
|
21
21
|
[types_1.TextVariant.BodyXs]: design_tokens_1.typography.sBodyXS.fontWeight,
|
|
22
|
+
[types_1.TextVariant.PageHeading]: design_tokens_1.typography.sPageHeading.fontWeight,
|
|
23
|
+
[types_1.TextVariant.SectionHeading]: design_tokens_1.typography.sSectionHeading
|
|
24
|
+
.fontWeight,
|
|
25
|
+
[types_1.TextVariant.ButtonLabelMd]: design_tokens_1.typography.sButtonLabelMd
|
|
26
|
+
.fontWeight,
|
|
27
|
+
[types_1.TextVariant.ButtonLabelLg]: design_tokens_1.typography.sButtonLabelLg
|
|
28
|
+
.fontWeight,
|
|
29
|
+
[types_1.TextVariant.AmountDisplayLg]: design_tokens_1.typography.sAmountDisplayLg
|
|
30
|
+
.fontWeight,
|
|
22
31
|
};
|
|
23
32
|
//# sourceMappingURL=Text.constants.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Text.constants.cjs","sourceRoot":"","sources":["../../../src/components/Text/Text.constants.ts"],"names":[],"mappings":";;;AAAA,oEAA8D;AAE9D,iDAAsD;AAEtD,WAAW;AACE,QAAA,0BAA0B,GAEnC;IACF,CAAC,kBAAU,CAAC,OAAO,CAAC,EAAE,UAAU;IAChC,CAAC,kBAAU,CAAC,MAAM,CAAC,EAAE,SAAS;IAC9B,CAAC,kBAAU,CAAC,IAAI,CAAC,EAAE,OAAO;CAC3B,CAAC;AAEW,QAAA,2BAA2B,GAEpC;IACF,CAAC,mBAAW,CAAC,SAAS,CAAC,EAAE,0BAAU,CAAC,UAAU,CAAC,UAAwB;IACvE,CAAC,mBAAW,CAAC,SAAS,CAAC,EAAE,0BAAU,CAAC,UAAU,CAAC,UAAwB;IACvE,CAAC,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U,CAAC,UAAwB;IACvE,CAAC,mBAAW,CAAC,MAAM,CAAC,EAAE,0BAAU,CAAC,aAAa,CAAC,UAAwB;IACvE,CAAC,mBAAW,CAAC,MAAM,CAAC,EAAE,0BAAU,CAAC,OAAO,CAAC,UAAwB;IACjE,CAAC,mBAAW,CAAC,MAAM,CAAC,EAAE,0BAAU,CAAC,OAAO,CAAC,UAAwB;IACjE,CAAC,mBAAW,CAAC,MAAM,CAAC,EAAE,0BAAU,CAAC,OAAO,CAAC,UAAwB;IACjE,CAAC,mBAAW,CAAC,WAAW,CAAC,EAAE,0BAAU,CAAC,YAAY,CAAC,UAAwB;IAC3E,CAAC,mBAAW,CAAC,cAAc,CAAC,EAAE,0BAAU,CAAC,eAAe;SACrD,UAAwB;IAC3B,CAAC,mBAAW,CAAC,aAAa,CAAC,EAAE,0BAAU,CAAC,cAAc;SACnD,UAAwB;IAC3B,CAAC,mBAAW,CAAC,aAAa,CAAC,EAAE,0BAAU,CAAC,cAAc;SACnD,UAAwB;IAC3B,CAAC,mBAAW,CAAC,eAAe,CAAC,EAAE,0BAAU,CAAC,gBAAgB;SACvD,UAAwB;CAC5B,CAAC","sourcesContent":["import { typography } from '@metamask-previews/design-tokens';\n\nimport { FontWeight, TextVariant } from '../../types';\n\n// Mappings\nexport const TWCLASSMAP_TEXT_FONTWEIGHT: {\n [key in FontWeight]: string;\n} = {\n [FontWeight.Regular]: '-regular',\n [FontWeight.Medium]: '-medium',\n [FontWeight.Bold]: '-bold',\n};\n\nexport const MAP_TEXT_VARIANT_FONTWEIGHT: {\n [key in TextVariant]: FontWeight;\n} = {\n [TextVariant.DisplayLg]: typography.sDisplayLG.fontWeight as FontWeight,\n [TextVariant.DisplayMd]: typography.sDisplayMD.fontWeight as FontWeight,\n [TextVariant.HeadingLg]: typography.sHeadingLG.fontWeight as FontWeight,\n [TextVariant.HeadingMd]: typography.sHeadingMD.fontWeight as FontWeight,\n [TextVariant.HeadingSm]: typography.sHeadingSM.fontWeight as FontWeight,\n [TextVariant.BodyLg]: typography.sBodyLGMedium.fontWeight as FontWeight,\n [TextVariant.BodyMd]: typography.sBodyMD.fontWeight as FontWeight,\n [TextVariant.BodySm]: typography.sBodySM.fontWeight as FontWeight,\n [TextVariant.BodyXs]: typography.sBodyXS.fontWeight as FontWeight,\n [TextVariant.PageHeading]: typography.sPageHeading.fontWeight as FontWeight,\n [TextVariant.SectionHeading]: typography.sSectionHeading\n .fontWeight as FontWeight,\n [TextVariant.ButtonLabelMd]: typography.sButtonLabelMd\n .fontWeight as FontWeight,\n [TextVariant.ButtonLabelLg]: typography.sButtonLabelLg\n .fontWeight as FontWeight,\n [TextVariant.AmountDisplayLg]: typography.sAmountDisplayLg\n .fontWeight as FontWeight,\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Text.constants.d.cts","sourceRoot":"","sources":["../../../src/components/Text/Text.constants.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,8BAAoB;AAGtD,eAAO,MAAM,0BAA0B,EAAE;KACtC,GAAG,IAAI,UAAU,GAAG,MAAM;CAK5B,CAAC;AAEF,eAAO,MAAM,2BAA2B,EAAE;KACvC,GAAG,IAAI,WAAW,GAAG,UAAU;
|
|
1
|
+
{"version":3,"file":"Text.constants.d.cts","sourceRoot":"","sources":["../../../src/components/Text/Text.constants.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,8BAAoB;AAGtD,eAAO,MAAM,0BAA0B,EAAE;KACtC,GAAG,IAAI,UAAU,GAAG,MAAM;CAK5B,CAAC;AAEF,eAAO,MAAM,2BAA2B,EAAE;KACvC,GAAG,IAAI,WAAW,GAAG,UAAU;CAoBjC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Text.constants.d.mts","sourceRoot":"","sources":["../../../src/components/Text/Text.constants.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,8BAAoB;AAGtD,eAAO,MAAM,0BAA0B,EAAE;KACtC,GAAG,IAAI,UAAU,GAAG,MAAM;CAK5B,CAAC;AAEF,eAAO,MAAM,2BAA2B,EAAE;KACvC,GAAG,IAAI,WAAW,GAAG,UAAU;
|
|
1
|
+
{"version":3,"file":"Text.constants.d.mts","sourceRoot":"","sources":["../../../src/components/Text/Text.constants.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,8BAAoB;AAGtD,eAAO,MAAM,0BAA0B,EAAE;KACtC,GAAG,IAAI,UAAU,GAAG,MAAM;CAK5B,CAAC;AAEF,eAAO,MAAM,2BAA2B,EAAE;KACvC,GAAG,IAAI,WAAW,GAAG,UAAU;CAoBjC,CAAC"}
|
|
@@ -16,5 +16,14 @@ export const MAP_TEXT_VARIANT_FONTWEIGHT = {
|
|
|
16
16
|
[TextVariant.BodyMd]: typography.sBodyMD.fontWeight,
|
|
17
17
|
[TextVariant.BodySm]: typography.sBodySM.fontWeight,
|
|
18
18
|
[TextVariant.BodyXs]: typography.sBodyXS.fontWeight,
|
|
19
|
+
[TextVariant.PageHeading]: typography.sPageHeading.fontWeight,
|
|
20
|
+
[TextVariant.SectionHeading]: typography.sSectionHeading
|
|
21
|
+
.fontWeight,
|
|
22
|
+
[TextVariant.ButtonLabelMd]: typography.sButtonLabelMd
|
|
23
|
+
.fontWeight,
|
|
24
|
+
[TextVariant.ButtonLabelLg]: typography.sButtonLabelLg
|
|
25
|
+
.fontWeight,
|
|
26
|
+
[TextVariant.AmountDisplayLg]: typography.sAmountDisplayLg
|
|
27
|
+
.fontWeight,
|
|
19
28
|
};
|
|
20
29
|
//# sourceMappingURL=Text.constants.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Text.constants.mjs","sourceRoot":"","sources":["../../../src/components/Text/Text.constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,yCAAyC;AAE9D,OAAO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import { FontWeight, TextVariant } from '../../types';\n\n// Mappings\nexport const TWCLASSMAP_TEXT_FONTWEIGHT: {\n [key in FontWeight]: string;\n} = {\n [FontWeight.Regular]: '-regular',\n [FontWeight.Medium]: '-medium',\n [FontWeight.Bold]: '-bold',\n};\n\nexport const MAP_TEXT_VARIANT_FONTWEIGHT: {\n [key in TextVariant]: FontWeight;\n} = {\n [TextVariant.DisplayLg]: typography.sDisplayLG.fontWeight as FontWeight,\n [TextVariant.DisplayMd]: typography.sDisplayMD.fontWeight as FontWeight,\n [TextVariant.HeadingLg]: typography.sHeadingLG.fontWeight as FontWeight,\n [TextVariant.HeadingMd]: typography.sHeadingMD.fontWeight as FontWeight,\n [TextVariant.HeadingSm]: typography.sHeadingSM.fontWeight as FontWeight,\n [TextVariant.BodyLg]: typography.sBodyLGMedium.fontWeight as FontWeight,\n [TextVariant.BodyMd]: typography.sBodyMD.fontWeight as FontWeight,\n [TextVariant.BodySm]: typography.sBodySM.fontWeight as FontWeight,\n [TextVariant.BodyXs]: typography.sBodyXS.fontWeight as FontWeight,\n [TextVariant.PageHeading]: typography.sPageHeading.fontWeight as FontWeight,\n [TextVariant.SectionHeading]: typography.sSectionHeading\n .fontWeight as FontWeight,\n [TextVariant.ButtonLabelMd]: typography.sButtonLabelMd\n .fontWeight as FontWeight,\n [TextVariant.ButtonLabelLg]: typography.sButtonLabelLg\n .fontWeight as FontWeight,\n [TextVariant.AmountDisplayLg]: typography.sAmountDisplayLg\n .fontWeight as FontWeight,\n};\n"]}
|
|
@@ -37,6 +37,7 @@ const TextButton = ({ children, size = types_1.TextButtonSize.BodyMd, textProps,
|
|
|
37
37
|
* Calculating the baselineOffset. This baselineOffset is needed to make sure
|
|
38
38
|
* the TextButton aligns perfectly when placed within Text elements
|
|
39
39
|
*/
|
|
40
|
+
// eslint-disable-next-line tailwindcss/no-custom-classname
|
|
40
41
|
const { fontSize, lineHeight } = tw `text-${TextButton_constants_1.MAP_TEXTBUTTON_SIZE_TEXTVARIANT[size]}`;
|
|
41
42
|
const baselineOffset = (lineHeight - fontSize) / 2;
|
|
42
43
|
const getTextColor = (0, react_1.useCallback)((pressed) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextButton.cjs","sourceRoot":"","sources":["../../../src/components/TextButton/TextButton.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8FAA4E;AAC5E,+CAA2C;AAC3C,wDAAyC;AAEzC,iDAA6C;AAC7C,4CAAyC;AACzC,4CAA2C;AAE3C,qEAAyE;AAGlE,MAAM,UAAU,GAA8B,CAAC,EACpD,QAAQ,EACR,IAAI,GAAG,sBAAc,CAAC,MAAM,EAC5B,SAAS,EACT,aAAa,EACb,cAAc,EACd,cAAc,EACd,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,UAAU,GAAG,KAAK,EAClB,SAAS,GAAG,KAAK,EACjB,WAAW,GAAG,EAAE,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,KAAK,EACL,GAAG,KAAK,EACT,EAAE,EAAE;IACH,MAAM,EAAE,GAAG,IAAA,wCAAW,GAAE,CAAC;IACzB;;;OAGG;IACH,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,EAAE,CAAA,QACjC,sDAA+B,CAAC,IAAI,CACtC,EAGC,CAAC;IACF,MAAM,cAAc,GAAG,CAAC,UAAU,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;IAEnD,MAAM,YAAY,GAAG,IAAA,mBAAW,EAC9B,CAAC,OAAgB,EAAU,EAAE;QAC3B,IAAI,SAAS,EAAE;YACb,OAAO,sBAAsB,CAAC;SAC/B;QACD,OAAO,OAAO,CAAC,CAAC,CAAC,8BAA8B,CAAC,CAAC,CAAC,sBAAsB,CAAC;IAC3E,CAAC,EACD,CAAC,SAAS,CAAC,CACZ,CAAC;IAEF,MAAM,iBAAiB,GAAG,IAAA,mBAAW,EACnC,CAAC,OAAgB,EAAU,EAAE,CAC3B,SAAS,IA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,IAAI,SAAS,EAAE,WAAW,IAAI,EAAE,GAAG,CAAC,CAExG;cAAA,CAAC,QAAQ,CACX;YAAA,EAAE,WAAI,CAEN;;YAAA,CAAC,WAAW,CAAC,CAAC,CAAC,CACb,CAAC,WAAI,CACH,IAAI,CAAC,CAAC,WAAW,CAAC,CAClB,IAAI,CAAC,CAAC,eAAQ,CAAC,EAAE,CAAC,CAClB,MAAM,CAAC,UAAU,CACjB,WAAW,CAAC,CAAC,GAAG,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,CAC7C,IAAI,YAAY,CAAC,EACjB,CACH,CAAC,CAAC,CAAC,CACF,YAAY,CACb,CACH;UAAA,GAAG,CACJ,CACH;MAAA,EAAE,wBAAS,CACb;IAAA,EAAE,WAAI,CAAC,CACR,CAAC;AACJ,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"TextButton.cjs","sourceRoot":"","sources":["../../../src/components/TextButton/TextButton.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8FAA4E;AAC5E,+CAA2C;AAC3C,wDAAyC;AAEzC,iDAA6C;AAC7C,4CAAyC;AACzC,4CAA2C;AAE3C,qEAAyE;AAGlE,MAAM,UAAU,GAA8B,CAAC,EACpD,QAAQ,EACR,IAAI,GAAG,sBAAc,CAAC,MAAM,EAC5B,SAAS,EACT,aAAa,EACb,cAAc,EACd,cAAc,EACd,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,UAAU,GAAG,KAAK,EAClB,SAAS,GAAG,KAAK,EACjB,WAAW,GAAG,EAAE,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,KAAK,EACL,GAAG,KAAK,EACT,EAAE,EAAE;IACH,MAAM,EAAE,GAAG,IAAA,wCAAW,GAAE,CAAC;IACzB;;;OAGG;IACH,2DAA2D;IAC3D,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,EAAE,CAAA,QACjC,sDAA+B,CAAC,IAAI,CACtC,EAGC,CAAC;IACF,M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CAAC,CAClB,MAAM,CAAC,YAAY,CACnB,WAAW,CAAC,CAAC,GAAG,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,CAC7C,IAAI,cAAc,CAAC,EACnB,CACH,CAAC,CAAC,CAAC,CACF,cAAc,CACf,CAED;;YAAA,CAAC,WAAI,CACH,OAAO,CAAC,CAAC,sDAA+B,CAAC,IAAI,CAAC,CAAC,CAC/C,UAAU,CAAC,CAAC,iBAAU,CAAC,MAAM,CAAC,CAC9B,IAAI,SAAS,CAAC,CACd,WAAW,CAAC,CAAC,IAAI,YAAY,CAAC,OAAO,CAAC,IAAI,iBAAiB,CAAC,OAAO,CAAC,IAAI,SAAS,EAAE,WAAW,IAAI,EAAE,GAAG,CAAC,CAExG;cAAA,CAAC,QAAQ,CACX;YAAA,EAAE,WAAI,CAEN;;YAAA,CAAC,WAAW,CAAC,CAAC,CAAC,CACb,CAAC,WAAI,CACH,IAAI,CAAC,CAAC,WAAW,CAAC,CAClB,IAAI,CAAC,CAAC,eAAQ,CAAC,EAAE,CAAC,CAClB,MAAM,CAAC,UAAU,CACjB,WAAW,CAAC,CAAC,GAAG,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,CAC7C,IAAI,YAAY,CAAC,EACjB,CACH,CAAC,CAAC,CAAC,CACF,YAAY,CACb,CACH;UAAA,GAAG,CACJ,CACH;MAAA,EAAE,wBAAS,CACb;IAAA,EAAE,WAAI,CAAC,CACR,CAAC;AACJ,CAAC,CAAC;AApGW,QAAA,UAAU,cAoGrB","sourcesContent":["import { useTailwind } from '@metamask-previews/design-system-twrnc-preset';\nimport React, { useCallback } from 'react';\nimport { Pressable } from 'react-native';\n\nimport { TextButtonSize } from '../../types';\nimport { Icon, IconSize } from '../Icon';\nimport { Text, FontWeight } from '../Text';\n\nimport { MAP_TEXTBUTTON_SIZE_TEXTVARIANT } from './TextButton.constants';\nimport type { TextButtonProps } from './TextButton.types';\n\nexport const TextButton: React.FC<TextButtonProps> = ({\n children,\n size = TextButtonSize.BodyMd,\n textProps,\n startIconName,\n startIconProps,\n startAccessory,\n endIconName,\n endIconProps,\n endAccessory,\n isDisabled = false,\n isInverse = false,\n twClassName = '',\n accessibilityRole,\n accessibilityLabel,\n style,\n ...props\n}) => {\n const tw = useTailwind();\n /**\n * Calculating the baselineOffset. This baselineOffset is needed to make sure\n * the TextButton aligns perfectly when placed within Text elements\n */\n // eslint-disable-next-line tailwindcss/no-custom-classname\n const { fontSize, lineHeight } = tw`text-${\n MAP_TEXTBUTTON_SIZE_TEXTVARIANT[size] as string\n }` as {\n fontSize: number;\n lineHeight: number;\n };\n const baselineOffset = (lineHeight - fontSize) / 2;\n\n const getTextColor = useCallback(\n (pressed: boolean): string => {\n if (isInverse) {\n return 'text-primary-inverse';\n }\n return pressed ? 'text-primary-default-pressed' : 'text-primary-default';\n },\n [isInverse],\n );\n\n const getTextDecoration = useCallback(\n (pressed: boolean): string =>\n isInverse || pressed ? 'underline' : 'no-underline',\n [isInverse],\n );\n\n return (\n <Text>\n <Pressable\n accessibilityRole={accessibilityRole ?? 'button'}\n accessibilityLabel={accessibilityLabel}\n disabled={isDisabled}\n style={({ pressed }) => [\n { transform: [{ translateY: baselineOffset }] },\n tw`flex-row items-center ${pressed ? 'bg-pressed' : 'bg-transparent'} ${isDisabled ? 'opacity-50' : 'opacity-100'} ${twClassName}`,\n style,\n ]}\n {...props}\n >\n {({ pressed }) => (\n <>\n {startIconName ? (\n <Icon\n name={startIconName}\n size={IconSize.Sm}\n testID=\"start-icon\"\n twClassName={`${getTextColor(pressed)} mr-1`}\n {...startIconProps}\n />\n ) : (\n startAccessory\n )}\n\n <Text\n variant={MAP_TEXTBUTTON_SIZE_TEXTVARIANT[size]}\n fontWeight={FontWeight.Medium}\n {...textProps}\n twClassName={` ${getTextColor(pressed)} ${getTextDecoration(pressed)} ${textProps?.twClassName ?? ''} `}\n >\n {children}\n </Text>\n\n {endIconName ? (\n <Icon\n name={endIconName}\n size={IconSize.Sm}\n testID=\"end-icon\"\n twClassName={`${getTextColor(pressed)} ml-1`}\n {...endIconProps}\n />\n ) : (\n endAccessory\n )}\n </>\n )}\n </Pressable>\n </Text>\n );\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextButton.d.cts","sourceRoot":"","sources":["../../../src/components/TextButton/TextButton.tsx"],"names":[],"mappings":"AACA,OAAO,KAAsB,cAAc;AAQ3C,OAAO,KAAK,EAAE,eAAe,EAAE,+BAA2B;AAE1D,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,
|
|
1
|
+
{"version":3,"file":"TextButton.d.cts","sourceRoot":"","sources":["../../../src/components/TextButton/TextButton.tsx"],"names":[],"mappings":"AACA,OAAO,KAAsB,cAAc;AAQ3C,OAAO,KAAK,EAAE,eAAe,EAAE,+BAA2B;AAE1D,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAoGhD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextButton.d.mts","sourceRoot":"","sources":["../../../src/components/TextButton/TextButton.tsx"],"names":[],"mappings":"AACA,OAAO,KAAsB,cAAc;AAQ3C,OAAO,KAAK,EAAE,eAAe,EAAE,+BAA2B;AAE1D,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,
|
|
1
|
+
{"version":3,"file":"TextButton.d.mts","sourceRoot":"","sources":["../../../src/components/TextButton/TextButton.tsx"],"names":[],"mappings":"AACA,OAAO,KAAsB,cAAc;AAQ3C,OAAO,KAAK,EAAE,eAAe,EAAE,+BAA2B;AAE1D,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAoGhD,CAAC"}
|
|
@@ -18,6 +18,7 @@ export const TextButton = ({ children, size = TextButtonSize.BodyMd, textProps,
|
|
|
18
18
|
* Calculating the baselineOffset. This baselineOffset is needed to make sure
|
|
19
19
|
* the TextButton aligns perfectly when placed within Text elements
|
|
20
20
|
*/
|
|
21
|
+
// eslint-disable-next-line tailwindcss/no-custom-classname
|
|
21
22
|
const { fontSize, lineHeight } = tw `text-${MAP_TEXTBUTTON_SIZE_TEXTVARIANT[size]}`;
|
|
22
23
|
const baselineOffset = (lineHeight - fontSize) / 2;
|
|
23
24
|
const getTextColor = useCallback((pressed) => {
|