@brycks/core-front 0.3.2 → 0.3.4
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/feedback/Alert/Alert.cjs +1 -1
- package/dist/components/feedback/Alert/Alert.cjs.map +1 -1
- package/dist/components/feedback/Alert/Alert.js +52 -177
- package/dist/components/feedback/Alert/Alert.js.map +1 -1
- package/dist/components/feedback/Modal/Modal.cjs +1 -1
- package/dist/components/feedback/Modal/Modal.cjs.map +1 -1
- package/dist/components/feedback/Modal/Modal.js +7 -6
- package/dist/components/feedback/Modal/Modal.js.map +1 -1
- package/dist/components/form/Checkbox/Checkbox.cjs +1 -1
- package/dist/components/form/Checkbox/Checkbox.js +12 -12
- package/dist/components/form/Input/Input.cjs +1 -1
- package/dist/components/form/Input/Input.js +13 -13
- package/dist/components/form/Slider/Slider.cjs +1 -1
- package/dist/components/form/Slider/Slider.js +1 -1
- package/dist/components/form/Switch/Switch.cjs +1 -1
- package/dist/components/form/Switch/Switch.cjs.map +1 -1
- package/dist/components/form/Switch/Switch.js +70 -105
- package/dist/components/form/Switch/Switch.js.map +1 -1
- package/dist/components/layout/Card/Card.cjs +1 -1
- package/dist/components/layout/Card/Card.cjs.map +1 -1
- package/dist/components/layout/Card/Card.js +59 -121
- package/dist/components/layout/Card/Card.js.map +1 -1
- package/dist/components/navigation/Dropdown/Dropdown.cjs +1 -6
- package/dist/components/navigation/Dropdown/Dropdown.cjs.map +1 -1
- package/dist/components/navigation/Dropdown/Dropdown.js +118 -183
- package/dist/components/navigation/Dropdown/Dropdown.js.map +1 -1
- package/dist/components/navigation/Menu/Menu.cjs +1 -1
- package/dist/components/navigation/Menu/Menu.js +5 -5
- package/dist/components/navigation/Tabs/Tabs.cjs +1 -6
- package/dist/components/navigation/Tabs/Tabs.cjs.map +1 -1
- package/dist/components/navigation/Tabs/Tabs.js +92 -162
- package/dist/components/navigation/Tabs/Tabs.js.map +1 -1
- package/dist/components/primitives/Button/Button.cjs +1 -1
- package/dist/components/primitives/Button/Button.cjs.map +1 -1
- package/dist/components/primitives/Button/Button.js +72 -96
- package/dist/components/primitives/Button/Button.js.map +1 -1
- package/dist/components/primitives/Button/Button.styles.cjs +1 -1
- package/dist/components/primitives/Button/Button.styles.cjs.map +1 -1
- package/dist/components/primitives/Button/Button.styles.js +8 -317
- package/dist/components/primitives/Button/Button.styles.js.map +1 -1
- package/dist/components/utility/Badge/Badge.cjs +1 -1
- package/dist/components/utility/Badge/Badge.cjs.map +1 -1
- package/dist/components/utility/Badge/Badge.js +23 -80
- package/dist/components/utility/Badge/Badge.js.map +1 -1
- package/dist/feedback.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import { cx as
|
|
5
|
-
const
|
|
6
|
-
return /* @__PURE__ */
|
|
1
|
+
import { jsxs as b, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import N, { forwardRef as p } from "react";
|
|
3
|
+
import { sizeConfig as g } from "./Button.styles.js";
|
|
4
|
+
import { cx as j } from "../../../utils/styles.js";
|
|
5
|
+
const D = N.memo(function({ size: n }) {
|
|
6
|
+
return /* @__PURE__ */ b(
|
|
7
7
|
"svg",
|
|
8
8
|
{
|
|
9
|
-
width:
|
|
10
|
-
height:
|
|
9
|
+
width: n,
|
|
10
|
+
height: n,
|
|
11
11
|
viewBox: "0 0 24 24",
|
|
12
12
|
fill: "none",
|
|
13
13
|
className: "brycks-animate-spin",
|
|
14
14
|
"aria-hidden": "true",
|
|
15
15
|
children: [
|
|
16
|
-
/* @__PURE__ */
|
|
16
|
+
/* @__PURE__ */ t(
|
|
17
17
|
"circle",
|
|
18
18
|
{
|
|
19
19
|
cx: "12",
|
|
@@ -26,7 +26,7 @@ const K = A.memo(function({ size: o }) {
|
|
|
26
26
|
opacity: "0.25"
|
|
27
27
|
}
|
|
28
28
|
),
|
|
29
|
-
/* @__PURE__ */
|
|
29
|
+
/* @__PURE__ */ t(
|
|
30
30
|
"circle",
|
|
31
31
|
{
|
|
32
32
|
cx: "12",
|
|
@@ -43,131 +43,107 @@ const K = A.memo(function({ size: o }) {
|
|
|
43
43
|
]
|
|
44
44
|
}
|
|
45
45
|
);
|
|
46
|
-
}),
|
|
47
|
-
as:
|
|
48
|
-
variant:
|
|
49
|
-
intent:
|
|
50
|
-
size:
|
|
51
|
-
fullWidth:
|
|
52
|
-
isLoading:
|
|
53
|
-
isDisabled:
|
|
54
|
-
leftIcon:
|
|
55
|
-
rightIcon:
|
|
46
|
+
}), $ = ({
|
|
47
|
+
as: o,
|
|
48
|
+
variant: n = "solid",
|
|
49
|
+
intent: h = "primary",
|
|
50
|
+
size: c = "md",
|
|
51
|
+
fullWidth: f,
|
|
52
|
+
isLoading: e,
|
|
53
|
+
isDisabled: k,
|
|
54
|
+
leftIcon: a,
|
|
55
|
+
rightIcon: l,
|
|
56
56
|
isIconOnly: r,
|
|
57
|
-
className:
|
|
58
|
-
style:
|
|
59
|
-
children:
|
|
60
|
-
testId:
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
intent: d,
|
|
70
|
-
size: l,
|
|
71
|
-
fullWidth: b,
|
|
72
|
-
isIconOnly: r
|
|
73
|
-
}), H = {
|
|
74
|
-
...c.base,
|
|
75
|
-
...j && !s ? c.hover : {},
|
|
76
|
-
...E && !s ? c.active : {},
|
|
77
|
-
...s ? c.disabled : {},
|
|
78
|
-
...t ? c.loading : {},
|
|
79
|
-
...z
|
|
80
|
-
}, i = G[l], I = (n) => {
|
|
81
|
-
k(!0), D?.(n);
|
|
82
|
-
}, R = (n) => {
|
|
83
|
-
k(!1), u(!1), N?.(n);
|
|
84
|
-
}, U = (n) => {
|
|
85
|
-
u(!0), g?.(n);
|
|
86
|
-
}, V = (n) => {
|
|
87
|
-
u(!1), P?.(n);
|
|
88
|
-
}, W = J(
|
|
57
|
+
className: x,
|
|
58
|
+
style: B,
|
|
59
|
+
children: u,
|
|
60
|
+
testId: S,
|
|
61
|
+
...d
|
|
62
|
+
}, w) => {
|
|
63
|
+
const y = o || "button", i = k || e, s = g[c], z = {
|
|
64
|
+
display: "inline-flex",
|
|
65
|
+
alignItems: "center",
|
|
66
|
+
justifyContent: "center",
|
|
67
|
+
...B
|
|
68
|
+
}, C = j(
|
|
89
69
|
"brycks-button",
|
|
90
|
-
`brycks-button--${
|
|
91
|
-
`brycks-button--${
|
|
92
|
-
`brycks-button--${
|
|
93
|
-
|
|
70
|
+
`brycks-button--${n}`,
|
|
71
|
+
`brycks-button--${h}`,
|
|
72
|
+
`brycks-button--${c}`,
|
|
73
|
+
f && "brycks-button--full-width",
|
|
94
74
|
r && "brycks-button--icon-only",
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
),
|
|
99
|
-
type:
|
|
100
|
-
disabled:
|
|
75
|
+
e && "brycks-button--loading",
|
|
76
|
+
i && "brycks-button--disabled",
|
|
77
|
+
x
|
|
78
|
+
), v = y === "button" || o === void 0 ? {
|
|
79
|
+
type: d.type ?? "button",
|
|
80
|
+
disabled: i
|
|
101
81
|
} : {
|
|
102
|
-
"aria-disabled":
|
|
82
|
+
"aria-disabled": i || void 0,
|
|
103
83
|
role: "button",
|
|
104
|
-
tabIndex:
|
|
84
|
+
tabIndex: i ? -1 : 0
|
|
105
85
|
};
|
|
106
|
-
return /* @__PURE__ */
|
|
107
|
-
|
|
86
|
+
return /* @__PURE__ */ b(
|
|
87
|
+
y,
|
|
108
88
|
{
|
|
109
|
-
ref:
|
|
110
|
-
className:
|
|
111
|
-
style:
|
|
112
|
-
"data-testid":
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
onMouseDown: U,
|
|
116
|
-
onMouseUp: V,
|
|
117
|
-
...q,
|
|
118
|
-
...m,
|
|
89
|
+
ref: w,
|
|
90
|
+
className: C,
|
|
91
|
+
style: z,
|
|
92
|
+
"data-testid": S,
|
|
93
|
+
...v,
|
|
94
|
+
...d,
|
|
119
95
|
children: [
|
|
120
|
-
|
|
96
|
+
e && /* @__PURE__ */ t(
|
|
121
97
|
"span",
|
|
122
98
|
{
|
|
123
99
|
style: {
|
|
124
100
|
display: "inline-flex",
|
|
125
101
|
position: r ? "absolute" : "relative"
|
|
126
102
|
},
|
|
127
|
-
children: /* @__PURE__ */
|
|
103
|
+
children: /* @__PURE__ */ t(D, { size: s.iconSize })
|
|
128
104
|
}
|
|
129
105
|
),
|
|
130
|
-
!
|
|
106
|
+
!e && a && /* @__PURE__ */ t(
|
|
131
107
|
"span",
|
|
132
108
|
{
|
|
133
109
|
style: {
|
|
134
110
|
display: "inline-flex",
|
|
135
|
-
width:
|
|
136
|
-
height:
|
|
111
|
+
width: s.iconSize,
|
|
112
|
+
height: s.iconSize
|
|
137
113
|
},
|
|
138
|
-
children:
|
|
114
|
+
children: a
|
|
139
115
|
}
|
|
140
116
|
),
|
|
141
|
-
!r && /* @__PURE__ */
|
|
117
|
+
!r && /* @__PURE__ */ t(
|
|
142
118
|
"span",
|
|
143
119
|
{
|
|
144
120
|
style: {
|
|
145
|
-
opacity:
|
|
121
|
+
opacity: e && !r ? 0.5 : 1
|
|
146
122
|
},
|
|
147
|
-
children:
|
|
123
|
+
children: u
|
|
148
124
|
}
|
|
149
125
|
),
|
|
150
|
-
!
|
|
126
|
+
!e && l && /* @__PURE__ */ t(
|
|
151
127
|
"span",
|
|
152
128
|
{
|
|
153
129
|
style: {
|
|
154
130
|
display: "inline-flex",
|
|
155
|
-
width:
|
|
156
|
-
height:
|
|
131
|
+
width: s.iconSize,
|
|
132
|
+
height: s.iconSize
|
|
157
133
|
},
|
|
158
|
-
children:
|
|
134
|
+
children: l
|
|
159
135
|
}
|
|
160
136
|
),
|
|
161
|
-
r && !
|
|
137
|
+
r && !e && u
|
|
162
138
|
]
|
|
163
139
|
}
|
|
164
140
|
);
|
|
165
|
-
},
|
|
166
|
-
|
|
167
|
-
const
|
|
168
|
-
|
|
141
|
+
}, m = p($);
|
|
142
|
+
m.displayName = "Button";
|
|
143
|
+
const I = (o, n) => /* @__PURE__ */ t(m, { ref: n, isIconOnly: !0, ...o }), R = p(I);
|
|
144
|
+
R.displayName = "IconButton";
|
|
169
145
|
export {
|
|
170
|
-
|
|
171
|
-
|
|
146
|
+
m as Button,
|
|
147
|
+
R as IconButton
|
|
172
148
|
};
|
|
173
149
|
//# sourceMappingURL=Button.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sources":["../../../../src/components/primitives/Button/Button.tsx"],"sourcesContent":["/**\r\n * Button Component\r\n *\r\n * A versatile, polymorphic button component with multiple variants,\r\n * sizes, and states. Designed with Apple-inspired aesthetics -\r\n * smooth transitions, tactile feedback, and refined visual details.\r\n */\r\n\r\nimport React, {\r\n forwardRef,\r\n useState,\r\n type ElementType,\r\n type ComponentPropsWithRef,\r\n type CSSProperties,\r\n} from 'react'\r\nimport type { ButtonProps } from './Button.types'\r\nimport { getButtonStyles, sizeConfig } from './Button.styles'\r\nimport { cx } from '../../../utils/styles'\r\n\r\ninterface ButtonComponent {\r\n <E extends ElementType = 'button'>(\r\n props: ButtonProps<E> & { ref?: ComponentPropsWithRef<E>['ref'] }\r\n ): React.JSX.Element | null\r\n displayName?: string\r\n}\r\n\r\n/** Loading spinner component - uses global CSS keyframes */\r\nconst LoadingSpinner = React.memo(function LoadingSpinner({ size }: { size: number }) {\r\n return (\r\n <svg\r\n width={size}\r\n height={size}\r\n viewBox=\"0 0 24 24\"\r\n fill=\"none\"\r\n className=\"brycks-animate-spin\"\r\n aria-hidden=\"true\"\r\n >\r\n <circle\r\n cx=\"12\"\r\n cy=\"12\"\r\n r=\"10\"\r\n stroke=\"currentColor\"\r\n strokeWidth=\"2\"\r\n strokeLinecap=\"round\"\r\n strokeDasharray=\"31.4 31.4\"\r\n opacity=\"0.25\"\r\n />\r\n <circle\r\n cx=\"12\"\r\n cy=\"12\"\r\n r=\"10\"\r\n stroke=\"currentColor\"\r\n strokeWidth=\"2\"\r\n strokeLinecap=\"round\"\r\n strokeDasharray=\"31.4 31.4\"\r\n strokeDashoffset=\"62.8\"\r\n style={{ transform: 'rotate(-90deg)', transformOrigin: 'center' }}\r\n />\r\n </svg>\r\n )\r\n})\r\n\r\nconst ButtonInner = <E extends ElementType = 'button'>(\r\n {\r\n as,\r\n variant = 'solid',\r\n intent = 'primary',\r\n size = 'md',\r\n fullWidth,\r\n isLoading,\r\n isDisabled,\r\n leftIcon,\r\n rightIcon,\r\n isIconOnly,\r\n className,\r\n style,\r\n children,\r\n testId,\r\n onMouseEnter,\r\n onMouseLeave,\r\n onMouseDown,\r\n onMouseUp,\r\n ...props\r\n }: ButtonProps<E>,\r\n ref: React.ForwardedRef<Element>\r\n) => {\r\n const Component = (as || 'button') as ElementType\r\n const [isHovered, setIsHovered] = useState(false)\r\n const [isPressed, setIsPressed] = useState(false)\r\n\r\n const disabled = isDisabled || isLoading\r\n\r\n const styles = getButtonStyles({\r\n variant,\r\n intent,\r\n size,\r\n fullWidth,\r\n isIconOnly,\r\n isDisabled: disabled,\r\n isLoading,\r\n })\r\n\r\n // Build final style object\r\n const computedStyle: CSSProperties = {\r\n ...styles.base,\r\n ...(isHovered && !disabled ? styles.hover : {}),\r\n ...(isPressed && !disabled ? styles.active : {}),\r\n ...(disabled ? styles.disabled : {}),\r\n ...(isLoading ? styles.loading : {}),\r\n ...style,\r\n }\r\n\r\n const sizeValues = sizeConfig[size]\r\n\r\n const handleMouseEnter = (e: React.MouseEvent) => {\r\n setIsHovered(true)\r\n onMouseEnter?.(e as never)\r\n }\r\n\r\n const handleMouseLeave = (e: React.MouseEvent) => {\r\n setIsHovered(false)\r\n setIsPressed(false)\r\n onMouseLeave?.(e as never)\r\n }\r\n\r\n const handleMouseDown = (e: React.MouseEvent) => {\r\n setIsPressed(true)\r\n onMouseDown?.(e as never)\r\n }\r\n\r\n const handleMouseUp = (e: React.MouseEvent) => {\r\n setIsPressed(false)\r\n onMouseUp?.(e as never)\r\n }\r\n\r\n // Build class name\r\n const buttonClassName = cx(\r\n 'brycks-button',\r\n `brycks-button--${variant}`,\r\n `brycks-button--${intent}`,\r\n `brycks-button--${size}`,\r\n fullWidth && 'brycks-button--full-width',\r\n isIconOnly && 'brycks-button--icon-only',\r\n isLoading && 'brycks-button--loading',\r\n disabled && 'brycks-button--disabled',\r\n className\r\n )\r\n\r\n const isButton = Component === 'button' || as === undefined\r\n const buttonProps = isButton\r\n ? {\r\n type: (props as { type?: string }).type ?? 'button',\r\n disabled,\r\n }\r\n : {\r\n 'aria-disabled': disabled || undefined,\r\n role: 'button',\r\n tabIndex: disabled ? -1 : 0,\r\n }\r\n\r\n return (\r\n <Component\r\n ref={ref}\r\n className={buttonClassName}\r\n style={computedStyle}\r\n data-testid={testId}\r\n onMouseEnter={handleMouseEnter}\r\n onMouseLeave={handleMouseLeave}\r\n onMouseDown={handleMouseDown}\r\n onMouseUp={handleMouseUp}\r\n {...buttonProps}\r\n {...props}\r\n >\r\n {isLoading && (\r\n <span\r\n style={{\r\n display: 'inline-flex',\r\n position: isIconOnly ? 'absolute' : 'relative',\r\n }}\r\n >\r\n <LoadingSpinner size={sizeValues.iconSize} />\r\n </span>\r\n )}\r\n\r\n {!isLoading && leftIcon && (\r\n <span\r\n style={{\r\n display: 'inline-flex',\r\n width: sizeValues.iconSize,\r\n height: sizeValues.iconSize,\r\n }}\r\n >\r\n {leftIcon}\r\n </span>\r\n )}\r\n\r\n {!isIconOnly && (\r\n <span\r\n style={{\r\n opacity: isLoading && !isIconOnly ? 0.5 : 1,\r\n }}\r\n >\r\n {children}\r\n </span>\r\n )}\r\n\r\n {!isLoading && rightIcon && (\r\n <span\r\n style={{\r\n display: 'inline-flex',\r\n width: sizeValues.iconSize,\r\n height: sizeValues.iconSize,\r\n }}\r\n >\r\n {rightIcon}\r\n </span>\r\n )}\r\n\r\n {isIconOnly && !isLoading && children}\r\n </Component>\r\n )\r\n}\r\n\r\nexport const Button = forwardRef(ButtonInner) as ButtonComponent\r\n\r\nButton.displayName = 'Button'\r\n\r\n/** Icon button shorthand */\r\nconst IconButtonInner = <E extends ElementType = 'button'>(\r\n props: Omit<ButtonProps<E>, 'isIconOnly'>,\r\n ref: React.ForwardedRef<Element>\r\n) => {\r\n return <Button ref={ref as React.ForwardedRef<HTMLButtonElement>} isIconOnly {...(props as ButtonProps<'button'>)} />\r\n}\r\n\r\nexport const IconButton = forwardRef(IconButtonInner) as ButtonComponent\r\n\r\nIconButton.displayName = 'IconButton'\r\n"],"names":["LoadingSpinner","React","size","jsxs","jsx","ButtonInner","as","variant","intent","fullWidth","isLoading","isDisabled","leftIcon","rightIcon","isIconOnly","className","style","children","testId","onMouseEnter","onMouseLeave","onMouseDown","onMouseUp","props","ref","Component","isHovered","setIsHovered","useState","isPressed","setIsPressed","disabled","styles","getButtonStyles","computedStyle","sizeValues","sizeConfig","handleMouseEnter","e","handleMouseLeave","handleMouseDown","handleMouseUp","buttonClassName","cx","buttonProps","Button","forwardRef","IconButtonInner","IconButton"],"mappings":";;;;AA2BA,MAAMA,IAAiBC,EAAM,KAAK,SAAwB,EAAE,MAAAC,KAA0B;AACpF,SACE,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,OAAOD;AAAA,MACP,QAAQA;AAAA,MACR,SAAQ;AAAA,MACR,MAAK;AAAA,MACL,WAAU;AAAA,MACV,eAAY;AAAA,MAEZ,UAAA;AAAA,QAAA,gBAAAE;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,IAAG;AAAA,YACH,IAAG;AAAA,YACH,GAAE;AAAA,YACF,QAAO;AAAA,YACP,aAAY;AAAA,YACZ,eAAc;AAAA,YACd,iBAAgB;AAAA,YAChB,SAAQ;AAAA,UAAA;AAAA,QAAA;AAAA,QAEV,gBAAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,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AAU;AAAA,UAAA;AAAA,QAAA;AAAA,QAI9C,CAACzB,KAAaE,KACb,gBAAAR;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,OAAO;AAAA,cACL,SAAS;AAAA,cACT,OAAO+B,EAAW;AAAA,cAClB,QAAQA,EAAW;AAAA,YAAA;AAAA,YAGpB,UAAAvB;AAAA,UAAA;AAAA,QAAA;AAAA,QAIJ,CAACE,KACA,gBAAAV;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,OAAO;AAAA,cACL,SAASM,KAAa,CAACI,IAAa,MAAM;AAAA,YAAA;AAAA,YAG3C,UAAAG;AAAA,UAAA;AAAA,QAAA;AAAA,QAIJ,CAACP,KAAaG,KACb,gBAAAT;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,OAAO;AAAA,cACL,SAAS;AAAA,cACT,OAAO+B,EAAW;AAAA,cAClB,QAAQA,EAAW;AAAA,YAAA;AAAA,YAGpB,UAAAtB;AAAA,UAAA;AAAA,QAAA;AAAA,QAIJC,KAAc,CAACJ,KAAaO;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGnC,GAEa4B,IAASC,EAAWzC,CAAW;AAE5CwC,EAAO,cAAc;AAGrB,MAAME,IAAkB,CACtBxB,GACAC,wBAEQqB,GAAA,EAAO,KAAArB,GAAmD,YAAU,IAAE,GAAID,GAAiC,GAGxGyB,IAAaF,EAAWC,CAAe;AAEpDC,EAAW,cAAc;"}
|
|
1
|
+
{"version":3,"file":"Button.js","sources":["../../../../src/components/primitives/Button/Button.tsx"],"sourcesContent":["/**\r\n * Button Component\r\n *\r\n * A versatile, polymorphic button component with multiple variants,\r\n * sizes, and states. Designed with Apple-inspired aesthetics -\r\n * smooth transitions, tactile feedback, and refined visual details.\r\n *\r\n * All color styles are handled via CSS classes for easy customization.\r\n * Layout styles (display, alignment) use inline styles for flexibility.\r\n */\r\n\r\nimport React, {\r\n forwardRef,\r\n type ElementType,\r\n type ComponentPropsWithRef,\r\n type CSSProperties,\r\n} from 'react'\r\nimport type { ButtonProps } from './Button.types'\r\nimport { sizeConfig } from './Button.styles'\r\nimport { cx } from '../../../utils/styles'\r\n\r\ninterface ButtonComponent {\r\n <E extends ElementType = 'button'>(\r\n props: ButtonProps<E> & { ref?: ComponentPropsWithRef<E>['ref'] }\r\n ): React.JSX.Element | null\r\n displayName?: string\r\n}\r\n\r\n/** Loading spinner component - uses global CSS keyframes */\r\nconst LoadingSpinner = React.memo(function LoadingSpinner({ size }: { size: number }) {\r\n return (\r\n <svg\r\n width={size}\r\n height={size}\r\n viewBox=\"0 0 24 24\"\r\n fill=\"none\"\r\n className=\"brycks-animate-spin\"\r\n aria-hidden=\"true\"\r\n >\r\n <circle\r\n cx=\"12\"\r\n cy=\"12\"\r\n r=\"10\"\r\n stroke=\"currentColor\"\r\n strokeWidth=\"2\"\r\n strokeLinecap=\"round\"\r\n strokeDasharray=\"31.4 31.4\"\r\n opacity=\"0.25\"\r\n />\r\n <circle\r\n cx=\"12\"\r\n cy=\"12\"\r\n r=\"10\"\r\n stroke=\"currentColor\"\r\n strokeWidth=\"2\"\r\n strokeLinecap=\"round\"\r\n strokeDasharray=\"31.4 31.4\"\r\n strokeDashoffset=\"62.8\"\r\n style={{ transform: 'rotate(-90deg)', transformOrigin: 'center' }}\r\n />\r\n </svg>\r\n )\r\n})\r\n\r\nconst ButtonInner = <E extends ElementType = 'button'>(\r\n {\r\n as,\r\n variant = 'solid',\r\n intent = 'primary',\r\n size = 'md',\r\n fullWidth,\r\n isLoading,\r\n isDisabled,\r\n leftIcon,\r\n rightIcon,\r\n isIconOnly,\r\n className,\r\n style,\r\n children,\r\n testId,\r\n ...props\r\n }: ButtonProps<E>,\r\n ref: React.ForwardedRef<Element>\r\n) => {\r\n const Component = (as || 'button') as ElementType\r\n\r\n const disabled = isDisabled || isLoading\r\n\r\n const sizeValues = sizeConfig[size]\r\n\r\n // Layout-only inline styles (colors handled by CSS classes)\r\n const layoutStyle: CSSProperties = {\r\n display: 'inline-flex',\r\n alignItems: 'center',\r\n justifyContent: 'center',\r\n ...style,\r\n }\r\n\r\n // Build class name - CSS handles all colors and states\r\n const buttonClassName = cx(\r\n 'brycks-button',\r\n `brycks-button--${variant}`,\r\n `brycks-button--${intent}`,\r\n `brycks-button--${size}`,\r\n fullWidth && 'brycks-button--full-width',\r\n isIconOnly && 'brycks-button--icon-only',\r\n isLoading && 'brycks-button--loading',\r\n disabled && 'brycks-button--disabled',\r\n className\r\n )\r\n\r\n const isButton = Component === 'button' || as === undefined\r\n const buttonProps = isButton\r\n ? {\r\n type: (props as { type?: string }).type ?? 'button',\r\n disabled,\r\n }\r\n : {\r\n 'aria-disabled': disabled || undefined,\r\n role: 'button',\r\n tabIndex: disabled ? -1 : 0,\r\n }\r\n\r\n return (\r\n <Component\r\n ref={ref}\r\n className={buttonClassName}\r\n style={layoutStyle}\r\n data-testid={testId}\r\n {...buttonProps}\r\n {...props}\r\n >\r\n {isLoading && (\r\n <span\r\n style={{\r\n display: 'inline-flex',\r\n position: isIconOnly ? 'absolute' : 'relative',\r\n }}\r\n >\r\n <LoadingSpinner size={sizeValues.iconSize} />\r\n </span>\r\n )}\r\n\r\n {!isLoading && leftIcon && (\r\n <span\r\n style={{\r\n display: 'inline-flex',\r\n width: sizeValues.iconSize,\r\n height: sizeValues.iconSize,\r\n }}\r\n >\r\n {leftIcon}\r\n </span>\r\n )}\r\n\r\n {!isIconOnly && (\r\n <span\r\n style={{\r\n opacity: isLoading && !isIconOnly ? 0.5 : 1,\r\n }}\r\n >\r\n {children}\r\n </span>\r\n )}\r\n\r\n {!isLoading && rightIcon && (\r\n <span\r\n style={{\r\n display: 'inline-flex',\r\n width: sizeValues.iconSize,\r\n height: sizeValues.iconSize,\r\n }}\r\n >\r\n {rightIcon}\r\n </span>\r\n )}\r\n\r\n {isIconOnly && !isLoading && children}\r\n </Component>\r\n )\r\n}\r\n\r\nexport const Button = forwardRef(ButtonInner) as ButtonComponent\r\n\r\nButton.displayName = 'Button'\r\n\r\n/** Icon button shorthand */\r\nconst IconButtonInner = <E extends ElementType = 'button'>(\r\n props: Omit<ButtonProps<E>, 'isIconOnly'>,\r\n ref: React.ForwardedRef<Element>\r\n) => {\r\n return <Button ref={ref as React.ForwardedRef<HTMLButtonElement>} isIconOnly {...(props as ButtonProps<'button'>)} />\r\n}\r\n\r\nexport const IconButton = forwardRef(IconButtonInner) as ButtonComponent\r\n\r\nIconButton.displayName = 'IconButton'\r\n"],"names":["LoadingSpinner","React","size","jsxs","jsx","ButtonInner","as","variant","intent","fullWidth","isLoading","isDisabled","leftIcon","rightIcon","isIconOnly","className","style","children","testId","props","ref","Component","disabled","sizeValues","sizeConfig","layoutStyle","buttonClassName","cx","buttonProps","Button","forwardRef","IconButtonInner","IconButton"],"mappings":";;;;AA6BA,MAAMA,IAAiBC,EAAM,KAAK,SAAwB,EAAE,MAAAC,KAA0B;AACpF,SACE,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,OAAOD;AAAA,MACP,QAAQA;AAAA,MACR,SAAQ;AAAA,MACR,MAAK;AAAA,MACL,WAAU;AAAA,MACV,eAAY;AAAA,MAEZ,UAAA;AAAA,QAAA,gBAAAE;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,IAAG;AAAA,YACH,IAAG;AAAA,YACH,GAAE;AAAA,YACF,QAAO;AAAA,YACP,aAAY;AAAA,YACZ,eAAc;AAAA,YACd,iBAAgB;AAAA,YAChB,SAAQ;AAAA,UAAA;AAAA,QAAA;AAAA,QAEV,gBAAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,IAAG;AAAA,YACH,IAAG;AAAA,YACH,GAAE;AAAA,YACF,QAAO;AAAA,YACP,aAAY;AAAA,YACZ,eAAc;AAAA,YACd,iBAAgB;AAAA,YAChB,kBAAiB;AAAA,YACjB,OAAO,EAAE,WAAW,kBAAkB,iBAAiB,SAAA;AAAA,UAAS;AAAA,QAAA;AAAA,MAClE;AAAA,IAAA;AAAA,EAAA;AAGN,CAAC,GAEKC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AV,EAACJ,GAAA,EAAe,MAAMuB,EAAW,SAAA,CAAU;AAAA,UAAA;AAAA,QAAA;AAAA,QAI9C,CAACb,KAAaE,KACb,gBAAAR;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,OAAO;AAAA,cACL,SAAS;AAAA,cACT,OAAOmB,EAAW;AAAA,cAClB,QAAQA,EAAW;AAAA,YAAA;AAAA,YAGpB,UAAAX;AAAA,UAAA;AAAA,QAAA;AAAA,QAIJ,CAACE,KACA,gBAAAV;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,OAAO;AAAA,cACL,SAASM,KAAa,CAACI,IAAa,MAAM;AAAA,YAAA;AAAA,YAG3C,UAAAG;AAAA,UAAA;AAAA,QAAA;AAAA,QAIJ,CAACP,KAAaG,KACb,gBAAAT;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,OAAO;AAAA,cACL,SAAS;AAAA,cACT,OAAOmB,EAAW;AAAA,cAClB,QAAQA,EAAW;AAAA,YAAA;AAAA,YAGpB,UAAAV;AAAA,UAAA;AAAA,QAAA;AAAA,QAIJC,KAAc,CAACJ,KAAaO;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGnC,GAEaY,IAASC,EAAWzB,CAAW;AAE5CwB,EAAO,cAAc;AAGrB,MAAME,IAAkB,CACtBZ,GACAC,wBAEQS,GAAA,EAAO,KAAAT,GAAmD,YAAU,IAAE,GAAID,GAAiC,GAGxGa,IAAaF,EAAWC,CAAe;AAEpDC,EAAW,cAAc;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("../../../design-system/primitives/sizing.cjs"),e={xs:{iconSize:i.iconSizes.xs},sm:{iconSize:i.iconSizes.sm},md:{iconSize:i.iconSizes.md},lg:{iconSize:i.iconSizes.lg},xl:{iconSize:i.iconSizes.xl}};exports.sizeConfig=e;
|
|
2
2
|
//# sourceMappingURL=Button.styles.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.styles.cjs","sources":["../../../../src/components/primitives/Button/Button.styles.ts"],"sourcesContent":["/**\r\n * Button Component Styles\r\n *\r\n * Apple-inspired button styles with smooth transitions and tactile feedback.\r\n * All values derive from the design system - NO hardcoded values.\r\n *\r\n * @module components/primitives/Button\r\n */\r\n\r\nimport type { CSSProperties } from 'react'\r\nimport type { ButtonVariant, ButtonIntent, ButtonSize } from './Button.types'\r\nimport {\r\n componentHeights,\r\n componentPaddingX,\r\n componentGap,\r\n iconSizes,\r\n componentFontWeight,\r\n componentLineHeight,\r\n transition,\r\n stateOpacity,\r\n scale,\r\n} from '../../../design-system'\r\n\r\n/**\r\n * Size dimension values - derived from design system primitives\r\n * Uses CSS variables for font sizes to enable dynamic scaling\r\n */\r\nconst sizeConfig: Record<\r\n ButtonSize,\r\n {\r\n height: number\r\n paddingX: number\r\n fontSize: string\r\n iconSize: number\r\n gap: number\r\n radius: string\r\n }\r\n> = {\r\n xs: {\r\n height: componentHeights.xs,\r\n paddingX: componentPaddingX.xs,\r\n fontSize: 'var(--brycks-fs-ui-xs)',\r\n iconSize: iconSizes.xs,\r\n gap: componentGap.xs,\r\n radius: 'var(--brycks-radius-md)',\r\n },\r\n sm: {\r\n height: componentHeights.sm,\r\n paddingX: componentPaddingX.sm,\r\n fontSize: 'var(--brycks-fs-ui-sm)',\r\n iconSize: iconSizes.sm,\r\n gap: componentGap.sm,\r\n radius: 'var(--brycks-radius-md)',\r\n },\r\n md: {\r\n height: componentHeights.md,\r\n paddingX: componentPaddingX.md,\r\n fontSize: 'var(--brycks-fs-ui-md)',\r\n iconSize: iconSizes.md,\r\n gap: componentGap.md,\r\n radius: 'var(--brycks-radius-default)',\r\n },\r\n lg: {\r\n height: componentHeights.lg,\r\n paddingX: componentPaddingX.lg,\r\n fontSize: 'var(--brycks-fs-ui-lg)',\r\n iconSize: iconSizes.lg,\r\n gap: componentGap.md,\r\n radius: 'var(--brycks-radius-lg)',\r\n },\r\n xl: {\r\n height: componentHeights.xl,\r\n paddingX: componentPaddingX.xl,\r\n fontSize: 'var(--brycks-fs-ui-xl)',\r\n iconSize: iconSizes.xl,\r\n gap: componentGap.lg,\r\n radius: 'var(--brycks-radius-xl)',\r\n },\r\n}\r\n\r\n/** Color values for each intent */\r\nconst intentColors: Record<\r\n ButtonIntent,\r\n {\r\n solid: { bg: string; hoverBg: string; activeBg: string; text: string }\r\n outline: { border: string; hoverBg: string; text: string }\r\n ghost: { hoverBg: string; text: string }\r\n soft: { bg: string; hoverBg: string; text: string }\r\n link: { text: string; hoverText: string }\r\n }\r\n> = {\r\n primary: {\r\n solid: {\r\n bg: 'var(--brycks-primary-default)',\r\n hoverBg: 'var(--brycks-primary-hover)',\r\n activeBg: 'var(--brycks-primary-active)',\r\n text: 'var(--brycks-primary-foreground)',\r\n },\r\n outline: {\r\n border: 'var(--brycks-primary-default)',\r\n hoverBg: 'var(--brycks-primary-muted)',\r\n text: 'var(--brycks-primary-default)',\r\n },\r\n ghost: {\r\n hoverBg: 'var(--brycks-primary-muted)',\r\n text: 'var(--brycks-primary-default)',\r\n },\r\n soft: {\r\n bg: 'var(--brycks-primary-muted)',\r\n hoverBg: 'var(--brycks-primary-soft-hover)',\r\n text: 'var(--brycks-primary-default)',\r\n },\r\n link: {\r\n text: 'var(--brycks-primary-default)',\r\n hoverText: 'var(--brycks-primary-hover)',\r\n },\r\n },\r\n accent: {\r\n solid: {\r\n bg: 'var(--brycks-accent-default)',\r\n hoverBg: 'var(--brycks-accent-hover)',\r\n activeBg: 'var(--brycks-accent-active)',\r\n text: 'var(--brycks-accent-foreground)',\r\n },\r\n outline: {\r\n border: 'var(--brycks-accent-default)',\r\n hoverBg: 'var(--brycks-accent-muted)',\r\n text: 'var(--brycks-accent-default)',\r\n },\r\n ghost: {\r\n hoverBg: 'var(--brycks-accent-muted)',\r\n text: 'var(--brycks-accent-default)',\r\n },\r\n soft: {\r\n bg: 'var(--brycks-accent-muted)',\r\n hoverBg: 'var(--brycks-accent-soft-hover)',\r\n text: 'var(--brycks-accent-default)',\r\n },\r\n link: {\r\n text: 'var(--brycks-accent-default)',\r\n hoverText: 'var(--brycks-accent-hover)',\r\n },\r\n },\r\n neutral: {\r\n solid: {\r\n bg: 'var(--brycks-foreground-default)',\r\n hoverBg: 'var(--brycks-foreground-muted)',\r\n activeBg: 'var(--brycks-foreground-subtle)',\r\n text: 'var(--brycks-background-app)',\r\n },\r\n outline: {\r\n border: 'var(--brycks-border-strong)',\r\n hoverBg: 'var(--brycks-background-muted)',\r\n text: 'var(--brycks-foreground-default)',\r\n },\r\n ghost: {\r\n hoverBg: 'var(--brycks-background-muted)',\r\n text: 'var(--brycks-foreground-default)',\r\n },\r\n soft: {\r\n bg: 'var(--brycks-background-muted)',\r\n hoverBg: 'var(--brycks-background-subtle)',\r\n text: 'var(--brycks-foreground-default)',\r\n },\r\n link: {\r\n text: 'var(--brycks-foreground-default)',\r\n hoverText: 'var(--brycks-foreground-muted)',\r\n },\r\n },\r\n success: {\r\n solid: {\r\n bg: 'var(--brycks-success-default)',\r\n hoverBg: 'var(--brycks-success-hover)',\r\n activeBg: 'var(--brycks-success-hover)',\r\n text: 'var(--brycks-success-foreground)',\r\n },\r\n outline: {\r\n border: 'var(--brycks-success-default)',\r\n hoverBg: 'var(--brycks-success-muted)',\r\n text: 'var(--brycks-success-default)',\r\n },\r\n ghost: {\r\n hoverBg: 'var(--brycks-success-muted)',\r\n text: 'var(--brycks-success-default)',\r\n },\r\n soft: {\r\n bg: 'var(--brycks-success-muted)',\r\n hoverBg: 'var(--brycks-success-soft-hover)',\r\n text: 'var(--brycks-success-default)',\r\n },\r\n link: {\r\n text: 'var(--brycks-success-default)',\r\n hoverText: 'var(--brycks-success-hover)',\r\n },\r\n },\r\n warning: {\r\n solid: {\r\n bg: 'var(--brycks-warning-default)',\r\n hoverBg: 'var(--brycks-warning-hover)',\r\n activeBg: 'var(--brycks-warning-hover)',\r\n text: 'var(--brycks-warning-foreground)',\r\n },\r\n outline: {\r\n border: 'var(--brycks-warning-default)',\r\n hoverBg: 'var(--brycks-warning-muted)',\r\n text: 'var(--brycks-warning-default)',\r\n },\r\n ghost: {\r\n hoverBg: 'var(--brycks-warning-muted)',\r\n text: 'var(--brycks-warning-default)',\r\n },\r\n soft: {\r\n bg: 'var(--brycks-warning-muted)',\r\n hoverBg: 'var(--brycks-warning-soft-hover)',\r\n text: 'var(--brycks-warning-default)',\r\n },\r\n link: {\r\n text: 'var(--brycks-warning-default)',\r\n hoverText: 'var(--brycks-warning-hover)',\r\n },\r\n },\r\n error: {\r\n solid: {\r\n bg: 'var(--brycks-error-default)',\r\n hoverBg: 'var(--brycks-error-hover)',\r\n activeBg: 'var(--brycks-error-hover)',\r\n text: 'var(--brycks-error-foreground)',\r\n },\r\n outline: {\r\n border: 'var(--brycks-error-default)',\r\n hoverBg: 'var(--brycks-error-muted)',\r\n text: 'var(--brycks-error-default)',\r\n },\r\n ghost: {\r\n hoverBg: 'var(--brycks-error-muted)',\r\n text: 'var(--brycks-error-default)',\r\n },\r\n soft: {\r\n bg: 'var(--brycks-error-muted)',\r\n hoverBg: 'var(--brycks-error-soft-hover)',\r\n text: 'var(--brycks-error-default)',\r\n },\r\n link: {\r\n text: 'var(--brycks-error-default)',\r\n hoverText: 'var(--brycks-error-hover)',\r\n },\r\n },\r\n}\r\n\r\nexport interface ButtonStyleProps {\r\n variant: ButtonVariant\r\n intent: ButtonIntent\r\n size: ButtonSize\r\n fullWidth?: boolean\r\n isIconOnly?: boolean\r\n isDisabled?: boolean\r\n isLoading?: boolean\r\n}\r\n\r\nexport function getButtonStyles(props: ButtonStyleProps): {\r\n base: CSSProperties\r\n hover: CSSProperties\r\n active: CSSProperties\r\n disabled: CSSProperties\r\n loading: CSSProperties\r\n} {\r\n const { variant, intent, size, fullWidth, isIconOnly } = props\r\n const sizeValues = sizeConfig[size]\r\n const colors = intentColors[intent][variant]\r\n\r\n // Base styles common to all buttons\r\n const base: CSSProperties = {\r\n display: 'inline-flex',\r\n alignItems: 'center',\r\n justifyContent: 'center',\r\n gap: sizeValues.gap,\r\n height: sizeValues.height,\r\n minWidth: isIconOnly ? sizeValues.height : undefined,\r\n width: fullWidth ? '100%' : undefined,\r\n padding: isIconOnly ? 0 : `0 ${sizeValues.paddingX}px`,\r\n fontSize: sizeValues.fontSize,\r\n fontWeight: componentFontWeight.medium,\r\n fontFamily: 'var(--brycks-font-sans)',\r\n lineHeight: componentLineHeight.none,\r\n borderRadius: sizeValues.radius,\r\n border: 'none',\r\n outline: 'none',\r\n cursor: 'pointer',\r\n userSelect: 'none',\r\n textDecoration: 'none',\r\n transition: transition.quick,\r\n WebkitTapHighlightColor: 'transparent',\r\n }\r\n\r\n // Apply variant-specific base styles\r\n switch (variant) {\r\n case 'solid': {\r\n const solidColors = colors as { bg: string; hoverBg: string; activeBg: string; text: string }\r\n Object.assign(base, {\r\n backgroundColor: solidColors.bg,\r\n color: solidColors.text,\r\n boxShadow: 'var(--brycks-shadow-xs)',\r\n })\r\n break\r\n }\r\n\r\n case 'outline': {\r\n const outlineColors = colors as { border: string; hoverBg: string; text: string }\r\n Object.assign(base, {\r\n backgroundColor: 'transparent',\r\n color: outlineColors.text,\r\n border: `1px solid ${outlineColors.border}`,\r\n })\r\n break\r\n }\r\n\r\n case 'ghost': {\r\n const ghostColors = colors as { hoverBg: string; text: string }\r\n Object.assign(base, {\r\n backgroundColor: 'transparent',\r\n color: ghostColors.text,\r\n })\r\n break\r\n }\r\n\r\n case 'soft': {\r\n const softColors = colors as { bg: string; hoverBg: string; text: string }\r\n Object.assign(base, {\r\n backgroundColor: softColors.bg,\r\n color: softColors.text,\r\n })\r\n break\r\n }\r\n\r\n case 'link': {\r\n const linkColors = colors as { text: string; hoverText: string }\r\n Object.assign(base, {\r\n backgroundColor: 'transparent',\r\n color: linkColors.text,\r\n height: 'auto',\r\n padding: 0,\r\n borderRadius: 0,\r\n })\r\n break\r\n }\r\n }\r\n\r\n // Hover styles\r\n const hover: CSSProperties = {}\r\n switch (variant) {\r\n case 'solid': {\r\n const solidColors = colors as { bg: string; hoverBg: string; activeBg: string; text: string }\r\n hover.backgroundColor = solidColors.hoverBg\r\n hover.boxShadow = 'var(--brycks-shadow-sm)'\r\n break\r\n }\r\n case 'outline': {\r\n const outlineColors = colors as { border: string; hoverBg: string; text: string }\r\n hover.backgroundColor = outlineColors.hoverBg\r\n break\r\n }\r\n case 'ghost': {\r\n const ghostColors = colors as { hoverBg: string; text: string }\r\n hover.backgroundColor = ghostColors.hoverBg\r\n break\r\n }\r\n case 'soft': {\r\n const softColors = colors as { bg: string; hoverBg: string; text: string }\r\n hover.backgroundColor = softColors.hoverBg\r\n break\r\n }\r\n case 'link': {\r\n const linkColors = colors as { text: string; hoverText: string }\r\n hover.color = linkColors.hoverText\r\n hover.textDecoration = 'underline'\r\n break\r\n }\r\n }\r\n\r\n // Active/pressed styles\r\n const active: CSSProperties = {\r\n transform: variant !== 'link' ? `scale(${scale.pressed})` : undefined,\r\n }\r\n if (variant === 'solid') {\r\n const solidColors = colors as { bg: string; hoverBg: string; activeBg: string; text: string }\r\n active.backgroundColor = solidColors.activeBg\r\n active.boxShadow = 'var(--brycks-shadow-xs)'\r\n }\r\n\r\n // Disabled styles\r\n const disabled: CSSProperties = {\r\n opacity: stateOpacity.disabled,\r\n cursor: 'not-allowed',\r\n pointerEvents: 'none',\r\n }\r\n\r\n // Loading styles\r\n const loading: CSSProperties = {\r\n cursor: 'wait',\r\n pointerEvents: 'none',\r\n }\r\n\r\n return { base, hover, active, disabled, loading }\r\n}\r\n\r\nexport { sizeConfig }\r\n"],"names":["sizeConfig","componentHeights","componentPaddingX","iconSizes","componentGap","intentColors","getButtonStyles","props","variant","intent","size","fullWidth","isIconOnly","sizeValues","colors","base","componentFontWeight","componentLineHeight","transition","solidColors","outlineColors","softColors","hover","ghostColors","linkColors","active","scale","disabled","stateOpacity"],"mappings":"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OACR,QAAS,EACT,aAAc,CAAA,CACf,EACD,KACF,CAAA,CAIF,MAAMQ,EAAuB,CAAA,EAC7B,OAAQd,EAAA,CACN,IAAK,QAAS,CACZ,MAAMW,EAAcL,EACpBQ,EAAM,gBAAkBH,EAAY,QACpCG,EAAM,UAAY,0BAClB,KACF,CACA,IAAK,UAAW,CACd,MAAMF,EAAgBN,EACtBQ,EAAM,gBAAkBF,EAAc,QACtC,KACF,CACA,IAAK,QAAS,CACZ,MAAMG,EAAcT,EACpBQ,EAAM,gBAAkBC,EAAY,QACpC,KACF,CACA,IAAK,OAAQ,CACX,MAAMF,EAAaP,EACnBQ,EAAM,gBAAkBD,EAAW,QACnC,KACF,CACA,IAAK,OAAQ,CACX,MAAMG,EAAaV,EACnBQ,EAAM,MAAQE,EAAW,UACzBF,EAAM,eAAiB,YACvB,KACF,CAAA,CAIF,MAAMG,EAAwB,CAC5B,UAAWjB,IAAY,OAAS,SAASkB,QAAM,OAAO,IAAM,MAAA,EAE9D,GAAIlB,IAAY,QAAS,CACvB,MAAMW,EAAcL,EACpBW,EAAO,gBAAkBN,EAAY,SACrCM,EAAO,UAAY,yBACrB,CAGA,MAAME,EAA0B,CAC9B,QAASC,EAAAA,aAAa,SACtB,OAAQ,cACR,cAAe,MAAA,EASjB,MAAO,CAAE,KAAAb,EAAM,MAAAO,EAAO,OAAAG,EAAQ,SAAAE,EAAU,QALT,CAC7B,OAAQ,OACR,cAAe,MAAA,CAGuB,CAC1C"}
|
|
1
|
+
{"version":3,"file":"Button.styles.cjs","sources":["../../../../src/components/primitives/Button/Button.styles.ts"],"sourcesContent":["/**\r\n * Button Component Styles\r\n *\r\n * Size configuration for button icons and internal elements.\r\n * All color and visual styles are handled via CSS classes in button.css.\r\n *\r\n * @module components/primitives/Button\r\n */\r\n\r\nimport type { ButtonSize } from './Button.types'\r\nimport { iconSizes } from '../../../design-system'\r\n\r\n/**\r\n * Size configuration for button icons\r\n * Used by the component to size icons and loading spinners\r\n */\r\nexport const sizeConfig: Record<ButtonSize, { iconSize: number }> = {\r\n xs: { iconSize: iconSizes.xs },\r\n sm: { iconSize: iconSizes.sm },\r\n md: { iconSize: iconSizes.md },\r\n lg: { iconSize: iconSizes.lg },\r\n xl: { iconSize: iconSizes.xl },\r\n}\r\n"],"names":["sizeConfig","iconSizes"],"mappings":"gJAgBaA,EAAuD,CAClE,GAAI,CAAE,SAAUC,EAAAA,UAAU,EAAA,EAC1B,GAAI,CAAE,SAAUA,EAAAA,UAAU,EAAA,EAC1B,GAAI,CAAE,SAAUA,EAAAA,UAAU,EAAA,EAC1B,GAAI,CAAE,SAAUA,EAAAA,UAAU,EAAA,EAC1B,GAAI,CAAE,SAAUA,EAAAA,UAAU,EAAA,CAC5B"}
|