shadcn-zod-formkit 3.10.2 → 3.11.1

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
@@ -12083,7 +12083,7 @@ var KeyboardTypes = /* @__PURE__ */ ((KeyboardTypes3) => {
12083
12083
  })(KeyboardTypes || {});
12084
12084
 
12085
12085
  // src/components/custom/keyboard/providers/keyboard.store.ts
12086
- var useKeyboardStore = zustand.create((set, get) => ({
12086
+ var DEFAULT_STATE = {
12087
12087
  isInputRequired: false,
12088
12088
  activeInput: null,
12089
12089
  inputs: {},
@@ -12092,8 +12092,22 @@ var useKeyboardStore = zustand.create((set, get) => ({
12092
12092
  children: void 0,
12093
12093
  isOpen: false,
12094
12094
  isOpenDynamic: false,
12095
+ isCloseOnEnter: true,
12095
12096
  value: "",
12096
12097
  onEnter: void 0,
12098
+ isPassword: false,
12099
+ inputPlaceholder: void 0,
12100
+ infoTooltip: void 0,
12101
+ inputLabel: void 0,
12102
+ classNameTextField: "items-center justify-center",
12103
+ iconsLeft: [],
12104
+ iconsRight: []
12105
+ };
12106
+ var useKeyboardStore = zustand.create((set, get) => ({
12107
+ ...DEFAULT_STATE,
12108
+ reset() {
12109
+ set(DEFAULT_STATE);
12110
+ },
12097
12111
  setChildren(children) {
12098
12112
  set({ children });
12099
12113
  },
@@ -12104,29 +12118,19 @@ var useKeyboardStore = zustand.create((set, get) => ({
12104
12118
  set({ currentInputField: inputField, isInputRequired: inputField ? true : false });
12105
12119
  },
12106
12120
  setIsOpen(open) {
12107
- if (!open) set({ value: "" });
12108
- set({ isOpen: open ?? !get().isOpen, children: void 0 });
12109
- if (!get().isOpen) {
12110
- set({
12111
- children: void 0,
12112
- value: "",
12113
- currentInputField: null,
12114
- isInputRequired: false,
12115
- onEnter: void 0
12116
- });
12121
+ const next = open ?? !get().isOpen;
12122
+ if (!next) {
12123
+ get().reset();
12124
+ } else {
12125
+ set({ isOpen: true, children: void 0 });
12117
12126
  }
12118
12127
  },
12119
12128
  setIsOpenDynamic(open) {
12120
- if (!open) set({ value: "" });
12121
- set({ isOpenDynamic: open ?? !get().isOpenDynamic });
12122
- if (!get().isOpenDynamic) {
12123
- set({
12124
- children: void 0,
12125
- value: "",
12126
- currentInputField: null,
12127
- isInputRequired: false,
12128
- onEnter: void 0
12129
- });
12129
+ const next = open ?? !get().isOpenDynamic;
12130
+ if (!next) {
12131
+ get().reset();
12132
+ } else {
12133
+ set({ isOpenDynamic: true });
12130
12134
  }
12131
12135
  },
12132
12136
  registerInput: (id, initialValue = "") => set((state) => ({
@@ -12220,7 +12224,31 @@ var useKeyboardStore = zustand.create((set, get) => ({
12220
12224
  ...state.inputs,
12221
12225
  [id]: value
12222
12226
  }
12223
- }))
12227
+ })),
12228
+ setPlaceholder: (placeholder) => {
12229
+ set({ inputPlaceholder: placeholder });
12230
+ },
12231
+ setIsPassword: (isPass) => {
12232
+ set({ isPassword: isPass });
12233
+ },
12234
+ setInfoToolTip: (tooltip) => {
12235
+ set({ infoTooltip: tooltip });
12236
+ },
12237
+ setIconsLeft: (icons) => {
12238
+ set({ iconsLeft: icons });
12239
+ },
12240
+ setIconsRight: (icons) => {
12241
+ set({ iconsRight: icons });
12242
+ },
12243
+ setInputLabel: (label) => {
12244
+ set({ inputLabel: label });
12245
+ },
12246
+ setClassNameTextField: (className) => {
12247
+ set({ classNameTextField: className });
12248
+ },
12249
+ setIsCloseOnEnter: (isClose) => {
12250
+ set({ isCloseOnEnter: isClose });
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, setIsOpenDynamic, 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
  ] });
@@ -13111,7 +13167,6 @@ var KeyboardQwerty = ({ onKeyPress, onEnter, keyFontSize = "text-2xl", onDelete,
13111
13167
  }, className: "", style: { backgroundColor: "#ffc0c05e" } };
13112
13168
  const btnEnter = { label: "Enter", onClick: () => {
13113
13169
  onEnter?.() ?? storeOnEnter?.();
13114
- console.log("btnEnter");
13115
13170
  }, className: "flex-[2] bg-green-200", style: { backgroundColor: "#008f003d" } };
13116
13171
  if (mode === "symbols") {
13117
13172
  const keys = [