draft-components 1.0.0-beta.13 → 1.0.0-beta.14
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.
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
const react = require('react');
|
|
4
5
|
const reactHelpers = require('../../lib/react-helpers.cjs');
|
|
5
6
|
|
|
6
|
-
function Alert({ icon = null, heading = null, variant = 'default', appearance = 'default', className, children, ...props }) {
|
|
7
|
+
const Alert = react.forwardRef(function Alert({ icon = null, heading = null, variant = 'default', appearance = 'default', className, children, ...props }) {
|
|
7
8
|
const shouldShowIcon = Boolean(icon);
|
|
8
9
|
const shouldRenderHeading = Boolean(heading);
|
|
9
10
|
const shouldRenderContent = Boolean(children);
|
|
@@ -13,6 +14,6 @@ function Alert({ icon = null, heading = null, variant = 'default', appearance =
|
|
|
13
14
|
[`dc-alert_variant_${variant}`]: variant,
|
|
14
15
|
[`dc-alert_appearance_${appearance}`]: appearance,
|
|
15
16
|
}), children: [shouldShowIcon && jsxRuntime.jsx("div", { className: "dc-alert__icon", children: icon }), jsxRuntime.jsxs("div", { className: "dc-alert__body", children: [shouldRenderHeading && (jsxRuntime.jsx("h1", { className: "dc-alert__title", children: heading })), shouldRenderContent && (jsxRuntime.jsx("div", { className: "dc-alert__content", children: children }))] })] }));
|
|
16
|
-
}
|
|
17
|
+
});
|
|
17
18
|
|
|
18
19
|
exports.Alert = Alert;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
2
3
|
import { classNames } from '../../lib/react-helpers.js';
|
|
3
4
|
|
|
4
|
-
function Alert({ icon = null, heading = null, variant = 'default', appearance = 'default', className, children, ...props }) {
|
|
5
|
+
const Alert = forwardRef(function Alert({ icon = null, heading = null, variant = 'default', appearance = 'default', className, children, ...props }) {
|
|
5
6
|
const shouldShowIcon = Boolean(icon);
|
|
6
7
|
const shouldRenderHeading = Boolean(heading);
|
|
7
8
|
const shouldRenderContent = Boolean(children);
|
|
@@ -11,6 +12,6 @@ function Alert({ icon = null, heading = null, variant = 'default', appearance =
|
|
|
11
12
|
[`dc-alert_variant_${variant}`]: variant,
|
|
12
13
|
[`dc-alert_appearance_${appearance}`]: appearance,
|
|
13
14
|
}), children: [shouldShowIcon && jsx("div", { className: "dc-alert__icon", children: icon }), jsxs("div", { className: "dc-alert__body", children: [shouldRenderHeading && (jsx("h1", { className: "dc-alert__title", children: heading })), shouldRenderContent && (jsx("div", { className: "dc-alert__content", children: children }))] })] }));
|
|
14
|
-
}
|
|
15
|
+
});
|
|
15
16
|
|
|
16
17
|
export { Alert };
|
package/package.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type ComponentPropsWithRef, type ReactNode } from 'react';
|
|
2
|
+
type AlertHTMLProps = ComponentPropsWithRef<'section'>;
|
|
2
3
|
export type AlertAppearance = 'default' | 'info' | 'success' | 'warning' | 'error';
|
|
3
4
|
export type AlertVariant = 'default' | 'full-width' | 'accent-border';
|
|
4
5
|
export type AlertProps = {
|
|
@@ -6,5 +7,6 @@ export type AlertProps = {
|
|
|
6
7
|
heading?: ReactNode;
|
|
7
8
|
variant?: AlertVariant;
|
|
8
9
|
appearance?: AlertAppearance;
|
|
9
|
-
} &
|
|
10
|
-
export declare
|
|
10
|
+
} & AlertHTMLProps;
|
|
11
|
+
export declare const Alert: import("react").ForwardRefExoticComponent<Pick<AlertProps, "key" | keyof import("react").HTMLAttributes<HTMLElement> | "icon" | "heading" | "variant" | "appearance"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
12
|
+
export {};
|