braid-design-system 34.8.2 → 34.9.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 +50 -0
- package/dist/color-mode/query-param.d.cts +1 -1
- package/dist/color-mode/query-param.d.mts +1 -1
- package/dist/index.cjs +3 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.mts +2 -1
- package/dist/index.mjs +3 -2
- package/dist/lib/components/Avatar/Avatar.cjs +213 -0
- package/dist/lib/components/Avatar/Avatar.css.cjs +31 -0
- package/dist/lib/components/Avatar/Avatar.css.d.cts +4 -0
- package/dist/lib/components/Avatar/Avatar.css.d.mts +4 -0
- package/dist/lib/components/Avatar/Avatar.css.mjs +29 -0
- package/dist/lib/components/Avatar/Avatar.d.cts +21 -0
- package/dist/lib/components/Avatar/Avatar.d.mts +21 -0
- package/dist/lib/components/Avatar/Avatar.mjs +211 -0
- package/dist/lib/components/Avatar/Avatar.playroom.cjs +14 -0
- package/dist/lib/components/Avatar/Avatar.playroom.d.cts +8 -0
- package/dist/lib/components/Avatar/Avatar.playroom.d.mts +8 -0
- package/dist/lib/components/Avatar/Avatar.playroom.mjs +14 -0
- package/dist/lib/components/Drawer/Drawer.cjs +26 -0
- package/dist/lib/components/Drawer/Drawer.d.cts +15 -4
- package/dist/lib/components/Drawer/Drawer.d.mts +15 -4
- package/dist/lib/components/Drawer/Drawer.mjs +25 -0
- package/dist/lib/components/Heading/Heading.cjs +2 -1
- package/dist/lib/components/Heading/Heading.mjs +3 -2
- package/dist/lib/components/List/List.cjs +16 -16
- package/dist/lib/components/List/List.mjs +16 -16
- package/dist/lib/components/Rating/Rating.cjs +48 -20
- package/dist/lib/components/Rating/Rating.css.cjs +34 -0
- package/dist/lib/components/Rating/Rating.css.mjs +31 -1
- package/dist/lib/components/Rating/Rating.d.cts +11 -2
- package/dist/lib/components/Rating/Rating.d.mts +11 -2
- package/dist/lib/components/Rating/Rating.mjs +50 -22
- package/dist/lib/components/Text/Text.cjs +2 -1
- package/dist/lib/components/Text/Text.mjs +2 -1
- package/dist/lib/components/index.d.cts +2 -1
- package/dist/lib/components/index.d.mts +2 -1
- package/dist/lib/components/private/InlineField/StyledInput.cjs +3 -4
- package/dist/lib/components/private/InlineField/StyledInput.mjs +3 -4
- package/dist/lib/components/private/Modal/Modal.cjs +6 -2
- package/dist/lib/components/private/Modal/Modal.mjs +6 -2
- package/dist/lib/components/private/Modal/ModalContent.cjs +104 -71
- package/dist/lib/components/private/Modal/ModalContent.mjs +104 -71
- package/dist/lib/components/private/Skeleton/Skeleton.cjs +14 -0
- package/dist/lib/components/private/Skeleton/Skeleton.css.cjs +25 -0
- package/dist/lib/components/private/Skeleton/Skeleton.css.mjs +25 -0
- package/dist/lib/components/private/Skeleton/Skeleton.mjs +14 -0
- package/dist/lib/css/atoms/sprinkles.css.d.cts +1 -1
- package/dist/lib/css/atoms/sprinkles.css.d.mts +1 -1
- package/dist/lib/css/typography.css.cjs +12 -0
- package/dist/lib/css/typography.css.mjs +12 -2
- package/dist/lib/playroom/components.cjs +2 -0
- package/dist/lib/playroom/components.d.cts +2 -1
- package/dist/lib/playroom/components.d.mts +2 -1
- package/dist/lib/playroom/components.mjs +2 -1
- package/dist/lib/playroom/snippets/Avatar.cjs +41 -0
- package/dist/lib/playroom/snippets/Avatar.mjs +41 -0
- package/dist/lib/playroom/snippets/CardList.cjs +1 -1
- package/dist/lib/playroom/snippets/CardList.mjs +1 -1
- package/dist/lib/playroom/snippets.cjs +2 -10
- package/dist/lib/playroom/snippets.mjs +94 -102
- package/dist/lib/themes/docs/tokens.cjs +4 -4
- package/dist/lib/themes/docs/tokens.mjs +4 -4
- package/dist/lib/themes/wireframe/tokens.cjs +1 -1
- package/dist/lib/themes/wireframe/tokens.mjs +1 -1
- package/dist/node_modules/.pnpm/{@capsizecss_metrics@4.2.0 → @capsizecss_metrics@4.3.0}/node_modules/@capsizecss/metrics/entireMetricsCollection/appleSystem/index.cjs +1 -1
- package/dist/node_modules/.pnpm/{@capsizecss_metrics@4.2.0 → @capsizecss_metrics@4.3.0}/node_modules/@capsizecss/metrics/entireMetricsCollection/appleSystem/index.mjs +1 -1
- package/dist/node_modules/.pnpm/{@capsizecss_metrics@4.2.0 → @capsizecss_metrics@4.3.0}/node_modules/@capsizecss/metrics/entireMetricsCollection/courierNew/index.cjs +1 -1
- package/dist/node_modules/.pnpm/{@capsizecss_metrics@4.2.0 → @capsizecss_metrics@4.3.0}/node_modules/@capsizecss/metrics/entireMetricsCollection/courierNew/index.mjs +1 -1
- package/dist/playroom/components.cjs +2 -0
- package/dist/playroom/components.d.cts +2 -1
- package/dist/playroom/components.d.mts +2 -1
- package/dist/playroom/components.mjs +2 -1
- package/package.json +3 -3
- package/dist/lib/playroom/snippets/DividedList.cjs +0 -8
- package/dist/lib/playroom/snippets/DividedList.mjs +0 -8
- package/dist/lib/playroom/snippets/Form.cjs +0 -12
- package/dist/lib/playroom/snippets/Form.mjs +0 -12
- package/dist/lib/playroom/snippets/SteppedSection.cjs +0 -8
- package/dist/lib/playroom/snippets/SteppedSection.mjs +0 -8
- package/dist/lib/playroom/snippets/TabbedSection.cjs +0 -8
- package/dist/lib/playroom/snippets/TabbedSection.mjs +0 -8
- package/dist/lib/playroom/snippets/TableSection.cjs +0 -8
- package/dist/lib/playroom/snippets/TableSection.mjs +0 -8
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const require_atoms = require("../../css/atoms/atoms.cjs");
|
|
1
2
|
let _vanilla_extract_css_fileScope = require("@vanilla-extract/css/fileScope");
|
|
2
3
|
let _vanilla_extract_css = require("@vanilla-extract/css");
|
|
3
4
|
//#region src/lib/components/Rating/Rating.css.ts
|
|
@@ -6,6 +7,39 @@ const inlineFlex = (0, _vanilla_extract_css.style)({
|
|
|
6
7
|
display: "inline-flex",
|
|
7
8
|
gap: "1px"
|
|
8
9
|
}, "inlineFlex");
|
|
10
|
+
const separatorSlot = "1em";
|
|
11
|
+
const clip = (0, _vanilla_extract_css.style)([require_atoms.atoms({ display: "block" }), {
|
|
12
|
+
overflowX: "clip",
|
|
13
|
+
overflowInline: "clip",
|
|
14
|
+
overflowBlock: "visible"
|
|
15
|
+
}], "clip");
|
|
16
|
+
const row = (0, _vanilla_extract_css.style)({
|
|
17
|
+
display: "flex",
|
|
18
|
+
flexWrap: "wrap",
|
|
19
|
+
alignItems: "baseline",
|
|
20
|
+
marginInlineStart: `-${separatorSlot}`
|
|
21
|
+
}, "row");
|
|
22
|
+
const group = (0, _vanilla_extract_css.style)({ paddingInlineStart: separatorSlot }, "group");
|
|
23
|
+
const reviews = (0, _vanilla_extract_css.style)({
|
|
24
|
+
position: "relative",
|
|
25
|
+
paddingInlineStart: separatorSlot,
|
|
26
|
+
whiteSpace: "nowrap",
|
|
27
|
+
"::before": {
|
|
28
|
+
content: ["\"·\"", "\"·\" / \"\""],
|
|
29
|
+
position: "absolute",
|
|
30
|
+
insetInlineStart: 0,
|
|
31
|
+
top: 0,
|
|
32
|
+
bottom: 0,
|
|
33
|
+
display: "flex",
|
|
34
|
+
alignItems: "center",
|
|
35
|
+
justifyContent: "center",
|
|
36
|
+
width: separatorSlot
|
|
37
|
+
}
|
|
38
|
+
}, "reviews");
|
|
9
39
|
(0, _vanilla_extract_css_fileScope.endFileScope)();
|
|
10
40
|
//#endregion
|
|
41
|
+
exports.clip = clip;
|
|
42
|
+
exports.group = group;
|
|
11
43
|
exports.inlineFlex = inlineFlex;
|
|
44
|
+
exports.reviews = reviews;
|
|
45
|
+
exports.row = row;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { atoms } from "../../css/atoms/atoms.mjs";
|
|
1
2
|
import { endFileScope, setFileScope } from "@vanilla-extract/css/fileScope";
|
|
2
3
|
import { style } from "@vanilla-extract/css";
|
|
3
4
|
//#region src/lib/components/Rating/Rating.css.ts
|
|
@@ -6,6 +7,35 @@ const inlineFlex = style({
|
|
|
6
7
|
display: "inline-flex",
|
|
7
8
|
gap: "1px"
|
|
8
9
|
}, "inlineFlex");
|
|
10
|
+
const separatorSlot = "1em";
|
|
11
|
+
const clip = style([atoms({ display: "block" }), {
|
|
12
|
+
overflowX: "clip",
|
|
13
|
+
overflowInline: "clip",
|
|
14
|
+
overflowBlock: "visible"
|
|
15
|
+
}], "clip");
|
|
16
|
+
const row = style({
|
|
17
|
+
display: "flex",
|
|
18
|
+
flexWrap: "wrap",
|
|
19
|
+
alignItems: "baseline",
|
|
20
|
+
marginInlineStart: `-${separatorSlot}`
|
|
21
|
+
}, "row");
|
|
22
|
+
const group = style({ paddingInlineStart: separatorSlot }, "group");
|
|
23
|
+
const reviews = style({
|
|
24
|
+
position: "relative",
|
|
25
|
+
paddingInlineStart: separatorSlot,
|
|
26
|
+
whiteSpace: "nowrap",
|
|
27
|
+
"::before": {
|
|
28
|
+
content: ["\"·\"", "\"·\" / \"\""],
|
|
29
|
+
position: "absolute",
|
|
30
|
+
insetInlineStart: 0,
|
|
31
|
+
top: 0,
|
|
32
|
+
bottom: 0,
|
|
33
|
+
display: "flex",
|
|
34
|
+
alignItems: "center",
|
|
35
|
+
justifyContent: "center",
|
|
36
|
+
width: separatorSlot
|
|
37
|
+
}
|
|
38
|
+
}, "reviews");
|
|
9
39
|
endFileScope();
|
|
10
40
|
//#endregion
|
|
11
|
-
export { inlineFlex };
|
|
41
|
+
export { clip, group, inlineFlex, reviews, row };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TextProps } from "../Text/Text.cjs";
|
|
2
|
-
import { FC } from "react";
|
|
2
|
+
import { FC, MouseEventHandler } from "react";
|
|
3
3
|
//#region src/lib/components/Rating/Rating.d.ts
|
|
4
4
|
interface RatingBaseProps {
|
|
5
5
|
rating: number;
|
|
@@ -9,7 +9,16 @@ interface RatingBaseProps {
|
|
|
9
9
|
tone?: Extract<TextProps['tone'], 'brandAccent' | 'neutral'>;
|
|
10
10
|
}
|
|
11
11
|
type RatingVariants = 'full' | 'starsOnly' | 'minimal';
|
|
12
|
-
type
|
|
12
|
+
type ReviewProps = {
|
|
13
|
+
reviewText?: string;
|
|
14
|
+
reviewLink?: never;
|
|
15
|
+
onClick?: never;
|
|
16
|
+
} | {
|
|
17
|
+
reviewText: string;
|
|
18
|
+
reviewLink: string;
|
|
19
|
+
onClick?: MouseEventHandler<HTMLAnchorElement>;
|
|
20
|
+
};
|
|
21
|
+
type RatingProps = RatingBaseProps & ReviewProps & ({
|
|
13
22
|
weight?: never;
|
|
14
23
|
variant?: RatingVariants;
|
|
15
24
|
} | {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TextProps } from "../Text/Text.mjs";
|
|
2
|
-
import { FC } from "react";
|
|
2
|
+
import { FC, MouseEventHandler } from "react";
|
|
3
3
|
//#region src/lib/components/Rating/Rating.d.ts
|
|
4
4
|
interface RatingBaseProps {
|
|
5
5
|
rating: number;
|
|
@@ -9,7 +9,16 @@ interface RatingBaseProps {
|
|
|
9
9
|
tone?: Extract<TextProps['tone'], 'brandAccent' | 'neutral'>;
|
|
10
10
|
}
|
|
11
11
|
type RatingVariants = 'full' | 'starsOnly' | 'minimal';
|
|
12
|
-
type
|
|
12
|
+
type ReviewProps = {
|
|
13
|
+
reviewText?: string;
|
|
14
|
+
reviewLink?: never;
|
|
15
|
+
onClick?: never;
|
|
16
|
+
} | {
|
|
17
|
+
reviewText: string;
|
|
18
|
+
reviewLink: string;
|
|
19
|
+
onClick?: MouseEventHandler<HTMLAnchorElement>;
|
|
20
|
+
};
|
|
21
|
+
type RatingProps = RatingBaseProps & ReviewProps & ({
|
|
13
22
|
weight?: never;
|
|
14
23
|
variant?: RatingVariants;
|
|
15
24
|
} | {
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { Box } from "../Box/Box.mjs";
|
|
2
|
-
import "../private/iconSlotSpace.mjs";
|
|
2
|
+
import { iconSlotSpace } from "../private/iconSlotSpace.mjs";
|
|
3
3
|
import { Text } from "../Text/Text.mjs";
|
|
4
4
|
import { IconContainer } from "../icons/IconContainer.mjs";
|
|
5
|
+
import { TextLink } from "../TextLink/TextLink.mjs";
|
|
5
6
|
import { IconRatingEmptySvg } from "../icons/IconRating/IconRatingEmptySvg.mjs";
|
|
6
7
|
import { IconRatingFullSvg } from "../icons/IconRating/IconRatingFullSvg.mjs";
|
|
7
8
|
import { IconRatingHalfSvg } from "../icons/IconRating/IconRatingHalfSvg.mjs";
|
|
8
|
-
import { inlineFlex } from "./Rating.css.mjs";
|
|
9
|
+
import { clip, group, inlineFlex, reviews, row } from "./Rating.css.mjs";
|
|
9
10
|
import assert from "assert";
|
|
10
11
|
import dedent from "dedent";
|
|
11
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
12
13
|
//#region src/lib/components/Rating/Rating.tsx
|
|
13
14
|
const getPercent = (rating, position) => Math.round(Math.min(Math.max(rating - position, 0), 1) * 100);
|
|
14
15
|
const RatingStar = ({ percent, ...restProps }) => {
|
|
@@ -24,8 +25,10 @@ const RatingStar = ({ percent, ...restProps }) => {
|
|
|
24
25
|
});
|
|
25
26
|
};
|
|
26
27
|
const ratingArr = [...Array(5)];
|
|
27
|
-
const Rating = ({ rating, size = "standard", weight, variant = "full", tone = "brandAccent", "aria-label": ariaLabel, data }) => {
|
|
28
|
+
const Rating = ({ rating, size = "standard", weight, variant = "full", tone = "brandAccent", "aria-label": ariaLabel, data, reviewText, reviewLink, onClick }) => {
|
|
28
29
|
assert(!rating || rating >= 0 && rating <= 5, "Rating must be between 0 and 5");
|
|
30
|
+
assert(!reviewLink || typeof reviewText === "string", "reviewText must be set when reviewLink is provided");
|
|
31
|
+
assert(!onClick || reviewLink, "reviewLink must be set when onClick is provided");
|
|
29
32
|
if (process.env.NODE_ENV !== "production") {
|
|
30
33
|
if (typeof weight !== "undefined" && variant === "starsOnly") console.warn(dedent`
|
|
31
34
|
The "weight" prop is not valid with the "starsOnly" variant as there is no visible text. Either remove the \`weight\` prop or choose an alternative \`variant\`.
|
|
@@ -35,28 +38,53 @@ const Rating = ({ rating, size = "standard", weight, variant = "full", tone = "b
|
|
|
35
38
|
/>
|
|
36
39
|
`, "color: red", "color: inherit");
|
|
37
40
|
}
|
|
38
|
-
|
|
41
|
+
const stars = /* @__PURE__ */ jsx(Box, {
|
|
42
|
+
component: "span",
|
|
43
|
+
className: inlineFlex,
|
|
44
|
+
role: "img",
|
|
45
|
+
"aria-label": ariaLabel || `${rating.toFixed(1)} out of ${ratingArr.length}`,
|
|
46
|
+
children: variant === "minimal" ? /* @__PURE__ */ jsx(RatingStar, {
|
|
47
|
+
percent: 100,
|
|
48
|
+
tone: tone === "neutral" ? "neutral" : "brandAccent"
|
|
49
|
+
}) : ratingArr.map((_, position) => /* @__PURE__ */ jsx(RatingStar, {
|
|
50
|
+
percent: getPercent(rating, position),
|
|
51
|
+
tone: tone === "neutral" ? "neutral" : "brandAccent"
|
|
52
|
+
}, position))
|
|
53
|
+
});
|
|
54
|
+
const ratingText = variant !== "starsOnly" ? /* @__PURE__ */ jsx(Box, {
|
|
55
|
+
component: "span",
|
|
56
|
+
paddingLeft: iconSlotSpace,
|
|
57
|
+
"aria-hidden": true,
|
|
58
|
+
children: rating.toFixed(1)
|
|
59
|
+
}) : null;
|
|
60
|
+
let reviewContent = null;
|
|
61
|
+
if (reviewText) reviewContent = reviewLink ? /* @__PURE__ */ jsx(TextLink, {
|
|
62
|
+
href: reviewLink,
|
|
63
|
+
weight: "weak",
|
|
64
|
+
onClick,
|
|
65
|
+
children: reviewText
|
|
66
|
+
}) : reviewText;
|
|
67
|
+
return /* @__PURE__ */ jsx(Text, {
|
|
39
68
|
size,
|
|
40
69
|
data,
|
|
41
70
|
weight,
|
|
42
|
-
children:
|
|
43
|
-
component: "span",
|
|
44
|
-
className: inlineFlex,
|
|
45
|
-
role: "img",
|
|
46
|
-
"aria-label": ariaLabel || `${rating.toFixed(1)} out of ${ratingArr.length}`,
|
|
47
|
-
children: variant === "minimal" ? /* @__PURE__ */ jsx(RatingStar, {
|
|
48
|
-
percent: 100,
|
|
49
|
-
tone: tone === "neutral" ? "neutral" : "brandAccent"
|
|
50
|
-
}) : ratingArr.map((_, position) => /* @__PURE__ */ jsx(RatingStar, {
|
|
51
|
-
percent: getPercent(rating, position),
|
|
52
|
-
tone: tone === "neutral" ? "neutral" : "brandAccent"
|
|
53
|
-
}, position))
|
|
54
|
-
}), variant !== "starsOnly" && /* @__PURE__ */ jsx(Box, {
|
|
71
|
+
children: reviewContent ? /* @__PURE__ */ jsx(Box, {
|
|
55
72
|
component: "span",
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
73
|
+
className: clip,
|
|
74
|
+
children: /* @__PURE__ */ jsxs(Box, {
|
|
75
|
+
component: "span",
|
|
76
|
+
className: row,
|
|
77
|
+
children: [/* @__PURE__ */ jsxs(Box, {
|
|
78
|
+
component: "span",
|
|
79
|
+
className: group,
|
|
80
|
+
children: [stars, ratingText]
|
|
81
|
+
}), /* @__PURE__ */ jsx(Box, {
|
|
82
|
+
component: "span",
|
|
83
|
+
className: reviews,
|
|
84
|
+
children: reviewContent
|
|
85
|
+
})]
|
|
86
|
+
})
|
|
87
|
+
}) : /* @__PURE__ */ jsxs(Fragment, { children: [stars, ratingText] })
|
|
60
88
|
});
|
|
61
89
|
};
|
|
62
90
|
//#endregion
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const require_runtime = require("../../../_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
const require_typography_css = require("../../css/typography.css.cjs");
|
|
2
3
|
const require_TextContext = require("./TextContext.cjs");
|
|
3
4
|
const require_typography = require("../../css/typography.cjs");
|
|
4
5
|
const require_Typography = require("../private/Typography/Typography.cjs");
|
|
@@ -32,7 +33,7 @@ const Text = ({ size: sizeProp, tone: toneProp, weight: weightProp, maxLines: ma
|
|
|
32
33
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Typography.Typography, {
|
|
33
34
|
maxLines,
|
|
34
35
|
...typographyProps,
|
|
35
|
-
className: require_typography.textStyles(textStylingProps)
|
|
36
|
+
className: [require_typography.textStyles(textStylingProps), require_typography_css.textSubSupScript]
|
|
36
37
|
})
|
|
37
38
|
});
|
|
38
39
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { textSubSupScript } from "../../css/typography.css.mjs";
|
|
1
2
|
import { TextContext } from "./TextContext.mjs";
|
|
2
3
|
import { textStyles } from "../../css/typography.mjs";
|
|
3
4
|
import { Typography } from "../private/Typography/Typography.mjs";
|
|
@@ -30,7 +31,7 @@ const Text = ({ size: sizeProp, tone: toneProp, weight: weightProp, maxLines: ma
|
|
|
30
31
|
children: /* @__PURE__ */ jsx(Typography, {
|
|
31
32
|
maxLines,
|
|
32
33
|
...typographyProps,
|
|
33
|
-
className: textStyles(textStylingProps)
|
|
34
|
+
className: [textStyles(textStylingProps), textSubSupScript]
|
|
34
35
|
})
|
|
35
36
|
});
|
|
36
37
|
};
|
|
@@ -18,6 +18,7 @@ import { FieldLabel } from "./FieldLabel/FieldLabel.cjs";
|
|
|
18
18
|
import { FieldMessage } from "./FieldMessage/FieldMessage.cjs";
|
|
19
19
|
import { Autosuggest } from "./Autosuggest/Autosuggest.cjs";
|
|
20
20
|
import { filterSuggestions } from "./Autosuggest/filterSuggestions.cjs";
|
|
21
|
+
import { Avatar } from "./Avatar/Avatar.cjs";
|
|
21
22
|
import { Bleed } from "./Bleed/Bleed.cjs";
|
|
22
23
|
import { BoxRenderer } from "./Box/BoxRenderer.cjs";
|
|
23
24
|
import { ButtonIcon } from "./ButtonIcon/ButtonIcon.cjs";
|
|
@@ -199,4 +200,4 @@ import "./icons/index.cjs";
|
|
|
199
200
|
//#region src/lib/components/index.d.ts
|
|
200
201
|
type LinkComponent = LinkComponent$1;
|
|
201
202
|
//#endregion
|
|
202
|
-
export { Accordion, AccordionItem, Actions, Alert, Autosuggest, Badge, Bleed, PublicBox as Box, BoxRenderer, BraidPortal, BraidProvider, Button, ButtonIcon, ButtonLink, Card, Checkbox, CheckboxStandalone, Column, Columns, ContentBlock, Dialog, Disclosure, Divider, Drawer, Dropdown, FieldLabel, FieldMessage, Heading, Hidden, HiddenVisually, IconAI, IconAdd, IconArrow, IconAttachment, IconBluetooth, IconBold, IconBookmark, IconBulletList, IconCareer, IconCategory, IconCaution, IconChecklist, IconChevron, IconClear, IconCompany, IconCompanyVerified, IconCompose, IconCopy, IconCoverLetter, IconCreditCard, IconCritical, IconDate, IconDelete, IconDesktop, IconDisallow, IconDocument, IconDocumentBroken, IconDownload, IconEdit, IconEducation, IconEnlarge, IconExperience, IconFilter, IconFlag, IconGift, IconGlobe, IconGrid, IconHash, IconHeart, IconHelp, IconHistory, IconHome, IconImage, IconImageBroken, IconInfo, IconInvoice, IconItalic, IconLanguage, IconLicence, IconLink, IconLinkBroken, IconLocation, IconMail, IconMessage, IconMicrophone, IconMinus, IconMobile, IconMoney, IconNewWindow, IconNote, IconNotification, IconNumberedList, IconOverflow, IconPeople, IconPersonAdd, IconPersonVerified, IconPhone, IconPhotoAdd, IconPlatformAndroid, IconPlatformApple, IconPositive, IconPrint, IconProfile, IconPromote, IconQR, IconRecommended, IconRedo, IconRefresh, IconRenderer, IconResume, IconRocket, IconSearch, IconSecurity, IconSend, IconSent, IconSentiment, IconSettings, IconShare, IconSkills, IconSocialFacebook, IconSocialGitHub, IconSocialInstagram, IconSocialLinkedIn, IconSocialMedium, IconSocialTiktok, IconSocialX, IconSocialYouTube, IconSort, IconStar, IconStatistics, IconSubCategory, IconTag, IconThumb, IconTick, IconTime, IconTip, IconTitle, IconUndo, IconUpload, IconVideo, IconVisibility, IconWorkExperience, IconZoomIn, IconZoomOut, Inline, Link, LinkComponent, List, Loader, MenuItem, MenuItemCheckbox, MenuItemDivider, MenuItemLink, MenuRenderer, MonthPicker, Notice, OverflowMenu, Page, PageBlock, Pagination, PasswordField, RadioGroup, RadioItem, Rating, Secondary, Spread, Stack, Step, Stepper, Strong, Tab, TabPanel, TabPanels, Table, TableBody, TableCell, TableFooter, TableHeader, TableHeaderCell, TableRow, Tabs, TabsProvider, Tag, Text, TextDropdown, TextField, TextLink, TextLinkButton, Textarea, ThemeNameConsumer, Tiles, ToastProvider, Toggle, TooltipRenderer, filterSuggestions, makeLinkComponent, useColor, useResponsiveValue, useSpace, useThemeName, useToast };
|
|
203
|
+
export { Accordion, AccordionItem, Actions, Alert, Autosuggest, Avatar, Badge, Bleed, PublicBox as Box, BoxRenderer, BraidPortal, BraidProvider, Button, ButtonIcon, ButtonLink, Card, Checkbox, CheckboxStandalone, Column, Columns, ContentBlock, Dialog, Disclosure, Divider, Drawer, Dropdown, FieldLabel, FieldMessage, Heading, Hidden, HiddenVisually, IconAI, IconAdd, IconArrow, IconAttachment, IconBluetooth, IconBold, IconBookmark, IconBulletList, IconCareer, IconCategory, IconCaution, IconChecklist, IconChevron, IconClear, IconCompany, IconCompanyVerified, IconCompose, IconCopy, IconCoverLetter, IconCreditCard, IconCritical, IconDate, IconDelete, IconDesktop, IconDisallow, IconDocument, IconDocumentBroken, IconDownload, IconEdit, IconEducation, IconEnlarge, IconExperience, IconFilter, IconFlag, IconGift, IconGlobe, IconGrid, IconHash, IconHeart, IconHelp, IconHistory, IconHome, IconImage, IconImageBroken, IconInfo, IconInvoice, IconItalic, IconLanguage, IconLicence, IconLink, IconLinkBroken, IconLocation, IconMail, IconMessage, IconMicrophone, IconMinus, IconMobile, IconMoney, IconNewWindow, IconNote, IconNotification, IconNumberedList, IconOverflow, IconPeople, IconPersonAdd, IconPersonVerified, IconPhone, IconPhotoAdd, IconPlatformAndroid, IconPlatformApple, IconPositive, IconPrint, IconProfile, IconPromote, IconQR, IconRecommended, IconRedo, IconRefresh, IconRenderer, IconResume, IconRocket, IconSearch, IconSecurity, IconSend, IconSent, IconSentiment, IconSettings, IconShare, IconSkills, IconSocialFacebook, IconSocialGitHub, IconSocialInstagram, IconSocialLinkedIn, IconSocialMedium, IconSocialTiktok, IconSocialX, IconSocialYouTube, IconSort, IconStar, IconStatistics, IconSubCategory, IconTag, IconThumb, IconTick, IconTime, IconTip, IconTitle, IconUndo, IconUpload, IconVideo, IconVisibility, IconWorkExperience, IconZoomIn, IconZoomOut, Inline, Link, LinkComponent, List, Loader, MenuItem, MenuItemCheckbox, MenuItemDivider, MenuItemLink, MenuRenderer, MonthPicker, Notice, OverflowMenu, Page, PageBlock, Pagination, PasswordField, RadioGroup, RadioItem, Rating, Secondary, Spread, Stack, Step, Stepper, Strong, Tab, TabPanel, TabPanels, Table, TableBody, TableCell, TableFooter, TableHeader, TableHeaderCell, TableRow, Tabs, TabsProvider, Tag, Text, TextDropdown, TextField, TextLink, TextLinkButton, Textarea, ThemeNameConsumer, Tiles, ToastProvider, Toggle, TooltipRenderer, filterSuggestions, makeLinkComponent, useColor, useResponsiveValue, useSpace, useThemeName, useToast };
|
|
@@ -18,6 +18,7 @@ import { FieldLabel } from "./FieldLabel/FieldLabel.mjs";
|
|
|
18
18
|
import { FieldMessage } from "./FieldMessage/FieldMessage.mjs";
|
|
19
19
|
import { Autosuggest } from "./Autosuggest/Autosuggest.mjs";
|
|
20
20
|
import { filterSuggestions } from "./Autosuggest/filterSuggestions.mjs";
|
|
21
|
+
import { Avatar } from "./Avatar/Avatar.mjs";
|
|
21
22
|
import { Bleed } from "./Bleed/Bleed.mjs";
|
|
22
23
|
import { BoxRenderer } from "./Box/BoxRenderer.mjs";
|
|
23
24
|
import { ButtonIcon } from "./ButtonIcon/ButtonIcon.mjs";
|
|
@@ -199,4 +200,4 @@ import "./icons/index.mjs";
|
|
|
199
200
|
//#region src/lib/components/index.d.ts
|
|
200
201
|
type LinkComponent = LinkComponent$1;
|
|
201
202
|
//#endregion
|
|
202
|
-
export { Accordion, AccordionItem, Actions, Alert, Autosuggest, Badge, Bleed, PublicBox as Box, BoxRenderer, BraidPortal, BraidProvider, Button, ButtonIcon, ButtonLink, Card, Checkbox, CheckboxStandalone, Column, Columns, ContentBlock, Dialog, Disclosure, Divider, Drawer, Dropdown, FieldLabel, FieldMessage, Heading, Hidden, HiddenVisually, IconAI, IconAdd, IconArrow, IconAttachment, IconBluetooth, IconBold, IconBookmark, IconBulletList, IconCareer, IconCategory, IconCaution, IconChecklist, IconChevron, IconClear, IconCompany, IconCompanyVerified, IconCompose, IconCopy, IconCoverLetter, IconCreditCard, IconCritical, IconDate, IconDelete, IconDesktop, IconDisallow, IconDocument, IconDocumentBroken, IconDownload, IconEdit, IconEducation, IconEnlarge, IconExperience, IconFilter, IconFlag, IconGift, IconGlobe, IconGrid, IconHash, IconHeart, IconHelp, IconHistory, IconHome, IconImage, IconImageBroken, IconInfo, IconInvoice, IconItalic, IconLanguage, IconLicence, IconLink, IconLinkBroken, IconLocation, IconMail, IconMessage, IconMicrophone, IconMinus, IconMobile, IconMoney, IconNewWindow, IconNote, IconNotification, IconNumberedList, IconOverflow, IconPeople, IconPersonAdd, IconPersonVerified, IconPhone, IconPhotoAdd, IconPlatformAndroid, IconPlatformApple, IconPositive, IconPrint, IconProfile, IconPromote, IconQR, IconRecommended, IconRedo, IconRefresh, IconRenderer, IconResume, IconRocket, IconSearch, IconSecurity, IconSend, IconSent, IconSentiment, IconSettings, IconShare, IconSkills, IconSocialFacebook, IconSocialGitHub, IconSocialInstagram, IconSocialLinkedIn, IconSocialMedium, IconSocialTiktok, IconSocialX, IconSocialYouTube, IconSort, IconStar, IconStatistics, IconSubCategory, IconTag, IconThumb, IconTick, IconTime, IconTip, IconTitle, IconUndo, IconUpload, IconVideo, IconVisibility, IconWorkExperience, IconZoomIn, IconZoomOut, Inline, Link, LinkComponent, List, Loader, MenuItem, MenuItemCheckbox, MenuItemDivider, MenuItemLink, MenuRenderer, MonthPicker, Notice, OverflowMenu, Page, PageBlock, Pagination, PasswordField, RadioGroup, RadioItem, Rating, Secondary, Spread, Stack, Step, Stepper, Strong, Tab, TabPanel, TabPanels, Table, TableBody, TableCell, TableFooter, TableHeader, TableHeaderCell, TableRow, Tabs, TabsProvider, Tag, Text, TextDropdown, TextField, TextLink, TextLinkButton, Textarea, ThemeNameConsumer, Tiles, ToastProvider, Toggle, TooltipRenderer, filterSuggestions, makeLinkComponent, useColor, useResponsiveValue, useSpace, useThemeName, useToast };
|
|
203
|
+
export { Accordion, AccordionItem, Actions, Alert, Autosuggest, Avatar, Badge, Bleed, PublicBox as Box, BoxRenderer, BraidPortal, BraidProvider, Button, ButtonIcon, ButtonLink, Card, Checkbox, CheckboxStandalone, Column, Columns, ContentBlock, Dialog, Disclosure, Divider, Drawer, Dropdown, FieldLabel, FieldMessage, Heading, Hidden, HiddenVisually, IconAI, IconAdd, IconArrow, IconAttachment, IconBluetooth, IconBold, IconBookmark, IconBulletList, IconCareer, IconCategory, IconCaution, IconChecklist, IconChevron, IconClear, IconCompany, IconCompanyVerified, IconCompose, IconCopy, IconCoverLetter, IconCreditCard, IconCritical, IconDate, IconDelete, IconDesktop, IconDisallow, IconDocument, IconDocumentBroken, IconDownload, IconEdit, IconEducation, IconEnlarge, IconExperience, IconFilter, IconFlag, IconGift, IconGlobe, IconGrid, IconHash, IconHeart, IconHelp, IconHistory, IconHome, IconImage, IconImageBroken, IconInfo, IconInvoice, IconItalic, IconLanguage, IconLicence, IconLink, IconLinkBroken, IconLocation, IconMail, IconMessage, IconMicrophone, IconMinus, IconMobile, IconMoney, IconNewWindow, IconNote, IconNotification, IconNumberedList, IconOverflow, IconPeople, IconPersonAdd, IconPersonVerified, IconPhone, IconPhotoAdd, IconPlatformAndroid, IconPlatformApple, IconPositive, IconPrint, IconProfile, IconPromote, IconQR, IconRecommended, IconRedo, IconRefresh, IconRenderer, IconResume, IconRocket, IconSearch, IconSecurity, IconSend, IconSent, IconSentiment, IconSettings, IconShare, IconSkills, IconSocialFacebook, IconSocialGitHub, IconSocialInstagram, IconSocialLinkedIn, IconSocialMedium, IconSocialTiktok, IconSocialX, IconSocialYouTube, IconSort, IconStar, IconStatistics, IconSubCategory, IconTag, IconThumb, IconTick, IconTime, IconTip, IconTitle, IconUndo, IconUpload, IconVideo, IconVisibility, IconWorkExperience, IconZoomIn, IconZoomOut, Inline, Link, LinkComponent, List, Loader, MenuItem, MenuItemCheckbox, MenuItemDivider, MenuItemLink, MenuRenderer, MonthPicker, Notice, OverflowMenu, Page, PageBlock, Pagination, PasswordField, RadioGroup, RadioItem, Rating, Secondary, Spread, Stack, Step, Stepper, Strong, Tab, TabPanel, TabPanels, Table, TableBody, TableCell, TableFooter, TableHeader, TableHeaderCell, TableRow, Tabs, TabsProvider, Tag, Text, TextDropdown, TextField, TextLink, TextLinkButton, Textarea, ThemeNameConsumer, Tiles, ToastProvider, Toggle, TooltipRenderer, filterSuggestions, makeLinkComponent, useColor, useResponsiveValue, useSpace, useThemeName, useToast };
|
|
@@ -12,10 +12,9 @@ let react_jsx_runtime = require("react/jsx-runtime");
|
|
|
12
12
|
const tones = ["neutral", "critical"];
|
|
13
13
|
const Indicator = ({ type, checked, hover = false, disabled = false }) => {
|
|
14
14
|
const isCheckbox = type === "checkbox";
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
})();
|
|
15
|
+
let iconTone;
|
|
16
|
+
if (disabled) iconTone = "secondary";
|
|
17
|
+
else if (hover) iconTone = "formAccent";
|
|
19
18
|
return isCheckbox ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_Box.Box, {
|
|
20
19
|
height: "full",
|
|
21
20
|
transition: "fast",
|
|
@@ -12,10 +12,9 @@ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
|
12
12
|
const tones = ["neutral", "critical"];
|
|
13
13
|
const Indicator = ({ type, checked, hover = false, disabled = false }) => {
|
|
14
14
|
const isCheckbox = type === "checkbox";
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
})();
|
|
15
|
+
let iconTone;
|
|
16
|
+
if (disabled) iconTone = "secondary";
|
|
17
|
+
else if (hover) iconTone = "formAccent";
|
|
19
18
|
return isCheckbox ? /* @__PURE__ */ jsxs(Box, {
|
|
20
19
|
height: "full",
|
|
21
20
|
transition: "fast",
|
|
@@ -63,12 +63,13 @@ const reducer = (prevState, action) => {
|
|
|
63
63
|
}
|
|
64
64
|
};
|
|
65
65
|
const ANIMATION_DURATION = 300;
|
|
66
|
-
const Modal = ({ id, open, children, description, onClose, width, closeLabel, illustration, title, headingLevel, position, ...restProps }) => {
|
|
66
|
+
const Modal = ({ id, open, children, description, onClose, width, closeLabel, illustration, title, "aria-label": ariaLabel, "aria-description": ariaDescription, headingLevel, position, ...restProps }) => {
|
|
67
67
|
const [trapActive, setTrapActive] = (0, react.useState)(true);
|
|
68
68
|
const [state, dispatch] = (0, react.useReducer)(reducer, INITIAL);
|
|
69
69
|
const allowClose = (0, react.useContext)(AllowCloseContext);
|
|
70
70
|
const shouldFocus = typeof document !== "undefined" && typeof document.hasFocus === "function" && document.hasFocus();
|
|
71
71
|
const openRef = (0, react.useRef)(open);
|
|
72
|
+
const dialogRef = (0, react.useRef)(null);
|
|
72
73
|
const modalRef = (0, react.useRef)(null);
|
|
73
74
|
const headingRef = (0, react.useRef)(null);
|
|
74
75
|
const closeHandlerRef = (0, react.useRef)(onClose);
|
|
@@ -113,7 +114,7 @@ const Modal = ({ id, open, children, description, onClose, width, closeLabel, il
|
|
|
113
114
|
autoFocus: false,
|
|
114
115
|
onActivation: () => {
|
|
115
116
|
if (state === OPEN) return;
|
|
116
|
-
if (headingRef.current
|
|
117
|
+
if (shouldFocus) (headingRef.current || dialogRef.current)?.focus();
|
|
117
118
|
dispatch(ANIMATION_COMPLETE);
|
|
118
119
|
},
|
|
119
120
|
returnFocus: true,
|
|
@@ -147,8 +148,11 @@ const Modal = ({ id, open, children, description, onClose, width, closeLabel, il
|
|
|
147
148
|
closeLabel,
|
|
148
149
|
illustration,
|
|
149
150
|
title,
|
|
151
|
+
"aria-label": ariaLabel,
|
|
152
|
+
"aria-description": ariaDescription,
|
|
150
153
|
headingLevel,
|
|
151
154
|
headingRef,
|
|
155
|
+
dialogRef,
|
|
152
156
|
modalRef,
|
|
153
157
|
position,
|
|
154
158
|
scrollLock: !(state === CLOSING),
|
|
@@ -61,12 +61,13 @@ const reducer = (prevState, action) => {
|
|
|
61
61
|
}
|
|
62
62
|
};
|
|
63
63
|
const ANIMATION_DURATION = 300;
|
|
64
|
-
const Modal = ({ id, open, children, description, onClose, width, closeLabel, illustration, title, headingLevel, position, ...restProps }) => {
|
|
64
|
+
const Modal = ({ id, open, children, description, onClose, width, closeLabel, illustration, title, "aria-label": ariaLabel, "aria-description": ariaDescription, headingLevel, position, ...restProps }) => {
|
|
65
65
|
const [trapActive, setTrapActive] = useState(true);
|
|
66
66
|
const [state, dispatch] = useReducer(reducer, INITIAL);
|
|
67
67
|
const allowClose = useContext(AllowCloseContext);
|
|
68
68
|
const shouldFocus = typeof document !== "undefined" && typeof document.hasFocus === "function" && document.hasFocus();
|
|
69
69
|
const openRef = useRef(open);
|
|
70
|
+
const dialogRef = useRef(null);
|
|
70
71
|
const modalRef = useRef(null);
|
|
71
72
|
const headingRef = useRef(null);
|
|
72
73
|
const closeHandlerRef = useRef(onClose);
|
|
@@ -111,7 +112,7 @@ const Modal = ({ id, open, children, description, onClose, width, closeLabel, il
|
|
|
111
112
|
autoFocus: false,
|
|
112
113
|
onActivation: () => {
|
|
113
114
|
if (state === OPEN) return;
|
|
114
|
-
if (headingRef.current
|
|
115
|
+
if (shouldFocus) (headingRef.current || dialogRef.current)?.focus();
|
|
115
116
|
dispatch(ANIMATION_COMPLETE);
|
|
116
117
|
},
|
|
117
118
|
returnFocus: true,
|
|
@@ -145,8 +146,11 @@ const Modal = ({ id, open, children, description, onClose, width, closeLabel, il
|
|
|
145
146
|
closeLabel,
|
|
146
147
|
illustration,
|
|
147
148
|
title,
|
|
149
|
+
"aria-label": ariaLabel,
|
|
150
|
+
"aria-description": ariaDescription,
|
|
148
151
|
headingLevel,
|
|
149
152
|
headingRef,
|
|
153
|
+
dialogRef,
|
|
150
154
|
modalRef,
|
|
151
155
|
position,
|
|
152
156
|
scrollLock: !(state === CLOSING),
|
|
@@ -3,11 +3,13 @@ const require_buildDataAttributes = require("../buildDataAttributes.cjs");
|
|
|
3
3
|
const require_Box = require("../../Box/Box.cjs");
|
|
4
4
|
const require_Stack = require("../../Stack/Stack.cjs");
|
|
5
5
|
const require_useFallbackId = require("../../../hooks/useFallbackId.cjs");
|
|
6
|
+
const require_index = require("../../../hooks/useIcon/index.cjs");
|
|
6
7
|
const require_IconClear = require("../../icons/IconClear/IconClear.cjs");
|
|
7
8
|
const require_Column = require("../../Column/Column.cjs");
|
|
8
9
|
const require_Columns = require("../../Columns/Columns.cjs");
|
|
9
10
|
const require_Bleed = require("../../Bleed/Bleed.cjs");
|
|
10
11
|
const require_ButtonIcon = require("../../ButtonIcon/ButtonIcon.cjs");
|
|
12
|
+
const require_HiddenVisually = require("../../HiddenVisually/HiddenVisually.cjs");
|
|
11
13
|
const require_normalizeKey = require("../normalizeKey.cjs");
|
|
12
14
|
const require_Heading = require("../../Heading/Heading.cjs");
|
|
13
15
|
const require_pageBlockGutters = require("../../PageBlock/pageBlockGutters.cjs");
|
|
@@ -22,6 +24,7 @@ const modalPadding = {
|
|
|
22
24
|
mobile: "gutter",
|
|
23
25
|
tablet: "large"
|
|
24
26
|
};
|
|
27
|
+
const modalContentGap = "large";
|
|
25
28
|
const ModalContentHeader = (0, react.forwardRef)(({ title, headingLevel, description, descriptionId, illustration, reserveCloseArea }, ref) => {
|
|
26
29
|
const header = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_Stack.Stack, {
|
|
27
30
|
space: headingLevel === "2" ? {
|
|
@@ -79,7 +82,7 @@ const ModalContentScrollLayout = ({ children, contentStartRef, coverImageEnabled
|
|
|
79
82
|
direction: "vertical",
|
|
80
83
|
children: [coverImageEnabled && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { ref: contentStartRef }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Box.Box, {
|
|
81
84
|
display: "flex",
|
|
82
|
-
gap:
|
|
85
|
+
gap: modalContentGap,
|
|
83
86
|
flexDirection: "column",
|
|
84
87
|
height: applyFullHeight ? "full" : void 0,
|
|
85
88
|
paddingTop: modalPadding,
|
|
@@ -128,7 +131,7 @@ const ModalCoverImageLayout = ({ width, image, children, footer, applyHeightLimi
|
|
|
128
131
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Column.Column, { children: coverImage$1 }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Column.Column, { children: content })]
|
|
129
132
|
});
|
|
130
133
|
};
|
|
131
|
-
const ModalContent = ({ id, children, description, onClose, width, closeLabel = "Close", illustration, coverImage, title, headingRef: headingRefProp, modalRef: modalRefProp, scrollLock = true, position, headingLevel, data, footer, ...restProps }) => {
|
|
134
|
+
const ModalContent = ({ id, children, description, onClose, width, closeLabel = "Close", illustration, coverImage, title, "aria-label": ariaLabel, "aria-description": ariaDescription, headingRef: headingRefProp, dialogRef, modalRef: modalRefProp, scrollLock = true, position, headingLevel, data, footer, ...restProps }) => {
|
|
132
135
|
const resolvedId = require_useFallbackId.useFallbackId(id);
|
|
133
136
|
const descriptionId = (0, react.useId)();
|
|
134
137
|
const defaultModalRef = (0, react.useRef)(null);
|
|
@@ -161,25 +164,48 @@ const ModalContent = ({ id, children, description, onClose, width, closeLabel =
|
|
|
161
164
|
contentStartRef,
|
|
162
165
|
coverImageEnabled,
|
|
163
166
|
hasFooter: Boolean(footer),
|
|
164
|
-
children: [
|
|
165
|
-
title,
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
167
|
+
children: [
|
|
168
|
+
title ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ModalContentHeader, {
|
|
169
|
+
title,
|
|
170
|
+
headingLevel,
|
|
171
|
+
description,
|
|
172
|
+
descriptionId,
|
|
173
|
+
illustration: illustration && !coverImageEnabled ? illustration : void 0,
|
|
174
|
+
ref: headingRef,
|
|
175
|
+
reserveCloseArea: true
|
|
176
|
+
}) : null,
|
|
177
|
+
isDrawer && !title ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
178
|
+
require_Bleed.Bleed,
|
|
179
|
+
/**
|
|
180
|
+
* Matches close button size so content starts below it. `bottom`
|
|
181
|
+
* cancels the gap that follows the spacer.
|
|
182
|
+
*/
|
|
183
|
+
{
|
|
184
|
+
top: "xxsmall",
|
|
185
|
+
bottom: modalContentGap,
|
|
186
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Box.Box, {
|
|
187
|
+
padding: "xsmall",
|
|
188
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Box.Box, { className: require_index.iconSize({
|
|
189
|
+
size: "standard",
|
|
190
|
+
crop: true
|
|
191
|
+
}) })
|
|
192
|
+
})
|
|
193
|
+
}
|
|
194
|
+
) : null,
|
|
195
|
+
children
|
|
196
|
+
]
|
|
173
197
|
});
|
|
174
198
|
const modalFooter = footer ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ModalFooter, {
|
|
175
199
|
applyPageBlockGutters: isDrawer,
|
|
176
200
|
children: footer
|
|
177
201
|
}) : null;
|
|
178
202
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Box.Box, {
|
|
203
|
+
ref: dialogRef,
|
|
179
204
|
role: "dialog",
|
|
180
|
-
"aria-label": title,
|
|
181
|
-
"aria-describedby": description ? descriptionId : void 0,
|
|
205
|
+
"aria-label": ariaLabel || title,
|
|
206
|
+
"aria-describedby": title && description || ariaDescription ? descriptionId : void 0,
|
|
182
207
|
"aria-modal": "true",
|
|
208
|
+
tabIndex: title ? void 0 : -1,
|
|
183
209
|
id: resolvedId,
|
|
184
210
|
onKeyDown: handleEscape,
|
|
185
211
|
position: "relative",
|
|
@@ -201,68 +227,75 @@ const ModalContent = ({ id, children, description, onClose, width, closeLabel =
|
|
|
201
227
|
borderRadius: modalRadius,
|
|
202
228
|
width: width !== "content" ? "full" : void 0,
|
|
203
229
|
maxWidth: width !== "content" ? width : void 0,
|
|
204
|
-
children: [
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
height: isDrawer ? "full" : void 0,
|
|
217
|
-
className: {
|
|
218
|
-
[require_Modal_css.pointerEventsAll]: true,
|
|
219
|
-
[require_Modal_css.maxSize[position]]: !isDrawer,
|
|
220
|
-
[require_Modal_css.hideOverflowAboveMobile]: allowColumnLayout
|
|
221
|
-
},
|
|
222
|
-
...require_buildDataAttributes.default({
|
|
223
|
-
data,
|
|
224
|
-
validateRestProps: restProps
|
|
225
|
-
}),
|
|
226
|
-
children: [coverImageEnabled && coverImage ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ScrollContainer.ScrollContainer, {
|
|
227
|
-
direction: "vertical",
|
|
228
|
-
startRef: contentStartRef,
|
|
229
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ModalCoverImageLayout, {
|
|
230
|
-
width,
|
|
231
|
-
image: coverImage,
|
|
232
|
-
footer: !isMobile ? modalFooter : null,
|
|
233
|
-
applyHeightLimit: allowColumnLayout,
|
|
234
|
-
children: modalLayout
|
|
235
|
-
})
|
|
236
|
-
}) : modalLayout, (!coverImageEnabled || isMobile) && modalFooter]
|
|
237
|
-
})
|
|
238
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Box.Box, {
|
|
239
|
-
position: "absolute",
|
|
240
|
-
zIndex: "sticky",
|
|
241
|
-
top: 0,
|
|
242
|
-
pointerEvents: "none",
|
|
243
|
-
width: "full",
|
|
244
|
-
display: "flex",
|
|
245
|
-
justifyContent: "flexEnd",
|
|
246
|
-
paddingTop: modalPadding,
|
|
247
|
-
paddingRight: isDrawer ? require_pageBlockGutters.pageBlockGutters : modalPadding,
|
|
248
|
-
className: !isDrawer && require_Modal_css.maxSize[position],
|
|
249
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Bleed.Bleed, {
|
|
250
|
-
space: "xxsmall",
|
|
251
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Box.Box, {
|
|
252
|
-
position: "relative",
|
|
230
|
+
children: [
|
|
231
|
+
ariaDescription ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_HiddenVisually.HiddenVisually, {
|
|
232
|
+
id: descriptionId,
|
|
233
|
+
children: ariaDescription
|
|
234
|
+
}) : null,
|
|
235
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_remove_scroll.RemoveScroll, {
|
|
236
|
+
noRelative: true,
|
|
237
|
+
forwardProps: true,
|
|
238
|
+
enabled: scrollLock,
|
|
239
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_Box.Box, {
|
|
240
|
+
display: "flex",
|
|
241
|
+
flexDirection: "column",
|
|
253
242
|
background: "surface",
|
|
254
|
-
borderRadius:
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
243
|
+
borderRadius: modalRadius,
|
|
244
|
+
overflow: "auto",
|
|
245
|
+
position: "relative",
|
|
246
|
+
width: width !== "content" ? "full" : void 0,
|
|
247
|
+
height: isDrawer ? "full" : void 0,
|
|
248
|
+
className: {
|
|
249
|
+
[require_Modal_css.pointerEventsAll]: true,
|
|
250
|
+
[require_Modal_css.maxSize[position]]: !isDrawer,
|
|
251
|
+
[require_Modal_css.hideOverflowAboveMobile]: allowColumnLayout
|
|
252
|
+
},
|
|
253
|
+
...require_buildDataAttributes.default({
|
|
254
|
+
data,
|
|
255
|
+
validateRestProps: restProps
|
|
256
|
+
}),
|
|
257
|
+
children: [coverImageEnabled && coverImage ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ScrollContainer.ScrollContainer, {
|
|
258
|
+
direction: "vertical",
|
|
259
|
+
startRef: contentStartRef,
|
|
260
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ModalCoverImageLayout, {
|
|
261
|
+
width,
|
|
262
|
+
image: coverImage,
|
|
263
|
+
footer: !isMobile ? modalFooter : null,
|
|
264
|
+
applyHeightLimit: allowColumnLayout,
|
|
265
|
+
children: modalLayout
|
|
266
|
+
})
|
|
267
|
+
}) : modalLayout, (!coverImageEnabled || isMobile) && modalFooter]
|
|
268
|
+
})
|
|
269
|
+
}),
|
|
270
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Box.Box, {
|
|
271
|
+
position: "absolute",
|
|
272
|
+
zIndex: "sticky",
|
|
273
|
+
top: 0,
|
|
274
|
+
pointerEvents: "none",
|
|
275
|
+
width: "full",
|
|
276
|
+
display: "flex",
|
|
277
|
+
justifyContent: "flexEnd",
|
|
278
|
+
paddingTop: modalPadding,
|
|
279
|
+
paddingRight: isDrawer ? require_pageBlockGutters.pageBlockGutters : modalPadding,
|
|
280
|
+
className: !isDrawer && require_Modal_css.maxSize[position],
|
|
281
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Bleed.Bleed, {
|
|
282
|
+
space: "xxsmall",
|
|
283
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Box.Box, {
|
|
284
|
+
position: "relative",
|
|
285
|
+
background: "surface",
|
|
286
|
+
borderRadius: "full",
|
|
287
|
+
padding: "xsmall",
|
|
288
|
+
className: [require_Modal_css.closeIconOffset, require_Modal_css.pointerEventsAll],
|
|
289
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ButtonIcon.ButtonIcon, {
|
|
290
|
+
label: closeLabel,
|
|
291
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_IconClear.IconClear, { tone: "secondary" }),
|
|
292
|
+
variant: "transparent",
|
|
293
|
+
onClick: onClose
|
|
294
|
+
})
|
|
262
295
|
})
|
|
263
296
|
})
|
|
264
297
|
})
|
|
265
|
-
|
|
298
|
+
]
|
|
266
299
|
})
|
|
267
300
|
});
|
|
268
301
|
};
|