@progress/kendo-react-dateinputs 9.0.0-develop.1 → 9.0.0-develop.3

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.
@@ -17,13 +17,7 @@ const a = (e) => {
17
17
  };
18
18
  }, l = (e) => {
19
19
  const { dateInput: t, ...o } = e, r = a(t);
20
- return /* @__PURE__ */ n.createElement(
21
- s,
22
- {
23
- ...o,
24
- ...r
25
- }
26
- );
20
+ return /* @__PURE__ */ n.createElement(s, { ...o, ...r });
27
21
  };
28
22
  export {
29
23
  l as PickerFloatingLabel,
package/index.d.mts CHANGED
@@ -1176,7 +1176,7 @@ export declare interface DatePickerOpenEvent {
1176
1176
  /**
1177
1177
  * Represents the props of the [KendoReact DatePicker component]({% slug overview_datepicker %}).
1178
1178
  */
1179
- export declare interface DatePickerProps extends DatePickerSettings, FormComponentProps, Omit<(React_2.HTMLAttributes<HTMLElement>), 'defaultValue' | 'onChange' | 'onBlur' | 'onFocus' | 'placeholder'> {
1179
+ export declare interface DatePickerProps extends DatePickerSettings, FormComponentProps, Omit<React_2.HTMLAttributes<HTMLElement>, 'defaultValue' | 'onChange' | 'onBlur' | 'onFocus' | 'placeholder'> {
1180
1180
  /**
1181
1181
  * Sets the default value of the DatePicker ([see example]({% slug default_value_datepicker %})).
1182
1182
  */
@@ -1939,6 +1939,9 @@ export declare class DateRangePickerWithoutContext extends React_2.Component<Dat
1939
1939
  disabled: PropTypes.Requireable<boolean>;
1940
1940
  spinners: PropTypes.Requireable<boolean>;
1941
1941
  name: PropTypes.Requireable<string>;
1942
+ /**
1943
+ * @hidden
1944
+ */
1942
1945
  dir: PropTypes.Requireable<string>;
1943
1946
  label: PropTypes.Requireable<string>;
1944
1947
  id: PropTypes.Requireable<string>;
package/index.d.ts CHANGED
@@ -1176,7 +1176,7 @@ export declare interface DatePickerOpenEvent {
1176
1176
  /**
1177
1177
  * Represents the props of the [KendoReact DatePicker component]({% slug overview_datepicker %}).
1178
1178
  */
1179
- export declare interface DatePickerProps extends DatePickerSettings, FormComponentProps, Omit<(React_2.HTMLAttributes<HTMLElement>), 'defaultValue' | 'onChange' | 'onBlur' | 'onFocus' | 'placeholder'> {
1179
+ export declare interface DatePickerProps extends DatePickerSettings, FormComponentProps, Omit<React_2.HTMLAttributes<HTMLElement>, 'defaultValue' | 'onChange' | 'onBlur' | 'onFocus' | 'placeholder'> {
1180
1180
  /**
1181
1181
  * Sets the default value of the DatePicker ([see example]({% slug default_value_datepicker %})).
1182
1182
  */
@@ -1939,6 +1939,9 @@ export declare class DateRangePickerWithoutContext extends React_2.Component<Dat
1939
1939
  disabled: PropTypes.Requireable<boolean>;
1940
1940
  spinners: PropTypes.Requireable<boolean>;
1941
1941
  name: PropTypes.Requireable<string>;
1942
+ /**
1943
+ * @hidden
1944
+ */
1942
1945
  dir: PropTypes.Requireable<string>;
1943
1946
  label: PropTypes.Requireable<string>;
1944
1947
  id: PropTypes.Requireable<string>;
@@ -10,7 +10,7 @@ const e = {
10
10
  name: "@progress/kendo-react-dateinputs",
11
11
  productName: "KendoReact",
12
12
  productCodes: ["KENDOUIREACT", "KENDOUICOMPLETE"],
13
- publishDate: 1729154335,
13
+ publishDate: 1729494654,
14
14
  version: "",
15
15
  licensingDocsUrl: "https://www.telerik.com/kendo-react-ui/components/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning"
16
16
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@progress/kendo-react-dateinputs",
3
- "version": "9.0.0-develop.1",
3
+ "version": "9.0.0-develop.3",
4
4
  "description": "React DateInput is a perfect input component for handling quick and efficient date values. KendoReact Date Inputs package",
5
5
  "author": "Progress",
6
6
  "license": "SEE LICENSE IN LICENSE.md",
@@ -24,12 +24,12 @@
24
24
  "peerDependencies": {
25
25
  "@progress/kendo-date-math": "^1.4.0",
26
26
  "@progress/kendo-licensing": "^1.3.4",
27
- "@progress/kendo-react-buttons": "9.0.0-develop.1",
28
- "@progress/kendo-react-common": "9.0.0-develop.1",
29
- "@progress/kendo-react-intl": "9.0.0-develop.1",
30
- "@progress/kendo-react-labels": "9.0.0-develop.1",
31
- "@progress/kendo-react-layout": "9.0.0-develop.1",
32
- "@progress/kendo-react-popup": "9.0.0-develop.1",
27
+ "@progress/kendo-react-buttons": "9.0.0-develop.3",
28
+ "@progress/kendo-react-common": "9.0.0-develop.3",
29
+ "@progress/kendo-react-intl": "9.0.0-develop.3",
30
+ "@progress/kendo-react-labels": "9.0.0-develop.3",
31
+ "@progress/kendo-react-layout": "9.0.0-develop.3",
32
+ "@progress/kendo-react-popup": "9.0.0-develop.3",
33
33
  "@progress/kendo-svg-icons": "^3.0.0",
34
34
  "react": "^16.8.2 || ^17.0.0 || ^18.0.0",
35
35
  "react-dom": "^16.8.2 || ^17.0.0 || ^18.0.0"
@@ -47,7 +47,11 @@ const F = 2, S = 0.05, N = 100, k = 0, T = 9, B = {
47
47
  this.dom.didCalculate && (this.itemHeight = this.dom.itemHeight, this.listHeight = this.dom.timeListHeight, this.topOffset = (this.listHeight - this.itemHeight) / 2, this.bottomOffset = this.listHeight - this.itemHeight, this.props.mobileMode && (this.topOffset += T, this.bottomOffset += T * 2), this.topThreshold = this.itemHeight * S, this.bottomThreshold = this.itemHeight * (1 - S));
48
48
  }, this.configureServices = ({ min: t, max: s, value: e } = this.props) => {
49
49
  if (this.service) {
50
- const [o, l] = this.service.limitRange(t || this.min, s || this.max, e || this.props.value);
50
+ const [o, l] = this.service.limitRange(
51
+ t || this.min,
52
+ s || this.max,
53
+ e || this.props.value
54
+ );
51
55
  this.service.configure(this.serviceSettings({ min: o, max: l }));
52
56
  }
53
57
  }, this.serviceSettings = (t) => {
@@ -82,10 +86,7 @@ const F = 2, S = 0.05, N = 100, k = 0, T = 9, B = {
82
86
  return;
83
87
  const { keyCode: s } = t;
84
88
  (s === c.down || s === c.up || s === c.end || s === c.home) && t.preventDefault();
85
- const o = (B[t.keyCode] || H)(
86
- this.service.data(this.props.value),
87
- this.service.selectedIndex(this.props.value)
88
- );
89
+ const o = (B[t.keyCode] || H)(this.service.data(this.props.value), this.service.selectedIndex(this.props.value));
89
90
  o && this.handleChange(o);
90
91
  }, this.handleChange = _((t) => {
91
92
  if (!this.service)
@@ -148,9 +149,17 @@ const F = 2, S = 0.05, N = 100, k = 0, T = 9, B = {
148
149
  style: { transform: l, msTransform: l },
149
150
  className: u(a.ul({ c: e }))
150
151
  },
151
- o.map((p, b) => /* @__PURE__ */ n.createElement("li", { key: b, className: u(a.li({ c: e })), onClick: () => {
152
- this.handleChange(p);
153
- } }, /* @__PURE__ */ n.createElement("span", null, p.text)))
152
+ o.map((p, b) => /* @__PURE__ */ n.createElement(
153
+ "li",
154
+ {
155
+ key: b,
156
+ className: u(a.li({ c: e })),
157
+ onClick: () => {
158
+ this.handleChange(p);
159
+ }
160
+ },
161
+ /* @__PURE__ */ n.createElement("span", null, p.text)
162
+ ))
154
163
  ), /* @__PURE__ */ n.createElement("div", { className: u(a.scrollablePlaceholder({ c: e })) }));
155
164
  return /* @__PURE__ */ n.createElement(
156
165
  "div",
@@ -189,10 +198,16 @@ const F = 2, S = 0.05, N = 100, k = 0, T = 9, B = {
189
198
  total: d,
190
199
  unstyled: s
191
200
  }
192
- ) : /* @__PURE__ */ n.createElement("div", { className: u(
193
- a.containerSelector({ c: e }),
194
- a.container({ c: e, content: !0, scrollable: !0 })
195
- ) }, v)
201
+ ) : /* @__PURE__ */ n.createElement(
202
+ "div",
203
+ {
204
+ className: u(
205
+ a.containerSelector({ c: e }),
206
+ a.container({ c: e, content: !0, scrollable: !0 })
207
+ )
208
+ },
209
+ v
210
+ )
196
211
  );
197
212
  }
198
213
  };
@@ -17,7 +17,9 @@ import { MIN_TIME as A, MAX_TIME as K, MIDNIGHT_DATE as _ } from "../utils.mjs";
17
17
  import { TIME_PART as d } from "./models/TimePart.mjs";
18
18
  import { isInTimeRange as $, getNow as z, snapTime as N, generateSnappers as B, timeInRange as W } from "./utils.mjs";
19
19
  import { Button as j } from "@progress/kendo-react-buttons";
20
- const v = new RegExp(`${d.hour}|${d.minute}|${d.second}|${d.dayperiod}|literal`), a = class a extends n.Component {
20
+ const v = new RegExp(
21
+ `${d.hour}|${d.minute}|${d.second}|${d.dayperiod}|literal`
22
+ ), a = class a extends n.Component {
21
23
  constructor(i) {
22
24
  super(i), this._element = null, this._nowButton = null, this.dateFormatParts = [], this.timeLists = [], this.focus = (s, e) => {
23
25
  Promise.resolve().then(() => {
@@ -30,10 +32,12 @@ const v = new RegExp(`${d.hour}|${d.minute}|${d.second}|${d.dayperiod}|literal`)
30
32
  return r && r && s.type === "literal" ? v.test(r.type || "") : v.test(s.type || "");
31
33
  }, this.focusList = (s) => {
32
34
  this.timeLists.length && this.timeLists.reduce(this.listReducer, []).map((e) => s === 1 ? e.next : e.prev).map((e) => e && e.element && e.element.focus({ preventScroll: !0 }));
33
- }, this.listReducer = (s, e, o, r) => s.length || e.props.id !== this.state.activeListIndex ? s : [{
34
- next: r[o + 1] || e,
35
- prev: r[o - 1] || e
36
- }], this.showNowButton = () => !this.hasSteps() && this.props.nowButton && $(z(), this.min, this.max), this.handleKeyDown = (s) => {
35
+ }, this.listReducer = (s, e, o, r) => s.length || e.props.id !== this.state.activeListIndex ? s : [
36
+ {
37
+ next: r[o + 1] || e,
38
+ prev: r[o - 1] || e
39
+ }
40
+ ], this.showNowButton = () => !this.hasSteps() && this.props.nowButton && $(z(), this.min, this.max), this.handleKeyDown = (s) => {
37
41
  const { keyCode: e } = s;
38
42
  switch (e) {
39
43
  case T.left:
@@ -62,9 +66,7 @@ const v = new RegExp(`${d.hour}|${d.minute}|${d.second}|${d.dayperiod}|literal`)
62
66
  }, this.handleChange = (s) => {
63
67
  const { onChange: e } = this.props;
64
68
  e && e.call(void 0, s);
65
- }, this.snapTime = N(
66
- B(this.props.steps, this.props.min || a.defaultProps.min)
67
- ), this.state = {
69
+ }, this.snapTime = N(B(this.props.steps, this.props.min || a.defaultProps.min)), this.state = {
68
70
  activeListIndex: -1
69
71
  }, this.hasActiveButton = this.hasActiveButton.bind(this);
70
72
  }
@@ -75,11 +77,7 @@ const v = new RegExp(`${d.hour}|${d.minute}|${d.second}|${d.dayperiod}|literal`)
75
77
  return this._element;
76
78
  }
77
79
  get value() {
78
- return W(
79
- this.snapTime(O(this.props.value || _)),
80
- this.min,
81
- this.max
82
- );
80
+ return W(this.snapTime(O(this.props.value || _)), this.min, this.max);
83
81
  }
84
82
  get intl() {
85
83
  return k(this);
@@ -110,17 +108,7 @@ const v = new RegExp(`${d.hour}|${d.minute}|${d.second}|${d.dayperiod}|literal`)
110
108
  * @hidden
111
109
  */
112
110
  render() {
113
- const {
114
- format: i,
115
- smoothScroll: s,
116
- onNowClick: e,
117
- className: o,
118
- disabled: r,
119
- mobileMode: w,
120
- show: D,
121
- onNowKeyDown: E,
122
- unstyled: g
123
- } = this.props, m = g && g.uTime;
111
+ const { format: i, smoothScroll: s, onNowClick: e, className: o, disabled: r, mobileMode: w, show: D, onNowKeyDown: E, unstyled: g } = this.props, m = g && g.uTime;
124
112
  this.snapTime = N(B(this.steps, this.min)), this.dateFormatParts = this.intl.splitDateFormat(i || a.defaultProps.format).filter(this.timeFormatFilter);
125
113
  const F = l(
126
114
  h.part({
@@ -149,63 +137,55 @@ const v = new RegExp(`${d.hour}|${d.minute}|${d.second}|${d.dayperiod}|literal`)
149
137
  tabIndex: r ? -1 : 0
150
138
  },
151
139
  b.toLanguageString(I, x[I])
152
- )), /* @__PURE__ */ n.createElement(
140
+ )), /* @__PURE__ */ n.createElement("div", { className: l(h.listContainer({ c: m })), onKeyDown: this.handleKeyDown }, /* @__PURE__ */ n.createElement("span", { className: l(h.highlight({ c: m })) }), this.dateFormatParts.map((u, c) => u.type !== "literal" ? /* @__PURE__ */ n.createElement(
153
141
  "div",
154
142
  {
155
- className: l(h.listContainer({ c: m })),
156
- onKeyDown: this.handleKeyDown
143
+ key: c,
144
+ className: l(
145
+ h.listWrapper({
146
+ c: m,
147
+ focused: c === this.state.activeListIndex
148
+ })
149
+ ),
150
+ role: "presentation",
151
+ tabIndex: -1
157
152
  },
158
- /* @__PURE__ */ n.createElement("span", { className: l(h.highlight({ c: m })) }),
159
- this.dateFormatParts.map((u, c) => u.type !== "literal" ? /* @__PURE__ */ n.createElement(
160
- "div",
153
+ /* @__PURE__ */ n.createElement(
154
+ "span",
161
155
  {
162
- key: c,
163
- className: l(
164
- h.listWrapper({
165
- c: m,
166
- focused: c === this.state.activeListIndex
167
- })
168
- ),
169
- role: "presentation",
170
- tabIndex: -1
171
- },
172
- /* @__PURE__ */ n.createElement("span", { className: l(h.title({ c: m })), onMouseDown: (p) => {
173
- p.preventDefault();
174
- } }, this.intl.dateFieldName(u)),
175
- /* @__PURE__ */ n.createElement(
176
- P,
177
- {
178
- min: this.min,
179
- max: this.max,
180
- boundRange: this.boundRange,
181
- part: u,
182
- step: u.type ? this.steps[u.type] : 1,
183
- smoothScroll: s,
184
- ref: (p) => {
185
- p && this.timeLists.push(p);
186
- },
187
- id: c,
188
- onFocus: () => {
189
- this.handleListFocus(c);
190
- },
191
- onBlur: this.handleListBlur,
192
- onChange: this.handleChange,
193
- value: this.value,
194
- disabled: r,
195
- show: D,
196
- mobileMode: w,
197
- unstyled: g
156
+ className: l(h.title({ c: m })),
157
+ onMouseDown: (p) => {
158
+ p.preventDefault();
198
159
  }
199
- )
200
- ) : /* @__PURE__ */ n.createElement(
201
- "div",
202
- {
203
- key: c,
204
- className: l(h.separator({ c: m }))
205
160
  },
206
- u.pattern
207
- ))
208
- ));
161
+ this.intl.dateFieldName(u)
162
+ ),
163
+ /* @__PURE__ */ n.createElement(
164
+ P,
165
+ {
166
+ min: this.min,
167
+ max: this.max,
168
+ boundRange: this.boundRange,
169
+ part: u,
170
+ step: u.type ? this.steps[u.type] : 1,
171
+ smoothScroll: s,
172
+ ref: (p) => {
173
+ p && this.timeLists.push(p);
174
+ },
175
+ id: c,
176
+ onFocus: () => {
177
+ this.handleListFocus(c);
178
+ },
179
+ onBlur: this.handleListBlur,
180
+ onChange: this.handleChange,
181
+ value: this.value,
182
+ disabled: r,
183
+ show: D,
184
+ mobileMode: w,
185
+ unstyled: g
186
+ }
187
+ )
188
+ ) : /* @__PURE__ */ n.createElement("div", { key: c, className: l(h.separator({ c: m })) }, u.pattern))));
209
189
  }
210
190
  nextTick(i) {
211
191
  clearTimeout(this.nextTickId), this.nextTickId = window.setTimeout(() => i());
@@ -53,9 +53,7 @@ const n = class n extends a.Component {
53
53
  }
54
54
  );
55
55
  }, this.renderPopup = () => {
56
- const { popupClass: t, ...s } = this.popupSettings, { unstyled: o } = this.props, r = o && o.uTimePicker, h = c(
57
- t
58
- ), l = {
56
+ const { popupClass: t, ...s } = this.popupSettings, { unstyled: o } = this.props, r = o && o.uTimePicker, h = c(t), l = {
59
57
  popupClass: g.popup({ c: r }),
60
58
  show: this.show,
61
59
  animate: this.element !== null,
@@ -291,7 +289,10 @@ const n = class n extends a.Component {
291
289
  fillMode: null,
292
290
  rounded: null,
293
291
  readonly: this.mobileMode
294
- }, A = this.localizationService.toLanguageString(f, u[f]), N = this.localizationService.toLanguageString(C, u[C]), b = /* @__PURE__ */ a.createElement(
292
+ }, A = this.localizationService.toLanguageString(f, u[f]), N = this.localizationService.toLanguageString(
293
+ C,
294
+ u[C]
295
+ ), b = /* @__PURE__ */ a.createElement(
295
296
  H,
296
297
  {
297
298
  onFocus: this.handleFocus,
@@ -412,7 +413,12 @@ n.displayName = "TimePicker", n.propTypes = {
412
413
  })
413
414
  ]),
414
415
  formatPlaceholder: e.oneOfType([
415
- e.oneOf(["wide", "narrow", "short", "formatPattern"]),
416
+ e.oneOf([
417
+ "wide",
418
+ "narrow",
419
+ "short",
420
+ "formatPattern"
421
+ ]),
416
422
  e.shape({
417
423
  year: e.string,
418
424
  month: e.string,
@@ -5,4 +5,4 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const I=require("react"),e=require("prop-types"),g=require("@progress/kendo-date-math"),s=require("@progress/kendo-react-common"),f=require("@progress/kendo-react-intl"),r=require("../messages/index.js"),y=require("../utils.js"),m=require("./utils.js"),K=require("./TimePart.js"),O=require("@progress/kendo-react-buttons");function x(u){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(u){for(const t in u)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(u,t);Object.defineProperty(i,t,n.get?n:{enumerable:!0,get:()=>u[t]})}}return i.default=u,Object.freeze(i)}const l=x(I),c=class c extends l.Component{constructor(i){super(i),this._element=null,this._cancelButton=null,this._acceptButton=null,this.timePart=null,this.focusActiveList=()=>{this.timePart&&this.timePart.focus({preventScroll:!0})},this.handleKeyDown=t=>{const{keyCode:n}=t;switch(n){case s.Keys.enter:this.hasActiveButton()||this.handleAccept(t);return;default:return}},this.revertToNowButton=t=>{const{keyCode:n,shiftKey:o}=t;!o&&n===s.Keys.tab&&(t.preventDefault(),this.props.nowButton!==!1?this.timePart&&this.timePart.focus({preventScroll:!0},!0):this.timePart&&this.timePart.focus({preventScroll:!0}))},this.handleNowKeyDown=t=>{var p;const{keyCode:n,shiftKey:o}=t;o&&n===s.Keys.tab?(t.preventDefault(),this._acceptButton&&((p=this._acceptButton.element)==null||p.focus({preventScroll:!0}))):n===s.Keys.enter&&(t.stopPropagation(),this.handleNowClick(t))},this.handleAccept=t=>{const n=this.mergeValue(g.cloneDate(this.value||m.getNow()),this.timePart?this.timePart.value:this.current);this.setState({value:n}),this.valueDuringOnChange=n;const{onChange:o}=this.props;o&&o.call(void 0,{syntheticEvent:t,nativeEvent:t.nativeEvent,value:this.value,target:this}),this.valueDuringOnChange=void 0},this.handleReject=t=>{this.setState({current:this.value});const{onReject:n}=this.props;n&&n.call(void 0,t)},this.handleNowClick=t=>{const n=this.mergeValue(g.cloneDate(this.value||m.getNow()),m.getNow());this.setState({current:n,value:n}),this.valueDuringOnChange=n;const{onChange:o}=this.props;o&&o.call(void 0,{syntheticEvent:t,nativeEvent:t.nativeEvent,value:this.value,target:this}),this.valueDuringOnChange=void 0},this.handleChange=t=>{this.setState({current:t});const{handleTimeChange:n}=this.props;n&&n.call(void 0,{time:t})},this.dateFormatParts=this.intl.splitDateFormat(this.props.format||c.defaultProps.format),this.mergeValue=m.valueMerger(m.generateGetters(this.dateFormatParts)),this.hasActiveButton=this.hasActiveButton.bind(this),this.state={current:this.props.value||y.MIDNIGHT_DATE,value:this.props.value||c.defaultProps.value}}get element(){return this._element}get value(){const i=this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value;return i!==null?g.cloneDate(i):null}get intl(){return f.provideIntlService(this)}get current(){return this.state.current!==null?g.cloneDate(this.state.current):null}componentWillUnmount(){clearTimeout(this.nextTickId)}render(){const{format:i,cancelButton:t,disabled:n,tabIndex:o,className:p,smoothScroll:P,min:B,max:k,boundRange:N,nowButton:T,steps:S,show:_,mobileMode:C,unstyled:h}=this.props,E=h&&h.uTimePicker,v=h&&h.uTime,D=f.provideLocalizationService(this),b=D.toLanguageString(r.timePickerCancel,r.messages[r.timePickerCancel]),w=D.toLanguageString(r.timePickerSet,r.messages[r.timePickerSet]);return l.createElement("div",{ref:a=>{this._element=a},tabIndex:n?void 0:o||0,className:s.classNames(s.uTimePicker.timeSelector({c:E,mobileMode:C,disabled:n}),p),onKeyDown:this.handleKeyDown},l.createElement(K.TimePart,{ref:a=>{this.timePart=a},value:this.current,onChange:this.handleChange,onNowClick:this.handleNowClick,format:i,smoothScroll:P,min:B,max:k,boundRange:N,disabled:n,nowButton:T,steps:S,show:_,mobileMode:C,onNowKeyDown:this.handleNowKeyDown,unstyled:h}),this.props.footer&&l.createElement("div",{className:s.classNames(s.uTime.footer({c:v}))},t&&l.createElement(O.Button,{type:"button",ref:a=>{this._cancelButton=a},className:s.classNames(s.uTime.cancel({c:v})),onClick:this.handleReject,title:b,"aria-label":b},b),l.createElement(O.Button,{type:"button",ref:a=>{this._acceptButton=a},className:s.classNames(s.uTime.accept({c:v})),themeColor:"primary",onClick:this.handleAccept,onKeyDown:this.revertToNowButton,title:w,"aria-label":w},w)))}nextTick(i){clearTimeout(this.nextTickId),this.nextTickId=window.setTimeout(()=>i())}hasActiveButton(){if(!this._acceptButton||!this._acceptButton.element)return!1;const i=s.getActiveElement(document);return this._acceptButton&&i===this._acceptButton.element||this._cancelButton&&i===this._cancelButton.element}};c.propTypes={cancelButton:e.bool,className:e.string,disabled:e.bool,format:e.oneOfType([e.string,e.shape({skeleton:e.string,pattern:e.string,date:e.oneOf(["short","medium","long","full"]),time:e.oneOf(["short","medium","long","full"]),datetime:e.oneOf(["short","medium","long","full"]),era:e.oneOf(["narrow","short","long"]),year:e.oneOf(["numeric","2-digit"]),month:e.oneOf(["numeric","2-digit","narrow","short","long"]),day:e.oneOf(["numeric","2-digit"]),weekday:e.oneOf(["narrow","short","long"]),hour:e.oneOf(["numeric","2-digit"]),hour12:e.bool,minute:e.oneOf(["numeric","2-digit"]),second:e.oneOf(["numeric","2-digit"]),timeZoneName:e.oneOf(["short","long"])})]),max:e.instanceOf(Date),min:e.instanceOf(Date),nowButton:e.bool,steps:e.shape({hour:e.number,minute:e.number,second:e.number}),smoothScroll:e.bool,tabIndex:e.number,value:e.instanceOf(Date),show:e.bool},c.defaultProps={value:null,disabled:!1,cancelButton:!0,format:"t",min:y.MIN_TIME,max:y.MAX_TIME,boundRange:!1,footer:!0};let d=c;f.registerForIntl(d);f.registerForLocalization(d);exports.TimeSelector=d;
8
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const I=require("react"),e=require("prop-types"),g=require("@progress/kendo-date-math"),s=require("@progress/kendo-react-common"),f=require("@progress/kendo-react-intl"),l=require("../messages/index.js"),y=require("../utils.js"),m=require("./utils.js"),K=require("./TimePart.js"),O=require("@progress/kendo-react-buttons");function x(u){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(u){for(const t in u)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(u,t);Object.defineProperty(i,t,n.get?n:{enumerable:!0,get:()=>u[t]})}}return i.default=u,Object.freeze(i)}const a=x(I),c=class c extends a.Component{constructor(i){super(i),this._element=null,this._cancelButton=null,this._acceptButton=null,this.timePart=null,this.focusActiveList=()=>{this.timePart&&this.timePart.focus({preventScroll:!0})},this.handleKeyDown=t=>{const{keyCode:n}=t;switch(n){case s.Keys.enter:this.hasActiveButton()||this.handleAccept(t);return;default:return}},this.revertToNowButton=t=>{const{keyCode:n,shiftKey:o}=t;!o&&n===s.Keys.tab&&(t.preventDefault(),this.props.nowButton!==!1?this.timePart&&this.timePart.focus({preventScroll:!0},!0):this.timePart&&this.timePart.focus({preventScroll:!0}))},this.handleNowKeyDown=t=>{var p;const{keyCode:n,shiftKey:o}=t;o&&n===s.Keys.tab?(t.preventDefault(),this._acceptButton&&((p=this._acceptButton.element)==null||p.focus({preventScroll:!0}))):n===s.Keys.enter&&(t.stopPropagation(),this.handleNowClick(t))},this.handleAccept=t=>{const n=this.mergeValue(g.cloneDate(this.value||m.getNow()),this.timePart?this.timePart.value:this.current);this.setState({value:n}),this.valueDuringOnChange=n;const{onChange:o}=this.props;o&&o.call(void 0,{syntheticEvent:t,nativeEvent:t.nativeEvent,value:this.value,target:this}),this.valueDuringOnChange=void 0},this.handleReject=t=>{this.setState({current:this.value});const{onReject:n}=this.props;n&&n.call(void 0,t)},this.handleNowClick=t=>{const n=this.mergeValue(g.cloneDate(this.value||m.getNow()),m.getNow());this.setState({current:n,value:n}),this.valueDuringOnChange=n;const{onChange:o}=this.props;o&&o.call(void 0,{syntheticEvent:t,nativeEvent:t.nativeEvent,value:this.value,target:this}),this.valueDuringOnChange=void 0},this.handleChange=t=>{this.setState({current:t});const{handleTimeChange:n}=this.props;n&&n.call(void 0,{time:t})},this.dateFormatParts=this.intl.splitDateFormat(this.props.format||c.defaultProps.format),this.mergeValue=m.valueMerger(m.generateGetters(this.dateFormatParts)),this.hasActiveButton=this.hasActiveButton.bind(this),this.state={current:this.props.value||y.MIDNIGHT_DATE,value:this.props.value||c.defaultProps.value}}get element(){return this._element}get value(){const i=this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value;return i!==null?g.cloneDate(i):null}get intl(){return f.provideIntlService(this)}get current(){return this.state.current!==null?g.cloneDate(this.state.current):null}componentWillUnmount(){clearTimeout(this.nextTickId)}render(){const{format:i,cancelButton:t,disabled:n,tabIndex:o,className:p,smoothScroll:P,min:B,max:k,boundRange:N,nowButton:T,steps:S,show:E,mobileMode:C,unstyled:h}=this.props,_=h&&h.uTimePicker,v=h&&h.uTime,D=f.provideLocalizationService(this),b=D.toLanguageString(l.timePickerCancel,l.messages[l.timePickerCancel]),w=D.toLanguageString(l.timePickerSet,l.messages[l.timePickerSet]);return a.createElement(a.Fragment,null,a.createElement("div",{ref:r=>{this._element=r},tabIndex:n?void 0:o||0,className:s.classNames(s.uTimePicker.timeSelector({c:_,mobileMode:C,disabled:n}),p),onKeyDown:this.handleKeyDown},a.createElement(K.TimePart,{ref:r=>{this.timePart=r},value:this.current,onChange:this.handleChange,onNowClick:this.handleNowClick,format:i,smoothScroll:P,min:B,max:k,boundRange:N,disabled:n,nowButton:T,steps:S,show:E,mobileMode:C,onNowKeyDown:this.handleNowKeyDown,unstyled:h})),this.props.footer&&a.createElement("div",{className:s.classNames(s.uTime.footer({c:v}))},t&&a.createElement(O.Button,{type:"button",ref:r=>{this._cancelButton=r},className:s.classNames(s.uTime.cancel({c:v})),onClick:this.handleReject,title:b,"aria-label":b},b),a.createElement(O.Button,{type:"button",ref:r=>{this._acceptButton=r},className:s.classNames(s.uTime.accept({c:v})),themeColor:"primary",onClick:this.handleAccept,onKeyDown:this.revertToNowButton,title:w,"aria-label":w},w)))}nextTick(i){clearTimeout(this.nextTickId),this.nextTickId=window.setTimeout(()=>i())}hasActiveButton(){if(!this._acceptButton||!this._acceptButton.element)return!1;const i=s.getActiveElement(document);return this._acceptButton&&i===this._acceptButton.element||this._cancelButton&&i===this._cancelButton.element}};c.propTypes={cancelButton:e.bool,className:e.string,disabled:e.bool,format:e.oneOfType([e.string,e.shape({skeleton:e.string,pattern:e.string,date:e.oneOf(["short","medium","long","full"]),time:e.oneOf(["short","medium","long","full"]),datetime:e.oneOf(["short","medium","long","full"]),era:e.oneOf(["narrow","short","long"]),year:e.oneOf(["numeric","2-digit"]),month:e.oneOf(["numeric","2-digit","narrow","short","long"]),day:e.oneOf(["numeric","2-digit"]),weekday:e.oneOf(["narrow","short","long"]),hour:e.oneOf(["numeric","2-digit"]),hour12:e.bool,minute:e.oneOf(["numeric","2-digit"]),second:e.oneOf(["numeric","2-digit"]),timeZoneName:e.oneOf(["short","long"])})]),max:e.instanceOf(Date),min:e.instanceOf(Date),nowButton:e.bool,steps:e.shape({hour:e.number,minute:e.number,second:e.number}),smoothScroll:e.bool,tabIndex:e.number,value:e.instanceOf(Date),show:e.bool},c.defaultProps={value:null,disabled:!1,cancelButton:!0,format:"t",min:y.MIN_TIME,max:y.MAX_TIME,boundRange:!1,footer:!0};let d=c;f.registerForIntl(d);f.registerForLocalization(d);exports.TimeSelector=d;
@@ -6,17 +6,17 @@
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
8
  "use client";
9
- import * as a from "react";
9
+ import * as s from "react";
10
10
  import t from "prop-types";
11
11
  import { cloneDate as u } from "@progress/kendo-date-math";
12
- import { Keys as h, classNames as m, uTimePicker as x, uTime as g, getActiveElement as A } from "@progress/kendo-react-common";
13
- import { provideIntlService as K, provideLocalizationService as M, registerForIntl as R, registerForLocalization as F } from "@progress/kendo-react-intl";
12
+ import { Keys as h, classNames as m, uTimePicker as x, uTime as v, getActiveElement as A } from "@progress/kendo-react-common";
13
+ import { provideIntlService as K, provideLocalizationService as M, registerForIntl as F, registerForLocalization as R } from "@progress/kendo-react-intl";
14
14
  import { timePickerCancel as y, messages as B, timePickerSet as D } from "../messages/index.mjs";
15
15
  import { MIDNIGHT_DATE as L, MIN_TIME as j, MAX_TIME as z } from "../utils.mjs";
16
16
  import { getNow as w, valueMerger as V, generateGetters as G } from "./utils.mjs";
17
17
  import { TimePart as H } from "./TimePart.mjs";
18
18
  import { Button as O } from "@progress/kendo-react-buttons";
19
- const r = class r extends a.Component {
19
+ const r = class r extends s.Component {
20
20
  constructor(i) {
21
21
  super(i), this._element = null, this._cancelButton = null, this._acceptButton = null, this.timePart = null, this.focusActiveList = () => {
22
22
  this.timePart && this.timePart.focus({ preventScroll: !0 });
@@ -54,10 +54,7 @@ const r = class r extends a.Component {
54
54
  const { onReject: n } = this.props;
55
55
  n && n.call(void 0, e);
56
56
  }, this.handleNowClick = (e) => {
57
- const n = this.mergeValue(
58
- u(this.value || w()),
59
- w()
60
- );
57
+ const n = this.mergeValue(u(this.value || w()), w());
61
58
  this.setState({
62
59
  current: n,
63
60
  value: n
@@ -121,12 +118,12 @@ const r = class r extends a.Component {
121
118
  show: _,
122
119
  mobileMode: b,
123
120
  unstyled: l
124
- } = this.props, I = l && l.uTimePicker, d = l && l.uTime, C = M(this), f = C.toLanguageString(y, B[y]), v = C.toLanguageString(D, B[D]);
125
- return /* @__PURE__ */ a.createElement(
121
+ } = this.props, I = l && l.uTimePicker, d = l && l.uTime, C = M(this), f = C.toLanguageString(y, B[y]), g = C.toLanguageString(D, B[D]);
122
+ return /* @__PURE__ */ s.createElement(s.Fragment, null, /* @__PURE__ */ s.createElement(
126
123
  "div",
127
124
  {
128
- ref: (s) => {
129
- this._element = s;
125
+ ref: (a) => {
126
+ this._element = a;
130
127
  },
131
128
  tabIndex: n ? void 0 : o || 0,
132
129
  className: m(
@@ -139,11 +136,11 @@ const r = class r extends a.Component {
139
136
  ),
140
137
  onKeyDown: this.handleKeyDown
141
138
  },
142
- /* @__PURE__ */ a.createElement(
139
+ /* @__PURE__ */ s.createElement(
143
140
  H,
144
141
  {
145
- ref: (s) => {
146
- this.timePart = s;
142
+ ref: (a) => {
143
+ this.timePart = a;
147
144
  },
148
145
  value: this.current,
149
146
  onChange: this.handleChange,
@@ -161,37 +158,36 @@ const r = class r extends a.Component {
161
158
  onNowKeyDown: this.handleNowKeyDown,
162
159
  unstyled: l
163
160
  }
164
- ),
165
- this.props.footer && /* @__PURE__ */ a.createElement("div", { className: m(g.footer({ c: d })) }, e && /* @__PURE__ */ a.createElement(
166
- O,
167
- {
168
- type: "button",
169
- ref: (s) => {
170
- this._cancelButton = s;
171
- },
172
- className: m(g.cancel({ c: d })),
173
- onClick: this.handleReject,
174
- title: f,
175
- "aria-label": f
161
+ )
162
+ ), this.props.footer && /* @__PURE__ */ s.createElement("div", { className: m(v.footer({ c: d })) }, e && /* @__PURE__ */ s.createElement(
163
+ O,
164
+ {
165
+ type: "button",
166
+ ref: (a) => {
167
+ this._cancelButton = a;
176
168
  },
177
- f
178
- ), /* @__PURE__ */ a.createElement(
179
- O,
180
- {
181
- type: "button",
182
- ref: (s) => {
183
- this._acceptButton = s;
184
- },
185
- className: m(g.accept({ c: d })),
186
- themeColor: "primary",
187
- onClick: this.handleAccept,
188
- onKeyDown: this.revertToNowButton,
189
- title: v,
190
- "aria-label": v
169
+ className: m(v.cancel({ c: d })),
170
+ onClick: this.handleReject,
171
+ title: f,
172
+ "aria-label": f
173
+ },
174
+ f
175
+ ), /* @__PURE__ */ s.createElement(
176
+ O,
177
+ {
178
+ type: "button",
179
+ ref: (a) => {
180
+ this._acceptButton = a;
191
181
  },
192
- v
193
- ))
194
- );
182
+ className: m(v.accept({ c: d })),
183
+ themeColor: "primary",
184
+ onClick: this.handleAccept,
185
+ onKeyDown: this.revertToNowButton,
186
+ title: g,
187
+ "aria-label": g
188
+ },
189
+ g
190
+ )));
195
191
  }
196
192
  nextTick(i) {
197
193
  clearTimeout(this.nextTickId), this.nextTickId = window.setTimeout(() => i());
@@ -250,8 +246,8 @@ r.propTypes = {
250
246
  footer: !0
251
247
  };
252
248
  let p = r;
253
- R(p);
254
249
  F(p);
250
+ R(p);
255
251
  export {
256
252
  p as TimeSelector
257
253
  };
@@ -18,10 +18,13 @@ class y {
18
18
  calculateHeights(c, n) {
19
19
  if (!C)
20
20
  return;
21
- const t = n && n.uTime, o = s("div"), p = s("span"), u = s("ul"), h = s("li"), m = () => h("<span>02</span>", i(e.li({ c: t }))), d = () => u([m()], i(e.ul({ c: t }))), f = () => o([d()], i(
22
- e.containerSelector({ c: t }),
23
- e.container({ c: t, content: !0, scrollable: !0 })
24
- )), g = o(
21
+ const t = n && n.uTime, o = s("div"), p = s("span"), u = s("ul"), h = s("li"), m = () => h("<span>02</span>", i(e.li({ c: t }))), d = () => u([m()], i(e.ul({ c: t }))), f = () => o(
22
+ [d()],
23
+ i(
24
+ e.containerSelector({ c: t }),
25
+ e.container({ c: t, content: !0, scrollable: !0 })
26
+ )
27
+ ), g = o(
25
28
  [
26
29
  p("minute", i(e.title({ c: t }))),
27
30
  o([f()], i(e.list({ c: t })))
@@ -78,10 +78,7 @@ class H {
78
78
  }
79
79
  normalizedRange() {
80
80
  const t = this.min.getHours(), n = this.max.getHours();
81
- return [
82
- Math.min(t, n),
83
- Math.max(t, n)
84
- ];
81
+ return [Math.min(t, n), Math.max(t, n)];
85
82
  }
86
83
  }
87
84
  export {
@@ -38,29 +38,17 @@ const a = (e) => (t, r) => {
38
38
  }), F = (e, t, r) => {
39
39
  if (!e || !t || !r)
40
40
  return e;
41
- const {
42
- candidateValue: n,
43
- minValue: s,
44
- maxValue: o
45
- } = i(e, t, r);
41
+ const { candidateValue: n, minValue: s, maxValue: o } = i(e, t, r);
46
42
  return n < s ? u(e, t) : n > o ? u(e, r) : e;
47
43
  }, N = (e, t, r) => {
48
44
  if (!e || !t || !r)
49
45
  return !0;
50
- const {
51
- candidateValue: n,
52
- minValue: s,
53
- maxValue: o
54
- } = i(e, t, r);
46
+ const { candidateValue: n, minValue: s, maxValue: o } = i(e, t, r);
55
47
  return s <= n && n <= o;
56
48
  }, P = (e, t, r) => {
57
49
  if (e === null)
58
50
  return !0;
59
- const {
60
- candidateValue: n,
61
- minValue: s,
62
- maxValue: o
63
- } = i(e, t, r);
51
+ const { candidateValue: n, minValue: s, maxValue: o } = i(e, t, r);
64
52
  return s <= n && n <= o;
65
53
  }, v = (e, t) => {
66
54
  if (e === null || t === null)
@@ -5,4 +5,4 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("react"),s=require("prop-types"),f=require("@progress/kendo-react-common"),H=require("./services/ScrollerService.js");function P(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>r[t]})}}return e.default=r,Object.freeze(e)}const g=P(w),T=(r,e,t)=>Math.min(Math.abs(e-r),t),C=17,O=10,A={1:r=>e=>e+r,0:r=>e=>e-r},x={1:r=>e=>Math.min(e,r),0:r=>e=>Math.max(e,r)},I={1:r=>e=>e<r,0:r=>e=>e>r},a=class a extends g.Component{constructor(e){super(e),this.rowHeightService=null,this.scrollContainer=null,this.lastDirection=null,this.lastTotal=0,this.lastTake=0,this.animationInProgress=!1,this.restrictScroll=!1,this.scrollTo=t=>{const i=this.direction==="vertical"?"scrollTop":"scrollLeft";if(!this.scrollContainer)return;const o=this.scrollContainer[i];this.restrictScroll&&i==="scrollTop"&&(!Number.isInteger(o)||!Number.isInteger(t))&&Math.abs(o-t)<O||(this.scrollContainer[i]=t)},this.scrollToIndex=t=>{this.animationInProgress=!1,this.rowHeightService&&this.scrollTo(this.rowHeightService.offset(t))},this.animateToIndex=t=>{if(!this.rowHeightService||!window)return;window.cancelAnimationFrame(this.cancelAnimation);const i=this.rowHeightService.offset(t),o=this.getContainerScrollDirection(i);let{start:n,end:l}=this.scrollRange(i,o);if(n===l)return;const S=this.scrollStep(n,l),c=A[o](S),h=x[o](l),u=I[o](c(l)),m=p=>{this.animationInProgress=!0;const d=c(p);this.scrollTo(h(d)),u(d)?this.cancelAnimation=window.requestAnimationFrame(()=>{m(d)}):this.animationInProgress=!1};this.cancelAnimation=window.requestAnimationFrame(()=>{m(n)})},this.scrollToBottom=()=>{this.rowHeightService&&this.scrollTo(this.rowHeightService.totalHeight()+this.props.bottomOffset)},this.scrollStep=(t,i)=>{const o=this.props.scrollDuration||a.defaultProps.scrollDuration;return Math.abs(i-t)/(o/C)},this.scrollRange=(t,i)=>{const o=this.containerScrollPosition;if(parseInt(`${t}`,10)===parseInt(`${o}`,10))return{start:t,end:t};const n=this.containerMaxScroll(),l=i===0?1:-1,S=T(o,t,this.props.maxScrollDifference||0),c=Math.min(t,n);return{start:Math.min(Math.max(c+l*S,0),n),end:c}},this.containerMaxScroll=()=>this.containerScrollSize-this.containerOffsetSize,this.getContainerScrollDirection=t=>t<this.containerScrollPosition?0:1,this.initServices=(t=this.props)=>{const i=this.direction==="vertical"?t.itemHeight:t.itemWidth;i!==void 0&&(this.rowHeightService=new f.RowHeightService(t.total,i,0),this.scrollerService.create(this.rowHeightService,t.skip,t.take,t.total,t.topOffset,this.scrollOffsetSize,this.direction))},this.getContainerProperty=t=>this.scrollContainer?this.scrollContainer[t]:0,this.handleScroll=t=>{if(!this.scrollContainer||!this.rowHeightService)return;const i=t.target;this.scrollerService.onScroll({scrollLeft:i.scrollLeft,scrollTop:i.scrollTop,offsetHeight:i.offsetHeight,offsetWidth:i.offsetWidth});const o=this.rowHeightService.index(this.containerScrollPosition-this.props.topOffset),{onScrollAction:n}=this.props,l={index:o,target:i,scrollAction:this.scrollAction,pageAction:this.pageAction,animationInProgress:this.animationInProgress};this.props.onScroll&&this.props.onScroll.call(void 0,t),n&&n.call(void 0,l),this.scrollAction=void 0,this.pageAction=void 0},this.handleScrollAction=t=>{this.scrollAction=t},this.handlePageAction=t=>{this.pageAction=t},this.scrollerService=new H.ScrollerService(this.handleScrollAction,this.handlePageAction),this.restrictScroll=Number.parseFloat(g.version)>17}get element(){return this.scrollContainer}get containerOffsetSize(){return this.getContainerProperty(this.direction==="vertical"?"offsetHeight":"offsetWidth")}get containerScrollSize(){return this.getContainerProperty(this.direction==="vertical"?"scrollHeight":"scrollWidth")}get containerScrollPosition(){return this.getContainerProperty(this.direction==="vertical"?"scrollTop":"scrollLeft")}get direction(){return this.props.direction!==void 0?this.props.direction:a.defaultProps.direction}get scrollOffsetSize(){return this.props.scrollOffsetSize!==void 0?this.props.scrollOffsetSize:a.defaultProps.scrollOffsetSize}activeIndex(){return this.itemIndex(Math.ceil(this.containerScrollPosition))}itemIndex(e){return this.rowHeightService?this.rowHeightService.index(e):0}itemOffset(e){return this.rowHeightService?this.rowHeightService.offset(e):0}isIndexVisible(e){if(!this.rowHeightService)return!1;const t=this.containerScrollPosition,i=t+this.containerOffsetSize,o=this.rowHeightService.offset(e),n=o+this.rowHeightService.height(e);return o>=t&&n<=i}isListScrolled(e){return this.rowHeightService?this.containerScrollPosition!==this.rowHeightService.offset(e):!1}componentDidMount(){const{onMount:e}=this.props;e&&e.call(void 0,this)}render(){const{total:e,take:t,bottomOffset:i,className:o,tabIndex:n,role:l,children:S,unstyled:c}=this.props,h=c&&c.uCalendar;(this.lastTotal!==e||this.lastDirection!==this.direction||this.lastTake!==t)&&(this.initServices(),this.lastTotal=e,this.lastDirection=this.direction,this.lastTake=t);const u=`${(this.rowHeightService?this.rowHeightService.totalHeight():0)+i}`,m=this.direction==="vertical"?{height:`${u}px`}:{width:`${u}px`},p=f.classNames(f.uCalendar.scrollableSelector({c:h}),f.uCalendar.scrollable({c:h,horizontal:this.direction==="horizontal"}),o),d=f.classNames(f.uCalendar.scrollablePlaceholder({c:h,horizontal:this.direction==="horizontal"}));return g.createElement("div",{ref:b=>{this.scrollContainer=b},onScroll:this.handleScroll,className:p,tabIndex:n,role:l},S,g.createElement("div",{style:m,className:d}))}};a.propTypes={bottomOffset:s.number.isRequired,className:s.string,direction:s.oneOf(["horizontal","vertical"]),forceScroll:s.bool,itemHeight:s.number,itemWidth:s.number,maxScrollDifference:s.number,onScroll:s.func,onScrollAction:s.func,scrollDuration:s.number,scrollOffsetSize:s.number,skip:s.number.isRequired,tabIndex:s.number,take:s.number.isRequired,topOffset:s.number.isRequired,total:s.number.isRequired,role:s.string},a.defaultProps={direction:"vertical",forceScroll:!1,scrollOffsetSize:0,maxScrollDifference:100,scrollDuration:100};let v=a;exports.Virtualization=v;
8
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("react"),s=require("prop-types"),f=require("@progress/kendo-react-common"),H=require("./services/ScrollerService.js");function P(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>r[t]})}}return e.default=r,Object.freeze(e)}const g=P(w),T=(r,e,t)=>Math.min(Math.abs(e-r),t),C=17,O=10,A={1:r=>e=>e+r,0:r=>e=>e-r},x={1:r=>e=>Math.min(e,r),0:r=>e=>Math.max(e,r)},I={1:r=>e=>e<r,0:r=>e=>e>r},a=class a extends g.Component{constructor(e){super(e),this.rowHeightService=null,this.scrollContainer=null,this.lastDirection=null,this.lastTotal=0,this.lastTake=0,this.animationInProgress=!1,this.restrictScroll=!1,this.scrollTo=t=>{const i=this.direction==="vertical"?"scrollTop":"scrollLeft";if(!this.scrollContainer)return;const o=this.scrollContainer[i];this.restrictScroll&&i==="scrollTop"&&(!Number.isInteger(o)||!Number.isInteger(t))&&Math.abs(o-t)<O||(this.scrollContainer[i]=t)},this.scrollToIndex=t=>{this.animationInProgress=!1,this.rowHeightService&&this.scrollTo(this.rowHeightService.offset(t))},this.animateToIndex=t=>{if(!this.rowHeightService||!window)return;window.cancelAnimationFrame(this.cancelAnimation);const i=this.rowHeightService.offset(t),o=this.getContainerScrollDirection(i),{start:n,end:l}=this.scrollRange(i,o);if(n===l)return;const S=this.scrollStep(n,l),c=A[o](S),h=x[o](l),u=I[o](c(l)),m=p=>{this.animationInProgress=!0;const d=c(p);this.scrollTo(h(d)),u(d)?this.cancelAnimation=window.requestAnimationFrame(()=>{m(d)}):this.animationInProgress=!1};this.cancelAnimation=window.requestAnimationFrame(()=>{m(n)})},this.scrollToBottom=()=>{this.rowHeightService&&this.scrollTo(this.rowHeightService.totalHeight()+this.props.bottomOffset)},this.scrollStep=(t,i)=>{const o=this.props.scrollDuration||a.defaultProps.scrollDuration;return Math.abs(i-t)/(o/C)},this.scrollRange=(t,i)=>{const o=this.containerScrollPosition;if(parseInt(`${t}`,10)===parseInt(`${o}`,10))return{start:t,end:t};const n=this.containerMaxScroll(),l=i===0?1:-1,S=T(o,t,this.props.maxScrollDifference||0),c=Math.min(t,n);return{start:Math.min(Math.max(c+l*S,0),n),end:c}},this.containerMaxScroll=()=>this.containerScrollSize-this.containerOffsetSize,this.getContainerScrollDirection=t=>t<this.containerScrollPosition?0:1,this.initServices=(t=this.props)=>{const i=this.direction==="vertical"?t.itemHeight:t.itemWidth;i!==void 0&&(this.rowHeightService=new f.RowHeightService(t.total,i,0),this.scrollerService.create(this.rowHeightService,t.skip,t.take,t.total,t.topOffset,this.scrollOffsetSize,this.direction))},this.getContainerProperty=t=>this.scrollContainer?this.scrollContainer[t]:0,this.handleScroll=t=>{if(!this.scrollContainer||!this.rowHeightService)return;const i=t.target;this.scrollerService.onScroll({scrollLeft:i.scrollLeft,scrollTop:i.scrollTop,offsetHeight:i.offsetHeight,offsetWidth:i.offsetWidth});const o=this.rowHeightService.index(this.containerScrollPosition-this.props.topOffset),{onScrollAction:n}=this.props,l={index:o,target:i,scrollAction:this.scrollAction,pageAction:this.pageAction,animationInProgress:this.animationInProgress};this.props.onScroll&&this.props.onScroll.call(void 0,t),n&&n.call(void 0,l),this.scrollAction=void 0,this.pageAction=void 0},this.handleScrollAction=t=>{this.scrollAction=t},this.handlePageAction=t=>{this.pageAction=t},this.scrollerService=new H.ScrollerService(this.handleScrollAction,this.handlePageAction),this.restrictScroll=Number.parseFloat(g.version)>17}get element(){return this.scrollContainer}get containerOffsetSize(){return this.getContainerProperty(this.direction==="vertical"?"offsetHeight":"offsetWidth")}get containerScrollSize(){return this.getContainerProperty(this.direction==="vertical"?"scrollHeight":"scrollWidth")}get containerScrollPosition(){return this.getContainerProperty(this.direction==="vertical"?"scrollTop":"scrollLeft")}get direction(){return this.props.direction!==void 0?this.props.direction:a.defaultProps.direction}get scrollOffsetSize(){return this.props.scrollOffsetSize!==void 0?this.props.scrollOffsetSize:a.defaultProps.scrollOffsetSize}activeIndex(){return this.itemIndex(Math.ceil(this.containerScrollPosition))}itemIndex(e){return this.rowHeightService?this.rowHeightService.index(e):0}itemOffset(e){return this.rowHeightService?this.rowHeightService.offset(e):0}isIndexVisible(e){if(!this.rowHeightService)return!1;const t=this.containerScrollPosition,i=t+this.containerOffsetSize,o=this.rowHeightService.offset(e),n=o+this.rowHeightService.height(e);return o>=t&&n<=i}isListScrolled(e){return this.rowHeightService?this.containerScrollPosition!==this.rowHeightService.offset(e):!1}componentDidMount(){const{onMount:e}=this.props;e&&e.call(void 0,this)}render(){const{total:e,take:t,bottomOffset:i,className:o,tabIndex:n,role:l,children:S,unstyled:c}=this.props,h=c&&c.uCalendar;(this.lastTotal!==e||this.lastDirection!==this.direction||this.lastTake!==t)&&(this.initServices(),this.lastTotal=e,this.lastDirection=this.direction,this.lastTake=t);const u=`${(this.rowHeightService?this.rowHeightService.totalHeight():0)+i}`,m=this.direction==="vertical"?{height:`${u}px`}:{width:`${u}px`},p=f.classNames(f.uCalendar.scrollableSelector({c:h}),f.uCalendar.scrollable({c:h,horizontal:this.direction==="horizontal"}),o),d=f.classNames(f.uCalendar.scrollablePlaceholder({c:h,horizontal:this.direction==="horizontal"}));return g.createElement("div",{ref:b=>{this.scrollContainer=b},onScroll:this.handleScroll,className:p,tabIndex:n,role:l},S,g.createElement("div",{style:m,className:d}))}};a.propTypes={bottomOffset:s.number.isRequired,className:s.string,direction:s.oneOf(["horizontal","vertical"]),forceScroll:s.bool,itemHeight:s.number,itemWidth:s.number,maxScrollDifference:s.number,onScroll:s.func,onScrollAction:s.func,scrollDuration:s.number,scrollOffsetSize:s.number,skip:s.number.isRequired,tabIndex:s.number,take:s.number.isRequired,topOffset:s.number.isRequired,total:s.number.isRequired,role:s.string},a.defaultProps={direction:"vertical",forceScroll:!1,scrollOffsetSize:0,maxScrollDifference:100,scrollDuration:100};let v=a;exports.Virtualization=v;