@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.
- package/CHANGELOG.md +26 -0
- package/dist/index.cjs.js +349 -299
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +348 -298
- package/dist/index.esm.js.map +1 -1
- package/dist/src/components/Expandable/Expandable.d.ts +1 -0
- package/dist/src/components/Select/Select.d.ts +1 -0
- package/dist/src/components/Select/SelectOption.d.ts +1 -0
- package/dist/src/components/Select/SelectOptions.d.ts +1 -0
- package/dist/styles.css +1 -1
- package/package.json +18 -8
- package/src/components/AspectRatioBox/AspectRatioBox.tsx +4 -4
- package/src/components/AspectRatioBox/index.ts +1 -1
- package/src/components/Badge/Badge.stories.tsx +5 -5
- package/src/components/Badge/Badge.test.tsx +1 -1
- package/src/components/Breadcrumbs/Breadcrumb/Breadcrumb.tsx +6 -6
- package/src/components/Breadcrumbs/Breadcrumbs.stories.tsx +6 -6
- package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +2 -2
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +1 -1
- package/src/components/Breakpoint/Breakpoint.stories.tsx +10 -9
- package/src/components/Breakpoint/Breakpoint.test.tsx +2 -2
- package/src/components/Breakpoint/generateMediaQuery.ts +5 -4
- package/src/components/Button/Button.stories.tsx +4 -4
- package/src/components/Checkbox/Checkbox.stories.tsx +5 -5
- package/src/components/Checkbox/Checkbox.test.tsx +3 -3
- package/src/components/Checkbox/Checkbox.tsx +4 -4
- package/src/components/Clickable/Clickable.stories.tsx +3 -3
- package/src/components/ColorSwatch/ColorSwatch.stories.tsx +11 -11
- package/src/components/ColorSwatch/ColorSwatch.test.tsx +1 -1
- package/src/components/ColorSwatch/ColorSwatch.tsx +1 -1
- package/src/components/Constrain/Constrain.stories.tsx +1 -1
- package/src/components/Constrain/ExceedConstrain.stories.tsx +2 -2
- package/src/components/ControlLink/ControlLink.stories.tsx +1 -1
- package/src/components/ControlLink/index.ts +1 -1
- package/src/components/CreditCardNumberInput/CreditCardNumberInput.stories.tsx +1 -1
- package/src/components/CreditCardNumberInput/CreditCardNumberInput.test.tsx +4 -4
- package/src/components/CreditCardNumberInput/CreditCardNumberInput.tsx +1 -0
- package/src/components/DefinitionList/DefinitionList.stories.tsx +3 -3
- package/src/components/DefinitionList/DefinitionList.test.tsx +1 -1
- package/src/components/Divider/Divider.stories.tsx +4 -4
- package/src/components/Divider/Divider.test.tsx +1 -1
- package/src/components/Divider/Divider.tsx +1 -1
- package/src/components/Divider/NoLineDivider.tsx +1 -1
- package/src/components/Divider/TwoLineDivider.tsx +1 -1
- package/src/components/Expandable/Expandable.stories.tsx +8 -8
- package/src/components/Expandable/Expandable.test.tsx +1 -1
- package/src/components/Expandable/Expandable.tsx +12 -5
- package/src/components/Field/Field.stories.tsx +4 -4
- package/src/components/Field/Field.test.tsx +7 -7
- package/src/components/Field/Field.tsx +5 -5
- package/src/components/Field/index.ts +1 -0
- package/src/components/Loading/Loading.test.tsx +1 -1
- package/src/components/Loading/Loading.tsx +2 -1
- package/src/components/Modal/Modal.test.tsx +2 -2
- package/src/components/ModalOverlay/ModalOverlay.test.tsx +2 -2
- package/src/components/ModalOverlay/ModalOverlay.tsx +2 -2
- package/src/components/Overlay/Overlay.stories.tsx +1 -1
- package/src/components/Paginator/Paginator.tsx +3 -3
- package/src/components/PasswordInput/PasswordInput.stories.tsx +1 -1
- package/src/components/PasswordInput/PasswordInput.tsx +6 -6
- package/src/components/Popover/Popover.stories.tsx +1 -1
- package/src/components/Popover/Popover.tsx +10 -7
- package/src/components/PromoBanner/PromoBanner.stories.tsx +9 -9
- package/src/components/PromoBanner/PromoBanner.tsx +1 -1
- package/src/components/RadioButton/RadioButton.stories.tsx +2 -2
- package/src/components/RadioButton/RadioButton.tsx +4 -4
- package/src/components/SearchInput/SearchInput.stories.tsx +2 -2
- package/src/components/SearchInput/SearchInput.test.tsx +1 -1
- package/src/components/SearchInput/SearchInput.tsx +3 -3
- package/src/components/Select/MultiSelect.tsx +7 -7
- package/src/components/Select/Select.stories.tsx +15 -14
- package/src/components/Select/Select.test.tsx +13 -13
- package/src/components/Select/Select.tsx +11 -7
- package/src/components/Select/SelectOption.tsx +5 -2
- package/src/components/Select/SelectOptions.tsx +8 -5
- package/src/components/SelectableButton/SelectableButton.stories.tsx +1 -1
- package/src/components/Shape/ArcWindow.tsx +10 -10
- package/src/components/Shape/Bradley.tsx +4 -4
- package/src/components/Shape/Brancusi.tsx +4 -4
- package/src/components/Shape/Circle.tsx +10 -10
- package/src/components/Shape/Diamond.tsx +10 -10
- package/src/components/Shape/Keyhole.tsx +4 -4
- package/src/components/Shape/Mirror.tsx +4 -4
- package/src/components/Shape/Oval.tsx +4 -4
- package/src/components/Shape/Triangle.tsx +7 -7
- package/src/components/Shape/Window.tsx +4 -4
- package/src/components/Stack/Stack.stories.tsx +3 -3
- package/src/components/Stack/Stack.test.tsx +1 -1
- package/src/components/Tabs/TabList.tsx +1 -1
- package/src/components/Tabs/TabPanel.tsx +1 -1
- package/src/components/Tabs/TabPanels.tsx +1 -1
- package/src/components/Tabs/Tabs.stories.tsx +2 -2
- package/src/components/Tabs/Tabs.test.tsx +2 -2
- package/src/components/Tabs/Tabs.tsx +7 -1
- package/src/components/Tag/Tag.tsx +6 -5
- package/src/components/Text/Text.stories.tsx +5 -5
- package/src/components/Text/Text.test.tsx +1 -1
- package/src/components/TextInput/TextInput.stories.tsx +1 -1
- package/src/components/TextInput/TextInput.test.tsx +1 -1
- package/src/components/Textarea/Textarea.stories.tsx +1 -1
- package/src/components/Textarea/Textarea.test.tsx +3 -3
- package/src/components/Toast/Toast.stories.tsx +1 -1
- package/src/components/Toast/Toast.test.tsx +1 -1
- package/src/components/Toast/Toast.tsx +6 -6
- package/src/components/VerticalDivider/VerticalDivider.stories.tsx +3 -3
- package/src/components/VerticalDivider/VerticalDivider.test.tsx +2 -2
- package/src/hooks/useKeyboardListNavigation.spec.ts +2 -1
- package/src/hooks/useKeyboardListNavigation.ts +2 -0
- package/src/hooks/useUpdateEffect.ts +1 -0
- package/src/index.ts +2 -2
- package/src/mixins/font-smoothing/font-smoothing.stories.tsx +8 -8
- package/src/mixins/overflow-scroll/overflow-scroll.stories.tsx +2 -2
- package/src/mixins/stack/stack.stories.tsx +5 -6
- package/src/mixins/thin-underline/thin-underline.stories.tsx +1 -1
- package/src/mixins/visually-hidden/visually-hidden.stories.tsx +1 -1
- package/src/utilities/States/State.tsx +3 -2
- package/src/utilities/States/States.tsx +4 -3
- package/src/utilities/States/StatesProps.tsx +5 -2
- package/src/utilities/States/isRenderProps.ts +1 -0
- 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=
|
|
13
|
-
<Text treatment=
|
|
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=
|
|
17
|
-
<Text treatment=
|
|
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=
|
|
21
|
-
<Text color=
|
|
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=
|
|
27
|
-
<Text color=
|
|
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=
|
|
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=
|
|
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=
|
|
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=
|
|
22
|
-
<p>Accepts
|
|
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=
|
|
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=
|
|
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=
|
|
17
|
+
<div className="State" {...rest}>
|
|
17
18
|
{Specimen}
|
|
18
19
|
|
|
19
|
-
<code className=
|
|
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=
|
|
14
|
-
{states.map((props,
|
|
15
|
-
<State key={
|
|
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=
|
|
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) && (
|
|
@@ -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={...}`;
|