@aurora-ds/components 1.1.3 → 1.1.5
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 +18 -9
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +18 -9
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +17 -4
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -2292,13 +2292,13 @@ const CARD_VARIANTS = theme.createVariants((theme) => ({
|
|
|
2292
2292
|
defaultVariants: { variant: 'elevated' },
|
|
2293
2293
|
}), { id: 'card' });
|
|
2294
2294
|
|
|
2295
|
-
const CardHeader = ({ label, icon, actions }) => {
|
|
2296
|
-
return (jsxRuntime.jsxs(Stack, { alignItems:
|
|
2295
|
+
const CardHeader = ({ label, icon, actions, flexDirection = 'row', gap = 'sm', alignItems = 'center', justifyContent = 'space-between', py = 'sm', px = 'md', ...rest }) => {
|
|
2296
|
+
return (jsxRuntime.jsxs(Stack, { flexDirection: flexDirection, alignItems: alignItems, justifyContent: justifyContent, gap: gap, py: py, px: px, ...rest, children: [jsxRuntime.jsxs(Stack, { alignItems: 'center', gap: 'sm', flex: 1, minWidth: '0', children: [icon !== undefined && (jsxRuntime.jsx(Icon, { icon: icon, size: 'md', strokeColor: 'textSecondary' })), jsxRuntime.jsx(Text, { variant: 'span', fontSize: 'sm', fontWeight: 'semibold', color: 'textPrimary', children: label })] }), actions !== undefined && (jsxRuntime.jsx(Stack, { alignItems: 'center', gap: 'xs', flexShrink: 0, children: actions }))] }));
|
|
2297
2297
|
};
|
|
2298
2298
|
CardHeader.displayName = 'Card.Header';
|
|
2299
2299
|
|
|
2300
|
-
const CardBody = ({ children, py = 'md', px = 'md', }) => {
|
|
2301
|
-
return (jsxRuntime.jsx(
|
|
2300
|
+
const CardBody = ({ children, py = 'md', px = 'md', flexDirection = 'column', gap = 'sm', ...rest }) => {
|
|
2301
|
+
return (jsxRuntime.jsx(Stack, { flexDirection: flexDirection, gap: gap, py: py, px: px, ...rest, children: children }));
|
|
2302
2302
|
};
|
|
2303
2303
|
CardBody.displayName = 'Card.Body';
|
|
2304
2304
|
|
|
@@ -2366,14 +2366,23 @@ const VARIANT_ICONS = {
|
|
|
2366
2366
|
warning: AlertWarningIcon,
|
|
2367
2367
|
info: AlertInfoIcon,
|
|
2368
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';
|
|
2369
2371
|
/**
|
|
2370
2372
|
* Alert title row: renders the variant icon alongside the title text.
|
|
2371
2373
|
* Must be used inside an `<Alert>` component.
|
|
2372
2374
|
*/
|
|
2373
|
-
const AlertTitle = ({ children }) => {
|
|
2375
|
+
const AlertTitle = ({ children, icon }) => {
|
|
2374
2376
|
const { variant, accentColor } = useAlertContext();
|
|
2375
|
-
|
|
2376
|
-
|
|
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 })] }));
|
|
2377
2386
|
};
|
|
2378
2387
|
AlertTitle.displayName = 'Alert.Title';
|
|
2379
2388
|
|
|
@@ -2407,9 +2416,9 @@ const VARIANT_ARIA_LIVE = {
|
|
|
2407
2416
|
* <Alert.Body>Your changes have been saved successfully.</Alert.Body>
|
|
2408
2417
|
* </Alert>
|
|
2409
2418
|
*/
|
|
2410
|
-
const AlertBase = ({ variant = 'default', children, width = '100%' }) => {
|
|
2419
|
+
const AlertBase = ({ variant = 'default', children, width = '100%', outline = false, shadow = 'none', }) => {
|
|
2411
2420
|
const { backgroundColor, borderColor, accentColor } = VARIANT_TOKENS[variant];
|
|
2412
|
-
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 }) }));
|
|
2413
2422
|
};
|
|
2414
2423
|
AlertBase.displayName = 'Alert';
|
|
2415
2424
|
const Alert = AlertBase;
|