najm-kit 0.0.32 → 0.0.33
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 +5 -4
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -30,7 +30,7 @@ import { Toaster as Toaster$1 } from 'sonner';
|
|
|
30
30
|
export { toast } from 'sonner';
|
|
31
31
|
import { FormProvider, Controller, useFormContext, useForm, useFieldArray } from 'react-hook-form';
|
|
32
32
|
import { defaultStyles, FileIcon } from 'react-file-icon';
|
|
33
|
-
import { format } from 'date-fns';
|
|
33
|
+
import { format, parseISO } from 'date-fns';
|
|
34
34
|
import { HexColorPicker } from 'react-colorful';
|
|
35
35
|
import { converter, parse, formatHsl, formatRgb, formatHex } from 'culori';
|
|
36
36
|
import { PhoneInput as PhoneInput$1, defaultCountries } from 'react-international-phone';
|
|
@@ -6180,11 +6180,12 @@ var SwitchInput = ({ value, onChange, label = "", helper, className = "", varian
|
|
|
6180
6180
|
] });
|
|
6181
6181
|
var DateInput = ({ value, onChange, placeholder = "Pick a date", className = "", icon, showIcon = true, iconColor, variant = "default", status = "default", bordered, borderColor }) => {
|
|
6182
6182
|
const iconProps = getIconColorProps(iconColor, "h-4 w-4");
|
|
6183
|
-
const toDateString = (date) => date
|
|
6183
|
+
const toDateString = (date) => date ? format(date, "yyyy-MM-dd") : void 0;
|
|
6184
|
+
const toDate = (val) => typeof val === "string" ? parseISO(val) : val;
|
|
6184
6185
|
return /* @__PURE__ */ jsxs(BaseInput, { variant, status, bordered, borderColor, className, children: [
|
|
6185
6186
|
/* @__PURE__ */ jsxs(Popover, { children: [
|
|
6186
|
-
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx("div", { className: "w-full flex items-center cursor-pointer gap-2 justify-start text-left font-normal", children: /* @__PURE__ */ jsx(Label, { className: cn("cursor-pointer", value ? "text-foreground" : "text-muted-foreground"), children: value ? format(
|
|
6187
|
-
/* @__PURE__ */ jsx(PopoverContent, { className: "w-auto p-0", align: "start", children: /* @__PURE__ */ jsx(Calendar, { mode: "single", selected:
|
|
6187
|
+
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx("div", { className: "w-full flex items-center cursor-pointer gap-2 justify-start text-left font-normal", children: /* @__PURE__ */ jsx(Label, { className: cn("cursor-pointer", value ? "text-foreground" : "text-muted-foreground"), children: value ? format(toDate(value), "PPP") : placeholder }) }) }),
|
|
6188
|
+
/* @__PURE__ */ jsx(PopoverContent, { className: "w-auto p-0", align: "start", children: /* @__PURE__ */ jsx(Calendar, { mode: "single", selected: toDate(value), onSelect: (date) => onChange(toDateString(date)), captionLayout: "dropdown" }) })
|
|
6188
6189
|
] }),
|
|
6189
6190
|
!icon && showIcon && /* @__PURE__ */ jsx(Calendar$1, { className: iconProps.className, style: iconProps.style })
|
|
6190
6191
|
] });
|