@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.
Files changed (234) hide show
  1. package/README.md +60 -40
  2. package/dist/App.js +161 -5
  3. package/dist/assets/animations/loading-animation.json +1 -0
  4. package/dist/index.d.ts +12 -2
  5. package/dist/index.js +12 -4
  6. package/dist/stories/Agent/AgentCard.d.ts +3 -0
  7. package/dist/stories/Agent/AgentCard.js +102 -0
  8. package/dist/stories/Agent/AgentCard.stories.d.ts +13 -0
  9. package/dist/stories/Agent/AgentCard.stories.js +303 -0
  10. package/dist/stories/Agent/AgentCardSkeleton.d.ts +2 -0
  11. package/dist/stories/Agent/AgentCardSkeleton.js +6 -0
  12. package/dist/stories/Agent/AgentCardSkeleton.stories.d.ts +13 -0
  13. package/dist/stories/Agent/AgentCardSkeleton.stories.js +101 -0
  14. package/dist/stories/Agent/CreateNewCard.d.ts +7 -0
  15. package/dist/stories/Agent/CreateNewCard.js +25 -0
  16. package/dist/stories/Agent/CreateNewCard.stories.d.ts +7 -0
  17. package/dist/stories/Agent/CreateNewCard.stories.js +23 -0
  18. package/dist/stories/Agent/index.d.ts +4 -0
  19. package/dist/stories/Agent/index.js +4 -0
  20. package/dist/stories/Agent/types.d.ts +96 -0
  21. package/dist/stories/Agent/types.js +7 -0
  22. package/dist/stories/Buttons/MainButton.d.ts +3 -0
  23. package/dist/stories/Buttons/MainButton.js +302 -0
  24. package/dist/stories/Buttons/MainButton.stories.d.ts +28 -0
  25. package/dist/stories/Buttons/MainButton.stories.js +299 -0
  26. package/dist/stories/Buttons/ToggleButtonGroup.d.ts +3 -0
  27. package/dist/stories/Buttons/ToggleButtonGroup.js +34 -0
  28. package/dist/stories/Buttons/ToggleButtonGroup.stories.d.ts +9 -0
  29. package/dist/stories/Buttons/ToggleButtonGroup.stories.js +78 -0
  30. package/dist/stories/Buttons/index.d.ts +3 -0
  31. package/dist/stories/Buttons/index.js +3 -0
  32. package/dist/stories/{types/button.d.ts → Buttons/types.d.ts} +37 -14
  33. package/dist/stories/{types/button.js → Buttons/types.js} +12 -2
  34. package/dist/stories/Credits/CreditsCard.d.ts +3 -0
  35. package/dist/stories/Credits/CreditsCard.js +53 -0
  36. package/dist/stories/Credits/CreditsCard.stories.d.ts +7 -0
  37. package/dist/stories/Credits/CreditsCard.stories.js +34 -0
  38. package/dist/stories/Credits/CreditsCardSkeleton.d.ts +3 -0
  39. package/dist/stories/Credits/CreditsCardSkeleton.js +30 -0
  40. package/dist/stories/Credits/CreditsCardSkeleton.stories.d.ts +7 -0
  41. package/dist/stories/Credits/CreditsCardSkeleton.stories.js +40 -0
  42. package/dist/stories/Credits/index.d.ts +3 -0
  43. package/dist/stories/Credits/index.js +3 -0
  44. package/dist/stories/Credits/types.d.ts +57 -0
  45. package/dist/stories/Credits/types.js +11 -0
  46. package/dist/stories/EntityCard/EntityCard.d.ts +3 -0
  47. package/dist/stories/EntityCard/EntityCard.js +22 -0
  48. package/dist/stories/EntityCard/EntityCard.stories.d.ts +10 -0
  49. package/dist/stories/EntityCard/EntityCard.stories.js +187 -0
  50. package/dist/stories/EntityCard/EntityCardSkeleton.d.ts +3 -0
  51. package/dist/stories/EntityCard/EntityCardSkeleton.js +9 -0
  52. package/dist/stories/EntityCard/EntityCardSkeleton.stories.d.ts +10 -0
  53. package/dist/stories/EntityCard/EntityCardSkeleton.stories.js +73 -0
  54. package/dist/stories/EntityCard/index.d.ts +3 -0
  55. package/dist/stories/EntityCard/index.js +3 -0
  56. package/dist/stories/EntityCard/types.d.ts +54 -0
  57. package/dist/stories/EntityCard/types.js +1 -0
  58. package/dist/stories/Form/AutoComplete.d.ts +3 -0
  59. package/dist/stories/Form/AutoComplete.js +163 -0
  60. package/dist/stories/Form/AutoComplete.stories.d.ts +6 -0
  61. package/dist/stories/Form/AutoComplete.stories.js +88 -0
  62. package/dist/stories/Form/Checkbox.d.ts +3 -0
  63. package/dist/stories/Form/Checkbox.js +65 -0
  64. package/dist/stories/Form/Checkbox.stories.d.ts +13 -0
  65. package/dist/stories/Form/Checkbox.stories.js +121 -0
  66. package/dist/stories/Form/Dropdown.d.ts +3 -0
  67. package/dist/stories/Form/Dropdown.js +183 -0
  68. package/dist/stories/Form/Dropdown.stories.d.ts +6 -0
  69. package/dist/stories/Form/Dropdown.stories.js +122 -0
  70. package/dist/stories/Form/FileUpload/FileUpload.d.ts +3 -0
  71. package/dist/stories/Form/FileUpload/FileUpload.js +128 -0
  72. package/dist/stories/Form/FileUpload/FileUpload.stories.d.ts +7 -0
  73. package/dist/stories/Form/FileUpload/FileUpload.stories.js +51 -0
  74. package/dist/stories/Form/FileUpload/FileUploading.d.ts +3 -0
  75. package/dist/stories/Form/FileUpload/FileUploading.js +49 -0
  76. package/dist/stories/Form/FileUpload/FileUploading.stories.d.ts +10 -0
  77. package/dist/stories/Form/FileUpload/FileUploading.stories.js +108 -0
  78. package/dist/stories/Form/FileUpload/UploadedFile.d.ts +3 -0
  79. package/dist/stories/Form/FileUpload/UploadedFile.js +12 -0
  80. package/dist/stories/Form/FileUpload/UploadedFile.stories.d.ts +7 -0
  81. package/dist/stories/Form/FileUpload/UploadedFile.stories.js +73 -0
  82. package/dist/stories/Form/FileUpload/index.d.ts +3 -0
  83. package/dist/stories/Form/FileUpload/index.js +3 -0
  84. package/dist/stories/Form/TextArea.d.ts +3 -0
  85. package/dist/stories/Form/TextArea.js +23 -0
  86. package/dist/stories/Form/TextArea.stories.d.ts +161 -0
  87. package/dist/stories/Form/TextArea.stories.js +142 -0
  88. package/dist/stories/Form/TextInput.d.ts +3 -0
  89. package/dist/stories/Form/TextInput.js +57 -0
  90. package/dist/stories/Form/TextInput.stories.d.ts +155 -0
  91. package/dist/stories/Form/TextInput.stories.js +155 -0
  92. package/dist/stories/Form/Toggle.d.ts +3 -0
  93. package/dist/stories/Form/Toggle.js +57 -0
  94. package/dist/stories/Form/Toggle.stories.d.ts +6 -0
  95. package/dist/stories/Form/Toggle.stories.js +79 -0
  96. package/dist/stories/Form/index.d.ts +8 -0
  97. package/dist/stories/Form/index.js +8 -0
  98. package/dist/stories/Form/types.d.ts +274 -0
  99. package/dist/stories/Form/types.js +46 -0
  100. package/dist/stories/Foundations/Colors.d.ts +2 -0
  101. package/dist/stories/Foundations/Colors.js +266 -0
  102. package/dist/stories/Foundations/Colors.stories.d.ts +6 -0
  103. package/dist/stories/Foundations/Colors.stories.js +15 -0
  104. package/dist/stories/Foundations/index.d.ts +1 -0
  105. package/dist/stories/Foundations/index.js +1 -0
  106. package/dist/stories/Navigation/ComplexHeader.d.ts +3 -0
  107. package/dist/stories/Navigation/ComplexHeader.js +21 -0
  108. package/dist/stories/Navigation/ComplexHeader.stories.d.ts +6 -0
  109. package/dist/stories/Navigation/ComplexHeader.stories.js +82 -0
  110. package/dist/stories/Navigation/Header.d.ts +3 -0
  111. package/dist/stories/Navigation/Header.js +9 -0
  112. package/dist/stories/Navigation/Header.stories.d.ts +7 -0
  113. package/dist/stories/Navigation/Header.stories.js +87 -0
  114. package/dist/stories/Navigation/NavItem.d.ts +3 -0
  115. package/dist/stories/Navigation/NavItem.js +66 -0
  116. package/dist/stories/Navigation/NavItem.stories.d.ts +14 -0
  117. package/dist/stories/Navigation/NavItem.stories.js +100 -0
  118. package/dist/stories/Navigation/ProcessHeader.d.ts +3 -0
  119. package/dist/stories/Navigation/ProcessHeader.js +11 -0
  120. package/dist/stories/Navigation/ProcessHeader.stories.d.ts +6 -0
  121. package/dist/stories/Navigation/ProcessHeader.stories.js +76 -0
  122. package/dist/stories/Navigation/Sidebar.d.ts +3 -0
  123. package/dist/stories/Navigation/Sidebar.js +115 -0
  124. package/dist/stories/Navigation/Sidebar.stories.d.ts +11 -0
  125. package/dist/stories/Navigation/Sidebar.stories.js +174 -0
  126. package/dist/stories/Navigation/index.d.ts +6 -0
  127. package/dist/stories/Navigation/index.js +6 -0
  128. package/dist/stories/Navigation/types.d.ts +186 -0
  129. package/dist/stories/Navigation/types.js +21 -0
  130. package/dist/stories/PlanCard/PlanCard.d.ts +3 -0
  131. package/dist/stories/PlanCard/PlanCard.js +13 -0
  132. package/dist/stories/PlanCard/PlanCard.stories.d.ts +9 -0
  133. package/dist/stories/PlanCard/PlanCard.stories.js +125 -0
  134. package/dist/stories/PlanCard/PlanCardSkeleton.d.ts +3 -0
  135. package/dist/stories/PlanCard/PlanCardSkeleton.js +6 -0
  136. package/dist/stories/PlanCard/PlanCardSkeleton.stories.d.ts +7 -0
  137. package/dist/stories/PlanCard/PlanCardSkeleton.stories.js +40 -0
  138. package/dist/stories/PlanCard/index.d.ts +3 -0
  139. package/dist/stories/PlanCard/index.js +3 -0
  140. package/dist/stories/PlanCard/types.d.ts +61 -0
  141. package/dist/stories/PlanCard/types.js +1 -0
  142. package/dist/stories/StripeProduct/StripeProduct.d.ts +3 -0
  143. package/dist/stories/StripeProduct/StripeProduct.js +24 -0
  144. package/dist/stories/StripeProduct/StripeProduct.stories.d.ts +10 -0
  145. package/dist/stories/StripeProduct/StripeProduct.stories.js +110 -0
  146. package/dist/stories/StripeProduct/StripeProductCardSkeleton.d.ts +3 -0
  147. package/dist/stories/StripeProduct/StripeProductCardSkeleton.js +6 -0
  148. package/dist/stories/StripeProduct/StripeProductCardSkeleton.stories.d.ts +16 -0
  149. package/dist/stories/StripeProduct/StripeProductCardSkeleton.stories.js +137 -0
  150. package/dist/stories/StripeProduct/index.d.ts +3 -0
  151. package/dist/stories/StripeProduct/index.js +3 -0
  152. package/dist/stories/StripeProduct/types.d.ts +56 -0
  153. package/dist/stories/StripeProduct/types.js +1 -0
  154. package/dist/stories/Typography/Typography.d.ts +3 -0
  155. package/dist/stories/Typography/Typography.js +22 -0
  156. package/dist/stories/Typography/Typography.stories.d.ts +25 -0
  157. package/dist/stories/Typography/Typography.stories.js +225 -0
  158. package/dist/stories/Typography/index.d.ts +2 -0
  159. package/dist/stories/Typography/index.js +2 -0
  160. package/dist/stories/Typography/types.d.ts +46 -0
  161. package/dist/stories/Typography/types.js +27 -0
  162. package/dist/stories/UI/Avatar.d.ts +3 -0
  163. package/dist/stories/UI/Avatar.js +76 -0
  164. package/dist/stories/UI/Avatar.stories.d.ts +8 -0
  165. package/dist/stories/UI/Avatar.stories.js +76 -0
  166. package/dist/stories/UI/Badge.d.ts +3 -0
  167. package/dist/stories/UI/Badge.js +118 -0
  168. package/dist/stories/UI/Badge.stories.d.ts +11 -0
  169. package/dist/stories/UI/Badge.stories.js +107 -0
  170. package/dist/stories/UI/CheckIcon.d.ts +3 -0
  171. package/dist/stories/UI/CheckIcon.js +36 -0
  172. package/dist/stories/UI/CheckIcon.stories.d.ts +7 -0
  173. package/dist/stories/UI/CheckIcon.stories.js +48 -0
  174. package/dist/stories/UI/FeatureBanner.d.ts +3 -0
  175. package/dist/stories/UI/FeatureBanner.js +34 -0
  176. package/dist/stories/UI/FeatureBanner.stories.d.ts +9 -0
  177. package/dist/stories/UI/FeatureBanner.stories.js +131 -0
  178. package/dist/stories/UI/HintBubble.d.ts +3 -0
  179. package/dist/stories/UI/HintBubble.js +28 -0
  180. package/dist/stories/UI/HintBubble.stories.d.ts +9 -0
  181. package/dist/stories/UI/HintBubble.stories.js +68 -0
  182. package/dist/stories/UI/Logo.d.ts +3 -0
  183. package/dist/stories/UI/Logo.js +60 -0
  184. package/dist/stories/UI/Logo.stories.d.ts +11 -0
  185. package/dist/stories/UI/Logo.stories.js +65 -0
  186. package/dist/stories/UI/Menu.d.ts +3 -0
  187. package/dist/stories/UI/Menu.js +56 -0
  188. package/dist/stories/UI/Menu.stories.d.ts +7 -0
  189. package/dist/stories/UI/Menu.stories.js +80 -0
  190. package/dist/stories/UI/ProgressIndicator.d.ts +3 -0
  191. package/dist/stories/UI/ProgressIndicator.js +35 -0
  192. package/dist/stories/UI/ProgressIndicator.stories.d.ts +10 -0
  193. package/dist/stories/UI/ProgressIndicator.stories.js +98 -0
  194. package/dist/stories/UI/PromoBanner.d.ts +3 -0
  195. package/dist/stories/UI/PromoBanner.js +34 -0
  196. package/dist/stories/UI/PromoBanner.stories.d.ts +9 -0
  197. package/dist/stories/UI/PromoBanner.stories.js +159 -0
  198. package/dist/stories/UI/SkeletonLoader.d.ts +3 -0
  199. package/dist/stories/UI/SkeletonLoader.js +19 -0
  200. package/dist/stories/UI/SkeletonLoader.stories.d.ts +8 -0
  201. package/dist/stories/UI/SkeletonLoader.stories.js +74 -0
  202. package/dist/stories/UI/Stepper.d.ts +3 -0
  203. package/dist/stories/UI/Stepper.js +67 -0
  204. package/dist/stories/UI/Stepper.stories.d.ts +6 -0
  205. package/dist/stories/UI/Stepper.stories.js +65 -0
  206. package/dist/stories/UI/Topbar.d.ts +3 -0
  207. package/dist/stories/UI/Topbar.js +9 -0
  208. package/dist/stories/UI/Topbar.stories.d.ts +6 -0
  209. package/dist/stories/UI/Topbar.stories.js +71 -0
  210. package/dist/stories/UI/index.d.ts +13 -0
  211. package/dist/stories/UI/index.js +13 -0
  212. package/dist/stories/UI/types.d.ts +398 -0
  213. package/dist/stories/UI/types.js +110 -0
  214. package/dist/utils/common.d.ts +2 -0
  215. package/dist/utils/common.js +20 -0
  216. package/dist/utils/icon.d.ts +6 -0
  217. package/dist/utils/icon.js +6 -0
  218. package/dist/utils/index.d.ts +3 -0
  219. package/dist/utils/index.js +3 -0
  220. package/dist/utils/typography.d.ts +14 -0
  221. package/dist/utils/typography.js +46 -0
  222. package/package.json +48 -42
  223. package/dist/stories/Button.d.ts +0 -4
  224. package/dist/stories/Button.js +0 -258
  225. package/dist/stories/Colors.d.ts +0 -5
  226. package/dist/stories/Colors.js +0 -9
  227. package/dist/stories/Header.d.ts +0 -12
  228. package/dist/stories/Header.js +0 -4
  229. package/dist/stories/Header.stories.d.ts +0 -18
  230. package/dist/stories/Header.stories.js +0 -26
  231. package/dist/stories/Page.d.ts +0 -3
  232. package/dist/stories/Page.js +0 -8
  233. package/dist/stories/Page.stories.d.ts +0 -12
  234. package/dist/stories/Page.stories.js +0 -24
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { TextInputProps } from './types';
3
+ export declare const TextInput: React.FC<TextInputProps>;
@@ -0,0 +1,57 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useState } from 'react';
3
+ import { Box } from '@mui/material';
4
+ import { Typography, TypographySize, TypographyWeight } from '../Typography';
5
+ import { HintBubble, HintBubbleSize } from '../UI';
6
+ import { getIconComponent } from '../../utils';
7
+ export const TextInput = ({ label, value, onChange, placeholder, type = 'text', hintText, errorText, disabled, trailingText, style, hintBubbleText, hintBubbleProps, required, labelTrailingElement, labelContainerStyle, showPasswordToggle = true, }) => {
8
+ const [focused, setFocused] = useState(false);
9
+ const [showPassword, setShowPassword] = useState(false);
10
+ const isPassword = type === 'password';
11
+ const enablePasswordToggle = isPassword && showPasswordToggle;
12
+ const inputType = enablePasswordToggle && showPassword ? 'text' : type;
13
+ // Reset visibility whenever the toggle is removed, so the field never
14
+ // reappears revealed after `type` switches away from password or
15
+ // `showPasswordToggle` is turned off.
16
+ useEffect(() => {
17
+ if (!enablePasswordToggle)
18
+ setShowPassword(false);
19
+ }, [enablePasswordToggle]);
20
+ const togglePasswordVisibility = () => {
21
+ if (!disabled)
22
+ setShowPassword((prev) => !prev);
23
+ };
24
+ const iconColor = disabled
25
+ ? 'var(--color-text-text-disabled)'
26
+ : 'var(--color-foreground-fg-secondary)';
27
+ 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 })), _jsxs(Box, { display: 'flex', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', bgcolor: 'var(--color-background-bg-component)', border: errorText
28
+ ? 'none'
29
+ : '1px solid var(--color-border-border-component)', overflow: 'hidden', borderRadius: 'var(--spacing-tokens-size-in-px-spacing-spacing-xs)', children: [_jsxs(Box, { display: 'flex', flexDirection: 'row', alignItems: 'center', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-sm)', padding: 'var(--spacing-tokens-size-in-px-spacing-spacing-lg)', width: '100%', borderRadius: 'var(--spacing-tokens-size-in-px-spacing-spacing-xs) 0 0 var(--spacing-tokens-size-in-px-spacing-spacing-xs)', border: `${errorText
30
+ ? '1px solid var(--color-border-border-error)'
31
+ : focused
32
+ ? '1px solid var(--color-border-border-component-active)'
33
+ : 'transparent'}`, children: [_jsx("input", { type: inputType, value: value, onChange: (e) => onChange(e.target.value), placeholder: placeholder, disabled: disabled, style: {
34
+ border: 'none',
35
+ outline: 'none',
36
+ width: '100%',
37
+ color: disabled
38
+ ? 'var(--color-text-text-disabled)'
39
+ : 'var(--color-text-text-title)',
40
+ backgroundColor: 'transparent',
41
+ }, onFocus: () => setFocused(true), onBlur: () => setFocused(false), required: required }), enablePasswordToggle && (_jsx(Box, { component: 'button', type: 'button', onClick: togglePasswordVisibility, disabled: disabled, "aria-label": showPassword ? 'Hide password' : 'Show password', "aria-pressed": showPassword, display: 'flex', alignItems: 'center', justifyContent: 'center', flexShrink: 0, sx: {
42
+ padding: 0,
43
+ border: 'none',
44
+ borderRadius: 'var(--spacing-tokens-size-in-px-spacing-spacing-xs)',
45
+ backgroundColor: 'transparent',
46
+ cursor: disabled ? 'not-allowed' : 'pointer',
47
+ '&:focus-visible': {
48
+ outline: '2px solid var(--color-border-border-component-active)',
49
+ outlineOffset: '2px',
50
+ },
51
+ }, children: getIconComponent(showPassword ? 'EyeSlash' : 'Eye', {
52
+ width: '20px',
53
+ height: '20px',
54
+ color: iconColor,
55
+ 'aria-hidden': 'true',
56
+ }) }))] }), trailingText && (_jsx(Box, { display: 'flex', alignItems: 'center', height: '100%', padding: 'var(--spacing-tokens-size-in-px-spacing-spacing-lg)', borderLeft: '1px solid var(--color-border-border-component)', children: _jsx(Typography, { size: TypographySize.TextS, weight: TypographyWeight.Regular, color: 'var(--color-text-text-paragraph)', children: trailingText }) }))] }), errorText && (_jsx(Typography, { size: TypographySize.TextS, weight: TypographyWeight.Regular, color: 'var(--color-text-text-error)', children: errorText })), hintText && !errorText && (_jsx(Typography, { size: TypographySize.TextS, weight: TypographyWeight.Regular, color: 'var(--color-text-text-subtle)', children: hintText }))] }) }));
57
+ };
@@ -0,0 +1,155 @@
1
+ import type { StoryObj } from '@storybook/react';
2
+ declare const meta: {
3
+ title: string;
4
+ component: import("react").FC<import("./types").TextInputProps>;
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
+ type: {
38
+ control: "select";
39
+ description: string;
40
+ options: string[];
41
+ table: {
42
+ type: {
43
+ summary: string;
44
+ };
45
+ };
46
+ };
47
+ hintText: {
48
+ control: "text";
49
+ description: string;
50
+ table: {
51
+ type: {
52
+ summary: string;
53
+ };
54
+ };
55
+ };
56
+ errorText: {
57
+ control: "text";
58
+ description: string;
59
+ table: {
60
+ type: {
61
+ summary: string;
62
+ };
63
+ };
64
+ };
65
+ disabled: {
66
+ control: "boolean";
67
+ description: string;
68
+ table: {
69
+ type: {
70
+ summary: string;
71
+ };
72
+ };
73
+ };
74
+ trailingText: {
75
+ control: "text";
76
+ description: string;
77
+ table: {
78
+ type: {
79
+ summary: string;
80
+ };
81
+ };
82
+ };
83
+ onChange: {
84
+ description: string;
85
+ table: {
86
+ type: {
87
+ summary: string;
88
+ };
89
+ };
90
+ };
91
+ hintBubbleProps: {
92
+ control: "object";
93
+ description: string;
94
+ table: {
95
+ type: {
96
+ summary: string;
97
+ };
98
+ };
99
+ };
100
+ hintBubbleText: {
101
+ control: "text";
102
+ description: string;
103
+ table: {
104
+ type: {
105
+ summary: string;
106
+ };
107
+ };
108
+ };
109
+ required: {
110
+ control: "boolean";
111
+ description: string;
112
+ table: {
113
+ type: {
114
+ summary: string;
115
+ };
116
+ };
117
+ };
118
+ style: {
119
+ control: "object";
120
+ description: string;
121
+ table: {
122
+ type: {
123
+ summary: string;
124
+ };
125
+ };
126
+ };
127
+ labelTrailingElement: {
128
+ control: "object";
129
+ description: string;
130
+ table: {
131
+ type: {
132
+ summary: string;
133
+ };
134
+ };
135
+ };
136
+ showPasswordToggle: {
137
+ control: "boolean";
138
+ description: string;
139
+ table: {
140
+ type: {
141
+ summary: string;
142
+ };
143
+ defaultValue: {
144
+ summary: string;
145
+ };
146
+ };
147
+ };
148
+ };
149
+ };
150
+ export default meta;
151
+ type Story = StoryObj<typeof meta>;
152
+ export declare const Default: Story;
153
+ export declare const Password: Story;
154
+ export declare const PasswordWithoutToggle: Story;
155
+ export declare const Email: Story;
@@ -0,0 +1,155 @@
1
+ import { TextInput } from './TextInput';
2
+ const meta = {
3
+ title: 'Design System/Components/Form/TextInput',
4
+ component: TextInput,
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
+ type: {
32
+ control: 'select',
33
+ description: 'The type of the text input',
34
+ options: ['text', 'password', 'email', 'number', 'tel', 'url'],
35
+ table: {
36
+ type: { summary: 'string' },
37
+ },
38
+ },
39
+ hintText: {
40
+ control: 'text',
41
+ description: 'The hint text of the text input',
42
+ table: {
43
+ type: { summary: 'string' },
44
+ },
45
+ },
46
+ errorText: {
47
+ control: 'text',
48
+ description: 'The error text of the text input',
49
+ table: {
50
+ type: { summary: 'string' },
51
+ },
52
+ },
53
+ disabled: {
54
+ control: 'boolean',
55
+ description: 'Whether the text input is disabled',
56
+ table: {
57
+ type: { summary: 'boolean' },
58
+ },
59
+ },
60
+ trailingText: {
61
+ control: 'text',
62
+ description: 'The trailing text of the text input',
63
+ table: {
64
+ type: { summary: 'string' },
65
+ },
66
+ },
67
+ onChange: {
68
+ description: 'The onChange function of the text input',
69
+ table: {
70
+ type: { summary: 'function' },
71
+ },
72
+ },
73
+ hintBubbleProps: {
74
+ control: 'object',
75
+ description: 'The props of the hint bubble',
76
+ table: {
77
+ type: { summary: 'object' },
78
+ },
79
+ },
80
+ hintBubbleText: {
81
+ control: 'text',
82
+ description: 'The text of the hint bubble',
83
+ table: {
84
+ type: { summary: 'string' },
85
+ },
86
+ },
87
+ required: {
88
+ control: 'boolean',
89
+ description: 'Whether the text input is required',
90
+ table: {
91
+ type: { summary: 'boolean' },
92
+ },
93
+ },
94
+ style: {
95
+ control: 'object',
96
+ description: 'Style of the text input',
97
+ table: {
98
+ type: { summary: 'object' },
99
+ },
100
+ },
101
+ labelTrailingElement: {
102
+ control: 'object',
103
+ description: 'The trailing element of the label',
104
+ table: {
105
+ type: { summary: 'ReactNode' },
106
+ },
107
+ },
108
+ showPasswordToggle: {
109
+ control: 'boolean',
110
+ description: 'Whether to show the password visibility toggle (only applies when type is "password")',
111
+ table: {
112
+ type: { summary: 'boolean' },
113
+ defaultValue: { summary: 'true' },
114
+ },
115
+ },
116
+ },
117
+ };
118
+ export default meta;
119
+ export const Default = {
120
+ args: {
121
+ label: "Agent's name",
122
+ value: 'Anna',
123
+ onChange: () => { },
124
+ hintBubbleText: 'This is a hint bubble',
125
+ },
126
+ };
127
+ export const Password = {
128
+ args: {
129
+ label: 'Password',
130
+ value: 'password',
131
+ type: 'password',
132
+ placeholder: 'Enter your password',
133
+ onChange: () => { },
134
+ hintText: 'Use at least 8 characters',
135
+ },
136
+ };
137
+ export const PasswordWithoutToggle = {
138
+ args: {
139
+ label: 'Password',
140
+ value: 'password',
141
+ type: 'password',
142
+ showPasswordToggle: false,
143
+ placeholder: 'Enter your password',
144
+ onChange: () => { },
145
+ },
146
+ };
147
+ export const Email = {
148
+ args: {
149
+ label: 'Email',
150
+ value: 'email',
151
+ type: 'email',
152
+ onChange: () => { },
153
+ hintBubbleText: 'This is a hint bubble',
154
+ },
155
+ };
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { ToggleProps } from './types';
3
+ export declare const Toggle: React.FC<ToggleProps>;
@@ -0,0 +1,57 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { TogglePosition } from './types';
3
+ import { Box, styled, Switch } from '@mui/material';
4
+ import { Typography, TypographySize, TypographyWeight } from '../Typography';
5
+ const IOSSwitch = styled((props) => (_jsx(Switch, { focusVisibleClassName: ".Mui-focusVisible", disableRipple: true, ...props })))(({ theme }) => ({
6
+ width: 36,
7
+ height: 20,
8
+ padding: 0,
9
+ '& .MuiSwitch-switchBase': {
10
+ padding: 0,
11
+ margin: 2,
12
+ transitionDuration: '300ms',
13
+ '&.Mui-checked': {
14
+ transform: 'translateX(16px)',
15
+ color: '#fff',
16
+ '& + .MuiSwitch-track': {
17
+ backgroundColor: 'var(--primitives-desktop-primary-success-500)',
18
+ opacity: 1,
19
+ border: 0,
20
+ },
21
+ '&.Mui-disabled + .MuiSwitch-track': {
22
+ opacity: 0.5,
23
+ },
24
+ },
25
+ '&.Mui-focusVisible .MuiSwitch-thumb': {
26
+ color: '#33cf4d',
27
+ border: '6px solid #fff',
28
+ },
29
+ '&.Mui-disabled .MuiSwitch-thumb': {
30
+ color: theme.palette.grey[100],
31
+ },
32
+ '&.Mui-disabled + .MuiSwitch-track': {
33
+ backgroundColor: 'var(--color-background-bg-element)',
34
+ opacity: 0.7,
35
+ },
36
+ },
37
+ '& .MuiSwitch-thumb': {
38
+ boxSizing: 'border-box',
39
+ width: 16,
40
+ height: 16,
41
+ backgroundColor: 'var(--color-foreground-fg-white)',
42
+ },
43
+ '& .MuiSwitch-track': {
44
+ borderRadius: 26 / 2,
45
+ backgroundColor: 'var(--color-background-bg-element)',
46
+ opacity: 1,
47
+ transition: theme.transitions.create(['background-color'], {
48
+ duration: 500,
49
+ }),
50
+ '&:hover': {
51
+ backgroundColor: 'var(--color-border-border-component)',
52
+ },
53
+ },
54
+ }));
55
+ export const Toggle = ({ checked, onChange, text = 'Click me', title, disabled = false, togglePosition = TogglePosition.Left, style, textColor = 'var(--color-text-text-title)', titleColor = '#475467', }) => {
56
+ return (_jsxs(Box, { display: "flex", alignItems: "flex-start", flexDirection: togglePosition === TogglePosition.Left ? 'row' : 'row-reverse', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-md)', sx: style, children: [_jsx(IOSSwitch, { checked: checked, onChange: (e) => onChange(e.target.checked), disabled: disabled }), text && (_jsxs(Box, { display: "flex", flexDirection: "column", children: [_jsx(Typography, { size: TypographySize.TextS, weight: TypographyWeight.Medium, color: textColor, children: text }), title && (_jsx(Typography, { size: TypographySize.TextS, weight: TypographyWeight.Medium, color: titleColor, children: title }))] }))] }));
57
+ };
@@ -0,0 +1,6 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { Toggle } from './Toggle';
3
+ declare const meta: Meta<typeof Toggle>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof Toggle>;
6
+ export declare const Default: Story;
@@ -0,0 +1,79 @@
1
+ import { TogglePosition } from './types';
2
+ import { Toggle } from './Toggle';
3
+ const meta = {
4
+ title: 'Design System/Components/Form/Toggle',
5
+ component: Toggle,
6
+ parameters: {
7
+ layout: 'centered',
8
+ design: {
9
+ type: 'figspec',
10
+ url: 'https://www.figma.com/design/mIhjz2yJjcpLlIqw6oUivt/Beyond-Presence?node-id=4595-5881&t=3PJghL9RdZ71sldb-1&m=dev',
11
+ },
12
+ },
13
+ tags: ['autodocs'],
14
+ argTypes: {
15
+ checked: {
16
+ control: 'boolean',
17
+ description: 'Whether the toggle is checked',
18
+ table: {
19
+ type: { summary: 'boolean' },
20
+ },
21
+ },
22
+ onChange: {
23
+ description: 'Callback function when the toggle is checked',
24
+ table: {
25
+ type: { summary: 'function' },
26
+ },
27
+ },
28
+ text: {
29
+ description: 'Text of the toggle',
30
+ table: {
31
+ type: { summary: 'string' },
32
+ },
33
+ },
34
+ title: {
35
+ description: 'Title of the toggle',
36
+ table: {
37
+ type: { summary: 'string' },
38
+ },
39
+ },
40
+ disabled: {
41
+ control: 'boolean',
42
+ description: 'Whether the toggle is disabled',
43
+ table: {
44
+ type: { summary: 'boolean' },
45
+ },
46
+ },
47
+ togglePosition: {
48
+ control: 'select',
49
+ description: 'Position of the toggle',
50
+ options: Object.values(TogglePosition),
51
+ table: { type: { summary: 'string' } },
52
+ },
53
+ style: {
54
+ description: 'Style of the toggle',
55
+ table: { type: { summary: 'object' } },
56
+ },
57
+ textColor: {
58
+ description: 'Color of the text',
59
+ table: { type: { summary: 'string' } },
60
+ },
61
+ titleColor: {
62
+ description: 'Color of the title',
63
+ table: { type: { summary: 'string' } },
64
+ },
65
+ },
66
+ };
67
+ export default meta;
68
+ export const Default = {
69
+ args: {
70
+ checked: false,
71
+ onChange: () => { },
72
+ text: 'Click me',
73
+ title: 'This is a toggle',
74
+ disabled: false,
75
+ togglePosition: TogglePosition.Right,
76
+ textColor: 'var(--color-text-text-title)',
77
+ titleColor: '#475467',
78
+ },
79
+ };
@@ -0,0 +1,8 @@
1
+ export * from './AutoComplete';
2
+ export * from './Checkbox';
3
+ export * from './Toggle';
4
+ export * from './TextArea';
5
+ export * from './TextInput';
6
+ export * from './FileUpload';
7
+ export * from './Dropdown';
8
+ export * from './types';
@@ -0,0 +1,8 @@
1
+ export * from './AutoComplete';
2
+ export * from './Checkbox';
3
+ export * from './Toggle';
4
+ export * from './TextArea';
5
+ export * from './TextInput';
6
+ export * from './FileUpload';
7
+ export * from './Dropdown';
8
+ export * from './types';