@livechat/design-system-react-components 1.0.0-alpha.4 → 1.0.0-alpha.41

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 (288) hide show
  1. package/dist/dsrc.cjs.js +15 -0
  2. package/dist/dsrc.es.js +4418 -0
  3. package/dist/dsrc.umd.js +15 -0
  4. package/dist/shadow/shadow.css +27 -0
  5. package/dist/shadow/shadow.css.map +1 -0
  6. package/dist/shadow/spacing.css +18 -0
  7. package/dist/shadow/spacing.css.map +1 -0
  8. package/dist/spacing/shadow.css +27 -0
  9. package/dist/spacing/shadow.css.map +1 -0
  10. package/dist/spacing/spacing.css +18 -0
  11. package/dist/spacing/spacing.css.map +1 -0
  12. package/dist/src/components/Alert/Alert.d.ts +9 -0
  13. package/dist/src/components/Avatar/Avatar.d.ts +19 -0
  14. package/dist/src/components/Avatar/Avatar.helpers.d.ts +2 -0
  15. package/dist/src/components/Avatar/index.d.ts +1 -0
  16. package/dist/src/components/Badge/Badge.d.ts +9 -0
  17. package/dist/src/components/Badge/Badge.helpers.d.ts +1 -0
  18. package/dist/src/components/Button/Button.d.ts +13 -0
  19. package/dist/src/components/Button/index.d.ts +2 -0
  20. package/dist/src/components/Card/Card.d.ts +12 -0
  21. package/dist/src/components/Checkbox/Checkbox.d.ts +7 -0
  22. package/dist/src/components/Checkbox/index.d.ts +1 -0
  23. package/dist/src/components/DatePicker/DatePicker.d.ts +4 -0
  24. package/dist/src/components/DatePicker/DatePickerNavbar.d.ts +4 -0
  25. package/dist/src/components/DatePicker/RangeDatePicker.d.ts +16 -0
  26. package/dist/src/components/DatePicker/helpers.d.ts +39 -0
  27. package/dist/src/components/DatePicker/hooks.d.ts +6 -0
  28. package/dist/src/components/DatePicker/index.d.ts +2 -0
  29. package/dist/src/components/DatePicker/types.d.ts +100 -0
  30. package/dist/src/components/FieldDescription/FieldDescription.d.ts +3 -0
  31. package/dist/src/components/FieldError/FieldError.d.ts +3 -0
  32. package/dist/src/components/FieldGroup/FieldGroup.d.ts +8 -0
  33. package/dist/src/components/FileUploadProgress/FileUploadProgress.d.ts +15 -0
  34. package/dist/src/components/FileUploadProgress/FileUploadProgressActions.d.ts +9 -0
  35. package/dist/src/components/FileUploadProgress/index.d.ts +2 -0
  36. package/dist/src/components/Form/Form.d.ts +7 -0
  37. package/dist/src/components/FormField/FormField.d.ts +13 -0
  38. package/dist/src/components/FormField/index.d.ts +1 -0
  39. package/dist/src/components/FormGroup/FormGroup.d.ts +7 -0
  40. package/dist/src/components/Icon/Icon.d.ts +14 -0
  41. package/dist/src/components/Icon/index.d.ts +1 -0
  42. package/dist/src/components/Input/Input.d.ts +14 -0
  43. package/dist/src/components/Input/index.d.ts +1 -0
  44. package/{src/components/Link/Link.tsx → dist/src/components/Link/Link.d.ts} +3 -26
  45. package/dist/src/components/Loader/Loader.d.ts +10 -0
  46. package/dist/src/components/Modal/Modal.d.ts +9 -0
  47. package/dist/src/components/Modal/ModalBase.d.ts +7 -0
  48. package/dist/src/components/Modal/ModalCloseButton.d.ts +6 -0
  49. package/dist/src/components/Modal/ModalPortal.d.ts +7 -0
  50. package/{src/components/Modal/index.ts → dist/src/components/Modal/index.d.ts} +0 -3
  51. package/dist/src/components/NumericInput/NumericInput.d.ts +14 -0
  52. package/dist/src/components/NumericInput/index.d.ts +1 -0
  53. package/dist/src/components/Picker/Picker.d.ts +23 -0
  54. package/dist/src/components/Picker/PickerList.d.ts +23 -0
  55. package/dist/src/components/Picker/Trigger.d.ts +15 -0
  56. package/dist/src/components/Picker/TriggerBody.d.ts +16 -0
  57. package/dist/src/components/Picker/constants.d.ts +21 -0
  58. package/dist/src/components/Picker/index.d.ts +2 -0
  59. package/dist/src/components/Popover/Popover.d.ts +12 -0
  60. package/dist/src/components/Progress/ProgressBar.d.ts +9 -0
  61. package/dist/src/components/Progress/ProgressCircle.d.ts +9 -0
  62. package/dist/src/components/Progress/constants.d.ts +4 -0
  63. package/dist/src/components/Progress/helpers.d.ts +3 -0
  64. package/{src/components/Progress/index.ts → dist/src/components/Progress/index.d.ts} +1 -0
  65. package/dist/src/components/PromoBanner/PromoBanner.d.ts +13 -0
  66. package/dist/src/components/RadioButton/RadioButton.d.ts +7 -0
  67. package/dist/src/components/Search/Search.d.ts +12 -0
  68. package/dist/src/components/Search/index.d.ts +1 -0
  69. package/dist/src/components/SegmentedControl/SegmentedControl.d.ts +18 -0
  70. package/dist/src/components/SegmentedControl/index.d.ts +2 -0
  71. package/dist/src/components/Switch/Switch.d.ts +17 -0
  72. package/dist/src/components/Tab/Tab.d.ts +15 -0
  73. package/dist/src/components/Tab/TabsWrapper.d.ts +3 -0
  74. package/dist/src/components/Tag/Tag.d.ts +14 -0
  75. package/dist/src/components/TagInput/EditableTag.d.ts +11 -0
  76. package/dist/src/components/TagInput/EditableTagContent.d.ts +11 -0
  77. package/dist/src/components/TagInput/EmailTagInput.d.ts +5 -0
  78. package/dist/src/components/TagInput/TagInput.d.ts +13 -0
  79. package/dist/src/components/Textarea/Textarea.d.ts +6 -0
  80. package/dist/src/components/Textarea/index.d.ts +1 -0
  81. package/dist/src/components/Toast/Toast.d.ts +16 -0
  82. package/dist/src/components/Toast/ToastWrapper.d.ts +20 -0
  83. package/dist/src/components/Tooltip/Info.d.ts +8 -0
  84. package/dist/src/components/Tooltip/Interactive.d.ts +14 -0
  85. package/dist/src/components/Tooltip/Simple.d.ts +4 -0
  86. package/dist/src/components/Tooltip/SpotlightOverlay.d.ts +7 -0
  87. package/dist/src/components/Tooltip/Tooltip.d.ts +22 -0
  88. package/dist/src/components/Tooltip/UserGuide.d.ts +12 -0
  89. package/dist/src/components/Tooltip/helpers.d.ts +2 -0
  90. package/dist/src/components/Tooltip/index.d.ts +5 -0
  91. package/dist/src/components/Tooltip/virtualElementReference.d.ts +9 -0
  92. package/dist/src/components/Typography/Heading.d.ts +11 -0
  93. package/dist/src/components/Typography/Text.d.ts +15 -0
  94. package/dist/src/components/UploadBar/UploadBar.d.ts +16 -0
  95. package/dist/src/components/UploadBar/index.d.ts +1 -0
  96. package/dist/src/foundations/shadow-token.d.ts +5 -0
  97. package/dist/src/foundations/spacing-token.d.ts +16 -0
  98. package/{src/index.ts → dist/src/index.d.ts} +16 -7
  99. package/dist/src/themes/design-token.d.ts +226 -0
  100. package/dist/src/utils/constants.d.ts +1 -0
  101. package/dist/src/utils/index.d.ts +1 -0
  102. package/dist/src/utils/keyCodes.d.ts +12 -0
  103. package/dist/src/utils/noop.d.ts +1 -0
  104. package/dist/style.css +1 -0
  105. package/dist/themes/dark.css +253 -0
  106. package/dist/themes/dark.css.map +1 -0
  107. package/dist/themes/legacy.css +254 -0
  108. package/dist/themes/legacy.css.map +1 -0
  109. package/dist/themes/light.css +253 -0
  110. package/dist/themes/light.css.map +1 -0
  111. package/package.json +26 -13
  112. package/.eslintrc +0 -9
  113. package/.storybook/main.js +0 -20
  114. package/.storybook/preview-head.html +0 -31
  115. package/.storybook/preview.js +0 -21
  116. package/src/components/Alert/Alert.module.scss +0 -88
  117. package/src/components/Alert/Alert.spec.tsx +0 -78
  118. package/src/components/Alert/Alert.stories.tsx +0 -73
  119. package/src/components/Alert/Alert.tsx +0 -94
  120. package/src/components/Badge/Badge.module.scss +0 -23
  121. package/src/components/Badge/Badge.spec.tsx +0 -12
  122. package/src/components/Badge/Badge.stories.tsx +0 -24
  123. package/src/components/Badge/Badge.tsx +0 -24
  124. package/src/components/Button/Button.module.scss +0 -257
  125. package/src/components/Button/Button.spec.tsx +0 -110
  126. package/src/components/Button/Button.stories.tsx +0 -152
  127. package/src/components/Button/Button.tsx +0 -88
  128. package/src/components/Button/index.ts +0 -2
  129. package/src/components/ButtonGroup/ButtonGroup.module.scss +0 -31
  130. package/src/components/ButtonGroup/ButtonGroup.spec.tsx +0 -61
  131. package/src/components/ButtonGroup/ButtonGroup.stories.tsx +0 -53
  132. package/src/components/ButtonGroup/ButtonGroup.tsx +0 -75
  133. package/src/components/ButtonGroup/index.ts +0 -1
  134. package/src/components/Card/Card.module.scss +0 -31
  135. package/src/components/Card/Card.spec.tsx +0 -38
  136. package/src/components/Card/Card.stories.tsx +0 -30
  137. package/src/components/Card/Card.tsx +0 -34
  138. package/src/components/Checkbox/Checkbox.module.scss +0 -99
  139. package/src/components/Checkbox/Checkbox.tsx +0 -39
  140. package/src/components/Checkbox/CheckboxField.spec.tsx +0 -58
  141. package/src/components/Checkbox/CheckboxField.stories.tsx +0 -30
  142. package/src/components/Checkbox/CheckboxField.tsx +0 -46
  143. package/src/components/Checkbox/index.ts +0 -2
  144. package/src/components/FieldDescription/FieldDescription.module.scss +0 -5
  145. package/src/components/FieldDescription/FieldDescription.tsx +0 -23
  146. package/src/components/FieldError/FieldError.module.scss +0 -5
  147. package/src/components/FieldError/FieldError.tsx +0 -23
  148. package/src/components/FieldGroup/FieldGroup.module.scss +0 -25
  149. package/src/components/FieldGroup/FieldGroup.spec.tsx +0 -42
  150. package/src/components/FieldGroup/FieldGroup.stories.tsx +0 -34
  151. package/src/components/FieldGroup/FieldGroup.tsx +0 -38
  152. package/src/components/Form/Form.module.scss +0 -22
  153. package/src/components/Form/Form.spec.tsx +0 -38
  154. package/src/components/Form/Form.stories.tsx +0 -42
  155. package/src/components/Form/Form.tsx +0 -46
  156. package/src/components/FormGroup/FormGroup.module.scss +0 -20
  157. package/src/components/FormGroup/FormGroup.spec.tsx +0 -34
  158. package/src/components/FormGroup/FormGroup.stories.tsx +0 -30
  159. package/src/components/FormGroup/FormGroup.tsx +0 -44
  160. package/src/components/Icon/Icon.module.scss +0 -70
  161. package/src/components/Icon/Icon.stories.tsx +0 -53
  162. package/src/components/Icon/Icon.tsx +0 -118
  163. package/src/components/Icon/index.ts +0 -1
  164. package/src/components/InputField/InputField.module.scss +0 -37
  165. package/src/components/InputField/InputField.spec.tsx +0 -53
  166. package/src/components/InputField/InputField.stories.tsx +0 -73
  167. package/src/components/InputField/InputField.tsx +0 -72
  168. package/src/components/InputField/index.ts +0 -1
  169. package/src/components/Link/Link.module.scss +0 -18
  170. package/src/components/Link/Link.stories.tsx +0 -17
  171. package/src/components/Loader/Loader.module.scss +0 -66
  172. package/src/components/Loader/Loader.spec.tsx +0 -64
  173. package/src/components/Loader/Loader.stories.tsx +0 -25
  174. package/src/components/Loader/Loader.tsx +0 -48
  175. package/src/components/Modal/ActionModal.tsx +0 -37
  176. package/src/components/Modal/Modal.module.scss +0 -131
  177. package/src/components/Modal/Modal.stories.tsx +0 -85
  178. package/src/components/Modal/Modal.tsx +0 -41
  179. package/src/components/Modal/ModalBase.spec.tsx +0 -58
  180. package/src/components/Modal/ModalBase.tsx +0 -66
  181. package/src/components/Modal/ModalCloseButton.tsx +0 -20
  182. package/src/components/Modal/ModalPortal.tsx +0 -35
  183. package/src/components/NumericInput/NumericInput.module.scss +0 -110
  184. package/src/components/NumericInput/NumericInput.spec.tsx +0 -129
  185. package/src/components/NumericInput/NumericInput.stories.tsx +0 -56
  186. package/src/components/NumericInput/NumericInput.tsx +0 -161
  187. package/src/components/NumericInput/NumericInputField.stories.tsx +0 -58
  188. package/src/components/NumericInput/NumericInputField.tsx +0 -57
  189. package/src/components/NumericInput/index.ts +0 -2
  190. package/src/components/Popover/Popover.module.scss +0 -16
  191. package/src/components/Popover/Popover.spec.tsx +0 -39
  192. package/src/components/Popover/Popover.stories.css +0 -23
  193. package/src/components/Popover/Popover.stories.tsx +0 -164
  194. package/src/components/Popover/Popover.tsx +0 -124
  195. package/src/components/Progress/ProgressBar.module.scss +0 -48
  196. package/src/components/Progress/ProgressBar.spec.tsx +0 -33
  197. package/src/components/Progress/ProgressBar.stories.tsx +0 -23
  198. package/src/components/Progress/ProgressBar.tsx +0 -62
  199. package/src/components/Progress/ProgressCircle.module.scss +0 -64
  200. package/src/components/Progress/ProgressCircle.spec.tsx +0 -34
  201. package/src/components/Progress/ProgressCircle.stories.tsx +0 -28
  202. package/src/components/Progress/ProgressCircle.tsx +0 -104
  203. package/src/components/Progress/constants.ts +0 -23
  204. package/src/components/Progress/helpers.ts +0 -23
  205. package/src/components/PromoBanner/PromoBanner.module.scss +0 -121
  206. package/src/components/PromoBanner/PromoBanner.spec.tsx +0 -119
  207. package/src/components/PromoBanner/PromoBanner.stories.tsx +0 -125
  208. package/src/components/PromoBanner/PromoBanner.tsx +0 -99
  209. package/src/components/RadioButton/RadioButton.module.scss +0 -100
  210. package/src/components/RadioButton/RadioButton.spec.tsx +0 -70
  211. package/src/components/RadioButton/RadioButton.stories.tsx +0 -34
  212. package/src/components/RadioButton/RadioButton.tsx +0 -54
  213. package/src/components/Switch/Switch.module.scss +0 -126
  214. package/src/components/Switch/Switch.spec.tsx +0 -40
  215. package/src/components/Switch/Switch.stories.tsx +0 -23
  216. package/src/components/Switch/Switch.tsx +0 -100
  217. package/src/components/Tab/Tab.module.scss +0 -56
  218. package/src/components/Tab/Tab.spec.tsx +0 -34
  219. package/src/components/Tab/Tab.stories.tsx +0 -20
  220. package/src/components/Tab/Tab.tsx +0 -49
  221. package/src/components/Tab/TabsWrapper.module.scss +0 -11
  222. package/src/components/Tab/TabsWrapper.spec.tsx +0 -19
  223. package/src/components/Tab/TabsWrapper.stories.tsx +0 -46
  224. package/src/components/Tab/TabsWrapper.tsx +0 -24
  225. package/src/components/Tag/Tag.module.scss +0 -131
  226. package/src/components/Tag/Tag.spec.tsx +0 -93
  227. package/src/components/Tag/Tag.stories.tsx +0 -151
  228. package/src/components/Tag/Tag.tsx +0 -129
  229. package/src/components/TagInput/EditableTag.tsx +0 -54
  230. package/src/components/TagInput/EditableTagContent.tsx +0 -81
  231. package/src/components/TagInput/EmailTagInput.tsx +0 -31
  232. package/src/components/TagInput/TagInput.module.scss +0 -81
  233. package/src/components/TagInput/TagInput.spec.tsx +0 -58
  234. package/src/components/TagInput/TagInput.stories.tsx +0 -49
  235. package/src/components/TagInput/TagInput.tsx +0 -133
  236. package/src/components/TextField/TextField.module.scss +0 -90
  237. package/src/components/TextField/TextField.spec.tsx +0 -40
  238. package/src/components/TextField/TextField.stories.tsx +0 -60
  239. package/src/components/TextField/TextField.tsx +0 -100
  240. package/src/components/TextField/index.ts +0 -1
  241. package/src/components/Toast/Toast.module.scss +0 -218
  242. package/src/components/Toast/Toast.spec.tsx +0 -96
  243. package/src/components/Toast/Toast.stories.tsx +0 -64
  244. package/src/components/Toast/Toast.tsx +0 -121
  245. package/src/components/Toast/ToastWrapper.spec.tsx +0 -13
  246. package/src/components/Toast/ToastWrapper.stories.tsx +0 -55
  247. package/src/components/Toast/ToastWrapper.tsx +0 -87
  248. package/src/components/Typography/Heading.tsx +0 -36
  249. package/src/components/Typography/Text.tsx +0 -49
  250. package/src/components/Typography/Typography.module.scss +0 -132
  251. package/src/index.scss +0 -9
  252. package/src/stories/ColorTokens.stories.mdx +0 -10
  253. package/src/stories/Icons.stories.mdx +0 -12
  254. package/src/stories/Typography.stories.mdx +0 -65
  255. package/src/stories/components/ColorTokens.tsx +0 -99
  256. package/src/stories/components/IconsShowcase.tsx +0 -25
  257. package/src/stories/components/iconsShowcase.css +0 -13
  258. package/src/test/setup.ts +0 -1
  259. package/src/test/utils.ts +0 -3
  260. package/src/themes/dark.scss +0 -127
  261. package/src/themes/designTokens.ts +0 -126
  262. package/src/themes/legacy.scss +0 -128
  263. package/src/themes/light.scss +0 -127
  264. package/src/utils/keyCodes.ts +0 -12
  265. package/src/utils/noop.ts +0 -2
  266. package/tsconfig.json +0 -25
  267. package/tsconfig.node.json +0 -8
  268. package/vite.config.ts +0 -44
  269. /package/{src/components/Alert/index.ts → dist/src/components/Alert/index.d.ts} +0 -0
  270. /package/{src/components/Badge/index.ts → dist/src/components/Badge/index.d.ts} +0 -0
  271. /package/{src/components/Card/index.ts → dist/src/components/Card/index.d.ts} +0 -0
  272. /package/{src/components/FieldDescription/index.ts → dist/src/components/FieldDescription/index.d.ts} +0 -0
  273. /package/{src/components/FieldError/index.ts → dist/src/components/FieldError/index.d.ts} +0 -0
  274. /package/{src/components/FieldGroup/index.ts → dist/src/components/FieldGroup/index.d.ts} +0 -0
  275. /package/{src/components/Form/index.ts → dist/src/components/Form/index.d.ts} +0 -0
  276. /package/{src/components/FormGroup/index.ts → dist/src/components/FormGroup/index.d.ts} +0 -0
  277. /package/{src/components/Link/index.ts → dist/src/components/Link/index.d.ts} +0 -0
  278. /package/{src/components/Loader/index.ts → dist/src/components/Loader/index.d.ts} +0 -0
  279. /package/{src/components/Popover/index.ts → dist/src/components/Popover/index.d.ts} +0 -0
  280. /package/{src/components/PromoBanner/index.ts → dist/src/components/PromoBanner/index.d.ts} +0 -0
  281. /package/{src/components/RadioButton/index.ts → dist/src/components/RadioButton/index.d.ts} +0 -0
  282. /package/{src/components/Switch/index.ts → dist/src/components/Switch/index.d.ts} +0 -0
  283. /package/{src/components/Tab/index.ts → dist/src/components/Tab/index.d.ts} +0 -0
  284. /package/{src/components/Tag/index.ts → dist/src/components/Tag/index.d.ts} +0 -0
  285. /package/{src/components/TagInput/index.ts → dist/src/components/TagInput/index.d.ts} +0 -0
  286. /package/{src/components/Toast/index.ts → dist/src/components/Toast/index.d.ts} +0 -0
  287. /package/{src/components/Typography/index.ts → dist/src/components/Typography/index.d.ts} +0 -0
  288. /package/{src → dist/src}/vite-env.d.ts +0 -0
@@ -1,23 +0,0 @@
1
- export const enum ProgressStatus {
2
- Normal = 'normal',
3
- Error = 'error',
4
- Success = 'success',
5
- }
6
-
7
- export const enum ProgressSize {
8
- Small = 'small',
9
- Medium = 'medium',
10
- Large = 'large',
11
- }
12
-
13
- export const PROGRESS_STATUSES = [
14
- ProgressStatus.Normal,
15
- ProgressStatus.Error,
16
- ProgressStatus.Success,
17
- ];
18
-
19
- export const PROGRESS_SIZES = [
20
- ProgressSize.Small,
21
- ProgressSize.Medium,
22
- ProgressSize.Large,
23
- ];
@@ -1,23 +0,0 @@
1
- import { PROGRESS_STATUSES, ProgressStatus } from './constants';
2
-
3
- const clampPercentage = (percent: number): number =>
4
- Math.min(Math.max(percent, 0), 100);
5
-
6
- export function getPercentNumber(status: ProgressStatus, percent = 0): number {
7
- if (status === ProgressStatus.Error) {
8
- return 0;
9
- }
10
-
11
- return clampPercentage(parseInt(percent.toString(), 10));
12
- }
13
-
14
- export function getProgressStatus(
15
- status: ProgressStatus,
16
- percent: number
17
- ): ProgressStatus {
18
- if (!PROGRESS_STATUSES.includes(status) && percent >= 100) {
19
- return ProgressStatus.Normal;
20
- }
21
-
22
- return status || ProgressStatus.Normal;
23
- }
@@ -1,121 +0,0 @@
1
- .promo-banner {
2
- align-items: center;
3
- background-color: var(--surface-basic-subtle);
4
- border-radius: 4px;
5
- box-sizing: border-box;
6
- color: var(--content-default);
7
- display: flex;
8
- font-size: 16px;
9
- justify-content: space-between;
10
- min-width: 180px;
11
- padding: 20px;
12
- position: relative;
13
- width: 100%;
14
- word-break: break-word;
15
-
16
- b {
17
- font-weight: 600;
18
- }
19
-
20
- &__content {
21
- display: flex;
22
- flex-direction: row;
23
- justify-content: flex-start;
24
- }
25
-
26
- &__wrapper {
27
- display: flex;
28
- flex-direction: column;
29
- }
30
-
31
- &__header {
32
- font-weight: 600;
33
- margin-bottom: 8px;
34
- }
35
-
36
- &__img {
37
- height: 48px;
38
- object-fit: contain;
39
- width: 48px;
40
- }
41
-
42
- &__button-text {
43
- margin-right: 24px;
44
- }
45
-
46
- &--light {
47
- background-color: var(--surface-basic-default);
48
- border: solid 1px var(--border-subtle);
49
- }
50
-
51
- &--small {
52
- flex-wrap: wrap;
53
- max-width: 400px;
54
-
55
- .promo-banner__content {
56
- flex-direction: column;
57
- }
58
-
59
- .promo-banner__img {
60
- margin-bottom: 12px;
61
- }
62
-
63
- .promo-banner__footer {
64
- display: flex;
65
- margin-top: 12px;
66
- }
67
- }
68
-
69
- &--medium {
70
- flex-wrap: wrap;
71
- max-width: 800px;
72
-
73
- .promo-banner__img {
74
- margin-right: 20px;
75
- }
76
-
77
- .promo-banner__wrapper {
78
- max-width: 680px;
79
- }
80
-
81
- .promo-banner__footer {
82
- display: flex;
83
- flex-shrink: 0;
84
- margin-top: 12px;
85
- }
86
- }
87
-
88
- &--large {
89
- min-width: 600px;
90
-
91
- .promo-banner__img {
92
- margin-right: 20px;
93
- }
94
-
95
- .promo-banner__wrapper {
96
- max-width: 680px;
97
- min-width: 180px;
98
- }
99
-
100
- .promo-banner__footer {
101
- align-items: center;
102
- display: inline-flex;
103
- flex-shrink: 0;
104
- margin: 0 56px;
105
- }
106
- }
107
-
108
- &__close-icon {
109
- background-color: transparent;
110
- border: 0;
111
- box-shadow: none;
112
- cursor: pointer;
113
- height: 24px;
114
- overflow: hidden;
115
- padding: 0;
116
- position: absolute;
117
- right: 12px;
118
- top: 12px;
119
- width: 24px;
120
- }
121
- }
@@ -1,119 +0,0 @@
1
- import * as React from 'react';
2
- import { render, fireEvent, vi } from 'test-utils';
3
- import { PromoBannerProps, PromoBanner, PromoBannerSize } from './PromoBanner';
4
-
5
- import styles from './PromoBanner.module.scss';
6
-
7
- const promoHeader = 'This example headline has 40 characters';
8
-
9
- const renderComponent = (props: PromoBannerProps) => {
10
- return render(<PromoBanner {...props}>This example content</PromoBanner>);
11
- };
12
-
13
- describe('<PromoBanner> component', () => {
14
- it('should allow for custom class', () => {
15
- const { container } = renderComponent({
16
- header: promoHeader,
17
- className: 'my-css-class',
18
- });
19
-
20
- expect(container.firstChild).toHaveClass('my-css-class');
21
- });
22
-
23
- it('should display button', () => {
24
- const { getByText } = renderComponent({
25
- header: promoHeader,
26
- buttonText: 'Example text',
27
- });
28
-
29
- expect(getByText('Example text')).toBeVisible();
30
- });
31
-
32
- it('should display link', () => {
33
- const { getByText } = renderComponent({
34
- header: promoHeader,
35
- linkText: 'Example text',
36
- });
37
-
38
- expect(getByText('Example text')).toBeVisible();
39
- });
40
-
41
- it('should display image', () => {
42
- const { getByRole } = renderComponent({
43
- header: promoHeader,
44
- img: 'https://via.placeholder.com/100',
45
- });
46
-
47
- expect(getByRole('img')).toBeVisible();
48
- });
49
-
50
- it('should display with light mode', () => {
51
- const { container } = renderComponent({
52
- header: promoHeader,
53
- light: true,
54
- });
55
-
56
- expect(container.firstChild).toHaveClass(styles['promo-banner--light']);
57
- });
58
-
59
- it('should display with small size by default', () => {
60
- const { container } = renderComponent({
61
- header: promoHeader,
62
- });
63
-
64
- expect(container.firstChild).toHaveClass(styles['promo-banner--small']);
65
- });
66
-
67
- it('should display with medium size', () => {
68
- const { container } = renderComponent({
69
- header: promoHeader,
70
- size: PromoBannerSize.Medium,
71
- });
72
-
73
- expect(container.firstChild).toHaveClass(styles['promo-banner--medium']);
74
- });
75
-
76
- it('should display with large size', () => {
77
- const { container } = renderComponent({
78
- header: promoHeader,
79
- size: PromoBannerSize.Large,
80
- });
81
-
82
- expect(container.firstChild).toHaveClass(styles['promo-banner--large']);
83
- });
84
-
85
- it('should call onClose function', () => {
86
- const onClose = vi.fn();
87
- const { getByRole } = renderComponent({
88
- header: promoHeader,
89
- onClose,
90
- });
91
-
92
- fireEvent.click(getByRole('button'));
93
- expect(onClose).toHaveBeenCalled();
94
- });
95
-
96
- it('should call onButtonClick function', () => {
97
- const onButtonClick = vi.fn();
98
- const { getByText } = renderComponent({
99
- header: promoHeader,
100
- buttonText: 'Example text',
101
- onButtonClick,
102
- });
103
-
104
- fireEvent.click(getByText('Example text'));
105
- expect(onButtonClick).toHaveBeenCalled();
106
- });
107
-
108
- it('should call onLinkClick function', () => {
109
- const onLinkClick = vi.fn();
110
- const { getByText } = renderComponent({
111
- header: promoHeader,
112
- linkText: 'Example text',
113
- onLinkClick,
114
- });
115
-
116
- fireEvent.click(getByText('Example text'));
117
- expect(onLinkClick).toHaveBeenCalled();
118
- });
119
- });
@@ -1,125 +0,0 @@
1
- import * as React from 'react';
2
- import { ComponentMeta, Story } from '@storybook/react';
3
-
4
- import {
5
- PromoBannerProps,
6
- PromoBanner as PromoBannerComponent,
7
- PromoBannerSize,
8
- } from './PromoBanner';
9
-
10
- export default {
11
- title: 'Components/PromoBanner',
12
- component: PromoBannerComponent,
13
- parameters: {
14
- componentSubtitle: `
15
- Promo banner component is used to let users know about upgrade options, new features,
16
- or any other information that doesn't require immediate action. This component should be
17
- used wisely so don't overuse it too often. Remember to always specify the action that you
18
- want to promote.
19
- `,
20
- },
21
- argTypes: { onClose: { defaultValue: null } },
22
- } as ComponentMeta<typeof PromoBannerComponent>;
23
-
24
- const StoryTemplate: Story<PromoBannerProps> = (args: PromoBannerProps) => (
25
- <div>
26
- <PromoBannerComponent {...args}>
27
- <>
28
- A description with a <b>maximum of 100 characters</b>. That usually
29
- means only one or two sentences.
30
- </>
31
- </PromoBannerComponent>
32
- </div>
33
- );
34
-
35
- export const PromoBanner = StoryTemplate.bind({});
36
- PromoBanner.args = {
37
- header: 'This example headline has 40 characters',
38
- };
39
-
40
- export const PromoBannerWithButtons = StoryTemplate.bind({});
41
- PromoBannerWithButtons.args = {
42
- header: 'This example headline has 40 characters',
43
- buttonText: 'Example',
44
- linkText: 'Example',
45
- onButtonClick: () => {
46
- alert('onButtonClick click');
47
- },
48
- onLinkClick: () => {
49
- alert('onLinkClick click');
50
- },
51
- };
52
-
53
- export const PromoBannerWithImage = StoryTemplate.bind({});
54
- PromoBannerWithImage.args = {
55
- header: 'This example headline has 40 characters',
56
- img: 'https://via.placeholder.com/100',
57
- };
58
-
59
- export const PromoBannerLight = StoryTemplate.bind({});
60
- PromoBannerLight.args = {
61
- header: 'This example headline has 40 characters',
62
- light: true,
63
- };
64
-
65
- export const PromoBannerWithClose = StoryTemplate.bind({});
66
- PromoBannerWithClose.args = {
67
- header: 'This example headline has 40 characters',
68
- onClose: () => {
69
- alert('onClose click');
70
- },
71
- };
72
-
73
- export const PromoBannerSmall = StoryTemplate.bind({});
74
- PromoBannerSmall.args = {
75
- header: 'This example headline has 40 characters',
76
- img: 'https://via.placeholder.com/100',
77
- size: PromoBannerSize.Small,
78
- buttonText: 'Example button',
79
- linkText: 'Example link',
80
- onClose: () => {
81
- alert('onClose click');
82
- },
83
- onButtonClick: () => {
84
- alert('onButtonClick click');
85
- },
86
- onLinkClick: () => {
87
- alert('onLinkClick click');
88
- },
89
- };
90
-
91
- export const PromoBannerMedium = StoryTemplate.bind({});
92
- PromoBannerMedium.args = {
93
- header: 'This example headline has 40 characters',
94
- img: 'https://via.placeholder.com/100',
95
- size: PromoBannerSize.Medium,
96
- buttonText: 'Example button',
97
- linkText: 'Example link',
98
- onClose: () => {
99
- alert('onClose click');
100
- },
101
- onButtonClick: () => {
102
- alert('onButtonClick click');
103
- },
104
- onLinkClick: () => {
105
- alert('onLinkClick click');
106
- },
107
- };
108
-
109
- export const PromoBannerLarge = StoryTemplate.bind({});
110
- PromoBannerLarge.args = {
111
- header: 'This example headline has 40 characters',
112
- img: 'https://via.placeholder.com/100',
113
- size: PromoBannerSize.Large,
114
- buttonText: 'Example button',
115
- linkText: 'Example link',
116
- onClose: () => {
117
- alert('onClose click');
118
- },
119
- onButtonClick: () => {
120
- alert('onButtonClick click');
121
- },
122
- onLinkClick: () => {
123
- alert('onLinkClick click');
124
- },
125
- };
@@ -1,99 +0,0 @@
1
- import * as React from 'react';
2
- import cx from 'clsx';
3
- import { Close as CloseIcon } from '@livechat/design-system-icons/react/material';
4
-
5
- import { Button } from '../Button';
6
- import { Icon, IconSizeName } from '../Icon';
7
-
8
- import styles from './PromoBanner.module.scss';
9
-
10
- const baseClass = 'promo-banner';
11
-
12
- export const enum PromoBannerSize {
13
- Small = 'small',
14
- Medium = 'medium',
15
- Large = 'large',
16
- }
17
-
18
- export interface PromoBannerProps {
19
- className?: string;
20
- buttonText?: string;
21
- header: string;
22
- img?: string;
23
- light?: boolean;
24
- linkText?: string;
25
- size?: PromoBannerSize;
26
- onButtonClick?: () => void;
27
- onClose?: () => void;
28
- onLinkClick?: () => void;
29
- }
30
-
31
- export const PromoBanner: React.FC<PromoBannerProps> = ({
32
- className,
33
- buttonText,
34
- children,
35
- header,
36
- img,
37
- light = false,
38
- linkText,
39
- size = PromoBannerSize.Small,
40
- onButtonClick,
41
- onClose,
42
- onLinkClick,
43
- }) => {
44
- const mergedClassNames = cx(
45
- styles[baseClass],
46
- {
47
- [styles[`${baseClass}--light`]]: light,
48
- [styles[`${baseClass}--${size}`]]: size,
49
- },
50
- className
51
- );
52
-
53
- const shouldRenderLargeFooter = (buttonText || linkText) && size === 'large';
54
- const shouldRenderSmallOrMediumFooter =
55
- (buttonText || linkText) && size !== 'large';
56
-
57
- const footer = (
58
- <div className={styles[`${baseClass}__footer`]}>
59
- {buttonText && (
60
- <Button
61
- kind="primary"
62
- size="compact"
63
- onClick={onButtonClick}
64
- className={styles[`${baseClass}__button-text`]}
65
- >
66
- {buttonText}
67
- </Button>
68
- )}
69
- {linkText && (
70
- <Button size="compact" kind="text" onClick={onLinkClick}>
71
- {linkText}
72
- </Button>
73
- )}
74
- </div>
75
- );
76
-
77
- return (
78
- <div className={mergedClassNames}>
79
- <div className={styles[`${baseClass}__content`]}>
80
- {img && <img src={img} className={styles[`${baseClass}__img`]} />}
81
- <div className={styles[`${baseClass}__wrapper`]}>
82
- <div className={styles[`${baseClass}__header`]}>{header}</div>
83
- <div>{children}</div>
84
- {shouldRenderSmallOrMediumFooter && footer}
85
- </div>
86
- {shouldRenderLargeFooter && footer}
87
- </div>
88
- {onClose && (
89
- <button
90
- type="button"
91
- className={styles[`${baseClass}__close-icon`]}
92
- onClick={onClose}
93
- >
94
- <Icon source={CloseIcon} size={IconSizeName.Large} />
95
- </button>
96
- )}
97
- </div>
98
- );
99
- };
@@ -1,100 +0,0 @@
1
- .radio-button {
2
- display: inline-block;
3
-
4
- &__label {
5
- align-items: center;
6
- cursor: pointer;
7
- display: inline-flex;
8
- flex: 0 1 auto;
9
- width: 100%;
10
- }
11
-
12
- &__circle {
13
- background-color: var(--surface-basic-default);
14
- border: 1px solid var(--border-default);
15
- border-radius: 16px;
16
- box-sizing: border-box;
17
- height: 16px;
18
- margin-right: 8px;
19
- position: relative;
20
- transition: all 0.2s ease;
21
- width: 16px;
22
- }
23
-
24
- &__inner-circle {
25
- background-color: var(--color-action-default);
26
- border-radius: 8px;
27
- height: 8px;
28
- left: 3px;
29
- opacity: 0;
30
- position: absolute;
31
- top: 3px;
32
- transition: all 0.2s ease;
33
- width: 8px;
34
- }
35
-
36
- &__text {
37
- color: var(--content-default);
38
- flex: 1 0 auto;
39
- }
40
-
41
- &__input {
42
- cursor: pointer;
43
- height: 100%;
44
- margin: 0;
45
- opacity: 0;
46
- width: 100%;
47
- }
48
-
49
- &__helper {
50
- cursor: default;
51
- margin-left: 24px;
52
- }
53
-
54
- &:focus {
55
- .radio-button__circle {
56
- border-radius: 20px;
57
- box-shadow: 0 0 1px 1.6px rgba(67, 132, 245, 0.7); // TODO use color token
58
- }
59
- }
60
-
61
- &--selected {
62
- .radio-button__circle {
63
- border-color: var(--color-action-default);
64
- }
65
-
66
- .radio-button__inner-circle {
67
- opacity: 1;
68
- }
69
- }
70
-
71
- &--selected:hover {
72
- .radio-button__circle {
73
- border-color: var(--color-action-hover);
74
- }
75
-
76
- .radio-button__inner-circle {
77
- background-color: var(--color-action-hover);
78
- }
79
- }
80
-
81
- &--disabled {
82
- .radio-button__circle {
83
- opacity: 0.4;
84
- }
85
-
86
- &:not(.radio-button--selected) {
87
- .radio-button__circle {
88
- background-color: var(--surface-basic-disabled);
89
- }
90
- }
91
-
92
- .radio-button__label,
93
- .radio-button__input,
94
- .radio-button__text,
95
- .radio-button__helper {
96
- color: var(--content-disabled);
97
- cursor: not-allowed;
98
- }
99
- }
100
- }
@@ -1,70 +0,0 @@
1
- import * as React from 'react';
2
- import { render, userEvent, vi } from 'test-utils';
3
- import { RadioButton } from './RadioButton';
4
-
5
- import styles from './RadioButton.module.scss';
6
-
7
- const baseClass = 'radio-button';
8
-
9
- describe('<RadioButton> component', () => {
10
- it('should allow for custom class', () => {
11
- const { container } = render(
12
- <RadioButton className="my-css-class">test</RadioButton>
13
- );
14
- expect(container.firstChild).toHaveClass('my-css-class');
15
- });
16
-
17
- it('should not have been checked or disabled by default', () => {
18
- const { container } = render(<RadioButton>test</RadioButton>);
19
- expect(container.firstChild).not.toHaveClass(
20
- styles[`${baseClass}--selected`]
21
- );
22
- expect(container.firstChild).not.toHaveClass(
23
- styles[`${baseClass}--disabled`]
24
- );
25
- });
26
-
27
- it('should have secondary class when used with secondary prop', () => {
28
- const { container } = render(
29
- <RadioButton checked disabled>
30
- test
31
- </RadioButton>
32
- );
33
- expect(container.firstChild).toHaveClass(styles[`${baseClass}--selected`]);
34
- expect(container.firstChild).toHaveClass(styles[`${baseClass}--disabled`]);
35
- });
36
-
37
- it('should call onChange method', () => {
38
- const onChange = vi.fn();
39
-
40
- const { getByRole } = render(
41
- <RadioButton onChange={onChange}>test</RadioButton>
42
- );
43
- userEvent.click(getByRole('radio'));
44
- expect(onChange).toBeCalledTimes(1);
45
- });
46
-
47
- it('should not call onChange method when checked', () => {
48
- const onChange = vi.fn();
49
-
50
- const { getByRole } = render(
51
- <RadioButton checked onChange={onChange}>
52
- test
53
- </RadioButton>
54
- );
55
- userEvent.click(getByRole('radio'));
56
- expect(onChange).not.toBeCalled();
57
- });
58
-
59
- it('should not call onChange method when disabled', () => {
60
- const onChange = vi.fn();
61
-
62
- const { getByRole } = render(
63
- <RadioButton disabled onChange={onChange}>
64
- test
65
- </RadioButton>
66
- );
67
- userEvent.click(getByRole('radio'));
68
- expect(onChange).not.toBeCalled();
69
- });
70
- });