@iota/apps-ui-kit 0.3.0 → 0.5.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.
Files changed (67) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/README.md +16 -0
  3. package/dist/index.d.ts +105 -22
  4. package/dist/index.es.js +3194 -3035
  5. package/dist/index.es.js.map +1 -1
  6. package/dist/index.umd.js +44 -44
  7. package/dist/index.umd.js.map +1 -1
  8. package/dist/style.css +1 -1
  9. package/package.json +2 -4
  10. package/src/lib/components/atoms/badge/Badge.tsx +1 -1
  11. package/src/lib/components/atoms/badge/badge.classes.ts +9 -0
  12. package/src/lib/components/atoms/badge/badge.enums.ts +3 -0
  13. package/src/lib/components/atoms/button/button-variants/ButtonPill.tsx +1 -1
  14. package/src/lib/components/atoms/button/button-variants/ButtonUnstyled.tsx +1 -1
  15. package/src/lib/components/atoms/button/button-variants/buttonVariants.types.ts +1 -1
  16. package/src/lib/components/atoms/index.ts +1 -0
  17. package/src/lib/components/atoms/info-box/InfoBox.tsx +3 -2
  18. package/src/lib/components/atoms/key-value-info/KeyValueInfo.tsx +3 -2
  19. package/src/lib/components/atoms/label-text/LabelText.tsx +2 -1
  20. package/src/lib/components/atoms/list-item/ListItem.tsx +2 -2
  21. package/src/lib/components/atoms/snackbar/Snackbar.tsx +1 -1
  22. package/src/lib/components/atoms/toggle/Toggle.tsx +140 -0
  23. package/src/lib/components/atoms/toggle/index.ts +6 -0
  24. package/src/lib/components/atoms/toggle/toggle.classes.ts +41 -0
  25. package/src/lib/components/atoms/toggle/toggle.enums.ts +12 -0
  26. package/src/lib/components/atoms/tooltip/Tooltip.tsx +3 -3
  27. package/src/lib/components/molecules/account/Account.tsx +21 -3
  28. package/src/lib/components/molecules/address/Address.tsx +1 -1
  29. package/src/lib/components/molecules/card/CardAction.tsx +1 -1
  30. package/src/lib/components/molecules/card/CardBody.tsx +14 -3
  31. package/src/lib/components/molecules/card/card.classes.ts +1 -0
  32. package/src/lib/components/molecules/card/card.enums.ts +1 -0
  33. package/src/lib/components/molecules/chip/Chip.tsx +1 -1
  34. package/src/lib/components/molecules/display-stats/DisplayStats.tsx +41 -3
  35. package/src/lib/components/molecules/input/Input.tsx +5 -4
  36. package/src/lib/components/molecules/input/InputWrapper.tsx +1 -1
  37. package/src/lib/components/molecules/input/TextArea.tsx +3 -2
  38. package/src/lib/components/molecules/input/input.types.ts +3 -3
  39. package/src/lib/components/molecules/navbar-item/NavbarItemHorizontal.tsx +2 -2
  40. package/src/lib/components/molecules/navbar-item/NavbarItemVertical.tsx +2 -2
  41. package/src/lib/components/molecules/search/Search.tsx +4 -8
  42. package/src/lib/components/molecules/segmented-button/SegmentedButton.tsx +2 -2
  43. package/src/lib/components/molecules/select/Select.tsx +2 -3
  44. package/src/lib/components/molecules/table-cell/TableCell.tsx +2 -2
  45. package/src/lib/components/molecules/table-header-cell/TableHeaderCell.tsx +1 -1
  46. package/src/lib/components/molecules/title/Title.tsx +11 -2
  47. package/src/lib/components/organisms/accordion/Accordion.tsx +2 -2
  48. package/src/lib/components/organisms/dialog/Dialog.tsx +20 -1
  49. package/src/lib/components/organisms/navbar/Navbar.tsx +2 -1
  50. package/src/lib/components/organisms/navbar/NavbarSlideout.tsx +3 -2
  51. package/src/lib/components/organisms/table/Table.tsx +23 -13
  52. package/src/lib/components/organisms/table/TableContext.tsx +2 -1
  53. package/src/lib/constants/colors.constants.ts +1 -0
  54. package/src/lib/tailwind/base.presets.ts +1 -1
  55. package/src/lib/tailwind/constants/fontSizes.constants.ts +1 -1
  56. package/src/lib/tailwind/helpers.ts +1 -1
  57. package/src/lib/tailwind/types.ts +1 -1
  58. package/src/storybook/blocks/TypeSet.tsx +1 -1
  59. package/src/storybook/stories/atoms/Snackbar.stories.tsx +2 -1
  60. package/src/storybook/stories/atoms/Toggle.stories.tsx +59 -0
  61. package/src/storybook/stories/molecules/Card.stories.tsx +1 -4
  62. package/src/storybook/stories/molecules/Dropdown.stories.tsx +1 -1
  63. package/src/storybook/stories/molecules/Input.stories.tsx +2 -1
  64. package/src/storybook/stories/molecules/Search.stories.tsx +2 -1
  65. package/src/storybook/stories/molecules/SegmentedButton.stories.tsx +2 -1
  66. package/src/storybook/stories/molecules/Select.stories.tsx +2 -1
  67. package/src/storybook/stories/organisms/Navbar.stories.tsx +2 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,42 @@
1
1
  # @iota/apps-ui-kit
2
2
 
3
+ ## 0.5.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 0524b61: add Tooltip to Badge in Account component
8
+ - a6d0c82: Add eslint config. Resolve eslint errors/warnings.
9
+ - a756bbc: add copy button to DisplayStats component
10
+ - 9d01a25: Fix dialog to prevent closing popup when closing a toast
11
+ - 0edfd4e: Update dependencies.
12
+ - be15d98: Update imports to avoid cycle dependencies
13
+
14
+ ## 0.5.0
15
+
16
+ ### Minor Changes
17
+
18
+ - a4b46bc: add more badge types
19
+
20
+ ### Patch Changes
21
+
22
+ - 6d274df: make renderSuggestion prop optional in Search component
23
+ - 976e7f8: Add heightFull configuration props to Table component
24
+ - bb45cb5: Add new type for CardImage component
25
+ - Updated dependencies [a4b46bc]
26
+ - @iota/apps-ui-icons@0.3.0
27
+
28
+ ## 0.4.0
29
+
30
+ ### Minor Changes
31
+
32
+ - a3f08da: add toggle component
33
+
34
+ ### Patch Changes
35
+
36
+ - 1ad39f9: Update dependencies
37
+ - 4e4f710: replace supportingText from string to ReactNode in InfoBox component
38
+ - d0cb92e: manage unreachable images by displaying a placeholder instead in VisualAssetCard
39
+
3
40
  ## 0.3.0
4
41
 
5
42
  ### Minor Changes
package/README.md ADDED
@@ -0,0 +1,16 @@
1
+ # `@iota/apps-ui-kit`
2
+
3
+ ## Usage
4
+
5
+ Installation:
6
+
7
+ ```bash
8
+ # Replace with npm, yarn, bun, etc.
9
+ pnpm install @iota/apps-ui-kit
10
+ ```
11
+
12
+ Importing:
13
+
14
+ ```typescript
15
+ import { Button } from '@iota/apps-ui-kit';
16
+ ```
package/dist/index.d.ts CHANGED
@@ -1,3 +1,7 @@
1
+ import { BadgeType as BadgeType_2 } from '../../../../components/atoms';
2
+ import { ButtonProps as ButtonProps_2 } from '../../../../components/atoms';
3
+ import { ButtonSegmentType as ButtonSegmentType_2 } from '../../../../components/atoms';
4
+ import { ButtonType as ButtonType_2 } from '../../../../components/atoms/button';
1
5
  import { ComponentProps } from 'react';
2
6
  import { Config } from 'tailwindcss';
3
7
  import { ForwardRefExoticComponent } from 'react';
@@ -9,7 +13,8 @@ import * as RadixDialog from '@radix-ui/react-dialog';
9
13
  import * as React_2 from 'react';
10
14
  import { ReactNode } from 'react';
11
15
  import { RefAttributes } from 'react';
12
- import { SearchBarType as SearchBarType_2 } from '../../../../components';
16
+ import { TooltipPosition as TooltipPosition_2 } from '../../../../components/atoms';
17
+ import { TooltipPosition as TooltipPosition_3 } from '../../../../components/atoms/tooltip';
13
18
 
14
19
  export declare function Accordion({ children, hideBorder, }: {
15
20
  children: React.ReactNode;
@@ -50,7 +55,7 @@ export declare interface AccordionHeaderProps {
50
55
  hideBorder?: boolean;
51
56
  }
52
57
 
53
- export declare function Account({ title, subtitle, badgeType, badgeText, isLocked, avatarContent, onOptionsClick, onLockAccountClick, onUnlockAccountClick, onCopy, copyText, onOpen, isCopyable, isExternal, isSelected, isActive, showSelected, }: AccountProps): React.JSX.Element;
58
+ export declare function Account({ title, subtitle, badgeType, badgeText, isLocked, avatarContent, onOptionsClick, onLockAccountClick, onUnlockAccountClick, onCopy, copyText, onOpen, isCopyable, isExternal, isSelected, isActive, showSelected, badgeTooltipText, badgeTooltipPosition, }: AccountProps): React.JSX.Element;
54
59
 
55
60
  declare interface AccountProps {
56
61
  /**
@@ -118,11 +123,19 @@ declare interface AccountProps {
118
123
  /**
119
124
  * The type of the badge.
120
125
  */
121
- badgeType?: BadgeType;
126
+ badgeType?: BadgeType_2;
122
127
  /**
123
128
  * The text of the badge.
124
129
  */
125
130
  badgeText?: string;
131
+ /**
132
+ * The tooltip text of the badge.
133
+ */
134
+ badgeTooltipText?: string;
135
+ /**
136
+ * The tooltip position of the badge.
137
+ */
138
+ badgeTooltipPosition?: TooltipPosition_2;
126
139
  }
127
140
 
128
141
  export declare function Address({ text, isCopyable, isExternal, externalLink, copyText, onCopySuccess, onCopyError, onOpen, }: AddressProps): React.JSX.Element;
@@ -178,7 +191,10 @@ declare interface BadgeProps {
178
191
  export declare enum BadgeType {
179
192
  Neutral = "neutral",
180
193
  PrimarySolid = "primary-solid",
181
- PrimarySoft = "primary-fill"
194
+ PrimarySoft = "primary-fill",
195
+ Success = "success",
196
+ Warning = "warning",
197
+ Error = "error"
182
198
  }
183
199
 
184
200
  export declare interface BaseInputProps extends InputWrapperProps {
@@ -343,7 +359,7 @@ export declare type CardActionProps = {
343
359
  onClick?: () => void;
344
360
  icon?: React.ReactNode;
345
361
  iconAfterText?: boolean;
346
- buttonType?: ButtonType;
362
+ buttonType?: ButtonType_2;
347
363
  buttonDisabled?: boolean;
348
364
  };
349
365
 
@@ -353,7 +369,7 @@ export declare enum CardActionType {
353
369
  Button = "button"
354
370
  }
355
371
 
356
- export declare function CardBody({ title, subtitle, clickableAction, icon, isTextTruncated, }: CardBodyProps): JSX_2.Element;
372
+ export declare function CardBody({ title, subtitle, clickableAction, icon, isTextTruncated, tooltipText, tooltipPosition, }: CardBodyProps): JSX_2.Element;
357
373
 
358
374
  export declare type CardBodyProps = {
359
375
  title: string;
@@ -361,6 +377,8 @@ export declare type CardBodyProps = {
361
377
  clickableAction?: React.ReactNode;
362
378
  icon?: React.ReactNode;
363
379
  isTextTruncated?: boolean;
380
+ tooltipText?: string;
381
+ tooltipPosition?: TooltipPosition_3;
364
382
  };
365
383
 
366
384
  export declare function CardImage({ type, shape, url, children, }: CardImageProps): JSX_2.Element;
@@ -480,7 +498,7 @@ declare interface ChipProps {
480
498
  disabled?: boolean;
481
499
  }
482
500
 
483
- export declare const Dialog: React_2.FC<RadixDialog.DialogProps>;
501
+ export declare const Dialog: ({ open, onOpenChange, children, ...props }: React_2.ComponentPropsWithoutRef<typeof RadixDialog.Root>) => JSX_2.Element;
484
502
 
485
503
  export declare const DialogBody: React_2.ForwardRefExoticComponent<Omit<React_2.DetailedHTMLProps<React_2.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React_2.RefAttributes<HTMLDivElement>>;
486
504
 
@@ -502,7 +520,7 @@ export declare const DialogTitle: React_2.ForwardRefExoticComponent<Omit<RadixDi
502
520
 
503
521
  export declare const DialogTrigger: React_2.ForwardRefExoticComponent<RadixDialog.DialogTriggerProps & React_2.RefAttributes<HTMLButtonElement>>;
504
522
 
505
- export declare function DisplayStats({ label, tooltipPosition, tooltipText, value, supportingLabel, type, size, icon, }: DisplayStatsProps): React.JSX.Element;
523
+ export declare function DisplayStats({ label, tooltipPosition, tooltipText, value, supportingLabel, type, size, icon, copyText, onCopySuccess, onCopyError, }: DisplayStatsProps): React.JSX.Element;
506
524
 
507
525
  declare interface DisplayStatsProps {
508
526
  /**
@@ -512,7 +530,7 @@ declare interface DisplayStatsProps {
512
530
  /**
513
531
  * The tooltip position.
514
532
  */
515
- tooltipPosition?: TooltipPosition;
533
+ tooltipPosition?: TooltipPosition_2;
516
534
  /**
517
535
  * The tooltip text.
518
536
  */
@@ -537,6 +555,18 @@ declare interface DisplayStatsProps {
537
555
  * Add icon to the right of the label.
538
556
  */
539
557
  icon?: React.ReactNode;
558
+ /**
559
+ * Text that need to be copied (optional).
560
+ */
561
+ copyText?: string;
562
+ /**
563
+ * The onCopySuccess event of the KeyValue (optional).
564
+ */
565
+ onCopySuccess?: (e: React.MouseEvent<HTMLButtonElement>, text: string) => void;
566
+ /**
567
+ * The onCopyError event of the KeyValue (optional).
568
+ */
569
+ onCopyError?: (e: unknown, text: string) => void;
540
570
  }
541
571
 
542
572
  export declare enum DisplayStatsSize {
@@ -620,6 +650,7 @@ export declare enum ImageShape {
620
650
  export declare enum ImageType {
621
651
  Placeholder = "placeholder",
622
652
  BgSolid = "bg-solid",
653
+ BgWhite = "bg-white",
623
654
  BgTransparent = "bg-transparent"
624
655
  }
625
656
 
@@ -637,7 +668,7 @@ export declare interface InfoBoxProps {
637
668
  /**
638
669
  * The supporting text of the info box (optional).
639
670
  */
640
- supportingText?: string;
671
+ supportingText?: React.ReactNode;
641
672
  /**
642
673
  * The type of the info box.
643
674
  */
@@ -781,6 +812,7 @@ export declare const IOTA_PRIMITIVES_COLOR_PALETTE: {
781
812
  warning: {
782
813
  '10': string;
783
814
  '20': string;
815
+ '60': string;
784
816
  '90': string;
785
817
  };
786
818
  };
@@ -1080,7 +1112,7 @@ export declare enum ScreenSize {
1080
1112
  Xl = "xl"
1081
1113
  }
1082
1114
 
1083
- export declare function Search({ searchValue, suggestions, onSearchValueChange, onSuggestionClick, placeholder, isLoading, onKeyDown, type, renderSuggestion, }: SearchProps): React.JSX.Element;
1115
+ export declare function Search({ searchValue, suggestions, onSearchValueChange, onSuggestionClick, placeholder, isLoading, type, renderSuggestion, }: SearchProps): React.JSX.Element;
1084
1116
 
1085
1117
  export declare enum SearchBarType {
1086
1118
  Outlined = "outlined",
@@ -1112,18 +1144,14 @@ export declare interface SearchProps {
1112
1144
  * Are the suggestions loading.
1113
1145
  */
1114
1146
  isLoading: boolean;
1115
- /**
1116
- * Callback when a key is pressed.
1117
- */
1118
- onKeyDown?: (event: React.KeyboardEvent<HTMLInputElement>) => void;
1119
1147
  /**
1120
1148
  * The type of the search bar. Can be 'outlined' or 'filled'.
1121
1149
  */
1122
- type?: SearchBarType_2;
1150
+ type?: SearchBarType;
1123
1151
  /**
1124
1152
  * Render suggestion.
1125
1153
  */
1126
- renderSuggestion: (suggestion: Suggestion, index: number) => React.ReactNode;
1154
+ renderSuggestion?: (suggestion: Suggestion, index: number) => React.ReactNode;
1127
1155
  }
1128
1156
 
1129
1157
  export declare function SegmentedButton({ type, children, shape, }: PropsWithChildren<SegmentedButtonProps>): React.JSX.Element;
@@ -1136,7 +1164,7 @@ declare interface SegmentedButtonProps {
1136
1164
  /**
1137
1165
  * The shape of the button
1138
1166
  */
1139
- shape?: ButtonSegmentType;
1167
+ shape?: ButtonSegmentType_2;
1140
1168
  }
1141
1169
 
1142
1170
  export declare enum SegmentedButtonType {
@@ -1322,9 +1350,9 @@ export declare interface Suggestion {
1322
1350
  type?: string;
1323
1351
  }
1324
1352
 
1325
- export declare function Table({ paginationOptions, action, supportingLabel, selectedRowIndexes, rowIndexes, children, pageSizeSelector, }: PropsWithChildren<TableProps>): JSX.Element;
1353
+ export declare function Table({ paginationOptions, action, supportingLabel, selectedRowIndexes, rowIndexes, children, pageSizeSelector, heightFull, }: PropsWithChildren<TableProps>): JSX.Element;
1326
1354
 
1327
- export declare function TableActionButton(props: PropsWithChildren<ButtonProps>): JSX_2.Element;
1355
+ export declare function TableActionButton(props: PropsWithChildren<ButtonProps_2>): JSX_2.Element;
1328
1356
 
1329
1357
  export declare function TableBody({ children }: PropsWithChildren): JSX.Element;
1330
1358
 
@@ -1479,6 +1507,10 @@ export declare type TableProps = {
1479
1507
  * The page size selector component.
1480
1508
  */
1481
1509
  pageSizeSelector?: ReactNode;
1510
+ /**
1511
+ * If the table should take the full height of the parent.
1512
+ */
1513
+ heightFull?: boolean;
1482
1514
  };
1483
1515
 
1484
1516
  export declare function TableRow({ children, leading, }: PropsWithChildren<{
@@ -1527,7 +1559,7 @@ declare interface TextFieldBaseProps extends TextAreaProps, InputWrapperProps {
1527
1559
  isResizeEnabled?: boolean;
1528
1560
  }
1529
1561
 
1530
- export declare function Title({ title, subtitle, trailingElement, tooltipText, supportingElement, tooltipPosition, size, }: TitleProps): JSX_2.Element;
1562
+ export declare function Title({ title, subtitle, trailingElement, tooltipText, supportingElement, tooltipPosition, size, testId, }: TitleProps): JSX_2.Element;
1531
1563
 
1532
1564
  declare interface TitleProps {
1533
1565
  /**
@@ -1545,7 +1577,7 @@ declare interface TitleProps {
1545
1577
  /**
1546
1578
  * The tooltip position.
1547
1579
  */
1548
- tooltipPosition?: TooltipPosition;
1580
+ tooltipPosition?: TooltipPosition_2;
1549
1581
  /**
1550
1582
  * The tooltip text.
1551
1583
  */
@@ -1558,6 +1590,10 @@ declare interface TitleProps {
1558
1590
  * The size of the component
1559
1591
  */
1560
1592
  size?: TitleSize;
1593
+ /**
1594
+ * The 'data-testid' attribute value (used in e2e tests)
1595
+ */
1596
+ testId?: string;
1561
1597
  }
1562
1598
 
1563
1599
  export declare enum TitleSize {
@@ -1565,6 +1601,53 @@ export declare enum TitleSize {
1565
1601
  Medium = "medium"
1566
1602
  }
1567
1603
 
1604
+ export declare const Toggle: ForwardRefExoticComponent<ToggleProps & RefAttributes<HTMLInputElement>>;
1605
+
1606
+ export declare enum ToggleLabelPosition {
1607
+ Left = "left",
1608
+ Right = "right"
1609
+ }
1610
+
1611
+ declare interface ToggleProps {
1612
+ /**
1613
+ * The label for the toggle.
1614
+ */
1615
+ label?: string | React.ReactNode;
1616
+ /**
1617
+ * The state of the toggle (on or off).
1618
+ */
1619
+ isToggled: boolean;
1620
+ /**
1621
+ * Whether the label should be placed before the toggle.
1622
+ */
1623
+ labelPosition?: ToggleLabelPosition;
1624
+ /**
1625
+ * If true, the toggle will be disabled.
1626
+ */
1627
+ isDisabled?: boolean;
1628
+ /**
1629
+ * The callback to call when the toggle state changes.
1630
+ */
1631
+ onChange?: (isToggled: boolean, event: React.ChangeEvent<HTMLInputElement>) => void;
1632
+ /**
1633
+ * The name and id of the toggle input.
1634
+ */
1635
+ name?: string;
1636
+ /**
1637
+ * The size of the toggle.
1638
+ */
1639
+ size?: ToggleSize;
1640
+ /**
1641
+ * The 'data-testid' attribute value (used in e2e tests)
1642
+ */
1643
+ testId?: string;
1644
+ }
1645
+
1646
+ export declare enum ToggleSize {
1647
+ Small = "small",
1648
+ Default = "default"
1649
+ }
1650
+
1568
1651
  export declare function Tooltip({ text, position, maxWidth, children, }: PropsWithChildren<TooltipProps>): React.JSX.Element;
1569
1652
 
1570
1653
  export declare enum TooltipPosition {