@storybook/components 6.5.9 → 7.0.0-alpha.2
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/Color-IIYOK4US.mjs +1 -0
- package/dist/GlobalScrollAreaStyles-5MYDB36S.mjs +1 -0
- package/dist/OverlayScrollbars-GXD6IR4B.mjs +6 -0
- package/dist/WithTooltip-F6U4FHOQ.mjs +9 -0
- package/dist/chunk-7IK3EOFL.mjs +1 -0
- package/dist/chunk-AZCVBZVA.mjs +149 -0
- package/dist/chunk-DF422II4.mjs +6 -0
- package/dist/chunk-EBKGXALM.mjs +1 -0
- package/dist/chunk-PJYBQ6PQ.mjs +1 -0
- package/dist/chunk-WYLOY4EF.mjs +5 -0
- package/dist/chunk-XFBIFQ3K.mjs +73 -0
- package/dist/chunk-XZM6YCLI.mjs +1 -0
- package/dist/formatter-7QCQCGUB.mjs +184 -0
- package/dist/html.d.ts +6 -0
- package/dist/html.js +352 -0
- package/dist/html.mjs +5 -0
- package/dist/index.d.ts +1144 -0
- package/dist/index.js +432 -0
- package/dist/index.mjs +1 -0
- package/dist/syntaxhighlighter-XYTTX7GN.mjs +7 -0
- package/html.d.ts +1 -1
- package/html.js +1 -2
- package/package.json +31 -19
- package/dist/cjs/Color-a62ba7e9.js +0 -2461
- package/dist/cjs/GlobalScrollAreaStyles-ff4bd929.js +0 -463
- package/dist/cjs/OverlayScrollbars-c574dc71.js +0 -6622
- package/dist/cjs/WithTooltip-f49e8812.js +0 -3170
- package/dist/cjs/formatter-e9350ac6.js +0 -128
- package/dist/cjs/index-967d55af.js +0 -2047
- package/dist/cjs/index.js +0 -133
- package/dist/cjs/syntaxhighlighter-9522fde9.js +0 -215
- package/dist/esm/Color-3c22bb81.js +0 -2576
- package/dist/esm/GlobalScrollAreaStyles-8793ce4a.js +0 -461
- package/dist/esm/OverlayScrollbars-26c4a78d.js +0 -6710
- package/dist/esm/WithTooltip-508b8277.js +0 -3195
- package/dist/esm/formatter-9dc562d4.js +0 -128
- package/dist/esm/index-b45716e8.js +0 -1990
- package/dist/esm/index.js +0 -7
- package/dist/esm/syntaxhighlighter-82dea71a.js +0 -230
- package/dist/modern/Color-f9ce6f57.js +0 -2444
- package/dist/modern/GlobalScrollAreaStyles-8793ce4a.js +0 -450
- package/dist/modern/OverlayScrollbars-119b80c2.js +0 -6604
- package/dist/modern/WithTooltip-040f3a83.js +0 -3126
- package/dist/modern/formatter-12a1a8d1.js +0 -128
- package/dist/modern/index-9ef3b84b.js +0 -2047
- package/dist/modern/index.js +0 -7
- package/dist/modern/syntaxhighlighter-5c1fdb3d.js +0 -158
- package/dist/ts-tmp/index.d.ts +0 -928
- package/dist/ts3.4/_modules/@popperjs-core-index.d.ts +0 -1
- package/dist/ts3.4/_modules/@popperjs-core-lib-createPopper.d.ts +0 -9
- package/dist/ts3.4/_modules/@popperjs-core-lib-enums.d.ts +0 -34
- package/dist/ts3.4/_modules/@popperjs-core-lib-index.d.ts +0 -6
- package/dist/ts3.4/_modules/@popperjs-core-lib-modifiers-applyStyles.d.ts +0 -4
- package/dist/ts3.4/_modules/@popperjs-core-lib-modifiers-arrow.d.ts +0 -13
- package/dist/ts3.4/_modules/@popperjs-core-lib-modifiers-computeStyles.d.ts +0 -38
- package/dist/ts3.4/_modules/@popperjs-core-lib-modifiers-eventListeners.d.ts +0 -8
- package/dist/ts3.4/_modules/@popperjs-core-lib-modifiers-flip.d.ts +0 -16
- package/dist/ts3.4/_modules/@popperjs-core-lib-modifiers-hide.d.ts +0 -4
- package/dist/ts3.4/_modules/@popperjs-core-lib-modifiers-index.d.ts +0 -9
- package/dist/ts3.4/_modules/@popperjs-core-lib-modifiers-offset.d.ts +0 -24
- package/dist/ts3.4/_modules/@popperjs-core-lib-modifiers-popperOffsets.d.ts +0 -4
- package/dist/ts3.4/_modules/@popperjs-core-lib-modifiers-preventOverflow.d.ts +0 -30
- package/dist/ts3.4/_modules/@popperjs-core-lib-popper-lite.d.ts +0 -5
- package/dist/ts3.4/_modules/@popperjs-core-lib-popper.d.ts +0 -7
- package/dist/ts3.4/_modules/@popperjs-core-lib-types.d.ts +0 -167
- package/dist/ts3.4/_modules/@popperjs-core-lib-utils-detectOverflow.d.ts +0 -11
- package/dist/ts3.4/_modules/@types-prettier-index.d.ts +0 -641
- package/dist/ts3.4/_modules/react-textarea-autosize-dist-declarations-src-index.d.ts +0 -17
- package/dist/ts3.4/_modules/react-textarea-autosize-dist-react-textarea-autosize.cjs.d.ts +0 -2
- package/dist/ts3.4/index.d.ts +0 -926
- package/dist/ts3.9/_modules/@popperjs-core-index.d.ts +0 -1
- package/dist/ts3.9/_modules/@popperjs-core-lib-createPopper.d.ts +0 -9
- package/dist/ts3.9/_modules/@popperjs-core-lib-enums.d.ts +0 -34
- package/dist/ts3.9/_modules/@popperjs-core-lib-index.d.ts +0 -6
- package/dist/ts3.9/_modules/@popperjs-core-lib-modifiers-applyStyles.d.ts +0 -4
- package/dist/ts3.9/_modules/@popperjs-core-lib-modifiers-arrow.d.ts +0 -13
- package/dist/ts3.9/_modules/@popperjs-core-lib-modifiers-computeStyles.d.ts +0 -38
- package/dist/ts3.9/_modules/@popperjs-core-lib-modifiers-eventListeners.d.ts +0 -8
- package/dist/ts3.9/_modules/@popperjs-core-lib-modifiers-flip.d.ts +0 -16
- package/dist/ts3.9/_modules/@popperjs-core-lib-modifiers-hide.d.ts +0 -4
- package/dist/ts3.9/_modules/@popperjs-core-lib-modifiers-index.d.ts +0 -9
- package/dist/ts3.9/_modules/@popperjs-core-lib-modifiers-offset.d.ts +0 -18
- package/dist/ts3.9/_modules/@popperjs-core-lib-modifiers-popperOffsets.d.ts +0 -4
- package/dist/ts3.9/_modules/@popperjs-core-lib-modifiers-preventOverflow.d.ts +0 -30
- package/dist/ts3.9/_modules/@popperjs-core-lib-popper-lite.d.ts +0 -5
- package/dist/ts3.9/_modules/@popperjs-core-lib-popper.d.ts +0 -7
- package/dist/ts3.9/_modules/@popperjs-core-lib-types.d.ts +0 -167
- package/dist/ts3.9/_modules/@popperjs-core-lib-utils-detectOverflow.d.ts +0 -11
- package/dist/ts3.9/_modules/@types-prettier-index.d.ts +0 -641
- package/dist/ts3.9/_modules/react-textarea-autosize-dist-declarations-src-index.d.ts +0 -17
- package/dist/ts3.9/_modules/react-textarea-autosize-dist-react-textarea-autosize.cjs.d.ts +0 -2
- package/dist/ts3.9/index.d.ts +0 -926
package/dist/modern/index.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import 'react';
|
|
2
|
-
export { D as A, A as ActionBar, an as AddonPanel, aE as ArgsTable, aC as ArgsTableError, a2 as Badge, al as Bar, E as Blockquote, aU as BooleanControl, a9 as Button, G as Code, aT as ColorControl, aP as ColorItem, aQ as ColorPalette, J as DL, aZ as DateControl, at as Description, H as Div, aw as DocsContent, ay as DocsPageWrapper, ax as DocsWrapper, a4 as DocumentWrapper, b5 as FilesControl, am as FlexBar, F as Form, K as H1, L as H2, M as H3, N as H4, O as H5, P as H6, Q as HR, aN as IFrame, ah as IconButton, aS as IconGallery, aR as IconItem, I as Icons, R as Img, U as LI, a3 as Link, ar as Loader, aG as NoControlsWarning, b0 as NumberControl, V as OL, b2 as ObjectControl, b1 as OptionsControl, X as P, a7 as Placeholder, Y as Pre, az as Preview, aA as PreviewSkeleton, b3 as RangeControl, S as ScrollArea, aj as Separator, aI as Source, aH as SourceError, a6 as Spaced, Z as Span, aL as Story, aK as StoryError, aM as StorySkeleton, aq as StorybookIcon, ap as StorybookLogo, aJ as StyledSyntaxHighlighter, av as Subtitle, ao as Symbols, a5 as SyntaxHighlighter, a0 as TT, af as TabBar, ai as TabButton, ag as TabWrapper, aF as TabbedArgsTable, $ as Table, aB as TableWrapper, ad as Tabs, ae as TabsState, b4 as TextControl, au as Title, ac as TooltipLinkList, ab as TooltipMessage, T as TooltipNote, aO as Typeset, a1 as UL, W as WithTooltip, aa as WithTooltipPure, a8 as Zoom, aD as argsTableLoadingData, B as components, a$ as format, aX as formatDate, aY as formatTime, as as getStoryHref, ak as interleaveSeparators, b6 as nameSpaceClassNames, a_ as parse, aV as parseDate, aW as parseTime, C as resetComponents } from './index-9ef3b84b.js';
|
|
3
|
-
import '@storybook/theming';
|
|
4
|
-
import 'memoizerific';
|
|
5
|
-
import '@storybook/csf';
|
|
6
|
-
import 'qs';
|
|
7
|
-
import '@storybook/client-logger';
|
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
import { _ as __awaiter, S as ScrollArea, a as __rest, A as ActionBar, w as window_1 } from './index-9ef3b84b.js';
|
|
2
|
-
import React__default, { useState, useCallback } from 'react';
|
|
3
|
-
import { logger } from '@storybook/client-logger';
|
|
4
|
-
import { styled } from '@storybook/theming';
|
|
5
|
-
import memoize from 'memoizerific';
|
|
6
|
-
import jsx from 'react-syntax-highlighter/dist/esm/languages/prism/jsx';
|
|
7
|
-
import bash from 'react-syntax-highlighter/dist/esm/languages/prism/bash';
|
|
8
|
-
import css from 'react-syntax-highlighter/dist/esm/languages/prism/css';
|
|
9
|
-
import jsExtras from 'react-syntax-highlighter/dist/esm/languages/prism/js-extras';
|
|
10
|
-
import json from 'react-syntax-highlighter/dist/esm/languages/prism/json';
|
|
11
|
-
import graphql from 'react-syntax-highlighter/dist/esm/languages/prism/graphql';
|
|
12
|
-
import html from 'react-syntax-highlighter/dist/esm/languages/prism/markup';
|
|
13
|
-
import md from 'react-syntax-highlighter/dist/esm/languages/prism/markdown';
|
|
14
|
-
import yml from 'react-syntax-highlighter/dist/esm/languages/prism/yaml';
|
|
15
|
-
import tsx from 'react-syntax-highlighter/dist/esm/languages/prism/tsx';
|
|
16
|
-
import typescript from 'react-syntax-highlighter/dist/esm/languages/prism/typescript';
|
|
17
|
-
import ReactSyntaxHighlighter from 'react-syntax-highlighter/dist/esm/prism-light';
|
|
18
|
-
import '@storybook/csf';
|
|
19
|
-
import 'qs';
|
|
20
|
-
const {
|
|
21
|
-
navigator,
|
|
22
|
-
document,
|
|
23
|
-
window: globalWindow
|
|
24
|
-
} = window_1;
|
|
25
|
-
ReactSyntaxHighlighter.registerLanguage('jsextra', jsExtras);
|
|
26
|
-
ReactSyntaxHighlighter.registerLanguage('jsx', jsx);
|
|
27
|
-
ReactSyntaxHighlighter.registerLanguage('json', json);
|
|
28
|
-
ReactSyntaxHighlighter.registerLanguage('yml', yml);
|
|
29
|
-
ReactSyntaxHighlighter.registerLanguage('md', md);
|
|
30
|
-
ReactSyntaxHighlighter.registerLanguage('bash', bash);
|
|
31
|
-
ReactSyntaxHighlighter.registerLanguage('css', css);
|
|
32
|
-
ReactSyntaxHighlighter.registerLanguage('html', html);
|
|
33
|
-
ReactSyntaxHighlighter.registerLanguage('tsx', tsx);
|
|
34
|
-
ReactSyntaxHighlighter.registerLanguage('typescript', typescript);
|
|
35
|
-
ReactSyntaxHighlighter.registerLanguage('graphql', graphql);
|
|
36
|
-
const themedSyntax = memoize(2)(theme => Object.entries(theme.code || {}).reduce((acc, [key, val]) => Object.assign(Object.assign({}, acc), {
|
|
37
|
-
[`* .${key}`]: val
|
|
38
|
-
}), {}));
|
|
39
|
-
const copyToClipboard = createCopyToClipboardFunction();
|
|
40
|
-
|
|
41
|
-
function createCopyToClipboardFunction() {
|
|
42
|
-
if (navigator === null || navigator === void 0 ? void 0 : navigator.clipboard) {
|
|
43
|
-
return text => navigator.clipboard.writeText(text);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return text => __awaiter(this, void 0, void 0, function* () {
|
|
47
|
-
const tmp = document.createElement('TEXTAREA');
|
|
48
|
-
const focus = document.activeElement;
|
|
49
|
-
tmp.value = text;
|
|
50
|
-
document.body.appendChild(tmp);
|
|
51
|
-
tmp.select();
|
|
52
|
-
document.execCommand('copy');
|
|
53
|
-
document.body.removeChild(tmp);
|
|
54
|
-
focus.focus();
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
const Wrapper = styled.div(({
|
|
59
|
-
theme
|
|
60
|
-
}) => ({
|
|
61
|
-
position: 'relative',
|
|
62
|
-
overflow: 'hidden',
|
|
63
|
-
color: theme.color.defaultText
|
|
64
|
-
}), ({
|
|
65
|
-
theme,
|
|
66
|
-
bordered
|
|
67
|
-
}) => bordered ? {
|
|
68
|
-
border: `1px solid ${theme.appBorderColor}`,
|
|
69
|
-
borderRadius: theme.borderRadius,
|
|
70
|
-
background: theme.background.content
|
|
71
|
-
} : {});
|
|
72
|
-
const Scroller = styled(({
|
|
73
|
-
children,
|
|
74
|
-
className
|
|
75
|
-
}) => React__default.createElement(ScrollArea, {
|
|
76
|
-
horizontal: true,
|
|
77
|
-
vertical: true,
|
|
78
|
-
className: className
|
|
79
|
-
}, children))({
|
|
80
|
-
position: 'relative'
|
|
81
|
-
}, ({
|
|
82
|
-
theme
|
|
83
|
-
}) => themedSyntax(theme));
|
|
84
|
-
const Pre = styled.pre(({
|
|
85
|
-
theme,
|
|
86
|
-
padded
|
|
87
|
-
}) => ({
|
|
88
|
-
display: 'flex',
|
|
89
|
-
justifyContent: 'flex-start',
|
|
90
|
-
margin: 0,
|
|
91
|
-
padding: padded ? theme.layoutMargin : 0
|
|
92
|
-
}));
|
|
93
|
-
/*
|
|
94
|
-
We can't use `code` since PrismJS races for it.
|
|
95
|
-
See https://github.com/storybookjs/storybook/issues/18090
|
|
96
|
-
*/
|
|
97
|
-
|
|
98
|
-
const Code = styled.div(({
|
|
99
|
-
theme
|
|
100
|
-
}) => ({
|
|
101
|
-
flex: 1,
|
|
102
|
-
paddingLeft: 2,
|
|
103
|
-
paddingRight: theme.layoutMargin,
|
|
104
|
-
opacity: 1
|
|
105
|
-
})); // copied from @types/react-syntax-highlighter/index.d.ts
|
|
106
|
-
|
|
107
|
-
const SyntaxHighlighter = _a => {
|
|
108
|
-
var {
|
|
109
|
-
children,
|
|
110
|
-
language = 'jsx',
|
|
111
|
-
copyable = false,
|
|
112
|
-
bordered = false,
|
|
113
|
-
padded = false,
|
|
114
|
-
format = true,
|
|
115
|
-
formatter = null,
|
|
116
|
-
className = null,
|
|
117
|
-
showLineNumbers = false
|
|
118
|
-
} = _a,
|
|
119
|
-
rest = __rest(_a, ["children", "language", "copyable", "bordered", "padded", "format", "formatter", "className", "showLineNumbers"]);
|
|
120
|
-
|
|
121
|
-
if (typeof children !== 'string' || !children.trim()) {
|
|
122
|
-
return null;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
const highlightableCode = formatter ? formatter(format, children) : children.trim();
|
|
126
|
-
const [copied, setCopied] = useState(false);
|
|
127
|
-
const onClick = useCallback(e => {
|
|
128
|
-
e.preventDefault();
|
|
129
|
-
const selectedText = globalWindow.getSelection().toString();
|
|
130
|
-
const textToCopy = e.type !== 'click' && selectedText ? selectedText : highlightableCode;
|
|
131
|
-
copyToClipboard(textToCopy).then(() => {
|
|
132
|
-
setCopied(true);
|
|
133
|
-
globalWindow.setTimeout(() => setCopied(false), 1500);
|
|
134
|
-
}).catch(logger.error);
|
|
135
|
-
}, []);
|
|
136
|
-
return React__default.createElement(Wrapper, {
|
|
137
|
-
bordered: bordered,
|
|
138
|
-
padded: padded,
|
|
139
|
-
className: className,
|
|
140
|
-
onCopyCapture: onClick
|
|
141
|
-
}, React__default.createElement(Scroller, null, React__default.createElement(ReactSyntaxHighlighter, Object.assign({
|
|
142
|
-
padded: padded || bordered,
|
|
143
|
-
language: language,
|
|
144
|
-
showLineNumbers: showLineNumbers,
|
|
145
|
-
showInlineLineNumbers: showLineNumbers,
|
|
146
|
-
useInlineStyles: false,
|
|
147
|
-
PreTag: Pre,
|
|
148
|
-
CodeTag: Code,
|
|
149
|
-
lineNumberContainerStyle: {}
|
|
150
|
-
}, rest), highlightableCode)), copyable ? React__default.createElement(ActionBar, {
|
|
151
|
-
actionItems: [{
|
|
152
|
-
title: copied ? 'Copied' : 'Copy',
|
|
153
|
-
onClick
|
|
154
|
-
}]
|
|
155
|
-
}) : null);
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
export { SyntaxHighlighter, createCopyToClipboardFunction, SyntaxHighlighter as default };
|