@ikatec/nebula-react 1.0.19 → 1.0.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -591,8 +591,9 @@ interface InputDatePickerSingleProps extends Omit<InputTextProps, 'onChange' | '
591
591
  numberOfMonths?: CalendarProps['numberOfMonths'];
592
592
  portal?: PopoverContentProps['portal'];
593
593
  placeholder?: string;
594
- className: InputTextProps['className'];
594
+ className?: string;
595
595
  disabledDates?: CalendarProps['disabled'];
596
+ onClean?: VoidFunction;
596
597
  }
597
598
  declare const dateIsAvailable: (inputDate?: Date | null, disabledDates?: InputDatePickerSingleProps["disabledDates"]) => boolean;
598
599
  declare const InputDatePickerSingle: ({ portal, placeholder, className, value, onChange, numberOfMonths, onClean, disabledDates, ...rest }: InputDatePickerSingleProps) => react_jsx_runtime.JSX.Element;
@@ -603,8 +604,9 @@ interface InputDateTimePickerSingleProps extends Omit<InputTextProps, 'onChange'
603
604
  numberOfMonths?: CalendarProps['numberOfMonths'];
604
605
  portal?: PopoverContentProps['portal'];
605
606
  placeholder?: string;
606
- className: InputTextProps['className'];
607
+ className?: string;
607
608
  disabledDates?: CalendarProps['disabled'];
609
+ onClean?: VoidFunction;
608
610
  }
609
611
  declare const InputDateTimePickerSingle: ({ portal, placeholder, className, value, onChange, numberOfMonths, onClean, disabledDates, ...rest }: InputDateTimePickerSingleProps) => react_jsx_runtime.JSX.Element;
610
612
 
package/dist/index.d.ts CHANGED
@@ -591,8 +591,9 @@ interface InputDatePickerSingleProps extends Omit<InputTextProps, 'onChange' | '
591
591
  numberOfMonths?: CalendarProps['numberOfMonths'];
592
592
  portal?: PopoverContentProps['portal'];
593
593
  placeholder?: string;
594
- className: InputTextProps['className'];
594
+ className?: string;
595
595
  disabledDates?: CalendarProps['disabled'];
596
+ onClean?: VoidFunction;
596
597
  }
597
598
  declare const dateIsAvailable: (inputDate?: Date | null, disabledDates?: InputDatePickerSingleProps["disabledDates"]) => boolean;
598
599
  declare const InputDatePickerSingle: ({ portal, placeholder, className, value, onChange, numberOfMonths, onClean, disabledDates, ...rest }: InputDatePickerSingleProps) => react_jsx_runtime.JSX.Element;
@@ -603,8 +604,9 @@ interface InputDateTimePickerSingleProps extends Omit<InputTextProps, 'onChange'
603
604
  numberOfMonths?: CalendarProps['numberOfMonths'];
604
605
  portal?: PopoverContentProps['portal'];
605
606
  placeholder?: string;
606
- className: InputTextProps['className'];
607
+ className?: string;
607
608
  disabledDates?: CalendarProps['disabled'];
609
+ onClean?: VoidFunction;
608
610
  }
609
611
  declare const InputDateTimePickerSingle: ({ portal, placeholder, className, value, onChange, numberOfMonths, onClean, disabledDates, ...rest }: InputDateTimePickerSingleProps) => react_jsx_runtime.JSX.Element;
610
612
 
package/dist/index.js CHANGED
@@ -27,6 +27,7 @@ var flags = require('react-phone-number-input/flags');
27
27
  var dateFns = require('date-fns');
28
28
  var reactDayPicker = require('react-day-picker');
29
29
  var locale = require('react-day-picker/locale');
30
+ var mask = require('@react-input/mask');
30
31
 
31
32
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
32
33
 
@@ -4056,6 +4057,11 @@ var InputDatePickerSingle = ({
4056
4057
  React8.useEffect(() => {
4057
4058
  if (innerDate) setMonth(innerDate);
4058
4059
  }, [innerDate]);
4060
+ const maskOptions = {
4061
+ mask: "__/__/____",
4062
+ replacement: { _: /\d/ }
4063
+ };
4064
+ const inputRef = mask.useMask(maskOptions);
4059
4065
  return /* @__PURE__ */ jsxRuntime.jsxs(Popover, { open: popoverIsOpen, onOpenChange: setPopoverIsOpen, children: [
4060
4066
  /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { className, asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
4061
4067
  "div",
@@ -4065,6 +4071,7 @@ var InputDatePickerSingle = ({
4065
4071
  children: /* @__PURE__ */ jsxRuntime.jsx(
4066
4072
  InputText,
4067
4073
  {
4074
+ ref: inputRef,
4068
4075
  placeholder,
4069
4076
  value,
4070
4077
  className,
@@ -4191,6 +4198,7 @@ var InputTime = React8.forwardRef(
4191
4198
  }
4192
4199
  );
4193
4200
  InputTime.displayName = "InputTime";
4201
+ var DATA_TIME_SEPARATOR = " - ";
4194
4202
  var InputDateTimePickerSingle = ({
4195
4203
  portal,
4196
4204
  placeholder,
@@ -4202,8 +4210,12 @@ var InputDateTimePickerSingle = ({
4202
4210
  disabledDates,
4203
4211
  ...rest
4204
4212
  }) => {
4205
- const [innerTimeValue, setInnerTimeValue] = React8.useState();
4206
- const formattedDateByLanguage = formatDateToSubmit(value ?? "");
4213
+ const [innerTimeValue, setInnerTimeValue] = React8.useState(
4214
+ value?.split?.(DATA_TIME_SEPARATOR)?.at?.(-1) ?? ""
4215
+ );
4216
+ const formattedDateByLanguage = formatDateToSubmit(
4217
+ value?.split(DATA_TIME_SEPARATOR)?.at(0) ?? ""
4218
+ );
4207
4219
  const [innerDate, setInnerDate] = React8.useState(
4208
4220
  formattedDateByLanguage ? new Date(formattedDateByLanguage) : void 0
4209
4221
  );
@@ -4217,8 +4229,7 @@ var InputDateTimePickerSingle = ({
4217
4229
  setMonth(/* @__PURE__ */ new Date());
4218
4230
  };
4219
4231
  const handleInnerInputChange = (text) => {
4220
- const dateSlice = text.substring(0, 11).trim();
4221
- let hourSlice = text.substring(11).trim();
4232
+ let [dateSlice = "", hourSlice = ""] = text.split(DATA_TIME_SEPARATOR);
4222
4233
  if (!text) {
4223
4234
  onChange?.(text);
4224
4235
  handleClearValue();
@@ -4292,6 +4303,11 @@ var InputDateTimePickerSingle = ({
4292
4303
  React8.useEffect(() => {
4293
4304
  if (innerDate) setMonth(innerDate);
4294
4305
  }, [innerDate]);
4306
+ const maskOptions = {
4307
+ mask: "__/__/____ - __:__",
4308
+ replacement: { _: /\d/ }
4309
+ };
4310
+ const inputRef = mask.useMask(maskOptions);
4295
4311
  return /* @__PURE__ */ jsxRuntime.jsxs(Popover, { open: popoverIsOpen, onOpenChange: setPopoverIsOpen, children: [
4296
4312
  /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { className, asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
4297
4313
  "div",
@@ -4301,6 +4317,7 @@ var InputDateTimePickerSingle = ({
4301
4317
  children: /* @__PURE__ */ jsxRuntime.jsx(
4302
4318
  InputText,
4303
4319
  {
4320
+ ref: inputRef,
4304
4321
  placeholder,
4305
4322
  value,
4306
4323
  className,
@@ -4326,7 +4343,6 @@ var InputDateTimePickerSingle = ({
4326
4343
  setPopoverIsOpen(true);
4327
4344
  }
4328
4345
  },
4329
- maxLength: 16,
4330
4346
  onClean: onClean ? () => {
4331
4347
  onClean();
4332
4348
  handleClearValue();
package/dist/index.mjs CHANGED
@@ -26,6 +26,7 @@ import flags from 'react-phone-number-input/flags';
26
26
  import { formatDate, isValid, addMonths, isSameDay, isBefore, isAfter } from 'date-fns';
27
27
  import { DayPicker } from 'react-day-picker';
28
28
  import { ptBR, enUS, es } from 'react-day-picker/locale';
29
+ import { useMask } from '@react-input/mask';
29
30
 
30
31
  // src/button.tsx
31
32
 
@@ -4016,6 +4017,11 @@ var InputDatePickerSingle = ({
4016
4017
  useEffect(() => {
4017
4018
  if (innerDate) setMonth(innerDate);
4018
4019
  }, [innerDate]);
4020
+ const maskOptions = {
4021
+ mask: "__/__/____",
4022
+ replacement: { _: /\d/ }
4023
+ };
4024
+ const inputRef = useMask(maskOptions);
4019
4025
  return /* @__PURE__ */ jsxs(Popover, { open: popoverIsOpen, onOpenChange: setPopoverIsOpen, children: [
4020
4026
  /* @__PURE__ */ jsx(PopoverTrigger, { className, asChild: true, children: /* @__PURE__ */ jsx(
4021
4027
  "div",
@@ -4025,6 +4031,7 @@ var InputDatePickerSingle = ({
4025
4031
  children: /* @__PURE__ */ jsx(
4026
4032
  InputText,
4027
4033
  {
4034
+ ref: inputRef,
4028
4035
  placeholder,
4029
4036
  value,
4030
4037
  className,
@@ -4151,6 +4158,7 @@ var InputTime = forwardRef(
4151
4158
  }
4152
4159
  );
4153
4160
  InputTime.displayName = "InputTime";
4161
+ var DATA_TIME_SEPARATOR = " - ";
4154
4162
  var InputDateTimePickerSingle = ({
4155
4163
  portal,
4156
4164
  placeholder,
@@ -4162,8 +4170,12 @@ var InputDateTimePickerSingle = ({
4162
4170
  disabledDates,
4163
4171
  ...rest
4164
4172
  }) => {
4165
- const [innerTimeValue, setInnerTimeValue] = useState();
4166
- const formattedDateByLanguage = formatDateToSubmit(value ?? "");
4173
+ const [innerTimeValue, setInnerTimeValue] = useState(
4174
+ value?.split?.(DATA_TIME_SEPARATOR)?.at?.(-1) ?? ""
4175
+ );
4176
+ const formattedDateByLanguage = formatDateToSubmit(
4177
+ value?.split(DATA_TIME_SEPARATOR)?.at(0) ?? ""
4178
+ );
4167
4179
  const [innerDate, setInnerDate] = useState(
4168
4180
  formattedDateByLanguage ? new Date(formattedDateByLanguage) : void 0
4169
4181
  );
@@ -4177,8 +4189,7 @@ var InputDateTimePickerSingle = ({
4177
4189
  setMonth(/* @__PURE__ */ new Date());
4178
4190
  };
4179
4191
  const handleInnerInputChange = (text) => {
4180
- const dateSlice = text.substring(0, 11).trim();
4181
- let hourSlice = text.substring(11).trim();
4192
+ let [dateSlice = "", hourSlice = ""] = text.split(DATA_TIME_SEPARATOR);
4182
4193
  if (!text) {
4183
4194
  onChange?.(text);
4184
4195
  handleClearValue();
@@ -4252,6 +4263,11 @@ var InputDateTimePickerSingle = ({
4252
4263
  useEffect(() => {
4253
4264
  if (innerDate) setMonth(innerDate);
4254
4265
  }, [innerDate]);
4266
+ const maskOptions = {
4267
+ mask: "__/__/____ - __:__",
4268
+ replacement: { _: /\d/ }
4269
+ };
4270
+ const inputRef = useMask(maskOptions);
4255
4271
  return /* @__PURE__ */ jsxs(Popover, { open: popoverIsOpen, onOpenChange: setPopoverIsOpen, children: [
4256
4272
  /* @__PURE__ */ jsx(PopoverTrigger, { className, asChild: true, children: /* @__PURE__ */ jsx(
4257
4273
  "div",
@@ -4261,6 +4277,7 @@ var InputDateTimePickerSingle = ({
4261
4277
  children: /* @__PURE__ */ jsx(
4262
4278
  InputText,
4263
4279
  {
4280
+ ref: inputRef,
4264
4281
  placeholder,
4265
4282
  value,
4266
4283
  className,
@@ -4286,7 +4303,6 @@ var InputDateTimePickerSingle = ({
4286
4303
  setPopoverIsOpen(true);
4287
4304
  }
4288
4305
  },
4289
- maxLength: 16,
4290
4306
  onClean: onClean ? () => {
4291
4307
  onClean();
4292
4308
  handleClearValue();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikatec/nebula-react",
3
- "version": "1.0.19",
3
+ "version": "1.0.20",
4
4
  "description": "React components",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -50,18 +50,20 @@
50
50
  "@radix-ui/react-tabs": "^1.1.12",
51
51
  "@radix-ui/react-toggle": "^1.1.8",
52
52
  "@radix-ui/react-tooltip": "^1.2.6",
53
+ "@react-input/mask": "^2.0.4",
53
54
  "class-variance-authority": "^0.7.1",
55
+ "date-fns": "^4.1.0",
54
56
  "react-day-picker": "^9.8.1",
55
57
  "react-phone-number-input": "^3.4.12",
56
58
  "react-select": "^5.10.1",
57
59
  "sonner": "^2.0.5",
58
- "tailwind-merge": "^2.6.0",
59
- "date-fns": "^4.1.0"
60
+ "tailwind-merge": "^2.6.0"
60
61
  },
61
62
  "peerDependencies": {
62
- "react": "^18.3.1",
63
- "react-dom": "18.3.1",
63
+ "@react-input/mask": "^2.0.4",
64
64
  "date-fns": "^4.1.0",
65
- "lucide-react": "^0.454.0"
65
+ "lucide-react": "^0.454.0",
66
+ "react": "^18.3.1",
67
+ "react-dom": "18.3.1"
66
68
  }
67
69
  }