@yeverlibs/ds 1.1.29 → 1.1.30
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 +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +20 -41
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19 -40
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -580,10 +580,9 @@ type CounterInputProps$2<T extends FieldValues = FieldValues> = {
|
|
|
580
580
|
id?: string
|
|
581
581
|
defaultValue?: string | number
|
|
582
582
|
name?: Path<T>
|
|
583
|
-
minValue?: number
|
|
584
583
|
} & React.InputHTMLAttributes<HTMLInputElement>
|
|
585
584
|
|
|
586
|
-
declare const Counter: <T extends FieldValues = FieldValues>({ label, hasDisabled, redeemablePoints, tooltip, full, type, wrapperClassName, methods, onChange, id,
|
|
585
|
+
declare const Counter: <T extends FieldValues = FieldValues>({ label, hasDisabled, redeemablePoints, tooltip, full, type, wrapperClassName, methods, onChange, id, ...rest }: CounterInputProps$2<T>) => react_jsx_runtime.JSX.Element;
|
|
587
586
|
|
|
588
587
|
type CurrencyInputProps<T extends FieldValues = FieldValues> = {
|
|
589
588
|
label?: string
|
|
@@ -663,6 +662,7 @@ declare const FormWrapper: <T extends FieldValues>({ children, onSubmit, default
|
|
|
663
662
|
|
|
664
663
|
type InputProps$1 = {
|
|
665
664
|
$charactersLimit?: number
|
|
665
|
+
$showCharactersLimit?: boolean
|
|
666
666
|
$iconName?: IconName
|
|
667
667
|
$labelText?: string
|
|
668
668
|
$iconDirection?: 'left' | 'right'
|
|
@@ -718,9 +718,9 @@ type SelectProps = {
|
|
|
718
718
|
label?: string
|
|
719
719
|
placeholder?: string
|
|
720
720
|
options: SelectOption[]
|
|
721
|
-
onSelect: (option: SelectOption) => void
|
|
721
|
+
onSelect: (option: SelectOption | null) => void
|
|
722
722
|
className?: string
|
|
723
|
-
value?: SelectOption
|
|
723
|
+
value?: SelectOption | null
|
|
724
724
|
tooltip?: string
|
|
725
725
|
isClearable?: boolean
|
|
726
726
|
}
|
|
@@ -794,10 +794,10 @@ type CounterInputProps$1 = {
|
|
|
794
794
|
form: UseFormReturn
|
|
795
795
|
} & React.InputHTMLAttributes<HTMLInputElement>
|
|
796
796
|
|
|
797
|
-
declare const TimerCounter: React.FC<CounterInputProps$1>;
|
|
798
|
-
|
|
799
797
|
declare const formatTime$1: (time: string | number) => string;
|
|
800
798
|
|
|
799
|
+
declare const TimerCounter: React.FC<CounterInputProps$1>;
|
|
800
|
+
|
|
801
801
|
type CounterInputProps = {
|
|
802
802
|
label?: string
|
|
803
803
|
tooltip?: string
|
package/dist/index.d.ts
CHANGED
|
@@ -580,10 +580,9 @@ type CounterInputProps$2<T extends FieldValues = FieldValues> = {
|
|
|
580
580
|
id?: string
|
|
581
581
|
defaultValue?: string | number
|
|
582
582
|
name?: Path<T>
|
|
583
|
-
minValue?: number
|
|
584
583
|
} & React.InputHTMLAttributes<HTMLInputElement>
|
|
585
584
|
|
|
586
|
-
declare const Counter: <T extends FieldValues = FieldValues>({ label, hasDisabled, redeemablePoints, tooltip, full, type, wrapperClassName, methods, onChange, id,
|
|
585
|
+
declare const Counter: <T extends FieldValues = FieldValues>({ label, hasDisabled, redeemablePoints, tooltip, full, type, wrapperClassName, methods, onChange, id, ...rest }: CounterInputProps$2<T>) => react_jsx_runtime.JSX.Element;
|
|
587
586
|
|
|
588
587
|
type CurrencyInputProps<T extends FieldValues = FieldValues> = {
|
|
589
588
|
label?: string
|
|
@@ -663,6 +662,7 @@ declare const FormWrapper: <T extends FieldValues>({ children, onSubmit, default
|
|
|
663
662
|
|
|
664
663
|
type InputProps$1 = {
|
|
665
664
|
$charactersLimit?: number
|
|
665
|
+
$showCharactersLimit?: boolean
|
|
666
666
|
$iconName?: IconName
|
|
667
667
|
$labelText?: string
|
|
668
668
|
$iconDirection?: 'left' | 'right'
|
|
@@ -718,9 +718,9 @@ type SelectProps = {
|
|
|
718
718
|
label?: string
|
|
719
719
|
placeholder?: string
|
|
720
720
|
options: SelectOption[]
|
|
721
|
-
onSelect: (option: SelectOption) => void
|
|
721
|
+
onSelect: (option: SelectOption | null) => void
|
|
722
722
|
className?: string
|
|
723
|
-
value?: SelectOption
|
|
723
|
+
value?: SelectOption | null
|
|
724
724
|
tooltip?: string
|
|
725
725
|
isClearable?: boolean
|
|
726
726
|
}
|
|
@@ -794,10 +794,10 @@ type CounterInputProps$1 = {
|
|
|
794
794
|
form: UseFormReturn
|
|
795
795
|
} & React.InputHTMLAttributes<HTMLInputElement>
|
|
796
796
|
|
|
797
|
-
declare const TimerCounter: React.FC<CounterInputProps$1>;
|
|
798
|
-
|
|
799
797
|
declare const formatTime$1: (time: string | number) => string;
|
|
800
798
|
|
|
799
|
+
declare const TimerCounter: React.FC<CounterInputProps$1>;
|
|
800
|
+
|
|
801
801
|
type CounterInputProps = {
|
|
802
802
|
label?: string
|
|
803
803
|
tooltip?: string
|
package/dist/index.js
CHANGED
|
@@ -8976,6 +8976,7 @@ var Input = React107.forwardRef(
|
|
|
8976
8976
|
$errorMessage,
|
|
8977
8977
|
type = "text",
|
|
8978
8978
|
$charactersLimit,
|
|
8979
|
+
$showCharactersLimit = true,
|
|
8979
8980
|
$description,
|
|
8980
8981
|
isNotProvided = false,
|
|
8981
8982
|
wrapperClassName,
|
|
@@ -9030,7 +9031,7 @@ var Input = React107.forwardRef(
|
|
|
9030
9031
|
]
|
|
9031
9032
|
}
|
|
9032
9033
|
),
|
|
9033
|
-
$charactersLimit && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-xs text-gray-600", children: [
|
|
9034
|
+
$charactersLimit && $showCharactersLimit && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-xs text-gray-600", children: [
|
|
9034
9035
|
value.length,
|
|
9035
9036
|
" de ",
|
|
9036
9037
|
$charactersLimit,
|
|
@@ -11319,27 +11320,24 @@ var Counter = ({
|
|
|
11319
11320
|
methods,
|
|
11320
11321
|
onChange,
|
|
11321
11322
|
id,
|
|
11322
|
-
minValue = 0,
|
|
11323
11323
|
...rest
|
|
11324
11324
|
}) => {
|
|
11325
11325
|
const form = reactHookForm.useForm();
|
|
11326
11326
|
const { setValue, getValues, control } = methods || form;
|
|
11327
11327
|
const fieldName = rest.name || "counter";
|
|
11328
|
-
const defaultValue = rest.defaultValue ?
|
|
11328
|
+
const defaultValue = rest.defaultValue ? Number(rest.defaultValue) : 0;
|
|
11329
11329
|
const handleIncrement = () => {
|
|
11330
11330
|
if (!hasDisabled) {
|
|
11331
|
-
const currentValue = getValues(fieldName);
|
|
11332
|
-
const
|
|
11333
|
-
const newValue = Math.max(numericValue, minValue) + 1;
|
|
11331
|
+
const currentValue = getValues(fieldName) || 0;
|
|
11332
|
+
const newValue = Number(currentValue) + 1;
|
|
11334
11333
|
setValue(fieldName, newValue);
|
|
11335
11334
|
onChange?.(newValue);
|
|
11336
11335
|
}
|
|
11337
11336
|
};
|
|
11338
11337
|
const handleDecrement = () => {
|
|
11339
11338
|
if (!hasDisabled) {
|
|
11340
|
-
const currentValue = getValues(fieldName);
|
|
11341
|
-
const
|
|
11342
|
-
const newValue = Math.max(numericValue, minValue) > minValue ? Math.max(numericValue, minValue) - 1 : minValue;
|
|
11339
|
+
const currentValue = getValues(fieldName) || 0;
|
|
11340
|
+
const newValue = Number(currentValue) > 0 ? Number(currentValue) - 1 : 0;
|
|
11343
11341
|
setValue(fieldName, newValue);
|
|
11344
11342
|
onChange?.(newValue);
|
|
11345
11343
|
}
|
|
@@ -11387,11 +11385,11 @@ var Counter = ({
|
|
|
11387
11385
|
...fieldWithoutDefaultValue,
|
|
11388
11386
|
id: fieldName,
|
|
11389
11387
|
type: "number",
|
|
11390
|
-
min:
|
|
11391
|
-
value: field.value
|
|
11388
|
+
min: 1,
|
|
11389
|
+
value: field.value || 1,
|
|
11392
11390
|
onChange: (e14) => {
|
|
11393
11391
|
const newValue = Number(e14.target.value);
|
|
11394
|
-
if (newValue >=
|
|
11392
|
+
if (newValue >= 0) {
|
|
11395
11393
|
field.onChange(newValue);
|
|
11396
11394
|
onChange?.(newValue);
|
|
11397
11395
|
}
|
|
@@ -11750,9 +11748,7 @@ var CustomSelect = ({
|
|
|
11750
11748
|
isClearable = true
|
|
11751
11749
|
}) => {
|
|
11752
11750
|
const handleChange = (option) => {
|
|
11753
|
-
|
|
11754
|
-
onSelect(option);
|
|
11755
|
-
}
|
|
11751
|
+
onSelect(option);
|
|
11756
11752
|
};
|
|
11757
11753
|
const formatOptionLabel = (option) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center", children: [
|
|
11758
11754
|
option.icon && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative mr-2 flex h-[24px] max-h-[24px] w-[24px] max-w-[24px] items-center justify-center rounded border border-gray-300", children: /* @__PURE__ */ jsxRuntime.jsx(Image3__default.default, { src: option.icon, alt: option.label, fill: true, className: "p-1", quality: 100 }) }),
|
|
@@ -12085,6 +12081,8 @@ var TimeInput = ({
|
|
|
12085
12081
|
] })
|
|
12086
12082
|
] });
|
|
12087
12083
|
};
|
|
12084
|
+
|
|
12085
|
+
// src/_design-system/helpers/formatTime.ts
|
|
12088
12086
|
var formatTime = (time2) => {
|
|
12089
12087
|
let timeInSeconds = 0;
|
|
12090
12088
|
if (typeof time2 === "string") {
|
|
@@ -12233,26 +12231,7 @@ var TimerCounter = ({
|
|
|
12233
12231
|
description && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-gray-700", children: description })
|
|
12234
12232
|
] });
|
|
12235
12233
|
};
|
|
12236
|
-
|
|
12237
|
-
// src/_design-system/helpers/formatTime.ts
|
|
12238
12234
|
var formatTime2 = (time2) => {
|
|
12239
|
-
let timeInSeconds = 0;
|
|
12240
|
-
if (typeof time2 === "string") {
|
|
12241
|
-
if (time2.includes(":")) {
|
|
12242
|
-
const [hours3, minutes3, seconds4] = time2.split(":").map(Number);
|
|
12243
|
-
timeInSeconds = hours3 * 3600 + minutes3 * 60 + seconds4;
|
|
12244
|
-
} else {
|
|
12245
|
-
timeInSeconds = parseInt(time2, 10) || 0;
|
|
12246
|
-
}
|
|
12247
|
-
} else {
|
|
12248
|
-
timeInSeconds = time2 || 0;
|
|
12249
|
-
}
|
|
12250
|
-
const hours2 = Math.floor(timeInSeconds / 3600);
|
|
12251
|
-
const minutes2 = Math.floor(timeInSeconds % 3600 / 60);
|
|
12252
|
-
const seconds3 = timeInSeconds % 60;
|
|
12253
|
-
return `${hours2.toString().padStart(2, "0")}:${minutes2.toString().padStart(2, "0")}:${seconds3.toString().padStart(2, "0")}`;
|
|
12254
|
-
};
|
|
12255
|
-
var formatTime3 = (time2) => {
|
|
12256
12235
|
let timeInSeconds = 0;
|
|
12257
12236
|
if (typeof time2 === "string") {
|
|
12258
12237
|
if (time2.includes(":")) {
|
|
@@ -12282,7 +12261,7 @@ var TimerCounterWithoutSeconds = ({
|
|
|
12282
12261
|
const fieldName = rest.name || "timer";
|
|
12283
12262
|
const { control, setValue, watch } = form;
|
|
12284
12263
|
const rawValue = watch(fieldName, defaultValue || "00:00");
|
|
12285
|
-
const displayValue = typeof rawValue === "number" ?
|
|
12264
|
+
const displayValue = typeof rawValue === "number" ? formatTime2(rawValue) : rawValue || "00:00";
|
|
12286
12265
|
const parseTime = (timeString) => {
|
|
12287
12266
|
if (!timeString) return 0;
|
|
12288
12267
|
const [hours2, minutes2] = timeString.split(":").map(Number);
|
|
@@ -12296,7 +12275,7 @@ var TimerCounterWithoutSeconds = ({
|
|
|
12296
12275
|
setValue(fieldName, "00:00", { shouldValidate: true, shouldDirty: true, shouldTouch: true });
|
|
12297
12276
|
return;
|
|
12298
12277
|
}
|
|
12299
|
-
setValue(fieldName,
|
|
12278
|
+
setValue(fieldName, formatTime2(newSeconds), { shouldValidate: true, shouldDirty: true, shouldTouch: true });
|
|
12300
12279
|
}
|
|
12301
12280
|
};
|
|
12302
12281
|
const handleDecrement = () => {
|
|
@@ -12304,7 +12283,7 @@ var TimerCounterWithoutSeconds = ({
|
|
|
12304
12283
|
const currentSeconds = parseTime(displayValue);
|
|
12305
12284
|
if (currentSeconds <= 0) return;
|
|
12306
12285
|
const newSeconds = Math.max(0, currentSeconds - 3600);
|
|
12307
|
-
setValue(fieldName,
|
|
12286
|
+
setValue(fieldName, formatTime2(newSeconds), { shouldValidate: true, shouldDirty: true, shouldTouch: true });
|
|
12308
12287
|
}
|
|
12309
12288
|
};
|
|
12310
12289
|
const handleChanges = (e14) => {
|
|
@@ -12436,8 +12415,8 @@ function FileUploadComponent({
|
|
|
12436
12415
|
const isImagePreview = React107.useCallback((preview) => {
|
|
12437
12416
|
if (!preview || typeof preview !== "string") return false;
|
|
12438
12417
|
if (preview.startsWith("data:image/")) return true;
|
|
12439
|
-
if (preview.startsWith("http") && preview.match(/\.(jpg|jpeg|png|gif|webp|svg|
|
|
12440
|
-
if (preview.match(/\.(jpg|jpeg|png|gif|webp|svg|
|
|
12418
|
+
if (preview.startsWith("http") && preview.match(/\.(jpg|jpeg|png|gif|webp|svg|bmp|tiff)/i)) return true;
|
|
12419
|
+
if (preview.match(/\.(jpg|jpeg|png|gif|webp|svg|bmp|tiff)$/i)) return true;
|
|
12441
12420
|
return false;
|
|
12442
12421
|
}, []);
|
|
12443
12422
|
React107.useEffect(() => {
|
|
@@ -26808,8 +26787,8 @@ exports.formatNumberToCurrency = formatNumberToCurrency;
|
|
|
26808
26787
|
exports.formatPhone = formatPhone;
|
|
26809
26788
|
exports.formatPostalCode = formatPostalCode;
|
|
26810
26789
|
exports.formatRawDigitsToCurrency = formatRawDigitsToCurrency;
|
|
26811
|
-
exports.formatTime =
|
|
26812
|
-
exports.formatTimeWithoutSeconds =
|
|
26790
|
+
exports.formatTime = formatTime;
|
|
26791
|
+
exports.formatTimeWithoutSeconds = formatTime2;
|
|
26813
26792
|
exports.getDates = getDates;
|
|
26814
26793
|
exports.handleFormSubmission = handleFormSubmission;
|
|
26815
26794
|
exports.iconList = iconList;
|