@metamask-previews/design-system-react-native 0.0.0-preview.bf69b6b → 0.0.0-preview.fbd1fe9
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/dist/components/Button/Button.constants.d.ts +2 -0
- package/dist/components/Button/Button.constants.d.ts.map +1 -0
- package/dist/components/Button/Button.constants.js +7 -0
- package/dist/components/Button/Button.constants.js.map +1 -0
- package/dist/components/Button/Button.d.ts +5 -0
- package/dist/components/Button/Button.d.ts.map +1 -0
- package/dist/components/Button/Button.js +25 -0
- package/dist/components/Button/Button.js.map +1 -0
- package/dist/components/Button/Button.types.d.ts +23 -0
- package/dist/components/Button/Button.types.d.ts.map +1 -0
- package/dist/components/Button/Button.types.js +15 -0
- package/dist/components/Button/Button.types.js.map +1 -0
- package/dist/components/Button/index.d.ts +4 -0
- package/dist/components/Button/index.d.ts.map +1 -0
- package/dist/components/Button/index.js +12 -0
- package/dist/components/Button/index.js.map +1 -0
- package/dist/components/Button/variants/ButtonPrimary/ButtonPrimary.constants.d.ts +3 -0
- package/dist/components/Button/variants/ButtonPrimary/ButtonPrimary.constants.d.ts.map +1 -0
- package/dist/components/Button/variants/ButtonPrimary/ButtonPrimary.constants.js +29 -0
- package/dist/components/Button/variants/ButtonPrimary/ButtonPrimary.constants.js.map +1 -0
- package/dist/components/Button/variants/ButtonPrimary/ButtonPrimary.d.ts +5 -0
- package/dist/components/Button/variants/ButtonPrimary/ButtonPrimary.d.ts.map +1 -0
- package/dist/components/Button/variants/ButtonPrimary/ButtonPrimary.js +97 -0
- package/dist/components/Button/variants/ButtonPrimary/ButtonPrimary.js.map +1 -0
- package/dist/components/Button/variants/ButtonPrimary/ButtonPrimary.types.d.ts +17 -0
- package/dist/components/Button/variants/ButtonPrimary/ButtonPrimary.types.d.ts.map +1 -0
- package/dist/components/Button/variants/ButtonPrimary/ButtonPrimary.types.js +3 -0
- package/dist/components/Button/variants/ButtonPrimary/ButtonPrimary.types.js.map +1 -0
- package/dist/components/Button/variants/ButtonPrimary/ButtonPrimary.utilities.d.ts +78 -0
- package/dist/components/Button/variants/ButtonPrimary/ButtonPrimary.utilities.d.ts.map +1 -0
- package/dist/components/Button/variants/ButtonPrimary/ButtonPrimary.utilities.js +122 -0
- package/dist/components/Button/variants/ButtonPrimary/ButtonPrimary.utilities.js.map +1 -0
- package/dist/components/Button/variants/ButtonPrimary/index.d.ts +4 -0
- package/dist/components/Button/variants/ButtonPrimary/index.d.ts.map +1 -0
- package/dist/components/Button/variants/ButtonPrimary/index.js +11 -0
- package/dist/components/Button/variants/ButtonPrimary/index.js.map +1 -0
- package/dist/components/Button/variants/ButtonSecondary/ButtonSecondary.constants.d.ts +3 -0
- package/dist/components/Button/variants/ButtonSecondary/ButtonSecondary.constants.d.ts.map +1 -0
- package/dist/components/Button/variants/ButtonSecondary/ButtonSecondary.constants.js +29 -0
- package/dist/components/Button/variants/ButtonSecondary/ButtonSecondary.constants.js.map +1 -0
- package/dist/components/Button/variants/ButtonSecondary/ButtonSecondary.d.ts +5 -0
- package/dist/components/Button/variants/ButtonSecondary/ButtonSecondary.d.ts.map +1 -0
- package/dist/components/Button/variants/ButtonSecondary/ButtonSecondary.js +90 -0
- package/dist/components/Button/variants/ButtonSecondary/ButtonSecondary.js.map +1 -0
- package/dist/components/Button/variants/ButtonSecondary/ButtonSecondary.types.d.ts +17 -0
- package/dist/components/Button/variants/ButtonSecondary/ButtonSecondary.types.d.ts.map +1 -0
- package/dist/components/Button/variants/ButtonSecondary/ButtonSecondary.types.js +3 -0
- package/dist/components/Button/variants/ButtonSecondary/ButtonSecondary.types.js.map +1 -0
- package/dist/components/Button/variants/ButtonSecondary/ButtonSecondary.utilities.d.ts +90 -0
- package/dist/components/Button/variants/ButtonSecondary/ButtonSecondary.utilities.d.ts.map +1 -0
- package/dist/components/Button/variants/ButtonSecondary/ButtonSecondary.utilities.js +145 -0
- package/dist/components/Button/variants/ButtonSecondary/ButtonSecondary.utilities.js.map +1 -0
- package/dist/components/Button/variants/ButtonSecondary/index.d.ts +4 -0
- package/dist/components/Button/variants/ButtonSecondary/index.d.ts.map +1 -0
- package/dist/components/Button/variants/ButtonSecondary/index.js +11 -0
- package/dist/components/Button/variants/ButtonSecondary/index.js.map +1 -0
- package/dist/components/Button/variants/ButtonTertiary/ButtonTertiary.constants.d.ts +3 -0
- package/dist/components/Button/variants/ButtonTertiary/ButtonTertiary.constants.d.ts.map +1 -0
- package/dist/components/Button/variants/ButtonTertiary/ButtonTertiary.constants.js +29 -0
- package/dist/components/Button/variants/ButtonTertiary/ButtonTertiary.constants.js.map +1 -0
- package/dist/components/Button/variants/ButtonTertiary/ButtonTertiary.d.ts +5 -0
- package/dist/components/Button/variants/ButtonTertiary/ButtonTertiary.d.ts.map +1 -0
- package/dist/components/Button/variants/ButtonTertiary/ButtonTertiary.js +90 -0
- package/dist/components/Button/variants/ButtonTertiary/ButtonTertiary.js.map +1 -0
- package/dist/components/Button/variants/ButtonTertiary/ButtonTertiary.types.d.ts +17 -0
- package/dist/components/Button/variants/ButtonTertiary/ButtonTertiary.types.d.ts.map +1 -0
- package/dist/components/Button/variants/ButtonTertiary/ButtonTertiary.types.js +3 -0
- package/dist/components/Button/variants/ButtonTertiary/ButtonTertiary.types.js.map +1 -0
- package/dist/components/Button/variants/ButtonTertiary/ButtonTertiary.utilities.d.ts +88 -0
- package/dist/components/Button/variants/ButtonTertiary/ButtonTertiary.utilities.d.ts.map +1 -0
- package/dist/components/Button/variants/ButtonTertiary/ButtonTertiary.utilities.js +147 -0
- package/dist/components/Button/variants/ButtonTertiary/ButtonTertiary.utilities.js.map +1 -0
- package/dist/components/Button/variants/ButtonTertiary/index.d.ts +4 -0
- package/dist/components/Button/variants/ButtonTertiary/index.d.ts.map +1 -0
- package/dist/components/Button/variants/ButtonTertiary/index.js +11 -0
- package/dist/components/Button/variants/ButtonTertiary/index.js.map +1 -0
- package/dist/components/ButtonIcon/ButtonIcon.constants.d.ts +6 -0
- package/dist/components/ButtonIcon/ButtonIcon.constants.d.ts.map +1 -0
- package/dist/components/ButtonIcon/ButtonIcon.constants.js +20 -0
- package/dist/components/ButtonIcon/ButtonIcon.constants.js.map +1 -0
- package/dist/components/ButtonIcon/ButtonIcon.d.ts +5 -0
- package/dist/components/ButtonIcon/ButtonIcon.d.ts.map +1 -0
- package/dist/components/ButtonIcon/ButtonIcon.js +72 -0
- package/dist/components/ButtonIcon/ButtonIcon.js.map +1 -0
- package/dist/components/ButtonIcon/ButtonIcon.types.d.ts +60 -0
- package/dist/components/ButtonIcon/ButtonIcon.types.d.ts.map +1 -0
- package/dist/components/ButtonIcon/ButtonIcon.types.js +19 -0
- package/dist/components/ButtonIcon/ButtonIcon.types.js.map +1 -0
- package/dist/components/ButtonIcon/ButtonIcon.utilities.d.ts +55 -0
- package/dist/components/ButtonIcon/ButtonIcon.utilities.d.ts.map +1 -0
- package/dist/components/ButtonIcon/ButtonIcon.utilities.js +73 -0
- package/dist/components/ButtonIcon/ButtonIcon.utilities.js.map +1 -0
- package/dist/components/ButtonIcon/index.d.ts +4 -0
- package/dist/components/ButtonIcon/index.d.ts.map +1 -0
- package/dist/components/ButtonIcon/index.js +11 -0
- package/dist/components/ButtonIcon/index.js.map +1 -0
- package/dist/components/Icon/Icon.assets.d.ts.map +1 -0
- package/dist/components/Icon/Icon.assets.js.map +1 -0
- package/dist/components/{Icons/Icon → Icon}/Icon.constants.d.ts +0 -2
- package/dist/components/Icon/Icon.constants.d.ts.map +1 -0
- package/dist/components/Icon/Icon.constants.js +15 -0
- package/dist/components/Icon/Icon.constants.js.map +1 -0
- package/dist/components/Icon/Icon.d.ts +5 -0
- package/dist/components/Icon/Icon.d.ts.map +1 -0
- package/dist/components/{Icons/Icon → Icon}/Icon.js +10 -6
- package/dist/components/Icon/Icon.js.map +1 -0
- package/dist/components/{Icons/Icon → Icon}/Icon.types.d.ts +42 -30
- package/dist/components/Icon/Icon.types.d.ts.map +1 -0
- package/dist/components/{Icons/Icon → Icon}/Icon.types.js +42 -30
- package/dist/components/Icon/Icon.types.js.map +1 -0
- package/dist/components/Icon/Icon.utilities.d.ts.map +1 -0
- package/dist/components/{Icons/Icon → Icon}/Icon.utilities.js +1 -1
- package/dist/components/Icon/Icon.utilities.js.map +1 -0
- package/dist/components/Icon/index.d.ts.map +1 -0
- package/dist/components/Icon/index.js.map +1 -0
- package/dist/components/Text/Text.d.ts +3 -10
- package/dist/components/Text/Text.d.ts.map +1 -1
- package/dist/components/Text/Text.js +1 -1
- package/dist/components/Text/Text.js.map +1 -1
- package/dist/components/Text/Text.types.d.ts +39 -29
- package/dist/components/Text/Text.types.d.ts.map +1 -1
- package/dist/components/Text/Text.types.js +39 -29
- package/dist/components/Text/Text.types.js.map +1 -1
- package/dist/components/Text/Text.utilities.js +1 -1
- package/dist/components/Text/Text.utilities.js.map +1 -1
- package/dist/components/Text/index.d.ts +1 -0
- package/dist/components/Text/index.d.ts.map +1 -1
- package/dist/components/Text/index.js.map +1 -1
- package/dist/components/TextButton/TextButton.constants.d.ts +3 -0
- package/dist/components/TextButton/TextButton.constants.d.ts.map +1 -0
- package/dist/components/TextButton/TextButton.constants.js +29 -0
- package/dist/components/TextButton/TextButton.constants.js.map +1 -0
- package/dist/components/TextButton/TextButton.d.ts +5 -0
- package/dist/components/TextButton/TextButton.d.ts.map +1 -0
- package/dist/components/TextButton/TextButton.js +187 -0
- package/dist/components/TextButton/TextButton.js.map +1 -0
- package/dist/components/TextButton/TextButton.types.d.ts +73 -0
- package/dist/components/TextButton/TextButton.types.d.ts.map +1 -0
- package/dist/components/TextButton/TextButton.types.js +3 -0
- package/dist/components/TextButton/TextButton.types.js.map +1 -0
- package/dist/components/TextButton/TextButton.utilities.d.ts +55 -0
- package/dist/components/TextButton/TextButton.utilities.d.ts.map +1 -0
- package/dist/components/TextButton/TextButton.utilities.js +77 -0
- package/dist/components/TextButton/TextButton.utilities.js.map +1 -0
- package/dist/components/TextButton/index.d.ts +3 -0
- package/dist/components/TextButton/index.d.ts.map +1 -0
- package/dist/components/TextButton/index.js +9 -0
- package/dist/components/TextButton/index.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/primitives/ButtonAnimated/ButtonAnimated.d.ts +5 -0
- package/dist/primitives/ButtonAnimated/ButtonAnimated.d.ts.map +1 -0
- package/dist/primitives/ButtonAnimated/ButtonAnimated.js +58 -0
- package/dist/primitives/ButtonAnimated/ButtonAnimated.js.map +1 -0
- package/dist/primitives/ButtonAnimated/ButtonAnimated.types.d.ts +6 -0
- package/dist/primitives/ButtonAnimated/ButtonAnimated.types.d.ts.map +1 -0
- package/dist/primitives/ButtonAnimated/ButtonAnimated.types.js +3 -0
- package/dist/primitives/ButtonAnimated/ButtonAnimated.types.js.map +1 -0
- package/dist/primitives/ButtonAnimated/index.d.ts +2 -0
- package/dist/primitives/ButtonAnimated/index.d.ts.map +1 -0
- package/dist/primitives/ButtonAnimated/index.js +9 -0
- package/dist/primitives/ButtonAnimated/index.js.map +1 -0
- package/dist/primitives/ButtonBase/ButtonBase.constants.d.ts +3 -0
- package/dist/primitives/ButtonBase/ButtonBase.constants.d.ts.map +1 -0
- package/dist/primitives/ButtonBase/ButtonBase.constants.js +32 -0
- package/dist/primitives/ButtonBase/ButtonBase.constants.js.map +1 -0
- package/dist/primitives/ButtonBase/ButtonBase.d.ts +5 -0
- package/dist/primitives/ButtonBase/ButtonBase.d.ts.map +1 -0
- package/dist/primitives/ButtonBase/ButtonBase.js +84 -0
- package/dist/primitives/ButtonBase/ButtonBase.js.map +1 -0
- package/dist/primitives/ButtonBase/ButtonBase.types.d.ts +93 -0
- package/dist/primitives/ButtonBase/ButtonBase.types.d.ts.map +1 -0
- package/dist/primitives/ButtonBase/ButtonBase.types.js +19 -0
- package/dist/primitives/ButtonBase/ButtonBase.types.js.map +1 -0
- package/dist/primitives/ButtonBase/ButtonBase.utilities.d.ts +28 -0
- package/dist/primitives/ButtonBase/ButtonBase.utilities.d.ts.map +1 -0
- package/dist/primitives/ButtonBase/ButtonBase.utilities.js +41 -0
- package/dist/primitives/ButtonBase/ButtonBase.utilities.js.map +1 -0
- package/dist/primitives/ButtonBase/index.d.ts +4 -0
- package/dist/primitives/ButtonBase/index.d.ts.map +1 -0
- package/dist/primitives/ButtonBase/index.js +11 -0
- package/dist/primitives/ButtonBase/index.js.map +1 -0
- package/dist/primitives/TextOrChildren/TextOrChildren.d.ts +5 -0
- package/dist/primitives/TextOrChildren/TextOrChildren.d.ts.map +1 -0
- package/dist/primitives/TextOrChildren/TextOrChildren.js +15 -0
- package/dist/primitives/TextOrChildren/TextOrChildren.js.map +1 -0
- package/dist/primitives/TextOrChildren/TextOrChildren.types.d.ts +15 -0
- package/dist/primitives/TextOrChildren/TextOrChildren.types.d.ts.map +1 -0
- package/dist/primitives/TextOrChildren/TextOrChildren.types.js +3 -0
- package/dist/primitives/TextOrChildren/TextOrChildren.types.js.map +1 -0
- package/dist/temp-components/Spinner/Spinner.constants.d.ts +3 -0
- package/dist/temp-components/Spinner/Spinner.constants.d.ts.map +1 -0
- package/dist/temp-components/Spinner/Spinner.constants.js +21 -0
- package/dist/temp-components/Spinner/Spinner.constants.js.map +1 -0
- package/dist/temp-components/Spinner/Spinner.d.ts +5 -0
- package/dist/temp-components/Spinner/Spinner.d.ts.map +1 -0
- package/dist/temp-components/Spinner/Spinner.js +68 -0
- package/dist/temp-components/Spinner/Spinner.js.map +1 -0
- package/dist/temp-components/Spinner/Spinner.types.d.ts +30 -0
- package/dist/temp-components/Spinner/Spinner.types.d.ts.map +1 -0
- package/dist/temp-components/Spinner/Spinner.types.js +3 -0
- package/dist/temp-components/Spinner/Spinner.types.js.map +1 -0
- package/dist/temp-components/Spinner/index.d.ts +3 -0
- package/dist/temp-components/Spinner/index.d.ts.map +1 -0
- package/dist/temp-components/Spinner/index.js +9 -0
- package/dist/temp-components/Spinner/index.js.map +1 -0
- package/package.json +5 -4
- package/dist/components/Icons/Icon/Icon.assets.d.ts.map +0 -1
- package/dist/components/Icons/Icon/Icon.assets.js.map +0 -1
- package/dist/components/Icons/Icon/Icon.constants.d.ts.map +0 -1
- package/dist/components/Icons/Icon/Icon.constants.js +0 -39
- package/dist/components/Icons/Icon/Icon.constants.js.map +0 -1
- package/dist/components/Icons/Icon/Icon.d.ts +0 -9
- package/dist/components/Icons/Icon/Icon.d.ts.map +0 -1
- package/dist/components/Icons/Icon/Icon.js.map +0 -1
- package/dist/components/Icons/Icon/Icon.types.d.ts.map +0 -1
- package/dist/components/Icons/Icon/Icon.types.js.map +0 -1
- package/dist/components/Icons/Icon/Icon.utilities.d.ts.map +0 -1
- package/dist/components/Icons/Icon/Icon.utilities.js.map +0 -1
- package/dist/components/Icons/Icon/index.d.ts.map +0 -1
- package/dist/components/Icons/Icon/index.js.map +0 -1
- /package/dist/components/{Icons/Icon → Icon}/Icon.assets.d.ts +0 -0
- /package/dist/components/{Icons/Icon → Icon}/Icon.assets.js +0 -0
- /package/dist/components/{Icons/Icon → Icon}/Icon.utilities.d.ts +0 -0
- /package/dist/components/{Icons/Icon → Icon}/index.d.ts +0 -0
- /package/dist/components/{Icons/Icon → Icon}/index.js +0 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ButtonBaseProps } from '../../../../primitives/ButtonBase';
|
|
2
|
+
/**
|
|
3
|
+
* ButtonTertiary component props.
|
|
4
|
+
*/
|
|
5
|
+
export type ButtonTertiaryProps = {
|
|
6
|
+
/**
|
|
7
|
+
* Optional prop to show the danger state of the button.
|
|
8
|
+
* @default false
|
|
9
|
+
*/
|
|
10
|
+
isDanger?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Optional prop to show the inverse state of the button, which is reserved for buttons on colored backgrounds.
|
|
13
|
+
* @default false
|
|
14
|
+
*/
|
|
15
|
+
isInverse?: boolean;
|
|
16
|
+
} & ButtonBaseProps;
|
|
17
|
+
//# sourceMappingURL=ButtonTertiary.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ButtonTertiary.types.d.ts","sourceRoot":"","sources":["../../../../../src/components/Button/variants/ButtonTertiary/ButtonTertiary.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAEzE;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,GAAG,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ButtonTertiary.types.js","sourceRoot":"","sources":["../../../../../src/components/Button/variants/ButtonTertiary/ButtonTertiary.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ButtonBaseProps } from '../../../../primitives/ButtonBase';\n\n/**\n * ButtonTertiary component props.\n */\nexport type ButtonTertiaryProps = {\n /**\n * Optional prop to show the danger state of the button.\n * @default false\n */\n isDanger?: boolean;\n /**\n * Optional prop to show the inverse state of the button, which is reserved for buttons on colored backgrounds.\n * @default false\n */\n isInverse?: boolean;\n} & ButtonBaseProps;\n"]}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { ButtonTertiaryProps } from './ButtonTertiary.types';
|
|
2
|
+
/**
|
|
3
|
+
* Generates Tailwind class names for a tertiary button's container based on its state.
|
|
4
|
+
*
|
|
5
|
+
* This function calculates the background, border color, and border width styles dynamically
|
|
6
|
+
* depending on the button's state (`isPressed`, `isDanger`, `isInverse`, `isLoading`). It also
|
|
7
|
+
* allows additional Tailwind classes to be appended using the `twClassName` parameter.
|
|
8
|
+
*
|
|
9
|
+
* @param isPressed - Indicates whether the button is currently being pressed.
|
|
10
|
+
* @param isDanger - Indicates whether the button is in a "danger" state.
|
|
11
|
+
* @param isInverse - Indicates whether the button is using an "inverse" theme.
|
|
12
|
+
* @param isLoading - Indicates whether the button is in a loading state.
|
|
13
|
+
* @param twClassName - Additional Tailwind class names for customization.
|
|
14
|
+
* @returns A string containing the combined Tailwind class names for the container's background,
|
|
15
|
+
* border styles, and any additional classes.
|
|
16
|
+
*
|
|
17
|
+
* Example:
|
|
18
|
+
* ```
|
|
19
|
+
* const classNames = generateButtonTertiaryContainerClassNames({
|
|
20
|
+
* isPressed: true,
|
|
21
|
+
* isDanger: true,
|
|
22
|
+
* isInverse: false,
|
|
23
|
+
* isLoading: false,
|
|
24
|
+
* twClassName: 'rounded-full',
|
|
25
|
+
* });
|
|
26
|
+
*
|
|
27
|
+
* console.log(classNames);
|
|
28
|
+
* // Output: "bg-error-mutedPressed border-0 border-error-mutedPressed rounded-full"
|
|
29
|
+
*
|
|
30
|
+
* const inverseClassNames = generateButtonTertiaryContainerClassNames({
|
|
31
|
+
* isInverse: true,
|
|
32
|
+
* twClassName: 'rounded-lg',
|
|
33
|
+
* });
|
|
34
|
+
*
|
|
35
|
+
* console.log(inverseClassNames);
|
|
36
|
+
* // Output: "bg-transparent border-[1.5px] border-primary-inverse rounded-lg"
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* State Priorities:
|
|
40
|
+
* 1. If `isInverse` and `isDanger` are true, styles are dynamically determined based on `isPressed` or `isLoading`.
|
|
41
|
+
* 2. If only `isDanger` is true, the styles reflect error-related colors with no borders.
|
|
42
|
+
* 3. If only `isInverse` is true, a border width is added along with inverse-specific styles.
|
|
43
|
+
* 4. If none of the above states are true, default styles are applied for a non-danger, non-inverse tertiary button.
|
|
44
|
+
*/
|
|
45
|
+
export declare const generateButtonTertiaryContainerClassNames: ({ isPressed, isDanger, isInverse, isLoading, twClassName, }: Partial<ButtonTertiaryProps> & {
|
|
46
|
+
isPressed?: boolean | undefined;
|
|
47
|
+
}) => string;
|
|
48
|
+
/**
|
|
49
|
+
* Generates Tailwind class names for a tertiary button's text styling based on its state.
|
|
50
|
+
*
|
|
51
|
+
* This function determines the appropriate text color class name for a tertiary button
|
|
52
|
+
* by evaluating the current states (`isPressed`, `isDanger`, `isInverse`, `isLoading`).
|
|
53
|
+
* The returned class name dynamically reflects the button's configuration.
|
|
54
|
+
*
|
|
55
|
+
* @param isPressed - Indicates whether the button is currently being pressed.
|
|
56
|
+
* @param isDanger - Indicates whether the button is in a "danger" state.
|
|
57
|
+
* @param isInverse - Indicates whether the button is using an "inverse" theme.
|
|
58
|
+
* @param isLoading - Indicates whether the button is in a loading state.
|
|
59
|
+
* @returns A string containing the Tailwind class name for the button's text color.
|
|
60
|
+
*
|
|
61
|
+
* Example:
|
|
62
|
+
* ```
|
|
63
|
+
* const classNames = generateButtonTertiaryTextClassNames({
|
|
64
|
+
* isPressed: true,
|
|
65
|
+
* isDanger: true,
|
|
66
|
+
* isInverse: false,
|
|
67
|
+
* isLoading: false,
|
|
68
|
+
* });
|
|
69
|
+
*
|
|
70
|
+
* console.log(classNames);
|
|
71
|
+
* // Output: "text-error-defaultPressed"
|
|
72
|
+
*
|
|
73
|
+
* const defaultClassNames = generateButtonTertiaryTextClassNames({});
|
|
74
|
+
*
|
|
75
|
+
* console.log(defaultClassNames);
|
|
76
|
+
* // Output: "text-primary-default"
|
|
77
|
+
* ```
|
|
78
|
+
*
|
|
79
|
+
* State Priorities:
|
|
80
|
+
* 1. If `isInverse` and `isDanger` are true, the text color is determined dynamically based on `isPressed` or `isLoading`.
|
|
81
|
+
* 2. If only `isDanger` is true, the text color defaults to `text-error-default` or `text-error-defaultPressed` depending on the state.
|
|
82
|
+
* 3. If only `isInverse` is true, the text color is `text-primary-inverse`.
|
|
83
|
+
* 4. If none of the above states are true, the text color defaults to `text-primary-default`.
|
|
84
|
+
*/
|
|
85
|
+
export declare const generateButtonTertiaryTextClassNames: ({ isPressed, isDanger, isInverse, isLoading, }: Partial<ButtonTertiaryProps> & {
|
|
86
|
+
isPressed?: boolean | undefined;
|
|
87
|
+
}) => string;
|
|
88
|
+
//# sourceMappingURL=ButtonTertiary.utilities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ButtonTertiary.utilities.d.ts","sourceRoot":"","sources":["../../../../../src/components/Button/variants/ButtonTertiary/ButtonTertiary.utilities.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAElE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,eAAO,MAAM,yCAAyC;;MAQlD,MAoCH,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,eAAO,MAAM,oCAAoC;;MAO7C,MAqBH,CAAC"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateButtonTertiaryTextClassNames = exports.generateButtonTertiaryContainerClassNames = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Generates Tailwind class names for a tertiary button's container based on its state.
|
|
6
|
+
*
|
|
7
|
+
* This function calculates the background, border color, and border width styles dynamically
|
|
8
|
+
* depending on the button's state (`isPressed`, `isDanger`, `isInverse`, `isLoading`). It also
|
|
9
|
+
* allows additional Tailwind classes to be appended using the `twClassName` parameter.
|
|
10
|
+
*
|
|
11
|
+
* @param isPressed - Indicates whether the button is currently being pressed.
|
|
12
|
+
* @param isDanger - Indicates whether the button is in a "danger" state.
|
|
13
|
+
* @param isInverse - Indicates whether the button is using an "inverse" theme.
|
|
14
|
+
* @param isLoading - Indicates whether the button is in a loading state.
|
|
15
|
+
* @param twClassName - Additional Tailwind class names for customization.
|
|
16
|
+
* @returns A string containing the combined Tailwind class names for the container's background,
|
|
17
|
+
* border styles, and any additional classes.
|
|
18
|
+
*
|
|
19
|
+
* Example:
|
|
20
|
+
* ```
|
|
21
|
+
* const classNames = generateButtonTertiaryContainerClassNames({
|
|
22
|
+
* isPressed: true,
|
|
23
|
+
* isDanger: true,
|
|
24
|
+
* isInverse: false,
|
|
25
|
+
* isLoading: false,
|
|
26
|
+
* twClassName: 'rounded-full',
|
|
27
|
+
* });
|
|
28
|
+
*
|
|
29
|
+
* console.log(classNames);
|
|
30
|
+
* // Output: "bg-error-mutedPressed border-0 border-error-mutedPressed rounded-full"
|
|
31
|
+
*
|
|
32
|
+
* const inverseClassNames = generateButtonTertiaryContainerClassNames({
|
|
33
|
+
* isInverse: true,
|
|
34
|
+
* twClassName: 'rounded-lg',
|
|
35
|
+
* });
|
|
36
|
+
*
|
|
37
|
+
* console.log(inverseClassNames);
|
|
38
|
+
* // Output: "bg-transparent border-[1.5px] border-primary-inverse rounded-lg"
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* State Priorities:
|
|
42
|
+
* 1. If `isInverse` and `isDanger` are true, styles are dynamically determined based on `isPressed` or `isLoading`.
|
|
43
|
+
* 2. If only `isDanger` is true, the styles reflect error-related colors with no borders.
|
|
44
|
+
* 3. If only `isInverse` is true, a border width is added along with inverse-specific styles.
|
|
45
|
+
* 4. If none of the above states are true, default styles are applied for a non-danger, non-inverse tertiary button.
|
|
46
|
+
*/
|
|
47
|
+
const generateButtonTertiaryContainerClassNames = ({ isPressed = false, isDanger = false, isInverse = false, isLoading = false, twClassName = '', }) => {
|
|
48
|
+
let backgroundStyle, borderColorStyle;
|
|
49
|
+
let borderWidthStyle = 'border-0';
|
|
50
|
+
const isPressedOrLoading = isPressed || isLoading;
|
|
51
|
+
if (isInverse && isDanger) {
|
|
52
|
+
backgroundStyle = isPressedOrLoading
|
|
53
|
+
? 'bg-background-defaultPressed'
|
|
54
|
+
: 'bg-background-default';
|
|
55
|
+
borderColorStyle = isPressedOrLoading
|
|
56
|
+
? 'border-background-defaultPressed'
|
|
57
|
+
: 'border-background-default';
|
|
58
|
+
}
|
|
59
|
+
else if (isDanger) {
|
|
60
|
+
backgroundStyle = isPressedOrLoading
|
|
61
|
+
? 'bg-error-mutedPressed'
|
|
62
|
+
: 'bg-transparent';
|
|
63
|
+
borderColorStyle = isPressedOrLoading
|
|
64
|
+
? 'border-error-mutedPressed'
|
|
65
|
+
: 'border-transparent';
|
|
66
|
+
}
|
|
67
|
+
else if (isInverse) {
|
|
68
|
+
backgroundStyle = isPressedOrLoading
|
|
69
|
+
? 'bg-background-pressed'
|
|
70
|
+
: 'bg-transparent';
|
|
71
|
+
borderColorStyle = 'border-primary-inverse';
|
|
72
|
+
borderWidthStyle = 'border-[1.5px]';
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
backgroundStyle = isPressedOrLoading
|
|
76
|
+
? 'bg-background-pressed'
|
|
77
|
+
: 'bg-transparent';
|
|
78
|
+
borderColorStyle = isPressedOrLoading
|
|
79
|
+
? 'border-background-pressed'
|
|
80
|
+
: 'border-transparent';
|
|
81
|
+
}
|
|
82
|
+
return `${backgroundStyle} ${borderWidthStyle} ${borderColorStyle} ${twClassName}`;
|
|
83
|
+
};
|
|
84
|
+
exports.generateButtonTertiaryContainerClassNames = generateButtonTertiaryContainerClassNames;
|
|
85
|
+
/**
|
|
86
|
+
* Generates Tailwind class names for a tertiary button's text styling based on its state.
|
|
87
|
+
*
|
|
88
|
+
* This function determines the appropriate text color class name for a tertiary button
|
|
89
|
+
* by evaluating the current states (`isPressed`, `isDanger`, `isInverse`, `isLoading`).
|
|
90
|
+
* The returned class name dynamically reflects the button's configuration.
|
|
91
|
+
*
|
|
92
|
+
* @param isPressed - Indicates whether the button is currently being pressed.
|
|
93
|
+
* @param isDanger - Indicates whether the button is in a "danger" state.
|
|
94
|
+
* @param isInverse - Indicates whether the button is using an "inverse" theme.
|
|
95
|
+
* @param isLoading - Indicates whether the button is in a loading state.
|
|
96
|
+
* @returns A string containing the Tailwind class name for the button's text color.
|
|
97
|
+
*
|
|
98
|
+
* Example:
|
|
99
|
+
* ```
|
|
100
|
+
* const classNames = generateButtonTertiaryTextClassNames({
|
|
101
|
+
* isPressed: true,
|
|
102
|
+
* isDanger: true,
|
|
103
|
+
* isInverse: false,
|
|
104
|
+
* isLoading: false,
|
|
105
|
+
* });
|
|
106
|
+
*
|
|
107
|
+
* console.log(classNames);
|
|
108
|
+
* // Output: "text-error-defaultPressed"
|
|
109
|
+
*
|
|
110
|
+
* const defaultClassNames = generateButtonTertiaryTextClassNames({});
|
|
111
|
+
*
|
|
112
|
+
* console.log(defaultClassNames);
|
|
113
|
+
* // Output: "text-primary-default"
|
|
114
|
+
* ```
|
|
115
|
+
*
|
|
116
|
+
* State Priorities:
|
|
117
|
+
* 1. If `isInverse` and `isDanger` are true, the text color is determined dynamically based on `isPressed` or `isLoading`.
|
|
118
|
+
* 2. If only `isDanger` is true, the text color defaults to `text-error-default` or `text-error-defaultPressed` depending on the state.
|
|
119
|
+
* 3. If only `isInverse` is true, the text color is `text-primary-inverse`.
|
|
120
|
+
* 4. If none of the above states are true, the text color defaults to `text-primary-default`.
|
|
121
|
+
*/
|
|
122
|
+
const generateButtonTertiaryTextClassNames = ({ isPressed = false, isDanger = false, isInverse = false, isLoading = false, }) => {
|
|
123
|
+
let textColor;
|
|
124
|
+
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
125
|
+
const isPressedOrLoading = isPressed || isLoading;
|
|
126
|
+
if (isInverse && isDanger) {
|
|
127
|
+
textColor = isPressedOrLoading
|
|
128
|
+
? 'text-error-defaultPressed'
|
|
129
|
+
: 'text-error-default';
|
|
130
|
+
}
|
|
131
|
+
else if (isDanger) {
|
|
132
|
+
textColor = isPressedOrLoading
|
|
133
|
+
? 'text-error-defaultPressed'
|
|
134
|
+
: 'text-error-default';
|
|
135
|
+
}
|
|
136
|
+
else if (isInverse) {
|
|
137
|
+
textColor = 'text-primary-inverse';
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
textColor = isPressedOrLoading
|
|
141
|
+
? 'text-primary-defaultPressed'
|
|
142
|
+
: 'text-primary-default';
|
|
143
|
+
}
|
|
144
|
+
return `${textColor}`;
|
|
145
|
+
};
|
|
146
|
+
exports.generateButtonTertiaryTextClassNames = generateButtonTertiaryTextClassNames;
|
|
147
|
+
//# sourceMappingURL=ButtonTertiary.utilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ButtonTertiary.utilities.js","sourceRoot":"","sources":["../../../../../src/components/Button/variants/ButtonTertiary/ButtonTertiary.utilities.ts"],"names":[],"mappings":";;;AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACI,MAAM,yCAAyC,GAAG,CAAC,EACxD,SAAS,GAAG,KAAK,EACjB,QAAQ,GAAG,KAAK,EAChB,SAAS,GAAG,KAAK,EACjB,SAAS,GAAG,KAAK,EACjB,WAAW,GAAG,EAAE,GAGjB,EAAU,EAAE;IACX,IAAI,eAAe,EAAE,gBAAgB,CAAC;IACtC,IAAI,gBAAgB,GAAG,UAAU,CAAC;IAElC,MAAM,kBAAkB,GAAG,SAAS,IAAI,SAAS,CAAC;IAElD,IAAI,SAAS,IAAI,QAAQ,EAAE;QACzB,eAAe,GAAG,kBAAkB;YAClC,CAAC,CAAC,8BAA8B;YAChC,CAAC,CAAC,uBAAuB,CAAC;QAC5B,gBAAgB,GAAG,kBAAkB;YACnC,CAAC,CAAC,kCAAkC;YACpC,CAAC,CAAC,2BAA2B,CAAC;KACjC;SAAM,IAAI,QAAQ,EAAE;QACnB,eAAe,GAAG,kBAAkB;YAClC,CAAC,CAAC,uBAAuB;YACzB,CAAC,CAAC,gBAAgB,CAAC;QACrB,gBAAgB,GAAG,kBAAkB;YACnC,CAAC,CAAC,2BAA2B;YAC7B,CAAC,CAAC,oBAAoB,CAAC;KAC1B;SAAM,IAAI,SAAS,EAAE;QACpB,eAAe,GAAG,kBAAkB;YAClC,CAAC,CAAC,uBAAuB;YACzB,CAAC,CAAC,gBAAgB,CAAC;QACrB,gBAAgB,GAAG,wBAAwB,CAAC;QAC5C,gBAAgB,GAAG,gBAAgB,CAAC;KACrC;SAAM;QACL,eAAe,GAAG,kBAAkB;YAClC,CAAC,CAAC,uBAAuB;YACzB,CAAC,CAAC,gBAAgB,CAAC;QACrB,gBAAgB,GAAG,kBAAkB;YACnC,CAAC,CAAC,2BAA2B;YAC7B,CAAC,CAAC,oBAAoB,CAAC;KAC1B;IAED,OAAO,GAAG,eAAe,IAAI,gBAAgB,IAAI,gBAAgB,IAAI,WAAW,EAAE,CAAC;AACrF,CAAC,CAAC;AA5CW,QAAA,yCAAyC,6CA4CpD;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACI,MAAM,oCAAoC,GAAG,CAAC,EACnD,SAAS,GAAG,KAAK,EACjB,QAAQ,GAAG,KAAK,EAChB,SAAS,GAAG,KAAK,EACjB,SAAS,GAAG,KAAK,GAGlB,EAAU,EAAE;IACX,IAAI,SAAS,CAAC;IACd,wEAAwE;IACxE,MAAM,kBAAkB,GAAG,SAAS,IAAI,SAAS,CAAC;IAClD,IAAI,SAAS,IAAI,QAAQ,EAAE;QACzB,SAAS,GAAG,kBAAkB;YAC5B,CAAC,CAAC,2BAA2B;YAC7B,CAAC,CAAC,oBAAoB,CAAC;KAC1B;SAAM,IAAI,QAAQ,EAAE;QACnB,SAAS,GAAG,kBAAkB;YAC5B,CAAC,CAAC,2BAA2B;YAC7B,CAAC,CAAC,oBAAoB,CAAC;KAC1B;SAAM,IAAI,SAAS,EAAE;QACpB,SAAS,GAAG,sBAAsB,CAAC;KACpC;SAAM;QACL,SAAS,GAAG,kBAAkB;YAC5B,CAAC,CAAC,6BAA6B;YAC/B,CAAC,CAAC,sBAAsB,CAAC;KAC5B;IAED,OAAO,GAAG,SAAS,EAAE,CAAC;AACxB,CAAC,CAAC;AA5BW,QAAA,oCAAoC,wCA4B/C","sourcesContent":["/* eslint-disable jsdoc/check-param-names */\n/* eslint-disable jsdoc/require-param */\nimport type { ButtonTertiaryProps } from './ButtonTertiary.types';\n\n/**\n * Generates Tailwind class names for a tertiary button's container based on its state.\n *\n * This function calculates the background, border color, and border width styles dynamically\n * depending on the button's state (`isPressed`, `isDanger`, `isInverse`, `isLoading`). It also\n * allows additional Tailwind classes to be appended using the `twClassName` parameter.\n *\n * @param isPressed - Indicates whether the button is currently being pressed.\n * @param isDanger - Indicates whether the button is in a \"danger\" state.\n * @param isInverse - Indicates whether the button is using an \"inverse\" theme.\n * @param isLoading - Indicates whether the button is in a loading state.\n * @param twClassName - Additional Tailwind class names for customization.\n * @returns A string containing the combined Tailwind class names for the container's background,\n * border styles, and any additional classes.\n *\n * Example:\n * ```\n * const classNames = generateButtonTertiaryContainerClassNames({\n * isPressed: true,\n * isDanger: true,\n * isInverse: false,\n * isLoading: false,\n * twClassName: 'rounded-full',\n * });\n *\n * console.log(classNames);\n * // Output: \"bg-error-mutedPressed border-0 border-error-mutedPressed rounded-full\"\n *\n * const inverseClassNames = generateButtonTertiaryContainerClassNames({\n * isInverse: true,\n * twClassName: 'rounded-lg',\n * });\n *\n * console.log(inverseClassNames);\n * // Output: \"bg-transparent border-[1.5px] border-primary-inverse rounded-lg\"\n * ```\n *\n * State Priorities:\n * 1. If `isInverse` and `isDanger` are true, styles are dynamically determined based on `isPressed` or `isLoading`.\n * 2. If only `isDanger` is true, the styles reflect error-related colors with no borders.\n * 3. If only `isInverse` is true, a border width is added along with inverse-specific styles.\n * 4. If none of the above states are true, default styles are applied for a non-danger, non-inverse tertiary button.\n */\nexport const generateButtonTertiaryContainerClassNames = ({\n isPressed = false,\n isDanger = false,\n isInverse = false,\n isLoading = false,\n twClassName = '',\n}: Partial<ButtonTertiaryProps> & {\n isPressed?: boolean;\n}): string => {\n let backgroundStyle, borderColorStyle;\n let borderWidthStyle = 'border-0';\n\n const isPressedOrLoading = isPressed || isLoading;\n\n if (isInverse && isDanger) {\n backgroundStyle = isPressedOrLoading\n ? 'bg-background-defaultPressed'\n : 'bg-background-default';\n borderColorStyle = isPressedOrLoading\n ? 'border-background-defaultPressed'\n : 'border-background-default';\n } else if (isDanger) {\n backgroundStyle = isPressedOrLoading\n ? 'bg-error-mutedPressed'\n : 'bg-transparent';\n borderColorStyle = isPressedOrLoading\n ? 'border-error-mutedPressed'\n : 'border-transparent';\n } else if (isInverse) {\n backgroundStyle = isPressedOrLoading\n ? 'bg-background-pressed'\n : 'bg-transparent';\n borderColorStyle = 'border-primary-inverse';\n borderWidthStyle = 'border-[1.5px]';\n } else {\n backgroundStyle = isPressedOrLoading\n ? 'bg-background-pressed'\n : 'bg-transparent';\n borderColorStyle = isPressedOrLoading\n ? 'border-background-pressed'\n : 'border-transparent';\n }\n\n return `${backgroundStyle} ${borderWidthStyle} ${borderColorStyle} ${twClassName}`;\n};\n\n/**\n * Generates Tailwind class names for a tertiary button's text styling based on its state.\n *\n * This function determines the appropriate text color class name for a tertiary button\n * by evaluating the current states (`isPressed`, `isDanger`, `isInverse`, `isLoading`).\n * The returned class name dynamically reflects the button's configuration.\n *\n * @param isPressed - Indicates whether the button is currently being pressed.\n * @param isDanger - Indicates whether the button is in a \"danger\" state.\n * @param isInverse - Indicates whether the button is using an \"inverse\" theme.\n * @param isLoading - Indicates whether the button is in a loading state.\n * @returns A string containing the Tailwind class name for the button's text color.\n *\n * Example:\n * ```\n * const classNames = generateButtonTertiaryTextClassNames({\n * isPressed: true,\n * isDanger: true,\n * isInverse: false,\n * isLoading: false,\n * });\n *\n * console.log(classNames);\n * // Output: \"text-error-defaultPressed\"\n *\n * const defaultClassNames = generateButtonTertiaryTextClassNames({});\n *\n * console.log(defaultClassNames);\n * // Output: \"text-primary-default\"\n * ```\n *\n * State Priorities:\n * 1. If `isInverse` and `isDanger` are true, the text color is determined dynamically based on `isPressed` or `isLoading`.\n * 2. If only `isDanger` is true, the text color defaults to `text-error-default` or `text-error-defaultPressed` depending on the state.\n * 3. If only `isInverse` is true, the text color is `text-primary-inverse`.\n * 4. If none of the above states are true, the text color defaults to `text-primary-default`.\n */\nexport const generateButtonTertiaryTextClassNames = ({\n isPressed = false,\n isDanger = false,\n isInverse = false,\n isLoading = false,\n}: Partial<ButtonTertiaryProps> & {\n isPressed?: boolean;\n}): string => {\n let textColor;\n // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing\n const isPressedOrLoading = isPressed || isLoading;\n if (isInverse && isDanger) {\n textColor = isPressedOrLoading\n ? 'text-error-defaultPressed'\n : 'text-error-default';\n } else if (isDanger) {\n textColor = isPressedOrLoading\n ? 'text-error-defaultPressed'\n : 'text-error-default';\n } else if (isInverse) {\n textColor = 'text-primary-inverse';\n } else {\n textColor = isPressedOrLoading\n ? 'text-primary-defaultPressed'\n : 'text-primary-default';\n }\n\n return `${textColor}`;\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/Button/variants/ButtonTertiary/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,YAAY,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,cAAc,IAAI,kBAAkB,EAAE,MAAM,mCAAmC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ButtonTertiarySize = exports.default = void 0;
|
|
7
|
+
var ButtonTertiary_1 = require("./ButtonTertiary");
|
|
8
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(ButtonTertiary_1).default; } });
|
|
9
|
+
var ButtonBase_1 = require("../../../../primitives/ButtonBase");
|
|
10
|
+
Object.defineProperty(exports, "ButtonTertiarySize", { enumerable: true, get: function () { return ButtonBase_1.ButtonBaseSize; } });
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/components/Button/variants/ButtonTertiary/index.ts"],"names":[],"mappings":";;;;;;AAAA,mDAA2C;AAAlC,0HAAA,OAAO,OAAA;AAEhB,gEAAyF;AAAhF,gHAAA,cAAc,OAAsB","sourcesContent":["export { default } from './ButtonTertiary';\nexport type { ButtonTertiaryProps } from './ButtonTertiary.types';\nexport { ButtonBaseSize as ButtonTertiarySize } from '../../../../primitives/ButtonBase';\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { IconSize } from '../Icon';
|
|
2
|
+
import { ButtonIconSize } from './ButtonIcon.types';
|
|
3
|
+
import type { ButtonIconProps } from './ButtonIcon.types';
|
|
4
|
+
export declare const MAPPING_BUTTONICONSIZE_ICONSIZE: Record<ButtonIconSize, IconSize>;
|
|
5
|
+
export declare const DEFAULT_BUTTONICON_PROPS: Pick<ButtonIconProps, 'iconName' | 'size' | 'isDisabled' | 'isInverse' | 'isFloating'>;
|
|
6
|
+
//# sourceMappingURL=ButtonIcon.constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ButtonIcon.constants.d.ts","sourceRoot":"","sources":["../../../src/components/ButtonIcon/ButtonIcon.constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAY,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAG1D,eAAO,MAAM,+BAA+B,EAAE,MAAM,CAAC,cAAc,EAAE,QAAQ,CAK1E,CAAC;AAGJ,eAAO,MAAM,wBAAwB,EAAE,IAAI,CACzC,eAAe,EACf,UAAU,GAAG,MAAM,GAAG,YAAY,GAAG,WAAW,GAAG,YAAY,CAOhE,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEFAULT_BUTTONICON_PROPS = exports.MAPPING_BUTTONICONSIZE_ICONSIZE = void 0;
|
|
4
|
+
const Icon_1 = require("../Icon");
|
|
5
|
+
const ButtonIcon_types_1 = require("./ButtonIcon.types");
|
|
6
|
+
// Mappings
|
|
7
|
+
exports.MAPPING_BUTTONICONSIZE_ICONSIZE = {
|
|
8
|
+
[ButtonIcon_types_1.ButtonIconSize.Sm]: Icon_1.IconSize.Sm,
|
|
9
|
+
[ButtonIcon_types_1.ButtonIconSize.Md]: Icon_1.IconSize.Md,
|
|
10
|
+
[ButtonIcon_types_1.ButtonIconSize.Lg]: Icon_1.IconSize.Lg,
|
|
11
|
+
};
|
|
12
|
+
// Defaults
|
|
13
|
+
exports.DEFAULT_BUTTONICON_PROPS = {
|
|
14
|
+
iconName: Icon_1.IconName.Close,
|
|
15
|
+
size: ButtonIcon_types_1.ButtonIconSize.Md,
|
|
16
|
+
isDisabled: false,
|
|
17
|
+
isInverse: false,
|
|
18
|
+
isFloating: false,
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=ButtonIcon.constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ButtonIcon.constants.js","sourceRoot":"","sources":["../../../src/components/ButtonIcon/ButtonIcon.constants.ts"],"names":[],"mappings":";;;AAAA,kCAA6C;AAC7C,yDAAoD;AAGpD,WAAW;AACE,QAAA,+BAA+B,GAC1C;IACE,CAAC,iCAAc,CAAC,EAAE,CAAC,EAAE,eAAQ,CAAC,EAAE;IAChC,CAAC,iCAAc,CAAC,EAAE,CAAC,EAAE,eAAQ,CAAC,EAAE;IAChC,CAAC,iCAAc,CAAC,EAAE,CAAC,EAAE,eAAQ,CAAC,EAAE;CACjC,CAAC;AAEJ,WAAW;AACE,QAAA,wBAAwB,GAGjC;IACF,QAAQ,EAAE,eAAQ,CAAC,KAAK;IACxB,IAAI,EAAE,iCAAc,CAAC,EAAE;IACvB,UAAU,EAAE,KAAK;IACjB,SAAS,EAAE,KAAK;IAChB,UAAU,EAAE,KAAK;CAClB,CAAC","sourcesContent":["import { IconSize, IconName } from '../Icon';\nimport { ButtonIconSize } from './ButtonIcon.types';\nimport type { ButtonIconProps } from './ButtonIcon.types';\n\n// Mappings\nexport const MAPPING_BUTTONICONSIZE_ICONSIZE: Record<ButtonIconSize, IconSize> =\n {\n [ButtonIconSize.Sm]: IconSize.Sm,\n [ButtonIconSize.Md]: IconSize.Md,\n [ButtonIconSize.Lg]: IconSize.Lg,\n };\n\n// Defaults\nexport const DEFAULT_BUTTONICON_PROPS: Pick<\n ButtonIconProps,\n 'iconName' | 'size' | 'isDisabled' | 'isInverse' | 'isFloating'\n> = {\n iconName: IconName.Close,\n size: ButtonIconSize.Md,\n isDisabled: false,\n isInverse: false,\n isFloating: false,\n};\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ButtonIconProps } from './ButtonIcon.types';
|
|
3
|
+
declare const ButtonIcon: ({ size, iconName, iconProps, isDisabled, isInverse, isFloating, onPressIn, onPressOut, twClassName, style, ...props }: ButtonIconProps) => React.JSX.Element;
|
|
4
|
+
export default ButtonIcon;
|
|
5
|
+
//# sourceMappingURL=ButtonIcon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ButtonIcon.d.ts","sourceRoot":"","sources":["../../../src/components/ButtonIcon/ButtonIcon.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAUjD,OAAO,KAAK,EAAE,eAAe,EAAkB,MAAM,oBAAoB,CAAC;AAM1E,QAAA,MAAM,UAAU,0HAYb,eAAe,sBAgDjB,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
|
|
30
|
+
const design_system_twrnc_preset_1 = require("@metamask-previews/design-system-twrnc-preset");
|
|
31
|
+
const react_1 = __importStar(require("react"));
|
|
32
|
+
const ButtonAnimated_1 = __importDefault(require("../../primitives/ButtonAnimated"));
|
|
33
|
+
const Icon_1 = __importDefault(require("../Icon"));
|
|
34
|
+
const ButtonIcon_constants_1 = require("./ButtonIcon.constants");
|
|
35
|
+
const ButtonIcon_utilities_1 = require("./ButtonIcon.utilities");
|
|
36
|
+
const ButtonIcon = ({ size = ButtonIcon_constants_1.DEFAULT_BUTTONICON_PROPS.size, iconName, iconProps, isDisabled = ButtonIcon_constants_1.DEFAULT_BUTTONICON_PROPS.isDisabled, isInverse = ButtonIcon_constants_1.DEFAULT_BUTTONICON_PROPS.isInverse, isFloating = ButtonIcon_constants_1.DEFAULT_BUTTONICON_PROPS.isFloating, onPressIn, onPressOut, twClassName, style, ...props }) => {
|
|
37
|
+
const [isPressed, setIsPressed] = (0, react_1.useState)(false);
|
|
38
|
+
const tw = (0, design_system_twrnc_preset_1.useTailwind)();
|
|
39
|
+
const twContainerClassNames = (0, react_1.useMemo)(() => {
|
|
40
|
+
return (0, ButtonIcon_utilities_1.generateButtonIconContainerClassNames)({
|
|
41
|
+
isDisabled,
|
|
42
|
+
isPressed,
|
|
43
|
+
isFloating,
|
|
44
|
+
size,
|
|
45
|
+
twClassName,
|
|
46
|
+
});
|
|
47
|
+
}, [isDisabled, isPressed, isFloating, size, twClassName]);
|
|
48
|
+
const twIconColorClassNames = (0, react_1.useMemo)(() => {
|
|
49
|
+
return (0, ButtonIcon_utilities_1.generateButtonIconIconColorClassNames)({
|
|
50
|
+
isInverse,
|
|
51
|
+
isFloating,
|
|
52
|
+
});
|
|
53
|
+
}, [isInverse, isFloating]);
|
|
54
|
+
const finalIconProps = {
|
|
55
|
+
color: twIconColorClassNames,
|
|
56
|
+
size: ButtonIcon_constants_1.MAPPING_BUTTONICONSIZE_ICONSIZE[size],
|
|
57
|
+
...iconProps,
|
|
58
|
+
};
|
|
59
|
+
const onPressInHandler = (event) => {
|
|
60
|
+
setIsPressed(true);
|
|
61
|
+
onPressIn?.(event);
|
|
62
|
+
};
|
|
63
|
+
const onPressOutHandler = (event) => {
|
|
64
|
+
setIsPressed(false);
|
|
65
|
+
onPressOut?.(event);
|
|
66
|
+
};
|
|
67
|
+
return (<ButtonAnimated_1.default disabled={isDisabled} onPressIn={onPressInHandler} onPressOut={onPressOutHandler} accessible style={[tw `${twContainerClassNames}`, style]} testID="button-icon" {...props}>
|
|
68
|
+
<Icon_1.default name={iconName} {...finalIconProps}/>
|
|
69
|
+
</ButtonAnimated_1.default>);
|
|
70
|
+
};
|
|
71
|
+
exports.default = ButtonIcon;
|
|
72
|
+
//# sourceMappingURL=ButtonIcon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ButtonIcon.js","sourceRoot":"","sources":["../../../src/components/ButtonIcon/ButtonIcon.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iEAAiE;AACjE,8FAA4E;AAC5E,+CAAiD;AAGjD,qFAA6D;AAE7D,mDAA2B;AAC3B,iEAGgC;AAEhC,iEAGgC;AAEhC,MAAM,UAAU,GAAG,CAAC,EAClB,IAAI,GAAG,+CAAwB,CAAC,IAAI,EACpC,QAAQ,EACR,SAAS,EACT,UAAU,GAAG,+CAAwB,CAAC,UAAU,EAChD,SAAS,GAAG,+CAAwB,CAAC,SAAS,EAC9C,UAAU,GAAG,+CAAwB,CAAC,UAAU,EAChD,SAAS,EACT,UAAU,EACV,WAAW,EACX,KAAK,EACL,GAAG,KAAK,EACQ,EAAE,EAAE;IACpB,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IAClD,MAAM,EAAE,GAAG,IAAA,wCAAW,GAAE,CAAC;IACzB,MAAM,qBAAqB,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE;QACzC,OAAO,IAAA,4DAAqC,EAAC;YAC3C,UAAU;YACV,SAAS;YACT,UAAU;YACV,IAAI;YACJ,WAAW;SACZ,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC;IAE3D,MAAM,qBAAqB,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE;QACzC,OAAO,IAAA,4DAAqC,EAAC;YAC3C,SAAS;YACT,UAAU;SACX,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;IAE5B,MAAM,cAAc,GAAuB;QACzC,KAAK,EAAE,qBAAqB;QAC5B,IAAI,EAAE,sDAA+B,CAAC,IAAsB,CAAC;QAC7D,GAAG,SAAS;KACb,CAAC;IACF,MAAM,gBAAgB,GAAG,CAAC,KAA4B,EAAE,EAAE;QACxD,YAAY,CAAC,IAAI,CAAC,CAAC;QACnB,SAAS,EAAE,CAAC,KAAK,CAAC,CAAC;IACrB,CAAC,CAAC;IAEF,MAAM,iBAAiB,GAAG,CAAC,KAA4B,EAAE,EAAE;QACzD,YAAY,CAAC,KAAK,CAAC,CAAC;QACpB,UAAU,EAAE,CAAC,KAAK,CAAC,CAAC;IACtB,CAAC,CAAC;IAEF,OAAO,CACL,CAAC,wBAAc,CACb,QAAQ,CAAC,CAAC,UAAU,CAAC,CACrB,SAAS,CAAC,CAAC,gBAAgB,CAAC,CAC5B,UAAU,CAAC,CAAC,iBAAiB,CAAC,CAC9B,UAAU,CACV,KAAK,CAAC,CAAC,CAAC,EAAE,CAAA,GAAG,qBAAqB,EAAE,EAAE,KAAK,CAAC,CAAC,CAC7C,MAAM,CAAC,aAAa,CACpB,IAAI,KAAK,CAAC,CAEV;MAAA,CAAC,cAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,cAAc,CAAC,EAC3C;IAAA,EAAE,wBAAc,CAAC,CAClB,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,UAAU,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */\nimport { useTailwind } from '@metamask-previews/design-system-twrnc-preset';\nimport React, { useMemo, useState } from 'react';\nimport type { GestureResponderEvent } from 'react-native';\n\nimport ButtonAnimated from '../../primitives/ButtonAnimated';\nimport type { IconProps } from '../Icon';\nimport Icon from '../Icon';\nimport {\n DEFAULT_BUTTONICON_PROPS,\n MAPPING_BUTTONICONSIZE_ICONSIZE,\n} from './ButtonIcon.constants';\nimport type { ButtonIconProps, ButtonIconSize } from './ButtonIcon.types';\nimport {\n generateButtonIconContainerClassNames,\n generateButtonIconIconColorClassNames,\n} from './ButtonIcon.utilities';\n\nconst ButtonIcon = ({\n size = DEFAULT_BUTTONICON_PROPS.size,\n iconName,\n iconProps,\n isDisabled = DEFAULT_BUTTONICON_PROPS.isDisabled,\n isInverse = DEFAULT_BUTTONICON_PROPS.isInverse,\n isFloating = DEFAULT_BUTTONICON_PROPS.isFloating,\n onPressIn,\n onPressOut,\n twClassName,\n style,\n ...props\n}: ButtonIconProps) => {\n const [isPressed, setIsPressed] = useState(false);\n const tw = useTailwind();\n const twContainerClassNames = useMemo(() => {\n return generateButtonIconContainerClassNames({\n isDisabled,\n isPressed,\n isFloating,\n size,\n twClassName,\n });\n }, [isDisabled, isPressed, isFloating, size, twClassName]);\n\n const twIconColorClassNames = useMemo(() => {\n return generateButtonIconIconColorClassNames({\n isInverse,\n isFloating,\n });\n }, [isInverse, isFloating]);\n\n const finalIconProps: Partial<IconProps> = {\n color: twIconColorClassNames,\n size: MAPPING_BUTTONICONSIZE_ICONSIZE[size as ButtonIconSize],\n ...iconProps,\n };\n const onPressInHandler = (event: GestureResponderEvent) => {\n setIsPressed(true);\n onPressIn?.(event);\n };\n\n const onPressOutHandler = (event: GestureResponderEvent) => {\n setIsPressed(false);\n onPressOut?.(event);\n };\n\n return (\n <ButtonAnimated\n disabled={isDisabled}\n onPressIn={onPressInHandler}\n onPressOut={onPressOutHandler}\n accessible\n style={[tw`${twContainerClassNames}`, style]}\n testID=\"button-icon\"\n {...props}\n >\n <Icon name={iconName} {...finalIconProps} />\n </ButtonAnimated>\n );\n};\n\nexport default ButtonIcon;\n"]}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { PressableProps, StyleProp, ViewStyle } from 'react-native';
|
|
2
|
+
import type { IconProps, IconName } from '../Icon';
|
|
3
|
+
export declare enum ButtonIconSize {
|
|
4
|
+
/**
|
|
5
|
+
* Represents a small button size (24px).
|
|
6
|
+
*/
|
|
7
|
+
Sm = "24",
|
|
8
|
+
/**
|
|
9
|
+
* Represents a medium button size (32px).
|
|
10
|
+
*/
|
|
11
|
+
Md = "32",
|
|
12
|
+
/**
|
|
13
|
+
* Represents a large button size (40px).
|
|
14
|
+
*/
|
|
15
|
+
Lg = "40"
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* ButtonIcon component props.
|
|
19
|
+
*/
|
|
20
|
+
export type ButtonIconProps = {
|
|
21
|
+
/**
|
|
22
|
+
* Optional prop to control the size of the icon
|
|
23
|
+
* Different sizes map to specific pixel dimensions
|
|
24
|
+
* @default IconSize.Md
|
|
25
|
+
*/
|
|
26
|
+
size?: ButtonIconSize;
|
|
27
|
+
/**
|
|
28
|
+
* Optional prop to specify an icon to show
|
|
29
|
+
*/
|
|
30
|
+
iconName: IconName;
|
|
31
|
+
/**
|
|
32
|
+
* Optional prop to pass additional properties to the icon
|
|
33
|
+
*/
|
|
34
|
+
iconProps?: Partial<IconProps>;
|
|
35
|
+
/**
|
|
36
|
+
* Optional prop that when true, disables the button
|
|
37
|
+
* @default false
|
|
38
|
+
*/
|
|
39
|
+
isDisabled?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Optional prop to show the inverse state of the button, which is reserved for buttons on colored backgrounds.
|
|
42
|
+
* @default false
|
|
43
|
+
*/
|
|
44
|
+
isInverse?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Optional prop to show the floating/contained state of the button, which is reserved for floating buttons.
|
|
47
|
+
* Note: This prop provides styling only. There is no positioning logic.
|
|
48
|
+
* @default false
|
|
49
|
+
*/
|
|
50
|
+
isFloating?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Optional prop to add twrnc overriding classNames.
|
|
53
|
+
*/
|
|
54
|
+
twClassName?: string;
|
|
55
|
+
/**
|
|
56
|
+
* Optional prop to control the style.
|
|
57
|
+
*/
|
|
58
|
+
style?: StyleProp<ViewStyle>;
|
|
59
|
+
} & Omit<PressableProps, 'children'>;
|
|
60
|
+
//# sourceMappingURL=ButtonIcon.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ButtonIcon.types.d.ts","sourceRoot":"","sources":["../../../src/components/ButtonIcon/ButtonIcon.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzE,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEnD,oBAAY,cAAc;IACxB;;OAEG;IACH,EAAE,OAAO;IACT;;OAEG;IACH,EAAE,OAAO;IACT;;OAEG;IACH,EAAE,OAAO;CACV;AAED;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B;;;;OAIG;IACH,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB;;OAEG;IACH,QAAQ,EAAE,QAAQ,CAAC;IACnB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IAC/B;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B,GAAG,IAAI,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ButtonIconSize = void 0;
|
|
4
|
+
var ButtonIconSize;
|
|
5
|
+
(function (ButtonIconSize) {
|
|
6
|
+
/**
|
|
7
|
+
* Represents a small button size (24px).
|
|
8
|
+
*/
|
|
9
|
+
ButtonIconSize["Sm"] = "24";
|
|
10
|
+
/**
|
|
11
|
+
* Represents a medium button size (32px).
|
|
12
|
+
*/
|
|
13
|
+
ButtonIconSize["Md"] = "32";
|
|
14
|
+
/**
|
|
15
|
+
* Represents a large button size (40px).
|
|
16
|
+
*/
|
|
17
|
+
ButtonIconSize["Lg"] = "40";
|
|
18
|
+
})(ButtonIconSize || (exports.ButtonIconSize = ButtonIconSize = {}));
|
|
19
|
+
//# sourceMappingURL=ButtonIcon.types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ButtonIcon.types.js","sourceRoot":"","sources":["../../../src/components/ButtonIcon/ButtonIcon.types.ts"],"names":[],"mappings":";;;AAIA,IAAY,cAaX;AAbD,WAAY,cAAc;IACxB;;OAEG;IACH,2BAAS,CAAA;IACT;;OAEG;IACH,2BAAS,CAAA;IACT;;OAEG;IACH,2BAAS,CAAA;AACX,CAAC,EAbW,cAAc,8BAAd,cAAc,QAazB","sourcesContent":["import type { PressableProps, StyleProp, ViewStyle } from 'react-native';\n\nimport type { IconProps, IconName } from '../Icon';\n\nexport enum ButtonIconSize {\n /**\n * Represents a small button size (24px).\n */\n Sm = '24',\n /**\n * Represents a medium button size (32px).\n */\n Md = '32',\n /**\n * Represents a large button size (40px).\n */\n Lg = '40',\n}\n\n/**\n * ButtonIcon component props.\n */\nexport type ButtonIconProps = {\n /**\n * Optional prop to control the size of the icon\n * Different sizes map to specific pixel dimensions\n * @default IconSize.Md\n */\n size?: ButtonIconSize;\n /**\n * Optional prop to specify an icon to show\n */\n iconName: IconName;\n /**\n * Optional prop to pass additional properties to the icon\n */\n iconProps?: Partial<IconProps>;\n /**\n * Optional prop that when true, disables the button\n * @default false\n */\n isDisabled?: boolean;\n /**\n * Optional prop to show the inverse state of the button, which is reserved for buttons on colored backgrounds.\n * @default false\n */\n isInverse?: boolean;\n /**\n * Optional prop to show the floating/contained state of the button, which is reserved for floating buttons.\n * Note: This prop provides styling only. There is no positioning logic.\n * @default false\n */\n isFloating?: boolean;\n /**\n * Optional prop to add twrnc overriding classNames.\n */\n twClassName?: string;\n /**\n * Optional prop to control the style.\n */\n style?: StyleProp<ViewStyle>;\n} & Omit<PressableProps, 'children'>;\n"]}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { IconColor } from '../Icon';
|
|
2
|
+
import type { ButtonIconProps } from './ButtonIcon.types';
|
|
3
|
+
/**
|
|
4
|
+
* Generates a Tailwind class name string for the icon button container.
|
|
5
|
+
*
|
|
6
|
+
* This function constructs a class name string based on the button icon's `size`,
|
|
7
|
+
* `isDisabled`, `isPressed`, `isFloating`, and optional additional Tailwind class names.
|
|
8
|
+
*
|
|
9
|
+
* @param isDisabled - Determines whether the button is disabled, affecting opacity.
|
|
10
|
+
* @param isPressed - Determines whether the button is pressed, affecting background color.
|
|
11
|
+
* @param isFloating - Determines whether the button should have a floating, rounded appearance.
|
|
12
|
+
* @param size - The size of the button in pixels.
|
|
13
|
+
* @param twClassName - Additional Tailwind class names for customization.
|
|
14
|
+
* @returns A string of Tailwind class names representing the button icon's container styles.
|
|
15
|
+
*
|
|
16
|
+
* Example:
|
|
17
|
+
* ```
|
|
18
|
+
* const classNames = generateButtonIconContainerClassNames({
|
|
19
|
+
* isDisabled: true,
|
|
20
|
+
* isPressed: false,
|
|
21
|
+
* isFloating: true,
|
|
22
|
+
* size: 48,
|
|
23
|
+
* twClassName: 'border border-blue-500',
|
|
24
|
+
* });
|
|
25
|
+
*
|
|
26
|
+
* console.log(classNames);
|
|
27
|
+
* // Output: "items-center justify-center rounded-full h-[48px] w-[48px] bg-icon-default opacity-50 border border-blue-500"
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare const generateButtonIconContainerClassNames: ({ isDisabled, isPressed, isFloating, size, twClassName, }: Partial<ButtonIconProps> & {
|
|
31
|
+
isPressed?: boolean | undefined;
|
|
32
|
+
}) => string;
|
|
33
|
+
/**
|
|
34
|
+
* Generates a Tailwind class name string for the icon color of a button icon.
|
|
35
|
+
*
|
|
36
|
+
* This function determines the appropriate icon color class based on whether
|
|
37
|
+
* the button icon is using an inverse theme or is floating.
|
|
38
|
+
*
|
|
39
|
+
* @param isInverse - Determines if the button icon should use an inverse theme, affecting text color.
|
|
40
|
+
* @param isFloating - Determines if the button icon is floating, affecting text color.
|
|
41
|
+
* @returns A string representing the Tailwind class name for the button icon color.
|
|
42
|
+
*
|
|
43
|
+
* Example:
|
|
44
|
+
* ```
|
|
45
|
+
* const classNames = generateButtonIconIconColorClassNames({
|
|
46
|
+
* isInverse: true,
|
|
47
|
+
* isFloating: false,
|
|
48
|
+
* });
|
|
49
|
+
*
|
|
50
|
+
* console.log(classNames);
|
|
51
|
+
* // Output: "text-primary-inverse"
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export declare const generateButtonIconIconColorClassNames: ({ isInverse, isFloating, }: Partial<ButtonIconProps>) => IconColor;
|
|
55
|
+
//# sourceMappingURL=ButtonIcon.utilities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ButtonIcon.utilities.d.ts","sourceRoot":"","sources":["../../../src/components/ButtonIcon/ButtonIcon.utilities.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAE1D;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,qCAAqC;;MAQ9C,MAgBH,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,qCAAqC,+BAG/C,QAAQ,eAAe,CAAC,KAAG,SAK7B,CAAC"}
|