@wonderflow/react-components 12.0.0 → 12.1.1
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.d.ts.map +1 -1
- package/dist/components/autocomplete/autocomplete.js +3 -2
- package/dist/components/button/button.module.css +1 -1
- package/dist/components/chip/chip.module.css +1 -1
- package/dist/components/drawer/drawer.module.css +1 -1
- package/dist/components/menu/menu-item/menu-item.js +1 -1
- package/dist/components/overlay-container/overlay-container.d.ts.map +1 -1
- package/dist/components/overlay-container/overlay-container.js +2 -1
- package/dist/components/pagination/pagination.module.css +1 -1
- package/dist/components/popover/popover.d.ts.map +1 -1
- package/dist/components/popover/popover.js +2 -1
- package/dist/components/snackbar/snackbar.js +2 -2
- package/dist/components/snackbar/snackbar.module.css +1 -1
- package/dist/components/tab/tab.js +1 -1
- package/dist/components/tab/tab.module.css +1 -1
- package/dist/components/text/text.stories.d.ts.map +1 -1
- package/dist/components/text/text.stories.js +2 -2
- package/dist/components/tooltip/tooltip.d.ts.map +1 -1
- package/dist/components/tooltip/tooltip.js +2 -1
- package/dist/components/tooltip/tooltip.module.css +1 -1
- package/dist/utils/browser.d.ts +2 -0
- package/dist/utils/browser.d.ts.map +1 -0
- package/dist/utils/browser.js +18 -0
- package/dist/utils/browser.test.d.ts +2 -0
- package/dist/utils/browser.test.d.ts.map +1 -0
- package/dist/utils/browser.test.js +7 -0
- package/dist/utils/convertions.test.js +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autocomplete.d.ts","sourceRoot":"","sources":["../../../src/components/autocomplete/autocomplete.tsx"],"names":[],"mappings":"AAuBA,OAAO,EAC+B,yBAAyB,EAG7D,SAAS,EAEV,MAAM,OAAO,CAAC;AAMf,OAAO,EAEM,cAAc,EAC1B,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"autocomplete.d.ts","sourceRoot":"","sources":["../../../src/components/autocomplete/autocomplete.tsx"],"names":[],"mappings":"AAuBA,OAAO,EAC+B,yBAAyB,EAG7D,SAAS,EAEV,MAAM,OAAO,CAAC;AAMf,OAAO,EAEM,cAAc,EAC1B,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAiB,SAAS,EAAE,MAAM,SAAS,CAAC;AAEnD,OAAO,EAAsB,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAEpF,aAAK,SAAS,GAAG;IACf,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAAA;AAED,oBAAY,iBAAiB,GAAG,cAAc,CAAC,cAAc,CAAC;IAC5D;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;IACtC;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IACnC;;;OAGG;IACH,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;OAEG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC;CACpB,CAAC,CAAC,CAAC;AAEJ,aAAK,qBAAqB,GAAG,yBAAyB,CAAC,iBAAiB,CAAC,GAAG;IAC1E,MAAM,EAAE,yBAAyB,CAAC,uBAAuB,CAAC,CAAC;CAC5D,CAAA;AAqBD,eAAO,MAAM,YAAY,uBAyKE,CAAC"}
|
|
@@ -22,6 +22,7 @@ import { mergeRefs } from 'react-merge-refs';
|
|
|
22
22
|
import { usePopperTooltip } from 'react-popper-tooltip';
|
|
23
23
|
import { useUIDSeed } from 'react-uid';
|
|
24
24
|
import { Menu, Skeleton, Stack, Text, Textfield, } from '../..';
|
|
25
|
+
import { isBrowser } from '../../utils/browser';
|
|
25
26
|
import * as styles from './autocomplete.module.css';
|
|
26
27
|
import { AutocompleteOption } from './autocomplete-option';
|
|
27
28
|
const AutocompleteAnimation = {
|
|
@@ -63,7 +64,7 @@ export const Autocomplete = forwardRef(({ children, onChange, disabled, readOnly
|
|
|
63
64
|
}, [debounceQuery, children]);
|
|
64
65
|
const isFocusWithin = useFocusWithin(autocompleteRef, {
|
|
65
66
|
onChange: (isFocusWithin) => {
|
|
66
|
-
const m = document.getElementById(seedID('autocomplete-menu'));
|
|
67
|
+
const m = isBrowser() && document.getElementById(seedID('autocomplete-menu'));
|
|
67
68
|
if (isFocusWithin || m) {
|
|
68
69
|
setIsOpen(true);
|
|
69
70
|
}
|
|
@@ -107,7 +108,7 @@ export const Autocomplete = forwardRef(({ children, onChange, disabled, readOnly
|
|
|
107
108
|
setValue(String(val));
|
|
108
109
|
setOptionValues(currentValues);
|
|
109
110
|
}, [filteredOptions, val]);
|
|
110
|
-
return (_jsxs("div", { ref: autocompleteRef, className: styles.Autocomplete, "data-focus-within": isFocusWithin, children: [_jsx(Textfield, { "aria-haspopup": true, "aria-controls": seedID('autocomplete-menu'), "aria-expanded": isOpen, role: "combobox", ref: mergeRefs([setTriggerRef, forwardedRef]), id: seedID('autocomplete-trigger'), onChange: handleFilter, "data-testid": "Autocomplete", "data-current-value": value, value: query, autoComplete: "off", disabled: disabled, readOnly: readOnly, ...otherProps }, seedID('autocomplete-trigger')), visible && createPortal(_jsx(AnimatePresence, { children: _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: _jsxs(Menu, { role: "listbox", id: seedID('autocomplete-menu'), className: styles.OptionsList, maxHeight: maxHeight, "aria-labelledby": seedID('autocomplete-trigger'), children: [(filteredOptions.length === 0 && !busy) && _jsx(Text, { as: "div", textAlign: "center", children: emptyContent }), busy
|
|
111
|
+
return (_jsxs("div", { ref: autocompleteRef, className: styles.Autocomplete, "data-focus-within": isFocusWithin, children: [_jsx(Textfield, { "aria-haspopup": true, "aria-controls": seedID('autocomplete-menu'), "aria-expanded": isOpen, role: "combobox", ref: mergeRefs([setTriggerRef, forwardedRef]), id: seedID('autocomplete-trigger'), onChange: handleFilter, "data-testid": "Autocomplete", "data-current-value": value, value: query, autoComplete: "off", disabled: disabled, readOnly: readOnly, ...otherProps }, seedID('autocomplete-trigger')), isBrowser() && visible && createPortal(_jsx(AnimatePresence, { children: _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: _jsxs(Menu, { role: "listbox", id: seedID('autocomplete-menu'), className: styles.OptionsList, maxHeight: maxHeight, "aria-labelledby": seedID('autocomplete-trigger'), children: [(filteredOptions.length === 0 && !busy) && _jsx(Text, { as: "div", textAlign: "center", children: emptyContent }), busy
|
|
111
112
|
? _jsx(Stack, { hPadding: 8, as: "span", children: _jsx(Skeleton, { count: 3 }) })
|
|
112
113
|
: Children.map(filteredOptions, child => isValidElement(child) && cloneElement(child, {
|
|
113
114
|
onClick: handleOptionClick,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer components{.Button{-webkit-touch-callout:none;grid-gap:.5rem;align-items:center;appearance:none;background:none;border:0;border-radius:.25rem;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;transition:all .1s cubic-bezier(.3,.07,.34,1);-webkit-user-select:none;user-select:none;white-space:nowrap}.Button:not([aria-pressed=true],[aria-disabled=true],[aria-busy=true]):active{transform:scale(.98);transform-origin:center}.Button[data-button-dimension=big]{block-size:3rem;font-size:1rem;line-height:0;padding:.75rem 1.5rem}.Button[data-button-dimension=regular]{block-size:2.
|
|
1
|
+
@layer components{.Button{-webkit-touch-callout:none;grid-gap:.5rem;align-items:center;appearance:none;background:none;border:0;border-radius:.25rem;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;transition:all .1s cubic-bezier(.3,.07,.34,1);-webkit-user-select:none;user-select:none;white-space:nowrap}.Button:not([aria-pressed=true],[aria-disabled=true],[aria-busy=true]):active{transform:scale(.98);transform-origin:center}.Button[data-button-dimension=big]{block-size:3rem;font-size:1rem;line-height:0;padding:.75rem 1.5rem}.Button[data-button-dimension=regular]{block-size:2.25rem;font-size:.875rem;line-height:0;padding:.5rem 1rem}.Button[data-button-dimension=small]{grid-gap:.25rem;block-size:1.5rem;font-size:.875rem;line-height:0;padding:.125rem .5rem}.Button[data-button-kind=primary]{background:var(--cta-default);color:var(--cta-foreground)}.Button[data-button-kind=primary]:where([aria-pressed=true]),.Button[data-button-kind=primary]:where([aria-pressed=true]:hover){background:#9e0018;color:#fff}.Button[data-button-kind=primary]:not([aria-pressed=true],[aria-disabled=true],[aria-busy=true]):is(:hover){background:var(--cta-dark)}.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]:where([aria-pressed=true]),.Button[data-button-kind=secondary]:where([aria-pressed=true]:hover){background:var(--dimmed-7);color:var(--dimmed-0)}.Button[data-button-kind=secondary]:not([aria-pressed=true],[aria-disabled=true],[aria-busy=true]):is(:hover){background-color:var(--global-vibrancy-background-hard);color:var(--global-vibrancy-foreground)}.Button[data-button-kind=flat]{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-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]:not([aria-pressed=true],[aria-disabled=true],[aria-busy=true]):is(:hover){background-color:var(--global-vibrancy-background)}.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;pointer-events:none}.Button[aria-busy=true]{pointer-events:none}.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 +1 @@
|
|
|
1
|
-
@layer components{.Chip{background-color:var(--highlight-gray-background);block-size:
|
|
1
|
+
@layer components{.Chip{background-color:var(--highlight-gray-background);block-size:1.75rem;border-radius:3rem;color:var(--highlight-gray-foreground);font-size:.875rem;font-weight:600;overflow:hidden;padding:.25rem .5rem;white-space:nowrap}.Chip[data-chip-dimension=small]{block-size:1.5rem;font-size:.75rem}.Chip[data-chip-dimension=big]{block-size:2rem;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)}.Chip[data-chip-color=magenta]{background-color:var(--highlight-magenta-background);color:var(--highlight-magenta-foreground)}.Chip[data-chip-color=violet]{background-color:var(--highlight-violet-background);color:var(--highlight-violet-foreground)}.Chip[data-chip-color=indigo]{background-color:var(--highlight-indigo-background);color:var(--highlight-indigo-foreground)}.Chip[data-chip-color=mint]{background-color:var(--highlight-mint-background);color:var(--highlight-mint-foreground)}.Chip[data-chip-color=dipsy]{background-color:var(--highlight-dipsy-background);color:var(--highlight-dipsy-foreground)}.Chip[data-chip-color=salmon]{background-color:var(--highlight-salmon-background);color:var(--highlight-salmon-foreground)}.Action{appearance:none;background:none;border:0;color:inherit;cursor:pointer;display:inline-flex;font:inherit;margin-top:1px;padding:0}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer components{.Drawer{display:contents}.Container{align-items:stretch;bottom:0;display:grid;left:0;pointer-events:none;position:absolute;right:0;top:0}.Container[data-drawer-side=right]{justify-content:flex-end}.Container[data-drawer-side=left]{justify-content:flex-start}.Container>*{pointer-events:auto}.Content{-webkit-overflow-scrolling:touch;background-color:var(--global-background);inline-size:100vw;max-inline-size:var(--max-w);overflow:auto;overscroll-behavior:contain}.Header{background-color:inherit;border-bottom:1px solid var(--dimmed-1);padding:1rem calc(env(safe-area-inset-top) + 1rem)
|
|
1
|
+
@layer components{.Drawer{display:contents}.Container{align-items:stretch;bottom:0;display:grid;left:0;pointer-events:none;position:absolute;right:0;top:0}.Container[data-drawer-side=right]{justify-content:flex-end}.Container[data-drawer-side=left]{justify-content:flex-start}.Container>*{pointer-events:auto}.Content{-webkit-overflow-scrolling:touch;background-color:var(--global-background);inline-size:100vw;max-inline-size:var(--max-w);overflow:auto;overscroll-behavior:contain}.Header{background-color:inherit;border-bottom:1px solid var(--dimmed-1);padding:1rem calc(env(safe-area-inset-top) + 1rem) 1rem 1.5rem;position:sticky;top:0;z-index:1}}@layer overrides{.CloseButton{flex-grow:0}}
|
|
@@ -32,7 +32,7 @@ export const MenuItem = forwardRef(({ className, children, subtext, onClick, ico
|
|
|
32
32
|
onClick(e, value);
|
|
33
33
|
}
|
|
34
34
|
}, [handleClick, onClick, value]);
|
|
35
|
-
const InnerContent = useMemo(() => (_jsxs(Stack, { direction: isIconRight ? 'row-reverse' : 'row', as: "span", fill: false, className: styles.ItemContent, hAlign: isIconRight ? 'space-between' : 'start', vAlign: "center", columnGap: 8, hPadding: 16, vPadding: 8, "data-menu-item-icon-right": isIconRight, "data-menu-item-has-icon": Boolean(icon), "data-menu-item-padding": padding, style: { inlineSize: '100%' }, children: [icon && (_jsx(Symbol, { className: styles.Icon, source: icon, dimension: dimension === 'small' ? 12 : 16 })), _jsxs(Stack, { className: styles.DecorationContent, columnGap: 16, fill: false, direction: "row", hAlign: "space-between", children: [_jsxs(Stack, { direction: "column", children: [children, subtext && _jsx(Text, { variant:
|
|
35
|
+
const InnerContent = useMemo(() => (_jsxs(Stack, { direction: isIconRight ? 'row-reverse' : 'row', as: "span", fill: false, className: styles.ItemContent, hAlign: isIconRight ? 'space-between' : 'start', vAlign: "center", columnGap: 8, hPadding: 16, vPadding: 8, "data-menu-item-icon-right": isIconRight, "data-menu-item-has-icon": Boolean(icon), "data-menu-item-padding": padding, style: { inlineSize: '100%' }, children: [icon && (_jsx(Symbol, { className: styles.Icon, source: icon, dimension: dimension === 'small' ? 12 : 16 })), _jsxs(Stack, { className: styles.DecorationContent, columnGap: 16, fill: false, direction: "row", hAlign: "space-between", children: [_jsxs(Stack, { direction: "column", children: [children, subtext && _jsx(Text, { variant: dimension === 'small' ? 'body-3' : 'body-2', children: subtext })] }), decoration] })] })), [children, subtext, dimension, icon, isIconRight, decoration, padding]);
|
|
36
36
|
return (_jsx(Stack, { as: "li", role: "none", children: _jsx(Wrapper, { autoFocus: autoFocus, ref: itemRef, role: "menuitem", className: clsx(styles.MenuItem, className), onClick: disabled ? undefined : triggerClick, onKeyDown: disabled ? undefined : handleKeyDown, tabIndex: tabIndex, "aria-disabled": disabled, type: Wrapper === 'button' ? 'button' : undefined, "data-menu-item-dimension": dimension, "data-testid": "MenuItem", ...otherProps, children: description
|
|
37
37
|
? (_jsx(Tooltip, { fill: true, open: isFocused || isHovering, placement: "auto", interactive: true, trigger: InnerContent, children: _jsx(Text, { variant: "body-2", children: description }) }))
|
|
38
38
|
: InnerContent }) }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overlay-container.d.ts","sourceRoot":"","sources":["../../../src/components/overlay-container/overlay-container.tsx"],"names":[],"mappings":"AAmBA,OAAO,EAAE,SAAS,EAAa,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"overlay-container.d.ts","sourceRoot":"","sources":["../../../src/components/overlay-container/overlay-container.tsx"],"names":[],"mappings":"AAmBA,OAAO,EAAE,SAAS,EAAa,MAAM,OAAO,CAAC;AAS7C,oBAAY,qBAAqB,GAAG;IAClC;;;;OAIG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;IACzC;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAA;AAED,eAAO,MAAM,gBAAgB,EAAE,UAAU,CAAC,qBAAqB,CA8C9D,CAAC"}
|
|
@@ -19,6 +19,7 @@ import { useEffect } from 'react';
|
|
|
19
19
|
import { createPortal } from 'react-dom';
|
|
20
20
|
import { useUIDSeed } from 'react-uid';
|
|
21
21
|
import { OverlayProvider } from '../..';
|
|
22
|
+
import { isBrowser } from '../../utils/browser';
|
|
22
23
|
import * as styles from './overlay-container.module.css';
|
|
23
24
|
export const OverlayContainer = ({ children, root, overlayColor = 'dark', index = 4, obfuscate = true, onClose, }) => {
|
|
24
25
|
const seedID = useUIDSeed();
|
|
@@ -28,5 +29,5 @@ export const OverlayContainer = ({ children, root, overlayColor = 'dark', index
|
|
|
28
29
|
}
|
|
29
30
|
}, [root]);
|
|
30
31
|
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 ?? document.body);
|
|
32
|
+
return isBrowser() ? createPortal(content, root ?? document.body) : null;
|
|
32
33
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer components{.Pagination{font-size:.875rem;list-style:none;margin:0;padding:0}.Pagination,.Pagination>li>a{align-items:center;display:inline-flex}.Pagination>li>a{border-radius:.25rem;color:var(--dimmed-
|
|
1
|
+
@layer components{.Pagination{font-size:.875rem;list-style:none;margin:0;padding:0}.Pagination,.Pagination>li>a{align-items:center;display:inline-flex}.Pagination>li>a{border-radius:.25rem;color:var(--dimmed-7);cursor:pointer;font-weight:600;height:2rem;justify-content:center;line-height:1.25rem;min-width:2rem;padding:0 .5rem;-webkit-user-select:none;user-select:none}.Pagination>li>a[aria-current=page]{background-color:var(--cta-default);color:var(--cta-foreground)}.Pagination>li>a[aria-disabled=true]{opacity:.5}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover.d.ts","sourceRoot":"","sources":["../../../src/components/popover/popover.tsx"],"names":[],"mappings":"AAgBA,OAAO,EACL,aAAa,EAAE,aAAa,EAAY,kBAAkB,EAC3D,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"popover.d.ts","sourceRoot":"","sources":["../../../src/components/popover/popover.tsx"],"names":[],"mappings":"AAgBA,OAAO,EACL,aAAa,EAAE,aAAa,EAAY,kBAAkB,EAC3D,MAAM,gBAAgB,CAAC;AAUxB,OAAO,EAML,SAAS,EAKV,MAAM,OAAO,CAAC;AASf,oBAAY,YAAY,GAAG;IACzB;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;;OAGG;IACH,OAAO,EAAE,SAAS,CAAC;IACnB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,aAAa,GAAG,aAAa,GAAG,kBAAkB,CAAC;IAC/D;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;OAEG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;OAEG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;OAEG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC;CACpB,CAAA;AA0BD,eAAO,MAAM,OAAO;;;iEAgIlB,CAAC"}
|
|
@@ -8,6 +8,7 @@ import { createPortal } from 'react-dom';
|
|
|
8
8
|
import { mergeRefs } from 'react-merge-refs';
|
|
9
9
|
import { usePopperTooltip } from 'react-popper-tooltip';
|
|
10
10
|
import { useUIDSeed } from 'react-uid';
|
|
11
|
+
import { isBrowser } from '../../utils/browser';
|
|
11
12
|
import * as styles from './popover.module.css';
|
|
12
13
|
const cssEasingToArray = (cssEasing) => {
|
|
13
14
|
const [x1, y1, x2, y2] = cssEasing.replace(/[^0-9.,]+/g, '').split(',').map(i => parseFloat(i));
|
|
@@ -97,7 +98,7 @@ export const Popover = forwardRef(({ children, trigger, offset = 8, placement =
|
|
|
97
98
|
'aria-controls': seedID('popover-dialog'),
|
|
98
99
|
'aria-expanded': isOpen,
|
|
99
100
|
...otherProps,
|
|
100
|
-
}), visible && createPortal(_jsx(AnimatePresence, { children: _jsx("div", { ref: setTooltipRef, role: "tooltip", id: seedID('tooltip-content'), ...getTooltipProps({ className: styles.PopUp }), children: _jsx(LazyMotion, { features: domMax, children: _jsx(m.div, { variants: PopoverAnimation, initial: "hidden", animate: "visible", exit: "hidden", children: Children.map(children, child => isValidElement(child) && cloneElement(child, {
|
|
101
|
+
}), isBrowser() && visible && createPortal(_jsx(AnimatePresence, { children: _jsx("div", { ref: setTooltipRef, role: "tooltip", id: seedID('tooltip-content'), ...getTooltipProps({ className: styles.PopUp }), children: _jsx(LazyMotion, { features: domMax, children: _jsx(m.div, { variants: PopoverAnimation, initial: "hidden", animate: "visible", exit: "hidden", children: Children.map(children, child => isValidElement(child) && cloneElement(child, {
|
|
101
102
|
id: seedID('popover-dialog'),
|
|
102
103
|
'aria-labelledby': seedID('popover-trigger'),
|
|
103
104
|
})) }) }) }, seedID('tooltip-content')) }), root ?? document.body)] }));
|
|
@@ -28,10 +28,10 @@ const mapping = {
|
|
|
28
28
|
export const Snackbar = forwardRef(({ children, className, title, icon, kind = 'neutral', as: Wrapper = 'output', dismissable, dismissLabel = 'Dismiss', onDismiss, ...otherProps }, forwardedRef) => {
|
|
29
29
|
const defaultIcons = {
|
|
30
30
|
info: 'circle-info',
|
|
31
|
-
warning: '
|
|
31
|
+
warning: 'triangle-exclamation',
|
|
32
32
|
neutral: 'compass',
|
|
33
33
|
positive: 'circle-check',
|
|
34
34
|
danger: 'circle-x',
|
|
35
35
|
};
|
|
36
|
-
return (_jsx(Wrapper, { ref: forwardedRef, className: clsx(styles.Snackbar, className), "data-snackbar-kind": kind, role: "status", ...otherProps, children: _jsxs(Stack, { vAlign: "start", hAlign: "start", direction: "row", columnGap: 16, children: [_jsx(Symbol, { "data-snackbar-has-title": !!title, className: styles.Icon, weight: "
|
|
36
|
+
return (_jsx(Wrapper, { ref: forwardedRef, className: clsx(styles.Snackbar, className), "data-snackbar-kind": kind, role: "status", ...otherProps, children: _jsxs(Stack, { vAlign: "start", hAlign: "start", direction: "row", columnGap: 16, children: [_jsx(Symbol, { "data-snackbar-has-title": !!title, className: styles.Icon, weight: "outline", source: icon ?? defaultIcons[kind], dimension: 24 }), _jsxs(Stack, { rowGap: 16, children: [_jsxs(Stack, { rowGap: 4, children: [title && _jsx(Text, { variant: "subtitle-1", color: kind ? mapping[kind] : 'neutral', preventResponsive: true, children: title }), _jsx(Text, { variant: "body-2", children: children })] }), dismissable && (_jsx(Stack, { hAlign: "end", children: _jsx(Button, { onClick: onDismiss, className: styles.Action, dimension: "small", children: dismissLabel }) }))] })] }) }));
|
|
37
37
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer components{.Snackbar{background:var(--global-background);border:1px solid var(--global-vibrancy-background);border-radius:.5rem;display:block;overflow:hidden;padding
|
|
1
|
+
@layer components{.Snackbar{background:var(--global-background);border:1px solid var(--global-vibrancy-background);border-radius:.5rem;display:block;overflow:hidden;padding:1rem}.Snackbar p{font-size:.875rem}.Snackbar[data-snackbar-kind=neutral]{--heading-foreground:var(--highlight-gray-foreground);--snackbar-bg:var(--highlight-gray-background);--snackbar-fg:var(--highlight-gray-foreground)}.Snackbar[data-snackbar-kind=positive]{--heading-foreground:var(--highlight-green-foreground);--snackbar-bg:var(--highlight-green-background);--snackbar-fg:var(--highlight-green-foreground)}.Snackbar[data-snackbar-kind=warning]{--heading-foreground:var(--highlight-yellow-foreground);--snackbar-bg:var(--highlight-yellow-background);--snackbar-fg:var(--highlight-yellow-foreground)}.Snackbar[data-snackbar-kind=info]{--heading-foreground:var(--highlight-blue-foreground);--snackbar-bg:var(--highlight-blue-background);--snackbar-fg:var(--highlight-blue-foreground)}.Snackbar[data-snackbar-kind=danger]{--heading-foreground:var(--highlight-red-foreground);--snackbar-bg:var(--highlight-red-background);--snackbar-fg:var(--highlight-red-foreground)}.Icon{color:var(--snackbar-fg);flex-grow:0;flex-shrink:0;height:1.5rem;margin-top:.2rem;max-width:1.5rem;width:1.5rem}.Icon[data-snackbar-has-title=true]{margin-top:0}}@layer overrides{.Action{background-color:var(--snackbar-fg);color:var(--snackbar-bg)}.Action:is(:active,:hover){background-color:var(--snackbar-fg);color:var(--snackbar-bg);opacity:.8}}
|
|
@@ -28,6 +28,6 @@ export const Tab = ({ className, children, onValueChange, defaultValue, value, l
|
|
|
28
28
|
onValueChange?.(value);
|
|
29
29
|
setActiveItem(value);
|
|
30
30
|
}, [onValueChange]);
|
|
31
|
-
return (_jsxs(TabsPrimitive.Root, { defaultValue: defaultValue, onValueChange: handleOnVlaueChange, className: className, value: value, "data-testid": "TabRoot", ...otherProps, children: [_jsx(LazyMotion, { features: domMax, strict: true, children: _jsx(TabsPrimitive.List, { className: styles.List, loop: loop, children: Children.map(children, child => isValidElement(child) && (_jsx(TabsPrimitive.Trigger, { value: child.props.value, disabled: child.props.disabled, className: styles.Trigger, "data-tab-dimension": dimension, asChild: true, children: _jsxs(Button, { kind: "flat",
|
|
31
|
+
return (_jsxs(TabsPrimitive.Root, { defaultValue: defaultValue, onValueChange: handleOnVlaueChange, className: className, value: value, "data-testid": "TabRoot", ...otherProps, children: [_jsx(LazyMotion, { features: domMax, strict: true, children: _jsx(TabsPrimitive.List, { className: styles.List, loop: loop, children: Children.map(children, child => isValidElement(child) && (_jsx(TabsPrimitive.Trigger, { value: child.props.value, disabled: child.props.disabled, className: styles.Trigger, "data-tab-dimension": dimension, asChild: true, children: _jsxs(Button, { kind: "flat", children: [child.props.icon && _jsx(Symbol, { source: child.props.icon, dimension: dimension === 'big' ? 24 : 16, weight: dimension === 'big' ? 'duotone' : 'solid' }), child.props.label, (child.props.value === activeItem || child.props.value === value) && (_jsx(m.span, { className: styles.Highlight, layoutId: uid('tab-highlight') }))] }) }))) }) }), children] }));
|
|
32
32
|
};
|
|
33
33
|
Tab.Panel = TabPanel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer components{.List{--separator-size:2px;box-shadow:inset 0 calc(var(--separator-size)*-1) 0 var(--dimmed-1);overflow:auto;white-space:nowrap}.Highlight{background:var(--cta-default);border-radius:2px 2px 0 0;bottom:0;height:4px;pointer-events:none;position:absolute;width:100%}.Panel{animation:fade-in .2s;animation-timing-function:cubic-bezier(0,0,.34,1)
|
|
1
|
+
@layer components{.List{--separator-size:2px;box-shadow:inset 0 calc(var(--separator-size)*-1) 0 var(--dimmed-1);overflow:auto;white-space:nowrap}.Highlight{background:var(--cta-default);border-radius:2px 2px 0 0;bottom:0;height:4px;pointer-events:none;position:absolute;width:100%}.Panel{animation:fade-in .2s;animation-timing-function:cubic-bezier(0,0,.34,1)}}@layer overrides{.Trigger{appearance:none;-webkit-backdrop-filter:none;backdrop-filter:none;background:none;background-color:transparent;border:0;border-radius:0;color:var(--dimmed-6);flex-shrink:0;font-family:inherit;font-size:.875rem;font-weight:400;outline-offset:calc(var(--separator-size)*-1);overflow:unset;padding:.5rem 1rem;position:relative;white-space:nowrap}.Trigger[data-tab-dimension=big]{font-size:1rem;height:3rem}.Trigger:active{transform:none}.Trigger:not([aria-disabled=true]){-webkit-backdrop-filter:none;backdrop-filter:none;color:var(--dimmed-5)}.Trigger.Trigger:not([aria-disabled=true]):is(:hover,:focus,:active){-webkit-backdrop-filter:none;backdrop-filter:none;background:none;color:var(--global-foreground)}.Trigger.Trigger[aria-disabled=true]{-webkit-backdrop-filter:none;backdrop-filter:none;background:none;color:var(--global-disabled-foreground)}.Trigger[data-state=active]{-webkit-text-stroke:.4px var(--global-foreground);color:var(--global-foreground)}}@keyframes fade-in{0%{opacity:0;transform:translate(var(--fade-from-x,0),var(--fade-from-y,0))}to{opacity:unset;transform:none}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.stories.d.ts","sourceRoot":"","sources":["../../../src/components/text/text.stories.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"text.stories.d.ts","sourceRoot":"","sources":["../../../src/components/text/text.stories.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAOjE,OAAO,EAAE,IAAI,EAAgB,MAAM,QAAQ,CAAC;AAE5C,QAAA,MAAM,KAAK,EAAE,aAAa,CAAC,OAAO,IAAI,CA8CrC,CAAC;AAEF,eAAe,KAAK,CAAC;AAIrB,eAAO,MAAM,OAAO,wGAAoB,CAAC;AAoBzC,eAAO,MAAM,QAAQ,wGAA4B,CAAC;AAalD,eAAO,MAAM,MAAM,wGAA0B,CAAC;AAc9C,eAAO,MAAM,eAAe,wGAAyB,CAAC;AAUtD,eAAO,MAAM,cAAc,wGAA8B,CAAC;AAgD1D,eAAO,MAAM,cAAc,wGAA8B,CAAC;AAiH1D,eAAO,MAAM,WAAW,wGAA2B,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Card, Chip, Container, Stack, Symbol, } from '../..';
|
|
2
|
+
import { Card, Chip, Container, Separator, Stack, Symbol, } from '../..';
|
|
3
3
|
import { Text } from './text';
|
|
4
4
|
const story = {
|
|
5
5
|
title: 'Typography/Text',
|
|
@@ -80,5 +80,5 @@ const TemplateDecorators = () => {
|
|
|
80
80
|
return (_jsx(Container, { dimension: "fixed", children: _jsx(Stack, { rowGap: 40, children: variants.map(v => (_jsxs(Stack, { rowGap: 8, children: [_jsx(Text, { variant: v, color: "informative", decoratorSize: sizes[0], decoratorStart: _jsx(Symbol, { source: "circle-check", weight: "solid" }), decoratorEnd: _jsx(Chip, { color: "cyan", children: sizes[0] }), children: v }), _jsx(Text, { variant: v, decoratorSize: sizes[1], decoratorStart: _jsx(Symbol, { source: "circle-check", weight: "solid" }), decoratorEnd: _jsx(Chip, { color: "green", children: sizes[1] }), children: v }), _jsx(Text, { variant: v, decoratorSize: sizes[2], decoratorStart: _jsx(Symbol, { source: "circle-check", weight: "outline", color: "red" }), decoratorEnd: _jsx(Chip, { color: "red", children: sizes[2] }), children: v })] }, v))) }) }));
|
|
81
81
|
};
|
|
82
82
|
export const withDecorators = TemplateDecorators.bind({});
|
|
83
|
-
const TemplatePairing = () => (_jsxs(Stack, { rowGap:
|
|
83
|
+
const TemplatePairing = () => (_jsxs(Stack, { rowGap: 32, children: [_jsxs("div", { style: { maxWidth: '800px' }, children: [_jsx(Text, { variant: "display-1", preventResponsive: true, children: "96px display-1" }), _jsx(Text, { variant: "tagline-1", preventResponsive: true, children: "28px tagline-1 Lorem ipsum sit amet, consectur adipiscing elit. Fusce aliquet cursus." })] }), _jsxs("div", { style: { maxWidth: '800px' }, children: [_jsx(Text, { variant: "display-2", preventResponsive: true, children: "80px display-2" }), _jsx(Text, { variant: "tagline-1", preventResponsive: true, children: "28px tagline-1 Lorem ipsum sit amet, consectur adipiscing elit. Fusce aliquet cursus." })] }), _jsxs("div", { style: { maxWidth: '800px' }, children: [_jsx(Text, { variant: "display-3", preventResponsive: true, children: "68px display-3" }), _jsx(Text, { variant: "tagline-2", preventResponsive: true, children: "24px tagline-2 Lorem ipsum sit amet, consectur adipiscing elit. Fusce aliquet cursus." })] }), _jsxs("div", { style: { maxWidth: '800px' }, children: [_jsx(Text, { variant: "display-4", preventResponsive: true, children: "56px display-4" }), _jsx(Text, { variant: "tagline-2", preventResponsive: true, children: "24px tagline-2 Lorem ipsum sit amet, consectur adipiscing elit. Fusce aliquet cursus." })] }), _jsxs("div", { style: { maxWidth: '800px' }, children: [_jsx(Text, { variant: "tagline-3", preventResponsive: true, children: "20px tagline-3" }), _jsx(Text, { variant: "heading-1", preventResponsive: true, children: "48px heading-1" }), _jsx(Text, { variant: "tagline-3", children: "20px tagline-3" })] }), _jsxs("div", { style: { maxWidth: '800px' }, children: [_jsx(Text, { variant: "subtitle-1", children: "16px subtitle-1" }), _jsx(Text, { variant: "heading-1", preventResponsive: true, children: "48px heading-1" }), _jsx(Text, { variant: "body-1", children: "16px body-1" })] }), _jsxs("div", { style: { maxWidth: '800px' }, children: [_jsx(Text, { variant: "heading-1", preventResponsive: true, children: "48px heading-1" }), _jsx(Text, { variant: "body-1", children: "16px as body-1 Lorem ipsum sit amet, consectur adipiscing elit. Fusce aliquet cursus." })] }), _jsxs("div", { style: { maxWidth: '800px' }, children: [_jsx(Text, { variant: "heading-2", preventResponsive: true, children: "40px heading-2" }), _jsx(Text, { variant: "body-1", children: "16px as body-1 Lorem ipsum sit amet, consectur adipiscing elit. Fusce aliquet cursus." })] }), _jsxs("div", { children: [_jsx(Text, { variant: "subtitle-1", color: "danger", children: "Heading Title with Body text" }), _jsx(Separator, {})] }), _jsxs("div", { style: { maxWidth: '800px' }, children: [_jsx(Text, { variant: "heading-3", preventResponsive: true, children: "32px heading-3" }), _jsx(Text, { variant: "body-1", children: "16px as body-1 Lorem ipsum sit amet, consectur adipiscing elit. Fusce aliquet cursus." })] }), _jsxs("div", { style: { maxWidth: '800px' }, children: [_jsx(Text, { variant: "heading-4", preventResponsive: true, children: "28px heading-4" }), _jsx(Text, { variant: "body-1", children: "16px as body-1 Lorem ipsum sit amet, consectur adipiscing elit. Fusce aliquet cursus." })] }), _jsxs("div", { style: { maxWidth: '800px' }, children: [_jsx(Text, { variant: "heading-5", preventResponsive: true, children: "24px heading-5" }), _jsx(Text, { variant: "body-1", children: "16px as body-1 Lorem ipsum sit amet, consectur adipiscing elit. Fusce aliquet cursus." })] }), _jsxs("div", { style: { maxWidth: '800px' }, children: [_jsx(Text, { variant: "heading-6", preventResponsive: true, children: "20px heading-6" }), _jsx(Text, { variant: "body-1", children: "16px as body-1 Lorem ipsum sit amet, consectur adipiscing elit. Fusce aliquet cursus." })] }), _jsxs("div", { style: { maxWidth: '800px' }, children: [_jsx(Text, { variant: "heading-6", preventResponsive: true, children: "20px heading-6" }), _jsx(Text, { variant: "body-2", children: "14px as body-2 Lorem ipsum sit amet, consectur adipiscing elit. Fusce aliquet cursus." })] }), _jsxs("div", { style: { maxWidth: '800px' }, children: [_jsx(Text, { variant: "subtitle-1", children: "16px subtitle-1" }), _jsx(Text, { variant: "body-2", children: "14px as body-2 Lorem ipsum sit amet, consectur adipiscing elit. Fusce aliquet cursus." })] }), _jsxs("div", { children: [_jsx(Text, { variant: "subtitle-1", color: "danger", children: "Title with eyebrow text" }), _jsx(Separator, {})] }), _jsxs("div", { style: { maxWidth: '800px' }, children: [_jsx(Text, { variant: "subtitle-1", children: "16px subtitle-1" }), _jsx(Text, { variant: "heading-4", preventResponsive: true, children: "28px heading-4" })] }), _jsxs("div", { style: { maxWidth: '800px' }, children: [_jsx(Text, { variant: "subtitle-2", children: "14px subtitle-2" }), _jsx(Text, { variant: "heading-5", preventResponsive: true, children: "24px heading-5" })] }), _jsxs("div", { children: [_jsx(Text, { variant: "subtitle-1", color: "danger", children: "Paragraph with text" }), _jsx(Separator, {})] }), _jsxs("div", { style: { maxWidth: '800px' }, children: [_jsx(Text, { children: "16px as body-1" }), _jsx(Text, { variant: "body-3", children: "12px as body-3" })] }), _jsxs("div", { style: { maxWidth: '800px' }, children: [_jsx(Text, { variant: "body-2", children: "14px as body-2" }), _jsx(Text, { variant: "body-3", children: "12px as body-3" })] })] }));
|
|
84
84
|
export const sizePairing = TemplatePairing.bind({});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../../src/components/tooltip/tooltip.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAEtF,OAAO,EACgE,SAAS,EAC/E,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../../src/components/tooltip/tooltip.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAEtF,OAAO,EACgE,SAAS,EAC/E,MAAM,OAAO,CAAC;AAUf,oBAAY,YAAY,GAAG;IACzB;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,OAAO,EAAE,SAAS,CAAC;IACnB;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,aAAa,GAAG,aAAa,GAAG,kBAAkB,CAAC;IAC/D;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;OAEG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC;CACpB,CAAA;AAED,eAAO,MAAM,OAAO,EAAE,eAAe,CAAC,YAAY,CAoFjD,CAAC"}
|
|
@@ -5,6 +5,7 @@ import { createPortal } from 'react-dom';
|
|
|
5
5
|
import { usePopperTooltip } from 'react-popper-tooltip';
|
|
6
6
|
import { useUIDSeed } from 'react-uid';
|
|
7
7
|
import { Elevator } from '../..';
|
|
8
|
+
import { isBrowser } from '../../utils/browser';
|
|
8
9
|
import * as styles from './tooltip.module.css';
|
|
9
10
|
export const Tooltip = ({ children, trigger, placement = 'bottom-start', open, style, maxWidth = '40ch', fill = false, interactive = false, delay = 500, root, }) => {
|
|
10
11
|
const [isOpen, setIsOpen] = useState(false);
|
|
@@ -43,5 +44,5 @@ export const Tooltip = ({ children, trigger, placement = 'bottom-start', open, s
|
|
|
43
44
|
ref: setTriggerRef,
|
|
44
45
|
tabIndex: 0,
|
|
45
46
|
'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 ?? document.body)] }));
|
|
47
|
+
})), isBrowser() && 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
48
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer components{.Tooltip{display:contents}.Balloon{word-wrap:break-word;background-color:#31363f;border-radius:.25rem;
|
|
1
|
+
@layer components{.Tooltip{display:contents}.Balloon{word-wrap:break-word;background-color:#31363f;border-radius:.25rem;max-inline-size:var(--max-w);padding:.5rem 1rem;position:relative;z-index:5}.Balloon,.Balloon p{font-size:.875rem}.Balloon[data-popper-reference-hidden=true]{pointer-events:none;visibility:hidden}.Arrow:before{background-color:#31363f;block-size:12px;content:"";inline-size:12px;position:absolute;transform:rotate(45deg);visibility:visible}.Balloon[data-popper-reference-hidden=true] .Arrow{pointer-events:none;visibility:hidden}.Balloon[data-popper-placement^=top] .Arrow{bottom:6px}.Balloon[data-popper-placement^=top] .Arrow:before{transform:translateX(-50%) translateY(-2px) rotate(45deg)}.Balloon[data-popper-placement^=left] .Arrow{right:6px}.Balloon[data-popper-placement^=left] .Arrow:before{transform:translateX(-2px) translateY(-50%) rotate(45deg)}.Balloon[data-popper-placement^=bottom] .Arrow{top:-6px}.Balloon[data-popper-placement^=bottom] .Arrow:before{transform:translateX(-50%) translateY(2px) rotate(45deg)}.Balloon[data-popper-placement^=right] .Arrow{left:-6px}.Balloon[data-popper-placement^=right] .Arrow:before{transform:translateX(2px) translateY(-50%) rotate(45deg)}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../src/utils/browser.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,SAAS,2BAEiB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Wonderflow Design Team
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export const isBrowser = () => (typeof window !== 'undefined'
|
|
17
|
+
&& window.document
|
|
18
|
+
&& window.document.documentElement);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser.test.d.ts","sourceRoot":"","sources":["../../src/utils/browser.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { cssRelativeUnitsToPixel } from './conversions';
|
|
2
2
|
describe('cssRelativeUnitsToPixel()', () => {
|
|
3
3
|
const rightCases = ['20rem', '20em'];
|
|
4
|
-
const wrongCases = ['abc', '20Rem', '20eM', '20ReM', '20EM', '20px', '20%'];
|
|
5
4
|
rightCases.map(c => it(`should return 320 with input "${c}"`, () => {
|
|
6
5
|
const res = cssRelativeUnitsToPixel(c);
|
|
7
6
|
expect(res).toBe(320);
|
|
8
7
|
}));
|
|
8
|
+
const wrongCases = ['abc', '20Rem', '20eM', '20ReM', '20EM', '20px', '20%'];
|
|
9
9
|
wrongCases.map(c => it(`should return -1 with input "${c}"`, () => {
|
|
10
10
|
const res = cssRelativeUnitsToPixel(c);
|
|
11
11
|
expect(res).toBe(-1);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wonderflow/react-components",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.1.1",
|
|
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": "12.
|
|
86
|
-
"@wonderflow/tokens": "12.
|
|
85
|
+
"@wonderflow/config": "12.1.1",
|
|
86
|
+
"@wonderflow/tokens": "12.1.1",
|
|
87
87
|
"babel-loader": "8.2.5",
|
|
88
88
|
"cpy-cli": "3.1.1",
|
|
89
89
|
"postcss": "8.4.17",
|