@storybook/components 6.4.0-beta.24 → 6.4.0-beta.28
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 +104 -0
- package/dist/cjs/ActionBar/ActionBar.stories.js +66 -0
- package/dist/cjs/Badge/Badge.js +97 -0
- package/dist/cjs/Badge/Badge.stories.js +19 -0
- package/dist/cjs/Button/Button.js +279 -0
- package/dist/cjs/Button/Button.stories.js +74 -0
- package/dist/cjs/Colors/SideBySide.js +25 -0
- package/dist/cjs/Colors/colorpalette.stories.mdx +125 -0
- package/dist/cjs/Loader/Loader.js +274 -0
- package/dist/cjs/Loader/Loader.stories.js +86 -0
- package/dist/cjs/ScrollArea/GlobalScrollAreaStyles.js +477 -0
- package/dist/cjs/ScrollArea/OverlayScrollbars.js +131 -0
- package/dist/cjs/ScrollArea/ScrollArea.js +98 -0
- package/dist/cjs/ScrollArea/ScrollArea.stories.js +136 -0
- package/dist/cjs/Zoom/Zoom.js +31 -0
- package/dist/cjs/Zoom/Zoom.stories.js +185 -0
- package/dist/cjs/Zoom/ZoomElement.js +96 -0
- package/dist/cjs/Zoom/ZoomIFrame.js +142 -0
- package/dist/cjs/Zoom/browserSupportsCssZoom.js +20 -0
- package/dist/cjs/addon-panel/addon-panel.js +65 -0
- package/dist/cjs/bar/bar.js +150 -0
- package/dist/cjs/bar/button.js +128 -0
- package/dist/cjs/bar/button.stories.js +61 -0
- package/dist/cjs/bar/separator.js +68 -0
- package/dist/cjs/blocks/ArgsTable/ArgControl.js +138 -0
- package/dist/cjs/blocks/ArgsTable/ArgJsDoc.js +100 -0
- package/dist/cjs/blocks/ArgsTable/ArgRow.js +139 -0
- package/dist/cjs/blocks/ArgsTable/ArgRow.stories.js +399 -0
- package/dist/cjs/blocks/ArgsTable/ArgValue.js +298 -0
- package/dist/cjs/blocks/ArgsTable/ArgsTable.js +454 -0
- package/dist/cjs/blocks/ArgsTable/ArgsTable.stories.js +212 -0
- package/dist/cjs/blocks/ArgsTable/NoControlsWarning.js +37 -0
- package/dist/cjs/blocks/ArgsTable/SectionRow.js +195 -0
- package/dist/cjs/blocks/ArgsTable/SectionRow.stories.js +59 -0
- package/dist/cjs/blocks/ArgsTable/TabbedArgsTable.js +92 -0
- package/dist/cjs/blocks/ArgsTable/TabbedArgsTable.stories.js +50 -0
- package/dist/cjs/blocks/ArgsTable/index.js +61 -0
- package/dist/cjs/blocks/ArgsTable/types.js +1 -0
- package/dist/cjs/blocks/BlockBackgroundStyles.js +17 -0
- package/dist/cjs/blocks/ColorPalette.js +234 -0
- package/dist/cjs/blocks/ColorPalette.stories.js +87 -0
- package/dist/cjs/blocks/Description.js +33 -0
- package/dist/cjs/blocks/Description.stories.js +48 -0
- package/dist/cjs/blocks/DocsPage.js +85 -0
- package/dist/cjs/blocks/DocsPage.stories.js +113 -0
- package/dist/cjs/blocks/DocsPageExampleCaption.md +92 -0
- package/dist/cjs/blocks/DocsPageExampleCaption.mdx +92 -0
- package/dist/cjs/blocks/EmptyBlock.js +45 -0
- package/dist/cjs/blocks/EmptyBlock.stories.js +25 -0
- package/dist/cjs/blocks/IFrame.js +148 -0
- package/dist/cjs/blocks/IconGallery.js +99 -0
- package/dist/cjs/blocks/IconGallery.stories.js +53 -0
- package/dist/cjs/blocks/Preview.js +416 -0
- package/dist/cjs/blocks/Preview.stories.js +338 -0
- package/dist/cjs/blocks/Source.js +94 -0
- package/dist/cjs/blocks/Source.stories.js +66 -0
- package/dist/cjs/blocks/Story.js +129 -0
- package/dist/cjs/blocks/Story.stories.js +115 -0
- package/dist/cjs/blocks/Toolbar.js +126 -0
- package/dist/cjs/blocks/Typeset.js +94 -0
- package/dist/cjs/blocks/Typeset.stories.js +61 -0
- package/dist/cjs/blocks/ZoomContext.js +13 -0
- package/dist/cjs/blocks/index.js +139 -0
- package/dist/cjs/brand/StorybookIcon.js +44 -0
- package/dist/cjs/brand/StorybookIcon.stories.js +13 -0
- package/dist/cjs/brand/StorybookLogo.js +61 -0
- package/dist/cjs/brand/StorybookLogo.stories.js +27 -0
- package/dist/cjs/controls/Boolean.js +154 -0
- package/dist/cjs/controls/Boolean.stories.js +91 -0
- package/dist/cjs/controls/Color.js +508 -0
- package/dist/cjs/controls/Color.stories.js +146 -0
- package/dist/cjs/controls/Date.js +193 -0
- package/dist/cjs/controls/Date.stories.js +85 -0
- package/dist/cjs/controls/Files.js +81 -0
- package/dist/cjs/controls/Number.js +152 -0
- package/dist/cjs/controls/Number.stories.js +91 -0
- package/dist/cjs/controls/Object.js +416 -0
- package/dist/cjs/controls/Object.stories.js +124 -0
- package/dist/cjs/controls/Range.js +224 -0
- package/dist/cjs/controls/Range.stories.js +126 -0
- package/dist/cjs/controls/Text.js +106 -0
- package/dist/cjs/controls/Text.stories.js +91 -0
- package/dist/cjs/controls/helpers.js +35 -0
- package/dist/cjs/controls/index.js +182 -0
- package/dist/cjs/controls/options/Checkbox.js +167 -0
- package/dist/cjs/controls/options/Options.js +92 -0
- package/dist/cjs/controls/options/Options.stories.js +214 -0
- package/dist/cjs/controls/options/Radio.js +102 -0
- package/dist/cjs/controls/options/Select.js +173 -0
- package/dist/cjs/controls/options/helpers.js +81 -0
- package/dist/cjs/controls/options/index.js +22 -0
- package/dist/cjs/controls/react-editable-json-tree/LICENSE.md +14 -0
- package/dist/cjs/controls/react-editable-json-tree/components/JsonAddValue.js +228 -0
- package/dist/cjs/controls/react-editable-json-tree/components/JsonArray.js +507 -0
- package/dist/cjs/controls/react-editable-json-tree/components/JsonFunctionValue.js +321 -0
- package/dist/cjs/controls/react-editable-json-tree/components/JsonNode.js +422 -0
- package/dist/cjs/controls/react-editable-json-tree/components/JsonObject.js +509 -0
- package/dist/cjs/controls/react-editable-json-tree/components/JsonValue.js +312 -0
- package/dist/cjs/controls/react-editable-json-tree/index.js +331 -0
- package/dist/cjs/controls/react-editable-json-tree/types/dataTypes.js +31 -0
- package/dist/cjs/controls/react-editable-json-tree/types/deltaTypes.js +12 -0
- package/dist/cjs/controls/react-editable-json-tree/types/inputUsageTypes.js +13 -0
- package/dist/cjs/controls/react-editable-json-tree/utils/objectTypes.js +51 -0
- package/dist/cjs/controls/react-editable-json-tree/utils/parse.js +29 -0
- package/dist/cjs/controls/react-editable-json-tree/utils/styles.js +68 -0
- package/dist/cjs/controls/types.js +1 -0
- package/dist/cjs/form/field/field.js +62 -0
- package/dist/cjs/form/form.stories.js +223 -0
- package/dist/cjs/form/index.js +27 -0
- package/dist/cjs/form/input/input.js +267 -0
- package/dist/cjs/html.js +58 -0
- package/dist/cjs/icon/icon.js +74 -0
- package/dist/cjs/icon/icon.stories.js +76 -0
- package/dist/cjs/icon/icons.js +182 -0
- package/dist/cjs/icon/svg.js +24 -0
- package/dist/cjs/index.js +355 -0
- package/dist/cjs/placeholder/placeholder.js +94 -0
- package/dist/cjs/placeholder/placeholder.stories.js +64 -0
- package/dist/cjs/shared/animation.js +19 -0
- package/dist/cjs/spaced/Spaced.js +101 -0
- package/dist/cjs/spaced/Spaced.stories.js +73 -0
- package/dist/cjs/syntaxhighlighter/formatter.js +17 -0
- package/dist/cjs/syntaxhighlighter/lazy-syntaxhighlighter.js +49 -0
- package/dist/cjs/syntaxhighlighter/syntaxhighlighter-types.js +1 -0
- package/dist/cjs/syntaxhighlighter/syntaxhighlighter.js +315 -0
- package/dist/cjs/syntaxhighlighter/syntaxhighlighter.stories.js +112 -0
- package/dist/cjs/tabs/tabs.js +315 -0
- package/dist/cjs/tabs/tabs.stories.js +308 -0
- package/dist/cjs/tooltip/ListItem.js +224 -0
- package/dist/cjs/tooltip/ListItem.stories.js +95 -0
- package/dist/cjs/tooltip/Tooltip.js +143 -0
- package/dist/cjs/tooltip/Tooltip.stories.js +52 -0
- package/dist/cjs/tooltip/TooltipLinkList.js +107 -0
- package/dist/cjs/tooltip/TooltipLinkList.stories.js +100 -0
- package/dist/cjs/tooltip/TooltipMessage.js +85 -0
- package/dist/cjs/tooltip/TooltipMessage.stories.js +54 -0
- package/dist/cjs/tooltip/TooltipNote.js +50 -0
- package/dist/cjs/tooltip/TooltipNote.stories.js +29 -0
- package/dist/cjs/tooltip/WithTooltip.js +229 -0
- package/dist/cjs/tooltip/WithTooltip.stories.js +95 -0
- package/dist/cjs/tooltip/lazy-WithTooltip.js +72 -0
- package/dist/cjs/typings.d.js +1 -0
- package/dist/cjs/typography/DocumentFormatting.js +577 -0
- package/dist/cjs/typography/DocumentFormattingSample.md +141 -0
- package/dist/cjs/typography/DocumentWrapper.js +298 -0
- package/dist/cjs/typography/DocumentWrapper.stories.js +89 -0
- package/dist/cjs/typography/link/link.js +207 -0
- package/dist/cjs/typography/link/link.stories.js +71 -0
- package/dist/cjs/typography/shared.js +67 -0
- package/dist/cjs/typography/typography.stories.mdx +75 -0
- package/dist/esm/ActionBar/ActionBar.js +83 -0
- package/dist/esm/ActionBar/ActionBar.stories.js +47 -0
- package/dist/esm/Badge/Badge.js +81 -0
- package/dist/esm/Badge/Badge.stories.js +12 -0
- package/dist/esm/Button/Button.js +239 -0
- package/dist/esm/Button/Button.stories.js +65 -0
- package/dist/esm/Colors/SideBySide.js +15 -0
- package/dist/esm/Colors/colorpalette.stories.mdx +125 -0
- package/dist/esm/Loader/Loader.js +223 -0
- package/dist/esm/Loader/Loader.stories.js +63 -0
- package/dist/esm/ScrollArea/GlobalScrollAreaStyles.js +461 -0
- package/dist/esm/ScrollArea/OverlayScrollbars.js +102 -0
- package/dist/esm/ScrollArea/ScrollArea.js +58 -0
- package/dist/esm/ScrollArea/ScrollArea.stories.js +88 -0
- package/dist/esm/Zoom/Zoom.js +15 -0
- package/dist/esm/Zoom/Zoom.stories.js +149 -0
- package/dist/esm/Zoom/ZoomElement.js +64 -0
- package/dist/esm/Zoom/ZoomIFrame.js +121 -0
- package/dist/esm/Zoom/browserSupportsCssZoom.js +9 -0
- package/dist/esm/addon-panel/addon-panel.js +32 -0
- package/dist/esm/bar/bar.js +114 -0
- package/dist/esm/bar/button.js +112 -0
- package/dist/esm/bar/button.stories.js +36 -0
- package/dist/esm/bar/separator.js +30 -0
- package/dist/esm/blocks/ArgsTable/ArgControl.js +107 -0
- package/dist/esm/blocks/ArgsTable/ArgJsDoc.js +78 -0
- package/dist/esm/blocks/ArgsTable/ArgRow.js +110 -0
- package/dist/esm/blocks/ArgsTable/ArgRow.stories.js +358 -0
- package/dist/esm/blocks/ArgsTable/ArgValue.js +246 -0
- package/dist/esm/blocks/ArgsTable/ArgsTable.js +410 -0
- package/dist/esm/blocks/ArgsTable/ArgsTable.stories.js +155 -0
- package/dist/esm/blocks/ArgsTable/NoControlsWarning.js +22 -0
- package/dist/esm/blocks/ArgsTable/SectionRow.js +153 -0
- package/dist/esm/blocks/ArgsTable/SectionRow.stories.js +38 -0
- package/dist/esm/blocks/ArgsTable/TabbedArgsTable.js +65 -0
- package/dist/esm/blocks/ArgsTable/TabbedArgsTable.stories.js +34 -0
- package/dist/esm/blocks/ArgsTable/index.js +4 -0
- package/dist/esm/blocks/ArgsTable/types.js +0 -0
- package/dist/esm/blocks/BlockBackgroundStyles.js +8 -0
- package/dist/esm/blocks/ColorPalette.js +196 -0
- package/dist/esm/blocks/ColorPalette.stories.js +69 -0
- package/dist/esm/blocks/Description.js +19 -0
- package/dist/esm/blocks/Description.stories.js +32 -0
- package/dist/esm/blocks/DocsPage.js +57 -0
- package/dist/esm/blocks/DocsPage.stories.js +56 -0
- package/dist/esm/blocks/DocsPageExampleCaption.md +92 -0
- package/dist/esm/blocks/DocsPageExampleCaption.mdx +92 -0
- package/dist/esm/blocks/EmptyBlock.js +29 -0
- package/dist/esm/blocks/EmptyBlock.stories.js +10 -0
- package/dist/esm/blocks/IFrame.js +115 -0
- package/dist/esm/blocks/IconGallery.js +75 -0
- package/dist/esm/blocks/IconGallery.stories.js +37 -0
- package/dist/esm/blocks/Preview.js +365 -0
- package/dist/esm/blocks/Preview.stories.js +251 -0
- package/dist/esm/blocks/Source.js +77 -0
- package/dist/esm/blocks/Source.stories.js +42 -0
- package/dist/esm/blocks/Story.js +91 -0
- package/dist/esm/blocks/Story.stories.js +76 -0
- package/dist/esm/blocks/Toolbar.js +87 -0
- package/dist/esm/blocks/Typeset.js +71 -0
- package/dist/esm/blocks/Typeset.stories.js +37 -0
- package/dist/esm/blocks/ZoomContext.js +4 -0
- package/dist/esm/blocks/index.js +10 -0
- package/dist/esm/brand/StorybookIcon.js +31 -0
- package/dist/esm/brand/StorybookIcon.stories.js +6 -0
- package/dist/esm/brand/StorybookLogo.js +47 -0
- package/dist/esm/brand/StorybookLogo.stories.js +12 -0
- package/dist/esm/controls/Boolean.js +114 -0
- package/dist/esm/controls/Boolean.stories.js +54 -0
- package/dist/esm/controls/Color.js +446 -0
- package/dist/esm/controls/Color.stories.js +109 -0
- package/dist/esm/controls/Date.js +158 -0
- package/dist/esm/controls/Date.stories.js +51 -0
- package/dist/esm/controls/Files.js +56 -0
- package/dist/esm/controls/Number.js +110 -0
- package/dist/esm/controls/Number.stories.js +54 -0
- package/dist/esm/controls/Object.js +370 -0
- package/dist/esm/controls/Object.stories.js +81 -0
- package/dist/esm/controls/Range.js +179 -0
- package/dist/esm/controls/Range.stories.js +83 -0
- package/dist/esm/controls/Text.js +72 -0
- package/dist/esm/controls/Text.stories.js +54 -0
- package/dist/esm/controls/helpers.js +22 -0
- package/dist/esm/controls/index.js +21 -0
- package/dist/esm/controls/options/Checkbox.js +123 -0
- package/dist/esm/controls/options/Options.js +70 -0
- package/dist/esm/controls/options/Options.stories.js +126 -0
- package/dist/esm/controls/options/Radio.js +77 -0
- package/dist/esm/controls/options/Select.js +143 -0
- package/dist/esm/controls/options/helpers.js +50 -0
- package/dist/esm/controls/options/index.js +1 -0
- package/dist/esm/controls/react-editable-json-tree/LICENSE.md +14 -0
- package/dist/esm/controls/react-editable-json-tree/components/JsonAddValue.js +194 -0
- package/dist/esm/controls/react-editable-json-tree/components/JsonArray.js +465 -0
- package/dist/esm/controls/react-editable-json-tree/components/JsonFunctionValue.js +282 -0
- package/dist/esm/controls/react-editable-json-tree/components/JsonNode.js +387 -0
- package/dist/esm/controls/react-editable-json-tree/components/JsonObject.js +467 -0
- package/dist/esm/controls/react-editable-json-tree/components/JsonValue.js +272 -0
- package/dist/esm/controls/react-editable-json-tree/index.js +267 -0
- package/dist/esm/controls/react-editable-json-tree/types/dataTypes.js +24 -0
- package/dist/esm/controls/react-editable-json-tree/types/deltaTypes.js +6 -0
- package/dist/esm/controls/react-editable-json-tree/types/inputUsageTypes.js +6 -0
- package/dist/esm/controls/react-editable-json-tree/utils/objectTypes.js +39 -0
- package/dist/esm/controls/react-editable-json-tree/utils/parse.js +21 -0
- package/dist/esm/controls/react-editable-json-tree/utils/styles.js +62 -0
- package/dist/esm/controls/types.js +0 -0
- package/dist/esm/form/field/field.js +44 -0
- package/dist/esm/form/form.stories.js +198 -0
- package/dist/esm/form/index.js +15 -0
- package/dist/esm/form/input/input.js +225 -0
- package/dist/esm/html.js +13 -0
- package/dist/esm/icon/icon.js +52 -0
- package/dist/esm/icon/icon.stories.js +62 -0
- package/dist/esm/icon/icons.js +174 -0
- package/dist/esm/icon/svg.js +15 -0
- package/dist/esm/index.js +50 -0
- package/dist/esm/placeholder/placeholder.js +58 -0
- package/dist/esm/placeholder/placeholder.stories.js +23 -0
- package/dist/esm/shared/animation.js +9 -0
- package/dist/esm/spaced/Spaced.js +84 -0
- package/dist/esm/spaced/Spaced.stories.js +63 -0
- package/dist/esm/syntaxhighlighter/formatter.js +5 -0
- package/dist/esm/syntaxhighlighter/lazy-syntaxhighlighter.js +12 -0
- package/dist/esm/syntaxhighlighter/syntaxhighlighter-types.js +0 -0
- package/dist/esm/syntaxhighlighter/syntaxhighlighter.js +250 -0
- package/dist/esm/syntaxhighlighter/syntaxhighlighter.stories.js +82 -0
- package/dist/esm/tabs/tabs.js +269 -0
- package/dist/esm/tabs/tabs.stories.js +277 -0
- package/dist/esm/tooltip/ListItem.js +201 -0
- package/dist/esm/tooltip/ListItem.stories.js +87 -0
- package/dist/esm/tooltip/Tooltip.js +119 -0
- package/dist/esm/tooltip/Tooltip.stories.js +42 -0
- package/dist/esm/tooltip/TooltipLinkList.js +67 -0
- package/dist/esm/tooltip/TooltipLinkList.stories.js +60 -0
- package/dist/esm/tooltip/TooltipMessage.js +62 -0
- package/dist/esm/tooltip/TooltipMessage.stories.js +46 -0
- package/dist/esm/tooltip/TooltipNote.js +33 -0
- package/dist/esm/tooltip/TooltipNote.stories.js +21 -0
- package/dist/esm/tooltip/WithTooltip.js +191 -0
- package/dist/esm/tooltip/WithTooltip.stories.js +83 -0
- package/dist/esm/tooltip/lazy-WithTooltip.js +29 -0
- package/dist/esm/typings.d.js +0 -0
- package/dist/esm/typography/DocumentFormatting.js +490 -0
- package/dist/esm/typography/DocumentFormattingSample.md +141 -0
- package/dist/esm/typography/DocumentWrapper.js +288 -0
- package/dist/esm/typography/DocumentWrapper.stories.js +70 -0
- package/dist/esm/typography/link/link.js +188 -0
- package/dist/esm/typography/link/link.stories.js +62 -0
- package/dist/esm/typography/shared.js +50 -0
- package/dist/esm/typography/typography.stories.mdx +75 -0
- package/dist/modern/ActionBar/ActionBar.js +74 -0
- package/dist/modern/ActionBar/ActionBar.stories.js +41 -0
- package/dist/modern/Badge/Badge.js +78 -0
- package/dist/modern/Badge/Badge.stories.js +10 -0
- package/dist/modern/Button/Button.js +231 -0
- package/dist/modern/Button/Button.stories.js +65 -0
- package/dist/modern/Colors/SideBySide.js +15 -0
- package/dist/modern/Colors/colorpalette.stories.mdx +125 -0
- package/dist/modern/Loader/Loader.js +185 -0
- package/dist/modern/Loader/Loader.stories.js +53 -0
- package/dist/modern/ScrollArea/GlobalScrollAreaStyles.js +450 -0
- package/dist/modern/ScrollArea/OverlayScrollbars.js +86 -0
- package/dist/modern/ScrollArea/ScrollArea.js +43 -0
- package/dist/modern/ScrollArea/ScrollArea.stories.js +70 -0
- package/dist/modern/Zoom/Zoom.js +17 -0
- package/dist/modern/Zoom/Zoom.stories.js +113 -0
- package/dist/modern/Zoom/ZoomElement.js +35 -0
- package/dist/modern/Zoom/ZoomIFrame.js +71 -0
- package/dist/modern/Zoom/browserSupportsCssZoom.js +11 -0
- package/dist/modern/addon-panel/addon-panel.js +33 -0
- package/dist/modern/bar/bar.js +80 -0
- package/dist/modern/bar/button.js +104 -0
- package/dist/modern/bar/button.stories.js +28 -0
- package/dist/modern/bar/separator.js +25 -0
- package/dist/modern/blocks/ArgsTable/ArgControl.js +71 -0
- package/dist/modern/blocks/ArgsTable/ArgJsDoc.js +71 -0
- package/dist/modern/blocks/ArgsTable/ArgRow.js +105 -0
- package/dist/modern/blocks/ArgsTable/ArgRow.stories.js +361 -0
- package/dist/modern/blocks/ArgsTable/ArgValue.js +191 -0
- package/dist/modern/blocks/ArgsTable/ArgsTable.js +356 -0
- package/dist/modern/blocks/ArgsTable/ArgsTable.stories.js +147 -0
- package/dist/modern/blocks/ArgsTable/NoControlsWarning.js +19 -0
- package/dist/modern/blocks/ArgsTable/SectionRow.js +110 -0
- package/dist/modern/blocks/ArgsTable/SectionRow.stories.js +31 -0
- package/dist/modern/blocks/ArgsTable/TabbedArgsTable.js +34 -0
- package/dist/modern/blocks/ArgsTable/TabbedArgsTable.stories.js +32 -0
- package/dist/modern/blocks/ArgsTable/index.js +4 -0
- package/dist/modern/blocks/ArgsTable/types.js +0 -0
- package/dist/modern/blocks/BlockBackgroundStyles.js +6 -0
- package/dist/modern/blocks/ColorPalette.js +175 -0
- package/dist/modern/blocks/ColorPalette.stories.js +65 -0
- package/dist/modern/blocks/Description.js +18 -0
- package/dist/modern/blocks/Description.stories.js +65 -0
- package/dist/modern/blocks/DocsPage.js +53 -0
- package/dist/modern/blocks/DocsPage.stories.js +44 -0
- package/dist/modern/blocks/DocsPageExampleCaption.md +92 -0
- package/dist/modern/blocks/DocsPageExampleCaption.mdx +92 -0
- package/dist/modern/blocks/EmptyBlock.js +24 -0
- package/dist/modern/blocks/EmptyBlock.stories.js +8 -0
- package/dist/modern/blocks/IFrame.js +65 -0
- package/dist/modern/blocks/IconGallery.js +68 -0
- package/dist/modern/blocks/IconGallery.stories.js +35 -0
- package/dist/modern/blocks/Preview.js +262 -0
- package/dist/modern/blocks/Preview.stories.js +217 -0
- package/dist/modern/blocks/Source.js +73 -0
- package/dist/modern/blocks/Source.stories.js +50 -0
- package/dist/modern/blocks/Story.js +85 -0
- package/dist/modern/blocks/Story.stories.js +39 -0
- package/dist/modern/blocks/Toolbar.js +82 -0
- package/dist/modern/blocks/Typeset.js +63 -0
- package/dist/modern/blocks/Typeset.stories.js +29 -0
- package/dist/modern/blocks/ZoomContext.js +4 -0
- package/dist/modern/blocks/index.js +10 -0
- package/dist/modern/brand/StorybookIcon.js +30 -0
- package/dist/modern/brand/StorybookIcon.stories.js +4 -0
- package/dist/modern/brand/StorybookLogo.js +43 -0
- package/dist/modern/brand/StorybookLogo.stories.js +10 -0
- package/dist/modern/controls/Boolean.js +104 -0
- package/dist/modern/controls/Boolean.stories.js +19 -0
- package/dist/modern/controls/Color.js +343 -0
- package/dist/modern/controls/Color.stories.js +74 -0
- package/dist/modern/controls/Date.js +118 -0
- package/dist/modern/controls/Date.stories.js +18 -0
- package/dist/modern/controls/Files.js +43 -0
- package/dist/modern/controls/Number.js +72 -0
- package/dist/modern/controls/Number.stories.js +19 -0
- package/dist/modern/controls/Object.js +316 -0
- package/dist/modern/controls/Object.stories.js +38 -0
- package/dist/modern/controls/Range.js +184 -0
- package/dist/modern/controls/Range.stories.js +44 -0
- package/dist/modern/controls/Text.js +46 -0
- package/dist/modern/controls/Text.stories.js +19 -0
- package/dist/modern/controls/helpers.js +15 -0
- package/dist/modern/controls/index.js +15 -0
- package/dist/modern/controls/options/Checkbox.js +81 -0
- package/dist/modern/controls/options/Options.js +67 -0
- package/dist/modern/controls/options/Options.stories.js +55 -0
- package/dist/modern/controls/options/Radio.js +70 -0
- package/dist/modern/controls/options/Select.js +143 -0
- package/dist/modern/controls/options/helpers.js +6 -0
- package/dist/modern/controls/options/index.js +1 -0
- package/dist/modern/controls/react-editable-json-tree/LICENSE.md +14 -0
- package/dist/modern/controls/react-editable-json-tree/components/JsonAddValue.js +148 -0
- package/dist/modern/controls/react-editable-json-tree/components/JsonArray.js +392 -0
- package/dist/modern/controls/react-editable-json-tree/components/JsonFunctionValue.js +215 -0
- package/dist/modern/controls/react-editable-json-tree/components/JsonNode.js +339 -0
- package/dist/modern/controls/react-editable-json-tree/components/JsonObject.js +394 -0
- package/dist/modern/controls/react-editable-json-tree/components/JsonValue.js +202 -0
- package/dist/modern/controls/react-editable-json-tree/index.js +192 -0
- package/dist/modern/controls/react-editable-json-tree/types/dataTypes.js +24 -0
- package/dist/modern/controls/react-editable-json-tree/types/deltaTypes.js +6 -0
- package/dist/modern/controls/react-editable-json-tree/types/inputUsageTypes.js +6 -0
- package/dist/modern/controls/react-editable-json-tree/utils/objectTypes.js +28 -0
- package/dist/modern/controls/react-editable-json-tree/utils/parse.js +21 -0
- package/dist/modern/controls/react-editable-json-tree/utils/styles.js +62 -0
- package/dist/modern/controls/types.js +0 -0
- package/dist/modern/form/field/field.js +39 -0
- package/dist/modern/form/form.stories.js +126 -0
- package/dist/modern/form/index.js +14 -0
- package/dist/modern/form/input/input.js +203 -0
- package/dist/modern/html.js +10 -0
- package/dist/modern/icon/icon.js +43 -0
- package/dist/modern/icon/icon.stories.js +51 -0
- package/dist/modern/icon/icons.js +174 -0
- package/dist/modern/icon/svg.js +14 -0
- package/dist/modern/index.js +45 -0
- package/dist/modern/placeholder/placeholder.js +28 -0
- package/dist/modern/placeholder/placeholder.stories.js +19 -0
- package/dist/modern/shared/animation.js +9 -0
- package/dist/modern/spaced/Spaced.js +76 -0
- package/dist/modern/spaced/Spaced.stories.js +51 -0
- package/dist/modern/syntaxhighlighter/formatter.js +3 -0
- package/dist/modern/syntaxhighlighter/lazy-syntaxhighlighter.js +6 -0
- package/dist/modern/syntaxhighlighter/syntaxhighlighter-types.js +0 -0
- package/dist/modern/syntaxhighlighter/syntaxhighlighter.js +172 -0
- package/dist/modern/syntaxhighlighter/syntaxhighlighter.stories.js +187 -0
- package/dist/modern/tabs/tabs.js +214 -0
- package/dist/modern/tabs/tabs.stories.js +196 -0
- package/dist/modern/tooltip/ListItem.js +183 -0
- package/dist/modern/tooltip/ListItem.stories.js +71 -0
- package/dist/modern/tooltip/Tooltip.js +110 -0
- package/dist/modern/tooltip/Tooltip.stories.js +30 -0
- package/dist/modern/tooltip/TooltipLinkList.js +64 -0
- package/dist/modern/tooltip/TooltipLinkList.stories.js +54 -0
- package/dist/modern/tooltip/TooltipMessage.js +56 -0
- package/dist/modern/tooltip/TooltipMessage.stories.js +36 -0
- package/dist/modern/tooltip/TooltipNote.js +29 -0
- package/dist/modern/tooltip/TooltipNote.stories.js +17 -0
- package/dist/modern/tooltip/WithTooltip.js +152 -0
- package/dist/modern/tooltip/WithTooltip.stories.js +68 -0
- package/dist/modern/tooltip/lazy-WithTooltip.js +15 -0
- package/dist/modern/typings.d.js +0 -0
- package/dist/modern/typography/DocumentFormatting.js +420 -0
- package/dist/modern/typography/DocumentFormattingSample.md +141 -0
- package/dist/modern/typography/DocumentWrapper.js +287 -0
- package/dist/modern/typography/DocumentWrapper.stories.js +64 -0
- package/dist/modern/typography/link/link.js +175 -0
- package/dist/modern/typography/link/link.stories.js +52 -0
- package/dist/modern/typography/shared.js +47 -0
- package/dist/modern/typography/typography.stories.mdx +75 -0
- package/dist/ts3.4/ActionBar/ActionBar.d.ts +14 -0
- package/dist/ts3.4/Badge/Badge.d.ts +5 -0
- package/dist/ts3.4/Button/Button.d.ts +18 -0
- package/dist/ts3.4/Colors/SideBySide.d.ts +2 -0
- package/dist/ts3.4/Loader/Loader.d.ts +18 -0
- package/dist/ts3.4/ScrollArea/GlobalScrollAreaStyles.d.ts +5 -0
- package/dist/ts3.4/ScrollArea/OverlayScrollbars.d.ts +15 -0
- package/dist/ts3.4/ScrollArea/ScrollArea.d.ts +7 -0
- package/dist/ts3.4/Zoom/Zoom.d.ts +7 -0
- package/dist/ts3.4/Zoom/ZoomElement.d.ts +7 -0
- package/dist/ts3.4/Zoom/ZoomIFrame.d.ts +15 -0
- package/dist/ts3.4/Zoom/browserSupportsCssZoom.d.ts +1 -0
- package/dist/ts3.4/addon-panel/addon-panel.d.ts +6 -0
- package/dist/ts3.4/bar/bar.d.ts +12 -0
- package/dist/ts3.4/bar/button.d.ts +25 -0
- package/dist/ts3.4/bar/separator.d.ts +6 -0
- package/dist/ts3.4/blocks/ArgsTable/ArgControl.d.ts +8 -0
- package/dist/ts3.4/blocks/ArgsTable/ArgJsDoc.d.ts +8 -0
- package/dist/ts3.4/blocks/ArgsTable/ArgRow.d.ts +11 -0
- package/dist/ts3.4/blocks/ArgsTable/ArgValue.d.ts +8 -0
- package/dist/ts3.4/blocks/ArgsTable/ArgsTable.d.ts +30 -0
- package/dist/ts3.4/blocks/ArgsTable/NoControlsWarning.d.ts +2 -0
- package/dist/ts3.4/blocks/ArgsTable/SectionRow.d.ts +10 -0
- package/dist/ts3.4/blocks/ArgsTable/TabbedArgsTable.d.ts +7 -0
- package/dist/ts3.4/blocks/ArgsTable/index.d.ts +4 -0
- package/dist/ts3.4/blocks/ArgsTable/types.d.ts +36 -0
- package/dist/ts3.4/blocks/BlockBackgroundStyles.d.ts +2 -0
- package/dist/ts3.4/blocks/ColorPalette.d.ts +20 -0
- package/dist/ts3.4/blocks/Description.d.ts +9 -0
- package/dist/ts3.4/blocks/DocsPage.d.ts +11 -0
- package/dist/ts3.4/blocks/EmptyBlock.d.ts +2 -0
- package/dist/ts3.4/blocks/IFrame.d.ts +24 -0
- package/dist/ts3.4/blocks/IconGallery.d.ts +13 -0
- package/dist/ts3.4/blocks/Preview.d.ts +19 -0
- package/dist/ts3.4/blocks/Source.d.ts +21 -0
- package/dist/ts3.4/blocks/Story.d.ts +25 -0
- package/dist/ts3.4/blocks/Toolbar.d.ts +15 -0
- package/dist/ts3.4/blocks/Typeset.d.ts +12 -0
- package/dist/ts3.4/blocks/ZoomContext.d.ts +4 -0
- package/dist/ts3.4/blocks/index.d.ts +10 -0
- package/dist/ts3.4/brand/StorybookIcon.d.ts +2 -0
- package/dist/ts3.4/brand/StorybookLogo.d.ts +5 -0
- package/dist/ts3.4/controls/Boolean.d.ts +4 -0
- package/dist/ts3.4/controls/Color.d.ts +5 -0
- package/dist/ts3.4/controls/Date.d.ts +4 -0
- package/dist/ts3.4/controls/Files.d.ts +6 -0
- package/dist/ts3.4/controls/Number.d.ts +7 -0
- package/dist/ts3.4/controls/Object.d.ts +6 -0
- package/dist/ts3.4/controls/Range.d.ts +5 -0
- package/dist/ts3.4/controls/Text.d.ts +4 -0
- package/dist/ts3.4/controls/helpers.d.ts +14 -0
- package/dist/ts3.4/controls/index.d.ts +13 -0
- package/dist/ts3.4/controls/options/Checkbox.d.ts +8 -0
- package/dist/ts3.4/controls/options/Options.d.ts +4 -0
- package/dist/ts3.4/controls/options/Radio.d.ts +8 -0
- package/dist/ts3.4/controls/options/Select.d.ts +8 -0
- package/dist/ts3.4/controls/options/helpers.d.ts +4 -0
- package/dist/ts3.4/controls/options/index.d.ts +1 -0
- package/dist/ts3.4/controls/types.d.ts +56 -0
- package/dist/ts3.4/form/field/field.d.ts +5 -0
- package/dist/ts3.4/form/index.d.ts +15 -0
- package/dist/ts3.4/form/input/input.d.ts +26 -0
- package/dist/ts3.4/html.d.ts +2 -0
- package/dist/ts3.4/icon/icon.d.ts +12 -0
- package/dist/ts3.4/icon/icons.d.ts +174 -0
- package/dist/ts3.4/icon/svg.d.ts +6 -0
- package/dist/ts3.4/index.d.ts +34 -0
- package/dist/ts3.4/placeholder/placeholder.d.ts +2 -0
- package/dist/ts3.4/shared/animation.d.ts +1 -0
- package/dist/ts3.4/spaced/Spaced.d.ts +12 -0
- package/dist/ts3.4/syntaxhighlighter/formatter.d.ts +1 -0
- package/dist/ts3.4/syntaxhighlighter/lazy-syntaxhighlighter.d.ts +4 -0
- package/dist/ts3.4/syntaxhighlighter/syntaxhighlighter-types.d.ts +15 -0
- package/dist/ts3.4/syntaxhighlighter/syntaxhighlighter.d.ts +18 -0
- package/dist/ts3.4/tabs/tabs.d.ts +52 -0
- package/dist/ts3.4/tooltip/ListItem.d.ts +34 -0
- package/dist/ts3.4/tooltip/Tooltip.d.ts +21 -0
- package/dist/ts3.4/tooltip/TooltipLinkList.d.ts +12 -0
- package/dist/ts3.4/tooltip/TooltipMessage.d.ts +11 -0
- package/dist/ts3.4/tooltip/TooltipNote.d.ts +5 -0
- package/dist/ts3.4/tooltip/WithTooltip.d.ts +23 -0
- package/dist/ts3.4/tooltip/lazy-WithTooltip.d.ts +8 -0
- package/dist/ts3.4/typography/DocumentFormatting.d.ts +56 -0
- package/dist/ts3.4/typography/DocumentWrapper.d.ts +2 -0
- package/dist/ts3.4/typography/link/link.d.ts +22 -0
- package/dist/ts3.4/typography/shared.d.ts +11 -0
- package/dist/ts3.9/ActionBar/ActionBar.d.ts +14 -0
- package/dist/ts3.9/Badge/Badge.d.ts +5 -0
- package/dist/ts3.9/Button/Button.d.ts +18 -0
- package/dist/ts3.9/Colors/SideBySide.d.ts +2 -0
- package/dist/ts3.9/Loader/Loader.d.ts +18 -0
- package/dist/ts3.9/ScrollArea/GlobalScrollAreaStyles.d.ts +5 -0
- package/dist/ts3.9/ScrollArea/OverlayScrollbars.d.ts +15 -0
- package/dist/ts3.9/ScrollArea/ScrollArea.d.ts +7 -0
- package/dist/ts3.9/Zoom/Zoom.d.ts +7 -0
- package/dist/ts3.9/Zoom/ZoomElement.d.ts +7 -0
- package/dist/ts3.9/Zoom/ZoomIFrame.d.ts +15 -0
- package/dist/ts3.9/Zoom/browserSupportsCssZoom.d.ts +1 -0
- package/dist/ts3.9/addon-panel/addon-panel.d.ts +6 -0
- package/dist/ts3.9/bar/bar.d.ts +12 -0
- package/dist/ts3.9/bar/button.d.ts +25 -0
- package/dist/ts3.9/bar/separator.d.ts +6 -0
- package/dist/ts3.9/blocks/ArgsTable/ArgControl.d.ts +8 -0
- package/dist/ts3.9/blocks/ArgsTable/ArgJsDoc.d.ts +8 -0
- package/dist/ts3.9/blocks/ArgsTable/ArgRow.d.ts +11 -0
- package/dist/ts3.9/blocks/ArgsTable/ArgValue.d.ts +8 -0
- package/dist/ts3.9/blocks/ArgsTable/ArgsTable.d.ts +30 -0
- package/dist/ts3.9/blocks/ArgsTable/NoControlsWarning.d.ts +2 -0
- package/dist/ts3.9/blocks/ArgsTable/SectionRow.d.ts +10 -0
- package/dist/ts3.9/blocks/ArgsTable/TabbedArgsTable.d.ts +7 -0
- package/dist/ts3.9/blocks/ArgsTable/index.d.ts +4 -0
- package/dist/ts3.9/blocks/ArgsTable/types.d.ts +36 -0
- package/dist/ts3.9/blocks/BlockBackgroundStyles.d.ts +2 -0
- package/dist/ts3.9/blocks/ColorPalette.d.ts +20 -0
- package/dist/ts3.9/blocks/Description.d.ts +9 -0
- package/dist/ts3.9/blocks/DocsPage.d.ts +11 -0
- package/dist/ts3.9/blocks/EmptyBlock.d.ts +2 -0
- package/dist/ts3.9/blocks/IFrame.d.ts +24 -0
- package/dist/ts3.9/blocks/IconGallery.d.ts +13 -0
- package/dist/ts3.9/blocks/Preview.d.ts +19 -0
- package/dist/ts3.9/blocks/Source.d.ts +21 -0
- package/dist/ts3.9/blocks/Story.d.ts +25 -0
- package/dist/ts3.9/blocks/Toolbar.d.ts +15 -0
- package/dist/ts3.9/blocks/Typeset.d.ts +12 -0
- package/dist/ts3.9/blocks/ZoomContext.d.ts +4 -0
- package/dist/ts3.9/blocks/index.d.ts +10 -0
- package/dist/ts3.9/brand/StorybookIcon.d.ts +2 -0
- package/dist/ts3.9/brand/StorybookLogo.d.ts +5 -0
- package/dist/ts3.9/controls/Boolean.d.ts +4 -0
- package/dist/ts3.9/controls/Color.d.ts +5 -0
- package/dist/ts3.9/controls/Date.d.ts +4 -0
- package/dist/ts3.9/controls/Files.d.ts +6 -0
- package/dist/ts3.9/controls/Number.d.ts +7 -0
- package/dist/ts3.9/controls/Object.d.ts +6 -0
- package/dist/ts3.9/controls/Range.d.ts +5 -0
- package/dist/ts3.9/controls/Text.d.ts +4 -0
- package/dist/ts3.9/controls/helpers.d.ts +14 -0
- package/dist/ts3.9/controls/index.d.ts +13 -0
- package/dist/ts3.9/controls/options/Checkbox.d.ts +8 -0
- package/dist/ts3.9/controls/options/Options.d.ts +4 -0
- package/dist/ts3.9/controls/options/Radio.d.ts +8 -0
- package/dist/ts3.9/controls/options/Select.d.ts +8 -0
- package/dist/ts3.9/controls/options/helpers.d.ts +4 -0
- package/dist/ts3.9/controls/options/index.d.ts +1 -0
- package/dist/ts3.9/controls/types.d.ts +56 -0
- package/dist/ts3.9/form/field/field.d.ts +5 -0
- package/dist/ts3.9/form/index.d.ts +15 -0
- package/dist/ts3.9/form/input/input.d.ts +26 -0
- package/dist/ts3.9/html.d.ts +2 -0
- package/dist/ts3.9/icon/icon.d.ts +12 -0
- package/dist/ts3.9/icon/icons.d.ts +174 -0
- package/dist/ts3.9/icon/svg.d.ts +6 -0
- package/dist/ts3.9/index.d.ts +34 -0
- package/dist/ts3.9/placeholder/placeholder.d.ts +2 -0
- package/dist/ts3.9/shared/animation.d.ts +1 -0
- package/dist/ts3.9/spaced/Spaced.d.ts +12 -0
- package/dist/ts3.9/syntaxhighlighter/formatter.d.ts +1 -0
- package/dist/ts3.9/syntaxhighlighter/lazy-syntaxhighlighter.d.ts +4 -0
- package/dist/ts3.9/syntaxhighlighter/syntaxhighlighter-types.d.ts +15 -0
- package/dist/ts3.9/syntaxhighlighter/syntaxhighlighter.d.ts +18 -0
- package/dist/ts3.9/tabs/tabs.d.ts +52 -0
- package/dist/ts3.9/tooltip/ListItem.d.ts +34 -0
- package/dist/ts3.9/tooltip/Tooltip.d.ts +21 -0
- package/dist/ts3.9/tooltip/TooltipLinkList.d.ts +12 -0
- package/dist/ts3.9/tooltip/TooltipMessage.d.ts +11 -0
- package/dist/ts3.9/tooltip/TooltipNote.d.ts +5 -0
- package/dist/ts3.9/tooltip/WithTooltip.d.ts +23 -0
- package/dist/ts3.9/tooltip/lazy-WithTooltip.d.ts +8 -0
- package/dist/ts3.9/typography/DocumentFormatting.d.ts +56 -0
- package/dist/ts3.9/typography/DocumentWrapper.d.ts +2 -0
- package/dist/ts3.9/typography/link/link.d.ts +22 -0
- package/dist/ts3.9/typography/shared.d.ts +11 -0
- package/package.json +4 -4
|
@@ -0,0 +1,356 @@
|
|
|
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
|
+
import "core-js/modules/es.array.reduce.js";
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import pickBy from 'lodash/pickBy';
|
|
6
|
+
import { styled, ignoreSsrWarning } from '@storybook/theming';
|
|
7
|
+
import { opacify, transparentize, darken, lighten } from 'polished';
|
|
8
|
+
import { Icons } from '../../icon/icon';
|
|
9
|
+
import { ArgRow } from './ArgRow';
|
|
10
|
+
import { SectionRow } from './SectionRow';
|
|
11
|
+
import { EmptyBlock } from '../EmptyBlock';
|
|
12
|
+
import { Link } from '../../typography/link/link';
|
|
13
|
+
import { ResetWrapper } from '../../typography/DocumentFormatting';
|
|
14
|
+
export const TableWrapper = styled.table(({
|
|
15
|
+
theme,
|
|
16
|
+
compact,
|
|
17
|
+
inAddonPanel
|
|
18
|
+
}) => ({
|
|
19
|
+
'&&': {
|
|
20
|
+
// Resets for cascading/system styles
|
|
21
|
+
borderCollapse: 'collapse',
|
|
22
|
+
borderSpacing: 0,
|
|
23
|
+
color: theme.color.defaultText,
|
|
24
|
+
'td, th': {
|
|
25
|
+
padding: 0,
|
|
26
|
+
border: 'none',
|
|
27
|
+
verticalAlign: 'top',
|
|
28
|
+
textOverflow: 'ellipsis'
|
|
29
|
+
},
|
|
30
|
+
// End Resets
|
|
31
|
+
fontSize: theme.typography.size.s2 - 1,
|
|
32
|
+
lineHeight: '20px',
|
|
33
|
+
textAlign: 'left',
|
|
34
|
+
width: '100%',
|
|
35
|
+
// Margin collapse
|
|
36
|
+
marginTop: inAddonPanel ? 0 : 25,
|
|
37
|
+
marginBottom: inAddonPanel ? 0 : 40,
|
|
38
|
+
'thead th:first-of-type, td:first-of-type': {
|
|
39
|
+
// intentionally specify thead here
|
|
40
|
+
width: '25%'
|
|
41
|
+
},
|
|
42
|
+
'th:first-of-type, td:first-of-type': {
|
|
43
|
+
paddingLeft: 20
|
|
44
|
+
},
|
|
45
|
+
'th:nth-of-type(2), td:nth-of-type(2)': Object.assign({}, compact ? null : {
|
|
46
|
+
// Description column
|
|
47
|
+
width: '35%'
|
|
48
|
+
}),
|
|
49
|
+
'td:nth-of-type(3)': Object.assign({}, compact ? null : {
|
|
50
|
+
// Defaults column
|
|
51
|
+
width: '15%'
|
|
52
|
+
}),
|
|
53
|
+
'th:last-of-type, td:last-of-type': Object.assign({
|
|
54
|
+
paddingRight: 20
|
|
55
|
+
}, compact ? null : {
|
|
56
|
+
// Controls column
|
|
57
|
+
width: '25%'
|
|
58
|
+
}),
|
|
59
|
+
th: {
|
|
60
|
+
color: theme.base === 'light' ? transparentize(0.25, theme.color.defaultText) : transparentize(0.45, theme.color.defaultText),
|
|
61
|
+
paddingTop: 10,
|
|
62
|
+
paddingBottom: 10,
|
|
63
|
+
paddingLeft: 15,
|
|
64
|
+
paddingRight: 15
|
|
65
|
+
},
|
|
66
|
+
td: {
|
|
67
|
+
paddingTop: '10px',
|
|
68
|
+
paddingBottom: '10px',
|
|
69
|
+
'&:not(:first-of-type)': {
|
|
70
|
+
paddingLeft: 15,
|
|
71
|
+
paddingRight: 15
|
|
72
|
+
},
|
|
73
|
+
'&:last-of-type': {
|
|
74
|
+
paddingRight: 20
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
// Table "block" styling
|
|
78
|
+
// Emphasize tbody's background and set borderRadius
|
|
79
|
+
// Calling out because styling tables is finicky
|
|
80
|
+
// Makes border alignment consistent w/other DocBlocks
|
|
81
|
+
marginLeft: inAddonPanel ? 0 : 1,
|
|
82
|
+
marginRight: inAddonPanel ? 0 : 1,
|
|
83
|
+
[`tr:first-child${ignoreSsrWarning}`]: {
|
|
84
|
+
[`td:first-child${ignoreSsrWarning}, th:first-child${ignoreSsrWarning}`]: {
|
|
85
|
+
borderTopLeftRadius: inAddonPanel ? 0 : theme.appBorderRadius
|
|
86
|
+
},
|
|
87
|
+
[`td:last-child${ignoreSsrWarning}, th:last-child${ignoreSsrWarning}`]: {
|
|
88
|
+
borderTopRightRadius: inAddonPanel ? 0 : theme.appBorderRadius
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
[`tr:last-child${ignoreSsrWarning}`]: {
|
|
92
|
+
[`td:first-child${ignoreSsrWarning}, th:first-child${ignoreSsrWarning}`]: {
|
|
93
|
+
borderBottomLeftRadius: inAddonPanel ? 0 : theme.appBorderRadius
|
|
94
|
+
},
|
|
95
|
+
[`td:last-child${ignoreSsrWarning}, th:last-child${ignoreSsrWarning}`]: {
|
|
96
|
+
borderBottomRightRadius: inAddonPanel ? 0 : theme.appBorderRadius
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
tbody: {
|
|
100
|
+
// slightly different than the other DocBlock shadows to account for table styling gymnastics
|
|
101
|
+
boxShadow: !inAddonPanel && (theme.base === 'light' ? `rgba(0, 0, 0, 0.10) 0 1px 3px 1px,
|
|
102
|
+
${transparentize(0.035, theme.appBorderColor)} 0 0 0 1px` : `rgba(0, 0, 0, 0.20) 0 2px 5px 1px,
|
|
103
|
+
${opacify(0.05, theme.appBorderColor)} 0 0 0 1px`),
|
|
104
|
+
borderRadius: theme.appBorderRadius,
|
|
105
|
+
// for safari only
|
|
106
|
+
// CSS hack courtesy of https://stackoverflow.com/questions/16348489/is-there-a-css-hack-for-safari-only-not-chrome
|
|
107
|
+
'@media not all and (min-resolution:.001dpcm)': {
|
|
108
|
+
'@supports (-webkit-appearance:none)': Object.assign({
|
|
109
|
+
borderWidth: 1,
|
|
110
|
+
borderStyle: 'solid'
|
|
111
|
+
}, inAddonPanel && {
|
|
112
|
+
borderColor: 'transparent'
|
|
113
|
+
}, !inAddonPanel && {
|
|
114
|
+
borderColor: theme.base === 'light' ? transparentize(0.035, theme.appBorderColor) : opacify(0.05, theme.appBorderColor)
|
|
115
|
+
})
|
|
116
|
+
},
|
|
117
|
+
tr: Object.assign({
|
|
118
|
+
background: 'transparent',
|
|
119
|
+
overflow: 'hidden'
|
|
120
|
+
}, inAddonPanel ? {
|
|
121
|
+
borderTopWidth: 1,
|
|
122
|
+
borderTopStyle: 'solid',
|
|
123
|
+
borderTopColor: theme.base === 'light' ? darken(0.1, theme.background.content) : lighten(0.05, theme.background.content)
|
|
124
|
+
} : {
|
|
125
|
+
[`&:not(:first-child${ignoreSsrWarning})`]: {
|
|
126
|
+
borderTopWidth: 1,
|
|
127
|
+
borderTopStyle: 'solid',
|
|
128
|
+
borderTopColor: theme.base === 'light' ? darken(0.1, theme.background.content) : lighten(0.05, theme.background.content)
|
|
129
|
+
}
|
|
130
|
+
}),
|
|
131
|
+
td: {
|
|
132
|
+
background: theme.background.content
|
|
133
|
+
}
|
|
134
|
+
} // End finicky table styling
|
|
135
|
+
|
|
136
|
+
}
|
|
137
|
+
}));
|
|
138
|
+
const ResetButton = styled.button(({
|
|
139
|
+
theme
|
|
140
|
+
}) => ({
|
|
141
|
+
border: 0,
|
|
142
|
+
borderRadius: '3em',
|
|
143
|
+
cursor: 'pointer',
|
|
144
|
+
display: 'inline-block',
|
|
145
|
+
overflow: 'hidden',
|
|
146
|
+
padding: '3px 8px',
|
|
147
|
+
transition: 'all 150ms ease-out',
|
|
148
|
+
verticalAlign: 'top',
|
|
149
|
+
userSelect: 'none',
|
|
150
|
+
margin: 0,
|
|
151
|
+
backgroundColor: theme.base === 'light' ? '#EAF3FC' : theme.color.border,
|
|
152
|
+
boxShadow: theme.base === 'light' ? `${theme.color.border} 0 0 0 1px inset` : `${theme.color.darker} 0 0 0 1px inset`,
|
|
153
|
+
color: theme.color.secondary,
|
|
154
|
+
'&:hover': {
|
|
155
|
+
background: theme.base === 'light' ? darken(0.03, '#EAF3FC') : opacify(0.1, theme.color.border)
|
|
156
|
+
},
|
|
157
|
+
'&:focus': {
|
|
158
|
+
boxShadow: `${theme.color.secondary} 0 0 0 1px inset`,
|
|
159
|
+
outline: 'none'
|
|
160
|
+
},
|
|
161
|
+
svg: {
|
|
162
|
+
display: 'block',
|
|
163
|
+
height: 14,
|
|
164
|
+
width: 14
|
|
165
|
+
}
|
|
166
|
+
}));
|
|
167
|
+
const ControlHeadingWrapper = styled.span({
|
|
168
|
+
display: 'flex',
|
|
169
|
+
justifyContent: 'space-between'
|
|
170
|
+
});
|
|
171
|
+
export let ArgsTableError;
|
|
172
|
+
|
|
173
|
+
(function (ArgsTableError) {
|
|
174
|
+
ArgsTableError["NO_COMPONENT"] = "No component found.";
|
|
175
|
+
ArgsTableError["ARGS_UNSUPPORTED"] = "Args unsupported. See Args documentation for your framework.";
|
|
176
|
+
})(ArgsTableError || (ArgsTableError = {}));
|
|
177
|
+
|
|
178
|
+
const sortFns = {
|
|
179
|
+
alpha: (a, b) => a.name.localeCompare(b.name),
|
|
180
|
+
requiredFirst: (a, b) => {
|
|
181
|
+
var _b$type, _a$type;
|
|
182
|
+
|
|
183
|
+
return Number(!!((_b$type = b.type) !== null && _b$type !== void 0 && _b$type.required)) - Number(!!((_a$type = a.type) !== null && _a$type !== void 0 && _a$type.required)) || a.name.localeCompare(b.name);
|
|
184
|
+
},
|
|
185
|
+
none: undefined
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
const groupRows = (rows, sort) => {
|
|
189
|
+
const sections = {
|
|
190
|
+
ungrouped: [],
|
|
191
|
+
ungroupedSubsections: {},
|
|
192
|
+
sections: {}
|
|
193
|
+
};
|
|
194
|
+
if (!rows) return sections;
|
|
195
|
+
Object.entries(rows).forEach(([key, row]) => {
|
|
196
|
+
const {
|
|
197
|
+
category,
|
|
198
|
+
subcategory
|
|
199
|
+
} = (row === null || row === void 0 ? void 0 : row.table) || {};
|
|
200
|
+
|
|
201
|
+
if (category) {
|
|
202
|
+
const section = sections.sections[category] || {
|
|
203
|
+
ungrouped: [],
|
|
204
|
+
subsections: {}
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
if (!subcategory) {
|
|
208
|
+
section.ungrouped.push(Object.assign({
|
|
209
|
+
key
|
|
210
|
+
}, row));
|
|
211
|
+
} else {
|
|
212
|
+
const subsection = section.subsections[subcategory] || [];
|
|
213
|
+
subsection.push(Object.assign({
|
|
214
|
+
key
|
|
215
|
+
}, row));
|
|
216
|
+
section.subsections[subcategory] = subsection;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
sections.sections[category] = section;
|
|
220
|
+
} else if (subcategory) {
|
|
221
|
+
const subsection = sections.ungroupedSubsections[subcategory] || [];
|
|
222
|
+
subsection.push(Object.assign({
|
|
223
|
+
key
|
|
224
|
+
}, row));
|
|
225
|
+
sections.ungroupedSubsections[subcategory] = subsection;
|
|
226
|
+
} else {
|
|
227
|
+
sections.ungrouped.push(Object.assign({
|
|
228
|
+
key
|
|
229
|
+
}, row));
|
|
230
|
+
}
|
|
231
|
+
}); // apply sort
|
|
232
|
+
|
|
233
|
+
const sortFn = sortFns[sort];
|
|
234
|
+
|
|
235
|
+
const sortSubsection = record => {
|
|
236
|
+
if (!sortFn) return record;
|
|
237
|
+
return Object.keys(record).reduce((acc, cur) => Object.assign({}, acc, {
|
|
238
|
+
[cur]: record[cur].sort(sortFn)
|
|
239
|
+
}), {});
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
const sorted = {
|
|
243
|
+
ungrouped: sections.ungrouped.sort(sortFn),
|
|
244
|
+
ungroupedSubsections: sortSubsection(sections.ungroupedSubsections),
|
|
245
|
+
sections: Object.keys(sections.sections).reduce((acc, cur) => Object.assign({}, acc, {
|
|
246
|
+
[cur]: {
|
|
247
|
+
ungrouped: sections.sections[cur].ungrouped.sort(sortFn),
|
|
248
|
+
subsections: sortSubsection(sections.sections[cur].subsections)
|
|
249
|
+
}
|
|
250
|
+
}), {})
|
|
251
|
+
};
|
|
252
|
+
return sorted;
|
|
253
|
+
};
|
|
254
|
+
/**
|
|
255
|
+
* Display the props for a component as a props table. Each row is a collection of
|
|
256
|
+
* ArgDefs, usually derived from docgen info for the component.
|
|
257
|
+
*/
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
export const ArgsTable = props => {
|
|
261
|
+
const {
|
|
262
|
+
error
|
|
263
|
+
} = props;
|
|
264
|
+
|
|
265
|
+
if (error) {
|
|
266
|
+
return /*#__PURE__*/React.createElement(EmptyBlock, null, error, "\xA0", /*#__PURE__*/React.createElement(Link, {
|
|
267
|
+
href: "http://storybook.js.org/docs/",
|
|
268
|
+
target: "_blank",
|
|
269
|
+
withArrow: true
|
|
270
|
+
}, "Read the docs"));
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
const {
|
|
274
|
+
rows,
|
|
275
|
+
args,
|
|
276
|
+
updateArgs,
|
|
277
|
+
resetArgs,
|
|
278
|
+
compact,
|
|
279
|
+
inAddonPanel,
|
|
280
|
+
initialExpandedArgs,
|
|
281
|
+
sort = 'none'
|
|
282
|
+
} = props;
|
|
283
|
+
const groups = groupRows(pickBy(rows, row => {
|
|
284
|
+
var _row$table;
|
|
285
|
+
|
|
286
|
+
return !(row !== null && row !== void 0 && (_row$table = row.table) !== null && _row$table !== void 0 && _row$table.disable);
|
|
287
|
+
}), sort);
|
|
288
|
+
|
|
289
|
+
if (groups.ungrouped.length === 0 && Object.entries(groups.sections).length === 0 && Object.entries(groups.ungroupedSubsections).length === 0) {
|
|
290
|
+
return /*#__PURE__*/React.createElement(EmptyBlock, null, "No inputs found for this component.\xA0", /*#__PURE__*/React.createElement(Link, {
|
|
291
|
+
href: "http://storybook.js.org/docs/",
|
|
292
|
+
target: "_blank",
|
|
293
|
+
withArrow: true
|
|
294
|
+
}, "Read the docs"));
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
let colSpan = 1;
|
|
298
|
+
if (updateArgs) colSpan += 1;
|
|
299
|
+
if (!compact) colSpan += 2;
|
|
300
|
+
const expandable = Object.keys(groups.sections).length > 0;
|
|
301
|
+
const common = {
|
|
302
|
+
updateArgs,
|
|
303
|
+
compact,
|
|
304
|
+
inAddonPanel,
|
|
305
|
+
initialExpandedArgs
|
|
306
|
+
};
|
|
307
|
+
return /*#__PURE__*/React.createElement(ResetWrapper, null, /*#__PURE__*/React.createElement(TableWrapper, {
|
|
308
|
+
compact,
|
|
309
|
+
inAddonPanel,
|
|
310
|
+
className: "docblock-argstable"
|
|
311
|
+
}, /*#__PURE__*/React.createElement("thead", {
|
|
312
|
+
className: "docblock-argstable-head"
|
|
313
|
+
}, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("th", null, "Name"), compact ? null : /*#__PURE__*/React.createElement("th", null, "Description"), compact ? null : /*#__PURE__*/React.createElement("th", null, "Default"), updateArgs ? /*#__PURE__*/React.createElement("th", null, /*#__PURE__*/React.createElement(ControlHeadingWrapper, null, "Control", ' ', resetArgs && /*#__PURE__*/React.createElement(ResetButton, {
|
|
314
|
+
onClick: () => resetArgs(),
|
|
315
|
+
title: "Reset controls"
|
|
316
|
+
}, /*#__PURE__*/React.createElement(Icons, {
|
|
317
|
+
icon: "undo",
|
|
318
|
+
"aria-hidden": true
|
|
319
|
+
})))) : null)), /*#__PURE__*/React.createElement("tbody", {
|
|
320
|
+
className: "docblock-argstable-body"
|
|
321
|
+
}, groups.ungrouped.map(row => /*#__PURE__*/React.createElement(ArgRow, _extends({
|
|
322
|
+
key: row.key,
|
|
323
|
+
row: row,
|
|
324
|
+
arg: args && args[row.key]
|
|
325
|
+
}, common))), Object.entries(groups.ungroupedSubsections).map(([subcategory, subsection]) => /*#__PURE__*/React.createElement(SectionRow, {
|
|
326
|
+
key: subcategory,
|
|
327
|
+
label: subcategory,
|
|
328
|
+
level: "subsection",
|
|
329
|
+
colSpan: colSpan
|
|
330
|
+
}, subsection.map(row => /*#__PURE__*/React.createElement(ArgRow, _extends({
|
|
331
|
+
key: row.key,
|
|
332
|
+
row: row,
|
|
333
|
+
arg: args && args[row.key],
|
|
334
|
+
expandable: expandable
|
|
335
|
+
}, common))))), Object.entries(groups.sections).map(([category, section]) => /*#__PURE__*/React.createElement(SectionRow, {
|
|
336
|
+
key: category,
|
|
337
|
+
label: category,
|
|
338
|
+
level: "section",
|
|
339
|
+
colSpan: colSpan
|
|
340
|
+
}, section.ungrouped.map(row => /*#__PURE__*/React.createElement(ArgRow, _extends({
|
|
341
|
+
key: row.key,
|
|
342
|
+
row: row,
|
|
343
|
+
arg: args && args[row.key]
|
|
344
|
+
}, common))), Object.entries(section.subsections).map(([subcategory, subsection]) => /*#__PURE__*/React.createElement(SectionRow, {
|
|
345
|
+
key: subcategory,
|
|
346
|
+
label: subcategory,
|
|
347
|
+
level: "subsection",
|
|
348
|
+
colSpan: colSpan
|
|
349
|
+
}, subsection.map(row => /*#__PURE__*/React.createElement(ArgRow, _extends({
|
|
350
|
+
key: row.key,
|
|
351
|
+
row: row,
|
|
352
|
+
arg: args && args[row.key],
|
|
353
|
+
expandable: expandable
|
|
354
|
+
}, common))))))))));
|
|
355
|
+
};
|
|
356
|
+
ArgsTable.displayName = "ArgsTable";
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { action } from '@storybook/addon-actions';
|
|
3
|
+
import { styled } from '@storybook/theming';
|
|
4
|
+
import { ArgsTable, ArgsTableError } from './ArgsTable';
|
|
5
|
+
import { NoControlsWarning } from './NoControlsWarning';
|
|
6
|
+
import * as ArgRow from './ArgRow.stories';
|
|
7
|
+
export default {
|
|
8
|
+
component: ArgsTable,
|
|
9
|
+
title: 'Docs/ArgsTable',
|
|
10
|
+
args: {
|
|
11
|
+
updateArgs: action('updateArgs'),
|
|
12
|
+
resetArgs: action('resetArgs')
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
const propsSection = {
|
|
16
|
+
category: 'props '
|
|
17
|
+
};
|
|
18
|
+
const eventsSection = {
|
|
19
|
+
category: 'events '
|
|
20
|
+
};
|
|
21
|
+
const componentSubsection = {
|
|
22
|
+
subcategory: 'MyComponent '
|
|
23
|
+
};
|
|
24
|
+
const htmlElementSubsection = {
|
|
25
|
+
subcategory: 'HTMLElement'
|
|
26
|
+
};
|
|
27
|
+
const stringType = ArgRow.String.args.row;
|
|
28
|
+
const numberType = ArgRow.Number.args.row;
|
|
29
|
+
const longEnumType = ArgRow.LongEnum.args.row;
|
|
30
|
+
|
|
31
|
+
const Template = args => /*#__PURE__*/React.createElement(ArgsTable, args);
|
|
32
|
+
|
|
33
|
+
Template.displayName = "Template";
|
|
34
|
+
export const Normal = Template.bind({});
|
|
35
|
+
Normal.args = {
|
|
36
|
+
rows: {
|
|
37
|
+
stringType,
|
|
38
|
+
numberType
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
export const Compact = Template.bind({});
|
|
42
|
+
Compact.args = Object.assign({}, Normal.args, {
|
|
43
|
+
compact: true
|
|
44
|
+
});
|
|
45
|
+
const AddonPanelLayout = styled.div(({
|
|
46
|
+
theme
|
|
47
|
+
}) => ({
|
|
48
|
+
fontSize: theme.typography.size.s2 - 1,
|
|
49
|
+
background: theme.background.content
|
|
50
|
+
}));
|
|
51
|
+
export const InAddonPanel = Template.bind({});
|
|
52
|
+
InAddonPanel.args = Object.assign({}, Normal.args, {
|
|
53
|
+
inAddonPanel: true
|
|
54
|
+
});
|
|
55
|
+
InAddonPanel.decorators = [storyFn => /*#__PURE__*/React.createElement(AddonPanelLayout, null, storyFn())];
|
|
56
|
+
export const InAddonPanelWithWarning = args => /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(NoControlsWarning, null), /*#__PURE__*/React.createElement(ArgsTable, args));
|
|
57
|
+
InAddonPanelWithWarning.args = Object.assign({}, InAddonPanel.args, {
|
|
58
|
+
updateArgs: null
|
|
59
|
+
});
|
|
60
|
+
InAddonPanelWithWarning.decorators = InAddonPanel.decorators;
|
|
61
|
+
export const Sections = Template.bind({});
|
|
62
|
+
Sections.args = {
|
|
63
|
+
rows: {
|
|
64
|
+
a: Object.assign({}, stringType, {
|
|
65
|
+
table: Object.assign({}, stringType.table, propsSection)
|
|
66
|
+
}),
|
|
67
|
+
b: Object.assign({}, numberType, {
|
|
68
|
+
table: Object.assign({}, stringType.table, propsSection)
|
|
69
|
+
}),
|
|
70
|
+
c: Object.assign({}, stringType, {
|
|
71
|
+
table: Object.assign({}, stringType.table, eventsSection)
|
|
72
|
+
})
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
export const SectionsCompact = Template.bind({});
|
|
76
|
+
SectionsCompact.args = Object.assign({}, Sections.args, {
|
|
77
|
+
compact: true
|
|
78
|
+
});
|
|
79
|
+
export const SectionsAndSubsections = Template.bind({});
|
|
80
|
+
SectionsAndSubsections.args = {
|
|
81
|
+
rows: {
|
|
82
|
+
a: Object.assign({}, stringType, {
|
|
83
|
+
table: Object.assign({}, stringType.table, propsSection, componentSubsection)
|
|
84
|
+
}),
|
|
85
|
+
b: Object.assign({}, numberType, {
|
|
86
|
+
table: Object.assign({}, stringType.table, propsSection, componentSubsection)
|
|
87
|
+
}),
|
|
88
|
+
c: Object.assign({}, stringType, {
|
|
89
|
+
table: Object.assign({}, stringType.table, eventsSection, componentSubsection)
|
|
90
|
+
}),
|
|
91
|
+
d: Object.assign({}, stringType, {
|
|
92
|
+
table: Object.assign({}, stringType.table, eventsSection, htmlElementSubsection)
|
|
93
|
+
})
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
export const SubsectionsOnly = Template.bind({});
|
|
97
|
+
SubsectionsOnly.args = {
|
|
98
|
+
rows: {
|
|
99
|
+
a: Object.assign({}, stringType, {
|
|
100
|
+
table: Object.assign({}, stringType.table, componentSubsection)
|
|
101
|
+
}),
|
|
102
|
+
b: Object.assign({}, numberType, {
|
|
103
|
+
table: Object.assign({}, stringType.table, componentSubsection)
|
|
104
|
+
}),
|
|
105
|
+
c: Object.assign({}, stringType, {
|
|
106
|
+
table: Object.assign({}, stringType.table, componentSubsection)
|
|
107
|
+
}),
|
|
108
|
+
d: Object.assign({}, stringType, {
|
|
109
|
+
table: Object.assign({}, stringType.table, htmlElementSubsection)
|
|
110
|
+
})
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
export const AllControls = Template.bind({});
|
|
114
|
+
AllControls.args = {
|
|
115
|
+
rows: {
|
|
116
|
+
array: ArgRow.ArrayOf.args.row,
|
|
117
|
+
boolean: ArgRow.Boolean.args.row,
|
|
118
|
+
color: ArgRow.Color.args.row,
|
|
119
|
+
date: ArgRow.Date.args.row,
|
|
120
|
+
string: ArgRow.String.args.row,
|
|
121
|
+
number: ArgRow.Number.args.row,
|
|
122
|
+
range: ArgRow.Number.args.row,
|
|
123
|
+
radio: ArgRow.Radio.args.row,
|
|
124
|
+
inlineRadio: ArgRow.InlineRadio.args.row,
|
|
125
|
+
check: ArgRow.Check.args.row,
|
|
126
|
+
inlineCheck: ArgRow.InlineCheck.args.row,
|
|
127
|
+
select: ArgRow.Select.args.row,
|
|
128
|
+
multiSelect: ArgRow.MultiSelect.args.row,
|
|
129
|
+
object: ArgRow.ObjectOf.args.row,
|
|
130
|
+
func: ArgRow.Func.args.row
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
export const Error = Template.bind({});
|
|
134
|
+
Error.args = {
|
|
135
|
+
error: ArgsTableError.NO_COMPONENT
|
|
136
|
+
};
|
|
137
|
+
export const Empty = Template.bind({});
|
|
138
|
+
Empty.args = {
|
|
139
|
+
rows: {}
|
|
140
|
+
};
|
|
141
|
+
export const WithDefaultExpandedArgs = Template.bind({});
|
|
142
|
+
WithDefaultExpandedArgs.args = {
|
|
143
|
+
rows: {
|
|
144
|
+
longEnumType
|
|
145
|
+
},
|
|
146
|
+
initialExpandedArgs: true
|
|
147
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { styled } from '@storybook/theming';
|
|
3
|
+
import { Link } from '../../typography/link/link';
|
|
4
|
+
const NoControlsWrapper = styled.div(({
|
|
5
|
+
theme
|
|
6
|
+
}) => ({
|
|
7
|
+
background: theme.background.warning,
|
|
8
|
+
color: theme.color.darkest,
|
|
9
|
+
padding: '10px 15px',
|
|
10
|
+
lineHeight: '20px',
|
|
11
|
+
boxShadow: `${theme.appBorderColor} 0 -1px 0 0 inset`
|
|
12
|
+
}));
|
|
13
|
+
export const NoControlsWarning = () => /*#__PURE__*/React.createElement(NoControlsWrapper, null, "This story is not configured to handle controls.", ' ', /*#__PURE__*/React.createElement(Link, {
|
|
14
|
+
href: "https://storybook.js.org/docs/react/essentials/controls",
|
|
15
|
+
target: "_blank",
|
|
16
|
+
cancel: false,
|
|
17
|
+
withArrow: true
|
|
18
|
+
}, "Learn how to add controls"));
|
|
19
|
+
NoControlsWarning.displayName = "NoControlsWarning";
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { transparentize } from 'polished';
|
|
3
|
+
import { styled } from '@storybook/theming';
|
|
4
|
+
import { Icons } from '../../icon/icon';
|
|
5
|
+
const ExpanderIcon = styled(Icons)(({
|
|
6
|
+
theme
|
|
7
|
+
}) => ({
|
|
8
|
+
marginRight: 8,
|
|
9
|
+
marginLeft: -10,
|
|
10
|
+
marginTop: -2,
|
|
11
|
+
// optical alignment
|
|
12
|
+
height: 12,
|
|
13
|
+
width: 12,
|
|
14
|
+
color: theme.base === 'light' ? transparentize(0.25, theme.color.defaultText) : transparentize(0.3, theme.color.defaultText),
|
|
15
|
+
border: 'none',
|
|
16
|
+
display: 'inline-block'
|
|
17
|
+
}));
|
|
18
|
+
const FlexWrapper = styled.span(({
|
|
19
|
+
theme
|
|
20
|
+
}) => ({
|
|
21
|
+
display: 'flex',
|
|
22
|
+
lineHeight: '20px',
|
|
23
|
+
alignItems: 'center'
|
|
24
|
+
}));
|
|
25
|
+
const Section = styled.td(({
|
|
26
|
+
theme
|
|
27
|
+
}) => ({
|
|
28
|
+
position: 'relative',
|
|
29
|
+
letterSpacing: '0.35em',
|
|
30
|
+
textTransform: 'uppercase',
|
|
31
|
+
fontWeight: theme.typography.weight.black,
|
|
32
|
+
fontSize: theme.typography.size.s1 - 1,
|
|
33
|
+
color: theme.base === 'light' ? transparentize(0.4, theme.color.defaultText) : transparentize(0.6, theme.color.defaultText),
|
|
34
|
+
background: `${theme.background.app} !important`,
|
|
35
|
+
'& ~ td': {
|
|
36
|
+
background: `${theme.background.app} !important`
|
|
37
|
+
}
|
|
38
|
+
}));
|
|
39
|
+
const Subsection = styled.td(({
|
|
40
|
+
theme
|
|
41
|
+
}) => ({
|
|
42
|
+
position: 'relative',
|
|
43
|
+
fontWeight: theme.typography.weight.bold,
|
|
44
|
+
fontSize: theme.typography.size.s2 - 1,
|
|
45
|
+
background: theme.background.content
|
|
46
|
+
}));
|
|
47
|
+
const StyledTd = styled.td(({
|
|
48
|
+
theme
|
|
49
|
+
}) => ({
|
|
50
|
+
position: 'relative'
|
|
51
|
+
}));
|
|
52
|
+
const StyledTr = styled.tr(({
|
|
53
|
+
theme
|
|
54
|
+
}) => ({
|
|
55
|
+
'&:hover > td': {
|
|
56
|
+
backgroundColor: `${theme.background.hoverable} !important`,
|
|
57
|
+
boxShadow: `${theme.color.mediumlight} 0 - 1px 0 0 inset`,
|
|
58
|
+
cursor: 'row-resize'
|
|
59
|
+
}
|
|
60
|
+
}));
|
|
61
|
+
const ClickIntercept = styled.button(() => ({
|
|
62
|
+
// reset button style
|
|
63
|
+
background: 'none',
|
|
64
|
+
border: 'none',
|
|
65
|
+
padding: '0',
|
|
66
|
+
font: 'inherit',
|
|
67
|
+
// add custom style
|
|
68
|
+
position: 'absolute',
|
|
69
|
+
top: 0,
|
|
70
|
+
bottom: 0,
|
|
71
|
+
left: 0,
|
|
72
|
+
right: 0,
|
|
73
|
+
height: '100%',
|
|
74
|
+
width: '100%',
|
|
75
|
+
color: 'transparent',
|
|
76
|
+
cursor: 'row-resize !important'
|
|
77
|
+
}));
|
|
78
|
+
export const SectionRow = ({
|
|
79
|
+
level = 'section',
|
|
80
|
+
label,
|
|
81
|
+
children,
|
|
82
|
+
initialExpanded = true,
|
|
83
|
+
colSpan = 3
|
|
84
|
+
}) => {
|
|
85
|
+
const [expanded, setExpanded] = useState(initialExpanded);
|
|
86
|
+
const Level = level === 'subsection' ? Subsection : Section; // @ts-ignore
|
|
87
|
+
|
|
88
|
+
const itemCount = (children === null || children === void 0 ? void 0 : children.length) || 0;
|
|
89
|
+
const caption = level === 'subsection' ? `${itemCount} item${itemCount !== 1 ? 's' : ''}` : '';
|
|
90
|
+
const icon = expanded ? 'arrowdown' : 'arrowright';
|
|
91
|
+
const helperText = `${expanded ? 'Hide' : 'Side'} ${level === 'subsection' ? itemCount : label} item${itemCount !== 1 ? 's' : ''}`;
|
|
92
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(StyledTr, {
|
|
93
|
+
title: helperText
|
|
94
|
+
}, /*#__PURE__*/React.createElement(Level, {
|
|
95
|
+
colSpan: 1
|
|
96
|
+
}, /*#__PURE__*/React.createElement(ClickIntercept, {
|
|
97
|
+
onClick: e => setExpanded(!expanded),
|
|
98
|
+
tabIndex: 0
|
|
99
|
+
}, helperText), /*#__PURE__*/React.createElement(FlexWrapper, null, /*#__PURE__*/React.createElement(ExpanderIcon, {
|
|
100
|
+
icon: icon
|
|
101
|
+
}), label)), /*#__PURE__*/React.createElement(StyledTd, {
|
|
102
|
+
colSpan: colSpan - 1
|
|
103
|
+
}, /*#__PURE__*/React.createElement(ClickIntercept, {
|
|
104
|
+
onClick: e => setExpanded(!expanded),
|
|
105
|
+
tabIndex: -1,
|
|
106
|
+
style: {
|
|
107
|
+
outline: 'none'
|
|
108
|
+
}
|
|
109
|
+
}, helperText), expanded ? null : caption)), expanded ? children : null);
|
|
110
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SectionRow } from './SectionRow';
|
|
3
|
+
import { TableWrapper } from './ArgsTable';
|
|
4
|
+
import { ResetWrapper } from '../../typography/DocumentFormatting';
|
|
5
|
+
export default {
|
|
6
|
+
component: SectionRow,
|
|
7
|
+
title: 'Docs/SectionRow',
|
|
8
|
+
decorators: [getStory => /*#__PURE__*/React.createElement(ResetWrapper, null, /*#__PURE__*/React.createElement(TableWrapper, null, /*#__PURE__*/React.createElement("tbody", null, getStory())))]
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const Template = args => /*#__PURE__*/React.createElement(SectionRow, args);
|
|
12
|
+
|
|
13
|
+
Template.displayName = "Template";
|
|
14
|
+
export const Section = Template.bind({});
|
|
15
|
+
Section.args = {
|
|
16
|
+
level: 'section',
|
|
17
|
+
label: 'Props'
|
|
18
|
+
};
|
|
19
|
+
export const Subsection = Template.bind({});
|
|
20
|
+
Subsection.args = {
|
|
21
|
+
level: 'subsection',
|
|
22
|
+
label: 'HTMLElement'
|
|
23
|
+
};
|
|
24
|
+
export const Collapsed = Template.bind({});
|
|
25
|
+
Collapsed.args = Object.assign({}, Section.args, {
|
|
26
|
+
initialExpanded: false
|
|
27
|
+
});
|
|
28
|
+
export const Nested = () => /*#__PURE__*/React.createElement(SectionRow, Section.args, /*#__PURE__*/React.createElement(SectionRow, Subsection.args, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", {
|
|
29
|
+
colSpan: 2
|
|
30
|
+
}, "Some content"))));
|
|
31
|
+
Nested.displayName = "Nested";
|
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { ArgsTable } from './ArgsTable';
|
|
7
|
+
import { TabsState } from '../../tabs/tabs';
|
|
8
|
+
export const TabbedArgsTable = (_ref) => {
|
|
9
|
+
let {
|
|
10
|
+
tabs
|
|
11
|
+
} = _ref,
|
|
12
|
+
props = _objectWithoutPropertiesLoose(_ref, ["tabs"]);
|
|
13
|
+
|
|
14
|
+
const entries = Object.entries(tabs);
|
|
15
|
+
|
|
16
|
+
if (entries.length === 1) {
|
|
17
|
+
return /*#__PURE__*/React.createElement(ArgsTable, _extends({}, entries[0][1], props));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return /*#__PURE__*/React.createElement(TabsState, null, entries.map(entry => {
|
|
21
|
+
const [label, table] = entry;
|
|
22
|
+
const id = `prop_table_div_${label}`;
|
|
23
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
24
|
+
key: id,
|
|
25
|
+
id: id,
|
|
26
|
+
title: label
|
|
27
|
+
}, ({
|
|
28
|
+
active
|
|
29
|
+
}) => active ? /*#__PURE__*/React.createElement(ArgsTable, _extends({
|
|
30
|
+
key: `prop_table_${label}`
|
|
31
|
+
}, table, props)) : null);
|
|
32
|
+
}));
|
|
33
|
+
};
|
|
34
|
+
TabbedArgsTable.displayName = "TabbedArgsTable";
|