@kvell-group/ui 1.18.7 → 1.18.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/components/Inputs/@styles/input-base.module.css +54 -0
- package/src/components/Inputs/CardExpireDateInput/CardExpireDateInput.tsx +1 -1
- package/src/components/Inputs/CardInput/CardInput.tsx +1 -1
- package/src/components/Inputs/CvvInput/CvvInput.tsx +1 -1
- package/src/components/Inputs/MaskedInput/MaskedInput.tsx +1 -1
- package/src/components/Inputs/PinInput/PinInput.module.css +17 -0
- package/src/components/Inputs/PinInput/PinInput.stories.tsx +40 -0
- package/src/components/Inputs/PinInput/PinInput.tsx +39 -0
- package/src/components/Inputs/PinInput/index.ts +1 -0
- package/src/components/Inputs/Textarea/Textarea.module.css +3 -0
- package/src/components/Inputs/Textarea/Textarea.ts +7 -1
- package/src/index.ts +1 -0
- package/src/theme/index.ts +1 -0
- /package/src/components/Inputs/{types.ts → @types/types.ts} +0 -0
package/package.json
CHANGED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
.input-base {
|
|
2
|
+
@media (hover: hover) {
|
|
3
|
+
&:hover:where(:not([data-loading], :disabled, [data-disabled])) {
|
|
4
|
+
--input-bd: var(--color-border-action-hover);
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
&:focus-within {
|
|
9
|
+
--input-bd: var(--color-border-action-focus-light);
|
|
10
|
+
box-shadow: var(--shadow-focus-ring-light);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
&[data-error] {
|
|
14
|
+
--input-color: var(--color-text-status-destructive);
|
|
15
|
+
--input-bd: var(--color-border-action-destructive);
|
|
16
|
+
|
|
17
|
+
@media (hover: hover) {
|
|
18
|
+
&:hover:where(:not([data-loading], :disabled, [data-disabled])) {
|
|
19
|
+
--input-bd: var(--color-border-action-destructive-hover);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&:focus-within {
|
|
24
|
+
--input-bd: var(--color-border-action-focus-destructive-light);
|
|
25
|
+
box-shadow: var(--shadow-focus-ring-light-destructive);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&:disabled,
|
|
30
|
+
[data-disabled] {
|
|
31
|
+
--input-bd: var(--color-border-action-disabled);
|
|
32
|
+
box-shadow: none;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.error-message {
|
|
37
|
+
padding-block: rem(2px);
|
|
38
|
+
font-size: var(--mantine-font-size-caption-l);
|
|
39
|
+
line-height: var(--mantine-line-height-caption-l);
|
|
40
|
+
letter-spacing: var(--mantine-spacing-caption-l);
|
|
41
|
+
display: flex;
|
|
42
|
+
color: var(--color-text-status-destructive);
|
|
43
|
+
|
|
44
|
+
&::before {
|
|
45
|
+
content: '';
|
|
46
|
+
width: rem(16px);
|
|
47
|
+
height: rem(16px);
|
|
48
|
+
background: currentColor;
|
|
49
|
+
mask: url('../../../assets/error.svg') no-repeat;
|
|
50
|
+
margin-top: rem(1.5px);
|
|
51
|
+
margin-right: rem(4px);
|
|
52
|
+
flex-shrink: 0;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MaskedInput } from '../MaskedInput'
|
|
2
2
|
|
|
3
|
-
import type { MaskedInputProps } from '
|
|
3
|
+
import type { MaskedInputProps } from '../@types/types'
|
|
4
4
|
import { forwardRef } from 'react'
|
|
5
5
|
import { CARD_EXPIRY_DATE_MASK } from '../../../constants/masks'
|
|
6
6
|
import { IMask } from 'react-imask'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MaskedInput } from '../MaskedInput'
|
|
2
|
-
import type { MaskedInputProps } from '
|
|
2
|
+
import type { MaskedInputProps } from '../@types/types'
|
|
3
3
|
import { forwardRef } from 'react'
|
|
4
4
|
import { CARD_NUMBER_MASK } from '../../../constants/masks'
|
|
5
5
|
import { IMask } from 'react-imask'
|
|
@@ -2,7 +2,7 @@ import { MaskedInput } from '../MaskedInput'
|
|
|
2
2
|
import passwordClassNames from './CvvInput.module.css'
|
|
3
3
|
import baseInputClassNames from '../Input/Input.module.css'
|
|
4
4
|
import clsx from 'clsx'
|
|
5
|
-
import type { MaskedInputProps } from '
|
|
5
|
+
import type { MaskedInputProps } from '../@types/types'
|
|
6
6
|
import { forwardRef } from 'react'
|
|
7
7
|
import { CARD_CVV_MASK } from '../../../constants/masks'
|
|
8
8
|
import { IMask } from 'react-imask'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IMaskInput } from 'react-imask'
|
|
2
2
|
import { Input } from '../Input/Input'
|
|
3
3
|
import { forwardRef } from 'react'
|
|
4
|
-
import type { MaskedInputProps } from '
|
|
4
|
+
import type { MaskedInputProps } from '../@types/types'
|
|
5
5
|
|
|
6
6
|
// ----------------------------------------------------------------------
|
|
7
7
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
margin-bottom: 0.5rem;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.pinInput {
|
|
6
|
+
/*
|
|
7
|
+
44:50, original:
|
|
8
|
+
height: pin-input-size
|
|
9
|
+
width: pin-input-size
|
|
10
|
+
*/
|
|
11
|
+
width: calc(var(--pin-input-size) * 0.88);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
input {
|
|
15
|
+
--input-bd: var(--mantine-color-border-action-normal-0);
|
|
16
|
+
box-shadow: var(--mantine-shadow-xs);
|
|
17
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
|
|
3
|
+
import { KvellUiProvider } from '@/components/KvellUiProvider'
|
|
4
|
+
|
|
5
|
+
import { theme } from '@/theme'
|
|
6
|
+
import { PinInput as PinInputComponent } from '@/components/Inputs/PinInput'
|
|
7
|
+
|
|
8
|
+
// ----------------------------------------------------------------------
|
|
9
|
+
|
|
10
|
+
const meta = {
|
|
11
|
+
title: 'Components/Inputs/PinInput',
|
|
12
|
+
component: PinInputComponent,
|
|
13
|
+
decorators: (Story) => (
|
|
14
|
+
<KvellUiProvider theme={theme}>
|
|
15
|
+
<div style={{ maxWidth: '465px' }}>
|
|
16
|
+
<Story />
|
|
17
|
+
</div>
|
|
18
|
+
</KvellUiProvider>
|
|
19
|
+
),
|
|
20
|
+
} satisfies Meta<typeof PinInputComponent>
|
|
21
|
+
|
|
22
|
+
type Story = StoryObj<typeof PinInputComponent>
|
|
23
|
+
|
|
24
|
+
// ----------------------------------------------------------------------
|
|
25
|
+
|
|
26
|
+
export const PinInput: Story = {
|
|
27
|
+
args: {
|
|
28
|
+
placeholder: '',
|
|
29
|
+
},
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export const PinInputError: Story = {
|
|
33
|
+
args: {
|
|
34
|
+
error: 'Ошибка OTP кода',
|
|
35
|
+
},
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// ----------------------------------------------------------------------
|
|
39
|
+
|
|
40
|
+
export default meta
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Input, PinInput as PinInputComponent } from '@mantine/core'
|
|
2
|
+
import type { PinInputProps as BasePinInputProps } from '@mantine/core'
|
|
3
|
+
|
|
4
|
+
import classes from './PinInput.module.css'
|
|
5
|
+
import textClasses from '../../../styles/typography.module.css'
|
|
6
|
+
import inputBaseClasses from '../@styles/input-base.module.css'
|
|
7
|
+
import { forwardRef } from 'react'
|
|
8
|
+
import clsx from 'clsx'
|
|
9
|
+
|
|
10
|
+
const inputClassName = clsx(
|
|
11
|
+
classes.input,
|
|
12
|
+
textClasses['body-m-regular'],
|
|
13
|
+
inputBaseClasses['input-base']
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
type PinInputProps = Omit<BasePinInputProps, 'error'> & {
|
|
17
|
+
error?: string
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const PinInput = forwardRef<HTMLInputElement, PinInputProps>((props, ref) => {
|
|
21
|
+
const { error, size = 'lg', gap = 4, radius = 'xl', ...restProps } = props
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<Input.Wrapper
|
|
25
|
+
error={error}
|
|
26
|
+
classNames={{ error: inputBaseClasses['error-message'] }}
|
|
27
|
+
>
|
|
28
|
+
<PinInputComponent
|
|
29
|
+
ref={ref}
|
|
30
|
+
{...restProps}
|
|
31
|
+
radius={radius}
|
|
32
|
+
gap={gap}
|
|
33
|
+
size={size}
|
|
34
|
+
error={Boolean(error)}
|
|
35
|
+
classNames={{ ...classes, input: inputClassName }}
|
|
36
|
+
/>
|
|
37
|
+
</Input.Wrapper>
|
|
38
|
+
)
|
|
39
|
+
})
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PinInput } from './PinInput'
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { Textarea as MantineTextarea } from '@mantine/core'
|
|
2
|
+
import clsx from 'clsx'
|
|
2
3
|
import classNames from '../Input/Input.module.css'
|
|
4
|
+
import textareaClassNames from './Textarea.module.css'
|
|
5
|
+
|
|
6
|
+
// ----------------------------------------------------------------------
|
|
7
|
+
|
|
8
|
+
const inputClassName = clsx(textareaClassNames.input, classNames.input)
|
|
3
9
|
|
|
4
10
|
// ----------------------------------------------------------------------
|
|
5
11
|
|
|
6
12
|
export const Textarea = MantineTextarea.withProps({
|
|
7
|
-
classNames,
|
|
13
|
+
classNames: { ...classNames, input: inputClassName },
|
|
8
14
|
inputWrapperOrder: ['label', 'input', 'error', 'description'],
|
|
9
15
|
})
|
package/src/index.ts
CHANGED
|
@@ -13,6 +13,7 @@ export { Select } from './components/Inputs/Select'
|
|
|
13
13
|
export { Textarea } from './components/Inputs/Textarea'
|
|
14
14
|
export { DatesProvider } from '@mantine/dates'
|
|
15
15
|
export * from './components/Inputs/DatePickerInput'
|
|
16
|
+
export { PinInput } from './components/Inputs/PinInput'
|
|
16
17
|
|
|
17
18
|
//providers
|
|
18
19
|
export { KvellUiProvider } from './components/KvellUiProvider'
|
package/src/theme/index.ts
CHANGED
|
File without changes
|