Skip to content

Commit

Permalink
update stories files
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisdholt committed May 14, 2021
1 parent abd5ede commit adc711d
Show file tree
Hide file tree
Showing 67 changed files with 1,963 additions and 2,221 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import {
} from '../../styles/';
import { heightNumber } from '../../styles/size';

export const accordionItemStyles = (context, definition) => css`
export const accordionItemStyles = (context, definition) =>
css`
${display('flex')} :host {
box-sizing: border-box;
font-family: var(--body-font);
Expand Down Expand Up @@ -122,15 +123,15 @@ export const accordionItemStyles = (context, definition) => css`
z-index: 2;
}
`.withBehaviors(
accentFillRestBehavior,
neutralDividerRestBehavior,
neutralForegroundActiveBehavior,
neutralForegroundFocusBehavior,
neutralForegroundRestBehavior,
neutralForegroundHoverBehavior,
neutralFocusBehavior,
forcedColorsStylesheetBehavior(
css`
accentFillRestBehavior,
neutralDividerRestBehavior,
neutralForegroundActiveBehavior,
neutralForegroundFocusBehavior,
neutralForegroundRestBehavior,
neutralForegroundHoverBehavior,
neutralFocusBehavior,
forcedColorsStylesheetBehavior(
css`
.button:${focusVisible}::before {
border-color: ${SystemColors.Highlight};
box-shadow: 0 0 0 calc((var(--focus-outline-width) - var(--outline-width)) * 1px) ${SystemColors.Highlight};
Expand All @@ -139,5 +140,5 @@ export const accordionItemStyles = (context, definition) => css`
fill: ${SystemColors.ButtonText};
}
`,
),
);
),
);
9 changes: 1 addition & 8 deletions packages/web-components/src/accordion/accordion.stories.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
import { FluentDesignSystemProvider } from '../design-system-provider';
import Examples from './fixtures/base.html';
import { FluentAccordionItem } from './accordion-item';
import { FluentAccordion } from '.';

// Prevent tree-shaking
FluentAccordion;
FluentAccordionItem;
FluentDesignSystemProvider;
import './index';

export default {
title: 'Accordion',
Expand Down
23 changes: 12 additions & 11 deletions packages/web-components/src/accordion/accordion.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ import { css } from '@microsoft/fast-element';
import { display } from '@microsoft/fast-foundation';
import { accentFillRestBehavior, neutralDividerRestBehavior, neutralForegroundRestBehavior } from '../styles/';

export const accordionStyles = (context, definition) => css`
${display('flex')} :host {
box-sizing: border-box;
flex-direction: column;
font-family: var(--body-font);
font-size: var(--type-ramp-minus-1-font-size);
line-height: var(--type-ramp-minus-1-line-height);
color: ${neutralForegroundRestBehavior.var};
border-top: calc(var(--outline-width) * 1px) solid ${neutralDividerRestBehavior.var};
}
`.withBehaviors(accentFillRestBehavior, neutralDividerRestBehavior, neutralForegroundRestBehavior);
export const accordionStyles = (context, definition) =>
css`
${display('flex')} :host {
box-sizing: border-box;
flex-direction: column;
font-family: var(--body-font);
font-size: var(--type-ramp-minus-1-font-size);
line-height: var(--type-ramp-minus-1-line-height);
color: ${neutralForegroundRestBehavior.var};
border-top: calc(var(--outline-width) * 1px) solid ${neutralDividerRestBehavior.var};
}
`.withBehaviors(accentFillRestBehavior, neutralDividerRestBehavior, neutralForegroundRestBehavior);
7 changes: 1 addition & 6 deletions packages/web-components/src/anchor/anchor.stories.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import { FluentDesignSystemProvider } from '../design-system-provider';
import AnchorTemplate from './fixtures/anchor.html';
import { FluentAnchor } from './';

// Prevent tree-shaking
FluentAnchor;
FluentDesignSystemProvider;
import './index';

export default {
title: 'Anchor',
Expand Down
19 changes: 10 additions & 9 deletions packages/web-components/src/anchor/anchor.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ import {
} from '../styles/';
import { appearanceBehavior } from '../utilities/behaviors';

export const anchorStyles = (context, definition) => css`
${BaseButtonStyles}
`.withBehaviors(
appearanceBehavior('accent', AccentButtonStyles),
appearanceBehavior('hypertext', HypertextStyles),
appearanceBehavior('lightweight', LightweightButtonStyles),
appearanceBehavior('outline', OutlineButtonStyles),
appearanceBehavior('stealth', StealthButtonStyles),
);
export const anchorStyles = (context, definition) =>
css`
${BaseButtonStyles}
`.withBehaviors(
appearanceBehavior('accent', AccentButtonStyles),
appearanceBehavior('hypertext', HypertextStyles),
appearanceBehavior('lightweight', LightweightButtonStyles),
appearanceBehavior('outline', OutlineButtonStyles),
appearanceBehavior('stealth', StealthButtonStyles),
);
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import { STORY_RENDERED } from '@storybook/core-events';
import addons from '@storybook/addons';
import { Direction, RtlScrollConverter } from '@microsoft/fast-web-utilities';
import { FluentDesignSystemProvider } from '../design-system-provider';
import { FluentAnchoredRegion } from '../anchored-region';
import { AnchoredRegion } from '@microsoft/fast-foundation';
import AnchoreRegionTemplate from './fixtures/base.html';

// Prevent tree-shaking
FluentAnchoredRegion;
FluentDesignSystemProvider;
import './index';

let scalingViewportPreviousXValue: number = 250;
let scalingViewportPreviousYValue: number = 250;
Expand Down Expand Up @@ -45,7 +41,7 @@ function scrollViewports(): void {
function handleScrollViaUpdate(ev: Event): void {
if (ev.target instanceof HTMLElement) {
const scalingRegionUpdate: HTMLElement | null = document.getElementById('region-scaling-update');
if (scalingRegionUpdate instanceof FluentAnchoredRegion) {
if (scalingRegionUpdate instanceof AnchoredRegion) {
(scalingRegionUpdate as any).update();
}
}
Expand All @@ -56,7 +52,7 @@ function handleScrollViaOffset(ev: Event): void {
const scroller: HTMLElement = ev.target as HTMLElement;

const scalingRegionOffset: HTMLElement | null = document.getElementById('region-scaling-offset');
if (scalingRegionOffset instanceof FluentAnchoredRegion) {
if (scalingRegionOffset instanceof AnchoredRegion) {
(scalingRegionOffset as any).updateAnchorOffset(
scalingViewportPreviousXValue - scroller.scrollLeft,
scalingViewportPreviousYValue - scroller.scrollTop,
Expand Down
8 changes: 0 additions & 8 deletions packages/web-components/src/badge/badge.spec.ts

This file was deleted.

7 changes: 1 addition & 6 deletions packages/web-components/src/badge/badge.stories.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import { FluentDesignSystemProvider } from '../design-system-provider';
import BadgeTemplate from './fixtures/badge.html';
import { FluentBadge } from './';

// Prevent tree-shaking
FluentBadge;
FluentDesignSystemProvider;
import './index';

export default {
title: 'Badge',
Expand Down
2 changes: 1 addition & 1 deletion packages/web-components/src/badge/badge.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
neutralForegroundRestBehavior,
} from '../styles';

export const BadgeStyles = (context, definition) =>
export const badgeStyles = (context, definition) =>
css`
${display('inline-block')} :host {
box-sizing: border-box;
Expand Down
2 changes: 1 addition & 1 deletion packages/web-components/src/badge/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { attr, DOM } from '@microsoft/fast-element';
import { Badge as FoundationBadge, badgeTemplate as template } from '@microsoft/fast-foundation';
import { BadgeStyles as styles } from './badge.styles';
import { badgeStyles as styles } from './badge.styles';

/**
* Badge appearance options.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import { FluentDesignSystemProvider } from '../design-system-provider';
import BreadcrumbItemTemplate from './fixtures/breadcrumb-item.html';
import { FluentBreadcrumbItem } from '.';

// Prevent tree-shaking
FluentBreadcrumbItem;
FluentDesignSystemProvider;
import './index';

export default {
title: 'Breadcrumb Item',
Expand Down
2 changes: 1 addition & 1 deletion packages/web-components/src/breadcrumb-item/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BreadcrumbItem, BreadcrumbItemTemplate as template } from '@microsoft/fast-foundation';
import { BreadcrumbItem, breadcrumbItemTemplate as template } from '@microsoft/fast-foundation';
import { breadcrumbItemStyles as styles } from './breadcrumb-item.styles';

/**
Expand Down
9 changes: 1 addition & 8 deletions packages/web-components/src/breadcrumb/breadcrumb.stories.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
import { FluentDesignSystemProvider } from '../design-system-provider';
import { FluentBreadcrumbItem } from '../breadcrumb-item';
import BreadcrumbTemplate from './fixtures/breadcrumb.html';
import { FluentBreadcrumb } from '.';

// Prevent tree-shaking
FluentBreadcrumb;
FluentBreadcrumbItem;
FluentDesignSystemProvider;
import './index';

export default {
title: 'Breadcrumb',
Expand Down
7 changes: 1 addition & 6 deletions packages/web-components/src/button/button.stories.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import { FluentDesignSystemProvider } from '../design-system-provider';
import ButtonTemplate from './fixtures/button.html';
import { FluentButton } from './';

// Prevent tree-shaking
FluentButton;
FluentDesignSystemProvider;
import './index';

export default {
title: 'Button',
Expand Down
2 changes: 1 addition & 1 deletion packages/web-components/src/button/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { attr } from '@microsoft/fast-element';
import { Button as FoundationButton, ButtonTemplate as template } from '@microsoft/fast-foundation';
import { Button as FoundationButton, buttonTemplate as template } from '@microsoft/fast-foundation';
import { buttonStyles as styles } from './button.styles';

/**
Expand Down
7 changes: 1 addition & 6 deletions packages/web-components/src/card/card.stories.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import { FluentDesignSystemProvider } from '../design-system-provider';
import CardTemplate from './fixtures/card.html';
import { FluentCard } from './';

// Prevent tree-shaking
FluentCard;
FluentDesignSystemProvider;
import './index';

export default {
title: 'Card',
Expand Down
28 changes: 6 additions & 22 deletions packages/web-components/src/checkbox/checkbox.stories.ts
Original file line number Diff line number Diff line change
@@ -1,35 +1,19 @@
import { STORY_RENDERED } from '@storybook/core-events';
import addons from '@storybook/addons';
import { FluentDesignSystemProvider } from '../design-system-provider';
import { STORY_RENDERED } from '@storybook/core-events';
import { Checkbox as FoundationCheckbox } from '@microsoft/fast-foundation';
import Examples from './fixtures/checkbox.html';
import { FluentCheckbox } from './';

// Prevent tree-shaking
FluentCheckbox;
FluentDesignSystemProvider;
import './index';

addons.getChannel().addListener(STORY_RENDERED, (name: string) => {
if (name.toLowerCase().startsWith('checkbox')) {
setIndeterminate();
}
});

function setIndeterminate(): void {
document.querySelectorAll('.flag-indeterminate').forEach(el => {
if (el instanceof FluentCheckbox) {
document.querySelectorAll('.flag-indeterminate').forEach((el: FoundationCheckbox) => {
el.indeterminate = true;
}
});
}

document.addEventListener('readystatechange', () => {
if (document.readyState === 'complete') {
setIndeterminate();
});
}
});

export default {
title: 'Checkbox',
};

export const Checkbox = (): string => Examples;
export const Checkbox = () => Examples;
2 changes: 1 addition & 1 deletion packages/web-components/src/checkbox/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Checkbox, CheckboxTemplate as template } from '@microsoft/fast-foundation';
import { Checkbox, checkboxTemplate as template } from '@microsoft/fast-foundation';
import { checkboxStyles as styles } from './checkbox.styles';

/**
Expand Down
Loading

0 comments on commit adc711d

Please sign in to comment.