linear-react-components-ui 1.1.25-beta.7 → 1.1.25-beta.8

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 (59) hide show
  1. package/lib/{BaseMask-0c14ef51.d.ts → BaseMask-78847f45.d.ts} +1 -1
  2. package/lib/{Cnpj-53bfd6ab.d.ts → Cnpj-8366781f.d.ts} +1 -2
  3. package/lib/{Cpf-019b21e0.d.ts → Cpf-3dfd54eb.d.ts} +1 -2
  4. package/lib/{Phone-2bb0b397.d.ts → Phone-1962c0f2.d.ts} +1 -1
  5. package/lib/{ZipCode-09460e18.d.ts → ZipCode-be9c5b3b.d.ts} +1 -1
  6. package/lib/assets/styles/split.scss +1 -1
  7. package/lib/form2/useForm/index.js +21 -8
  8. package/lib/{index-3b70931d.d.ts → index-02a27c19.d.ts} +2 -20
  9. package/lib/index-053f615b.d.ts +26 -0
  10. package/lib/{index-7dfa8924.d.ts → index-25b80f32.d.ts} +1 -1
  11. package/lib/{index-9e576346.d.ts → index-6f5c772d.d.ts} +1 -1
  12. package/lib/{index-208e7f62.d.ts → index-6fcf446c.d.ts} +2 -20
  13. package/lib/index-7159df18.d.ts +21 -0
  14. package/lib/inputs2/checkboxfield/base.d.ts +29 -0
  15. package/lib/inputs2/checkboxfield/base.js +134 -0
  16. package/lib/inputs2/checkboxfield/index.d.ts +3 -2
  17. package/lib/inputs2/checkboxfield/index.js +32 -125
  18. package/lib/inputs2/colorfield/index.d.ts +6 -5
  19. package/lib/inputs2/date/datefield/base.d.ts +13 -0
  20. package/lib/inputs2/date/datefield/base.js +330 -0
  21. package/lib/inputs2/date/datefield/index.js +34 -322
  22. package/lib/inputs2/date/datefield/types.d.ts +5 -3
  23. package/lib/inputs2/date/dateperiodfield/base.d.ts +13 -0
  24. package/lib/inputs2/date/dateperiodfield/base.js +595 -0
  25. package/lib/inputs2/date/dateperiodfield/index.js +34 -587
  26. package/lib/inputs2/date/dateperiodfield/types.d.ts +5 -3
  27. package/lib/inputs2/filefield/index.d.ts +6 -5
  28. package/lib/inputs2/index.d.ts +17 -14
  29. package/lib/inputs2/mask/BaseMask.d.ts +6 -5
  30. package/lib/inputs2/mask/Cnpj.d.ts +7 -6
  31. package/lib/inputs2/mask/Cnpj.js +18 -21
  32. package/lib/inputs2/mask/Cpf.d.ts +7 -6
  33. package/lib/inputs2/mask/Cpf.js +12 -19
  34. package/lib/inputs2/mask/Phone.d.ts +7 -6
  35. package/lib/inputs2/mask/ZipCode.d.ts +7 -6
  36. package/lib/inputs2/numberfield/currency.d.ts +5 -4
  37. package/lib/inputs2/numberfield/decimal.d.ts +5 -4
  38. package/lib/inputs2/numberfield/index.d.ts +5 -4
  39. package/lib/inputs2/numberfield/types.d.ts +5 -4
  40. package/lib/inputs2/radiofield/base.d.ts +12 -0
  41. package/lib/inputs2/radiofield/base.js +156 -0
  42. package/lib/inputs2/radiofield/index.js +25 -126
  43. package/lib/inputs2/radiofield/types.d.ts +6 -4
  44. package/lib/inputs2/selectfield/base.d.ts +11 -0
  45. package/lib/inputs2/selectfield/base.js +513 -0
  46. package/lib/inputs2/selectfield/index.d.ts +1 -1
  47. package/lib/inputs2/selectfield/index.js +35 -502
  48. package/lib/inputs2/selectfield/types.d.ts +8 -6
  49. package/lib/inputs2/textareafield/base.d.ts +26 -0
  50. package/lib/inputs2/textareafield/base.js +166 -0
  51. package/lib/inputs2/textareafield/index.d.ts +4 -3
  52. package/lib/inputs2/textareafield/index.js +30 -154
  53. package/lib/inputs2/textfield/base.d.ts +26 -0
  54. package/lib/inputs2/textfield/base.js +131 -0
  55. package/lib/inputs2/textfield/index.d.ts +5 -4
  56. package/lib/inputs2/textfield/index.js +30 -120
  57. package/package.json +1 -1
  58. package/lib/index-19761a50.d.ts +0 -26
  59. package/lib/index-4bda404f.d.ts +0 -42
@@ -1,9 +1,10 @@
1
1
  import 'react';
2
- import '../../index-3b70931d.js';
3
- export { F as FileFieldInputProps, I as Input } from '../../index-7dfa8924.js';
4
- import '../../@types/Align.js';
5
- import '../../@types/ColorStyles.js';
6
- import '../../@types/Position.js';
2
+ import '../../index-02a27c19.js';
3
+ export { F as FileFieldInputProps, I as Input } from '../../index-25b80f32.js';
7
4
  import '../../@types/PermissionAttr.js';
8
5
  import '../slot/index.js';
6
+ import '../textfield/base.js';
9
7
  import '../../tooltip/types.js';
8
+ import '../../@types/Position.js';
9
+ import '../../@types/Align.js';
10
+ import '../../@types/ColorStyles.js';
@@ -1,25 +1,27 @@
1
- export { i as TextField } from '../index-3b70931d.js';
2
- export { i as TextAreaField } from '../index-208e7f62.js';
1
+ export { i as TextField } from '../index-02a27c19.js';
2
+ export { i as TextAreaField } from '../index-6fcf446c.js';
3
3
  export { i as NumberField } from '../index-ecafc8c6.js';
4
4
  export { i as DateField } from '../index-368f781f.js';
5
5
  export { i as RadioField } from '../index-afb7b5a9.js';
6
- export { i as SelectField } from '../index-19761a50.js';
7
- export { i as ColorField } from '../index-9e576346.js';
8
- export { B as MaskField } from '../BaseMask-0c14ef51.js';
9
- export { C as CpfField } from '../Cpf-019b21e0.js';
10
- export { C as CnpjField } from '../Cnpj-53bfd6ab.js';
11
- export { P as PhoneField } from '../Phone-2bb0b397.js';
12
- export { Z as ZipCodeField } from '../ZipCode-09460e18.js';
13
- export { i as CheckboxField } from '../index-4bda404f.js';
6
+ export { i as SelectField } from '../index-053f615b.js';
7
+ export { i as ColorField } from '../index-6f5c772d.js';
8
+ export { B as MaskField } from '../BaseMask-78847f45.js';
9
+ export { C as CpfField } from '../Cpf-3dfd54eb.js';
10
+ export { C as CnpjField } from '../Cnpj-8366781f.js';
11
+ export { P as PhoneField } from '../Phone-1962c0f2.js';
12
+ export { Z as ZipCodeField } from '../ZipCode-be9c5b3b.js';
13
+ export { i as CheckboxField } from '../index-7159df18.js';
14
14
  export { i as DatePeriodField } from '../index-c9247c1f.js';
15
- export { i as FileField } from '../index-7dfa8924.js';
15
+ export { i as FileField } from '../index-25b80f32.js';
16
16
  import 'react';
17
- import '../@types/Align.js';
18
- import '../@types/ColorStyles.js';
19
- import '../@types/Position.js';
20
17
  import '../@types/PermissionAttr.js';
21
18
  import './slot/index.js';
19
+ import './textfield/base.js';
22
20
  import '../tooltip/types.js';
21
+ import '../@types/Position.js';
22
+ import '../@types/Align.js';
23
+ import '../@types/ColorStyles.js';
24
+ import './textareafield/base.js';
23
25
  import './numberfield/decimal.js';
24
26
  import './numberfield/types.js';
25
27
  import './numberfield/currency.js';
@@ -32,4 +34,5 @@ import './selectfield/options.js';
32
34
  import './selectfield/item.js';
33
35
  import './selectfield/types.js';
34
36
  import 'imask';
37
+ import './checkboxfield/base.js';
35
38
  import './date/dateperiodfield/types.js';
@@ -1,10 +1,11 @@
1
1
  import 'react';
2
- import '../../index-3b70931d.js';
2
+ import '../../index-02a27c19.js';
3
3
  import 'imask';
4
- export { I as Input, M as MaskFieldProps } from '../../BaseMask-0c14ef51.js';
5
- import '../../@types/Align.js';
6
- import '../../@types/ColorStyles.js';
7
- import '../../@types/Position.js';
4
+ export { I as Input, M as MaskFieldProps } from '../../BaseMask-78847f45.js';
8
5
  import '../../@types/PermissionAttr.js';
9
6
  import '../slot/index.js';
7
+ import '../textfield/base.js';
10
8
  import '../../tooltip/types.js';
9
+ import '../../@types/Position.js';
10
+ import '../../@types/Align.js';
11
+ import '../../@types/ColorStyles.js';
@@ -1,11 +1,12 @@
1
1
  import 'react';
2
- import '../../BaseMask-0c14ef51.js';
3
- export { a as CnpjFieldProps, I as Input } from '../../Cnpj-53bfd6ab.js';
4
- import '../../index-3b70931d.js';
5
- import '../../@types/Align.js';
6
- import '../../@types/ColorStyles.js';
7
- import '../../@types/Position.js';
2
+ import '../../BaseMask-78847f45.js';
3
+ export { a as CnpjFieldProps, I as Input } from '../../Cnpj-8366781f.js';
4
+ import '../../index-02a27c19.js';
8
5
  import '../../@types/PermissionAttr.js';
9
6
  import '../slot/index.js';
7
+ import '../textfield/base.js';
10
8
  import '../../tooltip/types.js';
9
+ import '../../@types/Position.js';
10
+ import '../../@types/Align.js';
11
+ import '../../@types/ColorStyles.js';
11
12
  import 'imask';
@@ -5,9 +5,10 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.Input = void 0;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
- var _helpers = require("./helpers");
8
+ var _helpers = require("../../../lib/form2/helpers");
9
+ var _helpers2 = require("./helpers");
9
10
  var _BaseMask = require("./BaseMask");
10
- const _excluded = ["onValidate", "onBlur", "onChange", "enableValidation", "errors"];
11
+ const _excluded = ["name", "onValidate", "onChange", "onBlur", "errors"];
11
12
  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); }
12
13
  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); }
13
14
  function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
@@ -15,37 +16,33 @@ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t =
15
16
  const CNPJ_INVALID_MESSAGE = 'CNPJ inválido';
16
17
  const Input = exports.Input = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
17
18
  const {
19
+ name,
18
20
  onValidate,
19
- onBlur,
20
21
  onChange,
21
- enableValidation = true,
22
+ onBlur,
22
23
  errors: externalErrors = []
23
24
  } = props,
24
25
  rest = _objectWithoutProperties(props, _excluded);
25
- const [erroValidacao, setErroValidacao] = (0, _react.useState)(null);
26
- const validarCnpj = raw => {
27
- const isValid = (0, _helpers.CNPJValidation)(raw);
28
- switch (isValid) {
29
- case true:
30
- onValidate === null || onValidate === void 0 ? void 0 : onValidate([]);
31
- setErroValidacao(null);
32
- break;
33
- case false:
34
- onValidate === null || onValidate === void 0 ? void 0 : onValidate([CNPJ_INVALID_MESSAGE]);
35
- setErroValidacao([CNPJ_INVALID_MESSAGE]);
36
- break;
26
+ const inputRef = (0, _react.useRef)(null);
27
+ const validateCnpj = raw => {
28
+ const hasCnpjError = externalErrors.includes(CNPJ_INVALID_MESSAGE);
29
+ const isValid = (0, _helpers2.CNPJValidation)(raw);
30
+ if (!isValid && hasCnpjError) {
31
+ onValidate === null || onValidate === void 0 ? void 0 : onValidate([CNPJ_INVALID_MESSAGE]);
32
+ }
33
+ if (isValid && !hasCnpjError) {
34
+ onValidate === null || onValidate === void 0 ? void 0 : onValidate([]);
37
35
  }
38
36
  };
39
37
  const handleChange = e => {
40
38
  const rawValue = e.target.value.replace(/\D/g, '');
41
- if (enableValidation) {
42
- validarCnpj(rawValue);
43
- }
39
+ validateCnpj(rawValue);
44
40
  onChange === null || onChange === void 0 ? void 0 : onChange(e);
45
41
  };
46
42
  return /*#__PURE__*/_react.default.createElement(_BaseMask.Input, _extends({}, rest, {
47
- ref: ref,
48
43
  type: "text",
44
+ name: name,
45
+ errors: externalErrors,
49
46
  maskOptions: {
50
47
  mask: '00.000.000/0000-00',
51
48
  placeholderChar: '_',
@@ -53,7 +50,7 @@ const Input = exports.Input = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =
53
50
  },
54
51
  onBlur: onBlur,
55
52
  onChange: handleChange,
56
- errors: erroValidacao || externalErrors
53
+ ref: (0, _helpers.mergeRefs)(ref, inputRef)
57
54
  }));
58
55
  });
59
56
  Input.displayName = 'CnpjInputField';
@@ -1,11 +1,12 @@
1
1
  import 'react';
2
- import '../../BaseMask-0c14ef51.js';
3
- export { a as CpfFieldProps, I as Input } from '../../Cpf-019b21e0.js';
4
- import '../../index-3b70931d.js';
5
- import '../../@types/Align.js';
6
- import '../../@types/ColorStyles.js';
7
- import '../../@types/Position.js';
2
+ import '../../BaseMask-78847f45.js';
3
+ export { a as CpfFieldProps, I as Input } from '../../Cpf-3dfd54eb.js';
4
+ import '../../index-02a27c19.js';
8
5
  import '../../@types/PermissionAttr.js';
9
6
  import '../slot/index.js';
7
+ import '../textfield/base.js';
10
8
  import '../../tooltip/types.js';
9
+ import '../../@types/Position.js';
10
+ import '../../@types/Align.js';
11
+ import '../../@types/ColorStyles.js';
11
12
  import 'imask';
@@ -7,7 +7,7 @@ exports.Input = void 0;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
8
  var _helpers = require("./helpers");
9
9
  var _BaseMask = require("./BaseMask");
10
- const _excluded = ["onValidate", "onBlur", "onChange", "enableValidation", "errors"];
10
+ const _excluded = ["onValidate", "onBlur", "onChange", "errors"];
11
11
  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); }
12
12
  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); }
13
13
  function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
@@ -18,42 +18,35 @@ const Input = exports.Input = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =
18
18
  onValidate,
19
19
  onBlur,
20
20
  onChange,
21
- enableValidation = true,
22
21
  errors: externalErrors = []
23
22
  } = props,
24
23
  rest = _objectWithoutProperties(props, _excluded);
25
- const [erroValidacao, setErroValidacao] = (0, _react.useState)(null);
26
- const validarCpf = raw => {
24
+ const validateCpf = raw => {
25
+ const hasCpfError = externalErrors.includes(CPF_INVALID_MESSAGE);
27
26
  const isValid = (0, _helpers.CPFValidation)(raw);
28
- switch (isValid) {
29
- case true:
30
- onValidate === null || onValidate === void 0 ? void 0 : onValidate([]);
31
- setErroValidacao(null);
32
- break;
33
- case false:
34
- onValidate === null || onValidate === void 0 ? void 0 : onValidate([CPF_INVALID_MESSAGE]);
35
- setErroValidacao([CPF_INVALID_MESSAGE]);
36
- break;
27
+ if (!isValid && hasCpfError) {
28
+ onValidate === null || onValidate === void 0 ? void 0 : onValidate([CPF_INVALID_MESSAGE]);
29
+ }
30
+ if (isValid && !hasCpfError) {
31
+ onValidate === null || onValidate === void 0 ? void 0 : onValidate([]);
37
32
  }
38
33
  };
39
34
  const handleChange = e => {
40
35
  const rawValue = e.target.value.replace(/\D/g, '');
41
- if (enableValidation) {
42
- validarCpf(rawValue);
43
- }
36
+ validateCpf(rawValue);
44
37
  onChange === null || onChange === void 0 ? void 0 : onChange(e);
45
38
  };
46
39
  return /*#__PURE__*/_react.default.createElement(_BaseMask.Input, _extends({}, rest, {
47
- ref: ref,
48
40
  type: "text",
41
+ ref: ref,
49
42
  maskOptions: {
50
43
  mask: '000.000.000-00',
51
44
  placeholderChar: '_',
52
45
  lazy: false
53
46
  },
54
- onBlur: onBlur,
55
47
  onChange: handleChange,
56
- errors: erroValidacao || externalErrors
48
+ errors: externalErrors,
49
+ onBlur: onBlur
57
50
  }));
58
51
  });
59
52
  Input.displayName = 'CpfInputField';
@@ -1,11 +1,12 @@
1
1
  import 'react';
2
- import '../../BaseMask-0c14ef51.js';
3
- export { I as Input, a as PhoneFieldProps } from '../../Phone-2bb0b397.js';
4
- import '../../index-3b70931d.js';
5
- import '../../@types/Align.js';
6
- import '../../@types/ColorStyles.js';
7
- import '../../@types/Position.js';
2
+ import '../../BaseMask-78847f45.js';
3
+ export { I as Input, a as PhoneFieldProps } from '../../Phone-1962c0f2.js';
4
+ import '../../index-02a27c19.js';
8
5
  import '../../@types/PermissionAttr.js';
9
6
  import '../slot/index.js';
7
+ import '../textfield/base.js';
10
8
  import '../../tooltip/types.js';
9
+ import '../../@types/Position.js';
10
+ import '../../@types/Align.js';
11
+ import '../../@types/ColorStyles.js';
11
12
  import 'imask';
@@ -1,11 +1,12 @@
1
1
  import 'react';
2
- import '../../BaseMask-0c14ef51.js';
3
- export { I as Input } from '../../ZipCode-09460e18.js';
4
- import '../../index-3b70931d.js';
5
- import '../../@types/Align.js';
6
- import '../../@types/ColorStyles.js';
7
- import '../../@types/Position.js';
2
+ import '../../BaseMask-78847f45.js';
3
+ export { I as Input } from '../../ZipCode-be9c5b3b.js';
4
+ import '../../index-02a27c19.js';
8
5
  import '../../@types/PermissionAttr.js';
9
6
  import '../slot/index.js';
7
+ import '../textfield/base.js';
10
8
  import '../../tooltip/types.js';
9
+ import '../../@types/Position.js';
10
+ import '../../@types/Align.js';
11
+ import '../../@types/ColorStyles.js';
11
12
  import 'imask';
@@ -1,12 +1,13 @@
1
1
  import React__default from 'react';
2
2
  import { CurrencyFieldInputProps } from './types.js';
3
- import '../../index-3b70931d.js';
4
- import '../../@types/Align.js';
5
- import '../../@types/ColorStyles.js';
6
- import '../../@types/Position.js';
3
+ import '../../index-02a27c19.js';
7
4
  import '../../@types/PermissionAttr.js';
8
5
  import '../slot/index.js';
6
+ import '../textfield/base.js';
9
7
  import '../../tooltip/types.js';
8
+ import '../../@types/Position.js';
9
+ import '../../@types/Align.js';
10
+ import '../../@types/ColorStyles.js';
10
11
 
11
12
  declare const Currency: React__default.ForwardRefExoticComponent<CurrencyFieldInputProps & React__default.RefAttributes<HTMLInputElement>>;
12
13
 
@@ -1,12 +1,13 @@
1
1
  import React__default from 'react';
2
2
  import { DecimalFieldInputProps } from './types.js';
3
- import '../../index-3b70931d.js';
4
- import '../../@types/Align.js';
5
- import '../../@types/ColorStyles.js';
6
- import '../../@types/Position.js';
3
+ import '../../index-02a27c19.js';
7
4
  import '../../@types/PermissionAttr.js';
8
5
  import '../slot/index.js';
6
+ import '../textfield/base.js';
9
7
  import '../../tooltip/types.js';
8
+ import '../../@types/Position.js';
9
+ import '../../@types/Align.js';
10
+ import '../../@types/ColorStyles.js';
10
11
 
11
12
  declare const Decimal: React__default.ForwardRefExoticComponent<DecimalFieldInputProps & React__default.RefAttributes<HTMLInputElement>>;
12
13
 
@@ -4,9 +4,10 @@ export { Decimal } from './decimal.js';
4
4
  export { Currency } from './currency.js';
5
5
  export { CurrencyFieldInputProps, DecimalFieldInputProps, NumberFieldInputProps } from './types.js';
6
6
  export { I as Input } from '../../index-ecafc8c6.js';
7
- import '../../index-3b70931d.js';
8
- import '../../@types/Align.js';
9
- import '../../@types/ColorStyles.js';
10
- import '../../@types/Position.js';
7
+ import '../../index-02a27c19.js';
11
8
  import '../../@types/PermissionAttr.js';
9
+ import '../textfield/base.js';
12
10
  import '../../tooltip/types.js';
11
+ import '../../@types/Position.js';
12
+ import '../../@types/Align.js';
13
+ import '../../@types/ColorStyles.js';
@@ -1,11 +1,12 @@
1
- import { T as TextFieldInputProps } from '../../index-3b70931d.js';
1
+ import { T as TextFieldInputProps } from '../../index-02a27c19.js';
2
2
  import 'react';
3
- import '../../@types/Align.js';
4
- import '../../@types/ColorStyles.js';
5
- import '../../@types/Position.js';
6
3
  import '../../@types/PermissionAttr.js';
7
4
  import '../slot/index.js';
5
+ import '../textfield/base.js';
8
6
  import '../../tooltip/types.js';
7
+ import '../../@types/Position.js';
8
+ import '../../@types/Align.js';
9
+ import '../../@types/ColorStyles.js';
9
10
 
10
11
  type BaseInputProps = Omit<TextFieldInputProps, 'type' | 'max' | 'min' | 'enum'>;
11
12
  type BaseMaskNumberInputProps = {
@@ -0,0 +1,12 @@
1
+ import React__default from 'react';
2
+ import { RadioFieldInputProps } from './types.js';
3
+ import '../../@types/Size.js';
4
+ import '../../@types/Align.js';
5
+ import '../../@types/ColorStyles.js';
6
+ import '../../tooltip/types.js';
7
+ import '../../@types/Position.js';
8
+ import '../../@types/PermissionAttr.js';
9
+
10
+ declare const InputBase: React__default.ForwardRefExoticComponent<Pick<RadioFieldInputProps, "form" | "label" | "slot" | "style" | "title" | "pattern" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "nonce" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "align" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "customClass" | "permissionAttr" | "size" | "skeletonize" | "disabled" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "value" | "tooltip" | "tooltipWidth" | "tooltipPosition" | "checked" | "required" | "labelUppercase" | "hint" | "hintPosition" | "themePopover" | "popoverAlign" | "width" | "height" | "readOnly" | "list" | "step" | "maxLength" | "textAlign" | "onDeniedActions" | "gridLayout" | "accept" | "autoComplete" | "max" | "min" | "src" | "alt" | "fieldId" | "errors" | "capture" | "crossOrigin" | "enterKeyHint" | "minLength" | "customClassLabel" | "customClassWrapper" | "customClassInputContainer" | "getFieldValue"> & React__default.RefAttributes<HTMLInputElement>>;
11
+
12
+ export { InputBase };
@@ -0,0 +1,156 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.InputBase = void 0;
7
+ require("../../assets/styles/radiofield.scss");
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _lodash = _interopRequireDefault(require("lodash"));
10
+ var _uuid = require("uuid");
11
+ var _hint = _interopRequireDefault(require("../../hint"));
12
+ var _popover = _interopRequireDefault(require("../../popover"));
13
+ var _gridlayout = _interopRequireDefault(require("../../gridlayout"));
14
+ var Tooltip = _interopRequireWildcard(require("../../tooltip"));
15
+ var _permissionValidations = require("../../permissionValidations");
16
+ const _excluded = ["label", "errors", "tooltip", "tooltipPosition", "tooltipWidth", "hint", "gridLayout", "size", "onDeniedActions", "permissionAttr", "labelUppercase", "customClassLabel", "customClassInputContainer", "customClass", "customClassWrapper", "textAlign", "skeletonize", "hintPosition", "themePopover", "popoverAlign"];
17
+ 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); }
18
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
19
+ 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); }
20
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
21
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
22
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
23
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
24
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
25
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
26
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
27
+ const options = [_permissionValidations.OPTIONS_ON_DENIED.disabled, _permissionValidations.OPTIONS_ON_DENIED.unvisible, _permissionValidations.OPTIONS_ON_DENIED.readOnly, _permissionValidations.OPTIONS_ON_DENIED.hideContent];
28
+ const InputBase = exports.InputBase = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
29
+ const {
30
+ label,
31
+ errors,
32
+ tooltip,
33
+ tooltipPosition,
34
+ tooltipWidth,
35
+ hint,
36
+ gridLayout,
37
+ size = 'medium',
38
+ onDeniedActions = undefined,
39
+ permissionAttr = undefined,
40
+ labelUppercase = false,
41
+ customClassLabel = '',
42
+ customClassInputContainer = '',
43
+ customClass = '',
44
+ customClassWrapper = '',
45
+ textAlign = 'left',
46
+ skeletonize = false,
47
+ hintPosition = 'below',
48
+ themePopover = 'light',
49
+ popoverAlign = 'left'
50
+ } = props,
51
+ rest = _objectWithoutProperties(props, _excluded);
52
+ const onDenied = _react.default.useMemo(() => {
53
+ return onDeniedActions || (0, _permissionValidations.actionsOnPermissionDenied)(options, permissionAttr);
54
+ }, [onDeniedActions, permissionAttr]);
55
+ const {
56
+ hideContent,
57
+ unvisible
58
+ } = onDenied;
59
+ const inputContainerRef = _react.default.useRef(null);
60
+ const inputId = _react.default.useMemo(() => (props === null || props === void 0 ? void 0 : props.id) || (props === null || props === void 0 ? void 0 : props.fieldId) || (0, _uuid.v1)(), [props === null || props === void 0 ? void 0 : props.id, props === null || props === void 0 ? void 0 : props.fieldId]);
61
+ const hasLabel = !_lodash.default.isEmpty(props === null || props === void 0 ? void 0 : props.label);
62
+ const isReadOnly = Boolean(props.readOnly || onDenied.readOnly);
63
+ const isDisabled = Boolean(props.disabled || onDenied.disabled);
64
+ const hasHintMessages = Boolean(hint === null || hint === void 0 ? void 0 : hint.length);
65
+ const hasValidationErrors = Boolean(errors === null || errors === void 0 ? void 0 : errors.length);
66
+ const isChecked = (props === null || props === void 0 ? void 0 : props.checked) || _lodash.default.isEqual(props === null || props === void 0 ? void 0 : props.value, props === null || props === void 0 ? void 0 : props.fieldId);
67
+ const handleOnChange = event => {
68
+ var _rest$onChange;
69
+ if (isReadOnly) {
70
+ event.preventDefault();
71
+ event.stopPropagation();
72
+ return;
73
+ }
74
+ const syntheticEvent = _objectSpread(_objectSpread({}, event), {}, {
75
+ target: _objectSpread(_objectSpread({}, event.target), {}, {
76
+ value: props === null || props === void 0 ? void 0 : props.fieldId
77
+ })
78
+ });
79
+ (_rest$onChange = rest.onChange) === null || _rest$onChange === void 0 ? void 0 : _rest$onChange.call(rest, syntheticEvent);
80
+ };
81
+ const handleOnClick = event => {
82
+ var _rest$onClick;
83
+ if (isReadOnly) {
84
+ event.preventDefault();
85
+ event.stopPropagation();
86
+ return;
87
+ }
88
+ (_rest$onClick = rest.onClick) === null || _rest$onClick === void 0 ? void 0 : _rest$onClick.call(rest, event);
89
+ };
90
+ if (unvisible || hideContent) return null;
91
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_gridlayout.default, {
92
+ cols: gridLayout
93
+ }, /*#__PURE__*/_react.default.createElement("div", {
94
+ "data-testid": "test-radio-field-root",
95
+ "data-state-error": hasValidationErrors,
96
+ className: "radio-field-root ".concat(customClassWrapper)
97
+ }, /*#__PURE__*/_react.default.createElement("div", {
98
+ ref: inputContainerRef,
99
+ "data-state-skeletonize": skeletonize,
100
+ className: "container ".concat(customClassInputContainer)
101
+ }, /*#__PURE__*/_react.default.createElement("input", _extends({
102
+ "data-testid": "test-radio-field-input"
103
+ }, _lodash.default.omit(rest, ['fieldId']), {
104
+ ref: ref,
105
+ id: inputId,
106
+ type: "radio",
107
+ checked: isChecked,
108
+ readOnly: isReadOnly,
109
+ disabled: isDisabled || isReadOnly,
110
+ className: "input ".concat(customClass),
111
+ tabIndex: !isReadOnly ? 0 : -1,
112
+ placeholder: rest.placeholder,
113
+ "data-state-size": size,
114
+ "data-state-error": hasValidationErrors,
115
+ "data-state-read-only": isReadOnly,
116
+ "data-state-text-align": textAlign,
117
+ "data-state-skeletonize": skeletonize,
118
+ onClick: handleOnClick,
119
+ onChange: handleOnChange
120
+ })), hasLabel && /*#__PURE__*/_react.default.createElement("span", {
121
+ className: "root-label ".concat(customClassLabel),
122
+ "data-state-skeletonize": skeletonize
123
+ }, /*#__PURE__*/_react.default.createElement("label", {
124
+ className: "label",
125
+ title: label,
126
+ htmlFor: inputId,
127
+ "data-state-disabled": isDisabled,
128
+ "data-state-read-only": isReadOnly,
129
+ "data-state-input-required": props.required,
130
+ "data-state-label-uppercase": labelUppercase
131
+ }, label), hasHintMessages && hintPosition === 'onLabelRight' && !skeletonize && /*#__PURE__*/_react.default.createElement(_popover.default, {
132
+ customClass: "label-popover",
133
+ theme: themePopover,
134
+ align: popoverAlign,
135
+ iconColor: "#03bde2"
136
+ }, hint))), hintPosition === 'below' && /*#__PURE__*/_react.default.createElement(_hint.default, {
137
+ customClass: "hint",
138
+ description: hint,
139
+ disabled: isDisabled,
140
+ skeletonize: skeletonize,
141
+ visible: hasHintMessages
142
+ }), hasValidationErrors && /*#__PURE__*/_react.default.createElement("span", {
143
+ "data-testid": "test-radio-field-list-errors",
144
+ className: "error",
145
+ "data-state-skeletonize": skeletonize,
146
+ "aria-describedby": String(props.name).concat('-errors')
147
+ }, errors === null || errors === void 0 ? void 0 : errors.map((error, index) => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, {
148
+ key: "".concat(index + 1, "-").concat(error)
149
+ }, error, "\xA0"))))), /*#__PURE__*/_react.default.createElement(Tooltip.Tooltip, {
150
+ targetRef: inputContainerRef,
151
+ text: tooltip,
152
+ width: tooltipWidth,
153
+ position: tooltipPosition
154
+ }));
155
+ });
156
+ InputBase.displayName = 'RadioFieldInputBase';