Skip to content

Commit e047bc2

Browse files
authored
[WNMGDS-246] Separate utilities documentation (#522)
* Separate out some * Split up the rest and import them all * Fix documentation organization in ChoiceList * Add back react documentation for the rest of the components * Rename doc scss files to partial naming convention * PR feedback * Mask description change
1 parent 8238c6a commit e047bc2

File tree

70 files changed

+797
-650
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+797
-650
lines changed

packages/core/src/components/ChoiceList/Choice.jsx

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,6 @@ import uniqueId from 'lodash.uniqueid';
88
/** Used to emit events to all Choice components */
99
const dsChoiceEmitter = new EvEmitter();
1010

11-
/**
12-
* A `Choice` component can be used to render a checkbox or radio button.
13-
*
14-
* Any _undocumented_ props that you pass to this component will be passed
15-
* to the `input` element, so you can use this to set additional attributes if
16-
* necessary.
17-
*/
1811
export class Choice extends React.PureComponent {
1912
constructor(props) {
2013
super(props);

packages/core/src/components/ChoiceList/ChoiceList.jsx

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,6 @@ import Select from './Select';
66
import classNames from 'classnames';
77
import uniqueId from 'lodash.uniqueid';
88

9-
/**
10-
* A `ChoiceList` component can be used to render a radio
11-
* button group, or checkbox group.
12-
*
13-
* By default the component determines the type of field for you, taking
14-
* into account accessibility and usability best practices. So, you can pass in
15-
* an array of `choices` and let it determine what type of field would be best for
16-
* the user, or alternatively you can manually pass in the `type` prop.
17-
*/
189
export class ChoiceList extends React.PureComponent {
1910
constructor(props) {
2011
super(props);

packages/core/src/components/ChoiceList/Select.jsx

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,6 @@ import React from 'react';
33
import classNames from 'classnames';
44
import uniqueId from 'lodash.uniqueid';
55

6-
/**
7-
* A `Select` component can be used to render an HTML `select` menu.
8-
* Any _undocumented_ props that you pass to this component will be passed
9-
* to the `select` element, so you can use this to set additional attributes if
10-
* necessary.
11-
*
12-
* Class-based component gives flexibility for active focus management
13-
* by allowing refs to be passed.
14-
*/
15-
166
export class Select extends React.PureComponent {
177
componentDidMount() {
188
if (this.props.focusTrigger) {

packages/core/src/components/ChoiceList/_Choice.docs.scss renamed to packages/core/src/components/ChoiceList/_ChoiceList.docs.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ Style guide: components.choice.size
3939
/*
4040
`<ChoiceList>`
4141
42+
A `ChoiceList` component can be used to render a radio button group, or checkbox group.
43+
44+
By default the component determines the type of field for you, taking into account accessibility and usability best practices. So, you can pass in an array of `choices` and let it determine what type of field would be best for the user, or alternatively you can manually pass in the `type` prop.
45+
4246
@react-component ChoiceList
4347
4448
Style guide: components.choice.choicelist
@@ -47,6 +51,10 @@ Style guide: components.choice.choicelist
4751
/*
4852
`<Choice>`
4953
54+
A `Choice` component can be used to render a checkbox or radio button.
55+
56+
Any _undocumented_ props that you pass to this component will be passed to the `input` element, so you can use this to set additional attributes if necessary.
57+
5058
@react-component Choice
5159
5260
Style guide: components.choice.react

packages/core/src/components/ChoiceList/_Select.docs.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ Style guide: components.select.choicelist
2323
/*
2424
`<Select>`
2525
26+
A `Select` component can be used to render an HTML `select` menu. Any _undocumented_ props that you pass to this component will be passed to the `select` element, so you can use this to set additional attributes if necessary.
27+
28+
Class-based component gives flexibility for active focus management by allowing refs to be passed.
29+
2630
@react-component Select
2731
2832
Style guide: components.select.react

packages/core/src/components/Dropdown/_Dropdown.docs.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ Style guide: components.dropdown
1313
/*
1414
`<Dropdown>`
1515
16+
A `Dropdown` component can be used to render an HTML `select` menu. Any _undocumented_ props that you pass to this component will be passed to the `select` element, so you can use this to set additional attributes if necessary.
17+
18+
Class-based component gives flexibility for active focus management by allowing refs to be passed.
19+
1620
@react-component Dropdown
1721
1822
Style guide: components.dropdown.react

packages/core/src/components/FormLabel/FormLabel.jsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@ import PropTypes from 'prop-types';
22
import React from 'react';
33
import classNames from 'classnames';
44

5-
/**
6-
* The `FormLabel` component provides the `label` (or `legend`) for a field,
7-
* along with any associated hint text and error message.
8-
*/
95
export class FormLabel extends React.PureComponent {
106
errorMessage() {
117
if (this.props.errorMessage) {

packages/core/src/components/FormLabel/_FormLabel.docs.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ Style guide: components.form-label
1111
/*
1212
`<FormLabel>`
1313
14+
The `FormLabel` component provides the `label` (or `legend`) for a field, along with any associated hint text and error message.
15+
1416
@react-component FormLabel
1517
1618
Style guide: components.form-label.react

packages/core/src/components/MonthPicker/MonthPicker.jsx

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,6 @@ import React from 'react';
77
import classNames from 'classnames';
88
import uniqueId from 'lodash.uniqueid';
99

10-
/*
11-
`<MonthPicker>`
12-
13-
@react-component MonthPicker
14-
15-
Style guide: components.month-picker.react
16-
*/
17-
1810
const NUM_MONTHS = 12;
1911
const monthNumbers = (() => {
2012
const months = [];
@@ -24,13 +16,6 @@ const monthNumbers = (() => {
2416
return months;
2517
})();
2618

27-
/**
28-
* The `MonthPicker` component renders a grid of checkboxes with shortened month
29-
* names as well as buttons for selecting or deselecting all. For internationalization
30-
* one can pass a `locale` prop, and the month names will change to match the
31-
* language of the locale. Full month names are also included as `aria-label`
32-
* attributes.
33-
*/
3419
export class MonthPicker extends React.PureComponent {
3520
constructor(props) {
3621
super(props);

packages/core/src/components/MonthPicker/_MonthPicker.docs.scss

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,13 @@ Month Picker
33
44
Style guide: components.month-picker
55
*/
6+
7+
/*
8+
`<MonthPicker>`
9+
10+
The `MonthPicker` component renders a grid of checkboxes with shortened month names as well as buttons for selecting or deselecting all. For internationalization one can pass a `locale` prop, and the month names will change to match the language of the locale. Full month names are also included as `aria-label` attributes.
11+
12+
@react-component MonthPicker
13+
14+
Style guide: components.month-picker.react
15+
*/

0 commit comments

Comments
 (0)