widenarrow-ui 2.3.4 → 2.3.6

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/lib/index.d.ts CHANGED
@@ -1,7 +1,17 @@
1
1
  import * as react from 'react';
2
- import react__default, { CSSProperties, MouseEvent, RefObject, ReactNode, ChangeEvent, KeyboardEvent, FocusEvent, FC, AriaAttributes } from 'react';
2
+ import react__default, { CSSProperties, ReactElement, MouseEvent, RefObject, ReactNode, ChangeEvent, KeyboardEvent, FocusEvent, FC, AriaAttributes } from 'react';
3
3
  import { Placement, PositioningStrategy } from '@popperjs/core';
4
4
 
5
+ interface AnimatedCountProps {
6
+ value: string | number;
7
+ className?: string;
8
+ }
9
+
10
+ declare const AnimatedCount: {
11
+ ({ value, className }: AnimatedCountProps): JSX.Element;
12
+ displayName: string;
13
+ };
14
+
5
15
  declare enum IconTypes {
6
16
  ACCOUNT_SETTINGS = "iconAccountSettings",
7
17
  ALL_SOURCES = "iconAllSources",
@@ -354,6 +364,18 @@ declare enum FontFamilyTypes {
354
364
  TIMES_NEW_ROMAN = "times new roman",
355
365
  CUSTOM = "custom"
356
366
  }
367
+ /**
368
+ * Colour variants for badges that carry a count. NumberBadge styles all six values; consuming apps can
369
+ * also use the same scale for their own counters.
370
+ */
371
+ declare enum BadgeTypes {
372
+ ORANGE = "colorBadgeOrange",
373
+ DARK = "colorBadgeDark",
374
+ GREY = "colorBadgeGrey",
375
+ PURPLE = "colorBadgePurple",
376
+ MINT = "colorBadgeMint",
377
+ BLUE = "colorBadgeBlue"
378
+ }
357
379
  declare enum AppColors {
358
380
  TRANSPARENT = "transparent",
359
381
  WHITE = "#ffffff",
@@ -391,6 +413,59 @@ declare enum AppColors {
391
413
  MAIN_DARK = "#030718"
392
414
  }
393
415
 
416
+ interface BadgeItem {
417
+ id: string | number;
418
+ name: string;
419
+ allUsers?: boolean;
420
+ type?: string;
421
+ }
422
+ interface BadgeProps {
423
+ badgeItem: BadgeItem;
424
+ className?: string;
425
+ /** Lets the badge fill the available width instead of being capped by `maxWidth`. */
426
+ displayAll?: boolean;
427
+ leftIcon?: Partial<IconTypes>;
428
+ /** CSS width expression, i.e. `calc(100% - 20px)`. Ignored when `displayAll` is set. */
429
+ maxWidth?: string;
430
+ style?: CSSProperties;
431
+ /** Renders the label as a button. */
432
+ onClickCallback?: (badgeItem: BadgeItem) => void;
433
+ /** Renders a remove (X) button after the label. */
434
+ onRemoveCallback?: (badgeItem: BadgeItem) => void;
435
+ /** Accessible name and tooltip for the remove button. Set it whenever `onRemoveCallback` is. */
436
+ removeLabel?: string;
437
+ }
438
+
439
+ declare const Badge: {
440
+ ({ badgeItem, className, displayAll, leftIcon, maxWidth, style, onClickCallback, onRemoveCallback, removeLabel }: BadgeProps): JSX.Element;
441
+ displayName: string;
442
+ };
443
+
444
+ interface BadgeListProps {
445
+ /** Either `BadgeItem` objects or ready-made badge components. Entries that render nothing are dropped. */
446
+ badgeArray: Array<BadgeItem> | Array<ReactElement>;
447
+ /** How many badges to show before the rest move into the dropdown. `0` shows all of them. */
448
+ numberToDisplay: number;
449
+ className?: string;
450
+ dropDownTitle?: string;
451
+ /** Reveals the overflow inline behind a toggle instead of in a dropdown. */
452
+ withToggleShowAll?: boolean;
453
+ wrapBadges?: boolean;
454
+ /** Styles the overflow toggle as a link. */
455
+ displayAsLinks?: boolean;
456
+ /** Label for the toggle once the overflow is open. Falls back to `- N`. Pass a translated string. */
457
+ showLessText?: string;
458
+ onClickCallback?: (badgeItem: BadgeItem) => void;
459
+ onRemoveCallback?: (badgeItem: BadgeItem) => void;
460
+ /** Accessible name and tooltip for each remove button. Set it whenever `onRemoveCallback` is. */
461
+ removeLabel?: string;
462
+ }
463
+
464
+ declare const BadgeList: {
465
+ ({ badgeArray, numberToDisplay, className, dropDownTitle, withToggleShowAll, wrapBadges, displayAsLinks, showLessText, onClickCallback, onRemoveCallback, removeLabel }: BadgeListProps): JSX.Element | null;
466
+ displayName: string;
467
+ };
468
+
394
469
  interface MarginInterface {
395
470
  margin?: '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '025' | '05' | '15' | '25' | 'auto';
396
471
  marginX?: '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '025' | '05' | '15' | '25' | 'auto';
@@ -941,9 +1016,12 @@ interface IconButtonProps extends IconStyleInterface {
941
1016
  toolTipComponent?: ReactNode;
942
1017
  ariaLabel?: string;
943
1018
  toggleIcon?: IconTypes;
1019
+ badge?: string | number;
1020
+ /** @default BadgeTypes.PURPLE */
1021
+ badgeColor?: BadgeTypes;
944
1022
  }
945
1023
 
946
- declare const IconButton: react.MemoExoticComponent<({ className, disabled, style, icon, id, text, size, type, href, iconColor, iconSize, iconClassName, onClickCallback, rotateIcon, tabIndex, autoFocus, buttonRef, rotateIconByDegree, toolTip, toolTipComponent, ariaLabel, toggleIcon }: IconButtonProps) => JSX.Element>;
1024
+ declare const IconButton: react.MemoExoticComponent<({ className, disabled, style, icon, id, text, size, type, href, iconColor, iconSize, iconClassName, onClickCallback, rotateIcon, tabIndex, autoFocus, buttonRef, rotateIconByDegree, toolTip, toolTipComponent, ariaLabel, toggleIcon, badge, badgeColor }: IconButtonProps) => JSX.Element>;
947
1025
 
948
1026
  interface IconInterface$1 {
949
1027
  loading?: boolean;
@@ -1351,6 +1429,29 @@ declare const MultiActionButton: {
1351
1429
  displayName: string;
1352
1430
  };
1353
1431
 
1432
+ interface NumberBadgeProps {
1433
+ /** Already formatted. The badge does no rounding or shortening of its own. */
1434
+ count: string | number;
1435
+ /** Animates each digit when `count` changes. Never fires on mount. */
1436
+ animate?: boolean;
1437
+ /** Renders nothing when `count` is empty. */
1438
+ hideWhenEmpty?: boolean;
1439
+ className?: string;
1440
+ id?: string;
1441
+ color?: BadgeTypes;
1442
+ /** @default SizeTypes.MEDIUM */
1443
+ size?: SizeTypes.SMALL | SizeTypes.MEDIUM;
1444
+ /** Pass an already translated string. */
1445
+ toolTip?: string;
1446
+ /** Escape hatch for a one-off colour, i.e. a value picked at runtime. */
1447
+ style?: CSSProperties;
1448
+ }
1449
+
1450
+ declare const NumberBadge: {
1451
+ ({ count, animate, className, color, id, hideWhenEmpty, size, toolTip, style }: NumberBadgeProps): JSX.Element | null;
1452
+ displayName: string;
1453
+ };
1454
+
1354
1455
  interface SeparatorProps extends MarginInterface, PaddingInterface {
1355
1456
  id?: string;
1356
1457
  className?: string;
@@ -1743,16 +1844,16 @@ declare const Heading: {
1743
1844
  ({ children, type, style, id, ...props }: HeadingProps): JSX.Element;
1744
1845
  displayName: string;
1745
1846
  defaultProps: {
1746
- marginTop: string;
1747
- marginBottom: string;
1748
- color: ColorTypes;
1847
+ readonly marginTop: "0";
1848
+ readonly marginBottom: "2";
1849
+ readonly color: ColorTypes.MAIN_DARK;
1749
1850
  };
1750
1851
  };
1751
1852
  declare const Label: {
1752
1853
  ({ children, htmlFor, style, id, ...props }: LabelProps): JSX.Element;
1753
1854
  displayName: string;
1754
1855
  defaultProps: {
1755
- marginBottom: string;
1856
+ readonly marginBottom: "05";
1756
1857
  };
1757
1858
  };
1758
1859
  declare const Paragraph: {
@@ -1819,4 +1920,4 @@ declare const NoDataMessage: {
1819
1920
  displayName: string;
1820
1921
  };
1821
1922
 
1822
- export { AppColors, AspectRatioTypes, BorderInterface, Box, Button, Card, Checkbox, ColorStyleInterface, ColorTypes, DropDown, DropDownItem, DropDownRef, FacetButton, FlexStylingInterface, FontFamilyTypes, FormSkeleton, Grid, Heading, HierarchyInterface, HierarchyTypes, Icon, IconButton, IconStyleInterface, IconTypes, Image, InlineButton, Input, Label, Link, LinkTypes, ListButton, ListButtonProps, ListItem, ListSkeleton, MarginInterface, MultiActionButton, NoDataMessage, PaddingInterface, Pagination, Paragraph, RadioButton, SelectInput, Separator, SizeStyleInterface, SizeTypes, SkeletonItem, SolidSpinner, SortableTable, SortableTableCellInterface, SortableTableProps, Span, SwitchButton, Tab, TabGroup, TabGroupProps, TabIndicatorProps, TabProps, TabValue, TableTypes, TextAreaInput, ToolTip, borderClassNames, flexClassNames, marginClassNames, paddingClassNames };
1923
+ export { AnimatedCount, AnimatedCountProps, AppColors, AspectRatioTypes, Badge, BadgeItem, BadgeList, BadgeListProps, BadgeProps, BadgeTypes, BorderInterface, Box, Button, Card, Checkbox, ColorStyleInterface, ColorTypes, DropDown, DropDownItem, DropDownRef, FacetButton, FlexStylingInterface, FontFamilyTypes, FormSkeleton, Grid, Heading, HierarchyInterface, HierarchyTypes, Icon, IconButton, IconStyleInterface, IconTypes, Image, InlineButton, Input, Label, Link, LinkTypes, ListButton, ListButtonProps, ListItem, ListSkeleton, MarginInterface, MultiActionButton, NoDataMessage, NumberBadge, NumberBadgeProps, PaddingInterface, Pagination, Paragraph, RadioButton, SelectInput, Separator, SizeStyleInterface, SizeTypes, SkeletonItem, SolidSpinner, SortableTable, SortableTableCellInterface, SortableTableProps, Span, SwitchButton, Tab, TabGroup, TabGroupProps, TabIndicatorProps, TabProps, TabValue, TableTypes, TextAreaInput, ToolTip, borderClassNames, flexClassNames, marginClassNames, paddingClassNames };