linear-react-components-ui 1.1.25-rc.8 → 1.1.25
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/{BaseMask-0c14ef51.d.ts → BaseMask-78847f45.d.ts} +1 -1
- package/lib/{Cnpj-bde01dd0.d.ts → Cnpj-8366781f.d.ts} +1 -1
- package/lib/{Cpf-3fa496ad.d.ts → Cpf-3dfd54eb.d.ts} +1 -1
- package/lib/{Phone-2bb0b397.d.ts → Phone-1962c0f2.d.ts} +1 -1
- package/lib/{ZipCode-09460e18.d.ts → ZipCode-be9c5b3b.d.ts} +1 -1
- package/lib/assets/styles/drawers.scss +0 -2
- package/lib/assets/styles/split.scss +1 -1
- package/lib/assets/styles/tooltip.scss +5 -4
- package/lib/drawer/Drawer.js +2 -3
- package/lib/drawer/index.js +1 -1
- package/lib/icons/helper.d.ts +12 -0
- package/lib/icons/helper.js +12 -0
- package/lib/{index-3b70931d.d.ts → index-02a27c19.d.ts} +2 -20
- package/lib/index-053f615b.d.ts +26 -0
- package/lib/{index-7dfa8924.d.ts → index-25b80f32.d.ts} +1 -1
- package/lib/{index-9e576346.d.ts → index-6f5c772d.d.ts} +1 -1
- package/lib/{index-208e7f62.d.ts → index-6fcf446c.d.ts} +2 -20
- package/lib/index-7159df18.d.ts +21 -0
- package/lib/inputs/date/index.js +2 -5
- package/lib/inputs2/checkboxfield/base.d.ts +29 -0
- package/lib/inputs2/checkboxfield/base.js +134 -0
- package/lib/inputs2/checkboxfield/index.d.ts +3 -2
- package/lib/inputs2/checkboxfield/index.js +32 -125
- package/lib/inputs2/colorfield/index.d.ts +6 -5
- package/lib/inputs2/date/datefield/base.d.ts +13 -0
- package/lib/inputs2/date/datefield/base.js +330 -0
- package/lib/inputs2/date/datefield/index.js +34 -322
- package/lib/inputs2/date/datefield/types.d.ts +5 -3
- package/lib/inputs2/date/dateperiodfield/base.d.ts +13 -0
- package/lib/inputs2/date/dateperiodfield/base.js +595 -0
- package/lib/inputs2/date/dateperiodfield/index.js +34 -587
- package/lib/inputs2/date/dateperiodfield/types.d.ts +5 -3
- package/lib/inputs2/filefield/index.d.ts +6 -5
- package/lib/inputs2/index.d.ts +17 -14
- package/lib/inputs2/mask/BaseMask.d.ts +6 -5
- package/lib/inputs2/mask/Cnpj.d.ts +7 -6
- package/lib/inputs2/mask/Cpf.d.ts +7 -6
- package/lib/inputs2/mask/Phone.d.ts +7 -6
- package/lib/inputs2/mask/ZipCode.d.ts +7 -6
- package/lib/inputs2/numberfield/currency.d.ts +5 -4
- package/lib/inputs2/numberfield/decimal.d.ts +5 -4
- package/lib/inputs2/numberfield/index.d.ts +5 -4
- package/lib/inputs2/numberfield/types.d.ts +5 -4
- package/lib/inputs2/radiofield/base.d.ts +12 -0
- package/lib/inputs2/radiofield/base.js +156 -0
- package/lib/inputs2/radiofield/index.js +25 -126
- package/lib/inputs2/radiofield/types.d.ts +6 -4
- package/lib/inputs2/selectfield/base.d.ts +11 -0
- package/lib/inputs2/selectfield/base.js +513 -0
- package/lib/inputs2/selectfield/index.d.ts +1 -1
- package/lib/inputs2/selectfield/index.js +35 -502
- package/lib/inputs2/selectfield/types.d.ts +8 -6
- package/lib/inputs2/textareafield/base.d.ts +26 -0
- package/lib/inputs2/textareafield/base.js +166 -0
- package/lib/inputs2/textareafield/index.d.ts +4 -3
- package/lib/inputs2/textareafield/index.js +30 -154
- package/lib/inputs2/textfield/base.d.ts +26 -0
- package/lib/inputs2/textfield/base.js +131 -0
- package/lib/inputs2/textfield/index.d.ts +5 -4
- package/lib/inputs2/textfield/index.js +30 -120
- package/lib/tooltip/TooltipContent.js +1 -1
- package/lib/tooltip/useTooltip.js +25 -0
- package/package.json +1 -1
- package/lib/index-cd005ed1.d.ts +0 -26
- package/lib/index-f03b97fe.d.ts +0 -42
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
|
-
import { M as MaskFieldProps } from './BaseMask-
|
|
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:
|
|
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:
|
|
52
|
+
left: var(--arrow-position);
|
|
52
53
|
margin-left: -5px;
|
|
53
54
|
border-width: 5px;
|
|
54
55
|
border-style: solid;
|
package/lib/drawer/Drawer.js
CHANGED
|
@@ -82,6 +82,7 @@ const BaseDrawer = _ref => {
|
|
|
82
82
|
const drawerOverlay = document.createElement('div');
|
|
83
83
|
drawerOverlay.className = 'drawer-overlay';
|
|
84
84
|
drawerOverlay.id = id;
|
|
85
|
+
drawerOverlay.inert = false;
|
|
85
86
|
drawerOverlay.dataset.testid = 'drawer-overlay';
|
|
86
87
|
body.appendChild(drawerOverlay);
|
|
87
88
|
};
|
|
@@ -100,10 +101,8 @@ const BaseDrawer = _ref => {
|
|
|
100
101
|
} else {
|
|
101
102
|
body = document.getElementById(targetId);
|
|
102
103
|
}
|
|
104
|
+
if (overlay && body) setDrawerOverlay(body, overlayId);
|
|
103
105
|
if (body) setDrawerComponent(body, randomId);
|
|
104
|
-
if (overlay && body) {
|
|
105
|
-
setDrawerOverlay(body, overlayId);
|
|
106
|
-
}
|
|
107
106
|
return () => {
|
|
108
107
|
const drawerOverlay = document.getElementById(overlayId);
|
|
109
108
|
if (closeOnEsc) document.body.removeEventListener('keydown', closeDrawerOnEsc);
|
package/lib/drawer/index.js
CHANGED
|
@@ -16,10 +16,10 @@ Object.defineProperty(exports, "DrawerHeader", {
|
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
18
|
exports.default = void 0;
|
|
19
|
+
require("../assets/styles/drawers.scss");
|
|
19
20
|
var _Drawer = _interopRequireDefault(require("./Drawer"));
|
|
20
21
|
var _Header = _interopRequireDefault(require("./Header"));
|
|
21
22
|
var _Content = _interopRequireDefault(require("./Content"));
|
|
22
|
-
require("../assets/styles/drawers.scss");
|
|
23
23
|
var _withFormSecurity = _interopRequireDefault(require("../form/withFormSecurity"));
|
|
24
24
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
25
25
|
var _default = exports.default = (0, _withFormSecurity.default)(_Drawer.default);
|
package/lib/icons/helper.d.ts
CHANGED
|
@@ -651,6 +651,18 @@ declare const _default: {
|
|
|
651
651
|
viewbox: string;
|
|
652
652
|
paths: string[];
|
|
653
653
|
};
|
|
654
|
+
perdaConsumoInterno: {
|
|
655
|
+
viewbox: string;
|
|
656
|
+
paths: string[];
|
|
657
|
+
};
|
|
658
|
+
inventario: {
|
|
659
|
+
viewbox: string;
|
|
660
|
+
paths: string[];
|
|
661
|
+
};
|
|
662
|
+
trocaFornecedor: {
|
|
663
|
+
viewbox: string;
|
|
664
|
+
paths: string[];
|
|
665
|
+
};
|
|
654
666
|
};
|
|
655
667
|
|
|
656
668
|
export { _default as default };
|
package/lib/icons/helper.js
CHANGED
|
@@ -656,5 +656,17 @@ var _default = exports.default = {
|
|
|
656
656
|
minus: {
|
|
657
657
|
viewbox: '0 0 16 16',
|
|
658
658
|
paths: ['M0 5h16v6h-16z']
|
|
659
|
+
},
|
|
660
|
+
perdaConsumoInterno: {
|
|
661
|
+
viewbox: '0 0 16 16',
|
|
662
|
+
paths: ['M6 7.25c0 0.412-0.338 0.75-0.75 0.75h-1.5c-0.413 0-0.75-0.338-0.75-0.75v-1.5c0-0.412 0.337-0.75 0.75-0.75h1.5c0.412 0 0.75 0.338 0.75 0.75v1.5z', 'M11 7.25c0 0.412-0.338 0.75-0.75 0.75h-1.5c-0.412 0-0.75-0.338-0.75-0.75v-1.5c0-0.412 0.338-0.75 0.75-0.75h1.5c0.412 0 0.75 0.338 0.75 0.75v1.5z', 'M6 12.25c0 0.412-0.338 0.75-0.75 0.75h-1.5c-0.413 0-0.75-0.338-0.75-0.75v-1.5c0-0.412 0.337-0.75 0.75-0.75h1.5c0.412 0 0.75 0.338 0.75 0.75v1.5z', 'M14.251 2.5l1.749-1.749v-0.751h-0.751l-1.749 1.749-1.749-1.749h-0.751v0.751l1.749 1.749-1.749 1.749v0.751h0.751l1.749-1.749 1.749 1.749h0.751v-0.751z', 'M0 12h1v2h-1v-2z', 'M0 9h1v2h-1v-2z', 'M13 7h1v2h-1v-2z', 'M13 13h1v2h-1v-2z', 'M13 10h1v2h-1v-2z', 'M0 6h1v2h-1v-2z', 'M0 3h1v2h-1v-2z', 'M8 2h2v1h-2v-1z', 'M5 2h2v1h-2v-1z', 'M2 2h2v1h-2v-1z', 'M7 15h2v1h-2v-1z', 'M10 15h2v1h-2v-1z', 'M4 15h2v1h-2v-1z', 'M1 15h2v1h-2v-1z']
|
|
663
|
+
},
|
|
664
|
+
inventario: {
|
|
665
|
+
viewbox: '0 0 16 16',
|
|
666
|
+
paths: ['M11 4v-4h-11v11h4v5h12v-12h-5zM10 6.125h-4v-0.125h4v0.125zM10 10h-4v-0.125h4v0.125zM10 9.625h-4v-0.25h4v0.25zM10 9.125h-4v-0.25h4v0.25zM10 8.625h-4v-0.25h4v0.25zM10 8.125h-4v-0.25h4v0.25zM10 7.625h-4v-0.25h4v0.25zM10 7.125h-4v-0.25h4v0.25zM10 6.625h-4v-0.25h4v0.25zM4 10h-3v-9h9v3h-6v6zM15 15h-10v-3h7v-7h3v10z']
|
|
667
|
+
},
|
|
668
|
+
trocaFornecedor: {
|
|
669
|
+
viewbox: '0 0 16 16',
|
|
670
|
+
paths: ['M11 8v6h1v-6h2.5l-3-3-3 3z', 'M1 3h1.5v1h-1.5v-1z', 'M3 3h1.5v1h-1.5v-1z', 'M5 3h1v1.5h-1v-1.5z', 'M1 6.5h1v1.5h-1v-1.5z', 'M2.5 7h1.5v1h-1.5v-1z', 'M4.5 7h1.5v1h-1.5v-1z', 'M1 4.5h1v1.5h-1v-1.5z', 'M5 5h1v1.5h-1v-1.5z', 'M5 11v3h-3v-3h3zM6 10h-5v5h5v-5z']
|
|
659
671
|
}
|
|
660
672
|
};
|
|
@@ -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 {
|
|
4
|
+
import { TextFieldInputBaseProps } from './inputs2/textfield/base.js';
|
|
8
5
|
|
|
9
|
-
interface TextFieldInputProps extends
|
|
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,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-
|
|
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 {
|
|
4
|
+
import { TextAreaFieldInputBaseProps } from './inputs2/textareafield/base.js';
|
|
8
5
|
|
|
9
|
-
interface TextAreaFieldInputProps extends
|
|
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 };
|
package/lib/inputs/date/index.js
CHANGED
|
@@ -285,12 +285,9 @@ const DatePicker = props => {
|
|
|
285
285
|
onInputFocus(e);
|
|
286
286
|
},
|
|
287
287
|
onChange: (e, date) => {
|
|
288
|
-
onInputChange(e, date);
|
|
289
|
-
},
|
|
290
|
-
inputRef: el => {
|
|
291
|
-
inputDateRef.current = el;
|
|
292
|
-
if (inputRefProp) inputRefProp.current = el;
|
|
288
|
+
if (date) onInputChange(e, date);
|
|
293
289
|
},
|
|
290
|
+
inputRef: inputRefProp,
|
|
294
291
|
rightElements: getButtonOpen(),
|
|
295
292
|
required: required,
|
|
296
293
|
handlerSetOnDenied: () => setOnDenied(onDenied)
|
|
@@ -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';
|