@panneau/core 4.0.2 → 4.0.4

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.
Files changed (3) hide show
  1. package/es/contexts.js +103 -81
  2. package/lib/contexts.js +163 -142
  3. package/package.json +2 -10
package/es/contexts.js CHANGED
@@ -1,7 +1,8 @@
1
1
  import _objectSpread from '@babel/runtime/helpers/objectSpread2';
2
2
  import isString from 'lodash-es/isString';
3
- import React$1, { useContext, useMemo, useState, useEffect, useRef, useCallback } from 'react';
3
+ import React, { useContext, useMemo, useState, useEffect, useRef, useCallback } from 'react';
4
4
  import { ComponentsManager, FieldsManager, Tracking } from '@panneau/core';
5
+ import { jsx } from 'react/jsx-runtime';
5
6
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
6
7
  import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
7
8
  import uniqBy from 'lodash-es/uniqBy';
@@ -29,7 +30,7 @@ var BUTTONS_NAMESPACE = 'buttons';
29
30
  var PAGES_NAMESPACE = 'pages';
30
31
  var PREVIEWS_NAMESPACE = 'previews';
31
32
  var APP_NAMESPACE = 'app';
32
- var ComponentsContext = /*#__PURE__*/React$1.createContext(null);
33
+ var ComponentsContext = /*#__PURE__*/React.createContext(null);
33
34
 
34
35
  /**
35
36
  * Hooks
@@ -242,12 +243,13 @@ function ComponentsProvider(_ref) {
242
243
  var finalManager = useMemo(function () {
243
244
  return new ComponentsManager(_objectSpread(_objectSpread(_objectSpread({}, previousManager !== null ? previousManager.getComponents() : null), manager !== null ? manager.getComponents() : null), new ComponentsManager(components).addNamespace(namespace).getComponents()));
244
245
  }, [previousManager, manager, components, namespace]);
245
- return /*#__PURE__*/React$1.createElement(ComponentsContext, {
246
- value: finalManager
247
- }, children);
246
+ return /*#__PURE__*/jsx(ComponentsContext, {
247
+ value: finalManager,
248
+ children: children
249
+ });
248
250
  }
249
251
 
250
- var DefinitionContext = /*#__PURE__*/React$1.createContext(null);
252
+ var DefinitionContext = /*#__PURE__*/React.createContext(null);
251
253
  var useDefinitionContext = function useDefinitionContext() {
252
254
  return useContext(DefinitionContext);
253
255
  };
@@ -258,12 +260,13 @@ var useDefinition = function useDefinition() {
258
260
  function DefinitionProvider(_ref) {
259
261
  var definition = _ref.definition,
260
262
  children = _ref.children;
261
- return /*#__PURE__*/React$1.createElement(DefinitionContext, {
262
- value: definition
263
- }, children);
263
+ return /*#__PURE__*/jsx(DefinitionContext, {
264
+ value: definition,
265
+ children: children
266
+ });
264
267
  }
265
268
 
266
- var FieldsContext = /*#__PURE__*/React$1.createContext(null);
269
+ var FieldsContext = /*#__PURE__*/React.createContext(null);
267
270
  var useFieldsManager = function useFieldsManager() {
268
271
  return useContext(FieldsContext);
269
272
  };
@@ -296,15 +299,17 @@ function FieldsProvider(_ref) {
296
299
  return isString(component) ? map : _objectSpread(_objectSpread({}, map), {}, _defineProperty({}, id, component));
297
300
  }, {});
298
301
  }, [finalManager]);
299
- return /*#__PURE__*/React$1.createElement(FieldsContext, {
300
- value: finalManager
301
- }, /*#__PURE__*/React$1.createElement(ComponentsProvider, {
302
- namespace: FIELDS_NAMESPACE,
303
- components: components
304
- }, children));
302
+ return /*#__PURE__*/jsx(FieldsContext, {
303
+ value: finalManager,
304
+ children: /*#__PURE__*/jsx(ComponentsProvider, {
305
+ namespace: FIELDS_NAMESPACE,
306
+ components: components,
307
+ children: children
308
+ })
309
+ });
305
310
  }
306
311
 
307
- var GoogleKeysContext = /*#__PURE__*/React$1.createContext({
312
+ var GoogleKeysContext = /*#__PURE__*/React.createContext({
308
313
  apiKey: null
309
314
  });
310
315
  var useGoogleKeys = function useGoogleKeys() {
@@ -321,12 +326,13 @@ function GoogleKeysProvider(_ref) {
321
326
  apiKey: apiKey || previousApiKey
322
327
  };
323
328
  }, [previousApiKey, apiKey]);
324
- return /*#__PURE__*/React$1.createElement(GoogleKeysContext, {
325
- value: value
326
- }, children);
329
+ return /*#__PURE__*/jsx(GoogleKeysContext, {
330
+ value: value,
331
+ children: children
332
+ });
327
333
  }
328
334
 
329
- var FontsContext = /*#__PURE__*/React$1.createContext({
335
+ var FontsContext = /*#__PURE__*/React.createContext({
330
336
  systemFonts: null,
331
337
  googleFonts: null,
332
338
  customFonts: null
@@ -429,12 +435,13 @@ function FontsProvider(_ref4) {
429
435
  setGoogleFonts: setGoogleFonts
430
436
  };
431
437
  }, [previousSystemFonts, previousGoogleFonts, previousCustomFonts, customFonts, systemFonts, googleFonts, setGoogleFonts]);
432
- return /*#__PURE__*/React$1.createElement(FontsContext, {
433
- value: fonts
434
- }, children);
438
+ return /*#__PURE__*/jsx(FontsContext, {
439
+ value: fonts,
440
+ children: children
441
+ });
435
442
  }
436
443
 
437
- var FormContext = /*#__PURE__*/React$1.createContext(null);
444
+ var FormContext = /*#__PURE__*/React.createContext(null);
438
445
  var useForm = function useForm() {
439
446
  return useContext(FormContext);
440
447
  };
@@ -458,12 +465,13 @@ function FormProvider(_ref) {
458
465
  setValue: setValue
459
466
  };
460
467
  }, [value, setValue]);
461
- return /*#__PURE__*/React$1.createElement(FormContext, {
462
- value: values
463
- }, children);
468
+ return /*#__PURE__*/jsx(FormContext, {
469
+ value: values,
470
+ children: children
471
+ });
464
472
  }
465
473
 
466
- var GoogleApiClientContext = /*#__PURE__*/React$1.createContext(null);
474
+ var GoogleApiClientContext = /*#__PURE__*/React.createContext(null);
467
475
  var useGoogleApiClient = function useGoogleApiClient() {
468
476
  return useContext(GoogleApiClientContext);
469
477
  };
@@ -476,10 +484,12 @@ var withGoogleApiClient = function withGoogleApiClient(WrappedComponent) {
476
484
  return displayName || name || 'Component';
477
485
  };
478
486
  var WithGoogleApiClientComponent = function WithGoogleApiClientComponent(props) {
479
- return /*#__PURE__*/React$1.createElement(GoogleApiClientContext.Consumer, null, function (client) {
480
- return /*#__PURE__*/React$1.createElement(WrappedComponent, Object.assign({
481
- googleApiClient: client
482
- }, props));
487
+ return /*#__PURE__*/jsx(GoogleApiClientContext.Consumer, {
488
+ children: function children(client) {
489
+ return /*#__PURE__*/jsx(WrappedComponent, _objectSpread({
490
+ googleApiClient: client
491
+ }, props));
492
+ }
483
493
  });
484
494
  };
485
495
  WithGoogleApiClientComponent.displayName = "WithGoogleApiClient(".concat(getDisplayName(WrappedComponent), ")");
@@ -504,12 +514,13 @@ function GoogleApiClientProvider(_ref2) {
504
514
  return setClient(gapi);
505
515
  });
506
516
  }, [apiKey, setClient]);
507
- return /*#__PURE__*/React$1.createElement(GoogleApiClientContext, {
508
- value: client
509
- }, children);
517
+ return /*#__PURE__*/jsx(GoogleApiClientContext, {
518
+ value: client,
519
+ children: children
520
+ });
510
521
  }
511
522
 
512
- var GoogleMapsClientContext = /*#__PURE__*/React$1.createContext(null);
523
+ var GoogleMapsClientContext = /*#__PURE__*/React.createContext(null);
513
524
  var useGoogleMapsClient = function useGoogleMapsClient() {
514
525
  return useContext(GoogleMapsClientContext);
515
526
  };
@@ -522,10 +533,12 @@ var withGoogleMapsClient = function withGoogleMapsClient(WrappedComponent) {
522
533
  return displayName || name || 'Component';
523
534
  };
524
535
  var WithGoogleMapsClientComponent = function WithGoogleMapsClientComponent(props) {
525
- return /*#__PURE__*/React$1.createElement(GoogleMapsClientContext.Consumer, null, function (client) {
526
- return /*#__PURE__*/React$1.createElement(WrappedComponent, Object.assign({
527
- googleApiClient: client
528
- }, props));
536
+ return /*#__PURE__*/jsx(GoogleMapsClientContext.Consumer, {
537
+ children: function children(client) {
538
+ return /*#__PURE__*/jsx(WrappedComponent, _objectSpread({
539
+ googleApiClient: client
540
+ }, props));
541
+ }
529
542
  });
530
543
  };
531
544
  WithGoogleMapsClientComponent.displayName = "WithGoogleMapsClient(".concat(getDisplayName(WrappedComponent), ")");
@@ -555,13 +568,14 @@ function GoogleMapsClientProvider(_ref2) {
555
568
  });
556
569
  }
557
570
  }, [apiKey, locale, libraries, setClient, exisitingClient]);
558
- return /*#__PURE__*/React$1.createElement(GoogleMapsClientContext, {
559
- value: client
560
- }, children);
571
+ return /*#__PURE__*/jsx(GoogleMapsClientContext, {
572
+ value: client,
573
+ children: children
574
+ });
561
575
  }
562
576
 
563
577
  var defaultLocales = ['en', 'fr'];
564
- var LocalesContext = /*#__PURE__*/React$1.createContext({
578
+ var LocalesContext = /*#__PURE__*/React.createContext({
565
579
  locales: defaultLocales
566
580
  });
567
581
  var useLocalesContext = function useLocalesContext() {
@@ -595,12 +609,13 @@ function LocalesProvider(_ref) {
595
609
  locales: locales
596
610
  };
597
611
  }, [locales]);
598
- return /*#__PURE__*/React$1.createElement(LocalesContext, {
599
- value: value
600
- }, children);
612
+ return /*#__PURE__*/jsx(LocalesContext, {
613
+ value: value,
614
+ children: children
615
+ });
601
616
  }
602
617
 
603
- var ModalContext = /*#__PURE__*/React$1.createContext(null);
618
+ var ModalContext = /*#__PURE__*/React.createContext(null);
604
619
  var useModal = function useModal() {
605
620
  return useContext(ModalContext) || {};
606
621
  };
@@ -687,12 +702,13 @@ function ModalProvider(_ref) {
687
702
  getModalById: getModalById
688
703
  };
689
704
  }, [modals, container, setContainer, register, unregister, closeLastModal, getModalById]);
690
- return /*#__PURE__*/React$1.createElement(ModalContext, {
691
- value: value
692
- }, children);
705
+ return /*#__PURE__*/jsx(ModalContext, {
706
+ value: value,
707
+ children: children
708
+ });
693
709
  }
694
710
 
695
- var PanelsContext = /*#__PURE__*/React$1.createContext({
711
+ var PanelsContext = /*#__PURE__*/React.createContext({
696
712
  panels: [],
697
713
  container: null,
698
714
  setContainer: function setContainer() {},
@@ -704,19 +720,21 @@ var usePanels = function usePanels() {
704
720
  };
705
721
  var withPanels = function withPanels(WrappedComponent) {
706
722
  var WithPanelsComponent = function WithPanelsComponent(props) {
707
- return /*#__PURE__*/React$1.createElement(PanelsContext.Consumer, null, function (_ref) {
708
- var panels = _ref.panels,
709
- setContainer = _ref.setContainer,
710
- container = _ref.container,
711
- register = _ref.register,
712
- unregister = _ref.unregister;
713
- return /*#__PURE__*/React$1.createElement(WrappedComponent, Object.assign({
714
- panelsContainer: container,
715
- setPanelsContainer: setContainer,
716
- panels: panels,
717
- registerPanel: register,
718
- unregisterPanel: unregister
719
- }, props));
723
+ return /*#__PURE__*/jsx(PanelsContext.Consumer, {
724
+ children: function children(_ref) {
725
+ var panels = _ref.panels,
726
+ setContainer = _ref.setContainer,
727
+ container = _ref.container,
728
+ register = _ref.register,
729
+ unregister = _ref.unregister;
730
+ return /*#__PURE__*/jsx(WrappedComponent, _objectSpread({
731
+ panelsContainer: container,
732
+ setPanelsContainer: setContainer,
733
+ panels: panels,
734
+ registerPanel: register,
735
+ unregisterPanel: unregister
736
+ }, props));
737
+ }
720
738
  });
721
739
  };
722
740
  WithPanelsComponent.displayName = "WithPanels(".concat(getDisplayName(WrappedComponent), ")");
@@ -768,13 +786,14 @@ function PanelsProvider(_ref2) {
768
786
  unregister: unregister
769
787
  };
770
788
  }, [panels, setContainer, container, register, unregister]);
771
- return /*#__PURE__*/React$1.createElement(PanelsContext, {
772
- value: value
773
- }, children);
789
+ return /*#__PURE__*/jsx(PanelsContext, {
790
+ value: value,
791
+ children: children
792
+ });
774
793
  }
775
794
 
776
795
  var _excluded = ["component"];
777
- var PanneauContext = /*#__PURE__*/React$1.createContext(null);
796
+ var PanneauContext = /*#__PURE__*/React.createContext(null);
778
797
  var usePanneau = function usePanneau() {
779
798
  return useContext(PanneauContext);
780
799
  };
@@ -794,7 +813,7 @@ var usePanneauResource = function usePanneauResource(id) {
794
813
  var usePanneauColorScheme = function usePanneauColorScheme() {
795
814
  var _ref2 = usePanneau() || {},
796
815
  _ref2$theme = _ref2.theme,
797
- theme = _ref2$theme === void 0 ? {} : _ref2$theme;
816
+ theme = _ref2$theme === void 0 ? null : _ref2$theme;
798
817
  var _ref3 = theme || {},
799
818
  _ref3$colorScheme = _ref3.colorScheme,
800
819
  colorScheme = _ref3$colorScheme === void 0 ? 'light' : _ref3$colorScheme;
@@ -853,21 +872,23 @@ var usePanneauSettings = function usePanneauSettings() {
853
872
  function PanneauProvider(_ref8) {
854
873
  var definition = _ref8.definition,
855
874
  children = _ref8.children;
856
- return /*#__PURE__*/React$1.createElement(PanneauContext, {
857
- value: definition
858
- }, children);
875
+ return /*#__PURE__*/jsx(PanneauContext, {
876
+ value: definition,
877
+ children: children
878
+ });
859
879
  }
860
880
 
861
- var ResourceContext = /*#__PURE__*/React$1.createContext(null);
881
+ var ResourceContext = /*#__PURE__*/React.createContext(null);
862
882
  var useResource = function useResource() {
863
883
  return useContext(ResourceContext);
864
884
  };
865
885
  function ResourceProvider(_ref) {
866
886
  var resource = _ref.resource,
867
887
  children = _ref.children;
868
- return /*#__PURE__*/React$1.createElement(ResourceContext, {
869
- value: resource
870
- }, children);
888
+ return /*#__PURE__*/jsx(ResourceContext, {
889
+ value: resource,
890
+ children: children
891
+ });
871
892
  }
872
893
 
873
894
  var useRoutePush = function useRoutePush() {
@@ -920,9 +941,10 @@ function TrackingProvider(_ref) {
920
941
  variables: variables
921
942
  });
922
943
  }, [contextTracking, variables]);
923
- return /*#__PURE__*/React.createElement(TrackingContainer, {
924
- tracking: tracking
925
- }, children);
944
+ return /*#__PURE__*/jsx(TrackingContainer, {
945
+ tracking: tracking,
946
+ children: children
947
+ });
926
948
  }
927
949
 
928
950
  export { ACTIONS_NAMESPACE, APP_NAMESPACE, BUTTONS_NAMESPACE, ComponentsContext, ComponentsProvider, DISPLAYS_NAMESPACE, DefinitionProvider, FIELDS_NAMESPACE, FILTERS_NAMESPACE, FORMS_NAMESPACE, FieldsContext, FieldsProvider, FontsContext, FontsProvider, FormProvider, GoogleApiClientContext, GoogleApiClientProvider, GoogleKeysContext, GoogleKeysProvider, GoogleMapsClientContext, GoogleMapsClientProvider, LISTS_NAMESPACE, LocalesContext, LocalesProvider, MODALS_NAMESPACE, ModalContext, ModalProvider, PAGES_NAMESPACE, PREVIEWS_NAMESPACE, PanelsContext, PanelsProvider, PanneauProvider, ResourceProvider, TrackingProvider, useActionComponent, useActionsComponents, useActionsComponentsManager, useAppComponent, useAppComponents, useAppComponentsManager, useButtonComponent, useButtonsComponents, useButtonsComponentsManager, useComponent, useComponents, useComponentsManager, useDefinition, useDefinitionContext, useDisplayComponent, useDisplaysComponents, useDisplaysComponentsManager, useField, useFieldComponent, useFields, useFieldsComponents, useFieldsComponentsManager, useFieldsManager, useFilterComponent, useFiltersComponents, useFiltersComponentsManager, useFonts, useForm, useFormComponent, useFormSetValue, useFormValue, useFormsComponents, useFormsComponentsManager, useGoogleApiClient, useGoogleFonts, useGoogleKeys, useGoogleMapsClient, useListComponent, useListsComponents, useListsComponentsManager, useLocales, useLocalesContext, useModal, useModalComponent, useModalsComponents, useModalsComponentsManager, useOtherLocales, usePageComponent, usePagesComponents, usePagesComponentsManager, usePanels, usePanneau, usePanneauAuth, usePanneauColorScheme, usePanneauComponent, usePanneauComponents, usePanneauResource, usePanneauResources, usePanneauSettings, usePreviewComponent, usePreviewsComponents, usePreviewsComponentsManager, useResource, useRouteBack, useRoutePush, useTracking, withGoogleApiClient, withGoogleMapsClient, withPanels };
package/lib/contexts.js CHANGED
@@ -2,8 +2,9 @@
2
2
 
3
3
  var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
4
4
  var isString = require('lodash-es/isString');
5
- var React$1 = require('react');
5
+ var React = require('react');
6
6
  var core = require('@panneau/core');
7
+ var jsxRuntime = require('react/jsx-runtime');
7
8
  var _defineProperty = require('@babel/runtime/helpers/defineProperty');
8
9
  var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
9
10
  var uniqBy = require('lodash-es/uniqBy');
@@ -15,7 +16,6 @@ var reactIntl = require('react-intl');
15
16
  var utils = require('@panneau/core/utils');
16
17
  var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
17
18
  var PropTypes = require('prop-types');
18
- var jsxRuntime = require('react/jsx-runtime');
19
19
  var pathToRegexp = require('path-to-regexp');
20
20
  var regexparam = require('regexparam');
21
21
  var index_js = require('use-sync-external-store/shim/index.js');
@@ -38,7 +38,7 @@ function _interopNamespaceDefault(e) {
38
38
  return Object.freeze(n);
39
39
  }
40
40
 
41
- var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React$1);
41
+ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
42
42
 
43
43
  var MODALS_NAMESPACE = 'modals';
44
44
  var FIELDS_NAMESPACE = 'fields';
@@ -51,15 +51,15 @@ var BUTTONS_NAMESPACE = 'buttons';
51
51
  var PAGES_NAMESPACE = 'pages';
52
52
  var PREVIEWS_NAMESPACE = 'previews';
53
53
  var APP_NAMESPACE = 'app';
54
- var ComponentsContext = /*#__PURE__*/React$1.createContext(null);
54
+ var ComponentsContext = /*#__PURE__*/React.createContext(null);
55
55
 
56
56
  /**
57
57
  * Hooks
58
58
  */
59
59
  var useComponentsManager = function useComponentsManager() {
60
60
  var namespace = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
61
- var manager = React$1.useContext(ComponentsContext);
62
- var finalManager = React$1.useMemo(function () {
61
+ var manager = React.useContext(ComponentsContext);
62
+ var finalManager = React.useMemo(function () {
63
63
  return namespace !== null ? new core.ComponentsManager(manager.getComponents(namespace)) : manager;
64
64
  }, [manager, namespace]);
65
65
  return finalManager;
@@ -74,7 +74,7 @@ var useComponent = function useComponent(name) {
74
74
  var defaultComponent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
75
75
  var namespace = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
76
76
  var manager = useComponentsManager(namespace);
77
- return React$1.useMemo(function () {
77
+ return React.useMemo(function () {
78
78
  if (!isString(name)) {
79
79
  return name || defaultComponent;
80
80
  }
@@ -261,17 +261,18 @@ function ComponentsProvider(_ref) {
261
261
  namespace = _ref$namespace === void 0 ? null : _ref$namespace,
262
262
  children = _ref.children;
263
263
  var previousManager = useComponentsManager() || null;
264
- var finalManager = React$1.useMemo(function () {
264
+ var finalManager = React.useMemo(function () {
265
265
  return new core.ComponentsManager(_objectSpread(_objectSpread(_objectSpread({}, previousManager !== null ? previousManager.getComponents() : null), manager !== null ? manager.getComponents() : null), new core.ComponentsManager(components).addNamespace(namespace).getComponents()));
266
266
  }, [previousManager, manager, components, namespace]);
267
- return /*#__PURE__*/React$1.createElement(ComponentsContext, {
268
- value: finalManager
269
- }, children);
267
+ return /*#__PURE__*/jsxRuntime.jsx(ComponentsContext, {
268
+ value: finalManager,
269
+ children: children
270
+ });
270
271
  }
271
272
 
272
- var DefinitionContext = /*#__PURE__*/React$1.createContext(null);
273
+ var DefinitionContext = /*#__PURE__*/React.createContext(null);
273
274
  var useDefinitionContext = function useDefinitionContext() {
274
- return React$1.useContext(DefinitionContext);
275
+ return React.useContext(DefinitionContext);
275
276
  };
276
277
  var useDefinition = function useDefinition() {
277
278
  var definition = useDefinitionContext();
@@ -280,14 +281,15 @@ var useDefinition = function useDefinition() {
280
281
  function DefinitionProvider(_ref) {
281
282
  var definition = _ref.definition,
282
283
  children = _ref.children;
283
- return /*#__PURE__*/React$1.createElement(DefinitionContext, {
284
- value: definition
285
- }, children);
284
+ return /*#__PURE__*/jsxRuntime.jsx(DefinitionContext, {
285
+ value: definition,
286
+ children: children
287
+ });
286
288
  }
287
289
 
288
- var FieldsContext = /*#__PURE__*/React$1.createContext(null);
290
+ var FieldsContext = /*#__PURE__*/React.createContext(null);
289
291
  var useFieldsManager = function useFieldsManager() {
290
- return React$1.useContext(FieldsContext);
292
+ return React.useContext(FieldsContext);
291
293
  };
292
294
  var useField = function useField(id) {
293
295
  var manager = useFieldsManager();
@@ -304,33 +306,35 @@ function FieldsProvider(_ref) {
304
306
  manager = _ref$manager === void 0 ? null : _ref$manager,
305
307
  children = _ref.children;
306
308
  var previousManager = useFieldsManager() || null;
307
- var finalManager = React$1.useMemo(function () {
309
+ var finalManager = React.useMemo(function () {
308
310
  var newFields = uniqBy([].concat(_toConsumableArray(fields || []), _toConsumableArray(manager !== null ? manager.getDefinitions() : []), _toConsumableArray(previousManager !== null ? previousManager.getDefinitions() : [])), function (_ref2) {
309
311
  var id = _ref2.id;
310
312
  return id;
311
313
  }).reverse();
312
314
  return new core.FieldsManager(newFields);
313
315
  }, [previousManager, manager, fields]);
314
- var components = React$1.useMemo(function () {
316
+ var components = React.useMemo(function () {
315
317
  var newComponents = finalManager.getComponents();
316
318
  return Object.keys(newComponents).reduce(function (map, id) {
317
319
  var component = newComponents[id];
318
320
  return isString(component) ? map : _objectSpread(_objectSpread({}, map), {}, _defineProperty({}, id, component));
319
321
  }, {});
320
322
  }, [finalManager]);
321
- return /*#__PURE__*/React$1.createElement(FieldsContext, {
322
- value: finalManager
323
- }, /*#__PURE__*/React$1.createElement(ComponentsProvider, {
324
- namespace: FIELDS_NAMESPACE,
325
- components: components
326
- }, children));
323
+ return /*#__PURE__*/jsxRuntime.jsx(FieldsContext, {
324
+ value: finalManager,
325
+ children: /*#__PURE__*/jsxRuntime.jsx(ComponentsProvider, {
326
+ namespace: FIELDS_NAMESPACE,
327
+ components: components,
328
+ children: children
329
+ })
330
+ });
327
331
  }
328
332
 
329
- var GoogleKeysContext = /*#__PURE__*/React$1.createContext({
333
+ var GoogleKeysContext = /*#__PURE__*/React.createContext({
330
334
  apiKey: null
331
335
  });
332
336
  var useGoogleKeys = function useGoogleKeys() {
333
- return React$1.useContext(GoogleKeysContext);
337
+ return React.useContext(GoogleKeysContext);
334
338
  };
335
339
  function GoogleKeysProvider(_ref) {
336
340
  var children = _ref.children,
@@ -338,17 +342,18 @@ function GoogleKeysProvider(_ref) {
338
342
  apiKey = _ref$apiKey === void 0 ? null : _ref$apiKey;
339
343
  var _useGoogleKeys = useGoogleKeys(),
340
344
  previousApiKey = _useGoogleKeys.apiKey;
341
- var value = React$1.useMemo(function () {
345
+ var value = React.useMemo(function () {
342
346
  return {
343
347
  apiKey: apiKey || previousApiKey
344
348
  };
345
349
  }, [previousApiKey, apiKey]);
346
- return /*#__PURE__*/React$1.createElement(GoogleKeysContext, {
347
- value: value
348
- }, children);
350
+ return /*#__PURE__*/jsxRuntime.jsx(GoogleKeysContext, {
351
+ value: value,
352
+ children: children
353
+ });
349
354
  }
350
355
 
351
- var FontsContext = /*#__PURE__*/React$1.createContext({
356
+ var FontsContext = /*#__PURE__*/React.createContext({
352
357
  systemFonts: null,
353
358
  googleFonts: null,
354
359
  customFonts: null
@@ -361,11 +366,11 @@ var useGoogleFonts = function useGoogleFonts() {
361
366
  setFonts = _ref$setFonts === void 0 ? null : _ref$setFonts;
362
367
  var _useGoogleKeys = useGoogleKeys(),
363
368
  apiKey = _useGoogleKeys.apiKey;
364
- var _useState = React$1.useState(null),
369
+ var _useState = React.useState(null),
365
370
  _useState2 = _slicedToArray(_useState, 2),
366
371
  googleFonts = _useState2[0],
367
372
  setGoogleFonts = _useState2[1];
368
- React$1.useEffect(function () {
373
+ React.useEffect(function () {
369
374
  var canceled = false;
370
375
  if (apiKey !== null && !disabled) {
371
376
  fetch.getJSON("https://www.googleapis.com/webfonts/v1/webfonts?key=".concat(apiKey, "&sort=popularity")).then(function (_ref2) {
@@ -397,7 +402,7 @@ var useFonts = function useFonts() {
397
402
  var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
398
403
  _ref3$withoutGoogleFo = _ref3.withoutGoogleFonts,
399
404
  withoutGoogleFonts = _ref3$withoutGoogleFo === void 0 ? false : _ref3$withoutGoogleFo;
400
- var _useContext = React$1.useContext(FontsContext),
405
+ var _useContext = React.useContext(FontsContext),
401
406
  _useContext$setGoogle = _useContext.setGoogleFonts,
402
407
  setGoogleFonts = _useContext$setGoogle === void 0 ? null : _useContext$setGoogle,
403
408
  _useContext$systemFon = _useContext.systemFonts,
@@ -410,7 +415,7 @@ var useFonts = function useFonts() {
410
415
  disabled: withoutGoogleFonts || googleFonts !== null && googleFonts.length > 0,
411
416
  setFonts: setGoogleFonts
412
417
  });
413
- var fonts = React$1.useMemo(function () {
418
+ var fonts = React.useMemo(function () {
414
419
  return {
415
420
  systemFonts: systemFonts,
416
421
  googleFonts: googleFonts,
@@ -433,11 +438,11 @@ function FontsProvider(_ref4) {
433
438
  previousGoogleFonts = _useFonts$googleFonts === void 0 ? null : _useFonts$googleFonts,
434
439
  _useFonts$customFonts = _useFonts.customFonts,
435
440
  previousCustomFonts = _useFonts$customFonts === void 0 ? null : _useFonts$customFonts;
436
- var _useState3 = React$1.useState(null),
441
+ var _useState3 = React.useState(null),
437
442
  _useState4 = _slicedToArray(_useState3, 2),
438
443
  googleFonts = _useState4[0],
439
444
  setGoogleFonts = _useState4[1];
440
- var fonts = React$1.useMemo(function () {
445
+ var fonts = React.useMemo(function () {
441
446
  return {
442
447
  systemFonts: uniqBy([].concat(_toConsumableArray(previousSystemFonts || []), _toConsumableArray(systemFonts || [])), function (font) {
443
448
  return isObject(font) ? font.name : font;
@@ -451,14 +456,15 @@ function FontsProvider(_ref4) {
451
456
  setGoogleFonts: setGoogleFonts
452
457
  };
453
458
  }, [previousSystemFonts, previousGoogleFonts, previousCustomFonts, customFonts, systemFonts, googleFonts, setGoogleFonts]);
454
- return /*#__PURE__*/React$1.createElement(FontsContext, {
455
- value: fonts
456
- }, children);
459
+ return /*#__PURE__*/jsxRuntime.jsx(FontsContext, {
460
+ value: fonts,
461
+ children: children
462
+ });
457
463
  }
458
464
 
459
- var FormContext = /*#__PURE__*/React$1.createContext(null);
465
+ var FormContext = /*#__PURE__*/React.createContext(null);
460
466
  var useForm = function useForm() {
461
- return React$1.useContext(FormContext);
467
+ return React.useContext(FormContext);
462
468
  };
463
469
  var useFormValue = function useFormValue() {
464
470
  var _useForm = useForm(),
@@ -474,20 +480,21 @@ function FormProvider(_ref) {
474
480
  var value = _ref.value,
475
481
  setValue = _ref.setValue,
476
482
  children = _ref.children;
477
- var values = React$1.useMemo(function () {
483
+ var values = React.useMemo(function () {
478
484
  return {
479
485
  value: value,
480
486
  setValue: setValue
481
487
  };
482
488
  }, [value, setValue]);
483
- return /*#__PURE__*/React$1.createElement(FormContext, {
484
- value: values
485
- }, children);
489
+ return /*#__PURE__*/jsxRuntime.jsx(FormContext, {
490
+ value: values,
491
+ children: children
492
+ });
486
493
  }
487
494
 
488
- var GoogleApiClientContext = /*#__PURE__*/React$1.createContext(null);
495
+ var GoogleApiClientContext = /*#__PURE__*/React.createContext(null);
489
496
  var useGoogleApiClient = function useGoogleApiClient() {
490
- return React$1.useContext(GoogleApiClientContext);
497
+ return React.useContext(GoogleApiClientContext);
491
498
  };
492
499
  var withGoogleApiClient = function withGoogleApiClient(WrappedComponent) {
493
500
  var getDisplayName = function getDisplayName(_ref) {
@@ -498,10 +505,12 @@ var withGoogleApiClient = function withGoogleApiClient(WrappedComponent) {
498
505
  return displayName || name || 'Component';
499
506
  };
500
507
  var WithGoogleApiClientComponent = function WithGoogleApiClientComponent(props) {
501
- return /*#__PURE__*/React$1.createElement(GoogleApiClientContext.Consumer, null, function (client) {
502
- return /*#__PURE__*/React$1.createElement(WrappedComponent, Object.assign({
503
- googleApiClient: client
504
- }, props));
508
+ return /*#__PURE__*/jsxRuntime.jsx(GoogleApiClientContext.Consumer, {
509
+ children: function children(client) {
510
+ return /*#__PURE__*/jsxRuntime.jsx(WrappedComponent, _objectSpread({
511
+ googleApiClient: client
512
+ }, props));
513
+ }
505
514
  });
506
515
  };
507
516
  WithGoogleApiClientComponent.displayName = "WithGoogleApiClient(".concat(getDisplayName(WrappedComponent), ")");
@@ -511,11 +520,11 @@ function GoogleApiClientProvider(_ref2) {
511
520
  var children = _ref2.children;
512
521
  var _useGoogleKeys = useGoogleKeys(),
513
522
  apiKey = _useGoogleKeys.apiKey;
514
- var _useState = React$1.useState(null),
523
+ var _useState = React.useState(null),
515
524
  _useState2 = _slicedToArray(_useState, 2),
516
525
  client = _useState2[0],
517
526
  setClient = _useState2[1];
518
- React$1.useEffect(function () {
527
+ React.useEffect(function () {
519
528
  services.loadGoogleApi().then(function (gapi) {
520
529
  return gapi.client.init({
521
530
  apiKey: apiKey
@@ -526,14 +535,15 @@ function GoogleApiClientProvider(_ref2) {
526
535
  return setClient(gapi);
527
536
  });
528
537
  }, [apiKey, setClient]);
529
- return /*#__PURE__*/React$1.createElement(GoogleApiClientContext, {
530
- value: client
531
- }, children);
538
+ return /*#__PURE__*/jsxRuntime.jsx(GoogleApiClientContext, {
539
+ value: client,
540
+ children: children
541
+ });
532
542
  }
533
543
 
534
- var GoogleMapsClientContext = /*#__PURE__*/React$1.createContext(null);
544
+ var GoogleMapsClientContext = /*#__PURE__*/React.createContext(null);
535
545
  var useGoogleMapsClient = function useGoogleMapsClient() {
536
- return React$1.useContext(GoogleMapsClientContext);
546
+ return React.useContext(GoogleMapsClientContext);
537
547
  };
538
548
  var withGoogleMapsClient = function withGoogleMapsClient(WrappedComponent) {
539
549
  var getDisplayName = function getDisplayName(_ref) {
@@ -544,10 +554,12 @@ var withGoogleMapsClient = function withGoogleMapsClient(WrappedComponent) {
544
554
  return displayName || name || 'Component';
545
555
  };
546
556
  var WithGoogleMapsClientComponent = function WithGoogleMapsClientComponent(props) {
547
- return /*#__PURE__*/React$1.createElement(GoogleMapsClientContext.Consumer, null, function (client) {
548
- return /*#__PURE__*/React$1.createElement(WrappedComponent, Object.assign({
549
- googleApiClient: client
550
- }, props));
557
+ return /*#__PURE__*/jsxRuntime.jsx(GoogleMapsClientContext.Consumer, {
558
+ children: function children(client) {
559
+ return /*#__PURE__*/jsxRuntime.jsx(WrappedComponent, _objectSpread({
560
+ googleApiClient: client
561
+ }, props));
562
+ }
551
563
  });
552
564
  };
553
565
  WithGoogleMapsClientComponent.displayName = "WithGoogleMapsClient(".concat(getDisplayName(WrappedComponent), ")");
@@ -562,11 +574,11 @@ function GoogleMapsClientProvider(_ref2) {
562
574
  var _useGoogleKeys = useGoogleKeys(),
563
575
  apiKey = _useGoogleKeys.apiKey;
564
576
  var exisitingClient = useGoogleMapsClient();
565
- var _useState = React$1.useState(exisitingClient),
577
+ var _useState = React.useState(exisitingClient),
566
578
  _useState2 = _slicedToArray(_useState, 2),
567
579
  client = _useState2[0],
568
580
  setClient = _useState2[1];
569
- React$1.useEffect(function () {
581
+ React.useEffect(function () {
570
582
  if (exisitingClient === null) {
571
583
  services.loadGoogleMaps({
572
584
  apiKey: apiKey,
@@ -577,17 +589,18 @@ function GoogleMapsClientProvider(_ref2) {
577
589
  });
578
590
  }
579
591
  }, [apiKey, locale, libraries, setClient, exisitingClient]);
580
- return /*#__PURE__*/React$1.createElement(GoogleMapsClientContext, {
581
- value: client
582
- }, children);
592
+ return /*#__PURE__*/jsxRuntime.jsx(GoogleMapsClientContext, {
593
+ value: client,
594
+ children: children
595
+ });
583
596
  }
584
597
 
585
598
  var defaultLocales = ['en', 'fr'];
586
- var LocalesContext = /*#__PURE__*/React$1.createContext({
599
+ var LocalesContext = /*#__PURE__*/React.createContext({
587
600
  locales: defaultLocales
588
601
  });
589
602
  var useLocalesContext = function useLocalesContext() {
590
- var context = React$1.useContext(LocalesContext);
603
+ var context = React.useContext(LocalesContext);
591
604
  return context;
592
605
  };
593
606
  var useLocales = function useLocales() {
@@ -600,7 +613,7 @@ var useOtherLocales = function useOtherLocales() {
600
613
  locales = _useLocalesContext2.locales;
601
614
  var _useIntl = reactIntl.useIntl(),
602
615
  locale = _useIntl.locale;
603
- var otherLocales = React$1.useMemo(function () {
616
+ var otherLocales = React.useMemo(function () {
604
617
  return locales.filter(function (it) {
605
618
  return it !== locale;
606
619
  });
@@ -612,35 +625,36 @@ function LocalesProvider(_ref) {
612
625
  var _ref$locales = _ref.locales,
613
626
  locales = _ref$locales === void 0 ? DEFAULT_LOCALES : _ref$locales,
614
627
  children = _ref.children;
615
- var value = React$1.useMemo(function () {
628
+ var value = React.useMemo(function () {
616
629
  return {
617
630
  locales: locales
618
631
  };
619
632
  }, [locales]);
620
- return /*#__PURE__*/React$1.createElement(LocalesContext, {
621
- value: value
622
- }, children);
633
+ return /*#__PURE__*/jsxRuntime.jsx(LocalesContext, {
634
+ value: value,
635
+ children: children
636
+ });
623
637
  }
624
638
 
625
- var ModalContext = /*#__PURE__*/React$1.createContext(null);
639
+ var ModalContext = /*#__PURE__*/React.createContext(null);
626
640
  var useModal = function useModal() {
627
- return React$1.useContext(ModalContext) || {};
641
+ return React.useContext(ModalContext) || {};
628
642
  };
629
643
  var DEFAULT_MODALS = [];
630
644
  function ModalProvider(_ref) {
631
645
  var children = _ref.children,
632
646
  _ref$container = _ref.container,
633
647
  initialContainer = _ref$container === void 0 ? null : _ref$container;
634
- var _useState = React$1.useState(initialContainer),
648
+ var _useState = React.useState(initialContainer),
635
649
  _useState2 = _slicedToArray(_useState, 2),
636
650
  container = _useState2[0],
637
651
  setContainer = _useState2[1];
638
- var _useState3 = React$1.useState(DEFAULT_MODALS),
652
+ var _useState3 = React.useState(DEFAULT_MODALS),
639
653
  _useState4 = _slicedToArray(_useState3, 2),
640
654
  modals = _useState4[0],
641
655
  setModals = _useState4[1];
642
- var modalsRef = React$1.useRef(modals);
643
- var register = React$1.useCallback(function (id) {
656
+ var modalsRef = React.useRef(modals);
657
+ var register = React.useCallback(function (id) {
644
658
  var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
645
659
  var _modalsRef$current = modalsRef.current,
646
660
  currentModals = _modalsRef$current === void 0 ? [] : _modalsRef$current;
@@ -650,7 +664,7 @@ function ModalProvider(_ref) {
650
664
  setModals(newModals);
651
665
  modalsRef.current = newModals;
652
666
  }, [setModals]);
653
- var unregister = React$1.useCallback(function () {
667
+ var unregister = React.useCallback(function () {
654
668
  var id = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
655
669
  var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
656
670
  var _modalsRef$current2 = modalsRef.current,
@@ -674,7 +688,7 @@ function ModalProvider(_ref) {
674
688
  modalsRef.current = newModals;
675
689
  }
676
690
  }, [setModals]);
677
- var closeLastModal = React$1.useCallback(function () {
691
+ var closeLastModal = React.useCallback(function () {
678
692
  var lastModal = modals.pop() || null;
679
693
  if (lastModal !== null) {
680
694
  var _ref5 = lastModal || {},
@@ -693,12 +707,12 @@ function ModalProvider(_ref) {
693
707
  modalsRef.current = newModals;
694
708
  }
695
709
  }, [modals, setModals]);
696
- var getModalById = React$1.useCallback(function (modalId) {
710
+ var getModalById = React.useCallback(function (modalId) {
697
711
  return (modals || []).find(function (modal) {
698
712
  return (modal === null || modal === void 0 ? void 0 : modal.id) === modalId;
699
713
  }) || null;
700
714
  }, [modals]);
701
- var value = React$1.useMemo(function () {
715
+ var value = React.useMemo(function () {
702
716
  return {
703
717
  modals: modals,
704
718
  container: container,
@@ -709,12 +723,13 @@ function ModalProvider(_ref) {
709
723
  getModalById: getModalById
710
724
  };
711
725
  }, [modals, container, setContainer, register, unregister, closeLastModal, getModalById]);
712
- return /*#__PURE__*/React$1.createElement(ModalContext, {
713
- value: value
714
- }, children);
726
+ return /*#__PURE__*/jsxRuntime.jsx(ModalContext, {
727
+ value: value,
728
+ children: children
729
+ });
715
730
  }
716
731
 
717
- var PanelsContext = /*#__PURE__*/React$1.createContext({
732
+ var PanelsContext = /*#__PURE__*/React.createContext({
718
733
  panels: [],
719
734
  container: null,
720
735
  setContainer: function setContainer() {},
@@ -722,23 +737,25 @@ var PanelsContext = /*#__PURE__*/React$1.createContext({
722
737
  unregister: function unregister() {}
723
738
  });
724
739
  var usePanels = function usePanels() {
725
- return React$1.useContext(PanelsContext) || {};
740
+ return React.useContext(PanelsContext) || {};
726
741
  };
727
742
  var withPanels = function withPanels(WrappedComponent) {
728
743
  var WithPanelsComponent = function WithPanelsComponent(props) {
729
- return /*#__PURE__*/React$1.createElement(PanelsContext.Consumer, null, function (_ref) {
730
- var panels = _ref.panels,
731
- setContainer = _ref.setContainer,
732
- container = _ref.container,
733
- register = _ref.register,
734
- unregister = _ref.unregister;
735
- return /*#__PURE__*/React$1.createElement(WrappedComponent, Object.assign({
736
- panelsContainer: container,
737
- setPanelsContainer: setContainer,
738
- panels: panels,
739
- registerPanel: register,
740
- unregisterPanel: unregister
741
- }, props));
744
+ return /*#__PURE__*/jsxRuntime.jsx(PanelsContext.Consumer, {
745
+ children: function children(_ref) {
746
+ var panels = _ref.panels,
747
+ setContainer = _ref.setContainer,
748
+ container = _ref.container,
749
+ register = _ref.register,
750
+ unregister = _ref.unregister;
751
+ return /*#__PURE__*/jsxRuntime.jsx(WrappedComponent, _objectSpread({
752
+ panelsContainer: container,
753
+ setPanelsContainer: setContainer,
754
+ panels: panels,
755
+ registerPanel: register,
756
+ unregisterPanel: unregister
757
+ }, props));
758
+ }
742
759
  });
743
760
  };
744
761
  WithPanelsComponent.displayName = "WithPanels(".concat(utils.getDisplayName(WrappedComponent), ")");
@@ -748,16 +765,16 @@ function PanelsProvider(_ref2) {
748
765
  var children = _ref2.children,
749
766
  _ref2$container = _ref2.container,
750
767
  initialContainer = _ref2$container === void 0 ? null : _ref2$container;
751
- var _useState = React$1.useState(initialContainer),
768
+ var _useState = React.useState(initialContainer),
752
769
  _useState2 = _slicedToArray(_useState, 2),
753
770
  container = _useState2[0],
754
771
  setContainer = _useState2[1];
755
- var _useState3 = React$1.useState([]),
772
+ var _useState3 = React.useState([]),
756
773
  _useState4 = _slicedToArray(_useState3, 2),
757
774
  panels = _useState4[0],
758
775
  setPanels = _useState4[1];
759
- var panelsRef = React$1.useRef(panels);
760
- var register = React$1.useCallback(function (id) {
776
+ var panelsRef = React.useRef(panels);
777
+ var register = React.useCallback(function (id) {
761
778
  var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
762
779
  var currentPanels = panelsRef.current;
763
780
  var newPanels = [].concat(_toConsumableArray(currentPanels), [_objectSpread({
@@ -766,7 +783,7 @@ function PanelsProvider(_ref2) {
766
783
  setPanels(newPanels);
767
784
  panelsRef.current = newPanels;
768
785
  }, [panels, setPanels]);
769
- var unregister = React$1.useCallback(function (id) {
786
+ var unregister = React.useCallback(function (id) {
770
787
  var currentPanels = panelsRef.current;
771
788
  var foundIndex = currentPanels.findIndex(function (_ref3) {
772
789
  var modalId = _ref3.id;
@@ -781,7 +798,7 @@ function PanelsProvider(_ref2) {
781
798
  panelsRef.current = newPanels;
782
799
  }
783
800
  }, [panels, setPanels]);
784
- var value = React$1.useMemo(function () {
801
+ var value = React.useMemo(function () {
785
802
  return {
786
803
  panels: panels,
787
804
  setContainer: setContainer,
@@ -790,15 +807,16 @@ function PanelsProvider(_ref2) {
790
807
  unregister: unregister
791
808
  };
792
809
  }, [panels, setContainer, container, register, unregister]);
793
- return /*#__PURE__*/React$1.createElement(PanelsContext, {
794
- value: value
795
- }, children);
810
+ return /*#__PURE__*/jsxRuntime.jsx(PanelsContext, {
811
+ value: value,
812
+ children: children
813
+ });
796
814
  }
797
815
 
798
816
  var _excluded = ["component"];
799
- var PanneauContext = /*#__PURE__*/React$1.createContext(null);
817
+ var PanneauContext = /*#__PURE__*/React.createContext(null);
800
818
  var usePanneau = function usePanneau() {
801
- return React$1.useContext(PanneauContext);
819
+ return React.useContext(PanneauContext);
802
820
  };
803
821
  var DEFAULT_RESOURCES = [];
804
822
  var usePanneauResources = function usePanneauResources() {
@@ -816,7 +834,7 @@ var usePanneauResource = function usePanneauResource(id) {
816
834
  var usePanneauColorScheme = function usePanneauColorScheme() {
817
835
  var _ref2 = usePanneau() || {},
818
836
  _ref2$theme = _ref2.theme,
819
- theme = _ref2$theme === void 0 ? {} : _ref2$theme;
837
+ theme = _ref2$theme === void 0 ? null : _ref2$theme;
820
838
  var _ref3 = theme || {},
821
839
  _ref3$colorScheme = _ref3.colorScheme,
822
840
  colorScheme = _ref3$colorScheme === void 0 ? 'light' : _ref3$colorScheme;
@@ -875,21 +893,23 @@ var usePanneauSettings = function usePanneauSettings() {
875
893
  function PanneauProvider(_ref8) {
876
894
  var definition = _ref8.definition,
877
895
  children = _ref8.children;
878
- return /*#__PURE__*/React$1.createElement(PanneauContext, {
879
- value: definition
880
- }, children);
896
+ return /*#__PURE__*/jsxRuntime.jsx(PanneauContext, {
897
+ value: definition,
898
+ children: children
899
+ });
881
900
  }
882
901
 
883
- var ResourceContext = /*#__PURE__*/React$1.createContext(null);
902
+ var ResourceContext = /*#__PURE__*/React.createContext(null);
884
903
  var useResource = function useResource() {
885
- return React$1.useContext(ResourceContext);
904
+ return React.useContext(ResourceContext);
886
905
  };
887
906
  function ResourceProvider(_ref) {
888
907
  var resource = _ref.resource,
889
908
  children = _ref.children;
890
- return /*#__PURE__*/React$1.createElement(ResourceContext, {
891
- value: resource
892
- }, children);
909
+ return /*#__PURE__*/jsxRuntime.jsx(ResourceContext, {
910
+ value: resource,
911
+ children: children
912
+ });
893
913
  }
894
914
 
895
915
  // React.useInsertionEffect is not available in React <18
@@ -1083,11 +1103,11 @@ var defaultRouter = {
1083
1103
  return x;
1084
1104
  }
1085
1105
  };
1086
- var RouterCtx = React$1.createContext(defaultRouter);
1106
+ var RouterCtx = React.createContext(defaultRouter);
1087
1107
 
1088
1108
  // gets the closest parent router from the context
1089
1109
  var useRouter = function useRouter() {
1090
- return React$1.useContext(RouterCtx);
1110
+ return React.useContext(RouterCtx);
1091
1111
  };
1092
1112
 
1093
1113
  /**
@@ -1096,7 +1116,7 @@ var useRouter = function useRouter() {
1096
1116
  */
1097
1117
 
1098
1118
  var Params0 = {};
1099
- React$1.createContext(Params0);
1119
+ React.createContext(Params0);
1100
1120
 
1101
1121
  /*
1102
1122
  * Part 1, Hooks API: useRoute and useLocation
@@ -1120,7 +1140,7 @@ var useLocationFromRouter = function useLocationFromRouter(router) {
1120
1140
  var useLocation = function useLocation() {
1121
1141
  return useLocationFromRouter(useRouter());
1122
1142
  };
1123
- React$1.forwardRef(function (props, ref) {
1143
+ React.forwardRef(function (props, ref) {
1124
1144
  var router = useRouter();
1125
1145
  var _useLocationFromRoute3 = useLocationFromRouter(router),
1126
1146
  _useLocationFromRoute4 = _slicedToArray(_useLocationFromRoute3, 2),
@@ -1151,10 +1171,10 @@ React$1.forwardRef(function (props, ref) {
1151
1171
  // handle nested routers and absolute paths
1152
1172
  var href = router.hrefs(targetPath[0] === "~" ? targetPath.slice(1) : router.base + targetPath, router // pass router as a second argument for convinience
1153
1173
  );
1154
- return asChild && React$1.isValidElement(children) ? React$1.cloneElement(children, {
1174
+ return asChild && React.isValidElement(children) ? React.cloneElement(children, {
1155
1175
  onClick: onClick,
1156
1176
  href: href
1157
- }) : React$1.createElement("a", _objectSpread(_objectSpread({}, restProps), {}, {
1177
+ }) : React.createElement("a", _objectSpread(_objectSpread({}, restProps), {}, {
1158
1178
  onClick: onClick,
1159
1179
  href: href,
1160
1180
  // `className` can be a function to apply the class if this link is active
@@ -1165,9 +1185,9 @@ React$1.forwardRef(function (props, ref) {
1165
1185
  });
1166
1186
 
1167
1187
  /* eslint-disable react/jsx-props-no-spreading */
1168
- var RoutesContext = /*#__PURE__*/React$1.createContext(null);
1188
+ var RoutesContext = /*#__PURE__*/React.createContext(null);
1169
1189
  var useRoutesContext = function useRoutesContext() {
1170
- return React$1.useContext(RoutesContext);
1190
+ return React.useContext(RoutesContext);
1171
1191
  };
1172
1192
  var propTypes$1 = {
1173
1193
  children: PropTypes.node.isRequired,
@@ -1181,7 +1201,7 @@ function RoutesProvider(_ref) {
1181
1201
  var routes = _ref.routes,
1182
1202
  basePath = _ref.basePath,
1183
1203
  children = _ref.children;
1184
- var value = React$1.useMemo(function () {
1204
+ var value = React.useMemo(function () {
1185
1205
  return {
1186
1206
  routes: routes,
1187
1207
  basePath: basePath
@@ -1210,7 +1230,7 @@ var useUrlGeneratorPathToRepexp = function useUrlGeneratorPathToRepexp() {
1210
1230
  routes = _ref2$routes === void 0 ? null : _ref2$routes,
1211
1231
  _ref2$basePath = _ref2.basePath,
1212
1232
  basePath = _ref2$basePath === void 0 ? null : _ref2$basePath;
1213
- var urlGenerator = React$1.useCallback(function (key, data, opts) {
1233
+ var urlGenerator = React.useCallback(function (key, data, opts) {
1214
1234
  var path = routes !== null ? routes[key] || null : null;
1215
1235
  if (path === null) {
1216
1236
  return null;
@@ -1236,7 +1256,7 @@ var useRoutePush = function useRoutePush() {
1236
1256
  var _useLocation = useLocation(),
1237
1257
  _useLocation2 = _slicedToArray(_useLocation, 2),
1238
1258
  navigate = _useLocation2[1];
1239
- var push = React$1.useCallback(function (route, data) {
1259
+ var push = React.useCallback(function (route, data) {
1240
1260
  for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
1241
1261
  args[_key - 2] = arguments[_key];
1242
1262
  }
@@ -1258,21 +1278,21 @@ var useRouteBack = function useRouteBack() {
1258
1278
  var _useLocation3 = useLocation(),
1259
1279
  _useLocation4 = _slicedToArray(_useLocation3, 2),
1260
1280
  navigate = _useLocation4[1];
1261
- var back = React$1.useCallback(function () {
1281
+ var back = React.useCallback(function () {
1262
1282
  return navigate(-1);
1263
1283
  }, [navigate, url]);
1264
1284
  return back;
1265
1285
  };
1266
1286
 
1267
1287
  var useTracking = function useTracking() {
1268
- return React$1.useContext(tracking.TrackingContext);
1288
+ return React.useContext(tracking.TrackingContext);
1269
1289
  };
1270
1290
  function TrackingProvider(_ref) {
1271
1291
  var _ref$variables = _ref.variables,
1272
1292
  variables = _ref$variables === void 0 ? null : _ref$variables,
1273
1293
  children = _ref.children;
1274
1294
  var contextTracking = useTracking() || null;
1275
- var tracking$1 = React$1.useMemo(function () {
1295
+ var tracking$1 = React.useMemo(function () {
1276
1296
  if (contextTracking !== null) {
1277
1297
  contextTracking.setVariables(variables);
1278
1298
  return contextTracking;
@@ -1281,9 +1301,10 @@ function TrackingProvider(_ref) {
1281
1301
  variables: variables
1282
1302
  });
1283
1303
  }, [contextTracking, variables]);
1284
- return /*#__PURE__*/React.createElement(tracking.TrackingContainer, {
1285
- tracking: tracking$1
1286
- }, children);
1304
+ return /*#__PURE__*/jsxRuntime.jsx(tracking.TrackingContainer, {
1305
+ tracking: tracking$1,
1306
+ children: children
1307
+ });
1287
1308
  }
1288
1309
 
1289
1310
  Object.defineProperty(exports, "TrackingContext", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panneau/core",
3
- "version": "4.0.2",
3
+ "version": "4.0.4",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "javascript"
@@ -22,14 +22,6 @@
22
22
  {
23
23
  "name": "Nicolas Roy-Bourdages",
24
24
  "email": "nrb@folklore.email"
25
- },
26
- {
27
- "name": "Julien Carignan",
28
- "email": "jc@folklore.email"
29
- },
30
- {
31
- "name": "Théo Gjini",
32
- "email": "tg@folklore.email"
33
25
  }
34
26
  ],
35
27
  "license": "ISC",
@@ -120,5 +112,5 @@
120
112
  "publishConfig": {
121
113
  "access": "public"
122
114
  },
123
- "gitHead": "53ad0f27e467992c23158732e0f7d39d8615780b"
115
+ "gitHead": "e854451a718c6bc7dcde2b804c9913d8ac0297ff"
124
116
  }