pixelize-design-library 2.3.1-beta.18 → 2.3.1-beta.19
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.
|
@@ -137,7 +137,9 @@ var Dropdown = (0, react_1.forwardRef)(function (_a, ref) {
|
|
|
137
137
|
background: (_l = (_k = theme.colors) === null || _k === void 0 ? void 0 : _k.gray) === null || _l === void 0 ? void 0 : _l[300],
|
|
138
138
|
borderRadius: "3px",
|
|
139
139
|
},
|
|
140
|
-
"&::-webkit-scrollbar-thumb:hover": {
|
|
140
|
+
"&::-webkit-scrollbar-thumb:hover": {
|
|
141
|
+
background: (_o = (_m = theme.colors) === null || _m === void 0 ? void 0 : _m.gray) === null || _o === void 0 ? void 0 : _o[400],
|
|
142
|
+
},
|
|
141
143
|
}, style: ListStyle }, options.map(function (option) {
|
|
142
144
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
143
145
|
return (react_1.default.createElement(react_2.ListItem, { key: option.id, onClick: function () { return handleListItemClick(option.id, option.label); }, mx: 1.5, px: s.px, py: s.py, borderRadius: "0.375rem", display: "flex", alignItems: "center", gap: 2, cursor: "pointer", color: (_c = (_b = (_a = theme.colors) === null || _a === void 0 ? void 0 : _a.text) === null || _b === void 0 ? void 0 : _b[700]) !== null && _c !== void 0 ? _c : (_e = (_d = theme.colors) === null || _d === void 0 ? void 0 : _d.gray) === null || _e === void 0 ? void 0 : _e[700], transition: "background 0.12s ease, color 0.12s ease", _hover: {
|
|
@@ -145,9 +147,11 @@ var Dropdown = (0, react_1.forwardRef)(function (_a, ref) {
|
|
|
145
147
|
color: (_o = (_m = (_l = theme.colors) === null || _l === void 0 ? void 0 : _l.primary) === null || _m === void 0 ? void 0 : _m[700]) !== null && _o !== void 0 ? _o : (_q = (_p = theme.colors) === null || _p === void 0 ? void 0 : _p.primary) === null || _q === void 0 ? void 0 : _q[600],
|
|
146
148
|
}, borderBottom: divider
|
|
147
149
|
? "0.063rem solid ".concat((_t = (_s = (_r = theme.colors) === null || _r === void 0 ? void 0 : _r.boxborder) === null || _s === void 0 ? void 0 : _s[100]) !== null && _t !== void 0 ? _t : (_u = theme.colors) === null || _u === void 0 ? void 0 : _u.gray[200])
|
|
148
|
-
: undefined, sx: { "&:last-child": { borderBottom: "none" } }, style: ItemStyle },
|
|
150
|
+
: undefined, sx: { "&:last-child": { borderBottom: "none" } }, style: ItemStyle, fontWeight: 500 },
|
|
149
151
|
(option === null || option === void 0 ? void 0 : option.image) && (react_1.default.createElement(react_2.Box, { as: option.image, boxSize: s.img, flexShrink: 0, color: (_w = (_v = theme.colors) === null || _v === void 0 ? void 0 : _v.gray) === null || _w === void 0 ? void 0 : _w[500], style: ImageStyle })),
|
|
150
|
-
react_1.default.createElement(react_2.Box, { as: "span", fontSize: s.fontSize, isTruncated: true,
|
|
152
|
+
react_1.default.createElement(react_2.Box, { as: "span", fontSize: s.fontSize, isTruncated: true,
|
|
153
|
+
// fontWeight={400}
|
|
154
|
+
style: LabelStyle }, option.label)));
|
|
151
155
|
})));
|
|
152
156
|
};
|
|
153
157
|
return (react_1.default.createElement(react_2.Box, { ref: dropdownRef, position: "relative", display: "inline-block" },
|
|
@@ -17,23 +17,38 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
var react_1 = __importDefault(require("react"));
|
|
18
18
|
var react_2 = require("@chakra-ui/react");
|
|
19
19
|
var lucide_react_1 = require("lucide-react");
|
|
20
|
+
var useCustomTheme_1 = require("../../Theme/useCustomTheme");
|
|
20
21
|
var sizeMap = {
|
|
21
22
|
sm: { px: "12px", py: "4px", font: "12px", sub: "8px", icon: 11, radius: "40px" },
|
|
22
23
|
md: { px: "20px", py: "5px", font: "14px", sub: "10px", icon: 13, radius: "50px" },
|
|
23
24
|
lg: { px: "26px", py: "8px", font: "16px", sub: "11px", icon: 16, radius: "60px" },
|
|
24
25
|
};
|
|
25
|
-
var
|
|
26
|
+
var FALLBACK_GRADIENT = { from: "#667eea", to: "#764ba2" };
|
|
26
27
|
var UpgradeButton = function (_a) {
|
|
27
|
-
var
|
|
28
|
+
var _b, _c;
|
|
29
|
+
var label = _a.label, mobileLabel = _a.mobileLabel, subtitle = _a.subtitle, _d = _a.icon, icon = _d === void 0 ? lucide_react_1.Sparkles : _d, _e = _a.iconColor, iconColor = _e === void 0 ? "#FFD66B" : _e, _f = _a.variant, variant = _f === void 0 ? "brand" : _f, gradient = _a.gradient, _g = _a.size, size = _g === void 0 ? "md" : _g, _h = _a.shimmer, shimmer = _h === void 0 ? true : _h, _j = _a.isLoading, isLoading = _j === void 0 ? false : _j, _k = _a.isDisabled, isDisabled = _k === void 0 ? false : _k, _l = _a.maxLabelWidth, maxLabelWidth = _l === void 0 ? "160px" : _l, ariaLabel = _a.ariaLabel, onClick = _a.onClick;
|
|
30
|
+
var theme = (0, useCustomTheme_1.useCustomTheme)();
|
|
31
|
+
var c = theme.colors;
|
|
32
|
+
var themeGradient = (_b = c.gradient) !== null && _b !== void 0 ? _b : FALLBACK_GRADIENT;
|
|
33
|
+
var variantGradient = {
|
|
34
|
+
brand: themeGradient,
|
|
35
|
+
primary: { from: c.primary[500], to: c.primary[700] },
|
|
36
|
+
secondary: { from: c.secondary[400], to: c.secondary[600] },
|
|
37
|
+
success: { from: c.semantic.success[400], to: c.semantic.success[600] },
|
|
38
|
+
warning: { from: c.semantic.warning[400], to: c.semantic.warning[600] },
|
|
39
|
+
danger: { from: c.semantic.error[400], to: c.semantic.error[600] },
|
|
40
|
+
info: { from: c.semantic.info[400], to: c.semantic.info[600] },
|
|
41
|
+
};
|
|
42
|
+
var resolved = (_c = gradient !== null && gradient !== void 0 ? gradient : variantGradient[variant]) !== null && _c !== void 0 ? _c : themeGradient;
|
|
28
43
|
var s = sizeMap[size];
|
|
29
44
|
var Icon = icon;
|
|
30
45
|
var blocked = isLoading || isDisabled;
|
|
31
|
-
var g = "linear-gradient(135deg, ".concat(
|
|
32
|
-
var gReversed = "linear-gradient(135deg, ".concat(
|
|
46
|
+
var g = "linear-gradient(135deg, ".concat(resolved.from, " 0%, ").concat(resolved.to, " 100%)");
|
|
47
|
+
var gReversed = "linear-gradient(135deg, ".concat(resolved.to, " 0%, ").concat(resolved.from, " 100%)");
|
|
33
48
|
var hasMobile = !!mobileLabel && mobileLabel !== label;
|
|
34
|
-
return (react_1.default.createElement(react_2.Box, { as: "button", type: "button", "aria-label": ariaLabel || label, onClick: blocked ? undefined : onClick, disabled: isDisabled, position: "relative", cursor: blocked ? "default" : "pointer", opacity: isDisabled ? 0.6 : 1, px: { base: s.px === "20px" ? "14px" : s.px, md: s.px }, py: s.py, bgImage: g, color: "white", borderRadius: s.radius, fontWeight: "bold", textAlign: "center", overflow: "hidden", display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", transition: "transform 0.3s ease, box-shadow 0.3s ease, background-image 0.3s ease", _focusVisible: { outline: "none", boxShadow: "0 0 0 3px ".concat(
|
|
49
|
+
return (react_1.default.createElement(react_2.Box, { as: "button", type: "button", "aria-label": ariaLabel || label, onClick: blocked ? undefined : onClick, disabled: isDisabled, position: "relative", cursor: blocked ? "default" : "pointer", opacity: isDisabled ? 0.6 : 1, px: { base: s.px === "20px" ? "14px" : s.px, md: s.px }, py: s.py, bgImage: g, color: "white", borderRadius: s.radius, fontWeight: "bold", textAlign: "center", overflow: "hidden", display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", transition: "transform 0.3s ease, box-shadow 0.3s ease, background-image 0.3s ease", _focusVisible: { outline: "none", boxShadow: "0 0 0 3px ".concat(resolved.from, "55") }, _hover: blocked
|
|
35
50
|
? undefined
|
|
36
|
-
: __assign({ transform: "translateY(-2px)", bgImage: gReversed, boxShadow: "0 10px 30px ".concat(
|
|
51
|
+
: __assign({ transform: "translateY(-2px)", bgImage: gReversed, boxShadow: "0 10px 30px ".concat(resolved.from, "66") }, (shimmer ? { _before: { left: "130%" } } : {})), sx: shimmer
|
|
37
52
|
? {
|
|
38
53
|
_before: {
|
|
39
54
|
content: '""',
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { ElementType } from "react";
|
|
2
2
|
export type UpgradeButtonSize = "sm" | "md" | "lg";
|
|
3
|
+
/**
|
|
4
|
+
* Theme-aware color variants. Each resolves to a gradient built from the
|
|
5
|
+
* active theme's tokens, so the button blends with whichever theme is active.
|
|
6
|
+
*/
|
|
7
|
+
export type UpgradeButtonVariant = "brand" | "primary" | "secondary" | "success" | "warning" | "danger" | "info";
|
|
3
8
|
export interface UpgradeButtonProps {
|
|
4
9
|
/** Primary label (shown on md+ screens). */
|
|
5
10
|
label: string;
|
|
@@ -11,7 +16,15 @@ export interface UpgradeButtonProps {
|
|
|
11
16
|
icon?: ElementType | null;
|
|
12
17
|
/** Icon color. Defaults to a gold tone. */
|
|
13
18
|
iconColor?: string;
|
|
14
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* Theme-aware color variant. Defaults to `brand` (the active theme's
|
|
21
|
+
* gradient). Ignored when an explicit `gradient` is provided.
|
|
22
|
+
*/
|
|
23
|
+
variant?: UpgradeButtonVariant;
|
|
24
|
+
/**
|
|
25
|
+
* Explicit gradient stops. Overrides `variant` and the theme gradient when
|
|
26
|
+
* provided.
|
|
27
|
+
*/
|
|
15
28
|
gradient?: {
|
|
16
29
|
from: string;
|
|
17
30
|
to: string;
|