@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,20 @@
|
|
|
1
|
+
// Copyright (c) 2024 IOTA Stiftung
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import type { ScreenSize } from '../enums';
|
|
5
|
+
|
|
6
|
+
export const pxToRem = (px: number, base: number = 16) => `${px / base}rem`;
|
|
7
|
+
|
|
8
|
+
export function getTailwindScreens(
|
|
9
|
+
breakpoints: Partial<Record<ScreenSize, number>>,
|
|
10
|
+
): Record<string, string> {
|
|
11
|
+
const screens: Record<string, string> = Object.entries(breakpoints).reduce(
|
|
12
|
+
(acc, [key, value]) => {
|
|
13
|
+
acc[key] = `${value}px`;
|
|
14
|
+
return acc;
|
|
15
|
+
},
|
|
16
|
+
{} as Record<string, string>,
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
return screens;
|
|
20
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Copyright (c) 2024 IOTA Stiftung
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import plugin from 'tailwindcss/plugin';
|
|
5
|
+
|
|
6
|
+
export const firefoxPlugin = plugin(({ addVariant }) => {
|
|
7
|
+
addVariant('firefox', '@-moz-document url-prefix()');
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export const namesVariant = plugin(({ addVariant }) => {
|
|
11
|
+
addVariant('names', '&:is(.names *)');
|
|
12
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// Copyright (c) 2024 IOTA Stiftung
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import type { Config } from 'tailwindcss';
|
|
5
|
+
import type { ScreenBreakpoints } from './types';
|
|
6
|
+
import { ScreenSize } from '../enums';
|
|
7
|
+
import { getTailwindScreens, pxToRem } from './helpers';
|
|
8
|
+
import { BASE_CONFIG } from './base.presets';
|
|
9
|
+
import merge from 'lodash.merge';
|
|
10
|
+
|
|
11
|
+
const BREAKPOINTS: ScreenBreakpoints = {
|
|
12
|
+
[ScreenSize.Sm]: 768,
|
|
13
|
+
[ScreenSize.Md]: 1024,
|
|
14
|
+
[ScreenSize.Lg]: 1400,
|
|
15
|
+
[ScreenSize.Xl]: 1920,
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const screens = getTailwindScreens(BREAKPOINTS);
|
|
19
|
+
|
|
20
|
+
const responsivePreset: Config = merge({}, BASE_CONFIG, {
|
|
21
|
+
theme: {
|
|
22
|
+
screens,
|
|
23
|
+
container: {
|
|
24
|
+
center: true,
|
|
25
|
+
screens,
|
|
26
|
+
padding: {
|
|
27
|
+
DEFAULT: pxToRem(20),
|
|
28
|
+
md: pxToRem(48),
|
|
29
|
+
lg: pxToRem(120),
|
|
30
|
+
xl: pxToRem(240),
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
export default responsivePreset;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Copyright (c) 2024 IOTA Stiftung
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import type { Config } from 'tailwindcss';
|
|
5
|
+
import type { ScreenBreakpoints } from './types';
|
|
6
|
+
import { getTailwindScreens } from './helpers';
|
|
7
|
+
import { BASE_CONFIG } from './base.presets';
|
|
8
|
+
import merge from 'lodash.merge';
|
|
9
|
+
|
|
10
|
+
const BREAKPOINTS: Partial<ScreenBreakpoints> & { default: number } = {
|
|
11
|
+
default: 0,
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const screens = getTailwindScreens(BREAKPOINTS);
|
|
15
|
+
|
|
16
|
+
const staticPreset: Config = merge({}, BASE_CONFIG, {
|
|
17
|
+
theme: {
|
|
18
|
+
screens,
|
|
19
|
+
},
|
|
20
|
+
corePlugins: {
|
|
21
|
+
container: false,
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export default staticPreset;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Copyright (c) 2024 IOTA Stiftung
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
export function truncate(value: string, startLength: number = 6, endLength: number = 6): string {
|
|
5
|
+
return value.length > startLength + endLength
|
|
6
|
+
? `${value.slice(0, startLength)}...${value.slice(-endLength)}`
|
|
7
|
+
: value;
|
|
8
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Copyright (c) 2024 IOTA Stiftung
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
interface ShowcaseProps {
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
title: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function Showcase({ children, title }: ShowcaseProps) {
|
|
10
|
+
return (
|
|
11
|
+
<div className="flex flex-col gap-2">
|
|
12
|
+
<code className="inline w-fit rounded-md bg-iota-neutral-96 px-xxs">{title}</code>
|
|
13
|
+
<div className="flex">
|
|
14
|
+
<div className="flex flex-row items-center justify-center rounded-xl border border-iota-neutral-70 p-md">
|
|
15
|
+
{children}
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// Copyright (c) 2024 IOTA Stiftung
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { TypeSetItem } from './TypeSetItem';
|
|
6
|
+
import { getFontSizeLabelFromClass } from '../helpers';
|
|
7
|
+
import type { TailwindCustomFonts } from '@/lib/tailwind/constants';
|
|
8
|
+
|
|
9
|
+
export interface TypeSetProps {
|
|
10
|
+
typeset: TailwindCustomFonts;
|
|
11
|
+
label: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function TypeSet({ typeset, label }: TypeSetProps) {
|
|
15
|
+
const textClasses = Object.entries(typeset);
|
|
16
|
+
return (
|
|
17
|
+
<div className="mt-4 flex flex-col gap-y-2 rounded-md border border-gray-200 px-xl py-lg shadow-md">
|
|
18
|
+
{textClasses.map(([fontClass, [_, fontConfig]], index) => {
|
|
19
|
+
const sizeText = getFontSizeLabelFromClass(fontClass);
|
|
20
|
+
return (
|
|
21
|
+
<React.Fragment key={index}>
|
|
22
|
+
<TypeSetItem
|
|
23
|
+
sampleText={label}
|
|
24
|
+
fontClass={fontClass}
|
|
25
|
+
sizeText={sizeText}
|
|
26
|
+
{...fontConfig}
|
|
27
|
+
/>
|
|
28
|
+
{index !== textClasses.length - 1 && <hr className="mb-sm mt-xxs" />}
|
|
29
|
+
</React.Fragment>
|
|
30
|
+
);
|
|
31
|
+
})}
|
|
32
|
+
</div>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// Copyright (c) 2024 IOTA Stiftung
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { Fragment, useEffect, useRef, useState } from 'react';
|
|
5
|
+
|
|
6
|
+
enum FontStyleProperties {
|
|
7
|
+
FontSize = 'Font Size',
|
|
8
|
+
LetterSpacing = 'Letter Spacing',
|
|
9
|
+
FontWeight = 'Font Weight',
|
|
10
|
+
LineHeight = 'Line Height',
|
|
11
|
+
FontFamily = 'Font Family',
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface TypeSetItemProps {
|
|
15
|
+
sampleText: string;
|
|
16
|
+
fontClass?: string;
|
|
17
|
+
sizeText?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
type FontStyles = Record<FontStyleProperties, string>;
|
|
21
|
+
|
|
22
|
+
function getComputedFontStyles(element: HTMLDivElement): FontStyles {
|
|
23
|
+
const computedStyles = getComputedStyle(element);
|
|
24
|
+
return {
|
|
25
|
+
[FontStyleProperties.FontSize]: computedStyles.fontSize,
|
|
26
|
+
[FontStyleProperties.LetterSpacing]: computedStyles.letterSpacing,
|
|
27
|
+
[FontStyleProperties.FontWeight]: computedStyles.fontWeight,
|
|
28
|
+
[FontStyleProperties.LineHeight]: computedStyles.lineHeight,
|
|
29
|
+
[FontStyleProperties.FontFamily]: computedStyles.fontFamily,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function TypeSetItem({ sampleText, sizeText, fontClass }: TypeSetItemProps) {
|
|
34
|
+
const [styles, setStyles] = useState<FontStyles | undefined>();
|
|
35
|
+
const ref = useRef<HTMLDivElement | null>(null);
|
|
36
|
+
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
if (ref.current) {
|
|
39
|
+
const computedStyles = getComputedFontStyles(ref.current);
|
|
40
|
+
setStyles(computedStyles);
|
|
41
|
+
}
|
|
42
|
+
}, [ref.current]);
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<div className="flex flex-row items-start gap-x-md">
|
|
46
|
+
{styles && (
|
|
47
|
+
<div className="text-xs text-iota-neutral-60">
|
|
48
|
+
{styles[FontStyleProperties.FontSize]}
|
|
49
|
+
</div>
|
|
50
|
+
)}
|
|
51
|
+
<div className="flex flex-col gap-y-sm">
|
|
52
|
+
<span ref={ref} className={fontClass}>
|
|
53
|
+
{sampleText} {sizeText}
|
|
54
|
+
</span>
|
|
55
|
+
{styles && (
|
|
56
|
+
<div className="flex flex-row gap-x-xs">
|
|
57
|
+
{Object.entries(styles)
|
|
58
|
+
.filter(([key]) => key !== FontStyleProperties.FontSize)
|
|
59
|
+
.map(([key, value], index) => (
|
|
60
|
+
<Fragment key={index}>
|
|
61
|
+
{index > 0 && (
|
|
62
|
+
<span className="text-xs text-iota-neutral-60">|</span>
|
|
63
|
+
)}
|
|
64
|
+
<span className="text-xs text-iota-neutral-60">
|
|
65
|
+
{key}: {value}
|
|
66
|
+
</span>
|
|
67
|
+
</Fragment>
|
|
68
|
+
))}
|
|
69
|
+
</div>
|
|
70
|
+
)}
|
|
71
|
+
</div>
|
|
72
|
+
</div>
|
|
73
|
+
);
|
|
74
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Copyright (c) 2024 IOTA Stiftung
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
TEXT_LABEL_CLASSES,
|
|
6
|
+
TEXT_BODY_CLASSES,
|
|
7
|
+
TEXT_BODY_DISAMBIGUOUS_CLASSES,
|
|
8
|
+
TEXT_TITLE_CLASSES,
|
|
9
|
+
TEXT_HEADLINE_CLASSES,
|
|
10
|
+
TEXT_DISPLAY_CLASSES,
|
|
11
|
+
} from '@/lib/tailwind/constants';
|
|
12
|
+
import type { TypeSetProps } from '../blocks';
|
|
13
|
+
|
|
14
|
+
export const TYPESETS: TypeSetProps[] = [
|
|
15
|
+
{
|
|
16
|
+
label: 'Label',
|
|
17
|
+
typeset: TEXT_LABEL_CLASSES,
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
label: 'Body',
|
|
21
|
+
typeset: TEXT_BODY_CLASSES,
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
label: 'Body Disambiguous',
|
|
25
|
+
typeset: TEXT_BODY_DISAMBIGUOUS_CLASSES,
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
label: 'Title',
|
|
29
|
+
typeset: TEXT_TITLE_CLASSES,
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
label: 'Headline',
|
|
33
|
+
typeset: TEXT_HEADLINE_CLASSES,
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
label: 'Display',
|
|
37
|
+
typeset: TEXT_DISPLAY_CLASSES,
|
|
38
|
+
},
|
|
39
|
+
];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Copyright (c) 2025 IOTA Stiftung
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
export function formatGradientNames(
|
|
5
|
+
title: string,
|
|
6
|
+
colors: Record<string, string>,
|
|
7
|
+
): Record<string, string> {
|
|
8
|
+
const formattedColors: Record<string, string> = {};
|
|
9
|
+
|
|
10
|
+
Object.entries(colors).forEach(([key, value]) => {
|
|
11
|
+
formattedColors[key.replace(`${title}-`, '')] = value;
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
return formattedColors;
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Copyright (c) 2024 IOTA Stiftung
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
const SIZE_TO_LABEL_MAP: Record<string, string> = {
|
|
5
|
+
sm: 'Small',
|
|
6
|
+
md: 'Medium',
|
|
7
|
+
lg: 'Large',
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export function getFontSizeLabelFromClass(fontClass: string): string {
|
|
11
|
+
const fontClassSplit = fontClass.split('-');
|
|
12
|
+
const size = fontClassSplit[fontClassSplit.length - 1];
|
|
13
|
+
const label = SIZE_TO_LABEL_MAP[size];
|
|
14
|
+
return label;
|
|
15
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// Copyright (c) 2024 IOTA Stiftung
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
5
|
+
import { Badge, BadgeType } from '@/components';
|
|
6
|
+
|
|
7
|
+
const meta: Meta<typeof Badge> = {
|
|
8
|
+
component: Badge,
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
render: (props) => {
|
|
11
|
+
return <Badge {...props} />;
|
|
12
|
+
},
|
|
13
|
+
} satisfies Meta<typeof Badge>;
|
|
14
|
+
|
|
15
|
+
export default meta;
|
|
16
|
+
|
|
17
|
+
type Story = StoryObj<typeof meta>;
|
|
18
|
+
|
|
19
|
+
export const Default: Story = {
|
|
20
|
+
args: {
|
|
21
|
+
label: 'Badge',
|
|
22
|
+
type: BadgeType.PrimarySolid,
|
|
23
|
+
},
|
|
24
|
+
argTypes: {
|
|
25
|
+
type: {
|
|
26
|
+
control: {
|
|
27
|
+
type: 'select',
|
|
28
|
+
options: Object.values(BadgeType),
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// Copyright (c) 2024 IOTA Stiftung
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
5
|
+
|
|
6
|
+
import { Button } from '@/components/atoms/button/Button';
|
|
7
|
+
import { ButtonSize, ButtonType } from '@/components/atoms/button';
|
|
8
|
+
|
|
9
|
+
const meta: Meta<typeof Button> = {
|
|
10
|
+
component: Button,
|
|
11
|
+
tags: ['autodocs'],
|
|
12
|
+
render: (props) => {
|
|
13
|
+
return <Button {...props} />;
|
|
14
|
+
},
|
|
15
|
+
} satisfies Meta<typeof Button>;
|
|
16
|
+
|
|
17
|
+
export default meta;
|
|
18
|
+
|
|
19
|
+
type Story = StoryObj<typeof meta>;
|
|
20
|
+
|
|
21
|
+
export const Default: Story = {
|
|
22
|
+
args: {
|
|
23
|
+
text: 'Button',
|
|
24
|
+
},
|
|
25
|
+
argTypes: {
|
|
26
|
+
text: {
|
|
27
|
+
control: 'text',
|
|
28
|
+
},
|
|
29
|
+
size: {
|
|
30
|
+
control: {
|
|
31
|
+
type: 'select',
|
|
32
|
+
options: Object.values(ButtonSize),
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
type: {
|
|
36
|
+
control: {
|
|
37
|
+
type: 'select',
|
|
38
|
+
options: Object.values(ButtonType),
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
disabled: {
|
|
42
|
+
control: 'boolean',
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// Copyright (c) 2024 IOTA Stiftung
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
5
|
+
|
|
6
|
+
import { ButtonSegment, ButtonSegmentType } from '@/components/atoms/';
|
|
7
|
+
|
|
8
|
+
const meta: Meta<typeof ButtonSegment> = {
|
|
9
|
+
component: ButtonSegment,
|
|
10
|
+
tags: ['autodocs'],
|
|
11
|
+
render: (props) => {
|
|
12
|
+
return (
|
|
13
|
+
<div className="flex flex-col items-start gap-2">
|
|
14
|
+
<ButtonSegment {...props} />
|
|
15
|
+
</div>
|
|
16
|
+
);
|
|
17
|
+
},
|
|
18
|
+
} satisfies Meta<typeof ButtonSegment>;
|
|
19
|
+
|
|
20
|
+
export default meta;
|
|
21
|
+
|
|
22
|
+
type Story = StoryObj<typeof meta>;
|
|
23
|
+
|
|
24
|
+
export const Default: Story = {
|
|
25
|
+
args: {
|
|
26
|
+
label: 'Label',
|
|
27
|
+
},
|
|
28
|
+
argTypes: {
|
|
29
|
+
label: {
|
|
30
|
+
control: 'text',
|
|
31
|
+
},
|
|
32
|
+
selected: {
|
|
33
|
+
control: 'boolean',
|
|
34
|
+
},
|
|
35
|
+
disabled: {
|
|
36
|
+
control: 'boolean',
|
|
37
|
+
},
|
|
38
|
+
type: {
|
|
39
|
+
control: {
|
|
40
|
+
type: 'select',
|
|
41
|
+
options: Object.values(ButtonSegmentType),
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// Copyright (c) 2024 IOTA Stiftung
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
5
|
+
import { Checkbox } from '@/components';
|
|
6
|
+
|
|
7
|
+
const meta: Meta<typeof Checkbox> = {
|
|
8
|
+
component: Checkbox,
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
render: (props) => {
|
|
11
|
+
return (
|
|
12
|
+
<div className="flex">
|
|
13
|
+
<Checkbox {...props} />
|
|
14
|
+
</div>
|
|
15
|
+
);
|
|
16
|
+
},
|
|
17
|
+
} satisfies Meta<typeof Checkbox>;
|
|
18
|
+
|
|
19
|
+
export default meta;
|
|
20
|
+
|
|
21
|
+
type Story = StoryObj<typeof meta>;
|
|
22
|
+
|
|
23
|
+
export const Default: Story = {
|
|
24
|
+
args: {
|
|
25
|
+
label: 'Label',
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const LabelFirst: Story = {
|
|
30
|
+
args: {
|
|
31
|
+
label: 'Label',
|
|
32
|
+
isLabelFirst: true,
|
|
33
|
+
},
|
|
34
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Copyright (c) 2024 IOTA Stiftung
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import type { StoryObj } from '@storybook/react';
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'Token Showcase/Scrollbar',
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
render: () => {
|
|
10
|
+
return (
|
|
11
|
+
<div className="h-[300px] w-1/2 overflow-y-scroll">
|
|
12
|
+
<div className="h-[500px]"></div>
|
|
13
|
+
</div>
|
|
14
|
+
);
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default meta;
|
|
19
|
+
|
|
20
|
+
type Story = StoryObj<typeof meta>;
|
|
21
|
+
|
|
22
|
+
export const Default: Story = {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// Copyright (c) 2024 IOTA Stiftung
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
5
|
+
|
|
6
|
+
import { Divider } from '@/components/atoms/divider';
|
|
7
|
+
import { DividerType } from '@/components/atoms/divider';
|
|
8
|
+
|
|
9
|
+
const meta: Meta<typeof Divider> = {
|
|
10
|
+
component: Divider,
|
|
11
|
+
tags: ['autodocs'],
|
|
12
|
+
render: (props) => {
|
|
13
|
+
return (
|
|
14
|
+
<div className="flex h-96 items-center justify-center">
|
|
15
|
+
<Divider {...props} />
|
|
16
|
+
</div>
|
|
17
|
+
);
|
|
18
|
+
},
|
|
19
|
+
} satisfies Meta<typeof Divider>;
|
|
20
|
+
|
|
21
|
+
export default meta;
|
|
22
|
+
|
|
23
|
+
type Story = StoryObj<typeof meta>;
|
|
24
|
+
|
|
25
|
+
export const Default: Story = {
|
|
26
|
+
args: {
|
|
27
|
+
width: 'w-3/4',
|
|
28
|
+
height: 'h-3/4',
|
|
29
|
+
},
|
|
30
|
+
argTypes: {
|
|
31
|
+
width: {
|
|
32
|
+
control: 'text',
|
|
33
|
+
},
|
|
34
|
+
type: {
|
|
35
|
+
control: {
|
|
36
|
+
type: 'select',
|
|
37
|
+
options: Object.values(DividerType),
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// Copyright (c) 2024 IOTA Stiftung
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { Header } from '@/lib/components/atoms/header';
|
|
5
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
6
|
+
|
|
7
|
+
const meta: Meta<typeof Header> = {
|
|
8
|
+
component: Header,
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
render: (props) => {
|
|
11
|
+
return (
|
|
12
|
+
<div className="flex flex-col items-start gap-2">
|
|
13
|
+
<Header {...props} />
|
|
14
|
+
</div>
|
|
15
|
+
);
|
|
16
|
+
},
|
|
17
|
+
} satisfies Meta<typeof Header>;
|
|
18
|
+
|
|
19
|
+
export default meta;
|
|
20
|
+
|
|
21
|
+
type Story = StoryObj<typeof meta>;
|
|
22
|
+
|
|
23
|
+
export const Default: Story = {
|
|
24
|
+
args: {
|
|
25
|
+
title: 'Header',
|
|
26
|
+
onBack: undefined,
|
|
27
|
+
onClose: undefined,
|
|
28
|
+
},
|
|
29
|
+
argTypes: {
|
|
30
|
+
titleCentered: {
|
|
31
|
+
control: 'boolean',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const Centered: Story = {
|
|
37
|
+
args: {
|
|
38
|
+
title: 'Header',
|
|
39
|
+
titleCentered: true,
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const CenteredNoIcon: Story = {
|
|
44
|
+
args: {
|
|
45
|
+
title: 'Header',
|
|
46
|
+
titleCentered: true,
|
|
47
|
+
onBack: undefined,
|
|
48
|
+
onClose: undefined,
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const NoIcon: Story = {
|
|
53
|
+
args: {
|
|
54
|
+
title: 'Header',
|
|
55
|
+
onBack: undefined,
|
|
56
|
+
onClose: undefined,
|
|
57
|
+
},
|
|
58
|
+
};
|