@panneau/core 4.0.1 → 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.
- package/es/contexts.js +89 -74
- package/lib/contexts.js +89 -75
- package/package.json +2 -10
package/es/contexts.js
CHANGED
|
@@ -2,6 +2,7 @@ import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
|
2
2
|
import isString from 'lodash-es/isString';
|
|
3
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';
|
|
@@ -242,12 +243,12 @@ 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__*/
|
|
246
|
-
value: finalManager
|
|
247
|
-
|
|
246
|
+
return /*#__PURE__*/jsx(ComponentsContext, {
|
|
247
|
+
value: finalManager,
|
|
248
|
+
children: children
|
|
249
|
+
});
|
|
248
250
|
}
|
|
249
251
|
|
|
250
|
-
/* eslint-disable react/jsx-props-no-spreading */
|
|
251
252
|
var DefinitionContext = /*#__PURE__*/React.createContext(null);
|
|
252
253
|
var useDefinitionContext = function useDefinitionContext() {
|
|
253
254
|
return useContext(DefinitionContext);
|
|
@@ -259,9 +260,10 @@ var useDefinition = function useDefinition() {
|
|
|
259
260
|
function DefinitionProvider(_ref) {
|
|
260
261
|
var definition = _ref.definition,
|
|
261
262
|
children = _ref.children;
|
|
262
|
-
return /*#__PURE__*/
|
|
263
|
-
value: definition
|
|
264
|
-
|
|
263
|
+
return /*#__PURE__*/jsx(DefinitionContext, {
|
|
264
|
+
value: definition,
|
|
265
|
+
children: children
|
|
266
|
+
});
|
|
265
267
|
}
|
|
266
268
|
|
|
267
269
|
var FieldsContext = /*#__PURE__*/React.createContext(null);
|
|
@@ -297,15 +299,16 @@ function FieldsProvider(_ref) {
|
|
|
297
299
|
return isString(component) ? map : _objectSpread(_objectSpread({}, map), {}, _defineProperty({}, id, component));
|
|
298
300
|
}, {});
|
|
299
301
|
}, [finalManager]);
|
|
300
|
-
return /*#__PURE__*/
|
|
301
|
-
value: finalManager
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
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
|
+
});
|
|
306
310
|
}
|
|
307
311
|
|
|
308
|
-
/* eslint-disable react/jsx-props-no-spreading */
|
|
309
312
|
var GoogleKeysContext = /*#__PURE__*/React.createContext({
|
|
310
313
|
apiKey: null
|
|
311
314
|
});
|
|
@@ -323,9 +326,10 @@ function GoogleKeysProvider(_ref) {
|
|
|
323
326
|
apiKey: apiKey || previousApiKey
|
|
324
327
|
};
|
|
325
328
|
}, [previousApiKey, apiKey]);
|
|
326
|
-
return /*#__PURE__*/
|
|
327
|
-
value: value
|
|
328
|
-
|
|
329
|
+
return /*#__PURE__*/jsx(GoogleKeysContext, {
|
|
330
|
+
value: value,
|
|
331
|
+
children: children
|
|
332
|
+
});
|
|
329
333
|
}
|
|
330
334
|
|
|
331
335
|
var FontsContext = /*#__PURE__*/React.createContext({
|
|
@@ -431,12 +435,12 @@ function FontsProvider(_ref4) {
|
|
|
431
435
|
setGoogleFonts: setGoogleFonts
|
|
432
436
|
};
|
|
433
437
|
}, [previousSystemFonts, previousGoogleFonts, previousCustomFonts, customFonts, systemFonts, googleFonts, setGoogleFonts]);
|
|
434
|
-
return /*#__PURE__*/
|
|
435
|
-
value: fonts
|
|
436
|
-
|
|
438
|
+
return /*#__PURE__*/jsx(FontsContext, {
|
|
439
|
+
value: fonts,
|
|
440
|
+
children: children
|
|
441
|
+
});
|
|
437
442
|
}
|
|
438
443
|
|
|
439
|
-
/* eslint-disable react/jsx-props-no-spreading */
|
|
440
444
|
var FormContext = /*#__PURE__*/React.createContext(null);
|
|
441
445
|
var useForm = function useForm() {
|
|
442
446
|
return useContext(FormContext);
|
|
@@ -461,9 +465,10 @@ function FormProvider(_ref) {
|
|
|
461
465
|
setValue: setValue
|
|
462
466
|
};
|
|
463
467
|
}, [value, setValue]);
|
|
464
|
-
return /*#__PURE__*/
|
|
465
|
-
value: values
|
|
466
|
-
|
|
468
|
+
return /*#__PURE__*/jsx(FormContext, {
|
|
469
|
+
value: values,
|
|
470
|
+
children: children
|
|
471
|
+
});
|
|
467
472
|
}
|
|
468
473
|
|
|
469
474
|
var GoogleApiClientContext = /*#__PURE__*/React.createContext(null);
|
|
@@ -479,10 +484,12 @@ var withGoogleApiClient = function withGoogleApiClient(WrappedComponent) {
|
|
|
479
484
|
return displayName || name || 'Component';
|
|
480
485
|
};
|
|
481
486
|
var WithGoogleApiClientComponent = function WithGoogleApiClientComponent(props) {
|
|
482
|
-
return /*#__PURE__*/
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
487
|
+
return /*#__PURE__*/jsx(GoogleApiClientContext.Consumer, {
|
|
488
|
+
children: function children(client) {
|
|
489
|
+
return /*#__PURE__*/jsx(WrappedComponent, _objectSpread({
|
|
490
|
+
googleApiClient: client
|
|
491
|
+
}, props));
|
|
492
|
+
}
|
|
486
493
|
});
|
|
487
494
|
};
|
|
488
495
|
WithGoogleApiClientComponent.displayName = "WithGoogleApiClient(".concat(getDisplayName(WrappedComponent), ")");
|
|
@@ -507,9 +514,10 @@ function GoogleApiClientProvider(_ref2) {
|
|
|
507
514
|
return setClient(gapi);
|
|
508
515
|
});
|
|
509
516
|
}, [apiKey, setClient]);
|
|
510
|
-
return /*#__PURE__*/
|
|
511
|
-
value: client
|
|
512
|
-
|
|
517
|
+
return /*#__PURE__*/jsx(GoogleApiClientContext, {
|
|
518
|
+
value: client,
|
|
519
|
+
children: children
|
|
520
|
+
});
|
|
513
521
|
}
|
|
514
522
|
|
|
515
523
|
var GoogleMapsClientContext = /*#__PURE__*/React.createContext(null);
|
|
@@ -525,10 +533,12 @@ var withGoogleMapsClient = function withGoogleMapsClient(WrappedComponent) {
|
|
|
525
533
|
return displayName || name || 'Component';
|
|
526
534
|
};
|
|
527
535
|
var WithGoogleMapsClientComponent = function WithGoogleMapsClientComponent(props) {
|
|
528
|
-
return /*#__PURE__*/
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
536
|
+
return /*#__PURE__*/jsx(GoogleMapsClientContext.Consumer, {
|
|
537
|
+
children: function children(client) {
|
|
538
|
+
return /*#__PURE__*/jsx(WrappedComponent, _objectSpread({
|
|
539
|
+
googleApiClient: client
|
|
540
|
+
}, props));
|
|
541
|
+
}
|
|
532
542
|
});
|
|
533
543
|
};
|
|
534
544
|
WithGoogleMapsClientComponent.displayName = "WithGoogleMapsClient(".concat(getDisplayName(WrappedComponent), ")");
|
|
@@ -558,12 +568,12 @@ function GoogleMapsClientProvider(_ref2) {
|
|
|
558
568
|
});
|
|
559
569
|
}
|
|
560
570
|
}, [apiKey, locale, libraries, setClient, exisitingClient]);
|
|
561
|
-
return /*#__PURE__*/
|
|
562
|
-
value: client
|
|
563
|
-
|
|
571
|
+
return /*#__PURE__*/jsx(GoogleMapsClientContext, {
|
|
572
|
+
value: client,
|
|
573
|
+
children: children
|
|
574
|
+
});
|
|
564
575
|
}
|
|
565
576
|
|
|
566
|
-
/* eslint-disable react/jsx-props-no-spreading */
|
|
567
577
|
var defaultLocales = ['en', 'fr'];
|
|
568
578
|
var LocalesContext = /*#__PURE__*/React.createContext({
|
|
569
579
|
locales: defaultLocales
|
|
@@ -599,9 +609,10 @@ function LocalesProvider(_ref) {
|
|
|
599
609
|
locales: locales
|
|
600
610
|
};
|
|
601
611
|
}, [locales]);
|
|
602
|
-
return /*#__PURE__*/
|
|
603
|
-
value: value
|
|
604
|
-
|
|
612
|
+
return /*#__PURE__*/jsx(LocalesContext, {
|
|
613
|
+
value: value,
|
|
614
|
+
children: children
|
|
615
|
+
});
|
|
605
616
|
}
|
|
606
617
|
|
|
607
618
|
var ModalContext = /*#__PURE__*/React.createContext(null);
|
|
@@ -691,9 +702,10 @@ function ModalProvider(_ref) {
|
|
|
691
702
|
getModalById: getModalById
|
|
692
703
|
};
|
|
693
704
|
}, [modals, container, setContainer, register, unregister, closeLastModal, getModalById]);
|
|
694
|
-
return /*#__PURE__*/
|
|
695
|
-
value: value
|
|
696
|
-
|
|
705
|
+
return /*#__PURE__*/jsx(ModalContext, {
|
|
706
|
+
value: value,
|
|
707
|
+
children: children
|
|
708
|
+
});
|
|
697
709
|
}
|
|
698
710
|
|
|
699
711
|
var PanelsContext = /*#__PURE__*/React.createContext({
|
|
@@ -708,19 +720,21 @@ var usePanels = function usePanels() {
|
|
|
708
720
|
};
|
|
709
721
|
var withPanels = function withPanels(WrappedComponent) {
|
|
710
722
|
var WithPanelsComponent = function WithPanelsComponent(props) {
|
|
711
|
-
return /*#__PURE__*/
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
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
|
+
}
|
|
724
738
|
});
|
|
725
739
|
};
|
|
726
740
|
WithPanelsComponent.displayName = "WithPanels(".concat(getDisplayName(WrappedComponent), ")");
|
|
@@ -772,9 +786,10 @@ function PanelsProvider(_ref2) {
|
|
|
772
786
|
unregister: unregister
|
|
773
787
|
};
|
|
774
788
|
}, [panels, setContainer, container, register, unregister]);
|
|
775
|
-
return /*#__PURE__*/
|
|
776
|
-
value: value
|
|
777
|
-
|
|
789
|
+
return /*#__PURE__*/jsx(PanelsContext, {
|
|
790
|
+
value: value,
|
|
791
|
+
children: children
|
|
792
|
+
});
|
|
778
793
|
}
|
|
779
794
|
|
|
780
795
|
var _excluded = ["component"];
|
|
@@ -798,7 +813,7 @@ var usePanneauResource = function usePanneauResource(id) {
|
|
|
798
813
|
var usePanneauColorScheme = function usePanneauColorScheme() {
|
|
799
814
|
var _ref2 = usePanneau() || {},
|
|
800
815
|
_ref2$theme = _ref2.theme,
|
|
801
|
-
theme = _ref2$theme === void 0 ?
|
|
816
|
+
theme = _ref2$theme === void 0 ? null : _ref2$theme;
|
|
802
817
|
var _ref3 = theme || {},
|
|
803
818
|
_ref3$colorScheme = _ref3.colorScheme,
|
|
804
819
|
colorScheme = _ref3$colorScheme === void 0 ? 'light' : _ref3$colorScheme;
|
|
@@ -836,7 +851,6 @@ var usePanneauComponent = function usePanneauComponent(namespace, name) {
|
|
|
836
851
|
return component;
|
|
837
852
|
}
|
|
838
853
|
if (isObject(component) && isString(component === null || component === void 0 ? void 0 : component.componnent)) {
|
|
839
|
-
// eslint-disable-next-line no-unused-vars
|
|
840
854
|
component.component;
|
|
841
855
|
_objectWithoutProperties(component, _excluded);
|
|
842
856
|
return component.component;
|
|
@@ -858,12 +872,12 @@ var usePanneauSettings = function usePanneauSettings() {
|
|
|
858
872
|
function PanneauProvider(_ref8) {
|
|
859
873
|
var definition = _ref8.definition,
|
|
860
874
|
children = _ref8.children;
|
|
861
|
-
return /*#__PURE__*/
|
|
862
|
-
value: definition
|
|
863
|
-
|
|
875
|
+
return /*#__PURE__*/jsx(PanneauContext, {
|
|
876
|
+
value: definition,
|
|
877
|
+
children: children
|
|
878
|
+
});
|
|
864
879
|
}
|
|
865
880
|
|
|
866
|
-
/* eslint-disable react/jsx-props-no-spreading */
|
|
867
881
|
var ResourceContext = /*#__PURE__*/React.createContext(null);
|
|
868
882
|
var useResource = function useResource() {
|
|
869
883
|
return useContext(ResourceContext);
|
|
@@ -871,9 +885,10 @@ var useResource = function useResource() {
|
|
|
871
885
|
function ResourceProvider(_ref) {
|
|
872
886
|
var resource = _ref.resource,
|
|
873
887
|
children = _ref.children;
|
|
874
|
-
return /*#__PURE__*/
|
|
875
|
-
value: resource
|
|
876
|
-
|
|
888
|
+
return /*#__PURE__*/jsx(ResourceContext, {
|
|
889
|
+
value: resource,
|
|
890
|
+
children: children
|
|
891
|
+
});
|
|
877
892
|
}
|
|
878
893
|
|
|
879
894
|
var useRoutePush = function useRoutePush() {
|
|
@@ -909,7 +924,6 @@ var useRouteBack = function useRouteBack() {
|
|
|
909
924
|
return back;
|
|
910
925
|
};
|
|
911
926
|
|
|
912
|
-
/* eslint-disable react/jsx-props-no-spreading */
|
|
913
927
|
var useTracking = function useTracking() {
|
|
914
928
|
return useContext(TrackingContext);
|
|
915
929
|
};
|
|
@@ -927,9 +941,10 @@ function TrackingProvider(_ref) {
|
|
|
927
941
|
variables: variables
|
|
928
942
|
});
|
|
929
943
|
}, [contextTracking, variables]);
|
|
930
|
-
return /*#__PURE__*/
|
|
931
|
-
tracking: tracking
|
|
932
|
-
|
|
944
|
+
return /*#__PURE__*/jsx(TrackingContainer, {
|
|
945
|
+
tracking: tracking,
|
|
946
|
+
children: children
|
|
947
|
+
});
|
|
933
948
|
}
|
|
934
949
|
|
|
935
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
|
@@ -4,6 +4,7 @@ var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
|
|
|
4
4
|
var isString = require('lodash-es/isString');
|
|
5
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');
|
|
@@ -264,12 +264,12 @@ function ComponentsProvider(_ref) {
|
|
|
264
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__*/
|
|
268
|
-
value: finalManager
|
|
269
|
-
|
|
267
|
+
return /*#__PURE__*/jsxRuntime.jsx(ComponentsContext, {
|
|
268
|
+
value: finalManager,
|
|
269
|
+
children: children
|
|
270
|
+
});
|
|
270
271
|
}
|
|
271
272
|
|
|
272
|
-
/* eslint-disable react/jsx-props-no-spreading */
|
|
273
273
|
var DefinitionContext = /*#__PURE__*/React.createContext(null);
|
|
274
274
|
var useDefinitionContext = function useDefinitionContext() {
|
|
275
275
|
return React.useContext(DefinitionContext);
|
|
@@ -281,9 +281,10 @@ var useDefinition = function useDefinition() {
|
|
|
281
281
|
function DefinitionProvider(_ref) {
|
|
282
282
|
var definition = _ref.definition,
|
|
283
283
|
children = _ref.children;
|
|
284
|
-
return /*#__PURE__*/
|
|
285
|
-
value: definition
|
|
286
|
-
|
|
284
|
+
return /*#__PURE__*/jsxRuntime.jsx(DefinitionContext, {
|
|
285
|
+
value: definition,
|
|
286
|
+
children: children
|
|
287
|
+
});
|
|
287
288
|
}
|
|
288
289
|
|
|
289
290
|
var FieldsContext = /*#__PURE__*/React.createContext(null);
|
|
@@ -319,15 +320,16 @@ function FieldsProvider(_ref) {
|
|
|
319
320
|
return isString(component) ? map : _objectSpread(_objectSpread({}, map), {}, _defineProperty({}, id, component));
|
|
320
321
|
}, {});
|
|
321
322
|
}, [finalManager]);
|
|
322
|
-
return /*#__PURE__*/
|
|
323
|
-
value: finalManager
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
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
|
+
});
|
|
328
331
|
}
|
|
329
332
|
|
|
330
|
-
/* eslint-disable react/jsx-props-no-spreading */
|
|
331
333
|
var GoogleKeysContext = /*#__PURE__*/React.createContext({
|
|
332
334
|
apiKey: null
|
|
333
335
|
});
|
|
@@ -345,9 +347,10 @@ function GoogleKeysProvider(_ref) {
|
|
|
345
347
|
apiKey: apiKey || previousApiKey
|
|
346
348
|
};
|
|
347
349
|
}, [previousApiKey, apiKey]);
|
|
348
|
-
return /*#__PURE__*/
|
|
349
|
-
value: value
|
|
350
|
-
|
|
350
|
+
return /*#__PURE__*/jsxRuntime.jsx(GoogleKeysContext, {
|
|
351
|
+
value: value,
|
|
352
|
+
children: children
|
|
353
|
+
});
|
|
351
354
|
}
|
|
352
355
|
|
|
353
356
|
var FontsContext = /*#__PURE__*/React.createContext({
|
|
@@ -453,12 +456,12 @@ function FontsProvider(_ref4) {
|
|
|
453
456
|
setGoogleFonts: setGoogleFonts
|
|
454
457
|
};
|
|
455
458
|
}, [previousSystemFonts, previousGoogleFonts, previousCustomFonts, customFonts, systemFonts, googleFonts, setGoogleFonts]);
|
|
456
|
-
return /*#__PURE__*/
|
|
457
|
-
value: fonts
|
|
458
|
-
|
|
459
|
+
return /*#__PURE__*/jsxRuntime.jsx(FontsContext, {
|
|
460
|
+
value: fonts,
|
|
461
|
+
children: children
|
|
462
|
+
});
|
|
459
463
|
}
|
|
460
464
|
|
|
461
|
-
/* eslint-disable react/jsx-props-no-spreading */
|
|
462
465
|
var FormContext = /*#__PURE__*/React.createContext(null);
|
|
463
466
|
var useForm = function useForm() {
|
|
464
467
|
return React.useContext(FormContext);
|
|
@@ -483,9 +486,10 @@ function FormProvider(_ref) {
|
|
|
483
486
|
setValue: setValue
|
|
484
487
|
};
|
|
485
488
|
}, [value, setValue]);
|
|
486
|
-
return /*#__PURE__*/
|
|
487
|
-
value: values
|
|
488
|
-
|
|
489
|
+
return /*#__PURE__*/jsxRuntime.jsx(FormContext, {
|
|
490
|
+
value: values,
|
|
491
|
+
children: children
|
|
492
|
+
});
|
|
489
493
|
}
|
|
490
494
|
|
|
491
495
|
var GoogleApiClientContext = /*#__PURE__*/React.createContext(null);
|
|
@@ -501,10 +505,12 @@ var withGoogleApiClient = function withGoogleApiClient(WrappedComponent) {
|
|
|
501
505
|
return displayName || name || 'Component';
|
|
502
506
|
};
|
|
503
507
|
var WithGoogleApiClientComponent = function WithGoogleApiClientComponent(props) {
|
|
504
|
-
return /*#__PURE__*/
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
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
|
+
}
|
|
508
514
|
});
|
|
509
515
|
};
|
|
510
516
|
WithGoogleApiClientComponent.displayName = "WithGoogleApiClient(".concat(getDisplayName(WrappedComponent), ")");
|
|
@@ -529,9 +535,10 @@ function GoogleApiClientProvider(_ref2) {
|
|
|
529
535
|
return setClient(gapi);
|
|
530
536
|
});
|
|
531
537
|
}, [apiKey, setClient]);
|
|
532
|
-
return /*#__PURE__*/
|
|
533
|
-
value: client
|
|
534
|
-
|
|
538
|
+
return /*#__PURE__*/jsxRuntime.jsx(GoogleApiClientContext, {
|
|
539
|
+
value: client,
|
|
540
|
+
children: children
|
|
541
|
+
});
|
|
535
542
|
}
|
|
536
543
|
|
|
537
544
|
var GoogleMapsClientContext = /*#__PURE__*/React.createContext(null);
|
|
@@ -547,10 +554,12 @@ var withGoogleMapsClient = function withGoogleMapsClient(WrappedComponent) {
|
|
|
547
554
|
return displayName || name || 'Component';
|
|
548
555
|
};
|
|
549
556
|
var WithGoogleMapsClientComponent = function WithGoogleMapsClientComponent(props) {
|
|
550
|
-
return /*#__PURE__*/
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
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
|
+
}
|
|
554
563
|
});
|
|
555
564
|
};
|
|
556
565
|
WithGoogleMapsClientComponent.displayName = "WithGoogleMapsClient(".concat(getDisplayName(WrappedComponent), ")");
|
|
@@ -580,12 +589,12 @@ function GoogleMapsClientProvider(_ref2) {
|
|
|
580
589
|
});
|
|
581
590
|
}
|
|
582
591
|
}, [apiKey, locale, libraries, setClient, exisitingClient]);
|
|
583
|
-
return /*#__PURE__*/
|
|
584
|
-
value: client
|
|
585
|
-
|
|
592
|
+
return /*#__PURE__*/jsxRuntime.jsx(GoogleMapsClientContext, {
|
|
593
|
+
value: client,
|
|
594
|
+
children: children
|
|
595
|
+
});
|
|
586
596
|
}
|
|
587
597
|
|
|
588
|
-
/* eslint-disable react/jsx-props-no-spreading */
|
|
589
598
|
var defaultLocales = ['en', 'fr'];
|
|
590
599
|
var LocalesContext = /*#__PURE__*/React.createContext({
|
|
591
600
|
locales: defaultLocales
|
|
@@ -621,9 +630,10 @@ function LocalesProvider(_ref) {
|
|
|
621
630
|
locales: locales
|
|
622
631
|
};
|
|
623
632
|
}, [locales]);
|
|
624
|
-
return /*#__PURE__*/
|
|
625
|
-
value: value
|
|
626
|
-
|
|
633
|
+
return /*#__PURE__*/jsxRuntime.jsx(LocalesContext, {
|
|
634
|
+
value: value,
|
|
635
|
+
children: children
|
|
636
|
+
});
|
|
627
637
|
}
|
|
628
638
|
|
|
629
639
|
var ModalContext = /*#__PURE__*/React.createContext(null);
|
|
@@ -713,9 +723,10 @@ function ModalProvider(_ref) {
|
|
|
713
723
|
getModalById: getModalById
|
|
714
724
|
};
|
|
715
725
|
}, [modals, container, setContainer, register, unregister, closeLastModal, getModalById]);
|
|
716
|
-
return /*#__PURE__*/
|
|
717
|
-
value: value
|
|
718
|
-
|
|
726
|
+
return /*#__PURE__*/jsxRuntime.jsx(ModalContext, {
|
|
727
|
+
value: value,
|
|
728
|
+
children: children
|
|
729
|
+
});
|
|
719
730
|
}
|
|
720
731
|
|
|
721
732
|
var PanelsContext = /*#__PURE__*/React.createContext({
|
|
@@ -730,19 +741,21 @@ var usePanels = function usePanels() {
|
|
|
730
741
|
};
|
|
731
742
|
var withPanels = function withPanels(WrappedComponent) {
|
|
732
743
|
var WithPanelsComponent = function WithPanelsComponent(props) {
|
|
733
|
-
return /*#__PURE__*/
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
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
|
+
}
|
|
746
759
|
});
|
|
747
760
|
};
|
|
748
761
|
WithPanelsComponent.displayName = "WithPanels(".concat(utils.getDisplayName(WrappedComponent), ")");
|
|
@@ -794,9 +807,10 @@ function PanelsProvider(_ref2) {
|
|
|
794
807
|
unregister: unregister
|
|
795
808
|
};
|
|
796
809
|
}, [panels, setContainer, container, register, unregister]);
|
|
797
|
-
return /*#__PURE__*/
|
|
798
|
-
value: value
|
|
799
|
-
|
|
810
|
+
return /*#__PURE__*/jsxRuntime.jsx(PanelsContext, {
|
|
811
|
+
value: value,
|
|
812
|
+
children: children
|
|
813
|
+
});
|
|
800
814
|
}
|
|
801
815
|
|
|
802
816
|
var _excluded = ["component"];
|
|
@@ -820,7 +834,7 @@ var usePanneauResource = function usePanneauResource(id) {
|
|
|
820
834
|
var usePanneauColorScheme = function usePanneauColorScheme() {
|
|
821
835
|
var _ref2 = usePanneau() || {},
|
|
822
836
|
_ref2$theme = _ref2.theme,
|
|
823
|
-
theme = _ref2$theme === void 0 ?
|
|
837
|
+
theme = _ref2$theme === void 0 ? null : _ref2$theme;
|
|
824
838
|
var _ref3 = theme || {},
|
|
825
839
|
_ref3$colorScheme = _ref3.colorScheme,
|
|
826
840
|
colorScheme = _ref3$colorScheme === void 0 ? 'light' : _ref3$colorScheme;
|
|
@@ -858,7 +872,6 @@ var usePanneauComponent = function usePanneauComponent(namespace, name) {
|
|
|
858
872
|
return component;
|
|
859
873
|
}
|
|
860
874
|
if (isObject(component) && isString(component === null || component === void 0 ? void 0 : component.componnent)) {
|
|
861
|
-
// eslint-disable-next-line no-unused-vars
|
|
862
875
|
component.component;
|
|
863
876
|
_objectWithoutProperties(component, _excluded);
|
|
864
877
|
return component.component;
|
|
@@ -880,12 +893,12 @@ var usePanneauSettings = function usePanneauSettings() {
|
|
|
880
893
|
function PanneauProvider(_ref8) {
|
|
881
894
|
var definition = _ref8.definition,
|
|
882
895
|
children = _ref8.children;
|
|
883
|
-
return /*#__PURE__*/
|
|
884
|
-
value: definition
|
|
885
|
-
|
|
896
|
+
return /*#__PURE__*/jsxRuntime.jsx(PanneauContext, {
|
|
897
|
+
value: definition,
|
|
898
|
+
children: children
|
|
899
|
+
});
|
|
886
900
|
}
|
|
887
901
|
|
|
888
|
-
/* eslint-disable react/jsx-props-no-spreading */
|
|
889
902
|
var ResourceContext = /*#__PURE__*/React.createContext(null);
|
|
890
903
|
var useResource = function useResource() {
|
|
891
904
|
return React.useContext(ResourceContext);
|
|
@@ -893,9 +906,10 @@ var useResource = function useResource() {
|
|
|
893
906
|
function ResourceProvider(_ref) {
|
|
894
907
|
var resource = _ref.resource,
|
|
895
908
|
children = _ref.children;
|
|
896
|
-
return /*#__PURE__*/
|
|
897
|
-
value: resource
|
|
898
|
-
|
|
909
|
+
return /*#__PURE__*/jsxRuntime.jsx(ResourceContext, {
|
|
910
|
+
value: resource,
|
|
911
|
+
children: children
|
|
912
|
+
});
|
|
899
913
|
}
|
|
900
914
|
|
|
901
915
|
// React.useInsertionEffect is not available in React <18
|
|
@@ -1270,7 +1284,6 @@ var useRouteBack = function useRouteBack() {
|
|
|
1270
1284
|
return back;
|
|
1271
1285
|
};
|
|
1272
1286
|
|
|
1273
|
-
/* eslint-disable react/jsx-props-no-spreading */
|
|
1274
1287
|
var useTracking = function useTracking() {
|
|
1275
1288
|
return React.useContext(tracking.TrackingContext);
|
|
1276
1289
|
};
|
|
@@ -1288,9 +1301,10 @@ function TrackingProvider(_ref) {
|
|
|
1288
1301
|
variables: variables
|
|
1289
1302
|
});
|
|
1290
1303
|
}, [contextTracking, variables]);
|
|
1291
|
-
return /*#__PURE__*/
|
|
1292
|
-
tracking: tracking$1
|
|
1293
|
-
|
|
1304
|
+
return /*#__PURE__*/jsxRuntime.jsx(tracking.TrackingContainer, {
|
|
1305
|
+
tracking: tracking$1,
|
|
1306
|
+
children: children
|
|
1307
|
+
});
|
|
1294
1308
|
}
|
|
1295
1309
|
|
|
1296
1310
|
Object.defineProperty(exports, "TrackingContext", {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@panneau/core",
|
|
3
|
-
"version": "4.0.
|
|
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": "
|
|
115
|
+
"gitHead": "e854451a718c6bc7dcde2b804c9913d8ac0297ff"
|
|
124
116
|
}
|