@serendie/ui 2.0.0 → 2.1.0

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.
Files changed (118) hide show
  1. package/dist/components/CheckBox/CheckBox.js +36 -35
  2. package/dist/components/ChoiceBox/ChoiceBox.js +41 -41
  3. package/dist/components/DataTable/DataTableComponent.d.ts +3 -20
  4. package/dist/components/DataTable/DataTableComponent.js +38 -36
  5. package/dist/components/DataTable/table/HeaderCheckbox.js +29 -19
  6. package/dist/components/Search/Search.d.ts +3 -1
  7. package/dist/components/Search/Search.js +34 -33
  8. package/dist/components/Select/Select.d.ts +2 -1
  9. package/dist/components/Select/Select.js +47 -41
  10. package/dist/components/Tooltip/Tooltip.d.ts +14 -0
  11. package/dist/components/Tooltip/Tooltip.js +70 -0
  12. package/dist/components/Tooltip/index.d.ts +1 -0
  13. package/dist/components/Tooltip/index.js +4 -0
  14. package/dist/index.d.ts +1 -0
  15. package/dist/index.js +12 -10
  16. package/dist/node_modules/@ark-ui/react/dist/components/accordion/accordion-item-content.js +4 -6
  17. package/dist/node_modules/@ark-ui/react/dist/components/accordion/accordion-item-indicator.js +4 -6
  18. package/dist/node_modules/@ark-ui/react/dist/components/accordion/accordion-item-trigger.js +10 -12
  19. package/dist/node_modules/@ark-ui/react/dist/components/accordion/accordion-item.js +16 -16
  20. package/dist/node_modules/@ark-ui/react/dist/components/accordion/use-accordion.js +13 -20
  21. package/dist/node_modules/@ark-ui/react/dist/components/avatar/avatar-root.js +1 -5
  22. package/dist/node_modules/@ark-ui/react/dist/components/avatar/use-avatar.js +14 -18
  23. package/dist/node_modules/@ark-ui/react/dist/components/checkbox/checkbox-hidden-input.js +4 -6
  24. package/dist/node_modules/@ark-ui/react/dist/components/checkbox/use-checkbox.js +22 -28
  25. package/dist/node_modules/@ark-ui/react/dist/components/collapsible/collapsible-content.js +7 -9
  26. package/dist/node_modules/@ark-ui/react/dist/components/collapsible/use-collapsible.js +14 -21
  27. package/dist/node_modules/@ark-ui/react/dist/components/collection/list-collection.js +5 -0
  28. package/dist/node_modules/@ark-ui/react/dist/components/combobox/combobox-content.js +9 -8
  29. package/dist/node_modules/@ark-ui/react/dist/components/combobox/combobox-item-group.js +4 -6
  30. package/dist/node_modules/@ark-ui/react/dist/components/combobox/combobox-positioner.js +4 -6
  31. package/dist/node_modules/@ark-ui/react/dist/components/combobox/combobox-root.js +17 -18
  32. package/dist/node_modules/@ark-ui/react/dist/components/combobox/combobox-trigger.js +10 -9
  33. package/dist/node_modules/@ark-ui/react/dist/components/combobox/use-combobox-item-context.js +5 -7
  34. package/dist/node_modules/@ark-ui/react/dist/components/combobox/use-combobox.js +21 -45
  35. package/dist/node_modules/@ark-ui/react/dist/components/dialog/dialog-backdrop.js +10 -9
  36. package/dist/node_modules/@ark-ui/react/dist/components/dialog/dialog-close-trigger.js +4 -6
  37. package/dist/node_modules/@ark-ui/react/dist/components/dialog/dialog-content.js +6 -5
  38. package/dist/node_modules/@ark-ui/react/dist/components/dialog/dialog-description.js +4 -6
  39. package/dist/node_modules/@ark-ui/react/dist/components/dialog/use-dialog.js +13 -22
  40. package/dist/node_modules/@ark-ui/react/dist/components/factory.js +26 -24
  41. package/dist/node_modules/@ark-ui/react/dist/components/menu/menu-content.js +9 -8
  42. package/dist/node_modules/@ark-ui/react/dist/components/menu/menu-item-group.js +1 -3
  43. package/dist/node_modules/@ark-ui/react/dist/components/menu/menu-item.js +15 -13
  44. package/dist/node_modules/@ark-ui/react/dist/components/menu/menu-root.js +13 -14
  45. package/dist/node_modules/@ark-ui/react/dist/components/menu/use-menu-option-item-props-context.js +10 -0
  46. package/dist/node_modules/@ark-ui/react/dist/components/menu/use-menu.js +14 -21
  47. package/dist/node_modules/@ark-ui/react/dist/components/pagination/pagination-ellipsis.js +4 -6
  48. package/dist/node_modules/@ark-ui/react/dist/components/pagination/pagination-next-trigger.js +4 -6
  49. package/dist/node_modules/@ark-ui/react/dist/components/pagination/pagination-prev-trigger.js +4 -6
  50. package/dist/node_modules/@ark-ui/react/dist/components/pagination/pagination-root.js +5 -4
  51. package/dist/node_modules/@ark-ui/react/dist/components/pagination/use-pagination.js +13 -19
  52. package/dist/node_modules/@ark-ui/react/dist/components/portal/portal.js +25 -16
  53. package/dist/node_modules/@ark-ui/react/dist/components/presence/split-presence-props.js +3 -2
  54. package/dist/node_modules/@ark-ui/react/dist/components/presence/use-presence.js +18 -18
  55. package/dist/node_modules/@ark-ui/react/dist/components/radio-group/radio-group-item-control.js +4 -6
  56. package/dist/node_modules/@ark-ui/react/dist/components/radio-group/radio-group-item-text.js +4 -6
  57. package/dist/node_modules/@ark-ui/react/dist/components/radio-group/radio-group-item.js +1 -5
  58. package/dist/node_modules/@ark-ui/react/dist/components/radio-group/use-radio-group.js +14 -22
  59. package/dist/node_modules/@ark-ui/react/dist/components/select/select-content.js +9 -8
  60. package/dist/node_modules/@ark-ui/react/dist/components/select/select-root.js +11 -12
  61. package/dist/node_modules/@ark-ui/react/dist/components/select/use-select.js +20 -47
  62. package/dist/node_modules/@ark-ui/react/dist/components/switch/switch-hidden-input.js +4 -6
  63. package/dist/node_modules/@ark-ui/react/dist/components/switch/use-switch.js +20 -26
  64. package/dist/node_modules/@ark-ui/react/dist/components/tabs/tabs-root.js +9 -8
  65. package/dist/node_modules/@ark-ui/react/dist/components/tabs/use-tabs.js +14 -21
  66. package/dist/node_modules/@ark-ui/react/dist/components/toast/create-toaster.js +3 -7
  67. package/dist/node_modules/@ark-ui/react/dist/components/toast/toaster.js +28 -15
  68. package/dist/node_modules/@ark-ui/react/dist/components/tooltip/tooltip-arrow-tip.js +13 -0
  69. package/dist/node_modules/@ark-ui/react/dist/components/tooltip/tooltip-arrow.js +13 -0
  70. package/dist/node_modules/@ark-ui/react/dist/components/tooltip/tooltip-content.js +15 -0
  71. package/dist/node_modules/@ark-ui/react/dist/components/tooltip/tooltip-positioner.js +14 -0
  72. package/dist/node_modules/@ark-ui/react/dist/components/tooltip/tooltip-root.js +14 -0
  73. package/dist/node_modules/@ark-ui/react/dist/components/tooltip/tooltip-trigger.js +13 -0
  74. package/dist/node_modules/@ark-ui/react/dist/components/tooltip/use-tooltip-context.js +10 -0
  75. package/dist/node_modules/@ark-ui/react/dist/components/tooltip/use-tooltip.js +17 -0
  76. package/dist/node_modules/@ark-ui/react/dist/utils/compose-refs.js +13 -7
  77. package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +92 -90
  78. package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +230 -216
  79. package/dist/node_modules/@zag-js/accordion/dist/index.js +210 -227
  80. package/dist/node_modules/@zag-js/aria-hidden/dist/index.js +49 -12
  81. package/dist/node_modules/@zag-js/avatar/dist/index.js +119 -134
  82. package/dist/node_modules/@zag-js/checkbox/dist/index.js +196 -197
  83. package/dist/node_modules/@zag-js/collapsible/dist/index.js +250 -198
  84. package/dist/node_modules/@zag-js/collection/dist/index.js +172 -179
  85. package/dist/node_modules/@zag-js/combobox/dist/index.js +1176 -1082
  86. package/dist/node_modules/@zag-js/core/dist/index.js +77 -496
  87. package/dist/node_modules/@zag-js/dialog/dist/index.js +243 -270
  88. package/dist/node_modules/@zag-js/dismissable/dist/index.js +62 -60
  89. package/dist/node_modules/@zag-js/dom-query/dist/index.js +465 -253
  90. package/dist/node_modules/@zag-js/focus-trap/dist/index.js +307 -0
  91. package/dist/node_modules/@zag-js/focus-visible/dist/index.js +48 -47
  92. package/dist/node_modules/@zag-js/interact-outside/dist/index.js +112 -80
  93. package/dist/node_modules/@zag-js/menu/dist/index.js +998 -884
  94. package/dist/node_modules/@zag-js/pagination/dist/index.js +207 -213
  95. package/dist/node_modules/@zag-js/popper/dist/index.js +130 -129
  96. package/dist/node_modules/@zag-js/presence/dist/index.js +139 -122
  97. package/dist/node_modules/@zag-js/radio-group/dist/index.js +297 -302
  98. package/dist/node_modules/@zag-js/react/dist/index.js +255 -103
  99. package/dist/node_modules/@zag-js/remove-scroll/dist/index.js +18 -31
  100. package/dist/node_modules/@zag-js/select/dist/index.js +889 -885
  101. package/dist/node_modules/@zag-js/store/dist/index.js +98 -137
  102. package/dist/node_modules/@zag-js/switch/dist/index.js +199 -191
  103. package/dist/node_modules/@zag-js/tabs/dist/index.js +383 -386
  104. package/dist/node_modules/@zag-js/toast/dist/index.js +646 -633
  105. package/dist/node_modules/@zag-js/tooltip/dist/index.js +459 -0
  106. package/dist/node_modules/@zag-js/types/dist/index.js +6 -6
  107. package/dist/node_modules/@zag-js/utils/dist/index.js +112 -99
  108. package/dist/node_modules/proxy-compare/dist/index.js +4 -106
  109. package/dist/styles.css +1 -1
  110. package/package.json +5 -5
  111. package/dist/node_modules/@ark-ui/react/dist/utils/use-is-server.js +0 -10
  112. package/dist/node_modules/@zag-js/dom-event/dist/index.js +0 -130
  113. package/dist/node_modules/@zag-js/element-rect/dist/index.js +0 -32
  114. package/dist/node_modules/@zag-js/form-utils/dist/index.js +0 -51
  115. package/dist/node_modules/aria-hidden/dist/es2015/index.js +0 -52
  116. package/dist/node_modules/focus-trap/dist/focus-trap.esm.js +0 -431
  117. package/dist/node_modules/klona/full/index.js +0 -21
  118. package/dist/node_modules/tabbable/dist/index.esm.js +0 -202
@@ -1,113 +1,159 @@
1
- import { isEqual as c, isObject as u, hasProp as h } from "../../utils/dist/index.js";
2
- var y = Object.defineProperty, I = (t, e, i) => e in t ? y(t, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[e] = i, p = (t, e, i) => I(t, e + "", i), a = {
3
- itemToValue(t) {
4
- return typeof t == "string" ? t : u(t) && h(t, "value") ? t.value : "";
1
+ import { isEqual as O, isObject as d, hasProp as p } from "../../utils/dist/index.js";
2
+ var S = Object.defineProperty, v = (n, h, t) => h in n ? S(n, h, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[h] = t, r = (n, h, t) => v(n, typeof h != "symbol" ? h + "" : h, t), c = {
3
+ itemToValue(n) {
4
+ return typeof n == "string" ? n : d(n) && p(n, "value") ? n.value : "";
5
5
  },
6
- itemToString(t) {
7
- return typeof t == "string" ? t : u(t) && h(t, "label") ? t.label : a.itemToValue(t);
6
+ itemToString(n) {
7
+ return typeof n == "string" ? n : d(n) && p(n, "label") ? n.label : c.itemToValue(n);
8
8
  },
9
- isItemDisabled(t) {
10
- return u(t) && h(t, "disabled") ? !!t.disabled : !1;
11
- }
12
- }, T = class {
13
- constructor(t) {
14
- this.options = t, p(this, "items"), this.items = [...t.items];
15
- }
16
- isEqual(t) {
17
- return c(this.items, t.items);
18
- }
19
- /**
20
- * Function to update the collection items
21
- */
22
- setItems(t) {
23
- this.items = Array.from(t);
24
- }
25
- /**
26
- * Returns all the values in the collection
27
- */
28
- getValues(t = this.items) {
29
- return Array.from(t).map((e) => this.getItemValue(e)).filter(Boolean);
30
- }
31
- /**
32
- * Get the item based on its value
33
- */
34
- find(t) {
35
- if (t == null) return null;
36
- const e = this.items.findIndex((i) => this.getItemValue(i) === t);
37
- return e != null ? this.items[e] : null;
38
- }
39
- /**
40
- * Get the items based on its values
41
- */
42
- findMany(t) {
43
- return Array.from(t).map((e) => this.find(e)).filter(Boolean);
44
- }
45
- /**
46
- * Get the item based on its index
47
- */
48
- at(t) {
49
- return this.items[t] ?? null;
50
- }
51
- sortFn(t, e) {
52
- const i = this.indexOf(t), s = this.indexOf(e);
53
- return (i ?? 0) - (s ?? 0);
54
- }
55
- /**
56
- * Sort the values based on their index
57
- */
58
- sort(t) {
59
- return [...t].sort(this.sortFn.bind(this));
60
- }
61
- /**
62
- * Convert an item to a value
63
- */
64
- getItemValue(t) {
65
- var e, i;
66
- return t == null ? null : ((i = (e = this.options).itemToValue) == null ? void 0 : i.call(e, t)) ?? a.itemToValue(t);
67
- }
68
- /**
69
- * Whether an item is disabled
70
- */
71
- getItemDisabled(t) {
72
- var e, i;
73
- return t == null ? !1 : ((i = (e = this.options).isItemDisabled) == null ? void 0 : i.call(e, t)) ?? a.isItemDisabled(t);
74
- }
75
- /**
76
- * Convert an item to a string
77
- */
78
- stringifyItem(t) {
79
- var e, i;
80
- return t == null ? null : ((i = (e = this.options).itemToString) == null ? void 0 : i.call(e, t)) ?? a.itemToString(t);
81
- }
82
- /**
83
- * Convert a value to a string
84
- */
85
- stringify(t) {
86
- return t == null ? null : this.stringifyItem(this.find(t));
87
- }
88
- /**
89
- * Convert an array of items to a string
90
- */
91
- stringifyItems(t, e = ", ") {
92
- return Array.from(t).map((i) => this.stringifyItem(i)).filter(Boolean).join(e);
93
- }
94
- /**
95
- * Convert an array of items to a string
96
- */
97
- stringifyMany(t, e) {
98
- return this.stringifyItems(this.findMany(t), e);
99
- }
100
- /**
101
- * Whether the collection has a value
102
- */
103
- has(t) {
104
- return this.indexOf(t) !== -1;
105
- }
106
- /**
107
- * Whether the collection has an item
108
- */
109
- hasItem(t) {
110
- return t == null ? !1 : this.has(this.getItemValue(t));
9
+ isItemDisabled(n) {
10
+ return d(n) && p(n, "disabled") ? !!n.disabled : !1;
11
+ }
12
+ }, w = class x {
13
+ constructor(h) {
14
+ this.options = h, r(this, "items"), r(this, "copy", (t) => new x({ ...this.options, items: t ?? [...this.items] })), r(this, "isEqual", (t) => O(this.items, t.items)), r(this, "setItems", (t) => this.copy(t)), r(this, "getValues", (t = this.items) => Array.from(t).map((e) => this.getItemValue(e)).filter(Boolean)), r(this, "find", (t) => {
15
+ if (t == null) return null;
16
+ const e = this.indexOf(t);
17
+ return e != null ? this.at(e) : null;
18
+ }), r(this, "findMany", (t) => Array.from(t).map((e) => this.find(e)).filter((e) => e != null)), r(this, "at", (t) => {
19
+ if (!this.options.groupBy && !this.options.groupSort)
20
+ return this.items[t] ?? null;
21
+ let e = 0;
22
+ const i = this.group();
23
+ for (const [, s] of i)
24
+ for (const u of s) {
25
+ if (e === t) return u;
26
+ e++;
27
+ }
28
+ return null;
29
+ }), r(this, "sortFn", (t, e) => {
30
+ const i = this.indexOf(t), s = this.indexOf(e);
31
+ return (i ?? 0) - (s ?? 0);
32
+ }), r(this, "sort", (t) => [...t].sort(this.sortFn.bind(this))), r(this, "getItemValue", (t) => {
33
+ var e, i;
34
+ return t == null ? null : ((i = (e = this.options).itemToValue) == null ? void 0 : i.call(e, t)) ?? c.itemToValue(t);
35
+ }), r(this, "getItemDisabled", (t) => {
36
+ var e, i;
37
+ return t == null ? !1 : ((i = (e = this.options).isItemDisabled) == null ? void 0 : i.call(e, t)) ?? c.isItemDisabled(t);
38
+ }), r(this, "stringifyItem", (t) => {
39
+ var e, i;
40
+ return t == null ? null : ((i = (e = this.options).itemToString) == null ? void 0 : i.call(e, t)) ?? c.itemToString(t);
41
+ }), r(this, "stringify", (t) => t == null ? null : this.stringifyItem(this.find(t))), r(this, "stringifyItems", (t, e = ", ") => Array.from(t).map((i) => this.stringifyItem(i)).filter(Boolean).join(e)), r(this, "stringifyMany", (t, e) => this.stringifyItems(this.findMany(t), e)), r(this, "has", (t) => this.indexOf(t) !== -1), r(this, "hasItem", (t) => t == null ? !1 : this.has(this.getItemValue(t))), r(this, "group", () => {
42
+ const { groupBy: t, groupSort: e } = this.options;
43
+ if (!t) return [["", [...this.items]]];
44
+ const i = /* @__PURE__ */ new Map();
45
+ this.items.forEach((u, l) => {
46
+ const o = t(u, l);
47
+ i.has(o) || i.set(o, []), i.get(o).push(u);
48
+ });
49
+ let s = Array.from(i.entries());
50
+ return e && s.sort(([u], [l]) => {
51
+ if (typeof e == "function") return e(u, l);
52
+ if (Array.isArray(e)) {
53
+ const o = e.indexOf(u), f = e.indexOf(l);
54
+ return o === -1 ? 1 : f === -1 ? -1 : o - f;
55
+ }
56
+ return e === "asc" ? u.localeCompare(l) : e === "desc" ? l.localeCompare(u) : 0;
57
+ }), s;
58
+ }), r(this, "getNextValue", (t, e = 1, i = !1) => {
59
+ let s = this.indexOf(t);
60
+ if (s === -1) return null;
61
+ for (s = i ? Math.min(s + e, this.size - 1) : s + e; s <= this.size && this.getItemDisabled(this.at(s)); ) s++;
62
+ return this.getItemValue(this.at(s));
63
+ }), r(this, "getPreviousValue", (t, e = 1, i = !1) => {
64
+ let s = this.indexOf(t);
65
+ if (s === -1) return null;
66
+ for (s = i ? Math.max(s - e, 0) : s - e; s >= 0 && this.getItemDisabled(this.at(s)); ) s--;
67
+ return this.getItemValue(this.at(s));
68
+ }), r(this, "indexOf", (t) => {
69
+ if (t == null) return -1;
70
+ if (!this.options.groupBy && !this.options.groupSort)
71
+ return this.items.findIndex((s) => this.getItemValue(s) === t);
72
+ let e = 0;
73
+ const i = this.group();
74
+ for (const [, s] of i)
75
+ for (const u of s) {
76
+ if (this.getItemValue(u) === t) return e;
77
+ e++;
78
+ }
79
+ return -1;
80
+ }), r(this, "getByText", (t, e) => {
81
+ let i = e != null ? A(this.items, this.indexOf(e)) : this.items;
82
+ return t.length === 1 && (i = i.filter((u) => this.getItemValue(u) !== e)), i.find((u) => B(this.stringifyItem(u), t));
83
+ }), r(this, "search", (t, e) => {
84
+ const { state: i, currentValue: s, timeout: u = 350 } = e, l = i.keysSoFar + t, f = l.length > 1 && Array.from(l).every((m) => m === l[0]) ? l[0] : l, V = this.getByText(f, s), b = this.getItemValue(V);
85
+ function y() {
86
+ clearTimeout(i.timer), i.timer = -1;
87
+ }
88
+ function I(m) {
89
+ i.keysSoFar = m, y(), m !== "" && (i.timer = +setTimeout(() => {
90
+ I(""), y();
91
+ }, u));
92
+ }
93
+ return I(l), b;
94
+ }), r(this, "update", (t, e) => {
95
+ let i = this.items.findIndex((s) => this.getItemValue(s) === t);
96
+ return i === -1 ? this : this.copy([...this.items.slice(0, i), e, ...this.items.slice(i + 1)]);
97
+ }), r(this, "insert", (t, ...e) => this.copy(a(this.items, t, ...e))), r(this, "insertBefore", (t, ...e) => {
98
+ let i = this.indexOf(t);
99
+ if (i === -1)
100
+ if (this.items.length === 0) i = 0;
101
+ else return this;
102
+ return this.copy(a(this.items, i, ...e));
103
+ }), r(this, "insertAfter", (t, ...e) => {
104
+ let i = this.indexOf(t);
105
+ if (i === -1)
106
+ if (this.items.length === 0) i = 0;
107
+ else return this;
108
+ return this.copy(a(this.items, i + 1, ...e));
109
+ }), r(this, "prepend", (...t) => this.copy(a(this.items, 0, ...t))), r(this, "append", (...t) => this.copy(a(this.items, this.items.length, ...t))), r(this, "filter", (t) => {
110
+ const e = this.items.filter((i, s) => t(this.stringifyItem(i), s));
111
+ return this.copy(e);
112
+ }), r(this, "remove", (...t) => {
113
+ const e = t.map(
114
+ (i) => typeof i == "string" ? i : this.getItemValue(i)
115
+ );
116
+ return this.copy(
117
+ this.items.filter((i) => {
118
+ const s = this.getItemValue(i);
119
+ return s == null ? !1 : !e.includes(s);
120
+ })
121
+ );
122
+ }), r(this, "move", (t, e) => {
123
+ const i = this.indexOf(t);
124
+ return i === -1 ? this : this.copy(g(this.items, [i], e));
125
+ }), r(this, "moveBefore", (t, ...e) => {
126
+ let i = this.items.findIndex((u) => this.getItemValue(u) === t);
127
+ if (i === -1) return this;
128
+ let s = e.map((u) => this.items.findIndex((l) => this.getItemValue(l) === u)).sort((u, l) => u - l);
129
+ return this.copy(g(this.items, s, i));
130
+ }), r(this, "moveAfter", (t, ...e) => {
131
+ let i = this.items.findIndex((u) => this.getItemValue(u) === t);
132
+ if (i === -1) return this;
133
+ let s = e.map((u) => this.items.findIndex((l) => this.getItemValue(l) === u)).sort((u, l) => u - l);
134
+ return this.copy(g(this.items, s, i + 1));
135
+ }), r(this, "reorder", (t, e) => this.copy(g(this.items, [t], e))), r(this, "compareValue", (t, e) => {
136
+ const i = this.indexOf(t), s = this.indexOf(e);
137
+ return i < s ? -1 : i > s ? 1 : 0;
138
+ }), r(this, "range", (t, e) => {
139
+ let i = [], s = t;
140
+ for (; s != null; ) {
141
+ if (this.find(s) && i.push(s), s === e) return i;
142
+ s = this.getNextValue(s);
143
+ }
144
+ return [];
145
+ }), r(this, "getValueRange", (t, e) => t && e ? this.compareValue(t, e) <= 0 ? this.range(t, e) : this.range(e, t) : []), r(this, "toString", () => {
146
+ let t = "";
147
+ for (const e of this.items) {
148
+ const i = this.getItemValue(e), s = this.stringifyItem(e), u = this.getItemDisabled(e), l = [i, s, u].filter(Boolean).join(":");
149
+ t += l + ",";
150
+ }
151
+ return t;
152
+ }), r(this, "toJSON", () => ({
153
+ size: this.size,
154
+ first: this.firstValue,
155
+ last: this.lastValue
156
+ })), this.items = [...h.items];
111
157
  }
112
158
  /**
113
159
  * Returns the number of items in the collection
@@ -119,85 +165,32 @@ var y = Object.defineProperty, I = (t, e, i) => e in t ? y(t, e, { enumerable: !
119
165
  * Returns the first value in the collection
120
166
  */
121
167
  get firstValue() {
122
- let t = 0;
123
- for (; this.getItemDisabled(this.at(t)); ) t++;
124
- return this.getItemValue(this.at(t));
168
+ let h = 0;
169
+ for (; this.getItemDisabled(this.at(h)); ) h++;
170
+ return this.getItemValue(this.at(h));
125
171
  }
126
172
  /**
127
173
  * Returns the last value in the collection
128
174
  */
129
175
  get lastValue() {
130
- let t = this.size - 1;
131
- for (; this.getItemDisabled(this.at(t)); ) t--;
132
- return this.getItemValue(this.at(t));
133
- }
134
- /**
135
- * Returns the next value in the collection
136
- */
137
- getNextValue(t, e = 1, i = !1) {
138
- let s = this.indexOf(t);
139
- if (s === -1) return null;
140
- for (s = i ? Math.min(s + e, this.size - 1) : s + e; s <= this.size && this.getItemDisabled(this.at(s)); ) s++;
141
- return this.getItemValue(this.at(s));
142
- }
143
- /**
144
- * Returns the previous value in the collection
145
- */
146
- getPreviousValue(t, e = 1, i = !1) {
147
- let s = this.indexOf(t);
148
- if (s === -1) return null;
149
- for (s = i ? Math.max(s - e, 0) : s - e; s >= 0 && this.getItemDisabled(this.at(s)); ) s--;
150
- return this.getItemValue(this.at(s));
151
- }
152
- /**
153
- * Get the index of an item based on its key
154
- */
155
- indexOf(t) {
156
- return t == null ? -1 : this.items.findIndex((e) => this.getItemValue(e) === t);
157
- }
158
- getByText(t, e) {
159
- let i = e != null ? x(this.items, this.indexOf(e)) : this.items;
160
- return t.length === 1 && (i = i.filter((n) => this.getItemValue(n) !== e)), i.find((n) => V(this.stringifyItem(n), t));
161
- }
162
- /**
163
- * Search for a value based on a query
164
- */
165
- search(t, e) {
166
- const { state: i, currentValue: s, timeout: n = 350 } = e, r = i.keysSoFar + t, m = r.length > 1 && Array.from(r).every((l) => l === r[0]) ? r[0] : r, d = this.getByText(m, s), g = this.getItemValue(d);
167
- function f() {
168
- clearTimeout(i.timer), i.timer = -1;
169
- }
170
- function o(l) {
171
- i.keysSoFar = l, f(), l !== "" && (i.timer = +setTimeout(() => {
172
- o(""), f();
173
- }, n));
174
- }
175
- return o(r), g;
176
+ let h = this.size - 1;
177
+ for (; this.getItemDisabled(this.at(h)); ) h--;
178
+ return this.getItemValue(this.at(h));
176
179
  }
177
180
  *[Symbol.iterator]() {
178
181
  yield* this.items;
179
182
  }
180
- insertBefore(t, e) {
181
- const i = this.indexOf(t);
182
- i !== -1 && this.items.splice(i, 0, e);
183
- }
184
- insertAfter(t, e) {
185
- const i = this.indexOf(t);
186
- i !== -1 && this.items.splice(i + 1, 0, e);
187
- }
188
- reorder(t, e) {
189
- if (t === -1 || e === -1 || t === e) return;
190
- const [i] = this.items.splice(t, 1);
191
- this.items.splice(e, 0, i);
192
- }
193
- json() {
194
- return {
195
- size: this.size,
196
- first: this.firstValue,
197
- last: this.lastValue
198
- };
199
- }
200
- }, V = (t, e) => !!(t != null && t.toLowerCase().startsWith(e.toLowerCase())), x = (t, e) => t.map((i, s) => t[(Math.max(e, 0) + s) % t.length]);
183
+ }, B = (n, h) => !!(n != null && n.toLowerCase().startsWith(h.toLowerCase())), A = (n, h) => n.map((t, e) => n[(Math.max(h, 0) + e) % n.length]);
184
+ function a(n, h, ...t) {
185
+ return [...n.slice(0, h), ...t, ...n.slice(h)];
186
+ }
187
+ function g(n, h, t) {
188
+ h = [...h].sort((i, s) => i - s);
189
+ const e = h.map((i) => n[i]);
190
+ for (let i = h.length - 1; i >= 0; i--)
191
+ n = [...n.slice(0, h[i]), ...n.slice(h[i] + 1)];
192
+ return t = Math.max(0, t - h.filter((i) => i < t).length), [...n.slice(0, t), ...e, ...n.slice(t)];
193
+ }
201
194
  export {
202
- T as ListCollection
195
+ w as ListCollection
203
196
  };