@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 +2 -2
- package/dist/extra.d.ts +2 -2
- package/dist/extra.js +21 -15
- package/dist/extra.js.map +1 -1
- package/dist/extra.mjs +21 -15
- package/dist/extra.mjs.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +21 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +21 -15
- package/dist/index.mjs.map +1 -1
- package/dist/{variant-aFXJGBXI.d.mts → variant-BGkGWsSy.d.mts} +1 -0
- package/dist/{variant-Jrd0I0Ey.d.ts → variant-B_L0opEi.d.ts} +1 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as Dict, C as CoreProps, a as CoreContext, F as Field, V as VariantKey, L as LabelPlacement, S as SublabelPlacement, b as DescriptionPlacement, H as HelpTextPlacement, E as ErrorTextPlacement, c as SlotPlacement, d as FieldSize, e as FieldDensity, f as ValidateResult, g as ChangeDetail, h as VariantValueFor, i as VariantPropsFor, j as VariantModule, P as PhoneCountry, k as PasswordDefinitionMap, l as CustomFileLoader } from './variant-
|
|
2
|
-
export { B as BaseProps, r as ButtonRef, y as EffectiveFieldLayout, x as FieldLayoutConfig, w as FieldOrdering, v as FieldRootId, t as FieldRoots, u as FieldSlotId, s as FieldSlots, o as FormProps, m as InferFromSchema, I as InputNumber, q as InputStore, z as LayoutResolveContext, A as LayoutResolver, R as RelativeRootsMap, n as SubmitEvent, T as Textarea, p as ValuesResult, G as VariantEntry, M as VariantLayoutDefaults, N as VariantModuleFor, K as VariantValidateFn, J as Variants } from './variant-
|
|
1
|
+
import { D as Dict, C as CoreProps, a as CoreContext, F as Field, V as VariantKey, L as LabelPlacement, S as SublabelPlacement, b as DescriptionPlacement, H as HelpTextPlacement, E as ErrorTextPlacement, c as SlotPlacement, d as FieldSize, e as FieldDensity, f as ValidateResult, g as ChangeDetail, h as VariantValueFor, i as VariantPropsFor, j as VariantModule, P as PhoneCountry, k as PasswordDefinitionMap, l as CustomFileLoader } from './variant-BGkGWsSy.mjs';
|
|
2
|
+
export { B as BaseProps, r as ButtonRef, y as EffectiveFieldLayout, x as FieldLayoutConfig, w as FieldOrdering, v as FieldRootId, t as FieldRoots, u as FieldSlotId, s as FieldSlots, o as FormProps, m as InferFromSchema, I as InputNumber, q as InputStore, z as LayoutResolveContext, A as LayoutResolver, R as RelativeRootsMap, n as SubmitEvent, T as Textarea, p as ValuesResult, G as VariantEntry, M as VariantLayoutDefaults, N as VariantModuleFor, K as VariantValidateFn, J as Variants } from './variant-BGkGWsSy.mjs';
|
|
3
3
|
import { A as AdapterKey } from './adapter-CvjXO9Gi.mjs';
|
|
4
4
|
export { a as AdapterCallbacks, c as AdapterConfig, h as AdapterError, d as AdapterFactory, g as AdapterOk, f as AdapterProps, b as AdapterResult, i as AdapterSubmit, e as Adapters, M as Method, N as NamedAdapterConfig, j as NamedAdapterFactory } from './adapter-CvjXO9Gi.mjs';
|
|
5
5
|
export { createAxiosAdapter, createInertiaAdapter, getAdapter, hasAdapter, localAdapter, registerAdapter, registerAllAdapters, registerAxiosAdapter, registerInertiaAdapter, registerKnownAdapter } from './adapters.mjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as Dict, C as CoreProps, a as CoreContext, F as Field, V as VariantKey, L as LabelPlacement, S as SublabelPlacement, b as DescriptionPlacement, H as HelpTextPlacement, E as ErrorTextPlacement, c as SlotPlacement, d as FieldSize, e as FieldDensity, f as ValidateResult, g as ChangeDetail, h as VariantValueFor, i as VariantPropsFor, j as VariantModule, P as PhoneCountry, k as PasswordDefinitionMap, l as CustomFileLoader } from './variant-
|
|
2
|
-
export { B as BaseProps, r as ButtonRef, y as EffectiveFieldLayout, x as FieldLayoutConfig, w as FieldOrdering, v as FieldRootId, t as FieldRoots, u as FieldSlotId, s as FieldSlots, o as FormProps, m as InferFromSchema, I as InputNumber, q as InputStore, z as LayoutResolveContext, A as LayoutResolver, R as RelativeRootsMap, n as SubmitEvent, T as Textarea, p as ValuesResult, G as VariantEntry, M as VariantLayoutDefaults, N as VariantModuleFor, K as VariantValidateFn, J as Variants } from './variant-
|
|
1
|
+
import { D as Dict, C as CoreProps, a as CoreContext, F as Field, V as VariantKey, L as LabelPlacement, S as SublabelPlacement, b as DescriptionPlacement, H as HelpTextPlacement, E as ErrorTextPlacement, c as SlotPlacement, d as FieldSize, e as FieldDensity, f as ValidateResult, g as ChangeDetail, h as VariantValueFor, i as VariantPropsFor, j as VariantModule, P as PhoneCountry, k as PasswordDefinitionMap, l as CustomFileLoader } from './variant-B_L0opEi.js';
|
|
2
|
+
export { B as BaseProps, r as ButtonRef, y as EffectiveFieldLayout, x as FieldLayoutConfig, w as FieldOrdering, v as FieldRootId, t as FieldRoots, u as FieldSlotId, s as FieldSlots, o as FormProps, m as InferFromSchema, I as InputNumber, q as InputStore, z as LayoutResolveContext, A as LayoutResolver, R as RelativeRootsMap, n as SubmitEvent, T as Textarea, p as ValuesResult, G as VariantEntry, M as VariantLayoutDefaults, N as VariantModuleFor, K as VariantValidateFn, J as Variants } from './variant-B_L0opEi.js';
|
|
3
3
|
import { A as AdapterKey } from './adapter-CvjXO9Gi.js';
|
|
4
4
|
export { a as AdapterCallbacks, c as AdapterConfig, h as AdapterError, d as AdapterFactory, g as AdapterOk, f as AdapterProps, b as AdapterResult, i as AdapterSubmit, e as Adapters, M as Method, N as NamedAdapterConfig, j as NamedAdapterFactory } from './adapter-CvjXO9Gi.js';
|
|
5
5
|
export { createAxiosAdapter, createInertiaAdapter, getAdapter, hasAdapter, localAdapter, registerAdapter, registerAllAdapters, registerAxiosAdapter, registerInertiaAdapter, registerKnownAdapter } from './adapters.js';
|
package/dist/index.js
CHANGED
|
@@ -19701,6 +19701,7 @@ var FileThumbnail = ({ item }) => {
|
|
|
19701
19701
|
) : /* @__PURE__ */ jsxRuntime.jsx(File2, { className: "h-4 w-4 text-muted-foreground/50" }) });
|
|
19702
19702
|
};
|
|
19703
19703
|
var ShadcnFileVariant = React68__namespace.forwardRef(function ShadcnFileVariant2(props, ref) {
|
|
19704
|
+
var _a;
|
|
19704
19705
|
const {
|
|
19705
19706
|
value,
|
|
19706
19707
|
onValue,
|
|
@@ -19727,6 +19728,7 @@ var ShadcnFileVariant = React68__namespace.forwardRef(function ShadcnFileVariant
|
|
|
19727
19728
|
formatFileSize = formatSizeDefault,
|
|
19728
19729
|
placeholder = "Select file...",
|
|
19729
19730
|
className,
|
|
19731
|
+
custom,
|
|
19730
19732
|
dropAreaClassName,
|
|
19731
19733
|
listClassName,
|
|
19732
19734
|
triggerClassName,
|
|
@@ -19752,7 +19754,7 @@ var ShadcnFileVariant = React68__namespace.forwardRef(function ShadcnFileVariant
|
|
|
19752
19754
|
} = props;
|
|
19753
19755
|
const joinControls = mode === "default" ? joinControlsProp != null ? joinControlsProp : true : false;
|
|
19754
19756
|
const extendBoxToControls = mode === "default" ? extendBoxToControlsProp != null ? extendBoxToControlsProp : true : false;
|
|
19755
|
-
const items = value != null ?
|
|
19757
|
+
const items = (_a = toArray(value)) != null ? _a : [];
|
|
19756
19758
|
const isDisabled = Boolean(disabled || readOnly);
|
|
19757
19759
|
const [dragOver, setDragOver] = React68__namespace.useState(false);
|
|
19758
19760
|
const [selectedIds, setSelectedIds] = React68__namespace.useState(
|
|
@@ -19836,12 +19838,16 @@ var ShadcnFileVariant = React68__namespace.forwardRef(function ShadcnFileVariant
|
|
|
19836
19838
|
setSelectedIds(/* @__PURE__ */ new Set());
|
|
19837
19839
|
}, [emitChange, items, selectedIds]);
|
|
19838
19840
|
const openPicker = React68__namespace.useCallback(async () => {
|
|
19839
|
-
var
|
|
19841
|
+
var _a2;
|
|
19840
19842
|
if (isDisabled) return;
|
|
19841
|
-
let resolvedLoader = customLoader != null ? customLoader : getPaletteUtil("customLoader");
|
|
19843
|
+
let resolvedLoader = customLoader != null ? customLoader : custom && getPaletteUtil("customLoader");
|
|
19842
19844
|
if (resolvedLoader) {
|
|
19843
19845
|
try {
|
|
19844
|
-
const result = await resolvedLoader({
|
|
19846
|
+
const result = await resolvedLoader({
|
|
19847
|
+
multiple,
|
|
19848
|
+
current: items,
|
|
19849
|
+
allowedTypes: toArray(accept)
|
|
19850
|
+
});
|
|
19845
19851
|
if (!result) return;
|
|
19846
19852
|
const normalized = toArray(result).map(normaliseFileLike);
|
|
19847
19853
|
if (mergeMode === "replace" || !multiple) {
|
|
@@ -19857,7 +19863,7 @@ var ShadcnFileVariant = React68__namespace.forwardRef(function ShadcnFileVariant
|
|
|
19857
19863
|
}
|
|
19858
19864
|
return;
|
|
19859
19865
|
}
|
|
19860
|
-
(
|
|
19866
|
+
(_a2 = fileInputRef.current) == null ? void 0 : _a2.click();
|
|
19861
19867
|
}, [
|
|
19862
19868
|
customLoader,
|
|
19863
19869
|
emitChange,
|
|
@@ -19876,18 +19882,18 @@ var ShadcnFileVariant = React68__namespace.forwardRef(function ShadcnFileVariant
|
|
|
19876
19882
|
);
|
|
19877
19883
|
const onDrop = React68__namespace.useCallback(
|
|
19878
19884
|
(e4) => {
|
|
19879
|
-
var
|
|
19885
|
+
var _a2;
|
|
19880
19886
|
e4.preventDefault();
|
|
19881
19887
|
setDragOver(false);
|
|
19882
|
-
if (isDisabled || !((
|
|
19888
|
+
if (isDisabled || !((_a2 = e4.dataTransfer.files) == null ? void 0 : _a2.length)) return;
|
|
19883
19889
|
const files = normaliseFromFiles(e4.dataTransfer.files);
|
|
19884
19890
|
handleAddItems(files, "drop");
|
|
19885
19891
|
},
|
|
19886
19892
|
[handleAddItems, isDisabled]
|
|
19887
19893
|
);
|
|
19888
19894
|
const onNativeChange = (e4) => {
|
|
19889
|
-
var
|
|
19890
|
-
if ((
|
|
19895
|
+
var _a2;
|
|
19896
|
+
if ((_a2 = e4.target.files) == null ? void 0 : _a2.length) {
|
|
19891
19897
|
handleAddItems(normaliseFromFiles(e4.target.files), "input");
|
|
19892
19898
|
}
|
|
19893
19899
|
e4.target.value = "";
|
|
@@ -19901,8 +19907,8 @@ var ShadcnFileVariant = React68__namespace.forwardRef(function ShadcnFileVariant
|
|
|
19901
19907
|
const [preview2, setPreview] = React68__namespace.useState(null);
|
|
19902
19908
|
const [isOpen, setIsOpen] = React68__namespace.useState(false);
|
|
19903
19909
|
React68__namespace.useEffect(() => {
|
|
19904
|
-
var
|
|
19905
|
-
const isImage2 = ((
|
|
19910
|
+
var _a2;
|
|
19911
|
+
const isImage2 = ((_a2 = item.type) == null ? void 0 : _a2.startsWith("image/")) || item.name.match(/\.(jpg|jpeg|png|gif|webp)$/i);
|
|
19906
19912
|
if (!isImage2) {
|
|
19907
19913
|
setPreview(null);
|
|
19908
19914
|
return;
|
|
@@ -20288,7 +20294,7 @@ var ShadcnFileVariant = React68__namespace.forwardRef(function ShadcnFileVariant
|
|
|
20288
20294
|
),
|
|
20289
20295
|
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
20290
20296
|
items.map((item) => {
|
|
20291
|
-
var
|
|
20297
|
+
var _a2;
|
|
20292
20298
|
const selected = selectedIds.has(item.id);
|
|
20293
20299
|
const toggle = () => {
|
|
20294
20300
|
const next = new Set(selectedIds);
|
|
@@ -20315,7 +20321,7 @@ var ShadcnFileVariant = React68__namespace.forwardRef(function ShadcnFileVariant
|
|
|
20315
20321
|
),
|
|
20316
20322
|
/* @__PURE__ */ jsxRuntime.jsx(FileThumbnail, { item }),
|
|
20317
20323
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
20318
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "truncate font-medium", children: (
|
|
20324
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "truncate font-medium", children: (_a2 = formatFileName == null ? void 0 : formatFileName(item)) != null ? _a2 : item.name }),
|
|
20319
20325
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
|
|
20320
20326
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: formatFileSize(
|
|
20321
20327
|
item.size
|
|
@@ -20433,7 +20439,7 @@ var ShadcnFileVariant = React68__namespace.forwardRef(function ShadcnFileVariant
|
|
|
20433
20439
|
] })
|
|
20434
20440
|
] }),
|
|
20435
20441
|
/* @__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) => {
|
|
20436
|
-
var
|
|
20442
|
+
var _a2;
|
|
20437
20443
|
const selected = selectedIds.has(item.id);
|
|
20438
20444
|
const toggle = () => {
|
|
20439
20445
|
const next = new Set(selectedIds);
|
|
@@ -20468,7 +20474,7 @@ var ShadcnFileVariant = React68__namespace.forwardRef(function ShadcnFileVariant
|
|
|
20468
20474
|
),
|
|
20469
20475
|
/* @__PURE__ */ jsxRuntime.jsx(FileThumbnail, { item }),
|
|
20470
20476
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1 space-y-1", children: [
|
|
20471
|
-
/* @__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: (
|
|
20477
|
+
/* @__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 }) }),
|
|
20472
20478
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
|
|
20473
20479
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: formatFileSize(item.size) }),
|
|
20474
20480
|
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" }) }),
|