@ultraviolet/ui 1.2.0 → 1.3.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/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react from 'react';
2
- import { ReactNode, SVGProps, ComponentProps, ButtonHTMLAttributes, AriaRole, MouseEventHandler, JSX, MouseEvent, InputHTMLAttributes, HTMLAttributeAnchorTarget, AnchorHTMLAttributes, ReactElement, Ref, ForwardRefExoticComponent, ForwardedRef, ChangeEventHandler, FocusEventHandler, CSSProperties, HTMLAttributes, ElementType, KeyboardEventHandler, TextareaHTMLAttributes, RefObject } from 'react';
2
+ import { ReactNode, SVGProps, ComponentProps, ButtonHTMLAttributes, AriaRole, MouseEventHandler, JSX, MouseEvent, InputHTMLAttributes, HTMLAttributeAnchorTarget, AnchorHTMLAttributes, ReactElement, Ref, RefObject, CSSProperties, ChangeEventHandler, FocusEventHandler, ForwardRefExoticComponent, ForwardedRef, HTMLAttributes, ElementType, KeyboardEventHandler, TextareaHTMLAttributes } from 'react';
3
3
  import * as _emotion_react_types_jsx_namespace from '@emotion/react/types/jsx-namespace';
4
4
  import * as _emotion_styled from '@emotion/styled';
5
5
  import * as _emotion_react from '@emotion/react';
@@ -961,6 +961,23 @@ type BadgeProps = {
961
961
  };
962
962
  declare const Badge: ({ sentiment, size, prominence, icon, disabled, className, children, "data-testid": dataTestId, }: BadgeProps) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
963
963
 
964
+ type Variant$1 = 'intro' | 'promotional';
965
+ type BannerProps = {
966
+ variant?: Variant$1;
967
+ size?: 'small' | 'medium';
968
+ title: string;
969
+ children: ReactNode;
970
+ direction?: 'row' | 'column';
971
+ onClose?: () => void;
972
+ buttonText?: string;
973
+ onClickButton?: ComponentProps<typeof Button>['onClick'];
974
+ linkText?: string;
975
+ linkHref?: string;
976
+ image?: ReactNode;
977
+ className?: string;
978
+ };
979
+ declare const Banner: ({ variant, size, title, children, direction, onClose, buttonText, onClickButton, linkText, linkHref, image, className, }: BannerProps) => _emotion_react_types_jsx_namespace.EmotionJSX.Element | null;
980
+
964
981
  type BarChartToolTipProps = {
965
982
  color: string;
966
983
  indexValue: string;
@@ -1048,23 +1065,6 @@ type BreadcrumbsType = ((props: BreadcrumbsProps) => JSX.Element) & {
1048
1065
  };
1049
1066
  declare const Breadcrumbs: BreadcrumbsType;
1050
1067
 
1051
- type Variant$1 = 'intro' | 'promotional';
1052
- type BannerProps = {
1053
- variant?: Variant$1;
1054
- size?: 'small' | 'medium';
1055
- title: string;
1056
- children: ReactNode;
1057
- direction?: 'row' | 'column';
1058
- onClose?: () => void;
1059
- buttonText?: string;
1060
- onClickButton?: ComponentProps<typeof Button>['onClick'];
1061
- linkText?: string;
1062
- linkHref?: string;
1063
- image?: ReactNode;
1064
- className?: string;
1065
- };
1066
- declare const Banner: ({ variant, size, title, children, direction, onClose, buttonText, onClickButton, linkText, linkHref, image, className, }: BannerProps) => _emotion_react_types_jsx_namespace.EmotionJSX.Element | null;
1067
-
1068
1068
  declare const sentiments$1: {
1069
1069
  readonly danger: ({ theme }: {
1070
1070
  theme: Theme;
@@ -1111,6 +1111,35 @@ type BulletProps = {
1111
1111
  } & ContentProps$1;
1112
1112
  declare const Bullet: ({ className, sentiment, size, icon, text, tooltip, tooltipBaseId, "data-testid": dataTestId, }: BulletProps) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
1113
1113
 
1114
+ type CardProps = {
1115
+ children: ReactNode;
1116
+ /**
1117
+ * Header can be a string but also a component if you need more complex header.
1118
+ */
1119
+ header?: ReactNode;
1120
+ /**
1121
+ * isActive enable a primary style on Card component for when you need to highlight it.
1122
+ */
1123
+ isActive?: boolean;
1124
+ disabled?: boolean;
1125
+ className?: string;
1126
+ 'data-testid'?: string;
1127
+ };
1128
+ declare const Card: react.ForwardRefExoticComponent<CardProps & react.RefAttributes<HTMLDivElement>>;
1129
+
1130
+ type CarouselItemProps = {
1131
+ children: ReactNode;
1132
+ };
1133
+ type CarouselProps = {
1134
+ className?: string;
1135
+ children?: ReactNode;
1136
+ 'data-testid'?: string;
1137
+ };
1138
+ declare const Carousel: {
1139
+ ({ children, className, "data-testid": dataTestId, }: CarouselProps): JSX.Element;
1140
+ Item: ({ children }: CarouselItemProps) => JSX.Element;
1141
+ };
1142
+
1114
1143
  type CheckboxProps = {
1115
1144
  error?: string | ReactNode;
1116
1145
  size?: number;
@@ -1163,24 +1192,6 @@ type DateInputProps = Pick<ReactDatePickerProps<string>, 'autoFocus' | 'disabled
1163
1192
  };
1164
1193
  declare const DateInput: ({ autoFocus, disabled, error, format, label, locale, maxDate, minDate, name, onBlur, onChange, onFocus, required, value, className, "data-testid": dataTestId, }: DateInputProps) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
1165
1194
 
1166
- type ExpandableProps = {
1167
- /**
1168
- * The content to display
1169
- */
1170
- children: ReactNode;
1171
- /**
1172
- * To display or not the content
1173
- */
1174
- opened?: boolean;
1175
- /**
1176
- * The minimum height of the content
1177
- */
1178
- minHeight?: number;
1179
- className?: string;
1180
- 'data-testid'?: string;
1181
- };
1182
- declare const Expandable: ({ children, opened, minHeight, className, "data-testid": dataTestId, }: ExpandableProps) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
1183
-
1184
1195
  declare const CONTAINER_SIZES: {
1185
1196
  readonly small: 720;
1186
1197
  readonly medium: 720;
@@ -1215,6 +1226,24 @@ type EmptyStateProps = {
1215
1226
  };
1216
1227
  declare const EmptyState: ({ image, title, size, description, primaryButton, secondaryButton, learnMore, className, bordered, children, "data-testid": dataTestId, }: EmptyStateProps) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
1217
1228
 
1229
+ type ExpandableProps = {
1230
+ /**
1231
+ * The content to display
1232
+ */
1233
+ children: ReactNode;
1234
+ /**
1235
+ * To display or not the content
1236
+ */
1237
+ opened?: boolean;
1238
+ /**
1239
+ * The minimum height of the content
1240
+ */
1241
+ minHeight?: number;
1242
+ className?: string;
1243
+ 'data-testid'?: string;
1244
+ };
1245
+ declare const Expandable: ({ children, opened, minHeight, className, "data-testid": dataTestId, }: ExpandableProps) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
1246
+
1218
1247
  type Transformer = (value: DatumValue) => string;
1219
1248
  type CustomLegendProps = {
1220
1249
  axisTransformer?: Transformer;
@@ -1405,6 +1434,29 @@ declare const Menu: react.ForwardRefExoticComponent<MenuProps & react.RefAttribu
1405
1434
  } & react.RefAttributes<HTMLElement>>;
1406
1435
  };
1407
1436
 
1437
+ type Strength$1 = {
1438
+ /**
1439
+ * Color to display
1440
+ */
1441
+ color: string;
1442
+ /**
1443
+ * Text to display
1444
+ */
1445
+ text: string;
1446
+ };
1447
+ type PasswordStrengthMeterProps$1 = {
1448
+ /**
1449
+ * Strength is used for defining different color and text associated with it.
1450
+ */
1451
+ strength: Strength$1[];
1452
+ title: string;
1453
+ value: number;
1454
+ className?: string;
1455
+ 'data-testid'?: string;
1456
+ id?: string;
1457
+ };
1458
+ declare const Meter: ({ strength, title, value, className, "data-testid": dataTestId, id, }: PasswordStrengthMeterProps$1) => JSX.Element;
1459
+
1408
1460
  declare const MODAL_WIDTH: {
1409
1461
  large: number;
1410
1462
  medium: number;
@@ -1493,13 +1545,50 @@ type NoticeProps = {
1493
1545
  };
1494
1546
  declare const Notice: ({ children, className, "data-testid": dataTestId, }: NoticeProps) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
1495
1547
 
1548
+ declare const containerSizes: {
1549
+ large: number;
1550
+ medium: number;
1551
+ small: number;
1552
+ };
1553
+ type ContainerSizesType = keyof typeof containerSizes;
1554
+ type NumberInputProps = {
1555
+ disabled?: boolean;
1556
+ maxValue?: number;
1557
+ minValue?: number;
1558
+ name?: string;
1559
+ onChange?: (input: number | undefined) => void;
1560
+ onMaxCrossed?(): void;
1561
+ onMinCrossed?(): void;
1562
+ size?: ContainerSizesType;
1563
+ /**
1564
+ * Define how much will stepper increase / decrease each time you click on + / - button.
1565
+ */
1566
+ step?: number;
1567
+ /**
1568
+ * Text displayed into component at the right of number value.
1569
+ */
1570
+ text?: string;
1571
+ defaultValue?: number;
1572
+ value?: number;
1573
+ disabledTooltip?: string;
1574
+ className?: string;
1575
+ 'data-testid'?: string;
1576
+ label?: string;
1577
+ 'aria-label'?: string;
1578
+ 'aria-describedby'?: string;
1579
+ id?: string;
1580
+ placeholder?: string;
1581
+ error?: string | boolean;
1582
+ } & Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'onChange' | 'value' | 'defaultValue'>;
1583
+ declare const NumberInput: ({ disabled, maxValue, minValue, name, onChange, onFocus, onBlur, onMaxCrossed, onMinCrossed, size, step, text, defaultValue, value, disabledTooltip, className, label, id, placeholder, error, "aria-label": ariaLabel, "aria-describedby": ariaDescribedBy, "data-testid": dataTestId, }: NumberInputProps) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
1584
+
1496
1585
  type PaginationProps = {
1497
1586
  /**
1498
1587
  Event function called when changing the page
1499
1588
  */
1500
1589
  onChange: (newPage: number) => void;
1501
1590
  /**
1502
- The current page
1591
+ The current page (must be between 1 and pageCount included, otherwhile onChange will be called with a correct value)
1503
1592
  */
1504
1593
  page: number;
1505
1594
  /**
@@ -1571,6 +1660,9 @@ type PasswordStrengthMeterProps = {
1571
1660
  className?: string;
1572
1661
  'data-testid'?: string;
1573
1662
  };
1663
+ /**
1664
+ * @deprecated use Meter component instead
1665
+ */
1574
1666
  declare const PasswordStrengthMeter: ({ password, onChange, strength, title, estimate, forbiddenInputs, className, "data-testid": dataTestId, }: PasswordStrengthMeterProps) => JSX.Element;
1575
1667
 
1576
1668
  type Data = {
@@ -1596,39 +1688,59 @@ type PieChartProps = {
1596
1688
  */
1597
1689
  declare const PieChart: ({ height, width, data, emptyLegend, content, withLegend, margin, chartProps, }: PieChartProps) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
1598
1690
 
1599
- declare const variants$1: {
1600
- readonly block: ({ length }: {
1601
- length?: number | undefined;
1602
- }) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
1603
- readonly blocks: ({ col, length, }: {
1604
- col?: number | undefined;
1605
- length?: number | undefined;
1606
- }) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
1607
- readonly box: ({ col, length, }: {
1608
- col?: number | undefined;
1609
- length?: number | undefined;
1610
- }) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
1611
- readonly donut: () => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
1612
- readonly line: _emotion_styled.StyledComponent<{
1613
- theme?: _emotion_react.Theme | undefined;
1614
- as?: react.ElementType<any> | undefined;
1615
- }, react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
1616
- readonly list: ({ length, col, }: {
1617
- length?: number | undefined;
1618
- col?: number | undefined;
1619
- }) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
1620
- readonly slider: ({ length }: {
1621
- length?: number | undefined;
1622
- }) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
1623
- };
1624
- type SkeletonVariant = keyof typeof variants$1;
1625
- type SkeletonProps = {
1626
- variant?: SkeletonVariant;
1627
- length?: number;
1628
- col?: number;
1691
+ type TooltipPlacement = 'top' | 'right' | 'bottom' | 'left' | 'auto';
1692
+
1693
+ type TooltipProps = {
1694
+ /**
1695
+ * Id is automatically generated if not set. It is used for associating tooltip wrapper with tooltip portal.
1696
+ */
1697
+ id?: string;
1698
+ children: ReactNode | ((renderProps: {
1699
+ className?: string;
1700
+ onBlur: () => void;
1701
+ onFocus: () => void;
1702
+ onPointerEnter: () => void;
1703
+ onPointerLeave: () => void;
1704
+ ref: RefObject<HTMLDivElement>;
1705
+ }) => ReactNode);
1706
+ maxWidth?: number;
1707
+ /**
1708
+ * `auto` placement will change the position of the tooltip if it doesn't fit in the viewport.
1709
+ */
1710
+ placement?: TooltipPlacement;
1711
+ /**
1712
+ * Content of the tooltip, preferably text inside.
1713
+ */
1714
+ text?: ReactNode;
1629
1715
  className?: string;
1716
+ /**
1717
+ * It will force display tooltip. This can be useful if you need to always display the tooltip without hover needed.
1718
+ */
1719
+ visible?: boolean;
1720
+ innerRef?: Ref<HTMLDivElement | null>;
1721
+ role?: string;
1722
+ 'data-testid'?: string;
1630
1723
  };
1631
- declare const Skeleton: ({ variant, length, col, className, }: SkeletonProps) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
1724
+ declare const Tooltip: react.ForwardRefExoticComponent<TooltipProps & react.RefAttributes<HTMLDivElement>>;
1725
+
1726
+ type SentimentType = 'neutral' | 'primary';
1727
+ declare const SIZES_WIDTH: {
1728
+ small: number;
1729
+ medium: number;
1730
+ large: number;
1731
+ };
1732
+ type PopoverProps = {
1733
+ children: ReactNode;
1734
+ content: ReactNode;
1735
+ title: string;
1736
+ sentiment?: SentimentType;
1737
+ visible?: boolean;
1738
+ size?: keyof typeof SIZES_WIDTH;
1739
+ onClose: () => void;
1740
+ className?: string;
1741
+ 'data-testid'?: string;
1742
+ } & Pick<ComponentProps<typeof Tooltip>, 'placement'>;
1743
+ declare const Popover: ({ visible, children, placement, content, title, sentiment, size, onClose, className, "data-testid": dataTestId, }: PopoverProps) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
1632
1744
 
1633
1745
  declare const progressBarSentiments: readonly ["primary", "success", "warning", "info"];
1634
1746
  type ProgressBarProps = {
@@ -1657,6 +1769,37 @@ type RadioProps = {
1657
1769
  });
1658
1770
  declare const Radio: react.ForwardRefExoticComponent<RadioProps & react.RefAttributes<HTMLInputElement>>;
1659
1771
 
1772
+ type RowProps = {
1773
+ className?: string;
1774
+ 'data-testid'?: string;
1775
+ children: ReactNode;
1776
+ templateColumns: string;
1777
+ gap?: keyof SCWUITheme['space'] | number;
1778
+ alignItems?: CSSProperties['alignItems'];
1779
+ justifyContent?: CSSProperties['justifyContent'];
1780
+ };
1781
+ declare const Row: ({ className, "data-testid": dataTestId, children, templateColumns, alignItems, justifyContent, gap, }: RowProps) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
1782
+
1783
+ type SelectableCardProps = {
1784
+ name?: string;
1785
+ children?: (({ disabled, checked, }: Pick<SelectableCardProps, 'checked' | 'disabled'>) => ReactNode) | ReactNode;
1786
+ value: string | number;
1787
+ onChange: ChangeEventHandler<HTMLInputElement>;
1788
+ showTick?: boolean;
1789
+ type?: 'radio' | 'checkbox';
1790
+ disabled?: boolean;
1791
+ checked?: boolean;
1792
+ className?: string;
1793
+ isError?: boolean;
1794
+ onFocus?: FocusEventHandler<HTMLInputElement>;
1795
+ onBlur?: FocusEventHandler<HTMLInputElement>;
1796
+ id?: string;
1797
+ tooltip?: string;
1798
+ label?: ReactNode;
1799
+ 'data-testid'?: string;
1800
+ };
1801
+ declare const SelectableCard: react.ForwardRefExoticComponent<SelectableCardProps & react.RefAttributes<HTMLDivElement>>;
1802
+
1660
1803
  type SelectOption = {
1661
1804
  value: string;
1662
1805
  label: ReactNode;
@@ -1722,63 +1865,6 @@ declare const SelectInput: ForwardRefExoticComponent<Partial<SelectInputProps>>
1722
1865
  Option: OptionComponent;
1723
1866
  };
1724
1867
 
1725
- type SelectableCardProps = {
1726
- name?: string;
1727
- children?: (({ disabled, checked, }: Pick<SelectableCardProps, 'checked' | 'disabled'>) => ReactNode) | ReactNode;
1728
- value: string | number;
1729
- onChange: ChangeEventHandler<HTMLInputElement>;
1730
- showTick?: boolean;
1731
- type?: 'radio' | 'checkbox';
1732
- disabled?: boolean;
1733
- checked?: boolean;
1734
- className?: string;
1735
- isError?: boolean;
1736
- onFocus?: FocusEventHandler<HTMLInputElement>;
1737
- onBlur?: FocusEventHandler<HTMLInputElement>;
1738
- id?: string;
1739
- tooltip?: string;
1740
- label?: ReactNode;
1741
- 'data-testid'?: string;
1742
- };
1743
- declare const SelectableCard: react.ForwardRefExoticComponent<SelectableCardProps & react.RefAttributes<HTMLDivElement>>;
1744
-
1745
- declare const containerSizes: {
1746
- large: number;
1747
- medium: number;
1748
- small: number;
1749
- };
1750
- type ContainerSizesType = keyof typeof containerSizes;
1751
- type NumberInputProps = {
1752
- disabled?: boolean;
1753
- maxValue?: number;
1754
- minValue?: number;
1755
- name?: string;
1756
- onChange?: (input: number | undefined) => void;
1757
- onMaxCrossed?(): void;
1758
- onMinCrossed?(): void;
1759
- size?: ContainerSizesType;
1760
- /**
1761
- * Define how much will stepper increase / decrease each time you click on + / - button.
1762
- */
1763
- step?: number;
1764
- /**
1765
- * Text displayed into component at the right of number value.
1766
- */
1767
- text?: string;
1768
- defaultValue?: number;
1769
- value?: number;
1770
- disabledTooltip?: string;
1771
- className?: string;
1772
- 'data-testid'?: string;
1773
- label?: string;
1774
- 'aria-label'?: string;
1775
- 'aria-describedby'?: string;
1776
- id?: string;
1777
- placeholder?: string;
1778
- error?: string | boolean;
1779
- } & Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'onChange' | 'value' | 'defaultValue'>;
1780
- declare const NumberInput: ({ disabled, maxValue, minValue, name, onChange, onFocus, onBlur, onMaxCrossed, onMinCrossed, size, step, text, defaultValue, value, disabledTooltip, className, label, id, placeholder, error, "aria-label": ariaLabel, "aria-describedby": ariaDescribedBy, "data-testid": dataTestId, }: NumberInputProps) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
1781
-
1782
1868
  type Direction = 'horizontal' | 'vertical';
1783
1869
  type SeparatorProps = {
1784
1870
  icon?: ComponentProps<typeof Icon>['name'];
@@ -1790,18 +1876,39 @@ type SeparatorProps = {
1790
1876
  };
1791
1877
  declare const Separator: ({ direction, thickness, color, icon, className, "data-testid": dataTestId, }: SeparatorProps) => JSX.Element;
1792
1878
 
1793
- type CarouselItemProps = {
1794
- children: ReactNode;
1879
+ declare const variants$1: {
1880
+ readonly block: ({ length }: {
1881
+ length?: number | undefined;
1882
+ }) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
1883
+ readonly blocks: ({ col, length, }: {
1884
+ col?: number | undefined;
1885
+ length?: number | undefined;
1886
+ }) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
1887
+ readonly box: ({ col, length, }: {
1888
+ col?: number | undefined;
1889
+ length?: number | undefined;
1890
+ }) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
1891
+ readonly donut: () => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
1892
+ readonly line: _emotion_styled.StyledComponent<{
1893
+ theme?: _emotion_react.Theme | undefined;
1894
+ as?: react.ElementType<any> | undefined;
1895
+ }, react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
1896
+ readonly list: ({ length, col, }: {
1897
+ length?: number | undefined;
1898
+ col?: number | undefined;
1899
+ }) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
1900
+ readonly slider: ({ length }: {
1901
+ length?: number | undefined;
1902
+ }) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
1795
1903
  };
1796
- type CarouselProps = {
1904
+ type SkeletonVariant = keyof typeof variants$1;
1905
+ type SkeletonProps = {
1906
+ variant?: SkeletonVariant;
1907
+ length?: number;
1908
+ col?: number;
1797
1909
  className?: string;
1798
- children?: ReactNode;
1799
- 'data-testid'?: string;
1800
- };
1801
- declare const Carousel: {
1802
- ({ children, className, "data-testid": dataTestId, }: CarouselProps): JSX.Element;
1803
- Item: ({ children }: CarouselItemProps) => JSX.Element;
1804
1910
  };
1911
+ declare const Skeleton: ({ variant, length, col, className, }: SkeletonProps) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
1805
1912
 
1806
1913
  type Prefixes = 'lines' | 'command';
1807
1914
  type SnippetProps = {
@@ -2274,41 +2381,6 @@ type ToggleProps = {
2274
2381
  };
2275
2382
  declare const Toggle: react.ForwardRefExoticComponent<ToggleProps & react.RefAttributes<HTMLInputElement>>;
2276
2383
 
2277
- type TooltipPlacement = 'top' | 'right' | 'bottom' | 'left' | 'auto';
2278
-
2279
- type TooltipProps = {
2280
- /**
2281
- * Id is automatically generated if not set. It is used for associating tooltip wrapper with tooltip portal.
2282
- */
2283
- id?: string;
2284
- children: ReactNode | ((renderProps: {
2285
- className?: string;
2286
- onBlur: () => void;
2287
- onFocus: () => void;
2288
- onPointerEnter: () => void;
2289
- onPointerLeave: () => void;
2290
- ref: RefObject<HTMLDivElement>;
2291
- }) => ReactNode);
2292
- maxWidth?: number;
2293
- /**
2294
- * `auto` placement will change the position of the tooltip if it doesn't fit in the viewport.
2295
- */
2296
- placement?: TooltipPlacement;
2297
- /**
2298
- * Content of the tooltip, preferably text inside.
2299
- */
2300
- text?: ReactNode;
2301
- className?: string;
2302
- /**
2303
- * It will force display tooltip. This can be useful if you need to always display the tooltip without hover needed.
2304
- */
2305
- visible?: boolean;
2306
- innerRef?: Ref<HTMLDivElement | null>;
2307
- role?: string;
2308
- 'data-testid'?: string;
2309
- };
2310
- declare const Tooltip: react.ForwardRefExoticComponent<TooltipProps & react.RefAttributes<HTMLDivElement>>;
2311
-
2312
2384
  type VerificationCodeProps = {
2313
2385
  disabled?: boolean;
2314
2386
  error?: boolean;
@@ -2339,52 +2411,6 @@ type VerificationCodeProps = {
2339
2411
  };
2340
2412
  declare const VerificationCode: ({ disabled, className, error, fields, initialValue, inputId, inputStyle, onChange, onComplete, placeholder, required, type, "data-testid": dataTestId, "aria-label": ariaLabel, }: VerificationCodeProps) => JSX.Element;
2341
2413
 
2342
- type RowProps = {
2343
- className?: string;
2344
- 'data-testid'?: string;
2345
- children: ReactNode;
2346
- templateColumns: string;
2347
- gap?: keyof SCWUITheme['space'] | number;
2348
- alignItems?: CSSProperties['alignItems'];
2349
- justifyContent?: CSSProperties['justifyContent'];
2350
- };
2351
- declare const Row: ({ className, "data-testid": dataTestId, children, templateColumns, alignItems, justifyContent, gap, }: RowProps) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
2352
-
2353
- type CardProps = {
2354
- children: ReactNode;
2355
- /**
2356
- * Header can be a string but also a component if you need more complex header.
2357
- */
2358
- header?: ReactNode;
2359
- /**
2360
- * isActive enable a primary style on Card component for when you need to highlight it.
2361
- */
2362
- isActive?: boolean;
2363
- disabled?: boolean;
2364
- className?: string;
2365
- 'data-testid'?: string;
2366
- };
2367
- declare const Card: react.ForwardRefExoticComponent<CardProps & react.RefAttributes<HTMLDivElement>>;
2368
-
2369
- type SentimentType = 'neutral' | 'primary';
2370
- declare const SIZES_WIDTH: {
2371
- small: number;
2372
- medium: number;
2373
- large: number;
2374
- };
2375
- type PopoverProps = {
2376
- children: ReactNode;
2377
- content: ReactNode;
2378
- title: string;
2379
- sentiment?: SentimentType;
2380
- visible?: boolean;
2381
- size?: keyof typeof SIZES_WIDTH;
2382
- onClose: () => void;
2383
- className?: string;
2384
- 'data-testid'?: string;
2385
- } & Pick<ComponentProps<typeof Tooltip>, 'placement'>;
2386
- declare const Popover: ({ visible, children, placement, content, title, sentiment, size, onClose, className, "data-testid": dataTestId, }: PopoverProps) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
2387
-
2388
2414
  declare const getUUID: (prefix?: string) => string;
2389
2415
 
2390
2416
  declare const bounce: _emotion_react.Keyframes;
@@ -2428,4 +2454,4 @@ declare const down: (size: ScreenSize, rules: string) => string;
2428
2454
 
2429
2455
  declare const normalize: () => string;
2430
2456
 
2431
- export { ActionBar, Alert, Avatar, Badge, Banner, BarChart, BarStack, Breadcrumbs, Breakpoint, Bullet, Button, Card, Carousel, Checkbox, CopyButton, DateInput, EmptyState, Expandable, Icon, LineChart, Link, List, Loader, Menu, Modal, Notice, NumberInput, Pagination, PasswordCheck, PasswordStrengthMeter, PieChart, Popover, ProgressBar, Radio, Row, SCWUITheme, SelectInput, SelectableCard, Separator, Skeleton, Snippet, Stack, Status, StepList, Stepper, SwitchButton, Table, Tabs, Tag, TagInput, TagList, Text, TextInput, TimeInput, ToastContainer, Toggle, Tooltip, VerificationCode, bounce, down, extendTheme, fadeIn, fadeOut, flash, getUUID, normalize, 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 };
2457
+ export { ActionBar, Alert, Avatar, Badge, Banner, BarChart, BarStack, Breadcrumbs, Breakpoint, Bullet, Button, Card, Carousel, Checkbox, CopyButton, DateInput, EmptyState, Expandable, Icon, LineChart, Link, List, Loader, Menu, Meter, Modal, Notice, NumberInput, Pagination, PasswordCheck, PasswordStrengthMeter, PieChart, Popover, ProgressBar, Radio, Row, SCWUITheme, SelectInput, SelectableCard, Separator, Skeleton, Snippet, Stack, Status, StepList, Stepper, SwitchButton, Table, Tabs, Tag, TagInput, TagList, Text, TextInput, TimeInput, ToastContainer, Toggle, Tooltip, VerificationCode, bounce, down, extendTheme, fadeIn, fadeOut, flash, getUUID, normalize, 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 };
@@ -302,6 +302,9 @@ const Button = /*#__PURE__*/forwardRef((_ref10, ref) => {
302
302
  name: name,
303
303
  "aria-label": ariaLabel,
304
304
  "aria-current": ariaCurrent,
305
+ "aria-controls": ariaControls,
306
+ "aria-expanded": ariaExpanded,
307
+ "aria-haspopup": ariaHaspopup,
305
308
  iconOnly: !!icon && !children,
306
309
  tabIndex: tabIndex,
307
310
  children: content
@@ -0,0 +1,95 @@
1
+ import _styled from '@emotion/styled/base';
2
+ import { Text } from '../Text/index.js';
3
+ import { jsxs, jsx } from '@emotion/react/jsx-runtime';
4
+
5
+ const StyledStrength = /*#__PURE__*/_styled(Text, {
6
+ shouldForwardProp: prop => !['color'].includes(prop),
7
+ target: "e1segop82"
8
+ })("float:right;vertical-align:top;color:", _ref => {
9
+ let {
10
+ strength
11
+ } = _ref;
12
+ return strength.color;
13
+ }, ";");
14
+ const StyledWrapper = /*#__PURE__*/_styled("div", {
15
+ target: "e1segop81"
16
+ })("background-color:", _ref2 => {
17
+ let {
18
+ theme
19
+ } = _ref2;
20
+ return theme.colors.neutral.backgroundDisabled;
21
+ }, ";border-radius:", _ref3 => {
22
+ let {
23
+ theme
24
+ } = _ref3;
25
+ return theme.radii.default;
26
+ }, ";height:", _ref4 => {
27
+ let {
28
+ theme
29
+ } = _ref4;
30
+ return theme.space['1'];
31
+ }, ";margin-top:", _ref5 => {
32
+ let {
33
+ theme
34
+ } = _ref5;
35
+ return theme.space['1'];
36
+ }, ";margin-bottom:", _ref6 => {
37
+ let {
38
+ theme
39
+ } = _ref6;
40
+ return theme.space['2'];
41
+ }, ";");
42
+ const StyledMeter = /*#__PURE__*/_styled("div", {
43
+ target: "e1segop80"
44
+ })("border-radius:", _ref7 => {
45
+ let {
46
+ theme
47
+ } = _ref7;
48
+ return theme.radii.default;
49
+ }, ";height:100%;transition:all 0.5s;");
50
+ const Meter = _ref8 => {
51
+ let {
52
+ strength,
53
+ title,
54
+ value,
55
+ className,
56
+ 'data-testid': dataTestId,
57
+ id
58
+ } = _ref8;
59
+ const toValue = (value + 1) / strength.length * 100;
60
+ const width = `${toValue}%`;
61
+ const backgroundColor = strength[value]?.color ?? strength[0].color;
62
+ const text = strength[value]?.text ?? strength[0].text;
63
+ return jsxs("div", {
64
+ "aria-live": "polite",
65
+ "aria-valuemax": strength.length ?? 0,
66
+ "aria-valuemin": 0,
67
+ "aria-valuenow": value,
68
+ className: className,
69
+ "data-testid": dataTestId,
70
+ id: id,
71
+ role: "meter",
72
+ title: title,
73
+ "aria-labelledby": "meter-label",
74
+ children: [jsxs(Text, {
75
+ id: "meter-label",
76
+ variant: "bodySmallStrong",
77
+ as: "p",
78
+ children: [title, jsx(StyledStrength, {
79
+ as: "span",
80
+ variant: "bodySmallStrong",
81
+ strength: strength[value],
82
+ children: text
83
+ })]
84
+ }), jsx(StyledWrapper, {
85
+ children: jsx(StyledMeter, {
86
+ style: {
87
+ backgroundColor,
88
+ width
89
+ }
90
+ })
91
+ })]
92
+ });
93
+ };
94
+
95
+ export { Meter };
@@ -1,5 +1,5 @@
1
1
  import _styled from '@emotion/styled/base';
2
- import { useCallback, useMemo } from 'react';
2
+ import { useCallback, useMemo, useEffect } from 'react';
3
3
  import { Button } from '../Button/index.js';
4
4
  import { getPageNumbers } from './getPageNumbers.js';
5
5
  import { jsxs, jsx } from '@emotion/react/jsx-runtime';
@@ -65,6 +65,14 @@ const Pagination = _ref4 => {
65
65
  const handlePageClick = useCallback(pageNumber => () => {
66
66
  onChange(pageNumber);
67
67
  }, [onChange]);
68
+ useEffect(() => {
69
+ if (page < 1) {
70
+ onChange(1);
71
+ }
72
+ if (page > pageCount) {
73
+ onChange(pageCount);
74
+ }
75
+ }, [page, pageCount, onChange]);
68
76
  return jsxs(StyledContainer, {
69
77
  className: className,
70
78
  "data-testid": dataTestId,
@@ -58,6 +58,10 @@ const DEFAULT_ESTIMATE = () => ({
58
58
  score: 0
59
59
  });
60
60
  const DEFAULT_FORBIDDEN_WORDS = [];
61
+
62
+ /**
63
+ * @deprecated use Meter component instead
64
+ */
61
65
  const PasswordStrengthMeter = _ref7 => {
62
66
  let {
63
67
  password = '',
package/dist/src/index.js CHANGED
@@ -9,36 +9,41 @@ export { ActionBar } from './components/ActionBar/index.js';
9
9
  export { Alert } from './components/Alert/index.js';
10
10
  export { Avatar } from './components/Avatar/index.js';
11
11
  export { Badge } from './components/Badge/index.js';
12
+ export { Banner } from './components/Banner/index.js';
12
13
  export { BarChart } from './components/BarChart/index.js';
13
14
  export { BarStack } from './components/BarStack/index.js';
14
15
  export { Breadcrumbs } from './components/Breadcrumbs/index.js';
15
- export { Banner } from './components/Banner/index.js';
16
16
  export { Bullet } from './components/Bullet/index.js';
17
+ export { Button } from './components/Button/index.js';
18
+ export { Card } from './components/Card/index.js';
19
+ export { Carousel } from './components/Carousel/index.js';
17
20
  export { Checkbox } from './components/Checkbox/index.js';
18
21
  export { CopyButton } from './components/CopyButton/index.js';
19
22
  export { DateInput } from './components/DateInput/index.js';
20
- export { Expandable } from './components/Expandable/index.js';
21
23
  export { EmptyState } from './components/EmptyState/index.js';
24
+ export { Expandable } from './components/Expandable/index.js';
22
25
  export { Icon } from './components/Icon/index.js';
23
26
  export { LineChart } from './components/LineChart/index.js';
24
27
  export { Link } from './components/Link/index.js';
25
28
  export { List } from './components/List/index.js';
26
29
  export { Loader } from './components/Loader/index.js';
27
30
  export { Menu } from './components/Menu/index.js';
31
+ export { Meter } from './components/Meter/Meter.js';
28
32
  export { Modal } from './components/Modal/index.js';
29
33
  export { Notice } from './components/Notice/index.js';
34
+ export { NumberInput } from './components/NumberInput/index.js';
30
35
  export { Pagination } from './components/Pagination/index.js';
31
36
  export { PasswordCheck } from './components/PasswordCheck/index.js';
32
37
  export { PasswordStrengthMeter } from './components/PasswordStrengthMeter/index.js';
33
38
  export { PieChart } from './components/PieChart/index.js';
34
- export { Skeleton } from './components/Skeleton/index.js';
39
+ export { Popover } from './components/Popover/index.js';
35
40
  export { ProgressBar } from './components/ProgressBar/index.js';
36
41
  export { Radio } from './components/Radio/index.js';
37
- export { SelectInput } from './components/SelectInput/index.js';
42
+ export { Row } from './components/Row/index.js';
38
43
  export { SelectableCard } from './components/SelectableCard/index.js';
39
- export { NumberInput } from './components/NumberInput/index.js';
44
+ export { SelectInput } from './components/SelectInput/index.js';
40
45
  export { Separator } from './components/Separator/index.js';
41
- export { Carousel } from './components/Carousel/index.js';
46
+ export { Skeleton } from './components/Skeleton/index.js';
42
47
  export { Snippet } from './components/Snippet/index.js';
43
48
  export { Stack } from './components/Stack/index.js';
44
49
  export { Status } from './components/Status/index.js';
@@ -57,7 +62,3 @@ export { ToastContainer, toast } from './components/Toaster/index.js';
57
62
  export { Toggle } from './components/Toggle/index.js';
58
63
  export { Tooltip } from './components/Tooltip/index.js';
59
64
  export { VerificationCode } from './components/VerificationCode/index.js';
60
- export { Row } from './components/Row/index.js';
61
- export { Button } from './components/Button/index.js';
62
- export { Card } from './components/Card/index.js';
63
- export { Popover } from './components/Popover/index.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ultraviolet/ui",
3
- "version": "1.2.0",
3
+ "version": "1.3.1",
4
4
  "description": "Ultraviolet UI",
5
5
  "homepage": "https://github.com/scaleway/ultraviolet#readme",
6
6
  "repository": {