@ultraviolet/ui 1.24.2 → 1.26.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/dist/index.d.ts +48 -24
- package/dist/src/components/Banner/index.js +6 -12
- package/dist/src/components/MenuV2/index.js +6 -23
- package/dist/src/components/Modal/Dialog.js +3 -3
- package/dist/src/components/Popover/index.js +5 -20
- package/dist/src/components/Popup/animations.js +24 -0
- package/dist/src/components/Popup/helpers.js +72 -44
- package/dist/src/components/Popup/index.js +109 -85
- package/dist/src/components/Snippet/index.js +5 -4
- package/dist/src/components/Tabs/Tab.js +54 -21
- package/dist/src/components/Tabs/TabMenu.js +2 -0
- package/dist/src/components/Tabs/index.js +21 -6
- package/dist/src/components/Tooltip/index.js +3 -1
- package/package.json +5 -5
- package/dist/src/components/Banner/assets/intro-compact-left-pattern.svg.js +0 -5
- package/dist/src/components/Banner/assets/intro-compact-right-pattern.svg.js +0 -5
- package/dist/src/components/Banner/assets/intro-pattern.svg.js +0 -5
- package/dist/src/components/Banner/assets/promotion-compact-left-pattern.svg.js +0 -5
- package/dist/src/components/Banner/assets/promotion-compact-right-pattern.svg.js +0 -5
- package/dist/src/components/Banner/assets/promotion-pattern.svg.js +0 -5
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import react__default, { ReactNode, ComponentProps, ButtonHTMLAttributes, AriaRole, MouseEventHandler, JSX, MouseEvent, InputHTMLAttributes, HTMLAttributeAnchorTarget, AnchorHTMLAttributes, ReactElement, Ref,
|
|
2
|
+
import react__default, { ReactNode, ComponentProps, ButtonHTMLAttributes, AriaRole, MouseEventHandler, JSX, MouseEvent, InputHTMLAttributes, HTMLAttributeAnchorTarget, AnchorHTMLAttributes, ReactElement, Ref, RefObject, KeyboardEventHandler, HTMLAttributes, CSSProperties, ChangeEventHandler, FocusEventHandler, ForwardRefExoticComponent, ForwardedRef, ElementType, TextareaHTMLAttributes } from 'react';
|
|
3
3
|
import * as _emotion_react_jsx_runtime from '@emotion/react/jsx-runtime';
|
|
4
4
|
import * as _emotion_styled from '@emotion/styled';
|
|
5
5
|
import * as _emotion_react from '@emotion/react';
|
|
@@ -407,11 +407,8 @@ declare const extendTheme: (extendedTheme: RecursivePartial<UltravioletUITheme>)
|
|
|
407
407
|
blue: string;
|
|
408
408
|
emerald: string;
|
|
409
409
|
fuschia: string;
|
|
410
|
-
gold: string;
|
|
411
410
|
magenta: string;
|
|
412
411
|
primary: string;
|
|
413
|
-
purple: string;
|
|
414
|
-
strong: string;
|
|
415
412
|
};
|
|
416
413
|
};
|
|
417
414
|
icon: {
|
|
@@ -639,6 +636,15 @@ declare const extendTheme: (extendedTheme: RecursivePartial<UltravioletUITheme>)
|
|
|
639
636
|
textWeakDisabled: string;
|
|
640
637
|
textWeakHover: string;
|
|
641
638
|
};
|
|
639
|
+
other: {
|
|
640
|
+
gradients: {
|
|
641
|
+
background: {
|
|
642
|
+
gold: string;
|
|
643
|
+
purple: string;
|
|
644
|
+
strong: string;
|
|
645
|
+
};
|
|
646
|
+
};
|
|
647
|
+
};
|
|
642
648
|
};
|
|
643
649
|
radii: {
|
|
644
650
|
circle: string;
|
|
@@ -1226,7 +1232,7 @@ type BarStackProps = {
|
|
|
1226
1232
|
/**
|
|
1227
1233
|
* BarStack is a graphic component that is used to show data in one dimension.
|
|
1228
1234
|
*/
|
|
1229
|
-
declare const BarStack: ({ data, total, className, "data-testid": dataTestId, }: BarStackProps) => JSX.Element;
|
|
1235
|
+
declare const BarStack: ({ data, total, className, "data-testid": dataTestId, }: BarStackProps) => _emotion_react_jsx_runtime.JSX.Element;
|
|
1230
1236
|
|
|
1231
1237
|
type ItemProps$1 = {
|
|
1232
1238
|
children: ReactNode;
|
|
@@ -1323,8 +1329,8 @@ type CarouselProps = {
|
|
|
1323
1329
|
* Carousel component allows you to scroll horizontally through a list of items.
|
|
1324
1330
|
*/
|
|
1325
1331
|
declare const Carousel: {
|
|
1326
|
-
({ children, className, "data-testid": dataTestId, }: CarouselProps): JSX.Element;
|
|
1327
|
-
Item: ({ children, width, }: CarouselItemProps) => JSX.Element;
|
|
1332
|
+
({ children, className, "data-testid": dataTestId, }: CarouselProps): _emotion_react_jsx_runtime.JSX.Element;
|
|
1333
|
+
Item: ({ children, width, }: CarouselItemProps) => _emotion_react_jsx_runtime.JSX.Element;
|
|
1328
1334
|
};
|
|
1329
1335
|
|
|
1330
1336
|
type CheckboxProps = {
|
|
@@ -1689,7 +1695,7 @@ type PasswordStrengthMeterProps$1 = {
|
|
|
1689
1695
|
/**
|
|
1690
1696
|
* Show strength of a password based on different criteria.
|
|
1691
1697
|
*/
|
|
1692
|
-
declare const Meter: ({ strength, title, value, className, "data-testid": dataTestId, id, }: PasswordStrengthMeterProps$1) => JSX.Element;
|
|
1698
|
+
declare const Meter: ({ strength, title, value, className, "data-testid": dataTestId, id, }: PasswordStrengthMeterProps$1) => _emotion_react_jsx_runtime.JSX.Element;
|
|
1693
1699
|
|
|
1694
1700
|
type ModalSize = 'large' | 'medium' | 'small' | 'xsmall' | 'xxsmall';
|
|
1695
1701
|
type ModalPlacement = 'bottom' | 'bottom-left' | 'bottom-right' | 'center' | 'top' | 'top-left' | 'top-right' | 'right' | 'left';
|
|
@@ -1850,7 +1856,7 @@ type PaginationProps = {
|
|
|
1850
1856
|
* Pagination is a component to navigate between pages, it is composed of 2 buttons to go to the previous and next page,
|
|
1851
1857
|
* and a list of buttons to go to a specific page.
|
|
1852
1858
|
*/
|
|
1853
|
-
declare const Pagination: ({ disabled, page, pageCount, onChange, pageTabCount, className, "data-testid": dataTestId, }: PaginationProps) => JSX.Element;
|
|
1859
|
+
declare const Pagination: ({ disabled, page, pageCount, onChange, pageTabCount, className, "data-testid": dataTestId, }: PaginationProps) => _emotion_react_jsx_runtime.JSX.Element;
|
|
1854
1860
|
|
|
1855
1861
|
type Rule = {
|
|
1856
1862
|
name: string;
|
|
@@ -1909,7 +1915,7 @@ type PasswordStrengthMeterProps = {
|
|
|
1909
1915
|
* PasswordStrengthMeter is a component that displays a password strength meter.
|
|
1910
1916
|
* @deprecated use Meter component instead
|
|
1911
1917
|
*/
|
|
1912
|
-
declare const PasswordStrengthMeter: ({ password, onChange, strength, title, estimate, forbiddenInputs, className, "data-testid": dataTestId, }: PasswordStrengthMeterProps) => JSX.Element;
|
|
1918
|
+
declare const PasswordStrengthMeter: ({ password, onChange, strength, title, estimate, forbiddenInputs, className, "data-testid": dataTestId, }: PasswordStrengthMeterProps) => _emotion_react_jsx_runtime.JSX.Element;
|
|
1913
1919
|
|
|
1914
1920
|
type Data = {
|
|
1915
1921
|
name?: string | null;
|
|
@@ -1955,6 +1961,11 @@ declare const Popover: react.ForwardRefExoticComponent<{
|
|
|
1955
1961
|
'data-testid'?: string | undefined;
|
|
1956
1962
|
maxWidth?: string | undefined;
|
|
1957
1963
|
maxHeight?: string | undefined;
|
|
1964
|
+
/**
|
|
1965
|
+
* By default, the portal target is children container or document.body if children is a function. You can override this
|
|
1966
|
+
* behavior by setting a portalTarget prop.
|
|
1967
|
+
*/
|
|
1968
|
+
portalTarget?: HTMLElement | undefined;
|
|
1958
1969
|
} & Pick<{
|
|
1959
1970
|
id?: string | undefined;
|
|
1960
1971
|
children: ReactNode | ((renderProps: {
|
|
@@ -1977,17 +1988,18 @@ declare const Popover: react.ForwardRefExoticComponent<{
|
|
|
1977
1988
|
hasArrow?: boolean | undefined;
|
|
1978
1989
|
onClose?: (() => void) | undefined;
|
|
1979
1990
|
tabIndex?: number | undefined;
|
|
1980
|
-
onKeyDown?: KeyboardEventHandler | undefined;
|
|
1991
|
+
onKeyDown?: react.KeyboardEventHandler | undefined;
|
|
1981
1992
|
'aria-haspopup'?: boolean | "menu" | "dialog" | "grid" | "listbox" | "tree" | "false" | "true" | undefined;
|
|
1982
1993
|
hideOnClickOutside?: boolean | undefined;
|
|
1983
1994
|
needDebounce?: boolean | undefined;
|
|
1984
1995
|
maxHeight?: string | number | undefined;
|
|
1985
1996
|
disableAnimation?: boolean | undefined;
|
|
1997
|
+
portalTarget?: HTMLElement | undefined;
|
|
1986
1998
|
} & react.RefAttributes<HTMLDivElement>, "placement"> & react.RefAttributes<HTMLDivElement>>;
|
|
1987
1999
|
|
|
1988
2000
|
type PopupProps = {
|
|
1989
2001
|
/**
|
|
1990
|
-
* Id is automatically generated if not set. It is used for associating
|
|
2002
|
+
* Id is automatically generated if not set. It is used for associating popup wrapper with popup portal.
|
|
1991
2003
|
*/
|
|
1992
2004
|
id?: string;
|
|
1993
2005
|
children: ReactNode | ((renderProps: {
|
|
@@ -2000,20 +2012,20 @@ type PopupProps = {
|
|
|
2000
2012
|
}) => ReactNode);
|
|
2001
2013
|
maxWidth?: number | string;
|
|
2002
2014
|
/**
|
|
2003
|
-
* `auto` placement will change the position of the
|
|
2015
|
+
* `auto` placement will change the position of the popup if it doesn't fit in the viewport.
|
|
2004
2016
|
*/
|
|
2005
2017
|
placement?: PopupPlacement;
|
|
2006
2018
|
/**
|
|
2007
|
-
* Content of the
|
|
2019
|
+
* Content of the popup, preferably text inside.
|
|
2008
2020
|
*/
|
|
2009
2021
|
text?: ReactNode;
|
|
2010
2022
|
className?: string;
|
|
2011
2023
|
/**
|
|
2012
|
-
* It will add `width: 100%` to the
|
|
2024
|
+
* It will add `width: 100%` to the popup container.
|
|
2013
2025
|
*/
|
|
2014
2026
|
containerFullWidth?: boolean;
|
|
2015
2027
|
/**
|
|
2016
|
-
* It will force display
|
|
2028
|
+
* It will force display popup. This can be useful if you need to always display the popup without hover needed.
|
|
2017
2029
|
*/
|
|
2018
2030
|
visible?: boolean;
|
|
2019
2031
|
innerRef?: Ref<HTMLDivElement | null>;
|
|
@@ -2034,6 +2046,11 @@ type PopupProps = {
|
|
|
2034
2046
|
* Will remove the animation on the popup if set to false.
|
|
2035
2047
|
*/
|
|
2036
2048
|
disableAnimation?: boolean;
|
|
2049
|
+
/**
|
|
2050
|
+
* By default, the portal target is children container or document.body if children is a function. You can override this
|
|
2051
|
+
* behavior by setting a portalTarget prop.
|
|
2052
|
+
*/
|
|
2053
|
+
portalTarget?: HTMLElement;
|
|
2037
2054
|
};
|
|
2038
2055
|
/**
|
|
2039
2056
|
* @experimental This component is experimental and may be subject to breaking changes in the future.
|
|
@@ -2194,7 +2211,7 @@ type SeparatorProps = {
|
|
|
2194
2211
|
/**
|
|
2195
2212
|
* Separator component used to separate content with a horizontal or vertical line.
|
|
2196
2213
|
*/
|
|
2197
|
-
declare const Separator: ({ direction, thickness, color, icon, className, "data-testid": dataTestId, }: SeparatorProps) => JSX.Element;
|
|
2214
|
+
declare const Separator: ({ direction, thickness, color, icon, className, "data-testid": dataTestId, }: SeparatorProps) => _emotion_react_jsx_runtime.JSX.Element;
|
|
2198
2215
|
|
|
2199
2216
|
declare const variants$1: {
|
|
2200
2217
|
readonly block: ({ length }: {
|
|
@@ -2252,12 +2269,13 @@ type SnippetProps = {
|
|
|
2252
2269
|
showText?: string;
|
|
2253
2270
|
hideText?: string;
|
|
2254
2271
|
'data-testid'?: string;
|
|
2272
|
+
initiallyExpanded?: boolean;
|
|
2255
2273
|
} & Pick<ComponentProps<typeof CopyButton>, 'copyText' | 'copiedText'>;
|
|
2256
2274
|
/**
|
|
2257
2275
|
* Snippet component is used to display code snippets with the ability to copy the code.
|
|
2258
2276
|
* It also has the ability to show/hide the code snippet if it has more than 4 lines.
|
|
2259
2277
|
*/
|
|
2260
|
-
declare const Snippet: ({ children, copyText, copiedText, showText, hideText, prefix, className, "data-testid": dataTestId, }: SnippetProps) => _emotion_react_jsx_runtime.JSX.Element;
|
|
2278
|
+
declare const Snippet: ({ children, copyText, copiedText, showText, hideText, prefix, className, "data-testid": dataTestId, initiallyExpanded, }: SnippetProps) => _emotion_react_jsx_runtime.JSX.Element;
|
|
2261
2279
|
|
|
2262
2280
|
type StackProps = {
|
|
2263
2281
|
gap?: keyof UltravioletUITheme['space'] | number;
|
|
@@ -2308,7 +2326,7 @@ type StatusProps = {
|
|
|
2308
2326
|
/**
|
|
2309
2327
|
* Status component used to display a colored circle with a tooltip for additional information.
|
|
2310
2328
|
*/
|
|
2311
|
-
declare const Status: ({ animated, className, tooltip, sentiment, "data-testid": dataTestId, }: StatusProps) => JSX.Element;
|
|
2329
|
+
declare const Status: ({ animated, className, tooltip, sentiment, "data-testid": dataTestId, }: StatusProps) => _emotion_react_jsx_runtime.JSX.Element;
|
|
2312
2330
|
|
|
2313
2331
|
type Sizes = 'small' | 'medium';
|
|
2314
2332
|
type ContentProps = {
|
|
@@ -2479,10 +2497,11 @@ declare const Tabs: {
|
|
|
2479
2497
|
className?: string | undefined;
|
|
2480
2498
|
counter?: string | number | undefined;
|
|
2481
2499
|
disabled?: boolean | undefined;
|
|
2482
|
-
value?: string | number | undefined;
|
|
2483
2500
|
onClick?: react.MouseEventHandler<HTMLElement> | undefined;
|
|
2484
2501
|
onKeyDown?: react.KeyboardEventHandler<HTMLElement> | undefined;
|
|
2502
|
+
subtitle?: string | undefined;
|
|
2485
2503
|
tooltip?: string | undefined;
|
|
2504
|
+
value?: string | number | undefined;
|
|
2486
2505
|
} & Omit<any, "tooltip" | "children" | "role" | "className" | "as" | "disabled" | "value" | "badge" | "counter">, "ref"> & react.RefAttributes<HTMLElement>>;
|
|
2487
2506
|
Menu: react.ForwardRefExoticComponent<{
|
|
2488
2507
|
children: ReactNode;
|
|
@@ -2563,7 +2582,7 @@ type TagInputProps = {
|
|
|
2563
2582
|
* TagInput is a component that allows users to input tags.
|
|
2564
2583
|
* @experimental This component is experimental and may be subject to breaking changes in the future.
|
|
2565
2584
|
*/
|
|
2566
|
-
declare const TagInput: ({ disabled, id, manualInput, name, onChange, onChangeError, placeholder, tags, variant, className, "data-testid": dataTestId, }: TagInputProps) => JSX.Element;
|
|
2585
|
+
declare const TagInput: ({ disabled, id, manualInput, name, onChange, onChangeError, placeholder, tags, variant, className, "data-testid": dataTestId, }: TagInputProps) => _emotion_react_jsx_runtime.JSX.Element;
|
|
2567
2586
|
|
|
2568
2587
|
type TagListProps = {
|
|
2569
2588
|
/**
|
|
@@ -2592,7 +2611,7 @@ type TagListProps = {
|
|
|
2592
2611
|
/**
|
|
2593
2612
|
* This component is used to display a list of tags with a threshold and a popover when there are too many tags.
|
|
2594
2613
|
*/
|
|
2595
|
-
declare const TagList: ({ maxLength, tags, threshold, multiline, popoverTitle, copiable, copyText, copiedText, className, "data-testid": dataTestId, }: TagListProps) => JSX.Element | null;
|
|
2614
|
+
declare const TagList: ({ maxLength, tags, threshold, multiline, popoverTitle, copiable, copyText, copiedText, className, "data-testid": dataTestId, }: TagListProps) => _emotion_react_jsx_runtime.JSX.Element | null;
|
|
2596
2615
|
|
|
2597
2616
|
declare const PROMINENCES: {
|
|
2598
2617
|
default: string;
|
|
@@ -2794,7 +2813,7 @@ declare const ToggleGroup: {
|
|
|
2794
2813
|
Toggle: ({ disabled, name, value, label, helper, className, "data-testid": dataTestId, }: ToggleGroupToggleProps) => _emotion_react_jsx_runtime.JSX.Element;
|
|
2795
2814
|
};
|
|
2796
2815
|
|
|
2797
|
-
type TooltipProps = Pick<ComponentProps<typeof Popup>, 'id' | 'children' | 'maxWidth' | 'placement' | 'text' | 'className' | 'visible' | 'innerRef' | 'role' | 'data-testid' | 'containerFullWidth'>;
|
|
2816
|
+
type TooltipProps = Pick<ComponentProps<typeof Popup>, 'id' | 'children' | 'maxWidth' | 'placement' | 'text' | 'className' | 'visible' | 'innerRef' | 'role' | 'data-testid' | 'containerFullWidth' | 'portalTarget'>;
|
|
2798
2817
|
/**
|
|
2799
2818
|
* Tooltip component is used to display additional information on hover or focus.
|
|
2800
2819
|
* It is used to explain the purpose of the element it is attached to.
|
|
@@ -2832,7 +2851,7 @@ type VerificationCodeProps = {
|
|
|
2832
2851
|
/**
|
|
2833
2852
|
* Verification code allows you to enter a code in multiple fields (4 by default).
|
|
2834
2853
|
*/
|
|
2835
|
-
declare const VerificationCode: ({ disabled, className, error, fields, initialValue, inputId, inputStyle, onChange, onComplete, placeholder, required, type, "data-testid": dataTestId, "aria-label": ariaLabel, }: VerificationCodeProps) => JSX.Element;
|
|
2854
|
+
declare const VerificationCode: ({ disabled, className, error, fields, initialValue, inputId, inputStyle, onChange, onComplete, placeholder, required, type, "data-testid": dataTestId, "aria-label": ariaLabel, }: VerificationCodeProps) => _emotion_react_jsx_runtime.JSX.Element;
|
|
2836
2855
|
|
|
2837
2856
|
type RadioGroupRadioProps = Omit<ComponentProps<typeof Radio>, 'onChange' | 'checked' | 'required'>;
|
|
2838
2857
|
type RadioGroupProps = {
|
|
@@ -2873,6 +2892,11 @@ type MenuProps = {
|
|
|
2873
2892
|
'data-testid'?: string;
|
|
2874
2893
|
maxHeight?: string;
|
|
2875
2894
|
maxWidth?: string;
|
|
2895
|
+
/**
|
|
2896
|
+
* By default, the portal target is children container or document.body if children is a function. You can override this
|
|
2897
|
+
* behavior by setting a portalTarget prop.
|
|
2898
|
+
*/
|
|
2899
|
+
portalTarget?: HTMLElement;
|
|
2876
2900
|
};
|
|
2877
2901
|
/**
|
|
2878
2902
|
* A menu is a widget that offers a list of choices to the user, such as a set of actions or functions.
|
|
@@ -7,12 +7,6 @@ import { Stack } from '../Stack/index.js';
|
|
|
7
7
|
import { Text } from '../Text/index.js';
|
|
8
8
|
import defaultIllustrationSmall from './assets/default-image-small.svg.js';
|
|
9
9
|
import defaultIllustration from './assets/default-image.svg.js';
|
|
10
|
-
import introCompactLeftPattern from './assets/intro-compact-left-pattern.svg.js';
|
|
11
|
-
import introCompactRightPattern from './assets/intro-compact-right-pattern.svg.js';
|
|
12
|
-
import introPattern from './assets/intro-pattern.svg.js';
|
|
13
|
-
import promotionCompactLeftPattern from './assets/promotion-compact-left-pattern.svg.js';
|
|
14
|
-
import promotionCompactRightPattern from './assets/promotion-compact-right-pattern.svg.js';
|
|
15
|
-
import promotionPattern from './assets/promotion-pattern.svg.js';
|
|
16
10
|
import { jsxs, jsx } from '@emotion/react/jsx-runtime';
|
|
17
11
|
|
|
18
12
|
const styles = _ref => {
|
|
@@ -23,18 +17,18 @@ const styles = _ref => {
|
|
|
23
17
|
} = _ref;
|
|
24
18
|
if (size === 'small') {
|
|
25
19
|
if (variant === 'intro') {
|
|
26
|
-
return /*#__PURE__*/css("background:", theme.colors.primary.background, ";background-
|
|
20
|
+
return /*#__PURE__*/css("background:", theme.colors.primary.background, ";background-position:left,right;background-repeat:no-repeat,no-repeat;background-size:contain,contain;");
|
|
27
21
|
}
|
|
28
22
|
if (variant === 'promotional') {
|
|
29
|
-
return /*#__PURE__*/css("background-image:
|
|
23
|
+
return /*#__PURE__*/css("background-position:left,right;background-image:", theme.colors.other.gradients.background.aqua, ";background-repeat:no-repeat,no-repeat;background-size:contain,contain;");
|
|
30
24
|
}
|
|
31
25
|
}
|
|
32
26
|
if (size === 'medium') {
|
|
33
27
|
if (variant === 'intro') {
|
|
34
|
-
return /*#__PURE__*/css("background:", theme.colors.primary.background, ";background-
|
|
28
|
+
return /*#__PURE__*/css("background:", theme.colors.primary.background, ";background-position:right;background-repeat:no-repeat;background-size:contain;");
|
|
35
29
|
}
|
|
36
30
|
if (variant === 'promotional') {
|
|
37
|
-
return /*#__PURE__*/css("background-image:
|
|
31
|
+
return /*#__PURE__*/css("background-image:", theme.colors.other.gradients.background.aqua, ";background-position:right;background-repeat:no-repeat;background-size:contain;");
|
|
38
32
|
}
|
|
39
33
|
}
|
|
40
34
|
return null;
|
|
@@ -149,7 +143,7 @@ const Banner = _ref8 => {
|
|
|
149
143
|
prominence: variant === 'intro' || variant === 'promotional' && theme !== 'light' ? 'default' : 'stronger',
|
|
150
144
|
children: children
|
|
151
145
|
})]
|
|
152
|
-
}), jsxs(Stack, {
|
|
146
|
+
}), buttonText || linkText ? jsxs(Stack, {
|
|
153
147
|
direction: "row",
|
|
154
148
|
gap: 2,
|
|
155
149
|
alignItems: "center",
|
|
@@ -167,7 +161,7 @@ const Banner = _ref8 => {
|
|
|
167
161
|
prominence: variant === 'intro' || theme !== 'light' ? 'default' : 'strong',
|
|
168
162
|
children: linkText
|
|
169
163
|
}) : null]
|
|
170
|
-
})]
|
|
164
|
+
}) : null]
|
|
171
165
|
}), closable ? jsx(Button, {
|
|
172
166
|
icon: "close",
|
|
173
167
|
size: "small",
|
|
@@ -53,7 +53,8 @@ const FwdMenu = /*#__PURE__*/forwardRef((_ref7, ref) => {
|
|
|
53
53
|
className,
|
|
54
54
|
'data-testid': dataTestId,
|
|
55
55
|
maxHeight,
|
|
56
|
-
maxWidth
|
|
56
|
+
maxWidth,
|
|
57
|
+
portalTarget
|
|
57
58
|
} = _ref7;
|
|
58
59
|
const [isVisible, setIsVisible] = useState(visible);
|
|
59
60
|
const popupRef = useRef(null);
|
|
@@ -67,27 +68,8 @@ const FwdMenu = /*#__PURE__*/forwardRef((_ref7, ref) => {
|
|
|
67
68
|
});
|
|
68
69
|
const innerRef = useRef(target);
|
|
69
70
|
useImperativeHandle(ref, () => innerRef.current);
|
|
70
|
-
const toggleVisible = () => {
|
|
71
|
-
setIsVisible(!isVisible);
|
|
72
|
-
|
|
73
|
-
// Focus the first item when the menu is opened
|
|
74
|
-
if (!isVisible) {
|
|
75
|
-
setTimeout(() => {
|
|
76
|
-
// We have to wait for the popup to be inserted in the DOM
|
|
77
|
-
if (popupRef.current?.firstChild?.firstChild instanceof HTMLElement) {
|
|
78
|
-
popupRef.current.firstChild.firstChild.focus();
|
|
79
|
-
}
|
|
80
|
-
}, 1);
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
const onClose = () => {
|
|
84
|
-
setIsVisible(false);
|
|
85
|
-
|
|
86
|
-
// Focus the disclosure when the menu is closed
|
|
87
|
-
disclosureRef.current?.focus();
|
|
88
|
-
};
|
|
89
71
|
const finalDisclosure = /*#__PURE__*/cloneElement(target, {
|
|
90
|
-
onClick:
|
|
72
|
+
onClick: () => setIsVisible(!isVisible),
|
|
91
73
|
'aria-haspopup': 'dialog',
|
|
92
74
|
'aria-expanded': isVisible,
|
|
93
75
|
// @ts-expect-error not sure how to fix this
|
|
@@ -105,7 +87,7 @@ const FwdMenu = /*#__PURE__*/forwardRef((_ref7, ref) => {
|
|
|
105
87
|
role: "dialog",
|
|
106
88
|
id: finalId,
|
|
107
89
|
ref: popupRef,
|
|
108
|
-
onClose:
|
|
90
|
+
onClose: () => setIsVisible(false),
|
|
109
91
|
tabIndex: -1,
|
|
110
92
|
maxHeight: maxHeight,
|
|
111
93
|
maxWidth: maxWidth,
|
|
@@ -114,9 +96,10 @@ const FwdMenu = /*#__PURE__*/forwardRef((_ref7, ref) => {
|
|
|
114
96
|
className: className,
|
|
115
97
|
role: "menu",
|
|
116
98
|
children: typeof children === 'function' ? children({
|
|
117
|
-
toggle:
|
|
99
|
+
toggle: () => setIsVisible(!isVisible)
|
|
118
100
|
}) : children
|
|
119
101
|
}),
|
|
102
|
+
portalTarget: portalTarget,
|
|
120
103
|
children: finalDisclosure
|
|
121
104
|
});
|
|
122
105
|
});
|
|
@@ -11,7 +11,7 @@ const StyledBackdrop = /*#__PURE__*/_styled("div", {
|
|
|
11
11
|
theme
|
|
12
12
|
} = _ref;
|
|
13
13
|
return theme.colors.overlay;
|
|
14
|
-
}, ";&[data-open='true']{padding:", _ref2 => {
|
|
14
|
+
}, ";z-index:1;&[data-open='true']{padding:", _ref2 => {
|
|
15
15
|
let {
|
|
16
16
|
theme
|
|
17
17
|
} = _ref2;
|
|
@@ -175,7 +175,7 @@ const Dialog = _ref9 => {
|
|
|
175
175
|
event.preventDefault();
|
|
176
176
|
event.stopPropagation();
|
|
177
177
|
};
|
|
178
|
-
return /*#__PURE__*/createPortal(jsx(StyledBackdrop, {
|
|
178
|
+
return open ? /*#__PURE__*/createPortal(jsx(StyledBackdrop, {
|
|
179
179
|
"data-open": open,
|
|
180
180
|
onClick: handleClose,
|
|
181
181
|
className: backdropClassName,
|
|
@@ -201,7 +201,7 @@ const Dialog = _ref9 => {
|
|
|
201
201
|
tabIndex: 0,
|
|
202
202
|
children: open ? children : null
|
|
203
203
|
})
|
|
204
|
-
}), containerRef.current);
|
|
204
|
+
}), containerRef.current) : null;
|
|
205
205
|
};
|
|
206
206
|
|
|
207
207
|
export { Dialog };
|
|
@@ -72,10 +72,6 @@ const ContentWrapper = _ref6 => {
|
|
|
72
72
|
children,
|
|
73
73
|
sentiment
|
|
74
74
|
} = _ref6;
|
|
75
|
-
const buttonRef = useRef(null);
|
|
76
|
-
useEffect(() => {
|
|
77
|
-
buttonRef.current?.focus();
|
|
78
|
-
}, []);
|
|
79
75
|
return jsxs(StyledStack, {
|
|
80
76
|
gap: 1,
|
|
81
77
|
children: [jsxs(Stack, {
|
|
@@ -93,8 +89,7 @@ const ContentWrapper = _ref6 => {
|
|
|
93
89
|
onClick: onClose,
|
|
94
90
|
size: "small",
|
|
95
91
|
icon: "close",
|
|
96
|
-
"aria-label": "close"
|
|
97
|
-
ref: buttonRef
|
|
92
|
+
"aria-label": "close"
|
|
98
93
|
})]
|
|
99
94
|
}), typeof children === 'string' ? jsx(Text, {
|
|
100
95
|
variant: "bodySmall",
|
|
@@ -122,7 +117,8 @@ const Popover = /*#__PURE__*/forwardRef((_ref7, ref) => {
|
|
|
122
117
|
className,
|
|
123
118
|
maxWidth,
|
|
124
119
|
maxHeight,
|
|
125
|
-
'data-testid': dataTestId
|
|
120
|
+
'data-testid': dataTestId,
|
|
121
|
+
portalTarget
|
|
126
122
|
} = _ref7;
|
|
127
123
|
const innerRef = useRef(null);
|
|
128
124
|
const [localVisible, setLocalVisible] = useState(visible);
|
|
@@ -131,21 +127,9 @@ const Popover = /*#__PURE__*/forwardRef((_ref7, ref) => {
|
|
|
131
127
|
useEffect(() => {
|
|
132
128
|
setLocalVisible(visible);
|
|
133
129
|
}, [visible]);
|
|
134
|
-
|
|
135
|
-
// When space key is pressed we show the popover
|
|
136
|
-
const onKeyDownSpace = useCallback(event => {
|
|
137
|
-
if (event.code === 'Space') {
|
|
138
|
-
event.preventDefault();
|
|
139
|
-
event.stopPropagation();
|
|
140
|
-
setLocalVisible(true);
|
|
141
|
-
}
|
|
142
|
-
}, []);
|
|
143
|
-
|
|
144
|
-
// When we close we hide the popover and focus the disclosure element
|
|
145
130
|
const localOnClose = useCallback(() => {
|
|
146
131
|
setLocalVisible(false);
|
|
147
132
|
onClose?.();
|
|
148
|
-
innerRef.current?.focus();
|
|
149
133
|
}, [onClose]);
|
|
150
134
|
return jsx(StyledPopup, {
|
|
151
135
|
hideOnClickOutside: true,
|
|
@@ -164,11 +148,12 @@ const Popover = /*#__PURE__*/forwardRef((_ref7, ref) => {
|
|
|
164
148
|
size: size,
|
|
165
149
|
role: "dialog",
|
|
166
150
|
ref: ref,
|
|
151
|
+
tabIndex: -1,
|
|
167
152
|
innerRef: innerRef,
|
|
168
153
|
onClose: localOnClose,
|
|
169
|
-
onKeyDown: onKeyDownSpace,
|
|
170
154
|
maxWidth: maxWidth,
|
|
171
155
|
maxHeight: maxHeight,
|
|
156
|
+
portalTarget: portalTarget,
|
|
172
157
|
children: children
|
|
173
158
|
});
|
|
174
159
|
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { keyframes } from '@emotion/react';
|
|
2
|
+
|
|
3
|
+
const animation = positions => keyframes`
|
|
4
|
+
0% {
|
|
5
|
+
opacity: 0;
|
|
6
|
+
transform: ${positions.popupInitialPosition};
|
|
7
|
+
}
|
|
8
|
+
100% {
|
|
9
|
+
opacity: 1;
|
|
10
|
+
transform: ${positions.popupPosition};
|
|
11
|
+
}
|
|
12
|
+
`;
|
|
13
|
+
const exitAnimation = positions => keyframes`
|
|
14
|
+
0% {
|
|
15
|
+
opacity: 1;
|
|
16
|
+
transform: ${positions.popupPosition};
|
|
17
|
+
}
|
|
18
|
+
100% {
|
|
19
|
+
opacity: 0;
|
|
20
|
+
transform: ${positions.popupInitialPosition};
|
|
21
|
+
}
|
|
22
|
+
`;
|
|
23
|
+
|
|
24
|
+
export { animation, exitAnimation };
|