@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
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
|
|
|
@@ -2,11 +2,6 @@ import { MenuItemProps } from '../..';
|
|
|
2
2
|
import { PropsWithChildren } from 'react';
|
|
3
3
|
import { Except } from 'type-fest';
|
|
4
4
|
export declare type AutocompleteOptionProps = PropsWithChildren<PropsWithClass> & Except<MenuItemProps, 'padding' | 'autoFocus' | 'description' | 'onClick'> & {
|
|
5
|
-
/**
|
|
6
|
-
* Value of the option.
|
|
7
|
-
* This is the value that will be passed to the `onChange` callback.
|
|
8
|
-
*/
|
|
9
|
-
value: string;
|
|
10
5
|
/**
|
|
11
6
|
* Callback called when the option is clicked.
|
|
12
7
|
* It passes the value and the inner text of the option as arguments.
|
|
@@ -21,11 +16,6 @@ export declare type AutocompleteOptionProps = PropsWithChildren<PropsWithClass>
|
|
|
21
16
|
export declare const AutocompleteOption: import("react").ForwardRefExoticComponent<PropsWithClass & {
|
|
22
17
|
children?: import("react").ReactNode;
|
|
23
18
|
} & Except<MenuItemProps, "padding" | "autoFocus" | "description" | "onClick"> & {
|
|
24
|
-
/**
|
|
25
|
-
* Value of the option.
|
|
26
|
-
* This is the value that will be passed to the `onChange` callback.
|
|
27
|
-
*/
|
|
28
|
-
value: string;
|
|
29
19
|
/**
|
|
30
20
|
* Callback called when the option is clicked.
|
|
31
21
|
* It passes the value and the inner text of the option as arguments.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autocomplete-option.d.ts","sourceRoot":"","sources":["../../../src/components/autocomplete/autocomplete-option.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAQ,aAAa,EAAE,MAAM,cAAc,CAAA;AAClD,OAAO,EAAE,iBAAiB,EAAmC,MAAM,OAAO,CAAA;AAC1E,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAElC,oBAAY,uBAAuB,GAAG,iBAAiB,CAAC,cAAc,CAAC,GAAG,MAAM,CAC9E,aAAa,EACb,SAAS,GAAG,WAAW,GAAG,aAAa,GAAG,SAAS,CACpD,GAAG;IACF;;;OAGG;IACH,
|
|
1
|
+
{"version":3,"file":"autocomplete-option.d.ts","sourceRoot":"","sources":["../../../src/components/autocomplete/autocomplete-option.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAQ,aAAa,EAAE,MAAM,cAAc,CAAA;AAClD,OAAO,EAAE,iBAAiB,EAAmC,MAAM,OAAO,CAAA;AAC1E,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAElC,oBAAY,uBAAuB,GAAG,iBAAiB,CAAC,cAAc,CAAC,GAAG,MAAM,CAC9E,aAAa,EACb,SAAS,GAAG,WAAW,GAAG,aAAa,GAAG,SAAS,CACpD,GAAG;IACF;;;OAGG;IACH,OAAO,CAAC,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjD;;;OAGG;IACH,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAC7B,CAAA;AAED,eAAO,MAAM,kBAAkB;;;IAZ7B;;;OAGG;wEACyC,IAAI;IAChD;;;OAGG;cACO,MAAM,GAAG,MAAM,EAAE;qDA6B3B,CAAA"}
|
|
@@ -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, { value: value, 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,6 +1,7 @@
|
|
|
1
1
|
import { AutocompleteOptionProps } from './autocomplete-option';
|
|
2
2
|
import { ForwardRefExoticComponent, ReactNode } from 'react';
|
|
3
3
|
import { TextfieldProps } from '../..';
|
|
4
|
+
import { MenuProps } from '../menu';
|
|
4
5
|
export declare type AutocompleteProps = TextfieldProps & {
|
|
5
6
|
/**
|
|
6
7
|
* The callback called when an option is picked from the list
|
|
@@ -10,12 +11,13 @@ export declare type AutocompleteProps = TextfieldProps & {
|
|
|
10
11
|
* Set the maximum height of the options list after which
|
|
11
12
|
* it will scroll.
|
|
12
13
|
*/
|
|
13
|
-
maxHeight?:
|
|
14
|
+
maxHeight?: MenuProps['maxHeight'];
|
|
14
15
|
/**
|
|
15
|
-
* Custom empty
|
|
16
|
+
* Custom empty content to display when there are no options or
|
|
16
17
|
* when the value does not match any of the options.
|
|
17
18
|
*/
|
|
18
|
-
|
|
19
|
+
emptyContent?: ReactNode;
|
|
20
|
+
busy?: boolean;
|
|
19
21
|
};
|
|
20
22
|
declare type AutocompleteComponent = ForwardRefExoticComponent<AutocompleteProps> & {
|
|
21
23
|
Option: ForwardRefExoticComponent<AutocompleteOptionProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autocomplete.d.ts","sourceRoot":"","sources":["../../../src/components/autocomplete/autocomplete.tsx"],"names":[],"mappings":"AACA,OAAO,EAAsB,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AACnF,OAAO,EACK,yBAAyB,
|
|
1
|
+
{"version":3,"file":"autocomplete.d.ts","sourceRoot":"","sources":["../../../src/components/autocomplete/autocomplete.tsx"],"names":[],"mappings":"AACA,OAAO,EAAsB,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AACnF,OAAO,EACK,yBAAyB,EAEd,SAAS,EAC/B,MAAM,OAAO,CAAA;AAEd,OAAO,EAAyB,cAAc,EAAmB,MAAM,cAAc,CAAA;AAIrF,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAEnC,oBAAY,iBAAiB,GAAG,cAAc,GAAG;IAC/C;;OAEG;IACH,QAAQ,CAAC,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IACnC;;;OAGG;IACH,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,aAAK,qBAAqB,GAAG,yBAAyB,CAAC,iBAAiB,CAAC,GAAG;IAC1E,MAAM,EAAE,yBAAyB,CAAC,uBAAuB,CAAC,CAAC;CAC5D,CAAA;AAqBD,eAAO,MAAM,YAAY,uBA8IE,CAAA"}
|
|
@@ -1,9 +1,9 @@
|
|
|
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 { AutocompleteOption } from './autocomplete-option';
|
|
4
4
|
import { Children, cloneElement, forwardRef, useCallback, useMemo, useRef, useState, useEffect, isValidElement } from 'react';
|
|
5
5
|
import { useDebounce, useFocusWithin, useKeyPress, useSize } from 'ahooks';
|
|
6
|
-
import { Text, Menu, Textfield } from '../..';
|
|
6
|
+
import { Text, Menu, Textfield, Skeleton, Stack } from '../..';
|
|
7
7
|
import styles from './autocomplete.module.css';
|
|
8
8
|
import { usePopperTooltip } from 'react-popper-tooltip';
|
|
9
9
|
import { useUIDSeed } from 'react-uid';
|
|
@@ -25,7 +25,7 @@ const AutocompleteAnimation = {
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
|
-
export const Autocomplete = forwardRef(({ children, onChange, disabled, readOnly, value, maxHeight = '200px',
|
|
28
|
+
export const Autocomplete = forwardRef(({ children, onChange, disabled, readOnly, value, busy, maxHeight = '200px', emptyContent = 'No items to show', ...otherProps }, forwardedRef) => {
|
|
29
29
|
const seedID = useUIDSeed();
|
|
30
30
|
const autocompleteRef = useRef(forwardedRef);
|
|
31
31
|
const [isOpen, setIsOpen] = useState(false);
|
|
@@ -65,17 +65,16 @@ export const Autocomplete = forwardRef(({ children, onChange, disabled, readOnly
|
|
|
65
65
|
const handleFilter = useCallback(({ currentTarget }) => {
|
|
66
66
|
setContent(currentTarget.value);
|
|
67
67
|
}, []);
|
|
68
|
-
const dynamicStyle = {
|
|
69
|
-
'--max-h': maxHeight
|
|
70
|
-
};
|
|
71
68
|
useEffect(() => {
|
|
72
69
|
value && setContent(String(value));
|
|
73
70
|
}, [value]);
|
|
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(
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
71
|
+
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(LazyMotion, { features: domMax, strict: true, children: _jsx(m.div, { variants: AutocompleteAnimation, initial: "hidden", animate: "visible", exit: "hidden", children: _jsx(Menu, { role: "listbox", id: seedID('autocomplete-menu'), className: styles.OptionsList, maxHeight: maxHeight, "aria-labelledby": seedID('autocomplete-trigger'), children: (filteredOptions.length === 0 && !busy)
|
|
72
|
+
? _jsx(Text, { as: "div", textAlign: "center", dimmed: 5, children: emptyContent })
|
|
73
|
+
: busy
|
|
74
|
+
? _jsx(Stack, { hPadding: 8, as: "li", children: _jsx(Skeleton, { count: 3 }) })
|
|
75
|
+
: Children.map(filteredOptions, (child) => isValidElement(child) && cloneElement(child, {
|
|
76
|
+
onClick: handleOptionClick
|
|
77
|
+
})) }) }) }) })) })] }));
|
|
79
78
|
});
|
|
80
79
|
Autocomplete.Option = AutocompleteOption;
|
|
81
80
|
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';
|
|
@@ -15,9 +15,9 @@ export const Button = forwardRef(({ kind = 'primary', dimension = 'regular', cla
|
|
|
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, weight: "solid", 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
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}
|
|
@@ -9,5 +9,5 @@ export const Card = forwardRef(({ as: Wrapper = 'div', children, className, padd
|
|
|
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, vAlign: vAlign, hAlign: hAlign, columnGap: columnGap, rowGap: rowGap, wrap: wrap, children: [left && _jsx("div", { className: styles.Left, children: left }
|
|
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
|
});
|
|
@@ -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), vAlign: "center", ref: forwardedRef, ...otherProps, children: [_jsx("b", { children: children }
|
|
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,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,7 +3,7 @@ export declare type ContainerProps = {
|
|
|
3
3
|
/**
|
|
4
4
|
* Set the horizontal max-width of the container.
|
|
5
5
|
*/
|
|
6
|
-
dimension?: 'full' | 'medium' | 'large';
|
|
6
|
+
dimension?: 'full' | 'small' | 'medium' | 'large';
|
|
7
7
|
/**
|
|
8
8
|
* Set or remove the container's predefined horizontal padding.
|
|
9
9
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../../../src/components/container/container.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAI1C,oBAAY,cAAc,GAAG;IAC3B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../../../src/components/container/container.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAI1C,oBAAY,cAAc,GAAG;IAC3B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IAClD;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAA;AAED,aAAK,oBAAoB,GAAG,WAAW,CAAC,mBAAmB,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC;AAEnF,eAAO,MAAM,SAAS,sBAmBI,CAAA"}
|
|
@@ -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
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.Container{inline-size:100%;margin:0 auto;padding:0 .89rem}.Container[data-container-dimension=
|
|
1
|
+
.Container{inline-size:100%;margin:0 auto;padding:0 .89rem}.Container[data-container-dimension=small]{max-inline-size:35.56rem}@media (min-width:48em){.Container[data-container-dimension=small]{padding:0 1.78rem}}.Container[data-container-dimension=medium]{max-inline-size:55.56rem}@media (min-width:48em){.Container[data-container-dimension=medium]{padding:0 1.78rem}}.Container[data-container-dimension=large]{max-inline-size:80rem}@media (min-width:48em){.Container[data-container-dimension=large]{padding:0 1.78rem}}.Container[data-container-dimension=full]{max-inline-size:100%}@media (min-width:48em){.Container[data-container-dimension=full]{padding:0 1.78rem}}.Container[data-container-padding=false]{padding:0}
|
|
@@ -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
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"disclosure.d.ts","sourceRoot":"","sources":["../../../src/components/disclosure/disclosure.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,qBAAqB,EACrB,SAAS,EACV,MAAM,OAAO,CAAA;AAMd,oBAAY,eAAe,GAAG,qBAAqB,CAAC,kBAAkB,CAAC,GAAG;IACxE;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;OAGG;IACH,OAAO,EAAE,SAAS,CAAC;IACnB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,KAAK,CAAC;IACxC;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAChC;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAA;AAED,eAAO,MAAM,UAAU;IAnCrB;;OAEG;;IAEH;;;OAGG;aACM,SAAS;IAClB;;;;OAIG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;;OAGG;;IAEH;;;OAGG;;
|
|
1
|
+
{"version":3,"file":"disclosure.d.ts","sourceRoot":"","sources":["../../../src/components/disclosure/disclosure.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,qBAAqB,EACrB,SAAS,EACV,MAAM,OAAO,CAAA;AAMd,oBAAY,eAAe,GAAG,qBAAqB,CAAC,kBAAkB,CAAC,GAAG;IACxE;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;OAGG;IACH,OAAO,EAAE,SAAS,CAAC;IACnB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,KAAK,CAAC;IACxC;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAChC;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAA;AAED,eAAO,MAAM,UAAU;IAnCrB;;OAEG;;IAEH;;;OAGG;aACM,SAAS;IAClB;;;;OAIG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;;OAGG;;IAEH;;;OAGG;;sDAuGH,CAAA"}
|
|
@@ -3,7 +3,7 @@ import { forwardRef, useCallback, useEffect, useRef, useState } from 'react';
|
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import styles from './disclosure.module.css';
|
|
5
5
|
import { Text, Icon } from '../..';
|
|
6
|
-
import {
|
|
6
|
+
import { domMax, LazyMotion, m } from 'framer-motion';
|
|
7
7
|
export const Disclosure = forwardRef(({ children, open = false, padding = true, className, summary, contentMaxHeight, dimension = 'regular', iconPosition = 'left', expandable = true, style, ...otherProps }, forwardedRef) => {
|
|
8
8
|
const ref = useRef(forwardedRef);
|
|
9
9
|
const [isOpen, setIsOpen] = useState(open);
|
|
@@ -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(
|
|
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(LazyMotion, { features: domMax, children: _jsx(m.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}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawer.d.ts","sourceRoot":"","sources":["../../../src/components/drawer/drawer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA6B,iBAAiB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAQ/E,oBAAY,WAAW,GAAG,iBAAiB,CAAC,cAAc,CAAC,GAAG;IAC5D;;;;;;OAMG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;IAClC;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACxB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAA;AAED,eAAO,MAAM,MAAM;;;IAzCjB;;;;;;OAMG;;IAEH;;;OAGG;YACK,SAAS;IACjB;;;;OAIG;;IAEH;;;OAGG;;IAEH;;;OAGG;;IAEH;;OAEG;;IAEH;;;;OAIG;;
|
|
1
|
+
{"version":3,"file":"drawer.d.ts","sourceRoot":"","sources":["../../../src/components/drawer/drawer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA6B,iBAAiB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAQ/E,oBAAY,WAAW,GAAG,iBAAiB,CAAC,cAAc,CAAC,GAAG;IAC5D;;;;;;OAMG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;IAClC;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACxB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAA;AAED,eAAO,MAAM,MAAM;;;IAzCjB;;;;;;OAMG;;IAEH;;;OAGG;YACK,SAAS;IACjB;;;;OAIG;;IAEH;;;OAGG;;IAEH;;;OAGG;;IAEH;;OAEG;;IAEH;;;;OAIG;;kDA8FH,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } 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, AutoFocusInside } from 'react-focus-on';
|
|
6
6
|
import { useKeyPress } from 'ahooks';
|
|
@@ -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(
|
|
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(LazyMotion, { features: domMax, children: _jsx(m.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';
|
|
@@ -4,5 +4,5 @@ export const Elevator = ({ children, resting, hover }) => {
|
|
|
4
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
|
};
|
|
@@ -13,7 +13,7 @@ export const Grid = forwardRef(({ className, children, columns, rows, rowGap, co
|
|
|
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;
|
|
@@ -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 | 24 | 32 | 40 | 48 | 56 | 12 | 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, 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 }
|
|
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';
|
|
@@ -6,13 +6,13 @@ 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, hAlign: "stretch", vAlign: "start", fill: false, children: [label && _jsx(Text, { as: "label", size: dimension === 'small' ? 14 : 16, htmlFor: seedID('field'), children: label }
|
|
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
|
+
});
|