@panneau/core 3.0.119 → 3.0.130
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/es/contexts.js +12 -2
- package/es/hooks.js +127 -12
- package/es/index.js +53 -41
- package/es/utils.js +19 -1
- package/lib/contexts.js +592 -273
- package/lib/hooks.js +182 -99
- package/lib/index.js +293 -235
- package/lib/utils.js +148 -66
- package/package.json +6 -6
package/lib/contexts.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
|
|
6
4
|
var isString = require('lodash/isString');
|
|
7
5
|
var PropTypes = require('prop-types');
|
|
@@ -17,22 +15,30 @@ var services = require('@folklore/services');
|
|
|
17
15
|
var reactIntl = require('react-intl');
|
|
18
16
|
var utils = require('@panneau/core/utils');
|
|
19
17
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
20
|
-
var
|
|
21
|
-
var
|
|
18
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
19
|
+
var pathToRegexp = require('path-to-regexp');
|
|
20
|
+
var regexparam = require('regexparam');
|
|
21
|
+
var index_js = require('use-sync-external-store/shim/index.js');
|
|
22
22
|
var tracking = require('@folklore/tracking');
|
|
23
23
|
|
|
24
|
-
function
|
|
24
|
+
function _interopNamespaceDefault(e) {
|
|
25
|
+
var n = Object.create(null);
|
|
26
|
+
if (e) {
|
|
27
|
+
Object.keys(e).forEach(function (k) {
|
|
28
|
+
if (k !== 'default') {
|
|
29
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
30
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () { return e[k]; }
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
n.default = e;
|
|
38
|
+
return Object.freeze(n);
|
|
39
|
+
}
|
|
25
40
|
|
|
26
|
-
var
|
|
27
|
-
var isString__default = /*#__PURE__*/_interopDefaultLegacy(isString);
|
|
28
|
-
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
29
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
30
|
-
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
31
|
-
var _toConsumableArray__default = /*#__PURE__*/_interopDefaultLegacy(_toConsumableArray);
|
|
32
|
-
var uniqBy__default = /*#__PURE__*/_interopDefaultLegacy(uniqBy);
|
|
33
|
-
var _slicedToArray__default = /*#__PURE__*/_interopDefaultLegacy(_slicedToArray);
|
|
34
|
-
var isObject__default = /*#__PURE__*/_interopDefaultLegacy(isObject);
|
|
35
|
-
var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
|
|
41
|
+
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
36
42
|
|
|
37
43
|
var MODALS_NAMESPACE = 'modals';
|
|
38
44
|
var FIELDS_NAMESPACE = 'fields';
|
|
@@ -44,7 +50,7 @@ var ACTIONS_NAMESPACE = 'actions';
|
|
|
44
50
|
var BUTTONS_NAMESPACE = 'buttons';
|
|
45
51
|
var PAGES_NAMESPACE = 'pages';
|
|
46
52
|
var APP_NAMESPACE = 'app';
|
|
47
|
-
var ComponentsContext = /*#__PURE__*/
|
|
53
|
+
var ComponentsContext = /*#__PURE__*/React.createContext(null);
|
|
48
54
|
|
|
49
55
|
/**
|
|
50
56
|
* Hooks
|
|
@@ -68,7 +74,7 @@ var useComponent = function useComponent(name) {
|
|
|
68
74
|
var namespace = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
69
75
|
var manager = useComponentsManager(namespace);
|
|
70
76
|
return React.useMemo(function () {
|
|
71
|
-
if (!
|
|
77
|
+
if (!isString(name)) {
|
|
72
78
|
return name || defaultComponent;
|
|
73
79
|
}
|
|
74
80
|
return manager.getComponent(name) || defaultComponent;
|
|
@@ -228,13 +234,13 @@ var useAppComponent = function useAppComponent(name) {
|
|
|
228
234
|
/**
|
|
229
235
|
* Provider
|
|
230
236
|
*/
|
|
231
|
-
var propTypes$
|
|
232
|
-
children:
|
|
233
|
-
namespace:
|
|
234
|
-
manager:
|
|
235
|
-
components:
|
|
237
|
+
var propTypes$e = {
|
|
238
|
+
children: PropTypes.node.isRequired,
|
|
239
|
+
namespace: PropTypes.string,
|
|
240
|
+
manager: PropTypes.instanceOf(core.ComponentsManager),
|
|
241
|
+
components: PropTypes.objectOf(PropTypes.oneOfType([PropTypes.object, PropTypes.func]))
|
|
236
242
|
};
|
|
237
|
-
var defaultProps$
|
|
243
|
+
var defaultProps$e = {
|
|
238
244
|
namespace: null,
|
|
239
245
|
components: {},
|
|
240
246
|
manager: null
|
|
@@ -246,165 +252,175 @@ var ComponentsProvider = function ComponentsProvider(_ref) {
|
|
|
246
252
|
children = _ref.children;
|
|
247
253
|
var previousManager = useComponentsManager() || null;
|
|
248
254
|
var finalManager = React.useMemo(function () {
|
|
249
|
-
return new core.ComponentsManager(
|
|
255
|
+
return new core.ComponentsManager(_objectSpread(_objectSpread(_objectSpread({}, previousManager !== null ? previousManager.getComponents() : null), manager !== null ? manager.getComponents() : null), new core.ComponentsManager(components).addNamespace(namespace).getComponents()));
|
|
250
256
|
}, [previousManager, manager, components, namespace]);
|
|
251
|
-
return /*#__PURE__*/
|
|
257
|
+
return /*#__PURE__*/React.createElement(ComponentsContext.Provider, {
|
|
252
258
|
value: finalManager
|
|
253
259
|
}, children);
|
|
254
260
|
};
|
|
255
|
-
ComponentsProvider.propTypes = propTypes$
|
|
256
|
-
ComponentsProvider.defaultProps = defaultProps$
|
|
261
|
+
ComponentsProvider.propTypes = propTypes$e;
|
|
262
|
+
ComponentsProvider.defaultProps = defaultProps$e;
|
|
257
263
|
|
|
258
|
-
var message =
|
|
259
|
-
id:
|
|
260
|
-
defaultMessage:
|
|
264
|
+
var message = PropTypes.shape({
|
|
265
|
+
id: PropTypes.string.isRequired,
|
|
266
|
+
defaultMessage: PropTypes.string
|
|
261
267
|
});
|
|
262
|
-
var label =
|
|
263
|
-
|
|
268
|
+
var label = PropTypes.oneOfType([message, PropTypes.node]);
|
|
269
|
+
PropTypes.oneOfType([PropTypes.number, PropTypes.string]);
|
|
264
270
|
|
|
265
271
|
/**
|
|
266
272
|
* Core
|
|
267
273
|
*/
|
|
268
|
-
var menuItem =
|
|
269
|
-
id:
|
|
274
|
+
var menuItem = PropTypes.shape({
|
|
275
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
270
276
|
label: label,
|
|
271
|
-
url:
|
|
272
|
-
external:
|
|
273
|
-
active:
|
|
277
|
+
url: PropTypes.string,
|
|
278
|
+
external: PropTypes.bool,
|
|
279
|
+
active: PropTypes.bool
|
|
274
280
|
});
|
|
275
|
-
|
|
276
|
-
var button =
|
|
277
|
-
id:
|
|
281
|
+
PropTypes.arrayOf(menuItem);
|
|
282
|
+
var button = PropTypes.shape({
|
|
283
|
+
id: PropTypes.string,
|
|
278
284
|
label: label,
|
|
279
|
-
onClick:
|
|
285
|
+
onClick: PropTypes.func
|
|
280
286
|
});
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
var fieldOption =
|
|
289
|
-
value:
|
|
290
|
-
label:
|
|
287
|
+
PropTypes.arrayOf(button);
|
|
288
|
+
PropTypes.oneOf(['primary', 'secondary', 'success', 'danger', 'warning', 'info', 'light', 'dark', null]);
|
|
289
|
+
PropTypes.oneOf(['lg', 'sm', null]);
|
|
290
|
+
PropTypes.oneOf(['button', 'submit']);
|
|
291
|
+
PropTypes.oneOf(['start', 'end']);
|
|
292
|
+
PropTypes.oneOf(['lg', 'sm', null]);
|
|
293
|
+
PropTypes.oneOf(['loading', 'success', 'error', null]);
|
|
294
|
+
var fieldOption = PropTypes.shape({
|
|
295
|
+
value: PropTypes.string,
|
|
296
|
+
label: PropTypes.string
|
|
291
297
|
});
|
|
292
|
-
|
|
293
|
-
var toggle =
|
|
294
|
-
key:
|
|
295
|
-
label:
|
|
298
|
+
PropTypes.arrayOf(fieldOption);
|
|
299
|
+
var toggle = PropTypes.shape({
|
|
300
|
+
key: PropTypes.string,
|
|
301
|
+
label: PropTypes.string
|
|
296
302
|
});
|
|
297
|
-
|
|
298
|
-
var tableColumn =
|
|
299
|
-
id:
|
|
300
|
-
component:
|
|
301
|
-
path:
|
|
302
|
-
field:
|
|
303
|
-
columnClassName:
|
|
303
|
+
PropTypes.arrayOf(toggle);
|
|
304
|
+
var tableColumn = PropTypes.oneOfType([PropTypes.string, PropTypes.shape({
|
|
305
|
+
id: PropTypes.string,
|
|
306
|
+
component: PropTypes.string,
|
|
307
|
+
path: PropTypes.string,
|
|
308
|
+
field: PropTypes.string,
|
|
309
|
+
columnClassName: PropTypes.string
|
|
304
310
|
})]);
|
|
305
|
-
|
|
311
|
+
PropTypes.arrayOf(tableColumn);
|
|
306
312
|
|
|
307
313
|
/**
|
|
308
314
|
* Panneau Definitions
|
|
309
315
|
*/
|
|
310
|
-
var routes =
|
|
311
|
-
'resources.index':
|
|
312
|
-
'resources.create':
|
|
313
|
-
'resources.store':
|
|
314
|
-
'resources.show':
|
|
315
|
-
'resources.edit':
|
|
316
|
-
'resources.update':
|
|
317
|
-
'resources.delete':
|
|
318
|
-
'resources.destroy':
|
|
316
|
+
var routes = PropTypes.shape({
|
|
317
|
+
'resources.index': PropTypes.string.isRequired,
|
|
318
|
+
'resources.create': PropTypes.string.isRequired,
|
|
319
|
+
'resources.store': PropTypes.string.isRequired,
|
|
320
|
+
'resources.show': PropTypes.string.isRequired,
|
|
321
|
+
'resources.edit': PropTypes.string.isRequired,
|
|
322
|
+
'resources.update': PropTypes.string.isRequired,
|
|
323
|
+
'resources.delete': PropTypes.string.isRequired,
|
|
324
|
+
'resources.destroy': PropTypes.string.isRequired
|
|
319
325
|
});
|
|
320
|
-
var intl =
|
|
321
|
-
locale:
|
|
322
|
-
messages:
|
|
323
|
-
values:
|
|
326
|
+
var intl = PropTypes.shape({
|
|
327
|
+
locale: PropTypes.string,
|
|
328
|
+
messages: PropTypes.objectOf(PropTypes.string),
|
|
329
|
+
values: PropTypes.objectOf(PropTypes.string)
|
|
324
330
|
});
|
|
325
|
-
var page =
|
|
326
|
-
component:
|
|
331
|
+
var page = PropTypes.shape({
|
|
332
|
+
component: PropTypes.string.isRequired
|
|
327
333
|
});
|
|
328
|
-
var pages =
|
|
329
|
-
var field =
|
|
330
|
-
name:
|
|
334
|
+
var pages = PropTypes.objectOf(page);
|
|
335
|
+
var field = PropTypes.shape({
|
|
336
|
+
name: PropTypes.string,
|
|
331
337
|
// Not required on localized fields
|
|
332
|
-
type:
|
|
333
|
-
component:
|
|
334
|
-
label:
|
|
338
|
+
type: PropTypes.string,
|
|
339
|
+
component: PropTypes.string,
|
|
340
|
+
label: PropTypes.node
|
|
335
341
|
});
|
|
336
|
-
var fields =
|
|
337
|
-
var form =
|
|
342
|
+
var fields = PropTypes.arrayOf(field);
|
|
343
|
+
var form = PropTypes.shape({
|
|
338
344
|
// type: PropTypes.string.isRequired,
|
|
339
|
-
title:
|
|
345
|
+
title: PropTypes.isRequired,
|
|
340
346
|
fields: fields
|
|
341
347
|
});
|
|
342
|
-
|
|
343
|
-
var resource =
|
|
344
|
-
id:
|
|
345
|
-
name:
|
|
348
|
+
PropTypes.arrayOf(form);
|
|
349
|
+
var resource = PropTypes.shape({
|
|
350
|
+
id: PropTypes.string.isRequired,
|
|
351
|
+
name: PropTypes.string.isRequired,
|
|
346
352
|
intl: intl,
|
|
347
353
|
fields: fields,
|
|
348
|
-
forms:
|
|
349
|
-
shows_in_navbar:
|
|
354
|
+
forms: PropTypes.shape({}),
|
|
355
|
+
shows_in_navbar: PropTypes.bool
|
|
350
356
|
});
|
|
351
|
-
var resources =
|
|
352
|
-
var panneauDefinition =
|
|
353
|
-
name:
|
|
357
|
+
var resources = PropTypes.arrayOf(resource);
|
|
358
|
+
var panneauDefinition = PropTypes.shape({
|
|
359
|
+
name: PropTypes.string,
|
|
354
360
|
resources: resources,
|
|
355
361
|
routes: routes,
|
|
356
362
|
pages: pages,
|
|
357
363
|
intl: intl
|
|
358
364
|
// intl,
|
|
359
365
|
});
|
|
360
|
-
var definition =
|
|
361
|
-
name:
|
|
366
|
+
var definition = PropTypes.shape({
|
|
367
|
+
name: PropTypes.string
|
|
362
368
|
// resources,
|
|
363
369
|
// routes,
|
|
364
370
|
// intl,
|
|
365
371
|
});
|
|
366
|
-
var item =
|
|
367
|
-
id:
|
|
372
|
+
var item = PropTypes.shape({
|
|
373
|
+
id: PropTypes.string.isRequired
|
|
368
374
|
});
|
|
369
|
-
|
|
370
|
-
var user =
|
|
371
|
-
id:
|
|
375
|
+
PropTypes.arrayOf(item);
|
|
376
|
+
var user = PropTypes.shape({
|
|
377
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
|
372
378
|
});
|
|
373
|
-
|
|
374
|
-
var selectOption =
|
|
375
|
-
value:
|
|
379
|
+
PropTypes.arrayOf(user);
|
|
380
|
+
var selectOption = PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.shape({
|
|
381
|
+
value: PropTypes.any,
|
|
376
382
|
// eslint-disable-line
|
|
377
383
|
label: label
|
|
378
|
-
}),
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
var formError =
|
|
382
|
-
message:
|
|
384
|
+
}), PropTypes.object]);
|
|
385
|
+
PropTypes.arrayOf(selectOption);
|
|
386
|
+
PropTypes.oneOf(['valid', 'invalid', 'loading', null]);
|
|
387
|
+
var formError = PropTypes.shape({
|
|
388
|
+
message: PropTypes.string
|
|
383
389
|
});
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
tus:
|
|
390
|
+
PropTypes.arrayOf(formError);
|
|
391
|
+
PropTypes.shape({
|
|
392
|
+
tus: PropTypes.object
|
|
387
393
|
}); // eslint-disable-line
|
|
388
394
|
|
|
389
|
-
|
|
390
|
-
var breadcrumb =
|
|
391
|
-
url:
|
|
395
|
+
PropTypes.string;
|
|
396
|
+
var breadcrumb = PropTypes.shape({
|
|
397
|
+
url: PropTypes.string
|
|
392
398
|
});
|
|
393
|
-
|
|
394
|
-
var font =
|
|
399
|
+
PropTypes.arrayOf(breadcrumb);
|
|
400
|
+
var font = PropTypes.shape({
|
|
395
401
|
// url: PropTypes.string,
|
|
396
402
|
});
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
var modal =
|
|
400
|
-
name:
|
|
403
|
+
PropTypes.arrayOf(font);
|
|
404
|
+
PropTypes.shape({});
|
|
405
|
+
var modal = PropTypes.shape({
|
|
406
|
+
name: PropTypes.string
|
|
401
407
|
});
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
408
|
+
PropTypes.arrayOf(modal);
|
|
409
|
+
var filter = PropTypes.shape({
|
|
410
|
+
id: PropTypes.string,
|
|
411
|
+
component: PropTypes.string
|
|
412
|
+
});
|
|
413
|
+
PropTypes.arrayOf(filter);
|
|
414
|
+
var media = PropTypes.shape({
|
|
415
|
+
id: PropTypes.string.isRequired,
|
|
416
|
+
name: PropTypes.string.isRequired,
|
|
417
|
+
type: PropTypes.string.isRequired,
|
|
418
|
+
thumbnail_url: PropTypes.string
|
|
419
|
+
});
|
|
420
|
+
PropTypes.arrayOf(media);
|
|
405
421
|
|
|
406
422
|
/* eslint-disable react/jsx-props-no-spreading */
|
|
407
|
-
var DefinitionContext = /*#__PURE__*/
|
|
423
|
+
var DefinitionContext = /*#__PURE__*/React.createContext(null);
|
|
408
424
|
var useDefinitionContext = function useDefinitionContext() {
|
|
409
425
|
return React.useContext(DefinitionContext);
|
|
410
426
|
};
|
|
@@ -414,22 +430,22 @@ var useDefinition = function useDefinition() {
|
|
|
414
430
|
definition = _useDefinitionContext2 === void 0 ? null : _useDefinitionContext2;
|
|
415
431
|
return definition;
|
|
416
432
|
};
|
|
417
|
-
var propTypes$
|
|
433
|
+
var propTypes$d = {
|
|
418
434
|
definition: definition.isRequired,
|
|
419
|
-
children:
|
|
435
|
+
children: PropTypes.node.isRequired
|
|
420
436
|
};
|
|
421
|
-
var defaultProps$
|
|
437
|
+
var defaultProps$d = {};
|
|
422
438
|
var DefinitionProvider = function DefinitionProvider(_ref) {
|
|
423
439
|
var definition = _ref.definition,
|
|
424
440
|
children = _ref.children;
|
|
425
|
-
return /*#__PURE__*/
|
|
441
|
+
return /*#__PURE__*/React.createElement(DefinitionContext.Provider, {
|
|
426
442
|
value: definition
|
|
427
443
|
}, children);
|
|
428
444
|
};
|
|
429
|
-
DefinitionProvider.propTypes = propTypes$
|
|
430
|
-
DefinitionProvider.defaultProps = defaultProps$
|
|
445
|
+
DefinitionProvider.propTypes = propTypes$d;
|
|
446
|
+
DefinitionProvider.defaultProps = defaultProps$d;
|
|
431
447
|
|
|
432
|
-
var FieldsContext = /*#__PURE__*/
|
|
448
|
+
var FieldsContext = /*#__PURE__*/React.createContext(null);
|
|
433
449
|
var useFieldsManager = function useFieldsManager() {
|
|
434
450
|
return React.useContext(FieldsContext);
|
|
435
451
|
};
|
|
@@ -441,12 +457,12 @@ var useFields = function useFields() {
|
|
|
441
457
|
var manager = useFieldsManager();
|
|
442
458
|
return manager.getDefinitions();
|
|
443
459
|
};
|
|
444
|
-
var propTypes$
|
|
460
|
+
var propTypes$c = {
|
|
445
461
|
fields: core.PropTypes.fields,
|
|
446
|
-
manager:
|
|
447
|
-
children:
|
|
462
|
+
manager: PropTypes.instanceOf(core.FieldsManager),
|
|
463
|
+
children: PropTypes.node.isRequired
|
|
448
464
|
};
|
|
449
|
-
var defaultProps$
|
|
465
|
+
var defaultProps$c = {
|
|
450
466
|
fields: null,
|
|
451
467
|
manager: null
|
|
452
468
|
};
|
|
@@ -456,7 +472,7 @@ var FieldsProvider = function FieldsProvider(_ref) {
|
|
|
456
472
|
children = _ref.children;
|
|
457
473
|
var previousManager = useFieldsManager() || null;
|
|
458
474
|
var finalManager = React.useMemo(function () {
|
|
459
|
-
var newFields =
|
|
475
|
+
var newFields = uniqBy([].concat(_toConsumableArray(fields || []), _toConsumableArray(manager !== null ? manager.getDefinitions() : []), _toConsumableArray(previousManager !== null ? previousManager.getDefinitions() : [])), function (_ref2) {
|
|
460
476
|
var id = _ref2.id;
|
|
461
477
|
return id;
|
|
462
478
|
}).reverse();
|
|
@@ -466,31 +482,31 @@ var FieldsProvider = function FieldsProvider(_ref) {
|
|
|
466
482
|
var newComponents = finalManager.getComponents();
|
|
467
483
|
return Object.keys(newComponents).reduce(function (map, id) {
|
|
468
484
|
var component = newComponents[id];
|
|
469
|
-
return
|
|
485
|
+
return isString(component) ? map : _objectSpread(_objectSpread({}, map), {}, _defineProperty({}, id, component));
|
|
470
486
|
}, {});
|
|
471
487
|
}, [finalManager]);
|
|
472
|
-
return /*#__PURE__*/
|
|
488
|
+
return /*#__PURE__*/React.createElement(FieldsContext.Provider, {
|
|
473
489
|
value: finalManager
|
|
474
|
-
}, /*#__PURE__*/
|
|
490
|
+
}, /*#__PURE__*/React.createElement(ComponentsProvider, {
|
|
475
491
|
namespace: FIELDS_NAMESPACE,
|
|
476
492
|
components: components
|
|
477
493
|
}, children));
|
|
478
494
|
};
|
|
479
|
-
FieldsProvider.propTypes = propTypes$
|
|
480
|
-
FieldsProvider.defaultProps = defaultProps$
|
|
495
|
+
FieldsProvider.propTypes = propTypes$c;
|
|
496
|
+
FieldsProvider.defaultProps = defaultProps$c;
|
|
481
497
|
|
|
482
498
|
/* eslint-disable react/jsx-props-no-spreading */
|
|
483
|
-
var GoogleKeysContext = /*#__PURE__*/
|
|
499
|
+
var GoogleKeysContext = /*#__PURE__*/React.createContext({
|
|
484
500
|
apiKey: null
|
|
485
501
|
});
|
|
486
502
|
var useGoogleKeys = function useGoogleKeys() {
|
|
487
503
|
return React.useContext(GoogleKeysContext);
|
|
488
504
|
};
|
|
489
|
-
var propTypes$
|
|
490
|
-
children:
|
|
491
|
-
apiKey:
|
|
505
|
+
var propTypes$b = {
|
|
506
|
+
children: PropTypes.node.isRequired,
|
|
507
|
+
apiKey: PropTypes.string // .isRequired,
|
|
492
508
|
};
|
|
493
|
-
var defaultProps$
|
|
509
|
+
var defaultProps$b = {
|
|
494
510
|
apiKey: null
|
|
495
511
|
};
|
|
496
512
|
var GoogleKeysProvider = function GoogleKeysProvider(_ref) {
|
|
@@ -503,14 +519,14 @@ var GoogleKeysProvider = function GoogleKeysProvider(_ref) {
|
|
|
503
519
|
apiKey: apiKey || previousApiKey
|
|
504
520
|
};
|
|
505
521
|
}, [previousApiKey, apiKey]);
|
|
506
|
-
return /*#__PURE__*/
|
|
522
|
+
return /*#__PURE__*/React.createElement(GoogleKeysContext.Provider, {
|
|
507
523
|
value: value
|
|
508
524
|
}, children);
|
|
509
525
|
};
|
|
510
|
-
GoogleKeysProvider.propTypes = propTypes$
|
|
511
|
-
GoogleKeysProvider.defaultProps = defaultProps$
|
|
526
|
+
GoogleKeysProvider.propTypes = propTypes$b;
|
|
527
|
+
GoogleKeysProvider.defaultProps = defaultProps$b;
|
|
512
528
|
|
|
513
|
-
var FontsContext = /*#__PURE__*/
|
|
529
|
+
var FontsContext = /*#__PURE__*/React.createContext({
|
|
514
530
|
systemFonts: null,
|
|
515
531
|
googleFonts: null,
|
|
516
532
|
customFonts: null
|
|
@@ -524,7 +540,7 @@ var useGoogleFonts = function useGoogleFonts() {
|
|
|
524
540
|
var _useGoogleKeys = useGoogleKeys(),
|
|
525
541
|
apiKey = _useGoogleKeys.apiKey;
|
|
526
542
|
var _useState = React.useState(null),
|
|
527
|
-
_useState2 =
|
|
543
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
528
544
|
googleFonts = _useState2[0],
|
|
529
545
|
setGoogleFonts = _useState2[1];
|
|
530
546
|
React.useEffect(function () {
|
|
@@ -581,12 +597,12 @@ var useFonts = function useFonts() {
|
|
|
581
597
|
}, [systemFonts, googleFonts, customFonts]);
|
|
582
598
|
return fonts;
|
|
583
599
|
};
|
|
584
|
-
var propTypes$
|
|
585
|
-
children:
|
|
600
|
+
var propTypes$a = {
|
|
601
|
+
children: PropTypes.node.isRequired,
|
|
586
602
|
systemFonts: core.PropTypes.fonts,
|
|
587
603
|
customFonts: core.PropTypes.fonts
|
|
588
604
|
};
|
|
589
|
-
var defaultProps$
|
|
605
|
+
var defaultProps$a = {
|
|
590
606
|
systemFonts: ['Arial', 'Courier', 'Georgia', 'Times New Roman', 'Verdana'],
|
|
591
607
|
customFonts: null
|
|
592
608
|
};
|
|
@@ -601,32 +617,32 @@ var FontsProvider = function FontsProvider(_ref4) {
|
|
|
601
617
|
previousGoogleFonts = _useFonts$googleFonts === void 0 ? null : _useFonts$googleFonts,
|
|
602
618
|
previousCustomFonts = _useFonts.customFonts;
|
|
603
619
|
var _useState3 = React.useState(null),
|
|
604
|
-
_useState4 =
|
|
620
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
605
621
|
googleFonts = _useState4[0],
|
|
606
622
|
setGoogleFonts = _useState4[1];
|
|
607
623
|
var fonts = React.useMemo(function () {
|
|
608
624
|
return {
|
|
609
|
-
systemFonts:
|
|
610
|
-
return
|
|
625
|
+
systemFonts: uniqBy([].concat(_toConsumableArray(previousSystemFonts || []), _toConsumableArray(systemFonts || [])), function (font) {
|
|
626
|
+
return isObject(font) ? font.name : font;
|
|
611
627
|
}),
|
|
612
|
-
googleFonts:
|
|
613
|
-
return
|
|
628
|
+
googleFonts: uniqBy([].concat(_toConsumableArray(previousGoogleFonts || []), _toConsumableArray(googleFonts || [])), function (font) {
|
|
629
|
+
return isObject(font) ? font.name : font;
|
|
614
630
|
}),
|
|
615
|
-
customFonts:
|
|
616
|
-
return
|
|
631
|
+
customFonts: uniqBy([].concat(_toConsumableArray(previousCustomFonts || []), _toConsumableArray(customFonts || [])), function (font) {
|
|
632
|
+
return isObject(font) ? font.name : font;
|
|
617
633
|
}),
|
|
618
634
|
setGoogleFonts: setGoogleFonts
|
|
619
635
|
};
|
|
620
636
|
}, [previousSystemFonts, previousGoogleFonts, previousCustomFonts, customFonts, systemFonts, googleFonts, setGoogleFonts]);
|
|
621
|
-
return /*#__PURE__*/
|
|
637
|
+
return /*#__PURE__*/React.createElement(FontsContext.Provider, {
|
|
622
638
|
value: fonts
|
|
623
639
|
}, children);
|
|
624
640
|
};
|
|
625
|
-
FontsProvider.propTypes = propTypes$
|
|
626
|
-
FontsProvider.defaultProps = defaultProps$
|
|
641
|
+
FontsProvider.propTypes = propTypes$a;
|
|
642
|
+
FontsProvider.defaultProps = defaultProps$a;
|
|
627
643
|
|
|
628
644
|
/* eslint-disable react/jsx-props-no-spreading */
|
|
629
|
-
var FormContext = /*#__PURE__*/
|
|
645
|
+
var FormContext = /*#__PURE__*/React.createContext(null);
|
|
630
646
|
var useForm = function useForm() {
|
|
631
647
|
return React.useContext(FormContext);
|
|
632
648
|
};
|
|
@@ -640,13 +656,13 @@ var useFormSetValue = function useFormSetValue() {
|
|
|
640
656
|
setValue = _useForm2.setValue;
|
|
641
657
|
return setValue;
|
|
642
658
|
};
|
|
643
|
-
var propTypes$
|
|
644
|
-
value:
|
|
659
|
+
var propTypes$9 = {
|
|
660
|
+
value: PropTypes.object.isRequired,
|
|
645
661
|
// eslint-disable-line react/forbid-prop-types
|
|
646
|
-
setValue:
|
|
647
|
-
children:
|
|
662
|
+
setValue: PropTypes.func.isRequired,
|
|
663
|
+
children: PropTypes.node.isRequired
|
|
648
664
|
};
|
|
649
|
-
var defaultProps$
|
|
665
|
+
var defaultProps$9 = {};
|
|
650
666
|
var FormProvider = function FormProvider(_ref) {
|
|
651
667
|
var value = _ref.value,
|
|
652
668
|
setValue = _ref.setValue,
|
|
@@ -657,14 +673,14 @@ var FormProvider = function FormProvider(_ref) {
|
|
|
657
673
|
setValue: setValue
|
|
658
674
|
};
|
|
659
675
|
}, [value, setValue]);
|
|
660
|
-
return /*#__PURE__*/
|
|
676
|
+
return /*#__PURE__*/React.createElement(FormContext.Provider, {
|
|
661
677
|
value: values
|
|
662
678
|
}, children);
|
|
663
679
|
};
|
|
664
|
-
FormProvider.propTypes = propTypes$
|
|
665
|
-
FormProvider.defaultProps = defaultProps$
|
|
680
|
+
FormProvider.propTypes = propTypes$9;
|
|
681
|
+
FormProvider.defaultProps = defaultProps$9;
|
|
666
682
|
|
|
667
|
-
var GoogleApiClientContext = /*#__PURE__*/
|
|
683
|
+
var GoogleApiClientContext = /*#__PURE__*/React.createContext(null);
|
|
668
684
|
var useGoogleApiClient = function useGoogleApiClient() {
|
|
669
685
|
return React.useContext(GoogleApiClientContext);
|
|
670
686
|
};
|
|
@@ -677,8 +693,8 @@ var withGoogleApiClient = function withGoogleApiClient(WrappedComponent) {
|
|
|
677
693
|
return displayName || name || 'Component';
|
|
678
694
|
};
|
|
679
695
|
var WithGoogleApiClientComponent = function WithGoogleApiClientComponent(props) {
|
|
680
|
-
return /*#__PURE__*/
|
|
681
|
-
return /*#__PURE__*/
|
|
696
|
+
return /*#__PURE__*/React.createElement(GoogleApiClientContext.Consumer, null, function (client) {
|
|
697
|
+
return /*#__PURE__*/React.createElement(WrappedComponent, Object.assign({
|
|
682
698
|
googleApiClient: client
|
|
683
699
|
}, props));
|
|
684
700
|
});
|
|
@@ -686,16 +702,16 @@ var withGoogleApiClient = function withGoogleApiClient(WrappedComponent) {
|
|
|
686
702
|
WithGoogleApiClientComponent.displayName = "WithGoogleApiClient(".concat(getDisplayName(WrappedComponent), ")");
|
|
687
703
|
return WithGoogleApiClientComponent;
|
|
688
704
|
};
|
|
689
|
-
var propTypes$
|
|
690
|
-
children:
|
|
705
|
+
var propTypes$8 = {
|
|
706
|
+
children: PropTypes.node.isRequired
|
|
691
707
|
};
|
|
692
|
-
var defaultProps$
|
|
708
|
+
var defaultProps$8 = {};
|
|
693
709
|
var GoogleApiClientProvider = function GoogleApiClientProvider(_ref2) {
|
|
694
710
|
var children = _ref2.children;
|
|
695
711
|
var _useGoogleKeys = useGoogleKeys(),
|
|
696
712
|
apiKey = _useGoogleKeys.apiKey;
|
|
697
713
|
var _useState = React.useState(null),
|
|
698
|
-
_useState2 =
|
|
714
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
699
715
|
client = _useState2[0],
|
|
700
716
|
setClient = _useState2[1];
|
|
701
717
|
React.useEffect(function () {
|
|
@@ -709,14 +725,14 @@ var GoogleApiClientProvider = function GoogleApiClientProvider(_ref2) {
|
|
|
709
725
|
return setClient(gapi);
|
|
710
726
|
});
|
|
711
727
|
}, [apiKey, setClient]);
|
|
712
|
-
return /*#__PURE__*/
|
|
728
|
+
return /*#__PURE__*/React.createElement(GoogleApiClientContext.Provider, {
|
|
713
729
|
value: client
|
|
714
730
|
}, children);
|
|
715
731
|
};
|
|
716
|
-
GoogleApiClientProvider.propTypes = propTypes$
|
|
717
|
-
GoogleApiClientProvider.defaultProps = defaultProps$
|
|
732
|
+
GoogleApiClientProvider.propTypes = propTypes$8;
|
|
733
|
+
GoogleApiClientProvider.defaultProps = defaultProps$8;
|
|
718
734
|
|
|
719
|
-
var GoogleMapsClientContext = /*#__PURE__*/
|
|
735
|
+
var GoogleMapsClientContext = /*#__PURE__*/React.createContext(null);
|
|
720
736
|
var useGoogleMapsClient = function useGoogleMapsClient() {
|
|
721
737
|
return React.useContext(GoogleMapsClientContext);
|
|
722
738
|
};
|
|
@@ -729,8 +745,8 @@ var withGoogleMapsClient = function withGoogleMapsClient(WrappedComponent) {
|
|
|
729
745
|
return displayName || name || 'Component';
|
|
730
746
|
};
|
|
731
747
|
var WithGoogleMapsClientComponent = function WithGoogleMapsClientComponent(props) {
|
|
732
|
-
return /*#__PURE__*/
|
|
733
|
-
return /*#__PURE__*/
|
|
748
|
+
return /*#__PURE__*/React.createElement(GoogleMapsClientContext.Consumer, null, function (client) {
|
|
749
|
+
return /*#__PURE__*/React.createElement(WrappedComponent, Object.assign({
|
|
734
750
|
googleApiClient: client
|
|
735
751
|
}, props));
|
|
736
752
|
});
|
|
@@ -738,12 +754,12 @@ var withGoogleMapsClient = function withGoogleMapsClient(WrappedComponent) {
|
|
|
738
754
|
WithGoogleMapsClientComponent.displayName = "WithGoogleMapsClient(".concat(getDisplayName(WrappedComponent), ")");
|
|
739
755
|
return WithGoogleMapsClientComponent;
|
|
740
756
|
};
|
|
741
|
-
var propTypes$
|
|
742
|
-
children:
|
|
743
|
-
locale:
|
|
744
|
-
libraries:
|
|
757
|
+
var propTypes$7 = {
|
|
758
|
+
children: PropTypes.node.isRequired,
|
|
759
|
+
locale: PropTypes.string,
|
|
760
|
+
libraries: PropTypes.arrayOf(PropTypes.string)
|
|
745
761
|
};
|
|
746
|
-
var defaultProps$
|
|
762
|
+
var defaultProps$7 = {
|
|
747
763
|
locale: 'fr',
|
|
748
764
|
libraries: null
|
|
749
765
|
};
|
|
@@ -755,7 +771,7 @@ var GoogleMapsClientProvider = function GoogleMapsClientProvider(_ref2) {
|
|
|
755
771
|
apiKey = _useGoogleKeys.apiKey;
|
|
756
772
|
var exisitingClient = useGoogleMapsClient();
|
|
757
773
|
var _useState = React.useState(exisitingClient),
|
|
758
|
-
_useState2 =
|
|
774
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
759
775
|
client = _useState2[0],
|
|
760
776
|
setClient = _useState2[1];
|
|
761
777
|
React.useEffect(function () {
|
|
@@ -769,16 +785,16 @@ var GoogleMapsClientProvider = function GoogleMapsClientProvider(_ref2) {
|
|
|
769
785
|
});
|
|
770
786
|
}
|
|
771
787
|
}, [apiKey, locale, libraries, setClient, exisitingClient]);
|
|
772
|
-
return /*#__PURE__*/
|
|
788
|
+
return /*#__PURE__*/React.createElement(GoogleMapsClientContext.Provider, {
|
|
773
789
|
value: client
|
|
774
790
|
}, children);
|
|
775
791
|
};
|
|
776
|
-
GoogleMapsClientProvider.propTypes = propTypes$
|
|
777
|
-
GoogleMapsClientProvider.defaultProps = defaultProps$
|
|
792
|
+
GoogleMapsClientProvider.propTypes = propTypes$7;
|
|
793
|
+
GoogleMapsClientProvider.defaultProps = defaultProps$7;
|
|
778
794
|
|
|
779
795
|
/* eslint-disable react/jsx-props-no-spreading */
|
|
780
796
|
var defaultLocales = ['en', 'fr'];
|
|
781
|
-
var LocalesContext = /*#__PURE__*/
|
|
797
|
+
var LocalesContext = /*#__PURE__*/React.createContext({
|
|
782
798
|
locales: defaultLocales
|
|
783
799
|
});
|
|
784
800
|
var useLocales = function useLocales() {
|
|
@@ -798,11 +814,11 @@ var useOtherLocales = function useOtherLocales() {
|
|
|
798
814
|
}, [locales, locale]);
|
|
799
815
|
return otherLocales;
|
|
800
816
|
};
|
|
801
|
-
var propTypes$
|
|
802
|
-
locales:
|
|
803
|
-
children:
|
|
817
|
+
var propTypes$6 = {
|
|
818
|
+
locales: PropTypes.arrayOf(PropTypes.string),
|
|
819
|
+
children: PropTypes.node.isRequired
|
|
804
820
|
};
|
|
805
|
-
var defaultProps$
|
|
821
|
+
var defaultProps$6 = {
|
|
806
822
|
locales: []
|
|
807
823
|
};
|
|
808
824
|
var LocalesProvider = function LocalesProvider(_ref) {
|
|
@@ -813,42 +829,42 @@ var LocalesProvider = function LocalesProvider(_ref) {
|
|
|
813
829
|
locales: locales
|
|
814
830
|
};
|
|
815
831
|
}, [locales]);
|
|
816
|
-
return /*#__PURE__*/
|
|
832
|
+
return /*#__PURE__*/React.createElement(LocalesContext.Provider, {
|
|
817
833
|
value: value
|
|
818
834
|
}, children);
|
|
819
835
|
};
|
|
820
|
-
LocalesProvider.propTypes = propTypes$
|
|
821
|
-
LocalesProvider.defaultProps = defaultProps$
|
|
836
|
+
LocalesProvider.propTypes = propTypes$6;
|
|
837
|
+
LocalesProvider.defaultProps = defaultProps$6;
|
|
822
838
|
|
|
823
839
|
// import { getDisplayName } from '../utils';
|
|
824
840
|
|
|
825
|
-
var ModalContext = /*#__PURE__*/
|
|
841
|
+
var ModalContext = /*#__PURE__*/React.createContext(null);
|
|
826
842
|
var useModal = function useModal() {
|
|
827
843
|
return React.useContext(ModalContext) || {};
|
|
828
844
|
};
|
|
829
|
-
var propTypes$
|
|
830
|
-
children:
|
|
831
|
-
container:
|
|
845
|
+
var propTypes$5 = {
|
|
846
|
+
children: PropTypes.node.isRequired,
|
|
847
|
+
container: PropTypes.object // eslint-disable-line
|
|
832
848
|
};
|
|
833
|
-
var defaultProps$
|
|
849
|
+
var defaultProps$5 = {
|
|
834
850
|
container: null
|
|
835
851
|
};
|
|
836
852
|
var ModalProvider = function ModalProvider(_ref) {
|
|
837
853
|
var children = _ref.children,
|
|
838
854
|
initialContainer = _ref.container;
|
|
839
855
|
var _useState = React.useState(initialContainer),
|
|
840
|
-
_useState2 =
|
|
856
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
841
857
|
container = _useState2[0],
|
|
842
858
|
setContainer = _useState2[1];
|
|
843
859
|
var _useState3 = React.useState([]),
|
|
844
|
-
_useState4 =
|
|
860
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
845
861
|
modals = _useState4[0],
|
|
846
862
|
setModals = _useState4[1];
|
|
847
863
|
var modalsRef = React.useRef(modals);
|
|
848
864
|
var register = React.useCallback(function (id) {
|
|
849
865
|
var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
850
866
|
var currentModals = modalsRef.current;
|
|
851
|
-
var newModals = [].concat(
|
|
867
|
+
var newModals = [].concat(_toConsumableArray(currentModals), [_objectSpread({
|
|
852
868
|
id: id
|
|
853
869
|
}, data)]);
|
|
854
870
|
setModals(newModals);
|
|
@@ -878,14 +894,14 @@ var ModalProvider = function ModalProvider(_ref) {
|
|
|
878
894
|
unregister: unregister
|
|
879
895
|
};
|
|
880
896
|
}, [modals, container, setContainer, register, unregister]);
|
|
881
|
-
return /*#__PURE__*/
|
|
897
|
+
return /*#__PURE__*/React.createElement(ModalContext.Provider, {
|
|
882
898
|
value: value
|
|
883
899
|
}, children);
|
|
884
900
|
};
|
|
885
|
-
ModalProvider.propTypes = propTypes$
|
|
886
|
-
ModalProvider.defaultProps = defaultProps$
|
|
901
|
+
ModalProvider.propTypes = propTypes$5;
|
|
902
|
+
ModalProvider.defaultProps = defaultProps$5;
|
|
887
903
|
|
|
888
|
-
var PanelsContext = /*#__PURE__*/
|
|
904
|
+
var PanelsContext = /*#__PURE__*/React.createContext({
|
|
889
905
|
container: null
|
|
890
906
|
});
|
|
891
907
|
var usePanels = function usePanels() {
|
|
@@ -893,13 +909,13 @@ var usePanels = function usePanels() {
|
|
|
893
909
|
};
|
|
894
910
|
var withPanels = function withPanels(WrappedComponent) {
|
|
895
911
|
var WithPanelsComponent = function WithPanelsComponent(props) {
|
|
896
|
-
return /*#__PURE__*/
|
|
912
|
+
return /*#__PURE__*/React.createElement(PanelsContext.Consumer, null, function (_ref) {
|
|
897
913
|
var panels = _ref.panels,
|
|
898
914
|
setContainer = _ref.setContainer,
|
|
899
915
|
container = _ref.container,
|
|
900
916
|
register = _ref.register,
|
|
901
917
|
unregister = _ref.unregister;
|
|
902
|
-
return /*#__PURE__*/
|
|
918
|
+
return /*#__PURE__*/React.createElement(WrappedComponent, Object.assign({
|
|
903
919
|
panelsContainer: container,
|
|
904
920
|
setPanelsContainer: setContainer,
|
|
905
921
|
panels: panels,
|
|
@@ -911,29 +927,29 @@ var withPanels = function withPanels(WrappedComponent) {
|
|
|
911
927
|
WithPanelsComponent.displayName = "WithPanels(".concat(utils.getDisplayName(WrappedComponent), ")");
|
|
912
928
|
return WithPanelsComponent;
|
|
913
929
|
};
|
|
914
|
-
var propTypes$
|
|
915
|
-
children:
|
|
916
|
-
container:
|
|
930
|
+
var propTypes$4 = {
|
|
931
|
+
children: PropTypes.node.isRequired,
|
|
932
|
+
container: PropTypes.object // eslint-disable-line
|
|
917
933
|
};
|
|
918
|
-
var defaultProps$
|
|
934
|
+
var defaultProps$4 = {
|
|
919
935
|
container: null
|
|
920
936
|
};
|
|
921
937
|
var PanelsProvider = function PanelsProvider(_ref2) {
|
|
922
938
|
var children = _ref2.children,
|
|
923
939
|
initialContainer = _ref2.container;
|
|
924
940
|
var _useState = React.useState(initialContainer),
|
|
925
|
-
_useState2 =
|
|
941
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
926
942
|
container = _useState2[0],
|
|
927
943
|
setContainer = _useState2[1];
|
|
928
944
|
var _useState3 = React.useState([]),
|
|
929
|
-
_useState4 =
|
|
945
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
930
946
|
panels = _useState4[0],
|
|
931
947
|
setPanels = _useState4[1];
|
|
932
948
|
var panelsRef = React.useRef(panels);
|
|
933
949
|
var register = React.useCallback(function (id) {
|
|
934
950
|
var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
935
951
|
var currentPanels = panelsRef.current;
|
|
936
|
-
var newPanels = [].concat(
|
|
952
|
+
var newPanels = [].concat(_toConsumableArray(currentPanels), [_objectSpread({
|
|
937
953
|
id: id
|
|
938
954
|
}, data)]);
|
|
939
955
|
setPanels(newPanels);
|
|
@@ -963,15 +979,15 @@ var PanelsProvider = function PanelsProvider(_ref2) {
|
|
|
963
979
|
unregister: unregister
|
|
964
980
|
};
|
|
965
981
|
}, [panels, setContainer, container, register, unregister]);
|
|
966
|
-
return /*#__PURE__*/
|
|
982
|
+
return /*#__PURE__*/React.createElement(PanelsContext.Provider, {
|
|
967
983
|
value: value
|
|
968
984
|
}, children);
|
|
969
985
|
};
|
|
970
|
-
PanelsProvider.propTypes = propTypes$
|
|
971
|
-
PanelsProvider.defaultProps = defaultProps$
|
|
986
|
+
PanelsProvider.propTypes = propTypes$4;
|
|
987
|
+
PanelsProvider.defaultProps = defaultProps$4;
|
|
972
988
|
|
|
973
989
|
var _excluded = ["component"];
|
|
974
|
-
var PanneauContext = /*#__PURE__*/
|
|
990
|
+
var PanneauContext = /*#__PURE__*/React.createContext(null);
|
|
975
991
|
var usePanneau = function usePanneau() {
|
|
976
992
|
return React.useContext(PanneauContext);
|
|
977
993
|
};
|
|
@@ -1023,13 +1039,13 @@ var usePanneauComponent = function usePanneauComponent(namespace, name) {
|
|
|
1023
1039
|
components = _ref5$components === void 0 ? {} : _ref5$components;
|
|
1024
1040
|
var path = namespace !== null ? "".concat(namespace, ".").concat(name) : name || null;
|
|
1025
1041
|
var component = components[path] || null;
|
|
1026
|
-
if (
|
|
1042
|
+
if (isString(component)) {
|
|
1027
1043
|
return component;
|
|
1028
1044
|
}
|
|
1029
|
-
if (
|
|
1045
|
+
if (isObject(component) && isString(component === null || component === void 0 ? void 0 : component.componnent)) {
|
|
1030
1046
|
// eslint-disable-next-line no-unused-vars
|
|
1031
1047
|
component.component;
|
|
1032
|
-
|
|
1048
|
+
_objectWithoutProperties(component, _excluded);
|
|
1033
1049
|
return component.component;
|
|
1034
1050
|
}
|
|
1035
1051
|
return null;
|
|
@@ -1046,51 +1062,366 @@ var usePanneauSettings = function usePanneauSettings() {
|
|
|
1046
1062
|
settings = _ref7$settings === void 0 ? {} : _ref7$settings;
|
|
1047
1063
|
return settings;
|
|
1048
1064
|
};
|
|
1049
|
-
var propTypes$
|
|
1065
|
+
var propTypes$3 = {
|
|
1050
1066
|
definition: panneauDefinition.isRequired,
|
|
1051
|
-
children:
|
|
1067
|
+
children: PropTypes.node.isRequired
|
|
1052
1068
|
};
|
|
1053
|
-
var defaultProps$
|
|
1069
|
+
var defaultProps$3 = {};
|
|
1054
1070
|
var PanneauProvider = function PanneauProvider(_ref8) {
|
|
1055
1071
|
var definition = _ref8.definition,
|
|
1056
1072
|
children = _ref8.children;
|
|
1057
|
-
return /*#__PURE__*/
|
|
1073
|
+
return /*#__PURE__*/React.createElement(PanneauContext.Provider, {
|
|
1058
1074
|
value: definition
|
|
1059
1075
|
}, children);
|
|
1060
1076
|
};
|
|
1061
|
-
PanneauProvider.propTypes = propTypes$
|
|
1062
|
-
PanneauProvider.defaultProps = defaultProps$
|
|
1077
|
+
PanneauProvider.propTypes = propTypes$3;
|
|
1078
|
+
PanneauProvider.defaultProps = defaultProps$3;
|
|
1063
1079
|
|
|
1064
1080
|
/* eslint-disable react/jsx-props-no-spreading */
|
|
1065
|
-
var ResourceContext = /*#__PURE__*/
|
|
1081
|
+
var ResourceContext = /*#__PURE__*/React.createContext(null);
|
|
1066
1082
|
var useResource = function useResource() {
|
|
1067
1083
|
return React.useContext(ResourceContext);
|
|
1068
1084
|
};
|
|
1069
|
-
var propTypes$
|
|
1085
|
+
var propTypes$2 = {
|
|
1070
1086
|
resource: resource.isRequired,
|
|
1071
|
-
children:
|
|
1087
|
+
children: PropTypes.node.isRequired
|
|
1072
1088
|
};
|
|
1073
|
-
var defaultProps$
|
|
1089
|
+
var defaultProps$2 = {};
|
|
1074
1090
|
var ResourceProvider = function ResourceProvider(_ref) {
|
|
1075
1091
|
var resource = _ref.resource,
|
|
1076
1092
|
children = _ref.children;
|
|
1077
|
-
return /*#__PURE__*/
|
|
1093
|
+
return /*#__PURE__*/React.createElement(ResourceContext.Provider, {
|
|
1078
1094
|
value: resource
|
|
1079
1095
|
}, children);
|
|
1080
1096
|
};
|
|
1081
|
-
ResourceProvider.propTypes = propTypes$
|
|
1082
|
-
ResourceProvider.defaultProps = defaultProps$
|
|
1097
|
+
ResourceProvider.propTypes = propTypes$2;
|
|
1098
|
+
ResourceProvider.defaultProps = defaultProps$2;
|
|
1099
|
+
|
|
1100
|
+
// React.useInsertionEffect is not available in React <18
|
|
1101
|
+
var useEffect = React__namespace.useEffect,
|
|
1102
|
+
useLayoutEffect = React__namespace.useLayoutEffect,
|
|
1103
|
+
useRef = React__namespace.useRef,
|
|
1104
|
+
useBuiltinInsertionEffect = React__namespace.useInsertionEffect;
|
|
1105
|
+
|
|
1106
|
+
// Copied from:
|
|
1107
|
+
// https://github.com/facebook/react/blob/main/packages/shared/ExecutionEnvironment.js
|
|
1108
|
+
var canUseDOM = !!(typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined");
|
|
1109
|
+
|
|
1110
|
+
// Copied from:
|
|
1111
|
+
// https://github.com/reduxjs/react-redux/blob/master/src/utils/useIsomorphicLayoutEffect.ts
|
|
1112
|
+
// "React currently throws a warning when using useLayoutEffect on the server.
|
|
1113
|
+
// To get around it, we can conditionally useEffect on the server (no-op) and
|
|
1114
|
+
// useLayoutEffect in the browser."
|
|
1115
|
+
var useIsomorphicLayoutEffect = canUseDOM ? useLayoutEffect : useEffect;
|
|
1116
|
+
|
|
1117
|
+
// useInsertionEffect is already a noop on the server.
|
|
1118
|
+
// See: https://github.com/facebook/react/blob/main/packages/react-server/src/ReactFizzHooks.js
|
|
1119
|
+
var useInsertionEffect = useBuiltinInsertionEffect || useIsomorphicLayoutEffect;
|
|
1120
|
+
|
|
1121
|
+
// Userland polyfill while we wait for the forthcoming
|
|
1122
|
+
// https://github.com/reactjs/rfcs/blob/useevent/text/0000-useevent.md
|
|
1123
|
+
// Note: "A high-fidelity polyfill for useEvent is not possible because
|
|
1124
|
+
// there is no lifecycle or Hook in React that we can use to switch
|
|
1125
|
+
// .current at the right timing."
|
|
1126
|
+
// So we will have to make do with this "close enough" approach for now.
|
|
1127
|
+
var useEvent = function useEvent(fn) {
|
|
1128
|
+
var ref = useRef([fn, function () {
|
|
1129
|
+
return ref[0].apply(ref, arguments);
|
|
1130
|
+
}]).current;
|
|
1131
|
+
// Per Dan Abramov: useInsertionEffect executes marginally closer to the
|
|
1132
|
+
// correct timing for ref synchronization than useLayoutEffect on React 18.
|
|
1133
|
+
// See: https://github.com/facebook/react/pull/25881#issuecomment-1356244360
|
|
1134
|
+
useInsertionEffect(function () {
|
|
1135
|
+
ref[0] = fn;
|
|
1136
|
+
});
|
|
1137
|
+
return ref[1];
|
|
1138
|
+
};
|
|
1139
|
+
|
|
1140
|
+
/**
|
|
1141
|
+
* History API docs @see https://developer.mozilla.org/en-US/docs/Web/API/History
|
|
1142
|
+
*/
|
|
1143
|
+
var eventPopstate = "popstate";
|
|
1144
|
+
var eventPushState = "pushState";
|
|
1145
|
+
var eventReplaceState = "replaceState";
|
|
1146
|
+
var eventHashchange = "hashchange";
|
|
1147
|
+
var events = [eventPopstate, eventPushState, eventReplaceState, eventHashchange];
|
|
1148
|
+
var subscribeToLocationUpdates = function subscribeToLocationUpdates(callback) {
|
|
1149
|
+
for (var _i = 0, _events = events; _i < _events.length; _i++) {
|
|
1150
|
+
var event = _events[_i];
|
|
1151
|
+
addEventListener(event, callback);
|
|
1152
|
+
}
|
|
1153
|
+
return function () {
|
|
1154
|
+
for (var _i2 = 0, _events2 = events; _i2 < _events2.length; _i2++) {
|
|
1155
|
+
var _event = _events2[_i2];
|
|
1156
|
+
removeEventListener(_event, callback);
|
|
1157
|
+
}
|
|
1158
|
+
};
|
|
1159
|
+
};
|
|
1160
|
+
var useLocationProperty = function useLocationProperty(fn, ssrFn) {
|
|
1161
|
+
return index_js.useSyncExternalStore(subscribeToLocationUpdates, fn, ssrFn);
|
|
1162
|
+
};
|
|
1163
|
+
var currentSearch = function currentSearch() {
|
|
1164
|
+
return location.search;
|
|
1165
|
+
};
|
|
1166
|
+
var useSearch = function useSearch() {
|
|
1167
|
+
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
1168
|
+
_ref$ssrSearch = _ref.ssrSearch,
|
|
1169
|
+
ssrSearch = _ref$ssrSearch === void 0 ? "" : _ref$ssrSearch;
|
|
1170
|
+
return useLocationProperty(currentSearch, function () {
|
|
1171
|
+
return ssrSearch;
|
|
1172
|
+
});
|
|
1173
|
+
};
|
|
1174
|
+
var currentPathname = function currentPathname() {
|
|
1175
|
+
return location.pathname;
|
|
1176
|
+
};
|
|
1177
|
+
var usePathname = function usePathname() {
|
|
1178
|
+
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
1179
|
+
ssrPath = _ref2.ssrPath;
|
|
1180
|
+
return useLocationProperty(currentPathname, ssrPath ? function () {
|
|
1181
|
+
return ssrPath;
|
|
1182
|
+
} : currentPathname);
|
|
1183
|
+
};
|
|
1184
|
+
var navigate = function navigate(to) {
|
|
1185
|
+
var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
1186
|
+
_ref3$replace = _ref3.replace,
|
|
1187
|
+
replace = _ref3$replace === void 0 ? false : _ref3$replace,
|
|
1188
|
+
_ref3$state = _ref3.state,
|
|
1189
|
+
state = _ref3$state === void 0 ? null : _ref3$state;
|
|
1190
|
+
return history[replace ? eventReplaceState : eventPushState](state, "", to);
|
|
1191
|
+
};
|
|
1192
|
+
|
|
1193
|
+
// the 2nd argument of the `useBrowserLocation` return value is a function
|
|
1194
|
+
// that allows to perform a navigation.
|
|
1195
|
+
var useBrowserLocation = function useBrowserLocation() {
|
|
1196
|
+
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1197
|
+
return [usePathname(opts), navigate];
|
|
1198
|
+
};
|
|
1199
|
+
var patchKey = Symbol["for"]("wouter_v3");
|
|
1200
|
+
|
|
1201
|
+
// While History API does have `popstate` event, the only
|
|
1202
|
+
// proper way to listen to changes via `push/replaceState`
|
|
1203
|
+
// is to monkey-patch these methods.
|
|
1204
|
+
//
|
|
1205
|
+
// See https://stackoverflow.com/a/4585031
|
|
1206
|
+
if (typeof history !== "undefined" && typeof window[patchKey] === "undefined") {
|
|
1207
|
+
var _loop = function _loop() {
|
|
1208
|
+
var type = _arr[_i3];
|
|
1209
|
+
var original = history[type];
|
|
1210
|
+
// TODO: we should be using unstable_batchedUpdates to avoid multiple re-renders,
|
|
1211
|
+
// however that will require an additional peer dependency on react-dom.
|
|
1212
|
+
// See: https://github.com/reactwg/react-18/discussions/86#discussioncomment-1567149
|
|
1213
|
+
history[type] = function () {
|
|
1214
|
+
var result = original.apply(this, arguments);
|
|
1215
|
+
var event = new Event(type);
|
|
1216
|
+
event.arguments = arguments;
|
|
1217
|
+
dispatchEvent(event);
|
|
1218
|
+
return result;
|
|
1219
|
+
};
|
|
1220
|
+
};
|
|
1221
|
+
for (var _i3 = 0, _arr = [eventPushState, eventReplaceState]; _i3 < _arr.length; _i3++) {
|
|
1222
|
+
_loop();
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
// patch history object only once
|
|
1226
|
+
// See: https://github.com/molefrog/wouter/issues/167
|
|
1227
|
+
Object.defineProperty(window, patchKey, {
|
|
1228
|
+
value: true
|
|
1229
|
+
});
|
|
1230
|
+
}
|
|
1231
|
+
|
|
1232
|
+
var _excluded3 = ["to", "href", "onClick", "asChild", "children", "replace", "state"];
|
|
1233
|
+
|
|
1234
|
+
/*
|
|
1235
|
+
* Transforms `path` into its relative `base` version
|
|
1236
|
+
* If base isn't part of the path provided returns absolute path e.g. `~/app`
|
|
1237
|
+
*/
|
|
1238
|
+
var relativePath = function relativePath() {
|
|
1239
|
+
var base = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
|
|
1240
|
+
var path = arguments.length > 1 ? arguments[1] : undefined;
|
|
1241
|
+
return !path.toLowerCase().indexOf(base.toLowerCase()) ? path.slice(base.length) || "/" : "~" + path;
|
|
1242
|
+
};
|
|
1243
|
+
var absolutePath = function absolutePath(to) {
|
|
1244
|
+
var base = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
1245
|
+
return to[0] === "~" ? to.slice(1) : base + to;
|
|
1246
|
+
};
|
|
1247
|
+
|
|
1248
|
+
/*
|
|
1249
|
+
* decodes escape sequences such as %20
|
|
1250
|
+
*/
|
|
1251
|
+
var unescape = function unescape(str) {
|
|
1252
|
+
try {
|
|
1253
|
+
return decodeURI(str);
|
|
1254
|
+
} catch (_e) {
|
|
1255
|
+
// fail-safe mode: if string can't be decoded do nothing
|
|
1256
|
+
return str;
|
|
1257
|
+
}
|
|
1258
|
+
};
|
|
1259
|
+
|
|
1260
|
+
/*
|
|
1261
|
+
* Router and router context. Router is a lightweight object that represents the current
|
|
1262
|
+
* routing options: how location is managed, base path etc.
|
|
1263
|
+
*
|
|
1264
|
+
* There is a default router present for most of the use cases, however it can be overridden
|
|
1265
|
+
* via the <Router /> component.
|
|
1266
|
+
*/
|
|
1267
|
+
|
|
1268
|
+
var defaultRouter = {
|
|
1269
|
+
hook: useBrowserLocation,
|
|
1270
|
+
searchHook: useSearch,
|
|
1271
|
+
parser: regexparam.parse,
|
|
1272
|
+
base: "",
|
|
1273
|
+
// this option is used to override the current location during SSR
|
|
1274
|
+
ssrPath: undefined,
|
|
1275
|
+
ssrSearch: undefined
|
|
1276
|
+
};
|
|
1277
|
+
var RouterCtx = React.createContext(defaultRouter);
|
|
1278
|
+
|
|
1279
|
+
// gets the closest parent router from the context
|
|
1280
|
+
var useRouter = function useRouter() {
|
|
1281
|
+
return React.useContext(RouterCtx);
|
|
1282
|
+
};
|
|
1283
|
+
|
|
1284
|
+
/**
|
|
1285
|
+
* Parameters context. Used by `useParams()` to get the
|
|
1286
|
+
* matched params from the innermost `Route` component.
|
|
1287
|
+
*/
|
|
1288
|
+
|
|
1289
|
+
React.createContext({});
|
|
1290
|
+
|
|
1291
|
+
/*
|
|
1292
|
+
* Part 1, Hooks API: useRoute and useLocation
|
|
1293
|
+
*/
|
|
1294
|
+
|
|
1295
|
+
// Internal version of useLocation to avoid redundant useRouter calls
|
|
1296
|
+
|
|
1297
|
+
var useLocationFromRouter = function useLocationFromRouter(router) {
|
|
1298
|
+
var _router$hook = router.hook(router),
|
|
1299
|
+
_router$hook2 = _slicedToArray(_router$hook, 2),
|
|
1300
|
+
location = _router$hook2[0],
|
|
1301
|
+
navigate = _router$hook2[1];
|
|
1302
|
+
|
|
1303
|
+
// the function reference should stay the same between re-renders, so that
|
|
1304
|
+
// it can be passed down as an element prop without any performance concerns.
|
|
1305
|
+
// (This is achieved via `useEvent`.)
|
|
1306
|
+
return [unescape(relativePath(router.base, location)), useEvent(function (to, navOpts) {
|
|
1307
|
+
return navigate(absolutePath(to, router.base), navOpts);
|
|
1308
|
+
})];
|
|
1309
|
+
};
|
|
1310
|
+
var useLocation = function useLocation() {
|
|
1311
|
+
return useLocationFromRouter(useRouter());
|
|
1312
|
+
};
|
|
1313
|
+
React.forwardRef(function (props, ref) {
|
|
1314
|
+
var router = useRouter();
|
|
1315
|
+
var _useLocationFromRoute3 = useLocationFromRouter(router),
|
|
1316
|
+
_useLocationFromRoute4 = _slicedToArray(_useLocationFromRoute3, 2),
|
|
1317
|
+
navigate = _useLocationFromRoute4[1];
|
|
1318
|
+
var to = props.to,
|
|
1319
|
+
_props$href = props.href,
|
|
1320
|
+
_href = _props$href === void 0 ? to : _props$href,
|
|
1321
|
+
_onClick = props.onClick,
|
|
1322
|
+
asChild = props.asChild,
|
|
1323
|
+
children = props.children;
|
|
1324
|
+
props.replace;
|
|
1325
|
+
props.state;
|
|
1326
|
+
var restProps = _objectWithoutProperties(props, _excluded3);
|
|
1327
|
+
var onClick = useEvent(function (event) {
|
|
1328
|
+
// ignores the navigation when clicked using right mouse button or
|
|
1329
|
+
// by holding a special modifier key: ctrl, command, win, alt, shift
|
|
1330
|
+
if (event.ctrlKey || event.metaKey || event.altKey || event.shiftKey || event.button !== 0) return;
|
|
1331
|
+
_onClick && _onClick(event); // TODO: is it safe to use _onClick?.(event)
|
|
1332
|
+
if (!event.defaultPrevented) {
|
|
1333
|
+
event.preventDefault();
|
|
1334
|
+
navigate(_href, props);
|
|
1335
|
+
}
|
|
1336
|
+
});
|
|
1337
|
+
|
|
1338
|
+
// handle nested routers and absolute paths
|
|
1339
|
+
var href = _href[0] === "~" ? _href.slice(1) : router.base + _href;
|
|
1340
|
+
return asChild && React.isValidElement(children) ? React.cloneElement(children, {
|
|
1341
|
+
href: href,
|
|
1342
|
+
onClick: onClick
|
|
1343
|
+
}) : React.createElement("a", _objectSpread(_objectSpread({}, restProps), {}, {
|
|
1344
|
+
href: href,
|
|
1345
|
+
onClick: onClick,
|
|
1346
|
+
children: children,
|
|
1347
|
+
ref: ref
|
|
1348
|
+
}));
|
|
1349
|
+
});
|
|
1350
|
+
|
|
1351
|
+
/* eslint-disable react/jsx-props-no-spreading */
|
|
1352
|
+
var RoutesContext = /*#__PURE__*/React.createContext(null);
|
|
1353
|
+
var useRoutesContext = function useRoutesContext() {
|
|
1354
|
+
return React.useContext(RoutesContext);
|
|
1355
|
+
};
|
|
1356
|
+
var propTypes$1 = {
|
|
1357
|
+
children: PropTypes.node.isRequired,
|
|
1358
|
+
routes: PropTypes.objectOf(PropTypes.string).isRequired,
|
|
1359
|
+
basePath: PropTypes.string
|
|
1360
|
+
};
|
|
1361
|
+
var defaultProps$1 = {
|
|
1362
|
+
basePath: null
|
|
1363
|
+
};
|
|
1364
|
+
function RoutesProvider(_ref) {
|
|
1365
|
+
var routes = _ref.routes,
|
|
1366
|
+
basePath = _ref.basePath,
|
|
1367
|
+
children = _ref.children;
|
|
1368
|
+
var value = React.useMemo(function () {
|
|
1369
|
+
return {
|
|
1370
|
+
routes: routes,
|
|
1371
|
+
basePath: basePath
|
|
1372
|
+
};
|
|
1373
|
+
}, [routes, basePath]);
|
|
1374
|
+
return /*#__PURE__*/jsxRuntime.jsx(RoutesContext.Provider, {
|
|
1375
|
+
value: value,
|
|
1376
|
+
children: children
|
|
1377
|
+
});
|
|
1378
|
+
}
|
|
1379
|
+
RoutesProvider.propTypes = propTypes$1;
|
|
1380
|
+
RoutesProvider.defaultProps = defaultProps$1;
|
|
1381
|
+
var compilers = {};
|
|
1382
|
+
function generatePath(fullPath, data) {
|
|
1383
|
+
var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
1384
|
+
var fullUrlMatches = fullPath.match(/^(https?:\/\/[^/]+)\//);
|
|
1385
|
+
if (typeof compilers[fullPath] === 'undefined') {
|
|
1386
|
+
compilers[fullPath] = pathToRegexp.compile(fullPath.replace(/^(https?:\/\/[^/]+)\//, '/'), opts);
|
|
1387
|
+
}
|
|
1388
|
+
var compiler = compilers[fullPath];
|
|
1389
|
+
return fullUrlMatches !== null ? "".concat(fullUrlMatches[1].substr(0, -1)).concat(compiler(data)) : compiler(data);
|
|
1390
|
+
}
|
|
1391
|
+
var useUrlGeneratorPathToRepexp = function useUrlGeneratorPathToRepexp() {
|
|
1392
|
+
var _ref2 = useRoutesContext() || {},
|
|
1393
|
+
_ref2$routes = _ref2.routes,
|
|
1394
|
+
routes = _ref2$routes === void 0 ? null : _ref2$routes,
|
|
1395
|
+
_ref2$basePath = _ref2.basePath,
|
|
1396
|
+
basePath = _ref2$basePath === void 0 ? null : _ref2$basePath;
|
|
1397
|
+
var urlGenerator = React.useCallback(function (key, data, opts) {
|
|
1398
|
+
var path = routes !== null ? routes[key] || null : null;
|
|
1399
|
+
if (path === null) {
|
|
1400
|
+
return null;
|
|
1401
|
+
}
|
|
1402
|
+
var url = generatePath(path, data, opts);
|
|
1403
|
+
return basePath !== null ? "".concat(basePath.replace(/\/$/, ''), "/").concat(url.replace(/^\//, '')) : url;
|
|
1404
|
+
}, [routes, basePath]);
|
|
1405
|
+
return urlGenerator;
|
|
1406
|
+
};
|
|
1407
|
+
var useUrlGeneratorPathToRegexp = useUrlGeneratorPathToRepexp;
|
|
1408
|
+
var useRoutes = function useRoutes() {
|
|
1409
|
+
var _useRoutesContext = useRoutesContext(),
|
|
1410
|
+
routes = _useRoutesContext.routes;
|
|
1411
|
+
return routes;
|
|
1412
|
+
};
|
|
1413
|
+
var useRoutes$1 = useRoutes;
|
|
1083
1414
|
|
|
1084
1415
|
var useRoutePush = function useRoutePush() {
|
|
1085
|
-
var url =
|
|
1086
|
-
var _useLocation =
|
|
1087
|
-
_useLocation2 =
|
|
1416
|
+
var url = useUrlGeneratorPathToRegexp();
|
|
1417
|
+
var _useLocation = useLocation(),
|
|
1418
|
+
_useLocation2 = _slicedToArray(_useLocation, 2),
|
|
1088
1419
|
navigate = _useLocation2[1];
|
|
1089
1420
|
var push = React.useCallback(function (route, data) {
|
|
1090
1421
|
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
1091
1422
|
args[_key - 2] = arguments[_key];
|
|
1092
1423
|
}
|
|
1093
|
-
if (
|
|
1424
|
+
if (isString(route)) {
|
|
1094
1425
|
navigate.apply(void 0, [url(route, data)].concat(args));
|
|
1095
1426
|
} else {
|
|
1096
1427
|
var _ref = route || {},
|
|
@@ -1104,9 +1435,9 @@ var useRoutePush = function useRoutePush() {
|
|
|
1104
1435
|
return push;
|
|
1105
1436
|
};
|
|
1106
1437
|
var useRouteBack = function useRouteBack() {
|
|
1107
|
-
var url =
|
|
1108
|
-
var _useLocation3 =
|
|
1109
|
-
_useLocation4 =
|
|
1438
|
+
var url = useUrlGeneratorPathToRegexp();
|
|
1439
|
+
var _useLocation3 = useLocation(),
|
|
1440
|
+
_useLocation4 = _slicedToArray(_useLocation3, 2),
|
|
1110
1441
|
navigate = _useLocation4[1];
|
|
1111
1442
|
var back = React.useCallback(function () {
|
|
1112
1443
|
return navigate(-1);
|
|
@@ -1119,7 +1450,7 @@ var useTracking = function useTracking() {
|
|
|
1119
1450
|
return React.useContext(tracking.TrackingContext);
|
|
1120
1451
|
};
|
|
1121
1452
|
var propTypes = {
|
|
1122
|
-
children:
|
|
1453
|
+
children: PropTypes.node.isRequired,
|
|
1123
1454
|
variables: core.PropTypes.trackingVariables
|
|
1124
1455
|
};
|
|
1125
1456
|
var defaultProps = {
|
|
@@ -1138,30 +1469,14 @@ var TrackingProvider = function TrackingProvider(_ref) {
|
|
|
1138
1469
|
variables: variables
|
|
1139
1470
|
});
|
|
1140
1471
|
}, [contextTracking, variables]);
|
|
1141
|
-
return /*#__PURE__*/
|
|
1472
|
+
return /*#__PURE__*/React.createElement(tracking.TrackingContainer, {
|
|
1142
1473
|
tracking: tracking$1
|
|
1143
1474
|
}, children);
|
|
1144
1475
|
};
|
|
1145
1476
|
TrackingProvider.propTypes = propTypes;
|
|
1146
1477
|
TrackingProvider.defaultProps = defaultProps;
|
|
1147
1478
|
|
|
1148
|
-
Object.defineProperty(exports,
|
|
1149
|
-
enumerable: true,
|
|
1150
|
-
get: function () { return routes$1.RoutesContext; }
|
|
1151
|
-
});
|
|
1152
|
-
Object.defineProperty(exports, 'RoutesProvider', {
|
|
1153
|
-
enumerable: true,
|
|
1154
|
-
get: function () { return routes$1.RoutesProvider; }
|
|
1155
|
-
});
|
|
1156
|
-
Object.defineProperty(exports, 'useRoutes', {
|
|
1157
|
-
enumerable: true,
|
|
1158
|
-
get: function () { return routes$1.useRoutes; }
|
|
1159
|
-
});
|
|
1160
|
-
Object.defineProperty(exports, 'useUrlGenerator', {
|
|
1161
|
-
enumerable: true,
|
|
1162
|
-
get: function () { return routes$1.useUrlGenerator; }
|
|
1163
|
-
});
|
|
1164
|
-
Object.defineProperty(exports, 'TrackingContext', {
|
|
1479
|
+
Object.defineProperty(exports, "TrackingContext", {
|
|
1165
1480
|
enumerable: true,
|
|
1166
1481
|
get: function () { return tracking.TrackingContext; }
|
|
1167
1482
|
});
|
|
@@ -1197,6 +1512,8 @@ exports.PanelsContext = PanelsContext;
|
|
|
1197
1512
|
exports.PanelsProvider = PanelsProvider;
|
|
1198
1513
|
exports.PanneauProvider = PanneauProvider;
|
|
1199
1514
|
exports.ResourceProvider = ResourceProvider;
|
|
1515
|
+
exports.RoutesContext = RoutesContext;
|
|
1516
|
+
exports.RoutesProvider = RoutesProvider;
|
|
1200
1517
|
exports.TrackingProvider = TrackingProvider;
|
|
1201
1518
|
exports.useActionComponent = useActionComponent;
|
|
1202
1519
|
exports.useActionsComponents = useActionsComponents;
|
|
@@ -1259,7 +1576,9 @@ exports.usePanneauSettings = usePanneauSettings;
|
|
|
1259
1576
|
exports.useResource = useResource;
|
|
1260
1577
|
exports.useRouteBack = useRouteBack;
|
|
1261
1578
|
exports.useRoutePush = useRoutePush;
|
|
1579
|
+
exports.useRoutes = useRoutes$1;
|
|
1262
1580
|
exports.useTracking = useTracking;
|
|
1581
|
+
exports.useUrlGenerator = useUrlGeneratorPathToRegexp;
|
|
1263
1582
|
exports.withGoogleApiClient = withGoogleApiClient;
|
|
1264
1583
|
exports.withGoogleMapsClient = withGoogleMapsClient;
|
|
1265
1584
|
exports.withPanels = withPanels;
|