shadcn-zod-formkit 1.27.4 → 1.28.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/README.md CHANGED
@@ -121,6 +121,8 @@ const mockFields: Array<FieldProps |FieldProps[]> = [
121
121
  | **Input Multi Select** | `InputTypes.MULTI_SELECT` |
122
122
  | **Select With Search** | `InputTypes.COMBOBOX` |
123
123
  | **Input Drag Drop List** | `InputTypes.SORTABLE_LIST` |
124
+ | **Dynamic Tabs** | `InputTypes.REPEATER_TABS` |
125
+ | **Dynamic String List** | `InputTypes.STRING_LIST` |
124
126
 
125
127
 
126
128
 
package/dist/index.cjs CHANGED
@@ -2220,6 +2220,28 @@ var ColorInput = class extends BaseInput {
2220
2220
  return /* @__PURE__ */ jsxRuntime.jsx(FieldColor, { input, form, isSubmitting });
2221
2221
  }
2222
2222
  };
2223
+ var PRESET_COLORS = [
2224
+ "#ef4444",
2225
+ // red
2226
+ "#f97316",
2227
+ // orange
2228
+ "#eab308",
2229
+ // yellow
2230
+ "#22c55e",
2231
+ // green
2232
+ "#06b6d4",
2233
+ // cyan
2234
+ "#3b82f6",
2235
+ // blue
2236
+ "#8b5cf6",
2237
+ // purple
2238
+ "#ec4899",
2239
+ // pink
2240
+ "#64748b",
2241
+ // slate
2242
+ "#000000"
2243
+ // black
2244
+ ];
2223
2245
  var FieldColor = ({ form, input, isSubmitting }) => {
2224
2246
  const [ColorCmp, _setColorCmp] = React3.useState(ColorComp);
2225
2247
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -2250,13 +2272,17 @@ var FieldColor = ({ form, input, isSubmitting }) => {
2250
2272
  var ColorComp = React3__namespace.default.forwardRef(
2251
2273
  ({ value = "#000000", onChange, onBlur, disabled, className, hideInput = ["hsv"] }, ref) => {
2252
2274
  const [color, setColor] = reactColorPalette.useColor(value);
2253
- const [open, setOpen] = React3__namespace.default.useState(false);
2275
+ const [open, setOpen] = React3.useState(false);
2254
2276
  React3__namespace.default.useEffect(() => {
2255
2277
  if (value !== color.hex) {
2256
2278
  setColor({ ...color, hex: value });
2257
2279
  }
2258
- }, [color, setColor, value]);
2280
+ }, [value]);
2259
2281
  const handleColorChange = (newColor) => {
2282
+ setColor({ ...color, hex: newColor });
2283
+ onChange?.(newColor);
2284
+ };
2285
+ const handlePickerChange = (newColor) => {
2260
2286
  setColor(newColor);
2261
2287
  onChange?.(newColor.hex);
2262
2288
  };
@@ -2266,21 +2292,38 @@ var ColorComp = React3__namespace.default.forwardRef(
2266
2292
  onBlur?.();
2267
2293
  }
2268
2294
  };
2269
- return /* @__PURE__ */ jsxRuntime.jsxs(Popover, { open, onOpenChange: handleOpenChange, children: [
2270
- /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
2271
- Button,
2295
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3", children: [
2296
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-2 p-2", children: PRESET_COLORS.map((presetColor) => /* @__PURE__ */ jsxRuntime.jsx(
2297
+ "button",
2272
2298
  {
2273
- ref,
2274
- variant: "outline",
2299
+ type: "button",
2275
2300
  disabled,
2276
- className: cn("w-full justify-start text-left font-normal", !value && "text-muted-foreground", className),
2277
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
2278
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-4 w-4 border border-border rounded-sm", style: { backgroundColor: color.hex, width: 20, height: 20 } }),
2279
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: color.hex })
2280
- ] })
2281
- }
2282
- ) }),
2283
- /* @__PURE__ */ jsxRuntime.jsx(PopoverContent, { className: "w-auto p-3", align: "start", children: /* @__PURE__ */ jsxRuntime.jsx(reactColorPalette.ColorPicker, { color, onChange: handleColorChange, hideInput }) })
2301
+ className: cn(
2302
+ "size-6 rounded-md border-2 transition-all hover:scale-110 disabled:opacity-50 disabled:cursor-not-allowed",
2303
+ color.hex === presetColor ? "border-foreground ring-2 ring-foreground/20" : "border-border hover:border-foreground/50"
2304
+ ),
2305
+ style: { backgroundColor: presetColor },
2306
+ onClick: () => handleColorChange(presetColor),
2307
+ "aria-label": `Select color ${presetColor}`
2308
+ },
2309
+ presetColor
2310
+ )) }),
2311
+ /* @__PURE__ */ jsxRuntime.jsxs(Popover, { open, onOpenChange: handleOpenChange, children: [
2312
+ /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
2313
+ Button,
2314
+ {
2315
+ ref,
2316
+ variant: "outline",
2317
+ disabled,
2318
+ className: cn("w-full justify-start text-left font-normal", !value && "text-muted-foreground", className),
2319
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
2320
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-4 w-4 border border-border rounded-sm", style: { backgroundColor: color.hex, width: 20, height: 20 } }),
2321
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: color.hex })
2322
+ ] })
2323
+ }
2324
+ ) }),
2325
+ /* @__PURE__ */ jsxRuntime.jsx(PopoverContent, { className: "w-auto p-3", align: "start", children: /* @__PURE__ */ jsxRuntime.jsx(reactColorPalette.ColorPicker, { color, onChange: handlePickerChange, hideInput }) })
2326
+ ] })
2284
2327
  ] });
2285
2328
  }
2286
2329
  );