@plasmicapp/react-web 0.2.136 → 0.2.138
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/all.d.ts +49 -46
- package/dist/auth/PlasmicPageGuard.d.ts +7 -0
- package/dist/index-common.d.ts +2 -3
- package/dist/react-web.cjs.development.js +708 -1087
- package/dist/react-web.cjs.development.js.map +1 -1
- package/dist/react-web.cjs.production.min.js +1 -1
- package/dist/react-web.cjs.production.min.js.map +1 -1
- package/dist/react-web.esm.js +710 -1086
- package/dist/react-web.esm.js.map +1 -1
- package/dist/render/translation.d.ts +2 -1
- package/dist/states/graph.d.ts +23 -2
- package/dist/states/helpers.d.ts +7 -6
- package/dist/states/index.d.ts +4 -24
- package/dist/states/types.d.ts +24 -0
- package/dist/states/valtio.d.ts +2 -3
- package/dist/stories/UseDollarState.stories.d.ts +1 -0
- package/package.json +5 -6
- package/skinny/dist/auth/PlasmicPageGuard.d.ts +7 -0
- package/skinny/dist/index-common.d.ts +2 -3
- package/skinny/dist/index.js +393 -319
- package/skinny/dist/index.js.map +1 -1
- package/skinny/dist/plume/checkbox/index.js +1 -1
- package/skinny/dist/plume/menu/index.js +1 -1
- package/skinny/dist/plume/menu-button/index.js +1 -1
- package/skinny/dist/plume/select/index.js +1 -1
- package/skinny/dist/plume/switch/index.js +1 -1
- package/skinny/dist/render/translation.d.ts +2 -1
- package/skinny/dist/{ssr-b16a1854.js → ssr-f6caec06.js} +7 -6
- package/skinny/dist/ssr-f6caec06.js.map +1 -0
- package/skinny/dist/states/graph.d.ts +23 -2
- package/skinny/dist/states/helpers.d.ts +7 -6
- package/skinny/dist/states/index.d.ts +4 -24
- package/skinny/dist/states/types.d.ts +24 -0
- package/skinny/dist/states/valtio.d.ts +2 -3
- package/skinny/dist/stories/UseDollarState.stories.d.ts +1 -0
- package/skinny/dist/ssr-b16a1854.js.map +0 -1
package/dist/react-web.esm.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import classNames$1 from 'classnames';
|
|
2
|
-
import _get from 'dlv';
|
|
3
|
-
export { default as get } from 'dlv';
|
|
4
2
|
import * as React from 'react';
|
|
5
3
|
import React__default, { forwardRef, createElement, Fragment, isValidElement, useContext, createContext, useState, useRef, useMemo, useLayoutEffect, useEffect, useImperativeHandle, useCallback, cloneElement } from 'react';
|
|
4
|
+
import _get from 'dlv';
|
|
5
|
+
export { default as get } from 'dlv';
|
|
6
6
|
import ReactDOM__default, { createPortal } from 'react-dom';
|
|
7
7
|
import { PlasmicDataSourceContextProvider } from '@plasmicapp/data-sources-context';
|
|
8
8
|
export { PlasmicDataSourceContextProvider, useCurrentUser } from '@plasmicapp/data-sources-context';
|
|
@@ -10,8 +10,7 @@ import { SSRProvider, useIsSSR as useIsSSR$1 } from '@react-aria/ssr';
|
|
|
10
10
|
import { useFocusRing, useFocusable, FocusScope } from '@react-aria/focus';
|
|
11
11
|
import clone from 'clone';
|
|
12
12
|
import deepEqual from 'fast-deep-equal';
|
|
13
|
-
import { proxy,
|
|
14
|
-
import { subscribeKey } from 'valtio/utils';
|
|
13
|
+
import { proxy, useSnapshot, ref } from 'valtio';
|
|
15
14
|
import { useCheckbox as useCheckbox$1 } from '@react-aria/checkbox';
|
|
16
15
|
import { VisuallyHidden } from '@react-aria/visually-hidden';
|
|
17
16
|
import { useToggleState } from '@react-stately/toggle';
|
|
@@ -27,39 +26,57 @@ import { useSelectState } from '@react-stately/select';
|
|
|
27
26
|
import { useSwitch as useSwitch$1 } from '@react-aria/switch';
|
|
28
27
|
import { useOverlay, useOverlayPosition, DismissButton } from '@react-aria/overlays';
|
|
29
28
|
|
|
29
|
+
function PlasmicPageGuard(props) {
|
|
30
|
+
var children = props.children,
|
|
31
|
+
dataSourceCtxValue = props.dataSourceCtxValue,
|
|
32
|
+
validRoles = props.validRoles;
|
|
33
|
+
if (!dataSourceCtxValue || dataSourceCtxValue.isUserLoading) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
function canUserViewPage() {
|
|
37
|
+
if (!dataSourceCtxValue) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
if (!dataSourceCtxValue.user) {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
if (!("roleId" in dataSourceCtxValue.user)) {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
return validRoles.includes(dataSourceCtxValue.user.roleId);
|
|
47
|
+
}
|
|
48
|
+
if (!canUserViewPage()) {
|
|
49
|
+
return React__default.createElement("div", null, "You don't have access to this page");
|
|
50
|
+
}
|
|
51
|
+
return children;
|
|
52
|
+
}
|
|
53
|
+
|
|
30
54
|
function _extends() {
|
|
31
|
-
_extends = Object.assign
|
|
55
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
32
56
|
for (var i = 1; i < arguments.length; i++) {
|
|
33
57
|
var source = arguments[i];
|
|
34
|
-
|
|
35
58
|
for (var key in source) {
|
|
36
59
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
37
60
|
target[key] = source[key];
|
|
38
61
|
}
|
|
39
62
|
}
|
|
40
63
|
}
|
|
41
|
-
|
|
42
64
|
return target;
|
|
43
65
|
};
|
|
44
|
-
|
|
45
66
|
return _extends.apply(this, arguments);
|
|
46
67
|
}
|
|
47
|
-
|
|
48
68
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
49
69
|
if (source == null) return {};
|
|
50
70
|
var target = {};
|
|
51
71
|
var sourceKeys = Object.keys(source);
|
|
52
72
|
var key, i;
|
|
53
|
-
|
|
54
73
|
for (i = 0; i < sourceKeys.length; i++) {
|
|
55
74
|
key = sourceKeys[i];
|
|
56
75
|
if (excluded.indexOf(key) >= 0) continue;
|
|
57
76
|
target[key] = source[key];
|
|
58
77
|
}
|
|
59
|
-
|
|
60
78
|
return target;
|
|
61
79
|
}
|
|
62
|
-
|
|
63
80
|
function _unsupportedIterableToArray(o, minLen) {
|
|
64
81
|
if (!o) return;
|
|
65
82
|
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
@@ -68,19 +85,14 @@ function _unsupportedIterableToArray(o, minLen) {
|
|
|
68
85
|
if (n === "Map" || n === "Set") return Array.from(o);
|
|
69
86
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
70
87
|
}
|
|
71
|
-
|
|
72
88
|
function _arrayLikeToArray(arr, len) {
|
|
73
89
|
if (len == null || len > arr.length) len = arr.length;
|
|
74
|
-
|
|
75
90
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
76
|
-
|
|
77
91
|
return arr2;
|
|
78
92
|
}
|
|
79
|
-
|
|
80
93
|
function _createForOfIteratorHelperLoose(o, allowArrayLike) {
|
|
81
94
|
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
82
95
|
if (it) return (it = it.call(o)).next.bind(it);
|
|
83
|
-
|
|
84
96
|
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
85
97
|
if (it) o = it;
|
|
86
98
|
var i = 0;
|
|
@@ -94,7 +106,6 @@ function _createForOfIteratorHelperLoose(o, allowArrayLike) {
|
|
|
94
106
|
};
|
|
95
107
|
};
|
|
96
108
|
}
|
|
97
|
-
|
|
98
109
|
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
99
110
|
}
|
|
100
111
|
|
|
@@ -105,57 +116,44 @@ function pick(obj) {
|
|
|
105
116
|
if (Object.keys(obj).length === 0) {
|
|
106
117
|
return obj;
|
|
107
118
|
}
|
|
108
|
-
|
|
109
119
|
var res = {};
|
|
110
|
-
|
|
111
120
|
for (var _len = arguments.length, keys = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
112
121
|
keys[_key - 1] = arguments[_key];
|
|
113
122
|
}
|
|
114
|
-
|
|
115
123
|
for (var _i = 0, _keys = keys; _i < _keys.length; _i++) {
|
|
116
124
|
var key = _keys[_i];
|
|
117
|
-
|
|
118
125
|
if (key in obj) {
|
|
119
126
|
res[key] = obj[key];
|
|
120
127
|
}
|
|
121
128
|
}
|
|
122
|
-
|
|
123
129
|
return res;
|
|
124
130
|
}
|
|
125
131
|
function pickBy(obj, func) {
|
|
126
132
|
var res = {};
|
|
127
|
-
|
|
128
133
|
for (var _i2 = 0, _Object$entries = Object.entries(obj); _i2 < _Object$entries.length; _i2++) {
|
|
129
134
|
var _Object$entries$_i = _Object$entries[_i2],
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
135
|
+
key = _Object$entries$_i[0],
|
|
136
|
+
val = _Object$entries$_i[1];
|
|
133
137
|
if (func(key, val)) {
|
|
134
138
|
res[key] = obj[key];
|
|
135
139
|
}
|
|
136
140
|
}
|
|
137
|
-
|
|
138
141
|
return res;
|
|
139
142
|
}
|
|
140
143
|
function omit(obj) {
|
|
141
144
|
if (Object.keys(obj).length === 0) {
|
|
142
145
|
return obj;
|
|
143
146
|
}
|
|
144
|
-
|
|
145
147
|
var res = {};
|
|
146
|
-
|
|
147
148
|
for (var _len2 = arguments.length, keys = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
148
149
|
keys[_key2 - 1] = arguments[_key2];
|
|
149
150
|
}
|
|
150
|
-
|
|
151
151
|
for (var _i3 = 0, _Object$keys = Object.keys(obj); _i3 < _Object$keys.length; _i3++) {
|
|
152
152
|
var key = _Object$keys[_i3];
|
|
153
|
-
|
|
154
153
|
if (!keys.includes(key)) {
|
|
155
154
|
res[key] = obj[key];
|
|
156
155
|
}
|
|
157
156
|
}
|
|
158
|
-
|
|
159
157
|
return res;
|
|
160
158
|
}
|
|
161
159
|
function isSubset(a1, a2) {
|
|
@@ -167,19 +165,15 @@ function chainSingleArgFuncs() {
|
|
|
167
165
|
for (var _len3 = arguments.length, funcs = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
168
166
|
funcs[_key3] = arguments[_key3];
|
|
169
167
|
}
|
|
170
|
-
|
|
171
168
|
if (funcs.length === 0) {
|
|
172
169
|
return undefined;
|
|
173
170
|
}
|
|
174
|
-
|
|
175
171
|
return function (arg) {
|
|
176
172
|
var res = arg;
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
var func = _step.value;
|
|
173
|
+
for (var _i4 = 0, _funcs = funcs; _i4 < _funcs.length; _i4++) {
|
|
174
|
+
var func = _funcs[_i4];
|
|
180
175
|
res = func(res);
|
|
181
176
|
}
|
|
182
|
-
|
|
183
177
|
return res;
|
|
184
178
|
};
|
|
185
179
|
}
|
|
@@ -188,27 +182,22 @@ function isString(x) {
|
|
|
188
182
|
}
|
|
189
183
|
function groupBy(collection, keyFunc) {
|
|
190
184
|
var result = {};
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
var obj = _step2.value;
|
|
185
|
+
for (var _iterator = _createForOfIteratorHelperLoose(collection), _step; !(_step = _iterator()).done;) {
|
|
186
|
+
var obj = _step.value;
|
|
194
187
|
var key = keyFunc(obj);
|
|
195
|
-
|
|
196
188
|
if (key in result) {
|
|
197
189
|
result[key].push(obj);
|
|
198
190
|
} else {
|
|
199
191
|
result[key] = [obj];
|
|
200
192
|
}
|
|
201
193
|
}
|
|
202
|
-
|
|
203
194
|
return result;
|
|
204
195
|
}
|
|
205
196
|
function mapValues(obj, mapper) {
|
|
206
197
|
var result = {};
|
|
207
|
-
|
|
208
198
|
for (var key in obj) {
|
|
209
199
|
result[key] = mapper(obj[key]);
|
|
210
200
|
}
|
|
211
|
-
|
|
212
201
|
return result;
|
|
213
202
|
}
|
|
214
203
|
|
|
@@ -246,7 +235,6 @@ function ensureNotArray(children) {
|
|
|
246
235
|
* Flattens ReactNode into an array of ReactChild, but does NOT replace
|
|
247
236
|
* missing keys with array index, as React.Children.toArray() does.
|
|
248
237
|
*/
|
|
249
|
-
|
|
250
238
|
function toChildArray(children) {
|
|
251
239
|
if (isReactChild(children)) {
|
|
252
240
|
return [children];
|
|
@@ -269,32 +257,25 @@ function mergeProps(props) {
|
|
|
269
257
|
for (var _len = arguments.length, restProps = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
270
258
|
restProps[_key - 1] = arguments[_key];
|
|
271
259
|
}
|
|
272
|
-
|
|
273
260
|
if (restProps.every(function (rest) {
|
|
274
261
|
return Object.keys(rest).length === 0;
|
|
275
262
|
})) {
|
|
276
263
|
return props;
|
|
277
264
|
}
|
|
278
|
-
|
|
279
265
|
var result = _extends({}, props);
|
|
280
|
-
|
|
281
266
|
for (var _i = 0, _restProps = restProps; _i < _restProps.length; _i++) {
|
|
282
267
|
var rest = _restProps[_i];
|
|
283
|
-
|
|
284
268
|
for (var _i2 = 0, _Object$keys = Object.keys(rest); _i2 < _Object$keys.length; _i2++) {
|
|
285
269
|
var key = _Object$keys[_i2];
|
|
286
270
|
result[key] = mergePropVals(key, result[key], rest[key]);
|
|
287
271
|
}
|
|
288
272
|
}
|
|
289
|
-
|
|
290
273
|
return result;
|
|
291
274
|
}
|
|
292
|
-
|
|
293
275
|
function updateRef(ref, value) {
|
|
294
276
|
if (!ref) {
|
|
295
277
|
return;
|
|
296
278
|
}
|
|
297
|
-
|
|
298
279
|
if (typeof ref === "function") {
|
|
299
280
|
ref(value);
|
|
300
281
|
} else {
|
|
@@ -303,15 +284,13 @@ function updateRef(ref, value) {
|
|
|
303
284
|
}
|
|
304
285
|
}
|
|
305
286
|
}
|
|
306
|
-
|
|
307
287
|
function mergeRefs() {
|
|
308
288
|
for (var _len2 = arguments.length, refs = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
309
289
|
refs[_key2] = arguments[_key2];
|
|
310
290
|
}
|
|
311
|
-
|
|
312
291
|
return function (value) {
|
|
313
|
-
for (var
|
|
314
|
-
var ref =
|
|
292
|
+
for (var _i3 = 0, _refs = refs; _i3 < _refs.length; _i3++) {
|
|
293
|
+
var ref = _refs[_i3];
|
|
315
294
|
updateRef(ref, value);
|
|
316
295
|
}
|
|
317
296
|
};
|
|
@@ -342,15 +321,12 @@ function mergePropVals(name, val1, val2) {
|
|
|
342
321
|
// Special case for event handlers -- always call both handlers
|
|
343
322
|
return function () {
|
|
344
323
|
var res;
|
|
345
|
-
|
|
346
324
|
if (typeof val1 === "function") {
|
|
347
325
|
res = val1.apply(void 0, arguments);
|
|
348
326
|
}
|
|
349
|
-
|
|
350
327
|
if (typeof val2 === "function") {
|
|
351
328
|
res = val2.apply(void 0, arguments);
|
|
352
329
|
}
|
|
353
|
-
|
|
354
330
|
return res;
|
|
355
331
|
};
|
|
356
332
|
} else {
|
|
@@ -363,45 +339,36 @@ function getElementTypeName(element) {
|
|
|
363
339
|
return element.type;
|
|
364
340
|
} else {
|
|
365
341
|
var _ref, _ref2, _comp$displayName, _comp$render;
|
|
366
|
-
|
|
367
342
|
var comp = element.type;
|
|
368
343
|
return (_ref = (_ref2 = (_comp$displayName = comp.displayName) != null ? _comp$displayName : comp.name) != null ? _ref2 : (_comp$render = comp.render) == null ? void 0 : _comp$render.name) != null ? _ref : "Component";
|
|
369
344
|
}
|
|
370
345
|
}
|
|
371
346
|
|
|
372
347
|
var _excluded = ["children"],
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
348
|
+
_excluded2 = ["as", "hasGap"],
|
|
349
|
+
_excluded3 = ["hasGap"];
|
|
376
350
|
function renderStack(as, props, hasGap, ref) {
|
|
377
351
|
var children = props.children,
|
|
378
|
-
|
|
379
|
-
|
|
352
|
+
rest = _objectWithoutPropertiesLoose(props, _excluded);
|
|
380
353
|
var wrappedChildren = wrapFlexContainerChildren(children, hasGap != null ? hasGap : false);
|
|
381
354
|
return createElementWithChildren(as, _extends({
|
|
382
355
|
ref: ref
|
|
383
356
|
}, rest), wrappedChildren);
|
|
384
357
|
}
|
|
385
|
-
|
|
386
358
|
function FlexStack_(props, outerRef) {
|
|
387
359
|
var as = props.as,
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
360
|
+
hasGap = props.hasGap,
|
|
361
|
+
rest = _objectWithoutPropertiesLoose(props, _excluded2);
|
|
391
362
|
return renderStack(as != null ? as : "div", rest, hasGap, outerRef);
|
|
392
363
|
}
|
|
393
|
-
|
|
394
364
|
var FlexStack = /*#__PURE__*/forwardRef(FlexStack_);
|
|
395
|
-
|
|
396
365
|
var makeStackImpl = function makeStackImpl(as) {
|
|
397
366
|
return forwardRef(function (props, ref) {
|
|
398
367
|
var hasGap = props.hasGap,
|
|
399
|
-
|
|
400
|
-
|
|
368
|
+
rest = _objectWithoutPropertiesLoose(props, _excluded3);
|
|
401
369
|
return renderStack(as, rest, hasGap, ref);
|
|
402
370
|
});
|
|
403
371
|
};
|
|
404
|
-
|
|
405
372
|
var Stack = /*#__PURE__*/Object.assign(FlexStack, {
|
|
406
373
|
div: /*#__PURE__*/makeStackImpl("div"),
|
|
407
374
|
a: /*#__PURE__*/makeStackImpl("a"),
|
|
@@ -424,9 +391,7 @@ function hasVariant(variants, groupName, variant) {
|
|
|
424
391
|
if (variants == null) {
|
|
425
392
|
return false;
|
|
426
393
|
}
|
|
427
|
-
|
|
428
394
|
var groupVariants = variants[groupName];
|
|
429
|
-
|
|
430
395
|
if (groupVariants == null) {
|
|
431
396
|
return false;
|
|
432
397
|
} else if (groupVariants === true) {
|
|
@@ -447,7 +412,6 @@ function wrapFlexContainerChildren(children, hasGap) {
|
|
|
447
412
|
// will blow away the children tree and all state if we switch from having
|
|
448
413
|
// a wrapper and not.
|
|
449
414
|
var className = hasGap ? "__wab_flex-container" : "__wab_passthrough";
|
|
450
|
-
|
|
451
415
|
if (!children) {
|
|
452
416
|
return null;
|
|
453
417
|
} else if (Array.isArray(children)) {
|
|
@@ -460,21 +424,16 @@ function wrapFlexContainerChildren(children, hasGap) {
|
|
|
460
424
|
}, children);
|
|
461
425
|
}
|
|
462
426
|
}
|
|
463
|
-
|
|
464
427
|
function createPlasmicElement(override, defaultRoot, defaultProps, wrapChildrenInFlex) {
|
|
465
428
|
if (!override || Object.keys(override).length === 0) {
|
|
466
429
|
return createElementWithChildren(defaultRoot, defaultProps, defaultProps.children);
|
|
467
430
|
}
|
|
468
|
-
|
|
469
431
|
var override2 = deriveOverride(override);
|
|
470
432
|
var props = mergeOverrideProps(defaultProps, override2.props);
|
|
471
|
-
|
|
472
433
|
if (override2.type === "render") {
|
|
473
434
|
return override2.render(props, defaultRoot);
|
|
474
435
|
}
|
|
475
|
-
|
|
476
436
|
var root = defaultRoot;
|
|
477
|
-
|
|
478
437
|
if (override2.type === "as" && override2.as) {
|
|
479
438
|
if (defaultRoot === Stack) {
|
|
480
439
|
// If there was an "as" override specified, but the default type is
|
|
@@ -486,30 +445,23 @@ function createPlasmicElement(override, defaultRoot, defaultProps, wrapChildrenI
|
|
|
486
445
|
root = override2.as;
|
|
487
446
|
}
|
|
488
447
|
}
|
|
489
|
-
|
|
490
448
|
var children = props.children;
|
|
491
|
-
|
|
492
449
|
if (override2.wrapChildren) {
|
|
493
450
|
children = override2.wrapChildren(ensureNotArray(children));
|
|
494
451
|
}
|
|
495
|
-
|
|
496
452
|
if (wrapChildrenInFlex) {
|
|
497
453
|
// For legacy, we still support data-plasmic-wrap-flex-children
|
|
498
454
|
children = wrapFlexContainerChildren(children, true);
|
|
499
455
|
}
|
|
500
|
-
|
|
501
456
|
var result = createElementWithChildren(root, props, children);
|
|
502
|
-
|
|
503
457
|
if (override2.wrap) {
|
|
504
458
|
result = override2.wrap(result);
|
|
505
459
|
}
|
|
506
|
-
|
|
507
460
|
return result;
|
|
508
|
-
}
|
|
461
|
+
}
|
|
462
|
+
// We use data-plasmic-XXX attributes for custom properties since Typescript doesn't
|
|
509
463
|
// support type check on jsx pragma. See https://github.com/microsoft/TypeScript/issues/21699
|
|
510
464
|
// for more info.
|
|
511
|
-
|
|
512
|
-
|
|
513
465
|
var seenElements = /*#__PURE__*/new Map();
|
|
514
466
|
function createPlasmicElementProxy(defaultElement, props) {
|
|
515
467
|
// We use seenElements to keep track of elements that has been rendered by
|
|
@@ -526,78 +478,61 @@ function createPlasmicElementProxy(defaultElement, props) {
|
|
|
526
478
|
if (props == null) {
|
|
527
479
|
props = {};
|
|
528
480
|
}
|
|
529
|
-
|
|
530
481
|
var name = props["data-plasmic-name"];
|
|
531
482
|
var isRoot = props["data-plasmic-root"];
|
|
532
483
|
var forNodeName = props["data-plasmic-for-node"];
|
|
533
484
|
delete props["data-plasmic-name"];
|
|
534
485
|
delete props["data-plasmic-root"];
|
|
535
486
|
delete props["data-plasmic-for-node"];
|
|
536
|
-
|
|
537
487
|
for (var _len = arguments.length, children = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
538
488
|
children[_key - 2] = arguments[_key];
|
|
539
489
|
}
|
|
540
|
-
|
|
541
490
|
var element = createPlasmicElementFromJsx.apply(void 0, [defaultElement, props].concat(children));
|
|
542
|
-
|
|
543
491
|
if (name) {
|
|
544
492
|
seenElements.set(name, element);
|
|
545
493
|
}
|
|
546
|
-
|
|
547
494
|
if (isRoot) {
|
|
548
495
|
var _seenElements$get;
|
|
549
|
-
|
|
550
496
|
// If this is the root, and we requested a specific node by specifying data-plasmic-for-node,
|
|
551
497
|
// then return that node instead
|
|
552
|
-
var forNode = forNodeName ? (_seenElements$get = seenElements.get(forNodeName)) != null ? _seenElements$get : null : element;
|
|
553
|
-
|
|
498
|
+
var forNode = forNodeName ? (_seenElements$get = seenElements.get(forNodeName)) != null ? _seenElements$get : null : element;
|
|
499
|
+
// Clear out the seenElements map, as we're done rendering this Plasmic* component.
|
|
554
500
|
seenElements.clear();
|
|
555
501
|
return forNode;
|
|
556
502
|
}
|
|
557
|
-
|
|
558
503
|
return element;
|
|
559
504
|
}
|
|
560
|
-
|
|
561
505
|
function createPlasmicElementFromJsx(defaultElement, props) {
|
|
562
506
|
var _props$dataPlasmicT;
|
|
563
|
-
|
|
564
507
|
var override = props["data-plasmic-override"];
|
|
565
508
|
var wrapFlexChild = props["data-plasmic-wrap-flex-child"];
|
|
566
509
|
var triggerProps = (_props$dataPlasmicT = props["data-plasmic-trigger-props"]) != null ? _props$dataPlasmicT : [];
|
|
567
510
|
delete props["data-plasmic-override"];
|
|
568
511
|
delete props["data-plasmic-wrap-flex-child"];
|
|
569
512
|
delete props["data-plasmic-trigger-props"];
|
|
570
|
-
|
|
571
513
|
for (var _len2 = arguments.length, children = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
|
572
514
|
children[_key2 - 2] = arguments[_key2];
|
|
573
515
|
}
|
|
574
|
-
|
|
575
516
|
return createPlasmicElement(override, defaultElement, mergeProps.apply(void 0, [props, children.length === 0 ? {} : {
|
|
576
517
|
children: children.length === 1 ? children[0] : children
|
|
577
518
|
}].concat(triggerProps)), wrapFlexChild);
|
|
578
519
|
}
|
|
579
|
-
|
|
580
520
|
function makeFragment() {
|
|
581
521
|
for (var _len3 = arguments.length, children = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
582
522
|
children[_key3] = arguments[_key3];
|
|
583
523
|
}
|
|
584
|
-
|
|
585
524
|
return createElement.apply(React, [Fragment, {}].concat(children));
|
|
586
525
|
}
|
|
587
526
|
var UNSET = /*#__PURE__*/Symbol("UNSET");
|
|
588
|
-
|
|
589
527
|
function mergeOverrideProps(defaults, overrides) {
|
|
590
528
|
if (!overrides) {
|
|
591
529
|
return defaults;
|
|
592
530
|
}
|
|
593
|
-
|
|
594
531
|
var result = _extends({}, defaults);
|
|
595
|
-
|
|
596
532
|
for (var _i = 0, _Object$keys = Object.keys(overrides); _i < _Object$keys.length; _i++) {
|
|
597
533
|
var key = _Object$keys[_i];
|
|
598
534
|
var defaultVal = defaults[key];
|
|
599
535
|
var overrideVal = overrides[key];
|
|
600
|
-
|
|
601
536
|
if (overrideVal === UNSET) {
|
|
602
537
|
delete result[key];
|
|
603
538
|
} else {
|
|
@@ -608,14 +543,11 @@ function mergeOverrideProps(defaults, overrides) {
|
|
|
608
543
|
if (overrideVal == null && key !== "className" && key !== "style" && !(key.startsWith("on") && typeof defaultVal === "function")) {
|
|
609
544
|
overrideVal = NONE;
|
|
610
545
|
}
|
|
611
|
-
|
|
612
546
|
result[key] = mergePropVals(key, defaultVal, overrideVal);
|
|
613
547
|
}
|
|
614
548
|
}
|
|
615
|
-
|
|
616
549
|
return result;
|
|
617
550
|
}
|
|
618
|
-
|
|
619
551
|
function wrapWithClassName(element, className) {
|
|
620
552
|
var key = isValidElement(element) ? element.key || undefined : undefined;
|
|
621
553
|
return createElement("div", {
|
|
@@ -626,7 +558,6 @@ function wrapWithClassName(element, className) {
|
|
|
626
558
|
}
|
|
627
559
|
}, element);
|
|
628
560
|
}
|
|
629
|
-
|
|
630
561
|
function deriveOverride(x) {
|
|
631
562
|
if (!x) {
|
|
632
563
|
// undefined Binding is an empty Binding
|
|
@@ -666,9 +597,8 @@ function deriveOverride(x) {
|
|
|
666
597
|
props: {},
|
|
667
598
|
type: "default"
|
|
668
599
|
});
|
|
669
|
-
}
|
|
670
|
-
|
|
671
|
-
|
|
600
|
+
}
|
|
601
|
+
// Else, assume this is just a props object.
|
|
672
602
|
return {
|
|
673
603
|
type: "default",
|
|
674
604
|
props: x
|
|
@@ -679,68 +609,53 @@ function deriveOverride(x) {
|
|
|
679
609
|
render: x
|
|
680
610
|
};
|
|
681
611
|
}
|
|
682
|
-
|
|
683
612
|
throw new Error("Unexpected override: " + x);
|
|
684
613
|
}
|
|
685
|
-
|
|
686
614
|
function mergeVariants(v1, v2) {
|
|
687
615
|
if (!v1 || !v2) {
|
|
688
616
|
return v1 || v2 || {};
|
|
689
617
|
}
|
|
690
|
-
|
|
691
618
|
return _extends({}, v1, v2);
|
|
692
619
|
}
|
|
693
|
-
|
|
694
620
|
function mergeVariantsWithStates(variants, $state, linkedStates) {
|
|
695
621
|
return _extends({}, variants, Object.fromEntries(linkedStates.map(function (_ref) {
|
|
696
622
|
var variantGroup = _ref.variantGroup,
|
|
697
|
-
|
|
623
|
+
statePath = _ref.statePath;
|
|
698
624
|
return [variantGroup, _get($state, statePath)];
|
|
699
625
|
})));
|
|
700
626
|
}
|
|
701
|
-
|
|
702
627
|
function mergeArgs(a1, a2) {
|
|
703
628
|
if (!a1 || !a2) {
|
|
704
629
|
return a1 || a2 || {};
|
|
705
630
|
}
|
|
706
|
-
|
|
707
631
|
return _extends({}, a1, a2);
|
|
708
632
|
}
|
|
709
|
-
|
|
710
633
|
function mergeFlexOverrides(o1, o2) {
|
|
711
634
|
if (!o2) {
|
|
712
635
|
return o1;
|
|
713
636
|
}
|
|
714
|
-
|
|
715
637
|
var keys = Array.from(new Set([].concat(Object.keys(o1), Object.keys(o2))));
|
|
716
638
|
var merged = {};
|
|
717
|
-
|
|
718
639
|
for (var _i2 = 0, _keys = keys; _i2 < _keys.length; _i2++) {
|
|
719
640
|
var key = _keys[_i2];
|
|
720
641
|
merged[key] = mergeFlexOverride(o1[key], o2[key]);
|
|
721
642
|
}
|
|
722
|
-
|
|
723
643
|
return merged;
|
|
724
644
|
}
|
|
725
|
-
|
|
726
645
|
function mergeFlexOverride(fo1, fo2) {
|
|
727
646
|
var _o1$props, _ref2;
|
|
728
|
-
|
|
729
647
|
if (!fo1) {
|
|
730
648
|
return fo2;
|
|
731
649
|
}
|
|
732
|
-
|
|
733
650
|
if (!fo2) {
|
|
734
651
|
return fo1;
|
|
735
652
|
}
|
|
736
|
-
|
|
737
653
|
var o1 = deriveOverride(fo1);
|
|
738
654
|
var o2 = deriveOverride(fo2);
|
|
739
655
|
var wrap = chainSingleArgFuncs.apply(void 0, [o1.wrap, o2.wrap].filter(notNil));
|
|
740
|
-
var wrapChildren = chainSingleArgFuncs.apply(void 0, [o1.wrapChildren, o2.wrapChildren].filter(notNil));
|
|
741
|
-
|
|
656
|
+
var wrapChildren = chainSingleArgFuncs.apply(void 0, [o1.wrapChildren, o2.wrapChildren].filter(notNil));
|
|
657
|
+
// "render" type always takes precedence, but we still merge the props
|
|
742
658
|
var props = mergeOverrideProps((_o1$props = o1.props) != null ? _o1$props : {}, o2.props);
|
|
743
|
-
|
|
744
659
|
if (o2.type === "render") {
|
|
745
660
|
return {
|
|
746
661
|
render: o2.render,
|
|
@@ -749,7 +664,6 @@ function mergeFlexOverride(fo1, fo2) {
|
|
|
749
664
|
wrapChildren: wrapChildren
|
|
750
665
|
};
|
|
751
666
|
}
|
|
752
|
-
|
|
753
667
|
if (o1.type === "render") {
|
|
754
668
|
return {
|
|
755
669
|
render: o1.render,
|
|
@@ -757,9 +671,8 @@ function mergeFlexOverride(fo1, fo2) {
|
|
|
757
671
|
wrap: wrap,
|
|
758
672
|
wrapChildren: wrapChildren
|
|
759
673
|
};
|
|
760
|
-
}
|
|
761
|
-
|
|
762
|
-
|
|
674
|
+
}
|
|
675
|
+
// "as" will take precedence
|
|
763
676
|
var as = (_ref2 = o2.type === "as" ? o2.as : undefined) != null ? _ref2 : o1.type === "as" ? o1.as : undefined;
|
|
764
677
|
return _extends({
|
|
765
678
|
props: props,
|
|
@@ -769,26 +682,22 @@ function mergeFlexOverride(fo1, fo2) {
|
|
|
769
682
|
as: as
|
|
770
683
|
} : {});
|
|
771
684
|
}
|
|
772
|
-
|
|
773
685
|
function deriveRenderOpts(props, config) {
|
|
774
686
|
var name = config.name,
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
687
|
+
descendantNames = config.descendantNames,
|
|
688
|
+
internalVariantPropNames = config.internalVariantPropNames,
|
|
689
|
+
internalArgPropNames = config.internalArgPropNames;
|
|
778
690
|
var reservedPropNames = ["variants", "args", "overrides"];
|
|
779
691
|
var variants = mergeVariants(omit.apply(void 0, [pick.apply(void 0, [props].concat(internalVariantPropNames))].concat(reservedPropNames)), props.variants);
|
|
780
692
|
var args = mergeArgs(omit.apply(void 0, [pick.apply(void 0, [props].concat(internalArgPropNames))].concat(reservedPropNames)), props.args);
|
|
781
693
|
var overrides = mergeFlexOverrides(omit.apply(void 0, [pick.apply(void 0, [props].concat(descendantNames))].concat(internalArgPropNames, internalVariantPropNames, reservedPropNames)), props.overrides);
|
|
782
694
|
var leftoverProps = omit.apply(void 0, [props, "variants", "args", "overrides"].concat(descendantNames, internalVariantPropNames, internalArgPropNames));
|
|
783
|
-
|
|
784
695
|
if (Object.keys(leftoverProps).length > 0) {
|
|
785
696
|
var _mergeFlexOverrides;
|
|
786
|
-
|
|
787
697
|
overrides = mergeFlexOverrides(overrides, (_mergeFlexOverrides = {}, _mergeFlexOverrides[name] = {
|
|
788
698
|
props: leftoverProps
|
|
789
699
|
}, _mergeFlexOverrides));
|
|
790
700
|
}
|
|
791
|
-
|
|
792
701
|
return {
|
|
793
702
|
variants: variants,
|
|
794
703
|
args: args,
|
|
@@ -799,7 +708,6 @@ function deriveRenderOpts(props, config) {
|
|
|
799
708
|
var isDefaultValue = function isDefaultValue(val) {
|
|
800
709
|
return val === "PLEASE_RENDER_INSIDE_PROVIDER";
|
|
801
710
|
};
|
|
802
|
-
|
|
803
711
|
var seenDefaultVariants = {};
|
|
804
712
|
function ensureGlobalVariants(globalVariantValues) {
|
|
805
713
|
Object.entries(globalVariantValues).filter(function (_ref) {
|
|
@@ -808,7 +716,6 @@ function ensureGlobalVariants(globalVariantValues) {
|
|
|
808
716
|
}).forEach(function (_ref2) {
|
|
809
717
|
var key = _ref2[0];
|
|
810
718
|
globalVariantValues[key] = undefined;
|
|
811
|
-
|
|
812
719
|
if (!seenDefaultVariants[key] && process.env.NODE_ENV === "development") {
|
|
813
720
|
seenDefaultVariants[key] = true;
|
|
814
721
|
var providerName = "" + key[0].toUpperCase() + key.substring(1) + "Context.Provider";
|
|
@@ -821,15 +728,13 @@ function ensureGlobalVariants(globalVariantValues) {
|
|
|
821
728
|
var PlasmicHeadContext = /*#__PURE__*/createContext(undefined);
|
|
822
729
|
function PlasmicHead(props) {
|
|
823
730
|
var Head = useContext(PlasmicHeadContext);
|
|
824
|
-
|
|
825
731
|
if (!Head) {
|
|
826
|
-
console.warn("Plasmic: Head meta tags are being ignored. To make them work, pass a Head component into PlasmicRootProvider.");
|
|
827
|
-
|
|
732
|
+
console.warn("Plasmic: Head meta tags are being ignored. To make them work, pass a Head component into PlasmicRootProvider.");
|
|
733
|
+
// TODO: Link to doc about Head.
|
|
828
734
|
return null;
|
|
829
|
-
}
|
|
735
|
+
}
|
|
736
|
+
// Helmet does not support React.Fragments, so we need to use `[<meta />,
|
|
830
737
|
// <meta />]` instead of `<><meta /><meta /></>`.
|
|
831
|
-
|
|
832
|
-
|
|
833
738
|
return createElement(Head, null, props.image ? [createElement("meta", {
|
|
834
739
|
key: "twitter:card",
|
|
835
740
|
name: "twitter:card",
|
|
@@ -905,50 +810,46 @@ var plasmicHeadMeta = {
|
|
|
905
810
|
var _excluded$1 = ["PlasmicIconType"];
|
|
906
811
|
function PlasmicIcon(props) {
|
|
907
812
|
var PlasmicIconType = props.PlasmicIconType,
|
|
908
|
-
|
|
909
|
-
|
|
813
|
+
rest = _objectWithoutPropertiesLoose(props, _excluded$1);
|
|
910
814
|
return createElement(PlasmicIconType, Object.assign({}, rest));
|
|
911
815
|
}
|
|
912
816
|
|
|
913
817
|
var _excluded$2 = ["src", "className", "displayWidth", "displayHeight", "displayMinWidth", "displayMinHeight", "displayMaxWidth", "displayMaxHeight", "quality", "loader", "imgRef", "style", "loading"];
|
|
818
|
+
// Default image sizes to snap to
|
|
914
819
|
// TODO: make this configurable?
|
|
915
|
-
|
|
916
820
|
var IMG_SIZES = [16, 32, 48, 64, 96, 128, 256, 384];
|
|
917
821
|
var DEVICE_SIZES = [640, 750, 828, 1080, 1200, 1920, 2048, 3840];
|
|
918
822
|
var ALL_SIZES = /*#__PURE__*/[].concat(IMG_SIZES, DEVICE_SIZES);
|
|
919
823
|
var PlasmicImg = /*#__PURE__*/React__default.forwardRef(function PlasmicImg(props, outerRef) {
|
|
920
824
|
var src = props.src,
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
825
|
+
className = props.className,
|
|
826
|
+
displayWidth = props.displayWidth,
|
|
827
|
+
displayHeight = props.displayHeight,
|
|
828
|
+
displayMinWidth = props.displayMinWidth,
|
|
829
|
+
displayMinHeight = props.displayMinHeight,
|
|
830
|
+
displayMaxWidth = props.displayMaxWidth,
|
|
831
|
+
displayMaxHeight = props.displayMaxHeight,
|
|
832
|
+
quality = props.quality,
|
|
833
|
+
loader = props.loader,
|
|
834
|
+
imgRef = props.imgRef,
|
|
835
|
+
style = props.style,
|
|
836
|
+
loading = props.loading,
|
|
837
|
+
rest = _objectWithoutPropertiesLoose(props, _excluded$2);
|
|
935
838
|
var imgProps = Object.assign({}, rest, {
|
|
936
839
|
// Default loading to "lazy" if not specified (which is different from the
|
|
937
840
|
// html img, which defaults to eager!)
|
|
938
841
|
loading: loading != null ? loading : "lazy"
|
|
939
842
|
});
|
|
940
|
-
|
|
941
843
|
var _ref = typeof src === "string" || !src ? {
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
844
|
+
fullWidth: undefined,
|
|
845
|
+
fullHeight: undefined,
|
|
846
|
+
aspectRatio: undefined
|
|
847
|
+
} : src,
|
|
848
|
+
fullWidth = _ref.fullWidth,
|
|
849
|
+
fullHeight = _ref.fullHeight,
|
|
850
|
+
aspectRatio = _ref.aspectRatio;
|
|
851
|
+
var srcStr = src ? typeof src === "string" ? src : typeof src.src === "string" ? src.src : src.src.src : "";
|
|
852
|
+
// Assume external image if either dimension is null and use usual <img>
|
|
952
853
|
if (fullHeight == null || fullWidth == null) {
|
|
953
854
|
return React__default.createElement("img", Object.assign({
|
|
954
855
|
src: srcStr,
|
|
@@ -959,13 +860,10 @@ var PlasmicImg = /*#__PURE__*/React__default.forwardRef(function PlasmicImg(prop
|
|
|
959
860
|
ref: mergeRefs(imgRef, outerRef)
|
|
960
861
|
}));
|
|
961
862
|
}
|
|
962
|
-
|
|
963
863
|
if (isSvg(srcStr) && (displayHeight == null || displayHeight === "auto") && (displayWidth == null || displayWidth === "auto")) {
|
|
964
864
|
displayWidth = "100%";
|
|
965
865
|
}
|
|
966
|
-
|
|
967
866
|
var computedDisplayWidth = displayWidth;
|
|
968
|
-
|
|
969
867
|
if (fullWidth && fullHeight && (!displayWidth || displayWidth === "auto") && !!getPixelLength(displayHeight)) {
|
|
970
868
|
// If there's a pixel length specified for displayHeight but not displayWidth,
|
|
971
869
|
// then we can derive the pixel length for displayWidth. Having an explicit
|
|
@@ -978,10 +876,8 @@ var PlasmicImg = /*#__PURE__*/React__default.forwardRef(function PlasmicImg(prop
|
|
|
978
876
|
computedDisplayWidth = getPixelLength(displayHeight) * fullWidth / fullHeight;
|
|
979
877
|
}
|
|
980
878
|
}
|
|
981
|
-
|
|
982
879
|
var spacerWidth = fullWidth;
|
|
983
880
|
var spacerHeight = fullHeight;
|
|
984
|
-
|
|
985
881
|
if (aspectRatio && isFinite(aspectRatio) && isSvg(srcStr)) {
|
|
986
882
|
// For SVGs, fullWidth and fullHeight can be rounded values, which would
|
|
987
883
|
// cause some discrepancy between the actual aspect ratio and the aspect
|
|
@@ -990,25 +886,21 @@ var PlasmicImg = /*#__PURE__*/React__default.forwardRef(function PlasmicImg(prop
|
|
|
990
886
|
spacerWidth = DEFAULT_SVG_WIDTH;
|
|
991
887
|
spacerHeight = Math.round(spacerWidth / aspectRatio);
|
|
992
888
|
}
|
|
993
|
-
|
|
994
889
|
var _getWidths = getWidths(computedDisplayWidth, fullWidth, {
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
890
|
+
minWidth: displayMinWidth
|
|
891
|
+
}),
|
|
892
|
+
sizes = _getWidths.sizes,
|
|
893
|
+
widthDescs = _getWidths.widthDescs;
|
|
1000
894
|
var imageLoader = getImageLoader(loader);
|
|
1001
895
|
var spacerSvg = "<svg width=\"" + spacerWidth + "\" height=\"" + spacerHeight + "\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\"/>";
|
|
1002
896
|
var spacerSvgBase64 = typeof window === "undefined" ? Buffer.from(spacerSvg).toString("base64") : window.btoa(spacerSvg);
|
|
1003
|
-
|
|
1004
897
|
var wrapperStyle = _extends({}, style || {});
|
|
1005
|
-
|
|
1006
898
|
var spacerStyle = _extends({}, pick(style || {}, "objectFit", "objectPosition"));
|
|
1007
|
-
|
|
1008
899
|
if (displayWidth != null && displayWidth !== "auto") {
|
|
1009
900
|
// If width is set, set it on the wrapper along with min/max width
|
|
1010
901
|
// and just use `width: 100%` on the spacer
|
|
1011
|
-
spacerStyle.width = "100%";
|
|
902
|
+
spacerStyle.width = "100%";
|
|
903
|
+
// Rely on the styles set by `classname` on the wrapper:
|
|
1012
904
|
// wrapperStyle.width = displayWidth;
|
|
1013
905
|
// wrapperStyle.minWidth = displayMinWidth;
|
|
1014
906
|
// wrapperStyle.maxWidth = displayMaxWidth;
|
|
@@ -1022,32 +914,35 @@ var PlasmicImg = /*#__PURE__*/React__default.forwardRef(function PlasmicImg(prop
|
|
|
1022
914
|
// than it should.
|
|
1023
915
|
spacerStyle.width = displayWidth;
|
|
1024
916
|
wrapperStyle.width = "auto";
|
|
1025
|
-
|
|
1026
917
|
if (displayMinWidth) {
|
|
1027
|
-
spacerStyle.minWidth = "100%";
|
|
918
|
+
spacerStyle.minWidth = "100%";
|
|
919
|
+
// Rely on min-width set by `classname` on the wrapper:
|
|
1028
920
|
// wrapperStyle.minWidth = displayMinWidth;
|
|
1029
921
|
}
|
|
1030
922
|
|
|
1031
923
|
if (displayMaxWidth != null && displayMaxWidth !== "none") {
|
|
1032
|
-
spacerStyle.maxWidth = "100%";
|
|
924
|
+
spacerStyle.maxWidth = "100%";
|
|
925
|
+
// Rely on max-width set by `classname` on the wrapper:
|
|
1033
926
|
// wrapperStyle.maxWidth = displayMaxWidth;
|
|
1034
927
|
}
|
|
1035
928
|
}
|
|
1036
929
|
|
|
1037
930
|
if (displayHeight != null && displayHeight !== "auto") {
|
|
1038
|
-
spacerStyle.height = "100%";
|
|
931
|
+
spacerStyle.height = "100%";
|
|
932
|
+
// wrapperStyle.height = displayHeight;
|
|
1039
933
|
// wrapperStyle.minHeight = displayMinHeight;
|
|
1040
934
|
// wrapperStyle.maxHeight = displayMaxHeight;
|
|
1041
935
|
} else {
|
|
1042
936
|
spacerStyle.height = displayHeight;
|
|
1043
937
|
wrapperStyle.height = "auto";
|
|
1044
|
-
|
|
1045
938
|
if (displayMinHeight) {
|
|
1046
|
-
spacerStyle.minHeight = "100%";
|
|
939
|
+
spacerStyle.minHeight = "100%";
|
|
940
|
+
// wrapperStyle.minHeight = displayMinHeight;
|
|
1047
941
|
}
|
|
1048
942
|
|
|
1049
943
|
if (displayMaxHeight != null && displayMaxHeight !== "none") {
|
|
1050
|
-
spacerStyle.maxHeight = "100%";
|
|
944
|
+
spacerStyle.maxHeight = "100%";
|
|
945
|
+
// wrapperStyle.maxHeight = displayMaxHeight;
|
|
1051
946
|
}
|
|
1052
947
|
}
|
|
1053
948
|
|
|
@@ -1073,20 +968,19 @@ var PlasmicImg = /*#__PURE__*/React__default.forwardRef(function PlasmicImg(prop
|
|
|
1073
968
|
className: "__wab_img"
|
|
1074
969
|
}));
|
|
1075
970
|
});
|
|
1076
|
-
|
|
1077
971
|
function makePicture(opts) {
|
|
1078
972
|
// If imageLoader is undefined, then this renders to just a normal
|
|
1079
973
|
// <img />. Else it will render to a <picture> with a <source> for
|
|
1080
974
|
// webp, and srcSet/sizes set according to width requirements.
|
|
1081
975
|
var imageLoader = opts.imageLoader,
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
976
|
+
widthDescs = opts.widthDescs,
|
|
977
|
+
src = opts.src,
|
|
978
|
+
quality = opts.quality,
|
|
979
|
+
style = opts.style,
|
|
980
|
+
className = opts.className,
|
|
981
|
+
sizes = opts.sizes,
|
|
982
|
+
imgProps = opts.imgProps,
|
|
983
|
+
ref = opts.ref;
|
|
1090
984
|
return React__default.createElement("picture", {
|
|
1091
985
|
className: "__wab_picture"
|
|
1092
986
|
}, imageLoader && imageLoader.supportsUrl(src) && React__default.createElement("source", {
|
|
@@ -1122,21 +1016,16 @@ function makePicture(opts) {
|
|
|
1122
1016
|
})
|
|
1123
1017
|
})));
|
|
1124
1018
|
}
|
|
1125
|
-
|
|
1126
1019
|
var DEFAULT_SVG_WIDTH = 10000;
|
|
1127
|
-
|
|
1128
1020
|
function isSvg(src) {
|
|
1129
1021
|
return src.endsWith(".svg") || src.startsWith("data:image/svg");
|
|
1130
1022
|
}
|
|
1131
|
-
|
|
1132
1023
|
function getClosestPresetSize(width, fullWidth) {
|
|
1133
1024
|
var _ALL_SIZES$findIndex;
|
|
1134
|
-
|
|
1135
1025
|
var nextBiggerIndex = (_ALL_SIZES$findIndex = ALL_SIZES.findIndex(function (w) {
|
|
1136
1026
|
return w >= width;
|
|
1137
1027
|
})) != null ? _ALL_SIZES$findIndex : ALL_SIZES.length - 1;
|
|
1138
1028
|
var nextBigger = ALL_SIZES[nextBiggerIndex];
|
|
1139
|
-
|
|
1140
1029
|
if (nextBigger >= fullWidth) {
|
|
1141
1030
|
// If the requested width is larger than the fullWidth,
|
|
1142
1031
|
// we just use the original width instead. It's impossible
|
|
@@ -1149,19 +1038,15 @@ function getClosestPresetSize(width, fullWidth) {
|
|
|
1149
1038
|
// less than 48)
|
|
1150
1039
|
return undefined;
|
|
1151
1040
|
}
|
|
1152
|
-
|
|
1153
1041
|
return nextBigger;
|
|
1154
1042
|
}
|
|
1155
1043
|
/**
|
|
1156
1044
|
* Computes the appropriate srcSet and sizes to use
|
|
1157
1045
|
*/
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
1046
|
function getWidths(width, fullWidth, extra) {
|
|
1161
1047
|
var minWidth = extra == null ? void 0 : extra.minWidth;
|
|
1162
1048
|
var pixelWidth = getPixelLength(width);
|
|
1163
1049
|
var pixelMinWidth = getPixelLength(minWidth);
|
|
1164
|
-
|
|
1165
1050
|
if (pixelWidth != null && (!minWidth || pixelMinWidth != null)) {
|
|
1166
1051
|
// If there's an exact width, then we just need to display it at 1x and 2x density
|
|
1167
1052
|
return {
|
|
@@ -1174,14 +1059,12 @@ function getWidths(width, fullWidth, extra) {
|
|
|
1174
1059
|
}],
|
|
1175
1060
|
sizes: undefined
|
|
1176
1061
|
};
|
|
1177
|
-
}
|
|
1062
|
+
}
|
|
1063
|
+
// Otherwise we don't know what sizes we'll end up, so we just cap it at
|
|
1178
1064
|
// device width. TODO: do better!
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
1065
|
var usefulSizes = DEVICE_SIZES.filter(function (size) {
|
|
1182
1066
|
return !fullWidth || size < fullWidth;
|
|
1183
1067
|
});
|
|
1184
|
-
|
|
1185
1068
|
if (!!fullWidth && usefulSizes.length === 0) {
|
|
1186
1069
|
// image fullWidth is smaller than all device sizes. So all we can do
|
|
1187
1070
|
// is offer 1x
|
|
@@ -1193,7 +1076,6 @@ function getWidths(width, fullWidth, extra) {
|
|
|
1193
1076
|
sizes: undefined
|
|
1194
1077
|
};
|
|
1195
1078
|
}
|
|
1196
|
-
|
|
1197
1079
|
return {
|
|
1198
1080
|
widthDescs: usefulSizes.map(function (size) {
|
|
1199
1081
|
return {
|
|
@@ -1214,33 +1096,25 @@ function getWidths(width, fullWidth, extra) {
|
|
|
1214
1096
|
sizes: "100vw"
|
|
1215
1097
|
};
|
|
1216
1098
|
}
|
|
1217
|
-
|
|
1218
1099
|
function getPixelLength(length) {
|
|
1219
1100
|
if (length == null || length == "") {
|
|
1220
1101
|
return undefined;
|
|
1221
1102
|
}
|
|
1222
|
-
|
|
1223
1103
|
if (typeof length === "number") {
|
|
1224
1104
|
return length;
|
|
1225
1105
|
}
|
|
1226
|
-
|
|
1227
1106
|
var parsed = parseNumeric(length);
|
|
1228
|
-
|
|
1229
1107
|
if (parsed && (!parsed.units || parsed.units === "px")) {
|
|
1230
1108
|
return parsed.num;
|
|
1231
1109
|
}
|
|
1232
|
-
|
|
1233
1110
|
return undefined;
|
|
1234
1111
|
}
|
|
1235
|
-
|
|
1236
1112
|
function parseNumeric(val) {
|
|
1237
1113
|
// Parse strings like "30", "30px", "30%", "30px /* blah blah */"
|
|
1238
1114
|
var res = val.match(/^\s*(-?(?:\d+\.\d*|\d*\.\d+|\d+))\s*([a-z]*|%)\s*(?:\/\*.*)?$/i);
|
|
1239
|
-
|
|
1240
1115
|
if (res == null) {
|
|
1241
1116
|
return undefined;
|
|
1242
1117
|
}
|
|
1243
|
-
|
|
1244
1118
|
var num = res[1];
|
|
1245
1119
|
var units = res[2];
|
|
1246
1120
|
return {
|
|
@@ -1248,7 +1122,6 @@ function parseNumeric(val) {
|
|
|
1248
1122
|
units: units
|
|
1249
1123
|
};
|
|
1250
1124
|
}
|
|
1251
|
-
|
|
1252
1125
|
function getImageLoader(loader) {
|
|
1253
1126
|
if (loader == null) {
|
|
1254
1127
|
return undefined;
|
|
@@ -1258,14 +1131,12 @@ function getImageLoader(loader) {
|
|
|
1258
1131
|
return loader;
|
|
1259
1132
|
}
|
|
1260
1133
|
}
|
|
1261
|
-
|
|
1262
1134
|
var PLASMIC_IMAGE_LOADER = {
|
|
1263
1135
|
supportsUrl: function supportsUrl(src) {
|
|
1264
1136
|
return src.startsWith("https://img.plasmic.app") && !isSvg(src);
|
|
1265
1137
|
},
|
|
1266
1138
|
transformUrl: function transformUrl(opts) {
|
|
1267
1139
|
var _opts$quality;
|
|
1268
|
-
|
|
1269
1140
|
var params = [opts.width ? "w=" + opts.width : undefined, "q=" + ((_opts$quality = opts.quality) != null ? _opts$quality : 75), opts.format ? "f=" + opts.format : undefined].filter(function (x) {
|
|
1270
1141
|
return !!x;
|
|
1271
1142
|
});
|
|
@@ -1284,46 +1155,37 @@ var PlasmicLink = /*#__PURE__*/React__default.forwardRef(function PlasmicLink(pr
|
|
|
1284
1155
|
ref: ref
|
|
1285
1156
|
})));
|
|
1286
1157
|
}
|
|
1287
|
-
|
|
1288
1158
|
if (props.platform === "gatsby" && isInternalHref(props.href)) {
|
|
1289
1159
|
return React__default.createElement(props.component, _extends({}, omit(props, "component", "platform", "href"), {
|
|
1290
1160
|
to: props.href,
|
|
1291
1161
|
ref: ref
|
|
1292
1162
|
}));
|
|
1293
1163
|
}
|
|
1294
|
-
|
|
1295
1164
|
return React__default.createElement("a", Object.assign({}, omit(props, "component", "platform"), {
|
|
1296
1165
|
ref: ref
|
|
1297
1166
|
}));
|
|
1298
1167
|
});
|
|
1299
|
-
|
|
1300
1168
|
function isInternalHref(href) {
|
|
1301
1169
|
return /^\/(?!\/)/.test(href);
|
|
1302
1170
|
}
|
|
1303
1171
|
|
|
1304
1172
|
var PlasmicTranslatorContext = /*#__PURE__*/React__default.createContext(undefined);
|
|
1305
|
-
|
|
1306
1173
|
function isIterable(val) {
|
|
1307
1174
|
return val != null && typeof val[Symbol.iterator] === "function";
|
|
1308
1175
|
}
|
|
1309
|
-
|
|
1310
1176
|
function genTranslatableString(elt) {
|
|
1311
1177
|
var components = {};
|
|
1312
1178
|
var componentsCount = 0;
|
|
1313
|
-
|
|
1314
1179
|
var getText = function getText(node) {
|
|
1315
1180
|
if (!node) {
|
|
1316
1181
|
return "";
|
|
1317
1182
|
}
|
|
1318
|
-
|
|
1319
1183
|
if (typeof node === "number" || typeof node === "boolean" || typeof node === "string") {
|
|
1320
1184
|
return node.toString();
|
|
1321
1185
|
}
|
|
1322
|
-
|
|
1323
1186
|
if (typeof node !== "object") {
|
|
1324
1187
|
return "";
|
|
1325
1188
|
}
|
|
1326
|
-
|
|
1327
1189
|
if (Array.isArray(node) || isIterable(node)) {
|
|
1328
1190
|
return Array.from(node).map(function (child) {
|
|
1329
1191
|
return getText(child);
|
|
@@ -1331,18 +1193,15 @@ function genTranslatableString(elt) {
|
|
|
1331
1193
|
return !!child;
|
|
1332
1194
|
}).join("");
|
|
1333
1195
|
}
|
|
1334
|
-
|
|
1335
1196
|
var nodeChildren = hasKey(node, "props") && hasKey(node.props, "children") && node.props.children || hasKey(node, "children") && node.children || [];
|
|
1336
1197
|
var contents = "" + React__default.Children.toArray(nodeChildren).map(function (child) {
|
|
1337
1198
|
return getText(child);
|
|
1338
1199
|
}).filter(function (child) {
|
|
1339
1200
|
return !!child;
|
|
1340
1201
|
}).join("");
|
|
1341
|
-
|
|
1342
1202
|
if (React__default.isValidElement(node) && node.type === React__default.Fragment) {
|
|
1343
1203
|
return contents;
|
|
1344
1204
|
}
|
|
1345
|
-
|
|
1346
1205
|
var componentId = componentsCount + 1;
|
|
1347
1206
|
componentsCount++;
|
|
1348
1207
|
components[componentId] = React__default.isValidElement(node) ? React__default.cloneElement(node, {
|
|
@@ -1351,7 +1210,6 @@ function genTranslatableString(elt) {
|
|
|
1351
1210
|
}) : node;
|
|
1352
1211
|
return "<" + componentId + ">" + contents + "</" + componentId + ">";
|
|
1353
1212
|
};
|
|
1354
|
-
|
|
1355
1213
|
var str = getText(elt);
|
|
1356
1214
|
return {
|
|
1357
1215
|
str: str,
|
|
@@ -1360,33 +1218,28 @@ function genTranslatableString(elt) {
|
|
|
1360
1218
|
};
|
|
1361
1219
|
}
|
|
1362
1220
|
function Trans(_ref) {
|
|
1363
|
-
var
|
|
1364
|
-
|
|
1221
|
+
var transKey = _ref.transKey,
|
|
1222
|
+
children = _ref.children;
|
|
1365
1223
|
var _t = React__default.useContext(PlasmicTranslatorContext);
|
|
1366
|
-
|
|
1367
1224
|
if (!_t) {
|
|
1368
1225
|
warnNoTranslationFunctionAtMostOnce();
|
|
1369
1226
|
return children;
|
|
1370
1227
|
}
|
|
1371
|
-
|
|
1372
1228
|
var _genTranslatableStrin = genTranslatableString(children),
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
return _t(str, componentsCount > 0 ? {
|
|
1229
|
+
str = _genTranslatableStrin.str,
|
|
1230
|
+
components = _genTranslatableStrin.components,
|
|
1231
|
+
componentsCount = _genTranslatableStrin.componentsCount;
|
|
1232
|
+
return _t(transKey != null ? transKey : str, componentsCount > 0 ? {
|
|
1378
1233
|
components: components
|
|
1379
1234
|
} : undefined);
|
|
1380
1235
|
}
|
|
1381
1236
|
var hasWarned = false;
|
|
1382
|
-
|
|
1383
1237
|
function warnNoTranslationFunctionAtMostOnce() {
|
|
1384
1238
|
if (!hasWarned) {
|
|
1385
1239
|
console.warn("Using Plasmic Translation but no translation function has been provided");
|
|
1386
1240
|
hasWarned = true;
|
|
1387
1241
|
}
|
|
1388
1242
|
}
|
|
1389
|
-
|
|
1390
1243
|
function hasKey(v, key) {
|
|
1391
1244
|
return typeof v === "object" && v !== null && key in v;
|
|
1392
1245
|
}
|
|
@@ -1397,68 +1250,56 @@ function PlasmicSlot(props) {
|
|
|
1397
1250
|
}
|
|
1398
1251
|
function renderPlasmicSlot(opts) {
|
|
1399
1252
|
var as = opts.as,
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1253
|
+
defaultContents = opts.defaultContents,
|
|
1254
|
+
value = opts.value,
|
|
1255
|
+
rest = _objectWithoutPropertiesLoose(opts, _excluded$3);
|
|
1404
1256
|
var content = value === undefined ? defaultContents : value;
|
|
1405
|
-
|
|
1406
1257
|
if (!content || Array.isArray(content) && content.length === 0) {
|
|
1407
1258
|
return null;
|
|
1408
|
-
}
|
|
1259
|
+
}
|
|
1260
|
+
// If the content is a raw string, then we need to wrap the raw string
|
|
1409
1261
|
// into an element, in case the slot is inside a flex-gap
|
|
1410
1262
|
// container (you cannot apply margin to just a text node).
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
1263
|
var maybeString = maybeAsString(content);
|
|
1414
|
-
|
|
1415
1264
|
if (maybeString) {
|
|
1416
1265
|
content = createElement("span", {
|
|
1417
1266
|
className: "__wab_slot-string-wrapper"
|
|
1418
1267
|
}, maybeString);
|
|
1419
1268
|
}
|
|
1420
|
-
|
|
1421
1269
|
var nonEmptyProps = Object.keys(rest).filter(function (p) {
|
|
1422
1270
|
return !!rest[p];
|
|
1423
1271
|
});
|
|
1424
|
-
|
|
1425
1272
|
if (nonEmptyProps.length === 0) {
|
|
1426
1273
|
// No attrs to apply to the slot (which means the slot is unstyled), then
|
|
1427
1274
|
// just render the content directly; no need for style wrapper.
|
|
1428
1275
|
return createElement(Fragment, null, content);
|
|
1429
1276
|
}
|
|
1430
|
-
|
|
1431
1277
|
return createElement(as || "span", mergeProps({
|
|
1432
1278
|
className: "__wab_slot"
|
|
1433
1279
|
}, rest), content);
|
|
1434
1280
|
}
|
|
1435
|
-
|
|
1436
1281
|
function maybeAsString(node) {
|
|
1437
1282
|
// Unwrap fragments
|
|
1438
|
-
if (isValidElement(node) && (
|
|
1283
|
+
if (isValidElement(node) && (
|
|
1284
|
+
// Fragment and Trans don't render DOM elements
|
|
1439
1285
|
node.type === Fragment || node.type === Trans)) {
|
|
1440
1286
|
return maybeAsString(node.props.children);
|
|
1441
1287
|
}
|
|
1442
|
-
|
|
1443
1288
|
if (typeof node === "string") {
|
|
1444
1289
|
return node;
|
|
1445
1290
|
}
|
|
1446
|
-
|
|
1447
1291
|
if (Array.isArray(node) && node.length === 1 && typeof node[0] === "string") {
|
|
1448
1292
|
return node[0];
|
|
1449
1293
|
}
|
|
1450
|
-
|
|
1451
1294
|
return undefined;
|
|
1452
1295
|
}
|
|
1453
1296
|
|
|
1454
1297
|
var listeners = [];
|
|
1455
1298
|
var queries = {};
|
|
1456
|
-
|
|
1457
1299
|
function matchScreenVariants() {
|
|
1458
1300
|
if (!isBrowser) {
|
|
1459
1301
|
return [];
|
|
1460
1302
|
}
|
|
1461
|
-
|
|
1462
1303
|
return Object.entries(queries).filter(function (_ref) {
|
|
1463
1304
|
var query = _ref[1];
|
|
1464
1305
|
return window.matchMedia(query).matches;
|
|
@@ -1466,14 +1307,11 @@ function matchScreenVariants() {
|
|
|
1466
1307
|
var name = _ref2[0];
|
|
1467
1308
|
return name;
|
|
1468
1309
|
});
|
|
1469
|
-
}
|
|
1470
|
-
|
|
1471
|
-
|
|
1310
|
+
}
|
|
1311
|
+
// undefined if screen variants have never been calculated
|
|
1472
1312
|
var curScreenVariants = undefined;
|
|
1473
|
-
|
|
1474
1313
|
function recalculateScreenVariants() {
|
|
1475
1314
|
var screenVariant = matchScreenVariants();
|
|
1476
|
-
|
|
1477
1315
|
if (!curScreenVariants || screenVariant.join("") !== curScreenVariants.join("")) {
|
|
1478
1316
|
curScreenVariants = screenVariant;
|
|
1479
1317
|
ReactDOM__default.unstable_batchedUpdates(function () {
|
|
@@ -1483,7 +1321,6 @@ function recalculateScreenVariants() {
|
|
|
1483
1321
|
});
|
|
1484
1322
|
}
|
|
1485
1323
|
}
|
|
1486
|
-
|
|
1487
1324
|
function ensureInitCurScreenVariants() {
|
|
1488
1325
|
// Initializes curScreenVariants if it hadn't been before. Note that this must
|
|
1489
1326
|
// be called from within an effect.
|
|
@@ -1491,11 +1328,9 @@ function ensureInitCurScreenVariants() {
|
|
|
1491
1328
|
curScreenVariants = matchScreenVariants();
|
|
1492
1329
|
}
|
|
1493
1330
|
}
|
|
1494
|
-
|
|
1495
1331
|
if (isBrowser) {
|
|
1496
1332
|
window.addEventListener("resize", recalculateScreenVariants);
|
|
1497
1333
|
}
|
|
1498
|
-
|
|
1499
1334
|
function createUseScreenVariants(isMulti, screenQueries) {
|
|
1500
1335
|
Object.assign(queries, screenQueries);
|
|
1501
1336
|
curScreenVariants = undefined;
|
|
@@ -1505,38 +1340,35 @@ function createUseScreenVariants(isMulti, screenQueries) {
|
|
|
1505
1340
|
// only happens on the client), we then actually ask for the real screen variant
|
|
1506
1341
|
// and, if different from [] or undefined, forces a re-render.
|
|
1507
1342
|
var _React$useState = useState(),
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1343
|
+
updateState = _React$useState[1];
|
|
1344
|
+
var lastScreenVariantsRef = useRef(curScreenVariants || []);
|
|
1345
|
+
// We do useLayoutEffect instead of useEffect to immediately
|
|
1511
1346
|
// register our forceUpdate. This ensures that if there was
|
|
1512
1347
|
// a window resize event between render and effects, that the
|
|
1513
1348
|
// listener will be registered in time
|
|
1514
|
-
|
|
1515
1349
|
useIsomorphicLayoutEffect(function () {
|
|
1516
1350
|
var updateIfChanged = function updateIfChanged() {
|
|
1517
1351
|
if (curScreenVariants && lastScreenVariantsRef.current.join("") !== curScreenVariants.join("")) {
|
|
1518
|
-
lastScreenVariantsRef.current = curScreenVariants;
|
|
1519
|
-
|
|
1352
|
+
lastScreenVariantsRef.current = curScreenVariants;
|
|
1353
|
+
// Force update
|
|
1520
1354
|
updateState({});
|
|
1521
1355
|
}
|
|
1522
|
-
};
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1356
|
+
};
|
|
1357
|
+
// Listeners are invoked whenever the window is resized
|
|
1358
|
+
listeners.push(updateIfChanged);
|
|
1359
|
+
// Initialize the curScreenVariants for the first time. We don't need
|
|
1526
1360
|
// to invoke the listeners here because all components will already
|
|
1527
1361
|
// have this effect running and will re-render if the real screen
|
|
1528
1362
|
// variant is non-empty.
|
|
1529
|
-
|
|
1530
|
-
|
|
1363
|
+
ensureInitCurScreenVariants();
|
|
1364
|
+
// Now, if the curScreenVariants differs from what we returned last,
|
|
1531
1365
|
// then force a re-render.
|
|
1532
|
-
|
|
1533
1366
|
updateIfChanged();
|
|
1534
1367
|
return function () {
|
|
1535
1368
|
// Remove our listener on unmount
|
|
1536
1369
|
listeners.splice(listeners.indexOf(updateIfChanged), 1);
|
|
1537
1370
|
};
|
|
1538
1371
|
}, []);
|
|
1539
|
-
|
|
1540
1372
|
if (isMulti) {
|
|
1541
1373
|
return curScreenVariants || [];
|
|
1542
1374
|
} else if (curScreenVariants) {
|
|
@@ -1550,9 +1382,10 @@ function createUseScreenVariants(isMulti, screenQueries) {
|
|
|
1550
1382
|
var PlasmicRootContext = /*#__PURE__*/createContext(undefined);
|
|
1551
1383
|
function PlasmicRootProvider(props) {
|
|
1552
1384
|
var platform = props.platform,
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1385
|
+
children = props.children,
|
|
1386
|
+
userAuthToken = props.userAuthToken,
|
|
1387
|
+
isUserLoading = props.isUserLoading,
|
|
1388
|
+
user = props.user;
|
|
1556
1389
|
var context = useMemo(function () {
|
|
1557
1390
|
return {
|
|
1558
1391
|
platform: platform
|
|
@@ -1561,9 +1394,10 @@ function PlasmicRootProvider(props) {
|
|
|
1561
1394
|
var dataSourceContextValue = useMemo(function () {
|
|
1562
1395
|
return {
|
|
1563
1396
|
userAuthToken: userAuthToken,
|
|
1564
|
-
user: user
|
|
1397
|
+
user: user,
|
|
1398
|
+
isUserLoading: isUserLoading
|
|
1565
1399
|
};
|
|
1566
|
-
}, [userAuthToken, user]);
|
|
1400
|
+
}, [userAuthToken, isUserLoading, user]);
|
|
1567
1401
|
return createElement(PlasmicRootContext.Provider, {
|
|
1568
1402
|
value: context
|
|
1569
1403
|
}, createElement(SSRProvider, null, createElement(PlasmicDataSourceContextProvider, {
|
|
@@ -1582,67 +1416,55 @@ var hasWarnedSSR = false;
|
|
|
1582
1416
|
/**
|
|
1583
1417
|
* Warns the user if PlasmicRootProvider is not used
|
|
1584
1418
|
*/
|
|
1585
|
-
|
|
1586
1419
|
function useEnsureSSRProvider() {
|
|
1587
1420
|
var hasRoot = useHasPlasmicRoot();
|
|
1588
|
-
|
|
1589
1421
|
if (hasRoot || hasWarnedSSR || process.env.NODE_ENV !== "development") {
|
|
1590
1422
|
return;
|
|
1591
1423
|
}
|
|
1592
|
-
|
|
1593
1424
|
hasWarnedSSR = true;
|
|
1594
1425
|
console.warn("Plasmic: To ensure your components work correctly with server-side rendering, please use PlasmicRootProvider at the root of your application. See https://docs.plasmic.app/learn/ssr");
|
|
1595
1426
|
}
|
|
1596
1427
|
|
|
1597
1428
|
function useFocused(opts) {
|
|
1598
1429
|
var _useAriaFocusRing = useFocusRing({
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1430
|
+
within: false,
|
|
1431
|
+
isTextInput: opts.isTextInput
|
|
1432
|
+
}),
|
|
1433
|
+
isFocused = _useAriaFocusRing.isFocused,
|
|
1434
|
+
focusProps = _useAriaFocusRing.focusProps;
|
|
1605
1435
|
return [isFocused, focusProps];
|
|
1606
1436
|
}
|
|
1607
|
-
|
|
1608
1437
|
function useFocusVisible(opts) {
|
|
1609
1438
|
var _useAriaFocusRing2 = useFocusRing({
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1439
|
+
within: false,
|
|
1440
|
+
isTextInput: opts.isTextInput
|
|
1441
|
+
}),
|
|
1442
|
+
isFocusVisible = _useAriaFocusRing2.isFocusVisible,
|
|
1443
|
+
focusProps = _useAriaFocusRing2.focusProps;
|
|
1616
1444
|
return [isFocusVisible, focusProps];
|
|
1617
1445
|
}
|
|
1618
|
-
|
|
1619
1446
|
function useFocusedWithin(opts) {
|
|
1620
1447
|
var _useAriaFocusRing3 = useFocusRing({
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1448
|
+
within: true,
|
|
1449
|
+
isTextInput: opts.isTextInput
|
|
1450
|
+
}),
|
|
1451
|
+
isFocused = _useAriaFocusRing3.isFocused,
|
|
1452
|
+
focusProps = _useAriaFocusRing3.focusProps;
|
|
1627
1453
|
return [isFocused, focusProps];
|
|
1628
1454
|
}
|
|
1629
|
-
|
|
1630
1455
|
function useFocusVisibleWithin(opts) {
|
|
1631
1456
|
var _useAriaFocusRing4 = useFocusRing({
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1457
|
+
within: true,
|
|
1458
|
+
isTextInput: opts.isTextInput
|
|
1459
|
+
}),
|
|
1460
|
+
isFocusVisible = _useAriaFocusRing4.isFocusVisible,
|
|
1461
|
+
focusProps = _useAriaFocusRing4.focusProps;
|
|
1638
1462
|
return [isFocusVisible, focusProps];
|
|
1639
1463
|
}
|
|
1640
|
-
|
|
1641
1464
|
function useHover() {
|
|
1642
1465
|
var _React$useState = useState(false),
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1466
|
+
isHover = _React$useState[0],
|
|
1467
|
+
setHover = _React$useState[1];
|
|
1646
1468
|
return [isHover, {
|
|
1647
1469
|
onMouseEnter: function onMouseEnter() {
|
|
1648
1470
|
return setHover(true);
|
|
@@ -1652,12 +1474,10 @@ function useHover() {
|
|
|
1652
1474
|
}
|
|
1653
1475
|
}];
|
|
1654
1476
|
}
|
|
1655
|
-
|
|
1656
1477
|
function usePressed() {
|
|
1657
1478
|
var _React$useState2 = useState(false),
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1479
|
+
isPressed = _React$useState2[0],
|
|
1480
|
+
setPressed = _React$useState2[1];
|
|
1661
1481
|
return [isPressed, {
|
|
1662
1482
|
onMouseDown: function onMouseDown() {
|
|
1663
1483
|
return setPressed(true);
|
|
@@ -1667,7 +1487,6 @@ function usePressed() {
|
|
|
1667
1487
|
}
|
|
1668
1488
|
}];
|
|
1669
1489
|
}
|
|
1670
|
-
|
|
1671
1490
|
var TRIGGER_TO_HOOK = {
|
|
1672
1491
|
useHover: useHover,
|
|
1673
1492
|
useFocused: useFocused,
|
|
@@ -1680,7 +1499,6 @@ var TRIGGER_TO_HOOK = {
|
|
|
1680
1499
|
* Installs argment trigger. All the useTrigger calls must use hardcoded `trigger` arg,
|
|
1681
1500
|
* as it's not valid to install variable React hooks!
|
|
1682
1501
|
*/
|
|
1683
|
-
|
|
1684
1502
|
function useTrigger(trigger, opts) {
|
|
1685
1503
|
return TRIGGER_TO_HOOK[trigger](opts);
|
|
1686
1504
|
}
|
|
@@ -1696,111 +1514,159 @@ function generateStateOnChangeProp($state, stateName, dataReps) {
|
|
|
1696
1514
|
* - parent[][].counter[].count
|
|
1697
1515
|
* We need to pass `parent[index1][index2].counter to the child component
|
|
1698
1516
|
*/
|
|
1699
|
-
|
|
1700
1517
|
function generateStateValueProp($state, path // ["parent", 0, 1, "counter"]
|
|
1701
1518
|
) {
|
|
1702
1519
|
return _get($state, path);
|
|
1703
1520
|
}
|
|
1704
|
-
/**
|
|
1705
|
-
* Forked from https://github.com/lukeed/dset
|
|
1706
|
-
* Changes: fixed setting a deep value to a proxy object
|
|
1707
|
-
*/
|
|
1708
|
-
|
|
1709
|
-
function set(obj, keys, val) {
|
|
1710
|
-
keys = keys.split ? keys.split(".") : keys;
|
|
1711
|
-
var i = 0,
|
|
1712
|
-
l = keys.length,
|
|
1713
|
-
t = obj,
|
|
1714
|
-
x,
|
|
1715
|
-
k;
|
|
1716
|
-
|
|
1717
|
-
while (i < l) {
|
|
1718
|
-
k = keys[i++];
|
|
1719
|
-
if (k === "__proto__" || k === "constructor" || k === "prototype") break;
|
|
1720
|
-
|
|
1721
|
-
if (i === l) {
|
|
1722
|
-
t[k] = val;
|
|
1723
|
-
t = t[k];
|
|
1724
|
-
} else {
|
|
1725
|
-
if (typeof (x = t[k]) === typeof keys) {
|
|
1726
|
-
t = t[k] = x;
|
|
1727
|
-
} else if (keys[i] * 0 !== 0 || !!~("" + keys[i]).indexOf(".")) {
|
|
1728
|
-
t[k] = {};
|
|
1729
|
-
t = t[k];
|
|
1730
|
-
} else {
|
|
1731
|
-
t[k] = [];
|
|
1732
|
-
t = t[k];
|
|
1733
|
-
}
|
|
1734
|
-
}
|
|
1735
|
-
}
|
|
1736
|
-
}
|
|
1737
1521
|
var useIsomorphicLayoutEffect$1 = typeof window !== "undefined" ? useLayoutEffect : useEffect;
|
|
1738
1522
|
function shallowEqual(a1, a2) {
|
|
1739
1523
|
if (a1.length !== a2.length) {
|
|
1740
1524
|
return false;
|
|
1741
1525
|
}
|
|
1742
|
-
|
|
1743
1526
|
for (var i = 0; i < a1.length; i++) {
|
|
1744
1527
|
if (a1[i] !== a2[i]) {
|
|
1745
1528
|
return false;
|
|
1746
1529
|
}
|
|
1747
1530
|
}
|
|
1748
|
-
|
|
1749
1531
|
return true;
|
|
1750
1532
|
}
|
|
1751
1533
|
function isNum(value) {
|
|
1752
1534
|
return typeof value === "symbol" ? false : !isNaN(+value);
|
|
1753
1535
|
}
|
|
1536
|
+
function assert(cond, msg) {
|
|
1537
|
+
if (msg === void 0) {
|
|
1538
|
+
msg = "Assertion failed";
|
|
1539
|
+
}
|
|
1540
|
+
if (!cond) {
|
|
1541
|
+
// We always generate an non empty message so that it doesn't get swallowed
|
|
1542
|
+
// by the async library.
|
|
1543
|
+
msg = (typeof msg === "string" ? msg : msg()) || "Assertion failed";
|
|
1544
|
+
debugger;
|
|
1545
|
+
throw new Error(msg);
|
|
1546
|
+
}
|
|
1547
|
+
}
|
|
1548
|
+
/**
|
|
1549
|
+
* Forked from https://github.com/lukeed/dset
|
|
1550
|
+
* Changes: fixed setting a deep value to a proxy object
|
|
1551
|
+
*/
|
|
1552
|
+
function set(obj, keys, val) {
|
|
1553
|
+
keys = keys.split ? keys.split(".") : keys;
|
|
1554
|
+
var i = 0,
|
|
1555
|
+
l = keys.length,
|
|
1556
|
+
t = obj,
|
|
1557
|
+
x,
|
|
1558
|
+
k;
|
|
1559
|
+
while (i < l) {
|
|
1560
|
+
k = keys[i++];
|
|
1561
|
+
if (k === "__proto__" || k === "constructor" || k === "prototype") break;
|
|
1562
|
+
var newValue = i === l ? val : typeof (x = t[k]) === typeof keys ? x : keys[i] * 0 !== 0 || !!~("" + keys[i]).indexOf(".") ? {} : [];
|
|
1563
|
+
assignValue(t, k, newValue);
|
|
1564
|
+
t = t[k];
|
|
1565
|
+
}
|
|
1566
|
+
}
|
|
1567
|
+
/**
|
|
1568
|
+
* Forked from lodash
|
|
1569
|
+
*/
|
|
1570
|
+
function baseAssignValue(object, key, value) {
|
|
1571
|
+
if (key == "__proto__") {
|
|
1572
|
+
Object.defineProperty(object, key, {
|
|
1573
|
+
configurable: true,
|
|
1574
|
+
enumerable: true,
|
|
1575
|
+
value: value,
|
|
1576
|
+
writable: true
|
|
1577
|
+
});
|
|
1578
|
+
} else {
|
|
1579
|
+
object[key] = value;
|
|
1580
|
+
}
|
|
1581
|
+
}
|
|
1582
|
+
function eq(value, other) {
|
|
1583
|
+
return value === other || value !== value && other !== other;
|
|
1584
|
+
}
|
|
1585
|
+
function assignValue(object, key, value) {
|
|
1586
|
+
var objValue = object[key];
|
|
1587
|
+
if (!(Object.prototype.hasOwnProperty.call(object, key) && eq(objValue, value)) || value === undefined && !(key in object)) {
|
|
1588
|
+
baseAssignValue(object, key, value);
|
|
1589
|
+
}
|
|
1590
|
+
}
|
|
1754
1591
|
|
|
1755
1592
|
var ARRAY_SYMBOL = /*#__PURE__*/Symbol("[]");
|
|
1756
1593
|
|
|
1594
|
+
var UNINITIALIZED = /*#__PURE__*/Symbol("plasmic.unitialized");
|
|
1757
1595
|
var StateSpecNode = /*#__PURE__*/function () {
|
|
1758
1596
|
function StateSpecNode(specs) {
|
|
1759
1597
|
this.specs = specs;
|
|
1760
1598
|
this.edges = new Map();
|
|
1599
|
+
this.state = {};
|
|
1761
1600
|
}
|
|
1762
|
-
|
|
1763
1601
|
var _proto = StateSpecNode.prototype;
|
|
1764
|
-
|
|
1765
1602
|
_proto.hasEdge = function hasEdge(key) {
|
|
1766
1603
|
return this.edges.has(key);
|
|
1767
1604
|
};
|
|
1768
|
-
|
|
1769
1605
|
_proto.addEdge = function addEdge(key, node) {
|
|
1770
1606
|
this.edges.set(key, node);
|
|
1771
1607
|
};
|
|
1772
|
-
|
|
1608
|
+
_proto.children = function children() {
|
|
1609
|
+
return this.edges.values();
|
|
1610
|
+
};
|
|
1773
1611
|
_proto.makeTransition = function makeTransition(key) {
|
|
1774
1612
|
key = isNum(key) ? ARRAY_SYMBOL : key;
|
|
1775
1613
|
return this.edges.get(key);
|
|
1776
1614
|
};
|
|
1777
|
-
|
|
1778
1615
|
_proto.isLeaf = function isLeaf() {
|
|
1779
1616
|
return this.edges.size === 0;
|
|
1780
1617
|
};
|
|
1781
|
-
|
|
1782
1618
|
_proto.hasArrayTransition = function hasArrayTransition() {
|
|
1783
1619
|
return this.edges.has(ARRAY_SYMBOL);
|
|
1784
1620
|
};
|
|
1785
|
-
|
|
1786
1621
|
_proto.getSpec = function getSpec() {
|
|
1787
1622
|
return this.specs[0];
|
|
1788
1623
|
};
|
|
1789
|
-
|
|
1790
1624
|
_proto.getAllSpecs = function getAllSpecs() {
|
|
1791
1625
|
return this.specs;
|
|
1792
1626
|
};
|
|
1793
|
-
|
|
1627
|
+
_proto.getState = function getState(path) {
|
|
1628
|
+
return this.state[JSON.stringify(path)];
|
|
1629
|
+
};
|
|
1630
|
+
_proto.clearStates = function clearStates() {
|
|
1631
|
+
this.state = {};
|
|
1632
|
+
};
|
|
1633
|
+
_proto.states = function states() {
|
|
1634
|
+
return Object.values(this.state);
|
|
1635
|
+
};
|
|
1636
|
+
_proto.hasState = function hasState(path) {
|
|
1637
|
+
var key = JSON.stringify(path);
|
|
1638
|
+
return key in this.state;
|
|
1639
|
+
};
|
|
1640
|
+
_proto.createStateCell = function createStateCell(path) {
|
|
1641
|
+
var key = JSON.stringify(path);
|
|
1642
|
+
this.state[key] = {
|
|
1643
|
+
listeners: [],
|
|
1644
|
+
initialValue: UNINITIALIZED,
|
|
1645
|
+
registeredInitFunc: this.getSpec().initFunc,
|
|
1646
|
+
path: path
|
|
1647
|
+
};
|
|
1648
|
+
};
|
|
1649
|
+
_proto.setInitialValue = function setInitialValue(path, value) {
|
|
1650
|
+
var key = JSON.stringify(path);
|
|
1651
|
+
this.state[key].initialValue = value;
|
|
1652
|
+
};
|
|
1653
|
+
_proto.getInitialValue = function getInitialValue(path) {
|
|
1654
|
+
var key = JSON.stringify(path);
|
|
1655
|
+
return this.state[key].initialValue;
|
|
1656
|
+
};
|
|
1657
|
+
_proto.addListener = function addListener(path, f) {
|
|
1658
|
+
var key = JSON.stringify(path);
|
|
1659
|
+
this.state[key].listeners.push(f);
|
|
1660
|
+
};
|
|
1794
1661
|
return StateSpecNode;
|
|
1795
1662
|
}();
|
|
1796
1663
|
var transformPathStringToObj = function transformPathStringToObj(str) {
|
|
1797
1664
|
var splitStatePathPart = function splitStatePathPart(state) {
|
|
1798
1665
|
return state.endsWith("[]") ? [].concat(splitStatePathPart(state.slice(0, -2)), [ARRAY_SYMBOL]) : [state];
|
|
1799
1666
|
};
|
|
1800
|
-
|
|
1801
1667
|
return str.split(".").flatMap(splitStatePathPart);
|
|
1802
1668
|
};
|
|
1803
|
-
function
|
|
1669
|
+
function buildTree(specs) {
|
|
1804
1670
|
var internalSpec = specs.map(function (spec) {
|
|
1805
1671
|
return _extends({}, spec, {
|
|
1806
1672
|
pathObj: transformPathStringToObj(spec.path),
|
|
@@ -1809,7 +1675,6 @@ function buildGraph(specs) {
|
|
|
1809
1675
|
})
|
|
1810
1676
|
});
|
|
1811
1677
|
});
|
|
1812
|
-
|
|
1813
1678
|
var rec = function rec(currentPath) {
|
|
1814
1679
|
var node = new StateSpecNode(internalSpec.filter(function (spec) {
|
|
1815
1680
|
return shallowEqual(currentPath, spec.pathObj.slice(0, currentPath.length));
|
|
@@ -1817,7 +1682,6 @@ function buildGraph(specs) {
|
|
|
1817
1682
|
node.getAllSpecs().forEach(function (spec) {
|
|
1818
1683
|
if (spec.pathObj.length > currentPath.length) {
|
|
1819
1684
|
var nextKey = spec.pathObj[currentPath.length];
|
|
1820
|
-
|
|
1821
1685
|
if (!node.hasEdge(nextKey)) {
|
|
1822
1686
|
node.addEdge(nextKey, rec([].concat(currentPath, [nextKey])));
|
|
1823
1687
|
}
|
|
@@ -1825,397 +1689,313 @@ function buildGraph(specs) {
|
|
|
1825
1689
|
});
|
|
1826
1690
|
return node;
|
|
1827
1691
|
};
|
|
1828
|
-
|
|
1829
1692
|
return rec([]);
|
|
1830
1693
|
}
|
|
1831
|
-
|
|
1832
|
-
var
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1694
|
+
function getLeaves(root) {
|
|
1695
|
+
var leaves = [];
|
|
1696
|
+
var rec = function rec(node) {
|
|
1697
|
+
for (var _iterator = _createForOfIteratorHelperLoose(node.children()), _step; !(_step = _iterator()).done;) {
|
|
1698
|
+
var child = _step.value;
|
|
1699
|
+
rec(child);
|
|
1700
|
+
}
|
|
1701
|
+
if (node.isLeaf()) {
|
|
1702
|
+
leaves.push(node);
|
|
1703
|
+
}
|
|
1704
|
+
};
|
|
1705
|
+
rec(root);
|
|
1706
|
+
return leaves;
|
|
1707
|
+
}
|
|
1708
|
+
function findStateCell(root, pathStr, repetitionIndex) {
|
|
1709
|
+
var realPath = [];
|
|
1710
|
+
var pathObj = transformPathStringToObj(pathStr);
|
|
1711
|
+
var currRepIndex = 0;
|
|
1712
|
+
for (var _iterator2 = _createForOfIteratorHelperLoose(pathObj), _step2; !(_step2 = _iterator2()).done;) {
|
|
1713
|
+
var part = _step2.value;
|
|
1714
|
+
if (typeof part === "symbol") {
|
|
1715
|
+
if (!root.hasArrayTransition() || !repetitionIndex || currRepIndex > repetitionIndex.length) {
|
|
1716
|
+
console.log(root);
|
|
1717
|
+
throw new Error("transition not found: pathStr " + pathStr + " part " + (typeof part === "symbol" ? "[]" : part));
|
|
1718
|
+
}
|
|
1719
|
+
realPath.push(repetitionIndex[currRepIndex++]);
|
|
1720
|
+
root = root.makeTransition(ARRAY_SYMBOL);
|
|
1721
|
+
} else {
|
|
1722
|
+
if (!root.hasEdge(part)) {
|
|
1723
|
+
throw new Error("transition not found: pathStr " + pathStr + " part " + (typeof part === "symbol" ? "[]" : part));
|
|
1724
|
+
}
|
|
1725
|
+
realPath.push(part);
|
|
1726
|
+
root = root.makeTransition(part);
|
|
1844
1727
|
}
|
|
1845
1728
|
}
|
|
1846
|
-
|
|
1847
|
-
|
|
1729
|
+
return {
|
|
1730
|
+
node: root,
|
|
1731
|
+
realPath: realPath
|
|
1732
|
+
};
|
|
1848
1733
|
}
|
|
1849
1734
|
|
|
1850
1735
|
function isNum$1(value) {
|
|
1851
1736
|
return typeof value === "symbol" ? false : !isNaN(+value);
|
|
1852
1737
|
}
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1738
|
+
function canProxy(value) {
|
|
1739
|
+
return typeof value === "object" && value != null;
|
|
1740
|
+
}
|
|
1741
|
+
function initializeStateValue($$state, initialSpecNode, initialStatePath, proxyRoot) {
|
|
1742
|
+
var stateAccess = new Set();
|
|
1743
|
+
var $state = create$StateProxy($$state, function (node, path) {
|
|
1744
|
+
return {
|
|
1745
|
+
get: function get() {
|
|
1746
|
+
stateAccess.add({
|
|
1747
|
+
path: path,
|
|
1748
|
+
node: node
|
|
1749
|
+
});
|
|
1750
|
+
var spec = node.getSpec();
|
|
1751
|
+
if (spec.valueProp) {
|
|
1752
|
+
return $$state.props[spec.valueProp];
|
|
1753
|
+
} else if (!node.hasState(path) && spec.initFunc) {
|
|
1754
|
+
return initializeStateValue($$state, node, path, proxyRoot);
|
|
1755
|
+
}
|
|
1756
|
+
return _get(proxyRoot, path);
|
|
1757
|
+
},
|
|
1758
|
+
set: function set() {
|
|
1759
|
+
throw new Error("Cannot update state values during initialization");
|
|
1760
|
+
}
|
|
1761
|
+
};
|
|
1859
1762
|
});
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
specKey: spec.path
|
|
1763
|
+
stateAccess.forEach(function (_ref) {
|
|
1764
|
+
var node = _ref.node,
|
|
1765
|
+
path = _ref.path;
|
|
1766
|
+
node.addListener(path, function () {
|
|
1767
|
+
var newValue = initialSpecNode.getSpec().initFunc($$state.props, $state, $$state.ctx);
|
|
1768
|
+
set(proxyRoot, initialStatePath, newValue);
|
|
1769
|
+
});
|
|
1868
1770
|
});
|
|
1771
|
+
var initialValue = initialSpecNode.getState(initialStatePath).registeredInitFunc($$state.props, $state, $$state.ctx);
|
|
1772
|
+
initialSpecNode.setInitialValue(initialStatePath, clone(initialValue));
|
|
1773
|
+
var initialSpec = initialSpecNode.getSpec();
|
|
1774
|
+
var value = initialSpec.isImmutable ? mkUntrackedValue(initialValue) : clone(initialValue);
|
|
1775
|
+
set(proxyRoot, initialStatePath, value);
|
|
1776
|
+
//immediately fire onChange
|
|
1777
|
+
if (initialSpec.onChangeProp) {
|
|
1778
|
+
var _$$state$props$initia, _$$state$props;
|
|
1779
|
+
(_$$state$props$initia = (_$$state$props = $$state.props)[initialSpec.onChangeProp]) == null ? void 0 : _$$state$props$initia.call(_$$state$props, initialValue);
|
|
1780
|
+
}
|
|
1781
|
+
return initialValue;
|
|
1869
1782
|
}
|
|
1870
|
-
|
|
1871
|
-
function
|
|
1872
|
-
var rec = function rec(currPath, currNode) {
|
|
1783
|
+
function create$StateProxy($$state, leafHandlers) {
|
|
1784
|
+
var rec = function rec(currPath, currNode, isOutside, proxyRoot, initialObject) {
|
|
1873
1785
|
var getNextPath = function getNextPath(property) {
|
|
1874
1786
|
return [].concat(currPath, [isNum$1(property) ? +property : property]);
|
|
1875
1787
|
};
|
|
1876
|
-
|
|
1877
|
-
|
|
1788
|
+
var spec = currNode.getSpec();
|
|
1789
|
+
var handlers = {
|
|
1878
1790
|
deleteProperty: function deleteProperty(target, property) {
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
}
|
|
1890
|
-
specKeysToUpdate.forEach(function (specKey) {
|
|
1891
|
-
var spec = $$state.specsByKey[specKey];
|
|
1892
|
-
|
|
1893
|
-
if (spec.onChangeProp) {
|
|
1894
|
-
var _$$state$props$spec$o, _$$state$props;
|
|
1895
|
-
|
|
1896
|
-
(_$$state$props$spec$o = (_$$state$props = $$state.props)[spec.onChangeProp]) == null ? void 0 : _$$state$props$spec$o.call(_$$state$props, _get($$state.stateValues, currPath), currPath);
|
|
1897
|
-
}
|
|
1898
|
-
});
|
|
1791
|
+
if (!isOutside && !currNode.isLeaf() && !currNode.hasArrayTransition() && !isNum$1(property)) {
|
|
1792
|
+
throw new Error("Can't delete a property in the middle of the state spec");
|
|
1793
|
+
}
|
|
1794
|
+
delete _get($$state.stateValues, currPath)[property];
|
|
1795
|
+
if (spec.onChangeProp) {
|
|
1796
|
+
var _$$state$props$spec$o, _$$state$props2;
|
|
1797
|
+
//we are always in a leaf, since we only have two cases:
|
|
1798
|
+
// 1 - delete properties outside the state tree
|
|
1799
|
+
// 2 - delete indices in repeated implicit states, but these can't be exposed, so they don't have onChangeProp
|
|
1800
|
+
(_$$state$props$spec$o = (_$$state$props2 = $$state.props)[spec.onChangeProp]) == null ? void 0 : _$$state$props$spec$o.call(_$$state$props2, _get($$state.stateValues, currPath.slice(spec.pathObj.length)));
|
|
1801
|
+
}
|
|
1899
1802
|
return Reflect.deleteProperty(target, property);
|
|
1900
1803
|
},
|
|
1901
1804
|
get: function get(target, property, receiver) {
|
|
1805
|
+
proxyRoot = proxyRoot == null ? receiver : proxyRoot;
|
|
1902
1806
|
var nextPath = getNextPath(property);
|
|
1807
|
+
if (isOutside || currNode.isLeaf()) {
|
|
1808
|
+
return Reflect.get(target, property, receiver);
|
|
1809
|
+
}
|
|
1903
1810
|
var nextNode = currNode.makeTransition(property);
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
target[property] = (_handlers$get = (_handlers = handlers(nextPath, nextNode.getSpec())).get) == null ? void 0 : _handlers$get.call(_handlers, target, property, receiver);
|
|
1910
|
-
} else if (!(property in target)) {
|
|
1911
|
-
target[property] = rec(nextPath, nextNode);
|
|
1912
|
-
}
|
|
1811
|
+
if (nextNode != null && nextNode.isLeaf()) {
|
|
1812
|
+
var _leafHandlers$get, _leafHandlers;
|
|
1813
|
+
return (_leafHandlers$get = (_leafHandlers = leafHandlers(nextNode, nextPath, proxyRoot)).get) == null ? void 0 : _leafHandlers$get.call(_leafHandlers, target, property, receiver);
|
|
1814
|
+
} else if (nextNode && !(property in target)) {
|
|
1815
|
+
target[property] = rec(nextPath, nextNode, false, proxyRoot, undefined);
|
|
1913
1816
|
}
|
|
1914
|
-
|
|
1915
1817
|
return Reflect.get(target, property, receiver);
|
|
1916
1818
|
},
|
|
1917
1819
|
set: function set$1(target, property, value, receiver) {
|
|
1820
|
+
var _nextNode, _nextNode2;
|
|
1821
|
+
proxyRoot = proxyRoot == null ? receiver : proxyRoot;
|
|
1918
1822
|
var nextPath = getNextPath(property);
|
|
1919
1823
|
var nextNode = currNode.makeTransition(property);
|
|
1920
|
-
|
|
1921
|
-
if (nextNode && typeof property !== "symbol") {
|
|
1922
|
-
if (nextNode.isLeaf()) {
|
|
1923
|
-
var _handlers$set, _handlers2;
|
|
1924
|
-
|
|
1925
|
-
// reached the end of the spec
|
|
1926
|
-
target[property] = (_handlers$set = (_handlers2 = handlers(nextPath, nextNode.getSpec())).set) == null ? void 0 : _handlers$set.call(_handlers2, target, property, value, receiver);
|
|
1927
|
-
return Reflect.set(target, property, value, receiver);
|
|
1928
|
-
} else if (typeof value === "object") {
|
|
1929
|
-
target[property] = rec(nextPath, nextNode);
|
|
1930
|
-
|
|
1931
|
-
for (var _i = 0, _Object$keys = Object.keys(value); _i < _Object$keys.length; _i++) {
|
|
1932
|
-
var key = _Object$keys[_i];
|
|
1933
|
-
target[property][key] = value[key];
|
|
1934
|
-
}
|
|
1935
|
-
|
|
1936
|
-
return true;
|
|
1937
|
-
}
|
|
1938
|
-
}
|
|
1939
|
-
|
|
1940
1824
|
if (property === "registerInitFunc" && currPath.length === 0) {
|
|
1941
1825
|
return Reflect.set(target, property, value, receiver);
|
|
1942
1826
|
}
|
|
1943
|
-
|
|
1944
|
-
if (currNode.hasArrayTransition()) {
|
|
1945
|
-
var _currNode$makeTransit, _currNode$makeTransit2;
|
|
1946
|
-
|
|
1827
|
+
if (!nextNode && currNode.hasArrayTransition()) {
|
|
1947
1828
|
set($$state.stateValues, nextPath, value);
|
|
1948
|
-
|
|
1949
|
-
(_currNode$makeTransit = currNode.makeTransition(ARRAY_SYMBOL)) == null ? void 0 : (_currNode$makeTransit2 = _currNode$makeTransit.getAllSpecs()) == null ? void 0 : _currNode$makeTransit2.forEach(function (spec) {
|
|
1950
|
-
if (spec.onChangeProp) {
|
|
1951
|
-
var _$$state$props$spec$o2, _$$state$props2;
|
|
1952
|
-
|
|
1953
|
-
(_$$state$props$spec$o2 = (_$$state$props2 = $$state.props)[spec.onChangeProp]) == null ? void 0 : _$$state$props$spec$o2.call(_$$state$props2, value, nextPath);
|
|
1954
|
-
}
|
|
1955
|
-
});
|
|
1829
|
+
//array can set his own properties such as length, map, ...
|
|
1956
1830
|
return Reflect.set(target, property, value, receiver);
|
|
1957
|
-
} // invalid setting a value that doesn't make part of the spec
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
return false;
|
|
1961
|
-
}
|
|
1962
|
-
});
|
|
1963
|
-
};
|
|
1964
|
-
|
|
1965
|
-
return rec([], $$state.rootStateSpec);
|
|
1966
|
-
}
|
|
1967
|
-
|
|
1968
|
-
var deleteState = function deleteState($$state, path) {
|
|
1969
|
-
var _$$state$unsubscripti;
|
|
1970
|
-
|
|
1971
|
-
var key = JSON.stringify(path);
|
|
1972
|
-
(_$$state$unsubscripti = $$state.unsubscriptionsByState[key]) == null ? void 0 : _$$state$unsubscripti.forEach(function (f) {
|
|
1973
|
-
return f();
|
|
1974
|
-
});
|
|
1975
|
-
delete $$state.unsubscriptionsByState[key];
|
|
1976
|
-
$$state.existingStates["delete"](key); // delete get($$state.stateValues, path.slice(-1))[path.slice(-1)[0]];
|
|
1977
|
-
// delete get($$state.initStateValues, path.slice(-1))[path.slice(-1)[0]];
|
|
1978
|
-
};
|
|
1979
|
-
|
|
1980
|
-
var getIndexes = function getIndexes(path, spec) {
|
|
1981
|
-
var indexes = [];
|
|
1982
|
-
|
|
1983
|
-
if (path.length !== spec.pathObj.length) {
|
|
1984
|
-
throw new Error("Unexpected error: state path and spec path have different lengths");
|
|
1985
|
-
}
|
|
1986
|
-
|
|
1987
|
-
for (var i = 0; i < spec.pathObj.length; i++) {
|
|
1988
|
-
if (spec.pathObj[i] === "[]") {
|
|
1989
|
-
indexes.push(path[i]);
|
|
1990
|
-
}
|
|
1991
|
-
}
|
|
1992
|
-
|
|
1993
|
-
return indexes;
|
|
1994
|
-
};
|
|
1995
|
-
|
|
1996
|
-
function initializeStateValue($$state, initialStatePath, initialSpec) {
|
|
1997
|
-
var _$$state$unsubscripti2;
|
|
1998
|
-
|
|
1999
|
-
var initialStateKey = JSON.stringify(initialStatePath);
|
|
2000
|
-
var stateAccess = new Set();
|
|
2001
|
-
var $state = create$StateProxy($$state, function (path, spec) {
|
|
2002
|
-
return {
|
|
2003
|
-
get: function get() {
|
|
2004
|
-
var key = JSON.stringify(path);
|
|
2005
|
-
stateAccess.add({
|
|
2006
|
-
path: path,
|
|
2007
|
-
spec: spec
|
|
2008
|
-
});
|
|
2009
|
-
|
|
2010
|
-
if (spec.valueProp) {
|
|
2011
|
-
return !spec.isRepeated ? $$state.props[spec.valueProp] : _get($$state.props[spec.valueProp], path.slice(1));
|
|
2012
1831
|
}
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
return _get($$state.stateValues, path);
|
|
2017
|
-
} else if (spec.initFunc) {
|
|
2018
|
-
initializeStateValue($$state, path, spec);
|
|
1832
|
+
if ((_nextNode = nextNode) != null && _nextNode.isLeaf()) {
|
|
1833
|
+
var _leafHandlers$set, _leafHandlers2;
|
|
1834
|
+
(_leafHandlers$set = (_leafHandlers2 = leafHandlers(nextNode, nextPath, proxyRoot)).set) == null ? void 0 : _leafHandlers$set.call(_leafHandlers2, target, property, value, receiver);
|
|
2019
1835
|
}
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
1836
|
+
if (!isOutside && !currNode.isLeaf() && !nextNode) {
|
|
1837
|
+
// can't set an unknown field in $state
|
|
1838
|
+
return false;
|
|
1839
|
+
}
|
|
1840
|
+
// we keep pointing to the leaf
|
|
1841
|
+
if (!nextNode) {
|
|
1842
|
+
assert(isOutside || currNode.isLeaf, "unexpected update in nextNode");
|
|
1843
|
+
nextNode = currNode;
|
|
1844
|
+
}
|
|
1845
|
+
if (canProxy(value)) {
|
|
1846
|
+
target[property] = rec(nextPath, nextNode, isOutside || currNode.isLeaf(), proxyRoot, value);
|
|
1847
|
+
} else if (!isOutside && !currNode.isLeaf() && !((_nextNode2 = nextNode) != null && _nextNode2.isLeaf())) {
|
|
1848
|
+
throw new Error("inserting a primitive value into a non-leaf");
|
|
1849
|
+
} else {
|
|
1850
|
+
Reflect.set(target, property, value, receiver);
|
|
1851
|
+
}
|
|
1852
|
+
nextNode.getAllSpecs().forEach(function (spec) {
|
|
1853
|
+
if (spec.onChangeProp) {
|
|
1854
|
+
var _$$state$props$spec$o2, _$$state$props3;
|
|
1855
|
+
(_$$state$props$spec$o2 = (_$$state$props3 = $$state.props)[spec.onChangeProp]) == null ? void 0 : _$$state$props$spec$o2.call(_$$state$props3, value);
|
|
1856
|
+
}
|
|
1857
|
+
});
|
|
1858
|
+
var newValue = (isOutside || currNode.isLeaf()) && currNode.getSpec().isImmutable ? mkUntrackedValue(value) : value;
|
|
1859
|
+
set($$state.stateValues, nextPath, newValue);
|
|
1860
|
+
return true;
|
|
2025
1861
|
}
|
|
2026
1862
|
};
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
return initialValue;
|
|
2043
|
-
}
|
|
2044
|
-
|
|
2045
|
-
function saveValue($$state, path, spec, value) {
|
|
2046
|
-
if (spec.isImmutable) {
|
|
2047
|
-
set($$state.stateValues, path, mkUntrackedValue(value));
|
|
2048
|
-
} else {
|
|
2049
|
-
set($$state.stateValues, path, value);
|
|
2050
|
-
}
|
|
2051
|
-
}
|
|
2052
|
-
|
|
2053
|
-
function saveStateInitialValue($$state, path, spec, initialValue) {
|
|
2054
|
-
if (spec.isImmutable) {
|
|
2055
|
-
var untrackedValue = mkUntrackedValue(initialValue);
|
|
2056
|
-
|
|
2057
|
-
set($$state.stateValues, path, untrackedValue);
|
|
2058
|
-
|
|
2059
|
-
set($$state.initStateValues, path, clone(untrackedValue));
|
|
2060
|
-
} else {
|
|
2061
|
-
set($$state.stateValues, path, clone(initialValue));
|
|
2062
|
-
|
|
2063
|
-
set($$state.initStateValues, path, clone(initialValue));
|
|
2064
|
-
}
|
|
1863
|
+
var baseObject = !isOutside && !currNode.isLeaf() ? currNode.hasArrayTransition() ? [] : {} : Array.isArray(initialObject) ? [] : Object.create(Object.getPrototypeOf(initialObject));
|
|
1864
|
+
var proxyObj = new Proxy(baseObject, handlers);
|
|
1865
|
+
if (initialObject) {
|
|
1866
|
+
Reflect.ownKeys(initialObject).forEach(function (key) {
|
|
1867
|
+
var desc = Object.getOwnPropertyDescriptor(initialObject, key);
|
|
1868
|
+
if (desc.get || desc.set) {
|
|
1869
|
+
Object.defineProperty(baseObject, key, desc);
|
|
1870
|
+
} else {
|
|
1871
|
+
proxyObj[key] = initialObject[key];
|
|
1872
|
+
}
|
|
1873
|
+
});
|
|
1874
|
+
}
|
|
1875
|
+
return proxyObj;
|
|
1876
|
+
};
|
|
1877
|
+
return rec([], $$state.rootSpecTree, false, undefined, undefined);
|
|
2065
1878
|
}
|
|
2066
|
-
|
|
1879
|
+
var mkUntrackedValue = function mkUntrackedValue(o) {
|
|
1880
|
+
return o != null && typeof o === "object" ? ref(o) : o;
|
|
1881
|
+
};
|
|
2067
1882
|
function useDollarState(specs, props, $ctx) {
|
|
2068
|
-
var $$state = React__default.useRef(
|
|
2069
|
-
|
|
2070
|
-
initStateValues: {},
|
|
2071
|
-
specsByKey: Object.fromEntries(specs.map(function (spec) {
|
|
2072
|
-
return [spec.path, _extends({}, spec, {
|
|
2073
|
-
pathObj: transformPathStringToObj(spec.path),
|
|
2074
|
-
isRepeated: spec.path.split(".").some(function (part) {
|
|
2075
|
-
return part.endsWith("[]");
|
|
2076
|
-
})
|
|
2077
|
-
})];
|
|
2078
|
-
})),
|
|
2079
|
-
statesInstanceBySpec: new Map(),
|
|
2080
|
-
existingStates: new Map(),
|
|
2081
|
-
unsubscriptionsByState: {},
|
|
2082
|
-
props: {},
|
|
2083
|
-
ctx: {},
|
|
2084
|
-
registrationsQueue: [],
|
|
2085
|
-
rootStateSpec: buildGraph(specs)
|
|
2086
|
-
})).current;
|
|
2087
|
-
$$state.props = mkUntrackedValue(props);
|
|
2088
|
-
$$state.ctx = mkUntrackedValue($ctx != null ? $ctx : {});
|
|
2089
|
-
var $state = React__default.useRef(Object.assign(create$StateProxy($$state, function (path, spec) {
|
|
2090
|
-
var key = JSON.stringify(path);
|
|
2091
|
-
|
|
2092
|
-
if (!$$state.existingStates.has(key)) {
|
|
2093
|
-
var _spec$initVal;
|
|
2094
|
-
|
|
2095
|
-
saveNewState($$state, path, spec);
|
|
2096
|
-
var initialValue = !spec.initFunc ? (_spec$initVal = spec.initVal) != null ? _spec$initVal : undefined : initializeStateValue($$state, path, spec);
|
|
2097
|
-
saveStateInitialValue($$state, path, spec, initialValue);
|
|
2098
|
-
}
|
|
2099
|
-
|
|
1883
|
+
var $$state = React__default.useRef(function () {
|
|
1884
|
+
var rootSpecTree = buildTree(specs);
|
|
2100
1885
|
return {
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
1886
|
+
rootSpecTree: rootSpecTree,
|
|
1887
|
+
specTreeLeaves: getLeaves(rootSpecTree),
|
|
1888
|
+
stateValues: proxy({}),
|
|
1889
|
+
props: {},
|
|
1890
|
+
ctx: {},
|
|
1891
|
+
registrationsQueue: []
|
|
1892
|
+
};
|
|
1893
|
+
}()).current;
|
|
1894
|
+
$$state.props = props;
|
|
1895
|
+
$$state.ctx = $ctx != null ? $ctx : {};
|
|
1896
|
+
var $state = React__default.useRef(function () {
|
|
1897
|
+
var useRef$state = Object.assign(create$StateProxy($$state, function (node, path, proxyRoot) {
|
|
1898
|
+
if (!node.hasState(path)) {
|
|
1899
|
+
node.createStateCell(path);
|
|
1900
|
+
var spec = node.getSpec();
|
|
1901
|
+
if (spec.initFunc) {
|
|
1902
|
+
initializeStateValue($$state, node, path, proxyRoot);
|
|
1903
|
+
} else if (!spec.valueProp) {
|
|
1904
|
+
set(proxyRoot, path, spec.initVal);
|
|
2116
1905
|
}
|
|
2117
|
-
|
|
2118
|
-
return true;
|
|
2119
1906
|
}
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
}
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
1907
|
+
return {
|
|
1908
|
+
get: function get(target, property, receiver) {
|
|
1909
|
+
var spec = node.getSpec();
|
|
1910
|
+
if (spec.valueProp) {
|
|
1911
|
+
return $$state.props[spec.valueProp];
|
|
1912
|
+
} else {
|
|
1913
|
+
return Reflect.get(target, property, receiver);
|
|
1914
|
+
}
|
|
1915
|
+
}
|
|
1916
|
+
};
|
|
1917
|
+
}), {
|
|
1918
|
+
registerInitFunc: function registerInitFunc(pathStr, f, repetitionIndex) {
|
|
1919
|
+
var _findStateCell = findStateCell($$state.rootSpecTree, pathStr, repetitionIndex),
|
|
1920
|
+
node = _findStateCell.node,
|
|
1921
|
+
realPath = _findStateCell.realPath;
|
|
1922
|
+
if (!node.hasState(realPath)) {
|
|
1923
|
+
node.createStateCell(realPath);
|
|
1924
|
+
}
|
|
1925
|
+
if (!deepEqual(node.getState(realPath).initialValue, f($$state.props, useRef$state, $$state.ctx))) {
|
|
1926
|
+
$$state.registrationsQueue.push({
|
|
1927
|
+
node: node,
|
|
1928
|
+
path: realPath,
|
|
1929
|
+
f: f
|
|
1930
|
+
});
|
|
1931
|
+
}
|
|
2134
1932
|
}
|
|
2135
|
-
}
|
|
2136
|
-
|
|
1933
|
+
});
|
|
1934
|
+
return useRef$state;
|
|
1935
|
+
}()).current;
|
|
1936
|
+
// For each spec with an initFunc, evaluate it and see if
|
|
2137
1937
|
// the init value has changed. If so, reset its state.
|
|
2138
|
-
|
|
2139
1938
|
var resetSpecs = [];
|
|
2140
|
-
$$state.
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
1939
|
+
$$state.specTreeLeaves.flatMap(function (node) {
|
|
1940
|
+
return node.states().map(function (stateCell) {
|
|
1941
|
+
return {
|
|
1942
|
+
stateCell: stateCell,
|
|
1943
|
+
node: node
|
|
1944
|
+
};
|
|
1945
|
+
});
|
|
1946
|
+
}).forEach(function (_ref2) {
|
|
1947
|
+
var stateCell = _ref2.stateCell,
|
|
1948
|
+
node = _ref2.node;
|
|
1949
|
+
if (stateCell.registeredInitFunc) {
|
|
1950
|
+
var newInit = stateCell.registeredInitFunc(props, $state, $ctx != null ? $ctx : {});
|
|
1951
|
+
if (!deepEqual(newInit, stateCell.initialValue)) {
|
|
2149
1952
|
resetSpecs.push({
|
|
2150
|
-
|
|
2151
|
-
|
|
1953
|
+
stateCell: stateCell,
|
|
1954
|
+
node: node
|
|
2152
1955
|
});
|
|
2153
1956
|
}
|
|
2154
1957
|
}
|
|
2155
1958
|
});
|
|
1959
|
+
var reInitializeState = function reInitializeState(node, stateCell) {
|
|
1960
|
+
var newInit = initializeStateValue($$state, node, stateCell.path, $state);
|
|
1961
|
+
var spec = node.getSpec();
|
|
1962
|
+
if (spec.onChangeProp) {
|
|
1963
|
+
var _$$state$props$spec$o3, _$$state$props4;
|
|
1964
|
+
(_$$state$props$spec$o3 = (_$$state$props4 = $$state.props)[spec.onChangeProp]) == null ? void 0 : _$$state$props$spec$o3.call(_$$state$props4, newInit);
|
|
1965
|
+
}
|
|
1966
|
+
};
|
|
2156
1967
|
useIsomorphicLayoutEffect$1(function () {
|
|
2157
|
-
resetSpecs.forEach(function (
|
|
2158
|
-
var
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
if (spec.onChangeProp) {
|
|
2163
|
-
var _$$state$props$spec$o4, _$$state$props4;
|
|
2164
|
-
|
|
2165
|
-
(_$$state$props$spec$o4 = (_$$state$props4 = $$state.props)[spec.onChangeProp]) == null ? void 0 : _$$state$props$spec$o4.call(_$$state$props4, newInit, path);
|
|
2166
|
-
}
|
|
1968
|
+
resetSpecs.forEach(function (_ref3) {
|
|
1969
|
+
var stateCell = _ref3.stateCell,
|
|
1970
|
+
node = _ref3.node;
|
|
1971
|
+
reInitializeState(node, stateCell);
|
|
2167
1972
|
});
|
|
2168
1973
|
}, [props, resetSpecs]);
|
|
2169
1974
|
useIsomorphicLayoutEffect$1(function () {
|
|
2170
|
-
$$state.registrationsQueue.forEach(function (
|
|
2171
|
-
var
|
|
2172
|
-
|
|
2173
|
-
|
|
1975
|
+
$$state.registrationsQueue.forEach(function (_ref4) {
|
|
1976
|
+
var node = _ref4.node,
|
|
1977
|
+
path = _ref4.path,
|
|
1978
|
+
f = _ref4.f;
|
|
1979
|
+
var stateCell = node.getState(path);
|
|
1980
|
+
stateCell.registeredInitFunc = f;
|
|
1981
|
+
reInitializeState(node, stateCell);
|
|
2174
1982
|
});
|
|
2175
1983
|
$$state.registrationsQueue = [];
|
|
2176
|
-
}, [$$state.registrationsQueue]);
|
|
2177
|
-
|
|
1984
|
+
}, [$$state.registrationsQueue]);
|
|
1985
|
+
// immediately initialize exposed non-private states
|
|
1986
|
+
useIsomorphicLayoutEffect$1(function () {
|
|
1987
|
+
$$state.specTreeLeaves.forEach(function (node) {
|
|
1988
|
+
var spec = node.getSpec();
|
|
1989
|
+
if (!spec.isRepeated && spec.type !== "private" && spec.initFunc) {
|
|
1990
|
+
node.createStateCell(spec.pathObj);
|
|
1991
|
+
initializeStateValue($$state, node, spec.pathObj, $state);
|
|
1992
|
+
}
|
|
1993
|
+
});
|
|
1994
|
+
}, []);
|
|
1995
|
+
// Re-render if any value changed in one of these objects
|
|
2178
1996
|
useSnapshot($$state.stateValues, {
|
|
2179
1997
|
sync: true
|
|
2180
1998
|
});
|
|
2181
|
-
useSnapshot($$state.specsByKey, {
|
|
2182
|
-
sync: true
|
|
2183
|
-
});
|
|
2184
|
-
return $state;
|
|
2185
|
-
}
|
|
2186
|
-
|
|
2187
|
-
function useCanvasDollarState(specs, props, $ctx) {
|
|
2188
|
-
var $$state = proxy({
|
|
2189
|
-
stateValues: {},
|
|
2190
|
-
initStateValues: {},
|
|
2191
|
-
specsByKey: Object.fromEntries(specs.map(function (spec) {
|
|
2192
|
-
return [spec.path, _extends({}, spec, {
|
|
2193
|
-
pathObj: transformPathStringToObj(spec.path),
|
|
2194
|
-
isRepeated: spec.path.split(".").some(function (part) {
|
|
2195
|
-
return part.endsWith("[]");
|
|
2196
|
-
})
|
|
2197
|
-
})];
|
|
2198
|
-
})),
|
|
2199
|
-
statesInstanceBySpec: new Map(),
|
|
2200
|
-
existingStates: new Map(),
|
|
2201
|
-
unsubscriptionsByState: {},
|
|
2202
|
-
props: {},
|
|
2203
|
-
ctx: {},
|
|
2204
|
-
registrationsQueue: [],
|
|
2205
|
-
rootStateSpec: buildGraph(specs)
|
|
2206
|
-
});
|
|
2207
|
-
$$state.props = mkUntrackedValue(props);
|
|
2208
|
-
$$state.ctx = mkUntrackedValue($ctx);
|
|
2209
|
-
var $state = {};
|
|
2210
|
-
|
|
2211
|
-
for (var _iterator = _createForOfIteratorHelperLoose(specs), _step; !(_step = _iterator()).done;) {
|
|
2212
|
-
var spec = _step.value;
|
|
2213
|
-
var path = transformPathStringToObj(spec.path);
|
|
2214
|
-
var init = spec.valueProp ? $$state.props[spec.valueProp] : spec.initVal ? spec.initVal : spec.initFunc ? initializeStateValue($$state, path, $$state.specsByKey[spec.path]) : undefined;
|
|
2215
|
-
|
|
2216
|
-
set($state, path, init);
|
|
2217
|
-
}
|
|
2218
|
-
|
|
2219
1999
|
return $state;
|
|
2220
2000
|
}
|
|
2221
2001
|
|
|
@@ -2230,7 +2010,6 @@ function mergeVariantToggles() {
|
|
|
2230
2010
|
for (var _len = arguments.length, toggles = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
2231
2011
|
toggles[_key] = arguments[_key];
|
|
2232
2012
|
}
|
|
2233
|
-
|
|
2234
2013
|
var definedToggles = toggles.filter(function (x) {
|
|
2235
2014
|
return !!x.def;
|
|
2236
2015
|
});
|
|
@@ -2241,7 +2020,7 @@ function mergeVariantToggles() {
|
|
|
2241
2020
|
return mapValues(grouped, function (subToggles) {
|
|
2242
2021
|
return Object.fromEntries(subToggles.map(function (_ref2) {
|
|
2243
2022
|
var def = _ref2.def,
|
|
2244
|
-
|
|
2023
|
+
active = _ref2.active;
|
|
2245
2024
|
return [def.variant, !!active];
|
|
2246
2025
|
}));
|
|
2247
2026
|
});
|
|
@@ -2255,7 +2034,6 @@ function getPlumeType(child) {
|
|
|
2255
2034
|
if (!isValidElement(child)) {
|
|
2256
2035
|
return undefined;
|
|
2257
2036
|
}
|
|
2258
|
-
|
|
2259
2037
|
var childType = child.type;
|
|
2260
2038
|
return childType.__plumeType || (childType.getPlumeType == null ? void 0 : childType.getPlumeType(child.props));
|
|
2261
2039
|
}
|
|
@@ -2263,20 +2041,17 @@ function getPlumeType(child) {
|
|
|
2263
2041
|
var _excluded$4 = ["link", "isDisabled", "startIcon", "endIcon", "showStartIcon", "showEndIcon", "children"];
|
|
2264
2042
|
function useButton(plasmicClass, props, config, ref) {
|
|
2265
2043
|
var _ref, _ref2, _extends2, _overrides;
|
|
2266
|
-
|
|
2267
2044
|
if (ref === void 0) {
|
|
2268
2045
|
ref = null;
|
|
2269
2046
|
}
|
|
2270
|
-
|
|
2271
2047
|
var link = props.link,
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2048
|
+
isDisabled = props.isDisabled,
|
|
2049
|
+
startIcon = props.startIcon,
|
|
2050
|
+
endIcon = props.endIcon,
|
|
2051
|
+
showStartIcon = props.showStartIcon,
|
|
2052
|
+
showEndIcon = props.showEndIcon,
|
|
2053
|
+
children = props.children,
|
|
2054
|
+
rest = _objectWithoutPropertiesLoose(props, _excluded$4);
|
|
2280
2055
|
var variants = _extends({}, pick.apply(void 0, [props].concat(plasmicClass.internalVariantProps)), mergeVariantToggles({
|
|
2281
2056
|
def: config.showStartIconVariant,
|
|
2282
2057
|
active: showStartIcon
|
|
@@ -2287,9 +2062,7 @@ function useButton(plasmicClass, props, config, ref) {
|
|
|
2287
2062
|
def: config.isDisabledVariant,
|
|
2288
2063
|
active: isDisabled
|
|
2289
2064
|
}));
|
|
2290
|
-
|
|
2291
2065
|
var args = _extends({}, pick.apply(void 0, [props].concat(plasmicClass.internalArgProps)), config.startIconSlot && (_ref = {}, _ref[config.startIconSlot] = startIcon, _ref), config.endIconSlot && (_ref2 = {}, _ref2[config.endIconSlot] = endIcon, _ref2), (_extends2 = {}, _extends2[config.contentSlot] = children, _extends2));
|
|
2292
|
-
|
|
2293
2066
|
var overrides = (_overrides = {}, _overrides[config.root] = {
|
|
2294
2067
|
as: !!link ? "a" : "button",
|
|
2295
2068
|
props: _extends({}, omit.apply(void 0, [rest].concat(plasmicClass.internalArgProps, plasmicClass.internalVariantProps)), {
|
|
@@ -2332,31 +2105,25 @@ function asAriaCheckboxProps(props) {
|
|
|
2332
2105
|
isSelected: props.isChecked,
|
|
2333
2106
|
defaultSelected: props.defaultChecked
|
|
2334
2107
|
});
|
|
2335
|
-
|
|
2336
2108
|
delete ariaProps["isChecked"];
|
|
2337
2109
|
delete ariaProps["defaultChecked"];
|
|
2338
2110
|
return ariaProps;
|
|
2339
2111
|
}
|
|
2340
|
-
|
|
2341
2112
|
function useCheckbox(plasmicClass, props, config, ref) {
|
|
2342
2113
|
var _overrides, _ref;
|
|
2343
|
-
|
|
2344
2114
|
if (ref === void 0) {
|
|
2345
2115
|
ref = null;
|
|
2346
2116
|
}
|
|
2347
|
-
|
|
2348
2117
|
var children = props.children,
|
|
2349
|
-
|
|
2350
|
-
|
|
2118
|
+
isDisabled = props.isDisabled,
|
|
2119
|
+
isIndeterminate = props.isIndeterminate;
|
|
2351
2120
|
useEnsureSSRProvider();
|
|
2352
2121
|
var inputRef = useRef(null);
|
|
2353
2122
|
var rootRef = useRef(null);
|
|
2354
2123
|
var ariaProps = asAriaCheckboxProps(props);
|
|
2355
2124
|
var state = useToggleState(ariaProps);
|
|
2356
|
-
|
|
2357
2125
|
var _useAriaCheckbox = useCheckbox$1(ariaProps, state, inputRef),
|
|
2358
|
-
|
|
2359
|
-
|
|
2126
|
+
inputProps = _useAriaCheckbox.inputProps;
|
|
2360
2127
|
var variants = _extends({}, pick.apply(void 0, [props].concat(plasmicClass.internalVariantProps)), mergeVariantToggles({
|
|
2361
2128
|
def: config.isDisabledVariant,
|
|
2362
2129
|
active: isDisabled
|
|
@@ -2370,7 +2137,6 @@ function useCheckbox(plasmicClass, props, config, ref) {
|
|
|
2370
2137
|
def: config.noLabelVariant,
|
|
2371
2138
|
active: !children
|
|
2372
2139
|
}));
|
|
2373
|
-
|
|
2374
2140
|
var overrides = (_overrides = {}, _overrides[config.root] = {
|
|
2375
2141
|
as: "label",
|
|
2376
2142
|
props: mergeProps(getStyleProps(props), {
|
|
@@ -2382,9 +2148,7 @@ function useCheckbox(plasmicClass, props, config, ref) {
|
|
|
2382
2148
|
}))), children);
|
|
2383
2149
|
}
|
|
2384
2150
|
}, _overrides);
|
|
2385
|
-
|
|
2386
2151
|
var args = _extends({}, pick.apply(void 0, [props].concat(plasmicClass.internalArgProps)), config.labelSlot ? (_ref = {}, _ref[config.labelSlot] = children, _ref) : {});
|
|
2387
|
-
|
|
2388
2152
|
var plumeState = useMemo(function () {
|
|
2389
2153
|
return {
|
|
2390
2154
|
setChecked: function setChecked(checked) {
|
|
@@ -2399,12 +2163,10 @@ function useCheckbox(plasmicClass, props, config, ref) {
|
|
|
2399
2163
|
},
|
|
2400
2164
|
focus: function focus() {
|
|
2401
2165
|
var _inputRef$current;
|
|
2402
|
-
|
|
2403
2166
|
return (_inputRef$current = inputRef.current) == null ? void 0 : _inputRef$current.focus();
|
|
2404
2167
|
},
|
|
2405
2168
|
blur: function blur() {
|
|
2406
2169
|
var _inputRef$current2;
|
|
2407
|
-
|
|
2408
2170
|
return (_inputRef$current2 = inputRef.current) == null ? void 0 : _inputRef$current2.blur();
|
|
2409
2171
|
},
|
|
2410
2172
|
setChecked: function setChecked(checked) {
|
|
@@ -2430,7 +2192,6 @@ function useCheckbox(plasmicClass, props, config, ref) {
|
|
|
2430
2192
|
* Will also assign keys to items by their index in the collection,
|
|
2431
2193
|
* and collect the keys of disabled items.
|
|
2432
2194
|
*/
|
|
2433
|
-
|
|
2434
2195
|
function deriveItemsFromChildren(children, opts) {
|
|
2435
2196
|
if (!children) {
|
|
2436
2197
|
return {
|
|
@@ -2438,15 +2199,13 @@ function deriveItemsFromChildren(children, opts) {
|
|
|
2438
2199
|
disabledKeys: []
|
|
2439
2200
|
};
|
|
2440
2201
|
}
|
|
2441
|
-
|
|
2442
2202
|
var itemPlumeType = opts.itemPlumeType,
|
|
2443
|
-
|
|
2444
|
-
|
|
2203
|
+
sectionPlumeType = opts.sectionPlumeType,
|
|
2204
|
+
invalidChildError = opts.invalidChildError;
|
|
2205
|
+
// For Plume items without an explicit key, we assign a key as the index
|
|
2445
2206
|
// of the collection.
|
|
2446
|
-
|
|
2447
2207
|
var itemCount = 0;
|
|
2448
2208
|
var sectionCount = 0;
|
|
2449
|
-
|
|
2450
2209
|
var ensureValue = function ensureValue(element) {
|
|
2451
2210
|
if (!propInChild(element, "value")) {
|
|
2452
2211
|
if (opts.requireItemValue && PLUME_STRICT_MODE) {
|
|
@@ -2463,32 +2222,24 @@ function deriveItemsFromChildren(children, opts) {
|
|
|
2463
2222
|
return element;
|
|
2464
2223
|
}
|
|
2465
2224
|
};
|
|
2466
|
-
|
|
2467
2225
|
var disabledKeys = [];
|
|
2468
|
-
|
|
2469
2226
|
var flattenedChildren = function flattenedChildren(children) {
|
|
2470
2227
|
return toChildArray(children).flatMap(function (child) {
|
|
2471
2228
|
if (React__default.isValidElement(child)) {
|
|
2472
2229
|
if (child.type === React__default.Fragment) {
|
|
2473
2230
|
return flattenedChildren(child.props.children);
|
|
2474
2231
|
}
|
|
2475
|
-
|
|
2476
2232
|
var type = getPlumeType(child);
|
|
2477
|
-
|
|
2478
2233
|
if (type === itemPlumeType) {
|
|
2479
2234
|
child = ensureValue(child);
|
|
2480
2235
|
var childKey = getItemLikeKey(child);
|
|
2481
|
-
|
|
2482
2236
|
if (getChildProp(child, "isDisabled") && !!childKey) {
|
|
2483
2237
|
disabledKeys.push(childKey);
|
|
2484
2238
|
}
|
|
2485
|
-
|
|
2486
2239
|
return [child];
|
|
2487
2240
|
}
|
|
2488
|
-
|
|
2489
2241
|
if (type === sectionPlumeType) {
|
|
2490
2242
|
var _child$key;
|
|
2491
|
-
|
|
2492
2243
|
return [cloneChild(child, {
|
|
2493
2244
|
// key of section doesn't actually matter, just needs
|
|
2494
2245
|
// to be unique
|
|
@@ -2497,7 +2248,6 @@ function deriveItemsFromChildren(children, opts) {
|
|
|
2497
2248
|
})];
|
|
2498
2249
|
}
|
|
2499
2250
|
}
|
|
2500
|
-
|
|
2501
2251
|
if (PLUME_STRICT_MODE) {
|
|
2502
2252
|
throw new Error(invalidChildError != null ? invalidChildError : "Unexpected child");
|
|
2503
2253
|
} else {
|
|
@@ -2505,7 +2255,6 @@ function deriveItemsFromChildren(children, opts) {
|
|
|
2505
2255
|
}
|
|
2506
2256
|
});
|
|
2507
2257
|
};
|
|
2508
|
-
|
|
2509
2258
|
return {
|
|
2510
2259
|
items: flattenedChildren(children),
|
|
2511
2260
|
disabledKeys: disabledKeys
|
|
@@ -2513,9 +2262,9 @@ function deriveItemsFromChildren(children, opts) {
|
|
|
2513
2262
|
}
|
|
2514
2263
|
function useDerivedItemsFromChildren(children, opts) {
|
|
2515
2264
|
var itemPlumeType = opts.itemPlumeType,
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2265
|
+
sectionPlumeType = opts.sectionPlumeType,
|
|
2266
|
+
invalidChildError = opts.invalidChildError,
|
|
2267
|
+
requireItemValue = opts.requireItemValue;
|
|
2519
2268
|
return React__default.useMemo(function () {
|
|
2520
2269
|
return deriveItemsFromChildren(children, {
|
|
2521
2270
|
itemPlumeType: itemPlumeType,
|
|
@@ -2529,7 +2278,6 @@ function useDerivedItemsFromChildren(children, opts) {
|
|
|
2529
2278
|
* Given a Collection node, create the React element that we should use
|
|
2530
2279
|
* to render it.
|
|
2531
2280
|
*/
|
|
2532
|
-
|
|
2533
2281
|
function renderCollectionNode(node) {
|
|
2534
2282
|
// node.rendered should already have our item-like or section-like Plume
|
|
2535
2283
|
// component elements, so we just need to clone them with a secret
|
|
@@ -2543,19 +2291,17 @@ function renderCollectionNode(node) {
|
|
|
2543
2291
|
* Renders a item-like or section-like Plume component element into an
|
|
2544
2292
|
* Item or a Section element.
|
|
2545
2293
|
*/
|
|
2546
|
-
|
|
2547
2294
|
function renderAsCollectionChild(child, opts) {
|
|
2548
2295
|
var plumeType = getPlumeType(child);
|
|
2549
|
-
|
|
2550
2296
|
if (plumeType === opts.itemPlumeType) {
|
|
2551
2297
|
var _getChildProp;
|
|
2552
|
-
|
|
2553
|
-
|
|
2298
|
+
var option = child;
|
|
2299
|
+
// We look at the children passed to the item-like element, and derive key
|
|
2554
2300
|
// or textValue from it if it is a string
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2301
|
+
var content = getChildProp(option, "children");
|
|
2302
|
+
// The children render prop needs to return an <Item/>
|
|
2303
|
+
return React__default.createElement(Item
|
|
2304
|
+
// We use ItemLike.value if the user explicitly specified a value,
|
|
2559
2305
|
// and we fallback to key. If the user specified neither, then
|
|
2560
2306
|
// the Collections API will generate a unique key for this item.
|
|
2561
2307
|
, {
|
|
@@ -2570,7 +2316,8 @@ function renderAsCollectionChild(child, opts) {
|
|
|
2570
2316
|
}, option);
|
|
2571
2317
|
} else {
|
|
2572
2318
|
var group = child;
|
|
2573
|
-
return React__default.createElement(Section
|
|
2319
|
+
return React__default.createElement(Section
|
|
2320
|
+
// Note that we are using the whole section-like element as the title
|
|
2574
2321
|
// here, and not group.props.title; we want the entire section-like
|
|
2575
2322
|
// Plume element to end up as Node.rendered.
|
|
2576
2323
|
, {
|
|
@@ -2588,23 +2335,19 @@ function renderAsCollectionChild(child, opts) {
|
|
|
2588
2335
|
});
|
|
2589
2336
|
}
|
|
2590
2337
|
}
|
|
2591
|
-
|
|
2592
2338
|
function getItemLikeKey(element) {
|
|
2593
2339
|
var _getChildProp2;
|
|
2594
|
-
|
|
2595
2340
|
return (_getChildProp2 = getChildProp(element, "value")) != null ? _getChildProp2 : element.key;
|
|
2596
|
-
}
|
|
2597
|
-
|
|
2598
|
-
|
|
2341
|
+
}
|
|
2342
|
+
// PlasmicLoader-aware function to get prop from child.
|
|
2599
2343
|
function getChildProp(child, prop) {
|
|
2600
2344
|
return "componentProps" in child.props ? child.props.componentProps[prop] : child.props[prop];
|
|
2601
|
-
}
|
|
2602
|
-
|
|
2345
|
+
}
|
|
2346
|
+
// PlasmicLoader-aware function to check `if (prop in element.props)`.
|
|
2603
2347
|
function propInChild(child, prop) {
|
|
2604
2348
|
return "componentProps" in child.props ? prop in child.props.componentProps : prop in child.props;
|
|
2605
|
-
}
|
|
2606
|
-
|
|
2607
|
-
|
|
2349
|
+
}
|
|
2350
|
+
// PlasmicLoader-aware function to clone React element.
|
|
2608
2351
|
function cloneChild(child, props) {
|
|
2609
2352
|
if (child.type.getPlumeType) {
|
|
2610
2353
|
// If React element has getPlumeType(), assume that it is PlasmicLoader,
|
|
@@ -2615,7 +2358,6 @@ function cloneChild(child, props) {
|
|
|
2615
2358
|
key: props.key
|
|
2616
2359
|
} : {}));
|
|
2617
2360
|
}
|
|
2618
|
-
|
|
2619
2361
|
return React__default.cloneElement(child, props);
|
|
2620
2362
|
}
|
|
2621
2363
|
|
|
@@ -2631,18 +2373,15 @@ var COLLECTION_OPTS = {
|
|
|
2631
2373
|
/**
|
|
2632
2374
|
* Converts props from BaseMenuProps to react-aria's useMenu() props.
|
|
2633
2375
|
*/
|
|
2634
|
-
|
|
2635
2376
|
function asAriaMenuProps(props) {
|
|
2636
2377
|
var children = props.children,
|
|
2637
|
-
|
|
2638
|
-
|
|
2378
|
+
rest = _objectWithoutPropertiesLoose(props, _excluded$5);
|
|
2639
2379
|
var _useDerivedItemsFromC = useDerivedItemsFromChildren(children, _extends({}, COLLECTION_OPTS, {
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2380
|
+
invalidChildError: "Can only use Menu.Item and Menu.Group as children to Menu",
|
|
2381
|
+
requireItemValue: false
|
|
2382
|
+
})),
|
|
2383
|
+
items = _useDerivedItemsFromC.items,
|
|
2384
|
+
disabledKeys = _useDerivedItemsFromC.disabledKeys;
|
|
2646
2385
|
var collectionChildRenderer = useCallback(function (child) {
|
|
2647
2386
|
return renderAsCollectionChild(child, COLLECTION_OPTS);
|
|
2648
2387
|
}, []);
|
|
@@ -2654,38 +2393,29 @@ function asAriaMenuProps(props) {
|
|
|
2654
2393
|
})
|
|
2655
2394
|
};
|
|
2656
2395
|
}
|
|
2657
|
-
|
|
2658
2396
|
function useMenu(plasmicClass, props, config, ref) {
|
|
2659
2397
|
var _overrides, _extends2;
|
|
2660
|
-
|
|
2661
2398
|
if (ref === void 0) {
|
|
2662
2399
|
ref = null;
|
|
2663
2400
|
}
|
|
2664
|
-
|
|
2665
2401
|
useEnsureSSRProvider();
|
|
2666
|
-
|
|
2667
2402
|
var _asAriaMenuProps = asAriaMenuProps(props),
|
|
2668
|
-
|
|
2669
|
-
|
|
2403
|
+
ariaProps = _asAriaMenuProps.ariaProps;
|
|
2670
2404
|
var triggerContext = useContext(TriggeredOverlayContext);
|
|
2671
2405
|
var rootRef = useRef(null);
|
|
2672
2406
|
var state = useTreeState(ariaProps);
|
|
2673
2407
|
var menuListRef = useRef(null);
|
|
2674
|
-
|
|
2675
2408
|
var _useAriaMenu = useMenu$1(_extends({}, ariaProps, {
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2409
|
+
autoFocus: triggerContext == null ? void 0 : triggerContext.autoFocus
|
|
2410
|
+
}), state, menuListRef),
|
|
2411
|
+
menuProps = _useAriaMenu.menuProps;
|
|
2680
2412
|
var contextValue = useMemo(function () {
|
|
2681
2413
|
return {
|
|
2682
2414
|
state: state,
|
|
2683
2415
|
menuProps: props
|
|
2684
2416
|
};
|
|
2685
2417
|
}, [state, props]);
|
|
2686
|
-
|
|
2687
2418
|
var variants = _extends({}, pick.apply(void 0, [props].concat(plasmicClass.internalVariantProps)));
|
|
2688
|
-
|
|
2689
2419
|
var overrides = (_overrides = {}, _overrides[config.root] = {
|
|
2690
2420
|
props: mergeProps(getStyleProps(props), {
|
|
2691
2421
|
ref: rootRef
|
|
@@ -2697,13 +2427,11 @@ function useMenu(plasmicClass, props, config, ref) {
|
|
|
2697
2427
|
style: _extends({}, noOutline())
|
|
2698
2428
|
})
|
|
2699
2429
|
}, _overrides);
|
|
2700
|
-
|
|
2701
2430
|
var args = _extends({}, pick.apply(void 0, [props].concat(plasmicClass.internalArgProps)), (_extends2 = {}, _extends2[config.itemsSlot] = createElement(MenuContext.Provider, {
|
|
2702
2431
|
value: contextValue
|
|
2703
2432
|
}, Array.from(state.collection).map(function (node) {
|
|
2704
2433
|
return renderCollectionNode(node);
|
|
2705
2434
|
})), _extends2));
|
|
2706
|
-
|
|
2707
2435
|
var plumeState = useMemo(function () {
|
|
2708
2436
|
return {
|
|
2709
2437
|
getFocusedValue: function getFocusedValue() {
|
|
@@ -2739,30 +2467,24 @@ function useMenu(plasmicClass, props, config, ref) {
|
|
|
2739
2467
|
|
|
2740
2468
|
function useMenuGroup(plasmicClass, props, config) {
|
|
2741
2469
|
var _extends2, _overrides;
|
|
2742
|
-
|
|
2743
2470
|
var context = useContext(MenuContext);
|
|
2744
2471
|
var node = props._node;
|
|
2745
|
-
|
|
2746
2472
|
if (!context || !node) {
|
|
2747
2473
|
if (PLUME_STRICT_MODE) {
|
|
2748
2474
|
throw new Error("You can only use a Menu.Group within a Menu component.");
|
|
2749
2475
|
}
|
|
2750
|
-
|
|
2751
2476
|
return getDefaultPlasmicProps(plasmicClass, props);
|
|
2752
2477
|
}
|
|
2753
|
-
|
|
2754
2478
|
var _useMenuSection = useMenuSection({
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2479
|
+
heading: props.title,
|
|
2480
|
+
"aria-label": props["aria-label"]
|
|
2481
|
+
}),
|
|
2482
|
+
headingProps = _useMenuSection.headingProps,
|
|
2483
|
+
groupProps = _useMenuSection.groupProps;
|
|
2761
2484
|
var _useSeparator = useSeparator({
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2485
|
+
elementType: "li"
|
|
2486
|
+
}),
|
|
2487
|
+
separatorProps = _useSeparator.separatorProps;
|
|
2766
2488
|
var variants = _extends({}, pick.apply(void 0, [props].concat(plasmicClass.internalVariantProps)), mergeVariantToggles({
|
|
2767
2489
|
def: config.noTitleVariant,
|
|
2768
2490
|
active: !props.title
|
|
@@ -2770,11 +2492,9 @@ function useMenuGroup(plasmicClass, props, config) {
|
|
|
2770
2492
|
def: config.isFirstVariant,
|
|
2771
2493
|
active: context.state.collection.getFirstKey() === node.key
|
|
2772
2494
|
}));
|
|
2773
|
-
|
|
2774
2495
|
var args = _extends({}, pick.apply(void 0, [props].concat(plasmicClass.internalArgProps)), (_extends2 = {}, _extends2[config.titleSlot] = props.title, _extends2[config.itemsSlot] = Array.from(node.childNodes).map(function (childNode) {
|
|
2775
2496
|
return renderCollectionNode(childNode);
|
|
2776
2497
|
}), _extends2));
|
|
2777
|
-
|
|
2778
2498
|
var overrides = (_overrides = {}, _overrides[config.root] = {
|
|
2779
2499
|
props: getStyleProps(props)
|
|
2780
2500
|
}, _overrides[config.separator] = {
|
|
@@ -2803,45 +2523,39 @@ function useMenuGroup(plasmicClass, props, config) {
|
|
|
2803
2523
|
|
|
2804
2524
|
function useMenuItem(plasmicClass, props, config) {
|
|
2805
2525
|
var _extends2, _overrides;
|
|
2806
|
-
|
|
2807
2526
|
var menuContext = useContext(MenuContext);
|
|
2808
2527
|
var triggerContext = useContext(TriggeredOverlayContext);
|
|
2809
|
-
|
|
2810
2528
|
if (!menuContext) {
|
|
2811
2529
|
if (PLUME_STRICT_MODE) {
|
|
2812
2530
|
throw new Error("You can only use a Menu.Item within a Menu component.");
|
|
2813
2531
|
}
|
|
2814
|
-
|
|
2815
2532
|
return getDefaultPlasmicProps(plasmicClass, props);
|
|
2816
2533
|
}
|
|
2817
|
-
|
|
2818
2534
|
var children = props.children,
|
|
2819
|
-
|
|
2535
|
+
onAction = props.onAction;
|
|
2820
2536
|
var state = menuContext.state,
|
|
2821
|
-
|
|
2822
|
-
|
|
2537
|
+
menuProps = menuContext.menuProps;
|
|
2538
|
+
// We pass in the Node secretly as an undocumented prop from <Select />
|
|
2823
2539
|
var node = props._node;
|
|
2824
2540
|
var isDisabled = state.disabledKeys.has(node.key);
|
|
2825
2541
|
var isHighlighted = state.selectionManager.isFocused && state.selectionManager.focusedKey === node.key;
|
|
2826
2542
|
var ref = useRef(null);
|
|
2827
|
-
|
|
2828
2543
|
var _useAriaMenuItem = useMenuItem$1(mergeProps({
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2544
|
+
// We need to merge both the onAction on MenuItem and the onAction
|
|
2545
|
+
// on Menu
|
|
2546
|
+
onAction: onAction
|
|
2547
|
+
}, {
|
|
2548
|
+
onAction: menuProps.onAction,
|
|
2549
|
+
onClose: triggerContext == null ? void 0 : triggerContext.state.close
|
|
2550
|
+
}, {
|
|
2551
|
+
isDisabled: isDisabled,
|
|
2552
|
+
"aria-label": node && node["aria-label"],
|
|
2553
|
+
key: node.key,
|
|
2554
|
+
isVirtualized: false,
|
|
2555
|
+
closeOnSelect: true
|
|
2556
|
+
}), state, ref),
|
|
2557
|
+
menuItemProps = _useAriaMenuItem.menuItemProps,
|
|
2558
|
+
labelProps = _useAriaMenuItem.labelProps;
|
|
2845
2559
|
var variants = _extends({}, pick.apply(void 0, [props].concat(plasmicClass.internalVariantProps)), mergeVariantToggles({
|
|
2846
2560
|
def: config.isDisabledVariant,
|
|
2847
2561
|
active: isDisabled
|
|
@@ -2849,9 +2563,7 @@ function useMenuItem(plasmicClass, props, config) {
|
|
|
2849
2563
|
def: config.isHighlightedVariant,
|
|
2850
2564
|
active: isHighlighted
|
|
2851
2565
|
}));
|
|
2852
|
-
|
|
2853
2566
|
var args = _extends({}, pick.apply(void 0, [props].concat(plasmicClass.internalArgProps)), (_extends2 = {}, _extends2[config.labelSlot] = children, _extends2));
|
|
2854
|
-
|
|
2855
2567
|
var overrides = (_overrides = {}, _overrides[config.root] = {
|
|
2856
2568
|
as: "li",
|
|
2857
2569
|
props: mergeProps(menuItemProps, {
|
|
@@ -2874,48 +2586,38 @@ function useMenuItem(plasmicClass, props, config) {
|
|
|
2874
2586
|
* A menu trigger hook that combines react-aria's useMenuTrigger, useAriaMenuTrigger,
|
|
2875
2587
|
* useOverlayPosition, useOverlay, and usePress
|
|
2876
2588
|
*/
|
|
2877
|
-
|
|
2878
2589
|
function useMenuTrigger(opts, state) {
|
|
2879
2590
|
var triggerRef = opts.triggerRef,
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2591
|
+
isDisabled = opts.isDisabled,
|
|
2592
|
+
placement = opts.placement,
|
|
2593
|
+
menuMatchTriggerWidth = opts.menuMatchTriggerWidth,
|
|
2594
|
+
menuWidth = opts.menuWidth,
|
|
2595
|
+
menu = opts.menu;
|
|
2886
2596
|
var _useAriaMenuTrigger = useMenuTrigger$1({
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2597
|
+
type: "menu",
|
|
2598
|
+
isDisabled: isDisabled
|
|
2599
|
+
}, state, triggerRef),
|
|
2600
|
+
triggerPressProps = _useAriaMenuTrigger.menuTriggerProps,
|
|
2601
|
+
menuProps = _useAriaMenuTrigger.menuProps;
|
|
2893
2602
|
var _usePress = usePress(_extends({}, triggerPressProps, {
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2603
|
+
isDisabled: isDisabled
|
|
2604
|
+
})),
|
|
2605
|
+
triggerProps = _usePress.pressProps;
|
|
2898
2606
|
var makeMenu = function makeMenu() {
|
|
2899
2607
|
var realMenu = typeof menu === "function" ? menu() : menu;
|
|
2900
|
-
|
|
2901
2608
|
if (!realMenu) {
|
|
2902
2609
|
return null;
|
|
2903
2610
|
}
|
|
2904
|
-
|
|
2905
2611
|
if (getPlumeType(realMenu) !== "menu") {
|
|
2906
2612
|
if (PLUME_STRICT_MODE) {
|
|
2907
2613
|
throw new Error("Must use an instance of the Menu component.");
|
|
2908
2614
|
}
|
|
2909
|
-
|
|
2910
2615
|
return null;
|
|
2911
2616
|
}
|
|
2912
|
-
|
|
2913
2617
|
return cloneElement(realMenu, mergeProps(realMenu.props, menuProps));
|
|
2914
2618
|
};
|
|
2915
|
-
|
|
2916
2619
|
var triggerContext = useMemo(function () {
|
|
2917
2620
|
var _state$focusStrategy;
|
|
2918
|
-
|
|
2919
2621
|
return {
|
|
2920
2622
|
triggerRef: triggerRef,
|
|
2921
2623
|
state: state,
|
|
@@ -2935,11 +2637,11 @@ function useMenuTrigger(opts, state) {
|
|
|
2935
2637
|
|
|
2936
2638
|
function DropdownMenu(props) {
|
|
2937
2639
|
var isOpen = props.isOpen,
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2640
|
+
defaultOpen = props.defaultOpen,
|
|
2641
|
+
onOpenChange = props.onOpenChange,
|
|
2642
|
+
children = props.children,
|
|
2643
|
+
placement = props.placement,
|
|
2644
|
+
menu = props.menu;
|
|
2943
2645
|
var triggerRef = useRef(null);
|
|
2944
2646
|
var state = useMenuTriggerState({
|
|
2945
2647
|
isOpen: isOpen,
|
|
@@ -2947,16 +2649,14 @@ function DropdownMenu(props) {
|
|
|
2947
2649
|
onOpenChange: onOpenChange,
|
|
2948
2650
|
shouldFlip: true
|
|
2949
2651
|
});
|
|
2950
|
-
|
|
2951
2652
|
var _useMenuTrigger = useMenuTrigger({
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2653
|
+
triggerRef: triggerRef,
|
|
2654
|
+
placement: placement,
|
|
2655
|
+
menu: menu
|
|
2656
|
+
}, state),
|
|
2657
|
+
triggerProps = _useMenuTrigger.triggerProps,
|
|
2658
|
+
makeMenu = _useMenuTrigger.makeMenu,
|
|
2659
|
+
triggerContext = _useMenuTrigger.triggerContext;
|
|
2960
2660
|
return createElement(TriggeredOverlayContext.Provider, {
|
|
2961
2661
|
value: triggerContext
|
|
2962
2662
|
}, cloneElement(children, mergeProps(children.props, triggerProps, {
|
|
@@ -2966,20 +2666,18 @@ function DropdownMenu(props) {
|
|
|
2966
2666
|
|
|
2967
2667
|
function useMenuButton(plasmicClass, props, config, outerRef) {
|
|
2968
2668
|
var _extends2, _overrides;
|
|
2969
|
-
|
|
2970
2669
|
if (outerRef === void 0) {
|
|
2971
2670
|
outerRef = null;
|
|
2972
2671
|
}
|
|
2973
|
-
|
|
2974
2672
|
var placement = props.placement,
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2673
|
+
isOpen = props.isOpen,
|
|
2674
|
+
defaultOpen = props.defaultOpen,
|
|
2675
|
+
onOpenChange = props.onOpenChange,
|
|
2676
|
+
isDisabled = props.isDisabled,
|
|
2677
|
+
menu = props.menu,
|
|
2678
|
+
autoFocus = props.autoFocus,
|
|
2679
|
+
menuMatchTriggerWidth = props.menuMatchTriggerWidth,
|
|
2680
|
+
menuWidth = props.menuWidth;
|
|
2983
2681
|
useEnsureSSRProvider();
|
|
2984
2682
|
var rootRef = useRef(null);
|
|
2985
2683
|
var triggerRef = useRef(null);
|
|
@@ -2989,22 +2687,19 @@ function useMenuButton(plasmicClass, props, config, outerRef) {
|
|
|
2989
2687
|
onOpenChange: onOpenChange,
|
|
2990
2688
|
shouldFlip: true
|
|
2991
2689
|
});
|
|
2992
|
-
|
|
2993
2690
|
var _useMenuTrigger = useMenuTrigger({
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
2691
|
+
isDisabled: isDisabled,
|
|
2692
|
+
triggerRef: triggerRef,
|
|
2693
|
+
placement: placement,
|
|
2694
|
+
menuMatchTriggerWidth: menuMatchTriggerWidth,
|
|
2695
|
+
menuWidth: menuWidth,
|
|
2696
|
+
menu: menu
|
|
2697
|
+
}, state),
|
|
2698
|
+
triggerProps = _useMenuTrigger.triggerProps,
|
|
2699
|
+
makeMenu = _useMenuTrigger.makeMenu,
|
|
2700
|
+
triggerContext = _useMenuTrigger.triggerContext;
|
|
3005
2701
|
var _useFocusable = useFocusable(props, triggerRef),
|
|
3006
|
-
|
|
3007
|
-
|
|
2702
|
+
triggerFocusProps = _useFocusable.focusableProps;
|
|
3008
2703
|
var variants = _extends({}, pick.apply(void 0, [props].concat(plasmicClass.internalVariantProps)), mergeVariantToggles({
|
|
3009
2704
|
def: config.isOpenVariant,
|
|
3010
2705
|
active: state.isOpen
|
|
@@ -3012,9 +2707,7 @@ function useMenuButton(plasmicClass, props, config, outerRef) {
|
|
|
3012
2707
|
def: config.isDisabledVariant,
|
|
3013
2708
|
active: isDisabled
|
|
3014
2709
|
}));
|
|
3015
|
-
|
|
3016
2710
|
var args = _extends({}, pick.apply(void 0, [props].concat(plasmicClass.internalArgProps)), (_extends2 = {}, _extends2[config.menuSlot] = state.isOpen ? makeMenu() : undefined, _extends2));
|
|
3017
|
-
|
|
3018
2711
|
var overrides = (_overrides = {}, _overrides[config.root] = {
|
|
3019
2712
|
wrapChildren: function wrapChildren(children) {
|
|
3020
2713
|
return createElement(TriggeredOverlayContext.Provider, {
|
|
@@ -3117,21 +2810,18 @@ var COLLECTION_OPTS$1 = {
|
|
|
3117
2810
|
* with the secret derived `_node` prop. That means Option and OptionGroup
|
|
3118
2811
|
* render functions can assume that _node is passed in.
|
|
3119
2812
|
*/
|
|
3120
|
-
|
|
3121
2813
|
function useAriaSelectProps(props) {
|
|
3122
2814
|
var value = props.value,
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
2815
|
+
defaultValue = props.defaultValue,
|
|
2816
|
+
children = props.children,
|
|
2817
|
+
onChange = props.onChange,
|
|
2818
|
+
rest = _objectWithoutPropertiesLoose(props, _excluded$6);
|
|
3128
2819
|
var _useDerivedItemsFromC = useDerivedItemsFromChildren(children, _extends({}, COLLECTION_OPTS$1, {
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
2820
|
+
invalidChildError: "Can only use Select.Option and Select.OptionGroup as children to Select",
|
|
2821
|
+
requireItemValue: true
|
|
2822
|
+
})),
|
|
2823
|
+
items = _useDerivedItemsFromC.items,
|
|
2824
|
+
disabledKeys = _useDerivedItemsFromC.disabledKeys;
|
|
3135
2825
|
var collectionChildRenderer = useCallback(function (child) {
|
|
3136
2826
|
return renderAsCollectionChild(child, COLLECTION_OPTS$1);
|
|
3137
2827
|
}, []);
|
|
@@ -3156,42 +2846,33 @@ function useAriaSelectProps(props) {
|
|
|
3156
2846
|
})
|
|
3157
2847
|
};
|
|
3158
2848
|
}
|
|
3159
|
-
|
|
3160
2849
|
function useSelect(plasmicClass, props, config, ref) {
|
|
3161
2850
|
var _overrides, _extends2;
|
|
3162
|
-
|
|
3163
2851
|
if (ref === void 0) {
|
|
3164
2852
|
ref = null;
|
|
3165
2853
|
}
|
|
3166
|
-
|
|
3167
2854
|
useEnsureSSRProvider();
|
|
3168
|
-
|
|
3169
2855
|
var _useAriaSelectProps = useAriaSelectProps(props),
|
|
3170
|
-
|
|
3171
|
-
|
|
2856
|
+
ariaProps = _useAriaSelectProps.ariaProps;
|
|
3172
2857
|
var placement = props.placement;
|
|
3173
2858
|
var state = useSelectState(ariaProps);
|
|
3174
2859
|
var triggerRef = useRef(null);
|
|
3175
2860
|
var rootRef = useRef(null);
|
|
3176
2861
|
var isDisabled = props.isDisabled,
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
2862
|
+
name = props.name,
|
|
2863
|
+
menuWidth = props.menuWidth,
|
|
2864
|
+
menuMatchTriggerWidth = props.menuMatchTriggerWidth,
|
|
2865
|
+
autoFocus = props.autoFocus,
|
|
2866
|
+
placeholder = props.placeholder,
|
|
2867
|
+
selectedContent = props.selectedContent;
|
|
3184
2868
|
var _useAriaSelect = useSelect$1(ariaProps, state, triggerRef),
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
2869
|
+
triggerPressProps = _useAriaSelect.triggerProps,
|
|
2870
|
+
menuProps = _useAriaSelect.menuProps;
|
|
3188
2871
|
var _usePress = usePress(_extends({}, triggerPressProps, {
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
2872
|
+
isDisabled: isDisabled
|
|
2873
|
+
})),
|
|
2874
|
+
triggerProps = _usePress.pressProps;
|
|
3193
2875
|
var triggerContent = state.selectedItem ? selectedContent != null ? selectedContent : getChildProp(state.selectedItem.value, "children") : null;
|
|
3194
|
-
|
|
3195
2876
|
var variants = _extends({}, pick.apply(void 0, [props].concat(plasmicClass.internalVariantProps)), mergeVariantToggles({
|
|
3196
2877
|
def: config.isOpenVariant,
|
|
3197
2878
|
active: state.isOpen
|
|
@@ -3202,7 +2883,6 @@ function useSelect(plasmicClass, props, config, ref) {
|
|
|
3202
2883
|
def: config.isDisabledVariant,
|
|
3203
2884
|
active: isDisabled
|
|
3204
2885
|
}));
|
|
3205
|
-
|
|
3206
2886
|
var triggerContext = useMemo(function () {
|
|
3207
2887
|
return {
|
|
3208
2888
|
triggerRef: triggerRef,
|
|
@@ -3247,13 +2927,11 @@ function useSelect(plasmicClass, props, config, ref) {
|
|
|
3247
2927
|
}, content);
|
|
3248
2928
|
}
|
|
3249
2929
|
}, _overrides);
|
|
3250
|
-
|
|
3251
2930
|
var args = _extends({}, pick.apply(void 0, [props].concat(plasmicClass.internalArgProps)), (_extends2 = {}, _extends2[config.triggerContentSlot] = triggerContent, _extends2[config.placeholderSlot] = placeholder, _extends2[config.optionsSlot] = createElement(SelectContext.Provider, {
|
|
3252
2931
|
value: state
|
|
3253
2932
|
}, Array.from(state.collection).map(function (node) {
|
|
3254
2933
|
return renderCollectionNode(node);
|
|
3255
2934
|
})), _extends2));
|
|
3256
|
-
|
|
3257
2935
|
var plumeState = useMemo(function () {
|
|
3258
2936
|
return {
|
|
3259
2937
|
open: function open() {
|
|
@@ -3283,12 +2961,10 @@ function useSelect(plasmicClass, props, config, ref) {
|
|
|
3283
2961
|
},
|
|
3284
2962
|
focus: function focus() {
|
|
3285
2963
|
var _triggerRef$current;
|
|
3286
|
-
|
|
3287
2964
|
return (_triggerRef$current = triggerRef.current) == null ? void 0 : _triggerRef$current.focus();
|
|
3288
2965
|
},
|
|
3289
2966
|
blur: function blur() {
|
|
3290
2967
|
var _triggerRef$current2;
|
|
3291
|
-
|
|
3292
2968
|
return (_triggerRef$current2 = triggerRef.current) == null ? void 0 : _triggerRef$current2.blur();
|
|
3293
2969
|
},
|
|
3294
2970
|
open: function open() {
|
|
@@ -3317,20 +2993,17 @@ function useSelect(plasmicClass, props, config, ref) {
|
|
|
3317
2993
|
state: plumeState
|
|
3318
2994
|
};
|
|
3319
2995
|
}
|
|
3320
|
-
|
|
3321
2996
|
function ListBoxWrapper(props) {
|
|
3322
2997
|
var state = props.state,
|
|
3323
|
-
|
|
3324
|
-
|
|
2998
|
+
menuProps = props.menuProps,
|
|
2999
|
+
children = props.children;
|
|
3325
3000
|
var ref = useRef(null);
|
|
3326
|
-
|
|
3327
3001
|
var _useListBox = useListBox(_extends({}, menuProps, {
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3002
|
+
isVirtualized: false,
|
|
3003
|
+
autoFocus: state.focusStrategy || true,
|
|
3004
|
+
disallowEmptySelection: true
|
|
3005
|
+
}), state, ref),
|
|
3006
|
+
listBoxProps = _useListBox.listBoxProps;
|
|
3334
3007
|
return cloneElement(children, mergeProps(children.props, listBoxProps, {
|
|
3335
3008
|
style: noOutline(),
|
|
3336
3009
|
ref: ref
|
|
@@ -3339,13 +3012,10 @@ function ListBoxWrapper(props) {
|
|
|
3339
3012
|
|
|
3340
3013
|
function useSelectOption(plasmicClass, props, config, outerRef) {
|
|
3341
3014
|
var _extends2, _overrides;
|
|
3342
|
-
|
|
3343
3015
|
if (outerRef === void 0) {
|
|
3344
3016
|
outerRef = null;
|
|
3345
3017
|
}
|
|
3346
|
-
|
|
3347
3018
|
var state = useContext(SelectContext);
|
|
3348
|
-
|
|
3349
3019
|
if (!state) {
|
|
3350
3020
|
// If no context, then we are being incorrectly used. Complain or just don't
|
|
3351
3021
|
// bother installing any hooks. It's okay to violate rules of hooks here
|
|
@@ -3353,31 +3023,27 @@ function useSelectOption(plasmicClass, props, config, outerRef) {
|
|
|
3353
3023
|
if (PLUME_STRICT_MODE) {
|
|
3354
3024
|
throw new Error("You can only use a Select.Option within a Select component.");
|
|
3355
3025
|
}
|
|
3356
|
-
|
|
3357
3026
|
return getDefaultPlasmicProps(plasmicClass, props);
|
|
3358
3027
|
}
|
|
3359
|
-
|
|
3360
3028
|
var children = props.children;
|
|
3361
3029
|
var rootRef = useRef(null);
|
|
3362
|
-
var onRef = mergeRefs(rootRef, outerRef);
|
|
3363
|
-
|
|
3030
|
+
var onRef = mergeRefs(rootRef, outerRef);
|
|
3031
|
+
// We pass in the Node secretly as an undocumented prop from <Select />
|
|
3364
3032
|
var node = props._node;
|
|
3365
3033
|
var isSelected = state.selectionManager.isSelected(node.key);
|
|
3366
3034
|
var isDisabled = state.disabledKeys.has(node.key);
|
|
3367
3035
|
var isHighlighted = state.selectionManager.isFocused && state.selectionManager.focusedKey === node.key;
|
|
3368
|
-
|
|
3369
3036
|
var _useAriaOption = useOption({
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3037
|
+
isSelected: isSelected,
|
|
3038
|
+
isDisabled: isDisabled,
|
|
3039
|
+
"aria-label": node && node["aria-label"],
|
|
3040
|
+
key: node.key,
|
|
3041
|
+
shouldSelectOnPressUp: true,
|
|
3042
|
+
shouldFocusOnHover: true,
|
|
3043
|
+
isVirtualized: false
|
|
3044
|
+
}, state, rootRef),
|
|
3045
|
+
optionProps = _useAriaOption.optionProps,
|
|
3046
|
+
labelProps = _useAriaOption.labelProps;
|
|
3381
3047
|
var variants = _extends({}, pick.apply(void 0, [props].concat(plasmicClass.internalVariantProps)), mergeVariantToggles({
|
|
3382
3048
|
def: config.isSelectedVariant,
|
|
3383
3049
|
active: isSelected
|
|
@@ -3388,9 +3054,7 @@ function useSelectOption(plasmicClass, props, config, outerRef) {
|
|
|
3388
3054
|
def: config.isHighlightedVariant,
|
|
3389
3055
|
active: isHighlighted
|
|
3390
3056
|
}));
|
|
3391
|
-
|
|
3392
3057
|
var args = _extends({}, pick.apply(void 0, [props].concat(plasmicClass.internalArgProps)), (_extends2 = {}, _extends2[config.labelSlot] = children, _extends2));
|
|
3393
|
-
|
|
3394
3058
|
var overrides = (_overrides = {}, _overrides[config.root] = {
|
|
3395
3059
|
props: mergeProps(optionProps, getStyleProps(props), {
|
|
3396
3060
|
ref: onRef,
|
|
@@ -3410,32 +3074,26 @@ function useSelectOption(plasmicClass, props, config, outerRef) {
|
|
|
3410
3074
|
|
|
3411
3075
|
function useSelectOptionGroup(plasmicClass, props, config) {
|
|
3412
3076
|
var _extends2, _overrides;
|
|
3413
|
-
|
|
3414
|
-
|
|
3077
|
+
var state = useContext(SelectContext);
|
|
3078
|
+
// `node` should exist if the OptionGroup was instantiated properly
|
|
3415
3079
|
// within a Select
|
|
3416
|
-
|
|
3417
3080
|
var node = props._node;
|
|
3418
|
-
|
|
3419
3081
|
if (!state || !node) {
|
|
3420
3082
|
if (PLUME_STRICT_MODE) {
|
|
3421
3083
|
throw new Error("You can only use a Select.OptionGroup within a Select component.");
|
|
3422
3084
|
}
|
|
3423
|
-
|
|
3424
3085
|
return getDefaultPlasmicProps(plasmicClass, props);
|
|
3425
3086
|
}
|
|
3426
|
-
|
|
3427
3087
|
var _useListBoxSection = useListBoxSection({
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3088
|
+
heading: props.title,
|
|
3089
|
+
"aria-label": props["aria-label"]
|
|
3090
|
+
}),
|
|
3091
|
+
headingProps = _useListBoxSection.headingProps,
|
|
3092
|
+
groupProps = _useListBoxSection.groupProps;
|
|
3434
3093
|
var _useSeparator = useSeparator({
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3094
|
+
elementType: "li"
|
|
3095
|
+
}),
|
|
3096
|
+
separatorProps = _useSeparator.separatorProps;
|
|
3439
3097
|
var variants = _extends({}, pick.apply(void 0, [props].concat(plasmicClass.internalVariantProps)), mergeVariantToggles({
|
|
3440
3098
|
def: config.noTitleVariant,
|
|
3441
3099
|
active: !props.title
|
|
@@ -3443,11 +3101,9 @@ function useSelectOptionGroup(plasmicClass, props, config) {
|
|
|
3443
3101
|
def: config.isFirstVariant,
|
|
3444
3102
|
active: state.collection.getFirstKey() === node.key
|
|
3445
3103
|
}));
|
|
3446
|
-
|
|
3447
3104
|
var args = _extends({}, pick.apply(void 0, [props].concat(plasmicClass.internalArgProps)), (_extends2 = {}, _extends2[config.titleSlot] = props.title, _extends2[config.optionsSlot] = Array.from(node.childNodes).map(function (childNode) {
|
|
3448
3105
|
return renderCollectionNode(childNode);
|
|
3449
3106
|
}), _extends2));
|
|
3450
|
-
|
|
3451
3107
|
var overrides = (_overrides = {}, _overrides[config.root] = {
|
|
3452
3108
|
props: getStyleProps(props)
|
|
3453
3109
|
}, _overrides[config.separator] = {
|
|
@@ -3477,30 +3133,24 @@ function asAriaSwitchProps(props) {
|
|
|
3477
3133
|
isSelected: props.isChecked,
|
|
3478
3134
|
defaultSelected: props.defaultChecked
|
|
3479
3135
|
});
|
|
3480
|
-
|
|
3481
3136
|
delete ariaProps["isChecked"];
|
|
3482
3137
|
delete ariaProps["defaultChecked"];
|
|
3483
3138
|
return ariaProps;
|
|
3484
3139
|
}
|
|
3485
|
-
|
|
3486
3140
|
function useSwitch(plasmicClass, props, config, ref) {
|
|
3487
3141
|
var _overrides, _ref;
|
|
3488
|
-
|
|
3489
3142
|
if (ref === void 0) {
|
|
3490
3143
|
ref = null;
|
|
3491
3144
|
}
|
|
3492
|
-
|
|
3493
3145
|
var children = props.children,
|
|
3494
|
-
|
|
3146
|
+
isDisabled = props.isDisabled;
|
|
3495
3147
|
useEnsureSSRProvider();
|
|
3496
3148
|
var inputRef = useRef(null);
|
|
3497
3149
|
var rootRef = useRef(null);
|
|
3498
3150
|
var ariaProps = asAriaSwitchProps(props);
|
|
3499
3151
|
var state = useToggleState(ariaProps);
|
|
3500
|
-
|
|
3501
3152
|
var _useAriaSwitch = useSwitch$1(ariaProps, state, inputRef),
|
|
3502
|
-
|
|
3503
|
-
|
|
3153
|
+
inputProps = _useAriaSwitch.inputProps;
|
|
3504
3154
|
var variants = _extends({}, pick.apply(void 0, [props].concat(plasmicClass.internalVariantProps)), mergeVariantToggles({
|
|
3505
3155
|
def: config.isDisabledVariant,
|
|
3506
3156
|
active: isDisabled
|
|
@@ -3511,7 +3161,6 @@ function useSwitch(plasmicClass, props, config, ref) {
|
|
|
3511
3161
|
def: config.noLabelVariant,
|
|
3512
3162
|
active: !children
|
|
3513
3163
|
}));
|
|
3514
|
-
|
|
3515
3164
|
var overrides = (_overrides = {}, _overrides[config.root] = {
|
|
3516
3165
|
as: "label",
|
|
3517
3166
|
props: mergeProps(getStyleProps(props), {
|
|
@@ -3523,9 +3172,7 @@ function useSwitch(plasmicClass, props, config, ref) {
|
|
|
3523
3172
|
}))), children);
|
|
3524
3173
|
}
|
|
3525
3174
|
}, _overrides);
|
|
3526
|
-
|
|
3527
3175
|
var args = _extends({}, pick.apply(void 0, [props].concat(plasmicClass.internalArgProps)), config.labelSlot ? (_ref = {}, _ref[config.labelSlot] = children, _ref) : {});
|
|
3528
|
-
|
|
3529
3176
|
var plumeState = useMemo(function () {
|
|
3530
3177
|
return {
|
|
3531
3178
|
setChecked: function setChecked(checked) {
|
|
@@ -3540,12 +3187,10 @@ function useSwitch(plasmicClass, props, config, ref) {
|
|
|
3540
3187
|
},
|
|
3541
3188
|
focus: function focus() {
|
|
3542
3189
|
var _inputRef$current;
|
|
3543
|
-
|
|
3544
3190
|
return (_inputRef$current = inputRef.current) == null ? void 0 : _inputRef$current.focus();
|
|
3545
3191
|
},
|
|
3546
3192
|
blur: function blur() {
|
|
3547
3193
|
var _inputRef$current2;
|
|
3548
|
-
|
|
3549
3194
|
return (_inputRef$current2 = inputRef.current) == null ? void 0 : _inputRef$current2.blur();
|
|
3550
3195
|
},
|
|
3551
3196
|
setChecked: function setChecked(checked) {
|
|
@@ -3566,34 +3211,29 @@ function useSwitch(plasmicClass, props, config, ref) {
|
|
|
3566
3211
|
var _excluded$7 = ["isDisabled", "startIcon", "endIcon", "showStartIcon", "showEndIcon", "className", "style", "inputClassName", "inputStyle"];
|
|
3567
3212
|
function useTextInput(plasmicClass, props, config, ref) {
|
|
3568
3213
|
var _ref, _ref2, _overrides;
|
|
3569
|
-
|
|
3570
3214
|
if (ref === void 0) {
|
|
3571
3215
|
ref = null;
|
|
3572
3216
|
}
|
|
3573
|
-
|
|
3574
3217
|
var isDisabled = props.isDisabled,
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3218
|
+
startIcon = props.startIcon,
|
|
3219
|
+
endIcon = props.endIcon,
|
|
3220
|
+
showStartIcon = props.showStartIcon,
|
|
3221
|
+
showEndIcon = props.showEndIcon,
|
|
3222
|
+
className = props.className,
|
|
3223
|
+
style = props.style,
|
|
3224
|
+
inputClassName = props.inputClassName,
|
|
3225
|
+
inputStyle = props.inputStyle,
|
|
3226
|
+
rest = _objectWithoutPropertiesLoose(props, _excluded$7);
|
|
3585
3227
|
var rootRef = useRef(null);
|
|
3586
3228
|
var inputRef = useRef(null);
|
|
3587
3229
|
useImperativeHandle(ref, function () {
|
|
3588
3230
|
return {
|
|
3589
3231
|
focus: function focus() {
|
|
3590
3232
|
var _inputRef$current;
|
|
3591
|
-
|
|
3592
3233
|
(_inputRef$current = inputRef.current) == null ? void 0 : _inputRef$current.focus();
|
|
3593
3234
|
},
|
|
3594
3235
|
blur: function blur() {
|
|
3595
3236
|
var _inputRef$current2;
|
|
3596
|
-
|
|
3597
3237
|
(_inputRef$current2 = inputRef.current) == null ? void 0 : _inputRef$current2.blur();
|
|
3598
3238
|
},
|
|
3599
3239
|
getRoot: function getRoot() {
|
|
@@ -3604,7 +3244,6 @@ function useTextInput(plasmicClass, props, config, ref) {
|
|
|
3604
3244
|
}
|
|
3605
3245
|
};
|
|
3606
3246
|
}, [rootRef, inputRef]);
|
|
3607
|
-
|
|
3608
3247
|
var variants = _extends({}, pick.apply(void 0, [props].concat(plasmicClass.internalVariantProps)), mergeVariantToggles({
|
|
3609
3248
|
def: config.showStartIconVariant,
|
|
3610
3249
|
active: showStartIcon
|
|
@@ -3615,9 +3254,7 @@ function useTextInput(plasmicClass, props, config, ref) {
|
|
|
3615
3254
|
def: config.isDisabledVariant,
|
|
3616
3255
|
active: isDisabled
|
|
3617
3256
|
}));
|
|
3618
|
-
|
|
3619
3257
|
var args = _extends({}, pick.apply(void 0, [props].concat(plasmicClass.internalArgProps)), config.startIconSlot && (_ref = {}, _ref[config.startIconSlot] = startIcon, _ref), config.endIconSlot && (_ref2 = {}, _ref2[config.endIconSlot] = endIcon, _ref2));
|
|
3620
|
-
|
|
3621
3258
|
var overrides = (_overrides = {}, _overrides[config.root] = {
|
|
3622
3259
|
props: {
|
|
3623
3260
|
ref: rootRef,
|
|
@@ -3645,19 +3282,15 @@ function useTextInput(plasmicClass, props, config, ref) {
|
|
|
3645
3282
|
|
|
3646
3283
|
function useTriggeredOverlay(plasmicClass, props, config, outerRef, isDismissable) {
|
|
3647
3284
|
var _extends2, _overrides;
|
|
3648
|
-
|
|
3649
3285
|
if (outerRef === void 0) {
|
|
3650
3286
|
outerRef = null;
|
|
3651
3287
|
}
|
|
3652
|
-
|
|
3653
3288
|
if (isDismissable === void 0) {
|
|
3654
3289
|
isDismissable = true;
|
|
3655
3290
|
}
|
|
3656
|
-
|
|
3657
3291
|
var overlayRef = useRef(null);
|
|
3658
3292
|
var onOverlayRef = mergeRefs(overlayRef, outerRef);
|
|
3659
3293
|
var context = useContext(TriggeredOverlayContext);
|
|
3660
|
-
|
|
3661
3294
|
if (!context) {
|
|
3662
3295
|
// If no context, then we are not being correctly used. Either complain, or
|
|
3663
3296
|
// exit early. It's okay to exit early and break the rules of React hooks
|
|
@@ -3665,50 +3298,44 @@ function useTriggeredOverlay(plasmicClass, props, config, outerRef, isDismissabl
|
|
|
3665
3298
|
if (PLUME_STRICT_MODE) {
|
|
3666
3299
|
throw new Error("You can only use a triggered overlay with a TriggeredOverlayContext");
|
|
3667
3300
|
}
|
|
3668
|
-
|
|
3669
3301
|
return getDefaultPlasmicProps(plasmicClass, props);
|
|
3670
3302
|
}
|
|
3671
|
-
|
|
3672
3303
|
var children = props.children;
|
|
3673
3304
|
var triggerRef = context.triggerRef,
|
|
3674
|
-
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
|
|
3305
|
+
placement = context.placement,
|
|
3306
|
+
overlayMatchTriggerWidth = context.overlayMatchTriggerWidth,
|
|
3307
|
+
overlayMinTriggerWidth = context.overlayMinTriggerWidth,
|
|
3308
|
+
overlayWidth = context.overlayWidth,
|
|
3309
|
+
state = context.state;
|
|
3310
|
+
// Measure the width of the trigger to inform the width of the menu (below).
|
|
3680
3311
|
var _React$useState = useState(false),
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3312
|
+
isRendered = _React$useState[0],
|
|
3313
|
+
setRendered = _React$useState[1];
|
|
3684
3314
|
var triggerWidth = triggerRef.current && (overlayMatchTriggerWidth || overlayMinTriggerWidth) ? triggerRef.current.offsetWidth : undefined;
|
|
3685
3315
|
useIsomorphicLayoutEffect(function () {
|
|
3686
3316
|
if (!isRendered && triggerRef.current && (overlayMatchTriggerWidth || overlayMinTriggerWidth)) {
|
|
3687
3317
|
setRendered(true);
|
|
3688
3318
|
}
|
|
3689
3319
|
}, [triggerRef, isRendered, overlayMatchTriggerWidth, overlayMinTriggerWidth]);
|
|
3690
|
-
|
|
3691
3320
|
var _useOverlay = useOverlay({
|
|
3692
|
-
|
|
3693
|
-
|
|
3694
|
-
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
|
|
3321
|
+
isOpen: state.isOpen,
|
|
3322
|
+
onClose: state.close,
|
|
3323
|
+
isDismissable: isDismissable,
|
|
3324
|
+
shouldCloseOnBlur: true
|
|
3325
|
+
}, overlayRef),
|
|
3326
|
+
overlayAriaProps = _useOverlay.overlayProps;
|
|
3699
3327
|
var _useOverlayPosition = useOverlayPosition({
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3328
|
+
targetRef: triggerRef,
|
|
3329
|
+
overlayRef: overlayRef,
|
|
3330
|
+
placement: placement != null ? placement : "bottom left",
|
|
3331
|
+
shouldFlip: true,
|
|
3332
|
+
isOpen: state.isOpen,
|
|
3333
|
+
onClose: state.close,
|
|
3334
|
+
containerPadding: 0
|
|
3335
|
+
}),
|
|
3336
|
+
overlayPositionProps = _useOverlayPosition.overlayProps,
|
|
3337
|
+
updatePosition = _useOverlayPosition.updatePosition,
|
|
3338
|
+
placementAxis = _useOverlayPosition.placement;
|
|
3712
3339
|
useIsomorphicLayoutEffect(function () {
|
|
3713
3340
|
if (state.isOpen) {
|
|
3714
3341
|
requestAnimationFrame(function () {
|
|
@@ -3727,7 +3354,6 @@ function useTriggeredOverlay(plasmicClass, props, config, outerRef, isDismissabl
|
|
|
3727
3354
|
minWidth: overlayMinTriggerWidth ? triggerWidth : "auto"
|
|
3728
3355
|
}
|
|
3729
3356
|
}, overlayAriaProps, overlayPositionProps);
|
|
3730
|
-
|
|
3731
3357
|
var variants = _extends({}, pick.apply(void 0, [props].concat(plasmicClass.internalVariantProps)), mergeVariantToggles({
|
|
3732
3358
|
def: config.isPlacedTopVariant,
|
|
3733
3359
|
active: placementAxis === "top"
|
|
@@ -3741,13 +3367,11 @@ function useTriggeredOverlay(plasmicClass, props, config, outerRef, isDismissabl
|
|
|
3741
3367
|
def: config.isPlacedRightVariant,
|
|
3742
3368
|
active: placementAxis === "right"
|
|
3743
3369
|
}));
|
|
3744
|
-
|
|
3745
3370
|
var args = _extends({}, pick.apply(void 0, [props].concat(plasmicClass.internalArgProps)), (_extends2 = {}, _extends2[config.contentSlot] = createElement(FocusScope, {
|
|
3746
3371
|
restoreFocus: true
|
|
3747
3372
|
}, createElement(DismissButton, {
|
|
3748
3373
|
onDismiss: state.close
|
|
3749
3374
|
}), children), _extends2));
|
|
3750
|
-
|
|
3751
3375
|
var overrides = (_overrides = {}, _overrides[config.root] = {
|
|
3752
3376
|
props: mergeProps(overlayProps, getStyleProps(props), {
|
|
3753
3377
|
ref: onOverlayRef
|
|
@@ -3771,5 +3395,5 @@ function useTriggeredOverlay(plasmicClass, props, config, outerRef, isDismissabl
|
|
|
3771
3395
|
};
|
|
3772
3396
|
}
|
|
3773
3397
|
|
|
3774
|
-
export { DropdownMenu, PlasmicHead, PlasmicIcon, PlasmicImg, PlasmicLink, PlasmicRootProvider, PlasmicSlot, SelectContext, Stack, Trans, TriggeredOverlayContext, classNames, createPlasmicElementProxy, createUseScreenVariants, deriveRenderOpts, ensureGlobalVariants, genTranslatableString, generateStateOnChangeProp, generateStateValueProp, getDataProps, hasVariant,
|
|
3398
|
+
export { DropdownMenu, PlasmicHead, PlasmicIcon, PlasmicImg, PlasmicLink, PlasmicPageGuard, PlasmicRootProvider, PlasmicSlot, SelectContext, Stack, Trans, TriggeredOverlayContext, classNames, createPlasmicElementProxy, createUseScreenVariants, deriveRenderOpts, ensureGlobalVariants, genTranslatableString, generateStateOnChangeProp, generateStateValueProp, getDataProps, hasVariant, makeFragment, mergeVariantsWithStates, omit, pick, plasmicHeadMeta, renderPlasmicSlot, set, setPlumeStrictMode, useButton, useCheckbox, useDollarState, useIsSSR, useMenu, useMenuButton, useMenuGroup, useMenuItem, useSelect, useSelectOption, useSelectOptionGroup, useSwitch, useTextInput, useTrigger, useTriggeredOverlay, wrapWithClassName };
|
|
3775
3399
|
//# sourceMappingURL=react-web.esm.js.map
|