@wonderflow/react-components 3.0.0-next.2 → 3.0.0-next.3
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/avatar/avatar.js +2 -2
- package/button/button.d.ts +4 -4
- package/button/button.js +4 -5
- package/button/button.module.css +22 -19
- package/card/card.d.ts +1 -1
- package/card/card.js +2 -2
- package/chip/chip.d.ts +10 -3
- package/chip/chip.js +2 -2
- package/circular-progress/circular-progress.js +2 -2
- package/clamp-text/clamp-text.d.ts +1 -1
- package/clamp-text/clamp-text.js +2 -3
- package/container/container.js +2 -3
- package/core/typography.css +1 -6
- package/core.css +5 -1
- package/disclosure/disclosure.js +3 -3
- package/dropdown/dropdown-item.d.ts +1 -1
- package/dropdown/dropdown-item.js +2 -2
- package/dropdown/dropdown-menu.d.ts +3 -3
- package/dropdown/dropdown-menu.js +11 -5
- package/dropdown/dropdown.d.ts +9 -19
- package/dropdown/dropdown.js +7 -5
- package/elevator/elevator.d.ts +2 -2
- package/grid/grid-item.d.ts +5 -1
- package/grid/grid-item.js +5 -4
- package/grid/grid.d.ts +5 -21
- package/grid/grid.js +3 -3
- package/grid/index.d.ts +1 -1
- package/grid/index.js +1 -1
- package/icon/icon.js +2 -2
- package/icon-button/icon-button.d.ts +1 -1
- package/icon-button/icon-button.js +1 -2
- package/icons/all.svg +15 -7
- package/icons/structure.json +2 -0
- package/icons/types.d.ts +4 -0
- package/index.d.ts +1 -1
- package/info-state/info-state.d.ts +12 -3
- package/info-state/info-state.js +2 -2
- package/input-group/input-group.js +3 -3
- package/input-group/input-group.module.css +0 -3
- package/linear-progress/linear-progress.d.ts +4 -4
- package/linear-progress/linear-progress.js +3 -3
- package/list/list.d.ts +2 -1
- package/list/list.js +2 -3
- package/list/list.module.css +7 -0
- package/masonry/masonry.d.ts +2 -2
- package/masonry/masonry.js +2 -2
- package/modal/modal-content.js +2 -2
- package/modal/modal.d.ts +5 -7
- package/modal/modal.js +11 -14
- package/package.json +30 -30
- package/pagination/pagination.d.ts +2 -4
- package/pagination/pagination.js +2 -2
- package/prose/prose.js +2 -3
- package/select/select.js +2 -2
- package/selection-controls/checkbox.js +2 -2
- package/selection-controls/radio.js +2 -2
- package/selection-controls/toggle.js +2 -2
- package/separator/index.d.ts +1 -0
- package/separator/separator.d.ts +3 -2
- package/separator/separator.js +2 -2
- package/skeleton-block/skeleton-block.d.ts +1 -1
- package/skeleton-block/skeleton-block.js +2 -2
- package/slider/slider.js +2 -2
- package/snackbar/snackbar.js +2 -3
- package/spinner/spinner.d.ts +5 -2
- package/spinner/spinner.js +5 -4
- package/split-button/split-button.js +2 -3
- package/stack/stack.js +2 -3
- package/star-meter/star-meter.d.ts +1 -1
- package/star-meter/star-meter.js +2 -3
- package/tab/tab-item.js +2 -2
- package/tab/tab-list.js +1 -1
- package/tab/tab-panel.js +3 -2
- package/tab/tab.d.ts +4 -4
- package/tab/tab.js +3 -2
- package/table/table.d.ts +3 -3
- package/table/table.js +8 -9
- package/table/table.module.css +0 -4
- package/text/text.d.ts +1 -1
- package/text/text.js +2 -3
- package/text/text.module.css +25 -24
- package/textfield/base-field/base-field.d.ts +1 -0
- package/textfield/base-field/base-field.js +2 -2
- package/textfield/base-field/index.d.ts +1 -1
- package/textfield/textfield.d.ts +4 -4
- package/textfield/textfield.js +3 -3
- 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/title/title.js +2 -3
- package/title/title.module.css +35 -34
- package/toggle-button/toggle-button.js +2 -3
- package/toggle-button/toggle-button.module.css +16 -2
- package/tooltip/tooltip.d.ts +2 -2
package/avatar/avatar.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import clsx from 'clsx';
|
|
2
2
|
import React, { forwardRef } from 'react';
|
|
3
3
|
import { Avatar as AvatarClass, Placeholder } from './avatar.module.css';
|
|
4
|
-
export const Avatar = forwardRef(({ className, src, dimension = 'regular', ...
|
|
4
|
+
export const Avatar = forwardRef(({ className, src, dimension = 'regular', ...otherProps }, forwardedRef) => {
|
|
5
5
|
return (React.createElement("picture", { className: clsx(AvatarClass, className), "data-avatar-dimension": dimension },
|
|
6
6
|
React.createElement("svg", { "aria-hidden": "true", className: Placeholder, height: 18, viewBox: "0 0 12 18", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
|
|
7
7
|
React.createElement("path", { opacity: 0.7, d: "M6 0C3.795 0 2 1.794 2 4s1.795 4 4 4 4-1.794 4-4-1.795-4-4-4z", fill: "var(--highlight-blue-foreground)" }),
|
|
8
8
|
React.createElement("path", { d: "M8.4 9H3.6C1.612 9 0 10.575 0 12.531v5.126C1.814 18.517 3.85 19 6 19s4.186-.483 6-1.343v-5.126C12 10.581 10.394 9 8.4 9z", fill: "var(--highlight-blue-foreground)" })),
|
|
9
|
-
src && (React.createElement("img", { ref: forwardedRef, alt: "", src: src, ...
|
|
9
|
+
src && (React.createElement("img", { ref: forwardedRef, alt: "", src: src, ...otherProps }))));
|
|
10
10
|
});
|
|
11
11
|
Avatar.displayName = 'Avatar';
|
package/button/button.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { FC, MouseEvent } from 'react';
|
|
2
2
|
import { IconNames } from '../icons/types';
|
|
3
3
|
import { Polymorphic } from '../';
|
|
4
|
-
export declare type ButtonProps =
|
|
4
|
+
export declare type ButtonProps = {
|
|
5
5
|
kind?: 'primary' | 'secondary' | 'flat';
|
|
6
6
|
dimension?: 'regular' | 'small' | 'big';
|
|
7
7
|
fullWidth?: boolean;
|
|
@@ -10,12 +10,12 @@ export declare type ButtonProps = PropsWithClass & {
|
|
|
10
10
|
iconColor?: string;
|
|
11
11
|
disabled?: boolean;
|
|
12
12
|
type?: 'submit' | 'reset' | 'button';
|
|
13
|
-
|
|
13
|
+
busy?: boolean;
|
|
14
14
|
pressed?: boolean;
|
|
15
15
|
onClick?(event: MouseEvent<HTMLButtonElement | HTMLAnchorElement>): void;
|
|
16
16
|
};
|
|
17
17
|
declare type PolymorphicButton = Polymorphic.ForwardRefComponent<'button', ButtonProps>;
|
|
18
18
|
export declare const Button: PolymorphicButton;
|
|
19
19
|
export declare type ButtonsGroupProps = PropsWithClass & Pick<ButtonProps, 'dimension' | 'kind'>;
|
|
20
|
-
export declare const ButtonsGroup:
|
|
20
|
+
export declare const ButtonsGroup: FC<ButtonsGroupProps>;
|
|
21
21
|
export {};
|
package/button/button.js
CHANGED
|
@@ -2,7 +2,7 @@ import clsx from 'clsx';
|
|
|
2
2
|
import React, { Children, cloneElement, forwardRef, useCallback } from 'react';
|
|
3
3
|
import { Icon, Spinner } from '../';
|
|
4
4
|
import { Button as ButtonClass, SpinnerIndicator, ButtonsGroup as ButtonsGroupClass } from './button.module.css';
|
|
5
|
-
export const Button = forwardRef(({ kind = 'primary', dimension = 'regular', className, children, fullWidth, icon, disabled, iconPosition = 'left', iconColor, type = 'button', pressed, onClick,
|
|
5
|
+
export const Button = forwardRef(({ kind = 'primary', dimension = 'regular', className, children, fullWidth, icon, disabled, iconPosition = 'left', iconColor, type = 'button', pressed, onClick, busy, as: Wrapper = 'button', ...otherProps }, forwardedRef) => {
|
|
6
6
|
const handleClick = useCallback(() => (event) => {
|
|
7
7
|
if (!disabled && onClick)
|
|
8
8
|
onClick(event);
|
|
@@ -14,14 +14,13 @@ export const Button = forwardRef(({ kind = 'primary', dimension = 'regular', cla
|
|
|
14
14
|
regular: 16,
|
|
15
15
|
small: 16
|
|
16
16
|
};
|
|
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, "
|
|
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, "aria-disabled": disabled, "aria-busy": busy, "aria-pressed": Wrapper === 'button' ? pressed : undefined, "aria-live": busy ? 'polite' : undefined, onClick: handleClick(), ...otherProps },
|
|
18
18
|
icon && (React.createElement(Icon, { name: icon, fill: iconColor, dimension: iconSize[dimension] })),
|
|
19
|
-
children && React.createElement("span", null, children),
|
|
20
|
-
|
|
19
|
+
(children && busy) ? React.createElement("span", null, children) : children,
|
|
20
|
+
busy && (React.createElement("span", { className: SpinnerIndicator },
|
|
21
21
|
React.createElement(Spinner, { dimension: dimension })))));
|
|
22
22
|
});
|
|
23
23
|
export const ButtonsGroup = ({ children, className, kind, dimension = 'regular' }) => (React.createElement("div", { className: clsx(ButtonsGroupClass, className) }, Children.map(children, (child) => cloneElement(child, {
|
|
24
24
|
kind,
|
|
25
25
|
dimension
|
|
26
26
|
}))));
|
|
27
|
-
Button.displayName = 'Button';
|
package/button/button.module.css
CHANGED
|
@@ -46,16 +46,16 @@
|
|
|
46
46
|
/* Types */
|
|
47
47
|
|
|
48
48
|
&[data-button-kind='primary'] {
|
|
49
|
-
background
|
|
49
|
+
background: var(--cta-default);
|
|
50
50
|
color: var(--cta-foreground);
|
|
51
51
|
|
|
52
|
-
&:is(:active) {
|
|
53
|
-
background
|
|
52
|
+
&:not([aria-pressed='true'], [aria-disabled='true']):is(:active) {
|
|
53
|
+
background: var(--cta-dark);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
background
|
|
56
|
+
&:where([aria-pressed='true']),
|
|
57
|
+
&:where([aria-pressed='true']:active) {
|
|
58
|
+
background: hsl(env(--color-red-50));
|
|
59
59
|
color: hsl(env(--color-support-white));
|
|
60
60
|
}
|
|
61
61
|
}
|
|
@@ -66,36 +66,39 @@
|
|
|
66
66
|
|
|
67
67
|
color: var(--global-vibrancy-foreground);
|
|
68
68
|
|
|
69
|
-
&:is(:active) {
|
|
69
|
+
&:not([aria-pressed='true'], [aria-disabled='true']):is(:active) {
|
|
70
70
|
|
|
71
71
|
@mixin vibrancy-hover;
|
|
72
|
+
|
|
73
|
+
color: var(--global-vibrancy-foreground);
|
|
72
74
|
}
|
|
73
75
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
background-color: var(--dimmed-7);
|
|
76
|
+
&:where([aria-pressed='true']),
|
|
77
|
+
&:where([aria-pressed='true']:active) {
|
|
77
78
|
color: var(--dimmed-0);
|
|
79
|
+
background: var(--dimmed-7);
|
|
78
80
|
}
|
|
79
81
|
}
|
|
80
82
|
|
|
81
83
|
&[data-button-kind='flat'] {
|
|
82
|
-
color: var(--global-foreground);
|
|
84
|
+
color: var(--global-vibrancy-foreground);
|
|
83
85
|
|
|
84
|
-
&:is(:active) {
|
|
86
|
+
&:not([aria-pressed='true'], [aria-disabled='true']):is(:active) {
|
|
85
87
|
|
|
86
88
|
@mixin vibrancy-hover;
|
|
87
89
|
}
|
|
88
90
|
|
|
89
|
-
&:is(:hover, :focus)
|
|
91
|
+
&:is(:hover, :focus) {
|
|
90
92
|
|
|
91
93
|
@mixin vibrancy;
|
|
92
94
|
|
|
93
95
|
color: var(--global-vibrancy-foreground);
|
|
94
96
|
}
|
|
95
97
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
98
|
+
&:where([aria-pressed='true']),
|
|
99
|
+
&:where([aria-pressed='true']:is(:active, :focus)) {
|
|
100
|
+
color: var(--dimmed-0);
|
|
101
|
+
background: var(--dimmed-7);
|
|
99
102
|
}
|
|
100
103
|
}
|
|
101
104
|
|
|
@@ -109,15 +112,15 @@
|
|
|
109
112
|
flex-direction: row-reverse;
|
|
110
113
|
}
|
|
111
114
|
|
|
112
|
-
&[
|
|
113
|
-
&[
|
|
115
|
+
&[aria-disabled='true'],
|
|
116
|
+
&[aria-disabled='true']:is(:hover, :focus, :active) {
|
|
114
117
|
|
|
115
118
|
@mixin vibrancy-disabled;
|
|
116
119
|
|
|
117
120
|
cursor: not-allowed;
|
|
118
121
|
}
|
|
119
122
|
|
|
120
|
-
&[
|
|
123
|
+
&[aria-busy='true'] > :not(.SpinnerIndicator) {
|
|
121
124
|
visibility: hidden;
|
|
122
125
|
}
|
|
123
126
|
}
|
package/card/card.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { StackProps, Polymorphic } from '../';
|
|
3
3
|
import { TokensTypes } from '@wonderflow/tokens/platforms/web/types';
|
|
4
|
-
export declare type CardProps =
|
|
4
|
+
export declare type CardProps = Pick<StackProps, 'wrap' | 'columnGap' | 'rowGap' | 'verticalAlign' | 'horizontalAlign'> & {
|
|
5
5
|
padding?: false | TokensTypes['space'];
|
|
6
6
|
left?: ReactNode;
|
|
7
7
|
right?: ReactNode;
|
package/card/card.js
CHANGED
|
@@ -3,12 +3,12 @@ import tkns from '@wonderflow/tokens/platforms/web/tokens.json';
|
|
|
3
3
|
import { Stack } from '../';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import { Card as CardClass, Left, Content, Right } from './card.module.css';
|
|
6
|
-
export const Card = forwardRef(({ as: Wrapper = 'div', children, className, padding = 24, radius = 8, left, right, dimmed, bordered, columnGap = 24, rowGap = 24, verticalAlign = 'start', horizontalAlign = 'space-between', vibrant = false, highlightOnHover = false, wrap, style, ...
|
|
6
|
+
export const Card = forwardRef(({ as: Wrapper = 'div', children, className, padding = 24, radius = 8, left, right, dimmed, bordered, columnGap = 24, rowGap = 24, verticalAlign = 'start', horizontalAlign = 'space-between', vibrant = false, highlightOnHover = false, wrap, style, ...otherProps }, forwardedRef) => {
|
|
7
7
|
const dynamicStyle = {
|
|
8
8
|
'--padding': padding && tkns.space[padding],
|
|
9
9
|
'--radius': radius && tkns.radius[radius]
|
|
10
10
|
};
|
|
11
|
-
return (React.createElement(Wrapper, { ref: forwardedRef, className: clsx(CardClass, className), style: { ...dynamicStyle, ...style }, "data-card-dimmed": dimmed, "data-card-bordered": bordered, "data-card-vibrant": vibrant, "data-card-highlight-hover": highlightOnHover, ...
|
|
11
|
+
return (React.createElement(Wrapper, { ref: forwardedRef, className: clsx(CardClass, className), style: { ...dynamicStyle, ...style }, "data-card-dimmed": dimmed, "data-card-bordered": bordered, "data-card-vibrant": vibrant, "data-card-highlight-hover": highlightOnHover, ...otherProps },
|
|
12
12
|
React.createElement(Stack, { direction: "row", fill: false, verticalAlign: verticalAlign, horizontalAlign: horizontalAlign, columnGap: columnGap, rowGap: rowGap, wrap: wrap },
|
|
13
13
|
left && React.createElement("div", { className: Left }, left),
|
|
14
14
|
children && (React.createElement("div", { className: Content }, children)),
|
package/chip/chip.d.ts
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export declare type ChipProps = PropsWithClass & {
|
|
1
|
+
import React, { PropsWithChildren } from 'react';
|
|
2
|
+
export declare type ChipProps = PropsWithChildren<PropsWithClass> & {
|
|
3
3
|
dimension?: 'small' | 'regular' | 'big';
|
|
4
4
|
color?: 'gray' | 'cyan' | 'green' | 'purple' | 'yellow' | 'red' | 'blue';
|
|
5
5
|
interactive?: boolean;
|
|
6
6
|
onDismissClick?(): void;
|
|
7
7
|
};
|
|
8
|
-
export declare const Chip: React.
|
|
8
|
+
export declare const Chip: React.ForwardRefExoticComponent<PropsWithClass & {
|
|
9
|
+
children?: React.ReactNode;
|
|
10
|
+
} & {
|
|
11
|
+
dimension?: "big" | "small" | "regular" | undefined;
|
|
12
|
+
color?: "gray" | "cyan" | "green" | "purple" | "yellow" | "red" | "blue" | undefined;
|
|
13
|
+
interactive?: boolean | undefined;
|
|
14
|
+
onDismissClick?(): void;
|
|
15
|
+
} & React.RefAttributes<HTMLSpanElement>>;
|
package/chip/chip.js
CHANGED
|
@@ -2,7 +2,7 @@ import clsx from 'clsx';
|
|
|
2
2
|
import React, { forwardRef } from 'react';
|
|
3
3
|
import { Icon, Stack } from '../';
|
|
4
4
|
import { Chip as ChipClass, Action } from './chip.module.css';
|
|
5
|
-
export const Chip = forwardRef(({ children, className, dimension = 'regular', color = 'gray', interactive, onDismissClick, ...
|
|
5
|
+
export const Chip = forwardRef(({ children, className, dimension = 'regular', color = 'gray', interactive, onDismissClick, ...otherProps }, forwardedRef) => {
|
|
6
6
|
const properties = {
|
|
7
7
|
small: {
|
|
8
8
|
iconSize: 14
|
|
@@ -14,7 +14,7 @@ export const Chip = forwardRef(({ children, className, dimension = 'regular', co
|
|
|
14
14
|
iconSize: 16
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
|
-
return (React.createElement(Stack, { as: "span", direction: "row", columnGap: 8, inline: true, "data-chip-color": color, "data-chip-dimension": dimension, className: clsx(ChipClass, className), verticalAlign: "center", ref: forwardedRef, ...
|
|
17
|
+
return (React.createElement(Stack, { as: "span", direction: "row", columnGap: 8, inline: true, "data-chip-color": color, "data-chip-dimension": dimension, className: clsx(ChipClass, className), verticalAlign: "center", ref: forwardedRef, ...otherProps },
|
|
18
18
|
React.createElement("b", null, children),
|
|
19
19
|
interactive && (React.createElement("button", { onClick: interactive && onDismissClick, className: Action, type: "button" },
|
|
20
20
|
React.createElement(Icon, { name: "xmark", dimension: properties[dimension].iconSize })))));
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React, { forwardRef, useCallback } from 'react';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
import { CircularProgress as CircularProgressClass } from './circular-progress.module.css';
|
|
4
|
-
export const CircularProgress = forwardRef(({ className, value, max = 100, dimension = 'regular', showProgress, style, ...
|
|
4
|
+
export const CircularProgress = forwardRef(({ className, value, max = 100, dimension = 'regular', showProgress, style, ...otherProps }, forwardedRef) => {
|
|
5
5
|
const getPercentage = useCallback(() => value ? Math.round((100 * value) / max) : 0, [max, value]);
|
|
6
6
|
const clamp = (num, min, max) => Math.min(Math.max(num, min), max);
|
|
7
7
|
const dynamicStyle = {
|
|
8
8
|
'--progress': `${getPercentage()}%`
|
|
9
9
|
};
|
|
10
|
-
return (React.createElement("div", { ref: forwardedRef, role: "progressbar", "aria-valuenow": value, "aria-valuemin": 0, "aria-valuemax": max, className: clsx(CircularProgressClass, className), "data-circular-progress": clamp(getPercentage(), 0, 100), "data-circular-progress-dimension": dimension, "data-circular-progress-show-progress": showProgress, style: { ...dynamicStyle, ...style }, ...
|
|
10
|
+
return (React.createElement("div", { ref: forwardedRef, role: "progressbar", "aria-valuenow": value, "aria-valuemin": 0, "aria-valuemax": max, className: clsx(CircularProgressClass, className), "data-circular-progress": clamp(getPercentage(), 0, 100), "data-circular-progress-dimension": dimension, "data-circular-progress-show-progress": showProgress, style: { ...dynamicStyle, ...style }, ...otherProps }));
|
|
11
11
|
});
|
|
12
12
|
CircularProgress.displayName = 'CircularProgress';
|
package/clamp-text/clamp-text.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
import { ClampText as ClampTextClass } from './clamp-text.module.css';
|
|
4
|
-
export const ClampText = forwardRef(({ className, children, rows = 1, style, as: Wrapper = 'span', ...
|
|
4
|
+
export const ClampText = forwardRef(({ className, children, rows = 1, style, as: Wrapper = 'span', ...otherProps }, forwardedRef) => {
|
|
5
5
|
const dynamicStyle = {
|
|
6
6
|
'--r': rows
|
|
7
7
|
};
|
|
8
|
-
return (React.createElement(Wrapper, { ref: forwardedRef, style: { ...dynamicStyle, ...style }, className: clsx(ClampTextClass, className), ...
|
|
8
|
+
return (React.createElement(Wrapper, { ref: forwardedRef, style: { ...dynamicStyle, ...style }, className: clsx(ClampTextClass, className), ...otherProps }, children));
|
|
9
9
|
});
|
|
10
|
-
ClampText.displayName = 'ClampText';
|
package/container/container.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react';
|
|
2
2
|
import { Container as ContainerClass } from './container.module.css';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
|
-
export const Container = forwardRef(({ children, className, dimension = 'full', padding = true, as: Wrapper = 'div', ...
|
|
5
|
-
return (React.createElement(Wrapper, { ref: forwardedRef, className: clsx(ContainerClass, className), "data-container-dimension": dimension, "data-container-padding": padding, ...
|
|
4
|
+
export const Container = forwardRef(({ children, className, dimension = 'full', padding = true, as: Wrapper = 'div', ...otherProps }, forwardedRef) => {
|
|
5
|
+
return (React.createElement(Wrapper, { ref: forwardedRef, className: clsx(ContainerClass, className), "data-container-dimension": dimension, "data-container-padding": padding, ...otherProps }, children));
|
|
6
6
|
});
|
|
7
|
-
Container.displayName = 'Container';
|
package/core/typography.css
CHANGED
package/core.css
CHANGED
package/disclosure/disclosure.js
CHANGED
|
@@ -3,7 +3,7 @@ import clsx from 'clsx';
|
|
|
3
3
|
import { Disclosure as DisclosureClass, Summary, ExpandIcon, Content } from './disclosure.module.css';
|
|
4
4
|
import { Text, Icon } from '../';
|
|
5
5
|
import { motion } from 'framer-motion';
|
|
6
|
-
export const Disclosure = forwardRef(({ children, open = false, padding = true, className, summary, contentMaxHeight, dimension = 'regular', iconPosition = 'left', expandable = true, style, ...
|
|
6
|
+
export const Disclosure = forwardRef(({ children, open = false, padding = true, className, summary, contentMaxHeight, dimension = 'regular', iconPosition = 'left', expandable = true, style, ...otherProps }, forwardedRef) => {
|
|
7
7
|
const [isOpen, setIsOpen] = useState(open);
|
|
8
8
|
const handleOpen = useCallback(() => (event) => {
|
|
9
9
|
event.preventDefault();
|
|
@@ -24,8 +24,8 @@ export const Disclosure = forwardRef(({ children, open = false, padding = true,
|
|
|
24
24
|
}
|
|
25
25
|
};
|
|
26
26
|
const renderContent = useCallback(() => (React.createElement(motion.div, { className: Content, "data-disclosure-padding": padding, "data-disclosure-height": Boolean(contentMaxHeight), animate: isOpen ? { y: 5, opacity: 1 } : { y: 0, opacity: 0 }, transition: { ease: 'easeOut', duration: 0.1 }, initial: false }, children)), [children, contentMaxHeight, isOpen, padding]);
|
|
27
|
-
return (React.createElement("details", { style: { ...dynamicStyle, ...style }, className: clsx(DisclosureClass, className), "data-disclosure-icon-position": iconPosition, "data-disclosure-dimension": dimension, "data-disclosure-expandable": expandable, "aria-expanded": isOpen ? 'true' : 'false', open: isOpen, ref: forwardedRef, ...
|
|
28
|
-
React.createElement(Text, { as: "summary", onClick: handleOpen(), className: Summary,
|
|
27
|
+
return (React.createElement("details", { style: { ...dynamicStyle, ...style }, className: clsx(DisclosureClass, className), "data-disclosure-icon-position": iconPosition, "data-disclosure-dimension": dimension, "data-disclosure-expandable": expandable, "aria-expanded": isOpen ? 'true' : 'false', open: isOpen, ref: forwardedRef, ...otherProps },
|
|
28
|
+
React.createElement(Text, { as: "summary", onClick: handleOpen(), className: Summary, "aria-expanded": isOpen, tabIndex: !expandable ? -1 : 0, size: dimension ? sizes[dimension].summary : undefined, weight: "bold" },
|
|
29
29
|
summary,
|
|
30
30
|
expandable && (React.createElement(Icon, { className: ExpandIcon, name: "chevron-right", dimension: dimension !== 'big' ? 16 : 24 }))),
|
|
31
31
|
renderContent()));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { IconNames } from '../icons/types';
|
|
3
3
|
import { Polymorphic } from '../';
|
|
4
|
-
export declare type DropdownItemProps =
|
|
4
|
+
export declare type DropdownItemProps = {
|
|
5
5
|
children: ReactNode;
|
|
6
6
|
icon?: IconNames;
|
|
7
7
|
dimension?: 'small' | 'regular';
|
|
@@ -21,6 +21,6 @@ export const DropdownItem = forwardRef(({ className, children, onClick, icon, di
|
|
|
21
21
|
? (React.createElement(Tooltip, { fill: true, show: focused, placement: "right-start", trigger: InnerContent }, description))
|
|
22
22
|
: InnerContent));
|
|
23
23
|
});
|
|
24
|
-
export const DropdownItemCheckbox = forwardRef(({ children, checked, ...props }, forwardedRef) => React.createElement(DropdownItem, { role: "menuitemcheckbox", "aria-checked": checked, ref: forwardedRef, ...props }, children));
|
|
25
24
|
DropdownItem.displayName = 'Dropdown.Item';
|
|
26
|
-
DropdownItemCheckbox
|
|
25
|
+
export const DropdownItemCheckbox = forwardRef(({ children, checked, ...props }, forwardedRef) => React.createElement(DropdownItem, { role: "menuitemcheckbox", "aria-checked": checked, ref: forwardedRef, ...props }, children));
|
|
26
|
+
DropdownItemCheckbox.displayName = 'Dropdown.ItemCheckbox';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React, { ReactNode } from 'react';
|
|
2
|
-
export declare type DropdownMenuProps =
|
|
1
|
+
import React, { ReactNode, HTMLAttributes } from 'react';
|
|
2
|
+
export declare type DropdownMenuProps = HTMLAttributes<HTMLUListElement> & {
|
|
3
3
|
children: ReactNode;
|
|
4
4
|
};
|
|
5
|
-
export declare const DropdownMenu: React.ForwardRefExoticComponent<
|
|
5
|
+
export declare const DropdownMenu: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLUListElement> & {
|
|
6
6
|
children: ReactNode;
|
|
7
7
|
} & React.RefAttributes<HTMLUListElement>>;
|
|
@@ -3,9 +3,15 @@ import { RovingTabIndexProvider } from 'react-roving-tabindex';
|
|
|
3
3
|
import { Stack, Elevator } from '../';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import { DropdownMenu as DropdownMenuClass } from './dropdown-menu.module.css';
|
|
6
|
-
export const DropdownMenu = forwardRef(({ className, children, ...
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
export const DropdownMenu = forwardRef(({ className, children, ...otherProps }, forwardedRef) => {
|
|
7
|
+
const renderedChildren = Children.toArray(children).filter(Boolean);
|
|
8
|
+
return (React.createElement(Elevator, { resting: 2 },
|
|
9
|
+
React.createElement(Stack, { as: "ul", ref: forwardedRef, className: clsx(DropdownMenuClass, className), role: "menu", ...otherProps },
|
|
10
|
+
React.createElement(RovingTabIndexProvider, { options: { direction: 'vertical', loopAround: true } }, Children.map(renderedChildren, (child, index) => {
|
|
11
|
+
var _a;
|
|
12
|
+
return (React.createElement(Stack, { as: "li", role: "none", verticalPadding: ((_a = child.type) === null || _a === void 0 ? void 0 : _a.displayName) === 'Separator' ? 8 : undefined }, cloneElement(child, {
|
|
13
|
+
autoFocus: index === 0 && true
|
|
14
|
+
})));
|
|
15
|
+
})))));
|
|
16
|
+
});
|
|
11
17
|
DropdownMenu.displayName = 'Dropdown.Menu';
|
package/dropdown/dropdown.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ReactNode, ForwardRefExoticComponent } from 'react';
|
|
2
|
+
import { DropdownMenuProps } from './dropdown-menu';
|
|
3
|
+
import { DropdownItemProps, DropdownItemCheckboxProps } from './dropdown-item';
|
|
2
4
|
import { AutoPlacement, BasePlacement, VariationPlacement } from '@popperjs/core';
|
|
3
5
|
export declare type DropdownProps = PropsWithClass & {
|
|
4
6
|
children: ReactNode;
|
|
@@ -6,22 +8,10 @@ export declare type DropdownProps = PropsWithClass & {
|
|
|
6
8
|
offset?: number;
|
|
7
9
|
placement?: AutoPlacement | BasePlacement | VariationPlacement;
|
|
8
10
|
};
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
} & React.RefAttributes<HTMLUListElement>>;
|
|
14
|
-
Item: import("../polymorphic/polymorphic").ForwardRefComponent<"button", import("./dropdown-item").DropdownItemProps>;
|
|
15
|
-
ItemCheckbox: import("../polymorphic/polymorphic").ForwardRefComponent<"button", PropsWithClass & {
|
|
16
|
-
children: React.ReactNode;
|
|
17
|
-
icon?: import("../icons/types").IconNames | undefined;
|
|
18
|
-
dimension?: "small" | "regular" | undefined;
|
|
19
|
-
onClick?(): void;
|
|
20
|
-
iconPosition?: "left" | "right" | undefined;
|
|
21
|
-
description?: React.ReactNode;
|
|
22
|
-
disabled?: boolean | undefined;
|
|
23
|
-
padding?: boolean | undefined;
|
|
24
|
-
} & {
|
|
25
|
-
checked?: boolean | undefined;
|
|
26
|
-
}>;
|
|
11
|
+
declare type DropdownComponent = ForwardRefExoticComponent<DropdownProps> & {
|
|
12
|
+
Menu: ForwardRefExoticComponent<DropdownMenuProps>;
|
|
13
|
+
Item: ForwardRefExoticComponent<DropdownItemProps>;
|
|
14
|
+
ItemCheckbox: ForwardRefExoticComponent<DropdownItemCheckboxProps>;
|
|
27
15
|
};
|
|
16
|
+
export declare const Dropdown: DropdownComponent;
|
|
17
|
+
export {};
|
package/dropdown/dropdown.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import clsx from 'clsx';
|
|
2
|
-
import React, { useState, Children, cloneElement, useRef } from 'react';
|
|
2
|
+
import React, { useState, Children, cloneElement, useRef, forwardRef } from 'react';
|
|
3
3
|
import { useKey, useClickAway } from 'react-use';
|
|
4
4
|
import { Dropdown as DropdownClass, PopUp } from './dropdown.module.css';
|
|
5
5
|
import { useUIDSeed } from 'react-uid';
|
|
@@ -8,9 +8,10 @@ import { DropdownMenu } from './dropdown-menu';
|
|
|
8
8
|
import { DropdownItem, DropdownItemCheckbox } from './dropdown-item';
|
|
9
9
|
import { usePopperTooltip } from 'react-popper-tooltip';
|
|
10
10
|
import { AnimatePresence, motion } from 'framer-motion';
|
|
11
|
-
export const Dropdown = ({ className, children, trigger, offset = 8, placement = 'auto-start' }) => {
|
|
11
|
+
export const Dropdown = forwardRef(({ className, children, trigger, offset = 8, placement = 'auto-start' }, forwardedRef) => {
|
|
12
|
+
const renderedChildren = Children.toArray(children).filter(Boolean);
|
|
12
13
|
const seedID = useUIDSeed();
|
|
13
|
-
const popupRef = useRef(
|
|
14
|
+
const popupRef = useRef(forwardedRef);
|
|
14
15
|
const [isOpen, setIsOpen] = useState(false);
|
|
15
16
|
const { getTooltipProps, setTooltipRef, setTriggerRef, visible } = usePopperTooltip({
|
|
16
17
|
delayShow: 0,
|
|
@@ -41,11 +42,12 @@ export const Dropdown = ({ className, children, trigger, offset = 8, placement =
|
|
|
41
42
|
'aria-expanded': isOpen
|
|
42
43
|
})),
|
|
43
44
|
React.createElement(AnimatePresence, null, visible && (React.createElement("div", { ref: setTooltipRef, role: "tooltip", id: seedID('tooltip-content'), className: PopUp, ...getTooltipProps({ className: PopUp }) },
|
|
44
|
-
React.createElement(motion.div, { animate: visible ? { y: 5, opacity: 1 } : { y: 0, opacity: 0 }, transition: { ease: 'easeOut', duration: 0.1 } }, Children.map(
|
|
45
|
+
React.createElement(motion.div, { animate: visible ? { y: 5, opacity: 1 } : { y: 0, opacity: 0 }, transition: { ease: 'easeOut', duration: 0.1 } }, Children.map(renderedChildren, (child) => cloneElement(child, {
|
|
45
46
|
id: seedID('dropdown-menu'),
|
|
46
47
|
'aria-labelledby': seedID('dropdown-trigger')
|
|
47
48
|
}))))))));
|
|
48
|
-
};
|
|
49
|
+
});
|
|
50
|
+
Dropdown.displayName = 'Dropdown';
|
|
49
51
|
Dropdown.Menu = DropdownMenu;
|
|
50
52
|
Dropdown.Item = DropdownItem;
|
|
51
53
|
Dropdown.ItemCheckbox = DropdownItemCheckbox;
|
package/elevator/elevator.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { FC, ReactElement } from 'react';
|
|
2
2
|
export declare type ElevatorProps = {
|
|
3
3
|
resting: 0 | 1 | 2 | 3 | 4;
|
|
4
4
|
hover?: 0 | 1 | 2 | 3 | 4;
|
|
5
5
|
children: ReactElement;
|
|
6
6
|
};
|
|
7
|
-
export declare const Elevator:
|
|
7
|
+
export declare const Elevator: FC<ElevatorProps>;
|
package/grid/grid-item.d.ts
CHANGED
|
@@ -4,4 +4,8 @@ export declare type GridItemProps = PropsWithClass & {
|
|
|
4
4
|
column?: string;
|
|
5
5
|
row?: string;
|
|
6
6
|
};
|
|
7
|
-
export declare const GridItem: React.
|
|
7
|
+
export declare const GridItem: React.ForwardRefExoticComponent<PropsWithClass & {
|
|
8
|
+
fullWidth?: boolean | undefined;
|
|
9
|
+
column?: string | undefined;
|
|
10
|
+
row?: string | undefined;
|
|
11
|
+
} & React.RefAttributes<HTMLLIElement>>;
|
package/grid/grid-item.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { forwardRef } from 'react';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
import { GridItem as GridItemClass } from './grid.module.css';
|
|
4
|
-
export const GridItem = ({ children, style, className, fullWidth = false, column, row, ...
|
|
4
|
+
export const GridItem = forwardRef(({ children, style, className, fullWidth = false, column, row, ...otherProps }, forwardedRef) => {
|
|
5
5
|
const dynamicStyle = {
|
|
6
6
|
'--column': column,
|
|
7
7
|
'--row': row
|
|
8
8
|
};
|
|
9
|
-
return (React.createElement("li", { className: clsx(GridItemClass, className), style: { ...dynamicStyle, ...style }, "data-grid-item-fullwidth": fullWidth, ...
|
|
10
|
-
};
|
|
9
|
+
return (React.createElement("li", { ref: forwardedRef, className: clsx(GridItemClass, className), style: { ...dynamicStyle, ...style }, "data-grid-item-fullwidth": fullWidth, ...otherProps }, children));
|
|
10
|
+
});
|
|
11
|
+
GridItem.displayName = 'Grid.Item';
|
package/grid/grid.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
2
|
import { TokensTypes } from '@wonderflow/tokens/platforms/web/types';
|
|
3
|
+
import { GridItemProps } from './grid-item';
|
|
3
4
|
export declare type GridProps = PropsWithClass & {
|
|
4
5
|
children: ReactNode;
|
|
5
6
|
columns?: number;
|
|
@@ -10,25 +11,8 @@ export declare type GridProps = PropsWithClass & {
|
|
|
10
11
|
colMinWidth?: string;
|
|
11
12
|
rowMinHeight?: string;
|
|
12
13
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
columns?: number | undefined;
|
|
16
|
-
rows?: number | undefined;
|
|
17
|
-
rowGap?: 0 | 24 | 16 | 32 | 40 | 48 | 56 | 2 | 4 | 8 | 64 | 72 | 80 | 88 | 96 | 104 | 112 | 120 | 128 | 136 | 144 | 152 | 160 | 168 | 176 | 184 | 192 | 200 | undefined;
|
|
18
|
-
columnGap?: 0 | 24 | 16 | 32 | 40 | 48 | 56 | 2 | 4 | 8 | 64 | 72 | 80 | 88 | 96 | 104 | 112 | 120 | 128 | 136 | 144 | 152 | 160 | 168 | 176 | 184 | 192 | 200 | undefined;
|
|
19
|
-
filling?: false | "fill" | "fit" | undefined;
|
|
20
|
-
colMinWidth?: string | undefined;
|
|
21
|
-
rowMinHeight?: string | undefined;
|
|
22
|
-
} & React.RefAttributes<HTMLUListElement>>;
|
|
23
|
-
export declare const GridRoot: React.ForwardRefExoticComponent<PropsWithClass & {
|
|
24
|
-
children: ReactNode;
|
|
25
|
-
columns?: number | undefined;
|
|
26
|
-
rows?: number | undefined;
|
|
27
|
-
rowGap?: 0 | 24 | 16 | 32 | 40 | 48 | 56 | 2 | 4 | 8 | 64 | 72 | 80 | 88 | 96 | 104 | 112 | 120 | 128 | 136 | 144 | 152 | 160 | 168 | 176 | 184 | 192 | 200 | undefined;
|
|
28
|
-
columnGap?: 0 | 24 | 16 | 32 | 40 | 48 | 56 | 2 | 4 | 8 | 64 | 72 | 80 | 88 | 96 | 104 | 112 | 120 | 128 | 136 | 144 | 152 | 160 | 168 | 176 | 184 | 192 | 200 | undefined;
|
|
29
|
-
filling?: false | "fill" | "fit" | undefined;
|
|
30
|
-
colMinWidth?: string | undefined;
|
|
31
|
-
rowMinHeight?: string | undefined;
|
|
32
|
-
} & React.RefAttributes<HTMLUListElement>> & {
|
|
33
|
-
Item: React.FC<import("./grid-item").GridItemProps>;
|
|
14
|
+
declare type GridComponent = React.ForwardRefExoticComponent<GridProps> & {
|
|
15
|
+
Item: React.ForwardRefExoticComponent<GridItemProps>;
|
|
34
16
|
};
|
|
17
|
+
export declare const Grid: GridComponent;
|
|
18
|
+
export {};
|
package/grid/grid.js
CHANGED
|
@@ -3,7 +3,7 @@ import clsx from 'clsx';
|
|
|
3
3
|
import tksn from '@wonderflow/tokens/platforms/web/tokens.json';
|
|
4
4
|
import { GridItem } from './grid-item';
|
|
5
5
|
import { Grid as GridClass } from './grid.module.css';
|
|
6
|
-
export const Grid = forwardRef(({ className, children, columns, rows, rowGap = 8, columnGap = 8, style, filling = 'fill', colMinWidth = '10rem', rowMinHeight = '1fr', ...
|
|
6
|
+
export const Grid = forwardRef(({ className, children, columns, rows, rowGap = 8, columnGap = 8, style, filling = 'fill', colMinWidth = '10rem', rowMinHeight = '1fr', ...otherProps }, forwardedRef) => {
|
|
7
7
|
const computedStyle = {
|
|
8
8
|
'--rGap': rowGap && tksn.space[rowGap],
|
|
9
9
|
'--cGap': columnGap && tksn.space[columnGap],
|
|
@@ -12,7 +12,7 @@ export const Grid = forwardRef(({ className, children, columns, rows, rowGap = 8
|
|
|
12
12
|
'--rows': rows,
|
|
13
13
|
'--row-min-h': rowMinHeight
|
|
14
14
|
};
|
|
15
|
-
return (React.createElement("ul", { className: clsx(GridClass, className), style: { ...computedStyle, ...style }, "data-grid-filling-type": filling, ref: forwardedRef, ...
|
|
15
|
+
return (React.createElement("ul", { className: clsx(GridClass, className), style: { ...computedStyle, ...style }, "data-grid-filling-type": filling, ref: forwardedRef, ...otherProps }, children));
|
|
16
16
|
});
|
|
17
17
|
Grid.displayName = 'Grid';
|
|
18
|
-
|
|
18
|
+
Grid.Item = GridItem;
|
package/grid/index.d.ts
CHANGED
package/grid/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { Grid } from './grid';
|
package/icon/icon.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react';
|
|
2
2
|
import sprite from '../icons/all.svg';
|
|
3
|
-
export const Icon = forwardRef(({ className, name, dimension = 16, fill, ...
|
|
3
|
+
export const Icon = forwardRef(({ className, name, dimension = 16, fill, ...otherProps }, forwardedRef) => {
|
|
4
4
|
const computedSize = dimension < 24 ? 16 : 24;
|
|
5
|
-
return (React.createElement("svg", { "aria-hidden": "true", width: dimension, height: dimension, fill: fill, className: className, ref: forwardedRef, ...
|
|
5
|
+
return (React.createElement("svg", { "aria-hidden": "true", width: dimension, height: dimension, fill: fill, className: className, ref: forwardedRef, ...otherProps },
|
|
6
6
|
React.createElement("use", { href: `${sprite}#${computedSize}/${name}` })));
|
|
7
7
|
});
|
|
8
8
|
Icon.displayName = 'Icon';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Button, ButtonProps, Polymorphic } from '../';
|
|
2
|
-
export declare type IconButtonProps =
|
|
2
|
+
export declare type IconButtonProps = Pick<ButtonProps, 'kind' | 'dimension' | 'icon' | 'disabled' | 'onClick' | 'busy'>;
|
|
3
3
|
declare type PolymorphicIconButton = Polymorphic.ForwardRefComponent<Polymorphic.IntrinsicElement<typeof Button>, Polymorphic.OwnProps<typeof Button> & IconButtonProps>;
|
|
4
4
|
export declare const IconButton: PolymorphicIconButton;
|
|
5
5
|
export {};
|
|
@@ -2,5 +2,4 @@ import React, { forwardRef } from 'react';
|
|
|
2
2
|
import { IconButton as IconButtonClass } from './icon-button.module.css';
|
|
3
3
|
import { Button } from '../';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
|
-
export const IconButton = forwardRef(({ className, icon, dimension, kind, disabled,
|
|
6
|
-
IconButton.displayName = 'IconButton';
|
|
5
|
+
export const IconButton = forwardRef(({ className, icon, dimension, kind, disabled, busy, ...otherProps }, forwardedRef) => (React.createElement(Button, { ref: forwardedRef, icon: icon, dimension: dimension, kind: kind, disabled: disabled, busy: busy, className: clsx(IconButtonClass, className), ...otherProps })));
|