braid-design-system 34.1.0 → 34.2.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.
Files changed (58) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/dist/color-mode/query-param.d.cts +1 -1
  3. package/dist/color-mode/query-param.d.mts +1 -1
  4. package/dist/css.cjs +3 -2
  5. package/dist/css.d.cts +4 -0
  6. package/dist/css.d.mts +4 -0
  7. package/dist/css.mjs +3 -2
  8. package/dist/lib/components/Badge/Badge.cjs +3 -1
  9. package/dist/lib/components/Badge/Badge.d.cts +2 -0
  10. package/dist/lib/components/Badge/Badge.d.mts +2 -0
  11. package/dist/lib/components/Badge/Badge.mjs +3 -1
  12. package/dist/lib/components/Drawer/Drawer.d.cts +1 -1
  13. package/dist/lib/components/Drawer/Drawer.d.mts +1 -1
  14. package/dist/lib/components/MenuRenderer/MenuRenderer.cjs +1 -1
  15. package/dist/lib/components/MenuRenderer/MenuRenderer.mjs +1 -1
  16. package/dist/lib/components/private/Modal/Modal.css.cjs +20 -3
  17. package/dist/lib/components/private/Modal/Modal.css.mjs +18 -5
  18. package/dist/lib/components/private/Modal/ModalContent.cjs +131 -67
  19. package/dist/lib/components/private/Modal/ModalContent.d.cts +9 -3
  20. package/dist/lib/components/private/Modal/ModalContent.d.mts +9 -3
  21. package/dist/lib/components/private/Modal/ModalContent.mjs +134 -70
  22. package/dist/lib/components/private/ScrollContainer/ScrollContainer.cjs +25 -6
  23. package/dist/lib/components/private/ScrollContainer/ScrollContainer.css.cjs +14 -6
  24. package/dist/lib/components/private/ScrollContainer/ScrollContainer.css.mjs +15 -7
  25. package/dist/lib/components/private/ScrollContainer/ScrollContainer.mjs +25 -6
  26. package/dist/lib/components/private/scrollbars.css.cjs +27 -0
  27. package/dist/lib/components/private/scrollbars.css.mjs +26 -0
  28. package/dist/lib/playroom/snippets/BrandedContainer.cjs +16 -0
  29. package/dist/lib/playroom/snippets/BrandedContainer.mjs +15 -0
  30. package/dist/lib/playroom/snippets/CardList.cjs +10 -0
  31. package/dist/lib/playroom/snippets/CardList.mjs +9 -0
  32. package/dist/lib/playroom/snippets/CompactPage.cjs +10 -0
  33. package/dist/lib/playroom/snippets/CompactPage.mjs +9 -0
  34. package/dist/lib/playroom/snippets/DividedList.cjs +10 -0
  35. package/dist/lib/playroom/snippets/DividedList.mjs +9 -0
  36. package/dist/lib/playroom/snippets/Form.cjs +14 -0
  37. package/dist/lib/playroom/snippets/Form.mjs +13 -0
  38. package/dist/lib/playroom/snippets/SpaciousPage.cjs +10 -0
  39. package/dist/lib/playroom/snippets/SpaciousPage.mjs +9 -0
  40. package/dist/lib/playroom/snippets/StandardPage.cjs +10 -0
  41. package/dist/lib/playroom/snippets/StandardPage.mjs +9 -0
  42. package/dist/lib/playroom/snippets/StandardSection.cjs +10 -0
  43. package/dist/lib/playroom/snippets/StandardSection.mjs +9 -0
  44. package/dist/lib/playroom/snippets/SteppedSection.cjs +10 -0
  45. package/dist/lib/playroom/snippets/SteppedSection.mjs +9 -0
  46. package/dist/lib/playroom/snippets/TabbedSection.cjs +10 -0
  47. package/dist/lib/playroom/snippets/TabbedSection.mjs +9 -0
  48. package/dist/lib/playroom/snippets/TableSection.cjs +10 -0
  49. package/dist/lib/playroom/snippets/TableSection.mjs +9 -0
  50. package/dist/lib/playroom/snippets.cjs +22 -4
  51. package/dist/lib/playroom/snippets.mjs +108 -90
  52. package/dist/lib/themes/baseTokens/nvl.cjs +1 -1
  53. package/dist/lib/themes/baseTokens/nvl.mjs +1 -1
  54. package/package.json +3 -4
  55. package/dist/lib/playroom/snippets/layouts.cjs +0 -22
  56. package/dist/lib/playroom/snippets/layouts.mjs +0 -21
  57. package/dist/lib/playroom/snippets/sections.cjs +0 -59
  58. package/dist/lib/playroom/snippets/sections.mjs +0 -58
package/CHANGELOG.md CHANGED
@@ -1,5 +1,63 @@
1
1
  # braid-design-system
2
2
 
3
+ ## 34.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - **Dialog:** Add `coverImage` support ([#2052](https://github.com/seek-oss/braid-design-system/pull/2052))
8
+
9
+ Add support for providing a URL for a cover image to display at the top of the Dialog via the `coverImage` prop.
10
+ The provided image must be compatible with the [CSS background-image “url” function].
11
+
12
+ **EXAMPLE USAGE:**
13
+
14
+ ```jsx
15
+ <Dialog
16
+ title="Cover Image"
17
+ coverImage="https://placehold.co/1600x900/051A49/FFFFFF/png?text=​++++++16:9++++++​"
18
+ open={true}
19
+ onClose={() => {}}
20
+ >
21
+ <Placeholder height={100} width="100%" label="Dialog Content" />
22
+ </Dialog>
23
+ ```
24
+
25
+ [CSS background-image “url” function]: https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/background-image
26
+
27
+ - **vars:** Exposed `vars.transition`. Transition CSS variables are available in stylesheets and runtime styles. ([#2034](https://github.com/seek-oss/braid-design-system/pull/2034))
28
+
29
+ **EXAMPLE USAGE:**
30
+
31
+ ```ts
32
+ import { vars } from 'braid-design-system/css':
33
+
34
+ export const myStyle = style({
35
+ transition: vars.transition.fast,
36
+ });
37
+ ```
38
+
39
+ - **Badge:** Added aria-hidden and aria-label props. ([#2034](https://github.com/seek-oss/braid-design-system/pull/2034))
40
+
41
+ `aria-hidden` allows a badge to be hidden from assistive technology
42
+
43
+ `aria-label` allows visible badge text to be overridden with a more descriptive label for screen readers
44
+
45
+ **EXAMPLE USAGE:**
46
+
47
+ ```jsx
48
+ <Badge aria-hidden>Deprecated</Badge>
49
+ ```
50
+
51
+ ```jsx
52
+ <Badge aria-label="You have 2 notifications">2</Badge>
53
+ ```
54
+
55
+ ### Patch Changes
56
+
57
+ - **seekJobs, seekBusiness:** Update webfont url ([#2044](https://github.com/seek-oss/braid-design-system/pull/2044))
58
+
59
+ Point to the `www.seek.com` domain instead of `www.seek.com.au`.
60
+
3
61
  ## 34.1.0
4
62
 
5
63
  ### Minor Changes
@@ -43,6 +43,6 @@ declare const colorModeQueryParamCheck: string;
43
43
  *
44
44
  * @returns Braid color mode preference as query string parameter
45
45
  */
46
- declare const getColorModeQueryParam: () => "_bdsdm=0" | "_bdsdm=1" | "_bdsdm=2" | "";
46
+ declare const getColorModeQueryParam: () => "" | "_bdsdm=1" | "_bdsdm=2" | "_bdsdm=0";
47
47
  //#endregion
48
48
  export { colorModeQueryParamCheck, getColorModeQueryParam };
@@ -43,6 +43,6 @@ declare const colorModeQueryParamCheck: string;
43
43
  *
44
44
  * @returns Braid color mode preference as query string parameter
45
45
  */
46
- declare const getColorModeQueryParam: () => "_bdsdm=0" | "_bdsdm=1" | "_bdsdm=2" | "";
46
+ declare const getColorModeQueryParam: () => "" | "_bdsdm=1" | "_bdsdm=2" | "_bdsdm=0";
47
47
  //#endregion
48
48
  export { colorModeQueryParamCheck, getColorModeQueryParam };
package/dist/css.cjs CHANGED
@@ -8,7 +8,7 @@ const require_atoms = require('./lib/css/atoms/atoms.cjs');
8
8
  const require_globalTypographyStyles = require('./lib/css/globalTypographyStyles.cjs');
9
9
 
10
10
  //#region src/css.ts
11
- const { grid, space, touchableSize, contentWidth, backgroundColor: { surfaceDark: _, bodyDark: __, ...backgroundColor }, foregroundColor, textWeight, borderColor, borderRadius, borderWidth, shadow } = require_vars_css.vars;
11
+ const { grid, space, touchableSize, contentWidth, backgroundColor: { surfaceDark: _, bodyDark: __, ...backgroundColor }, foregroundColor, textWeight, borderColor, borderRadius, borderWidth, shadow, transition } = require_vars_css.vars;
12
12
  const vars = {
13
13
  grid,
14
14
  space,
@@ -20,7 +20,8 @@ const vars = {
20
20
  borderColor,
21
21
  borderRadius,
22
22
  borderWidth,
23
- shadow
23
+ shadow,
24
+ transition
24
25
  };
25
26
  function atoms(props) {
26
27
  if (process.env.NODE_ENV !== "production") {
package/dist/css.d.cts CHANGED
@@ -131,6 +131,10 @@ declare const vars: {
131
131
  medium: `var(--${string})`;
132
132
  large: `var(--${string})`;
133
133
  };
134
+ transition: {
135
+ fast: `var(--${string})`;
136
+ touchable: `var(--${string})`;
137
+ };
134
138
  };
135
139
  declare function atoms(props: Omit<Atoms, 'background'>): string;
136
140
  //#endregion
package/dist/css.d.mts CHANGED
@@ -131,6 +131,10 @@ declare const vars: {
131
131
  medium: `var(--${string})`;
132
132
  large: `var(--${string})`;
133
133
  };
134
+ transition: {
135
+ fast: `var(--${string})`;
136
+ touchable: `var(--${string})`;
137
+ };
134
138
  };
135
139
  declare function atoms(props: Omit<Atoms, 'background'>): string;
136
140
  //#endregion
package/dist/css.mjs CHANGED
@@ -7,7 +7,7 @@ import { atoms as atoms$1 } from "./lib/css/atoms/atoms.mjs";
7
7
  import { globalHeadingStyle, globalTextStyle } from "./lib/css/globalTypographyStyles.mjs";
8
8
 
9
9
  //#region src/css.ts
10
- const { grid, space, touchableSize, contentWidth, backgroundColor: { surfaceDark: _, bodyDark: __, ...backgroundColor }, foregroundColor, textWeight, borderColor, borderRadius, borderWidth, shadow } = vars$1;
10
+ const { grid, space, touchableSize, contentWidth, backgroundColor: { surfaceDark: _, bodyDark: __, ...backgroundColor }, foregroundColor, textWeight, borderColor, borderRadius, borderWidth, shadow, transition } = vars$1;
11
11
  const vars = {
12
12
  grid,
13
13
  space,
@@ -19,7 +19,8 @@ const vars = {
19
19
  borderColor,
20
20
  borderRadius,
21
21
  borderWidth,
22
- shadow
22
+ shadow,
23
+ transition
23
24
  };
24
25
  function atoms(props) {
25
26
  if (process.env.NODE_ENV !== "production") {
@@ -35,7 +35,7 @@ const stringifyChildren = (children) => {
35
35
  if (typeof children === "number") return children.toString();
36
36
  return children.join("");
37
37
  };
38
- const Badge = (0, react.forwardRef)(({ tone = "info", weight = "regular", bleedY: bleedYProp, title, children, id, data, tabIndex, "aria-describedby": ariaDescribedBy, ...restProps }, ref) => {
38
+ const Badge = (0, react.forwardRef)(({ tone = "info", weight = "regular", bleedY: bleedYProp, title, children, id, data, tabIndex, "aria-describedby": ariaDescribedBy, "aria-hidden": ariaHidden, "aria-label": ariaLabel, ...restProps }, ref) => {
39
39
  (0, assert.default)(validBadgeTones.indexOf(tone) >= 0, `Badge tone of "${tone}" is not valid.`);
40
40
  (0, assert.default)(react.Children.toArray(children).every((child) => ["string", "number"].includes(typeof child)), "Badge may only contain strings or numbers");
41
41
  const textContext = (0, react.useContext)(require_TextContext.TextContext);
@@ -53,6 +53,8 @@ const Badge = (0, react.forwardRef)(({ tone = "info", weight = "regular", bleedY
53
53
  ref,
54
54
  tabIndex,
55
55
  "aria-describedby": ariaDescribedBy,
56
+ "aria-hidden": ariaHidden,
57
+ "aria-label": ariaLabel,
56
58
  title: title ?? (!ariaDescribedBy ? stringifyChildren(children) : void 0),
57
59
  background: weight === "strong" ? tone : lightModeBackgroundForTone[tone],
58
60
  paddingY: require_Badge_css.verticalPadding,
@@ -18,6 +18,8 @@ interface BadgeProps {
18
18
  data?: DataAttributeMap;
19
19
  tabIndex?: BoxProps['tabIndex'];
20
20
  'aria-describedby'?: string;
21
+ 'aria-hidden'?: boolean;
22
+ 'aria-label'?: string;
21
23
  }
22
24
  declare const Badge: react.ForwardRefExoticComponent<BadgeProps & react.RefAttributes<HTMLSpanElement>>;
23
25
  //#endregion
@@ -18,6 +18,8 @@ interface BadgeProps {
18
18
  data?: DataAttributeMap;
19
19
  tabIndex?: BoxProps['tabIndex'];
20
20
  'aria-describedby'?: string;
21
+ 'aria-hidden'?: boolean;
22
+ 'aria-label'?: string;
21
23
  }
22
24
  declare const Badge: react.ForwardRefExoticComponent<BadgeProps & react.RefAttributes<HTMLSpanElement>>;
23
25
  //#endregion
@@ -33,7 +33,7 @@ const stringifyChildren = (children) => {
33
33
  if (typeof children === "number") return children.toString();
34
34
  return children.join("");
35
35
  };
36
- const Badge = forwardRef(({ tone = "info", weight = "regular", bleedY: bleedYProp, title, children, id, data, tabIndex, "aria-describedby": ariaDescribedBy, ...restProps }, ref) => {
36
+ const Badge = forwardRef(({ tone = "info", weight = "regular", bleedY: bleedYProp, title, children, id, data, tabIndex, "aria-describedby": ariaDescribedBy, "aria-hidden": ariaHidden, "aria-label": ariaLabel, ...restProps }, ref) => {
37
37
  assert(validBadgeTones.indexOf(tone) >= 0, `Badge tone of "${tone}" is not valid.`);
38
38
  assert(Children.toArray(children).every((child) => ["string", "number"].includes(typeof child)), "Badge may only contain strings or numbers");
39
39
  const textContext = useContext(TextContext);
@@ -51,6 +51,8 @@ const Badge = forwardRef(({ tone = "info", weight = "regular", bleedY: bleedYPro
51
51
  ref,
52
52
  tabIndex,
53
53
  "aria-describedby": ariaDescribedBy,
54
+ "aria-hidden": ariaHidden,
55
+ "aria-label": ariaLabel,
54
56
  title: title ?? (!ariaDescribedBy ? stringifyChildren(children) : void 0),
55
57
  background: weight === "strong" ? tone : lightModeBackgroundForTone[tone],
56
58
  paddingY: verticalPadding,
@@ -8,7 +8,7 @@ declare const modalStyle: {
8
8
  readonly headingLevel: "2";
9
9
  readonly illustration: undefined;
10
10
  };
11
- interface DrawerProps extends Omit<ModalProps, keyof typeof modalStyle | 'width' | 'position'> {
11
+ interface DrawerProps extends Omit<ModalProps, keyof typeof modalStyle | 'width' | 'position' | 'coverImage'> {
12
12
  width?: (typeof validWidths)[number];
13
13
  position?: (typeof validPositions)[number];
14
14
  }
@@ -7,7 +7,7 @@ declare const modalStyle: {
7
7
  readonly headingLevel: "2";
8
8
  readonly illustration: undefined;
9
9
  };
10
- interface DrawerProps extends Omit<ModalProps, keyof typeof modalStyle | 'width' | 'position'> {
10
+ interface DrawerProps extends Omit<ModalProps, keyof typeof modalStyle | 'width' | 'position' | 'coverImage'> {
11
11
  width?: (typeof validWidths)[number];
12
12
  position?: (typeof validPositions)[number];
13
13
  }
@@ -7,9 +7,9 @@ const require_Overlay = require('../private/Overlay/Overlay.cjs');
7
7
  const require_Popover = require('../private/Popover/Popover.cjs');
8
8
  const require_getNextIndex = require('../private/getNextIndex.cjs');
9
9
  const require_normalizeKey = require('../private/normalizeKey.cjs');
10
+ const require_ScrollContainer = require('../private/ScrollContainer/ScrollContainer.cjs');
10
11
  const require_MenuRendererContext = require('./MenuRendererContext.cjs');
11
12
  const require_MenuItemDivider = require('../MenuItemDivider/MenuItemDivider.cjs');
12
- const require_ScrollContainer = require('../private/ScrollContainer/ScrollContainer.cjs');
13
13
  const require_MenuRenderer_actions = require('./MenuRenderer.actions.cjs');
14
14
  const require_MenuRendererItemContext = require('./MenuRendererItemContext.cjs');
15
15
  const require_MenuRenderer_css = require('./MenuRenderer.css.cjs');
@@ -6,9 +6,9 @@ import { Overlay } from "../private/Overlay/Overlay.mjs";
6
6
  import { Popover } from "../private/Popover/Popover.mjs";
7
7
  import { getNextIndex } from "../private/getNextIndex.mjs";
8
8
  import { normalizeKey } from "../private/normalizeKey.mjs";
9
+ import { ScrollContainer } from "../private/ScrollContainer/ScrollContainer.mjs";
9
10
  import { MenuRendererContext } from "./MenuRendererContext.mjs";
10
11
  import { MenuItemDivider } from "../MenuItemDivider/MenuItemDivider.mjs";
11
- import { ScrollContainer } from "../private/ScrollContainer/ScrollContainer.mjs";
12
12
  import { actionTypes } from "./MenuRenderer.actions.mjs";
13
13
  import { MenuRendererItemContext } from "./MenuRendererItemContext.mjs";
14
14
  import { menuHeightLimit, menuYPadding, width } from "./MenuRenderer.css.mjs";
@@ -69,9 +69,10 @@ const gutterSizeVar = (0, _vanilla_extract_css.createVar)("gutterSizeVar");
69
69
  const fullHeightVar = (0, _vanilla_extract_css.createVar)("fullHeightVar");
70
70
  const fullWidthVar = (0, _vanilla_extract_css.createVar)("fullWidthVar");
71
71
  const viewportHeight = (0, _vanilla_extract_css.style)({ maxHeight: fullHeightVar }, "viewportHeight");
72
+ const overrideMaxHeightForScreenshot = (0, _vanilla_extract_css.createVar)("overrideMaxHeightForScreenshot");
72
73
  const maxSize = {
73
74
  center: (0, _vanilla_extract_css.style)([{
74
- maxHeight: _vanilla_extract_css_utils.calc.subtract(fullHeightVar, _vanilla_extract_css_utils.calc.multiply(gutterSizeVar, 2)),
75
+ maxHeight: (0, _vanilla_extract_css.fallbackVar)(overrideMaxHeightForScreenshot, _vanilla_extract_css_utils.calc.subtract(fullHeightVar, _vanilla_extract_css_utils.calc.multiply(gutterSizeVar, 2))),
75
76
  maxWidth: _vanilla_extract_css_utils.calc.subtract(fullWidthVar, _vanilla_extract_css_utils.calc.multiply(gutterSizeVar, 2))
76
77
  }, require_responsiveStyle.responsiveStyle({
77
78
  mobile: { vars: { [gutterSizeVar]: require_vars_css.vars.space[require_ModalExternalGutter.externalGutter.mobile] } },
@@ -90,23 +91,39 @@ const modalContainer = (0, _vanilla_extract_css.style)({
90
91
  [fullHeightVar]: "100dvh",
91
92
  [fullWidthVar]: "100dvw"
92
93
  } } },
94
+ display: "flex",
95
+ alignItems: "center",
93
96
  maxHeight: fullHeightVar,
94
97
  maxWidth: fullWidthVar
95
98
  }, "modalContainer");
96
99
  const headingRoot = (0, _vanilla_extract_css.style)({ overflowWrap: "break-word" }, "headingRoot");
97
100
  const closeIconOffset = (0, _vanilla_extract_css.style)({
98
- top: "-5px",
99
- right: "-5px"
101
+ top: "-2px",
102
+ right: "-2px"
100
103
  }, "closeIconOffset");
104
+ const hideOverflowAboveMobile = (0, _vanilla_extract_css.style)(require_responsiveStyle.responsiveStyle({ tablet: { overflow: "hidden" } }), "hideOverflowAboveMobile");
105
+ const maximumHeightForCoverImage = "60vh";
106
+ const coverImageHeightLimit = (0, _vanilla_extract_css.style)(require_responsiveStyle.responsiveStyle({ tablet: { maxHeight: (0, _vanilla_extract_css.fallbackVar)(overrideMaxHeightForScreenshot, maximumHeightForCoverImage) } }), "coverImageHeightLimit");
107
+ const coverImageVar = (0, _vanilla_extract_css.createVar)("coverImageVar");
108
+ const coverImage = (0, _vanilla_extract_css.style)([require_responsiveStyle.responsiveStyle({ mobile: { aspectRatio: "16 / 9" } }), {
109
+ backgroundSize: "cover",
110
+ backgroundPosition: "center",
111
+ backgroundRepeat: "no-repeat",
112
+ backgroundImage: coverImageVar
113
+ }], "coverImage");
101
114
  (0, _vanilla_extract_css_fileScope.endFileScope)();
102
115
 
103
116
  //#endregion
104
117
  exports.backdrop = backdrop;
105
118
  exports.closeIconOffset = closeIconOffset;
119
+ exports.coverImage = coverImage;
120
+ exports.coverImageHeightLimit = coverImageHeightLimit;
121
+ exports.coverImageVar = coverImageVar;
106
122
  exports.entrance = entrance;
107
123
  exports.exit = exit;
108
124
  exports.fixedStackingContext = fixedStackingContext;
109
125
  exports.headingRoot = headingRoot;
126
+ exports.hideOverflowAboveMobile = hideOverflowAboveMobile;
110
127
  exports.maxSize = maxSize;
111
128
  exports.modalContainer = modalContainer;
112
129
  exports.pointerEventsAll = pointerEventsAll;
@@ -4,7 +4,7 @@ import { responsiveStyle } from "../../../css/responsiveStyle.mjs";
4
4
  import { atoms } from "../../../css/atoms/atoms.mjs";
5
5
  import { externalGutter } from "./ModalExternalGutter.mjs";
6
6
  import { endFileScope, setFileScope } from "@vanilla-extract/css/fileScope";
7
- import { createVar, style } from "@vanilla-extract/css";
7
+ import { createVar, fallbackVar, style } from "@vanilla-extract/css";
8
8
  import { calc } from "@vanilla-extract/css-utils";
9
9
 
10
10
  //#region src/lib/components/private/Modal/Modal.css.ts
@@ -68,9 +68,10 @@ const gutterSizeVar = createVar("gutterSizeVar");
68
68
  const fullHeightVar = createVar("fullHeightVar");
69
69
  const fullWidthVar = createVar("fullWidthVar");
70
70
  const viewportHeight = style({ maxHeight: fullHeightVar }, "viewportHeight");
71
+ const overrideMaxHeightForScreenshot = createVar("overrideMaxHeightForScreenshot");
71
72
  const maxSize = {
72
73
  center: style([{
73
- maxHeight: calc.subtract(fullHeightVar, calc.multiply(gutterSizeVar, 2)),
74
+ maxHeight: fallbackVar(overrideMaxHeightForScreenshot, calc.subtract(fullHeightVar, calc.multiply(gutterSizeVar, 2))),
74
75
  maxWidth: calc.subtract(fullWidthVar, calc.multiply(gutterSizeVar, 2))
75
76
  }, responsiveStyle({
76
77
  mobile: { vars: { [gutterSizeVar]: vars.space[externalGutter.mobile] } },
@@ -89,15 +90,27 @@ const modalContainer = style({
89
90
  [fullHeightVar]: "100dvh",
90
91
  [fullWidthVar]: "100dvw"
91
92
  } } },
93
+ display: "flex",
94
+ alignItems: "center",
92
95
  maxHeight: fullHeightVar,
93
96
  maxWidth: fullWidthVar
94
97
  }, "modalContainer");
95
98
  const headingRoot = style({ overflowWrap: "break-word" }, "headingRoot");
96
99
  const closeIconOffset = style({
97
- top: "-5px",
98
- right: "-5px"
100
+ top: "-2px",
101
+ right: "-2px"
99
102
  }, "closeIconOffset");
103
+ const hideOverflowAboveMobile = style(responsiveStyle({ tablet: { overflow: "hidden" } }), "hideOverflowAboveMobile");
104
+ const maximumHeightForCoverImage = "60vh";
105
+ const coverImageHeightLimit = style(responsiveStyle({ tablet: { maxHeight: fallbackVar(overrideMaxHeightForScreenshot, maximumHeightForCoverImage) } }), "coverImageHeightLimit");
106
+ const coverImageVar = createVar("coverImageVar");
107
+ const coverImage = style([responsiveStyle({ mobile: { aspectRatio: "16 / 9" } }), {
108
+ backgroundSize: "cover",
109
+ backgroundPosition: "center",
110
+ backgroundRepeat: "no-repeat",
111
+ backgroundImage: coverImageVar
112
+ }], "coverImage");
100
113
  endFileScope();
101
114
 
102
115
  //#endregion
103
- export { backdrop, closeIconOffset, entrance, exit, fixedStackingContext, headingRoot, maxSize, modalContainer, pointerEventsAll, resetStackingContext, transition };
116
+ export { backdrop, closeIconOffset, coverImage, coverImageHeightLimit, coverImageVar, entrance, exit, fixedStackingContext, headingRoot, hideOverflowAboveMobile, maxSize, modalContainer, pointerEventsAll, resetStackingContext, transition };
@@ -4,14 +4,18 @@ 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
6
  const require_IconClear = require('../../icons/IconClear/IconClear.cjs');
7
+ const require_Column = require('../../Column/Column.cjs');
8
+ const require_Columns = require('../../Columns/Columns.cjs');
7
9
  const require_Bleed = require('../../Bleed/Bleed.cjs');
8
10
  const require_ButtonIcon = require('../../ButtonIcon/ButtonIcon.cjs');
9
11
  const require_normalizeKey = require('../normalizeKey.cjs');
10
12
  const require_Heading = require('../../Heading/Heading.cjs');
11
13
  const require_pageBlockGutters = require('../../PageBlock/pageBlockGutters.cjs');
14
+ const require_ScrollContainer = require('../ScrollContainer/ScrollContainer.cjs');
12
15
  const require_Modal_css = require('./Modal.css.cjs');
13
16
  let react = require("react");
14
17
  let react_jsx_runtime = require("react/jsx-runtime");
18
+ let _vanilla_extract_dynamic = require("@vanilla-extract/dynamic");
15
19
  let react_remove_scroll = require("react-remove-scroll");
16
20
 
17
21
  //#region src/lib/components/private/Modal/ModalContent.tsx
@@ -19,48 +23,130 @@ const modalPadding = {
19
23
  mobile: "gutter",
20
24
  tablet: "large"
21
25
  };
22
- const ModalContentHeader = (0, react.forwardRef)(({ title, headingLevel, description, descriptionId, center }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_Stack.Stack, {
23
- space: headingLevel === "2" ? {
24
- mobile: "small",
25
- tablet: "medium"
26
- } : "small",
27
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Heading.Heading, {
28
- level: headingLevel,
29
- align: center ? "center" : void 0,
26
+ const ModalContentHeader = (0, react.forwardRef)(({ title, headingLevel, description, descriptionId, illustration, reserveCloseArea }, ref) => {
27
+ const header = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_Stack.Stack, {
28
+ space: headingLevel === "2" ? {
29
+ mobile: "small",
30
+ tablet: "medium"
31
+ } : "small",
32
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Heading.Heading, {
33
+ level: headingLevel,
34
+ align: illustration ? "center" : void 0,
35
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Box.Box, {
36
+ ref,
37
+ tabIndex: -1,
38
+ component: "span",
39
+ position: "relative",
40
+ outline: "focus",
41
+ borderRadius: "small",
42
+ className: require_Modal_css.headingRoot,
43
+ children: title
44
+ })
45
+ }), description ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Box.Box, {
46
+ id: descriptionId,
47
+ children: description
48
+ }) : null]
49
+ });
50
+ const resolvedLayout = illustration ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_Stack.Stack, {
51
+ space: "medium",
52
+ align: "center",
53
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Box.Box, {
54
+ paddingX: "gutter",
55
+ children: illustration
56
+ }), header]
57
+ }) : header;
58
+ return reserveCloseArea && !illustration ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_Box.Box, {
59
+ display: "flex",
60
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Box.Box, {
61
+ width: "full",
62
+ minWidth: 0,
63
+ children: resolvedLayout
64
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Box.Box, {
65
+ width: "touchable",
66
+ flexShrink: 0,
67
+ flexGrow: 0
68
+ })]
69
+ }) : resolvedLayout;
70
+ });
71
+ const ModalContentScrollLayout = ({ children, applyCoverImageHeightLimit, contentStartRef, coverImageEnabled, applyPageBlockGutters, applyFullHeight }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_ScrollContainer.ScrollContainer, {
72
+ direction: "vertical",
73
+ children: [coverImageEnabled && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { ref: contentStartRef }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Box.Box, {
74
+ className: applyCoverImageHeightLimit ? require_Modal_css.coverImageHeightLimit : void 0,
75
+ height: applyFullHeight ? "full" : void 0,
30
76
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Box.Box, {
31
- ref,
32
- tabIndex: -1,
33
- component: "span",
34
- position: "relative",
35
- outline: "focus",
36
- borderRadius: "small",
37
- className: require_Modal_css.headingRoot,
38
- children: title
77
+ display: "flex",
78
+ gap: "large",
79
+ flexDirection: "column",
80
+ height: applyFullHeight ? "full" : void 0,
81
+ paddingY: modalPadding,
82
+ paddingX: applyPageBlockGutters ? require_pageBlockGutters.pageBlockGutters : modalPadding,
83
+ children
84
+ })
85
+ })]
86
+ });
87
+ const ModalCoverImageLayout = ({ width, image, children }) => {
88
+ const forceStack = width === "xsmall";
89
+ const coverImage$1 = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Box.Box, {
90
+ position: "relative",
91
+ height: "full",
92
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Box.Box, {
93
+ position: { tablet: forceStack ? void 0 : "absolute" },
94
+ inset: 0,
95
+ className: require_Modal_css.coverImage,
96
+ width: "full",
97
+ height: "full",
98
+ style: (0, _vanilla_extract_dynamic.assignInlineVars)({ [require_Modal_css.coverImageVar]: `url(${image})` })
39
99
  })
40
- }), description ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Box.Box, {
41
- id: descriptionId,
42
- children: description
43
- }) : null]
44
- }));
45
- const ModalContent = ({ id, children, description, onClose, width, closeLabel = "Close", illustration, title, headingRef: headingRefProp, modalRef: modalRefProp, scrollLock = true, position, headingLevel, data, ...restProps }) => {
100
+ });
101
+ return forceStack ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_Stack.Stack, {
102
+ space: "none",
103
+ children: [coverImage$1, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children })]
104
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_Columns.Columns, {
105
+ space: "none",
106
+ collapseBelow: "tablet",
107
+ reverse: true,
108
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Column.Column, { children: coverImage$1 }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Column.Column, { children })]
109
+ });
110
+ };
111
+ const ModalContent = ({ id, children, description, onClose, width, closeLabel = "Close", illustration, coverImage, title, headingRef: headingRefProp, modalRef: modalRefProp, scrollLock = true, position, headingLevel, data, ...restProps }) => {
46
112
  const resolvedId = require_useFallbackId.useFallbackId(id);
47
113
  const descriptionId = (0, react.useId)();
48
114
  const defaultModalRef = (0, react.useRef)(null);
49
115
  const modalRef = modalRefProp || defaultModalRef;
50
116
  const defaultHeadingRef = (0, react.useRef)(null);
51
117
  const headingRef = headingRefProp || defaultHeadingRef;
118
+ const contentStartRef = (0, react.useRef)(null);
52
119
  const handleEscape = (event) => {
53
120
  if (require_normalizeKey.normalizeKey(event) === "Escape") {
54
121
  event.stopPropagation();
55
122
  onClose();
56
123
  }
57
124
  };
125
+ const isDrawer = position === "left" || position === "right";
126
+ const coverImageEnabled = Boolean(coverImage) && !isDrawer;
127
+ const allowColumnLayout = coverImageEnabled && width !== "xsmall";
58
128
  const justifyContent = {
59
129
  left: "flexStart",
60
130
  center: "center",
61
131
  right: "flexEnd"
62
132
  }[position];
63
- const modalRadius = position === "center" ? "xlarge" : void 0;
133
+ const modalRadius = !isDrawer ? "xlarge" : void 0;
134
+ const modalLayout = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(ModalContentScrollLayout, {
135
+ applyCoverImageHeightLimit: allowColumnLayout,
136
+ applyPageBlockGutters: isDrawer,
137
+ applyFullHeight: isDrawer,
138
+ contentStartRef,
139
+ coverImageEnabled,
140
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ModalContentHeader, {
141
+ title,
142
+ headingLevel,
143
+ description,
144
+ descriptionId,
145
+ illustration: illustration && !coverImageEnabled ? illustration : void 0,
146
+ ref: headingRef,
147
+ reserveCloseArea: true
148
+ }), children]
149
+ });
64
150
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Box.Box, {
65
151
  role: "dialog",
66
152
  "aria-label": title,
@@ -70,7 +156,7 @@ const ModalContent = ({ id, children, description, onClose, width, closeLabel =
70
156
  onKeyDown: handleEscape,
71
157
  position: "relative",
72
158
  width: "full",
73
- height: "full",
159
+ height: isDrawer ? "full" : void 0,
74
160
  display: "flex",
75
161
  alignItems: "center",
76
162
  textAlign: "left",
@@ -81,8 +167,8 @@ const ModalContent = ({ id, children, description, onClose, width, closeLabel =
81
167
  display: "flex",
82
168
  alignItems: "center",
83
169
  justifyContent,
84
- height: position === "right" || position === "left" ? "full" : void 0,
85
- overflow: position !== "center" ? "hidden" : void 0,
170
+ height: isDrawer ? "full" : void 0,
171
+ overflow: "hidden",
86
172
  boxShadow: "large",
87
173
  borderRadius: modalRadius,
88
174
  width: width !== "content" ? "full" : void 0,
@@ -91,7 +177,7 @@ const ModalContent = ({ id, children, description, onClose, width, closeLabel =
91
177
  noRelative: true,
92
178
  forwardProps: true,
93
179
  enabled: scrollLock,
94
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_Box.Box, {
180
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Box.Box, {
95
181
  display: "flex",
96
182
  gap: "large",
97
183
  flexDirection: "column",
@@ -100,47 +186,25 @@ const ModalContent = ({ id, children, description, onClose, width, closeLabel =
100
186
  overflow: "auto",
101
187
  position: "relative",
102
188
  width: width !== "content" ? "full" : void 0,
103
- height: position === "right" || position === "left" ? "full" : void 0,
104
- paddingY: modalPadding,
105
- paddingX: position !== "center" ? require_pageBlockGutters.pageBlockGutters : modalPadding,
106
- className: [require_Modal_css.pointerEventsAll, position === "center" && require_Modal_css.maxSize[position]],
189
+ height: isDrawer ? "full" : void 0,
190
+ className: {
191
+ [require_Modal_css.pointerEventsAll]: true,
192
+ [require_Modal_css.maxSize[position]]: !isDrawer,
193
+ [require_Modal_css.hideOverflowAboveMobile]: allowColumnLayout
194
+ },
107
195
  ...require_buildDataAttributes.default({
108
196
  data,
109
197
  validateRestProps: restProps
110
198
  }),
111
- children: [illustration ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_Stack.Stack, {
112
- space: "medium",
113
- align: "center",
114
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Box.Box, {
115
- paddingX: "gutter",
116
- children: illustration
117
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ModalContentHeader, {
118
- title,
119
- headingLevel,
120
- description,
121
- descriptionId,
122
- center: Boolean(illustration),
123
- ref: headingRef
124
- })]
125
- }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_Box.Box, {
126
- display: "flex",
127
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Box.Box, {
128
- width: "full",
129
- minWidth: 0,
130
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ModalContentHeader, {
131
- title,
132
- headingLevel,
133
- description,
134
- descriptionId,
135
- center: Boolean(illustration),
136
- ref: headingRef
137
- })
138
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Box.Box, {
139
- width: "touchable",
140
- flexShrink: 0,
141
- flexGrow: 0
142
- })]
143
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.Fragment, { children })]
199
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ScrollContainer.ScrollContainer, {
200
+ direction: "vertical",
201
+ startRef: contentStartRef,
202
+ children: coverImageEnabled && coverImage ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ModalCoverImageLayout, {
203
+ width,
204
+ image: coverImage,
205
+ children: modalLayout
206
+ }) : modalLayout
207
+ })
144
208
  })
145
209
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Box.Box, {
146
210
  position: "absolute",
@@ -151,10 +215,11 @@ const ModalContent = ({ id, children, description, onClose, width, closeLabel =
151
215
  display: "flex",
152
216
  justifyContent: "flexEnd",
153
217
  paddingTop: modalPadding,
154
- paddingRight: position !== "center" ? require_pageBlockGutters.pageBlockGutters : modalPadding,
155
- className: position === "center" && require_Modal_css.maxSize[position],
218
+ paddingRight: isDrawer ? require_pageBlockGutters.pageBlockGutters : modalPadding,
219
+ className: !isDrawer && require_Modal_css.maxSize[position],
156
220
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Bleed.Bleed, {
157
221
  space: "xsmall",
222
+ horizontal: "xxsmall",
158
223
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Box.Box, {
159
224
  position: "relative",
160
225
  background: "surface",
@@ -165,7 +230,6 @@ const ModalContent = ({ id, children, description, onClose, width, closeLabel =
165
230
  label: closeLabel,
166
231
  icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_IconClear.IconClear, { tone: "secondary" }),
167
232
  variant: "transparent",
168
- size: "large",
169
233
  onClick: onClose
170
234
  })
171
235
  })