From 66d9ab5dc0772193d29be873cca8c2a45bd7a816 Mon Sep 17 00:00:00 2001 From: Jonathan Prusik Date: Wed, 7 Aug 2024 11:13:29 -0400 Subject: [PATCH] [PM-9969] Papercut - Update component library storybook docs (#10191) * add component import examples * component library story html formatting/cleanup nits * Update libs/components/src/dialog/dialog/dialog.mdx Co-authored-by: Will Martin * Update libs/components/src/badge/badge.mdx Co-authored-by: Will Martin * Update libs/components/src/dialog/simple-dialog/simple-dialog.mdx Co-authored-by: Will Martin --------- Co-authored-by: Will Martin --- libs/components/src/badge/badge.mdx | 4 ++ libs/components/src/badge/badge.stories.ts | 4 +- libs/components/src/button/button.mdx | 4 ++ libs/components/src/checkbox/checkbox.mdx | 32 ++++++++++ .../src/checkbox/checkbox.stories.ts | 10 ++-- libs/components/src/dialog/dialog/dialog.mdx | 4 ++ .../src/dialog/dialog/dialog.stories.ts | 4 +- .../dialog/simple-dialog/simple-dialog.mdx | 4 ++ .../simple-dialog/simple-dialog.stories.ts | 5 +- libs/components/src/form-field/form-field.mdx | 60 +++++++++++++++++++ libs/components/src/form/form.stories.ts | 14 ++--- .../src/icon-button/icon-button.mdx | 4 ++ libs/components/src/link/link.mdx | 4 ++ libs/components/src/search/search.mdx | 20 +++++++ libs/components/src/select/select.mdx | 20 +++++++ libs/components/src/table/table.stories.ts | 4 +- libs/components/src/toast/toast.mdx | 30 ++++++++++ libs/components/src/typography/typography.mdx | 4 ++ 18 files changed, 210 insertions(+), 21 deletions(-) create mode 100644 libs/components/src/checkbox/checkbox.mdx create mode 100644 libs/components/src/form-field/form-field.mdx create mode 100644 libs/components/src/search/search.mdx create mode 100644 libs/components/src/select/select.mdx create mode 100644 libs/components/src/toast/toast.mdx diff --git a/libs/components/src/badge/badge.mdx b/libs/components/src/badge/badge.mdx index 1c91944997..3dd2459871 100644 --- a/libs/components/src/badge/badge.mdx +++ b/libs/components/src/badge/badge.mdx @@ -4,6 +4,10 @@ import * as stories from "./badge.stories"; +```ts +import { BadgeModule } from "@bitwarden/components"; +``` + # Badge The Badge directive can be used on a `` (non clickable events), or an `` or ` `, }), diff --git a/libs/components/src/button/button.mdx b/libs/components/src/button/button.mdx index 6dcbbbbfac..5ee709093e 100644 --- a/libs/components/src/button/button.mdx +++ b/libs/components/src/button/button.mdx @@ -4,6 +4,10 @@ import * as stories from "./button.stories"; +```ts +import { ButtonModule } from "@bitwarden/components"; +``` + # Button Buttons are interactive elements that can be triggered using a mouse, keyboard, or touch. They are diff --git a/libs/components/src/checkbox/checkbox.mdx b/libs/components/src/checkbox/checkbox.mdx new file mode 100644 index 0000000000..f3ce0d8fd0 --- /dev/null +++ b/libs/components/src/checkbox/checkbox.mdx @@ -0,0 +1,32 @@ +import { Meta, Canvas, Source, Primary, Controls } from "@storybook/addon-docs"; + +import * as stories from "./checkbox.stories"; + + + +```ts +import { CheckboxModule } from "@bitwarden/components"; +``` + +# Checkbox + + + + +## Stories + +### Default + + + +### Hint + + + +### Custom + + + +### Intermediate + + diff --git a/libs/components/src/checkbox/checkbox.stories.ts b/libs/components/src/checkbox/checkbox.stories.ts index 86b682240d..0d649eb433 100644 --- a/libs/components/src/checkbox/checkbox.stories.ts +++ b/libs/components/src/checkbox/checkbox.stories.ts @@ -19,7 +19,7 @@ import { CheckboxModule } from "./checkbox.module"; const template = `
- + Click me
@@ -107,7 +107,7 @@ export const Hint: Story = { template: `
- + Really long value that never ends. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur iaculis consequat enim vitae elementum. @@ -138,15 +138,15 @@ export const Custom: Story = {
`, diff --git a/libs/components/src/dialog/dialog/dialog.mdx b/libs/components/src/dialog/dialog/dialog.mdx index f1f7692d4c..d7ccd423da 100644 --- a/libs/components/src/dialog/dialog/dialog.mdx +++ b/libs/components/src/dialog/dialog/dialog.mdx @@ -4,6 +4,10 @@ import * as stories from "./dialog.stories"; +```ts +import { DialogModule, DialogService } from "@bitwarden/components"; +``` + # Dialog Dialogs are used throughout the app to help the user focus on a specific action. Use this dialog diff --git a/libs/components/src/dialog/dialog/dialog.stories.ts b/libs/components/src/dialog/dialog/dialog.stories.ts index ee377aa930..905123ac90 100644 --- a/libs/components/src/dialog/dialog/dialog.stories.ts +++ b/libs/components/src/dialog/dialog/dialog.stories.ts @@ -145,9 +145,9 @@ export const ScrollingContent: Story = { template: ` - Dialog body text goes here.
+ Dialog body text goes here.
- repeating lines of characters
+ repeating lines of characters
end of sequence!
diff --git a/libs/components/src/dialog/simple-dialog/simple-dialog.mdx b/libs/components/src/dialog/simple-dialog/simple-dialog.mdx index a78ba4650a..d188b3598e 100644 --- a/libs/components/src/dialog/simple-dialog/simple-dialog.mdx +++ b/libs/components/src/dialog/simple-dialog/simple-dialog.mdx @@ -4,6 +4,10 @@ import * as stories from "./simple-dialog.stories"; +```ts +import { DialogModule, DialogService } from "@bitwarden/components"; +``` + # Simple Dialogs Simple Dialogs are used throughout the app for simple alert or confirmation actions such as diff --git a/libs/components/src/dialog/simple-dialog/simple-dialog.stories.ts b/libs/components/src/dialog/simple-dialog/simple-dialog.stories.ts index a433de21be..34dedaaec0 100644 --- a/libs/components/src/dialog/simple-dialog/simple-dialog.stories.ts +++ b/libs/components/src/dialog/simple-dialog/simple-dialog.stories.ts @@ -64,10 +64,9 @@ export const ScrollingContent: Story = { Alert Dialog - Message Content - Message text goes here.
+ Message Content Message text goes here.
- repeating lines of characters
+ repeating lines of characters
end of sequence!
diff --git a/libs/components/src/form-field/form-field.mdx b/libs/components/src/form-field/form-field.mdx new file mode 100644 index 0000000000..d84535481a --- /dev/null +++ b/libs/components/src/form-field/form-field.mdx @@ -0,0 +1,60 @@ +import { Meta, Canvas, Source, Primary, Controls } from "@storybook/addon-docs"; + +import * as stories from "./form-field.stories"; + + + +```ts +import { FormFieldModule } from "@bitwarden/components"; +``` + +# Field + + + + +## Stories + +### Default + + + +### Required + + + +### Hint + + + +### Disabled + + + +### Readonly + + + +### Input Group + + + +### Button Input Group + + + +### Disabled Button Input Group + + + +### Select + + + +### Advanced Select + + + +### Textarea + + diff --git a/libs/components/src/form/form.stories.ts b/libs/components/src/form/form.stories.ts index cc4e9b62cf..8f08966ba5 100644 --- a/libs/components/src/form/form.stories.ts +++ b/libs/components/src/form/form.stories.ts @@ -96,19 +96,19 @@ export const FullExample: Story = { Name - + Email - + Country - + Age - + Agree to terms - + Required for the service to work properly - + Subscribe to updates? @@ -138,7 +138,7 @@ export const FullExample: Story = { Decide later - + `, diff --git a/libs/components/src/icon-button/icon-button.mdx b/libs/components/src/icon-button/icon-button.mdx index 817594a772..8361d4c399 100644 --- a/libs/components/src/icon-button/icon-button.mdx +++ b/libs/components/src/icon-button/icon-button.mdx @@ -4,6 +4,10 @@ import * as stories from "./icon-button.stories"; +```ts +import { IconButtonModule } from "@bitwarden/components"; +``` + # Icon Button Icon buttons are used when no text accompanies the button. It consists of an icon that may be diff --git a/libs/components/src/link/link.mdx b/libs/components/src/link/link.mdx index 100824277a..39d8de72fc 100644 --- a/libs/components/src/link/link.mdx +++ b/libs/components/src/link/link.mdx @@ -4,6 +4,10 @@ import * as stories from "./link.stories"; +```ts +import { LinkModule } from "@bitwarden/components"; +``` + # Link / Text button Text Links and Buttons use the `primary-600` color and can use either the `` or `