@moda/om 16.2.0 → 17.0.0

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 (120) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/index.cjs.js +349 -299
  3. package/dist/index.cjs.js.map +1 -1
  4. package/dist/index.esm.js +348 -298
  5. package/dist/index.esm.js.map +1 -1
  6. package/dist/src/components/Expandable/Expandable.d.ts +1 -0
  7. package/dist/src/components/Select/Select.d.ts +1 -0
  8. package/dist/src/components/Select/SelectOption.d.ts +1 -0
  9. package/dist/src/components/Select/SelectOptions.d.ts +1 -0
  10. package/dist/styles.css +1 -1
  11. package/package.json +18 -8
  12. package/src/components/AspectRatioBox/AspectRatioBox.tsx +4 -4
  13. package/src/components/AspectRatioBox/index.ts +1 -1
  14. package/src/components/Badge/Badge.stories.tsx +5 -5
  15. package/src/components/Badge/Badge.test.tsx +1 -1
  16. package/src/components/Breadcrumbs/Breadcrumb/Breadcrumb.tsx +6 -6
  17. package/src/components/Breadcrumbs/Breadcrumbs.stories.tsx +6 -6
  18. package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +2 -2
  19. package/src/components/Breadcrumbs/Breadcrumbs.tsx +1 -1
  20. package/src/components/Breakpoint/Breakpoint.stories.tsx +10 -9
  21. package/src/components/Breakpoint/Breakpoint.test.tsx +2 -2
  22. package/src/components/Breakpoint/generateMediaQuery.ts +5 -4
  23. package/src/components/Button/Button.stories.tsx +4 -4
  24. package/src/components/Checkbox/Checkbox.stories.tsx +5 -5
  25. package/src/components/Checkbox/Checkbox.test.tsx +3 -3
  26. package/src/components/Checkbox/Checkbox.tsx +4 -4
  27. package/src/components/Clickable/Clickable.stories.tsx +3 -3
  28. package/src/components/ColorSwatch/ColorSwatch.stories.tsx +11 -11
  29. package/src/components/ColorSwatch/ColorSwatch.test.tsx +1 -1
  30. package/src/components/ColorSwatch/ColorSwatch.tsx +1 -1
  31. package/src/components/Constrain/Constrain.stories.tsx +1 -1
  32. package/src/components/Constrain/ExceedConstrain.stories.tsx +2 -2
  33. package/src/components/ControlLink/ControlLink.stories.tsx +1 -1
  34. package/src/components/ControlLink/index.ts +1 -1
  35. package/src/components/CreditCardNumberInput/CreditCardNumberInput.stories.tsx +1 -1
  36. package/src/components/CreditCardNumberInput/CreditCardNumberInput.test.tsx +4 -4
  37. package/src/components/CreditCardNumberInput/CreditCardNumberInput.tsx +1 -0
  38. package/src/components/DefinitionList/DefinitionList.stories.tsx +3 -3
  39. package/src/components/DefinitionList/DefinitionList.test.tsx +1 -1
  40. package/src/components/Divider/Divider.stories.tsx +4 -4
  41. package/src/components/Divider/Divider.test.tsx +1 -1
  42. package/src/components/Divider/Divider.tsx +1 -1
  43. package/src/components/Divider/NoLineDivider.tsx +1 -1
  44. package/src/components/Divider/TwoLineDivider.tsx +1 -1
  45. package/src/components/Expandable/Expandable.stories.tsx +8 -8
  46. package/src/components/Expandable/Expandable.test.tsx +1 -1
  47. package/src/components/Expandable/Expandable.tsx +12 -5
  48. package/src/components/Field/Field.stories.tsx +4 -4
  49. package/src/components/Field/Field.test.tsx +7 -7
  50. package/src/components/Field/Field.tsx +5 -5
  51. package/src/components/Field/index.ts +1 -0
  52. package/src/components/Loading/Loading.test.tsx +1 -1
  53. package/src/components/Loading/Loading.tsx +2 -1
  54. package/src/components/Modal/Modal.test.tsx +2 -2
  55. package/src/components/ModalOverlay/ModalOverlay.test.tsx +2 -2
  56. package/src/components/ModalOverlay/ModalOverlay.tsx +2 -2
  57. package/src/components/Overlay/Overlay.stories.tsx +1 -1
  58. package/src/components/Paginator/Paginator.tsx +3 -3
  59. package/src/components/PasswordInput/PasswordInput.stories.tsx +1 -1
  60. package/src/components/PasswordInput/PasswordInput.tsx +6 -6
  61. package/src/components/Popover/Popover.stories.tsx +1 -1
  62. package/src/components/Popover/Popover.tsx +10 -7
  63. package/src/components/PromoBanner/PromoBanner.stories.tsx +9 -9
  64. package/src/components/PromoBanner/PromoBanner.tsx +1 -1
  65. package/src/components/RadioButton/RadioButton.stories.tsx +2 -2
  66. package/src/components/RadioButton/RadioButton.tsx +4 -4
  67. package/src/components/SearchInput/SearchInput.stories.tsx +2 -2
  68. package/src/components/SearchInput/SearchInput.test.tsx +1 -1
  69. package/src/components/SearchInput/SearchInput.tsx +3 -3
  70. package/src/components/Select/MultiSelect.tsx +7 -7
  71. package/src/components/Select/Select.stories.tsx +15 -14
  72. package/src/components/Select/Select.test.tsx +13 -13
  73. package/src/components/Select/Select.tsx +11 -7
  74. package/src/components/Select/SelectOption.tsx +5 -2
  75. package/src/components/Select/SelectOptions.tsx +8 -5
  76. package/src/components/SelectableButton/SelectableButton.stories.tsx +1 -1
  77. package/src/components/Shape/ArcWindow.tsx +10 -10
  78. package/src/components/Shape/Bradley.tsx +4 -4
  79. package/src/components/Shape/Brancusi.tsx +4 -4
  80. package/src/components/Shape/Circle.tsx +10 -10
  81. package/src/components/Shape/Diamond.tsx +10 -10
  82. package/src/components/Shape/Keyhole.tsx +4 -4
  83. package/src/components/Shape/Mirror.tsx +4 -4
  84. package/src/components/Shape/Oval.tsx +4 -4
  85. package/src/components/Shape/Triangle.tsx +7 -7
  86. package/src/components/Shape/Window.tsx +4 -4
  87. package/src/components/Stack/Stack.stories.tsx +3 -3
  88. package/src/components/Stack/Stack.test.tsx +1 -1
  89. package/src/components/Tabs/TabList.tsx +1 -1
  90. package/src/components/Tabs/TabPanel.tsx +1 -1
  91. package/src/components/Tabs/TabPanels.tsx +1 -1
  92. package/src/components/Tabs/Tabs.stories.tsx +2 -2
  93. package/src/components/Tabs/Tabs.test.tsx +2 -2
  94. package/src/components/Tabs/Tabs.tsx +7 -1
  95. package/src/components/Tag/Tag.tsx +6 -5
  96. package/src/components/Text/Text.stories.tsx +5 -5
  97. package/src/components/Text/Text.test.tsx +1 -1
  98. package/src/components/TextInput/TextInput.stories.tsx +1 -1
  99. package/src/components/TextInput/TextInput.test.tsx +1 -1
  100. package/src/components/Textarea/Textarea.stories.tsx +1 -1
  101. package/src/components/Textarea/Textarea.test.tsx +3 -3
  102. package/src/components/Toast/Toast.stories.tsx +1 -1
  103. package/src/components/Toast/Toast.test.tsx +1 -1
  104. package/src/components/Toast/Toast.tsx +6 -6
  105. package/src/components/VerticalDivider/VerticalDivider.stories.tsx +3 -3
  106. package/src/components/VerticalDivider/VerticalDivider.test.tsx +2 -2
  107. package/src/hooks/useKeyboardListNavigation.spec.ts +2 -1
  108. package/src/hooks/useKeyboardListNavigation.ts +2 -0
  109. package/src/hooks/useUpdateEffect.ts +1 -0
  110. package/src/index.ts +2 -2
  111. package/src/mixins/font-smoothing/font-smoothing.stories.tsx +8 -8
  112. package/src/mixins/overflow-scroll/overflow-scroll.stories.tsx +2 -2
  113. package/src/mixins/stack/stack.stories.tsx +5 -6
  114. package/src/mixins/thin-underline/thin-underline.stories.tsx +1 -1
  115. package/src/mixins/visually-hidden/visually-hidden.stories.tsx +1 -1
  116. package/src/utilities/States/State.tsx +3 -2
  117. package/src/utilities/States/States.tsx +4 -3
  118. package/src/utilities/States/StatesProps.tsx +5 -2
  119. package/src/utilities/States/isRenderProps.ts +1 -0
  120. package/src/utilities/States/stringifyProps.tsx +1 -0
@@ -2,8 +2,8 @@ import React from 'react';
2
2
  import { action } from '@storybook/addon-actions';
3
3
 
4
4
  import { States } from 'storybook-states';
5
- import { SelectableButton, SelectableButtonProps } from './SelectableButton';
6
5
  import { Stack } from '../Stack';
6
+ import { SelectableButton, SelectableButtonProps } from './SelectableButton';
7
7
 
8
8
  export default { title: 'Components/SelectableButton' };
9
9
 
@@ -3,18 +3,18 @@ import { ShapeProps } from './Shape';
3
3
 
4
4
  export const ArcWindow: React.FC<ShapeProps> = () => (
5
5
  <svg
6
- className='ArcWindow'
7
- width='24'
8
- height='24'
9
- viewBox='0 0 24 24'
10
- fill='none'
11
- xmlns='http://www.w3.org/2000/svg'
6
+ className="ArcWindow"
7
+ width="24"
8
+ height="24"
9
+ viewBox="0 0 24 24"
10
+ fill="none"
11
+ xmlns="http://www.w3.org/2000/svg"
12
12
  >
13
13
  <path
14
- fillRule='evenodd'
15
- clipRule='evenodd'
16
- d='M20.1097 24V11.6273V8.8331V8.81993C20.1018 3.96884 16.4806 0 12.0536 0C7.6291 0 4.00527 3.96884 4 8.81993V8.8331V11.6273V24H20.1097Z'
17
- fill='#003728'
14
+ fillRule="evenodd"
15
+ clipRule="evenodd"
16
+ d="M20.1097 24V11.6273V8.8331V8.81993C20.1018 3.96884 16.4806 0 12.0536 0C7.6291 0 4.00527 3.96884 4 8.81993V8.8331V11.6273V24H20.1097Z"
17
+ fill="#003728"
18
18
  />
19
19
  </svg>
20
20
  );
@@ -1,13 +1,13 @@
1
1
  import React from 'react';
2
2
  import { ShapeProps } from './Shape';
3
3
 
4
- export const Bradley: React.FC<ShapeProps> = (props) => (
4
+ export const Bradley: React.FC<ShapeProps> = props => (
5
5
  <svg
6
6
  style={{ fill: 'currentcolor' }}
7
- xmlns='http://www.w3.org/2000/svg'
8
- viewBox='0 0 110 211'
7
+ xmlns="http://www.w3.org/2000/svg"
8
+ viewBox="0 0 110 211"
9
9
  {...props}
10
10
  >
11
- <path d='M110 .336H0v210h45.11v-52.595h19.78v52.595H110V105.147z' />
11
+ <path d="M110 .336H0v210h45.11v-52.595h19.78v52.595H110V105.147z" />
12
12
  </svg>
13
13
  );
@@ -1,13 +1,13 @@
1
1
  import React from 'react';
2
2
  import { ShapeProps } from './Shape';
3
3
 
4
- export const Brancusi: React.FC<ShapeProps> = (props) => (
4
+ export const Brancusi: React.FC<ShapeProps> = props => (
5
5
  <svg
6
6
  style={{ fill: 'currentcolor' }}
7
- xmlns='http://www.w3.org/2000/svg'
8
- viewBox='0 0 111 210'
7
+ xmlns="http://www.w3.org/2000/svg"
8
+ viewBox="0 0 111 210"
9
9
  {...props}
10
10
  >
11
- <path d='M110.575 210l-27.5-105 27.5-105h-110l27.501 105L.575 210z' />
11
+ <path d="M110.575 210l-27.5-105 27.5-105h-110l27.501 105L.575 210z" />
12
12
  </svg>
13
13
  );
@@ -3,18 +3,18 @@ import { ShapeProps } from './Shape';
3
3
 
4
4
  export const Circle: React.FC<ShapeProps> = () => (
5
5
  <svg
6
- className='Circle'
7
- width='24'
8
- height='24'
9
- viewBox='0 0 24 24'
10
- fill='none'
11
- xmlns='http://www.w3.org/2000/svg'
6
+ className="Circle"
7
+ width="24"
8
+ height="24"
9
+ viewBox="0 0 24 24"
10
+ fill="none"
11
+ xmlns="http://www.w3.org/2000/svg"
12
12
  >
13
13
  <path
14
- fillRule='evenodd'
15
- clipRule='evenodd'
16
- d='M24 12C24 18.6282 18.6282 24 12 24C5.37184 24 0 18.6282 0 12C0 5.37184 5.37184 0 12 0C18.6282 0 24 5.37184 24 12Z'
17
- fill='#D7B3D0'
14
+ fillRule="evenodd"
15
+ clipRule="evenodd"
16
+ d="M24 12C24 18.6282 18.6282 24 12 24C5.37184 24 0 18.6282 0 12C0 5.37184 5.37184 0 12 0C18.6282 0 24 5.37184 24 12Z"
17
+ fill="#D7B3D0"
18
18
  />
19
19
  </svg>
20
20
  );
@@ -3,18 +3,18 @@ import { ShapeProps } from './Shape';
3
3
 
4
4
  export const Diamond: React.FC<ShapeProps> = () => (
5
5
  <svg
6
- className='Diamond'
7
- width='24'
8
- height='24'
9
- viewBox='0 0 24 24'
10
- fill='none'
11
- xmlns='http://www.w3.org/2000/svg'
6
+ className="Diamond"
7
+ width="24"
8
+ height="24"
9
+ viewBox="0 0 24 24"
10
+ fill="none"
11
+ xmlns="http://www.w3.org/2000/svg"
12
12
  >
13
13
  <path
14
- fillRule='evenodd'
15
- clipRule='evenodd'
16
- d='M12 24.0026L0 12.0026L12 0L24 12.0026L12 24.0026Z'
17
- fill='#C44CB0'
14
+ fillRule="evenodd"
15
+ clipRule="evenodd"
16
+ d="M12 24.0026L0 12.0026L12 0L24 12.0026L12 24.0026Z"
17
+ fill="#C44CB0"
18
18
  />
19
19
  </svg>
20
20
  );
@@ -1,13 +1,13 @@
1
1
  import React from 'react';
2
2
  import { ShapeProps } from './Shape';
3
3
 
4
- export const Keyhole: React.FC<ShapeProps> = (props) => (
4
+ export const Keyhole: React.FC<ShapeProps> = props => (
5
5
  <svg
6
6
  style={{ fill: 'currentcolor' }}
7
- xmlns='http://www.w3.org/2000/svg'
8
- viewBox='0 0 111 210'
7
+ xmlns="http://www.w3.org/2000/svg"
8
+ viewBox="0 0 111 210"
9
9
  {...props}
10
10
  >
11
- <path d='M.8 210h110V86.403h-9.317c5.88-8.833 9.317-19.46 9.317-30.902C110.8 24.85 86.175 0 55.8 0S.8 24.85.8 55.501c0 11.441 3.436 22.069 9.315 30.902H.8V210z' />
11
+ <path d="M.8 210h110V86.403h-9.317c5.88-8.833 9.317-19.46 9.317-30.902C110.8 24.85 86.175 0 55.8 0S.8 24.85.8 55.501c0 11.441 3.436 22.069 9.315 30.902H.8V210z" />
12
12
  </svg>
13
13
  );
@@ -1,13 +1,13 @@
1
1
  import React from 'react';
2
2
  import { ShapeProps } from './Shape';
3
3
 
4
- export const Mirror: React.FC<ShapeProps> = (props) => (
4
+ export const Mirror: React.FC<ShapeProps> = props => (
5
5
  <svg
6
6
  style={{ fill: 'currentcolor' }}
7
- xmlns='http://www.w3.org/2000/svg'
8
- viewBox='0 0 111 210'
7
+ xmlns="http://www.w3.org/2000/svg"
8
+ viewBox="0 0 111 210"
9
9
  {...props}
10
10
  >
11
- <path d='M110.03 105c0-22.7-3.786-43.7-10.2-60.874V15.97H84.176C75.724 5.862 65.739 0 55.03 0 44.323 0 34.336 5.862 25.885 15.969H10.23v28.157C3.817 61.3.03 82.3.03 105c0 22.7 3.787 43.7 10.2 60.874v28.157h15.655C34.336 204.138 44.323 210 55.03 210c10.708 0 20.693-5.862 29.146-15.969h15.652v-28.157C106.244 148.7 110.03 127.7 110.03 105z' />
11
+ <path d="M110.03 105c0-22.7-3.786-43.7-10.2-60.874V15.97H84.176C75.724 5.862 65.739 0 55.03 0 44.323 0 34.336 5.862 25.885 15.969H10.23v28.157C3.817 61.3.03 82.3.03 105c0 22.7 3.787 43.7 10.2 60.874v28.157h15.655C34.336 204.138 44.323 210 55.03 210c10.708 0 20.693-5.862 29.146-15.969h15.652v-28.157C106.244 148.7 110.03 127.7 110.03 105z" />
12
12
  </svg>
13
13
  );
@@ -1,13 +1,13 @@
1
1
  import React from 'react';
2
2
  import { ShapeProps } from './Shape';
3
3
 
4
- export const Oval: React.FC<ShapeProps> = (props) => (
4
+ export const Oval: React.FC<ShapeProps> = props => (
5
5
  <svg
6
6
  style={{ fill: 'currentcolor' }}
7
- xmlns='http://www.w3.org/2000/svg'
8
- viewBox='0 0 110 210'
7
+ xmlns="http://www.w3.org/2000/svg"
8
+ viewBox="0 0 110 210"
9
9
  {...props}
10
10
  >
11
- <path d='M110 105C110 47.01 85.376 0 55 0S0 47.01 0 105s24.624 105 55 105 55-47.01 55-105z' />
11
+ <path d="M110 105C110 47.01 85.376 0 55 0S0 47.01 0 105s24.624 105 55 105 55-47.01 55-105z" />
12
12
  </svg>
13
13
  );
@@ -3,13 +3,13 @@ import { ShapeProps } from './Shape';
3
3
 
4
4
  export const Triangle: React.FC<ShapeProps> = () => (
5
5
  <svg
6
- className='Triangle'
7
- width='24'
8
- height='24'
9
- viewBox='0 0 24 24'
10
- fill='none'
11
- xmlns='http://www.w3.org/2000/svg'
6
+ className="Triangle"
7
+ width="24"
8
+ height="24"
9
+ viewBox="0 0 24 24"
10
+ fill="none"
11
+ xmlns="http://www.w3.org/2000/svg"
12
12
  >
13
- <path fillRule='evenodd' clipRule='evenodd' d='M11.9986 0L0 24H24L11.9986 0Z' fill='#D56B27' />
13
+ <path fillRule="evenodd" clipRule="evenodd" d="M11.9986 0L0 24H24L11.9986 0Z" fill="#D56B27" />
14
14
  </svg>
15
15
  );
@@ -1,13 +1,13 @@
1
1
  import React from 'react';
2
2
  import { ShapeProps } from './Shape';
3
3
 
4
- export const Window: React.FC<ShapeProps> = (props) => (
4
+ export const Window: React.FC<ShapeProps> = props => (
5
5
  <svg
6
6
  style={{ fill: 'currentcolor' }}
7
- xmlns='http://www.w3.org/2000/svg'
8
- viewBox='0 0 110 210'
7
+ xmlns="http://www.w3.org/2000/svg"
8
+ viewBox="0 0 110 210"
9
9
  {...props}
10
10
  >
11
- <path d='M110 187.673V21.948H98.87C88.873 8.64 73.08 0 55.247 0 37.412 0 21.619 8.64 11.622 21.948H0v165.725h11.34C21.32 201.198 37.245 210 55.248 210c18 0 33.924-8.802 43.904-22.327H110z' />
11
+ <path d="M110 187.673V21.948H98.87C88.873 8.64 73.08 0 55.247 0 37.412 0 21.619 8.64 11.622 21.948H0v165.725h11.34C21.32 201.198 37.245 210 55.248 210c18 0 33.924-8.802 43.904-22.327H110z" />
12
12
  </svg>
13
13
  );
@@ -6,7 +6,7 @@ import { Stack, StackProps } from './Stack';
6
6
  export default { title: 'Components/Stack' };
7
7
 
8
8
  export const Vertical = () => (
9
- <States<StackProps> states={space.scale.map((_, i) => ({ space: i }))}>
9
+ <States<StackProps> states={space.scale.map((_, index) => ({ space: index }))}>
10
10
  <Stack space={0}>
11
11
  <div style={{ backgroundColor: 'yellow' }}>One</div>
12
12
  <div style={{ backgroundColor: 'yellow' }}>Two</div>
@@ -17,8 +17,8 @@ export const Vertical = () => (
17
17
 
18
18
  export const Horizontal = () => (
19
19
  <States<StackProps>
20
- states={space.scale.map((_, i) => ({
21
- space: i,
20
+ states={space.scale.map((_, index) => ({
21
+ space: index,
22
22
  direction: 'horizontal'
23
23
  }))}
24
24
  >
@@ -6,7 +6,7 @@ import { Stack } from './Stack';
6
6
  describe('Stack', () => {
7
7
  it('renders correctly', () => {
8
8
  render(
9
- <Stack space={6} direction='horizontal'>
9
+ <Stack space={6} direction="horizontal">
10
10
  <div>Hello</div>
11
11
  <div>World</div>
12
12
  </Stack>
@@ -10,7 +10,7 @@ export type TabListProps = {
10
10
 
11
11
  export const TabList: React.FC<TabListProps> = ({ tabs, onTabSelected, activePanel }) => {
12
12
  return (
13
- <div className='TabList'>
13
+ <div className="TabList">
14
14
  {tabs.map(tab => (
15
15
  <Tab key={tab.name} tab={tab} onTabChosen={onTabSelected} activeTab={activePanel} />
16
16
  ))}
@@ -6,5 +6,5 @@ export type TabPanelProps = {
6
6
  };
7
7
 
8
8
  export const TabPanel: React.FC<TabPanelProps> = ({ children }) => {
9
- return <div className='TabPanel'>{children}</div>;
9
+ return <div className="TabPanel">{children}</div>;
10
10
  };
@@ -9,7 +9,7 @@ export type TabPanelsProps = {
9
9
 
10
10
  export const TabPanels: React.FC<TabPanelsProps> = ({ panels, activePanel }) => {
11
11
  return (
12
- <div className='TabPanels'>
12
+ <div className="TabPanels">
13
13
  {panels
14
14
  .filter(tab => tab.name === activePanel)
15
15
  .map(tab => (
@@ -47,9 +47,9 @@ export const WithCallback = () => {
47
47
  return (
48
48
  <States<TabsProps>>
49
49
  <>
50
- <Text treatment='h5'>Selected Tab:</Text>
50
+ <Text treatment="h5">Selected Tab:</Text>
51
51
  <Text> {tabName} </Text>
52
- <Tabs tabs={TAB_LIST} onTabClicked={handleTabClick} activeTab="tab2"/>
52
+ <Tabs tabs={TAB_LIST} onTabClicked={handleTabClick} activeTab="tab2" />
53
53
  </>
54
54
  </States>
55
55
  );
@@ -8,12 +8,12 @@ describe('Tabs', () => {
8
8
  {
9
9
  name: 'tab1',
10
10
  title: 'Tab 1',
11
- panel: <div className='test'>I am a panel</div>
11
+ panel: <div className="test">I am a panel</div>
12
12
  },
13
13
  {
14
14
  name: 'tab2',
15
15
  title: 'Tab 2',
16
- panel: <div className='test'>I am also a panel</div>
16
+ panel: <div className="test">I am also a panel</div>
17
17
  }
18
18
  ];
19
19
 
@@ -9,7 +9,13 @@ export type TabsProps = React.HTMLAttributes<HTMLDivElement> & {
9
9
  activeTab?: string;
10
10
  };
11
11
 
12
- export const Tabs: React.FC<TabsProps> = ({ tabs, onTabClicked, activeTab, className, ...rest }) => {
12
+ export const Tabs: React.FC<TabsProps> = ({
13
+ tabs,
14
+ onTabClicked,
15
+ activeTab,
16
+ className,
17
+ ...rest
18
+ }) => {
13
19
  const [activePanel, setActivePanel] = useState(activeTab || tabs[0].name);
14
20
  const handleTabClick = (tabName: string) => {
15
21
  setActivePanel(tabName);
@@ -1,18 +1,19 @@
1
1
  import React from 'react';
2
2
  import classNames from 'classnames';
3
- import { Clickable } from '../Clickable';
4
3
  import ExitIcon from '@moda/icons/exit-16';
4
+ import { Clickable } from '../Clickable';
5
5
  import './Tag.scss';
6
6
 
7
- export type TagProps = { disabled?: boolean; onRemove?: () => void } & React.HTMLAttributes<
8
- HTMLDivElement
9
- >;
7
+ export type TagProps = {
8
+ disabled?: boolean;
9
+ onRemove?: () => void;
10
+ } & React.HTMLAttributes<HTMLDivElement>;
10
11
 
11
12
  export const Tag: React.FC<TagProps> = ({ className, disabled, onRemove, children, ...rest }) => (
12
13
  <div className={classNames('Tag', className, { 'Tag--disabled': disabled })} {...rest}>
13
14
  <div>{children}</div>
14
15
  {onRemove && (
15
- <Clickable disabled={disabled} aria-label='Remove' onClick={onRemove}>
16
+ <Clickable disabled={disabled} aria-label="Remove" onClick={onRemove}>
16
17
  <ExitIcon />
17
18
  </Clickable>
18
19
  )}
@@ -23,24 +23,24 @@ export const Treatments = () => (
23
23
 
24
24
  export const Colors = () => (
25
25
  <States<Partial<TextProps>> states={COLORS}>
26
- <Text treatment='h5'>Moda Operandi</Text>
26
+ <Text treatment="h5">Moda Operandi</Text>
27
27
  </States>
28
28
  );
29
29
 
30
30
  export const Families = () => (
31
31
  <States<Partial<TextProps>> states={FAMILIES}>
32
- <Text treatment='h5'>Moda Operandi</Text>
32
+ <Text treatment="h5">Moda Operandi</Text>
33
33
  </States>
34
34
  );
35
35
 
36
36
  export const Complex = () => (
37
37
  <Text>
38
- <Text treatment='h6' color='fuchsia' family='serif'>
38
+ <Text treatment="h6" color="fuchsia" family="serif">
39
39
  Moda Operandi
40
40
  </Text>
41
41
  {' — '}
42
- <Text color='money-good' treatment='eyebrow'>
43
- Happy <Text color='code-red'>Holidays</Text>
42
+ <Text color="money-good" treatment="eyebrow">
43
+ Happy <Text color="code-red">Holidays</Text>
44
44
  </Text>
45
45
  </Text>
46
46
  );
@@ -6,7 +6,7 @@ import { Text } from './Text';
6
6
  describe('Text', () => {
7
7
  it('renders correctly', () => {
8
8
  render(
9
- <Text treatment='body2' color='money-good' family='serif'>
9
+ <Text treatment="body2" color="money-good" family="serif">
10
10
  Hello
11
11
  </Text>
12
12
  );
@@ -14,6 +14,6 @@ export const Default = () => (
14
14
  { error: 'Error', defaultValue: 'With value' }
15
15
  ]}
16
16
  >
17
- <TextInput placeholder='An input' />
17
+ <TextInput placeholder="An input" />
18
18
  </States>
19
19
  );
@@ -5,7 +5,7 @@ import { TextInput } from './TextInput';
5
5
 
6
6
  describe('TextInput', () => {
7
7
  it('renders correctly', () => {
8
- render(<TextInput placeholder='Hello' />);
8
+ render(<TextInput placeholder="Hello" />);
9
9
  expect(screen.getByRole('textbox')).toHaveValue('');
10
10
  expect(screen.getByRole('textbox')).toHaveAttribute('placeholder', 'Hello');
11
11
  });
@@ -18,6 +18,6 @@ export const Default = () => (
18
18
  { defaultValue: MULTI_LINE_TEXT_EXAMPLE }
19
19
  ]}
20
20
  >
21
- <Textarea placeholder='A textarea' />
21
+ <Textarea placeholder="A textarea" />
22
22
  </States>
23
23
  );
@@ -5,14 +5,14 @@ import { Textarea } from './Textarea';
5
5
 
6
6
  describe('Textarea', () => {
7
7
  it('renders correctly', () => {
8
- render(<Textarea placeholder='Placeholder' defaultValue='Hello' />);
8
+ render(<Textarea placeholder="Placeholder" defaultValue="Hello" />);
9
9
 
10
10
  expect(screen.getByRole('textbox')).toHaveValue('Hello');
11
11
  expect(screen.getByRole('textbox')).toHaveAttribute('placeholder', 'Placeholder');
12
12
  });
13
13
 
14
14
  it('renders with an error', () => {
15
- render(<Textarea placeholder='Placeholder' defaultValue='Hello' label='Label' error='Error' />);
15
+ render(<Textarea placeholder="Placeholder" defaultValue="Hello" label="Label" error="Error" />);
16
16
 
17
17
  expect(screen.getByRole('textbox')).toHaveValue('Hello');
18
18
  expect(screen.getByRole('textbox')).toHaveClass('Textarea--error');
@@ -20,7 +20,7 @@ describe('Textarea', () => {
20
20
 
21
21
  it('renders with a className', () => {
22
22
  render(
23
- <Textarea className='Custom' placeholder='Placeholder' defaultValue='Hello' label='Label' />
23
+ <Textarea className="Custom" placeholder="Placeholder" defaultValue="Hello" label="Label" />
24
24
  );
25
25
 
26
26
  expect(screen.getByRole('textbox')).toHaveValue('Hello');
@@ -7,7 +7,7 @@ export default { title: 'Components/Toast' };
7
7
 
8
8
  export const Default = () => (
9
9
  <States<ToastProps> states={[{ theme: 'success' }, { theme: 'warning' }, { theme: 'error' }]}>
10
- <Toast theme='success' onRemove={() => action('removed')}>
10
+ <Toast theme="success" onRemove={() => action('removed')}>
11
11
  This is a toast notification.
12
12
  </Toast>
13
13
  </States>
@@ -7,7 +7,7 @@ describe('Toast', () => {
7
7
  it('works correctly', async () => {
8
8
  const onRemove = jest.fn();
9
9
  render(
10
- <Toast theme='success' onRemove={onRemove}>
10
+ <Toast theme="success" onRemove={onRemove}>
11
11
  Hello
12
12
  </Toast>
13
13
  );
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
2
  import classNames from 'classnames';
3
+ import ExitIcon from '@moda/icons/exit-16';
3
4
  import { Clickable } from '../Clickable';
4
5
  import { Text } from '../Text';
5
6
  import { Stack, StackProps } from '../Stack';
6
- import ExitIcon from '@moda/icons/exit-16';
7
7
  import './Toast.scss';
8
8
 
9
9
  export type ToastProps = {
@@ -14,17 +14,17 @@ export type ToastProps = {
14
14
  export const Toast: React.FC<ToastProps> = ({ theme, className, onRemove, children, ...rest }) => (
15
15
  <Stack
16
16
  className={classNames('Toast', `Toast--${theme}`, className)}
17
- direction='horizontal'
17
+ direction="horizontal"
18
18
  space={2}
19
- alignItems='center'
20
- justifyContent='space-between'
19
+ alignItems="center"
20
+ justifyContent="space-between"
21
21
  {...rest}
22
22
  >
23
- <Text treatment='bold1' color='snow'>
23
+ <Text treatment="bold1" color="snow">
24
24
  {children}
25
25
  </Text>
26
26
  {onRemove && (
27
- <Clickable aria-label='Remove' onClick={onRemove}>
27
+ <Clickable aria-label="Remove" onClick={onRemove}>
28
28
  <ExitIcon />
29
29
  </Clickable>
30
30
  )}
@@ -1,14 +1,14 @@
1
1
  import React from 'react';
2
2
 
3
3
  import { States } from 'storybook-states';
4
- import { VerticalDivider } from './VerticalDivider';
5
4
  import { Stack } from '../Stack';
5
+ import { VerticalDivider } from './VerticalDivider';
6
6
 
7
7
  export default { title: 'Components/VerticalDivider' };
8
8
 
9
9
  export const Default = () => (
10
10
  <States>
11
- <Stack direction='horizontal' space={4}>
11
+ <Stack direction="horizontal" space={4}>
12
12
  <div> Lorem ipsum dolor sit amet</div>
13
13
 
14
14
  <VerticalDivider />
@@ -20,7 +20,7 @@ export const Default = () => (
20
20
 
21
21
  export const Double = () => (
22
22
  <States>
23
- <Stack direction='horizontal' space={4}>
23
+ <Stack direction="horizontal" space={4}>
24
24
  <div> Lorem ipsum dolor sit amet</div>
25
25
 
26
26
  <VerticalDivider double />
@@ -5,13 +5,13 @@ import { VerticalDivider } from './VerticalDivider';
5
5
 
6
6
  describe('VerticalDivider', () => {
7
7
  it('renders correctly', () => {
8
- render(<VerticalDivider aria-label='Divider' />);
8
+ render(<VerticalDivider aria-label="Divider" />);
9
9
 
10
10
  expect(screen.getByLabelText('Divider')).toBeVisible();
11
11
  });
12
12
 
13
13
  it('renders correctly - double', () => {
14
- render(<VerticalDivider aria-label='Divider' double />);
14
+ render(<VerticalDivider aria-label="Divider" double />);
15
15
 
16
16
  expect(screen.getByLabelText('Divider')).toBeVisible();
17
17
  expect(screen.getByLabelText('Divider')).toHaveClass('VerticalDivider--double');
@@ -1,6 +1,7 @@
1
+ /* eslint-disable @typescript-eslint/no-magic-numbers */
1
2
  import { renderHook, fireEvent } from '@testing-library/react';
2
- import { useKeyboardListNavigation } from './useKeyboardListNavigation';
3
3
  import { useRef } from 'react';
4
+ import { useKeyboardListNavigation } from './useKeyboardListNavigation';
4
5
 
5
6
  describe('useKeyboardListNavigation', () => {
6
7
  const list = ['first', 'second', 'third', 'fourth'];
@@ -56,6 +56,7 @@ export type UseKeyboardListNavigationProps<T> = {
56
56
  index: number;
57
57
  }): void;
58
58
  extractValue?(item: T): string;
59
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
59
60
  ref?: React.MutableRefObject<any>;
60
61
  };
61
62
 
@@ -138,6 +139,7 @@ export const useKeyboardListNavigation = <T>({
138
139
  };
139
140
  }, [handleKeyDown, ref, idleTimeout]);
140
141
 
142
+ // eslint-disable-next-line react-hooks/exhaustive-deps
141
143
  useEffect(() => dispatch({ type: 'RESET', payload: { defaultCursor } }), [list.length]);
142
144
 
143
145
  const interactiveIndex = waitForInteractive && !state.interactive ? -1 : index;
@@ -1,3 +1,4 @@
1
+ /* eslint-disable react-hooks/exhaustive-deps */
1
2
  import { useEffect, useRef } from 'react';
2
3
 
3
4
  export const useUpdateEffect: typeof useEffect = (effect, deps) => {
package/src/index.ts CHANGED
@@ -2,6 +2,8 @@ import 'focus-visible';
2
2
 
3
3
  import { colors, typography, space, breakpoints } from '@moda/tokens';
4
4
 
5
+ import { States } from './utilities';
6
+
5
7
  export const tokens = {
6
8
  colors,
7
9
  typography,
@@ -14,6 +16,4 @@ export { FocusOn } from 'react-focus-on';
14
16
  export * from './components';
15
17
  export * from './hooks';
16
18
 
17
- import { States } from './utilities';
18
-
19
19
  export const Utilities = { States };