forstok-ui-lib 5.2.48 → 5.2.50
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/dist/index.d.ts +9 -1
- package/dist/index.js +182 -114
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +189 -121
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/assets/images/icons/filter copy.svg +16 -0
- package/src/components/index.ts +1 -0
- package/src/components/radio/index.tsx +30 -0
- package/src/components/radio/styles.ts +85 -0
package/package.json
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
|
|
3
|
+
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
|
4
|
+
<svg width="auto" height="auto" viewBox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
|
|
5
|
+
<title>filter-horizontal-solid</title>
|
|
6
|
+
<g id="Layer_2" data-name="Layer 2">
|
|
7
|
+
<g id="invisible_box" data-name="invisible box">
|
|
8
|
+
<rect width="48" height="48" fill="none"/>
|
|
9
|
+
</g>
|
|
10
|
+
<g id="icons_Q2" data-name="icons Q2">
|
|
11
|
+
<path d="M41.8,8H21.7A6.2,6.2,0,0,0,16,4a6,6,0,0,0-5.6,4H6.2A2.1,2.1,0,0,0,4,10a2.1,2.1,0,0,0,2.2,2h4.2A6,6,0,0,0,16,16a6.2,6.2,0,0,0,5.7-4H41.8A2.1,2.1,0,0,0,44,10,2.1,2.1,0,0,0,41.8,8Z"/>
|
|
12
|
+
<path d="M41.8,22H37.7A6.2,6.2,0,0,0,32,18a6,6,0,0,0-5.6,4H6.2a2,2,0,1,0,0,4H26.4A6,6,0,0,0,32,30a6.2,6.2,0,0,0,5.7-4h4.1a2,2,0,1,0,0-4Z"/>
|
|
13
|
+
<path d="M41.8,36H24.7A6.2,6.2,0,0,0,19,32a6,6,0,0,0-5.6,4H6.2a2,2,0,1,0,0,4h7.2A6,6,0,0,0,19,44a6.2,6.2,0,0,0,5.7-4H41.8a2,2,0,1,0,0-4Z"/>
|
|
14
|
+
</g>
|
|
15
|
+
</g>
|
|
16
|
+
</svg>
|
package/src/components/index.ts
CHANGED
|
@@ -22,6 +22,7 @@ export { default as TextAreaComponent } from './textarea';
|
|
|
22
22
|
export { default as TextAreaRefComponent } from './textarea/ref';
|
|
23
23
|
export { default as DateComponent } from './date';
|
|
24
24
|
export { default as DateTimeComponent } from './datetime';
|
|
25
|
+
export { default as RadioComponent } from './radio';
|
|
25
26
|
|
|
26
27
|
export * from './dropdown/typed';
|
|
27
28
|
export * from './message/typed';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ChangeEvent, InputHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { RadioContainer, RadioInput, RadioSpan } from './styles';
|
|
3
|
+
|
|
4
|
+
type TRadio = InputHTMLAttributes<HTMLInputElement> & {
|
|
5
|
+
children?: ReactNode
|
|
6
|
+
mode?: string
|
|
7
|
+
evChange?: (e: ChangeEvent<HTMLInputElement>) => void
|
|
8
|
+
'data-qa-id'?: string
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const RadioComponent = ({ children, mode, evChange,...props }: TRadio) => {
|
|
12
|
+
const { id } = props;
|
|
13
|
+
return (
|
|
14
|
+
<RadioContainer>
|
|
15
|
+
<label htmlFor={id}>
|
|
16
|
+
<RadioInput
|
|
17
|
+
type='radio'
|
|
18
|
+
id={id}
|
|
19
|
+
$mode={mode}
|
|
20
|
+
onChange={(e: ChangeEvent<HTMLInputElement>) => {
|
|
21
|
+
evChange && evChange(e)
|
|
22
|
+
}}
|
|
23
|
+
{...props} />
|
|
24
|
+
<RadioSpan $mode={mode} {...props['data-qa-id'] && { 'data-qa-id': props['data-qa-id'] }}>{children}</RadioSpan>
|
|
25
|
+
</label>
|
|
26
|
+
</RadioContainer>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export default RadioComponent
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components'
|
|
2
|
+
|
|
3
|
+
import IconCheckmarkTick from '../../assets/images/icons/checkmark-tick.svg'
|
|
4
|
+
|
|
5
|
+
export const RadioContainer = styled.div`
|
|
6
|
+
display: grid;
|
|
7
|
+
grid-auto-flow: column;
|
|
8
|
+
justify-self: self-start;
|
|
9
|
+
`
|
|
10
|
+
|
|
11
|
+
export const RadioSpan = styled.span<{ $mode?: string }>`
|
|
12
|
+
position: relative;
|
|
13
|
+
cursor: pointer;
|
|
14
|
+
display: inline-block;
|
|
15
|
+
height: 16px;
|
|
16
|
+
transition: .28s ease;
|
|
17
|
+
user-select: none;
|
|
18
|
+
padding-left: 22px;
|
|
19
|
+
&:before,
|
|
20
|
+
&:after {
|
|
21
|
+
content: '';
|
|
22
|
+
position: absolute;
|
|
23
|
+
left: 0;
|
|
24
|
+
top: 0;
|
|
25
|
+
width: 10px;
|
|
26
|
+
height: 10px;
|
|
27
|
+
z-index: 0;
|
|
28
|
+
transition: .28s ease;
|
|
29
|
+
border: 2px solid #5a5a5a;
|
|
30
|
+
border-radius: 50%;
|
|
31
|
+
}
|
|
32
|
+
b {
|
|
33
|
+
line-height: 18px;
|
|
34
|
+
display: block;
|
|
35
|
+
}
|
|
36
|
+
.sub {
|
|
37
|
+
font-size: 90%;
|
|
38
|
+
color: #2d3c48;
|
|
39
|
+
}
|
|
40
|
+
${({ $mode }:{ $mode?: string }) => {
|
|
41
|
+
if ($mode === 'check') {
|
|
42
|
+
return css`
|
|
43
|
+
&:before,
|
|
44
|
+
&:after {
|
|
45
|
+
border: none;
|
|
46
|
+
}
|
|
47
|
+
`
|
|
48
|
+
}
|
|
49
|
+
}}
|
|
50
|
+
`
|
|
51
|
+
|
|
52
|
+
export const RadioInput = styled.input<{ $mode?: string }>`
|
|
53
|
+
position: absolute;
|
|
54
|
+
opacity: 0;
|
|
55
|
+
pointer-events: none;
|
|
56
|
+
width: auto;
|
|
57
|
+
&:checked + ${RadioSpan} {
|
|
58
|
+
&:before {
|
|
59
|
+
border: 2px solid var(--err-clr-ln);
|
|
60
|
+
}
|
|
61
|
+
&:after {
|
|
62
|
+
transform: scale(0.6);
|
|
63
|
+
background-color: var(--err-clr-ln);
|
|
64
|
+
border: 2px solid transparent;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
${({ $mode }:{ $mode?: string }) => {
|
|
68
|
+
if ($mode === 'check') {
|
|
69
|
+
return css`
|
|
70
|
+
&:checked + ${RadioSpan} {
|
|
71
|
+
&:before,
|
|
72
|
+
&:after {
|
|
73
|
+
border: none;
|
|
74
|
+
transform: none;
|
|
75
|
+
background: none;
|
|
76
|
+
}
|
|
77
|
+
&:before {
|
|
78
|
+
content: url(${IconCheckmarkTick});
|
|
79
|
+
width: 14px;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
`
|
|
83
|
+
}
|
|
84
|
+
}}
|
|
85
|
+
`
|