@storybook/components 6.4.0-beta.1 → 6.4.0-beta.10

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.
@@ -496,10 +496,10 @@ var ColorControl = function ColorControl(_ref13) {
496
496
  return e.target.select();
497
497
  },
498
498
  placeholder: "Choose color..."
499
- }), /*#__PURE__*/_react.default.createElement(ToggleIcon, {
499
+ }), value ? /*#__PURE__*/_react.default.createElement(ToggleIcon, {
500
500
  icon: "markup",
501
501
  onClick: cycleColorSpace
502
- }));
502
+ }) : null);
503
503
  };
504
504
 
505
505
  exports.ColorControl = ColorControl;
@@ -13,10 +13,10 @@ require("core-js/modules/es.string.match.js");
13
13
 
14
14
  require("core-js/modules/es.regexp.exec.js");
15
15
 
16
- require("core-js/modules/es.array.join.js");
17
-
18
16
  require("core-js/modules/es.array.filter.js");
19
17
 
18
+ require("core-js/modules/es.array.join.js");
19
+
20
20
  require("core-js/modules/es.array.concat.js");
21
21
 
22
22
  require("core-js/modules/es.object.keys.js");
@@ -442,6 +442,12 @@ var DefaultCodeBlock = _theming.styled.code(function (_ref16) {
442
442
  };
443
443
  }, _shared.codeCommon);
444
444
 
445
+ var isInlineCodeRegex = /[\n\r]/g;
446
+
447
+ var isReactChildString = function isReactChildString(child) {
448
+ return typeof child === 'string';
449
+ };
450
+
445
451
  var Code = function Code(_ref17) {
446
452
  var _language$;
447
453
 
@@ -450,12 +456,17 @@ var Code = function Code(_ref17) {
450
456
  props = _objectWithoutProperties(_ref17, ["className", "children"]);
451
457
 
452
458
  var language = (className || '').match(/lang-(\S+)/);
453
- var isInlineCode = !children.match(/[\n\r]/g);
459
+
460
+ var childrenArray = _react.default.Children.toArray(children);
461
+
462
+ var isInlineCode = !childrenArray.filter(isReactChildString).some(function (child) {
463
+ return child.match(isInlineCodeRegex);
464
+ });
454
465
 
455
466
  if (isInlineCode) {
456
467
  return /*#__PURE__*/_react.default.createElement(DefaultCodeBlock, _extends({}, props, {
457
468
  className: className
458
- }), children);
469
+ }), childrenArray);
459
470
  }
460
471
 
461
472
  return /*#__PURE__*/_react.default.createElement(_Source.StyledSyntaxHighlighter, _extends({
@@ -437,10 +437,10 @@ export var ColorControl = function ColorControl(_ref13) {
437
437
  return e.target.select();
438
438
  },
439
439
  placeholder: "Choose color..."
440
- }), /*#__PURE__*/React.createElement(ToggleIcon, {
440
+ }), value ? /*#__PURE__*/React.createElement(ToggleIcon, {
441
441
  icon: "markup",
442
442
  onClick: cycleColorSpace
443
- }));
443
+ }) : null);
444
444
  };
445
445
  ColorControl.displayName = "ColorControl";
446
446
  export default ColorControl;
@@ -1,8 +1,8 @@
1
1
  import "core-js/modules/es.object.assign.js";
2
2
  import "core-js/modules/es.string.match.js";
3
3
  import "core-js/modules/es.regexp.exec.js";
4
- import "core-js/modules/es.array.join.js";
5
4
  import "core-js/modules/es.array.filter.js";
5
+ import "core-js/modules/es.array.join.js";
6
6
  import "core-js/modules/es.array.concat.js";
7
7
  import "core-js/modules/es.object.keys.js";
8
8
  import "core-js/modules/es.symbol.js";
@@ -366,6 +366,12 @@ var DefaultCodeBlock = styled.code(function (_ref16) {
366
366
  color: 'inherit'
367
367
  };
368
368
  }, codeCommon);
369
+ var isInlineCodeRegex = /[\n\r]/g;
370
+
371
+ var isReactChildString = function isReactChildString(child) {
372
+ return typeof child === 'string';
373
+ };
374
+
369
375
  export var Code = function Code(_ref17) {
370
376
  var _language$;
371
377
 
@@ -374,12 +380,15 @@ export var Code = function Code(_ref17) {
374
380
  props = _objectWithoutProperties(_ref17, ["className", "children"]);
375
381
 
376
382
  var language = (className || '').match(/lang-(\S+)/);
377
- var isInlineCode = !children.match(/[\n\r]/g);
383
+ var childrenArray = React.Children.toArray(children);
384
+ var isInlineCode = !childrenArray.filter(isReactChildString).some(function (child) {
385
+ return child.match(isInlineCodeRegex);
386
+ });
378
387
 
379
388
  if (isInlineCode) {
380
389
  return /*#__PURE__*/React.createElement(DefaultCodeBlock, _extends({}, props, {
381
390
  className: className
382
- }), children);
391
+ }), childrenArray);
383
392
  }
384
393
 
385
394
  return /*#__PURE__*/React.createElement(StyledSyntaxHighlighter, _extends({
@@ -334,10 +334,10 @@ export const ColorControl = ({
334
334
  onChange: e => updateValue(e.target.value),
335
335
  onFocus: e => e.target.select(),
336
336
  placeholder: "Choose color..."
337
- }), /*#__PURE__*/React.createElement(ToggleIcon, {
337
+ }), value ? /*#__PURE__*/React.createElement(ToggleIcon, {
338
338
  icon: "markup",
339
339
  onClick: cycleColorSpace
340
- }));
340
+ }) : null);
341
341
  };
342
342
  ColorControl.displayName = "ColorControl";
343
343
  export default ColorControl;
@@ -342,6 +342,10 @@ const DefaultCodeBlock = styled.code(({
342
342
  verticalAlign: 'baseline',
343
343
  color: 'inherit'
344
344
  }), codeCommon);
345
+ const isInlineCodeRegex = /[\n\r]/g;
346
+
347
+ const isReactChildString = child => typeof child === 'string';
348
+
345
349
  export const Code = (_ref2) => {
346
350
  var _language$;
347
351
 
@@ -352,12 +356,13 @@ export const Code = (_ref2) => {
352
356
  props = _objectWithoutPropertiesLoose(_ref2, ["className", "children"]);
353
357
 
354
358
  const language = (className || '').match(/lang-(\S+)/);
355
- const isInlineCode = !children.match(/[\n\r]/g);
359
+ const childrenArray = React.Children.toArray(children);
360
+ const isInlineCode = !childrenArray.filter(isReactChildString).some(child => child.match(isInlineCodeRegex));
356
361
 
357
362
  if (isInlineCode) {
358
363
  return /*#__PURE__*/React.createElement(DefaultCodeBlock, _extends({}, props, {
359
364
  className: className
360
- }), children);
365
+ }), childrenArray);
361
366
  }
362
367
 
363
368
  return /*#__PURE__*/React.createElement(StyledSyntaxHighlighter, _extends({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/components",
3
- "version": "6.4.0-beta.1",
3
+ "version": "6.4.0-beta.10",
4
4
  "description": "Core Storybook Components",
5
5
  "keywords": [
6
6
  "storybook"
@@ -41,9 +41,9 @@
41
41
  },
42
42
  "dependencies": {
43
43
  "@popperjs/core": "^2.6.0",
44
- "@storybook/client-logger": "6.4.0-beta.1",
44
+ "@storybook/client-logger": "6.4.0-beta.10",
45
45
  "@storybook/csf": "0.0.2--canary.6aca495.0",
46
- "@storybook/theming": "6.4.0-beta.1",
46
+ "@storybook/theming": "6.4.0-beta.10",
47
47
  "@types/color-convert": "^2.0.0",
48
48
  "@types/overlayscrollbars": "^1.12.0",
49
49
  "@types/react-syntax-highlighter": "11.0.5",
@@ -76,6 +76,6 @@
76
76
  "publishConfig": {
77
77
  "access": "public"
78
78
  },
79
- "gitHead": "000a73948b4b91aa6bf84828b42ccdb7064f72bd",
79
+ "gitHead": "9128cc184fa9771b332c1aabe85af6751dde890c",
80
80
  "sbmodern": "dist/modern/index.js"
81
81
  }