@storybook/components 6.4.0-alpha.4 → 6.4.0-alpha.40
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/ActionBar/ActionBar.js +1 -0
- package/dist/cjs/Button/Button.stories.js +8 -1
- package/dist/cjs/bar/separator.js +0 -2
- package/dist/cjs/blocks/ArgsTable/ArgControl.js +24 -41
- package/dist/cjs/blocks/ArgsTable/ArgRow.js +9 -1
- package/dist/cjs/blocks/ArgsTable/ArgsTable.js +1 -3
- package/dist/cjs/blocks/ColorPalette.js +33 -19
- package/dist/cjs/blocks/Preview.js +81 -8
- package/dist/cjs/controls/Boolean.js +2 -1
- package/dist/cjs/controls/Number.js +1 -0
- package/dist/cjs/controls/Object.js +1 -0
- package/dist/cjs/controls/Text.js +1 -0
- package/dist/cjs/controls/helpers.js +15 -2
- package/dist/cjs/controls/index.js +0 -14
- package/dist/cjs/controls/options/Options.js +22 -26
- package/dist/cjs/icon/icons.js +3 -0
- package/dist/cjs/index.js +7 -3
- package/dist/cjs/syntaxhighlighter/syntaxhighlighter.js +20 -14
- package/dist/esm/ActionBar/ActionBar.js +1 -0
- package/dist/esm/Button/Button.stories.js +8 -1
- package/dist/esm/bar/separator.js +0 -1
- package/dist/esm/blocks/ArgsTable/ArgControl.js +23 -41
- package/dist/esm/blocks/ArgsTable/ArgRow.js +8 -1
- package/dist/esm/blocks/ArgsTable/ArgsTable.js +1 -2
- package/dist/esm/blocks/ColorPalette.js +33 -19
- package/dist/esm/blocks/Preview.js +74 -7
- package/dist/esm/controls/Boolean.js +3 -2
- package/dist/esm/controls/Number.js +2 -1
- package/dist/esm/controls/Object.js +2 -1
- package/dist/esm/controls/Text.js +2 -1
- package/dist/esm/controls/helpers.js +10 -0
- package/dist/esm/controls/index.js +0 -1
- package/dist/esm/controls/options/Options.js +18 -24
- package/dist/esm/icon/icons.js +3 -0
- package/dist/esm/index.js +7 -4
- package/dist/esm/syntaxhighlighter/syntaxhighlighter.js +16 -13
- package/dist/modern/ActionBar/ActionBar.js +1 -0
- package/dist/modern/Button/Button.stories.js +8 -1
- package/dist/modern/blocks/ArgsTable/ArgControl.js +23 -41
- package/dist/modern/blocks/ArgsTable/ArgRow.js +7 -1
- package/dist/modern/blocks/ArgsTable/ArgsTable.js +1 -1
- package/dist/modern/blocks/ColorPalette.js +20 -7
- package/dist/modern/blocks/Preview.js +34 -5
- package/dist/modern/controls/Boolean.js +3 -2
- package/dist/modern/controls/Number.js +2 -1
- package/dist/modern/controls/Object.js +2 -1
- package/dist/modern/controls/Text.js +2 -1
- package/dist/modern/controls/helpers.js +9 -1
- package/dist/modern/controls/index.js +0 -1
- package/dist/modern/controls/options/Options.js +16 -23
- package/dist/modern/icon/icons.js +3 -0
- package/dist/modern/index.js +4 -2
- package/dist/modern/syntaxhighlighter/syntaxhighlighter.js +11 -8
- package/dist/ts3.4/Button/Button.d.ts +1 -0
- package/dist/ts3.4/controls/helpers.d.ts +7 -0
- package/dist/ts3.4/controls/index.d.ts +0 -1
- package/dist/ts3.4/controls/types.d.ts +1 -5
- package/dist/ts3.4/icon/icons.d.ts +3 -0
- package/dist/ts3.4/syntaxhighlighter/syntaxhighlighter.d.ts +1 -0
- package/dist/ts3.9/Button/Button.d.ts +1 -0
- package/dist/ts3.9/controls/helpers.d.ts +7 -0
- package/dist/ts3.9/controls/index.d.ts +0 -1
- package/dist/ts3.9/controls/types.d.ts +1 -5
- package/dist/ts3.9/icon/icons.d.ts +3 -0
- package/dist/ts3.9/syntaxhighlighter/syntaxhighlighter.d.ts +1 -0
- package/package.json +7 -7
- package/dist/cjs/controls/Array.js +0 -123
- package/dist/cjs/controls/Array.stories.js +0 -92
- package/dist/esm/controls/Array.js +0 -86
- package/dist/esm/controls/Array.stories.js +0 -55
- package/dist/modern/controls/Array.js +0 -55
- package/dist/modern/controls/Array.stories.js +0 -20
- package/dist/ts3.4/controls/Array.d.ts +0 -4
- package/dist/ts3.9/controls/Array.d.ts +0 -4
package/dist/esm/icon/icons.js
CHANGED
|
@@ -107,7 +107,10 @@ export var icons = {
|
|
|
107
107
|
dashboard: 'M512 85.3a512 512 0 01361 875c-99.5-44-225-70.4-361.6-70.4-136.1 0-261.4 26.2-360.8 70A512 512 0 01512 85.4zm0 91.5c-112.4 0-218 43.7-297.4 123.1A417.8 417.8 0 0091.4 597.3c0 93 30 181.5 85.5 254.2 101-34.8 215.3-53 334.5-53 119.6 0 234.2 18.3 335.5 53.4a417.3 417.3 0 0085.7-254.6c0-112.3-43.8-218-123.2-297.4a417.5 417.5 0 00-275-122.6l-22.4-.5zm219.7 115.7a45.7 45.7 0 0116.7 62.4L580.4 646c6.5 17.1 6.7 36.6-.6 54.3l-4.3 8.7A73.1 73.1 0 11501.3 600l168-291a45.7 45.7 0 0162.4-16.6z',
|
|
108
108
|
hourglass: 'M511.926 801.946c-22.090 0-40-17.906-40-40v0c0-22.090 17.91-40 40-40v0c22.090 0 40.004 17.91 40.004 40v0c0 22.094-17.914 40-40.004 40v0zM831.682 915.242c0.192 1.582 0.318 3.186 0.318 4.82 0 22.090-17.908 40-40 40h-560c-22.092 0-40-17.914-40-40 0-2.438 0.252-4.812 0.67-7.128 2.36-53.636 18.034-105.7 45.852-151.554 0.734-1.476 1.562-2.912 2.492-4.296l5.582-8.364c0.054-0.080 0.11-0.158 0.164-0.238 0.042-0.068 0.098-0.156 0.144-0.222l157.704-236.036-158.5-237.228c-0.116-0.17-0.23-0.342-0.34-0.516-32.842-49.178-51.11-105.994-53.368-165.044-0.238-1.762-0.402-3.546-0.402-5.374 0-22.090 17.908-40 40-40h560c22.092 0 40 17.914 40 40 0 2.056-0.204 4.064-0.504 6.038-2.194 54.020-17.886 106.48-45.894 152.648-0.734 1.472-1.562 2.91-2.492 4.294l-5.582 8.366c-0.054 0.078-0.11 0.156-0.164 0.236-0.042 0.068-0.098 0.154-0.144 0.222l-157.734 236.082 158.468 237.182c0.116 0.168 0.23 0.344 0.34 0.516 32.946 49.33 51.226 106.346 53.39 165.596zM749.958 144.060h-475.99c6.138 31.304 18.384 61.124 36.354 87.916 0.118 0.17 0.23 0.344 0.342 0.514l0.024 0.038c0.036 0.054 0.15 0.23 0.186 0.284l54.286 81.25h293.596l58.196-87.1c0.366-0.67 0.75-1.334 1.154-1.99 15.492-24.916 26.228-52.324 31.852-80.912zM497.528 512.178l-0.032 0.046 14.426 21.592 93.378-139.756h-186.692l78.92 118.118zM305.96 799.156c-15.498 24.91-26.234 52.318-31.856 80.906h476.052c-6.138-31.304-18.384-61.122-36.354-87.918-0.118-0.168-0.23-0.344-0.342-0.512l-0.024-0.040c-0.036-0.050-0.15-0.23-0.186-0.282l-140.242-209.902-28.98 43.374c-7.166 10.72-19.21 17.162-32.11 17.162-12.896 0-24.942-6.442-32.11-17.166l-28.76-43.044-143.938 215.428c-0.36 0.674-0.744 1.338-1.15 1.994z',
|
|
109
109
|
play: 'M878.78 477.856l-591.884-341.722c-9.464-5.464-18.426-8.050-26.386-8.048-19.516 0.002-33.002 15.546-33.002 42.338v683.446c0 26.792 13.482 42.338 33.002 42.338 7.96 0 16.924-2.586 26.386-8.048l591.884-341.722c32.664-18.864 32.664-49.724 0-68.582z',
|
|
110
|
+
playnext: 'M222 136l513 342 12 10V192a64 64 0 01128 0v640a64 64 0 01-128 0V536l-12 10-513 342c-8 5-16 8-23 8-17 0-28-16-28-42V170c0-26 11-42 28-42 7 0 15 3 23 8z',
|
|
111
|
+
playback: 'M823 136L311 478l-12 10V192a64 64 0 00-128 0v640a64 64 0 10128 0V536l12 10 512 342c8 5 16 8 23 8 17 0 29-16 29-42V170c0-26-12-42-29-42-7 0-15 3-23 8z',
|
|
110
112
|
stop: 'M1024 512A512 512 0 100 512a512 512 0 001024 0zM215 809a418 418 0 010-594 418 418 0 01594 0 418 418 0 010 594 418 418 0 01-594 0zm471-78H338c-25 0-45-20-45-45V338c0-25 20-45 45-45h348c25 0 45 20 45 45v348c0 25-20 45-45 45z',
|
|
113
|
+
stopalt: 'M894 85H130c-25 0-45 20-45 45v764c0 25 20 45 45 45h764c25 0 45-20 45-45V130c0-25-20-45-45-45z',
|
|
111
114
|
email: 'M960.032 268.004c0.748-10.040-2.246-20.364-9.226-28.684-5.984-7.132-13.938-11.62-22.394-13.394-0.13-0.026-0.268-0.066-0.396-0.092-1.082-0.22-2.172-0.376-3.272-0.5-0.25-0.032-0.492-0.080-0.742-0.102-1.028-0.096-2.052-0.136-3.090-0.156-0.292-0.002-0.582-0.042-0.876-0.042h-816.008c-21.416 0-38.848 16.844-39.898 38-0.034 0.628-0.092 1.256-0.096 1.89 0 0.034-0.006 0.074-0.006 0.114 0 0.050 0.008 0.102 0.008 0.152v495.692c0 0.054-0.008 0.106-0.008 0.156 0 22.090 17.91 40 40 40h816.004c13.808 0 25.98-6.996 33.17-17.636 0.1-0.148 0.182-0.312 0.28-0.458 0.606-0.93 1.196-1.868 1.722-2.84 0.046-0.082 0.080-0.172 0.124-0.258 2.992-5.604 4.704-12.008 4.704-18.804v0 0-493.038zM144.032 350.156l339.946 281.188c6.568 6.434 14.918 10.168 23.564 11.122 0.16 0.024 0.32 0.050 0.48 0.066 0.838 0.082 1.676 0.114 2.518 0.14 0.496 0.020 0.994 0.058 1.492 0.058s0.996-0.042 1.492-0.058c0.842-0.028 1.68-0.058 2.518-0.14 0.16-0.016 0.32-0.042 0.48-0.066 8.646-0.958 16.996-4.688 23.564-11.122l339.946-281.206v370.894h-736v-370.876zM215.066 305.030h593.91l-296.946 245.422-296.964-245.422z',
|
|
112
115
|
link: 'M743.52 529.234c5.616-5.616 83.048-83.046 88.462-88.46 30.944-32.778 47.97-75.636 47.97-120.792 0-47.048-18.304-91.26-51.542-124.484-33.228-33.22-77.43-51.516-124.458-51.516-45.024 0-87.792 16.94-120.536 47.72l-104.458 104.456c-30.792 32.738-47.734 75.512-47.734 120.548 0 41.916 14.576 81.544 41.248 113.196 3.264 3.876 6.666 7.664 10.292 11.29 4.258 4.258 8.704 8.262 13.304 12.022 0.054 0.080 0.096 0.152 0.148 0.232 9.572 7.308 15.778 18.804 15.778 31.776 0 22.094-17.914 40-40.004 40-8.542 0-16.442-2.696-22.938-7.26-2.746-1.93-20.622-17.43-30.35-28.050-0.008-0.010-0.018-0.018-0.026-0.028-4.992-5.432-13.234-15.23-18.552-22.65s-16.556-25.872-17.036-26.736c-0.7-1.262-2.974-5.526-3.422-6.39-0.69-1.334-6.118-12.67-6.114-12.67-14.342-31.96-22.332-67.4-22.332-104.728 0-60.826 21.198-116.648 56.58-160.544 0.252-0.314 4.61-5.594 6.594-7.866 0.304-0.35 5.038-5.636 7.16-7.874 0.252-0.268 105.86-105.874 106.128-106.126 45.902-43.584 107.958-70.314 176.264-70.314 141.382 0 255.998 114.5 255.998 256 0 68.516-26.882 130.688-70.652 176.61-0.144 0.148-109.854 109.546-112.090 111.528-0.958 0.848-5.072 4.352-5.072 4.352-6.448 5.434-13.132 10.592-20.1 15.378 0.412-6.836 0.644-13.702 0.644-20.6 0-26.46-3.108-52.206-8.918-76.918l-0.236-1.102zM616.144 767.82c35.382-43.896 56.58-99.718 56.58-160.544 0-37.328-7.99-72.768-22.332-104.728 0.004 0 0.006-0.002 0.010-0.004-0.258-0.576-0.538-1.14-0.8-1.714-0.686-1.498-2.894-6.112-3.296-6.93-0.668-1.344-2.952-5.732-3.386-6.604-3.48-6.982-8.708-15.126-9.49-16.366-0.498-0.792-0.996-1.58-1.502-2.364-0.834-1.29-15.364-22.066-26.656-34.466-0.008-0.010-0.018-0.018-0.026-0.028-7.056-8.448-24.932-24.198-30.35-28.050-6.47-4.602-14.396-7.26-22.938-7.26-22.090 0-40.004 17.906-40.004 40 0 12.97 6.206 24.466 15.778 31.776 0.052 0.080 0.094 0.152 0.148 0.232 4.602 3.76 20.334 19.434 23.598 23.31 26.672 31.65 41.248 71.28 41.248 113.196 0 45.038-16.944 87.81-47.734 120.548l-104.458 104.456c-32.742 30.782-75.512 47.72-120.536 47.72-47.028 0-91.228-18.294-124.458-51.516-33.236-33.224-51.542-77.436-51.542-124.484 0-45.154 17.028-88.014 47.97-120.792 5.414-5.414 40.812-40.812 68.958-68.958 7.176-7.176 13.888-13.886 19.504-19.502v-0.002c-0.356-1.562-0.246-1.096-0.246-1.096-5.81-24.712-8.918-50.458-8.918-76.918 0-6.898 0.232-13.764 0.644-20.6-6.966 4.788-20.1 15.33-20.1 15.33-0.734 0.62-9.518 8.388-11.68 10.45-0.16 0.154-105.338 105.33-105.482 105.478-43.77 45.922-70.652 108.094-70.652 176.61 0 141.5 114.616 256 255.998 256 68.306 0 130.362-26.73 176.264-70.314 0.27-0.254 105.876-105.86 106.128-106.126 0.004-0.002 13.506-15.426 13.758-15.74z',
|
|
113
116
|
paperclip: 'M824.25 369.354c68.146-70.452 67.478-182.784-2.094-252.354-70.296-70.296-184.266-70.296-254.558 0-0.014 0.012-0.028 0.026-0.042 0.042-0.004 0.002-0.006 0.004-0.010 0.008l-433.144 433.142c-0.036 0.036-0.074 0.068-0.11 0.106-0.054 0.052-0.106 0.11-0.16 0.162l-2.668 2.67c-0.286 0.286-0.528 0.596-0.8 0.888-43.028 44.88-66.664 103.616-66.664 165.986 0 64.106 24.962 124.376 70.292 169.704 45.328 45.33 105.598 70.292 169.706 70.292 50.612 0 98.822-15.57 139.186-44.428 4.932-1.952 9.556-4.906 13.544-8.894l16.802-16.802c0.056-0.056 0.116-0.112 0.172-0.168 0.038-0.038 0.074-0.076 0.112-0.116l289.010-289.014c15.622-15.618 15.62-40.942 0-56.56s-40.948-15.62-56.566 0l-289.124 289.122c-62.482 62.484-163.792 62.484-226.274 0-62.484-62.482-62.484-163.79 0-226.272h-0.002l433.134-433.12c0.058-0.060 0.112-0.122 0.172-0.18 38.99-38.99 102.43-38.99 141.42 0 38.992 38.99 38.99 102.432 0 141.422-0.058 0.060-0.122 0.114-0.18 0.17l0.006 0.006-280.536 280.534c-0.002-0.002-0.002-0.004-0.004-0.006l-79.978 79.98c-0.010 0.010-0.016 0.020-0.028 0.028-0.008 0.012-0.018 0.018-0.028 0.028l-0.064 0.062c-15.622 15.624-40.944 15.624-56.562 0-15.624-15.62-15.624-40.944-0.002-56.566l0.062-0.062c0.010-0.010 0.018-0.020 0.028-0.028 0.008-0.012 0.020-0.018 0.028-0.028l79.98-79.978c-0.002-0.002-0.004-0.002-0.006-0.004l136.508-136.512c15.622-15.62 15.62-40.944-0.002-56.562-15.618-15.62-40.946-15.62-56.564 0l-219.342 219.344c-1.284 1.284-2.42 2.652-3.494 4.052-40.4 47.148-38.316 118.184 6.322 162.824 44.64 44.638 115.674 46.722 162.82 6.324 1.402-1.072 2.772-2.21 4.054-3.494l2.83-2.832c0.002 0 0.002 0 0.002 0s0 0 0 0l360.54-360.54c0.058-0.056 0.12-0.114 0.18-0.172 0.050-0.050 0.098-0.106 0.15-0.158l0.994-0.994c0.34-0.338 0.63-0.702 0.952-1.052z',
|
package/dist/esm/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import "core-js/modules/web.dom-collections.for-each.js";
|
|
2
2
|
import "core-js/modules/es.object.keys.js";
|
|
3
|
-
import
|
|
3
|
+
import "core-js/modules/es.object.assign.js";
|
|
4
|
+
import { createElement, forwardRef } from 'react';
|
|
4
5
|
import { components as rawComponents } from './typography/DocumentFormatting';
|
|
5
6
|
export { Badge } from './Badge/Badge'; // Typography
|
|
6
7
|
|
|
@@ -40,8 +41,10 @@ export * from './typography/DocumentFormatting';
|
|
|
40
41
|
export { rawComponents as components };
|
|
41
42
|
var resetComponents = {};
|
|
42
43
|
Object.keys(rawComponents).forEach(function (key) {
|
|
43
|
-
resetComponents[key] = function (props) {
|
|
44
|
-
return /*#__PURE__*/createElement(key, props
|
|
45
|
-
|
|
44
|
+
resetComponents[key] = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
45
|
+
return /*#__PURE__*/createElement(key, Object.assign({}, props, {
|
|
46
|
+
ref: ref
|
|
47
|
+
}));
|
|
48
|
+
});
|
|
46
49
|
});
|
|
47
50
|
export { resetComponents };
|
|
@@ -24,13 +24,13 @@ function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(
|
|
|
24
24
|
|
|
25
25
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
26
26
|
|
|
27
|
-
import "core-js/modules/es.array.reduce.js";
|
|
28
27
|
import "core-js/modules/es.object.entries.js";
|
|
29
28
|
import "core-js/modules/es.object.assign.js";
|
|
30
29
|
import "core-js/modules/es.string.trim.js";
|
|
30
|
+
import "core-js/modules/es.object.to-string.js";
|
|
31
|
+
import "core-js/modules/es.regexp.to-string.js";
|
|
31
32
|
import "core-js/modules/es.symbol.js";
|
|
32
33
|
import "core-js/modules/es.symbol.description.js";
|
|
33
|
-
import "core-js/modules/es.object.to-string.js";
|
|
34
34
|
import "core-js/modules/es.symbol.iterator.js";
|
|
35
35
|
import "core-js/modules/es.string.iterator.js";
|
|
36
36
|
import "core-js/modules/es.array.iterator.js";
|
|
@@ -95,14 +95,15 @@ var themedSyntax = memoize(2)(function (theme) {
|
|
|
95
95
|
return Object.assign({}, acc, _defineProperty({}, "* .".concat(key), val));
|
|
96
96
|
}, {});
|
|
97
97
|
});
|
|
98
|
-
var copyToClipboard;
|
|
98
|
+
var copyToClipboard = createCopyToClipboardFunction();
|
|
99
|
+
export function createCopyToClipboardFunction() {
|
|
100
|
+
if (navigator !== null && navigator !== void 0 && navigator.clipboard) {
|
|
101
|
+
return function (text) {
|
|
102
|
+
return navigator.clipboard.writeText(text);
|
|
103
|
+
};
|
|
104
|
+
}
|
|
99
105
|
|
|
100
|
-
|
|
101
|
-
copyToClipboard = function copyToClipboard(text) {
|
|
102
|
-
return navigator.clipboard.writeText(text);
|
|
103
|
-
};
|
|
104
|
-
} else {
|
|
105
|
-
copyToClipboard = /*#__PURE__*/function () {
|
|
106
|
+
return /*#__PURE__*/function () {
|
|
106
107
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(text) {
|
|
107
108
|
var tmp, focus;
|
|
108
109
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
@@ -126,12 +127,11 @@ if (navigator !== null && navigator !== void 0 && navigator.clipboard) {
|
|
|
126
127
|
}, _callee);
|
|
127
128
|
}));
|
|
128
129
|
|
|
129
|
-
return function
|
|
130
|
+
return function (_x) {
|
|
130
131
|
return _ref3.apply(this, arguments);
|
|
131
132
|
};
|
|
132
133
|
}();
|
|
133
134
|
}
|
|
134
|
-
|
|
135
135
|
var Wrapper = styled.div(function (_ref4) {
|
|
136
136
|
var theme = _ref4.theme;
|
|
137
137
|
return {
|
|
@@ -215,7 +215,9 @@ export var SyntaxHighlighter = function SyntaxHighlighter(_ref10) {
|
|
|
215
215
|
|
|
216
216
|
var onClick = function onClick(e) {
|
|
217
217
|
e.preventDefault();
|
|
218
|
-
|
|
218
|
+
var selectedText = globalWindow.getSelection().toString();
|
|
219
|
+
var textToCopy = e.type !== 'click' && selectedText ? selectedText : highlightableCode;
|
|
220
|
+
copyToClipboard(textToCopy).then(function () {
|
|
219
221
|
setCopied(true);
|
|
220
222
|
globalWindow.setTimeout(function () {
|
|
221
223
|
return setCopied(false);
|
|
@@ -226,7 +228,8 @@ export var SyntaxHighlighter = function SyntaxHighlighter(_ref10) {
|
|
|
226
228
|
return /*#__PURE__*/React.createElement(Wrapper, {
|
|
227
229
|
bordered: bordered,
|
|
228
230
|
padded: padded,
|
|
229
|
-
className: className
|
|
231
|
+
className: className,
|
|
232
|
+
onCopyCapture: onClick
|
|
230
233
|
}, /*#__PURE__*/React.createElement(Scroller, null, /*#__PURE__*/React.createElement(ReactSyntaxHighlighter, _extends({
|
|
231
234
|
padded: padded || bordered,
|
|
232
235
|
language: language,
|
|
@@ -55,4 +55,11 @@ storiesOf('Basics/Button', module).add('all buttons', () => /*#__PURE__*/React.c
|
|
|
55
55
|
small: true
|
|
56
56
|
}, /*#__PURE__*/React.createElement(Icons, {
|
|
57
57
|
icon: "link"
|
|
58
|
-
}), "Link")
|
|
58
|
+
}), "Link"), /*#__PURE__*/React.createElement(Button, {
|
|
59
|
+
primary: true,
|
|
60
|
+
small: true,
|
|
61
|
+
isLink: true,
|
|
62
|
+
href: "#"
|
|
63
|
+
}, /*#__PURE__*/React.createElement(Icons, {
|
|
64
|
+
icon: "link"
|
|
65
|
+
}), " Link")));
|
|
@@ -2,6 +2,23 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
|
|
|
2
2
|
|
|
3
3
|
import React, { useCallback, useState, useEffect } from 'react';
|
|
4
4
|
import { BooleanControl, ColorControl, DateControl, FilesControl, NumberControl, ObjectControl, OptionsControl, RangeControl, TextControl } from '../../controls';
|
|
5
|
+
const Controls = {
|
|
6
|
+
array: ObjectControl,
|
|
7
|
+
object: ObjectControl,
|
|
8
|
+
boolean: BooleanControl,
|
|
9
|
+
color: ColorControl,
|
|
10
|
+
date: DateControl,
|
|
11
|
+
number: NumberControl,
|
|
12
|
+
check: OptionsControl,
|
|
13
|
+
'inline-check': OptionsControl,
|
|
14
|
+
radio: OptionsControl,
|
|
15
|
+
'inline-radio': OptionsControl,
|
|
16
|
+
select: OptionsControl,
|
|
17
|
+
'multi-select': OptionsControl,
|
|
18
|
+
range: RangeControl,
|
|
19
|
+
text: TextControl,
|
|
20
|
+
file: FilesControl
|
|
21
|
+
};
|
|
5
22
|
|
|
6
23
|
const NoControl = () => /*#__PURE__*/React.createElement(React.Fragment, null, "-");
|
|
7
24
|
|
|
@@ -46,44 +63,9 @@ export const ArgControl = ({
|
|
|
46
63
|
onBlur,
|
|
47
64
|
onFocus
|
|
48
65
|
};
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
case 'boolean':
|
|
56
|
-
return /*#__PURE__*/React.createElement(BooleanControl, _extends({}, props, control));
|
|
57
|
-
|
|
58
|
-
case 'color':
|
|
59
|
-
return /*#__PURE__*/React.createElement(ColorControl, _extends({}, props, control));
|
|
60
|
-
|
|
61
|
-
case 'date':
|
|
62
|
-
return /*#__PURE__*/React.createElement(DateControl, _extends({}, props, control));
|
|
63
|
-
|
|
64
|
-
case 'number':
|
|
65
|
-
return /*#__PURE__*/React.createElement(NumberControl, _extends({}, props, control));
|
|
66
|
-
|
|
67
|
-
case 'check':
|
|
68
|
-
case 'inline-check':
|
|
69
|
-
case 'radio':
|
|
70
|
-
case 'inline-radio':
|
|
71
|
-
case 'select':
|
|
72
|
-
case 'multi-select':
|
|
73
|
-
return /*#__PURE__*/React.createElement(OptionsControl, _extends({}, props, control, {
|
|
74
|
-
controlType: control.type
|
|
75
|
-
}));
|
|
76
|
-
|
|
77
|
-
case 'range':
|
|
78
|
-
return /*#__PURE__*/React.createElement(RangeControl, _extends({}, props, control));
|
|
79
|
-
|
|
80
|
-
case 'text':
|
|
81
|
-
return /*#__PURE__*/React.createElement(TextControl, _extends({}, props, control));
|
|
82
|
-
|
|
83
|
-
case 'file':
|
|
84
|
-
return /*#__PURE__*/React.createElement(FilesControl, _extends({}, props, control));
|
|
85
|
-
|
|
86
|
-
default:
|
|
87
|
-
return /*#__PURE__*/React.createElement(NoControl, null);
|
|
88
|
-
}
|
|
89
|
-
};
|
|
66
|
+
const Control = Controls[control.type] || NoControl;
|
|
67
|
+
return /*#__PURE__*/React.createElement(Control, _extends({}, props, control, {
|
|
68
|
+
controlType: control.type
|
|
69
|
+
}));
|
|
70
|
+
};
|
|
71
|
+
ArgControl.displayName = "ArgControl";
|
|
@@ -27,12 +27,18 @@ const Description = styled.div(({
|
|
|
27
27
|
color: theme.color.secondary
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
|
-
code: codeCommon({
|
|
30
|
+
code: Object.assign({}, codeCommon({
|
|
31
31
|
theme
|
|
32
|
+
}), {
|
|
33
|
+
fontSize: 12,
|
|
34
|
+
fontFamily: theme.typography.fonts.mono
|
|
32
35
|
}),
|
|
33
36
|
'& code': {
|
|
34
37
|
margin: 0,
|
|
35
38
|
display: 'inline-block'
|
|
39
|
+
},
|
|
40
|
+
'& pre > code': {
|
|
41
|
+
whiteSpace: 'pre-wrap'
|
|
36
42
|
}
|
|
37
43
|
}));
|
|
38
44
|
const Type = styled.div(({
|
|
@@ -314,7 +314,7 @@ export const ArgsTable = props => {
|
|
|
314
314
|
onClick: () => resetArgs(),
|
|
315
315
|
title: "Reset controls"
|
|
316
316
|
}, /*#__PURE__*/React.createElement(Icons, {
|
|
317
|
-
icon: "
|
|
317
|
+
icon: "undo",
|
|
318
318
|
"aria-hidden": true
|
|
319
319
|
})))) : null)), /*#__PURE__*/React.createElement("tbody", {
|
|
320
320
|
className: "docblock-argstable-body"
|
|
@@ -48,9 +48,21 @@ const SwatchLabels = styled.div({
|
|
|
48
48
|
display: 'flex',
|
|
49
49
|
flexDirection: 'row'
|
|
50
50
|
});
|
|
51
|
-
const Swatch = styled.div({
|
|
52
|
-
|
|
53
|
-
})
|
|
51
|
+
const Swatch = styled.div(({
|
|
52
|
+
background
|
|
53
|
+
}) => ({
|
|
54
|
+
position: 'relative',
|
|
55
|
+
flex: 1,
|
|
56
|
+
'&::before': {
|
|
57
|
+
position: 'absolute',
|
|
58
|
+
top: 0,
|
|
59
|
+
left: 0,
|
|
60
|
+
width: '100%',
|
|
61
|
+
height: '100%',
|
|
62
|
+
background,
|
|
63
|
+
content: '""'
|
|
64
|
+
}
|
|
65
|
+
}));
|
|
54
66
|
const SwatchColors = styled.div(({
|
|
55
67
|
theme
|
|
56
68
|
}) => Object.assign({}, getBlockBackgroundStyle(theme), {
|
|
@@ -58,7 +70,10 @@ const SwatchColors = styled.div(({
|
|
|
58
70
|
flexDirection: 'row',
|
|
59
71
|
height: 50,
|
|
60
72
|
marginBottom: 5,
|
|
61
|
-
overflow: 'hidden'
|
|
73
|
+
overflow: 'hidden',
|
|
74
|
+
backgroundColor: 'white',
|
|
75
|
+
backgroundImage: `repeating-linear-gradient(-45deg, #ccc, #ccc 1px, #fff 1px, #fff 16px)`,
|
|
76
|
+
backgroundClip: 'padding-box'
|
|
62
77
|
}));
|
|
63
78
|
const SwatchSpecimen = styled.div({
|
|
64
79
|
display: 'flex',
|
|
@@ -105,9 +120,7 @@ function renderSwatch(color, index) {
|
|
|
105
120
|
return /*#__PURE__*/React.createElement(Swatch, {
|
|
106
121
|
key: `${color}-${index}`,
|
|
107
122
|
title: color,
|
|
108
|
-
|
|
109
|
-
background: color
|
|
110
|
-
}
|
|
123
|
+
background: color
|
|
111
124
|
});
|
|
112
125
|
}
|
|
113
126
|
|
|
@@ -4,9 +4,10 @@ import "core-js/modules/es.array.reduce.js";
|
|
|
4
4
|
|
|
5
5
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
6
6
|
|
|
7
|
-
import React, { Children, useState } from 'react';
|
|
7
|
+
import React, { Children, useCallback, useState } from 'react';
|
|
8
8
|
import { darken } from 'polished';
|
|
9
9
|
import { styled } from '@storybook/theming';
|
|
10
|
+
import global from 'global';
|
|
10
11
|
import { getBlockBackgroundStyle } from './BlockBackgroundStyles';
|
|
11
12
|
import { Source } from './Source';
|
|
12
13
|
import { ActionBar } from '../ActionBar/ActionBar';
|
|
@@ -119,7 +120,9 @@ const getSource = (withSource, expanded, setExpanded) => {
|
|
|
119
120
|
default:
|
|
120
121
|
{
|
|
121
122
|
return {
|
|
122
|
-
source:
|
|
123
|
+
source: /*#__PURE__*/React.createElement(StyledSource, _extends({}, withSource, {
|
|
124
|
+
dark: true
|
|
125
|
+
})),
|
|
123
126
|
actionItem: {
|
|
124
127
|
title: 'Show code',
|
|
125
128
|
className: 'docblock-code-toggle',
|
|
@@ -195,9 +198,34 @@ const Preview = (_ref) => {
|
|
|
195
198
|
const [scale, setScale] = useState(1);
|
|
196
199
|
const previewClasses = [className].concat(['sbdocs', 'sbdocs-preview']);
|
|
197
200
|
const defaultActionItems = withSource ? [actionItem] : [];
|
|
198
|
-
const
|
|
201
|
+
const [additionalActionItems, setAdditionalActionItems] = useState(additionalActions ? [...additionalActions] : []);
|
|
202
|
+
const actionItems = [...defaultActionItems, ...additionalActionItems]; // @ts-ignore
|
|
199
203
|
|
|
200
204
|
const layout = getLayout(Children.count(children) === 1 ? [children] : children);
|
|
205
|
+
const {
|
|
206
|
+
window: globalWindow
|
|
207
|
+
} = global;
|
|
208
|
+
const copyToClipboard = useCallback(async text => {
|
|
209
|
+
const {
|
|
210
|
+
createCopyToClipboardFunction
|
|
211
|
+
} = await import('../syntaxhighlighter/syntaxhighlighter');
|
|
212
|
+
createCopyToClipboardFunction();
|
|
213
|
+
}, []);
|
|
214
|
+
|
|
215
|
+
const onCopyCapture = e => {
|
|
216
|
+
e.preventDefault();
|
|
217
|
+
|
|
218
|
+
if (additionalActionItems.filter(item => item.title === 'Copied').length === 0) {
|
|
219
|
+
copyToClipboard(source.props.code).then(() => {
|
|
220
|
+
setAdditionalActionItems([...additionalActionItems, {
|
|
221
|
+
title: 'Copied',
|
|
222
|
+
onClick: () => {}
|
|
223
|
+
}]);
|
|
224
|
+
globalWindow.setTimeout(() => setAdditionalActionItems(additionalActionItems.filter(item => item.title !== 'Copied')), 1500);
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
|
|
201
229
|
return /*#__PURE__*/React.createElement(PreviewContainer, _extends({
|
|
202
230
|
withSource,
|
|
203
231
|
withToolbar
|
|
@@ -214,7 +242,8 @@ const Preview = (_ref) => {
|
|
|
214
242
|
scale
|
|
215
243
|
}
|
|
216
244
|
}, /*#__PURE__*/React.createElement(Relative, {
|
|
217
|
-
className: "docs-story"
|
|
245
|
+
className: "docs-story",
|
|
246
|
+
onCopyCapture: withSource && onCopyCapture
|
|
218
247
|
}, /*#__PURE__*/React.createElement(ChildrenContainer, {
|
|
219
248
|
isColumn: isColumn || !Array.isArray(children),
|
|
220
249
|
columns: columns,
|
|
@@ -226,7 +255,7 @@ const Preview = (_ref) => {
|
|
|
226
255
|
key: i
|
|
227
256
|
}, child)) : /*#__PURE__*/React.createElement("div", null, children))), /*#__PURE__*/React.createElement(ActionBar, {
|
|
228
257
|
actionItems: actionItems
|
|
229
|
-
}))), withSource && source);
|
|
258
|
+
}))), withSource && expanded && source);
|
|
230
259
|
};
|
|
231
260
|
|
|
232
261
|
Preview.displayName = "Preview";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useCallback } from 'react';
|
|
2
2
|
import { opacify, transparentize } from 'polished';
|
|
3
3
|
import { styled } from '@storybook/theming';
|
|
4
|
-
import { getControlId } from './helpers';
|
|
4
|
+
import { getControlId, getControlSetterButtonId } from './helpers';
|
|
5
5
|
import { Form } from '../form';
|
|
6
6
|
const Label = styled.label(({
|
|
7
7
|
theme
|
|
@@ -61,7 +61,7 @@ const Label = styled.label(({
|
|
|
61
61
|
}
|
|
62
62
|
},
|
|
63
63
|
'input:checked ~ span:last-of-type, input:not(:checked) ~ span:first-of-type': {
|
|
64
|
-
background: theme.background.
|
|
64
|
+
background: theme.background.app,
|
|
65
65
|
boxShadow: `${opacify(0.1, theme.appBorderColor)} 0 0 2px`,
|
|
66
66
|
color: theme.color.defaultText,
|
|
67
67
|
padding: '7px 15px'
|
|
@@ -83,6 +83,7 @@ export const BooleanControl = ({
|
|
|
83
83
|
|
|
84
84
|
if (value === undefined) {
|
|
85
85
|
return /*#__PURE__*/React.createElement(Form.Button, {
|
|
86
|
+
id: getControlSetterButtonId(name),
|
|
86
87
|
onClick: onSetFalse
|
|
87
88
|
}, "Set boolean");
|
|
88
89
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useState, useCallback, useEffect, useRef } from 'react';
|
|
2
2
|
import { styled } from '@storybook/theming';
|
|
3
3
|
import { Form } from '../form';
|
|
4
|
-
import { getControlId } from './helpers';
|
|
4
|
+
import { getControlId, getControlSetterButtonId } from './helpers';
|
|
5
5
|
const Wrapper = styled.label({
|
|
6
6
|
display: 'flex'
|
|
7
7
|
});
|
|
@@ -46,6 +46,7 @@ export const NumberControl = ({
|
|
|
46
46
|
|
|
47
47
|
if (!forceVisible && value === undefined) {
|
|
48
48
|
return /*#__PURE__*/React.createElement(Form.Button, {
|
|
49
|
+
id: getControlSetterButtonId(name),
|
|
49
50
|
onClick: onForceVisible
|
|
50
51
|
}, "Set number");
|
|
51
52
|
}
|
|
@@ -4,7 +4,7 @@ import React, { useCallback, useMemo, useState, useEffect, useRef } from 'react'
|
|
|
4
4
|
import { styled, useTheme } from '@storybook/theming'; // @ts-ignore
|
|
5
5
|
|
|
6
6
|
import { JsonTree, getObjectType } from './react-editable-json-tree';
|
|
7
|
-
import { getControlId } from './helpers';
|
|
7
|
+
import { getControlId, getControlSetterButtonId } from './helpers';
|
|
8
8
|
import { Form } from '../form';
|
|
9
9
|
import { Icons } from '../icon/icon';
|
|
10
10
|
import { IconButton } from '../bar/button';
|
|
@@ -266,6 +266,7 @@ export const ObjectControl = ({
|
|
|
266
266
|
|
|
267
267
|
if (!hasData) {
|
|
268
268
|
return /*#__PURE__*/React.createElement(Form.Button, {
|
|
269
|
+
id: getControlSetterButtonId(name),
|
|
269
270
|
onClick: onForceVisible
|
|
270
271
|
}, "Set object");
|
|
271
272
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useCallback, useState } from 'react';
|
|
2
2
|
import { styled } from '@storybook/theming';
|
|
3
3
|
import { Form } from '../form';
|
|
4
|
-
import { getControlId } from './helpers';
|
|
4
|
+
import { getControlId, getControlSetterButtonId } from './helpers';
|
|
5
5
|
const Wrapper = styled.label({
|
|
6
6
|
display: 'flex'
|
|
7
7
|
});
|
|
@@ -24,6 +24,7 @@ export const TextControl = ({
|
|
|
24
24
|
|
|
25
25
|
if (value === undefined) {
|
|
26
26
|
return /*#__PURE__*/React.createElement(Form.Button, {
|
|
27
|
+
id: getControlSetterButtonId(name),
|
|
27
28
|
onClick: onForceVisible
|
|
28
29
|
}, "Set string");
|
|
29
30
|
}
|
|
@@ -4,4 +4,12 @@
|
|
|
4
4
|
* @link http://xahlee.info/js/html_allowed_chars_in_attribute.html
|
|
5
5
|
* @example getControlId('my prop name') -> 'control-my-prop-name'
|
|
6
6
|
*/
|
|
7
|
-
export const getControlId = value => `control-${value.replace(/\s+/g, '-')}`;
|
|
7
|
+
export const getControlId = value => `control-${value.replace(/\s+/g, '-')}`;
|
|
8
|
+
/**
|
|
9
|
+
* Adds `set` prefix to make ID attribute more specific.
|
|
10
|
+
* Removes spaces because spaces are not allowed in ID attributes
|
|
11
|
+
* @link http://xahlee.info/js/html_allowed_chars_in_attribute.html
|
|
12
|
+
* @example getControlSetterButtonId('my prop name') -> 'set-my-prop-name'
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
export const getControlSetterButtonId = value => `set-${value.replace(/\s+/g, '-')}`;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React, { Suspense } from 'react';
|
|
2
2
|
export * from './types';
|
|
3
|
-
export * from './Array';
|
|
4
3
|
export * from './Boolean';
|
|
5
4
|
const LazyColorControl = /*#__PURE__*/React.lazy(() => import('./Color'));
|
|
6
5
|
export const ColorControl = props => /*#__PURE__*/React.createElement(Suspense, {
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
-
|
|
3
1
|
import "core-js/modules/es.array.reduce.js";
|
|
4
2
|
import React from 'react';
|
|
5
3
|
import dedent from 'ts-dedent';
|
|
@@ -30,6 +28,14 @@ const normalizeOptions = (options, labels) => {
|
|
|
30
28
|
return options;
|
|
31
29
|
};
|
|
32
30
|
|
|
31
|
+
const Controls = {
|
|
32
|
+
check: CheckboxControl,
|
|
33
|
+
'inline-check': CheckboxControl,
|
|
34
|
+
radio: RadioControl,
|
|
35
|
+
'inline-radio': RadioControl,
|
|
36
|
+
select: SelectControl,
|
|
37
|
+
'multi-select': SelectControl
|
|
38
|
+
};
|
|
33
39
|
export const OptionsControl = props => {
|
|
34
40
|
const {
|
|
35
41
|
type = 'select',
|
|
@@ -38,7 +44,9 @@ export const OptionsControl = props => {
|
|
|
38
44
|
argType
|
|
39
45
|
} = props;
|
|
40
46
|
const normalized = Object.assign({}, props, {
|
|
41
|
-
options: normalizeOptions(options || argType.options, labels)
|
|
47
|
+
options: normalizeOptions(options || argType.options, labels),
|
|
48
|
+
isInline: type.includes('inline'),
|
|
49
|
+
isMulti: type.includes('multi')
|
|
42
50
|
});
|
|
43
51
|
|
|
44
52
|
if (options) {
|
|
@@ -49,26 +57,11 @@ export const OptionsControl = props => {
|
|
|
49
57
|
`);
|
|
50
58
|
}
|
|
51
59
|
|
|
52
|
-
|
|
53
|
-
case 'check':
|
|
54
|
-
case 'inline-check':
|
|
55
|
-
return /*#__PURE__*/React.createElement(CheckboxControl, _extends({}, normalized, {
|
|
56
|
-
isInline: type === 'inline-check'
|
|
57
|
-
}));
|
|
58
|
-
|
|
59
|
-
case 'radio':
|
|
60
|
-
case 'inline-radio':
|
|
61
|
-
return /*#__PURE__*/React.createElement(RadioControl, _extends({}, normalized, {
|
|
62
|
-
isInline: type === 'inline-radio'
|
|
63
|
-
}));
|
|
60
|
+
const Control = Controls[type];
|
|
64
61
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
return /*#__PURE__*/React.createElement(SelectControl, _extends({}, normalized, {
|
|
68
|
-
isMulti: type === 'multi-select'
|
|
69
|
-
}));
|
|
70
|
-
|
|
71
|
-
default:
|
|
72
|
-
throw new Error(`Unknown options type: ${type}`);
|
|
62
|
+
if (Control) {
|
|
63
|
+
return /*#__PURE__*/React.createElement(Control, normalized);
|
|
73
64
|
}
|
|
65
|
+
|
|
66
|
+
throw new Error(`Unknown options type: ${type}`);
|
|
74
67
|
};
|
|
@@ -107,7 +107,10 @@ export const icons = {
|
|
|
107
107
|
dashboard: 'M512 85.3a512 512 0 01361 875c-99.5-44-225-70.4-361.6-70.4-136.1 0-261.4 26.2-360.8 70A512 512 0 01512 85.4zm0 91.5c-112.4 0-218 43.7-297.4 123.1A417.8 417.8 0 0091.4 597.3c0 93 30 181.5 85.5 254.2 101-34.8 215.3-53 334.5-53 119.6 0 234.2 18.3 335.5 53.4a417.3 417.3 0 0085.7-254.6c0-112.3-43.8-218-123.2-297.4a417.5 417.5 0 00-275-122.6l-22.4-.5zm219.7 115.7a45.7 45.7 0 0116.7 62.4L580.4 646c6.5 17.1 6.7 36.6-.6 54.3l-4.3 8.7A73.1 73.1 0 11501.3 600l168-291a45.7 45.7 0 0162.4-16.6z',
|
|
108
108
|
hourglass: 'M511.926 801.946c-22.090 0-40-17.906-40-40v0c0-22.090 17.91-40 40-40v0c22.090 0 40.004 17.91 40.004 40v0c0 22.094-17.914 40-40.004 40v0zM831.682 915.242c0.192 1.582 0.318 3.186 0.318 4.82 0 22.090-17.908 40-40 40h-560c-22.092 0-40-17.914-40-40 0-2.438 0.252-4.812 0.67-7.128 2.36-53.636 18.034-105.7 45.852-151.554 0.734-1.476 1.562-2.912 2.492-4.296l5.582-8.364c0.054-0.080 0.11-0.158 0.164-0.238 0.042-0.068 0.098-0.156 0.144-0.222l157.704-236.036-158.5-237.228c-0.116-0.17-0.23-0.342-0.34-0.516-32.842-49.178-51.11-105.994-53.368-165.044-0.238-1.762-0.402-3.546-0.402-5.374 0-22.090 17.908-40 40-40h560c22.092 0 40 17.914 40 40 0 2.056-0.204 4.064-0.504 6.038-2.194 54.020-17.886 106.48-45.894 152.648-0.734 1.472-1.562 2.91-2.492 4.294l-5.582 8.366c-0.054 0.078-0.11 0.156-0.164 0.236-0.042 0.068-0.098 0.154-0.144 0.222l-157.734 236.082 158.468 237.182c0.116 0.168 0.23 0.344 0.34 0.516 32.946 49.33 51.226 106.346 53.39 165.596zM749.958 144.060h-475.99c6.138 31.304 18.384 61.124 36.354 87.916 0.118 0.17 0.23 0.344 0.342 0.514l0.024 0.038c0.036 0.054 0.15 0.23 0.186 0.284l54.286 81.25h293.596l58.196-87.1c0.366-0.67 0.75-1.334 1.154-1.99 15.492-24.916 26.228-52.324 31.852-80.912zM497.528 512.178l-0.032 0.046 14.426 21.592 93.378-139.756h-186.692l78.92 118.118zM305.96 799.156c-15.498 24.91-26.234 52.318-31.856 80.906h476.052c-6.138-31.304-18.384-61.122-36.354-87.918-0.118-0.168-0.23-0.344-0.342-0.512l-0.024-0.040c-0.036-0.050-0.15-0.23-0.186-0.282l-140.242-209.902-28.98 43.374c-7.166 10.72-19.21 17.162-32.11 17.162-12.896 0-24.942-6.442-32.11-17.166l-28.76-43.044-143.938 215.428c-0.36 0.674-0.744 1.338-1.15 1.994z',
|
|
109
109
|
play: 'M878.78 477.856l-591.884-341.722c-9.464-5.464-18.426-8.050-26.386-8.048-19.516 0.002-33.002 15.546-33.002 42.338v683.446c0 26.792 13.482 42.338 33.002 42.338 7.96 0 16.924-2.586 26.386-8.048l591.884-341.722c32.664-18.864 32.664-49.724 0-68.582z',
|
|
110
|
+
playnext: 'M222 136l513 342 12 10V192a64 64 0 01128 0v640a64 64 0 01-128 0V536l-12 10-513 342c-8 5-16 8-23 8-17 0-28-16-28-42V170c0-26 11-42 28-42 7 0 15 3 23 8z',
|
|
111
|
+
playback: 'M823 136L311 478l-12 10V192a64 64 0 00-128 0v640a64 64 0 10128 0V536l12 10 512 342c8 5 16 8 23 8 17 0 29-16 29-42V170c0-26-12-42-29-42-7 0-15 3-23 8z',
|
|
110
112
|
stop: 'M1024 512A512 512 0 100 512a512 512 0 001024 0zM215 809a418 418 0 010-594 418 418 0 01594 0 418 418 0 010 594 418 418 0 01-594 0zm471-78H338c-25 0-45-20-45-45V338c0-25 20-45 45-45h348c25 0 45 20 45 45v348c0 25-20 45-45 45z',
|
|
113
|
+
stopalt: 'M894 85H130c-25 0-45 20-45 45v764c0 25 20 45 45 45h764c25 0 45-20 45-45V130c0-25-20-45-45-45z',
|
|
111
114
|
email: 'M960.032 268.004c0.748-10.040-2.246-20.364-9.226-28.684-5.984-7.132-13.938-11.62-22.394-13.394-0.13-0.026-0.268-0.066-0.396-0.092-1.082-0.22-2.172-0.376-3.272-0.5-0.25-0.032-0.492-0.080-0.742-0.102-1.028-0.096-2.052-0.136-3.090-0.156-0.292-0.002-0.582-0.042-0.876-0.042h-816.008c-21.416 0-38.848 16.844-39.898 38-0.034 0.628-0.092 1.256-0.096 1.89 0 0.034-0.006 0.074-0.006 0.114 0 0.050 0.008 0.102 0.008 0.152v495.692c0 0.054-0.008 0.106-0.008 0.156 0 22.090 17.91 40 40 40h816.004c13.808 0 25.98-6.996 33.17-17.636 0.1-0.148 0.182-0.312 0.28-0.458 0.606-0.93 1.196-1.868 1.722-2.84 0.046-0.082 0.080-0.172 0.124-0.258 2.992-5.604 4.704-12.008 4.704-18.804v0 0-493.038zM144.032 350.156l339.946 281.188c6.568 6.434 14.918 10.168 23.564 11.122 0.16 0.024 0.32 0.050 0.48 0.066 0.838 0.082 1.676 0.114 2.518 0.14 0.496 0.020 0.994 0.058 1.492 0.058s0.996-0.042 1.492-0.058c0.842-0.028 1.68-0.058 2.518-0.14 0.16-0.016 0.32-0.042 0.48-0.066 8.646-0.958 16.996-4.688 23.564-11.122l339.946-281.206v370.894h-736v-370.876zM215.066 305.030h593.91l-296.946 245.422-296.964-245.422z',
|
|
112
115
|
link: 'M743.52 529.234c5.616-5.616 83.048-83.046 88.462-88.46 30.944-32.778 47.97-75.636 47.97-120.792 0-47.048-18.304-91.26-51.542-124.484-33.228-33.22-77.43-51.516-124.458-51.516-45.024 0-87.792 16.94-120.536 47.72l-104.458 104.456c-30.792 32.738-47.734 75.512-47.734 120.548 0 41.916 14.576 81.544 41.248 113.196 3.264 3.876 6.666 7.664 10.292 11.29 4.258 4.258 8.704 8.262 13.304 12.022 0.054 0.080 0.096 0.152 0.148 0.232 9.572 7.308 15.778 18.804 15.778 31.776 0 22.094-17.914 40-40.004 40-8.542 0-16.442-2.696-22.938-7.26-2.746-1.93-20.622-17.43-30.35-28.050-0.008-0.010-0.018-0.018-0.026-0.028-4.992-5.432-13.234-15.23-18.552-22.65s-16.556-25.872-17.036-26.736c-0.7-1.262-2.974-5.526-3.422-6.39-0.69-1.334-6.118-12.67-6.114-12.67-14.342-31.96-22.332-67.4-22.332-104.728 0-60.826 21.198-116.648 56.58-160.544 0.252-0.314 4.61-5.594 6.594-7.866 0.304-0.35 5.038-5.636 7.16-7.874 0.252-0.268 105.86-105.874 106.128-106.126 45.902-43.584 107.958-70.314 176.264-70.314 141.382 0 255.998 114.5 255.998 256 0 68.516-26.882 130.688-70.652 176.61-0.144 0.148-109.854 109.546-112.090 111.528-0.958 0.848-5.072 4.352-5.072 4.352-6.448 5.434-13.132 10.592-20.1 15.378 0.412-6.836 0.644-13.702 0.644-20.6 0-26.46-3.108-52.206-8.918-76.918l-0.236-1.102zM616.144 767.82c35.382-43.896 56.58-99.718 56.58-160.544 0-37.328-7.99-72.768-22.332-104.728 0.004 0 0.006-0.002 0.010-0.004-0.258-0.576-0.538-1.14-0.8-1.714-0.686-1.498-2.894-6.112-3.296-6.93-0.668-1.344-2.952-5.732-3.386-6.604-3.48-6.982-8.708-15.126-9.49-16.366-0.498-0.792-0.996-1.58-1.502-2.364-0.834-1.29-15.364-22.066-26.656-34.466-0.008-0.010-0.018-0.018-0.026-0.028-7.056-8.448-24.932-24.198-30.35-28.050-6.47-4.602-14.396-7.26-22.938-7.26-22.090 0-40.004 17.906-40.004 40 0 12.97 6.206 24.466 15.778 31.776 0.052 0.080 0.094 0.152 0.148 0.232 4.602 3.76 20.334 19.434 23.598 23.31 26.672 31.65 41.248 71.28 41.248 113.196 0 45.038-16.944 87.81-47.734 120.548l-104.458 104.456c-32.742 30.782-75.512 47.72-120.536 47.72-47.028 0-91.228-18.294-124.458-51.516-33.236-33.224-51.542-77.436-51.542-124.484 0-45.154 17.028-88.014 47.97-120.792 5.414-5.414 40.812-40.812 68.958-68.958 7.176-7.176 13.888-13.886 19.504-19.502v-0.002c-0.356-1.562-0.246-1.096-0.246-1.096-5.81-24.712-8.918-50.458-8.918-76.918 0-6.898 0.232-13.764 0.644-20.6-6.966 4.788-20.1 15.33-20.1 15.33-0.734 0.62-9.518 8.388-11.68 10.45-0.16 0.154-105.338 105.33-105.482 105.478-43.77 45.922-70.652 108.094-70.652 176.61 0 141.5 114.616 256 255.998 256 68.306 0 130.362-26.73 176.264-70.314 0.27-0.254 105.876-105.86 106.128-106.126 0.004-0.002 13.506-15.426 13.758-15.74z',
|
|
113
116
|
paperclip: 'M824.25 369.354c68.146-70.452 67.478-182.784-2.094-252.354-70.296-70.296-184.266-70.296-254.558 0-0.014 0.012-0.028 0.026-0.042 0.042-0.004 0.002-0.006 0.004-0.010 0.008l-433.144 433.142c-0.036 0.036-0.074 0.068-0.11 0.106-0.054 0.052-0.106 0.11-0.16 0.162l-2.668 2.67c-0.286 0.286-0.528 0.596-0.8 0.888-43.028 44.88-66.664 103.616-66.664 165.986 0 64.106 24.962 124.376 70.292 169.704 45.328 45.33 105.598 70.292 169.706 70.292 50.612 0 98.822-15.57 139.186-44.428 4.932-1.952 9.556-4.906 13.544-8.894l16.802-16.802c0.056-0.056 0.116-0.112 0.172-0.168 0.038-0.038 0.074-0.076 0.112-0.116l289.010-289.014c15.622-15.618 15.62-40.942 0-56.56s-40.948-15.62-56.566 0l-289.124 289.122c-62.482 62.484-163.792 62.484-226.274 0-62.484-62.482-62.484-163.79 0-226.272h-0.002l433.134-433.12c0.058-0.060 0.112-0.122 0.172-0.18 38.99-38.99 102.43-38.99 141.42 0 38.992 38.99 38.99 102.432 0 141.422-0.058 0.060-0.122 0.114-0.18 0.17l0.006 0.006-280.536 280.534c-0.002-0.002-0.002-0.004-0.004-0.006l-79.978 79.98c-0.010 0.010-0.016 0.020-0.028 0.028-0.008 0.012-0.018 0.018-0.028 0.028l-0.064 0.062c-15.622 15.624-40.944 15.624-56.562 0-15.624-15.62-15.624-40.944-0.002-56.566l0.062-0.062c0.010-0.010 0.018-0.020 0.028-0.028 0.008-0.012 0.020-0.018 0.028-0.028l79.98-79.978c-0.002-0.002-0.004-0.002-0.006-0.004l136.508-136.512c15.622-15.62 15.62-40.944-0.002-56.562-15.618-15.62-40.946-15.62-56.564 0l-219.342 219.344c-1.284 1.284-2.42 2.652-3.494 4.052-40.4 47.148-38.316 118.184 6.322 162.824 44.64 44.638 115.674 46.722 162.82 6.324 1.402-1.072 2.772-2.21 4.054-3.494l2.83-2.832c0.002 0 0.002 0 0.002 0s0 0 0 0l360.54-360.54c0.058-0.056 0.12-0.114 0.18-0.172 0.050-0.050 0.098-0.106 0.15-0.158l0.994-0.994c0.34-0.338 0.63-0.702 0.952-1.052z',
|
package/dist/modern/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createElement } from 'react';
|
|
1
|
+
import { createElement, forwardRef } from 'react';
|
|
2
2
|
import { components as rawComponents } from './typography/DocumentFormatting';
|
|
3
3
|
export { Badge } from './Badge/Badge'; // Typography
|
|
4
4
|
|
|
@@ -38,6 +38,8 @@ export * from './typography/DocumentFormatting';
|
|
|
38
38
|
export { rawComponents as components };
|
|
39
39
|
const resetComponents = {};
|
|
40
40
|
Object.keys(rawComponents).forEach(key => {
|
|
41
|
-
resetComponents[key] = props => /*#__PURE__*/createElement(key, props
|
|
41
|
+
resetComponents[key] = /*#__PURE__*/forwardRef((props, ref) => /*#__PURE__*/createElement(key, Object.assign({}, props, {
|
|
42
|
+
ref
|
|
43
|
+
})));
|
|
42
44
|
});
|
|
43
45
|
export { resetComponents };
|
|
@@ -54,12 +54,13 @@ ReactSyntaxHighlighter.registerLanguage('graphql', graphql);
|
|
|
54
54
|
const themedSyntax = memoize(2)(theme => Object.entries(theme.code || {}).reduce((acc, [key, val]) => Object.assign({}, acc, {
|
|
55
55
|
[`* .${key}`]: val
|
|
56
56
|
}), {}));
|
|
57
|
-
|
|
57
|
+
const copyToClipboard = createCopyToClipboardFunction();
|
|
58
|
+
export function createCopyToClipboardFunction() {
|
|
59
|
+
if (navigator !== null && navigator !== void 0 && navigator.clipboard) {
|
|
60
|
+
return text => navigator.clipboard.writeText(text);
|
|
61
|
+
}
|
|
58
62
|
|
|
59
|
-
|
|
60
|
-
copyToClipboard = text => navigator.clipboard.writeText(text);
|
|
61
|
-
} else {
|
|
62
|
-
copyToClipboard = async text => {
|
|
63
|
+
return async text => {
|
|
63
64
|
const tmp = document.createElement('TEXTAREA');
|
|
64
65
|
const focus = document.activeElement;
|
|
65
66
|
tmp.value = text;
|
|
@@ -70,7 +71,6 @@ if (navigator !== null && navigator !== void 0 && navigator.clipboard) {
|
|
|
70
71
|
focus.focus();
|
|
71
72
|
};
|
|
72
73
|
}
|
|
73
|
-
|
|
74
74
|
const Wrapper = styled.div(({
|
|
75
75
|
theme
|
|
76
76
|
}) => ({
|
|
@@ -139,7 +139,9 @@ export const SyntaxHighlighter = (_ref) => {
|
|
|
139
139
|
|
|
140
140
|
const onClick = e => {
|
|
141
141
|
e.preventDefault();
|
|
142
|
-
|
|
142
|
+
const selectedText = globalWindow.getSelection().toString();
|
|
143
|
+
const textToCopy = e.type !== 'click' && selectedText ? selectedText : highlightableCode;
|
|
144
|
+
copyToClipboard(textToCopy).then(() => {
|
|
143
145
|
setCopied(true);
|
|
144
146
|
globalWindow.setTimeout(() => setCopied(false), 1500);
|
|
145
147
|
}).catch(logger.error);
|
|
@@ -148,7 +150,8 @@ export const SyntaxHighlighter = (_ref) => {
|
|
|
148
150
|
return /*#__PURE__*/React.createElement(Wrapper, {
|
|
149
151
|
bordered: bordered,
|
|
150
152
|
padded: padded,
|
|
151
|
-
className: className
|
|
153
|
+
className: className,
|
|
154
|
+
onCopyCapture: onClick
|
|
152
155
|
}, /*#__PURE__*/React.createElement(Scroller, null, /*#__PURE__*/React.createElement(ReactSyntaxHighlighter, _extends({
|
|
153
156
|
padded: padded || bordered,
|
|
154
157
|
language: language,
|
|
@@ -11,6 +11,7 @@ export interface ButtonProps {
|
|
|
11
11
|
outline?: boolean;
|
|
12
12
|
containsIcon?: boolean;
|
|
13
13
|
children?: React.ReactNode;
|
|
14
|
+
href?: string;
|
|
14
15
|
}
|
|
15
16
|
declare const ButtonWrapper: import("@emotion/styled-base").StyledComponent<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, ButtonProps, import("@storybook/theming").Theme>;
|
|
16
17
|
export declare const Button: FunctionComponent<ComponentProps<typeof ButtonWrapper>>;
|
|
@@ -5,3 +5,10 @@
|
|
|
5
5
|
* @example getControlId('my prop name') -> 'control-my-prop-name'
|
|
6
6
|
*/
|
|
7
7
|
export declare const getControlId: (value: string) => string;
|
|
8
|
+
/**
|
|
9
|
+
* Adds `set` prefix to make ID attribute more specific.
|
|
10
|
+
* Removes spaces because spaces are not allowed in ID attributes
|
|
11
|
+
* @link http://xahlee.info/js/html_allowed_chars_in_attribute.html
|
|
12
|
+
* @example getControlSetterButtonId('my prop name') -> 'set-my-prop-name'
|
|
13
|
+
*/
|
|
14
|
+
export declare const getControlSetterButtonId: (value: string) => string;
|