@wonderflow/react-components 5.6.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 +4 -4
- package/dist/components/avatar/avatar.js +1 -1
- package/dist/components/button/button.d.ts.map +1 -1
- package/dist/components/button/button.js +5 -5
- package/dist/components/button/button.module.css +1 -1
- package/dist/components/card/card.d.ts +1 -1
- package/dist/components/card/card.d.ts.map +1 -1
- package/dist/components/card/card.js +2 -2
- package/dist/components/card/card.module.css +1 -1
- package/dist/components/chip/chip.js +1 -1
- package/dist/components/chip/chip.module.css +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.d.ts.map +1 -1
- package/dist/components/elevator/elevator.js +3 -3
- package/dist/components/grid/grid.js +4 -4
- package/dist/components/grid/grid.module.css +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.d.ts.map +1 -1
- package/dist/components/input-group/input-group.js +5 -5
- 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.d.ts.map +1 -1
- package/dist/components/masonry/masonry.js +3 -3
- 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.d.ts.map +1 -1
- package/dist/components/selection-controls/checkbox.js +2 -1
- package/dist/components/selection-controls/radio.d.ts.map +1 -1
- package/dist/components/selection-controls/radio.js +2 -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.d.ts +4 -4
- package/dist/components/stack/stack.d.ts.map +1 -1
- package/dist/components/stack/stack.js +6 -6
- 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 +3 -2
- package/dist/components/tab/tab-list.js +1 -1
- package/dist/components/tab/tab-panel.js +1 -1
- package/dist/components/tab/tab.d.ts.map +1 -1
- package/dist/components/tab/tab.js +5 -6
- package/dist/components/tab/tab.module.css +1 -1
- package/dist/components/table/table-cell/table-cell.d.ts +0 -4
- package/dist/components/table/table-cell/table-cell.d.ts.map +1 -1
- package/dist/components/table/table-cell/table-cell.js +10 -21
- package/dist/components/table/table-cell/table-cell.module.css +1 -1
- package/dist/components/table/table-checkbox/table-checkbox.js +1 -1
- package/dist/components/table/table-controls/toggle-columns.d.ts +4 -4
- package/dist/components/table/table-controls/toggle-columns.d.ts.map +1 -1
- package/dist/components/table/table-controls/toggle-columns.js +4 -4
- package/dist/components/table/table-expand/table-expand.js +1 -1
- package/dist/components/table/table-header/table-header.d.ts +1 -1
- package/dist/components/table/table-header/table-header.d.ts.map +1 -1
- package/dist/components/table/table-header/table-header.js +2 -2
- package/dist/components/table/table-pagination/table-pagination.d.ts +1 -1
- package/dist/components/table/table-pagination/table-pagination.d.ts.map +1 -1
- package/dist/components/table/table-pagination/table-pagination.js +5 -3
- package/dist/components/table/table-row/table-row.d.ts +8 -3
- package/dist/components/table/table-row/table-row.d.ts.map +1 -1
- package/dist/components/table/table-row/table-row.js +12 -3
- package/dist/components/table/table-row/table-row.module.css +1 -1
- package/dist/components/table/table.d.ts +10 -10
- package/dist/components/table/table.d.ts.map +1 -1
- package/dist/components/table/table.js +67 -49
- package/dist/components/table/types.d.ts +9 -5
- 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.d.ts.map +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/toggle-button/toggle-button.module.css +1 -1
- package/dist/components/tooltip/tooltip.d.ts +1 -1
- package/dist/components/tooltip/tooltip.d.ts.map +1 -1
- package/dist/components/tooltip/tooltip.js +6 -5
- package/dist/components/tooltip/tooltip.module.css +1 -1
- package/package.json +10 -11
- package/dist/components/dropdown/dropdown.d.ts +0 -59
- package/dist/components/dropdown/dropdown.d.ts.map +0 -1
- package/dist/components/dropdown/dropdown.js +0 -64
- 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/core/utils/media.css
CHANGED
|
@@ -9,11 +9,11 @@
|
|
|
9
9
|
|
|
10
10
|
/* Mobile First Media Queries */
|
|
11
11
|
|
|
12
|
-
@custom-media --from-extra-small (min-width:
|
|
13
|
-
@custom-media --from-small (min-width:
|
|
14
|
-
@custom-media --from-medium (min-width:
|
|
15
|
-
@custom-media --from-large (min-width:
|
|
16
|
-
@custom-media --from-extra-large (min-width:
|
|
12
|
+
@custom-media --from-extra-small (min-width: token(--breakpoint-extra-small));
|
|
13
|
+
@custom-media --from-small (min-width: token(--breakpoint-small));
|
|
14
|
+
@custom-media --from-medium (min-width: token(--breakpoint-medium));
|
|
15
|
+
@custom-media --from-large (min-width: token(--breakpoint-large));
|
|
16
|
+
@custom-media --from-extra-large (min-width: token(--breakpoint-extra-large));
|
|
17
17
|
|
|
18
18
|
/* Orientation Media Queries */
|
|
19
19
|
|
|
@@ -6,6 +6,6 @@ export const AutocompleteOption = forwardRef(({ children, value, onClick, ...oth
|
|
|
6
6
|
const handleClick = useCallback(() => {
|
|
7
7
|
onClick && onClick(value, contentRef?.current?.innerText);
|
|
8
8
|
}, [onClick, value]);
|
|
9
|
-
return (_jsx(Menu.Item, { ref: forwardedRef, role: "option", padding: false, onClick: handleClick, ...otherProps, children: _jsx("span", { ref: contentRef, children: children }
|
|
9
|
+
return (_jsx(Menu.Item, { ref: forwardedRef, role: "option", padding: false, onClick: handleClick, ...otherProps, children: _jsx("span", { ref: contentRef, children: children }) }));
|
|
10
10
|
});
|
|
11
11
|
AutocompleteOption.displayName = 'Autocomplete.Option';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { AnimatePresence, motion } from 'framer-motion';
|
|
3
3
|
import { AutocompleteOption } from './autocomplete-option';
|
|
4
|
-
import { Children, cloneElement, forwardRef, useCallback, useMemo, useRef, useState, useEffect } from 'react';
|
|
4
|
+
import { Children, cloneElement, forwardRef, useCallback, useMemo, useRef, useState, useEffect, isValidElement } from 'react';
|
|
5
5
|
import { useDebounce, useFocusWithin, useKeyPress, useSize } from 'ahooks';
|
|
6
6
|
import { Text, Menu, Textfield } from '../..';
|
|
7
7
|
import styles from './autocomplete.module.css';
|
|
@@ -72,10 +72,10 @@ export const Autocomplete = forwardRef(({ children, onChange, disabled, readOnly
|
|
|
72
72
|
value && setContent(String(value));
|
|
73
73
|
}, [value]);
|
|
74
74
|
return (_jsxs("div", { ref: autocompleteRef, className: styles.Autocomplete, "data-focus-within": isFocusWithin, children: [_jsx(Textfield, { ref: setTriggerRef, id: seedID('autocomplete-trigger'), "aria-haspopup": "true", "aria-controls": seedID('autocomplete-menu'), "aria-expanded": isOpen, onChange: handleFilter, value: content, autoComplete: "off", disabled: disabled, readOnly: readOnly, ...otherProps }, seedID('autocomplete-trigger')), _jsx(AnimatePresence, { children: visible && (_jsx("div", { ref: setTooltipRef, ...getTooltipProps({ className: styles.PopUp, style: { minInlineSize: triggerSize ? (triggerSize.width + 2) : 'auto' } }), children: _jsx(motion.div, { variants: AutocompleteAnimation, initial: "hidden", animate: "visible", exit: "hidden", children: _jsx(Menu, { role: "listbox", id: seedID('autocomplete-menu'), className: styles.OptionsList, style: dynamicStyle, "aria-labelledby": seedID('autocomplete-trigger'), children: filteredOptions.length === 0
|
|
75
|
-
? _jsx(Text, { as: "div", textAlign: "center", dimmed: 5, children: emptyMessage }
|
|
76
|
-
: Children.map(filteredOptions, (child) => cloneElement(child, {
|
|
75
|
+
? _jsx(Text, { as: "div", textAlign: "center", dimmed: 5, children: emptyMessage })
|
|
76
|
+
: Children.map(filteredOptions, (child) => isValidElement(child) && cloneElement(child, {
|
|
77
77
|
onClick: handleOptionClick
|
|
78
|
-
})) }
|
|
78
|
+
})) }) }) })) })] }));
|
|
79
79
|
});
|
|
80
80
|
Autocomplete.Option = AutocompleteOption;
|
|
81
81
|
Autocomplete.displayName = 'Autocomplete';
|
|
@@ -3,6 +3,6 @@ import { forwardRef } from 'react';
|
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import styles from './avatar.module.css';
|
|
5
5
|
export const Avatar = forwardRef(({ className, src, dimension = 'regular', ...otherProps }, forwardedRef) => {
|
|
6
|
-
return (_jsxs("picture", { className: clsx(styles.Avatar, className), "data-avatar-dimension": dimension, children: [_jsxs("svg", { "aria-hidden": "true", className: styles.Placeholder, height: 18, viewBox: "0 0 12 18", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("path", { opacity: 0.7, d: "M6 0C3.795 0 2 1.794 2 4s1.795 4 4 4 4-1.794 4-4-1.795-4-4-4z", fill: "var(--highlight-blue-foreground)" }
|
|
6
|
+
return (_jsxs("picture", { className: clsx(styles.Avatar, className), "data-avatar-dimension": dimension, children: [_jsxs("svg", { "aria-hidden": "true", className: styles.Placeholder, height: 18, viewBox: "0 0 12 18", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("path", { opacity: 0.7, d: "M6 0C3.795 0 2 1.794 2 4s1.795 4 4 4 4-1.794 4-4-1.795-4-4-4z", fill: "var(--highlight-blue-foreground)" }), _jsx("path", { d: "M8.4 9H3.6C1.612 9 0 10.575 0 12.531v5.126C1.814 18.517 3.85 19 6 19s4.186-.483 6-1.343v-5.126C12 10.581 10.394 9 8.4 9z", fill: "var(--highlight-blue-foreground)" })] }), src && (_jsx("img", { ref: forwardedRef, alt: "", src: src, ...otherProps }))] }));
|
|
7
7
|
});
|
|
8
8
|
Avatar.displayName = 'Avatar';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../src/components/button/button.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAsC,UAAU,
|
|
1
|
+
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../src/components/button/button.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAsC,UAAU,EAA+B,MAAM,OAAO,CAAA;AACvG,OAAO,EAAQ,SAAS,EAAE,WAAW,EAAW,MAAM,cAAc,CAAA;AAGpE,oBAAY,WAAW,GAAG;IACxB;;;OAGG;IACH,IAAI,CAAC,EAAE,SAAS,GAAG,WAAW,GAAG,MAAM,CAAC;IACxC;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,KAAK,CAAC;IACxC;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;IAC3B;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAChC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,IAAI,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAC;IACrC;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,OAAO,CAAC,CAAC,KAAK,EAAE,UAAU,CAAC,iBAAiB,GAAG,iBAAiB,CAAC,GAAG,IAAI,CAAC;CAC1E,CAAA;AAED,aAAK,iBAAiB,GAAG,WAAW,CAAC,mBAAmB,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;AAEhF,eAAO,MAAM,MAAM,mBAgEI,CAAA;AAEvB,oBAAY,iBAAiB,GAAG,cAAc,GAAG,IAAI,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,CAAC,CAAA;AAExF,eAAO,MAAM,YAAY,EAAE,EAAE,CAAC,iBAAiB,CAe9C,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import clsx from 'clsx';
|
|
3
|
-
import { Children, cloneElement, forwardRef, useCallback } from 'react';
|
|
3
|
+
import { Children, cloneElement, forwardRef, useCallback, isValidElement } from 'react';
|
|
4
4
|
import { Icon, Spinner } from '../..';
|
|
5
5
|
import styles from './button.module.css';
|
|
6
6
|
export const Button = forwardRef(({ kind = 'primary', dimension = 'regular', className, children, fullWidth, icon, disabled, iconPosition = 'left', iconColor, type = 'button', pressed, onClick, busy, as: Wrapper = 'button', ...otherProps }, forwardedRef) => {
|
|
@@ -11,13 +11,13 @@ export const Button = forwardRef(({ kind = 'primary', dimension = 'regular', cla
|
|
|
11
11
|
event.preventDefault();
|
|
12
12
|
}, [disabled, onClick]);
|
|
13
13
|
const iconSize = {
|
|
14
|
-
big:
|
|
14
|
+
big: 16,
|
|
15
15
|
regular: 16,
|
|
16
16
|
small: 12
|
|
17
17
|
};
|
|
18
|
-
return (_jsxs(Wrapper, { ref: forwardedRef, type: Wrapper === 'button' ? type : undefined, className: clsx(styles.Button, className), "data-button-icon-position": iconPosition, "data-button-dimension": dimension, "data-button-kind": kind, "data-button-fullwidth": fullWidth, "aria-disabled": disabled, "aria-busy": busy, "aria-pressed": Wrapper === 'button' ? pressed : undefined, "aria-live": busy ? 'polite' : undefined, onClick: handleClick(), ...otherProps, children: [icon && (_jsx(Icon, { source: icon, fill: iconColor, dimension: iconSize[dimension] }
|
|
18
|
+
return (_jsxs(Wrapper, { ref: forwardedRef, type: Wrapper === 'button' ? type : undefined, className: clsx(styles.Button, className), "data-button-icon-position": iconPosition, "data-button-dimension": dimension, "data-button-kind": kind, "data-button-fullwidth": fullWidth, "aria-disabled": disabled, "aria-busy": busy, "aria-pressed": Wrapper === 'button' ? pressed : undefined, "aria-live": busy ? 'polite' : undefined, onClick: handleClick(), ...otherProps, children: [icon && (_jsx(Icon, { source: icon, fill: iconColor, weight: "solid", dimension: iconSize[dimension] })), (children && busy) ? _jsx("span", { children: children }) : children, busy && (_jsx("span", { className: styles.SpinnerIndicator, children: _jsx(Spinner, { dimension: dimension }) }))] }));
|
|
19
19
|
});
|
|
20
|
-
export const ButtonsGroup = ({ children, className, kind, dimension = 'regular' }) => (_jsx("div", { className: clsx(styles.ButtonsGroup, className), children: Children.map(children, (child) => cloneElement(child, {
|
|
20
|
+
export const ButtonsGroup = ({ children, className, kind, dimension = 'regular' }) => (_jsx("div", { className: clsx(styles.ButtonsGroup, className), children: Children.map(children, (child) => isValidElement(child) && cloneElement(child, {
|
|
21
21
|
kind,
|
|
22
22
|
dimension
|
|
23
|
-
})) }
|
|
23
|
+
})) }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.Button{-webkit-touch-callout:none;grid-gap:.44rem;align-items:center;-webkit-appearance:none;appearance:none;background:none;border:0;border-radius:.22rem;box-sizing:border-box;cursor:pointer;display:inline-flex;font-family:inherit;font-weight:600;justify-content:center;margin:0;min-inline-size:min-content;overflow:hidden;position:relative;text-decoration:none;-webkit-user-select:none;user-select:none;white-space:nowrap}.Button[data-button-dimension=big]{block-size:2.67rem;font-size:1rem;padding:.55rem 1.33rem .66rem}.Button[data-button-dimension=regular]{block-size:2.22rem;font-size:.89rem;padding:.33rem .89rem .44rem}.Button[data-button-dimension=small]{grid-gap:.22rem;block-size:1.33rem;font-size:.78rem;padding:0 .44rem .11rem}.Button[data-button-kind=primary]{background:var(--cta-default);color:var(--cta-foreground)}.Button[data-button-kind=primary]:not([aria-pressed=true],[aria-disabled=true]):is(:active){background:var(--cta-dark)}.Button[data-button-kind=primary]:where([aria-pressed=true]),.Button[data-button-kind=primary]:where([aria-pressed=true]:active){background:#9e0018;color:#fff}.Button[data-button-kind=secondary]{-webkit-backdrop-filter:saturate(180%) blur(62px);backdrop-filter:saturate(180%) blur(62px);background-color:var(--global-vibrancy-background);color:var(--global-vibrancy-foreground)}.Button[data-button-kind=secondary]:not([aria-pressed=true],[aria-disabled=true]):is(:active){background-color:var(--global-vibrancy-background-hard);color:var(--global-vibrancy-foreground)}.Button[data-button-kind=secondary]:where([aria-pressed=true]),.Button[data-button-kind=secondary]:where([aria-pressed=true]:active){background:var(--dimmed-7);color:var(--dimmed-0)}.Button[data-button-kind=flat]{color:var(--global-vibrancy-foreground)}.Button[data-button-kind=flat]:not([aria-pressed=true],[aria-disabled=true]):is(:active){background-color:var(--global-vibrancy-background-hard)}.Button[data-button-kind=flat]:is(:hover,:focus){-webkit-backdrop-filter:saturate(180%) blur(62px);backdrop-filter:saturate(180%) blur(62px);background-color:var(--global-vibrancy-background);color:var(--global-vibrancy-foreground)}.Button[data-button-kind=flat]:where([aria-pressed=true]),.Button[data-button-kind=flat]:where([aria-pressed=true]:is(:active,:focus)){background:var(--dimmed-7);color:var(--dimmed-0)}.Button[data-button-fullwidth=true]{inline-size:100%}.Button[data-button-icon-position=right]{flex-direction:row-reverse}.Button[aria-disabled=true],.Button[aria-disabled=true]:is(:hover,:focus,:active){-webkit-backdrop-filter:saturate(180%) blur(62px);backdrop-filter:saturate(180%) blur(62px);background-color:var(--global-disabled-background);color:var(--global-disabled-foreground);cursor:not-allowed}.Button[aria-busy=true]>:not(.SpinnerIndicator){visibility:hidden}.SpinnerIndicator{bottom:0;display:grid;left:0;place-content:center;position:absolute;right:0;top:0}.ButtonsGroup{display:inline-flex}.ButtonsGroup>:not(:first-child,:last-child,:only-of-type){border-radius:0}.ButtonsGroup>:first-child:not(:only-of-type){border-bottom-right-radius:0;border-top-right-radius:0
|
|
1
|
+
.Button{-webkit-touch-callout:none;grid-gap:.44rem;align-items:center;-webkit-appearance:none;appearance:none;background:none;border:0;border-radius:.22rem;box-sizing:border-box;cursor:pointer;display:inline-flex;font-family:inherit;font-weight:600;justify-content:center;margin:0;min-inline-size:min-content;overflow:hidden;position:relative;text-decoration:none;-webkit-user-select:none;user-select:none;white-space:nowrap}.Button[data-button-dimension=big]{block-size:2.67rem;font-size:1rem;padding:.55rem 1.33rem .66rem}.Button[data-button-dimension=regular]{block-size:2.22rem;font-size:.89rem;padding:.33rem .89rem .44rem}.Button[data-button-dimension=small]{grid-gap:.22rem;block-size:1.33rem;font-size:.78rem;padding:0 .44rem .11rem}.Button[data-button-kind=primary]{background:var(--cta-default);color:var(--cta-foreground)}.Button[data-button-kind=primary]:not([aria-pressed=true],[aria-disabled=true]):is(:active){background:var(--cta-dark)}.Button[data-button-kind=primary]:where([aria-pressed=true]),.Button[data-button-kind=primary]:where([aria-pressed=true]:active){background:#9e0018;color:#fff}.Button[data-button-kind=secondary]{-webkit-backdrop-filter:saturate(180%) blur(62px);backdrop-filter:saturate(180%) blur(62px);background-color:var(--global-vibrancy-background);color:var(--global-vibrancy-foreground)}.Button[data-button-kind=secondary]:not([aria-pressed=true],[aria-disabled=true]):is(:active){background-color:var(--global-vibrancy-background-hard);color:var(--global-vibrancy-foreground)}.Button[data-button-kind=secondary]:where([aria-pressed=true]),.Button[data-button-kind=secondary]:where([aria-pressed=true]:active){background:var(--dimmed-7);color:var(--dimmed-0)}.Button[data-button-kind=flat]{color:var(--global-vibrancy-foreground)}.Button[data-button-kind=flat]:not([aria-pressed=true],[aria-disabled=true]):is(:active){background-color:var(--global-vibrancy-background-hard)}.Button[data-button-kind=flat]:is(:hover,:focus){-webkit-backdrop-filter:saturate(180%) blur(62px);backdrop-filter:saturate(180%) blur(62px);background-color:var(--global-vibrancy-background);color:var(--global-vibrancy-foreground)}.Button[data-button-kind=flat]:where([aria-pressed=true]),.Button[data-button-kind=flat]:where([aria-pressed=true]:is(:active,:focus)){background:var(--dimmed-7);color:var(--dimmed-0)}.Button[data-button-fullwidth=true]{inline-size:100%}.Button[data-button-icon-position=right]{flex-direction:row-reverse}.Button[aria-disabled=true],.Button[aria-disabled=true]:is(:hover,:focus,:active){-webkit-backdrop-filter:saturate(180%) blur(62px);backdrop-filter:saturate(180%) blur(62px);background-color:var(--global-disabled-background);color:var(--global-disabled-foreground);cursor:not-allowed}.Button[aria-busy=true]>:not(.SpinnerIndicator){visibility:hidden}.SpinnerIndicator{bottom:0;display:grid;left:0;place-content:center;position:absolute;right:0;top:0}.ButtonsGroup{display:inline-flex}.ButtonsGroup>*+*{box-shadow:inset 1px 0 0 hsla(0,0%,40%,.2)}.ButtonsGroup>:not(:first-child,:last-child,:only-of-type){border-radius:0}.ButtonsGroup>:first-child:not(:only-of-type){border-bottom-right-radius:0;border-top-right-radius:0}.ButtonsGroup>:last-child:not(:only-of-type){border-bottom-left-radius:0;border-top-left-radius:0}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { StackProps, Polymorphic } from '../..';
|
|
3
3
|
import { TokensTypes } from '@wonderflow/tokens/platforms/web';
|
|
4
|
-
export declare type CardProps = Pick<StackProps, 'wrap' | 'columnGap' | 'rowGap' | '
|
|
4
|
+
export declare type CardProps = Pick<StackProps, 'wrap' | 'columnGap' | 'rowGap' | 'vAlign' | 'hAlign'> & {
|
|
5
5
|
/**
|
|
6
6
|
* Set the padding on each side of the card.
|
|
7
7
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../../../src/components/card/card.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA6B,SAAS,EAAE,MAAM,OAAO,CAAA;AAE5D,OAAO,EAAS,UAAU,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAI7D,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAA;AAE9D,oBAAY,SAAS,GAAG,IAAI,CAC5B,UAAU,EACR,MAAM,GAAG,WAAW,GAAG,QAAQ,GAAG,
|
|
1
|
+
{"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../../../src/components/card/card.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA6B,SAAS,EAAE,MAAM,OAAO,CAAA;AAE5D,OAAO,EAAS,UAAU,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAI7D,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAA;AAE9D,oBAAY,SAAS,GAAG,IAAI,CAC5B,UAAU,EACR,MAAM,GAAG,WAAW,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC,GACpD;IACF;;OAEG;IACH,OAAO,CAAC,EAAE,KAAK,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;IACvC;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC;IACvC;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACnB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAA;AAED,aAAK,eAAe,GAAG,WAAW,CAAC,mBAAmB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;AAEzE,eAAO,MAAM,IAAI,iBA6DI,CAAA"}
|
|
@@ -4,10 +4,10 @@ import tkns from '@wonderflow/tokens/platforms/web/tokens.json';
|
|
|
4
4
|
import { Stack } from '../..';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
import styles from './card.module.css';
|
|
7
|
-
export const Card = forwardRef(({ as: Wrapper = 'div', children, className, padding = 24, radius = 8, left, right, dimmed, bordered, columnGap = 24, rowGap = 24,
|
|
7
|
+
export const Card = forwardRef(({ as: Wrapper = 'div', children, className, padding = 24, radius = 8, left, right, dimmed, bordered, columnGap = 24, rowGap = 24, vAlign = 'start', hAlign = 'space-between', vibrant = false, highlightOnHover = false, wrap, style, ...otherProps }, forwardedRef) => {
|
|
8
8
|
const dynamicStyle = {
|
|
9
9
|
'--padding': padding && tkns.space[padding],
|
|
10
10
|
'--radius': radius && tkns.radius[radius]
|
|
11
11
|
};
|
|
12
|
-
return (_jsx(Wrapper, { ref: forwardedRef, className: clsx(styles.Card, className), style: { ...dynamicStyle, ...style }, "data-card-dimmed": dimmed, "data-card-bordered": bordered, "data-card-vibrant": vibrant, "data-card-highlight-hover": highlightOnHover, ...otherProps, children: _jsxs(Stack, { direction: "row", fill: false,
|
|
12
|
+
return (_jsx(Wrapper, { ref: forwardedRef, className: clsx(styles.Card, className), style: { ...dynamicStyle, ...style }, "data-card-dimmed": dimmed, "data-card-bordered": bordered, "data-card-vibrant": vibrant, "data-card-highlight-hover": highlightOnHover, ...otherProps, children: _jsxs(Stack, { direction: "row", fill: false, vAlign: vAlign, hAlign: hAlign, columnGap: columnGap, rowGap: rowGap, wrap: wrap, children: [left && _jsx("div", { className: styles.Left, children: left }), children && (_jsx("div", { className: styles.Content, children: children })), right && (_jsx("div", { className: styles.Right, children: right }))] }) }));
|
|
13
13
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
:where(.Card){background-color:var(--global-background);border-radius:var(--radius);padding:var(--padding);position:relative}[data-card-highlight-hover=true]:where(.Card):is(:hover,:focus-visible){background-color:var(--dimmed-0)}[data-card-dimmed="1"]:where(.Card){background-color:var(--dimmed-0)}[data-card-dimmed="1"][data-card-highlight-hover=true]:where(.Card):is(:hover,:focus-visible){background-color:var(--global-background)}[data-card-dimmed="2"]:where(.Card){background-color:var(--dimmed-1)}[data-card-dimmed="2"][data-card-highlight-hover=true]:where(.Card):is(:hover,:focus-visible){background-color:var(--dimmed-0)}[data-card-dimmed="3"]:where(.Card){background-color:var(--dimmed-2)}[data-card-dimmed="3"][data-card-highlight-hover=true]:where(.Card):is(:hover,:focus-visible){background-color:var(--dimmed-1)}[data-card-vibrant=true]:where(.Card){-webkit-backdrop-filter:saturate(180%) blur(62px);backdrop-filter:saturate(180%) blur(62px);background-color:var(--global-vibrancy-background)}[data-card-vibrant=true][data-card-highlight-hover=true]:where(.Card):is(:hover,:focus-visible){background-color:var(--global-vibrancy-background-soft)}[data-card-bordered=true]:where(.Card){border:1px solid var(--dimmed-1)}
|
|
1
|
+
:where(.Card){background-color:var(--global-background);border-radius:var(--radius);padding:var(--padding);position:relative}[data-card-highlight-hover=true]:where(.Card):is(:hover,:focus-visible){background-color:var(--dimmed-0)}[data-card-dimmed="1"]:where(.Card){background-color:var(--dimmed-0)}[data-card-dimmed="1"][data-card-highlight-hover=true]:where(.Card):is(:hover,:focus-visible){background-color:var(--global-background)}[data-card-dimmed="2"]:where(.Card){background-color:var(--dimmed-1)}[data-card-dimmed="2"][data-card-highlight-hover=true]:where(.Card):is(:hover,:focus-visible){background-color:var(--dimmed-0)}[data-card-dimmed="3"]:where(.Card){background-color:var(--dimmed-2)}[data-card-dimmed="3"][data-card-highlight-hover=true]:where(.Card):is(:hover,:focus-visible){background-color:var(--dimmed-1)}[data-card-vibrant=true]:where(.Card){-webkit-backdrop-filter:saturate(180%) blur(62px);backdrop-filter:saturate(180%) blur(62px);background-color:var(--global-vibrancy-background)}[data-card-vibrant=true][data-card-highlight-hover=true]:where(.Card):is(:hover,:focus-visible){background-color:var(--global-vibrancy-background-soft)}[data-card-bordered=true]:where(.Card){border:1px solid var(--dimmed-1)}.Left{flex-shrink:0}.Content{flex-grow:1}.Right{flex-shrink:0}
|
|
@@ -18,6 +18,6 @@ export const Chip = forwardRef(({ children, className, dimension = 'regular', co
|
|
|
18
18
|
style: 'outline'
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
|
-
return (_jsxs(Stack, { as: "span", direction: "row", columnGap: 8, inline: true, "data-chip-color": color, "data-chip-dimension": dimension, className: clsx(styles.Chip, className),
|
|
21
|
+
return (_jsxs(Stack, { as: "span", direction: "row", columnGap: 8, inline: true, "data-chip-color": color, "data-chip-dimension": dimension, className: clsx(styles.Chip, className), vAlign: "center", ref: forwardedRef, ...otherProps, children: [_jsx("b", { children: children }), interactive && (_jsx("button", { onClick: interactive && onDismissClick, className: styles.Action, type: "button", children: _jsx(Icon, { source: "xmark", weight: properties[dimension].style, dimension: properties[dimension].iconSize }) }))] }));
|
|
22
22
|
});
|
|
23
23
|
Chip.displayName = 'Chip';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.Chip{background-color:var(--highlight-gray-background);block-size:1.78rem;border-radius:2.67rem;color:var(--highlight-gray-foreground);font-size:.89rem;font-weight:600;padding:
|
|
1
|
+
.Chip{background-color:var(--highlight-gray-background);block-size:1.78rem;border-radius:2.67rem;color:var(--highlight-gray-foreground);font-size:.89rem;font-weight:600;padding:0 .44rem .22rem}.Chip[data-chip-dimension=small]{block-size:1.33rem;font-size:.78rem}.Chip[data-chip-dimension=big]{font-size:1rem}.Chip[data-chip-color=cyan]{background-color:var(--highlight-cyan-background);color:var(--highlight-cyan-foreground)}.Chip[data-chip-color=green]{background-color:var(--highlight-green-background);color:var(--highlight-green-foreground)}.Chip[data-chip-color=purple]{background-color:var(--highlight-purple-background);color:var(--highlight-purple-foreground)}.Chip[data-chip-color=yellow]{background-color:var(--highlight-yellow-background);color:var(--highlight-yellow-foreground)}.Chip[data-chip-color=red]{background-color:var(--highlight-red-background);color:var(--highlight-red-foreground)}.Chip[data-chip-color=blue]{background-color:var(--highlight-blue-background);color:var(--highlight-blue-foreground)}.Action{-webkit-appearance:none;appearance:none;background:none;border:0;color:inherit;cursor:pointer;display:inline-flex;font:inherit;margin-top:1px;padding:0}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef, useCallback } from 'react';
|
|
2
|
+
import { forwardRef, useCallback, useMemo } from 'react';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import styles from './circular-progress.module.css';
|
|
5
5
|
export const CircularProgress = forwardRef(({ className, value, max = 100, dimension = 'regular', showProgress, style, ...otherProps }, forwardedRef) => {
|
|
6
6
|
const getPercentage = useCallback(() => value ? Math.round((100 * value) / max) : 0, [max, value]);
|
|
7
|
-
const clamp = (num, min, max) => Math.min(Math.max(num, min), max);
|
|
7
|
+
const clamp = useMemo(() => (num, min, max) => Math.min(Math.max(num, min), max), []);
|
|
8
8
|
const dynamicStyle = {
|
|
9
9
|
'--progress': `${getPercentage()}%`
|
|
10
10
|
};
|
|
11
|
-
return (_jsx("div", { ref: forwardedRef, role: "progressbar", "aria-valuenow": value, "aria-valuemin": 0, "aria-valuemax": max, className: clsx(styles.CircularProgress, className), "data-circular-progress": clamp(getPercentage(), 0, 100), "data-circular-progress-dimension": dimension, "data-circular-progress-show-progress": showProgress, style: { ...dynamicStyle, ...style }, ...otherProps }
|
|
11
|
+
return (_jsx("div", { ref: forwardedRef, role: "progressbar", "aria-valuenow": value, "aria-valuemin": 0, "aria-valuemax": max, className: clsx(styles.CircularProgress, className), "data-circular-progress": clamp(getPercentage(), 0, 100), "data-circular-progress-dimension": dimension, "data-circular-progress-show-progress": showProgress, style: { ...dynamicStyle, ...style }, ...otherProps }));
|
|
12
12
|
});
|
|
13
13
|
CircularProgress.displayName = 'CircularProgress';
|
|
@@ -6,5 +6,5 @@ export const ClampText = forwardRef(({ className, children, rows = 1, style, as:
|
|
|
6
6
|
const dynamicStyle = {
|
|
7
7
|
'--r': rows
|
|
8
8
|
};
|
|
9
|
-
return (_jsx(Wrapper, { ref: forwardedRef, style: { ...dynamicStyle, ...style }, className: clsx(styles.ClampText, className), ...otherProps, children: children }
|
|
9
|
+
return (_jsx(Wrapper, { ref: forwardedRef, style: { ...dynamicStyle, ...style }, className: clsx(styles.ClampText, className), ...otherProps, children: children }));
|
|
10
10
|
});
|
|
@@ -3,5 +3,5 @@ import { forwardRef } from 'react';
|
|
|
3
3
|
import styles from './container.module.css';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
export const Container = forwardRef(({ children, className, dimension = 'full', padding = true, as: Wrapper = 'div', ...otherProps }, forwardedRef) => {
|
|
6
|
-
return (_jsx(Wrapper, { ref: forwardedRef, className: clsx(styles.Container, className), "data-container-dimension": dimension, "data-container-padding": padding, ...otherProps, children: children }
|
|
6
|
+
return (_jsx(Wrapper, { ref: forwardedRef, className: clsx(styles.Container, className), "data-container-dimension": dimension, "data-container-padding": padding, ...otherProps, children: children }));
|
|
7
7
|
});
|
|
@@ -12,5 +12,5 @@ export const Datetime = ({ date, locale = 'en-US', options, ...otherProps }) =>
|
|
|
12
12
|
}).format(timeDate);
|
|
13
13
|
setDateTime(humanDate);
|
|
14
14
|
}, [date, locale, options]);
|
|
15
|
-
return (_jsx("time", { dateTime: date, ...otherProps, children: datetime }
|
|
15
|
+
return (_jsx("time", { dateTime: date, ...otherProps, children: datetime }));
|
|
16
16
|
};
|
|
@@ -16,7 +16,7 @@ export const Disclosure = forwardRef(({ children, open = false, padding = true,
|
|
|
16
16
|
(ref.current && expandable) && setIsOpen(ref.current.open);
|
|
17
17
|
}, [expandable]);
|
|
18
18
|
const dynamicStyle = {
|
|
19
|
-
'--
|
|
19
|
+
'--max-height': contentMaxHeight
|
|
20
20
|
};
|
|
21
21
|
const sizes = {
|
|
22
22
|
small: {
|
|
@@ -32,7 +32,7 @@ export const Disclosure = forwardRef(({ children, open = false, padding = true,
|
|
|
32
32
|
icon: 24
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
|
-
const renderContent = useCallback(() => (_jsx(motion.div, { className: styles.Content, "data-disclosure-padding": padding, "data-disclosure-height": Boolean(contentMaxHeight), animate: isOpen ? { y: 5, opacity: 1 } : { y: 0, opacity: 0 }, transition: { ease: 'easeOut', duration: 0.1 }, initial: false, children: children }
|
|
36
|
-
return (_jsxs("details", { style: { ...dynamicStyle, ...style }, className: clsx(styles.Disclosure, className), "data-disclosure-icon-position": iconPosition, "data-disclosure-dimension": dimension, "data-disclosure-expandable": expandable, onToggle: handleOpen(), "aria-expanded": isOpen ? 'true' : 'false', ref: ref, ...otherProps, children: [_jsxs(Text, { as: "summary", responsive: false, className: styles.Summary, "aria-expanded": isOpen, tabIndex: !expandable ? -1 : 0, size: dimension ? sizes[dimension].summary : undefined, weight: "bold", children: [summary, expandable && (_jsx(Icon, { className: styles.ExpandIcon, source: "chevron-right", dimension: sizes[dimension].icon }
|
|
35
|
+
const renderContent = useCallback(() => (_jsx(motion.div, { className: styles.Content, "data-disclosure-padding": padding, "data-disclosure-height": Boolean(contentMaxHeight), animate: isOpen ? { y: 5, opacity: 1 } : { y: 0, opacity: 0 }, transition: { ease: 'easeOut', duration: 0.1 }, initial: false, children: children })), [children, contentMaxHeight, padding, isOpen]);
|
|
36
|
+
return (_jsxs("details", { style: { ...dynamicStyle, ...style }, className: clsx(styles.Disclosure, className), "data-disclosure-icon-position": iconPosition, "data-disclosure-dimension": dimension, "data-disclosure-expandable": expandable, onToggle: handleOpen(), "aria-expanded": isOpen ? 'true' : 'false', ref: ref, ...otherProps, children: [_jsxs(Text, { as: "summary", responsive: false, className: styles.Summary, "aria-expanded": isOpen, tabIndex: !expandable ? -1 : 0, size: dimension ? sizes[dimension].summary : undefined, weight: "bold", children: [summary, expandable && (_jsx(Icon, { className: styles.ExpandIcon, source: "chevron-right", dimension: sizes[dimension].icon }))] }), renderContent()] }));
|
|
37
37
|
});
|
|
38
38
|
Disclosure.displayName = 'Disclosure';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.Disclosure{--icon-size:1.11rem;--icon-padding:0.44rem;--padding:calc(var(--icon-size) + var(--icon-padding) + var(--icon-size)/2);--icon-top-offset:calc(var(--icon-size)/2);display:block;position:relative;transform:translateZ(0);z-index:0}.Disclosure *{box-sizing:border-box}.Disclosure[data-disclosure-dimension=small]{--icon-top-offset:calc(var(--icon-size)/1.5);--icon-size:0.67rem}.Disclosure[data-disclosure-dimension=regular]{--icon-size:0.89rem}.Disclosure[data-disclosure-dimension=big]{--icon-top-offset:calc(var(--icon-size)/4);--icon-size:1.33rem;--icon-padding:0.89rem}.Summary{display:list-item;outline-offset:-2px;padding:.11rem 0;position:relative;touch-action:manipulation;-webkit-user-select:none;user-select:none}.Disclosure[data-disclosure-icon-position=right][data-disclosure-expandable=true] .Summary{padding-inline-end:var(--padding)}.Disclosure[data-disclosure-icon-position=left][data-disclosure-expandable=true] .Summary{padding-inline-start:var(--padding)}.Disclosure[data-disclosure-expandable=true] .Summary{cursor:pointer}.Summary::marker{content:""}.Summary::-webkit-details-marker{display:none}.ExpandIcon{block-size:var(--icon-size);content:"";inline-size:var(--icon-size);position:absolute;right:calc(var(--icon-size)/2);top:var(--icon-top-offset);transform-box:fill-box;transform-origin:50% center;transition:transform .1s cubic-bezier(.3,.07,.34,1)}.Disclosure[data-disclosure-icon-position=left] .ExpandIcon{left:calc(var(--icon-size)/2);right:auto}.Disclosure[open]>.Summary>.ExpandIcon{transform:rotate(90deg)}.Content{box-sizing:border-box}.Disclosure[data-disclosure-icon-position=left] .Content[data-disclosure-padding=true]{padding-inline-start:var(--padding)}.Disclosure[data-disclosure-icon-position=right] .Content[data-disclosure-padding=true]{padding-right:var(--padding)}.Content[data-disclosure-height=true]{-webkit-overflow-scrolling:touch;max-block-size:var(--
|
|
1
|
+
.Disclosure{--icon-size:1.11rem;--icon-padding:0.44rem;--padding:calc(var(--icon-size) + var(--icon-padding) + var(--icon-size)/2);--icon-top-offset:calc(var(--icon-size)/2);display:block;position:relative;transform:translateZ(0);z-index:0}.Disclosure *{box-sizing:border-box}.Disclosure[data-disclosure-dimension=small]{--icon-top-offset:calc(var(--icon-size)/1.5);--icon-size:0.67rem}.Disclosure[data-disclosure-dimension=regular]{--icon-size:0.89rem}.Disclosure[data-disclosure-dimension=big]{--icon-top-offset:calc(var(--icon-size)/4);--icon-size:1.33rem;--icon-padding:0.89rem}.Summary{display:list-item;outline-offset:-2px;padding:.11rem 0;position:relative;touch-action:manipulation;-webkit-user-select:none;user-select:none}.Disclosure[data-disclosure-icon-position=right][data-disclosure-expandable=true] .Summary{padding-inline-end:var(--padding)}.Disclosure[data-disclosure-icon-position=left][data-disclosure-expandable=true] .Summary{padding-inline-start:var(--padding)}.Disclosure[data-disclosure-expandable=true] .Summary{cursor:pointer}.Summary::marker{content:""}.Summary::-webkit-details-marker{display:none}.ExpandIcon{block-size:var(--icon-size);content:"";inline-size:var(--icon-size);position:absolute;right:calc(var(--icon-size)/2);top:var(--icon-top-offset);transform-box:fill-box;transform-origin:50% center;transition:transform .1s cubic-bezier(.3,.07,.34,1)}.Disclosure[data-disclosure-icon-position=left] .ExpandIcon{left:calc(var(--icon-size)/2);right:auto}.Disclosure[open]>.Summary>.ExpandIcon{transform:rotate(90deg)}.Content{box-sizing:border-box}.Disclosure[data-disclosure-icon-position=left] .Content[data-disclosure-padding=true]{padding-inline-start:var(--padding)}.Disclosure[data-disclosure-icon-position=right] .Content[data-disclosure-padding=true]{padding-right:var(--padding)}.Content[data-disclosure-height=true]{-webkit-overflow-scrolling:touch;max-block-size:var(--max-height);overflow:auto;overscroll-behavior:contain}
|
|
@@ -28,6 +28,6 @@ export const Drawer = forwardRef(({ children, className, closeOnClickOutside = t
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
|
-
return (_jsx("div", { role: "dialog", "aria-modal": isModal, "data-theme": theme, "aria-labelledby": titleId, className: clsx(styles.Drawer, className), ref: forwardedRef, ...otherProps, children: _jsx(FocusOn, { enabled: isModal, onClickOutside: closeOnClickOutside ? onClose : undefined, onEscapeKey: onClose, children: _jsx(motion.div, { variants: DrawerAnimation, initial: "hidden", animate: "visible", exit: "hidden", className: styles.Container, "data-drawer-side": side, children: _jsx(Elevator, { resting: 4, children: _jsxs("div", { className: styles.Content, style: dynamicStyle, ref: forwardedRef, ...otherProps, children: [(showHeader && title) && (_jsxs(Stack, {
|
|
31
|
+
return (_jsx("div", { role: "dialog", "aria-modal": isModal, "data-theme": theme, "aria-labelledby": titleId, className: clsx(styles.Drawer, className), ref: forwardedRef, ...otherProps, children: _jsx(FocusOn, { enabled: isModal, onClickOutside: closeOnClickOutside ? onClose : undefined, onEscapeKey: onClose, children: _jsx(motion.div, { variants: DrawerAnimation, initial: "hidden", animate: "visible", exit: "hidden", className: styles.Container, "data-drawer-side": side, children: _jsx(Elevator, { resting: 4, children: _jsxs("div", { className: styles.Content, style: dynamicStyle, ref: forwardedRef, ...otherProps, children: [(showHeader && title) && (_jsxs(Stack, { vAlign: "center", fill: false, hAlign: "space-between", direction: "row", className: styles.Header, children: [_jsx(Title, { responsive: false, level: "6", id: titleId, children: title }), onClose && _jsx(IconButton, { onClick: onClose, className: styles.CloseButton, icon: "xmark", kind: "flat" })] })), _jsx(AutoFocusInside, { children: children })] }) }) }) }) }));
|
|
32
32
|
});
|
|
33
33
|
Drawer.displayName = 'Drawer';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"elevator.d.ts","sourceRoot":"","sources":["../../../src/components/elevator/elevator.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAoC,YAAY,
|
|
1
|
+
{"version":3,"file":"elevator.d.ts","sourceRoot":"","sources":["../../../src/components/elevator/elevator.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAoC,YAAY,EAAkB,MAAM,OAAO,CAAA;AAE1F,oBAAY,aAAa,GAAG;IAC1B;;MAEE;IACF,OAAO,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC3B;;OAEG;IACH,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC1B;;;;OAIG;IACH,QAAQ,EAAE,YAAY,CAAC;CACxB,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,EAAE,CAAC,aAAa,CAgBtC,CAAA"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Fragment, Children, cloneElement } from 'react';
|
|
2
|
+
import { Fragment, Children, cloneElement, isValidElement } from 'react';
|
|
3
3
|
export const Elevator = ({ children, resting, hover }) => {
|
|
4
|
-
return (_jsx(Fragment, { children: Children.map(children, (child) => cloneElement(child, {
|
|
4
|
+
return (_jsx(Fragment, { children: Children.map(children, (child) => isValidElement(child) && cloneElement(child, {
|
|
5
5
|
'data-elevation': resting,
|
|
6
6
|
'data-elevation-hover': hover
|
|
7
|
-
})) }
|
|
7
|
+
})) }));
|
|
8
8
|
};
|
|
@@ -4,16 +4,16 @@ import clsx from 'clsx';
|
|
|
4
4
|
import tkns from '@wonderflow/tokens/platforms/web/tokens.json';
|
|
5
5
|
import { GridItem } from './item/grid-item';
|
|
6
6
|
import styles from './grid.module.css';
|
|
7
|
-
export const Grid = forwardRef(({ className, children, columns, rows, rowGap
|
|
7
|
+
export const Grid = forwardRef(({ className, children, columns, rows, rowGap, columnGap, style, filling = 'fill', colMinWidth = '10rem', rowMinHeight = '1fr', ...otherProps }, forwardedRef) => {
|
|
8
8
|
const computedStyle = {
|
|
9
|
-
'--
|
|
10
|
-
'--
|
|
9
|
+
'--row-gap': rowGap ? tkns.space[rowGap] : 0,
|
|
10
|
+
'--column-gap': columnGap ? tkns.space[columnGap] : 0,
|
|
11
11
|
'--columns': columns,
|
|
12
12
|
'--column-min-w': colMinWidth,
|
|
13
13
|
'--rows': rows,
|
|
14
14
|
'--row-min-h': rowMinHeight
|
|
15
15
|
};
|
|
16
|
-
return (_jsx("ul", { className: clsx(styles.Grid, className), style: { ...computedStyle, ...style }, "data-grid-filling-type": filling, ref: forwardedRef, ...otherProps, children: children }
|
|
16
|
+
return (_jsx("ul", { className: clsx(styles.Grid, className), style: { ...computedStyle, ...style }, "data-grid-filling-type": filling, ref: forwardedRef, ...otherProps, children: children }));
|
|
17
17
|
});
|
|
18
18
|
Grid.displayName = 'Grid';
|
|
19
19
|
Grid.Item = GridItem;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.Grid{--column-size:minmax(min(var(--column-min-w),100%),1fr);grid-gap:var(--
|
|
1
|
+
.Grid{--column-size:minmax(min(var(--column-min-w),100%),1fr);grid-gap:var(--row-gap,.44rem) var(--column-gap,.44rem);display:grid;grid-template-columns:repeat(var(--columns),var(--column-size));grid-template-rows:repeat(var(--rows),var(--row-min-h));list-style:none;margin:0;padding:0}.Grid[data-grid-filling-type=fill]{grid-template-columns:repeat(auto-fill,var(--column-size))}.Grid[data-grid-filling-type=fit]{grid-template-columns:repeat(auto-fit,var(--column-size))}
|
|
@@ -7,6 +7,6 @@ export const GridItem = forwardRef(({ children, style, className, fullWidth = fa
|
|
|
7
7
|
'--column': column,
|
|
8
8
|
'--row': row
|
|
9
9
|
};
|
|
10
|
-
return (_jsx("li", { ref: forwardedRef, className: clsx(styles.GridItem, className), style: { ...dynamicStyle, ...style }, "data-grid-item-fullwidth": fullWidth, ...otherProps, children: children }
|
|
10
|
+
return (_jsx("li", { ref: forwardedRef, className: clsx(styles.GridItem, className), style: { ...dynamicStyle, ...style }, "data-grid-item-fullwidth": fullWidth, ...otherProps, children: children }));
|
|
11
11
|
});
|
|
12
12
|
GridItem.displayName = 'Grid.Item';
|
|
@@ -34,7 +34,7 @@ export declare const Icon: import("react").ForwardRefExoticComponent<SVGAttribut
|
|
|
34
34
|
* Set the size of the icon. To improve readability at any size, the style of the icon
|
|
35
35
|
* is automatically defined based on the dimension.
|
|
36
36
|
*/
|
|
37
|
-
dimension?: 16 |
|
|
37
|
+
dimension?: 16 | 12 | 24 | 32 | 40 | 48 | 56 | undefined;
|
|
38
38
|
/**
|
|
39
39
|
* Set the weight of the icon.
|
|
40
40
|
* The default weight is `outline` if `dimension` is greather than `12` or `undefined`.
|
|
@@ -6,12 +6,12 @@ import styles from './icon.module.css';
|
|
|
6
6
|
export const Icon = forwardRef(({ className, source, dimension = 16, weight = 'outline', fill, ...otherProps }, forwardedRef) => {
|
|
7
7
|
const computedStyle = useMemo(() => dimension < 16 ? 'solid' : weight, [weight, dimension]);
|
|
8
8
|
return (typeof source === 'string')
|
|
9
|
-
? (_jsx("svg", { "aria-hidden": "true", width: dimension, height: dimension, fill: fill, className: clsx(styles.Icon, className), ref: forwardedRef, ...otherProps, children: _jsx("use", { href: `${sprite}#${computedStyle}/${source}` }
|
|
9
|
+
? (_jsx("svg", { "aria-hidden": "true", width: dimension, height: dimension, fill: fill, className: clsx(styles.Icon, className), ref: forwardedRef, ...otherProps, children: _jsx("use", { href: `${sprite}#${computedStyle}/${source}` }) }))
|
|
10
10
|
: (_jsx(_Fragment, { children: Children.map(source, (child) => cloneElement(child, {
|
|
11
11
|
className,
|
|
12
12
|
'aria-hidden': 'true',
|
|
13
13
|
width: dimension,
|
|
14
14
|
height: dimension
|
|
15
|
-
})) }
|
|
15
|
+
})) }));
|
|
16
16
|
});
|
|
17
17
|
Icon.displayName = 'Icon';
|
|
@@ -3,4 +3,4 @@ import { forwardRef } from 'react';
|
|
|
3
3
|
import styles from './icon-button.module.css';
|
|
4
4
|
import { Button } from '../..';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
|
-
export const IconButton = forwardRef(({ className, icon, dimension, kind, disabled, busy, ...otherProps }, forwardedRef) => (_jsx(Button, { ref: forwardedRef, icon: icon, dimension: dimension, kind: kind, disabled: disabled, busy: busy, className: clsx(styles.IconButton, className), ...otherProps }
|
|
6
|
+
export const IconButton = forwardRef(({ className, icon, dimension, kind, disabled, busy, ...otherProps }, forwardedRef) => (_jsx(Button, { ref: forwardedRef, icon: icon, dimension: dimension, kind: kind, disabled: disabled, busy: busy, className: clsx(styles.IconButton, className), ...otherProps })));
|
|
@@ -9,7 +9,7 @@ export * from './container';
|
|
|
9
9
|
export * from './datetime';
|
|
10
10
|
export * from './disclosure';
|
|
11
11
|
export * from './drawer';
|
|
12
|
-
export * from './
|
|
12
|
+
export * from './popover';
|
|
13
13
|
export * from './elevator';
|
|
14
14
|
export * from './grid';
|
|
15
15
|
export * from './icon-button';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,QAAQ,CAAA;AACtB,cAAc,QAAQ,CAAA;AACtB,cAAc,qBAAqB,CAAA;AACnC,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,UAAU,CAAA;AACxB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,QAAQ,CAAA;AACtB,cAAc,QAAQ,CAAA;AACtB,cAAc,qBAAqB,CAAA;AACnC,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,UAAU,CAAA;AACxB,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,QAAQ,CAAA;AACtB,cAAc,eAAe,CAAA;AAC7B,cAAc,QAAQ,CAAA;AACtB,cAAc,cAAc,CAAA;AAC5B,cAAc,eAAe,CAAA;AAC7B,cAAc,mBAAmB,CAAA;AACjC,cAAc,QAAQ,CAAA;AACtB,cAAc,WAAW,CAAA;AACzB,cAAc,QAAQ,CAAA;AACtB,cAAc,SAAS,CAAA;AACvB,cAAc,qBAAqB,CAAA;AACnC,cAAc,cAAc,CAAA;AAC5B,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,sBAAsB,CAAA;AACpC,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAA;AACzB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,SAAS,CAAA;AACvB,cAAc,cAAc,CAAA;AAC5B,cAAc,OAAO,CAAA;AACrB,cAAc,SAAS,CAAA;AACvB,cAAc,QAAQ,CAAA;AACtB,cAAc,aAAa,CAAA;AAC3B,cAAc,SAAS,CAAA;AACvB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,WAAW,CAAA"}
|
package/dist/components/index.js
CHANGED
|
@@ -9,7 +9,7 @@ export * from './container';
|
|
|
9
9
|
export * from './datetime';
|
|
10
10
|
export * from './disclosure';
|
|
11
11
|
export * from './drawer';
|
|
12
|
-
export * from './
|
|
12
|
+
export * from './popover';
|
|
13
13
|
export * from './elevator';
|
|
14
14
|
export * from './grid';
|
|
15
15
|
export * from './icon-button';
|
|
@@ -4,6 +4,6 @@ import { Stack, Icon, Title, Text } from '../..';
|
|
|
4
4
|
import styles from './info-state.module.css';
|
|
5
5
|
export const InfoState = forwardRef(({ className, children, title, icon, image, direction = 'column', iconColor = 'blue', actions, ...otherProps }, forwardedRef) => {
|
|
6
6
|
const isHorizontal = direction === 'row';
|
|
7
|
-
return (_jsxs(Stack, { ref: forwardedRef, direction: direction, rowGap: 24, columnGap: 32, className: className,
|
|
7
|
+
return (_jsxs(Stack, { ref: forwardedRef, direction: direction, rowGap: 24, columnGap: 32, className: className, hAlign: isHorizontal ? 'start' : 'center', vAlign: (isHorizontal && image) ? 'center' : 'start', fill: false, wrap: !!image, ...otherProps, children: [(!image && icon) && (_jsx("span", { "data-info-state-icon-color": iconColor, className: styles.IconWrapper, children: _jsx(Icon, { source: icon, dimension: 48 }) })), (image && !icon) && _jsx("img", { className: styles.Image, alt: "", width: "400", src: image, loading: "lazy", decoding: "async" }), _jsxs(Stack, { rowGap: 16, hAlign: isHorizontal ? 'start' : 'center', vAlign: "center", fill: false, children: [_jsx(Title, { maxWidth: "20ch", textAlign: isHorizontal ? 'start' : 'center', level: "4", children: title }), _jsx(Text, { maxWidth: "60ch", dimmed: 6, textAlign: isHorizontal ? 'start' : 'center', children: children }), actions && (_jsx(Stack, { vPadding: 16, inline: true, direction: "row", columnGap: 16, rowGap: 16, wrap: true, children: actions }))] })] }));
|
|
8
8
|
});
|
|
9
9
|
InfoState.displayName = 'InfoState';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-group.d.ts","sourceRoot":"","sources":["../../../src/components/input-group/input-group.tsx"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"input-group.d.ts","sourceRoot":"","sources":["../../../src/components/input-group/input-group.tsx"],"names":[],"mappings":"AACA,OAAO,EAAsD,SAAS,EAAE,MAAM,OAAO,CAAA;AAKrF,oBAAY,eAAe,GAAG,cAAc,GAAG;IAC7C;;OAEG;IACH,KAAK,EAAE,SAAS,CAAC;IACjB;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;OAEG;IACH,GAAG,CAAC,EAAE,SAAS,CAAC;IAChB;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,KAAK,GAAG,SAAS,CAAC;CACzC,CAAA;AAED,eAAO,MAAM,UAAU;IAtBrB;;OAEG;WACI,SAAS;IAChB;;OAEG;YACK,SAAS;IACjB;;OAEG;UACG,SAAS;IACf;;OAEG;YACK,SAAS;IACjB;;OAEG;;uDAgEH,CAAA"}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import clsx from 'clsx';
|
|
3
|
-
import { Children, cloneElement, forwardRef } from 'react';
|
|
3
|
+
import { Children, cloneElement, forwardRef, isValidElement } from 'react';
|
|
4
4
|
import { Stack, Text } from '../..';
|
|
5
5
|
import { useUIDSeed } from 'react-uid';
|
|
6
6
|
import styles from './input-group.module.css';
|
|
7
7
|
export const InputGroup = forwardRef(({ className, input, end, start, label, dimension = 'regular', ...otherProps }, forwardedRef) => {
|
|
8
8
|
const seedID = useUIDSeed();
|
|
9
|
-
return (_jsxs(Stack, { rowGap: 4,
|
|
9
|
+
return (_jsxs(Stack, { rowGap: 4, hAlign: "stretch", vAlign: "start", fill: false, children: [label && _jsx(Text, { as: "label", size: dimension === 'small' ? 14 : 16, htmlFor: seedID('field'), children: label }), _jsxs(Stack, { as: "fieldset", direction: "row", vAlign: "start", hAlign: "start", fill: false, inline: true, ref: forwardedRef, className: clsx(styles.InputGroup, className), "data-input-group-has-end": Boolean(end), "data-input-group-has-start": !!start, ...otherProps, children: [_jsx("div", { className: styles.Start, children: Children.map(start, (child) => isValidElement(child) && cloneElement(child, {
|
|
10
10
|
dimension
|
|
11
|
-
})) }
|
|
11
|
+
})) }), _jsx("div", { className: styles.InputField, children: Children.map(input, (child) => isValidElement(child) && cloneElement(child, {
|
|
12
12
|
id: seedID('field'),
|
|
13
13
|
dimension
|
|
14
|
-
})) }
|
|
14
|
+
})) }), _jsx("div", { className: styles.End, children: Children.map(end, (child) => isValidElement(child) && cloneElement(child, {
|
|
15
15
|
dimension
|
|
16
|
-
})) }
|
|
16
|
+
})) })] })] }));
|
|
17
17
|
});
|
|
18
18
|
InputGroup.displayName = 'InputGroup';
|
|
@@ -6,9 +6,9 @@ import styles from './linear-progress.module.css';
|
|
|
6
6
|
export const LinearProgress = forwardRef(({ className, value, max = 100, dimension = 'regular', showProgress, ...otherProps }, forwardedRef) => {
|
|
7
7
|
const getPercentage = useCallback(() => value ? Math.round((100 * value) / max) : 0, [max, value]);
|
|
8
8
|
const clamp = (num, min, max) => Math.min(Math.max(num, min), max);
|
|
9
|
-
return (_jsxs("div", { className: clsx(styles.LinearProgress, className), children: [_jsx("progress", { role: "progressbar", ref: forwardedRef, className: styles.Progress, "data-progress-dimension": dimension, "aria-valuemin": 0, "aria-valuenow": value, "aria-valuemax": max, value: value, max: max, ...otherProps }
|
|
9
|
+
return (_jsxs("div", { className: clsx(styles.LinearProgress, className), children: [_jsx("progress", { role: "progressbar", ref: forwardedRef, className: styles.Progress, "data-progress-dimension": dimension, "aria-valuemin": 0, "aria-valuenow": value, "aria-valuemax": max, value: value, max: max, ...otherProps }), (showProgress) && (_jsx(Text, { as: "span", className: styles.Percentage, style: {
|
|
10
10
|
'--offset': `${getPercentage()}%`,
|
|
11
11
|
'--translation': value !== 0 ? '-100%' : '-50%'
|
|
12
|
-
}, weight: "bold", size: dimension === 'regular' ? 16 : 18, children: value && clamp(getPercentage(), 0, 100) }
|
|
12
|
+
}, weight: "bold", size: dimension === 'regular' ? 16 : 18, children: value && clamp(getPercentage(), 0, 100) }))] }));
|
|
13
13
|
});
|
|
14
14
|
LinearProgress.displayName = 'LinearProgress';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/list/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,YAAY,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/list/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,YAAY,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AACvC,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { IconProps } from '../..';
|
|
2
|
+
import { PropsWithChildren } from 'react';
|
|
3
|
+
import { ListProps } from './list';
|
|
4
|
+
export declare type ListItemProps = PropsWithChildren<PropsWithClass> & Pick<ListProps, 'dimension' | 'hideMarker'> & {
|
|
5
|
+
/**
|
|
6
|
+
* Set the marker style. You can use any icon from the iconography as marker
|
|
7
|
+
* by passing its name.
|
|
8
|
+
*/
|
|
9
|
+
marker?: IconProps['source'];
|
|
10
|
+
/**
|
|
11
|
+
* Set the color of the marker.
|
|
12
|
+
*/
|
|
13
|
+
markerColor?: string;
|
|
14
|
+
};
|
|
15
|
+
export declare const ListItem: import("react").ForwardRefExoticComponent<PropsWithClass & {
|
|
16
|
+
children?: import("react").ReactNode;
|
|
17
|
+
} & Pick<ListProps, "dimension" | "hideMarker"> & {
|
|
18
|
+
/**
|
|
19
|
+
* Set the marker style. You can use any icon from the iconography as marker
|
|
20
|
+
* by passing its name.
|
|
21
|
+
*/
|
|
22
|
+
marker?: import("packages/icons/dist").IconNames | import("react").ReactElement<HTMLOrSVGElement, string | import("react").JSXElementConstructor<any>> | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* Set the color of the marker.
|
|
25
|
+
*/
|
|
26
|
+
markerColor?: string | undefined;
|
|
27
|
+
} & import("react").RefAttributes<HTMLLIElement>>;
|
|
28
|
+
//# sourceMappingURL=list-item.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-item.d.ts","sourceRoot":"","sources":["../../../src/components/list/list-item.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqB,SAAS,EAAa,MAAM,cAAc,CAAA;AAGtE,OAAO,EAAc,iBAAiB,EAAE,MAAM,OAAO,CAAA;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAElC,oBAAY,aAAa,GAAG,iBAAiB,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC,SAAS,EAAE,WAAW,GAAG,YAAY,CAAC,GAAG;IAC5G;;;OAGG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;IAC7B;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAA;AAED,eAAO,MAAM,QAAQ;;;IAXnB;;;OAGG;;IAEH;;OAEG;;iDA+DH,CAAA"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Stack, Icon, Text } from '../..';
|
|
3
|
+
import styles from './list.module.css';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
import { forwardRef } from 'react';
|
|
6
|
+
export const ListItem = forwardRef(({ className, hideMarker, marker = 'circle', markerColor, children, dimension = 'regular', ...otherProps }, forwardedRef) => {
|
|
7
|
+
const sizes = {
|
|
8
|
+
small: {
|
|
9
|
+
text: 16,
|
|
10
|
+
icon: {
|
|
11
|
+
size: 16,
|
|
12
|
+
weight: 'solid'
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
regular: {
|
|
16
|
+
text: 18,
|
|
17
|
+
icon: {
|
|
18
|
+
size: 16,
|
|
19
|
+
weight: 'outline'
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
big: {
|
|
23
|
+
text: 22,
|
|
24
|
+
icon: {
|
|
25
|
+
size: 24,
|
|
26
|
+
weight: 'duotone'
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
return (_jsxs(Stack, { className: clsx(styles.ListItem, className), as: "li", direction: "row", hAlign: "start", vAlign: "start", fill: false, ref: forwardedRef, ...otherProps, children: [!hideMarker && (_jsx(Icon, { source: marker, className: styles.Marker, fill: markerColor, "data-list-default-marker": marker === 'circle', weight: marker === 'circle' ? 'solid' : sizes[dimension].icon.weight, dimension: marker !== 'circle' ? sizes[dimension].icon.size : 16 })), _jsx(Text, { as: "span", size: sizes[dimension].text, children: children })] }));
|
|
31
|
+
});
|
|
@@ -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"}
|