@wonderflow/react-components 8.0.0 → 8.3.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-option.d.ts +0 -10
- package/dist/components/autocomplete/autocomplete-option.d.ts.map +1 -1
- package/dist/components/autocomplete/autocomplete-option.js +1 -1
- package/dist/components/autocomplete/autocomplete.d.ts +5 -3
- package/dist/components/autocomplete/autocomplete.d.ts.map +1 -1
- package/dist/components/autocomplete/autocomplete.js +9 -10
- package/dist/components/icon/icon.d.ts +1 -1
- package/dist/components/menu/menu-item/menu-item.d.ts +5 -1
- package/dist/components/menu/menu-item/menu-item.d.ts.map +1 -1
- package/dist/components/menu/menu-item/menu-item.js +3 -3
- package/dist/components/menu/menu.d.ts +4 -0
- package/dist/components/menu/menu.d.ts.map +1 -1
- package/dist/components/menu/menu.js +5 -2
- package/dist/components/menu/menu.module.css +1 -1
- package/dist/components/slider/slider.module.css +1 -1
- package/dist/components/tab/tab.d.ts +1 -1
- package/dist/components/tab/tab.d.ts.map +1 -1
- package/dist/components/tab/tab.js +1 -1
- package/dist/components/tab/tab.module.css +1 -1
- package/dist/components/tab/tabs-panel.d.ts +1 -1
- package/dist/components/tab/tabs-panel.d.ts.map +1 -1
- package/dist/components/tab/tabs-panel.js +2 -1
- package/dist/components/table/table-controls/toggle-columns.d.ts.map +1 -1
- package/dist/components/table/table-controls/toggle-columns.js +1 -1
- package/dist/components/table/table.d.ts +3 -3
- package/dist/components/table/table.d.ts.map +1 -1
- package/dist/components/table/table.js +12 -8
- package/dist/components/textfield/base-field/base-field.module.css +1 -1
- package/package.json +14 -14
|
@@ -2,11 +2,6 @@ import { MenuItemProps } from '../..';
|
|
|
2
2
|
import { PropsWithChildren } from 'react';
|
|
3
3
|
import { Except } from 'type-fest';
|
|
4
4
|
export declare type AutocompleteOptionProps = PropsWithChildren<PropsWithClass> & Except<MenuItemProps, 'padding' | 'autoFocus' | 'description' | 'onClick'> & {
|
|
5
|
-
/**
|
|
6
|
-
* Value of the option.
|
|
7
|
-
* This is the value that will be passed to the `onChange` callback.
|
|
8
|
-
*/
|
|
9
|
-
value: string;
|
|
10
5
|
/**
|
|
11
6
|
* Callback called when the option is clicked.
|
|
12
7
|
* It passes the value and the inner text of the option as arguments.
|
|
@@ -21,11 +16,6 @@ export declare type AutocompleteOptionProps = PropsWithChildren<PropsWithClass>
|
|
|
21
16
|
export declare const AutocompleteOption: import("react").ForwardRefExoticComponent<PropsWithClass & {
|
|
22
17
|
children?: import("react").ReactNode;
|
|
23
18
|
} & Except<MenuItemProps, "padding" | "autoFocus" | "description" | "onClick"> & {
|
|
24
|
-
/**
|
|
25
|
-
* Value of the option.
|
|
26
|
-
* This is the value that will be passed to the `onChange` callback.
|
|
27
|
-
*/
|
|
28
|
-
value: string;
|
|
29
19
|
/**
|
|
30
20
|
* Callback called when the option is clicked.
|
|
31
21
|
* It passes the value and the inner text of the option as arguments.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autocomplete-option.d.ts","sourceRoot":"","sources":["../../../src/components/autocomplete/autocomplete-option.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAQ,aAAa,EAAE,MAAM,cAAc,CAAA;AAClD,OAAO,EAAE,iBAAiB,EAAmC,MAAM,OAAO,CAAA;AAC1E,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAElC,oBAAY,uBAAuB,GAAG,iBAAiB,CAAC,cAAc,CAAC,GAAG,MAAM,CAC9E,aAAa,EACb,SAAS,GAAG,WAAW,GAAG,aAAa,GAAG,SAAS,CACpD,GAAG;IACF;;;OAGG;IACH,
|
|
1
|
+
{"version":3,"file":"autocomplete-option.d.ts","sourceRoot":"","sources":["../../../src/components/autocomplete/autocomplete-option.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAQ,aAAa,EAAE,MAAM,cAAc,CAAA;AAClD,OAAO,EAAE,iBAAiB,EAAmC,MAAM,OAAO,CAAA;AAC1E,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAElC,oBAAY,uBAAuB,GAAG,iBAAiB,CAAC,cAAc,CAAC,GAAG,MAAM,CAC9E,aAAa,EACb,SAAS,GAAG,WAAW,GAAG,aAAa,GAAG,SAAS,CACpD,GAAG;IACF;;;OAGG;IACH,OAAO,CAAC,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjD;;;OAGG;IACH,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAC7B,CAAA;AAED,eAAO,MAAM,kBAAkB;;;IAZ7B;;;OAGG;wEACyC,IAAI;IAChD;;;OAGG;cACO,MAAM,GAAG,MAAM,EAAE;qDA6B3B,CAAA"}
|
|
@@ -6,6 +6,6 @@ export const AutocompleteOption = forwardRef(({ children, value, onClick, ...oth
|
|
|
6
6
|
const handleClick = useCallback(() => {
|
|
7
7
|
onClick && onClick(value, contentRef?.current?.innerText);
|
|
8
8
|
}, [onClick, value]);
|
|
9
|
-
return (_jsx(Menu.Item, { ref: forwardedRef, role: "option", padding: false, onClick: handleClick, ...otherProps, children: _jsx("span", { ref: contentRef, children: children }) }));
|
|
9
|
+
return (_jsx(Menu.Item, { value: value, ref: forwardedRef, role: "option", padding: false, onClick: handleClick, ...otherProps, children: _jsx("span", { ref: contentRef, children: children }) }));
|
|
10
10
|
});
|
|
11
11
|
AutocompleteOption.displayName = 'Autocomplete.Option';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AutocompleteOptionProps } from './autocomplete-option';
|
|
2
2
|
import { ForwardRefExoticComponent, ReactNode } from 'react';
|
|
3
3
|
import { TextfieldProps } from '../..';
|
|
4
|
+
import { MenuProps } from '../menu';
|
|
4
5
|
export declare type AutocompleteProps = TextfieldProps & {
|
|
5
6
|
/**
|
|
6
7
|
* The callback called when an option is picked from the list
|
|
@@ -10,12 +11,13 @@ export declare type AutocompleteProps = TextfieldProps & {
|
|
|
10
11
|
* Set the maximum height of the options list after which
|
|
11
12
|
* it will scroll.
|
|
12
13
|
*/
|
|
13
|
-
maxHeight?:
|
|
14
|
+
maxHeight?: MenuProps['maxHeight'];
|
|
14
15
|
/**
|
|
15
|
-
* Custom empty
|
|
16
|
+
* Custom empty content to display when there are no options or
|
|
16
17
|
* when the value does not match any of the options.
|
|
17
18
|
*/
|
|
18
|
-
|
|
19
|
+
emptyContent?: ReactNode;
|
|
20
|
+
busy?: boolean;
|
|
19
21
|
};
|
|
20
22
|
declare type AutocompleteComponent = ForwardRefExoticComponent<AutocompleteProps> & {
|
|
21
23
|
Option: ForwardRefExoticComponent<AutocompleteOptionProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autocomplete.d.ts","sourceRoot":"","sources":["../../../src/components/autocomplete/autocomplete.tsx"],"names":[],"mappings":"AACA,OAAO,EAAsB,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AACnF,OAAO,EACK,yBAAyB,
|
|
1
|
+
{"version":3,"file":"autocomplete.d.ts","sourceRoot":"","sources":["../../../src/components/autocomplete/autocomplete.tsx"],"names":[],"mappings":"AACA,OAAO,EAAsB,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AACnF,OAAO,EACK,yBAAyB,EAEd,SAAS,EAC/B,MAAM,OAAO,CAAA;AAEd,OAAO,EAAyB,cAAc,EAAmB,MAAM,cAAc,CAAA;AAIrF,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAEnC,oBAAY,iBAAiB,GAAG,cAAc,GAAG;IAC/C;;OAEG;IACH,QAAQ,CAAC,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IACnC;;;OAGG;IACH,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,aAAK,qBAAqB,GAAG,yBAAyB,CAAC,iBAAiB,CAAC,GAAG;IAC1E,MAAM,EAAE,yBAAyB,CAAC,uBAAuB,CAAC,CAAC;CAC5D,CAAA;AAqBD,eAAO,MAAM,YAAY,uBA8IE,CAAA"}
|
|
@@ -3,7 +3,7 @@ import { domMax, LazyMotion, m, AnimatePresence } from 'framer-motion';
|
|
|
3
3
|
import { AutocompleteOption } from './autocomplete-option';
|
|
4
4
|
import { Children, cloneElement, forwardRef, useCallback, useMemo, useRef, useState, useEffect, isValidElement } from 'react';
|
|
5
5
|
import { useDebounce, useFocusWithin, useKeyPress, useSize } from 'ahooks';
|
|
6
|
-
import { Text, Menu, Textfield } from '../..';
|
|
6
|
+
import { Text, Menu, Textfield, Skeleton, Stack } from '../..';
|
|
7
7
|
import styles from './autocomplete.module.css';
|
|
8
8
|
import { usePopperTooltip } from 'react-popper-tooltip';
|
|
9
9
|
import { useUIDSeed } from 'react-uid';
|
|
@@ -25,7 +25,7 @@ const AutocompleteAnimation = {
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
|
-
export const Autocomplete = forwardRef(({ children, onChange, disabled, readOnly, value, maxHeight = '200px',
|
|
28
|
+
export const Autocomplete = forwardRef(({ children, onChange, disabled, readOnly, value, busy, maxHeight = '200px', emptyContent = 'No items to show', ...otherProps }, forwardedRef) => {
|
|
29
29
|
const seedID = useUIDSeed();
|
|
30
30
|
const autocompleteRef = useRef(forwardedRef);
|
|
31
31
|
const [isOpen, setIsOpen] = useState(false);
|
|
@@ -65,17 +65,16 @@ export const Autocomplete = forwardRef(({ children, onChange, disabled, readOnly
|
|
|
65
65
|
const handleFilter = useCallback(({ currentTarget }) => {
|
|
66
66
|
setContent(currentTarget.value);
|
|
67
67
|
}, []);
|
|
68
|
-
const dynamicStyle = {
|
|
69
|
-
'--max-h': maxHeight
|
|
70
|
-
};
|
|
71
68
|
useEffect(() => {
|
|
72
69
|
value && setContent(String(value));
|
|
73
70
|
}, [value]);
|
|
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(LazyMotion, { features: domMax, strict: true, children: _jsx(m.div, { variants: AutocompleteAnimation, initial: "hidden", animate: "visible", exit: "hidden", children: _jsx(Menu, { role: "listbox", id: seedID('autocomplete-menu'), className: styles.OptionsList,
|
|
75
|
-
? _jsx(Text, { as: "div", textAlign: "center", dimmed: 5, children:
|
|
76
|
-
:
|
|
77
|
-
|
|
78
|
-
|
|
71
|
+
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(LazyMotion, { features: domMax, strict: true, children: _jsx(m.div, { variants: AutocompleteAnimation, initial: "hidden", animate: "visible", exit: "hidden", children: _jsx(Menu, { role: "listbox", id: seedID('autocomplete-menu'), className: styles.OptionsList, maxHeight: maxHeight, "aria-labelledby": seedID('autocomplete-trigger'), children: (filteredOptions.length === 0 && !busy)
|
|
72
|
+
? _jsx(Text, { as: "div", textAlign: "center", dimmed: 5, children: emptyContent })
|
|
73
|
+
: busy
|
|
74
|
+
? _jsx(Stack, { hPadding: 8, as: "li", children: _jsx(Skeleton, { count: 3 }) })
|
|
75
|
+
: Children.map(filteredOptions, (child) => isValidElement(child) && cloneElement(child, {
|
|
76
|
+
onClick: handleOptionClick
|
|
77
|
+
})) }) }) }) })) })] }));
|
|
79
78
|
});
|
|
80
79
|
Autocomplete.Option = AutocompleteOption;
|
|
81
80
|
Autocomplete.displayName = 'Autocomplete';
|
|
@@ -34,7 +34,7 @@ export declare const Icon: import("react").ForwardRefExoticComponent<SVGAttribut
|
|
|
34
34
|
* Set the size of the icon. To improve readability at any size, the style of the icon
|
|
35
35
|
* is automatically defined based on the dimension.
|
|
36
36
|
*/
|
|
37
|
-
dimension?: 16 |
|
|
37
|
+
dimension?: 16 | 24 | 32 | 40 | 48 | 56 | 12 | undefined;
|
|
38
38
|
/**
|
|
39
39
|
* Set the weight of the icon.
|
|
40
40
|
* The default weight is `outline` if `dimension` is greather than `12` or `undefined`.
|
|
@@ -21,7 +21,7 @@ export declare type MenuItemProps = {
|
|
|
21
21
|
/**
|
|
22
22
|
* Callback function to be called when the menu item is pressed.
|
|
23
23
|
*/
|
|
24
|
-
onClick?(event
|
|
24
|
+
onClick?(event: Event, value: string): void;
|
|
25
25
|
/**
|
|
26
26
|
* Add an extra description to the menu item.
|
|
27
27
|
* This uses the `<Tooltip>` component internally.
|
|
@@ -53,6 +53,10 @@ export declare type MenuItemProps = {
|
|
|
53
53
|
* if `Menu.Item` is rendered as ´<button>´ (default).
|
|
54
54
|
*/
|
|
55
55
|
decoration?: ReactNode;
|
|
56
|
+
/**
|
|
57
|
+
* Assign a string value to the menu option. This is returned when the menu item is clicked.
|
|
58
|
+
*/
|
|
59
|
+
value: string;
|
|
56
60
|
};
|
|
57
61
|
declare type PolymorphicMenuItem = Polymorphic.ForwardRefComponent<'button', MenuItemProps>;
|
|
58
62
|
export declare const MenuItem: PolymorphicMenuItem;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu-item.d.ts","sourceRoot":"","sources":["../../../../src/components/menu/menu-item/menu-item.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAQ,WAAW,EAAkB,SAAS,EAAE,MAAM,cAAc,CAAA;AAE3E,OAAO,EAAE,SAAS,EAA4C,MAAM,OAAO,CAAA;AAI3E,oBAAY,aAAa,GAAG;IAC1B;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;IAC3B;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAChC;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAC/B;;OAEG;IACH,OAAO,CAAC,CAAC,KAAK,
|
|
1
|
+
{"version":3,"file":"menu-item.d.ts","sourceRoot":"","sources":["../../../../src/components/menu/menu-item/menu-item.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAQ,WAAW,EAAkB,SAAS,EAAE,MAAM,cAAc,CAAA;AAE3E,OAAO,EAAE,SAAS,EAA4C,MAAM,OAAO,CAAA;AAI3E,oBAAY,aAAa,GAAG;IAC1B;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;IAC3B;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAChC;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAC/B;;OAEG;IACH,OAAO,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5C;;;OAGG;IACH,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;CACf,CAAA;AAED,aAAK,mBAAmB,GAAG,WAAW,CAAC,mBAAmB,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;AAEpF,eAAO,MAAM,QAAQ,qBA4FI,CAAA"}
|
|
@@ -4,7 +4,7 @@ import styles from './menu-item.module.css';
|
|
|
4
4
|
import { forwardRef, useCallback, useMemo, useRef } from 'react';
|
|
5
5
|
import { useFocusEffect, useRovingTabIndex } from 'react-roving-tabindex';
|
|
6
6
|
import clsx from 'clsx';
|
|
7
|
-
export const MenuItem = forwardRef(({ className, children, onClick, icon, dimension = 'regular', as: Wrapper = 'button', iconPosition = 'left', description, padding = true, disabled = false, autoFocus, decoration, ...otherProps }, forwardedRef) => {
|
|
7
|
+
export const MenuItem = forwardRef(({ className, children, onClick, icon, dimension = 'regular', as: Wrapper = 'button', iconPosition = 'left', description, padding = true, disabled = false, autoFocus, decoration, value, ...otherProps }, forwardedRef) => {
|
|
8
8
|
const itemRef = useRef(forwardedRef);
|
|
9
9
|
const [tabIndex, focused, handleKeyDown, handleClick] = useRovingTabIndex(itemRef, disabled);
|
|
10
10
|
const isIconRight = iconPosition === 'right';
|
|
@@ -12,9 +12,9 @@ export const MenuItem = forwardRef(({ className, children, onClick, icon, dimens
|
|
|
12
12
|
const triggerClick = useCallback((e) => {
|
|
13
13
|
if (onClick) {
|
|
14
14
|
handleClick();
|
|
15
|
-
onClick(e);
|
|
15
|
+
onClick(e, value);
|
|
16
16
|
}
|
|
17
|
-
}, [handleClick, onClick]);
|
|
17
|
+
}, [handleClick, onClick, value]);
|
|
18
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 })), _jsxs(Stack, { className: styles.DecorationContent, columnGap: 16, fill: false, direction: "row", hAlign: "space-between", children: [children, decoration] })] })), [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 }))
|
|
@@ -7,6 +7,10 @@ export declare type MenuProps = HTMLAttributes<HTMLUListElement> & {
|
|
|
7
7
|
* The items of the menu.
|
|
8
8
|
*/
|
|
9
9
|
children: ReactNode;
|
|
10
|
+
/**
|
|
11
|
+
* Set a maximum height of the menu after which it will scroll.
|
|
12
|
+
*/
|
|
13
|
+
maxHeight?: string;
|
|
10
14
|
};
|
|
11
15
|
declare type MenuComponent = ForwardRefExoticComponent<MenuProps> & {
|
|
12
16
|
Item: Polymorphic.ForwardRefComponent<Polymorphic.IntrinsicElement<typeof MenuItem>, Polymorphic.OwnProps<typeof MenuItem> & MenuItemProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu.d.ts","sourceRoot":"","sources":["../../../src/components/menu/menu.tsx"],"names":[],"mappings":"AACA,OAAO,EAAwB,SAAS,EAAE,cAAc,EAAE,yBAAyB,
|
|
1
|
+
{"version":3,"file":"menu.d.ts","sourceRoot":"","sources":["../../../src/components/menu/menu.tsx"],"names":[],"mappings":"AACA,OAAO,EAAwB,SAAS,EAAE,cAAc,EAAE,yBAAyB,EAAiB,MAAM,OAAO,CAAA;AAEjH,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAC/D,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAA;AACxF,OAAO,EAAmB,WAAW,EAAE,MAAM,cAAc,CAAA;AAI3D,oBAAY,SAAS,GAAG,cAAc,CAAC,gBAAgB,CAAC,GAAG;IACzD;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAA;AAED,aAAK,aAAa,GAAG,yBAAyB,CAAC,SAAS,CAAC,GAAG;IAC1D,IAAI,EAAE,WAAW,CAAC,mBAAmB,CACnC,WAAW,CAAC,gBAAgB,CAAC,OAAO,QAAQ,CAAC,EAC7C,WAAW,CAAC,QAAQ,CAAC,OAAO,QAAQ,CAAC,GAAG,aAAa,CACtD,CAAC;IACF,YAAY,EAAE,WAAW,CAAC,mBAAmB,CAC3C,WAAW,CAAC,gBAAgB,CAAC,OAAO,gBAAgB,CAAC,EACrD,WAAW,CAAC,QAAQ,CAAC,OAAO,gBAAgB,CAAC,GAAG,qBAAqB,CACtE,CAAC;CACH,CAAA;AAED,eAAO,MAAM,IAAI,eAmCE,CAAA"}
|
|
@@ -6,9 +6,12 @@ import { MenuItemCheckbox } from './menu-item/menu-item-checkbox';
|
|
|
6
6
|
import { Stack, Elevator } from '../..';
|
|
7
7
|
import styles from './menu.module.css';
|
|
8
8
|
import clsx from 'clsx';
|
|
9
|
-
export const Menu = forwardRef(({ className, children, ...otherProps }, forwardedRef) => {
|
|
9
|
+
export const Menu = forwardRef(({ className, children, maxHeight, style, ...otherProps }, forwardedRef) => {
|
|
10
10
|
const renderedChildren = Children.toArray(children).filter(Boolean);
|
|
11
|
-
|
|
11
|
+
const computedStyle = {
|
|
12
|
+
'--max-height': maxHeight
|
|
13
|
+
};
|
|
14
|
+
return (_jsx(Elevator, { resting: 2, children: _jsx(Stack, { as: "ul", ref: forwardedRef, className: clsx(styles.Menu, className), style: { ...computedStyle, ...style }, "data-menu-should-scroll": Boolean(maxHeight), 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 }))) }) }) }));
|
|
12
15
|
});
|
|
13
16
|
Menu.displayName = 'Menu';
|
|
14
17
|
Menu.Item = MenuItem;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.Menu{background-color:var(--global-background);border:1px solid var(--dimmed-1);border-radius:.44rem;list-style-type:none;overflow:hidden;position:relative}.Menu hr{margin:0 .44rem}
|
|
1
|
+
.Menu{background-color:var(--global-background);border:1px solid var(--dimmed-1);border-radius:.44rem;list-style-type:none;overflow:hidden;position:relative}.Menu hr{margin:0 .44rem}.Menu[data-menu-should-scroll=true]{-webkit-overflow-scrolling:touch;max-height:var(--max-height);overflow:auto;overscroll-behavior:contain}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.Slider svg{flex-shrink:0}.Input{--track-color:var(--global-vibrancy-background);--progress-color:var(--dimmed-3);--thumb-size:24px;--progress-direction:calc(-9999px - var(--thumb-size)/2);-webkit-appearance:none;appearance:none;background:transparent;border-radius:100px;height:var(--thumb-size);overflow:hidden;width:100%}[dir=rtl] .Input{--progress-direction:calc(9999px + var(--thumb-size)/2)}.Slider[data-slider-dimension=small] .Input{--thumb-size:16px}.Input::-webkit-slider-runnable-track{background:var(--track-color);cursor:pointer;height:var(--thumb-size);-webkit-transition:background-color .2s ease-out;transition:background-color .2s ease-out;width:100%}.Input::-moz-range-track{background:var(--track-color);cursor:pointer;height:var(--thumb-size);-moz-transition:background-color .2s ease-out;transition:background-color .2s ease-out;width:100%}.Input::-moz-focus-outer{border:0}.Input::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;background-color:var(--dimmed-7);border:0;border-radius:100%;box-shadow:var(--progress-direction) 0 0 9999px var(--progress-color);height:var(--thumb-size);outline-offset:-2px;-webkit-transition:box-shadow .1s ease-out,background-color .1s ease-out;transition:box-shadow .1s ease-out,background-color .1s ease-out;width:var(--thumb-size)}.Input::-webkit-slider-thumb
|
|
1
|
+
.Slider svg{flex-shrink:0}.Input{--track-color:var(--global-vibrancy-background);--progress-color:var(--dimmed-3);--thumb-size:24px;--progress-direction:calc(-9999px - var(--thumb-size)/2);-webkit-appearance:none;appearance:none;background:transparent;border-radius:100px;height:var(--thumb-size);overflow:hidden;width:100%}[dir=rtl] .Input{--progress-direction:calc(9999px + var(--thumb-size)/2)}.Slider[data-slider-dimension=small] .Input{--thumb-size:16px}.Input::-webkit-slider-runnable-track{background:var(--track-color);cursor:pointer;height:var(--thumb-size);-webkit-transition:background-color .2s ease-out;transition:background-color .2s ease-out;width:100%}.Input::-moz-range-track{background:var(--track-color);cursor:pointer;height:var(--thumb-size);-moz-transition:background-color .2s ease-out;transition:background-color .2s ease-out;width:100%}.Input::-moz-focus-outer{border:0}.Input::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;background-color:var(--dimmed-7);border:0;border-radius:100%;box-shadow:var(--progress-direction) 0 0 9999px var(--progress-color);height:var(--thumb-size);outline-offset:-2px;-webkit-transition:box-shadow .1s ease-out,background-color .1s ease-out;transition:box-shadow .1s ease-out,background-color .1s ease-out;width:var(--thumb-size)}.Input:active::-webkit-slider-thumb,.Input:focus::-webkit-slider-thumb{background-color:var(--dimmed-6)}.Input::-moz-range-thumb{appearance:none;background-color:var(--dimmed-7);border:0;border-radius:100%;box-shadow:var(--progress-direction) 0 0 9999px var(--progress-color);height:var(--thumb-size);outline-offset:-2px;-moz-transition:box-shadow .1s ease-out,background-color .1s ease-out;transition:box-shadow .1s ease-out,background-color .1s ease-out;width:var(--thumb-size)}.Input:active::-moz-range-thumb,.Input:focus::-moz-range-thumb{background-color:var(--dimmed-6)}.Input:active::-webkit-slider-thumb{background-color:var(--dimmed-7);box-shadow:var(--progress-direction) 0 0 9999px var(--progress-color);cursor:grabbing}.Input:active::-moz-range-thumb{background-color:var(--dimmed-7);box-shadow:var(--progress-direction) 0 0 9999px var(--progress-color);cursor:grabbing}.Input:disabled::-webkit-slider-runnable-track{background:var(--global-disabled-background);cursor:not-allowed}.Input:disabled::-moz-range-track{background:var(--global-disabled-background);cursor:not-allowed}.Input:disabled::-webkit-slider-thumb{background:none var(--global-disabled-foreground);box-shadow:var(--progress-direction) 0 0 9999px transparent;cursor:not-allowed}.Input:disabled::-moz-range-thumb{background:none var(--global-disabled-foreground);box-shadow:var(--progress-direction) 0 0 9999px transparent;cursor:not-allowed}.CurrentValue,.Value{flex-shrink:0}
|
|
@@ -31,6 +31,6 @@ export declare type TabProps = PropsWithChildren<PropsWithClass> & {
|
|
|
31
31
|
};
|
|
32
32
|
export declare const Tab: {
|
|
33
33
|
({ className, children, onValueChange, defaultValue, loop, ...otherProps }: TabProps): JSX.Element;
|
|
34
|
-
Panel: ({ children, label, ...otherProps }: import("./tabs-panel").TabPanelProps) => JSX.Element;
|
|
34
|
+
Panel: ({ className, children, label, ...otherProps }: import("./tabs-panel").TabPanelProps) => JSX.Element;
|
|
35
35
|
};
|
|
36
36
|
//# sourceMappingURL=tab.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tab.d.ts","sourceRoot":"","sources":["../../../src/components/tab/tab.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,aAAa,MAAM,sBAAsB,CAAA;AAErD,OAAO,EACqB,iBAAiB,EAC5C,MAAM,OAAO,CAAA;AAQd,oBAAY,QAAQ,GAAG,iBAAiB,CAAC,cAAc,CAAC,GAAG;IACzD;;OAEG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACzC;;OAEG;IACH,YAAY,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IACvD;;OAEG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;IACzD;;;OAGG;IACH,GAAG,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACrC;;;OAGG;IACH,cAAc,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;IAC3D;;;OAGG;IACH,IAAI,CAAC,EAAE,aAAa,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;CAC5C,CAAC;AAEF,eAAO,MAAM,GAAG;gFAOb,QAAQ;;
|
|
1
|
+
{"version":3,"file":"tab.d.ts","sourceRoot":"","sources":["../../../src/components/tab/tab.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,aAAa,MAAM,sBAAsB,CAAA;AAErD,OAAO,EACqB,iBAAiB,EAC5C,MAAM,OAAO,CAAA;AAQd,oBAAY,QAAQ,GAAG,iBAAiB,CAAC,cAAc,CAAC,GAAG;IACzD;;OAEG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACzC;;OAEG;IACH,YAAY,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IACvD;;OAEG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;IACzD;;;OAGG;IACH,GAAG,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACrC;;;OAGG;IACH,cAAc,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;IAC3D;;;OAGG;IACH,IAAI,CAAC,EAAE,aAAa,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;CAC5C,CAAC;AAEF,eAAO,MAAM,GAAG;gFAOb,QAAQ;;CAwCV,CAAA"}
|
|
@@ -13,6 +13,6 @@ export const Tab = ({ className, children, onValueChange, defaultValue, loop, ..
|
|
|
13
13
|
onValueChange?.(value);
|
|
14
14
|
setActiveItem(value);
|
|
15
15
|
}, [onValueChange]);
|
|
16
|
-
return (_jsxs(TabsPrimitive.Root, { defaultValue: defaultValue, onValueChange: handleOnVlaueChange, ...otherProps, children: [_jsx(LazyMotion, { features: domMax, strict: true, children: _jsx(TabsPrimitive.List, { className: styles.List, loop: loop, children: Children.map(children, child => isValidElement(child) && (_jsx(TabsPrimitive.Trigger, { value: child.props.value, disabled: child.props.disabled, className: styles.Trigger, asChild: true, children: _jsxs(Button, { kind: "flat", icon: child.props.icon, children: [child.props.label, (child.props.value === activeItem) && 'active' && (_jsx(m.span, { className: styles.Highlight, layoutId: uid('tab-highlight') }))] }) }))) }) }), children] }));
|
|
16
|
+
return (_jsxs(TabsPrimitive.Root, { defaultValue: defaultValue, onValueChange: handleOnVlaueChange, className: className, ...otherProps, children: [_jsx(LazyMotion, { features: domMax, strict: true, children: _jsx(TabsPrimitive.List, { className: styles.List, loop: loop, children: Children.map(children, child => isValidElement(child) && (_jsx(TabsPrimitive.Trigger, { value: child.props.value, disabled: child.props.disabled, className: styles.Trigger, asChild: true, children: _jsxs(Button, { kind: "flat", icon: child.props.icon, children: [child.props.label, (child.props.value === activeItem) && 'active' && (_jsx(m.span, { className: styles.Highlight, layoutId: uid('tab-highlight') }))] }) }))) }) }), children] }));
|
|
17
17
|
};
|
|
18
18
|
Tab.Panel = TabPanel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.List{--separator-size:2px;
|
|
1
|
+
.List{--separator-size:2px;box-shadow:inset 0 calc(var(--separator-size)*-1) 0 var(--dimmed-1);overflow:auto;white-space:nowrap}.Trigger{-webkit-appearance:none;appearance:none;background:none;background-color:transparent;block-size:2.67rem;border:0;border-radius:0;color:var(--dimmed-6);flex-shrink:0;font-family:inherit;font-size:inherit;font-weight:token(--font-weight-semi-bold);outline-offset:calc(var(--separator-size)*-1);overflow:unset;padding:.44rem .89rem;position:relative;white-space:nowrap}.Trigger,.Trigger:not([aria-disabled=true]){-webkit-backdrop-filter:none;backdrop-filter:none}.Trigger:not([aria-disabled=true]){color:var(--dimmed-5)}.Trigger.Trigger:not([aria-disabled=true]):is(:hover,:focus,:active){-webkit-backdrop-filter:none;backdrop-filter:none;background:none;color:var(--global-foreground)}.Trigger.Trigger[aria-disabled=true]{-webkit-backdrop-filter:none;backdrop-filter:none;background:none}.Trigger[data-state=active]{-webkit-text-stroke:.4px var(--global-foreground);color:var(--global-foreground)}.Highlight{background:var(--cta-default);border-radius:2px 2px 0 0;bottom:0;height:4px;pointer-events:none;position:absolute;width:100%}.Panel{animation:fade-in .2s;animation-timing-function:cubic-bezier(0,0,.34,1))}@keyframes fade-in{0%{opacity:0;transform:translate(var(--fade-from-x,0),var(--fade-from-y,0))}to{opacity:unset;transform:none}}
|
|
@@ -6,5 +6,5 @@ export declare type TabPanelProps = PropsWithChildren<PropsWithClass> & {
|
|
|
6
6
|
icon?: IconProps['source'];
|
|
7
7
|
value: TabsPrimitive.TabsContentProps['value'];
|
|
8
8
|
};
|
|
9
|
-
export declare const TabPanel: ({ children, label, ...otherProps }: TabPanelProps) => JSX.Element;
|
|
9
|
+
export declare const TabPanel: ({ className, children, label, ...otherProps }: TabPanelProps) => JSX.Element;
|
|
10
10
|
//# sourceMappingURL=tabs-panel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs-panel.d.ts","sourceRoot":"","sources":["../../../src/components/tab/tabs-panel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,aAAa,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAGxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"tabs-panel.d.ts","sourceRoot":"","sources":["../../../src/components/tab/tabs-panel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,aAAa,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAGxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAGzC,oBAAY,aAAa,GAAG,iBAAiB,CAAC,cAAc,CAAC,GAAG;IAC9D,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;IAC3B,KAAK,EAAE,aAAa,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;CAChD,CAAC;AAEF,eAAO,MAAM,QAAQ,kDAKlB,aAAa,gBAQf,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import * as TabsPrimitive from '@radix-ui/react-tabs';
|
|
3
3
|
import styles from './tab.module.css';
|
|
4
|
-
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
export const TabPanel = ({ className, children, label, ...otherProps }) => (_jsx(TabsPrimitive.Content, { className: clsx(styles.Panel, className), "data-tabs-label": label, ...otherProps, children: children }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggle-columns.d.ts","sourceRoot":"","sources":["../../../../src/components/table/table-controls/toggle-columns.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAA;AAEnD,aAAK,yBAAyB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;IAClE,OAAO,EAAE,KAAK,CAAC,wBAAwB,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5C,cAAc,EAAE,KAAK,CAAC,wBAAwB,CAAC,CAAC,CAAC,CAAC,CAAC;CACpD,CAAA;AAED,eAAO,MAAM,oBAAoB,+
|
|
1
|
+
{"version":3,"file":"toggle-columns.d.ts","sourceRoot":"","sources":["../../../../src/components/table/table-controls/toggle-columns.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAA;AAEnD,aAAK,yBAAyB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;IAClE,OAAO,EAAE,KAAK,CAAC,wBAAwB,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5C,cAAc,EAAE,KAAK,CAAC,wBAAwB,CAAC,CAAC,CAAC,CAAC,CAAC;CACpD,CAAA;AAED,eAAO,MAAM,oBAAoB,+GAuDhC,CAAA"}
|
|
@@ -19,5 +19,5 @@ export const ToggleColumnsControl = ({ columns, visibleColumns }) => {
|
|
|
19
19
|
*/
|
|
20
20
|
filteredColumns.forEach(col => col.toggleHidden(false));
|
|
21
21
|
}, [someVisibleColums, filteredColumns, visibleColumns]);
|
|
22
|
-
return (_jsx(Popover, { placement: "bottom-start", trigger: _jsx(Button, { kind: "secondary", children: "Toggle columns" }), children: _jsxs(Menu, { children: [_jsx(Menu.ItemCheckbox, { onClick: () => handleToggleAll(), checked: true, icon: visibleColumns.length === 0 ? 'check' : 'minus', children: "Toggle All" }), columns.filter(col => !col.isToggable).map((column, i) => (_jsx(Menu.ItemCheckbox, { autoFocus: i === 0, checked: column.isVisible, icon: column.isVisible ? 'check' : undefined, onClick: () => column.toggleHidden(), children: column.render('Header') }, column.id)))] }) }));
|
|
22
|
+
return (_jsx(Popover, { placement: "bottom-start", trigger: _jsx(Button, { kind: "secondary", children: "Toggle columns" }), children: _jsxs(Menu, { maxHeight: "350px", children: [_jsx(Menu.ItemCheckbox, { value: "toggle-all", onClick: () => handleToggleAll(), checked: true, icon: visibleColumns.length === 0 ? 'check' : 'minus', children: "Toggle All" }), columns.filter(col => !col.isToggable).map((column, i) => (_jsx(Menu.ItemCheckbox, { value: column.id, autoFocus: i === 0, checked: column.isVisible, icon: column.isVisible ? 'check' : undefined, onClick: () => column.toggleHidden(), children: column.render('Header') }, column.id)))] }) }));
|
|
23
23
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComponentType, ReactNode } from 'react';
|
|
2
|
-
import { IdType, SortingRule } from 'react-table';
|
|
2
|
+
import { IdType, Row, SortingRule } from 'react-table';
|
|
3
3
|
import { TableHeaderProps } from './table-header';
|
|
4
4
|
import { TablePaginationProps } from './table-pagination';
|
|
5
5
|
import { CustomColumnsType, OptionalDataTypes, CustomSortingRule, PaginationPageType } from './types';
|
|
@@ -57,11 +57,11 @@ export declare type TableProps<T extends Record<string, unknown>> = PropsWithCla
|
|
|
57
57
|
/**
|
|
58
58
|
* Set the label for selected items in the table. Default to "Selected items"
|
|
59
59
|
*/
|
|
60
|
-
selectedLabel?: (selectedRowIds: Array<
|
|
60
|
+
selectedLabel?: (selectedRowIds: Array<Row<T>>) => ReactNode;
|
|
61
61
|
/**
|
|
62
62
|
* Pass custom components to show when rows are selected.
|
|
63
63
|
*/
|
|
64
|
-
selectedActions?: (
|
|
64
|
+
selectedActions?: (selectedRows: Array<Row<T>>) => ReactNode;
|
|
65
65
|
/**
|
|
66
66
|
* Set the table height after which the table will scroll.
|
|
67
67
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../src/components/table/table.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,aAAa,EAA2B,SAAS,EAClD,MAAM,OAAO,CAAA;AACd,OAAO,EACE,MAAM,
|
|
1
|
+
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../src/components/table/table.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,aAAa,EAA2B,SAAS,EAClD,MAAM,OAAO,CAAA;AACd,OAAO,EACE,MAAM,EAAE,GAAG,EAEiB,WAAW,EAC/C,MAAM,aAAa,CAAA;AAcpB,OAAO,EAAe,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAC9D,OAAO,EAAmB,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AAE1E,OAAO,EAC+B,iBAAiB,EACpC,iBAAiB,EAAE,iBAAiB,EAAE,kBAAkB,EAC1E,MAAM,SAAS,CAAA;AAEhB,oBAAY,UAAU,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,cAAc,GAAG;IAC3E;;OAEG;IACH,OAAO,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC;IAC9B;;OAEG;IACH,IAAI,EAAE,KAAK,CAAC,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC;IACtC;;OAEG;IACH,oBAAoB,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IACxC;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;OAEG;IACH,KAAK,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAClC;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;OAEG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,CAAC,cAAc,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC;IAC5D;;MAEE;IACH,eAAe,CAAC,EAAE,CAAC,YAAY,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC;IAC7D;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;OAKG;IACH,sBAAsB,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;IAC1C;;;OAGG;IACH,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IACzB;;OAEG;IACJ,YAAY,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACJ,SAAS,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACJ,YAAY,CAAC,EAAE,oBAAoB,CAAC,UAAU,CAAC,CAAC;IAC/C;;;;OAIG;IACJ,kBAAkB,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,kBAAkB,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAC3F;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACxB;;MAEE;IACH,aAAa,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IACrC;;OAEG;IACJ,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;CAC/D,CAAA;AAED,eAAO,MAAM,KAAK,geA6VjB,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
import { domMax, LazyMotion, m, AnimatePresence } from 'framer-motion';
|
|
4
|
-
import { Fragment, useCallback, useMemo } from 'react';
|
|
4
|
+
import { Fragment, useCallback, useEffect, useMemo } from 'react';
|
|
5
5
|
import { useExpanded, usePagination, useRowSelect, useSortBy, useTable } from 'react-table';
|
|
6
6
|
import { useUIDSeed } from 'react-uid';
|
|
7
7
|
import { useUpdateEffect } from 'ahooks';
|
|
@@ -28,7 +28,7 @@ export const Table = ({ className, style, columns, data = [], selectableRows, st
|
|
|
28
28
|
return hiddenColumns;
|
|
29
29
|
}, [defaultHiddenColumns, selectableRows, hasSomeExpandableRows]);
|
|
30
30
|
const getRowId = useCallback((originalRow, relativeIndex, parent) => originalRow?._id || (parent && [parent.id, relativeIndex].join('.')) || relativeIndex.toString(), []);
|
|
31
|
-
const { getTableProps, getTableBodyProps, headerGroups, rows, page, pageCount, gotoPage, allColumns, prepareRow,
|
|
31
|
+
const { getTableProps, getTableBodyProps, headerGroups, rows, page, pageCount, gotoPage, allColumns, prepareRow, visibleColumns, setPageSize, setHiddenColumns, selectedFlatRows, state: { pageSize, pageIndex, sortBy } } = useTable({
|
|
32
32
|
columns,
|
|
33
33
|
data,
|
|
34
34
|
getRowId,
|
|
@@ -40,7 +40,6 @@ export const Table = ({ className, style, columns, data = [], selectableRows, st
|
|
|
40
40
|
autoResetHiddenColumns: false,
|
|
41
41
|
autoResetPage: false,
|
|
42
42
|
autoResetSortBy: false,
|
|
43
|
-
autoResetSelectedRows: false,
|
|
44
43
|
/**
|
|
45
44
|
* This `paginateExpandedRows` prop prevent expanded rows to
|
|
46
45
|
* be placed in the next page. But it breaks row selection
|
|
@@ -67,7 +66,7 @@ export const Table = ({ className, style, columns, data = [], selectableRows, st
|
|
|
67
66
|
minWidth: 40,
|
|
68
67
|
align: 'center',
|
|
69
68
|
Cell: ({ row }) => (row.canExpand
|
|
70
|
-
? (_jsx(ToggleButton, { kind: "
|
|
69
|
+
? (_jsx(ToggleButton, { kind: "flat", dimension: "small", restingIcon: "chevron-right", pressedIcon: "chevron-down", ...row.getToggleRowExpandedProps(), onClick: () => {
|
|
71
70
|
const subRowsExpanded = row.subRows.filter(r => r.isExpanded);
|
|
72
71
|
subRowsExpanded.forEach(r => r.toggleRowExpanded(!r.isExpanded));
|
|
73
72
|
row.toggleRowExpanded(!row.isExpanded);
|
|
@@ -93,6 +92,11 @@ export const Table = ({ className, style, columns, data = [], selectableRows, st
|
|
|
93
92
|
useUpdateEffect(() => {
|
|
94
93
|
onPaginationChange?.({ pageIndex, pageSize });
|
|
95
94
|
}, [onPaginationChange, pageIndex, pageSize]);
|
|
95
|
+
useEffect(() => {
|
|
96
|
+
if (pageIndex >= pageCount) {
|
|
97
|
+
gotoPage(0);
|
|
98
|
+
}
|
|
99
|
+
}, [pageCount, pageIndex, gotoPage]);
|
|
96
100
|
const rowEntries = useMemo(() => {
|
|
97
101
|
return (showPagination ? page : rows);
|
|
98
102
|
}, [page, rows, showPagination]);
|
|
@@ -102,7 +106,7 @@ export const Table = ({ className, style, columns, data = [], selectableRows, st
|
|
|
102
106
|
'--table-height': height,
|
|
103
107
|
'--table-background': background
|
|
104
108
|
};
|
|
105
|
-
return (_jsxs("div", { className: clsx(styles.Table, className), style: { ...dynamicStyle, ...style }, children: [_jsx(AnimatePresence, { children: _jsxs(LazyMotion, { features: domMax, children: [!!
|
|
109
|
+
return (_jsxs("div", { className: clsx(styles.Table, className), style: { ...dynamicStyle, ...style }, children: [_jsx(AnimatePresence, { children: _jsxs(LazyMotion, { features: domMax, children: [!!selectedFlatRows.length && selectableRows && (_jsxs(Stack, { as: m.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: {
|
|
106
110
|
y: 0,
|
|
107
111
|
opacity: 1,
|
|
108
112
|
transition: {
|
|
@@ -110,9 +114,9 @@ export const Table = ({ className, style, columns, data = [], selectableRows, st
|
|
|
110
114
|
stiffness: 700,
|
|
111
115
|
damping: 30
|
|
112
116
|
}
|
|
113
|
-
}, exit: { y: '-16px', opacity: 0 }, children: [_jsx(Text, { as: "span", size: 14, weight: "bold", children: selectedLabel(
|
|
114
|
-
y: selectedFlatRows
|
|
115
|
-
opacity: selectedFlatRows
|
|
117
|
+
}, exit: { y: '-16px', opacity: 0 }, children: [_jsx(Text, { as: "span", size: 14, weight: "bold", children: selectedLabel(selectedFlatRows) }), selectedActions?.(selectedFlatRows)] })), (showHeader || selectableRows) && (_jsx(m.div, { animate: {
|
|
118
|
+
y: selectedFlatRows.length ? 20 : 0,
|
|
119
|
+
opacity: selectedFlatRows.length ? 0 : 1,
|
|
116
120
|
transition: {
|
|
117
121
|
type: 'spring',
|
|
118
122
|
stiffness: 700,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.BaseField{-webkit-appearance:none;appearance:none;background-color:var(--global-background);block-size:var(--field-height);border:1px solid var(--dimmed-2);border-radius:.22rem;box-sizing:border-box;caret-color:var(--cta-default);color:inherit;display:flex;font-family:inherit;font-size:var(--font-size);inline-size:100%;line-height:1;margin:0;outline-offset:2px;overflow:hidden;padding:0 var(--field-padding);text-overflow:ellipsis}[data-textfield-has-icon=true] .BaseField::-webkit-calendar-picker-indicator{opacity:0;position:absolute;right:calc(var(--field-padding)/2)}.BaseField:-moz-ui-invalid{box-shadow:none}.BaseField::placeholder{color:var(--dimmed-5)}.BaseField:focus-visible{border-color:var(--dimmed-5)}.BaseField:disabled{background:linear-gradient(to bottom,var(--global-disabled-background),var(--global-disabled-background));border-color:transparent;color:var(--global-disabled-foreground);cursor:not-allowed}.BaseField:disabled::placeholder{color:var(--dimmed-6)}.BaseField[readonly]{border-style:dashed;box-shadow:none;cursor:default}.BaseField:-webkit-autofill,.BaseField:-webkit-autofill:active,.BaseField:-webkit-autofill:focus,.BaseField:-webkit-autofill:hover{-webkit-text-fill-color:var(--global-vibrancy-foreground);border:1px solid var(--dimmed-2);box-shadow:0 0 0 100px var(--global-background) inset}:is(.BaseField:-webkit-autofill,.BaseField:-webkit-autofill:hover,.BaseField:-webkit-autofill:focus,.BaseField:-webkit-autofill:active)::selection{-webkit-text-fill-color:var(--dimmed-0)}.BaseField:is(:invalid,[data-basefield-invalid=true],:out-of-range),.BaseField:is(:invalid,[data-basefield-invalid=true],:out-of-range):focus-visible{border-color:var(--highlight-red-foreground)}.BaseField[type=number]{-webkit-appearance:textfield;appearance:textfield}.BaseField[type=number]::-webkit-inner-spin-button,.BaseField[type=number]::-webkit-outer-spin-button{display:none}.BaseField[type=search]{-webkit-appearance:none;appearance:none}.BaseField[type=search]::-webkit-search-cancel-button,.BaseField[type=search]::-webkit-search-decoration{-webkit-appearance:none;appearance:none}textarea.BaseField{block-size:auto;line-height:1.5;min-block-size:1.78rem;padding:calc(var(--field-padding)/2) calc(var(--field-padding) + .89rem) calc(var(--field-padding)/2) var(--field-padding);resize:vertical}textarea.BaseField::-webkit-datetime-edit-text{opacity:.3}textarea.BaseField::-webkit-calendar-picker-indicator{color:var(--global-foreground)}textarea.BaseField:-moz-ui-invalid{box-shadow:none}textarea.BaseField::-webkit-calendar-picker-indicator
|
|
1
|
+
.BaseField{-webkit-appearance:none;appearance:none;background-color:var(--global-background);block-size:var(--field-height);border:1px solid var(--dimmed-2);border-radius:.22rem;box-sizing:border-box;caret-color:var(--cta-default);color:inherit;display:flex;font-family:inherit;font-size:var(--font-size);inline-size:100%;line-height:1;margin:0;outline-offset:2px;overflow:hidden;padding:0 var(--field-padding);text-overflow:ellipsis}[data-textfield-has-icon=true] .BaseField::-webkit-calendar-picker-indicator{opacity:0;position:absolute;right:calc(var(--field-padding)/2)}.BaseField:-moz-ui-invalid{box-shadow:none}.BaseField::placeholder{color:var(--dimmed-5)}.BaseField:focus-visible{border-color:var(--dimmed-5)}.BaseField:disabled{background:linear-gradient(to bottom,var(--global-disabled-background),var(--global-disabled-background));border-color:transparent;color:var(--global-disabled-foreground);cursor:not-allowed}.BaseField:disabled::placeholder{color:var(--dimmed-6)}.BaseField[readonly]{border-style:dashed;box-shadow:none;cursor:default}.BaseField:-webkit-autofill,.BaseField:-webkit-autofill:active,.BaseField:-webkit-autofill:focus,.BaseField:-webkit-autofill:hover{-webkit-text-fill-color:var(--global-vibrancy-foreground);border:1px solid var(--dimmed-2);box-shadow:0 0 0 100px var(--global-background) inset}:is(.BaseField:-webkit-autofill,.BaseField:-webkit-autofill:hover,.BaseField:-webkit-autofill:focus,.BaseField:-webkit-autofill:active)::selection{-webkit-text-fill-color:var(--dimmed-0)}.BaseField:is(:invalid,[data-basefield-invalid=true],:out-of-range),.BaseField:is(:invalid,[data-basefield-invalid=true],:out-of-range):focus-visible{border-color:var(--highlight-red-foreground)}.BaseField[type=number]{-webkit-appearance:textfield;appearance:textfield}.BaseField[type=number]::-webkit-inner-spin-button,.BaseField[type=number]::-webkit-outer-spin-button{display:none}.BaseField[type=search]{-webkit-appearance:none;appearance:none}.BaseField[type=search]::-webkit-search-cancel-button,.BaseField[type=search]::-webkit-search-decoration{-webkit-appearance:none;appearance:none}textarea.BaseField{block-size:auto;line-height:1.5;min-block-size:1.78rem;padding:calc(var(--field-padding)/2) calc(var(--field-padding) + .89rem) calc(var(--field-padding)/2) var(--field-padding);resize:vertical}textarea.BaseField::-webkit-datetime-edit-text{opacity:.3}textarea.BaseField::-webkit-calendar-picker-indicator{color:var(--global-foreground)}textarea.BaseField:-moz-ui-invalid{box-shadow:none}textarea.BaseField:hover::-webkit-calendar-picker-indicator{background-color:transparent}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wonderflow/react-components",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.3.0",
|
|
4
4
|
"description": "UI components from Wonderflow's Wanda design system",
|
|
5
5
|
"author": "Wonderflow",
|
|
6
6
|
"license": "MIT",
|
|
@@ -56,24 +56,24 @@
|
|
|
56
56
|
"react-dom": "^17.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@babel/core": "7.17.
|
|
59
|
+
"@babel/core": "7.17.9",
|
|
60
60
|
"@babel/preset-typescript": "7.16.7",
|
|
61
|
-
"@storybook/addon-actions": "6.4.
|
|
62
|
-
"@storybook/addon-essentials": "6.4.
|
|
63
|
-
"@storybook/addon-links": "6.4.
|
|
61
|
+
"@storybook/addon-actions": "6.4.22",
|
|
62
|
+
"@storybook/addon-essentials": "6.4.22",
|
|
63
|
+
"@storybook/addon-links": "6.4.22",
|
|
64
64
|
"@storybook/addon-postcss": "2.0.0",
|
|
65
65
|
"@storybook/addons": "6.5.0-alpha.21",
|
|
66
66
|
"@storybook/builder-webpack5": "6.5.0-alpha.21",
|
|
67
67
|
"@storybook/manager-webpack5": "6.5.0-alpha.21",
|
|
68
|
-
"@storybook/react": "6.4.
|
|
68
|
+
"@storybook/react": "6.4.22",
|
|
69
69
|
"@storybook/theming": "6.5.0-alpha.21",
|
|
70
70
|
"@types/react": "17.0.43",
|
|
71
71
|
"@types/react-dom": "17.0.14",
|
|
72
|
-
"@types/react-table": "7.7.
|
|
72
|
+
"@types/react-table": "7.7.11",
|
|
73
73
|
"@wonderflow/config": "*",
|
|
74
74
|
"@wonderflow/stylelint-config": "1.1.4",
|
|
75
75
|
"@wonderflow/tokens": "*",
|
|
76
|
-
"babel-loader": "8.2.
|
|
76
|
+
"babel-loader": "8.2.5",
|
|
77
77
|
"cpy-cli": "3.1.1",
|
|
78
78
|
"postcss": "8.4.12",
|
|
79
79
|
"postcss-cli": "9.1.0",
|
|
@@ -87,16 +87,16 @@
|
|
|
87
87
|
},
|
|
88
88
|
"dependencies": {
|
|
89
89
|
"@radix-ui/react-tabs": "0.1.5",
|
|
90
|
-
"ahooks": "3.3.
|
|
90
|
+
"ahooks": "3.3.10",
|
|
91
91
|
"clsx": "1.1.1",
|
|
92
|
-
"framer-motion": "6.2
|
|
92
|
+
"framer-motion": "6.3.2",
|
|
93
93
|
"react-focus-on": "3.5.4",
|
|
94
94
|
"react-masonry-css": "1.0.16",
|
|
95
|
-
"react-paginate": "8.1.
|
|
95
|
+
"react-paginate": "8.1.3",
|
|
96
96
|
"react-popper-tooltip": "4.3.1",
|
|
97
|
-
"react-roving-tabindex": "3.
|
|
97
|
+
"react-roving-tabindex": "3.2.0",
|
|
98
98
|
"react-table": "7.7.0",
|
|
99
|
-
"react-uid": "2.3.
|
|
100
|
-
"type-fest": "2.12.
|
|
99
|
+
"react-uid": "2.3.2",
|
|
100
|
+
"type-fest": "2.12.2"
|
|
101
101
|
}
|
|
102
102
|
}
|