@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/esm/index.js CHANGED
@@ -7,13 +7,12 @@ import { createPortal } from 'react-dom';
7
7
  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); }
8
8
  const AlertErrorIcon = props => /*#__PURE__*/React.createElement("svg", _extends$8({
9
9
  xmlns: "http://www.w3.org/2000/svg",
10
- width: 24,
11
- height: 24,
12
10
  fill: "none",
13
11
  stroke: "currentColor",
14
12
  strokeLinecap: "round",
15
13
  strokeLinejoin: "round",
16
- strokeWidth: 2
14
+ strokeWidth: 2,
15
+ viewBox: "0 0 24 24"
17
16
  }, props), /*#__PURE__*/React.createElement("circle", {
18
17
  cx: 12,
19
18
  cy: 12,
@@ -25,13 +24,12 @@ const AlertErrorIcon = props => /*#__PURE__*/React.createElement("svg", _extends
25
24
  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); }
26
25
  const AlertInfoIcon = props => /*#__PURE__*/React.createElement("svg", _extends$7({
27
26
  xmlns: "http://www.w3.org/2000/svg",
28
- width: 24,
29
- height: 24,
30
27
  fill: "none",
31
28
  stroke: "currentColor",
32
29
  strokeLinecap: "round",
33
30
  strokeLinejoin: "round",
34
- strokeWidth: 2
31
+ strokeWidth: 2,
32
+ viewBox: "0 0 24 24"
35
33
  }, props), /*#__PURE__*/React.createElement("circle", {
36
34
  cx: 12,
37
35
  cy: 12,
@@ -43,13 +41,12 @@ const AlertInfoIcon = props => /*#__PURE__*/React.createElement("svg", _extends$
43
41
  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); }
44
42
  const AlertSuccessIcon = props => /*#__PURE__*/React.createElement("svg", _extends$6({
45
43
  xmlns: "http://www.w3.org/2000/svg",
46
- width: 24,
47
- height: 24,
48
44
  fill: "none",
49
45
  stroke: "currentColor",
50
46
  strokeLinecap: "round",
51
47
  strokeLinejoin: "round",
52
- strokeWidth: 2
48
+ strokeWidth: 2,
49
+ viewBox: "0 0 24 24"
53
50
  }, props), /*#__PURE__*/React.createElement("circle", {
54
51
  cx: 12,
55
52
  cy: 12,
@@ -61,13 +58,12 @@ const AlertSuccessIcon = props => /*#__PURE__*/React.createElement("svg", _exten
61
58
  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); }
62
59
  const AlertWarningIcon = props => /*#__PURE__*/React.createElement("svg", _extends$5({
63
60
  xmlns: "http://www.w3.org/2000/svg",
64
- width: 24,
65
- height: 24,
66
61
  fill: "none",
67
62
  stroke: "currentColor",
68
63
  strokeLinecap: "round",
69
64
  strokeLinejoin: "round",
70
- strokeWidth: 2
65
+ strokeWidth: 2,
66
+ viewBox: "0 0 24 24"
71
67
  }, props), /*#__PURE__*/React.createElement("path", {
72
68
  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"
73
69
  }));
@@ -75,14 +71,13 @@ const AlertWarningIcon = props => /*#__PURE__*/React.createElement("svg", _exten
75
71
  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); }
76
72
  const ChevronDownIcon = props => /*#__PURE__*/React.createElement("svg", _extends$4({
77
73
  xmlns: "http://www.w3.org/2000/svg",
78
- width: 24,
79
- height: 24,
80
74
  fill: "none",
81
75
  stroke: "currentColor",
82
76
  strokeLinecap: "round",
83
77
  strokeLinejoin: "round",
84
78
  strokeWidth: 2,
85
- className: "prefix__lucide prefix__lucide-chevron-down-icon prefix__lucide-chevron-down"
79
+ className: "lucide lucide-chevron-down-icon lucide-chevron-down",
80
+ viewBox: "0 0 24 24"
86
81
  }, props), /*#__PURE__*/React.createElement("path", {
87
82
  d: "m6 9 6 6 6-6"
88
83
  }));
@@ -104,14 +99,13 @@ const CloseIcon = props => /*#__PURE__*/React.createElement("svg", _extends$3({
104
99
  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); }
105
100
  const EyeIcon = props => /*#__PURE__*/React.createElement("svg", _extends$2({
106
101
  xmlns: "http://www.w3.org/2000/svg",
107
- width: 24,
108
- height: 24,
109
102
  fill: "none",
110
103
  stroke: "currentColor",
111
104
  strokeLinecap: "round",
112
105
  strokeLinejoin: "round",
113
106
  strokeWidth: 2,
114
- className: "prefix__lucide prefix__lucide-eye-icon prefix__lucide-eye"
107
+ className: "lucide lucide-eye-icon lucide-eye",
108
+ viewBox: "0 0 24 24"
115
109
  }, props), /*#__PURE__*/React.createElement("path", {
116
110
  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"
117
111
  }), /*#__PURE__*/React.createElement("circle", {
@@ -123,14 +117,13 @@ const EyeIcon = props => /*#__PURE__*/React.createElement("svg", _extends$2({
123
117
  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); }
124
118
  const EyeSlashIcon = props => /*#__PURE__*/React.createElement("svg", _extends$1({
125
119
  xmlns: "http://www.w3.org/2000/svg",
126
- width: 24,
127
- height: 24,
128
120
  fill: "none",
129
121
  stroke: "currentColor",
130
122
  strokeLinecap: "round",
131
123
  strokeLinejoin: "round",
132
124
  strokeWidth: 2,
133
- className: "prefix__lucide prefix__lucide-eye-off-icon prefix__lucide-eye-off"
125
+ className: "lucide lucide-eye-off-icon lucide-eye-off",
126
+ viewBox: "0 0 24 24"
134
127
  }, props), /*#__PURE__*/React.createElement("path", {
135
128
  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"
136
129
  }), /*#__PURE__*/React.createElement("path", {
@@ -2289,8 +2282,8 @@ const CardBody = ({ children, py = 'md', px = 'md', }) => {
2289
2282
  };
2290
2283
  CardBody.displayName = 'Card.Body';
2291
2284
 
2292
- const CardBase = ({ ref, variant = 'outlined', className, children, ...rest }) => {
2293
- return (jsx(Box, { ref: ref, className: cx(CARD_VARIANTS({ variant }), className), ...rest, children: children }));
2285
+ const CardBase = ({ ref, variant = 'outlined', padding = 'none', className, children, ...rest }) => {
2286
+ return (jsx(Box, { ref: ref, padding: padding, className: cx(CARD_VARIANTS({ variant }), className), ...rest, children: children }));
2294
2287
  };
2295
2288
  CardBase.displayName = 'Card';
2296
2289
  const Card = CardBase;
@@ -2353,14 +2346,23 @@ const VARIANT_ICONS = {
2353
2346
  warning: AlertWarningIcon,
2354
2347
  info: AlertInfoIcon,
2355
2348
  };
2349
+ /** Returns true if value is a React component type (function/class), false if it is a rendered node. */
2350
+ const isSvgComponent = (value) => typeof value === 'function';
2356
2351
  /**
2357
2352
  * Alert title row: renders the variant icon alongside the title text.
2358
2353
  * Must be used inside an `<Alert>` component.
2359
2354
  */
2360
- const AlertTitle = ({ children }) => {
2355
+ const AlertTitle = ({ children, icon }) => {
2361
2356
  const { variant, accentColor } = useAlertContext();
2362
- const IconComponent = VARIANT_ICONS[variant];
2363
- return (jsxs(Stack, { flexDirection: 'row', alignItems: 'center', gap: 'sm', children: [IconComponent && (jsx(Stack, { flexShrink: 0, alignItems: 'center', color: accentColor, width: '1.25rem', height: '1.25rem', "aria-hidden": true, children: jsx(IconComponent, { width: 20, height: 20 }) })), jsx(Text, { fontWeight: 'semibold', fontSize: 'sm', color: accentColor, children: children })] }));
2357
+ // Resolve which icon to render:
2358
+ // - custom icon prop always takes precedence over the built-in variant icon
2359
+ // - for "default" variant there is no built-in icon; custom icon adds one
2360
+ const builtInIcon = VARIANT_ICONS[variant];
2361
+ // Must be capitalised for JSX to treat it as a component (not an HTML tag)
2362
+ const ResolvedIcon = icon && isSvgComponent(icon) ? icon : (icon === undefined ? (builtInIcon ?? null) : null);
2363
+ const customNode = icon && !isSvgComponent(icon) ? icon : null;
2364
+ const hasIcon = ResolvedIcon !== null || customNode !== null;
2365
+ return (jsxs(Stack, { flexDirection: 'row', alignItems: 'center', gap: 'sm', children: [hasIcon && (jsx(Stack, { flexShrink: 0, alignItems: 'center', color: accentColor, width: '1.25rem', height: '1.25rem', "aria-hidden": true, children: ResolvedIcon ? (jsx(ResolvedIcon, { width: 20, height: 20 })) : (customNode) })), jsx(Text, { fontWeight: 'semibold', fontSize: 'sm', color: accentColor, children: children })] }));
2364
2366
  };
2365
2367
  AlertTitle.displayName = 'Alert.Title';
2366
2368
 
@@ -2394,9 +2396,9 @@ const VARIANT_ARIA_LIVE = {
2394
2396
  * <Alert.Body>Your changes have been saved successfully.</Alert.Body>
2395
2397
  * </Alert>
2396
2398
  */
2397
- const AlertBase = ({ variant = 'default', children, width = '100%' }) => {
2399
+ const AlertBase = ({ variant = 'default', children, width = '100%', outline = false, shadow = 'none', }) => {
2398
2400
  const { backgroundColor, borderColor, accentColor } = VARIANT_TOKENS[variant];
2399
- return (jsx(AlertContext.Provider, { value: { variant, accentColor }, children: 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 }) }));
2401
+ return (jsx(AlertContext.Provider, { value: { variant, accentColor }, children: 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 }) }));
2400
2402
  };
2401
2403
  AlertBase.displayName = 'Alert';
2402
2404
  const Alert = AlertBase;