@thx/controls 16.0.0-alpha.23 → 16.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/dist/esm/date/DatePicker/styles.css.js +7 -0
  2. package/dist/esm/date/DatePicker/styles.css.js.map +1 -0
  3. package/dist/esm/date/LocalDatePicker/LocalDatePicker.js +13 -60
  4. package/dist/esm/date/LocalDatePicker/LocalDatePicker.js.map +1 -0
  5. package/dist/esm/date/LocalDatePicker/MaskedDateInput.js +7 -35
  6. package/dist/esm/date/LocalDatePicker/MaskedDateInput.js.map +1 -0
  7. package/dist/esm/date/LocalMonthSelect/LocalMonthSelect.js +7 -32
  8. package/dist/esm/date/LocalMonthSelect/LocalMonthSelect.js.map +1 -0
  9. package/dist/esm/date/LocalTimePicker/LocalTimePicker.js +13 -57
  10. package/dist/esm/date/LocalTimePicker/LocalTimePicker.js.map +1 -0
  11. package/dist/esm/date/LocalTimePicker/MaskedTimeInput.js +8 -33
  12. package/dist/esm/date/LocalTimePicker/MaskedTimeInput.js.map +1 -0
  13. package/dist/esm/date/MonthDayPicker/MonthDayPicker.js +13 -57
  14. package/dist/esm/date/MonthDayPicker/MonthDayPicker.js.map +1 -0
  15. package/dist/esm/date/MonthYearPicker/MonthYearPicker.js +15 -61
  16. package/dist/esm/date/MonthYearPicker/MonthYearPicker.js.map +1 -0
  17. package/dist/esm/date/YearSelect/YearSelect.js +7 -32
  18. package/dist/esm/date/YearSelect/YearSelect.js.map +1 -0
  19. package/dist/esm/external/style-inject/dist/style-inject.es.js +29 -0
  20. package/dist/esm/external/style-inject/dist/style-inject.es.js.map +1 -0
  21. package/dist/esm/form/TForm/TForm.js +5 -4
  22. package/dist/esm/form/TForm/TForm.js.map +1 -0
  23. package/dist/esm/form/TForm/useTForm.js +7 -38
  24. package/dist/esm/form/TForm/useTForm.js.map +1 -0
  25. package/dist/esm/index.js +6 -4
  26. package/dist/esm/index.js.map +1 -0
  27. package/dist/esm/inputs/CreditCardInput/CreditCardInput.js +4 -2
  28. package/dist/esm/inputs/CreditCardInput/CreditCardInput.js.map +1 -0
  29. package/dist/esm/inputs/CreditCardInput/CreditCardNumberInput.js +6 -35
  30. package/dist/esm/inputs/CreditCardInput/CreditCardNumberInput.js.map +1 -0
  31. package/dist/esm/inputs/CreditCardInput/styles.css.js +7 -0
  32. package/dist/esm/inputs/CreditCardInput/styles.css.js.map +1 -0
  33. package/dist/esm/inputs/MaskedInput/MaskedInput.js +6 -30
  34. package/dist/esm/inputs/MaskedInput/MaskedInput.js.map +1 -0
  35. package/dist/esm/inputs/MaskedInput/useMaskedInput.js +14 -32
  36. package/dist/esm/inputs/MaskedInput/useMaskedInput.js.map +1 -0
  37. package/dist/esm/inputs/PhoneInput/PhoneInput.js +7 -34
  38. package/dist/esm/inputs/PhoneInput/PhoneInput.js.map +1 -0
  39. package/dist/esm/inputs/RadioGroup/RadioGroup.js +7 -32
  40. package/dist/esm/inputs/RadioGroup/RadioGroup.js.map +1 -0
  41. package/dist/esm/inputs/Scriptel/Scriptel.js +2 -1
  42. package/dist/esm/inputs/Scriptel/Scriptel.js.map +1 -0
  43. package/dist/esm/inputs/Scriptel/ScriptelContext.js +1 -0
  44. package/dist/esm/inputs/Scriptel/ScriptelContext.js.map +1 -0
  45. package/dist/esm/inputs/Scriptel/scriptel/enums.js +1 -0
  46. package/dist/esm/inputs/Scriptel/scriptel/enums.js.map +1 -0
  47. package/dist/esm/inputs/Scriptel/scriptel/index.js +1 -0
  48. package/dist/esm/inputs/Scriptel/scriptel/index.js.map +1 -0
  49. package/dist/esm/inputs/Scriptel/withScriptel.js +7 -17
  50. package/dist/esm/inputs/Scriptel/withScriptel.js.map +1 -0
  51. package/dist/esm/inputs/ScriptelInput/ScriptelInput.js +8 -10
  52. package/dist/esm/inputs/ScriptelInput/ScriptelInput.js.map +1 -0
  53. package/dist/esm/inputs/SinInput/SinInput.js +6 -35
  54. package/dist/esm/inputs/SinInput/SinInput.js.map +1 -0
  55. package/dist/esm/inputs/TableInput/DropdownCell.js +6 -34
  56. package/dist/esm/inputs/TableInput/DropdownCell.js.map +1 -0
  57. package/dist/esm/inputs/TableInput/HoverCell.js +5 -17
  58. package/dist/esm/inputs/TableInput/HoverCell.js.map +1 -0
  59. package/dist/esm/inputs/TableInput/MoneyCell.js +3 -1
  60. package/dist/esm/inputs/TableInput/MoneyCell.js.map +1 -0
  61. package/dist/esm/inputs/TableInput/MoneyEditCell.js +4 -3
  62. package/dist/esm/inputs/TableInput/MoneyEditCell.js.map +1 -0
  63. package/dist/esm/inputs/TableInput/MoneySumFooter.js +2 -0
  64. package/dist/esm/inputs/TableInput/MoneySumFooter.js.map +1 -0
  65. package/dist/esm/inputs/TableInput/StringEditCell.js +6 -24
  66. package/dist/esm/inputs/TableInput/StringEditCell.js.map +1 -0
  67. package/dist/esm/inputs/TableInput/TableInput.js +25 -27
  68. package/dist/esm/inputs/TableInput/TableInput.js.map +1 -0
  69. package/dist/esm/inputs/TableInput/addRowOnTab.js +1 -0
  70. package/dist/esm/inputs/TableInput/addRowOnTab.js.map +1 -0
  71. package/dist/esm/money/MoneyCurrencyInput/MoneyCurrencyInput.js +8 -37
  72. package/dist/esm/money/MoneyCurrencyInput/MoneyCurrencyInput.js.map +1 -0
  73. package/dist/esm/money/MoneyInput/MoneyInput.js +6 -31
  74. package/dist/esm/money/MoneyInput/MoneyInput.js.map +1 -0
  75. package/dist/esm/money/useMoneyInput.js +8 -10
  76. package/dist/esm/money/useMoneyInput.js.map +1 -0
  77. package/dist/esm/step/FormStep.js +2 -1
  78. package/dist/esm/step/FormStep.js.map +1 -0
  79. package/dist/esm/step/Step.js +2 -0
  80. package/dist/esm/step/Step.js.map +1 -0
  81. package/dist/esm/step/StepProvider.js +18 -37
  82. package/dist/esm/step/StepProvider.js.map +1 -0
  83. package/dist/esm/step/stepContext.js +1 -0
  84. package/dist/esm/step/stepContext.js.map +1 -0
  85. package/dist/esm/step/useStep.js +1 -0
  86. package/dist/esm/step/useStep.js.map +1 -0
  87. package/dist/stats.html +2689 -0
  88. package/dist/stats.txt +94 -0
  89. package/dist/types/date/LocalDatePicker/LocalDatePicker.d.ts +1 -0
  90. package/dist/types/inputs/MaskedInput/useMaskedInput.d.ts +1 -1
  91. package/package.json +11 -19
@@ -0,0 +1,7 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,wBAAwB,uDAAyD;AACjF;AACA;AACA;AACA;AACA;"}
@@ -1,42 +1,13 @@
1
+ import React from 'react';
1
2
  import { toDate, toLocalDate } from '@thx/date';
2
3
  import debug from 'debug';
3
4
  import DatePicker from 'react-datepicker';
5
+ import '../DatePicker/styles.css.js';
4
6
  import { MaskedDateInput } from './MaskedDateInput.js';
5
7
 
6
- var __defProp = Object.defineProperty;
7
- var __defProps = Object.defineProperties;
8
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
9
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
10
- var __hasOwnProp = Object.prototype.hasOwnProperty;
11
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
12
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13
- var __spreadValues = (a, b) => {
14
- for (var prop in b || (b = {}))
15
- if (__hasOwnProp.call(b, prop))
16
- __defNormalProp(a, prop, b[prop]);
17
- if (__getOwnPropSymbols)
18
- for (var prop of __getOwnPropSymbols(b)) {
19
- if (__propIsEnum.call(b, prop))
20
- __defNormalProp(a, prop, b[prop]);
21
- }
22
- return a;
23
- };
24
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
25
- var __objRest = (source, exclude) => {
26
- var target = {};
27
- for (var prop in source)
28
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
29
- target[prop] = source[prop];
30
- if (source != null && __getOwnPropSymbols)
31
- for (var prop of __getOwnPropSymbols(source)) {
32
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
33
- target[prop] = source[prop];
34
- }
35
- return target;
36
- };
37
8
  debug("thx.controls.date.LocalDatePicker");
38
9
  function LocalDatePicker(props) {
39
- const _a = props, {
10
+ const {
40
11
  minDate,
41
12
  maxDate,
42
13
  value,
@@ -57,30 +28,9 @@ function LocalDatePicker(props) {
57
28
  loading,
58
29
  size,
59
30
  tabIndex,
60
- transparent
61
- } = _a, rest = __objRest(_a, [
62
- "minDate",
63
- "maxDate",
64
- "value",
65
- "onChange",
66
- "onBlur",
67
- "as",
68
- "action",
69
- "actionPosition",
70
- "className",
71
- "error",
72
- "fluid",
73
- "focus",
74
- "icon",
75
- "iconPosition",
76
- "inverted",
77
- "label",
78
- "labelPosition",
79
- "loading",
80
- "size",
81
- "tabIndex",
82
- "transparent"
83
- ]);
31
+ transparent,
32
+ ...rest
33
+ } = props;
84
34
  const selected = value ? toDate(value) : null;
85
35
  const inputProps = {
86
36
  as,
@@ -100,19 +50,22 @@ function LocalDatePicker(props) {
100
50
  tabIndex,
101
51
  transparent
102
52
  };
103
- return /* @__PURE__ */ React.createElement(DatePicker, __spreadProps(__spreadValues({}, rest), {
53
+ return /* @__PURE__ */ React.createElement(DatePicker, {
54
+ ...rest,
104
55
  selected,
105
56
  onChange: (date) => {
106
57
  if (onChange)
107
58
  onChange(date ? toLocalDate(date) : null);
108
59
  },
109
60
  onBlur,
110
- customInput: /* @__PURE__ */ React.createElement(MaskedDateInput, __spreadProps(__spreadValues({}, inputProps), {
61
+ customInput: /* @__PURE__ */ React.createElement(MaskedDateInput, {
62
+ ...inputProps,
111
63
  onBlur
112
- })),
64
+ }),
113
65
  minDate: minDate ? toDate(minDate) : null,
114
66
  maxDate: maxDate ? toDate(maxDate) : null
115
- }));
67
+ });
116
68
  }
117
69
 
118
70
  export { LocalDatePicker };
71
+ //# sourceMappingURL=LocalDatePicker.js.map
@@ -0,0 +1 @@
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 type {ReactDatePickerProps} from 'react-datepicker';\nimport type {InputProps} from 'semantic-ui-react';\nimport {DatePicker} from '../DatePicker/index';\nimport '../DatePicker/styles.css';\nimport {MaskedDateInput} 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}\n\ntype InputPropsOmitted = Omit<InputProps, 'onChange'>;\ntype ReactDatePickerPropsOmitted = Omit<Omit<ReactDatePickerProps, 'value'>, 'onChange' | 'minDate' | 'maxDate'>;\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,\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\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\tonBlur={onBlur}\n\t\t\tcustomInput={<MaskedDateInput {...inputProps} onBlur={onBlur} />}\n\t\t\tminDate={minDate ? toDate(minDate) : null}\n\t\t\tmaxDate={maxDate ? toDate(maxDate) : null}\n\t\t/>\n\t);\n}\n"],"names":[],"mappings":";;;;;;;AASU,MAAM,mCAAmC,EAAA;AAc5C,SAAA,eAAA,CAAyB,KAA0C,EAAA;AACzE,EAAM,MAAA;AAAA,IACL,OAAA;AAAA,IACA,OAAA;AAAA,IACA,KAAA;AAAA,IACA,QAAA;AAAA,IACA,MAAA;AAAA,IACA,EAAA;AAAA,IACA,MAAA;AAAA,IACA,cAAA;AAAA,IACA,SAAA;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,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,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,MAAA;AAAA,IACA,6BAAc,KAAA,CAAA,aAAA,CAAA,eAAA,EAAA;AAAA,MAAoB,GAAA,UAAA;AAAA,MAAY,MAAA;AAAA,KAAgB,CAAA;AAAA,IAC9D,OAAS,EAAA,OAAA,GAAU,MAAO,CAAA,OAAO,CAAI,GAAA,IAAA;AAAA,IACrC,OAAS,EAAA,OAAA,GAAU,MAAO,CAAA,OAAO,CAAI,GAAA,IAAA;AAAA,GACtC,CAAA,CAAA;AAEF;;;;"}
@@ -1,50 +1,22 @@
1
+ import React, { forwardRef } from 'react';
1
2
  import debug from 'debug';
2
- import { forwardRef } from 'react';
3
3
  import { MaskedInput } from '../../inputs/MaskedInput/MaskedInput.js';
4
+ import '../../inputs/MaskedInput/useMaskedInput.js';
4
5
 
5
- var __defProp = Object.defineProperty;
6
- var __defProps = Object.defineProperties;
7
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
8
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
9
- var __hasOwnProp = Object.prototype.hasOwnProperty;
10
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
- var __spreadValues = (a, b) => {
13
- for (var prop in b || (b = {}))
14
- if (__hasOwnProp.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- if (__getOwnPropSymbols)
17
- for (var prop of __getOwnPropSymbols(b)) {
18
- if (__propIsEnum.call(b, prop))
19
- __defNormalProp(a, prop, b[prop]);
20
- }
21
- return a;
22
- };
23
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
- var __objRest = (source, exclude) => {
25
- var target = {};
26
- for (var prop in source)
27
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
28
- target[prop] = source[prop];
29
- if (source != null && __getOwnPropSymbols)
30
- for (var prop of __getOwnPropSymbols(source)) {
31
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
32
- target[prop] = source[prop];
33
- }
34
- return target;
35
- };
36
6
  debug("thx.controls.date.LocalDatePicker.MaskedDateInput");
37
7
  function MaskedDateInputInner(props, ref) {
38
- const _a = props, { onChange, name } = _a, rest = __objRest(_a, ["onChange", "name"]);
39
- return /* @__PURE__ */ React.createElement(MaskedInput, __spreadProps(__spreadValues({}, rest), {
8
+ const { onChange, name, ...rest } = props;
9
+ return /* @__PURE__ */ React.createElement(MaskedInput, {
10
+ ...rest,
40
11
  name,
41
12
  mask: { alias: "datetime", inputFormat: "mm/dd/yyyy" },
42
13
  onChange: (value) => {
43
14
  if (onChange)
44
15
  onChange({ target: { value: value || "" } });
45
16
  }
46
- }));
17
+ });
47
18
  }
48
19
  const MaskedDateInput = forwardRef(MaskedDateInputInner);
49
20
 
50
21
  export { MaskedDateInput };
22
+ //# sourceMappingURL=MaskedDateInput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MaskedDateInput.js","sources":["../../../../src/date/LocalDatePicker/MaskedDateInput.tsx"],"sourcesContent":["import debug from 'debug';\nimport {forwardRef} from 'react';\nimport {MaskedInput, MaskedInputProps} from '../../inputs/MaskedInput';\n\nconst d = debug('thx.controls.date.LocalDatePicker.MaskedDateInput');\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\n// eslint-disable-next-line no-unused-vars,@typescript-eslint/no-unused-vars\nfunction MaskedDateInputInner(props: MaskedDateInputProps & Omit<MaskedInputProps, 'onChange'>, ref: any) {\n\tconst {onChange, name, ...rest} = props;\n\n\treturn (\n\t\t<MaskedInput\n\t\t\t{...rest}\n\t\t\tname={name}\n\t\t\tmask={{alias: 'datetime', inputFormat: 'mm/dd/yyyy'}}\n\t\t\tonChange={value => {\n\t\t\t\tif (onChange) onChange({target: {value: value || ''}});\n\t\t\t}}\n\t\t/>\n\t);\n}\n\nexport const MaskedDateInput = forwardRef(MaskedDateInputInner);\n"],"names":[],"mappings":";;;;;AAIU,MAAM,mDAAmD,EAAA;AAcnE,SAAA,oBAAA,CAA8B,OAAkE,GAAU,EAAA;AACzG,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,IAAA;AAAA,IACA,IAAM,EAAA,EAAC,KAAO,EAAA,UAAA,EAAY,aAAa,YAAY,EAAA;AAAA,IACnD,UAAU,CAAS,KAAA,KAAA;AAClB,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,CAAA;AAEa,MAAA,eAAA,GAAkB,WAAW,oBAAoB;;;;"}
@@ -1,35 +1,8 @@
1
+ import React from 'react';
1
2
  import { LocalDate } from '@js-joda/core';
2
3
  import debug from 'debug';
3
4
  import { Select } from 'semantic-ui-react';
4
5
 
5
- var __defProp = Object.defineProperty;
6
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
9
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10
- var __spreadValues = (a, b) => {
11
- for (var prop in b || (b = {}))
12
- if (__hasOwnProp.call(b, prop))
13
- __defNormalProp(a, prop, b[prop]);
14
- if (__getOwnPropSymbols)
15
- for (var prop of __getOwnPropSymbols(b)) {
16
- if (__propIsEnum.call(b, prop))
17
- __defNormalProp(a, prop, b[prop]);
18
- }
19
- return a;
20
- };
21
- var __objRest = (source, exclude) => {
22
- var target = {};
23
- for (var prop in source)
24
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
25
- target[prop] = source[prop];
26
- if (source != null && __getOwnPropSymbols)
27
- for (var prop of __getOwnPropSymbols(source)) {
28
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
29
- target[prop] = source[prop];
30
- }
31
- return target;
32
- };
33
6
  debug("thx.controls.date.LocalMonthSelect");
34
7
  const monthOptions = [
35
8
  { text: "January", value: 1, key: 1 },
@@ -46,9 +19,9 @@ const monthOptions = [
46
19
  { text: "December", value: 12, key: 12 }
47
20
  ];
48
21
  function LocalMonthSelect(props) {
49
- const _a = props, { value, onChange, year, handleBlur } = _a, rest = __objRest(_a, ["value", "onChange", "year", "handleBlur"]);
22
+ const { value, onChange, year, handleBlur, ...rest } = props;
50
23
  const theYear = year || LocalDate.now().year();
51
- return /* @__PURE__ */ React.createElement(Select, __spreadValues({
24
+ return /* @__PURE__ */ React.createElement(Select, {
52
25
  placeholder: "Select Month",
53
26
  options: monthOptions,
54
27
  value: value ? value.monthValue() : "",
@@ -61,8 +34,10 @@ function LocalMonthSelect(props) {
61
34
  }
62
35
  }
63
36
  },
64
- onBlur: handleBlur
65
- }, rest));
37
+ onBlur: handleBlur,
38
+ ...rest
39
+ });
66
40
  }
67
41
 
68
42
  export { LocalMonthSelect };
43
+ //# sourceMappingURL=LocalMonthSelect.js.map
@@ -0,0 +1 @@
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, 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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,IAAM,EAAA,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,43 +1,14 @@
1
+ import React from 'react';
1
2
  import { LocalTime } from '@js-joda/core';
2
3
  import { toDate, toLocalTime } from '@thx/date';
3
4
  import debug from 'debug';
4
5
  import DatePicker from 'react-datepicker';
6
+ import '../DatePicker/styles.css.js';
5
7
  import { MaskedTimeInput } from './MaskedTimeInput.js';
6
8
 
7
- var __defProp = Object.defineProperty;
8
- var __defProps = Object.defineProperties;
9
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
10
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
11
- var __hasOwnProp = Object.prototype.hasOwnProperty;
12
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
13
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
14
- var __spreadValues = (a, b) => {
15
- for (var prop in b || (b = {}))
16
- if (__hasOwnProp.call(b, prop))
17
- __defNormalProp(a, prop, b[prop]);
18
- if (__getOwnPropSymbols)
19
- for (var prop of __getOwnPropSymbols(b)) {
20
- if (__propIsEnum.call(b, prop))
21
- __defNormalProp(a, prop, b[prop]);
22
- }
23
- return a;
24
- };
25
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
26
- var __objRest = (source, exclude) => {
27
- var target = {};
28
- for (var prop in source)
29
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
30
- target[prop] = source[prop];
31
- if (source != null && __getOwnPropSymbols)
32
- for (var prop of __getOwnPropSymbols(source)) {
33
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
34
- target[prop] = source[prop];
35
- }
36
- return target;
37
- };
38
9
  debug("thx.controls.date.LocalTimePicker");
39
10
  function LocalTimePicker(props) {
40
- const _a = props, {
11
+ const {
41
12
  value,
42
13
  onChange,
43
14
  as,
@@ -56,28 +27,9 @@ function LocalTimePicker(props) {
56
27
  loading,
57
28
  size,
58
29
  tabIndex,
59
- transparent
60
- } = _a, rest = __objRest(_a, [
61
- "value",
62
- "onChange",
63
- "as",
64
- "action",
65
- "actionPosition",
66
- "className",
67
- "disabled",
68
- "error",
69
- "fluid",
70
- "focus",
71
- "icon",
72
- "iconPosition",
73
- "inverted",
74
- "label",
75
- "labelPosition",
76
- "loading",
77
- "size",
78
- "tabIndex",
79
- "transparent"
80
- ]);
30
+ transparent,
31
+ ...rest
32
+ } = props;
81
33
  let selected;
82
34
  if (typeof value === "number")
83
35
  selected = toDate(LocalTime.ofSecondOfDay(value));
@@ -102,7 +54,8 @@ function LocalTimePicker(props) {
102
54
  tabIndex,
103
55
  transparent
104
56
  };
105
- return /* @__PURE__ */ React.createElement(DatePicker, __spreadProps(__spreadValues({}, rest), {
57
+ return /* @__PURE__ */ React.createElement(DatePicker, {
58
+ ...rest,
106
59
  selected,
107
60
  onChange: (date) => {
108
61
  if (onChange)
@@ -113,8 +66,11 @@ function LocalTimePicker(props) {
113
66
  timeIntervals: 15,
114
67
  timeCaption: "Time",
115
68
  dateFormat: "hh:mm aa",
116
- customInput: /* @__PURE__ */ React.createElement(MaskedTimeInput, __spreadValues({}, inputProps))
117
- }));
69
+ customInput: /* @__PURE__ */ React.createElement(MaskedTimeInput, {
70
+ ...inputProps
71
+ })
72
+ });
118
73
  }
119
74
 
120
75
  export { LocalTimePicker };
76
+ //# sourceMappingURL=LocalTimePicker.js.map
@@ -0,0 +1 @@
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 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\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\tlet selected;\n\tif (typeof value === 'number') selected = toDate(LocalTime.ofSecondOfDay(value));\n\telse 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 ? 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={<MaskedTimeInput {...inputProps} />}\n\t\t/>\n\t);\n}\n"],"names":[],"mappings":";;;;;;;;AAQU,MAAM,mCAAmC,EAAA;AAY5C,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,WA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2
- import { forwardRef } from 'react';
3
3
  import { MaskedInput } from '../../inputs/MaskedInput/MaskedInput.js';
4
+ import '../../inputs/MaskedInput/useMaskedInput.js';
4
5
 
5
- var __defProp = Object.defineProperty;
6
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
9
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10
- var __spreadValues = (a, b) => {
11
- for (var prop in b || (b = {}))
12
- if (__hasOwnProp.call(b, prop))
13
- __defNormalProp(a, prop, b[prop]);
14
- if (__getOwnPropSymbols)
15
- for (var prop of __getOwnPropSymbols(b)) {
16
- if (__propIsEnum.call(b, prop))
17
- __defNormalProp(a, prop, b[prop]);
18
- }
19
- return a;
20
- };
21
- var __objRest = (source, exclude) => {
22
- var target = {};
23
- for (var prop in source)
24
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
25
- target[prop] = source[prop];
26
- if (source != null && __getOwnPropSymbols)
27
- for (var prop of __getOwnPropSymbols(source)) {
28
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
29
- target[prop] = source[prop];
30
- }
31
- return target;
32
- };
33
6
  debug("thx.controls.date.LocalTimePicker.MaskedTimeInput");
34
7
  function MaskedTimeInputInner(props, ref) {
35
- const _a = props, { onChange } = _a, rest = __objRest(_a, ["onChange"]);
36
- return /* @__PURE__ */ React.createElement(MaskedInput, __spreadValues({
8
+ const { onChange, ...rest } = props;
9
+ return /* @__PURE__ */ React.createElement(MaskedInput, {
37
10
  mask: { alias: "datetime", inputFormat: "hh:MM TT" },
38
11
  onChange: (value) => {
39
12
  if (onChange)
40
13
  onChange({ target: { value: value || "" } });
41
- }
42
- }, rest));
14
+ },
15
+ ...rest
16
+ });
43
17
  }
44
18
  const MaskedTimeInput = forwardRef(MaskedTimeInputInner);
45
19
 
46
20
  export { MaskedTimeInput };
21
+ //# sourceMappingURL=MaskedTimeInput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MaskedTimeInput.js","sources":["../../../../src/date/LocalTimePicker/MaskedTimeInput.tsx"],"sourcesContent":["import debug from 'debug';\nimport {forwardRef} from 'react';\nimport {MaskedInput, MaskedInputProps} from '../../inputs/MaskedInput';\n\nconst d = debug('thx.controls.date.LocalTimePicker.MaskedTimeInput');\n\nexport interface MaskedTimeInputValue {\n\ttarget: {\n\t\tvalue: string;\n\t};\n}\n\nexport interface MaskedTimeInputProps {\n\tonChange?: (value: MaskedTimeInputValue) => void;\n}\n\n// eslint-disable-next-line no-unused-vars,@typescript-eslint/no-unused-vars\nfunction MaskedTimeInputInner(props: MaskedTimeInputProps & Omit<MaskedInputProps, 'onChange'>, ref: any) {\n\tconst {onChange, ...rest} = props;\n\n\treturn (\n\t\t<MaskedInput\n\t\t\tmask={{alias: 'datetime', inputFormat: 'hh:MM TT'}}\n\t\t\tonChange={value => {\n\t\t\t\tif (onChange) onChange({target: {value: value || ''}});\n\t\t\t}}\n\t\t\t{...rest}\n\t\t/>\n\t);\n}\n\nexport const MaskedTimeInput = forwardRef(MaskedTimeInputInner);\n"],"names":[],"mappings":";;;;;AAIU,MAAM,mDAAmD,EAAA;AAanE,SAAA,oBAAA,CAA8B,OAAkE,GAAU,EAAA;AACzG,EAAM,MAAA,EAAC,aAAa,IAAQ,EAAA,GAAA,KAAA,CAAA;AAE5B,EAAA,uBACE,KAAA,CAAA,aAAA,CAAA,WAAA,EAAA;AAAA,IACA,IAAM,EAAA,EAAC,KAAO,EAAA,UAAA,EAAY,aAAa,UAAU,EAAA;AAAA,IACjD,UAAU,CAAS,KAAA,KAAA;AAClB,MAAI,IAAA,QAAA;AAAU,QAAA,QAAA,CAAS,EAAC,MAAQ,EAAA,EAAC,OAAO,KAAS,IAAA,EAAA,IAAI,CAAA,CAAA;AAAA,KACtD;AAAA,IACI,GAAA,IAAA;AAAA,GACL,CAAA,CAAA;AAEF,CAAA;AAEa,MAAA,eAAA,GAAkB,WAAW,oBAAoB;;;;"}
@@ -1,39 +1,10 @@
1
+ import React from 'react';
1
2
  import { toDate, toLocalDate } from '@thx/date';
2
3
  import debug from 'debug';
3
4
  import { Input } from 'semantic-ui-react';
4
5
  import DatePicker from 'react-datepicker';
6
+ import '../DatePicker/styles.css.js';
5
7
 
6
- var __defProp = Object.defineProperty;
7
- var __defProps = Object.defineProperties;
8
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
9
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
10
- var __hasOwnProp = Object.prototype.hasOwnProperty;
11
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
12
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13
- var __spreadValues = (a, b) => {
14
- for (var prop in b || (b = {}))
15
- if (__hasOwnProp.call(b, prop))
16
- __defNormalProp(a, prop, b[prop]);
17
- if (__getOwnPropSymbols)
18
- for (var prop of __getOwnPropSymbols(b)) {
19
- if (__propIsEnum.call(b, prop))
20
- __defNormalProp(a, prop, b[prop]);
21
- }
22
- return a;
23
- };
24
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
25
- var __objRest = (source, exclude) => {
26
- var target = {};
27
- for (var prop in source)
28
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
29
- target[prop] = source[prop];
30
- if (source != null && __getOwnPropSymbols)
31
- for (var prop of __getOwnPropSymbols(source)) {
32
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
33
- target[prop] = source[prop];
34
- }
35
- return target;
36
- };
37
8
  debug("thx.controls.date.MonthDayPicker");
38
9
  const months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
39
10
  function MonthDayHeader(props) {
@@ -54,7 +25,7 @@ function MonthDayHeader(props) {
54
25
  }, "Next Month"));
55
26
  }
56
27
  function MonthDayPicker(props) {
57
- const _a = props, {
28
+ const {
58
29
  value,
59
30
  onChange,
60
31
  as,
@@ -73,28 +44,9 @@ function MonthDayPicker(props) {
73
44
  loading,
74
45
  size,
75
46
  tabIndex,
76
- transparent
77
- } = _a, rest = __objRest(_a, [
78
- "value",
79
- "onChange",
80
- "as",
81
- "action",
82
- "actionPosition",
83
- "className",
84
- "disabled",
85
- "error",
86
- "fluid",
87
- "focus",
88
- "icon",
89
- "iconPosition",
90
- "inverted",
91
- "label",
92
- "labelPosition",
93
- "loading",
94
- "size",
95
- "tabIndex",
96
- "transparent"
97
- ]);
47
+ transparent,
48
+ ...rest
49
+ } = props;
98
50
  const selected = value ? toDate(value) : null;
99
51
  const inputProps = {
100
52
  as,
@@ -115,16 +67,20 @@ function MonthDayPicker(props) {
115
67
  tabIndex,
116
68
  transparent
117
69
  };
118
- return /* @__PURE__ */ React.createElement(DatePicker, __spreadProps(__spreadValues({}, rest), {
70
+ return /* @__PURE__ */ React.createElement(DatePicker, {
71
+ ...rest,
119
72
  selected,
120
73
  onChange: (date) => {
121
74
  if (onChange)
122
75
  onChange(date ? toLocalDate(date) : null);
123
76
  },
124
- customInput: /* @__PURE__ */ React.createElement(Input, __spreadValues({}, inputProps)),
77
+ customInput: /* @__PURE__ */ React.createElement(Input, {
78
+ ...inputProps
79
+ }),
125
80
  renderCustomHeader: MonthDayHeader,
126
81
  dateFormat: "MMMM d"
127
- }));
82
+ });
128
83
  }
129
84
 
130
85
  export { MonthDayPicker };
86
+ //# sourceMappingURL=MonthDayPicker.js.map
@@ -0,0 +1 @@
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 {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"],"names":[],"mappings":";;;;;;;AAOU,MAAM,kCAAkC,EAAA;AAElD,MAAM,MAAS,GAAA,CAAC,SAAW,EAAA,UAAA,EAAY,OAAS,EAAA,OAAA,EAAS,KAAO,EAAA,MAAA,EAAQ,MAAQ,EAAA,QAAA,EAAU,WAAa,EAAA,SAAA,EAAW,YAAY,UAAU,CAAA,CAAA;AAgBxI,SAAA,cAAA,CAAwB,KAA4B,EAAA;AACnD,EAAA,iFAEG,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA;AAAA,IAAI,SAAU,EAAA,iCAAA;AAAA,GAAA,EAAmC,OAAO,KAAM,CAAA,IAAA,CAAK,QAAS,EAAA,CAAG,mBAC/E,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA;AAAA,IACA,IAAK,EAAA,QAAA;AAAA,I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A;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,43 +1,14 @@
1
+ import React from 'react';
1
2
  import { LocalDate } from '@js-joda/core';
2
3
  import { toDate, toLocalDate } from '@thx/date';
3
4
  import debug from 'debug';
4
5
  import { Input } from 'semantic-ui-react';
5
6
  import DatePicker from 'react-datepicker';
7
+ import '../DatePicker/styles.css.js';
6
8
 
7
- var __defProp = Object.defineProperty;
8
- var __defProps = Object.defineProperties;
9
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
10
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
11
- var __hasOwnProp = Object.prototype.hasOwnProperty;
12
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
13
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
14
- var __spreadValues = (a, b) => {
15
- for (var prop in b || (b = {}))
16
- if (__hasOwnProp.call(b, prop))
17
- __defNormalProp(a, prop, b[prop]);
18
- if (__getOwnPropSymbols)
19
- for (var prop of __getOwnPropSymbols(b)) {
20
- if (__propIsEnum.call(b, prop))
21
- __defNormalProp(a, prop, b[prop]);
22
- }
23
- return a;
24
- };
25
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
26
- var __objRest = (source, exclude) => {
27
- var target = {};
28
- for (var prop in source)
29
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
30
- target[prop] = source[prop];
31
- if (source != null && __getOwnPropSymbols)
32
- for (var prop of __getOwnPropSymbols(source)) {
33
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
34
- target[prop] = source[prop];
35
- }
36
- return target;
37
- };
38
9
  debug("thx.controls.date.MonthYearPicker");
39
10
  function MonthYearPicker(props) {
40
- const _a = props, {
11
+ const {
41
12
  value,
42
13
  onChange,
43
14
  as,
@@ -58,30 +29,9 @@ function MonthYearPicker(props) {
58
29
  tabIndex,
59
30
  transparent,
60
31
  minDate,
61
- maxDate
62
- } = _a, rest = __objRest(_a, [
63
- "value",
64
- "onChange",
65
- "as",
66
- "action",
67
- "actionPosition",
68
- "className",
69
- "disabled",
70
- "error",
71
- "fluid",
72
- "focus",
73
- "icon",
74
- "iconPosition",
75
- "inverted",
76
- "label",
77
- "labelPosition",
78
- "loading",
79
- "size",
80
- "tabIndex",
81
- "transparent",
82
- "minDate",
83
- "maxDate"
84
- ]);
32
+ maxDate,
33
+ ...rest
34
+ } = props;
85
35
  const selected = value ? toDate(value) : null;
86
36
  const inputProps = {
87
37
  as,
@@ -102,18 +52,22 @@ function MonthYearPicker(props) {
102
52
  tabIndex,
103
53
  transparent
104
54
  };
105
- return /* @__PURE__ */ React.createElement(DatePicker, __spreadProps(__spreadValues({}, rest), {
55
+ return /* @__PURE__ */ React.createElement(DatePicker, {
56
+ ...rest,
106
57
  selected,
107
58
  onChange: (date) => {
108
59
  if (onChange)
109
60
  onChange(date ? toLocalDate(date) : void 0);
110
61
  },
111
- customInput: /* @__PURE__ */ React.createElement(Input, __spreadValues({}, inputProps)),
62
+ customInput: /* @__PURE__ */ React.createElement(Input, {
63
+ ...inputProps
64
+ }),
112
65
  dateFormat: "MMMM yyyy",
113
66
  showMonthYearPicker: true,
114
- minDate: toDate((minDate == null ? void 0 : minDate.withDayOfMonth(1)) || LocalDate.ofEpochDay(0)),
115
- maxDate: toDate((maxDate == null ? void 0 : maxDate.plusMonths(1).withDayOfMonth(1).minusDays(1)) || LocalDate.now().plusYears(20))
116
- }));
67
+ minDate: toDate(minDate?.withDayOfMonth(1) || LocalDate.ofEpochDay(0)),
68
+ maxDate: toDate(maxDate?.plusMonths(1).withDayOfMonth(1).minusDays(1) || LocalDate.now().plusYears(20))
69
+ });
117
70
  }
118
71
 
119
72
  export { MonthYearPicker };
73
+ //# sourceMappingURL=MonthYearPicker.js.map