@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.
- package/CHANGELOG.md +37 -0
- package/README.md +16 -0
- package/dist/index.d.ts +105 -22
- package/dist/index.es.js +3194 -3035
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +44 -44
- package/dist/index.umd.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +2 -4
- package/src/lib/components/atoms/badge/Badge.tsx +1 -1
- package/src/lib/components/atoms/badge/badge.classes.ts +9 -0
- package/src/lib/components/atoms/badge/badge.enums.ts +3 -0
- package/src/lib/components/atoms/button/button-variants/ButtonPill.tsx +1 -1
- package/src/lib/components/atoms/button/button-variants/ButtonUnstyled.tsx +1 -1
- package/src/lib/components/atoms/button/button-variants/buttonVariants.types.ts +1 -1
- package/src/lib/components/atoms/index.ts +1 -0
- package/src/lib/components/atoms/info-box/InfoBox.tsx +3 -2
- package/src/lib/components/atoms/key-value-info/KeyValueInfo.tsx +3 -2
- package/src/lib/components/atoms/label-text/LabelText.tsx +2 -1
- package/src/lib/components/atoms/list-item/ListItem.tsx +2 -2
- package/src/lib/components/atoms/snackbar/Snackbar.tsx +1 -1
- package/src/lib/components/atoms/toggle/Toggle.tsx +140 -0
- package/src/lib/components/atoms/toggle/index.ts +6 -0
- package/src/lib/components/atoms/toggle/toggle.classes.ts +41 -0
- package/src/lib/components/atoms/toggle/toggle.enums.ts +12 -0
- package/src/lib/components/atoms/tooltip/Tooltip.tsx +3 -3
- package/src/lib/components/molecules/account/Account.tsx +21 -3
- package/src/lib/components/molecules/address/Address.tsx +1 -1
- package/src/lib/components/molecules/card/CardAction.tsx +1 -1
- package/src/lib/components/molecules/card/CardBody.tsx +14 -3
- package/src/lib/components/molecules/card/card.classes.ts +1 -0
- package/src/lib/components/molecules/card/card.enums.ts +1 -0
- package/src/lib/components/molecules/chip/Chip.tsx +1 -1
- package/src/lib/components/molecules/display-stats/DisplayStats.tsx +41 -3
- package/src/lib/components/molecules/input/Input.tsx +5 -4
- package/src/lib/components/molecules/input/InputWrapper.tsx +1 -1
- package/src/lib/components/molecules/input/TextArea.tsx +3 -2
- package/src/lib/components/molecules/input/input.types.ts +3 -3
- package/src/lib/components/molecules/navbar-item/NavbarItemHorizontal.tsx +2 -2
- package/src/lib/components/molecules/navbar-item/NavbarItemVertical.tsx +2 -2
- package/src/lib/components/molecules/search/Search.tsx +4 -8
- package/src/lib/components/molecules/segmented-button/SegmentedButton.tsx +2 -2
- package/src/lib/components/molecules/select/Select.tsx +2 -3
- package/src/lib/components/molecules/table-cell/TableCell.tsx +2 -2
- package/src/lib/components/molecules/table-header-cell/TableHeaderCell.tsx +1 -1
- package/src/lib/components/molecules/title/Title.tsx +11 -2
- package/src/lib/components/organisms/accordion/Accordion.tsx +2 -2
- package/src/lib/components/organisms/dialog/Dialog.tsx +20 -1
- package/src/lib/components/organisms/navbar/Navbar.tsx +2 -1
- package/src/lib/components/organisms/navbar/NavbarSlideout.tsx +3 -2
- package/src/lib/components/organisms/table/Table.tsx +23 -13
- package/src/lib/components/organisms/table/TableContext.tsx +2 -1
- package/src/lib/constants/colors.constants.ts +1 -0
- package/src/lib/tailwind/base.presets.ts +1 -1
- package/src/lib/tailwind/constants/fontSizes.constants.ts +1 -1
- package/src/lib/tailwind/helpers.ts +1 -1
- package/src/lib/tailwind/types.ts +1 -1
- package/src/storybook/blocks/TypeSet.tsx +1 -1
- package/src/storybook/stories/atoms/Snackbar.stories.tsx +2 -1
- package/src/storybook/stories/atoms/Toggle.stories.tsx +59 -0
- package/src/storybook/stories/molecules/Card.stories.tsx +1 -4
- package/src/storybook/stories/molecules/Dropdown.stories.tsx +1 -1
- package/src/storybook/stories/molecules/Input.stories.tsx +2 -1
- package/src/storybook/stories/molecules/Search.stories.tsx +2 -1
- package/src/storybook/stories/molecules/SegmentedButton.stories.tsx +2 -1
- package/src/storybook/stories/molecules/Select.stories.tsx +2 -1
- package/src/storybook/stories/organisms/Navbar.stories.tsx +2 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
4
|
import cx from 'classnames';
|
|
5
|
-
import { SecondaryText } from '
|
|
5
|
+
import { SecondaryText } from '@/components/atoms/secondary-text';
|
|
6
6
|
import { LABEL_CLASSES } from './input.classes';
|
|
7
7
|
import { createElement } from 'react';
|
|
8
8
|
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
4
|
import { forwardRef, useEffect, useState } from 'react';
|
|
5
|
-
import {
|
|
5
|
+
import type { InputWrapperProps } from './InputWrapper';
|
|
6
|
+
import { InputWrapper } from './InputWrapper';
|
|
6
7
|
import {
|
|
7
8
|
BORDER_CLASSES,
|
|
8
9
|
INPUT_CLASSES,
|
|
@@ -10,7 +11,7 @@ import {
|
|
|
10
11
|
INPUT_PLACEHOLDER_CLASSES,
|
|
11
12
|
} from './input.classes';
|
|
12
13
|
import cx from 'classnames';
|
|
13
|
-
import { ButtonUnstyled } from '
|
|
14
|
+
import { ButtonUnstyled } from '@/components/atoms/button';
|
|
14
15
|
import { VisibilityOff, VisibilityOn } from '@iota/apps-ui-icons';
|
|
15
16
|
|
|
16
17
|
type TextAreaProps = Omit<
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// Copyright (c) 2024 IOTA Stiftung
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import { ComponentProps } from 'react';
|
|
5
|
-
import { InputType } from '.';
|
|
6
|
-
import { NumericFormat } from 'react-number-format';
|
|
4
|
+
import type { ComponentProps } from 'react';
|
|
5
|
+
import type { InputType } from '.';
|
|
6
|
+
import type { NumericFormat } from 'react-number-format';
|
|
7
7
|
|
|
8
8
|
type InputElementProps = Omit<
|
|
9
9
|
React.ComponentProps<'input'>,
|
|
@@ -13,8 +13,8 @@ import {
|
|
|
13
13
|
UNSELECTED_ICON,
|
|
14
14
|
UNSELECTED_TEXT,
|
|
15
15
|
} from './navbarItem.classes';
|
|
16
|
-
import { Badge, BadgeType } from '
|
|
17
|
-
import { NavbarItemProps } from './NavbarItem';
|
|
16
|
+
import { Badge, BadgeType } from '@/components/atoms';
|
|
17
|
+
import type { NavbarItemProps } from './NavbarItem';
|
|
18
18
|
|
|
19
19
|
export function NavbarItemHorizontal({
|
|
20
20
|
icon,
|
|
@@ -9,8 +9,8 @@ import {
|
|
|
9
9
|
UNSELECTED_ICON,
|
|
10
10
|
UNSELECTED_TEXT,
|
|
11
11
|
} from './navbarItem.classes';
|
|
12
|
-
import { Badge, BadgeType } from '
|
|
13
|
-
import { NavbarItemProps } from './NavbarItem';
|
|
12
|
+
import { Badge, BadgeType } from '@/components/atoms';
|
|
13
|
+
import type { NavbarItemProps } from './NavbarItem';
|
|
14
14
|
|
|
15
15
|
export function NavbarItemVertical({
|
|
16
16
|
icon,
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
import { useEffect, useRef, useState } from 'react';
|
|
5
5
|
import cx from 'classnames';
|
|
6
6
|
import { Loader, Search as SearchIcon } from '@iota/apps-ui-icons';
|
|
7
|
-
import { Divider
|
|
7
|
+
import { Divider } from '@/components/atoms';
|
|
8
|
+
import { SearchBarType } from './search.enums';
|
|
8
9
|
import {
|
|
9
10
|
BACKGROUND_COLORS,
|
|
10
11
|
SUGGESTIONS_WRAPPER_STYLE,
|
|
@@ -43,10 +44,6 @@ export interface SearchProps {
|
|
|
43
44
|
* Are the suggestions loading.
|
|
44
45
|
*/
|
|
45
46
|
isLoading: boolean;
|
|
46
|
-
/**
|
|
47
|
-
* Callback when a key is pressed.
|
|
48
|
-
*/
|
|
49
|
-
onKeyDown?: (event: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
50
47
|
/**
|
|
51
48
|
* The type of the search bar. Can be 'outlined' or 'filled'.
|
|
52
49
|
*/
|
|
@@ -54,7 +51,7 @@ export interface SearchProps {
|
|
|
54
51
|
/**
|
|
55
52
|
* Render suggestion.
|
|
56
53
|
*/
|
|
57
|
-
renderSuggestion
|
|
54
|
+
renderSuggestion?: (suggestion: Suggestion, index: number) => React.ReactNode;
|
|
58
55
|
}
|
|
59
56
|
|
|
60
57
|
export function Search({
|
|
@@ -64,7 +61,6 @@ export function Search({
|
|
|
64
61
|
onSuggestionClick,
|
|
65
62
|
placeholder,
|
|
66
63
|
isLoading = false,
|
|
67
|
-
onKeyDown,
|
|
68
64
|
type = SearchBarType.Outlined,
|
|
69
65
|
renderSuggestion,
|
|
70
66
|
}: SearchProps): React.JSX.Element {
|
|
@@ -183,7 +179,7 @@ export function Search({
|
|
|
183
179
|
/>
|
|
184
180
|
<SearchIcon />
|
|
185
181
|
</div>
|
|
186
|
-
{showSuggestions && (
|
|
182
|
+
{showSuggestions && renderSuggestion && (
|
|
187
183
|
<div
|
|
188
184
|
ref={suggestionsListRef}
|
|
189
185
|
className={cx(
|
|
@@ -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 '
|
|
8
|
+
import { ButtonSegmentType } from '@/components/atoms';
|
|
9
9
|
|
|
10
10
|
interface SegmentedButtonProps {
|
|
11
11
|
/**
|
|
@@ -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 '
|
|
8
|
+
import { SecondaryText } from '@/components/atoms/secondary-text';
|
|
9
9
|
import { InputWrapper, LabelHtmlTag } from '../input/InputWrapper';
|
|
10
|
-
import { ButtonUnstyled } from '
|
|
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 '
|
|
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 '@/
|
|
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 {
|
|
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';
|
|
@@ -36,6 +37,10 @@ interface TitleProps {
|
|
|
36
37
|
* The size of the component
|
|
37
38
|
*/
|
|
38
39
|
size?: TitleSize;
|
|
40
|
+
/**
|
|
41
|
+
* The 'data-testid' attribute value (used in e2e tests)
|
|
42
|
+
*/
|
|
43
|
+
testId?: string;
|
|
39
44
|
}
|
|
40
45
|
|
|
41
46
|
export function Title({
|
|
@@ -46,9 +51,13 @@ export function Title({
|
|
|
46
51
|
supportingElement,
|
|
47
52
|
tooltipPosition,
|
|
48
53
|
size = TitleSize.Medium,
|
|
54
|
+
testId,
|
|
49
55
|
}: TitleProps) {
|
|
50
56
|
return (
|
|
51
|
-
<div
|
|
57
|
+
<div
|
|
58
|
+
className={cx('flex flex-row items-center justify-between', TITLE_PADDINGS[size])}
|
|
59
|
+
data-testid={testId}
|
|
60
|
+
>
|
|
52
61
|
<div className="flex flex-row items-center gap-x-xxxs">
|
|
53
62
|
<div className="flex flex-col justify-start">
|
|
54
63
|
<div className="flex flex-row items-center gap-x-0.5 text-neutral-10 dark:text-neutral-92">
|
|
@@ -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 '@/
|
|
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 =
|
|
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 {
|
|
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
|
|
7
|
-
import {
|
|
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
|
-
|
|
9
|
-
|
|
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 {
|
|
@@ -75,6 +69,11 @@ export type TableProps = {
|
|
|
75
69
|
* The page size selector component.
|
|
76
70
|
*/
|
|
77
71
|
pageSizeSelector?: ReactNode;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* If the table should take the full height of the parent.
|
|
75
|
+
*/
|
|
76
|
+
heightFull?: boolean;
|
|
78
77
|
};
|
|
79
78
|
|
|
80
79
|
export function Table({
|
|
@@ -85,12 +84,23 @@ export function Table({
|
|
|
85
84
|
rowIndexes,
|
|
86
85
|
children,
|
|
87
86
|
pageSizeSelector,
|
|
87
|
+
heightFull = false,
|
|
88
88
|
}: PropsWithChildren<TableProps>): JSX.Element {
|
|
89
89
|
return (
|
|
90
90
|
<TableProvider selectedRowIndexes={selectedRowIndexes} rowIndexes={rowIndexes}>
|
|
91
|
-
<div className=
|
|
92
|
-
<div
|
|
93
|
-
|
|
91
|
+
<div className={cx('w-full', { 'h-full': heightFull })}>
|
|
92
|
+
<div
|
|
93
|
+
className={cx('overflow-auto', {
|
|
94
|
+
'h-full': heightFull,
|
|
95
|
+
})}
|
|
96
|
+
>
|
|
97
|
+
<table
|
|
98
|
+
className={cx('w-full table-auto', {
|
|
99
|
+
'h-full': heightFull,
|
|
100
|
+
})}
|
|
101
|
+
>
|
|
102
|
+
{children}
|
|
103
|
+
</table>
|
|
94
104
|
</div>
|
|
95
105
|
<div
|
|
96
106
|
className={cx('flex w-full items-center gap-2 pt-md', {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// Copyright (c) 2024 IOTA Stiftung
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import {
|
|
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,
|
|
@@ -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 {
|
|
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,
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// Copyright (c) 2024 IOTA Stiftung
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
5
|
+
import { Toggle, ToggleLabelPosition, ToggleSize } from '@/components';
|
|
6
|
+
import { useState } from 'react';
|
|
7
|
+
|
|
8
|
+
const meta: Meta<typeof Toggle> = {
|
|
9
|
+
component: Toggle,
|
|
10
|
+
tags: ['autodocs'],
|
|
11
|
+
argTypes: {
|
|
12
|
+
isToggled: {
|
|
13
|
+
control: { type: 'boolean' },
|
|
14
|
+
},
|
|
15
|
+
label: {
|
|
16
|
+
control: { type: 'text' },
|
|
17
|
+
},
|
|
18
|
+
labelPosition: {
|
|
19
|
+
control: { type: 'select' },
|
|
20
|
+
options: Object.values(ToggleLabelPosition),
|
|
21
|
+
},
|
|
22
|
+
isDisabled: {
|
|
23
|
+
control: { type: 'boolean' },
|
|
24
|
+
},
|
|
25
|
+
size: {
|
|
26
|
+
control: { type: 'select' },
|
|
27
|
+
options: Object.values(ToggleSize),
|
|
28
|
+
},
|
|
29
|
+
onChange: {
|
|
30
|
+
action: 'changed',
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
args: {
|
|
34
|
+
isToggled: false,
|
|
35
|
+
isDisabled: false,
|
|
36
|
+
size: ToggleSize.Default,
|
|
37
|
+
labelPosition: ToggleLabelPosition.Right,
|
|
38
|
+
},
|
|
39
|
+
} satisfies Meta<typeof Toggle>;
|
|
40
|
+
|
|
41
|
+
export default meta;
|
|
42
|
+
|
|
43
|
+
type Story = StoryObj<typeof meta>;
|
|
44
|
+
|
|
45
|
+
export const Default: Story = {
|
|
46
|
+
args: {
|
|
47
|
+
label: 'Label',
|
|
48
|
+
},
|
|
49
|
+
render: (args) => {
|
|
50
|
+
const [isToggled, setIsToggled] = useState(args.isToggled);
|
|
51
|
+
|
|
52
|
+
const handleToggleChange = (newState: boolean) => {
|
|
53
|
+
console.log('Toggle state changed:', newState);
|
|
54
|
+
setIsToggled(newState);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
return <Toggle {...args} isToggled={isToggled} onChange={handleToggleChange} />;
|
|
58
|
+
},
|
|
59
|
+
};
|
|
@@ -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,
|
|
@@ -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
|
|
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 {
|
|
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
|
|
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 {
|
|
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 {
|
|
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[] = [
|