widenarrow-ui 2.3.4 → 2.3.5

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';
@@ -1351,6 +1426,28 @@ declare const MultiActionButton: {
1351
1426
  displayName: string;
1352
1427
  };
1353
1428
 
1429
+ interface NumberBadgeProps {
1430
+ /** Already formatted. The badge does no rounding or shortening of its own. */
1431
+ count: string | number;
1432
+ /** Pins the badge to this element's top right corner instead of rendering it inline. */
1433
+ anchor?: ReactNode;
1434
+ /** Animates each digit when `count` changes. Never fires on mount. */
1435
+ animate?: boolean;
1436
+ /** Renders no badge when `count` is empty. The `anchor` still renders. */
1437
+ hideWhenEmpty?: boolean;
1438
+ className?: string;
1439
+ color?: BadgeTypes;
1440
+ /** Pass an already translated string. */
1441
+ toolTip?: string;
1442
+ /** Escape hatch for a one-off colour, i.e. a value picked at runtime. */
1443
+ style?: CSSProperties;
1444
+ }
1445
+
1446
+ declare const NumberBadge: {
1447
+ ({ anchor, count, animate, className, color, hideWhenEmpty, toolTip, style }: NumberBadgeProps): JSX.Element | null;
1448
+ displayName: string;
1449
+ };
1450
+
1354
1451
  interface SeparatorProps extends MarginInterface, PaddingInterface {
1355
1452
  id?: string;
1356
1453
  className?: string;
@@ -1743,16 +1840,16 @@ declare const Heading: {
1743
1840
  ({ children, type, style, id, ...props }: HeadingProps): JSX.Element;
1744
1841
  displayName: string;
1745
1842
  defaultProps: {
1746
- marginTop: string;
1747
- marginBottom: string;
1748
- color: ColorTypes;
1843
+ readonly marginTop: "0";
1844
+ readonly marginBottom: "2";
1845
+ readonly color: ColorTypes.MAIN_DARK;
1749
1846
  };
1750
1847
  };
1751
1848
  declare const Label: {
1752
1849
  ({ children, htmlFor, style, id, ...props }: LabelProps): JSX.Element;
1753
1850
  displayName: string;
1754
1851
  defaultProps: {
1755
- marginBottom: string;
1852
+ readonly marginBottom: "05";
1756
1853
  };
1757
1854
  };
1758
1855
  declare const Paragraph: {
@@ -1819,4 +1916,4 @@ declare const NoDataMessage: {
1819
1916
  displayName: string;
1820
1917
  };
1821
1918
 
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 };
1919
+ 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 };