@wonderflow/react-components 5.6.0 → 6.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/dist/components/autocomplete/autocomplete.js +2 -2
- package/dist/components/button/button.d.ts.map +1 -1
- package/dist/components/button/button.js +2 -2
- package/dist/components/card/card.d.ts +1 -1
- package/dist/components/card/card.d.ts.map +1 -1
- package/dist/components/card/card.js +2 -2
- package/dist/components/chip/chip.js +1 -1
- package/dist/components/drawer/drawer.js +1 -1
- package/dist/components/dropdown/dropdown.d.ts +28 -0
- package/dist/components/dropdown/dropdown.d.ts.map +1 -1
- package/dist/components/dropdown/dropdown.js +13 -8
- package/dist/components/elevator/elevator.d.ts.map +1 -1
- package/dist/components/elevator/elevator.js +2 -2
- package/dist/components/info-state/info-state.js +1 -1
- package/dist/components/input-group/input-group.d.ts.map +1 -1
- package/dist/components/input-group/input-group.js +4 -4
- package/dist/components/list/list.js +1 -1
- package/dist/components/masonry/masonry.d.ts.map +1 -1
- package/dist/components/masonry/masonry.js +2 -2
- package/dist/components/menu/menu-item/menu-item.js +1 -1
- package/dist/components/menu/menu.js +1 -1
- package/dist/components/modal/content/modal-content.js +1 -1
- package/dist/components/select/select.js +1 -1
- package/dist/components/slider/slider.js +1 -1
- package/dist/components/snackbar/snackbar.js +1 -1
- package/dist/components/stack/stack.d.ts +4 -4
- package/dist/components/stack/stack.d.ts.map +1 -1
- package/dist/components/stack/stack.js +6 -6
- package/dist/components/star-meter/star-meter.js +1 -1
- package/dist/components/tab/tab-item.js +1 -1
- package/dist/components/tab/tab.d.ts.map +1 -1
- package/dist/components/tab/tab.js +2 -3
- package/dist/components/table/table-header/table-header.js +1 -1
- package/dist/components/table/table-pagination/table-pagination.js +1 -1
- package/dist/components/table/table.js +2 -2
- package/dist/components/textfield/textfield.d.ts.map +1 -1
- package/dist/components/textfield/textfield.js +2 -2
- package/dist/components/tooltip/tooltip.d.ts.map +1 -1
- package/dist/components/tooltip/tooltip.js +4 -3
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { AnimatePresence, motion } from 'framer-motion';
|
|
3
3
|
import { AutocompleteOption } from './autocomplete-option';
|
|
4
|
-
import { Children, cloneElement, forwardRef, useCallback, useMemo, useRef, useState, useEffect } from 'react';
|
|
4
|
+
import { Children, cloneElement, forwardRef, useCallback, useMemo, useRef, useState, useEffect, isValidElement } from 'react';
|
|
5
5
|
import { useDebounce, useFocusWithin, useKeyPress, useSize } from 'ahooks';
|
|
6
6
|
import { Text, Menu, Textfield } from '../..';
|
|
7
7
|
import styles from './autocomplete.module.css';
|
|
@@ -73,7 +73,7 @@ export const Autocomplete = forwardRef(({ children, onChange, disabled, readOnly
|
|
|
73
73
|
}, [value]);
|
|
74
74
|
return (_jsxs("div", { ref: autocompleteRef, className: styles.Autocomplete, "data-focus-within": isFocusWithin, children: [_jsx(Textfield, { ref: setTriggerRef, id: seedID('autocomplete-trigger'), "aria-haspopup": "true", "aria-controls": seedID('autocomplete-menu'), "aria-expanded": isOpen, onChange: handleFilter, value: content, autoComplete: "off", disabled: disabled, readOnly: readOnly, ...otherProps }, seedID('autocomplete-trigger')), _jsx(AnimatePresence, { children: visible && (_jsx("div", { ref: setTooltipRef, ...getTooltipProps({ className: styles.PopUp, style: { minInlineSize: triggerSize ? (triggerSize.width + 2) : 'auto' } }), children: _jsx(motion.div, { variants: AutocompleteAnimation, initial: "hidden", animate: "visible", exit: "hidden", children: _jsx(Menu, { role: "listbox", id: seedID('autocomplete-menu'), className: styles.OptionsList, style: dynamicStyle, "aria-labelledby": seedID('autocomplete-trigger'), children: filteredOptions.length === 0
|
|
75
75
|
? _jsx(Text, { as: "div", textAlign: "center", dimmed: 5, children: emptyMessage }, void 0)
|
|
76
|
-
: Children.map(filteredOptions, (child) => cloneElement(child, {
|
|
76
|
+
: Children.map(filteredOptions, (child) => isValidElement(child) && cloneElement(child, {
|
|
77
77
|
onClick: handleOptionClick
|
|
78
78
|
})) }, void 0) }, void 0) }, void 0)) }, void 0)] }, void 0));
|
|
79
79
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../src/components/button/button.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAsC,UAAU,
|
|
1
|
+
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../src/components/button/button.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAsC,UAAU,EAA+B,MAAM,OAAO,CAAA;AACvG,OAAO,EAAQ,SAAS,EAAE,WAAW,EAAW,MAAM,cAAc,CAAA;AAGpE,oBAAY,WAAW,GAAG;IACxB;;;OAGG;IACH,IAAI,CAAC,EAAE,SAAS,GAAG,WAAW,GAAG,MAAM,CAAC;IACxC;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,KAAK,CAAC;IACxC;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;IAC3B;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAChC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,IAAI,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAC;IACrC;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,OAAO,CAAC,CAAC,KAAK,EAAE,UAAU,CAAC,iBAAiB,GAAG,iBAAiB,CAAC,GAAG,IAAI,CAAC;CAC1E,CAAA;AAED,aAAK,iBAAiB,GAAG,WAAW,CAAC,mBAAmB,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;AAEhF,eAAO,MAAM,MAAM,mBA+DI,CAAA;AAEvB,oBAAY,iBAAiB,GAAG,cAAc,GAAG,IAAI,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,CAAC,CAAA;AAExF,eAAO,MAAM,YAAY,EAAE,EAAE,CAAC,iBAAiB,CAe9C,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import clsx from 'clsx';
|
|
3
|
-
import { Children, cloneElement, forwardRef, useCallback } from 'react';
|
|
3
|
+
import { Children, cloneElement, forwardRef, useCallback, isValidElement } from 'react';
|
|
4
4
|
import { Icon, Spinner } from '../..';
|
|
5
5
|
import styles from './button.module.css';
|
|
6
6
|
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) => {
|
|
@@ -17,7 +17,7 @@ export const Button = forwardRef(({ kind = 'primary', dimension = 'regular', cla
|
|
|
17
17
|
};
|
|
18
18
|
return (_jsxs(Wrapper, { ref: forwardedRef, type: Wrapper === 'button' ? type : undefined, className: clsx(styles.Button, 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, children: [icon && (_jsx(Icon, { source: icon, fill: iconColor, dimension: iconSize[dimension] }, void 0)), (children && busy) ? _jsx("span", { children: children }, void 0) : children, busy && (_jsx("span", { className: styles.SpinnerIndicator, children: _jsx(Spinner, { dimension: dimension }, void 0) }, void 0))] }, void 0));
|
|
19
19
|
});
|
|
20
|
-
export const ButtonsGroup = ({ children, className, kind, dimension = 'regular' }) => (_jsx("div", { className: clsx(styles.ButtonsGroup, className), children: Children.map(children, (child) => cloneElement(child, {
|
|
20
|
+
export const ButtonsGroup = ({ children, className, kind, dimension = 'regular' }) => (_jsx("div", { className: clsx(styles.ButtonsGroup, className), children: Children.map(children, (child) => isValidElement(child) && cloneElement(child, {
|
|
21
21
|
kind,
|
|
22
22
|
dimension
|
|
23
23
|
})) }, void 0));
|
|
@@ -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';
|
|
4
|
-
export declare type CardProps = Pick<StackProps, 'wrap' | 'columnGap' | 'rowGap' | '
|
|
4
|
+
export declare type CardProps = Pick<StackProps, 'wrap' | 'columnGap' | 'rowGap' | 'vAlign' | 'hAlign'> & {
|
|
5
5
|
/**
|
|
6
6
|
* Set the padding on each side of the card.
|
|
7
7
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../../../src/components/card/card.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA6B,SAAS,EAAE,MAAM,OAAO,CAAA;AAE5D,OAAO,EAAS,UAAU,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAI7D,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAA;AAE9D,oBAAY,SAAS,GAAG,IAAI,CAC5B,UAAU,EACR,MAAM,GAAG,WAAW,GAAG,QAAQ,GAAG,
|
|
1
|
+
{"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../../../src/components/card/card.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA6B,SAAS,EAAE,MAAM,OAAO,CAAA;AAE5D,OAAO,EAAS,UAAU,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAI7D,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAA;AAE9D,oBAAY,SAAS,GAAG,IAAI,CAC5B,UAAU,EACR,MAAM,GAAG,WAAW,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC,GACpD;IACF;;OAEG;IACH,OAAO,CAAC,EAAE,KAAK,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;IACvC;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC;IACvC;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACnB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAA;AAED,aAAK,eAAe,GAAG,WAAW,CAAC,mBAAmB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;AAEzE,eAAO,MAAM,IAAI,iBA6DI,CAAA"}
|
|
@@ -4,10 +4,10 @@ import tkns from '@wonderflow/tokens/platforms/web/tokens.json';
|
|
|
4
4
|
import { Stack } from '../..';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
import styles from './card.module.css';
|
|
7
|
-
export const Card = forwardRef(({ as: Wrapper = 'div', children, className, padding = 24, radius = 8, left, right, dimmed, bordered, columnGap = 24, rowGap = 24,
|
|
7
|
+
export const Card = forwardRef(({ as: Wrapper = 'div', children, className, padding = 24, radius = 8, left, right, dimmed, bordered, columnGap = 24, rowGap = 24, vAlign = 'start', hAlign = 'space-between', vibrant = false, highlightOnHover = false, wrap, style, ...otherProps }, forwardedRef) => {
|
|
8
8
|
const dynamicStyle = {
|
|
9
9
|
'--padding': padding && tkns.space[padding],
|
|
10
10
|
'--radius': radius && tkns.radius[radius]
|
|
11
11
|
};
|
|
12
|
-
return (_jsx(Wrapper, { ref: forwardedRef, className: clsx(styles.Card, className), style: { ...dynamicStyle, ...style }, "data-card-dimmed": dimmed, "data-card-bordered": bordered, "data-card-vibrant": vibrant, "data-card-highlight-hover": highlightOnHover, ...otherProps, children: _jsxs(Stack, { direction: "row", fill: false,
|
|
12
|
+
return (_jsx(Wrapper, { ref: forwardedRef, className: clsx(styles.Card, className), style: { ...dynamicStyle, ...style }, "data-card-dimmed": dimmed, "data-card-bordered": bordered, "data-card-vibrant": vibrant, "data-card-highlight-hover": highlightOnHover, ...otherProps, children: _jsxs(Stack, { direction: "row", fill: false, vAlign: vAlign, hAlign: hAlign, columnGap: columnGap, rowGap: rowGap, wrap: wrap, children: [left && _jsx("div", { className: styles.Left, children: left }, void 0), children && (_jsx("div", { className: styles.Content, children: children }, void 0)), right && (_jsx("div", { className: styles.Right, children: right }, void 0))] }, void 0) }, void 0));
|
|
13
13
|
});
|
|
@@ -18,6 +18,6 @@ export const Chip = forwardRef(({ children, className, dimension = 'regular', co
|
|
|
18
18
|
style: 'outline'
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
|
-
return (_jsxs(Stack, { as: "span", direction: "row", columnGap: 8, inline: true, "data-chip-color": color, "data-chip-dimension": dimension, className: clsx(styles.Chip, className),
|
|
21
|
+
return (_jsxs(Stack, { as: "span", direction: "row", columnGap: 8, inline: true, "data-chip-color": color, "data-chip-dimension": dimension, className: clsx(styles.Chip, className), vAlign: "center", ref: forwardedRef, ...otherProps, children: [_jsx("b", { children: children }, void 0), interactive && (_jsx("button", { onClick: interactive && onDismissClick, className: styles.Action, type: "button", children: _jsx(Icon, { source: "xmark", weight: properties[dimension].style, dimension: properties[dimension].iconSize }, void 0) }, void 0))] }, void 0));
|
|
22
22
|
});
|
|
23
23
|
Chip.displayName = 'Chip';
|
|
@@ -28,6 +28,6 @@ export const Drawer = forwardRef(({ children, className, closeOnClickOutside = t
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
|
-
return (_jsx("div", { role: "dialog", "aria-modal": isModal, "data-theme": theme, "aria-labelledby": titleId, className: clsx(styles.Drawer, className), ref: forwardedRef, ...otherProps, children: _jsx(FocusOn, { enabled: isModal, onClickOutside: closeOnClickOutside ? onClose : undefined, onEscapeKey: onClose, children: _jsx(motion.div, { variants: DrawerAnimation, initial: "hidden", animate: "visible", exit: "hidden", className: styles.Container, "data-drawer-side": side, children: _jsx(Elevator, { resting: 4, children: _jsxs("div", { className: styles.Content, style: dynamicStyle, ref: forwardedRef, ...otherProps, children: [(showHeader && title) && (_jsxs(Stack, {
|
|
31
|
+
return (_jsx("div", { role: "dialog", "aria-modal": isModal, "data-theme": theme, "aria-labelledby": titleId, className: clsx(styles.Drawer, className), ref: forwardedRef, ...otherProps, children: _jsx(FocusOn, { enabled: isModal, onClickOutside: closeOnClickOutside ? onClose : undefined, onEscapeKey: onClose, children: _jsx(motion.div, { variants: DrawerAnimation, initial: "hidden", animate: "visible", exit: "hidden", className: styles.Container, "data-drawer-side": side, children: _jsx(Elevator, { resting: 4, children: _jsxs("div", { className: styles.Content, style: dynamicStyle, ref: forwardedRef, ...otherProps, children: [(showHeader && title) && (_jsxs(Stack, { vAlign: "center", fill: false, hAlign: "space-between", direction: "row", className: styles.Header, children: [_jsx(Title, { responsive: false, level: "6", id: titleId, children: title }, void 0), onClose && _jsx(IconButton, { onClick: onClose, className: styles.CloseButton, icon: "xmark", kind: "flat" }, void 0)] }, void 0)), _jsx(AutoFocusInside, { children: children }, void 0)] }, void 0) }, void 0) }, void 0) }, void 0) }, void 0));
|
|
32
32
|
});
|
|
33
33
|
Drawer.displayName = 'Drawer';
|
|
@@ -27,6 +27,20 @@ export declare type DropdownProps = PropsWithClass & {
|
|
|
27
27
|
* Enable or disable the itneraction on the trigger.
|
|
28
28
|
*/
|
|
29
29
|
disabled?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Calllback triggered when the dropdown state changes.
|
|
32
|
+
* It returns the new `boolean` state.
|
|
33
|
+
*/
|
|
34
|
+
onOpenChange?: (open: boolean) => void;
|
|
35
|
+
/**
|
|
36
|
+
* Programmatically open or close the dropdown. If set to `true`, the dropdown
|
|
37
|
+
* will be open when rendered. This make the dropdown a controlled component.
|
|
38
|
+
*/
|
|
39
|
+
open?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Enable or disable the auto close of the dropdown when clicking outside of it.
|
|
42
|
+
*/
|
|
43
|
+
closeOnOutsideClick?: boolean;
|
|
30
44
|
};
|
|
31
45
|
export declare const Dropdown: import("react").ForwardRefExoticComponent<PropsWithClass & {
|
|
32
46
|
/**
|
|
@@ -55,5 +69,19 @@ export declare const Dropdown: import("react").ForwardRefExoticComponent<PropsWi
|
|
|
55
69
|
* Enable or disable the itneraction on the trigger.
|
|
56
70
|
*/
|
|
57
71
|
disabled?: boolean | undefined;
|
|
72
|
+
/**
|
|
73
|
+
* Calllback triggered when the dropdown state changes.
|
|
74
|
+
* It returns the new `boolean` state.
|
|
75
|
+
*/
|
|
76
|
+
onOpenChange?: ((open: boolean) => void) | undefined;
|
|
77
|
+
/**
|
|
78
|
+
* Programmatically open or close the dropdown. If set to `true`, the dropdown
|
|
79
|
+
* will be open when rendered. This make the dropdown a controlled component.
|
|
80
|
+
*/
|
|
81
|
+
open?: boolean | undefined;
|
|
82
|
+
/**
|
|
83
|
+
* Enable or disable the auto close of the dropdown when clicking outside of it.
|
|
84
|
+
*/
|
|
85
|
+
closeOnOutsideClick?: boolean | undefined;
|
|
58
86
|
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
59
87
|
//# sourceMappingURL=dropdown.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown.d.ts","sourceRoot":"","sources":["../../../src/components/dropdown/dropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,
|
|
1
|
+
{"version":3,"file":"dropdown.d.ts","sourceRoot":"","sources":["../../../src/components/dropdown/dropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAQV,MAAM,OAAO,CAAA;AAId,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAKjF,oBAAY,aAAa,GAAG,cAAc,GAAG;IAC3C;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,OAAO,EAAE,SAAS,CAAC;IACnB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,aAAa,GAAG,aAAa,GAAG,kBAAkB,CAAC;IAC/D;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;OAEG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B,CAAA;AAqBD,eAAO,MAAM,QAAQ;IA7DnB;;OAEG;cACO,SAAS;IACnB;;OAEG;aACM,SAAS;IAClB;;OAEG;;IAEH;;;;;;;;OAQG;;IAEH;;OAEG;;IAEH;;;OAGG;2BACmB,OAAO,KAAK,IAAI;IACtC;;;OAGG;;IAEH;;OAEG;;kDAwHH,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState, Children, cloneElement, useRef, forwardRef } from 'react';
|
|
2
|
+
import { useState, Children, cloneElement, useRef, forwardRef, isValidElement, useEffect } from 'react';
|
|
3
3
|
import { useKeyPress, useFocusWithin } from 'ahooks';
|
|
4
4
|
import styles from './dropdown.module.css';
|
|
5
5
|
import { useUIDSeed } from 'react-uid';
|
|
@@ -24,8 +24,7 @@ const DropdownAnimation = {
|
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
|
-
export const Dropdown = forwardRef(({ children, trigger, offset = 8, placement = 'auto-start', disabled, className, ...otherProps }, forwardedRef) => {
|
|
28
|
-
const renderedChildren = Children.toArray(children).filter(Boolean);
|
|
27
|
+
export const Dropdown = forwardRef(({ children, trigger, offset = 8, placement = 'auto-start', open, disabled, closeOnOutsideClick = true, className, onOpenChange, ...otherProps }, forwardedRef) => {
|
|
29
28
|
const seedID = useUIDSeed();
|
|
30
29
|
const dropdownRef = useRef(forwardedRef);
|
|
31
30
|
const [isOpen, setIsOpen] = useState(false);
|
|
@@ -35,10 +34,13 @@ export const Dropdown = forwardRef(({ children, trigger, offset = 8, placement =
|
|
|
35
34
|
trigger: !disabled ? ['click'] : null,
|
|
36
35
|
visible: isOpen,
|
|
37
36
|
closeOnTriggerHidden: true,
|
|
38
|
-
|
|
37
|
+
closeOnOutsideClick,
|
|
38
|
+
onVisibleChange: state => {
|
|
39
|
+
onOpenChange?.(state);
|
|
40
|
+
setIsOpen(state);
|
|
41
|
+
},
|
|
39
42
|
placement: placement,
|
|
40
|
-
offset: [0, offset]
|
|
41
|
-
closeOnOutsideClick: true
|
|
43
|
+
offset: [0, offset]
|
|
42
44
|
});
|
|
43
45
|
const isFocusWithin = useFocusWithin(dropdownRef, {
|
|
44
46
|
onBlur: (e) => {
|
|
@@ -48,7 +50,10 @@ export const Dropdown = forwardRef(({ children, trigger, offset = 8, placement =
|
|
|
48
50
|
}
|
|
49
51
|
});
|
|
50
52
|
useKeyPress('esc', () => setIsOpen(false));
|
|
51
|
-
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
open !== undefined && setIsOpen(open);
|
|
55
|
+
}, [open]);
|
|
56
|
+
return (_jsxs("div", { ref: dropdownRef, className: clsx(styles.Dropdown, className), "data-dropdown-has-focus": isFocusWithin, children: [Children.map(trigger, (child) => isValidElement(child) && cloneElement(child, {
|
|
52
57
|
ref: setTriggerRef,
|
|
53
58
|
id: seedID('dropdown-trigger'),
|
|
54
59
|
key: seedID('dropdown-trigger'),
|
|
@@ -56,7 +61,7 @@ export const Dropdown = forwardRef(({ children, trigger, offset = 8, placement =
|
|
|
56
61
|
'aria-controls': seedID('dropdown-menu'),
|
|
57
62
|
'aria-expanded': isOpen,
|
|
58
63
|
...otherProps
|
|
59
|
-
})), _jsx(AnimatePresence, { children: visible && (_jsx("div", { ref: setTooltipRef, role: "tooltip", id: seedID('tooltip-content'), ...getTooltipProps({ className: styles.PopUp }), children: _jsx(motion.div, { variants: DropdownAnimation, initial: "hidden", animate: "visible", exit: "hidden", children: Children.map(
|
|
64
|
+
})), _jsx(AnimatePresence, { children: visible && (_jsx("div", { ref: setTooltipRef, role: "tooltip", id: seedID('tooltip-content'), ...getTooltipProps({ className: styles.PopUp }), children: _jsx(motion.div, { variants: DropdownAnimation, initial: "hidden", animate: "visible", exit: "hidden", children: Children.map(children, (child) => isValidElement(child) && cloneElement(child, {
|
|
60
65
|
id: seedID('dropdown-menu'),
|
|
61
66
|
'aria-labelledby': seedID('dropdown-trigger')
|
|
62
67
|
})) }, void 0) }, seedID('tooltip-content'))) }, void 0)] }, void 0));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"elevator.d.ts","sourceRoot":"","sources":["../../../src/components/elevator/elevator.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAoC,YAAY,
|
|
1
|
+
{"version":3,"file":"elevator.d.ts","sourceRoot":"","sources":["../../../src/components/elevator/elevator.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAoC,YAAY,EAAkB,MAAM,OAAO,CAAA;AAE1F,oBAAY,aAAa,GAAG;IAC1B;;MAEE;IACF,OAAO,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC3B;;OAEG;IACH,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC1B;;;;OAIG;IACH,QAAQ,EAAE,YAAY,CAAC;CACxB,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,EAAE,CAAC,aAAa,CAgBtC,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Fragment, Children, cloneElement } from 'react';
|
|
2
|
+
import { Fragment, Children, cloneElement, isValidElement } from 'react';
|
|
3
3
|
export const Elevator = ({ children, resting, hover }) => {
|
|
4
|
-
return (_jsx(Fragment, { children: Children.map(children, (child) => cloneElement(child, {
|
|
4
|
+
return (_jsx(Fragment, { children: Children.map(children, (child) => isValidElement(child) && cloneElement(child, {
|
|
5
5
|
'data-elevation': resting,
|
|
6
6
|
'data-elevation-hover': hover
|
|
7
7
|
})) }, void 0));
|
|
@@ -4,6 +4,6 @@ import { Stack, Icon, Title, Text } from '../..';
|
|
|
4
4
|
import styles from './info-state.module.css';
|
|
5
5
|
export const InfoState = forwardRef(({ className, children, title, icon, image, direction = 'column', iconColor = 'blue', actions, ...otherProps }, forwardedRef) => {
|
|
6
6
|
const isHorizontal = direction === 'row';
|
|
7
|
-
return (_jsxs(Stack, { ref: forwardedRef, direction: direction, rowGap: 24, columnGap: 32, className: className,
|
|
7
|
+
return (_jsxs(Stack, { ref: forwardedRef, direction: direction, rowGap: 24, columnGap: 32, className: className, hAlign: isHorizontal ? 'start' : 'center', vAlign: (isHorizontal && image) ? 'center' : 'start', fill: false, wrap: !!image, ...otherProps, children: [(!image && icon) && (_jsx("span", { "data-info-state-icon-color": iconColor, className: styles.IconWrapper, children: _jsx(Icon, { source: icon, dimension: 48 }, void 0) }, void 0)), (image && !icon) && _jsx("img", { className: styles.Image, alt: "", width: "400", src: image, loading: "lazy", decoding: "async" }, void 0), _jsxs(Stack, { rowGap: 16, hAlign: isHorizontal ? 'start' : 'center', vAlign: "center", fill: false, children: [_jsx(Title, { maxWidth: "20ch", textAlign: isHorizontal ? 'start' : 'center', level: "4", children: title }, void 0), _jsx(Text, { maxWidth: "60ch", dimmed: 6, textAlign: isHorizontal ? 'start' : 'center', children: children }, void 0), actions && (_jsx(Stack, { vPadding: 16, inline: true, direction: "row", columnGap: 16, rowGap: 16, wrap: true, children: actions }, void 0))] }, void 0)] }, void 0));
|
|
8
8
|
});
|
|
9
9
|
InfoState.displayName = 'InfoState';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-group.d.ts","sourceRoot":"","sources":["../../../src/components/input-group/input-group.tsx"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"input-group.d.ts","sourceRoot":"","sources":["../../../src/components/input-group/input-group.tsx"],"names":[],"mappings":"AACA,OAAO,EAAsD,SAAS,EAAE,MAAM,OAAO,CAAA;AAKrF,oBAAY,eAAe,GAAG,cAAc,GAAG;IAC7C;;OAEG;IACH,KAAK,EAAE,SAAS,CAAC;IACjB;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;OAEG;IACH,GAAG,CAAC,EAAE,SAAS,CAAC;IAChB;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,KAAK,GAAG,SAAS,CAAC;CACzC,CAAA;AAED,eAAO,MAAM,UAAU;IAtBrB;;OAEG;WACI,SAAS;IAChB;;OAEG;YACK,SAAS;IACjB;;OAEG;UACG,SAAS;IACf;;OAEG;YACK,SAAS;IACjB;;OAEG;;uDAgEH,CAAA"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import clsx from 'clsx';
|
|
3
|
-
import { Children, cloneElement, forwardRef } from 'react';
|
|
3
|
+
import { Children, cloneElement, forwardRef, isValidElement } from 'react';
|
|
4
4
|
import { Stack, Text } from '../..';
|
|
5
5
|
import { useUIDSeed } from 'react-uid';
|
|
6
6
|
import styles from './input-group.module.css';
|
|
7
7
|
export const InputGroup = forwardRef(({ className, input, end, start, label, dimension = 'regular', ...otherProps }, forwardedRef) => {
|
|
8
8
|
const seedID = useUIDSeed();
|
|
9
|
-
return (_jsxs(Stack, { rowGap: 4,
|
|
9
|
+
return (_jsxs(Stack, { rowGap: 4, hAlign: "stretch", vAlign: "start", fill: false, children: [label && _jsx(Text, { as: "label", size: dimension === 'small' ? 14 : 16, htmlFor: seedID('field'), children: label }, void 0), _jsxs(Stack, { as: "fieldset", direction: "row", vAlign: "start", hAlign: "start", fill: false, inline: true, ref: forwardedRef, className: clsx(styles.InputGroup, className), "data-input-group-has-end": Boolean(end), "data-input-group-has-start": !!start, ...otherProps, children: [_jsx("div", { className: styles.Start, children: Children.map(start, (child) => isValidElement(child) && cloneElement(child, {
|
|
10
10
|
dimension
|
|
11
|
-
})) }, void 0), _jsx("div", { className: styles.InputField, children: Children.map(input, (child) => cloneElement(child, {
|
|
11
|
+
})) }, void 0), _jsx("div", { className: styles.InputField, children: Children.map(input, (child) => isValidElement(child) && cloneElement(child, {
|
|
12
12
|
id: seedID('field'),
|
|
13
13
|
dimension
|
|
14
|
-
})) }, void 0), _jsx("div", { className: styles.End, children: Children.map(end, (child) => cloneElement(child, {
|
|
14
|
+
})) }, void 0), _jsx("div", { className: styles.End, children: Children.map(end, (child) => isValidElement(child) && cloneElement(child, {
|
|
15
15
|
dimension
|
|
16
16
|
})) }, void 0)] }, void 0)] }, void 0));
|
|
17
17
|
});
|
|
@@ -19,5 +19,5 @@ export const List = forwardRef(({ as: Wrapper = 'ul', children, marker = 'circle
|
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
21
|
const isUnordered = useMemo(() => Wrapper === 'ul', [Wrapper]);
|
|
22
|
-
return (_jsx(Wrapper, { ref: forwardedRef, className: clsx(styles.List, className), "data-list-size": dimension, "data-list-ordered": !isUnordered, "data-list-no-marker": hideMarker, ...otherProps, children: Children.map(children, (child) => (_jsxs(Stack, { as: "li", direction: "row",
|
|
22
|
+
return (_jsx(Wrapper, { ref: forwardedRef, className: clsx(styles.List, className), "data-list-size": dimension, "data-list-ordered": !isUnordered, "data-list-no-marker": hideMarker, ...otherProps, children: Children.map(children, (child) => (_jsxs(Stack, { as: "li", direction: "row", hAlign: "start", vAlign: "start", fill: false, children: [(isUnordered && !hideMarker) && (_jsx(Icon, { source: marker, className: styles.Marker, fill: markerColor, "data-list-default-marker": marker === 'circle', weight: marker === 'circle' ? 'solid' : undefined, dimension: marker !== 'circle' ? sizes[dimension].icon : 16 }, void 0)), _jsx(Text, { as: "span", size: sizes[dimension].text, children: child.props.children }, void 0)] }, void 0))) }, void 0));
|
|
23
23
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"masonry.d.ts","sourceRoot":"","sources":["../../../src/components/masonry/masonry.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"masonry.d.ts","sourceRoot":"","sources":["../../../src/components/masonry/masonry.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAyD,MAAM,OAAO,CAAA;AAGjF,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAA;AAG9D,oBAAY,YAAY,GAAG,cAAc,GAAG;IAC1C;;;OAGG;IACH,MAAM,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;IAClC;;;;;;;;;;;;;;;;;OAiBG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;CAC3B,CAAA;AAED,aAAK,OAAO,GAAG;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,eAAO,MAAM,OAAO,EAAE,EAAE,CAAC,YAAY,CA4CpC,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import clsx from 'clsx';
|
|
3
|
-
import { Children, cloneElement } from 'react';
|
|
3
|
+
import { Children, cloneElement, isValidElement } from 'react';
|
|
4
4
|
import MasonryLayout from 'react-masonry-css';
|
|
5
5
|
import tkns from '@wonderflow/tokens/platforms/web/tokens.json';
|
|
6
6
|
import styles from './masonry.module.css';
|
|
@@ -20,7 +20,7 @@ export const Masonry = ({ className, children, columns = 3, gutter = 16, style,
|
|
|
20
20
|
default: columns.default,
|
|
21
21
|
[breakpoints[current]]: columns[current]
|
|
22
22
|
}), {});
|
|
23
|
-
return (_jsx(MasonryLayout, { role: "list", className: clsx(styles.Masonry, className), columnClassName: styles.Column, breakpointCols: typeof columns === 'number' ? columns : computedColumns, style: { ...dynamicStyle, ...style }, ...otherProps, children: Children.map(children, (child) => cloneElement(child, {
|
|
23
|
+
return (_jsx(MasonryLayout, { role: "list", className: clsx(styles.Masonry, className), columnClassName: styles.Column, breakpointCols: typeof columns === 'number' ? columns : computedColumns, style: { ...dynamicStyle, ...style }, ...otherProps, children: Children.map(children, (child) => isValidElement(child) && cloneElement(child, {
|
|
24
24
|
role: 'listitem'
|
|
25
25
|
})) }, void 0));
|
|
26
26
|
};
|
|
@@ -15,7 +15,7 @@ export const MenuItem = forwardRef(({ className, children, onClick, icon, dimens
|
|
|
15
15
|
onClick(e);
|
|
16
16
|
}
|
|
17
17
|
}, [handleClick, onClick]);
|
|
18
|
-
const InnerContent = useMemo(() => (_jsxs(Stack, { direction: isIconRight ? 'row-reverse' : 'row', as: "span", fill: false, className: styles.ItemContent,
|
|
18
|
+
const InnerContent = useMemo(() => (_jsxs(Stack, { direction: isIconRight ? 'row-reverse' : 'row', as: "span", fill: false, className: styles.ItemContent, hAlign: isIconRight ? 'space-between' : 'start', vAlign: "center", columnGap: 8, hPadding: 16, vPadding: 8, "data-menu-item-icon-right": isIconRight, "data-menu-item-has-icon": Boolean(icon), "data-menu-item-padding": padding, style: { inlineSize: '100%' }, children: [icon && (_jsx(Icon, { className: styles.IconClass, source: icon, dimension: dimension === 'small' ? 12 : 16 }, void 0)), _jsxs(Stack, { className: styles.DecorationContent, columnGap: 16, fill: false, direction: "row", hAlign: "space-between", children: [children, decoration] }, void 0)] }, void 0)), [children, dimension, icon, isIconRight, decoration, padding]);
|
|
19
19
|
return (_jsx(Wrapper, { autoFocus: autoFocus, ref: itemRef, role: "menuitem", className: clsx(styles.MenuItem, className), onClick: disabled ? undefined : triggerClick, onKeyDown: disabled ? undefined : handleKeyDown, tabIndex: tabIndex, "aria-disabled": disabled, type: Wrapper === 'button' ? 'button' : undefined, "data-menu-item-dimension": dimension, ...otherProps, children: description
|
|
20
20
|
? (_jsx(Tooltip, { fill: true, open: focused, placement: "right-start", interactive: true, trigger: InnerContent, children: description }, void 0))
|
|
21
21
|
: InnerContent }, void 0));
|
|
@@ -8,7 +8,7 @@ import styles from './menu.module.css';
|
|
|
8
8
|
import clsx from 'clsx';
|
|
9
9
|
export const Menu = forwardRef(({ className, children, ...otherProps }, forwardedRef) => {
|
|
10
10
|
const renderedChildren = Children.toArray(children).filter(Boolean);
|
|
11
|
-
return (_jsx(Elevator, { resting: 2, children: _jsx(Stack, { as: "ul", ref: forwardedRef, className: clsx(styles.Menu, className),
|
|
11
|
+
return (_jsx(Elevator, { resting: 2, children: _jsx(Stack, { as: "ul", ref: forwardedRef, className: clsx(styles.Menu, className), vPadding: 8, role: "menu", ...otherProps, children: _jsx(RovingTabIndexProvider, { options: { direction: 'vertical', loopAround: true }, children: Children.map(renderedChildren, (child) => (_jsx(Stack, { as: "li", role: "none", vPadding: child.type?.displayName === 'Separator' ? 8 : undefined, children: child }, void 0))) }, void 0) }, void 0) }, void 0));
|
|
12
12
|
});
|
|
13
13
|
Menu.displayName = 'Menu';
|
|
14
14
|
Menu.Item = MenuItem;
|
|
@@ -6,6 +6,6 @@ import styles from './modal-content.module.css';
|
|
|
6
6
|
import { Title, Elevator, IconButton, Stack, useOverlayContext } from '../../..';
|
|
7
7
|
export const ModalContent = forwardRef(({ children, className, title, theme = 'light', ...otherProps }, forwardedRef) => {
|
|
8
8
|
const { onClose, titleId } = useOverlayContext();
|
|
9
|
-
return (_jsx(Elevator, { resting: 4, children: _jsxs("div", { className: clsx(styles.Content, className), ref: forwardedRef, "data-theme": theme, ...otherProps, children: [_jsxs(Stack, {
|
|
9
|
+
return (_jsx(Elevator, { resting: 4, children: _jsxs("div", { className: clsx(styles.Content, className), ref: forwardedRef, "data-theme": theme, ...otherProps, children: [_jsxs(Stack, { vAlign: "center", fill: false, hAlign: "space-between", direction: "row", className: styles.Header, children: [_jsx(Title, { responsive: false, level: "5", id: titleId, children: title }, void 0), onClose && _jsx(IconButton, { onClick: onClose, className: styles.CloseButton, icon: "xmark", kind: "flat" }, void 0)] }, void 0), _jsx(AutoFocusInside, { children: children }, void 0)] }, void 0) }, void 0));
|
|
10
10
|
});
|
|
11
11
|
ModalContent.displayName = 'Modal.Content';
|
|
@@ -11,6 +11,6 @@ export const Select = forwardRef(({ children, className, disabled = false, icon
|
|
|
11
11
|
regular: 16,
|
|
12
12
|
big: 24
|
|
13
13
|
};
|
|
14
|
-
return (_jsxs(Stack, { as: "fieldset", rowGap: 4, className: clsx(styles.Select, className), "data-select-is-multiple": kind === 'multiple', "data-select-has-label": Boolean(label), "data-select-dimension": dimension, "aria-disabled": disabled,
|
|
14
|
+
return (_jsxs(Stack, { as: "fieldset", rowGap: 4, className: clsx(styles.Select, className), "data-select-is-multiple": kind === 'multiple', "data-select-has-label": Boolean(label), "data-select-dimension": dimension, "aria-disabled": disabled, hAlign: "start", vAlign: "start", inline: true, tabIndex: disabled ? 0 : undefined, children: [label && _jsx(Text, { as: "label", size: dimension === 'small' ? 14 : 16, htmlFor: seedID('select'), children: label }, void 0), _jsxs("div", { className: styles.FieldContainer, children: [_jsx("select", { disabled: disabled, className: styles.Field, id: seedID('select'), multiple: kind === 'multiple', onChange: onChange, ref: forwardedRef, ...otherProps, children: children }, void 0), kind === 'single' && (_jsx(Icon, { className: styles.Icon, source: icon, dimension: iconSizes[dimension] }, void 0))] }, void 0)] }, void 0));
|
|
15
15
|
});
|
|
16
16
|
Select.displayName = 'Select';
|
|
@@ -10,6 +10,6 @@ export const Slider = forwardRef(({ min = 0, max = 100, step, onInput, className
|
|
|
10
10
|
onInput && onInput(currentTarget.valueAsNumber);
|
|
11
11
|
setValue(currentTarget.valueAsNumber);
|
|
12
12
|
}, [onInput]);
|
|
13
|
-
return (_jsxs(Stack, { direction: "row",
|
|
13
|
+
return (_jsxs(Stack, { direction: "row", vAlign: "center", columnGap: 8, className: clsx(styles.Slider, className), "data-slider-dimension": dimension, children: [showValues && _jsx(Text, { as: "span", size: isSmall ? 14 : 16, weight: "bold", textAlign: "end", className: styles.Value, children: value }, void 0), (iconMin && !showValues) && _jsx(Icon, { source: iconMin, dimension: isSmall ? 16 : 24 }, void 0), _jsx("input", { ref: forwardedRef, className: styles.Input, type: "range", min: min, max: max, defaultValue: value, "aria-valuemin": min, "aria-valuemax": max, "aria-valuenow": value, step: step, onInput: handleInput, ...otherProps }, void 0), showValues && _jsx(Text, { as: "span", size: isSmall ? 14 : 16, weight: "bold", className: styles.Value, children: max }, void 0), (iconMax && !showValues) && _jsx(Icon, { source: iconMax, dimension: isSmall ? 16 : 24 }, void 0)] }, void 0));
|
|
14
14
|
});
|
|
15
15
|
Slider.displayName = 'Slider';
|
|
@@ -11,5 +11,5 @@ export const Snackbar = forwardRef(({ children, className, title, icon, kind = '
|
|
|
11
11
|
positive: 'check',
|
|
12
12
|
danger: 'circle-x'
|
|
13
13
|
};
|
|
14
|
-
return (_jsx(Wrapper, { ref: forwardedRef, className: clsx(styles.Snackbar, className), "data-snackbar-kind": kind, role: "status", ...otherProps, children: _jsxs(Stack, {
|
|
14
|
+
return (_jsx(Wrapper, { ref: forwardedRef, className: clsx(styles.Snackbar, className), "data-snackbar-kind": kind, role: "status", ...otherProps, children: _jsxs(Stack, { vAlign: "start", hAlign: "start", direction: "row", columnGap: 16, fill: false, children: [_jsx(Icon, { className: styles.Icon, weight: "duotone", source: icon || defaultIcons[kind], dimension: 24 }, void 0), _jsxs(Stack, { rowGap: 16, children: [_jsxs(Stack, { rowGap: 8, children: [title && _jsx(Title, { level: "5", children: title }, void 0), _jsx("p", { children: children }, void 0)] }, void 0), dismissable && (_jsx(Stack, { hAlign: "end", children: _jsx(Button, { onClick: onDismiss, className: styles.Action, children: dismissLabel }, void 0) }, void 0))] }, void 0)] }, void 0) }, void 0));
|
|
15
15
|
});
|
|
@@ -26,20 +26,20 @@ export declare type StackProps = {
|
|
|
26
26
|
* Set the vertical content placement instead of
|
|
27
27
|
* growing to fill the available space.
|
|
28
28
|
*/
|
|
29
|
-
|
|
29
|
+
vAlign?: string;
|
|
30
30
|
/**
|
|
31
31
|
* Set the horizontal content placement instead of
|
|
32
32
|
* growing to fill the available space.
|
|
33
33
|
*/
|
|
34
|
-
|
|
34
|
+
hAlign?: string;
|
|
35
35
|
/**
|
|
36
36
|
* Set the horizontal padding (left/right)
|
|
37
37
|
*/
|
|
38
|
-
|
|
38
|
+
hPadding?: TokensTypes['space'];
|
|
39
39
|
/**
|
|
40
40
|
* Set the vertical padding (top/bottom)
|
|
41
41
|
*/
|
|
42
|
-
|
|
42
|
+
vPadding?: TokensTypes['space'];
|
|
43
43
|
/**
|
|
44
44
|
* Renderes children as rows or columns. The value can be one of the flex directions.
|
|
45
45
|
* More info: https://developer.mozilla.org/en-US/docs/Web/CSS/flex-direction
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stack.d.ts","sourceRoot":"","sources":["../../../src/components/stack/stack.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAA;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAI1C,oBAAY,UAAU,GAAG;IACvB;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IAC9B;;OAEG;IACH,SAAS,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IACjC;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;OAGG;IACH,
|
|
1
|
+
{"version":3,"file":"stack.d.ts","sourceRoot":"","sources":["../../../src/components/stack/stack.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAA;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAI1C,oBAAY,UAAU,GAAG;IACvB;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IAC9B;;OAEG;IACH,SAAS,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IACjC;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,QAAQ,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IAChC;;OAEG;IACH,QAAQ,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IAChC;;;OAGG;IACH,SAAS,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,aAAa,GAAG,gBAAgB,CAAC;CACjE,CAAA;AAED,aAAK,gBAAgB,GAAG,WAAW,CAAC,mBAAmB,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;AAE3E,eAAO,MAAM,KAAK,kBAgDI,CAAA"}
|
|
@@ -3,7 +3,7 @@ import { forwardRef } from 'react';
|
|
|
3
3
|
import tkns from '@wonderflow/tokens/platforms/web/tokens.json';
|
|
4
4
|
import styles from './stack.module.css';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
|
-
export const Stack = forwardRef(({ children, className, rowGap, columnGap, as: Wrapper = 'div', inline = false, direction = 'column', wrap = false, fill = true,
|
|
6
|
+
export const Stack = forwardRef(({ children, className, rowGap, columnGap, as: Wrapper = 'div', inline = false, direction = 'column', wrap = false, fill = true, vAlign = 'initial', hAlign = 'initial', hPadding, vPadding, style, ...otherProps }, forwardedRef) => {
|
|
7
7
|
const alignmentTemplate = (prop) => {
|
|
8
8
|
if (prop.includes('start') || prop.includes('end')) {
|
|
9
9
|
return `flex-${prop}`;
|
|
@@ -13,10 +13,10 @@ export const Stack = forwardRef(({ children, className, rowGap, columnGap, as: W
|
|
|
13
13
|
const computedStyle = {
|
|
14
14
|
'--rGap': rowGap ? tkns.space[rowGap] : 0,
|
|
15
15
|
'--cGap': columnGap ? tkns.space[columnGap] : 0,
|
|
16
|
-
'--vAlign':
|
|
17
|
-
'--hAlign':
|
|
18
|
-
'--vPadding':
|
|
19
|
-
'--hPadding':
|
|
16
|
+
'--vAlign': vAlign && alignmentTemplate(vAlign),
|
|
17
|
+
'--hAlign': hAlign && alignmentTemplate(hAlign),
|
|
18
|
+
'--vPadding': vPadding ? tkns.space[vPadding] : 0,
|
|
19
|
+
'--hPadding': hPadding ? tkns.space[hPadding] : 0
|
|
20
20
|
};
|
|
21
|
-
return (_jsx(Wrapper, { ref: forwardedRef, style: { ...computedStyle, ...style }, "data-stack-inline": inline, "data-stack-wrap": wrap, "data-stack-direction": direction, "data-stack-fill": fill, "data-stack-has-padding": Boolean(
|
|
21
|
+
return (_jsx(Wrapper, { ref: forwardedRef, style: { ...computedStyle, ...style }, "data-stack-inline": inline, "data-stack-wrap": wrap, "data-stack-direction": direction, "data-stack-fill": fill, "data-stack-has-padding": Boolean(hPadding || vPadding), className: clsx(styles.Stack, styles.StackWrapper, className), ...otherProps, children: children }, void 0));
|
|
22
22
|
});
|
|
@@ -49,5 +49,5 @@ export const StarMeter = forwardRef(({ className, value = 0, starCount = 5, labe
|
|
|
49
49
|
return _jsx(Icon, { source: "star", weight: "solid", className: styles.Icon, dimension: properties[dimension].iconSize, fill: fillType }, starIndex);
|
|
50
50
|
});
|
|
51
51
|
};
|
|
52
|
-
return (_jsxs(Stack, { inline: true, direction: "row",
|
|
52
|
+
return (_jsxs(Stack, { inline: true, direction: "row", vAlign: "center", columnGap: 8, className: clsx(styles.StarMeter, className), role: "meter", fill: false, "aria-valuenow": clamp(value, 0, starCount), "aria-valuemin": 0, "aria-valuemax": starCount, "aria-labelledby": seedID('star-meter'), "data-star-meter-dimension": dimension, ref: forwardedRef, ...otherProps, children: [_jsx("svg", { "aria-hidden": "true", className: styles.Gradient, width: "100", height: "50", version: "1.1", xmlns: "http://www.w3.org/2000/svg", children: _jsx("defs", { children: _jsxs("linearGradient", { id: "HalfStar", children: [_jsx("stop", { offset: "0", style: { stopColor: 'var(--star-color)' } }, void 0), _jsx("stop", { offset: "50%", style: { stopColor: 'var(--star-color)' } }, void 0), _jsx("stop", { offset: "50.1%", style: { stopColor: 'var(--star-dimmed-color)' } }, void 0), _jsx("stop", { offset: "100%", style: { stopColor: 'var(--star-dimmed-color)' } }, void 0)] }, void 0) }, void 0) }, void 0), _jsx(Stack, { direction: "row", columnGap: dimension === 'small' ? 2 : 4, children: starType(starCount, value) }, void 0), _jsx(Text, { dimmed: 6, id: seedID('star-meter'), size: properties[dimension].labelSize, weight: "bold", children: !hideLabel && _jsx(_Fragment, { children: label || value.toString() }, void 0) }, void 0)] }, void 0));
|
|
53
53
|
});
|
|
@@ -18,6 +18,6 @@ export const TabItem = forwardRef(({ children, className, icon, ...otherProps },
|
|
|
18
18
|
onClick();
|
|
19
19
|
handleClick();
|
|
20
20
|
}, [handleClick, onClick]);
|
|
21
|
-
return (_jsxs(Stack, { as: "button", direction: "row",
|
|
21
|
+
return (_jsxs(Stack, { as: "button", direction: "row", vAlign: "center", hAlign: "start", fill: false, columnGap: 8, role: "tab", ref: internalRef, className: clsx(styles.TabItem, className), "aria-selected": isActive, onClick: fireClick, onKeyDown: handleKeyDown, onFocus: fireClick, type: "button", tabIndex: isActive ? 0 : -1, ...otherProps, children: [icon && _jsx(Icon, { source: icon, dimension: 16 }, void 0), children] }, void 0));
|
|
22
22
|
});
|
|
23
23
|
TabItem.displayName = 'Tab.Item';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tab.d.ts","sourceRoot":"","sources":["../../../src/components/tab/tab.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,SAAS,
|
|
1
|
+
{"version":3,"file":"tab.d.ts","sourceRoot":"","sources":["../../../src/components/tab/tab.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,SAAS,EAIV,MAAM,OAAO,CAAA;AAGd,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AACpC,OAAO,EAAW,YAAY,EAAE,MAAM,YAAY,CAAA;AAClD,OAAO,EAAY,aAAa,EAAE,MAAM,aAAa,CAAA;AAErD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAQ1C;;;GAGG;AACH,oBAAY,QAAQ,GAAG,cAAc,GAAG;IACtC;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAC/D;;OAEG;IACH,QAAQ,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC,CAAA;AAED,aAAK,YAAY,GAAG,KAAK,CAAC,yBAAyB,CAAC,QAAQ,CAAC,GAAG;IAC9D,KAAK,EAAE,KAAK,CAAC,yBAAyB,CAAC,aAAa,CAAC,CAAC;IACtD,IAAI,EAAE,KAAK,CAAC,yBAAyB,CAAC,WAAW,CAAC,QAAQ,CAAC,OAAO,OAAO,CAAC,CAAC,CAAC;IAC5E,IAAI,EAAE,KAAK,CAAC,yBAAyB,CAAC,YAAY,CAAC,CAAC;CACrD,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,GAAG,cAwDE,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useState, forwardRef, Children, cloneElement } from 'react';
|
|
2
|
+
import { useEffect, useState, forwardRef, Children, cloneElement, isValidElement } from 'react';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import { useUIDSeed } from 'react-uid';
|
|
5
5
|
import { TabItem } from './tab-item';
|
|
@@ -12,7 +12,6 @@ import styles from './tab.module.css';
|
|
|
12
12
|
* Component
|
|
13
13
|
*/
|
|
14
14
|
export const Tab = forwardRef(({ children, className, state, onChange, ...otherProps }, forwardedRef) => {
|
|
15
|
-
const renderedChildren = Children.toArray(children).filter(Boolean);
|
|
16
15
|
const innerState = useState(0);
|
|
17
16
|
const tabState = state || innerState;
|
|
18
17
|
const [currentTab] = tabState;
|
|
@@ -22,7 +21,7 @@ export const Tab = forwardRef(({ children, className, state, onChange, ...otherP
|
|
|
22
21
|
onChange(currentTab);
|
|
23
22
|
}
|
|
24
23
|
}, [currentTab, onChange]);
|
|
25
|
-
return (_jsx("div", { ref: forwardedRef, className: clsx(styles.Tab, className), ...otherProps, children: _jsxs(TabsWrapper, { state: tabState, children: [_jsx(TabList, { children: Children.map(
|
|
24
|
+
return (_jsx("div", { ref: forwardedRef, className: clsx(styles.Tab, className), ...otherProps, children: _jsxs(TabsWrapper, { state: tabState, children: [_jsx(TabList, { children: Children.map(children, (child, index) => isValidElement(child) && (_jsx(TabItem, { id: seedID(`tab-item-${index}`), "aria-controls": seedID(`tab-panel-${index}`), icon: child.props.icon, children: child.props.label }, void 0))) }, void 0), Children.map(children, (child, index) => isValidElement(child) && cloneElement(child, {
|
|
26
25
|
id: seedID(`tab-panel-${index}`),
|
|
27
26
|
'aria-labelledby': seedID(`tab-item-${index}`)
|
|
28
27
|
}))] }, void 0) }, void 0));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Title, Stack } from '../../..';
|
|
3
3
|
import styles from './table-header.module.css';
|
|
4
|
-
export const TableHeader = ({ children, title, id, ...otherProps }) => (_jsxs(Stack, { direction: "row", columnGap: 32,
|
|
4
|
+
export const TableHeader = ({ children, title, id, ...otherProps }) => (_jsxs(Stack, { direction: "row", columnGap: 32, vAlign: "center", hAlign: "space-between", fill: false, className: styles.TableHeader, ...otherProps, children: [_jsx("div", { children: typeof title === 'string' ? _jsx(Title, { id: id, level: "5", children: title }, void 0) : title }, void 0), _jsx(Stack, { direction: "row", vAlign: "center", columnGap: 8, inline: true, children: children }, void 0)] }, void 0));
|
|
@@ -7,5 +7,5 @@ export const TablePagination = ({ children, pageSize, onPageSizeChange, clusters
|
|
|
7
7
|
const computedPageCount = useMemo(() => isManual ? Math.ceil(totalItems / pageSize) : totalPages, [isManual, pageSize, totalItems, totalPages]);
|
|
8
8
|
const computedItemsInPageStart = useMemo(() => (currentPage && pageSize) && currentPage * pageSize, [currentPage, pageSize]);
|
|
9
9
|
const computedItemsInPageEnd = useMemo(() => currentPage * pageSize + pageSize, [currentPage, pageSize]);
|
|
10
|
-
return (_jsxs(Stack, { fill: false, direction: "row", columnGap: 16,
|
|
10
|
+
return (_jsxs(Stack, { fill: false, direction: "row", columnGap: 16, vAlign: "center", hAlign: "end", vPadding: 16, ...otherProps, children: [_jsxs(Stack, { direction: "row", columnGap: 4, children: [_jsx(Text, { as: "label", htmlFor: uid('table-i-per-page'), size: 14, children: "Items per page:" }, void 0), _jsx(Select, { value: pageSize, dimension: "small", id: uid('table-i-per-page'), onChange: ({ currentTarget }) => { onPageSizeChange && onPageSizeChange(Number(currentTarget.value)); }, children: clusters.map(cluster => (_jsx("option", { value: cluster, children: cluster }, cluster))) }, void 0)] }, void 0), _jsx(Text, { "aria-hidden": "true", weight: "bold", size: 14, children: `${computedItemsInPageStart + 1}-${computedItemsInPageEnd > totalItems ? totalItems : computedItemsInPageEnd} of ${totalItems}` }, void 0), _jsx(Pagination, { itemsCount: totalItems, itemsPerPage: pageSize, pageCount: computedPageCount, onPageClick: ({ selected }) => onPageClick && onPageClick(selected), renderOnZeroPageCount: () => null, forcePage: currentPage }, void 0)] }, void 0));
|
|
11
11
|
};
|
|
@@ -96,7 +96,7 @@ export const Table = ({ className, style, columns, data = [], selectableRows, on
|
|
|
96
96
|
'--table-height': height,
|
|
97
97
|
'--table-background': background
|
|
98
98
|
};
|
|
99
|
-
return (_jsxs("div", { className: clsx(styles.Table, className), style: { ...dynamicStyle, ...style }, children: [_jsx(AnimatePresence, { children: selectedFlatRows?.length && (_jsxs(Stack, { as: motion.div, className: styles.Toast, direction: "row",
|
|
99
|
+
return (_jsxs("div", { className: clsx(styles.Table, className), style: { ...dynamicStyle, ...style }, children: [_jsx(AnimatePresence, { children: selectedFlatRows?.length && (_jsxs(Stack, { as: motion.div, className: styles.Toast, direction: "row", hAlign: "space-between", vAlign: "center", hPadding: 16, vPadding: 8, fill: false, columnGap: 16, initial: { y: '-16px', opacity: 0 }, animate: {
|
|
100
100
|
y: 0,
|
|
101
101
|
opacity: 1,
|
|
102
102
|
transition: {
|
|
@@ -113,5 +113,5 @@ export const Table = ({ className, style, columns, data = [], selectableRows, on
|
|
|
113
113
|
prepareRow(row);
|
|
114
114
|
return (_jsxs(Fragment, { children: [_jsx(TableRow, { ...row.getRowProps(), "data-row-expanded": row.isExpanded || undefined, "data-row-depth": row.depth > 0 ? row.depth : undefined, children: row.cells.map((cell) => (_jsx(TableCell, { collapsed: cell.column.isCollapsed, isExpander: cell.column.expander, expanded: row.isExpanded, depth: row.depth, width: cell.column.minWidth === 0 ? undefined : cell.column.minWidth, align: cell.column.align, hasSubrows: !!row.subRows?.length, ...cell.getCellProps(), children: cell.render('Cell') }, void 0))) }, void 0), (row.subRows && row.isExpanded && expandableRowComponent) && row.subRows.map((subRow) => (_jsx(TableRow, { "data-table-row-expander": true, children: _jsx(TableCell, { padding: false, colSpan: 100, children: _jsx(TableExpand, { data: subRow.original, component: expandableRowComponent }, void 0) }, void 0) }, subRow.id)))] }, row.id));
|
|
115
115
|
}) }, void 0)] }, void 0) }, void 0))
|
|
116
|
-
: (_jsx(Stack, {
|
|
116
|
+
: (_jsx(Stack, { vAlign: "center", hAlign: "center", children: emptyComponent || 'No data' }, void 0)), (showPagination && filteredVisibleColumns.length > 0 && !!rows.length) && (_jsx(TablePagination, { clusters: pageClusters, pageSize: pageSize, totalItems: totalRows || rows.length, currentPage: pageIndex, totalPages: pageCount, isManual: Boolean(isManualPaginated && totalRows), onPageSizeChange: newPageSize => setPageSize(newPageSize), onPageClick: (selected) => gotoPage(selected) }, void 0))] }, void 0));
|
|
117
117
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textfield.d.ts","sourceRoot":"","sources":["../../../src/components/textfield/textfield.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAa,cAAc,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAC5E,OAAO,EAAE,WAAW,EAAmD,MAAM,OAAO,CAAA;AAEpF,OAAO,EAAqC,SAAS,EAAe,MAAM,cAAc,CAAA;AAIxF,oBAAY,cAAc,GAAG,cAAc,GAAG;IAC5C;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;IAC3B;;OAEG;IACF,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACjC;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,KAAK,CAAC;IACxC;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,kBAAkB,CAAC,KAAK,IAAI,CAAA;CAC5D,CAAA;AAED,eAAO,MAAM,SAAS;;;IA9CpB;;OAEG;;IAEH;;OAEG;;IAEH;;;;OAIG;;IAEH;;;;;OAKG;;IAEH;;;OAGG;;IAEH;;OAEG;;IAEH;;;OAGG;;IAEH;;;OAGG;;IAEH;;OAEG;wBACgB,YAAY,kBAAkB,CAAC,KAAK,IAAI;
|
|
1
|
+
{"version":3,"file":"textfield.d.ts","sourceRoot":"","sources":["../../../src/components/textfield/textfield.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAa,cAAc,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAC5E,OAAO,EAAE,WAAW,EAAmD,MAAM,OAAO,CAAA;AAEpF,OAAO,EAAqC,SAAS,EAAe,MAAM,cAAc,CAAA;AAIxF,oBAAY,cAAc,GAAG,cAAc,GAAG;IAC5C;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;IAC3B;;OAEG;IACF,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACjC;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,KAAK,CAAC;IACxC;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,kBAAkB,CAAC,KAAK,IAAI,CAAA;CAC5D,CAAA;AAED,eAAO,MAAM,SAAS;;;IA9CpB;;OAEG;;IAEH;;OAEG;;IAEH;;;;OAIG;;IAEH;;;;;OAKG;;IAEH;;;OAGG;;IAEH;;OAEG;;IAEH;;;OAGG;;IAEH;;;OAGG;;IAEH;;OAEG;wBACgB,YAAY,kBAAkB,CAAC,KAAK,IAAI;sDA+G3D,CAAA"}
|
|
@@ -29,8 +29,8 @@ export const Textfield = forwardRef(({ children, className, disabled = false, ic
|
|
|
29
29
|
disabled,
|
|
30
30
|
onChange
|
|
31
31
|
};
|
|
32
|
-
return (_jsxs(Stack, { as: "fieldset", rowGap: 4, className: clsx(styles.Textfield, className), "data-textfield-has-icon": isPassword || Boolean(icon), "data-textfield-icon-position": iconPosition, "data-textfield-dimension": dimension, "data-textfield-invalid": invalid, "aria-disabled": disabled,
|
|
32
|
+
return (_jsxs(Stack, { as: "fieldset", rowGap: 4, className: clsx(styles.Textfield, className), "data-textfield-has-icon": isPassword || Boolean(icon), "data-textfield-icon-position": iconPosition, "data-textfield-dimension": dimension, "data-textfield-invalid": invalid, "aria-disabled": disabled, hAlign: "stretch", vAlign: "start", tabIndex: disabled ? 0 : undefined, style: style, children: [label && _jsx(Text, { as: "label", size: dimension === 'small' ? 14 : 16, htmlFor: fieldID, children: label }, void 0), _jsxs("div", { className: styles.FieldContainer, children: [textarea
|
|
33
33
|
? (_jsx(BaseField, { ref: forwardedRef, as: "textarea", id: fieldID, ...commonProps, ...otherProps }, void 0))
|
|
34
|
-
: (_jsx(BaseField, { className: styles.InputField, id: fieldID, ref: forwardedRef, type: passwordVisible ? 'text' : type, ...commonProps, ...otherProps }, void 0)), isPassword && (_jsx(IconButton, { className: styles.IconButton, dimension: actionSizes[dimension], onClick: handlePasswordVisibility, kind: "flat", "aria-label": "Reveal password", icon: passwordVisible ? 'eye-slash' : 'eye' }, void 0)), !textarea && icon && !isPassword && (_jsx(Icon, { className: styles.Icon, source: icon, dimension: iconSizes[dimension] }, void 0))] }, void 0)] }, void 0));
|
|
34
|
+
: (_jsx(BaseField, { className: styles.InputField, id: fieldID, ref: forwardedRef, type: passwordVisible ? 'text' : type, spellCheck: isPassword ? false : undefined, ...commonProps, ...otherProps }, void 0)), isPassword && (_jsx(IconButton, { className: styles.IconButton, dimension: actionSizes[dimension], onClick: handlePasswordVisibility, kind: "flat", "aria-label": "Reveal password", icon: passwordVisible ? 'eye-slash' : 'eye' }, void 0)), !textarea && icon && !isPassword && (_jsx(Icon, { className: styles.Icon, source: icon, dimension: iconSizes[dimension] }, void 0))] }, void 0)] }, void 0));
|
|
35
35
|
});
|
|
36
36
|
Textfield.displayName = 'Textfield';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../../src/components/tooltip/tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAyC,SAAS,
|
|
1
|
+
{"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../../src/components/tooltip/tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAyC,SAAS,EAAoC,MAAM,OAAO,CAAA;AAK9G,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AAGrF,oBAAY,YAAY,GAAG,cAAc,GAAG;IAC1C;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,OAAO,EAAE,SAAS,CAAC;IACnB;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,aAAa,GAAG,aAAa,GAAG,kBAAkB,CAAC;IAC/D;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAA;AAED,eAAO,MAAM,OAAO,EAAE,EAAE,CAAC,YAAY,CAiFpC,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Children, cloneElement, useState, useRef } from 'react';
|
|
2
|
+
import { Children, cloneElement, useState, useRef, isValidElement } from 'react';
|
|
3
3
|
import { useUIDSeed } from 'react-uid';
|
|
4
4
|
import { useKeyPress, useFocusWithin } from 'ahooks';
|
|
5
5
|
import { Elevator } from '../..';
|
|
@@ -28,13 +28,14 @@ export const Tooltip = ({ children, trigger, placement = 'bottom-start', open, s
|
|
|
28
28
|
setIsOpen(true);
|
|
29
29
|
},
|
|
30
30
|
onBlur: (e) => {
|
|
31
|
-
(e.
|
|
31
|
+
if (e.currentTarget?.parentElement !== tooltipContainerRef.current)
|
|
32
|
+
setIsOpen(false);
|
|
32
33
|
}
|
|
33
34
|
});
|
|
34
35
|
const dynamycStyle = {
|
|
35
36
|
'--maxW': maxWidth
|
|
36
37
|
};
|
|
37
|
-
return (_jsxs("div", { "data-tooltip-fill": fill, className: styles.TooltipClass, ref: tooltipContainerRef, "data-tooltip-has-focus-within": isFocusWithin, style: { ...style }, children: [Children.map(trigger, (child) => cloneElement(child, {
|
|
38
|
+
return (_jsxs("div", { "data-tooltip-fill": fill, className: styles.TooltipClass, ref: tooltipContainerRef, "data-tooltip-has-focus-within": isFocusWithin, style: { ...style }, children: [Children.map(trigger, (child) => isValidElement(child) && cloneElement(child, {
|
|
38
39
|
ref: setTriggerRef,
|
|
39
40
|
tabIndex: 0,
|
|
40
41
|
'aria-describedby': seedID('tooltip-content')
|