@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,32 +0,0 @@
|
|
|
1
|
-
.wrapper {
|
|
2
|
-
font-family: 'Nunito Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
|
3
|
-
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
|
|
4
|
-
padding: 15px 20px;
|
|
5
|
-
display: flex;
|
|
6
|
-
align-items: center;
|
|
7
|
-
justify-content: space-between;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
svg {
|
|
11
|
-
display: inline-block;
|
|
12
|
-
vertical-align: top;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
h1 {
|
|
16
|
-
font-weight: 900;
|
|
17
|
-
font-size: 20px;
|
|
18
|
-
line-height: 1;
|
|
19
|
-
margin: 6px 0 6px 10px;
|
|
20
|
-
display: inline-block;
|
|
21
|
-
vertical-align: top;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
button + button {
|
|
25
|
-
margin-left: 10px;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.welcome {
|
|
29
|
-
color: #333;
|
|
30
|
-
font-size: 14px;
|
|
31
|
-
margin-right: 10px;
|
|
32
|
-
}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
section {
|
|
2
|
-
font-family: 'Nunito Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
|
3
|
-
font-size: 14px;
|
|
4
|
-
line-height: 24px;
|
|
5
|
-
padding: 48px 20px;
|
|
6
|
-
margin: 0 auto;
|
|
7
|
-
max-width: 600px;
|
|
8
|
-
color: #333;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
section h2 {
|
|
12
|
-
font-weight: 900;
|
|
13
|
-
font-size: 32px;
|
|
14
|
-
line-height: 1;
|
|
15
|
-
margin: 0 0 4px;
|
|
16
|
-
display: inline-block;
|
|
17
|
-
vertical-align: top;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
section p {
|
|
21
|
-
margin: 1em 0;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
section a {
|
|
25
|
-
text-decoration: none;
|
|
26
|
-
color: #1ea7fd;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
section ul {
|
|
30
|
-
padding-left: 30px;
|
|
31
|
-
margin: 1em 0;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
section li {
|
|
35
|
-
margin-bottom: 8px;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
section .tip {
|
|
39
|
-
display: inline-block;
|
|
40
|
-
border-radius: 1em;
|
|
41
|
-
font-size: 11px;
|
|
42
|
-
line-height: 12px;
|
|
43
|
-
font-weight: 700;
|
|
44
|
-
background: #e7fdd8;
|
|
45
|
-
color: #66bf3c;
|
|
46
|
-
padding: 4px 12px;
|
|
47
|
-
margin-right: 10px;
|
|
48
|
-
vertical-align: top;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
section .tip-wrapper {
|
|
52
|
-
font-size: 13px;
|
|
53
|
-
line-height: 20px;
|
|
54
|
-
margin-top: 40px;
|
|
55
|
-
margin-bottom: 40px;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
section .tip-wrapper svg {
|
|
59
|
-
display: inline-block;
|
|
60
|
-
height: 12px;
|
|
61
|
-
width: 12px;
|
|
62
|
-
margin-right: 4px;
|
|
63
|
-
vertical-align: top;
|
|
64
|
-
margin-top: 3px;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
section .tip-wrapper svg path {
|
|
68
|
-
fill: #1ea7fd;
|
|
69
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { hbs } from 'ember-cli-htmlbars';
|
|
2
|
-
import { action } from '@storybook/addon-actions';
|
|
3
|
-
import { linkTo } from '@storybook/addon-links';
|
|
4
|
-
|
|
5
|
-
// More on default export: https://storybook.js.org/docs/ember/writing-stories/introduction#default-export
|
|
6
|
-
export default {
|
|
7
|
-
title: 'Button',
|
|
8
|
-
// More on argTypes: https://storybook.js.org/docs/ember/api/argtypes
|
|
9
|
-
argTypes: {
|
|
10
|
-
children: { control: 'text' },
|
|
11
|
-
},
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
// More on component templates: https://storybook.js.org/docs/ember/writing-stories/introduction#using-args
|
|
15
|
-
const Template = (args) => ({
|
|
16
|
-
template: hbs`<button {{action onClick}}>{{children}}</button>`,
|
|
17
|
-
context: args,
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
export const Text = Template.bind({});
|
|
21
|
-
// More on args: https://storybook.js.org/docs/ember/writing-stories/args
|
|
22
|
-
Text.args = {
|
|
23
|
-
children: 'Button',
|
|
24
|
-
onClick: action('onClick'),
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export const Emoji = Template.bind({});
|
|
28
|
-
Emoji.args = {
|
|
29
|
-
children: '😀 😎 👍 💯',
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export const TextWithAction = () => ({
|
|
33
|
-
template: hbs`
|
|
34
|
-
<button {{action onClick}}>
|
|
35
|
-
Trigger Action
|
|
36
|
-
</button>
|
|
37
|
-
`,
|
|
38
|
-
context: {
|
|
39
|
-
onClick: () => action('This was clicked')(),
|
|
40
|
-
},
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
TextWithAction.storyName = 'With an action';
|
|
44
|
-
TextWithAction.parameters = { notes: 'My notes on a button with emojis' };
|
|
45
|
-
|
|
46
|
-
export const ButtonWithLinkToAnotherStory = () => ({
|
|
47
|
-
template: hbs`
|
|
48
|
-
<button {{action onClick}}>
|
|
49
|
-
Go to Welcome Story
|
|
50
|
-
</button>
|
|
51
|
-
`,
|
|
52
|
-
context: {
|
|
53
|
-
onClick: linkTo('example-introduction--page'),
|
|
54
|
-
},
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
ButtonWithLinkToAnotherStory.storyName = 'button with link to another story';
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import './button.css';
|
|
2
|
-
|
|
3
|
-
export const createButton = ({
|
|
4
|
-
primary = false,
|
|
5
|
-
size = 'medium',
|
|
6
|
-
backgroundColor,
|
|
7
|
-
label,
|
|
8
|
-
onClick,
|
|
9
|
-
}) => {
|
|
10
|
-
const btn = document.createElement('button');
|
|
11
|
-
btn.type = 'button';
|
|
12
|
-
btn.innerText = label;
|
|
13
|
-
btn.addEventListener('click', onClick);
|
|
14
|
-
|
|
15
|
-
const mode = primary ? 'storybook-button--primary' : 'storybook-button--secondary';
|
|
16
|
-
btn.className = ['storybook-button', `storybook-button--${size}`, mode].join(' ');
|
|
17
|
-
|
|
18
|
-
btn.style.backgroundColor = backgroundColor;
|
|
19
|
-
|
|
20
|
-
return btn;
|
|
21
|
-
};
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { createButton } from './Button';
|
|
2
|
-
|
|
3
|
-
// More on default export: https://storybook.js.org/docs/html/writing-stories/introduction#default-export
|
|
4
|
-
export default {
|
|
5
|
-
title: 'Example/Button',
|
|
6
|
-
// More on argTypes: https://storybook.js.org/docs/html/api/argtypes
|
|
7
|
-
argTypes: {
|
|
8
|
-
backgroundColor: { control: 'color' },
|
|
9
|
-
label: { control: 'text' },
|
|
10
|
-
onClick: { action: 'onClick' },
|
|
11
|
-
primary: { control: 'boolean' },
|
|
12
|
-
size: {
|
|
13
|
-
control: { type: 'select' },
|
|
14
|
-
options: ['small', 'medium', 'large'],
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
// More on component templates: https://storybook.js.org/docs/html/writing-stories/introduction#using-args
|
|
20
|
-
const Template = ({ label, ...args }) => {
|
|
21
|
-
// You can either use a function to create DOM elements or use a plain html string!
|
|
22
|
-
// return `<div>${label}</div>`;
|
|
23
|
-
return createButton({ label, ...args });
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export const Primary = Template.bind({});
|
|
27
|
-
// More on args: https://storybook.js.org/docs/html/writing-stories/args
|
|
28
|
-
Primary.args = {
|
|
29
|
-
primary: true,
|
|
30
|
-
label: 'Button',
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export const Secondary = Template.bind({});
|
|
34
|
-
Secondary.args = {
|
|
35
|
-
label: 'Button',
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export const Large = Template.bind({});
|
|
39
|
-
Large.args = {
|
|
40
|
-
size: 'large',
|
|
41
|
-
label: 'Button',
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export const Small = Template.bind({});
|
|
45
|
-
Small.args = {
|
|
46
|
-
size: 'small',
|
|
47
|
-
label: 'Button',
|
|
48
|
-
};
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import './header.css';
|
|
2
|
-
import { createButton } from './Button';
|
|
3
|
-
|
|
4
|
-
export const createHeader = ({ user, onLogout, onLogin, onCreateAccount }) => {
|
|
5
|
-
const header = document.createElement('header');
|
|
6
|
-
|
|
7
|
-
const wrapper = document.createElement('div');
|
|
8
|
-
wrapper.className = 'wrapper';
|
|
9
|
-
|
|
10
|
-
const logo = `<div>
|
|
11
|
-
<svg width="32" height="32" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">
|
|
12
|
-
<g fill="none" fillRule="evenodd">
|
|
13
|
-
<path
|
|
14
|
-
d="M10 0h12a10 10 0 0110 10v12a10 10 0 01-10 10H10A10 10 0 010 22V10A10 10 0 0110 0z"
|
|
15
|
-
fill="#FFF" />
|
|
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
|
-
<path d="M27.2 10.6v11.2l-10.5 6V16.5l10.5-6zM15.7 4.4v11L6 10l9.7-5.5z" fill="#91BAF8" />
|
|
20
|
-
</g>
|
|
21
|
-
</svg>
|
|
22
|
-
<h1>Acme</h1>
|
|
23
|
-
</div>`;
|
|
24
|
-
|
|
25
|
-
wrapper.insertAdjacentHTML('afterbegin', logo);
|
|
26
|
-
|
|
27
|
-
const account = document.createElement('div');
|
|
28
|
-
if (user) {
|
|
29
|
-
const welcomeMessage = `<span class="welcome">Welcome, <b>${user.name}</b>!</span>`;
|
|
30
|
-
account.innerHTML = welcomeMessage;
|
|
31
|
-
account.appendChild(createButton({ size: 'small', label: 'Log out', onClick: onLogout }));
|
|
32
|
-
} else {
|
|
33
|
-
account.appendChild(createButton({ size: 'small', label: 'Log in', onClick: onLogin }));
|
|
34
|
-
account.appendChild(
|
|
35
|
-
createButton({
|
|
36
|
-
size: 'small',
|
|
37
|
-
label: 'Sign up',
|
|
38
|
-
onClick: onCreateAccount,
|
|
39
|
-
primary: true,
|
|
40
|
-
})
|
|
41
|
-
);
|
|
42
|
-
}
|
|
43
|
-
wrapper.appendChild(account);
|
|
44
|
-
header.appendChild(wrapper);
|
|
45
|
-
|
|
46
|
-
return header;
|
|
47
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { createHeader } from './Header';
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
title: 'Example/Header',
|
|
5
|
-
parameters: {
|
|
6
|
-
// More on Story layout: https://storybook.js.org/docs/html/configure/story-layout
|
|
7
|
-
layout: 'fullscreen',
|
|
8
|
-
},
|
|
9
|
-
// More on argTypes: https://storybook.js.org/docs/html/api/argtypes
|
|
10
|
-
argTypes: {
|
|
11
|
-
onLogin: { action: 'onLogin' },
|
|
12
|
-
onLogout: { action: 'onLogout' },
|
|
13
|
-
onCreateAccount: { action: 'onCreateAccount' },
|
|
14
|
-
},
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
const Template = (args) => createHeader(args);
|
|
18
|
-
|
|
19
|
-
export const LoggedIn = Template.bind({});
|
|
20
|
-
LoggedIn.args = {
|
|
21
|
-
user: {
|
|
22
|
-
name: 'Jane Doe',
|
|
23
|
-
},
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export const LoggedOut = Template.bind({});
|
|
27
|
-
LoggedOut.args = {};
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import './page.css';
|
|
2
|
-
import { createHeader } from './Header';
|
|
3
|
-
|
|
4
|
-
export const createPage = () => {
|
|
5
|
-
const article = document.createElement('article');
|
|
6
|
-
let user = null;
|
|
7
|
-
let header = null;
|
|
8
|
-
|
|
9
|
-
const rerenderHeader = () => {
|
|
10
|
-
const wrapper = document.getElementsByTagName('article')[0];
|
|
11
|
-
wrapper.replaceChild(createHeaderElement(), wrapper.firstChild);
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const onLogin = () => {
|
|
15
|
-
user = { name: 'Jane Doe' };
|
|
16
|
-
rerenderHeader();
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const onLogout = () => {
|
|
20
|
-
user = null;
|
|
21
|
-
rerenderHeader();
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const onCreateAccount = () => {
|
|
25
|
-
user = { name: 'Jane Doe' };
|
|
26
|
-
rerenderHeader();
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
const createHeaderElement = () => {
|
|
30
|
-
return createHeader({ onLogin, onLogout, onCreateAccount, user });
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
header = createHeaderElement();
|
|
34
|
-
article.appendChild(header);
|
|
35
|
-
|
|
36
|
-
const section = `
|
|
37
|
-
<section>
|
|
38
|
-
<h2>Pages in Storybook</h2>
|
|
39
|
-
<p>
|
|
40
|
-
We recommend building UIs with a
|
|
41
|
-
<a
|
|
42
|
-
href="https://blog.hichroma.com/component-driven-development-ce1109d56c8e"
|
|
43
|
-
target="_blank"
|
|
44
|
-
rel="noopener noreferrer">
|
|
45
|
-
<strong>component-driven</strong>
|
|
46
|
-
</a>
|
|
47
|
-
process starting with atomic components and ending with pages.
|
|
48
|
-
</p>
|
|
49
|
-
<p>
|
|
50
|
-
Render pages with mock data. This makes it easy to build and review page states without
|
|
51
|
-
needing to navigate to them in your app. Here are some handy patterns for managing page data
|
|
52
|
-
in Storybook:
|
|
53
|
-
</p>
|
|
54
|
-
<ul>
|
|
55
|
-
<li>
|
|
56
|
-
Use a higher-level connected component. Storybook helps you compose such data from the
|
|
57
|
-
"args" of child component stories
|
|
58
|
-
</li>
|
|
59
|
-
<li>
|
|
60
|
-
Assemble data in the page component from your services. You can mock these services out
|
|
61
|
-
using Storybook.
|
|
62
|
-
</li>
|
|
63
|
-
</ul>
|
|
64
|
-
<p>
|
|
65
|
-
Get a guided tutorial on component-driven development at
|
|
66
|
-
<a href="https://storybook.js.org/tutorials/" target="_blank" rel="noopener noreferrer">
|
|
67
|
-
Storybook tutorials
|
|
68
|
-
</a>
|
|
69
|
-
. Read more in the
|
|
70
|
-
<a href="https://storybook.js.org/docs" target="_blank" rel="noopener noreferrer">docs</a>
|
|
71
|
-
.
|
|
72
|
-
</p>
|
|
73
|
-
<div class="tip-wrapper">
|
|
74
|
-
<span class="tip">Tip</span>
|
|
75
|
-
Adjust the width of the canvas with the
|
|
76
|
-
<svg width="10" height="10" viewBox="0 0 12 12" xmlns="http://www.w3.org/2000/svg">
|
|
77
|
-
<g fill="none" fillRule="evenodd">
|
|
78
|
-
<path
|
|
79
|
-
d="M1.5 5.2h4.8c.3 0 .5.2.5.4v5.1c-.1.2-.3.3-.4.3H1.4a.5.5 0
|
|
80
|
-
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
|
|
81
|
-
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"
|
|
82
|
-
id="a"
|
|
83
|
-
fill="#999" />
|
|
84
|
-
</g>
|
|
85
|
-
</svg>
|
|
86
|
-
Viewports addon in the toolbar
|
|
87
|
-
</div>
|
|
88
|
-
</section>
|
|
89
|
-
`;
|
|
90
|
-
|
|
91
|
-
article.insertAdjacentHTML('beforeend', section);
|
|
92
|
-
|
|
93
|
-
return article;
|
|
94
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { within, userEvent } from '@storybook/testing-library';
|
|
2
|
-
import { createPage } from './Page';
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: 'Example/Page',
|
|
6
|
-
parameters: {
|
|
7
|
-
// More on Story layout: https://storybook.js.org/docs/html/configure/story-layout
|
|
8
|
-
layout: 'fullscreen',
|
|
9
|
-
},
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
const Template = () => createPage();
|
|
13
|
-
|
|
14
|
-
export const LoggedOut = Template.bind({});
|
|
15
|
-
|
|
16
|
-
export const LoggedIn = Template.bind({});
|
|
17
|
-
|
|
18
|
-
// More on interaction testing: https://storybook.js.org/docs/html/writing-tests/interaction-testing
|
|
19
|
-
LoggedIn.play = async ({ canvasElement }) => {
|
|
20
|
-
const canvas = within(canvasElement);
|
|
21
|
-
const loginButton = await canvas.getByRole('button', { name: /Log in/i });
|
|
22
|
-
await userEvent.click(loginButton);
|
|
23
|
-
};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryFn } from '@storybook/html';
|
|
2
|
-
import { createButton, ButtonProps } from './Button';
|
|
3
|
-
|
|
4
|
-
// More on default export: https://storybook.js.org/docs/html/writing-stories/introduction#default-export
|
|
5
|
-
export default {
|
|
6
|
-
title: 'Example/Button',
|
|
7
|
-
// More on argTypes: https://storybook.js.org/docs/html/api/argtypes
|
|
8
|
-
argTypes: {
|
|
9
|
-
backgroundColor: { control: 'color' },
|
|
10
|
-
label: { control: 'text' },
|
|
11
|
-
onClick: { action: 'onClick' },
|
|
12
|
-
primary: { control: 'boolean' },
|
|
13
|
-
size: {
|
|
14
|
-
control: { type: 'select' },
|
|
15
|
-
options: ['small', 'medium', 'large'],
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
} as Meta<ButtonProps>;
|
|
19
|
-
|
|
20
|
-
// More on component templates: https://storybook.js.org/docs/html/writing-stories/introduction#using-args
|
|
21
|
-
const Template: StoryFn<ButtonProps> = (args) => {
|
|
22
|
-
// You can either use a function to create DOM elements or use a plain html string!
|
|
23
|
-
// return `<div>${label}</div>`;
|
|
24
|
-
return createButton(args);
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export const Primary = Template.bind({});
|
|
28
|
-
// More on args: https://storybook.js.org/docs/html/writing-stories/args
|
|
29
|
-
Primary.args = {
|
|
30
|
-
primary: true,
|
|
31
|
-
label: 'Button',
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export const Secondary = Template.bind({});
|
|
35
|
-
Secondary.args = {
|
|
36
|
-
label: 'Button',
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export const Large = Template.bind({});
|
|
40
|
-
Large.args = {
|
|
41
|
-
size: 'large',
|
|
42
|
-
label: 'Button',
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export const Small = Template.bind({});
|
|
46
|
-
Small.args = {
|
|
47
|
-
size: 'small',
|
|
48
|
-
label: 'Button',
|
|
49
|
-
};
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import './button.css';
|
|
2
|
-
|
|
3
|
-
export interface ButtonProps {
|
|
4
|
-
/**
|
|
5
|
-
* Is this the principal call to action on the page?
|
|
6
|
-
*/
|
|
7
|
-
primary?: boolean;
|
|
8
|
-
/**
|
|
9
|
-
* What background color to use
|
|
10
|
-
*/
|
|
11
|
-
backgroundColor?: string;
|
|
12
|
-
/**
|
|
13
|
-
* How large should the button be?
|
|
14
|
-
*/
|
|
15
|
-
size?: 'small' | 'medium' | 'large';
|
|
16
|
-
/**
|
|
17
|
-
* Button contents
|
|
18
|
-
*/
|
|
19
|
-
label: string;
|
|
20
|
-
/**
|
|
21
|
-
* Optional click handler
|
|
22
|
-
*/
|
|
23
|
-
onClick?: () => void;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Primary UI component for user interaction
|
|
28
|
-
*/
|
|
29
|
-
export const createButton = ({
|
|
30
|
-
primary = false,
|
|
31
|
-
size = 'medium',
|
|
32
|
-
backgroundColor,
|
|
33
|
-
label,
|
|
34
|
-
onClick,
|
|
35
|
-
}: ButtonProps) => {
|
|
36
|
-
const btn = document.createElement('button');
|
|
37
|
-
btn.type = 'button';
|
|
38
|
-
btn.innerText = label;
|
|
39
|
-
if (onClick) {
|
|
40
|
-
btn.addEventListener('click', onClick);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const mode = primary ? 'storybook-button--primary' : 'storybook-button--secondary';
|
|
44
|
-
btn.className = ['storybook-button', `storybook-button--${size}`, mode].join(' ');
|
|
45
|
-
|
|
46
|
-
if (backgroundColor) {
|
|
47
|
-
btn.style.backgroundColor = backgroundColor;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return btn;
|
|
51
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryFn } from '@storybook/html';
|
|
2
|
-
import { createHeader, HeaderProps } from './Header';
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: 'Example/Header',
|
|
6
|
-
parameters: {
|
|
7
|
-
// More on Story layout: https://storybook.js.org/docs/html/configure/story-layout
|
|
8
|
-
layout: 'fullscreen',
|
|
9
|
-
},
|
|
10
|
-
// More on argTypes: https://storybook.js.org/docs/html/api/argtypes
|
|
11
|
-
argTypes: {
|
|
12
|
-
onLogin: { action: 'onLogin' },
|
|
13
|
-
onLogout: { action: 'onLogout' },
|
|
14
|
-
onCreateAccount: { action: 'onCreateAccount' },
|
|
15
|
-
},
|
|
16
|
-
} as Meta<HeaderProps>;
|
|
17
|
-
|
|
18
|
-
const Template: StoryFn<HeaderProps> = (args) => createHeader(args);
|
|
19
|
-
|
|
20
|
-
export const LoggedIn = Template.bind({});
|
|
21
|
-
LoggedIn.args = {
|
|
22
|
-
user: {},
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export const LoggedOut = Template.bind({});
|
|
26
|
-
LoggedOut.args = {};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import './header.css';
|
|
2
|
-
import { createButton } from './Button';
|
|
3
|
-
|
|
4
|
-
export interface HeaderProps {
|
|
5
|
-
user?: { name: string };
|
|
6
|
-
onLogin: () => void;
|
|
7
|
-
onLogout: () => void;
|
|
8
|
-
onCreateAccount: () => void;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export const createHeader = ({ user, onLogout, onLogin, onCreateAccount }: HeaderProps) => {
|
|
12
|
-
const header = document.createElement('header');
|
|
13
|
-
|
|
14
|
-
const wrapper = document.createElement('div');
|
|
15
|
-
wrapper.className = 'wrapper';
|
|
16
|
-
|
|
17
|
-
const logo = `<div>
|
|
18
|
-
<svg width="32" height="32" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">
|
|
19
|
-
<g fill="none" fillRule="evenodd">
|
|
20
|
-
<path
|
|
21
|
-
d="M10 0h12a10 10 0 0110 10v12a10 10 0 01-10 10H10A10 10 0 010 22V10A10 10 0 0110 0z"
|
|
22
|
-
fill="#FFF" />
|
|
23
|
-
<path
|
|
24
|
-
d="M5.3 10.6l10.4 6v11.1l-10.4-6v-11zm11.4-6.2l9.7 5.5-9.7 5.6V4.4z"
|
|
25
|
-
fill="#555AB9" />
|
|
26
|
-
<path d="M27.2 10.6v11.2l-10.5 6V16.5l10.5-6zM15.7 4.4v11L6 10l9.7-5.5z" fill="#91BAF8" />
|
|
27
|
-
</g>
|
|
28
|
-
</svg>
|
|
29
|
-
<h1>Acme</h1>
|
|
30
|
-
</div>`;
|
|
31
|
-
|
|
32
|
-
wrapper.insertAdjacentHTML('afterbegin', logo);
|
|
33
|
-
|
|
34
|
-
const account = document.createElement('div');
|
|
35
|
-
if (user) {
|
|
36
|
-
const welcomeMessage = `<span class="welcome">Welcome, <b>${user.name}</b>!</span>`;
|
|
37
|
-
account.innerHTML = welcomeMessage;
|
|
38
|
-
account.appendChild(createButton({ size: 'small', label: 'Log out', onClick: onLogout }));
|
|
39
|
-
} else {
|
|
40
|
-
account.appendChild(createButton({ size: 'small', label: 'Log in', onClick: onLogin }));
|
|
41
|
-
account.appendChild(
|
|
42
|
-
createButton({
|
|
43
|
-
size: 'small',
|
|
44
|
-
label: 'Sign up',
|
|
45
|
-
onClick: onCreateAccount,
|
|
46
|
-
primary: true,
|
|
47
|
-
})
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
wrapper.appendChild(account);
|
|
51
|
-
header.appendChild(wrapper);
|
|
52
|
-
|
|
53
|
-
return header;
|
|
54
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { within, userEvent } from '@storybook/testing-library';
|
|
2
|
-
import type { Meta, StoryFn } from '@storybook/html';
|
|
3
|
-
import { createPage } from './Page';
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
title: 'Example/Page',
|
|
7
|
-
parameters: {
|
|
8
|
-
// More on Story layout: https://storybook.js.org/docs/html/configure/story-layout
|
|
9
|
-
layout: 'fullscreen',
|
|
10
|
-
},
|
|
11
|
-
} as Meta;
|
|
12
|
-
|
|
13
|
-
const Template: StoryFn = () => createPage();
|
|
14
|
-
|
|
15
|
-
export const LoggedOut = Template.bind({});
|
|
16
|
-
|
|
17
|
-
export const LoggedIn = Template.bind({});
|
|
18
|
-
|
|
19
|
-
// More on interaction testing: https://storybook.js.org/docs/html/writing-tests/interaction-testing
|
|
20
|
-
LoggedIn.play = async ({ canvasElement }) => {
|
|
21
|
-
const canvas = within(canvasElement);
|
|
22
|
-
const loginButton = await canvas.getByRole('button', { name: /Log in/i });
|
|
23
|
-
await userEvent.click(loginButton);
|
|
24
|
-
};
|