@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.
- package/CHANGELOG.md +7 -0
- package/dist/index.cjs.js +310 -278
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +309 -277
- package/dist/index.esm.js.map +1 -1
- 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 +3 -2
- 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 +7 -7
- package/src/components/Select/SelectOption.tsx +1 -1
- package/src/components/Select/SelectOptions.tsx +5 -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
|
@@ -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={...}`;
|