widenarrow-ui 2.4.12 → 2.5.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/lib/index.d.ts CHANGED
@@ -441,61 +441,6 @@ declare enum AppColors {
441
441
  MAIN_DARK = "#030718"
442
442
  }
443
443
 
444
- interface BadgeItem {
445
- id: string | number;
446
- name: string;
447
- allUsers?: boolean;
448
- type?: string;
449
- }
450
- interface BadgeProps {
451
- badgeItem: BadgeItem;
452
- className?: string;
453
- /** Lets the badge fill the available width instead of being capped by `maxWidth`. */
454
- displayAll?: boolean;
455
- leftIcon?: Partial<IconTypes>;
456
- /** CSS width expression, i.e. `calc(100% - 20px)`. Ignored when `displayAll` is set. */
457
- maxWidth?: string;
458
- style?: CSSProperties;
459
- /** Renders the label as a button. */
460
- onClickCallback?: (badgeItem: BadgeItem) => void;
461
- /** Renders a remove (X) button after the label. */
462
- onRemoveCallback?: (badgeItem: BadgeItem) => void;
463
- /** Accessible name and tooltip for the remove button. Set it whenever `onRemoveCallback` is. */
464
- removeLabel?: string;
465
- /** Ref to the remove button, e.g. to move focus to it. Only set while `onRemoveCallback` is. */
466
- removeButtonRef?: RefObject<HTMLButtonElement>;
467
- }
468
-
469
- declare const Badge: {
470
- ({ badgeItem, className, displayAll, leftIcon, maxWidth, style, onClickCallback, onRemoveCallback, removeLabel, removeButtonRef }: BadgeProps): JSX.Element;
471
- displayName: string;
472
- };
473
-
474
- interface BadgeListProps {
475
- /** Either `BadgeItem` objects or ready-made badge components. Entries that render nothing are dropped. */
476
- badgeArray: Array<BadgeItem> | Array<ReactElement>;
477
- /** How many badges to show before the rest move into the dropdown. `0` shows all of them. */
478
- numberToDisplay: number;
479
- className?: string;
480
- dropDownTitle?: string;
481
- /** Reveals the overflow inline behind a toggle instead of in a dropdown. */
482
- withToggleShowAll?: boolean;
483
- wrapBadges?: boolean;
484
- /** Styles the overflow toggle as a link. */
485
- displayAsLinks?: boolean;
486
- /** Label for the toggle once the overflow is open. Falls back to `- N`. Pass a translated string. */
487
- showLessText?: string;
488
- onClickCallback?: (badgeItem: BadgeItem) => void;
489
- onRemoveCallback?: (badgeItem: BadgeItem) => void;
490
- /** Accessible name and tooltip for each remove button. Set it whenever `onRemoveCallback` is. */
491
- removeLabel?: string;
492
- }
493
-
494
- declare const BadgeList: {
495
- ({ badgeArray, numberToDisplay, className, dropDownTitle, withToggleShowAll, wrapBadges, displayAsLinks, showLessText, onClickCallback, onRemoveCallback, removeLabel }: BadgeListProps): JSX.Element | null;
496
- displayName: string;
497
- };
498
-
499
444
  interface MarginInterface {
500
445
  margin?: '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '025' | '05' | '15' | '25' | 'auto';
501
446
  marginX?: '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '025' | '05' | '15' | '25' | 'auto';
@@ -545,8 +490,31 @@ interface ColorStyleInterface {
545
490
  interface SizeStyleInterface {
546
491
  size?: Partial<SizeTypes>;
547
492
  }
493
+ /** Two icons combined: `cornerIcon` is placed in a corner of `icon`, on a cut-out that keeps it legible */
494
+ interface CombinedIcon {
495
+ /** The main icon */
496
+ icon: Partial<IconTypes>;
497
+ /** Secondary icon drawn in a corner, cut out of the main icon. Uses the main icon's color */
498
+ cornerIcon: Partial<IconTypes>;
499
+ /**
500
+ * Which corner of the main icon the corner icon is placed in
501
+ * @default 'bottom-right'
502
+ */
503
+ cornerPosition?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
504
+ /**
505
+ * Thickens the corner icon to compensate for the thinner strokes caused by scaling it down.
506
+ * Grows its outline by this many units on the main icon's 24px grid. Typically 0-0.5.
507
+ * @default 0.25
508
+ */
509
+ weightCompensation?: number;
510
+ /**
511
+ * Accessible name for what the combination means, e.g. "Locked document". Without it the icon is
512
+ * hidden from assistive technology, which suits icons inside a control that has its own label.
513
+ */
514
+ ariaLabel?: string;
515
+ }
548
516
  interface IconStyleInterface {
549
- icon?: Partial<IconTypes>;
517
+ icon?: Partial<IconTypes> | CombinedIcon;
550
518
  }
551
519
  declare const paddingClassNames: ({ padding, paddingX, paddingY, paddingTop, paddingBottom, paddingRight, paddingLeft }: PaddingInterface) => {
552
520
  [x: string]: boolean;
@@ -564,6 +532,66 @@ declare const borderClassNames: ({ borderColor, border, borderTop, borderLeft, b
564
532
  [x: string]: boolean;
565
533
  };
566
534
 
535
+ interface BadgeItem {
536
+ id: string | number;
537
+ name: string;
538
+ allUsers?: boolean;
539
+ type?: string;
540
+ }
541
+ interface BadgeProps {
542
+ badgeItem: BadgeItem;
543
+ className?: string;
544
+ /** Lets the badge fill the available width instead of being capped by `maxWidth`. */
545
+ displayAll?: boolean;
546
+ leftIcon?: Partial<IconTypes> | CombinedIcon;
547
+ /**
548
+ * Height and text size of the badge.
549
+ * @default SizeTypes.MEDIUM
550
+ */
551
+ size?: SizeTypes.SMALL | SizeTypes.MEDIUM;
552
+ /** CSS width expression, i.e. `calc(100% - 20px)`. Ignored when `displayAll` is set. */
553
+ maxWidth?: string;
554
+ style?: CSSProperties;
555
+ /** Renders the label as a button. */
556
+ onClickCallback?: (badgeItem: BadgeItem) => void;
557
+ /** Renders a remove (X) button after the label. */
558
+ onRemoveCallback?: (badgeItem: BadgeItem) => void;
559
+ /** Accessible name and tooltip for the remove button. Set it whenever `onRemoveCallback` is. */
560
+ removeLabel?: string;
561
+ /** Ref to the remove button, e.g. to move focus to it. Only set while `onRemoveCallback` is. */
562
+ removeButtonRef?: RefObject<HTMLButtonElement>;
563
+ }
564
+
565
+ declare const Badge: {
566
+ ({ badgeItem, className, displayAll, leftIcon, size, maxWidth, style, onClickCallback, onRemoveCallback, removeLabel, removeButtonRef }: BadgeProps): JSX.Element;
567
+ displayName: string;
568
+ };
569
+
570
+ interface BadgeListProps {
571
+ /** Either `BadgeItem` objects or ready-made badge components. Entries that render nothing are dropped. */
572
+ badgeArray: Array<BadgeItem> | Array<ReactElement>;
573
+ /** How many badges to show before the rest move into the dropdown. `0` shows all of them. */
574
+ numberToDisplay: number;
575
+ className?: string;
576
+ dropDownTitle?: string;
577
+ /** Reveals the overflow inline behind a toggle instead of in a dropdown. */
578
+ withToggleShowAll?: boolean;
579
+ wrapBadges?: boolean;
580
+ /** Styles the overflow toggle as a link. */
581
+ displayAsLinks?: boolean;
582
+ /** Label for the toggle once the overflow is open. Falls back to `- N`. Pass a translated string. */
583
+ showLessText?: string;
584
+ onClickCallback?: (badgeItem: BadgeItem) => void;
585
+ onRemoveCallback?: (badgeItem: BadgeItem) => void;
586
+ /** Accessible name and tooltip for each remove button. Set it whenever `onRemoveCallback` is. */
587
+ removeLabel?: string;
588
+ }
589
+
590
+ declare const BadgeList: {
591
+ ({ badgeArray, numberToDisplay, className, dropDownTitle, withToggleShowAll, wrapBadges, displayAsLinks, showLessText, onClickCallback, onRemoveCallback, removeLabel }: BadgeListProps): JSX.Element | null;
592
+ displayName: string;
593
+ };
594
+
567
595
  interface BoxProps extends MarginInterface, PaddingInterface, BorderInterface, FlexStylingInterface {
568
596
  children?: react__default.ReactNode;
569
597
  id?: string;
@@ -595,13 +623,13 @@ interface ButtonProps {
595
623
  sizeMd?: SizeTypes.SMALL | SizeTypes.MEDIUM | SizeTypes.LARGE;
596
624
  sizeLg?: SizeTypes.SMALL | SizeTypes.MEDIUM | SizeTypes.LARGE;
597
625
  sizeXl?: SizeTypes.SMALL | SizeTypes.MEDIUM | SizeTypes.LARGE;
598
- icon?: Partial<IconTypes>;
626
+ icon?: Partial<IconTypes> | CombinedIcon;
599
627
  iconColor?: Partial<ColorTypes>;
600
628
  iconSize?: SizeTypes.SMALL | SizeTypes.MEDIUM | SizeTypes.LARGE | SizeTypes.AUTO;
601
629
  /** @default false */
602
630
  withIconRight?: boolean;
603
- leftIcon?: Partial<IconTypes>;
604
- rightIcon?: Partial<IconTypes>;
631
+ leftIcon?: Partial<IconTypes> | CombinedIcon;
632
+ rightIcon?: Partial<IconTypes> | CombinedIcon;
605
633
  /** @default false */
606
634
  disabled?: boolean;
607
635
  className?: string;
@@ -666,7 +694,7 @@ declare const Checkbox: FC<CheckboxProps>;
666
694
  interface NoDataMessageProps {
667
695
  id?: string;
668
696
  className?: string;
669
- icon?: Partial<IconTypes>;
697
+ icon?: Partial<IconTypes> | CombinedIcon;
670
698
  title?: string;
671
699
  message?: string;
672
700
  /** @default false */
@@ -675,7 +703,7 @@ interface NoDataMessageProps {
675
703
  button?: {
676
704
  onClickCallback: () => void;
677
705
  text: string;
678
- icon: Partial<IconTypes>;
706
+ icon: Partial<IconTypes> | CombinedIcon;
679
707
  };
680
708
  }
681
709
 
@@ -704,7 +732,7 @@ interface OptionItem {
704
732
  * Icon before the text. In a Combobox with `multiple`, also shown on the option's pill. Not shown
705
733
  * in the field of a single value, nor with `nativeHtmlComponent`.
706
734
  */
707
- leftIcon?: IconTypes;
735
+ leftIcon?: Partial<IconTypes> | CombinedIcon;
708
736
  /**
709
737
  * Component before the text, e.g. an avatar or a logo. Shown in the list in place of `leftIcon`,
710
738
  * while pills keep showing `leftIcon`. It doesn't make the option higher, so keep it to the size of an
@@ -859,7 +887,8 @@ interface ComboboxBaseProps {
859
887
  onLoadMoreCallback?: () => void;
860
888
  /**
861
889
  * Let the value be cleared: with a button while there is one, and for a single value also by deleting
862
- * all text in the input. Without it, a value can only be replaced by another. @default true
890
+ * all text in the input. Without it, a value can only be replaced by another. Not shown with
891
+ * `withPills={false}`. @default true
863
892
  */
864
893
  withClearButton?: boolean;
865
894
  /** Accessible names of the clear, toggle and pill remove buttons, e.g. to translate them. */
@@ -925,6 +954,14 @@ interface ComboboxMultipleProps extends ComboboxBaseProps {
925
954
  onChange: (value: Array<ComboboxValue>) => void;
926
955
  /** Only with `multiple`: pills shown in the field. The rest are behind a "+ N" button that lists them, as in BadgeList. @default 5 */
927
956
  maxVisiblePills?: number;
957
+ /**
958
+ * Only with `multiple`: show the selected values as pills in the field. When false the field holds just
959
+ * the input, e.g. when the selection is shown elsewhere. The selected options stay checked in the list,
960
+ * the placeholder stays shown, there is no clear button, and Backspace in the empty input no longer
961
+ * removes the last value.
962
+ * @default true
963
+ */
964
+ withPills?: boolean;
928
965
  }
929
966
  type ComboboxProps = ComboboxSingleProps | ComboboxMultipleProps;
930
967
 
@@ -938,7 +975,7 @@ interface CardProps extends PaddingInterface, MarginInterface, FlexStylingInterf
938
975
  onClickCallback?: () => void;
939
976
  /** @default AspectRatioTypes.ar16_9 */
940
977
  imageAspectRatio?: Partial<AspectRatioTypes>;
941
- imageIcon?: Partial<IconTypes>;
978
+ imageIcon?: Partial<IconTypes> | CombinedIcon;
942
979
  imageIconSize?: SizeTypes.SMALL | SizeTypes.MEDIUM | SizeTypes.LARGE | SizeTypes.AUTO | undefined;
943
980
  /** @default false */
944
981
  withEllipsis?: boolean;
@@ -1147,8 +1184,8 @@ interface DropDownItemProps {
1147
1184
  /** @default 'li' */
1148
1185
  wrapperElement?: 'div' | 'li';
1149
1186
  className?: string;
1150
- leftIcon?: Partial<IconTypes>;
1151
- rightIcon?: Partial<IconTypes>;
1187
+ leftIcon?: Partial<IconTypes> | CombinedIcon;
1188
+ rightIcon?: Partial<IconTypes> | CombinedIcon;
1152
1189
  rightComponent?: ReactNode;
1153
1190
  children?: ReactNode | ReactNode[];
1154
1191
  iconSize?: SizeTypes.SMALL | SizeTypes.MEDIUM | SizeTypes.LARGE;
@@ -1186,8 +1223,8 @@ interface FacetButtonProps {
1186
1223
  selected?: boolean;
1187
1224
  /** @default false */
1188
1225
  blocked?: boolean;
1189
- icon?: Partial<IconTypes>;
1190
- rightIcon?: Partial<IconTypes>;
1226
+ icon?: Partial<IconTypes> | CombinedIcon;
1227
+ rightIcon?: Partial<IconTypes> | CombinedIcon;
1191
1228
  children?: ReactNode;
1192
1229
  className?: string;
1193
1230
  toolTip?: string;
@@ -1362,7 +1399,7 @@ interface IconButtonProps extends IconStyleInterface {
1362
1399
  toolTip?: string;
1363
1400
  toolTipComponent?: ReactNode;
1364
1401
  ariaLabel?: string;
1365
- toggleIcon?: IconTypes;
1402
+ toggleIcon?: Partial<IconTypes> | CombinedIcon;
1366
1403
  badge?: string | number;
1367
1404
  /** @default BadgeTypes.PURPLE */
1368
1405
  badgeColor?: BadgeTypes;
@@ -1373,7 +1410,7 @@ declare const IconButton: react.MemoExoticComponent<({ className, disabled, styl
1373
1410
  interface IconInterface$1 {
1374
1411
  loading?: boolean;
1375
1412
  disabled?: boolean;
1376
- icon: Partial<IconTypes>;
1413
+ icon: Partial<IconTypes> | CombinedIcon;
1377
1414
  toolTip?: string;
1378
1415
  tabIndex?: number;
1379
1416
  onClickCallback: () => void;
@@ -1460,7 +1497,7 @@ interface InlineButtonProps {
1460
1497
  onClickCallback?: (e: MouseEvent<HTMLButtonElement>) => void;
1461
1498
  className?: string;
1462
1499
  children?: ReactNode;
1463
- icon?: Partial<IconTypes>;
1500
+ icon?: Partial<IconTypes> | CombinedIcon;
1464
1501
  iconSize?: SizeTypes.SMALL | SizeTypes.MEDIUM | SizeTypes.LARGE;
1465
1502
  /** @default false */
1466
1503
  rotateIcon?: boolean;
@@ -1504,7 +1541,7 @@ interface LinkProps {
1504
1541
  /** Renders a react-router Link instead of an anchor. Requires a surrounding Router. */
1505
1542
  to?: string;
1506
1543
  text?: string;
1507
- icon?: Partial<IconTypes>;
1544
+ icon?: Partial<IconTypes> | CombinedIcon;
1508
1545
  /** @default ColorTypes.CURRENT */
1509
1546
  iconColor?: Partial<ColorTypes>;
1510
1547
  /** @default SizeTypes.MEDIUM */
@@ -1549,7 +1586,7 @@ declare const Link: FC<LinkProps>;
1549
1586
  interface IconInterface {
1550
1587
  loading?: boolean;
1551
1588
  disabled?: boolean;
1552
- icon: Partial<IconTypes>;
1589
+ icon: Partial<IconTypes> | CombinedIcon;
1553
1590
  toolTip?: string;
1554
1591
  tabIndex?: number;
1555
1592
  onClickCallback: () => void;
@@ -1613,7 +1650,7 @@ interface ListButtonProps {
1613
1650
  */
1614
1651
  labelClassName?: string;
1615
1652
  iconClassName?: string;
1616
- icon?: Partial<IconTypes>;
1653
+ icon?: Partial<IconTypes> | CombinedIcon;
1617
1654
  /** Applied to the icon if in a Link component. Otherwise, size is inherited from the button's size.
1618
1655
  * @default SizeTypes.SMALL */
1619
1656
  iconSize?: SizeTypes.SMALL | SizeTypes.MEDIUM | SizeTypes.LARGE | SizeTypes.AUTO | undefined;
@@ -1669,7 +1706,7 @@ interface ListItemProps extends MarginInterface, PaddingInterface {
1669
1706
  withHoverEffect?: boolean;
1670
1707
  /** @default true */
1671
1708
  withEllipsis?: boolean;
1672
- imageIcon?: Partial<IconTypes>;
1709
+ imageIcon?: Partial<IconTypes> | CombinedIcon;
1673
1710
  /** @default SizeTypes.MEDIUM */
1674
1711
  size: Partial<SizeTypes>;
1675
1712
  /** @default AspectRatioTypes.ar1_1 */
@@ -1744,9 +1781,9 @@ interface MultiActionButtonProps {
1744
1781
  sizeLg?: SizeTypes.SMALL | SizeTypes.MEDIUM | SizeTypes.LARGE;
1745
1782
  sizeXl?: SizeTypes.SMALL | SizeTypes.MEDIUM | SizeTypes.LARGE;
1746
1783
  iconSize?: SizeTypes.SMALL | SizeTypes.MEDIUM | SizeTypes.LARGE;
1747
- leftIcon?: Partial<IconTypes>;
1748
- middleIcon?: Partial<IconTypes>;
1749
- rightIcon?: Partial<IconTypes>;
1784
+ leftIcon?: Partial<IconTypes> | CombinedIcon;
1785
+ middleIcon?: Partial<IconTypes> | CombinedIcon;
1786
+ rightIcon?: Partial<IconTypes> | CombinedIcon;
1750
1787
  rotateLeftIconByDegree?: 0 | 45 | 90 | 135 | 180 | 225 | 270 | 315;
1751
1788
  rotateMiddleIconByDegree?: 0 | 45 | 90 | 135 | 180 | 225 | 270 | 315;
1752
1789
  rotateRightIconByDegree?: 0 | 45 | 90 | 135 | 180 | 225 | 270 | 315;
@@ -1965,7 +2002,7 @@ interface SortableTableProps {
1965
2002
  /** Shown in place of the rows when `data` is empty and `loading` is false. */
1966
2003
  noDataMessage?: {
1967
2004
  title?: string;
1968
- icon?: Partial<IconTypes>;
2005
+ icon?: Partial<IconTypes> | CombinedIcon;
1969
2006
  message?: string;
1970
2007
  };
1971
2008
  }
@@ -2212,4 +2249,4 @@ declare const NoDataMessage: {
2212
2249
  displayName: string;
2213
2250
  };
2214
2251
 
2215
- export { AnimatedCount, AnimatedCountProps, AppColors, AspectRatioTypes, Badge, BadgeItem, BadgeList, BadgeListProps, BadgeProps, BadgeTypes, BorderInterface, Box, Button, Card, Checkbox, ColorStyleInterface, ColorTypes, Combobox, ComboboxAriaLabels, ComboboxMultipleProps, ComboboxProps, ComboboxSingleProps, ComboboxValue, DropDown, DropDownItem, DropDownProps, 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, OptionItem as SelectInputOptionItem, SelectInputProps, Separator, SizeStyleInterface, SizeTypes, SkeletonItem, SolidSpinner, SortableTable, SortableTableCellInterface, SortableTableProps, Span, SwitchButton, Tab, TabGroup, TabGroupProps, TabIndicatorProps, TabProps, TabValue, TableTypes, TextAreaInput, ToolTip, borderClassNames, flexClassNames, marginClassNames, paddingClassNames };
2252
+ export { AnimatedCount, AnimatedCountProps, AppColors, AspectRatioTypes, Badge, BadgeItem, BadgeList, BadgeListProps, BadgeProps, BadgeTypes, BorderInterface, Box, Button, Card, Checkbox, ColorStyleInterface, ColorTypes, CombinedIcon, Combobox, ComboboxAriaLabels, ComboboxMultipleProps, ComboboxProps, ComboboxSingleProps, ComboboxValue, DropDown, DropDownItem, DropDownProps, 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, OptionItem as SelectInputOptionItem, SelectInputProps, Separator, SizeStyleInterface, SizeTypes, SkeletonItem, SolidSpinner, SortableTable, SortableTableCellInterface, SortableTableProps, Span, SwitchButton, Tab, TabGroup, TabGroupProps, TabIndicatorProps, TabProps, TabValue, TableTypes, TextAreaInput, ToolTip, borderClassNames, flexClassNames, marginClassNames, paddingClassNames };