linear-react-components-ui 1.1.26-beta.21 → 1.1.26-beta.22
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/assets/styles/datepicker2.css +1 -1
- package/lib/assets/styles/dialog.css +1 -1
- package/lib/assets/styles/drawers.css +1 -1
- package/lib/assets/styles/gridlayout.css +1 -1
- package/lib/assets/styles/selectfield.css +1 -1
- package/lib/assets/styles/textfield.css +1 -1
- package/lib/assets/styles/tooltip.css +1 -1
- package/lib/dialog/base/index.js +53 -55
- package/lib/dialog/base/index.js.map +1 -1
- package/lib/dialog/form/index.js +56 -55
- package/lib/dialog/form/index.js.map +1 -1
- package/lib/drawer/Drawer.js +7 -7
- package/lib/drawer/Drawer.js.map +1 -1
- package/lib/drawer/index.js +1 -1
- package/lib/drawer/index.js.map +1 -1
- package/lib/form2/types.d.ts +9 -4
- package/lib/form2/useForm/index.js +96 -89
- package/lib/form2/useForm/index.js.map +1 -1
- package/lib/icons/helper.d.ts +12 -0
- package/lib/icons/helper.js +12 -0
- package/lib/icons/helper.js.map +1 -1
- package/lib/inputs/date/index.js +59 -61
- package/lib/inputs/date/index.js.map +1 -1
- package/lib/inputs2/checkboxfield/base.d.ts +27 -0
- package/lib/inputs2/checkboxfield/base.js +100 -0
- package/lib/inputs2/checkboxfield/base.js.map +1 -0
- package/lib/inputs2/checkboxfield/index.d.ts +4 -25
- package/lib/inputs2/checkboxfield/index.js +41 -108
- package/lib/inputs2/checkboxfield/index.js.map +1 -1
- package/lib/inputs2/date/datefield/base.d.ts +3 -0
- package/lib/inputs2/date/datefield/base.js +193 -0
- package/lib/inputs2/date/datefield/base.js.map +1 -0
- package/lib/inputs2/date/datefield/index.d.ts +2 -1
- package/lib/inputs2/date/datefield/index.js +42 -312
- package/lib/inputs2/date/datefield/index.js.map +1 -1
- package/lib/inputs2/date/datefield/types.d.ts +6 -4
- package/lib/inputs2/date/dateperiodfield/base.d.ts +3 -0
- package/lib/inputs2/date/dateperiodfield/base.js +511 -0
- package/lib/inputs2/date/dateperiodfield/base.js.map +1 -0
- package/lib/inputs2/date/dateperiodfield/index.d.ts +2 -1
- package/lib/inputs2/date/dateperiodfield/index.js +42 -517
- package/lib/inputs2/date/dateperiodfield/index.js.map +1 -1
- package/lib/inputs2/date/dateperiodfield/types.d.ts +6 -4
- package/lib/inputs2/mask/Cnpj.d.ts +1 -3
- package/lib/inputs2/mask/Cnpj.js +38 -44
- package/lib/inputs2/mask/Cnpj.js.map +1 -1
- package/lib/inputs2/mask/Cpf.d.ts +0 -1
- package/lib/inputs2/mask/Cpf.js +32 -42
- package/lib/inputs2/mask/Cpf.js.map +1 -1
- package/lib/inputs2/numberfield/index.js +85 -68
- package/lib/inputs2/numberfield/index.js.map +1 -1
- package/lib/inputs2/radiofield/base.d.ts +3 -0
- package/lib/inputs2/radiofield/base.js +115 -0
- package/lib/inputs2/radiofield/base.js.map +1 -0
- package/lib/inputs2/radiofield/index.d.ts +2 -1
- package/lib/inputs2/radiofield/index.js +41 -108
- package/lib/inputs2/radiofield/index.js.map +1 -1
- package/lib/inputs2/radiofield/types.d.ts +5 -2
- package/lib/inputs2/selectfield/base.d.ts +3 -0
- package/lib/inputs2/selectfield/base.js +411 -0
- package/lib/inputs2/selectfield/base.js.map +1 -0
- package/lib/inputs2/selectfield/index.d.ts +3 -3
- package/lib/inputs2/selectfield/index.js +49 -404
- package/lib/inputs2/selectfield/index.js.map +1 -1
- package/lib/inputs2/selectfield/listbox.d.ts +0 -1
- package/lib/inputs2/selectfield/listbox.js +33 -34
- package/lib/inputs2/selectfield/listbox.js.map +1 -1
- package/lib/inputs2/selectfield/types.d.ts +8 -7
- package/lib/inputs2/selectfield/types.js.map +1 -1
- package/lib/inputs2/textareafield/base.d.ts +23 -0
- package/lib/inputs2/textareafield/base.js +137 -0
- package/lib/inputs2/textareafield/base.js.map +1 -0
- package/lib/inputs2/textareafield/index.d.ts +4 -22
- package/lib/inputs2/textareafield/index.js +45 -130
- package/lib/inputs2/textareafield/index.js.map +1 -1
- package/lib/inputs2/textfield/base.d.ts +23 -0
- package/lib/inputs2/textfield/base.js +107 -0
- package/lib/inputs2/textfield/base.js.map +1 -0
- package/lib/inputs2/textfield/index.d.ts +4 -22
- package/lib/inputs2/textfield/index.js +45 -103
- package/lib/inputs2/textfield/index.js.map +1 -1
- package/lib/tooltip/types.d.ts +4 -1
- package/lib/tooltip/useTooltip.js +68 -86
- package/lib/tooltip/useTooltip.js.map +1 -1
- package/package.json +1 -1
- package/lib/inputs2/selectfield/simple.d.ts +0 -9
- package/lib/inputs2/selectfield/simple.js +0 -24
- package/lib/inputs2/selectfield/simple.js.map +0 -1
package/lib/inputs/date/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as ue, jsx as m } from "react/jsx-runtime";
|
|
2
2
|
import '../../assets/styles/button.css';import '../../assets/styles/datepicker.css';/* empty css */
|
|
3
3
|
import { useState as g, useRef as C, useEffect as w } from "react";
|
|
4
|
-
import
|
|
4
|
+
import a from "../../node_modules/moment/dist/moment.js";
|
|
5
5
|
import de from "../../gridlayout/GridCol.js";
|
|
6
6
|
import "../../_virtual/compiler-runtime.js";
|
|
7
7
|
import fe from "../../buttons/Button.js";
|
|
@@ -11,73 +11,73 @@ import ge from "../mask/BaseMask.js";
|
|
|
11
11
|
import Ce from "./Dialog.js";
|
|
12
12
|
import he from "./Dropdown.js";
|
|
13
13
|
import { getMomentValue as De, EN_US_FORMAT as pe, EN_US_FORMAT_DATETIME as ye, blocksDateTimeFormat as Ee, PT_BR_FORMAT as be, PT_BR_FORMAT_DATETIME as Fe } from "./helpers.js";
|
|
14
|
-
const Ae = (
|
|
14
|
+
const Ae = (n) => {
|
|
15
15
|
const {
|
|
16
16
|
showButtonOpen: O = !0,
|
|
17
|
-
openOnFocus:
|
|
18
|
-
shouldCloseOnSelect:
|
|
19
|
-
setFocusOnSelect:
|
|
17
|
+
openOnFocus: H = !0,
|
|
18
|
+
shouldCloseOnSelect: U = !0,
|
|
19
|
+
setFocusOnSelect: q = !0,
|
|
20
20
|
showCalendarInDialog: c = !1,
|
|
21
|
-
required:
|
|
21
|
+
required: G = !1,
|
|
22
22
|
value: r = "",
|
|
23
|
-
name:
|
|
24
|
-
inputRef:
|
|
23
|
+
name: W = "",
|
|
24
|
+
inputRef: J,
|
|
25
25
|
dialogSize: Q = {
|
|
26
26
|
width: "384px",
|
|
27
27
|
height: "384px"
|
|
28
28
|
},
|
|
29
|
-
gridLayout:
|
|
29
|
+
gridLayout: T,
|
|
30
30
|
shouldCloseOnEsc: X = !0,
|
|
31
31
|
isDateTimeField: f = !1
|
|
32
|
-
} =
|
|
32
|
+
} = n, Z = f ? Date : "00/00/0000", S = f ? "DD/MM/YYYY HH:mm" : void 0, u = f ? Fe : be, h = f ? ye : pe, [p, y] = g(r ? De(r) : void 0), [i, d] = g(!1), [V, I] = g(a(r, S).format()), [$, L] = g(), [_, k] = g(!1), [l, ee] = g({
|
|
33
33
|
disabled: !1,
|
|
34
34
|
readOnly: !1,
|
|
35
35
|
unvisible: !1,
|
|
36
36
|
hideContent: !1
|
|
37
|
-
}),
|
|
38
|
-
|
|
37
|
+
}), s = C(null), te = C(null), E = C(null), M = C(null), v = C(null), B = C(null), R = () => {
|
|
38
|
+
L(s?.current?.getBoundingClientRect());
|
|
39
39
|
}, ne = () => {
|
|
40
40
|
d(!1), c && setTimeout(() => {
|
|
41
|
-
k(!1),
|
|
41
|
+
k(!1), s.current?.focus();
|
|
42
42
|
}, 100);
|
|
43
43
|
}, oe = (e) => {
|
|
44
|
-
const
|
|
45
|
-
!c &&
|
|
46
|
-
},
|
|
47
|
-
if (X &&
|
|
48
|
-
const
|
|
49
|
-
e.shiftKey && document.activeElement ===
|
|
44
|
+
const t = !B.current?.contains(e.relatedTarget);
|
|
45
|
+
!c && i && t && d(!1);
|
|
46
|
+
}, P = (e) => {
|
|
47
|
+
if (X && i && e && e.key && e.key === "Escape" && (e.preventDefault(), d(!1), s.current?.focus()), i && c && e && e.key && e.key === "Tab") {
|
|
48
|
+
const t = v.current?.getElementsByClassName("navbutton"), F = (v.current?.getElementsByClassName("-selectedday"))[0].firstChild, D = Array.from([...t, F]), Y = D[0], K = D[D.length - 1];
|
|
49
|
+
e.shiftKey && document.activeElement === Y ? (e.preventDefault(), K.focus()) : !e.shiftKey && document.activeElement === K && (e.preventDefault(), Y.focus());
|
|
50
50
|
}
|
|
51
51
|
e.stopPropagation();
|
|
52
52
|
}, b = () => {
|
|
53
|
-
const e =
|
|
54
|
-
E && E.current && e && (E.current.style.top = String(
|
|
55
|
-
},
|
|
56
|
-
d(!0),
|
|
57
|
-
|
|
53
|
+
const e = s.current?.getBoundingClientRect(), t = e && e.bottom;
|
|
54
|
+
E && E.current && e && (E.current.style.top = String(t).concat("px"));
|
|
55
|
+
}, A = () => {
|
|
56
|
+
d(!0), s.current && (s.current.focus(), L(s.current?.getBoundingClientRect())), c && setTimeout(() => {
|
|
57
|
+
M.current?.focus();
|
|
58
58
|
}, 100);
|
|
59
59
|
}, re = (e) => {
|
|
60
|
-
|
|
60
|
+
n.onFocus && n.onFocus(e), H && !i && !_ && A();
|
|
61
61
|
}, ae = (e) => {
|
|
62
|
-
|
|
62
|
+
n.onBlur && n.onBlur(e);
|
|
63
63
|
}, ie = (e) => {
|
|
64
64
|
if (typeof e == "object" && !(e instanceof Date)) {
|
|
65
|
-
const
|
|
66
|
-
return
|
|
65
|
+
const t = a(e.initial, u, !0).isValid(), o = a(e.final, u, !0).isValid();
|
|
66
|
+
return t && o;
|
|
67
67
|
}
|
|
68
|
-
return
|
|
69
|
-
},
|
|
70
|
-
if (typeof
|
|
68
|
+
return a(e, u, !0).isValid();
|
|
69
|
+
}, x = (e, t = "") => {
|
|
70
|
+
if (typeof t == "string") {
|
|
71
71
|
const o = e.target.value ?? "";
|
|
72
|
-
if (
|
|
72
|
+
if (n.onChange) {
|
|
73
73
|
if (ie(o)) {
|
|
74
74
|
const D = {
|
|
75
75
|
target: {
|
|
76
|
-
value:
|
|
76
|
+
value: a(o, u).format(h),
|
|
77
77
|
name: e.target.name
|
|
78
78
|
}
|
|
79
79
|
};
|
|
80
|
-
|
|
80
|
+
n.onChange(D, o);
|
|
81
81
|
} else if (e.target.value === "") {
|
|
82
82
|
const F = {
|
|
83
83
|
target: {
|
|
@@ -85,51 +85,49 @@ const Ae = (t) => {
|
|
|
85
85
|
name: e.target.name
|
|
86
86
|
}
|
|
87
87
|
};
|
|
88
|
-
|
|
88
|
+
n.onChange(F, o), d(!1), y(void 0);
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
|
-
},
|
|
93
|
-
|
|
92
|
+
}, N = (e, t) => {
|
|
93
|
+
i && q && s.current?.focus(), n.onComplete && n.onComplete(t, e), n.onChange && x({
|
|
94
94
|
target: {
|
|
95
95
|
value: e ?? "",
|
|
96
|
-
name:
|
|
96
|
+
name: W
|
|
97
97
|
}
|
|
98
|
-
}, e),
|
|
99
|
-
}, se = () =>
|
|
98
|
+
}, e), U && d(!1), y(a(e, u));
|
|
99
|
+
}, se = () => n.disabled || l && (l.disabled || l.hideContent), le = () => {
|
|
100
100
|
if (O)
|
|
101
|
-
return /* @__PURE__ */ m(fe, { disabled: se(), tabIndex: -1, customClass: "calendar-button", iconName: "calendar", title:
|
|
102
|
-
|
|
101
|
+
return /* @__PURE__ */ m(fe, { disabled: se(), tabIndex: -1, customClass: "calendar-button", iconName: "calendar", title: i ? "Fechar Calendário" : "Abrir Calendário", onClick: () => {
|
|
102
|
+
i ? d(!1) : A();
|
|
103
103
|
}, targetRef: (e) => {
|
|
104
104
|
te.current = e;
|
|
105
105
|
} }, "button-open-date-picker");
|
|
106
|
-
},
|
|
107
|
-
|
|
108
|
-
}, currentDateButton: (o) =>
|
|
106
|
+
}, j = (e, t) => /* @__PURE__ */ m(me, { colorStyle: t, currentDate: e !== void 0 ? e : a(), onDateChange: (o) => {
|
|
107
|
+
N(o.format(u), void 0), c && k(!1);
|
|
108
|
+
}, currentDateButton: (o) => M.current = o, calendarContainer: (o) => {
|
|
109
109
|
v.current = o;
|
|
110
|
-
} }), ce = () => l && l.readOnly ? null : c ? /* @__PURE__ */ m(Ce, { dialogSize: Q, handlerClose: ne, children:
|
|
110
|
+
} }), ce = () => l && l.readOnly ? null : c ? /* @__PURE__ */ m(Ce, { dialogSize: Q, handlerClose: ne, children: j(p, n?.calendarColorStyle) }) : /* @__PURE__ */ m(he, { showButtonOpen: O, inputDimensions: $, containerRef: B, dropdownRef: (e) => {
|
|
111
111
|
E.current = e;
|
|
112
|
-
}, children:
|
|
112
|
+
}, children: j(p, n?.calendarColorStyle) });
|
|
113
113
|
if (w(() => {
|
|
114
|
-
r &&
|
|
115
|
-
}, [r]), w(() => (window.addEventListener("resize", R), document.addEventListener("keydown",
|
|
116
|
-
window.removeEventListener("resize", R), document.removeEventListener("keydown",
|
|
117
|
-
}), [
|
|
114
|
+
r && a(r, h).format() !== "Invalid date" && a(V, h).format() !== a(r, h).format() ? (y(a(r, h)), I(r)) : !r && r !== V && (y(void 0), I(r));
|
|
115
|
+
}, [r]), w(() => (window.addEventListener("resize", R), document.addEventListener("keydown", P), s.current && R(), i && c && k(!0), () => {
|
|
116
|
+
window.removeEventListener("resize", R), document.removeEventListener("keydown", P);
|
|
117
|
+
}), [s.current, i]), w(() => (document.addEventListener("scroll", b), document.getElementById("modal-dialog-content")?.addEventListener("scroll", b), () => {
|
|
118
118
|
document.removeEventListener("scroll", b), document.getElementById("modal-dialog-content")?.removeEventListener("scroll", b);
|
|
119
119
|
}), []), l && l.unvisible) return null;
|
|
120
|
-
const
|
|
121
|
-
/* @__PURE__ */ m(ge, { ...
|
|
122
|
-
e &&
|
|
120
|
+
const z = () => /* @__PURE__ */ ue("div", { ref: B, onBlur: oe, className: "datepicker-container", children: [
|
|
121
|
+
/* @__PURE__ */ m(ge, { ...n, gridLayout: void 0, isDateTimeField: f, value: p ? p.format(u) : " ", mask: Z, pattern: S, blocks: f ? Ee : {}, onComplete: (e) => {
|
|
122
|
+
e && N(e.target?.maskedValue, e);
|
|
123
123
|
}, onBlur: ae, onFocus: (e) => {
|
|
124
124
|
re(e);
|
|
125
|
-
}, onChange: (e,
|
|
126
|
-
|
|
127
|
-
}, inputRef: (
|
|
128
|
-
|
|
129
|
-
}, rightElements: le(), required: W, handlerSetOnDenied: () => ee(l) }),
|
|
130
|
-
s && ce()
|
|
125
|
+
}, onChange: (e, t) => {
|
|
126
|
+
t && x(e, t);
|
|
127
|
+
}, inputRef: J, rightElements: le(), required: G, handlerSetOnDenied: () => ee(l) }),
|
|
128
|
+
i && ce()
|
|
131
129
|
] });
|
|
132
|
-
return
|
|
130
|
+
return T ? /* @__PURE__ */ m(de, { customClass: "-withinput", cols: T, children: z() }) : z();
|
|
133
131
|
};
|
|
134
132
|
export {
|
|
135
133
|
Ae as default
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/lib/inputs/date/index.tsx"],"sourcesContent":["import '../../assets/styles/datepicker.scss';\n\nimport { FocusEvent as ReactFocusEvent, useEffect, useRef, useState } from 'react';\nimport moment, { Moment } from 'moment';\nimport Grid from '../../gridlayout';\nimport Button from '../../buttons';\nimport Calendar from '../../calendar';\nimport { ColorStyles } from '../../@types/ColorStyles';\nimport BaseMask from '../mask/BaseMask';\nimport { CustomInputEvent } from '../base/types';\nimport Dialog from './Dialog';\nimport Dropdown from './Dropdown';\nimport { IDatePickerProps } from './types';\nimport {\n getMomentValue, PT_BR_FORMAT, EN_US_FORMAT, PT_BR_FORMAT_DATETIME,\n EN_US_FORMAT_DATETIME, blocksDateTimeFormat,\n} from './helpers';\n\nconst DatePicker = (props: IDatePickerProps) => {\n const {\n showButtonOpen = true, openOnFocus = true, shouldCloseOnSelect = true, setFocusOnSelect = true,\n showCalendarInDialog = false, required = false, value = '', name = '', inputRef: inputRefProp,\n dialogSize = { width: '384px', height: '384px' }, gridLayout, shouldCloseOnEsc = true,\n isDateTimeField = false,\n } = props;\n\n const maskFormat = !isDateTimeField ? '00/00/0000' : Date;\n const patternFormat = !isDateTimeField ? undefined : 'DD/MM/YYYY HH:mm';\n const brFormatter = !isDateTimeField ? PT_BR_FORMAT : PT_BR_FORMAT_DATETIME;\n const usFormatter = !isDateTimeField ? EN_US_FORMAT : EN_US_FORMAT_DATETIME;\n\n const [valueState, setValueState] =\n useState<Moment | undefined>(value ? getMomentValue(value) : undefined);\n const [showCalendar, setShowCalendar] = useState(false);\n const [valueFromProps, setValueFromProps] = useState(moment(value, patternFormat).format());\n const [inputDimensions, setInputDimensions] = useState<DOMRect>();\n const [calendarOnDialog, setCalendarOnDialog] = useState(false);\n const [onDenied, setOnDenied] = useState({\n disabled: false,\n readOnly: false,\n unvisible: false,\n hideContent: false,\n });\n const inputDateRef = useRef<HTMLInputElement | HTMLTextAreaElement | null>(null);\n const buttonOpenRef = useRef<HTMLButtonElement>(null);\n const dropdownContainer = useRef<HTMLDivElement>(null);\n const currentDateButtonRef = useRef<HTMLButtonElement>(null);\n const calendarContainerRef = useRef<HTMLDivElement | null>(null);\n const datePickerContainerRef = useRef<HTMLDivElement>(null);\n\n const onScreenResize = () => {\n setInputDimensions(inputDateRef?.current?.getBoundingClientRect());\n };\n\n const onCloseDateDialog = () => {\n setShowCalendar(false);\n if (showCalendarInDialog) {\n setTimeout(() => {\n setCalendarOnDialog(false);\n inputDateRef.current?.focus();\n }, 100);\n }\n };\n\n const onCloseWithoutBlur = (event: ReactFocusEvent<HTMLDivElement>) => {\n const focusOnAnotherField = !datePickerContainerRef.current?.contains(event.relatedTarget);\n if (!showCalendarInDialog && showCalendar && focusOnAnotherField) { setShowCalendar(false); }\n };\n\n const onKeyDownPress = (event: KeyboardEvent) => {\n if (shouldCloseOnEsc && showCalendar && event && event.key && event.key === 'Escape') {\n event.preventDefault();\n setShowCalendar(false);\n inputDateRef.current?.focus();\n }\n if (showCalendar && showCalendarInDialog && event && event.key && event.key === 'Tab') {\n const buttonForNavigateCalendar = calendarContainerRef.current?.getElementsByClassName('navbutton') as HTMLCollectionOf<HTMLButtonElement>;\n const datePicked = calendarContainerRef.current?.getElementsByClassName('-selectedday') as HTMLCollectionOf<HTMLButtonElement>;\n const buttonDatePicked = datePicked[0].firstChild as HTMLButtonElement;\n const buttonsForFocus = Array.from([...buttonForNavigateCalendar, buttonDatePicked]);\n const firstElement = buttonsForFocus[0];\n const lastElement = buttonsForFocus[buttonsForFocus.length - 1];\n\n if (event.shiftKey && document.activeElement === firstElement) {\n event.preventDefault();\n lastElement.focus();\n } else if (!event.shiftKey && document.activeElement === lastElement) {\n event.preventDefault();\n firstElement.focus();\n }\n }\n event.stopPropagation();\n };\n\n const keepPositionCalendarByScroll = () => {\n const inputDateDimensions = inputDateRef.current?.getBoundingClientRect();\n const positionTop = inputDateDimensions && inputDateDimensions.bottom;\n if (dropdownContainer && dropdownContainer.current && inputDateDimensions) {\n dropdownContainer.current.style.top = String(positionTop).concat('px');\n }\n };\n\n const openCalendar = () => {\n setShowCalendar(true);\n if (inputDateRef.current) {\n inputDateRef.current.focus();\n setInputDimensions(inputDateRef.current?.getBoundingClientRect());\n }\n if (showCalendarInDialog) {\n setTimeout(() => { currentDateButtonRef.current?.focus(); }, 100);\n }\n };\n\n const onInputFocus = (e: CustomInputEvent) => {\n if (props.onFocus) props.onFocus(e);\n if (openOnFocus && !showCalendar && !calendarOnDialog) { openCalendar(); }\n };\n\n const onInputBlur = (e: CustomInputEvent) => {\n if (props.onBlur) props.onBlur(e);\n };\n\n const isValidDate = (date: Date | string | { initial?: string, final?: string }) => {\n if (typeof date === 'object' && !(date instanceof Date)) {\n const initialValid = moment(date.initial, brFormatter, true).isValid();\n const finalValid = moment(date.final, brFormatter, true).isValid();\n\n return initialValid && finalValid;\n }\n\n return moment(date, brFormatter, true).isValid();\n };\n\n const onInputChange = (\n event: CustomInputEvent,\n valueInput: string | {\n initial: string;\n final: string;\n } = '',\n ) => {\n if (typeof valueInput === 'string') {\n const date = event.target.value ?? '';\n if (props.onChange) {\n if (isValidDate(date)) {\n const newValue = moment(date, brFormatter).format(usFormatter);\n const obj = { target: { value: newValue, name: event.target.name } };\n props.onChange(obj, date);\n } else if (event.target.value === '') {\n const obj = { target: { value: '', name: event.target.name } };\n props.onChange(obj, date);\n setShowCalendar(false);\n setValueState(undefined);\n }\n }\n }\n };\n\n const setValue = (valueParam?: string, e?: CustomInputEvent) => {\n if (showCalendar && setFocusOnSelect) inputDateRef.current?.focus();\n if (props.onComplete) props.onComplete(e, valueParam);\n if (props.onChange) onInputChange({ target: { value: valueParam ?? '', name } }, valueParam);\n if (shouldCloseOnSelect) setShowCalendar(false);\n setValueState(moment(valueParam, brFormatter));\n };\n\n const shouldDisable = () =>\n props.disabled || (onDenied && (onDenied.disabled || onDenied.hideContent));\n\n const getButtonOpen = () => {\n if (!showButtonOpen) return undefined;\n return (\n <Button\n key=\"button-open-date-picker\"\n disabled={shouldDisable()}\n tabIndex={-1}\n customClass=\"calendar-button\"\n iconName='calendar'\n title={showCalendar ? 'Fechar Calendário' : 'Abrir Calendário'}\n onClick={() => { if (showCalendar) { setShowCalendar(false); } else openCalendar(); }}\n targetRef={(ref: HTMLButtonElement) => { buttonOpenRef.current = ref; }} />\n );\n };\n\n const getCalendar = (valueCalendar?: Moment, calendarColorStyle?: ColorStyles) => (\n <Calendar\n colorStyle={calendarColorStyle}\n currentDate={valueCalendar !== undefined ? valueCalendar : moment()}\n onDateChange={(date) => {\n setValue(date.format(brFormatter), undefined);\n if (showCalendarInDialog) setCalendarOnDialog(false);\n }}\n currentDateButton={buttonElement => currentDateButtonRef.current = buttonElement}\n calendarContainer={(calendarContainer) => { \n calendarContainerRef.current = calendarContainer; \n }} />\n );\n\n const getCalendarComponent = () => {\n if (onDenied && onDenied.readOnly) return null;\n if (showCalendarInDialog) {\n return (\n <Dialog\n dialogSize={dialogSize}\n handlerClose={onCloseDateDialog}>\n {getCalendar(valueState, props?.calendarColorStyle)}\n </Dialog>\n );\n }\n\n return (\n <Dropdown\n showButtonOpen={showButtonOpen}\n inputDimensions={inputDimensions}\n containerRef={datePickerContainerRef as any}\n dropdownRef={(el: HTMLDivElement) => { dropdownContainer.current = el; }}>\n {getCalendar(valueState, props?.calendarColorStyle)}\n </Dropdown>\n );\n };\n\n useEffect(() => {\n if (value && moment(value, usFormatter).format() !== 'Invalid date' &&\n moment(valueFromProps, usFormatter).format() !== moment(value, usFormatter).format()) {\n setValueState(moment(value, usFormatter));\n setValueFromProps(value);\n } else if (!value && value !== valueFromProps) {\n setValueState(undefined);\n setValueFromProps(value);\n }\n }, [value]);\n\n useEffect(() => {\n window.addEventListener('resize', onScreenResize);\n document.addEventListener('keydown', onKeyDownPress);\n if (inputDateRef.current) onScreenResize();\n if (showCalendar && showCalendarInDialog) setCalendarOnDialog(true);\n\n return () => {\n window.removeEventListener('resize', onScreenResize);\n document.removeEventListener('keydown', onKeyDownPress);\n };\n }, [inputDateRef.current, showCalendar]);\n\n useEffect(() => {\n document.addEventListener('scroll', keepPositionCalendarByScroll);\n document.getElementById('modal-dialog-content')?.addEventListener('scroll', keepPositionCalendarByScroll);\n\n return () => {\n document.removeEventListener('scroll', keepPositionCalendarByScroll);\n document.getElementById('modal-dialog-content')?.removeEventListener('scroll', keepPositionCalendarByScroll);\n };\n }, []);\n\n if (onDenied && onDenied.unvisible) return null;\n\n const component = () => (\n <div ref={datePickerContainerRef} onBlur={onCloseWithoutBlur} className=\"datepicker-container\">\n <BaseMask\n {...props}\n gridLayout={undefined}\n isDateTimeField={isDateTimeField}\n value={!valueState ? ' ' : valueState.format(brFormatter)}\n mask={maskFormat}\n pattern={patternFormat}\n blocks={!isDateTimeField ? {} : blocksDateTimeFormat}\n onComplete={(e) => { if (e) { setValue(e.target?.maskedValue, e); } }}\n onBlur={onInputBlur}\n onFocus={(e: CustomInputEvent) => { onInputFocus(e); }}\n onChange={(e, date) => { onInputChange(e, date); }}\n inputRef={(el: HTMLInputElement | HTMLTextAreaElement | null) => {\n inputDateRef.current = el;\n if (inputRefProp) inputRefProp.current = el;\n }}\n rightElements={getButtonOpen()}\n required={required}\n handlerSetOnDenied={() => setOnDenied(onDenied)} />\n {showCalendar && getCalendarComponent()}\n </div>\n );\n\n return (!gridLayout ? component() : <Grid customClass=\"-withinput\" cols={gridLayout}>{component()}</Grid>);\n};\n\nexport default DatePicker;\n"],"names":["DatePicker","props","showButtonOpen","openOnFocus","shouldCloseOnSelect","setFocusOnSelect","showCalendarInDialog","required","value","name","inputRef","inputRefProp","dialogSize","width","height","gridLayout","shouldCloseOnEsc","isDateTimeField","maskFormat","Date","patternFormat","undefined","brFormatter","PT_BR_FORMAT_DATETIME","PT_BR_FORMAT","usFormatter","EN_US_FORMAT_DATETIME","EN_US_FORMAT","valueState","setValueState","useState","getMomentValue","showCalendar","setShowCalendar","valueFromProps","setValueFromProps","moment","format","inputDimensions","setInputDimensions","calendarOnDialog","setCalendarOnDialog","onDenied","setOnDenied","disabled","readOnly","unvisible","hideContent","inputDateRef","useRef","buttonOpenRef","dropdownContainer","currentDateButtonRef","calendarContainerRef","datePickerContainerRef","onScreenResize","current","getBoundingClientRect","onCloseDateDialog","setTimeout","focus","onCloseWithoutBlur","event","focusOnAnotherField","contains","relatedTarget","onKeyDownPress","key","preventDefault","buttonForNavigateCalendar","getElementsByClassName","buttonDatePicked","firstChild","buttonsForFocus","Array","from","firstElement","lastElement","length","shiftKey","document","activeElement","stopPropagation","keepPositionCalendarByScroll","inputDateDimensions","positionTop","bottom","style","top","String","concat","openCalendar","onInputFocus","e","onFocus","onInputBlur","onBlur","isValidDate","date","initialValid","initial","isValid","finalValid","final","onInputChange","valueInput","target","onChange","obj","setValue","valueParam","onComplete","shouldDisable","getButtonOpen","Button","ref","getCalendar","valueCalendar","calendarColorStyle","Calendar","buttonElement","calendarContainer","getCalendarComponent","jsx","Dialog","Dropdown","el","useEffect","window","addEventListener","removeEventListener","getElementById","component","jsxs","BaseMask","blocksDateTimeFormat","maskedValue","Grid"],"mappings":";;;;;;;;;;;;;AAkBA,MAA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puts/date/index.tsx"],"sourcesContent":["import '../../assets/styles/datepicker.scss';\n\nimport { FocusEvent as ReactFocusEvent, useEffect, useRef, useState } from 'react';\nimport moment, { Moment } from 'moment';\nimport Grid from '../../gridlayout';\nimport Button from '../../buttons';\nimport Calendar from '../../calendar';\nimport { ColorStyles } from '../../@types/ColorStyles';\nimport BaseMask from '../mask/BaseMask';\nimport { CustomInputEvent } from '../base/types';\nimport Dialog from './Dialog';\nimport Dropdown from './Dropdown';\nimport { IDatePickerProps } from './types';\nimport {\n getMomentValue, PT_BR_FORMAT, EN_US_FORMAT, PT_BR_FORMAT_DATETIME,\n EN_US_FORMAT_DATETIME, blocksDateTimeFormat,\n} from './helpers';\n\nconst DatePicker = (props: IDatePickerProps) => {\n const {\n showButtonOpen = true, openOnFocus = true, shouldCloseOnSelect = true, setFocusOnSelect = true,\n showCalendarInDialog = false, required = false, value = '', name = '', inputRef: inputRefProp,\n dialogSize = { width: '384px', height: '384px' }, gridLayout, shouldCloseOnEsc = true,\n isDateTimeField = false,\n } = props;\n\n const maskFormat = !isDateTimeField ? '00/00/0000' : Date;\n const patternFormat = !isDateTimeField ? undefined : 'DD/MM/YYYY HH:mm';\n const brFormatter = !isDateTimeField ? PT_BR_FORMAT : PT_BR_FORMAT_DATETIME;\n const usFormatter = !isDateTimeField ? EN_US_FORMAT : EN_US_FORMAT_DATETIME;\n\n const [valueState, setValueState] =\n useState<Moment | undefined>(value ? getMomentValue(value) : undefined);\n const [showCalendar, setShowCalendar] = useState(false);\n const [valueFromProps, setValueFromProps] = useState(moment(value, patternFormat).format());\n const [inputDimensions, setInputDimensions] = useState<DOMRect>();\n const [calendarOnDialog, setCalendarOnDialog] = useState(false);\n const [onDenied, setOnDenied] = useState({\n disabled: false,\n readOnly: false,\n unvisible: false,\n hideContent: false,\n });\n const inputDateRef = useRef<HTMLInputElement | HTMLTextAreaElement | null>(null);\n const buttonOpenRef = useRef<HTMLButtonElement>(null);\n const dropdownContainer = useRef<HTMLDivElement>(null);\n const currentDateButtonRef = useRef<HTMLButtonElement>(null);\n const calendarContainerRef = useRef<HTMLDivElement | null>(null);\n const datePickerContainerRef = useRef<HTMLDivElement>(null);\n\n const onScreenResize = () => {\n setInputDimensions(inputDateRef?.current?.getBoundingClientRect());\n };\n\n const onCloseDateDialog = () => {\n setShowCalendar(false);\n if (showCalendarInDialog) {\n setTimeout(() => {\n setCalendarOnDialog(false);\n inputDateRef.current?.focus();\n }, 100);\n }\n };\n\n const onCloseWithoutBlur = (event: ReactFocusEvent<HTMLDivElement>) => {\n const focusOnAnotherField = !datePickerContainerRef.current?.contains(event.relatedTarget);\n if (!showCalendarInDialog && showCalendar && focusOnAnotherField) { setShowCalendar(false); }\n };\n\n const onKeyDownPress = (event: KeyboardEvent) => {\n if (shouldCloseOnEsc && showCalendar && event && event.key && event.key === 'Escape') {\n event.preventDefault();\n setShowCalendar(false);\n inputDateRef.current?.focus();\n }\n if (showCalendar && showCalendarInDialog && event && event.key && event.key === 'Tab') {\n const buttonForNavigateCalendar = calendarContainerRef.current?.getElementsByClassName('navbutton') as HTMLCollectionOf<HTMLButtonElement>;\n const datePicked = calendarContainerRef.current?.getElementsByClassName('-selectedday') as HTMLCollectionOf<HTMLButtonElement>;\n const buttonDatePicked = datePicked[0].firstChild as HTMLButtonElement;\n const buttonsForFocus = Array.from([...buttonForNavigateCalendar, buttonDatePicked]);\n const firstElement = buttonsForFocus[0];\n const lastElement = buttonsForFocus[buttonsForFocus.length - 1];\n\n if (event.shiftKey && document.activeElement === firstElement) {\n event.preventDefault();\n lastElement.focus();\n } else if (!event.shiftKey && document.activeElement === lastElement) {\n event.preventDefault();\n firstElement.focus();\n }\n }\n event.stopPropagation();\n };\n\n const keepPositionCalendarByScroll = () => {\n const inputDateDimensions = inputDateRef.current?.getBoundingClientRect();\n const positionTop = inputDateDimensions && inputDateDimensions.bottom;\n if (dropdownContainer && dropdownContainer.current && inputDateDimensions) {\n dropdownContainer.current.style.top = String(positionTop).concat('px');\n }\n };\n\n const openCalendar = () => {\n setShowCalendar(true);\n if (inputDateRef.current) {\n inputDateRef.current.focus();\n setInputDimensions(inputDateRef.current?.getBoundingClientRect());\n }\n if (showCalendarInDialog) {\n setTimeout(() => { currentDateButtonRef.current?.focus(); }, 100);\n }\n };\n\n const onInputFocus = (e: CustomInputEvent) => {\n if (props.onFocus) props.onFocus(e);\n if (openOnFocus && !showCalendar && !calendarOnDialog) { openCalendar(); }\n };\n\n const onInputBlur = (e: CustomInputEvent) => {\n if (props.onBlur) props.onBlur(e);\n };\n\n const isValidDate = (date: Date | string | { initial?: string, final?: string }) => {\n if (typeof date === 'object' && !(date instanceof Date)) {\n const initialValid = moment(date.initial, brFormatter, true).isValid();\n const finalValid = moment(date.final, brFormatter, true).isValid();\n\n return initialValid && finalValid;\n }\n\n return moment(date, brFormatter, true).isValid();\n };\n\n const onInputChange = (\n event: CustomInputEvent,\n valueInput: string | {\n initial: string;\n final: string;\n } = '',\n ) => {\n if (typeof valueInput === 'string') {\n const date = event.target.value ?? '';\n if (props.onChange) {\n if (isValidDate(date)) {\n const newValue = moment(date, brFormatter).format(usFormatter);\n const obj = { target: { value: newValue, name: event.target.name } };\n props.onChange(obj, date);\n } else if (event.target.value === '') {\n const obj = { target: { value: '', name: event.target.name } };\n props.onChange(obj, date);\n setShowCalendar(false);\n setValueState(undefined);\n }\n }\n }\n };\n\n const setValue = (valueParam?: string, e?: CustomInputEvent) => {\n if (showCalendar && setFocusOnSelect) inputDateRef.current?.focus();\n if (props.onComplete) props.onComplete(e, valueParam);\n if (props.onChange) onInputChange({ target: { value: valueParam ?? '', name } }, valueParam);\n if (shouldCloseOnSelect) setShowCalendar(false);\n setValueState(moment(valueParam, brFormatter));\n };\n\n const shouldDisable = () =>\n props.disabled || (onDenied && (onDenied.disabled || onDenied.hideContent));\n\n const getButtonOpen = () => {\n if (!showButtonOpen) return undefined;\n return (\n <Button\n key=\"button-open-date-picker\"\n disabled={shouldDisable()}\n tabIndex={-1}\n customClass=\"calendar-button\"\n iconName='calendar'\n title={showCalendar ? 'Fechar Calendário' : 'Abrir Calendário'}\n onClick={() => { if (showCalendar) { setShowCalendar(false); } else openCalendar(); }}\n targetRef={(ref: HTMLButtonElement) => { buttonOpenRef.current = ref; }} />\n );\n };\n\n const getCalendar = (valueCalendar?: Moment, calendarColorStyle?: ColorStyles) => (\n <Calendar\n colorStyle={calendarColorStyle}\n currentDate={valueCalendar !== undefined ? valueCalendar : moment()}\n onDateChange={(date) => {\n setValue(date.format(brFormatter), undefined);\n if (showCalendarInDialog) setCalendarOnDialog(false);\n }}\n currentDateButton={buttonElement => currentDateButtonRef.current = buttonElement}\n calendarContainer={(calendarContainer) => { \n calendarContainerRef.current = calendarContainer; \n }} />\n );\n\n const getCalendarComponent = () => {\n if (onDenied && onDenied.readOnly) return null;\n if (showCalendarInDialog) {\n return (\n <Dialog\n dialogSize={dialogSize}\n handlerClose={onCloseDateDialog}>\n {getCalendar(valueState, props?.calendarColorStyle)}\n </Dialog>\n );\n }\n\n return (\n <Dropdown\n showButtonOpen={showButtonOpen}\n inputDimensions={inputDimensions}\n containerRef={datePickerContainerRef as any}\n dropdownRef={(el: HTMLDivElement) => { dropdownContainer.current = el; }}>\n {getCalendar(valueState, props?.calendarColorStyle)}\n </Dropdown>\n );\n };\n\n useEffect(() => {\n if (value && moment(value, usFormatter).format() !== 'Invalid date' &&\n moment(valueFromProps, usFormatter).format() !== moment(value, usFormatter).format()) {\n setValueState(moment(value, usFormatter));\n setValueFromProps(value);\n } else if (!value && value !== valueFromProps) {\n setValueState(undefined);\n setValueFromProps(value);\n }\n }, [value]);\n\n useEffect(() => {\n window.addEventListener('resize', onScreenResize);\n document.addEventListener('keydown', onKeyDownPress);\n if (inputDateRef.current) onScreenResize();\n if (showCalendar && showCalendarInDialog) setCalendarOnDialog(true);\n\n return () => {\n window.removeEventListener('resize', onScreenResize);\n document.removeEventListener('keydown', onKeyDownPress);\n };\n }, [inputDateRef.current, showCalendar]);\n\n useEffect(() => {\n document.addEventListener('scroll', keepPositionCalendarByScroll);\n document.getElementById('modal-dialog-content')?.addEventListener('scroll', keepPositionCalendarByScroll);\n\n return () => {\n document.removeEventListener('scroll', keepPositionCalendarByScroll);\n document.getElementById('modal-dialog-content')?.removeEventListener('scroll', keepPositionCalendarByScroll);\n };\n }, []);\n\n if (onDenied && onDenied.unvisible) return null;\n\n const component = () => (\n <div ref={datePickerContainerRef} onBlur={onCloseWithoutBlur} className=\"datepicker-container\">\n <BaseMask\n {...props}\n gridLayout={undefined}\n isDateTimeField={isDateTimeField}\n value={!valueState ? ' ' : valueState.format(brFormatter)}\n mask={maskFormat}\n pattern={patternFormat}\n blocks={!isDateTimeField ? {} : blocksDateTimeFormat}\n onComplete={(e) => { if (e) { setValue(e.target?.maskedValue, e); } }}\n onBlur={onInputBlur}\n onFocus={(e: CustomInputEvent) => { onInputFocus(e); }}\n onChange={(e, date) => { if (date) onInputChange(e, date); }}\n inputRef={inputRefProp}\n rightElements={getButtonOpen()}\n required={required}\n handlerSetOnDenied={() => setOnDenied(onDenied)} />\n {showCalendar && getCalendarComponent()}\n </div>\n );\n\n return (!gridLayout ? component() : <Grid customClass=\"-withinput\" cols={gridLayout}>{component()}</Grid>);\n};\n\nexport default DatePicker;\n"],"names":["DatePicker","props","showButtonOpen","openOnFocus","shouldCloseOnSelect","setFocusOnSelect","showCalendarInDialog","required","value","name","inputRef","inputRefProp","dialogSize","width","height","gridLayout","shouldCloseOnEsc","isDateTimeField","maskFormat","Date","patternFormat","undefined","brFormatter","PT_BR_FORMAT_DATETIME","PT_BR_FORMAT","usFormatter","EN_US_FORMAT_DATETIME","EN_US_FORMAT","valueState","setValueState","useState","getMomentValue","showCalendar","setShowCalendar","valueFromProps","setValueFromProps","moment","format","inputDimensions","setInputDimensions","calendarOnDialog","setCalendarOnDialog","onDenied","setOnDenied","disabled","readOnly","unvisible","hideContent","inputDateRef","useRef","buttonOpenRef","dropdownContainer","currentDateButtonRef","calendarContainerRef","datePickerContainerRef","onScreenResize","current","getBoundingClientRect","onCloseDateDialog","setTimeout","focus","onCloseWithoutBlur","event","focusOnAnotherField","contains","relatedTarget","onKeyDownPress","key","preventDefault","buttonForNavigateCalendar","getElementsByClassName","buttonDatePicked","firstChild","buttonsForFocus","Array","from","firstElement","lastElement","length","shiftKey","document","activeElement","stopPropagation","keepPositionCalendarByScroll","inputDateDimensions","positionTop","bottom","style","top","String","concat","openCalendar","onInputFocus","e","onFocus","onInputBlur","onBlur","isValidDate","date","initialValid","initial","isValid","finalValid","final","onInputChange","valueInput","target","onChange","obj","setValue","valueParam","onComplete","shouldDisable","getButtonOpen","Button","ref","getCalendar","valueCalendar","calendarColorStyle","Calendar","buttonElement","calendarContainer","getCalendarComponent","jsx","Dialog","Dropdown","el","useEffect","window","addEventListener","removeEventListener","getElementById","component","jsxs","BaseMask","blocksDateTimeFormat","maskedValue","Grid"],"mappings":";;;;;;;;;;;;;AAkBA,MAAMA,KAAaA,CAACC,MAA4B;AAC9C,QAAM;AAAA,IACJC,gBAAAA,IAAiB;AAAA,IAAMC,aAAAA,IAAc;AAAA,IAAMC,qBAAAA,IAAsB;AAAA,IAAMC,kBAAAA,IAAmB;AAAA,IAC1FC,sBAAAA,IAAuB;AAAA,IAAOC,UAAAA,IAAW;AAAA,IAAOC,OAAAA,IAAQ;AAAA,IAAIC,MAAAA,IAAO;AAAA,IAAIC,UAAUC;AAAAA,IACjFC,YAAAA,IAAa;AAAA,MAAEC,OAAO;AAAA,MAASC,QAAQ;AAAA,IAAA;AAAA,IAAWC,YAAAA;AAAAA,IAAYC,kBAAAA,IAAmB;AAAA,IACjFC,iBAAAA,IAAkB;AAAA,EAAA,IAChBhB,GAEEiB,IAAcD,IAAiCE,OAAf,cAChCC,IAAiBH,IAA8B,qBAAZI,QACnCC,IAAeL,IAAiCM,KAAfC,IACjCC,IAAeR,IAAiCS,KAAfC,IAEjC,CAACC,GAAYC,CAAa,IAC9BC,EAA6BtB,IAAQuB,GAAevB,CAAK,IAAIa,MAAS,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8B,aAAa3C,CAAC;AAAA,IAAK,GACpE,QAAQE,IACR,SAAS,CAACF,MAAwB;AAAED,MAAAA,GAAaC,CAAC;AAAA,IAAG,GACrD,UAAU,CAACA,GAAGK,MAAS;AAAE,MAAIA,KAAMM,EAAcX,GAAGK,CAAI;AAAA,IAAG,GAC3D,UAAUvF,GACV,eAAesG,GAAAA,GACf,UAAA1G,GACA,oBAAoB,MAAMoC,GAAYD,CAAQ,EAAA,CAAE;AAAA,IACjDV,KAAgB0F,GAAAA;AAAAA,EAAqB,GACxC;AAGF,SAAS3G,IAA2B,gBAAA4G,EAACc,IAAA,EAAK,aAAY,cAAa,MAAM1H,GAAaqH,UAAAA,EAAAA,EAAU,CAAE,IAA5EA;AACxB;"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { Size } from '../../@types/Size';
|
|
3
|
+
import { ColorTheme } from '../../@types/ColorStyles';
|
|
4
|
+
import { ITooltipCommonProps } from '../../tooltip/types';
|
|
5
|
+
import { Position, HintPosition } from '../../@types/Position';
|
|
6
|
+
type InputHTMLProps = Omit<React.ComponentPropsWithoutRef<'input'>, 'size' | 'type'>;
|
|
7
|
+
export interface CheckboxFieldInputBaseProps extends InputHTMLProps, ITooltipCommonProps {
|
|
8
|
+
hint?: string;
|
|
9
|
+
label?: string;
|
|
10
|
+
size?: Exclude<Size, 'mini'>;
|
|
11
|
+
variant?: 'default' | 'secondary';
|
|
12
|
+
errors?: string[];
|
|
13
|
+
customClass?: string;
|
|
14
|
+
customClassLabel?: string;
|
|
15
|
+
customClassWrapper?: string;
|
|
16
|
+
customClassInputContainer?: string;
|
|
17
|
+
rounded?: boolean;
|
|
18
|
+
readOnly?: boolean;
|
|
19
|
+
skeletonize?: boolean;
|
|
20
|
+
labelUppercase?: boolean;
|
|
21
|
+
hintPosition?: HintPosition;
|
|
22
|
+
themePopover?: ColorTheme;
|
|
23
|
+
popoverAlign?: Extract<Position, 'left' | 'right'>;
|
|
24
|
+
tabIndex?: number;
|
|
25
|
+
}
|
|
26
|
+
export declare const InputBase: React.ForwardRefExoticComponent<CheckboxFieldInputBaseProps & React.RefAttributes<HTMLInputElement>>;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { jsx as n, jsxs as T } from "react/jsx-runtime";
|
|
2
|
+
import { c as ue } from "../../_virtual/compiler-runtime.js";
|
|
3
|
+
import '../../assets/styles/checkbox2.css';/* empty css */
|
|
4
|
+
import G from "react";
|
|
5
|
+
import fe from "../../_virtual/lodash.js";
|
|
6
|
+
import be from "../../hint/index.js";
|
|
7
|
+
import ve from "../../icons/index.js";
|
|
8
|
+
import pe from "../../popover/index.js";
|
|
9
|
+
import ke from "../../tooltip/index.js";
|
|
10
|
+
import Ce from "../../popover/PopoverText.js";
|
|
11
|
+
const ge = G.forwardRef((t, N) => {
|
|
12
|
+
const e = ue.c(97);
|
|
13
|
+
let l, r, c, i, d, o, m, w, B, q, F, L, _, j, E, O, S, W, A, H, h, u, f;
|
|
14
|
+
e[0] !== t ? ({
|
|
15
|
+
name: i,
|
|
16
|
+
label: c,
|
|
17
|
+
errors: r,
|
|
18
|
+
onChange: d,
|
|
19
|
+
size: w,
|
|
20
|
+
tooltip: h,
|
|
21
|
+
tooltipPosition: u,
|
|
22
|
+
tooltipWidth: f,
|
|
23
|
+
tabIndex: B,
|
|
24
|
+
variant: _,
|
|
25
|
+
customClass: j,
|
|
26
|
+
customClassLabel: E,
|
|
27
|
+
customClassWrapper: O,
|
|
28
|
+
labelUppercase: S,
|
|
29
|
+
rounded: W,
|
|
30
|
+
customClassInputContainer: A,
|
|
31
|
+
skeletonize: H,
|
|
32
|
+
hintPosition: q,
|
|
33
|
+
themePopover: F,
|
|
34
|
+
popoverAlign: L,
|
|
35
|
+
disabled: l,
|
|
36
|
+
readOnly: o,
|
|
37
|
+
...m
|
|
38
|
+
} = t, e[0] = t, e[1] = l, e[2] = r, e[3] = c, e[4] = i, e[5] = d, e[6] = o, e[7] = m, e[8] = w, e[9] = B, e[10] = q, e[11] = F, e[12] = L, e[13] = _, e[14] = j, e[15] = E, e[16] = O, e[17] = S, e[18] = W, e[19] = A, e[20] = H, e[21] = h, e[22] = u, e[23] = f) : (l = e[1], r = e[2], c = e[3], i = e[4], d = e[5], o = e[6], m = e[7], w = e[8], B = e[9], q = e[10], F = e[11], L = e[12], _ = e[13], j = e[14], E = e[15], O = e[16], S = e[17], W = e[18], A = e[19], H = e[20], h = e[21], u = e[22], f = e[23]);
|
|
39
|
+
const J = w === void 0 ? "default" : w, ce = B === void 0 ? 0 : B, K = _ === void 0 ? "default" : _, de = j === void 0 ? "" : j, Q = E === void 0 ? "" : E, me = O === void 0 ? "" : O, X = S === void 0 ? !1 : S, Y = W === void 0 ? !1 : W, he = A === void 0 ? "" : A, a = H === void 0 ? !1 : H, b = q === void 0 ? "below" : q, Z = F === void 0 ? "light" : F, ee = L === void 0 ? "left" : L, v = t.id || `checkboxfield-${i}`, re = G.useRef(null), te = t.checked ?? !!t.value;
|
|
40
|
+
let U;
|
|
41
|
+
e[24] !== t.label ? (U = fe.isEmpty(t?.label), e[24] = t.label, e[25] = U) : U = e[25];
|
|
42
|
+
const p = !U, k = !!t.hint?.length, s = !!r?.length;
|
|
43
|
+
let M;
|
|
44
|
+
e[26] !== l || e[27] !== d || e[28] !== o ? (M = (ne) => {
|
|
45
|
+
o || l || (Object.defineProperty(ne.target, "value", {
|
|
46
|
+
value: ne.target.checked,
|
|
47
|
+
writable: !0,
|
|
48
|
+
enumerable: !0,
|
|
49
|
+
configurable: !0
|
|
50
|
+
}), d?.(ne));
|
|
51
|
+
}, e[26] = l, e[27] = d, e[28] = o, e[29] = M) : M = e[29];
|
|
52
|
+
const ae = M, le = `checkbox-field-root ${me}`, oe = `container ${he}`, ie = `input ${de}`, se = !o && !ce ? 0 : -1;
|
|
53
|
+
let C;
|
|
54
|
+
e[30] !== l || e[31] !== ae || e[32] !== s || e[33] !== v || e[34] !== te || e[35] !== i || e[36] !== o || e[37] !== N || e[38] !== m || e[39] !== Y || e[40] !== J || e[41] !== a || e[42] !== ie || e[43] !== se || e[44] !== K ? (C = /* @__PURE__ */ n("input", { ref: N, id: v, name: i, readOnly: o, disabled: l, className: ie, tabIndex: se, "data-testid": "test-checkbox-field-input", "data-state-size": J, "data-state-error": s, "data-state-variant": K, "data-state-rounded": Y, "data-state-read-only": o, "data-state-skeletonize": a, ...m, type: "checkbox", checked: te, onChange: ae }), e[30] = l, e[31] = ae, e[32] = s, e[33] = v, e[34] = te, e[35] = i, e[36] = o, e[37] = N, e[38] = m, e[39] = Y, e[40] = J, e[41] = a, e[42] = ie, e[43] = se, e[44] = K, e[45] = C) : C = e[45];
|
|
55
|
+
let V;
|
|
56
|
+
e[46] === Symbol.for("react.memo_cache_sentinel") ? (V = /* @__PURE__ */ n(ve, { customClass: "checkmark", name: "checkmark", colorStyle: "default" }), e[46] = V) : V = e[46];
|
|
57
|
+
let g;
|
|
58
|
+
e[47] !== C ? (g = /* @__PURE__ */ T("div", { className: "input-root", children: [
|
|
59
|
+
C,
|
|
60
|
+
V
|
|
61
|
+
] }), e[47] = C, e[48] = g) : g = e[48];
|
|
62
|
+
let x;
|
|
63
|
+
e[49] !== Q || e[50] !== l || e[51] !== p || e[52] !== v || e[53] !== c || e[54] !== X || e[55] !== t.required || e[56] !== o || e[57] !== a ? (x = p && /* @__PURE__ */ n("label", { className: `label ${Q}`, title: c, htmlFor: v, "aria-readonly": o, "aria-disabled": l, "data-testid": "test-checkbox-field-label", "data-state-skeletonize": a, "data-state-disabled": l, "data-state-read-only": o, "data-state-uppercase": X, "data-state-input-required": t.required, children: c }), e[49] = Q, e[50] = l, e[51] = p, e[52] = v, e[53] = c, e[54] = X, e[55] = t.required, e[56] = o, e[57] = a, e[58] = x) : x = e[58];
|
|
64
|
+
let y;
|
|
65
|
+
e[59] !== k || e[60] !== p || e[61] !== b || e[62] !== ee || e[63] !== t.hint || e[64] !== a || e[65] !== Z ? (y = p && k && b === "onLabelRight" && !a && /* @__PURE__ */ n(pe, { customClass: "label-popover", theme: Z, align: ee, iconColor: "#03bde2", children: /* @__PURE__ */ n(Ce, { text: t?.hint }) }), e[59] = k, e[60] = p, e[61] = b, e[62] = ee, e[63] = t.hint, e[64] = a, e[65] = Z, e[66] = y) : y = e[66];
|
|
66
|
+
let z;
|
|
67
|
+
e[67] !== a || e[68] !== oe || e[69] !== g || e[70] !== x || e[71] !== y ? (z = /* @__PURE__ */ T("div", { "data-state-skeletonize": a, className: oe, children: [
|
|
68
|
+
g,
|
|
69
|
+
x,
|
|
70
|
+
y
|
|
71
|
+
] }), e[67] = a, e[68] = oe, e[69] = g, e[70] = x, e[71] = y, e[72] = z) : z = e[72];
|
|
72
|
+
let I;
|
|
73
|
+
e[73] !== l || e[74] !== k || e[75] !== b || e[76] !== t.hint || e[77] !== a ? (I = b === "below" && /* @__PURE__ */ n(be, { customClass: "hint", description: t.hint, disabled: l, skeletonize: a, visible: k }), e[73] = l, e[74] = k, e[75] = b, e[76] = t.hint, e[77] = a, e[78] = I) : I = e[78];
|
|
74
|
+
let P;
|
|
75
|
+
e[79] !== r || e[80] !== s || e[81] !== i || e[82] !== a ? (P = s && /* @__PURE__ */ n("span", { className: "error", "data-state-skeletonize": a, "aria-describedby": String(i).concat("-errors"), children: r?.map(xe) }), e[79] = r, e[80] = s, e[81] = i, e[82] = a, e[83] = P) : P = e[83];
|
|
76
|
+
let R;
|
|
77
|
+
e[84] !== s || e[85] !== le || e[86] !== z || e[87] !== I || e[88] !== P ? (R = /* @__PURE__ */ T("div", { ref: re, "data-testid": "test-chebox-field-root", className: le, "data-state-error": s, children: [
|
|
78
|
+
z,
|
|
79
|
+
I,
|
|
80
|
+
P
|
|
81
|
+
] }), e[84] = s, e[85] = le, e[86] = z, e[87] = I, e[88] = P, e[89] = R) : R = e[89];
|
|
82
|
+
let $;
|
|
83
|
+
e[90] !== h || e[91] !== u || e[92] !== f ? ($ = /* @__PURE__ */ n(ke, { targetRef: re, text: h, width: f, position: u }), e[90] = h, e[91] = u, e[92] = f, e[93] = $) : $ = e[93];
|
|
84
|
+
let D;
|
|
85
|
+
return e[94] !== R || e[95] !== $ ? (D = /* @__PURE__ */ T(G.Fragment, { children: [
|
|
86
|
+
R,
|
|
87
|
+
$
|
|
88
|
+
] }), e[94] = R, e[95] = $, e[96] = D) : D = e[96], D;
|
|
89
|
+
});
|
|
90
|
+
ge.displayName = "CheckboxFieldInputBase";
|
|
91
|
+
function xe(t, N) {
|
|
92
|
+
return /* @__PURE__ */ T(G.Fragment, { children: [
|
|
93
|
+
t,
|
|
94
|
+
" "
|
|
95
|
+
] }, `${N + 1}-${t}`);
|
|
96
|
+
}
|
|
97
|
+
export {
|
|
98
|
+
ge as InputBase
|
|
99
|
+
};
|
|
100
|
+
//# sourceMappingURL=base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.js","sources":["../../../src/lib/inputs2/checkboxfield/base.tsx"],"sourcesContent":["import '../../assets/styles/checkbox2.scss';\n\nimport React from 'react';\nimport _ from 'lodash';\nimport Hint from '../../hint';\nimport Icon from '../../icons';\nimport Popover, { PopoverText } from '../../popover';\nimport { Tooltip } from '../../tooltip';\nimport type { Size } from '../../@types/Size';\nimport type { ColorTheme } from '../../@types/ColorStyles';\nimport type { ITooltipCommonProps } from '../../tooltip/types';\nimport type { Position, HintPosition } from '../../@types/Position';\n\ntype InputHTMLProps = Omit<React.ComponentPropsWithoutRef<'input'>, 'size' | 'type'>;\nexport interface CheckboxFieldInputBaseProps extends InputHTMLProps, ITooltipCommonProps {\n hint?: string;\n label?: string;\n size?: Exclude<Size, 'mini'>;\n variant?: 'default' | 'secondary';\n errors?: string[];\n customClass?: string;\n customClassLabel?: string;\n customClassWrapper?: string;\n customClassInputContainer?: string;\n rounded?: boolean;\n readOnly?: boolean;\n skeletonize?: boolean\n labelUppercase?: boolean;\n hintPosition?: HintPosition;\n themePopover?: ColorTheme;\n popoverAlign?: Extract<Position, 'left' | 'right'>;\n tabIndex?: number;\n}\n\nexport const InputBase = \n React.forwardRef<HTMLInputElement, CheckboxFieldInputBaseProps>((props, ref) => {\n const {\n name, label, errors, onChange, size = 'default', tooltip, tooltipPosition, tooltipWidth, tabIndex = 0,\n variant = 'default', customClass = '', customClassLabel = '', customClassWrapper = '', labelUppercase = false,\n rounded = false, customClassInputContainer = '', skeletonize = false, hintPosition = 'below',\n themePopover = 'light', popoverAlign = 'left', disabled, readOnly, ...rest\n } = props;\n const inputId = React.useMemo(() => props.id || `checkboxfield-${name}`, [props.id, name]);\n const inputRootRef = React.useRef<HTMLInputElement | null>(null);\n\n const isChecked = props.checked ?? Boolean(props.value);\n const hasLabel = !_.isEmpty(props?.label);\n const hasHintMessages = Boolean(props.hint?.length);\n const hasValidationErrors = Boolean(errors?.length);\n\n const handleOnChange = React.useCallback((event: React.ChangeEvent<HTMLInputElement>) => {\n if (readOnly || disabled) return;\n Object.defineProperty(event.target, 'value', {\n value: event.target.checked,\n writable: true,\n enumerable: true,\n configurable: true,\n });\n onChange?.(event);\n }, [readOnly, disabled, onChange]);\n\n return (\n <React.Fragment>\n <div\n ref={inputRootRef}\n data-testid=\"test-chebox-field-root\"\n className={`checkbox-field-root ${customClassWrapper}`}\n data-state-error={hasValidationErrors}>\n <div\n data-state-skeletonize={skeletonize}\n className={`container ${customClassInputContainer}`}>\n <div className='input-root'>\n <input\n ref={ref}\n id={inputId}\n name={name}\n readOnly={readOnly}\n disabled={disabled}\n className={`input ${customClass}`}\n tabIndex={!readOnly && !tabIndex ? 0 : -1}\n data-testid=\"test-checkbox-field-input\"\n data-state-size={size}\n data-state-error={hasValidationErrors}\n data-state-variant={variant}\n data-state-rounded={rounded}\n data-state-read-only={readOnly}\n data-state-skeletonize={skeletonize}\n {...rest}\n type=\"checkbox\"\n checked={isChecked}\n onChange={handleOnChange} />\n <Icon customClass=\"checkmark\" name=\"checkmark\" colorStyle=\"default\" />\n </div>\n {hasLabel && (\n <label\n className={`label ${customClassLabel}`}\n title={label}\n htmlFor={inputId}\n aria-readonly={readOnly}\n aria-disabled={disabled}\n data-testid=\"test-checkbox-field-label\"\n data-state-skeletonize={skeletonize}\n data-state-disabled={disabled}\n data-state-read-only={readOnly}\n data-state-uppercase={labelUppercase}\n data-state-input-required={props.required}>\n {label}\n </label>\n )}\n {hasLabel && hasHintMessages && hintPosition === 'onLabelRight' && !skeletonize && (\n <Popover\n customClass=\"label-popover\"\n theme={themePopover}\n align={popoverAlign}\n iconColor=\"#03bde2\">\n <PopoverText text={props?.hint} />\n </Popover>\n )}\n </div>\n {hintPosition === 'below' && (\n <Hint\n customClass=\"hint\"\n description={props.hint}\n disabled={disabled}\n skeletonize={skeletonize}\n visible={hasHintMessages} />\n )}\n {hasValidationErrors && (\n <span\n className=\"error\"\n data-state-skeletonize={skeletonize}\n aria-describedby={String(name).concat('-errors')}>\n {errors?.map((error, index) => (\n <React.Fragment key={`${index + 1}-${error}`}>\n {error}\n {' '}\n </React.Fragment>\n ))}\n </span>\n )}\n </div>\n <Tooltip\n targetRef={inputRootRef}\n text={tooltip}\n width={tooltipWidth}\n position={tooltipPosition} />\n </React.Fragment>\n );\n });\n\nInputBase.displayName = 'CheckboxFieldInputBase';\n"],"names":["InputBase","React","forwardRef","props","ref","$","_c","disabled","errors","label","name","onChange","readOnly","rest","t0","t1","t10","t11","t12","t2","t3","t4","t5","t6","t7","t8","t9","tooltip","tooltipPosition","tooltipWidth","size","tabIndex","variant","customClass","customClassLabel","customClassWrapper","labelUppercase","rounded","customClassInputContainer","skeletonize","hintPosition","themePopover","popoverAlign","undefined","inputId","id","inputRootRef","useRef","isChecked","checked","Boolean","value","t13","_","isEmpty","hasLabel","hasHintMessages","hint","length","hasValidationErrors","t14","event","Object","defineProperty","target","writable","enumerable","configurable","handleOnChange","t15","t16","t17","t18","t19","t20","Symbol","for","Icon","t21","jsxs","t22","required","jsx","t23","Popover","PopoverText","t24","t25","Hint","t26","String","concat","map","_temp","t27","t28","Tooltip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AA,SACOjC,SACO,eAAA,0BACD,WAAAuB,IACOV,oBAAAA,GAClB2B,UAAAA;AAAAA,IAAAA;AAAAA,IAmDCC;AAAAA,IAQAE;AAAAA,EAAAA,GAaH,GAAMpF,QAAAsD,GAAAtD,QAAAgE,IAAAhE,QAAAiF,GAAAjF,QAAAkF,GAAAlF,QAAAoF,GAAApF,QAAAyF,KAAAA,IAAAzF,EAAA,EAAA;AAAA,MAAA0F;AAAA,EAAA1F,EAAA,EAAA,MAAAsB,KAAAtB,UAAAuB,KAAAvB,EAAA,EAAA,MAAAwB,KACNkE,IAAA,gBAAAb,EAACc,MACYlD,WAAAA,IACLnB,MAAAA,GACCE,OAAAA,GACGD,UAAAA,EAAAA,CAAe,GAAIvB,QAAAsB,GAAAtB,QAAAuB,GAAAvB,QAAAwB,GAAAxB,QAAA0F,KAAAA,IAAA1F,EAAA,EAAA;AAAA,MAAA4F;AAAA,SAAA5F,EAAA,EAAA,MAAAyF,KAAAzF,UAAA0F,KAnFjCE,oCACEH,UAAAA;AAAAA,IAAAA;AAAAA,IA8EAC;AAAAA,EAAAA,GAKF,GAAiB1F,QAAAyF,GAAAzF,QAAA0F,GAAA1F,QAAA4F,KAAAA,IAAA5F,EAAA,EAAA,GApFjB4F;AAoFiB,CAEpB;AAEHjG,GAAUkG,cAAc;AAnH0C,SAAAL,GAAAM,GAAAC,GAAA;AAAA,SAkGpD,gBAAArB,gBACGoB,UAAAA;AAAAA,IAAAA;AAAAA,IACA;AAAA,EAAA,EAAA,GAFkB,GAAGC,IAAQ,CAAC,IAAID,CAAK,EAG1C;AAAiB;"}
|
|
@@ -1,32 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Size } from '../../@types/Size';
|
|
3
|
-
import { ColorTheme } from '../../@types/ColorStyles';
|
|
4
|
-
import { ITooltipCommonProps } from '../../tooltip/types';
|
|
5
|
-
import { Position, HintPosition } from '../../@types/Position';
|
|
1
|
+
import { default as React } from 'react';
|
|
6
2
|
import { OnDenied, PermissionAttr } from '../../@types/PermissionAttr';
|
|
7
|
-
|
|
8
|
-
interface CheckboxFieldInputProps extends
|
|
9
|
-
hint?: string;
|
|
10
|
-
label?: string;
|
|
11
|
-
size?: Exclude<Size, 'mini'>;
|
|
12
|
-
variant?: 'default' | 'secondary';
|
|
13
|
-
errors?: string[];
|
|
3
|
+
import { CheckboxFieldInputBaseProps } from './base';
|
|
4
|
+
interface CheckboxFieldInputProps extends CheckboxFieldInputBaseProps {
|
|
14
5
|
gridLayout?: string;
|
|
15
|
-
customClass?: string;
|
|
16
|
-
customClassLabel?: string;
|
|
17
|
-
customClassWrapper?: string;
|
|
18
|
-
customClassInputContainer?: string;
|
|
19
|
-
rounded?: boolean;
|
|
20
|
-
readOnly?: boolean;
|
|
21
|
-
skeletonize?: boolean;
|
|
22
|
-
labelUppercase?: boolean;
|
|
23
|
-
hintPosition?: HintPosition;
|
|
24
|
-
themePopover?: ColorTheme;
|
|
25
|
-
popoverAlign?: Extract<Position, 'left' | 'right'>;
|
|
26
6
|
permissionAttr?: PermissionAttr;
|
|
27
7
|
onDeniedActions?: OnDenied;
|
|
28
|
-
tabIndex?: number;
|
|
29
8
|
}
|
|
30
|
-
declare const Input:
|
|
9
|
+
declare const Input: React.ForwardRefExoticComponent<CheckboxFieldInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
31
10
|
export { Input };
|
|
32
11
|
export type { CheckboxFieldInputProps };
|