@ultraviolet/ui 1.48.1 → 1.50.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 CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react from 'react';
2
- import react__default, { ReactNode, ComponentProps, ButtonHTMLAttributes, AriaRole, MouseEventHandler, JSX, MouseEvent, InputHTMLAttributes, FocusEvent, HTMLAttributeAnchorTarget, AnchorHTMLAttributes, Dispatch, SetStateAction, ReactElement, Ref, RefObject, KeyboardEventHandler, HTMLAttributes, CSSProperties, ChangeEventHandler, FocusEventHandler, ForwardRefExoticComponent, ForwardedRef, ElementType, DOMAttributes, TextareaHTMLAttributes } from 'react';
2
+ import react__default, { ReactNode, ComponentProps, ButtonHTMLAttributes, AriaRole, MouseEventHandler, JSX, MouseEvent, InputHTMLAttributes, FocusEvent, ReactElement, HTMLAttributeAnchorTarget, AnchorHTMLAttributes, Dispatch, SetStateAction, Ref, RefObject, KeyboardEventHandler, HTMLAttributes, CSSProperties, ChangeEventHandler, FocusEventHandler, ForwardRefExoticComponent, ForwardedRef, ElementType, DOMAttributes, 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';
@@ -1638,6 +1638,157 @@ type DateInputProps = Pick<ReactDatePickerProps<string, boolean>, 'locale' | 'on
1638
1638
  */
1639
1639
  declare const DateInput: ({ autoFocus, disabled, error, format, label, labelDescription, locale, maxDate, minDate, startDate, endDate, name, onBlur, onChange, onFocus, required, excludeDates, value, selectsRange, className, id, success, helper, size, readOnly, tooltip, "data-testid": dataTestId, }: DateInputProps) => _emotion_react_jsx_runtime.JSX.Element;
1640
1640
 
1641
+ type ModalSize = 'large' | 'medium' | 'small' | 'xsmall' | 'xxsmall';
1642
+ type ModalPlacement = 'bottom' | 'bottom-left' | 'bottom-right' | 'center' | 'top' | 'top-left' | 'top-right' | 'right' | 'left';
1643
+ type ModalState = {
1644
+ /**
1645
+ * @deprecated use show
1646
+ */
1647
+ onOpen: () => void;
1648
+ /**
1649
+ * @deprecated use close
1650
+ */
1651
+ onClose: () => void;
1652
+ toggle: () => void;
1653
+ visible: boolean;
1654
+ modalId: string;
1655
+ /**
1656
+ * @deprecated use close
1657
+ */
1658
+ hide: () => void;
1659
+ close: () => void;
1660
+ show: () => void;
1661
+ };
1662
+
1663
+ type ModalProps = {
1664
+ id?: string;
1665
+ hideOnEsc?: boolean;
1666
+ hideOnClickOutside?: boolean;
1667
+ preventBodyScroll?: boolean;
1668
+ ariaLabel?: string;
1669
+ disclosure?: ReactElement | ((state: ModalState) => ReactElement);
1670
+ isClosable?: boolean;
1671
+ onClose?: () => void;
1672
+ onBeforeClose?: () => Promise<void> | void;
1673
+ open?: boolean;
1674
+ /**
1675
+ * @deprecated You should use open prop instead
1676
+ */
1677
+ opened?: boolean;
1678
+ placement?: ModalPlacement;
1679
+ size?: ModalSize;
1680
+ /**
1681
+ * @deprecated You should use size prop instead
1682
+ */
1683
+ width?: ModalSize;
1684
+ children: ReactNode | ((args: ModalState) => ReactNode);
1685
+ className?: string;
1686
+ 'data-testid'?: string;
1687
+ backdropClassName?: string;
1688
+ /**
1689
+ * @deprecated You should use backdropClassName instead
1690
+ */
1691
+ customDialogBackdropStyles?: react__default.JSX.IntrinsicAttributes['css'];
1692
+ /**
1693
+ * @deprecated You should use className instead
1694
+ */
1695
+ customDialogStyles?: react__default.JSX.IntrinsicAttributes['css'];
1696
+ };
1697
+ /**
1698
+ * Modal is a component that allows you to display content on top of other content.
1699
+ * It is often used to display a dialog with additional information or to ask for a confirmation.
1700
+ */
1701
+ declare const Modal: ({ ariaLabel, id, children, disclosure, hideOnClickOutside, hideOnEsc, isClosable, onClose, onBeforeClose, open, opened, placement, preventBodyScroll, size, className, "data-testid": dataTestId, backdropClassName, width, customDialogStyles, customDialogBackdropStyles, }: ModalProps) => _emotion_react_jsx_runtime.JSX.Element;
1702
+
1703
+ declare const DIALOG_SENTIMENTS: ("primary" | "success" | "danger" | "warning")[];
1704
+ type DialogSentiment = (typeof DIALOG_SENTIMENTS)[number];
1705
+
1706
+ type DialogContextType = {
1707
+ sentiment: DialogSentiment;
1708
+ };
1709
+
1710
+ type DialogProps = Pick<ComponentProps<typeof Modal>, 'ariaLabel' | 'children' | 'className' | 'data-testid' | 'disclosure' | 'hideOnClickOutside' | 'hideOnEsc' | 'id' | 'isClosable' | 'onBeforeClose' | 'onClose' | 'open' | 'placement'> & {
1711
+ title: string;
1712
+ sentiment: DialogSentiment;
1713
+ };
1714
+ /**
1715
+ * The Dialog component is used to show content on top of an overlay that requires user interaction.
1716
+ * @experimental This component is experimental and may be subject to breaking changes in the future.
1717
+ */
1718
+ declare const Dialog: (({ ariaLabel, className, children, "data-testid": dataTestId, disclosure, hideOnClickOutside, hideOnEsc, id, isClosable, onBeforeClose, onClose, open, placement, sentiment, title, }: DialogProps) => _emotion_react_jsx_runtime.JSX.Element) & {
1719
+ Buttons: ({ secondaryButton, primaryButton, }: {
1720
+ secondaryButton: react.ReactNode;
1721
+ primaryButton: react.ReactNode;
1722
+ }) => _emotion_react_jsx_runtime.JSX.Element;
1723
+ Button: ({ children, onClick, disabled, tooltip, }: {
1724
+ children: react.ReactNode;
1725
+ } & Pick<({
1726
+ type?: "button" | "reset" | "submit" | undefined;
1727
+ autoFocus?: boolean | undefined;
1728
+ variant?: "filled" | "outlined" | "ghost" | undefined;
1729
+ role?: react.AriaRole | undefined;
1730
+ size?: "large" | "small" | "xsmall" | "medium" | undefined;
1731
+ className?: string | undefined;
1732
+ 'data-testid'?: string | undefined;
1733
+ sentiment?: "primary" | "secondary" | "neutral" | "success" | "danger" | "warning" | "info" | undefined;
1734
+ disabled?: boolean | undefined;
1735
+ iconPosition?: "left" | "right" | undefined;
1736
+ iconVariant?: "filled" | "outlined" | undefined;
1737
+ fullWidth?: boolean | undefined;
1738
+ isLoading?: boolean | undefined;
1739
+ 'aria-label'?: string | undefined;
1740
+ 'aria-current'?: boolean | undefined;
1741
+ 'aria-controls'?: string | undefined;
1742
+ 'aria-expanded'?: boolean | undefined;
1743
+ 'aria-haspopup'?: boolean | undefined;
1744
+ onClick?: react.MouseEventHandler<HTMLElement> | undefined;
1745
+ tooltip?: string | undefined;
1746
+ tabIndex?: number | undefined;
1747
+ onMouseDown?: react.MouseEventHandler<HTMLElement> | undefined;
1748
+ onMouseUp?: react.MouseEventHandler<HTMLElement> | undefined;
1749
+ onMouseOut?: react.MouseEventHandler<HTMLElement> | undefined;
1750
+ } & ({
1751
+ children: react.ReactNode;
1752
+ icon?: "address" | "search" | "filter" | "view" | "id" | "alert" | "x" | "anchor" | "cancel" | "close" | "sort" | "download" | "arrow-down" | "arrow-left-bottom" | "arrow-left-double" | "arrow-left" | "arrow-right-bottom" | "arrow-right-double" | "arrow-right" | "arrow-up" | "asterisk" | "attach" | "burger" | "check" | "close-circle-outline" | "copy-content" | "detach" | "dots-horizontal" | "dots-vertical" | "drag-vertical" | "drag-variant" | "east" | "equal" | "escape" | "expand" | "expand-more" | "github" | "instagram" | "linkedIn" | "logout" | "minus" | "north" | "open-in-new" | "organization" | "plus" | "progress-check" | "ray-end-arrow" | "ray-start-arrow" | "ray-start-end" | "ray-top-arrow" | "reboot" | "restore" | "revoke" | "rss" | "send" | "slack" | "south" | "switch_orga" | "upload" | "west" | "youtube" | "auto-fix" | "book-open-outline" | "bullhorn" | "calculator" | "calendar-range" | "chat" | "checkbox-circle-outline" | "clock-outline" | "console" | "credentials" | "credit-card" | "database" | "delete" | "doc" | "earth" | "email-remove-outline" | "email-outline" | "eye-off" | "eye" | "folder" | "help-circle-outline" | "information-outline" | "lock" | "members" | "moon" | "mosaic" | "pen" | "pencil" | "phone" | "play-circle-outline" | "privacy" | "profile" | "rocket" | "settings" | "sun" | "support" | "unlock" | "weather-night" | "pin" | "unpin" | undefined;
1753
+ name?: string | undefined;
1754
+ href?: undefined;
1755
+ target?: undefined;
1756
+ download?: undefined;
1757
+ } | {
1758
+ children?: undefined;
1759
+ icon: "address" | "search" | "filter" | "view" | "id" | "alert" | "x" | "anchor" | "cancel" | "close" | "sort" | "download" | "arrow-down" | "arrow-left-bottom" | "arrow-left-double" | "arrow-left" | "arrow-right-bottom" | "arrow-right-double" | "arrow-right" | "arrow-up" | "asterisk" | "attach" | "burger" | "check" | "close-circle-outline" | "copy-content" | "detach" | "dots-horizontal" | "dots-vertical" | "drag-vertical" | "drag-variant" | "east" | "equal" | "escape" | "expand" | "expand-more" | "github" | "instagram" | "linkedIn" | "logout" | "minus" | "north" | "open-in-new" | "organization" | "plus" | "progress-check" | "ray-end-arrow" | "ray-start-arrow" | "ray-start-end" | "ray-top-arrow" | "reboot" | "restore" | "revoke" | "rss" | "send" | "slack" | "south" | "switch_orga" | "upload" | "west" | "youtube" | "auto-fix" | "book-open-outline" | "bullhorn" | "calculator" | "calendar-range" | "chat" | "checkbox-circle-outline" | "clock-outline" | "console" | "credentials" | "credit-card" | "database" | "delete" | "doc" | "earth" | "email-remove-outline" | "email-outline" | "eye-off" | "eye" | "folder" | "help-circle-outline" | "information-outline" | "lock" | "members" | "moon" | "mosaic" | "pen" | "pencil" | "phone" | "play-circle-outline" | "privacy" | "profile" | "rocket" | "settings" | "sun" | "support" | "unlock" | "weather-night" | "pin" | "unpin" | undefined;
1760
+ name?: string | undefined;
1761
+ href?: undefined;
1762
+ target?: undefined;
1763
+ download?: undefined;
1764
+ } | {
1765
+ children: react.ReactNode;
1766
+ icon?: "address" | "search" | "filter" | "view" | "id" | "alert" | "x" | "anchor" | "cancel" | "close" | "sort" | "download" | "arrow-down" | "arrow-left-bottom" | "arrow-left-double" | "arrow-left" | "arrow-right-bottom" | "arrow-right-double" | "arrow-right" | "arrow-up" | "asterisk" | "attach" | "burger" | "check" | "close-circle-outline" | "copy-content" | "detach" | "dots-horizontal" | "dots-vertical" | "drag-vertical" | "drag-variant" | "east" | "equal" | "escape" | "expand" | "expand-more" | "github" | "instagram" | "linkedIn" | "logout" | "minus" | "north" | "open-in-new" | "organization" | "plus" | "progress-check" | "ray-end-arrow" | "ray-start-arrow" | "ray-start-end" | "ray-top-arrow" | "reboot" | "restore" | "revoke" | "rss" | "send" | "slack" | "south" | "switch_orga" | "upload" | "west" | "youtube" | "auto-fix" | "book-open-outline" | "bullhorn" | "calculator" | "calendar-range" | "chat" | "checkbox-circle-outline" | "clock-outline" | "console" | "credentials" | "credit-card" | "database" | "delete" | "doc" | "earth" | "email-remove-outline" | "email-outline" | "eye-off" | "eye" | "folder" | "help-circle-outline" | "information-outline" | "lock" | "members" | "moon" | "mosaic" | "pen" | "pencil" | "phone" | "play-circle-outline" | "privacy" | "profile" | "rocket" | "settings" | "sun" | "support" | "unlock" | "weather-night" | "pin" | "unpin" | undefined;
1767
+ name?: undefined;
1768
+ href: string;
1769
+ target?: string | undefined;
1770
+ download?: string | undefined;
1771
+ } | {
1772
+ children?: undefined;
1773
+ icon: "address" | "search" | "filter" | "view" | "id" | "alert" | "x" | "anchor" | "cancel" | "close" | "sort" | "download" | "arrow-down" | "arrow-left-bottom" | "arrow-left-double" | "arrow-left" | "arrow-right-bottom" | "arrow-right-double" | "arrow-right" | "arrow-up" | "asterisk" | "attach" | "burger" | "check" | "close-circle-outline" | "copy-content" | "detach" | "dots-horizontal" | "dots-vertical" | "drag-vertical" | "drag-variant" | "east" | "equal" | "escape" | "expand" | "expand-more" | "github" | "instagram" | "linkedIn" | "logout" | "minus" | "north" | "open-in-new" | "organization" | "plus" | "progress-check" | "ray-end-arrow" | "ray-start-arrow" | "ray-start-end" | "ray-top-arrow" | "reboot" | "restore" | "revoke" | "rss" | "send" | "slack" | "south" | "switch_orga" | "upload" | "west" | "youtube" | "auto-fix" | "book-open-outline" | "bullhorn" | "calculator" | "calendar-range" | "chat" | "checkbox-circle-outline" | "clock-outline" | "console" | "credentials" | "credit-card" | "database" | "delete" | "doc" | "earth" | "email-remove-outline" | "email-outline" | "eye-off" | "eye" | "folder" | "help-circle-outline" | "information-outline" | "lock" | "members" | "moon" | "mosaic" | "pen" | "pencil" | "phone" | "play-circle-outline" | "privacy" | "profile" | "rocket" | "settings" | "sun" | "support" | "unlock" | "weather-night" | "pin" | "unpin" | undefined;
1774
+ name?: undefined;
1775
+ href: string;
1776
+ target?: string | undefined;
1777
+ download?: string | undefined;
1778
+ })) & react.RefAttributes<Element>, "tooltip" | "onClick" | "disabled">) => _emotion_react_jsx_runtime.JSX.Element;
1779
+ CancelButton: ({ children, onClick, }: {
1780
+ children: react.ReactNode;
1781
+ onClick: react.MouseEventHandler<HTMLElement> | undefined;
1782
+ }) => _emotion_react_jsx_runtime.JSX.Element;
1783
+ Stack: ({ children }: {
1784
+ children: react.ReactNode;
1785
+ }) => _emotion_react_jsx_runtime.JSX.Element;
1786
+ Text: ({ children }: {
1787
+ children: react.ReactNode;
1788
+ }) => _emotion_react_jsx_runtime.JSX.Element;
1789
+ useDialogContext: () => DialogContextType;
1790
+ };
1791
+
1641
1792
  declare const CONTAINER_SIZES: {
1642
1793
  readonly small: 720;
1643
1794
  readonly medium: 720;
@@ -1941,64 +2092,6 @@ type PasswordStrengthMeterProps$1 = {
1941
2092
  */
1942
2093
  declare const Meter: ({ strength, title, value, className, "data-testid": dataTestId, id, }: PasswordStrengthMeterProps$1) => _emotion_react_jsx_runtime.JSX.Element;
1943
2094
 
1944
- type ModalSize = 'large' | 'medium' | 'small' | 'xsmall' | 'xxsmall';
1945
- type ModalPlacement = 'bottom' | 'bottom-left' | 'bottom-right' | 'center' | 'top' | 'top-left' | 'top-right' | 'right' | 'left';
1946
- type ModalState = {
1947
- /**
1948
- * @deprecated use show
1949
- */
1950
- onOpen: () => void;
1951
- /**
1952
- * @deprecated use close
1953
- */
1954
- onClose: () => void;
1955
- toggle: () => void;
1956
- visible: boolean;
1957
- modalId: string;
1958
- /**
1959
- * @deprecated use close
1960
- */
1961
- hide: () => void;
1962
- close: () => void;
1963
- show: () => void;
1964
- };
1965
-
1966
- type ModalProps = {
1967
- id?: string;
1968
- hideOnEsc?: boolean;
1969
- hideOnClickOutside?: boolean;
1970
- preventBodyScroll?: boolean;
1971
- ariaLabel?: string;
1972
- disclosure?: ReactElement | ((state: ModalState) => ReactElement);
1973
- isClosable?: boolean;
1974
- onClose?: () => void;
1975
- onBeforeClose?: () => Promise<void> | void;
1976
- opened?: boolean;
1977
- placement?: ModalPlacement;
1978
- size?: ModalSize;
1979
- /**
1980
- * @deprecated You should use size prop instead
1981
- */
1982
- width?: ModalSize;
1983
- children: ReactNode | ((args: ModalState) => ReactNode);
1984
- className?: string;
1985
- 'data-testid'?: string;
1986
- backdropClassName?: string;
1987
- /**
1988
- * @deprecated You should use backdropClassName instead
1989
- */
1990
- customDialogBackdropStyles?: react__default.JSX.IntrinsicAttributes['css'];
1991
- /**
1992
- * @deprecated You should use className instead
1993
- */
1994
- customDialogStyles?: react__default.JSX.IntrinsicAttributes['css'];
1995
- };
1996
- /**
1997
- * Modal is a component that allows you to display content on top of other content.
1998
- * It is often used to display a dialog with additional information or to ask for a confirmation.
1999
- */
2000
- declare const Modal: ({ ariaLabel, id, children, disclosure, hideOnClickOutside, hideOnEsc, isClosable, onClose, onBeforeClose, opened, placement, preventBodyScroll, size, className, "data-testid": dataTestId, backdropClassName, width, customDialogStyles, customDialogBackdropStyles, }: ModalProps) => _emotion_react_jsx_runtime.JSX.Element;
2001
-
2002
2095
  type NoticeProps = {
2003
2096
  children: ReactNode;
2004
2097
  className?: string;
@@ -3441,15 +3534,11 @@ type OptionType = {
3441
3534
  };
3442
3535
  type DataType = Record<string, OptionType[]> | OptionType[];
3443
3536
 
3444
- type SelectInputV2Props = {
3537
+ type SelectInputV2Props<IsMulti extends undefined | boolean = false> = {
3445
3538
  /**
3446
3539
  * Input name
3447
3540
  */
3448
3541
  name: string;
3449
- /**
3450
- * Default value, must be one of the options
3451
- */
3452
- value?: OptionType;
3453
3542
  /**
3454
3543
  * Place holder when no value defined
3455
3544
  */
@@ -3494,10 +3583,6 @@ type SelectInputV2Props = {
3494
3583
  * Size of the input
3495
3584
  */
3496
3585
  size?: 'small' | 'medium' | 'large';
3497
- /**
3498
- * Whether it is possible to select multiple options
3499
- */
3500
- multiselect?: boolean;
3501
3586
  /**
3502
3587
  * Whether field is required
3503
3588
  */
@@ -3546,13 +3631,21 @@ type SelectInputV2Props = {
3546
3631
  */
3547
3632
  selectAllGroup?: boolean;
3548
3633
  autofocus?: boolean;
3634
+ /**
3635
+ * Whether it is possible to select multiple options
3636
+ */
3637
+ multiselect?: IsMulti;
3638
+ /**
3639
+ * Default value, must be one of the options
3640
+ */
3641
+ value?: IsMulti extends true ? string[] : string;
3642
+ onChange?: IsMulti extends true ? (value: string[]) => void : (value: string) => void;
3549
3643
  'data-testid'?: string;
3550
- onChange?: (value: string[]) => void;
3551
3644
  } & Pick<HTMLAttributes<HTMLDivElement>, 'id' | 'onBlur' | 'onFocus' | 'aria-label' | 'className'>;
3552
3645
  /**
3553
3646
  * SelectInputV2 component is used to select one or many elements from a selection.
3554
3647
  */
3555
- declare const SelectInputV2: ({ name, id, onBlur, onFocus, onChange, "aria-label": ariaLabel, value, label, helper, options, size, emptyState, descriptionDirection, success, error, "data-testid": dataTestId, className, footer, placeholderSearch, placeholder, searchable, disabled, readOnly, clearable, multiselect, required, labelDescription, autofocus, loadMore, optionalInfoPlacement, isLoading, selectAll, selectAllGroup, }: SelectInputV2Props) => _emotion_react_jsx_runtime.JSX.Element;
3648
+ declare const SelectInputV2: <IsMulti extends boolean | undefined>({ name, id, onBlur, onFocus, onChange, "aria-label": ariaLabel, value, label, helper, options, size, emptyState, descriptionDirection, success, error, "data-testid": dataTestId, className, footer, placeholderSearch, placeholder, searchable, disabled, readOnly, clearable, multiselect, required, labelDescription, autofocus, loadMore, optionalInfoPlacement, isLoading, selectAll, selectAllGroup, }: SelectInputV2Props<IsMulti>) => _emotion_react_jsx_runtime.JSX.Element;
3556
3649
 
3557
3650
  declare const getUUID: (prefix?: string) => string;
3558
3651
 
@@ -3597,4 +3690,4 @@ declare const down: (size: ScreenSize, rules: string) => string;
3597
3690
 
3598
3691
  declare const normalize: () => string;
3599
3692
 
3600
- export { ActionBar, Alert, Avatar, Badge, Banner, BarChart, BarStack, Breadcrumbs, Breakpoint, Bullet, Button, Card, Carousel, Checkbox, CheckboxGroup, CheckboxGroupCheckbox, CopyButton, DateInput, EmptyState, Expandable, GlobalAlert, LineChart, Link, List, Loader, Menu, MenuV2, Meter, Modal, Notice, NotificationContainer, NumberInput, NumberInputV2, Pagination, PasswordCheck, PasswordStrengthMeter, PieChart, Popover, Popup, ProgressBar, Radio, RadioGroup, Row, type SCWUITheme, SelectInput, SelectInputV2, SelectableCard, SelectableCardGroup, Separator, Skeleton, Snippet, Stack, Status, StepList, Stepper, SwitchButton, Table, Tabs, Tag, TagInput, TagList, Text, TextArea, TextInput, TextInputV2, TimeInput, ToastContainer, Toggle, ToggleGroup, Tooltip, type UltravioletUITheme, VerificationCode, bounce, down, extendTheme, fadeIn, fadeOut, flash, getUUID, normalize, notification, ping, pulse, quickScaleDown, scaleBack, scaleDown, scaleForward, scaleUp, sketchIn, sketchOut, slideDownLarge, slideFromBottom, slideFromLeft, slideFromRight, slideFromTop, slideToBottom, slideToLeft, slideToRight, slideToTop, slideUpLarge, toast, unfoldIn, unfoldOut, up, zoomIn, zoomOut };
3693
+ export { ActionBar, Alert, Avatar, Badge, Banner, BarChart, BarStack, Breadcrumbs, Breakpoint, Bullet, Button, Card, Carousel, Checkbox, CheckboxGroup, CheckboxGroupCheckbox, CopyButton, DateInput, Dialog, EmptyState, Expandable, GlobalAlert, LineChart, Link, List, Loader, Menu, MenuV2, Meter, Modal, Notice, NotificationContainer, NumberInput, NumberInputV2, Pagination, PasswordCheck, PasswordStrengthMeter, PieChart, Popover, Popup, ProgressBar, Radio, RadioGroup, Row, type SCWUITheme, SelectInput, SelectInputV2, SelectableCard, SelectableCardGroup, Separator, Skeleton, Snippet, Stack, Status, StepList, Stepper, SwitchButton, Table, Tabs, Tag, TagInput, TagList, Text, TextArea, TextInput, TextInputV2, TimeInput, ToastContainer, Toggle, ToggleGroup, Tooltip, type UltravioletUITheme, VerificationCode, bounce, down, extendTheme, fadeIn, fadeOut, flash, getUUID, normalize, notification, ping, pulse, quickScaleDown, scaleBack, scaleDown, scaleForward, scaleUp, sketchIn, sketchOut, slideDownLarge, slideFromBottom, slideFromLeft, slideFromRight, slideFromTop, slideToBottom, slideToLeft, slideToRight, slideToTop, slideUpLarge, toast, unfoldIn, unfoldOut, up, zoomIn, zoomOut };
@@ -89,7 +89,7 @@ const Bullet = ({
89
89
  prominence: prominence,
90
90
  children: icon ? jsx(Icon, {
91
91
  name: icon,
92
- size: "50%",
92
+ size: "small",
93
93
  variant: iconVariant
94
94
  }) : text
95
95
  })
@@ -0,0 +1,12 @@
1
+ import { useContext, createContext } from 'react';
2
+
3
+ const DialogContext = /*#__PURE__*/createContext(undefined);
4
+ const useDialogContext = () => {
5
+ const context = useContext(DialogContext);
6
+ if (!context) {
7
+ throw new Error('Dialog context can only be used inside a Dialog component');
8
+ }
9
+ return context;
10
+ };
11
+
12
+ export { DialogContext, useDialogContext };
@@ -0,0 +1,88 @@
1
+ import _styled from '@emotion/styled/base';
2
+ import { useMemo } from 'react';
3
+ import { Bullet } from '../Bullet/index.js';
4
+ import { Modal } from '../Modal/index.js';
5
+ import { Text } from '../Text/index.js';
6
+ import { useDialogContext, DialogContext } from './Context.js';
7
+ import { DialogButton } from './subComponents/Button.js';
8
+ import { DialogButtons } from './subComponents/Buttons.js';
9
+ import { DialogCancelButton } from './subComponents/CancelButton.js';
10
+ import { DialogStack } from './subComponents/Stack.js';
11
+ import { DialogText } from './subComponents/Text.js';
12
+ import { jsxs, Fragment, jsx } from '@emotion/react/jsx-runtime';
13
+
14
+ const StyledTextTitle = /*#__PURE__*/_styled(Text, {
15
+ target: "ehf9m9r0"
16
+ })("margin-top:", ({
17
+ theme
18
+ }) => theme.space['2'], ";margin-bottom:", ({
19
+ theme
20
+ }) => theme.space['1'], ";");
21
+ const BaseDialog = ({
22
+ ariaLabel,
23
+ className,
24
+ children,
25
+ 'data-testid': dataTestId,
26
+ disclosure,
27
+ hideOnClickOutside,
28
+ hideOnEsc,
29
+ id,
30
+ isClosable,
31
+ onBeforeClose,
32
+ onClose,
33
+ open,
34
+ placement,
35
+ sentiment,
36
+ title
37
+ }) => {
38
+ const headerContent = jsxs(Fragment, {
39
+ children: [jsx(Bullet, {
40
+ sentiment: sentiment,
41
+ icon: sentiment === 'warning' || sentiment === 'danger' ? 'information-outline' : 'check'
42
+ }), jsx(StyledTextTitle, {
43
+ as: "h2",
44
+ variant: "headingSmallStronger",
45
+ children: title
46
+ })]
47
+ });
48
+ const contextValue = useMemo(() => ({
49
+ sentiment
50
+ }), [sentiment]);
51
+ return jsx(Modal, {
52
+ ariaLabel: ariaLabel,
53
+ className: className,
54
+ "data-testid": dataTestId,
55
+ disclosure: disclosure,
56
+ hideOnClickOutside: hideOnClickOutside,
57
+ hideOnEsc: hideOnEsc,
58
+ id: id,
59
+ isClosable: isClosable,
60
+ onBeforeClose: onBeforeClose,
61
+ onClose: onClose,
62
+ open: open,
63
+ placement: placement,
64
+ size: "xsmall",
65
+ children: typeof children === 'function' ? modalProps => jsxs(DialogContext.Provider, {
66
+ value: contextValue,
67
+ children: [headerContent, children(modalProps)]
68
+ }) : jsxs(DialogContext.Provider, {
69
+ value: contextValue,
70
+ children: [headerContent, children]
71
+ })
72
+ });
73
+ };
74
+
75
+ /**
76
+ * The Dialog component is used to show content on top of an overlay that requires user interaction.
77
+ * @experimental This component is experimental and may be subject to breaking changes in the future.
78
+ */
79
+ const Dialog = /*#__PURE__*/Object.assign(BaseDialog, {
80
+ Buttons: DialogButtons,
81
+ Button: DialogButton,
82
+ CancelButton: DialogCancelButton,
83
+ Stack: DialogStack,
84
+ Text: DialogText,
85
+ useDialogContext
86
+ });
87
+
88
+ export { BaseDialog, Dialog };
@@ -0,0 +1,21 @@
1
+ import { Button } from '../../Button/index.js';
2
+ import { useDialogContext } from '../Context.js';
3
+ import { jsx } from '@emotion/react/jsx-runtime';
4
+
5
+ const DialogButton = ({
6
+ children,
7
+ onClick,
8
+ disabled,
9
+ tooltip
10
+ }) => {
11
+ const context = useDialogContext();
12
+ return jsx(Button, {
13
+ sentiment: context.sentiment,
14
+ onClick: onClick,
15
+ disabled: disabled,
16
+ tooltip: tooltip,
17
+ children: children
18
+ });
19
+ };
20
+
21
+ export { DialogButton };
@@ -0,0 +1,14 @@
1
+ import { Stack } from '../../Stack/index.js';
2
+ import { jsxs } from '@emotion/react/jsx-runtime';
3
+
4
+ const DialogButtons = ({
5
+ secondaryButton,
6
+ primaryButton
7
+ }) => jsxs(Stack, {
8
+ direction: "row",
9
+ gap: 2,
10
+ justifyContent: "end",
11
+ children: [secondaryButton, primaryButton]
12
+ });
13
+
14
+ export { DialogButtons };
@@ -0,0 +1,14 @@
1
+ import { Button } from '../../Button/index.js';
2
+ import { jsx } from '@emotion/react/jsx-runtime';
3
+
4
+ const DialogCancelButton = ({
5
+ children,
6
+ onClick
7
+ }) => jsx(Button, {
8
+ variant: "outlined",
9
+ sentiment: "neutral",
10
+ onClick: onClick,
11
+ children: children
12
+ });
13
+
14
+ export { DialogCancelButton };
@@ -0,0 +1,11 @@
1
+ import { Stack } from '../../Stack/index.js';
2
+ import { jsx } from '@emotion/react/jsx-runtime';
3
+
4
+ const DialogStack = ({
5
+ children
6
+ }) => jsx(Stack, {
7
+ gap: 3,
8
+ children: children
9
+ });
10
+
11
+ export { DialogStack };
@@ -0,0 +1,12 @@
1
+ import { Text } from '../../Text/index.js';
2
+ import { jsx } from '@emotion/react/jsx-runtime';
3
+
4
+ const DialogText = ({
5
+ children
6
+ }) => jsx(Text, {
7
+ as: "p",
8
+ variant: "body",
9
+ children: children
10
+ });
11
+
12
+ export { DialogText };
@@ -1,5 +1,5 @@
1
1
  import _styled from '@emotion/styled/base';
2
- import { useState, useId, useCallback, useEffect } from 'react';
2
+ import { useState, useId, useCallback } from 'react';
3
3
  import { Button } from '../Button/index.js';
4
4
  import { Dialog } from './Dialog.js';
5
5
  import { Disclosure } from './Disclosure.js';
@@ -27,6 +27,7 @@ const Modal = ({
27
27
  isClosable = true,
28
28
  onClose,
29
29
  onBeforeClose,
30
+ open = false,
30
31
  opened = false,
31
32
  placement = 'center',
32
33
  preventBodyScroll = true,
@@ -38,7 +39,8 @@ const Modal = ({
38
39
  customDialogStyles,
39
40
  customDialogBackdropStyles
40
41
  }) => {
41
- const [visible, setVisible] = useState(opened);
42
+ // Used for disclosure usage only
43
+ const [visible, setVisible] = useState(false);
42
44
  const controlId = useId();
43
45
  const handleOpen = useCallback(() => {
44
46
  setVisible(true);
@@ -59,19 +61,16 @@ const Modal = ({
59
61
  }, []);
60
62
  const finalId = id ?? controlId;
61
63
  const finalSize = size ?? width;
62
- useEffect(() => {
63
- setVisible(opened);
64
- }, [opened]);
65
64
  return jsxs(Fragment, {
66
- children: [jsx(Disclosure, {
65
+ children: [disclosure ? jsx(Disclosure, {
67
66
  id: finalId,
68
67
  handleOpen: handleOpen,
69
68
  disclosure: disclosure,
70
69
  handleClose: handleClose,
71
70
  visible: visible,
72
71
  toggle: handleToggle
73
- }), jsx(Dialog, {
74
- open: visible,
72
+ }) : null, jsx(Dialog, {
73
+ open: visible || open || opened,
75
74
  placement: placement,
76
75
  size: finalSize,
77
76
  ariaLabel: ariaLabel,