@timeax/form-palette 0.1.0 → 0.1.2

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-aFXJGBXI.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-aFXJGBXI.mjs';
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';
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-Jrd0I0Ey.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-Jrd0I0Ey.js';
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';
5
5
  import 'zod';
6
6
  import './adapter-CvjXO9Gi.js';
7
7
  import '@inertiajs/core';
package/dist/extra.js CHANGED
@@ -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,
@@ -19404,6 +19405,7 @@ var ShadcnFileVariant = React__namespace.forwardRef(function ShadcnFileVariant2(
19404
19405
  formatFileSize = formatSizeDefault,
19405
19406
  placeholder = "Select file...",
19406
19407
  className,
19408
+ custom,
19407
19409
  dropAreaClassName,
19408
19410
  listClassName,
19409
19411
  triggerClassName,
@@ -19429,7 +19431,7 @@ var ShadcnFileVariant = React__namespace.forwardRef(function ShadcnFileVariant2(
19429
19431
  } = props;
19430
19432
  const joinControls = mode === "default" ? joinControlsProp != null ? joinControlsProp : true : false;
19431
19433
  const extendBoxToControls = mode === "default" ? extendBoxToControlsProp != null ? extendBoxToControlsProp : true : false;
19432
- const items = value != null ? value : [];
19434
+ const items = (_a = toArray2(value)) != null ? _a : [];
19433
19435
  const isDisabled = Boolean(disabled || readOnly);
19434
19436
  const [dragOver, setDragOver] = React__namespace.useState(false);
19435
19437
  const [selectedIds, setSelectedIds] = React__namespace.useState(
@@ -19513,12 +19515,16 @@ var ShadcnFileVariant = React__namespace.forwardRef(function ShadcnFileVariant2(
19513
19515
  setSelectedIds(/* @__PURE__ */ new Set());
19514
19516
  }, [emitChange, items, selectedIds]);
19515
19517
  const openPicker = React__namespace.useCallback(async () => {
19516
- var _a;
19518
+ var _a2;
19517
19519
  if (isDisabled) return;
19518
- let resolvedLoader = customLoader != null ? customLoader : getPaletteUtil("customLoader");
19520
+ let resolvedLoader = customLoader != null ? customLoader : custom && getPaletteUtil("customLoader");
19519
19521
  if (resolvedLoader) {
19520
19522
  try {
19521
- const result = await resolvedLoader({ multiple, current: items, allowedTypes: toArray2(accept) });
19523
+ const result = await resolvedLoader({
19524
+ multiple,
19525
+ current: items,
19526
+ allowedTypes: toArray2(accept)
19527
+ });
19522
19528
  if (!result) return;
19523
19529
  const normalized = toArray2(result).map(normaliseFileLike);
19524
19530
  if (mergeMode === "replace" || !multiple) {
@@ -19534,7 +19540,7 @@ var ShadcnFileVariant = React__namespace.forwardRef(function ShadcnFileVariant2(
19534
19540
  }
19535
19541
  return;
19536
19542
  }
19537
- (_a = fileInputRef.current) == null ? void 0 : _a.click();
19543
+ (_a2 = fileInputRef.current) == null ? void 0 : _a2.click();
19538
19544
  }, [
19539
19545
  customLoader,
19540
19546
  emitChange,
@@ -19553,18 +19559,18 @@ var ShadcnFileVariant = React__namespace.forwardRef(function ShadcnFileVariant2(
19553
19559
  );
19554
19560
  const onDrop = React__namespace.useCallback(
19555
19561
  (e4) => {
19556
- var _a;
19562
+ var _a2;
19557
19563
  e4.preventDefault();
19558
19564
  setDragOver(false);
19559
- if (isDisabled || !((_a = e4.dataTransfer.files) == null ? void 0 : _a.length)) return;
19565
+ if (isDisabled || !((_a2 = e4.dataTransfer.files) == null ? void 0 : _a2.length)) return;
19560
19566
  const files = normaliseFromFiles(e4.dataTransfer.files);
19561
19567
  handleAddItems(files, "drop");
19562
19568
  },
19563
19569
  [handleAddItems, isDisabled]
19564
19570
  );
19565
19571
  const onNativeChange = (e4) => {
19566
- var _a;
19567
- if ((_a = e4.target.files) == null ? void 0 : _a.length) {
19572
+ var _a2;
19573
+ if ((_a2 = e4.target.files) == null ? void 0 : _a2.length) {
19568
19574
  handleAddItems(normaliseFromFiles(e4.target.files), "input");
19569
19575
  }
19570
19576
  e4.target.value = "";
@@ -19578,8 +19584,8 @@ var ShadcnFileVariant = React__namespace.forwardRef(function ShadcnFileVariant2(
19578
19584
  const [preview2, setPreview] = React__namespace.useState(null);
19579
19585
  const [isOpen, setIsOpen] = React__namespace.useState(false);
19580
19586
  React__namespace.useEffect(() => {
19581
- var _a;
19582
- const isImage2 = ((_a = item.type) == null ? void 0 : _a.startsWith("image/")) || item.name.match(/\.(jpg|jpeg|png|gif|webp)$/i);
19587
+ var _a2;
19588
+ const isImage2 = ((_a2 = item.type) == null ? void 0 : _a2.startsWith("image/")) || item.name.match(/\.(jpg|jpeg|png|gif|webp)$/i);
19583
19589
  if (!isImage2) {
19584
19590
  setPreview(null);
19585
19591
  return;
@@ -19965,7 +19971,7 @@ var ShadcnFileVariant = React__namespace.forwardRef(function ShadcnFileVariant2(
19965
19971
  ),
19966
19972
  children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
19967
19973
  items.map((item) => {
19968
- var _a;
19974
+ var _a2;
19969
19975
  const selected = selectedIds.has(item.id);
19970
19976
  const toggle = () => {
19971
19977
  const next = new Set(selectedIds);
@@ -19992,7 +19998,7 @@ var ShadcnFileVariant = React__namespace.forwardRef(function ShadcnFileVariant2(
19992
19998
  ),
19993
19999
  /* @__PURE__ */ jsxRuntime.jsx(FileThumbnail, { item }),
19994
20000
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1", children: [
19995
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "truncate font-medium", children: (_a = formatFileName == null ? void 0 : formatFileName(item)) != null ? _a : item.name }),
20001
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "truncate font-medium", children: (_a2 = formatFileName == null ? void 0 : formatFileName(item)) != null ? _a2 : item.name }),
19996
20002
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
19997
20003
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: formatFileSize(
19998
20004
  item.size
@@ -20110,7 +20116,7 @@ var ShadcnFileVariant = React__namespace.forwardRef(function ShadcnFileVariant2(
20110
20116
  ] })
20111
20117
  ] }),
20112
20118
  /* @__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) => {
20113
- var _a;
20119
+ var _a2;
20114
20120
  const selected = selectedIds.has(item.id);
20115
20121
  const toggle = () => {
20116
20122
  const next = new Set(selectedIds);
@@ -20145,7 +20151,7 @@ var ShadcnFileVariant = React__namespace.forwardRef(function ShadcnFileVariant2(
20145
20151
  ),
20146
20152
  /* @__PURE__ */ jsxRuntime.jsx(FileThumbnail, { item }),
20147
20153
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1 space-y-1", children: [
20148
- /* @__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 }) }),
20154
+ /* @__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 }) }),
20149
20155
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
20150
20156
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: formatFileSize(item.size) }),
20151
20157
  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" }) }),