@kvell-group/ui 1.14.2 → 1.15.1

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 (141) hide show
  1. package/package.json +4 -7
  2. package/src/assets/arrow-left.svg +3 -0
  3. package/src/assets/calendar.svg +3 -0
  4. package/src/assets/card-logos/maestro.svg +8 -0
  5. package/src/assets/card-logos/mastercard.svg +5 -0
  6. package/src/assets/card-logos/mir.svg +10 -0
  7. package/src/assets/card-logos/unionpay.svg +4 -0
  8. package/src/assets/card-logos/visa-electron.svg +12 -0
  9. package/src/assets/card-logos/visa.svg +4 -0
  10. package/src/assets/error.svg +3 -0
  11. package/src/assets/fonts/password.woff2 +0 -0
  12. package/src/assets/lead-icon.svg +3 -0
  13. package/src/components/Button/Button.module.css +50 -0
  14. package/src/components/Button/Button.stories.tsx +90 -0
  15. package/src/components/Button/Button.tsx +25 -0
  16. package/src/components/Button/constants.ts +17 -0
  17. package/src/components/Button/index.ts +1 -0
  18. package/src/components/Button/types.ts +8 -0
  19. package/src/components/Inputs/CardInput/CardInput.stories.tsx +42 -0
  20. package/src/components/Inputs/CardInput/CardInput.tsx +28 -0
  21. package/src/components/Inputs/CardInput/index.ts +1 -0
  22. package/src/components/Inputs/CardInput/useCardLogo.ts +88 -0
  23. package/src/components/Inputs/CvvInput/CvvInput.module.css +12 -0
  24. package/src/components/Inputs/CvvInput/CvvInput.stories.tsx +42 -0
  25. package/src/components/Inputs/CvvInput/CvvInput.tsx +27 -0
  26. package/src/components/Inputs/CvvInput/index.ts +1 -0
  27. package/src/components/Inputs/Input.module.css +38 -0
  28. package/src/components/Inputs/Input.stories.tsx +44 -0
  29. package/src/components/Inputs/Input.tsx +20 -0
  30. package/src/components/Inputs/MaskedInput/MaskedInput.stories.tsx +58 -0
  31. package/src/components/Inputs/MaskedInput/MaskedInput.tsx +16 -0
  32. package/src/components/Inputs/MaskedInput/index.ts +1 -0
  33. package/src/components/Inputs/PasswordInput/PasswordInput.module.css +3 -0
  34. package/src/components/Inputs/PasswordInput/PasswordInput.stories.tsx +42 -0
  35. package/src/components/Inputs/PasswordInput/PasswordInput.tsx +26 -0
  36. package/src/components/Inputs/PasswordInput/index.ts +1 -0
  37. package/src/components/Inputs/index.ts +1 -0
  38. package/src/components/Inputs/types.ts +6 -0
  39. package/src/components/Loader/Loader.module.css +46 -0
  40. package/src/components/Loader/Loader.stories.tsx +39 -0
  41. package/src/components/Loader/Loader.tsx +36 -0
  42. package/src/components/Loader/constants.ts +8 -0
  43. package/src/components/Loader/index.ts +1 -0
  44. package/src/components/MainProvider/MantineProvider.tsx +15 -0
  45. package/src/components/MainProvider/index.ts +1 -0
  46. package/src/components/Modal/Modal.module.css +43 -0
  47. package/src/components/Modal/Modal.stories.tsx +83 -0
  48. package/src/components/Modal/Modal.tsx +10 -0
  49. package/src/components/Modal/index.ts +1 -0
  50. package/src/components/Switch/Switch.module.css +28 -0
  51. package/src/components/Switch/Switch.stories.tsx +39 -0
  52. package/src/components/Switch/Switch.tsx +19 -0
  53. package/src/components/Switch/index.tsx +1 -0
  54. package/src/components/Text/Text.stories.tsx +40 -0
  55. package/src/components/Text/Text.tsx +21 -0
  56. package/src/components/Text/index.ts +1 -0
  57. package/src/components/Text/types.ts +8 -0
  58. package/src/components/theme.ts +180 -0
  59. package/src/constants/font-variants.ts +31 -0
  60. package/src/constants/masks.ts +7 -0
  61. package/src/index.ts +17 -0
  62. package/src/styles/typography.module.css +76 -0
  63. package/src/vite-env.d.ts +2 -0
  64. package/dist/Input.module-CPh0cNNI.js +0 -9
  65. package/dist/assets/Button.css +0 -1
  66. package/dist/assets/CvvInput.css +0 -1
  67. package/dist/assets/Input.css +0 -1
  68. package/dist/assets/Loader.css +0 -1
  69. package/dist/assets/Modal.css +0 -1
  70. package/dist/assets/PasswordInput.css +0 -1
  71. package/dist/assets/Switch.css +0 -1
  72. package/dist/assets/typography.css +0 -1
  73. package/dist/clsx-OuTLNxxd.js +0 -16
  74. package/dist/components/Button/Button.d.ts +0 -19
  75. package/dist/components/Button/Button.js +0 -24
  76. package/dist/components/Button/constants.d.ts +0 -8
  77. package/dist/components/Button/constants.js +0 -15
  78. package/dist/components/Button/index.d.ts +0 -1
  79. package/dist/components/Button/index.js +0 -4
  80. package/dist/components/Button/types.d.ts +0 -5
  81. package/dist/components/Button/types.js +0 -1
  82. package/dist/components/Inputs/CardInput/CardInput.d.ts +0 -2
  83. package/dist/components/Inputs/CardInput/CardInput.js +0 -28
  84. package/dist/components/Inputs/CardInput/index.d.ts +0 -1
  85. package/dist/components/Inputs/CardInput/index.js +0 -4
  86. package/dist/components/Inputs/CardInput/useCardLogo.d.ts +0 -1
  87. package/dist/components/Inputs/CardInput/useCardLogo.js +0 -49
  88. package/dist/components/Inputs/CardInputTest.d.ts +0 -2
  89. package/dist/components/Inputs/CardInputTest.js +0 -23
  90. package/dist/components/Inputs/CvvInput/CvvInput.d.ts +0 -2
  91. package/dist/components/Inputs/CvvInput/CvvInput.js +0 -21
  92. package/dist/components/Inputs/CvvInput/index.d.ts +0 -1
  93. package/dist/components/Inputs/CvvInput/index.js +0 -4
  94. package/dist/components/Inputs/Input.d.ts +0 -4
  95. package/dist/components/Inputs/Input.js +0 -11
  96. package/dist/components/Inputs/MaskedInput/MaskedInput.d.ts +0 -2
  97. package/dist/components/Inputs/MaskedInput/MaskedInput.js +0 -15
  98. package/dist/components/Inputs/MaskedInput/index.d.ts +0 -1
  99. package/dist/components/Inputs/MaskedInput/index.js +0 -4
  100. package/dist/components/Inputs/PasswordInput/PasswordInput.d.ts +0 -4
  101. package/dist/components/Inputs/PasswordInput/PasswordInput.js +0 -18
  102. package/dist/components/Inputs/PasswordInput/index.d.ts +0 -1
  103. package/dist/components/Inputs/PasswordInput/index.js +0 -4
  104. package/dist/components/Inputs/index.d.ts +0 -1
  105. package/dist/components/Inputs/index.js +0 -4
  106. package/dist/components/Inputs/types.d.ts +0 -3
  107. package/dist/components/Inputs/types.js +0 -1
  108. package/dist/components/Loader/Loader.d.ts +0 -7
  109. package/dist/components/Loader/Loader.js +0 -25
  110. package/dist/components/Loader/constants.d.ts +0 -5
  111. package/dist/components/Loader/constants.js +0 -8
  112. package/dist/components/Loader/index.d.ts +0 -1
  113. package/dist/components/Loader/index.js +0 -4
  114. package/dist/components/MainProvider/MantineProvider.d.ts +0 -2
  115. package/dist/components/MainProvider/MantineProvider.js +0 -15
  116. package/dist/components/MainProvider/index.d.ts +0 -1
  117. package/dist/components/MainProvider/index.js +0 -4
  118. package/dist/components/Modal/Modal.d.ts +0 -4
  119. package/dist/components/Modal/Modal.js +0 -15
  120. package/dist/components/Modal/index.d.ts +0 -1
  121. package/dist/components/Modal/index.js +0 -4
  122. package/dist/components/Switch/Switch.d.ts +0 -4
  123. package/dist/components/Switch/Switch.js +0 -18
  124. package/dist/components/Switch/index.d.ts +0 -1
  125. package/dist/components/Switch/index.js +0 -4
  126. package/dist/components/Text/Text.d.ts +0 -7
  127. package/dist/components/Text/Text.js +0 -15
  128. package/dist/components/Text/index.d.ts +0 -1
  129. package/dist/components/Text/index.js +0 -4
  130. package/dist/components/Text/types.d.ts +0 -5
  131. package/dist/components/Text/types.js +0 -1
  132. package/dist/components/theme.d.ts +0 -2
  133. package/dist/components/theme.js +0 -184
  134. package/dist/constants/font-variants.d.ts +0 -10
  135. package/dist/constants/font-variants.js +0 -26
  136. package/dist/constants/masks.d.ts +0 -4
  137. package/dist/constants/masks.js +0 -7
  138. package/dist/main.d.ts +0 -14
  139. package/dist/main.js +0 -31
  140. package/dist/typography.module-krUfTmwf.js +0 -14
  141. /package/{dist → src}/assets/card.svg +0 -0
@@ -0,0 +1,44 @@
1
+ import type { Meta, StoryObj } from '@storybook/react'
2
+
3
+ import { MantineProvider } from '@/components/MainProvider'
4
+
5
+ import '@mantine/core/styles.css'
6
+ import { theme } from '@/components/theme'
7
+ import { Input as InputComponent } from '@/components/Inputs/Input'
8
+
9
+ // ----------------------------------------------------------------------
10
+
11
+ const meta = {
12
+ title: 'Components/Inputs/Input',
13
+ component: InputComponent,
14
+ decorators: (Story) => (
15
+ <MantineProvider theme={theme}>
16
+ <div style={{ maxWidth: '465px' }}>
17
+ <Story />
18
+ </div>
19
+ </MantineProvider>
20
+ ),
21
+ } satisfies Meta<typeof InputComponent>
22
+
23
+ type Story = StoryObj<typeof InputComponent>
24
+
25
+ // ----------------------------------------------------------------------
26
+
27
+ export const Input: Story = {
28
+ args: {
29
+ placeholder: 'IVAN IVANOV',
30
+ label: 'Имя на карте',
31
+ },
32
+ }
33
+
34
+ export const InputError: Story = {
35
+ args: {
36
+ placeholder: 'IVAN IVANOV',
37
+ label: 'Имя на карте',
38
+ error: 'Неправильный формат имени',
39
+ },
40
+ }
41
+
42
+ // ----------------------------------------------------------------------
43
+
44
+ export default meta
@@ -0,0 +1,20 @@
1
+ import { TextInput } from '@mantine/core'
2
+ import classNames from './Input.module.css'
3
+ import textClassNames from '../../styles/typography.module.css'
4
+ import clsx from 'clsx'
5
+ import { CAPTION_L_REGULAR_FONT_VARIANT } from '../../constants/font-variants'
6
+
7
+ // ----------------------------------------------------------------------
8
+
9
+ const { input, error, ...restClassNames } = classNames
10
+
11
+ const captionLRegular = textClassNames[CAPTION_L_REGULAR_FONT_VARIANT]
12
+
13
+ const inputClassNames = clsx(input, captionLRegular)
14
+ const errorClassNames = clsx(error, captionLRegular)
15
+
16
+ // ----------------------------------------------------------------------
17
+
18
+ export const Input = TextInput.withProps({
19
+ classNames: { ...restClassNames, input: inputClassNames, error: errorClassNames },
20
+ })
@@ -0,0 +1,58 @@
1
+ import type { Meta, StoryObj } from '@storybook/react'
2
+
3
+ import { MantineProvider } from '@/components/MainProvider'
4
+
5
+ import '@mantine/core/styles.css'
6
+ import { theme } from '@/components/theme'
7
+ import { MaskedInput as MaskedInputComponent } from '@/components/Inputs/MaskedInput'
8
+ import CalendarSVG from '@/assets/calendar.svg'
9
+ import { CARD_EXPIRY_DATE_MASK, PHONE_MASK } from '@/constants/masks'
10
+
11
+ // ----------------------------------------------------------------------
12
+
13
+ const meta = {
14
+ title: 'Components/Inputs/MaskedInput',
15
+ component: MaskedInputComponent,
16
+ decorators: (Story) => (
17
+ <MantineProvider theme={theme}>
18
+ <div style={{ maxWidth: '304px' }}>
19
+ <Story />
20
+ </div>
21
+ </MantineProvider>
22
+ ),
23
+ } satisfies Meta<typeof MaskedInputComponent>
24
+
25
+ type Story = StoryObj<typeof MaskedInputComponent>
26
+
27
+ // ----------------------------------------------------------------------
28
+
29
+ export const MaskedInput: Story = {
30
+ args: {
31
+ mask: PHONE_MASK,
32
+ value: '77777777777',
33
+ label: 'Номер телефона',
34
+ },
35
+ }
36
+
37
+ export const MaskedInputExpiryDate: Story = {
38
+ args: {
39
+ leftSection: <CalendarSVG />,
40
+ mask: CARD_EXPIRY_DATE_MASK,
41
+ value: '1225',
42
+ label: 'Срок действия',
43
+ },
44
+ }
45
+
46
+ export const MaskedInputExpiryDateError: Story = {
47
+ args: {
48
+ leftSection: <CalendarSVG />,
49
+ mask: CARD_EXPIRY_DATE_MASK,
50
+ value: '0120',
51
+ label: 'Срок действия',
52
+ error: 'Срок действия карты истёк',
53
+ },
54
+ }
55
+
56
+ // ----------------------------------------------------------------------
57
+
58
+ export default meta
@@ -0,0 +1,16 @@
1
+ import { IMaskInput } from 'react-imask'
2
+ import { Input } from '../Input'
3
+ import { forwardRef } from 'react'
4
+ import type { MaskedInputProps } from '../types'
5
+
6
+ // ----------------------------------------------------------------------
7
+
8
+ export const MaskedInput = forwardRef<HTMLInputElement, MaskedInputProps>((props, ref) => {
9
+ return (
10
+ <Input
11
+ ref={ref}
12
+ component={IMaskInput}
13
+ {...props}
14
+ />
15
+ )
16
+ })
@@ -0,0 +1 @@
1
+ export { MaskedInput } from './MaskedInput'
@@ -0,0 +1,3 @@
1
+ .section[data-position='right'] {
2
+ margin-right: 0;
3
+ }
@@ -0,0 +1,42 @@
1
+ import type { Meta, StoryObj } from '@storybook/react'
2
+
3
+ import { MantineProvider } from '@/components/MainProvider'
4
+
5
+ import '@mantine/core/styles.css'
6
+ import { theme } from '@/components/theme'
7
+ import { PasswordInput as PasswordInputComponent } from '@/components/Inputs/PasswordInput/PasswordInput'
8
+
9
+ // ----------------------------------------------------------------------
10
+
11
+ const meta = {
12
+ title: 'Components/Inputs/PasswordInput',
13
+ component: PasswordInputComponent,
14
+ decorators: (Story) => (
15
+ <MantineProvider theme={theme}>
16
+ <div style={{ maxWidth: '465px' }}>
17
+ <Story />
18
+ </div>
19
+ </MantineProvider>
20
+ ),
21
+ } satisfies Meta<typeof PasswordInputComponent>
22
+
23
+ type Story = StoryObj<typeof PasswordInputComponent>
24
+
25
+ // ----------------------------------------------------------------------
26
+
27
+ export const PasswordInput: Story = {
28
+ args: {
29
+ label: 'Введите пароль',
30
+ },
31
+ }
32
+
33
+ export const PasswordInputError: Story = {
34
+ args: {
35
+ label: 'Введите пароль',
36
+ error: 'Неверный пароль',
37
+ },
38
+ }
39
+
40
+ // ----------------------------------------------------------------------
41
+
42
+ export default meta
@@ -0,0 +1,26 @@
1
+ import { PasswordInput as PasswordInputBase } from '@mantine/core'
2
+ import classNames from '../Input.module.css'
3
+ import sectionClassNames from './PasswordInput.module.css'
4
+ import textClassNames from '../../../styles/typography.module.css'
5
+ import clsx from 'clsx'
6
+ import { CAPTION_L_REGULAR_FONT_VARIANT } from '../../../constants/font-variants'
7
+
8
+ // ----------------------------------------------------------------------
9
+
10
+ const { input, error, ...restClassNames } = classNames
11
+
12
+ const captionLRegular = textClassNames[CAPTION_L_REGULAR_FONT_VARIANT]
13
+
14
+ const inputClassNames = clsx(input, captionLRegular)
15
+ const errorClassNames = clsx(error, captionLRegular)
16
+
17
+ // ----------------------------------------------------------------------
18
+
19
+ export const PasswordInput = PasswordInputBase.withProps({
20
+ classNames: {
21
+ ...restClassNames,
22
+ input: inputClassNames,
23
+ error: errorClassNames,
24
+ section: sectionClassNames.section,
25
+ },
26
+ })
@@ -0,0 +1 @@
1
+ export { PasswordInput } from './PasswordInput'
@@ -0,0 +1 @@
1
+ export { Input } from './Input'
@@ -0,0 +1,6 @@
1
+ import type { TextInputProps } from '@mantine/core'
2
+ import type { IMaskInputProps } from 'react-imask'
3
+
4
+ // ----------------------------------------------------------------------
5
+
6
+ export type MaskedInputProps = IMaskInputProps<HTMLInputElement> & TextInputProps
@@ -0,0 +1,46 @@
1
+ .container {
2
+ position: relative;
3
+ display: inline-block;
4
+
5
+ &[data-size='auto'] {
6
+ width: 100%;
7
+ height: 100%;
8
+ }
9
+
10
+ &[data-size='sm'] {
11
+ width: 1.5rem;
12
+ height: 1.5rem;
13
+ }
14
+
15
+ &[data-size='md'] {
16
+ width: 2rem;
17
+ height: 2rem;
18
+ }
19
+
20
+ &[data-size='lg'] {
21
+ width: 4rem;
22
+ height: 4rem;
23
+ }
24
+ }
25
+
26
+ .part {
27
+ position: absolute;
28
+ left: 45%;
29
+ top: 36%;
30
+ width: 8%;
31
+ height: 26%;
32
+ background: var(--mantine-color-typography-secondary-0);
33
+ opacity: 0;
34
+ border-radius: 3rem;
35
+ box-shadow: 0 0 3px rgba(0, 0, 0, 0.2);
36
+ animation: fade 1s linear infinite;
37
+ }
38
+
39
+ @keyframes fade {
40
+ from {
41
+ opacity: 1;
42
+ }
43
+ to {
44
+ opacity: 0.25;
45
+ }
46
+ }
@@ -0,0 +1,39 @@
1
+ import type { Meta, StoryObj } from '@storybook/react'
2
+
3
+ import { MantineProvider } from '@/components/MainProvider'
4
+
5
+ import '@mantine/core/styles.css'
6
+ import { theme } from '@/components/theme'
7
+ import { Loader } from '@/components/Loader'
8
+ import { LoaderSizes } from '@/components/Loader/constants'
9
+
10
+ // ----------------------------------------------------------------------
11
+
12
+ const meta = {
13
+ title: 'Components/Loader',
14
+ component: Loader,
15
+ decorators: (Story) => (
16
+ <MantineProvider theme={theme}>
17
+ <div style={{ width: '120px', height: '120px', backgroundColor: 'whitesmoke' }}>
18
+ <Story />
19
+ </div>
20
+ </MantineProvider>
21
+ ),
22
+ } satisfies Meta<typeof Loader>
23
+
24
+ type Story = StoryObj<typeof meta>
25
+
26
+ // ----------------------------------------------------------------------
27
+
28
+ export const ComponentLoader: Story = {
29
+ argTypes: {
30
+ size: {
31
+ control: 'select',
32
+ options: LoaderSizes,
33
+ },
34
+ },
35
+ }
36
+
37
+ // ----------------------------------------------------------------------
38
+
39
+ export default meta
@@ -0,0 +1,36 @@
1
+ import { LoaderSizes } from './constants'
2
+ import classnames from './Loader.module.css'
3
+
4
+ // ----------------------------------------------------------------------
5
+
6
+ type LoaderSizesTypes = typeof LoaderSizes
7
+
8
+ // ----------------------------------------------------------------------
9
+
10
+ const calculateStyle = (i: number): React.CSSProperties => ({
11
+ transform: `rotate(${(i * 360) / 8}deg) translate(0, -130%)`,
12
+ animationDelay: `${-(8 - i) * 0.125}s`,
13
+ })
14
+
15
+ // ----------------------------------------------------------------------
16
+
17
+ type LoaderProps = {
18
+ size?: LoaderSizesTypes[number]
19
+ }
20
+
21
+ export const Loader = ({ size = 'auto' }: LoaderProps) => (
22
+ <div
23
+ className={classnames.container}
24
+ data-size={size}
25
+ >
26
+ {Array(8)
27
+ .fill(0)
28
+ .map((_, index) => (
29
+ <div
30
+ className={classnames.part}
31
+ key={index}
32
+ style={calculateStyle(index)}
33
+ />
34
+ ))}
35
+ </div>
36
+ )
@@ -0,0 +1,8 @@
1
+ export const LOADER_SIZE_AUTO = 'auto'
2
+ export const LOADER_SIZE_SM = 'sm'
3
+ export const LOADER_SIZE_MD = 'md'
4
+ export const LOADER_SIZE_LG = 'lg'
5
+
6
+ // ----------------------------------------------------------------------
7
+
8
+ export const LoaderSizes = [LOADER_SIZE_AUTO, LOADER_SIZE_SM, LOADER_SIZE_MD, LOADER_SIZE_LG]
@@ -0,0 +1 @@
1
+ export { Loader } from './Loader'
@@ -0,0 +1,15 @@
1
+ import { MantineProvider as MantineProviderCore } from '@mantine/core'
2
+ import type { MantineProviderProps } from '@mantine/core'
3
+
4
+ // ----------------------------------------------------------------------
5
+
6
+ export function MantineProvider({ children, theme, ...restProps }: MantineProviderProps) {
7
+ return (
8
+ <MantineProviderCore
9
+ theme={theme}
10
+ {...restProps}
11
+ >
12
+ {children}
13
+ </MantineProviderCore>
14
+ )
15
+ }
@@ -0,0 +1 @@
1
+ export { MantineProvider } from './MantineProvider'
@@ -0,0 +1,43 @@
1
+ .root {
2
+ box-shadow: var(--mantine-shadows-lg);
3
+ width: 100%;
4
+ }
5
+
6
+ .content {
7
+ border-radius: var(--mantine-radius-xl);
8
+ border: 1px solid var(--mantine-color-border-action-normal-0);
9
+ white-space: pre-wrap;
10
+ padding: 0.5rem;
11
+
12
+ @media (max-width: $mantine-breakpoint-xs) {
13
+ width: 100%;
14
+ border-radius: var(--mantine-radius-xl) var(--mantine-radius-xl) 0 0;
15
+ }
16
+ }
17
+
18
+ .header {
19
+ padding-bottom: 0.25rem;
20
+ }
21
+
22
+ .inner {
23
+ @media (max-width: $mantine-breakpoint-xs) {
24
+ align-items: end;
25
+ padding: 0;
26
+ width: 100%;
27
+ }
28
+ }
29
+
30
+ button.close {
31
+ position: absolute;
32
+ right: 0.25rem;
33
+ top: 0.4rem;
34
+ display: flex;
35
+ background-color: var(--mantine-color-background-button-tertiary-0);
36
+ border-radius: 50%;
37
+ --cb-size: 1.5rem;
38
+
39
+ & > svg {
40
+ color: var(--mantine-color-icon-base-secondary-0);
41
+ scale: 0.75;
42
+ }
43
+ }
@@ -0,0 +1,83 @@
1
+ import type { Meta, StoryObj } from '@storybook/react'
2
+
3
+ import { MantineProvider } from '@/components/MainProvider'
4
+ import { Text } from '@/components/Text'
5
+
6
+ import '@mantine/core/styles.css'
7
+ import { theme } from '@/components/theme'
8
+ import { Modal } from '@/components/Modal'
9
+ import { Button } from '@/components/Button'
10
+
11
+ import { useDisclosure } from '@mantine/hooks'
12
+ import { Flex } from '@mantine/core'
13
+
14
+ // ----------------------------------------------------------------------
15
+
16
+ const ModalWrapper = () => {
17
+ const [opened, { open, close }] = useDisclosure(true)
18
+
19
+ return (
20
+ <>
21
+ <Modal
22
+ opened={opened}
23
+ onClose={close}
24
+ title={'Невозможно сменить \nспособ оплаты'}
25
+ >
26
+ <Text
27
+ variant='caption-l-regular'
28
+ c='text-base-secondary.0'
29
+ mb='1.5rem'
30
+ display='block'
31
+ >
32
+ Чтобы оплатить другим способом, необходимо <br />
33
+ вернуться на сайт и повторить платёж
34
+ </Text>
35
+ <Flex gap='sm'>
36
+ <Button
37
+ variant='secondary'
38
+ size='xs'
39
+ fullWidth
40
+ >
41
+ Вернуться на сайт
42
+ </Button>
43
+ <Button
44
+ variant='primary'
45
+ size='xs'
46
+ fullWidth
47
+ >
48
+ Остаться
49
+ </Button>
50
+ </Flex>
51
+ </Modal>
52
+
53
+ <Button
54
+ variant='default'
55
+ onClick={open}
56
+ >
57
+ Открыть модальное окно
58
+ </Button>
59
+ </>
60
+ )
61
+ }
62
+
63
+ // ----------------------------------------------------------------------
64
+
65
+ const meta = {
66
+ title: 'Components/Modal',
67
+ component: ModalWrapper,
68
+ decorators: (Story) => (
69
+ <MantineProvider theme={theme}>
70
+ <Story />
71
+ </MantineProvider>
72
+ ),
73
+ } satisfies Meta<typeof ModalWrapper>
74
+
75
+ type Story = StoryObj<typeof meta>
76
+
77
+ // ----------------------------------------------------------------------
78
+
79
+ export const ComponentCardInput: Story = {}
80
+
81
+ // ----------------------------------------------------------------------
82
+
83
+ export default meta
@@ -0,0 +1,10 @@
1
+ import { Modal as ModalBase } from '@mantine/core'
2
+ import classNames from './Modal.module.css'
3
+ import textClassNames from '../../styles/typography.module.css'
4
+ import { BODY_M_MEDIUM_FONT_VARIANT } from '../../constants/font-variants'
5
+
6
+ // ----------------------------------------------------------------------
7
+
8
+ export const Modal = ModalBase.withProps({
9
+ classNames: { ...classNames, title: textClassNames[BODY_M_MEDIUM_FONT_VARIANT] },
10
+ })
@@ -0,0 +1 @@
1
+ export { Modal } from './Modal'
@@ -0,0 +1,28 @@
1
+ .track {
2
+ --switch-height: 1rem;
3
+ --switch-width: rem(28px);
4
+ --switch-color: var(--mantine-color-background-toggle-active-0);
5
+
6
+ input:not(:checked) + & {
7
+ background-color: var(--mantine-color-background-toggle-default-0);
8
+ }
9
+ }
10
+
11
+ .description {
12
+ margin-top: -1px;
13
+ --label-offset-start: 1rem;
14
+ color: var(--mantine-color-primary);
15
+ }
16
+
17
+ .error {
18
+ color: var(--mantine-color-text-status-destructive-0);
19
+ padding-left: 0.25rem;
20
+ margin-top: 0;
21
+
22
+ &::before {
23
+ content: url('../../assets/error.svg');
24
+ position: relative;
25
+ top: 3px;
26
+ left: -0.25rem;
27
+ }
28
+ }
@@ -0,0 +1,39 @@
1
+ import type { Meta, StoryObj } from '@storybook/react'
2
+
3
+ import { MantineProvider } from '@/components/MainProvider'
4
+
5
+ import '@mantine/core/styles.css'
6
+ import { theme } from '@/components/theme'
7
+ import { Switch } from '@/components/Switch'
8
+
9
+ // ----------------------------------------------------------------------
10
+
11
+ const meta = {
12
+ title: 'Components/Switch',
13
+ component: Switch,
14
+ decorators: (Story) => (
15
+ <MantineProvider theme={theme}>
16
+ <Story />
17
+ </MantineProvider>
18
+ ),
19
+ } satisfies Meta<typeof Switch>
20
+
21
+ type Story = StoryObj<typeof Switch>
22
+
23
+ // ----------------------------------------------------------------------
24
+
25
+ export const ComponentSwitch: Story = {
26
+ args: {
27
+ description: 'Сохранить карту в KVELL.Pay',
28
+ },
29
+ argTypes: {
30
+ checked: { control: 'boolean' },
31
+ error: {
32
+ control: 'text',
33
+ },
34
+ },
35
+ }
36
+
37
+ // ----------------------------------------------------------------------
38
+
39
+ export default meta
@@ -0,0 +1,19 @@
1
+ import { Switch as SwitchBase } from '@mantine/core'
2
+ import classes from './Switch.module.css'
3
+ import textClassNames from '../../styles/typography.module.css'
4
+ import clsx from 'clsx'
5
+ import { CAPTION_L_MEDIUM_FONT_VARIANT } from '../../constants/font-variants'
6
+
7
+ // ----------------------------------------------------------------------
8
+
9
+ const descriptionClassName = clsx(
10
+ classes.description,
11
+ textClassNames[CAPTION_L_MEDIUM_FONT_VARIANT]
12
+ )
13
+
14
+ // ----------------------------------------------------------------------
15
+
16
+ export const Switch = SwitchBase.withProps({
17
+ classNames: { ...classes, description: descriptionClassName },
18
+ size: 'xs',
19
+ })
@@ -0,0 +1 @@
1
+ export { Switch } from './Switch'
@@ -0,0 +1,40 @@
1
+ import type { Meta, StoryObj } from '@storybook/react'
2
+
3
+ import { MantineProvider } from '@/components/MainProvider'
4
+
5
+ import '@mantine/core/styles.css'
6
+ import { theme } from '@/components/theme'
7
+ import { Text } from '@/components/Text/Text'
8
+ import { FontVariants } from '@/constants/font-variants'
9
+
10
+ // ----------------------------------------------------------------------
11
+
12
+ const meta = {
13
+ title: 'Components/Text',
14
+ component: Text,
15
+ decorators: (Story) => (
16
+ <MantineProvider theme={theme}>
17
+ <Story />
18
+ </MantineProvider>
19
+ ),
20
+ } satisfies Meta<typeof Text>
21
+
22
+ type Story = StoryObj<typeof meta>
23
+
24
+ // ----------------------------------------------------------------------
25
+
26
+ export const ComponentText: Story = {
27
+ args: {
28
+ children: 'Компонент типографии',
29
+ },
30
+ argTypes: {
31
+ variant: {
32
+ control: 'select',
33
+ options: FontVariants,
34
+ },
35
+ },
36
+ }
37
+
38
+ // ----------------------------------------------------------------------
39
+
40
+ export default meta