@primer/react 0.0.0-20260306110652 → 0.0.0-20260306140850
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 +3 -7
- package/dist/ActionMenu/ActionMenu.d.ts.map +1 -1
- package/dist/ActionMenu/ActionMenu.js +9 -1
- package/dist/AnchoredOverlay/AnchoredOverlay-0f6f45b5.css +2 -0
- package/dist/AnchoredOverlay/AnchoredOverlay-0f6f45b5.css.map +1 -0
- package/dist/AnchoredOverlay/AnchoredOverlay.d.ts.map +1 -1
- package/dist/AnchoredOverlay/AnchoredOverlay.js +34 -9
- package/dist/AnchoredOverlay/AnchoredOverlay.module.css.js +2 -2
- package/dist/Dialog/Dialog-b8e961f6.css +2 -0
- package/dist/Dialog/Dialog-b8e961f6.css.map +1 -0
- package/dist/Dialog/Dialog.d.ts +0 -11
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +1 -10
- package/dist/Dialog/Dialog.module.css.js +1 -1
- package/dist/FeatureFlags/DefaultFeatureFlags.d.ts.map +1 -1
- package/dist/FeatureFlags/DefaultFeatureFlags.js +1 -0
- package/dist/FormControl/FormControl.d.ts.map +1 -1
- package/dist/FormControl/FormControl.js +64 -81
- package/dist/FormControl/FormControlLabel.d.ts.map +1 -1
- package/dist/FormControl/FormControlLabel.js +15 -20
- package/dist/FormControl/_FormControlContext.d.ts +0 -6
- package/dist/FormControl/_FormControlContext.d.ts.map +1 -1
- package/dist/Overlay/Overlay-71957ebf.css +2 -0
- package/dist/Overlay/Overlay-71957ebf.css.map +1 -0
- package/dist/Overlay/Overlay.d.ts.map +1 -1
- package/dist/Overlay/Overlay.js +10 -4
- package/dist/Overlay/Overlay.module.css.js +1 -1
- package/dist/SelectPanel/SelectPanel.d.ts.map +1 -1
- package/dist/SelectPanel/SelectPanel.js +3 -17
- package/dist/TextInputWithTokens/TextInputWithTokens.d.ts.map +1 -1
- package/dist/TextInputWithTokens/TextInputWithTokens.js +262 -331
- package/generated/components.json +0 -21
- package/package.json +2 -1
- package/dist/AnchoredOverlay/AnchoredOverlay-73c1b2d1.css +0 -2
- package/dist/AnchoredOverlay/AnchoredOverlay-73c1b2d1.css.map +0 -1
- package/dist/Dialog/Dialog-2d417a89.css +0 -2
- package/dist/Dialog/Dialog-2d417a89.css.map +0 -1
- package/dist/Overlay/Overlay-15519c09.css +0 -2
- package/dist/Overlay/Overlay-15519c09.css.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# @primer/react
|
|
2
2
|
|
|
3
|
-
## 0.0.0-
|
|
3
|
+
## 0.0.0-20260306140850
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
7
|
-
- [#
|
|
7
|
+
- [#7604](https://github.com/primer/react/pull/7604) [`d79584d`](https://github.com/primer/react/commit/d79584d0656ea92bd476820ecc1e4a3fcf25f9c1) Thanks [@TylerJDev](https://github.com/TylerJDev)! - AnchoredOverlay: Add CSS Anchor Positioning to `AnchoredOverlay` (under a feature flag)
|
|
8
8
|
|
|
9
|
-
- [#
|
|
9
|
+
- [#7524](https://github.com/primer/react/pull/7524) [`f7bdd1c`](https://github.com/primer/react/commit/f7bdd1c04f8cbb17b6a913ba55f7d0855c8eebf1) Thanks [@francinelucca](https://github.com/francinelucca)! - chore: always render ActionMenu in viewport when inside Dialog under feature flag
|
|
10
10
|
|
|
11
11
|
### Patch Changes
|
|
12
12
|
|
|
@@ -16,14 +16,10 @@
|
|
|
16
16
|
|
|
17
17
|
- Improves initial render performance for `ActionBar`
|
|
18
18
|
|
|
19
|
-
- [#7624](https://github.com/primer/react/pull/7624) [`f6d4311`](https://github.com/primer/react/commit/f6d431194d217fbb7d456e58bcbbcbb434896fe1) Thanks [@llastflowers](https://github.com/llastflowers)! - Fix FormControl + SelectPanel accessible name to address SR issues
|
|
20
|
-
|
|
21
19
|
- [#7617](https://github.com/primer/react/pull/7617) [`79c855a`](https://github.com/primer/react/commit/79c855abeb6f46d3fefafb236f00ea65dfcd1ed4) Thanks [@llastflowers](https://github.com/llastflowers)! - Push margin-top of TimelineBody +1px
|
|
22
20
|
|
|
23
21
|
- [#7550](https://github.com/primer/react/pull/7550) [`9585669`](https://github.com/primer/react/commit/958566907a580b54b484ff2339b32315b8a3b4b7) Thanks [@hectahertz](https://github.com/hectahertz)! - perf(Spinner): replace Web Animations API with CSS animation-delay sync
|
|
24
22
|
|
|
25
|
-
- [#7618](https://github.com/primer/react/pull/7618) [`17a103c`](https://github.com/primer/react/commit/17a103c0726ff2903e008a69dfd141461f99591f) Thanks [@liuliu-dev](https://github.com/liuliu-dev)! - TextInputWithTokens: announce selected token values for screen readers.
|
|
26
|
-
|
|
27
23
|
- [#7588](https://github.com/primer/react/pull/7588) [`e649da3`](https://github.com/primer/react/commit/e649da3c89b38f477fb574acf5bb06a49b41ee9d) Thanks [@lukasoppermann](https://github.com/lukasoppermann)! - ToggleSwitch: Updated with a 1px space around the knob to work better with updated primitives.
|
|
28
24
|
|
|
29
25
|
## 38.14.0
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionMenu.d.ts","sourceRoot":"","sources":["../../src/ActionMenu/ActionMenu.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8D,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"ActionMenu.d.ts","sourceRoot":"","sources":["../../src/ActionMenu/ActionMenu.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8D,MAAM,OAAO,CAAA;AAGlF,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,oBAAoB,CAAA;AAE5D,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,YAAY,CAAA;AAI5C,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,WAAW,CAAA;AAC1C,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,mBAAmB,CAAA;AAIrD,OAAO,KAAK,EAAC,mBAAmB,IAAI,8B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AK,CAAC,SAAS,CAAA;IACzB,gBAAgB,CAAC,EAAE,CAAC,EAAC,QAAQ,EAAC,EAAE;QAAC,QAAQ,EAAE,cAAc,CAAA;KAAC,KAAK,IAAI,CAAA;CACpE,CAAA;AAgHH,eAAO,MAAM,UAAU;;;kBA7LP,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC;aAC5B,MAAM;;;;CA4L4E,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { useContext, useState, useEffect, useCallback, useMemo } from 'react';
|
|
2
|
+
import { clsx } from 'clsx';
|
|
2
3
|
import { ChevronRightIcon, TriangleDownIcon } from '@primer/octicons-react';
|
|
3
4
|
import { Divider } from '../ActionList/Divider.js';
|
|
4
5
|
import { ActionListContainerContext } from '../ActionList/ActionListContainerContext.js';
|
|
@@ -43,6 +44,9 @@ const mergeAnchorHandlers = (anchorProps, buttonProps) => {
|
|
|
43
44
|
};
|
|
44
45
|
mergedAnchorProps.onKeyDown = mergedOnAnchorKeyDown;
|
|
45
46
|
}
|
|
47
|
+
if (buttonProps.className) {
|
|
48
|
+
mergedAnchorProps.className = clsx(anchorProps.className, buttonProps.className);
|
|
49
|
+
}
|
|
46
50
|
return mergedAnchorProps;
|
|
47
51
|
};
|
|
48
52
|
const Menu = ({
|
|
@@ -120,7 +124,10 @@ const Menu = ({
|
|
|
120
124
|
};
|
|
121
125
|
}
|
|
122
126
|
} else {
|
|
123
|
-
renderAnchor = anchorProps => /*#__PURE__*/React.cloneElement(child,
|
|
127
|
+
renderAnchor = anchorProps => /*#__PURE__*/React.cloneElement(child, {
|
|
128
|
+
...anchorProps,
|
|
129
|
+
className: clsx(anchorProps.className, child.props.className)
|
|
130
|
+
});
|
|
124
131
|
}
|
|
125
132
|
return null;
|
|
126
133
|
} else if (child.type === MenuButton || isSlot(child, MenuButton)) {
|
|
@@ -181,6 +188,7 @@ const Anchor = /*#__PURE__*/React.forwardRef(({
|
|
|
181
188
|
children: /*#__PURE__*/React.cloneElement(child, {
|
|
182
189
|
...anchorProps,
|
|
183
190
|
ref: anchorRef,
|
|
191
|
+
className: clsx(anchorProps.className, child.props.className),
|
|
184
192
|
onClick: onButtonClick,
|
|
185
193
|
onKeyDown: onButtonKeyDown
|
|
186
194
|
})
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
.prc-AnchoredOverlay-ResponsiveCloseButtonContainer-nuium{position:relative}.prc-AnchoredOverlay-ResponsiveCloseButton-z-2rx{display:none;position:absolute;right:var(--base-size-8,.5rem);top:var(--base-size-8,.5rem)}@media screen and (max-width:calc(48rem - 0.02px)){.prc-AnchoredOverlay-ResponsiveCloseButton-z-2rx{display:inline-grid}}.prc-AnchoredOverlay-Wrapper-w6jU3{anchor-scope:--anchored-overlay-anchor}.prc-AnchoredOverlay-Anchor-DWRfK{anchor-name:--anchored-overlay-anchor}.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z{position-anchor:--anchored-overlay-anchor;position-try-fallbacks:flip-block,flip-inline,flip-block flip-inline;position-visibility:anchors-visible;position:fixed;z-index:100}.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z[data-side=outside-bottom]{left:anchor(left);top:calc(anchor(bottom) + var(--base-size-4,.25rem))}.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z[data-side=outside-top]{bottom:anchor(top);left:anchor(left);margin-bottom:var(--base-size-4,.25rem)}.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z[data-side=outside-left]{margin-right:var(--base-size-4,.25rem);right:anchor(left);top:anchor(top)}.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z[data-side=outside-right]{left:anchor(right);margin-left:var(--base-size-4,.25rem);top:anchor(top)}
|
|
2
|
+
/*# sourceMappingURL=AnchoredOverlay-0f6f45b5.css.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/AnchoredOverlay/AnchoredOverlay.module.css.js"],"names":[],"mappings":"AAAA,0DACE,iBACF,CAEA,iDAIE,YAAa,CAHb,iBAAkB,CAElB,8BAAyB,CADzB,4BAOF,CAHE,mDANF,iDAOI,mBAEJ,CADE,CAGF,mCACE,sCACF,CAEA,kCAEE,qCACF,CAEA,2CAEE,yCAA0C,CAC1C,oEAGwB,CACxB,mCAAoC,CAEpC,cAAe,CADf,WA0BF,CAvBE,qEAGE,iBAAkB,CADlB,oDAEF,CAEA,kEAEE,kBAAmB,CACnB,iBAAkB,CAFlB,uCAGF,CAEA,mEAGE,sCAAgC,CAFhC,kBAAmB,CACnB,eAEF,CAEA,oEACE,kBAAmB,CAEnB,qCAA+B,CAD/B,eAEF","file":"AnchoredOverlay-0f6f45b5.css","sourcesContent":[".ResponsiveCloseButtonContainer {\n position: relative;\n}\n\n.ResponsiveCloseButton {\n position: absolute;\n top: var(--base-size-8);\n right: var(--base-size-8);\n display: none;\n\n @media screen and (--viewportRange-narrow) {\n display: inline-grid;\n }\n}\n\n.Wrapper {\n anchor-scope: --anchored-overlay-anchor;\n}\n\n.Anchor {\n /* Anchor name, this is currently tied to `renderAnchor` */\n anchor-name: --anchored-overlay-anchor;\n}\n\n.AnchoredOverlay {\n /* Anchor position, this is currently tied to `<Overlay>` */\n position-anchor: --anchored-overlay-anchor;\n position-try-fallbacks:\n flip-block,\n flip-inline,\n flip-block flip-inline;\n position-visibility: anchors-visible;\n z-index: 100;\n position: fixed;\n\n &[data-side='outside-bottom'] {\n /* stylelint-disable primer/spacing */\n top: calc(anchor(bottom) + var(--base-size-4));\n left: anchor(left);\n }\n\n &[data-side='outside-top'] {\n margin-bottom: var(--base-size-4);\n bottom: anchor(top);\n left: anchor(left);\n }\n\n &[data-side='outside-left'] {\n right: anchor(left);\n top: anchor(top);\n margin-right: var(--base-size-4);\n }\n\n &[data-side='outside-right'] {\n left: anchor(right);\n top: anchor(top);\n margin-left: var(--base-size-4);\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnchoredOverlay.d.ts","sourceRoot":"","sources":["../../src/AnchoredOverlay/An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eAAe,CAAC,UAAU,EAAE,UAAU,GAAG,YAAY,CAAC,CAAA;IAChE;;OAEG;IACH,gBAAgB,CAAC,EAAE,CAAC,EAAC,QAAQ,EAAC,EAAE;QAAC,QAAQ,EAAE,cAAc,CAAA;KAAC,KAAK,IAAI,CAAA;IACnE;;OAEG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAA;CAC5C;AAED,MAAM,MAAM,oBAAoB,GAAG,wBAAwB,GACzD,CAAC,8BAA8B,GAAG,iCAAiC,CAAC,GACpE,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,OAAO,GAAG,MAAM,GAAG,cAAc,GAAG,iBAAiB,GAAG,mBAAmB,CAAC,CAAC,CAAA;AAe9G;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,oBAAoB,CAAC,CA6KnF,CAAA"}
|
|
@@ -4,14 +4,21 @@ import { useFocusZone } from '../hooks/useFocusZone.js';
|
|
|
4
4
|
import { useId } from '../hooks/useId.js';
|
|
5
5
|
import { IconButton } from '../Button/IconButton.js';
|
|
6
6
|
import { XIcon } from '@primer/octicons-react';
|
|
7
|
+
import polyfill from '@oddbird/css-anchor-positioning/fn';
|
|
7
8
|
import classes from './AnchoredOverlay.module.css.js';
|
|
8
9
|
import { clsx } from 'clsx';
|
|
9
10
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
11
|
+
import { useFeatureFlag } from '../FeatureFlags/useFeatureFlag.js';
|
|
10
12
|
import { useProvidedRefOrCreate } from '../hooks/useProvidedRefOrCreate.js';
|
|
11
13
|
import { useRenderForcingRef } from '../hooks/useRenderForcingRef.js';
|
|
12
14
|
import { useAnchoredPosition } from '../hooks/useAnchoredPosition.js';
|
|
13
15
|
import Overlay from '../Overlay/Overlay.js';
|
|
14
16
|
|
|
17
|
+
const applyAnchorPositioningPolyfill = () => {
|
|
18
|
+
if (typeof window !== 'undefined' && !('anchorName' in document.documentElement.style)) {
|
|
19
|
+
polyfill();
|
|
20
|
+
}
|
|
21
|
+
};
|
|
15
22
|
const defaultVariant = {
|
|
16
23
|
regular: 'anchored',
|
|
17
24
|
narrow: 'anchored'
|
|
@@ -48,6 +55,7 @@ const AnchoredOverlay = ({
|
|
|
48
55
|
displayCloseButton = true,
|
|
49
56
|
closeButtonProps = defaultCloseButtonProps
|
|
50
57
|
}) => {
|
|
58
|
+
const cssAnchorPositioning = useFeatureFlag('primer_react_css_anchor_positioning');
|
|
51
59
|
const anchorRef = useProvidedRefOrCreate(externalAnchorRef);
|
|
52
60
|
const [overlayRef, updateOverlayRef] = useRenderForcingRef();
|
|
53
61
|
const anchorId = useId(externalAnchorId);
|
|
@@ -96,7 +104,10 @@ const AnchoredOverlay = ({
|
|
|
96
104
|
if (!open && overlayRef.current) {
|
|
97
105
|
updateOverlayRef(null);
|
|
98
106
|
}
|
|
99
|
-
|
|
107
|
+
if (cssAnchorPositioning) {
|
|
108
|
+
applyAnchorPositioningPolyfill();
|
|
109
|
+
}
|
|
110
|
+
}, [open, overlayRef, updateOverlayRef, cssAnchorPositioning]);
|
|
100
111
|
useFocusZone({
|
|
101
112
|
containerRef: overlayRef,
|
|
102
113
|
disabled: !open || !position_0,
|
|
@@ -110,7 +121,11 @@ const AnchoredOverlay = ({
|
|
|
110
121
|
const showXIcon = onClose && variant.narrow === 'fullscreen' && displayCloseButton;
|
|
111
122
|
const XButtonAriaLabelledBy = closeButtonProps['aria-labelledby'];
|
|
112
123
|
const XButtonAriaLabel = closeButtonProps['aria-label'];
|
|
113
|
-
|
|
124
|
+
const {
|
|
125
|
+
className: overlayClassName,
|
|
126
|
+
...restOverlayProps
|
|
127
|
+
} = overlayProps || {};
|
|
128
|
+
const innerContent = /*#__PURE__*/jsxs(Fragment, {
|
|
114
129
|
children: [renderAnchor && renderAnchor({
|
|
115
130
|
ref: anchorRef,
|
|
116
131
|
id: anchorId,
|
|
@@ -118,30 +133,33 @@ const AnchoredOverlay = ({
|
|
|
118
133
|
'aria-expanded': open,
|
|
119
134
|
tabIndex: 0,
|
|
120
135
|
onClick: onAnchorClick,
|
|
121
|
-
onKeyDown: onAnchorKeyDown
|
|
136
|
+
onKeyDown: onAnchorKeyDown,
|
|
137
|
+
className: cssAnchorPositioning ? classes.Anchor : undefined
|
|
122
138
|
}), open ? /*#__PURE__*/jsxs(Overlay, {
|
|
123
139
|
returnFocusRef: anchorRef,
|
|
124
140
|
onClickOutside: onClickOutside,
|
|
125
141
|
ignoreClickRefs: [anchorRef],
|
|
126
142
|
onEscape: onEscape,
|
|
127
143
|
role: "none",
|
|
128
|
-
visibility: position_0 ? 'visible' : 'hidden',
|
|
144
|
+
visibility: cssAnchorPositioning || position_0 ? 'visible' : 'hidden',
|
|
129
145
|
height: height,
|
|
130
146
|
width: width,
|
|
131
|
-
top: (position_0 === null || position_0 === void 0 ? void 0 : position_0.top) || 0,
|
|
132
|
-
left: (position_0 === null || position_0 === void 0 ? void 0 : position_0.left) || 0,
|
|
147
|
+
top: cssAnchorPositioning ? undefined : (position_0 === null || position_0 === void 0 ? void 0 : position_0.top) || 0,
|
|
148
|
+
left: cssAnchorPositioning ? undefined : (position_0 === null || position_0 === void 0 ? void 0 : position_0.left) || 0,
|
|
133
149
|
responsiveVariant: variant.narrow === 'fullscreen' ? 'fullscreen' : undefined,
|
|
134
|
-
anchorSide: position_0 === null || position_0 === void 0 ? void 0 : position_0.anchorSide,
|
|
135
|
-
className: className,
|
|
150
|
+
anchorSide: cssAnchorPositioning ? undefined : position_0 === null || position_0 === void 0 ? void 0 : position_0.anchorSide,
|
|
151
|
+
className: clsx(className, overlayClassName, cssAnchorPositioning ? classes.AnchoredOverlay : undefined),
|
|
136
152
|
preventOverflow: preventOverflow,
|
|
137
153
|
"data-component": "AnchoredOverlay",
|
|
138
|
-
...
|
|
154
|
+
...restOverlayProps,
|
|
139
155
|
ref: node => {
|
|
140
156
|
if (overlayProps !== null && overlayProps !== void 0 && overlayProps.ref) {
|
|
141
157
|
assignRef(overlayProps.ref, node);
|
|
142
158
|
}
|
|
143
159
|
updateOverlayRef(node);
|
|
144
160
|
},
|
|
161
|
+
"data-anchor-position": cssAnchorPositioning,
|
|
162
|
+
"data-side": position_0 === null || position_0 === void 0 ? void 0 : position_0.anchorSide,
|
|
145
163
|
children: [showXIcon ? /*#__PURE__*/jsx("div", {
|
|
146
164
|
className: classes.ResponsiveCloseButtonContainer,
|
|
147
165
|
children: /*#__PURE__*/jsx(IconButton, {
|
|
@@ -164,6 +182,13 @@ const AnchoredOverlay = ({
|
|
|
164
182
|
}) : null, children]
|
|
165
183
|
}) : null]
|
|
166
184
|
});
|
|
185
|
+
if (cssAnchorPositioning) {
|
|
186
|
+
return /*#__PURE__*/jsx("div", {
|
|
187
|
+
className: classes.Wrapper,
|
|
188
|
+
children: innerContent
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
return innerContent;
|
|
167
192
|
};
|
|
168
193
|
function assignRef(ref, value) {
|
|
169
194
|
if (typeof ref === 'function') {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import './AnchoredOverlay-
|
|
1
|
+
import './AnchoredOverlay-0f6f45b5.css';
|
|
2
2
|
|
|
3
|
-
var classes = {"ResponsiveCloseButtonContainer":"prc-AnchoredOverlay-ResponsiveCloseButtonContainer-nuium","ResponsiveCloseButton":"prc-AnchoredOverlay-ResponsiveCloseButton-z-2rx"};
|
|
3
|
+
var classes = {"ResponsiveCloseButtonContainer":"prc-AnchoredOverlay-ResponsiveCloseButtonContainer-nuium","ResponsiveCloseButton":"prc-AnchoredOverlay-ResponsiveCloseButton-z-2rx","Wrapper":"prc-AnchoredOverlay-Wrapper-w6jU3","Anchor":"prc-AnchoredOverlay-Anchor-DWRfK","AnchoredOverlay":"prc-AnchoredOverlay-AnchoredOverlay-fYg9Z"};
|
|
4
4
|
|
|
5
5
|
export { classes as default };
|
|
@@ -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}@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=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-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}@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-b8e961f6.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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CADjB,YAWF,CAHE,yDATF,sDAUI,2GAEJ,CADE,CAGF,0DAKE,6BAA+B,CAC/B,WAAY,CAHZ,WAAY,CACZ,iBAAkB,CAFlB,gBAAiB,CADjB,UAUF,CAHE,yDARF,0DASI,4GAEJ,CADE,CAEJ,CAeF,sGAGE,yBAA2B,CAD3B,sDAEF,CAOA,kCAGE,yBAA2B,CAD3B,sDAEF,CAEA,wCACE,WACF,CAQA,uDACE,cAYF,CAVE,+FAGE,wCAAwB,CADxB,8GAA0E,CAE1E,+BAKF,CAHE,4CANF,+FAOI,mIAEJ,CADE,CAIJ,yBAME,yEAA8C,CAC9C,aAAc,CALd,eAAgB,CAEhB,eAAgB,CADhB,gCAA2B,CAF3B,SAOF,CAEA,8BACE,YACF,CAEA,gCACE,YAAa,CAGb,qBAAsB,CACtB,WAAY,CAFZ,wCAAiC,CADjC,uCAIF,CAEA,wBAEE,8CAAuC,CACvC,8CAA2C,CAF3C,QAGF,CAEA,2BAKE,gDAA2B,CAF3B,4CAAsC,CACtC,8CAA2C,CAH3C,QAAS,CACT,oCAIF,CAEA,uBAGE,WAAY,CADZ,aAEF,CAEA,gDALE,gCAoBF,CAfA,yBAEE,YAAa,CACb,cAAe,CAIf,aAAc,CADd,4BAAuB,CAFvB,wBAAyB,CAHzB,SAcF,CANE,0BATF,yBAYI,kBAAmB,CAFnB,gBAAiB,CAGjB,qBAAsB,CAFtB,iBAIJ,CADE","file":"Dialog-b8e961f6.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 @media (max-width: 767px) {\n &[data-position-narrow='center'] {\n align-items: center;\n justify-content: center;\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 &[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 @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 */\n/* stylelint-disable-next-line selector-no-qualifying-type */\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"]}
|
package/dist/Dialog/Dialog.d.ts
CHANGED
|
@@ -100,13 +100,6 @@ 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';
|
|
110
103
|
/**
|
|
111
104
|
* Return focus to this element when the Dialog closes,
|
|
112
105
|
* instead of the element that had focus immediately before the Dialog opened
|
|
@@ -120,10 +113,6 @@ export interface DialogProps {
|
|
|
120
113
|
* Additional class names to apply to the dialog
|
|
121
114
|
*/
|
|
122
115
|
className?: string;
|
|
123
|
-
/**
|
|
124
|
-
* Additional styles to apply to the dialog
|
|
125
|
-
*/
|
|
126
|
-
style?: React.CSSProperties;
|
|
127
116
|
}
|
|
128
117
|
/**
|
|
129
118
|
* Props that are passed to a component that serves as a dialog header
|
|
@@ -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,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,GAAG,IAAI,CAAC,CAAA;CAChD,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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,GAAG,QAAQ,GAAG,YAAY,GAAG,QAAQ,CAAC,CAAA;IAE/G;;;OAGG;IACH,cAAc,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;IAEpD;;OAEG;IACH,eAAe,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;IAErD;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAkB,SAAQ,WAAW;IACpD;;;OAGG;IACH,aAAa,EAAE,MAAM,CAAA;IAErB;;;OAGG;IACH,mBAAmB,EAAE,MAAM,CAAA;CAC5B;AAGD,QAAA,MAAM,SAAS;;;;CAIL,CAAA;AAGV,QAAA,MAAM,QAAQ;;;;;CAKJ,CAAA;AAEV,MAAM,MAAM,WAAW,GAAG,MAAM,OAAO,QAAQ,CAAA;AAC/C,MAAM,MAAM,YAAY,GAAG,MAAM,OAAO,SAAS,CAAA;AA+CjD,eAAO,MAAM,aAAa,mCAAqD,CAAA;AAmP/E,eAAO,MAAM,MAAM;;;;;;;;;;iBAhEuC,iBAAiB,EAAE;;;iBAkCf,MAAM,IAAI;;CAuCtE,CAAA"}
|
package/dist/Dialog/Dialog.js
CHANGED
|
@@ -91,11 +91,9 @@ const _Dialog = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
|
|
91
91
|
height = 'auto',
|
|
92
92
|
footerButtons = defaultFooterButtons,
|
|
93
93
|
position = defaultPosition,
|
|
94
|
-
align,
|
|
95
94
|
returnFocusRef,
|
|
96
95
|
initialFocusRef,
|
|
97
|
-
className
|
|
98
|
-
style
|
|
96
|
+
className
|
|
99
97
|
} = props;
|
|
100
98
|
const dialogLabelId = useId();
|
|
101
99
|
const dialogDescriptionId = useId();
|
|
@@ -181,9 +179,6 @@ const _Dialog = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
|
|
181
179
|
ref: backdropRef,
|
|
182
180
|
className: classes.Backdrop,
|
|
183
181
|
...positionDataAttributes,
|
|
184
|
-
...(align && {
|
|
185
|
-
'data-align': align
|
|
186
|
-
}),
|
|
187
182
|
onClick: onBackdropClick,
|
|
188
183
|
onMouseDown: e => {
|
|
189
184
|
setLastMouseDownIsBackdrop(e.target === e.currentTarget);
|
|
@@ -195,13 +190,9 @@ const _Dialog = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
|
|
195
190
|
"aria-describedby": dialogDescriptionId,
|
|
196
191
|
"aria-modal": true,
|
|
197
192
|
...positionDataAttributes,
|
|
198
|
-
...(align && {
|
|
199
|
-
'data-align': align
|
|
200
|
-
}),
|
|
201
193
|
"data-width": width,
|
|
202
194
|
"data-height": height,
|
|
203
195
|
className: clsx(className, classes.Dialog),
|
|
204
|
-
style: style,
|
|
205
196
|
children: [header, /*#__PURE__*/jsx(ScrollableRegion, {
|
|
206
197
|
"aria-labelledby": dialogLabelId,
|
|
207
198
|
className: classes.DialogOverflowWrapper,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import './Dialog-
|
|
1
|
+
import './Dialog-b8e961f6.css';
|
|
2
2
|
|
|
3
3
|
var classes = {"Backdrop":"prc-Dialog-Backdrop-5Nt2U","dialog-backdrop-appear":"prc-Dialog-dialog-backdrop-appear-tCG2K","Dialog":"prc-Dialog-Dialog-G8cDF","Overlay--motion-scaleFade":"prc-Dialog-Overlay--motion-scaleFade-mE6-C","Overlay--motion-slideInRight":"prc-Dialog-Overlay--motion-slideInRight-BR-CZ","Overlay--motion-slideInLeft":"prc-Dialog-Overlay--motion-slideInLeft-ISmQZ","Overlay--motion-slideUp":"prc-Dialog-Overlay--motion-slideUp-tPElO","DisableScroll":"prc-Dialog-DisableScroll-UkWFM","DialogOverflowWrapper":"prc-Dialog-DialogOverflowWrapper-JvHzz","Footer":"prc-Dialog-Footer-PMeQk","detect-scroll":"prc-Dialog-detect-scroll-b3i8Q","Header":"prc-Dialog-Header-f7Me-","HeaderInner":"prc-Dialog-HeaderInner-H-fFY","HeaderContent":"prc-Dialog-HeaderContent-mjAsn","Title":"prc-Dialog-Title-M-iPn","Subtitle":"prc-Dialog-Subtitle-aBFSq","Body":"prc-Dialog-Body-bB903"};
|
|
4
4
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultFeatureFlags.d.ts","sourceRoot":"","sources":["../../src/FeatureFlags/DefaultFeatureFlags.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAA;AAEnD,eAAO,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"DefaultFeatureFlags.d.ts","sourceRoot":"","sources":["../../src/FeatureFlags/DefaultFeatureFlags.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAA;AAEnD,eAAO,MAAM,mBAAmB,kBAS9B,CAAA"}
|
|
@@ -2,6 +2,7 @@ import { FeatureFlagScope } from './FeatureFlagScope.js';
|
|
|
2
2
|
|
|
3
3
|
const DefaultFeatureFlags = FeatureFlagScope.create({
|
|
4
4
|
primer_react_breadcrumbs_overflow_menu: false,
|
|
5
|
+
primer_react_css_anchor_positioning: false,
|
|
5
6
|
primer_react_css_has_selector_perf: false,
|
|
6
7
|
primer_react_select_panel_fullscreen_on_narrow: false,
|
|
7
8
|
primer_react_select_panel_order_selected_at_top: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormControl.d.ts","sourceRoot":"","sources":["../../src/FormControl/FormControl.tsx"],"names":[],"mappings":"AACA,OAAO,KAAmB,MAAM,OAAO,CAAA;AAavC,OAAO,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAA;AASvD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAA;IACX;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;;OAGG;IACH,MAAM,CAAC,EAAE,YAAY,GAAG,UAAU,CAAA;IAClC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;CAC5B,CAAA;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"FormControl.d.ts","sourceRoot":"","sources":["../../src/FormControl/FormControl.tsx"],"names":[],"mappings":"AACA,OAAO,KAAmB,MAAM,OAAO,CAAA;AAavC,OAAO,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAA;AASvD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAA;IACX;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;;OAGG;IACH,MAAM,CAAC,EAAE,YAAY,GAAG,UAAU,CAAA;IAClC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;CAC5B,CAAA;;;;;;;;;;;;;;AAuLD,wBAME"}
|
|
@@ -25,7 +25,7 @@ import { SelectPanel } from '../SelectPanel/SelectPanel.js';
|
|
|
25
25
|
|
|
26
26
|
const FormControl = /*#__PURE__*/React.forwardRef((t0, ref) => {
|
|
27
27
|
var _slots$validation, _slots$label;
|
|
28
|
-
const $ = c(
|
|
28
|
+
const $ = c(27);
|
|
29
29
|
const {
|
|
30
30
|
children,
|
|
31
31
|
disabled: disabledProp,
|
|
@@ -60,18 +60,6 @@ const FormControl = /*#__PURE__*/React.forwardRef((t0, ref) => {
|
|
|
60
60
|
const inputProps = /*#__PURE__*/React.isValidElement(InputComponent) && InputComponent.props;
|
|
61
61
|
const isChoiceInput = /*#__PURE__*/React.isValidElement(InputComponent) && (InputComponent.type === Checkbox || InputComponent.type === Radio || isSlot(InputComponent, Checkbox) || isSlot(InputComponent, Radio));
|
|
62
62
|
const isRadioInput = /*#__PURE__*/React.isValidElement(InputComponent) && (InputComponent.type === Radio || isSlot(InputComponent, Radio));
|
|
63
|
-
const isSelectPanelInput = /*#__PURE__*/React.isValidElement(InputComponent) && (InputComponent.type === SelectPanel || isSlot(InputComponent, SelectPanel));
|
|
64
|
-
let t3;
|
|
65
|
-
if ($[1] !== id || $[2] !== slots.label) {
|
|
66
|
-
var _ref;
|
|
67
|
-
t3 = slots.label ? (_ref = /*#__PURE__*/React.isValidElement(slots.label) ? slots.label.props.id : undefined) !== null && _ref !== void 0 ? _ref : `${id}-label` : undefined;
|
|
68
|
-
$[1] = id;
|
|
69
|
-
$[2] = slots.label;
|
|
70
|
-
$[3] = t3;
|
|
71
|
-
} else {
|
|
72
|
-
t3 = $[3];
|
|
73
|
-
}
|
|
74
|
-
const labelId = t3;
|
|
75
63
|
if (InputComponent) {
|
|
76
64
|
process.env.NODE_ENV !== "production" ? warning(inputProps === null || inputProps === void 0 ? void 0 : inputProps.id, "instead of passing the 'id' prop directly to the input component, it should be passed to the parent component, <FormControl>") : void 0;
|
|
77
65
|
process.env.NODE_ENV !== "production" ? warning(inputProps === null || inputProps === void 0 ? void 0 : inputProps.disabled, "instead of passing the 'disabled' prop directly to the input component, it should be passed to the parent component, <FormControl>") : void 0;
|
|
@@ -87,97 +75,92 @@ const FormControl = /*#__PURE__*/React.forwardRef((t0, ref) => {
|
|
|
87
75
|
process.env.NODE_ENV !== "production" ? warning(!!slots.leadingVisual, "A leading visual is only rendered for a checkbox or radio form control. If you want to render a leading visual inside of your input, check if your input supports a leading visual.") : void 0;
|
|
88
76
|
}
|
|
89
77
|
const isLabelHidden = (_slots$label = slots.label) === null || _slots$label === void 0 ? void 0 : _slots$label.props.visuallyHidden;
|
|
90
|
-
const
|
|
78
|
+
const t3 = /*#__PURE__*/React.isValidElement(InputComponent) ? /*#__PURE__*/React.cloneElement(InputComponent, {
|
|
91
79
|
id,
|
|
92
80
|
disabled,
|
|
93
81
|
required: required && !isRadioInput,
|
|
94
82
|
"aria-describedby": captionId
|
|
95
83
|
}) : null;
|
|
96
|
-
let
|
|
97
|
-
if ($[
|
|
98
|
-
|
|
99
|
-
$[
|
|
100
|
-
$[
|
|
84
|
+
let t4;
|
|
85
|
+
if ($[1] !== childrenWithoutSlots) {
|
|
86
|
+
t4 = childrenWithoutSlots.filter(_temp2);
|
|
87
|
+
$[1] = childrenWithoutSlots;
|
|
88
|
+
$[2] = t4;
|
|
101
89
|
} else {
|
|
102
|
-
|
|
90
|
+
t4 = $[2];
|
|
103
91
|
}
|
|
104
|
-
let
|
|
105
|
-
if ($[
|
|
106
|
-
|
|
92
|
+
let t5;
|
|
93
|
+
if ($[3] !== t3 || $[4] !== t4) {
|
|
94
|
+
t5 = /*#__PURE__*/jsxs("div", {
|
|
107
95
|
className: classes.ControlChoiceInputs,
|
|
108
|
-
children: [
|
|
96
|
+
children: [t3, t4]
|
|
109
97
|
});
|
|
110
|
-
$[
|
|
111
|
-
$[
|
|
112
|
-
$[
|
|
98
|
+
$[3] = t3;
|
|
99
|
+
$[4] = t4;
|
|
100
|
+
$[5] = t5;
|
|
113
101
|
} else {
|
|
114
|
-
|
|
102
|
+
t5 = $[5];
|
|
115
103
|
}
|
|
116
|
-
let
|
|
117
|
-
if ($[
|
|
118
|
-
|
|
104
|
+
let t6;
|
|
105
|
+
if ($[6] !== disabled || $[7] !== slots.caption || $[8] !== slots.leadingVisual) {
|
|
106
|
+
t6 = slots.leadingVisual ? /*#__PURE__*/jsx("div", {
|
|
119
107
|
className: classes.LeadingVisual,
|
|
120
108
|
"data-disabled": disabled ? "" : undefined,
|
|
121
109
|
"data-has-caption": slots.caption ? "" : undefined,
|
|
122
110
|
children: slots.leadingVisual
|
|
123
111
|
}) : null;
|
|
124
|
-
$[
|
|
125
|
-
$[
|
|
126
|
-
$[
|
|
127
|
-
$[
|
|
112
|
+
$[6] = disabled;
|
|
113
|
+
$[7] = slots.caption;
|
|
114
|
+
$[8] = slots.leadingVisual;
|
|
115
|
+
$[9] = t6;
|
|
128
116
|
} else {
|
|
129
|
-
|
|
117
|
+
t6 = $[9];
|
|
130
118
|
}
|
|
131
|
-
let
|
|
132
|
-
if ($[
|
|
133
|
-
|
|
119
|
+
let t7;
|
|
120
|
+
if ($[10] !== slots.caption || $[11] !== slots.label) {
|
|
121
|
+
t7 = /*#__PURE__*/jsxs("div", {
|
|
134
122
|
className: classes.LabelContainer,
|
|
135
123
|
children: [slots.label, slots.caption]
|
|
136
124
|
});
|
|
137
|
-
$[
|
|
138
|
-
$[
|
|
139
|
-
$[
|
|
125
|
+
$[10] = slots.caption;
|
|
126
|
+
$[11] = slots.label;
|
|
127
|
+
$[12] = t7;
|
|
140
128
|
} else {
|
|
141
|
-
|
|
129
|
+
t7 = $[12];
|
|
142
130
|
}
|
|
143
|
-
let
|
|
144
|
-
if ($[
|
|
145
|
-
|
|
146
|
-
children: [t6, t7
|
|
131
|
+
let t8;
|
|
132
|
+
if ($[13] !== t5 || $[14] !== t6 || $[15] !== t7) {
|
|
133
|
+
t8 = /*#__PURE__*/jsxs(Fragment, {
|
|
134
|
+
children: [t5, t6, t7]
|
|
147
135
|
});
|
|
148
|
-
$[
|
|
149
|
-
$[
|
|
150
|
-
$[
|
|
151
|
-
$[
|
|
136
|
+
$[13] = t5;
|
|
137
|
+
$[14] = t6;
|
|
138
|
+
$[15] = t7;
|
|
139
|
+
$[16] = t8;
|
|
152
140
|
} else {
|
|
153
|
-
|
|
141
|
+
t8 = $[16];
|
|
154
142
|
}
|
|
155
|
-
const InputChildren =
|
|
143
|
+
const InputChildren = t8;
|
|
156
144
|
const T0 = FormControlContextProvider;
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
t11 = {
|
|
145
|
+
let t9;
|
|
146
|
+
if ($[17] !== captionId || $[18] !== disabled || $[19] !== id || $[20] !== required || $[21] !== validationMessageId) {
|
|
147
|
+
t9 = {
|
|
161
148
|
captionId,
|
|
162
149
|
disabled,
|
|
163
150
|
id,
|
|
164
151
|
required,
|
|
165
|
-
validationMessageId
|
|
166
|
-
isReferenced: t10,
|
|
167
|
-
labelId
|
|
152
|
+
validationMessageId
|
|
168
153
|
};
|
|
169
|
-
$[
|
|
170
|
-
$[
|
|
171
|
-
$[
|
|
172
|
-
$[
|
|
173
|
-
$[
|
|
174
|
-
$[
|
|
175
|
-
$[26] = validationMessageId;
|
|
176
|
-
$[27] = t11;
|
|
154
|
+
$[17] = captionId;
|
|
155
|
+
$[18] = disabled;
|
|
156
|
+
$[19] = id;
|
|
157
|
+
$[20] = required;
|
|
158
|
+
$[21] = validationMessageId;
|
|
159
|
+
$[22] = t9;
|
|
177
160
|
} else {
|
|
178
|
-
|
|
161
|
+
t9 = $[22];
|
|
179
162
|
}
|
|
180
|
-
const
|
|
163
|
+
const t10 = isChoiceInput || layout === "horizontal" ? /*#__PURE__*/jsx("div", {
|
|
181
164
|
ref: ref,
|
|
182
165
|
"data-has-leading-visual": slots.leadingVisual ? "" : undefined,
|
|
183
166
|
className: clsx(className, classes.ControlHorizontalLayout),
|
|
@@ -199,20 +182,20 @@ const FormControl = /*#__PURE__*/React.forwardRef((t0, ref) => {
|
|
|
199
182
|
children: slots.validation
|
|
200
183
|
}) : null, slots.caption]
|
|
201
184
|
});
|
|
202
|
-
let
|
|
203
|
-
if ($[
|
|
204
|
-
|
|
205
|
-
value:
|
|
206
|
-
children:
|
|
185
|
+
let t11;
|
|
186
|
+
if ($[23] !== T0 || $[24] !== t10 || $[25] !== t9) {
|
|
187
|
+
t11 = /*#__PURE__*/jsx(T0, {
|
|
188
|
+
value: t9,
|
|
189
|
+
children: t10
|
|
207
190
|
});
|
|
208
|
-
$[
|
|
209
|
-
$[
|
|
210
|
-
$[
|
|
211
|
-
$[
|
|
191
|
+
$[23] = T0;
|
|
192
|
+
$[24] = t10;
|
|
193
|
+
$[25] = t9;
|
|
194
|
+
$[26] = t11;
|
|
212
195
|
} else {
|
|
213
|
-
|
|
196
|
+
t11 = $[26];
|
|
214
197
|
}
|
|
215
|
-
return
|
|
198
|
+
return t11;
|
|
216
199
|
});
|
|
217
200
|
var FormControl$1 = Object.assign(FormControl, {
|
|
218
201
|
__SLOT__: Symbol('FormControl'),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormControlLabel.d.ts","sourceRoot":"","sources":["../../src/FormControl/FormControlLabel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAC,UAAU,EAAC,MAAM,mCAAmC,CAAA;AAC5D,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,gBAAgB,CAAA;AAEpD,MAAM,MAAM,KAAK,GAAG;IAClB;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;CAC5B,CAAA;AAED,QAAA,MAAM,gBAAgB,EAAE,gBAAgB,CACtC,KAAK,CAAC,iBAAiB,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAC,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,UAAU,CAAC,GAAG,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"FormControlLabel.d.ts","sourceRoot":"","sources":["../../src/FormControl/FormControlLabel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAC,UAAU,EAAC,MAAM,mCAAmC,CAAA;AAC5D,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,gBAAgB,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