@ariakit/react-core 0.1.7 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +108 -0
- package/cjs/__chunks/{XFZ3MEQZ.cjs → 27JG67F3.cjs} +3 -3
- package/cjs/__chunks/{ASQZCUUA.cjs → 4SZYU2PD.cjs} +2 -2
- package/cjs/__chunks/5P6HRGY6.cjs +21 -0
- package/cjs/__chunks/{DCDTT7UY.cjs → A6ZSQXNQ.cjs} +2 -2
- package/cjs/__chunks/{QXXZLOZG.cjs → D3EUPD6P.cjs} +22 -41
- package/cjs/__chunks/{EEXWIKOB.cjs → GOXUG4RX.cjs} +41 -53
- package/cjs/__chunks/{RHO5OVPE.cjs → GRL5KGV3.cjs} +2 -2
- package/cjs/__chunks/MHL3EECX.cjs +363 -0
- package/cjs/__chunks/{AUDANYMJ.cjs → W2XKIB23.cjs} +1 -20
- package/cjs/__chunks/{PFD4TS6B.cjs → WWDX5YPG.cjs} +28 -15
- package/cjs/combobox/combobox-item.cjs +1 -1
- package/cjs/combobox/combobox-popover.cjs +12 -11
- package/cjs/combobox/combobox-store.cjs +3 -3
- package/cjs/combobox/combobox-store.d.ts +0 -7
- package/cjs/combobox/combobox.cjs +3 -3
- package/cjs/composite/composite-item.cjs +1 -1
- package/cjs/composite/composite-overflow-disclosure.cjs +5 -5
- package/cjs/composite/composite-overflow-store.cjs +3 -3
- package/cjs/composite/composite-overflow-store.d.ts +1 -13
- package/cjs/composite/composite-overflow.cjs +12 -11
- package/cjs/composite/composite.cjs +3 -3
- package/cjs/dialog/dialog-backdrop.cjs +6 -3
- package/cjs/dialog/dialog-backdrop.d.ts +2 -5
- package/cjs/dialog/dialog-dismiss.cjs +1 -1
- package/cjs/dialog/dialog.cjs +11 -10
- package/cjs/dialog/dialog.d.ts +21 -8
- package/cjs/dialog/utils/is-backdrop.cjs +21 -0
- package/cjs/dialog/utils/is-backdrop.d.ts +1 -0
- package/cjs/form/form-radio.cjs +1 -1
- package/cjs/heading/heading-level.d.ts +1 -1
- package/cjs/hovercard/hovercard-dismiss.cjs +1 -1
- package/cjs/hovercard/hovercard-store.cjs +3 -3
- package/cjs/hovercard/hovercard-store.d.ts +1 -13
- package/cjs/hovercard/hovercard.cjs +13 -12
- package/cjs/menu/menu-bar.cjs +3 -3
- package/cjs/menu/menu-button.cjs +8 -8
- package/cjs/menu/menu-dismiss.cjs +1 -1
- package/cjs/menu/menu-item-checkbox.cjs +1 -1
- package/cjs/menu/menu-item-radio.cjs +1 -1
- package/cjs/menu/menu-item.cjs +1 -1
- package/cjs/menu/menu-list.cjs +4 -4
- package/cjs/menu/menu-store.cjs +7 -7
- package/cjs/menu/menu-store.d.ts +0 -7
- package/cjs/menu/menu.cjs +21 -20
- package/cjs/popover/popover-disclosure.cjs +4 -4
- package/cjs/popover/popover-dismiss.cjs +1 -1
- package/cjs/popover/popover-store.cjs +2 -2
- package/cjs/popover/popover-store.d.ts +1 -13
- package/cjs/popover/popover.cjs +12 -11
- package/cjs/popover/popover.d.ts +96 -0
- package/cjs/portal/portal.cjs +2 -2
- package/cjs/radio/radio-group.cjs +3 -3
- package/cjs/radio/radio.cjs +1 -1
- package/cjs/role/role.cjs +3 -14
- package/cjs/select/select-item.cjs +1 -1
- package/cjs/select/select-list.cjs +4 -4
- package/cjs/select/select-popover.cjs +21 -20
- package/cjs/select/select-store.cjs +3 -3
- package/cjs/select/select-store.d.ts +0 -7
- package/cjs/select/select.cjs +5 -5
- package/cjs/tab/tab-list.cjs +3 -3
- package/cjs/tab/tab-panel.cjs +3 -3
- package/cjs/tab/tab.cjs +1 -1
- package/cjs/toolbar/toolbar-container.cjs +1 -1
- package/cjs/toolbar/toolbar-input.cjs +1 -1
- package/cjs/toolbar/toolbar-item.cjs +1 -1
- package/cjs/toolbar/toolbar.cjs +3 -3
- package/cjs/tooltip/tooltip-anchor.cjs +58 -28
- package/cjs/tooltip/tooltip-anchor.d.ts +2 -18
- package/cjs/tooltip/tooltip-store.cjs +4 -3
- package/cjs/tooltip/tooltip-store.d.ts +5 -17
- package/cjs/tooltip/tooltip.cjs +66 -67
- package/cjs/tooltip/tooltip.d.ts +6 -25
- package/cjs/tsconfig.build.tsbuildinfo +1 -1
- package/dialog/utils/is-backdrop/package.json +7 -0
- package/esm/__chunks/{USCWE5QL.js → 2CA5JWPW.js} +28 -15
- package/esm/__chunks/5PIH3SMS.js +35 -0
- package/esm/__chunks/{PZK3B6LX.js → 776K5FXB.js} +1 -1
- package/esm/__chunks/{DQSQP4IL.js → GDDVBILZ.js} +1 -1
- package/esm/__chunks/{3L2YBPR3.js → HJWYYQGA.js} +1 -1
- package/esm/__chunks/{3FKA4P4C.js → K5R24MFH.js} +1 -1
- package/esm/__chunks/MLEIJKSM.js +363 -0
- package/esm/__chunks/{JXNLCNWG.js → MR75RQGW.js} +25 -44
- package/esm/__chunks/{TCX5FQUL.js → NAG6UD2X.js} +43 -55
- package/esm/__chunks/XIACQCPS.js +21 -0
- package/esm/combobox/combobox-item.js +1 -1
- package/esm/combobox/combobox-popover.js +11 -10
- package/esm/combobox/combobox-store.d.ts +0 -7
- package/esm/combobox/combobox-store.js +1 -1
- package/esm/combobox/combobox.js +2 -2
- package/esm/composite/composite-item.js +1 -1
- package/esm/composite/composite-overflow-disclosure.js +4 -4
- package/esm/composite/composite-overflow-store.d.ts +1 -13
- package/esm/composite/composite-overflow-store.js +1 -1
- package/esm/composite/composite-overflow.js +11 -10
- package/esm/composite/composite.js +2 -2
- package/esm/dialog/dialog-backdrop.d.ts +2 -5
- package/esm/dialog/dialog-backdrop.js +5 -2
- package/esm/dialog/dialog-dismiss.js +1 -1
- package/esm/dialog/dialog.d.ts +21 -8
- package/esm/dialog/dialog.js +10 -9
- package/esm/dialog/utils/is-backdrop.d.ts +1 -0
- package/esm/dialog/utils/is-backdrop.js +21 -0
- package/esm/form/form-radio.js +1 -1
- package/esm/heading/heading-level.d.ts +1 -1
- package/esm/hovercard/hovercard-dismiss.js +1 -1
- package/esm/hovercard/hovercard-store.d.ts +1 -13
- package/esm/hovercard/hovercard-store.js +2 -2
- package/esm/hovercard/hovercard.js +12 -11
- package/esm/menu/menu-bar.js +2 -2
- package/esm/menu/menu-button.js +7 -7
- package/esm/menu/menu-dismiss.js +1 -1
- package/esm/menu/menu-item-checkbox.js +1 -1
- package/esm/menu/menu-item-radio.js +1 -1
- package/esm/menu/menu-item.js +1 -1
- package/esm/menu/menu-list.js +3 -3
- package/esm/menu/menu-store.d.ts +0 -7
- package/esm/menu/menu-store.js +5 -5
- package/esm/menu/menu.js +20 -19
- package/esm/popover/popover-disclosure.js +3 -3
- package/esm/popover/popover-dismiss.js +1 -1
- package/esm/popover/popover-store.d.ts +1 -13
- package/esm/popover/popover-store.js +1 -1
- package/esm/popover/popover.d.ts +96 -0
- package/esm/popover/popover.js +11 -10
- package/esm/portal/portal.js +1 -1
- package/esm/radio/radio-group.js +2 -2
- package/esm/radio/radio.js +1 -1
- package/esm/role/role.js +4 -15
- package/esm/select/select-item.js +1 -1
- package/esm/select/select-list.js +3 -3
- package/esm/select/select-popover.js +19 -18
- package/esm/select/select-store.d.ts +0 -7
- package/esm/select/select-store.js +1 -1
- package/esm/select/select.js +4 -4
- package/esm/tab/tab-list.js +2 -2
- package/esm/tab/tab-panel.js +3 -3
- package/esm/tab/tab.js +1 -1
- package/esm/toolbar/toolbar-container.js +1 -1
- package/esm/toolbar/toolbar-input.js +1 -1
- package/esm/toolbar/toolbar-item.js +1 -1
- package/esm/toolbar/toolbar.js +2 -2
- package/esm/tooltip/tooltip-anchor.d.ts +2 -18
- package/esm/tooltip/tooltip-anchor.js +59 -29
- package/esm/tooltip/tooltip-store.d.ts +5 -17
- package/esm/tooltip/tooltip-store.js +6 -5
- package/esm/tooltip/tooltip.d.ts +6 -25
- package/esm/tooltip/tooltip.js +67 -68
- package/esm/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +7 -2
- package/cjs/__chunks/FU76FHC2.cjs +0 -125
- package/esm/__chunks/RVIGSXKO.js +0 -125
- package/esm/__chunks/SHGWT5HV.js +0 -54
- package/cjs/__chunks/{OV363CW6.cjs → BDJYHP43.cjs} +2 -2
- package/cjs/__chunks/{5I6IQHKQ.cjs → BIPONQXE.cjs} +2 -2
- package/esm/__chunks/{OY5YT7OV.js → RTOWJJVI.js} +3 -3
- package/esm/__chunks/{6O3TZMB4.js → U2KSDJ3W.js} +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,113 @@
|
|
|
1
1
|
# @ariakit/react-core
|
|
2
2
|
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- **BREAKING**: Moved props from the `usePopoverStore` hook to the `Popover` component: `fixed`, `gutter`, `shift`, `flip`, `slide`, `overlap`, `sameWidth`, `fitViewport`, `arrowPadding`, `overflowPadding`, `getAnchorRect`, `renderCallback` (renamed to `updatePosition`). ([#2279](https://github.com/ariakit/ariakit/pull/2279))
|
|
8
|
+
|
|
9
|
+
The exception is the `placement` prop that should still be passed to the store.
|
|
10
|
+
|
|
11
|
+
**Before**:
|
|
12
|
+
|
|
13
|
+
```jsx
|
|
14
|
+
const popover = usePopoverStore({
|
|
15
|
+
placement: "bottom",
|
|
16
|
+
fixed: true,
|
|
17
|
+
gutter: 8,
|
|
18
|
+
shift: 8,
|
|
19
|
+
flip: true,
|
|
20
|
+
slide: true,
|
|
21
|
+
overlap: true,
|
|
22
|
+
sameWidth: true,
|
|
23
|
+
fitViewport: true,
|
|
24
|
+
arrowPadding: 8,
|
|
25
|
+
overflowPadding: 8,
|
|
26
|
+
getAnchorRect: (anchor) => anchor?.getBoundingClientRect(),
|
|
27
|
+
renderCallback: (props) => props.defaultRenderCallback(),
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
<Popover store={popover} />;
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
**After**:
|
|
34
|
+
|
|
35
|
+
```jsx
|
|
36
|
+
const popover = usePopoverStore({ placement: "bottom" });
|
|
37
|
+
|
|
38
|
+
<Popover
|
|
39
|
+
store={popover}
|
|
40
|
+
fixed
|
|
41
|
+
gutter={8}
|
|
42
|
+
shift={8}
|
|
43
|
+
flip
|
|
44
|
+
slide
|
|
45
|
+
overlap
|
|
46
|
+
sameWidth
|
|
47
|
+
fitViewport
|
|
48
|
+
arrowPadding={8}
|
|
49
|
+
overflowPadding={8}
|
|
50
|
+
getAnchorRect={(anchor) => anchor?.getBoundingClientRect()}
|
|
51
|
+
updatePosition={(props) => props.updatePosition()}
|
|
52
|
+
/>;
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
This change affects all the hooks and components that use `usePopoverStore` and `Popover` underneath: `useComboboxStore`, `ComboboxPopover`, `useHovercardStore`, `Hovercard`, `useMenuStore`, `Menu`, `useSelectStore`, `SelectPopover`, `useTooltipStore`, `Tooltip`.
|
|
56
|
+
|
|
57
|
+
With this change, the underlying `@floating-ui/dom` dependency has been also moved to the `Popover` component, which means it can be lazy loaded. See the [Lazy Popover](https://ariakit.org/examples/popover-lazy) example.
|
|
58
|
+
|
|
59
|
+
- **BREAKING**: The backdrop element on the `Dialog` component is now rendered as a sibling rather than as a parent of the dialog. This should make it easier to animate them separately. ([#2407](https://github.com/ariakit/ariakit/pull/2407))
|
|
60
|
+
|
|
61
|
+
This might be a breaking change if you're relying on their parent/child relationship for styling purposes (for example, to position the dialog in the center of the backdrop). If that's the case, you can apply the following styles to the dialog to achieve the same effect:
|
|
62
|
+
|
|
63
|
+
```css
|
|
64
|
+
.dialog {
|
|
65
|
+
position: fixed;
|
|
66
|
+
inset: 1rem;
|
|
67
|
+
margin: auto;
|
|
68
|
+
height: fit-content;
|
|
69
|
+
max-height: calc(100vh - 2 * 1rem);
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
These styles work even if the dialog is a child of the backdrop, so you can use them regardless of whether you're upgrading to this version or not.
|
|
74
|
+
|
|
75
|
+
### Patch Changes
|
|
76
|
+
|
|
77
|
+
- Deprecated the `backdropProps` prop on the `Dialog` component. Use the `backdrop` prop instead. ([#2407](https://github.com/ariakit/ariakit/pull/2407))
|
|
78
|
+
|
|
79
|
+
- The `backdrop` prop on the `Dialog` component now accepts a JSX element as its value. ([#2407](https://github.com/ariakit/ariakit/pull/2407))
|
|
80
|
+
|
|
81
|
+
- The `Dialog` component will now wait for being unmounted before restoring the body scroll when the `hidden` prop is set to `false`. This should prevent the body scroll from being restored too early when the dialog is being animated out using third-party libraries like Framer Motion. ([#2407](https://github.com/ariakit/ariakit/pull/2407))
|
|
82
|
+
|
|
83
|
+
- The `Tooltip` component now defaults to use `aria-describedby` instead of `aria-labelledby`. ([#2279](https://github.com/ariakit/ariakit/pull/2279))
|
|
84
|
+
|
|
85
|
+
If you want to use the tooltip as a label for an anchor element, you can use the `type` prop on `useTooltipStore`:
|
|
86
|
+
|
|
87
|
+
```jsx
|
|
88
|
+
useTooltipStore({ type: "label" });
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
- The `Tooltip` component now supports mouse events. ([#2279](https://github.com/ariakit/ariakit/pull/2279))
|
|
92
|
+
|
|
93
|
+
It's now possible to hover over the tooltip without it disappearing, which makes it compliant with [WCAG 1.4.13](https://www.w3.org/WAI/WCAG21/Understanding/content-on-hover-or-focus.html).
|
|
94
|
+
|
|
95
|
+
- Fixed infinite loop on `Portal` with the `preserveTabOrder` prop set to `true` when the portalled element is placed right after its original position in the React tree. ([#2279](https://github.com/ariakit/ariakit/pull/2279))
|
|
96
|
+
|
|
97
|
+
- Updated dependencies: `@ariakit/core@0.2.0`.
|
|
98
|
+
|
|
99
|
+
## 0.1.8
|
|
100
|
+
|
|
101
|
+
### Patch Changes
|
|
102
|
+
|
|
103
|
+
- Fixed `DialogBackdrop` not including the `data-backdrop` attribute in the initial render, causing a flash of unstyled content when the dialog is initially open. ([#2369](https://github.com/ariakit/ariakit/pull/2369))
|
|
104
|
+
|
|
105
|
+
- Fixed `Dialog` calling `hideOnInteractOutside` twice when clicking on the backdrop. ([#2369](https://github.com/ariakit/ariakit/pull/2369))
|
|
106
|
+
|
|
107
|
+
- The built-in `DialogBackdrop` component is no longer focusable. ([#2369](https://github.com/ariakit/ariakit/pull/2369))
|
|
108
|
+
|
|
109
|
+
- Call `autoFocusOnHide` and `autoFocusOnShow` with a `null` argument when there's no element to focus or the element is not focusable. This allows users to specify a fallback element to focus on hide or show. ([#2369](https://github.com/ariakit/ariakit/pull/2369))
|
|
110
|
+
|
|
3
111
|
## 0.1.7
|
|
4
112
|
|
|
5
113
|
### Patch Changes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _W2XKIB23cjs = require('./W2XKIB23.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
var _F7HVNVHQcjs = require('./F7HVNVHQ.cjs');
|
|
@@ -12,10 +12,10 @@ var _6455U47Tcjs = require('./6455U47T.cjs');
|
|
|
12
12
|
// src/hovercard/hovercard-store.ts
|
|
13
13
|
var _hovercardstore = require('@ariakit/core/hovercard/hovercard-store'); var Core = _interopRequireWildcard(_hovercardstore);
|
|
14
14
|
function useHovercardStoreOptions(props) {
|
|
15
|
-
return
|
|
15
|
+
return _W2XKIB23cjs.usePopoverStoreOptions.call(void 0, props);
|
|
16
16
|
}
|
|
17
17
|
function useHovercardStoreProps(store, props) {
|
|
18
|
-
return
|
|
18
|
+
return _W2XKIB23cjs.usePopoverStoreProps.call(void 0, store, props);
|
|
19
19
|
}
|
|
20
20
|
function useHovercardStore(props = {}) {
|
|
21
21
|
const options = useHovercardStoreOptions(props);
|
|
@@ -6,7 +6,7 @@ var _HVQRVCAScjs = require('./HVQRVCAS.cjs');
|
|
|
6
6
|
var _RCGSDYWJcjs = require('./RCGSDYWJ.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _BIPONQXEcjs = require('./BIPONQXE.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
@@ -101,7 +101,7 @@ var useSelectList = _7NAIPZYNcjs.createHook.call(void 0,
|
|
|
101
101
|
const canFocusOnMove = store.useState(
|
|
102
102
|
(state) => state.open && !state.animating && focusOnMove
|
|
103
103
|
);
|
|
104
|
-
props =
|
|
104
|
+
props = _BIPONQXEcjs.useComposite.call(void 0, _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {
|
|
105
105
|
store
|
|
106
106
|
}, props), {
|
|
107
107
|
composite,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
var _7NAIPZYNcjs = require('./7NAIPZYN.cjs');
|
|
6
|
+
|
|
7
|
+
// src/role/role.ts
|
|
8
|
+
var useRole = _7NAIPZYNcjs.createHook.call(void 0, (props) => {
|
|
9
|
+
return props;
|
|
10
|
+
});
|
|
11
|
+
var Role = _7NAIPZYNcjs.createComponent.call(void 0, (props) => {
|
|
12
|
+
return _7NAIPZYNcjs.createElement.call(void 0, "div", props);
|
|
13
|
+
});
|
|
14
|
+
if (process.env.NODE_ENV !== "production") {
|
|
15
|
+
Role.displayName = "Role";
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
exports.useRole = useRole; exports.Role = Role;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
var _OLGMV24Ucjs = require('./OLGMV24U.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _MHL3EECXcjs = require('./MHL3EECX.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
@@ -282,7 +282,7 @@ var useHovercard = _7NAIPZYNcjs.createHook.call(void 0,
|
|
|
282
282
|
});
|
|
283
283
|
props = useAutoFocusOnHide(_6455U47Tcjs.__spreadValues.call(void 0, { store }, props));
|
|
284
284
|
props = useAutoFocusOnShow(_6455U47Tcjs.__spreadValues.call(void 0, { store, modal }, props));
|
|
285
|
-
props =
|
|
285
|
+
props = _MHL3EECXcjs.usePopover.call(void 0, _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {
|
|
286
286
|
hideOnEscape,
|
|
287
287
|
store,
|
|
288
288
|
modal,
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _CARNFZQTcjs = require('./CARNFZQT.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _5P6HRGY6cjs = require('./5P6HRGY6.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
+
var _EM2PMFEWcjs = require('./EM2PMFEW.cjs');
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
|
|
@@ -17,17 +18,13 @@ var _6455U47Tcjs = require('./6455U47T.cjs');
|
|
|
17
18
|
|
|
18
19
|
// src/dialog/dialog-backdrop.tsx
|
|
19
20
|
var _react = require('react');
|
|
20
|
-
var _events = require('@ariakit/core/utils/events');
|
|
21
21
|
var _misc = require('@ariakit/core/utils/misc');
|
|
22
22
|
var _jsxruntime = require('react/jsx-runtime');
|
|
23
23
|
function DialogBackdrop({
|
|
24
24
|
store,
|
|
25
25
|
backdrop,
|
|
26
26
|
backdropProps,
|
|
27
|
-
|
|
28
|
-
hideOnEscape = true,
|
|
29
|
-
hidden,
|
|
30
|
-
children
|
|
27
|
+
hidden
|
|
31
28
|
}) {
|
|
32
29
|
const ref = _react.useRef.call(void 0, null);
|
|
33
30
|
store = _react.useMemo.call(void 0,
|
|
@@ -48,47 +45,26 @@ function DialogBackdrop({
|
|
|
48
45
|
return;
|
|
49
46
|
backdrop2.style.zIndex = getComputedStyle(dialog).zIndex;
|
|
50
47
|
}, [contentElement]);
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
const previousMouseDownRef = _X2GXTE3Pcjs.usePreviousMouseDownRef.call(void 0, mounted);
|
|
55
|
-
const onClick = _NREUHWTUcjs.useEvent.call(void 0, (event) => {
|
|
56
|
-
onClickProp == null ? void 0 : onClickProp(event);
|
|
57
|
-
if (event.defaultPrevented)
|
|
58
|
-
return;
|
|
59
|
-
if (!_events.isSelfTarget.call(void 0, event))
|
|
60
|
-
return;
|
|
61
|
-
if (previousMouseDownRef.current !== event.currentTarget)
|
|
62
|
-
return;
|
|
63
|
-
if (!hideOnInteractOutsideProp(event))
|
|
64
|
-
return;
|
|
65
|
-
event.stopPropagation();
|
|
66
|
-
store.hide();
|
|
67
|
-
});
|
|
68
|
-
const onKeyDownProp = backdropProps == null ? void 0 : backdropProps.onKeyDown;
|
|
69
|
-
const hideOnEscapeProp = _NREUHWTUcjs.useBooleanEvent.call(void 0, hideOnEscape);
|
|
70
|
-
const onKeyDown = _NREUHWTUcjs.useEvent.call(void 0, (event) => {
|
|
71
|
-
onKeyDownProp == null ? void 0 : onKeyDownProp(event);
|
|
72
|
-
if (event.defaultPrevented)
|
|
73
|
-
return;
|
|
74
|
-
if (event.key !== "Escape")
|
|
75
|
-
return;
|
|
76
|
-
if (!_events.isSelfTarget.call(void 0, event))
|
|
48
|
+
_NREUHWTUcjs.useSafeLayoutEffect.call(void 0, () => {
|
|
49
|
+
const id = contentElement == null ? void 0 : contentElement.id;
|
|
50
|
+
if (!id)
|
|
77
51
|
return;
|
|
78
|
-
|
|
52
|
+
const backdrop2 = ref.current;
|
|
53
|
+
if (!backdrop2)
|
|
79
54
|
return;
|
|
80
|
-
|
|
81
|
-
});
|
|
55
|
+
return _CARNFZQTcjs.markAncestor.call(void 0, backdrop2, id);
|
|
56
|
+
}, [contentElement]);
|
|
57
|
+
backdropProps = _react.isValidElement.call(void 0, backdrop) ? _6455U47Tcjs.__spreadValues.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {
|
|
58
|
+
ref: "ref" in backdrop ? backdrop.ref : void 0
|
|
59
|
+
}, backdrop.props), backdropProps) : backdropProps;
|
|
82
60
|
const props = _EM2PMFEWcjs.useDisclosureContent.call(void 0, _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {
|
|
83
61
|
store,
|
|
84
62
|
id: void 0,
|
|
85
63
|
role: "presentation",
|
|
86
|
-
|
|
87
|
-
|
|
64
|
+
hidden,
|
|
65
|
+
"data-backdrop": (contentElement == null ? void 0 : contentElement.id) || ""
|
|
88
66
|
}, backdropProps), {
|
|
89
67
|
ref: _NREUHWTUcjs.useForkRef.call(void 0, backdropProps == null ? void 0 : backdropProps.ref, ref),
|
|
90
|
-
onClick,
|
|
91
|
-
onKeyDown,
|
|
92
68
|
style: _6455U47Tcjs.__spreadValues.call(void 0, {
|
|
93
69
|
position: "fixed",
|
|
94
70
|
top: 0,
|
|
@@ -97,8 +73,13 @@ function DialogBackdrop({
|
|
|
97
73
|
left: 0
|
|
98
74
|
}, backdropProps == null ? void 0 : backdropProps.style)
|
|
99
75
|
}));
|
|
76
|
+
if (!backdrop)
|
|
77
|
+
return null;
|
|
78
|
+
if (_react.isValidElement.call(void 0, backdrop)) {
|
|
79
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _5P6HRGY6cjs.Role, _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, props), { children: (props2) => _react.cloneElement.call(void 0, backdrop, props2) }));
|
|
80
|
+
}
|
|
100
81
|
const Component = typeof backdrop !== "boolean" ? backdrop || "div" : "div";
|
|
101
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
82
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _5P6HRGY6cjs.Role, _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, props), { as: Component }));
|
|
102
83
|
}
|
|
103
84
|
|
|
104
85
|
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _D3EUPD6Pcjs = require('./D3EUPD6P.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _O45IXGJWcjs = require('./O45IXGJW.cjs');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _TVZPJJTXcjs = require('./TVZPJJTX.cjs');
|
|
4
10
|
|
|
5
11
|
|
|
6
12
|
var _QRAQT522cjs = require('./QRAQT522.cjs');
|
|
@@ -18,30 +24,24 @@ var _W32FX7DMcjs = require('./W32FX7DM.cjs');
|
|
|
18
24
|
var _CARNFZQTcjs = require('./CARNFZQT.cjs');
|
|
19
25
|
|
|
20
26
|
|
|
21
|
-
var _O45IXGJWcjs = require('./O45IXGJW.cjs');
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
var _TVZPJJTXcjs = require('./TVZPJJTX.cjs');
|
|
25
|
-
|
|
26
|
-
|
|
27
27
|
var _GHWBKA6Hcjs = require('./GHWBKA6H.cjs');
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
var _SOPRUU56cjs = require('./SOPRUU56.cjs');
|
|
31
31
|
|
|
32
32
|
|
|
33
|
+
var _WWDX5YPGcjs = require('./WWDX5YPG.cjs');
|
|
33
34
|
|
|
34
35
|
|
|
35
|
-
var _N2VCZZLPcjs = require('./N2VCZZLP.cjs');
|
|
36
36
|
|
|
37
37
|
|
|
38
|
-
var
|
|
38
|
+
var _N2VCZZLPcjs = require('./N2VCZZLP.cjs');
|
|
39
39
|
|
|
40
40
|
|
|
41
|
-
var
|
|
41
|
+
var _EM2PMFEWcjs = require('./EM2PMFEW.cjs');
|
|
42
42
|
|
|
43
43
|
|
|
44
|
-
var
|
|
44
|
+
var _NVBNDB5Bcjs = require('./NVBNDB5B.cjs');
|
|
45
45
|
|
|
46
46
|
|
|
47
47
|
|
|
@@ -84,20 +84,12 @@ var _misc = require('@ariakit/core/utils/misc');
|
|
|
84
84
|
var _platform = require('@ariakit/core/utils/platform');
|
|
85
85
|
var _jsxruntime = require('react/jsx-runtime');
|
|
86
86
|
var isSafariBrowser = _platform.isSafari.call(void 0, );
|
|
87
|
-
function isBackdrop(dialog, element) {
|
|
88
|
-
const id = dialog.id;
|
|
89
|
-
if (!id)
|
|
90
|
-
return;
|
|
91
|
-
return element.getAttribute("data-backdrop") === id;
|
|
92
|
-
}
|
|
93
87
|
function isAlreadyFocusingAnotherElement(dialog) {
|
|
94
88
|
const activeElement = _dom.getActiveElement.call(void 0, );
|
|
95
89
|
if (!activeElement)
|
|
96
90
|
return false;
|
|
97
91
|
if (_dom.contains.call(void 0, dialog, activeElement))
|
|
98
92
|
return false;
|
|
99
|
-
if (isBackdrop(dialog, activeElement))
|
|
100
|
-
return false;
|
|
101
93
|
if (activeElement.hasAttribute("data-dialog"))
|
|
102
94
|
return false;
|
|
103
95
|
if (_focus.isFocusable.call(void 0, activeElement))
|
|
@@ -160,11 +152,15 @@ var useDialog = _7NAIPZYNcjs.createHook.call(void 0,
|
|
|
160
152
|
const open = store.useState("open");
|
|
161
153
|
const mounted = store.useState("mounted");
|
|
162
154
|
const contentElement = store.useState("contentElement");
|
|
163
|
-
|
|
155
|
+
const hiddenProp = props.hidden;
|
|
156
|
+
_QRAQT522cjs.usePreventBodyScroll.call(void 0,
|
|
157
|
+
store,
|
|
158
|
+
(mounted || hiddenProp === false) && preventBodyScroll
|
|
159
|
+
);
|
|
164
160
|
_E5VOJWDRcjs.useHideOnInteractOutside.call(void 0, store, hideOnInteractOutside);
|
|
165
161
|
const { wrapElement, nestedDialogs } = _NZYGNCZLcjs.useNestedDialogs.call(void 0, store);
|
|
166
162
|
props = _NREUHWTUcjs.useWrapElement.call(void 0, props, wrapElement, [wrapElement]);
|
|
167
|
-
|
|
163
|
+
_NREUHWTUcjs.useSafeLayoutEffect.call(void 0, () => {
|
|
168
164
|
if (!open)
|
|
169
165
|
return;
|
|
170
166
|
const dialog = ref.current;
|
|
@@ -285,7 +281,8 @@ var useDialog = _7NAIPZYNcjs.createHook.call(void 0,
|
|
|
285
281
|
// receives focus.
|
|
286
282
|
_focus.getFirstTabbableIn.call(void 0, contentElement, true, portal && preserveTabOrder) || // Finally, we fallback to the dialog element itself.
|
|
287
283
|
contentElement;
|
|
288
|
-
|
|
284
|
+
const isElementFocusable = _focus.isFocusable.call(void 0, element);
|
|
285
|
+
if (!autoFocusOnShowProp(isElementFocusable ? element : null))
|
|
289
286
|
return;
|
|
290
287
|
setAutoFocusEnabled(true);
|
|
291
288
|
element.focus();
|
|
@@ -321,9 +318,7 @@ var useDialog = _7NAIPZYNcjs.createHook.call(void 0,
|
|
|
321
318
|
return;
|
|
322
319
|
const { disclosureElement } = store.getState();
|
|
323
320
|
let element = getElementFromProp(finalFocus) || disclosureElement;
|
|
324
|
-
if (
|
|
325
|
-
return;
|
|
326
|
-
if (element.id) {
|
|
321
|
+
if (element == null ? void 0 : element.id) {
|
|
327
322
|
const doc = _dom.getDocument.call(void 0, element);
|
|
328
323
|
const selector = `[aria-activedescendant="${element.id}"]`;
|
|
329
324
|
const composite = doc.querySelector(selector);
|
|
@@ -331,7 +326,7 @@ var useDialog = _7NAIPZYNcjs.createHook.call(void 0,
|
|
|
331
326
|
element = composite;
|
|
332
327
|
}
|
|
333
328
|
}
|
|
334
|
-
if (!_focus.isFocusable.call(void 0, element)) {
|
|
329
|
+
if (element && !_focus.isFocusable.call(void 0, element)) {
|
|
335
330
|
const maybeParentDialog = _dom.closest.call(void 0, element, "[data-dialog]");
|
|
336
331
|
if (maybeParentDialog && maybeParentDialog.id) {
|
|
337
332
|
const doc = _dom.getDocument.call(void 0, maybeParentDialog);
|
|
@@ -342,15 +337,16 @@ var useDialog = _7NAIPZYNcjs.createHook.call(void 0,
|
|
|
342
337
|
}
|
|
343
338
|
}
|
|
344
339
|
}
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
return;
|
|
340
|
+
const isElementFocusable = element && _focus.isFocusable.call(void 0, element);
|
|
341
|
+
if (!isElementFocusable && retry) {
|
|
348
342
|
requestAnimationFrame(() => focusOnHide(false));
|
|
349
343
|
return;
|
|
350
344
|
}
|
|
351
|
-
if (!autoFocusOnHideProp(element))
|
|
345
|
+
if (!autoFocusOnHideProp(isElementFocusable ? element : null))
|
|
352
346
|
return;
|
|
353
|
-
|
|
347
|
+
if (!isElementFocusable)
|
|
348
|
+
return;
|
|
349
|
+
element == null ? void 0 : element.focus();
|
|
354
350
|
};
|
|
355
351
|
if (!open) {
|
|
356
352
|
return focusOnHide();
|
|
@@ -400,34 +396,26 @@ var useDialog = _7NAIPZYNcjs.createHook.call(void 0,
|
|
|
400
396
|
(element) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _SOPRUU56cjs.HeadingLevel, { level: modal ? 1 : void 0, children: element }),
|
|
401
397
|
[modal]
|
|
402
398
|
);
|
|
403
|
-
const hiddenProp = props.hidden;
|
|
404
399
|
props = _NREUHWTUcjs.useWrapElement.call(void 0,
|
|
405
400
|
props,
|
|
406
401
|
(element) => {
|
|
407
402
|
if (backdrop) {
|
|
408
|
-
return /* @__PURE__ */ _jsxruntime.
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
);
|
|
403
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
404
|
+
backdrop && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
405
|
+
_D3EUPD6Pcjs.DialogBackdrop,
|
|
406
|
+
{
|
|
407
|
+
store,
|
|
408
|
+
backdrop,
|
|
409
|
+
backdropProps,
|
|
410
|
+
hidden: hiddenProp
|
|
411
|
+
}
|
|
412
|
+
),
|
|
413
|
+
element
|
|
414
|
+
] });
|
|
420
415
|
}
|
|
421
416
|
return element;
|
|
422
417
|
},
|
|
423
|
-
[
|
|
424
|
-
store,
|
|
425
|
-
backdrop,
|
|
426
|
-
backdropProps,
|
|
427
|
-
hideOnInteractOutside,
|
|
428
|
-
hideOnEscape,
|
|
429
|
-
hiddenProp
|
|
430
|
-
]
|
|
418
|
+
[store, backdrop, backdropProps, hiddenProp]
|
|
431
419
|
);
|
|
432
420
|
const [headingId, setHeadingId] = _react.useState.call(void 0, );
|
|
433
421
|
const [descriptionId, setDescriptionId] = _react.useState.call(void 0, );
|
|
@@ -451,7 +439,7 @@ var useDialog = _7NAIPZYNcjs.createHook.call(void 0,
|
|
|
451
439
|
}));
|
|
452
440
|
props = _EM2PMFEWcjs.useDisclosureContent.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, { store }, props));
|
|
453
441
|
props = _NVBNDB5Bcjs.useFocusable.call(void 0, _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, props), { focusable }));
|
|
454
|
-
props =
|
|
442
|
+
props = _WWDX5YPGcjs.usePortal.call(void 0, _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, { portal }, props), { portalRef, preserveTabOrder }));
|
|
455
443
|
return props;
|
|
456
444
|
}
|
|
457
445
|
);
|
|
@@ -7,7 +7,7 @@ var _MPFAD3UKcjs = require('./MPFAD3UK.cjs');
|
|
|
7
7
|
var _HVQRVCAScjs = require('./HVQRVCAS.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _BIPONQXEcjs = require('./BIPONQXE.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
@@ -145,7 +145,7 @@ var useMenuList = _7NAIPZYNcjs.createHook.call(void 0,
|
|
|
145
145
|
"aria-orientation": orientation
|
|
146
146
|
}, props);
|
|
147
147
|
}
|
|
148
|
-
props =
|
|
148
|
+
props = _BIPONQXEcjs.useComposite.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, { store, composite }, props));
|
|
149
149
|
props = _HVQRVCAScjs.useCompositeTypeahead.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, { store }, props));
|
|
150
150
|
return props;
|
|
151
151
|
}
|