@timeax/form-palette 0.0.7 → 0.0.9
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/adapters.d.mts +73 -51
- package/dist/adapters.d.ts +73 -51
- package/dist/adapters.js +1 -1
- package/dist/adapters.js.map +1 -1
- package/dist/adapters.mjs +1 -1
- package/dist/adapters.mjs.map +1 -1
- package/dist/index.d.mts +13 -16
- package/dist/index.d.ts +13 -16
- package/dist/index.js +70 -18
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +70 -18
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -13412,6 +13412,25 @@ var FieldRegistry = class {
|
|
|
13412
13412
|
}
|
|
13413
13413
|
};
|
|
13414
13414
|
_binding = new WeakMap();
|
|
13415
|
+
var CORE_PROP_KEYS = /* @__PURE__ */ new Set([
|
|
13416
|
+
"adapter",
|
|
13417
|
+
"schema",
|
|
13418
|
+
"exceptions",
|
|
13419
|
+
"persist",
|
|
13420
|
+
"name",
|
|
13421
|
+
"activateButtonOnChange",
|
|
13422
|
+
"onChange",
|
|
13423
|
+
"onUpdate",
|
|
13424
|
+
"changeBefore",
|
|
13425
|
+
"formRef",
|
|
13426
|
+
"valueBag",
|
|
13427
|
+
"valueFeed",
|
|
13428
|
+
"onFinish",
|
|
13429
|
+
"init",
|
|
13430
|
+
"onSubmit",
|
|
13431
|
+
"onSubmitted",
|
|
13432
|
+
"children"
|
|
13433
|
+
]);
|
|
13415
13434
|
function isPlainObject(value) {
|
|
13416
13435
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
13417
13436
|
}
|
|
@@ -13572,7 +13591,16 @@ function CoreProvider(props) {
|
|
|
13572
13591
|
}
|
|
13573
13592
|
return valid;
|
|
13574
13593
|
}
|
|
13575
|
-
|
|
13594
|
+
function getAdapterPropsFrom(current) {
|
|
13595
|
+
const result = {};
|
|
13596
|
+
for (const key in current) {
|
|
13597
|
+
if (!CORE_PROP_KEYS.has(key)) {
|
|
13598
|
+
result[key] = current[key];
|
|
13599
|
+
}
|
|
13600
|
+
}
|
|
13601
|
+
return result;
|
|
13602
|
+
}
|
|
13603
|
+
async function submitWithAdapter(adapterOverride, extra, ignoreForm, autoErr = true, autoRun = true) {
|
|
13576
13604
|
var _a2, _b;
|
|
13577
13605
|
const currentProps = propsRef.current;
|
|
13578
13606
|
const btn = buttonRef.current;
|
|
@@ -13604,6 +13632,10 @@ function CoreProvider(props) {
|
|
|
13604
13632
|
...collectValues(),
|
|
13605
13633
|
...extra != null ? extra : {}
|
|
13606
13634
|
};
|
|
13635
|
+
let adapterConfig = {
|
|
13636
|
+
...getAdapterPropsFrom(currentProps),
|
|
13637
|
+
...adapterOverride
|
|
13638
|
+
};
|
|
13607
13639
|
const event = {
|
|
13608
13640
|
preventDefault() {
|
|
13609
13641
|
this.continue = false;
|
|
@@ -13614,11 +13646,15 @@ function CoreProvider(props) {
|
|
|
13614
13646
|
submissionValues = result;
|
|
13615
13647
|
}
|
|
13616
13648
|
},
|
|
13617
|
-
|
|
13618
|
-
|
|
13619
|
-
|
|
13620
|
-
|
|
13621
|
-
|
|
13649
|
+
setConfig(arg1, arg2) {
|
|
13650
|
+
if (typeof arg1 === "string") {
|
|
13651
|
+
adapterConfig[arg1] = arg2;
|
|
13652
|
+
} else if (arg1 && typeof arg1 === "object") {
|
|
13653
|
+
adapterConfig = {
|
|
13654
|
+
...adapterConfig,
|
|
13655
|
+
...arg1
|
|
13656
|
+
};
|
|
13657
|
+
}
|
|
13622
13658
|
},
|
|
13623
13659
|
button: (_a2 = buttonRef.current) != null ? _a2 : void 0,
|
|
13624
13660
|
get formData() {
|
|
@@ -13641,8 +13677,9 @@ function CoreProvider(props) {
|
|
|
13641
13677
|
}
|
|
13642
13678
|
const factory2 = (_b = getAdapter(adapterKey)) != null ? _b : localAdapter;
|
|
13643
13679
|
const adapter2 = factory2({
|
|
13644
|
-
method,
|
|
13645
|
-
|
|
13680
|
+
// adapter-specific config (url, method, config, etc.)
|
|
13681
|
+
...adapterConfig,
|
|
13682
|
+
// core config
|
|
13646
13683
|
data: submissionValues,
|
|
13647
13684
|
callbacks: {
|
|
13648
13685
|
onSuccess(ok) {
|
|
@@ -13802,9 +13839,12 @@ function CoreProvider(props) {
|
|
|
13802
13839
|
return !deepEqual(original, current);
|
|
13803
13840
|
},
|
|
13804
13841
|
async prepare(type, route, extra, ignoreForm, autoErr) {
|
|
13842
|
+
const override = {
|
|
13843
|
+
method: type,
|
|
13844
|
+
url: route
|
|
13845
|
+
};
|
|
13805
13846
|
return submitWithAdapter(
|
|
13806
|
-
|
|
13807
|
-
route,
|
|
13847
|
+
override,
|
|
13808
13848
|
extra,
|
|
13809
13849
|
ignoreForm,
|
|
13810
13850
|
autoErr,
|
|
@@ -13910,7 +13950,13 @@ function CoreProvider(props) {
|
|
|
13910
13950
|
}
|
|
13911
13951
|
},
|
|
13912
13952
|
go(data, ignoreForm) {
|
|
13913
|
-
void submitWithAdapter(
|
|
13953
|
+
void submitWithAdapter(
|
|
13954
|
+
void 0,
|
|
13955
|
+
data,
|
|
13956
|
+
ignoreForm,
|
|
13957
|
+
true,
|
|
13958
|
+
true
|
|
13959
|
+
);
|
|
13914
13960
|
},
|
|
13915
13961
|
reset(inputs) {
|
|
13916
13962
|
if (!inputs.length) return;
|
|
@@ -13932,7 +13978,13 @@ function CoreProvider(props) {
|
|
|
13932
13978
|
buttonRef.current = btn;
|
|
13933
13979
|
},
|
|
13934
13980
|
async forceSubmit() {
|
|
13935
|
-
await submitWithAdapter(
|
|
13981
|
+
await submitWithAdapter(
|
|
13982
|
+
void 0,
|
|
13983
|
+
void 0,
|
|
13984
|
+
false,
|
|
13985
|
+
true,
|
|
13986
|
+
true
|
|
13987
|
+
);
|
|
13936
13988
|
},
|
|
13937
13989
|
get fields() {
|
|
13938
13990
|
return fetchAllNamedFields();
|
|
@@ -18344,7 +18396,7 @@ var Input = React54.forwardRef(
|
|
|
18344
18396
|
);
|
|
18345
18397
|
const baseBoxClasses = cx(
|
|
18346
18398
|
"file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30",
|
|
18347
|
-
"border-input w-full min-w-0 rounded-md border bg-transparent shadow-xs",
|
|
18399
|
+
"border-input w-full min-w-0 rounded-md border bg-[var(--surfaces-input, transparent)] shadow-xs",
|
|
18348
18400
|
"transition-[color,box-shadow] outline-none",
|
|
18349
18401
|
"file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium",
|
|
18350
18402
|
"disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",
|
|
@@ -26335,7 +26387,7 @@ function SelectTrigger2({
|
|
|
26335
26387
|
"data-slot": "select-trigger",
|
|
26336
26388
|
"data-size": size4,
|
|
26337
26389
|
className: cn(
|
|
26338
|
-
"border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
26390
|
+
"border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-[var(--surfaces-input, transparent)] px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
26339
26391
|
className
|
|
26340
26392
|
),
|
|
26341
26393
|
...props,
|
|
@@ -33481,7 +33533,7 @@ var Textarea = React54.forwardRef(
|
|
|
33481
33533
|
const frameClasses = cn(
|
|
33482
33534
|
"border-input placeholder:text-muted-foreground focus-within:border-ring focus-within:ring-ring/50 focus-within:ring-[3px]",
|
|
33483
33535
|
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
33484
|
-
"dark:bg-input/30 rounded-md border bg-transparent shadow-xs transition-[color,box-shadow] outline-none",
|
|
33536
|
+
"dark:bg-input/30 rounded-md border bg-[var(--surfaces-input, transparent)] shadow-xs transition-[color,box-shadow] outline-none",
|
|
33485
33537
|
"disabled:cursor-not-allowed disabled:opacity-50"
|
|
33486
33538
|
);
|
|
33487
33539
|
const framePaddingClasses = cn(
|
|
@@ -41543,7 +41595,7 @@ var ShadcnFileVariant = React54.forwardRef(
|
|
|
41543
41595
|
className: cn(
|
|
41544
41596
|
"relative flex w-full cursor-pointer items-center gap-2 px-3 transition-all",
|
|
41545
41597
|
heightCls,
|
|
41546
|
-
(!joinControls || !hasExternalControls) && "rounded-md border border-input bg-
|
|
41598
|
+
(!joinControls || !hasExternalControls) && "rounded-md border border-input bg-[var(--surfaces-input, transparent)] shadow-xs ring-offset-background hover:bg-accent/5 focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2",
|
|
41547
41599
|
dragOver && "border-primary ring-2 ring-primary/20",
|
|
41548
41600
|
isDisabled && "cursor-not-allowed opacity-50",
|
|
41549
41601
|
error && "border-destructive text-destructive",
|
|
@@ -41746,7 +41798,7 @@ var ShadcnFileVariant = React54.forwardRef(
|
|
|
41746
41798
|
children: [
|
|
41747
41799
|
/* @__PURE__ */ jsxs("div", { className: cn(
|
|
41748
41800
|
"flex w-full",
|
|
41749
|
-
joinControls && extendBoxToControls && !showDropArea ? "items-stretch rounded-md border border-input bg-
|
|
41801
|
+
joinControls && extendBoxToControls && !showDropArea ? "items-stretch rounded-md border border-input bg-[var(--surfaces-input, transparent)] shadow-xs ring-offset-background focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2" : "items-start gap-2"
|
|
41750
41802
|
), children: [
|
|
41751
41803
|
leadingControl && /* @__PURE__ */ jsx("div", { className: cn(
|
|
41752
41804
|
"flex items-center",
|
|
@@ -42815,7 +42867,7 @@ function normalizeInertiaError(raw) {
|
|
|
42815
42867
|
return raw;
|
|
42816
42868
|
}
|
|
42817
42869
|
var createInertiaAdapter = (config3) => {
|
|
42818
|
-
const { method, url, data, callbacks } = config3;
|
|
42870
|
+
const { method = "post", url, data, callbacks } = config3;
|
|
42819
42871
|
const upperMethod = method.toUpperCase();
|
|
42820
42872
|
function buildOptions(resolve, reject, extraOptions) {
|
|
42821
42873
|
const merged = {
|