@primer/react 0.0.0-20260226155303 → 0.0.0-20260226155413

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 (102) hide show
  1. package/CHANGELOG.md +34 -6
  2. package/dist/ActionBar/ActionBar.d.ts.map +1 -1
  3. package/dist/ActionBar/ActionBar.js +431 -281
  4. package/dist/ActionList/ActionList-c04a02d6.css +2 -0
  5. package/dist/ActionList/ActionList-c04a02d6.css.map +1 -0
  6. package/dist/ActionList/ActionList.module.css.js +1 -1
  7. package/dist/ActionList/Item.d.ts.map +1 -1
  8. package/dist/ActionList/Item.js +1 -0
  9. package/dist/Autocomplete/Autocomplete.js +76 -159
  10. package/dist/Autocomplete/AutocompleteMenu.js +128 -333
  11. package/dist/Autocomplete/AutocompleteOverlay.js +49 -130
  12. package/dist/Banner/Banner.js +64 -238
  13. package/dist/Blankslate/{Blankslate-f5a9755a.css → Blankslate-a039d79a.css} +2 -2
  14. package/dist/Blankslate/Blankslate-a039d79a.css.map +1 -0
  15. package/dist/Blankslate/Blankslate.module.css.js +1 -1
  16. package/dist/Button/Button.js +11 -34
  17. package/dist/Button/IconButton.js +51 -140
  18. package/dist/Button/LinkButton.js +11 -39
  19. package/dist/Checkbox/Checkbox.js +55 -163
  20. package/dist/Dialog/Dialog-ad7231e4.css +2 -0
  21. package/dist/Dialog/Dialog-ad7231e4.css.map +1 -0
  22. package/dist/Dialog/Dialog.d.ts +7 -0
  23. package/dist/Dialog/Dialog.d.ts.map +1 -1
  24. package/dist/Dialog/Dialog.js +112 -347
  25. package/dist/Dialog/Dialog.module.css.js +1 -1
  26. package/dist/FilteredActionList/FilteredActionList.d.ts +16 -1
  27. package/dist/FilteredActionList/FilteredActionList.d.ts.map +1 -1
  28. package/dist/FilteredActionList/FilteredActionList.js +147 -42
  29. package/dist/Overlay/Overlay-15519c09.css +2 -0
  30. package/dist/Overlay/Overlay-15519c09.css.map +1 -0
  31. package/dist/Overlay/Overlay.module.css.js +1 -1
  32. package/dist/PageLayout/PageLayout-3444a142.css +2 -0
  33. package/dist/PageLayout/PageLayout-3444a142.css.map +1 -0
  34. package/dist/PageLayout/PageLayout.d.ts +72 -2
  35. package/dist/PageLayout/PageLayout.d.ts.map +1 -1
  36. package/dist/PageLayout/PageLayout.js +750 -1235
  37. package/dist/PageLayout/PageLayout.module.css.js +2 -2
  38. package/dist/PageLayout/usePaneWidth.d.ts +18 -6
  39. package/dist/PageLayout/usePaneWidth.d.ts.map +1 -1
  40. package/dist/PageLayout/usePaneWidth.js +126 -112
  41. package/dist/SelectPanel/SelectPanel.d.ts +1 -1
  42. package/dist/SelectPanel/SelectPanel.d.ts.map +1 -1
  43. package/dist/SelectPanel/SelectPanel.js +85 -33
  44. package/dist/SplitPageLayout/SplitPageLayout.d.ts +4 -1
  45. package/dist/SplitPageLayout/SplitPageLayout.d.ts.map +1 -1
  46. package/dist/SplitPageLayout/SplitPageLayout.js +54 -2
  47. package/dist/Text/Text.d.ts +1 -1
  48. package/dist/Text/Text.d.ts.map +1 -1
  49. package/dist/Text/Text.js +10 -13
  50. package/dist/UnderlineNav/UnderlineNav-4344d9b0.css +2 -0
  51. package/dist/UnderlineNav/UnderlineNav-4344d9b0.css.map +1 -0
  52. package/dist/UnderlineNav/UnderlineNav.d.ts.map +1 -1
  53. package/dist/UnderlineNav/UnderlineNav.js +325 -77
  54. package/dist/UnderlineNav/UnderlineNav.module.css.js +2 -2
  55. package/dist/UnderlineNav/UnderlineNavContext.d.ts +11 -1
  56. package/dist/UnderlineNav/UnderlineNavContext.d.ts.map +1 -1
  57. package/dist/UnderlineNav/UnderlineNavContext.js +4 -1
  58. package/dist/UnderlineNav/UnderlineNavItem-b65e8fd3.css +2 -0
  59. package/dist/UnderlineNav/UnderlineNavItem-b65e8fd3.css.map +1 -0
  60. package/dist/UnderlineNav/UnderlineNavItem.d.ts +0 -6
  61. package/dist/UnderlineNav/UnderlineNavItem.d.ts.map +1 -1
  62. package/dist/UnderlineNav/UnderlineNavItem.js +61 -149
  63. package/dist/UnderlineNav/UnderlineNavItem.module.css.js +1 -1
  64. package/dist/UnderlineNav/styles.d.ts +16 -0
  65. package/dist/UnderlineNav/styles.d.ts.map +1 -0
  66. package/dist/UnderlineNav/styles.js +19 -0
  67. package/dist/experimental/SelectPanel2/SelectPanel.js +209 -593
  68. package/dist/experimental/UnderlinePanels/UnderlinePanels.js +1 -1
  69. package/dist/hooks/useRefObjectAsForwardedRef.d.ts.map +1 -1
  70. package/dist/hooks/useRefObjectAsForwardedRef.js +10 -2
  71. package/dist/hooks/useScrollFlash.d.ts.map +1 -1
  72. package/dist/hooks/useScrollFlash.js +14 -22
  73. package/dist/hooks/useSlots.d.ts +50 -6
  74. package/dist/hooks/useSlots.d.ts.map +1 -1
  75. package/dist/hooks/useSlots.js +114 -36
  76. package/dist/internal/components/UnderlineTabbedInterface-4197ee28.css +2 -0
  77. package/dist/internal/components/UnderlineTabbedInterface-4197ee28.css.map +1 -0
  78. package/dist/internal/components/UnderlineTabbedInterface.d.ts +1 -0
  79. package/dist/internal/components/UnderlineTabbedInterface.d.ts.map +1 -1
  80. package/dist/internal/components/UnderlineTabbedInterface.js +60 -66
  81. package/dist/internal/components/UnderlineTabbedInterface.module.css.js +1 -1
  82. package/dist/utils/environment.js +9 -0
  83. package/generated/components.json +213 -6
  84. package/package.json +3 -3
  85. package/dist/ActionList/ActionList-f4ac3b54.css +0 -2
  86. package/dist/ActionList/ActionList-f4ac3b54.css.map +0 -1
  87. package/dist/Blankslate/Blankslate-f5a9755a.css.map +0 -1
  88. package/dist/Dialog/Dialog-9e7a4691.css +0 -2
  89. package/dist/Dialog/Dialog-9e7a4691.css.map +0 -1
  90. package/dist/Overlay/Overlay-43cda449.css +0 -2
  91. package/dist/Overlay/Overlay-43cda449.css.map +0 -1
  92. package/dist/PageLayout/PageLayout-cb491b47.css +0 -2
  93. package/dist/PageLayout/PageLayout-cb491b47.css.map +0 -1
  94. package/dist/UnderlineNav/UnderlineNav-f506fb23.css +0 -2
  95. package/dist/UnderlineNav/UnderlineNav-f506fb23.css.map +0 -1
  96. package/dist/UnderlineNav/UnderlineNavItem-db9dc5d0.css +0 -2
  97. package/dist/UnderlineNav/UnderlineNavItem-db9dc5d0.css.map +0 -1
  98. package/dist/internal/components/UnderlineTabbedInterface-be1a162c.css +0 -2
  99. package/dist/internal/components/UnderlineTabbedInterface-be1a162c.css.map +0 -1
  100. package/dist/utils/descendant-registry.d.ts +0 -32
  101. package/dist/utils/descendant-registry.d.ts.map +0 -1
  102. package/dist/utils/descendant-registry.js +0 -222
@@ -1,4 +1,3 @@
1
- import { c } from 'react-compiler-runtime';
2
1
  import React, { forwardRef } from 'react';
3
2
  import { ButtonBase } from './ButtonBase.js';
4
3
  import { TooltipContext, Tooltip } from '../TooltipV2/Tooltip.js';
@@ -7,158 +6,70 @@ import classes from './ButtonBase.module.css.js';
7
6
  import { clsx } from 'clsx';
8
7
  import { jsx } from 'react/jsx-runtime';
9
8
 
10
- const IconButton = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
11
- const $ = c(36);
12
- let Icon;
13
- let ariaLabel;
14
- let className;
15
- let description;
16
- let disabled;
17
- let keybindingHint;
18
- let keyshortcuts;
19
- let props;
20
- let t1;
21
- let tooltipDirection;
22
- if ($[0] !== t0) {
23
- ({
24
- icon: Icon,
25
- "aria-label": ariaLabel,
26
- description,
27
- disabled,
28
- tooltipDirection,
29
- unsafeDisableTooltip: t1,
30
- keyshortcuts,
31
- keybindingHint,
32
- className,
33
- ...props
34
- } = t0);
35
- $[0] = t0;
36
- $[1] = Icon;
37
- $[2] = ariaLabel;
38
- $[3] = className;
39
- $[4] = description;
40
- $[5] = disabled;
41
- $[6] = keybindingHint;
42
- $[7] = keyshortcuts;
43
- $[8] = props;
44
- $[9] = t1;
45
- $[10] = tooltipDirection;
46
- } else {
47
- Icon = $[1];
48
- ariaLabel = $[2];
49
- className = $[3];
50
- description = $[4];
51
- disabled = $[5];
52
- keybindingHint = $[6];
53
- keyshortcuts = $[7];
54
- props = $[8];
55
- t1 = $[9];
56
- tooltipDirection = $[10];
57
- }
58
- const unsafeDisableTooltip = t1 === undefined ? false : t1;
9
+ const IconButton = /*#__PURE__*/forwardRef(({
10
+ icon: Icon,
11
+ 'aria-label': ariaLabel,
12
+ description,
13
+ disabled,
14
+ tooltipDirection,
15
+ // This is planned to be a temporary prop until the default tooltip on icon buttons are fully rolled out.
16
+ unsafeDisableTooltip = false,
17
+ keyshortcuts,
18
+ keybindingHint,
19
+ className,
20
+ ...props
21
+ }, forwardedRef) => {
22
+ // If the icon button is already wrapped in a tooltip, do not add one.
59
23
  const {
60
24
  tooltipId
61
- } = React.useContext(TooltipContext);
25
+ } = React.useContext(TooltipContext); // Tooltip v2
62
26
  const {
63
27
  tooltipId: tooltipIdV1
64
- } = React.useContext(TooltipContext$1);
28
+ } = React.useContext(TooltipContext$1); // Tooltip v1
29
+
65
30
  const {
66
- "aria-expanded": isExpanded,
67
- "aria-haspopup": hasPopup
31
+ 'aria-expanded': isExpanded,
32
+ 'aria-haspopup': hasPopup
68
33
  } = props;
69
34
  const hasExternalTooltip = tooltipId || tooltipIdV1;
70
- const hasActivePopup = (isExpanded === true || isExpanded === "true") && hasPopup === "true";
71
- const withoutTooltip = unsafeDisableTooltip || disabled || ariaLabel === undefined || ariaLabel === "" || hasExternalTooltip;
35
+
36
+ // If the button has an active "popup" (like a menu), we don't want to show the tooltip.
37
+ // This is mostly for `ActionMenu`, but could be applicable elsewhere.
38
+ const hasActivePopup = (isExpanded === true || isExpanded === 'true') && hasPopup === 'true';
39
+ const withoutTooltip = unsafeDisableTooltip || disabled || ariaLabel === undefined || ariaLabel === '' || hasExternalTooltip;
72
40
  if (withoutTooltip) {
73
- let t2;
74
- if ($[11] !== className) {
75
- t2 = clsx(className, classes.IconButton);
76
- $[11] = className;
77
- $[12] = t2;
78
- } else {
79
- t2 = $[12];
80
- }
81
- let t3;
82
- if ($[13] !== Icon || $[14] !== ariaLabel || $[15] !== disabled || $[16] !== forwardedRef || $[17] !== props || $[18] !== t2) {
83
- t3 = /*#__PURE__*/jsx(ButtonBase, {
84
- icon: Icon,
85
- className: t2,
86
- "data-component": "IconButton",
87
- type: "button",
88
- "aria-label": ariaLabel,
89
- disabled: disabled,
90
- ...props,
91
- ref: forwardedRef
92
- });
93
- $[13] = Icon;
94
- $[14] = ariaLabel;
95
- $[15] = disabled;
96
- $[16] = forwardedRef;
97
- $[17] = props;
98
- $[18] = t2;
99
- $[19] = t3;
100
- } else {
101
- t3 = $[19];
102
- }
103
- return t3;
41
+ return /*#__PURE__*/jsx(ButtonBase, {
42
+ icon: Icon,
43
+ className: clsx(className, classes.IconButton),
44
+ "data-component": "IconButton",
45
+ type: "button",
46
+ "aria-label": ariaLabel,
47
+ disabled: disabled,
48
+ ...props,
49
+ // @ts-expect-error StyledButton wants both Anchor and Button refs
50
+ ref: forwardedRef
51
+ });
104
52
  } else {
105
- var _description, _keybindingHint, _keyshortcuts;
106
- const tooltipText = (_description = description) !== null && _description !== void 0 ? _description : ariaLabel;
107
- const t2 = description ? undefined : "label";
108
- const t3 = (_keybindingHint = keybindingHint) !== null && _keybindingHint !== void 0 ? _keybindingHint : keyshortcuts;
109
- let t4;
110
- if ($[20] !== className) {
111
- t4 = clsx(className, classes.IconButton);
112
- $[20] = className;
113
- $[21] = t4;
114
- } else {
115
- t4 = $[21];
116
- }
117
- const t5 = (_keyshortcuts = keyshortcuts) !== null && _keyshortcuts !== void 0 ? _keyshortcuts : undefined;
118
- const t6 = description ? ariaLabel : undefined;
119
- let t7;
120
- if ($[22] !== Icon || $[23] !== props || $[24] !== t4 || $[25] !== t5 || $[26] !== t6) {
121
- t7 = /*#__PURE__*/jsx(ButtonBase, {
53
+ const tooltipText = description !== null && description !== void 0 ? description : ariaLabel;
54
+ return /*#__PURE__*/jsx(Tooltip, {
55
+ ref: forwardedRef,
56
+ text: tooltipText,
57
+ type: description ? undefined : 'label',
58
+ direction: tooltipDirection,
59
+ keybindingHint: keybindingHint !== null && keybindingHint !== void 0 ? keybindingHint : keyshortcuts,
60
+ _privateDisableTooltip: hasActivePopup,
61
+ children: /*#__PURE__*/jsx(ButtonBase, {
122
62
  icon: Icon,
123
- className: t4,
63
+ className: clsx(className, classes.IconButton),
124
64
  "data-component": "IconButton",
125
65
  type: "button",
126
- "aria-keyshortcuts": t5,
127
- "aria-label": t6,
66
+ "aria-keyshortcuts": keyshortcuts !== null && keyshortcuts !== void 0 ? keyshortcuts : undefined
67
+ // If description is provided, we will use the tooltip to describe the button, so we need to keep the aria-label to label the button.
68
+ ,
69
+ "aria-label": description ? ariaLabel : undefined,
128
70
  ...props
129
- });
130
- $[22] = Icon;
131
- $[23] = props;
132
- $[24] = t4;
133
- $[25] = t5;
134
- $[26] = t6;
135
- $[27] = t7;
136
- } else {
137
- t7 = $[27];
138
- }
139
- let t8;
140
- if ($[28] !== forwardedRef || $[29] !== hasActivePopup || $[30] !== t2 || $[31] !== t3 || $[32] !== t7 || $[33] !== tooltipDirection || $[34] !== tooltipText) {
141
- t8 = /*#__PURE__*/jsx(Tooltip, {
142
- ref: forwardedRef,
143
- text: tooltipText,
144
- type: t2,
145
- direction: tooltipDirection,
146
- keybindingHint: t3,
147
- _privateDisableTooltip: hasActivePopup,
148
- children: t7
149
- });
150
- $[28] = forwardedRef;
151
- $[29] = hasActivePopup;
152
- $[30] = t2;
153
- $[31] = t3;
154
- $[32] = t7;
155
- $[33] = tooltipDirection;
156
- $[34] = tooltipText;
157
- $[35] = t8;
158
- } else {
159
- t8 = $[35];
160
- }
161
- return t8;
71
+ })
72
+ });
162
73
  }
163
74
  });
164
75
 
@@ -1,46 +1,18 @@
1
- import { c } from 'react-compiler-runtime';
2
1
  import { forwardRef } from 'react';
3
2
  import { ButtonBase } from './ButtonBase.js';
4
3
  import { jsx } from 'react/jsx-runtime';
5
4
 
6
- const LinkButton = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
7
- const $ = c(9);
8
- let children;
9
- let props;
10
- let t1;
11
- if ($[0] !== t0) {
12
- ({
13
- children,
14
- as: t1,
15
- ...props
16
- } = t0);
17
- $[0] = t0;
18
- $[1] = children;
19
- $[2] = props;
20
- $[3] = t1;
21
- } else {
22
- children = $[1];
23
- props = $[2];
24
- t1 = $[3];
25
- }
26
- const Component = t1 === undefined ? "a" : t1;
27
- let t2;
28
- if ($[4] !== Component || $[5] !== children || $[6] !== forwardedRef || $[7] !== props) {
29
- t2 = /*#__PURE__*/jsx(ButtonBase, {
30
- as: Component,
31
- ref: forwardedRef,
32
- ...props,
33
- children: children
34
- });
35
- $[4] = Component;
36
- $[5] = children;
37
- $[6] = forwardedRef;
38
- $[7] = props;
39
- $[8] = t2;
40
- } else {
41
- t2 = $[8];
42
- }
43
- return t2;
5
+ const LinkButton = /*#__PURE__*/forwardRef(({
6
+ children,
7
+ as: Component = 'a',
8
+ ...props
9
+ }, forwardedRef) => {
10
+ return /*#__PURE__*/jsx(ButtonBase, {
11
+ as: Component,
12
+ ref: forwardedRef,
13
+ ...props,
14
+ children: children
15
+ });
44
16
  });
45
17
 
46
18
  export { LinkButton };
@@ -1,4 +1,3 @@
1
- import { c } from 'react-compiler-runtime';
2
1
  import { clsx } from 'clsx';
3
2
  import React, { useContext, useEffect } from 'react';
4
3
  import useIsomorphicLayoutEffect from '../utils/useIsomorphicLayoutEffect.js';
@@ -11,170 +10,63 @@ import { useProvidedRefOrCreate } from '../hooks/useProvidedRefOrCreate.js';
11
10
  /**
12
11
  * An accessible, native checkbox component
13
12
  */
14
- const Checkbox = /*#__PURE__*/React.forwardRef((t0, ref) => {
15
- const $ = c(40);
16
- let checked;
17
- let className;
18
- let defaultChecked;
19
- let disabled;
20
- let indeterminate;
21
- let onChange;
22
- let required;
23
- let rest;
24
- let validationStatus;
25
- let value;
26
- if ($[0] !== t0) {
27
- ({
28
- checked,
29
- className,
30
- defaultChecked,
31
- indeterminate,
32
- disabled,
33
- onChange,
34
- required,
35
- validationStatus,
36
- value,
37
- ...rest
38
- } = t0);
39
- $[0] = t0;
40
- $[1] = checked;
41
- $[2] = className;
42
- $[3] = defaultChecked;
43
- $[4] = disabled;
44
- $[5] = indeterminate;
45
- $[6] = onChange;
46
- $[7] = required;
47
- $[8] = rest;
48
- $[9] = validationStatus;
49
- $[10] = value;
50
- } else {
51
- checked = $[1];
52
- className = $[2];
53
- defaultChecked = $[3];
54
- disabled = $[4];
55
- indeterminate = $[5];
56
- onChange = $[6];
57
- required = $[7];
58
- rest = $[8];
59
- validationStatus = $[9];
60
- value = $[10];
61
- }
13
+ const Checkbox = /*#__PURE__*/React.forwardRef(({
14
+ checked,
15
+ className,
16
+ defaultChecked,
17
+ indeterminate,
18
+ disabled,
19
+ onChange,
20
+ required,
21
+ validationStatus,
22
+ value,
23
+ ...rest
24
+ }, ref
25
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
26
+ ) => {
62
27
  const checkboxRef = useProvidedRefOrCreate(ref);
63
28
  const checkboxGroupContext = useContext(CheckboxGroupContext);
64
- let t1;
65
- if ($[11] !== checkboxGroupContext || $[12] !== onChange) {
66
- t1 = e => {
67
- checkboxGroupContext.onChange && checkboxGroupContext.onChange(e);
68
- onChange && onChange(e);
69
- };
70
- $[11] = checkboxGroupContext;
71
- $[12] = onChange;
72
- $[13] = t1;
73
- } else {
74
- t1 = $[13];
75
- }
76
- const handleOnChange = t1;
77
- const t2 = indeterminate ? false : checked;
78
- const t3 = required ? "true" : "false";
79
- const t4 = validationStatus === "error" ? "true" : "false";
80
- let t5;
81
- if ($[14] !== checkboxRef || $[15] !== defaultChecked || $[16] !== disabled || $[17] !== handleOnChange || $[18] !== required || $[19] !== rest || $[20] !== t2 || $[21] !== t3 || $[22] !== t4 || $[23] !== value) {
82
- t5 = {
83
- type: "checkbox",
84
- disabled,
85
- ref: checkboxRef,
86
- checked: t2,
87
- defaultChecked,
88
- required,
89
- "aria-required": t3,
90
- "aria-invalid": t4,
91
- onChange: handleOnChange,
92
- value,
93
- name: value,
94
- ...rest
95
- };
96
- $[14] = checkboxRef;
97
- $[15] = defaultChecked;
98
- $[16] = disabled;
99
- $[17] = handleOnChange;
100
- $[18] = required;
101
- $[19] = rest;
102
- $[20] = t2;
103
- $[21] = t3;
104
- $[22] = t4;
105
- $[23] = value;
106
- $[24] = t5;
107
- } else {
108
- t5 = $[24];
109
- }
110
- const inputProps = t5;
111
- let t6;
112
- if ($[25] !== checkboxRef || $[26] !== indeterminate) {
113
- t6 = () => {
114
- if (checkboxRef.current) {
115
- checkboxRef.current.indeterminate = indeterminate || false;
116
- }
117
- };
118
- $[25] = checkboxRef;
119
- $[26] = indeterminate;
120
- $[27] = t6;
121
- } else {
122
- t6 = $[27];
123
- }
124
- let t7;
125
- if ($[28] !== checkboxRef || $[29] !== checked || $[30] !== indeterminate) {
126
- t7 = [indeterminate, checked, checkboxRef];
127
- $[28] = checkboxRef;
128
- $[29] = checked;
129
- $[30] = indeterminate;
130
- $[31] = t7;
131
- } else {
132
- t7 = $[31];
133
- }
134
- useIsomorphicLayoutEffect(t6, t7);
135
- let t8;
136
- if ($[32] !== checkboxRef || $[33] !== indeterminate) {
137
- t8 = () => {
138
- const {
139
- current: checkbox
140
- } = checkboxRef;
141
- if (!checkbox) {
142
- return;
143
- }
144
- if (indeterminate) {
145
- checkbox.setAttribute("aria-checked", "mixed");
146
- } else {
147
- checkbox.setAttribute("aria-checked", checkbox.checked ? "true" : "false");
148
- }
149
- };
150
- $[32] = checkboxRef;
151
- $[33] = indeterminate;
152
- $[34] = t8;
153
- } else {
154
- t8 = $[34];
155
- }
156
- useEffect(t8);
157
- let t9;
158
- if ($[35] !== className) {
159
- t9 = clsx(className, sharedClasses.Input, classes.Checkbox);
160
- $[35] = className;
161
- $[36] = t9;
162
- } else {
163
- t9 = $[36];
164
- }
165
- let t10;
166
- if ($[37] !== inputProps || $[38] !== t9) {
167
- t10 = /*#__PURE__*/jsx("input", {
168
- ...inputProps,
169
- className: t9
170
- });
171
- $[37] = inputProps;
172
- $[38] = t9;
173
- $[39] = t10;
174
- } else {
175
- t10 = $[39];
176
- }
177
- return t10;
29
+ const handleOnChange = e => {
30
+ checkboxGroupContext.onChange && checkboxGroupContext.onChange(e);
31
+ onChange && onChange(e);
32
+ };
33
+ const inputProps = {
34
+ type: 'checkbox',
35
+ disabled,
36
+ ref: checkboxRef,
37
+ checked: indeterminate ? false : checked,
38
+ defaultChecked,
39
+ required,
40
+ ['aria-required']: required ? 'true' : 'false',
41
+ ['aria-invalid']: validationStatus === 'error' ? 'true' : 'false',
42
+ onChange: handleOnChange,
43
+ value,
44
+ name: value,
45
+ ...rest
46
+ };
47
+ useIsomorphicLayoutEffect(() => {
48
+ if (checkboxRef.current) {
49
+ checkboxRef.current.indeterminate = indeterminate || false;
50
+ }
51
+ }, [indeterminate, checked, checkboxRef]);
52
+ useEffect(() => {
53
+ const {
54
+ current: checkbox
55
+ } = checkboxRef;
56
+ if (!checkbox) {
57
+ return;
58
+ }
59
+ if (indeterminate) {
60
+ checkbox.setAttribute('aria-checked', 'mixed');
61
+ } else {
62
+ checkbox.setAttribute('aria-checked', checkbox.checked ? 'true' : 'false');
63
+ }
64
+ });
65
+ // @ts-expect-error inputProp needs a non nullable ref
66
+ return /*#__PURE__*/jsx("input", {
67
+ ...inputProps,
68
+ className: clsx(className, sharedClasses.Input, classes.Checkbox)
69
+ });
178
70
  });
179
71
  Checkbox.displayName = 'Checkbox';
180
72
  Checkbox.__SLOT__ = Symbol('Checkbox');
@@ -0,0 +1,2 @@
1
+ @property --prc-dialog-scrollgutter{initial-value:0;inherits:false;syntax:"<length>"}@keyframes prc-Dialog-dialog-backdrop-appear-tCG2K{0%{opacity:0}to{opacity:1}}@keyframes prc-Dialog-Overlay--motion-scaleFade-mE6-C{0%{opacity:0;transform:scale(.5)}to{opacity:1;transform:scale(1)}}@keyframes prc-Dialog-Overlay--motion-slideUp-tPElO{0%{transform:translateY(100%)}}@keyframes prc-Dialog-Overlay--motion-slideInRight-BR-CZ{0%{transform:translateX(-100%)}}@keyframes prc-Dialog-Overlay--motion-slideInLeft-ISmQZ{0%{transform:translateX(100%)}}@keyframes prc-Dialog-detect-scroll-b3i8Q{0%,to{--can-scroll:1}}.prc-Dialog-Backdrop-5Nt2U{animation:prc-Dialog-dialog-backdrop-appear-tCG2K .2s cubic-bezier(.33,1,.68,1);background-color:var(--overlay-backdrop-bgColor,var(--color-overlay-backdrop));bottom:0;display:flex;left:0;position:fixed;right:0;top:0}.prc-Dialog-Backdrop-5Nt2U,.prc-Dialog-Backdrop-5Nt2U[data-position-regular=center]{align-items:center;justify-content:center}.prc-Dialog-Backdrop-5Nt2U[data-position-regular=left]{align-items:center;justify-content:flex-start}.prc-Dialog-Backdrop-5Nt2U[data-position-regular=right]{align-items:center;justify-content:flex-end}.prc-Dialog-Backdrop-5Nt2U[data-align=top]:not([data-position-regular=left]):not([data-position-regular=right]){align-items:flex-start}.prc-Dialog-Backdrop-5Nt2U[data-align=center]:not([data-position-regular=left]):not([data-position-regular=right]){align-items:center}.prc-Dialog-Backdrop-5Nt2U[data-align=bottom]:not([data-position-regular=left]):not([data-position-regular=right]){align-items:flex-end}@media (max-width:767px){.prc-Dialog-Backdrop-5Nt2U[data-position-narrow=center]{align-items:center;justify-content:center}.prc-Dialog-Backdrop-5Nt2U[data-position-narrow=center][data-align=top]{align-items:flex-start}.prc-Dialog-Backdrop-5Nt2U[data-position-narrow=center][data-align=center]{align-items:center}.prc-Dialog-Backdrop-5Nt2U[data-position-narrow=center][data-align=bottom]{align-items:flex-end}.prc-Dialog-Backdrop-5Nt2U[data-position-narrow=bottom]{align-items:end;justify-content:center}}.prc-Dialog-Dialog-G8cDF{background-color:var(--overlay-bgColor,var(--color-canvas-overlay));border-radius:var(--borderRadius-large,.75rem);border-radius:var(--borderRadius-large,var(--borderRadius-large,.75rem));box-shadow:var(--shadow-floating-small,var(--color-overlay-shadow));display:flex;flex-direction:column;height:auto;max-height:calc(100dvh - 64px);max-width:calc(100dvw - 64px);min-width:296px;opacity:1;width:640px}.prc-Dialog-Dialog-G8cDF:where([data-width=small]){width:296px}.prc-Dialog-Dialog-G8cDF:where([data-width=medium]){width:320px}.prc-Dialog-Dialog-G8cDF:where([data-width=large]){width:480px}.prc-Dialog-Dialog-G8cDF:where([data-height=small]){height:480px}.prc-Dialog-Dialog-G8cDF:where([data-height=large]){height:640px}@media screen and (prefers-reduced-motion:no-preference){.prc-Dialog-Dialog-G8cDF{animation:prc-Dialog-Overlay--motion-scaleFade-mE6-C .2s cubic-bezier(.33,1,.68,1) 1ms 1 normal none running}}.prc-Dialog-Dialog-G8cDF[data-position-regular=center]{border-radius:var(--borderRadius-large,var(--borderRadius-large,.75rem))}@media screen and (prefers-reduced-motion:no-preference){.prc-Dialog-Dialog-G8cDF[data-position-regular=center]{animation:prc-Dialog-Overlay--motion-scaleFade-mE6-C .2s cubic-bezier(.33,1,.68,1) 1ms 1 normal none running}}.prc-Dialog-Dialog-G8cDF[data-align=top]:not([data-position-regular=left]):not([data-position-regular=right]){margin-top:var(--base-size-64,4rem)}.prc-Dialog-Dialog-G8cDF[data-align=bottom]:not([data-position-regular=left]):not([data-position-regular=right]){margin-bottom:var(--base-size-64,4rem)}.prc-Dialog-Dialog-G8cDF[data-position-regular=left]{border-radius:var(--borderRadius-large,var(--borderRadius-large,.75rem));border-bottom-left-radius:0;border-top-left-radius:0;height:100dvh;max-height:unset}@media screen and (prefers-reduced-motion:no-preference){.prc-Dialog-Dialog-G8cDF[data-position-regular=left]{animation:prc-Dialog-Overlay--motion-slideInRight-BR-CZ .25s cubic-bezier(.33,1,.68,1) 1ms 1 normal none running}}.prc-Dialog-Dialog-G8cDF[data-position-regular=right]{border-radius:var(--borderRadius-large,var(--borderRadius-large,.75rem));border-bottom-right-radius:0;border-top-right-radius:0;height:100dvh;max-height:unset}@media screen and (prefers-reduced-motion:no-preference){.prc-Dialog-Dialog-G8cDF[data-position-regular=right]{animation:prc-Dialog-Overlay--motion-slideInLeft-ISmQZ .25s cubic-bezier(.33,1,.68,1) 0s 1 normal none running}}@media (max-width:767px){.prc-Dialog-Dialog-G8cDF[data-position-narrow=center]{border-radius:var(--borderRadius-large,var(--borderRadius-large,.75rem));height:auto;width:640px}.prc-Dialog-Dialog-G8cDF[data-position-narrow=center]:where([data-width=small]){width:296px}.prc-Dialog-Dialog-G8cDF[data-position-narrow=center]:where([data-width=medium]){width:320px}.prc-Dialog-Dialog-G8cDF[data-position-narrow=center]:where([data-width=large]){width:480px}.prc-Dialog-Dialog-G8cDF[data-position-narrow=center]:where([data-height=small]){height:480px}.prc-Dialog-Dialog-G8cDF[data-position-narrow=center]:where([data-height=large]){height:640px}@media (max-height:280px){.prc-Dialog-Dialog-G8cDF{max-height:calc(100dvh - 12px);max-width:calc(100dvw - 12px)}}.prc-Dialog-Dialog-G8cDF[data-position-narrow=bottom]{border-radius:var(--borderRadius-large,var(--borderRadius-large,.75rem));border-bottom-left-radius:0;border-bottom-right-radius:0;height:auto;max-height:calc(100dvh - 64px);max-width:100dvw;width:100dvw}.prc-Dialog-Dialog-G8cDF[data-position-narrow=bottom][data-align]{margin-bottom:0;margin-top:0}@media screen and (prefers-reduced-motion:no-preference){.prc-Dialog-Dialog-G8cDF[data-position-narrow=bottom]{animation:prc-Dialog-Overlay--motion-slideUp-tPElO .25s cubic-bezier(.33,1,.68,1) 1ms 1 normal none running}}.prc-Dialog-Dialog-G8cDF[data-position-narrow=fullscreen]{border-radius:unset!important;flex-grow:1;height:100%;max-height:100dvh;max-width:100dvw;width:100%}@media screen and (prefers-reduced-motion:no-preference){.prc-Dialog-Dialog-G8cDF[data-position-narrow=fullscreen]{animation:prc-Dialog-Overlay--motion-scaleFade-mE6-C .2s cubic-bezier(.33,1,.68,1) 1ms 1 normal none running}}}body:not([data-dialog-scroll-optimized]):has(.prc-Dialog-Dialog-G8cDF.prc-Dialog-DisableScroll-UkWFM){overflow:hidden!important;padding-right:var(--prc-dialog-scrollgutter)!important}body[data-dialog-scroll-disabled]{overflow:hidden!important;padding-right:var(--prc-dialog-scrollgutter)!important}.prc-Dialog-DialogOverflowWrapper-JvHzz{flex-grow:1}.prc-Dialog-Dialog-G8cDF:has(.prc-Dialog-Footer-PMeQk){--can-scroll:0}.prc-Dialog-Dialog-G8cDF:has(.prc-Dialog-Footer-PMeQk) .prc-Dialog-DialogOverflowWrapper-JvHzz{animation:prc-Dialog-detect-scroll-b3i8Q;border-bottom:var(--borderWidth-default,.0625rem) solid var(--borderColor-default,var(--color-border-default));animation-timeline:scroll(self)}@supports (animation-timeline:scroll(self)){.prc-Dialog-Dialog-G8cDF:has(.prc-Dialog-Footer-PMeQk) .prc-Dialog-DialogOverflowWrapper-JvHzz{border-bottom:calc(var(--borderWidth-thin,.0625rem)*var(--can-scroll)) solid var(--borderColor-default,var(--color-border-default))}}.prc-Dialog-Header-f7Me-{box-shadow:0 1px 0 var(--borderColor-default,var(--color-border-default));flex-shrink:0;max-height:35vh;overflow-y:auto;padding:var(--base-size-8,.5rem);z-index:1}.prc-Dialog-HeaderInner-H-fFY{display:flex}.prc-Dialog-HeaderContent-mjAsn{display:flex;flex-direction:column;flex-grow:1;padding-block:var(--base-size-6,.375rem);padding-inline:var(--base-size-8,.5rem)}.prc-Dialog-Title-M-iPn{font-size:var(--text-body-size-medium,.875rem);font-weight:var(--text-title-weight-large,600);margin:0}.prc-Dialog-Subtitle-aBFSq{color:var(--fgColor-muted,var(--color-fg-muted));font-size:var(--text-body-size-small,.75rem);font-weight:var(--base-text-weight-normal,400);margin:0;margin-top:var(--base-size-4,.25rem)}.prc-Dialog-Body-bB903{flex-grow:1;overflow:auto}.prc-Dialog-Body-bB903,.prc-Dialog-Footer-PMeQk{padding:var(--base-size-16,1rem)}.prc-Dialog-Footer-PMeQk{display:flex;flex-flow:wrap;flex-shrink:0;gap:var(--base-size-8,.5rem);justify-content:flex-end;z-index:1}@media (max-height:325px){.prc-Dialog-Footer-PMeQk{flex-direction:row;flex-wrap:nowrap;justify-content:unset;overflow-x:scroll}}
2
+ /*# sourceMappingURL=Dialog-ad7231e4.css.map */
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/Dialog/Dialog.module.css.js"],"names":[],"mappings":"AAOA,oCACE,eAAgB,CAChB,cAAe,CACf,iBACF,CAEA,mDACE,GACE,SACF,CAEA,GACE,SACF,CACF,CAEA,sDACE,GACE,SAAU,CACV,mBACF,CAEA,GACE,SAAU,CACV,kBACF,CACF,CAEA,oDACE,GACE,0BACF,CACF,CAEA,yDACE,GACE,2BACF,CACF,CAEA,wDACE,GACE,0BACF,CACF,CAGA,0CACE,MAEE,cACF,CACF,CAEA,2BAQE,+EAAsE,CADtE,8EAAiD,CAHjD,QAAS,CAET,YAAa,CADb,MAAO,CAJP,cAAe,CAEf,OAAQ,CADR,KAgEF,CAtDE,oFAHA,kBAAmB,CACnB,sBAKA,CAEA,uDACE,kBAAmB,CACnB,0BACF,CAEA,wDACE,kBAAmB,CACnB,wBACF,CAIE,gHACE,sBACF,CAEA,mHACE,kBACF,CAEA,mHACE,oBACF,CAGF,yBACE,wDACE,kBAAmB,CACnB,sBAcF,CAXE,wEACE,sBACF,CAEA,2EACE,kBACF,CAEA,2EACE,oBACF,CAGF,wDACE,eAAgB,CAChB,sBACF,CACF,CAGF,yBASE,mEAAwC,CACxC,8CAAwC,CACxC,wEAAmE,CACnE,mEAAwC,CAXxC,YAAa,CAOb,qBAAsB,CAFtB,WAAY,CACZ,8BAA+B,CAF/B,6BAA8B,CAD9B,eAAgB,CAShB,SAAU,CAVV,WAmJF,CAvIE,mDACE,WACF,CAEA,oDACE,WACF,CAEA,mDAEE,WACF,CAEA,oDACE,YACF,CAEA,oDACE,YACF,CAEA,yDApCF,yBAqCI,4GAiHJ,CAhHE,CAEA,uDACE,wEAKF,CAHE,yDAHF,uDAII,4GAEJ,CADE,CAKA,8GACE,mCACF,CAEA,iHACE,sCACF,CAGF,qDAGE,wEAAmE,CAEnE,2BAA4B,CAD5B,wBAAyB,CAHzB,aAAc,CACd,gBAQF,CAHE,yDAPF,qDAQI,gHAEJ,CADE,CAGF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AcF,CANE,0BATF,yBAYI,kBAAmB,CAFnB,gBAAiB,CAGjB,qBAAsB,CAFtB,iBAIJ,CADE","file":"Dialog-ad7231e4.css","sourcesContent":["/* The --prc-dialog-scrollgutter property is used only on the body element to\n * simulate scrollbar-gutter:stable. This property is not and should not\n * be used elsewhere in the DOM. There is a performance penalty to\n * setting inherited properties which can cause a large style recalc to\n * occur, so it benefits us to prevent inheritance for this property.\n * See https://web.dev/blog/at-property-performance\n */\n@property --prc-dialog-scrollgutter {\n initial-value: 0;\n inherits: false;\n syntax: '<length>';\n}\n\n@keyframes dialog-backdrop-appear {\n 0% {\n opacity: 0;\n }\n\n 100% {\n opacity: 1;\n }\n}\n\n@keyframes Overlay--motion-scaleFade {\n 0% {\n opacity: 0;\n transform: scale(0.5);\n }\n\n 100% {\n opacity: 1;\n transform: scale(1);\n }\n}\n\n@keyframes Overlay--motion-slideUp {\n from {\n transform: translateY(100%);\n }\n}\n\n@keyframes Overlay--motion-slideInRight {\n from {\n transform: translateX(-100%);\n }\n}\n\n@keyframes Overlay--motion-slideInLeft {\n from {\n transform: translateX(100%);\n }\n}\n\n/* Used to determine whether there should be a border between the body and footer */\n@keyframes detect-scroll {\n from,\n to {\n --can-scroll: 1;\n }\n}\n\n.Backdrop {\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n display: flex;\n background-color: var(--overlay-backdrop-bgColor);\n animation: dialog-backdrop-appear 200ms cubic-bezier(0.33, 1, 0.68, 1);\n align-items: center;\n justify-content: center;\n\n &[data-position-regular='center'] {\n align-items: center;\n justify-content: center;\n }\n\n &[data-position-regular='left'] {\n align-items: center;\n justify-content: flex-start;\n }\n\n &[data-position-regular='right'] {\n align-items: center;\n justify-content: flex-end;\n }\n\n /* align only applies when regular position is center (or absent) */\n &:not([data-position-regular='left']):not([data-position-regular='right']) {\n &[data-align='top'] {\n align-items: flex-start;\n }\n\n &[data-align='center'] {\n align-items: center;\n }\n\n &[data-align='bottom'] {\n align-items: flex-end;\n }\n }\n\n @media (max-width: 767px) {\n &[data-position-narrow='center'] {\n align-items: center;\n justify-content: center;\n\n /* align still applies when narrow position is center */\n &[data-align='top'] {\n align-items: flex-start;\n }\n\n &[data-align='center'] {\n align-items: center;\n }\n\n &[data-align='bottom'] {\n align-items: flex-end;\n }\n }\n\n &[data-position-narrow='bottom'] {\n align-items: end;\n justify-content: center;\n }\n }\n}\n\n.Dialog {\n display: flex;\n /* stylelint-disable-next-line primer/responsive-widths */\n width: 640px;\n min-width: 296px;\n max-width: calc(100dvw - 64px);\n height: auto;\n max-height: calc(100dvh - 64px);\n flex-direction: column;\n background-color: var(--overlay-bgColor);\n border-radius: var(--borderRadius-large);\n border-radius: var(--borderRadius-large, var(--borderRadius-large));\n box-shadow: var(--shadow-floating-small);\n opacity: 1;\n\n &:where([data-width='small']) {\n width: 296px;\n }\n\n &:where([data-width='medium']) {\n width: 320px;\n }\n\n &:where([data-width='large']) {\n /* stylelint-disable-next-line primer/responsive-widths */\n width: 480px;\n }\n\n &:where([data-height='small']) {\n height: 480px;\n }\n\n &:where([data-height='large']) {\n height: 640px;\n }\n\n @media screen and (prefers-reduced-motion: no-preference) {\n animation: Overlay--motion-scaleFade 0.2s cubic-bezier(0.33, 1, 0.68, 1) 1ms 1 normal none running;\n }\n\n &[data-position-regular='center'] {\n border-radius: var(--borderRadius-large, var(--borderRadius-large));\n\n @media screen and (prefers-reduced-motion: no-preference) {\n animation: Overlay--motion-scaleFade 0.2s cubic-bezier(0.33, 1, 0.68, 1) 1ms 1 normal none running;\n }\n }\n\n /* align margins only apply when regular position is center (or absent) */\n &:not([data-position-regular='left']):not([data-position-regular='right']) {\n &[data-align='top'] {\n margin-top: var(--base-size-64);\n }\n\n &[data-align='bottom'] {\n margin-bottom: var(--base-size-64);\n }\n }\n\n &[data-position-regular='left'] {\n height: 100dvh;\n max-height: unset;\n border-radius: var(--borderRadius-large, var(--borderRadius-large));\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n\n @media screen and (prefers-reduced-motion: no-preference) {\n animation: Overlay--motion-slideInRight 0.25s cubic-bezier(0.33, 1, 0.68, 1) 1ms 1 normal none running;\n }\n }\n\n &[data-position-regular='right'] {\n height: 100dvh;\n max-height: unset;\n border-radius: var(--borderRadius-large, var(--borderRadius-large));\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n\n @media screen and (prefers-reduced-motion: no-preference) {\n animation: Overlay--motion-slideInLeft 0.25s cubic-bezier(0.33, 1, 0.68, 1) 0s 1 normal none running;\n }\n }\n\n @media (max-width: 767px) {\n &[data-position-narrow='center'] {\n /* stylelint-disable-next-line primer/responsive-widths */\n width: 640px;\n height: auto;\n border-radius: var(--borderRadius-large, var(--borderRadius-large));\n\n &:where([data-width='small']) {\n width: 296px;\n }\n\n &:where([data-width='medium']) {\n width: 320px;\n }\n\n &:where([data-width='large']) {\n /* stylelint-disable-next-line primer/responsive-widths */\n width: 480px;\n }\n\n &:where([data-height='small']) {\n height: 480px;\n }\n\n &:where([data-height='large']) {\n height: 640px;\n }\n }\n\n @media (max-height: 280px) {\n max-height: calc(100dvh - 12px);\n max-width: calc(100dvw - 12px);\n }\n\n &[data-position-narrow='bottom'] {\n width: 100dvw;\n max-width: 100dvw;\n height: auto;\n max-height: calc(100dvh - 64px);\n border-radius: var(--borderRadius-large, var(--borderRadius-large));\n border-bottom-right-radius: 0;\n border-bottom-left-radius: 0;\n\n /* reset align margins since position wins at narrow */\n &[data-align] {\n margin-top: 0;\n margin-bottom: 0;\n }\n\n @media screen and (prefers-reduced-motion: no-preference) {\n animation: Overlay--motion-slideUp 0.25s cubic-bezier(0.33, 1, 0.68, 1) 1ms 1 normal none running;\n }\n }\n\n &[data-position-narrow='fullscreen'] {\n width: 100%;\n max-width: 100dvw;\n height: 100%;\n max-height: 100dvh;\n border-radius: unset !important;\n flex-grow: 1;\n\n @media screen and (prefers-reduced-motion: no-preference) {\n animation: Overlay--motion-scaleFade 0.2s cubic-bezier(0.33, 1, 0.68, 1) 1ms 1 normal none running;\n }\n }\n }\n}\n\n/* DisableScroll class is added to Dialog when scroll should be disabled on body */\n.DisableScroll {\n /* This class is used as a selector target for the legacy :has() CSS selector */\n}\n\n/*\n * LEGACY: Scoped :has() selector with negation guard\n * Only evaluates when data-dialog-scroll-optimized is NOT present on body.\n * When the attribute IS present (flag ON), browser skips :has() evaluation\n * because the :not() check fails first (O(1) attribute lookup).\n */\nbody:not([data-dialog-scroll-optimized]):has(.Dialog.DisableScroll) {\n /* stylelint-disable-next-line primer/spacing */\n padding-right: var(--prc-dialog-scrollgutter) !important;\n overflow: hidden !important;\n}\n\n/*\n * PERFORMANCE OPTIMIZATION: Direct attribute on body - O(1) lookup\n * Active when primer_react_css_has_selector_perf flag is ON\n */\n/* stylelint-disable-next-line selector-no-qualifying-type */\nbody[data-dialog-scroll-disabled] {\n /* stylelint-disable-next-line primer/spacing */\n padding-right: var(--prc-dialog-scrollgutter) !important;\n overflow: hidden !important;\n}\n\n.DialogOverflowWrapper {\n flex-grow: 1;\n}\n\n/*\nAdd a border between the body and footer if:\n- the dialog has a footer\n- the dialog has a body that can scroll\n- the browser supports the `animation-timeline` property and its `scroll()` function\n*/\n.Dialog:has(.Footer) {\n --can-scroll: 0;\n\n .DialogOverflowWrapper {\n /* If the browser does not support the `animation-timeline` property, always show a border */\n border-bottom: var(--borderWidth-default) solid var(--borderColor-default);\n animation: detect-scroll;\n animation-timeline: scroll(self);\n\n @supports (animation-timeline: scroll(self)) {\n border-bottom: calc(var(--borderWidth-thin) * var(--can-scroll)) solid var(--borderColor-default);\n }\n }\n}\n\n.Header {\n z-index: 1;\n max-height: 35vh;\n padding: var(--base-size-8);\n overflow-y: auto;\n /* stylelint-disable-next-line primer/box-shadow */\n box-shadow: 0 1px 0 var(--borderColor-default);\n flex-shrink: 0;\n}\n\n.HeaderInner {\n display: flex;\n}\n\n.HeaderContent {\n display: flex;\n padding-inline: var(--base-size-8);\n padding-block: var(--base-size-6);\n flex-direction: column;\n flex-grow: 1;\n}\n\n.Title {\n margin: 0; /* override default margin */\n font-size: var(--text-body-size-medium);\n font-weight: var(--text-title-weight-large);\n}\n\n.Subtitle {\n margin: 0; /* override default margin */\n margin-top: var(--base-size-4);\n font-size: var(--text-body-size-small);\n font-weight: var(--base-text-weight-normal);\n color: var(--fgColor-muted);\n}\n\n.Body {\n padding: var(--base-size-16);\n overflow: auto;\n flex-grow: 1;\n}\n\n.Footer {\n z-index: 1;\n display: flex;\n flex-flow: wrap;\n justify-content: flex-end;\n padding: var(--base-size-16);\n gap: var(--base-size-8);\n flex-shrink: 0;\n\n @media (max-height: 325px) {\n flex-wrap: nowrap;\n overflow-x: scroll;\n flex-direction: row;\n justify-content: unset;\n }\n}\n"]}
@@ -100,6 +100,13 @@ export interface DialogProps {
100
100
  * The position of the dialog
101
101
  */
102
102
  position?: 'center' | 'left' | 'right' | ResponsiveValue<'left' | 'right' | 'bottom' | 'fullscreen' | 'center'>;
103
+ /**
104
+ * The vertical alignment of the dialog. Only applies when position is 'center' (the default).
105
+ * top: positions the Dialog ~4rem from the top of the screen, horizontally centered
106
+ * center: (default) vertically centers the Dialog on the screen
107
+ * bottom: positions the Dialog near the bottom of the screen, horizontally centered
108
+ */
109
+ align?: 'top' | 'center' | 'bottom';
103
110
  /**
104
111
  * Return focus to this element when the Dialog closes,
105
112
  * instead of the element that had focus immediately before the Dialog opened
@@ -1 +1 @@
1
- {"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../src/Dialog/Dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsE,MAAM,OAAO,CAAA;AAC1F,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,WAAW,CAAA;AAW1C,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,6BAA6B,CAAA;AAChE,OAAO,KAAK,EAAC,mBAAmB,IAAI,8BAA8B,EAAC,MAAM,sBAAsB,CAAA;AAQ/F;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,WAAW,EAAE,SA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