@dragonmastery/zinia-forms-core 0.3.9 → 0.3.10
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/index.d.ts +15 -0
- package/dist/index.js +296 -392
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3787,26 +3787,14 @@ function createDaisyUIArrayField() {
|
|
|
3787
3787
|
formState.pendingOperations[fieldName] = [];
|
|
3788
3788
|
}
|
|
3789
3789
|
const pendingOperations = formState.pendingOperations[fieldName];
|
|
3790
|
-
const createPendingOperation = (type, previousState, currentState, index
|
|
3790
|
+
const createPendingOperation = (type, previousState, currentState, index) => {
|
|
3791
3791
|
if (!inlineUndo) return null;
|
|
3792
|
-
if (type === "add" || type === "swap") {
|
|
3793
|
-
const existingOps = pendingOperations.filter((op) => op.type === type);
|
|
3794
|
-
existingOps.forEach((op) => {
|
|
3795
|
-
if (op.timeoutId) {
|
|
3796
|
-
clearTimeout(op.timeoutId);
|
|
3797
|
-
}
|
|
3798
|
-
});
|
|
3799
|
-
formState.pendingOperations[fieldName] = pendingOperations.filter((op) => op.type !== type);
|
|
3800
|
-
}
|
|
3801
3792
|
const timestamp = Date.now();
|
|
3802
3793
|
const initialRemaining = inlineUndoTimeout > 0 ? inlineUndoTimeout : 0;
|
|
3803
3794
|
const initialProgress = 0;
|
|
3804
3795
|
const operation = {
|
|
3805
|
-
type,
|
|
3796
|
+
type: "remove",
|
|
3806
3797
|
index,
|
|
3807
|
-
indexA,
|
|
3808
|
-
indexB,
|
|
3809
|
-
item,
|
|
3810
3798
|
previousState: JSON.parse(JSON.stringify(previousState)),
|
|
3811
3799
|
currentState: JSON.parse(JSON.stringify(currentState)),
|
|
3812
3800
|
timestamp,
|
|
@@ -3821,41 +3809,23 @@ function createDaisyUIArrayField() {
|
|
|
3821
3809
|
const timeoutId = window.setTimeout(() => {
|
|
3822
3810
|
const currentOps = formState.pendingOperations[fieldName] || [];
|
|
3823
3811
|
const currentPendingOp = currentOps.find((op) => op.timestamp === operation.timestamp);
|
|
3824
|
-
if (currentPendingOp) {
|
|
3812
|
+
if (currentPendingOp && currentPendingOp.type === "remove" && currentPendingOp.index !== void 0) {
|
|
3825
3813
|
const currentActualArray = formState.getValue(props.name) || [];
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
props.onRemoveItem(currentPendingOp.index);
|
|
3837
|
-
}
|
|
3838
|
-
}
|
|
3839
|
-
} else {
|
|
3840
|
-
formState.setValue(props.name, currentPendingOp.currentState);
|
|
3841
|
-
formState.validateField(props.name);
|
|
3842
|
-
const instance = getCurrentInstance();
|
|
3843
|
-
if (instance) {
|
|
3844
|
-
if (currentPendingOp.type === "add" && currentPendingOp.item) {
|
|
3845
|
-
instance.emit("item-added", currentPendingOp.item);
|
|
3846
|
-
if (props.onAddItem) {
|
|
3847
|
-
props.onAddItem(currentPendingOp.item);
|
|
3848
|
-
}
|
|
3849
|
-
} else if (currentPendingOp.type === "swap" && currentPendingOp.indexA !== void 0 && currentPendingOp.indexB !== void 0) {
|
|
3850
|
-
const currentArray = formState.getValue(props.name) || [];
|
|
3851
|
-
instance.emit("items-swapped", currentPendingOp.indexA, currentPendingOp.indexB, currentArray[currentPendingOp.indexA], currentArray[currentPendingOp.indexB]);
|
|
3852
|
-
if (props.onSwapItems) {
|
|
3853
|
-
props.onSwapItems(currentPendingOp.indexA, currentPendingOp.indexB);
|
|
3854
|
-
}
|
|
3855
|
-
}
|
|
3814
|
+
const newArray = [...currentActualArray];
|
|
3815
|
+
const removedItem = newArray[currentPendingOp.index];
|
|
3816
|
+
newArray.splice(currentPendingOp.index, 1);
|
|
3817
|
+
formState.setValue(props.name, newArray);
|
|
3818
|
+
formState.validateField(props.name);
|
|
3819
|
+
const instance = getCurrentInstance();
|
|
3820
|
+
if (instance) {
|
|
3821
|
+
instance.emit("item-removed", removedItem, currentPendingOp.index);
|
|
3822
|
+
if (props.onRemoveItem) {
|
|
3823
|
+
props.onRemoveItem(currentPendingOp.index);
|
|
3856
3824
|
}
|
|
3857
3825
|
}
|
|
3858
|
-
formState.pendingOperations[fieldName] = currentOps.filter(
|
|
3826
|
+
formState.pendingOperations[fieldName] = currentOps.filter(
|
|
3827
|
+
(op) => op.timestamp !== operation.timestamp
|
|
3828
|
+
);
|
|
3859
3829
|
if (currentPendingOp.type === "remove" && currentPendingOp.index !== void 0) {
|
|
3860
3830
|
const removedIndex = currentPendingOp.index;
|
|
3861
3831
|
const remainingOps = formState.pendingOperations[fieldName];
|
|
@@ -3900,37 +3870,18 @@ function createDaisyUIArrayField() {
|
|
|
3900
3870
|
if (opToConfirm.timeoutId) {
|
|
3901
3871
|
clearTimeout(opToConfirm.timeoutId);
|
|
3902
3872
|
}
|
|
3873
|
+
if (opToConfirm.type !== "remove" || opToConfirm.index === void 0) return;
|
|
3903
3874
|
const currentActualArray = formState.getValue(props.name) || [];
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
props.onRemoveItem(opToConfirm.index);
|
|
3915
|
-
}
|
|
3916
|
-
}
|
|
3917
|
-
} else {
|
|
3918
|
-
formState.setValue(props.name, opToConfirm.currentState);
|
|
3919
|
-
formState.validateField(props.name);
|
|
3920
|
-
const instance = getCurrentInstance();
|
|
3921
|
-
if (instance) {
|
|
3922
|
-
if (opToConfirm.type === "add" && opToConfirm.item) {
|
|
3923
|
-
instance.emit("item-added", opToConfirm.item);
|
|
3924
|
-
if (props.onAddItem) {
|
|
3925
|
-
props.onAddItem(opToConfirm.item);
|
|
3926
|
-
}
|
|
3927
|
-
} else if (opToConfirm.type === "swap" && opToConfirm.indexA !== void 0 && opToConfirm.indexB !== void 0) {
|
|
3928
|
-
const currentArray = formState.getValue(props.name) || [];
|
|
3929
|
-
instance.emit("items-swapped", opToConfirm.indexA, opToConfirm.indexB, currentArray[opToConfirm.indexA], currentArray[opToConfirm.indexB]);
|
|
3930
|
-
if (props.onSwapItems) {
|
|
3931
|
-
props.onSwapItems(opToConfirm.indexA, opToConfirm.indexB);
|
|
3932
|
-
}
|
|
3933
|
-
}
|
|
3875
|
+
const newArray = [...currentActualArray];
|
|
3876
|
+
const removedItem = newArray[opToConfirm.index];
|
|
3877
|
+
newArray.splice(opToConfirm.index, 1);
|
|
3878
|
+
formState.setValue(props.name, newArray);
|
|
3879
|
+
formState.validateField(props.name);
|
|
3880
|
+
const instance = getCurrentInstance();
|
|
3881
|
+
if (instance) {
|
|
3882
|
+
instance.emit("item-removed", removedItem, opToConfirm.index);
|
|
3883
|
+
if (props.onRemoveItem) {
|
|
3884
|
+
props.onRemoveItem(opToConfirm.index);
|
|
3934
3885
|
}
|
|
3935
3886
|
}
|
|
3936
3887
|
formState.pendingOperations[fieldName] = ops.filter((op) => op.timestamp !== opToConfirm.timestamp);
|
|
@@ -3966,6 +3917,7 @@ function createDaisyUIArrayField() {
|
|
|
3966
3917
|
opToCancel = ops.length > 0 ? ops[ops.length - 1] : null;
|
|
3967
3918
|
}
|
|
3968
3919
|
if (!opToCancel) return;
|
|
3920
|
+
if (opToCancel.type !== "remove") return;
|
|
3969
3921
|
if (opToCancel.timeoutId) {
|
|
3970
3922
|
clearTimeout(opToCancel.timeoutId);
|
|
3971
3923
|
}
|
|
@@ -3983,23 +3935,13 @@ function createDaisyUIArrayField() {
|
|
|
3983
3935
|
}
|
|
3984
3936
|
});
|
|
3985
3937
|
};
|
|
3986
|
-
if (process.env.NODE_ENV === "development") {
|
|
3987
|
-
console.log("[ArrayFieldDaisy] createItem prop:", !!props.createItem, "for field:", props.name);
|
|
3988
|
-
}
|
|
3989
3938
|
const addItem = (item) => {
|
|
3990
3939
|
const currentArray = [...arrayValue];
|
|
3991
3940
|
if (maxItems !== void 0 && currentArray.length >= maxItems) {
|
|
3992
3941
|
return;
|
|
3993
3942
|
}
|
|
3994
|
-
const previousState = [...currentArray];
|
|
3995
3943
|
const itemCopy = JSON.parse(JSON.stringify(item));
|
|
3996
3944
|
const newArray = [...currentArray, itemCopy];
|
|
3997
|
-
if (inlineUndo) {
|
|
3998
|
-
createPendingOperation("add", previousState, newArray, newArray.length - 1, void 0, void 0, itemCopy);
|
|
3999
|
-
formState.setValue(props.name, newArray);
|
|
4000
|
-
formState.validateField(props.name);
|
|
4001
|
-
return;
|
|
4002
|
-
}
|
|
4003
3945
|
formState.setValue(props.name, newArray);
|
|
4004
3946
|
formState.validateField(props.name);
|
|
4005
3947
|
if (props.onAddItem) {
|
|
@@ -4038,17 +3980,10 @@ function createDaisyUIArrayField() {
|
|
|
4038
3980
|
return;
|
|
4039
3981
|
}
|
|
4040
3982
|
const currentArray = [...arrayValue];
|
|
4041
|
-
const previousState = [...currentArray];
|
|
4042
3983
|
const newArray = [...currentArray];
|
|
4043
3984
|
const temp = newArray[indexA];
|
|
4044
3985
|
newArray[indexA] = newArray[indexB];
|
|
4045
3986
|
newArray[indexB] = temp;
|
|
4046
|
-
if (inlineUndo) {
|
|
4047
|
-
createPendingOperation("swap", previousState, newArray, void 0, indexA, indexB);
|
|
4048
|
-
formState.setValue(props.name, newArray);
|
|
4049
|
-
formState.validateField(props.name);
|
|
4050
|
-
return;
|
|
4051
|
-
}
|
|
4052
3987
|
formState.setValue(props.name, newArray);
|
|
4053
3988
|
formState.validateField(props.name);
|
|
4054
3989
|
if (props.onSwapItems) {
|
|
@@ -4139,328 +4074,261 @@ function createDaisyUIArrayField() {
|
|
|
4139
4074
|
const renderSelectedItems = () => {
|
|
4140
4075
|
if (arrayValue.length === 0) {
|
|
4141
4076
|
return /* @__PURE__ */ jsx("div", { class: "mt-4 sm:mt-6", children: /* @__PURE__ */ jsx("div", { class: "text-center py-8 sm:py-12 px-4 border border-dashed border-base-300 rounded-lg bg-base-50", children: /* @__PURE__ */ jsxs("p", { class: "text-sm sm:text-base text-base-content/60", children: [
|
|
4142
|
-
"No items added yet.
|
|
4077
|
+
"No items added yet.",
|
|
4078
|
+
" ",
|
|
4143
4079
|
props.createItem ? 'Click "Add New Item" below to get started.' : availableItems && availableItems.length > 0 ? "Select an item from above to add it." : ""
|
|
4144
4080
|
] }) }) });
|
|
4145
4081
|
}
|
|
4146
|
-
return /* @__PURE__ */
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
const startWidth = itemPendingOp.animationStartWidth ?? 0;
|
|
4167
|
-
return /* @__PURE__ */ jsx(
|
|
4168
|
-
"div",
|
|
4169
|
-
{
|
|
4170
|
-
class: "border-2 border-warning rounded-lg bg-warning/10 shadow-sm",
|
|
4171
|
-
children: /* @__PURE__ */ jsx("div", { class: "p-3 sm:p-4", children: /* @__PURE__ */ jsxs("div", { class: "flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 sm:gap-4", children: [
|
|
4172
|
-
/* @__PURE__ */ jsxs("div", { class: "flex-1 w-full", children: [
|
|
4173
|
-
/* @__PURE__ */ jsx("p", { class: "text-sm sm:text-base font-semibold text-warning mb-1", children: "Item removed" }),
|
|
4174
|
-
/* @__PURE__ */ jsx("p", { class: "text-xs sm:text-sm text-base-content/70 mb-2", children: getItemPreview(item, index) || `Item #${index + 1}` }),
|
|
4175
|
-
inlineUndoTimeout > 0 && /* @__PURE__ */ jsxs("div", { class: "w-full", children: [
|
|
4176
|
-
/* @__PURE__ */ jsx(
|
|
4177
|
-
"div",
|
|
4178
|
-
{
|
|
4179
|
-
class: "w-full h-2 bg-warning/20 rounded-full overflow-hidden",
|
|
4180
|
-
children: /* @__PURE__ */ jsx(
|
|
4181
|
-
"div",
|
|
4182
|
-
{
|
|
4183
|
-
class: "h-full bg-warning rounded-full",
|
|
4184
|
-
style: `--start-width: ${startWidth}%; animation: progress-fill ${animationDuration}ms linear forwards;`
|
|
4185
|
-
}
|
|
4186
|
-
)
|
|
4187
|
-
}
|
|
4188
|
-
),
|
|
4189
|
-
/* @__PURE__ */ jsxs("p", { class: "text-xs text-base-content/60 mt-1", children: [
|
|
4190
|
-
"Auto-confirming in ",
|
|
4191
|
-
remainingSeconds,
|
|
4192
|
-
"s"
|
|
4193
|
-
] })
|
|
4194
|
-
] })
|
|
4195
|
-
] }),
|
|
4196
|
-
/* @__PURE__ */ jsxs("div", { class: "flex items-center gap-2 flex-shrink-0", children: [
|
|
4197
|
-
/* @__PURE__ */ jsxs(
|
|
4198
|
-
"button",
|
|
4199
|
-
{
|
|
4200
|
-
type: "button",
|
|
4201
|
-
class: "btn btn-sm btn-ghost min-h-[32px] sm:min-h-[36px] px-3 sm:px-4 text-xs sm:text-sm",
|
|
4202
|
-
onClick: () => cancelPendingOperation(index),
|
|
4203
|
-
"aria-label": "Undo removal",
|
|
4204
|
-
children: [
|
|
4205
|
-
/* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", class: "h-4 w-4 sm:h-5 sm:w-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx("path", { "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", d: "M3 10h10a8 8 0 018 8v2M3 10l6 6m-6-6l6-6" }) }),
|
|
4206
|
-
/* @__PURE__ */ jsx("span", { class: "ml-1", children: "Undo" })
|
|
4207
|
-
]
|
|
4208
|
-
}
|
|
4209
|
-
),
|
|
4210
|
-
/* @__PURE__ */ jsxs(
|
|
4211
|
-
"button",
|
|
4082
|
+
return /* @__PURE__ */ jsx("div", { class: "mt-4 sm:mt-6", children: /* @__PURE__ */ jsx("div", { class: "space-y-3 sm:space-y-4", children: arrayValue.map((item, index) => {
|
|
4083
|
+
const isItemCollapsed = collapseState.collapsedItems.includes(index);
|
|
4084
|
+
const itemPendingOp = inlineUndo ? pendingOperations.find((op) => op.type === "remove" && op.index === index) : null;
|
|
4085
|
+
if (itemPendingOp && itemPendingOp.type === "remove" && itemPendingOp.index === index) {
|
|
4086
|
+
const elapsed = Date.now() - itemPendingOp.timestamp;
|
|
4087
|
+
const remaining = Math.max(0, inlineUndoTimeout - elapsed);
|
|
4088
|
+
const remainingSeconds = Math.ceil(remaining / 1e3);
|
|
4089
|
+
const animationDuration = itemPendingOp.animationDuration ?? inlineUndoTimeout;
|
|
4090
|
+
const startWidth = itemPendingOp.animationStartWidth ?? 0;
|
|
4091
|
+
return /* @__PURE__ */ jsx(
|
|
4092
|
+
"div",
|
|
4093
|
+
{
|
|
4094
|
+
class: "border-2 border-warning rounded-lg bg-warning/10 shadow-sm",
|
|
4095
|
+
children: /* @__PURE__ */ jsx("div", { class: "p-3 sm:p-4", children: /* @__PURE__ */ jsxs("div", { class: "flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 sm:gap-4", children: [
|
|
4096
|
+
/* @__PURE__ */ jsxs("div", { class: "flex-1 w-full", children: [
|
|
4097
|
+
/* @__PURE__ */ jsx("p", { class: "text-sm sm:text-base font-semibold text-warning mb-1", children: "Item removed" }),
|
|
4098
|
+
/* @__PURE__ */ jsx("p", { class: "text-xs sm:text-sm text-base-content/70 mb-2", children: getItemPreview(item, index) || `Item #${index + 1}` }),
|
|
4099
|
+
inlineUndoTimeout > 0 && /* @__PURE__ */ jsxs("div", { class: "w-full", children: [
|
|
4100
|
+
/* @__PURE__ */ jsx("div", { class: "w-full h-2 bg-warning/20 rounded-full overflow-hidden", children: /* @__PURE__ */ jsx(
|
|
4101
|
+
"div",
|
|
4212
4102
|
{
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
onClick: () => confirmPendingOperation(index),
|
|
4216
|
-
"aria-label": "Confirm removal",
|
|
4217
|
-
children: [
|
|
4218
|
-
/* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", class: "h-4 w-4 sm:h-5 sm:w-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx("path", { "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", d: "M5 13l4 4L19 7" }) }),
|
|
4219
|
-
/* @__PURE__ */ jsx("span", { class: "ml-1", children: "Confirm" })
|
|
4220
|
-
]
|
|
4103
|
+
class: "h-full bg-warning rounded-full",
|
|
4104
|
+
style: `--start-width: ${startWidth}%; animation: progress-fill ${animationDuration}ms linear forwards;`
|
|
4221
4105
|
}
|
|
4222
|
-
)
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
);
|
|
4228
|
-
}
|
|
4229
|
-
if (itemPendingOp && itemPendingOp.type === "add" && itemPendingOp.index === index) {
|
|
4230
|
-
const elapsed = Date.now() - itemPendingOp.timestamp;
|
|
4231
|
-
const remaining = Math.max(0, inlineUndoTimeout - elapsed);
|
|
4232
|
-
const remainingSeconds = Math.ceil(remaining / 1e3);
|
|
4233
|
-
const animationDuration = itemPendingOp.animationDuration ?? inlineUndoTimeout;
|
|
4234
|
-
const startWidth = itemPendingOp.animationStartWidth ?? 0;
|
|
4235
|
-
return /* @__PURE__ */ jsx(
|
|
4236
|
-
"div",
|
|
4237
|
-
{
|
|
4238
|
-
class: "border-2 border-success rounded-lg bg-success/10 shadow-sm",
|
|
4239
|
-
children: /* @__PURE__ */ jsx("div", { class: "p-3 sm:p-4", children: /* @__PURE__ */ jsxs("div", { class: "flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 sm:gap-4", children: [
|
|
4240
|
-
/* @__PURE__ */ jsxs("div", { class: "flex-1 w-full", children: [
|
|
4241
|
-
/* @__PURE__ */ jsx("p", { class: "text-sm sm:text-base font-semibold text-success mb-1", children: "Item added" }),
|
|
4242
|
-
/* @__PURE__ */ jsx("p", { class: "text-xs sm:text-sm text-base-content/70 mb-2", children: getItemPreview(item, index) || `Item #${index + 1}` }),
|
|
4243
|
-
inlineUndoTimeout > 0 && /* @__PURE__ */ jsxs("div", { class: "w-full", children: [
|
|
4244
|
-
/* @__PURE__ */ jsx(
|
|
4245
|
-
"div",
|
|
4246
|
-
{
|
|
4247
|
-
class: "w-full h-2 bg-success/20 rounded-full overflow-hidden",
|
|
4248
|
-
children: /* @__PURE__ */ jsx(
|
|
4249
|
-
"div",
|
|
4250
|
-
{
|
|
4251
|
-
class: "h-full bg-success rounded-full",
|
|
4252
|
-
style: `--start-width: ${startWidth}%; animation: progress-fill ${animationDuration}ms linear forwards;`
|
|
4253
|
-
}
|
|
4254
|
-
)
|
|
4255
|
-
}
|
|
4256
|
-
),
|
|
4257
|
-
/* @__PURE__ */ jsxs("p", { class: "text-xs text-base-content/60 mt-1", children: [
|
|
4258
|
-
"Auto-confirming in ",
|
|
4259
|
-
remainingSeconds,
|
|
4260
|
-
"s"
|
|
4261
|
-
] })
|
|
4106
|
+
) }),
|
|
4107
|
+
/* @__PURE__ */ jsxs("p", { class: "text-xs text-base-content/60 mt-1", children: [
|
|
4108
|
+
"Auto-confirming in ",
|
|
4109
|
+
remainingSeconds,
|
|
4110
|
+
"s"
|
|
4262
4111
|
] })
|
|
4263
|
-
] }),
|
|
4264
|
-
/* @__PURE__ */ jsxs("div", { class: "flex items-center gap-2 flex-shrink-0", children: [
|
|
4265
|
-
/* @__PURE__ */ jsxs(
|
|
4266
|
-
"button",
|
|
4267
|
-
{
|
|
4268
|
-
type: "button",
|
|
4269
|
-
class: "btn btn-sm btn-ghost min-h-[32px] sm:min-h-[36px] px-3 sm:px-4 text-xs sm:text-sm",
|
|
4270
|
-
onClick: () => cancelPendingOperation(index),
|
|
4271
|
-
"aria-label": "Undo addition",
|
|
4272
|
-
children: [
|
|
4273
|
-
/* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", class: "h-4 w-4 sm:h-5 sm:w-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx("path", { "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", d: "M3 10h10a8 8 0 018 8v2M3 10l6 6m-6-6l6-6" }) }),
|
|
4274
|
-
/* @__PURE__ */ jsx("span", { class: "ml-1", children: "Undo" })
|
|
4275
|
-
]
|
|
4276
|
-
}
|
|
4277
|
-
),
|
|
4278
|
-
/* @__PURE__ */ jsxs(
|
|
4279
|
-
"button",
|
|
4280
|
-
{
|
|
4281
|
-
type: "button",
|
|
4282
|
-
class: "btn btn-sm btn-primary min-h-[32px] sm:min-h-[36px] px-3 sm:px-4 text-xs sm:text-sm",
|
|
4283
|
-
onClick: () => confirmPendingOperation(index),
|
|
4284
|
-
"aria-label": "Confirm addition",
|
|
4285
|
-
children: [
|
|
4286
|
-
/* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", class: "h-4 w-4 sm:h-5 sm:w-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx("path", { "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", d: "M5 13l4 4L19 7" }) }),
|
|
4287
|
-
/* @__PURE__ */ jsx("span", { class: "ml-1", children: "Confirm" })
|
|
4288
|
-
]
|
|
4289
|
-
}
|
|
4290
|
-
)
|
|
4291
4112
|
] })
|
|
4292
|
-
] })
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
|
|
4301
|
-
|
|
4302
|
-
const remainingSeconds = Math.ceil(remaining / 1e3);
|
|
4303
|
-
const animationDuration = itemPendingOp.animationDuration ?? inlineUndoTimeout;
|
|
4304
|
-
const startWidth = itemPendingOp.animationStartWidth ?? 0;
|
|
4305
|
-
return /* @__PURE__ */ jsx(
|
|
4306
|
-
"div",
|
|
4307
|
-
{
|
|
4308
|
-
class: "border-2 border-info rounded-lg bg-info/10 shadow-sm",
|
|
4309
|
-
children: /* @__PURE__ */ jsx("div", { class: "p-3 sm:p-4", children: /* @__PURE__ */ jsxs("div", { class: "flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 sm:gap-4", children: [
|
|
4310
|
-
/* @__PURE__ */ jsxs("div", { class: "flex-1 w-full", children: [
|
|
4311
|
-
/* @__PURE__ */ jsx("p", { class: "text-sm sm:text-base font-semibold text-info mb-1", children: "Item moved" }),
|
|
4312
|
-
/* @__PURE__ */ jsx("p", { class: "text-xs sm:text-sm text-base-content/70 mb-2", children: getItemPreview(item, index) || `Item #${index + 1}` }),
|
|
4313
|
-
inlineUndoTimeout > 0 && /* @__PURE__ */ jsxs("div", { class: "w-full", children: [
|
|
4113
|
+
] }),
|
|
4114
|
+
/* @__PURE__ */ jsxs("div", { class: "flex items-center gap-2 flex-shrink-0", children: [
|
|
4115
|
+
/* @__PURE__ */ jsxs(
|
|
4116
|
+
"button",
|
|
4117
|
+
{
|
|
4118
|
+
type: "button",
|
|
4119
|
+
class: "btn btn-sm btn-ghost min-h-[32px] sm:min-h-[36px] px-3 sm:px-4 text-xs sm:text-sm",
|
|
4120
|
+
onClick: () => cancelPendingOperation(index),
|
|
4121
|
+
"aria-label": "Undo removal",
|
|
4122
|
+
children: [
|
|
4314
4123
|
/* @__PURE__ */ jsx(
|
|
4315
|
-
"
|
|
4124
|
+
"svg",
|
|
4316
4125
|
{
|
|
4317
|
-
|
|
4126
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
4127
|
+
class: "h-4 w-4 sm:h-5 sm:w-5",
|
|
4128
|
+
fill: "none",
|
|
4129
|
+
viewBox: "0 0 24 24",
|
|
4130
|
+
stroke: "currentColor",
|
|
4318
4131
|
children: /* @__PURE__ */ jsx(
|
|
4319
|
-
"
|
|
4132
|
+
"path",
|
|
4320
4133
|
{
|
|
4321
|
-
|
|
4322
|
-
|
|
4134
|
+
"stroke-linecap": "round",
|
|
4135
|
+
"stroke-linejoin": "round",
|
|
4136
|
+
"stroke-width": "2",
|
|
4137
|
+
d: "M3 10h10a8 8 0 018 8v2M3 10l6 6m-6-6l6-6"
|
|
4323
4138
|
}
|
|
4324
4139
|
)
|
|
4325
4140
|
}
|
|
4326
4141
|
),
|
|
4327
|
-
/* @__PURE__ */
|
|
4328
|
-
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
|
|
4336
|
-
|
|
4337
|
-
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
|
|
4142
|
+
/* @__PURE__ */ jsx("span", { class: "ml-1", children: "Undo" })
|
|
4143
|
+
]
|
|
4144
|
+
}
|
|
4145
|
+
),
|
|
4146
|
+
/* @__PURE__ */ jsxs(
|
|
4147
|
+
"button",
|
|
4148
|
+
{
|
|
4149
|
+
type: "button",
|
|
4150
|
+
class: "btn btn-sm btn-primary min-h-[32px] sm:min-h-[36px] px-3 sm:px-4 text-xs sm:text-sm",
|
|
4151
|
+
onClick: () => confirmPendingOperation(index),
|
|
4152
|
+
"aria-label": "Confirm removal",
|
|
4153
|
+
children: [
|
|
4154
|
+
/* @__PURE__ */ jsx(
|
|
4155
|
+
"svg",
|
|
4156
|
+
{
|
|
4157
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
4158
|
+
class: "h-4 w-4 sm:h-5 sm:w-5",
|
|
4159
|
+
fill: "none",
|
|
4160
|
+
viewBox: "0 0 24 24",
|
|
4161
|
+
stroke: "currentColor",
|
|
4162
|
+
children: /* @__PURE__ */ jsx(
|
|
4163
|
+
"path",
|
|
4164
|
+
{
|
|
4165
|
+
"stroke-linecap": "round",
|
|
4166
|
+
"stroke-linejoin": "round",
|
|
4167
|
+
"stroke-width": "2",
|
|
4168
|
+
d: "M5 13l4 4L19 7"
|
|
4169
|
+
}
|
|
4170
|
+
)
|
|
4171
|
+
}
|
|
4172
|
+
),
|
|
4173
|
+
/* @__PURE__ */ jsx("span", { class: "ml-1", children: "Confirm" })
|
|
4174
|
+
]
|
|
4175
|
+
}
|
|
4176
|
+
)
|
|
4177
|
+
] })
|
|
4178
|
+
] }) })
|
|
4179
|
+
},
|
|
4180
|
+
`remove-${itemPendingOp.timestamp}`
|
|
4181
|
+
);
|
|
4182
|
+
}
|
|
4183
|
+
const itemKey = `item-${index}-${JSON.stringify(item).substring(0, 50)}`;
|
|
4184
|
+
return /* @__PURE__ */ jsxs(
|
|
4185
|
+
"div",
|
|
4186
|
+
{
|
|
4187
|
+
class: "border border-base-300 rounded-lg bg-base-100 shadow-sm hover:shadow-md transition-shadow",
|
|
4188
|
+
children: [
|
|
4189
|
+
/* @__PURE__ */ jsxs("div", { class: "border-b border-base-200 bg-base-50 rounded-t-lg", children: [
|
|
4190
|
+
/* @__PURE__ */ jsxs("div", { class: "flex items-center justify-between gap-2 p-1 sm:p-3 sm:px-4", children: [
|
|
4191
|
+
/* @__PURE__ */ jsx(
|
|
4192
|
+
"button",
|
|
4193
|
+
{
|
|
4194
|
+
type: "button",
|
|
4195
|
+
class: "btn btn-ghost btn-square btn-xs sm:btn-sm min-h-[32px] sm:min-h-[36px] min-w-[32px] sm:min-w-[36px] p-0 flex-shrink-0",
|
|
4196
|
+
onClick: () => toggleItemCollapse(index),
|
|
4197
|
+
"aria-label": isItemCollapsed ? "Expand item" : "Collapse item",
|
|
4198
|
+
"aria-expanded": !isItemCollapsed,
|
|
4199
|
+
children: /* @__PURE__ */ jsx(
|
|
4200
|
+
"svg",
|
|
4350
4201
|
{
|
|
4351
|
-
|
|
4352
|
-
class:
|
|
4353
|
-
|
|
4354
|
-
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
/* @__PURE__ */ jsx("span", { class: "ml-1", children: "Confirm" })
|
|
4358
|
-
]
|
|
4202
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
4203
|
+
class: `h-4 w-4 sm:h-5 sm:w-5 transition-transform ${isItemCollapsed ? "" : "rotate-90"}`,
|
|
4204
|
+
fill: "none",
|
|
4205
|
+
viewBox: "0 0 24 24",
|
|
4206
|
+
stroke: "currentColor",
|
|
4207
|
+
children: /* @__PURE__ */ jsx("path", { "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", d: "M9 5l7 7-7 7" })
|
|
4359
4208
|
}
|
|
4360
4209
|
)
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
|
|
4376
|
-
|
|
4377
|
-
|
|
4378
|
-
|
|
4379
|
-
type: "button",
|
|
4380
|
-
class: "btn btn-ghost btn-square btn-xs sm:btn-sm min-h-[32px] sm:min-h-[36px] min-w-[32px] sm:min-w-[36px] p-0 flex-shrink-0",
|
|
4381
|
-
onClick: () => toggleItemCollapse(index),
|
|
4382
|
-
"aria-label": isItemCollapsed ? "Expand item" : "Collapse item",
|
|
4383
|
-
"aria-expanded": !isItemCollapsed,
|
|
4384
|
-
children: /* @__PURE__ */ jsx(
|
|
4210
|
+
}
|
|
4211
|
+
),
|
|
4212
|
+
/* @__PURE__ */ jsx("div", { class: "flex-1 flex items-center justify-end gap-2", children: slots.itemActions?.({
|
|
4213
|
+
item,
|
|
4214
|
+
index,
|
|
4215
|
+
fields: generateFieldsProxy(index)
|
|
4216
|
+
}) }),
|
|
4217
|
+
/* @__PURE__ */ jsxs(
|
|
4218
|
+
"button",
|
|
4219
|
+
{
|
|
4220
|
+
type: "button",
|
|
4221
|
+
class: "btn btn-error btn-xs sm:btn-sm min-h-[32px] sm:min-h-[36px] px-2 sm:px-3 text-xs sm:text-sm flex-shrink-0",
|
|
4222
|
+
onClick: () => removeItem(index),
|
|
4223
|
+
disabled: isRemoveButtonDisabled(),
|
|
4224
|
+
"aria-label": ariaLabels.removeButton,
|
|
4225
|
+
"data-testid": `${formState.storeName}-array-field-${String(props.name)}-remove-${index}`,
|
|
4226
|
+
children: [
|
|
4227
|
+
/* @__PURE__ */ jsx(
|
|
4385
4228
|
"svg",
|
|
4386
4229
|
{
|
|
4387
4230
|
xmlns: "http://www.w3.org/2000/svg",
|
|
4388
|
-
class:
|
|
4231
|
+
class: "h-3.5 w-3.5 sm:h-4 sm:w-4",
|
|
4389
4232
|
fill: "none",
|
|
4390
4233
|
viewBox: "0 0 24 24",
|
|
4391
4234
|
stroke: "currentColor",
|
|
4392
|
-
children: /* @__PURE__ */ jsx(
|
|
4235
|
+
children: /* @__PURE__ */ jsx(
|
|
4236
|
+
"path",
|
|
4237
|
+
{
|
|
4238
|
+
"stroke-linecap": "round",
|
|
4239
|
+
"stroke-linejoin": "round",
|
|
4240
|
+
"stroke-width": "2",
|
|
4241
|
+
d: "M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"
|
|
4242
|
+
}
|
|
4243
|
+
)
|
|
4393
4244
|
}
|
|
4394
|
-
)
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
{
|
|
4405
|
-
type: "button",
|
|
4406
|
-
class: "btn btn-error btn-xs sm:btn-sm min-h-[32px] sm:min-h-[36px] px-2 sm:px-3 text-xs sm:text-sm flex-shrink-0",
|
|
4407
|
-
onClick: () => removeItem(index),
|
|
4408
|
-
disabled: isRemoveButtonDisabled(),
|
|
4409
|
-
"aria-label": ariaLabels.removeButton,
|
|
4410
|
-
"data-testid": `${formState.storeName}-array-field-${String(props.name)}-remove-${index}`,
|
|
4411
|
-
children: [
|
|
4412
|
-
/* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", class: "h-3.5 w-3.5 sm:h-4 sm:w-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx("path", { "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", d: "M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16" }) }),
|
|
4413
|
-
/* @__PURE__ */ jsx("span", { class: "hidden sm:inline ml-1", children: "Remove" })
|
|
4414
|
-
]
|
|
4415
|
-
}
|
|
4416
|
-
)
|
|
4417
|
-
] }),
|
|
4418
|
-
isItemCollapsed && /* @__PURE__ */ jsxs("div", { class: "px-1 sm:px-4 pb-2 sm:pb-3 border-t border-base-200/50", children: [
|
|
4419
|
-
showItemNumber && /* @__PURE__ */ jsxs("div", { class: "text-xs text-base-content/60 font-medium mb-1", children: [
|
|
4420
|
-
"#",
|
|
4421
|
-
index + 1
|
|
4422
|
-
] }),
|
|
4423
|
-
getItemPreview(item, index) && /* @__PURE__ */ jsx("div", { class: "font-semibold text-sm sm:text-base break-words leading-tight", children: getItemPreview(item, index) })
|
|
4245
|
+
),
|
|
4246
|
+
/* @__PURE__ */ jsx("span", { class: "hidden sm:inline ml-1", children: "Remove" })
|
|
4247
|
+
]
|
|
4248
|
+
}
|
|
4249
|
+
)
|
|
4250
|
+
] }),
|
|
4251
|
+
isItemCollapsed && /* @__PURE__ */ jsxs("div", { class: "px-1 sm:px-4 pb-2 sm:pb-3 border-t border-base-200/50", children: [
|
|
4252
|
+
showItemNumber && /* @__PURE__ */ jsxs("div", { class: "text-xs text-base-content/60 font-medium mb-1", children: [
|
|
4253
|
+
"#",
|
|
4254
|
+
index + 1
|
|
4424
4255
|
] }),
|
|
4425
|
-
|
|
4426
|
-
/* @__PURE__ */ jsx(
|
|
4427
|
-
"button",
|
|
4428
|
-
{
|
|
4429
|
-
type: "button",
|
|
4430
|
-
class: "btn btn-ghost btn-square btn-xs sm:btn-sm min-h-[32px] sm:min-h-[36px] min-w-[32px] sm:min-w-[36px] p-0",
|
|
4431
|
-
onClick: () => moveItemUp(index),
|
|
4432
|
-
disabled: index === 0 || props.disabled || props.readonly,
|
|
4433
|
-
"aria-label": ariaLabels.moveUpButton,
|
|
4434
|
-
"data-testid": `${formState.storeName}-array-field-${String(props.name)}-move-up-${index}`,
|
|
4435
|
-
children: /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", class: "h-3.5 w-3.5 sm:h-4 sm:w-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx("path", { "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", d: "M5 15l7-7 7 7" }) })
|
|
4436
|
-
}
|
|
4437
|
-
),
|
|
4438
|
-
/* @__PURE__ */ jsx(
|
|
4439
|
-
"button",
|
|
4440
|
-
{
|
|
4441
|
-
type: "button",
|
|
4442
|
-
class: "btn btn-ghost btn-square btn-xs sm:btn-sm min-h-[32px] sm:min-h-[36px] min-w-[32px] sm:min-w-[36px] p-0",
|
|
4443
|
-
onClick: () => moveItemDown(index),
|
|
4444
|
-
disabled: index === arrayValue.length - 1 || props.disabled || props.readonly,
|
|
4445
|
-
"aria-label": ariaLabels.moveDownButton,
|
|
4446
|
-
"data-testid": `${formState.storeName}-array-field-${String(props.name)}-move-down-${index}`,
|
|
4447
|
-
children: /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", class: "h-3.5 w-3.5 sm:h-4 sm:w-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx("path", { "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", d: "M19 9l-7 7-7-7" }) })
|
|
4448
|
-
}
|
|
4449
|
-
)
|
|
4450
|
-
] })
|
|
4256
|
+
getItemPreview(item, index) && /* @__PURE__ */ jsx("div", { class: "font-semibold text-sm sm:text-base break-words leading-tight", children: getItemPreview(item, index) })
|
|
4451
4257
|
] }),
|
|
4452
|
-
|
|
4453
|
-
|
|
4454
|
-
|
|
4455
|
-
|
|
4456
|
-
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
|
|
4258
|
+
props.allowReordering && /* @__PURE__ */ jsxs("div", { class: "flex items-center justify-end gap-1 sm:gap-2 p-1 sm:p-3 sm:px-4 border-t border-base-200/50", children: [
|
|
4259
|
+
/* @__PURE__ */ jsx(
|
|
4260
|
+
"button",
|
|
4261
|
+
{
|
|
4262
|
+
type: "button",
|
|
4263
|
+
class: "btn btn-ghost btn-square btn-xs sm:btn-sm min-h-[32px] sm:min-h-[36px] min-w-[32px] sm:min-w-[36px] p-0",
|
|
4264
|
+
onClick: () => moveItemUp(index),
|
|
4265
|
+
disabled: index === 0 || props.disabled || props.readonly,
|
|
4266
|
+
"aria-label": ariaLabels.moveUpButton,
|
|
4267
|
+
"data-testid": `${formState.storeName}-array-field-${String(props.name)}-move-up-${index}`,
|
|
4268
|
+
children: /* @__PURE__ */ jsx(
|
|
4269
|
+
"svg",
|
|
4270
|
+
{
|
|
4271
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
4272
|
+
class: "h-3.5 w-3.5 sm:h-4 sm:w-4",
|
|
4273
|
+
fill: "none",
|
|
4274
|
+
viewBox: "0 0 24 24",
|
|
4275
|
+
stroke: "currentColor",
|
|
4276
|
+
children: /* @__PURE__ */ jsx(
|
|
4277
|
+
"path",
|
|
4278
|
+
{
|
|
4279
|
+
"stroke-linecap": "round",
|
|
4280
|
+
"stroke-linejoin": "round",
|
|
4281
|
+
"stroke-width": "2",
|
|
4282
|
+
d: "M5 15l7-7 7 7"
|
|
4283
|
+
}
|
|
4284
|
+
)
|
|
4285
|
+
}
|
|
4286
|
+
)
|
|
4287
|
+
}
|
|
4288
|
+
),
|
|
4289
|
+
/* @__PURE__ */ jsx(
|
|
4290
|
+
"button",
|
|
4291
|
+
{
|
|
4292
|
+
type: "button",
|
|
4293
|
+
class: "btn btn-ghost btn-square btn-xs sm:btn-sm min-h-[32px] sm:min-h-[36px] min-w-[32px] sm:min-w-[36px] p-0",
|
|
4294
|
+
onClick: () => moveItemDown(index),
|
|
4295
|
+
disabled: index === arrayValue.length - 1 || props.disabled || props.readonly,
|
|
4296
|
+
"aria-label": ariaLabels.moveDownButton,
|
|
4297
|
+
"data-testid": `${formState.storeName}-array-field-${String(props.name)}-move-down-${index}`,
|
|
4298
|
+
children: /* @__PURE__ */ jsx(
|
|
4299
|
+
"svg",
|
|
4300
|
+
{
|
|
4301
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
4302
|
+
class: "h-3.5 w-3.5 sm:h-4 sm:w-4",
|
|
4303
|
+
fill: "none",
|
|
4304
|
+
viewBox: "0 0 24 24",
|
|
4305
|
+
stroke: "currentColor",
|
|
4306
|
+
children: /* @__PURE__ */ jsx(
|
|
4307
|
+
"path",
|
|
4308
|
+
{
|
|
4309
|
+
"stroke-linecap": "round",
|
|
4310
|
+
"stroke-linejoin": "round",
|
|
4311
|
+
"stroke-width": "2",
|
|
4312
|
+
d: "M19 9l-7 7-7-7"
|
|
4313
|
+
}
|
|
4314
|
+
)
|
|
4315
|
+
}
|
|
4316
|
+
)
|
|
4317
|
+
}
|
|
4318
|
+
)
|
|
4319
|
+
] })
|
|
4320
|
+
] }),
|
|
4321
|
+
!isItemCollapsed && /* @__PURE__ */ jsx("div", { class: "p-3 sm:p-5", children: slots.itemRenderer?.({
|
|
4322
|
+
item,
|
|
4323
|
+
index,
|
|
4324
|
+
// Type-safe fields object with autocomplete
|
|
4325
|
+
fields: generateFieldsProxy(index)
|
|
4326
|
+
}) || (props.itemRenderer ? props.itemRenderer(item, index) : JSON.stringify(item)) })
|
|
4327
|
+
]
|
|
4328
|
+
},
|
|
4329
|
+
itemKey
|
|
4330
|
+
);
|
|
4331
|
+
}) }) });
|
|
4464
4332
|
};
|
|
4465
4333
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4466
4334
|
/* @__PURE__ */ jsx("style", { children: progressBarStyle }),
|
|
@@ -4517,7 +4385,15 @@ function createDaisyUIArrayField() {
|
|
|
4517
4385
|
fill: "none",
|
|
4518
4386
|
viewBox: "0 0 24 24",
|
|
4519
4387
|
stroke: "currentColor",
|
|
4520
|
-
children: /* @__PURE__ */ jsx(
|
|
4388
|
+
children: /* @__PURE__ */ jsx(
|
|
4389
|
+
"path",
|
|
4390
|
+
{
|
|
4391
|
+
"stroke-linecap": "round",
|
|
4392
|
+
"stroke-linejoin": "round",
|
|
4393
|
+
"stroke-width": "2",
|
|
4394
|
+
d: "M4 6h16M4 12h16M4 18h16"
|
|
4395
|
+
}
|
|
4396
|
+
)
|
|
4521
4397
|
}
|
|
4522
4398
|
),
|
|
4523
4399
|
/* @__PURE__ */ jsx("span", { class: "hidden sm:inline ml-1 text-xs", children: areAllItemsCollapsed() ? "Expand All" : "Collapse All" })
|
|
@@ -4531,7 +4407,7 @@ function createDaisyUIArrayField() {
|
|
|
4531
4407
|
renderAvailableItems(),
|
|
4532
4408
|
renderSelectedItems()
|
|
4533
4409
|
] }),
|
|
4534
|
-
collapseState.isFieldCollapsed && arrayValue.length > 0 && /* @__PURE__ */ jsx("div", { class: "mt-4 sm:mt-6 p-4 border border-base-300 rounded-lg bg-base-50", children: /* @__PURE__ */ jsx("p", { class: "text-sm sm:text-base text-base-content/70", children: props.fieldSummary ? props.fieldSummary(arrayValue) : `${arrayValue.length} item${arrayValue.length !== 1 ? "s" : ""} added. Click "Expand" above to view and edit.` }) }),
|
|
4410
|
+
collapseState.isFieldCollapsed && arrayValue.length > 0 && /* @__PURE__ */ jsx("div", { class: "mt-4 sm:mt-6 p-4 border border-base-300 rounded-lg bg-base-50", children: slots.fieldSummary?.({ items: arrayValue }) || /* @__PURE__ */ jsx("p", { class: "text-sm sm:text-base text-base-content/70", children: props.fieldSummary ? props.fieldSummary(arrayValue) : `${arrayValue.length} item${arrayValue.length !== 1 ? "s" : ""} added. Click "Expand" above to view and edit.` }) }),
|
|
4535
4411
|
props.description && /* @__PURE__ */ jsx("p", { class: "text-sm sm:text-base text-base-content/70 mt-2 sm:mt-3 px-1", children: props.description }),
|
|
4536
4412
|
props.createItem && /* @__PURE__ */ jsxs("div", { class: `mt-3 sm:mt-6 ${arrayValue.length > 0 ? "pt-3 sm:pt-6 border-t border-base-300" : ""}`, children: [
|
|
4537
4413
|
/* @__PURE__ */ jsxs(
|
|
@@ -4544,7 +4420,17 @@ function createDaisyUIArrayField() {
|
|
|
4544
4420
|
"aria-label": ariaLabels.addButton,
|
|
4545
4421
|
"data-testid": `${formState.storeName}-array-field-${String(props.name)}-add-button`,
|
|
4546
4422
|
children: [
|
|
4547
|
-
/* @__PURE__ */ jsx(
|
|
4423
|
+
/* @__PURE__ */ jsx(
|
|
4424
|
+
"svg",
|
|
4425
|
+
{
|
|
4426
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
4427
|
+
class: "h-4 w-4 mr-1.5",
|
|
4428
|
+
fill: "none",
|
|
4429
|
+
viewBox: "0 0 24 24",
|
|
4430
|
+
stroke: "currentColor",
|
|
4431
|
+
children: /* @__PURE__ */ jsx("path", { "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", d: "M12 4v16m8-8H4" })
|
|
4432
|
+
}
|
|
4433
|
+
),
|
|
4548
4434
|
/* @__PURE__ */ jsx("span", { class: "text-sm", children: "Add New Item" })
|
|
4549
4435
|
]
|
|
4550
4436
|
}
|
|
@@ -4557,7 +4443,25 @@ function createDaisyUIArrayField() {
|
|
|
4557
4443
|
] })
|
|
4558
4444
|
] }),
|
|
4559
4445
|
isTouched2 && hasErrors && /* @__PURE__ */ jsx("div", { class: "mt-2 sm:mt-3 p-3 sm:p-4 bg-error/10 border border-error/20 rounded-lg", children: /* @__PURE__ */ jsxs("p", { class: "text-sm sm:text-base text-error font-medium flex items-start gap-2", children: [
|
|
4560
|
-
/* @__PURE__ */ jsx(
|
|
4446
|
+
/* @__PURE__ */ jsx(
|
|
4447
|
+
"svg",
|
|
4448
|
+
{
|
|
4449
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
4450
|
+
class: "h-5 w-5 flex-shrink-0 mt-0.5",
|
|
4451
|
+
fill: "none",
|
|
4452
|
+
viewBox: "0 0 24 24",
|
|
4453
|
+
stroke: "currentColor",
|
|
4454
|
+
children: /* @__PURE__ */ jsx(
|
|
4455
|
+
"path",
|
|
4456
|
+
{
|
|
4457
|
+
"stroke-linecap": "round",
|
|
4458
|
+
"stroke-linejoin": "round",
|
|
4459
|
+
"stroke-width": "2",
|
|
4460
|
+
d: "M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
|
|
4461
|
+
}
|
|
4462
|
+
)
|
|
4463
|
+
}
|
|
4464
|
+
),
|
|
4561
4465
|
/* @__PURE__ */ jsx("span", { children: formState.getError(props.name) })
|
|
4562
4466
|
] }) })
|
|
4563
4467
|
] })
|