@moda/om 16.2.0 → 16.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/index.cjs.js +310 -278
  3. package/dist/index.cjs.js.map +1 -1
  4. package/dist/index.esm.js +309 -277
  5. package/dist/index.esm.js.map +1 -1
  6. package/dist/styles.css +1 -1
  7. package/package.json +18 -8
  8. package/src/components/AspectRatioBox/AspectRatioBox.tsx +4 -4
  9. package/src/components/AspectRatioBox/index.ts +1 -1
  10. package/src/components/Badge/Badge.stories.tsx +5 -5
  11. package/src/components/Badge/Badge.test.tsx +1 -1
  12. package/src/components/Breadcrumbs/Breadcrumb/Breadcrumb.tsx +6 -6
  13. package/src/components/Breadcrumbs/Breadcrumbs.stories.tsx +6 -6
  14. package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +2 -2
  15. package/src/components/Breadcrumbs/Breadcrumbs.tsx +1 -1
  16. package/src/components/Breakpoint/Breakpoint.stories.tsx +10 -9
  17. package/src/components/Breakpoint/Breakpoint.test.tsx +2 -2
  18. package/src/components/Breakpoint/generateMediaQuery.ts +5 -4
  19. package/src/components/Button/Button.stories.tsx +4 -4
  20. package/src/components/Checkbox/Checkbox.stories.tsx +5 -5
  21. package/src/components/Checkbox/Checkbox.test.tsx +3 -3
  22. package/src/components/Checkbox/Checkbox.tsx +4 -4
  23. package/src/components/Clickable/Clickable.stories.tsx +3 -3
  24. package/src/components/ColorSwatch/ColorSwatch.stories.tsx +11 -11
  25. package/src/components/ColorSwatch/ColorSwatch.test.tsx +1 -1
  26. package/src/components/ColorSwatch/ColorSwatch.tsx +1 -1
  27. package/src/components/Constrain/Constrain.stories.tsx +1 -1
  28. package/src/components/Constrain/ExceedConstrain.stories.tsx +2 -2
  29. package/src/components/ControlLink/ControlLink.stories.tsx +1 -1
  30. package/src/components/ControlLink/index.ts +1 -1
  31. package/src/components/CreditCardNumberInput/CreditCardNumberInput.stories.tsx +1 -1
  32. package/src/components/CreditCardNumberInput/CreditCardNumberInput.test.tsx +4 -4
  33. package/src/components/CreditCardNumberInput/CreditCardNumberInput.tsx +1 -0
  34. package/src/components/DefinitionList/DefinitionList.stories.tsx +3 -3
  35. package/src/components/DefinitionList/DefinitionList.test.tsx +1 -1
  36. package/src/components/Divider/Divider.stories.tsx +4 -4
  37. package/src/components/Divider/Divider.test.tsx +1 -1
  38. package/src/components/Divider/Divider.tsx +1 -1
  39. package/src/components/Divider/NoLineDivider.tsx +1 -1
  40. package/src/components/Divider/TwoLineDivider.tsx +1 -1
  41. package/src/components/Expandable/Expandable.stories.tsx +8 -8
  42. package/src/components/Expandable/Expandable.test.tsx +1 -1
  43. package/src/components/Expandable/Expandable.tsx +3 -2
  44. package/src/components/Field/Field.stories.tsx +4 -4
  45. package/src/components/Field/Field.test.tsx +7 -7
  46. package/src/components/Field/Field.tsx +5 -5
  47. package/src/components/Field/index.ts +1 -0
  48. package/src/components/Loading/Loading.test.tsx +1 -1
  49. package/src/components/Loading/Loading.tsx +2 -1
  50. package/src/components/Modal/Modal.test.tsx +2 -2
  51. package/src/components/ModalOverlay/ModalOverlay.test.tsx +2 -2
  52. package/src/components/ModalOverlay/ModalOverlay.tsx +2 -2
  53. package/src/components/Overlay/Overlay.stories.tsx +1 -1
  54. package/src/components/Paginator/Paginator.tsx +3 -3
  55. package/src/components/PasswordInput/PasswordInput.stories.tsx +1 -1
  56. package/src/components/PasswordInput/PasswordInput.tsx +6 -6
  57. package/src/components/Popover/Popover.stories.tsx +1 -1
  58. package/src/components/Popover/Popover.tsx +10 -7
  59. package/src/components/PromoBanner/PromoBanner.stories.tsx +9 -9
  60. package/src/components/PromoBanner/PromoBanner.tsx +1 -1
  61. package/src/components/RadioButton/RadioButton.stories.tsx +2 -2
  62. package/src/components/RadioButton/RadioButton.tsx +4 -4
  63. package/src/components/SearchInput/SearchInput.stories.tsx +2 -2
  64. package/src/components/SearchInput/SearchInput.test.tsx +1 -1
  65. package/src/components/SearchInput/SearchInput.tsx +3 -3
  66. package/src/components/Select/MultiSelect.tsx +7 -7
  67. package/src/components/Select/Select.stories.tsx +15 -14
  68. package/src/components/Select/Select.test.tsx +13 -13
  69. package/src/components/Select/Select.tsx +7 -7
  70. package/src/components/Select/SelectOption.tsx +1 -1
  71. package/src/components/Select/SelectOptions.tsx +5 -5
  72. package/src/components/SelectableButton/SelectableButton.stories.tsx +1 -1
  73. package/src/components/Shape/ArcWindow.tsx +10 -10
  74. package/src/components/Shape/Bradley.tsx +4 -4
  75. package/src/components/Shape/Brancusi.tsx +4 -4
  76. package/src/components/Shape/Circle.tsx +10 -10
  77. package/src/components/Shape/Diamond.tsx +10 -10
  78. package/src/components/Shape/Keyhole.tsx +4 -4
  79. package/src/components/Shape/Mirror.tsx +4 -4
  80. package/src/components/Shape/Oval.tsx +4 -4
  81. package/src/components/Shape/Triangle.tsx +7 -7
  82. package/src/components/Shape/Window.tsx +4 -4
  83. package/src/components/Stack/Stack.stories.tsx +3 -3
  84. package/src/components/Stack/Stack.test.tsx +1 -1
  85. package/src/components/Tabs/TabList.tsx +1 -1
  86. package/src/components/Tabs/TabPanel.tsx +1 -1
  87. package/src/components/Tabs/TabPanels.tsx +1 -1
  88. package/src/components/Tabs/Tabs.stories.tsx +2 -2
  89. package/src/components/Tabs/Tabs.test.tsx +2 -2
  90. package/src/components/Tabs/Tabs.tsx +7 -1
  91. package/src/components/Tag/Tag.tsx +6 -5
  92. package/src/components/Text/Text.stories.tsx +5 -5
  93. package/src/components/Text/Text.test.tsx +1 -1
  94. package/src/components/TextInput/TextInput.stories.tsx +1 -1
  95. package/src/components/TextInput/TextInput.test.tsx +1 -1
  96. package/src/components/Textarea/Textarea.stories.tsx +1 -1
  97. package/src/components/Textarea/Textarea.test.tsx +3 -3
  98. package/src/components/Toast/Toast.stories.tsx +1 -1
  99. package/src/components/Toast/Toast.test.tsx +1 -1
  100. package/src/components/Toast/Toast.tsx +6 -6
  101. package/src/components/VerticalDivider/VerticalDivider.stories.tsx +3 -3
  102. package/src/components/VerticalDivider/VerticalDivider.test.tsx +2 -2
  103. package/src/hooks/useKeyboardListNavigation.spec.ts +2 -1
  104. package/src/hooks/useKeyboardListNavigation.ts +2 -0
  105. package/src/hooks/useUpdateEffect.ts +1 -0
  106. package/src/index.ts +2 -2
  107. package/src/mixins/font-smoothing/font-smoothing.stories.tsx +8 -8
  108. package/src/mixins/overflow-scroll/overflow-scroll.stories.tsx +2 -2
  109. package/src/mixins/stack/stack.stories.tsx +5 -6
  110. package/src/mixins/thin-underline/thin-underline.stories.tsx +1 -1
  111. package/src/mixins/visually-hidden/visually-hidden.stories.tsx +1 -1
  112. package/src/utilities/States/State.tsx +3 -2
  113. package/src/utilities/States/States.tsx +4 -3
  114. package/src/utilities/States/StatesProps.tsx +5 -2
  115. package/src/utilities/States/isRenderProps.ts +1 -0
  116. package/src/utilities/States/stringifyProps.tsx +1 -0
@@ -20,33 +20,33 @@ const STATES = [
20
20
 
21
21
  export const Default = () => (
22
22
  <States<Partial<ColorSwatchProps>> states={STATES}>
23
- <ColorSwatch color='yellow' onClick={action('onClick')} />
23
+ <ColorSwatch color="yellow" onClick={action('onClick')} />
24
24
  </States>
25
25
  );
26
26
 
27
27
  export const Small = () => (
28
28
  <States<Partial<ColorSwatchProps>> states={STATES}>
29
- <ColorSwatch size='small' color='yellow' onClick={action('onClick')} />
29
+ <ColorSwatch size="small" color="yellow" onClick={action('onClick')} />
30
30
  </States>
31
31
  );
32
32
 
33
33
  export const White = () => (
34
34
  <States<Partial<ColorSwatchProps>> states={STATES}>
35
- <ColorSwatch size='small' color='white' onClick={action('onClick')} />
35
+ <ColorSwatch size="small" color="white" onClick={action('onClick')} />
36
36
  </States>
37
37
  );
38
38
 
39
39
  export const Swatches = () => (
40
40
  <States<ColorSwatchProps>>
41
- <Stack space={1} direction='horizontal'>
42
- <ColorSwatch onClick={action('onClick')} color='red' />
43
- <ColorSwatch onClick={action('onClick')} color='white' />
44
- <ColorSwatch onClick={action('onClick')} color='bronze' soldOut disabled />
45
- <ColorSwatch onClick={action('onClick')} color='nude' onSale />
41
+ <Stack space={1} direction="horizontal">
42
+ <ColorSwatch onClick={action('onClick')} color="red" />
43
+ <ColorSwatch onClick={action('onClick')} color="white" />
44
+ <ColorSwatch onClick={action('onClick')} color="bronze" soldOut disabled />
45
+ <ColorSwatch onClick={action('onClick')} color="nude" onSale />
46
46
  <ColorSwatch
47
47
  onClick={action('onClick')}
48
- backgroundUrl='https://www.modaoperandi.com/assets/images/products/730581/340267/sw/prada-animal-leopard-print-shell-shoulder-bag.jpg?_v=1581323237'
49
- color='nude'
48
+ backgroundUrl="https://www.modaoperandi.com/assets/images/products/730581/340267/sw/prada-animal-leopard-print-shell-shoulder-bag.jpg?_v=1581323237"
49
+ color="nude"
50
50
  onSale
51
51
  onMouseEnter={action('onMouseEnter')}
52
52
  onMouseLeave={action('onMouseLeave')}
@@ -56,7 +56,7 @@ export const Swatches = () => (
56
56
  );
57
57
 
58
58
  export const Constrained = () => (
59
- <Stack direction='horizontal' space={3}>
59
+ <Stack direction="horizontal" space={3}>
60
60
  {Object.keys(SKU_COLORS).map(color => (
61
61
  <ColorSwatch key={color} onClick={action('onClick')} color={color} />
62
62
  ))}
@@ -5,7 +5,7 @@ import { ColorSwatch } from './ColorSwatch';
5
5
 
6
6
  describe('ColorSwatch', () => {
7
7
  it('renders correctly', () => {
8
- render(<ColorSwatch color='nude' />);
8
+ render(<ColorSwatch color="nude" />);
9
9
  expect(screen.getByRole('button')).toBeVisible();
10
10
  });
11
11
  });
@@ -83,7 +83,7 @@ export const ColorSwatch: React.FC<ColorSwatchProps> = ({
83
83
  disabled={disabled}
84
84
  {...rest}
85
85
  >
86
- <div className='ColorSwatch__chip' style={styles} />
86
+ <div className="ColorSwatch__chip" style={styles} />
87
87
  </Clickable>
88
88
  );
89
89
  };
@@ -26,7 +26,7 @@ const Constrained = () => {
26
26
  return (
27
27
  <Constrain>
28
28
  <div ref={ref} style={{ backgroundColor: 'black', color: 'white', padding: '1rem' }}>
29
- <Text color='snow'>
29
+ <Text color="snow">
30
30
  window: {windowWidth}px
31
31
  <br />
32
32
  constrained: {constrainWidth}px
@@ -10,10 +10,10 @@ const Constrained = () => {
10
10
  return (
11
11
  <Constrain>
12
12
  <div style={{ backgroundColor: 'black', color: 'white', padding: '1rem' }}>
13
- <Text color='snow'>This div is constrained.</Text>
13
+ <Text color="snow">This div is constrained.</Text>
14
14
  </div>
15
15
  <ExceedConstrain style={{ backgroundColor: 'gray', color: 'white', padding: '1rem' }}>
16
- <Text color='snow'>This exceeds the constrain.</Text>
16
+ <Text color="snow">This exceeds the constrain.</Text>
17
17
  </ExceedConstrain>
18
18
  </Constrain>
19
19
  );
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
2
  import { action } from '@storybook/addon-actions';
3
3
  import { States } from 'storybook-states';
4
- import { ControlLink, ControlLinkProps } from './ControlLink';
5
4
  import { BrowserRouter } from 'react-router-dom';
5
+ import { ControlLink, ControlLinkProps } from './ControlLink';
6
6
 
7
7
  export default { title: 'Components/ControlLink' };
8
8
 
@@ -1 +1 @@
1
- export * from './ControlLink';
1
+ export * from './ControlLink';
@@ -13,6 +13,6 @@ export const Default = () => (
13
13
  { maskChar: '' }
14
14
  ]}
15
15
  >
16
- <CreditCardNumberInput label='Card Number' />
16
+ <CreditCardNumberInput label="Card Number" />
17
17
  </States>
18
18
  );
@@ -5,14 +5,14 @@ import { CreditCardNumberInput } from './CreditCardNumberInput';
5
5
 
6
6
  describe('credit card number input', () => {
7
7
  it('renders without errors', () => {
8
- render(<CreditCardNumberInput label='Card Number' />);
8
+ render(<CreditCardNumberInput label="Card Number" />);
9
9
  const input = screen.getByLabelText('Card Number');
10
10
  expect(input).toBeInTheDocument();
11
11
  });
12
12
 
13
13
  // TODO: userEvent.type does not work here for some reason
14
14
  xit('does not allow non-numeric characters', async () => {
15
- render(<CreditCardNumberInput label='Card Number' />);
15
+ render(<CreditCardNumberInput label="Card Number" />);
16
16
  const input = screen.getByLabelText('Card Number') as HTMLInputElement;
17
17
 
18
18
  await userEvent.type(input, 'foo1234');
@@ -22,7 +22,7 @@ describe('credit card number input', () => {
22
22
 
23
23
  // TODO: userEvent.type does not work here for some reason
24
24
  xit('puts spaces between the numbers', async () => {
25
- render(<CreditCardNumberInput label='Card Number' />);
25
+ render(<CreditCardNumberInput label="Card Number" />);
26
26
  const input = screen.getByLabelText('Card Number') as HTMLInputElement;
27
27
 
28
28
  await userEvent.type(input, '5510000000000000');
@@ -32,7 +32,7 @@ describe('credit card number input', () => {
32
32
 
33
33
  // TODO: userEvent.type does not work here for some reason
34
34
  xit('does not allow more characters than required', async () => {
35
- render(<CreditCardNumberInput label='Card Number' />);
35
+ render(<CreditCardNumberInput label="Card Number" />);
36
36
  const input = screen.getByLabelText('Card Number') as HTMLInputElement;
37
37
 
38
38
  await userEvent.type(input, '5510000000000000251');
@@ -62,6 +62,7 @@ export const CreditCardNumberInput: React.FC<CreditCardNumberInputProps> = ({
62
62
  );
63
63
 
64
64
  // TODO: get rid of the any, the types of react-input-mask are incorrect here, it should expect a function as a child, but it expects a ReactNode
65
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
65
66
  const renderInputField: any = (inputProps: CreditCardNumberInputFieldProps) => (
66
67
  <CreditCardNumberInputField {...rest} {...inputProps} />
67
68
  );
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { States } from 'storybook-states';
3
- import { DefinitionList, DefinitionListProps } from './DefinitionList';
4
3
  import { Text } from '../Text';
4
+ import { DefinitionList, DefinitionListProps } from './DefinitionList';
5
5
 
6
6
  export default { title: 'Components/DefinitionList' };
7
7
 
@@ -14,13 +14,13 @@ export const Default = () => (
14
14
  term: 'Size',
15
15
  children: (
16
16
  <>
17
- US 2 — <Text color='code-red'>Only 2 Left</Text>
17
+ US 2 — <Text color="code-red">Only 2 Left</Text>
18
18
  </>
19
19
  )
20
20
  },
21
21
  {
22
22
  term: 'Supports',
23
- children: <a href='#link'>Links</a>
23
+ children: <a href="#link">Links</a>
24
24
  }
25
25
  ]}
26
26
  >
@@ -5,7 +5,7 @@ import { DefinitionList } from './DefinitionList';
5
5
 
6
6
  describe('DefinitionList', () => {
7
7
  it('renders correctly', () => {
8
- render(<DefinitionList term='Foo'>Bar</DefinitionList>);
8
+ render(<DefinitionList term="Foo">Bar</DefinitionList>);
9
9
  expect(screen.getByText('Foo')).toBeVisible();
10
10
  expect(screen.getByText('Bar')).toBeVisible();
11
11
  });
@@ -1,25 +1,25 @@
1
1
  import React from 'react';
2
2
  import { States } from 'storybook-states';
3
- import { Divider, NoLineDivider, TwoLineDivider } from './';
4
3
  import { DividerProps } from './Divider';
4
+ import { Divider, NoLineDivider, TwoLineDivider } from './';
5
5
 
6
6
  export default { title: 'Components/Divider' };
7
7
 
8
8
  export const Default = () => (
9
9
  <States<Partial<DividerProps>> states={[{}, { type: 'no-line' }, { type: 'two-line' }]}>
10
- <Divider text='Moda Operandi' />
10
+ <Divider text="Moda Operandi" />
11
11
  </States>
12
12
  );
13
13
 
14
14
  export const WithNoLine = () => (
15
15
  <States>
16
- <NoLineDivider text='Divider with No Line' />
16
+ <NoLineDivider text="Divider with No Line" />
17
17
  </States>
18
18
  );
19
19
 
20
20
  export const WithDoubleLine = () => (
21
21
  <States>
22
- <TwoLineDivider text='Divider with Double Line' />
22
+ <TwoLineDivider text="Divider with Double Line" />
23
23
  </States>
24
24
  );
25
25
 
@@ -5,7 +5,7 @@ import { Divider } from './Divider';
5
5
 
6
6
  describe('Divider', () => {
7
7
  it('renders correctly', () => {
8
- render(<Divider style={{ padding: '30px 0' }} text='Hello' />);
8
+ render(<Divider style={{ padding: '30px 0' }} text="Hello" />);
9
9
  expect(screen.getByText('Hello')).toBeVisible();
10
10
  // eslint-disable-next-line testing-library/no-node-access
11
11
  expect(screen.getByText('Hello').parentNode).toHaveStyle('padding: 30px 0px;');
@@ -29,7 +29,7 @@ export const Divider: React.FC<DividerProps> = ({
29
29
  <div className={classNames('Divider', type ? `Divider--${type}` : '', className)} {...rest}>
30
30
  {text && (
31
31
  <Text
32
- className='Divider__text'
32
+ className="Divider__text"
33
33
  treatment={treatment ?? defaultTreatment}
34
34
  color={color}
35
35
  family={family ?? defaultFamily}
@@ -2,5 +2,5 @@ import React from 'react';
2
2
  import { Divider, DividerProps } from './Divider';
3
3
 
4
4
  export const NoLineDivider: React.FC<DividerProps> = props => {
5
- return <Divider {...props} type={'no-line'} />;
5
+ return <Divider {...props} type="no-line" />;
6
6
  };
@@ -2,5 +2,5 @@ import React from 'react';
2
2
  import { Divider, DividerProps } from './Divider';
3
3
 
4
4
  export const TwoLineDivider: React.FC<DividerProps> = props => {
5
- return <Divider {...props} type={'two-line'} />;
5
+ return <Divider {...props} type="two-line" />;
6
6
  };
@@ -7,7 +7,7 @@ export default { title: 'Components/Expandable' };
7
7
 
8
8
  export const Default = () => (
9
9
  <States<Partial<ExpandableProps>> states={[{}, { expanded: true }]}>
10
- <Expandable name='Editor’s Note'>
10
+ <Expandable name="Editor’s Note">
11
11
  Mark Cross’ ‘Cole’ duffle bag is crafted from textured grain leather with ample space for your
12
12
  long-haul travels. It opens to reveal red twill lining and ample compartments for your
13
13
  essentials. It has polished silver-tone palladium hardware and is stamped with the label’s
@@ -20,7 +20,7 @@ export const Default = () => (
20
20
  // Push content into the DOM only after epanding component
21
21
  export const VirtualizeContent = () => (
22
22
  <States<Partial<ExpandableProps>> states={[{}, { expanded: false, virtual: true }]}>
23
- <Expandable name='Editor’s Note'>
23
+ <Expandable name="Editor’s Note">
24
24
  Mark Cross’ ‘Cole’ duffle bag is crafted from textured grain leather with ample space for your
25
25
  long-haul travels. It opens to reveal red twill lining and ample compartments for your
26
26
  essentials. It has polished silver-tone palladium hardware and is stamped with the label’s
@@ -32,7 +32,7 @@ export const VirtualizeContent = () => (
32
32
 
33
33
  export const ChevronIcon = () => (
34
34
  <States<Partial<ExpandableProps>> states={[{}, { expanded: true }]}>
35
- <Expandable icon='chevron' name='Editor’s Note'>
35
+ <Expandable icon="chevron" name="Editor’s Note">
36
36
  Mark Cross’ ‘Cole’ duffle bag is crafted from textured grain leather with ample space for your
37
37
  long-haul travels. It opens to reveal red twill lining and ample compartments for your
38
38
  essentials. It has polished silver-tone palladium hardware and is stamped with the label’s
@@ -45,14 +45,14 @@ export const ChevronIcon = () => (
45
45
  export const Stacked = () => (
46
46
  <States>
47
47
  <Stack space={0}>
48
- <Expandable name='Editor’s Note' expanded>
48
+ <Expandable name="Editor’s Note" expanded>
49
49
  <p>
50
50
  Acne Studios’ ‘1996’ jeans are fitted with a high-rise waist and straight-leg silhouette.
51
51
  Designed in a dark-blue wash, this five-pocket style is detailed with contrast
52
52
  top-stitching to mirror vintage pairs.
53
53
  </p>
54
54
  </Expandable>
55
- <Expandable name='Product Details'>
55
+ <Expandable name="Product Details">
56
56
  <ul>
57
57
  <li>Belt loops, five-pocket style</li>
58
58
  <li>Button and concealed zip fastening at front</li>
@@ -61,7 +61,7 @@ export const Stacked = () => (
61
61
  </ul>
62
62
  <p>Made in Italy Product Code 684196</p>
63
63
  </Expandable>
64
- <Expandable name='Size &amp; Fit'>
64
+ <Expandable name="Size &amp; Fit">
65
65
  <ul>
66
66
  <li>
67
67
  Model measurements: height 6&apos;2&quot;/188cm - neck 15.5&quot;/39cm - waist
@@ -72,11 +72,11 @@ export const Stacked = () => (
72
72
  <li>We suggest taking your normal size</li>
73
73
  </ul>
74
74
  <p>
75
- Questions? Please contact <a href='mailto:care@modaoperandi.com'>care@modaoperandi.com</a>
75
+ Questions? Please contact <a href="mailto:care@modaoperandi.com">care@modaoperandi.com</a>
76
76
  .
77
77
  </p>
78
78
  </Expandable>
79
- <Expandable name='Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit...'>
79
+ <Expandable name="Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit...">
80
80
  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed condimentum laoreet urna nec
81
81
  consequat. Morbi et volutpat nulla, a vehicula nisl. Nullam tincidunt ac neque ornare
82
82
  mattis. Donec eget dapibus enim. Aliquam ut tortor pretium dui pretium tincidunt. Donec quis
@@ -9,7 +9,7 @@ describe('Expandable', () => {
9
9
  const user = userEvent.setup();
10
10
 
11
11
  render(
12
- <Expandable virtual name='Hello'>
12
+ <Expandable virtual name="Hello">
13
13
  Goodbye
14
14
  </Expandable>
15
15
  );
@@ -21,6 +21,7 @@ export const Expandable: React.FC<ExpandableProps> = ({
21
21
  virtual = false,
22
22
  icon = 'plus-minus',
23
23
  'data-testid': dataTestId,
24
+ // eslint-disable-next-line @typescript-eslint/naming-convention
24
25
  expanded: __expanded__ = false,
25
26
  ...rest
26
27
  }) => {
@@ -43,14 +44,14 @@ export const Expandable: React.FC<ExpandableProps> = ({
43
44
  {name}
44
45
 
45
46
  {icon !== 'plus-minus' && (
46
- <div className='Expandable__icon'>
47
+ <div className="Expandable__icon">
47
48
  {icon === 'chevron' && expanded && <ChevronUpIcon />}
48
49
  {icon === 'chevron' && !expanded && <ChevronDownIcon />}
49
50
  </div>
50
51
  )}
51
52
  </Clickable>
52
53
 
53
- <div className='Expandable__contents'>{expanded || !virtual ? children : null}</div>
54
+ <div className="Expandable__contents">{expanded || !virtual ? children : null}</div>
54
55
  </div>
55
56
  );
56
57
  };
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
2
  import { States } from 'storybook-states';
3
- import { Field, FieldProps } from './Field';
3
+ import { action } from '@storybook/addon-actions';
4
4
  import { Textarea } from '../Textarea';
5
5
  import { Select } from '../Select';
6
- import { action } from '@storybook/addon-actions';
6
+ import { Field, FieldProps } from './Field';
7
7
 
8
8
  export default { title: 'Components/Field' };
9
9
 
@@ -19,7 +19,7 @@ export const Default = () => (
19
19
  { label: 'Name of input', error: 'Something went wrong' }
20
20
  ]}
21
21
  >
22
- <Field placeholder='An input' />
22
+ <Field placeholder="An input" />
23
23
  </States>
24
24
  );
25
25
 
@@ -36,7 +36,7 @@ export const AribitraryChildren = () => (
36
36
  ]}
37
37
  >
38
38
  <Field>
39
- <Textarea placeholder='A textarea' />
39
+ <Textarea placeholder="A textarea" />
40
40
  </Field>
41
41
  </States>
42
42
  );
@@ -1,19 +1,19 @@
1
1
  import React from 'react';
2
2
  import { render, screen } from '@testing-library/react';
3
3
 
4
- import { Field } from './Field';
5
4
  import { Select } from '../Select';
5
+ import { Field } from './Field';
6
6
 
7
7
  describe('Field', () => {
8
8
  it('renders correctly', () => {
9
- render(<Field placeholder='Placeholder' defaultValue='Hello' />);
9
+ render(<Field placeholder="Placeholder" defaultValue="Hello" />);
10
10
 
11
11
  expect(screen.getByRole('textbox')).toBeVisible();
12
12
  expect(screen.getByRole('textbox')).toHaveAttribute('placeholder', 'Placeholder');
13
13
  });
14
14
 
15
15
  it('renders with a label', () => {
16
- render(<Field placeholder='Placeholder' defaultValue='Hello' label='Label' />);
16
+ render(<Field placeholder="Placeholder" defaultValue="Hello" label="Label" />);
17
17
 
18
18
  expect(screen.getByRole('textbox')).toBeVisible();
19
19
  expect(screen.getByRole('textbox')).toHaveAttribute('placeholder', 'Placeholder');
@@ -21,7 +21,7 @@ describe('Field', () => {
21
21
  });
22
22
 
23
23
  it('renders with an error', () => {
24
- render(<Field placeholder='Placeholder' defaultValue='Hello' label='Label' error='Error' />);
24
+ render(<Field placeholder="Placeholder" defaultValue="Hello" label="Label" error="Error" />);
25
25
 
26
26
  expect(screen.getByRole('textbox')).toBeVisible();
27
27
  expect(screen.getByRole('textbox')).toHaveClass('TextInput--error');
@@ -37,7 +37,7 @@ describe('Field', () => {
37
37
 
38
38
  render(
39
39
  <Field>
40
- <Select idRef='1' name='name-1' label='Sort by' options={options} />
40
+ <Select idRef="1" name="name-1" label="Sort by" options={options} />
41
41
  </Field>
42
42
  );
43
43
 
@@ -46,7 +46,7 @@ describe('Field', () => {
46
46
 
47
47
  it('renders with a className', () => {
48
48
  render(
49
- <Field className='Custom' placeholder='Placeholder' defaultValue='Hello' label='Label' />
49
+ <Field className="Custom" placeholder="Placeholder" defaultValue="Hello" label="Label" />
50
50
  );
51
51
 
52
52
  expect(screen.getByRole('textbox')).toBeVisible();
@@ -56,7 +56,7 @@ describe('Field', () => {
56
56
 
57
57
  it('supports custom children', () => {
58
58
  render(
59
- <Field placeholder='Placeholder' defaultValue='Hello' label='Label'>
59
+ <Field placeholder="Placeholder" defaultValue="Hello" label="Label">
60
60
  <textarea />
61
61
  </Field>
62
62
  );
@@ -17,10 +17,10 @@ export const Field = React.forwardRef(
17
17
  ) => {
18
18
  return (
19
19
  <label className={classNames('Field', className)}>
20
- {label && <span className='Field__label'>{label}</span>}
20
+ {label && <span className="Field__label">{label}</span>}
21
21
 
22
22
  {/* TODO: Codify some kind of IconWrapper component */}
23
- <span className='Field__context'>
23
+ <span className="Field__context">
24
24
  {children ? (
25
25
  <>
26
26
  {React.cloneElement(children, {
@@ -34,7 +34,7 @@ export const Field = React.forwardRef(
34
34
  })}
35
35
 
36
36
  {error && (
37
- <span className='Field__icon'>
37
+ <span className="Field__icon">
38
38
  <WarningIcon />
39
39
  </span>
40
40
  )}
@@ -49,7 +49,7 @@ export const Field = React.forwardRef(
49
49
  {...rest}
50
50
  />
51
51
  {error && (
52
- <span className='Field__icon'>
52
+ <span className="Field__icon">
53
53
  <WarningIcon />
54
54
  </span>
55
55
  )}
@@ -57,7 +57,7 @@ export const Field = React.forwardRef(
57
57
  )}
58
58
  </span>
59
59
 
60
- {error && <span className='Field__error'>{error}</span>}
60
+ {error && <span className="Field__error">{error}</span>}
61
61
  </label>
62
62
  );
63
63
  }
@@ -1,3 +1,4 @@
1
1
  import { Field } from './Field';
2
+
2
3
  export { Field as Input };
3
4
  export * from './Field';
@@ -5,7 +5,7 @@ import { Loading } from './Loading';
5
5
 
6
6
  describe('Loading', () => {
7
7
  it('renders correctly', () => {
8
- render(<Loading aria-label='Loading' />);
8
+ render(<Loading aria-label="Loading" />);
9
9
  expect(screen.getByLabelText('Loading')).toBeVisible();
10
10
  });
11
11
  });
@@ -11,9 +11,10 @@ const FRAMES = [Triangle, Diamond, ArcWindow, Circle];
11
11
 
12
12
  export const Loading: React.FC<LoadingProps> = ({ className, ...rest }) => {
13
13
  const { index, handleNext } = useCursor({ max: FRAMES.length });
14
+ const ONE_SECOND_INTERVAL = 1000;
14
15
 
15
16
  useEffect(() => {
16
- const interval = setInterval(handleNext, 1000);
17
+ const interval = setInterval(handleNext, ONE_SECOND_INTERVAL);
17
18
  return () => clearInterval(interval);
18
19
  }, [handleNext]);
19
20
 
@@ -14,8 +14,8 @@ describe('Modal', () => {
14
14
  const onClose = jest.fn();
15
15
  const onClickButton = jest.fn();
16
16
  render(
17
- <Modal data-testid='modal' onClose={onClose}>
18
- <button data-testid='button' onClick={onClickButton}>
17
+ <Modal data-testid="modal" onClose={onClose}>
18
+ <button data-testid="button" onClick={onClickButton}>
19
19
  Click Me
20
20
  </button>
21
21
  </Modal>
@@ -8,11 +8,11 @@ const ModalComponent: React.FC = () => {
8
8
  const [showModal, setShowModal] = useState(false);
9
9
 
10
10
  return showModal ? (
11
- <ModalOverlay data-testid='modal' onClose={() => setShowModal(false)}>
11
+ <ModalOverlay data-testid="modal" onClose={() => setShowModal(false)}>
12
12
  Modal Content
13
13
  </ModalOverlay>
14
14
  ) : (
15
- <button data-testid='button' onClick={() => setShowModal(true)}>
15
+ <button data-testid="button" onClick={() => setShowModal(true)}>
16
16
  Click Me
17
17
  </button>
18
18
  );
@@ -1,8 +1,8 @@
1
1
  import React, { useEffect, useMemo } from 'react';
2
- import { Modal, ModalProps } from '../Modal';
3
- import { OverlayProps, Overlay } from '../Overlay';
4
2
  import classNames from 'classnames';
5
3
  import { createPortal } from 'react-dom';
4
+ import { Modal, ModalProps } from '../Modal';
5
+ import { OverlayProps, Overlay } from '../Overlay';
6
6
 
7
7
  import './ModalOverlay.scss';
8
8
 
@@ -1,8 +1,8 @@
1
1
  import React, { useState } from 'react';
2
2
 
3
3
  import { States } from 'storybook-states';
4
- import { Overlay } from './Overlay';
5
4
  import { Button } from '../Button';
5
+ import { Overlay } from './Overlay';
6
6
 
7
7
  export default { title: 'Components/Overlay' };
8
8
 
@@ -66,7 +66,7 @@ export const Paginator: React.FC<Props> = ({
66
66
  const prevPage = (page: number) => onGoToPage(page - 1);
67
67
 
68
68
  return (
69
- <section className={classNames('Paginator', className)} aria-label='Pagination'>
69
+ <section className={classNames('Paginator', className)} aria-label="Pagination">
70
70
  <button
71
71
  disabled={!canDoPrev(selectedPage)}
72
72
  onClick={() => {
@@ -75,7 +75,7 @@ export const Paginator: React.FC<Props> = ({
75
75
  }}
76
76
  className={classNames('Paginator__button', 'Paginator__button--previous')}
77
77
  >
78
- <ChevronLeftIcon className='Paginator__previous-chevron' /> Previous
78
+ <ChevronLeftIcon className="Paginator__previous-chevron" /> Previous
79
79
  </button>
80
80
 
81
81
  {pages.map((page, index) => (
@@ -108,7 +108,7 @@ export const Paginator: React.FC<Props> = ({
108
108
  }}
109
109
  className={classNames('Paginator__button', 'Paginator__button--next')}
110
110
  >
111
- Next <ChevronRightIcon className='Paginator__next-chevron' />
111
+ Next <ChevronRightIcon className="Paginator__next-chevron" />
112
112
  </button>
113
113
  </section>
114
114
  );
@@ -6,6 +6,6 @@ export default { title: 'Components/PasswordInput' };
6
6
 
7
7
  export const Default = () => (
8
8
  <States<Partial<PasswordInputProps>> states={[{}, { error: 'Password cannot be empty.' }]}>
9
- <PasswordInput id='signInPassword' placeholder='Password' />
9
+ <PasswordInput id="signInPassword" placeholder="Password" />
10
10
  </States>
11
11
  );