@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/esm/index.js
CHANGED
|
@@ -32281,12 +32281,15 @@ function AssistantPreview(props) {
|
|
|
32281
32281
|
|
|
32282
32282
|
// Define defaultProps for the Banner component.
|
|
32283
32283
|
Banner.defaultProps = {
|
|
32284
|
+
allowDismiss: true,
|
|
32284
32285
|
classNames: "",
|
|
32285
32286
|
hidden: false,
|
|
32286
32287
|
};
|
|
32287
32288
|
function Banner(props) {
|
|
32288
|
-
var _a;
|
|
32289
|
-
|
|
32289
|
+
var _a = __read(useState(true), 2), isDismissed = _a[0], setIsDismissed = _a[1];
|
|
32290
|
+
useEffect(function () {
|
|
32291
|
+
setIsDismissed(props.hidden);
|
|
32292
|
+
}, [props.hidden]);
|
|
32290
32293
|
return isDismissed ? (React__default.createElement(React__default.Fragment, null)) : (React__default.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) },
|
|
32291
32294
|
React__default.createElement("div", { className: "s-flex s-flex-1" }),
|
|
32292
32295
|
React__default.createElement("div", { className: "s-flex s-flex-row s-flex-wrap s-items-center s-gap-4" },
|
|
@@ -32296,7 +32299,12 @@ function Banner(props) {
|
|
|
32296
32299
|
props.label),
|
|
32297
32300
|
props.ctaLabel && (React__default.createElement(Button, { label: props.ctaLabel, variant: "tertiary", onClick: props.onClick }))),
|
|
32298
32301
|
React__default.createElement("div", { className: "s-flex s-flex-1 s-justify-end" },
|
|
32299
|
-
React__default.createElement("a", { className: "focus-visible:outline-offset-[-4px] s--m-3 s-p-3", onClick: function () {
|
|
32302
|
+
React__default.createElement("a", { className: "focus-visible:outline-offset-[-4px] s--m-3 s-p-3", onClick: function () {
|
|
32303
|
+
setIsDismissed(true);
|
|
32304
|
+
if (props.onDismiss) {
|
|
32305
|
+
props.onDismiss();
|
|
32306
|
+
}
|
|
32307
|
+
} },
|
|
32300
32308
|
React__default.createElement("span", { className: "s-sr-only" }, "Dismiss"),
|
|
32301
32309
|
React__default.createElement(SvgXMark$1, { className: "s-h-5 s-w-5 s-text-white", "aria-hidden": "true" })))));
|
|
32302
32310
|
}
|