1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-25 17:13:24 +00:00

Merge branch 'main' into ps/extension-refresh

This commit is contained in:
Vicki League
2024-08-07 13:23:52 -04:00
28 changed files with 1071 additions and 31 deletions

View File

@@ -4,6 +4,10 @@ import * as stories from "./badge.stories";
<Meta of={stories} />
```ts
import { BadgeModule } from "@bitwarden/components";
```
# Badge
Badges are primarily used as labels, counters, and small buttons.

View File

@@ -70,9 +70,9 @@ export const Primary: Story = {
props: args,
template: /*html*/ `
<span class="tw-text-main">Span </span><span bitBadge [variant]="variant" [truncate]="truncate">Badge containing lengthy text</span>
<br><br>
<br /><br />
<span class="tw-text-main">Link </span><a href="#" bitBadge [variant]="variant" [truncate]="truncate">Badge</a>
<br><br>
<br /><br />
<span class="tw-text-main">Button </span><button bitBadge [variant]="variant" [truncate]="truncate">Badge</button>
`,
}),

View File

@@ -4,6 +4,10 @@ import * as stories from "./button.stories";
<Meta of={stories} />
```ts
import { ButtonModule } from "@bitwarden/components";
```
# Button
Buttons are interactive elements that can be triggered using a mouse, keyboard, or touch. They are

View File

@@ -0,0 +1,32 @@
import { Meta, Canvas, Source, Primary, Controls } from "@storybook/addon-docs";
import * as stories from "./checkbox.stories";
<Meta of={stories} />
```ts
import { CheckboxModule } from "@bitwarden/components";
```
# Checkbox
<Primary />
<Controls />
## Stories
### Default
<Canvas of={stories.Default} />
### Hint
<Canvas of={stories.Hint} />
### Custom
<Canvas of={stories.Custom} />
### Intermediate
<Canvas of={stories.Indeterminate} />

View File

@@ -20,7 +20,7 @@ import { CheckboxModule } from "./checkbox.module";
const template = /*html*/ `
<form [formGroup]="formObj">
<bit-form-control>
<input type="checkbox" bitCheckbox formControlName="checkbox">
<input type="checkbox" bitCheckbox formControlName="checkbox" />
<bit-label>Click me</bit-label>
</bit-form-control>
</form>
@@ -133,7 +133,7 @@ export const Hint: Story = {
template: /*html*/ `
<form [formGroup]="formObj">
<bit-form-control>
<input type="checkbox" bitCheckbox formControlName="checkbox">
<input type="checkbox" bitCheckbox formControlName="checkbox" />
<bit-label>Really long value that never ends.</bit-label>
<bit-hint>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur iaculis consequat enim vitae elementum.
@@ -181,15 +181,15 @@ export const Custom: Story = {
<div class="tw-flex tw-flex-col tw-w-32">
<label class="tw-text-main tw-flex tw-bg-secondary-300 tw-p-2">
A-Z
<input class="tw-ml-auto focus-visible:tw-ring-offset-secondary-300" type="checkbox" bitCheckbox>
<input class="tw-ml-auto focus-visible:tw-ring-offset-secondary-300" type="checkbox" bitCheckbox />
</label>
<label class="tw-text-main tw-flex tw-bg-secondary-300 tw-p-2">
a-z
<input class="tw-ml-auto focus-visible:tw-ring-offset-secondary-300" type="checkbox" bitCheckbox>
<input class="tw-ml-auto focus-visible:tw-ring-offset-secondary-300" type="checkbox" bitCheckbox />
</label>
<label class="tw-text-main tw-flex tw-bg-secondary-300 tw-p-2">
0-9
<input class="tw-ml-auto focus-visible:tw-ring-offset-secondary-300" type="checkbox" bitCheckbox>
<input class="tw-ml-auto focus-visible:tw-ring-offset-secondary-300" type="checkbox" bitCheckbox />
</label>
</div>
`,

View File

@@ -5,7 +5,7 @@ import * as stories from "./dialog.stories";
<Meta of={stories} />
```ts
import { DialogModule } from "@bitwarden/components";
import { DialogModule, DialogService } from "@bitwarden/components";
```
# Dialog

View File

@@ -145,9 +145,9 @@ export const ScrollingContent: Story = {
template: `
<bit-dialog title="Scrolling Example" [dialogSize]="dialogSize" [loading]="loading" [disablePadding]="disablePadding">
<span bitDialogContent>
Dialog body text goes here.<br>
Dialog body text goes here.<br />
<ng-container *ngFor="let _ of [].constructor(100)">
repeating lines of characters <br>
repeating lines of characters <br />
</ng-container>
end of sequence!
</span>

View File

@@ -5,7 +5,7 @@ import * as stories from "./simple-dialog.stories";
<Meta of={stories} />
```ts
import { DialogModule } from "@bitwarden/components";
import { DialogModule, DialogService } from "@bitwarden/components";
```
# Simple Dialogs

View File

@@ -64,10 +64,9 @@ export const ScrollingContent: Story = {
<bit-simple-dialog>
<span bitDialogTitle>Alert Dialog</span>
<span bitDialogContent>
Message Content
Message text goes here.<br>
Message Content Message text goes here.<br />
<ng-container *ngFor="let _ of [].constructor(100)">
repeating lines of characters <br>
repeating lines of characters <br />
</ng-container>
end of sequence!
</span>

View File

@@ -0,0 +1,60 @@
import { Meta, Canvas, Source, Primary, Controls } from "@storybook/addon-docs";
import * as stories from "./form-field.stories";
<Meta of={stories} />
```ts
import { FormFieldModule } from "@bitwarden/components";
```
# Field
<Primary />
<Controls />
## Stories
### Default
<Canvas of={stories.Default} />
### Required
<Canvas of={stories.Required} />
### Hint
<Canvas of={stories.Hint} />
### Disabled
<Canvas of={stories.Disabled} />
### Readonly
<Canvas of={stories.Readonly} />
### Input Group
<Canvas of={stories.InputGroup} />
### Button Input Group
<Canvas of={stories.ButtonInputGroup} />
### Disabled Button Input Group
<Canvas of={stories.DisabledButtonInputGroup} />
### Select
<Canvas of={stories.Select} />
### Advanced Select
<Canvas of={stories.AdvancedSelect} />
### Textarea
<Canvas of={stories.Textarea} />

View File

@@ -96,19 +96,19 @@ export const FullExample: Story = {
<bit-label>Name</bit-label>
<input bitInput formControlName="name" />
</bit-form-field>
<bit-form-field>
<bit-label>Email</bit-label>
<input bitInput formControlName="email" />
</bit-form-field>
<bit-form-field>
<bit-label>Country</bit-label>
<bit-select formControlName="country">
<bit-option *ngFor="let country of countries" [value]="country.value" [label]="country.name"></bit-option>
</bit-select>
</bit-form-field>
<bit-form-field>
<bit-label>Age</bit-label>
<input
@@ -119,13 +119,13 @@ export const FullExample: Story = {
max="150"
/>
</bit-form-field>
<bit-form-control>
<bit-label>Agree to terms</bit-label>
<input type="checkbox" bitCheckbox formControlName="terms">
<input type="checkbox" bitCheckbox formControlName="terms" />
<bit-hint>Required for the service to work properly</bit-hint>
</bit-form-control>
<bit-radio-group formControlName="updates">
<bit-label>Subscribe to updates?</bit-label>
<bit-radio-button value="yes">
@@ -138,7 +138,7 @@ export const FullExample: Story = {
<bit-label>Decide later</bit-label>
</bit-radio-button>
</bit-radio-group>
<button type="submit" bitButton buttonType="primary">Submit</button>
</form>
`,

View File

@@ -4,6 +4,10 @@ import * as stories from "./icon-button.stories";
<Meta of={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

View File

@@ -4,6 +4,10 @@ import * as stories from "./link.stories";
<Meta of={stories} />
```ts
import { LinkModule } from "@bitwarden/components";
```
# Link / Text button
Text Links and Buttons use the `primary-600` color and can use either the `<a>` or `<button>` tags.

View File

@@ -1,12 +1,10 @@
<div
class="tw-mx-auto tw-flex tw-flex-col tw-items-center tw-justify-center tw-pt-6 tw-text-center"
>
<div class="tw-max-w-sm">
<div class="tw-mx-auto tw-flex tw-flex-col tw-items-center tw-justify-center tw-pt-6">
<div class="tw-max-w-sm tw-flex tw-flex-col tw-items-center">
<bit-icon [icon]="icon" aria-hidden="true"></bit-icon>
<h3 class="tw-font-semibold">
<h3 class="tw-font-semibold tw-text-center">
<ng-content select="[slot=title]"></ng-content>
</h3>
<p>
<p class="tw-text-center">
<ng-content select="[slot=description]"></ng-content>
</p>
</div>

View File

@@ -0,0 +1,20 @@
import { Meta, Canvas, Source, Primary, Controls } from "@storybook/addon-docs";
import * as stories from "./search.stories";
<Meta of={stories} />
```ts
import { SearchModule } from "@bitwarden/components";
```
# Search
<Primary />
<Controls />
## Stories
### Default
<Canvas of={stories.Default} />

View File

@@ -0,0 +1,20 @@
import { Meta, Canvas, Source, Primary, Controls } from "@storybook/addon-docs";
import * as stories from "./select.stories";
<Meta of={stories} />
```ts
import { SelectModule } from "@bitwarden/components";
```
# Select
<Primary />
<Controls />
## Stories
### Default
<Canvas of={stories.Default} />

View File

@@ -44,7 +44,7 @@ export const Default: Story = {
<ng-template body>
<tr bitRow [alignContent]="alignRowContent">
<td bitCell>Cell 1</td>
<td bitCell>Cell 2 <br> Multiline Cell</td>
<td bitCell>Cell 2 <br /> Multiline Cell</td>
<td bitCell>Cell 3</td>
</tr>
<tr bitRow [alignContent]="alignRowContent">
@@ -53,7 +53,7 @@ export const Default: Story = {
<td bitCell>Cell 6</td>
</tr>
<tr bitRow [alignContent]="alignRowContent">
<td bitCell>Cell 7 <br> Multiline Cell</td>
<td bitCell>Cell 7 <br /> Multiline Cell</td>
<td bitCell>Cell 8</td>
<td bitCell>Cell 9</td>
</tr>

View File

@@ -0,0 +1,30 @@
import { Meta, Canvas, Source, Primary, Controls } from "@storybook/addon-docs";
import * as stories from "./toast.stories";
<Meta of={stories} />
```ts
import { ToastService } from "@bitwarden/components";
```
# Toast
<Primary />
<Controls />
## Stories
### Default
<Canvas of={stories.Default} />
### Long Content
Avoid using long messages in toasts.
<Canvas of={stories.LongContent} />
### Service
<Canvas of={stories.Service} />