@npm_leadtech/legal-lib-components 5.40.2 → 5.42.0

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.
@@ -1768,194 +1768,61 @@ h2.react-datepicker__current-month {
1768
1768
  height: 1em;
1769
1769
  vertical-align: -0.125em;
1770
1770
  }
1771
- .e-radio label:first-child:not(.e-radio-label) {
1772
- font-weight: bold;
1771
+ .e-radio .label {
1772
+ color: var(--neutral-neutral-1);
1773
+ margin-bottom: 1rem;
1774
+ display: block;
1773
1775
  }
1774
- .e-radio .radio-item-container {
1775
- width: 100%;
1776
+ .e-radio.default .e-radio__inner {
1777
+ display: flex;
1778
+ flex-direction: column;
1779
+ gap: 1rem;
1776
1780
  }
1777
- @media (max-width: 575px) {
1778
- .e-radio.--regular .e-radio__inner {
1779
- display: flex;
1780
- flex-flow: row wrap;
1781
- width: 100%;
1782
- margin-left: 1.5rem;
1783
- }
1784
- .e-radio.--regular .e-radio__inner label {
1785
- margin-bottom: 0.25rem;
1786
- flex-basis: 100%;
1787
- display: flex;
1788
- align-items: center;
1789
- color: var(--neutral-main);
1790
- font-size: 16px;
1791
- position: relative;
1792
- cursor: pointer;
1793
- width: 100%;
1794
- }
1795
- .e-radio.--regular input {
1796
- position: absolute;
1797
- left: -9999px;
1798
- }
1799
- .e-radio.--regular input:not(:checked):hover + label:before {
1800
- background-color: var(--primary-main-light-5);
1801
- }
1802
- .e-radio.--regular input:checked:hover + label:before {
1803
- background-color: var(--primary-main);
1804
- }
1805
- .e-radio.--regular input:checked + label {
1806
- color: var(--primary-main);
1807
- text-shadow: -0.02ex 0 var(--primary-main), 0.02ex 0 var(--primary-main);
1808
- }
1809
- .e-radio.--regular input:checked + label:before {
1810
- content: "";
1811
- position: absolute;
1812
- top: 2px;
1813
- left: -23px;
1814
- height: 1.25rem;
1815
- width: 1.25rem;
1816
- background-color: var(--primary-main);
1817
- border: 1px solid var(--primary-main);
1818
- border-radius: 50%;
1819
- box-sizing: border-box;
1820
- }
1821
- .e-radio.--regular input:checked + label:after {
1822
- content: "";
1823
- position: absolute;
1824
- top: 0.5rem;
1825
- left: -17px;
1826
- display: block;
1827
- height: 0.5rem;
1828
- width: 0.5rem;
1829
- background: currentColor;
1830
- border-radius: 50%;
1831
- opacity: 1;
1832
- transform: scale(1);
1833
- color: #fff;
1834
- transition: all 0.1s;
1835
- }
1836
- .e-radio.--regular input + label {
1837
- cursor: pointer;
1838
- font-size: 16px;
1839
- }
1840
- .e-radio.--regular input + label:before {
1841
- content: "";
1842
- position: absolute;
1843
- left: -23px;
1844
- top: 2px;
1845
- height: 1.25rem;
1846
- width: 1.25rem;
1847
- border-radius: 50%;
1848
- background-color: transparent;
1849
- border: 1px solid var(--neutral-main);
1850
- box-sizing: border-box;
1851
- }
1852
- .e-radio.--regular input + label:after {
1853
- position: absolute;
1854
- top: 0.5rem;
1855
- left: -17px;
1856
- display: block;
1857
- height: 0.5rem;
1858
- width: 0.5rem;
1859
- opacity: 0;
1860
- transform: scale(0);
1861
- color: var(--others-white);
1862
- transition: all 0.1s;
1863
- content: "";
1864
- bottom: 0.5rem;
1865
- border-radius: 50%;
1866
- }
1781
+ .e-radio.default .e-radio__inner .radio-item-container .e-radio-label {
1782
+ display: flex;
1783
+ align-items: center;
1784
+ gap: 0.5rem;
1785
+ }
1786
+ .e-radio.default .e-radio__inner .radio-item-container .e-radio-label .radio-item-input {
1787
+ visibility: hidden;
1788
+ }
1789
+ .e-radio.default .e-radio__inner .radio-item-container .e-radio-label input[type=radio]:after {
1790
+ width: 16px;
1791
+ height: 16px;
1792
+ border-radius: 16px;
1793
+ top: -4px;
1794
+ left: -2px;
1795
+ position: relative;
1796
+ background-color: var(--others-white);
1797
+ content: "";
1798
+ display: inline-block;
1799
+ visibility: visible;
1800
+ border: 1px solid var(--neutral-neutral-1);
1801
+ cursor: pointer;
1802
+ }
1803
+ .e-radio.default .e-radio__inner .radio-item-container .e-radio-label .e-radio-label__label {
1804
+ cursor: pointer;
1805
+ }
1806
+ .e-radio.default .e-radio__inner .radio-item-container.active .e-radio-label input[type=radio]:after {
1807
+ border: 5px solid var(--primary-main);
1808
+ }
1809
+ .e-radio.default .e-radio__inner .radio-item-container.active .e-radio-label .e-radio-label__label {
1810
+ color: var(--primary-main);
1811
+ }
1812
+ .e-radio.default .e-radio__inner .radio-item-container:hover .e-radio-label input[type=radio]:after {
1813
+ background-color: var(--primary-main-light-5);
1867
1814
  }
1868
1815
  @media (min-width: 575px) {
1869
- .e-radio.--regular:not(.--icons) .e-radio__inner {
1870
- display: flex;
1871
- flex-flow: row wrap;
1872
- width: 100%;
1873
- margin-left: 1.5rem;
1874
- }
1875
- .e-radio.--regular:not(.--icons) .e-radio__inner label {
1876
- margin-bottom: 0.25rem;
1877
- flex-basis: 100%;
1878
- display: flex;
1879
- align-items: center;
1880
- color: var(--neutral-main);
1881
- font-size: 16px;
1882
- position: relative;
1883
- cursor: pointer;
1884
- width: 100%;
1885
- }
1886
- .e-radio.--regular:not(.--icons) input {
1887
- position: absolute;
1888
- left: -9999px;
1889
- }
1890
- .e-radio.--regular:not(.--icons) input:not(:checked):hover + label:before {
1891
- background-color: var(--primary-main-light-5);
1892
- }
1893
- .e-radio.--regular:not(.--icons) input:checked:hover + label:before {
1894
- background-color: var(--primary-main);
1895
- }
1896
- .e-radio.--regular:not(.--icons) input:checked + label {
1897
- color: var(--primary-main);
1898
- text-shadow: -0.02ex 0 var(--primary-main), 0.02ex 0 var(--primary-main);
1899
- }
1900
- .e-radio.--regular:not(.--icons) input:checked + label:before {
1901
- content: "";
1902
- position: absolute;
1903
- top: 2px;
1904
- left: -23px;
1905
- height: 1.25rem;
1906
- width: 1.25rem;
1907
- background-color: var(--primary-main);
1908
- border: 1px solid var(--primary-main);
1909
- border-radius: 50%;
1910
- box-sizing: border-box;
1911
- }
1912
- .e-radio.--regular:not(.--icons) input:checked + label:after {
1913
- content: "";
1914
- position: absolute;
1915
- top: 0.5rem;
1916
- left: -17px;
1917
- display: block;
1918
- height: 0.5rem;
1919
- width: 0.5rem;
1920
- background: currentColor;
1921
- border-radius: 50%;
1922
- opacity: 1;
1923
- transform: scale(1);
1924
- color: #fff;
1925
- transition: all 0.1s;
1926
- }
1927
- .e-radio.--regular:not(.--icons) input + label {
1928
- cursor: pointer;
1929
- font-size: 16px;
1930
- }
1931
- .e-radio.--regular:not(.--icons) input + label:before {
1932
- content: "";
1933
- position: absolute;
1934
- left: -23px;
1935
- top: 2px;
1936
- height: 1.25rem;
1937
- width: 1.25rem;
1938
- border-radius: 50%;
1939
- background-color: transparent;
1940
- border: 1px solid var(--neutral-main);
1941
- box-sizing: border-box;
1942
- }
1943
- .e-radio.--regular:not(.--icons) input + label:after {
1944
- position: absolute;
1945
- top: 0.5rem;
1946
- left: -17px;
1947
- display: block;
1948
- height: 0.5rem;
1949
- width: 0.5rem;
1950
- opacity: 0;
1951
- transform: scale(0);
1952
- color: var(--others-white);
1953
- transition: all 0.1s;
1954
- content: "";
1955
- bottom: 0.5rem;
1956
- border-radius: 50%;
1816
+ .e-radio.default .e-radio__inner {
1817
+ gap: 0.5rem;
1957
1818
  }
1958
1819
  }
1820
+ .e-radio label:first-child:not(.e-radio-label) {
1821
+ font-weight: bold;
1822
+ }
1823
+ .e-radio .radio-item-container {
1824
+ width: 100%;
1825
+ }
1959
1826
  @media (max-width: 575px) {
1960
1827
  .e-radio.--tabs .e-radio__inner {
1961
1828
  display: flex;
@@ -2072,6 +1939,52 @@ h2.react-datepicker__current-month {
2072
1939
  width: 100%;
2073
1940
  }
2074
1941
  }
1942
+ @media (max-width: 575px) {
1943
+ .e-radio.--icons .e-radio__inner {
1944
+ display: flex;
1945
+ flex-direction: column;
1946
+ gap: 1rem;
1947
+ }
1948
+ .e-radio.--icons .e-radio__inner .radio-item-container .e-radio-label {
1949
+ display: flex;
1950
+ align-items: center;
1951
+ gap: 0.5rem;
1952
+ }
1953
+ .e-radio.--icons .e-radio__inner .radio-item-container .e-radio-label .radio-item-input {
1954
+ visibility: hidden;
1955
+ }
1956
+ .e-radio.--icons .e-radio__inner .radio-item-container .e-radio-label input[type=radio]:after {
1957
+ width: 16px;
1958
+ height: 16px;
1959
+ border-radius: 16px;
1960
+ top: -4px;
1961
+ left: -2px;
1962
+ position: relative;
1963
+ background-color: var(--others-white);
1964
+ content: "";
1965
+ display: inline-block;
1966
+ visibility: visible;
1967
+ border: 1px solid var(--neutral-neutral-1);
1968
+ cursor: pointer;
1969
+ }
1970
+ .e-radio.--icons .e-radio__inner .radio-item-container .e-radio-label .e-radio-label__label {
1971
+ cursor: pointer;
1972
+ }
1973
+ .e-radio.--icons .e-radio__inner .radio-item-container.active .e-radio-label input[type=radio]:after {
1974
+ border: 5px solid var(--primary-main);
1975
+ }
1976
+ .e-radio.--icons .e-radio__inner .radio-item-container.active .e-radio-label .e-radio-label__label {
1977
+ color: var(--primary-main);
1978
+ }
1979
+ .e-radio.--icons .e-radio__inner .radio-item-container:hover .e-radio-label input[type=radio]:after {
1980
+ background-color: var(--primary-main-light-5);
1981
+ }
1982
+ }
1983
+ @media (max-width: 575px) and (min-width: 575px) {
1984
+ .e-radio.--icons .e-radio__inner {
1985
+ gap: 0.5rem;
1986
+ }
1987
+ }
2075
1988
  .e-radio.--icons .radio-icon {
2076
1989
  display: none;
2077
1990
  }
@@ -2118,10 +2031,6 @@ h2.react-datepicker__current-month {
2118
2031
  margin-right: 1rem;
2119
2032
  }
2120
2033
  }
2121
- .e-radio.--is-invalid.--regular input + label:before,
2122
- .e-radio.--group-invalid.--regular input + label:before {
2123
- border-color: var(--error-main);
2124
- }
2125
2034
  .e-radio.--is-invalid.--tabs .e-radio__inner,
2126
2035
  .e-radio.--is-invalid.--group-invalid .e-radio__inner,
2127
2036
  .e-radio.--group-invalid.--tabs .e-radio__inner,
@@ -2140,9 +2049,6 @@ h2.react-datepicker__current-month {
2140
2049
  .e-radio.--group-invalid.--group-invalid .e-radio__inner label:last-child label {
2141
2050
  border-right: none;
2142
2051
  }
2143
- .radio-group__label {
2144
- color: var(--neutral-neutral-1);
2145
- }
2146
2052
  .e-radio.radio--small.--tabs input + label {
2147
2053
  font-size: 0.875rem;
2148
2054
  padding: 0.75rem;
@@ -2151,20 +2057,6 @@ h2.react-datepicker__current-month {
2151
2057
  margin-top: 0;
2152
2058
  margin-bottom: 0;
2153
2059
  }
2154
- .e-radio.radio--narrow.--regular .e-radio__inner {
2155
- margin-top: 0.5rem;
2156
- }
2157
- .e-radio.--regular.radio--regular--bare .e-radio__inner {
2158
- display: inline-block;
2159
- margin-right: auto;
2160
- text-align: left;
2161
- width: auto;
2162
- }
2163
- .e-radio.--regular.radio--regular--bare .e-radio-label,
2164
- .e-radio.--regular.radio--regular--bare .e-radio-label__label {
2165
- display: block;
2166
- margin-bottom: 0.75rem;
2167
- }
2168
2060
  .tippy-box {
2169
2061
  background-color: var(--others-white);
2170
2062
  border-radius: var(--global-border-radius);
@@ -1,4 +1,4 @@
1
- import { type FC } from 'react';
1
+ import React from 'react';
2
2
  import { type RadioProps } from './RadioProps.types';
3
- declare const Radio: FC<RadioProps>;
3
+ declare const Radio: React.FC<RadioProps>;
4
4
  export default Radio;
@@ -1,20 +1,21 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React from 'react';
3
+ import { RadioFormat } from './RadioProps.types';
2
4
  import IconImage from '../IconImage/IconImage';
3
5
  // import './Radio.scss'
4
- const Radio = (props) => {
5
- const optionalClassNames = {
6
- small: 'radio--small',
7
- narrow: 'radio--narrow',
8
- regularBare: 'radio--regular--bare'
9
- };
10
- const additionalClassNames = Object.keys(optionalClassNames)
11
- .filter((attribute) => props[attribute])
12
- .map((key) => optionalClassNames[key])
13
- .join(' ');
14
- const classNames = `e-radio ${props.class} ${!props.validate ? '--is-invalid' : ''} ${!props.isValidGroup ? '--group-invalid' : ''} ${additionalClassNames}`;
15
- const TooltipObject = props.tooltip ? _jsx("p", { className: 'tooltip-form sans-serif --small', children: props.tooltip }) : '';
16
- return (_jsxs("div", { className: classNames, children: [_jsx("label", { htmlFor: props.name, className: 'radio-group__label', children: props.label }), _jsx("div", { className: 'e-radio__inner', children: props.items?.map((radio) => {
17
- return (_jsx("div", { className: `radio-item-container ${radio.value === props.value ? 'active' : ''}`, children: _jsxs("label", { className: 'e-radio-label', children: [radio.iconName !== undefined && radio.iconName !== '' && (_jsx(IconImage, { givenClass: 'radio-icon', iconName: radio.iconName })), _jsx("input", { type: 'radio', className: 'radio-item-input', id: `${props.name}_${radio.value}`, name: props.name, onChange: props.onChange, value: radio.value, checked: radio.value === props.value, disabled: props.disabled }), _jsx("label", { className: 'e-radio-label__label', htmlFor: `${props.name}_${radio.value}`, "data-qa": `${props.name}_${radio.value}`, children: radio.label }), _jsx("div", { children: props.help })] }, radio.value) }, radio.value));
18
- }) }), TooltipObject] }));
6
+ const Radio = ({ class: className, format = RadioFormat.Default, validate = false, isValidGroup = false, tooltip, name, label, items, value, disabled = false, help, onChange }) => {
7
+ const [classNameValue] = React.useState(() => {
8
+ let value = `e-radio ${format}`;
9
+ if (className)
10
+ value += ` ${className}`;
11
+ if (!validate)
12
+ value += ' --is-invalid';
13
+ if (!isValidGroup)
14
+ value += ' --group-invalid';
15
+ return value;
16
+ });
17
+ return (_jsxs("div", { className: classNameValue, children: [_jsx("label", { htmlFor: name, className: 'sans-serif --medium --bold-weight label', children: label }), _jsx("div", { className: 'e-radio__inner', children: items.map((radio) => {
18
+ return (_jsx("div", { className: `radio-item-container ${radio.value === value ? 'active' : ''}`, children: _jsxs("label", { className: 'e-radio-label', children: [radio.iconName !== undefined && radio.iconName !== '' && (_jsx(IconImage, { givenClass: 'radio-icon', iconName: radio.iconName })), _jsx("input", { type: 'radio', className: 'radio-item-input', id: `${name}_${radio.value}`, name: name, onChange: onChange, value: radio.value, checked: radio.value === value, disabled: disabled }), _jsx("label", { className: 'e-radio-label__label sans-serif --medium', htmlFor: `${name}_${radio.value}`, "data-qa": `${name}_${radio.value}`, children: radio.label }), help && _jsx("div", { children: help })] }, radio.value) }, radio.value));
19
+ }) }), tooltip ?? _jsx("p", { className: 'tooltip-form sans-serif --small', children: tooltip })] }));
19
20
  };
20
21
  export default Radio;
@@ -1,110 +1,63 @@
1
1
  @import '../../../globalStyles/variables.scss';
2
2
  @import '../../../globalStyles/mediaqueries.scss';
3
3
 
4
- @mixin regularStyles {
4
+ @mixin defaultStyles {
5
5
  .e-radio__inner {
6
6
  display: flex;
7
- flex-flow: row wrap;
8
- width: 100%;
9
- margin-left: 1.5rem;
10
-
11
- label {
12
- margin-bottom: 0.25rem;
13
- flex-basis: 100%;
14
- display: flex;
15
- align-items: center;
16
- color: var(--neutral-main);
17
- font-size: 16px;
18
- position: relative;
19
- cursor: pointer;
20
- width: 100%;
21
- }
22
- }
7
+ flex-direction: column;
8
+ gap: 1rem;
9
+ .radio-item-container {
10
+ .e-radio-label {
11
+ display: flex;
12
+ align-items: center;
13
+ gap: 0.5rem;
23
14
 
24
- input {
25
- position: absolute;
26
- left: -9999px;
15
+ .radio-item-input {
16
+ visibility: hidden;
17
+ }
27
18
 
28
- &:not(:checked):hover + label {
29
- &:before {
30
- background-color: var(--primary-main-light-5);
31
- }
32
- }
19
+ input[type='radio']:after {
20
+ width: 16px;
21
+ height: 16px;
22
+ border-radius: 16px;
23
+ top: -4px;
24
+ left: -2px;
25
+ position: relative;
26
+ background-color: var(--others-white);
27
+ content: '';
28
+ display: inline-block;
29
+ visibility: visible;
30
+ border: 1px solid var(--neutral-neutral-1);
31
+ cursor: pointer;
32
+ }
33
33
 
34
- &:checked:hover + label {
35
- &:before {
36
- background-color: var(--primary-main);
34
+ .e-radio-label__label {
35
+ cursor: pointer;
36
+ }
37
37
  }
38
- }
39
38
 
40
- &:checked + label {
41
- color: var(--primary-main);
42
- text-shadow:
43
- -0.02ex 0 get-color(primary),
44
- 0.02ex 0 var(--primary-main);
45
-
46
- &:before {
47
- content: '';
48
- position: absolute;
49
- top: 2px;
50
- left: -23px;
51
- height: 1.25rem;
52
- width: 1.25rem;
53
- background-color: var(--primary-main);
54
- border: 1px solid var(--primary-main);
55
- border-radius: 50%;
56
- box-sizing: border-box;
39
+ &.active {
40
+ .e-radio-label {
41
+ input[type='radio']:after {
42
+ border: 5px solid var(--primary-main);
43
+ }
44
+ .e-radio-label__label {
45
+ color: var(--primary-main);
46
+ }
47
+ }
57
48
  }
58
49
 
59
- &:after {
60
- content: '';
61
- position: absolute;
62
- top: 0.5rem;
63
- left: -17px;
64
- display: block;
65
- height: 0.5rem;
66
- width: 0.5rem;
67
- background: currentColor;
68
- border-radius: 50%;
69
- opacity: 1;
70
- transform: scale(1);
71
- color: #fff;
72
- transition: all 0.1s;
50
+ &:hover {
51
+ .e-radio-label {
52
+ input[type='radio']:after {
53
+ background-color: var(--primary-main-light-5);
54
+ }
55
+ }
73
56
  }
74
57
  }
75
58
 
76
- + label {
77
- cursor: pointer;
78
- font-size: 16px;
79
-
80
- &:before {
81
- content: '';
82
- position: absolute;
83
- left: -23px;
84
- top: 2px;
85
- height: 1.25rem;
86
- width: 1.25rem;
87
- border-radius: 50%;
88
- background-color: transparent;
89
- border: 1px solid var(--neutral-main);
90
- box-sizing: border-box;
91
- }
92
-
93
- &:after {
94
- position: absolute;
95
- top: 0.5rem;
96
- left: -17px;
97
- display: block;
98
- height: 0.5rem;
99
- width: 0.5rem;
100
- opacity: 0;
101
- transform: scale(0);
102
- color: var(--others-white);
103
- transition: all 0.1s;
104
- content: '';
105
- bottom: 0.5rem;
106
- border-radius: 50%;
107
- }
59
+ @include portrait-tablets {
60
+ gap: 0.5rem;
108
61
  }
109
62
  }
110
63
  }
@@ -178,62 +131,69 @@
178
131
  }
179
132
 
180
133
  @mixin iconStyles {
181
- .radio-icon {
182
- display: none;
134
+ .e-radio__inner {
135
+ display: flex;
136
+ flex-flow: row wrap;
137
+ margin-top: 1.5rem;
183
138
  }
184
- @include portrait-tablets {
185
- .e-radio__inner {
186
- display: flex;
187
- flex-flow: row wrap;
188
- margin-top: 1.5rem;
189
- }
190
139
 
191
- .radio-item-container {
192
- display: flex;
193
- width: 47%;
194
- border: 1px solid black;
195
- min-width: 80px;
196
- min-height: 3.5rem;
197
- margin-bottom: 0.5rem;
198
- border-radius: var(--global-border-radius);
199
- border-color: var(--neutral-neutral-4);
200
- cursor: pointer;
201
- }
140
+ .radio-item-container {
141
+ display: flex;
142
+ width: 47%;
143
+ border: 1px solid black;
144
+ min-width: 80px;
145
+ min-height: 3.5rem;
146
+ margin-bottom: 0.5rem;
147
+ border-radius: var(--global-border-radius);
148
+ border-color: var(--neutral-neutral-4);
149
+ cursor: pointer;
150
+ }
202
151
 
203
- .radio-item-container:not(:nth-child(2n + 0)) {
204
- margin-right: 0.5rem;
205
- }
152
+ .radio-item-container:not(:nth-child(2n + 0)) {
153
+ margin-right: 0.5rem;
154
+ }
206
155
 
207
- .radio-item-input {
208
- position: absolute;
209
- visibility: hidden;
210
- }
156
+ .radio-item-input {
157
+ position: absolute;
158
+ visibility: hidden;
159
+ }
211
160
 
212
- .radio-item-container.active {
213
- border: 2px solid var(--primary-main-dark-1);
214
- background-color: var(--neutral-neutral-5);
215
- }
161
+ .radio-item-container.active {
162
+ border: 2px solid var(--primary-main-dark-1);
163
+ background-color: var(--neutral-neutral-5);
164
+ }
216
165
 
217
- .radio-item-container:hover {
218
- background-color: var(--neutral-neutral-5);
219
- font-weight: bold;
220
- }
166
+ .radio-item-container:hover {
167
+ background-color: var(--neutral-neutral-5);
168
+ font-weight: bold;
169
+ }
221
170
 
222
- .e-radio-label {
223
- display: flex;
224
- align-items: center;
225
- padding: 0.25rem 1rem;
226
- width: 100%;
227
- }
171
+ .e-radio-label {
172
+ display: flex;
173
+ align-items: center;
174
+ padding: 0.25rem 1rem;
175
+ width: 100%;
176
+ }
228
177
 
229
- .radio-icon {
230
- display: block;
231
- margin-right: 1rem;
232
- }
178
+ .radio-icon {
179
+ display: block;
180
+ margin-right: 1rem;
233
181
  }
234
182
  }
235
183
 
236
184
  .e-radio {
185
+ .label {
186
+ color: var(--neutral-neutral-1);
187
+ margin-bottom: 1rem;
188
+ display: block;
189
+ }
190
+
191
+ &.default {
192
+ @include defaultStyles;
193
+ }
194
+
195
+ // por aqui
196
+
237
197
  label:first-child:not(.e-radio-label) {
238
198
  font-weight: bold;
239
199
  }
@@ -242,17 +202,6 @@
242
202
  width: 100%;
243
203
  }
244
204
 
245
- &.--regular {
246
- @media (max-width: #{$xs}) {
247
- @include regularStyles;
248
- }
249
- &:not(.--icons) {
250
- @media (min-width: #{$xs}) {
251
- @include regularStyles;
252
- }
253
- }
254
- }
255
-
256
205
  &.--tabs {
257
206
  @media (max-width: #{$xs}) {
258
207
  @include tabsStyles;
@@ -265,21 +214,19 @@
265
214
  }
266
215
 
267
216
  &.--icons {
268
- @include iconStyles;
217
+ @include mobile {
218
+ @include defaultStyles();
219
+ }
220
+ .radio-icon {
221
+ display: none;
222
+ }
223
+ @include portrait-tablets {
224
+ @include iconStyles;
225
+ }
269
226
  }
270
227
 
271
228
  &.--is-invalid,
272
229
  &.--group-invalid {
273
- &.--regular {
274
- input {
275
- & + label {
276
- &:before {
277
- border-color: var(--error-main);
278
- }
279
- }
280
- }
281
- }
282
-
283
230
  &.--tabs,
284
231
  &.--group-invalid {
285
232
  .e-radio__inner {
@@ -301,10 +248,6 @@
301
248
  }
302
249
  }
303
250
 
304
- .radio-group__label {
305
- color: var(--neutral-neutral-1);
306
- }
307
-
308
251
  .e-radio.radio--small.--tabs {
309
252
  input + label {
310
253
  font-size: 0.875rem;
@@ -316,24 +259,3 @@
316
259
  margin-bottom: 0;
317
260
  }
318
261
  }
319
-
320
- .e-radio.radio--narrow.--regular {
321
- .e-radio__inner {
322
- margin-top: 0.5rem;
323
- }
324
- }
325
-
326
- .e-radio.--regular.radio--regular--bare {
327
- .e-radio__inner {
328
- display: inline-block;
329
- margin-right: auto;
330
- text-align: left;
331
- width: auto;
332
- }
333
-
334
- .e-radio-label,
335
- .e-radio-label__label {
336
- display: block;
337
- margin-bottom: 0.75rem;
338
- }
339
- }
@@ -1,35 +1,39 @@
1
- import React, { type FC } from 'react'
1
+ import React from 'react'
2
2
 
3
+ import { RadioFormat, type RadioProps } from './RadioProps.types'
3
4
  import IconImage from '../IconImage/IconImage'
4
- import { type RadioProps } from './RadioProps.types'
5
5
  // import './Radio.scss'
6
6
 
7
- const Radio: FC<RadioProps> = (props) => {
8
- const optionalClassNames = {
9
- small: 'radio--small',
10
- narrow: 'radio--narrow',
11
- regularBare: 'radio--regular--bare'
12
- }
13
-
14
- const additionalClassNames = Object.keys(optionalClassNames)
15
- .filter((attribute) => props[attribute])
16
- .map((key) => optionalClassNames[key])
17
- .join(' ')
18
-
19
- const classNames = `e-radio ${props.class} ${!props.validate ? '--is-invalid' : ''} ${
20
- !props.isValidGroup ? '--group-invalid' : ''
21
- } ${additionalClassNames}`
22
- const TooltipObject = props.tooltip ? <p className='tooltip-form sans-serif --small'>{props.tooltip}</p> : ''
23
-
7
+ const Radio: React.FC<RadioProps> = ({
8
+ class: className,
9
+ format = RadioFormat.Default,
10
+ validate = false,
11
+ isValidGroup = false,
12
+ tooltip,
13
+ name,
14
+ label,
15
+ items,
16
+ value,
17
+ disabled = false,
18
+ help,
19
+ onChange
20
+ }) => {
21
+ const [classNameValue] = React.useState<string>(() => {
22
+ let value = `e-radio ${format}`
23
+ if (className) value += ` ${className}`
24
+ if (!validate) value += ' --is-invalid'
25
+ if (!isValidGroup) value += ' --group-invalid'
26
+ return value
27
+ })
24
28
  return (
25
- <div className={classNames}>
26
- <label htmlFor={props.name} className='radio-group__label'>
27
- {props.label}
29
+ <div className={classNameValue}>
30
+ <label htmlFor={name} className='sans-serif --medium --bold-weight label'>
31
+ {label}
28
32
  </label>
29
33
  <div className={'e-radio__inner'}>
30
- {props.items?.map((radio) => {
34
+ {items.map((radio) => {
31
35
  return (
32
- <div className={`radio-item-container ${radio.value === props.value ? 'active' : ''}`} key={radio.value}>
36
+ <div className={`radio-item-container ${radio.value === value ? 'active' : ''}`} key={radio.value}>
33
37
  <label className='e-radio-label' key={radio.value}>
34
38
  {radio.iconName !== undefined && radio.iconName !== '' && (
35
39
  <IconImage givenClass='radio-icon' iconName={radio.iconName} />
@@ -37,27 +41,27 @@ const Radio: FC<RadioProps> = (props) => {
37
41
  <input
38
42
  type='radio'
39
43
  className='radio-item-input'
40
- id={`${props.name}_${radio.value}`}
41
- name={props.name}
42
- onChange={props.onChange}
44
+ id={`${name}_${radio.value}`}
45
+ name={name}
46
+ onChange={onChange}
43
47
  value={radio.value}
44
- checked={radio.value === props.value}
45
- disabled={props.disabled}
48
+ checked={radio.value === value}
49
+ disabled={disabled}
46
50
  />
47
51
  <label
48
- className='e-radio-label__label'
49
- htmlFor={`${props.name}_${radio.value}`}
50
- data-qa={`${props.name}_${radio.value}`}
52
+ className='e-radio-label__label sans-serif --medium'
53
+ htmlFor={`${name}_${radio.value}`}
54
+ data-qa={`${name}_${radio.value}`}
51
55
  >
52
56
  {radio.label}
53
57
  </label>
54
- <div>{props.help}</div>
58
+ {help && <div>{help}</div>}
55
59
  </label>
56
60
  </div>
57
61
  )
58
62
  })}
59
63
  </div>
60
- {TooltipObject}
64
+ {tooltip ?? <p className='tooltip-form sans-serif --small'>{tooltip}</p>}
61
65
  </div>
62
66
  )
63
67
  }
@@ -1,18 +1,24 @@
1
1
  export interface RadioProps {
2
2
  id?: string;
3
- name?: string;
3
+ name: string;
4
4
  class?: string;
5
+ format?: RadioFormat;
5
6
  value?: string;
6
7
  tooltip?: string;
7
- label?: string;
8
+ label: string;
8
9
  help?: string;
9
10
  validate?: boolean;
10
11
  isValidGroup?: boolean;
11
12
  disabled?: boolean;
12
- items?: {
13
+ items: {
13
14
  value: string;
14
15
  label: string;
15
16
  iconName?: string;
16
17
  }[];
17
18
  onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
18
19
  }
20
+ export declare enum RadioFormat {
21
+ Default = "default",
22
+ Tabs = "--tabs",
23
+ Icons = "--icons"
24
+ }
@@ -1 +1,6 @@
1
- export {};
1
+ export var RadioFormat;
2
+ (function (RadioFormat) {
3
+ RadioFormat["Default"] = "default";
4
+ RadioFormat["Tabs"] = "--tabs";
5
+ RadioFormat["Icons"] = "--icons";
6
+ })(RadioFormat || (RadioFormat = {}));
@@ -1,14 +1,21 @@
1
1
  export interface RadioProps {
2
2
  id?: string
3
- name?: string
3
+ name: string
4
4
  class?: string
5
+ format?: RadioFormat
5
6
  value?: string
6
7
  tooltip?: string
7
- label?: string
8
+ label: string
8
9
  help?: string
9
10
  validate?: boolean
10
11
  isValidGroup?: boolean
11
12
  disabled?: boolean
12
- items?: { value: string; label: string; iconName?: string }[]
13
+ items: { value: string; label: string; iconName?: string }[]
13
14
  onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void
14
15
  }
16
+
17
+ export enum RadioFormat {
18
+ Default = 'default',
19
+ Tabs = '--tabs',
20
+ Icons = '--icons'
21
+ }
@@ -1,2 +1,2 @@
1
1
  export { default as Radio } from './Radio';
2
- export { type RadioProps } from './RadioProps.types';
2
+ export * from './RadioProps.types';
@@ -1 +1,2 @@
1
1
  export { default as Radio } from './Radio';
2
+ export * from './RadioProps.types';
@@ -1,2 +1,2 @@
1
1
  export { default as Radio } from './Radio'
2
- export { type RadioProps } from './RadioProps.types'
2
+ export * from './RadioProps.types'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@npm_leadtech/legal-lib-components",
3
- "version": "5.40.2",
3
+ "version": "5.42.0",
4
4
  "license": "ISC",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",