@storybook/angular 7.0.0-alpha.46 → 7.0.0-alpha.48
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/{types/builders → builders}/build-storybook/index.d.ts +0 -0
- package/dist/{types/builders → builders}/build-storybook/index.js +0 -0
- package/dist/{types/builders → builders}/build-storybook/index.spec.d.ts +0 -0
- package/dist/{types/builders → builders}/build-storybook/index.spec.js +0 -0
- package/dist/{types/builders → builders}/build-storybook/schema.json +0 -0
- package/dist/{types/builders → builders}/builders.json +0 -0
- package/dist/{types/builders → builders}/start-storybook/index.d.ts +0 -0
- package/dist/{types/builders → builders}/start-storybook/index.js +0 -0
- package/dist/{types/builders → builders}/start-storybook/index.spec.d.ts +0 -0
- package/dist/{types/builders → builders}/start-storybook/index.spec.js +0 -0
- package/dist/{types/builders → builders}/start-storybook/schema.json +0 -0
- package/dist/{types/builders → builders}/utils/build-standalone-errors-handler.d.ts +0 -0
- package/dist/{types/builders → builders}/utils/build-standalone-errors-handler.js +0 -0
- package/dist/{types/builders → builders}/utils/run-compodoc.d.ts +0 -0
- package/dist/{types/builders → builders}/utils/run-compodoc.js +0 -0
- package/dist/{types/builders → builders}/utils/run-compodoc.spec.d.ts +0 -0
- package/dist/{types/builders → builders}/utils/run-compodoc.spec.js +0 -0
- package/dist/{types/builders → builders}/utils/standalone-options.d.ts +0 -0
- package/dist/{types/builders → builders}/utils/standalone-options.js +0 -0
- package/dist/{types/client → client}/angular/app.component.d.ts +0 -0
- package/dist/{types/client → client}/angular/app.component.js +0 -0
- package/dist/{types/client → client}/angular/app.token.d.ts +0 -0
- package/dist/{types/client → client}/angular/app.token.js +0 -0
- package/dist/{types/client → client}/angular/helpers.d.ts +0 -0
- package/dist/{types/client → client}/angular/helpers.js +0 -0
- package/dist/{types/client → client}/angular-beta/AbstractRenderer.d.ts +0 -0
- package/dist/{types/client → client}/angular-beta/AbstractRenderer.js +0 -0
- package/dist/{types/client → client}/angular-beta/CanvasRenderer.d.ts +0 -0
- package/dist/{types/client → client}/angular-beta/CanvasRenderer.js +0 -0
- package/dist/{types/client → client}/angular-beta/ComputesTemplateFromComponent.d.ts +0 -0
- package/dist/{types/client → client}/angular-beta/ComputesTemplateFromComponent.js +0 -0
- package/dist/client/angular-beta/ComputesTemplateFromComponent.test.d.ts +1 -0
- package/dist/client/angular-beta/ComputesTemplateFromComponent.test.js +389 -0
- package/dist/{types/client → client}/angular-beta/DocsRenderer.d.ts +0 -0
- package/dist/{types/client → client}/angular-beta/DocsRenderer.js +0 -0
- package/dist/{types/client → client}/angular-beta/RendererFactory.d.ts +0 -0
- package/dist/{types/client → client}/angular-beta/RendererFactory.js +0 -0
- package/dist/client/angular-beta/RendererFactory.test.d.ts +1 -0
- package/dist/client/angular-beta/RendererFactory.test.js +295 -0
- package/dist/{types/client → client}/angular-beta/StorybookModule.d.ts +0 -0
- package/dist/{types/client → client}/angular-beta/StorybookModule.js +9 -1
- package/dist/client/angular-beta/StorybookModule.test.d.ts +1 -0
- package/dist/client/angular-beta/StorybookModule.test.js +279 -0
- package/dist/{types/client → client}/angular-beta/StorybookProvider.d.ts +0 -0
- package/dist/{types/client → client}/angular-beta/StorybookProvider.js +0 -0
- package/dist/{types/client → client}/angular-beta/StorybookWrapperComponent.d.ts +0 -0
- package/dist/{types/client → client}/angular-beta/StorybookWrapperComponent.js +0 -0
- package/dist/client/angular-beta/__testfixtures__/input.component.d.ts +26 -0
- package/dist/client/angular-beta/__testfixtures__/input.component.js +67 -0
- package/dist/{types/client → client}/angular-beta/utils/NgComponentAnalyzer.d.ts +0 -0
- package/dist/{types/client → client}/angular-beta/utils/NgComponentAnalyzer.js +0 -0
- package/dist/client/angular-beta/utils/NgComponentAnalyzer.test.d.ts +1 -0
- package/dist/client/angular-beta/utils/NgComponentAnalyzer.test.js +340 -0
- package/dist/{types/client → client}/angular-beta/utils/NgModulesAnalyzer.d.ts +0 -0
- package/dist/{types/client → client}/angular-beta/utils/NgModulesAnalyzer.js +0 -0
- package/dist/client/angular-beta/utils/NgModulesAnalyzer.test.d.ts +1 -0
- package/dist/client/angular-beta/utils/NgModulesAnalyzer.test.js +23 -0
- package/dist/{types/client → client}/config.d.ts +0 -0
- package/dist/{types/client → client}/config.js +0 -0
- package/dist/{types/client → client}/decorateStory.d.ts +0 -0
- package/dist/{types/client → client}/decorateStory.js +0 -0
- package/dist/client/decorateStory.test.d.ts +1 -0
- package/dist/client/decorateStory.test.js +335 -0
- package/dist/{types/client → client}/decorators.d.ts +0 -0
- package/dist/{types/client → client}/decorators.js +0 -0
- package/dist/client/decorators.test.d.ts +1 -0
- package/dist/client/decorators.test.js +106 -0
- package/dist/client/docs/__testfixtures__/doc-button/input.d.ts +111 -0
- package/dist/client/docs/__testfixtures__/doc-button/input.js +207 -0
- package/dist/client/docs/__testfixtures__/doc-button/tsconfig.json +7 -0
- package/dist/client/docs/angular-properties.test.d.ts +1 -0
- package/dist/client/docs/angular-properties.test.js +56 -0
- package/dist/{types/client → client}/docs/compodoc.d.ts +0 -0
- package/dist/{types/client → client}/docs/compodoc.js +0 -0
- package/dist/client/docs/compodoc.test.d.ts +1 -0
- package/dist/client/docs/compodoc.test.js +131 -0
- package/dist/{types/client → client}/docs/config.d.ts +0 -0
- package/dist/{types/client → client}/docs/config.js +0 -0
- package/dist/{types/client → client}/docs/index.d.ts +0 -0
- package/dist/{types/client → client}/docs/index.js +0 -0
- package/dist/{types/client → client}/docs/sourceDecorator.d.ts +0 -0
- package/dist/{types/client → client}/docs/sourceDecorator.js +0 -0
- package/dist/{types/client → client}/docs/types.d.ts +0 -0
- package/dist/{types/client → client}/docs/types.js +0 -0
- package/dist/{types/client → client}/globals.d.ts +0 -0
- package/dist/{types/client → client}/globals.js +0 -0
- package/dist/{types/client → client}/index.d.ts +0 -0
- package/dist/{types/client → client}/index.js +0 -0
- package/dist/{types/client → client}/public-api.d.ts +0 -0
- package/dist/{types/client → client}/public-api.js +0 -0
- package/dist/{types/client → client}/public-types.d.ts +0 -0
- package/dist/{types/client → client}/public-types.js +0 -0
- package/dist/{types/client → client}/render.d.ts +0 -0
- package/dist/{types/client → client}/render.js +0 -0
- package/dist/{types/client → client}/types.d.ts +0 -0
- package/dist/{types/client → client}/types.js +0 -0
- package/dist/{types/index.d.ts → index.d.ts} +0 -0
- package/dist/{types/index.js → index.js} +0 -0
- package/dist/{types/preset.d.ts → preset.d.ts} +0 -0
- package/dist/{types/preset.js → preset.js} +0 -0
- package/dist/{types/renderer.d.ts → renderer.d.ts} +0 -0
- package/dist/{types/renderer.js → renderer.js} +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/empty-projects-entry/angular.json +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/minimal-config/angular.json +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/minimal-config/src/main.d.ts +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/minimal-config/src/main.js +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/minimal-config/src/tsconfig.app.json +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/minimal-config/tsconfig.json +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/some-config/angular.json +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/some-config/src/main.d.ts +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/some-config/src/main.js +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/some-config/src/tsconfig.app.json +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/some-config/tsconfig.json +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-angularBrowserTarget/angular.json +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-angularBrowserTarget/src/main.d.ts +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-angularBrowserTarget/src/main.js +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-angularBrowserTarget/src/tsconfig.app.json +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-angularBrowserTarget/tsconfig.json +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-lib/angular.json +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-lib/projects/pattern-lib/src/main.d.ts +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-lib/projects/pattern-lib/src/main.js +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-lib/projects/pattern-lib/tsconfig.lib.json +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-lib/tsconfig.json +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-nx/angular.json +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-nx/nx.json +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-nx/src/main.d.ts +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-nx/src/main.js +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-nx/src/tsconfig.app.json +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-nx/tsconfig.json +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-nx-workspace/nx.json +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-nx-workspace/src/main.d.ts +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-nx-workspace/src/main.js +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-nx-workspace/src/tsconfig.app.json +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-nx-workspace/tsconfig.json +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-nx-workspace/workspace.json +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-options-styles/angular.json +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-options-styles/src/main.d.ts +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-options-styles/src/main.js +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-options-styles/src/tsconfig.app.json +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-options-styles/tsconfig.json +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/without-architect-build/angular.json +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/without-architect-build-options/angular.json +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/without-compatible-projects/angular.json +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/without-projects-entry/angular.json +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/without-projects-entry/projects/pattern-lib/src/main.d.ts +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/without-projects-entry/projects/pattern-lib/src/main.js +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/without-projects-entry/projects/pattern-lib/tsconfig.lib.json +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/without-projects-entry/tsconfig.json +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/without-tsConfig/angular.json +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/without-tsConfig/src/main.d.ts +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/without-tsConfig/src/main.js +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/without-tsConfig/src/tsconfig.app.json +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/without-tsConfig/tsconfig.json +0 -0
- package/dist/server/__tests__/angular.json +96 -0
- package/dist/{types/server → server}/angular-cli-webpack-13.x.x.d.ts +0 -0
- package/dist/{types/server → server}/angular-cli-webpack-13.x.x.js +0 -0
- package/dist/{types/server → server}/angular-read-workspace.d.ts +0 -0
- package/dist/{types/server → server}/angular-read-workspace.js +0 -0
- package/dist/{types/server → server}/framework-preset-angular-cli.d.ts +0 -0
- package/dist/{types/server → server}/framework-preset-angular-cli.js +0 -0
- package/dist/server/framework-preset-angular-cli.test.d.ts +1 -0
- package/dist/server/framework-preset-angular-cli.test.js +708 -0
- package/dist/{types/server → server}/framework-preset-angular-docs.d.ts +0 -0
- package/dist/{types/server → server}/framework-preset-angular-docs.js +1 -1
- package/dist/{types/server → server}/framework-preset-angular-ivy.d.ts +0 -0
- package/dist/{types/server → server}/framework-preset-angular-ivy.js +0 -0
- package/dist/{types/server → server}/preset-options.d.ts +0 -0
- package/dist/{types/server → server}/preset-options.js +0 -0
- package/dist/{types/server → server}/utils/filter-out-styling-rules.d.ts +0 -0
- package/dist/{types/server → server}/utils/filter-out-styling-rules.js +0 -0
- package/dist/{types/server → server}/utils/module-is-available.d.ts +0 -0
- package/dist/{types/server → server}/utils/module-is-available.js +0 -0
- package/dist/{types/server → server}/utils/normalize-asset-patterns.d.ts +0 -0
- package/dist/{types/server → server}/utils/normalize-asset-patterns.js +0 -0
- package/dist/{types/server → server}/utils/normalize-optimization.d.ts +0 -0
- package/dist/{types/server → server}/utils/normalize-optimization.js +0 -0
- package/dist/{types/types.d.ts → types.d.ts} +0 -0
- package/dist/{types/types.js → types.js} +0 -0
- package/package.json +23 -21
- package/preset.js +1 -1
- package/renderer.d.ts +1 -1
- package/renderer.js +1 -1
- package/template/cli/.eslintrc.json +5 -0
- package/template/cli/Button.stories.ts +54 -0
- package/template/cli/Header.stories.ts +37 -0
- package/template/cli/Page.stories.ts +46 -0
- package/template/cli/User.ts +2 -0
- package/template/cli/button.component.ts +53 -0
- package/template/cli/header.component.ts +75 -0
- package/template/cli/page.component.ts +77 -0
- package/template/components/button.component.ts +54 -0
- package/template/components/button.css +30 -0
- package/template/components/form.component.ts +37 -0
- package/template/components/html.component.ts +22 -0
- package/template/components/index.js +8 -0
- package/template/components/pre.component.ts +29 -0
- package/template/stories/angular-mdx.stories.mdx +25 -0
- package/template/stories/argTypes/doc-button/doc-button.component.html +7 -0
- package/template/stories/argTypes/doc-button/doc-button.component.scss +3 -0
- package/template/stories/argTypes/doc-button/doc-button.component.ts +233 -0
- package/template/stories/argTypes/doc-button/doc-button.stories.ts +24 -0
- package/template/stories/argTypes/doc-directive/doc-directive.directive.ts +24 -0
- package/template/stories/argTypes/doc-directive/doc-directive.stories.ts +14 -0
- package/template/stories/argTypes/doc-injectable/doc-injectable.service.ts +27 -0
- package/template/stories/argTypes/doc-injectable/doc-injectable.stories.ts +17 -0
- package/template/stories/argTypes/doc-pipe/doc-pipe.pipe.ts +18 -0
- package/template/stories/argTypes/doc-pipe/doc-pipe.stories.ts +17 -0
- package/template/stories/basics/README.stories.mdx +7 -0
- package/template/stories/basics/angular-forms/customControlValueAccessor/custom-cva-component.stories.ts +27 -0
- package/template/stories/basics/angular-forms/customControlValueAccessor/custom-cva.component.ts +57 -0
- package/template/stories/basics/component-with-complex-selectors/attribute-selector.component.ts +19 -0
- package/template/stories/basics/component-with-complex-selectors/attribute-selectors.component.stories.ts +8 -0
- package/template/stories/basics/component-with-complex-selectors/class-selector.component.stories.ts +8 -0
- package/template/stories/basics/component-with-complex-selectors/class-selector.component.ts +19 -0
- package/template/stories/basics/component-with-complex-selectors/multiple-class-selector.component.stories.ts +8 -0
- package/template/stories/basics/component-with-complex-selectors/multiple-selector.component.stories.ts +8 -0
- package/template/stories/basics/component-with-complex-selectors/multiple-selector.component.ts +37 -0
- package/template/stories/basics/component-with-enums/enums.component.html +8 -0
- package/template/stories/basics/component-with-enums/enums.component.stories.ts +24 -0
- package/template/stories/basics/component-with-enums/enums.component.ts +53 -0
- package/template/stories/basics/component-with-inheritance/base-button.component.ts +10 -0
- package/template/stories/basics/component-with-inheritance/base-button.stories.ts +12 -0
- package/template/stories/basics/component-with-inheritance/icon-button.component.ts +11 -0
- package/template/stories/basics/component-with-inheritance/icon-button.stories.ts +13 -0
- package/template/stories/basics/component-with-ng-content/ng-content-about-parent.stories.ts +58 -0
- package/template/stories/basics/component-with-ng-content/ng-content-simple.stories.ts +29 -0
- package/template/stories/basics/component-with-ng-on-destroy/component-with-on-destroy.stories.ts +42 -0
- package/template/stories/basics/component-with-on-push/on-push-box.component.ts +21 -0
- package/template/stories/basics/component-with-on-push/on-push.stories.ts +21 -0
- package/template/stories/basics/component-with-pipe/custom-pipes.stories.ts +31 -0
- package/template/stories/basics/component-with-pipe/custom.pipe.ts +10 -0
- package/template/stories/basics/component-with-pipe/with-pipe.component.ts +10 -0
- package/template/stories/basics/component-with-provider/di.component.html +7 -0
- package/template/stories/basics/component-with-provider/di.component.stories.ts +26 -0
- package/template/stories/basics/component-with-provider/di.component.ts +28 -0
- package/template/stories/basics/component-with-style/styled.component.css +3 -0
- package/template/stories/basics/component-with-style/styled.component.html +5 -0
- package/template/stories/basics/component-with-style/styled.component.scss +5 -0
- package/template/stories/basics/component-with-style/styled.component.stories.ts +10 -0
- package/template/stories/basics/component-with-style/styled.component.ts +8 -0
- package/template/stories/basics/component-without-selector/without-selector-ng-component-outlet.stories.ts +73 -0
- package/template/stories/basics/component-without-selector/without-selector-ng-factory-resolver.stories.ts +71 -0
- package/template/stories/basics/component-without-selector/without-selector.component.ts +30 -0
- package/template/stories/basics/component-without-selector/without-selector.stories.ts +30 -0
- package/template/stories/basics/ng-module/angular-src/chip-color.token.ts +3 -0
- package/template/stories/basics/ng-module/angular-src/chip-text.pipe.ts +29 -0
- package/template/stories/basics/ng-module/angular-src/chip.component.ts +60 -0
- package/template/stories/basics/ng-module/angular-src/chips-group.component.ts +49 -0
- package/template/stories/basics/ng-module/angular-src/chips.module.ts +31 -0
- package/template/stories/basics/ng-module/import-module-for-root.stories.ts +50 -0
- package/template/stories/basics/ng-module/import-module.stories.ts +46 -0
- package/template/stories/button.component.ts +26 -0
- package/template/stories/core/README.stories.mdx +7 -0
- package/template/stories/core/decorators/componentWrapperDecorator/child.component.ts +20 -0
- package/template/stories/core/decorators/componentWrapperDecorator/decorators.stories.ts +117 -0
- package/template/stories/core/decorators/componentWrapperDecorator/parent.component.ts +18 -0
- package/template/stories/core/decorators/theme-decorator/decorators.stories.ts +20 -0
- package/template/stories/core/moduleMetadata/angular-src/custom.pipe.ts +10 -0
- package/template/stories/core/moduleMetadata/angular-src/dummy.service.ts +14 -0
- package/template/stories/core/moduleMetadata/angular-src/service.component.ts +24 -0
- package/template/stories/core/moduleMetadata/angular-src/token.component.ts +31 -0
- package/template/stories/core/moduleMetadata/in-export-default.stories.ts +38 -0
- package/template/stories/core/moduleMetadata/in-stories.stories.ts +46 -0
- package/template/stories/core/moduleMetadata/merge-default-and-story.stories.ts +35 -0
- package/template/stories/core/parameters/bootstrap-options.stories.ts +22 -0
- package/template/stories/core/styles/story-styles.stories.ts +50 -0
- package/template/stories/others/issues/12009-unknown-component.stories.ts +14 -0
- package/template/stories/others/ngx-translate/README.stories.mdx +58 -0
|
File without changes
|
|
@@ -9,6 +9,6 @@ const docs_tools_1 = require("@storybook/docs-tools");
|
|
|
9
9
|
const previewAnnotations = (entry = [], options) => {
|
|
10
10
|
if (!(0, docs_tools_1.hasDocsOrControls)(options))
|
|
11
11
|
return entry;
|
|
12
|
-
return [...entry, path_1.default.join(__dirname, '
|
|
12
|
+
return [...entry, path_1.default.join(__dirname, '../../dist/client/docs/config')];
|
|
13
13
|
};
|
|
14
14
|
exports.previewAnnotations = previewAnnotations;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/angular",
|
|
3
|
-
"version": "7.0.0-alpha.
|
|
3
|
+
"version": "7.0.0-alpha.48",
|
|
4
4
|
"description": "Storybook for Angular: Develop Angular components in isolation with hot reloading.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook",
|
|
@@ -20,33 +20,33 @@
|
|
|
20
20
|
"url": "https://opencollective.com/storybook"
|
|
21
21
|
},
|
|
22
22
|
"license": "MIT",
|
|
23
|
-
"main": "dist/
|
|
24
|
-
"
|
|
25
|
-
"types": "dist/types/index.d.ts",
|
|
23
|
+
"main": "dist/index.js",
|
|
24
|
+
"types": "dist/index.d.ts",
|
|
26
25
|
"files": [
|
|
27
26
|
"dist/**/*",
|
|
27
|
+
"template/**/*",
|
|
28
28
|
"README.md",
|
|
29
29
|
"*.js",
|
|
30
30
|
"*.d.ts"
|
|
31
31
|
],
|
|
32
32
|
"scripts": {
|
|
33
|
-
"check": "../../../scripts/node_modules/.bin/tsc
|
|
34
|
-
"prep": "
|
|
33
|
+
"check": "../../../scripts/node_modules/.bin/tsc",
|
|
34
|
+
"prep": "rimraf dist && ../../../scripts/node_modules/.bin/tsc --project tsconfig.build.json && echo \"Preventing passing flags to tsc\""
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@storybook/addons": "7.0.0-alpha.
|
|
38
|
-
"@storybook/api": "7.0.0-alpha.
|
|
39
|
-
"@storybook/builder-webpack5": "7.0.0-alpha.
|
|
40
|
-
"@storybook/client-logger": "7.0.0-alpha.
|
|
41
|
-
"@storybook/core-client": "7.0.0-alpha.
|
|
42
|
-
"@storybook/core-common": "7.0.0-alpha.
|
|
43
|
-
"@storybook/core-events": "7.0.0-alpha.
|
|
44
|
-
"@storybook/core-server": "7.0.0-alpha.
|
|
45
|
-
"@storybook/core-webpack": "7.0.0-alpha.
|
|
46
|
-
"@storybook/docs-tools": "7.0.0-alpha.
|
|
47
|
-
"@storybook/node-logger": "7.0.0-alpha.
|
|
48
|
-
"@storybook/store": "7.0.0-alpha.
|
|
49
|
-
"@storybook/types": "7.0.0-alpha.
|
|
37
|
+
"@storybook/addons": "7.0.0-alpha.48",
|
|
38
|
+
"@storybook/api": "7.0.0-alpha.48",
|
|
39
|
+
"@storybook/builder-webpack5": "7.0.0-alpha.48",
|
|
40
|
+
"@storybook/client-logger": "7.0.0-alpha.48",
|
|
41
|
+
"@storybook/core-client": "7.0.0-alpha.48",
|
|
42
|
+
"@storybook/core-common": "7.0.0-alpha.48",
|
|
43
|
+
"@storybook/core-events": "7.0.0-alpha.48",
|
|
44
|
+
"@storybook/core-server": "7.0.0-alpha.48",
|
|
45
|
+
"@storybook/core-webpack": "7.0.0-alpha.48",
|
|
46
|
+
"@storybook/docs-tools": "7.0.0-alpha.48",
|
|
47
|
+
"@storybook/node-logger": "7.0.0-alpha.48",
|
|
48
|
+
"@storybook/store": "7.0.0-alpha.48",
|
|
49
|
+
"@storybook/types": "7.0.0-alpha.48",
|
|
50
50
|
"@types/node": "^16.0.0",
|
|
51
51
|
"@types/react": "^16.14.23",
|
|
52
52
|
"@types/react-dom": "^16.9.14",
|
|
@@ -77,11 +77,13 @@
|
|
|
77
77
|
"@angular/platform-browser": "^13.3.6",
|
|
78
78
|
"@angular/platform-browser-dynamic": "^13.3.6",
|
|
79
79
|
"@nrwl/workspace": "14.6.1",
|
|
80
|
+
"@types/rimraf": "^3.0.2",
|
|
80
81
|
"@types/tmp": "^0.2.3",
|
|
81
82
|
"cross-spawn": "^7.0.3",
|
|
82
83
|
"jest": "^27.5.1",
|
|
83
84
|
"jest-preset-angular": "^12.0.0",
|
|
84
85
|
"jest-specific-snapshot": "^5.0.0",
|
|
86
|
+
"rimraf": "^3.0.2",
|
|
85
87
|
"tmp": "^0.2.1",
|
|
86
88
|
"typescript": "~4.6.3",
|
|
87
89
|
"webpack": "5",
|
|
@@ -119,6 +121,6 @@
|
|
|
119
121
|
"publishConfig": {
|
|
120
122
|
"access": "public"
|
|
121
123
|
},
|
|
122
|
-
"builders": "dist/
|
|
123
|
-
"gitHead": "
|
|
124
|
+
"builders": "dist/builders/builders.json",
|
|
125
|
+
"gitHead": "b58a29b785462f8a8b711b6bb2d7223fd6dc17fd"
|
|
124
126
|
}
|
package/preset.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
module.exports = require('./dist/
|
|
1
|
+
module.exports = require('./dist/preset');
|
package/renderer.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './dist/
|
|
1
|
+
export * from './dist/renderer.d';
|
package/renderer.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
module.exports = require('./dist/
|
|
1
|
+
module.exports = require('./dist/renderer');
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/angular';
|
|
2
|
+
import Button from './button.component';
|
|
3
|
+
|
|
4
|
+
// More on how to set up stories at: https://storybook.js.org/docs/angular/writing-stories/introduction#default-export
|
|
5
|
+
const meta: Meta<Button> = {
|
|
6
|
+
title: 'Example/Button',
|
|
7
|
+
component: Button,
|
|
8
|
+
// This component will have an automatically generated docsPage entry: https://storybook.js.org/docs/angular/writing-docs/docs-page
|
|
9
|
+
tags: ['docsPage'],
|
|
10
|
+
// More on component templates: https://storybook.js.org/docs/angular/writing-stories/introduction#using-args
|
|
11
|
+
render: (args: Button) => ({
|
|
12
|
+
props: {
|
|
13
|
+
backgroundColor: null,
|
|
14
|
+
...args,
|
|
15
|
+
},
|
|
16
|
+
}),
|
|
17
|
+
// More on argTypes: https://storybook.js.org/docs/angular/api/argtypes
|
|
18
|
+
argTypes: {
|
|
19
|
+
backgroundColor: {
|
|
20
|
+
control: 'color',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export default meta;
|
|
26
|
+
type Story = StoryObj<Button>;
|
|
27
|
+
|
|
28
|
+
// More on component templates: https://storybook.js.org/docs/angular/writing-stories/introduction#using-args
|
|
29
|
+
export const Primary: Story = {
|
|
30
|
+
args: {
|
|
31
|
+
primary: true,
|
|
32
|
+
label: 'Button',
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const Secondary: Story = {
|
|
37
|
+
args: {
|
|
38
|
+
label: 'Button',
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export const Large: Story = {
|
|
43
|
+
args: {
|
|
44
|
+
size: 'large',
|
|
45
|
+
label: 'Button',
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const Small: Story = {
|
|
50
|
+
args: {
|
|
51
|
+
size: 'small',
|
|
52
|
+
label: 'Button',
|
|
53
|
+
},
|
|
54
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { moduleMetadata } from '@storybook/angular';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/angular';
|
|
3
|
+
import { CommonModule } from '@angular/common';
|
|
4
|
+
|
|
5
|
+
import Button from './button.component';
|
|
6
|
+
import Header from './header.component';
|
|
7
|
+
|
|
8
|
+
const meta: Meta<Header> = {
|
|
9
|
+
title: 'Example/Header',
|
|
10
|
+
component: Header,
|
|
11
|
+
// This component will have an automatically generated docsPage entry: https://storybook.js.org/docs/angular/writing-docs/docs-page
|
|
12
|
+
tags: ['docsPage'],
|
|
13
|
+
render: (args) => ({ props: args }),
|
|
14
|
+
decorators: [
|
|
15
|
+
moduleMetadata({
|
|
16
|
+
declarations: [Button],
|
|
17
|
+
imports: [CommonModule],
|
|
18
|
+
}),
|
|
19
|
+
],
|
|
20
|
+
parameters: {
|
|
21
|
+
// More on Story layout: https://storybook.js.org/docs/angular/configure/story-layout
|
|
22
|
+
layout: 'fullscreen',
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default meta;
|
|
27
|
+
type Story = StoryObj<Header>;
|
|
28
|
+
|
|
29
|
+
export const LoggedIn: Story = {
|
|
30
|
+
args: {
|
|
31
|
+
user: {
|
|
32
|
+
name: 'Jane Doe',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const LoggedOut: Story = {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/angular';
|
|
2
|
+
import { moduleMetadata } from '@storybook/angular';
|
|
3
|
+
import { within, userEvent } from '@storybook/testing-library';
|
|
4
|
+
import { CommonModule } from '@angular/common';
|
|
5
|
+
|
|
6
|
+
import Button from './button.component';
|
|
7
|
+
import Header from './header.component';
|
|
8
|
+
import Page from './page.component';
|
|
9
|
+
|
|
10
|
+
const meta: Meta<Page> = {
|
|
11
|
+
title: 'Example/Page',
|
|
12
|
+
component: Page,
|
|
13
|
+
parameters: {
|
|
14
|
+
// More on StoryFn layout: https://storybook.js.org/docs/angular/configure/story-layout
|
|
15
|
+
layout: 'fullscreen',
|
|
16
|
+
},
|
|
17
|
+
decorators: [
|
|
18
|
+
moduleMetadata({
|
|
19
|
+
declarations: [Button, Header],
|
|
20
|
+
imports: [CommonModule],
|
|
21
|
+
}),
|
|
22
|
+
],
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export default meta;
|
|
26
|
+
type Story = StoryObj<Page>;
|
|
27
|
+
|
|
28
|
+
export const LoggedOut: Story = {
|
|
29
|
+
render: (args: Page) => ({
|
|
30
|
+
props: args,
|
|
31
|
+
}),
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
// More on interaction testing: https://storybook.js.org/docs/angular/writing-tests/interaction-testing
|
|
35
|
+
export const LoggedIn: Story = {
|
|
36
|
+
render: (args: Page) => ({
|
|
37
|
+
props: args,
|
|
38
|
+
}),
|
|
39
|
+
play: async ({ canvasElement }) => {
|
|
40
|
+
const canvas = within(canvasElement);
|
|
41
|
+
const loginButton = await canvas.getByRole('button', {
|
|
42
|
+
name: /Log in/i,
|
|
43
|
+
});
|
|
44
|
+
await userEvent.click(loginButton);
|
|
45
|
+
},
|
|
46
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Component, Input, Output, EventEmitter } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
@Component({
|
|
4
|
+
selector: 'storybook-button',
|
|
5
|
+
template: ` <button
|
|
6
|
+
type="button"
|
|
7
|
+
(click)="onClick.emit($event)"
|
|
8
|
+
[ngClass]="classes"
|
|
9
|
+
[ngStyle]="{ 'background-color': backgroundColor }"
|
|
10
|
+
>
|
|
11
|
+
{{ label }}
|
|
12
|
+
</button>`,
|
|
13
|
+
styleUrls: ['./button.css'],
|
|
14
|
+
})
|
|
15
|
+
export default class ButtonComponent {
|
|
16
|
+
/**
|
|
17
|
+
* Is this the principal call to action on the page?
|
|
18
|
+
*/
|
|
19
|
+
@Input()
|
|
20
|
+
primary = false;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* What background color to use
|
|
24
|
+
*/
|
|
25
|
+
@Input()
|
|
26
|
+
backgroundColor?: string;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* How large should the button be?
|
|
30
|
+
*/
|
|
31
|
+
@Input()
|
|
32
|
+
size: 'small' | 'medium' | 'large' = 'medium';
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Button contents
|
|
36
|
+
*
|
|
37
|
+
* @required
|
|
38
|
+
*/
|
|
39
|
+
@Input()
|
|
40
|
+
label = 'Button';
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Optional click handler
|
|
44
|
+
*/
|
|
45
|
+
@Output()
|
|
46
|
+
onClick = new EventEmitter<Event>();
|
|
47
|
+
|
|
48
|
+
public get classes(): string[] {
|
|
49
|
+
const mode = this.primary ? 'storybook-button--primary' : 'storybook-button--secondary';
|
|
50
|
+
|
|
51
|
+
return ['storybook-button', `storybook-button--${this.size}`, mode];
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { Component, Input, Output, EventEmitter } from '@angular/core';
|
|
2
|
+
import type { User } from './User';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'storybook-header',
|
|
6
|
+
template: `<header>
|
|
7
|
+
<div class="wrapper">
|
|
8
|
+
<div>
|
|
9
|
+
<svg width="32" height="32" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">
|
|
10
|
+
<g fill="none" fillRule="evenodd">
|
|
11
|
+
<path
|
|
12
|
+
d="M10 0h12a10 10 0 0110 10v12a10 10 0 01-10 10H10A10 10 0 010 22V10A10 10 0 0110 0z"
|
|
13
|
+
fill="#FFF"
|
|
14
|
+
/>
|
|
15
|
+
<path
|
|
16
|
+
d="M5.3 10.6l10.4 6v11.1l-10.4-6v-11zm11.4-6.2l9.7 5.5-9.7 5.6V4.4z"
|
|
17
|
+
fill="#555AB9"
|
|
18
|
+
/>
|
|
19
|
+
<path
|
|
20
|
+
d="M27.2 10.6v11.2l-10.5 6V16.5l10.5-6zM15.7 4.4v11L6 10l9.7-5.5z"
|
|
21
|
+
fill="#91BAF8"
|
|
22
|
+
/>
|
|
23
|
+
</g>
|
|
24
|
+
</svg>
|
|
25
|
+
<h1>Acme</h1>
|
|
26
|
+
</div>
|
|
27
|
+
<div>
|
|
28
|
+
<div *ngIf="user">
|
|
29
|
+
<span class="welcome">
|
|
30
|
+
Welcome, <b>{{ user.name }}</b
|
|
31
|
+
>!
|
|
32
|
+
</span>
|
|
33
|
+
<storybook-button
|
|
34
|
+
*ngIf="user"
|
|
35
|
+
size="small"
|
|
36
|
+
(onClick)="onLogout.emit($event)"
|
|
37
|
+
label="Log out"
|
|
38
|
+
></storybook-button>
|
|
39
|
+
</div>
|
|
40
|
+
<div *ngIf="!user">
|
|
41
|
+
<storybook-button
|
|
42
|
+
*ngIf="!user"
|
|
43
|
+
size="small"
|
|
44
|
+
class="margin-left"
|
|
45
|
+
(onClick)="onLogin.emit($event)"
|
|
46
|
+
label="Log in"
|
|
47
|
+
></storybook-button>
|
|
48
|
+
<storybook-button
|
|
49
|
+
*ngIf="!user"
|
|
50
|
+
primary
|
|
51
|
+
size="small"
|
|
52
|
+
primary="true"
|
|
53
|
+
class="margin-left"
|
|
54
|
+
(onClick)="onCreateAccount.emit($event)"
|
|
55
|
+
label="Sign up"
|
|
56
|
+
></storybook-button>
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
</header>`,
|
|
61
|
+
styleUrls: ['./header.css'],
|
|
62
|
+
})
|
|
63
|
+
export default class HeaderComponent {
|
|
64
|
+
@Input()
|
|
65
|
+
user: User | null = null;
|
|
66
|
+
|
|
67
|
+
@Output()
|
|
68
|
+
onLogin = new EventEmitter<Event>();
|
|
69
|
+
|
|
70
|
+
@Output()
|
|
71
|
+
onLogout = new EventEmitter<Event>();
|
|
72
|
+
|
|
73
|
+
@Output()
|
|
74
|
+
onCreateAccount = new EventEmitter<Event>();
|
|
75
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
import type { User } from './User';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'storybook-page',
|
|
6
|
+
template: `<article>
|
|
7
|
+
<storybook-header
|
|
8
|
+
[user]="user"
|
|
9
|
+
(onLogout)="doLogout()"
|
|
10
|
+
(onLogin)="doLogin()"
|
|
11
|
+
(onCreateAccount)="doCreateAccount()"
|
|
12
|
+
></storybook-header>
|
|
13
|
+
<section>
|
|
14
|
+
<h2>Pages in Storybook</h2>
|
|
15
|
+
<p>
|
|
16
|
+
We recommend building UIs with a
|
|
17
|
+
<a href="https://componentdriven.org" target="_blank" rel="noopener noreferrer">
|
|
18
|
+
<strong>component-driven</strong>
|
|
19
|
+
</a>
|
|
20
|
+
process starting with atomic components and ending with pages.
|
|
21
|
+
</p>
|
|
22
|
+
<p>
|
|
23
|
+
Render pages with mock data. This makes it easy to build and review page states without
|
|
24
|
+
needing to navigate to them in your app. Here are some handy patterns for managing page data
|
|
25
|
+
in Storybook:
|
|
26
|
+
</p>
|
|
27
|
+
<ul>
|
|
28
|
+
<li>
|
|
29
|
+
Use a higher-level connected component. Storybook helps you compose such data from the
|
|
30
|
+
"args" of child component stories
|
|
31
|
+
</li>
|
|
32
|
+
<li>
|
|
33
|
+
Assemble data in the page component from your services. You can mock these services out
|
|
34
|
+
using Storybook.
|
|
35
|
+
</li>
|
|
36
|
+
</ul>
|
|
37
|
+
<p>
|
|
38
|
+
Get a guided tutorial on component-driven development at
|
|
39
|
+
<a href="https://storybook.js.org/tutorials/" target="_blank" rel="noopener noreferrer">
|
|
40
|
+
Storybook tutorials
|
|
41
|
+
</a>
|
|
42
|
+
. Read more in the
|
|
43
|
+
<a href="https://storybook.js.org/docs" target="_blank" rel="noopener noreferrer"> docs </a>
|
|
44
|
+
.
|
|
45
|
+
</p>
|
|
46
|
+
<div class="tip-wrapper">
|
|
47
|
+
<span class="tip">Tip</span> Adjust the width of the canvas with the
|
|
48
|
+
<svg width="10" height="10" viewBox="0 0 12 12" xmlns="http://www.w3.org/2000/svg">
|
|
49
|
+
<g fill="none" fillRule="evenodd">
|
|
50
|
+
<path
|
|
51
|
+
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"
|
|
52
|
+
id="a"
|
|
53
|
+
fill="#999"
|
|
54
|
+
/>
|
|
55
|
+
</g>
|
|
56
|
+
</svg>
|
|
57
|
+
Viewports addon in the toolbar
|
|
58
|
+
</div>
|
|
59
|
+
</section>
|
|
60
|
+
</article>`,
|
|
61
|
+
styleUrls: ['./page.css'],
|
|
62
|
+
})
|
|
63
|
+
export default class PageComponent {
|
|
64
|
+
user: User | null = null;
|
|
65
|
+
|
|
66
|
+
doLogout() {
|
|
67
|
+
this.user = null;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
doLogin() {
|
|
71
|
+
this.user = { name: 'Jane Doe' };
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
doCreateAccount() {
|
|
75
|
+
this.user = { name: 'Jane Doe' };
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Component, Input, Output, EventEmitter } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
@Component({
|
|
4
|
+
// Needs to be a different name to the CLI template button
|
|
5
|
+
selector: 'storybook-framework-button',
|
|
6
|
+
template: ` <button
|
|
7
|
+
type="button"
|
|
8
|
+
(click)="onClick.emit($event)"
|
|
9
|
+
[ngClass]="classes"
|
|
10
|
+
[ngStyle]="{ 'background-color': backgroundColor }"
|
|
11
|
+
>
|
|
12
|
+
{{ label }}
|
|
13
|
+
</button>`,
|
|
14
|
+
styleUrls: ['./button.css'],
|
|
15
|
+
})
|
|
16
|
+
export default class FrameworkButtonComponent {
|
|
17
|
+
/**
|
|
18
|
+
* Is this the principal call to action on the page?
|
|
19
|
+
*/
|
|
20
|
+
@Input()
|
|
21
|
+
primary = false;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* What background color to use
|
|
25
|
+
*/
|
|
26
|
+
@Input()
|
|
27
|
+
backgroundColor?: string;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* How large should the button be?
|
|
31
|
+
*/
|
|
32
|
+
@Input()
|
|
33
|
+
size: 'small' | 'medium' | 'large' = 'medium';
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Button contents
|
|
37
|
+
*
|
|
38
|
+
* @required
|
|
39
|
+
*/
|
|
40
|
+
@Input()
|
|
41
|
+
label = 'Button';
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Optional click handler
|
|
45
|
+
*/
|
|
46
|
+
@Output()
|
|
47
|
+
onClick = new EventEmitter<Event>();
|
|
48
|
+
|
|
49
|
+
public get classes(): string[] {
|
|
50
|
+
const mode = this.primary ? 'storybook-button--primary' : 'storybook-button--secondary';
|
|
51
|
+
|
|
52
|
+
return ['storybook-button', `storybook-button--${this.size}`, mode];
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
.storybook-button {
|
|
2
|
+
font-family: 'Nunito Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
|
3
|
+
font-weight: 700;
|
|
4
|
+
border: 0;
|
|
5
|
+
border-radius: 3em;
|
|
6
|
+
cursor: pointer;
|
|
7
|
+
display: inline-block;
|
|
8
|
+
line-height: 1;
|
|
9
|
+
}
|
|
10
|
+
.storybook-button--primary {
|
|
11
|
+
color: white;
|
|
12
|
+
background-color: #1ea7fd;
|
|
13
|
+
}
|
|
14
|
+
.storybook-button--secondary {
|
|
15
|
+
color: #333;
|
|
16
|
+
background-color: transparent;
|
|
17
|
+
box-shadow: rgba(0, 0, 0, 0.15) 0px 0px 0px 1px inset;
|
|
18
|
+
}
|
|
19
|
+
.storybook-button--small {
|
|
20
|
+
font-size: 12px;
|
|
21
|
+
padding: 10px 16px;
|
|
22
|
+
}
|
|
23
|
+
.storybook-button--medium {
|
|
24
|
+
font-size: 14px;
|
|
25
|
+
padding: 11px 20px;
|
|
26
|
+
}
|
|
27
|
+
.storybook-button--large {
|
|
28
|
+
font-size: 16px;
|
|
29
|
+
padding: 12px 24px;
|
|
30
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Component, Output, EventEmitter } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
@Component({
|
|
4
|
+
selector: 'storybook-form',
|
|
5
|
+
template: `
|
|
6
|
+
<form id="interaction-test-form" (submit)="handleSubmit($event)">
|
|
7
|
+
<label>
|
|
8
|
+
Enter Value
|
|
9
|
+
<input type="text" data-testid="value" [value]="value" required />
|
|
10
|
+
</label>
|
|
11
|
+
<button type="submit">Submit</button>
|
|
12
|
+
<p *ngIf="complete">Completed!!</p>
|
|
13
|
+
</form>
|
|
14
|
+
`,
|
|
15
|
+
})
|
|
16
|
+
export default class FormComponent {
|
|
17
|
+
/**
|
|
18
|
+
* Optional success handler
|
|
19
|
+
*/
|
|
20
|
+
@Output()
|
|
21
|
+
onSuccess = new EventEmitter<string>();
|
|
22
|
+
|
|
23
|
+
value = '';
|
|
24
|
+
|
|
25
|
+
complete = false;
|
|
26
|
+
|
|
27
|
+
handleSubmit(event: SubmitEvent) {
|
|
28
|
+
event.preventDefault();
|
|
29
|
+
this.onSuccess.emit(this.value);
|
|
30
|
+
setTimeout(() => {
|
|
31
|
+
this.complete = true;
|
|
32
|
+
}, 500);
|
|
33
|
+
setTimeout(() => {
|
|
34
|
+
this.complete = false;
|
|
35
|
+
}, 1500);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Component, Input } from '@angular/core';
|
|
2
|
+
import { DomSanitizer } from '@angular/platform-browser';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'storybook-html',
|
|
6
|
+
template: `<div [innerHTML]="safeContent"></div>`,
|
|
7
|
+
})
|
|
8
|
+
export default class HtmlComponent {
|
|
9
|
+
/**
|
|
10
|
+
* The HTML to render
|
|
11
|
+
*
|
|
12
|
+
* @required
|
|
13
|
+
*/
|
|
14
|
+
@Input()
|
|
15
|
+
content = '';
|
|
16
|
+
|
|
17
|
+
constructor(private sanitizer: DomSanitizer) {}
|
|
18
|
+
|
|
19
|
+
get safeContent() {
|
|
20
|
+
return this.sanitizer.bypassSecurityTrustHtml(this.content);
|
|
21
|
+
}
|
|
22
|
+
}
|