@storybook/cli 7.0.0-alpha.16 → 7.0.0-alpha.19
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/add.js +0 -2
- package/dist/cjs/automigrate/fixes/angular12.js +0 -2
- package/dist/cjs/automigrate/fixes/builder-vite.js +0 -2
- package/dist/cjs/automigrate/fixes/cra5.js +0 -2
- package/dist/cjs/automigrate/fixes/eslint-plugin.js +0 -2
- package/dist/cjs/automigrate/fixes/index.js +3 -1
- package/dist/cjs/automigrate/fixes/mainjsFramework.js +0 -2
- package/dist/cjs/automigrate/fixes/npm7.js +0 -2
- package/dist/cjs/automigrate/fixes/sb-scripts.js +140 -0
- package/dist/cjs/automigrate/fixes/vue3.js +0 -2
- package/dist/cjs/automigrate/fixes/webpack5.js +0 -2
- package/dist/cjs/automigrate/index.js +0 -2
- package/dist/cjs/babel-config.js +0 -2
- package/dist/cjs/build.js +0 -2
- package/dist/cjs/dev.js +0 -2
- package/dist/cjs/dirs.js +12 -0
- package/dist/cjs/extract.js +0 -2
- package/dist/cjs/generate.js +21 -7
- package/dist/cjs/generators/ANGULAR/angular-helpers.js +0 -2
- package/dist/cjs/generators/ANGULAR/index.js +0 -2
- package/dist/cjs/generators/ANGULAR/template-csf/.storybook/tsconfig.json +5 -16
- package/dist/cjs/generators/AURELIA/index.js +0 -2
- package/dist/cjs/generators/AURELIA/template-csf/.storybook/tsconfig.json +5 -16
- package/dist/cjs/generators/EMBER/index.js +0 -2
- package/dist/cjs/generators/HTML/index.js +0 -2
- package/dist/cjs/generators/MARIONETTE/index.js +0 -2
- package/dist/cjs/generators/MARKO/index.js +0 -2
- package/dist/cjs/generators/MITHRIL/index.js +0 -2
- package/dist/cjs/generators/PREACT/index.js +0 -2
- package/dist/cjs/generators/RAX/index.js +0 -2
- package/dist/cjs/generators/REACT/index.js +0 -2
- package/dist/cjs/generators/REACT_NATIVE/index.js +0 -2
- package/dist/cjs/generators/REACT_NATIVE/template-csf/storybook/addons.js +7 -3
- package/dist/cjs/generators/REACT_NATIVE/template-csf/storybook/index.js +21 -15
- package/dist/cjs/generators/REACT_NATIVE/template-csf/storybook/rn-addons.js +5 -2
- package/dist/cjs/generators/REACT_NATIVE/template-csf/storybook/stories/Button/Button.stories.js +23 -20
- package/dist/cjs/generators/REACT_NATIVE/template-csf/storybook/stories/Button/index.js +25 -10
- package/dist/cjs/generators/REACT_NATIVE/template-csf/storybook/stories/CenterView/index.js +25 -10
- package/dist/cjs/generators/REACT_NATIVE/template-csf/storybook/stories/CenterView/style.js +10 -3
- package/dist/cjs/generators/REACT_NATIVE/template-csf/storybook/stories/Welcome/Welcome.stories.js +14 -5
- package/dist/cjs/generators/REACT_NATIVE/template-csf/storybook/stories/Welcome/index.js +60 -49
- package/dist/cjs/generators/REACT_NATIVE/template-csf/storybook/stories/index.js +5 -2
- package/dist/cjs/generators/REACT_SCRIPTS/index.js +0 -2
- package/dist/cjs/generators/RIOT/index.js +0 -2
- package/dist/cjs/generators/SERVER/index.js +0 -2
- package/dist/cjs/generators/SERVER/template-csf/.storybook/preview.js +10 -3
- package/dist/cjs/generators/SFC_VUE/index.js +0 -2
- package/dist/cjs/generators/SVELTE/index.js +0 -2
- package/dist/cjs/generators/VUE/index.js +0 -2
- package/dist/cjs/generators/VUE3/index.js +0 -2
- package/dist/cjs/generators/WEB-COMPONENTS/index.js +0 -2
- package/dist/cjs/generators/WEBPACK_REACT/index.js +0 -2
- package/dist/cjs/generators/baseGenerator.js +0 -2
- package/dist/cjs/generators/configure.js +0 -2
- package/dist/cjs/helpers.js +28 -5
- package/dist/cjs/initiate.js +0 -4
- package/dist/cjs/js-package-manager/JsPackageManager.js +46 -12
- package/dist/cjs/js-package-manager/NPMProxy.js +14 -0
- package/dist/cjs/js-package-manager/Yarn1Proxy.js +5 -0
- package/dist/cjs/js-package-manager/Yarn2Proxy.js +5 -0
- package/dist/cjs/link.js +8 -7
- package/dist/cjs/migrate.js +0 -2
- package/dist/cjs/repro-generators/scripts.js +30 -9
- package/dist/cjs/repro-next.js +182 -0
- package/dist/cjs/repro-templates.js +28 -0
- package/dist/cjs/repro.js +2 -4
- package/dist/cjs/upgrade.js +0 -4
- package/dist/cjs/versions.js +75 -75
- package/dist/esm/NpmOptions.js +0 -1
- package/dist/esm/add.js +24 -54
- package/dist/esm/automigrate/fixes/angular12.js +14 -32
- package/dist/esm/automigrate/fixes/builder-vite.js +16 -34
- package/dist/esm/automigrate/fixes/cra5.js +15 -33
- package/dist/esm/automigrate/fixes/eslint-plugin.js +16 -33
- package/dist/esm/automigrate/fixes/index.js +11 -41
- package/dist/esm/automigrate/fixes/mainjsFramework.js +17 -37
- package/dist/esm/automigrate/fixes/npm7.js +7 -21
- package/dist/esm/automigrate/fixes/sb-scripts.js +119 -0
- package/dist/esm/automigrate/fixes/vue3.js +15 -34
- package/dist/esm/automigrate/fixes/webpack5.js +24 -46
- package/dist/esm/automigrate/helpers/getEslintInfo.js +6 -20
- package/dist/esm/automigrate/index.js +18 -38
- package/dist/esm/automigrate/types.js +1 -5
- package/dist/esm/babel-config.js +14 -39
- package/dist/esm/build.js +10 -26
- package/dist/esm/detect-nextjs.js +2 -11
- package/dist/esm/detect-webpack.js +2 -11
- package/dist/esm/detect.js +33 -61
- package/dist/esm/dev.js +20 -41
- package/dist/esm/dirs.js +4 -0
- package/dist/esm/extract.js +17 -35
- package/dist/esm/generate.js +72 -111
- package/dist/esm/generators/ANGULAR/angular-helpers.js +17 -43
- package/dist/esm/generators/ANGULAR/index.js +17 -38
- package/dist/esm/generators/ANGULAR/template-csf/.storybook/tsconfig.json +5 -16
- package/dist/esm/generators/AURELIA/index.js +7 -18
- package/dist/esm/generators/AURELIA/template-csf/.storybook/tsconfig.json +5 -16
- package/dist/esm/generators/EMBER/index.js +3 -13
- package/dist/esm/generators/HTML/index.js +3 -13
- package/dist/esm/generators/MARIONETTE/index.js +3 -13
- package/dist/esm/generators/MARKO/index.js +3 -13
- package/dist/esm/generators/MITHRIL/index.js +3 -13
- package/dist/esm/generators/PREACT/index.js +3 -13
- package/dist/esm/generators/RAX/index.js +5 -16
- package/dist/esm/generators/REACT/index.js +3 -13
- package/dist/esm/generators/REACT_NATIVE/index.js +9 -24
- package/dist/esm/generators/REACT_NATIVE/template-csf/storybook/addons.js +1 -1
- package/dist/esm/generators/REACT_NATIVE/template-csf/storybook/index.js +6 -13
- package/dist/esm/generators/REACT_NATIVE/template-csf/storybook/rn-addons.js +1 -1
- package/dist/esm/generators/REACT_NATIVE/template-csf/storybook/stories/Button/Button.stories.js +5 -13
- package/dist/esm/generators/REACT_NATIVE/template-csf/storybook/stories/Button/index.js +10 -8
- package/dist/esm/generators/REACT_NATIVE/template-csf/storybook/stories/CenterView/index.js +9 -8
- package/dist/esm/generators/REACT_NATIVE/template-csf/storybook/stories/CenterView/style.js +3 -3
- package/dist/esm/generators/REACT_NATIVE/template-csf/storybook/stories/Welcome/Welcome.stories.js +3 -2
- package/dist/esm/generators/REACT_NATIVE/template-csf/storybook/stories/Welcome/index.js +41 -44
- package/dist/esm/generators/REACT_NATIVE/template-csf/storybook/stories/index.js +1 -1
- package/dist/esm/generators/REACT_SCRIPTS/index.js +12 -33
- package/dist/esm/generators/RIOT/index.js +3 -13
- package/dist/esm/generators/SERVER/index.js +5 -16
- package/dist/esm/generators/SERVER/template-csf/.storybook/preview.js +3 -3
- package/dist/esm/generators/SFC_VUE/index.js +3 -13
- package/dist/esm/generators/SVELTE/index.js +10 -27
- package/dist/esm/generators/VUE/index.js +3 -13
- package/dist/esm/generators/VUE3/index.js +3 -13
- package/dist/esm/generators/WEB-COMPONENTS/index.js +3 -13
- package/dist/esm/generators/WEBPACK_REACT/index.js +3 -13
- package/dist/esm/generators/baseGenerator.js +25 -44
- package/dist/esm/generators/configure.js +10 -26
- package/dist/esm/generators/types.js +1 -5
- package/dist/esm/helpers.js +65 -94
- package/dist/esm/initiate.js +105 -150
- package/dist/esm/js-package-manager/JsPackageManager.js +72 -59
- package/dist/esm/js-package-manager/JsPackageManagerFactory.js +12 -26
- package/dist/esm/js-package-manager/NPMProxy.js +19 -18
- package/dist/esm/js-package-manager/PackageJson.js +1 -5
- package/dist/esm/js-package-manager/PackageJsonHelper.js +9 -25
- package/dist/esm/js-package-manager/Yarn1Proxy.js +8 -13
- package/dist/esm/js-package-manager/Yarn2Proxy.js +8 -13
- package/dist/esm/js-package-manager/index.js +4 -57
- package/dist/esm/link.js +35 -64
- package/dist/esm/migrate.js +4 -14
- package/dist/esm/project_types.js +13 -28
- package/dist/esm/repro-generators/configs.js +21 -48
- package/dist/esm/repro-generators/scripts.js +61 -71
- package/dist/esm/repro-next.js +163 -0
- package/dist/esm/repro-templates.js +21 -0
- package/dist/esm/repro.js +29 -55
- package/dist/esm/upgrade.js +33 -75
- package/dist/esm/utils.js +2 -11
- package/dist/esm/versions.js +77 -84
- package/dist/esm/warn.js +9 -25
- package/dist/esm/window.d.js +1 -5
- package/dist/types/automigrate/fixes/sb-scripts.d.ts +23 -0
- package/dist/types/dirs.d.ts +1 -0
- package/dist/types/helpers.d.ts +1 -0
- package/dist/types/js-package-manager/JsPackageManager.d.ts +16 -0
- package/dist/types/js-package-manager/NPMProxy.d.ts +3 -0
- package/dist/types/js-package-manager/Yarn1Proxy.d.ts +1 -0
- package/dist/types/js-package-manager/Yarn2Proxy.d.ts +1 -0
- package/dist/types/link.d.ts +2 -1
- package/dist/types/repro-generators/scripts.d.ts +4 -2
- package/dist/types/repro-next.d.ts +8 -0
- package/dist/types/repro-templates.d.ts +21 -0
- package/dist/types/repro.d.ts +2 -1
- package/package.json +14 -10
- package/LICENSE +0 -21
- package/dist/cjs/frameworks/angular/Button.stories.ts +0 -44
- package/dist/cjs/frameworks/angular/Header.stories.ts +0 -35
- package/dist/cjs/frameworks/angular/Page.stories.ts +0 -36
- package/dist/cjs/frameworks/angular/User.ts +0 -2
- package/dist/cjs/frameworks/angular/button.component.ts +0 -53
- package/dist/cjs/frameworks/angular/header.component.ts +0 -75
- package/dist/cjs/frameworks/angular/page.component.ts +0 -77
- package/dist/cjs/frameworks/aurelia/1-Button.stories.ts +0 -49
- package/dist/cjs/frameworks/aurelia/button.ts +0 -28
- package/dist/cjs/frameworks/common/Introduction.stories.mdx +0 -211
- package/dist/cjs/frameworks/common/assets/code-brackets.svg +0 -1
- package/dist/cjs/frameworks/common/assets/colors.svg +0 -1
- package/dist/cjs/frameworks/common/assets/comments.svg +0 -1
- package/dist/cjs/frameworks/common/assets/direction.svg +0 -1
- package/dist/cjs/frameworks/common/assets/flow.svg +0 -1
- package/dist/cjs/frameworks/common/assets/plugin.svg +0 -1
- package/dist/cjs/frameworks/common/assets/repo.svg +0 -1
- package/dist/cjs/frameworks/common/assets/stackalt.svg +0 -1
- package/dist/cjs/frameworks/common/button.css +0 -30
- package/dist/cjs/frameworks/common/header.css +0 -32
- package/dist/cjs/frameworks/common/page.css +0 -69
- package/dist/cjs/frameworks/ember/1-Button.stories.js +0 -57
- package/dist/cjs/frameworks/html/js/Button.js +0 -21
- package/dist/cjs/frameworks/html/js/Button.stories.js +0 -48
- package/dist/cjs/frameworks/html/js/Header.js +0 -47
- package/dist/cjs/frameworks/html/js/Header.stories.js +0 -27
- package/dist/cjs/frameworks/html/js/Page.js +0 -94
- package/dist/cjs/frameworks/html/js/Page.stories.js +0 -23
- package/dist/cjs/frameworks/html/ts/Button.stories.ts +0 -49
- package/dist/cjs/frameworks/html/ts/Button.ts +0 -51
- package/dist/cjs/frameworks/html/ts/Header.stories.ts +0 -26
- package/dist/cjs/frameworks/html/ts/Header.ts +0 -54
- package/dist/cjs/frameworks/html/ts/Page.stories.ts +0 -24
- package/dist/cjs/frameworks/html/ts/Page.ts +0 -98
- package/dist/cjs/frameworks/marionette/index.stories.js +0 -20
- package/dist/cjs/frameworks/marko/1-Button.stories.js +0 -24
- package/dist/cjs/frameworks/marko/Button.marko +0 -13
- package/dist/cjs/frameworks/mithril/Button.js +0 -22
- package/dist/cjs/frameworks/mithril/Button.stories.js +0 -43
- package/dist/cjs/frameworks/mithril/Header.js +0 -51
- package/dist/cjs/frameworks/mithril/Header.stories.js +0 -20
- package/dist/cjs/frameworks/mithril/Page.js +0 -70
- package/dist/cjs/frameworks/mithril/Page.stories.js +0 -24
- package/dist/cjs/frameworks/preact/Button.jsx +0 -51
- package/dist/cjs/frameworks/preact/Button.stories.jsx +0 -41
- package/dist/cjs/frameworks/preact/Header.jsx +0 -58
- package/dist/cjs/frameworks/preact/Header.stories.jsx +0 -29
- package/dist/cjs/frameworks/preact/Page.jsx +0 -71
- package/dist/cjs/frameworks/preact/Page.stories.jsx +0 -26
- package/dist/cjs/frameworks/rax/Button.js +0 -26
- package/dist/cjs/frameworks/rax/Button.stories.js +0 -40
- package/dist/cjs/frameworks/rax/Header.js +0 -44
- package/dist/cjs/frameworks/rax/Header.stories.js +0 -17
- package/dist/cjs/frameworks/rax/Page.js +0 -64
- package/dist/cjs/frameworks/rax/Page.stories.js +0 -21
- package/dist/cjs/frameworks/react/js/Button.jsx +0 -50
- package/dist/cjs/frameworks/react/js/Button.stories.jsx +0 -40
- package/dist/cjs/frameworks/react/js/Header.jsx +0 -57
- package/dist/cjs/frameworks/react/js/Header.stories.jsx +0 -24
- package/dist/cjs/frameworks/react/js/Page.jsx +0 -69
- package/dist/cjs/frameworks/react/js/Page.stories.jsx +0 -25
- package/dist/cjs/frameworks/react/ts/Button.stories.tsx +0 -41
- package/dist/cjs/frameworks/react/ts/Button.tsx +0 -48
- package/dist/cjs/frameworks/react/ts/Header.stories.tsx +0 -25
- package/dist/cjs/frameworks/react/ts/Header.tsx +0 -56
- package/dist/cjs/frameworks/react/ts/Page.stories.tsx +0 -26
- package/dist/cjs/frameworks/react/ts/Page.tsx +0 -73
- package/dist/cjs/frameworks/riot/1-Button.stories.js +0 -52
- package/dist/cjs/frameworks/riot/MyButton.tag +0 -24
- package/dist/cjs/frameworks/server/button.stories.json +0 -32
- package/dist/cjs/frameworks/server/header.stories.json +0 -15
- package/dist/cjs/frameworks/server/page.stories.json +0 -15
- package/dist/cjs/frameworks/svelte/Button.stories.js +0 -51
- package/dist/cjs/frameworks/svelte/Button.svelte +0 -42
- package/dist/cjs/frameworks/svelte/Header.stories.js +0 -35
- package/dist/cjs/frameworks/svelte/Header.svelte +0 -51
- package/dist/cjs/frameworks/svelte/Page.stories.js +0 -27
- package/dist/cjs/frameworks/svelte/Page.svelte +0 -63
- package/dist/cjs/frameworks/vue/Button.stories.js +0 -46
- package/dist/cjs/frameworks/vue/Button.vue +0 -54
- package/dist/cjs/frameworks/vue/Header.stories.js +0 -27
- package/dist/cjs/frameworks/vue/Header.vue +0 -60
- package/dist/cjs/frameworks/vue/Page.stories.js +0 -27
- package/dist/cjs/frameworks/vue/Page.vue +0 -88
- package/dist/cjs/frameworks/vue3/Button.stories.js +0 -52
- package/dist/cjs/frameworks/vue3/Button.vue +0 -52
- package/dist/cjs/frameworks/vue3/Header.stories.js +0 -34
- package/dist/cjs/frameworks/vue3/Header.vue +0 -50
- package/dist/cjs/frameworks/vue3/Page.stories.js +0 -29
- package/dist/cjs/frameworks/vue3/Page.vue +0 -88
- package/dist/cjs/frameworks/web-components/js/Button.js +0 -21
- package/dist/cjs/frameworks/web-components/js/Button.stories.js +0 -42
- package/dist/cjs/frameworks/web-components/js/Header.js +0 -45
- package/dist/cjs/frameworks/web-components/js/Header.stories.js +0 -15
- package/dist/cjs/frameworks/web-components/js/Page.js +0 -61
- package/dist/cjs/frameworks/web-components/js/Page.stories.js +0 -19
- package/dist/cjs/frameworks/web-components/ts/Button.stories.ts +0 -43
- package/dist/cjs/frameworks/web-components/ts/Button.ts +0 -43
- package/dist/cjs/frameworks/web-components/ts/Header.stories.ts +0 -16
- package/dist/cjs/frameworks/web-components/ts/Header.ts +0 -52
- package/dist/cjs/frameworks/web-components/ts/Page.stories.ts +0 -20
- package/dist/cjs/frameworks/web-components/ts/Page.ts +0 -68
- package/dist/esm/frameworks/angular/Button.stories.ts +0 -44
- package/dist/esm/frameworks/angular/Header.stories.ts +0 -35
- package/dist/esm/frameworks/angular/Page.stories.ts +0 -36
- package/dist/esm/frameworks/angular/User.ts +0 -2
- package/dist/esm/frameworks/angular/button.component.ts +0 -53
- package/dist/esm/frameworks/angular/header.component.ts +0 -75
- package/dist/esm/frameworks/angular/page.component.ts +0 -77
- package/dist/esm/frameworks/aurelia/1-Button.stories.ts +0 -49
- package/dist/esm/frameworks/aurelia/button.ts +0 -28
- package/dist/esm/frameworks/common/Introduction.stories.mdx +0 -211
- package/dist/esm/frameworks/common/assets/code-brackets.svg +0 -1
- package/dist/esm/frameworks/common/assets/colors.svg +0 -1
- package/dist/esm/frameworks/common/assets/comments.svg +0 -1
- package/dist/esm/frameworks/common/assets/direction.svg +0 -1
- package/dist/esm/frameworks/common/assets/flow.svg +0 -1
- package/dist/esm/frameworks/common/assets/plugin.svg +0 -1
- package/dist/esm/frameworks/common/assets/repo.svg +0 -1
- package/dist/esm/frameworks/common/assets/stackalt.svg +0 -1
- package/dist/esm/frameworks/common/button.css +0 -30
- package/dist/esm/frameworks/common/header.css +0 -32
- package/dist/esm/frameworks/common/page.css +0 -69
- package/dist/esm/frameworks/ember/1-Button.stories.js +0 -57
- package/dist/esm/frameworks/html/js/Button.js +0 -21
- package/dist/esm/frameworks/html/js/Button.stories.js +0 -48
- package/dist/esm/frameworks/html/js/Header.js +0 -47
- package/dist/esm/frameworks/html/js/Header.stories.js +0 -27
- package/dist/esm/frameworks/html/js/Page.js +0 -94
- package/dist/esm/frameworks/html/js/Page.stories.js +0 -23
- package/dist/esm/frameworks/html/ts/Button.stories.ts +0 -49
- package/dist/esm/frameworks/html/ts/Button.ts +0 -51
- package/dist/esm/frameworks/html/ts/Header.stories.ts +0 -26
- package/dist/esm/frameworks/html/ts/Header.ts +0 -54
- package/dist/esm/frameworks/html/ts/Page.stories.ts +0 -24
- package/dist/esm/frameworks/html/ts/Page.ts +0 -98
- package/dist/esm/frameworks/marionette/index.stories.js +0 -20
- package/dist/esm/frameworks/marko/1-Button.stories.js +0 -24
- package/dist/esm/frameworks/marko/Button.marko +0 -13
- package/dist/esm/frameworks/mithril/Button.js +0 -22
- package/dist/esm/frameworks/mithril/Button.stories.js +0 -43
- package/dist/esm/frameworks/mithril/Header.js +0 -51
- package/dist/esm/frameworks/mithril/Header.stories.js +0 -20
- package/dist/esm/frameworks/mithril/Page.js +0 -70
- package/dist/esm/frameworks/mithril/Page.stories.js +0 -24
- package/dist/esm/frameworks/preact/Button.jsx +0 -51
- package/dist/esm/frameworks/preact/Button.stories.jsx +0 -41
- package/dist/esm/frameworks/preact/Header.jsx +0 -58
- package/dist/esm/frameworks/preact/Header.stories.jsx +0 -29
- package/dist/esm/frameworks/preact/Page.jsx +0 -71
- package/dist/esm/frameworks/preact/Page.stories.jsx +0 -26
- package/dist/esm/frameworks/rax/Button.js +0 -26
- package/dist/esm/frameworks/rax/Button.stories.js +0 -40
- package/dist/esm/frameworks/rax/Header.js +0 -44
- package/dist/esm/frameworks/rax/Header.stories.js +0 -17
- package/dist/esm/frameworks/rax/Page.js +0 -64
- package/dist/esm/frameworks/rax/Page.stories.js +0 -21
- package/dist/esm/frameworks/react/js/Button.jsx +0 -50
- package/dist/esm/frameworks/react/js/Button.stories.jsx +0 -40
- package/dist/esm/frameworks/react/js/Header.jsx +0 -57
- package/dist/esm/frameworks/react/js/Header.stories.jsx +0 -24
- package/dist/esm/frameworks/react/js/Page.jsx +0 -69
- package/dist/esm/frameworks/react/js/Page.stories.jsx +0 -25
- package/dist/esm/frameworks/react/ts/Button.stories.tsx +0 -41
- package/dist/esm/frameworks/react/ts/Button.tsx +0 -48
- package/dist/esm/frameworks/react/ts/Header.stories.tsx +0 -25
- package/dist/esm/frameworks/react/ts/Header.tsx +0 -56
- package/dist/esm/frameworks/react/ts/Page.stories.tsx +0 -26
- package/dist/esm/frameworks/react/ts/Page.tsx +0 -73
- package/dist/esm/frameworks/riot/1-Button.stories.js +0 -52
- package/dist/esm/frameworks/riot/MyButton.tag +0 -24
- package/dist/esm/frameworks/server/button.stories.json +0 -32
- package/dist/esm/frameworks/server/header.stories.json +0 -15
- package/dist/esm/frameworks/server/page.stories.json +0 -15
- package/dist/esm/frameworks/svelte/Button.stories.js +0 -51
- package/dist/esm/frameworks/svelte/Button.svelte +0 -42
- package/dist/esm/frameworks/svelte/Header.stories.js +0 -35
- package/dist/esm/frameworks/svelte/Header.svelte +0 -51
- package/dist/esm/frameworks/svelte/Page.stories.js +0 -27
- package/dist/esm/frameworks/svelte/Page.svelte +0 -63
- package/dist/esm/frameworks/vue/Button.stories.js +0 -46
- package/dist/esm/frameworks/vue/Button.vue +0 -54
- package/dist/esm/frameworks/vue/Header.stories.js +0 -27
- package/dist/esm/frameworks/vue/Header.vue +0 -60
- package/dist/esm/frameworks/vue/Page.stories.js +0 -27
- package/dist/esm/frameworks/vue/Page.vue +0 -88
- package/dist/esm/frameworks/vue3/Button.stories.js +0 -52
- package/dist/esm/frameworks/vue3/Button.vue +0 -52
- package/dist/esm/frameworks/vue3/Header.stories.js +0 -34
- package/dist/esm/frameworks/vue3/Header.vue +0 -50
- package/dist/esm/frameworks/vue3/Page.stories.js +0 -29
- package/dist/esm/frameworks/vue3/Page.vue +0 -88
- package/dist/esm/frameworks/web-components/js/Button.js +0 -21
- package/dist/esm/frameworks/web-components/js/Button.stories.js +0 -42
- package/dist/esm/frameworks/web-components/js/Header.js +0 -45
- package/dist/esm/frameworks/web-components/js/Header.stories.js +0 -15
- package/dist/esm/frameworks/web-components/js/Page.js +0 -61
- package/dist/esm/frameworks/web-components/js/Page.stories.js +0 -19
- package/dist/esm/frameworks/web-components/ts/Button.stories.ts +0 -43
- package/dist/esm/frameworks/web-components/ts/Button.ts +0 -43
- package/dist/esm/frameworks/web-components/ts/Header.stories.ts +0 -16
- package/dist/esm/frameworks/web-components/ts/Header.ts +0 -52
- package/dist/esm/frameworks/web-components/ts/Page.stories.ts +0 -20
- package/dist/esm/frameworks/web-components/ts/Page.ts +0 -68
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
/** @jsx m */
|
|
2
|
-
|
|
3
|
-
import m from 'mithril';
|
|
4
|
-
|
|
5
|
-
import { Header } from './Header';
|
|
6
|
-
import './page.css';
|
|
7
|
-
|
|
8
|
-
export const Page = {
|
|
9
|
-
view: ({ attrs }) => (
|
|
10
|
-
<article>
|
|
11
|
-
<div>
|
|
12
|
-
{m(Header, {
|
|
13
|
-
user: attrs.user,
|
|
14
|
-
onLogin: attrs.onLogin,
|
|
15
|
-
onLogout: attrs.onLogout,
|
|
16
|
-
onCreateAccount: attrs.onCreateAccount,
|
|
17
|
-
})}
|
|
18
|
-
</div>
|
|
19
|
-
<section>
|
|
20
|
-
<h2>Pages in Storybook</h2>
|
|
21
|
-
<p>
|
|
22
|
-
We recommend building UIs with a{' '}
|
|
23
|
-
<a href="https://componentdriven.org" target="_blank" rel="noopener noreferrer">
|
|
24
|
-
<strong>component-driven</strong>
|
|
25
|
-
</a>{' '}
|
|
26
|
-
process starting with atomic components and ending with pages.
|
|
27
|
-
</p>
|
|
28
|
-
<p>
|
|
29
|
-
Render pages with mock data. This makes it easy to build and review page states without
|
|
30
|
-
needing to navigate to them in your app. Here are some handy patterns for managing page
|
|
31
|
-
data in Storybook:
|
|
32
|
-
</p>
|
|
33
|
-
<ul>
|
|
34
|
-
<li>
|
|
35
|
-
Use a higher-level connected component. Storybook helps you compose such data from the
|
|
36
|
-
"args" of child component stories
|
|
37
|
-
</li>
|
|
38
|
-
<li>
|
|
39
|
-
Assemble data in the page component from your services. You can mock these services out
|
|
40
|
-
using Storybook.
|
|
41
|
-
</li>
|
|
42
|
-
</ul>
|
|
43
|
-
<p>
|
|
44
|
-
Get a guided tutorial on component-driven development at{' '}
|
|
45
|
-
<a href="https://storybook.js.org/tutorials/" target="_blank" rel="noopener noreferrer">
|
|
46
|
-
Storybook tutorials
|
|
47
|
-
</a>
|
|
48
|
-
. Read more in the{' '}
|
|
49
|
-
<a href="https://storybook.js.org/docs" target="_blank" rel="noopener noreferrer">
|
|
50
|
-
docs
|
|
51
|
-
</a>
|
|
52
|
-
.
|
|
53
|
-
</p>
|
|
54
|
-
<div class="tip-wrapper">
|
|
55
|
-
<span class="tip">Tip</span> Adjust the width of the canvas with the{' '}
|
|
56
|
-
<svg width="10" height="10" viewBox="0 0 12 12" xmlns="http://www.w3.org/2000/svg">
|
|
57
|
-
<g fill="none" fillRule="evenodd">
|
|
58
|
-
<path
|
|
59
|
-
d="M1.5 5.2h4.8c.3 0 .5.2.5.4v5.1c-.1.2-.3.3-.4.3H1.4a.5.5 0 01-.5-.4V5.7c0-.3.2-.5.5-.5zm0-2.1h6.9c.3 0 .5.2.5.4v7a.5.5 0 01-1 0V4H1.5a.5.5 0 010-1zm0-2.1h9c.3 0 .5.2.5.4v9.1a.5.5 0 01-1 0V2H1.5a.5.5 0 010-1zm4.3 5.2H2V10h3.8V6.2z"
|
|
60
|
-
id="a"
|
|
61
|
-
fill="#999"
|
|
62
|
-
/>
|
|
63
|
-
</g>
|
|
64
|
-
</svg>
|
|
65
|
-
Viewports addon in the toolbar
|
|
66
|
-
</div>
|
|
67
|
-
</section>
|
|
68
|
-
</article>
|
|
69
|
-
),
|
|
70
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import m from 'mithril';
|
|
2
|
-
|
|
3
|
-
import { Page } from './Page';
|
|
4
|
-
import * as HeaderStories from './Header.stories';
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
title: 'Example/Page',
|
|
8
|
-
component: Page,
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
const Template = ({ children, ...args }) => ({
|
|
12
|
-
view: () => m(Page, args, children),
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
export const LoggedIn = Template.bind({});
|
|
16
|
-
LoggedIn.args = {
|
|
17
|
-
// More on composing args: https://storybook.js.org/docs/mithril/writing-stories/args#args-composition
|
|
18
|
-
...HeaderStories.LoggedIn.args,
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export const LoggedOut = Template.bind({});
|
|
22
|
-
LoggedOut.args = {
|
|
23
|
-
...HeaderStories.LoggedOut.args,
|
|
24
|
-
};
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/** @jsx h */
|
|
2
|
-
import { h } from 'preact';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import './button.css';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Primary UI component for user interaction
|
|
8
|
-
*/
|
|
9
|
-
export const Button = ({ primary, backgroundColor, size, label, ...props }) => {
|
|
10
|
-
const mode = primary ? 'storybook-button--primary' : 'storybook-button--secondary';
|
|
11
|
-
return (
|
|
12
|
-
<button
|
|
13
|
-
type="button"
|
|
14
|
-
className={['storybook-button', `storybook-button--${size}`, mode].join(' ')}
|
|
15
|
-
style={backgroundColor && { backgroundColor }}
|
|
16
|
-
{...props}
|
|
17
|
-
>
|
|
18
|
-
{label}
|
|
19
|
-
</button>
|
|
20
|
-
);
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
Button.propTypes = {
|
|
24
|
-
/**
|
|
25
|
-
* Is this the principal call to action on the page?
|
|
26
|
-
*/
|
|
27
|
-
primary: PropTypes.bool,
|
|
28
|
-
/**
|
|
29
|
-
* What background color to use
|
|
30
|
-
*/
|
|
31
|
-
backgroundColor: PropTypes.string,
|
|
32
|
-
/**
|
|
33
|
-
* How large should the button be?
|
|
34
|
-
*/
|
|
35
|
-
size: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
36
|
-
/**
|
|
37
|
-
* Button contents
|
|
38
|
-
*/
|
|
39
|
-
label: PropTypes.string.isRequired,
|
|
40
|
-
/**
|
|
41
|
-
* Optional click handler
|
|
42
|
-
*/
|
|
43
|
-
onClick: PropTypes.func,
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
Button.defaultProps = {
|
|
47
|
-
backgroundColor: null,
|
|
48
|
-
primary: false,
|
|
49
|
-
size: 'medium',
|
|
50
|
-
onClick: undefined,
|
|
51
|
-
};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/** @jsx h */
|
|
2
|
-
import { h } from 'preact';
|
|
3
|
-
import { Button } from './Button';
|
|
4
|
-
|
|
5
|
-
// More on default export: https://storybook.js.org/docs/preact/writing-stories/introduction#default-export
|
|
6
|
-
export default {
|
|
7
|
-
title: 'Example/Button',
|
|
8
|
-
component: Button,
|
|
9
|
-
// More on argTypes: https://storybook.js.org/docs/preact/api/argtypes
|
|
10
|
-
argTypes: {
|
|
11
|
-
backgroundColor: { control: 'color' },
|
|
12
|
-
onClick: { action: 'onClick' },
|
|
13
|
-
},
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
// More on component templates: https://storybook.js.org/docs/preact/writing-stories/introduction#using-args
|
|
17
|
-
const Template = (args) => <Button {...args} />;
|
|
18
|
-
|
|
19
|
-
export const Primary = Template.bind({});
|
|
20
|
-
// More on args: https://storybook.js.org/docs/preact/writing-stories/args
|
|
21
|
-
Primary.args = {
|
|
22
|
-
primary: true,
|
|
23
|
-
label: 'Button',
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export const Secondary = Template.bind({});
|
|
27
|
-
Secondary.args = {
|
|
28
|
-
label: 'Button',
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export const Large = Template.bind({});
|
|
32
|
-
Large.args = {
|
|
33
|
-
size: 'large',
|
|
34
|
-
label: 'Button',
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export const Small = Template.bind({});
|
|
38
|
-
Small.args = {
|
|
39
|
-
size: 'small',
|
|
40
|
-
label: 'Button',
|
|
41
|
-
};
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/** @jsx h */
|
|
2
|
-
import { h, Fragment } from 'preact';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
|
|
5
|
-
import { Button } from './Button';
|
|
6
|
-
import './header.css';
|
|
7
|
-
|
|
8
|
-
export const Header = ({ user, onLogin, onLogout, onCreateAccount }) => (
|
|
9
|
-
<header>
|
|
10
|
-
<div className="wrapper">
|
|
11
|
-
<div>
|
|
12
|
-
<svg width="32" height="32" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">
|
|
13
|
-
<g fill="none" fillRule="evenodd">
|
|
14
|
-
<path
|
|
15
|
-
d="M10 0h12a10 10 0 0110 10v12a10 10 0 01-10 10H10A10 10 0 010 22V10A10 10 0 0110 0z"
|
|
16
|
-
fill="#FFF"
|
|
17
|
-
/>
|
|
18
|
-
<path
|
|
19
|
-
d="M5.3 10.6l10.4 6v11.1l-10.4-6v-11zm11.4-6.2l9.7 5.5-9.7 5.6V4.4z"
|
|
20
|
-
fill="#555AB9"
|
|
21
|
-
/>
|
|
22
|
-
<path
|
|
23
|
-
d="M27.2 10.6v11.2l-10.5 6V16.5l10.5-6zM15.7 4.4v11L6 10l9.7-5.5z"
|
|
24
|
-
fill="#91BAF8"
|
|
25
|
-
/>
|
|
26
|
-
</g>
|
|
27
|
-
</svg>
|
|
28
|
-
<h1>Acme</h1>
|
|
29
|
-
</div>
|
|
30
|
-
<div>
|
|
31
|
-
{user ? (
|
|
32
|
-
<Fragment>
|
|
33
|
-
<span className="welcome">
|
|
34
|
-
Welcome, <b>{user.name}</b>!
|
|
35
|
-
</span>
|
|
36
|
-
<Button size="small" onClick={onLogout} label="Log out" />
|
|
37
|
-
</Fragment>
|
|
38
|
-
) : (
|
|
39
|
-
<Fragment>
|
|
40
|
-
<Button size="small" onClick={onLogin} label="Log in" />
|
|
41
|
-
<Button primary size="small" onClick={onCreateAccount} label="Sign up" />
|
|
42
|
-
</Fragment>
|
|
43
|
-
)}
|
|
44
|
-
</div>
|
|
45
|
-
</div>
|
|
46
|
-
</header>
|
|
47
|
-
);
|
|
48
|
-
|
|
49
|
-
Header.propTypes = {
|
|
50
|
-
user: PropTypes.shape({}),
|
|
51
|
-
onLogin: PropTypes.func.isRequired,
|
|
52
|
-
onLogout: PropTypes.func.isRequired,
|
|
53
|
-
onCreateAccount: PropTypes.func.isRequired,
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
Header.defaultProps = {
|
|
57
|
-
user: null,
|
|
58
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/** @jsx h */
|
|
2
|
-
import { h } from 'preact';
|
|
3
|
-
import { Header } from './Header';
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
title: 'Example/Header',
|
|
7
|
-
component: Header,
|
|
8
|
-
parameters: {
|
|
9
|
-
// More on Story layout: https://storybook.js.org/docs/preact/configure/story-layout
|
|
10
|
-
layout: 'fullscreen',
|
|
11
|
-
},
|
|
12
|
-
argTypes: {
|
|
13
|
-
onLogin: { action: 'onLogin' },
|
|
14
|
-
onLogout: { action: 'onLogout' },
|
|
15
|
-
onCreateAccount: { action: 'onCreateAccount' },
|
|
16
|
-
},
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const Template = (args) => <Header {...args} />;
|
|
20
|
-
|
|
21
|
-
export const LoggedIn = Template.bind({});
|
|
22
|
-
LoggedIn.args = {
|
|
23
|
-
user: {
|
|
24
|
-
name: 'Jane Doe',
|
|
25
|
-
},
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export const LoggedOut = Template.bind({});
|
|
29
|
-
LoggedOut.args = {};
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
/** @jsx h */
|
|
2
|
-
import { h } from 'preact';
|
|
3
|
-
import { useState } from 'preact/hooks';
|
|
4
|
-
|
|
5
|
-
import { Header } from './Header';
|
|
6
|
-
import './page.css';
|
|
7
|
-
|
|
8
|
-
export const Page = () => {
|
|
9
|
-
const [user, setUser] = useState();
|
|
10
|
-
|
|
11
|
-
return (
|
|
12
|
-
<article>
|
|
13
|
-
<Header
|
|
14
|
-
user={user}
|
|
15
|
-
onLogin={() => setUser({ name: 'Jane Doe' })}
|
|
16
|
-
onLogout={() => setUser(undefined)}
|
|
17
|
-
onCreateAccount={() => setUser({ name: 'Jane Doe' })}
|
|
18
|
-
/>
|
|
19
|
-
|
|
20
|
-
<section>
|
|
21
|
-
<h2>Pages in Storybook</h2>
|
|
22
|
-
<p>
|
|
23
|
-
We recommend building UIs with a{' '}
|
|
24
|
-
<a href="https://componentdriven.org" target="_blank" rel="noopener noreferrer">
|
|
25
|
-
<strong>component-driven</strong>
|
|
26
|
-
</a>{' '}
|
|
27
|
-
process starting with atomic components and ending with pages.
|
|
28
|
-
</p>
|
|
29
|
-
<p>
|
|
30
|
-
Render pages with mock data. This makes it easy to build and review page states without
|
|
31
|
-
needing to navigate to them in your app. Here are some handy patterns for managing page
|
|
32
|
-
data in Storybook:
|
|
33
|
-
</p>
|
|
34
|
-
<ul>
|
|
35
|
-
<li>
|
|
36
|
-
Use a higher-level connected component. Storybook helps you compose such data from the
|
|
37
|
-
"args" of child component stories
|
|
38
|
-
</li>
|
|
39
|
-
<li>
|
|
40
|
-
Assemble data in the page component from your services. You can mock these services out
|
|
41
|
-
using Storybook.
|
|
42
|
-
</li>
|
|
43
|
-
</ul>
|
|
44
|
-
<p>
|
|
45
|
-
Get a guided tutorial on component-driven development at{' '}
|
|
46
|
-
<a href="https://storybook.js.org/tutorials/" target="_blank" rel="noopener noreferrer">
|
|
47
|
-
Storybook tutorials
|
|
48
|
-
</a>
|
|
49
|
-
. Read more in the{' '}
|
|
50
|
-
<a href="https://storybook.js.org/docs" target="_blank" rel="noopener noreferrer">
|
|
51
|
-
docs
|
|
52
|
-
</a>
|
|
53
|
-
.
|
|
54
|
-
</p>
|
|
55
|
-
<div className="tip-wrapper">
|
|
56
|
-
<span className="tip">Tip</span> Adjust the width of the canvas with the{' '}
|
|
57
|
-
<svg width="10" height="10" viewBox="0 0 12 12" xmlns="http://www.w3.org/2000/svg">
|
|
58
|
-
<g fill="none" fillRule="evenodd">
|
|
59
|
-
<path
|
|
60
|
-
d="M1.5 5.2h4.8c.3 0 .5.2.5.4v5.1c-.1.2-.3.3-.4.3H1.4a.5.5 0 01-.5-.4V5.7c0-.3.2-.5.5-.5zm0-2.1h6.9c.3 0 .5.2.5.4v7a.5.5 0 01-1 0V4H1.5a.5.5 0 010-1zm0-2.1h9c.3 0 .5.2.5.4v9.1a.5.5 0 01-1 0V2H1.5a.5.5 0 010-1zm4.3 5.2H2V10h3.8V6.2z"
|
|
61
|
-
id="a"
|
|
62
|
-
fill="#999"
|
|
63
|
-
/>
|
|
64
|
-
</g>
|
|
65
|
-
</svg>
|
|
66
|
-
Viewports addon in the toolbar
|
|
67
|
-
</div>
|
|
68
|
-
</section>
|
|
69
|
-
</article>
|
|
70
|
-
);
|
|
71
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/** @jsx h */
|
|
2
|
-
import { h } from 'preact';
|
|
3
|
-
import { within, userEvent } from '@storybook/testing-library';
|
|
4
|
-
|
|
5
|
-
import { Page } from './Page';
|
|
6
|
-
|
|
7
|
-
export default {
|
|
8
|
-
title: 'Example/Page',
|
|
9
|
-
component: Page,
|
|
10
|
-
parameters: {
|
|
11
|
-
// More on Story layout: https://storybook.js.org/docs/preact/configure/story-layout
|
|
12
|
-
layout: 'fullscreen',
|
|
13
|
-
},
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
const Template = (args) => <Page {...args} />;
|
|
17
|
-
|
|
18
|
-
export const LoggedOut = Template.bind({});
|
|
19
|
-
|
|
20
|
-
// More on interaction testing: https://storybook.js.org/docs/preact/writing-tests/interaction-testing
|
|
21
|
-
export const LoggedIn = Template.bind({});
|
|
22
|
-
LoggedIn.play = async ({ canvasElement }) => {
|
|
23
|
-
const canvas = within(canvasElement);
|
|
24
|
-
const loginButton = await canvas.getByRole('button', { name: /Log in/i });
|
|
25
|
-
await userEvent.click(loginButton);
|
|
26
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import './button.css';
|
|
2
|
-
import { createElement } from 'rax';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Primary UI component for user interaction
|
|
6
|
-
*/
|
|
7
|
-
export const Button = ({ primary, backgroundColor, size, label, ...props }) => {
|
|
8
|
-
const mode = primary ? 'storybook-button--primary' : 'storybook-button--secondary';
|
|
9
|
-
return (
|
|
10
|
-
<button
|
|
11
|
-
type="button"
|
|
12
|
-
className={['storybook-button', `storybook-button--${size}`, mode].join(' ')}
|
|
13
|
-
style={backgroundColor && { backgroundColor }}
|
|
14
|
-
{...props}
|
|
15
|
-
>
|
|
16
|
-
{label}
|
|
17
|
-
</button>
|
|
18
|
-
);
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
Button.defaultProps = {
|
|
22
|
-
backgroundColor: null,
|
|
23
|
-
primary: false,
|
|
24
|
-
size: 'medium',
|
|
25
|
-
onClick: undefined,
|
|
26
|
-
};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { createElement } from 'rax';
|
|
2
|
-
|
|
3
|
-
import { Button } from './Button';
|
|
4
|
-
|
|
5
|
-
// More on default export: https://storybook.js.org/docs/rax/writing-stories/introduction#default-export
|
|
6
|
-
export default {
|
|
7
|
-
title: 'Example/Button',
|
|
8
|
-
// More on argTypes: https://storybook.js.org/docs/rax/api/argtypes
|
|
9
|
-
argTypes: {
|
|
10
|
-
backgroundColor: { control: 'color' },
|
|
11
|
-
onClick: { action: 'onClick' },
|
|
12
|
-
},
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
// More on component templates: https://storybook.js.org/docs/rax/writing-stories/introduction#using-args
|
|
16
|
-
const Template = (args) => <Button {...args} />;
|
|
17
|
-
|
|
18
|
-
export const Primary = Template.bind({});
|
|
19
|
-
// More on args: https://storybook.js.org/docs/rax/writing-stories/args
|
|
20
|
-
Primary.args = {
|
|
21
|
-
primary: true,
|
|
22
|
-
label: 'Button',
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export const Secondary = Template.bind({});
|
|
26
|
-
Secondary.args = {
|
|
27
|
-
label: 'Button',
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export const Large = Template.bind({});
|
|
31
|
-
Large.args = {
|
|
32
|
-
size: 'large',
|
|
33
|
-
label: 'Button',
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export const Small = Template.bind({});
|
|
37
|
-
Small.args = {
|
|
38
|
-
size: 'small',
|
|
39
|
-
label: 'Button',
|
|
40
|
-
};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { createElement } from 'rax';
|
|
2
|
-
|
|
3
|
-
import { Button } from './Button';
|
|
4
|
-
import './header.css';
|
|
5
|
-
|
|
6
|
-
export const Header = ({ user, onLogin, onLogout, onCreateAccount }) => (
|
|
7
|
-
<header>
|
|
8
|
-
<div className="wrapper">
|
|
9
|
-
<div>
|
|
10
|
-
<svg width="32" height="32" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">
|
|
11
|
-
<g fill="none" fillRule="evenodd">
|
|
12
|
-
<path
|
|
13
|
-
d="M10 0h12a10 10 0 0110 10v12a10 10 0 01-10 10H10A10 10 0 010 22V10A10 10 0 0110 0z"
|
|
14
|
-
fill="#FFF"
|
|
15
|
-
/>
|
|
16
|
-
<path
|
|
17
|
-
d="M5.3 10.6l10.4 6v11.1l-10.4-6v-11zm11.4-6.2l9.7 5.5-9.7 5.6V4.4z"
|
|
18
|
-
fill="#555AB9"
|
|
19
|
-
/>
|
|
20
|
-
<path
|
|
21
|
-
d="M27.2 10.6v11.2l-10.5 6V16.5l10.5-6zM15.7 4.4v11L6 10l9.7-5.5z"
|
|
22
|
-
fill="#91BAF8"
|
|
23
|
-
/>
|
|
24
|
-
</g>
|
|
25
|
-
</svg>
|
|
26
|
-
<h1>Acme</h1>
|
|
27
|
-
</div>
|
|
28
|
-
<div>
|
|
29
|
-
{user ? (
|
|
30
|
-
<Button size="small" onClick={onLogout} label="Log out" />
|
|
31
|
-
) : (
|
|
32
|
-
<div>
|
|
33
|
-
<Button size="small" onClick={onLogin} label="Log in" />
|
|
34
|
-
<Button primary size="small" onClick={onCreateAccount} label="Sign up" />
|
|
35
|
-
</div>
|
|
36
|
-
)}
|
|
37
|
-
</div>
|
|
38
|
-
</div>
|
|
39
|
-
</header>
|
|
40
|
-
);
|
|
41
|
-
|
|
42
|
-
Header.defaultProps = {
|
|
43
|
-
user: null,
|
|
44
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { createElement } from 'rax';
|
|
2
|
-
|
|
3
|
-
import { Header } from './Header';
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
title: 'Example/Header',
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
const Template = (args) => <Header {...args} />;
|
|
10
|
-
|
|
11
|
-
export const LoggedIn = Template.bind({});
|
|
12
|
-
LoggedIn.args = {
|
|
13
|
-
user: {},
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export const LoggedOut = Template.bind({});
|
|
17
|
-
LoggedOut.args = {};
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { createElement } from 'rax';
|
|
2
|
-
|
|
3
|
-
import { Header } from './Header';
|
|
4
|
-
import './page.css';
|
|
5
|
-
|
|
6
|
-
export const Page = ({ user, onLogin, onLogout, onCreateAccount }) => (
|
|
7
|
-
<article>
|
|
8
|
-
<Header user={user} onLogin={onLogin} onLogout={onLogout} onCreateAccount={onCreateAccount} />
|
|
9
|
-
|
|
10
|
-
<section>
|
|
11
|
-
<h2>Pages in Storybook</h2>
|
|
12
|
-
<p>
|
|
13
|
-
We recommend building UIs with a{' '}
|
|
14
|
-
<a href="https://componentdriven.org" target="_blank" rel="noopener noreferrer">
|
|
15
|
-
<strong>component-driven</strong>
|
|
16
|
-
</a>{' '}
|
|
17
|
-
process starting with atomic components and ending with pages.
|
|
18
|
-
</p>
|
|
19
|
-
<p>
|
|
20
|
-
Render pages with mock data. This makes it easy to build and review page states without
|
|
21
|
-
needing to navigate to them in your app. Here are some handy patterns for managing page data
|
|
22
|
-
in Storybook:
|
|
23
|
-
</p>
|
|
24
|
-
<ul>
|
|
25
|
-
<li>
|
|
26
|
-
Use a higher-level connected component. Storybook helps you compose such data from the
|
|
27
|
-
"args" of child component stories
|
|
28
|
-
</li>
|
|
29
|
-
<li>
|
|
30
|
-
Assemble data in the page component from your services. You can mock these services out
|
|
31
|
-
using Storybook.
|
|
32
|
-
</li>
|
|
33
|
-
</ul>
|
|
34
|
-
<p>
|
|
35
|
-
Get a guided tutorial on component-driven development at{' '}
|
|
36
|
-
<a href="https://storybook.js.org/tutorials/" target="_blank" rel="noopener noreferrer">
|
|
37
|
-
Storybook tutorials
|
|
38
|
-
</a>
|
|
39
|
-
. Read more in the{' '}
|
|
40
|
-
<a href="https://storybook.js.org/docs" target="_blank" rel="noopener noreferrer">
|
|
41
|
-
docs
|
|
42
|
-
</a>
|
|
43
|
-
.
|
|
44
|
-
</p>
|
|
45
|
-
<div className="tip-wrapper">
|
|
46
|
-
<span className="tip">Tip</span> Adjust the width of the canvas with the{' '}
|
|
47
|
-
<svg width="10" height="10" viewBox="0 0 12 12" xmlns="http://www.w3.org/2000/svg">
|
|
48
|
-
<g fill="none" fillRule="evenodd">
|
|
49
|
-
<path
|
|
50
|
-
d="M1.5 5.2h4.8c.3 0 .5.2.5.4v5.1c-.1.2-.3.3-.4.3H1.4a.5.5 0 01-.5-.4V5.7c0-.3.2-.5.5-.5zm0-2.1h6.9c.3 0 .5.2.5.4v7a.5.5 0 01-1 0V4H1.5a.5.5 0 010-1zm0-2.1h9c.3 0 .5.2.5.4v9.1a.5.5 0 01-1 0V2H1.5a.5.5 0 010-1zm4.3 5.2H2V10h3.8V6.2z"
|
|
51
|
-
id="a"
|
|
52
|
-
fill="#999"
|
|
53
|
-
/>
|
|
54
|
-
</g>
|
|
55
|
-
</svg>
|
|
56
|
-
Viewports addon in the toolbar
|
|
57
|
-
</div>
|
|
58
|
-
</section>
|
|
59
|
-
</article>
|
|
60
|
-
);
|
|
61
|
-
|
|
62
|
-
Page.defaultProps = {
|
|
63
|
-
user: null,
|
|
64
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { createElement } from 'rax';
|
|
2
|
-
|
|
3
|
-
import { Page } from './Page';
|
|
4
|
-
import * as HeaderStories from './Header.stories';
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
title: 'Example/Page',
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
const Template = (args) => <Page {...args} />;
|
|
11
|
-
|
|
12
|
-
export const LoggedIn = Template.bind({});
|
|
13
|
-
LoggedIn.args = {
|
|
14
|
-
// More on composing args: https://storybook.js.org/docs/rax/writing-stories/args#args-composition
|
|
15
|
-
...HeaderStories.LoggedIn.args,
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export const LoggedOut = Template.bind({});
|
|
19
|
-
LoggedOut.args = {
|
|
20
|
-
...HeaderStories.LoggedOut.args,
|
|
21
|
-
};
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import './button.css';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Primary UI component for user interaction
|
|
7
|
-
*/
|
|
8
|
-
export const Button = ({ primary, backgroundColor, size, label, ...props }) => {
|
|
9
|
-
const mode = primary ? 'storybook-button--primary' : 'storybook-button--secondary';
|
|
10
|
-
return (
|
|
11
|
-
<button
|
|
12
|
-
type="button"
|
|
13
|
-
className={['storybook-button', `storybook-button--${size}`, mode].join(' ')}
|
|
14
|
-
style={backgroundColor && { backgroundColor }}
|
|
15
|
-
{...props}
|
|
16
|
-
>
|
|
17
|
-
{label}
|
|
18
|
-
</button>
|
|
19
|
-
);
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
Button.propTypes = {
|
|
23
|
-
/**
|
|
24
|
-
* Is this the principal call to action on the page?
|
|
25
|
-
*/
|
|
26
|
-
primary: PropTypes.bool,
|
|
27
|
-
/**
|
|
28
|
-
* What background color to use
|
|
29
|
-
*/
|
|
30
|
-
backgroundColor: PropTypes.string,
|
|
31
|
-
/**
|
|
32
|
-
* How large should the button be?
|
|
33
|
-
*/
|
|
34
|
-
size: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
35
|
-
/**
|
|
36
|
-
* Button contents
|
|
37
|
-
*/
|
|
38
|
-
label: PropTypes.string.isRequired,
|
|
39
|
-
/**
|
|
40
|
-
* Optional click handler
|
|
41
|
-
*/
|
|
42
|
-
onClick: PropTypes.func,
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
Button.defaultProps = {
|
|
46
|
-
backgroundColor: null,
|
|
47
|
-
primary: false,
|
|
48
|
-
size: 'medium',
|
|
49
|
-
onClick: undefined,
|
|
50
|
-
};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import { Button } from './Button';
|
|
4
|
-
|
|
5
|
-
// More on default export: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
|
|
6
|
-
export default {
|
|
7
|
-
title: 'Example/Button',
|
|
8
|
-
component: Button,
|
|
9
|
-
// More on argTypes: https://storybook.js.org/docs/react/api/argtypes
|
|
10
|
-
argTypes: {
|
|
11
|
-
backgroundColor: { control: 'color' },
|
|
12
|
-
},
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
// More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args
|
|
16
|
-
const Template = (args) => <Button {...args} />;
|
|
17
|
-
|
|
18
|
-
export const Primary = Template.bind({});
|
|
19
|
-
// More on args: https://storybook.js.org/docs/react/writing-stories/args
|
|
20
|
-
Primary.args = {
|
|
21
|
-
primary: true,
|
|
22
|
-
label: 'Button',
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export const Secondary = Template.bind({});
|
|
26
|
-
Secondary.args = {
|
|
27
|
-
label: 'Button',
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export const Large = Template.bind({});
|
|
31
|
-
Large.args = {
|
|
32
|
-
size: 'large',
|
|
33
|
-
label: 'Button',
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export const Small = Template.bind({});
|
|
37
|
-
Small.args = {
|
|
38
|
-
size: 'small',
|
|
39
|
-
label: 'Button',
|
|
40
|
-
};
|