najm-kit 0.0.32 → 0.0.34

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.
Files changed (2) hide show
  1. package/dist/index.mjs +25 -16
  2. 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';
@@ -5017,23 +5017,31 @@ function CompactCard({ icon, label, value, unit, iconColor, onClick, bordered, c
5017
5017
  onClick,
5018
5018
  bordered,
5019
5019
  className: cn(
5020
- !bordered && "border-0",
5021
- "bg-foreground/10 p-3 shadow-none",
5020
+ "group px-3 py-2.5 transition-colors",
5022
5021
  onClick && "cursor-pointer",
5023
5022
  className
5024
5023
  ),
5025
5024
  classNames: {
5026
5025
  root: classNames?.root,
5027
- content: "items-center justify-center"
5026
+ content: "flex-row items-center gap-2.5"
5028
5027
  },
5029
5028
  children: [
5030
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 mb-1", children: [
5031
- /* @__PURE__ */ jsx(NIcon, { icon, className: cn("w-4 h-4", iconColor ?? "text-primary", classNames?.icon) }),
5032
- /* @__PURE__ */ jsx("span", { className: cn("text-xs text-muted-foreground", classNames?.label), children: label })
5033
- ] }),
5034
- /* @__PURE__ */ jsxs("p", { className: cn("text-lg font-semibold text-foreground leading-none", classNames?.value), children: [
5035
- value,
5036
- unit ? ` ${unit}` : ""
5029
+ /* @__PURE__ */ jsx(
5030
+ "div",
5031
+ {
5032
+ className: cn(
5033
+ "flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary transition-colors group-hover:bg-primary/20",
5034
+ classNames?.icon
5035
+ ),
5036
+ children: /* @__PURE__ */ jsx(NIcon, { icon, className: cn("w-4 h-4", iconColor ?? "text-primary") })
5037
+ }
5038
+ ),
5039
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-0.5", children: [
5040
+ /* @__PURE__ */ jsx("p", { className: cn("truncate text-[11px] leading-none text-muted-foreground", classNames?.label), children: label }),
5041
+ /* @__PURE__ */ jsxs("p", { className: cn("truncate text-base font-semibold leading-tight text-foreground", classNames?.value), children: [
5042
+ value,
5043
+ unit ? ` ${unit}` : ""
5044
+ ] })
5037
5045
  ] })
5038
5046
  ]
5039
5047
  }
@@ -6180,11 +6188,12 @@ var SwitchInput = ({ value, onChange, label = "", helper, className = "", varian
6180
6188
  ] });
6181
6189
  var DateInput = ({ value, onChange, placeholder = "Pick a date", className = "", icon, showIcon = true, iconColor, variant = "default", status = "default", bordered, borderColor }) => {
6182
6190
  const iconProps = getIconColorProps(iconColor, "h-4 w-4");
6183
- const toDateString = (date) => date?.toISOString().split("T")[0];
6191
+ const toDateString = (date) => date ? format(date, "yyyy-MM-dd") : void 0;
6192
+ const toDate = (val) => typeof val === "string" ? parseISO(val) : val;
6184
6193
  return /* @__PURE__ */ jsxs(BaseInput, { variant, status, bordered, borderColor, className, children: [
6185
6194
  /* @__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(typeof value === "string" ? new Date(value) : value, "PPP") : placeholder }) }) }),
6187
- /* @__PURE__ */ jsx(PopoverContent, { className: "w-auto p-0", align: "start", children: /* @__PURE__ */ jsx(Calendar, { mode: "single", selected: typeof value === "string" ? new Date(value) : value, onSelect: (date) => onChange(toDateString(date)), captionLayout: "dropdown" }) })
6195
+ /* @__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 }) }) }),
6196
+ /* @__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
6197
  ] }),
6189
6198
  !icon && showIcon && /* @__PURE__ */ jsx(Calendar$1, { className: iconProps.className, style: iconProps.style })
6190
6199
  ] });
@@ -7514,8 +7523,8 @@ function NFormSectionHeader({
7514
7523
  className
7515
7524
  ),
7516
7525
  children: [
7517
- Icon2 && /* @__PURE__ */ jsx(Icon2, { className: "w-4 h-4 shrink-0" }),
7518
- /* @__PURE__ */ jsx(Label, { className: "text-sm font-semibold leading-none", children: title })
7526
+ Icon2 && /* @__PURE__ */ jsx(Icon2, { className: "w-4 h-4 shrink-0 text-current" }),
7527
+ /* @__PURE__ */ jsx(Label, { className: "text-sm font-semibold leading-none text-current", children: title })
7519
7528
  ]
7520
7529
  }
7521
7530
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "najm-kit",
3
- "version": "0.0.32",
3
+ "version": "0.0.34",
4
4
  "type": "module",
5
5
  "description": "Reusable React UI component package for Najm framework",
6
6
  "main": "./dist/index.mjs",