@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,24 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Polymorphic } from '../..';
|
|
3
|
+
import { ListItemProps } from './list-item';
|
|
2
4
|
export declare type ListProps = {
|
|
3
5
|
/**
|
|
4
6
|
* Set the dimension of the items in the list. This affects also the marker size.
|
|
5
7
|
*/
|
|
6
8
|
dimension?: 'small' | 'regular' | 'big';
|
|
7
|
-
/**
|
|
8
|
-
* Set the marker style. You can use any icon from the iconography as marker
|
|
9
|
-
* by passing its name.
|
|
10
|
-
*/
|
|
11
|
-
marker?: IconProps['source'];
|
|
12
|
-
/**
|
|
13
|
-
* Set the color of the marker.
|
|
14
|
-
*/
|
|
15
|
-
markerColor?: string;
|
|
16
9
|
/**
|
|
17
10
|
* Set to show or hide the marker indicator beside each item in the list.
|
|
18
11
|
*/
|
|
19
12
|
hideMarker?: boolean;
|
|
20
13
|
};
|
|
21
|
-
declare type PolymorphicList = Polymorphic.ForwardRefComponent<'ul', ListProps
|
|
14
|
+
declare type PolymorphicList = Polymorphic.ForwardRefComponent<'ul', ListProps> & {
|
|
15
|
+
Li: React.ForwardRefExoticComponent<ListItemProps>;
|
|
16
|
+
};
|
|
22
17
|
export declare const List: PolymorphicList;
|
|
23
18
|
export {};
|
|
24
19
|
//# sourceMappingURL=list.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/components/list/list.tsx"],"names":[],"mappings":"AAGA,OAAO,
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/components/list/list.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,EAAY,aAAa,EAAE,MAAM,aAAa,CAAA;AAErD,oBAAY,SAAS,GAAG;IACtB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,KAAK,CAAC;IACxC;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAA;AAED,aAAK,eAAe,GAAG,WAAW,CAAC,mBAAmB,CAAC,IAAI,EAAE,SAAS,CAAC,GAAG;IACxE,EAAE,EAAE,KAAK,CAAC,yBAAyB,CAAC,aAAa,CAAC,CAAC;CACpD,CAAC;AAEF,eAAO,MAAM,IAAI,iBA4BI,CAAA"}
|
|
@@ -1,23 +1,13 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
2
|
-
import { Children, forwardRef, useMemo } from 'react';
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Children, cloneElement, forwardRef, isValidElement, useMemo } from 'react';
|
|
3
3
|
import styles from './list.module.css';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
|
-
import {
|
|
6
|
-
export const List = forwardRef(({ as: Wrapper = 'ul', children,
|
|
7
|
-
const sizes = {
|
|
8
|
-
small: {
|
|
9
|
-
text: 16,
|
|
10
|
-
icon: 16
|
|
11
|
-
},
|
|
12
|
-
regular: {
|
|
13
|
-
text: 18,
|
|
14
|
-
icon: 16
|
|
15
|
-
},
|
|
16
|
-
big: {
|
|
17
|
-
text: 22,
|
|
18
|
-
icon: 24
|
|
19
|
-
}
|
|
20
|
-
};
|
|
5
|
+
import { ListItem } from './list-item';
|
|
6
|
+
export const List = forwardRef(({ as: Wrapper = 'ul', children, dimension = 'regular', className, hideMarker = false, ...otherProps }, forwardedRef) => {
|
|
21
7
|
const isUnordered = useMemo(() => Wrapper === 'ul', [Wrapper]);
|
|
22
|
-
return (_jsx(Wrapper, { ref: forwardedRef, className: clsx(styles.List, className), "data-list-size": dimension, "data-list-ordered": !isUnordered, "data-list-no-marker": hideMarker, ...otherProps, children: Children.map(children, (child) => (
|
|
8
|
+
return (_jsx(Wrapper, { ref: forwardedRef, className: clsx(styles.List, className), "data-list-size": dimension, "data-list-ordered": !isUnordered, "data-list-no-marker": hideMarker, ...otherProps, children: Children.map(children, (child) => isValidElement(child) && cloneElement(child, {
|
|
9
|
+
hideMarker: !isUnordered && !hideMarker,
|
|
10
|
+
dimension
|
|
11
|
+
})) }));
|
|
23
12
|
});
|
|
13
|
+
List.Li = ListItem;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.List{--marker-size:0.89rem;--marker-gap:0.44rem}.List
|
|
1
|
+
.List{--marker-size:0.89rem;--marker-gap:0.44rem}.List[data-list-ordered=false]{list-style:none;padding:0}.List[data-list-size=small]{--marker-size:0.77rem;--marker-gap:0.44rem}.List[data-list-size=big]{--marker-size:1.11rem;--marker-gap:0.89rem}.List[data-list-no-marker=true]{--marker-size:0;--marker-gap:0;list-style:none;padding:0}.ListItem.ListItem{gap:var(--marker-gap)}[data-list-ordered=true] .ListItem.ListItem{display:list-item}[data-list-ordered=true] .ListItem.ListItem::marker{color:var(--dimmed-5)}.Marker{block-size:var(--marker-size);flex-shrink:0;inline-size:var(--marker-size);margin-block-start:calc(var(--marker-size)/2.5)}.Marker[data-list-default-marker=true]{transform:scale(.7)}.List[data-list-size=big] .Marker,.Marker[data-list-default-marker=true]{margin-block-start:calc(var(--marker-size)/3)}
|
|
@@ -22,5 +22,5 @@ export const Masonry = ({ className, children, columns = 3, gutter = 16, style,
|
|
|
22
22
|
}), {});
|
|
23
23
|
return (_jsx(MasonryLayout, { role: "list", className: clsx(styles.Masonry, className), columnClassName: styles.Column, breakpointCols: typeof columns === 'number' ? columns : computedColumns, style: { ...dynamicStyle, ...style }, ...otherProps, children: Children.map(children, (child) => isValidElement(child) && cloneElement(child, {
|
|
24
24
|
role: 'listitem'
|
|
25
|
-
})) }
|
|
25
|
+
})) }));
|
|
26
26
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
3
|
import { MenuItem } from '../../..';
|
|
4
|
-
export const MenuItemCheckbox = forwardRef(({ children, checked, ...otherProps }, forwardedRef) => (_jsx(MenuItem, { role: "menuitemcheckbox", "aria-checked": checked, ref: forwardedRef, ...otherProps, children: children }
|
|
4
|
+
export const MenuItemCheckbox = forwardRef(({ children, checked, ...otherProps }, forwardedRef) => (_jsx(MenuItem, { role: "menuitemcheckbox", "aria-checked": checked, ref: forwardedRef, ...otherProps, children: children })));
|
|
5
5
|
MenuItemCheckbox.displayName = 'Menu.ItemCheckbox';
|
|
@@ -21,7 +21,7 @@ export declare type MenuItemProps = {
|
|
|
21
21
|
/**
|
|
22
22
|
* Callback function to be called when the menu item is pressed.
|
|
23
23
|
*/
|
|
24
|
-
onClick?(event
|
|
24
|
+
onClick?(event: Event, value: string): void;
|
|
25
25
|
/**
|
|
26
26
|
* Add an extra description to the menu item.
|
|
27
27
|
* This uses the `<Tooltip>` component internally.
|
|
@@ -53,6 +53,10 @@ export declare type MenuItemProps = {
|
|
|
53
53
|
* if `Menu.Item` is rendered as ´<button>´ (default).
|
|
54
54
|
*/
|
|
55
55
|
decoration?: ReactNode;
|
|
56
|
+
/**
|
|
57
|
+
* Assign a string value to the menu option. This is returned when the menu item is clicked.
|
|
58
|
+
*/
|
|
59
|
+
value: string;
|
|
56
60
|
};
|
|
57
61
|
declare type PolymorphicMenuItem = Polymorphic.ForwardRefComponent<'button', MenuItemProps>;
|
|
58
62
|
export declare const MenuItem: PolymorphicMenuItem;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu-item.d.ts","sourceRoot":"","sources":["../../../../src/components/menu/menu-item/menu-item.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAQ,WAAW,EAAkB,SAAS,EAAE,MAAM,cAAc,CAAA;AAE3E,OAAO,EAAE,SAAS,EAA4C,MAAM,OAAO,CAAA;AAI3E,oBAAY,aAAa,GAAG;IAC1B;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;IAC3B;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAChC;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAC/B;;OAEG;IACH,OAAO,CAAC,CAAC,KAAK,
|
|
1
|
+
{"version":3,"file":"menu-item.d.ts","sourceRoot":"","sources":["../../../../src/components/menu/menu-item/menu-item.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAQ,WAAW,EAAkB,SAAS,EAAE,MAAM,cAAc,CAAA;AAE3E,OAAO,EAAE,SAAS,EAA4C,MAAM,OAAO,CAAA;AAI3E,oBAAY,aAAa,GAAG;IAC1B;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;IAC3B;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAChC;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAC/B;;OAEG;IACH,OAAO,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5C;;;OAGG;IACH,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;CACf,CAAA;AAED,aAAK,mBAAmB,GAAG,WAAW,CAAC,mBAAmB,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;AAEpF,eAAO,MAAM,QAAQ,qBA4FI,CAAA"}
|
|
@@ -4,7 +4,7 @@ import styles from './menu-item.module.css';
|
|
|
4
4
|
import { forwardRef, useCallback, useMemo, useRef } from 'react';
|
|
5
5
|
import { useFocusEffect, useRovingTabIndex } from 'react-roving-tabindex';
|
|
6
6
|
import clsx from 'clsx';
|
|
7
|
-
export const MenuItem = forwardRef(({ className, children, onClick, icon, dimension = 'regular', as: Wrapper = 'button', iconPosition = 'left', description, padding = true, disabled = false, autoFocus, decoration, ...otherProps }, forwardedRef) => {
|
|
7
|
+
export const MenuItem = forwardRef(({ className, children, onClick, icon, dimension = 'regular', as: Wrapper = 'button', iconPosition = 'left', description, padding = true, disabled = false, autoFocus, decoration, value, ...otherProps }, forwardedRef) => {
|
|
8
8
|
const itemRef = useRef(forwardedRef);
|
|
9
9
|
const [tabIndex, focused, handleKeyDown, handleClick] = useRovingTabIndex(itemRef, disabled);
|
|
10
10
|
const isIconRight = iconPosition === 'right';
|
|
@@ -12,12 +12,12 @@ export const MenuItem = forwardRef(({ className, children, onClick, icon, dimens
|
|
|
12
12
|
const triggerClick = useCallback((e) => {
|
|
13
13
|
if (onClick) {
|
|
14
14
|
handleClick();
|
|
15
|
-
onClick(e);
|
|
15
|
+
onClick(e, value);
|
|
16
16
|
}
|
|
17
|
-
}, [handleClick, onClick]);
|
|
18
|
-
const InnerContent = useMemo(() => (_jsxs(Stack, { direction: isIconRight ? 'row-reverse' : 'row', as: "span", fill: false, className: styles.ItemContent, hAlign: isIconRight ? 'space-between' : 'start', vAlign: "center", columnGap: 8, hPadding: 16, vPadding: 8, "data-menu-item-icon-right": isIconRight, "data-menu-item-has-icon": Boolean(icon), "data-menu-item-padding": padding, style: { inlineSize: '100%' }, children: [icon && (_jsx(Icon, { className: styles.IconClass, source: icon, dimension: dimension === 'small' ? 12 : 16 }
|
|
17
|
+
}, [handleClick, onClick, value]);
|
|
18
|
+
const InnerContent = useMemo(() => (_jsxs(Stack, { direction: isIconRight ? 'row-reverse' : 'row', as: "span", fill: false, className: styles.ItemContent, hAlign: isIconRight ? 'space-between' : 'start', vAlign: "center", columnGap: 8, hPadding: 16, vPadding: 8, "data-menu-item-icon-right": isIconRight, "data-menu-item-has-icon": Boolean(icon), "data-menu-item-padding": padding, style: { inlineSize: '100%' }, children: [icon && (_jsx(Icon, { className: styles.IconClass, source: icon, dimension: dimension === 'small' ? 12 : 16 })), _jsxs(Stack, { className: styles.DecorationContent, columnGap: 16, fill: false, direction: "row", hAlign: "space-between", children: [children, decoration] })] })), [children, dimension, icon, isIconRight, decoration, padding]);
|
|
19
19
|
return (_jsx(Wrapper, { autoFocus: autoFocus, ref: itemRef, role: "menuitem", className: clsx(styles.MenuItem, className), onClick: disabled ? undefined : triggerClick, onKeyDown: disabled ? undefined : handleKeyDown, tabIndex: tabIndex, "aria-disabled": disabled, type: Wrapper === 'button' ? 'button' : undefined, "data-menu-item-dimension": dimension, ...otherProps, children: description
|
|
20
|
-
? (_jsx(Tooltip, { fill: true, open: focused, placement: "right-start", interactive: true, trigger: InnerContent, children: description }
|
|
21
|
-
: InnerContent }
|
|
20
|
+
? (_jsx(Tooltip, { fill: true, open: focused, placement: "right-start", interactive: true, trigger: InnerContent, children: description }))
|
|
21
|
+
: InnerContent }));
|
|
22
22
|
});
|
|
23
23
|
MenuItem.displayName = 'Menu.Item';
|
|
@@ -4,9 +4,13 @@ import { MenuItemCheckbox, MenuItemCheckboxProps } from './menu-item/menu-item-c
|
|
|
4
4
|
import { Polymorphic } from '../..';
|
|
5
5
|
export declare type MenuProps = HTMLAttributes<HTMLUListElement> & {
|
|
6
6
|
/**
|
|
7
|
-
* The items of the
|
|
7
|
+
* The items of the menu.
|
|
8
8
|
*/
|
|
9
9
|
children: ReactNode;
|
|
10
|
+
/**
|
|
11
|
+
* Set a maximum height of the menu after which it will scroll.
|
|
12
|
+
*/
|
|
13
|
+
maxHeight?: string;
|
|
10
14
|
};
|
|
11
15
|
declare type MenuComponent = ForwardRefExoticComponent<MenuProps> & {
|
|
12
16
|
Item: Polymorphic.ForwardRefComponent<Polymorphic.IntrinsicElement<typeof MenuItem>, Polymorphic.OwnProps<typeof MenuItem> & MenuItemProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu.d.ts","sourceRoot":"","sources":["../../../src/components/menu/menu.tsx"],"names":[],"mappings":"AACA,OAAO,EAAwB,SAAS,EAAE,cAAc,EAAE,yBAAyB,
|
|
1
|
+
{"version":3,"file":"menu.d.ts","sourceRoot":"","sources":["../../../src/components/menu/menu.tsx"],"names":[],"mappings":"AACA,OAAO,EAAwB,SAAS,EAAE,cAAc,EAAE,yBAAyB,EAAiB,MAAM,OAAO,CAAA;AAEjH,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAC/D,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAA;AACxF,OAAO,EAAmB,WAAW,EAAE,MAAM,cAAc,CAAA;AAI3D,oBAAY,SAAS,GAAG,cAAc,CAAC,gBAAgB,CAAC,GAAG;IACzD;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAA;AAED,aAAK,aAAa,GAAG,yBAAyB,CAAC,SAAS,CAAC,GAAG;IAC1D,IAAI,EAAE,WAAW,CAAC,mBAAmB,CACnC,WAAW,CAAC,gBAAgB,CAAC,OAAO,QAAQ,CAAC,EAC7C,WAAW,CAAC,QAAQ,CAAC,OAAO,QAAQ,CAAC,GAAG,aAAa,CACtD,CAAC;IACF,YAAY,EAAE,WAAW,CAAC,mBAAmB,CAC3C,WAAW,CAAC,gBAAgB,CAAC,OAAO,gBAAgB,CAAC,EACrD,WAAW,CAAC,QAAQ,CAAC,OAAO,gBAAgB,CAAC,GAAG,qBAAqB,CACtE,CAAC;CACH,CAAA;AAED,eAAO,MAAM,IAAI,eAmCE,CAAA"}
|
|
@@ -6,9 +6,12 @@ import { MenuItemCheckbox } from './menu-item/menu-item-checkbox';
|
|
|
6
6
|
import { Stack, Elevator } from '../..';
|
|
7
7
|
import styles from './menu.module.css';
|
|
8
8
|
import clsx from 'clsx';
|
|
9
|
-
export const Menu = forwardRef(({ className, children, ...otherProps }, forwardedRef) => {
|
|
9
|
+
export const Menu = forwardRef(({ className, children, maxHeight, style, ...otherProps }, forwardedRef) => {
|
|
10
10
|
const renderedChildren = Children.toArray(children).filter(Boolean);
|
|
11
|
-
|
|
11
|
+
const computedStyle = {
|
|
12
|
+
'--max-height': maxHeight
|
|
13
|
+
};
|
|
14
|
+
return (_jsx(Elevator, { resting: 2, children: _jsx(Stack, { as: "ul", ref: forwardedRef, className: clsx(styles.Menu, className), style: { ...computedStyle, ...style }, "data-menu-should-scroll": Boolean(maxHeight), vPadding: 8, role: "menu", ...otherProps, children: _jsx(RovingTabIndexProvider, { options: { direction: 'vertical', loopAround: true }, children: Children.map(renderedChildren, (child) => (_jsx(Stack, { as: "li", role: "none", vPadding: child.type?.displayName === 'Separator' ? 8 : undefined, children: child }))) }) }) }));
|
|
12
15
|
});
|
|
13
16
|
Menu.displayName = 'Menu';
|
|
14
17
|
Menu.Item = MenuItem;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.Menu{background-color:var(--global-background);border:1px solid var(--dimmed-1);border-radius:.44rem;list-style-type:none;overflow:hidden;position:relative}.Menu hr{margin:0 .44rem}
|
|
1
|
+
.Menu{background-color:var(--global-background);border:1px solid var(--dimmed-1);border-radius:.44rem;list-style-type:none;overflow:hidden;position:relative}.Menu hr{margin:0 .44rem}.Menu[data-menu-should-scroll=true]{max-height:var(--max-height);overflow:auto}
|
|
@@ -6,6 +6,6 @@ import styles from './modal-content.module.css';
|
|
|
6
6
|
import { Title, Elevator, IconButton, Stack, useOverlayContext } from '../../..';
|
|
7
7
|
export const ModalContent = forwardRef(({ children, className, title, theme = 'light', ...otherProps }, forwardedRef) => {
|
|
8
8
|
const { onClose, titleId } = useOverlayContext();
|
|
9
|
-
return (_jsx(Elevator, { resting: 4, children: _jsxs("div", { className: clsx(styles.Content, className), ref: forwardedRef, "data-theme": theme, ...otherProps, children: [_jsxs(Stack, { vAlign: "center", fill: false, hAlign: "space-between", direction: "row", className: styles.Header, children: [_jsx(Title, { responsive: false, level: "5", id: titleId, children: title }
|
|
9
|
+
return (_jsx(Elevator, { resting: 4, children: _jsxs("div", { className: clsx(styles.Content, className), ref: forwardedRef, "data-theme": theme, ...otherProps, children: [_jsxs(Stack, { vAlign: "center", fill: false, hAlign: "space-between", direction: "row", className: styles.Header, children: [_jsx(Title, { responsive: false, level: "5", id: titleId, children: title }), onClose && _jsx(IconButton, { onClick: onClose, className: styles.CloseButton, icon: "xmark", kind: "flat" })] }), _jsx(AutoFocusInside, { children: children })] }) }));
|
|
10
10
|
});
|
|
11
11
|
ModalContent.displayName = 'Modal.Content';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modal.d.ts","sourceRoot":"","sources":["../../../src/components/modal/modal.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAIrD,OAAO,EAAgB,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAIzE,oBAAY,UAAU,GAAG,iBAAiB,CAAC,cAAc,CAAC,GAAG;IAC3D;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B,CAAA;AAED,aAAK,cAAc,GAAG,KAAK,CAAC,yBAAyB,CAAC,UAAU,CAAC,GAAG;IAClE,OAAO,EAAE,KAAK,CAAC,yBAAyB,CAAC,iBAAiB,CAAC,CAAC;CAC7D,CAAA;AAqBD,eAAO,MAAM,KAAK,
|
|
1
|
+
{"version":3,"file":"modal.d.ts","sourceRoot":"","sources":["../../../src/components/modal/modal.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAIrD,OAAO,EAAgB,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAIzE,oBAAY,UAAU,GAAG,iBAAiB,CAAC,cAAc,CAAC,GAAG;IAC3D;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B,CAAA;AAED,aAAK,cAAc,GAAG,KAAK,CAAC,yBAAyB,CAAC,UAAU,CAAC,GAAG;IAClE,OAAO,EAAE,KAAK,CAAC,yBAAyB,CAAC,iBAAiB,CAAC,CAAC;CAC7D,CAAA;AAqBD,eAAO,MAAM,KAAK,gBAmCE,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { domMax, LazyMotion, m } from 'framer-motion';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import { FocusOn } from 'react-focus-on';
|
|
6
6
|
import { ModalContent } from './content/modal-content';
|
|
@@ -26,7 +26,7 @@ const ModalAnimation = {
|
|
|
26
26
|
};
|
|
27
27
|
export const Modal = forwardRef(({ children, className, closeOnClickOutside = true, ...otherProps }, forwardedRef) => {
|
|
28
28
|
const { titleId, onClose } = useOverlayContext();
|
|
29
|
-
return (_jsx("div", { role: "dialog", "aria-modal": "true", "aria-labelledby": titleId, className: clsx(styles.Modal, className), ref: forwardedRef, ...otherProps, children: _jsx(FocusOn, { onClickOutside: closeOnClickOutside ? onClose : undefined, onEscapeKey: onClose, children: _jsx(
|
|
29
|
+
return (_jsx("div", { role: "dialog", "aria-modal": "true", "aria-labelledby": titleId, className: clsx(styles.Modal, className), ref: forwardedRef, ...otherProps, children: _jsx(FocusOn, { onClickOutside: closeOnClickOutside ? onClose : undefined, onEscapeKey: onClose, children: _jsx(LazyMotion, { features: domMax, children: _jsx(m.div, { variants: ModalAnimation, initial: "hidden", animate: "visible", exit: "hidden", className: styles.Container, children: children }) }) }) }));
|
|
30
30
|
});
|
|
31
31
|
Modal.displayName = 'Modal';
|
|
32
32
|
Modal.Content = ModalContent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overlay-container.d.ts","sourceRoot":"","sources":["../../../src/components/overlay-container/overlay-container.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAa,MAAM,OAAO,CAAA;AAM5C,oBAAY,qBAAqB,GAAG;IAClC;;;;OAIG;IACH,QAAQ,EAAE,SAAS,CAAA;IACnB;;OAEG;IACH,IAAI,CAAC,EAAE,WAAW,CAAA;IAClB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;IACzC;;OAEG;IACH,OAAO,CAAC,IAAI,IAAI,CAAC;IACjB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAA;AAED,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,
|
|
1
|
+
{"version":3,"file":"overlay-container.d.ts","sourceRoot":"","sources":["../../../src/components/overlay-container/overlay-container.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAa,MAAM,OAAO,CAAA;AAM5C,oBAAY,qBAAqB,GAAG;IAClC;;;;OAIG;IACH,QAAQ,EAAE,SAAS,CAAA;IACnB;;OAEG;IACH,IAAI,CAAC,EAAE,WAAW,CAAA;IAClB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;IACzC;;OAEG;IACH,OAAO,CAAC,IAAI,IAAI,CAAC;IACjB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAA;AAED,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CA8C5D,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { domMax, LazyMotion, m, AnimatePresence } from 'framer-motion';
|
|
3
3
|
import { useEffect } from 'react';
|
|
4
4
|
import { createPortal } from 'react-dom';
|
|
5
5
|
import { useUIDSeed } from 'react-uid';
|
|
@@ -12,6 +12,6 @@ export const OverlayContainer = ({ children, root = document.body, overlayColor
|
|
|
12
12
|
throw new Error('An OverlayContainer must not be inside another container. Please change the root prop.');
|
|
13
13
|
}
|
|
14
14
|
}, [root]);
|
|
15
|
-
const content = (_jsx(OverlayProvider, { onClose: onClose, children: _jsx(AnimatePresence, { exitBeforeEnter: true, children: children && (
|
|
15
|
+
const content = (_jsx(OverlayProvider, { onClose: onClose, children: _jsx(AnimatePresence, { exitBeforeEnter: true, children: children && (_jsx("div", { "data-overlay-container": true, "data-overlay-container-obfuscate": obfuscate, className: styles.OverlayContainer, style: { zIndex: index }, children: _jsxs(LazyMotion, { features: domMax, children: [obfuscate && (_jsx(m.span, { className: styles.Backdrop, "data-overlay-color": overlayColor, initial: { opacity: 0 }, animate: { opacity: 0.95 }, transition: { duration: 0.2 }, exit: { opacity: 0 } }, seedID('modal-backdrop'))), children] }) })) }) }));
|
|
16
16
|
return createPortal(content, root);
|
|
17
17
|
};
|
|
@@ -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;;kDAkJH,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 { domMax, LazyMotion, m, AnimatePresence } 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-dialog'),
|
|
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(LazyMotion, { features: domMax, children: _jsx(m.div, { variants: PopoverAnimation, initial: "hidden", animate: "visible", exit: "hidden", children: Children.map(children, (child) => isValidElement(child) && cloneElement(child, {
|
|
89
|
+
id: seedID('popover-dialog'),
|
|
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"}
|