@yeverlibs/ds 1.1.21 → 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.js +28 -26
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +29 -27
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
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';
|
|
@@ -7135,6 +7135,7 @@ var TimeInput = ({
|
|
|
7135
7135
|
return `${String(hours).padStart(2, "0")}:${String(mins).padStart(2, "0")}`;
|
|
7136
7136
|
};
|
|
7137
7137
|
const initialTime = formatMinutesToTime(defaultValue ?? 0);
|
|
7138
|
+
const value = useWatch({ name, defaultValue: initialTime });
|
|
7138
7139
|
useEffect(() => {
|
|
7139
7140
|
if (defaultValue !== void 0 && defaultValue !== null) {
|
|
7140
7141
|
setValue(name, formatMinutesToTime(defaultValue));
|
|
@@ -7153,6 +7154,7 @@ var TimeInput = ({
|
|
|
7153
7154
|
return formatMinutesToTime(totalMinutes);
|
|
7154
7155
|
};
|
|
7155
7156
|
const formatDescription = (time) => {
|
|
7157
|
+
if (!time) return "0 minutos";
|
|
7156
7158
|
const [hours, minutes] = time.split(":").map(Number);
|
|
7157
7159
|
const totalMinutes = hours * 60 + minutes;
|
|
7158
7160
|
if (hours > 0) {
|
|
@@ -7165,23 +7167,23 @@ var TimeInput = ({
|
|
|
7165
7167
|
label,
|
|
7166
7168
|
tooltip ? /* @__PURE__ */ jsx(Tooltip, { text: tooltip }) : null
|
|
7167
7169
|
] }),
|
|
7168
|
-
/* @__PURE__ */
|
|
7169
|
-
|
|
7170
|
-
|
|
7171
|
-
|
|
7172
|
-
|
|
7173
|
-
|
|
7174
|
-
|
|
7175
|
-
|
|
7176
|
-
const
|
|
7177
|
-
|
|
7178
|
-
|
|
7179
|
-
|
|
7180
|
-
const
|
|
7181
|
-
|
|
7182
|
-
|
|
7183
|
-
|
|
7184
|
-
/* @__PURE__ */ jsxs(
|
|
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: [
|
|
7185
7187
|
/* @__PURE__ */ jsx(
|
|
7186
7188
|
"button",
|
|
7187
7189
|
{
|
|
@@ -7227,16 +7229,16 @@ var TimeInput = ({
|
|
|
7227
7229
|
) })
|
|
7228
7230
|
}
|
|
7229
7231
|
)
|
|
7230
|
-
] })
|
|
7231
|
-
|
|
7232
|
-
"Enviado ",
|
|
7233
|
-
formatDescription(field.value || "00:00"),
|
|
7234
|
-
" ap\xF3s o abandono"
|
|
7235
|
-
] })
|
|
7236
|
-
] });
|
|
7232
|
+
] });
|
|
7233
|
+
}
|
|
7237
7234
|
}
|
|
7238
|
-
}
|
|
7239
|
-
|
|
7235
|
+
) }),
|
|
7236
|
+
description && /* @__PURE__ */ jsxs(FeedbackBadge, { $variant: "default", children: [
|
|
7237
|
+
"Enviado ",
|
|
7238
|
+
formatDescription(value),
|
|
7239
|
+
" ap\xF3s o abandono"
|
|
7240
|
+
] })
|
|
7241
|
+
] })
|
|
7240
7242
|
] });
|
|
7241
7243
|
};
|
|
7242
7244
|
var formatTime = (time) => {
|