@primer/react 38.1.0-rc.995dba874 → 38.1.0-rc.fc60f3128
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/dist/Dialog/Dialog.d.ts +3 -23
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +18 -3
- package/package.json +5 -2
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
|
|
9
9
|
### Patch Changes
|
|
10
10
|
|
|
11
|
+
- [#7060](https://github.com/primer/react/pull/7060) [`3468793`](https://github.com/primer/react/commit/3468793e15269d6d9f226ee7844921e44bfc4622) Thanks [@francinelucca](https://github.com/francinelucca)! - @primer/react: chore(Dialog): allow direct children
|
|
12
|
+
|
|
11
13
|
- [#7061](https://github.com/primer/react/pull/7061) [`e58e102`](https://github.com/primer/react/commit/e58e1027d7f3cdae5223c08d83f7b86918db370b) Thanks [@francinelucca](https://github.com/francinelucca)! - PageLayout: update wrapper dimensions to match PageLayout's root element
|
|
12
14
|
|
|
13
15
|
- [#7097](https://github.com/primer/react/pull/7097) [`12fad7a`](https://github.com/primer/react/commit/12fad7af4d9d31898dfff5d3419987100b398d9e) Thanks [@francinelucca](https://github.com/francinelucca)! - chore: fix UnderlineWrapper html structure
|
package/dist/Dialog/Dialog.d.ts
CHANGED
|
@@ -142,35 +142,15 @@ declare const widthMap: {
|
|
|
142
142
|
};
|
|
143
143
|
export type DialogWidth = keyof typeof widthMap;
|
|
144
144
|
export type DialogHeight = keyof typeof heightMap;
|
|
145
|
-
/**
|
|
146
|
-
* A dialog is a type of overlay that can be used for confirming actions, asking
|
|
147
|
-
* for disambiguation, and presenting small forms. They generally allow the user
|
|
148
|
-
* to focus on a quick task without having to navigate to a different page.
|
|
149
|
-
*
|
|
150
|
-
* Dialogs appear in the page after a direct user interaction. Don't show dialogs
|
|
151
|
-
* on page load or as system alerts.
|
|
152
|
-
*
|
|
153
|
-
* Dialogs appear centered in the page, with a visible backdrop that dims the rest
|
|
154
|
-
* of the window for focus.
|
|
155
|
-
*
|
|
156
|
-
* All dialogs have a title and a close button.
|
|
157
|
-
*
|
|
158
|
-
* Dialogs are modal. Dialogs can be dismissed by clicking on the close button,
|
|
159
|
-
* pressing the escape key, or by interacting with another button in the dialog.
|
|
160
|
-
* To avoid losing information and missing important messages, clicking outside
|
|
161
|
-
* of the dialog will not close it.
|
|
162
|
-
*
|
|
163
|
-
* The sub components provided (e.g. Header, Title, etc.) are available for custom
|
|
164
|
-
* renderers only. They are not intended to be used otherwise.
|
|
165
|
-
*/
|
|
166
145
|
export declare const Dialog: React.ForwardRefExoticComponent<DialogProps & {
|
|
167
146
|
children?: React.ReactNode | undefined;
|
|
168
147
|
} & React.RefAttributes<HTMLDivElement>> & {
|
|
169
|
-
|
|
148
|
+
__SLOT__: symbol;
|
|
149
|
+
Header: PolymorphicForwardRefComponent<"div", React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>>;
|
|
170
150
|
Title: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
|
|
171
151
|
Subtitle: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
|
|
172
152
|
Body: PolymorphicForwardRefComponent<"div", React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>>;
|
|
173
|
-
Footer:
|
|
153
|
+
Footer: PolymorphicForwardRefComponent<"div", React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>>;
|
|
174
154
|
Buttons: React.FC<React.PropsWithChildren<{
|
|
175
155
|
buttons: DialogButtonProps[];
|
|
176
156
|
}>>;
|
|
@@ -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;
|
|
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,SAAS,CAAC,GAAG;IAC7D;;OAEG;IACH,UAAU,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAA;IAExD;;OAEG;IACH,OAAO,EAAE,KAAK,CAAC,SAAS,CAAA;IAExB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;IAEnB;;;OAGG;IACH,GAAG,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAA;CACzC,CAAA;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAEvB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAE1B;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,KA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AAG,MAAM,OAAO,QAAQ,CAAA;AAC/C,MAAM,MAAM,YAAY,GAAG,MAAM,OAAO,SAAS,CAAA;AA0QjD,eAAO,MAAM,MAAM;;;;;;;;;;iBA/DuC,iBAAiB,EAAE;;;iBAiCf,MAAM,IAAI;;CAuCtE,CAAA"}
|
package/dist/Dialog/Dialog.js
CHANGED
|
@@ -11,6 +11,7 @@ import { useRefObjectAsForwardedRef } from '../hooks/useRefObjectAsForwardedRef.
|
|
|
11
11
|
import { useId } from '../hooks/useId.js';
|
|
12
12
|
import classes from './Dialog.module.css.js';
|
|
13
13
|
import { clsx } from 'clsx';
|
|
14
|
+
import { useSlots } from '../hooks/useSlots.js';
|
|
14
15
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
15
16
|
import { useOnEscapePress } from '../hooks/useOnEscapePress.js';
|
|
16
17
|
import { ScrollableRegion } from '../ScrollableRegion/ScrollableRegion.js';
|
|
@@ -156,6 +157,7 @@ const defaultPosition = {
|
|
|
156
157
|
};
|
|
157
158
|
const defaultFooterButtons = [];
|
|
158
159
|
const _Dialog = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
|
160
|
+
var _slots$header, _slots$body, _slots$footer;
|
|
159
161
|
const {
|
|
160
162
|
title = 'Dialog',
|
|
161
163
|
subtitle = '',
|
|
@@ -195,6 +197,11 @@ const _Dialog = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
|
|
195
197
|
onClose('escape');
|
|
196
198
|
}
|
|
197
199
|
}, [onClose, lastMouseDownIsBackdrop]);
|
|
200
|
+
const [slots, childrenWithoutSlots] = useSlots(props.children, {
|
|
201
|
+
body: Dialog.Body,
|
|
202
|
+
header: Dialog.Header,
|
|
203
|
+
footer: Dialog.Footer
|
|
204
|
+
});
|
|
198
205
|
const dialogRef = useRef(null);
|
|
199
206
|
useRefObjectAsForwardedRef(forwardedRef, dialogRef);
|
|
200
207
|
const backdropRef = useRef(null);
|
|
@@ -217,9 +224,12 @@ const _Dialog = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
|
|
217
224
|
// account for the scrollbar width when calculating its width.
|
|
218
225
|
document.body.style.setProperty('--prc-dialog-scrollgutter', `${scrollbarWidth}px`);
|
|
219
226
|
}, []);
|
|
220
|
-
const header = (renderHeader !== null && renderHeader !== void 0 ? renderHeader : DefaultHeader)(defaultedProps);
|
|
221
|
-
const body = (renderBody !== null && renderBody !== void 0 ? renderBody : DefaultBody)(
|
|
222
|
-
|
|
227
|
+
const header = (_slots$header = slots.header) !== null && _slots$header !== void 0 ? _slots$header : (renderHeader !== null && renderHeader !== void 0 ? renderHeader : DefaultHeader)(defaultedProps);
|
|
228
|
+
const body = (_slots$body = slots.body) !== null && _slots$body !== void 0 ? _slots$body : (renderBody !== null && renderBody !== void 0 ? renderBody : DefaultBody)({
|
|
229
|
+
...defaultedProps,
|
|
230
|
+
children: childrenWithoutSlots
|
|
231
|
+
});
|
|
232
|
+
const footer = (_slots$footer = slots.footer) !== null && _slots$footer !== void 0 ? _slots$footer : (renderFooter !== null && renderFooter !== void 0 ? renderFooter : DefaultFooter)(defaultedProps);
|
|
223
233
|
const positionDataAttributes = typeof position === 'string' ? {
|
|
224
234
|
'data-position-regular': position
|
|
225
235
|
} : Object.fromEntries(Object.entries(position).map(([key, value]) => {
|
|
@@ -537,7 +547,12 @@ const CloseButton = t0 => {
|
|
|
537
547
|
* The sub components provided (e.g. Header, Title, etc.) are available for custom
|
|
538
548
|
* renderers only. They are not intended to be used otherwise.
|
|
539
549
|
*/
|
|
550
|
+
|
|
551
|
+
Header.__SLOT__ = Symbol('Dialog.Header');
|
|
552
|
+
Footer.__SLOT__ = Symbol('Dialog.Footer');
|
|
553
|
+
Body.__SLOT__ = Symbol('Dialog.Body');
|
|
540
554
|
const Dialog = Object.assign(_Dialog, {
|
|
555
|
+
__SLOT__: Symbol('Dialog'),
|
|
541
556
|
Header,
|
|
542
557
|
Title,
|
|
543
558
|
Subtitle,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@primer/react",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "38.1.0-rc.
|
|
4
|
+
"version": "38.1.0-rc.fc60f3128",
|
|
5
5
|
"description": "An implementation of GitHub's Primer Design System using React",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"module": "./dist/index.js",
|
|
@@ -51,7 +51,10 @@
|
|
|
51
51
|
"type-check": "tsc --noEmit",
|
|
52
52
|
"type-css-modules": "tcm -p src/**/*.module.css"
|
|
53
53
|
},
|
|
54
|
-
"repository":
|
|
54
|
+
"repository": {
|
|
55
|
+
"type": "git",
|
|
56
|
+
"url": "git+https://github.com/primer/react.git"
|
|
57
|
+
},
|
|
55
58
|
"keywords": [
|
|
56
59
|
"react",
|
|
57
60
|
"components",
|