@maif/react-forms 1.1.3 → 1.1.4

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/esm/index.js CHANGED
@@ -178,13 +178,18 @@ const BooleanInput = React__default.forwardRef(({ onChange, value, readOnly }, r
178
178
  onChange === null || onChange === void 0 ? void 0 : onChange(value);
179
179
  }
180
180
  };
181
- return (React__default.createElement("div", { className: classNames({ ['mrf-cursor_pointer']: !readOnly, ['mrf-cursor_not_allowed']: readOnly }) },
182
- !!value && React__default.createElement("div", { className: classNames('mrf-content_switch_button_on'), onClick: () => handleClick(false) },
183
- React__default.createElement("div", { className: classNames('mrf-switch_button_on') })),
184
- !value && value !== null && React__default.createElement("div", { className: classNames('mrf-content_switch_button_off'), onClick: () => handleClick(true) },
185
- React__default.createElement("div", { className: classNames('mrf-switch_button_off') })),
186
- value === null && React__default.createElement("div", { className: classNames('mrf-content_switch_button_null'), onClick: () => handleClick(true) },
187
- React__default.createElement("div", { className: classNames('mrf-switch_button_null') }))));
181
+ let className = classNames("mrf-content_switch", {
182
+ "mrf-content_switch_button_on": !!value,
183
+ "mrf-content_switch_button_off": !value && value !== null,
184
+ "mrf-content_switch_button_null": value === null,
185
+ "mrf-cursor_pointer": !readOnly,
186
+ "mrf-cursor_not_allowed": readOnly,
187
+ });
188
+ let callback = () => handleClick(true);
189
+ if (!!value) {
190
+ callback = () => handleClick(false);
191
+ }
192
+ return React__default.createElement("input", { type: "checkbox", className: className, onChange: callback });
188
193
  });
189
194
 
190
195
  const Collapse = (props) => {
package/lib/index.css CHANGED
@@ -294,6 +294,10 @@
294
294
  margin-left: 5px;
295
295
  }
296
296
 
297
+ .mrf-content_switch {
298
+ appearance: none;
299
+ }
300
+
297
301
  .mrf-content_switch_button_on {
298
302
  width: 35px;
299
303
  height: 22px;
@@ -305,6 +309,18 @@
305
309
  justify-content: flex-end;
306
310
  }
307
311
 
312
+ .mrf-content_switch_button_on::before {
313
+ content: "";
314
+ cursor: pointer;
315
+ width: 20px;
316
+ height: 20px;
317
+ background-color: var(--form-bg-color, #fff);
318
+ border-radius: 20px;
319
+ border: 1px solid var(--success-hover-color, #1e7e34);
320
+ box-shadow: 1px 0px 5px 0px rgba(0, 0, 0, 0.3);
321
+ margin-top: -1px;
322
+ }
323
+
308
324
  .mrf-content_switch_button_off {
309
325
  width: 35px;
310
326
  height: 22px;
@@ -316,6 +332,18 @@
316
332
  justify-content: flex-start;
317
333
  }
318
334
 
335
+ .mrf-content_switch_button_off::before {
336
+ content: "";
337
+ background-color: var(--form-bg-color, #fff);
338
+ border-radius: 20px;
339
+ cursor: pointer;
340
+ width: 20px;
341
+ height: 20px;
342
+ border: 1px solid var(--error-hover-color, #bd2130);
343
+ box-shadow: 1px 0px 5px 0px rgba(0, 0, 0, 0.3);
344
+ margin-top: -1px;
345
+ }
346
+
319
347
  .mrf-content_switch_button_null {
320
348
  width: 35px;
321
349
  height: 22px;
@@ -327,34 +355,16 @@
327
355
  justify-content: flex-start;
328
356
  }
329
357
 
330
- .mrf-switch_button_on {
331
- cursor: pointer;
332
- width: 20px;
333
- height: 20px;
334
- background-color: var(--form-bg-color, #fff);
335
- border-radius: 20px;
336
- border: 1px solid var(--success-hover-color, #1e7e34);
337
- box-shadow: 1px 0px 5px 0px rgba(0, 0, 0, 0.3);
338
- }
339
-
340
- .mrf-switch_button_off {
358
+ .mrf-content_switch_button_null::before {
359
+ content: "";
341
360
  background-color: var(--form-bg-color, #fff);
342
361
  border-radius: 20px;
343
362
  cursor: pointer;
344
363
  width: 20px;
345
364
  height: 20px;
346
- border: 1px solid var(--error-hover-color, #bd2130);
347
- box-shadow: 1px 0px 5px 0px rgba(0, 0, 0, 0.3);
348
- }
349
-
350
- .mrf-switch_button_null {
351
- background-color: var(--form-bg-color, #fff);
352
- border-radius: 20px;
353
- cursor: pointer;
354
- width: 22px;
355
- height: 22px;
356
365
  margin-top: -1px;
357
366
  margin-left: -1px;
358
367
  border: 1px solid var(--neutral-hover-color, #5c636a);
359
368
  box-shadow: 1px 0px 5px 0px rgba(0, 0, 0, 0.3);
369
+ margin-top: -1px;
360
370
  }
package/lib/index.js CHANGED
@@ -214,13 +214,18 @@ const BooleanInput = React__default["default"].forwardRef(({ onChange, value, re
214
214
  onChange === null || onChange === void 0 ? void 0 : onChange(value);
215
215
  }
216
216
  };
217
- return (React__default["default"].createElement("div", { className: classNames__default["default"]({ ['mrf-cursor_pointer']: !readOnly, ['mrf-cursor_not_allowed']: readOnly }) },
218
- !!value && React__default["default"].createElement("div", { className: classNames__default["default"]('mrf-content_switch_button_on'), onClick: () => handleClick(false) },
219
- React__default["default"].createElement("div", { className: classNames__default["default"]('mrf-switch_button_on') })),
220
- !value && value !== null && React__default["default"].createElement("div", { className: classNames__default["default"]('mrf-content_switch_button_off'), onClick: () => handleClick(true) },
221
- React__default["default"].createElement("div", { className: classNames__default["default"]('mrf-switch_button_off') })),
222
- value === null && React__default["default"].createElement("div", { className: classNames__default["default"]('mrf-content_switch_button_null'), onClick: () => handleClick(true) },
223
- React__default["default"].createElement("div", { className: classNames__default["default"]('mrf-switch_button_null') }))));
217
+ let className = classNames__default["default"]("mrf-content_switch", {
218
+ "mrf-content_switch_button_on": !!value,
219
+ "mrf-content_switch_button_off": !value && value !== null,
220
+ "mrf-content_switch_button_null": value === null,
221
+ "mrf-cursor_pointer": !readOnly,
222
+ "mrf-cursor_not_allowed": readOnly,
223
+ });
224
+ let callback = () => handleClick(true);
225
+ if (!!value) {
226
+ callback = () => handleClick(false);
227
+ }
228
+ return React__default["default"].createElement("input", { type: "checkbox", className: className, onChange: callback });
224
229
  });
225
230
 
226
231
  const Collapse = (props) => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@maif/react-forms",
3
3
  "description": "Build react safe forms as fast as possible",
4
- "version": "1.1.3",
4
+ "version": "1.1.4",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/esm/index.js",
7
7
  "types": "lib/index.d.ts",