@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
@@ -9,22 +9,22 @@ export default { title: 'Mixins/font-smoothing' };
9
9
 
10
10
  export const Default = () => (
11
11
  <Stack space={3}>
12
- <div className='Story Mixins font-smoothing--antialiased'>
13
- <Text treatment='eyebrow'>@include font-smoothing(antialiased);</Text>
12
+ <div className="Story Mixins font-smoothing--antialiased">
13
+ <Text treatment="eyebrow">@include font-smoothing(antialiased);</Text>
14
14
  </div>
15
15
 
16
- <div className='Story Mixins font-smoothing--subpixel'>
17
- <Text treatment='eyebrow'>@include font-smoothing(subpixel);</Text>
16
+ <div className="Story Mixins font-smoothing--subpixel">
17
+ <Text treatment="eyebrow">@include font-smoothing(subpixel);</Text>
18
18
  </div>
19
19
 
20
- <div className='Story Mixins font-smoothing--antialiased' style={{ backgroundColor: 'black' }}>
21
- <Text color='snow' treatment='eyebrow'>
20
+ <div className="Story Mixins font-smoothing--antialiased" style={{ backgroundColor: 'black' }}>
21
+ <Text color="snow" treatment="eyebrow">
22
22
  @include font-smoothing(antialiased);
23
23
  </Text>
24
24
  </div>
25
25
 
26
- <div className='Story Mixins font-smoothing--subpixel' style={{ backgroundColor: 'black' }}>
27
- <Text color='snow' treatment='eyebrow'>
26
+ <div className="Story Mixins font-smoothing--subpixel" style={{ backgroundColor: 'black' }}>
27
+ <Text color="snow" treatment="eyebrow">
28
28
  @include font-smoothing(subpixel);
29
29
  </Text>
30
30
  </div>
@@ -5,9 +5,9 @@ import './overflow-scroll.stories.scss';
5
5
  export default { title: 'Mixins/overflow-scroll' };
6
6
 
7
7
  export const Default = () => (
8
- <div className='Story Mixins overflow-scroll'>Overflowed on the y axis!</div>
8
+ <div className="Story Mixins overflow-scroll">Overflowed on the y axis!</div>
9
9
  );
10
10
 
11
11
  export const OverflowX = () => (
12
- <div className='Story Mixins overflow-scroll-x'>Overflowed on the x axis!</div>
12
+ <div className="Story Mixins overflow-scroll-x">Overflowed on the x axis!</div>
13
13
  );
@@ -1,3 +1,4 @@
1
+ /* eslint-disable @typescript-eslint/no-magic-numbers */
1
2
  import React from 'react';
2
3
  import { space } from '@moda/tokens';
3
4
 
@@ -6,10 +7,8 @@ import './stack.stories.scss';
6
7
  export default { title: 'Mixins/stack' };
7
8
 
8
9
  export const Default = () => (
9
- <div className='Story Mixins stack'>
10
- <p>
11
- Defaults to {`$space: 4`} === {space.scale[4]}
12
- </p>
10
+ <div className="Story Mixins stack">
11
+ <p>Defaults to $space: 4 === {space.scale[4]}</p>
13
12
 
14
13
  <span>Notice the different element tags</span>
15
14
 
@@ -18,8 +17,8 @@ export const Default = () => (
18
17
  );
19
18
 
20
19
  export const Horizontal = () => (
21
- <div className='Story Mixins stack stack--horizontal'>
22
- <p>Accepts {`$direction: horizontal`}</p>
20
+ <div className="Story Mixins stack stack--horizontal">
21
+ <p>Accepts $direction: horizontal</p>
23
22
 
24
23
  <span>Notice the different element tags</span>
25
24
 
@@ -4,4 +4,4 @@ import './thin-underline.stories.scss';
4
4
 
5
5
  export default { title: 'Mixins/thin-underline' };
6
6
 
7
- export const Default = () => <div className='Story Mixins thin-underline'>Hello</div>;
7
+ export const Default = () => <div className="Story Mixins thin-underline">Hello</div>;
@@ -4,4 +4,4 @@ import './visually-hidden.stories.scss';
4
4
 
5
5
  export default { title: 'Mixins/visually-hidden' };
6
6
 
7
- export const Default = () => <div className='Story Mixins visually-hidden'>Hello</div>;
7
+ export const Default = () => <div className="Story Mixins visually-hidden">Hello</div>;
@@ -4,6 +4,7 @@ import { StatesProps } from './StatesProps';
4
4
  import './State.scss';
5
5
 
6
6
  interface Props {
7
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
7
8
  props: any;
8
9
  children: JSX.Element | RenderProps;
9
10
  }
@@ -13,10 +14,10 @@ export const State: React.FC<Props> = ({ props, children, ...rest }) => {
13
14
  const innerChildren = isRenderProps(children) ? children(props) : children;
14
15
 
15
16
  return (
16
- <div className='State' {...rest}>
17
+ <div className="State" {...rest}>
17
18
  {Specimen}
18
19
 
19
- <code className='State__props'>
20
+ <code className="State__props">
20
21
  <StatesProps props={props}>{innerChildren}</StatesProps>
21
22
  </code>
22
23
  </div>
@@ -4,15 +4,16 @@ import { State } from './State';
4
4
  import './States.scss';
5
5
 
6
6
  export interface Props {
7
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
7
8
  states?: any[];
8
9
  children: JSX.Element | RenderProps;
9
10
  }
10
11
 
11
12
  export const States: React.FC<Props> = ({ states = [{}], children, ...rest }) => {
12
13
  return (
13
- <div className='States'>
14
- {states.map((props, i) => (
15
- <State key={i} props={props} {...rest}>
14
+ <div className="States">
15
+ {states.map((props, index) => (
16
+ <State key={index} props={props} {...rest}>
16
17
  {children}
17
18
  </State>
18
19
  ))}
@@ -1,22 +1,25 @@
1
1
  import React from 'react';
2
2
  import { Stack } from '../../components/Stack';
3
+ import { omit } from '../omit';
3
4
  import { isRenderProps } from './isRenderProps';
4
5
  import { stringifyProps } from './stringifyProps';
5
- import { omit } from '../omit';
6
6
  import './StatesProps.scss';
7
7
 
8
+ /* eslint-disable @typescript-eslint/no-explicit-any */
8
9
  interface Props {
9
10
  children: any;
10
11
  props: any;
11
12
  }
13
+ /* eslint-enable @typescript-eslint/no-explicit-any */
12
14
 
15
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
13
16
  const isEmpty = (obj?: any) => Object.entries(obj || {}).length === 0;
14
17
 
15
18
  export const StatesProps: React.FC<Props> = ({ props, children }) => {
16
19
  const childrenProps = omit(children.props, ...Object.keys(props || {}));
17
20
 
18
21
  return (
19
- <Stack className='StatesProps' space={2} direction='horizontal'>
22
+ <Stack className="StatesProps" space={2} direction="horizontal">
20
23
  <span>{children.type.displayName || children.type.name}</span>
21
24
  {!isEmpty(props) && <strong>{stringifyProps(props)}</strong>}
22
25
  {!isRenderProps(children) && !isEmpty(childrenProps) && (
@@ -1,4 +1,5 @@
1
1
  export type RenderProps = {
2
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2
3
  (props: any): JSX.Element;
3
4
  };
4
5
 
@@ -4,6 +4,7 @@ const truncate = (string: string, maxLength = 25) => {
4
4
  return `${string.substring(0, maxLength)}${ellipsis ? '...' : ''}`;
5
5
  };
6
6
 
7
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
7
8
  export const stringifyProps = (props: any) => {
8
9
  const stringifiedProps = Object.entries(props || {}).reduce((memo: string, [key, value]) => {
9
10
  if (key === 'children') return `${memo} children={...}`;