@dust-tt/sparkle 0.2.68-alpha → 0.2.68-alpha-2
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,15 +1,18 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
interface BannerProps {
|
|
3
|
+
allowDismiss: boolean;
|
|
3
4
|
classNames: string;
|
|
4
5
|
ctaLabel?: string;
|
|
5
6
|
hidden: boolean;
|
|
6
7
|
label: string;
|
|
7
8
|
onClick?: () => void;
|
|
9
|
+
onDismiss?: () => void;
|
|
8
10
|
title: string;
|
|
9
11
|
}
|
|
10
12
|
export declare function Banner(props: BannerProps): React.JSX.Element;
|
|
11
13
|
export declare namespace Banner {
|
|
12
14
|
var defaultProps: {
|
|
15
|
+
allowDismiss: boolean;
|
|
13
16
|
classNames: string;
|
|
14
17
|
hidden: boolean;
|
|
15
18
|
};
|
package/dist/cjs/index.js
CHANGED
|
@@ -32301,12 +32301,15 @@ function AssistantPreview(props) {
|
|
|
32301
32301
|
|
|
32302
32302
|
// Define defaultProps for the Banner component.
|
|
32303
32303
|
Banner.defaultProps = {
|
|
32304
|
+
allowDismiss: true,
|
|
32304
32305
|
classNames: "",
|
|
32305
32306
|
hidden: false,
|
|
32306
32307
|
};
|
|
32307
32308
|
function Banner(props) {
|
|
32308
|
-
var _a;
|
|
32309
|
-
|
|
32309
|
+
var _a = __read(React.useState(true), 2), isDismissed = _a[0], setIsDismissed = _a[1];
|
|
32310
|
+
React.useEffect(function () {
|
|
32311
|
+
setIsDismissed(props.hidden);
|
|
32312
|
+
}, [props.hidden]);
|
|
32310
32313
|
return isDismissed ? (React.createElement(React.Fragment, null)) : (React.createElement("div", { className: classNames("sm:s-before:flex-1 s-flex s-items-center s-gap-x-6 s-px-6 s-py-2.5 sm:s-px-3.5", props.classNames) },
|
|
32311
32314
|
React.createElement("div", { className: "s-flex s-flex-1" }),
|
|
32312
32315
|
React.createElement("div", { className: "s-flex s-flex-row s-flex-wrap s-items-center s-gap-4" },
|
|
@@ -32316,7 +32319,12 @@ function Banner(props) {
|
|
|
32316
32319
|
props.label),
|
|
32317
32320
|
props.ctaLabel && (React.createElement(Button, { label: props.ctaLabel, variant: "tertiary", onClick: props.onClick }))),
|
|
32318
32321
|
React.createElement("div", { className: "s-flex s-flex-1 s-justify-end" },
|
|
32319
|
-
React.createElement("a", { className: "focus-visible:outline-offset-[-4px] s--m-3 s-p-3", onClick: function () {
|
|
32322
|
+
React.createElement("a", { className: "focus-visible:outline-offset-[-4px] s--m-3 s-p-3", onClick: function () {
|
|
32323
|
+
setIsDismissed(true);
|
|
32324
|
+
if (props.onDismiss) {
|
|
32325
|
+
props.onDismiss();
|
|
32326
|
+
}
|
|
32327
|
+
} },
|
|
32320
32328
|
React.createElement("span", { className: "s-sr-only" }, "Dismiss"),
|
|
32321
32329
|
React.createElement(SvgXMark$1, { className: "s-h-5 s-w-5 s-text-white", "aria-hidden": "true" })))));
|
|
32322
32330
|
}
|