@timeax/form-palette 0.1.1 → 0.1.3

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/extra.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
- import { O as ListerDefinition, Q as ListerRuntimeState, U as ListerProviderHost, W as PresetMap, X as ListerStoreState, Y as ListerSessionId, Z as ListerId, _ as ListerSearchMode, $ as ListerSearchTarget, a0 as ListerSearchPayload, a1 as ListerFilterCtx, a2 as ListerFilterOption, a3 as ListerMode, a4 as ListerApi, a5 as ShadcnJsonEditorProps, a6 as JsonEditorIndexHandle } from './variant-BGkGWsSy.mjs';
4
- export { ab as ListerChangeEvent, av as ListerDetails, al as ListerFilterApply, ak as ListerFilterApplyMode, am as ListerFilterBindKey, ao as ListerFilterGroupOption, an as ListerFilterInput, aq as ListerFilterInputOption, ar as ListerFilterSpec, ap as ListerFilterValueOption, ad as ListerLogCode, ae as ListerLogEntry, ac as ListerLogLevel, ah as ListerMapping, aw as ListerOpenOptions, a7 as ListerOpenReason, ax as ListerOpenResult, ag as ListerOption, au as ListerOptionsForMode, af as ListerPermissionCtx, at as ListerRawForMode, aj as ListerSearchSpec, aC as ListerSessionState, ai as ListerSource, as as ListerValueForMode, aa as OpenAnchor, aA as PresetFilters, aB as PresetMeta, ay as PresetRaw, az as PresetValue, a9 as Resolver, a8 as Selector } from './variant-BGkGWsSy.mjs';
3
+ import { Q as ListerDefinition, U as ListerRuntimeState, W as ListerProviderHost, X as PresetMap, Y as ListerStoreState, Z as ListerSessionId, _ as ListerId, $ as ListerSearchMode, a0 as ListerSearchTarget, a1 as ListerSearchPayload, a2 as ListerFilterCtx, a3 as ListerFilterOption, a4 as ListerMode, a5 as ListerApi, a6 as ShadcnJsonEditorProps, a7 as JsonEditorIndexHandle } from './core-BD0ObjuE.mjs';
4
+ export { ac as ListerChangeEvent, aw as ListerDetails, am as ListerFilterApply, al as ListerFilterApplyMode, an as ListerFilterBindKey, ap as ListerFilterGroupOption, ao as ListerFilterInput, ar as ListerFilterInputOption, as as ListerFilterSpec, aq as ListerFilterValueOption, ae as ListerLogCode, af as ListerLogEntry, ad as ListerLogLevel, ai as ListerMapping, ax as ListerOpenOptions, a8 as ListerOpenReason, ay as ListerOpenResult, ah as ListerOption, av as ListerOptionsForMode, ag as ListerPermissionCtx, au as ListerRawForMode, ak as ListerSearchSpec, aD as ListerSessionState, aj as ListerSource, at as ListerValueForMode, ab as OpenAnchor, aB as PresetFilters, aC as PresetMeta, az as PresetRaw, aA as PresetValue, aa as Resolver, a9 as Selector } from './core-BD0ObjuE.mjs';
5
5
  import 'zod';
6
6
  import './adapter-CvjXO9Gi.mjs';
7
7
  import '@inertiajs/core';
package/dist/extra.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
- import { O as ListerDefinition, Q as ListerRuntimeState, U as ListerProviderHost, W as PresetMap, X as ListerStoreState, Y as ListerSessionId, Z as ListerId, _ as ListerSearchMode, $ as ListerSearchTarget, a0 as ListerSearchPayload, a1 as ListerFilterCtx, a2 as ListerFilterOption, a3 as ListerMode, a4 as ListerApi, a5 as ShadcnJsonEditorProps, a6 as JsonEditorIndexHandle } from './variant-B_L0opEi.js';
4
- export { ab as ListerChangeEvent, av as ListerDetails, al as ListerFilterApply, ak as ListerFilterApplyMode, am as ListerFilterBindKey, ao as ListerFilterGroupOption, an as ListerFilterInput, aq as ListerFilterInputOption, ar as ListerFilterSpec, ap as ListerFilterValueOption, ad as ListerLogCode, ae as ListerLogEntry, ac as ListerLogLevel, ah as ListerMapping, aw as ListerOpenOptions, a7 as ListerOpenReason, ax as ListerOpenResult, ag as ListerOption, au as ListerOptionsForMode, af as ListerPermissionCtx, at as ListerRawForMode, aj as ListerSearchSpec, aC as ListerSessionState, ai as ListerSource, as as ListerValueForMode, aa as OpenAnchor, aA as PresetFilters, aB as PresetMeta, ay as PresetRaw, az as PresetValue, a9 as Resolver, a8 as Selector } from './variant-B_L0opEi.js';
3
+ import { Q as ListerDefinition, U as ListerRuntimeState, W as ListerProviderHost, X as PresetMap, Y as ListerStoreState, Z as ListerSessionId, _ as ListerId, $ as ListerSearchMode, a0 as ListerSearchTarget, a1 as ListerSearchPayload, a2 as ListerFilterCtx, a3 as ListerFilterOption, a4 as ListerMode, a5 as ListerApi, a6 as ShadcnJsonEditorProps, a7 as JsonEditorIndexHandle } from './core-q_p0E4W9.js';
4
+ export { ac as ListerChangeEvent, aw as ListerDetails, am as ListerFilterApply, al as ListerFilterApplyMode, an as ListerFilterBindKey, ap as ListerFilterGroupOption, ao as ListerFilterInput, ar as ListerFilterInputOption, as as ListerFilterSpec, aq as ListerFilterValueOption, ae as ListerLogCode, af as ListerLogEntry, ad as ListerLogLevel, ai as ListerMapping, ax as ListerOpenOptions, a8 as ListerOpenReason, ay as ListerOpenResult, ah as ListerOption, av as ListerOptionsForMode, ag as ListerPermissionCtx, au as ListerRawForMode, ak as ListerSearchSpec, aD as ListerSessionState, aj as ListerSource, at as ListerValueForMode, ab as OpenAnchor, aB as PresetFilters, aC as PresetMeta, az as PresetRaw, aA as PresetValue, aa as Resolver, a9 as Selector } from './core-q_p0E4W9.js';
5
5
  import 'zod';
6
6
  import './adapter-CvjXO9Gi.js';
7
7
  import '@inertiajs/core';
package/dist/extra.js CHANGED
@@ -4488,6 +4488,10 @@ var twMerge = /* @__PURE__ */ createTailwindMerge(getDefaultConfig);
4488
4488
  function cn(...inputs) {
4489
4489
  return twMerge(clsx(inputs));
4490
4490
  }
4491
+ function toArray2(v2) {
4492
+ if (v2 == null) return [];
4493
+ return Array.isArray(v2) ? v2 : [v2];
4494
+ }
4491
4495
  function Popover({
4492
4496
  ...props
4493
4497
  }) {
@@ -19243,10 +19247,6 @@ function pickerBtnSize(size) {
19243
19247
  return "h-7 w-7";
19244
19248
  }
19245
19249
  }
19246
- function toArray2(v2) {
19247
- if (v2 == null) return [];
19248
- return Array.isArray(v2) ? v2 : [v2];
19249
- }
19250
19250
  function normaliseFileLike(input) {
19251
19251
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
19252
19252
  const asAny = input;
@@ -19378,6 +19378,7 @@ var FileThumbnail = ({ item }) => {
19378
19378
  ) : /* @__PURE__ */ jsxRuntime.jsx(File2, { className: "h-4 w-4 text-muted-foreground/50" }) });
19379
19379
  };
19380
19380
  var ShadcnFileVariant = React__namespace.forwardRef(function ShadcnFileVariant2(props, ref) {
19381
+ var _a;
19381
19382
  const {
19382
19383
  value,
19383
19384
  onValue,
@@ -19403,6 +19404,7 @@ var ShadcnFileVariant = React__namespace.forwardRef(function ShadcnFileVariant2(
19403
19404
  formatFileName,
19404
19405
  formatFileSize = formatSizeDefault,
19405
19406
  placeholder = "Select file...",
19407
+ asRaw,
19406
19408
  className,
19407
19409
  custom,
19408
19410
  dropAreaClassName,
@@ -19430,7 +19432,7 @@ var ShadcnFileVariant = React__namespace.forwardRef(function ShadcnFileVariant2(
19430
19432
  } = props;
19431
19433
  const joinControls = mode === "default" ? joinControlsProp != null ? joinControlsProp : true : false;
19432
19434
  const extendBoxToControls = mode === "default" ? extendBoxToControlsProp != null ? extendBoxToControlsProp : true : false;
19433
- const items = value != null ? value : [];
19435
+ const items = (_a = toArray2(value)) != null ? _a : [];
19434
19436
  const isDisabled = Boolean(disabled || readOnly);
19435
19437
  const [dragOver, setDragOver] = React__namespace.useState(false);
19436
19438
  const [selectedIds, setSelectedIds] = React__namespace.useState(
@@ -19514,12 +19516,16 @@ var ShadcnFileVariant = React__namespace.forwardRef(function ShadcnFileVariant2(
19514
19516
  setSelectedIds(/* @__PURE__ */ new Set());
19515
19517
  }, [emitChange, items, selectedIds]);
19516
19518
  const openPicker = React__namespace.useCallback(async () => {
19517
- var _a;
19519
+ var _a2;
19518
19520
  if (isDisabled) return;
19519
19521
  let resolvedLoader = customLoader != null ? customLoader : custom && getPaletteUtil("customLoader");
19520
19522
  if (resolvedLoader) {
19521
19523
  try {
19522
- const result = await resolvedLoader({ multiple, current: items, allowedTypes: toArray2(accept) });
19524
+ const result = await resolvedLoader({
19525
+ multiple,
19526
+ current: items,
19527
+ allowedTypes: toArray2(accept)
19528
+ });
19523
19529
  if (!result) return;
19524
19530
  const normalized = toArray2(result).map(normaliseFileLike);
19525
19531
  if (mergeMode === "replace" || !multiple) {
@@ -19535,7 +19541,7 @@ var ShadcnFileVariant = React__namespace.forwardRef(function ShadcnFileVariant2(
19535
19541
  }
19536
19542
  return;
19537
19543
  }
19538
- (_a = fileInputRef.current) == null ? void 0 : _a.click();
19544
+ (_a2 = fileInputRef.current) == null ? void 0 : _a2.click();
19539
19545
  }, [
19540
19546
  customLoader,
19541
19547
  emitChange,
@@ -19554,18 +19560,18 @@ var ShadcnFileVariant = React__namespace.forwardRef(function ShadcnFileVariant2(
19554
19560
  );
19555
19561
  const onDrop = React__namespace.useCallback(
19556
19562
  (e4) => {
19557
- var _a;
19563
+ var _a2;
19558
19564
  e4.preventDefault();
19559
19565
  setDragOver(false);
19560
- if (isDisabled || !((_a = e4.dataTransfer.files) == null ? void 0 : _a.length)) return;
19566
+ if (isDisabled || !((_a2 = e4.dataTransfer.files) == null ? void 0 : _a2.length)) return;
19561
19567
  const files = normaliseFromFiles(e4.dataTransfer.files);
19562
19568
  handleAddItems(files, "drop");
19563
19569
  },
19564
19570
  [handleAddItems, isDisabled]
19565
19571
  );
19566
19572
  const onNativeChange = (e4) => {
19567
- var _a;
19568
- if ((_a = e4.target.files) == null ? void 0 : _a.length) {
19573
+ var _a2;
19574
+ if ((_a2 = e4.target.files) == null ? void 0 : _a2.length) {
19569
19575
  handleAddItems(normaliseFromFiles(e4.target.files), "input");
19570
19576
  }
19571
19577
  e4.target.value = "";
@@ -19579,8 +19585,8 @@ var ShadcnFileVariant = React__namespace.forwardRef(function ShadcnFileVariant2(
19579
19585
  const [preview2, setPreview] = React__namespace.useState(null);
19580
19586
  const [isOpen, setIsOpen] = React__namespace.useState(false);
19581
19587
  React__namespace.useEffect(() => {
19582
- var _a;
19583
- const isImage2 = ((_a = item.type) == null ? void 0 : _a.startsWith("image/")) || item.name.match(/\.(jpg|jpeg|png|gif|webp)$/i);
19588
+ var _a2;
19589
+ const isImage2 = ((_a2 = item.type) == null ? void 0 : _a2.startsWith("image/")) || item.name.match(/\.(jpg|jpeg|png|gif|webp)$/i);
19584
19590
  if (!isImage2) {
19585
19591
  setPreview(null);
19586
19592
  return;
@@ -19966,7 +19972,7 @@ var ShadcnFileVariant = React__namespace.forwardRef(function ShadcnFileVariant2(
19966
19972
  ),
19967
19973
  children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
19968
19974
  items.map((item) => {
19969
- var _a;
19975
+ var _a2;
19970
19976
  const selected = selectedIds.has(item.id);
19971
19977
  const toggle = () => {
19972
19978
  const next = new Set(selectedIds);
@@ -19993,7 +19999,7 @@ var ShadcnFileVariant = React__namespace.forwardRef(function ShadcnFileVariant2(
19993
19999
  ),
19994
20000
  /* @__PURE__ */ jsxRuntime.jsx(FileThumbnail, { item }),
19995
20001
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1", children: [
19996
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "truncate font-medium", children: (_a = formatFileName == null ? void 0 : formatFileName(item)) != null ? _a : item.name }),
20002
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "truncate font-medium", children: (_a2 = formatFileName == null ? void 0 : formatFileName(item)) != null ? _a2 : item.name }),
19997
20003
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
19998
20004
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: formatFileSize(
19999
20005
  item.size
@@ -20111,7 +20117,7 @@ var ShadcnFileVariant = React__namespace.forwardRef(function ShadcnFileVariant2(
20111
20117
  ] })
20112
20118
  ] }),
20113
20119
  /* @__PURE__ */ jsxRuntime.jsx(ScrollArea, { className: cn("mt-1 w-full", listClassName), children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-2", children: items.map((item, index) => {
20114
- var _a;
20120
+ var _a2;
20115
20121
  const selected = selectedIds.has(item.id);
20116
20122
  const toggle = () => {
20117
20123
  const next = new Set(selectedIds);
@@ -20146,7 +20152,7 @@ var ShadcnFileVariant = React__namespace.forwardRef(function ShadcnFileVariant2(
20146
20152
  ),
20147
20153
  /* @__PURE__ */ jsxRuntime.jsx(FileThumbnail, { item }),
20148
20154
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1 space-y-1", children: [
20149
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-between gap-2", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-sm font-medium text-foreground", children: (_a = formatFileName == null ? void 0 : formatFileName(item)) != null ? _a : item.name }) }),
20155
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-between gap-2", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-sm font-medium text-foreground", children: (_a2 = formatFileName == null ? void 0 : formatFileName(item)) != null ? _a2 : item.name }) }),
20150
20156
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
20151
20157
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: formatFileSize(item.size) }),
20152
20158
  item.status === "loading" && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex items-center gap-1 text-primary", children: /* @__PURE__ */ jsxRuntime.jsx(LoaderCircle, { className: "h-3 w-3 animate-spin" }) }),
@@ -24690,7 +24696,8 @@ function useField(options) {
24690
24696
  readOnly: readOnlyProp = false,
24691
24697
  validate,
24692
24698
  getOriginalValue,
24693
- onValueChange
24699
+ onValueChange,
24700
+ onSubmit
24694
24701
  } = options;
24695
24702
  const ref = React__namespace.useRef(null);
24696
24703
  const stateRef = React__namespace.useRef({
@@ -24777,6 +24784,7 @@ function useField(options) {
24777
24784
  main,
24778
24785
  ignore,
24779
24786
  required,
24787
+ onSubmit,
24780
24788
  ref,
24781
24789
  get defaultValue() {
24782
24790
  return stateRef.current.original;
@@ -24810,7 +24818,8 @@ function useField(options) {
24810
24818
  if (onValueChange) {
24811
24819
  onValueChange(value2, old, variant);
24812
24820
  }
24813
- }
24821
+ },
24822
+ variant: options.variant
24814
24823
  // Flags not directly on the Field interface but used via `as any`
24815
24824
  // in core-provider (getValue/setValue/reset).
24816
24825
  };
@@ -25175,6 +25184,7 @@ function InputField(props) {
25175
25184
  var _a, _b, _c, _d, _e, _f, _g;
25176
25185
  const {
25177
25186
  variant,
25187
+ onSubmit,
25178
25188
  // Field identity / wiring
25179
25189
  name,
25180
25190
  bind,
@@ -25306,6 +25316,8 @@ function InputField(props) {
25306
25316
  alias,
25307
25317
  main,
25308
25318
  ignore,
25319
+ onSubmit,
25320
+ variant,
25309
25321
  required,
25310
25322
  defaultValue,
25311
25323
  validate