@wonderflow/react-components 6.1.0 → 8.1.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/core/utils/media.css +5 -5
- 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 +10 -11
- package/dist/components/avatar/avatar.js +1 -1
- package/dist/components/button/button.js +2 -2
- package/dist/components/button/button.module.css +1 -1
- package/dist/components/card/card.js +1 -1
- package/dist/components/chip/chip.js +1 -1
- package/dist/components/circular-progress/circular-progress.js +3 -3
- package/dist/components/clamp-text/clamp-text.js +1 -1
- package/dist/components/container/container.d.ts +1 -1
- package/dist/components/container/container.d.ts.map +1 -1
- package/dist/components/container/container.js +1 -1
- package/dist/components/container/container.module.css +1 -1
- package/dist/components/datetime/datetime.js +1 -1
- package/dist/components/disclosure/disclosure.d.ts.map +1 -1
- package/dist/components/disclosure/disclosure.js +4 -4
- package/dist/components/disclosure/disclosure.module.css +1 -1
- package/dist/components/drawer/drawer.d.ts.map +1 -1
- package/dist/components/drawer/drawer.js +2 -2
- package/dist/components/elevator/elevator.js +1 -1
- package/dist/components/grid/grid.js +1 -1
- package/dist/components/grid/item/grid-item.js +1 -1
- package/dist/components/icon/icon.d.ts +1 -1
- package/dist/components/icon/icon.js +2 -2
- package/dist/components/icon-button/icon-button.js +1 -1
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/info-state/info-state.js +1 -1
- package/dist/components/input-group/input-group.js +4 -4
- package/dist/components/linear-progress/linear-progress.js +2 -2
- package/dist/components/list/index.d.ts +1 -0
- package/dist/components/list/index.d.ts.map +1 -1
- package/dist/components/list/list-item.d.ts +28 -0
- package/dist/components/list/list-item.d.ts.map +1 -0
- package/dist/components/list/list-item.js +31 -0
- package/dist/components/list/list.d.ts +6 -11
- package/dist/components/list/list.d.ts.map +1 -1
- package/dist/components/list/list.js +9 -19
- package/dist/components/list/list.module.css +1 -1
- package/dist/components/masonry/masonry.js +1 -1
- package/dist/components/menu/menu-item/menu-item-checkbox.js +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 +6 -6
- package/dist/components/menu/menu.d.ts +5 -1
- 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/modal/content/modal-content.js +1 -1
- package/dist/components/modal/modal.d.ts.map +1 -1
- package/dist/components/modal/modal.js +2 -2
- package/dist/components/overlay-container/overlay-container.d.ts.map +1 -1
- package/dist/components/overlay-container/overlay-container.js +2 -2
- package/dist/components/overlay-container/overlay-context.js +1 -1
- package/dist/components/pagination/pagination.js +1 -1
- package/dist/components/popover/index.d.ts +4 -0
- package/dist/components/popover/index.d.ts.map +1 -0
- package/dist/components/popover/index.js +2 -0
- package/dist/components/popover/popover.d.ts +95 -0
- package/dist/components/popover/popover.d.ts.map +1 -0
- package/dist/components/popover/popover.js +93 -0
- package/dist/components/popover/popover.module.css +1 -0
- package/dist/components/prose/prose.js +1 -1
- package/dist/components/select/select.js +1 -1
- package/dist/components/select/select.module.css +1 -1
- package/dist/components/selection-controls/checkbox.js +1 -1
- package/dist/components/selection-controls/radio.js +1 -1
- package/dist/components/selection-controls/selection-controls.module.css +1 -1
- package/dist/components/selection-controls/toggle.js +1 -1
- package/dist/components/separator/separator.js +1 -1
- package/dist/components/skeleton/skeleton.js +3 -3
- package/dist/components/slider/slider.d.ts.map +1 -1
- package/dist/components/slider/slider.js +2 -2
- package/dist/components/slider/slider.module.css +1 -1
- package/dist/components/snackbar/snackbar.js +1 -1
- package/dist/components/spinner/spinner.d.ts.map +1 -1
- package/dist/components/spinner/spinner.js +6 -6
- package/dist/components/split-button/split-button.d.ts +2 -2
- package/dist/components/split-button/split-button.d.ts.map +1 -1
- package/dist/components/split-button/split-button.js +2 -2
- package/dist/components/stack/stack.js +1 -1
- package/dist/components/star-meter/star-meter.d.ts.map +1 -1
- package/dist/components/star-meter/star-meter.js +10 -10
- package/dist/components/star-meter/star-meter.module.css +1 -1
- package/dist/components/tab/tab.d.ts +27 -26
- package/dist/components/tab/tab.d.ts.map +1 -1
- package/dist/components/tab/tab.js +15 -32
- package/dist/components/tab/tab.module.css +1 -1
- package/dist/components/tab/tabs-panel.d.ts +10 -0
- package/dist/components/tab/tabs-panel.d.ts.map +1 -0
- package/dist/components/tab/tabs-panel.js +5 -0
- package/dist/components/table/table-cell/table-cell.js +1 -1
- package/dist/components/table/table-checkbox/table-checkbox.js +1 -1
- package/dist/components/table/table-controls/toggle-columns.d.ts.map +1 -1
- package/dist/components/table/table-controls/toggle-columns.js +3 -3
- package/dist/components/table/table-expand/table-expand.js +1 -1
- package/dist/components/table/table-header/table-header.js +1 -1
- package/dist/components/table/table-pagination/table-pagination.js +2 -2
- package/dist/components/table/table-row/table-row.js +1 -1
- package/dist/components/table/table.d.ts +41 -51
- package/dist/components/table/table.d.ts.map +1 -1
- package/dist/components/table/table.js +70 -65
- package/dist/components/table/types.d.ts +2 -2
- package/dist/components/table/types.d.ts.map +1 -1
- package/dist/components/text/text.js +3 -3
- package/dist/components/text/text.module.css +1 -1
- package/dist/components/textfield/base-field/base-field.js +1 -1
- package/dist/components/textfield/base-field/base-field.module.css +1 -1
- package/dist/components/textfield/textfield.js +3 -3
- package/dist/components/title/title.js +3 -3
- package/dist/components/title/title.module.css +1 -1
- package/dist/components/toggle-button/toggle-button.d.ts.map +1 -1
- package/dist/components/toggle-button/toggle-button.js +5 -5
- package/dist/components/tooltip/tooltip.d.ts +1 -1
- package/dist/components/tooltip/tooltip.js +2 -2
- package/dist/components/tooltip/tooltip.module.css +1 -1
- package/package.json +17 -17
- package/dist/components/dropdown/dropdown.d.ts +0 -87
- package/dist/components/dropdown/dropdown.d.ts.map +0 -1
- package/dist/components/dropdown/dropdown.js +0 -69
- package/dist/components/dropdown/dropdown.module.css +0 -1
- package/dist/components/dropdown/index.d.ts +0 -3
- package/dist/components/dropdown/index.d.ts.map +0 -1
- package/dist/components/dropdown/index.js +0 -1
- package/dist/components/tab/primitive-tab.d.ts +0 -12
- package/dist/components/tab/primitive-tab.d.ts.map +0 -1
- package/dist/components/tab/primitive-tab.js +0 -51
- package/dist/components/tab/tab-item.d.ts +0 -23
- package/dist/components/tab/tab-item.d.ts.map +0 -1
- package/dist/components/tab/tab-item.js +0 -24
- package/dist/components/tab/tab-list.d.ts +0 -8
- package/dist/components/tab/tab-list.d.ts.map +0 -1
- package/dist/components/tab/tab-list.js +0 -11
- package/dist/components/tab/tab-panel.d.ts +0 -35
- package/dist/components/tab/tab-panel.d.ts.map +0 -1
- package/dist/components/tab/tab-panel.js +0 -16
- package/dist/components/tab/use-constant.d.ts +0 -2
- package/dist/components/tab/use-constant.d.ts.map +0 -1
- package/dist/components/tab/use-constant.js +0 -8
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, useCallback, useState } from 'react';
|
|
3
|
-
import { Stack, Text, Icon } from '../..';
|
|
3
|
+
import { Stack, Text, Icon, Textfield } from '../..';
|
|
4
4
|
import styles from './slider.module.css';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
export const Slider = forwardRef(({ min = 0, max = 100, step, onInput, className, defaultValue = 0, dimension = 'regular', showValues, iconMin, iconMax, ...otherProps }, forwardedRef) => {
|
|
@@ -10,6 +10,6 @@ export const Slider = forwardRef(({ min = 0, max = 100, step, onInput, className
|
|
|
10
10
|
onInput && onInput(currentTarget.valueAsNumber);
|
|
11
11
|
setValue(currentTarget.valueAsNumber);
|
|
12
12
|
}, [onInput]);
|
|
13
|
-
return (_jsxs(Stack, { direction: "row", vAlign: "center", columnGap: 8, className: clsx(styles.Slider, className), "data-slider-dimension": dimension, children: [showValues && _jsx(Text, { as: "span", size: isSmall ? 14 : 16, weight: "bold", textAlign: "end", className: styles.Value, children:
|
|
13
|
+
return (_jsxs(Stack, { direction: "row", vAlign: "center", columnGap: 8, className: clsx(styles.Slider, className), "data-slider-dimension": dimension, children: [showValues && _jsx(Text, { as: "span", size: isSmall ? 14 : 16, weight: "bold", textAlign: "end", className: styles.Value, children: min }), (iconMin && !showValues) && _jsx(Icon, { source: iconMin, dimension: isSmall ? 16 : 24 }), _jsx("input", { ref: forwardedRef, className: styles.Input, type: "range", min: min, max: max, defaultValue: value, "aria-valuemin": min, "aria-valuemax": max, "aria-valuenow": value, step: step, onInput: handleInput, ...otherProps }), showValues && _jsx(Text, { as: "span", size: isSmall ? 14 : 16, weight: "bold", className: styles.Value, children: max }), showValues && _jsx(Textfield, { readOnly: true, dimension: "small", size: String(max).length, value: value, className: styles.CurrentValue }), (iconMax && !showValues) && _jsx(Icon, { source: iconMax, dimension: isSmall ? 16 : 24 })] }));
|
|
14
14
|
});
|
|
15
15
|
Slider.displayName = 'Slider';
|
|
@@ -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:active,.Input::-webkit-slider-thumb:focus{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::-moz-range-thumb:active,.Input::-moz-range-thumb:focus{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}.Value{
|
|
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:active,.Input::-webkit-slider-thumb:focus{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::-moz-range-thumb:active,.Input::-moz-range-thumb:focus{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}
|
|
@@ -11,5 +11,5 @@ export const Snackbar = forwardRef(({ children, className, title, icon, kind = '
|
|
|
11
11
|
positive: 'check',
|
|
12
12
|
danger: 'circle-x'
|
|
13
13
|
};
|
|
14
|
-
return (_jsx(Wrapper, { ref: forwardedRef, className: clsx(styles.Snackbar, className), "data-snackbar-kind": kind, role: "status", ...otherProps, children: _jsxs(Stack, { vAlign: "start", hAlign: "start", direction: "row", columnGap: 16, fill: false, children: [_jsx(Icon, { className: styles.Icon, weight: "duotone", source: icon || defaultIcons[kind], dimension: 24 }
|
|
14
|
+
return (_jsx(Wrapper, { ref: forwardedRef, className: clsx(styles.Snackbar, className), "data-snackbar-kind": kind, role: "status", ...otherProps, children: _jsxs(Stack, { vAlign: "start", hAlign: "start", direction: "row", columnGap: 16, fill: false, children: [_jsx(Icon, { className: styles.Icon, weight: "duotone", source: icon || defaultIcons[kind], dimension: 24 }), _jsxs(Stack, { rowGap: 16, children: [_jsxs(Stack, { rowGap: 8, children: [title && _jsx(Title, { level: "5", children: title }), _jsx("p", { children: children })] }), dismissable && (_jsx(Stack, { hAlign: "end", children: _jsx(Button, { onClick: onDismiss, className: styles.Action, children: dismissLabel }) }))] })] }) }));
|
|
15
15
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spinner.d.ts","sourceRoot":"","sources":["../../../src/components/spinner/spinner.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,aAAa,EAAE,MAAM,OAAO,CAAA;AAIjD,oBAAY,YAAY,GAAG,aAAa,CAAC,UAAU,CAAC,GAAG;IACrD;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,KAAK,CAAC;IACxC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAA;AAED,eAAO,MAAM,OAAO;IAVlB;;OAEG;;IAEH;;OAEG;;
|
|
1
|
+
{"version":3,"file":"spinner.d.ts","sourceRoot":"","sources":["../../../src/components/spinner/spinner.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,aAAa,EAAE,MAAM,OAAO,CAAA;AAIjD,oBAAY,YAAY,GAAG,aAAa,CAAC,UAAU,CAAC,GAAG;IACrD;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,KAAK,CAAC;IACxC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAA;AAED,eAAO,MAAM,OAAO;IAVlB;;OAEG;;IAEH;;OAEG;;iDA8DH,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
|
-
import {
|
|
4
|
+
import { domMax, LazyMotion, m } from 'framer-motion';
|
|
5
5
|
export const Spinner = forwardRef(({ className, style, color, dimension = 'big' }, forwardedRef) => {
|
|
6
6
|
const attributes = {
|
|
7
7
|
small: {
|
|
@@ -14,10 +14,10 @@ export const Spinner = forwardRef(({ className, style, color, dimension = 'big'
|
|
|
14
14
|
size: 30
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
|
-
return (_jsx(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
return (_jsx(LazyMotion, { features: domMax, strict: true, children: _jsx(m.svg, { ref: forwardedRef, className: clsx(className), animate: { rotate: '2turn' }, transition: {
|
|
18
|
+
duration: 2,
|
|
19
|
+
repeat: Infinity,
|
|
20
|
+
repeatDelay: 2
|
|
21
|
+
}, style: { ...style, originX: '50%', originY: '50%' }, width: attributes[dimension].size, height: attributes[dimension].size, viewBox: "0 0 38 38", stroke: color || 'currentColor', xmlns: "http://www.w3.org/2000/svg", strokeLinecap: "round", children: _jsxs("g", { transform: "translate(1 1)", strokeWidth: 2, fill: "none", fillRule: "evenodd", children: [_jsx("circle", { strokeOpacity: 0.5, cx: 18, cy: 18, r: 18 }), _jsx("path", { d: "M36 18c0-9.94-8.06-18-18-18", children: _jsx("animateTransform", { attributeName: "transform", type: "rotate", from: "0 18 18", to: "360 18 18", dur: "1s", repeatCount: "indefinite" }) })] }) }) }));
|
|
22
22
|
});
|
|
23
23
|
Spinner.displayName = 'Spinner';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Button,
|
|
1
|
+
import { Button, PopoverProps, Polymorphic } from '../..';
|
|
2
2
|
import { Except } from 'type-fest';
|
|
3
|
-
export declare type SplitButtonProps = Pick<
|
|
3
|
+
export declare type SplitButtonProps = Pick<PopoverProps, 'placement' | 'offset'> & {
|
|
4
4
|
/**
|
|
5
5
|
* Set the label of the action associated to the dropdown.
|
|
6
6
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"split-button.d.ts","sourceRoot":"","sources":["../../../src/components/split-button/split-button.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"split-button.d.ts","sourceRoot":"","sources":["../../../src/components/split-button/split-button.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAW,YAAY,EAAS,WAAW,EAAE,MAAM,cAAc,CAAA;AAEhF,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAElC,oBAAY,gBAAgB,GAAG,IAAI,CAAC,YAAY,EAAE,WAAW,GAAG,QAAQ,CAAC,GAAG;IAC1E;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;CACf,CAAA;AAED,aAAK,sBAAsB,GAAG,WAAW,CAAC,mBAAmB,CAC3D,WAAW,CAAC,gBAAgB,CAAC,OAAO,MAAM,CAAC,EAC3C,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,OAAO,MAAM,CAAC,EAAE,cAAc,GAAG,WAAW,GAAG,SAAS,CAAC,GAAG,gBAAgB,CACzG,CAAC;AAEF,eAAO,MAAM,WAAW,wBA+CI,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 { forwardRef } from 'react';
|
|
4
|
-
import { Button,
|
|
4
|
+
import { Button, Popover, Stack } from '../..';
|
|
5
5
|
import styles from './split-button.module.css';
|
|
6
6
|
export const SplitButton = forwardRef(({ className, label, icon = 'chevron-down', kind, dimension, fullWidth, disabled, busy, children, placement, offset, onClick, ...otherProps }, forwardedRef) => {
|
|
7
7
|
const commonProps = {
|
|
@@ -9,5 +9,5 @@ export const SplitButton = forwardRef(({ className, label, icon = 'chevron-down'
|
|
|
9
9
|
dimension,
|
|
10
10
|
disabled
|
|
11
11
|
};
|
|
12
|
-
return (_jsxs(Stack, { className: clsx(styles.SplitButton, className), direction: "row", inline: !fullWidth, children: [_jsx(Button, { busy: busy, fullWidth: fullWidth, onClick: onClick, ref: forwardedRef, ...commonProps, ...otherProps, children: label }
|
|
12
|
+
return (_jsxs(Stack, { className: clsx(styles.SplitButton, className), direction: "row", inline: !fullWidth, children: [_jsx(Button, { busy: busy, fullWidth: fullWidth, onClick: onClick, ref: forwardedRef, ...commonProps, ...otherProps, children: label }), _jsx(Popover, { placement: placement, offset: offset, disabled: disabled, trigger: _jsx(Button, { icon: icon, ...commonProps }), children: children })] }));
|
|
13
13
|
});
|
|
@@ -18,5 +18,5 @@ export const Stack = forwardRef(({ children, className, rowGap, columnGap, as: W
|
|
|
18
18
|
'--vPadding': vPadding ? tkns.space[vPadding] : 0,
|
|
19
19
|
'--hPadding': hPadding ? tkns.space[hPadding] : 0
|
|
20
20
|
};
|
|
21
|
-
return (_jsx(Wrapper, { ref: forwardedRef, style: { ...computedStyle, ...style }, "data-stack-inline": inline, "data-stack-wrap": wrap, "data-stack-direction": direction, "data-stack-fill": fill, "data-stack-has-padding": Boolean(hPadding || vPadding), className: clsx(styles.Stack, styles.StackWrapper, className), ...otherProps, children: children }
|
|
21
|
+
return (_jsx(Wrapper, { ref: forwardedRef, style: { ...computedStyle, ...style }, "data-stack-inline": inline, "data-stack-wrap": wrap, "data-stack-direction": direction, "data-stack-fill": fill, "data-stack-has-padding": Boolean(hPadding || vPadding), className: clsx(styles.Stack, styles.StackWrapper, className), ...otherProps, children: children }));
|
|
22
22
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"star-meter.d.ts","sourceRoot":"","sources":["../../../src/components/star-meter/star-meter.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,SAAS,
|
|
1
|
+
{"version":3,"file":"star-meter.d.ts","sourceRoot":"","sources":["../../../src/components/star-meter/star-meter.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,SAAS,EAAwB,MAAM,OAAO,CAAA;AAGnE,OAAO,EAAmB,KAAK,EAAQ,WAAW,EAAa,MAAM,cAAc,CAAA;AAInF,oBAAY,cAAc,GAAG;IAC3B;;;;;;;;;;;OAWG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,KAAK,CAAC;IACxC;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAA;AAED,aAAK,oBAAoB,GAAG,WAAW,CAAC,mBAAmB,CACzD,WAAW,CAAC,gBAAgB,CAAC,OAAO,KAAK,CAAC,EAC1C,WAAW,CAAC,QAAQ,CAAC,OAAO,KAAK,CAAC,GAAG,cAAc,CACpD,CAAC;AAEF,eAAO,MAAM,SAAS,sBA6GI,CAAA"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef } from 'react';
|
|
2
|
+
import { forwardRef, useCallback, useMemo } from 'react';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import { useUIDSeed } from 'react-uid';
|
|
5
5
|
import { Text, Stack, Icon } from '../..';
|
|
6
6
|
import styles from './star-meter.module.css';
|
|
7
7
|
export const StarMeter = forwardRef(({ className, value = 0, starCount = 5, label, dimension = 'regular', hideLabel = false, ...otherProps }, forwardedRef) => {
|
|
8
8
|
const seedID = useUIDSeed();
|
|
9
|
-
const properties = {
|
|
9
|
+
const properties = useMemo(() => ({
|
|
10
10
|
small: {
|
|
11
11
|
labelSize: 14,
|
|
12
12
|
iconSize: 12
|
|
@@ -19,9 +19,9 @@ export const StarMeter = forwardRef(({ className, value = 0, starCount = 5, labe
|
|
|
19
19
|
labelSize: 18,
|
|
20
20
|
iconSize: 24
|
|
21
21
|
}
|
|
22
|
-
};
|
|
23
|
-
const clamp = (num, min, max) => Math.min(Math.max(num, min), max);
|
|
24
|
-
const roundValue = (value) => {
|
|
22
|
+
}), []);
|
|
23
|
+
const clamp = useMemo(() => (num, min, max) => Math.min(Math.max(num, min), max), []);
|
|
24
|
+
const roundValue = useCallback((value) => {
|
|
25
25
|
const integer = parseInt(String(value), 10);
|
|
26
26
|
const fraction = value - integer;
|
|
27
27
|
if (fraction >= 0.75) {
|
|
@@ -34,8 +34,8 @@ export const StarMeter = forwardRef(({ className, value = 0, starCount = 5, labe
|
|
|
34
34
|
return integer + 0.5;
|
|
35
35
|
}
|
|
36
36
|
return 0;
|
|
37
|
-
};
|
|
38
|
-
const starType = (maxStars, value) => {
|
|
37
|
+
}, []);
|
|
38
|
+
const starType = useCallback((maxStars, value) => {
|
|
39
39
|
const roundedValue = roundValue(value);
|
|
40
40
|
return new Array(maxStars).fill(0).map((_, index) => {
|
|
41
41
|
const starIndex = index + 1;
|
|
@@ -46,8 +46,8 @@ export const StarMeter = forwardRef(({ className, value = 0, starCount = 5, labe
|
|
|
46
46
|
if (roundedValue < starIndex && roundedValue > starIndex - 1) {
|
|
47
47
|
fillType = 'url(#HalfStar)';
|
|
48
48
|
}
|
|
49
|
-
return _jsx(Icon, { source: "star", weight: "solid", className: styles.Icon, dimension: properties[dimension].iconSize, fill: fillType }, starIndex);
|
|
49
|
+
return (_jsx(Icon, { source: "star", weight: "solid", className: styles.Icon, dimension: properties[dimension].iconSize, fill: fillType }, starIndex));
|
|
50
50
|
});
|
|
51
|
-
};
|
|
52
|
-
return (_jsxs(Stack, { inline: true, direction: "row", vAlign: "center", columnGap: 8, className: clsx(styles.StarMeter, className), role: "meter", fill: false, "aria-valuenow": clamp(value, 0, starCount), "aria-valuemin": 0, "aria-valuemax": starCount, "aria-labelledby": seedID('star-meter'), "data-star-meter-dimension": dimension, ref: forwardedRef, ...otherProps, children: [_jsx("svg", { "aria-hidden": "true", className: styles.Gradient, width: "100", height: "50", version: "1.1", xmlns: "http://www.w3.org/2000/svg", children: _jsx("defs", { children: _jsxs("linearGradient", { id: "HalfStar", children: [_jsx("stop", { offset: "0", style: { stopColor: 'var(--star-color)' } }
|
|
51
|
+
}, [dimension, properties, roundValue]);
|
|
52
|
+
return (_jsxs(Stack, { inline: true, direction: "row", vAlign: "center", columnGap: 8, className: clsx(styles.StarMeter, className), role: "meter", fill: false, "aria-valuenow": clamp(value, 0, starCount), "aria-valuemin": 0, "aria-valuemax": starCount, "aria-labelledby": seedID('star-meter'), "data-star-meter-dimension": dimension, ref: forwardedRef, ...otherProps, children: [_jsx("svg", { "aria-hidden": "true", className: styles.Gradient, width: "100", height: "50", version: "1.1", xmlns: "http://www.w3.org/2000/svg", children: _jsx("defs", { children: _jsxs("linearGradient", { id: "HalfStar", children: [_jsx("stop", { offset: "0", style: { stopColor: 'var(--star-color)' } }), _jsx("stop", { offset: "50%", style: { stopColor: 'var(--star-color)' } }), _jsx("stop", { offset: "50.1%", style: { stopColor: 'var(--star-dimmed-color)' } }), _jsx("stop", { offset: "100%", style: { stopColor: 'var(--star-dimmed-color)' } })] }) }) }), _jsx(Stack, { direction: "row", columnGap: dimension === 'small' ? 2 : 4, children: starType(starCount, value) }), _jsx(Text, { dimmed: 6, id: seedID('star-meter'), size: properties[dimension].labelSize, weight: "bold", children: !hideLabel && _jsx(_Fragment, { children: label || value.toString() }) })] }));
|
|
53
53
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.StarMeter{--star-color:#f5a856;--star-dimmed-color:var(--dimmed-2);--icon-size:0.89rem;position:relative}.StarMeter[data-star-meter-dimension=small]{--icon-size:
|
|
1
|
+
.StarMeter{--star-color:#f5a856;--star-dimmed-color:var(--dimmed-2);--icon-size:0.89rem;position:relative}.StarMeter[data-star-meter-dimension=small]{--icon-size:token(--icon-size-14)}.StarMeter[data-star-meter-dimension=big]{--icon-size:1.33rem}.Gradient{clip:rect(0 0 0 0);block-size:1px;clip-path:inset(50%);inline-size:1px;overflow:hidden;position:absolute;white-space:nowrap}.Icon{block-size:var(--icon-size);inline-size:var(--icon-size)}
|
|
@@ -1,35 +1,36 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import { TabPanelProps } from './tab-panel';
|
|
5
|
-
import { Polymorphic } from '../..';
|
|
6
|
-
/**
|
|
7
|
-
* Tab.Root
|
|
8
|
-
* Public api
|
|
9
|
-
*/
|
|
10
|
-
export declare type TabProps = PropsWithClass & {
|
|
1
|
+
import * as TabsPrimitive from '@radix-ui/react-tabs';
|
|
2
|
+
import { PropsWithChildren } from 'react';
|
|
3
|
+
export declare type TabProps = PropsWithChildren<PropsWithClass> & {
|
|
11
4
|
/**
|
|
12
|
-
*
|
|
5
|
+
* The value for the selected tab, if controlled
|
|
13
6
|
*/
|
|
14
|
-
|
|
7
|
+
value?: TabsPrimitive.TabsProps['value'];
|
|
15
8
|
/**
|
|
16
|
-
*
|
|
9
|
+
* The value of the tab to select by default, if uncontrolled
|
|
17
10
|
*/
|
|
18
|
-
|
|
11
|
+
defaultValue?: TabsPrimitive.TabsProps['defaultValue'];
|
|
19
12
|
/**
|
|
20
|
-
*
|
|
13
|
+
* A function called when a new tab is selected
|
|
21
14
|
*/
|
|
22
|
-
|
|
15
|
+
onValueChange?: TabsPrimitive.TabsProps['onValueChange'];
|
|
16
|
+
/**
|
|
17
|
+
* The direction of navigation between toolbar items.
|
|
18
|
+
* @defaultValue ltr
|
|
19
|
+
*/
|
|
20
|
+
dir?: TabsPrimitive.TabsProps['dir'];
|
|
21
|
+
/**
|
|
22
|
+
* When `automatic`, tabs are activated when receiving focus.
|
|
23
|
+
* When `manual`, tabs are activated when clicked.
|
|
24
|
+
*/
|
|
25
|
+
activationMode?: TabsPrimitive.TabsProps['activationMode'];
|
|
26
|
+
/**
|
|
27
|
+
* When true, keyboard navigation will loop from last tab to first, and vice versa.
|
|
28
|
+
* @defaultValue true
|
|
29
|
+
*/
|
|
30
|
+
loop?: TabsPrimitive.TabsListProps['loop'];
|
|
23
31
|
};
|
|
24
|
-
declare
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
List: React.ForwardRefExoticComponent<TabListProps>;
|
|
32
|
+
export declare const Tab: {
|
|
33
|
+
({ className, children, onValueChange, defaultValue, loop, ...otherProps }: TabProps): JSX.Element;
|
|
34
|
+
Panel: ({ className, children, label, ...otherProps }: import("./tabs-panel").TabPanelProps) => JSX.Element;
|
|
28
35
|
};
|
|
29
|
-
/**
|
|
30
|
-
* Tab.Root
|
|
31
|
-
* Component
|
|
32
|
-
*/
|
|
33
|
-
export declare const Tab: TabComponent;
|
|
34
|
-
export {};
|
|
35
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,
|
|
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"}
|
|
@@ -1,35 +1,18 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { TabList } from './tab-list';
|
|
7
|
-
import { TabPanel } from './tab-panel';
|
|
8
|
-
import { Tabs as TabsWrapper } from './primitive-tab';
|
|
2
|
+
import * as TabsPrimitive from '@radix-ui/react-tabs';
|
|
3
|
+
import { domMax, LazyMotion, m } from 'framer-motion';
|
|
4
|
+
import { Children, isValidElement, useCallback, useState } from 'react';
|
|
5
|
+
import { Button } from '../..';
|
|
9
6
|
import styles from './tab.module.css';
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
onChange(currentTab);
|
|
22
|
-
}
|
|
23
|
-
}, [currentTab, onChange]);
|
|
24
|
-
return (_jsx("div", { ref: forwardedRef, className: clsx(styles.Tab, className), ...otherProps, children: _jsxs(TabsWrapper, { state: tabState, children: [_jsx(TabList, { children: Children.map(children, (child, index) => isValidElement(child) && (_jsx(TabItem, { id: seedID('tab-item'), "aria-controls": seedID('tab-panel'), icon: child.props.icon, children: child.props.label }, void 0))) }, void 0), Children.map(children, (child, index) => isValidElement(child) && cloneElement(child, {
|
|
25
|
-
id: seedID('tab-panel'),
|
|
26
|
-
'aria-labelledby': seedID('tab-item')
|
|
27
|
-
}))] }, void 0) }, void 0));
|
|
28
|
-
});
|
|
29
|
-
Tab.displayName = 'Tab';
|
|
30
|
-
/* -------------------------------------------------------------------------- */
|
|
31
|
-
/* Export */
|
|
32
|
-
/* -------------------------------------------------------------------------- */
|
|
7
|
+
import { TabPanel } from './tabs-panel';
|
|
8
|
+
import { useUIDSeed } from 'react-uid';
|
|
9
|
+
export const Tab = ({ className, children, onValueChange, defaultValue, loop, ...otherProps }) => {
|
|
10
|
+
const [activeItem, setActiveItem] = useState(defaultValue ?? '');
|
|
11
|
+
const uid = useUIDSeed();
|
|
12
|
+
const handleOnVlaueChange = useCallback((value) => {
|
|
13
|
+
onValueChange?.(value);
|
|
14
|
+
setActiveItem(value);
|
|
15
|
+
}, [onValueChange]);
|
|
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
|
+
};
|
|
33
18
|
Tab.Panel = TabPanel;
|
|
34
|
-
Tab.Item = TabItem;
|
|
35
|
-
Tab.List = TabList;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
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}}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as TabsPrimitive from '@radix-ui/react-tabs';
|
|
2
|
+
import { IconProps } from '../..';
|
|
3
|
+
import { PropsWithChildren } from 'react';
|
|
4
|
+
export declare type TabPanelProps = PropsWithChildren<PropsWithClass> & {
|
|
5
|
+
label: string;
|
|
6
|
+
icon?: IconProps['source'];
|
|
7
|
+
value: TabsPrimitive.TabsContentProps['value'];
|
|
8
|
+
};
|
|
9
|
+
export declare const TabPanel: ({ className, children, label, ...otherProps }: TabPanelProps) => JSX.Element;
|
|
10
|
+
//# sourceMappingURL=tabs-panel.d.ts.map
|
|
@@ -0,0 +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;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"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as TabsPrimitive from '@radix-ui/react-tabs';
|
|
3
|
+
import styles from './tab.module.css';
|
|
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 }));
|
|
@@ -14,5 +14,5 @@ export const TableCell = forwardRef(({ children, className, collapsed, isSorted,
|
|
|
14
14
|
...dynamicStyle,
|
|
15
15
|
...style,
|
|
16
16
|
userSelect: Wrapper === 'td' ? undefined : 'none'
|
|
17
|
-
}, ...otherProps, children: [children, isSorted && (_jsx(Icon, { dimension: 12, className: styles.HeadCellIcon, fill: "var(--highlight-red-foreground)", source: isSortedDesc ? 'bars-sort-down' : 'bars-sort-up' }
|
|
17
|
+
}, ...otherProps, children: [children, isSorted && (_jsx(Icon, { dimension: 12, className: styles.HeadCellIcon, fill: "var(--highlight-red-foreground)", source: isSortedDesc ? 'bars-sort-down' : 'bars-sort-up' }))] }));
|
|
18
18
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Checkbox } from '../../..';
|
|
3
3
|
import styles from './table-checkbox.module.css';
|
|
4
|
-
export const TableCheckbox = ({ ...otherProps }) => (_jsx(Checkbox, { className: styles.TableCheckbox, dimension: "small", ...otherProps }
|
|
4
|
+
export const TableCheckbox = ({ ...otherProps }) => (_jsx(Checkbox, { className: styles.TableCheckbox, dimension: "small", ...otherProps }));
|
|
@@ -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"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, useMemo } from 'react';
|
|
3
|
-
import { Button, Menu,
|
|
3
|
+
import { Button, Menu, Popover } from '../../..';
|
|
4
4
|
export const ToggleColumnsControl = ({ columns, visibleColumns }) => {
|
|
5
5
|
const someVisibleColums = useMemo(() => visibleColumns.length !== 0, [visibleColumns]);
|
|
6
|
-
const filteredColumns = useMemo(() => columns.filter(col => !col.
|
|
6
|
+
const filteredColumns = useMemo(() => columns.filter(col => !col.isToggable), [columns]);
|
|
7
7
|
const handleToggleAll = useCallback(() => {
|
|
8
8
|
/**
|
|
9
9
|
* If there are visible columns (excluding artificial ones),
|
|
@@ -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(
|
|
22
|
+
return (_jsx(Popover, { placement: "bottom-start", trigger: _jsx(Button, { kind: "secondary", children: "Toggle columns" }), children: _jsxs(Menu, { 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,3 +1,3 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import styles from './table-expand.module.css';
|
|
3
|
-
export const TableExpand = ({ data, component: Component }) => (_jsx("div", { className: styles.TableExpand, children: _jsx("div", { className: styles.ExpandContent, children: Component ? _jsx(Component, { ...data }
|
|
3
|
+
export const TableExpand = ({ data, component: Component }) => (_jsx("div", { className: styles.TableExpand, children: _jsx("div", { className: styles.ExpandContent, children: Component ? _jsx(Component, { ...data }) : null }) }));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Stack, Title } from '../../..';
|
|
3
3
|
import styles from './table-header.module.css';
|
|
4
|
-
export const TableHeader = ({ children, title, id, ...otherProps }) => (_jsxs(Stack, { direction: "row", columnGap: 32, vAlign: "center", hAlign: "space-between", fill: false, className: styles.TableHeader, ...otherProps, children: [_jsx("div", { children: typeof title === 'string' ? _jsx(Title, { id: id, level: "5", children: title }
|
|
4
|
+
export const TableHeader = ({ children, title, id, ...otherProps }) => (_jsxs(Stack, { direction: "row", columnGap: 32, vAlign: "center", hAlign: "space-between", fill: false, className: styles.TableHeader, ...otherProps, children: [_jsx("div", { children: typeof title === 'string' ? _jsx(Title, { id: id, level: "5", children: title }) : title }), _jsx(Stack, { direction: "row", vAlign: "center", columnGap: 8, inline: true, children: children })] }));
|
|
@@ -7,7 +7,7 @@ export const TablePagination = ({ children, pageSize, onPageSizeChange, clusters
|
|
|
7
7
|
const computedPageCount = useMemo(() => (isManual ? Math.ceil(totalItems / pageSize) : totalPages), [isManual, pageSize, totalItems, totalPages]);
|
|
8
8
|
const computedItemsInPageStart = useMemo(() => (currentPage && pageSize) && currentPage * pageSize, [currentPage, pageSize]);
|
|
9
9
|
const computedItemsInPageEnd = useMemo(() => currentPage * pageSize + pageSize, [currentPage, pageSize]);
|
|
10
|
-
return (_jsxs(Stack, { fill: false, direction: "row", columnGap: 16, vAlign: "center", hAlign: "end", vPadding: 16, ...otherProps, children: [_jsxs(Stack, { direction: "row", columnGap: 4, children: [_jsx(Text, { as: "label", htmlFor: uid('table-i-per-page'), size: 14, children: "Items per page:" }
|
|
10
|
+
return (_jsxs(Stack, { fill: false, direction: "row", columnGap: 16, vAlign: "center", hAlign: "end", vPadding: 16, ...otherProps, children: [_jsxs(Stack, { direction: "row", columnGap: 4, children: [_jsx(Text, { as: "label", htmlFor: uid('table-i-per-page'), size: 14, children: "Items per page:" }), _jsx(Select, { value: pageSize, dimension: "small", id: uid('table-i-per-page'), onChange: ({ currentTarget }) => {
|
|
11
11
|
onPageSizeChange?.(Number(currentTarget.value));
|
|
12
|
-
}, children: clusters.map(cluster => (_jsx("option", { value: cluster, children: cluster }, cluster))) }
|
|
12
|
+
}, children: clusters.map(cluster => (_jsx("option", { value: cluster, children: cluster }, cluster))) })] }), _jsx(Text, { "aria-hidden": "true", weight: "bold", size: 14, children: `${computedItemsInPageStart + 1}-${computedItemsInPageEnd > totalItems ? totalItems : computedItemsInPageEnd} of ${totalItems}` }), _jsx(Pagination, { itemsCount: totalItems, itemsPerPage: pageSize, pageCount: computedPageCount, onPageClick: ({ selected }) => onPageClick?.(selected), renderOnZeroPageCount: () => null, forcePage: currentPage })] }));
|
|
13
13
|
};
|
|
@@ -11,5 +11,5 @@ export const TableRow = ({ children, className, expanded, rowData, expandedRows,
|
|
|
11
11
|
});
|
|
12
12
|
return Boolean(isHighlight);
|
|
13
13
|
}, [expandedRows, rowData]);
|
|
14
|
-
return (_jsx("tr", { className: clsx(styles.TableRow, className), "data-table-row-expanded": expanded, "data-table-row-highlight": highlightRow || undefined, ...otherProps, children: children }
|
|
14
|
+
return (_jsx("tr", { className: clsx(styles.TableRow, className), "data-table-row-expanded": expanded, "data-table-row-highlight": highlightRow || undefined, ...otherProps, children: children }));
|
|
15
15
|
};
|
|
@@ -2,7 +2,7 @@ import { ComponentType, ReactNode } from 'react';
|
|
|
2
2
|
import { IdType, Row, SortingRule } from 'react-table';
|
|
3
3
|
import { TableHeaderProps } from './table-header';
|
|
4
4
|
import { TablePaginationProps } from './table-pagination';
|
|
5
|
-
import { CustomColumnsType,
|
|
5
|
+
import { CustomColumnsType, OptionalDataTypes, CustomSortingRule, PaginationPageType } from './types';
|
|
6
6
|
export declare type TableProps<T extends Record<string, unknown>> = PropsWithClass & {
|
|
7
7
|
/**
|
|
8
8
|
* Define the columns and headers of the table.
|
|
@@ -16,51 +16,11 @@ export declare type TableProps<T extends Record<string, unknown>> = PropsWithCla
|
|
|
16
16
|
* Define the default visibility of the columns. This is an array of columns `id`,
|
|
17
17
|
*/
|
|
18
18
|
defaultHiddenColumns?: Array<IdType<T>>;
|
|
19
|
-
/**
|
|
20
|
-
* Show pagination below the table. This is recommended only for tables with a lot of rows.
|
|
21
|
-
*/
|
|
22
|
-
showPagination?: boolean;
|
|
23
|
-
/**
|
|
24
|
-
* The amount of entries to show for each page.
|
|
25
|
-
*/
|
|
26
|
-
itemsPerPage?: number;
|
|
27
|
-
/**
|
|
28
|
-
* The index of the page that should be set as active when the table is rendered.
|
|
29
|
-
*/
|
|
30
|
-
activePageIndex?: number;
|
|
31
|
-
/**
|
|
32
|
-
* The callback that is called when the active page index and page size change.
|
|
33
|
-
* Passing this property along side `showPagination` will enable manual pagination,
|
|
34
|
-
* disabling the automatic one.
|
|
35
|
-
*/
|
|
36
|
-
onDataUpdate?: ({ pageIndex, pageSize }: PaginationType) => Promise<void> | void;
|
|
37
|
-
/**
|
|
38
|
-
* Set the number of pages to show in the pagination. Used only when doing manual pagination.
|
|
39
|
-
*/
|
|
40
|
-
totalRows?: number;
|
|
41
|
-
/**
|
|
42
|
-
* Set clusters of items to show in a single page. These values are used to
|
|
43
|
-
* compute the select options for the page size dropdown.
|
|
44
|
-
*/
|
|
45
|
-
pageClusters?: TablePaginationProps['clusters'];
|
|
46
19
|
/**
|
|
47
20
|
* Enable row selection. This property will render an additiona column
|
|
48
21
|
* at the start of the table, containing a checkbox.
|
|
49
22
|
*/
|
|
50
23
|
selectableRows?: boolean;
|
|
51
|
-
/**
|
|
52
|
-
* Callback run when the selected rows change
|
|
53
|
-
*/
|
|
54
|
-
onSelectionChange?: (selectedRows?: Array<Row<T>>, selectedRowIds?: Record<IdType<T>, boolean>) => void;
|
|
55
|
-
/**
|
|
56
|
-
* If true, disable the automatic column sorting of the table. Turn this on if you want to
|
|
57
|
-
* to control the sorting yourself.
|
|
58
|
-
*/
|
|
59
|
-
isManualSorted?: boolean;
|
|
60
|
-
/**
|
|
61
|
-
* Callback run when a column is sorted
|
|
62
|
-
*/
|
|
63
|
-
onSortChange?: (sorting: Array<CustomSortingRule<T>>) => void;
|
|
64
24
|
/**
|
|
65
25
|
* Add an alternate style to the table rows
|
|
66
26
|
*/
|
|
@@ -97,11 +57,11 @@ export declare type TableProps<T extends Record<string, unknown>> = PropsWithCla
|
|
|
97
57
|
/**
|
|
98
58
|
* Set the label for selected items in the table. Default to "Selected items"
|
|
99
59
|
*/
|
|
100
|
-
selectedLabel?: (
|
|
60
|
+
selectedLabel?: (selectedRowIds: Array<Row<T>>) => ReactNode;
|
|
101
61
|
/**
|
|
102
62
|
* Pass custom components to show when rows are selected.
|
|
103
63
|
*/
|
|
104
|
-
selectedActions?: ReactNode;
|
|
64
|
+
selectedActions?: (selectedRows: Array<Row<T>>) => ReactNode;
|
|
105
65
|
/**
|
|
106
66
|
* Set the table height after which the table will scroll.
|
|
107
67
|
*/
|
|
@@ -118,21 +78,51 @@ export declare type TableProps<T extends Record<string, unknown>> = PropsWithCla
|
|
|
118
78
|
* a component.
|
|
119
79
|
*/
|
|
120
80
|
expandableRowComponent?: ComponentType<T>;
|
|
121
|
-
/**
|
|
122
|
-
* A react component that add custom actions to rows. If fuction is passed,
|
|
123
|
-
* the function will be called with the row data and the function must return
|
|
124
|
-
* a component.
|
|
125
|
-
*/
|
|
126
|
-
actionsRowComponent?: ComponentType<Row<T>>;
|
|
127
81
|
/**
|
|
128
82
|
* Custom component/empty state to show when the table has no data or
|
|
129
83
|
* all columns have been toggled off.
|
|
130
84
|
*/
|
|
131
85
|
emptyComponent?: ReactNode;
|
|
132
86
|
/**
|
|
133
|
-
*
|
|
87
|
+
* Show pagination below the table. This is recommended only for tables with a lot of rows.
|
|
88
|
+
*/
|
|
89
|
+
showPagination?: boolean;
|
|
90
|
+
/**
|
|
91
|
+
* The index of the page that should be set as active when the table is rendered.
|
|
92
|
+
*/
|
|
93
|
+
initialPageIndex?: number;
|
|
94
|
+
/**
|
|
95
|
+
* The amount of entries to show for each page.
|
|
96
|
+
*/
|
|
97
|
+
itemsPerPage?: number;
|
|
98
|
+
/**
|
|
99
|
+
* Set the number of pages to show in the pagination. Used only when doing manual pagination.
|
|
100
|
+
*/
|
|
101
|
+
totalRows?: number;
|
|
102
|
+
/**
|
|
103
|
+
* Set clusters of items to show in a single page. These values are used to
|
|
104
|
+
* compute the select options for the page size select.
|
|
134
105
|
*/
|
|
106
|
+
pageClusters?: TablePaginationProps['clusters'];
|
|
107
|
+
/**
|
|
108
|
+
* The callback that is called when the active page index and page size change.
|
|
109
|
+
* Passing this property will enable manual pagination,
|
|
110
|
+
* disabling the automatic one.
|
|
111
|
+
*/
|
|
112
|
+
onPaginationChange?: ({ pageIndex, pageSize }: PaginationPageType) => Promise<void> | void;
|
|
113
|
+
/**
|
|
114
|
+
* If true, disable the automatic column sorting of the table. Turn this on if you want to
|
|
115
|
+
* to control the sorting yourself.
|
|
116
|
+
*/
|
|
117
|
+
isManualSorted?: boolean;
|
|
118
|
+
/**
|
|
119
|
+
* Set the initial sorted column and order by passing column id and order.
|
|
120
|
+
*/
|
|
135
121
|
initialSortBy?: Array<SortingRule<T>>;
|
|
122
|
+
/**
|
|
123
|
+
* Callback run when a column is sorted
|
|
124
|
+
*/
|
|
125
|
+
onSortChange?: (sorting: Array<CustomSortingRule<T>>) => void;
|
|
136
126
|
};
|
|
137
|
-
export declare const Table: <T extends Record<string, unknown>>({ className, style, columns, data, selectableRows,
|
|
127
|
+
export declare const Table: <T extends Record<string, unknown>>({ className, style, columns, data, selectableRows, stripes, showSeparators, title, actions, selectedActions, selectedLabel, showHeader, showTableHead, columnsControl, defaultHiddenColumns, height, loading, background, expandableRowComponent, emptyComponent, showPagination, isManualSorted, itemsPerPage, totalRows, initialPageIndex, onPaginationChange, onSortChange, pageClusters, initialSortBy, ...otherProps }: TableProps<T>) => JSX.Element;
|
|
138
128
|
//# sourceMappingURL=table.d.ts.map
|
|
@@ -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,EAAE,GAAG,
|
|
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"}
|