@thx/controls 17.3.2 → 17.3.5
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/package.json +5 -5
- package/dist/esm/date/DatePicker/styles.css.js +0 -7
- package/dist/esm/date/DatePicker/styles.css.js.map +0 -1
- package/dist/esm/date/LocalDatePicker/LocalDatePicker.js +0 -151
- package/dist/esm/date/LocalDatePicker/LocalDatePicker.js.map +0 -1
- package/dist/esm/date/LocalDatePicker/MaskedDateInput.js +0 -22
- package/dist/esm/date/LocalDatePicker/MaskedDateInput.js.map +0 -1
- package/dist/esm/date/LocalMonthSelect/LocalMonthSelect.js +0 -43
- package/dist/esm/date/LocalMonthSelect/LocalMonthSelect.js.map +0 -1
- package/dist/esm/date/LocalTimePicker/LocalTimePicker.js +0 -96
- package/dist/esm/date/LocalTimePicker/LocalTimePicker.js.map +0 -1
- package/dist/esm/date/LocalTimePicker/MaskedTimeInput.js +0 -22
- package/dist/esm/date/LocalTimePicker/MaskedTimeInput.js.map +0 -1
- package/dist/esm/date/MonthDayPicker/MonthDayPicker.js +0 -86
- package/dist/esm/date/MonthDayPicker/MonthDayPicker.js.map +0 -1
- package/dist/esm/date/MonthYearPicker/MonthYearPicker.js +0 -73
- package/dist/esm/date/MonthYearPicker/MonthYearPicker.js.map +0 -1
- package/dist/esm/date/YearSelect/YearSelect.js +0 -62
- package/dist/esm/date/YearSelect/YearSelect.js.map +0 -1
- package/dist/esm/external/style-inject/dist/style-inject.es.js +0 -29
- package/dist/esm/external/style-inject/dist/style-inject.es.js.map +0 -1
- package/dist/esm/form/TForm/TForm.js +0 -29
- package/dist/esm/form/TForm/TForm.js.map +0 -1
- package/dist/esm/form/TForm/useTForm.js +0 -90
- package/dist/esm/form/TForm/useTForm.js.map +0 -1
- package/dist/esm/index.js +0 -34
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/inputs/CreditCardInput/CreditCardInput.js +0 -71
- package/dist/esm/inputs/CreditCardInput/CreditCardInput.js.map +0 -1
- package/dist/esm/inputs/CreditCardInput/CreditCardNumberInput.js +0 -76
- package/dist/esm/inputs/CreditCardInput/CreditCardNumberInput.js.map +0 -1
- package/dist/esm/inputs/CreditCardInput/styles.css.js +0 -7
- package/dist/esm/inputs/CreditCardInput/styles.css.js.map +0 -1
- package/dist/esm/inputs/MaskedInput/MaskedInput.js +0 -26
- package/dist/esm/inputs/MaskedInput/MaskedInput.js.map +0 -1
- package/dist/esm/inputs/MaskedInput/useMaskedInput.js +0 -57
- package/dist/esm/inputs/MaskedInput/useMaskedInput.js.map +0 -1
- package/dist/esm/inputs/PhoneInput/PhoneInput.js +0 -59
- package/dist/esm/inputs/PhoneInput/PhoneInput.js.map +0 -1
- package/dist/esm/inputs/RadioGroup/RadioGroup.js +0 -25
- package/dist/esm/inputs/RadioGroup/RadioGroup.js.map +0 -1
- package/dist/esm/inputs/SinInput/SinInput.js +0 -54
- package/dist/esm/inputs/SinInput/SinInput.js.map +0 -1
- package/dist/esm/inputs/TableInput/CheckboxEditCell.js +0 -32
- package/dist/esm/inputs/TableInput/CheckboxEditCell.js.map +0 -1
- package/dist/esm/inputs/TableInput/DropdownCell.js +0 -26
- package/dist/esm/inputs/TableInput/DropdownCell.js.map +0 -1
- package/dist/esm/inputs/TableInput/HoverCell.js +0 -20
- package/dist/esm/inputs/TableInput/HoverCell.js.map +0 -1
- package/dist/esm/inputs/TableInput/LocalDateCell.js +0 -13
- package/dist/esm/inputs/TableInput/LocalDateCell.js.map +0 -1
- package/dist/esm/inputs/TableInput/LocalDateEditCell.js +0 -33
- package/dist/esm/inputs/TableInput/LocalDateEditCell.js.map +0 -1
- package/dist/esm/inputs/TableInput/LocalTimeEditCell.js +0 -31
- package/dist/esm/inputs/TableInput/LocalTimeEditCell.js.map +0 -1
- package/dist/esm/inputs/TableInput/MoneyCell.js +0 -13
- package/dist/esm/inputs/TableInput/MoneyCell.js.map +0 -1
- package/dist/esm/inputs/TableInput/MoneyEditCell.js +0 -37
- package/dist/esm/inputs/TableInput/MoneyEditCell.js.map +0 -1
- package/dist/esm/inputs/TableInput/MoneySumFooter.js +0 -20
- package/dist/esm/inputs/TableInput/MoneySumFooter.js.map +0 -1
- package/dist/esm/inputs/TableInput/NumberEditCell.js +0 -35
- package/dist/esm/inputs/TableInput/NumberEditCell.js.map +0 -1
- package/dist/esm/inputs/TableInput/StringEditCell.js +0 -34
- package/dist/esm/inputs/TableInput/StringEditCell.js.map +0 -1
- package/dist/esm/inputs/TableInput/TableInput.js +0 -79
- package/dist/esm/inputs/TableInput/TableInput.js.map +0 -1
- package/dist/esm/inputs/TableInput/addRowOnTab.js +0 -13
- package/dist/esm/inputs/TableInput/addRowOnTab.js.map +0 -1
- package/dist/esm/money/MoneyCurrencyInput/MoneyCurrencyInput.js +0 -51
- package/dist/esm/money/MoneyCurrencyInput/MoneyCurrencyInput.js.map +0 -1
- package/dist/esm/money/MoneyInput/MoneyInput.js +0 -31
- package/dist/esm/money/MoneyInput/MoneyInput.js.map +0 -1
- package/dist/esm/money/useMoneyInput.js +0 -75
- package/dist/esm/money/useMoneyInput.js.map +0 -1
- package/dist/esm/step/FormStep.js +0 -17
- package/dist/esm/step/FormStep.js.map +0 -1
- package/dist/esm/step/Step.js +0 -10
- package/dist/esm/step/Step.js.map +0 -1
- package/dist/esm/step/StepProvider.js +0 -95
- package/dist/esm/step/StepProvider.js.map +0 -1
- package/dist/esm/step/stepContext.js +0 -10
- package/dist/esm/step/stepContext.js.map +0 -1
- package/dist/esm/step/useStep.js +0 -10
- package/dist/esm/step/useStep.js.map +0 -1
- package/dist/stats.html +0 -2689
- package/dist/stats.txt +0 -92
- package/dist/types/date/DatePicker/index.d.ts +0 -3
- package/dist/types/date/LocalDatePicker/LocalDatePicker.d.ts +0 -20
- package/dist/types/date/LocalDatePicker/MaskedDateInput.d.ts +0 -13
- package/dist/types/date/LocalDatePicker/index.d.ts +0 -2
- package/dist/types/date/LocalMonthSelect/LocalMonthSelect.d.ts +0 -11
- package/dist/types/date/LocalMonthSelect/index.d.ts +0 -2
- package/dist/types/date/LocalTimePicker/LocalTimePicker.d.ts +0 -13
- package/dist/types/date/LocalTimePicker/MaskedTimeInput.d.ts +0 -12
- package/dist/types/date/LocalTimePicker/index.d.ts +0 -2
- package/dist/types/date/MonthDayPicker/MonthDayPicker.d.ts +0 -13
- package/dist/types/date/MonthDayPicker/index.d.ts +0 -2
- package/dist/types/date/MonthYearPicker/MonthYearPicker.d.ts +0 -15
- package/dist/types/date/MonthYearPicker/index.d.ts +0 -2
- package/dist/types/date/YearSelect/YearSelect.d.ts +0 -10
- package/dist/types/date/YearSelect/index.d.ts +0 -2
- package/dist/types/form/TForm/TForm.d.ts +0 -3
- package/dist/types/form/TForm/index.d.ts +0 -3
- package/dist/types/form/TForm/types.d.ts +0 -32
- package/dist/types/form/TForm/useTForm.d.ts +0 -57
- package/dist/types/index.d.ts +0 -32
- package/dist/types/inputs/CreditCardInput/CreditCardInput.d.ts +0 -15
- package/dist/types/inputs/CreditCardInput/CreditCardNumberInput.d.ts +0 -7
- package/dist/types/inputs/CreditCardInput/index.d.ts +0 -2
- package/dist/types/inputs/MaskedInput/MaskedInput.d.ts +0 -11
- package/dist/types/inputs/MaskedInput/index.d.ts +0 -3
- package/dist/types/inputs/MaskedInput/useMaskedInput.d.ts +0 -7
- package/dist/types/inputs/PhoneInput/PhoneInput.d.ts +0 -6
- package/dist/types/inputs/PhoneInput/index.d.ts +0 -2
- package/dist/types/inputs/RadioGroup/RadioGroup.d.ts +0 -7
- package/dist/types/inputs/RadioGroup/index.d.ts +0 -2
- package/dist/types/inputs/Scriptel/Scriptel.d.ts +0 -10
- package/dist/types/inputs/Scriptel/ScriptelContext.d.ts +0 -9
- package/dist/types/inputs/Scriptel/index.d.ts +0 -4
- package/dist/types/inputs/Scriptel/scriptel/classes.d.ts +0 -144
- package/dist/types/inputs/Scriptel/scriptel/enums.d.ts +0 -16
- package/dist/types/inputs/Scriptel/scriptel/index.d.ts +0 -17
- package/dist/types/inputs/Scriptel/scriptel/messages.d.ts +0 -52
- package/dist/types/inputs/Scriptel/withScriptel.d.ts +0 -8
- package/dist/types/inputs/ScriptelInput/ScriptelInput.d.ts +0 -7
- package/dist/types/inputs/ScriptelInput/index.d.ts +0 -2
- package/dist/types/inputs/SinInput/SinInput.d.ts +0 -6
- package/dist/types/inputs/SinInput/index.d.ts +0 -2
- package/dist/types/inputs/TableInput/CheckboxEditCell.d.ts +0 -11
- package/dist/types/inputs/TableInput/DropdownCell.d.ts +0 -3
- package/dist/types/inputs/TableInput/HoverCell.d.ts +0 -6
- package/dist/types/inputs/TableInput/LocalDateCell.d.ts +0 -10
- package/dist/types/inputs/TableInput/LocalDateEditCell.d.ts +0 -3
- package/dist/types/inputs/TableInput/LocalTimeEditCell.d.ts +0 -3
- package/dist/types/inputs/TableInput/MoneyCell.d.ts +0 -8
- package/dist/types/inputs/TableInput/MoneyEditCell.d.ts +0 -10
- package/dist/types/inputs/TableInput/MoneySumFooter.d.ts +0 -6
- package/dist/types/inputs/TableInput/NumberEditCell.d.ts +0 -11
- package/dist/types/inputs/TableInput/StringEditCell.d.ts +0 -11
- package/dist/types/inputs/TableInput/TableInput.d.ts +0 -32
- package/dist/types/inputs/TableInput/addRowOnTab.d.ts +0 -10
- package/dist/types/inputs/TableInput/index.d.ts +0 -14
- package/dist/types/money/MoneyCurrencyInput/MoneyCurrencyInput.d.ts +0 -10
- package/dist/types/money/MoneyCurrencyInput/index.d.ts +0 -2
- package/dist/types/money/MoneyInput/MoneyInput.d.ts +0 -14
- package/dist/types/money/MoneyInput/index.d.ts +0 -2
- package/dist/types/money/useMoneyInput.d.ts +0 -13
- package/dist/types/step/FormStep.d.ts +0 -8
- package/dist/types/step/Step.d.ts +0 -8
- package/dist/types/step/StepProvider.d.ts +0 -9
- package/dist/types/step/index.d.ts +0 -4
- package/dist/types/step/stepContext.d.ts +0 -4
- package/dist/types/step/useStep.d.ts +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thx/controls",
|
|
3
|
-
"version": "17.3.
|
|
3
|
+
"version": "17.3.5",
|
|
4
4
|
"description": "A collection of components designed with SemanticUI.",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/thr-consulting/thr-addons/issues"
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"url": "https://github.com/thr-consulting/thr-addons.git"
|
|
11
11
|
},
|
|
12
12
|
"license": "MIT",
|
|
13
|
-
"author": "
|
|
13
|
+
"author": "MYMC <tech@makingyourmilescount.com>",
|
|
14
14
|
"sideEffects": true,
|
|
15
15
|
"type": "module",
|
|
16
16
|
"main": "./dist/esm/index.js",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@js-joda/core": "^5.6.5",
|
|
34
|
-
"@thx/date": "^17.3.
|
|
35
|
-
"@thx/money": "^17.
|
|
34
|
+
"@thx/date": "^17.3.5",
|
|
35
|
+
"@thx/money": "^17.3.5",
|
|
36
36
|
"@types/inputmask": "^5.0.7",
|
|
37
37
|
"@types/react-datepicker": "^6.0.1",
|
|
38
38
|
"credit-card-type": "^9.1.0",
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
"publishConfig": {
|
|
63
63
|
"access": "public"
|
|
64
64
|
},
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "7cf746d316ca1f98c24adf4c51b7167547a125a2"
|
|
66
66
|
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import styleInject from './../../external/style-inject/dist/style-inject.es.js';
|
|
2
|
-
|
|
3
|
-
var css_248z = ".rw-datetimepicker > input {\n\tborder: none !important;\n}\n\n.rw-datetimepicker .rw-calendar-grid.rw-nav-view .rw-btn {\n\tpadding: 0 !important;\n}\n\n.dateTimePickerAutoWidth {\n\twidth: auto;\n\tdisplay: inline-flex;\n}\n\n.dateTimePickerAutoWidth > input {\n\twidth: auto;\n}\n\n.react-datepicker-wrapper {\n\twidth: 100%;\n\tdisplay: inline !important;\n}\n\n.react-datepicker__input-container {\n\tdisplay: inline !important;\n}\n\n.react-datepicker-popper {\n\tz-index: 5 !important;\n}\n";
|
|
4
|
-
styleInject(css_248z);
|
|
5
|
-
|
|
6
|
-
export { css_248z as default };
|
|
7
|
-
//# sourceMappingURL=styles.css.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,wBAAwB,uDAAyD;AACjF;AACA;AACA;AACA;AACA;"}
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
import React, { useState, useRef, useEffect } from 'react';
|
|
2
|
-
import { toDate, toLocalDate } from '@thx/date';
|
|
3
|
-
import debug from 'debug';
|
|
4
|
-
import { Input, Icon } from 'semantic-ui-react';
|
|
5
|
-
import DatePicker from 'react-datepicker';
|
|
6
|
-
import '../DatePicker/styles.css.js';
|
|
7
|
-
import { MaskedDateInput } from './MaskedDateInput.js';
|
|
8
|
-
|
|
9
|
-
debug("thx.controls.date.LocalDatePicker");
|
|
10
|
-
function LocalDatePicker(props) {
|
|
11
|
-
const {
|
|
12
|
-
minDate,
|
|
13
|
-
maxDate,
|
|
14
|
-
value,
|
|
15
|
-
onChange,
|
|
16
|
-
onBlur,
|
|
17
|
-
as,
|
|
18
|
-
action,
|
|
19
|
-
actionPosition,
|
|
20
|
-
className,
|
|
21
|
-
error,
|
|
22
|
-
fluid,
|
|
23
|
-
focus,
|
|
24
|
-
icon = true,
|
|
25
|
-
inverted,
|
|
26
|
-
label,
|
|
27
|
-
labelPosition,
|
|
28
|
-
loading,
|
|
29
|
-
size,
|
|
30
|
-
tabIndex,
|
|
31
|
-
transparent,
|
|
32
|
-
openOnFocus = false,
|
|
33
|
-
startFocused,
|
|
34
|
-
startSelected,
|
|
35
|
-
...rest
|
|
36
|
-
} = props;
|
|
37
|
-
const inputProps = {
|
|
38
|
-
as,
|
|
39
|
-
action,
|
|
40
|
-
actionPosition,
|
|
41
|
-
className: `${className || ""} icon`,
|
|
42
|
-
error,
|
|
43
|
-
focus,
|
|
44
|
-
fluid,
|
|
45
|
-
inverted,
|
|
46
|
-
label,
|
|
47
|
-
labelPosition,
|
|
48
|
-
loading,
|
|
49
|
-
size,
|
|
50
|
-
tabIndex,
|
|
51
|
-
transparent
|
|
52
|
-
};
|
|
53
|
-
const maskedInputProps = {
|
|
54
|
-
as,
|
|
55
|
-
action,
|
|
56
|
-
actionPosition,
|
|
57
|
-
className,
|
|
58
|
-
error,
|
|
59
|
-
focus,
|
|
60
|
-
inverted,
|
|
61
|
-
label,
|
|
62
|
-
labelPosition,
|
|
63
|
-
loading,
|
|
64
|
-
size,
|
|
65
|
-
tabIndex,
|
|
66
|
-
transparent
|
|
67
|
-
};
|
|
68
|
-
const iconProps = {
|
|
69
|
-
className,
|
|
70
|
-
inverted,
|
|
71
|
-
loading,
|
|
72
|
-
size,
|
|
73
|
-
transparent
|
|
74
|
-
};
|
|
75
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
76
|
-
const [selected, setSelected] = useState();
|
|
77
|
-
const ref = useRef(null);
|
|
78
|
-
useEffect(() => {
|
|
79
|
-
setSelected(value ? toDate(value) : null);
|
|
80
|
-
}, [value]);
|
|
81
|
-
useEffect(() => {
|
|
82
|
-
if (startFocused) {
|
|
83
|
-
ref.current?.focus();
|
|
84
|
-
}
|
|
85
|
-
}, [startFocused]);
|
|
86
|
-
useEffect(() => {
|
|
87
|
-
if (startSelected) {
|
|
88
|
-
ref.current?.select();
|
|
89
|
-
}
|
|
90
|
-
}, [startSelected]);
|
|
91
|
-
const handleDateChange = (date) => {
|
|
92
|
-
let allowedDate = toLocalDate(date);
|
|
93
|
-
if (minDate?.isAfter(allowedDate)) {
|
|
94
|
-
allowedDate = minDate;
|
|
95
|
-
}
|
|
96
|
-
if (maxDate?.isBefore(allowedDate)) {
|
|
97
|
-
allowedDate = maxDate;
|
|
98
|
-
}
|
|
99
|
-
onChange && onChange(date ? allowedDate : null);
|
|
100
|
-
setSelected(toDate(allowedDate));
|
|
101
|
-
setIsOpen(false);
|
|
102
|
-
};
|
|
103
|
-
const handleInputChange = (e) => {
|
|
104
|
-
const inputValue = e.target.value;
|
|
105
|
-
const date = inputValue ? toDate(inputValue) : null;
|
|
106
|
-
date && handleDateChange(date);
|
|
107
|
-
};
|
|
108
|
-
const handleDatePickerBlur = (e) => {
|
|
109
|
-
setIsOpen(false);
|
|
110
|
-
onBlur && onBlur(e);
|
|
111
|
-
handleInputChange(e);
|
|
112
|
-
};
|
|
113
|
-
const toggleDatePicker = () => {
|
|
114
|
-
setIsOpen(!isOpen);
|
|
115
|
-
};
|
|
116
|
-
const handleOnKeyDown = (e) => {
|
|
117
|
-
e?.key === "Enter" && toggleDatePicker();
|
|
118
|
-
e?.key === "Escape" && setIsOpen(false);
|
|
119
|
-
};
|
|
120
|
-
return /* @__PURE__ */ React.createElement(DatePicker, {
|
|
121
|
-
...rest,
|
|
122
|
-
selected,
|
|
123
|
-
onChange: handleDateChange,
|
|
124
|
-
customInput: /* @__PURE__ */ React.createElement(Input, {
|
|
125
|
-
...inputProps
|
|
126
|
-
}, /* @__PURE__ */ React.createElement(MaskedDateInput, {
|
|
127
|
-
...maskedInputProps,
|
|
128
|
-
onBlur: handleDatePickerBlur,
|
|
129
|
-
value: selected,
|
|
130
|
-
onClick: ({ target }) => openOnFocus ? setIsOpen(!isOpen) : target.select(),
|
|
131
|
-
onKeyDown: handleOnKeyDown,
|
|
132
|
-
ref
|
|
133
|
-
}), icon && /* @__PURE__ */ React.createElement(Icon, {
|
|
134
|
-
...iconProps,
|
|
135
|
-
onClick: toggleDatePicker,
|
|
136
|
-
tabIndex: -1,
|
|
137
|
-
name: "calendar alternate",
|
|
138
|
-
link: true
|
|
139
|
-
})),
|
|
140
|
-
minDate: minDate ? toDate(minDate) : null,
|
|
141
|
-
maxDate: maxDate ? toDate(maxDate) : null,
|
|
142
|
-
open: isOpen,
|
|
143
|
-
enableTabLoop: openOnFocus,
|
|
144
|
-
preventOpenOnFocus: openOnFocus,
|
|
145
|
-
onBlur: handleDatePickerBlur,
|
|
146
|
-
onClickOutside: () => setIsOpen(false)
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
export { LocalDatePicker };
|
|
151
|
-
//# sourceMappingURL=LocalDatePicker.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LocalDatePicker.js","sources":["../../../../src/date/LocalDatePicker/LocalDatePicker.tsx"],"sourcesContent":["import type {LocalDate} from '@js-joda/core';\nimport {toDate, toLocalDate} from '@thx/date';\nimport debug from 'debug';\nimport {useEffect, useRef, useState} from 'react';\nimport type {ReactDatePickerProps} from 'react-datepicker';\nimport {Icon, Input, type InputProps} from 'semantic-ui-react';\nimport {DatePicker} from '../DatePicker/index';\nimport '../DatePicker/styles.css';\nimport {MaskedDateInput, type MaskedDateInputRef} from './MaskedDateInput';\n\nconst d = debug('thx.controls.date.LocalDatePicker');\n\ninterface ILocalDatePicker {\n\tvalue?: LocalDate | number | null;\n\tonChange?: (value: LocalDate | null) => void;\n\tonChangeRaw?: () => void;\n\tminDate?: LocalDate;\n\tmaxDate?: LocalDate;\n\ticon?: boolean;\n\topenOnFocus?: boolean;\n\tstartFocused?: boolean;\n\tstartSelected?: boolean;\n}\n\ntype InputPropsOmitted = Omit<InputProps, 'onChange'>;\ntype ReactDatePickerPropsOmitted = Omit<Omit<ReactDatePickerProps, 'value'>, 'onChange' | 'minDate' | 'maxDate' | 'icon'>;\nexport type LocalDatePickerProps = ILocalDatePicker & InputPropsOmitted & ReactDatePickerPropsOmitted;\n\nexport function LocalDatePicker(props: LocalDatePickerProps): JSX.Element {\n\tconst {\n\t\tminDate,\n\t\tmaxDate,\n\t\tvalue,\n\t\tonChange,\n\t\tonBlur,\n\t\tas,\n\t\taction,\n\t\tactionPosition,\n\t\tclassName,\n\t\terror,\n\t\tfluid,\n\t\tfocus,\n\t\ticon = true,\n\t\tinverted,\n\t\tlabel,\n\t\tlabelPosition,\n\t\tloading,\n\t\tsize,\n\t\ttabIndex,\n\t\ttransparent,\n\t\topenOnFocus = false,\n\t\tstartFocused,\n\t\tstartSelected,\n\t\t...rest\n\t} = props;\n\n\tconst inputProps = {\n\t\tas,\n\t\taction,\n\t\tactionPosition,\n\t\tclassName: `${className || ''} icon`,\n\t\terror,\n\t\tfocus,\n\t\tfluid,\n\t\tinverted,\n\t\tlabel,\n\t\tlabelPosition,\n\t\tloading,\n\t\tsize,\n\t\ttabIndex,\n\t\ttransparent,\n\t};\n\n\tconst maskedInputProps = {\n\t\tas,\n\t\taction,\n\t\tactionPosition,\n\t\tclassName,\n\t\terror,\n\t\tfocus,\n\t\tinverted,\n\t\tlabel,\n\t\tlabelPosition,\n\t\tloading,\n\t\tsize,\n\t\ttabIndex,\n\t\ttransparent,\n\t};\n\n\tconst iconProps = {\n\t\tclassName,\n\t\tinverted,\n\t\tloading,\n\t\tsize,\n\t\ttransparent,\n\t};\n\n\tconst [isOpen, setIsOpen] = useState(false);\n\tconst [selected, setSelected] = useState<Date | null>();\n\tconst ref = useRef<MaskedDateInputRef>(null);\n\n\tuseEffect(() => {\n\t\tsetSelected(value ? toDate(value) : null);\n\t}, [value]);\n\n\tuseEffect(() => {\n\t\tif (startFocused) {\n\t\t\tref.current?.focus();\n\t\t}\n\t}, [startFocused]);\n\n\tuseEffect(() => {\n\t\tif (startSelected) {\n\t\t\tref.current?.select();\n\t\t}\n\t}, [startSelected]);\n\n\tconst handleDateChange = (date: Date) => {\n\t\tlet allowedDate = toLocalDate(date);\n\n\t\tif (minDate?.isAfter(allowedDate)) {\n\t\t\tallowedDate = minDate;\n\t\t}\n\t\tif (maxDate?.isBefore(allowedDate)) {\n\t\t\tallowedDate = maxDate;\n\t\t}\n\t\tonChange && onChange(date ? allowedDate : null);\n\t\tsetSelected(toDate(allowedDate));\n\t\tsetIsOpen(false);\n\t};\n\n\tconst handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n\t\tconst inputValue = e.target.value;\n\t\tconst date = inputValue ? toDate(inputValue) : null;\n\n\t\tdate && handleDateChange(date);\n\t};\n\n\tconst handleDatePickerBlur = (e: React.FocusEvent<HTMLInputElement>) => {\n\t\tsetIsOpen(false);\n\t\tonBlur && onBlur(e);\n\t\thandleInputChange(e);\n\t};\n\n\tconst toggleDatePicker = () => {\n\t\tsetIsOpen(!isOpen);\n\t};\n\n\tconst handleOnKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {\n\t\t// toggle on enter\n\t\te?.key === 'Enter' && toggleDatePicker();\n\t\t// hide on escape\n\t\te?.key === 'Escape' && setIsOpen(false);\n\t};\n\n\treturn (\n\t\t<DatePicker\n\t\t\t{...rest}\n\t\t\tselected={selected}\n\t\t\tonChange={handleDateChange}\n\t\t\tcustomInput={\n\t\t\t\t<Input {...inputProps}>\n\t\t\t\t\t<MaskedDateInput\n\t\t\t\t\t\t{...maskedInputProps}\n\t\t\t\t\t\tonBlur={handleDatePickerBlur}\n\t\t\t\t\t\tvalue={selected}\n\t\t\t\t\t\tonClick={({target}: {target: HTMLInputElement}) => (openOnFocus ? setIsOpen(!isOpen) : target.select())}\n\t\t\t\t\t\tonKeyDown={handleOnKeyDown}\n\t\t\t\t\t\tref={ref}\n\t\t\t\t\t/>\n\t\t\t\t\t{icon && <Icon {...iconProps} onClick={toggleDatePicker} tabIndex={-1} name=\"calendar alternate\" link />}\n\t\t\t\t</Input>\n\t\t\t}\n\t\t\tminDate={minDate ? toDate(minDate) : null}\n\t\t\tmaxDate={maxDate ? toDate(maxDate) : null}\n\t\t\topen={isOpen}\n\t\t\tenableTabLoop={openOnFocus}\n\t\t\tpreventOpenOnFocus={openOnFocus}\n\t\t\tonBlur={handleDatePickerBlur}\n\t\t\tonClickOutside={() => setIsOpen(false)}\n\t\t/>\n\t);\n}\n"],"names":[],"mappings":";;;;;;;;AAUU,MAAM,mCAAmC,EAAA;AAkB5C,SA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,GAAA,MAAA,CAAO,MAAO,EAAA;AAAA,MACrG,SAAW,EAAA,eAAA;AAAA,MACX,GAAA;AAAA,KACD,CAAA,EACC,wBAAS,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA;AAAA,MAAS,GAAA,SAAA;AAAA,MAAW,OAAS,EAAA,gBAAA;AAAA,MAAkB,QAAU,EAAA,CAAA,CAAA;AAAA,MAAI,IAAK,EAAA,oBAAA;AAAA,MAAqB,IAAI,EAAA,IAAA;AAAA,KAAC,CACvG,CAAA;AAAA,IAED,OAAS,EAAA,OAAA,GAAU,MAAO,CAAA,OAAO,CAAI,GAAA,IAAA;AAAA,IACrC,OAAS,EAAA,OAAA,GAAU,MAAO,CAAA,OAAO,CAAI,GAAA,IAAA;AAAA,IACrC,IAAM,EAAA,MAAA;AAAA,IACN,aAAe,EAAA,WAAA;AAAA,IACf,kBAAoB,EAAA,WAAA;AAAA,IACpB,MAAQ,EAAA,oBAAA;AAAA,IACR,cAAA,EAAgB,MAAM,SAAA,CAAU,KAAK,CAAA;AAAA,GACtC,CAAA,CAAA;AAEF;;;;"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef } from 'react';
|
|
2
|
-
import debug from 'debug';
|
|
3
|
-
import { MaskedInput } from '../../inputs/MaskedInput/MaskedInput.js';
|
|
4
|
-
import '../../inputs/MaskedInput/useMaskedInput.js';
|
|
5
|
-
|
|
6
|
-
debug("thx.controls.date.LocalDatePicker.MaskedDateInput");
|
|
7
|
-
const MaskedDateInput = forwardRef((props, ref) => {
|
|
8
|
-
const { onChange, name, ...rest } = props;
|
|
9
|
-
return /* @__PURE__ */ React.createElement(MaskedInput, {
|
|
10
|
-
...rest,
|
|
11
|
-
ref,
|
|
12
|
-
name,
|
|
13
|
-
mask: { alias: "datetime", inputFormat: "mm/dd/yyyy" },
|
|
14
|
-
onChange: (value) => {
|
|
15
|
-
if (onChange)
|
|
16
|
-
onChange({ target: { value: value || "" } });
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
export { MaskedDateInput };
|
|
22
|
-
//# sourceMappingURL=MaskedDateInput.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MaskedDateInput.js","sources":["../../../../src/date/LocalDatePicker/MaskedDateInput.tsx"],"sourcesContent":["import debug from 'debug';\nimport {forwardRef} from 'react';\nimport {MaskedInput, type MaskedInputProps} from '../../inputs/MaskedInput';\nimport type {MaskedInputRef} from '../../inputs/MaskedInput/MaskedInput';\n\nconst d = debug('thx.controls.date.LocalDatePicker.MaskedDateInput');\n\nexport type MaskedDateInputRef = MaskedInputRef;\n\nexport interface MaskedDateInputValue {\n\ttarget: {\n\t\tvalue: string;\n\t};\n}\n\nexport interface MaskedDateInputProps {\n\tname?: string;\n\tonChange?: (value: MaskedDateInputValue) => void;\n}\n\nexport const MaskedDateInput = forwardRef<MaskedDateInputRef, MaskedDateInputProps & Omit<MaskedInputProps, 'onChange'>>((props, ref) => {\n\tconst {onChange, name, ...rest} = props;\n\n\treturn (\n\t\t<MaskedInput\n\t\t\t{...rest}\n\t\t\tref={ref}\n\t\t\tname={name}\n\t\t\tmask={{alias: 'datetime', inputFormat: 'mm/dd/yyyy'}}\n\t\t\tonChange={(value: string) => {\n\t\t\t\tif (onChange) onChange({target: {value: value || ''}});\n\t\t\t}}\n\t\t/>\n\t);\n});\n"],"names":[],"mappings":";;;;;AAKU,MAAM,mDAAmD,EAAA;AAe5D,MAAM,eAAkB,GAAA,UAAA,CAA0F,CAAC,KAAA,EAAO,GAAQ,KAAA;AACxI,EAAM,MAAA,EAAC,QAAU,EAAA,IAAA,EAAA,GAAS,IAAQ,EAAA,GAAA,KAAA,CAAA;AAElC,EAAA,uBACE,KAAA,CAAA,aAAA,CAAA,WAAA,EAAA;AAAA,IACI,GAAA,IAAA;AAAA,IACJ,GAAA;AAAA,IACA,IAAA;AAAA,IACA,IAAM,EAAA,EAAC,KAAO,EAAA,UAAA,EAAY,aAAa,YAAY,EAAA;AAAA,IACnD,QAAA,EAAU,CAAC,KAAkB,KAAA;AAC5B,MAAI,IAAA,QAAA;AAAU,QAAA,QAAA,CAAS,EAAC,MAAQ,EAAA,EAAC,OAAO,KAAS,IAAA,EAAA,IAAI,CAAA,CAAA;AAAA,KACtD;AAAA,GACD,CAAA,CAAA;AAEF,CAAC;;;;"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { LocalDate } from '@js-joda/core';
|
|
3
|
-
import debug from 'debug';
|
|
4
|
-
import { Select } from 'semantic-ui-react';
|
|
5
|
-
|
|
6
|
-
debug("thx.controls.date.LocalMonthSelect");
|
|
7
|
-
const monthOptions = [
|
|
8
|
-
{ text: "January", value: 1, key: 1 },
|
|
9
|
-
{ text: "February", value: 2, key: 2 },
|
|
10
|
-
{ text: "March", value: 3, key: 3 },
|
|
11
|
-
{ text: "April", value: 4, key: 4 },
|
|
12
|
-
{ text: "May", value: 5, key: 5 },
|
|
13
|
-
{ text: "June", value: 6, key: 6 },
|
|
14
|
-
{ text: "July", value: 7, key: 7 },
|
|
15
|
-
{ text: "August", value: 8, key: 8 },
|
|
16
|
-
{ text: "September", value: 9, key: 9 },
|
|
17
|
-
{ text: "October", value: 10, key: 10 },
|
|
18
|
-
{ text: "November", value: 11, key: 11 },
|
|
19
|
-
{ text: "December", value: 12, key: 12 }
|
|
20
|
-
];
|
|
21
|
-
function LocalMonthSelect(props) {
|
|
22
|
-
const { value, onChange, year, handleBlur, ...rest } = props;
|
|
23
|
-
const theYear = year || LocalDate.now().year();
|
|
24
|
-
return /* @__PURE__ */ React.createElement(Select, {
|
|
25
|
-
placeholder: "Select Month",
|
|
26
|
-
options: monthOptions,
|
|
27
|
-
value: value ? value.monthValue() : "",
|
|
28
|
-
onChange: (ev, v) => {
|
|
29
|
-
if (onChange) {
|
|
30
|
-
if (typeof v.value === "number") {
|
|
31
|
-
onChange(v ? LocalDate.of(theYear, v.value, 1) : null);
|
|
32
|
-
} else {
|
|
33
|
-
onChange(null);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
onBlur: handleBlur,
|
|
38
|
-
...rest
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export { LocalMonthSelect };
|
|
43
|
-
//# sourceMappingURL=LocalMonthSelect.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LocalMonthSelect.js","sources":["../../../../src/date/LocalMonthSelect/LocalMonthSelect.tsx"],"sourcesContent":["import {LocalDate} from '@js-joda/core';\nimport debug from 'debug';\nimport {Select, type SelectProps} from 'semantic-ui-react';\n\nconst d = debug('thx.controls.date.LocalMonthSelect');\n\nconst monthOptions = [\n\t{text: 'January', value: 1, key: 1},\n\t{text: 'February', value: 2, key: 2},\n\t{text: 'March', value: 3, key: 3},\n\t{text: 'April', value: 4, key: 4},\n\t{text: 'May', value: 5, key: 5},\n\t{text: 'June', value: 6, key: 6},\n\t{text: 'July', value: 7, key: 7},\n\t{text: 'August', value: 8, key: 8},\n\t{text: 'September', value: 9, key: 9},\n\t{text: 'October', value: 10, key: 10},\n\t{text: 'November', value: 11, key: 11},\n\t{text: 'December', value: 12, key: 12},\n];\n\ninterface ILocalMonthSelectProps {\n\tonChange?: (value: LocalDate | null) => void;\n\tvalue?: LocalDate | null;\n\tyear?: number;\n\thandleBlur?: (event: any) => void;\n}\n\nexport type LocalMonthSelectProps = ILocalMonthSelectProps & Omit<SelectProps, 'options'>;\n\nexport function LocalMonthSelect(props: LocalMonthSelectProps): JSX.Element {\n\tconst {value, onChange, year, handleBlur, ...rest} = props;\n\n\tconst theYear = year || LocalDate.now().year();\n\n\treturn (\n\t\t<Select\n\t\t\tplaceholder=\"Select Month\"\n\t\t\toptions={monthOptions}\n\t\t\tvalue={value ? value.monthValue() : ''}\n\t\t\tonChange={(ev, v) => {\n\t\t\t\tif (onChange) {\n\t\t\t\t\tif (typeof v.value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AAA,UAAA,EAAY,KAAO,EAAA,EAAA,EAAI,KAAK,EAAE,EAAA;AACtC,CAAA,CAAA;AAWO,SAAA,gBAAA,CAA0B,KAA2C,EAAA;AAC3E,EAAA,MAAM,EAAC,KAAA,EAAO,QAAU,EAAA,IAAA,EAAM,eAAe,IAAQ,EAAA,GAAA,KAAA,CAAA;AAErD,EAAA,MAAM,OAAU,GAAA,IAAA,IAAQ,SAAU,CAAA,GAAA,GAAM,IAAK,EAAA,CAAA;AAE7C,EAAA,uBACE,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA;AAAA,IACA,WAAY,EAAA,cAAA;AAAA,IACZ,OAAS,EAAA,YAAA;AAAA,IACT,KAAO,EAAA,KAAA,GAAQ,KAAM,CAAA,UAAA,EAAe,GAAA,EAAA;AAAA,IACpC,QAAA,EAAU,CAAC,EAAA,EAAI,CAAM,KAAA;AACpB,MAAA,IAAI,QAAU,EAAA;AACb,QAAI,IAAA,OAAO,CAAE,CAAA,KAAA,KAAU,QAAU,EAAA;AAChC,UAAS,QAAA,CAAA,CAAA,GAAI,UAAU,EAAG,CAAA,OAAA,EAAS,EAAE,KAAO,EAAA,CAAC,IAAI,IAAI,CAAA,CAAA;AAAA,SAC/C,MAAA;AACN,UAAA,QAAA,CAAS,IAAI,CAAA,CAAA;AAAA,SACd;AAAA,OACD;AAAA,KACD;AAAA,IACA,MAAQ,EAAA,UAAA;AAAA,IACJ,GAAA,IAAA;AAAA,GACL,CAAA,CAAA;AAEF;;;;"}
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { LocalTime } from '@js-joda/core';
|
|
3
|
-
import { toDate, toLocalTime } from '@thx/date';
|
|
4
|
-
import debug from 'debug';
|
|
5
|
-
import { Input } from 'semantic-ui-react';
|
|
6
|
-
import DatePicker from 'react-datepicker';
|
|
7
|
-
import '../DatePicker/styles.css.js';
|
|
8
|
-
import { MaskedTimeInput } from './MaskedTimeInput.js';
|
|
9
|
-
|
|
10
|
-
debug("thx.controls.date.LocalTimePicker");
|
|
11
|
-
function LocalTimePicker(props) {
|
|
12
|
-
const {
|
|
13
|
-
value,
|
|
14
|
-
onChange,
|
|
15
|
-
onBlur,
|
|
16
|
-
as,
|
|
17
|
-
action,
|
|
18
|
-
actionPosition,
|
|
19
|
-
className,
|
|
20
|
-
error,
|
|
21
|
-
fluid,
|
|
22
|
-
focus,
|
|
23
|
-
inverted,
|
|
24
|
-
label,
|
|
25
|
-
labelPosition,
|
|
26
|
-
loading,
|
|
27
|
-
size,
|
|
28
|
-
tabIndex,
|
|
29
|
-
transparent,
|
|
30
|
-
startFocused,
|
|
31
|
-
startSelected,
|
|
32
|
-
...rest
|
|
33
|
-
} = props;
|
|
34
|
-
const inputProps = {
|
|
35
|
-
as,
|
|
36
|
-
action,
|
|
37
|
-
actionPosition,
|
|
38
|
-
className: `${className || ""} icon`,
|
|
39
|
-
error,
|
|
40
|
-
focus,
|
|
41
|
-
fluid,
|
|
42
|
-
inverted,
|
|
43
|
-
label,
|
|
44
|
-
labelPosition,
|
|
45
|
-
loading,
|
|
46
|
-
size,
|
|
47
|
-
tabIndex,
|
|
48
|
-
transparent
|
|
49
|
-
};
|
|
50
|
-
const maskedInputProps = {
|
|
51
|
-
as,
|
|
52
|
-
action,
|
|
53
|
-
actionPosition,
|
|
54
|
-
className,
|
|
55
|
-
error,
|
|
56
|
-
focus,
|
|
57
|
-
inverted,
|
|
58
|
-
label,
|
|
59
|
-
labelPosition,
|
|
60
|
-
loading,
|
|
61
|
-
size,
|
|
62
|
-
tabIndex,
|
|
63
|
-
transparent
|
|
64
|
-
};
|
|
65
|
-
let selected;
|
|
66
|
-
if (typeof value === "number")
|
|
67
|
-
selected = toDate(LocalTime.ofSecondOfDay(value));
|
|
68
|
-
else
|
|
69
|
-
selected = value ? toDate(value) : null;
|
|
70
|
-
const handleDatePickerBlur = (e) => {
|
|
71
|
-
onBlur && onBlur(e);
|
|
72
|
-
};
|
|
73
|
-
return /* @__PURE__ */ React.createElement(DatePicker, {
|
|
74
|
-
...rest,
|
|
75
|
-
selected,
|
|
76
|
-
onChange: (date) => {
|
|
77
|
-
if (onChange)
|
|
78
|
-
onChange(date ? toLocalTime(date) : null);
|
|
79
|
-
},
|
|
80
|
-
showTimeSelect: true,
|
|
81
|
-
showTimeSelectOnly: true,
|
|
82
|
-
timeIntervals: 15,
|
|
83
|
-
timeCaption: "Time",
|
|
84
|
-
dateFormat: "hh:mm aa",
|
|
85
|
-
customInput: /* @__PURE__ */ React.createElement(Input, {
|
|
86
|
-
...inputProps
|
|
87
|
-
}, /* @__PURE__ */ React.createElement(MaskedTimeInput, {
|
|
88
|
-
...maskedInputProps,
|
|
89
|
-
onBlur: handleDatePickerBlur
|
|
90
|
-
})),
|
|
91
|
-
onBlur: handleDatePickerBlur
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
export { LocalTimePicker };
|
|
96
|
-
//# sourceMappingURL=LocalTimePicker.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LocalTimePicker.js","sources":["../../../../src/date/LocalTimePicker/LocalTimePicker.tsx"],"sourcesContent":["import {LocalTime} from '@js-joda/core';\nimport {toDate, toLocalTime} from '@thx/date';\nimport debug from 'debug';\nimport type {ReactDatePickerProps} from 'react-datepicker';\nimport {Input, type InputProps} from 'semantic-ui-react';\nimport {DatePicker} from '../DatePicker/index';\nimport {MaskedTimeInput} from './MaskedTimeInput';\n\nconst d = debug('thx.controls.date.LocalTimePicker');\n\ninterface ILocalTimePicker {\n\tvalue?: LocalTime | number | null;\n\tonChange?: (value: LocalTime | null) => void;\n\tonChangeRaw?: () => void;\n}\n\ntype InputPropsOmitted = Omit<InputProps, 'onChange'>;\ntype ReactDatePickerPropsOmitted = Omit<Omit<ReactDatePickerProps, 'value'>, 'onChange'>;\nexport type LocalTimePickerProps = ILocalTimePicker & InputPropsOmitted & ReactDatePickerPropsOmitted;\n\nexport function LocalTimePicker(props: LocalTimePickerProps): JSX.Element {\n\tconst {\n\t\tvalue,\n\t\tonChange,\n\t\tonBlur,\n\t\tas,\n\t\taction,\n\t\tactionPosition,\n\t\tclassName,\n\t\terror,\n\t\tfluid,\n\t\tfocus,\n\t\tinverted,\n\t\tlabel,\n\t\tlabelPosition,\n\t\tloading,\n\t\tsize,\n\t\ttabIndex,\n\t\ttransparent,\n\t\tstartFocused,\n\t\tstartSelected,\n\t\t...rest\n\t} = props;\n\n\tconst inputProps = {\n\t\tas,\n\t\taction,\n\t\tactionPosition,\n\t\tclassName: `${className || ''} icon`,\n\t\terror,\n\t\tfocus,\n\t\tfluid,\n\t\tinverted,\n\t\tlabel,\n\t\tlabelPosition,\n\t\tloading,\n\t\tsize,\n\t\ttabIndex,\n\t\ttransparent,\n\t};\n\n\tconst maskedInputProps = {\n\t\tas,\n\t\taction,\n\t\tactionPosition,\n\t\tclassName,\n\t\terror,\n\t\tfocus,\n\t\tinverted,\n\t\tlabel,\n\t\tlabelPosition,\n\t\tloading,\n\t\tsize,\n\t\ttabIndex,\n\t\ttransparent,\n\t};\n\n\tlet selected;\n\tif (typeof value === 'number') selected = toDate(LocalTime.ofSecondOfDay(value));\n\telse selected = value ? toDate(value) : null;\n\n\tconst handleDatePickerBlur = (e: React.FocusEvent<HTMLInputElement>) => {\n\t\tonBlur && onBlur(e);\n\t};\n\n\treturn (\n\t\t<DatePicker\n\t\t\t{...rest}\n\t\t\tselected={selected}\n\t\t\tonChange={date => {\n\t\t\t\tif (onChange) onChange(date ? toLocalTime(date) : null);\n\t\t\t}}\n\t\t\tshowTimeSelect\n\t\t\tshowTimeSelectOnly\n\t\t\ttimeIntervals={15}\n\t\t\ttimeCaption=\"Time\"\n\t\t\tdateFormat=\"hh:mm aa\"\n\t\t\tcustomInput={\n\t\t\t\t<Input {...inputProps}>\n\t\t\t\t\t<MaskedTimeInput {...maskedInputProps} onBlur={handleDatePickerBlur} />\n\t\t\t\t</Input>\n\t\t\t}\n\t\t\tonBlur={handleDat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AAU,aAAc,CAAA,KAAK,CAAC,CAAA,CAAA;AAAA;AAC1E,IAAW,QAAA,GAAA,KAAA,GAAQ,MAAO,CAAA,KAAK,CAAI,GAAA,IAAA,CAAA;AAExC,EAAM,MAAA,oBAAA,GAAuB,CAAC,CAA0C,KAAA;AACvE,IAAA,MAAA,IAAU,OAAO,CAAC,CAAA,CAAA;AAAA,GACnB,CAAA;AAEA,EAAA,uBACE,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA;AAAA,IACI,GAAA,IAAA;AAAA,IACJ,QAAA;AAAA,IACA,UAAU,CAAQ,IAAA,KAAA;AACjB,MAAI,IAAA,QAAA;AAAU,QAAA,QAAA,CAAS,IAAO,GAAA,WAAA,CAAY,IAAI,CAAA,GAAI,IAAI,CAAA,CAAA;AAAA,KACvD;AAAA,IACA,cAAc,EAAA,IAAA;AAAA,IACd,kBAAkB,EAAA,IAAA;AAAA,IAClB,aAAe,EAAA,EAAA;AAAA,IACf,WAAY,EAAA,MAAA;AAAA,IACZ,UAAW,EAAA,UAAA;AAAA,IACX,6BACE,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA;AAAA,MAAU,GAAA,UAAA;AAAA,KAAA,kBACT,KAAA,CAAA,aAAA,CAAA,eAAA,EAAA;AAAA,MAAoB,GAAA,gBAAA;AAAA,MAAkB,MAAQ,EAAA,oBAAA;AAAA,KAAsB,CACtE,CAAA;AAAA,IAED,MAAQ,EAAA,oBAAA;AAAA,GACT,CAAA,CAAA;AAEF;;;;"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef } from 'react';
|
|
2
|
-
import debug from 'debug';
|
|
3
|
-
import { MaskedInput } from '../../inputs/MaskedInput/MaskedInput.js';
|
|
4
|
-
import '../../inputs/MaskedInput/useMaskedInput.js';
|
|
5
|
-
|
|
6
|
-
debug("thx.controls.date.LocalTimePicker.MaskedTimeInput");
|
|
7
|
-
const MaskedTimeInput = forwardRef((props, ref) => {
|
|
8
|
-
const { onChange, name, ...rest } = props;
|
|
9
|
-
return /* @__PURE__ */ React.createElement(MaskedInput, {
|
|
10
|
-
...rest,
|
|
11
|
-
ref,
|
|
12
|
-
name,
|
|
13
|
-
mask: { alias: "datetime", inputFormat: "hh:MM TT" },
|
|
14
|
-
onChange: (value) => {
|
|
15
|
-
if (onChange)
|
|
16
|
-
onChange({ target: { value: value || "" } });
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
export { MaskedTimeInput };
|
|
22
|
-
//# sourceMappingURL=MaskedTimeInput.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MaskedTimeInput.js","sources":["../../../../src/date/LocalTimePicker/MaskedTimeInput.tsx"],"sourcesContent":["import debug from 'debug';\nimport {forwardRef} from 'react';\nimport {MaskedInput, type MaskedInputProps} from '../../inputs/MaskedInput';\nimport type {MaskedInputRef} from '../../inputs/MaskedInput/MaskedInput';\n\nconst d = debug('thx.controls.date.LocalTimePicker.MaskedTimeInput');\n\nexport type MaskedTimeInputRef = MaskedInputRef;\n\nexport interface MaskedTimeInputValue {\n\ttarget: {\n\t\tvalue: string;\n\t};\n}\n\nexport interface MaskedTimeInputProps {\n\tonChange?: (value: MaskedTimeInputValue) => void;\n}\n\nexport const MaskedTimeInput = forwardRef<MaskedTimeInputRef, MaskedTimeInputProps & Omit<MaskedInputProps, 'onChange'>>(\n\t(props: MaskedTimeInputProps & Omit<MaskedInputProps, 'onChange'>, ref: any) => {\n\t\tconst {onChange, name, ...rest} = props;\n\n\t\treturn (\n\t\t\t<MaskedInput\n\t\t\t\t{...rest}\n\t\t\t\tref={ref}\n\t\t\t\tname={name}\n\t\t\t\tmask={{alias: 'datetime', inputFormat: 'hh:MM TT'}}\n\t\t\t\tonChange={(value: string) => {\n\t\t\t\t\tif (onChange) onChange({target: {value: value || ''}});\n\t\t\t\t}}\n\t\t\t/>\n\t\t);\n\t},\n);\n"],"names":[],"mappings":";;;;;AAKU,MAAM,mDAAmD,EAAA;AAc5D,MAAM,eAAkB,GAAA,UAAA,CAC9B,CAAC,KAAA,EAAkE,GAAa,KAAA;AAC/E,EAAM,MAAA,EAAC,QAAU,EAAA,IAAA,EAAA,GAAS,IAAQ,EAAA,GAAA,KAAA,CAAA;AAElC,EAAA,uBACE,KAAA,CAAA,aAAA,CAAA,WAAA,EAAA;AAAA,IACI,GAAA,IAAA;AAAA,IACJ,GAAA;AAAA,IACA,IAAA;AAAA,IACA,IAAM,EAAA,EAAC,KAAO,EAAA,UAAA,EAAY,aAAa,UAAU,EAAA;AAAA,IACjD,QAAA,EAAU,CAAC,KAAkB,KAAA;AAC5B,MAAI,IAAA,QAAA;AAAU,QAAA,QAAA,CAAS,EAAC,MAAQ,EAAA,EAAC,OAAO,KAAS,IAAA,EAAA,IAAI,CAAA,CAAA;AAAA,KACtD;AAAA,GACD,CAAA,CAAA;AAEF,CACD;;;;"}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { toDate, toLocalDate } from '@thx/date';
|
|
3
|
-
import debug from 'debug';
|
|
4
|
-
import { Input } from 'semantic-ui-react';
|
|
5
|
-
import DatePicker from 'react-datepicker';
|
|
6
|
-
import '../DatePicker/styles.css.js';
|
|
7
|
-
|
|
8
|
-
debug("thx.controls.date.MonthDayPicker");
|
|
9
|
-
const months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
|
|
10
|
-
function MonthDayHeader(props) {
|
|
11
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
|
|
12
|
-
className: "react-datepicker__current-month"
|
|
13
|
-
}, months[props.date.getMonth()]), /* @__PURE__ */ React.createElement("button", {
|
|
14
|
-
type: "button",
|
|
15
|
-
className: "react-datepicker__navigation react-datepicker__navigation--previous",
|
|
16
|
-
"aria-label": "Previous Month",
|
|
17
|
-
onClick: props.decreaseMonth,
|
|
18
|
-
disabled: props.prevMonthButtonDisabled
|
|
19
|
-
}, "Previous Month"), /* @__PURE__ */ React.createElement("button", {
|
|
20
|
-
type: "button",
|
|
21
|
-
className: "react-datepicker__navigation react-datepicker__navigation--next",
|
|
22
|
-
"aria-label": "Next Month",
|
|
23
|
-
onClick: props.increaseMonth,
|
|
24
|
-
disabled: props.nextMonthButtonDisabled
|
|
25
|
-
}, "Next Month"));
|
|
26
|
-
}
|
|
27
|
-
function MonthDayPicker(props) {
|
|
28
|
-
const {
|
|
29
|
-
value,
|
|
30
|
-
onChange,
|
|
31
|
-
as,
|
|
32
|
-
action,
|
|
33
|
-
actionPosition,
|
|
34
|
-
className,
|
|
35
|
-
disabled,
|
|
36
|
-
error,
|
|
37
|
-
fluid,
|
|
38
|
-
focus,
|
|
39
|
-
icon,
|
|
40
|
-
iconPosition,
|
|
41
|
-
inverted,
|
|
42
|
-
label,
|
|
43
|
-
labelPosition,
|
|
44
|
-
loading,
|
|
45
|
-
size,
|
|
46
|
-
tabIndex,
|
|
47
|
-
transparent,
|
|
48
|
-
...rest
|
|
49
|
-
} = props;
|
|
50
|
-
const selected = value ? toDate(value) : null;
|
|
51
|
-
const inputProps = {
|
|
52
|
-
as,
|
|
53
|
-
action,
|
|
54
|
-
actionPosition,
|
|
55
|
-
className,
|
|
56
|
-
disabled,
|
|
57
|
-
error,
|
|
58
|
-
fluid,
|
|
59
|
-
focus,
|
|
60
|
-
icon,
|
|
61
|
-
iconPosition,
|
|
62
|
-
inverted,
|
|
63
|
-
label,
|
|
64
|
-
labelPosition,
|
|
65
|
-
loading,
|
|
66
|
-
size,
|
|
67
|
-
tabIndex,
|
|
68
|
-
transparent
|
|
69
|
-
};
|
|
70
|
-
return /* @__PURE__ */ React.createElement(DatePicker, {
|
|
71
|
-
...rest,
|
|
72
|
-
selected,
|
|
73
|
-
onChange: (date) => {
|
|
74
|
-
if (onChange)
|
|
75
|
-
onChange(date ? toLocalDate(date) : null);
|
|
76
|
-
},
|
|
77
|
-
customInput: /* @__PURE__ */ React.createElement(Input, {
|
|
78
|
-
...inputProps
|
|
79
|
-
}),
|
|
80
|
-
renderCustomHeader: MonthDayHeader,
|
|
81
|
-
dateFormat: "MMMM d"
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export { MonthDayPicker };
|
|
86
|
-
//# sourceMappingURL=MonthDayPicker.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MonthDayPicker.js","sources":["../../../../src/date/MonthDayPicker/MonthDayPicker.tsx"],"sourcesContent":["import type {LocalDate} from '@js-joda/core';\nimport {toDate, toLocalDate} from '@thx/date';\nimport debug from 'debug';\nimport type {ReactDatePickerProps} from 'react-datepicker';\nimport {type InputProps, Input} from 'semantic-ui-react';\nimport {DatePicker} from '../DatePicker/index';\n\nconst d = debug('thx.controls.date.MonthDayPicker');\n\nconst months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];\n\ninterface MonthDayHeaderProps {\n\tdate: Date;\n\tchangeYear(year: number): void;\n\tchangeMonth(month: number): void;\n\tdecreaseMonth(): void;\n\tincreaseMonth(): void;\n\tprevMonthButtonDisabled: boolean;\n\tnextMonthButtonDisabled: boolean;\n\tdecreaseYear(): void;\n\tincreaseYear(): void;\n\tprevYearButtonDisabled: boolean;\n\tnextYearButtonDisabled: boolean;\n}\n\nfunction MonthDayHeader(props: MonthDayHeaderProps) {\n\treturn (\n\t\t<>\n\t\t\t<div className=\"react-datepicker__current-month\">{months[props.date.getMonth()]}</div>\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\tclassName=\"react-datepicker__navigation react-datepicker__navigation--previous\"\n\t\t\t\taria-label=\"Previous Month\"\n\t\t\t\tonClick={props.decreaseMonth}\n\t\t\t\tdisabled={props.prevMonthButtonDisabled}\n\t\t\t>\n\t\t\t\tPrevious Month\n\t\t\t</button>\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\tclassName=\"react-datepicker__navigation react-datepicker__navigation--next\"\n\t\t\t\taria-label=\"Next Month\"\n\t\t\t\tonClick={props.increaseMonth}\n\t\t\t\tdisabled={props.nextMonthButtonDisabled}\n\t\t\t>\n\t\t\t\tNext Month\n\t\t\t</button>\n\t\t</>\n\t);\n}\n\ninterface IMonthDayPickerProps {\n\tvalue?: LocalDate | number | null;\n\tonChange?: (value: LocalDate | null) => void;\n\tonChangeRaw?: () => void;\n}\n\ntype InputPropsOmitted = Omit<InputProps, 'onChange'>;\ntype ReactDatePickerPropsOmitted = Omit<Omit<ReactDatePickerProps, 'value'>, 'onChange'>;\nexport type MonthDayPickerProps = IMonthDayPickerProps & InputPropsOmitted & ReactDatePickerPropsOmitted;\n\nexport function MonthDayPicker(props: MonthDayPickerProps): JSX.Element {\n\tconst {\n\t\tvalue,\n\t\tonChange,\n\t\tas,\n\t\taction,\n\t\tactionPosition,\n\t\tclassName,\n\t\tdisabled,\n\t\terror,\n\t\tfluid,\n\t\tfocus,\n\t\ticon,\n\t\ticonPosition,\n\t\tinverted,\n\t\tlabel,\n\t\tlabelPosition,\n\t\tloading,\n\t\tsize,\n\t\ttabIndex,\n\t\ttransparent,\n\t\t...rest\n\t} = props;\n\n\tconst selected = value ? toDate(value) : null;\n\n\tconst inputProps = {\n\t\tas,\n\t\taction,\n\t\tactionPosition,\n\t\tclassName,\n\t\tdisabled,\n\t\terror,\n\t\tfluid,\n\t\tfocus,\n\t\ticon,\n\t\ticonPosition,\n\t\tinverted,\n\t\tlabel,\n\t\tlabelPosition,\n\t\tloading,\n\t\tsize,\n\t\ttabIndex,\n\t\ttransparent,\n\t};\n\n\treturn (\n\t\t<DatePicker\n\t\t\t{...rest}\n\t\t\tselected={selected}\n\t\t\tonChange={date => {\n\t\t\t\tif (onChange) onChange(date ? toLocalDate(date) : null);\n\t\t\t}}\n\t\t\tcustomInput={<Input {...inputProps} />}\n\t\t\trenderCustomHeader={MonthDayHeader}\n\t\t\tdateFormat=\"MMMM d\"\n\t\t/>\n\t);\n}\n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A,IACA,IAAA;AAAA,IACA,QAAA;AAAA,IACA,WAAA;AAAA,IACG,GAAA,IAAA;AAAA,GACA,GAAA,KAAA,CAAA;AAEJ,EAAA,MAAM,QAAW,GAAA,KAAA,GAAQ,MAAO,CAAA,KAAK,CAAI,GAAA,IAAA,CAAA;AAEzC,EAAA,MAAM,UAAa,GAAA;AAAA,IAClB,EAAA;AAAA,IACA,MAAA;AAAA,IACA,cAAA;AAAA,IACA,SAAA;AAAA,IACA,QAAA;AAAA,IACA,KAAA;AAAA,IACA,KAAA;AAAA,IACA,KAAA;AAAA,IACA,IAAA;AAAA,IACA,YAAA;AAAA,IACA,QAAA;AAAA,IACA,KAAA;AAAA,IACA,aAAA;AAAA,IACA,OAAA;AAAA,IACA,IAAA;AAAA,IACA,QAAA;AAAA,IACA,WAAA;AAAA,GACD,CAAA;AAEA,EAAA,uBACE,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA;AAAA,IACI,GAAA,IAAA;AAAA,IACJ,QAAA;AAAA,IACA,UAAU,CAAQ,IAAA,KAAA;AACjB,MAAI,IAAA,QAAA;AAAU,QAAA,QAAA,CAAS,IAAO,GAAA,WAAA,CAAY,IAAI,CAAA,GAAI,IAAI,CAAA,CAAA;AAAA,KACvD;AAAA,IACA,6BAAc,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA;AAAA,MAAU,GAAA,UAAA;AAAA,KAAY,CAAA;AAAA,IACpC,kBAAoB,EAAA,cAAA;AAAA,IACpB,UAAW,EAAA,QAAA;AAAA,GACZ,CAAA,CAAA;AAEF;;;;"}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { LocalDate } from '@js-joda/core';
|
|
3
|
-
import { toDate, toLocalDate } from '@thx/date';
|
|
4
|
-
import debug from 'debug';
|
|
5
|
-
import { Input } from 'semantic-ui-react';
|
|
6
|
-
import DatePicker from 'react-datepicker';
|
|
7
|
-
import '../DatePicker/styles.css.js';
|
|
8
|
-
|
|
9
|
-
debug("thx.controls.date.MonthYearPicker");
|
|
10
|
-
function MonthYearPicker(props) {
|
|
11
|
-
const {
|
|
12
|
-
value,
|
|
13
|
-
onChange,
|
|
14
|
-
as,
|
|
15
|
-
action,
|
|
16
|
-
actionPosition,
|
|
17
|
-
className,
|
|
18
|
-
disabled,
|
|
19
|
-
error,
|
|
20
|
-
fluid,
|
|
21
|
-
focus,
|
|
22
|
-
icon,
|
|
23
|
-
iconPosition,
|
|
24
|
-
inverted,
|
|
25
|
-
label,
|
|
26
|
-
labelPosition,
|
|
27
|
-
loading,
|
|
28
|
-
size,
|
|
29
|
-
tabIndex,
|
|
30
|
-
transparent,
|
|
31
|
-
minDate,
|
|
32
|
-
maxDate,
|
|
33
|
-
...rest
|
|
34
|
-
} = props;
|
|
35
|
-
const selected = value ? toDate(value) : null;
|
|
36
|
-
const inputProps = {
|
|
37
|
-
as,
|
|
38
|
-
action,
|
|
39
|
-
actionPosition,
|
|
40
|
-
className,
|
|
41
|
-
disabled,
|
|
42
|
-
error,
|
|
43
|
-
fluid,
|
|
44
|
-
focus,
|
|
45
|
-
icon,
|
|
46
|
-
iconPosition,
|
|
47
|
-
inverted,
|
|
48
|
-
label,
|
|
49
|
-
labelPosition,
|
|
50
|
-
loading,
|
|
51
|
-
size,
|
|
52
|
-
tabIndex,
|
|
53
|
-
transparent
|
|
54
|
-
};
|
|
55
|
-
return /* @__PURE__ */ React.createElement(DatePicker, {
|
|
56
|
-
...rest,
|
|
57
|
-
selected,
|
|
58
|
-
onChange: (date) => {
|
|
59
|
-
if (onChange)
|
|
60
|
-
onChange(date ? toLocalDate(date) : void 0);
|
|
61
|
-
},
|
|
62
|
-
customInput: /* @__PURE__ */ React.createElement(Input, {
|
|
63
|
-
...inputProps
|
|
64
|
-
}),
|
|
65
|
-
dateFormat: "MMMM yyyy",
|
|
66
|
-
showMonthYearPicker: true,
|
|
67
|
-
minDate: toDate(minDate?.withDayOfMonth(1) || LocalDate.ofEpochDay(0)),
|
|
68
|
-
maxDate: toDate(maxDate?.plusMonths(1).withDayOfMonth(1).minusDays(1) || LocalDate.now().plusYears(20))
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export { MonthYearPicker };
|
|
73
|
-
//# sourceMappingURL=MonthYearPicker.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MonthYearPicker.js","sources":["../../../../src/date/MonthYearPicker/MonthYearPicker.tsx"],"sourcesContent":["import {LocalDate} from '@js-joda/core';\nimport {toDate, toLocalDate} from '@thx/date';\nimport debug from 'debug';\nimport type {ReactDatePickerProps} from 'react-datepicker';\nimport {type InputProps, Input} from 'semantic-ui-react';\nimport {DatePicker} from '../DatePicker/index';\n\nconst d = debug('thx.controls.date.MonthYearPicker');\n\ninterface IMonthYearPickerProps {\n\tvalue?: LocalDate | number | undefined;\n\tonChange?: (value: LocalDate | undefined) => void;\n\tonChangeRaw?: () => void;\n\tminDate?: LocalDate | undefined;\n\tmaxDate?: LocalDate | undefined;\n}\n\ntype InputPropsOmitted = Omit<InputProps, 'onChange'>;\ntype ReactDatePickerPropsOmitted = Omit<Omit<ReactDatePickerProps, 'value' | 'minDate' | 'maxDate'>, 'onChange'>;\nexport type MonthYearPickerProps = IMonthYearPickerProps & InputPropsOmitted & ReactDatePickerPropsOmitted;\n\nexport function MonthYearPicker(props: MonthYearPickerProps): JSX.Element {\n\tconst {\n\t\tvalue,\n\t\tonChange,\n\t\tas,\n\t\taction,\n\t\tactionPosition,\n\t\tclassName,\n\t\tdisabled,\n\t\terror,\n\t\tfluid,\n\t\tfocus,\n\t\ticon,\n\t\ticonPosition,\n\t\tinverted,\n\t\tlabel,\n\t\tlabelPosition,\n\t\tloading,\n\t\tsize,\n\t\ttabIndex,\n\t\ttransparent,\n\t\tminDate,\n\t\tmaxDate,\n\t\t...rest\n\t} = props;\n\n\tconst selected = value ? toDate(value) : null;\n\n\tconst inputProps = {\n\t\tas,\n\t\taction,\n\t\tactionPosition,\n\t\tclassName,\n\t\tdisabled,\n\t\terror,\n\t\tfluid,\n\t\tfocus,\n\t\ticon,\n\t\ticonPosition,\n\t\tinverted,\n\t\tlabel,\n\t\tlabelPosition,\n\t\tloading,\n\t\tsize,\n\t\ttabIndex,\n\t\ttransparent,\n\t};\n\n\treturn (\n\t\t<DatePicker\n\t\t\t{...rest}\n\t\t\tselected={selected}\n\t\t\tonChange={date => {\n\t\t\t\tif (onChange) onChange(date ? toLocalDate(date) : undefined);\n\t\t\t}}\n\t\t\tcustomInput={<Input {...inputProps} />}\n\t\t\tdateFormat=\"MMMM yyyy\"\n\t\t\tshowMonthYearPicker\n\t\t\tminDate={toDate(minDate?.withDayOfMonth(1) || LocalDate.ofEpochDay(0))}\n\t\t\tmaxDate={toDate(maxDate?.plusMonths(1).withDayOfMonth(1).minusDays(1) || LocalDate.now().plusYears(20))}\n\t\t/>\n\t);\n}\n"],"names":[],"mappings":";;;;;;;;AAOU,MAAM,mCAAmC,EAAA;AAc5C,SAAA,eAAA,CAAyB,KAA0C,EAAA;AACzE,EAAM,MAAA;AAAA,IACL,KAAA;AAAA,IACA,QAAA;AAAA,IACA,EAAA;AAAA,IACA,MAAA;AAAA,IACA,cAAA;AAAA,IACA,SAAA;AAAA,IACA,QAAA;AAAA,IACA,KAAA;AAAA,IACA,KAAA;AAAA,IACA,KAAA;AAAA,IACA,IAAA;AAAA,IACA,YAAA;AAAA,IACA,QAAA;AAAA,IACA,KAAA;AAAA,IACA,aAAA;AAAA,IACA,OAAA;AAAA,IACA,IAAA;AAAA,IACA,QAAA;AAAA,IACA,WAAA;AAAA,IACA,OAAA;AAAA,IACA,OAAA;AAAA,IACG,GAAA,IAAA;AAAA,GACA,GAAA,KAAA,CAAA;AAEJ,EAAA,MAAM,QAAW,GAAA,KAAA,GAAQ,MAAO,CAAA,KAAK,CAAI,GAAA,IAAA,CAAA;AAEzC,EAAA,MAAM,UAAa,GAAA;AAAA,IAClB,EAAA;AAAA,IACA,MAAA;AAAA,IACA,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