@wonderflow/react-components 6.1.0 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/utils/media.css +5 -5
- package/dist/components/autocomplete/autocomplete-option.js +1 -1
- package/dist/components/autocomplete/autocomplete.js +2 -2
- 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.js +1 -1
- package/dist/components/datetime/datetime.js +1 -1
- package/dist/components/disclosure/disclosure.js +3 -3
- package/dist/components/disclosure/disclosure.module.css +1 -1
- package/dist/components/drawer/drawer.js +1 -1
- 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.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.js +3 -3
- package/dist/components/menu/menu.d.ts +1 -1
- package/dist/components/menu/menu.js +1 -1
- package/dist/components/modal/content/modal-content.js +1 -1
- package/dist/components/modal/modal.js +1 -1
- package/dist/components/overlay-container/overlay-container.js +1 -1
- 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.js +1 -1
- 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/primitive-tab.js +1 -1
- package/dist/components/tab/tab-item.d.ts.map +1 -1
- package/dist/components/tab/tab-item.js +1 -1
- package/dist/components/tab/tab-list.js +1 -1
- package/dist/components/tab/tab-panel.js +1 -1
- package/dist/components/tab/tab.js +2 -2
- 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.js +2 -2
- 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 +1 -1
- package/dist/components/table/table.d.ts.map +1 -1
- package/dist/components/table/table.js +28 -23
- 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.js +2 -2
- 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 +10 -11
- 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
|
@@ -12,7 +12,7 @@ export const OverlayProvider = (props) => {
|
|
|
12
12
|
return (_jsx(OverlayContext.Provider, { value: {
|
|
13
13
|
titleId,
|
|
14
14
|
onClose
|
|
15
|
-
}, children: children }
|
|
15
|
+
}, children: children }));
|
|
16
16
|
};
|
|
17
17
|
export const useOverlayContext = () => {
|
|
18
18
|
const context = useContext(OverlayContext);
|
|
@@ -13,5 +13,5 @@ export const Pagination = ({ className, itemsCount, itemsPerPage = 10, onPageCli
|
|
|
13
13
|
const newOffset = (event.selected * itemsPerPage) % itemsCount;
|
|
14
14
|
onPageClick && onPageClick({ ...event, offset: newOffset });
|
|
15
15
|
};
|
|
16
|
-
return (_jsx(ReactPaginate, { containerClassName: clsx(styles.Pagination, className), breakLabel: "...", nextLabel: _jsx(Icon, { dimension: 16, source: "chevron-right" }
|
|
16
|
+
return (_jsx(ReactPaginate, { containerClassName: clsx(styles.Pagination, className), breakLabel: "...", nextLabel: _jsx(Icon, { dimension: 16, source: "chevron-right" }), previousLabel: _jsx(Icon, { dimension: 16, source: "chevron-left" }), onPageChange: handlePageClick, pageRangeDisplayed: pageRangeDisplayed, pageCount: pageCount || computedPageCount, marginPagesDisplayed: marginPagesDisplayed, ...otherProps }));
|
|
17
17
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/popover/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,WAAW,CAAA;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { AutoPlacement, BasePlacement, VariationPlacement } from '@popperjs/core';
|
|
3
|
+
export declare type PopoverProps = PropsWithClass & {
|
|
4
|
+
/**
|
|
5
|
+
* The content of the popover to display when the popover is open.
|
|
6
|
+
*/
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* The element to use as the trigger for the popover.
|
|
10
|
+
*/
|
|
11
|
+
trigger: ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* The distance from the trigger to the popover.
|
|
14
|
+
*/
|
|
15
|
+
offset?: number;
|
|
16
|
+
/**
|
|
17
|
+
* The placement of the popover. This is automatically handled based on
|
|
18
|
+
* scroll and viewport edges. By default the popover is anchored at
|
|
19
|
+
* the beginning of the trigger.
|
|
20
|
+
*
|
|
21
|
+
* The first key refers to the X axis, the second key refers to the Y axis.
|
|
22
|
+
* Eg: `auto-start` means the popover will be placed automatically on left or right
|
|
23
|
+
* based on the available space, and anchored at the top (start) of the trigger.
|
|
24
|
+
*/
|
|
25
|
+
placement?: AutoPlacement | BasePlacement | VariationPlacement;
|
|
26
|
+
/**
|
|
27
|
+
* Enable or disable the itneraction on the trigger.
|
|
28
|
+
*/
|
|
29
|
+
disabled?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Callback triggered when the popover state changes.
|
|
32
|
+
* It returns the new `boolean` state.
|
|
33
|
+
*/
|
|
34
|
+
onOpenChange?: (open: boolean) => void;
|
|
35
|
+
/**
|
|
36
|
+
* Programmatically open or close the popover. If set to `true`, the popover
|
|
37
|
+
* will be open when rendered. This make the popover a controlled component.
|
|
38
|
+
*/
|
|
39
|
+
open?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Enable or disable the auto close of the popover when clicking outside of it.
|
|
42
|
+
*/
|
|
43
|
+
closeOnOutsideClick?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Set the popover element the same with of the trigger element.
|
|
46
|
+
*/
|
|
47
|
+
matchTriggerWidth?: boolean;
|
|
48
|
+
};
|
|
49
|
+
export declare const Popover: import("react").ForwardRefExoticComponent<PropsWithClass & {
|
|
50
|
+
/**
|
|
51
|
+
* The content of the popover to display when the popover is open.
|
|
52
|
+
*/
|
|
53
|
+
children: ReactNode;
|
|
54
|
+
/**
|
|
55
|
+
* The element to use as the trigger for the popover.
|
|
56
|
+
*/
|
|
57
|
+
trigger: ReactNode;
|
|
58
|
+
/**
|
|
59
|
+
* The distance from the trigger to the popover.
|
|
60
|
+
*/
|
|
61
|
+
offset?: number | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* The placement of the popover. This is automatically handled based on
|
|
64
|
+
* scroll and viewport edges. By default the popover is anchored at
|
|
65
|
+
* the beginning of the trigger.
|
|
66
|
+
*
|
|
67
|
+
* The first key refers to the X axis, the second key refers to the Y axis.
|
|
68
|
+
* Eg: `auto-start` means the popover will be placed automatically on left or right
|
|
69
|
+
* based on the available space, and anchored at the top (start) of the trigger.
|
|
70
|
+
*/
|
|
71
|
+
placement?: AutoPlacement | BasePlacement | VariationPlacement | undefined;
|
|
72
|
+
/**
|
|
73
|
+
* Enable or disable the itneraction on the trigger.
|
|
74
|
+
*/
|
|
75
|
+
disabled?: boolean | undefined;
|
|
76
|
+
/**
|
|
77
|
+
* Callback triggered when the popover state changes.
|
|
78
|
+
* It returns the new `boolean` state.
|
|
79
|
+
*/
|
|
80
|
+
onOpenChange?: ((open: boolean) => void) | undefined;
|
|
81
|
+
/**
|
|
82
|
+
* Programmatically open or close the popover. If set to `true`, the popover
|
|
83
|
+
* will be open when rendered. This make the popover a controlled component.
|
|
84
|
+
*/
|
|
85
|
+
open?: boolean | undefined;
|
|
86
|
+
/**
|
|
87
|
+
* Enable or disable the auto close of the popover when clicking outside of it.
|
|
88
|
+
*/
|
|
89
|
+
closeOnOutsideClick?: boolean | undefined;
|
|
90
|
+
/**
|
|
91
|
+
* Set the popover element the same with of the trigger element.
|
|
92
|
+
*/
|
|
93
|
+
matchTriggerWidth?: boolean | undefined;
|
|
94
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
95
|
+
//# sourceMappingURL=popover.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"popover.d.ts","sourceRoot":"","sources":["../../../src/components/popover/popover.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EASV,MAAM,OAAO,CAAA;AAId,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,kBAAkB,EAAY,MAAM,gBAAgB,CAAA;AAK3F,oBAAY,YAAY,GAAG,cAAc,GAAG;IAC1C;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,OAAO,EAAE,SAAS,CAAC;IACnB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,aAAa,GAAG,aAAa,GAAG,kBAAkB,CAAC;IAC/D;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;OAEG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;OAEG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B,CAAA;AAqBD,eAAO,MAAM,OAAO;IAjElB;;OAEG;cACO,SAAS;IACnB;;OAEG;aACM,SAAS;IAClB;;OAEG;;IAEH;;;;;;;;OAQG;;IAEH;;OAEG;;IAEH;;;OAGG;2BACmB,OAAO,KAAK,IAAI;IACtC;;;OAGG;;IAEH;;OAEG;;IAEH;;OAEG;;kDAgJH,CAAA"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState, Children, cloneElement, useRef, forwardRef, isValidElement, useEffect, useMemo } from 'react';
|
|
3
|
+
import { useKeyPress, useFocusWithin } from 'ahooks';
|
|
4
|
+
import styles from './popover.module.css';
|
|
5
|
+
import { useUIDSeed } from 'react-uid';
|
|
6
|
+
import { usePopperTooltip } from 'react-popper-tooltip';
|
|
7
|
+
import { AnimatePresence, motion } from 'framer-motion';
|
|
8
|
+
import clsx from 'clsx';
|
|
9
|
+
const PopoverAnimation = {
|
|
10
|
+
visible: {
|
|
11
|
+
y: 0,
|
|
12
|
+
opacity: 1,
|
|
13
|
+
transition: {
|
|
14
|
+
ease: [0, 0, 0.34, 1],
|
|
15
|
+
duration: 0.1
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
hidden: {
|
|
19
|
+
y: -5,
|
|
20
|
+
opacity: 0,
|
|
21
|
+
transition: {
|
|
22
|
+
ease: [0.3, 0.07, 1, 1],
|
|
23
|
+
duration: 0.1
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
export const Popover = forwardRef(({ children, trigger, offset = 8, placement = 'auto-start', open, disabled, closeOnOutsideClick = true, className, matchTriggerWidth, onOpenChange, ...otherProps }, forwardedRef) => {
|
|
28
|
+
const seedID = useUIDSeed();
|
|
29
|
+
const popoverRef = useRef(forwardedRef);
|
|
30
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
31
|
+
const sameWidth = useMemo(() => ({
|
|
32
|
+
name: 'sameWidth',
|
|
33
|
+
enabled: true,
|
|
34
|
+
phase: 'beforeWrite',
|
|
35
|
+
requires: ['computeStyles'],
|
|
36
|
+
fn: ({ state }) => {
|
|
37
|
+
if (matchTriggerWidth)
|
|
38
|
+
state.styles.popper.width = `${state.rects.reference.width}px`;
|
|
39
|
+
},
|
|
40
|
+
effect: ({ state }) => {
|
|
41
|
+
const referenceElement = state.elements.reference;
|
|
42
|
+
if (matchTriggerWidth)
|
|
43
|
+
state.elements.popper.style.width = `${referenceElement.offsetWidth}px`;
|
|
44
|
+
}
|
|
45
|
+
}), [matchTriggerWidth]);
|
|
46
|
+
const { getTooltipProps, setTooltipRef, setTriggerRef, visible } = usePopperTooltip({
|
|
47
|
+
delayShow: 0,
|
|
48
|
+
delayHide: 0,
|
|
49
|
+
trigger: !disabled ? ['click'] : null,
|
|
50
|
+
visible: isOpen,
|
|
51
|
+
closeOnTriggerHidden: true,
|
|
52
|
+
closeOnOutsideClick,
|
|
53
|
+
onVisibleChange: state => {
|
|
54
|
+
onOpenChange?.(state);
|
|
55
|
+
setIsOpen(state);
|
|
56
|
+
}
|
|
57
|
+
}, {
|
|
58
|
+
placement,
|
|
59
|
+
modifiers: [
|
|
60
|
+
sameWidth,
|
|
61
|
+
{
|
|
62
|
+
name: 'offset',
|
|
63
|
+
options: {
|
|
64
|
+
offset: [0, offset]
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
});
|
|
69
|
+
const isFocusWithin = useFocusWithin(popoverRef, {
|
|
70
|
+
onBlur: (e) => {
|
|
71
|
+
if (e.relatedTarget && visible) {
|
|
72
|
+
setIsOpen(false);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
useKeyPress('esc', () => setIsOpen(false));
|
|
77
|
+
useEffect(() => {
|
|
78
|
+
open !== undefined && setIsOpen(open);
|
|
79
|
+
}, [open]);
|
|
80
|
+
return (_jsxs("div", { ref: popoverRef, className: clsx(styles.Popover, className), "data-popover-has-focus": isFocusWithin, children: [Children.map(trigger, (child) => isValidElement(child) && cloneElement(child, {
|
|
81
|
+
ref: setTriggerRef,
|
|
82
|
+
id: seedID('popover-trigger'),
|
|
83
|
+
key: seedID('popover-trigger'),
|
|
84
|
+
'aria-haspopup': 'true',
|
|
85
|
+
'aria-controls': seedID('popover-menu'),
|
|
86
|
+
'aria-expanded': isOpen,
|
|
87
|
+
...otherProps
|
|
88
|
+
})), _jsx(AnimatePresence, { children: visible && (_jsx("div", { ref: setTooltipRef, role: "tooltip", id: seedID('tooltip-content'), ...getTooltipProps({ className: styles.PopUp }), children: _jsx(motion.div, { variants: PopoverAnimation, initial: "hidden", animate: "visible", exit: "hidden", children: Children.map(children, (child) => isValidElement(child) && cloneElement(child, {
|
|
89
|
+
id: seedID('popover-menu'),
|
|
90
|
+
'aria-labelledby': seedID('popover-trigger')
|
|
91
|
+
})) }) }, seedID('tooltip-content'))) })] }));
|
|
92
|
+
});
|
|
93
|
+
Popover.displayName = 'Popover';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.Popover{display:contents}.PopUp{inline-size:max-content;z-index:2}
|
|
@@ -3,5 +3,5 @@ import { forwardRef } from 'react';
|
|
|
3
3
|
import styles from './prose.module.css';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
export const Prose = forwardRef(({ children, className, as: Wrapper = 'div', ...otherProps }, forwardedRef) => {
|
|
6
|
-
return (_jsx(Wrapper, { ref: forwardedRef, className: clsx(styles.Prose, className), ...otherProps, children: children }
|
|
6
|
+
return (_jsx(Wrapper, { ref: forwardedRef, className: clsx(styles.Prose, className), ...otherProps, children: children }));
|
|
7
7
|
});
|
|
@@ -11,6 +11,6 @@ export const Select = forwardRef(({ children, className, disabled = false, icon
|
|
|
11
11
|
regular: 16,
|
|
12
12
|
big: 24
|
|
13
13
|
};
|
|
14
|
-
return (_jsxs(Stack, { as: "fieldset", rowGap: 4, className: clsx(styles.Select, className), "data-select-is-multiple": kind === 'multiple', "data-select-has-label": Boolean(label), "data-select-dimension": dimension, "aria-disabled": disabled, hAlign: "start", vAlign: "start", inline: true, tabIndex: disabled ? 0 : undefined, children: [label && _jsx(Text, { as: "label", size: dimension === 'small' ? 14 : 16, htmlFor: seedID('select'), children: label }
|
|
14
|
+
return (_jsxs(Stack, { as: "fieldset", rowGap: 4, className: clsx(styles.Select, className), "data-select-is-multiple": kind === 'multiple', "data-select-has-label": Boolean(label), "data-select-dimension": dimension, "aria-disabled": disabled, hAlign: "start", vAlign: "start", inline: true, tabIndex: disabled ? 0 : undefined, children: [label && _jsx(Text, { as: "label", size: dimension === 'small' ? 14 : 16, htmlFor: seedID('select'), children: label }), _jsxs("div", { className: styles.FieldContainer, children: [_jsx("select", { disabled: disabled, className: styles.Field, id: seedID('select'), multiple: kind === 'multiple', onChange: onChange, ref: forwardedRef, ...otherProps, children: children }), kind === 'single' && (_jsx(Icon, { className: styles.Icon, source: icon, dimension: iconSizes[dimension] }))] })] }));
|
|
15
15
|
});
|
|
16
16
|
Select.displayName = 'Select';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.Select{-webkit-appearance:none;appearance:none;padding:0;position:relative}.Select[data-select-dimension=small]{--field-height:1.33rem;--field-padding:0.33rem;--font-size:0.78rem}.Select[data-select-dimension=regular]{--field-height:2.22rem;--field-padding:0.89rem;--font-size:0.89rem}.Select[data-select-dimension=big]{--field-height:2.67rem;--field-padding:0.89rem;--font-size:1.00rem}.FieldContainer{color:var(--global-vibrancy-foreground);inline-size:100%;position:relative}.Select[aria-disabled=true] .FieldContainer{color:var(--global-disabled-foreground)}.Field{-webkit-appearance:none;appearance:none;-webkit-backdrop-filter:saturate(180%) blur(62px);backdrop-filter:saturate(180%) blur(62px);background:linear-gradient(to bottom,var(--global-vibrancy-background),var(--global-vibrancy-background));block-size:var(--field-height);border:0;border-radius:.22rem;box-sizing:border-box;color:inherit;display:block;font-family:inherit;font-size:var(--font-size);inline-size:100%;margin:0;overflow:hidden;padding:0 calc(var(--field-padding)*3.5) 0 var(--field-padding);text-overflow:ellipsis}.Field:disabled{background:linear-gradient(to bottom,var(--global-disabled-background),var(--global-disabled-background));color:var(--global-disabled-foreground);cursor:not-allowed}.Field option{color:#000}.Field optgroup{color:initial}.Field[multiple]{block-size:auto;overflow:auto;padding:.44rem .89rem}.Field[multiple] option{color:
|
|
1
|
+
.Select{-webkit-appearance:none;appearance:none;padding:0;position:relative}.Select[data-select-dimension=small]{--field-height:1.33rem;--field-padding:0.33rem;--font-size:0.78rem}.Select[data-select-dimension=regular]{--field-height:2.22rem;--field-padding:0.89rem;--font-size:0.89rem}.Select[data-select-dimension=big]{--field-height:2.67rem;--field-padding:0.89rem;--font-size:1.00rem}.FieldContainer{color:var(--global-vibrancy-foreground);inline-size:100%;position:relative}.Select[aria-disabled=true] .FieldContainer{color:var(--global-disabled-foreground)}.Field{-webkit-appearance:none;appearance:none;-webkit-backdrop-filter:saturate(180%) blur(62px);backdrop-filter:saturate(180%) blur(62px);background:linear-gradient(to bottom,var(--global-vibrancy-background),var(--global-vibrancy-background));block-size:var(--field-height);border:0;border-radius:.22rem;box-sizing:border-box;color:inherit;display:block;font-family:inherit;font-size:var(--font-size);inline-size:100%;margin:0;overflow:hidden;padding:0 calc(var(--field-padding)*3.5) 0 var(--field-padding);text-overflow:ellipsis}.Field:disabled{background:linear-gradient(to bottom,var(--global-disabled-background),var(--global-disabled-background));color:var(--global-disabled-foreground);cursor:not-allowed}.Field option{color:#000}.Field optgroup{color:initial}.Field[multiple]{block-size:auto;overflow:auto;padding:.44rem .89rem}.Field[multiple] option{color:currentcolor;padding:calc(var(--field-padding)/2) var(--field-padding)}.Field[multiple] option:checked{background:var(--dimmed-4) linear-gradient(to bottom,var(--dimmed-4) 0,var(--dimmed-4) 100%);background-color:var(--dimmed-4);color:var(--dimmed-0)}.Field[multiple] optgroup{color:currentcolor;font-family:inherit;font-size:inherit;line-height:inherit;margin:0 0 1rem}.Icon{border-radius:.22rem;pointer-events:none;position:absolute;right:calc(var(--field-padding) - var(--field-padding)/3);top:calc(var(--field-height)/2);transform:translateY(-50%)}
|
|
@@ -10,6 +10,6 @@ export const Checkbox = forwardRef(({ className, disabled, dimension = 'regular'
|
|
|
10
10
|
ref.current.indeterminate = indeterminate;
|
|
11
11
|
}
|
|
12
12
|
}, [indeterminate]);
|
|
13
|
-
return (_jsx(LazyMotion, { features: domAnimation, strict: true, children: _jsx(m.span, { className: styles.InputWrapper, whileTap: { scale: 1.15 }, transition: { duration: 0.3, ease: 'backOut' }, children: _jsx("input", { type: "checkbox", disabled: disabled, "aria-disabled": disabled, "data-control-dimension": dimension, onChange: onChange, className: clsx(styles.CheckboxInput, className), ref: ref, ...otherProps }
|
|
13
|
+
return (_jsx(LazyMotion, { features: domAnimation, strict: true, children: _jsx(m.span, { className: styles.InputWrapper, whileTap: { scale: 1.15 }, transition: { duration: 0.3, ease: 'backOut' }, children: _jsx("input", { type: "checkbox", disabled: disabled, "aria-disabled": disabled, "data-control-dimension": dimension, onChange: onChange, className: clsx(styles.CheckboxInput, className), ref: ref, ...otherProps }) }) }));
|
|
14
14
|
});
|
|
15
15
|
Checkbox.displayName = 'Checkbox';
|
|
@@ -4,6 +4,6 @@ import { forwardRef } from 'react';
|
|
|
4
4
|
import styles from './selection-controls.module.css';
|
|
5
5
|
import { domAnimation, LazyMotion, m } from 'framer-motion';
|
|
6
6
|
export const Radio = forwardRef(({ className, disabled, dimension = 'regular', onChange, ...otherProps }, forwardedRef) => {
|
|
7
|
-
return (_jsx(LazyMotion, { features: domAnimation, strict: true, children: _jsx(m.span, { className: styles.InputWrapper, whileTap: { scale: 1.15 }, transition: { duration: 0.3, ease: 'backOut' }, children: _jsx("input", { type: "radio", disabled: disabled, "aria-disabled": disabled, "data-control-dimension": dimension, onChange: onChange, className: clsx(styles.RadioInput, className), ref: forwardedRef, ...otherProps }
|
|
7
|
+
return (_jsx(LazyMotion, { features: domAnimation, strict: true, children: _jsx(m.span, { className: styles.InputWrapper, whileTap: { scale: 1.15 }, transition: { duration: 0.3, ease: 'backOut' }, children: _jsx("input", { type: "radio", disabled: disabled, "aria-disabled": disabled, "data-control-dimension": dimension, onChange: onChange, className: clsx(styles.RadioInput, className), ref: forwardedRef, ...otherProps }) }) }));
|
|
8
8
|
});
|
|
9
9
|
Radio.displayName = 'Radio';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.InputWrapper{display:inline-block;line-height:0}.CheckboxInput{--w:24px;--h:24px;-webkit-appearance:none;appearance:none;-webkit-backdrop-filter:saturate(180%) blur(62px);backdrop-filter:saturate(180%) blur(62px);background-color:var(--global-vibrancy-background);block-size:var(--h);border-radius:.22rem;color:var(--global-background);inline-size:var(--w);max-block-size:var(--h);max-inline-size:var(--w);position:relative}.CheckboxInput:after{block-size:27%;border-bottom:2px solid;border-left:2px solid;content:"";display:none;inline-size:50%;left:50%;position:absolute;top:50%;transform:translate(-50%,-80%) rotate(-45deg)}.CheckboxInput:active{background-color:var(--global-vibrancy-background-hard)}.CheckboxInput:checked,.CheckboxInput:indeterminate{background:var(--dimmed-7)}.CheckboxInput:checked:after,.CheckboxInput:indeterminate:after{display:block}.CheckboxInput:disabled{background-color:var(--global-disabled-background);color:var(--global-disabled-foreground);cursor:not-allowed}.CheckboxInput[data-control-dimension=small]{--w:16px;--h:16px}.CheckboxInput:indeterminate:after{block-size:2px;border-left:0;transform:translate(-50%,-50%)}.RadioInput{composes:CheckboxInput;border-radius:100%}.RadioInput:after{background-color:currentcolor;block-size:50%;border:0;border-radius:100%;inline-size:50%;transform:translate(-50%,-50%)}.Toggle{--w:44px;--h:24px;--p:2px;composes:RadioInput;border-radius:200px;color:var(--dimmed-7)}.Toggle:checked{color:var(--global-background)}.Toggle:disabled{color:var(--global-disabled-foreground)}.Toggle:after{block-size:calc(var(--h) - var(--p)*2);bottom:var(--p);display:block;inline-size:calc(var(--h) - var(--p)*2);left:var(--p);top:var(--p);transform:none;transition:transform .1s cubic-bezier(.3,.07,.34,1),background-color .1s cubic-bezier(.3,.07,.34,1)}.Toggle:checked:after{display:block;transform:translateX(100%)}.Toggle[data-control-dimension=small]{--w:28px;--h:16px}
|
|
1
|
+
.InputWrapper{display:inline-block;line-height:0}.CheckboxInput{--w:24px;--h:24px;-webkit-appearance:none;appearance:none;-webkit-backdrop-filter:saturate(180%) blur(62px);backdrop-filter:saturate(180%) blur(62px);background-color:var(--global-vibrancy-background);block-size:var(--h);border-radius:.22rem;box-shadow:0 0 0 1px var(--global-background),inset 0 0 0 1px var(--dimmed-2);color:var(--global-background);inline-size:var(--w);max-block-size:var(--h);max-inline-size:var(--w);position:relative}.CheckboxInput:after{block-size:27%;border-bottom:2px solid;border-left:2px solid;content:"";display:none;inline-size:50%;left:50%;position:absolute;top:50%;transform:translate(-50%,-80%) rotate(-45deg)}.CheckboxInput:active{background-color:var(--global-vibrancy-background-hard)}.CheckboxInput:checked,.CheckboxInput:indeterminate{background:var(--dimmed-7);box-shadow:0 0 0 1px var(--global-background),inset 0 0 0 1px transparent}.CheckboxInput:checked:after,.CheckboxInput:indeterminate:after{display:block}.CheckboxInput:disabled{background-color:var(--global-disabled-background);color:var(--global-disabled-foreground);cursor:not-allowed}.CheckboxInput[data-control-dimension=small]{--w:16px;--h:16px}.CheckboxInput:indeterminate:after{block-size:2px;border-left:0;transform:translate(-50%,-50%)}.RadioInput{composes:CheckboxInput;border-radius:100%}.RadioInput:after{background-color:currentcolor;block-size:50%;border:0;border-radius:100%;inline-size:50%;transform:translate(-50%,-50%)}.Toggle{--w:44px;--h:24px;--p:2px;composes:RadioInput;border-radius:200px;color:var(--dimmed-7)}.Toggle:checked{color:var(--global-background)}.Toggle:disabled{color:var(--global-disabled-foreground)}.Toggle:after{block-size:calc(var(--h) - var(--p)*2);bottom:var(--p);display:block;inline-size:calc(var(--h) - var(--p)*2);left:var(--p);top:var(--p);transform:none;transition:transform .1s cubic-bezier(.3,.07,.34,1),background-color .1s cubic-bezier(.3,.07,.34,1)}.Toggle:checked:after{display:block;transform:translateX(100%)}.Toggle[data-control-dimension=small]{--w:28px;--h:16px}
|
|
@@ -3,6 +3,6 @@ import clsx from 'clsx';
|
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
4
|
import styles from './selection-controls.module.css';
|
|
5
5
|
export const Toggle = forwardRef(({ className, disabled, dimension = 'regular', onChange, ...otherProps }, forwardedRef) => {
|
|
6
|
-
return (_jsx("input", { type: "checkbox", disabled: disabled, "aria-disabled": disabled, "data-control-dimension": dimension, onChange: onChange, className: clsx(styles.Toggle, className), ref: forwardedRef, ...otherProps }
|
|
6
|
+
return (_jsx("input", { type: "checkbox", disabled: disabled, "aria-disabled": disabled, "data-control-dimension": dimension, onChange: onChange, className: clsx(styles.Toggle, className), ref: forwardedRef, ...otherProps }));
|
|
7
7
|
});
|
|
8
8
|
Toggle.displayName = 'Toggle';
|
|
@@ -3,6 +3,6 @@ import { forwardRef } from 'react';
|
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import styles from './separator.module.css';
|
|
5
5
|
export const Separator = forwardRef(({ className, ...otherProps }, forwardedRef) => {
|
|
6
|
-
return (_jsx("hr", { ref: forwardedRef, className: clsx(styles.Separator, className), ...otherProps }
|
|
6
|
+
return (_jsx("hr", { ref: forwardedRef, className: clsx(styles.Separator, className), ...otherProps }));
|
|
7
7
|
});
|
|
8
8
|
Separator.displayName = 'Separator';
|
|
@@ -14,11 +14,11 @@ export const Skeleton = ({ className, borderRadius = 4, style, width, height, co
|
|
|
14
14
|
'--height': height && computedHeight,
|
|
15
15
|
'--gap': gap ? tkns.space[gap] : undefined
|
|
16
16
|
};
|
|
17
|
-
return (_jsx("span", { className: styles.SkeletonItem, "data-skeleton-circle": circle, "data-skeleton-animated": enableAnimation, style: { ...dynamicStyle, ...style }, children: "\u200C" }
|
|
17
|
+
return (_jsx("span", { className: styles.SkeletonItem, "data-skeleton-circle": circle, "data-skeleton-animated": enableAnimation, style: { ...dynamicStyle, ...style }, children: "\u200C" }));
|
|
18
18
|
}, [borderRadius, width, computedWidth, height, computedHeight, gap, circle, enableAnimation, style]);
|
|
19
19
|
return (_jsx("span", { className: className, "aria-live": "polite", "aria-busy": enableAnimation, ...otherProps, children: Array.from({ length: count }).map((_, i) => {
|
|
20
20
|
return inline
|
|
21
21
|
? _jsx(SkeletonItem, {}, uid(i))
|
|
22
|
-
: (_jsxs(Fragment, { children: [_jsx(SkeletonItem, {}
|
|
23
|
-
}) }
|
|
22
|
+
: (_jsxs(Fragment, { children: [_jsx(SkeletonItem, {}), _jsx("br", {})] }, uid(i)));
|
|
23
|
+
}) }));
|
|
24
24
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slider.d.ts","sourceRoot":"","sources":["../../../src/components/slider/slider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,mBAAmB,EAAyB,MAAM,OAAO,CAAA;AAC9E,OAAO,EAAqB,SAAS,
|
|
1
|
+
{"version":3,"file":"slider.d.ts","sourceRoot":"","sources":["../../../src/components/slider/slider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,mBAAmB,EAAyB,MAAM,OAAO,CAAA;AAC9E,OAAO,EAAqB,SAAS,EAAa,MAAM,cAAc,CAAA;AAItE,oBAAY,WAAW,GAAG,mBAAmB,CAAC,gBAAgB,CAAC,GAAG;IAChE;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,OAAO,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;IAC9B;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;IAC9B;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACjC,CAAA;AAED,eAAO,MAAM,MAAM;IA1CjB;;OAEG;;IAEH;;OAEG;;IAEH;;;OAGG;;IAEH;;;OAGG;oBACa,MAAM,GAAG,IAAI;IAC7B;;OAEG;;IAEH;;OAEG;;IAEH;;;OAGG;;IAEH;;;OAGG;;IAEH;;OAEG;;oDA0DH,CAAA"}
|
|
@@ -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
|
});
|
|
@@ -18,6 +18,6 @@ export const Spinner = forwardRef(({ className, style, color, dimension = 'big'
|
|
|
18
18
|
duration: 2,
|
|
19
19
|
repeat: Infinity,
|
|
20
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 }
|
|
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)}
|
|
@@ -10,7 +10,7 @@ export const Tabs = ({ state: outerState, children }) => {
|
|
|
10
10
|
const innerState = useState(0);
|
|
11
11
|
const elements = useConstant(() => ({ tabs: [], panels: [] }));
|
|
12
12
|
const state = outerState || innerState;
|
|
13
|
-
return (_jsx(Elements.Provider, { value: elements, children: _jsx(TabsState.Provider, { value: state, children: children }
|
|
13
|
+
return (_jsx(Elements.Provider, { value: elements, children: _jsx(TabsState.Provider, { value: state, children: children }) }));
|
|
14
14
|
};
|
|
15
15
|
export const useTabState = (children) => {
|
|
16
16
|
const [activeIndex, setActive] = useContext(TabsState);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tab-item.d.ts","sourceRoot":"","sources":["../../../src/components/tab/tab-item.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,oBAAoB,EAErB,MAAM,OAAO,CAAA;AAId,OAAO,EAAe,SAAS,EAAE,MAAM,cAAc,CAAA;AAKrD;;;GAGG;AACH,oBAAY,YAAY,GAAG,oBAAoB,CAAC,iBAAiB,CAAC,GAAG;IACnE;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;CAC5B,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,OAAO;IAVlB;;OAEG;;
|
|
1
|
+
{"version":3,"file":"tab-item.d.ts","sourceRoot":"","sources":["../../../src/components/tab/tab-item.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,oBAAoB,EAErB,MAAM,OAAO,CAAA;AAId,OAAO,EAAe,SAAS,EAAE,MAAM,cAAc,CAAA;AAKrD;;;GAGG;AACH,oBAAY,YAAY,GAAG,oBAAoB,CAAC,iBAAiB,CAAC,GAAG;IACnE;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;CAC5B,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,OAAO;IAVlB;;OAEG;;qDA8DH,CAAA"}
|
|
@@ -19,6 +19,6 @@ export const TabItem = forwardRef(({ children, className, icon, id, ...otherProp
|
|
|
19
19
|
onClick();
|
|
20
20
|
handleClick();
|
|
21
21
|
}, [handleClick, onClick]);
|
|
22
|
-
return (_jsx(LazyMotion, { features: domMax, strict: true, children: _jsxs(Stack, { as: "button", direction: "row", vAlign: "center", hAlign: "start", fill: false, columnGap: 8, role: "tab", ref: internalRef, className: clsx(styles.TabItem, className), "aria-selected": isActive, onClick: fireClick, onKeyDown: handleKeyDown, onFocus: fireClick, type: "button", tabIndex: isActive ? 0 : -1, id: id, ...otherProps, children: [icon && _jsx(Icon, { source: icon, dimension: 16 }
|
|
22
|
+
return (_jsx(LazyMotion, { features: domMax, strict: true, children: _jsxs(Stack, { as: "button", direction: "row", vAlign: "center", hAlign: "start", fill: false, columnGap: 8, role: "tab", ref: internalRef, className: clsx(styles.TabItem, className), "aria-selected": isActive, onClick: fireClick, onKeyDown: handleKeyDown, onFocus: fireClick, type: "button", tabIndex: isActive ? 0 : -1, id: id, ...otherProps, children: [icon && _jsx(Icon, { source: icon, dimension: 16 }), children, isActive && (_jsx(m.span, { transition: { type: 'spring', duration: 0.4, bounce: 0 }, className: styles.Highlight, layoutId: id }))] }) }));
|
|
23
23
|
});
|
|
24
24
|
TabItem.displayName = 'Tab.Item';
|
|
@@ -7,5 +7,5 @@ import styles from './tab.module.css';
|
|
|
7
7
|
* Tab.List
|
|
8
8
|
* Component
|
|
9
9
|
*/
|
|
10
|
-
export const TabList = forwardRef(({ children, className, ...otherProps }, forwardedRef) => (_jsx("div", { ref: forwardedRef, role: "tablist", tabIndex: -1, className: clsx(styles.TabList, className), ...otherProps, children: _jsx(RovingTabIndexProvider, { children: children }
|
|
10
|
+
export const TabList = forwardRef(({ children, className, ...otherProps }, forwardedRef) => (_jsx("div", { ref: forwardedRef, role: "tablist", tabIndex: -1, className: clsx(styles.TabList, className), ...otherProps, children: _jsx(RovingTabIndexProvider, { children: children }) })));
|
|
11
11
|
TabList.displayName = 'Tab.List';
|
|
@@ -10,7 +10,7 @@ import styles from './tab.module.css';
|
|
|
10
10
|
export const TabPanel = forwardRef(({ children, className, ...otherProps }, forwardedRef) => {
|
|
11
11
|
const isActive = usePanelState(children);
|
|
12
12
|
return isActive
|
|
13
|
-
? (_jsx("div", { ref: forwardedRef, tabIndex: 0, className: clsx(styles.TabPanel, className), ...otherProps, children: children }
|
|
13
|
+
? (_jsx("div", { ref: forwardedRef, tabIndex: 0, className: clsx(styles.TabPanel, className), ...otherProps, children: children }))
|
|
14
14
|
: null;
|
|
15
15
|
});
|
|
16
16
|
TabPanel.displayName = 'Tab.Panel';
|
|
@@ -21,10 +21,10 @@ export const Tab = forwardRef(({ children, className, state, onChange, ...otherP
|
|
|
21
21
|
onChange(currentTab);
|
|
22
22
|
}
|
|
23
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 }
|
|
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 }))) }), Children.map(children, (child, index) => isValidElement(child) && cloneElement(child, {
|
|
25
25
|
id: seedID('tab-panel'),
|
|
26
26
|
'aria-labelledby': seedID('tab-item')
|
|
27
|
-
}))] }
|
|
27
|
+
}))] }) }));
|
|
28
28
|
});
|
|
29
29
|
Tab.displayName = 'Tab';
|
|
30
30
|
/* -------------------------------------------------------------------------- */
|
|
@@ -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 }));
|