@metamask-previews/design-system-react 0.11.0-preview.fa05289 → 0.13.0-preview.8028c20
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 +26 -1
- package/dist/components/AvatarBase/AvatarBase.cjs +3 -3
- package/dist/components/AvatarBase/AvatarBase.cjs.map +1 -1
- package/dist/components/AvatarBase/AvatarBase.constants.cjs +21 -21
- package/dist/components/AvatarBase/AvatarBase.constants.cjs.map +1 -1
- package/dist/components/AvatarBase/AvatarBase.constants.d.cts +1 -1
- package/dist/components/AvatarBase/AvatarBase.constants.d.cts.map +1 -1
- package/dist/components/AvatarBase/AvatarBase.constants.d.mts +1 -1
- package/dist/components/AvatarBase/AvatarBase.constants.d.mts.map +1 -1
- package/dist/components/AvatarBase/AvatarBase.constants.mjs +1 -1
- package/dist/components/AvatarBase/AvatarBase.constants.mjs.map +1 -1
- package/dist/components/AvatarBase/AvatarBase.d.cts.map +1 -1
- package/dist/components/AvatarBase/AvatarBase.d.mts.map +1 -1
- package/dist/components/AvatarBase/AvatarBase.mjs +1 -1
- package/dist/components/AvatarBase/AvatarBase.mjs.map +1 -1
- package/dist/components/AvatarBase/AvatarBase.types.cjs.map +1 -1
- package/dist/components/AvatarBase/AvatarBase.types.d.cts +4 -42
- package/dist/components/AvatarBase/AvatarBase.types.d.cts.map +1 -1
- package/dist/components/AvatarBase/AvatarBase.types.d.mts +4 -42
- package/dist/components/AvatarBase/AvatarBase.types.d.mts.map +1 -1
- package/dist/components/AvatarBase/AvatarBase.types.mjs.map +1 -1
- package/dist/components/AvatarBase/index.cjs +3 -3
- package/dist/components/AvatarBase/index.cjs.map +1 -1
- package/dist/components/AvatarBase/index.d.cts +1 -1
- package/dist/components/AvatarBase/index.d.cts.map +1 -1
- package/dist/components/AvatarBase/index.d.mts +1 -1
- package/dist/components/AvatarBase/index.d.mts.map +1 -1
- package/dist/components/AvatarBase/index.mjs +1 -1
- package/dist/components/AvatarBase/index.mjs.map +1 -1
- package/dist/components/AvatarNetwork/AvatarNetwork.types.cjs.map +1 -1
- package/dist/components/AvatarNetwork/AvatarNetwork.types.d.cts +8 -13
- package/dist/components/AvatarNetwork/AvatarNetwork.types.d.cts.map +1 -1
- package/dist/components/AvatarNetwork/AvatarNetwork.types.d.mts +8 -13
- package/dist/components/AvatarNetwork/AvatarNetwork.types.d.mts.map +1 -1
- package/dist/components/AvatarNetwork/AvatarNetwork.types.mjs.map +1 -1
- package/dist/components/BadgeWrapper/BadgeWrapper.cjs +8 -8
- package/dist/components/BadgeWrapper/BadgeWrapper.cjs.map +1 -1
- package/dist/components/BadgeWrapper/BadgeWrapper.d.cts.map +1 -1
- package/dist/components/BadgeWrapper/BadgeWrapper.d.mts.map +1 -1
- package/dist/components/BadgeWrapper/BadgeWrapper.mjs +1 -1
- package/dist/components/BadgeWrapper/BadgeWrapper.mjs.map +1 -1
- package/dist/components/BadgeWrapper/BadgeWrapper.types.cjs.map +1 -1
- package/dist/components/BadgeWrapper/BadgeWrapper.types.d.cts +4 -51
- package/dist/components/BadgeWrapper/BadgeWrapper.types.d.cts.map +1 -1
- package/dist/components/BadgeWrapper/BadgeWrapper.types.d.mts +4 -51
- package/dist/components/BadgeWrapper/BadgeWrapper.types.d.mts.map +1 -1
- package/dist/components/BadgeWrapper/BadgeWrapper.types.mjs.map +1 -1
- package/dist/components/BadgeWrapper/index.cjs +3 -3
- package/dist/components/BadgeWrapper/index.cjs.map +1 -1
- package/dist/components/BadgeWrapper/index.d.cts +1 -2
- package/dist/components/BadgeWrapper/index.d.cts.map +1 -1
- package/dist/components/BadgeWrapper/index.d.mts +1 -2
- package/dist/components/BadgeWrapper/index.d.mts.map +1 -1
- package/dist/components/BadgeWrapper/index.mjs +1 -1
- package/dist/components/BadgeWrapper/index.mjs.map +1 -1
- package/dist/components/Button/variants/ButtonPrimary/ButtonPrimary.cjs +3 -3
- package/dist/components/Button/variants/ButtonPrimary/ButtonPrimary.cjs.map +1 -1
- package/dist/components/Button/variants/ButtonPrimary/ButtonPrimary.mjs +3 -3
- package/dist/components/Button/variants/ButtonPrimary/ButtonPrimary.mjs.map +1 -1
- package/dist/components/Button/variants/ButtonSecondary/ButtonSecondary.cjs +3 -3
- package/dist/components/Button/variants/ButtonSecondary/ButtonSecondary.cjs.map +1 -1
- package/dist/components/Button/variants/ButtonSecondary/ButtonSecondary.mjs +3 -3
- package/dist/components/Button/variants/ButtonSecondary/ButtonSecondary.mjs.map +1 -1
- package/dist/components/Button/variants/ButtonTertiary/ButtonTertiary.cjs +3 -3
- package/dist/components/Button/variants/ButtonTertiary/ButtonTertiary.cjs.map +1 -1
- package/dist/components/Button/variants/ButtonTertiary/ButtonTertiary.mjs +3 -3
- package/dist/components/Button/variants/ButtonTertiary/ButtonTertiary.mjs.map +1 -1
- package/dist/components/ButtonHero/ButtonHero.cjs +1 -1
- package/dist/components/ButtonHero/ButtonHero.cjs.map +1 -1
- package/dist/components/ButtonHero/ButtonHero.mjs +1 -1
- package/dist/components/ButtonHero/ButtonHero.mjs.map +1 -1
- package/dist/components/Checkbox/Checkbox.cjs +2 -2
- package/dist/components/Checkbox/Checkbox.cjs.map +1 -1
- package/dist/components/Checkbox/Checkbox.mjs +2 -2
- package/dist/components/Checkbox/Checkbox.mjs.map +1 -1
- package/dist/components/Icon/icons/Candlestick.cjs +1 -1
- package/dist/components/Icon/icons/Candlestick.cjs.map +1 -1
- package/dist/components/Icon/icons/Candlestick.mjs +1 -1
- package/dist/components/Icon/icons/Candlestick.mjs.map +1 -1
- package/dist/components/Input/Input.cjs +1 -1
- package/dist/components/Input/Input.cjs.map +1 -1
- package/dist/components/Input/Input.mjs +1 -1
- package/dist/components/Input/Input.mjs.map +1 -1
- package/dist/components/Text/Text.types.cjs.map +1 -1
- package/dist/components/Text/Text.types.d.cts +1 -1
- package/dist/components/Text/Text.types.d.mts +1 -1
- package/dist/components/Text/Text.types.mjs.map +1 -1
- package/dist/components/TextButton/TextButton.cjs +4 -4
- package/dist/components/TextButton/TextButton.cjs.map +1 -1
- package/dist/components/TextButton/TextButton.mjs +4 -4
- package/dist/components/TextButton/TextButton.mjs.map +1 -1
- package/dist/types/index.cjs +19 -60
- package/dist/types/index.cjs.map +1 -1
- package/dist/types/index.d.cts +9 -72
- package/dist/types/index.d.cts.map +1 -1
- package/dist/types/index.d.mts +9 -72
- package/dist/types/index.d.mts.map +1 -1
- package/dist/types/index.mjs +9 -67
- package/dist/types/index.mjs.map +1 -1
- package/package.json +6 -12
|
@@ -24,10 +24,10 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.BadgeWrapper = void 0;
|
|
27
|
+
const design_system_shared_1 = require("@metamask-previews/design-system-shared");
|
|
27
28
|
const react_1 = __importStar(require("react"));
|
|
28
|
-
const types_1 = require("../../types/index.cjs");
|
|
29
29
|
const tw_merge_1 = require("../../utils/tw-merge.cjs");
|
|
30
|
-
exports.BadgeWrapper = (0, react_1.forwardRef)(({ children, childrenContainerProps, badge, badgeContainerProps, position =
|
|
30
|
+
exports.BadgeWrapper = (0, react_1.forwardRef)(({ children, childrenContainerProps, badge, badgeContainerProps, position = design_system_shared_1.BadgeWrapperPosition.BottomRight, positionAnchorShape = design_system_shared_1.BadgeWrapperPositionAnchorShape.Circular, positionXOffset = 0, positionYOffset = 0, customPosition, className = '', style, ...props }, ref) => {
|
|
31
31
|
const [anchorWidth, setAnchorWidth] = (0, react_1.useState)(0);
|
|
32
32
|
const [anchorHeight, setAnchorHeight] = (0, react_1.useState)(0);
|
|
33
33
|
const [badgeWidth, setBadgeWidth] = (0, react_1.useState)(0);
|
|
@@ -51,10 +51,10 @@ exports.BadgeWrapper = (0, react_1.forwardRef)(({ children, childrenContainerPro
|
|
|
51
51
|
if (customPosition) {
|
|
52
52
|
return customPosition;
|
|
53
53
|
}
|
|
54
|
-
const anchorShapeXOffset = positionAnchorShape ===
|
|
54
|
+
const anchorShapeXOffset = positionAnchorShape === design_system_shared_1.BadgeWrapperPositionAnchorShape.Rectangular
|
|
55
55
|
? 0
|
|
56
56
|
: anchorWidth * 0.1464;
|
|
57
|
-
const anchorShapeYOffset = positionAnchorShape ===
|
|
57
|
+
const anchorShapeYOffset = positionAnchorShape === design_system_shared_1.BadgeWrapperPositionAnchorShape.Rectangular
|
|
58
58
|
? 0
|
|
59
59
|
: anchorHeight * 0.1464;
|
|
60
60
|
const badgeCenteringXOffset = badgeWidth / 2;
|
|
@@ -62,13 +62,13 @@ exports.BadgeWrapper = (0, react_1.forwardRef)(({ children, childrenContainerPro
|
|
|
62
62
|
const finalXOffset = anchorShapeXOffset - badgeCenteringXOffset + positionXOffset;
|
|
63
63
|
const finalYOffset = anchorShapeYOffset - badgeCenteringYOffset + positionYOffset;
|
|
64
64
|
switch (position) {
|
|
65
|
-
case
|
|
65
|
+
case design_system_shared_1.BadgeWrapperPosition.TopRight:
|
|
66
66
|
return { top: finalYOffset, right: finalXOffset };
|
|
67
|
-
case
|
|
67
|
+
case design_system_shared_1.BadgeWrapperPosition.TopLeft:
|
|
68
68
|
return { top: finalYOffset, left: finalXOffset };
|
|
69
|
-
case
|
|
69
|
+
case design_system_shared_1.BadgeWrapperPosition.BottomLeft:
|
|
70
70
|
return { bottom: finalYOffset, left: finalXOffset };
|
|
71
|
-
case
|
|
71
|
+
case design_system_shared_1.BadgeWrapperPosition.BottomRight:
|
|
72
72
|
default:
|
|
73
73
|
return { bottom: finalYOffset, right: finalXOffset };
|
|
74
74
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BadgeWrapper.cjs","sourceRoot":"","sources":["../../../src/components/BadgeWrapper/BadgeWrapper.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"BadgeWrapper.cjs","sourceRoot":"","sources":["../../../src/components/BadgeWrapper/BadgeWrapper.tsx"],"names":[],"mappings":"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","sourcesContent":["import {\n BadgeWrapperPosition,\n BadgeWrapperPositionAnchorShape,\n} from '@metamask-previews/design-system-shared';\nimport type { CSSProperties } from 'react';\nimport React, {\n forwardRef,\n useState,\n useLayoutEffect,\n useMemo,\n useRef,\n} from 'react';\n\nimport { twMerge } from '../../utils/tw-merge';\n\nimport type { BadgeWrapperProps } from './BadgeWrapper.types';\n\nexport const BadgeWrapper = forwardRef<HTMLDivElement, BadgeWrapperProps>(\n (\n {\n children,\n childrenContainerProps,\n badge,\n badgeContainerProps,\n position = BadgeWrapperPosition.BottomRight,\n positionAnchorShape = BadgeWrapperPositionAnchorShape.Circular,\n positionXOffset = 0,\n positionYOffset = 0,\n customPosition,\n className = '',\n style,\n ...props\n },\n ref,\n ) => {\n const [anchorWidth, setAnchorWidth] = useState(0);\n const [anchorHeight, setAnchorHeight] = useState(0);\n const [badgeWidth, setBadgeWidth] = useState(0);\n const [badgeHeight, setBadgeHeight] = useState(0);\n\n const anchorRef = useRef<HTMLDivElement | null>(null);\n const badgeRef = useRef<HTMLDivElement | null>(null);\n\n // Measure both elements once on mount\n useLayoutEffect(() => {\n if (anchorRef.current) {\n const { width, height } = anchorRef.current.getBoundingClientRect();\n setAnchorWidth(width);\n setAnchorHeight(height);\n }\n if (badgeRef.current) {\n const { width, height } = badgeRef.current.getBoundingClientRect();\n setBadgeWidth(width);\n setBadgeHeight(height);\n }\n }, []); // empty deps → run only after first render\n\n const finalPositions = useMemo<React.CSSProperties>(() => {\n if (customPosition) {\n return customPosition as CSSProperties;\n }\n\n const anchorShapeXOffset =\n positionAnchorShape === BadgeWrapperPositionAnchorShape.Rectangular\n ? 0\n : anchorWidth * 0.1464;\n const anchorShapeYOffset =\n positionAnchorShape === BadgeWrapperPositionAnchorShape.Rectangular\n ? 0\n : anchorHeight * 0.1464;\n\n const badgeCenteringXOffset = badgeWidth / 2;\n const badgeCenteringYOffset = badgeHeight / 2;\n\n const finalXOffset =\n anchorShapeXOffset - badgeCenteringXOffset + positionXOffset;\n const finalYOffset =\n anchorShapeYOffset - badgeCenteringYOffset + positionYOffset;\n\n switch (position) {\n case BadgeWrapperPosition.TopRight:\n return { top: finalYOffset, right: finalXOffset };\n case BadgeWrapperPosition.TopLeft:\n return { top: finalYOffset, left: finalXOffset };\n case BadgeWrapperPosition.BottomLeft:\n return { bottom: finalYOffset, left: finalXOffset };\n case BadgeWrapperPosition.BottomRight:\n default:\n return { bottom: finalYOffset, right: finalXOffset };\n }\n }, [\n position,\n positionAnchorShape,\n anchorWidth,\n anchorHeight,\n badgeWidth,\n badgeHeight,\n positionXOffset,\n positionYOffset,\n customPosition,\n ]);\n\n const containerClassName = twMerge(\n 'relative inline-flex self-start',\n className,\n );\n\n return (\n <div ref={ref} className={containerClassName} style={style} {...props}>\n <div\n className=\"inline-flex\"\n ref={anchorRef}\n {...childrenContainerProps}\n >\n {children}\n </div>\n\n <div\n ref={badgeRef}\n className=\"absolute\"\n style={finalPositions}\n {...badgeContainerProps}\n >\n {badge}\n </div>\n </div>\n );\n },\n);\n\nBadgeWrapper.displayName = 'BadgeWrapper';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BadgeWrapper.d.cts","sourceRoot":"","sources":["../../../src/components/BadgeWrapper/BadgeWrapper.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BadgeWrapper.d.cts","sourceRoot":"","sources":["../../../src/components/BadgeWrapper/BadgeWrapper.tsx"],"names":[],"mappings":"AAKA,OAAO,KAMN,cAAc;AAIf,OAAO,KAAK,EAAE,iBAAiB,EAAE,iCAA6B;AAE9D,eAAO,MAAM,YAAY,uGA+GxB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BadgeWrapper.d.mts","sourceRoot":"","sources":["../../../src/components/BadgeWrapper/BadgeWrapper.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BadgeWrapper.d.mts","sourceRoot":"","sources":["../../../src/components/BadgeWrapper/BadgeWrapper.tsx"],"names":[],"mappings":"AAKA,OAAO,KAMN,cAAc;AAIf,OAAO,KAAK,EAAE,iBAAiB,EAAE,iCAA6B;AAE9D,eAAO,MAAM,YAAY,uGA+GxB,CAAC"}
|
|
@@ -4,9 +4,9 @@ function $importDefault(module) {
|
|
|
4
4
|
}
|
|
5
5
|
return module;
|
|
6
6
|
}
|
|
7
|
+
import { BadgeWrapperPosition, BadgeWrapperPositionAnchorShape } from "@metamask-previews/design-system-shared";
|
|
7
8
|
import $React, { forwardRef, useState, useLayoutEffect, useMemo, useRef } from "react";
|
|
8
9
|
const React = $importDefault($React);
|
|
9
|
-
import { BadgeWrapperPosition, BadgeWrapperPositionAnchorShape } from "../../types/index.mjs";
|
|
10
10
|
import { twMerge } from "../../utils/tw-merge.mjs";
|
|
11
11
|
export const BadgeWrapper = forwardRef(({ children, childrenContainerProps, badge, badgeContainerProps, position = BadgeWrapperPosition.BottomRight, positionAnchorShape = BadgeWrapperPositionAnchorShape.Circular, positionXOffset = 0, positionYOffset = 0, customPosition, className = '', style, ...props }, ref) => {
|
|
12
12
|
const [anchorWidth, setAnchorWidth] = useState(0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BadgeWrapper.mjs","sourceRoot":"","sources":["../../../src/components/BadgeWrapper/BadgeWrapper.tsx"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"BadgeWrapper.mjs","sourceRoot":"","sources":["../../../src/components/BadgeWrapper/BadgeWrapper.tsx"],"names":[],"mappings":"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","sourcesContent":["import {\n BadgeWrapperPosition,\n BadgeWrapperPositionAnchorShape,\n} from '@metamask-previews/design-system-shared';\nimport type { CSSProperties } from 'react';\nimport React, {\n forwardRef,\n useState,\n useLayoutEffect,\n useMemo,\n useRef,\n} from 'react';\n\nimport { twMerge } from '../../utils/tw-merge';\n\nimport type { BadgeWrapperProps } from './BadgeWrapper.types';\n\nexport const BadgeWrapper = forwardRef<HTMLDivElement, BadgeWrapperProps>(\n (\n {\n children,\n childrenContainerProps,\n badge,\n badgeContainerProps,\n position = BadgeWrapperPosition.BottomRight,\n positionAnchorShape = BadgeWrapperPositionAnchorShape.Circular,\n positionXOffset = 0,\n positionYOffset = 0,\n customPosition,\n className = '',\n style,\n ...props\n },\n ref,\n ) => {\n const [anchorWidth, setAnchorWidth] = useState(0);\n const [anchorHeight, setAnchorHeight] = useState(0);\n const [badgeWidth, setBadgeWidth] = useState(0);\n const [badgeHeight, setBadgeHeight] = useState(0);\n\n const anchorRef = useRef<HTMLDivElement | null>(null);\n const badgeRef = useRef<HTMLDivElement | null>(null);\n\n // Measure both elements once on mount\n useLayoutEffect(() => {\n if (anchorRef.current) {\n const { width, height } = anchorRef.current.getBoundingClientRect();\n setAnchorWidth(width);\n setAnchorHeight(height);\n }\n if (badgeRef.current) {\n const { width, height } = badgeRef.current.getBoundingClientRect();\n setBadgeWidth(width);\n setBadgeHeight(height);\n }\n }, []); // empty deps → run only after first render\n\n const finalPositions = useMemo<React.CSSProperties>(() => {\n if (customPosition) {\n return customPosition as CSSProperties;\n }\n\n const anchorShapeXOffset =\n positionAnchorShape === BadgeWrapperPositionAnchorShape.Rectangular\n ? 0\n : anchorWidth * 0.1464;\n const anchorShapeYOffset =\n positionAnchorShape === BadgeWrapperPositionAnchorShape.Rectangular\n ? 0\n : anchorHeight * 0.1464;\n\n const badgeCenteringXOffset = badgeWidth / 2;\n const badgeCenteringYOffset = badgeHeight / 2;\n\n const finalXOffset =\n anchorShapeXOffset - badgeCenteringXOffset + positionXOffset;\n const finalYOffset =\n anchorShapeYOffset - badgeCenteringYOffset + positionYOffset;\n\n switch (position) {\n case BadgeWrapperPosition.TopRight:\n return { top: finalYOffset, right: finalXOffset };\n case BadgeWrapperPosition.TopLeft:\n return { top: finalYOffset, left: finalXOffset };\n case BadgeWrapperPosition.BottomLeft:\n return { bottom: finalYOffset, left: finalXOffset };\n case BadgeWrapperPosition.BottomRight:\n default:\n return { bottom: finalYOffset, right: finalXOffset };\n }\n }, [\n position,\n positionAnchorShape,\n anchorWidth,\n anchorHeight,\n badgeWidth,\n badgeHeight,\n positionXOffset,\n positionYOffset,\n customPosition,\n ]);\n\n const containerClassName = twMerge(\n 'relative inline-flex self-start',\n className,\n );\n\n return (\n <div ref={ref} className={containerClassName} style={style} {...props}>\n <div\n className=\"inline-flex\"\n ref={anchorRef}\n {...childrenContainerProps}\n >\n {children}\n </div>\n\n <div\n ref={badgeRef}\n className=\"absolute\"\n style={finalPositions}\n {...badgeContainerProps}\n >\n {badge}\n </div>\n </div>\n );\n },\n);\n\nBadgeWrapper.displayName = 'BadgeWrapper';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BadgeWrapper.types.cjs","sourceRoot":"","sources":["../../../src/components/BadgeWrapper/BadgeWrapper.types.ts"],"names":[],"mappings":"","sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"BadgeWrapper.types.cjs","sourceRoot":"","sources":["../../../src/components/BadgeWrapper/BadgeWrapper.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { BadgeWrapperPropsShared } from '@metamask-previews/design-system-shared';\nimport type { ComponentProps } from 'react';\n\n/**\n * BadgeWrapper component props (React platform-specific)\n * Extends shared props from @metamask-previews/design-system-shared with React-specific platform concerns\n */\nexport type BadgeWrapperProps = BadgeWrapperPropsShared & {\n /**\n * Optional prop to pass additional props to the children container\n */\n childrenContainerProps?: ComponentProps<'div'>;\n /**\n * Optional prop to pass additional props to the badge container\n */\n badgeContainerProps?: ComponentProps<'div'>;\n /**\n * Optional prop for additional CSS classes to be applied to the BadgeWrapper component.\n * These classes will be merged with the component's default classes using twMerge.\n */\n className?: string;\n /**\n * Optional prop to control the style.\n */\n style?: React.CSSProperties;\n /**\n * Optional prop to add a test id to the BadgeWrapper\n */\n 'data-testid'?: string;\n} & ComponentProps<'div'>;\n"]}
|
|
@@ -1,61 +1,14 @@
|
|
|
1
|
+
import type { BadgeWrapperPropsShared } from "@metamask-previews/design-system-shared";
|
|
1
2
|
import type { ComponentProps } from "react";
|
|
2
|
-
import type { BadgeWrapperPosition, BadgeWrapperCustomPosition, BadgeWrapperPositionAnchorShape } from "../../types/index.cjs";
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* BadgeWrapper component props (React platform-specific)
|
|
5
|
+
* Extends shared props from @metamask-previews/design-system-shared with React-specific platform concerns
|
|
5
6
|
*/
|
|
6
|
-
export type BadgeWrapperProps = {
|
|
7
|
-
/**
|
|
8
|
-
* Optional prop to determine the shape of the anchoring element.
|
|
9
|
-
* This prop gets used along with position, positionXOffset, and positionYOffset
|
|
10
|
-
* to determine the final position.
|
|
11
|
-
* Possible values:
|
|
12
|
-
* BadgeWrapperPositionAnchorShape.Circular,
|
|
13
|
-
* - BadgeWrapperPositionAnchorShape.Rectangular,
|
|
14
|
-
*
|
|
15
|
-
* @default BadgeWrapperPositionAnchorShape.Circular
|
|
16
|
-
*/
|
|
17
|
-
positionAnchorShape?: BadgeWrapperPositionAnchorShape;
|
|
18
|
-
/**
|
|
19
|
-
* Optional prop to control the preset position of the badge.
|
|
20
|
-
* This prop gets used along with positionAnchorShape, positionXOffset, and positionYOffset
|
|
21
|
-
* to determine the final position.
|
|
22
|
-
*
|
|
23
|
-
* @default BadgeWrapperPosition.TopRight
|
|
24
|
-
*/
|
|
25
|
-
position?: BadgeWrapperPosition;
|
|
26
|
-
/**
|
|
27
|
-
* Optional prop to move the preset position horizontally.
|
|
28
|
-
* This prop gets used along with position, positionAnchorShape, and positionYOffset
|
|
29
|
-
* to determine the final position.
|
|
30
|
-
*
|
|
31
|
-
* @default 0
|
|
32
|
-
*/
|
|
33
|
-
positionXOffset?: number;
|
|
34
|
-
/**
|
|
35
|
-
* Optional prop to move the preset position vertically.
|
|
36
|
-
* This prop gets used along with position, positionAnchorShape, and positionXOffset
|
|
37
|
-
* to determine the final position.
|
|
38
|
-
*
|
|
39
|
-
* @default 0
|
|
40
|
-
*/
|
|
41
|
-
positionYOffset?: number;
|
|
42
|
-
/**
|
|
43
|
-
* Optional prop to customize the position through the position object.
|
|
44
|
-
* Position object - {top: 0, right: 0, bottom: 0, left: 0}
|
|
45
|
-
*/
|
|
46
|
-
customPosition?: BadgeWrapperCustomPosition;
|
|
47
|
-
/**
|
|
48
|
-
* The element that the badge will attach itself to.
|
|
49
|
-
*/
|
|
50
|
-
children: React.ReactNode;
|
|
7
|
+
export type BadgeWrapperProps = BadgeWrapperPropsShared & {
|
|
51
8
|
/**
|
|
52
9
|
* Optional prop to pass additional props to the children container
|
|
53
10
|
*/
|
|
54
11
|
childrenContainerProps?: ComponentProps<'div'>;
|
|
55
|
-
/**
|
|
56
|
-
* Any element that will be placed in the position of the badge.
|
|
57
|
-
*/
|
|
58
|
-
badge: React.ReactNode;
|
|
59
12
|
/**
|
|
60
13
|
* Optional prop to pass additional props to the badge container
|
|
61
14
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BadgeWrapper.types.d.cts","sourceRoot":"","sources":["../../../src/components/BadgeWrapper/BadgeWrapper.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"BadgeWrapper.types.d.cts","sourceRoot":"","sources":["../../../src/components/BadgeWrapper/BadgeWrapper.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,gDAAgD;AACvF,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc;AAE5C;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,uBAAuB,GAAG;IACxD;;OAEG;IACH,sBAAsB,CAAC,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC;IAC/C;;OAEG;IACH,mBAAmB,CAAC,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC;IAC5C;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC"}
|
|
@@ -1,61 +1,14 @@
|
|
|
1
|
+
import type { BadgeWrapperPropsShared } from "@metamask-previews/design-system-shared";
|
|
1
2
|
import type { ComponentProps } from "react";
|
|
2
|
-
import type { BadgeWrapperPosition, BadgeWrapperCustomPosition, BadgeWrapperPositionAnchorShape } from "../../types/index.mjs";
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* BadgeWrapper component props (React platform-specific)
|
|
5
|
+
* Extends shared props from @metamask-previews/design-system-shared with React-specific platform concerns
|
|
5
6
|
*/
|
|
6
|
-
export type BadgeWrapperProps = {
|
|
7
|
-
/**
|
|
8
|
-
* Optional prop to determine the shape of the anchoring element.
|
|
9
|
-
* This prop gets used along with position, positionXOffset, and positionYOffset
|
|
10
|
-
* to determine the final position.
|
|
11
|
-
* Possible values:
|
|
12
|
-
* BadgeWrapperPositionAnchorShape.Circular,
|
|
13
|
-
* - BadgeWrapperPositionAnchorShape.Rectangular,
|
|
14
|
-
*
|
|
15
|
-
* @default BadgeWrapperPositionAnchorShape.Circular
|
|
16
|
-
*/
|
|
17
|
-
positionAnchorShape?: BadgeWrapperPositionAnchorShape;
|
|
18
|
-
/**
|
|
19
|
-
* Optional prop to control the preset position of the badge.
|
|
20
|
-
* This prop gets used along with positionAnchorShape, positionXOffset, and positionYOffset
|
|
21
|
-
* to determine the final position.
|
|
22
|
-
*
|
|
23
|
-
* @default BadgeWrapperPosition.TopRight
|
|
24
|
-
*/
|
|
25
|
-
position?: BadgeWrapperPosition;
|
|
26
|
-
/**
|
|
27
|
-
* Optional prop to move the preset position horizontally.
|
|
28
|
-
* This prop gets used along with position, positionAnchorShape, and positionYOffset
|
|
29
|
-
* to determine the final position.
|
|
30
|
-
*
|
|
31
|
-
* @default 0
|
|
32
|
-
*/
|
|
33
|
-
positionXOffset?: number;
|
|
34
|
-
/**
|
|
35
|
-
* Optional prop to move the preset position vertically.
|
|
36
|
-
* This prop gets used along with position, positionAnchorShape, and positionXOffset
|
|
37
|
-
* to determine the final position.
|
|
38
|
-
*
|
|
39
|
-
* @default 0
|
|
40
|
-
*/
|
|
41
|
-
positionYOffset?: number;
|
|
42
|
-
/**
|
|
43
|
-
* Optional prop to customize the position through the position object.
|
|
44
|
-
* Position object - {top: 0, right: 0, bottom: 0, left: 0}
|
|
45
|
-
*/
|
|
46
|
-
customPosition?: BadgeWrapperCustomPosition;
|
|
47
|
-
/**
|
|
48
|
-
* The element that the badge will attach itself to.
|
|
49
|
-
*/
|
|
50
|
-
children: React.ReactNode;
|
|
7
|
+
export type BadgeWrapperProps = BadgeWrapperPropsShared & {
|
|
51
8
|
/**
|
|
52
9
|
* Optional prop to pass additional props to the children container
|
|
53
10
|
*/
|
|
54
11
|
childrenContainerProps?: ComponentProps<'div'>;
|
|
55
|
-
/**
|
|
56
|
-
* Any element that will be placed in the position of the badge.
|
|
57
|
-
*/
|
|
58
|
-
badge: React.ReactNode;
|
|
59
12
|
/**
|
|
60
13
|
* Optional prop to pass additional props to the badge container
|
|
61
14
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BadgeWrapper.types.d.mts","sourceRoot":"","sources":["../../../src/components/BadgeWrapper/BadgeWrapper.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"BadgeWrapper.types.d.mts","sourceRoot":"","sources":["../../../src/components/BadgeWrapper/BadgeWrapper.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,gDAAgD;AACvF,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc;AAE5C;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,uBAAuB,GAAG;IACxD;;OAEG;IACH,sBAAsB,CAAC,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC;IAC/C;;OAEG;IACH,mBAAmB,CAAC,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC;IAC5C;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BadgeWrapper.types.mjs","sourceRoot":"","sources":["../../../src/components/BadgeWrapper/BadgeWrapper.types.ts"],"names":[],"mappings":"","sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"BadgeWrapper.types.mjs","sourceRoot":"","sources":["../../../src/components/BadgeWrapper/BadgeWrapper.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { BadgeWrapperPropsShared } from '@metamask-previews/design-system-shared';\nimport type { ComponentProps } from 'react';\n\n/**\n * BadgeWrapper component props (React platform-specific)\n * Extends shared props from @metamask-previews/design-system-shared with React-specific platform concerns\n */\nexport type BadgeWrapperProps = BadgeWrapperPropsShared & {\n /**\n * Optional prop to pass additional props to the children container\n */\n childrenContainerProps?: ComponentProps<'div'>;\n /**\n * Optional prop to pass additional props to the badge container\n */\n badgeContainerProps?: ComponentProps<'div'>;\n /**\n * Optional prop for additional CSS classes to be applied to the BadgeWrapper component.\n * These classes will be merged with the component's default classes using twMerge.\n */\n className?: string;\n /**\n * Optional prop to control the style.\n */\n style?: React.CSSProperties;\n /**\n * Optional prop to add a test id to the BadgeWrapper\n */\n 'data-testid'?: string;\n} & ComponentProps<'div'>;\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BadgeWrapper = exports.BadgeWrapperPositionAnchorShape = exports.BadgeWrapperPosition = void 0;
|
|
4
|
-
var
|
|
5
|
-
Object.defineProperty(exports, "BadgeWrapperPosition", { enumerable: true, get: function () { return
|
|
6
|
-
Object.defineProperty(exports, "BadgeWrapperPositionAnchorShape", { enumerable: true, get: function () { return
|
|
4
|
+
var design_system_shared_1 = require("@metamask-previews/design-system-shared");
|
|
5
|
+
Object.defineProperty(exports, "BadgeWrapperPosition", { enumerable: true, get: function () { return design_system_shared_1.BadgeWrapperPosition; } });
|
|
6
|
+
Object.defineProperty(exports, "BadgeWrapperPositionAnchorShape", { enumerable: true, get: function () { return design_system_shared_1.BadgeWrapperPositionAnchorShape; } });
|
|
7
7
|
var BadgeWrapper_1 = require("./BadgeWrapper.cjs");
|
|
8
8
|
Object.defineProperty(exports, "BadgeWrapper", { enumerable: true, get: function () { return BadgeWrapper_1.BadgeWrapper; } });
|
|
9
9
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../src/components/BadgeWrapper/index.ts"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../src/components/BadgeWrapper/index.ts"],"names":[],"mappings":";;;AAAA,gFAIiD;AAH/C,4HAAA,oBAAoB,OAAA;AACpB,uIAAA,+BAA+B,OAAA;AAGjC,mDAA8C;AAArC,4GAAA,YAAY,OAAA","sourcesContent":["export {\n BadgeWrapperPosition,\n BadgeWrapperPositionAnchorShape,\n type BadgeWrapperCustomPosition,\n} from '@metamask-previews/design-system-shared';\nexport { BadgeWrapper } from './BadgeWrapper';\nexport type { BadgeWrapperProps } from './BadgeWrapper.types';\n"]}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
export { BadgeWrapperPosition, BadgeWrapperPositionAnchorShape, } from "
|
|
2
|
-
export type { BadgeWrapperCustomPosition } from "../../types/index.cjs";
|
|
1
|
+
export { BadgeWrapperPosition, BadgeWrapperPositionAnchorShape, type BadgeWrapperCustomPosition, } from "@metamask-previews/design-system-shared";
|
|
3
2
|
export { BadgeWrapper } from "./BadgeWrapper.cjs";
|
|
4
3
|
export type { BadgeWrapperProps } from "./BadgeWrapper.types.cjs";
|
|
5
4
|
//# sourceMappingURL=index.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/components/BadgeWrapper/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,+BAA+B,
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/components/BadgeWrapper/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,+BAA+B,EAC/B,KAAK,0BAA0B,GAChC,gDAAgD;AACjD,OAAO,EAAE,YAAY,EAAE,2BAAuB;AAC9C,YAAY,EAAE,iBAAiB,EAAE,iCAA6B"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
export { BadgeWrapperPosition, BadgeWrapperPositionAnchorShape, } from "
|
|
2
|
-
export type { BadgeWrapperCustomPosition } from "../../types/index.mjs";
|
|
1
|
+
export { BadgeWrapperPosition, BadgeWrapperPositionAnchorShape, type BadgeWrapperCustomPosition, } from "@metamask-previews/design-system-shared";
|
|
3
2
|
export { BadgeWrapper } from "./BadgeWrapper.mjs";
|
|
4
3
|
export type { BadgeWrapperProps } from "./BadgeWrapper.types.mjs";
|
|
5
4
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/components/BadgeWrapper/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,+BAA+B,
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/components/BadgeWrapper/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,+BAA+B,EAC/B,KAAK,0BAA0B,GAChC,gDAAgD;AACjD,OAAO,EAAE,YAAY,EAAE,2BAAuB;AAC9C,YAAY,EAAE,iBAAiB,EAAE,iCAA6B"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { BadgeWrapperPosition, BadgeWrapperPositionAnchorShape } from "
|
|
1
|
+
export { BadgeWrapperPosition, BadgeWrapperPositionAnchorShape } from "@metamask-previews/design-system-shared";
|
|
2
2
|
export { BadgeWrapper } from "./BadgeWrapper.mjs";
|
|
3
3
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/components/BadgeWrapper/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,+BAA+B,
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/components/BadgeWrapper/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,+BAA+B,EAEhC,gDAAgD;AACjD,OAAO,EAAE,YAAY,EAAE,2BAAuB","sourcesContent":["export {\n BadgeWrapperPosition,\n BadgeWrapperPositionAnchorShape,\n type BadgeWrapperCustomPosition,\n} from '@metamask-previews/design-system-shared';\nexport { BadgeWrapper } from './BadgeWrapper';\nexport type { BadgeWrapperProps } from './BadgeWrapper.types';\n"]}
|
|
@@ -74,9 +74,9 @@ exports.ButtonPrimary = (0, react_1.forwardRef)(({ className, isDanger, isInvers
|
|
|
74
74
|
!isDanger && ['hover:bg-default-hover', 'active:bg-default-pressed'],
|
|
75
75
|
isInverse &&
|
|
76
76
|
isDanger && ['hover:bg-default-hover', 'active:bg-default-pressed'],
|
|
77
|
-
], 'focus-visible:ring-0', isInverse
|
|
78
|
-
? 'focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-background-default'
|
|
79
|
-
: 'focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-default',
|
|
77
|
+
], 'focus-visible:outline-none focus-visible:ring-0', isInverse
|
|
78
|
+
? 'focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-background-default'
|
|
79
|
+
: 'focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-default',
|
|
80
80
|
// Loading styles
|
|
81
81
|
isLoading && 'cursor-not-allowed',
|
|
82
82
|
// Disabled styles (but not loading)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonPrimary.cjs","sourceRoot":"","sources":["../../../../../src/components/Button/variants/ButtonPrimary/ButtonPrimary.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA0C;AAE1C,6DAAqD;AACrD,8DAAiD;AAIpC,QAAA,aAAa,GAAG,IAAA,kBAAU,EACrC,CACE,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EACnE,GAAG,EACH,EAAE;IACF,MAAM,aAAa,GAAG,CAAC,CAAC,UAAU,IAAI,SAAS,CAAC,CAAC;IAEjD,MAAM,eAAe,GAAG,IAAA,kBAAO;IAC7B,yBAAyB;IACzB,CAAC,QAAQ;QACP,CAAC,SAAS,IAAI;QACZ,sCAAsC;QACtC,mCAAmC;QACnC,SAAS,IAAI,yBAAyB;KACvC;IACH,gBAAgB;IAChB,QAAQ;QACN,CAAC,SAAS,IAAI;QACZ,qCAAqC;QACrC,mCAAmC;QACnC,SAAS,IAAI,0BAA0B;KACxC;IACH,iBAAiB;IACjB,SAAS;QACP,CAAC,QAAQ,IAAI;QACX,yBAAyB;QACzB,mCAAmC;QACnC,SAAS,IAAI,oBAAoB;KAClC;IACH,wBAAwB;IACxB,SAAS;QACP,QAAQ,IAAI;QACV,+BAA+B;QAC/B,mCAAmC;QACnC,SAAS,IAAI,oBAAoB;KAClC;IACH,sDAAsD;IACtD,aAAa,IAAI;QACf,CAAC,QAAQ;YACP,CAAC,SAAS,IAAI;YACZ,6BAA6B;YAC7B,gCAAgC;SACjC;QACH,QAAQ;YACN,CAAC,SAAS,IAAI;YACZ,8BAA8B;YAC9B,iCAAiC;SAClC;QACH,SAAS;YACP,CAAC,QAAQ,IAAI,CAAC,wBAAwB,EAAE,2BAA2B,CAAC;QACtE,SAAS;YACP,QAAQ,IAAI,CAAC,wBAAwB,EAAE,2BAA2B,CAAC;KACtE,EACD,
|
|
1
|
+
{"version":3,"file":"ButtonPrimary.cjs","sourceRoot":"","sources":["../../../../../src/components/Button/variants/ButtonPrimary/ButtonPrimary.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA0C;AAE1C,6DAAqD;AACrD,8DAAiD;AAIpC,QAAA,aAAa,GAAG,IAAA,kBAAU,EACrC,CACE,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EACnE,GAAG,EACH,EAAE;IACF,MAAM,aAAa,GAAG,CAAC,CAAC,UAAU,IAAI,SAAS,CAAC,CAAC;IAEjD,MAAM,eAAe,GAAG,IAAA,kBAAO;IAC7B,yBAAyB;IACzB,CAAC,QAAQ;QACP,CAAC,SAAS,IAAI;QACZ,sCAAsC;QACtC,mCAAmC;QACnC,SAAS,IAAI,yBAAyB;KACvC;IACH,gBAAgB;IAChB,QAAQ;QACN,CAAC,SAAS,IAAI;QACZ,qCAAqC;QACrC,mCAAmC;QACnC,SAAS,IAAI,0BAA0B;KACxC;IACH,iBAAiB;IACjB,SAAS;QACP,CAAC,QAAQ,IAAI;QACX,yBAAyB;QACzB,mCAAmC;QACnC,SAAS,IAAI,oBAAoB;KAClC;IACH,wBAAwB;IACxB,SAAS;QACP,QAAQ,IAAI;QACV,+BAA+B;QAC/B,mCAAmC;QACnC,SAAS,IAAI,oBAAoB;KAClC;IACH,sDAAsD;IACtD,aAAa,IAAI;QACf,CAAC,QAAQ;YACP,CAAC,SAAS,IAAI;YACZ,6BAA6B;YAC7B,gCAAgC;SACjC;QACH,QAAQ;YACN,CAAC,SAAS,IAAI;YACZ,8BAA8B;YAC9B,iCAAiC;SAClC;QACH,SAAS;YACP,CAAC,QAAQ,IAAI,CAAC,wBAAwB,EAAE,2BAA2B,CAAC;QACtE,SAAS;YACP,QAAQ,IAAI,CAAC,wBAAwB,EAAE,2BAA2B,CAAC;KACtE,EACD,iDAAiD,EACjD,SAAS;QACP,CAAC,CAAC,uHAAuH;QACzH,CAAC,CAAC,oHAAoH;IACxH,iBAAiB;IACjB,SAAS,IAAI,oBAAoB;IACjC,oCAAoC;IACpC,UAAU,IAAI,CAAC,SAAS,IAAI,CAAC,YAAY,EAAE,oBAAoB,CAAC,EAChE,SAAS,CACV,CAAC;IAEF,OAAO,CACL,8BAAC,uBAAU,IACT,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,eAAe,EAC1B,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,SAAS,KAChB,KAAK,GACT,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,qBAAa,CAAC,WAAW,GAAG,eAAe,CAAC","sourcesContent":["import React, { forwardRef } from 'react';\n\nimport { twMerge } from '../../../../utils/tw-merge';\nimport { ButtonBase } from '../../../ButtonBase';\n\nimport type { ButtonPrimaryProps } from './ButtonPrimary.types';\n\nexport const ButtonPrimary = forwardRef<HTMLButtonElement, ButtonPrimaryProps>(\n (\n { className, isDanger, isInverse, isDisabled, isLoading, ...props },\n ref,\n ) => {\n const isInteractive = !(isDisabled ?? isLoading);\n\n const mergedClassName = twMerge(\n // Default primary styles\n !isDanger &&\n !isInverse && [\n 'bg-icon-default text-primary-inverse',\n // Loading state uses pressed color\n isLoading && 'bg-icon-default-pressed',\n ],\n // Danger styles\n isDanger &&\n !isInverse && [\n 'bg-error-default text-error-inverse',\n // Loading state uses pressed color\n isLoading && 'bg-error-default-pressed',\n ],\n // Inverse styles\n isInverse &&\n !isDanger && [\n 'bg-default text-default',\n // Loading state uses pressed color\n isLoading && 'bg-default-pressed',\n ],\n // Inverse danger styles\n isInverse &&\n isDanger && [\n 'bg-default text-error-default',\n // Loading state uses pressed color\n isLoading && 'bg-default-pressed',\n ],\n // Hover/Active states - only applied when interactive\n isInteractive && [\n !isDanger &&\n !isInverse && [\n 'hover:bg-icon-default-hover',\n 'active:bg-icon-default-pressed',\n ],\n isDanger &&\n !isInverse && [\n 'hover:bg-error-default-hover',\n 'active:bg-error-default-pressed',\n ],\n isInverse &&\n !isDanger && ['hover:bg-default-hover', 'active:bg-default-pressed'],\n isInverse &&\n isDanger && ['hover:bg-default-hover', 'active:bg-default-pressed'],\n ],\n 'focus-visible:outline-none focus-visible:ring-0',\n isInverse\n ? 'focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-background-default'\n : 'focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-default',\n // Loading styles\n isLoading && 'cursor-not-allowed',\n // Disabled styles (but not loading)\n isDisabled && !isLoading && ['opacity-50', 'cursor-not-allowed'],\n className,\n );\n\n return (\n <ButtonBase\n ref={ref}\n className={mergedClassName}\n isDisabled={isDisabled}\n isLoading={isLoading}\n {...props}\n />\n );\n },\n);\n\nButtonPrimary.displayName = 'ButtonPrimary';\n"]}
|
|
@@ -55,9 +55,9 @@ export const ButtonPrimary = forwardRef(({ className, isDanger, isInverse, isDis
|
|
|
55
55
|
!isDanger && ['hover:bg-default-hover', 'active:bg-default-pressed'],
|
|
56
56
|
isInverse &&
|
|
57
57
|
isDanger && ['hover:bg-default-hover', 'active:bg-default-pressed'],
|
|
58
|
-
], 'focus-visible:ring-0', isInverse
|
|
59
|
-
? 'focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-background-default'
|
|
60
|
-
: 'focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-default',
|
|
58
|
+
], 'focus-visible:outline-none focus-visible:ring-0', isInverse
|
|
59
|
+
? 'focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-background-default'
|
|
60
|
+
: 'focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-default',
|
|
61
61
|
// Loading styles
|
|
62
62
|
isLoading && 'cursor-not-allowed',
|
|
63
63
|
// Disabled styles (but not loading)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonPrimary.mjs","sourceRoot":"","sources":["../../../../../src/components/Button/variants/ButtonPrimary/ButtonPrimary.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,QAAO,EAAE,UAAU,EAAE,cAAc;;AAE1C,OAAO,EAAE,OAAO,EAAE,uCAAmC;AACrD,OAAO,EAAE,UAAU,EAAE,sCAA4B;AAIjD,MAAM,CAAC,MAAM,aAAa,GAAG,UAAU,CACrC,CACE,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EACnE,GAAG,EACH,EAAE;IACF,MAAM,aAAa,GAAG,CAAC,CAAC,UAAU,IAAI,SAAS,CAAC,CAAC;IAEjD,MAAM,eAAe,GAAG,OAAO;IAC7B,yBAAyB;IACzB,CAAC,QAAQ;QACP,CAAC,SAAS,IAAI;QACZ,sCAAsC;QACtC,mCAAmC;QACnC,SAAS,IAAI,yBAAyB;KACvC;IACH,gBAAgB;IAChB,QAAQ;QACN,CAAC,SAAS,IAAI;QACZ,qCAAqC;QACrC,mCAAmC;QACnC,SAAS,IAAI,0BAA0B;KACxC;IACH,iBAAiB;IACjB,SAAS;QACP,CAAC,QAAQ,IAAI;QACX,yBAAyB;QACzB,mCAAmC;QACnC,SAAS,IAAI,oBAAoB;KAClC;IACH,wBAAwB;IACxB,SAAS;QACP,QAAQ,IAAI;QACV,+BAA+B;QAC/B,mCAAmC;QACnC,SAAS,IAAI,oBAAoB;KAClC;IACH,sDAAsD;IACtD,aAAa,IAAI;QACf,CAAC,QAAQ;YACP,CAAC,SAAS,IAAI;YACZ,6BAA6B;YAC7B,gCAAgC;SACjC;QACH,QAAQ;YACN,CAAC,SAAS,IAAI;YACZ,8BAA8B;YAC9B,iCAAiC;SAClC;QACH,SAAS;YACP,CAAC,QAAQ,IAAI,CAAC,wBAAwB,EAAE,2BAA2B,CAAC;QACtE,SAAS;YACP,QAAQ,IAAI,CAAC,wBAAwB,EAAE,2BAA2B,CAAC;KACtE,EACD,
|
|
1
|
+
{"version":3,"file":"ButtonPrimary.mjs","sourceRoot":"","sources":["../../../../../src/components/Button/variants/ButtonPrimary/ButtonPrimary.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,QAAO,EAAE,UAAU,EAAE,cAAc;;AAE1C,OAAO,EAAE,OAAO,EAAE,uCAAmC;AACrD,OAAO,EAAE,UAAU,EAAE,sCAA4B;AAIjD,MAAM,CAAC,MAAM,aAAa,GAAG,UAAU,CACrC,CACE,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EACnE,GAAG,EACH,EAAE;IACF,MAAM,aAAa,GAAG,CAAC,CAAC,UAAU,IAAI,SAAS,CAAC,CAAC;IAEjD,MAAM,eAAe,GAAG,OAAO;IAC7B,yBAAyB;IACzB,CAAC,QAAQ;QACP,CAAC,SAAS,IAAI;QACZ,sCAAsC;QACtC,mCAAmC;QACnC,SAAS,IAAI,yBAAyB;KACvC;IACH,gBAAgB;IAChB,QAAQ;QACN,CAAC,SAAS,IAAI;QACZ,qCAAqC;QACrC,mCAAmC;QACnC,SAAS,IAAI,0BAA0B;KACxC;IACH,iBAAiB;IACjB,SAAS;QACP,CAAC,QAAQ,IAAI;QACX,yBAAyB;QACzB,mCAAmC;QACnC,SAAS,IAAI,oBAAoB;KAClC;IACH,wBAAwB;IACxB,SAAS;QACP,QAAQ,IAAI;QACV,+BAA+B;QAC/B,mCAAmC;QACnC,SAAS,IAAI,oBAAoB;KAClC;IACH,sDAAsD;IACtD,aAAa,IAAI;QACf,CAAC,QAAQ;YACP,CAAC,SAAS,IAAI;YACZ,6BAA6B;YAC7B,gCAAgC;SACjC;QACH,QAAQ;YACN,CAAC,SAAS,IAAI;YACZ,8BAA8B;YAC9B,iCAAiC;SAClC;QACH,SAAS;YACP,CAAC,QAAQ,IAAI,CAAC,wBAAwB,EAAE,2BAA2B,CAAC;QACtE,SAAS;YACP,QAAQ,IAAI,CAAC,wBAAwB,EAAE,2BAA2B,CAAC;KACtE,EACD,iDAAiD,EACjD,SAAS;QACP,CAAC,CAAC,uHAAuH;QACzH,CAAC,CAAC,oHAAoH;IACxH,iBAAiB;IACjB,SAAS,IAAI,oBAAoB;IACjC,oCAAoC;IACpC,UAAU,IAAI,CAAC,SAAS,IAAI,CAAC,YAAY,EAAE,oBAAoB,CAAC,EAChE,SAAS,CACV,CAAC;IAEF,OAAO,CACL,oBAAC,UAAU,IACT,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,eAAe,EAC1B,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,SAAS,KAChB,KAAK,GACT,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,aAAa,CAAC,WAAW,GAAG,eAAe,CAAC","sourcesContent":["import React, { forwardRef } from 'react';\n\nimport { twMerge } from '../../../../utils/tw-merge';\nimport { ButtonBase } from '../../../ButtonBase';\n\nimport type { ButtonPrimaryProps } from './ButtonPrimary.types';\n\nexport const ButtonPrimary = forwardRef<HTMLButtonElement, ButtonPrimaryProps>(\n (\n { className, isDanger, isInverse, isDisabled, isLoading, ...props },\n ref,\n ) => {\n const isInteractive = !(isDisabled ?? isLoading);\n\n const mergedClassName = twMerge(\n // Default primary styles\n !isDanger &&\n !isInverse && [\n 'bg-icon-default text-primary-inverse',\n // Loading state uses pressed color\n isLoading && 'bg-icon-default-pressed',\n ],\n // Danger styles\n isDanger &&\n !isInverse && [\n 'bg-error-default text-error-inverse',\n // Loading state uses pressed color\n isLoading && 'bg-error-default-pressed',\n ],\n // Inverse styles\n isInverse &&\n !isDanger && [\n 'bg-default text-default',\n // Loading state uses pressed color\n isLoading && 'bg-default-pressed',\n ],\n // Inverse danger styles\n isInverse &&\n isDanger && [\n 'bg-default text-error-default',\n // Loading state uses pressed color\n isLoading && 'bg-default-pressed',\n ],\n // Hover/Active states - only applied when interactive\n isInteractive && [\n !isDanger &&\n !isInverse && [\n 'hover:bg-icon-default-hover',\n 'active:bg-icon-default-pressed',\n ],\n isDanger &&\n !isInverse && [\n 'hover:bg-error-default-hover',\n 'active:bg-error-default-pressed',\n ],\n isInverse &&\n !isDanger && ['hover:bg-default-hover', 'active:bg-default-pressed'],\n isInverse &&\n isDanger && ['hover:bg-default-hover', 'active:bg-default-pressed'],\n ],\n 'focus-visible:outline-none focus-visible:ring-0',\n isInverse\n ? 'focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-background-default'\n : 'focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-default',\n // Loading styles\n isLoading && 'cursor-not-allowed',\n // Disabled styles (but not loading)\n isDisabled && !isLoading && ['opacity-50', 'cursor-not-allowed'],\n className,\n );\n\n return (\n <ButtonBase\n ref={ref}\n className={mergedClassName}\n isDisabled={isDisabled}\n isLoading={isLoading}\n {...props}\n />\n );\n },\n);\n\nButtonPrimary.displayName = 'ButtonPrimary';\n"]}
|
|
@@ -67,9 +67,9 @@ exports.ButtonSecondary = (0, react_1.forwardRef)(({ className, isDanger, isInve
|
|
|
67
67
|
isInverse && !isDanger && ['hover:bg-hover', 'active:bg-pressed'],
|
|
68
68
|
isInverse &&
|
|
69
69
|
isDanger && ['hover:bg-default-hover', 'active:bg-default-pressed'],
|
|
70
|
-
], 'focus-visible:ring-0', isInverse
|
|
71
|
-
? 'focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-background-default'
|
|
72
|
-
: 'focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-default',
|
|
70
|
+
], 'focus-visible:outline-none focus-visible:ring-0', isInverse
|
|
71
|
+
? 'focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-background-default'
|
|
72
|
+
: 'focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-default',
|
|
73
73
|
// Loading styles
|
|
74
74
|
isLoading && 'cursor-not-allowed',
|
|
75
75
|
// Disabled styles (but not loading)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonSecondary.cjs","sourceRoot":"","sources":["../../../../../src/components/Button/variants/ButtonSecondary/ButtonSecondary.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA0C;AAE1C,6DAAqD;AACrD,8DAAiD;AAIpC,QAAA,eAAe,GAAG,IAAA,kBAAU,EAIvC,CACE,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EACnE,GAAG,EACH,EAAE;IACF,MAAM,aAAa,GAAG,CAAC,CAAC,UAAU,IAAI,SAAS,CAAC,CAAC;IAEjD,MAAM,eAAe,GAAG,IAAA,kBAAO;IAC7B,2BAA2B;IAC3B,CAAC,QAAQ;QACP,CAAC,SAAS,IAAI;QACZ,uBAAuB;QACvB,mCAAmC;QACnC,SAAS,IAAI,kBAAkB;KAChC;IACH,gBAAgB;IAChB,QAAQ;QACN,CAAC,SAAS,IAAI;QACZ,6BAA6B;QAC7B,mCAAmC;QACnC,SAAS,IAAI,kBAAkB;KAChC;IACH,iBAAiB;IACjB,SAAS;QACP,CAAC,QAAQ,IAAI;QACX,qEAAqE;QACrE,mCAAmC;QACnC,SAAS,IAAI,YAAY;KAC1B;IACH,wBAAwB;IACxB,SAAS;QACP,QAAQ,IAAI;QACV,wCAAwC;QACxC,mCAAmC;QACnC,SAAS,IAAI,oBAAoB;KAClC;IACH,sDAAsD;IACtD,aAAa,IAAI;QACf,CAAC,QAAQ;YACP,CAAC,SAAS,IAAI,CAAC,sBAAsB,EAAE,yBAAyB,CAAC;QACnE,QAAQ;YACN,CAAC,SAAS,IAAI,CAAC,sBAAsB,EAAE,yBAAyB,CAAC;QACnE,SAAS,IAAI,CAAC,QAAQ,IAAI,CAAC,gBAAgB,EAAE,mBAAmB,CAAC;QACjE,SAAS;YACP,QAAQ,IAAI,CAAC,wBAAwB,EAAE,2BAA2B,CAAC;KACtE,EACD,
|
|
1
|
+
{"version":3,"file":"ButtonSecondary.cjs","sourceRoot":"","sources":["../../../../../src/components/Button/variants/ButtonSecondary/ButtonSecondary.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA0C;AAE1C,6DAAqD;AACrD,8DAAiD;AAIpC,QAAA,eAAe,GAAG,IAAA,kBAAU,EAIvC,CACE,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EACnE,GAAG,EACH,EAAE;IACF,MAAM,aAAa,GAAG,CAAC,CAAC,UAAU,IAAI,SAAS,CAAC,CAAC;IAEjD,MAAM,eAAe,GAAG,IAAA,kBAAO;IAC7B,2BAA2B;IAC3B,CAAC,QAAQ;QACP,CAAC,SAAS,IAAI;QACZ,uBAAuB;QACvB,mCAAmC;QACnC,SAAS,IAAI,kBAAkB;KAChC;IACH,gBAAgB;IAChB,QAAQ;QACN,CAAC,SAAS,IAAI;QACZ,6BAA6B;QAC7B,mCAAmC;QACnC,SAAS,IAAI,kBAAkB;KAChC;IACH,iBAAiB;IACjB,SAAS;QACP,CAAC,QAAQ,IAAI;QACX,qEAAqE;QACrE,mCAAmC;QACnC,SAAS,IAAI,YAAY;KAC1B;IACH,wBAAwB;IACxB,SAAS;QACP,QAAQ,IAAI;QACV,wCAAwC;QACxC,mCAAmC;QACnC,SAAS,IAAI,oBAAoB;KAClC;IACH,sDAAsD;IACtD,aAAa,IAAI;QACf,CAAC,QAAQ;YACP,CAAC,SAAS,IAAI,CAAC,sBAAsB,EAAE,yBAAyB,CAAC;QACnE,QAAQ;YACN,CAAC,SAAS,IAAI,CAAC,sBAAsB,EAAE,yBAAyB,CAAC;QACnE,SAAS,IAAI,CAAC,QAAQ,IAAI,CAAC,gBAAgB,EAAE,mBAAmB,CAAC;QACjE,SAAS;YACP,QAAQ,IAAI,CAAC,wBAAwB,EAAE,2BAA2B,CAAC;KACtE,EACD,iDAAiD,EACjD,SAAS;QACP,CAAC,CAAC,uHAAuH;QACzH,CAAC,CAAC,oHAAoH;IACxH,iBAAiB;IACjB,SAAS,IAAI,oBAAoB;IACjC,oCAAoC;IACpC,UAAU,IAAI,CAAC,SAAS,IAAI,CAAC,YAAY,EAAE,oBAAoB,CAAC,EAChE,SAAS,CACV,CAAC;IAEF,OAAO,CACL,8BAAC,uBAAU,IACT,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,eAAe,EAC1B,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,SAAS,KAChB,KAAK,GACT,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,uBAAe,CAAC,WAAW,GAAG,iBAAiB,CAAC","sourcesContent":["import React, { forwardRef } from 'react';\n\nimport { twMerge } from '../../../../utils/tw-merge';\nimport { ButtonBase } from '../../../ButtonBase';\n\nimport type { ButtonSecondaryProps } from './ButtonSecondary.types';\n\nexport const ButtonSecondary = forwardRef<\n HTMLButtonElement,\n ButtonSecondaryProps\n>(\n (\n { className, isDanger, isInverse, isDisabled, isLoading, ...props },\n ref,\n ) => {\n const isInteractive = !(isDisabled ?? isLoading);\n\n const mergedClassName = twMerge(\n // Default secondary styles\n !isDanger &&\n !isInverse && [\n 'bg-muted text-default',\n // Loading state uses pressed color\n isLoading && 'bg-muted-pressed',\n ],\n // Danger styles\n isDanger &&\n !isInverse && [\n 'bg-muted text-error-default',\n // Loading state uses pressed color\n isLoading && 'bg-muted-pressed',\n ],\n // Inverse styles\n isInverse &&\n !isDanger && [\n 'border-2 border-primary-inverse bg-transparent text-primary-inverse',\n // Loading state uses pressed color\n isLoading && 'bg-pressed',\n ],\n // Inverse danger styles\n isInverse &&\n isDanger && [\n 'border-0 bg-default text-error-default',\n // Loading state uses pressed color\n isLoading && 'bg-default-pressed',\n ],\n // Hover/Active states - only applied when interactive\n isInteractive && [\n !isDanger &&\n !isInverse && ['hover:bg-muted-hover', 'active:bg-muted-pressed'],\n isDanger &&\n !isInverse && ['hover:bg-muted-hover', 'active:bg-muted-pressed'],\n isInverse && !isDanger && ['hover:bg-hover', 'active:bg-pressed'],\n isInverse &&\n isDanger && ['hover:bg-default-hover', 'active:bg-default-pressed'],\n ],\n 'focus-visible:outline-none focus-visible:ring-0',\n isInverse\n ? 'focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-background-default'\n : 'focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-default',\n // Loading styles\n isLoading && 'cursor-not-allowed',\n // Disabled styles (but not loading)\n isDisabled && !isLoading && ['opacity-50', 'cursor-not-allowed'],\n className,\n );\n\n return (\n <ButtonBase\n ref={ref}\n className={mergedClassName}\n isDisabled={isDisabled}\n isLoading={isLoading}\n {...props}\n />\n );\n },\n);\n\nButtonSecondary.displayName = 'ButtonSecondary';\n"]}
|
|
@@ -48,9 +48,9 @@ export const ButtonSecondary = forwardRef(({ className, isDanger, isInverse, isD
|
|
|
48
48
|
isInverse && !isDanger && ['hover:bg-hover', 'active:bg-pressed'],
|
|
49
49
|
isInverse &&
|
|
50
50
|
isDanger && ['hover:bg-default-hover', 'active:bg-default-pressed'],
|
|
51
|
-
], 'focus-visible:ring-0', isInverse
|
|
52
|
-
? 'focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-background-default'
|
|
53
|
-
: 'focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-default',
|
|
51
|
+
], 'focus-visible:outline-none focus-visible:ring-0', isInverse
|
|
52
|
+
? 'focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-background-default'
|
|
53
|
+
: 'focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-default',
|
|
54
54
|
// Loading styles
|
|
55
55
|
isLoading && 'cursor-not-allowed',
|
|
56
56
|
// Disabled styles (but not loading)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonSecondary.mjs","sourceRoot":"","sources":["../../../../../src/components/Button/variants/ButtonSecondary/ButtonSecondary.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,QAAO,EAAE,UAAU,EAAE,cAAc;;AAE1C,OAAO,EAAE,OAAO,EAAE,uCAAmC;AACrD,OAAO,EAAE,UAAU,EAAE,sCAA4B;AAIjD,MAAM,CAAC,MAAM,eAAe,GAAG,UAAU,CAIvC,CACE,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EACnE,GAAG,EACH,EAAE;IACF,MAAM,aAAa,GAAG,CAAC,CAAC,UAAU,IAAI,SAAS,CAAC,CAAC;IAEjD,MAAM,eAAe,GAAG,OAAO;IAC7B,2BAA2B;IAC3B,CAAC,QAAQ;QACP,CAAC,SAAS,IAAI;QACZ,uBAAuB;QACvB,mCAAmC;QACnC,SAAS,IAAI,kBAAkB;KAChC;IACH,gBAAgB;IAChB,QAAQ;QACN,CAAC,SAAS,IAAI;QACZ,6BAA6B;QAC7B,mCAAmC;QACnC,SAAS,IAAI,kBAAkB;KAChC;IACH,iBAAiB;IACjB,SAAS;QACP,CAAC,QAAQ,IAAI;QACX,qEAAqE;QACrE,mCAAmC;QACnC,SAAS,IAAI,YAAY;KAC1B;IACH,wBAAwB;IACxB,SAAS;QACP,QAAQ,IAAI;QACV,wCAAwC;QACxC,mCAAmC;QACnC,SAAS,IAAI,oBAAoB;KAClC;IACH,sDAAsD;IACtD,aAAa,IAAI;QACf,CAAC,QAAQ;YACP,CAAC,SAAS,IAAI,CAAC,sBAAsB,EAAE,yBAAyB,CAAC;QACnE,QAAQ;YACN,CAAC,SAAS,IAAI,CAAC,sBAAsB,EAAE,yBAAyB,CAAC;QACnE,SAAS,IAAI,CAAC,QAAQ,IAAI,CAAC,gBAAgB,EAAE,mBAAmB,CAAC;QACjE,SAAS;YACP,QAAQ,IAAI,CAAC,wBAAwB,EAAE,2BAA2B,CAAC;KACtE,EACD,
|
|
1
|
+
{"version":3,"file":"ButtonSecondary.mjs","sourceRoot":"","sources":["../../../../../src/components/Button/variants/ButtonSecondary/ButtonSecondary.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,QAAO,EAAE,UAAU,EAAE,cAAc;;AAE1C,OAAO,EAAE,OAAO,EAAE,uCAAmC;AACrD,OAAO,EAAE,UAAU,EAAE,sCAA4B;AAIjD,MAAM,CAAC,MAAM,eAAe,GAAG,UAAU,CAIvC,CACE,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EACnE,GAAG,EACH,EAAE;IACF,MAAM,aAAa,GAAG,CAAC,CAAC,UAAU,IAAI,SAAS,CAAC,CAAC;IAEjD,MAAM,eAAe,GAAG,OAAO;IAC7B,2BAA2B;IAC3B,CAAC,QAAQ;QACP,CAAC,SAAS,IAAI;QACZ,uBAAuB;QACvB,mCAAmC;QACnC,SAAS,IAAI,kBAAkB;KAChC;IACH,gBAAgB;IAChB,QAAQ;QACN,CAAC,SAAS,IAAI;QACZ,6BAA6B;QAC7B,mCAAmC;QACnC,SAAS,IAAI,kBAAkB;KAChC;IACH,iBAAiB;IACjB,SAAS;QACP,CAAC,QAAQ,IAAI;QACX,qEAAqE;QACrE,mCAAmC;QACnC,SAAS,IAAI,YAAY;KAC1B;IACH,wBAAwB;IACxB,SAAS;QACP,QAAQ,IAAI;QACV,wCAAwC;QACxC,mCAAmC;QACnC,SAAS,IAAI,oBAAoB;KAClC;IACH,sDAAsD;IACtD,aAAa,IAAI;QACf,CAAC,QAAQ;YACP,CAAC,SAAS,IAAI,CAAC,sBAAsB,EAAE,yBAAyB,CAAC;QACnE,QAAQ;YACN,CAAC,SAAS,IAAI,CAAC,sBAAsB,EAAE,yBAAyB,CAAC;QACnE,SAAS,IAAI,CAAC,QAAQ,IAAI,CAAC,gBAAgB,EAAE,mBAAmB,CAAC;QACjE,SAAS;YACP,QAAQ,IAAI,CAAC,wBAAwB,EAAE,2BAA2B,CAAC;KACtE,EACD,iDAAiD,EACjD,SAAS;QACP,CAAC,CAAC,uHAAuH;QACzH,CAAC,CAAC,oHAAoH;IACxH,iBAAiB;IACjB,SAAS,IAAI,oBAAoB;IACjC,oCAAoC;IACpC,UAAU,IAAI,CAAC,SAAS,IAAI,CAAC,YAAY,EAAE,oBAAoB,CAAC,EAChE,SAAS,CACV,CAAC;IAEF,OAAO,CACL,oBAAC,UAAU,IACT,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,eAAe,EAC1B,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,SAAS,KAChB,KAAK,GACT,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,CAAC,WAAW,GAAG,iBAAiB,CAAC","sourcesContent":["import React, { forwardRef } from 'react';\n\nimport { twMerge } from '../../../../utils/tw-merge';\nimport { ButtonBase } from '../../../ButtonBase';\n\nimport type { ButtonSecondaryProps } from './ButtonSecondary.types';\n\nexport const ButtonSecondary = forwardRef<\n HTMLButtonElement,\n ButtonSecondaryProps\n>(\n (\n { className, isDanger, isInverse, isDisabled, isLoading, ...props },\n ref,\n ) => {\n const isInteractive = !(isDisabled ?? isLoading);\n\n const mergedClassName = twMerge(\n // Default secondary styles\n !isDanger &&\n !isInverse && [\n 'bg-muted text-default',\n // Loading state uses pressed color\n isLoading && 'bg-muted-pressed',\n ],\n // Danger styles\n isDanger &&\n !isInverse && [\n 'bg-muted text-error-default',\n // Loading state uses pressed color\n isLoading && 'bg-muted-pressed',\n ],\n // Inverse styles\n isInverse &&\n !isDanger && [\n 'border-2 border-primary-inverse bg-transparent text-primary-inverse',\n // Loading state uses pressed color\n isLoading && 'bg-pressed',\n ],\n // Inverse danger styles\n isInverse &&\n isDanger && [\n 'border-0 bg-default text-error-default',\n // Loading state uses pressed color\n isLoading && 'bg-default-pressed',\n ],\n // Hover/Active states - only applied when interactive\n isInteractive && [\n !isDanger &&\n !isInverse && ['hover:bg-muted-hover', 'active:bg-muted-pressed'],\n isDanger &&\n !isInverse && ['hover:bg-muted-hover', 'active:bg-muted-pressed'],\n isInverse && !isDanger && ['hover:bg-hover', 'active:bg-pressed'],\n isInverse &&\n isDanger && ['hover:bg-default-hover', 'active:bg-default-pressed'],\n ],\n 'focus-visible:outline-none focus-visible:ring-0',\n isInverse\n ? 'focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-background-default'\n : 'focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-default',\n // Loading styles\n isLoading && 'cursor-not-allowed',\n // Disabled styles (but not loading)\n isDisabled && !isLoading && ['opacity-50', 'cursor-not-allowed'],\n className,\n );\n\n return (\n <ButtonBase\n ref={ref}\n className={mergedClassName}\n isDisabled={isDisabled}\n isLoading={isLoading}\n {...props}\n />\n );\n },\n);\n\nButtonSecondary.displayName = 'ButtonSecondary';\n"]}
|
|
@@ -69,9 +69,9 @@ exports.ButtonTertiary = (0, react_1.forwardRef)(({ className, isDanger, isInver
|
|
|
69
69
|
'hover:bg-error-muted-hover',
|
|
70
70
|
'active:bg-error-muted-pressed',
|
|
71
71
|
],
|
|
72
|
-
], 'focus-visible:ring-0', isInverse
|
|
73
|
-
? 'focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-background-default'
|
|
74
|
-
: 'focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-default',
|
|
72
|
+
], 'focus-visible:outline-none focus-visible:ring-0', isInverse
|
|
73
|
+
? 'focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-background-default'
|
|
74
|
+
: 'focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-default',
|
|
75
75
|
// Loading styles
|
|
76
76
|
isLoading && 'cursor-not-allowed',
|
|
77
77
|
// Disabled styles (but not loading)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonTertiary.cjs","sourceRoot":"","sources":["../../../../../src/components/Button/variants/ButtonTertiary/ButtonTertiary.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA0C;AAE1C,6DAAqD;AACrD,8DAAiD;AAIpC,QAAA,cAAc,GAAG,IAAA,kBAAU,EAItC,CACE,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EACnE,GAAG,EACH,EAAE;IACF,MAAM,aAAa,GAAG,CAAC,CAAC,UAAU,IAAI,SAAS,CAAC,CAAC;IAEjD,MAAM,eAAe,GAAG,IAAA,kBAAO;IAC7B,0BAA0B;IAC1B,CAAC,QAAQ;QACP,CAAC,SAAS,IAAI;QACZ,qCAAqC;QACrC,mCAAmC;QACnC,SAAS,IAAI,YAAY;KAC1B;IACH,gBAAgB;IAChB,QAAQ;QACN,CAAC,SAAS,IAAI;QACZ,mCAAmC;QACnC,+CAA+C;QAC/C,SAAS,IAAI,mDAAmD;KACjE;IACH,iBAAiB;IACjB,SAAS;QACP,CAAC,QAAQ,IAAI;QACX,qCAAqC;QACrC,mCAAmC;QACnC,SAAS,IAAI,YAAY;KAC1B;IACH,wBAAwB;IACxB,SAAS;QACP,QAAQ,IAAI;QACV,+BAA+B;QAC/B,mCAAmC;QACnC,SAAS,IAAI,oBAAoB;KAClC;IACH,sDAAsD;IACtD,aAAa,IAAI;QACf,gBAAgB;QAChB,mBAAmB;QACnB,SAAS;YACP,QAAQ,IAAI,CAAC,wBAAwB,EAAE,2BAA2B,CAAC;QACrE,QAAQ;YACN,CAAC,SAAS,IAAI;YACZ,4BAA4B;YAC5B,+BAA+B;SAChC;KACJ,EACD,
|
|
1
|
+
{"version":3,"file":"ButtonTertiary.cjs","sourceRoot":"","sources":["../../../../../src/components/Button/variants/ButtonTertiary/ButtonTertiary.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA0C;AAE1C,6DAAqD;AACrD,8DAAiD;AAIpC,QAAA,cAAc,GAAG,IAAA,kBAAU,EAItC,CACE,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EACnE,GAAG,EACH,EAAE;IACF,MAAM,aAAa,GAAG,CAAC,CAAC,UAAU,IAAI,SAAS,CAAC,CAAC;IAEjD,MAAM,eAAe,GAAG,IAAA,kBAAO;IAC7B,0BAA0B;IAC1B,CAAC,QAAQ;QACP,CAAC,SAAS,IAAI;QACZ,qCAAqC;QACrC,mCAAmC;QACnC,SAAS,IAAI,YAAY;KAC1B;IACH,gBAAgB;IAChB,QAAQ;QACN,CAAC,SAAS,IAAI;QACZ,mCAAmC;QACnC,+CAA+C;QAC/C,SAAS,IAAI,mDAAmD;KACjE;IACH,iBAAiB;IACjB,SAAS;QACP,CAAC,QAAQ,IAAI;QACX,qCAAqC;QACrC,mCAAmC;QACnC,SAAS,IAAI,YAAY;KAC1B;IACH,wBAAwB;IACxB,SAAS;QACP,QAAQ,IAAI;QACV,+BAA+B;QAC/B,mCAAmC;QACnC,SAAS,IAAI,oBAAoB;KAClC;IACH,sDAAsD;IACtD,aAAa,IAAI;QACf,gBAAgB;QAChB,mBAAmB;QACnB,SAAS;YACP,QAAQ,IAAI,CAAC,wBAAwB,EAAE,2BAA2B,CAAC;QACrE,QAAQ;YACN,CAAC,SAAS,IAAI;YACZ,4BAA4B;YAC5B,+BAA+B;SAChC;KACJ,EACD,iDAAiD,EACjD,SAAS;QACP,CAAC,CAAC,uHAAuH;QACzH,CAAC,CAAC,oHAAoH;IACxH,iBAAiB;IACjB,SAAS,IAAI,oBAAoB;IACjC,oCAAoC;IACpC,UAAU,IAAI,CAAC,SAAS,IAAI,CAAC,YAAY,EAAE,oBAAoB,CAAC,EAChE,SAAS,CACV,CAAC;IAEF,OAAO,CACL,8BAAC,uBAAU,IACT,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,eAAe,EAC1B,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,SAAS,KAChB,KAAK,GACT,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,sBAAc,CAAC,WAAW,GAAG,gBAAgB,CAAC","sourcesContent":["import React, { forwardRef } from 'react';\n\nimport { twMerge } from '../../../../utils/tw-merge';\nimport { ButtonBase } from '../../../ButtonBase';\n\nimport type { ButtonTertiaryProps } from './ButtonTertiary.types';\n\nexport const ButtonTertiary = forwardRef<\n HTMLButtonElement,\n ButtonTertiaryProps\n>(\n (\n { className, isDanger, isInverse, isDisabled, isLoading, ...props },\n ref,\n ) => {\n const isInteractive = !(isDisabled ?? isLoading);\n\n const mergedClassName = twMerge(\n // Default tertiary styles\n !isDanger &&\n !isInverse && [\n 'bg-transparent text-primary-default',\n // Loading state uses pressed color\n isLoading && 'bg-pressed',\n ],\n // Danger styles\n isDanger &&\n !isInverse && [\n 'bg-transparent text-error-default',\n // Loading state uses error muted pressed color\n isLoading && 'bg-error-muted-pressed text-error-default-pressed',\n ],\n // Inverse styles\n isInverse &&\n !isDanger && [\n 'bg-transparent text-primary-inverse',\n // Loading state uses pressed color\n isLoading && 'bg-pressed',\n ],\n // Inverse danger styles\n isInverse &&\n isDanger && [\n 'bg-default text-error-default',\n // Loading state uses pressed color\n isLoading && 'bg-default-pressed',\n ],\n // Hover/Active states - only applied when interactive\n isInteractive && [\n 'hover:bg-hover',\n 'active:bg-pressed',\n isInverse &&\n isDanger && ['hover:bg-default-hover', 'active:bg-default-pressed'],\n isDanger &&\n !isInverse && [\n 'hover:bg-error-muted-hover',\n 'active:bg-error-muted-pressed',\n ],\n ],\n 'focus-visible:outline-none focus-visible:ring-0',\n isInverse\n ? 'focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-background-default'\n : 'focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-default',\n // Loading styles\n isLoading && 'cursor-not-allowed',\n // Disabled styles (but not loading)\n isDisabled && !isLoading && ['opacity-50', 'cursor-not-allowed'],\n className,\n );\n\n return (\n <ButtonBase\n ref={ref}\n className={mergedClassName}\n isDisabled={isDisabled}\n isLoading={isLoading}\n {...props}\n />\n );\n },\n);\n\nButtonTertiary.displayName = 'ButtonTertiary';\n"]}
|