@react-fabric/superdate 1.0.0-beta.63 → 1.0.2

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.
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  var core = require('@react-fabric/core');
4
- var superdate$1 = require('./ar/superdate.json.js');
5
- var superdate = require('./en/superdate.json.js');
4
+ var superdate = require('./ar/superdate.json.js');
5
+ var superdate$1 = require('./en/superdate.json.js');
6
6
 
7
7
  /*
8
8
  * React Fabric
@@ -28,6 +28,6 @@ var superdate = require('./en/superdate.json.js');
28
28
  */
29
29
 
30
30
  core.addTranslationBundle("superdate", {
31
- en: superdate.default,
32
- ar: superdate$1.default
31
+ en: superdate$1.default,
32
+ ar: superdate.default
33
33
  });
package/dist/cjs/index.js CHANGED
@@ -3,6 +3,34 @@
3
3
  require('./i18n/index.js');
4
4
  var Superdate = require('./superdate/Superdate.js');
5
5
 
6
+ /**
7
+ * React Fabric
8
+ * @version 1.0.0
9
+ * @license MIT
10
+ * @copyright 2024 Adarsh Pastakia
11
+ *
12
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ * of this software and associated documentation files (the "Software"), to deal
14
+ * in the Software without restriction, including without limitation the rights
15
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+ * copies of the Software, and to permit persons to whom the Software is
17
+ * furnished to do so, subject to the following conditions:
18
+ *
19
+ * The above copyright notice and this permission notice shall be included in all
20
+ * copies or substantial portions of the Software.
21
+ *
22
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
+ * SOFTWARE.
29
+ */
6
30
 
31
+ var SUPERDATE_PACKAGE = "@react-fabric/superdate";
32
+ var SUPERDATE_VERSION = "1.0.0";
7
33
 
8
34
  exports.SuperDate = Superdate.SuperDate;
35
+ exports.SUPERDATE_PACKAGE = SUPERDATE_PACKAGE;
36
+ exports.SUPERDATE_VERSION = SUPERDATE_VERSION;
@@ -64,7 +64,7 @@ var schema = utilities.yup.object({
64
64
  part: utilities.yup.string().required().oneOf(Object.values(date.DatePart)).label("Date part")
65
65
  })
66
66
  });
67
- var QuickSelect = function QuickSelect(_ref) {
67
+ function QuickSelect(_ref) {
68
68
  var _ref$presets = _ref.presets,
69
69
  presets = _ref$presets === void 0 ? DEFAULT_PRESETS : _ref$presets,
70
70
  _ref$value = _ref.value,
@@ -78,11 +78,11 @@ var QuickSelect = function QuickSelect(_ref) {
78
78
  diff = _ref2$rel.diff,
79
79
  op = _ref2$rel.op;
80
80
  onChange("".concat(part).concat(op).concat(diff, "|").concat(date.DatePart.NOW));
81
- }, []);
81
+ }, [onChange]);
82
82
  var defaultValue = react.useMemo(function () {
83
83
  if (value !== null && value !== void 0 && value.endsWith(date.DatePart.NOW)) {
84
- var _value$split$shift$ma;
85
- var _ref3 = (_value$split$shift$ma = value.split("|").shift().match(/^(\$\w+)([+-])(\d+)?$/)) !== null && _value$split$shift$ma !== void 0 ? _value$split$shift$ma : [],
84
+ var _value$split$shift$ma, _value$split$shift;
85
+ var _ref3 = (_value$split$shift$ma = (_value$split$shift = value.split("|").shift()) === null || _value$split$shift === void 0 ? void 0 : _value$split$shift.match(/^(\$\w+)([+-])(\d+)?$/)) !== null && _value$split$shift$ma !== void 0 ? _value$split$shift$ma : [],
86
86
  _ref4 = _slicedToArray(_ref3, 4),
87
87
  part = _ref4[1],
88
88
  op = _ref4[2],
@@ -92,7 +92,7 @@ var QuickSelect = function QuickSelect(_ref) {
92
92
  rel: {
93
93
  part: part,
94
94
  op: op,
95
- diff: diff
95
+ diff: +diff
96
96
  }
97
97
  };
98
98
  }
@@ -131,6 +131,6 @@ var QuickSelect = function QuickSelect(_ref) {
131
131
  })
132
132
  })]
133
133
  });
134
- };
134
+ }
135
135
 
136
136
  exports.QuickSelect = QuickSelect;
@@ -29,7 +29,7 @@ var jsxRuntime = require('react/jsx-runtime');
29
29
  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30
30
  */
31
31
 
32
- var RelativeInput = function RelativeInput(_ref) {
32
+ function RelativeInput(_ref) {
33
33
  var label = _ref.label,
34
34
  prefix = _ref.prefix,
35
35
  showApply = _ref.showApply;
@@ -50,7 +50,7 @@ var RelativeInput = function RelativeInput(_ref) {
50
50
  children: /*#__PURE__*/jsxRuntime.jsx(form.Select, {
51
51
  options: Object.values(date.DatePart).slice(1).map(function (dt) {
52
52
  return {
53
- id: dt,
53
+ value: dt,
54
54
  label: t("label.".concat(dt))
55
55
  };
56
56
  })
@@ -60,10 +60,10 @@ var RelativeInput = function RelativeInput(_ref) {
60
60
  children: /*#__PURE__*/jsxRuntime.jsx(form.Select, {
61
61
  width: "7rem",
62
62
  options: [{
63
- id: "-",
63
+ value: "-",
64
64
  label: t("label.-")
65
65
  }, {
66
- id: "+",
66
+ value: "+",
67
67
  label: t("label.+")
68
68
  }]
69
69
  })
@@ -76,6 +76,6 @@ var RelativeInput = function RelativeInput(_ref) {
76
76
  children: t("label.apply")
77
77
  })]
78
78
  });
79
- };
79
+ }
80
80
 
81
81
  exports.RelativeInput = RelativeInput;
@@ -23,7 +23,7 @@ var schema = utilities.yup.object({
23
23
  part: utilities.yup.string().required().oneOf(Object.values(date.DatePart)).label("Date part")
24
24
  })
25
25
  });
26
- var RelativePanel = function RelativePanel(_ref) {
26
+ function RelativePanel(_ref) {
27
27
  var _ref$value = _ref.value,
28
28
  value = _ref$value === void 0 ? "" : _ref$value,
29
29
  onChange = _ref.onChange;
@@ -32,18 +32,18 @@ var RelativePanel = function RelativePanel(_ref) {
32
32
  var handleChange = react.useCallback(function (_ref2) {
33
33
  var to = _ref2.to,
34
34
  from = _ref2.from;
35
- onChange("".concat(from.part).concat(from.op).concat(from.diff, "|").concat(to.part).concat(to.op).concat(to.diff));
36
- }, []);
35
+ onChange === null || onChange === void 0 || onChange("".concat(from.part).concat(from.op).concat(from.diff, "|").concat(to.part).concat(to.op).concat(to.diff));
36
+ }, [onChange]);
37
37
  var defaultValue = react.useMemo(function () {
38
- if (value !== null && value !== void 0 && value.match(/^(\$\w+)([+-])(\d+)?\|(\$\w+)([+-])(\d+)?$/)) {
39
- var _value$split$shift$ma, _value$split$pop$matc;
40
- var _ref3 = (_value$split$shift$ma = value.split("|").shift().match(/^(\$\w+)([+-])(\d+)?$/)) !== null && _value$split$shift$ma !== void 0 ? _value$split$shift$ma : [],
38
+ if (value.match(/^(\$\w+)([+-])(\d+)?\|(\$\w+)([+-])(\d+)?$/)) {
39
+ var _value$split$shift$ma, _value$split$shift, _value$split$pop$matc, _value$split$pop;
40
+ var _ref3 = (_value$split$shift$ma = (_value$split$shift = value.split("|").shift()) === null || _value$split$shift === void 0 ? void 0 : _value$split$shift.match(/^(\$\w+)([+-])(\d+)?$/)) !== null && _value$split$shift$ma !== void 0 ? _value$split$shift$ma : [],
41
41
  _ref4 = _slicedToArray(_ref3, 4),
42
42
  part = _ref4[1],
43
43
  op = _ref4[2],
44
44
  _ref4$ = _ref4[3],
45
45
  diff = _ref4$ === void 0 ? "0" : _ref4$;
46
- var _ref5 = (_value$split$pop$matc = value.split("|").pop().match(/^(\$\w+)([+-])(\d+)?$/)) !== null && _value$split$pop$matc !== void 0 ? _value$split$pop$matc : [],
46
+ var _ref5 = (_value$split$pop$matc = (_value$split$pop = value.split("|").pop()) === null || _value$split$pop === void 0 ? void 0 : _value$split$pop.match(/^(\$\w+)([+-])(\d+)?$/)) !== null && _value$split$pop$matc !== void 0 ? _value$split$pop$matc : [],
47
47
  _ref6 = _slicedToArray(_ref5, 4),
48
48
  toPart = _ref6[1],
49
49
  toOp = _ref6[2],
@@ -53,12 +53,12 @@ var RelativePanel = function RelativePanel(_ref) {
53
53
  from: {
54
54
  part: part,
55
55
  op: op,
56
- diff: diff
56
+ diff: +diff
57
57
  },
58
58
  to: {
59
59
  part: toPart,
60
60
  op: toOp,
61
- diff: toDiff
61
+ diff: +toDiff
62
62
  }
63
63
  };
64
64
  }
@@ -90,6 +90,6 @@ var RelativePanel = function RelativePanel(_ref) {
90
90
  })
91
91
  })
92
92
  });
93
- };
93
+ }
94
94
 
95
95
  exports.RelativePanel = RelativePanel;
@@ -6,17 +6,17 @@ var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
6
6
  var react$1 = require('@floating-ui/react');
7
7
  var core = require('@react-fabric/core');
8
8
  var date = require('@react-fabric/date');
9
- var classNames = require('classnames');
9
+ var utilities = require('@react-fabric/utilities');
10
10
  var react = require('react');
11
11
  var reactI18next = require('react-i18next');
12
12
  var QuickSelect = require('./QuickSelect.js');
13
13
  var RelativePanel = require('./RelativePanel.js');
14
14
  var jsxRuntime = require('react/jsx-runtime');
15
15
 
16
- var _excluded = ["as", "color", "size", "variant", "disabled", "fullWidth", "onChange", "value", "data-test-value", "data-testid"];
16
+ var _excluded = ["as", "color", "size", "variant", "disabled", "onChange", "value", "data-test-value", "data-testid"];
17
17
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
18
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
19
- var SuperDateTabs = function SuperDateTabs(_ref) {
18
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
19
+ function SuperDateTabs(_ref) {
20
20
  var events = _ref.events,
21
21
  value = _ref.value,
22
22
  presets = _ref.presets,
@@ -26,8 +26,7 @@ var SuperDateTabs = function SuperDateTabs(_ref) {
26
26
  t = _useTranslation.t;
27
27
  var tree = react$1.useFloatingTree();
28
28
  var _useApplicationContex = core.useApplicationContext(),
29
- currentCalendar = _useApplicationContex.currentCalendar,
30
- currentLocale = _useApplicationContex.currentLocale;
29
+ currentCalendar = _useApplicationContex.currentCalendar;
31
30
  var isHijri = react.useMemo(function () {
32
31
  return currentCalendar === "hijri";
33
32
  }, [currentCalendar]);
@@ -41,7 +40,7 @@ var SuperDateTabs = function SuperDateTabs(_ref) {
41
40
  setActiveTab = _useState4[1];
42
41
  react.useEffect(function () {
43
42
  if (value !== null && value !== void 0 && value.match(/^(\$\w+)([+-])(\d+)\|(\$\w+)([+-])(\d+)$/)) setActiveTab("relative");else if (value && !(value !== null && value !== void 0 && value.match(/^(\$\w+)/))) setActiveTab("absolute");else setActiveTab("quick");
44
- value && setCurrentValue(value);
43
+ if (value) setCurrentValue(value);
45
44
  }, [value]);
46
45
  var handleChange = react.useCallback(function (value) {
47
46
  var _parsed$, _parsed$$toISOString, _parsed$2, _parsed$2$toISOString;
@@ -49,11 +48,12 @@ var SuperDateTabs = function SuperDateTabs(_ref) {
49
48
  setCurrentValue(value);
50
49
  onChange === null || onChange === void 0 || onChange(value, [(_parsed$ = parsed[0]) === null || _parsed$ === void 0 || (_parsed$$toISOString = _parsed$.toISOString) === null || _parsed$$toISOString === void 0 ? void 0 : _parsed$$toISOString.call(_parsed$), (_parsed$2 = parsed[1]) === null || _parsed$2 === void 0 || (_parsed$2$toISOString = _parsed$2.toISOString) === null || _parsed$2$toISOString === void 0 ? void 0 : _parsed$2$toISOString.call(_parsed$2)]);
51
50
  tree === null || tree === void 0 || tree.events.emit("close");
52
- }, [isHijri, currentLocale]);
51
+ },
52
+ // eslint-disable-next-line @eslint-react/exhaustive-deps
53
+ [onChange]);
53
54
  return /*#__PURE__*/jsxRuntime.jsx("div", {
54
- className: classNames("rounded-capped outline select-none overflow-hidden grid", "fabric-superDate"),
55
+ className: utilities.cn("rounded-capped outline select-none overflow-hidden grid", "fabric-superDate"),
55
56
  children: /*#__PURE__*/jsxRuntime.jsxs(core.TabPanel, {
56
- headerClassName: "border-b",
57
57
  onChange: setActiveTab,
58
58
  activeTab: activeTab,
59
59
  children: [/*#__PURE__*/jsxRuntime.jsx(core.Tab, {
@@ -74,8 +74,8 @@ var SuperDateTabs = function SuperDateTabs(_ref) {
74
74
  }), /*#__PURE__*/jsxRuntime.jsx(core.Tab, {
75
75
  id: "absolute",
76
76
  label: t("label.absolute"),
77
- children: /*#__PURE__*/jsxRuntime.jsx(core.Content, {
78
- className: "p-0",
77
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
78
+ className: "p-0 overflow-hidden area-content",
79
79
  children: /*#__PURE__*/jsxRuntime.jsx(date.RangePanel, {
80
80
  withTime: true,
81
81
  showHijriToggle: true,
@@ -101,7 +101,7 @@ var SuperDateTabs = function SuperDateTabs(_ref) {
101
101
  })]
102
102
  })
103
103
  });
104
- };
104
+ }
105
105
 
106
106
  /**
107
107
  * SuperDate component provides a date selection interface with quick, relative, and absolute date options.
@@ -128,9 +128,6 @@ var SuperDateTabs = function SuperDateTabs(_ref) {
128
128
  * - `$week|$now`: Represents the current week starting from the beginning of the week to now.
129
129
  * - `$month|$week`: Represents the current month starting from the beginning of the month to the end of current week.
130
130
  *
131
- * @param {SuperDateProps} props - The properties for the SuperDate component.
132
- * @returns {React.ReactElement} The rendered SuperDate component.
133
- *
134
131
  * @example
135
132
  * ```jsx
136
133
  * <SuperDate
@@ -146,10 +143,8 @@ var SuperDateTabs = function SuperDateTabs(_ref) {
146
143
  * data-testid="superdate"
147
144
  * />
148
145
  * ```
149
- *
150
- * @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/superdate-superdate--docs}
151
146
  */
152
- var SuperDate = function SuperDate(_ref4) {
147
+ function SuperDate(_ref4) {
153
148
  var _DateUtil$relativeLab;
154
149
  var _ref4$as = _ref4.as,
155
150
  as = _ref4$as === void 0 ? "button" : _ref4$as,
@@ -158,31 +153,29 @@ var SuperDate = function SuperDate(_ref4) {
158
153
  size = _ref4.size,
159
154
  variant = _ref4.variant,
160
155
  disabled = _ref4.disabled,
161
- fullWidth = _ref4.fullWidth,
162
156
  onChange = _ref4.onChange,
163
157
  value = _ref4.value,
164
158
  testValue = _ref4["data-test-value"],
165
159
  testId = _ref4["data-testid"],
166
160
  props = _objectWithoutProperties(_ref4, _excluded);
167
161
  var _useApplicationContex2 = core.useApplicationContext(),
168
- currentCalendar = _useApplicationContex2.currentCalendar,
169
- currentLocale = _useApplicationContex2.currentLocale;
162
+ currentCalendar = _useApplicationContex2.currentCalendar;
170
163
  var isHijri = react.useMemo(function () {
171
164
  return currentCalendar === "hijri";
172
165
  }, [currentCalendar]);
173
166
  var _useState5 = react.useState(),
174
167
  _useState6 = _slicedToArray(_useState5, 2),
175
168
  relValue = _useState6[0],
176
- setRelative = _useState6[1];
169
+ setRelValue = _useState6[1];
177
170
  react.useEffect(function () {
178
- setRelative(value);
171
+ setRelValue(value);
179
172
  }, [value]);
180
173
  var handleChange = react.useCallback(function (value) {
181
174
  var _parsed$3, _parsed$3$toISOString, _parsed$4, _parsed$4$toISOString;
182
175
  var parsed = date.DateUtil.parseRange(value);
183
- setRelative(value);
176
+ setRelValue(value);
184
177
  onChange === null || onChange === void 0 || onChange(value, [(_parsed$3 = parsed[0]) === null || _parsed$3 === void 0 || (_parsed$3$toISOString = _parsed$3.toISOString) === null || _parsed$3$toISOString === void 0 ? void 0 : _parsed$3$toISOString.call(_parsed$3), (_parsed$4 = parsed[1]) === null || _parsed$4 === void 0 || (_parsed$4$toISOString = _parsed$4.toISOString) === null || _parsed$4$toISOString === void 0 ? void 0 : _parsed$4$toISOString.call(_parsed$4)]);
185
- }, [isHijri, currentLocale]);
178
+ }, [onChange]);
186
179
  var E = as === "button" ? core.Button : core.Chip;
187
180
  return /*#__PURE__*/jsxRuntime.jsxs(core.Dropdown, {
188
181
  showArrow: true,
@@ -190,11 +183,14 @@ var SuperDate = function SuperDate(_ref4) {
190
183
  content: date.DateUtil.relativeTooltip(relValue, isHijri),
191
184
  children: /*#__PURE__*/jsxRuntime.jsx(E, {
192
185
  icon: "icon-[mdi--clock-outline]",
193
- size: size,
194
- color: color,
195
- disabled: disabled,
196
- fullWidth: fullWidth,
186
+ size: size
187
+ // @ts-expect-error ignore
188
+ ,
189
+ color: color
190
+ // @ts-expect-error ignore
191
+ ,
197
192
  variant: variant,
193
+ disabled: disabled,
198
194
  "data-test-value": testValue,
199
195
  "data-testid": testId,
200
196
  children: (_DateUtil$relativeLab = date.DateUtil.relativeLabel(relValue, isHijri)) !== null && _DateUtil$relativeLab !== void 0 ? _DateUtil$relativeLab : ""
@@ -204,7 +200,7 @@ var SuperDate = function SuperDate(_ref4) {
204
200
  onChange: handleChange
205
201
  }))]
206
202
  });
207
- };
203
+ }
208
204
 
209
205
  exports.SuperDate = SuperDate;
210
206
  exports.SuperDateTabs = SuperDateTabs;
package/dist/esm/index.js CHANGED
@@ -2,3 +2,33 @@
2
2
 
3
3
  import './i18n/index.js';
4
4
  export { SuperDate } from './superdate/Superdate.js';
5
+
6
+ /**
7
+ * React Fabric
8
+ * @version 1.0.0
9
+ * @license MIT
10
+ * @copyright 2024 Adarsh Pastakia
11
+ *
12
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ * of this software and associated documentation files (the "Software"), to deal
14
+ * in the Software without restriction, including without limitation the rights
15
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+ * copies of the Software, and to permit persons to whom the Software is
17
+ * furnished to do so, subject to the following conditions:
18
+ *
19
+ * The above copyright notice and this permission notice shall be included in all
20
+ * copies or substantial portions of the Software.
21
+ *
22
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
+ * SOFTWARE.
29
+ */
30
+
31
+ var SUPERDATE_PACKAGE = "@react-fabric/superdate";
32
+ var SUPERDATE_VERSION = "1.0.0";
33
+
34
+ export { SUPERDATE_PACKAGE, SUPERDATE_VERSION };
@@ -64,7 +64,7 @@ var schema = yup.object({
64
64
  part: yup.string().required().oneOf(Object.values(DatePart)).label("Date part")
65
65
  })
66
66
  });
67
- var QuickSelect = function QuickSelect(_ref) {
67
+ function QuickSelect(_ref) {
68
68
  var _ref$presets = _ref.presets,
69
69
  presets = _ref$presets === void 0 ? DEFAULT_PRESETS : _ref$presets,
70
70
  _ref$value = _ref.value,
@@ -78,11 +78,11 @@ var QuickSelect = function QuickSelect(_ref) {
78
78
  diff = _ref2$rel.diff,
79
79
  op = _ref2$rel.op;
80
80
  onChange("".concat(part).concat(op).concat(diff, "|").concat(DatePart.NOW));
81
- }, []);
81
+ }, [onChange]);
82
82
  var defaultValue = useMemo(function () {
83
83
  if (value !== null && value !== void 0 && value.endsWith(DatePart.NOW)) {
84
- var _value$split$shift$ma;
85
- var _ref3 = (_value$split$shift$ma = value.split("|").shift().match(/^(\$\w+)([+-])(\d+)?$/)) !== null && _value$split$shift$ma !== void 0 ? _value$split$shift$ma : [],
84
+ var _value$split$shift$ma, _value$split$shift;
85
+ var _ref3 = (_value$split$shift$ma = (_value$split$shift = value.split("|").shift()) === null || _value$split$shift === void 0 ? void 0 : _value$split$shift.match(/^(\$\w+)([+-])(\d+)?$/)) !== null && _value$split$shift$ma !== void 0 ? _value$split$shift$ma : [],
86
86
  _ref4 = _slicedToArray(_ref3, 4),
87
87
  part = _ref4[1],
88
88
  op = _ref4[2],
@@ -92,7 +92,7 @@ var QuickSelect = function QuickSelect(_ref) {
92
92
  rel: {
93
93
  part: part,
94
94
  op: op,
95
- diff: diff
95
+ diff: +diff
96
96
  }
97
97
  };
98
98
  }
@@ -131,6 +131,6 @@ var QuickSelect = function QuickSelect(_ref) {
131
131
  })
132
132
  })]
133
133
  });
134
- };
134
+ }
135
135
 
136
136
  export { QuickSelect };
@@ -29,7 +29,7 @@ import { jsxs, jsx } from 'react/jsx-runtime';
29
29
  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30
30
  */
31
31
 
32
- var RelativeInput = function RelativeInput(_ref) {
32
+ function RelativeInput(_ref) {
33
33
  var label = _ref.label,
34
34
  prefix = _ref.prefix,
35
35
  showApply = _ref.showApply;
@@ -50,7 +50,7 @@ var RelativeInput = function RelativeInput(_ref) {
50
50
  children: /*#__PURE__*/jsx(Select, {
51
51
  options: Object.values(DatePart).slice(1).map(function (dt) {
52
52
  return {
53
- id: dt,
53
+ value: dt,
54
54
  label: t("label.".concat(dt))
55
55
  };
56
56
  })
@@ -60,10 +60,10 @@ var RelativeInput = function RelativeInput(_ref) {
60
60
  children: /*#__PURE__*/jsx(Select, {
61
61
  width: "7rem",
62
62
  options: [{
63
- id: "-",
63
+ value: "-",
64
64
  label: t("label.-")
65
65
  }, {
66
- id: "+",
66
+ value: "+",
67
67
  label: t("label.+")
68
68
  }]
69
69
  })
@@ -76,6 +76,6 @@ var RelativeInput = function RelativeInput(_ref) {
76
76
  children: t("label.apply")
77
77
  })]
78
78
  });
79
- };
79
+ }
80
80
 
81
81
  export { RelativeInput };
@@ -23,7 +23,7 @@ var schema = yup.object({
23
23
  part: yup.string().required().oneOf(Object.values(DatePart)).label("Date part")
24
24
  })
25
25
  });
26
- var RelativePanel = function RelativePanel(_ref) {
26
+ function RelativePanel(_ref) {
27
27
  var _ref$value = _ref.value,
28
28
  value = _ref$value === void 0 ? "" : _ref$value,
29
29
  onChange = _ref.onChange;
@@ -32,18 +32,18 @@ var RelativePanel = function RelativePanel(_ref) {
32
32
  var handleChange = useCallback(function (_ref2) {
33
33
  var to = _ref2.to,
34
34
  from = _ref2.from;
35
- onChange("".concat(from.part).concat(from.op).concat(from.diff, "|").concat(to.part).concat(to.op).concat(to.diff));
36
- }, []);
35
+ onChange === null || onChange === void 0 || onChange("".concat(from.part).concat(from.op).concat(from.diff, "|").concat(to.part).concat(to.op).concat(to.diff));
36
+ }, [onChange]);
37
37
  var defaultValue = useMemo(function () {
38
- if (value !== null && value !== void 0 && value.match(/^(\$\w+)([+-])(\d+)?\|(\$\w+)([+-])(\d+)?$/)) {
39
- var _value$split$shift$ma, _value$split$pop$matc;
40
- var _ref3 = (_value$split$shift$ma = value.split("|").shift().match(/^(\$\w+)([+-])(\d+)?$/)) !== null && _value$split$shift$ma !== void 0 ? _value$split$shift$ma : [],
38
+ if (value.match(/^(\$\w+)([+-])(\d+)?\|(\$\w+)([+-])(\d+)?$/)) {
39
+ var _value$split$shift$ma, _value$split$shift, _value$split$pop$matc, _value$split$pop;
40
+ var _ref3 = (_value$split$shift$ma = (_value$split$shift = value.split("|").shift()) === null || _value$split$shift === void 0 ? void 0 : _value$split$shift.match(/^(\$\w+)([+-])(\d+)?$/)) !== null && _value$split$shift$ma !== void 0 ? _value$split$shift$ma : [],
41
41
  _ref4 = _slicedToArray(_ref3, 4),
42
42
  part = _ref4[1],
43
43
  op = _ref4[2],
44
44
  _ref4$ = _ref4[3],
45
45
  diff = _ref4$ === void 0 ? "0" : _ref4$;
46
- var _ref5 = (_value$split$pop$matc = value.split("|").pop().match(/^(\$\w+)([+-])(\d+)?$/)) !== null && _value$split$pop$matc !== void 0 ? _value$split$pop$matc : [],
46
+ var _ref5 = (_value$split$pop$matc = (_value$split$pop = value.split("|").pop()) === null || _value$split$pop === void 0 ? void 0 : _value$split$pop.match(/^(\$\w+)([+-])(\d+)?$/)) !== null && _value$split$pop$matc !== void 0 ? _value$split$pop$matc : [],
47
47
  _ref6 = _slicedToArray(_ref5, 4),
48
48
  toPart = _ref6[1],
49
49
  toOp = _ref6[2],
@@ -53,12 +53,12 @@ var RelativePanel = function RelativePanel(_ref) {
53
53
  from: {
54
54
  part: part,
55
55
  op: op,
56
- diff: diff
56
+ diff: +diff
57
57
  },
58
58
  to: {
59
59
  part: toPart,
60
60
  op: toOp,
61
- diff: toDiff
61
+ diff: +toDiff
62
62
  }
63
63
  };
64
64
  }
@@ -90,6 +90,6 @@ var RelativePanel = function RelativePanel(_ref) {
90
90
  })
91
91
  })
92
92
  });
93
- };
93
+ }
94
94
 
95
95
  export { RelativePanel };