@groupeactual/ui-kit 0.3.5 → 0.3.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsx, jsxs } from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
- import React__default, { useLayoutEffect, useContext, createElement, createContext, forwardRef, Fragment, useRef, Children, isValidElement, cloneElement, useState, useEffect, useMemo } from 'react';
3
+ import React__default, { useLayoutEffect, forwardRef, useContext, createElement, createContext, Fragment, useRef, Children, isValidElement, cloneElement, useState, useEffect, useMemo } from 'react';
4
4
 
5
5
  /******************************************************************************
6
6
  Copyright (c) Microsoft Corporation.
@@ -2330,41 +2330,6 @@ if (process.env.NODE_ENV !== 'production') {
2330
2330
  ThemeContext$2.displayName = 'EmotionThemeContext';
2331
2331
  }
2332
2332
 
2333
- var getTheme = function getTheme(outerTheme, theme) {
2334
- if (typeof theme === 'function') {
2335
- var mergedTheme = theme(outerTheme);
2336
-
2337
- if (process.env.NODE_ENV !== 'production' && (mergedTheme == null || typeof mergedTheme !== 'object' || Array.isArray(mergedTheme))) {
2338
- throw new Error('[ThemeProvider] Please return an object from your theme function, i.e. theme={() => ({})}!');
2339
- }
2340
-
2341
- return mergedTheme;
2342
- }
2343
-
2344
- if (process.env.NODE_ENV !== 'production' && (theme == null || typeof theme !== 'object' || Array.isArray(theme))) {
2345
- throw new Error('[ThemeProvider] Please make your theme prop a plain object');
2346
- }
2347
-
2348
- return _extends({}, outerTheme, theme);
2349
- };
2350
-
2351
- var createCacheWithTheme = /* #__PURE__ */weakMemoize(function (outerTheme) {
2352
- return weakMemoize(function (theme) {
2353
- return getTheme(outerTheme, theme);
2354
- });
2355
- });
2356
- var ThemeProvider = function ThemeProvider(props) {
2357
- var theme = useContext(ThemeContext$2);
2358
-
2359
- if (props.theme !== theme) {
2360
- theme = createCacheWithTheme(theme)(props.theme);
2361
- }
2362
-
2363
- return /*#__PURE__*/createElement(ThemeContext$2.Provider, {
2364
- value: theme
2365
- }, props.children);
2366
- };
2367
-
2368
2333
  var typePropName = '__EMOTION_TYPE_PLEASE_DO_NOT_USE__';
2369
2334
  var labelPropName = '__EMOTION_LABEL_PLEASE_DO_NOT_USE__';
2370
2335
 
@@ -6110,6 +6075,75 @@ function useTheme$3() {
6110
6075
  return theme;
6111
6076
  }
6112
6077
 
6078
+ const hasSymbol = typeof Symbol === 'function' && Symbol.for;
6079
+ var nested = hasSymbol ? Symbol.for('mui.nested') : '__THEME_NESTED__';
6080
+
6081
+ function mergeOuterLocalTheme(outerTheme, localTheme) {
6082
+ if (typeof localTheme === 'function') {
6083
+ const mergedTheme = localTheme(outerTheme);
6084
+
6085
+ if (process.env.NODE_ENV !== 'production') {
6086
+ if (!mergedTheme) {
6087
+ console.error(['MUI: You should return an object from your theme function, i.e.', '<ThemeProvider theme={() => ({})} />'].join('\n'));
6088
+ }
6089
+ }
6090
+
6091
+ return mergedTheme;
6092
+ }
6093
+
6094
+ return _extends({}, outerTheme, localTheme);
6095
+ }
6096
+ /**
6097
+ * This component takes a `theme` prop.
6098
+ * It makes the `theme` available down the React tree thanks to React context.
6099
+ * This component should preferably be used at **the root of your component tree**.
6100
+ */
6101
+
6102
+
6103
+ function ThemeProvider$1(props) {
6104
+ const {
6105
+ children,
6106
+ theme: localTheme
6107
+ } = props;
6108
+ const outerTheme = useTheme$3();
6109
+
6110
+ if (process.env.NODE_ENV !== 'production') {
6111
+ if (outerTheme === null && typeof localTheme === 'function') {
6112
+ console.error(['MUI: You are providing a theme function prop to the ThemeProvider component:', '<ThemeProvider theme={outerTheme => outerTheme} />', '', 'However, no outer theme is present.', 'Make sure a theme is already injected higher in the React tree ' + 'or provide a theme object.'].join('\n'));
6113
+ }
6114
+ }
6115
+
6116
+ const theme = React.useMemo(() => {
6117
+ const output = outerTheme === null ? localTheme : mergeOuterLocalTheme(outerTheme, localTheme);
6118
+
6119
+ if (output != null) {
6120
+ output[nested] = outerTheme !== null;
6121
+ }
6122
+
6123
+ return output;
6124
+ }, [localTheme, outerTheme]);
6125
+ return /*#__PURE__*/jsx(ThemeContext$1.Provider, {
6126
+ value: theme,
6127
+ children: children
6128
+ });
6129
+ }
6130
+
6131
+ process.env.NODE_ENV !== "production" ? ThemeProvider$1.propTypes = {
6132
+ /**
6133
+ * Your component tree.
6134
+ */
6135
+ children: PropTypes.node,
6136
+
6137
+ /**
6138
+ * A theme object. You can provide a function to extend the outer theme.
6139
+ */
6140
+ theme: PropTypes.oneOfType([PropTypes.object, PropTypes.func]).isRequired
6141
+ } : void 0;
6142
+
6143
+ if (process.env.NODE_ENV !== 'production') {
6144
+ process.env.NODE_ENV !== "production" ? ThemeProvider$1.propTypes = exactProp(ThemeProvider$1.propTypes) : void 0;
6145
+ }
6146
+
6113
6147
  function isObjectEmpty(obj) {
6114
6148
  return Object.keys(obj).length === 0;
6115
6149
  }
@@ -6732,6 +6766,61 @@ function lighten(color, coefficient) {
6732
6766
  return recomposeColor(color);
6733
6767
  }
6734
6768
 
6769
+ function InnerThemeProvider(props) {
6770
+ const theme = useTheme$1();
6771
+ return /*#__PURE__*/jsx(ThemeContext$2.Provider, {
6772
+ value: typeof theme === 'object' ? theme : {},
6773
+ children: props.children
6774
+ });
6775
+ }
6776
+
6777
+ process.env.NODE_ENV !== "production" ? InnerThemeProvider.propTypes = {
6778
+ /**
6779
+ * Your component tree.
6780
+ */
6781
+ children: PropTypes.node
6782
+ } : void 0;
6783
+ /**
6784
+ * This component makes the `theme` available down the React tree.
6785
+ * It should preferably be used at **the root of your component tree**.
6786
+ */
6787
+
6788
+ function ThemeProvider(props) {
6789
+ const {
6790
+ children,
6791
+ theme: localTheme
6792
+ } = props;
6793
+ return /*#__PURE__*/jsx(ThemeProvider$1, {
6794
+ theme: localTheme,
6795
+ children: /*#__PURE__*/jsx(InnerThemeProvider, {
6796
+ children: children
6797
+ })
6798
+ });
6799
+ }
6800
+
6801
+ process.env.NODE_ENV !== "production" ? ThemeProvider.propTypes
6802
+ /* remove-proptypes */
6803
+ = {
6804
+ // ----------------------------- Warning --------------------------------
6805
+ // | These PropTypes are generated from the TypeScript type definitions |
6806
+ // | To update them edit the d.ts file and run "yarn proptypes" |
6807
+ // ----------------------------------------------------------------------
6808
+
6809
+ /**
6810
+ * Your component tree.
6811
+ */
6812
+ children: PropTypes.node,
6813
+
6814
+ /**
6815
+ * A theme object. You can provide a function to extend the outer theme.
6816
+ */
6817
+ theme: PropTypes.oneOfType([PropTypes.func, PropTypes.object]).isRequired
6818
+ } : void 0;
6819
+
6820
+ if (process.env.NODE_ENV !== 'production') {
6821
+ process.env.NODE_ENV !== "production" ? ThemeProvider.propTypes = exactProp(ThemeProvider.propTypes) : void 0;
6822
+ }
6823
+
6735
6824
  /**
6736
6825
  * Determines if a given element is a DOM element name (i.e. not a React component).
6737
6826
  */