linear-react-components-ui 1.1.25-rc.10 → 1.1.25-rc.11

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 (58) hide show
  1. package/lib/{BaseMask-0c14ef51.d.ts → BaseMask-78847f45.d.ts} +1 -1
  2. package/lib/{Cnpj-bde01dd0.d.ts → Cnpj-8366781f.d.ts} +1 -1
  3. package/lib/{Cpf-3fa496ad.d.ts → Cpf-3dfd54eb.d.ts} +1 -1
  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/tooltip.scss +5 -4
  7. package/lib/{index-3b70931d.d.ts → index-02a27c19.d.ts} +2 -20
  8. package/lib/index-053f615b.d.ts +26 -0
  9. package/lib/{index-7dfa8924.d.ts → index-25b80f32.d.ts} +1 -1
  10. package/lib/{index-9e576346.d.ts → index-6f5c772d.d.ts} +1 -1
  11. package/lib/{index-208e7f62.d.ts → index-6fcf446c.d.ts} +2 -20
  12. package/lib/index-7159df18.d.ts +21 -0
  13. package/lib/inputs2/checkboxfield/base.d.ts +29 -0
  14. package/lib/inputs2/checkboxfield/base.js +134 -0
  15. package/lib/inputs2/checkboxfield/index.d.ts +3 -2
  16. package/lib/inputs2/checkboxfield/index.js +32 -125
  17. package/lib/inputs2/colorfield/index.d.ts +6 -5
  18. package/lib/inputs2/date/datefield/base.d.ts +13 -0
  19. package/lib/inputs2/date/datefield/base.js +330 -0
  20. package/lib/inputs2/date/datefield/index.js +34 -322
  21. package/lib/inputs2/date/datefield/types.d.ts +5 -3
  22. package/lib/inputs2/date/dateperiodfield/base.d.ts +13 -0
  23. package/lib/inputs2/date/dateperiodfield/base.js +595 -0
  24. package/lib/inputs2/date/dateperiodfield/index.js +34 -587
  25. package/lib/inputs2/date/dateperiodfield/types.d.ts +5 -3
  26. package/lib/inputs2/filefield/index.d.ts +6 -5
  27. package/lib/inputs2/index.d.ts +17 -14
  28. package/lib/inputs2/mask/BaseMask.d.ts +6 -5
  29. package/lib/inputs2/mask/Cnpj.d.ts +7 -6
  30. package/lib/inputs2/mask/Cpf.d.ts +7 -6
  31. package/lib/inputs2/mask/Phone.d.ts +7 -6
  32. package/lib/inputs2/mask/ZipCode.d.ts +7 -6
  33. package/lib/inputs2/numberfield/currency.d.ts +5 -4
  34. package/lib/inputs2/numberfield/decimal.d.ts +5 -4
  35. package/lib/inputs2/numberfield/index.d.ts +5 -4
  36. package/lib/inputs2/numberfield/types.d.ts +5 -4
  37. package/lib/inputs2/radiofield/base.d.ts +12 -0
  38. package/lib/inputs2/radiofield/base.js +156 -0
  39. package/lib/inputs2/radiofield/index.js +25 -126
  40. package/lib/inputs2/radiofield/types.d.ts +6 -4
  41. package/lib/inputs2/selectfield/base.d.ts +11 -0
  42. package/lib/inputs2/selectfield/base.js +513 -0
  43. package/lib/inputs2/selectfield/index.d.ts +1 -1
  44. package/lib/inputs2/selectfield/index.js +35 -502
  45. package/lib/inputs2/selectfield/types.d.ts +8 -6
  46. package/lib/inputs2/textareafield/base.d.ts +26 -0
  47. package/lib/inputs2/textareafield/base.js +166 -0
  48. package/lib/inputs2/textareafield/index.d.ts +4 -3
  49. package/lib/inputs2/textareafield/index.js +30 -154
  50. package/lib/inputs2/textfield/base.d.ts +26 -0
  51. package/lib/inputs2/textfield/base.js +131 -0
  52. package/lib/inputs2/textfield/index.d.ts +5 -4
  53. package/lib/inputs2/textfield/index.js +30 -120
  54. package/lib/tooltip/TooltipContent.js +1 -1
  55. package/lib/tooltip/useTooltip.js +25 -0
  56. package/package.json +1 -1
  57. package/lib/index-cd005ed1.d.ts +0 -26
  58. package/lib/index-f03b97fe.d.ts +0 -42
@@ -1,5 +1,5 @@
1
1
  import React__default from 'react';
2
- import { T as TextFieldInputProps } from './index-3b70931d.js';
2
+ import { T as TextFieldInputProps } from './index-02a27c19.js';
3
3
  import { FactoryOpts } from 'imask';
4
4
 
5
5
  interface MaskFieldProps extends TextFieldInputProps {
@@ -1,5 +1,5 @@
1
1
  import React__default from 'react';
2
- import { M as MaskFieldProps } from './BaseMask-0c14ef51.js';
2
+ import { M as MaskFieldProps } from './BaseMask-78847f45.js';
3
3
 
4
4
  interface CnpjFieldProps extends MaskFieldProps {
5
5
  onValidate?: (errors: string[]) => void;
@@ -1,5 +1,5 @@
1
1
  import React__default from 'react';
2
- import { M as MaskFieldProps } from './BaseMask-0c14ef51.js';
2
+ import { M as MaskFieldProps } from './BaseMask-78847f45.js';
3
3
 
4
4
  interface CpfFieldProps extends MaskFieldProps {
5
5
  onValidate?: (errors: string[]) => void;
@@ -1,5 +1,5 @@
1
1
  import React__default from 'react';
2
- import { M as MaskFieldProps } from './BaseMask-0c14ef51.js';
2
+ import { M as MaskFieldProps } from './BaseMask-78847f45.js';
3
3
 
4
4
  interface PhoneFieldProps extends MaskFieldProps {
5
5
  isCellphone?: boolean;
@@ -1,5 +1,5 @@
1
1
  import React__default from 'react';
2
- import { M as MaskFieldProps } from './BaseMask-0c14ef51.js';
2
+ import { M as MaskFieldProps } from './BaseMask-78847f45.js';
3
3
 
4
4
  declare const Input: React__default.ForwardRefExoticComponent<MaskFieldProps & React__default.RefAttributes<HTMLInputElement>>;
5
5
 
@@ -1,6 +1,7 @@
1
1
  @import "colors.scss";
2
2
 
3
3
  .tooltip-component {
4
+ --arrow-position: 50%;
4
5
  font-family: 'Roboto', sans-serif;
5
6
  position: absolute;
6
7
  padding: 8px;
@@ -13,7 +14,7 @@
13
14
  z-index: 999999;
14
15
  pointer-events: none;
15
16
  max-width: 300px;
16
- word-break: break-word;
17
+ word-break: break-word;
17
18
  &.left::after {
18
19
  content: " ";
19
20
  position: absolute;
@@ -34,11 +35,11 @@
34
35
  border-style: solid;
35
36
  border-color: transparent rgba(black, 0.85) transparent transparent;
36
37
  }
37
- &.top::after {
38
+ &.top::after {
38
39
  content: " ";
39
40
  position: absolute;
40
41
  top: 100%;
41
- left: 50%;
42
+ left: var(--arrow-position);
42
43
  margin-left: -5px;
43
44
  border-width: 5px;
44
45
  border-style: solid;
@@ -48,7 +49,7 @@
48
49
  content: " ";
49
50
  position: absolute;
50
51
  bottom: 100%;
51
- left: 50%;
52
+ left: var(--arrow-position);
52
53
  margin-left: -5px;
53
54
  border-width: 5px;
54
55
  border-style: solid;
@@ -1,28 +1,10 @@
1
1
  import React__default from 'react';
2
- import { TextAlign } from './@types/Align.js';
3
- import { ColorTheme } from './@types/ColorStyles.js';
4
- import { HintPosition, Position } from './@types/Position.js';
5
2
  import { PermissionAttr, OnDenied } from './@types/PermissionAttr.js';
6
3
  import { LeftSlot, RightSlot } from './inputs2/slot/index.js';
7
- import { ITooltipCommonProps } from './tooltip/types.js';
4
+ import { TextFieldInputBaseProps } from './inputs2/textfield/base.js';
8
5
 
9
- interface TextFieldInputProps extends React__default.ComponentPropsWithoutRef<'input'>, ITooltipCommonProps {
10
- hint?: string;
11
- label?: string;
12
- errors?: string[];
6
+ interface TextFieldInputProps extends TextFieldInputBaseProps {
13
7
  gridLayout?: string;
14
- customClass?: string;
15
- customClassLabel?: string;
16
- customClassWrapper?: string;
17
- customClassInputContainer?: string;
18
- rounded?: boolean;
19
- readOnly?: boolean;
20
- skeletonize?: boolean;
21
- labelUppercase?: boolean;
22
- textAlign?: TextAlign;
23
- hintPosition?: HintPosition;
24
- themePopover?: ColorTheme;
25
- popoverAlign?: Extract<Position, 'left' | 'right'>;
26
8
  permissionAttr?: PermissionAttr;
27
9
  onDeniedActions?: OnDenied;
28
10
  }
@@ -0,0 +1,26 @@
1
+ import React__default from 'react';
2
+ import { LeftSlot, RightSlot } from './inputs2/slot/index.js';
3
+ import { Options } from './inputs2/selectfield/options.js';
4
+ import { Item } from './inputs2/selectfield/item.js';
5
+ import { SelectFieldInputProps } from './inputs2/selectfield/types.js';
6
+
7
+ declare const Input: React__default.ForwardRefExoticComponent<SelectFieldInputProps & React__default.RefAttributes<HTMLInputElement>>;
8
+
9
+ declare const index_Input: typeof Input;
10
+ declare const index_Item: typeof Item;
11
+ declare const index_LeftSlot: typeof LeftSlot;
12
+ declare const index_Options: typeof Options;
13
+ declare const index_RightSlot: typeof RightSlot;
14
+ declare const index_SelectFieldInputProps: typeof SelectFieldInputProps;
15
+ declare namespace index {
16
+ export {
17
+ index_Input as Input,
18
+ index_Item as Item,
19
+ index_LeftSlot as LeftSlot,
20
+ index_Options as Options,
21
+ index_RightSlot as RightSlot,
22
+ index_SelectFieldInputProps as SelectFieldInputProps,
23
+ };
24
+ }
25
+
26
+ export { Input as I, index as i };
@@ -1,5 +1,5 @@
1
1
  import React__default from 'react';
2
- import { T as TextFieldInputProps } from './index-3b70931d.js';
2
+ import { T as TextFieldInputProps } from './index-02a27c19.js';
3
3
 
4
4
  interface FileFieldInputProps extends Omit<TextFieldInputProps, 'type'> {
5
5
  multiple?: boolean;
@@ -1,6 +1,6 @@
1
1
  import React__default from 'react';
2
2
  import { LeftSlot, RightSlot } from './inputs2/slot/index.js';
3
- import { T as TextFieldInputProps } from './index-3b70931d.js';
3
+ import { T as TextFieldInputProps } from './index-02a27c19.js';
4
4
 
5
5
  interface ColorFieldInputProps extends TextFieldInputProps {
6
6
  isTypeText?: boolean;
@@ -1,28 +1,10 @@
1
1
  import React__default from 'react';
2
- import { TextAlign } from './@types/Align.js';
3
- import { ColorTheme } from './@types/ColorStyles.js';
4
- import { HintPosition, Position } from './@types/Position.js';
5
2
  import { PermissionAttr, OnDenied } from './@types/PermissionAttr.js';
6
3
  import { LeftSlot, RightSlot } from './inputs2/slot/index.js';
7
- import { ITooltipCommonProps } from './tooltip/types.js';
4
+ import { TextAreaFieldInputBaseProps } from './inputs2/textareafield/base.js';
8
5
 
9
- interface TextAreaFieldInputProps extends React__default.ComponentPropsWithoutRef<'textarea'>, ITooltipCommonProps {
10
- hint?: string;
11
- label?: string;
12
- errors?: string[];
6
+ interface TextAreaFieldInputProps extends TextAreaFieldInputBaseProps {
13
7
  gridLayout?: string;
14
- customClass?: string;
15
- customClassLabel?: string;
16
- customClassWrapper?: string;
17
- customClassInputContainer?: string;
18
- rounded?: boolean;
19
- readOnly?: boolean;
20
- skeletonize?: boolean;
21
- labelUppercase?: boolean;
22
- textAlign?: TextAlign;
23
- hintPosition?: HintPosition;
24
- themePopover?: ColorTheme;
25
- popoverAlign?: Extract<Position, 'left' | 'right'>;
26
8
  permissionAttr?: PermissionAttr;
27
9
  onDeniedActions?: OnDenied;
28
10
  }
@@ -0,0 +1,21 @@
1
+ import React__default from 'react';
2
+ import { PermissionAttr, OnDenied } from './@types/PermissionAttr.js';
3
+ import { CheckboxFieldInputBaseProps } from './inputs2/checkboxfield/base.js';
4
+
5
+ interface CheckboxFieldInputProps extends CheckboxFieldInputBaseProps {
6
+ gridLayout?: string;
7
+ permissionAttr?: PermissionAttr;
8
+ onDeniedActions?: OnDenied;
9
+ }
10
+ declare const Input: React__default.ForwardRefExoticComponent<CheckboxFieldInputProps & React__default.RefAttributes<HTMLInputElement>>;
11
+
12
+ type index_CheckboxFieldInputProps = CheckboxFieldInputProps;
13
+ declare const index_Input: typeof Input;
14
+ declare namespace index {
15
+ export {
16
+ index_CheckboxFieldInputProps as CheckboxFieldInputProps,
17
+ index_Input as Input,
18
+ };
19
+ }
20
+
21
+ export { CheckboxFieldInputProps as C, Input as I, index as i };
@@ -0,0 +1,29 @@
1
+ import React__default from 'react';
2
+ import { Size } from '../../@types/Size.js';
3
+ import { ColorTheme } from '../../@types/ColorStyles.js';
4
+ import { ITooltipCommonProps } from '../../tooltip/types.js';
5
+ import { HintPosition, Position } from '../../@types/Position.js';
6
+
7
+ type InputHTMLProps = Omit<React__default.ComponentPropsWithoutRef<'input'>, 'size' | 'type'>;
8
+ interface CheckboxFieldInputBaseProps extends InputHTMLProps, ITooltipCommonProps {
9
+ hint?: string;
10
+ label?: string;
11
+ size?: Exclude<Size, 'mini'>;
12
+ variant?: 'default' | 'secondary';
13
+ errors?: string[];
14
+ customClass?: string;
15
+ customClassLabel?: string;
16
+ customClassWrapper?: string;
17
+ customClassInputContainer?: string;
18
+ rounded?: boolean;
19
+ readOnly?: boolean;
20
+ skeletonize?: boolean;
21
+ labelUppercase?: boolean;
22
+ hintPosition?: HintPosition;
23
+ themePopover?: ColorTheme;
24
+ popoverAlign?: Extract<Position, 'left' | 'right'>;
25
+ tabIndex?: number;
26
+ }
27
+ declare const InputBase: React__default.ForwardRefExoticComponent<CheckboxFieldInputBaseProps & React__default.RefAttributes<HTMLInputElement>>;
28
+
29
+ export { CheckboxFieldInputBaseProps, InputBase };
@@ -0,0 +1,134 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.InputBase = void 0;
7
+ require("../../assets/styles/checkbox2.scss");
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _lodash = _interopRequireDefault(require("lodash"));
10
+ var _hint = _interopRequireDefault(require("../../hint"));
11
+ var _icons = _interopRequireDefault(require("../../icons"));
12
+ var _popover = _interopRequireWildcard(require("../../popover"));
13
+ var _tooltip = require("../../tooltip");
14
+ const _excluded = ["name", "label", "errors", "onChange", "size", "tooltip", "tooltipPosition", "tooltipWidth", "tabIndex", "variant", "customClass", "customClassLabel", "customClassWrapper", "labelUppercase", "rounded", "customClassInputContainer", "skeletonize", "hintPosition", "themePopover", "popoverAlign", "disabled", "readOnly"];
15
+ 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); }
16
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
17
+ 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); }
18
+ 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; }
19
+ 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; }
20
+ const InputBase = exports.InputBase = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
21
+ var _props$checked, _props$hint;
22
+ const {
23
+ name,
24
+ label,
25
+ errors,
26
+ onChange,
27
+ size = 'default',
28
+ tooltip,
29
+ tooltipPosition,
30
+ tooltipWidth,
31
+ tabIndex = 0,
32
+ variant = 'default',
33
+ customClass = '',
34
+ customClassLabel = '',
35
+ customClassWrapper = '',
36
+ labelUppercase = false,
37
+ rounded = false,
38
+ customClassInputContainer = '',
39
+ skeletonize = false,
40
+ hintPosition = 'below',
41
+ themePopover = 'light',
42
+ popoverAlign = 'left',
43
+ disabled,
44
+ readOnly
45
+ } = props,
46
+ rest = _objectWithoutProperties(props, _excluded);
47
+ const inputId = _react.default.useMemo(() => props.id || "checkboxfield-".concat(name), [props.id, name]);
48
+ const inputRootRef = _react.default.useRef(null);
49
+ const isChecked = (_props$checked = props.checked) !== null && _props$checked !== void 0 ? _props$checked : Boolean(props.value);
50
+ const hasLabel = !_lodash.default.isEmpty(props === null || props === void 0 ? void 0 : props.label);
51
+ const hasHintMessages = Boolean((_props$hint = props.hint) === null || _props$hint === void 0 ? void 0 : _props$hint.length);
52
+ const hasValidationErrors = Boolean(errors === null || errors === void 0 ? void 0 : errors.length);
53
+ const handleOnChange = _react.default.useCallback(event => {
54
+ if (readOnly || disabled) return;
55
+ Object.defineProperty(event.target, 'value', {
56
+ value: event.target.checked,
57
+ writable: true,
58
+ enumerable: true,
59
+ configurable: true
60
+ });
61
+ onChange === null || onChange === void 0 ? void 0 : onChange(event);
62
+ }, [readOnly, disabled, onChange]);
63
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
64
+ ref: inputRootRef,
65
+ "data-testid": "test-chebox-field-root",
66
+ className: "checkbox-field-root ".concat(customClassWrapper),
67
+ "data-state-error": hasValidationErrors
68
+ }, /*#__PURE__*/_react.default.createElement("div", {
69
+ "data-state-skeletonize": skeletonize,
70
+ className: "container ".concat(customClassInputContainer)
71
+ }, /*#__PURE__*/_react.default.createElement("div", {
72
+ className: "input-root"
73
+ }, /*#__PURE__*/_react.default.createElement("input", _extends({
74
+ ref: ref,
75
+ id: inputId,
76
+ name: name,
77
+ readOnly: readOnly,
78
+ disabled: disabled,
79
+ className: "input ".concat(customClass),
80
+ tabIndex: !readOnly && !tabIndex ? 0 : -1,
81
+ "data-testid": "test-checkbox-field-input",
82
+ "data-state-size": size,
83
+ "data-state-error": hasValidationErrors,
84
+ "data-state-variant": variant,
85
+ "data-state-rounded": rounded,
86
+ "data-state-read-only": readOnly,
87
+ "data-state-skeletonize": skeletonize
88
+ }, rest, {
89
+ type: "checkbox",
90
+ checked: isChecked,
91
+ onChange: handleOnChange
92
+ })), /*#__PURE__*/_react.default.createElement(_icons.default, {
93
+ customClass: "checkmark",
94
+ name: "checkmark",
95
+ colorStyle: "default"
96
+ })), hasLabel && /*#__PURE__*/_react.default.createElement("label", {
97
+ className: "label ".concat(customClassLabel),
98
+ title: label,
99
+ htmlFor: inputId,
100
+ "aria-readonly": readOnly,
101
+ "aria-disabled": disabled,
102
+ "data-testid": "test-checkbox-field-label",
103
+ "data-state-skeletonize": skeletonize,
104
+ "data-state-disabled": disabled,
105
+ "data-state-read-only": readOnly,
106
+ "data-state-uppercase": labelUppercase,
107
+ "data-state-input-required": props.required
108
+ }, label), hasLabel && hasHintMessages && hintPosition === 'onLabelRight' && !skeletonize && /*#__PURE__*/_react.default.createElement(_popover.default, {
109
+ customClass: "label-popover",
110
+ theme: themePopover,
111
+ align: popoverAlign,
112
+ iconColor: "#03bde2"
113
+ }, /*#__PURE__*/_react.default.createElement(_popover.PopoverText, {
114
+ text: props === null || props === void 0 ? void 0 : props.hint
115
+ }))), hintPosition === 'below' && /*#__PURE__*/_react.default.createElement(_hint.default, {
116
+ customClass: "hint",
117
+ description: props.hint,
118
+ disabled: disabled,
119
+ skeletonize: skeletonize,
120
+ visible: hasHintMessages
121
+ }), hasValidationErrors && /*#__PURE__*/_react.default.createElement("span", {
122
+ className: "error",
123
+ "data-state-skeletonize": skeletonize,
124
+ "aria-describedby": String(name).concat('-errors')
125
+ }, errors === null || errors === void 0 ? void 0 : errors.map((error, index) => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, {
126
+ key: "".concat(index + 1, "-").concat(error)
127
+ }, error, "\xA0")))), /*#__PURE__*/_react.default.createElement(_tooltip.Tooltip, {
128
+ targetRef: inputRootRef,
129
+ text: tooltip,
130
+ width: tooltipWidth,
131
+ position: tooltipPosition
132
+ }));
133
+ });
134
+ InputBase.displayName = 'CheckboxFieldInputBase';
@@ -1,7 +1,8 @@
1
1
  import 'react';
2
+ import '../../@types/PermissionAttr.js';
3
+ import './base.js';
4
+ export { C as CheckboxFieldInputProps, I as Input } from '../../index-7159df18.js';
2
5
  import '../../@types/Size.js';
3
6
  import '../../@types/ColorStyles.js';
4
7
  import '../../tooltip/types.js';
5
8
  import '../../@types/Position.js';
6
- import '../../@types/PermissionAttr.js';
7
- export { C as CheckboxFieldInputProps, I as Input } from '../../index-f03b97fe.js';
@@ -6,48 +6,29 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.Input = void 0;
7
7
  require("../../assets/styles/checkbox2.scss");
8
8
  var _react = _interopRequireDefault(require("react"));
9
- var _lodash = _interopRequireDefault(require("lodash"));
10
- var _hint = _interopRequireDefault(require("../../hint"));
11
- var _icons = _interopRequireDefault(require("../../icons"));
12
9
  var _gridlayout = _interopRequireDefault(require("../../gridlayout"));
13
- var _popover = _interopRequireWildcard(require("../../popover"));
14
- var _tooltip = require("../../tooltip");
15
10
  var _permissionValidations = require("../../permissionValidations");
16
- const _excluded = ["name", "label", "errors", "onChange", "size", "onDeniedActions", "permissionAttr", "variant", "customClass", "customClassLabel", "customClassWrapper", "labelUppercase", "rounded", "customClassInputContainer", "skeletonize", "hintPosition", "gridLayout", "themePopover", "popoverAlign", "tooltip", "tooltipPosition", "tooltipWidth", "tabIndex"];
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); }
11
+ var _base = require("./base");
12
+ const _excluded = ["onDeniedActions", "permissionAttr", "gridLayout", "readOnly", "disabled"];
18
13
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
19
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); }
15
+ 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; }
16
+ 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; }
17
+ 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; }
18
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
19
+ 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); }
20
20
  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; }
21
21
  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; }
22
22
  const options = [_permissionValidations.OPTIONS_ON_DENIED.disabled, _permissionValidations.OPTIONS_ON_DENIED.unvisible, _permissionValidations.OPTIONS_ON_DENIED.readOnly, _permissionValidations.OPTIONS_ON_DENIED.hideContent];
23
- const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
24
- var _props$checked, _props$hint;
25
- const {
26
- name,
27
- label,
28
- errors,
29
- onChange,
30
- size = 'default',
31
- onDeniedActions = undefined,
32
- permissionAttr = undefined,
33
- variant = 'default',
34
- customClass = '',
35
- customClassLabel = '',
36
- customClassWrapper = '',
37
- labelUppercase = false,
38
- rounded = false,
39
- customClassInputContainer = '',
40
- skeletonize = false,
41
- hintPosition = 'below',
42
- gridLayout = undefined,
43
- themePopover = 'light',
44
- popoverAlign = 'left',
45
- tooltip,
46
- tooltipPosition,
47
- tooltipWidth,
48
- tabIndex = 0
49
- } = props,
50
- rest = _objectWithoutProperties(props, _excluded);
23
+ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
24
+ let {
25
+ onDeniedActions,
26
+ permissionAttr,
27
+ gridLayout,
28
+ readOnly,
29
+ disabled
30
+ } = _ref,
31
+ props = _objectWithoutProperties(_ref, _excluded);
51
32
  const onDenied = _react.default.useMemo(() => {
52
33
  return onDeniedActions || (0, _permissionValidations.actionsOnPermissionDenied)(options, permissionAttr);
53
34
  }, [onDeniedActions, permissionAttr]);
@@ -55,96 +36,22 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, ref
55
36
  hideContent,
56
37
  unvisible
57
38
  } = onDenied;
58
- const inputId = _react.default.useMemo(() => props.id || "checkboxfield-".concat(name), [props.id, name]);
59
- const inputRootRef = _react.default.useRef(null);
60
- const isChecked = (_props$checked = props.checked) !== null && _props$checked !== void 0 ? _props$checked : Boolean(props.value);
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((_props$hint = props.hint) === null || _props$hint === void 0 ? void 0 : _props$hint.length);
65
- const hasValidationErrors = Boolean(errors === null || errors === void 0 ? void 0 : errors.length);
66
- const handleOnChange = _react.default.useCallback(event => {
67
- if (isReadOnly || isDisabled) return;
68
- Object.defineProperty(event.target, 'value', {
69
- value: event.target.checked,
70
- writable: true,
71
- enumerable: true,
72
- configurable: true
73
- });
74
- onChange === null || onChange === void 0 ? void 0 : onChange(event);
75
- }, [isReadOnly, isDisabled, onChange]);
76
- if (unvisible || hideContent) return null;
77
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_gridlayout.default, {
78
- cols: gridLayout
79
- }, /*#__PURE__*/_react.default.createElement("div", {
80
- ref: inputRootRef,
81
- "data-testid": "test-chebox-field-root",
82
- className: "checkbox-field-root ".concat(customClassWrapper),
83
- "data-state-error": hasValidationErrors
84
- }, /*#__PURE__*/_react.default.createElement("div", {
85
- "data-state-skeletonize": skeletonize,
86
- className: "container ".concat(customClassInputContainer)
87
- }, /*#__PURE__*/_react.default.createElement("div", {
88
- className: "input-root"
89
- }, /*#__PURE__*/_react.default.createElement("input", _extends({
90
- ref: ref,
91
- id: inputId,
92
- name: name,
39
+ const isReadOnly = Boolean(readOnly || onDenied.readOnly);
40
+ const isDisabled = Boolean(disabled || onDenied.disabled);
41
+ const inputProps = _objectSpread({
93
42
  readOnly: isReadOnly,
94
- disabled: isDisabled,
95
- className: "input ".concat(customClass),
96
- tabIndex: !isReadOnly && !tabIndex ? 0 : -1,
97
- "data-testid": "test-checkbox-field-input",
98
- "data-state-size": size,
99
- "data-state-error": hasValidationErrors,
100
- "data-state-variant": variant,
101
- "data-state-rounded": rounded,
102
- "data-state-read-only": isReadOnly,
103
- "data-state-skeletonize": skeletonize
104
- }, rest, {
105
- type: "checkbox",
106
- checked: isChecked,
107
- onChange: handleOnChange
108
- })), /*#__PURE__*/_react.default.createElement(_icons.default, {
109
- customClass: "checkmark",
110
- name: "checkmark",
111
- colorStyle: "default"
112
- })), hasLabel && /*#__PURE__*/_react.default.createElement("label", {
113
- className: "label ".concat(customClassLabel),
114
- title: label,
115
- htmlFor: inputId,
116
- "aria-readonly": isReadOnly,
117
- "aria-disabled": isDisabled,
118
- "data-testid": "test-checkbox-field-label",
119
- "data-state-skeletonize": skeletonize,
120
- "data-state-disabled": isDisabled,
121
- "data-state-read-only": isReadOnly,
122
- "data-state-uppercase": labelUppercase,
123
- "data-state-input-required": props.required
124
- }, label), hasLabel && hasHintMessages && hintPosition === 'onLabelRight' && !skeletonize && /*#__PURE__*/_react.default.createElement(_popover.default, {
125
- customClass: "label-popover",
126
- theme: themePopover,
127
- align: popoverAlign,
128
- iconColor: "#03bde2"
129
- }, /*#__PURE__*/_react.default.createElement(_popover.PopoverText, {
130
- text: props === null || props === void 0 ? void 0 : props.hint
131
- }))), hintPosition === 'below' && /*#__PURE__*/_react.default.createElement(_hint.default, {
132
- customClass: "hint",
133
- description: props.hint,
134
- disabled: isDisabled,
135
- skeletonize: skeletonize,
136
- visible: hasHintMessages
137
- }), hasValidationErrors && /*#__PURE__*/_react.default.createElement("span", {
138
- className: "error",
139
- "data-state-skeletonize": skeletonize,
140
- "aria-describedby": String(name).concat('-errors')
141
- }, errors === null || errors === void 0 ? void 0 : errors.map((error, index) => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, {
142
- key: "".concat(index + 1, "-").concat(error)
143
- }, error, "\xA0"))))), /*#__PURE__*/_react.default.createElement(_tooltip.Tooltip, {
144
- targetRef: inputRootRef,
145
- text: tooltip,
146
- width: tooltipWidth,
147
- position: tooltipPosition
148
- }));
43
+ disabled: isDisabled
44
+ }, props);
45
+ if (unvisible || hideContent) return null;
46
+ if (gridLayout) {
47
+ return /*#__PURE__*/_react.default.createElement(_gridlayout.default, {
48
+ cols: gridLayout
49
+ }, /*#__PURE__*/_react.default.createElement(_base.InputBase, _extends({
50
+ ref: ref
51
+ }, inputProps)));
52
+ }
53
+ return /*#__PURE__*/_react.default.createElement(_base.InputBase, _extends({
54
+ ref: ref
55
+ }, inputProps));
149
56
  });
150
57
  Input.displayName = 'CheckboxFieldInput';
@@ -1,9 +1,10 @@
1
1
  import 'react';
2
2
  export { LeftSlot, RightSlot } from '../slot/index.js';
3
- import '../../index-3b70931d.js';
4
- export { C as ColorFieldInputProps, I as Input } from '../../index-9e576346.js';
5
- import '../../@types/Align.js';
6
- import '../../@types/ColorStyles.js';
7
- import '../../@types/Position.js';
3
+ import '../../index-02a27c19.js';
4
+ export { C as ColorFieldInputProps, I as Input } from '../../index-6f5c772d.js';
8
5
  import '../../@types/PermissionAttr.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';
@@ -0,0 +1,13 @@
1
+ import React__default from 'react';
2
+ import { DateFieldInputBaseProps } from './types.js';
3
+ import 'moment';
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
+ import '../types.js';
10
+
11
+ declare const InputBase: React__default.ForwardRefExoticComponent<DateFieldInputBaseProps & React__default.RefAttributes<HTMLInputElement>>;
12
+
13
+ export { InputBase };