@iota/apps-ui-kit 0.5.0 → 0.6.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.
Files changed (57) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/index.d.ts +47 -19
  3. package/dist/index.es.js +3609 -3516
  4. package/dist/index.es.js.map +1 -1
  5. package/dist/index.umd.js +43 -43
  6. package/dist/index.umd.js.map +1 -1
  7. package/dist/style.css +1 -1
  8. package/package.json +3 -4
  9. package/src/lib/components/atoms/badge/Badge.tsx +1 -1
  10. package/src/lib/components/atoms/button/button-variants/ButtonPill.tsx +1 -1
  11. package/src/lib/components/atoms/button/button-variants/ButtonUnstyled.tsx +1 -1
  12. package/src/lib/components/atoms/button/button-variants/buttonVariants.types.ts +1 -1
  13. package/src/lib/components/atoms/button-segment/ButtonSegment.tsx +15 -3
  14. package/src/lib/components/atoms/info-box/InfoBox.tsx +2 -1
  15. package/src/lib/components/atoms/key-value-info/KeyValueInfo.tsx +3 -2
  16. package/src/lib/components/atoms/label-text/LabelText.tsx +2 -1
  17. package/src/lib/components/atoms/list-item/ListItem.tsx +2 -2
  18. package/src/lib/components/atoms/snackbar/Snackbar.tsx +1 -1
  19. package/src/lib/components/atoms/tooltip/Tooltip.tsx +115 -14
  20. package/src/lib/components/molecules/account/Account.tsx +21 -3
  21. package/src/lib/components/molecules/address/Address.tsx +1 -1
  22. package/src/lib/components/molecules/card/CardAction.tsx +1 -1
  23. package/src/lib/components/molecules/card/CardBody.tsx +3 -3
  24. package/src/lib/components/molecules/chip/Chip.tsx +1 -1
  25. package/src/lib/components/molecules/display-stats/DisplayStats.tsx +41 -3
  26. package/src/lib/components/molecules/input/Input.tsx +5 -4
  27. package/src/lib/components/molecules/input/InputWrapper.tsx +1 -1
  28. package/src/lib/components/molecules/input/TextArea.tsx +3 -2
  29. package/src/lib/components/molecules/input/input.types.ts +3 -3
  30. package/src/lib/components/molecules/navbar-item/NavbarItemHorizontal.tsx +2 -2
  31. package/src/lib/components/molecules/navbar-item/NavbarItemVertical.tsx +2 -2
  32. package/src/lib/components/molecules/search/Search.tsx +2 -9
  33. package/src/lib/components/molecules/segmented-button/SegmentedButton.tsx +7 -3
  34. package/src/lib/components/molecules/select/Select.tsx +2 -3
  35. package/src/lib/components/molecules/table-cell/TableCell.tsx +2 -2
  36. package/src/lib/components/molecules/table-header-cell/TableHeaderCell.tsx +1 -1
  37. package/src/lib/components/molecules/title/Title.tsx +2 -1
  38. package/src/lib/components/organisms/accordion/Accordion.tsx +2 -2
  39. package/src/lib/components/organisms/dialog/Dialog.tsx +20 -1
  40. package/src/lib/components/organisms/navbar/Navbar.tsx +2 -1
  41. package/src/lib/components/organisms/navbar/NavbarSlideout.tsx +3 -2
  42. package/src/lib/components/organisms/table/Table.tsx +6 -12
  43. package/src/lib/components/organisms/table/TableContext.tsx +2 -1
  44. package/src/lib/tailwind/base.presets.ts +1 -1
  45. package/src/lib/tailwind/constants/fontSizes.constants.ts +1 -1
  46. package/src/lib/tailwind/helpers.ts +1 -1
  47. package/src/lib/tailwind/responsive.presets.ts +1 -1
  48. package/src/lib/tailwind/types.ts +1 -1
  49. package/src/storybook/blocks/TypeSet.tsx +1 -1
  50. package/src/storybook/stories/atoms/Snackbar.stories.tsx +2 -1
  51. package/src/storybook/stories/molecules/Card.stories.tsx +1 -4
  52. package/src/storybook/stories/molecules/Dropdown.stories.tsx +1 -1
  53. package/src/storybook/stories/molecules/Input.stories.tsx +2 -1
  54. package/src/storybook/stories/molecules/Search.stories.tsx +2 -1
  55. package/src/storybook/stories/molecules/SegmentedButton.stories.tsx +2 -1
  56. package/src/storybook/stories/molecules/Select.stories.tsx +2 -1
  57. package/src/storybook/stories/organisms/Navbar.stories.tsx +2 -1
@@ -1,11 +1,11 @@
1
1
  // Copyright (c) 2024 IOTA Stiftung
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- import { PropsWithChildren } from 'react';
4
+ import type { PropsWithChildren } from 'react';
5
5
  import { BACKGROUND_COLORS, OUTLINED_BORDER } from './segmentedButton.classes';
6
6
  import cx from 'classnames';
7
7
  import { SegmentedButtonType } from './segmentedButton.enums';
8
- import { ButtonSegmentType } from '../../atoms';
8
+ import { ButtonSegmentType } from '@/components/atoms';
9
9
 
10
10
  interface SegmentedButtonProps {
11
11
  /**
@@ -26,8 +26,12 @@ export function SegmentedButton({
26
26
  const backgroundColors = BACKGROUND_COLORS[type];
27
27
  const borderColors = type === SegmentedButtonType.Outlined ? OUTLINED_BORDER : '';
28
28
  const borderShape = shape === ButtonSegmentType.Rounded ? 'rounded-full gap-1 p-xxs' : '';
29
+ const scrollable =
30
+ shape === ButtonSegmentType.Rounded ? 'flex-wrap' : 'flex-nowrap overflow-x-auto';
29
31
  return (
30
- <div className={cx('flex flex-row flex-wrap', backgroundColors, borderColors, borderShape)}>
32
+ <div
33
+ className={cx('flex flex-row', backgroundColors, borderColors, borderShape, scrollable)}
34
+ >
31
35
  {children}
32
36
  </div>
33
37
  );
@@ -5,10 +5,9 @@ import { TriangleDown } from '@iota/apps-ui-icons';
5
5
  import cx from 'classnames';
6
6
  import { forwardRef, useEffect, useState } from 'react';
7
7
  import { Dropdown } from '../dropdown/Dropdown';
8
- import { SecondaryText } from '../../atoms/secondary-text';
8
+ import { SecondaryText } from '@/components/atoms/secondary-text';
9
9
  import { InputWrapper, LabelHtmlTag } from '../input/InputWrapper';
10
- import { ButtonUnstyled } from '../../atoms/button';
11
- import { ListItem } from '../../atoms';
10
+ import { ListItem, ButtonUnstyled } from '@/components/atoms';
12
11
  import { DropdownPosition } from '../dropdown';
13
12
  import { SelectSize } from './select.enums';
14
13
 
@@ -1,8 +1,8 @@
1
1
  // Copyright (c) 2024 IOTA Stiftung
2
2
  // SPDX-License-Identifier: Apache-2.0
3
- import { PropsWithChildren } from 'react';
3
+ import type { PropsWithChildren } from 'react';
4
4
  import cx from 'classnames';
5
- import { Placeholder } from '../../atoms';
5
+ import { Placeholder } from '@/components/atoms';
6
6
 
7
7
  interface TableCellBaseProps {
8
8
  /**
@@ -3,7 +3,7 @@
3
3
 
4
4
  import { SortByDown, SortByUp } from '@iota/apps-ui-icons';
5
5
  import cx from 'classnames';
6
- import { Checkbox } from '@/lib';
6
+ import { Checkbox } from '@/components/atoms/checkbox';
7
7
  import { TableHeaderCellSortOrder } from './tableHeaderCell.enums';
8
8
 
9
9
  export interface TableHeaderCellProps {
@@ -1,7 +1,8 @@
1
1
  // Copyright (c) 2024 IOTA Stiftung
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- import { Tooltip, TooltipPosition } from '../../atoms';
4
+ import type { TooltipPosition } from '@/components/atoms';
5
+ import { Tooltip } from '@/components/atoms';
5
6
  import { Info } from '@iota/apps-ui-icons';
6
7
  import { TitleSize } from './titleSize.enums';
7
8
  import cx from 'classnames';
@@ -1,10 +1,10 @@
1
1
  // Copyright (c) 2024 IOTA Stiftung
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- import { PropsWithChildren } from 'react';
4
+ import type { PropsWithChildren } from 'react';
5
5
  import cx from 'classnames';
6
6
  import { ArrowDown } from '@iota/apps-ui-icons';
7
- import { Button, ButtonType } from '@/lib';
7
+ import { Button, ButtonType } from '@/components/atoms';
8
8
  import { ICON_STYLE } from './accordion.classes';
9
9
 
10
10
  export interface AccordionHeaderProps {
@@ -9,7 +9,26 @@ import { Close } from '@iota/apps-ui-icons';
9
9
  import { useEffect, useState } from 'react';
10
10
  import { DialogPosition } from './dialog.enums';
11
11
 
12
- const Dialog = RadixDialog.Root;
12
+ const Dialog = ({
13
+ open,
14
+ onOpenChange,
15
+ children,
16
+ ...props
17
+ }: React.ComponentPropsWithoutRef<typeof RadixDialog.Root>) => {
18
+ const handleOpenChange = (isOpen: boolean) => {
19
+ const isMouseOverToast = document.querySelector('.toast-layer:hover');
20
+ if (!isOpen && isMouseOverToast) {
21
+ return;
22
+ }
23
+ onOpenChange?.(isOpen);
24
+ };
25
+
26
+ return (
27
+ <RadixDialog.Root open={open} onOpenChange={handleOpenChange} {...props}>
28
+ {children}
29
+ </RadixDialog.Root>
30
+ );
31
+ };
13
32
  const DialogTrigger = RadixDialog.Trigger;
14
33
  const DialogClose = RadixDialog.Close;
15
34
 
@@ -3,7 +3,8 @@
3
3
 
4
4
  import cx from 'classnames';
5
5
  import { IotaLogoMark, MenuIcon } from '@iota/apps-ui-icons';
6
- import { NavbarItem, NavbarItemProps } from '@/components/molecules/navbar-item/NavbarItem';
6
+ import type { NavbarItemProps } from '@/components/molecules/navbar-item/NavbarItem';
7
+ import { NavbarItem } from '@/components/molecules/navbar-item/NavbarItem';
7
8
 
8
9
  export type NavbarItemWithId = NavbarItemProps & { id: string };
9
10
 
@@ -3,8 +3,9 @@
3
3
 
4
4
  import { ArrowBack } from '@iota/apps-ui-icons';
5
5
  import cx from 'classnames';
6
- import { Button, ButtonType, NavbarItem, NavbarItemType } from '@/components';
7
- import { NavbarProps } from './Navbar';
6
+ import { Button, ButtonType } from '@/components/atoms';
7
+ import { NavbarItem, NavbarItemType } from '@/components/molecules';
8
+ import type { NavbarProps } from './Navbar';
8
9
 
9
10
  export function NavbarSlideout({
10
11
  items,
@@ -1,18 +1,12 @@
1
1
  // Copyright (c) 2024 IOTA Stiftung
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- import { PropsWithChildren, ReactNode } from 'react';
4
+ import type { PropsWithChildren, ReactNode } from 'react';
5
5
  import cx from 'classnames';
6
6
  import { TableProvider, useTableContext } from './TableContext';
7
- import {
8
- Button,
9
- ButtonProps,
10
- ButtonSize,
11
- ButtonType,
12
- Checkbox,
13
- TableCellBase,
14
- TableHeaderCell,
15
- } from '@/lib';
7
+ import type { ButtonProps } from '@/components/atoms';
8
+ import { Button, ButtonSize, ButtonType, Checkbox } from '@/components/atoms';
9
+ import { TableCellBase, TableHeaderCell } from '@/components/molecules';
16
10
  import { ArrowLeft, DoubleArrowLeft, ArrowRight, DoubleArrowRight } from '@iota/apps-ui-icons';
17
11
 
18
12
  export interface TablePaginationOptions {
@@ -109,9 +103,9 @@ export function Table({
109
103
  </table>
110
104
  </div>
111
105
  <div
112
- className={cx('flex w-full items-center gap-2 pt-md', {
106
+ className={cx('flex w-full items-center gap-sm pt-md', {
113
107
  hidden: !supportingLabel && !paginationOptions && !action,
114
- 'justify-between': paginationOptions,
108
+ 'flex-col justify-between sm:flex-row': paginationOptions,
115
109
  'justify-end': !paginationOptions && action,
116
110
  })}
117
111
  >
@@ -1,7 +1,8 @@
1
1
  // Copyright (c) 2024 IOTA Stiftung
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- import { createContext, PropsWithChildren, useContext } from 'react';
4
+ import type { PropsWithChildren } from 'react';
5
+ import { createContext, useContext } from 'react';
5
6
 
6
7
  export interface TableProviderProps {
7
8
  /**
@@ -1,7 +1,7 @@
1
1
  // Copyright (c) 2024 IOTA Stiftung
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- import { Config } from 'tailwindcss';
4
+ import type { Config } from 'tailwindcss';
5
5
  import { IOTA_PRIMITIVES_COLOR_PALETTE, SHADER_COLOR_PALETTE } from '../constants/colors.constants';
6
6
  import {
7
7
  CUSTOM_FONT_SIZES,
@@ -1,7 +1,7 @@
1
1
  // Copyright (c) 2024 IOTA Stiftung
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- import { ThemeConfig } from 'tailwindcss/types/config';
4
+ import type { ThemeConfig } from 'tailwindcss/types/config';
5
5
 
6
6
  type TailwindFontSize = ThemeConfig['fontSize'];
7
7
 
@@ -1,7 +1,7 @@
1
1
  // Copyright (c) 2024 IOTA Stiftung
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- import { ScreenSize } from '../enums';
4
+ import type { ScreenSize } from '../enums';
5
5
 
6
6
  export const pxToRem = (px: number, base: number = 16) => `${px / base}rem`;
7
7
 
@@ -24,7 +24,7 @@ const responsivePreset: Config = merge({}, BASE_CONFIG, {
24
24
  center: true,
25
25
  screens,
26
26
  padding: {
27
- DEFAULT: pxToRem(24),
27
+ DEFAULT: pxToRem(20),
28
28
  md: pxToRem(48),
29
29
  lg: pxToRem(120),
30
30
  xl: pxToRem(240),
@@ -1,6 +1,6 @@
1
1
  // Copyright (c) 2024 IOTA Stiftung
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- import { ScreenSize } from '../enums';
4
+ import type { ScreenSize } from '../enums';
5
5
 
6
6
  export type ScreenBreakpoints = Record<ScreenSize, number>;
@@ -3,7 +3,7 @@
3
3
 
4
4
  import { TypeSetItem } from './TypeSetItem';
5
5
  import { getFontSizeLabelFromClass } from '../helpers';
6
- import { TailwindCustomFonts } from '@/lib/tailwind/constants';
6
+ import type { TailwindCustomFonts } from '@/lib/tailwind/constants';
7
7
 
8
8
  export interface TypeSetProps {
9
9
  typeset: TailwindCustomFonts;
@@ -3,7 +3,8 @@
3
3
 
4
4
  import { useState } from 'react';
5
5
  import type { Meta, StoryObj } from '@storybook/react';
6
- import { Snackbar, SnackbarProps, SnackbarType, Button } from '@/components/atoms';
6
+ import type { SnackbarProps } from '@/components/atoms';
7
+ import { Snackbar, SnackbarType, Button } from '@/components/atoms';
7
8
 
8
9
  const meta: Meta<SnackbarProps> = {
9
10
  component: Snackbar,
@@ -3,15 +3,12 @@
3
3
 
4
4
  import type { Meta, StoryObj } from '@storybook/react';
5
5
  import { IotaLogoSmall } from '@iota/apps-ui-icons';
6
+ import type { CardProps, CardImageProps, CardBodyProps, CardActionProps } from '@/components';
6
7
  import {
7
8
  Card,
8
- CardProps,
9
9
  CardImage,
10
- CardImageProps,
11
10
  CardAction,
12
11
  CardBody,
13
- CardBodyProps,
14
- CardActionProps,
15
12
  CardActionType,
16
13
  CardType,
17
14
  ImageType,
@@ -3,7 +3,7 @@
3
3
 
4
4
  import type { Meta, StoryObj } from '@storybook/react';
5
5
  import { Dropdown, ListItem } from '@/components';
6
- import { ComponentProps } from 'react';
6
+ import type { ComponentProps } from 'react';
7
7
 
8
8
  const meta = {
9
9
  component: Dropdown,
@@ -5,7 +5,8 @@ import type { Meta, StoryObj } from '@storybook/react';
5
5
 
6
6
  import { Input, InputType } from '@/lib/components/molecules/input';
7
7
  import { PlaceholderReplace } from '@iota/apps-ui-icons';
8
- import { ComponentProps, useCallback, useEffect, useState } from 'react';
8
+ import type { ComponentProps } from 'react';
9
+ import { useCallback, useEffect, useState } from 'react';
9
10
  import { ButtonPill } from '@/lib/components/atoms/button';
10
11
 
11
12
  type CustomStoryProps = {
@@ -3,7 +3,8 @@
3
3
 
4
4
  import { useState } from 'react';
5
5
  import type { Meta, StoryObj } from '@storybook/react';
6
- import { ListItem, Search, SearchBarType, Suggestion } from '@/components';
6
+ import type { Suggestion } from '@/components';
7
+ import { ListItem, Search, SearchBarType } from '@/components';
7
8
  import cx from 'classnames';
8
9
 
9
10
  const meta: Meta<typeof Search> = {
@@ -9,7 +9,8 @@ import {
9
9
  SegmentedButton,
10
10
  SegmentedButtonType,
11
11
  } from '@/components';
12
- import { ComponentProps, useState } from 'react';
12
+ import type { ComponentProps } from 'react';
13
+ import { useState } from 'react';
13
14
  import { PlaceholderReplace } from '@iota/apps-ui-icons';
14
15
 
15
16
  const meta: Meta<typeof SegmentedButton> = {
@@ -2,7 +2,8 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
4
  import type { Meta, StoryObj } from '@storybook/react';
5
- import { Select, SelectOption } from '@/components/molecules/select/Select';
5
+ import type { SelectOption } from '@/components/molecules/select/Select';
6
+ import { Select } from '@/components/molecules/select/Select';
6
7
  import { useState } from 'react';
7
8
  import { IotaLogoMark, PlaceholderReplace } from '@iota/apps-ui-icons';
8
9
 
@@ -3,7 +3,8 @@
3
3
 
4
4
  import type { Meta, StoryObj } from '@storybook/react';
5
5
  import { Activity, Apps, Assets, Home } from '@iota/apps-ui-icons';
6
- import { Navbar, NavbarSlideout, NavbarItemWithId, NavbarProps } from '@/components';
6
+ import type { NavbarItemWithId, NavbarProps } from '@/components';
7
+ import { Navbar, NavbarSlideout } from '@/components';
7
8
  import { useState } from 'react';
8
9
 
9
10
  const NAVBAR_ITEMS: NavbarItemWithId[] = [