@iota/apps-ui-kit 0.0.0-dev-20251015065834
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 +145 -0
- package/LICENSE +201 -0
- package/README.md +16 -0
- package/dist/index.d.ts +1911 -0
- package/dist/index.es.js +6486 -0
- package/dist/index.es.js.map +1 -0
- package/dist/index.umd.js +66 -0
- package/dist/index.umd.js.map +1 -0
- package/dist/style.css +1 -0
- package/package.json +80 -0
- package/src/lib/components/atoms/badge/Badge.tsx +37 -0
- package/src/lib/components/atoms/badge/badge.classes.ts +33 -0
- package/src/lib/components/atoms/badge/badge.enums.ts +11 -0
- package/src/lib/components/atoms/badge/index.ts +6 -0
- package/src/lib/components/atoms/button/Button.tsx +110 -0
- package/src/lib/components/atoms/button/button-variants/ButtonPill.tsx +23 -0
- package/src/lib/components/atoms/button/button-variants/ButtonUnstyled.tsx +27 -0
- package/src/lib/components/atoms/button/button-variants/buttonVariants.types.ts +11 -0
- package/src/lib/components/atoms/button/button-variants/index.ts +5 -0
- package/src/lib/components/atoms/button/button.classes.ts +53 -0
- package/src/lib/components/atoms/button/button.enums.ts +21 -0
- package/src/lib/components/atoms/button/index.ts +7 -0
- package/src/lib/components/atoms/button-segment/ButtonSegment.tsx +98 -0
- package/src/lib/components/atoms/button-segment/buttonSegment.classes.ts +24 -0
- package/src/lib/components/atoms/button-segment/buttonSegment.enums.ts +7 -0
- package/src/lib/components/atoms/button-segment/index.ts +5 -0
- package/src/lib/components/atoms/checkbox/Checkbox.tsx +124 -0
- package/src/lib/components/atoms/checkbox/index.ts +4 -0
- package/src/lib/components/atoms/divider/Divider.tsx +48 -0
- package/src/lib/components/atoms/divider/divider.classes.ts +11 -0
- package/src/lib/components/atoms/divider/divider.enums.ts +7 -0
- package/src/lib/components/atoms/divider/index.ts +6 -0
- package/src/lib/components/atoms/header/Header.tsx +73 -0
- package/src/lib/components/atoms/header/index.ts +4 -0
- package/src/lib/components/atoms/image/Image.tsx +32 -0
- package/src/lib/components/atoms/image/index.ts +4 -0
- package/src/lib/components/atoms/index.ts +26 -0
- package/src/lib/components/atoms/info-box/InfoBox.tsx +68 -0
- package/src/lib/components/atoms/info-box/index.ts +5 -0
- package/src/lib/components/atoms/info-box/infoBox.classes.ts +18 -0
- package/src/lib/components/atoms/info-box/infoBox.enums.ts +14 -0
- package/src/lib/components/atoms/key-value-info/KeyValueInfo.tsx +157 -0
- package/src/lib/components/atoms/key-value-info/index.ts +6 -0
- package/src/lib/components/atoms/key-value-info/keyValue.enums.ts +7 -0
- package/src/lib/components/atoms/label-text/LabelText.tsx +92 -0
- package/src/lib/components/atoms/label-text/index.ts +5 -0
- package/src/lib/components/atoms/label-text/labelText.classes.ts +22 -0
- package/src/lib/components/atoms/label-text/labelText.enums.ts +8 -0
- package/src/lib/components/atoms/list-item/ListItem.tsx +88 -0
- package/src/lib/components/atoms/list-item/index.ts +4 -0
- package/src/lib/components/atoms/loading-indicator/LoadingIndicator.tsx +38 -0
- package/src/lib/components/atoms/loading-indicator/index.ts +4 -0
- package/src/lib/components/atoms/media-fallback/MediaFallback.tsx +12 -0
- package/src/lib/components/atoms/media-fallback/index.ts +4 -0
- package/src/lib/components/atoms/panel/Panel.tsx +28 -0
- package/src/lib/components/atoms/panel/index.ts +4 -0
- package/src/lib/components/atoms/placeholder/Placeholder.tsx +27 -0
- package/src/lib/components/atoms/placeholder/index.ts +4 -0
- package/src/lib/components/atoms/radio-button/RadioButton.tsx +64 -0
- package/src/lib/components/atoms/radio-button/index.ts +4 -0
- package/src/lib/components/atoms/secondary-text/SecondaryText.tsx +29 -0
- package/src/lib/components/atoms/secondary-text/index.ts +4 -0
- package/src/lib/components/atoms/skeleton/Skeleton.tsx +30 -0
- package/src/lib/components/atoms/skeleton/index.ts +4 -0
- package/src/lib/components/atoms/snackbar/Snackbar.tsx +69 -0
- package/src/lib/components/atoms/snackbar/index.ts +5 -0
- package/src/lib/components/atoms/snackbar/snackbar.classes.ts +18 -0
- package/src/lib/components/atoms/snackbar/snackbar.enums.tsx +9 -0
- 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 +139 -0
- package/src/lib/components/atoms/tooltip/index.ts +5 -0
- package/src/lib/components/atoms/tooltip/tooltip.classes.ts +11 -0
- package/src/lib/components/atoms/tooltip/tooltip.enums.ts +9 -0
- package/src/lib/components/atoms/video/Video.tsx +33 -0
- package/src/lib/components/atoms/video/index.ts +4 -0
- package/src/lib/components/atoms/video/video.constants.ts +31 -0
- package/src/lib/components/index.ts +6 -0
- package/src/lib/components/molecules/account/Account.tsx +195 -0
- package/src/lib/components/molecules/account/index.ts +4 -0
- package/src/lib/components/molecules/address/Address.tsx +101 -0
- package/src/lib/components/molecules/address/index.ts +4 -0
- package/src/lib/components/molecules/asset-media-renderer/AssetMediaRenderer.tsx +50 -0
- package/src/lib/components/molecules/asset-media-renderer/index.ts +4 -0
- package/src/lib/components/molecules/card/Card.tsx +70 -0
- package/src/lib/components/molecules/card/CardAction.tsx +78 -0
- package/src/lib/components/molecules/card/CardBody.tsx +73 -0
- package/src/lib/components/molecules/card/CardImage.tsx +43 -0
- package/src/lib/components/molecules/card/CardImagePlaceholder.tsx +146 -0
- package/src/lib/components/molecules/card/card.classes.ts +27 -0
- package/src/lib/components/molecules/card/card.enums.ts +26 -0
- package/src/lib/components/molecules/card/index.ts +8 -0
- package/src/lib/components/molecules/chip/Chip.tsx +146 -0
- package/src/lib/components/molecules/chip/chip.classes.ts +54 -0
- package/src/lib/components/molecules/chip/chip.enums.ts +15 -0
- package/src/lib/components/molecules/chip/index.ts +5 -0
- package/src/lib/components/molecules/display-stats/DisplayStats.tsx +142 -0
- package/src/lib/components/molecules/display-stats/displayStats.classes.ts +36 -0
- package/src/lib/components/molecules/display-stats/displayStats.enums.ts +13 -0
- package/src/lib/components/molecules/display-stats/index.ts +5 -0
- package/src/lib/components/molecules/dropdown/Dropdown.tsx +10 -0
- package/src/lib/components/molecules/dropdown/dropdownPosition.enums.ts +7 -0
- package/src/lib/components/molecules/dropdown/index.ts +5 -0
- package/src/lib/components/molecules/index.ts +19 -0
- package/src/lib/components/molecules/input/Input.tsx +261 -0
- package/src/lib/components/molecules/input/InputWrapper.tsx +97 -0
- package/src/lib/components/molecules/input/TextArea.tsx +148 -0
- package/src/lib/components/molecules/input/index.ts +8 -0
- package/src/lib/components/molecules/input/input.classes.ts +13 -0
- package/src/lib/components/molecules/input/input.enums.ts +14 -0
- package/src/lib/components/molecules/input/input.types.ts +29 -0
- package/src/lib/components/molecules/navbar-item/NavbarItem.tsx +47 -0
- package/src/lib/components/molecules/navbar-item/NavbarItemHorizontal.tsx +65 -0
- package/src/lib/components/molecules/navbar-item/NavbarItemVertical.tsx +54 -0
- package/src/lib/components/molecules/navbar-item/index.ts +5 -0
- package/src/lib/components/molecules/navbar-item/navbarItem.classes.ts +16 -0
- package/src/lib/components/molecules/navbar-item/navbarItem.enums.ts +7 -0
- package/src/lib/components/molecules/search/Search.tsx +219 -0
- package/src/lib/components/molecules/search/index.ts +5 -0
- package/src/lib/components/molecules/search/search.classes.ts +20 -0
- package/src/lib/components/molecules/search/search.enums.ts +7 -0
- package/src/lib/components/molecules/segmented-button/SegmentedButton.tsx +38 -0
- package/src/lib/components/molecules/segmented-button/index.ts +6 -0
- package/src/lib/components/molecules/segmented-button/segmentedButton.classes.ts +12 -0
- package/src/lib/components/molecules/segmented-button/segmentedButton.enums.ts +8 -0
- package/src/lib/components/molecules/select/Select.tsx +235 -0
- package/src/lib/components/molecules/select/index.ts +5 -0
- package/src/lib/components/molecules/select/select.enums.ts +7 -0
- package/src/lib/components/molecules/table-cell/TableCell.tsx +62 -0
- package/src/lib/components/molecules/table-cell/index.ts +4 -0
- package/src/lib/components/molecules/table-header-cell/TableHeaderCell.tsx +140 -0
- package/src/lib/components/molecules/table-header-cell/index.ts +5 -0
- package/src/lib/components/molecules/table-header-cell/tableHeaderCell.enums.ts +7 -0
- package/src/lib/components/molecules/title/Title.tsx +78 -0
- package/src/lib/components/molecules/title/index.ts +5 -0
- package/src/lib/components/molecules/title/titleClasses.constants.ts +14 -0
- package/src/lib/components/molecules/title/titleSize.enums.ts +7 -0
- package/src/lib/components/molecules/visual-asset-card/VisualAssetCard.tsx +89 -0
- package/src/lib/components/molecules/visual-asset-card/index.ts +5 -0
- package/src/lib/components/molecules/visual-asset-card/visualAssetCard.enums.ts +7 -0
- package/src/lib/components/organisms/accordion/Accordion.tsx +108 -0
- package/src/lib/components/organisms/accordion/accordion.classes.ts +4 -0
- package/src/lib/components/organisms/accordion/index.ts +4 -0
- package/src/lib/components/organisms/dialog/Dialog.tsx +157 -0
- package/src/lib/components/organisms/dialog/dialog.enums.ts +7 -0
- package/src/lib/components/organisms/dialog/index.ts +5 -0
- package/src/lib/components/organisms/index.ts +7 -0
- package/src/lib/components/organisms/navbar/Navbar.tsx +101 -0
- package/src/lib/components/organisms/navbar/NavbarSlideout.tsx +59 -0
- package/src/lib/components/organisms/navbar/index.ts +5 -0
- package/src/lib/components/organisms/table/Table.tsx +234 -0
- package/src/lib/components/organisms/table/TableContext.tsx +56 -0
- package/src/lib/components/organisms/table/index.ts +4 -0
- package/src/lib/constants/colors.constants.ts +239 -0
- package/src/lib/constants/index.ts +4 -0
- package/src/lib/enums/index.ts +5 -0
- package/src/lib/enums/screenSize.enums.ts +9 -0
- package/src/lib/enums/theme.enums.ts +8 -0
- package/src/lib/index.ts +10 -0
- package/src/lib/styles/base.css +144 -0
- package/src/lib/styles/components.css +735 -0
- package/src/lib/styles/fonts.css +7 -0
- package/src/lib/styles/index.css +18 -0
- package/src/lib/styles/utilities.css +61 -0
- package/src/lib/styles/variables/dark-variables.css +262 -0
- package/src/lib/styles/variables/general-variables.css +9 -0
- package/src/lib/styles/variables/light-variables.css +276 -0
- package/src/lib/styles/variables/names-variables.css +270 -0
- package/src/lib/tailwind/base.presets.ts +58 -0
- package/src/lib/tailwind/constants/customColors.constants.ts +13 -0
- package/src/lib/tailwind/constants/fontFamily.constants.ts +8 -0
- package/src/lib/tailwind/constants/fontSizes.constants.ts +201 -0
- package/src/lib/tailwind/constants/gradients.constants.ts +6 -0
- package/src/lib/tailwind/constants/index.ts +7 -0
- package/src/lib/tailwind/constants/scaling.constants.ts +41 -0
- package/src/lib/tailwind/constants/variableSpacing.constants.ts +66 -0
- package/src/lib/tailwind/helpers.ts +20 -0
- package/src/lib/tailwind/index.ts +5 -0
- package/src/lib/tailwind/plugins.ts +12 -0
- package/src/lib/tailwind/responsive.presets.ts +36 -0
- package/src/lib/tailwind/static.presets.ts +25 -0
- package/src/lib/tailwind/types.ts +6 -0
- package/src/lib/utils/format.ts +8 -0
- package/src/lib/utils/index.ts +4 -0
- package/src/storybook/blocks/Showcase.tsx +20 -0
- package/src/storybook/blocks/TypeSet.tsx +34 -0
- package/src/storybook/blocks/TypeSetItem.tsx +74 -0
- package/src/storybook/blocks/index.ts +6 -0
- package/src/storybook/constants/gradients.constants.ts +8 -0
- package/src/storybook/constants/index.ts +5 -0
- package/src/storybook/constants/typeset.constants.ts +39 -0
- package/src/storybook/constants/variableSpacing.constants.ts +6 -0
- package/src/storybook/helpers/formatGradientNames.ts +15 -0
- package/src/storybook/helpers/getFontSizeLabel.ts +15 -0
- package/src/storybook/helpers/index.ts +4 -0
- package/src/storybook/stories/atoms/Badge.stories.tsx +32 -0
- package/src/storybook/stories/atoms/Button.stories.tsx +45 -0
- package/src/storybook/stories/atoms/ButtonSegment.stories.tsx +45 -0
- package/src/storybook/stories/atoms/Checkbox.stories.tsx +34 -0
- package/src/storybook/stories/atoms/CustomScrollbar.stories.tsx +22 -0
- package/src/storybook/stories/atoms/Divider.stories.tsx +41 -0
- package/src/storybook/stories/atoms/Header.stories.tsx +58 -0
- package/src/storybook/stories/atoms/InfoBox.stories.tsx +67 -0
- package/src/storybook/stories/atoms/KeyValueInfo.stories.tsx +59 -0
- package/src/storybook/stories/atoms/LabelText.stories.tsx +55 -0
- package/src/storybook/stories/atoms/ListItem.stories.tsx +41 -0
- package/src/storybook/stories/atoms/LoadingIndicator.stories.tsx +32 -0
- package/src/storybook/stories/atoms/Panel.stories.tsx +36 -0
- package/src/storybook/stories/atoms/Placeholder.stories.tsx +33 -0
- package/src/storybook/stories/atoms/RadioButton.stories.tsx +51 -0
- package/src/storybook/stories/atoms/Skeleton.stories.tsx +33 -0
- package/src/storybook/stories/atoms/Snackbar.stories.tsx +43 -0
- package/src/storybook/stories/atoms/Toggle.stories.tsx +59 -0
- package/src/storybook/stories/atoms/Tooltip.stories.tsx +59 -0
- package/src/storybook/stories/atoms/VisualAssetCard.stories.tsx +57 -0
- package/src/storybook/stories/components/DocsSyncTheme.tsx +20 -0
- package/src/storybook/stories/components/VariableSpacingShowcase.tsx +46 -0
- package/src/storybook/stories/components/index.ts +5 -0
- package/src/storybook/stories/design-tokens/colors.stories.mdx +44 -0
- package/src/storybook/stories/design-tokens/icons.stories.mdx +19 -0
- package/src/storybook/stories/design-tokens/typeset.stories.mdx +17 -0
- package/src/storybook/stories/design-tokens/variable-spacing.stories.mdx +11 -0
- package/src/storybook/stories/molecules/Account.stories.tsx +71 -0
- package/src/storybook/stories/molecules/Address.stories.tsx +39 -0
- package/src/storybook/stories/molecules/Card.stories.tsx +112 -0
- package/src/storybook/stories/molecules/Chip.stories.tsx +127 -0
- package/src/storybook/stories/molecules/DisplayStats.stories.tsx +63 -0
- package/src/storybook/stories/molecules/Dropdown.stories.tsx +38 -0
- package/src/storybook/stories/molecules/Input.stories.tsx +239 -0
- package/src/storybook/stories/molecules/NavbarItem.stories.tsx +45 -0
- package/src/storybook/stories/molecules/Search.stories.tsx +101 -0
- package/src/storybook/stories/molecules/SegmentedButton.stories.tsx +108 -0
- package/src/storybook/stories/molecules/Select.stories.tsx +103 -0
- package/src/storybook/stories/molecules/TableCell.stories.tsx +46 -0
- package/src/storybook/stories/molecules/TableHeaderCell.stories.tsx +34 -0
- package/src/storybook/stories/molecules/TextArea.stories.tsx +80 -0
- package/src/storybook/stories/molecules/Title.stories.tsx +76 -0
- package/src/storybook/stories/organisms/Accordion.stories.tsx +70 -0
- package/src/storybook/stories/organisms/Dialog.stories.tsx +129 -0
- package/src/storybook/stories/organisms/Navbar.stories.tsx +78 -0
- package/src/storybook/stories/organisms/Table.stories.tsx +154 -0
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// Copyright (c) 2024 IOTA Stiftung
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import cx from 'classnames';
|
|
5
|
+
import { LabelTextSize } from './labelText.enums';
|
|
6
|
+
import { LABEL_TEXT_SIZE, SUPPORTING_TEXT_SIZE, TEXT_SIZE } from './labelText.classes';
|
|
7
|
+
import { Info } from '@iota/apps-ui-icons';
|
|
8
|
+
import type { TooltipPosition } from '../tooltip';
|
|
9
|
+
import { Tooltip } from '../tooltip';
|
|
10
|
+
|
|
11
|
+
interface LabelTextProps {
|
|
12
|
+
/**
|
|
13
|
+
* The size of the LabelText.
|
|
14
|
+
*/
|
|
15
|
+
size?: LabelTextSize;
|
|
16
|
+
/**
|
|
17
|
+
* The position of the LabelText.
|
|
18
|
+
*/
|
|
19
|
+
isCentered?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* The supporting label of the LabelText.
|
|
22
|
+
*/
|
|
23
|
+
supportingLabel?: string;
|
|
24
|
+
/**
|
|
25
|
+
* The text of the LabelText.
|
|
26
|
+
*/
|
|
27
|
+
label: string;
|
|
28
|
+
/**
|
|
29
|
+
* The text of the LabelText.
|
|
30
|
+
*/
|
|
31
|
+
text: string;
|
|
32
|
+
/**
|
|
33
|
+
* The tooltip position.
|
|
34
|
+
*/
|
|
35
|
+
tooltipPosition?: TooltipPosition;
|
|
36
|
+
/**
|
|
37
|
+
* The tooltip text.
|
|
38
|
+
*/
|
|
39
|
+
tooltipText?: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function LabelText({
|
|
43
|
+
size = LabelTextSize.Medium,
|
|
44
|
+
isCentered,
|
|
45
|
+
supportingLabel,
|
|
46
|
+
label,
|
|
47
|
+
text,
|
|
48
|
+
tooltipPosition,
|
|
49
|
+
tooltipText,
|
|
50
|
+
}: LabelTextProps): React.JSX.Element {
|
|
51
|
+
const textClasses = TEXT_SIZE[size];
|
|
52
|
+
const supportingLabelClasses = SUPPORTING_TEXT_SIZE[size];
|
|
53
|
+
const labelTextClasses = LABEL_TEXT_SIZE[size];
|
|
54
|
+
const centeredClasses = isCentered ? 'items-center' : 'items-start';
|
|
55
|
+
const gapClass = size === LabelTextSize.Small ? 'gap-0.5' : 'gap-1';
|
|
56
|
+
return (
|
|
57
|
+
<div className={cx('flex flex-col', centeredClasses, gapClass)}>
|
|
58
|
+
<div className="flex flex-row flex-wrap items-center gap-0.5">
|
|
59
|
+
<span className={cx('label-text-primary-neutral font-inter', textClasses)}>
|
|
60
|
+
{text}
|
|
61
|
+
</span>
|
|
62
|
+
{supportingLabel && (
|
|
63
|
+
<span
|
|
64
|
+
className={cx(
|
|
65
|
+
'label-text-secondary-neutral font-inter',
|
|
66
|
+
supportingLabelClasses,
|
|
67
|
+
)}
|
|
68
|
+
>
|
|
69
|
+
{supportingLabel}
|
|
70
|
+
</span>
|
|
71
|
+
)}
|
|
72
|
+
</div>
|
|
73
|
+
<div className="flex flex-row items-center gap-x-0.5">
|
|
74
|
+
<span
|
|
75
|
+
className={cx(
|
|
76
|
+
'label-text-secondary-neutral flex items-center font-inter',
|
|
77
|
+
labelTextClasses,
|
|
78
|
+
)}
|
|
79
|
+
>
|
|
80
|
+
{label}
|
|
81
|
+
{tooltipText && (
|
|
82
|
+
<div className="ml-xxxs flex items-center">
|
|
83
|
+
<Tooltip text={tooltipText} position={tooltipPosition}>
|
|
84
|
+
<Info className="label-text-secondary-neutral" />
|
|
85
|
+
</Tooltip>
|
|
86
|
+
</div>
|
|
87
|
+
)}
|
|
88
|
+
</span>
|
|
89
|
+
</div>
|
|
90
|
+
</div>
|
|
91
|
+
);
|
|
92
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Copyright (c) 2024 IOTA Stiftung
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { LabelTextSize } from './labelText.enums';
|
|
5
|
+
|
|
6
|
+
export const TEXT_SIZE = {
|
|
7
|
+
[LabelTextSize.Small]: 'text-title-sm',
|
|
8
|
+
[LabelTextSize.Medium]: 'text-title-md',
|
|
9
|
+
[LabelTextSize.Large]: 'text-title-lg',
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const SUPPORTING_TEXT_SIZE = {
|
|
13
|
+
[LabelTextSize.Small]: 'text-label-md',
|
|
14
|
+
[LabelTextSize.Medium]: 'text-label-md',
|
|
15
|
+
[LabelTextSize.Large]: 'text-label-lg',
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const LABEL_TEXT_SIZE = {
|
|
19
|
+
[LabelTextSize.Small]: 'text-label-md',
|
|
20
|
+
[LabelTextSize.Medium]: 'text-label-md',
|
|
21
|
+
[LabelTextSize.Large]: 'text-label-lg',
|
|
22
|
+
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
// Copyright (c) 2024 IOTA Stiftung
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import type { PropsWithChildren } from 'react';
|
|
5
|
+
import cx from 'classnames';
|
|
6
|
+
import { ArrowRight } from '@iota/apps-ui-icons';
|
|
7
|
+
import { Button, ButtonSize, ButtonType } from '../button';
|
|
8
|
+
|
|
9
|
+
export interface ListItemProps {
|
|
10
|
+
/**
|
|
11
|
+
* Has right icon (optional).
|
|
12
|
+
*/
|
|
13
|
+
showRightIcon?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Hide bottom border (optional).
|
|
16
|
+
*/
|
|
17
|
+
hideBottomBorder?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* On click handler (optional).
|
|
20
|
+
*/
|
|
21
|
+
onClick?: () => void;
|
|
22
|
+
/**
|
|
23
|
+
* The list item is disabled or not.
|
|
24
|
+
*/
|
|
25
|
+
isDisabled?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* The list item is highlighted.
|
|
28
|
+
*/
|
|
29
|
+
isHighlighted?: boolean;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function ListItem({
|
|
33
|
+
showRightIcon,
|
|
34
|
+
hideBottomBorder,
|
|
35
|
+
onClick,
|
|
36
|
+
isDisabled,
|
|
37
|
+
children,
|
|
38
|
+
isHighlighted,
|
|
39
|
+
}: PropsWithChildren<ListItemProps>): React.JSX.Element {
|
|
40
|
+
function handleKeyDown(event: React.KeyboardEvent<HTMLDivElement>) {
|
|
41
|
+
if ((event.key === 'Enter' || event.key === ' ') && !isDisabled && onClick) {
|
|
42
|
+
onClick();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function handleClick() {
|
|
47
|
+
if (!isDisabled && onClick) {
|
|
48
|
+
onClick();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<div
|
|
54
|
+
className={cx(
|
|
55
|
+
'w-full',
|
|
56
|
+
{
|
|
57
|
+
'list-item-border-color border-b pb-xs': !hideBottomBorder,
|
|
58
|
+
},
|
|
59
|
+
{ 'opacity-40': isDisabled },
|
|
60
|
+
)}
|
|
61
|
+
>
|
|
62
|
+
<div
|
|
63
|
+
onClick={handleClick}
|
|
64
|
+
role="button"
|
|
65
|
+
tabIndex={0}
|
|
66
|
+
onKeyDown={handleKeyDown}
|
|
67
|
+
className={cx(
|
|
68
|
+
'list-item-color relative flex flex-row items-center justify-between px-md py-sm',
|
|
69
|
+
!isDisabled && onClick ? 'cursor-pointer' : 'cursor-default',
|
|
70
|
+
{
|
|
71
|
+
'list-item-highlight-bg': isHighlighted,
|
|
72
|
+
'state-layer-secondary': !isDisabled,
|
|
73
|
+
},
|
|
74
|
+
)}
|
|
75
|
+
>
|
|
76
|
+
{children}
|
|
77
|
+
{showRightIcon && (
|
|
78
|
+
<Button
|
|
79
|
+
size={ButtonSize.Small}
|
|
80
|
+
type={ButtonType.Ghost}
|
|
81
|
+
disabled={isDisabled}
|
|
82
|
+
icon={<ArrowRight />}
|
|
83
|
+
/>
|
|
84
|
+
)}
|
|
85
|
+
</div>
|
|
86
|
+
</div>
|
|
87
|
+
);
|
|
88
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// Copyright (c) 2024 IOTA Stiftung
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import cx from 'classnames';
|
|
5
|
+
import { Loader } from '@iota/apps-ui-icons';
|
|
6
|
+
|
|
7
|
+
export interface LoadingIndicatorProps {
|
|
8
|
+
/**
|
|
9
|
+
* The color of the loading indicator.
|
|
10
|
+
*/
|
|
11
|
+
color?: string;
|
|
12
|
+
/**
|
|
13
|
+
* The size of the loading indicator.
|
|
14
|
+
*/
|
|
15
|
+
size?: string;
|
|
16
|
+
/**
|
|
17
|
+
* The text to display next to the loading indicator.
|
|
18
|
+
*/
|
|
19
|
+
text?: string;
|
|
20
|
+
/**
|
|
21
|
+
* The 'data-testid' attribute value (used in e2e tests)
|
|
22
|
+
*/
|
|
23
|
+
testId?: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function LoadingIndicator({
|
|
27
|
+
color = 'loading-indicator-color',
|
|
28
|
+
size = 'w-5 h-5',
|
|
29
|
+
text,
|
|
30
|
+
testId,
|
|
31
|
+
}: LoadingIndicatorProps): React.JSX.Element {
|
|
32
|
+
return (
|
|
33
|
+
<div className="flex items-center justify-center gap-xs">
|
|
34
|
+
<Loader className={cx('animate-spin', color, size)} data-testid={testId} />
|
|
35
|
+
{text && <span className={cx('text-body-sm', color)}>{text}</span>}
|
|
36
|
+
</div>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Copyright (c) 2025 IOTA Stiftung
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { PlaceholderReplace } from '@iota/apps-ui-icons';
|
|
5
|
+
|
|
6
|
+
export function MediaFallback() {
|
|
7
|
+
return (
|
|
8
|
+
<div className="flex h-full w-full items-center justify-center bg-iota-neutral-96 dark:bg-iota-neutral-10">
|
|
9
|
+
<PlaceholderReplace className="h-4 w-4 text-iota-neutral-40 dark:text-iota-neutral-60" />
|
|
10
|
+
</div>
|
|
11
|
+
);
|
|
12
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// Copyright (c) 2024 IOTA Stiftung
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import cx from 'classnames';
|
|
5
|
+
|
|
6
|
+
interface PanelProps {
|
|
7
|
+
/**
|
|
8
|
+
* Show or hide border around the panel.
|
|
9
|
+
*/
|
|
10
|
+
hasBorder?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Background color of the panel.
|
|
13
|
+
*/
|
|
14
|
+
bgColor?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function Panel({
|
|
18
|
+
children,
|
|
19
|
+
hasBorder,
|
|
20
|
+
bgColor = 'panel-bg',
|
|
21
|
+
}: React.PropsWithChildren<PanelProps>): React.JSX.Element {
|
|
22
|
+
const borderClass = hasBorder ? 'border panel-border-color' : 'border border-transparent';
|
|
23
|
+
return (
|
|
24
|
+
<div className={cx('flex w-full flex-col rounded-xl', bgColor, borderClass)}>
|
|
25
|
+
{children}
|
|
26
|
+
</div>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// Copyright (c) 2024 IOTA Stiftung
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import cx from 'classnames';
|
|
5
|
+
|
|
6
|
+
interface PlaceholderProps {
|
|
7
|
+
/**
|
|
8
|
+
* The width of the placeholder.
|
|
9
|
+
*/
|
|
10
|
+
width?: string;
|
|
11
|
+
/**
|
|
12
|
+
* The height of the placeholder.
|
|
13
|
+
*/
|
|
14
|
+
height?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function Placeholder({ width = 'w-full', height = 'h-4' }: PlaceholderProps) {
|
|
18
|
+
return (
|
|
19
|
+
<div
|
|
20
|
+
className={cx(
|
|
21
|
+
'animate-pulse rounded-md bg-gradient-to-r from-shader-primary-light-8 bg-[length:1000px_100%] dark:from-shader-primary-dark-8',
|
|
22
|
+
width,
|
|
23
|
+
height,
|
|
24
|
+
)}
|
|
25
|
+
/>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// Copyright (c) 2024 IOTA Stiftung
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import cx from 'classnames';
|
|
5
|
+
import { RadioOn, RadioOff } from '@iota/apps-ui-icons';
|
|
6
|
+
|
|
7
|
+
interface RadioButtonProps {
|
|
8
|
+
/**
|
|
9
|
+
* The label of the radio button.
|
|
10
|
+
*/
|
|
11
|
+
label: string;
|
|
12
|
+
/**
|
|
13
|
+
* The state of the radio button.
|
|
14
|
+
*/
|
|
15
|
+
isChecked?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* If radio button disabled.
|
|
18
|
+
*/
|
|
19
|
+
isDisabled?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* The callback to call when the radio button is clicked.
|
|
22
|
+
*/
|
|
23
|
+
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function RadioButton({
|
|
27
|
+
label,
|
|
28
|
+
isChecked,
|
|
29
|
+
isDisabled,
|
|
30
|
+
onChange,
|
|
31
|
+
}: RadioButtonProps): React.JSX.Element {
|
|
32
|
+
const RadioIcon = isChecked ? RadioOn : RadioOff;
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<label
|
|
36
|
+
className={cx('flex flex-row gap-x-1 text-center has-[:disabled]:opacity-40', {
|
|
37
|
+
disabled: isDisabled,
|
|
38
|
+
'cursor-pointer': !isDisabled,
|
|
39
|
+
})}
|
|
40
|
+
>
|
|
41
|
+
<div
|
|
42
|
+
className={cx('relative flex h-10 w-10 items-center justify-center rounded-full', {
|
|
43
|
+
'state-layer-secondary': !isDisabled,
|
|
44
|
+
})}
|
|
45
|
+
>
|
|
46
|
+
<input
|
|
47
|
+
type="radio"
|
|
48
|
+
checked={isChecked}
|
|
49
|
+
onChange={onChange}
|
|
50
|
+
disabled={isDisabled}
|
|
51
|
+
className={cx('peer appearance-none')}
|
|
52
|
+
/>
|
|
53
|
+
<span className="radio-icon-color peer-checked:radio-icon-checked-color peer-checked:peer-disabled:radio-icon-checked-disabled-color absolute [&_svg]:h-6 [&_svg]:w-6">
|
|
54
|
+
<RadioIcon />
|
|
55
|
+
</span>
|
|
56
|
+
</div>
|
|
57
|
+
<span className="radio-label-color inline-flex items-center justify-center text-label-lg ">
|
|
58
|
+
{label}
|
|
59
|
+
</span>
|
|
60
|
+
</label>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export { RadioButton };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Copyright (c) 2024 IOTA Stiftung
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import cx from 'classnames';
|
|
5
|
+
|
|
6
|
+
interface SecondaryTextProps {
|
|
7
|
+
/**
|
|
8
|
+
* The children to render.
|
|
9
|
+
*/
|
|
10
|
+
children: React.ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* Should the text have error styles.
|
|
13
|
+
*/
|
|
14
|
+
hasErrorStyles?: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function SecondaryText({ children, hasErrorStyles }: SecondaryTextProps) {
|
|
18
|
+
const ERROR_STYLES =
|
|
19
|
+
'group-[.errored]:w-full group-[.errored]:secondary-text-error-color group-[.errored]:bg-error-surface group-[.errored]:rounded-xl group-[.errored]:py-1 group-[.errored]:px-2';
|
|
20
|
+
return (
|
|
21
|
+
<p
|
|
22
|
+
className={cx('secondary-text-color text-label-lg', {
|
|
23
|
+
[ERROR_STYLES]: hasErrorStyles,
|
|
24
|
+
})}
|
|
25
|
+
>
|
|
26
|
+
{children}
|
|
27
|
+
</p>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Copyright (c) 2024 IOTA Stiftung
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import cx from 'classnames';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
interface SkeletonLoaderProps extends Pick<React.HTMLAttributes<HTMLDivElement>, 'className'> {
|
|
8
|
+
/**
|
|
9
|
+
* If true, the skeleton will use darker neutral colors.
|
|
10
|
+
*/
|
|
11
|
+
hasSecondaryColors?: boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function Skeleton({
|
|
15
|
+
children,
|
|
16
|
+
className,
|
|
17
|
+
hasSecondaryColors,
|
|
18
|
+
}: React.PropsWithChildren<SkeletonLoaderProps>): React.JSX.Element {
|
|
19
|
+
return (
|
|
20
|
+
<div
|
|
21
|
+
className={cx(
|
|
22
|
+
'h-3 w-full animate-pulse rounded-full',
|
|
23
|
+
hasSecondaryColors ? 'skeleton-secondary-bg' : 'skeleton-bg',
|
|
24
|
+
className,
|
|
25
|
+
)}
|
|
26
|
+
>
|
|
27
|
+
{children}
|
|
28
|
+
</div>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// Copyright (c) 2024 IOTA Stiftung
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { useEffect } from 'react';
|
|
5
|
+
import cx from 'classnames';
|
|
6
|
+
import { Close } from '@iota/apps-ui-icons';
|
|
7
|
+
import { SnackbarType } from './snackbar.enums';
|
|
8
|
+
import { BACKGROUND_COLOR, TEXT_COLOR } from './snackbar.classes';
|
|
9
|
+
|
|
10
|
+
type Renderable = JSX.Element | string | null;
|
|
11
|
+
export interface SnackbarProps {
|
|
12
|
+
/**
|
|
13
|
+
* The message to display in the snackbar.
|
|
14
|
+
*/
|
|
15
|
+
text: Renderable;
|
|
16
|
+
/**
|
|
17
|
+
* Type of the snackbar.
|
|
18
|
+
*/
|
|
19
|
+
type: SnackbarType;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Duration in milliseconds for the snackbar to auto close. `0` will make the component not close automatically.
|
|
23
|
+
*/
|
|
24
|
+
duration?: number;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Callback to close the snackbar.
|
|
28
|
+
*/
|
|
29
|
+
onClose: () => void;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Show the close button.
|
|
33
|
+
*/
|
|
34
|
+
showClose?: boolean;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function Snackbar({
|
|
38
|
+
text,
|
|
39
|
+
duration = 2000,
|
|
40
|
+
onClose,
|
|
41
|
+
showClose,
|
|
42
|
+
type = SnackbarType.Default,
|
|
43
|
+
}: SnackbarProps) {
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
if (duration) {
|
|
46
|
+
const timer = setTimeout(onClose, duration);
|
|
47
|
+
return () => clearTimeout(timer);
|
|
48
|
+
}
|
|
49
|
+
}, [duration, onClose]);
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<div
|
|
53
|
+
className={cx(
|
|
54
|
+
'transition-all duration-300 ease-out',
|
|
55
|
+
'z-99 bottom-0',
|
|
56
|
+
'flex w-full items-center justify-between gap-xxs rounded-md py-sm pl-md pr-sm',
|
|
57
|
+
BACKGROUND_COLOR[type],
|
|
58
|
+
)}
|
|
59
|
+
>
|
|
60
|
+
<div className={cx('w-full text-left text-body-md', TEXT_COLOR[type])}>{text}</div>
|
|
61
|
+
{showClose && (
|
|
62
|
+
<Close
|
|
63
|
+
className={cx('h-5 w-5 cursor-pointer', TEXT_COLOR[type])}
|
|
64
|
+
onClick={onClose}
|
|
65
|
+
/>
|
|
66
|
+
)}
|
|
67
|
+
</div>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Copyright (c) 2024 IOTA Stiftung
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { SnackbarType } from './snackbar.enums';
|
|
5
|
+
|
|
6
|
+
export const TEXT_COLOR: Record<SnackbarType, string> = {
|
|
7
|
+
[SnackbarType.Default]: 'text-on-default',
|
|
8
|
+
[SnackbarType.Error]: 'text-on-error',
|
|
9
|
+
[SnackbarType.Warning]: 'text-on-warning',
|
|
10
|
+
[SnackbarType.Success]: 'text-on-success',
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const BACKGROUND_COLOR: Record<SnackbarType, string> = {
|
|
14
|
+
[SnackbarType.Default]: 'bg-default-surface',
|
|
15
|
+
[SnackbarType.Error]: 'bg-error-surface',
|
|
16
|
+
[SnackbarType.Warning]: 'bg-warning-surface',
|
|
17
|
+
[SnackbarType.Success]: 'bg-success-surface',
|
|
18
|
+
};
|