shadcn-zod-formkit 3.10.1 → 3.11.0

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.cjs CHANGED
@@ -12094,6 +12094,13 @@ var useKeyboardStore = zustand.create((set, get) => ({
12094
12094
  isOpenDynamic: false,
12095
12095
  value: "",
12096
12096
  onEnter: void 0,
12097
+ isPassword: false,
12098
+ inputPlaceholder: void 0,
12099
+ infoTooltip: void 0,
12100
+ inputLabel: void 0,
12101
+ classNameTextField: "items-center justify-center",
12102
+ iconsLeft: [],
12103
+ iconsRight: [],
12097
12104
  setChildren(children) {
12098
12105
  set({ children });
12099
12106
  },
@@ -12220,7 +12227,28 @@ var useKeyboardStore = zustand.create((set, get) => ({
12220
12227
  ...state.inputs,
12221
12228
  [id]: value
12222
12229
  }
12223
- }))
12230
+ })),
12231
+ setPlaceholder: (placeholder) => {
12232
+ set({ inputPlaceholder: placeholder });
12233
+ },
12234
+ setIsPassword: (isPass) => {
12235
+ set({ isPassword: isPass });
12236
+ },
12237
+ setInfoToolTip: (tooltip) => {
12238
+ set({ infoTooltip: tooltip });
12239
+ },
12240
+ setIconsLeft: (icons) => {
12241
+ set({ iconsLeft: icons });
12242
+ },
12243
+ setIconsRight: (icons) => {
12244
+ set({ iconsRight: icons });
12245
+ },
12246
+ setInputLabel: (label) => {
12247
+ set({ inputLabel: label });
12248
+ },
12249
+ setClassNameTextField: (className) => {
12250
+ set({ classNameTextField: className });
12251
+ }
12224
12252
  }));
12225
12253
  var CustomSheet = ({ title = "", children, childrenHeader, isOpen, className, side = "bottom", isDynamic }) => {
12226
12254
  const setIsOpen = useKeyboardStore((state) => state.setIsOpen);
@@ -12537,7 +12565,7 @@ var Key = ({
12537
12565
  "active:scale-95",
12538
12566
  fontSize,
12539
12567
  // Estados base (soft UI)
12540
- "border border-(--color-border)",
12568
+ "border-2 border-(--color-border)",
12541
12569
  "bg-(--color-secondary-soft) text-(--color-foreground)",
12542
12570
  // Hover
12543
12571
  "hover:bg-(--color-accent-soft)",
@@ -12926,7 +12954,8 @@ var TextField = ({
12926
12954
  placeholder = "",
12927
12955
  className,
12928
12956
  activeColor = "amber" /* amber */,
12929
- inputType = "default" /* DEFAULT */
12957
+ inputType = "default" /* DEFAULT */,
12958
+ isPassword = false
12930
12959
  }) => {
12931
12960
  React3.useEffect(() => {
12932
12961
  if (!isActive || disabled) return;
@@ -12964,33 +12993,40 @@ var TextField = ({
12964
12993
  {
12965
12994
  tabIndex: 0,
12966
12995
  onClick: handleClick,
12996
+ style: { gridTemplateColumns: "15fr 70fr 15fr" },
12967
12997
  className: cn(
12968
- "flex flex-row items-center gap-3 rounded-xl border-2 transition-all min-h-16 outline-none",
12998
+ "grid items-center gap-3 rounded-xl border-2 transition-all min-h-16 outline-none w-full",
12969
12999
  sizeClasses[size],
12970
13000
  isActive ? activeColorClasses[activeColor] : "border-zinc-700/40 hover:border-zinc-600",
12971
13001
  disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer",
12972
13002
  className
12973
13003
  ),
12974
13004
  children: [
12975
- prefix && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-zinc-400 text-xs font-mono font-bold", children: prefix }),
12976
- (iconsLeft.length > 0 || textLeft) && /* @__PURE__ */ jsxRuntime.jsxs(InputGroupAddon, { children: [
12977
- textLeft && /* @__PURE__ */ jsxRuntime.jsx(InputGroupText, { children: typeof textLeft === "string" ? textLeft : "" }),
12978
- iconsLeft.map((IconComponent, index) => /* @__PURE__ */ jsxRuntime.jsx(IconComponent, { size: 20, className: "text-zinc-400" }, index))
13005
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-full items-start", children: [
13006
+ prefix && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-zinc-400 text-xs font-mono font-bold", children: prefix }),
13007
+ (iconsLeft.length > 0 || textLeft) && /* @__PURE__ */ jsxRuntime.jsxs(InputGroupAddon, { children: [
13008
+ textLeft && /* @__PURE__ */ jsxRuntime.jsx(InputGroupText, { children: typeof textLeft === "string" ? textLeft : "" }),
13009
+ iconsLeft.map((IconComponent, index) => /* @__PURE__ */ jsxRuntime.jsx(IconComponent, { size: 20, className: "text-zinc-400" }, index))
13010
+ ] })
12979
13011
  ] }),
12980
- placeholder && displayValue.toString().length == 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-mono font-bold text-zinc-500/20", style: { color: "#8080807d" }, children: placeholder }),
12981
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(
12982
- "font-mono font-bold tracking-widest",
12983
- !displayValue && "text-zinc-500"
12984
- ), children: inputType !== "password" /* PASSWORD */ ? displayValue : "\u2022".repeat(displayValue.toString().length) }),
12985
- suffix && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-zinc-400 text-sm", children: suffix }),
12986
- (iconsRight.length > 0 || textRight) && /* @__PURE__ */ jsxRuntime.jsxs(InputGroupAddon, { className: "ml-auto", children: [
12987
- textRight && /* @__PURE__ */ jsxRuntime.jsx(InputGroupText, { children: textRight }),
12988
- iconsRight.map((IconComponent, index) => /* @__PURE__ */ jsxRuntime.jsx(IconComponent, { size: 20, className: "text-zinc-400" }, index))
13012
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex h-full ", className), children: [
13013
+ placeholder && displayValue.toString().length == 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-mono font-bold text-zinc-500/20", style: { color: "#8080807d" }, children: placeholder }),
13014
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(
13015
+ "font-mono font-bold tracking-widest",
13016
+ !displayValue && "text-zinc-500"
13017
+ ), children: inputType == "password" /* PASSWORD */ || isPassword ? "\u2022".repeat(displayValue.toString().length) : displayValue })
12989
13018
  ] }),
12990
- infoTooltip && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "mr-auto text-[10px] uppercase tracking-widest", children: /* @__PURE__ */ jsxRuntime.jsx(TooltipPrimitive.TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(TooltipPrimitive.Tooltip, { children: [
12991
- /* @__PURE__ */ jsxRuntime.jsx(TooltipPrimitive.TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Info, { size: 20, className: "text-zinc-400 hover:text-zinc-200" }) }),
12992
- /* @__PURE__ */ jsxRuntime.jsx(TooltipPrimitive.TooltipContent, { children: /* @__PURE__ */ jsxRuntime.jsx("p", { children: infoTooltip }) })
12993
- ] }) }) })
13019
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full h-full items-center justify-end", children: [
13020
+ (suffix || name) && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-zinc-400 text-sm w-full text-right", children: suffix ?? name }),
13021
+ (iconsRight.length > 0 || textRight) && /* @__PURE__ */ jsxRuntime.jsxs(InputGroupAddon, { className: "ml-auto", children: [
13022
+ textRight && /* @__PURE__ */ jsxRuntime.jsx(InputGroupText, { children: textRight }),
13023
+ iconsRight.map((IconComponent, index) => /* @__PURE__ */ jsxRuntime.jsx(IconComponent, { size: 20, className: "text-zinc-400" }, index))
13024
+ ] }),
13025
+ infoTooltip && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "mr-auto text-[10px] uppercase tracking-widest", children: /* @__PURE__ */ jsxRuntime.jsx(TooltipPrimitive.TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(TooltipPrimitive.Tooltip, { children: [
13026
+ /* @__PURE__ */ jsxRuntime.jsx(TooltipPrimitive.TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Info, { size: 20, className: "text-zinc-400 hover:text-zinc-200" }) }),
13027
+ /* @__PURE__ */ jsxRuntime.jsx(TooltipPrimitive.TooltipContent, { children: /* @__PURE__ */ jsxRuntime.jsx("p", { children: infoTooltip }) })
13028
+ ] }) }) })
13029
+ ] })
12994
13030
  ]
12995
13031
  }
12996
13032
  );
@@ -13005,9 +13041,24 @@ var KeyboardQwerty = ({ onKeyPress, onEnter, keyFontSize = "text-2xl", onDelete,
13005
13041
  const [shiftMode, setShiftMode] = React3.useState("off");
13006
13042
  const [mode, setMode] = React3.useState("letters");
13007
13043
  const lastShiftPress = React3.useRef(0);
13008
- const { currentInputField, write, setIsOpen, backspace, isInputRequired, value } = useKeyboardStore();
13009
13044
  const storeOnEnter = useKeyboardStore((state) => state.onEnter);
13010
13045
  const isUpper = shiftMode !== "off";
13046
+ const {
13047
+ currentInputField,
13048
+ write,
13049
+ setIsOpen,
13050
+ setIsOpenDynamic,
13051
+ backspace,
13052
+ isInputRequired,
13053
+ value,
13054
+ inputPlaceholder,
13055
+ isPassword,
13056
+ infoTooltip,
13057
+ iconsLeft,
13058
+ iconsRight,
13059
+ inputLabel,
13060
+ classNameTextField
13061
+ } = useKeyboardStore();
13011
13062
  React3.useEffect(() => {
13012
13063
  const handleKeyDown = (e) => {
13013
13064
  const active = document.activeElement;
@@ -13095,10 +13146,15 @@ var KeyboardQwerty = ({ onKeyPress, onEnter, keyFontSize = "text-2xl", onDelete,
13095
13146
  !currentInputField && /* @__PURE__ */ jsxRuntime.jsx(
13096
13147
  TextField,
13097
13148
  {
13098
- name: "",
13149
+ name: inputLabel ?? "",
13099
13150
  value,
13151
+ isPassword,
13152
+ placeholder: !inputPlaceholder || inputPlaceholder?.length == 0 ? "" : inputPlaceholder,
13100
13153
  isActive: true,
13101
- className: "justify-center"
13154
+ infoTooltip,
13155
+ iconsLeft: iconsLeft && iconsLeft.length == 0 ? isPassword ? [lucideReact.LockIcon] : [lucideReact.Pencil] : iconsLeft,
13156
+ iconsRight: iconsRight && iconsRight.length == 0 ? [] : iconsRight,
13157
+ className: classNameTextField ?? isPassword ? "justify-center" : ""
13102
13158
  }
13103
13159
  )
13104
13160
  ] });
@@ -13107,8 +13163,12 @@ var KeyboardQwerty = ({ onKeyPress, onEnter, keyFontSize = "text-2xl", onDelete,
13107
13163
  }, className: "bg-red-200 text-xs", style: { backgroundColor: "#faba005e" } };
13108
13164
  const btnEsc = { label: "esc", onClick: () => {
13109
13165
  setIsOpen(false);
13166
+ setIsOpenDynamic(false);
13110
13167
  }, className: "", style: { backgroundColor: "#ffc0c05e" } };
13111
- const btnEnter = { label: "Enter", onClick: onEnter, className: "flex-[2] bg-green-200", style: { backgroundColor: "#008f003d" } };
13168
+ const btnEnter = { label: "Enter", onClick: () => {
13169
+ onEnter?.() ?? storeOnEnter?.();
13170
+ console.log("btnEnter");
13171
+ }, className: "flex-[2] bg-green-200", style: { backgroundColor: "#008f003d" } };
13112
13172
  if (mode === "symbols") {
13113
13173
  const keys = [
13114
13174
  ["esc", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")"],