@eightshift/ui-components 1.4.2 → 1.4.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.
|
@@ -5086,6 +5086,9 @@ const Repeater = (props) => {
|
|
|
5086
5086
|
if (canDelete && items.length < (minItems ?? 1)) {
|
|
5087
5087
|
setCanDelete(false);
|
|
5088
5088
|
}
|
|
5089
|
+
useEffect(() => {
|
|
5090
|
+
setItems(fixIds(rawItems));
|
|
5091
|
+
}, [rawItems]);
|
|
5089
5092
|
if (hidden) {
|
|
5090
5093
|
return null;
|
|
5091
5094
|
}
|
|
@@ -5114,8 +5117,7 @@ const Repeater = (props) => {
|
|
|
5114
5117
|
{
|
|
5115
5118
|
onPress: () => {
|
|
5116
5119
|
const newItem = { id: `${itemIdBase}${items.length + 1}`, ...addDefaultItem };
|
|
5117
|
-
|
|
5118
|
-
onChange(items);
|
|
5120
|
+
onChange([...items, newItem]);
|
|
5119
5121
|
if (onAfterItemAdd) {
|
|
5120
5122
|
onAfterItemAdd(newItem);
|
|
5121
5123
|
}
|
|
@@ -5130,8 +5132,7 @@ const Repeater = (props) => {
|
|
|
5130
5132
|
addButton && /* @__PURE__ */ jsx("div", { className: clsx(!hideEmptyState && items.length < 1 && "es-uic-invisible"), children: addButton({
|
|
5131
5133
|
addItem: (additional = {}) => {
|
|
5132
5134
|
const newItem = { id: `${itemIdBase}${items.length + 1}`, ...addDefaultItem, ...additional };
|
|
5133
|
-
|
|
5134
|
-
onChange(items);
|
|
5135
|
+
onChange([...items, newItem]);
|
|
5135
5136
|
if (onAfterItemAdd) {
|
|
5136
5137
|
onAfterItemAdd(newItem);
|
|
5137
5138
|
}
|
|
@@ -5173,8 +5174,7 @@ const Repeater = (props) => {
|
|
|
5173
5174
|
if (event.canceled) {
|
|
5174
5175
|
return;
|
|
5175
5176
|
}
|
|
5176
|
-
|
|
5177
|
-
onChange(items);
|
|
5177
|
+
onChange(move([...items], source, target));
|
|
5178
5178
|
},
|
|
5179
5179
|
children: items.map((item, index) => /* @__PURE__ */ jsx(
|
|
5180
5180
|
SortableItem,
|
|
@@ -5191,7 +5191,6 @@ const Repeater = (props) => {
|
|
|
5191
5191
|
index,
|
|
5192
5192
|
canDelete,
|
|
5193
5193
|
deleteItem: () => {
|
|
5194
|
-
setItems([...items].filter((i2) => i2.id !== item.id));
|
|
5195
5194
|
onChange([...items].filter((i2) => i2.id !== item.id));
|
|
5196
5195
|
if (onAfterItemRemove) {
|
|
5197
5196
|
onAfterItemRemove(item);
|
|
@@ -5218,12 +5217,11 @@ const Repeater = (props) => {
|
|
|
5218
5217
|
children({
|
|
5219
5218
|
...item,
|
|
5220
5219
|
updateData: (newValue) => {
|
|
5221
|
-
|
|
5222
|
-
onChange(
|
|
5220
|
+
const updated = [...items].map((i2) => i2.id === item.id ? { ...i2, ...newValue } : i2);
|
|
5221
|
+
onChange(updated);
|
|
5223
5222
|
},
|
|
5224
5223
|
itemIndex: index,
|
|
5225
5224
|
deleteItem: () => {
|
|
5226
|
-
setItems([...items].filter((i2) => i2.id !== item.id));
|
|
5227
5225
|
onChange([...items].filter((i2) => i2.id !== item.id));
|
|
5228
5226
|
if (onAfterItemRemove) {
|
|
5229
5227
|
onAfterItemRemove(item);
|
|
@@ -5247,8 +5245,7 @@ const Repeater = (props) => {
|
|
|
5247
5245
|
{
|
|
5248
5246
|
onPress: () => {
|
|
5249
5247
|
const newItem = { id: `${itemIdBase}${items.length + 1}`, ...addDefaultItem };
|
|
5250
|
-
|
|
5251
|
-
onChange(items);
|
|
5248
|
+
onChange([...items, newItem]);
|
|
5252
5249
|
if (onAfterItemAdd) {
|
|
5253
5250
|
onAfterItemAdd(newItem);
|
|
5254
5251
|
}
|
|
@@ -5263,8 +5260,7 @@ const Repeater = (props) => {
|
|
|
5263
5260
|
addButton && !hideEmptyState && addButton({
|
|
5264
5261
|
addItem: (additional = {}) => {
|
|
5265
5262
|
const newItem = { id: `${itemIdBase}${items.length + 1}`, ...addDefaultItem, ...additional };
|
|
5266
|
-
|
|
5267
|
-
onChange(items);
|
|
5263
|
+
onChange([...items, newItem]);
|
|
5268
5264
|
if (onAfterItemAdd) {
|
|
5269
5265
|
onAfterItemAdd(newItem);
|
|
5270
5266
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eightshift/ui-components",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -85,6 +85,7 @@
|
|
|
85
85
|
"tailwindcss": "^3.4.7",
|
|
86
86
|
"tailwindcss-animate": "^1.0.7",
|
|
87
87
|
"tailwindcss-react-aria-components": "^1.1.4",
|
|
88
|
+
"tailwindcss-scoped-preflight": "^3.4.3",
|
|
88
89
|
"vite": "^5.3.5",
|
|
89
90
|
"vite-plugin-lib-inject-css": "^2.1.1"
|
|
90
91
|
},
|