@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/cjs/index.js +124 -35
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +125 -36
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
- package/src/DesignSystemProvider.tsx +2 -9
package/dist/cjs/index.js
CHANGED
|
@@ -2356,41 +2356,6 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
2356
2356
|
ThemeContext$2.displayName = 'EmotionThemeContext';
|
|
2357
2357
|
}
|
|
2358
2358
|
|
|
2359
|
-
var getTheme = function getTheme(outerTheme, theme) {
|
|
2360
|
-
if (typeof theme === 'function') {
|
|
2361
|
-
var mergedTheme = theme(outerTheme);
|
|
2362
|
-
|
|
2363
|
-
if (process.env.NODE_ENV !== 'production' && (mergedTheme == null || typeof mergedTheme !== 'object' || Array.isArray(mergedTheme))) {
|
|
2364
|
-
throw new Error('[ThemeProvider] Please return an object from your theme function, i.e. theme={() => ({})}!');
|
|
2365
|
-
}
|
|
2366
|
-
|
|
2367
|
-
return mergedTheme;
|
|
2368
|
-
}
|
|
2369
|
-
|
|
2370
|
-
if (process.env.NODE_ENV !== 'production' && (theme == null || typeof theme !== 'object' || Array.isArray(theme))) {
|
|
2371
|
-
throw new Error('[ThemeProvider] Please make your theme prop a plain object');
|
|
2372
|
-
}
|
|
2373
|
-
|
|
2374
|
-
return _extends({}, outerTheme, theme);
|
|
2375
|
-
};
|
|
2376
|
-
|
|
2377
|
-
var createCacheWithTheme = /* #__PURE__ */weakMemoize(function (outerTheme) {
|
|
2378
|
-
return weakMemoize(function (theme) {
|
|
2379
|
-
return getTheme(outerTheme, theme);
|
|
2380
|
-
});
|
|
2381
|
-
});
|
|
2382
|
-
var ThemeProvider = function ThemeProvider(props) {
|
|
2383
|
-
var theme = React.useContext(ThemeContext$2);
|
|
2384
|
-
|
|
2385
|
-
if (props.theme !== theme) {
|
|
2386
|
-
theme = createCacheWithTheme(theme)(props.theme);
|
|
2387
|
-
}
|
|
2388
|
-
|
|
2389
|
-
return /*#__PURE__*/React.createElement(ThemeContext$2.Provider, {
|
|
2390
|
-
value: theme
|
|
2391
|
-
}, props.children);
|
|
2392
|
-
};
|
|
2393
|
-
|
|
2394
2359
|
var typePropName = '__EMOTION_TYPE_PLEASE_DO_NOT_USE__';
|
|
2395
2360
|
var labelPropName = '__EMOTION_LABEL_PLEASE_DO_NOT_USE__';
|
|
2396
2361
|
|
|
@@ -6136,6 +6101,75 @@ function useTheme$3() {
|
|
|
6136
6101
|
return theme;
|
|
6137
6102
|
}
|
|
6138
6103
|
|
|
6104
|
+
const hasSymbol = typeof Symbol === 'function' && Symbol.for;
|
|
6105
|
+
var nested = hasSymbol ? Symbol.for('mui.nested') : '__THEME_NESTED__';
|
|
6106
|
+
|
|
6107
|
+
function mergeOuterLocalTheme(outerTheme, localTheme) {
|
|
6108
|
+
if (typeof localTheme === 'function') {
|
|
6109
|
+
const mergedTheme = localTheme(outerTheme);
|
|
6110
|
+
|
|
6111
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6112
|
+
if (!mergedTheme) {
|
|
6113
|
+
console.error(['MUI: You should return an object from your theme function, i.e.', '<ThemeProvider theme={() => ({})} />'].join('\n'));
|
|
6114
|
+
}
|
|
6115
|
+
}
|
|
6116
|
+
|
|
6117
|
+
return mergedTheme;
|
|
6118
|
+
}
|
|
6119
|
+
|
|
6120
|
+
return _extends({}, outerTheme, localTheme);
|
|
6121
|
+
}
|
|
6122
|
+
/**
|
|
6123
|
+
* This component takes a `theme` prop.
|
|
6124
|
+
* It makes the `theme` available down the React tree thanks to React context.
|
|
6125
|
+
* This component should preferably be used at **the root of your component tree**.
|
|
6126
|
+
*/
|
|
6127
|
+
|
|
6128
|
+
|
|
6129
|
+
function ThemeProvider$1(props) {
|
|
6130
|
+
const {
|
|
6131
|
+
children,
|
|
6132
|
+
theme: localTheme
|
|
6133
|
+
} = props;
|
|
6134
|
+
const outerTheme = useTheme$3();
|
|
6135
|
+
|
|
6136
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6137
|
+
if (outerTheme === null && typeof localTheme === 'function') {
|
|
6138
|
+
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'));
|
|
6139
|
+
}
|
|
6140
|
+
}
|
|
6141
|
+
|
|
6142
|
+
const theme = React__namespace.useMemo(() => {
|
|
6143
|
+
const output = outerTheme === null ? localTheme : mergeOuterLocalTheme(outerTheme, localTheme);
|
|
6144
|
+
|
|
6145
|
+
if (output != null) {
|
|
6146
|
+
output[nested] = outerTheme !== null;
|
|
6147
|
+
}
|
|
6148
|
+
|
|
6149
|
+
return output;
|
|
6150
|
+
}, [localTheme, outerTheme]);
|
|
6151
|
+
return /*#__PURE__*/jsxRuntime.jsx(ThemeContext$1.Provider, {
|
|
6152
|
+
value: theme,
|
|
6153
|
+
children: children
|
|
6154
|
+
});
|
|
6155
|
+
}
|
|
6156
|
+
|
|
6157
|
+
process.env.NODE_ENV !== "production" ? ThemeProvider$1.propTypes = {
|
|
6158
|
+
/**
|
|
6159
|
+
* Your component tree.
|
|
6160
|
+
*/
|
|
6161
|
+
children: PropTypes.node,
|
|
6162
|
+
|
|
6163
|
+
/**
|
|
6164
|
+
* A theme object. You can provide a function to extend the outer theme.
|
|
6165
|
+
*/
|
|
6166
|
+
theme: PropTypes.oneOfType([PropTypes.object, PropTypes.func]).isRequired
|
|
6167
|
+
} : void 0;
|
|
6168
|
+
|
|
6169
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6170
|
+
process.env.NODE_ENV !== "production" ? ThemeProvider$1.propTypes = exactProp(ThemeProvider$1.propTypes) : void 0;
|
|
6171
|
+
}
|
|
6172
|
+
|
|
6139
6173
|
function isObjectEmpty(obj) {
|
|
6140
6174
|
return Object.keys(obj).length === 0;
|
|
6141
6175
|
}
|
|
@@ -6758,6 +6792,61 @@ function lighten(color, coefficient) {
|
|
|
6758
6792
|
return recomposeColor(color);
|
|
6759
6793
|
}
|
|
6760
6794
|
|
|
6795
|
+
function InnerThemeProvider(props) {
|
|
6796
|
+
const theme = useTheme$1();
|
|
6797
|
+
return /*#__PURE__*/jsxRuntime.jsx(ThemeContext$2.Provider, {
|
|
6798
|
+
value: typeof theme === 'object' ? theme : {},
|
|
6799
|
+
children: props.children
|
|
6800
|
+
});
|
|
6801
|
+
}
|
|
6802
|
+
|
|
6803
|
+
process.env.NODE_ENV !== "production" ? InnerThemeProvider.propTypes = {
|
|
6804
|
+
/**
|
|
6805
|
+
* Your component tree.
|
|
6806
|
+
*/
|
|
6807
|
+
children: PropTypes.node
|
|
6808
|
+
} : void 0;
|
|
6809
|
+
/**
|
|
6810
|
+
* This component makes the `theme` available down the React tree.
|
|
6811
|
+
* It should preferably be used at **the root of your component tree**.
|
|
6812
|
+
*/
|
|
6813
|
+
|
|
6814
|
+
function ThemeProvider(props) {
|
|
6815
|
+
const {
|
|
6816
|
+
children,
|
|
6817
|
+
theme: localTheme
|
|
6818
|
+
} = props;
|
|
6819
|
+
return /*#__PURE__*/jsxRuntime.jsx(ThemeProvider$1, {
|
|
6820
|
+
theme: localTheme,
|
|
6821
|
+
children: /*#__PURE__*/jsxRuntime.jsx(InnerThemeProvider, {
|
|
6822
|
+
children: children
|
|
6823
|
+
})
|
|
6824
|
+
});
|
|
6825
|
+
}
|
|
6826
|
+
|
|
6827
|
+
process.env.NODE_ENV !== "production" ? ThemeProvider.propTypes
|
|
6828
|
+
/* remove-proptypes */
|
|
6829
|
+
= {
|
|
6830
|
+
// ----------------------------- Warning --------------------------------
|
|
6831
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
6832
|
+
// | To update them edit the d.ts file and run "yarn proptypes" |
|
|
6833
|
+
// ----------------------------------------------------------------------
|
|
6834
|
+
|
|
6835
|
+
/**
|
|
6836
|
+
* Your component tree.
|
|
6837
|
+
*/
|
|
6838
|
+
children: PropTypes.node,
|
|
6839
|
+
|
|
6840
|
+
/**
|
|
6841
|
+
* A theme object. You can provide a function to extend the outer theme.
|
|
6842
|
+
*/
|
|
6843
|
+
theme: PropTypes.oneOfType([PropTypes.func, PropTypes.object]).isRequired
|
|
6844
|
+
} : void 0;
|
|
6845
|
+
|
|
6846
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6847
|
+
process.env.NODE_ENV !== "production" ? ThemeProvider.propTypes = exactProp(ThemeProvider.propTypes) : void 0;
|
|
6848
|
+
}
|
|
6849
|
+
|
|
6761
6850
|
/**
|
|
6762
6851
|
* Determines if a given element is a DOM element name (i.e. not a React component).
|
|
6763
6852
|
*/
|