@beydesign/storybook 0.0.1 → 0.0.2
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/README.md +60 -40
- package/dist/App.js +161 -5
- package/dist/assets/animations/loading-animation.json +1 -0
- package/dist/index.d.ts +12 -2
- package/dist/index.js +12 -4
- package/dist/stories/Agent/AgentCard.d.ts +3 -0
- package/dist/stories/Agent/AgentCard.js +102 -0
- package/dist/stories/Agent/AgentCard.stories.d.ts +13 -0
- package/dist/stories/Agent/AgentCard.stories.js +303 -0
- package/dist/stories/Agent/AgentCardSkeleton.d.ts +2 -0
- package/dist/stories/Agent/AgentCardSkeleton.js +6 -0
- package/dist/stories/Agent/AgentCardSkeleton.stories.d.ts +13 -0
- package/dist/stories/Agent/AgentCardSkeleton.stories.js +101 -0
- package/dist/stories/Agent/CreateNewCard.d.ts +7 -0
- package/dist/stories/Agent/CreateNewCard.js +25 -0
- package/dist/stories/Agent/CreateNewCard.stories.d.ts +7 -0
- package/dist/stories/Agent/CreateNewCard.stories.js +23 -0
- package/dist/stories/Agent/index.d.ts +4 -0
- package/dist/stories/Agent/index.js +4 -0
- package/dist/stories/Agent/types.d.ts +96 -0
- package/dist/stories/Agent/types.js +7 -0
- package/dist/stories/Buttons/MainButton.d.ts +3 -0
- package/dist/stories/Buttons/MainButton.js +302 -0
- package/dist/stories/Buttons/MainButton.stories.d.ts +28 -0
- package/dist/stories/Buttons/MainButton.stories.js +299 -0
- package/dist/stories/Buttons/ToggleButtonGroup.d.ts +3 -0
- package/dist/stories/Buttons/ToggleButtonGroup.js +34 -0
- package/dist/stories/Buttons/ToggleButtonGroup.stories.d.ts +9 -0
- package/dist/stories/Buttons/ToggleButtonGroup.stories.js +78 -0
- package/dist/stories/Buttons/index.d.ts +3 -0
- package/dist/stories/Buttons/index.js +3 -0
- package/dist/stories/{types/button.d.ts → Buttons/types.d.ts} +37 -14
- package/dist/stories/{types/button.js → Buttons/types.js} +12 -2
- package/dist/stories/Credits/CreditsCard.d.ts +3 -0
- package/dist/stories/Credits/CreditsCard.js +53 -0
- package/dist/stories/Credits/CreditsCard.stories.d.ts +7 -0
- package/dist/stories/Credits/CreditsCard.stories.js +34 -0
- package/dist/stories/Credits/CreditsCardSkeleton.d.ts +3 -0
- package/dist/stories/Credits/CreditsCardSkeleton.js +30 -0
- package/dist/stories/Credits/CreditsCardSkeleton.stories.d.ts +7 -0
- package/dist/stories/Credits/CreditsCardSkeleton.stories.js +40 -0
- package/dist/stories/Credits/index.d.ts +3 -0
- package/dist/stories/Credits/index.js +3 -0
- package/dist/stories/Credits/types.d.ts +57 -0
- package/dist/stories/Credits/types.js +11 -0
- package/dist/stories/EntityCard/EntityCard.d.ts +3 -0
- package/dist/stories/EntityCard/EntityCard.js +22 -0
- package/dist/stories/EntityCard/EntityCard.stories.d.ts +10 -0
- package/dist/stories/EntityCard/EntityCard.stories.js +187 -0
- package/dist/stories/EntityCard/EntityCardSkeleton.d.ts +3 -0
- package/dist/stories/EntityCard/EntityCardSkeleton.js +9 -0
- package/dist/stories/EntityCard/EntityCardSkeleton.stories.d.ts +10 -0
- package/dist/stories/EntityCard/EntityCardSkeleton.stories.js +73 -0
- package/dist/stories/EntityCard/index.d.ts +3 -0
- package/dist/stories/EntityCard/index.js +3 -0
- package/dist/stories/EntityCard/types.d.ts +54 -0
- package/dist/stories/EntityCard/types.js +1 -0
- package/dist/stories/Form/AutoComplete.d.ts +3 -0
- package/dist/stories/Form/AutoComplete.js +163 -0
- package/dist/stories/Form/AutoComplete.stories.d.ts +6 -0
- package/dist/stories/Form/AutoComplete.stories.js +88 -0
- package/dist/stories/Form/Checkbox.d.ts +3 -0
- package/dist/stories/Form/Checkbox.js +65 -0
- package/dist/stories/Form/Checkbox.stories.d.ts +13 -0
- package/dist/stories/Form/Checkbox.stories.js +121 -0
- package/dist/stories/Form/Dropdown.d.ts +3 -0
- package/dist/stories/Form/Dropdown.js +183 -0
- package/dist/stories/Form/Dropdown.stories.d.ts +6 -0
- package/dist/stories/Form/Dropdown.stories.js +122 -0
- package/dist/stories/Form/FileUpload/FileUpload.d.ts +3 -0
- package/dist/stories/Form/FileUpload/FileUpload.js +128 -0
- package/dist/stories/Form/FileUpload/FileUpload.stories.d.ts +7 -0
- package/dist/stories/Form/FileUpload/FileUpload.stories.js +51 -0
- package/dist/stories/Form/FileUpload/FileUploading.d.ts +3 -0
- package/dist/stories/Form/FileUpload/FileUploading.js +49 -0
- package/dist/stories/Form/FileUpload/FileUploading.stories.d.ts +10 -0
- package/dist/stories/Form/FileUpload/FileUploading.stories.js +108 -0
- package/dist/stories/Form/FileUpload/UploadedFile.d.ts +3 -0
- package/dist/stories/Form/FileUpload/UploadedFile.js +12 -0
- package/dist/stories/Form/FileUpload/UploadedFile.stories.d.ts +7 -0
- package/dist/stories/Form/FileUpload/UploadedFile.stories.js +73 -0
- package/dist/stories/Form/FileUpload/index.d.ts +3 -0
- package/dist/stories/Form/FileUpload/index.js +3 -0
- package/dist/stories/Form/TextArea.d.ts +3 -0
- package/dist/stories/Form/TextArea.js +23 -0
- package/dist/stories/Form/TextArea.stories.d.ts +161 -0
- package/dist/stories/Form/TextArea.stories.js +142 -0
- package/dist/stories/Form/TextInput.d.ts +3 -0
- package/dist/stories/Form/TextInput.js +57 -0
- package/dist/stories/Form/TextInput.stories.d.ts +155 -0
- package/dist/stories/Form/TextInput.stories.js +155 -0
- package/dist/stories/Form/Toggle.d.ts +3 -0
- package/dist/stories/Form/Toggle.js +57 -0
- package/dist/stories/Form/Toggle.stories.d.ts +6 -0
- package/dist/stories/Form/Toggle.stories.js +79 -0
- package/dist/stories/Form/index.d.ts +8 -0
- package/dist/stories/Form/index.js +8 -0
- package/dist/stories/Form/types.d.ts +274 -0
- package/dist/stories/Form/types.js +46 -0
- package/dist/stories/Foundations/Colors.d.ts +2 -0
- package/dist/stories/Foundations/Colors.js +266 -0
- package/dist/stories/Foundations/Colors.stories.d.ts +6 -0
- package/dist/stories/Foundations/Colors.stories.js +15 -0
- package/dist/stories/Foundations/index.d.ts +1 -0
- package/dist/stories/Foundations/index.js +1 -0
- package/dist/stories/Navigation/ComplexHeader.d.ts +3 -0
- package/dist/stories/Navigation/ComplexHeader.js +21 -0
- package/dist/stories/Navigation/ComplexHeader.stories.d.ts +6 -0
- package/dist/stories/Navigation/ComplexHeader.stories.js +82 -0
- package/dist/stories/Navigation/Header.d.ts +3 -0
- package/dist/stories/Navigation/Header.js +9 -0
- package/dist/stories/Navigation/Header.stories.d.ts +7 -0
- package/dist/stories/Navigation/Header.stories.js +87 -0
- package/dist/stories/Navigation/NavItem.d.ts +3 -0
- package/dist/stories/Navigation/NavItem.js +66 -0
- package/dist/stories/Navigation/NavItem.stories.d.ts +14 -0
- package/dist/stories/Navigation/NavItem.stories.js +100 -0
- package/dist/stories/Navigation/ProcessHeader.d.ts +3 -0
- package/dist/stories/Navigation/ProcessHeader.js +11 -0
- package/dist/stories/Navigation/ProcessHeader.stories.d.ts +6 -0
- package/dist/stories/Navigation/ProcessHeader.stories.js +76 -0
- package/dist/stories/Navigation/Sidebar.d.ts +3 -0
- package/dist/stories/Navigation/Sidebar.js +115 -0
- package/dist/stories/Navigation/Sidebar.stories.d.ts +11 -0
- package/dist/stories/Navigation/Sidebar.stories.js +174 -0
- package/dist/stories/Navigation/index.d.ts +6 -0
- package/dist/stories/Navigation/index.js +6 -0
- package/dist/stories/Navigation/types.d.ts +186 -0
- package/dist/stories/Navigation/types.js +21 -0
- package/dist/stories/PlanCard/PlanCard.d.ts +3 -0
- package/dist/stories/PlanCard/PlanCard.js +13 -0
- package/dist/stories/PlanCard/PlanCard.stories.d.ts +9 -0
- package/dist/stories/PlanCard/PlanCard.stories.js +125 -0
- package/dist/stories/PlanCard/PlanCardSkeleton.d.ts +3 -0
- package/dist/stories/PlanCard/PlanCardSkeleton.js +6 -0
- package/dist/stories/PlanCard/PlanCardSkeleton.stories.d.ts +7 -0
- package/dist/stories/PlanCard/PlanCardSkeleton.stories.js +40 -0
- package/dist/stories/PlanCard/index.d.ts +3 -0
- package/dist/stories/PlanCard/index.js +3 -0
- package/dist/stories/PlanCard/types.d.ts +61 -0
- package/dist/stories/PlanCard/types.js +1 -0
- package/dist/stories/StripeProduct/StripeProduct.d.ts +3 -0
- package/dist/stories/StripeProduct/StripeProduct.js +24 -0
- package/dist/stories/StripeProduct/StripeProduct.stories.d.ts +10 -0
- package/dist/stories/StripeProduct/StripeProduct.stories.js +110 -0
- package/dist/stories/StripeProduct/StripeProductCardSkeleton.d.ts +3 -0
- package/dist/stories/StripeProduct/StripeProductCardSkeleton.js +6 -0
- package/dist/stories/StripeProduct/StripeProductCardSkeleton.stories.d.ts +16 -0
- package/dist/stories/StripeProduct/StripeProductCardSkeleton.stories.js +137 -0
- package/dist/stories/StripeProduct/index.d.ts +3 -0
- package/dist/stories/StripeProduct/index.js +3 -0
- package/dist/stories/StripeProduct/types.d.ts +56 -0
- package/dist/stories/StripeProduct/types.js +1 -0
- package/dist/stories/Typography/Typography.d.ts +3 -0
- package/dist/stories/Typography/Typography.js +22 -0
- package/dist/stories/Typography/Typography.stories.d.ts +25 -0
- package/dist/stories/Typography/Typography.stories.js +225 -0
- package/dist/stories/Typography/index.d.ts +2 -0
- package/dist/stories/Typography/index.js +2 -0
- package/dist/stories/Typography/types.d.ts +46 -0
- package/dist/stories/Typography/types.js +27 -0
- package/dist/stories/UI/Avatar.d.ts +3 -0
- package/dist/stories/UI/Avatar.js +76 -0
- package/dist/stories/UI/Avatar.stories.d.ts +8 -0
- package/dist/stories/UI/Avatar.stories.js +76 -0
- package/dist/stories/UI/Badge.d.ts +3 -0
- package/dist/stories/UI/Badge.js +118 -0
- package/dist/stories/UI/Badge.stories.d.ts +11 -0
- package/dist/stories/UI/Badge.stories.js +107 -0
- package/dist/stories/UI/CheckIcon.d.ts +3 -0
- package/dist/stories/UI/CheckIcon.js +36 -0
- package/dist/stories/UI/CheckIcon.stories.d.ts +7 -0
- package/dist/stories/UI/CheckIcon.stories.js +48 -0
- package/dist/stories/UI/FeatureBanner.d.ts +3 -0
- package/dist/stories/UI/FeatureBanner.js +34 -0
- package/dist/stories/UI/FeatureBanner.stories.d.ts +9 -0
- package/dist/stories/UI/FeatureBanner.stories.js +131 -0
- package/dist/stories/UI/HintBubble.d.ts +3 -0
- package/dist/stories/UI/HintBubble.js +28 -0
- package/dist/stories/UI/HintBubble.stories.d.ts +9 -0
- package/dist/stories/UI/HintBubble.stories.js +68 -0
- package/dist/stories/UI/Logo.d.ts +3 -0
- package/dist/stories/UI/Logo.js +60 -0
- package/dist/stories/UI/Logo.stories.d.ts +11 -0
- package/dist/stories/UI/Logo.stories.js +65 -0
- package/dist/stories/UI/Menu.d.ts +3 -0
- package/dist/stories/UI/Menu.js +56 -0
- package/dist/stories/UI/Menu.stories.d.ts +7 -0
- package/dist/stories/UI/Menu.stories.js +80 -0
- package/dist/stories/UI/ProgressIndicator.d.ts +3 -0
- package/dist/stories/UI/ProgressIndicator.js +35 -0
- package/dist/stories/UI/ProgressIndicator.stories.d.ts +10 -0
- package/dist/stories/UI/ProgressIndicator.stories.js +98 -0
- package/dist/stories/UI/PromoBanner.d.ts +3 -0
- package/dist/stories/UI/PromoBanner.js +34 -0
- package/dist/stories/UI/PromoBanner.stories.d.ts +9 -0
- package/dist/stories/UI/PromoBanner.stories.js +159 -0
- package/dist/stories/UI/SkeletonLoader.d.ts +3 -0
- package/dist/stories/UI/SkeletonLoader.js +19 -0
- package/dist/stories/UI/SkeletonLoader.stories.d.ts +8 -0
- package/dist/stories/UI/SkeletonLoader.stories.js +74 -0
- package/dist/stories/UI/Stepper.d.ts +3 -0
- package/dist/stories/UI/Stepper.js +67 -0
- package/dist/stories/UI/Stepper.stories.d.ts +6 -0
- package/dist/stories/UI/Stepper.stories.js +65 -0
- package/dist/stories/UI/Topbar.d.ts +3 -0
- package/dist/stories/UI/Topbar.js +9 -0
- package/dist/stories/UI/Topbar.stories.d.ts +6 -0
- package/dist/stories/UI/Topbar.stories.js +71 -0
- package/dist/stories/UI/index.d.ts +13 -0
- package/dist/stories/UI/index.js +13 -0
- package/dist/stories/UI/types.d.ts +398 -0
- package/dist/stories/UI/types.js +110 -0
- package/dist/utils/common.d.ts +2 -0
- package/dist/utils/common.js +20 -0
- package/dist/utils/icon.d.ts +6 -0
- package/dist/utils/icon.js +6 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.js +3 -0
- package/dist/utils/typography.d.ts +14 -0
- package/dist/utils/typography.js +46 -0
- package/package.json +48 -42
- package/dist/stories/Button.d.ts +0 -4
- package/dist/stories/Button.js +0 -258
- package/dist/stories/Colors.d.ts +0 -5
- package/dist/stories/Colors.js +0 -9
- package/dist/stories/Header.d.ts +0 -12
- package/dist/stories/Header.js +0 -4
- package/dist/stories/Header.stories.d.ts +0 -18
- package/dist/stories/Header.stories.js +0 -26
- package/dist/stories/Page.d.ts +0 -3
- package/dist/stories/Page.js +0 -8
- package/dist/stories/Page.stories.d.ts +0 -12
- package/dist/stories/Page.stories.js +0 -24
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { FileUpload } from './FileUpload';
|
|
2
|
+
const meta = {
|
|
3
|
+
title: 'Design System/Components/Form/FileUpload/FileUpload',
|
|
4
|
+
component: FileUpload,
|
|
5
|
+
parameters: {
|
|
6
|
+
layout: 'centered',
|
|
7
|
+
design: {
|
|
8
|
+
type: 'figspec',
|
|
9
|
+
url: 'https://www.figma.com/design/mIhjz2yJjcpLlIqw6oUivt/Beyond-Presence?node-id=4793-22751&t=rqtBB1YFgMFiNXZa-1',
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
tags: ['autodocs'],
|
|
13
|
+
argTypes: {
|
|
14
|
+
disabled: {
|
|
15
|
+
control: 'boolean',
|
|
16
|
+
defaultValue: false,
|
|
17
|
+
description: 'Whether the file upload is disabled',
|
|
18
|
+
table: { type: { summary: 'boolean' } },
|
|
19
|
+
},
|
|
20
|
+
acceptedFileTypes: {
|
|
21
|
+
control: 'text',
|
|
22
|
+
description: 'Accepted file types',
|
|
23
|
+
table: { type: { summary: 'string' } },
|
|
24
|
+
},
|
|
25
|
+
maxFileSizeMB: {
|
|
26
|
+
control: 'number',
|
|
27
|
+
description: 'Max file size in MB',
|
|
28
|
+
table: { type: { summary: 'number' } },
|
|
29
|
+
},
|
|
30
|
+
onFileSelect: {
|
|
31
|
+
description: 'Callback function when a file is selected',
|
|
32
|
+
table: { type: { summary: 'function' } },
|
|
33
|
+
},
|
|
34
|
+
sx: {
|
|
35
|
+
control: 'object',
|
|
36
|
+
description: 'Style of the file upload',
|
|
37
|
+
table: { type: { summary: 'SxProps' } },
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
export default meta;
|
|
42
|
+
export const Default = {
|
|
43
|
+
args: {
|
|
44
|
+
disabled: false,
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
export const Disabled = {
|
|
48
|
+
args: {
|
|
49
|
+
disabled: true,
|
|
50
|
+
},
|
|
51
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment } from 'react';
|
|
3
|
+
import { FileUploadingStatus, FileUploadingProgressMode, } from '../types';
|
|
4
|
+
import { Box } from '@mui/material';
|
|
5
|
+
import { Typography, TypographySize, TypographyWeight } from '../../Typography';
|
|
6
|
+
import { getIconComponent } from '../../../utils';
|
|
7
|
+
import { Player } from '@lottiefiles/react-lottie-player';
|
|
8
|
+
import loadingAnimation from '../../../assets/animations/loading-animation.json';
|
|
9
|
+
import { ProgressIndicator, ProgressIndicatorMode } from '../../UI';
|
|
10
|
+
export const FileUploading = ({ uploadProgress, uploadingStatus, progressMode = FileUploadingProgressMode.Animation, sx, onCancel, onRetry, fileName, showCancel, showRetry, }) => {
|
|
11
|
+
const isUploading = uploadingStatus === FileUploadingStatus.Uploading;
|
|
12
|
+
const isSuccess = uploadingStatus === FileUploadingStatus.Success;
|
|
13
|
+
const isError = uploadingStatus === FileUploadingStatus.Error;
|
|
14
|
+
const isPercentageProgress = progressMode === FileUploadingProgressMode.Percentage;
|
|
15
|
+
const isAnimationProgress = progressMode === FileUploadingProgressMode.Animation;
|
|
16
|
+
const fileExtension = fileName.split('.').pop();
|
|
17
|
+
const getFileIcon = () => {
|
|
18
|
+
if (fileExtension?.toLowerCase() === 'pdf')
|
|
19
|
+
return 'FilePdf';
|
|
20
|
+
if (fileExtension?.toLowerCase().includes('doc'))
|
|
21
|
+
return 'FileDoc';
|
|
22
|
+
if (fileExtension?.toLowerCase() === 'txt')
|
|
23
|
+
return 'FileTxt';
|
|
24
|
+
return 'File';
|
|
25
|
+
};
|
|
26
|
+
return (_jsxs(Box, { display: 'flex', flexDirection: 'column', justifyContent: 'center', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-xs)', paddingX: 'var(--spacing-tokens-size-in-px-spacing-spacing-xl)', paddingY: 'var(--spacing-tokens-size-in-px-spacing-spacing-md)', borderRadius: 'var(--spacing-tokens-size-in-px-spacing-spacing-md)', border: `1px solid ${isError ? 'var(--color-border-border-error)' : 'var(--color-border-border-component)'}`, bgcolor: 'var(--color-background-bg-component-contrast-subtle)', minWidth: '300px', sx: { ...sx }, children: [_jsxs(Box, { display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', children: [_jsxs(Box, { display: 'flex', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-md)', children: [getIconComponent(getFileIcon(), {
|
|
27
|
+
width: '24px',
|
|
28
|
+
height: '24px',
|
|
29
|
+
color: isError
|
|
30
|
+
? 'var(--color-text-text-error)'
|
|
31
|
+
: 'var(--color-foreground-fg-primary)',
|
|
32
|
+
}), _jsx(Typography, { size: TypographySize.TextM, weight: TypographyWeight.Regular, color: isError
|
|
33
|
+
? 'var(--color-text-text-error)'
|
|
34
|
+
: 'var(--color-text-text-title)', children: fileName })] }), _jsxs(Box, { display: 'flex', flexDirection: 'row', alignItems: 'center', paddingY: 'var(--spacing-tokens-size-in-px-spacing-spacing-md)', children: [showCancel &&
|
|
35
|
+
onCancel &&
|
|
36
|
+
isUploading &&
|
|
37
|
+
getIconComponent('X', {
|
|
38
|
+
width: '24px',
|
|
39
|
+
height: '24px',
|
|
40
|
+
color: 'var(--color-text-text-title)',
|
|
41
|
+
onClick: onCancel,
|
|
42
|
+
style: { cursor: 'pointer' },
|
|
43
|
+
}), isSuccess &&
|
|
44
|
+
getIconComponent('Check', {
|
|
45
|
+
width: '24px',
|
|
46
|
+
height: '24px',
|
|
47
|
+
color: 'var(--color-foreground-fg-success)',
|
|
48
|
+
})] })] }), _jsxs(Box, { display: 'flex', flexDirection: 'column', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-xs)', width: '100%', children: [isUploading && isAnimationProgress && (_jsx(Player, { autoplay: true, loop: true, src: loadingAnimation, style: { height: '100%', width: '100%' } })), isUploading && isPercentageProgress && (_jsx(ProgressIndicator, { currentValue: uploadProgress || 0, maxValue: 100, mode: ProgressIndicatorMode.Percentage, style: { width: '100%', height: '100%' } })), isError && (_jsxs(Fragment, { children: [_jsx(Typography, { size: TypographySize.TextXS, weight: TypographyWeight.Regular, color: 'var(--color-text-text-error)', children: "Upload failed, please try again." }), showRetry && onRetry && (_jsx(Box, { onClick: onRetry, style: { cursor: 'pointer' }, children: _jsx(Typography, { size: TypographySize.TextXS, weight: TypographyWeight.SemiBold, color: 'var(--color-text-text-error)', children: "Try again" }) }))] }))] })] }));
|
|
49
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { FileUploading } from './FileUploading';
|
|
3
|
+
declare const meta: Meta<typeof FileUploading>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof FileUploading>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const PercentageProgress: Story;
|
|
8
|
+
export declare const AnimationProgress: Story;
|
|
9
|
+
export declare const Success: Story;
|
|
10
|
+
export declare const Error: Story;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { FileUploading } from './FileUploading';
|
|
2
|
+
import { FileUploadingStatus, FileUploadingProgressMode } from '../types';
|
|
3
|
+
const meta = {
|
|
4
|
+
title: 'Design System/Components/Form/FileUpload/FileUploading',
|
|
5
|
+
component: FileUploading,
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: 'centered',
|
|
8
|
+
design: {
|
|
9
|
+
type: 'figspec',
|
|
10
|
+
url: 'https://www.figma.com/design/mIhjz2yJjcpLlIqw6oUivt/Beyond-Presence?node-id=4793-22751&t=rqtBB1YFgMFiNXZa-1',
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
tags: ['autodocs'],
|
|
14
|
+
argTypes: {
|
|
15
|
+
fileName: {
|
|
16
|
+
control: 'text',
|
|
17
|
+
description: 'The name of the file',
|
|
18
|
+
table: { type: { summary: 'string' } },
|
|
19
|
+
},
|
|
20
|
+
uploadingStatus: {
|
|
21
|
+
control: 'select',
|
|
22
|
+
options: Object.values(FileUploadingStatus),
|
|
23
|
+
defaultValue: FileUploadingStatus.Uploading,
|
|
24
|
+
description: 'The status of the file upload',
|
|
25
|
+
table: { type: { summary: 'FileUploadingStatus' } },
|
|
26
|
+
},
|
|
27
|
+
uploadProgress: {
|
|
28
|
+
control: 'number',
|
|
29
|
+
description: 'The progress of the file upload',
|
|
30
|
+
table: { type: { summary: 'number' } },
|
|
31
|
+
},
|
|
32
|
+
progressMode: {
|
|
33
|
+
control: 'select',
|
|
34
|
+
options: Object.values(FileUploadingProgressMode),
|
|
35
|
+
description: 'The mode of the file upload progress',
|
|
36
|
+
table: { type: { summary: 'ProgressMode' } },
|
|
37
|
+
},
|
|
38
|
+
showCancel: {
|
|
39
|
+
control: 'boolean',
|
|
40
|
+
description: 'Whether to show the cancel button',
|
|
41
|
+
table: { type: { summary: 'boolean' } },
|
|
42
|
+
},
|
|
43
|
+
onCancel: {
|
|
44
|
+
action: 'clicked',
|
|
45
|
+
description: 'Callback function when the cancel button is clicked',
|
|
46
|
+
table: { type: { summary: 'function' } },
|
|
47
|
+
},
|
|
48
|
+
showRetry: {
|
|
49
|
+
control: 'boolean',
|
|
50
|
+
description: 'Whether to show the retry button',
|
|
51
|
+
table: { type: { summary: 'boolean' } },
|
|
52
|
+
},
|
|
53
|
+
onRetry: {
|
|
54
|
+
action: 'clicked',
|
|
55
|
+
description: 'Callback function when the retry button is clicked',
|
|
56
|
+
table: { type: { summary: 'function' } },
|
|
57
|
+
},
|
|
58
|
+
sx: {
|
|
59
|
+
control: 'object',
|
|
60
|
+
description: 'Style of the file upload',
|
|
61
|
+
table: { type: { summary: 'SxProps' } },
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
export default meta;
|
|
66
|
+
export const Default = {
|
|
67
|
+
args: {
|
|
68
|
+
fileName: 'test.pdf',
|
|
69
|
+
uploadingStatus: FileUploadingStatus.Uploading,
|
|
70
|
+
showCancel: true,
|
|
71
|
+
showRetry: true,
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
export const PercentageProgress = {
|
|
75
|
+
args: {
|
|
76
|
+
fileName: 'test.pdf',
|
|
77
|
+
uploadingStatus: FileUploadingStatus.Uploading,
|
|
78
|
+
showCancel: true,
|
|
79
|
+
showRetry: true,
|
|
80
|
+
progressMode: FileUploadingProgressMode.Percentage,
|
|
81
|
+
uploadProgress: 50,
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
export const AnimationProgress = {
|
|
85
|
+
args: {
|
|
86
|
+
fileName: 'test.pdf',
|
|
87
|
+
uploadingStatus: FileUploadingStatus.Uploading,
|
|
88
|
+
showCancel: true,
|
|
89
|
+
showRetry: true,
|
|
90
|
+
progressMode: FileUploadingProgressMode.Animation,
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
export const Success = {
|
|
94
|
+
args: {
|
|
95
|
+
fileName: 'test.pdf',
|
|
96
|
+
uploadingStatus: FileUploadingStatus.Success,
|
|
97
|
+
showCancel: true,
|
|
98
|
+
showRetry: true,
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
export const Error = {
|
|
102
|
+
args: {
|
|
103
|
+
fileName: 'test.pdf',
|
|
104
|
+
uploadingStatus: FileUploadingStatus.Error,
|
|
105
|
+
showCancel: true,
|
|
106
|
+
showRetry: true,
|
|
107
|
+
},
|
|
108
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { FileType } from '../types';
|
|
3
|
+
import { Box } from '@mui/material';
|
|
4
|
+
import { File } from '@phosphor-icons/react';
|
|
5
|
+
import { Typography, TypographySize, TypographyWeight } from '../../Typography';
|
|
6
|
+
import { ButtonDisplayMode, ButtonHierarchy, ButtonSize, MainButton, } from '../../Buttons';
|
|
7
|
+
export const UploadedFile = ({ type = FileType.Default, showDelete = true, onDelete, showDownload = true, onDownload, fileName, sx, }) => {
|
|
8
|
+
const isSampleFile = type === FileType.Sample;
|
|
9
|
+
return (_jsxs(Box, { display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', borderRadius: 'var(--spacing-tokens-size-in-px-spacing-spacing-xs)', padding: 'var(--spacing-tokens-size-in-px-spacing-spacing-sm)', paddingLeft: 'var(--spacing-tokens-size-in-px-spacing-spacing-lg)', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-md)', bgcolor: isSampleFile
|
|
10
|
+
? 'var(--color-background-bg-card-highlight)'
|
|
11
|
+
: 'var(--color-background-bg-component-contrast-subtle)', minWidth: '240px', minHeight: '36px', sx: { ...sx }, children: [_jsxs(Box, { display: 'flex', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-md)', children: [_jsx(File, { width: '24px', height: '24px', color: 'var(--color-foreground-fg-primary)' }), _jsx(Typography, { size: TypographySize.TextM, weight: TypographyWeight.Medium, color: 'var(--color-foreground-fg-primary)', children: fileName })] }), _jsxs(Box, { display: 'flex', flexDirection: 'row', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-md)', children: [showDownload && onDownload && (_jsx(MainButton, { hierarchy: ButtonHierarchy.Secondary, size: ButtonSize.xs, displayIconMode: ButtonDisplayMode.Only, displayIcon: "DownloadSimple", onClick: onDownload })), showDelete && onDelete && (_jsx(MainButton, { hierarchy: ButtonHierarchy.Secondary, size: ButtonSize.xs, displayIconMode: ButtonDisplayMode.Only, displayIcon: "X", onClick: onDelete }))] })] }));
|
|
12
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { UploadedFile } from './UploadedFile';
|
|
3
|
+
declare const meta: Meta<typeof UploadedFile>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof UploadedFile>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const Sample: Story;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { UploadedFile } from './UploadedFile';
|
|
2
|
+
import { FileType } from '../types';
|
|
3
|
+
const meta = {
|
|
4
|
+
title: 'Design System/Components/Form/FileUpload/UploadedFile',
|
|
5
|
+
component: UploadedFile,
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: 'centered',
|
|
8
|
+
design: {
|
|
9
|
+
type: 'figspec',
|
|
10
|
+
url: 'https://www.figma.com/design/mIhjz2yJjcpLlIqw6oUivt/Beyond-Presence?node-id=4793-22751&t=rqtBB1YFgMFiNXZa-1',
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
tags: ['autodocs'],
|
|
14
|
+
argTypes: {
|
|
15
|
+
fileName: {
|
|
16
|
+
control: 'text',
|
|
17
|
+
description: 'The name of the file',
|
|
18
|
+
table: { type: { summary: 'string' } },
|
|
19
|
+
},
|
|
20
|
+
type: {
|
|
21
|
+
control: 'select',
|
|
22
|
+
options: Object.values(FileType),
|
|
23
|
+
description: 'The type of the file',
|
|
24
|
+
table: { type: { summary: 'string' } },
|
|
25
|
+
},
|
|
26
|
+
showDelete: {
|
|
27
|
+
control: 'boolean',
|
|
28
|
+
description: 'Whether to show the delete button',
|
|
29
|
+
table: { type: { summary: 'boolean' } },
|
|
30
|
+
},
|
|
31
|
+
showDownload: {
|
|
32
|
+
control: 'boolean',
|
|
33
|
+
description: 'Whether to show the download button',
|
|
34
|
+
table: { type: { summary: 'boolean' } },
|
|
35
|
+
},
|
|
36
|
+
onDelete: {
|
|
37
|
+
action: 'onDelete',
|
|
38
|
+
description: 'Callback function when the delete button is clicked',
|
|
39
|
+
table: { type: { summary: 'function' } },
|
|
40
|
+
},
|
|
41
|
+
onDownload: {
|
|
42
|
+
action: 'onDownload',
|
|
43
|
+
description: 'Callback function when the download button is clicked',
|
|
44
|
+
table: { type: { summary: 'function' } },
|
|
45
|
+
},
|
|
46
|
+
sx: {
|
|
47
|
+
control: 'object',
|
|
48
|
+
description: 'Style of the uploaded file',
|
|
49
|
+
table: { type: { summary: 'SxProps' } },
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
export default meta;
|
|
54
|
+
export const Default = {
|
|
55
|
+
args: {
|
|
56
|
+
fileName: 'example.pdf',
|
|
57
|
+
type: FileType.Default,
|
|
58
|
+
showDelete: true,
|
|
59
|
+
showDownload: true,
|
|
60
|
+
onDelete: () => { },
|
|
61
|
+
onDownload: () => { },
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
export const Sample = {
|
|
65
|
+
args: {
|
|
66
|
+
fileName: 'sample.txt',
|
|
67
|
+
type: FileType.Sample,
|
|
68
|
+
showDelete: false,
|
|
69
|
+
showDownload: false,
|
|
70
|
+
onDelete: () => { },
|
|
71
|
+
onDownload: () => { },
|
|
72
|
+
},
|
|
73
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { Box } from '@mui/material';
|
|
4
|
+
import { Typography, TypographySize, TypographyWeight } from '../Typography';
|
|
5
|
+
import { HintBubble, HintBubbleSize } from '../UI';
|
|
6
|
+
export const TextArea = ({ label, value, onChange, placeholder, hintText, errorText, disabled, allowMaxLength = false, maxLength = 256, showMaxLengthIndicator = false, numberOfRows = 5, style, hintBubbleProps, hintBubbleText, required, labelTrailingElement, labelContainerStyle, }) => {
|
|
7
|
+
const [focused, setFocused] = useState(false);
|
|
8
|
+
return (_jsx(Box, { display: 'flex', flexDirection: 'column', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-sm)', sx: style, children: _jsxs(Box, { display: 'flex', flexDirection: 'column', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-lg)', minWidth: '260px', children: [label && (_jsxs(Box, { display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'flex-start', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-sm)', sx: labelContainerStyle, children: [_jsx(Typography, { size: TypographySize.HeadingXS, weight: TypographyWeight.SemiBold, required: required, children: label }), labelTrailingElement] })), hintBubbleText && (_jsx(HintBubble, { text: hintBubbleText, size: HintBubbleSize.sm, ...hintBubbleProps })), _jsx(Box, { display: 'flex', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', bgcolor: 'var(--color-background-bg-component)', border: `1px solid ${errorText
|
|
9
|
+
? 'var(--color-border-border-error)'
|
|
10
|
+
: focused
|
|
11
|
+
? 'var(--color-border-border-component-active)'
|
|
12
|
+
: 'var(--color-border-border-component)'}`, overflow: 'hidden', borderRadius: 'var(--spacing-tokens-size-in-px-spacing-spacing-xs)', padding: 'var(--spacing-tokens-size-in-px-spacing-spacing-lg)', width: '100%', children: _jsx("textarea", { value: value, onChange: (e) => onChange(e.target.value), placeholder: placeholder, disabled: disabled, rows: numberOfRows, style: {
|
|
13
|
+
border: 'none',
|
|
14
|
+
outline: 'none',
|
|
15
|
+
width: '100%',
|
|
16
|
+
height: '100%',
|
|
17
|
+
color: disabled
|
|
18
|
+
? 'var(--color-text-text-disabled)'
|
|
19
|
+
: 'var(--color-text-text-title)',
|
|
20
|
+
backgroundColor: 'transparent',
|
|
21
|
+
resize: 'none',
|
|
22
|
+
}, maxLength: allowMaxLength ? maxLength : undefined, onFocus: () => setFocused(true), onBlur: () => setFocused(false), required: required }) }), _jsxs(Box, { display: 'flex', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', children: [errorText ? (_jsx(Typography, { size: TypographySize.TextS, weight: TypographyWeight.Regular, color: 'var(--color-text-text-error)', children: errorText })) : hintText ? (_jsx(Typography, { size: TypographySize.TextS, weight: TypographyWeight.Regular, color: 'var(--color-text-text-subtle)', children: hintText })) : (_jsx(Box, { style: { flex: 1 } })), showMaxLengthIndicator && allowMaxLength && maxLength && (_jsx(Typography, { size: TypographySize.TextS, weight: TypographyWeight.Regular, color: 'var(--color-text-text-subtle)', children: `${maxLength - value.length}` }))] })] }) }));
|
|
23
|
+
};
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import type { StoryObj } from '@storybook/react';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: import("react").FC<import("./types").TextAreaProps>;
|
|
5
|
+
parameters: {
|
|
6
|
+
layout: string;
|
|
7
|
+
};
|
|
8
|
+
tags: string[];
|
|
9
|
+
argTypes: {
|
|
10
|
+
label: {
|
|
11
|
+
control: "text";
|
|
12
|
+
description: string;
|
|
13
|
+
table: {
|
|
14
|
+
type: {
|
|
15
|
+
summary: string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
value: {
|
|
20
|
+
control: "text";
|
|
21
|
+
description: string;
|
|
22
|
+
table: {
|
|
23
|
+
type: {
|
|
24
|
+
summary: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
placeholder: {
|
|
29
|
+
control: "text";
|
|
30
|
+
description: string;
|
|
31
|
+
table: {
|
|
32
|
+
type: {
|
|
33
|
+
summary: string;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
hintText: {
|
|
38
|
+
control: "text";
|
|
39
|
+
description: string;
|
|
40
|
+
table: {
|
|
41
|
+
type: {
|
|
42
|
+
summary: string;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
errorText: {
|
|
47
|
+
control: "text";
|
|
48
|
+
description: string;
|
|
49
|
+
table: {
|
|
50
|
+
type: {
|
|
51
|
+
summary: string;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
disabled: {
|
|
56
|
+
control: "boolean";
|
|
57
|
+
description: string;
|
|
58
|
+
table: {
|
|
59
|
+
type: {
|
|
60
|
+
summary: string;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
onChange: {
|
|
65
|
+
description: string;
|
|
66
|
+
table: {
|
|
67
|
+
type: {
|
|
68
|
+
summary: string;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
maxLength: {
|
|
73
|
+
control: "number";
|
|
74
|
+
description: string;
|
|
75
|
+
table: {
|
|
76
|
+
type: {
|
|
77
|
+
summary: string;
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
showMaxLengthIndicator: {
|
|
82
|
+
control: "boolean";
|
|
83
|
+
description: string;
|
|
84
|
+
table: {
|
|
85
|
+
type: {
|
|
86
|
+
summary: string;
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
numberOfRows: {
|
|
91
|
+
control: "number";
|
|
92
|
+
description: string;
|
|
93
|
+
table: {
|
|
94
|
+
type: {
|
|
95
|
+
summary: string;
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
hintBubbleText: {
|
|
100
|
+
control: "text";
|
|
101
|
+
description: string;
|
|
102
|
+
table: {
|
|
103
|
+
type: {
|
|
104
|
+
summary: string;
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
hintBubbleProps: {
|
|
109
|
+
control: "object";
|
|
110
|
+
description: string;
|
|
111
|
+
table: {
|
|
112
|
+
type: {
|
|
113
|
+
summary: string;
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
required: {
|
|
118
|
+
control: "boolean";
|
|
119
|
+
description: string;
|
|
120
|
+
table: {
|
|
121
|
+
type: {
|
|
122
|
+
summary: string;
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
style: {
|
|
127
|
+
control: "object";
|
|
128
|
+
description: string;
|
|
129
|
+
table: {
|
|
130
|
+
type: {
|
|
131
|
+
summary: string;
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
labelTrailingElement: {
|
|
136
|
+
control: "object";
|
|
137
|
+
description: string;
|
|
138
|
+
table: {
|
|
139
|
+
type: {
|
|
140
|
+
summary: string;
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
allowMaxLength: {
|
|
145
|
+
control: "boolean";
|
|
146
|
+
description: string;
|
|
147
|
+
table: {
|
|
148
|
+
type: {
|
|
149
|
+
summary: string;
|
|
150
|
+
};
|
|
151
|
+
defaultValue: {
|
|
152
|
+
summary: string;
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
};
|
|
156
|
+
};
|
|
157
|
+
};
|
|
158
|
+
export default meta;
|
|
159
|
+
type Story = StoryObj<typeof meta>;
|
|
160
|
+
export declare const Default: Story;
|
|
161
|
+
export declare const WithMaxLength: Story;
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { TextArea } from './TextArea';
|
|
2
|
+
const meta = {
|
|
3
|
+
title: 'Design System/Components/Form/TextArea',
|
|
4
|
+
component: TextArea,
|
|
5
|
+
parameters: {
|
|
6
|
+
layout: 'centered',
|
|
7
|
+
},
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
argTypes: {
|
|
10
|
+
label: {
|
|
11
|
+
control: 'text',
|
|
12
|
+
description: 'The label of the text input',
|
|
13
|
+
table: {
|
|
14
|
+
type: { summary: 'string' },
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
value: {
|
|
18
|
+
control: 'text',
|
|
19
|
+
description: 'The value of the text input',
|
|
20
|
+
table: {
|
|
21
|
+
type: { summary: 'string' },
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
placeholder: {
|
|
25
|
+
control: 'text',
|
|
26
|
+
description: 'The placeholder of the text input',
|
|
27
|
+
table: {
|
|
28
|
+
type: { summary: 'string' },
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
hintText: {
|
|
32
|
+
control: 'text',
|
|
33
|
+
description: 'The hint text of the text input',
|
|
34
|
+
table: {
|
|
35
|
+
type: { summary: 'string' },
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
errorText: {
|
|
39
|
+
control: 'text',
|
|
40
|
+
description: 'The error text of the text input',
|
|
41
|
+
table: {
|
|
42
|
+
type: { summary: 'string' },
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
disabled: {
|
|
46
|
+
control: 'boolean',
|
|
47
|
+
description: 'Whether the text input is disabled',
|
|
48
|
+
table: {
|
|
49
|
+
type: { summary: 'boolean' },
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
onChange: {
|
|
53
|
+
description: 'The onChange function of the text input',
|
|
54
|
+
table: {
|
|
55
|
+
type: { summary: 'function' },
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
maxLength: {
|
|
59
|
+
control: 'number',
|
|
60
|
+
description: 'The max length of the text input',
|
|
61
|
+
table: {
|
|
62
|
+
type: { summary: 'number' },
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
showMaxLengthIndicator: {
|
|
66
|
+
control: 'boolean',
|
|
67
|
+
description: 'Whether to show the max length indicator',
|
|
68
|
+
table: {
|
|
69
|
+
type: { summary: 'boolean' },
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
numberOfRows: {
|
|
73
|
+
control: 'number',
|
|
74
|
+
description: 'The number of rows of the text input',
|
|
75
|
+
table: {
|
|
76
|
+
type: { summary: 'number' },
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
hintBubbleText: {
|
|
80
|
+
control: 'text',
|
|
81
|
+
description: 'The text of the hint bubble',
|
|
82
|
+
table: {
|
|
83
|
+
type: { summary: 'string' },
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
hintBubbleProps: {
|
|
87
|
+
control: 'object',
|
|
88
|
+
description: 'The props of the hint bubble',
|
|
89
|
+
table: {
|
|
90
|
+
type: { summary: 'object' },
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
required: {
|
|
94
|
+
control: 'boolean',
|
|
95
|
+
description: 'Whether the text area is required',
|
|
96
|
+
table: {
|
|
97
|
+
type: { summary: 'boolean' },
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
style: {
|
|
101
|
+
control: 'object',
|
|
102
|
+
description: 'Style of the text area',
|
|
103
|
+
table: {
|
|
104
|
+
type: { summary: 'object' },
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
labelTrailingElement: {
|
|
108
|
+
control: 'object',
|
|
109
|
+
description: 'The trailing element of the label',
|
|
110
|
+
table: {
|
|
111
|
+
type: { summary: 'ReactNode' },
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
allowMaxLength: {
|
|
115
|
+
control: 'boolean',
|
|
116
|
+
description: 'Whether to apply max length restriction',
|
|
117
|
+
table: {
|
|
118
|
+
type: { summary: 'boolean' },
|
|
119
|
+
defaultValue: { summary: 'false' },
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
};
|
|
124
|
+
export default meta;
|
|
125
|
+
export const Default = {
|
|
126
|
+
args: {
|
|
127
|
+
label: "Agent's name",
|
|
128
|
+
value: 'Anna',
|
|
129
|
+
onChange: (_value) => { },
|
|
130
|
+
},
|
|
131
|
+
};
|
|
132
|
+
export const WithMaxLength = {
|
|
133
|
+
args: {
|
|
134
|
+
label: 'Limited Text Area',
|
|
135
|
+
value: '',
|
|
136
|
+
onChange: (_value) => { },
|
|
137
|
+
allowMaxLength: true,
|
|
138
|
+
maxLength: 100,
|
|
139
|
+
showMaxLengthIndicator: true,
|
|
140
|
+
placeholder: 'Enter text (max 100 characters)',
|
|
141
|
+
},
|
|
142
|
+
};
|