@aurora-ds/components 1.1.2 → 1.1.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/cjs/index.js +30 -28
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +30 -28
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +19 -0
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -27,13 +27,12 @@ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
|
27
27
|
function _extends$8() { return _extends$8 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$8.apply(null, arguments); }
|
|
28
28
|
const AlertErrorIcon = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$8({
|
|
29
29
|
xmlns: "http://www.w3.org/2000/svg",
|
|
30
|
-
width: 24,
|
|
31
|
-
height: 24,
|
|
32
30
|
fill: "none",
|
|
33
31
|
stroke: "currentColor",
|
|
34
32
|
strokeLinecap: "round",
|
|
35
33
|
strokeLinejoin: "round",
|
|
36
|
-
strokeWidth: 2
|
|
34
|
+
strokeWidth: 2,
|
|
35
|
+
viewBox: "0 0 24 24"
|
|
37
36
|
}, props), /*#__PURE__*/React__namespace.createElement("circle", {
|
|
38
37
|
cx: 12,
|
|
39
38
|
cy: 12,
|
|
@@ -45,13 +44,12 @@ const AlertErrorIcon = props => /*#__PURE__*/React__namespace.createElement("svg
|
|
|
45
44
|
function _extends$7() { return _extends$7 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$7.apply(null, arguments); }
|
|
46
45
|
const AlertInfoIcon = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$7({
|
|
47
46
|
xmlns: "http://www.w3.org/2000/svg",
|
|
48
|
-
width: 24,
|
|
49
|
-
height: 24,
|
|
50
47
|
fill: "none",
|
|
51
48
|
stroke: "currentColor",
|
|
52
49
|
strokeLinecap: "round",
|
|
53
50
|
strokeLinejoin: "round",
|
|
54
|
-
strokeWidth: 2
|
|
51
|
+
strokeWidth: 2,
|
|
52
|
+
viewBox: "0 0 24 24"
|
|
55
53
|
}, props), /*#__PURE__*/React__namespace.createElement("circle", {
|
|
56
54
|
cx: 12,
|
|
57
55
|
cy: 12,
|
|
@@ -63,13 +61,12 @@ const AlertInfoIcon = props => /*#__PURE__*/React__namespace.createElement("svg"
|
|
|
63
61
|
function _extends$6() { return _extends$6 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$6.apply(null, arguments); }
|
|
64
62
|
const AlertSuccessIcon = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$6({
|
|
65
63
|
xmlns: "http://www.w3.org/2000/svg",
|
|
66
|
-
width: 24,
|
|
67
|
-
height: 24,
|
|
68
64
|
fill: "none",
|
|
69
65
|
stroke: "currentColor",
|
|
70
66
|
strokeLinecap: "round",
|
|
71
67
|
strokeLinejoin: "round",
|
|
72
|
-
strokeWidth: 2
|
|
68
|
+
strokeWidth: 2,
|
|
69
|
+
viewBox: "0 0 24 24"
|
|
73
70
|
}, props), /*#__PURE__*/React__namespace.createElement("circle", {
|
|
74
71
|
cx: 12,
|
|
75
72
|
cy: 12,
|
|
@@ -81,13 +78,12 @@ const AlertSuccessIcon = props => /*#__PURE__*/React__namespace.createElement("s
|
|
|
81
78
|
function _extends$5() { return _extends$5 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$5.apply(null, arguments); }
|
|
82
79
|
const AlertWarningIcon = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$5({
|
|
83
80
|
xmlns: "http://www.w3.org/2000/svg",
|
|
84
|
-
width: 24,
|
|
85
|
-
height: 24,
|
|
86
81
|
fill: "none",
|
|
87
82
|
stroke: "currentColor",
|
|
88
83
|
strokeLinecap: "round",
|
|
89
84
|
strokeLinejoin: "round",
|
|
90
|
-
strokeWidth: 2
|
|
85
|
+
strokeWidth: 2,
|
|
86
|
+
viewBox: "0 0 24 24"
|
|
91
87
|
}, props), /*#__PURE__*/React__namespace.createElement("path", {
|
|
92
88
|
d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3M12 9v4M12 17h.01"
|
|
93
89
|
}));
|
|
@@ -95,14 +91,13 @@ const AlertWarningIcon = props => /*#__PURE__*/React__namespace.createElement("s
|
|
|
95
91
|
function _extends$4() { return _extends$4 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$4.apply(null, arguments); }
|
|
96
92
|
const ChevronDownIcon = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$4({
|
|
97
93
|
xmlns: "http://www.w3.org/2000/svg",
|
|
98
|
-
width: 24,
|
|
99
|
-
height: 24,
|
|
100
94
|
fill: "none",
|
|
101
95
|
stroke: "currentColor",
|
|
102
96
|
strokeLinecap: "round",
|
|
103
97
|
strokeLinejoin: "round",
|
|
104
98
|
strokeWidth: 2,
|
|
105
|
-
className: "
|
|
99
|
+
className: "lucide lucide-chevron-down-icon lucide-chevron-down",
|
|
100
|
+
viewBox: "0 0 24 24"
|
|
106
101
|
}, props), /*#__PURE__*/React__namespace.createElement("path", {
|
|
107
102
|
d: "m6 9 6 6 6-6"
|
|
108
103
|
}));
|
|
@@ -124,14 +119,13 @@ const CloseIcon = props => /*#__PURE__*/React__namespace.createElement("svg", _e
|
|
|
124
119
|
function _extends$2() { return _extends$2 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$2.apply(null, arguments); }
|
|
125
120
|
const EyeIcon = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$2({
|
|
126
121
|
xmlns: "http://www.w3.org/2000/svg",
|
|
127
|
-
width: 24,
|
|
128
|
-
height: 24,
|
|
129
122
|
fill: "none",
|
|
130
123
|
stroke: "currentColor",
|
|
131
124
|
strokeLinecap: "round",
|
|
132
125
|
strokeLinejoin: "round",
|
|
133
126
|
strokeWidth: 2,
|
|
134
|
-
className: "
|
|
127
|
+
className: "lucide lucide-eye-icon lucide-eye",
|
|
128
|
+
viewBox: "0 0 24 24"
|
|
135
129
|
}, props), /*#__PURE__*/React__namespace.createElement("path", {
|
|
136
130
|
d: "M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"
|
|
137
131
|
}), /*#__PURE__*/React__namespace.createElement("circle", {
|
|
@@ -143,14 +137,13 @@ const EyeIcon = props => /*#__PURE__*/React__namespace.createElement("svg", _ext
|
|
|
143
137
|
function _extends$1() { return _extends$1 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$1.apply(null, arguments); }
|
|
144
138
|
const EyeSlashIcon = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$1({
|
|
145
139
|
xmlns: "http://www.w3.org/2000/svg",
|
|
146
|
-
width: 24,
|
|
147
|
-
height: 24,
|
|
148
140
|
fill: "none",
|
|
149
141
|
stroke: "currentColor",
|
|
150
142
|
strokeLinecap: "round",
|
|
151
143
|
strokeLinejoin: "round",
|
|
152
144
|
strokeWidth: 2,
|
|
153
|
-
className: "
|
|
145
|
+
className: "lucide lucide-eye-off-icon lucide-eye-off",
|
|
146
|
+
viewBox: "0 0 24 24"
|
|
154
147
|
}, props), /*#__PURE__*/React__namespace.createElement("path", {
|
|
155
148
|
d: "M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.8 10.8 0 0 1-1.444 2.49M14.084 14.158a3 3 0 0 1-4.242-4.242"
|
|
156
149
|
}), /*#__PURE__*/React__namespace.createElement("path", {
|
|
@@ -2309,8 +2302,8 @@ const CardBody = ({ children, py = 'md', px = 'md', }) => {
|
|
|
2309
2302
|
};
|
|
2310
2303
|
CardBody.displayName = 'Card.Body';
|
|
2311
2304
|
|
|
2312
|
-
const CardBase = ({ ref, variant = 'outlined', className, children, ...rest }) => {
|
|
2313
|
-
return (jsxRuntime.jsx(Box, { ref: ref, className: theme.cx(CARD_VARIANTS({ variant }), className), ...rest, children: children }));
|
|
2305
|
+
const CardBase = ({ ref, variant = 'outlined', padding = 'none', className, children, ...rest }) => {
|
|
2306
|
+
return (jsxRuntime.jsx(Box, { ref: ref, padding: padding, className: theme.cx(CARD_VARIANTS({ variant }), className), ...rest, children: children }));
|
|
2314
2307
|
};
|
|
2315
2308
|
CardBase.displayName = 'Card';
|
|
2316
2309
|
const Card = CardBase;
|
|
@@ -2373,14 +2366,23 @@ const VARIANT_ICONS = {
|
|
|
2373
2366
|
warning: AlertWarningIcon,
|
|
2374
2367
|
info: AlertInfoIcon,
|
|
2375
2368
|
};
|
|
2369
|
+
/** Returns true if value is a React component type (function/class), false if it is a rendered node. */
|
|
2370
|
+
const isSvgComponent = (value) => typeof value === 'function';
|
|
2376
2371
|
/**
|
|
2377
2372
|
* Alert title row: renders the variant icon alongside the title text.
|
|
2378
2373
|
* Must be used inside an `<Alert>` component.
|
|
2379
2374
|
*/
|
|
2380
|
-
const AlertTitle = ({ children }) => {
|
|
2375
|
+
const AlertTitle = ({ children, icon }) => {
|
|
2381
2376
|
const { variant, accentColor } = useAlertContext();
|
|
2382
|
-
|
|
2383
|
-
|
|
2377
|
+
// Resolve which icon to render:
|
|
2378
|
+
// - custom icon prop always takes precedence over the built-in variant icon
|
|
2379
|
+
// - for "default" variant there is no built-in icon; custom icon adds one
|
|
2380
|
+
const builtInIcon = VARIANT_ICONS[variant];
|
|
2381
|
+
// Must be capitalised for JSX to treat it as a component (not an HTML tag)
|
|
2382
|
+
const ResolvedIcon = icon && isSvgComponent(icon) ? icon : (icon === undefined ? (builtInIcon ?? null) : null);
|
|
2383
|
+
const customNode = icon && !isSvgComponent(icon) ? icon : null;
|
|
2384
|
+
const hasIcon = ResolvedIcon !== null || customNode !== null;
|
|
2385
|
+
return (jsxRuntime.jsxs(Stack, { flexDirection: 'row', alignItems: 'center', gap: 'sm', children: [hasIcon && (jsxRuntime.jsx(Stack, { flexShrink: 0, alignItems: 'center', color: accentColor, width: '1.25rem', height: '1.25rem', "aria-hidden": true, children: ResolvedIcon ? (jsxRuntime.jsx(ResolvedIcon, { width: 20, height: 20 })) : (customNode) })), jsxRuntime.jsx(Text, { fontWeight: 'semibold', fontSize: 'sm', color: accentColor, children: children })] }));
|
|
2384
2386
|
};
|
|
2385
2387
|
AlertTitle.displayName = 'Alert.Title';
|
|
2386
2388
|
|
|
@@ -2414,9 +2416,9 @@ const VARIANT_ARIA_LIVE = {
|
|
|
2414
2416
|
* <Alert.Body>Your changes have been saved successfully.</Alert.Body>
|
|
2415
2417
|
* </Alert>
|
|
2416
2418
|
*/
|
|
2417
|
-
const AlertBase = ({ variant = 'default', children, width = '100%' }) => {
|
|
2419
|
+
const AlertBase = ({ variant = 'default', children, width = '100%', outline = false, shadow = 'none', }) => {
|
|
2418
2420
|
const { backgroundColor, borderColor, accentColor } = VARIANT_TOKENS[variant];
|
|
2419
|
-
return (jsxRuntime.jsx(AlertContext.Provider, { value: { variant, accentColor }, children: jsxRuntime.jsx(Stack, { role: 'alert', "aria-live": VARIANT_ARIA_LIVE[variant], flexDirection: 'column', gap: 'xs', padding: 'md', borderRadius: 'lg', backgroundColor: backgroundColor, borderColor: borderColor, borderWidth: '1px', borderStyle: 'solid', width: width, children: children }) }));
|
|
2421
|
+
return (jsxRuntime.jsx(AlertContext.Provider, { value: { variant, accentColor }, children: jsxRuntime.jsx(Stack, { role: 'alert', "aria-live": VARIANT_ARIA_LIVE[variant], flexDirection: 'column', gap: 'xs', padding: 'md', borderRadius: 'lg', backgroundColor: backgroundColor, borderColor: outline ? borderColor : undefined, borderWidth: outline ? '1px' : undefined, borderStyle: outline ? 'solid' : undefined, boxShadow: shadow, width: width, children: children }) }));
|
|
2420
2422
|
};
|
|
2421
2423
|
AlertBase.displayName = 'Alert';
|
|
2422
2424
|
const Alert = AlertBase;
|