@wix/site-ui 1.185.0 → 1.187.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/dist/1763.js +836 -0
- package/dist/2205.js +26 -0
- package/dist/2445.js +470 -0
- package/dist/285.js +1 -1
- package/dist/3485.js +4 -3
- package/dist/4863.js +61 -0
- package/dist/{4388.js → 487.js} +5 -57
- package/dist/5992.js +5 -471
- package/dist/6046.js +2 -26
- package/dist/6089.js +6 -3
- package/dist/6270.js +5 -3
- package/dist/6535.js +2 -1
- package/dist/6588.js +2 -1
- package/dist/6882.js +8 -4
- package/dist/6917.js +55 -0
- package/dist/7871.js +1 -1
- package/dist/8052.js +2 -1
- package/dist/8106.js +3 -2
- package/dist/8171.js +1 -1
- package/dist/8750.js +3 -2
- package/dist/8960.js +1 -1
- package/dist/904.js +1 -1
- package/dist/9352.js +2 -2
- package/dist/{880.js → 9369.js} +2 -60
- package/dist/Accordion/index.js +1 -1
- package/dist/Avatar/index.js +2 -1
- package/dist/Checkbox/index.js +2 -1
- package/dist/Collapsible/index.js +1 -1
- package/dist/Combobox/index.js +3 -2
- package/dist/ContextMenu/index.js +2 -2
- package/dist/Drawer/index.js +10 -836
- package/dist/Field/index.js +2 -1
- package/dist/Menu/index.js +3 -2
- package/dist/NavigationMenu/index.js +6 -3
- package/dist/Popover/index.js +5 -3
- package/dist/PreviewCard/index.js +5 -3
- package/dist/Radio/index.js +2 -1
- package/dist/Select/index.js +6 -3
- package/dist/Tabs/index.js +2 -1
- package/dist/Toast/index.css +111 -0
- package/dist/Toast/index.d.ts +846 -0
- package/dist/Toast/index.js +1204 -0
- package/dist/Tooltip/index.js +5 -3
- package/dist/index.d.ts +501 -0
- package/dist/index.js +1 -0
- package/package.json +2 -2
- /package/dist/{5992.js.LICENSE.txt → 2445.js.LICENSE.txt} +0 -0
package/dist/2205.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { SafeReact } from "./6499.js";
|
|
2
|
+
import * as __rspack_external_react from "react";
|
|
3
|
+
let globalId = 0;
|
|
4
|
+
function useGlobalId(idOverride, prefix = 'mui') {
|
|
5
|
+
const [defaultId, setDefaultId] = __rspack_external_react.useState(idOverride);
|
|
6
|
+
const id = idOverride || defaultId;
|
|
7
|
+
__rspack_external_react.useEffect(()=>{
|
|
8
|
+
if (null == defaultId) {
|
|
9
|
+
globalId += 1;
|
|
10
|
+
setDefaultId(`${prefix}-${globalId}`);
|
|
11
|
+
}
|
|
12
|
+
}, [
|
|
13
|
+
defaultId,
|
|
14
|
+
prefix
|
|
15
|
+
]);
|
|
16
|
+
return id;
|
|
17
|
+
}
|
|
18
|
+
const maybeReactUseId = SafeReact.useId;
|
|
19
|
+
function useId(idOverride, prefix) {
|
|
20
|
+
if (void 0 !== maybeReactUseId) {
|
|
21
|
+
const reactId = maybeReactUseId();
|
|
22
|
+
return idOverride ?? (prefix ? `${prefix}-${reactId}` : reactId);
|
|
23
|
+
}
|
|
24
|
+
return useGlobalId(idOverride, prefix);
|
|
25
|
+
}
|
|
26
|
+
export { useId };
|
package/dist/2445.js
ADDED
|
@@ -0,0 +1,470 @@
|
|
|
1
|
+
/*! LICENSE: 2445.js.LICENSE.txt */
|
|
2
|
+
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
3
|
+
import "./4586.js";
|
|
4
|
+
import { NOOP, useRefWithInit, isReactVersionAtLeast, esm_formatErrorMessage } from "./8272.js";
|
|
5
|
+
import { useIsoLayoutEffect } from "./6499.js";
|
|
6
|
+
import { useStableCallback } from "./7541.js";
|
|
7
|
+
import * as __rspack_external_react from "react";
|
|
8
|
+
__webpack_require__.add({
|
|
9
|
+
"../../node_modules/use-sync-external-store/cjs/use-sync-external-store-with-selector.development.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
10
|
+
/**
|
|
11
|
+
* @license React
|
|
12
|
+
* use-sync-external-store-with-selector.development.js
|
|
13
|
+
*
|
|
14
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
15
|
+
*
|
|
16
|
+
* This source code is licensed under the MIT license found in the
|
|
17
|
+
* LICENSE file in the root directory of this source tree.
|
|
18
|
+
*/ "production" !== process.env.NODE_ENV && function() {
|
|
19
|
+
function is(x, y) {
|
|
20
|
+
return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
|
|
21
|
+
}
|
|
22
|
+
"u" > typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" == typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
23
|
+
var React = __webpack_require__("react?1096"), objectIs = "function" == typeof Object.is ? Object.is : is, useSyncExternalStore = React.useSyncExternalStore, useRef = React.useRef, useEffect = React.useEffect, useMemo = React.useMemo, useDebugValue = React.useDebugValue;
|
|
24
|
+
exports.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
|
|
25
|
+
var instRef = useRef(null);
|
|
26
|
+
if (null === instRef.current) {
|
|
27
|
+
var inst = {
|
|
28
|
+
hasValue: !1,
|
|
29
|
+
value: null
|
|
30
|
+
};
|
|
31
|
+
instRef.current = inst;
|
|
32
|
+
} else inst = instRef.current;
|
|
33
|
+
instRef = useMemo(function() {
|
|
34
|
+
function memoizedSelector(nextSnapshot) {
|
|
35
|
+
if (!hasMemo) {
|
|
36
|
+
hasMemo = !0;
|
|
37
|
+
memoizedSnapshot = nextSnapshot;
|
|
38
|
+
nextSnapshot = selector(nextSnapshot);
|
|
39
|
+
if (void 0 !== isEqual && inst.hasValue) {
|
|
40
|
+
var currentSelection = inst.value;
|
|
41
|
+
if (isEqual(currentSelection, nextSnapshot)) return memoizedSelection = currentSelection;
|
|
42
|
+
}
|
|
43
|
+
return memoizedSelection = nextSnapshot;
|
|
44
|
+
}
|
|
45
|
+
currentSelection = memoizedSelection;
|
|
46
|
+
if (objectIs(memoizedSnapshot, nextSnapshot)) return currentSelection;
|
|
47
|
+
var nextSelection = selector(nextSnapshot);
|
|
48
|
+
if (void 0 !== isEqual && isEqual(currentSelection, nextSelection)) return memoizedSnapshot = nextSnapshot, currentSelection;
|
|
49
|
+
memoizedSnapshot = nextSnapshot;
|
|
50
|
+
return memoizedSelection = nextSelection;
|
|
51
|
+
}
|
|
52
|
+
var hasMemo = !1, memoizedSnapshot, memoizedSelection, maybeGetServerSnapshot = void 0 === getServerSnapshot ? null : getServerSnapshot;
|
|
53
|
+
return [
|
|
54
|
+
function() {
|
|
55
|
+
return memoizedSelector(getSnapshot());
|
|
56
|
+
},
|
|
57
|
+
null === maybeGetServerSnapshot ? void 0 : function() {
|
|
58
|
+
return memoizedSelector(maybeGetServerSnapshot());
|
|
59
|
+
}
|
|
60
|
+
];
|
|
61
|
+
}, [
|
|
62
|
+
getSnapshot,
|
|
63
|
+
getServerSnapshot,
|
|
64
|
+
selector,
|
|
65
|
+
isEqual
|
|
66
|
+
]);
|
|
67
|
+
var value = useSyncExternalStore(subscribe, instRef[0], instRef[1]);
|
|
68
|
+
useEffect(function() {
|
|
69
|
+
inst.hasValue = !0;
|
|
70
|
+
inst.value = value;
|
|
71
|
+
}, [
|
|
72
|
+
value
|
|
73
|
+
]);
|
|
74
|
+
useDebugValue(value);
|
|
75
|
+
return value;
|
|
76
|
+
};
|
|
77
|
+
"u" > typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" == typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
78
|
+
}();
|
|
79
|
+
},
|
|
80
|
+
"../../node_modules/use-sync-external-store/cjs/use-sync-external-store-with-selector.production.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
81
|
+
/**
|
|
82
|
+
* @license React
|
|
83
|
+
* use-sync-external-store-with-selector.production.js
|
|
84
|
+
*
|
|
85
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
86
|
+
*
|
|
87
|
+
* This source code is licensed under the MIT license found in the
|
|
88
|
+
* LICENSE file in the root directory of this source tree.
|
|
89
|
+
*/ var React = __webpack_require__("react?1096");
|
|
90
|
+
function is(x, y) {
|
|
91
|
+
return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
|
|
92
|
+
}
|
|
93
|
+
var objectIs = "function" == typeof Object.is ? Object.is : is, useSyncExternalStore = React.useSyncExternalStore, useRef = React.useRef, useEffect = React.useEffect, useMemo = React.useMemo, useDebugValue = React.useDebugValue;
|
|
94
|
+
exports.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
|
|
95
|
+
var instRef = useRef(null);
|
|
96
|
+
if (null === instRef.current) {
|
|
97
|
+
var inst = {
|
|
98
|
+
hasValue: !1,
|
|
99
|
+
value: null
|
|
100
|
+
};
|
|
101
|
+
instRef.current = inst;
|
|
102
|
+
} else inst = instRef.current;
|
|
103
|
+
instRef = useMemo(function() {
|
|
104
|
+
function memoizedSelector(nextSnapshot) {
|
|
105
|
+
if (!hasMemo) {
|
|
106
|
+
hasMemo = !0;
|
|
107
|
+
memoizedSnapshot = nextSnapshot;
|
|
108
|
+
nextSnapshot = selector(nextSnapshot);
|
|
109
|
+
if (void 0 !== isEqual && inst.hasValue) {
|
|
110
|
+
var currentSelection = inst.value;
|
|
111
|
+
if (isEqual(currentSelection, nextSnapshot)) return memoizedSelection = currentSelection;
|
|
112
|
+
}
|
|
113
|
+
return memoizedSelection = nextSnapshot;
|
|
114
|
+
}
|
|
115
|
+
currentSelection = memoizedSelection;
|
|
116
|
+
if (objectIs(memoizedSnapshot, nextSnapshot)) return currentSelection;
|
|
117
|
+
var nextSelection = selector(nextSnapshot);
|
|
118
|
+
if (void 0 !== isEqual && isEqual(currentSelection, nextSelection)) return memoizedSnapshot = nextSnapshot, currentSelection;
|
|
119
|
+
memoizedSnapshot = nextSnapshot;
|
|
120
|
+
return memoizedSelection = nextSelection;
|
|
121
|
+
}
|
|
122
|
+
var hasMemo = !1, memoizedSnapshot, memoizedSelection, maybeGetServerSnapshot = void 0 === getServerSnapshot ? null : getServerSnapshot;
|
|
123
|
+
return [
|
|
124
|
+
function() {
|
|
125
|
+
return memoizedSelector(getSnapshot());
|
|
126
|
+
},
|
|
127
|
+
null === maybeGetServerSnapshot ? void 0 : function() {
|
|
128
|
+
return memoizedSelector(maybeGetServerSnapshot());
|
|
129
|
+
}
|
|
130
|
+
];
|
|
131
|
+
}, [
|
|
132
|
+
getSnapshot,
|
|
133
|
+
getServerSnapshot,
|
|
134
|
+
selector,
|
|
135
|
+
isEqual
|
|
136
|
+
]);
|
|
137
|
+
var value = useSyncExternalStore(subscribe, instRef[0], instRef[1]);
|
|
138
|
+
useEffect(function() {
|
|
139
|
+
inst.hasValue = !0;
|
|
140
|
+
inst.value = value;
|
|
141
|
+
}, [
|
|
142
|
+
value
|
|
143
|
+
]);
|
|
144
|
+
useDebugValue(value);
|
|
145
|
+
return value;
|
|
146
|
+
};
|
|
147
|
+
},
|
|
148
|
+
"../../node_modules/use-sync-external-store/with-selector.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
149
|
+
if ('production' === process.env.NODE_ENV) module.exports = __webpack_require__("../../node_modules/use-sync-external-store/cjs/use-sync-external-store-with-selector.production.js");
|
|
150
|
+
else module.exports = __webpack_require__("../../node_modules/use-sync-external-store/cjs/use-sync-external-store-with-selector.development.js");
|
|
151
|
+
},
|
|
152
|
+
"react?1096" (module) {
|
|
153
|
+
module.exports = __rspack_external_react;
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
function createAttribute(name) {
|
|
157
|
+
return `data-base-ui-${name}`;
|
|
158
|
+
}
|
|
159
|
+
const createSelector = (a, b, c, d, e, f, ...other)=>{
|
|
160
|
+
if (other.length > 0) throw new Error("production" !== process.env.NODE_ENV ? 'Unsupported number of selectors' : esm_formatErrorMessage(1));
|
|
161
|
+
let selector;
|
|
162
|
+
if (a && b && c && d && e && f) selector = (state, a1, a2, a3)=>{
|
|
163
|
+
const va = a(state, a1, a2, a3);
|
|
164
|
+
const vb = b(state, a1, a2, a3);
|
|
165
|
+
const vc = c(state, a1, a2, a3);
|
|
166
|
+
const vd = d(state, a1, a2, a3);
|
|
167
|
+
const ve = e(state, a1, a2, a3);
|
|
168
|
+
return f(va, vb, vc, vd, ve, a1, a2, a3);
|
|
169
|
+
};
|
|
170
|
+
else if (a && b && c && d && e) selector = (state, a1, a2, a3)=>{
|
|
171
|
+
const va = a(state, a1, a2, a3);
|
|
172
|
+
const vb = b(state, a1, a2, a3);
|
|
173
|
+
const vc = c(state, a1, a2, a3);
|
|
174
|
+
const vd = d(state, a1, a2, a3);
|
|
175
|
+
return e(va, vb, vc, vd, a1, a2, a3);
|
|
176
|
+
};
|
|
177
|
+
else if (a && b && c && d) selector = (state, a1, a2, a3)=>{
|
|
178
|
+
const va = a(state, a1, a2, a3);
|
|
179
|
+
const vb = b(state, a1, a2, a3);
|
|
180
|
+
const vc = c(state, a1, a2, a3);
|
|
181
|
+
return d(va, vb, vc, a1, a2, a3);
|
|
182
|
+
};
|
|
183
|
+
else if (a && b && c) selector = (state, a1, a2, a3)=>{
|
|
184
|
+
const va = a(state, a1, a2, a3);
|
|
185
|
+
const vb = b(state, a1, a2, a3);
|
|
186
|
+
return c(va, vb, a1, a2, a3);
|
|
187
|
+
};
|
|
188
|
+
else if (a && b) selector = (state, a1, a2, a3)=>{
|
|
189
|
+
const va = a(state, a1, a2, a3);
|
|
190
|
+
return b(va, a1, a2, a3);
|
|
191
|
+
};
|
|
192
|
+
else if (a) selector = a;
|
|
193
|
+
else throw new Error('Missing arguments');
|
|
194
|
+
return selector;
|
|
195
|
+
};
|
|
196
|
+
const hooks = [];
|
|
197
|
+
let currentInstance;
|
|
198
|
+
function getInstance() {
|
|
199
|
+
return currentInstance;
|
|
200
|
+
}
|
|
201
|
+
function register(hook) {
|
|
202
|
+
hooks.push(hook);
|
|
203
|
+
}
|
|
204
|
+
function fastComponent(fn) {
|
|
205
|
+
const FastComponent = (props, forwardedRef)=>{
|
|
206
|
+
const instance = useRefWithInit(createInstance).current;
|
|
207
|
+
let result;
|
|
208
|
+
try {
|
|
209
|
+
currentInstance = instance;
|
|
210
|
+
for (const hook of hooks)hook.before(instance);
|
|
211
|
+
result = fn(props, forwardedRef);
|
|
212
|
+
for (const hook of hooks)hook.after(instance);
|
|
213
|
+
instance.didInitialize = true;
|
|
214
|
+
} finally{
|
|
215
|
+
currentInstance = void 0;
|
|
216
|
+
}
|
|
217
|
+
return result;
|
|
218
|
+
};
|
|
219
|
+
FastComponent.displayName = fn.displayName || fn.name;
|
|
220
|
+
return FastComponent;
|
|
221
|
+
}
|
|
222
|
+
function fastComponentRef(fn) {
|
|
223
|
+
return /*#__PURE__*/ __rspack_external_react.forwardRef(fastComponent(fn));
|
|
224
|
+
}
|
|
225
|
+
function createInstance() {
|
|
226
|
+
return {
|
|
227
|
+
didInitialize: false
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
const use_sync_external_store = __webpack_require__("../../node_modules/use-sync-external-store/index.js");
|
|
231
|
+
const with_selector = __webpack_require__("../../node_modules/use-sync-external-store/with-selector.js");
|
|
232
|
+
const canUseRawUseSyncExternalStore = isReactVersionAtLeast(19);
|
|
233
|
+
const useStoreImplementation = canUseRawUseSyncExternalStore ? useStoreFast : useStoreLegacy;
|
|
234
|
+
function useStore(store, selector, a1, a2, a3) {
|
|
235
|
+
return useStoreImplementation(store, selector, a1, a2, a3);
|
|
236
|
+
}
|
|
237
|
+
function useStoreR19(store, selector, a1, a2, a3) {
|
|
238
|
+
const getSelection = __rspack_external_react.useCallback(()=>selector(store.getSnapshot(), a1, a2, a3), [
|
|
239
|
+
store,
|
|
240
|
+
selector,
|
|
241
|
+
a1,
|
|
242
|
+
a2,
|
|
243
|
+
a3
|
|
244
|
+
]);
|
|
245
|
+
return (0, use_sync_external_store.useSyncExternalStore)(store.subscribe, getSelection, getSelection);
|
|
246
|
+
}
|
|
247
|
+
register({
|
|
248
|
+
before (instance) {
|
|
249
|
+
instance.syncIndex = 0;
|
|
250
|
+
if (!instance.didInitialize) {
|
|
251
|
+
instance.syncTick = 1;
|
|
252
|
+
instance.syncHooks = [];
|
|
253
|
+
instance.didChangeStore = true;
|
|
254
|
+
instance.getSnapshot = ()=>{
|
|
255
|
+
let didChange = false;
|
|
256
|
+
for(let i = 0; i < instance.syncHooks.length; i += 1){
|
|
257
|
+
const hook = instance.syncHooks[i];
|
|
258
|
+
const value = hook.selector(hook.store.state, hook.a1, hook.a2, hook.a3);
|
|
259
|
+
if (hook.didChange || !Object.is(hook.value, value)) {
|
|
260
|
+
didChange = true;
|
|
261
|
+
hook.value = value;
|
|
262
|
+
hook.didChange = false;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
if (didChange) instance.syncTick += 1;
|
|
266
|
+
return instance.syncTick;
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
},
|
|
270
|
+
after (instance) {
|
|
271
|
+
if (instance.syncHooks.length > 0) {
|
|
272
|
+
if (instance.didChangeStore) {
|
|
273
|
+
instance.didChangeStore = false;
|
|
274
|
+
instance.subscribe = (onStoreChange)=>{
|
|
275
|
+
const stores = new Set();
|
|
276
|
+
for (const hook of instance.syncHooks)stores.add(hook.store);
|
|
277
|
+
const unsubscribes = [];
|
|
278
|
+
for (const store of stores)unsubscribes.push(store.subscribe(onStoreChange));
|
|
279
|
+
return ()=>{
|
|
280
|
+
for (const unsubscribe of unsubscribes)unsubscribe();
|
|
281
|
+
};
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
(0, use_sync_external_store.useSyncExternalStore)(instance.subscribe, instance.getSnapshot, instance.getSnapshot);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
function useStoreFast(store, selector, a1, a2, a3) {
|
|
289
|
+
const instance = getInstance();
|
|
290
|
+
if (!instance) return useStoreR19(store, selector, a1, a2, a3);
|
|
291
|
+
const index = instance.syncIndex;
|
|
292
|
+
instance.syncIndex += 1;
|
|
293
|
+
let hook;
|
|
294
|
+
if (instance.didInitialize) {
|
|
295
|
+
hook = instance.syncHooks[index];
|
|
296
|
+
if (hook.store !== store || hook.selector !== selector || !Object.is(hook.a1, a1) || !Object.is(hook.a2, a2) || !Object.is(hook.a3, a3)) {
|
|
297
|
+
if (hook.store !== store) instance.didChangeStore = true;
|
|
298
|
+
hook.store = store;
|
|
299
|
+
hook.selector = selector;
|
|
300
|
+
hook.a1 = a1;
|
|
301
|
+
hook.a2 = a2;
|
|
302
|
+
hook.a3 = a3;
|
|
303
|
+
hook.didChange = true;
|
|
304
|
+
}
|
|
305
|
+
} else {
|
|
306
|
+
hook = {
|
|
307
|
+
store,
|
|
308
|
+
selector,
|
|
309
|
+
a1,
|
|
310
|
+
a2,
|
|
311
|
+
a3,
|
|
312
|
+
value: selector(store.getSnapshot(), a1, a2, a3),
|
|
313
|
+
didChange: false
|
|
314
|
+
};
|
|
315
|
+
instance.syncHooks.push(hook);
|
|
316
|
+
}
|
|
317
|
+
return hook.value;
|
|
318
|
+
}
|
|
319
|
+
function useStoreLegacy(store, selector, a1, a2, a3) {
|
|
320
|
+
return (0, with_selector.useSyncExternalStoreWithSelector)(store.subscribe, store.getSnapshot, store.getSnapshot, (state)=>selector(state, a1, a2, a3));
|
|
321
|
+
}
|
|
322
|
+
class Store {
|
|
323
|
+
constructor(state){
|
|
324
|
+
this.state = state;
|
|
325
|
+
this.listeners = new Set();
|
|
326
|
+
this.updateTick = 0;
|
|
327
|
+
}
|
|
328
|
+
subscribe = (fn)=>{
|
|
329
|
+
this.listeners.add(fn);
|
|
330
|
+
return ()=>{
|
|
331
|
+
this.listeners.delete(fn);
|
|
332
|
+
};
|
|
333
|
+
};
|
|
334
|
+
getSnapshot = ()=>this.state;
|
|
335
|
+
setState(newState) {
|
|
336
|
+
if (this.state === newState) return;
|
|
337
|
+
this.state = newState;
|
|
338
|
+
this.updateTick += 1;
|
|
339
|
+
const currentTick = this.updateTick;
|
|
340
|
+
for (const listener of this.listeners){
|
|
341
|
+
if (currentTick !== this.updateTick) return;
|
|
342
|
+
listener(newState);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
update(changes) {
|
|
346
|
+
for(const key in changes)if (!Object.is(this.state[key], changes[key])) return void this.setState({
|
|
347
|
+
...this.state,
|
|
348
|
+
...changes
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
set(key, value) {
|
|
352
|
+
if (!Object.is(this.state[key], value)) this.setState({
|
|
353
|
+
...this.state,
|
|
354
|
+
[key]: value
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
notifyAll() {
|
|
358
|
+
const newState = {
|
|
359
|
+
...this.state
|
|
360
|
+
};
|
|
361
|
+
this.setState(newState);
|
|
362
|
+
}
|
|
363
|
+
use(selector, a1, a2, a3) {
|
|
364
|
+
return useStore(this, selector, a1, a2, a3);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
class ReactStore extends Store {
|
|
368
|
+
constructor(state, context = {}, selectors){
|
|
369
|
+
super(state);
|
|
370
|
+
this.context = context;
|
|
371
|
+
this.selectors = selectors;
|
|
372
|
+
}
|
|
373
|
+
useSyncedValue(key, value) {
|
|
374
|
+
__rspack_external_react.useDebugValue(key);
|
|
375
|
+
const store = this;
|
|
376
|
+
useIsoLayoutEffect(()=>{
|
|
377
|
+
if (store.state[key] !== value) store.set(key, value);
|
|
378
|
+
}, [
|
|
379
|
+
store,
|
|
380
|
+
key,
|
|
381
|
+
value
|
|
382
|
+
]);
|
|
383
|
+
}
|
|
384
|
+
useSyncedValueWithCleanup(key, value) {
|
|
385
|
+
const store = this;
|
|
386
|
+
useIsoLayoutEffect(()=>{
|
|
387
|
+
if (store.state[key] !== value) store.set(key, value);
|
|
388
|
+
return ()=>{
|
|
389
|
+
store.set(key, void 0);
|
|
390
|
+
};
|
|
391
|
+
}, [
|
|
392
|
+
store,
|
|
393
|
+
key,
|
|
394
|
+
value
|
|
395
|
+
]);
|
|
396
|
+
}
|
|
397
|
+
useSyncedValues(statePart) {
|
|
398
|
+
const store = this;
|
|
399
|
+
if ('production' !== process.env.NODE_ENV) {
|
|
400
|
+
__rspack_external_react.useDebugValue(statePart, (p)=>Object.keys(p));
|
|
401
|
+
const keys = __rspack_external_react.useRef(Object.keys(statePart)).current;
|
|
402
|
+
const nextKeys = Object.keys(statePart);
|
|
403
|
+
if (keys.length !== nextKeys.length || keys.some((key, index)=>key !== nextKeys[index])) console.error('ReactStore.useSyncedValues expects the same prop keys on every render. Keys should be stable.');
|
|
404
|
+
}
|
|
405
|
+
const dependencies = Object.values(statePart);
|
|
406
|
+
useIsoLayoutEffect(()=>{
|
|
407
|
+
store.update(statePart);
|
|
408
|
+
}, [
|
|
409
|
+
store,
|
|
410
|
+
...dependencies
|
|
411
|
+
]);
|
|
412
|
+
}
|
|
413
|
+
useControlledProp(key, controlled) {
|
|
414
|
+
__rspack_external_react.useDebugValue(key);
|
|
415
|
+
const store = this;
|
|
416
|
+
const isControlled = void 0 !== controlled;
|
|
417
|
+
useIsoLayoutEffect(()=>{
|
|
418
|
+
if (isControlled && !Object.is(store.state[key], controlled)) store.setState({
|
|
419
|
+
...store.state,
|
|
420
|
+
[key]: controlled
|
|
421
|
+
});
|
|
422
|
+
}, [
|
|
423
|
+
store,
|
|
424
|
+
key,
|
|
425
|
+
controlled,
|
|
426
|
+
isControlled
|
|
427
|
+
]);
|
|
428
|
+
if ('production' !== process.env.NODE_ENV) {
|
|
429
|
+
const cache = this.controlledValues ??= new Map();
|
|
430
|
+
if (!cache.has(key)) cache.set(key, isControlled);
|
|
431
|
+
const previouslyControlled = cache.get(key);
|
|
432
|
+
if (void 0 !== previouslyControlled && previouslyControlled !== isControlled) console.error(`A component is changing the ${isControlled ? '' : 'un'}controlled state of ${key.toString()} to be ${isControlled ? 'un' : ''}controlled. Elements should not switch from uncontrolled to controlled (or vice versa).`);
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
select(key, a1, a2, a3) {
|
|
436
|
+
const selector = this.selectors[key];
|
|
437
|
+
return selector(this.state, a1, a2, a3);
|
|
438
|
+
}
|
|
439
|
+
useState(key, a1, a2, a3) {
|
|
440
|
+
__rspack_external_react.useDebugValue(key);
|
|
441
|
+
return useStore(this, this.selectors[key], a1, a2, a3);
|
|
442
|
+
}
|
|
443
|
+
useContextCallback(key, fn) {
|
|
444
|
+
__rspack_external_react.useDebugValue(key);
|
|
445
|
+
const stableFunction = useStableCallback(fn ?? NOOP);
|
|
446
|
+
this.context[key] = stableFunction;
|
|
447
|
+
}
|
|
448
|
+
useStateSetter(key) {
|
|
449
|
+
const ref = __rspack_external_react.useRef(void 0);
|
|
450
|
+
if (void 0 === ref.current) ref.current = (value)=>{
|
|
451
|
+
this.set(key, value);
|
|
452
|
+
};
|
|
453
|
+
return ref.current;
|
|
454
|
+
}
|
|
455
|
+
observe(selector, listener) {
|
|
456
|
+
let selectFn;
|
|
457
|
+
selectFn = 'function' == typeof selector ? selector : this.selectors[selector];
|
|
458
|
+
let prevValue = selectFn(this.state);
|
|
459
|
+
listener(prevValue, prevValue, this);
|
|
460
|
+
return this.subscribe((nextState)=>{
|
|
461
|
+
const nextValue = selectFn(nextState);
|
|
462
|
+
if (!Object.is(prevValue, nextValue)) {
|
|
463
|
+
const oldValue = prevValue;
|
|
464
|
+
prevValue = nextValue;
|
|
465
|
+
listener(nextValue, oldValue, this);
|
|
466
|
+
}
|
|
467
|
+
});
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
export { ReactStore, Store, createAttribute, createSelector, fastComponent, fastComponentRef, useStore };
|
package/dist/285.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as __rspack_external_react from "react";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import { useId } from "./
|
|
3
|
+
import { useId } from "./2205.js";
|
|
4
4
|
import { useIsoLayoutEffect } from "./6499.js";
|
|
5
5
|
import { useRefWithInit } from "./8272.js";
|
|
6
6
|
function createEventEmitter() {
|
package/dist/3485.js
CHANGED
|
@@ -3,7 +3,7 @@ import { useMergedRefs, NOOP } from "./8272.js";
|
|
|
3
3
|
import { getWindow, isOverflowElement, getNodeName, isShadowRoot, isHTMLElement } from "./3829.js";
|
|
4
4
|
import { ownerDocument } from "./9829.js";
|
|
5
5
|
import { getTarget, contains, activeElement } from "./4549.js";
|
|
6
|
-
import { CLICK_TRIGGER_IDENTIFIER, FocusGuard_FocusGuard, focusable, getPreviousTabbable, isTabbable, isOutsideEvent, tabbable, usePortalContext, getNextTabbable } from "./
|
|
6
|
+
import { CLICK_TRIGGER_IDENTIFIER, FocusGuard_FocusGuard, focusable, getPreviousTabbable, isTabbable, isOutsideEvent, tabbable, usePortalContext, getNextTabbable } from "./487.js";
|
|
7
7
|
import { useStableCallback } from "./7541.js";
|
|
8
8
|
import { getFloatingFocusElement, isTypeableCombobox, isTypeableElement } from "./8758.js";
|
|
9
9
|
import { useValueAsRef } from "./4707.js";
|
|
@@ -13,8 +13,9 @@ import { useAnimationFrame, AnimationFrame } from "./8996.js";
|
|
|
13
13
|
import { stopEvent, isVirtualPointerEvent, isVirtualClick } from "./6330.js";
|
|
14
14
|
import { addEventListener } from "./4723.js";
|
|
15
15
|
import { mergeCleanups } from "./4495.js";
|
|
16
|
-
import {
|
|
17
|
-
import { resolveRef } from "./
|
|
16
|
+
import { createAttribute } from "./2445.js";
|
|
17
|
+
import { resolveRef } from "./9369.js";
|
|
18
|
+
import { getNodeChildren, getNodeAncestors } from "./5992.js";
|
|
18
19
|
import { isElementVisible } from "./3319.js";
|
|
19
20
|
import { createChangeEventDetails } from "./4768.js";
|
|
20
21
|
import { focusOut, triggerHover, outsidePress } from "./2418.js";
|
package/dist/4863.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { useIsoLayoutEffect } from "./6499.js";
|
|
2
|
+
import { AnimationFrame } from "./8996.js";
|
|
3
|
+
import * as __rspack_external_react from "react";
|
|
4
|
+
function useTransitionStatus(open, enableIdleState = false, deferEndingState = false) {
|
|
5
|
+
const [transitionStatus, setTransitionStatus] = __rspack_external_react.useState(open && enableIdleState ? 'idle' : void 0);
|
|
6
|
+
const [mounted, setMounted] = __rspack_external_react.useState(open);
|
|
7
|
+
if (open && !mounted) {
|
|
8
|
+
setMounted(true);
|
|
9
|
+
setTransitionStatus('starting');
|
|
10
|
+
}
|
|
11
|
+
if (!open && mounted && 'ending' !== transitionStatus && !deferEndingState) setTransitionStatus('ending');
|
|
12
|
+
if (!open && !mounted && 'ending' === transitionStatus) setTransitionStatus(void 0);
|
|
13
|
+
useIsoLayoutEffect(()=>{
|
|
14
|
+
if (!open && mounted && 'ending' !== transitionStatus && deferEndingState) {
|
|
15
|
+
const frame = AnimationFrame.request(()=>{
|
|
16
|
+
setTransitionStatus('ending');
|
|
17
|
+
});
|
|
18
|
+
return ()=>{
|
|
19
|
+
AnimationFrame.cancel(frame);
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
}, [
|
|
23
|
+
open,
|
|
24
|
+
mounted,
|
|
25
|
+
transitionStatus,
|
|
26
|
+
deferEndingState
|
|
27
|
+
]);
|
|
28
|
+
useIsoLayoutEffect(()=>{
|
|
29
|
+
if (!open || enableIdleState) return;
|
|
30
|
+
const frame = AnimationFrame.request(()=>{
|
|
31
|
+
setTransitionStatus(void 0);
|
|
32
|
+
});
|
|
33
|
+
return ()=>{
|
|
34
|
+
AnimationFrame.cancel(frame);
|
|
35
|
+
};
|
|
36
|
+
}, [
|
|
37
|
+
enableIdleState,
|
|
38
|
+
open
|
|
39
|
+
]);
|
|
40
|
+
useIsoLayoutEffect(()=>{
|
|
41
|
+
if (!open || !enableIdleState) return;
|
|
42
|
+
if (open && mounted && 'idle' !== transitionStatus) setTransitionStatus('starting');
|
|
43
|
+
const frame = AnimationFrame.request(()=>{
|
|
44
|
+
setTransitionStatus('idle');
|
|
45
|
+
});
|
|
46
|
+
return ()=>{
|
|
47
|
+
AnimationFrame.cancel(frame);
|
|
48
|
+
};
|
|
49
|
+
}, [
|
|
50
|
+
enableIdleState,
|
|
51
|
+
open,
|
|
52
|
+
mounted,
|
|
53
|
+
transitionStatus
|
|
54
|
+
]);
|
|
55
|
+
return {
|
|
56
|
+
mounted,
|
|
57
|
+
setMounted,
|
|
58
|
+
transitionStatus
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
export { useTransitionStatus };
|
package/dist/{4388.js → 487.js}
RENAMED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { stateAttributesMapping_TransitionStatusDataAttributes } from "./880.js";
|
|
3
2
|
import { useIsoLayoutEffect } from "./6499.js";
|
|
4
3
|
import { isSafari } from "./8971.js";
|
|
5
4
|
import { visuallyHidden } from "./8225.js";
|
|
@@ -7,9 +6,9 @@ import { isNode, getComputedStyle, getNodeName, isShadowRoot, isHTMLElement } fr
|
|
|
7
6
|
import { contains, activeElement } from "./4549.js";
|
|
8
7
|
import { isElementVisible } from "./3319.js";
|
|
9
8
|
import { ownerDocument } from "./9829.js";
|
|
10
|
-
import { createAttribute } from "./
|
|
9
|
+
import { createAttribute } from "./2445.js";
|
|
11
10
|
import { useRenderElement, EMPTY_OBJECT } from "./8272.js";
|
|
12
|
-
import { useId } from "./
|
|
11
|
+
import { useId } from "./2205.js";
|
|
13
12
|
import { useStableCallback } from "./7541.js";
|
|
14
13
|
import { mergeCleanups } from "./4495.js";
|
|
15
14
|
import { addEventListener } from "./4723.js";
|
|
@@ -17,59 +16,6 @@ import { createChangeEventDetails } from "./4768.js";
|
|
|
17
16
|
import { focusOut } from "./2418.js";
|
|
18
17
|
import * as __rspack_external_react from "react";
|
|
19
18
|
import * as __rspack_external_react_dom_7136dc57 from "react-dom";
|
|
20
|
-
let popupStateMapping_CommonPopupDataAttributes = function(CommonPopupDataAttributes) {
|
|
21
|
-
CommonPopupDataAttributes["open"] = "data-open";
|
|
22
|
-
CommonPopupDataAttributes["closed"] = "data-closed";
|
|
23
|
-
CommonPopupDataAttributes[CommonPopupDataAttributes["startingStyle"] = stateAttributesMapping_TransitionStatusDataAttributes.startingStyle] = "startingStyle";
|
|
24
|
-
CommonPopupDataAttributes[CommonPopupDataAttributes["endingStyle"] = stateAttributesMapping_TransitionStatusDataAttributes.endingStyle] = "endingStyle";
|
|
25
|
-
CommonPopupDataAttributes["anchorHidden"] = "data-anchor-hidden";
|
|
26
|
-
CommonPopupDataAttributes["side"] = "data-side";
|
|
27
|
-
CommonPopupDataAttributes["align"] = "data-align";
|
|
28
|
-
return CommonPopupDataAttributes;
|
|
29
|
-
}({});
|
|
30
|
-
let popupStateMapping_CommonTriggerDataAttributes = /*#__PURE__*/ function(CommonTriggerDataAttributes) {
|
|
31
|
-
CommonTriggerDataAttributes["popupOpen"] = "data-popup-open";
|
|
32
|
-
CommonTriggerDataAttributes["pressed"] = "data-pressed";
|
|
33
|
-
return CommonTriggerDataAttributes;
|
|
34
|
-
}({});
|
|
35
|
-
const TRIGGER_HOOK = {
|
|
36
|
-
[popupStateMapping_CommonTriggerDataAttributes.popupOpen]: ''
|
|
37
|
-
};
|
|
38
|
-
const PRESSABLE_TRIGGER_HOOK = {
|
|
39
|
-
[popupStateMapping_CommonTriggerDataAttributes.popupOpen]: '',
|
|
40
|
-
[popupStateMapping_CommonTriggerDataAttributes.pressed]: ''
|
|
41
|
-
};
|
|
42
|
-
const POPUP_OPEN_HOOK = {
|
|
43
|
-
[popupStateMapping_CommonPopupDataAttributes.open]: ''
|
|
44
|
-
};
|
|
45
|
-
const POPUP_CLOSED_HOOK = {
|
|
46
|
-
[popupStateMapping_CommonPopupDataAttributes.closed]: ''
|
|
47
|
-
};
|
|
48
|
-
const ANCHOR_HIDDEN_HOOK = {
|
|
49
|
-
[popupStateMapping_CommonPopupDataAttributes.anchorHidden]: ''
|
|
50
|
-
};
|
|
51
|
-
const triggerOpenStateMapping = {
|
|
52
|
-
open (value) {
|
|
53
|
-
if (value) return TRIGGER_HOOK;
|
|
54
|
-
return null;
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
const pressableTriggerOpenStateMapping = {
|
|
58
|
-
open (value) {
|
|
59
|
-
if (value) return PRESSABLE_TRIGGER_HOOK;
|
|
60
|
-
return null;
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
const popupStateMapping = {
|
|
64
|
-
open (value) {
|
|
65
|
-
if (value) return POPUP_OPEN_HOOK;
|
|
66
|
-
return POPUP_CLOSED_HOOK;
|
|
67
|
-
},
|
|
68
|
-
anchorHidden (value) {
|
|
69
|
-
if (value) return ANCHOR_HIDDEN_HOOK;
|
|
70
|
-
return null;
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
19
|
const FocusGuard_FocusGuard = /*#__PURE__*/ __rspack_external_react.forwardRef(function(props, ref) {
|
|
74
20
|
const [role, setRole] = __rspack_external_react.useState();
|
|
75
21
|
useIsoLayoutEffect(()=>{
|
|
@@ -244,7 +190,9 @@ const DISABLED_TRANSITIONS_STYLE = {
|
|
|
244
190
|
};
|
|
245
191
|
const CLICK_TRIGGER_IDENTIFIER = 'data-base-ui-click-trigger';
|
|
246
192
|
const BASE_UI_SWIPE_IGNORE_ATTRIBUTE = 'data-base-ui-swipe-ignore';
|
|
193
|
+
const LEGACY_SWIPE_IGNORE_ATTRIBUTE = 'data-swipe-ignore';
|
|
247
194
|
const BASE_UI_SWIPE_IGNORE_SELECTOR = `[${BASE_UI_SWIPE_IGNORE_ATTRIBUTE}]`;
|
|
195
|
+
const LEGACY_SWIPE_IGNORE_SELECTOR = `[${LEGACY_SWIPE_IGNORE_ATTRIBUTE}]`;
|
|
248
196
|
const DROPDOWN_COLLISION_AVOIDANCE = {
|
|
249
197
|
fallbackAxisSide: 'none'
|
|
250
198
|
};
|
|
@@ -415,4 +363,4 @@ const FloatingPortal_FloatingPortal = /*#__PURE__*/ __rspack_external_react.forw
|
|
|
415
363
|
});
|
|
416
364
|
});
|
|
417
365
|
if ("production" !== process.env.NODE_ENV) FloatingPortal_FloatingPortal.displayName = "FloatingPortal";
|
|
418
|
-
export { BASE_UI_SWIPE_IGNORE_SELECTOR, CLICK_TRIGGER_IDENTIFIER, DISABLED_TRANSITIONS_STYLE, DROPDOWN_COLLISION_AVOIDANCE, FloatingPortal_FloatingPortal, FocusGuard_FocusGuard, POPUP_COLLISION_AVOIDANCE, disableFocusInside, enableFocusInside, focusable, getNextTabbable, getPreviousTabbable, getTabbableAfterElement, getTabbableBeforeElement, isOutsideEvent, isTabbable, ownerVisuallyHidden,
|
|
366
|
+
export { BASE_UI_SWIPE_IGNORE_SELECTOR, CLICK_TRIGGER_IDENTIFIER, DISABLED_TRANSITIONS_STYLE, DROPDOWN_COLLISION_AVOIDANCE, FloatingPortal_FloatingPortal, FocusGuard_FocusGuard, LEGACY_SWIPE_IGNORE_SELECTOR, POPUP_COLLISION_AVOIDANCE, disableFocusInside, enableFocusInside, focusable, getNextTabbable, getPreviousTabbable, getTabbableAfterElement, getTabbableBeforeElement, isOutsideEvent, isTabbable, ownerVisuallyHidden, tabbable, useFloatingPortalNode, usePortalContext };
|