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