@lets-events/react 12.11.7 → 12.11.8

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,6 +1,6 @@
1
1
 
2
2
 
3
- > @lets-events/react@12.11.7 build
3
+ > @lets-events/react@12.11.8 build
4
4
  > tsup src/index.tsx --format esm,cjs --dts --external react
5
5
 
6
6
  CLI Building entry: src/index.tsx
@@ -10,12 +10,12 @@
10
10
  CLI Target: es6
11
11
  ESM Build start
12
12
  CJS Build start
13
- ESM dist/index.mjs 423.79 KB
14
- ESM ⚡️ Build success in 288ms
15
- CJS dist/index.js 439.94 KB
16
- CJS ⚡️ Build success in 289ms
13
+ CJS dist/index.js 440.27 KB
14
+ CJS ⚡️ Build success in 291ms
15
+ ESM dist/index.mjs 424.13 KB
16
+ ESM ⚡️ Build success in 292ms
17
17
  DTS Build start
18
- DTS ⚡️ Build success in 6480ms
18
+ DTS ⚡️ Build success in 6808ms
19
19
  DTS dist/index.d.mts 411.35 KB
20
20
  DTS dist/index.d.ts 411.35 KB
21
21
  ⠙
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @lets-events/react
2
2
 
3
+ ## 12.11.8
4
+
5
+ ### Patch Changes
6
+
7
+ - fix timePickers input quantity
8
+
3
9
  ## 12.11.7
4
10
 
5
11
  ### Patch Changes
package/dist/index.js CHANGED
@@ -9017,7 +9017,7 @@ var TimePickerButtonStyled = styled("button", {
9017
9017
  var TimePickerIconButton = styled(Button, {
9018
9018
  padding: "0 !important"
9019
9019
  });
9020
- var pad = (num) => String(num).padStart(2, "0");
9020
+ var pad = (num) => num < 10 ? `0${num}` : String(num);
9021
9021
  var parseTime = (value) => {
9022
9022
  if (!value) {
9023
9023
  return {
@@ -9162,9 +9162,10 @@ function TimePicker({
9162
9162
  pattern: "[0-9]*",
9163
9163
  type: "text",
9164
9164
  placeholder: "00",
9165
+ maxLength: 2,
9165
9166
  value: unit === "hours" ? rawHours : rawMinutes,
9166
9167
  onChange: (e) => {
9167
- const rawValue = e.target.value.replace(/\D/g, "");
9168
+ const rawValue = e.target.value.replace(/\D/g, "").slice(0, 2);
9168
9169
  if (unit === "hours") {
9169
9170
  setRawHours(rawValue);
9170
9171
  } else {
@@ -9186,9 +9187,16 @@ function TimePicker({
9186
9187
  }
9187
9188
  },
9188
9189
  onPaste: (e) => {
9189
- const paste = e.clipboardData.getData("Text");
9190
- if (!/^\d{1,2}$/.test(paste)) {
9190
+ const paste = e.clipboardData.getData("Text").replace(/\D/g, "").slice(0, 2);
9191
+ if (!paste) {
9191
9192
  e.preventDefault();
9193
+ return;
9194
+ }
9195
+ e.preventDefault();
9196
+ if (unit === "hours") {
9197
+ setRawHours(paste);
9198
+ } else {
9199
+ setRawMinutes(paste);
9192
9200
  }
9193
9201
  }
9194
9202
  }
package/dist/index.mjs CHANGED
@@ -8900,7 +8900,7 @@ var TimePickerButtonStyled = styled("button", {
8900
8900
  var TimePickerIconButton = styled(Button, {
8901
8901
  padding: "0 !important"
8902
8902
  });
8903
- var pad = (num) => String(num).padStart(2, "0");
8903
+ var pad = (num) => num < 10 ? `0${num}` : String(num);
8904
8904
  var parseTime = (value) => {
8905
8905
  if (!value) {
8906
8906
  return {
@@ -9045,9 +9045,10 @@ function TimePicker({
9045
9045
  pattern: "[0-9]*",
9046
9046
  type: "text",
9047
9047
  placeholder: "00",
9048
+ maxLength: 2,
9048
9049
  value: unit === "hours" ? rawHours : rawMinutes,
9049
9050
  onChange: (e) => {
9050
- const rawValue = e.target.value.replace(/\D/g, "");
9051
+ const rawValue = e.target.value.replace(/\D/g, "").slice(0, 2);
9051
9052
  if (unit === "hours") {
9052
9053
  setRawHours(rawValue);
9053
9054
  } else {
@@ -9069,9 +9070,16 @@ function TimePicker({
9069
9070
  }
9070
9071
  },
9071
9072
  onPaste: (e) => {
9072
- const paste = e.clipboardData.getData("Text");
9073
- if (!/^\d{1,2}$/.test(paste)) {
9073
+ const paste = e.clipboardData.getData("Text").replace(/\D/g, "").slice(0, 2);
9074
+ if (!paste) {
9074
9075
  e.preventDefault();
9076
+ return;
9077
+ }
9078
+ e.preventDefault();
9079
+ if (unit === "hours") {
9080
+ setRawHours(paste);
9081
+ } else {
9082
+ setRawMinutes(paste);
9075
9083
  }
9076
9084
  }
9077
9085
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lets-events/react",
3
- "version": "12.11.7",
3
+ "version": "12.11.8",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -133,7 +133,7 @@ export type TimePickerProps = {
133
133
  expand?: boolean;
134
134
  disabled?: boolean;
135
135
  };
136
- const pad = (num: number) => String(num).padStart(2, "0");
136
+ const pad = (num: number) => (num < 10 ? `0${num}` : String(num));
137
137
 
138
138
  const parseTime = (value?: string) => {
139
139
  if (!value) {
@@ -279,9 +279,10 @@ export function TimePicker({
279
279
  pattern="[0-9]*"
280
280
  type="text"
281
281
  placeholder="00"
282
+ maxLength={2}
282
283
  value={unit === "hours" ? rawHours : rawMinutes}
283
284
  onChange={(e) => {
284
- const rawValue = e.target.value.replace(/\D/g, "");
285
+ const rawValue = e.target.value.replace(/\D/g, "").slice(0, 2);
285
286
  if (unit === "hours") {
286
287
  setRawHours(rawValue);
287
288
  } else {
@@ -303,9 +304,19 @@ export function TimePicker({
303
304
  }
304
305
  }}
305
306
  onPaste={(e) => {
306
- const paste = e.clipboardData.getData("Text");
307
- if (!/^\d{1,2}$/.test(paste)) {
307
+ const paste = e.clipboardData
308
+ .getData("Text")
309
+ .replace(/\D/g, "")
310
+ .slice(0, 2);
311
+ if (!paste) {
308
312
  e.preventDefault();
313
+ return;
314
+ }
315
+ e.preventDefault();
316
+ if (unit === "hours") {
317
+ setRawHours(paste);
318
+ } else {
319
+ setRawMinutes(paste);
309
320
  }
310
321
  }}
311
322
  />