Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds Slider as a web component #27165

Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
b8d3f0f
Initial commit of styles and markup for slider
procload Mar 2, 2023
563e392
Cleans up some styles and adds Stories for states
procload Mar 2, 2023
94138aa
More Slider styles and stories
procload Mar 6, 2023
cba445a
Adds stripes to slider for vertical/horizontal. Deletes SliderLabel a…
procload Mar 7, 2023
36bd6fc
Fixes silly math
procload Mar 8, 2023
830c803
Cleans up CSS
procload Mar 10, 2023
d5b8b8a
Cleans up CSS and Stories for Slider
procload Mar 10, 2023
814e3a5
Initial commit of styles and markup for slider
procload Mar 2, 2023
278d1f2
More Slider styles and stories
procload Mar 6, 2023
5b90af1
Adds stripes to slider for vertical/horizontal. Deletes SliderLabel a…
procload Mar 7, 2023
cfbec7b
Fixes silly math
procload Mar 8, 2023
f5be020
Fixes some styles on checkmarks
procload Mar 14, 2023
fcf6d60
Adds check to see if Step was set
procload Mar 14, 2023
63072e5
Generates API report
procload Mar 14, 2023
6810bee
Removes some duplicate CSS and cleans up spec
procload Mar 14, 2023
47bd722
Adds slider to index.ts and package.json
procload Mar 15, 2023
415ab79
Addresses initial round of feedback to PR
procload Mar 15, 2023
3b92f87
Renames sizeChanged to stepChanged. Duh.
procload Mar 15, 2023
b77c99d
Adds JSDOC comments
procload Mar 15, 2023
40e4807
update slider step rate code
chrisdholt Mar 21, 2023
af05433
Merge pull request #1 from chrisdholt/users/chhol/update-slider-step-…
procload Mar 21, 2023
53ff7d5
Adds export to SliderOrientation
procload Mar 21, 2023
c6b24d2
Adds new focus style and fixes overflow visual bug
procload Mar 22, 2023
d14c0e1
Fixes build errors
procload Mar 23, 2023
8a5e30b
Adds export to SliderOrientation
procload Mar 21, 2023
37ad17f
Adds new focus style and fixes overflow visual bug
procload Mar 22, 2023
5e2b6f2
Fixes build errors
procload Mar 23, 2023
76f1a6d
Runs API report
procload Mar 23, 2023
575bb52
Merge branch 'users/procload/add-slider-and-sliderlabel-as-web-compon…
procload Mar 23, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "Adds Slider as a web component",
"packageName": "@fluentui/web-components",
"email": "ryan@ryanmerrill.net",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
colorPaletteRedBackground3,
} from '../theme/design-tokens.js';

/** Text styles
/** ProgressBar styles
procload marked this conversation as resolved.
Show resolved Hide resolved
* @public
*/
export const styles = css`
Expand Down
74 changes: 0 additions & 74 deletions packages/web-components/src/slider-label/slider-label.spec.md

This file was deleted.

4 changes: 4 additions & 0 deletions packages/web-components/src/slider/define.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { FluentDesignSystem } from '../fluent-design-system.js';
import { definition } from './slider.definition.js';

definition.define(FluentDesignSystem.registry);
5 changes: 5 additions & 0 deletions packages/web-components/src/slider/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export * from './slider.js';
export * from './slider.options.js';
export { definition as SliderDefinition } from './slider.definition.js';
export { styles as SliderStyles } from './slider.styles.js';
export { template as SliderTemplate } from './slider.template.js';
18 changes: 18 additions & 0 deletions packages/web-components/src/slider/slider.definition.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { FluentDesignSystem } from '../fluent-design-system.js';
import { Slider } from './slider.js';
import { styles } from './slider.styles.js';
import { template } from './slider.template.js';

/**
* The Fluent Slider Element.
*
*
* @public
* @remarks
* HTML Element: \<fluent-slider\>
*/
export const definition = Slider.compose({
name: `${FluentDesignSystem.prefix}-slider`,
template,
styles,
});
16 changes: 16 additions & 0 deletions packages/web-components/src/slider/slider.options.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { ValuesOf } from '@microsoft/fast-foundation';

procload marked this conversation as resolved.
Show resolved Hide resolved
/**
* SliderSize Constants
* @public
*/
export const SliderSize = {
small: 'small',
medium: 'medium',
} as const;

/**
* Applies bar height to the slider rail and diameter to the slider thumbs
* @public
*/
export type SliderSize = ValuesOf<typeof SliderSize>;
1 change: 0 additions & 1 deletion packages/web-components/src/slider/slider.spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ None
- no `defaultValue` or `value` attributes, instead only `current-value` that specifies the selected range of the slider
- `rail` is in Fluent React; `track` is in FAST Foundation
- No value indicators to the left/right of slider in FAST Slider. These should be present in Fluent version. This will be handled through slotting in the the SliderLabel component.
- No default support for the ticks on the slider when `step` is set. This will be handled through slotting in the SliderLabel component.
- [x] [Fluent UI React V9 Storybook](https://aka.ms/fluentui-storybook) for implementation differences and document
- [Fluent React V9 Slider](https://master--628d031b55e942004ac95df1.chromatic.com/?path=/docs/components-slider--default)
- [x] [Open GitHub issues related to component](https://github.com/microsoft/fluentui/wiki/Component-Implementation-Guide#find-open-issues-on-github)
Expand Down
81 changes: 81 additions & 0 deletions packages/web-components/src/slider/slider.stories.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
import { html } from '@microsoft/fast-element';
import type { Args, Meta } from '@storybook/html';
import { renderComponent } from '../helpers.stories.js';
import { SliderSize } from './slider.options.js';
import type { Slider as FluentSlider } from './slider.js';
import './define.js';

type SliderStoryArgs = Args & FluentSlider;
type SliderStoryMeta = Meta<SliderStoryArgs>;

const storyTemplate = html<SliderStoryArgs>`
<fluent-slider
?disabled=${x => x.disabled}
?readonly=${x => x.readOnly}
step=${x => x.step}
size=${x => x.size}
min=${x => x.min}
max=${x => x.max}
orientation=${x => x.orientation}
value=${x => x.value}
></fluent-slider>
`;

export default {
title: 'Components/Slider',
args: {
disabled: false,
readOnly: false,
min: 0,
max: 100,
size: SliderSize.medium,
orientation: 'horizontal',
},
argTypes: {
disabled: { control: 'boolean' },
readOnly: { control: 'boolean' },
min: {
control: 'number',
defaultValue: 0,
},
max: {
control: 'number',
defaultValue: 100,
},
value: { control: 'number', defaultValue: 50 },
size: {
control: {
type: 'inline-radio',
options: Object.values(SliderSize),
},
},
orientation: {
control: {
type: 'inline-radio',
options: ['horizontal', 'vertical'],
},
},
},
} as SliderStoryMeta;

export const Slider = renderComponent(storyTemplate).bind({});

export const SliderVertical = renderComponent(html<SliderStoryArgs>`
<fluent-slider orientation="vertical" step="20" value="60" min="0" max="100"></fluent-slider>
`);
procload marked this conversation as resolved.
Show resolved Hide resolved

export const SliderSmall = renderComponent(html<SliderStoryArgs>`
<fluent-slider size="small" value="10" min="0" max="10"></fluent-slider>
`);
procload marked this conversation as resolved.
Show resolved Hide resolved

export const SliderSteps = renderComponent(html<SliderStoryArgs>`
<fluent-slider step="10" value="10" min="0" max="100"></fluent-slider>
`);

export const SliderDisabled = renderComponent(html<SliderStoryArgs>`
<fluent-slider disabled value="10" min="0" max="100"></fluent-slider>
`);

export const SliderDisabledWithSteps = renderComponent(html<SliderStoryArgs>`
<fluent-slider step="25" disabled value="50" min="0" max="100"></fluent-slider>
`);
procload marked this conversation as resolved.
Show resolved Hide resolved
Loading