Skip to content

Commit dffd063

Browse files
bjarnefiOvergaard
andauthored
docs: Specific control types in storybook controls (#537)
* Specific control types in storybook controls * Set initial value on opacity story to 50% opacity * Run formatting * Update support for HSV --------- Co-authored-by: Jacob Overgaard <[email protected]>
1 parent 875d46e commit dffd063

File tree

2 files changed

+26
-8
lines changed

2 files changed

+26
-8
lines changed

packages/uui-color-picker/lib/uui-color-picker.story.ts

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ const defaultSwatches = [
3434
'#fff',
3535
];
3636

37+
const formats = ['hex', 'rgb', 'hsl', 'hsv'];
38+
const sizes = ['small', 'medium', 'large'];
39+
3740
const meta: Meta<UUIColorPickerElement> = {
3841
id: 'uui-color-picker',
3942
title: 'Inputs/Color/Color Picker',
@@ -42,6 +45,20 @@ const meta: Meta<UUIColorPickerElement> = {
4245
inline: false,
4346
swatches: defaultSwatches,
4447
format: 'hex',
48+
size: 'medium',
49+
},
50+
argTypes: {
51+
format: {
52+
options: formats,
53+
control: { type: 'select' },
54+
},
55+
size: {
56+
options: sizes,
57+
control: { type: 'select' },
58+
},
59+
value: {
60+
control: { type: 'color' },
61+
},
4562
},
4663
parameters: {
4764
readme: {
@@ -91,6 +108,7 @@ export const Disabled: Story = {
91108
export const WithOpacity: Story = {
92109
args: {
93110
opacity: true,
111+
value: 'rgba(0, 0, 0, 0.5)',
94112
},
95113
parameters: {
96114
docs: {
@@ -101,8 +119,6 @@ export const WithOpacity: Story = {
101119
},
102120
};
103121

104-
const formats = ['hex', 'rgb', 'hsl'];
105-
106122
export const Formats: Story = {
107123
args: {
108124
format: 'hex',
@@ -115,12 +131,6 @@ export const Formats: Story = {
115131
${story()}
116132
</div> `,
117133
],
118-
argTypes: {
119-
format: {
120-
options: formats,
121-
control: { type: 'select' },
122-
},
123-
},
124134
parameters: {
125135
docs: {
126136
source: {

packages/uui-color-slider/lib/uui-color-slider.story.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import readme from '../README.md?raw';
44

55
import './uui-color-slider.element';
66

7+
const types = ['hue', 'opacity'];
8+
79
const meta: Meta<UUIColorSliderElement> = {
810
id: 'uui-color-slider',
911
title: 'Inputs/Color/Color Slider',
@@ -19,6 +21,12 @@ const meta: Meta<UUIColorSliderElement> = {
1921
type: 'hue',
2022
color: '',
2123
},
24+
argTypes: {
25+
type: {
26+
options: types,
27+
control: { type: 'select' },
28+
},
29+
},
2230
parameters: {
2331
readme: {
2432
markdown: readme,

0 commit comments

Comments
 (0)