@wonderflow/react-components 2.39.3 → 2.39.5-next.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/avatar/avatar.js +2 -3
- package/button/button.d.ts +4 -4
- package/button/button.js +4 -5
- package/button/button.module.css +6 -6
- package/card/card.d.ts +1 -1
- package/card/card.js +2 -2
- package/chip/chip.d.ts +10 -3
- package/chip/chip.js +2 -3
- package/circular-progress/circular-progress.js +2 -3
- package/clamp-text/clamp-text.d.ts +1 -1
- package/clamp-text/clamp-text.js +2 -3
- package/container/container.js +2 -3
- package/core/typography.css +1 -6
- package/core.css +5 -1
- package/disclosure/disclosure.js +3 -4
- package/dropdown/dropdown-item.d.ts +1 -1
- package/dropdown/dropdown-item.js +0 -2
- package/dropdown/dropdown-menu.d.ts +3 -3
- package/dropdown/dropdown-menu.js +3 -5
- package/dropdown/dropdown.js +0 -1
- package/elevator/elevator.d.ts +2 -2
- package/grid/grid-item.js +2 -2
- package/grid/grid.js +2 -3
- package/icon/icon.js +2 -2
- package/icon-button/icon-button.d.ts +1 -1
- package/icon-button/icon-button.js +1 -2
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/info-state/info-state.d.ts +12 -3
- package/info-state/info-state.js +2 -3
- package/input-group/input-group.js +3 -4
- package/input-group/input-group.module.css +0 -3
- package/linear-progress/linear-progress.d.ts +4 -4
- package/linear-progress/linear-progress.js +3 -4
- package/list/list.d.ts +1 -1
- package/list/list.js +2 -3
- package/masonry/masonry.d.ts +2 -2
- package/masonry/masonry.js +2 -2
- package/modal/modal-content.js +2 -3
- package/modal/modal.js +6 -8
- package/package.json +15 -16
- package/pagination/pagination.d.ts +2 -4
- package/pagination/pagination.js +2 -2
- package/prose/prose.js +2 -3
- package/select/select.js +2 -3
- package/selection-controls/checkbox.js +2 -3
- package/selection-controls/radio.js +2 -3
- package/selection-controls/toggle.js +2 -3
- package/separator/index.d.ts +2 -1
- package/separator/index.js +1 -1
- package/separator/separator.d.ts +3 -3
- package/separator/separator.js +2 -4
- package/skeleton-block/skeleton-block.d.ts +1 -1
- package/skeleton-block/skeleton-block.js +2 -2
- package/slider/slider.js +2 -3
- package/snackbar/snackbar.js +2 -3
- package/spinner/spinner.d.ts +5 -2
- package/spinner/spinner.js +4 -4
- package/split-button/split-button.js +2 -3
- package/stack/stack.js +2 -3
- package/star-meter/star-meter.d.ts +1 -1
- package/star-meter/star-meter.js +2 -3
- package/tab/tab-item.js +2 -3
- package/tab/tab-list.js +1 -2
- package/tab/tab-panel.js +2 -2
- package/tab/tab.js +2 -2
- package/table/table.d.ts +3 -3
- package/table/table.js +8 -9
- package/table/table.module.css +0 -4
- package/text/text.d.ts +0 -1
- package/text/text.js +2 -3
- package/text/text.module.css +13 -20
- package/textfield/base-field/base-field.d.ts +1 -0
- package/textfield/base-field/base-field.js +2 -2
- package/textfield/base-field/index.d.ts +1 -1
- package/textfield/textfield.d.ts +4 -4
- package/textfield/textfield.js +3 -4
- package/themes/dark.css +1 -1
- package/themes/light.css +1 -1
- package/themes.css +3 -3
- package/title/title.d.ts +0 -1
- package/title/title.js +2 -3
- package/title/title.module.css +30 -33
- package/toggle-button/toggle-button.js +2 -3
- package/tooltip/tooltip.d.ts +2 -2
package/masonry/masonry.js
CHANGED
|
@@ -3,7 +3,7 @@ import React, { Children, cloneElement } from 'react';
|
|
|
3
3
|
import MasonryLayout from 'react-masonry-css';
|
|
4
4
|
import tksn from '@wonderflow/tokens/platforms/web/tokens.json';
|
|
5
5
|
import { Masonry as MasonryClass, Column } from './masonry.module.css';
|
|
6
|
-
export const Masonry = ({ className, children, columns = 3, gutter = 16, style, ...
|
|
6
|
+
export const Masonry = ({ className, children, columns = 3, gutter = 16, style, ...otherProps }) => {
|
|
7
7
|
const breakpoints = {
|
|
8
8
|
extraSmall: 480,
|
|
9
9
|
small: 768,
|
|
@@ -19,7 +19,7 @@ export const Masonry = ({ className, children, columns = 3, gutter = 16, style,
|
|
|
19
19
|
default: columns.default,
|
|
20
20
|
[breakpoints[current]]: columns[current]
|
|
21
21
|
}), {});
|
|
22
|
-
return (React.createElement(MasonryLayout, { role: "list", className: clsx(MasonryClass, className), columnClassName: Column, breakpointCols: typeof columns === 'number' ? columns : computedColumns, style: { ...dynamicStyle, ...style }, ...
|
|
22
|
+
return (React.createElement(MasonryLayout, { role: "list", className: clsx(MasonryClass, className), columnClassName: Column, breakpointCols: typeof columns === 'number' ? columns : computedColumns, style: { ...dynamicStyle, ...style }, ...otherProps }, Children.map(children, (child) => cloneElement(child, {
|
|
23
23
|
role: 'listitem'
|
|
24
24
|
}))));
|
|
25
25
|
};
|
package/modal/modal-content.js
CHANGED
|
@@ -3,13 +3,12 @@ import React, { forwardRef } from 'react';
|
|
|
3
3
|
import { Content, Header, CloseButton } from './modal-content.module.css';
|
|
4
4
|
import { Title, Elevator, IconButton, Stack } from '../';
|
|
5
5
|
import { useModalContext } from './modal-context';
|
|
6
|
-
export const ModalContent = forwardRef(({ children, className, title, ...
|
|
6
|
+
export const ModalContent = forwardRef(({ children, className, title, ...otherProps }, forwardedRef) => {
|
|
7
7
|
const { onClose, titleId } = useModalContext();
|
|
8
8
|
return (React.createElement(Elevator, { resting: 4 },
|
|
9
|
-
React.createElement("div", { className: clsx(Content, className), ref: forwardedRef, "data-theme": "light", ...
|
|
9
|
+
React.createElement("div", { className: clsx(Content, className), ref: forwardedRef, "data-theme": "light", ...otherProps },
|
|
10
10
|
React.createElement(Stack, { as: "header", verticalAlign: "center", fill: false, horizontalAlign: "space-between", direction: "row", className: Header },
|
|
11
11
|
React.createElement(Title, { level: "5", id: titleId }, title),
|
|
12
12
|
onClose && React.createElement(IconButton, { onClick: onClose, className: CloseButton, icon: "xmark", kind: "flat" })),
|
|
13
13
|
children)));
|
|
14
14
|
});
|
|
15
|
-
ModalContent.displayName = 'Modal.Content';
|
package/modal/modal.js
CHANGED
|
@@ -7,7 +7,7 @@ import { ModalContent } from './modal-content';
|
|
|
7
7
|
import { Modal as ModalClass, Backdrop, Container } from './modal.module.css';
|
|
8
8
|
import { ModalContext } from './modal-context';
|
|
9
9
|
import { Presence } from '../';
|
|
10
|
-
const ModalElement = forwardRef(({ children, className, overlayColor = 'dark', closeOnClickOutside = true, onClose, visible, ...
|
|
10
|
+
const ModalElement = forwardRef(({ children, className, overlayColor = 'dark', closeOnClickOutside = true, onClose, visible, ...otherProps }, forwardedRef) => {
|
|
11
11
|
const seedID = useUIDSeed();
|
|
12
12
|
return (React.createElement(ModalContext.Provider, { value: {
|
|
13
13
|
onClose,
|
|
@@ -15,17 +15,15 @@ const ModalElement = forwardRef(({ children, className, overlayColor = 'dark', c
|
|
|
15
15
|
titleId: seedID('modal-title')
|
|
16
16
|
} },
|
|
17
17
|
React.createElement(ModalContext.Consumer, null, (ctx) => (React.createElement(LazyMotion, { features: domAnimation },
|
|
18
|
-
React.createElement("div", { role: "dialog", "aria-modal": "true", "aria-labelledby": ctx.titleId, className: clsx(ModalClass, className), ref: forwardedRef, ...
|
|
18
|
+
React.createElement("div", { role: "dialog", "aria-modal": "true", "aria-labelledby": ctx.titleId, className: clsx(ModalClass, className), ref: forwardedRef, ...otherProps },
|
|
19
19
|
React.createElement(m.span, { key: seedID('modal-backdrop'), className: Backdrop, "data-overlay-color": overlayColor, initial: { opacity: 0 }, animate: { opacity: 0.95 }, exit: { opacity: 0 }, transition: { duration: 0.2 } }),
|
|
20
|
-
React.createElement(FocusOn, { onClickOutside: () =>
|
|
20
|
+
React.createElement(FocusOn, { onClickOutside: () => ctx.onClose(), onEscapeKey: ctx.onClose },
|
|
21
21
|
React.createElement(m.div, { key: seedID('modal-container'), className: Container, initial: { scale: 0.98, opacity: 0 }, animate: { scale: 1, opacity: 1 }, exit: { scale: 0.98, opacity: 0 }, transition: { ease: 'easeOut', duration: 0.1 } }, children))))))));
|
|
22
22
|
});
|
|
23
|
-
export const Modal = forwardRef(({ visible, ...
|
|
23
|
+
export const Modal = forwardRef(({ visible, ...otherProps }, forwardedRef) => {
|
|
24
24
|
if (typeof visible === 'boolean') {
|
|
25
|
-
return (React.createElement(Presence, { exitBeforeEnter: true }, visible ? React.createElement(ModalElement, { ref: forwardedRef, ...
|
|
25
|
+
return (React.createElement(Presence, { exitBeforeEnter: true }, visible ? React.createElement(ModalElement, { ref: forwardedRef, ...otherProps }) : null));
|
|
26
26
|
}
|
|
27
|
-
return (React.createElement(ModalElement, { ref: forwardedRef, ...
|
|
27
|
+
return (React.createElement(ModalElement, { ref: forwardedRef, ...otherProps }));
|
|
28
28
|
});
|
|
29
29
|
Modal.Content = ModalContent;
|
|
30
|
-
Modal.displayName = 'Modal';
|
|
31
|
-
ModalElement.displayName = 'Modal.Content';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wonderflow/react-components",
|
|
3
3
|
"description": "UI components from Wonderflow's Wanda design system",
|
|
4
|
-
"version": "2.39.3",
|
|
4
|
+
"version": "2.39.5-next.3",
|
|
5
5
|
"author": "Wonderflow",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"main": "index.js",
|
|
@@ -57,13 +57,13 @@
|
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
59
|
"@react-aria/interactions": "3.7.0",
|
|
60
|
-
"@wonderflow/eslint-config": "1.1.
|
|
61
|
-
"@wonderflow/stylelint-config": "1.
|
|
60
|
+
"@wonderflow/eslint-config": "1.1.6",
|
|
61
|
+
"@wonderflow/stylelint-config": "1.1.2",
|
|
62
62
|
"@wonderflow/tokens": "1.3.6",
|
|
63
63
|
"clsx": "1.1.1",
|
|
64
64
|
"flat": "5.0.2",
|
|
65
65
|
"framer-motion": "4.1.17",
|
|
66
|
-
"postcss": "8.4.
|
|
66
|
+
"postcss": "8.4.5",
|
|
67
67
|
"react": ">=17.0.2",
|
|
68
68
|
"react-data-table-component": "7.4.5",
|
|
69
69
|
"react-dom": ">=17.0.2",
|
|
@@ -84,25 +84,25 @@
|
|
|
84
84
|
},
|
|
85
85
|
"devDependencies": {
|
|
86
86
|
"@babel/core": "7.16.0",
|
|
87
|
-
"@commitlint/cli": "
|
|
88
|
-
"@commitlint/config-conventional": "
|
|
87
|
+
"@commitlint/cli": "15.0.0",
|
|
88
|
+
"@commitlint/config-conventional": "15.0.0",
|
|
89
89
|
"@semantic-release/exec": "6.0.2",
|
|
90
90
|
"@semantic-release/git": "10.0.1",
|
|
91
91
|
"@semantic-release/github": "8.0.2",
|
|
92
92
|
"@semantic-release/npm": "8.0.3",
|
|
93
93
|
"@semantic-release/release-notes-generator": "10.0.3",
|
|
94
|
-
"@storybook/addon-actions": "6.4.
|
|
95
|
-
"@storybook/addon-essentials": "6.4.
|
|
96
|
-
"@storybook/addon-links": "6.4.
|
|
94
|
+
"@storybook/addon-actions": "6.4.9",
|
|
95
|
+
"@storybook/addon-essentials": "6.4.9",
|
|
96
|
+
"@storybook/addon-links": "6.4.9",
|
|
97
97
|
"@storybook/addon-postcss": "2.0.0",
|
|
98
|
-
"@storybook/addons": "6.4.
|
|
99
|
-
"@storybook/react": "6.4.
|
|
100
|
-
"@storybook/theming": "6.4.
|
|
98
|
+
"@storybook/addons": "6.4.9",
|
|
99
|
+
"@storybook/react": "6.4.9",
|
|
100
|
+
"@storybook/theming": "6.4.9",
|
|
101
101
|
"@types/flat": "5.0.2",
|
|
102
102
|
"@types/react-dom": "17.0.11",
|
|
103
103
|
"@typescript-eslint/eslint-plugin": "5.6.0",
|
|
104
104
|
"@typescript-eslint/parser": "5.6.0",
|
|
105
|
-
"@wonderflow/config": "1.
|
|
105
|
+
"@wonderflow/config": "1.6.2",
|
|
106
106
|
"babel-loader": "8.2.3",
|
|
107
107
|
"commit-analyzer-fail-on-no-release": "1.0.0",
|
|
108
108
|
"commitizen": "4.2.4",
|
|
@@ -113,10 +113,9 @@
|
|
|
113
113
|
"fs-extra": "10.0.0",
|
|
114
114
|
"husky": "7.0.4",
|
|
115
115
|
"is-ci": "3.0.1",
|
|
116
|
-
"nanospinner": "0.
|
|
116
|
+
"nanospinner": "0.6.0",
|
|
117
117
|
"npm-run-all": "4.1.5",
|
|
118
118
|
"picocolors": "1.0.0",
|
|
119
|
-
"postcss-mixins": "8.1.0",
|
|
120
119
|
"rimraf": "3.0.2",
|
|
121
120
|
"semantic-release": "18.0.1",
|
|
122
121
|
"storybook-addon-themes": "6.1.0",
|
|
@@ -124,7 +123,7 @@
|
|
|
124
123
|
"stylelint": "14.1.0",
|
|
125
124
|
"svgo": "2.8.0",
|
|
126
125
|
"svgstore": "3.0.1",
|
|
127
|
-
"typescript": "4.5.
|
|
126
|
+
"typescript": "4.5.3",
|
|
128
127
|
"typescript-plugin-css-modules": "3.4.0",
|
|
129
128
|
"yargs": "17.3.0"
|
|
130
129
|
},
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ReactPaginateProps } from 'react-paginate';
|
|
3
|
-
|
|
4
|
-
export declare type PaginationProps = PropsWithClass & Except<ReactPaginateProps, 'pageCount' | 'pageRangeDisplayed' | 'marginPagesDisplayed'> & {
|
|
3
|
+
export declare type PaginationProps = ReactPaginateProps & {
|
|
5
4
|
itemsCount: number;
|
|
6
5
|
itemsPerPage?: number;
|
|
7
6
|
onPageClick?(offset: Record<string, number>): void;
|
|
8
|
-
pageCount?: ReactPaginateProps['pageCount'];
|
|
9
7
|
pageRangeDisplayed?: ReactPaginateProps['pageRangeDisplayed'];
|
|
10
8
|
marginPagesDisplayed?: ReactPaginateProps['marginPagesDisplayed'];
|
|
11
9
|
};
|
|
12
|
-
export declare const Pagination: ({ className, itemsCount, itemsPerPage, onPageClick, pageCount, pageRangeDisplayed, marginPagesDisplayed, ...
|
|
10
|
+
export declare const Pagination: ({ className, itemsCount, itemsPerPage, onPageClick, pageCount, pageRangeDisplayed, marginPagesDisplayed, ...otherProps }: PaginationProps) => JSX.Element;
|
package/pagination/pagination.js
CHANGED
|
@@ -3,7 +3,7 @@ import React, { useCallback, useEffect, useState } from 'react';
|
|
|
3
3
|
import ReactPaginate from 'react-paginate';
|
|
4
4
|
import { Icon } from '../';
|
|
5
5
|
import { Pagination as PaginationClass } from './pagination.module.css';
|
|
6
|
-
export const Pagination = ({ className, itemsCount, itemsPerPage = 10, onPageClick, pageCount, pageRangeDisplayed = 3, marginPagesDisplayed = 1, ...
|
|
6
|
+
export const Pagination = ({ className, itemsCount, itemsPerPage = 10, onPageClick, pageCount, pageRangeDisplayed = 3, marginPagesDisplayed = 1, ...otherProps }) => {
|
|
7
7
|
const [computedPageCount, setComputedPageCount] = useState(0);
|
|
8
8
|
useEffect(() => {
|
|
9
9
|
itemsCount && setComputedPageCount(Math.ceil(itemsCount / itemsPerPage));
|
|
@@ -12,5 +12,5 @@ export const Pagination = ({ className, itemsCount, itemsPerPage = 10, onPageCli
|
|
|
12
12
|
const newOffset = (event.selected * itemsPerPage) % itemsCount;
|
|
13
13
|
onPageClick && onPageClick({ ...event, offset: newOffset });
|
|
14
14
|
}, [itemsPerPage, onPageClick, itemsCount]);
|
|
15
|
-
return (React.createElement(ReactPaginate, { containerClassName: clsx(PaginationClass, className), breakLabel: "...", nextLabel: React.createElement(Icon, { dimension: 16, name: "chevron-right" }), previousLabel: React.createElement(Icon, { dimension: 16, name: "chevron-left" }), onPageChange: handlePageClick, pageRangeDisplayed: pageRangeDisplayed, pageCount: pageCount || computedPageCount, marginPagesDisplayed: marginPagesDisplayed, ...
|
|
15
|
+
return (React.createElement(ReactPaginate, { containerClassName: clsx(PaginationClass, className), breakLabel: "...", nextLabel: React.createElement(Icon, { dimension: 16, name: "chevron-right" }), previousLabel: React.createElement(Icon, { dimension: 16, name: "chevron-left" }), onPageChange: handlePageClick, pageRangeDisplayed: pageRangeDisplayed, pageCount: pageCount || computedPageCount, marginPagesDisplayed: marginPagesDisplayed, ...otherProps }));
|
|
16
16
|
};
|
package/prose/prose.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react';
|
|
2
2
|
import { Prose as ProseClass } from './prose.module.css';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
|
-
export const Prose = forwardRef(({ children, className, as: Wrapper = 'div', ...
|
|
5
|
-
return (React.createElement(Wrapper, { ref: forwardedRef, className: clsx(ProseClass, className), ...
|
|
4
|
+
export const Prose = forwardRef(({ children, className, as: Wrapper = 'div', ...otherProps }, forwardedRef) => {
|
|
5
|
+
return (React.createElement(Wrapper, { ref: forwardedRef, className: clsx(ProseClass, className), ...otherProps }, children));
|
|
6
6
|
});
|
|
7
|
-
Prose.displayName = 'Prose';
|
package/select/select.js
CHANGED
|
@@ -3,7 +3,7 @@ import { Text, Stack, Icon } from '../';
|
|
|
3
3
|
import { Select as SelectClass, FieldContainer, Icon as IconClass, Field } from './select.module.css';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import { useUIDSeed } from 'react-uid';
|
|
6
|
-
export const Select = forwardRef(({ children, className, disabled = false, icon = 'sort-alt', label, kind = 'single', dimension = 'regular', onChange, ...
|
|
6
|
+
export const Select = forwardRef(({ children, className, disabled = false, icon = 'sort-alt', label, kind = 'single', dimension = 'regular', onChange, ...otherProps }, forwardedRef) => {
|
|
7
7
|
const uid = useUIDSeed();
|
|
8
8
|
const iconSizes = {
|
|
9
9
|
small: 14,
|
|
@@ -13,7 +13,6 @@ export const Select = forwardRef(({ children, className, disabled = false, icon
|
|
|
13
13
|
return (React.createElement(Stack, { as: "fieldset", rowGap: 4, className: clsx(SelectClass, className), "data-select-is-multiple": kind === 'multiple', "data-select-has-label": Boolean(label), "data-select-dimension": dimension, "aria-disabled": disabled, horizontalAlign: "start", verticalAlign: "start", inline: true, tabIndex: disabled ? 0 : undefined },
|
|
14
14
|
label && React.createElement(Text, { as: "label", size: dimension === 'small' ? 14 : 16, htmlFor: uid('select') }, label),
|
|
15
15
|
React.createElement("div", { className: FieldContainer },
|
|
16
|
-
React.createElement("select", { disabled: disabled, className: Field, id: uid('select'), multiple: kind === 'multiple', onChange: onChange, ref: forwardedRef, ...
|
|
16
|
+
React.createElement("select", { disabled: disabled, className: Field, id: uid('select'), multiple: kind === 'multiple', onChange: onChange, ref: forwardedRef, ...otherProps }, children),
|
|
17
17
|
kind === 'single' && (React.createElement(Icon, { className: IconClass, name: icon, dimension: iconSizes[dimension] })))));
|
|
18
18
|
});
|
|
19
|
-
Select.displayName = 'Select';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import clsx from 'clsx';
|
|
2
2
|
import React, { forwardRef } from 'react';
|
|
3
3
|
import { Checkbox as CheckboxClass } from './selection-controls.module.css';
|
|
4
|
-
export const Checkbox = forwardRef(({ className, disabled, dimension = 'regular', onChange, indeterminate, ...
|
|
5
|
-
return (React.createElement("input", { type: "checkbox", disabled: disabled, "aria-disabled": disabled, "data-control-dimension": dimension, "data-control-indeterminate": indeterminate, onChange: onChange, className: clsx(CheckboxClass, className), ref: forwardedRef, ...
|
|
4
|
+
export const Checkbox = forwardRef(({ className, disabled, dimension = 'regular', onChange, indeterminate, ...otherProps }, forwardedRef) => {
|
|
5
|
+
return (React.createElement("input", { type: "checkbox", disabled: disabled, "aria-disabled": disabled, "data-control-dimension": dimension, "data-control-indeterminate": indeterminate, onChange: onChange, className: clsx(CheckboxClass, className), ref: forwardedRef, ...otherProps }));
|
|
6
6
|
});
|
|
7
|
-
Checkbox.displayName = 'Checkbox';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import clsx from 'clsx';
|
|
2
2
|
import React, { forwardRef } from 'react';
|
|
3
3
|
import { Radio as RadioClass } from './selection-controls.module.css';
|
|
4
|
-
export const Radio = forwardRef(({ className, disabled, dimension = 'regular', onChange, ...
|
|
5
|
-
return (React.createElement("input", { type: "radio", disabled: disabled, "aria-disabled": disabled, "data-control-dimension": dimension, onChange: onChange, className: clsx(RadioClass, className), ref: forwardedRef, ...
|
|
4
|
+
export const Radio = forwardRef(({ className, disabled, dimension = 'regular', onChange, ...otherProps }, forwardedRef) => {
|
|
5
|
+
return (React.createElement("input", { type: "radio", disabled: disabled, "aria-disabled": disabled, "data-control-dimension": dimension, onChange: onChange, className: clsx(RadioClass, className), ref: forwardedRef, ...otherProps }));
|
|
6
6
|
});
|
|
7
|
-
Radio.displayName = 'Radio';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import clsx from 'clsx';
|
|
2
2
|
import React, { forwardRef } from 'react';
|
|
3
3
|
import { Toggle as ToggleClass } from './selection-controls.module.css';
|
|
4
|
-
export const Toggle = forwardRef(({ className, disabled, dimension = 'regular', onChange, ...
|
|
5
|
-
return (React.createElement("input", { type: "checkbox", disabled: disabled, "aria-disabled": disabled, "data-control-dimension": dimension, onChange: onChange, className: clsx(ToggleClass, className), ref: forwardedRef, ...
|
|
4
|
+
export const Toggle = forwardRef(({ className, disabled, dimension = 'regular', onChange, ...otherProps }, forwardedRef) => {
|
|
5
|
+
return (React.createElement("input", { type: "checkbox", disabled: disabled, "aria-disabled": disabled, "data-control-dimension": dimension, onChange: onChange, className: clsx(ToggleClass, className), ref: forwardedRef, ...otherProps }));
|
|
6
6
|
});
|
|
7
|
-
Toggle.displayName = 'Toggle';
|
package/separator/index.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { Separator
|
|
1
|
+
export { Separator } from './separator';
|
|
2
|
+
export type { SeparatorProps } from './separator';
|
package/separator/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Separator
|
|
1
|
+
export { Separator } from './separator';
|
package/separator/separator.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export declare
|
|
3
|
-
export declare const Separator: React.ForwardRefExoticComponent<React.RefAttributes<HTMLHRElement>>;
|
|
1
|
+
import React, { HTMLAttributes } from 'react';
|
|
2
|
+
export declare type SeparatorProps = HTMLAttributes<HTMLHRElement>;
|
|
3
|
+
export declare const Separator: React.ForwardRefExoticComponent<SeparatorProps & React.RefAttributes<HTMLHRElement>>;
|
package/separator/separator.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
import { Separator as SeparatorClass } from './separator.module.css';
|
|
4
|
-
export const
|
|
5
|
-
|
|
6
|
-
return (React.createElement("hr", { ref: forwardedRef, className: clsx(SeparatorClass, className), ...props }));
|
|
4
|
+
export const Separator = forwardRef(({ className, ...otherProps }, forwardedRef) => {
|
|
5
|
+
return (React.createElement("hr", { ref: forwardedRef, className: clsx(SeparatorClass, className), ...otherProps }));
|
|
7
6
|
});
|
|
8
|
-
Separator.displayName = NAME;
|
|
@@ -5,4 +5,4 @@ import { TokensTypes } from '@wonderflow/tokens/platforms/web/types';
|
|
|
5
5
|
export declare type SkeletonBlockProps = SkeletonProps & {
|
|
6
6
|
borderRadius?: TokensTypes['radius'];
|
|
7
7
|
};
|
|
8
|
-
export declare const SkeletonBlock: ({ className, borderRadius, ...
|
|
8
|
+
export declare const SkeletonBlock: ({ className, borderRadius, ...otherProps }: SkeletonBlockProps) => JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import Skeleton from 'react-loading-skeleton';
|
|
3
3
|
import 'react-loading-skeleton/dist/skeleton.css';
|
|
4
|
-
export const SkeletonBlock = ({ className, borderRadius = 4, ...
|
|
5
|
-
return (React.createElement(Skeleton, { className: className, borderRadius: borderRadius, baseColor: "var(--dimmed-1)", highlightColor: "var(--dimmed-0)", ...
|
|
4
|
+
export const SkeletonBlock = ({ className, borderRadius = 4, ...otherProps }) => {
|
|
5
|
+
return (React.createElement(Skeleton, { className: className, borderRadius: borderRadius, baseColor: "var(--dimmed-1)", highlightColor: "var(--dimmed-0)", ...otherProps }));
|
|
6
6
|
};
|
package/slider/slider.js
CHANGED
|
@@ -2,7 +2,7 @@ import React, { forwardRef, useCallback, useState } from 'react';
|
|
|
2
2
|
import { Stack, Text, Icon } from '..';
|
|
3
3
|
import { Slider as SliderClass, Input, Value } from './slider.module.css';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
|
-
export const Slider = forwardRef(({ min = 0, max = 100, step, onInput, className, defaultValue = 0, dimension = 'regular', showValues, iconMin, iconMax, ...
|
|
5
|
+
export const Slider = forwardRef(({ min = 0, max = 100, step, onInput, className, defaultValue = 0, dimension = 'regular', showValues, iconMin, iconMax, ...otherProps }, forwardedRef) => {
|
|
6
6
|
const [value, setValue] = useState(defaultValue);
|
|
7
7
|
const isSmall = dimension === 'small';
|
|
8
8
|
const handleInput = useCallback(({ currentTarget }) => {
|
|
@@ -12,8 +12,7 @@ export const Slider = forwardRef(({ min = 0, max = 100, step, onInput, className
|
|
|
12
12
|
return (React.createElement(Stack, { direction: "row", verticalAlign: "center", columnGap: 8, className: clsx(SliderClass, className), "data-slider-dimension": dimension },
|
|
13
13
|
showValues && React.createElement(Text, { as: "span", size: isSmall ? 14 : 16, weight: "bold", textAlign: "end", className: Value }, value),
|
|
14
14
|
(iconMin && !showValues) && React.createElement(Icon, { name: iconMin, dimension: isSmall ? 16 : 24 }),
|
|
15
|
-
React.createElement("input", { ref: forwardedRef, className: Input, type: "range", min: min, max: max, defaultValue: value, "aria-valuemin": min, "aria-valuemax": max, "aria-valuenow": value, step: step, onInput: handleInput, ...
|
|
15
|
+
React.createElement("input", { ref: forwardedRef, className: Input, type: "range", min: min, max: max, defaultValue: value, "aria-valuemin": min, "aria-valuemax": max, "aria-valuenow": value, step: step, onInput: handleInput, ...otherProps }),
|
|
16
16
|
showValues && React.createElement(Text, { as: "span", size: isSmall ? 14 : 16, weight: "bold", className: Value }, max),
|
|
17
17
|
(iconMax && !showValues) && React.createElement(Icon, { name: iconMax, dimension: isSmall ? 16 : 24 })));
|
|
18
18
|
});
|
|
19
|
-
Slider.displayName = 'Slider';
|
package/snackbar/snackbar.js
CHANGED
|
@@ -2,7 +2,7 @@ import React, { forwardRef } from 'react';
|
|
|
2
2
|
import { Snackbar as SnackbarClass, Icon as IconClass, Action } from './snackbar.module.css';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import { Title, Stack, Icon, Button } from '../';
|
|
5
|
-
export const Snackbar = forwardRef(({ children, className, title, icon, kind = 'neutral', as: Wrapper = 'div', dismissable, dismissLabel = 'Dismiss', onDismiss, ...
|
|
5
|
+
export const Snackbar = forwardRef(({ children, className, title, icon, kind = 'neutral', as: Wrapper = 'div', dismissable, dismissLabel = 'Dismiss', onDismiss, ...otherProps }, forwardedRef) => {
|
|
6
6
|
const defaultIcons = {
|
|
7
7
|
info: 'circle-info',
|
|
8
8
|
warning: 'triangle-exclamation',
|
|
@@ -10,7 +10,7 @@ export const Snackbar = forwardRef(({ children, className, title, icon, kind = '
|
|
|
10
10
|
positive: 'check',
|
|
11
11
|
danger: 'circle-x'
|
|
12
12
|
};
|
|
13
|
-
return (React.createElement(Wrapper, { ref: forwardedRef, className: clsx(SnackbarClass, className), "data-snackbar-kind": kind, role: "alert", ...
|
|
13
|
+
return (React.createElement(Wrapper, { ref: forwardedRef, className: clsx(SnackbarClass, className), "data-snackbar-kind": kind, role: "alert", ...otherProps },
|
|
14
14
|
React.createElement(Stack, { verticalAlign: "start", horizontalAlign: "start", direction: "row", columnGap: 16, fill: false },
|
|
15
15
|
React.createElement(Icon, { className: IconClass, name: icon || defaultIcons[kind], dimension: 24 }),
|
|
16
16
|
React.createElement(Stack, { rowGap: 16 },
|
|
@@ -20,4 +20,3 @@ export const Snackbar = forwardRef(({ children, className, title, icon, kind = '
|
|
|
20
20
|
dismissable && (React.createElement(Stack, { horizontalAlign: "end" },
|
|
21
21
|
React.createElement(Button, { onClick: onDismiss, className: Action }, dismissLabel)))))));
|
|
22
22
|
});
|
|
23
|
-
Snackbar.displayName = 'Snackbar';
|
package/spinner/spinner.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import { SVGAttributes } from 'react';
|
|
1
|
+
import React, { SVGAttributes } from 'react';
|
|
2
2
|
export declare type SpinnerProps = SVGAttributes<SVGElement> & {
|
|
3
3
|
dimension?: 'small' | 'regular' | 'big';
|
|
4
4
|
color?: string;
|
|
5
5
|
};
|
|
6
|
-
export declare const Spinner:
|
|
6
|
+
export declare const Spinner: React.ForwardRefExoticComponent<React.SVGAttributes<SVGElement> & {
|
|
7
|
+
dimension?: "big" | "small" | "regular" | undefined;
|
|
8
|
+
color?: string | undefined;
|
|
9
|
+
} & React.RefAttributes<SVGSVGElement>>;
|
package/spinner/spinner.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { forwardRef } from 'react';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
import { motion } from 'framer-motion';
|
|
4
|
-
export const Spinner = ({ className, style, color, dimension = 'big' }) => {
|
|
4
|
+
export const Spinner = forwardRef(({ className, style, color, dimension = 'big' }, forwardedRef) => {
|
|
5
5
|
const attributes = {
|
|
6
6
|
small: {
|
|
7
7
|
size: 14
|
|
@@ -13,7 +13,7 @@ export const Spinner = ({ className, style, color, dimension = 'big' }) => {
|
|
|
13
13
|
size: 30
|
|
14
14
|
}
|
|
15
15
|
};
|
|
16
|
-
return (React.createElement(motion.svg, { className: clsx(className), animate: { rotate: '2turn' }, transition: {
|
|
16
|
+
return (React.createElement(motion.svg, { ref: forwardedRef, className: clsx(className), animate: { rotate: '2turn' }, transition: {
|
|
17
17
|
duration: 2,
|
|
18
18
|
repeat: Infinity,
|
|
19
19
|
repeatDelay: 2
|
|
@@ -22,4 +22,4 @@ export const Spinner = ({ className, style, color, dimension = 'big' }) => {
|
|
|
22
22
|
React.createElement("circle", { strokeOpacity: 0.5, cx: 18, cy: 18, r: 18 }),
|
|
23
23
|
React.createElement("path", { d: "M36 18c0-9.94-8.06-18-18-18" },
|
|
24
24
|
React.createElement("animateTransform", { attributeName: "transform", type: "rotate", from: "0 18 18", to: "360 18 18", dur: "1s", repeatCount: "indefinite" })))));
|
|
25
|
-
};
|
|
25
|
+
});
|
|
@@ -2,13 +2,12 @@ import clsx from 'clsx';
|
|
|
2
2
|
import React, { forwardRef } from 'react';
|
|
3
3
|
import { Button, Dropdown, Stack } from '..';
|
|
4
4
|
import { SplitButton as SplitButtonClass } from './split-button.module.css';
|
|
5
|
-
export const SplitButton = forwardRef(({ className, label, icon = 'chevron-down', kind, dimension, fullWidth, disabled,
|
|
5
|
+
export const SplitButton = forwardRef(({ className, label, icon = 'chevron-down', kind, dimension, fullWidth, disabled, busy, children, placement, dropdownOffset, onClick, pressed = false, iconPosition = 'left', ...otherProps }, forwardedRef) => {
|
|
6
6
|
const commonProps = {
|
|
7
7
|
kind,
|
|
8
8
|
dimension
|
|
9
9
|
};
|
|
10
10
|
return (React.createElement(Stack, { className: clsx(SplitButtonClass, className), direction: "row", columnGap: 0, inline: !fullWidth },
|
|
11
|
-
React.createElement(Button, {
|
|
11
|
+
React.createElement(Button, { busy: busy, disabled: disabled, fullWidth: fullWidth, onClick: onClick, pressed: pressed, iconPosition: iconPosition, ref: forwardedRef, ...commonProps, ...otherProps }, label),
|
|
12
12
|
React.createElement(Dropdown, { placement: placement, offset: dropdownOffset, trigger: React.createElement(Button, { icon: icon, ...commonProps }) }, children)));
|
|
13
13
|
});
|
|
14
|
-
SplitButton.displayName = 'SplitButton';
|
package/stack/stack.js
CHANGED
|
@@ -2,7 +2,7 @@ import React, { forwardRef } from 'react';
|
|
|
2
2
|
import tksn from '@wonderflow/tokens/platforms/web/tokens.json';
|
|
3
3
|
import { Stack as StackClass } from './stack.module.css';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
|
-
export const Stack = forwardRef(({ children, className, rowGap = 0, columnGap = 0, as: Wrapper = 'div', inline = false, direction = 'column', wrap = false, fill = true, verticalAlign = 'initial', horizontalAlign = 'initial', horizontalPadding = 0, verticalPadding = 0, style, ...
|
|
5
|
+
export const Stack = forwardRef(({ children, className, rowGap = 0, columnGap = 0, as: Wrapper = 'div', inline = false, direction = 'column', wrap = false, fill = true, verticalAlign = 'initial', horizontalAlign = 'initial', horizontalPadding = 0, verticalPadding = 0, style, ...otherProps }, forwardedRef) => {
|
|
6
6
|
const alignmentTemplate = (prop) => {
|
|
7
7
|
if (prop.includes('start') || prop.includes('end')) {
|
|
8
8
|
return `flex-${prop}`;
|
|
@@ -17,6 +17,5 @@ export const Stack = forwardRef(({ children, className, rowGap = 0, columnGap =
|
|
|
17
17
|
'--vPadding': verticalPadding && tksn.space[verticalPadding],
|
|
18
18
|
'--hPadding': horizontalPadding && tksn.space[horizontalPadding]
|
|
19
19
|
};
|
|
20
|
-
return (React.createElement(Wrapper, { ref: forwardedRef, style: { ...computedStyle, ...style }, "data-stack-inline": inline, "data-stack-wrap": wrap, "data-stack-direction": direction, "data-stack-fill": fill, className: clsx(StackClass, className), ...
|
|
20
|
+
return (React.createElement(Wrapper, { ref: forwardedRef, style: { ...computedStyle, ...style }, "data-stack-inline": inline, "data-stack-wrap": wrap, "data-stack-direction": direction, "data-stack-fill": fill, className: clsx(StackClass, className), ...otherProps }, children));
|
|
21
21
|
});
|
|
22
|
-
Stack.displayName = 'Stack';
|
package/star-meter/star-meter.js
CHANGED
|
@@ -3,7 +3,7 @@ import clsx from 'clsx';
|
|
|
3
3
|
import { useUIDSeed } from 'react-uid';
|
|
4
4
|
import { Text, Stack, Icon } from '../';
|
|
5
5
|
import { StarMeter as StarMeterClass, Gradient, Icon as IconClass } from './star-meter.module.css';
|
|
6
|
-
export const StarMeter = forwardRef(({ className, value = 0, starCount = 5, label, dimension = 'regular', ...
|
|
6
|
+
export const StarMeter = forwardRef(({ className, value = 0, starCount = 5, label, dimension = 'regular', ...otherProps }, forwardedRef) => {
|
|
7
7
|
const uid = useUIDSeed();
|
|
8
8
|
const labelSize = {
|
|
9
9
|
small: 14,
|
|
@@ -38,7 +38,7 @@ export const StarMeter = forwardRef(({ className, value = 0, starCount = 5, labe
|
|
|
38
38
|
return React.createElement(Icon, { name: "star", className: IconClass, dimension: 16, fill: fillType, key: starIndex });
|
|
39
39
|
});
|
|
40
40
|
};
|
|
41
|
-
return (React.createElement(Stack, { inline: true, direction: "row", verticalAlign: "center", columnGap: 8, className: clsx(StarMeterClass, className), role: "meter", "aria-valuenow": clamp(value, 0, starCount), "aria-valuemin": 0, "aria-valuemax": starCount, "aria-labelledby": uid('star-meter'), "data-star-meter-dimension": dimension, ref: forwardedRef, ...
|
|
41
|
+
return (React.createElement(Stack, { inline: true, direction: "row", verticalAlign: "center", columnGap: 8, className: clsx(StarMeterClass, className), role: "meter", "aria-valuenow": clamp(value, 0, starCount), "aria-valuemin": 0, "aria-valuemax": starCount, "aria-labelledby": uid('star-meter'), "data-star-meter-dimension": dimension, ref: forwardedRef, ...otherProps },
|
|
42
42
|
React.createElement("svg", { "aria-hidden": "true", className: Gradient, width: "100", height: "50", version: "1.1", xmlns: "http://www.w3.org/2000/svg" },
|
|
43
43
|
React.createElement("defs", null,
|
|
44
44
|
React.createElement("linearGradient", { id: "HalfStar" },
|
|
@@ -49,4 +49,3 @@ export const StarMeter = forwardRef(({ className, value = 0, starCount = 5, labe
|
|
|
49
49
|
React.createElement(Stack, { direction: "row", columnGap: 2 }, starType(starCount, roundValue(value))),
|
|
50
50
|
React.createElement(Text, { dimmed: 6, id: uid('star-meter'), size: labelSize[dimension], weight: "bold" }, label || value.toString())));
|
|
51
51
|
});
|
|
52
|
-
StarMeter.displayName = 'StarMeter';
|
package/tab/tab-item.js
CHANGED
|
@@ -4,7 +4,7 @@ import clsx from 'clsx';
|
|
|
4
4
|
import { Stack, Icon } from '../';
|
|
5
5
|
import { useTabState } from './primitive-tab';
|
|
6
6
|
import { TabItem as TabItemClass } from './tab.module.css';
|
|
7
|
-
export const TabItem = forwardRef(({ children, className, icon, ...
|
|
7
|
+
export const TabItem = forwardRef(({ children, className, icon, ...otherProps }, forwardedRef) => {
|
|
8
8
|
const { onClick, isActive } = useTabState(children);
|
|
9
9
|
const internalRef = useRef(forwardedRef);
|
|
10
10
|
const [, focused, handleKeyDown, handleClick] = useRovingTabIndex(internalRef, false);
|
|
@@ -13,8 +13,7 @@ export const TabItem = forwardRef(({ children, className, icon, ...props }, forw
|
|
|
13
13
|
onClick();
|
|
14
14
|
handleClick();
|
|
15
15
|
}, [handleClick, onClick]);
|
|
16
|
-
return (React.createElement(Stack, { as: "button", direction: "row", verticalAlign: "center", horizontalAlign: "start", fill: false, columnGap: 8, role: "tab", ref: internalRef, className: clsx(TabItemClass, className), "aria-selected": isActive, onClick: fireClick, onKeyDown: handleKeyDown, onFocus: fireClick, type: "button", tabIndex: isActive ? 0 : -1, ...
|
|
16
|
+
return (React.createElement(Stack, { as: "button", direction: "row", verticalAlign: "center", horizontalAlign: "start", fill: false, columnGap: 8, role: "tab", ref: internalRef, className: clsx(TabItemClass, className), "aria-selected": isActive, onClick: fireClick, onKeyDown: handleKeyDown, onFocus: fireClick, type: "button", tabIndex: isActive ? 0 : -1, ...otherProps },
|
|
17
17
|
icon && React.createElement(Icon, { name: icon, dimension: 16 }),
|
|
18
18
|
children));
|
|
19
19
|
});
|
|
20
|
-
TabItem.displayName = 'Tab.Item';
|
package/tab/tab-list.js
CHANGED
|
@@ -2,6 +2,5 @@ import React, { forwardRef } from 'react';
|
|
|
2
2
|
import { RovingTabIndexProvider } from 'react-roving-tabindex';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import { TabList as TabListClass } from './tab.module.css';
|
|
5
|
-
export const TabList = forwardRef(({ children, className, ...
|
|
5
|
+
export const TabList = forwardRef(({ children, className, ...otherProps }, forwardedRef) => (React.createElement("div", { ref: forwardedRef, role: "tablist", tabIndex: -1, className: clsx(TabListClass, className), ...otherProps },
|
|
6
6
|
React.createElement(RovingTabIndexProvider, null, children))));
|
|
7
|
-
TabList.displayName = 'Tab.List';
|
package/tab/tab-panel.js
CHANGED
|
@@ -2,9 +2,9 @@ import React, { forwardRef } from 'react';
|
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
import { usePanelState } from './primitive-tab';
|
|
4
4
|
import { TabPanel as TabPanelClass } from './tab.module.css';
|
|
5
|
-
export const TabPanel = forwardRef(({ children, className, ...
|
|
5
|
+
export const TabPanel = forwardRef(({ children, className, ...otherProps }, forwardedRef) => {
|
|
6
6
|
const isActive = usePanelState(children);
|
|
7
7
|
return isActive
|
|
8
|
-
? (React.createElement("div", { ref: forwardedRef, tabIndex: 0, className: clsx(TabPanelClass, className), ...
|
|
8
|
+
? (React.createElement("div", { ref: forwardedRef, tabIndex: 0, className: clsx(TabPanelClass, className), ...otherProps }, children))
|
|
9
9
|
: null;
|
|
10
10
|
});
|
package/tab/tab.js
CHANGED
|
@@ -6,7 +6,7 @@ import { TabList } from './tab-list';
|
|
|
6
6
|
import { TabPanel } from './tab-panel';
|
|
7
7
|
import { Tabs as TabsWrapper } from './primitive-tab';
|
|
8
8
|
import { Tab as TabClass } from './tab.module.css';
|
|
9
|
-
export const Tab = forwardRef(({ children, className, state, onChange, ...
|
|
9
|
+
export const Tab = forwardRef(({ children, className, state, onChange, ...otherProps }, forwardedRef) => {
|
|
10
10
|
const renderedChildren = Children.toArray(children).filter(Boolean);
|
|
11
11
|
const innerState = useState(0);
|
|
12
12
|
const tabState = state || innerState;
|
|
@@ -17,7 +17,7 @@ export const Tab = forwardRef(({ children, className, state, onChange, ...props
|
|
|
17
17
|
onChange(currentTab);
|
|
18
18
|
}
|
|
19
19
|
}, [currentTab, onChange]);
|
|
20
|
-
return (React.createElement("div", { ref: forwardedRef, className: clsx(TabClass, className), ...
|
|
20
|
+
return (React.createElement("div", { ref: forwardedRef, className: clsx(TabClass, className), ...otherProps },
|
|
21
21
|
React.createElement(TabsWrapper, { state: tabState },
|
|
22
22
|
React.createElement(TabList, null, Children.map(renderedChildren, (child, index) => (React.createElement(TabItem, { id: seedID(`tab-item-${index}`), "aria-controls": seedID(`tab-panel-${index}`), icon: child.props.icon }, child.props.label)))),
|
|
23
23
|
Children.map(renderedChildren, (child, index) => cloneElement(child, {
|
package/table/table.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { FC } from 'react';
|
|
2
2
|
import { TableProps as ReactTableProps } from 'react-data-table-component';
|
|
3
3
|
import { IconNames } from '../icons/types';
|
|
4
4
|
export declare type TableProps<T> = ReactTableProps<T> & {
|
|
5
|
-
ExpandableRowsComponent?:
|
|
5
|
+
ExpandableRowsComponent?: FC<{
|
|
6
6
|
data: T;
|
|
7
7
|
}>;
|
|
8
8
|
collapsedRowIcon?: IconNames;
|
|
9
9
|
expandedRowIcon?: IconNames;
|
|
10
10
|
minRowHeight?: string;
|
|
11
11
|
};
|
|
12
|
-
export declare const Table: <T>({ className, ExpandableRowsComponent, progressComponent, customStyles, pagination, responsive, fixedHeader, noHeader, paginationPerPage, striped, theme, collapsedRowIcon, expandedRowIcon, minRowHeight, ...
|
|
12
|
+
export declare const Table: <T>({ className, ExpandableRowsComponent, progressComponent, customStyles, pagination, responsive, fixedHeader, noHeader, paginationPerPage, striped, theme, collapsedRowIcon, expandedRowIcon, minRowHeight, ...otherProps }: TableProps<T>) => JSX.Element;
|
package/table/table.js
CHANGED
|
@@ -2,20 +2,19 @@ import React, { useMemo } from 'react';
|
|
|
2
2
|
import ReactDataTable from 'react-data-table-component';
|
|
3
3
|
import { Icon, SkeletonBlock, Checkbox } from '..';
|
|
4
4
|
import { customStyle } from './theme';
|
|
5
|
-
import {
|
|
5
|
+
import { SortIcon, ExpandWrapper, ExpandContent } from './table.module.css';
|
|
6
6
|
import clsx from 'clsx';
|
|
7
|
-
export const Table = ({ className, ExpandableRowsComponent, progressComponent, customStyles, pagination = false, responsive = true, fixedHeader = false, noHeader = true, paginationPerPage = 8, striped = false, theme = 'default', collapsedRowIcon = 'chevron-right', expandedRowIcon = 'chevron-down', minRowHeight = '48px', ...
|
|
7
|
+
export const Table = ({ className, ExpandableRowsComponent, progressComponent, customStyles, pagination = false, responsive = true, fixedHeader = false, noHeader = true, paginationPerPage = 8, striped = false, theme = 'default', collapsedRowIcon = 'chevron-right', expandedRowIcon = 'chevron-down', minRowHeight = '48px', ...otherProps }) => {
|
|
8
8
|
const selectProps = {
|
|
9
9
|
indeterminate: (isIndeterminate) => isIndeterminate,
|
|
10
10
|
dimension: 'small'
|
|
11
11
|
};
|
|
12
12
|
const ExpandComponent = useMemo(() => ({ data: innerData }) => (React.createElement("div", { className: ExpandWrapper },
|
|
13
13
|
React.createElement("div", { className: ExpandContent }, ExpandableRowsComponent ? React.createElement(ExpandableRowsComponent, { data: innerData }) : null))), [ExpandableRowsComponent]);
|
|
14
|
-
return (React.createElement(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
React.createElement(Icon, { name: "arrow-up", dimension: 16 }))), ...props })));
|
|
14
|
+
return (React.createElement(ReactDataTable, { className: clsx(className), pagination: pagination, responsive: responsive, fixedHeader: fixedHeader, paginationPerPage: paginationPerPage, expandableRows: Boolean(ExpandableRowsComponent), expandOnRowClicked: Boolean(ExpandableRowsComponent), expandableRowsComponent: ExpandComponent, theme: theme, noHeader: noHeader, progressComponent: progressComponent || React.createElement("div", { style: { width: '100%' } },
|
|
15
|
+
React.createElement(SkeletonBlock, { height: 40, count: 8 })), striped: striped, customStyles: customStyles || customStyle(minRowHeight), selectableRowsComponent: Checkbox, selectableRowsComponentProps: selectProps, expandableIcon: {
|
|
16
|
+
collapsed: React.createElement(Icon, { name: collapsedRowIcon, fill: "var(--global-foreground)", dimension: 16 }),
|
|
17
|
+
expanded: React.createElement(Icon, { name: expandedRowIcon, fill: "var(--global-foreground)", dimension: 16 })
|
|
18
|
+
}, paginationIconFirstPage: React.createElement(Icon, { name: "backward-step", dimension: 24 }), paginationIconPrevious: React.createElement(Icon, { name: "chevron-left", dimension: 24 }), paginationIconNext: React.createElement(Icon, { name: "chevron-right", dimension: 24 }), paginationIconLastPage: React.createElement(Icon, { name: "forward-step", dimension: 24 }), sortIcon: (React.createElement("span", { className: SortIcon },
|
|
19
|
+
React.createElement(Icon, { name: "arrow-up" }))), ...otherProps }));
|
|
21
20
|
};
|
package/table/table.module.css
CHANGED