@lanaco/lnc-react-ui 3.0.0-rc.5 → 3.0.0-rc.6

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/lib/index.esm.js CHANGED
@@ -65311,21 +65311,23 @@ var useTheme = function useTheme() {
65311
65311
  var ThemeProvider = function ThemeProvider(_ref) {
65312
65312
  var theme = _ref.theme,
65313
65313
  children = _ref.children;
65314
- var _useState = useState(themes === null || themes === void 0 ? void 0 : themes.find(function (item) {
65315
- return item.name == theme;
65316
- })),
65314
+ var _useState = useState(function () {
65315
+ typeof theme == "string" ? themes === null || themes === void 0 ? void 0 : themes.find(function (item) {
65316
+ return item.name == theme;
65317
+ }) : theme;
65318
+ }),
65317
65319
  _useState2 = _slicedToArray$2(_useState, 2),
65318
65320
  currentTheme = _useState2[0],
65319
65321
  setCurrentTheme = _useState2[1];
65320
65322
  useEffect(function () {
65321
- setCurrentTheme(themes === null || themes === void 0 ? void 0 : themes.find(function (item) {
65323
+ if (typeof theme == "string") setCurrentTheme(themes === null || themes === void 0 ? void 0 : themes.find(function (item) {
65322
65324
  return item.name == theme;
65323
- }));
65325
+ }));else setCurrentTheme(theme);
65324
65326
  }, [theme]);
65325
65327
  var switchTheme = function switchTheme(name) {
65326
- setCurrentTheme(themes === null || themes === void 0 ? void 0 : themes.find(function (item) {
65327
- return item.name == name;
65328
- }));
65328
+ if (typeof theme == "string") setCurrentTheme(themes === null || themes === void 0 ? void 0 : themes.find(function (item) {
65329
+ return item.name == theme;
65330
+ }));else setCurrentTheme(theme);
65329
65331
  };
65330
65332
  return /*#__PURE__*/React__default.createElement(ThemeContext.Provider, {
65331
65333
  value: {
@@ -65342,7 +65344,7 @@ ThemeProvider.defaultProps = {
65342
65344
  theme: "Lanaco Light"
65343
65345
  };
65344
65346
  ThemeProvider.propTypes = {
65345
- theme: PropTypes.string
65347
+ theme: PropTypes.oneOfType[(PropTypes.string, PropTypes.object)]
65346
65348
  };
65347
65349
 
65348
65350
  var _excluded$E = ["control", "openOnClick", "openOnHover", "offset", "verticalAlignment", "horizontalAlignment", "widthFitContent", "closeOnItemSelect", "onFocus", "onBlur", "onClick", "onKeyDown", "onMouseEnter", "onMouseLeave", "onItemSelected", "className", "style", "color", "size", "popoverProps", "children"];
package/lib/index.js CHANGED
@@ -65360,21 +65360,23 @@ var useTheme = function useTheme() {
65360
65360
  var ThemeProvider = function ThemeProvider(_ref) {
65361
65361
  var theme = _ref.theme,
65362
65362
  children = _ref.children;
65363
- var _useState = React.useState(themes === null || themes === void 0 ? void 0 : themes.find(function (item) {
65364
- return item.name == theme;
65365
- })),
65363
+ var _useState = React.useState(function () {
65364
+ typeof theme == "string" ? themes === null || themes === void 0 ? void 0 : themes.find(function (item) {
65365
+ return item.name == theme;
65366
+ }) : theme;
65367
+ }),
65366
65368
  _useState2 = _slicedToArray__default["default"](_useState, 2),
65367
65369
  currentTheme = _useState2[0],
65368
65370
  setCurrentTheme = _useState2[1];
65369
65371
  React.useEffect(function () {
65370
- setCurrentTheme(themes === null || themes === void 0 ? void 0 : themes.find(function (item) {
65372
+ if (typeof theme == "string") setCurrentTheme(themes === null || themes === void 0 ? void 0 : themes.find(function (item) {
65371
65373
  return item.name == theme;
65372
- }));
65374
+ }));else setCurrentTheme(theme);
65373
65375
  }, [theme]);
65374
65376
  var switchTheme = function switchTheme(name) {
65375
- setCurrentTheme(themes === null || themes === void 0 ? void 0 : themes.find(function (item) {
65376
- return item.name == name;
65377
- }));
65377
+ if (typeof theme == "string") setCurrentTheme(themes === null || themes === void 0 ? void 0 : themes.find(function (item) {
65378
+ return item.name == theme;
65379
+ }));else setCurrentTheme(theme);
65378
65380
  };
65379
65381
  return /*#__PURE__*/React__default["default"].createElement(ThemeContext.Provider, {
65380
65382
  value: {
@@ -65391,7 +65393,7 @@ ThemeProvider.defaultProps = {
65391
65393
  theme: "Lanaco Light"
65392
65394
  };
65393
65395
  ThemeProvider.propTypes = {
65394
- theme: PropTypes__default["default"].string
65396
+ theme: PropTypes__default["default"].oneOfType[(PropTypes__default["default"].string, PropTypes__default["default"].object)]
65395
65397
  };
65396
65398
 
65397
65399
  var _excluded$E = ["control", "openOnClick", "openOnHover", "offset", "verticalAlignment", "horizontalAlignment", "widthFitContent", "closeOnItemSelect", "onFocus", "onBlur", "onClick", "onKeyDown", "onMouseEnter", "onMouseLeave", "onItemSelected", "className", "style", "color", "size", "popoverProps", "children"];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lanaco/lnc-react-ui",
3
3
  "type": "module",
4
- "version": "3.0.0-rc.5",
4
+ "version": "3.0.0-rc.6",
5
5
  "description": "component library",
6
6
  "main": "lib/index.js",
7
7
  "module": "lib/index.esm.js",