@yeverlibs/ds 1.1.20 → 1.1.22

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.mjs CHANGED
@@ -10,7 +10,7 @@ import ReactDOM from 'react-dom';
10
10
  import Select from 'react-select';
11
11
  import { isValid, format, parse, startOfMonth, subMonths, endOfMonth, subDays, startOfDay, endOfDay, startOfWeek, endOfWeek, addDays, isWithinInterval, isSameDay, addMonths } from 'date-fns';
12
12
  import { ptBR } from 'date-fns/locale';
13
- import { useFormContext, Controller, useForm, FormProvider } from 'react-hook-form';
13
+ import { useFormContext, Controller, useForm, FormProvider, useWatch } from 'react-hook-form';
14
14
  import Link2 from 'next/link';
15
15
  import { AnimatePresence, motion } from 'framer-motion';
16
16
  import { toast } from 'sonner';
@@ -20,7 +20,6 @@ import { ResponsivePie } from '@nivo/pie';
20
20
  import Cookies from 'js-cookie';
21
21
  import currency from 'currency.js';
22
22
 
23
- // src/lib/utils.ts
24
23
  function cn(...inputs) {
25
24
  return twMerge(clsx(inputs));
26
25
  }
@@ -7136,6 +7135,7 @@ var TimeInput = ({
7136
7135
  return `${String(hours).padStart(2, "0")}:${String(mins).padStart(2, "0")}`;
7137
7136
  };
7138
7137
  const initialTime = formatMinutesToTime(defaultValue ?? 0);
7138
+ const value = useWatch({ name, defaultValue: initialTime });
7139
7139
  useEffect(() => {
7140
7140
  if (defaultValue !== void 0 && defaultValue !== null) {
7141
7141
  setValue(name, formatMinutesToTime(defaultValue));
@@ -7154,6 +7154,7 @@ var TimeInput = ({
7154
7154
  return formatMinutesToTime(totalMinutes);
7155
7155
  };
7156
7156
  const formatDescription = (time) => {
7157
+ if (!time) return "0 minutos";
7157
7158
  const [hours, minutes] = time.split(":").map(Number);
7158
7159
  const totalMinutes = hours * 60 + minutes;
7159
7160
  if (hours > 0) {
@@ -7166,23 +7167,23 @@ var TimeInput = ({
7166
7167
  label,
7167
7168
  tooltip ? /* @__PURE__ */ jsx(Tooltip, { text: tooltip }) : null
7168
7169
  ] }),
7169
- /* @__PURE__ */ jsx(
7170
- Controller,
7171
- {
7172
- name,
7173
- control,
7174
- defaultValue: initialTime,
7175
- render: ({ field }) => {
7176
- const handleIncrement = () => {
7177
- const newTime = adjustTime(field.value, step, maxTime);
7178
- setValue(name, newTime);
7179
- };
7180
- const handleDecrement = () => {
7181
- const newTime = adjustTime(field.value, -step, maxTime);
7182
- setValue(name, newTime);
7183
- };
7184
- return /* @__PURE__ */ jsxs("div", { className: "flex w-full items-center gap-8", children: [
7185
- /* @__PURE__ */ jsxs("div", { className: "flex w-fit items-center", children: [
7170
+ /* @__PURE__ */ jsxs("div", { className: "flex w-full items-center gap-8", children: [
7171
+ /* @__PURE__ */ jsx("div", { className: "flex w-fit items-center", children: /* @__PURE__ */ jsx(
7172
+ Controller,
7173
+ {
7174
+ name,
7175
+ control,
7176
+ defaultValue: initialTime,
7177
+ render: ({ field }) => {
7178
+ const handleIncrement = () => {
7179
+ const newTime = adjustTime(field.value, step, maxTime);
7180
+ setValue(name, newTime);
7181
+ };
7182
+ const handleDecrement = () => {
7183
+ const newTime = adjustTime(field.value, -step, maxTime);
7184
+ setValue(name, newTime);
7185
+ };
7186
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
7186
7187
  /* @__PURE__ */ jsx(
7187
7188
  "button",
7188
7189
  {
@@ -7228,16 +7229,16 @@ var TimeInput = ({
7228
7229
  ) })
7229
7230
  }
7230
7231
  )
7231
- ] }),
7232
- description && /* @__PURE__ */ jsxs(FeedbackBadge, { $variant: "default", children: [
7233
- "Enviado ",
7234
- formatDescription(field.value || "00:00"),
7235
- " ap\xF3s o abandono"
7236
- ] })
7237
- ] });
7232
+ ] });
7233
+ }
7238
7234
  }
7239
- }
7240
- )
7235
+ ) }),
7236
+ description && /* @__PURE__ */ jsxs(FeedbackBadge, { $variant: "default", children: [
7237
+ "Enviado ",
7238
+ formatDescription(value),
7239
+ " ap\xF3s o abandono"
7240
+ ] })
7241
+ ] })
7241
7242
  ] });
7242
7243
  };
7243
7244
  var formatTime = (time) => {