@primer/react 0.0.0-20260306145654 → 0.0.0-20260306164000
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 +9 -3
- package/dist/ActionMenu/ActionMenu.d.ts.map +1 -1
- package/dist/ActionMenu/ActionMenu.js +1 -9
- package/dist/AnchoredOverlay/AnchoredOverlay-73c1b2d1.css +2 -0
- package/dist/AnchoredOverlay/AnchoredOverlay-73c1b2d1.css.map +1 -0
- package/dist/AnchoredOverlay/AnchoredOverlay.d.ts.map +1 -1
- package/dist/AnchoredOverlay/AnchoredOverlay.js +9 -34
- package/dist/AnchoredOverlay/AnchoredOverlay.module.css.js +2 -2
- package/dist/Dialog/Dialog-2d417a89.css +2 -0
- package/dist/Dialog/Dialog-2d417a89.css.map +1 -0
- package/dist/Dialog/Dialog.d.ts +11 -0
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +12 -2
- package/dist/Dialog/Dialog.module.css.js +1 -1
- package/dist/FeatureFlags/DefaultFeatureFlags.d.ts.map +1 -1
- package/dist/FeatureFlags/DefaultFeatureFlags.js +0 -1
- package/dist/FormControl/FormControl.d.ts.map +1 -1
- package/dist/FormControl/FormControl.js +81 -64
- package/dist/FormControl/FormControlLabel.d.ts.map +1 -1
- package/dist/FormControl/FormControlLabel.js +20 -15
- package/dist/FormControl/_FormControlContext.d.ts +6 -0
- package/dist/FormControl/_FormControlContext.d.ts.map +1 -1
- package/dist/Overlay/Overlay-15519c09.css +2 -0
- package/dist/Overlay/Overlay-15519c09.css.map +1 -0
- package/dist/Overlay/Overlay.d.ts.map +1 -1
- package/dist/Overlay/Overlay.js +4 -10
- package/dist/Overlay/Overlay.module.css.js +1 -1
- package/dist/SelectPanel/SelectPanel.d.ts.map +1 -1
- package/dist/SelectPanel/SelectPanel.js +17 -3
- package/dist/TextInputWithTokens/TextInputWithTokens.d.ts.map +1 -1
- package/dist/TextInputWithTokens/TextInputWithTokens.js +331 -262
- package/generated/components.json +21 -0
- package/package.json +1 -2
- package/dist/AnchoredOverlay/AnchoredOverlay-0f6f45b5.css +0 -2
- package/dist/AnchoredOverlay/AnchoredOverlay-0f6f45b5.css.map +0 -1
- package/dist/Dialog/Dialog-b8e961f6.css +0 -2
- package/dist/Dialog/Dialog-b8e961f6.css.map +0 -1
- package/dist/Overlay/Overlay-c207c100.css +0 -2
- package/dist/Overlay/Overlay-c207c100.css.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
# @primer/react
|
|
2
2
|
|
|
3
|
-
## 0.0.0-
|
|
3
|
+
## 0.0.0-20260306164000
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
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
|
-
|
|
9
7
|
- [#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
8
|
|
|
9
|
+
- [#7594](https://github.com/primer/react/pull/7594) [`1e54bdf`](https://github.com/primer/react/commit/1e54bdf72c9466f23c567cfdc73b7b5c243782a4) Thanks [@copilot-swe-agent](https://github.com/apps/copilot-swe-agent)! - Add `align` and `style` props to Dialog component
|
|
10
|
+
|
|
11
11
|
### Patch Changes
|
|
12
12
|
|
|
13
13
|
- Fake entry to force publishing
|
|
@@ -16,10 +16,16 @@
|
|
|
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
|
+
- [#7620](https://github.com/primer/react/pull/7620) [`143c0aa`](https://github.com/primer/react/commit/143c0aa36fcbe8763eb42a850f374765321fd155) Thanks [@hectahertz](https://github.com/hectahertz)! - Use stable object reference for DialogContext value to prevent unnecessary re-renders
|
|
22
|
+
|
|
19
23
|
- [#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
|
|
20
24
|
|
|
21
25
|
- [#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
|
|
22
26
|
|
|
27
|
+
- [#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.
|
|
28
|
+
|
|
23
29
|
- [#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.
|
|
24
30
|
|
|
25
31
|
## 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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G,CAAC,CAAC;IAAC,EAAE,CAAC,EAAE,MAAM,CAAA;CAAC,GAAG,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,CAAA;AA0DxH,6CAA6C;AAC7C,MAAM,MAAM,qBAAqB,GAAG,WAAW,CAAA;AAe/C,KAAK,gBAAgB,GAAG,OAAO,CAAC,YAAY,CAAC,GAC3C,IAAI,CAAC,oBAAoB,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,GAAG,mBAAmB,CAAC,GAAG;IAC/E;;OAEG;IACH,QAAQ,EAAE,KAAK,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;;;kBA5LP,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC;aAC5B,MAAM;;;;CA2L4E,CAAA"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React, { useContext, useState, useEffect, useCallback, useMemo } from 'react';
|
|
2
|
-
import { clsx } from 'clsx';
|
|
3
2
|
import { ChevronRightIcon, TriangleDownIcon } from '@primer/octicons-react';
|
|
4
3
|
import { Divider } from '../ActionList/Divider.js';
|
|
5
4
|
import { ActionListContainerContext } from '../ActionList/ActionListContainerContext.js';
|
|
@@ -44,9 +43,6 @@ const mergeAnchorHandlers = (anchorProps, buttonProps) => {
|
|
|
44
43
|
};
|
|
45
44
|
mergedAnchorProps.onKeyDown = mergedOnAnchorKeyDown;
|
|
46
45
|
}
|
|
47
|
-
if (buttonProps.className) {
|
|
48
|
-
mergedAnchorProps.className = clsx(anchorProps.className, buttonProps.className);
|
|
49
|
-
}
|
|
50
46
|
return mergedAnchorProps;
|
|
51
47
|
};
|
|
52
48
|
const Menu = ({
|
|
@@ -124,10 +120,7 @@ const Menu = ({
|
|
|
124
120
|
};
|
|
125
121
|
}
|
|
126
122
|
} else {
|
|
127
|
-
renderAnchor = anchorProps => /*#__PURE__*/React.cloneElement(child,
|
|
128
|
-
...anchorProps,
|
|
129
|
-
className: clsx(anchorProps.className, child.props.className)
|
|
130
|
-
});
|
|
123
|
+
renderAnchor = anchorProps => /*#__PURE__*/React.cloneElement(child, anchorProps);
|
|
131
124
|
}
|
|
132
125
|
return null;
|
|
133
126
|
} else if (child.type === MenuButton || isSlot(child, MenuButton)) {
|
|
@@ -188,7 +181,6 @@ const Anchor = /*#__PURE__*/React.forwardRef(({
|
|
|
188
181
|
children: /*#__PURE__*/React.cloneElement(child, {
|
|
189
182
|
...anchorProps,
|
|
190
183
|
ref: anchorRef,
|
|
191
|
-
className: clsx(anchorProps.className, child.props.className),
|
|
192
184
|
onClick: onButtonClick,
|
|
193
185
|
onKeyDown: onButtonKeyDown
|
|
194
186
|
})
|
|
@@ -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}}
|
|
2
|
+
/*# sourceMappingURL=AnchoredOverlay-73c1b2d1.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","file":"AnchoredOverlay-73c1b2d1.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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnchoredOverlay.d.ts","sourceRoot":"","sources":["../../src/AnchoredOverlay/AnchoredOverlay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAyB,KAAK,GAAG,EAAC,MAAM,OAAO,CAAA;AACtD,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,YAAY,CAAA;AAE5C,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,uBAAuB,CAAA;AAEhE,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,uBAAuB,CAAA;AAIhE,OAAO,KAAK,EAAC,cAAc,EAAE,gBAAgB,EAAC,MAAM,mBAAmB,CAAA;AACvE,OAAO,EAAC,KAAK,eAAe,EAAC,MAAM,6BAA6B,CAAA;AAChE,OAAO,EAAa,KAAK,eAAe,EAAC,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"AnchoredOverlay.d.ts","sourceRoot":"","sources":["../../src/AnchoredOverlay/AnchoredOverlay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAyB,KAAK,GAAG,EAAC,MAAM,OAAO,CAAA;AACtD,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,YAAY,CAAA;AAE5C,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,uBAAuB,CAAA;AAEhE,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,uBAAuB,CAAA;AAIhE,OAAO,KAAK,EAAC,cAAc,EAAE,gBAAgB,EAAC,MAAM,mBAAmB,CAAA;AACvE,OAAO,EAAC,KAAK,eAAe,EAAC,MAAM,6BAA6B,CAAA;AAChE,OAAO,EAAa,KAAK,eAAe,EAAC,MAAM,WAAW,CAAA;AAK1D,UAAU,8BAA8B;IACtC;;;OAGG;IACH,YAAY,EAAE,CAAC,CAAC,SAAS,IAAI,CAAC,KAAK,CAA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,CAAA;IACzB;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB;;OAEG;IACH,OAAO,CAAC,EAAE,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;AAS9G;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,oBAAoB,CAAC,CA6JnF,CAAA"}
|
|
@@ -4,21 +4,14 @@ 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';
|
|
8
7
|
import classes from './AnchoredOverlay.module.css.js';
|
|
9
8
|
import { clsx } from 'clsx';
|
|
10
9
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
11
|
-
import { useFeatureFlag } from '../FeatureFlags/useFeatureFlag.js';
|
|
12
10
|
import { useProvidedRefOrCreate } from '../hooks/useProvidedRefOrCreate.js';
|
|
13
11
|
import { useRenderForcingRef } from '../hooks/useRenderForcingRef.js';
|
|
14
12
|
import { useAnchoredPosition } from '../hooks/useAnchoredPosition.js';
|
|
15
13
|
import Overlay from '../Overlay/Overlay.js';
|
|
16
14
|
|
|
17
|
-
const applyAnchorPositioningPolyfill = () => {
|
|
18
|
-
if (typeof window !== 'undefined' && !('anchorName' in document.documentElement.style)) {
|
|
19
|
-
polyfill();
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
15
|
const defaultVariant = {
|
|
23
16
|
regular: 'anchored',
|
|
24
17
|
narrow: 'anchored'
|
|
@@ -55,7 +48,6 @@ const AnchoredOverlay = ({
|
|
|
55
48
|
displayCloseButton = true,
|
|
56
49
|
closeButtonProps = defaultCloseButtonProps
|
|
57
50
|
}) => {
|
|
58
|
-
const cssAnchorPositioning = useFeatureFlag('primer_react_css_anchor_positioning');
|
|
59
51
|
const anchorRef = useProvidedRefOrCreate(externalAnchorRef);
|
|
60
52
|
const [overlayRef, updateOverlayRef] = useRenderForcingRef();
|
|
61
53
|
const anchorId = useId(externalAnchorId);
|
|
@@ -104,10 +96,7 @@ const AnchoredOverlay = ({
|
|
|
104
96
|
if (!open && overlayRef.current) {
|
|
105
97
|
updateOverlayRef(null);
|
|
106
98
|
}
|
|
107
|
-
|
|
108
|
-
applyAnchorPositioningPolyfill();
|
|
109
|
-
}
|
|
110
|
-
}, [open, overlayRef, updateOverlayRef, cssAnchorPositioning]);
|
|
99
|
+
}, [open, overlayRef, updateOverlayRef]);
|
|
111
100
|
useFocusZone({
|
|
112
101
|
containerRef: overlayRef,
|
|
113
102
|
disabled: !open || !position_0,
|
|
@@ -121,11 +110,7 @@ const AnchoredOverlay = ({
|
|
|
121
110
|
const showXIcon = onClose && variant.narrow === 'fullscreen' && displayCloseButton;
|
|
122
111
|
const XButtonAriaLabelledBy = closeButtonProps['aria-labelledby'];
|
|
123
112
|
const XButtonAriaLabel = closeButtonProps['aria-label'];
|
|
124
|
-
|
|
125
|
-
className: overlayClassName,
|
|
126
|
-
...restOverlayProps
|
|
127
|
-
} = overlayProps || {};
|
|
128
|
-
const innerContent = /*#__PURE__*/jsxs(Fragment, {
|
|
113
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
129
114
|
children: [renderAnchor && renderAnchor({
|
|
130
115
|
ref: anchorRef,
|
|
131
116
|
id: anchorId,
|
|
@@ -133,33 +118,30 @@ const AnchoredOverlay = ({
|
|
|
133
118
|
'aria-expanded': open,
|
|
134
119
|
tabIndex: 0,
|
|
135
120
|
onClick: onAnchorClick,
|
|
136
|
-
onKeyDown: onAnchorKeyDown
|
|
137
|
-
className: cssAnchorPositioning ? classes.Anchor : undefined
|
|
121
|
+
onKeyDown: onAnchorKeyDown
|
|
138
122
|
}), open ? /*#__PURE__*/jsxs(Overlay, {
|
|
139
123
|
returnFocusRef: anchorRef,
|
|
140
124
|
onClickOutside: onClickOutside,
|
|
141
125
|
ignoreClickRefs: [anchorRef],
|
|
142
126
|
onEscape: onEscape,
|
|
143
127
|
role: "none",
|
|
144
|
-
visibility:
|
|
128
|
+
visibility: position_0 ? 'visible' : 'hidden',
|
|
145
129
|
height: height,
|
|
146
130
|
width: width,
|
|
147
|
-
top:
|
|
148
|
-
left:
|
|
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,
|
|
149
133
|
responsiveVariant: variant.narrow === 'fullscreen' ? 'fullscreen' : undefined,
|
|
150
|
-
anchorSide:
|
|
151
|
-
className:
|
|
134
|
+
anchorSide: position_0 === null || position_0 === void 0 ? void 0 : position_0.anchorSide,
|
|
135
|
+
className: className,
|
|
152
136
|
preventOverflow: preventOverflow,
|
|
153
137
|
"data-component": "AnchoredOverlay",
|
|
154
|
-
...
|
|
138
|
+
...overlayProps,
|
|
155
139
|
ref: node => {
|
|
156
140
|
if (overlayProps !== null && overlayProps !== void 0 && overlayProps.ref) {
|
|
157
141
|
assignRef(overlayProps.ref, node);
|
|
158
142
|
}
|
|
159
143
|
updateOverlayRef(node);
|
|
160
144
|
},
|
|
161
|
-
"data-anchor-position": cssAnchorPositioning,
|
|
162
|
-
"data-side": position_0 === null || position_0 === void 0 ? void 0 : position_0.anchorSide,
|
|
163
145
|
children: [showXIcon ? /*#__PURE__*/jsx("div", {
|
|
164
146
|
className: classes.ResponsiveCloseButtonContainer,
|
|
165
147
|
children: /*#__PURE__*/jsx(IconButton, {
|
|
@@ -182,13 +164,6 @@ const AnchoredOverlay = ({
|
|
|
182
164
|
}) : null, children]
|
|
183
165
|
}) : null]
|
|
184
166
|
});
|
|
185
|
-
if (cssAnchorPositioning) {
|
|
186
|
-
return /*#__PURE__*/jsx("div", {
|
|
187
|
-
className: classes.Wrapper,
|
|
188
|
-
children: innerContent
|
|
189
|
-
});
|
|
190
|
-
}
|
|
191
|
-
return innerContent;
|
|
192
167
|
};
|
|
193
168
|
function assignRef(ref, value) {
|
|
194
169
|
if (typeof ref === 'function') {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import './AnchoredOverlay-
|
|
1
|
+
import './AnchoredOverlay-73c1b2d1.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"};
|
|
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}.prc-Dialog-Backdrop-5Nt2U[data-align=top]:where(:not([data-position-regular=left]):not([data-position-regular=right])){align-items:flex-start}.prc-Dialog-Backdrop-5Nt2U[data-align=center]:where(:not([data-position-regular=left]):not([data-position-regular=right])){align-items:center}.prc-Dialog-Backdrop-5Nt2U[data-align=bottom]:where(: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-position-regular=center][data-align=top]{margin-top:var(--base-size-64,4rem)}.prc-Dialog-Dialog-G8cDF[data-position-regular=center][data-align=bottom]{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%}.prc-Dialog-Dialog-G8cDF[data-position-narrow=fullscreen][data-align]{margin-bottom:0;margin-top:0}@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-2d417a89.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,KAkEF,CAxDE,oFAHA,kBAAmB,CACnB,sBAKA,CAEA,uDACE,kBAAmB,CACnB,0BACF,CAEA,wDACE,kBAAmB,CACnB,wBACF,CAME,wHACE,sBACF,CAEA,2HACE,kBACF,CAEA,2HACE,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,WAuJF,CA3IE,mDACE,WACF,CAEA,oDACE,WACF,CAEA,mDAEE,WACF,CAEA,oDACE,YACF,CAEA,oDACE,YACF,CAEA,yDApCF,yBAqCI,4GAqHJ,CApHE,CAEA,uDACE,wEAcF,CAZE,yDAHF,uDAII,4GAWJ,CAVE,CA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AF3B,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-2d417a89.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 * :where() zeroes out the :not() specificity so narrow-position rules (coming later)\n * always win when data-position-narrow is bottom or fullscreen. */\n &:where(: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 /* align margins only apply when regular position is center */\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 /* reset align margins since fullscreen 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-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,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
|
|
@@ -113,6 +120,10 @@ export interface DialogProps {
|
|
|
113
120
|
* Additional class names to apply to the dialog
|
|
114
121
|
*/
|
|
115
122
|
className?: string;
|
|
123
|
+
/**
|
|
124
|
+
* Additional styles to apply to the dialog
|
|
125
|
+
*/
|
|
126
|
+
style?: React.CSSProperties;
|
|
116
127
|
}
|
|
117
128
|
/**
|
|
118
129
|
* 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;IACH,YAAY,CAAC,EAAE,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from a nested component
|
|
79
79
|
const DialogContext = /*#__PURE__*/React.createContext(undefined);
|
|
80
|
+
const DIALOG_CONTEXT_VALUE = Object.freeze({});
|
|
80
81
|
const _Dialog = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
|
81
82
|
var _slots$header, _slots$body, _slots$footer;
|
|
82
83
|
const {
|
|
@@ -91,9 +92,11 @@ const _Dialog = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
|
|
91
92
|
height = 'auto',
|
|
92
93
|
footerButtons = defaultFooterButtons,
|
|
93
94
|
position = defaultPosition,
|
|
95
|
+
align,
|
|
94
96
|
returnFocusRef,
|
|
95
97
|
initialFocusRef,
|
|
96
|
-
className
|
|
98
|
+
className,
|
|
99
|
+
style
|
|
97
100
|
} = props;
|
|
98
101
|
const dialogLabelId = useId();
|
|
99
102
|
const dialogDescriptionId = useId();
|
|
@@ -173,12 +176,15 @@ const _Dialog = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
|
|
173
176
|
return [`data-position-${key}`, value];
|
|
174
177
|
}));
|
|
175
178
|
return /*#__PURE__*/jsx(DialogContext.Provider, {
|
|
176
|
-
value:
|
|
179
|
+
value: DIALOG_CONTEXT_VALUE,
|
|
177
180
|
children: /*#__PURE__*/jsx(Portal, {
|
|
178
181
|
children: /*#__PURE__*/jsx("div", {
|
|
179
182
|
ref: backdropRef,
|
|
180
183
|
className: classes.Backdrop,
|
|
181
184
|
...positionDataAttributes,
|
|
185
|
+
...(align && {
|
|
186
|
+
'data-align': align
|
|
187
|
+
}),
|
|
182
188
|
onClick: onBackdropClick,
|
|
183
189
|
onMouseDown: e => {
|
|
184
190
|
setLastMouseDownIsBackdrop(e.target === e.currentTarget);
|
|
@@ -190,9 +196,13 @@ const _Dialog = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
|
|
190
196
|
"aria-describedby": dialogDescriptionId,
|
|
191
197
|
"aria-modal": true,
|
|
192
198
|
...positionDataAttributes,
|
|
199
|
+
...(align && {
|
|
200
|
+
'data-align': align
|
|
201
|
+
}),
|
|
193
202
|
"data-width": width,
|
|
194
203
|
"data-height": height,
|
|
195
204
|
className: clsx(className, classes.Dialog),
|
|
205
|
+
style: style,
|
|
196
206
|
children: [header, /*#__PURE__*/jsx(ScrollableRegion, {
|
|
197
207
|
"aria-labelledby": dialogLabelId,
|
|
198
208
|
className: classes.DialogOverflowWrapper,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import './Dialog-
|
|
1
|
+
import './Dialog-2d417a89.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,kBAQ9B,CAAA"}
|
|
@@ -2,7 +2,6 @@ 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,
|
|
6
5
|
primer_react_css_has_selector_perf: false,
|
|
7
6
|
primer_react_select_panel_fullscreen_on_narrow: false,
|
|
8
7
|
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;;;;;;;;;;;;;;AAiMD,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(32);
|
|
29
29
|
const {
|
|
30
30
|
children,
|
|
31
31
|
disabled: disabledProp,
|
|
@@ -60,6 +60,18 @@ 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;
|
|
63
75
|
if (InputComponent) {
|
|
64
76
|
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;
|
|
65
77
|
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;
|
|
@@ -75,92 +87,97 @@ const FormControl = /*#__PURE__*/React.forwardRef((t0, ref) => {
|
|
|
75
87
|
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;
|
|
76
88
|
}
|
|
77
89
|
const isLabelHidden = (_slots$label = slots.label) === null || _slots$label === void 0 ? void 0 : _slots$label.props.visuallyHidden;
|
|
78
|
-
const
|
|
90
|
+
const t4 = /*#__PURE__*/React.isValidElement(InputComponent) ? /*#__PURE__*/React.cloneElement(InputComponent, {
|
|
79
91
|
id,
|
|
80
92
|
disabled,
|
|
81
93
|
required: required && !isRadioInput,
|
|
82
94
|
"aria-describedby": captionId
|
|
83
95
|
}) : null;
|
|
84
|
-
let t4;
|
|
85
|
-
if ($[1] !== childrenWithoutSlots) {
|
|
86
|
-
t4 = childrenWithoutSlots.filter(_temp2);
|
|
87
|
-
$[1] = childrenWithoutSlots;
|
|
88
|
-
$[2] = t4;
|
|
89
|
-
} else {
|
|
90
|
-
t4 = $[2];
|
|
91
|
-
}
|
|
92
96
|
let t5;
|
|
93
|
-
if ($[
|
|
94
|
-
t5 =
|
|
95
|
-
|
|
96
|
-
children: [t3, t4]
|
|
97
|
-
});
|
|
98
|
-
$[3] = t3;
|
|
99
|
-
$[4] = t4;
|
|
97
|
+
if ($[4] !== childrenWithoutSlots) {
|
|
98
|
+
t5 = childrenWithoutSlots.filter(_temp2);
|
|
99
|
+
$[4] = childrenWithoutSlots;
|
|
100
100
|
$[5] = t5;
|
|
101
101
|
} else {
|
|
102
102
|
t5 = $[5];
|
|
103
103
|
}
|
|
104
104
|
let t6;
|
|
105
|
-
if ($[6] !==
|
|
106
|
-
t6 =
|
|
105
|
+
if ($[6] !== t4 || $[7] !== t5) {
|
|
106
|
+
t6 = /*#__PURE__*/jsxs("div", {
|
|
107
|
+
className: classes.ControlChoiceInputs,
|
|
108
|
+
children: [t4, t5]
|
|
109
|
+
});
|
|
110
|
+
$[6] = t4;
|
|
111
|
+
$[7] = t5;
|
|
112
|
+
$[8] = t6;
|
|
113
|
+
} else {
|
|
114
|
+
t6 = $[8];
|
|
115
|
+
}
|
|
116
|
+
let t7;
|
|
117
|
+
if ($[9] !== disabled || $[10] !== slots.caption || $[11] !== slots.leadingVisual) {
|
|
118
|
+
t7 = slots.leadingVisual ? /*#__PURE__*/jsx("div", {
|
|
107
119
|
className: classes.LeadingVisual,
|
|
108
120
|
"data-disabled": disabled ? "" : undefined,
|
|
109
121
|
"data-has-caption": slots.caption ? "" : undefined,
|
|
110
122
|
children: slots.leadingVisual
|
|
111
123
|
}) : null;
|
|
112
|
-
$[
|
|
113
|
-
$[
|
|
114
|
-
$[
|
|
115
|
-
$[
|
|
124
|
+
$[9] = disabled;
|
|
125
|
+
$[10] = slots.caption;
|
|
126
|
+
$[11] = slots.leadingVisual;
|
|
127
|
+
$[12] = t7;
|
|
116
128
|
} else {
|
|
117
|
-
|
|
129
|
+
t7 = $[12];
|
|
118
130
|
}
|
|
119
|
-
let
|
|
120
|
-
if ($[
|
|
121
|
-
|
|
131
|
+
let t8;
|
|
132
|
+
if ($[13] !== slots.caption || $[14] !== slots.label) {
|
|
133
|
+
t8 = /*#__PURE__*/jsxs("div", {
|
|
122
134
|
className: classes.LabelContainer,
|
|
123
135
|
children: [slots.label, slots.caption]
|
|
124
136
|
});
|
|
125
|
-
$[
|
|
126
|
-
$[
|
|
127
|
-
$[
|
|
137
|
+
$[13] = slots.caption;
|
|
138
|
+
$[14] = slots.label;
|
|
139
|
+
$[15] = t8;
|
|
128
140
|
} else {
|
|
129
|
-
|
|
141
|
+
t8 = $[15];
|
|
130
142
|
}
|
|
131
|
-
let
|
|
132
|
-
if ($[
|
|
133
|
-
|
|
134
|
-
children: [
|
|
143
|
+
let t9;
|
|
144
|
+
if ($[16] !== t6 || $[17] !== t7 || $[18] !== t8) {
|
|
145
|
+
t9 = /*#__PURE__*/jsxs(Fragment, {
|
|
146
|
+
children: [t6, t7, t8]
|
|
135
147
|
});
|
|
136
|
-
$[
|
|
137
|
-
$[
|
|
138
|
-
$[
|
|
139
|
-
$[
|
|
148
|
+
$[16] = t6;
|
|
149
|
+
$[17] = t7;
|
|
150
|
+
$[18] = t8;
|
|
151
|
+
$[19] = t9;
|
|
140
152
|
} else {
|
|
141
|
-
|
|
153
|
+
t9 = $[19];
|
|
142
154
|
}
|
|
143
|
-
const InputChildren =
|
|
155
|
+
const InputChildren = t9;
|
|
144
156
|
const T0 = FormControlContextProvider;
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
157
|
+
const t10 = !isSelectPanelInput;
|
|
158
|
+
let t11;
|
|
159
|
+
if ($[20] !== captionId || $[21] !== disabled || $[22] !== id || $[23] !== labelId || $[24] !== required || $[25] !== t10 || $[26] !== validationMessageId) {
|
|
160
|
+
t11 = {
|
|
148
161
|
captionId,
|
|
149
162
|
disabled,
|
|
150
163
|
id,
|
|
151
164
|
required,
|
|
152
|
-
validationMessageId
|
|
165
|
+
validationMessageId,
|
|
166
|
+
isReferenced: t10,
|
|
167
|
+
labelId
|
|
153
168
|
};
|
|
154
|
-
$[
|
|
155
|
-
$[
|
|
156
|
-
$[
|
|
157
|
-
$[
|
|
158
|
-
$[
|
|
159
|
-
$[
|
|
169
|
+
$[20] = captionId;
|
|
170
|
+
$[21] = disabled;
|
|
171
|
+
$[22] = id;
|
|
172
|
+
$[23] = labelId;
|
|
173
|
+
$[24] = required;
|
|
174
|
+
$[25] = t10;
|
|
175
|
+
$[26] = validationMessageId;
|
|
176
|
+
$[27] = t11;
|
|
160
177
|
} else {
|
|
161
|
-
|
|
178
|
+
t11 = $[27];
|
|
162
179
|
}
|
|
163
|
-
const
|
|
180
|
+
const t12 = isChoiceInput || layout === "horizontal" ? /*#__PURE__*/jsx("div", {
|
|
164
181
|
ref: ref,
|
|
165
182
|
"data-has-leading-visual": slots.leadingVisual ? "" : undefined,
|
|
166
183
|
className: clsx(className, classes.ControlHorizontalLayout),
|
|
@@ -182,20 +199,20 @@ const FormControl = /*#__PURE__*/React.forwardRef((t0, ref) => {
|
|
|
182
199
|
children: slots.validation
|
|
183
200
|
}) : null, slots.caption]
|
|
184
201
|
});
|
|
185
|
-
let
|
|
186
|
-
if ($[
|
|
187
|
-
|
|
188
|
-
value:
|
|
189
|
-
children:
|
|
202
|
+
let t13;
|
|
203
|
+
if ($[28] !== T0 || $[29] !== t11 || $[30] !== t12) {
|
|
204
|
+
t13 = /*#__PURE__*/jsx(T0, {
|
|
205
|
+
value: t11,
|
|
206
|
+
children: t12
|
|
190
207
|
});
|
|
191
|
-
$[
|
|
192
|
-
$[
|
|
193
|
-
$[
|
|
194
|
-
$[
|
|
208
|
+
$[28] = T0;
|
|
209
|
+
$[29] = t11;
|
|
210
|
+
$[30] = t12;
|
|
211
|
+
$[31] = t13;
|
|
195
212
|
} else {
|
|
196
|
-
|
|
213
|
+
t13 = $[31];
|
|
197
214
|
}
|
|
198
|
-
return
|
|
215
|
+
return t13;
|
|
199
216
|
});
|
|
200
217
|
var FormControl$1 = Object.assign(FormControl, {
|
|
201
218
|
__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,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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