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

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 (233) hide show
  1. package/dist/dsrc.cjs.js +1 -0
  2. package/dist/dsrc.es.js +2213 -0
  3. package/dist/dsrc.umd.js +1 -0
  4. package/dist/src/components/Alert/Alert.d.ts +19 -0
  5. package/{src/components/Alert/index.ts → dist/src/components/Alert/index.d.ts} +0 -0
  6. package/dist/src/components/Badge/Badge.d.ts +5 -0
  7. package/{src/components/Badge/index.ts → dist/src/components/Badge/index.d.ts} +0 -0
  8. package/dist/src/components/Button/Button.d.ts +13 -0
  9. package/{src/components/Button/index.ts → dist/src/components/Button/index.d.ts} +0 -0
  10. package/dist/src/components/ButtonGroup/ButtonGroup.d.ts +11 -0
  11. package/{src/components/ButtonGroup/index.ts → dist/src/components/ButtonGroup/index.d.ts} +0 -0
  12. package/dist/src/components/Card/Card.d.ts +6 -0
  13. package/{src/components/Card/index.ts → dist/src/components/Card/index.d.ts} +0 -0
  14. package/dist/src/components/Checkbox/Checkbox.d.ts +7 -0
  15. package/dist/src/components/Checkbox/CheckboxField.d.ts +7 -0
  16. package/{src/components/Checkbox/index.ts → dist/src/components/Checkbox/index.d.ts} +0 -0
  17. package/dist/src/components/FieldDescription/FieldDescription.d.ts +3 -0
  18. package/{src/components/FieldDescription/index.ts → dist/src/components/FieldDescription/index.d.ts} +0 -0
  19. package/dist/src/components/FieldError/FieldError.d.ts +3 -0
  20. package/{src/components/FieldError/index.ts → dist/src/components/FieldError/index.d.ts} +0 -0
  21. package/dist/src/components/FieldGroup/FieldGroup.d.ts +8 -0
  22. package/{src/components/FieldGroup/index.ts → dist/src/components/FieldGroup/index.d.ts} +0 -0
  23. package/dist/src/components/Form/Form.d.ts +7 -0
  24. package/{src/components/Form/index.ts → dist/src/components/Form/index.d.ts} +0 -0
  25. package/dist/src/components/FormGroup/FormGroup.d.ts +7 -0
  26. package/{src/components/FormGroup/index.ts → dist/src/components/FormGroup/index.d.ts} +0 -0
  27. package/dist/src/components/Icon/Icon.d.ts +70 -0
  28. package/{src/components/Icon/index.ts → dist/src/components/Icon/index.d.ts} +0 -0
  29. package/dist/src/components/InputField/InputField.d.ts +15 -0
  30. package/{src/components/InputField/index.ts → dist/src/components/InputField/index.d.ts} +0 -0
  31. package/{src/components/Link/Link.tsx → dist/src/components/Link/Link.d.ts} +3 -26
  32. package/{src/components/Link/index.ts → dist/src/components/Link/index.d.ts} +0 -0
  33. package/dist/src/components/Loader/Loader.d.ts +10 -0
  34. package/{src/components/Loader/index.ts → dist/src/components/Loader/index.d.ts} +0 -0
  35. package/dist/src/components/Modal/ActionModal.d.ts +8 -0
  36. package/dist/src/components/Modal/Modal.d.ts +7 -0
  37. package/dist/src/components/Modal/ModalBase.d.ts +6 -0
  38. package/dist/src/components/Modal/ModalCloseButton.d.ts +3 -0
  39. package/dist/src/components/Modal/ModalPortal.d.ts +7 -0
  40. package/{src/components/Modal/index.ts → dist/src/components/Modal/index.d.ts} +0 -1
  41. package/dist/src/components/NumericInput/NumericInput.d.ts +14 -0
  42. package/dist/src/components/NumericInput/NumericInputField.d.ts +19 -0
  43. package/{src/components/NumericInput/index.ts → dist/src/components/NumericInput/index.d.ts} +0 -0
  44. package/dist/src/components/Popover/Popover.d.ts +15 -0
  45. package/{src/components/Popover/index.ts → dist/src/components/Popover/index.d.ts} +0 -0
  46. package/dist/src/components/Progress/ProgressCircle.d.ts +9 -0
  47. package/dist/src/components/Progress/constants.d.ts +12 -0
  48. package/dist/src/components/Progress/helpers.d.ts +3 -0
  49. package/{src/components/Progress/index.ts → dist/src/components/Progress/index.d.ts} +0 -0
  50. package/dist/src/components/PromoBanner/PromoBanner.d.ts +19 -0
  51. package/{src/components/PromoBanner/index.ts → dist/src/components/PromoBanner/index.d.ts} +0 -0
  52. package/dist/src/components/RadioButton/RadioButton.d.ts +7 -0
  53. package/{src/components/RadioButton/index.ts → dist/src/components/RadioButton/index.d.ts} +0 -0
  54. package/dist/src/components/Switch/Switch.d.ts +20 -0
  55. package/{src/components/Switch/index.ts → dist/src/components/Switch/index.d.ts} +0 -0
  56. package/dist/src/components/Tab/Tab.d.ts +12 -0
  57. package/dist/src/components/Tab/TabsWrapper.d.ts +3 -0
  58. package/{src/components/Tab/index.ts → dist/src/components/Tab/index.d.ts} +0 -0
  59. package/dist/src/components/Tag/Tag.d.ts +12 -0
  60. package/{src/components/Tag/index.ts → dist/src/components/Tag/index.d.ts} +0 -0
  61. package/dist/src/components/TagInput/EditableTag.d.ts +11 -0
  62. package/dist/src/components/TagInput/EditableTagContent.d.ts +11 -0
  63. package/dist/src/components/TagInput/EmailTagInput.d.ts +5 -0
  64. package/dist/src/components/TagInput/TagInput.d.ts +12 -0
  65. package/{src/components/TagInput/index.ts → dist/src/components/TagInput/index.d.ts} +0 -0
  66. package/dist/src/components/TextField/TextField.d.ts +13 -0
  67. package/{src/components/TextField/index.ts → dist/src/components/TextField/index.d.ts} +0 -0
  68. package/dist/src/components/Toast/Toast.d.ts +22 -0
  69. package/dist/src/components/Toast/ToastWrapper.d.ts +27 -0
  70. package/{src/components/Toast/index.ts → dist/src/components/Toast/index.d.ts} +0 -0
  71. package/dist/src/components/Typography/Heading.d.ts +11 -0
  72. package/dist/src/components/Typography/Text.d.ts +15 -0
  73. package/{src/components/Typography/index.ts → dist/src/components/Typography/index.d.ts} +0 -0
  74. package/{src/index.ts → dist/src/index.d.ts} +0 -3
  75. package/dist/src/themes/designTokens.d.ts +126 -0
  76. package/dist/src/utils/keyCodes.d.ts +12 -0
  77. package/dist/src/utils/noop.d.ts +1 -0
  78. package/{src → dist/src}/vite-env.d.ts +0 -0
  79. package/dist/style.css +1 -0
  80. package/{src/themes/dark.scss → dist/themes/dark.css} +2 -0
  81. package/dist/themes/dark.css.map +1 -0
  82. package/{src/themes/legacy.scss → dist/themes/legacy.css} +2 -0
  83. package/dist/themes/legacy.css.map +1 -0
  84. package/{src/themes/light.scss → dist/themes/light.css} +2 -0
  85. package/dist/themes/light.css.map +1 -0
  86. package/package.json +8 -5
  87. package/.eslintrc +0 -9
  88. package/.storybook/main.js +0 -20
  89. package/.storybook/preview-head.html +0 -31
  90. package/.storybook/preview.js +0 -21
  91. package/src/components/Alert/Alert.module.scss +0 -88
  92. package/src/components/Alert/Alert.spec.tsx +0 -78
  93. package/src/components/Alert/Alert.stories.tsx +0 -73
  94. package/src/components/Alert/Alert.tsx +0 -94
  95. package/src/components/Badge/Badge.module.scss +0 -23
  96. package/src/components/Badge/Badge.spec.tsx +0 -12
  97. package/src/components/Badge/Badge.stories.tsx +0 -24
  98. package/src/components/Badge/Badge.tsx +0 -24
  99. package/src/components/Button/Button.module.scss +0 -257
  100. package/src/components/Button/Button.spec.tsx +0 -110
  101. package/src/components/Button/Button.stories.tsx +0 -152
  102. package/src/components/Button/Button.tsx +0 -88
  103. package/src/components/ButtonGroup/ButtonGroup.module.scss +0 -31
  104. package/src/components/ButtonGroup/ButtonGroup.spec.tsx +0 -61
  105. package/src/components/ButtonGroup/ButtonGroup.stories.tsx +0 -53
  106. package/src/components/ButtonGroup/ButtonGroup.tsx +0 -75
  107. package/src/components/Card/Card.module.scss +0 -31
  108. package/src/components/Card/Card.spec.tsx +0 -38
  109. package/src/components/Card/Card.stories.tsx +0 -30
  110. package/src/components/Card/Card.tsx +0 -34
  111. package/src/components/Checkbox/Checkbox.module.scss +0 -99
  112. package/src/components/Checkbox/Checkbox.tsx +0 -39
  113. package/src/components/Checkbox/CheckboxField.spec.tsx +0 -58
  114. package/src/components/Checkbox/CheckboxField.stories.tsx +0 -30
  115. package/src/components/Checkbox/CheckboxField.tsx +0 -46
  116. package/src/components/FieldDescription/FieldDescription.module.scss +0 -5
  117. package/src/components/FieldDescription/FieldDescription.tsx +0 -23
  118. package/src/components/FieldError/FieldError.module.scss +0 -5
  119. package/src/components/FieldError/FieldError.tsx +0 -23
  120. package/src/components/FieldGroup/FieldGroup.module.scss +0 -25
  121. package/src/components/FieldGroup/FieldGroup.spec.tsx +0 -42
  122. package/src/components/FieldGroup/FieldGroup.stories.tsx +0 -34
  123. package/src/components/FieldGroup/FieldGroup.tsx +0 -38
  124. package/src/components/Form/Form.module.scss +0 -22
  125. package/src/components/Form/Form.spec.tsx +0 -38
  126. package/src/components/Form/Form.stories.tsx +0 -42
  127. package/src/components/Form/Form.tsx +0 -46
  128. package/src/components/FormGroup/FormGroup.module.scss +0 -20
  129. package/src/components/FormGroup/FormGroup.spec.tsx +0 -34
  130. package/src/components/FormGroup/FormGroup.stories.tsx +0 -30
  131. package/src/components/FormGroup/FormGroup.tsx +0 -44
  132. package/src/components/Icon/Icon.module.scss +0 -70
  133. package/src/components/Icon/Icon.stories.tsx +0 -53
  134. package/src/components/Icon/Icon.tsx +0 -118
  135. package/src/components/InputField/InputField.module.scss +0 -37
  136. package/src/components/InputField/InputField.spec.tsx +0 -53
  137. package/src/components/InputField/InputField.stories.tsx +0 -73
  138. package/src/components/InputField/InputField.tsx +0 -72
  139. package/src/components/Link/Link.module.scss +0 -18
  140. package/src/components/Link/Link.stories.tsx +0 -17
  141. package/src/components/Loader/Loader.module.scss +0 -66
  142. package/src/components/Loader/Loader.spec.tsx +0 -64
  143. package/src/components/Loader/Loader.stories.tsx +0 -25
  144. package/src/components/Loader/Loader.tsx +0 -48
  145. package/src/components/Modal/ActionModal.tsx +0 -37
  146. package/src/components/Modal/Modal.module.scss +0 -131
  147. package/src/components/Modal/Modal.stories.tsx +0 -85
  148. package/src/components/Modal/Modal.tsx +0 -41
  149. package/src/components/Modal/ModalBase.spec.tsx +0 -58
  150. package/src/components/Modal/ModalBase.tsx +0 -66
  151. package/src/components/Modal/ModalCloseButton.tsx +0 -20
  152. package/src/components/Modal/ModalPortal.tsx +0 -35
  153. package/src/components/NumericInput/NumericInput.module.scss +0 -110
  154. package/src/components/NumericInput/NumericInput.spec.tsx +0 -129
  155. package/src/components/NumericInput/NumericInput.stories.tsx +0 -56
  156. package/src/components/NumericInput/NumericInput.tsx +0 -161
  157. package/src/components/NumericInput/NumericInputField.stories.tsx +0 -58
  158. package/src/components/NumericInput/NumericInputField.tsx +0 -57
  159. package/src/components/Popover/Popover.module.scss +0 -16
  160. package/src/components/Popover/Popover.spec.tsx +0 -39
  161. package/src/components/Popover/Popover.stories.css +0 -23
  162. package/src/components/Popover/Popover.stories.tsx +0 -164
  163. package/src/components/Popover/Popover.tsx +0 -124
  164. package/src/components/Progress/ProgressBar.module.scss +0 -48
  165. package/src/components/Progress/ProgressBar.spec.tsx +0 -33
  166. package/src/components/Progress/ProgressBar.stories.tsx +0 -23
  167. package/src/components/Progress/ProgressBar.tsx +0 -62
  168. package/src/components/Progress/ProgressCircle.module.scss +0 -64
  169. package/src/components/Progress/ProgressCircle.spec.tsx +0 -34
  170. package/src/components/Progress/ProgressCircle.stories.tsx +0 -28
  171. package/src/components/Progress/ProgressCircle.tsx +0 -104
  172. package/src/components/Progress/constants.ts +0 -23
  173. package/src/components/Progress/helpers.ts +0 -23
  174. package/src/components/PromoBanner/PromoBanner.module.scss +0 -121
  175. package/src/components/PromoBanner/PromoBanner.spec.tsx +0 -119
  176. package/src/components/PromoBanner/PromoBanner.stories.tsx +0 -125
  177. package/src/components/PromoBanner/PromoBanner.tsx +0 -99
  178. package/src/components/RadioButton/RadioButton.module.scss +0 -100
  179. package/src/components/RadioButton/RadioButton.spec.tsx +0 -70
  180. package/src/components/RadioButton/RadioButton.stories.tsx +0 -34
  181. package/src/components/RadioButton/RadioButton.tsx +0 -54
  182. package/src/components/Switch/Switch.module.scss +0 -126
  183. package/src/components/Switch/Switch.spec.tsx +0 -40
  184. package/src/components/Switch/Switch.stories.tsx +0 -23
  185. package/src/components/Switch/Switch.tsx +0 -100
  186. package/src/components/Tab/Tab.module.scss +0 -56
  187. package/src/components/Tab/Tab.spec.tsx +0 -34
  188. package/src/components/Tab/Tab.stories.tsx +0 -20
  189. package/src/components/Tab/Tab.tsx +0 -49
  190. package/src/components/Tab/TabsWrapper.module.scss +0 -11
  191. package/src/components/Tab/TabsWrapper.spec.tsx +0 -19
  192. package/src/components/Tab/TabsWrapper.stories.tsx +0 -46
  193. package/src/components/Tab/TabsWrapper.tsx +0 -24
  194. package/src/components/Tag/Tag.module.scss +0 -131
  195. package/src/components/Tag/Tag.spec.tsx +0 -93
  196. package/src/components/Tag/Tag.stories.tsx +0 -151
  197. package/src/components/Tag/Tag.tsx +0 -129
  198. package/src/components/TagInput/EditableTag.tsx +0 -54
  199. package/src/components/TagInput/EditableTagContent.tsx +0 -81
  200. package/src/components/TagInput/EmailTagInput.tsx +0 -31
  201. package/src/components/TagInput/TagInput.module.scss +0 -81
  202. package/src/components/TagInput/TagInput.spec.tsx +0 -58
  203. package/src/components/TagInput/TagInput.stories.tsx +0 -49
  204. package/src/components/TagInput/TagInput.tsx +0 -133
  205. package/src/components/TextField/TextField.module.scss +0 -90
  206. package/src/components/TextField/TextField.spec.tsx +0 -40
  207. package/src/components/TextField/TextField.stories.tsx +0 -60
  208. package/src/components/TextField/TextField.tsx +0 -100
  209. package/src/components/Toast/Toast.module.scss +0 -218
  210. package/src/components/Toast/Toast.spec.tsx +0 -96
  211. package/src/components/Toast/Toast.stories.tsx +0 -64
  212. package/src/components/Toast/Toast.tsx +0 -121
  213. package/src/components/Toast/ToastWrapper.spec.tsx +0 -13
  214. package/src/components/Toast/ToastWrapper.stories.tsx +0 -55
  215. package/src/components/Toast/ToastWrapper.tsx +0 -87
  216. package/src/components/Typography/Heading.tsx +0 -36
  217. package/src/components/Typography/Text.tsx +0 -49
  218. package/src/components/Typography/Typography.module.scss +0 -132
  219. package/src/index.scss +0 -9
  220. package/src/stories/ColorTokens.stories.mdx +0 -10
  221. package/src/stories/Icons.stories.mdx +0 -12
  222. package/src/stories/Typography.stories.mdx +0 -65
  223. package/src/stories/components/ColorTokens.tsx +0 -99
  224. package/src/stories/components/IconsShowcase.tsx +0 -25
  225. package/src/stories/components/iconsShowcase.css +0 -13
  226. package/src/test/setup.ts +0 -1
  227. package/src/test/utils.ts +0 -3
  228. package/src/themes/designTokens.ts +0 -126
  229. package/src/utils/keyCodes.ts +0 -12
  230. package/src/utils/noop.ts +0 -2
  231. package/tsconfig.json +0 -25
  232. package/tsconfig.node.json +0 -8
  233. package/vite.config.ts +0 -44
@@ -1,88 +0,0 @@
1
- .alert {
2
- box-sizing: border-box;
3
- overflow: hidden;
4
- padding: 20px;
5
- position: relative;
6
- width: 100%;
7
- word-break: break-word;
8
-
9
- &__content-text {
10
- color: var(--content-default);
11
- }
12
-
13
- &__content {
14
- display: flex;
15
- justify-content: flex-start;
16
- width: 100%;
17
- }
18
-
19
- &--small {
20
- max-width: 400px;
21
-
22
- .alert__content {
23
- flex-direction: column;
24
-
25
- &-text {
26
- margin: 14px 0 0;
27
- max-width: 246px;
28
- }
29
- }
30
- }
31
-
32
- &--medium {
33
- max-width: 800px;
34
-
35
- .alert__content {
36
- &-text {
37
- margin: 0 30px 0 16px;
38
- max-width: 640px;
39
- }
40
- }
41
- }
42
-
43
- &--large {
44
- .alert__content {
45
- &-text {
46
- margin: 0 30px 0 16px;
47
- max-width: 720px;
48
- }
49
- }
50
- }
51
-
52
- &__close-icon {
53
- background-color: transparent;
54
- border: 0;
55
- box-shadow: none;
56
- height: 24px;
57
- overflow: hidden;
58
- padding: 0;
59
- position: absolute;
60
- right: 12px;
61
- top: 12px;
62
- width: 24px;
63
- }
64
-
65
- &--info {
66
- background-color: var(--surface-feedback-info);
67
- box-shadow: inset 0 3px 0 0 var(--color-action-default);
68
- }
69
-
70
- &--warning {
71
- background-color: var(--surface-feedback-warning);
72
- box-shadow: inset 0 3px 0 0 var(--color-warning-default);
73
- }
74
-
75
- &--success {
76
- background-color: var(--surface-feedback-positive);
77
- box-shadow: inset 0 3px 0 0 var(--color-positive-default);
78
- }
79
-
80
- &--error {
81
- background-color: var(--surface-feedback-negative);
82
- box-shadow: inset 0 3px 0 0 var(--color-negative-default);
83
- }
84
-
85
- &__icon {
86
- flex-shrink: 0;
87
- }
88
- }
@@ -1,78 +0,0 @@
1
- import * as React from 'react';
2
- import { render, fireEvent, vi } from 'test-utils';
3
- import { Alert, AlertSize, AlertType, AlertProps } from './Alert';
4
-
5
- import styles from './Alert.module.scss';
6
-
7
- const renderComponent = (props: AlertProps) => {
8
- return render(
9
- <Alert {...props} className="my-css-class">
10
- This example content
11
- </Alert>
12
- );
13
- };
14
-
15
- describe('<Alert> component', () => {
16
- it('should allow for custom class', () => {
17
- const { container } = renderComponent({});
18
-
19
- expect(container.firstChild).toHaveClass('my-css-class');
20
- });
21
-
22
- it('should render as info by default', () => {
23
- const { container } = renderComponent({});
24
-
25
- expect(container.firstChild).toHaveClass(styles['alert--info']);
26
- });
27
-
28
- it('should render as warning', () => {
29
- const { container } = renderComponent({ type: AlertType.Warning });
30
-
31
- expect(container.firstChild).toHaveClass(styles['alert--warning']);
32
- });
33
-
34
- it('should render as success', () => {
35
- const { container } = renderComponent({ type: AlertType.Success });
36
-
37
- expect(container.firstChild).toHaveClass(styles['alert--success']);
38
- });
39
-
40
- it('should render as error', () => {
41
- const { container } = renderComponent({ type: AlertType.Error });
42
-
43
- expect(container.firstChild).toHaveClass(styles['alert--error']);
44
- });
45
-
46
- it('should render as small by default', () => {
47
- const { container } = renderComponent({});
48
-
49
- expect(container.firstChild).toHaveClass(styles['alert--small']);
50
- });
51
-
52
- it('should render as medium', () => {
53
- const { container } = renderComponent({ size: AlertSize.Medium });
54
-
55
- expect(container.firstChild).toHaveClass(styles['alert--medium']);
56
- });
57
-
58
- it('should render as large', () => {
59
- const { container } = renderComponent({ size: AlertSize.Large });
60
-
61
- expect(container.firstChild).toHaveClass(styles['alert--large']);
62
- });
63
-
64
- it('should render with close icon and call onClose function', () => {
65
- const mockedFunction = vi.fn();
66
- const { getByRole } = renderComponent({ onClose: mockedFunction });
67
-
68
- expect(getByRole('button')).toBeVisible();
69
- fireEvent.click(getByRole('button'));
70
- expect(mockedFunction).toHaveBeenCalled();
71
- });
72
-
73
- it('should not render with close icon if no onClose function passed', () => {
74
- const { queryByRole } = renderComponent({});
75
-
76
- expect(queryByRole('button')).toBeFalsy();
77
- });
78
- });
@@ -1,73 +0,0 @@
1
- import * as React from 'react';
2
- import { ComponentMeta, Story } from '@storybook/react';
3
-
4
- import {
5
- Alert as AlertComponent,
6
- AlertSize,
7
- AlertType,
8
- AlertProps,
9
- } from './Alert';
10
-
11
- export default {
12
- title: 'Components/Alert',
13
- component: AlertComponent,
14
- parameters: {
15
- componentSubtitle: `
16
- Alert banners are used to let users know about important
17
- informations that require immediate action or attention.
18
- `,
19
- },
20
- argTypes: { onClose: { defaultValue: null } },
21
- } as ComponentMeta<typeof AlertComponent>;
22
-
23
- const StoryTemplate: Story<AlertProps> = (args: AlertProps) => (
24
- <div>
25
- <AlertComponent {...args}>
26
- A description with a <b>maximum of 100 characters</b>. That usually means
27
- only one or two sentences.
28
- </AlertComponent>
29
- </div>
30
- );
31
-
32
- export const Alert = StoryTemplate.bind({});
33
- Alert.args = {};
34
-
35
- export const InfoAlert = StoryTemplate.bind({});
36
- InfoAlert.args = {
37
- type: AlertType.Info,
38
- };
39
-
40
- export const WarningAlert = StoryTemplate.bind({});
41
- WarningAlert.args = {
42
- type: AlertType.Warning,
43
- };
44
-
45
- export const SuccessAlert = StoryTemplate.bind({});
46
- SuccessAlert.args = {
47
- type: AlertType.Success,
48
- };
49
-
50
- export const ErrorAlert = StoryTemplate.bind({});
51
- ErrorAlert.args = {
52
- type: AlertType.Error,
53
- };
54
-
55
- export const BannerWithClose = StoryTemplate.bind({});
56
- BannerWithClose.args = {
57
- onClose: () => alert('onClose click'),
58
- };
59
-
60
- export const SmallAlert = StoryTemplate.bind({});
61
- SmallAlert.args = {
62
- size: AlertSize.Small,
63
- };
64
-
65
- export const MediumBanner = StoryTemplate.bind({});
66
- MediumBanner.args = {
67
- size: AlertSize.Medium,
68
- };
69
-
70
- export const LargeAlert = StoryTemplate.bind({});
71
- LargeAlert.args = {
72
- size: AlertSize.Large,
73
- };
@@ -1,94 +0,0 @@
1
- import * as React from 'react';
2
- import cx from 'clsx';
3
- import {
4
- Close as CloseIcon,
5
- Warning as WarningIcon,
6
- Info as InfoIcon,
7
- Block as BlockIcon,
8
- CheckCircleSolid as CheckIcon,
9
- } from '@livechat/design-system-icons/react/material';
10
-
11
- import { Text } from '../Typography';
12
- import { Icon, IconSizeName, IconTypeName } from '../Icon';
13
-
14
- import styles from './Alert.module.scss';
15
-
16
- export enum AlertSize {
17
- Small = 'small',
18
- Medium = 'medium',
19
- Large = 'large',
20
- }
21
-
22
- export enum AlertType {
23
- Info = 'info',
24
- Warning = 'warning',
25
- Success = 'success',
26
- Error = 'error',
27
- }
28
-
29
- export interface AlertProps {
30
- className?: string;
31
- size?: AlertSize;
32
- type?: AlertType;
33
- onClose?: () => void;
34
- }
35
-
36
- const IconConfig = {
37
- [AlertType.Info]: {
38
- source: InfoIcon,
39
- iconType: IconTypeName.Link,
40
- },
41
- [AlertType.Warning]: {
42
- source: WarningIcon,
43
- iconType: IconTypeName.Warning,
44
- },
45
- [AlertType.Success]: {
46
- source: CheckIcon,
47
- iconType: IconTypeName.Success,
48
- },
49
- [AlertType.Error]: {
50
- source: BlockIcon,
51
- iconType: IconTypeName.Error,
52
- },
53
- };
54
-
55
- const baseClass = 'alert';
56
-
57
- export const Alert: React.FC<AlertProps> = ({
58
- children,
59
- className,
60
- size = AlertSize.Small,
61
- type = AlertType.Info,
62
- onClose,
63
- }) => {
64
- const mergedClassNames = cx(
65
- styles[baseClass],
66
- styles[`${baseClass}--${type}`],
67
- styles[`${baseClass}--${size}`],
68
- className
69
- );
70
-
71
- return (
72
- <div className={mergedClassNames}>
73
- <div className={styles[`${baseClass}__content`]}>
74
- <Icon {...IconConfig[type]} />
75
- <Text as="div" className={styles[`${baseClass}__content-text`]}>
76
- {children}
77
- </Text>
78
- </div>
79
- {onClose && (
80
- <button
81
- type="button"
82
- className={styles[`${baseClass}__close-icon`]}
83
- onClick={onClose}
84
- >
85
- <Icon
86
- source={CloseIcon}
87
- size={IconSizeName.Large}
88
- iconType={IconTypeName.Primary}
89
- />
90
- </button>
91
- )}
92
- </div>
93
- );
94
- };
@@ -1,23 +0,0 @@
1
- .badge {
2
- background-color: var(--color-negative-default);
3
- border-radius: 18px;
4
- box-sizing: border-box;
5
- color: var(--content-invert-default);
6
- display: inline-block;
7
- font-size: 10px;
8
- font-weight: 600;
9
- height: 18px;
10
- line-height: 18px;
11
- min-width: 18px;
12
- padding: 0 3px;
13
- text-align: center;
14
-
15
- & + & {
16
- margin-left: 4px;
17
- }
18
-
19
- &--secondary {
20
- background-color: var(--surface-secondary-default);
21
- color: var(--surface-invert-default);
22
- }
23
- }
@@ -1,12 +0,0 @@
1
- import * as React from 'react';
2
- import { render } from 'test-utils';
3
-
4
- import { Badge } from './Badge';
5
-
6
- describe('Badge', () => {
7
- it('should accept custom className', () => {
8
- const { container } = render(<Badge className="my-custom-class" />);
9
-
10
- expect(container.firstChild).toHaveClass('my-custom-class');
11
- });
12
- });
@@ -1,24 +0,0 @@
1
- import * as React from 'react';
2
- import { Badge as BadgeComponent, BadgeProps } from './Badge';
3
-
4
- export default {
5
- title: 'Components/Badge',
6
- component: BadgeComponent,
7
- };
8
-
9
- export const Badge = (args: BadgeProps): React.ReactElement => (
10
- <div
11
- style={{
12
- display: 'inline-flex',
13
- alignItems: 'center',
14
- alignContent: 'center',
15
- }}
16
- >
17
- <BadgeComponent {...args} />
18
- </div>
19
- );
20
-
21
- Badge.args = {
22
- secondary: false,
23
- children: '7',
24
- };
@@ -1,24 +0,0 @@
1
- import * as React from 'react';
2
-
3
- import styles from './Badge.module.scss';
4
- import cx from 'clsx';
5
-
6
- export interface BadgeProps extends React.HTMLAttributes<HTMLDivElement> {
7
- secondary?: boolean;
8
- }
9
-
10
- export const Badge: React.FC<BadgeProps> = ({
11
- children,
12
- className,
13
- secondary = false,
14
- }) => {
15
- return (
16
- <span
17
- className={cx(styles.badge, className, {
18
- [styles['badge--secondary']]: secondary,
19
- })}
20
- >
21
- {children}
22
- </span>
23
- );
24
- };
@@ -1,257 +0,0 @@
1
- $base-class: 'btn';
2
-
3
- .#{$base-class} {
4
- align-items: center;
5
- border-radius: 4px;
6
- border-style: solid;
7
- border-width: 1px;
8
- cursor: pointer;
9
- display: inline-flex;
10
- font-size: 15px;
11
- font-weight: 600;
12
- height: 36px;
13
- justify-content: center;
14
- min-width: 36px;
15
- padding: 8px 16px;
16
- position: relative;
17
- text-align: center;
18
- text-decoration: none;
19
- transition-duration: 200ms;
20
- transition-property: opacity, border, color, background-color, box-shadow;
21
- transition-timing-function: cubic-bezier(0.64, 0, 0.35, 1);
22
- user-select: none;
23
-
24
- &:focus,
25
- &:hover,
26
- &:active {
27
- outline: 0;
28
- }
29
-
30
- &:focus {
31
- box-shadow: 0 0 1px 2px rgba(var(--color-action-default-rgb), 0.7);
32
- }
33
-
34
- &--disabled {
35
- cursor: not-allowed;
36
- }
37
-
38
- &--icon-only {
39
- padding: 6px;
40
-
41
- .#{$base-class}__icon--left,
42
- .#{$base-class}__icon--right {
43
- margin: 0;
44
- }
45
- }
46
-
47
- &--full-width {
48
- width: 100%;
49
- }
50
-
51
- &--basic {
52
- background-color: var(--surface-basic-default);
53
- border-color: var(--color-action-default);
54
- color: var(--color-action-default);
55
-
56
- &:hover {
57
- background-color: var(--surface-basic-subtle);
58
- color: var(--color-action-hover);
59
- }
60
-
61
- &:active {
62
- background-color: var(--surface-feedback-info);
63
- color: var(--color-action-hover);
64
- }
65
-
66
- &[disabled] {
67
- background-color: inherit;
68
- border-color: var(--color-action-disabled);
69
- color: var(--color-action-disabled);
70
- }
71
- }
72
-
73
- &--primary {
74
- background-color: var(--color-action-default);
75
- border-color: var(--color-action-default);
76
- color: var(--content-invert-default);
77
-
78
- &:hover {
79
- background-color: var(--color-action-hover);
80
- border-color: var(--color-action-hover);
81
- }
82
-
83
- &:active {
84
- background-color: var(--color-action-active);
85
- border-color: var(--color-action-active);
86
- }
87
-
88
- &[disabled] {
89
- background-color: var(--color-action-disabled);
90
- border-color: var(--color-action-disabled);
91
- }
92
- }
93
-
94
- &--secondary {
95
- background-color: var(--surface-basic-default);
96
- border-color: var(--surface-secondary-default);
97
- color: var(--content-default);
98
-
99
- &:hover {
100
- background-color: var(--surface-basic-hover);
101
- border-color: var(--surface-secondary-hover);
102
- }
103
-
104
- &:active {
105
- background-color: var(--surface-feedback-info);
106
- border-color: var(--color-action-default);
107
- color: var(--color-action-default);
108
- }
109
-
110
- &[disabled] {
111
- background-color: inherit;
112
- border-color: var(--border-disabled);
113
- color: var(--content-disabled);
114
- }
115
- }
116
-
117
- &--destructive {
118
- background-color: var(--color-negative-default);
119
- border-color: var(--color-negative-default);
120
- color: var(--content-invert-default);
121
-
122
- &:hover {
123
- background-color: var(--color-negative-hover);
124
- border-color: var(--color-negative-hover);
125
- }
126
-
127
- &:active {
128
- background-color: var(--color-negative-active);
129
- border-color: var(--color-negative-active);
130
- }
131
-
132
- &[disabled] {
133
- background-color: var(--color-negative-disabled);
134
- border-color: var(--color-negative-disabled);
135
- }
136
- }
137
-
138
- &--compact {
139
- height: 32px;
140
- min-width: 32px;
141
- padding: 6px 16px;
142
-
143
- &.#{$base-class}--icon-only {
144
- padding: 4px;
145
- }
146
- }
147
-
148
- &--large {
149
- height: 42px;
150
- min-width: 42px;
151
- padding: 11px 16px;
152
-
153
- &.#{$base-class}--icon-only {
154
- padding: 9px;
155
- }
156
- }
157
-
158
- &--text,
159
- &--plain,
160
- &--plain-light {
161
- background-color: transparent;
162
- border-color: transparent;
163
- color: var(--color-action-default);
164
-
165
- &:hover {
166
- color: var(--color-action-hover);
167
- }
168
-
169
- &[disabled] {
170
- color: var(--color-action-disabled);
171
- }
172
- }
173
-
174
- &--plain-light {
175
- font-weight: 400;
176
- }
177
-
178
- &--plain {
179
- font-weight: 600;
180
- }
181
-
182
- &--plain,
183
- &--plain-light {
184
- border: 0;
185
- height: auto;
186
- min-width: auto;
187
- padding: 0;
188
-
189
- &:hover,
190
- &:focus {
191
- box-shadow: none;
192
- text-decoration: underline;
193
- }
194
-
195
- &:disabled {
196
- text-decoration: none;
197
- }
198
- }
199
-
200
- &--loading {
201
- cursor: progress;
202
- transition: all 0.2s cubic-bezier(0.64, 0, 0.35, 1);
203
-
204
- > * {
205
- opacity: 0;
206
- }
207
-
208
- .#{$base-class}__loader {
209
- align-items: center;
210
- box-sizing: border-box;
211
- display: flex;
212
- height: 100%;
213
- justify-content: center;
214
- left: 0;
215
- opacity: 1;
216
- padding: inherit;
217
- position: absolute;
218
- top: 0;
219
- width: 100%;
220
-
221
- > * {
222
- color: inherit;
223
- font-weight: inherit;
224
- margin: 0 5px;
225
- overflow: hidden;
226
- text-align: left;
227
- text-overflow: ellipsis;
228
- white-space: nowrap;
229
- }
230
- }
231
- }
232
-
233
- // TODO: Investigate
234
- &__content {
235
- margin-top: -2px;
236
- }
237
-
238
- &__icon {
239
- color: inherit;
240
- display: inline-block;
241
- height: 20px;
242
- line-height: 1;
243
- width: 20px;
244
-
245
- &--left {
246
- margin-left: -4px;
247
- margin-right: 5px;
248
- order: -1;
249
- }
250
-
251
- &--right {
252
- margin-left: 5px;
253
- margin-right: -4px;
254
- order: 1;
255
- }
256
- }
257
- }