@eightshift/ui-components 6.0.5 → 6.0.8

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.
@@ -2501,8 +2501,8 @@ input[data-rac]::-webkit-search-cancel-button {
2501
2501
  translate: var(--tw-translate-x) var(--tw-translate-y);
2502
2502
  }
2503
2503
 
2504
- :is(body, body #wpwrap) .es\:translate-y-0 {
2505
- --tw-translate-y: calc(var(--es-spacing) * 0);
2504
+ :is(body, body #wpwrap) .es\:translate-y-1 {
2505
+ --tw-translate-y: calc(var(--es-spacing) * 1);
2506
2506
  translate: var(--tw-translate-x) var(--tw-translate-y);
2507
2507
  }
2508
2508
 
@@ -3167,6 +3167,10 @@ input[data-rac]::-webkit-search-cancel-button {
3167
3167
  border-radius: var(--es-radius-18);
3168
3168
  }
3169
3169
 
3170
+ :is(body, body #wpwrap) .es\:rounded-20\! {
3171
+ border-radius: var(--es-radius-20) !important;
3172
+ }
3173
+
3170
3174
  :is(body, body #wpwrap) .es\:rounded-28 {
3171
3175
  border-radius: var(--es-radius-28);
3172
3176
  }
@@ -7855,6 +7859,17 @@ input[data-rac]::-webkit-search-cancel-button {
7855
7859
  grid-row-end: 1;
7856
7860
  }
7857
7861
 
7862
+ :is(:is(body, body #wpwrap) .es\:\*\:motion-preset-fade-sm > *) {
7863
+ --motion-origin-opacity: 0;
7864
+ --motion-duration: .3s;
7865
+ --motion-opacity-in-animation: motion-opacity-in calc(var(--motion-opacity-duration, var(--motion-duration)) * var(--motion-opacity-perceptual-duration-multiplier, var(--motion-perceptual-duration-multiplier))) var(--motion-opacity-timing, var(--motion-timing)) var(--motion-opacity-delay, var(--motion-delay)) both;
7866
+ animation: var(--motion-scale-in-animation), var(--motion-translate-in-animation), var(--motion-rotate-in-animation), var(--motion-filter-in-animation), var(--motion-opacity-in-animation), var(--motion-background-color-in-animation), var(--motion-text-color-in-animation), var(--motion-scale-loop-animation), var(--motion-translate-loop-animation), var(--motion-rotate-loop-animation), var(--motion-filter-loop-animation), var(--motion-opacity-loop-animation), var(--motion-background-color-loop-animation), var(--motion-text-color-loop-animation);
7867
+ }
7868
+
7869
+ :is(:is(body, body #wpwrap) .es\:\*\:motion-delay-75 > *) {
7870
+ --motion-delay: 75ms;
7871
+ }
7872
+
7858
7873
  :is(body, body #wpwrap) .es\:not-group-first\:not-group-before-current\:rounded-t-md:not(:is(:where(.es\:group):first-child *)):not(:is(:where(.es\:group):has( + :where(:pressed, :active, [data-selected="true"], [data-focus-visible="true"], [data-hovered="true"], [aria-expanded="true"], [data-expanded="true"])) *)) {
7859
7874
  border-top-left-radius: var(--es-radius-md);
7860
7875
  border-top-right-radius: var(--es-radius-md);
@@ -2469,8 +2469,8 @@ button, input:where([type="button"], [type="reset"], [type="submit"]) {
2469
2469
  translate: var(--tw-translate-x) var(--tw-translate-y);
2470
2470
  }
2471
2471
 
2472
- :is(body, #wpwrap #editor) .es\:translate-y-0 {
2473
- --tw-translate-y: calc(var(--es-spacing) * 0);
2472
+ :is(body, #wpwrap #editor) .es\:translate-y-1 {
2473
+ --tw-translate-y: calc(var(--es-spacing) * 1);
2474
2474
  translate: var(--tw-translate-x) var(--tw-translate-y);
2475
2475
  }
2476
2476
 
@@ -3135,6 +3135,10 @@ button, input:where([type="button"], [type="reset"], [type="submit"]) {
3135
3135
  border-radius: var(--es-radius-18);
3136
3136
  }
3137
3137
 
3138
+ :is(body, #wpwrap #editor) .es\:rounded-20\! {
3139
+ border-radius: var(--es-radius-20) !important;
3140
+ }
3141
+
3138
3142
  :is(body, #wpwrap #editor) .es\:rounded-28 {
3139
3143
  border-radius: var(--es-radius-28);
3140
3144
  }
@@ -7823,6 +7827,17 @@ button, input:where([type="button"], [type="reset"], [type="submit"]) {
7823
7827
  grid-row-end: 1;
7824
7828
  }
7825
7829
 
7830
+ :is(:is(body, #wpwrap #editor) .es\:\*\:motion-preset-fade-sm > *) {
7831
+ --motion-origin-opacity: 0;
7832
+ --motion-duration: .3s;
7833
+ --motion-opacity-in-animation: motion-opacity-in calc(var(--motion-opacity-duration, var(--motion-duration)) * var(--motion-opacity-perceptual-duration-multiplier, var(--motion-perceptual-duration-multiplier))) var(--motion-opacity-timing, var(--motion-timing)) var(--motion-opacity-delay, var(--motion-delay)) both;
7834
+ animation: var(--motion-scale-in-animation), var(--motion-translate-in-animation), var(--motion-rotate-in-animation), var(--motion-filter-in-animation), var(--motion-opacity-in-animation), var(--motion-background-color-in-animation), var(--motion-text-color-in-animation), var(--motion-scale-loop-animation), var(--motion-translate-loop-animation), var(--motion-rotate-loop-animation), var(--motion-filter-loop-animation), var(--motion-opacity-loop-animation), var(--motion-background-color-loop-animation), var(--motion-text-color-loop-animation);
7835
+ }
7836
+
7837
+ :is(:is(body, #wpwrap #editor) .es\:\*\:motion-delay-75 > *) {
7838
+ --motion-delay: 75ms;
7839
+ }
7840
+
7826
7841
  :is(body, #wpwrap #editor) .es\:not-group-first\:not-group-before-current\:rounded-t-md:not(:is(:where(.es\:group):first-child *)):not(:is(:where(.es\:group):has( + :where(:pressed, :active, [data-selected="true"], [data-focus-visible="true"], [data-hovered="true"], [aria-expanded="true"], [data-expanded="true"])) *)) {
7827
7842
  border-top-left-radius: var(--es-radius-md);
7828
7843
  border-top-right-radius: var(--es-radius-md);
@@ -2954,8 +2954,8 @@ input[data-rac]::-webkit-search-cancel-button {
2954
2954
  translate: var(--tw-translate-x) var(--tw-translate-y);
2955
2955
  }
2956
2956
 
2957
- .es\:translate-y-0 {
2958
- --tw-translate-y: calc(var(--es-spacing) * 0);
2957
+ .es\:translate-y-1 {
2958
+ --tw-translate-y: calc(var(--es-spacing) * 1);
2959
2959
  translate: var(--tw-translate-x) var(--tw-translate-y);
2960
2960
  }
2961
2961
 
@@ -3620,6 +3620,10 @@ input[data-rac]::-webkit-search-cancel-button {
3620
3620
  border-radius: var(--es-radius-18);
3621
3621
  }
3622
3622
 
3623
+ .es\:rounded-20\! {
3624
+ border-radius: var(--es-radius-20) !important;
3625
+ }
3626
+
3623
3627
  .es\:rounded-28 {
3624
3628
  border-radius: var(--es-radius-28);
3625
3629
  }
@@ -8308,6 +8312,17 @@ input[data-rac]::-webkit-search-cancel-button {
8308
8312
  grid-row-end: 1;
8309
8313
  }
8310
8314
 
8315
+ :is(.es\:\*\:motion-preset-fade-sm > *) {
8316
+ --motion-origin-opacity: 0;
8317
+ --motion-duration: .3s;
8318
+ --motion-opacity-in-animation: motion-opacity-in calc(var(--motion-opacity-duration, var(--motion-duration)) * var(--motion-opacity-perceptual-duration-multiplier, var(--motion-perceptual-duration-multiplier))) var(--motion-opacity-timing, var(--motion-timing)) var(--motion-opacity-delay, var(--motion-delay)) both;
8319
+ animation: var(--motion-scale-in-animation), var(--motion-translate-in-animation), var(--motion-rotate-in-animation), var(--motion-filter-in-animation), var(--motion-opacity-in-animation), var(--motion-background-color-in-animation), var(--motion-text-color-in-animation), var(--motion-scale-loop-animation), var(--motion-translate-loop-animation), var(--motion-rotate-loop-animation), var(--motion-filter-loop-animation), var(--motion-opacity-loop-animation), var(--motion-background-color-loop-animation), var(--motion-text-color-loop-animation);
8320
+ }
8321
+
8322
+ :is(.es\:\*\:motion-delay-75 > *) {
8323
+ --motion-delay: 75ms;
8324
+ }
8325
+
8311
8326
  .es\:not-group-first\:not-group-before-current\:rounded-t-md:not(:is(:where(.es\:group):first-child *)):not(:is(:where(.es\:group):has( + :where(:pressed, :active, [data-selected="true"], [data-focus-visible="true"], [data-hovered="true"], [aria-expanded="true"], [data-expanded="true"])) *)) {
8312
8327
  border-top-left-radius: var(--es-radius-md);
8313
8328
  border-top-right-radius: var(--es-radius-md);
@@ -3,6 +3,7 @@ import { useEffect, useRef, useLayoutEffect, useMemo, useState, useCallback, sta
3
3
  import { _ as __ } from "../../default-i18n-CnQeC5Pl.js";
4
4
  import { DraggableContext } from "./draggable-context.js";
5
5
  import { r as reactDomExports } from "../../index-oFgxU4zs.js";
6
+ import { randomId } from "../../utilities/hash.js";
6
7
  var i = Symbol.for("preact-signals");
7
8
  function t() {
8
9
  if (!(s > 1)) {
@@ -7005,11 +7006,11 @@ var _AxisModifier = class _AxisModifier2 extends Modifier {
7005
7006
  };
7006
7007
  _AxisModifier.configure = configurator(_AxisModifier);
7007
7008
  var AxisModifier = _AxisModifier;
7008
- AxisModifier.configure({
7009
+ var RestrictToVerticalAxis = AxisModifier.configure({
7009
7010
  axis: "x",
7010
7011
  value: 0
7011
7012
  });
7012
- AxisModifier.configure({
7013
+ var RestrictToHorizontalAxis = AxisModifier.configure({
7013
7014
  axis: "y",
7014
7015
  value: 0
7015
7016
  });
@@ -7222,21 +7223,22 @@ function mutate(items, event, mutation) {
7222
7223
  function move(items, event) {
7223
7224
  return mutate(items, event, arrayMove);
7224
7225
  }
7225
- const fixIds = (items, itemIdBase) => {
7226
- return items?.map((item, i2) => ({
7227
- ...item,
7228
- id: item?.id ?? `${itemIdBase}-${i2}`
7229
- })) ?? [];
7230
- };
7231
7226
  const SortableItem = ({ id, index, disabled, children, axis }) => {
7232
7227
  const [element, setElement] = useState(null);
7233
7228
  const handleRef = useRef(null);
7229
+ let modifiers = [RestrictToElement];
7230
+ if (axis === "horizontal") {
7231
+ modifiers.push(RestrictToHorizontalAxis);
7232
+ }
7233
+ if (axis === "vertical") {
7234
+ modifiers.push(RestrictToVerticalAxis);
7235
+ }
7234
7236
  const { isDragSource, status } = useSortable({
7235
7237
  id,
7236
7238
  index,
7237
7239
  element,
7238
7240
  type: "item",
7239
- modifiers: [RestrictToElement],
7241
+ modifiers,
7240
7242
  transition: { idle: true, duration: 400, easing: "cubic-bezier(0, 0.55, 0.45, 1)" },
7241
7243
  // 'easeOutCirc'
7242
7244
  handle: handleRef,
@@ -7280,7 +7282,7 @@ const SortableItem = ({ id, index, disabled, children, axis }) => {
7280
7282
  * @preserve
7281
7283
  */
7282
7284
  const Draggable3 = (props) => {
7283
- const itemIdBase = useId("draggable-list-item-");
7285
+ useId("draggable-list-item-");
7284
7286
  const {
7285
7287
  children,
7286
7288
  items: rawItems,
@@ -7295,9 +7297,9 @@ const Draggable3 = (props) => {
7295
7297
  if (typeof rawItems === "undefined" || rawItems === null || !Array.isArray(rawItems)) {
7296
7298
  console.warn(__("Draggable: 'items' are not an array or are undefined!", "eightshift-ui-components"));
7297
7299
  }
7298
- const [items, setItems] = useState(fixIds(rawItems ?? []));
7300
+ const [items, setItems] = useState(rawItems);
7299
7301
  useEffect(() => {
7300
- setItems(fixIds(rawItems, itemIdBase));
7302
+ setItems(rawItems);
7301
7303
  }, [rawItems]);
7302
7304
  if (hidden) {
7303
7305
  return null;
@@ -7321,36 +7323,33 @@ const Draggable3 = (props) => {
7321
7323
  children: items.map((item, index) => /* @__PURE__ */ jsx(
7322
7324
  SortableItem,
7323
7325
  {
7324
- id: item?.id ?? index,
7326
+ id: randomId(6),
7325
7327
  index,
7326
7328
  item,
7327
7329
  disabled: noReorder,
7328
7330
  axis,
7329
- children: (handleRef, isDragSource, status) => /* @__PURE__ */ jsx(
7330
- DraggableContext.Provider,
7331
- {
7332
- value: { isDragSource, handleRef, status },
7333
- children: children({
7334
- ...item,
7335
- updateData: (newValue) => {
7336
- const updated = [...items].map((i2) => i2.id === item.id ? { ...i2, ...newValue } : i2);
7337
- onChange(updated);
7338
- setItems(updated);
7339
- },
7340
- itemIndex: index,
7341
- deleteItem: () => {
7342
- setItems([...items].filter((i2) => i2.id !== item.id));
7343
- onChange([...items].filter((i2) => i2.id !== item.id));
7344
- if (onAfterItemRemove) {
7345
- onAfterItemRemove(item);
7346
- }
7347
- }
7348
- })
7331
+ children: (handleRef, isDragSource, status) => /* @__PURE__ */ jsx(DraggableContext.Provider, { value: { isDragSource, handleRef, status }, children: children({
7332
+ ...item,
7333
+ updateData: (newValue) => {
7334
+ const updated = [...items];
7335
+ updated[index] = {
7336
+ ...updated[index],
7337
+ ...newValue
7338
+ };
7339
+ onChange(updated);
7340
+ setItems(updated);
7349
7341
  },
7350
- item.id
7351
- )
7342
+ itemIndex: index,
7343
+ deleteItem: () => {
7344
+ setItems([...items].filter((_2, i2) => i2 !== index));
7345
+ onChange([...items].filter((_2, i2) => i2 !== index));
7346
+ if (onAfterItemRemove) {
7347
+ onAfterItemRemove(item);
7348
+ }
7349
+ }
7350
+ }) })
7352
7351
  },
7353
- item?.id ?? index
7352
+ index
7354
7353
  ))
7355
7354
  }
7356
7355
  )
@@ -37,7 +37,7 @@ const DraggableListItem = (props) => {
37
37
  icon,
38
38
  label,
39
39
  subtitle,
40
- className: clsx("es:mr-auto", labelContainerClassName),
40
+ className: clsx("es:mr-auto es:min-h-9", labelContainerClassName),
41
41
  iconClassName,
42
42
  labelClassName,
43
43
  subtitleClassName,
@@ -1,16 +1,9 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { useId } from "react";
3
2
  import { _ as __ } from "../../default-i18n-CnQeC5Pl.js";
4
3
  import { BaseControl } from "../base-control/base-control.js";
5
4
  import { c as clsx } from "../../clsx-DgYk2OaC.js";
6
5
  import { L as List, a as arrayRemove, b as arrayMove } from "../../List-BGHOoFf0.js";
7
6
  import { Container, ContainerGroup } from "../base-control/container.js";
8
- const fixIds = (items, itemIdBase) => {
9
- return items?.map((item, i) => ({
10
- ...item,
11
- id: item?.id ?? `${itemIdBase}-${i}`
12
- }));
13
- };
14
7
  /**
15
8
  * A component that allows re-ordering a list of items.
16
9
  *
@@ -58,10 +51,9 @@ const fixIds = (items, itemIdBase) => {
58
51
  * @preserve
59
52
  */
60
53
  const DraggableList = (props) => {
61
- const itemIdBase = useId("draggable-list-item-");
62
54
  const {
63
55
  children,
64
- items: rawItems,
56
+ items,
65
57
  onChange,
66
58
  icon,
67
59
  label,
@@ -77,11 +69,10 @@ const DraggableList = (props) => {
77
69
  hidden,
78
70
  ...rest
79
71
  } = props;
80
- if (typeof rawItems === "undefined" || rawItems === null || !Array.isArray(rawItems)) {
72
+ if (typeof items === "undefined" || items === null || !Array.isArray(items)) {
81
73
  console.warn(__("DraggableList: 'items' are not an array or are undefined!", "eightshift-ui-components"));
82
74
  }
83
- const items = fixIds(rawItems ?? [], itemIdBase);
84
- if (hidden) {
75
+ if (hidden || !items?.length) {
85
76
  return null;
86
77
  }
87
78
  return /* @__PURE__ */ jsx(
@@ -109,8 +100,7 @@ const DraggableList = (props) => {
109
100
  className: clsx("es:w-full es:list-none es:m-0!", itemContainerClassName),
110
101
  ...rest2,
111
102
  children: children2
112
- },
113
- key
103
+ }
114
104
  );
115
105
  },
116
106
  renderItem: ({ value, index, isDragged, isSelected, props: props2 }) => {
@@ -127,11 +117,16 @@ const DraggableList = (props) => {
127
117
  children: children({
128
118
  ...value,
129
119
  updateData: (newValue) => {
130
- onChange(items.map((i) => i.id === value.id ? { ...i, ...newValue } : i));
120
+ const updated = [...items];
121
+ updated[index] = {
122
+ ...updated[index],
123
+ ...newValue
124
+ };
125
+ onChange(updated);
131
126
  },
132
127
  itemIndex: index,
133
128
  deleteItem: () => {
134
- onChange(items.filter((i) => i.id !== value.id));
129
+ onChange(items.filter((_, i) => i !== index));
135
130
  if (onAfterItemRemove) {
136
131
  onAfterItemRemove(value);
137
132
  }
@@ -387,7 +387,7 @@ const Expandable = (props) => {
387
387
  "es:h-(--disclosure-panel-height)",
388
388
  "es:opacity-0 es:blur-[1px] es:-translate-y-2",
389
389
  !isOpen && "es:rounded-t-xl",
390
- isOpen && "es:rounded-t-sm es:opacity-100 es:blur-none es:translate-y-0 es:mt-1",
390
+ isOpen && "es:rounded-t-md es:opacity-100 es:*:motion-preset-fade-sm es:*:motion-delay-75 es:blur-none es:translate-y-1 es:mb-1",
391
391
  "es:origin-top",
392
392
  "es:bg-white es:rounded-b-xl es:inset-ring es:inset-ring-surface-200",
393
393
  "es:inset-shadow-sm es:inset-shadow-accent-600/5",
@@ -30,7 +30,7 @@ import { RepeaterContext } from "./repeater-context.js";
30
30
  */
31
31
  const RepeaterItem = (props) => {
32
32
  const { children, icon, label, subtitle, "aria-label": ariaLabel, className, actions, textValue, expandDisabled, menuOptions, noMenuButton, ...rest } = props;
33
- const { deleteItem, duplicateItem, isDragged, isOutOfBounds, isSelected, canDelete, canAdd, allOpen, setAllOpen, setOpenItems, id, isItemOpen, noDuplicateButton } = useContext(RepeaterContext);
33
+ const { deleteItem, duplicateItem, isDragged, isOutOfBounds, canDelete, canAdd, allOpen, setAllOpen, setOpenItems, isItemOpen, index, noDuplicateButton } = useContext(RepeaterContext);
34
34
  return /* @__PURE__ */ jsx(
35
35
  Expandable,
36
36
  {
@@ -49,7 +49,7 @@ const RepeaterItem = (props) => {
49
49
  if (allOpen && !open) {
50
50
  setAllOpen(false);
51
51
  }
52
- setOpenItems((prev) => ({ ...prev, [id]: open }));
52
+ setOpenItems((prev) => ({ ...prev, [index]: open }));
53
53
  },
54
54
  customOpenButton: ({ open, toggleOpen, tooltip, disabled }) => {
55
55
  return /* @__PURE__ */ jsxs("div", { className: "es:flex es:items-center es:gap-px", children: [
@@ -82,6 +82,7 @@ const RepeaterItem = (props) => {
82
82
  disabled: !canDelete,
83
83
  icon: icons.trash,
84
84
  onPress: () => deleteItem(),
85
+ danger: true,
85
86
  children: __("Remove", "eightshift-ui-components")
86
87
  }
87
88
  )
@@ -1,14 +1,14 @@
1
1
  import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
- import { useId, useState } from "react";
2
+ import { useState } from "react";
3
3
  import { _ as __ } from "../../default-i18n-CnQeC5Pl.js";
4
4
  import { Button } from "../button/button.js";
5
5
  import { icons } from "../../icons/icons.js";
6
6
  import { BaseControl } from "../base-control/base-control.js";
7
7
  import { AnimatedVisibility } from "../animated-visibility/animated-visibility.js";
8
8
  import { RepeaterContext } from "./repeater-context.js";
9
- import { c as clsx } from "../../clsx-DgYk2OaC.js";
10
9
  import { L as List, a as arrayRemove, b as arrayMove } from "../../List-BGHOoFf0.js";
11
10
  import { Menu, MenuItem, MenuSeparator } from "../menu/menu.js";
11
+ import { c as clsx } from "../../clsx-DgYk2OaC.js";
12
12
  /**
13
13
  * A component that allows re-ordering a list of items with additional sub-options.
14
14
  *
@@ -67,7 +67,6 @@ import { Menu, MenuItem, MenuSeparator } from "../menu/menu.js";
67
67
  * @preserve
68
68
  */
69
69
  const Repeater = (props) => {
70
- const itemIdBase = `item-${useId().replaceAll(":", "")}`;
71
70
  const {
72
71
  children,
73
72
  onChange,
@@ -95,7 +94,7 @@ const Repeater = (props) => {
95
94
  } = props;
96
95
  const [allOpen, setAllOpen] = useState(false);
97
96
  const [openItems, setOpenItems] = useState({});
98
- if (typeof rawItems === "undefined" || rawItems === null || !Array.isArray(rawItems)) {
97
+ if (typeof items === "undefined" || items === null || !Array.isArray(items)) {
99
98
  console.warn(__("Repeater: 'items' are not an array or are undefined!", "eightshift-ui-components"));
100
99
  }
101
100
  const canDelete = items.length > (minItems ?? 0);
@@ -137,7 +136,7 @@ const Repeater = (props) => {
137
136
  Button,
138
137
  {
139
138
  onPress: () => {
140
- const newItem = { id: `${itemIdBase}${items.length + 1}`, ...addDefaultItem };
139
+ const newItem = { ...addDefaultItem };
141
140
  onChange([...items, newItem]);
142
141
  if (onAfterItemAdd) {
143
142
  onAfterItemAdd(newItem);
@@ -145,15 +144,14 @@ const Repeater = (props) => {
145
144
  },
146
145
  size: "small",
147
146
  icon: icons.add,
148
- className: clsx("es:icon:size-4", !hideEmptyState && items.length < 1 && "es:invisible"),
147
+ className: !hideEmptyState && items.length < 1 && "es:invisible",
149
148
  tooltip: __("Add item", "eightshift-ui-components"),
150
- disabled: addDisabled || !canAdd,
151
- type: "simple"
149
+ disabled: addDisabled || !canAdd
152
150
  }
153
151
  ),
154
152
  addButton && /* @__PURE__ */ jsx("div", { className: clsx(!hideEmptyState && items.length < 1 && "es:invisible"), children: addButton({
155
153
  addItem: (additional = {}) => {
156
- const newItem = { id: `${itemIdBase}${items.length + 1}`, ...addDefaultItem, ...additional };
154
+ const newItem = { ...addDefaultItem, ...additional };
157
155
  onChange([...items, newItem]);
158
156
  if (onAfterItemAdd) {
159
157
  onAfterItemAdd(newItem);
@@ -167,18 +165,16 @@ const Repeater = (props) => {
167
165
  /* @__PURE__ */ jsx(
168
166
  List,
169
167
  {
170
- values: items.map((item) => ({ ...item, disabled: openItems?.[item?.id] })),
168
+ values: items.map((item, index) => ({ ...item, disabled: openItems?.[index] })),
171
169
  onChange: ({ oldIndex, newIndex }) => onChange(newIndex === -1 ? arrayRemove(items, oldIndex) : arrayMove(items, oldIndex, newIndex)),
172
170
  renderList: ({ children: children2, props: props2 }) => {
173
- const { key, ...rest } = props2;
174
171
  return /* @__PURE__ */ jsx(
175
172
  "ul",
176
173
  {
177
- className: clsx("es:w-full es:list-none es:m-0! es:flex es:flex-col es:gap-1", className),
178
- ...rest,
174
+ className: clsx("es:w-full es:list-none es:m-0! es:flex es:flex-col es:gap-0.75", className),
175
+ ...props2,
179
176
  children: children2
180
- },
181
- key
177
+ }
182
178
  );
183
179
  },
184
180
  renderItem: ({ value: item, index, isDragged, isSelected, isOutOfBounds, props: props2 }) => {
@@ -195,13 +191,13 @@ const Repeater = (props) => {
195
191
  ...item,
196
192
  index,
197
193
  deleteItem: () => {
198
- onChange([...items].filter((i) => i.id !== item.id));
194
+ onChange([...items].filter((_, i) => i !== index));
199
195
  if (onAfterItemRemove) {
200
196
  onAfterItemRemove(item);
201
197
  }
202
198
  },
203
199
  duplicateItem: () => {
204
- const newItem = { ...item, id: `${itemIdBase}${items.length + 1}` };
200
+ const newItem = { ...item };
205
201
  onChange([...items, newItem]);
206
202
  if (onAfterItemAdd) {
207
203
  onAfterItemAdd(newItem);
@@ -215,18 +211,22 @@ const Repeater = (props) => {
215
211
  allOpen,
216
212
  setAllOpen,
217
213
  setOpenItems,
218
- isItemOpen: openItems?.[item?.id] ?? allOpen,
214
+ isItemOpen: openItems?.[index] ?? allOpen,
219
215
  noDuplicateButton
220
216
  },
221
217
  children: children({
222
218
  ...item,
223
219
  updateData: (newValue) => {
224
- const updated = [...items].map((i) => i.id === item.id ? { ...i, ...newValue } : i);
220
+ const updated = [...items];
221
+ updated[index] = {
222
+ ...updated[index],
223
+ ...newValue
224
+ };
225
225
  onChange(updated);
226
226
  },
227
227
  itemIndex: index,
228
228
  deleteItem: () => {
229
- onChange([...items].filter((i) => i.id !== item.id));
229
+ onChange([...items].filter((_, i) => i !== index));
230
230
  if (onAfterItemRemove) {
231
231
  onAfterItemRemove(item);
232
232
  }
@@ -248,7 +248,7 @@ const Repeater = (props) => {
248
248
  Button,
249
249
  {
250
250
  onPress: () => {
251
- const newItem = { id: `${itemIdBase}${items.length + 1}`, ...addDefaultItem };
251
+ const newItem = { ...addDefaultItem };
252
252
  onChange([...items, newItem]);
253
253
  if (onAfterItemAdd) {
254
254
  onAfterItemAdd(newItem);
@@ -263,7 +263,7 @@ const Repeater = (props) => {
263
263
  ),
264
264
  addButton && !hideEmptyState && addButton({
265
265
  addItem: (additional = {}) => {
266
- const newItem = { id: `${itemIdBase}${items.length + 1}`, ...addDefaultItem, ...additional };
266
+ const newItem = { ...addDefaultItem, ...additional };
267
267
  onChange([...items, newItem]);
268
268
  if (onAfterItemAdd) {
269
269
  onAfterItemAdd(newItem);
@@ -162,7 +162,7 @@ const AsyncMultiSelect = (props) => {
162
162
  return;
163
163
  }
164
164
  const selectedValues = [...selected].map((item) => {
165
- const option = list.items.find((option2) => option2.value === item) || value.find((option2) => option2.value === item);
165
+ const option = list?.items?.find((option2) => option2.value === item) || value.find((option2) => option2.value === item);
166
166
  if (!option) {
167
167
  return null;
168
168
  }
@@ -259,7 +259,7 @@ const AsyncMultiSelect = (props) => {
259
259
  {
260
260
  selectionMode: "multiple",
261
261
  isDisabled: disabled,
262
- value: currentValueKeys,
262
+ value: currentValueKeys ?? [],
263
263
  onChange: (selected) => handleSelectionChange(selected),
264
264
  placeholder,
265
265
  ...rest,
@@ -354,14 +354,14 @@ const AsyncMultiSelect = (props) => {
354
354
  slot: null
355
355
  },
356
356
  className: "es:grid es:grid-cols-1 es:grid-rows-[auto_minmax(0,1fr)] es:p-0!",
357
- wrapperClassName: "es:w-72 es:px-1.5 es:h-fit es:from-surface-300/35 es:to-surface-300/35 es:overflow-clip",
358
- hidden: noReorder || disabled || value?.length < 2,
357
+ wrapperClassName: "es:w-72 es:px-1.5 es:h-fit es:from-surface-300/35 es:to-surface-300/35 es:overflow-clip es:rounded-20!",
358
+ hidden: noReorder || disabled || (value ?? [])?.length < 2,
359
359
  children: [
360
- /* @__PURE__ */ jsx("span", { className: 'es:text-lg es:mx-auto es:my-1 es:font-variation-["wdth"_140,"wght"_320] es:text-surface-600', children: __("Item order", "eightshift-ui-components") }),
360
+ /* @__PURE__ */ jsx("span", { className: 'es:text-base es:mx-auto es:my-1 es:font-variation-["wdth"_140,"wght"_320] es:text-surface-600', children: __("Item order", "eightshift-ui-components") }),
361
361
  /* @__PURE__ */ jsx(
362
362
  DraggableList,
363
363
  {
364
- items: value,
364
+ items: value ?? [],
365
365
  onChange: (value2) => {
366
366
  handleSelectionChange(new Set(value2?.map((item) => item?.value ?? item)));
367
367
  },
@@ -383,7 +383,7 @@ const AsyncMultiSelect = (props) => {
383
383
  iconClassName: "es:pointer-events-none es:select-none",
384
384
  labelClassName: "es:line-clamp-1",
385
385
  subtitleClassName: "es:line-clamp-1",
386
- className: clsx("es:min-h-8 es:flex es:items-center es:justify-between", realItem?.icon ? "es:pl-1" : "es:pl-2")
386
+ className: clsx("es:flex es:items-center es:justify-between", realItem?.icon ? "es:pl-1" : "es:pl-2")
387
387
  }
388
388
  );
389
389
  }
@@ -468,7 +468,7 @@ const AsyncMultiSelect = (props) => {
468
468
  $eed445e0843c11d0$export$41f133550aa26f48,
469
469
  {
470
470
  className: clsx("es:space-y-0.75 es:p-1.5 es:pt-0 es:any-focus:outline-hidden es:h-full es:overflow-y-auto es:rounded-t-xl", list?.isLoading && "es:hidden"),
471
- items: list.items,
471
+ items: list?.items ?? [],
472
472
  selectedKeys: list.selectedKeys,
473
473
  selectionMode: "multiple",
474
474
  selectionBehavior: "toggle",
@@ -308,14 +308,14 @@ const MultiSelect = (props) => {
308
308
  slot: null
309
309
  },
310
310
  className: "es:grid es:grid-cols-1 es:grid-rows-[auto_minmax(0,1fr)] es:p-0!",
311
- wrapperClassName: "es:w-72 es:px-1.5 es:h-fit es:from-surface-300/35 es:to-surface-300/35 es:overflow-clip",
311
+ wrapperClassName: "es:w-72 es:px-1.5 es:h-fit es:from-surface-300/35 es:to-surface-300/35 es:overflow-clip es:rounded-20!",
312
312
  hidden: noReorder || disabled || currentValue?.length < 2,
313
313
  children: [
314
- /* @__PURE__ */ jsx("span", { className: 'es:text-lg es:mx-auto es:my-1 es:font-variation-["wdth"_140,"wght"_320] es:text-surface-600', children: __("Item order", "eightshift-ui-components") }),
314
+ /* @__PURE__ */ jsx("span", { className: 'es:text-base es:mx-auto es:my-1 es:font-variation-["wdth"_140,"wght"_320] es:text-surface-600', children: __("Item order", "eightshift-ui-components") }),
315
315
  /* @__PURE__ */ jsx(
316
316
  DraggableList,
317
317
  {
318
- items: simpleValue ? value.map((item) => options.find((option) => option.value === item)) : value,
318
+ items: simpleValue ? value?.map((item) => options.find((option) => option.value === item)) ?? [] : value ?? [],
319
319
  onChange: (value2) => {
320
320
  handleSelectionChange(new Set(value2?.map((item) => item?.value ?? item)));
321
321
  },
@@ -333,7 +333,7 @@ const MultiSelect = (props) => {
333
333
  iconClassName: "es:pointer-events-none es:select-none",
334
334
  labelClassName: "es:line-clamp-1",
335
335
  subtitleClassName: "es:line-clamp-1",
336
- className: clsx("es:min-h-8 es:flex es:items-center es:justify-between", realItem?.icon ? "es:pl-1" : "es:pl-2")
336
+ className: clsx("es:min-h-9 es:flex es:items-center es:justify-between", realItem?.icon ? "es:pl-1" : "es:pl-2")
337
337
  }
338
338
  );
339
339
  }
@@ -7,7 +7,7 @@ import { BaseControl } from "../base-control/base-control.js";
7
7
  import { icons } from "../../icons/icons.js";
8
8
  import { getColumnConfigOutputText } from "./utils.js";
9
9
  import { c as clsx } from "../../clsx-DgYk2OaC.js";
10
- import { A as AnimatePresence, m as motion } from "../../proxy-0B6wWuDe.js";
10
+ import { A as AnimatePresence, m as motion } from "../../proxy-DkQpcQgI.js";
11
11
  /**
12
12
  * A two-thumb slider for selecting a range of columns.
13
13
  *
@@ -6,7 +6,7 @@ import { c as clsx } from "../../clsx-DgYk2OaC.js";
6
6
  import { NumberPicker } from "../number-picker/number-picker.js";
7
7
  import { generateMarkers, generateGridTemplate } from "./utils.js";
8
8
  import { HStack } from "../layout/hstack.js";
9
- import { A as AnimatePresence, m as motion } from "../../proxy-0B6wWuDe.js";
9
+ import { A as AnimatePresence, m as motion } from "../../proxy-DkQpcQgI.js";
10
10
  /**
11
11
  * A single/multi-thumb slider component.
12
12
  *
@@ -460,6 +460,9 @@ const $5e8ad37a45e1c704$export$3d96ec278d3efce4 = /* @__PURE__ */ $f39a9eba43920
460
460
  * @param {string} [props.className] - Classes to pass to the tabs container.
461
461
  * @param {TabsType} [props.type='underline'] - Design of the tabs.
462
462
  * @param {boolean} [props.flat] - If `true`, component will look more flat. Useful for nested layer of controls.
463
+ * @param {string} [props.defaultSelectedKey] - **(uncontrolled mode)** The initial selected tab ID.
464
+ * @param {string} [props.selectedKey] - **(controlled mode)** The selected tab ID.
465
+ * @param {Function} [props.onSelectionChange] - Handler that is called when the selection changes. `(key: string) => void`.
463
466
  * @param {boolean} [props.hidden] - If `true`, the component is not rendered.
464
467
  *
465
468
  * @returns {JSX.Element} The Tabs component.
@@ -487,6 +490,7 @@ const Tabs2 = (props) => {
487
490
  let tabPanelCounter = 1;
488
491
  let tabCounter = 1;
489
492
  const preparedChildren = Array.isArray(children) ? children : [children];
493
+ let realTabIds = preparedChildren?.[0]?.props?.children?.map((tab, i) => tab?.props?.id ?? `tab-${baseId}-${i + 1}`);
490
494
  const childrenWithIds = preparedChildren.reduce((acc, child, index) => {
491
495
  if (child.type.displayName === "TabList") {
492
496
  const childItems = Array.isArray(child?.props?.children) ? child?.props?.children : [child?.props?.children].filter(Boolean);
@@ -504,7 +508,7 @@ const Tabs2 = (props) => {
504
508
  },
505
509
  childItems?.map(
506
510
  (innerChild, i) => cloneElement(innerChild, {
507
- id: `tab-${baseId}-${i + 1}`,
511
+ id: innerChild?.props?.id ?? realTabIds?.[i] ?? `tab-${baseId}-${i + 1}`,
508
512
  key: i,
509
513
  isParentVertical: vertical,
510
514
  type,
@@ -518,7 +522,7 @@ const Tabs2 = (props) => {
518
522
  return [
519
523
  ...acc,
520
524
  cloneElement(child, {
521
- id: `tab-${baseId}-${tabPanelCounter++}`,
525
+ id: realTabIds?.[tabPanelCounter++ - 1] ?? `tab-${baseId}-${tabPanelCounter++}`,
522
526
  key: index,
523
527
  className: child.props.className,
524
528
  flat,
@@ -678,6 +682,7 @@ TabList2.displayName = "TabList";
678
682
  * @param {boolean} [props.invisible] - If `true`, the tab is disabled and not rendered, but is not unmounted from the DOM.
679
683
  * @param {string} [props.label] - Tab label. **Note**: overrides inner items!
680
684
  * @param {string} [props.subtitle] - Tab subtitle. **Note**: overrides inner items!
685
+ * @param {string} [props.id] - The tab unique identifier.
681
686
  *
682
687
  * @returns {JSX.Element} The Tab component.
683
688
  *
@@ -3402,8 +3402,10 @@ const icons = {
3402
3402
  /* @__PURE__ */ jsx("rect", { x: "1", y: "7", width: "7", height: "12", rx: "1.5", fill: "currentColor" })
3403
3403
  ] }),
3404
3404
  reorder: /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 20 20", width: "20", height: "20", fill: "none", children: [
3405
- /* @__PURE__ */ jsx("path", { stroke: "currentColor", strokeLinecap: "round", d: "M2.5 5.5h15m-15 3h15m-15 3h15m-15 3h15", fill: "none" }),
3406
- /* @__PURE__ */ jsx("path", { d: "M12.148 3H7.852a.5.5 0 0 1-.326-.88L9.675.28a.5.5 0 0 1 .65 0l2.149 1.841a.5.5 0 0 1-.326.88Zm0 14H7.852a.5.5 0 0 0-.326.88l2.149 1.841a.5.5 0 0 0 .65 0l2.149-1.841a.5.5 0 0 0-.326-.88Z", fill: "currentColor" })
3405
+ /* @__PURE__ */ jsx("path", { stroke: "currentColor", strokeLinecap: "round", d: "M2.5 5.5h15", fill: "none" }),
3406
+ /* @__PURE__ */ jsx("path", { d: "M17.5 8a.5.5 0 0 1 0 1h-15a.5.5 0 0 1 0-1h15Zm0 3a.5.5 0 0 1 0 1h-15a.5.5 0 0 1 0-1h15Z", fill: "currentColor" }),
3407
+ /* @__PURE__ */ jsx("path", { stroke: "currentColor", strokeLinecap: "round", d: "M2.5 14.5h15", fill: "none" }),
3408
+ /* @__PURE__ */ jsx("path", { d: "M12.5 3h-5a.5.5 0 0 1-.3-.9L9.7.225a.5.5 0 0 1 .6 0L12.8 2.1a.5.5 0 0 1-.3.9Zm0 14h-5a.5.5 0 0 0-.3.9l2.5 1.875a.5.5 0 0 0 .6 0l2.5-1.875a.5.5 0 0 0-.3-.9Z", fill: "currentColor" })
3407
3409
  ] }),
3408
3410
  loaderAlt: /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 20 20", width: "20", height: "20", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M10 19v-2m-9-7h2m13.367 6.367-1.414-1.414m-11.32 1.414 1.414-1.414M10 3V1m7 9h2M5.047 5.047 3.633 3.633m11.32 1.414 1.414-1.414M10 17v-1.555M3 10h1.555m10.396 4.951-1.1-1.1m-8.803 1.1 1.1-1.1M10 4.556V3m5.444 7H17M6.147 6.147l-1.1-1.1m8.806 1.1 1.1-1.1", stroke: "currentColor", strokeLinecap: "round", fill: "none" }) })
3409
3411
  };
@@ -6184,6 +6184,7 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
6184
6184
  this.treeScale = { x: 1, y: 1 };
6185
6185
  this.eventHandlers = /* @__PURE__ */ new Map();
6186
6186
  this.hasTreeAnimated = false;
6187
+ this.layoutVersion = 0;
6187
6188
  this.updateScheduled = false;
6188
6189
  this.scheduleUpdate = () => this.update();
6189
6190
  this.projectionUpdateScheduled = false;
@@ -6201,6 +6202,7 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
6201
6202
  this.nodes.forEach(cleanDirtyNodes);
6202
6203
  };
6203
6204
  this.resolvedRelativeTargetAt = 0;
6205
+ this.linkedParentVersion = 0;
6204
6206
  this.hasProjected = false;
6205
6207
  this.isVisible = true;
6206
6208
  this.animationProgress = 0;
@@ -6456,6 +6458,7 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
6456
6458
  }
6457
6459
  const prevLayout = this.layout;
6458
6460
  this.layout = this.measure(false);
6461
+ this.layoutVersion++;
6459
6462
  this.layoutCorrected = createBox();
6460
6463
  this.isLayoutDirty = false;
6461
6464
  this.projectionDelta = void 0;
@@ -6623,17 +6626,15 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
6623
6626
  if (!this.layout || !(layout2 || layoutId))
6624
6627
  return;
6625
6628
  this.resolvedRelativeTargetAt = frameData.timestamp;
6629
+ const relativeParent = this.getClosestProjectingParent();
6630
+ if (relativeParent && this.linkedParentVersion !== relativeParent.layoutVersion && !relativeParent.options.layoutRoot) {
6631
+ this.removeRelativeTarget();
6632
+ }
6626
6633
  if (!this.targetDelta && !this.relativeTarget) {
6627
- const relativeParent = this.getClosestProjectingParent();
6628
- if (relativeParent && relativeParent.layout && this.animationProgress !== 1) {
6629
- this.relativeParent = relativeParent;
6630
- this.forceRelativeParentToResolveTarget();
6631
- this.relativeTarget = createBox();
6632
- this.relativeTargetOrigin = createBox();
6633
- calcRelativePosition(this.relativeTargetOrigin, this.layout.layoutBox, relativeParent.layout.layoutBox);
6634
- copyBoxInto(this.relativeTarget, this.relativeTargetOrigin);
6634
+ if (relativeParent && relativeParent.layout) {
6635
+ this.createRelativeTarget(relativeParent, this.layout.layoutBox, relativeParent.layout.layoutBox);
6635
6636
  } else {
6636
- this.relativeParent = this.relativeTarget = void 0;
6637
+ this.removeRelativeTarget();
6637
6638
  }
6638
6639
  }
6639
6640
  if (!this.relativeTarget && !this.targetDelta)
@@ -6657,14 +6658,8 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
6657
6658
  }
6658
6659
  if (this.attemptToResolveRelativeTarget) {
6659
6660
  this.attemptToResolveRelativeTarget = false;
6660
- const relativeParent = this.getClosestProjectingParent();
6661
6661
  if (relativeParent && Boolean(relativeParent.resumingFrom) === Boolean(this.resumingFrom) && !relativeParent.options.layoutScroll && relativeParent.target && this.animationProgress !== 1) {
6662
- this.relativeParent = relativeParent;
6663
- this.forceRelativeParentToResolveTarget();
6664
- this.relativeTarget = createBox();
6665
- this.relativeTargetOrigin = createBox();
6666
- calcRelativePosition(this.relativeTargetOrigin, this.target, relativeParent.target);
6667
- copyBoxInto(this.relativeTarget, this.relativeTargetOrigin);
6662
+ this.createRelativeTarget(relativeParent, this.target, relativeParent.target);
6668
6663
  } else {
6669
6664
  this.relativeParent = this.relativeTarget = void 0;
6670
6665
  }
@@ -6683,6 +6678,18 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
6683
6678
  isProjecting() {
6684
6679
  return Boolean((this.relativeTarget || this.targetDelta || this.options.layoutRoot) && this.layout);
6685
6680
  }
6681
+ createRelativeTarget(relativeParent, layout2, parentLayout) {
6682
+ this.relativeParent = relativeParent;
6683
+ this.linkedParentVersion = relativeParent.layoutVersion;
6684
+ this.forceRelativeParentToResolveTarget();
6685
+ this.relativeTarget = createBox();
6686
+ this.relativeTargetOrigin = createBox();
6687
+ calcRelativePosition(this.relativeTargetOrigin, layout2, parentLayout);
6688
+ copyBoxInto(this.relativeTarget, this.relativeTargetOrigin);
6689
+ }
6690
+ removeRelativeTarget() {
6691
+ this.relativeParent = this.relativeTarget = void 0;
6692
+ }
6686
6693
  calcProjection() {
6687
6694
  const lead = this.getLead();
6688
6695
  const isShared = Boolean(this.resumingFrom) || this !== lead;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eightshift/ui-components",
3
- "version": "6.0.5",
3
+ "version": "6.0.8",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -88,7 +88,7 @@
88
88
  "just-throttle": "^4.2.0",
89
89
  "lightningcss": "^1.30.2",
90
90
  "postcss": "^8.5.6",
91
- "prettier": "^3.7.0",
91
+ "prettier": "^3.7.3",
92
92
  "prettier-plugin-tailwindcss": "^0.7.1",
93
93
  "react": "^18.3.1",
94
94
  "react-aria": "^3.44.0",
@@ -101,12 +101,12 @@
101
101
  "tailwindcss": "^4.1.17",
102
102
  "tailwindcss-motion": "^1.1.1",
103
103
  "tailwindcss-react-aria-components": "^2.0.1",
104
- "vite": "^7.2.4",
104
+ "vite": "^7.2.6",
105
105
  "vite-plugin-lib-inject-css": "^2.2.2"
106
106
  },
107
107
  "dependencies": {
108
108
  "@fontsource-variable/geist-mono": "^5.2.7",
109
109
  "@fontsource-variable/roboto-flex": "^5.2.8",
110
- "motion": "^12.23.24"
110
+ "motion": "^12.23.25"
111
111
  }
112
112
  }