linear-react-components-ui 1.1.27-rc.0 → 1.1.27
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/lib/assets/styles/radio.scss +114 -87
- package/lib/radio/index.js +8 -7
- package/package.json +1 -1
|
@@ -4,153 +4,180 @@
|
|
|
4
4
|
$radio-button-checked-color: $component-selected-color;
|
|
5
5
|
$radio-button-border-color: rgba(0, 0, 0, 0.54);
|
|
6
6
|
$radio-button-size: 20px;
|
|
7
|
-
$radio-button-checked-size: 10px;
|
|
7
|
+
$radio-button-checked-size: 10px;
|
|
8
8
|
$radio-button-ripple-size: 15px;
|
|
9
9
|
|
|
10
|
+
:root {
|
|
11
|
+
--radio-small: 12px;
|
|
12
|
+
--radio-medium: 16px;
|
|
13
|
+
--radio-large: 20px;
|
|
14
|
+
--radio-border-size: 1px;
|
|
15
|
+
--radio-checked-blank-size: calc(var(--radio-border-size) * 6);
|
|
16
|
+
}
|
|
17
|
+
|
|
10
18
|
@keyframes ripple {
|
|
11
19
|
0% {
|
|
12
20
|
box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.0);
|
|
13
21
|
}
|
|
14
|
-
|
|
22
|
+
|
|
23
|
+
50% {
|
|
15
24
|
box-shadow: 0px 0px 0px $radio-button-ripple-size rgba(0, 0, 0, 0.1);
|
|
16
25
|
}
|
|
26
|
+
|
|
17
27
|
100% {
|
|
18
28
|
box-shadow: 0px 0px 0px $radio-button-ripple-size rgba(0, 0, 0, 0);
|
|
19
29
|
}
|
|
20
30
|
}
|
|
21
|
-
|
|
22
|
-
|
|
31
|
+
|
|
32
|
+
.radio-button {
|
|
33
|
+
display: flex;
|
|
34
|
+
align-items: center;
|
|
35
|
+
justify-content: flex-start;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.radio-component:disabled+.description:before {
|
|
39
|
+
background-color: #e5e5e5 !important;
|
|
23
40
|
}
|
|
24
41
|
|
|
25
42
|
.radio-component {
|
|
26
|
-
|
|
43
|
+
cursor: pointer;
|
|
44
|
+
|
|
45
|
+
&:disabled+.description:before {
|
|
27
46
|
background-color: rgb(229, 229, 229);
|
|
28
47
|
}
|
|
29
|
-
|
|
48
|
+
|
|
49
|
+
&:disabled+.description {
|
|
30
50
|
color: $font-color-disabled;
|
|
31
51
|
}
|
|
32
52
|
}
|
|
33
53
|
|
|
34
|
-
.radio-component:
|
|
35
|
-
|
|
36
|
-
position: absolute;
|
|
37
|
-
left: -9999px;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.radio-component:focus + label:before {
|
|
41
|
-
box-shadow: 0 0 2px 1px $radio-button-checked-color;
|
|
54
|
+
.radio-component:focus+label:before {
|
|
55
|
+
box-shadow: 0 0 2px 1px $radio-button-checked-color;
|
|
42
56
|
}
|
|
43
57
|
|
|
44
|
-
.radio-component:checked
|
|
45
|
-
.radio-component:not(:checked)
|
|
46
|
-
|
|
47
|
-
padding-left: 1.35rem;
|
|
58
|
+
.radio-component:checked+.description,
|
|
59
|
+
.radio-component:not(:checked)+.description {
|
|
60
|
+
text-indent: 0.375rem;
|
|
48
61
|
cursor: pointer;
|
|
49
62
|
line-height: 20px;
|
|
50
63
|
display: inline-block;
|
|
51
|
-
color: $font-color-soft;
|
|
64
|
+
color: $font-color-soft;
|
|
65
|
+
|
|
52
66
|
&.-medium {
|
|
53
|
-
padding-left: 1.6rem;
|
|
54
67
|
padding-top: 0.1rem;
|
|
55
68
|
}
|
|
69
|
+
|
|
56
70
|
&.-large {
|
|
57
|
-
padding-left: 1.875rem;
|
|
58
71
|
padding-top: 0.2rem;
|
|
59
72
|
}
|
|
60
73
|
}
|
|
61
74
|
|
|
62
|
-
.disabled
|
|
75
|
+
.disabled+.description {
|
|
63
76
|
@extend %component-menu-disabled;
|
|
64
77
|
}
|
|
65
78
|
|
|
66
|
-
.radio-component
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
top: 0;
|
|
72
|
-
border: 1px solid $component-border-color;
|
|
79
|
+
input.radio-component {
|
|
80
|
+
appearance: unset;
|
|
81
|
+
display: inline-flex;
|
|
82
|
+
align-items: center;
|
|
83
|
+
justify-content: center;
|
|
73
84
|
border-radius: 100%;
|
|
74
|
-
|
|
75
|
-
|
|
85
|
+
width: var(--radio-medium);
|
|
86
|
+
height: var(--radio-medium);
|
|
87
|
+
background-color: $default-color;
|
|
88
|
+
border: 1px solid $component-border-color;
|
|
76
89
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
top: 0.245rem;
|
|
88
|
-
left: 0.285rem;
|
|
89
|
-
}
|
|
90
|
-
.-large:before{
|
|
91
|
-
width: 24px;
|
|
92
|
-
height: 24px;
|
|
93
|
-
top: 0.245rem;
|
|
94
|
-
left: 0.285rem;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
.-small:after{
|
|
98
|
-
width: 8px;
|
|
99
|
-
height: 8px;
|
|
100
|
-
top: 0.23rem;
|
|
101
|
-
left: 0.27rem;
|
|
102
|
-
}
|
|
103
|
-
.-medium:after{
|
|
104
|
-
width: 12px;
|
|
105
|
-
height: 12px;
|
|
106
|
-
top: 0.24rem;
|
|
107
|
-
left: 0.26rem;
|
|
108
|
-
}
|
|
109
|
-
.-large:after{
|
|
110
|
-
width: 16px;
|
|
111
|
-
height: 16px;
|
|
112
|
-
top: 0.245rem;
|
|
113
|
-
left: 0.285rem;
|
|
90
|
+
&:checked {
|
|
91
|
+
border-color: $radio-button-checked-color;
|
|
92
|
+
|
|
93
|
+
&::after {
|
|
94
|
+
content: '';
|
|
95
|
+
width: calc(var(--radio-medium) - var(--radio-checked-blank-size));
|
|
96
|
+
height: calc(var(--radio-medium) - var(--radio-checked-blank-size));
|
|
97
|
+
border-radius: 100%;
|
|
98
|
+
background-color: $radio-button-checked-color;
|
|
99
|
+
}
|
|
114
100
|
}
|
|
115
|
-
}
|
|
116
101
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
102
|
+
&:hover:not(:disabled),
|
|
103
|
+
&:focus:not(:disabled) {
|
|
104
|
+
outline: 3px solid rgba(161, 13, 13, 0.35);
|
|
105
|
+
outline-offset: 0px;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
&:disabled {
|
|
109
|
+
cursor: not-allowed;
|
|
110
|
+
cursor: default;
|
|
111
|
+
background-color: $input-disabled-bg-color;
|
|
112
|
+
|
|
113
|
+
&:checked {
|
|
114
|
+
border-color: $font-color-disabled;
|
|
115
|
+
|
|
116
|
+
&::after {
|
|
117
|
+
background-color: $font-color-disabled;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
&[data-state-size="small"] {
|
|
123
|
+
width: var(--radio-small);
|
|
124
|
+
height: var(--radio-small);
|
|
125
|
+
|
|
126
|
+
&::after {
|
|
127
|
+
width: calc(var(--radio-small) - var(--radio-checked-blank-size));
|
|
128
|
+
height: calc(var(--radio-small) - var(--radio-checked-blank-size));
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
&[data-state-size="medium"] {
|
|
133
|
+
width: var(--radio-medium);
|
|
134
|
+
height: var(--radio-medium);
|
|
135
|
+
|
|
136
|
+
&::after {
|
|
137
|
+
width: calc(var(--radio-medium) - var(--radio-checked-blank-size));
|
|
138
|
+
height: calc(var(--radio-medium) - var(--radio-checked-blank-size));
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
&[data-state-size="large"] {
|
|
143
|
+
width: var(--radio-large);
|
|
144
|
+
height: var(--radio-large);
|
|
145
|
+
|
|
146
|
+
&::after {
|
|
147
|
+
width: calc(var(--radio-large) - var(--radio-checked-blank-size));
|
|
148
|
+
height: calc(var(--radio-large) - var(--radio-checked-blank-size));
|
|
149
|
+
}
|
|
150
|
+
}
|
|
125
151
|
}
|
|
126
152
|
|
|
127
|
-
.radio-component:not(:checked)
|
|
153
|
+
.radio-component:not(:checked)+.description:after {
|
|
128
154
|
opacity: 0;
|
|
129
155
|
-webkit-transform: scale(0);
|
|
130
156
|
transform: scale(0);
|
|
131
157
|
}
|
|
132
158
|
|
|
133
|
-
.radio-component:checked
|
|
159
|
+
.radio-component:checked+.description:after {
|
|
134
160
|
opacity: 1;
|
|
135
161
|
-webkit-transform: scale(1);
|
|
136
162
|
transform: scale(1);
|
|
137
163
|
}
|
|
138
164
|
|
|
139
165
|
.radio-button.-skeletonized {
|
|
140
|
-
|
|
141
|
-
|
|
166
|
+
|
|
167
|
+
>.radio-component:not(:checked)+.description,
|
|
168
|
+
>.radio-component:checked+.description {
|
|
142
169
|
cursor: initial;
|
|
143
170
|
}
|
|
144
171
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
172
|
+
>.radio-component:checked+.description:before,
|
|
173
|
+
>.radio-component:checked+.description:after,
|
|
174
|
+
>.radio-component:not(:checked)+.description:before,
|
|
175
|
+
>.radio-component:not(:checked)+.description:after {
|
|
149
176
|
@extend %skeleton-component;
|
|
150
177
|
border-color: transparent;
|
|
151
178
|
}
|
|
152
179
|
|
|
153
|
-
|
|
180
|
+
>.description>span {
|
|
154
181
|
@extend %skeleton-component;
|
|
155
182
|
}
|
|
156
|
-
}
|
|
183
|
+
}
|
package/lib/radio/index.js
CHANGED
|
@@ -4,11 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
8
7
|
require("../assets/styles/radio.scss");
|
|
9
|
-
var
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
9
|
var _popover = _interopRequireDefault(require("../popover"));
|
|
11
10
|
var _textContent = _interopRequireDefault(require("../textContent"));
|
|
11
|
+
var _permissionValidations = require("../permissionValidations");
|
|
12
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
13
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
14
14
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
@@ -52,6 +52,7 @@ const Radio = _ref => {
|
|
|
52
52
|
if (checked !== isChecked) setIsChecked(checked);
|
|
53
53
|
}, [checked]);
|
|
54
54
|
const shouldDisable = () => disabled || !!onDenied.disabled || skeletonize;
|
|
55
|
+
const hasLabel = !!label;
|
|
55
56
|
const getCustomProps = () => {
|
|
56
57
|
let customProps = {};
|
|
57
58
|
const checkProps = defaultChecked && !checked ? {
|
|
@@ -64,7 +65,6 @@ const Radio = _ref => {
|
|
|
64
65
|
customProps = _objectSpread(_objectSpread({}, customProps), {}, {
|
|
65
66
|
onChange: e => onChange(e),
|
|
66
67
|
onKeyDown: null,
|
|
67
|
-
role: 'button',
|
|
68
68
|
tabIndex: '0'
|
|
69
69
|
});
|
|
70
70
|
}
|
|
@@ -87,10 +87,11 @@ const Radio = _ref => {
|
|
|
87
87
|
id: id,
|
|
88
88
|
name: name,
|
|
89
89
|
required: required,
|
|
90
|
-
disabled: shouldDisable()
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
htmlFor: id
|
|
90
|
+
disabled: shouldDisable(),
|
|
91
|
+
"data-state-size": size
|
|
92
|
+
})), hasLabel && /*#__PURE__*/_react.default.createElement("label", {
|
|
93
|
+
htmlFor: id,
|
|
94
|
+
className: "description ".concat(size && "-".concat(size))
|
|
94
95
|
}, /*#__PURE__*/_react.default.createElement("span", null, /*#__PURE__*/_react.default.createElement(_textContent.default, {
|
|
95
96
|
required: required,
|
|
96
97
|
disabled: shouldDisable(),
|