@superdispatch/ui 0.32.0 → 0.33.0

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.
@@ -19,7 +19,6 @@ var clsx = _interopDefault(require('clsx'));
19
19
  var flattenChildren = _interopDefault(require('react-keyed-flatten-children'));
20
20
  var reactNumberFormat = require('react-number-format');
21
21
  var createBreakpoints = _interopDefault(require('@material-ui/core/styles/createBreakpoints'));
22
- var _taggedTemplateLiteral = _interopDefault(require('@babel/runtime/helpers/taggedTemplateLiteral'));
23
22
 
24
23
  var _excluded = ["size", "children", "disabled", "isActive", "isLoading", "color"];
25
24
  var Button = /*#__PURE__*/React.forwardRef((_ref, ref) => {
@@ -4089,14 +4088,20 @@ function overrideTypography(theme) {
4089
4088
  };
4090
4089
  }
4091
4090
 
4092
- var _templateObject;
4093
- var GlobalStyles = /*#__PURE__*/styled.createGlobalStyle(_templateObject || (_templateObject = /*#__PURE__*/_taggedTemplateLiteral( /*#__PURE__*/JSON.parse('["\\n :root {\\n --sd-white: ",";\\n --sd-white-50: ",";\\n --sd-white-40: ",";\\n --sd-white-20: ",";\\n --sd-white-10: ",";\\n --sd-white-08: ",";\\n --sd-transparent: ",";\\n\\n --sd-black: ",";\\n --sd-black-50: ",";\\n --sd-black-20: ",";\\n\\n --sd-dark-30: ",";\\n --sd-blue-30: ",";\\n --sd-green-30: ",";\\n --sd-red-30: ",";\\n --sd-silver-30: ",";\\n\\n --sd-blue-10: ",";\\n --sd-red-10: ",";\\n\\n /* Legacy Neutral Colors */\\n --sd-grey-100: ","; /* @deprecated Use Dark100 */\\n --sd-grey-200: ","; /* @deprecated Use Dark200 */\\n --sd-grey-300: ","; /* @deprecated Use Dark300 */\\n --sd-grey-400: ","; /* @deprecated Use Dark400 */\\n --sd-grey-450: ","; /* @deprecated Use Dark450 */\\n --sd-grey-500: ","; /* @deprecated Use Dark500 */\\n\\n --sd-dark-200: ","; /* @deprecated */\\n --sd-dark-400: ","; /* @deprecated */\\n --sd-dark-450: ","; /* @deprecated */\\n\\n --sd-silver-100: ","; /* @deprecated */\\n --sd-silver-300: ","; /* @deprecated */\\n\\n /* Legacy Extended Palette */\\n --sd-blue-75: ","; /* @deprecated */\\n --sd-blue-100: ","; /* @deprecated */\\n --sd-blue-200: ","; /* @deprecated */\\n --sd-blue-400: ","; /* @deprecated */\\n\\n --sd-green-75: ","; /* @deprecated */\\n --sd-green-100: ","; /* @deprecated */\\n --sd-green-200: ","; /* @deprecated */\\n --sd-green-400: ","; /* @deprecated */\\n\\n --sd-purple-75: ","; /* @deprecated */\\n --sd-purple-100: ","; /* @deprecated */\\n --sd-purple-200: ","; /* @deprecated */\\n --sd-purple-400: ","; /* @deprecated */\\n\\n --sd-red-75: ","; /* @deprecated */\\n --sd-red-100: ","; /* @deprecated */\\n --sd-red-200: ","; /* @deprecated */\\n --sd-red-400: ","; /* @deprecated */\\n\\n --sd-teal-75: ","; /* @deprecated */\\n --sd-teal-100: ","; /* @deprecated */\\n --sd-teal-200: ","; /* @deprecated */\\n --sd-teal-400: ","; /* @deprecated */\\n\\n --sd-yellow-75: ","; /* @deprecated */\\n --sd-yellow-100: ","; /* @deprecated */\\n --sd-yellow-200: ","; /* @deprecated */\\n --sd-yellow-400: ","; /* @deprecated */\\n --sd-dark-50: ",";\\n /* extended palette */\\n \\n --sd-blue-50: ",";\\n --sd-blue-500: ",";\\n --sd-blue-300: ",";\\n --sd-green-300: ",";\\n --sd-green-500: ",";\\n --sd-green-50: ",";\\n --sd-yellow-300: ",";\\n --sd-yellow-500: ",";\\n --sd-yellow-50: ",";\\n --sd-red-300: ",";\\n --sd-red-500: ",";\\n --sd-red-50: ",";\\n --sd-purple-300: ",";\\n --sd-purple-500: ",";\\n --sd-purple-50: ",";\\n --sd-teal-300: ",";\\n --sd-teal-500: ",";\\n --sd-teal-50: ",";\\n --sd-silver-500: ",";\\n --sd-silver-200: ",";\\n --sd-silver-400: ",";\\n --sd-dark-100: ",";\\n --sd-dark-300: ",";\\n --sd-dark-500: ",";\\n }\\n"]'))), exports.ColorLightInternal.White, exports.ColorLightInternal.White50, exports.ColorLightInternal.White40, exports.ColorLightInternal.White20, exports.ColorLightInternal.White10, exports.ColorLightInternal.White08, exports.ColorLightInternal.Transparent, exports.ColorLightInternal.Black, exports.ColorLightInternal.Black50, exports.ColorLightInternal.Black20, exports.ColorLightInternal.Dark30, exports.ColorLightInternal.Blue30, exports.ColorLightInternal.Green30, exports.ColorLightInternal.Red30, exports.ColorLightInternal.Silver30, exports.ColorLightInternal.Blue10, exports.ColorLightInternal.Red10, exports.ColorLightInternal.Grey100, exports.ColorLightInternal.Grey200, exports.ColorLightInternal.Grey300, exports.ColorLightInternal.Grey400, exports.ColorLightInternal.Grey450, exports.ColorLightInternal.Grey500, exports.ColorLightInternal.Dark200, exports.ColorLightInternal.Dark400, exports.ColorLightInternal.Dark450, exports.ColorLightInternal.Silver100, exports.ColorLightInternal.Silver300, exports.ColorLightInternal.Blue75, exports.ColorLightInternal.Blue100, exports.ColorLightInternal.Blue200, exports.ColorLightInternal.Blue400, exports.ColorLightInternal.Green75, exports.ColorLightInternal.Green100, exports.ColorLightInternal.Green200, exports.ColorLightInternal.Green400, exports.ColorLightInternal.Purple75, exports.ColorLightInternal.Purple100, exports.ColorLightInternal.Purple200, exports.ColorLightInternal.Purple400, exports.ColorLightInternal.Red75, exports.ColorLightInternal.Red100, exports.ColorLightInternal.Red200, exports.ColorLightInternal.Red400, exports.ColorLightInternal.Teal75, exports.ColorLightInternal.Teal100, exports.ColorLightInternal.Teal200, exports.ColorLightInternal.Teal400, exports.ColorLightInternal.Yellow75, exports.ColorLightInternal.Yellow100, exports.ColorLightInternal.Yellow200, exports.ColorLightInternal.Yellow400, exports.ColorLightInternal.Dark50, exports.ColorLightInternal.Blue50, exports.ColorLightInternal.Blue500, exports.ColorLightInternal.Blue300, exports.ColorLightInternal.Green300, exports.ColorLightInternal.Green500, exports.ColorLightInternal.Green50, exports.ColorLightInternal.Yellow300, exports.ColorLightInternal.Yellow500, exports.ColorLightInternal.Yellow50, exports.ColorLightInternal.Red300, exports.ColorLightInternal.Red500, exports.ColorLightInternal.Red50, exports.ColorLightInternal.Purple300, exports.ColorLightInternal.Purple500, exports.ColorLightInternal.Purple50, exports.ColorLightInternal.Teal300, exports.ColorLightInternal.Teal500, exports.ColorLightInternal.Teal50, exports.ColorLightInternal.Silver500, exports.ColorLightInternal.Silver200, exports.ColorLightInternal.Silver400, exports.ColorLightInternal.Dark100, exports.ColorLightInternal.Dark300, exports.ColorLightInternal.Dark500);
4091
+ var GlobalStyles = /*#__PURE__*/styled.createGlobalStyle(_ref => {
4092
+ var {
4093
+ theme
4094
+ } = _ref;
4095
+ var color = theme.palette.type === 'dark' ? exports.ColorDarkInternal : exports.ColorLightInternal;
4096
+ return "\n :root{\n --sd-white: ".concat(color.White, ";\n --sd-white-50: ").concat(color.White50, ";\n --sd-white-40: ").concat(color.White40, ";\n --sd-white-20: ").concat(color.White20, ";\n --sd-white-10: ").concat(color.White10, ";\n --sd-white-08: ").concat(color.White08, ";\n --sd-transparent: ").concat(color.Transparent, ";\n\n --sd-black: ").concat(color.Black, ";\n --sd-black-50: ").concat(color.Black50, ";\n --sd-black-20: ").concat(color.Black20, ";\n\n --sd-dark-30: ").concat(color.Dark30, ";\n --sd-blue-30: ").concat(color.Blue30, ";\n --sd-green-30: ").concat(color.Green30, ";\n --sd-red-30: ").concat(color.Red30, ";\n --sd-silver-30: ").concat(color.Silver30, ";\n\n --sd-blue-10: ").concat(color.Blue10, ";\n --sd-red-10: ").concat(color.Red10, ";\n\n /* Legacy Neutral Colors */\n --sd-grey-100: ").concat(color.Grey100, "; /* @deprecated Use Dark100 */\n --sd-grey-200: ").concat(color.Grey200, "; /* @deprecated Use Dark200 */\n --sd-grey-300: ").concat(color.Grey300, "; /* @deprecated Use Dark300 */\n --sd-grey-400: ").concat(color.Grey400, "; /* @deprecated Use Dark400 */\n --sd-grey-450: ").concat(color.Grey450, "; /* @deprecated Use Dark450 */\n --sd-grey-500: ").concat(color.Grey500, "; /* @deprecated Use Dark500 */\n\n --sd-dark-200: ").concat(color.Dark200, "; /* @deprecated */\n --sd-dark-400: ").concat(color.Dark400, "; /* @deprecated */\n --sd-dark-450: ").concat(color.Dark450, "; /* @deprecated */\n\n --sd-silver-100: ").concat(color.Silver100, "; /* @deprecated */\n --sd-silver-300: ").concat(color.Silver300, "; /* @deprecated */\n\n /* Legacy Extended Palette */\n --sd-blue-75: ").concat(color.Blue75, "; /* @deprecated */\n --sd-blue-100: ").concat(color.Blue100, "; /* @deprecated */\n --sd-blue-200: ").concat(color.Blue200, "; /* @deprecated */\n --sd-blue-400: ").concat(color.Blue400, "; /* @deprecated */\n\n --sd-green-75: ").concat(color.Green75, "; /* @deprecated */\n --sd-green-100: ").concat(color.Green100, "; /* @deprecated */\n --sd-green-200: ").concat(color.Green200, "; /* @deprecated */\n --sd-green-400: ").concat(color.Green400, "; /* @deprecated */\n\n --sd-purple-75: ").concat(color.Purple75, "; /* @deprecated */\n --sd-purple-100: ").concat(color.Purple100, "; /* @deprecated */\n --sd-purple-200: ").concat(color.Purple200, "; /* @deprecated */\n --sd-purple-400: ").concat(color.Purple400, "; /* @deprecated */\n\n --sd-red-75: ").concat(color.Red75, "; /* @deprecated */\n --sd-red-100: ").concat(color.Red100, "; /* @deprecated */\n --sd-red-200: ").concat(color.Red200, "; /* @deprecated */\n --sd-red-400: ").concat(color.Red400, "; /* @deprecated */\n\n --sd-teal-75: ").concat(color.Teal75, "; /* @deprecated */\n --sd-teal-100: ").concat(color.Teal100, "; /* @deprecated */\n --sd-teal-200: ").concat(color.Teal200, "; /* @deprecated */\n --sd-teal-400: ").concat(color.Teal400, "; /* @deprecated */\n\n --sd-yellow-75: ").concat(color.Yellow75, "; /* @deprecated */\n --sd-yellow-100: ").concat(color.Yellow100, "; /* @deprecated */\n --sd-yellow-200: ").concat(color.Yellow200, "; /* @deprecated */\n --sd-yellow-400: ").concat(color.Yellow400, "; /* @deprecated */\n --sd-dark-50: ").concat(color.Dark50, ";\n /* extended palette */\n \n --sd-blue-50: ").concat(color.Blue50, ";\n --sd-blue-500: ").concat(color.Blue500, ";\n --sd-blue-300: ").concat(color.Blue300, ";\n --sd-green-300: ").concat(color.Green300, ";\n --sd-green-500: ").concat(color.Green500, ";\n --sd-green-50: ").concat(color.Green50, ";\n --sd-yellow-300: ").concat(color.Yellow300, ";\n --sd-yellow-500: ").concat(color.Yellow500, ";\n --sd-yellow-50: ").concat(color.Yellow50, ";\n --sd-red-300: ").concat(color.Red300, ";\n --sd-red-500: ").concat(color.Red500, ";\n --sd-red-50: ").concat(color.Red50, ";\n --sd-purple-300: ").concat(color.Purple300, ";\n --sd-purple-500: ").concat(color.Purple500, ";\n --sd-purple-50: ").concat(color.Purple50, ";\n --sd-teal-300: ").concat(color.Teal300, ";\n --sd-teal-500: ").concat(color.Teal500, ";\n --sd-teal-50: ").concat(color.Teal50, ";\n --sd-silver-500: ").concat(color.Silver500, ";\n --sd-silver-200: ").concat(color.Silver200, ";\n --sd-silver-400: ").concat(color.Silver400, ";\n --sd-dark-100: ").concat(color.Dark100, ";\n --sd-dark-300: ").concat(color.Dark300, ";\n --sd-dark-500: ").concat(color.Dark500, ";\n }\n ");
4097
+ });
4094
4098
 
4095
- function createSuperDispatchTheme() {
4099
+ function createSuperDispatchTheme(type) {
4096
4100
  var breakpoints = createBreakpoints({});
4097
4101
  var theme = core.createTheme({
4098
4102
  breakpoints,
4099
4103
  palette: {
4104
+ type,
4100
4105
  primary: {
4101
4106
  main: exports.Color.Blue300
4102
4107
  },
@@ -4176,12 +4181,14 @@ function ThemeProvider(_ref) {
4176
4181
  var {
4177
4182
  modifier,
4178
4183
  children,
4184
+ mode,
4179
4185
  injectFirst = true
4180
4186
  } = _ref;
4181
- var theme = hooks.useConstant(() => {
4182
- var nextTheme = createSuperDispatchTheme();
4187
+ var theme = React.useMemo(() => {
4188
+ var nextTheme = createSuperDispatchTheme(mode);
4183
4189
  return !modifier ? nextTheme : modifier(nextTheme);
4184
- });
4190
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- modifier may update on every render
4191
+ }, [mode]);
4185
4192
  return /*#__PURE__*/jsxRuntime.jsx(styles.StylesProvider, {
4186
4193
  injectFirst: injectFirst,
4187
4194
  generateClassName: generateClassName,