@wonderflow/react-components 11.0.1 → 11.0.3
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/dist/components/autocomplete/autocomplete.js +2 -2
- package/dist/components/modal/content/modal-content.module.css +1 -1
- package/dist/components/modal/modal.js +1 -1
- package/dist/components/modal/modal.stories.d.ts.map +1 -1
- package/dist/components/modal/modal.stories.js +2 -2
- package/dist/components/overlay-container/overlay-container.js +3 -3
- package/dist/components/tooltip/tooltip.js +2 -2
- package/package.json +3 -3
|
@@ -42,7 +42,7 @@ const AutocompleteAnimation = {
|
|
|
42
42
|
},
|
|
43
43
|
},
|
|
44
44
|
};
|
|
45
|
-
export const Autocomplete = forwardRef(({ children, onChange, disabled, readOnly, value: val, busy, maxHeight = '200px', emptyContent = 'No items to show', root
|
|
45
|
+
export const Autocomplete = forwardRef(({ children, onChange, disabled, readOnly, value: val, busy, maxHeight = '200px', emptyContent = 'No items to show', root, ...otherProps }, forwardedRef) => {
|
|
46
46
|
const seedID = useUIDSeed();
|
|
47
47
|
const autocompleteRef = useRef(null);
|
|
48
48
|
const [isOpen, setIsOpen] = useState(false);
|
|
@@ -111,7 +111,7 @@ export const Autocomplete = forwardRef(({ children, onChange, disabled, readOnly
|
|
|
111
111
|
? _jsx(Stack, { hPadding: 8, as: "span", children: _jsx(Skeleton, { count: 3 }) })
|
|
112
112
|
: Children.map(filteredOptions, child => isValidElement(child) && cloneElement(child, {
|
|
113
113
|
onClick: handleOptionClick,
|
|
114
|
-
}))] }) }) }) }) }), root)] }));
|
|
114
|
+
}))] }) }) }) }) }), root ?? document.body)] }));
|
|
115
115
|
});
|
|
116
116
|
Autocomplete.Option = AutocompleteOption;
|
|
117
117
|
Autocomplete.displayName = 'Autocomplete';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer components{.Content{-webkit-overflow-scrolling:touch;background-color:var(--global-background);overflow:auto;overscroll-behavior:contain;padding:1.5rem}.Content[data-center-vertically=true]{margin:auto}@media (min-width:48em){.Content{margin:0;min-height:auto}}}
|
|
1
|
+
@layer components{.Content{-webkit-overflow-scrolling:touch;background-color:var(--global-background);overflow:auto;overscroll-behavior:contain;padding:1.5rem}.Content[data-center-vertically=true]{margin-bottom:auto;margin-top:auto}@media (min-width:48em){.Content{margin:0;min-height:auto}}}
|
|
@@ -51,7 +51,7 @@ export const Modal = forwardRef(({ children, className, size = 'medium', theme =
|
|
|
51
51
|
},
|
|
52
52
|
},
|
|
53
53
|
}), [matches]);
|
|
54
|
-
return (_jsx(_Fragment, { children: isVisible && (_jsx(OverlayContainer, { onClose: onCloseModal, overlayColor: otherProps.overlayColor, root: otherProps.root, index: otherProps.index, obfuscate: otherProps.obfuscate, children: _jsx("div", { "aria-modal": "true", "aria-labelledby": (typeof title === 'string') ? title : 'modal-label', className: clsx(styles.Modal, className), ref: forwardedRef, ...otherProps, children: _jsx(FocusOn, { onClickOutside: preventCloseOnClickOutside ? undefined : onCloseModal, onEscapeKey: onCloseModal, children: _jsx(LazyMotion, { features: domMax, children: _jsx(m.div, { role: "dialog", variants: ModalAnimation, initial: "hidden", animate: "visible", exit: "hidden", className: styles.Container, children: _jsx(Elevator, { resting: 4, children: _jsx("div", { className: clsx(styles.Main, className), ref: forwardedRef, "data-theme": theme, "data-size": size, ...otherProps, children: children ?? (_jsxs(_Fragment, { children: [_jsxs(Modal.Header, { hideCloseButton: hideCloseButton, theme: theme, hideBorder: (!title ?? !subtitle) || hideHeaderBorder, children: [title && _jsx(Title, { level: "5", children: title }), (title && subtitle) && _jsx(Text, { size: 14, children: subtitle })] }), content && (_jsx(Modal.Content, { theme: theme, alignContentCenter: isLoading
|
|
54
|
+
return (_jsx(_Fragment, { children: isVisible && (_jsx(OverlayContainer, { onClose: onCloseModal, overlayColor: otherProps.overlayColor, root: otherProps.root, index: otherProps.index, obfuscate: otherProps.obfuscate, children: _jsx("div", { "aria-modal": "true", "aria-labelledby": (typeof title === 'string') ? title : 'modal-label', className: clsx(styles.Modal, className), ref: forwardedRef, ...otherProps, children: _jsx(FocusOn, { onClickOutside: preventCloseOnClickOutside ? undefined : onCloseModal, onEscapeKey: onCloseModal, children: _jsx(LazyMotion, { features: domMax, children: _jsx(m.div, { role: "dialog", variants: ModalAnimation, initial: "hidden", animate: "visible", exit: "hidden", className: styles.Container, children: _jsx(Elevator, { resting: 4, children: _jsx("div", { className: clsx(styles.Main, className), ref: forwardedRef, "data-theme": theme, "data-size": size, ...otherProps, children: children ?? (_jsxs(_Fragment, { children: [_jsxs(Modal.Header, { hideCloseButton: hideCloseButton, theme: theme, hideBorder: (!title ?? !subtitle) || hideHeaderBorder, children: [title && _jsx(Title, { level: "5", children: title }), (title && subtitle) && _jsx(Text, { size: 14, children: subtitle })] }), content && (_jsx(Modal.Content, { theme: theme, alignContentCenter: isLoading ? true : alignContentCenter, children: isLoading
|
|
55
55
|
? (_jsx(Stack, { fill: true, hAlign: "center", vPadding: 64, children: _jsxs(Stack, { hAlign: "center", vAlign: "center", rowGap: 16, children: [_jsx(Spinner, { dimension: "big" }), _jsx(Text, { size: "16", dimmed: 5, children: "Loading..." })] }) }))
|
|
56
56
|
: content })), hasActions && (_jsx(Modal.Footer, { theme: theme, hideBorder: hideFooterBorder, children: _jsxs(Stack, { direction: matches.small ? 'row' : 'column-reverse', rowGap: matches.small ? undefined : '16', fill: false, hAlign: (alignActionCenter && matches.small) ? 'center' : 'space-between', vAlign: "center", columnGap: 16, children: [_jsx(Stack, { direction: "row", fill: true, children: tertiaryAction }), _jsxs(Stack, { direction: matches.small ? 'row' : 'column-reverse', rowGap: matches.small ? undefined : '16', columnGap: 16, children: [secondaryAction
|
|
57
57
|
&& isValidElement(secondaryAction)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modal.stories.d.ts","sourceRoot":"","sources":["../../../src/components/modal/modal.stories.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAQjE,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A2B,CAAC;AA4DjD,eAAO,MAAM,kBAAkB;;;;EAA2B,CAAC;AAS3D,eAAO,MAAM,cAAc;;;;EAA2B,CAAC;AAqBvD,eAAO,MAAM,YAAY;;;;EAA2B,CAAC;AA+CrD,eAAO,MAAM,MAAM;;;;EAA0B,CAAC"}
|
|
@@ -114,8 +114,8 @@ WithImage.args = {
|
|
|
114
114
|
primaryAction: _jsx(Button, { children: "Primary" }),
|
|
115
115
|
secondaryAction: _jsx(Button, { children: "Secondary" }),
|
|
116
116
|
};
|
|
117
|
-
const formWithin = (_jsxs(Stack, { rowGap: 24, children: [_jsxs(Stack, { direction: "row", columnGap: 24, children: [_jsx(Textfield, { label: "Label", placeHolder: "Sample value" }), _jsx(Textfield, { label: "Label", placeHolder: "Sample value" })] }), _jsx(Textfield, { label: "Label", placeHolder: "Sample value" })] }));
|
|
118
|
-
const withTabsContent = (_jsxs(Tab, { defaultValue: "1", dimension: "regular", children: [_jsx(Tab.Panel, { value: "1", label: "Tab 1", children:
|
|
117
|
+
const formWithin = (_jsxs(Stack, { rowGap: 24, style: { marginTop: '24px' }, children: [_jsxs(Stack, { direction: "row", columnGap: 24, children: [_jsx(Textfield, { label: "Label", placeHolder: "Sample value" }), _jsx(Textfield, { label: "Label", placeHolder: "Sample value" })] }), _jsx(Textfield, { label: "Label", placeHolder: "Sample value" })] }));
|
|
118
|
+
const withTabsContent = (_jsxs(Tab, { defaultValue: "1", dimension: "regular", children: [_jsx(Tab.Panel, { value: "1", label: "Tab 1", children: formWithin }), _jsx(Tab.Panel, { value: "2", label: "Tab 2", children: formWithin }), _jsx(Tab.Panel, { value: "3", label: "Tab 3", children: formWithin })] }));
|
|
119
119
|
export const WithTabs = DefaultTemplate.bind({});
|
|
120
120
|
WithTabs.args = {
|
|
121
121
|
title: 'Modal title',
|
|
@@ -20,13 +20,13 @@ import { createPortal } from 'react-dom';
|
|
|
20
20
|
import { useUIDSeed } from 'react-uid';
|
|
21
21
|
import { OverlayProvider } from '../..';
|
|
22
22
|
import * as styles from './overlay-container.module.css';
|
|
23
|
-
export const OverlayContainer = ({ children, root
|
|
23
|
+
export const OverlayContainer = ({ children, root, overlayColor = 'dark', index = 4, obfuscate = true, onClose, }) => {
|
|
24
24
|
const seedID = useUIDSeed();
|
|
25
25
|
useEffect(() => {
|
|
26
|
-
if (root
|
|
26
|
+
if (root?.closest('[data-overlay-container]')) {
|
|
27
27
|
throw new Error('An OverlayContainer must not be inside another container. Please change the root prop.');
|
|
28
28
|
}
|
|
29
29
|
}, [root]);
|
|
30
30
|
const content = (_jsx(OverlayProvider, { onClose: onClose, children: _jsx(AnimatePresence, { exitBeforeEnter: true, children: children && (_jsx("div", { "data-overlay-container": true, "data-overlay-container-obfuscate": obfuscate, className: styles.OverlayContainer, style: { zIndex: index }, children: _jsxs(LazyMotion, { features: domMax, children: [obfuscate && (_jsx(m.span, { className: styles.Backdrop, "data-overlay-color": overlayColor, initial: { opacity: 0 }, animate: { opacity: 0.95 }, transition: { duration: 0.2 }, exit: { opacity: 0 } }, seedID('modal-backdrop'))), children] }) })) }) }));
|
|
31
|
-
return createPortal(content, root);
|
|
31
|
+
return createPortal(content, root ?? document.body);
|
|
32
32
|
};
|
|
@@ -6,7 +6,7 @@ import { usePopperTooltip } from 'react-popper-tooltip';
|
|
|
6
6
|
import { useUIDSeed } from 'react-uid';
|
|
7
7
|
import { Elevator } from '../..';
|
|
8
8
|
import * as styles from './tooltip.module.css';
|
|
9
|
-
export const Tooltip = ({ children, trigger, placement = 'bottom-start', open, style, maxWidth = '40ch', fill = false, interactive = false, delay = 500, root
|
|
9
|
+
export const Tooltip = ({ children, trigger, placement = 'bottom-start', open, style, maxWidth = '40ch', fill = false, interactive = false, delay = 500, root, }) => {
|
|
10
10
|
const [isOpen, setIsOpen] = useState(false);
|
|
11
11
|
const seedID = useUIDSeed();
|
|
12
12
|
const id = seedID('tooltip-content');
|
|
@@ -43,5 +43,5 @@ export const Tooltip = ({ children, trigger, placement = 'bottom-start', open, s
|
|
|
43
43
|
ref: setTriggerRef,
|
|
44
44
|
tabIndex: 0,
|
|
45
45
|
'aria-describedby': id,
|
|
46
|
-
})), visible && createPortal(_jsx(Elevator, { resting: 1, children: _jsxs("div", { ref: setTooltipRef, role: "tooltip", id: id, "data-theme": "dark", ...getTooltipProps({ className: styles.Balloon, style: dynamycStyle }), children: [children, _jsx("div", { ...getArrowProps({ className: styles.Arrow }) })] }) }), root)] }));
|
|
46
|
+
})), visible && createPortal(_jsx(Elevator, { resting: 1, children: _jsxs("div", { ref: setTooltipRef, role: "tooltip", id: id, "data-theme": "dark", ...getTooltipProps({ className: styles.Balloon, style: dynamycStyle }), children: [children, _jsx("div", { ...getArrowProps({ className: styles.Arrow }) })] }) }), root ?? document.body)] }));
|
|
47
47
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wonderflow/react-components",
|
|
3
|
-
"version": "11.0.
|
|
3
|
+
"version": "11.0.3",
|
|
4
4
|
"description": "UI components from Wonderflow's Wanda design system",
|
|
5
5
|
"author": "Wonderflow",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -82,8 +82,8 @@
|
|
|
82
82
|
"@types/react-dom": "17.0.14",
|
|
83
83
|
"@types/react-table": "7.7.12",
|
|
84
84
|
"@types/react-test-renderer": "18.0.0",
|
|
85
|
-
"@wonderflow/config": "11.0.
|
|
86
|
-
"@wonderflow/tokens": "11.0.
|
|
85
|
+
"@wonderflow/config": "11.0.3",
|
|
86
|
+
"@wonderflow/tokens": "11.0.3",
|
|
87
87
|
"babel-loader": "8.2.5",
|
|
88
88
|
"cpy-cli": "3.1.1",
|
|
89
89
|
"postcss": "8.4.17",
|