braid-design-system 33.10.2 → 33.11.0
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/CHANGELOG.md +31 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/lib/components/PageBlock/PageBlock.cjs +2 -3
- package/dist/lib/components/PageBlock/PageBlock.mjs +3 -4
- package/dist/lib/components/PageBlock/pageBlockGutters.cjs +3 -0
- package/dist/lib/components/PageBlock/pageBlockGutters.mjs +4 -0
- package/dist/lib/components/RadioGroup/RadioGroup.cjs +0 -1
- package/dist/lib/components/RadioGroup/RadioGroup.mjs +0 -1
- package/dist/lib/components/TooltipRenderer/TooltipRenderer.cjs +21 -8
- package/dist/lib/components/TooltipRenderer/TooltipRenderer.mjs +21 -8
- package/dist/lib/components/private/Modal/ModalContent.cjs +3 -3
- package/dist/lib/components/private/Modal/ModalContent.mjs +3 -3
- package/dist/lib/components/useToast/Toast.cjs +67 -51
- package/dist/lib/components/useToast/Toast.css.cjs +10 -0
- package/dist/lib/components/useToast/Toast.css.mjs +10 -0
- package/dist/lib/components/useToast/Toast.mjs +68 -52
- package/dist/lib/components/useToast/Toaster.cjs +49 -20
- package/dist/lib/components/useToast/Toaster.css.cjs +18 -0
- package/dist/lib/components/useToast/Toaster.css.mjs +19 -0
- package/dist/lib/components/useToast/Toaster.mjs +49 -22
- package/dist/lib/components/useToast/consts.cjs +5 -0
- package/dist/lib/components/useToast/consts.mjs +6 -0
- package/dist/lib/components/useToast/useFlipList.cjs +116 -33
- package/dist/lib/components/useToast/useFlipList.mjs +116 -33
- package/dist/lib/themes/baseTokens/nvl.cjs +7 -10
- package/dist/lib/themes/baseTokens/nvl.mjs +7 -10
- package/dist/lib/themes/makeVanillaTheme.cjs +10 -10
- package/dist/lib/themes/makeVanillaTheme.mjs +1 -1
- package/dist/lib/utils/px.cjs +3 -0
- package/dist/lib/utils/px.mjs +4 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# braid-design-system
|
|
2
2
|
|
|
3
|
+
## 33.11.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- **useToast**: Improve layout of toasts when multiple toasts are shown ([#1782](https://github.com/seek-oss/braid-design-system/pull/1782))
|
|
8
|
+
|
|
9
|
+
When multiple toasts are shown simultaneously, they now visually stack in a collapsed format that expands on interaction.
|
|
10
|
+
This prevents toasts from obscuring page content while providing users with an easy way to manage and navigate through the recent toast history.
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- **RadioGroup:** Ensure provided `id` is assigned to `fieldset` ([#1845](https://github.com/seek-oss/braid-design-system/pull/1845))
|
|
15
|
+
|
|
16
|
+
Fixes a bug where the provided `id` was not being passed through to the `fieldset` element.
|
|
17
|
+
|
|
18
|
+
- **seekJobs, seekBusiness:** Update drop shadow palette ([#1847](https://github.com/seek-oss/braid-design-system/pull/1847))
|
|
19
|
+
|
|
20
|
+
Refine the drop shadow palette values of `small`, `medium`, and `large`.
|
|
21
|
+
The shadow values are now softer and more linear in their scale.
|
|
22
|
+
|
|
23
|
+
- **TooltipRenderer:** Optimise performance by reducing unnecessary recalculations of the trigger position ([#1833](https://github.com/seek-oss/braid-design-system/pull/1833))
|
|
24
|
+
|
|
25
|
+
- **seekJobs, seekBusiness:** Increase medium font weight ([#1843](https://github.com/seek-oss/braid-design-system/pull/1843))
|
|
26
|
+
|
|
27
|
+
The introduction of Traditional Chinese support means characters in this unicode range are rendered using the default `sans-serif` font.
|
|
28
|
+
The system fonts that handle these characters only cater for **regular** and **bold** weights, resulting in the `medium` weight of 500 falling back to 400 — resulting in loss of visual hierarchy.
|
|
29
|
+
|
|
30
|
+
By increasing the weight of `medium` to 600, it will now round up to 700 (`strong`) when the rendered font cannot satisfy `medium`.
|
|
31
|
+
|
|
32
|
+
This only affects `seekJobs` and `seekBusiness` themes rendering Traditional Chinese characters, all weights across other character sets remain unchanged.
|
|
33
|
+
|
|
3
34
|
## 33.10.2
|
|
4
35
|
|
|
5
36
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -3666,7 +3666,7 @@ type RadioGroupBaseProps<Value = NonNullable<string | number>> = FieldGroupBaseP
|
|
|
3666
3666
|
type RadioGroupLabelProps = FieldLabelVariant;
|
|
3667
3667
|
type RadioGroupProps<Value = NonNullable<string | number>> = RadioGroupBaseProps<Value> & RadioGroupLabelProps;
|
|
3668
3668
|
declare const RadioGroup$1: {
|
|
3669
|
-
({
|
|
3669
|
+
({ children, value, name, onChange, disabled, tone, size, ...props }: RadioGroupProps): react.JSX.Element;
|
|
3670
3670
|
displayName: string;
|
|
3671
3671
|
};
|
|
3672
3672
|
|
package/dist/index.d.ts
CHANGED
|
@@ -3666,7 +3666,7 @@ type RadioGroupBaseProps<Value = NonNullable<string | number>> = FieldGroupBaseP
|
|
|
3666
3666
|
type RadioGroupLabelProps = FieldLabelVariant;
|
|
3667
3667
|
type RadioGroupProps<Value = NonNullable<string | number>> = RadioGroupBaseProps<Value> & RadioGroupLabelProps;
|
|
3668
3668
|
declare const RadioGroup$1: {
|
|
3669
|
-
({
|
|
3669
|
+
({ children, value, name, onChange, disabled, tone, size, ...props }: RadioGroupProps): react.JSX.Element;
|
|
3670
3670
|
displayName: string;
|
|
3671
3671
|
};
|
|
3672
3672
|
|
|
@@ -3,6 +3,7 @@ const jsxRuntime = require("react/jsx-runtime");
|
|
|
3
3
|
const lib_components_Box_Box_cjs = require("../Box/Box.cjs");
|
|
4
4
|
const lib_components_ContentBlock_ContentBlock_cjs = require("../ContentBlock/ContentBlock.cjs");
|
|
5
5
|
const lib_components_private_buildDataAttributes_cjs = require("../private/buildDataAttributes.cjs");
|
|
6
|
+
const lib_components_PageBlock_pageBlockGutters_cjs = require("./pageBlockGutters.cjs");
|
|
6
7
|
const validPageBlockComponents = [
|
|
7
8
|
"div",
|
|
8
9
|
"article",
|
|
@@ -11,7 +12,6 @@ const validPageBlockComponents = [
|
|
|
11
12
|
"section",
|
|
12
13
|
"nav"
|
|
13
14
|
];
|
|
14
|
-
const gutters = { mobile: "small", tablet: "gutter" };
|
|
15
15
|
const PageBlock = ({
|
|
16
16
|
children,
|
|
17
17
|
width = "large",
|
|
@@ -25,11 +25,10 @@ const PageBlock = ({
|
|
|
25
25
|
{
|
|
26
26
|
width: "full",
|
|
27
27
|
component,
|
|
28
|
-
paddingX:
|
|
28
|
+
paddingX: lib_components_PageBlock_pageBlockGutters_cjs.pageBlockGutters,
|
|
29
29
|
...lib_components_private_buildDataAttributes_cjs.buildDataAttributes({ data, validateRestProps: restProps }),
|
|
30
30
|
children: width === "full" ? children : /* @__PURE__ */ jsxRuntime.jsx(lib_components_ContentBlock_ContentBlock_cjs.ContentBlock, { width, children })
|
|
31
31
|
}
|
|
32
32
|
);
|
|
33
33
|
};
|
|
34
34
|
exports.PageBlock = PageBlock;
|
|
35
|
-
exports.gutters = gutters;
|
|
@@ -2,6 +2,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { Box } from "../Box/Box.mjs";
|
|
3
3
|
import { ContentBlock } from "../ContentBlock/ContentBlock.mjs";
|
|
4
4
|
import { buildDataAttributes } from "../private/buildDataAttributes.mjs";
|
|
5
|
+
import { pageBlockGutters } from "./pageBlockGutters.mjs";
|
|
5
6
|
const validPageBlockComponents = [
|
|
6
7
|
"div",
|
|
7
8
|
"article",
|
|
@@ -10,7 +11,6 @@ const validPageBlockComponents = [
|
|
|
10
11
|
"section",
|
|
11
12
|
"nav"
|
|
12
13
|
];
|
|
13
|
-
const gutters = { mobile: "small", tablet: "gutter" };
|
|
14
14
|
const PageBlock = ({
|
|
15
15
|
children,
|
|
16
16
|
width = "large",
|
|
@@ -24,13 +24,12 @@ const PageBlock = ({
|
|
|
24
24
|
{
|
|
25
25
|
width: "full",
|
|
26
26
|
component,
|
|
27
|
-
paddingX:
|
|
27
|
+
paddingX: pageBlockGutters,
|
|
28
28
|
...buildDataAttributes({ data, validateRestProps: restProps }),
|
|
29
29
|
children: width === "full" ? children : /* @__PURE__ */ jsx(ContentBlock, { width, children })
|
|
30
30
|
}
|
|
31
31
|
);
|
|
32
32
|
};
|
|
33
33
|
export {
|
|
34
|
-
PageBlock
|
|
35
|
-
gutters
|
|
34
|
+
PageBlock
|
|
36
35
|
};
|
|
@@ -80,6 +80,7 @@ const TooltipRenderer = ({
|
|
|
80
80
|
const isStatic = react.useContext(StaticTooltipContext);
|
|
81
81
|
const isMobileDevice = react.useRef(isMobile__default.default()).current;
|
|
82
82
|
const onScreen = react.useRef(null);
|
|
83
|
+
const showTooltip = isStatic ? true : open;
|
|
83
84
|
react.useEffect(() => {
|
|
84
85
|
const observer = new IntersectionObserver(
|
|
85
86
|
([entry]) => {
|
|
@@ -135,18 +136,30 @@ const TooltipRenderer = ({
|
|
|
135
136
|
}
|
|
136
137
|
};
|
|
137
138
|
}, [open, isMobileDevice]);
|
|
138
|
-
|
|
139
|
+
const handleTooltipPosition = () => {
|
|
139
140
|
const setPositions = () => {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
141
|
+
if (tooltipRef.current) {
|
|
142
|
+
setTooltipPosition(tooltipRef.current.getBoundingClientRect());
|
|
143
|
+
}
|
|
144
|
+
if (triggerRef.current) {
|
|
145
|
+
setTriggerPosition(triggerRef.current.getBoundingClientRect());
|
|
146
|
+
}
|
|
143
147
|
};
|
|
144
|
-
|
|
148
|
+
setTimeout(() => {
|
|
145
149
|
const frameId = requestAnimationFrame(setPositions);
|
|
146
150
|
return () => cancelAnimationFrame(frameId);
|
|
147
151
|
}, lib_components_private_animationTimeout_cjs.animationTimeout / 2);
|
|
148
|
-
|
|
149
|
-
|
|
152
|
+
};
|
|
153
|
+
lib_hooks_useIsomorphicLayoutEffect_cjs.useIsomorphicLayoutEffect(() => {
|
|
154
|
+
if (!showTooltip) {
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
handleTooltipPosition();
|
|
158
|
+
window.addEventListener("resize", handleTooltipPosition);
|
|
159
|
+
return () => {
|
|
160
|
+
window.removeEventListener("resize", handleTooltipPosition);
|
|
161
|
+
};
|
|
162
|
+
}, [showTooltip]);
|
|
150
163
|
let inferredPlacement = placement;
|
|
151
164
|
let arrowLeftOffset = 0;
|
|
152
165
|
if (tooltipPosition && triggerPosition) {
|
|
@@ -177,7 +190,7 @@ const TooltipRenderer = ({
|
|
|
177
190
|
lockPlacement: isStatic,
|
|
178
191
|
delayVisibility: !isMobileDevice,
|
|
179
192
|
modal: false,
|
|
180
|
-
open:
|
|
193
|
+
open: showTooltip,
|
|
181
194
|
onClose: !isStatic ? () => setOpen(false) : void 0,
|
|
182
195
|
triggerRef,
|
|
183
196
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -77,6 +77,7 @@ const TooltipRenderer = ({
|
|
|
77
77
|
const isStatic = useContext(StaticTooltipContext);
|
|
78
78
|
const isMobileDevice = useRef(isMobile()).current;
|
|
79
79
|
const onScreen = useRef(null);
|
|
80
|
+
const showTooltip = isStatic ? true : open;
|
|
80
81
|
useEffect(() => {
|
|
81
82
|
const observer = new IntersectionObserver(
|
|
82
83
|
([entry]) => {
|
|
@@ -132,18 +133,30 @@ const TooltipRenderer = ({
|
|
|
132
133
|
}
|
|
133
134
|
};
|
|
134
135
|
}, [open, isMobileDevice]);
|
|
135
|
-
|
|
136
|
+
const handleTooltipPosition = () => {
|
|
136
137
|
const setPositions = () => {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
138
|
+
if (tooltipRef.current) {
|
|
139
|
+
setTooltipPosition(tooltipRef.current.getBoundingClientRect());
|
|
140
|
+
}
|
|
141
|
+
if (triggerRef.current) {
|
|
142
|
+
setTriggerPosition(triggerRef.current.getBoundingClientRect());
|
|
143
|
+
}
|
|
140
144
|
};
|
|
141
|
-
|
|
145
|
+
setTimeout(() => {
|
|
142
146
|
const frameId = requestAnimationFrame(setPositions);
|
|
143
147
|
return () => cancelAnimationFrame(frameId);
|
|
144
148
|
}, animationTimeout / 2);
|
|
145
|
-
|
|
146
|
-
|
|
149
|
+
};
|
|
150
|
+
useIsomorphicLayoutEffect(() => {
|
|
151
|
+
if (!showTooltip) {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
handleTooltipPosition();
|
|
155
|
+
window.addEventListener("resize", handleTooltipPosition);
|
|
156
|
+
return () => {
|
|
157
|
+
window.removeEventListener("resize", handleTooltipPosition);
|
|
158
|
+
};
|
|
159
|
+
}, [showTooltip]);
|
|
147
160
|
let inferredPlacement = placement;
|
|
148
161
|
let arrowLeftOffset = 0;
|
|
149
162
|
if (tooltipPosition && triggerPosition) {
|
|
@@ -174,7 +187,7 @@ const TooltipRenderer = ({
|
|
|
174
187
|
lockPlacement: isStatic,
|
|
175
188
|
delayVisibility: !isMobileDevice,
|
|
176
189
|
modal: false,
|
|
177
|
-
open:
|
|
190
|
+
open: showTooltip,
|
|
178
191
|
onClose: !isStatic ? () => setOpen(false) : void 0,
|
|
179
192
|
triggerRef,
|
|
180
193
|
children: /* @__PURE__ */ jsx(
|
|
@@ -7,7 +7,7 @@ const lib_components_Bleed_Bleed_cjs = require("../../Bleed/Bleed.cjs");
|
|
|
7
7
|
const lib_components_Box_Box_cjs = require("../../Box/Box.cjs");
|
|
8
8
|
const lib_components_ButtonIcon_ButtonIcon_cjs = require("../../ButtonIcon/ButtonIcon.cjs");
|
|
9
9
|
const lib_components_Heading_Heading_cjs = require("../../Heading/Heading.cjs");
|
|
10
|
-
const
|
|
10
|
+
const lib_components_PageBlock_pageBlockGutters_cjs = require("../../PageBlock/pageBlockGutters.cjs");
|
|
11
11
|
const lib_components_Stack_Stack_cjs = require("../../Stack/Stack.cjs");
|
|
12
12
|
const lib_components_private_buildDataAttributes_cjs = require("../buildDataAttributes.cjs");
|
|
13
13
|
const lib_components_private_normalizeKey_cjs = require("../normalizeKey.cjs");
|
|
@@ -120,7 +120,7 @@ const ModalContent = ({
|
|
|
120
120
|
width: width !== "content" ? "full" : void 0,
|
|
121
121
|
height: position === "right" || position === "left" ? "full" : void 0,
|
|
122
122
|
paddingY: modalPadding,
|
|
123
|
-
paddingX: position !== "center" ?
|
|
123
|
+
paddingX: position !== "center" ? lib_components_PageBlock_pageBlockGutters_cjs.pageBlockGutters : modalPadding,
|
|
124
124
|
className: [
|
|
125
125
|
lib_components_private_Modal_Modal_css_cjs.pointerEventsAll,
|
|
126
126
|
position === "center" && lib_components_private_Modal_Modal_css_cjs.maxSize[position]
|
|
@@ -171,7 +171,7 @@ const ModalContent = ({
|
|
|
171
171
|
display: "flex",
|
|
172
172
|
justifyContent: "flexEnd",
|
|
173
173
|
paddingTop: modalPadding,
|
|
174
|
-
paddingRight: position !== "center" ?
|
|
174
|
+
paddingRight: position !== "center" ? lib_components_PageBlock_pageBlockGutters_cjs.pageBlockGutters : modalPadding,
|
|
175
175
|
className: position === "center" && lib_components_private_Modal_Modal_css_cjs.maxSize[position],
|
|
176
176
|
children: /* @__PURE__ */ jsxRuntime.jsx(lib_components_Bleed_Bleed_cjs.Bleed, { space: "xsmall", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
177
177
|
lib_components_Box_Box_cjs.Box,
|
|
@@ -6,7 +6,7 @@ import { Bleed } from "../../Bleed/Bleed.mjs";
|
|
|
6
6
|
import { Box } from "../../Box/Box.mjs";
|
|
7
7
|
import { ButtonIcon } from "../../ButtonIcon/ButtonIcon.mjs";
|
|
8
8
|
import { Heading } from "../../Heading/Heading.mjs";
|
|
9
|
-
import {
|
|
9
|
+
import { pageBlockGutters } from "../../PageBlock/pageBlockGutters.mjs";
|
|
10
10
|
import { Stack } from "../../Stack/Stack.mjs";
|
|
11
11
|
import { buildDataAttributes } from "../buildDataAttributes.mjs";
|
|
12
12
|
import { normalizeKey } from "../normalizeKey.mjs";
|
|
@@ -119,7 +119,7 @@ const ModalContent = ({
|
|
|
119
119
|
width: width !== "content" ? "full" : void 0,
|
|
120
120
|
height: position === "right" || position === "left" ? "full" : void 0,
|
|
121
121
|
paddingY: modalPadding,
|
|
122
|
-
paddingX: position !== "center" ?
|
|
122
|
+
paddingX: position !== "center" ? pageBlockGutters : modalPadding,
|
|
123
123
|
className: [
|
|
124
124
|
pointerEventsAll,
|
|
125
125
|
position === "center" && maxSize[position]
|
|
@@ -170,7 +170,7 @@ const ModalContent = ({
|
|
|
170
170
|
display: "flex",
|
|
171
171
|
justifyContent: "flexEnd",
|
|
172
172
|
paddingTop: modalPadding,
|
|
173
|
-
paddingRight: position !== "center" ?
|
|
173
|
+
paddingRight: position !== "center" ? pageBlockGutters : modalPadding,
|
|
174
174
|
className: position === "center" && maxSize[position],
|
|
175
175
|
children: /* @__PURE__ */ jsx(Bleed, { space: "xsmall", children: /* @__PURE__ */ jsx(
|
|
176
176
|
Box,
|
|
@@ -6,12 +6,13 @@ const lib_components_Box_Box_cjs = require("../Box/Box.cjs");
|
|
|
6
6
|
const lib_components_ButtonIcon_ButtonIcon_cjs = require("../ButtonIcon/ButtonIcon.cjs");
|
|
7
7
|
const lib_components_Column_Column_cjs = require("../Column/Column.cjs");
|
|
8
8
|
const lib_components_Columns_Columns_cjs = require("../Columns/Columns.cjs");
|
|
9
|
-
const lib_components_ContentBlock_ContentBlock_cjs = require("../ContentBlock/ContentBlock.cjs");
|
|
10
9
|
const lib_components_Inline_Inline_cjs = require("../Inline/Inline.cjs");
|
|
11
10
|
const lib_components_Stack_Stack_cjs = require("../Stack/Stack.cjs");
|
|
12
11
|
const lib_components_Text_Text_cjs = require("../Text/Text.cjs");
|
|
13
12
|
const lib_components_TextLinkButton_TextLinkButton_cjs = require("../TextLinkButton/TextLinkButton.cjs");
|
|
13
|
+
const lib_components_private_Overlay_Overlay_cjs = require("../private/Overlay/Overlay.cjs");
|
|
14
14
|
const lib_components_private_buildDataAttributes_cjs = require("../private/buildDataAttributes.cjs");
|
|
15
|
+
const lib_components_useToast_consts_cjs = require("./consts.cjs");
|
|
15
16
|
const lib_components_useToast_useTimeout_cjs = require("./useTimeout.cjs");
|
|
16
17
|
const lib_components_useToast_Toast_css_cjs = require("./Toast.css.cjs");
|
|
17
18
|
const lib_css_lineHeightContainer_css_cjs = require("../../css/lineHeightContainer.css.cjs");
|
|
@@ -24,13 +25,17 @@ const toneToIcon = {
|
|
|
24
25
|
critical: lib_components_icons_IconCritical_IconCritical_cjs.IconCritical,
|
|
25
26
|
positive: lib_components_icons_IconPositive_IconPositive_cjs.IconPositive
|
|
26
27
|
};
|
|
27
|
-
const toastDuration =
|
|
28
|
+
const toastDuration = 10 * 1e3;
|
|
28
29
|
const borderRadius = "large";
|
|
29
30
|
const Action = ({ label, onClick, removeToast }) => {
|
|
30
|
-
const handleClick = react.useCallback(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
const handleClick = react.useCallback(
|
|
32
|
+
(event) => {
|
|
33
|
+
event.stopPropagation();
|
|
34
|
+
removeToast();
|
|
35
|
+
onClick();
|
|
36
|
+
},
|
|
37
|
+
[removeToast, onClick]
|
|
38
|
+
);
|
|
34
39
|
return /* @__PURE__ */ jsxRuntime.jsx(lib_components_Text_Text_cjs.Text, { baseline: false, children: /* @__PURE__ */ jsxRuntime.jsx(lib_components_Box_Box_cjs.Box, { component: "span", "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsx(lib_components_TextLinkButton_TextLinkButton_cjs.TextLinkButton, { onClick: handleClick, hitArea: "large", children: label }) }) });
|
|
35
40
|
};
|
|
36
41
|
const ToastIcon = ({ tone, icon }) => {
|
|
@@ -56,6 +61,7 @@ const Toast = react.forwardRef(
|
|
|
56
61
|
action,
|
|
57
62
|
shouldRemove,
|
|
58
63
|
data,
|
|
64
|
+
expanded = true,
|
|
59
65
|
...restProps
|
|
60
66
|
}, ref) => {
|
|
61
67
|
const remove = react.useCallback(
|
|
@@ -72,6 +78,10 @@ const Toast = react.forwardRef(
|
|
|
72
78
|
remove();
|
|
73
79
|
}
|
|
74
80
|
}, [shouldRemove, remove, stopTimeout]);
|
|
81
|
+
react.useEffect(
|
|
82
|
+
() => expanded ? stopTimeout() : startTimeout(),
|
|
83
|
+
[expanded, startTimeout, stopTimeout]
|
|
84
|
+
);
|
|
75
85
|
assert__default.default(
|
|
76
86
|
!icon || icon.props.size === void 0 && icon.props.tone === void 0,
|
|
77
87
|
"Icons cannot set the 'size' or 'tone' prop when passed to a Toast component"
|
|
@@ -88,56 +98,62 @@ const Toast = react.forwardRef(
|
|
|
88
98
|
/* @__PURE__ */ jsxRuntime.jsx(lib_components_Box_Box_cjs.Box, { paddingRight: "medium", children: /* @__PURE__ */ jsxRuntime.jsx(lib_components_Text_Text_cjs.Text, { weight: "medium", tone, baseline: false, children: message }) }),
|
|
89
99
|
action ? /* @__PURE__ */ jsxRuntime.jsx(Action, { removeToast: remove, ...action }, action.label) : null
|
|
90
100
|
] });
|
|
91
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
101
|
+
return /* @__PURE__ */ jsxRuntime.jsx(lib_components_Box_Box_cjs.Box, { position: "relative", width: "full", display: "flex", ref, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
92
102
|
lib_components_Box_Box_cjs.Box,
|
|
93
103
|
{
|
|
94
|
-
display: "flex",
|
|
95
|
-
justifyContent: "center",
|
|
96
|
-
textAlign: "left",
|
|
97
104
|
role: "alert",
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
105
|
+
textAlign: "left",
|
|
106
|
+
background: { lightMode: "surfaceDark", darkMode: "surface" },
|
|
107
|
+
boxShadow: {
|
|
108
|
+
lightMode: "borderNeutral",
|
|
109
|
+
darkMode: "borderNeutralLight"
|
|
110
|
+
},
|
|
111
|
+
borderRadius,
|
|
112
|
+
paddingY: "medium",
|
|
113
|
+
paddingX: "gutter",
|
|
114
|
+
marginTop: lib_components_useToast_consts_cjs.toastGap,
|
|
115
|
+
width: "full",
|
|
116
|
+
position: "relative",
|
|
117
|
+
className: lib_components_useToast_Toast_css_cjs.toast,
|
|
118
|
+
tabIndex: 0,
|
|
119
|
+
outline: "focus",
|
|
120
|
+
onClick: (event) => {
|
|
121
|
+
event.stopPropagation();
|
|
122
|
+
},
|
|
101
123
|
...lib_components_private_buildDataAttributes_cjs.buildDataAttributes({ data, validateRestProps: restProps }),
|
|
102
|
-
children:
|
|
103
|
-
lib_components_Box_Box_cjs.Box,
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
)
|
|
134
|
-
}
|
|
135
|
-
) })
|
|
136
|
-
] })
|
|
137
|
-
}
|
|
138
|
-
) }) })
|
|
124
|
+
children: [
|
|
125
|
+
/* @__PURE__ */ jsxRuntime.jsx(lib_components_Box_Box_cjs.Box, { transition: "fast", className: lib_components_useToast_Toast_css_cjs.collapsedToastContent, children: /* @__PURE__ */ jsxRuntime.jsxs(lib_components_Columns_Columns_cjs.Columns, { space: "none", children: [
|
|
126
|
+
tone !== "neutral" || tone === "neutral" && icon ? /* @__PURE__ */ jsxRuntime.jsx(lib_components_Column_Column_cjs.Column, { width: "content", children: /* @__PURE__ */ jsxRuntime.jsx(lib_components_Box_Box_cjs.Box, { paddingRight: "small", children: /* @__PURE__ */ jsxRuntime.jsx(ToastIcon, { tone, icon }) }) }) : null,
|
|
127
|
+
/* @__PURE__ */ jsxRuntime.jsx(lib_components_Column_Column_cjs.Column, { children: content }),
|
|
128
|
+
/* @__PURE__ */ jsxRuntime.jsx(lib_components_Column_Column_cjs.Column, { width: "content", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
129
|
+
lib_components_Box_Box_cjs.Box,
|
|
130
|
+
{
|
|
131
|
+
width: "touchable",
|
|
132
|
+
display: "flex",
|
|
133
|
+
justifyContent: "flexEnd",
|
|
134
|
+
alignItems: "center",
|
|
135
|
+
className: lib_css_lineHeightContainer_css_cjs.lineHeightContainer.standard,
|
|
136
|
+
"aria-hidden": true,
|
|
137
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
138
|
+
lib_components_ButtonIcon_ButtonIcon_cjs.ButtonIcon,
|
|
139
|
+
{
|
|
140
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(lib_components_icons_IconClear_IconClear_cjs.IconClear, { tone: "secondary" }),
|
|
141
|
+
variant: "transparent",
|
|
142
|
+
onClick: (event) => {
|
|
143
|
+
event.stopPropagation();
|
|
144
|
+
remove();
|
|
145
|
+
},
|
|
146
|
+
label: closeLabel,
|
|
147
|
+
data: process.env.NODE_ENV !== "production" ? { testid: "clearToast" } : {}
|
|
148
|
+
}
|
|
149
|
+
)
|
|
150
|
+
}
|
|
151
|
+
) })
|
|
152
|
+
] }) }),
|
|
153
|
+
/* @__PURE__ */ jsxRuntime.jsx(lib_components_private_Overlay_Overlay_cjs.Overlay, { visible: true, borderRadius, boxShadow: "large" })
|
|
154
|
+
]
|
|
139
155
|
}
|
|
140
|
-
);
|
|
156
|
+
) });
|
|
141
157
|
}
|
|
142
158
|
);
|
|
143
159
|
exports.Toast = Toast;
|
|
@@ -5,5 +5,15 @@ fileScope.setFileScope("src/lib/components/useToast/Toast.css.ts", "braid-design
|
|
|
5
5
|
const toast = css.style({
|
|
6
6
|
pointerEvents: "all"
|
|
7
7
|
}, "toast");
|
|
8
|
+
const collapsed = css.style({}, "collapsed");
|
|
9
|
+
const collapsedToastContent = css.style({
|
|
10
|
+
selectors: {
|
|
11
|
+
[`${collapsed} &`]: {
|
|
12
|
+
opacity: 0
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}, "collapsedToastContent");
|
|
8
16
|
fileScope.endFileScope();
|
|
17
|
+
exports.collapsed = collapsed;
|
|
18
|
+
exports.collapsedToastContent = collapsedToastContent;
|
|
9
19
|
exports.toast = toast;
|
|
@@ -4,7 +4,17 @@ setFileScope("src/lib/components/useToast/Toast.css.ts", "braid-design-system");
|
|
|
4
4
|
const toast = style({
|
|
5
5
|
pointerEvents: "all"
|
|
6
6
|
}, "toast");
|
|
7
|
+
const collapsed = style({}, "collapsed");
|
|
8
|
+
const collapsedToastContent = style({
|
|
9
|
+
selectors: {
|
|
10
|
+
[`${collapsed} &`]: {
|
|
11
|
+
opacity: 0
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}, "collapsedToastContent");
|
|
7
15
|
endFileScope();
|
|
8
16
|
export {
|
|
17
|
+
collapsed,
|
|
18
|
+
collapsedToastContent,
|
|
9
19
|
toast
|
|
10
20
|
};
|