@wonderflow/react-components 2.25.0-beta.7 → 2.25.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/button/button.d.ts +5 -18
- package/button/button.js +3 -3
- package/card/card.d.ts +1 -2
- package/clamp-text/clamp-text.d.ts +1 -1
- package/container/container.d.ts +1 -1
- package/dropdown/dropdown-item.d.ts +1 -1
- package/dropdown/dropdown-item.js +1 -3
- package/icon-button/icon-button.d.ts +4 -18
- package/icon-button/icon-button.module.css +3 -3
- package/index.d.ts +0 -1
- package/index.js +0 -1
- package/list/list.d.ts +1 -1
- package/package.json +1 -1
- package/prose/prose.d.ts +1 -1
- package/snackbar/snackbar.d.ts +1 -1
- package/stack/stack.d.ts +1 -1
- package/star-meter/star-meter.d.ts +1 -2
- package/text/text.d.ts +1 -1
- package/textfield/base-field/base-field.d.ts +1 -1
- package/themes/dark.css +1 -1
- package/themes/light.css +1 -1
- package/themes.css +3 -3
- package/title/title.d.ts +1 -1
- package/primitive/index.d.ts +0 -2
- package/primitive/index.js +0 -1
- package/primitive/primitive.d.ts +0 -14
- package/primitive/primitive.js +0 -23
package/button/button.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { MouseEvent } from 'react';
|
|
2
2
|
import { IconNames } from '../icons/types';
|
|
3
|
-
import {
|
|
4
|
-
declare type
|
|
5
|
-
export declare type ButtonProps = PrimitiveButtonProps & {
|
|
3
|
+
import { Polymorphic } from '../';
|
|
4
|
+
export declare type ButtonProps = PropsWithClass & {
|
|
6
5
|
kind?: 'primary' | 'secondary' | 'flat';
|
|
7
6
|
dimension?: 'regular' | 'small' | 'big';
|
|
8
7
|
fullWidth?: boolean;
|
|
@@ -12,18 +11,6 @@ export declare type ButtonProps = PrimitiveButtonProps & {
|
|
|
12
11
|
type?: 'submit' | 'reset' | 'button';
|
|
13
12
|
onClick?(event: MouseEvent<HTMLButtonElement | HTMLAnchorElement>): void;
|
|
14
13
|
};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
} & {
|
|
18
|
-
as?: keyof JSX.IntrinsicElements | undefined;
|
|
19
|
-
}, "as" | "key" | keyof React.ButtonHTMLAttributes<HTMLButtonElement>> & {
|
|
20
|
-
kind?: "primary" | "secondary" | "flat" | undefined;
|
|
21
|
-
dimension?: "big" | "small" | "regular" | undefined;
|
|
22
|
-
fullWidth?: boolean | undefined;
|
|
23
|
-
icon?: IconNames | undefined;
|
|
24
|
-
iconPosition?: "left" | "right" | undefined;
|
|
25
|
-
disabled?: boolean | undefined;
|
|
26
|
-
type?: "button" | "submit" | "reset" | undefined;
|
|
27
|
-
onClick?(event: MouseEvent<HTMLButtonElement | HTMLAnchorElement>): void;
|
|
28
|
-
} & React.RefAttributes<HTMLButtonElement>>;
|
|
14
|
+
declare type PolymorphicButton = Polymorphic.ForwardRefComponent<'button', ButtonProps>;
|
|
15
|
+
export declare const Button: PolymorphicButton;
|
|
29
16
|
export {};
|
package/button/button.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import clsx from 'clsx';
|
|
2
2
|
import React, { forwardRef, useCallback } from 'react';
|
|
3
|
-
import { Icon
|
|
3
|
+
import { Icon } from '../';
|
|
4
4
|
import { Button as ButtonClass } from './button.module.css';
|
|
5
|
-
export const Button = forwardRef(({ kind = 'primary', dimension = 'regular', className, children, fullWidth, icon, disabled, iconPosition = 'left', type = 'button', onClick, as = 'button', ...props }, forwardedRef) => {
|
|
5
|
+
export const Button = forwardRef(({ kind = 'primary', dimension = 'regular', className, children, fullWidth, icon, disabled, iconPosition = 'left', type = 'button', onClick, as: Wrapper = 'button', ...props }, forwardedRef) => {
|
|
6
6
|
const handleClick = useCallback(() => (event) => {
|
|
7
7
|
if (!disabled && onClick)
|
|
8
8
|
onClick(event);
|
|
@@ -14,7 +14,7 @@ export const Button = forwardRef(({ kind = 'primary', dimension = 'regular', cla
|
|
|
14
14
|
regular: 16,
|
|
15
15
|
small: 16
|
|
16
16
|
};
|
|
17
|
-
return (React.createElement(
|
|
17
|
+
return (React.createElement(Wrapper, { ref: forwardedRef, type: Wrapper === 'button' ? type : undefined, className: clsx(ButtonClass, className), "data-button-icon-position": iconPosition, "data-button-dimension": dimension, "data-button-kind": kind, "data-button-fullwidth": fullWidth, "data-button-disabled": disabled, "aria-disabled": disabled, onClick: handleClick(), ...props },
|
|
18
18
|
icon && React.createElement(Icon, { name: icon, dimension: iconSize[dimension] }),
|
|
19
19
|
children));
|
|
20
20
|
});
|
package/card/card.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import
|
|
3
|
-
import { StackProps } from '../';
|
|
2
|
+
import { StackProps, Polymorphic } from '../';
|
|
4
3
|
import { TokensTypes } from '@wonderflow/tokens/platforms/web/types';
|
|
5
4
|
export declare type CardProps = PropsWithClass & Pick<StackProps, 'wrap' | 'columnGap' | 'rowGap' | 'verticalAlign' | 'horizontalAlign'> & {
|
|
6
5
|
padding?: false | TokensTypes['space'];
|
package/container/container.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import type * as Polymorphic from '../polymorphic';
|
|
3
2
|
import { IconNames } from '../icons/types';
|
|
3
|
+
import { Polymorphic } from '../';
|
|
4
4
|
export declare type DropdownItemProps = PropsWithClass & {
|
|
5
5
|
children: ReactNode;
|
|
6
6
|
icon?: IconNames;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import React, { useCallback, forwardRef, useRef, useMemo } from 'react';
|
|
2
|
-
import { Icon } from '../icon';
|
|
3
|
-
import { Stack } from '../stack';
|
|
4
2
|
import { useRovingTabIndex, useFocusEffect } from 'react-roving-tabindex';
|
|
5
3
|
import { DropdownItem as DropdownItemClass, Icon as IconClass } from './dropdown-item.module.css';
|
|
6
|
-
import { Tooltip } from '../';
|
|
4
|
+
import { Tooltip, Stack, Icon } from '../';
|
|
7
5
|
import clsx from 'clsx';
|
|
8
6
|
export const DropdownItem = forwardRef(({ className, children, onClick, icon, dimension = 'regular', as: Wrapper = 'button', iconPosition = 'left', description, ...props }, forwardedRef) => {
|
|
9
7
|
const itemRef = useRef(forwardedRef);
|
|
@@ -1,19 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
declare type
|
|
4
|
-
export declare
|
|
5
|
-
export declare const IconButton: React.ForwardRefExoticComponent<Pick<Pick<Pick<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "key" | keyof React.ButtonHTMLAttributes<HTMLButtonElement>> & {
|
|
6
|
-
ref?: ((instance: HTMLButtonElement | null) => void) | React.RefObject<HTMLButtonElement> | null | undefined;
|
|
7
|
-
} & {
|
|
8
|
-
as?: keyof JSX.IntrinsicElements | undefined;
|
|
9
|
-
}, "as" | "key" | keyof React.ButtonHTMLAttributes<HTMLButtonElement>> & {
|
|
10
|
-
kind?: "primary" | "secondary" | "flat" | undefined;
|
|
11
|
-
dimension?: "big" | "small" | "regular" | undefined;
|
|
12
|
-
fullWidth?: boolean | undefined;
|
|
13
|
-
icon?: import("../icons/types").IconNames | undefined;
|
|
14
|
-
iconPosition?: "left" | "right" | undefined;
|
|
15
|
-
disabled?: boolean | undefined;
|
|
16
|
-
type?: "button" | "submit" | "reset" | undefined;
|
|
17
|
-
onClick?(event: React.MouseEvent<HTMLAnchorElement | HTMLButtonElement, MouseEvent>): void;
|
|
18
|
-
} & React.RefAttributes<HTMLButtonElement>, "as" | "key" | keyof React.ButtonHTMLAttributes<HTMLButtonElement> | "kind" | "dimension" | "fullWidth" | "icon" | "iconPosition"> & Pick<ButtonProps, "onClick" | "disabled" | "kind" | "dimension" | "icon"> & React.RefAttributes<HTMLButtonElement>>;
|
|
1
|
+
import { Button, ButtonProps, Polymorphic } from '../';
|
|
2
|
+
export declare type IconButtonProps = PropsWithClass & Pick<ButtonProps, 'kind' | 'dimension' | 'icon' | 'disabled' | 'onClick'>;
|
|
3
|
+
declare type PolymorphicIconButton = Polymorphic.ForwardRefComponent<Polymorphic.IntrinsicElement<typeof Button>, Polymorphic.OwnProps<typeof Button> & IconButtonProps>;
|
|
4
|
+
export declare const IconButton: PolymorphicIconButton;
|
|
19
5
|
export {};
|
|
@@ -5,18 +5,18 @@
|
|
|
5
5
|
&[data-button-dimension='small'] {
|
|
6
6
|
inline-size: env(--space-24);
|
|
7
7
|
min-inline-size: env(--space-24);
|
|
8
|
-
padding:
|
|
8
|
+
padding: 0;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
&[data-button-dimension='regular'] {
|
|
12
12
|
inline-size: env(--space-40);
|
|
13
13
|
min-inline-size: env(--space-40);
|
|
14
|
-
padding:
|
|
14
|
+
padding: 0;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
&[data-button-dimension='big'] {
|
|
18
18
|
inline-size: env(--space-48);
|
|
19
19
|
min-inline-size: env(--space-48);
|
|
20
|
-
padding:
|
|
20
|
+
padding: 0;
|
|
21
21
|
}
|
|
22
22
|
}
|
package/index.d.ts
CHANGED
|
@@ -15,7 +15,6 @@ export { IconButton, IconButtonProps } from './icon-button';
|
|
|
15
15
|
export { List, ListProps } from './list';
|
|
16
16
|
export { Modal, ModalProps, useModalContext } from './modal';
|
|
17
17
|
export { Prose, ProseProps } from './prose';
|
|
18
|
-
export { Primitive, ComponentPropsWithoutRef, PrimitivePropsWithRef } from './primitive';
|
|
19
18
|
export { Select, SelectProps } from './select';
|
|
20
19
|
export { Separator } from './separator';
|
|
21
20
|
export { Snackbar, SnackbarProps } from './snackbar';
|
package/index.js
CHANGED
|
@@ -15,7 +15,6 @@ export { IconButton } from './icon-button';
|
|
|
15
15
|
export { List } from './list';
|
|
16
16
|
export { Modal, useModalContext } from './modal';
|
|
17
17
|
export { Prose } from './prose';
|
|
18
|
-
export { Primitive } from './primitive';
|
|
19
18
|
export { Select } from './select';
|
|
20
19
|
export { Separator } from './separator';
|
|
21
20
|
export { Snackbar } from './snackbar';
|
package/list/list.d.ts
CHANGED
package/package.json
CHANGED
package/prose/prose.d.ts
CHANGED
package/snackbar/snackbar.d.ts
CHANGED
package/stack/stack.d.ts
CHANGED
package/text/text.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { InputHTMLAttributes } from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { Polymorphic } from '../../';
|
|
3
3
|
export declare type BaseFieldProps = InputHTMLAttributes<HTMLInputElement> & InputHTMLAttributes<HTMLTextAreaElement> & {
|
|
4
4
|
invalid?: boolean;
|
|
5
5
|
};
|
package/themes/dark.css
CHANGED
package/themes/light.css
CHANGED
package/themes.css
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
color: var(--global-foreground);
|
|
5
5
|
/**
|
|
6
6
|
* Do not edit directly
|
|
7
|
-
* Generated on Mon, 04 Oct 2021
|
|
7
|
+
* Generated on Mon, 04 Oct 2021 16:41:59 GMT
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
color: var(--global-foreground);
|
|
52
52
|
/**
|
|
53
53
|
* Do not edit directly
|
|
54
|
-
* Generated on Mon, 04 Oct 2021
|
|
54
|
+
* Generated on Mon, 04 Oct 2021 16:41:59 GMT
|
|
55
55
|
*/
|
|
56
56
|
|
|
57
57
|
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
color: var(--global-foreground);
|
|
100
100
|
/**
|
|
101
101
|
* Do not edit directly
|
|
102
|
-
* Generated on Mon, 04 Oct 2021
|
|
102
|
+
* Generated on Mon, 04 Oct 2021 16:41:59 GMT
|
|
103
103
|
*/
|
|
104
104
|
|
|
105
105
|
|
package/title/title.d.ts
CHANGED
package/primitive/index.d.ts
DELETED
package/primitive/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Primitive } from './primitive';
|
package/primitive/primitive.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
declare const NODES: readonly ["a", "button", "div", "h2", "h3", "img", "li", "nav", "p", "span", "svg", "ul"];
|
|
3
|
-
declare type PropsWithoutRef<P> = P extends any ? ('ref' extends keyof P ? Pick<P, Exclude<keyof P, 'ref'>> : P) : P;
|
|
4
|
-
export declare type ComponentPropsWithoutRef<T extends React.ElementType> = PropsWithoutRef<React.ComponentProps<T>>;
|
|
5
|
-
declare type Primitives = {
|
|
6
|
-
[E in typeof NODES[number]]: PrimitiveForwardRefComponent<E>;
|
|
7
|
-
};
|
|
8
|
-
export declare type PrimitivePropsWithRef<E extends React.ElementType> = React.ComponentPropsWithRef<E> & {
|
|
9
|
-
as?: keyof JSX.IntrinsicElements;
|
|
10
|
-
};
|
|
11
|
-
interface PrimitiveForwardRefComponent<E extends React.ElementType> extends React.ForwardRefExoticComponent<PrimitivePropsWithRef<E>> {
|
|
12
|
-
}
|
|
13
|
-
export declare const Primitive: Primitives;
|
|
14
|
-
export {};
|
package/primitive/primitive.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
const NODES = [
|
|
3
|
-
'a',
|
|
4
|
-
'button',
|
|
5
|
-
'div',
|
|
6
|
-
'h2',
|
|
7
|
-
'h3',
|
|
8
|
-
'img',
|
|
9
|
-
'li',
|
|
10
|
-
'nav',
|
|
11
|
-
'p',
|
|
12
|
-
'span',
|
|
13
|
-
'svg',
|
|
14
|
-
'ul'
|
|
15
|
-
];
|
|
16
|
-
export const Primitive = NODES.reduce((primitive, node) => ({
|
|
17
|
-
...primitive,
|
|
18
|
-
[node]: React.forwardRef((props, forwardedRef) => {
|
|
19
|
-
const { as, ...primitiveProps } = props;
|
|
20
|
-
const Comp = as || node;
|
|
21
|
-
return React.createElement(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
22
|
-
})
|
|
23
|
-
}), {});
|