Skip to content

Commit e5da4fa

Browse files
marissahuysentruytcastastrophe
authored andcommitted
chore(colorarea,colorhandle,colorloupe,colorslider,colorwheel): remove mdx files (#3409)
* docs(colorarea): remove MDX file - adds links to other color components - migrates documentation from MDX to stories file * docs(colorhandle): remove MDX file - adds links to other color components - migrates documentation from MDX to stories file * docs(colorloupe): remove MDX file - migrates documentation from MDX to stories file * docs(colorslider): remove MDX file - migrates documentation from MDX to stories file * docs(colorwheel): remove MDX file - adds missing documentation particularly around the WithColorArea story - migrates documentation from MDX to stories file * docs(colorarea): clarify docs on color area handle * docs(colorslider): add punctuation and reorganize docs
1 parent 63e86eb commit e5da4fa

File tree

10 files changed

+59
-279
lines changed

10 files changed

+59
-279
lines changed

components/colorarea/stories/colorarea.mdx

Lines changed: 0 additions & 47 deletions
This file was deleted.

components/colorarea/stories/colorarea.stories.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@ import { ColorAreaGroup } from "./colorarea.test.js";
66
import { Template } from "./template.js";
77

88
/**
9-
* The color area component allows users to visually select two properties of a color simultaneously. It's commonly used together with a color slider or color wheel. Some usage notes:
10-
* - The `.spectrum-ColorHandle` should be moved with the `transform: translate(x, y)` style property as the sliders are dragged
11-
* - Set the background style property of `.spectrum-ColorArea-gradient` to the gradient of the colors to be selected
12-
* - Set the value attribute of `.spectrum-ColorArea-slider[name=x]` to the currently selected x value (i.e. saturation)
13-
* - Set the value attribute of `.spectrum-ColorArea-slider[name=y]` to the currently selected y value (i.e. value)
14-
* - Set the value of the ColorHandle component to the selected color
15-
* - Marshall focus between the saturation and value sliders according to which keys are pressed (up/down for value, left/right for saturation)
9+
* The color area component allows users to visually select two properties of a color simultaneously. It's commonly used together with a [color slider](/docs/components-color-slider--docs) or [color wheel](/docs/components-color-wheel--docs).
10+
*
11+
* ## Usage notes
12+
* - The `.spectrum-ColorArea-handle` element should be moved with the `transform: translate(x, y)` style property as the sliders are dragged.
13+
* - Set the background style property of `.spectrum-ColorArea-gradient` to the gradient of the colors to be selected.
14+
* - Set the value attribute of `.spectrum-ColorArea-slider[name=x]` to the currently selected x value (i.e. saturation).
15+
* - Set the value attribute of `.spectrum-ColorArea-slider[name=y]` to the currently selected y value (i.e. value).
16+
* - Set the value of the [color handle component](/docs/components-color-handle--docs) to the selected color.
17+
* - Marshall focus between the saturation and value sliders according to which keys are pressed (up/down for value, left/right for saturation).
1618
*/
1719
export default {
1820
title: "Color area",
@@ -48,7 +50,6 @@ export default {
4850
packageJson,
4951
metadata,
5052
},
51-
tags: ["!autodocs"],
5253
};
5354

5455
export const Default = ColorAreaGroup.bind({});
@@ -64,6 +65,7 @@ CustomSize.args = {
6465
CustomSize.parameters = {
6566
chromatic: { disableSnapshot: true },
6667
};
68+
CustomSize.storyName = "Custom size";
6769

6870
export const Disabled = Template.bind({});
6971
Disabled.tags = ["!dev"];

components/colorhandle/stories/colorhandle.mdx

Lines changed: 0 additions & 51 deletions
This file was deleted.

components/colorhandle/stories/colorhandle.stories.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { ColorHandleGroup } from "./colorhandle.test.js";
66
import { Template } from "./template.js";
77

88
/**
9-
* The color handle component is used with color area, color slider and color wheel as the color selector.
9+
* The color handle component is used with [color area](/docs/components-color-area--docs), [color slider](/docs/components-color-slider--docs) and [color wheel](/docs/components-color-wheel--docs) as the color selector.
1010
*/
1111
export default {
1212
title: "Color handle",
@@ -53,9 +53,11 @@ export default {
5353
packageJson,
5454
metadata,
5555
},
56-
tags: ["!autodocs"],
5756
};
5857

58+
/**
59+
* Set the `--spectrum-picked-color` custom property to the color value you want to show.
60+
*/
5961
export const Default = ColorHandleGroup.bind({});
6062
Default.args = {};
6163

@@ -69,6 +71,9 @@ Disabled.parameters = {
6971
chromatic: { disableSnapshot: true },
7072
};
7173

74+
/**
75+
* Nest the [color loupe component](/docs/components-color-loupe--docs) within the color handle markup and apply `.is-open` to the `.spectrum-ColorLoupe` to display the loupe.
76+
*/
7277
export const WithColorLoupe = Template.bind({});
7378
WithColorLoupe.args = {
7479
isWithColorLoupe: true,
@@ -77,6 +82,7 @@ WithColorLoupe.tags = ["!dev"];
7782
WithColorLoupe.parameters = {
7883
chromatic: { disableSnapshot: true },
7984
};
85+
WithColorLoupe.storyName = "With color loupe";
8086

8187
// ********* VRT ONLY ********* //
8288
export const WithForcedColors = ColorHandleGroup.bind({});

components/colorloupe/stories/colorloupe.mdx

Lines changed: 0 additions & 45 deletions
This file was deleted.

components/colorloupe/stories/colorloupe.stories.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ import { ColorLoupeGroup } from "./colorloupe.test.js";
66

77
/**
88
* The color loupe component shows the output color that would otherwise be covered by a cursor, stylus, or finger during color selection.
9+
*
10+
* ## Usage notes
11+
*
12+
* - Set the `--spectrum-picked-color` custom property to the CSS color value you want to show.
13+
* - Implementations must apply the `.is-open` class to display the loupe.
14+
* - Color loupe does not have a disabled style. Do not show it when the handle it's attached to is disabled.
915
*/
1016
export default {
1117
title: "Color loupe",

components/colorslider/stories/colorslider.mdx

Lines changed: 0 additions & 64 deletions
This file was deleted.

components/colorslider/stories/colorslider.stories.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ import { Template } from "./template.js";
77

88
/**
99
* The color slider component lets users visually change an individual channel of a color.
10+
*
11+
* ## Usage notes
12+
* - Set the color of the nested [color handle component](/docs/components-color-handle--docs) to match the color slider’s currently selected color using its custom property, `--spectrum-picked-color`.
13+
- The `.spectrum-ColorHandle` should be moved with `inset-inline-*` (horizontal) or `inset-block-*` (vertical) style properties as the slider is dragged.
14+
* - Ensure that the min and max attributes of the `.spectrum-ColorSlider-slider` input are set to the corresponding scale (i.e. 0 to 1 for a, 0 to 255 for r, etc.).
15+
* - Ensure the step attribute of the `.spectrum-ColorSlider-slider` input is set appropriately (i.e. 0.1 for a, s, v or 1 and h, r, etc).
1016
*/
1117
export default {
1218
title: "Color slider",
@@ -57,9 +63,11 @@ export default {
5763
packageJson,
5864
metadata,
5965
},
60-
tags: ["!autodocs"],
6166
};
6267

68+
/**
69+
* By default, a color slider is horizontal and should be used when vertical space is more limited. The background style property of `.spectrum-ColorSlider-gradient` can be set to the gradient of the colors to be selected. The CSS will automatically reverse the gradient element horizontally when using a RTL (right-to-left) base direction.
70+
*/
6371
export const Default = ColorSliderGroup.bind({});
6472
Default.args = {
6573
gradientStops:
@@ -78,6 +86,9 @@ WithForcedColors.parameters = {
7886
};
7987

8088
// ********* DOCS ONLY ********* //
89+
/**
90+
* The vertical orientation is used when horizontal space is more limited.
91+
*/
8192
export const Vertical = Template.bind({});
8293
Vertical.args = {
8394
vertical: true,
@@ -97,6 +108,9 @@ Alpha.parameters = {
97108
chromatic: { disableSnapshot: true },
98109
};
99110

111+
/**
112+
* Alternatively, implementations can provide an `<img>` element with the gradient desired and apply the `.spectrum-ColorSlider-gradient` class.
113+
*/
100114
export const WithImage = Template.bind({});
101115
WithImage.args = {
102116
gradientType: "image",
@@ -105,7 +119,7 @@ WithImage.args = {
105119
"inset-inline-start": "50%",
106120
},
107121
};
108-
WithImage.storyName = "Image";
122+
WithImage.storyName = "With image";
109123
WithImage.tags = ["!dev"];
110124
WithImage.parameters = {
111125
chromatic: { disableSnapshot: true },

0 commit comments

Comments
 (0)