@panneau/core 3.0.119 → 3.0.126
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/index.js +37 -39
- package/lib/contexts.js +580 -271
- package/lib/hooks.js +55 -88
- package/lib/index.js +277 -233
- package/lib/utils.js +129 -66
- package/package.json +5 -5
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,165 @@ 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
|
-
|
|
408
|
+
PropTypes.arrayOf(modal);
|
|
403
409
|
|
|
404
410
|
//
|
|
405
411
|
|
|
406
412
|
/* eslint-disable react/jsx-props-no-spreading */
|
|
407
|
-
var DefinitionContext = /*#__PURE__*/
|
|
413
|
+
var DefinitionContext = /*#__PURE__*/React.createContext(null);
|
|
408
414
|
var useDefinitionContext = function useDefinitionContext() {
|
|
409
415
|
return React.useContext(DefinitionContext);
|
|
410
416
|
};
|
|
@@ -414,22 +420,22 @@ var useDefinition = function useDefinition() {
|
|
|
414
420
|
definition = _useDefinitionContext2 === void 0 ? null : _useDefinitionContext2;
|
|
415
421
|
return definition;
|
|
416
422
|
};
|
|
417
|
-
var propTypes$
|
|
423
|
+
var propTypes$d = {
|
|
418
424
|
definition: definition.isRequired,
|
|
419
|
-
children:
|
|
425
|
+
children: PropTypes.node.isRequired
|
|
420
426
|
};
|
|
421
|
-
var defaultProps$
|
|
427
|
+
var defaultProps$d = {};
|
|
422
428
|
var DefinitionProvider = function DefinitionProvider(_ref) {
|
|
423
429
|
var definition = _ref.definition,
|
|
424
430
|
children = _ref.children;
|
|
425
|
-
return /*#__PURE__*/
|
|
431
|
+
return /*#__PURE__*/React.createElement(DefinitionContext.Provider, {
|
|
426
432
|
value: definition
|
|
427
433
|
}, children);
|
|
428
434
|
};
|
|
429
|
-
DefinitionProvider.propTypes = propTypes$
|
|
430
|
-
DefinitionProvider.defaultProps = defaultProps$
|
|
435
|
+
DefinitionProvider.propTypes = propTypes$d;
|
|
436
|
+
DefinitionProvider.defaultProps = defaultProps$d;
|
|
431
437
|
|
|
432
|
-
var FieldsContext = /*#__PURE__*/
|
|
438
|
+
var FieldsContext = /*#__PURE__*/React.createContext(null);
|
|
433
439
|
var useFieldsManager = function useFieldsManager() {
|
|
434
440
|
return React.useContext(FieldsContext);
|
|
435
441
|
};
|
|
@@ -441,12 +447,12 @@ var useFields = function useFields() {
|
|
|
441
447
|
var manager = useFieldsManager();
|
|
442
448
|
return manager.getDefinitions();
|
|
443
449
|
};
|
|
444
|
-
var propTypes$
|
|
450
|
+
var propTypes$c = {
|
|
445
451
|
fields: core.PropTypes.fields,
|
|
446
|
-
manager:
|
|
447
|
-
children:
|
|
452
|
+
manager: PropTypes.instanceOf(core.FieldsManager),
|
|
453
|
+
children: PropTypes.node.isRequired
|
|
448
454
|
};
|
|
449
|
-
var defaultProps$
|
|
455
|
+
var defaultProps$c = {
|
|
450
456
|
fields: null,
|
|
451
457
|
manager: null
|
|
452
458
|
};
|
|
@@ -456,7 +462,7 @@ var FieldsProvider = function FieldsProvider(_ref) {
|
|
|
456
462
|
children = _ref.children;
|
|
457
463
|
var previousManager = useFieldsManager() || null;
|
|
458
464
|
var finalManager = React.useMemo(function () {
|
|
459
|
-
var newFields =
|
|
465
|
+
var newFields = uniqBy([].concat(_toConsumableArray(fields || []), _toConsumableArray(manager !== null ? manager.getDefinitions() : []), _toConsumableArray(previousManager !== null ? previousManager.getDefinitions() : [])), function (_ref2) {
|
|
460
466
|
var id = _ref2.id;
|
|
461
467
|
return id;
|
|
462
468
|
}).reverse();
|
|
@@ -466,31 +472,31 @@ var FieldsProvider = function FieldsProvider(_ref) {
|
|
|
466
472
|
var newComponents = finalManager.getComponents();
|
|
467
473
|
return Object.keys(newComponents).reduce(function (map, id) {
|
|
468
474
|
var component = newComponents[id];
|
|
469
|
-
return
|
|
475
|
+
return isString(component) ? map : _objectSpread(_objectSpread({}, map), {}, _defineProperty({}, id, component));
|
|
470
476
|
}, {});
|
|
471
477
|
}, [finalManager]);
|
|
472
|
-
return /*#__PURE__*/
|
|
478
|
+
return /*#__PURE__*/React.createElement(FieldsContext.Provider, {
|
|
473
479
|
value: finalManager
|
|
474
|
-
}, /*#__PURE__*/
|
|
480
|
+
}, /*#__PURE__*/React.createElement(ComponentsProvider, {
|
|
475
481
|
namespace: FIELDS_NAMESPACE,
|
|
476
482
|
components: components
|
|
477
483
|
}, children));
|
|
478
484
|
};
|
|
479
|
-
FieldsProvider.propTypes = propTypes$
|
|
480
|
-
FieldsProvider.defaultProps = defaultProps$
|
|
485
|
+
FieldsProvider.propTypes = propTypes$c;
|
|
486
|
+
FieldsProvider.defaultProps = defaultProps$c;
|
|
481
487
|
|
|
482
488
|
/* eslint-disable react/jsx-props-no-spreading */
|
|
483
|
-
var GoogleKeysContext = /*#__PURE__*/
|
|
489
|
+
var GoogleKeysContext = /*#__PURE__*/React.createContext({
|
|
484
490
|
apiKey: null
|
|
485
491
|
});
|
|
486
492
|
var useGoogleKeys = function useGoogleKeys() {
|
|
487
493
|
return React.useContext(GoogleKeysContext);
|
|
488
494
|
};
|
|
489
|
-
var propTypes$
|
|
490
|
-
children:
|
|
491
|
-
apiKey:
|
|
495
|
+
var propTypes$b = {
|
|
496
|
+
children: PropTypes.node.isRequired,
|
|
497
|
+
apiKey: PropTypes.string // .isRequired,
|
|
492
498
|
};
|
|
493
|
-
var defaultProps$
|
|
499
|
+
var defaultProps$b = {
|
|
494
500
|
apiKey: null
|
|
495
501
|
};
|
|
496
502
|
var GoogleKeysProvider = function GoogleKeysProvider(_ref) {
|
|
@@ -503,14 +509,14 @@ var GoogleKeysProvider = function GoogleKeysProvider(_ref) {
|
|
|
503
509
|
apiKey: apiKey || previousApiKey
|
|
504
510
|
};
|
|
505
511
|
}, [previousApiKey, apiKey]);
|
|
506
|
-
return /*#__PURE__*/
|
|
512
|
+
return /*#__PURE__*/React.createElement(GoogleKeysContext.Provider, {
|
|
507
513
|
value: value
|
|
508
514
|
}, children);
|
|
509
515
|
};
|
|
510
|
-
GoogleKeysProvider.propTypes = propTypes$
|
|
511
|
-
GoogleKeysProvider.defaultProps = defaultProps$
|
|
516
|
+
GoogleKeysProvider.propTypes = propTypes$b;
|
|
517
|
+
GoogleKeysProvider.defaultProps = defaultProps$b;
|
|
512
518
|
|
|
513
|
-
var FontsContext = /*#__PURE__*/
|
|
519
|
+
var FontsContext = /*#__PURE__*/React.createContext({
|
|
514
520
|
systemFonts: null,
|
|
515
521
|
googleFonts: null,
|
|
516
522
|
customFonts: null
|
|
@@ -524,7 +530,7 @@ var useGoogleFonts = function useGoogleFonts() {
|
|
|
524
530
|
var _useGoogleKeys = useGoogleKeys(),
|
|
525
531
|
apiKey = _useGoogleKeys.apiKey;
|
|
526
532
|
var _useState = React.useState(null),
|
|
527
|
-
_useState2 =
|
|
533
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
528
534
|
googleFonts = _useState2[0],
|
|
529
535
|
setGoogleFonts = _useState2[1];
|
|
530
536
|
React.useEffect(function () {
|
|
@@ -581,12 +587,12 @@ var useFonts = function useFonts() {
|
|
|
581
587
|
}, [systemFonts, googleFonts, customFonts]);
|
|
582
588
|
return fonts;
|
|
583
589
|
};
|
|
584
|
-
var propTypes$
|
|
585
|
-
children:
|
|
590
|
+
var propTypes$a = {
|
|
591
|
+
children: PropTypes.node.isRequired,
|
|
586
592
|
systemFonts: core.PropTypes.fonts,
|
|
587
593
|
customFonts: core.PropTypes.fonts
|
|
588
594
|
};
|
|
589
|
-
var defaultProps$
|
|
595
|
+
var defaultProps$a = {
|
|
590
596
|
systemFonts: ['Arial', 'Courier', 'Georgia', 'Times New Roman', 'Verdana'],
|
|
591
597
|
customFonts: null
|
|
592
598
|
};
|
|
@@ -601,32 +607,32 @@ var FontsProvider = function FontsProvider(_ref4) {
|
|
|
601
607
|
previousGoogleFonts = _useFonts$googleFonts === void 0 ? null : _useFonts$googleFonts,
|
|
602
608
|
previousCustomFonts = _useFonts.customFonts;
|
|
603
609
|
var _useState3 = React.useState(null),
|
|
604
|
-
_useState4 =
|
|
610
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
605
611
|
googleFonts = _useState4[0],
|
|
606
612
|
setGoogleFonts = _useState4[1];
|
|
607
613
|
var fonts = React.useMemo(function () {
|
|
608
614
|
return {
|
|
609
|
-
systemFonts:
|
|
610
|
-
return
|
|
615
|
+
systemFonts: uniqBy([].concat(_toConsumableArray(previousSystemFonts || []), _toConsumableArray(systemFonts || [])), function (font) {
|
|
616
|
+
return isObject(font) ? font.name : font;
|
|
611
617
|
}),
|
|
612
|
-
googleFonts:
|
|
613
|
-
return
|
|
618
|
+
googleFonts: uniqBy([].concat(_toConsumableArray(previousGoogleFonts || []), _toConsumableArray(googleFonts || [])), function (font) {
|
|
619
|
+
return isObject(font) ? font.name : font;
|
|
614
620
|
}),
|
|
615
|
-
customFonts:
|
|
616
|
-
return
|
|
621
|
+
customFonts: uniqBy([].concat(_toConsumableArray(previousCustomFonts || []), _toConsumableArray(customFonts || [])), function (font) {
|
|
622
|
+
return isObject(font) ? font.name : font;
|
|
617
623
|
}),
|
|
618
624
|
setGoogleFonts: setGoogleFonts
|
|
619
625
|
};
|
|
620
626
|
}, [previousSystemFonts, previousGoogleFonts, previousCustomFonts, customFonts, systemFonts, googleFonts, setGoogleFonts]);
|
|
621
|
-
return /*#__PURE__*/
|
|
627
|
+
return /*#__PURE__*/React.createElement(FontsContext.Provider, {
|
|
622
628
|
value: fonts
|
|
623
629
|
}, children);
|
|
624
630
|
};
|
|
625
|
-
FontsProvider.propTypes = propTypes$
|
|
626
|
-
FontsProvider.defaultProps = defaultProps$
|
|
631
|
+
FontsProvider.propTypes = propTypes$a;
|
|
632
|
+
FontsProvider.defaultProps = defaultProps$a;
|
|
627
633
|
|
|
628
634
|
/* eslint-disable react/jsx-props-no-spreading */
|
|
629
|
-
var FormContext = /*#__PURE__*/
|
|
635
|
+
var FormContext = /*#__PURE__*/React.createContext(null);
|
|
630
636
|
var useForm = function useForm() {
|
|
631
637
|
return React.useContext(FormContext);
|
|
632
638
|
};
|
|
@@ -640,13 +646,13 @@ var useFormSetValue = function useFormSetValue() {
|
|
|
640
646
|
setValue = _useForm2.setValue;
|
|
641
647
|
return setValue;
|
|
642
648
|
};
|
|
643
|
-
var propTypes$
|
|
644
|
-
value:
|
|
649
|
+
var propTypes$9 = {
|
|
650
|
+
value: PropTypes.object.isRequired,
|
|
645
651
|
// eslint-disable-line react/forbid-prop-types
|
|
646
|
-
setValue:
|
|
647
|
-
children:
|
|
652
|
+
setValue: PropTypes.func.isRequired,
|
|
653
|
+
children: PropTypes.node.isRequired
|
|
648
654
|
};
|
|
649
|
-
var defaultProps$
|
|
655
|
+
var defaultProps$9 = {};
|
|
650
656
|
var FormProvider = function FormProvider(_ref) {
|
|
651
657
|
var value = _ref.value,
|
|
652
658
|
setValue = _ref.setValue,
|
|
@@ -657,14 +663,14 @@ var FormProvider = function FormProvider(_ref) {
|
|
|
657
663
|
setValue: setValue
|
|
658
664
|
};
|
|
659
665
|
}, [value, setValue]);
|
|
660
|
-
return /*#__PURE__*/
|
|
666
|
+
return /*#__PURE__*/React.createElement(FormContext.Provider, {
|
|
661
667
|
value: values
|
|
662
668
|
}, children);
|
|
663
669
|
};
|
|
664
|
-
FormProvider.propTypes = propTypes$
|
|
665
|
-
FormProvider.defaultProps = defaultProps$
|
|
670
|
+
FormProvider.propTypes = propTypes$9;
|
|
671
|
+
FormProvider.defaultProps = defaultProps$9;
|
|
666
672
|
|
|
667
|
-
var GoogleApiClientContext = /*#__PURE__*/
|
|
673
|
+
var GoogleApiClientContext = /*#__PURE__*/React.createContext(null);
|
|
668
674
|
var useGoogleApiClient = function useGoogleApiClient() {
|
|
669
675
|
return React.useContext(GoogleApiClientContext);
|
|
670
676
|
};
|
|
@@ -677,8 +683,8 @@ var withGoogleApiClient = function withGoogleApiClient(WrappedComponent) {
|
|
|
677
683
|
return displayName || name || 'Component';
|
|
678
684
|
};
|
|
679
685
|
var WithGoogleApiClientComponent = function WithGoogleApiClientComponent(props) {
|
|
680
|
-
return /*#__PURE__*/
|
|
681
|
-
return /*#__PURE__*/
|
|
686
|
+
return /*#__PURE__*/React.createElement(GoogleApiClientContext.Consumer, null, function (client) {
|
|
687
|
+
return /*#__PURE__*/React.createElement(WrappedComponent, Object.assign({
|
|
682
688
|
googleApiClient: client
|
|
683
689
|
}, props));
|
|
684
690
|
});
|
|
@@ -686,16 +692,16 @@ var withGoogleApiClient = function withGoogleApiClient(WrappedComponent) {
|
|
|
686
692
|
WithGoogleApiClientComponent.displayName = "WithGoogleApiClient(".concat(getDisplayName(WrappedComponent), ")");
|
|
687
693
|
return WithGoogleApiClientComponent;
|
|
688
694
|
};
|
|
689
|
-
var propTypes$
|
|
690
|
-
children:
|
|
695
|
+
var propTypes$8 = {
|
|
696
|
+
children: PropTypes.node.isRequired
|
|
691
697
|
};
|
|
692
|
-
var defaultProps$
|
|
698
|
+
var defaultProps$8 = {};
|
|
693
699
|
var GoogleApiClientProvider = function GoogleApiClientProvider(_ref2) {
|
|
694
700
|
var children = _ref2.children;
|
|
695
701
|
var _useGoogleKeys = useGoogleKeys(),
|
|
696
702
|
apiKey = _useGoogleKeys.apiKey;
|
|
697
703
|
var _useState = React.useState(null),
|
|
698
|
-
_useState2 =
|
|
704
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
699
705
|
client = _useState2[0],
|
|
700
706
|
setClient = _useState2[1];
|
|
701
707
|
React.useEffect(function () {
|
|
@@ -709,14 +715,14 @@ var GoogleApiClientProvider = function GoogleApiClientProvider(_ref2) {
|
|
|
709
715
|
return setClient(gapi);
|
|
710
716
|
});
|
|
711
717
|
}, [apiKey, setClient]);
|
|
712
|
-
return /*#__PURE__*/
|
|
718
|
+
return /*#__PURE__*/React.createElement(GoogleApiClientContext.Provider, {
|
|
713
719
|
value: client
|
|
714
720
|
}, children);
|
|
715
721
|
};
|
|
716
|
-
GoogleApiClientProvider.propTypes = propTypes$
|
|
717
|
-
GoogleApiClientProvider.defaultProps = defaultProps$
|
|
722
|
+
GoogleApiClientProvider.propTypes = propTypes$8;
|
|
723
|
+
GoogleApiClientProvider.defaultProps = defaultProps$8;
|
|
718
724
|
|
|
719
|
-
var GoogleMapsClientContext = /*#__PURE__*/
|
|
725
|
+
var GoogleMapsClientContext = /*#__PURE__*/React.createContext(null);
|
|
720
726
|
var useGoogleMapsClient = function useGoogleMapsClient() {
|
|
721
727
|
return React.useContext(GoogleMapsClientContext);
|
|
722
728
|
};
|
|
@@ -729,8 +735,8 @@ var withGoogleMapsClient = function withGoogleMapsClient(WrappedComponent) {
|
|
|
729
735
|
return displayName || name || 'Component';
|
|
730
736
|
};
|
|
731
737
|
var WithGoogleMapsClientComponent = function WithGoogleMapsClientComponent(props) {
|
|
732
|
-
return /*#__PURE__*/
|
|
733
|
-
return /*#__PURE__*/
|
|
738
|
+
return /*#__PURE__*/React.createElement(GoogleMapsClientContext.Consumer, null, function (client) {
|
|
739
|
+
return /*#__PURE__*/React.createElement(WrappedComponent, Object.assign({
|
|
734
740
|
googleApiClient: client
|
|
735
741
|
}, props));
|
|
736
742
|
});
|
|
@@ -738,12 +744,12 @@ var withGoogleMapsClient = function withGoogleMapsClient(WrappedComponent) {
|
|
|
738
744
|
WithGoogleMapsClientComponent.displayName = "WithGoogleMapsClient(".concat(getDisplayName(WrappedComponent), ")");
|
|
739
745
|
return WithGoogleMapsClientComponent;
|
|
740
746
|
};
|
|
741
|
-
var propTypes$
|
|
742
|
-
children:
|
|
743
|
-
locale:
|
|
744
|
-
libraries:
|
|
747
|
+
var propTypes$7 = {
|
|
748
|
+
children: PropTypes.node.isRequired,
|
|
749
|
+
locale: PropTypes.string,
|
|
750
|
+
libraries: PropTypes.arrayOf(PropTypes.string)
|
|
745
751
|
};
|
|
746
|
-
var defaultProps$
|
|
752
|
+
var defaultProps$7 = {
|
|
747
753
|
locale: 'fr',
|
|
748
754
|
libraries: null
|
|
749
755
|
};
|
|
@@ -755,7 +761,7 @@ var GoogleMapsClientProvider = function GoogleMapsClientProvider(_ref2) {
|
|
|
755
761
|
apiKey = _useGoogleKeys.apiKey;
|
|
756
762
|
var exisitingClient = useGoogleMapsClient();
|
|
757
763
|
var _useState = React.useState(exisitingClient),
|
|
758
|
-
_useState2 =
|
|
764
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
759
765
|
client = _useState2[0],
|
|
760
766
|
setClient = _useState2[1];
|
|
761
767
|
React.useEffect(function () {
|
|
@@ -769,16 +775,16 @@ var GoogleMapsClientProvider = function GoogleMapsClientProvider(_ref2) {
|
|
|
769
775
|
});
|
|
770
776
|
}
|
|
771
777
|
}, [apiKey, locale, libraries, setClient, exisitingClient]);
|
|
772
|
-
return /*#__PURE__*/
|
|
778
|
+
return /*#__PURE__*/React.createElement(GoogleMapsClientContext.Provider, {
|
|
773
779
|
value: client
|
|
774
780
|
}, children);
|
|
775
781
|
};
|
|
776
|
-
GoogleMapsClientProvider.propTypes = propTypes$
|
|
777
|
-
GoogleMapsClientProvider.defaultProps = defaultProps$
|
|
782
|
+
GoogleMapsClientProvider.propTypes = propTypes$7;
|
|
783
|
+
GoogleMapsClientProvider.defaultProps = defaultProps$7;
|
|
778
784
|
|
|
779
785
|
/* eslint-disable react/jsx-props-no-spreading */
|
|
780
786
|
var defaultLocales = ['en', 'fr'];
|
|
781
|
-
var LocalesContext = /*#__PURE__*/
|
|
787
|
+
var LocalesContext = /*#__PURE__*/React.createContext({
|
|
782
788
|
locales: defaultLocales
|
|
783
789
|
});
|
|
784
790
|
var useLocales = function useLocales() {
|
|
@@ -798,11 +804,11 @@ var useOtherLocales = function useOtherLocales() {
|
|
|
798
804
|
}, [locales, locale]);
|
|
799
805
|
return otherLocales;
|
|
800
806
|
};
|
|
801
|
-
var propTypes$
|
|
802
|
-
locales:
|
|
803
|
-
children:
|
|
807
|
+
var propTypes$6 = {
|
|
808
|
+
locales: PropTypes.arrayOf(PropTypes.string),
|
|
809
|
+
children: PropTypes.node.isRequired
|
|
804
810
|
};
|
|
805
|
-
var defaultProps$
|
|
811
|
+
var defaultProps$6 = {
|
|
806
812
|
locales: []
|
|
807
813
|
};
|
|
808
814
|
var LocalesProvider = function LocalesProvider(_ref) {
|
|
@@ -813,42 +819,42 @@ var LocalesProvider = function LocalesProvider(_ref) {
|
|
|
813
819
|
locales: locales
|
|
814
820
|
};
|
|
815
821
|
}, [locales]);
|
|
816
|
-
return /*#__PURE__*/
|
|
822
|
+
return /*#__PURE__*/React.createElement(LocalesContext.Provider, {
|
|
817
823
|
value: value
|
|
818
824
|
}, children);
|
|
819
825
|
};
|
|
820
|
-
LocalesProvider.propTypes = propTypes$
|
|
821
|
-
LocalesProvider.defaultProps = defaultProps$
|
|
826
|
+
LocalesProvider.propTypes = propTypes$6;
|
|
827
|
+
LocalesProvider.defaultProps = defaultProps$6;
|
|
822
828
|
|
|
823
829
|
// import { getDisplayName } from '../utils';
|
|
824
830
|
|
|
825
|
-
var ModalContext = /*#__PURE__*/
|
|
831
|
+
var ModalContext = /*#__PURE__*/React.createContext(null);
|
|
826
832
|
var useModal = function useModal() {
|
|
827
833
|
return React.useContext(ModalContext) || {};
|
|
828
834
|
};
|
|
829
|
-
var propTypes$
|
|
830
|
-
children:
|
|
831
|
-
container:
|
|
835
|
+
var propTypes$5 = {
|
|
836
|
+
children: PropTypes.node.isRequired,
|
|
837
|
+
container: PropTypes.object // eslint-disable-line
|
|
832
838
|
};
|
|
833
|
-
var defaultProps$
|
|
839
|
+
var defaultProps$5 = {
|
|
834
840
|
container: null
|
|
835
841
|
};
|
|
836
842
|
var ModalProvider = function ModalProvider(_ref) {
|
|
837
843
|
var children = _ref.children,
|
|
838
844
|
initialContainer = _ref.container;
|
|
839
845
|
var _useState = React.useState(initialContainer),
|
|
840
|
-
_useState2 =
|
|
846
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
841
847
|
container = _useState2[0],
|
|
842
848
|
setContainer = _useState2[1];
|
|
843
849
|
var _useState3 = React.useState([]),
|
|
844
|
-
_useState4 =
|
|
850
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
845
851
|
modals = _useState4[0],
|
|
846
852
|
setModals = _useState4[1];
|
|
847
853
|
var modalsRef = React.useRef(modals);
|
|
848
854
|
var register = React.useCallback(function (id) {
|
|
849
855
|
var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
850
856
|
var currentModals = modalsRef.current;
|
|
851
|
-
var newModals = [].concat(
|
|
857
|
+
var newModals = [].concat(_toConsumableArray(currentModals), [_objectSpread({
|
|
852
858
|
id: id
|
|
853
859
|
}, data)]);
|
|
854
860
|
setModals(newModals);
|
|
@@ -878,14 +884,14 @@ var ModalProvider = function ModalProvider(_ref) {
|
|
|
878
884
|
unregister: unregister
|
|
879
885
|
};
|
|
880
886
|
}, [modals, container, setContainer, register, unregister]);
|
|
881
|
-
return /*#__PURE__*/
|
|
887
|
+
return /*#__PURE__*/React.createElement(ModalContext.Provider, {
|
|
882
888
|
value: value
|
|
883
889
|
}, children);
|
|
884
890
|
};
|
|
885
|
-
ModalProvider.propTypes = propTypes$
|
|
886
|
-
ModalProvider.defaultProps = defaultProps$
|
|
891
|
+
ModalProvider.propTypes = propTypes$5;
|
|
892
|
+
ModalProvider.defaultProps = defaultProps$5;
|
|
887
893
|
|
|
888
|
-
var PanelsContext = /*#__PURE__*/
|
|
894
|
+
var PanelsContext = /*#__PURE__*/React.createContext({
|
|
889
895
|
container: null
|
|
890
896
|
});
|
|
891
897
|
var usePanels = function usePanels() {
|
|
@@ -893,13 +899,13 @@ var usePanels = function usePanels() {
|
|
|
893
899
|
};
|
|
894
900
|
var withPanels = function withPanels(WrappedComponent) {
|
|
895
901
|
var WithPanelsComponent = function WithPanelsComponent(props) {
|
|
896
|
-
return /*#__PURE__*/
|
|
902
|
+
return /*#__PURE__*/React.createElement(PanelsContext.Consumer, null, function (_ref) {
|
|
897
903
|
var panels = _ref.panels,
|
|
898
904
|
setContainer = _ref.setContainer,
|
|
899
905
|
container = _ref.container,
|
|
900
906
|
register = _ref.register,
|
|
901
907
|
unregister = _ref.unregister;
|
|
902
|
-
return /*#__PURE__*/
|
|
908
|
+
return /*#__PURE__*/React.createElement(WrappedComponent, Object.assign({
|
|
903
909
|
panelsContainer: container,
|
|
904
910
|
setPanelsContainer: setContainer,
|
|
905
911
|
panels: panels,
|
|
@@ -911,29 +917,29 @@ var withPanels = function withPanels(WrappedComponent) {
|
|
|
911
917
|
WithPanelsComponent.displayName = "WithPanels(".concat(utils.getDisplayName(WrappedComponent), ")");
|
|
912
918
|
return WithPanelsComponent;
|
|
913
919
|
};
|
|
914
|
-
var propTypes$
|
|
915
|
-
children:
|
|
916
|
-
container:
|
|
920
|
+
var propTypes$4 = {
|
|
921
|
+
children: PropTypes.node.isRequired,
|
|
922
|
+
container: PropTypes.object // eslint-disable-line
|
|
917
923
|
};
|
|
918
|
-
var defaultProps$
|
|
924
|
+
var defaultProps$4 = {
|
|
919
925
|
container: null
|
|
920
926
|
};
|
|
921
927
|
var PanelsProvider = function PanelsProvider(_ref2) {
|
|
922
928
|
var children = _ref2.children,
|
|
923
929
|
initialContainer = _ref2.container;
|
|
924
930
|
var _useState = React.useState(initialContainer),
|
|
925
|
-
_useState2 =
|
|
931
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
926
932
|
container = _useState2[0],
|
|
927
933
|
setContainer = _useState2[1];
|
|
928
934
|
var _useState3 = React.useState([]),
|
|
929
|
-
_useState4 =
|
|
935
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
930
936
|
panels = _useState4[0],
|
|
931
937
|
setPanels = _useState4[1];
|
|
932
938
|
var panelsRef = React.useRef(panels);
|
|
933
939
|
var register = React.useCallback(function (id) {
|
|
934
940
|
var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
935
941
|
var currentPanels = panelsRef.current;
|
|
936
|
-
var newPanels = [].concat(
|
|
942
|
+
var newPanels = [].concat(_toConsumableArray(currentPanels), [_objectSpread({
|
|
937
943
|
id: id
|
|
938
944
|
}, data)]);
|
|
939
945
|
setPanels(newPanels);
|
|
@@ -963,15 +969,15 @@ var PanelsProvider = function PanelsProvider(_ref2) {
|
|
|
963
969
|
unregister: unregister
|
|
964
970
|
};
|
|
965
971
|
}, [panels, setContainer, container, register, unregister]);
|
|
966
|
-
return /*#__PURE__*/
|
|
972
|
+
return /*#__PURE__*/React.createElement(PanelsContext.Provider, {
|
|
967
973
|
value: value
|
|
968
974
|
}, children);
|
|
969
975
|
};
|
|
970
|
-
PanelsProvider.propTypes = propTypes$
|
|
971
|
-
PanelsProvider.defaultProps = defaultProps$
|
|
976
|
+
PanelsProvider.propTypes = propTypes$4;
|
|
977
|
+
PanelsProvider.defaultProps = defaultProps$4;
|
|
972
978
|
|
|
973
979
|
var _excluded = ["component"];
|
|
974
|
-
var PanneauContext = /*#__PURE__*/
|
|
980
|
+
var PanneauContext = /*#__PURE__*/React.createContext(null);
|
|
975
981
|
var usePanneau = function usePanneau() {
|
|
976
982
|
return React.useContext(PanneauContext);
|
|
977
983
|
};
|
|
@@ -1023,13 +1029,13 @@ var usePanneauComponent = function usePanneauComponent(namespace, name) {
|
|
|
1023
1029
|
components = _ref5$components === void 0 ? {} : _ref5$components;
|
|
1024
1030
|
var path = namespace !== null ? "".concat(namespace, ".").concat(name) : name || null;
|
|
1025
1031
|
var component = components[path] || null;
|
|
1026
|
-
if (
|
|
1032
|
+
if (isString(component)) {
|
|
1027
1033
|
return component;
|
|
1028
1034
|
}
|
|
1029
|
-
if (
|
|
1035
|
+
if (isObject(component) && isString(component === null || component === void 0 ? void 0 : component.componnent)) {
|
|
1030
1036
|
// eslint-disable-next-line no-unused-vars
|
|
1031
1037
|
component.component;
|
|
1032
|
-
|
|
1038
|
+
_objectWithoutProperties(component, _excluded);
|
|
1033
1039
|
return component.component;
|
|
1034
1040
|
}
|
|
1035
1041
|
return null;
|
|
@@ -1046,51 +1052,366 @@ var usePanneauSettings = function usePanneauSettings() {
|
|
|
1046
1052
|
settings = _ref7$settings === void 0 ? {} : _ref7$settings;
|
|
1047
1053
|
return settings;
|
|
1048
1054
|
};
|
|
1049
|
-
var propTypes$
|
|
1055
|
+
var propTypes$3 = {
|
|
1050
1056
|
definition: panneauDefinition.isRequired,
|
|
1051
|
-
children:
|
|
1057
|
+
children: PropTypes.node.isRequired
|
|
1052
1058
|
};
|
|
1053
|
-
var defaultProps$
|
|
1059
|
+
var defaultProps$3 = {};
|
|
1054
1060
|
var PanneauProvider = function PanneauProvider(_ref8) {
|
|
1055
1061
|
var definition = _ref8.definition,
|
|
1056
1062
|
children = _ref8.children;
|
|
1057
|
-
return /*#__PURE__*/
|
|
1063
|
+
return /*#__PURE__*/React.createElement(PanneauContext.Provider, {
|
|
1058
1064
|
value: definition
|
|
1059
1065
|
}, children);
|
|
1060
1066
|
};
|
|
1061
|
-
PanneauProvider.propTypes = propTypes$
|
|
1062
|
-
PanneauProvider.defaultProps = defaultProps$
|
|
1067
|
+
PanneauProvider.propTypes = propTypes$3;
|
|
1068
|
+
PanneauProvider.defaultProps = defaultProps$3;
|
|
1063
1069
|
|
|
1064
1070
|
/* eslint-disable react/jsx-props-no-spreading */
|
|
1065
|
-
var ResourceContext = /*#__PURE__*/
|
|
1071
|
+
var ResourceContext = /*#__PURE__*/React.createContext(null);
|
|
1066
1072
|
var useResource = function useResource() {
|
|
1067
1073
|
return React.useContext(ResourceContext);
|
|
1068
1074
|
};
|
|
1069
|
-
var propTypes$
|
|
1075
|
+
var propTypes$2 = {
|
|
1070
1076
|
resource: resource.isRequired,
|
|
1071
|
-
children:
|
|
1077
|
+
children: PropTypes.node.isRequired
|
|
1072
1078
|
};
|
|
1073
|
-
var defaultProps$
|
|
1079
|
+
var defaultProps$2 = {};
|
|
1074
1080
|
var ResourceProvider = function ResourceProvider(_ref) {
|
|
1075
1081
|
var resource = _ref.resource,
|
|
1076
1082
|
children = _ref.children;
|
|
1077
|
-
return /*#__PURE__*/
|
|
1083
|
+
return /*#__PURE__*/React.createElement(ResourceContext.Provider, {
|
|
1078
1084
|
value: resource
|
|
1079
1085
|
}, children);
|
|
1080
1086
|
};
|
|
1081
|
-
ResourceProvider.propTypes = propTypes$
|
|
1082
|
-
ResourceProvider.defaultProps = defaultProps$
|
|
1087
|
+
ResourceProvider.propTypes = propTypes$2;
|
|
1088
|
+
ResourceProvider.defaultProps = defaultProps$2;
|
|
1089
|
+
|
|
1090
|
+
// React.useInsertionEffect is not available in React <18
|
|
1091
|
+
var useEffect = React__namespace.useEffect,
|
|
1092
|
+
useLayoutEffect = React__namespace.useLayoutEffect,
|
|
1093
|
+
useRef = React__namespace.useRef,
|
|
1094
|
+
useBuiltinInsertionEffect = React__namespace.useInsertionEffect;
|
|
1095
|
+
|
|
1096
|
+
// Copied from:
|
|
1097
|
+
// https://github.com/facebook/react/blob/main/packages/shared/ExecutionEnvironment.js
|
|
1098
|
+
var canUseDOM = !!(typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined");
|
|
1099
|
+
|
|
1100
|
+
// Copied from:
|
|
1101
|
+
// https://github.com/reduxjs/react-redux/blob/master/src/utils/useIsomorphicLayoutEffect.ts
|
|
1102
|
+
// "React currently throws a warning when using useLayoutEffect on the server.
|
|
1103
|
+
// To get around it, we can conditionally useEffect on the server (no-op) and
|
|
1104
|
+
// useLayoutEffect in the browser."
|
|
1105
|
+
var useIsomorphicLayoutEffect = canUseDOM ? useLayoutEffect : useEffect;
|
|
1106
|
+
|
|
1107
|
+
// useInsertionEffect is already a noop on the server.
|
|
1108
|
+
// See: https://github.com/facebook/react/blob/main/packages/react-server/src/ReactFizzHooks.js
|
|
1109
|
+
var useInsertionEffect = useBuiltinInsertionEffect || useIsomorphicLayoutEffect;
|
|
1110
|
+
|
|
1111
|
+
// Userland polyfill while we wait for the forthcoming
|
|
1112
|
+
// https://github.com/reactjs/rfcs/blob/useevent/text/0000-useevent.md
|
|
1113
|
+
// Note: "A high-fidelity polyfill for useEvent is not possible because
|
|
1114
|
+
// there is no lifecycle or Hook in React that we can use to switch
|
|
1115
|
+
// .current at the right timing."
|
|
1116
|
+
// So we will have to make do with this "close enough" approach for now.
|
|
1117
|
+
var useEvent = function useEvent(fn) {
|
|
1118
|
+
var ref = useRef([fn, function () {
|
|
1119
|
+
return ref[0].apply(ref, arguments);
|
|
1120
|
+
}]).current;
|
|
1121
|
+
// Per Dan Abramov: useInsertionEffect executes marginally closer to the
|
|
1122
|
+
// correct timing for ref synchronization than useLayoutEffect on React 18.
|
|
1123
|
+
// See: https://github.com/facebook/react/pull/25881#issuecomment-1356244360
|
|
1124
|
+
useInsertionEffect(function () {
|
|
1125
|
+
ref[0] = fn;
|
|
1126
|
+
});
|
|
1127
|
+
return ref[1];
|
|
1128
|
+
};
|
|
1129
|
+
|
|
1130
|
+
/**
|
|
1131
|
+
* History API docs @see https://developer.mozilla.org/en-US/docs/Web/API/History
|
|
1132
|
+
*/
|
|
1133
|
+
var eventPopstate = "popstate";
|
|
1134
|
+
var eventPushState = "pushState";
|
|
1135
|
+
var eventReplaceState = "replaceState";
|
|
1136
|
+
var eventHashchange = "hashchange";
|
|
1137
|
+
var events = [eventPopstate, eventPushState, eventReplaceState, eventHashchange];
|
|
1138
|
+
var subscribeToLocationUpdates = function subscribeToLocationUpdates(callback) {
|
|
1139
|
+
for (var _i = 0, _events = events; _i < _events.length; _i++) {
|
|
1140
|
+
var event = _events[_i];
|
|
1141
|
+
addEventListener(event, callback);
|
|
1142
|
+
}
|
|
1143
|
+
return function () {
|
|
1144
|
+
for (var _i2 = 0, _events2 = events; _i2 < _events2.length; _i2++) {
|
|
1145
|
+
var _event = _events2[_i2];
|
|
1146
|
+
removeEventListener(_event, callback);
|
|
1147
|
+
}
|
|
1148
|
+
};
|
|
1149
|
+
};
|
|
1150
|
+
var useLocationProperty = function useLocationProperty(fn, ssrFn) {
|
|
1151
|
+
return index_js.useSyncExternalStore(subscribeToLocationUpdates, fn, ssrFn);
|
|
1152
|
+
};
|
|
1153
|
+
var currentSearch = function currentSearch() {
|
|
1154
|
+
return location.search;
|
|
1155
|
+
};
|
|
1156
|
+
var useSearch = function useSearch() {
|
|
1157
|
+
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
1158
|
+
_ref$ssrSearch = _ref.ssrSearch,
|
|
1159
|
+
ssrSearch = _ref$ssrSearch === void 0 ? "" : _ref$ssrSearch;
|
|
1160
|
+
return useLocationProperty(currentSearch, function () {
|
|
1161
|
+
return ssrSearch;
|
|
1162
|
+
});
|
|
1163
|
+
};
|
|
1164
|
+
var currentPathname = function currentPathname() {
|
|
1165
|
+
return location.pathname;
|
|
1166
|
+
};
|
|
1167
|
+
var usePathname = function usePathname() {
|
|
1168
|
+
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
1169
|
+
ssrPath = _ref2.ssrPath;
|
|
1170
|
+
return useLocationProperty(currentPathname, ssrPath ? function () {
|
|
1171
|
+
return ssrPath;
|
|
1172
|
+
} : currentPathname);
|
|
1173
|
+
};
|
|
1174
|
+
var navigate = function navigate(to) {
|
|
1175
|
+
var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
1176
|
+
_ref3$replace = _ref3.replace,
|
|
1177
|
+
replace = _ref3$replace === void 0 ? false : _ref3$replace,
|
|
1178
|
+
_ref3$state = _ref3.state,
|
|
1179
|
+
state = _ref3$state === void 0 ? null : _ref3$state;
|
|
1180
|
+
return history[replace ? eventReplaceState : eventPushState](state, "", to);
|
|
1181
|
+
};
|
|
1182
|
+
|
|
1183
|
+
// the 2nd argument of the `useBrowserLocation` return value is a function
|
|
1184
|
+
// that allows to perform a navigation.
|
|
1185
|
+
var useBrowserLocation = function useBrowserLocation() {
|
|
1186
|
+
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1187
|
+
return [usePathname(opts), navigate];
|
|
1188
|
+
};
|
|
1189
|
+
var patchKey = Symbol["for"]("wouter_v3");
|
|
1190
|
+
|
|
1191
|
+
// While History API does have `popstate` event, the only
|
|
1192
|
+
// proper way to listen to changes via `push/replaceState`
|
|
1193
|
+
// is to monkey-patch these methods.
|
|
1194
|
+
//
|
|
1195
|
+
// See https://stackoverflow.com/a/4585031
|
|
1196
|
+
if (typeof history !== "undefined" && typeof window[patchKey] === "undefined") {
|
|
1197
|
+
var _loop = function _loop() {
|
|
1198
|
+
var type = _arr[_i3];
|
|
1199
|
+
var original = history[type];
|
|
1200
|
+
// TODO: we should be using unstable_batchedUpdates to avoid multiple re-renders,
|
|
1201
|
+
// however that will require an additional peer dependency on react-dom.
|
|
1202
|
+
// See: https://github.com/reactwg/react-18/discussions/86#discussioncomment-1567149
|
|
1203
|
+
history[type] = function () {
|
|
1204
|
+
var result = original.apply(this, arguments);
|
|
1205
|
+
var event = new Event(type);
|
|
1206
|
+
event.arguments = arguments;
|
|
1207
|
+
dispatchEvent(event);
|
|
1208
|
+
return result;
|
|
1209
|
+
};
|
|
1210
|
+
};
|
|
1211
|
+
for (var _i3 = 0, _arr = [eventPushState, eventReplaceState]; _i3 < _arr.length; _i3++) {
|
|
1212
|
+
_loop();
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
// patch history object only once
|
|
1216
|
+
// See: https://github.com/molefrog/wouter/issues/167
|
|
1217
|
+
Object.defineProperty(window, patchKey, {
|
|
1218
|
+
value: true
|
|
1219
|
+
});
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
var _excluded3 = ["to", "href", "onClick", "asChild", "children", "replace", "state"];
|
|
1223
|
+
|
|
1224
|
+
/*
|
|
1225
|
+
* Transforms `path` into its relative `base` version
|
|
1226
|
+
* If base isn't part of the path provided returns absolute path e.g. `~/app`
|
|
1227
|
+
*/
|
|
1228
|
+
var relativePath = function relativePath() {
|
|
1229
|
+
var base = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
|
|
1230
|
+
var path = arguments.length > 1 ? arguments[1] : undefined;
|
|
1231
|
+
return !path.toLowerCase().indexOf(base.toLowerCase()) ? path.slice(base.length) || "/" : "~" + path;
|
|
1232
|
+
};
|
|
1233
|
+
var absolutePath = function absolutePath(to) {
|
|
1234
|
+
var base = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
1235
|
+
return to[0] === "~" ? to.slice(1) : base + to;
|
|
1236
|
+
};
|
|
1237
|
+
|
|
1238
|
+
/*
|
|
1239
|
+
* decodes escape sequences such as %20
|
|
1240
|
+
*/
|
|
1241
|
+
var unescape = function unescape(str) {
|
|
1242
|
+
try {
|
|
1243
|
+
return decodeURI(str);
|
|
1244
|
+
} catch (_e) {
|
|
1245
|
+
// fail-safe mode: if string can't be decoded do nothing
|
|
1246
|
+
return str;
|
|
1247
|
+
}
|
|
1248
|
+
};
|
|
1249
|
+
|
|
1250
|
+
/*
|
|
1251
|
+
* Router and router context. Router is a lightweight object that represents the current
|
|
1252
|
+
* routing options: how location is managed, base path etc.
|
|
1253
|
+
*
|
|
1254
|
+
* There is a default router present for most of the use cases, however it can be overridden
|
|
1255
|
+
* via the <Router /> component.
|
|
1256
|
+
*/
|
|
1257
|
+
|
|
1258
|
+
var defaultRouter = {
|
|
1259
|
+
hook: useBrowserLocation,
|
|
1260
|
+
searchHook: useSearch,
|
|
1261
|
+
parser: regexparam.parse,
|
|
1262
|
+
base: "",
|
|
1263
|
+
// this option is used to override the current location during SSR
|
|
1264
|
+
ssrPath: undefined,
|
|
1265
|
+
ssrSearch: undefined
|
|
1266
|
+
};
|
|
1267
|
+
var RouterCtx = React.createContext(defaultRouter);
|
|
1268
|
+
|
|
1269
|
+
// gets the closest parent router from the context
|
|
1270
|
+
var useRouter = function useRouter() {
|
|
1271
|
+
return React.useContext(RouterCtx);
|
|
1272
|
+
};
|
|
1273
|
+
|
|
1274
|
+
/**
|
|
1275
|
+
* Parameters context. Used by `useParams()` to get the
|
|
1276
|
+
* matched params from the innermost `Route` component.
|
|
1277
|
+
*/
|
|
1278
|
+
|
|
1279
|
+
React.createContext({});
|
|
1280
|
+
|
|
1281
|
+
/*
|
|
1282
|
+
* Part 1, Hooks API: useRoute and useLocation
|
|
1283
|
+
*/
|
|
1284
|
+
|
|
1285
|
+
// Internal version of useLocation to avoid redundant useRouter calls
|
|
1286
|
+
|
|
1287
|
+
var useLocationFromRouter = function useLocationFromRouter(router) {
|
|
1288
|
+
var _router$hook = router.hook(router),
|
|
1289
|
+
_router$hook2 = _slicedToArray(_router$hook, 2),
|
|
1290
|
+
location = _router$hook2[0],
|
|
1291
|
+
navigate = _router$hook2[1];
|
|
1292
|
+
|
|
1293
|
+
// the function reference should stay the same between re-renders, so that
|
|
1294
|
+
// it can be passed down as an element prop without any performance concerns.
|
|
1295
|
+
// (This is achieved via `useEvent`.)
|
|
1296
|
+
return [unescape(relativePath(router.base, location)), useEvent(function (to, navOpts) {
|
|
1297
|
+
return navigate(absolutePath(to, router.base), navOpts);
|
|
1298
|
+
})];
|
|
1299
|
+
};
|
|
1300
|
+
var useLocation = function useLocation() {
|
|
1301
|
+
return useLocationFromRouter(useRouter());
|
|
1302
|
+
};
|
|
1303
|
+
React.forwardRef(function (props, ref) {
|
|
1304
|
+
var router = useRouter();
|
|
1305
|
+
var _useLocationFromRoute3 = useLocationFromRouter(router),
|
|
1306
|
+
_useLocationFromRoute4 = _slicedToArray(_useLocationFromRoute3, 2),
|
|
1307
|
+
navigate = _useLocationFromRoute4[1];
|
|
1308
|
+
var to = props.to,
|
|
1309
|
+
_props$href = props.href,
|
|
1310
|
+
_href = _props$href === void 0 ? to : _props$href,
|
|
1311
|
+
_onClick = props.onClick,
|
|
1312
|
+
asChild = props.asChild,
|
|
1313
|
+
children = props.children;
|
|
1314
|
+
props.replace;
|
|
1315
|
+
props.state;
|
|
1316
|
+
var restProps = _objectWithoutProperties(props, _excluded3);
|
|
1317
|
+
var onClick = useEvent(function (event) {
|
|
1318
|
+
// ignores the navigation when clicked using right mouse button or
|
|
1319
|
+
// by holding a special modifier key: ctrl, command, win, alt, shift
|
|
1320
|
+
if (event.ctrlKey || event.metaKey || event.altKey || event.shiftKey || event.button !== 0) return;
|
|
1321
|
+
_onClick && _onClick(event); // TODO: is it safe to use _onClick?.(event)
|
|
1322
|
+
if (!event.defaultPrevented) {
|
|
1323
|
+
event.preventDefault();
|
|
1324
|
+
navigate(_href, props);
|
|
1325
|
+
}
|
|
1326
|
+
});
|
|
1327
|
+
|
|
1328
|
+
// handle nested routers and absolute paths
|
|
1329
|
+
var href = _href[0] === "~" ? _href.slice(1) : router.base + _href;
|
|
1330
|
+
return asChild && React.isValidElement(children) ? React.cloneElement(children, {
|
|
1331
|
+
href: href,
|
|
1332
|
+
onClick: onClick
|
|
1333
|
+
}) : React.createElement("a", _objectSpread(_objectSpread({}, restProps), {}, {
|
|
1334
|
+
href: href,
|
|
1335
|
+
onClick: onClick,
|
|
1336
|
+
children: children,
|
|
1337
|
+
ref: ref
|
|
1338
|
+
}));
|
|
1339
|
+
});
|
|
1340
|
+
|
|
1341
|
+
/* eslint-disable react/jsx-props-no-spreading */
|
|
1342
|
+
var RoutesContext = /*#__PURE__*/React.createContext(null);
|
|
1343
|
+
var useRoutesContext = function useRoutesContext() {
|
|
1344
|
+
return React.useContext(RoutesContext);
|
|
1345
|
+
};
|
|
1346
|
+
var propTypes$1 = {
|
|
1347
|
+
children: PropTypes.node.isRequired,
|
|
1348
|
+
routes: PropTypes.objectOf(PropTypes.string).isRequired,
|
|
1349
|
+
basePath: PropTypes.string
|
|
1350
|
+
};
|
|
1351
|
+
var defaultProps$1 = {
|
|
1352
|
+
basePath: null
|
|
1353
|
+
};
|
|
1354
|
+
function RoutesProvider(_ref) {
|
|
1355
|
+
var routes = _ref.routes,
|
|
1356
|
+
basePath = _ref.basePath,
|
|
1357
|
+
children = _ref.children;
|
|
1358
|
+
var value = React.useMemo(function () {
|
|
1359
|
+
return {
|
|
1360
|
+
routes: routes,
|
|
1361
|
+
basePath: basePath
|
|
1362
|
+
};
|
|
1363
|
+
}, [routes, basePath]);
|
|
1364
|
+
return /*#__PURE__*/jsxRuntime.jsx(RoutesContext.Provider, {
|
|
1365
|
+
value: value,
|
|
1366
|
+
children: children
|
|
1367
|
+
});
|
|
1368
|
+
}
|
|
1369
|
+
RoutesProvider.propTypes = propTypes$1;
|
|
1370
|
+
RoutesProvider.defaultProps = defaultProps$1;
|
|
1371
|
+
var compilers = {};
|
|
1372
|
+
function generatePath(fullPath, data) {
|
|
1373
|
+
var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
1374
|
+
var fullUrlMatches = fullPath.match(/^(https?:\/\/[^/]+)\//);
|
|
1375
|
+
if (typeof compilers[fullPath] === 'undefined') {
|
|
1376
|
+
compilers[fullPath] = pathToRegexp.compile(fullPath.replace(/^(https?:\/\/[^/]+)\//, '/'), opts);
|
|
1377
|
+
}
|
|
1378
|
+
var compiler = compilers[fullPath];
|
|
1379
|
+
return fullUrlMatches !== null ? "".concat(fullUrlMatches[1].substr(0, -1)).concat(compiler(data)) : compiler(data);
|
|
1380
|
+
}
|
|
1381
|
+
var useUrlGeneratorPathToRepexp = function useUrlGeneratorPathToRepexp() {
|
|
1382
|
+
var _ref2 = useRoutesContext() || {},
|
|
1383
|
+
_ref2$routes = _ref2.routes,
|
|
1384
|
+
routes = _ref2$routes === void 0 ? null : _ref2$routes,
|
|
1385
|
+
_ref2$basePath = _ref2.basePath,
|
|
1386
|
+
basePath = _ref2$basePath === void 0 ? null : _ref2$basePath;
|
|
1387
|
+
var urlGenerator = React.useCallback(function (key, data, opts) {
|
|
1388
|
+
var path = routes !== null ? routes[key] || null : null;
|
|
1389
|
+
if (path === null) {
|
|
1390
|
+
return null;
|
|
1391
|
+
}
|
|
1392
|
+
var url = generatePath(path, data, opts);
|
|
1393
|
+
return basePath !== null ? "".concat(basePath.replace(/\/$/, ''), "/").concat(url.replace(/^\//, '')) : url;
|
|
1394
|
+
}, [routes, basePath]);
|
|
1395
|
+
return urlGenerator;
|
|
1396
|
+
};
|
|
1397
|
+
var useUrlGeneratorPathToRegexp = useUrlGeneratorPathToRepexp;
|
|
1398
|
+
var useRoutes = function useRoutes() {
|
|
1399
|
+
var _useRoutesContext = useRoutesContext(),
|
|
1400
|
+
routes = _useRoutesContext.routes;
|
|
1401
|
+
return routes;
|
|
1402
|
+
};
|
|
1403
|
+
var useRoutes$1 = useRoutes;
|
|
1083
1404
|
|
|
1084
1405
|
var useRoutePush = function useRoutePush() {
|
|
1085
|
-
var url =
|
|
1086
|
-
var _useLocation =
|
|
1087
|
-
_useLocation2 =
|
|
1406
|
+
var url = useUrlGeneratorPathToRegexp();
|
|
1407
|
+
var _useLocation = useLocation(),
|
|
1408
|
+
_useLocation2 = _slicedToArray(_useLocation, 2),
|
|
1088
1409
|
navigate = _useLocation2[1];
|
|
1089
1410
|
var push = React.useCallback(function (route, data) {
|
|
1090
1411
|
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
1091
1412
|
args[_key - 2] = arguments[_key];
|
|
1092
1413
|
}
|
|
1093
|
-
if (
|
|
1414
|
+
if (isString(route)) {
|
|
1094
1415
|
navigate.apply(void 0, [url(route, data)].concat(args));
|
|
1095
1416
|
} else {
|
|
1096
1417
|
var _ref = route || {},
|
|
@@ -1104,9 +1425,9 @@ var useRoutePush = function useRoutePush() {
|
|
|
1104
1425
|
return push;
|
|
1105
1426
|
};
|
|
1106
1427
|
var useRouteBack = function useRouteBack() {
|
|
1107
|
-
var url =
|
|
1108
|
-
var _useLocation3 =
|
|
1109
|
-
_useLocation4 =
|
|
1428
|
+
var url = useUrlGeneratorPathToRegexp();
|
|
1429
|
+
var _useLocation3 = useLocation(),
|
|
1430
|
+
_useLocation4 = _slicedToArray(_useLocation3, 2),
|
|
1110
1431
|
navigate = _useLocation4[1];
|
|
1111
1432
|
var back = React.useCallback(function () {
|
|
1112
1433
|
return navigate(-1);
|
|
@@ -1119,7 +1440,7 @@ var useTracking = function useTracking() {
|
|
|
1119
1440
|
return React.useContext(tracking.TrackingContext);
|
|
1120
1441
|
};
|
|
1121
1442
|
var propTypes = {
|
|
1122
|
-
children:
|
|
1443
|
+
children: PropTypes.node.isRequired,
|
|
1123
1444
|
variables: core.PropTypes.trackingVariables
|
|
1124
1445
|
};
|
|
1125
1446
|
var defaultProps = {
|
|
@@ -1138,30 +1459,14 @@ var TrackingProvider = function TrackingProvider(_ref) {
|
|
|
1138
1459
|
variables: variables
|
|
1139
1460
|
});
|
|
1140
1461
|
}, [contextTracking, variables]);
|
|
1141
|
-
return /*#__PURE__*/
|
|
1462
|
+
return /*#__PURE__*/React.createElement(tracking.TrackingContainer, {
|
|
1142
1463
|
tracking: tracking$1
|
|
1143
1464
|
}, children);
|
|
1144
1465
|
};
|
|
1145
1466
|
TrackingProvider.propTypes = propTypes;
|
|
1146
1467
|
TrackingProvider.defaultProps = defaultProps;
|
|
1147
1468
|
|
|
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', {
|
|
1469
|
+
Object.defineProperty(exports, "TrackingContext", {
|
|
1165
1470
|
enumerable: true,
|
|
1166
1471
|
get: function () { return tracking.TrackingContext; }
|
|
1167
1472
|
});
|
|
@@ -1197,6 +1502,8 @@ exports.PanelsContext = PanelsContext;
|
|
|
1197
1502
|
exports.PanelsProvider = PanelsProvider;
|
|
1198
1503
|
exports.PanneauProvider = PanneauProvider;
|
|
1199
1504
|
exports.ResourceProvider = ResourceProvider;
|
|
1505
|
+
exports.RoutesContext = RoutesContext;
|
|
1506
|
+
exports.RoutesProvider = RoutesProvider;
|
|
1200
1507
|
exports.TrackingProvider = TrackingProvider;
|
|
1201
1508
|
exports.useActionComponent = useActionComponent;
|
|
1202
1509
|
exports.useActionsComponents = useActionsComponents;
|
|
@@ -1259,7 +1566,9 @@ exports.usePanneauSettings = usePanneauSettings;
|
|
|
1259
1566
|
exports.useResource = useResource;
|
|
1260
1567
|
exports.useRouteBack = useRouteBack;
|
|
1261
1568
|
exports.useRoutePush = useRoutePush;
|
|
1569
|
+
exports.useRoutes = useRoutes$1;
|
|
1262
1570
|
exports.useTracking = useTracking;
|
|
1571
|
+
exports.useUrlGenerator = useUrlGeneratorPathToRegexp;
|
|
1263
1572
|
exports.withGoogleApiClient = withGoogleApiClient;
|
|
1264
1573
|
exports.withGoogleMapsClient = withGoogleMapsClient;
|
|
1265
1574
|
exports.withPanels = withPanels;
|