braid-design-system 34.1.0 → 34.3.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 (100) hide show
  1. package/CHANGELOG.md +82 -0
  2. package/dist/css.cjs +3 -2
  3. package/dist/css.d.cts +4 -0
  4. package/dist/css.d.mts +4 -0
  5. package/dist/css.mjs +3 -2
  6. package/dist/lib/components/Autosuggest/Autosuggest.playroom.d.cts +2 -2
  7. package/dist/lib/components/Autosuggest/Autosuggest.playroom.d.mts +2 -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/Box/BoxRenderer.d.cts +2 -2
  13. package/dist/lib/components/Box/BoxRenderer.d.mts +2 -2
  14. package/dist/lib/components/BraidTestProvider/BraidTestProvider.d.cts +2 -2
  15. package/dist/lib/components/BraidTestProvider/BraidTestProvider.d.mts +2 -2
  16. package/dist/lib/components/Button/Button.d.mts +1 -0
  17. package/dist/lib/components/Dialog/Dialog.d.mts +1 -0
  18. package/dist/lib/components/Drawer/Drawer.d.cts +1 -1
  19. package/dist/lib/components/Drawer/Drawer.d.mts +2 -1
  20. package/dist/lib/components/Inline/Inline.cjs +4 -4
  21. package/dist/lib/components/Inline/Inline.css.cjs +4 -1
  22. package/dist/lib/components/Inline/Inline.css.mjs +3 -1
  23. package/dist/lib/components/Inline/Inline.d.cts +1 -0
  24. package/dist/lib/components/Inline/Inline.d.mts +1 -0
  25. package/dist/lib/components/Inline/Inline.mjs +5 -5
  26. package/dist/lib/components/MenuItem/useMenuItem.d.mts +1 -0
  27. package/dist/lib/components/MenuRenderer/MenuRenderer.cjs +1 -1
  28. package/dist/lib/components/MenuRenderer/MenuRenderer.d.mts +1 -0
  29. package/dist/lib/components/MenuRenderer/MenuRenderer.mjs +1 -1
  30. package/dist/lib/components/MonthPicker/MonthPicker.d.cts +2 -2
  31. package/dist/lib/components/MonthPicker/MonthPicker.d.mts +2 -2
  32. package/dist/lib/components/RadioGroup/RadioGroup.d.cts +2 -2
  33. package/dist/lib/components/RadioGroup/RadioGroup.d.mts +2 -2
  34. package/dist/lib/components/Stepper/StepperContext.d.mts +1 -0
  35. package/dist/lib/components/Tag/Tag.playroom.d.cts +2 -2
  36. package/dist/lib/components/Tag/Tag.playroom.d.mts +2 -2
  37. package/dist/lib/components/TextDropdown/TextDropdown.d.cts +2 -2
  38. package/dist/lib/components/TextDropdown/TextDropdown.d.mts +2 -2
  39. package/dist/lib/components/TextLink/TextLink.d.mts +1 -0
  40. package/dist/lib/components/Textarea/Textarea.cjs +1 -0
  41. package/dist/lib/components/Textarea/Textarea.css.cjs +5 -1
  42. package/dist/lib/components/Textarea/Textarea.css.mjs +5 -2
  43. package/dist/lib/components/Textarea/Textarea.mjs +2 -1
  44. package/dist/lib/components/TooltipRenderer/TooltipRenderer.d.mts +1 -0
  45. package/dist/lib/components/icons/IconContainer.d.mts +1 -0
  46. package/dist/lib/components/private/Field/Field.d.mts +1 -0
  47. package/dist/lib/components/private/FieldGroup/FieldGroup.d.mts +1 -0
  48. package/dist/lib/components/private/Modal/Modal.css.cjs +20 -3
  49. package/dist/lib/components/private/Modal/Modal.css.mjs +18 -5
  50. package/dist/lib/components/private/Modal/ModalContent.cjs +131 -67
  51. package/dist/lib/components/private/Modal/ModalContent.d.cts +9 -3
  52. package/dist/lib/components/private/Modal/ModalContent.d.mts +10 -3
  53. package/dist/lib/components/private/Modal/ModalContent.mjs +134 -70
  54. package/dist/lib/components/private/ScrollContainer/ScrollContainer.cjs +25 -6
  55. package/dist/lib/components/private/ScrollContainer/ScrollContainer.css.cjs +14 -6
  56. package/dist/lib/components/private/ScrollContainer/ScrollContainer.css.mjs +15 -7
  57. package/dist/lib/components/private/ScrollContainer/ScrollContainer.mjs +25 -6
  58. package/dist/lib/components/private/Typography/Typography.d.mts +1 -0
  59. package/dist/lib/components/private/scrollbars.css.cjs +27 -0
  60. package/dist/lib/components/private/scrollbars.css.mjs +26 -0
  61. package/dist/lib/playroom/FrameComponent.d.cts +2 -2
  62. package/dist/lib/playroom/FrameComponent.d.mts +2 -2
  63. package/dist/lib/playroom/components/Placeholder/Placeholder.d.cts +2 -2
  64. package/dist/lib/playroom/components/Placeholder/Placeholder.d.mts +2 -2
  65. package/dist/lib/playroom/components/PlaceholderHeader/PlaceholderHeader.d.cts +4 -4
  66. package/dist/lib/playroom/components/PlaceholderHeader/PlaceholderHeader.d.mts +4 -4
  67. package/dist/lib/playroom/playroomState.d.mts +1 -0
  68. package/dist/lib/playroom/snippets/BrandedContainer.cjs +16 -0
  69. package/dist/lib/playroom/snippets/BrandedContainer.mjs +15 -0
  70. package/dist/lib/playroom/snippets/CardList.cjs +10 -0
  71. package/dist/lib/playroom/snippets/CardList.mjs +9 -0
  72. package/dist/lib/playroom/snippets/CompactPage.cjs +10 -0
  73. package/dist/lib/playroom/snippets/CompactPage.mjs +9 -0
  74. package/dist/lib/playroom/snippets/DividedList.cjs +10 -0
  75. package/dist/lib/playroom/snippets/DividedList.mjs +9 -0
  76. package/dist/lib/playroom/snippets/Form.cjs +14 -0
  77. package/dist/lib/playroom/snippets/Form.mjs +13 -0
  78. package/dist/lib/playroom/snippets/Inline.cjs +4 -0
  79. package/dist/lib/playroom/snippets/Inline.mjs +4 -0
  80. package/dist/lib/playroom/snippets/SpaciousPage.cjs +10 -0
  81. package/dist/lib/playroom/snippets/SpaciousPage.mjs +9 -0
  82. package/dist/lib/playroom/snippets/StandardPage.cjs +10 -0
  83. package/dist/lib/playroom/snippets/StandardPage.mjs +9 -0
  84. package/dist/lib/playroom/snippets/StandardSection.cjs +10 -0
  85. package/dist/lib/playroom/snippets/StandardSection.mjs +9 -0
  86. package/dist/lib/playroom/snippets/SteppedSection.cjs +10 -0
  87. package/dist/lib/playroom/snippets/SteppedSection.mjs +9 -0
  88. package/dist/lib/playroom/snippets/TabbedSection.cjs +10 -0
  89. package/dist/lib/playroom/snippets/TabbedSection.mjs +9 -0
  90. package/dist/lib/playroom/snippets/TableSection.cjs +10 -0
  91. package/dist/lib/playroom/snippets/TableSection.mjs +9 -0
  92. package/dist/lib/playroom/snippets.cjs +22 -4
  93. package/dist/lib/playroom/snippets.mjs +108 -90
  94. package/dist/lib/themes/baseTokens/nvl.cjs +9 -9
  95. package/dist/lib/themes/baseTokens/nvl.mjs +9 -9
  96. package/package.json +3 -4
  97. package/dist/lib/playroom/snippets/layouts.cjs +0 -22
  98. package/dist/lib/playroom/snippets/layouts.mjs +0 -21
  99. package/dist/lib/playroom/snippets/sections.cjs +0 -59
  100. package/dist/lib/playroom/snippets/sections.mjs +0 -58
@@ -1,5 +1,5 @@
1
1
  import { DataAttributeMap } from "../private/buildDataAttributes.cjs";
2
- import * as react_jsx_runtime0 from "react/jsx-runtime";
2
+ import * as react from "react";
3
3
 
4
4
  //#region src/lib/components/TextDropdown/TextDropdown.d.ts
5
5
  interface TextDropdownOption<Value> {
@@ -27,6 +27,6 @@ declare function TextDropdown<Value>({
27
27
  data,
28
28
  tabIndex,
29
29
  ...restProps
30
- }: TextDropdownProps<Value>): react_jsx_runtime0.JSX.Element;
30
+ }: TextDropdownProps<Value>): react.JSX.Element;
31
31
  //#endregion
32
32
  export { TextDropdown, TextDropdownProps };
@@ -1,5 +1,5 @@
1
1
  import { DataAttributeMap } from "../private/buildDataAttributes.mjs";
2
- import * as react_jsx_runtime0 from "react/jsx-runtime";
2
+ import * as react from "react";
3
3
 
4
4
  //#region src/lib/components/TextDropdown/TextDropdown.d.ts
5
5
  interface TextDropdownOption<Value> {
@@ -27,6 +27,6 @@ declare function TextDropdown<Value>({
27
27
  data,
28
28
  tabIndex,
29
29
  ...restProps
30
- }: TextDropdownProps<Value>): react_jsx_runtime0.JSX.Element;
30
+ }: TextDropdownProps<Value>): react.JSX.Element;
31
31
  //#endregion
32
32
  export { TextDropdown, TextDropdownProps };
@@ -3,6 +3,7 @@ import { DataAttributeMap } from "../private/buildDataAttributes.mjs";
3
3
  import { UseIconProps } from "../../hooks/useIcon/index.mjs";
4
4
  import * as react from "react";
5
5
  import { ReactElement } from "react";
6
+
6
7
  //#region src/lib/components/TextLink/TextLink.d.ts
7
8
  interface TextLinkStyles {
8
9
  weight?: 'regular' | 'weak';
@@ -52,6 +52,7 @@ const Textarea = (0, react.forwardRef)(({ value, onChange, onBlur, onFocus, onPa
52
52
  zIndex: 0,
53
53
  background,
54
54
  borderRadius,
55
+ className: require_Textarea_css.focusRing,
55
56
  children: [
56
57
  hasHighlights ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Box.Box, {
57
58
  ref: highlightsRef,
@@ -1,5 +1,6 @@
1
1
  const require_runtime = require('../../../_virtual/_rolldown/runtime.cjs');
2
2
  const require_vars_css = require('../../themes/vars.css.cjs');
3
+ const require_outlineStyle = require('../../css/outlineStyle.cjs');
3
4
  const require_fieldPaddingX = require('../private/Field/fieldPaddingX.cjs');
4
5
  let _vanilla_extract_css_fileScope = require("@vanilla-extract/css/fileScope");
5
6
  let _vanilla_extract_css = require("@vanilla-extract/css");
@@ -9,8 +10,10 @@ let _vanilla_extract_css = require("@vanilla-extract/css");
9
10
  const field = (0, _vanilla_extract_css.style)({
10
11
  resize: "vertical",
11
12
  background: "transparent",
12
- minHeight: require_vars_css.vars.touchableSize
13
+ minHeight: require_vars_css.vars.touchableSize,
14
+ outline: "none"
13
15
  }, "field");
16
+ const focusRing = (0, _vanilla_extract_css.style)(require_outlineStyle.outlineStyle("&:focus-within"), "focusRing");
14
17
  const highlights = (0, _vanilla_extract_css.style)({
15
18
  color: "transparent !important",
16
19
  wordBreak: "break-word",
@@ -33,5 +36,6 @@ const scrollbarBorderOffset = (0, _vanilla_extract_css.style)({ borderRight: `${
33
36
  //#endregion
34
37
  exports.clipScrollBar = clipScrollBar;
35
38
  exports.field = field;
39
+ exports.focusRing = focusRing;
36
40
  exports.highlights = highlights;
37
41
  exports.scrollbarBorderOffset = scrollbarBorderOffset;
@@ -1,4 +1,5 @@
1
1
  import { vars } from "../../themes/vars.css.mjs";
2
+ import { outlineStyle } from "../../css/outlineStyle.mjs";
2
3
  import { fieldPaddingX } from "../private/Field/fieldPaddingX.mjs";
3
4
  import { endFileScope, setFileScope } from "@vanilla-extract/css/fileScope";
4
5
  import { style } from "@vanilla-extract/css";
@@ -8,8 +9,10 @@ setFileScope("src/lib/components/Textarea/Textarea.css.ts", "braid-design-system
8
9
  const field = style({
9
10
  resize: "vertical",
10
11
  background: "transparent",
11
- minHeight: vars.touchableSize
12
+ minHeight: vars.touchableSize,
13
+ outline: "none"
12
14
  }, "field");
15
+ const focusRing = style(outlineStyle("&:focus-within"), "focusRing");
13
16
  const highlights = style({
14
17
  color: "transparent !important",
15
18
  wordBreak: "break-word",
@@ -30,4 +33,4 @@ const scrollbarBorderOffset = style({ borderRight: `${vars.borderWidth.standard}
30
33
  endFileScope();
31
34
 
32
35
  //#endregion
33
- export { clipScrollBar, field, highlights, scrollbarBorderOffset };
36
+ export { clipScrollBar, field, focusRing, highlights, scrollbarBorderOffset };
@@ -2,7 +2,7 @@ import { Box } from "../Box/Box.mjs";
2
2
  import { Field } from "../private/Field/Field.mjs";
3
3
  import { getCharacterLimitStatus } from "../private/Field/getCharacterLimitStatus.mjs";
4
4
  import { formatRanges } from "./formatRanges.mjs";
5
- import { clipScrollBar, field, highlights, scrollbarBorderOffset } from "./Textarea.css.mjs";
5
+ import { clipScrollBar, field, focusRing, highlights, scrollbarBorderOffset } from "./Textarea.css.mjs";
6
6
  import { forwardRef, useCallback, useRef, useState } from "react";
7
7
  import { jsx, jsxs } from "react/jsx-runtime";
8
8
 
@@ -51,6 +51,7 @@ const Textarea = forwardRef(({ value, onChange, onBlur, onFocus, onPaste, placeh
51
51
  zIndex: 0,
52
52
  background,
53
53
  borderRadius,
54
+ className: focusRing,
54
55
  children: [
55
56
  hasHighlights ? /* @__PURE__ */ jsx(Box, {
56
57
  ref: highlightsRef,
@@ -1,6 +1,7 @@
1
1
  import { ReactNodeNoStrings } from "../private/ReactNodeNoStrings.mjs";
2
2
  import { PopoverProps } from "../private/Popover/Popover.mjs";
3
3
  import { FC, ReactNode, RefCallback } from "react";
4
+
4
5
  //#region src/lib/components/TooltipRenderer/TooltipRenderer.d.ts
5
6
  interface TriggerProps {
6
7
  ref: RefCallback<HTMLElement>;
@@ -1,5 +1,6 @@
1
1
  import { UseIconProps } from "../../hooks/useIcon/index.mjs";
2
2
  import { ReactElement } from "react";
3
+
3
4
  //#region src/lib/components/icons/IconContainer.d.ts
4
5
  type IconContainerProps = UseIconProps;
5
6
  //#endregion
@@ -2,6 +2,7 @@ import { DataAttributeMap } from "../buildDataAttributes.mjs";
2
2
  import { FieldLabelProps } from "../../FieldLabel/FieldLabel.mjs";
3
3
  import { FieldMessageProps } from "../../FieldMessage/FieldMessage.mjs";
4
4
  import { AllHTMLAttributes, ReactNode } from "react";
5
+
5
6
  //#region src/lib/components/private/Field/Field.d.ts
6
7
  type FormElementProps = AllHTMLAttributes<HTMLFormElement>;
7
8
  type FieldLabelVariant = {
@@ -2,6 +2,7 @@ import { DataAttributeMap } from "../buildDataAttributes.mjs";
2
2
  import { FieldLabelProps } from "../../FieldLabel/FieldLabel.mjs";
3
3
  import { FieldMessageProps } from "../../FieldMessage/FieldMessage.mjs";
4
4
  import { AllHTMLAttributes } from "react";
5
+
5
6
  //#region src/lib/components/private/FieldGroup/FieldGroup.d.ts
6
7
  type FormElementProps = AllHTMLAttributes<HTMLFormElement>;
7
8
  type FieldLabelVariant = {
@@ -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
  })
@@ -4,7 +4,7 @@ import { BoxProps } from "../../Box/Box.cjs";
4
4
  import { ReactNode, Ref } from "react";
5
5
 
6
6
  //#region src/lib/components/private/Modal/ModalContent.d.ts
7
- interface ModalContentProps {
7
+ type ModalContentCommonProps = {
8
8
  id?: string;
9
9
  title: string;
10
10
  children: ReactNode;
@@ -12,13 +12,19 @@ interface ModalContentProps {
12
12
  closeLabel?: string;
13
13
  width: BoxProps['maxWidth'] | 'content';
14
14
  description?: ReactNodeNoStrings;
15
- illustration?: ReactNodeNoStrings;
16
15
  position: 'center' | 'right' | 'left';
17
16
  headingLevel: '2' | '3';
18
17
  scrollLock?: boolean;
19
18
  headingRef?: Ref<HTMLElement>;
20
19
  modalRef?: Ref<HTMLElement>;
21
20
  data?: DataAttributeMap;
22
- }
21
+ };
22
+ type ModalContentProps = ModalContentCommonProps & ({
23
+ coverImage?: never;
24
+ illustration?: ReactNodeNoStrings;
25
+ } | {
26
+ coverImage?: string;
27
+ illustration?: never;
28
+ });
23
29
  //#endregion
24
30
  export { ModalContentProps };
@@ -2,8 +2,9 @@ import { ReactNodeNoStrings } from "../ReactNodeNoStrings.mjs";
2
2
  import { DataAttributeMap } from "../buildDataAttributes.mjs";
3
3
  import { BoxProps } from "../../Box/Box.mjs";
4
4
  import { ReactNode, Ref } from "react";
5
+
5
6
  //#region src/lib/components/private/Modal/ModalContent.d.ts
6
- interface ModalContentProps {
7
+ type ModalContentCommonProps = {
7
8
  id?: string;
8
9
  title: string;
9
10
  children: ReactNode;
@@ -11,13 +12,19 @@ interface ModalContentProps {
11
12
  closeLabel?: string;
12
13
  width: BoxProps['maxWidth'] | 'content';
13
14
  description?: ReactNodeNoStrings;
14
- illustration?: ReactNodeNoStrings;
15
15
  position: 'center' | 'right' | 'left';
16
16
  headingLevel: '2' | '3';
17
17
  scrollLock?: boolean;
18
18
  headingRef?: Ref<HTMLElement>;
19
19
  modalRef?: Ref<HTMLElement>;
20
20
  data?: DataAttributeMap;
21
- }
21
+ };
22
+ type ModalContentProps = ModalContentCommonProps & ({
23
+ coverImage?: never;
24
+ illustration?: ReactNodeNoStrings;
25
+ } | {
26
+ coverImage?: string;
27
+ illustration?: never;
28
+ });
22
29
  //#endregion
23
30
  export { ModalContentProps };