@steroidsjs/bootstrap 3.0.30 → 3.0.34

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 (48) hide show
  1. package/content/Accordion/AccordionItemView.js +0 -1
  2. package/content/Accordion/AccordionItemView.scss +56 -7
  3. package/content/Accordion/AccordionView.scss +2 -0
  4. package/content/Calendar/CalendarView.js +8 -3
  5. package/content/Calendar/CalendarView.scss +2 -2
  6. package/form/CheckboxListField/CheckboxListFieldView.js +1 -1
  7. package/form/DateRangeField/DateRangeFieldView.js +10 -1
  8. package/form/DateRangeField/DateRangeFieldView.scss +54 -0
  9. package/form/DateRangeField/views/RangeButtons/RangeButtons.d.ts +11 -0
  10. package/form/DateRangeField/views/RangeButtons/RangeButtons.js +60 -0
  11. package/form/DateRangeField/views/RangeButtons/RangeButtons.scss +126 -0
  12. package/form/DateRangeField/views/RangeButtons/consts.d.ts +34 -0
  13. package/form/DateRangeField/views/RangeButtons/consts.js +71 -0
  14. package/form/DateRangeField/views/RangeButtons/index.d.ts +2 -0
  15. package/form/DateRangeField/views/RangeButtons/index.js +7 -0
  16. package/form/DateRangeField/views/RangeButtons/utils.d.ts +14 -0
  17. package/form/DateRangeField/views/RangeButtons/utils.js +36 -0
  18. package/form/DateTimeRangeField/DateTimeRangeFieldView.js +12 -3
  19. package/form/DateTimeRangeField/DateTimeRangeFieldView.scss +54 -0
  20. package/form/DropDownField/DropDownFieldView.js +54 -35
  21. package/form/DropDownField/DropDownFieldView.scss +57 -45
  22. package/form/InputField/InputFieldView.js +4 -4
  23. package/form/InputField/InputFieldView.scss +128 -174
  24. package/form/RadioField/RadioFieldView.d.ts +2 -2
  25. package/form/RadioListField/RadioListFieldView.d.ts +2 -2
  26. package/form/RadioListField/RadioListFieldView.js +1 -1
  27. package/form/SwitcherField/SwitcherFieldView.d.ts +2 -2
  28. package/form/SwitcherField/SwitcherFieldView.js +17 -35
  29. package/form/SwitcherField/SwitcherFieldView.scss +63 -69
  30. package/form/SwitcherListField/SwitcherListFieldView.d.ts +3 -0
  31. package/form/SwitcherListField/SwitcherListFieldView.js +54 -0
  32. package/form/SwitcherListField/SwitcherListFieldView.scss +9 -0
  33. package/hooks/index.d.ts +2 -0
  34. package/hooks/index.js +8 -0
  35. package/hooks/useHideScroll.d.ts +1 -0
  36. package/hooks/useHideScroll.js +37 -0
  37. package/icons/index.js +2 -0
  38. package/icons/svgs/long-arrow-alt-down.svg +3 -0
  39. package/icons/svgs/long-arrow-alt-up.svg +3 -0
  40. package/index.d.ts +3 -0
  41. package/index.js +3 -0
  42. package/index.scss +1 -0
  43. package/list/Grid/GridView.js +2 -3
  44. package/list/Grid/GridView.scss +46 -0
  45. package/modal/Modal/ModalView.js +3 -1
  46. package/modal/Modal/ModalView.scss +0 -5
  47. package/package.json +2 -2
  48. package/scss/normalize.scss +5 -0
@@ -24,16 +24,74 @@ $lead-icon-disabled-color: var(--lead-icon-disabled-color);
24
24
  flex-flow: row nowrap;
25
25
  align-items: center;
26
26
 
27
- height: 34px;
27
+ height: var(--input-height);
28
+
28
29
 
29
30
  font-family: variables.$font-family-nunito;
30
31
  font-weight: variables.$font-weight-sm;
31
32
  line-height: 24px;
32
33
 
34
+ color: variables.$text-color;
35
+ border-radius: var(--border-radius);
36
+
37
+
38
+ --input-height: #{variables.$input-height-sm};
39
+
40
+ --border-radius: #{variables.$radius-small};
41
+
42
+ --colored-border-radius: 12px;
43
+
44
+ --addon-padding: 5px 8px;
45
+
46
+ --input-font-size: #{variables.$font-size-sm};
47
+
48
+ //Sizes
49
+ &_size {
50
+ &_lg {
51
+ --input-height: #{variables.$input-height-lg};
52
+ --border-radius: #{variables.$radius-large};
53
+ --colored-border-radius: 16px;
54
+ --addon-padding: 16px;
55
+ --input-font-size: #{variables.$font-size-lg};
56
+ --input-border-radius: #{variables.$radius-large};
57
+ }
58
+
59
+ &_md {
60
+ --input-height: #{variables.$input-height-md};
61
+ --border-radius: #{variables.$radius-large};
62
+ --colored-border-radius: 16px;
63
+ --addon-padding: 11px 12px;
64
+ --input-font-size: #{variables.$font-size-base};
65
+ --input-border-radius: #{variables.$radius-large};
66
+ }
67
+ }
68
+
33
69
  &__input-wrapper {
70
+ display: flex;
71
+
34
72
  position: relative;
35
73
  width: 100%;
36
74
  height: 100%;
75
+
76
+ &::before {
77
+ content: '';
78
+ position: absolute;
79
+ z-index: 2;
80
+ top: 0;
81
+ left: 0;
82
+ width: 100%;
83
+ height: 100%;
84
+
85
+ pointer-events: none;
86
+ transform: translate(calc(var(--input-wrapper-border-width) * -1), calc(var(--input-wrapper-border-width) * -1));
87
+ opacity: var(--input-wrapper-border-opacity);
88
+ transition: opacity 150ms ease-in-out;
89
+
90
+ border-radius: var(--colored-border-radius);
91
+ border-width: var(--input-wrapper-border-width);
92
+ border-color: var(--input-wrapper-border-color);
93
+ border-style: solid;
94
+ }
37
95
  }
38
96
 
39
97
  &__input {
@@ -47,170 +105,34 @@ $lead-icon-disabled-color: var(--lead-icon-disabled-color);
47
105
  outline: none;
48
106
 
49
107
  background-color: variables.$element-field-background-color;
50
- border: 1px solid variables.$element-border-color;
51
- border-radius: inherit;
108
+ border-width: var(--input-border-width);
109
+ border-color: var(--input-border-color);
110
+ border-top-left-radius: var(--input-left-border-radius);
111
+ border-bottom-left-radius: var(--input-left-border-radius);
112
+ border-top-right-radius: var(--input-right-border-radius);
113
+ border-bottom-right-radius: var(--input-right-border-radius);
114
+ border-style: solid;
52
115
 
53
116
  white-space: nowrap; /* Запретить перенос текста */
54
117
  overflow: hidden; /* Скрыть содержимое, выходящее за границы ячейки */
55
118
  text-overflow: ellipsis; /* Добавить многоточие, если текст обрезается */
56
119
 
120
+ font-size: var(--input-font-size);
121
+
57
122
  &::placeholder {
58
123
  color: variables.$element-placeholder-color;
59
124
  font-size: inherit;
60
125
  }
61
126
 
62
- &:not(:disabled):focus {
63
- border-color: transparent;
64
- }
65
- }
66
-
67
- //Statements
68
- &::before {
69
- content: '';
70
- position: absolute;
71
- z-index: 2;
72
- top: 0;
73
- left: 0;
74
- width: 100%;
75
- height: 100%;
76
-
77
- pointer-events: none;
78
- transform: translate(-1px, -1px);
79
- opacity: 0;
80
- transition: opacity 150ms ease-in-out;
81
- }
82
-
83
- &:not(#{$root}_disabled):focus-within::before {
84
- border: 4px solid variables.$primary-light;
85
- transform: translateX(-4px) translateY(-4px);
86
- opacity: 1;
87
- }
88
-
89
- &:not(#{$root}_disabled):active {
90
- #{$root}__input {
91
- border-color: transparent;
92
- }
93
-
94
- &::before {
95
- transform: translate(-1px, -1px);
96
- border: 1px solid variables.$primary;
97
- opacity: 1;
98
- }
99
127
  }
100
128
 
101
129
  &_disabled {
102
130
  #{$root}__input {
103
131
  background-color: variables.$element-background-color-disabled;
104
- border-color: transparent;
105
132
  cursor: not-allowed;
106
133
  }
107
134
  }
108
135
 
109
- &_hasError {
110
- #{$root}__input {
111
- border-color: transparent;
112
- }
113
-
114
-
115
- &::before {
116
- border: 1px solid variables.$danger;
117
- border-radius: 16px;
118
- transform: translateX(-1px) translateY(-1px);
119
- opacity: 1;
120
- }
121
- }
122
-
123
- //Sizes
124
- &_size {
125
- &_lg {
126
- color: variables.$text-color;
127
- height: variables.$input-height-lg;
128
- border-radius: variables.$radius-large;
129
-
130
- #{$root}__input {
131
- font-size: variables.$font-size-lg;
132
- border-radius: variables.$radius-large;
133
- }
134
-
135
- #{$root}__addon-before,
136
- #{$root}__addon-after {
137
- padding: 16px;
138
- }
139
- #{$root}__text-before,
140
- #{$root}__text-after {
141
- padding: 16px 3px;
142
- }
143
-
144
- &::before {
145
- border-radius: variables.$radius-large;
146
- }
147
-
148
- &:focus-within::before {
149
- border-radius: 16px;
150
- }
151
- }
152
-
153
- &_md {
154
- color: variables.$text-color;
155
- height: variables.$input-height-md;
156
- border-radius: variables.$radius-large;
157
-
158
- #{$root}__input {
159
- border-radius: variables.$radius-large;
160
- font-size: variables.$font-size-base;
161
- }
162
-
163
- #{$root}__addon-before,
164
- #{$root}__addon-after,
165
- #{$root}__text-before,
166
- #{$root}__text-after {
167
- padding: 11px 12px;
168
- }
169
-
170
- #{$root}__text-before,
171
- #{$root}__text-after {
172
- padding: 11px 3px;
173
- }
174
-
175
- &::before {
176
- border-radius: variables.$radius-medium;
177
- }
178
-
179
- &:focus-within::before {
180
- border-radius: 16px;
181
- }
182
- }
183
-
184
- &_sm {
185
- color: variables.$text-color;
186
- height: variables.$input-height-sm;
187
- border-radius: variables.$radius-small;
188
-
189
- #{$root}__input {
190
- font-size: variables.$font-size-sm;
191
- border-radius: variables.$radius-small;
192
- }
193
-
194
- #{$root}__addon-before,
195
- #{$root}__addon-after {
196
- padding: 5px 8px;
197
- }
198
-
199
- #{$root}__text-before,
200
- #{$root}__text-after {
201
- padding: 5px 3px;
202
- }
203
-
204
- &::before {
205
- border-radius: variables.$radius-small;
206
- }
207
-
208
- &:focus-within::before {
209
- border-radius: 12px;
210
- }
211
- }
212
- }
213
-
214
136
  //LEAD ICON
215
137
  &_hasLeadIcon {
216
138
  #{$root}__input {
@@ -279,49 +201,81 @@ $lead-icon-disabled-color: var(--lead-icon-disabled-color);
279
201
  }
280
202
  }
281
203
 
282
- &_hasAddonBefore {
283
- #{$root}__input {
284
- border-top-left-radius: 0;
285
- border-bottom-left-radius: 0;
286
- border: none;
287
- }
288
- &::before {
289
- border: 1px solid variables.$element-border-color;
290
- opacity: 1;
291
- }
292
- }
293
-
294
- &_hasAddonAfter {
295
- #{$root}__input {
296
- border-top-right-radius: 0;
297
- border-bottom-right-radius: 0;
298
- }
299
- &::before {
300
- border: 1px solid variables.$element-border-color;
301
- opacity: 1;
302
- }
303
- }
304
-
305
204
  &__text-before,
306
205
  &__text-after {
307
206
  flex-shrink: 0;
207
+ padding: 0 6px;
308
208
  }
309
209
 
310
210
  &__addon-before,
311
211
  &__addon-after {
312
212
  flex-shrink: 0;
313
- padding: 11px 12px;
213
+ padding: var(--addon-padding);
314
214
  background-color: variables.$element-background-color-disabled;
315
215
  color: variables.$text-color;
316
216
  }
317
217
 
218
+ // BORDERS
219
+ --input-border-radius: #{variables.$radius-small};
220
+ --input-border-width: 1px;
221
+ --input-border-color: #{variables.$element-border-color};
222
+ --input-left-border-radius: var(--input-border-radius);
223
+ --input-right-border-radius: var(--input-border-radius);
224
+
225
+ --input-wrapper-border-width: 1px;
226
+ --input-wrapper-border-color: transparent;
227
+ --input-wrapper-border-opacity: 0;
228
+
229
+ &_hasError {
230
+ --input-wrapper-border-width: 1px;
231
+ --input-wrapper-border-color: #{variables.$danger};
232
+ --input-wrapper-border-opacity: 1;
233
+
234
+ --input-border-color: transparent;
235
+ }
236
+
237
+ &_hasAddon {
238
+ --input-wrapper-border-width: 1px;
239
+ --input-wrapper-border-color: #{variables.$element-border-color};
240
+ --input-wrapper-border-opacity: 1;
241
+
242
+ --input-border-width: 0px;
243
+ }
244
+ &_hasAddonBefore {
245
+ --input-left-border-radius: 0;
246
+ }
247
+ &_hasAddonAfter {
248
+ --input-right-border-radius: 0;
249
+ }
250
+
251
+ &:not(&_disabled) {
252
+ &:focus-within {
253
+ --input-wrapper-border-width: 4px;
254
+ --input-wrapper-border-color: #{variables.$primary-light};
255
+ --input-wrapper-border-opacity: 1;
256
+
257
+ --input-border-color: transparent;
258
+ }
259
+ &:active {
260
+ --input-wrapper-border-width: 1px;
261
+ --input-wrapper-border-color: #{variables.$primary};
262
+ --input-wrapper-border-opacity: 1;
263
+
264
+ --input-border-color: transparent;
265
+ }
266
+ }
267
+
268
+ &_disabled {
269
+ --input-border-color: transparent;
270
+ }
271
+
318
272
  &__addon-before {
319
- border-top-left-radius: inherit;
320
- border-bottom-left-radius: inherit;
273
+ border-top-left-radius: var(--input-border-radius);
274
+ border-bottom-left-radius: var(--input-border-radius);
321
275
  }
322
276
 
323
277
  &__addon-after {
324
- border-top-right-radius: inherit;
325
- border-bottom-right-radius: inherit;
278
+ border-top-right-radius: var(--input-border-radius);
279
+ border-bottom-right-radius: var(--input-border-radius);
326
280
  }
327
281
  }
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
- import { IRadioFieldViewProps } from '@steroidsjs/core/ui/form/RadioField/RadioField';
3
- export default function RadioFieldView(props: IRadioFieldViewProps): JSX.Element;
2
+ import { ICheckboxFieldViewProps } from '@steroidsjs/core/ui/form/CheckboxField/CheckboxField';
3
+ export default function RadioFieldView(props: ICheckboxFieldViewProps): JSX.Element;
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
- import { IRadioListFieldViewProps } from '@steroidsjs/core/ui/form/RadioListField/RadioListField';
3
- export default function RadioListFieldView(props: IRadioListFieldViewProps): JSX.Element;
2
+ import { ICheckboxListFieldViewProps } from '@steroidsjs/core/ui/form/CheckboxListField/CheckboxListField';
3
+ export default function RadioListFieldView(props: ICheckboxListFieldViewProps): JSX.Element;
@@ -35,7 +35,7 @@ function RadioListFieldView(props) {
35
35
  var prefix = (0, useUniqueId_1["default"])('radio');
36
36
  return (React.createElement("div", { className: bem(bem.block((_a = {},
37
37
  _a["".concat(props.orientation)] = !!props.orientation,
38
- _a)), props.className) }, props.items.map(function (radio, radioIndex) { return props.renderRadio({
38
+ _a)), props.className) }, props.items.map(function (radio, radioIndex) { return props.renderItem({
39
39
  key: radioIndex,
40
40
  id: "".concat(prefix, "_").concat(radio.id),
41
41
  label: radio.label,
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
- import { ISwitcherFieldViewProps } from '@steroidsjs/core/ui/form/SwitcherField/SwitcherField';
3
- export default function SwitcherFieldView(props: ISwitcherFieldViewProps): JSX.Element;
2
+ import { ICheckboxFieldViewProps } from '@steroidsjs/core/ui/form/CheckboxField/CheckboxField';
3
+ export default function SwitcherFieldView(props: ICheckboxFieldViewProps): JSX.Element;
@@ -10,46 +10,28 @@ var __assign = (this && this.__assign) || function () {
10
10
  };
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
- if (k2 === undefined) k2 = k;
15
- var desc = Object.getOwnPropertyDescriptor(m, k);
16
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
- desc = { enumerable: true, get: function() { return m[k]; } };
18
- }
19
- Object.defineProperty(o, k2, desc);
20
- }) : (function(o, m, k, k2) {
21
- if (k2 === undefined) k2 = k;
22
- o[k2] = m[k];
23
- }));
24
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
- Object.defineProperty(o, "default", { enumerable: true, value: v });
26
- }) : function(o, v) {
27
- o["default"] = v;
28
- });
29
- var __importStar = (this && this.__importStar) || function (mod) {
30
- if (mod && mod.__esModule) return mod;
31
- var result = {};
32
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
33
- __setModuleDefault(result, mod);
34
- return result;
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
35
15
  };
36
16
  exports.__esModule = true;
37
- var React = __importStar(require("react"));
17
+ var react_1 = __importDefault(require("react"));
38
18
  var hooks_1 = require("@steroidsjs/core/hooks");
39
19
  function SwitcherFieldView(props) {
40
20
  var bem = (0, hooks_1.useBem)('SwitcherFieldView');
41
- var prefix = (0, hooks_1.useUniqueId)('switcher');
42
- var renderLabel = React.useCallback(function (item) {
43
- if (typeof item.label === 'object') {
44
- return props.selectedIds.includes(item.id) ? item.label.checked : item.label.unchecked;
21
+ var uniqueId = (0, hooks_1.useUniqueId)('switcher');
22
+ var renderLabel = react_1["default"].useCallback(function () {
23
+ if (typeof props.label === 'object') {
24
+ return props.inputProps.checked ? props.label.checked : props.label.unchecked;
45
25
  }
46
- return item.label;
47
- }, [props.selectedIds]);
48
- return (React.createElement("div", { className: bem(bem.block(), props.className), style: props.style }, props.items.map(function (switcher, switcherIndex) { return (React.createElement("label", { key: switcherIndex, className: bem.element('switcher', {
49
- size: props.size
50
- }), htmlFor: "".concat(prefix, "_").concat(switcher.id) },
51
- React.createElement("input", __assign({}, props.inputProps, { id: "".concat(prefix, "_").concat(switcher.id), onChange: function () { return props.onItemSelect(switcher.id); }, checked: props.selectedIds.includes(switcher.id), className: bem.element('input'), required: switcher.required })),
52
- React.createElement("span", { className: bem.element('slider') }),
53
- React.createElement("span", { className: bem.element('label') }, renderLabel(switcher)))); })));
26
+ return props.label;
27
+ }, [props.inputProps.checked, props.label]);
28
+ var customVariableColorStyle = { '--checkbox-custom-color': props.color };
29
+ return (react_1["default"].createElement("div", { className: bem(bem.block({
30
+ size: props.size,
31
+ hasErrors: !!props.errors
32
+ }), props.className), style: __assign(__assign({}, props.style), customVariableColorStyle), onClick: props.onChange },
33
+ react_1["default"].createElement("input", __assign({ id: props.id || uniqueId, disabled: props.disabled, required: props.required, onChange: function () { return props.onItemSelect(props.id); }, className: bem.element('input') }, props.inputProps)),
34
+ react_1["default"].createElement("span", { className: bem.element('slider') }),
35
+ react_1["default"].createElement("span", { className: bem.element('label') }, renderLabel())));
54
36
  }
55
37
  exports["default"] = SwitcherFieldView;
@@ -1,5 +1,5 @@
1
1
  @use "sass:map";
2
- @use "../../scss/variables";
2
+ @use 'style/variables';
3
3
 
4
4
  :root {
5
5
  --switcher-dot-disabled-color: #dbe2e6;
@@ -11,85 +11,79 @@ html[data-theme="dark"] {
11
11
  --switcher-slider-disabled-color: #5b5c6b;
12
12
  }
13
13
 
14
+
14
15
  $switcher-dot-disabled-color: var(--switcher-dot-disabled-color);
15
16
  $switcher-slider-disabled-color: var(--switcher-slider-disabled-color);
16
17
 
17
18
  $background-color-transition-timing: 150ms;
18
19
 
19
-
20
20
  .SwitcherFieldView {
21
21
  $root: &;
22
- display: flex;
23
- flex-flow: column nowrap;
24
- align-items: flex-start;
25
- row-gap: 10px;
26
-
27
- &__switcher {
28
- display: inline-flex;
29
- column-gap: 12px;
30
- align-items: center;
31
- position: relative;
32
- cursor: pointer;
33
22
 
34
- $sizes: () !default;
35
- $sizes: map.merge(
36
- (
37
- "lg": (
38
- "width": 40px,
39
- "height": 24px,
40
- "dotSize": 18px,
41
- "dotTranslateDefault": translateY(-50%) translateX(4px),
42
- "dotTranslateActive": translateY(-50%) translateX(16px),
43
- "font-size": variables.$font-size-lg,
44
- "line-height": variables.$line-height-lg,
45
- ),
46
- "md": (
47
- "width": 34px,
48
- "height": 20px,
49
- "dotSize": 14px,
50
- "dotTranslateDefault": translateY(-50%) translateX(3px),
51
- "dotTranslateActive": translateY(-50%) translateX(15px),
52
- "font-size": variables.$font-size-base,
53
- "line-height": variables.$line-height-base,
54
- ),
55
- "sm": (
56
- "width": 28px,
57
- "height": 16px,
58
- "dotSize": 12px,
59
- "dotTranslateDefault": translateY(-50%) translateX(2px),
60
- "dotTranslateActive": translateY(-50%) translateX(12px),
61
- "font-size": variables.$font-size-sm,
62
- "line-height": variables.$line-height-sm,
63
- ),
23
+ display: inline-flex;
24
+ column-gap: 12px;
25
+ align-items: center;
26
+ position: relative;
27
+ cursor: pointer;
28
+
29
+ $sizes: () !default;
30
+ $sizes: map.merge(
31
+ (
32
+ "lg": (
33
+ "width": 40px,
34
+ "height": 24px,
35
+ "dotSize": 18px,
36
+ "dotTranslateDefault": translateY(-50%) translateX(4px),
37
+ "dotTranslateActive": translateY(-50%) translateX(16px),
38
+ "font-size": variables.$font-size-lg,
39
+ "line-height": variables.$line-height-lg,
64
40
  ),
65
- $sizes
66
- );
67
-
68
- &_size {
69
- @each $size, $sizeMap in $sizes {
70
- &_#{$size} {
71
- #{$root}__slider {
72
- width: map.get($sizeMap, width);
73
- height: map.get($sizeMap, height);
74
-
75
- &::before {
76
- width: map.get($sizeMap, dotSize);
77
- height: map.get($sizeMap, dotSize);
78
- transform: map.get($sizeMap, dotTranslateDefault);
79
- }
80
- }
81
-
82
- #{$root}__input:checked + #{$root}__slider {
83
- &::before {
84
- transform: map.get($sizeMap, dotTranslateActive);
85
- }
41
+ "md": (
42
+ "width": 34px,
43
+ "height": 20px,
44
+ "dotSize": 14px,
45
+ "dotTranslateDefault": translateY(-50%) translateX(3px),
46
+ "dotTranslateActive": translateY(-50%) translateX(15px),
47
+ "font-size": variables.$font-size-base,
48
+ "line-height": variables.$line-height-base,
49
+ ),
50
+ "sm": (
51
+ "width": 28px,
52
+ "height": 16px,
53
+ "dotSize": 12px,
54
+ "dotTranslateDefault": translateY(-50%) translateX(2px),
55
+ "dotTranslateActive": translateY(-50%) translateX(12px),
56
+ "font-size": variables.$font-size-sm,
57
+ "line-height": variables.$line-height-sm,
58
+ ),
59
+ ),
60
+ $sizes
61
+ );
62
+
63
+ &_size {
64
+ @each $size, $sizeMap in $sizes {
65
+ &_#{$size} {
66
+ #{$root}__slider {
67
+ width: map.get($sizeMap, width);
68
+ height: map.get($sizeMap, height);
69
+
70
+ &::before {
71
+ width: map.get($sizeMap, dotSize);
72
+ height: map.get($sizeMap, dotSize);
73
+ transform: map.get($sizeMap, dotTranslateDefault);
86
74
  }
87
-
88
- #{$root}__label {
89
- font-size: map.get($sizeMap, font-size);
90
- line-height: map.get($sizeMap, line-height);
75
+ }
76
+
77
+ #{$root}__input:checked + #{$root}__slider {
78
+ &::before {
79
+ transform: map.get($sizeMap, dotTranslateActive);
91
80
  }
92
81
  }
82
+
83
+ #{$root}__label {
84
+ font-size: map.get($sizeMap, font-size);
85
+ line-height: map.get($sizeMap, line-height);
86
+ }
93
87
  }
94
88
  }
95
89
  }
@@ -190,4 +184,4 @@ $background-color-transition-timing: 150ms;
190
184
  &__label {
191
185
  color: variables.$text-color;
192
186
  }
193
- }
187
+ }
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { ICheckboxListFieldViewProps } from '@steroidsjs/core/ui/form/CheckboxListField/CheckboxListField';
3
+ export default function SwitcherListFieldView(props: ICheckboxListFieldViewProps): JSX.Element;
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ exports.__esModule = true;
29
+ var React = __importStar(require("react"));
30
+ var hooks_1 = require("@steroidsjs/core/hooks");
31
+ var SwitcherFieldView_1 = __importDefault(require("../SwitcherField/SwitcherFieldView"));
32
+ function SwitcherListFieldView(props) {
33
+ var bem = (0, hooks_1.useBem)('SwitcherListFieldView');
34
+ var prefix = (0, hooks_1.useUniqueId)('switcher');
35
+ return (React.createElement("div", { className: bem(bem.block(), props.className), style: props.style }, props.items.map(function (checkbox, checkboxIndex) { return props.renderItem({
36
+ key: checkboxIndex,
37
+ id: "".concat(prefix, "_").concat(checkbox.id),
38
+ label: checkbox.label,
39
+ inputProps: {
40
+ name: "".concat(prefix, "_").concat(checkbox.id),
41
+ type: 'checkbox',
42
+ checked: props.selectedIds.includes(checkbox.id),
43
+ onChange: function () {
44
+ props.onItemSelect(checkbox.id);
45
+ },
46
+ disabled: props.disabled || checkbox.disabled
47
+ },
48
+ size: checkbox.size || props.size,
49
+ color: checkbox.color,
50
+ required: checkbox.required,
51
+ view: SwitcherFieldView_1["default"]
52
+ }); })));
53
+ }
54
+ exports["default"] = SwitcherListFieldView;