@propellerads/pagination 3.1.4 → 4.0.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.
- package/README.md +97 -0
- package/dist/index.d.ts +9 -1
- package/dist/index.js +89 -709
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/dist/index.css +0 -2
package/dist/index.js
CHANGED
|
@@ -1,746 +1,126 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
//#region
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
function C(e) {
|
|
17
|
-
return x() ? e instanceof HTMLElement || e instanceof S(e).HTMLElement : !1;
|
|
18
|
-
}
|
|
19
|
-
//#endregion
|
|
20
|
-
//#region ../../node_modules/@base-ui-components/utils/esm/useRefWithInit.js
|
|
21
|
-
var w = {};
|
|
22
|
-
function T(t, n) {
|
|
23
|
-
let r = e.useRef(w);
|
|
24
|
-
return r.current === w && (r.current = t(n)), r;
|
|
25
|
-
}
|
|
26
|
-
//#endregion
|
|
27
|
-
//#region ../../node_modules/@base-ui-components/utils/esm/useStableCallback.js
|
|
28
|
-
var E = e[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0, -3)], D = E && E !== e.useLayoutEffect ? E : (e) => e();
|
|
29
|
-
function O(e) {
|
|
30
|
-
let t = T(k).current;
|
|
31
|
-
return t.next = e, D(t.effect), t.trampoline;
|
|
32
|
-
}
|
|
33
|
-
function k() {
|
|
34
|
-
let e = {
|
|
35
|
-
next: void 0,
|
|
36
|
-
callback: A,
|
|
37
|
-
trampoline: (...t) => e.callback?.(...t),
|
|
38
|
-
effect: () => {
|
|
39
|
-
e.callback = e.next;
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
return e;
|
|
43
|
-
}
|
|
44
|
-
function A() {
|
|
45
|
-
if (process.env.NODE_ENV !== "production") throw Error("Base UI: Cannot call an event handler while rendering.");
|
|
46
|
-
}
|
|
47
|
-
//#endregion
|
|
48
|
-
//#region ../../node_modules/@base-ui-components/utils/esm/error.js
|
|
49
|
-
var j;
|
|
50
|
-
process.env.NODE_ENV !== "production" && (j = /* @__PURE__ */ new Set());
|
|
51
|
-
function M(...e) {
|
|
52
|
-
if (process.env.NODE_ENV !== "production") {
|
|
53
|
-
let t = e.join(" ");
|
|
54
|
-
j.has(t) || (j.add(t), console.error(`Base UI: ${t}`));
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
var te = typeof document < "u" ? e.useLayoutEffect : () => {};
|
|
58
|
-
//#endregion
|
|
59
|
-
//#region ../../node_modules/@base-ui-components/utils/esm/mergeObjects.js
|
|
60
|
-
function N(e, t) {
|
|
61
|
-
if (e && !t) return e;
|
|
62
|
-
if (!e && t) return t;
|
|
63
|
-
if (e || t) return {
|
|
64
|
-
...e,
|
|
65
|
-
...t
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
//#endregion
|
|
69
|
-
//#region ../../node_modules/@base-ui-components/react/esm/merge-props/mergeProps.js
|
|
70
|
-
var P = {};
|
|
71
|
-
function ne(e, t, n, r, i) {
|
|
72
|
-
let a = { ...I(e, P) };
|
|
73
|
-
return t && (a = F(a, t)), n && (a = F(a, n)), r && (a = F(a, r)), i && (a = F(a, i)), a;
|
|
74
|
-
}
|
|
75
|
-
function re(e) {
|
|
76
|
-
if (e.length === 0) return P;
|
|
77
|
-
if (e.length === 1) return I(e[0], P);
|
|
78
|
-
let t = { ...I(e[0], P) };
|
|
79
|
-
for (let n = 1; n < e.length; n += 1) t = F(t, e[n]);
|
|
80
|
-
return t;
|
|
81
|
-
}
|
|
82
|
-
function F(e, t) {
|
|
83
|
-
return oe(t) ? t(e) : ie(e, t);
|
|
84
|
-
}
|
|
85
|
-
function ie(e, t) {
|
|
86
|
-
if (!t) return e;
|
|
87
|
-
for (let n in t) {
|
|
88
|
-
let r = t[n];
|
|
89
|
-
switch (n) {
|
|
90
|
-
case "style":
|
|
91
|
-
e[n] = N(e.style, r);
|
|
92
|
-
break;
|
|
93
|
-
case "className":
|
|
94
|
-
e[n] = R(e.className, r);
|
|
95
|
-
break;
|
|
96
|
-
default: ae(n, r) ? e[n] = se(e[n], r) : e[n] = r;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
return e;
|
|
100
|
-
}
|
|
101
|
-
function ae(e, t) {
|
|
102
|
-
let n = e.charCodeAt(0), r = e.charCodeAt(1), i = e.charCodeAt(2);
|
|
103
|
-
return n === 111 && r === 110 && i >= 65 && i <= 90 && (typeof t == "function" || t === void 0);
|
|
104
|
-
}
|
|
105
|
-
function oe(e) {
|
|
106
|
-
return typeof e == "function";
|
|
107
|
-
}
|
|
108
|
-
function I(e, t) {
|
|
109
|
-
return oe(e) ? e(t) : e ?? P;
|
|
110
|
-
}
|
|
111
|
-
function se(e, t) {
|
|
112
|
-
return t ? e ? (n) => {
|
|
113
|
-
if (ce(n)) {
|
|
114
|
-
let r = n;
|
|
115
|
-
L(r);
|
|
116
|
-
let i = t(r);
|
|
117
|
-
return r.baseUIHandlerPrevented || e?.(r), i;
|
|
118
|
-
}
|
|
119
|
-
let r = t(n);
|
|
120
|
-
return e?.(n), r;
|
|
121
|
-
} : t : e;
|
|
122
|
-
}
|
|
123
|
-
function L(e) {
|
|
124
|
-
return e.preventBaseUIHandler = () => {
|
|
125
|
-
e.baseUIHandlerPrevented = !0;
|
|
126
|
-
}, e;
|
|
127
|
-
}
|
|
128
|
-
function R(e, t) {
|
|
129
|
-
return t ? e ? t + " " + e : t : e;
|
|
130
|
-
}
|
|
131
|
-
function ce(e) {
|
|
132
|
-
return typeof e == "object" && !!e && "nativeEvent" in e;
|
|
133
|
-
}
|
|
134
|
-
//#endregion
|
|
135
|
-
//#region ../../node_modules/@base-ui-components/utils/esm/formatErrorMessage.js
|
|
136
|
-
function z(e, ...t) {
|
|
137
|
-
let n = new URL(`https://base-ui.com/production-error/${e}`);
|
|
138
|
-
return t.forEach((e) => n.searchParams.append("args[]", e)), `Base UI error #${e}; visit ${n} for the full message.`;
|
|
139
|
-
}
|
|
140
|
-
//#endregion
|
|
141
|
-
//#region ../../node_modules/@base-ui-components/react/esm/composite/root/CompositeRootContext.js
|
|
142
|
-
var B = /* @__PURE__ */ e.createContext(void 0);
|
|
143
|
-
process.env.NODE_ENV !== "production" && (B.displayName = "CompositeRootContext");
|
|
144
|
-
function le(t = !1) {
|
|
145
|
-
let n = e.useContext(B);
|
|
146
|
-
if (n === void 0 && !t) throw Error(process.env.NODE_ENV === "production" ? z(16) : "Base UI: CompositeRootContext is missing. Composite parts must be placed within <Composite.Root>.");
|
|
147
|
-
return n;
|
|
148
|
-
}
|
|
149
|
-
//#endregion
|
|
150
|
-
//#region ../../node_modules/@base-ui-components/react/esm/utils/useFocusableWhenDisabled.js
|
|
151
|
-
function ue(t) {
|
|
152
|
-
let { focusableWhenDisabled: n, disabled: r, composite: i = !1, tabIndex: a = 0, isNativeButton: o } = t, s = i && n !== !1, c = i && n === !1;
|
|
153
|
-
return { props: e.useMemo(() => {
|
|
154
|
-
let e = { onKeyDown(e) {
|
|
155
|
-
r && n && e.key !== "Tab" && e.preventDefault();
|
|
156
|
-
} };
|
|
157
|
-
return i || (e.tabIndex = a, !o && r && (e.tabIndex = n ? a : -1)), (o && (n || s) || !o && r) && (e["aria-disabled"] = r), o && (!n || c) && (e.disabled = r), e;
|
|
158
|
-
}, [
|
|
159
|
-
i,
|
|
160
|
-
r,
|
|
161
|
-
n,
|
|
162
|
-
s,
|
|
163
|
-
c,
|
|
164
|
-
o,
|
|
165
|
-
a
|
|
166
|
-
]) };
|
|
167
|
-
}
|
|
168
|
-
//#endregion
|
|
169
|
-
//#region ../../node_modules/@base-ui-components/react/esm/use-button/useButton.js
|
|
170
|
-
function de(t = {}) {
|
|
171
|
-
let { disabled: n = !1, focusableWhenDisabled: r, tabIndex: i = 0, native: a = !0 } = t, o = e.useRef(null), s = le(!0) !== void 0, c = O(() => {
|
|
172
|
-
let e = o.current;
|
|
173
|
-
return !!(e?.tagName === "A" && e?.href);
|
|
174
|
-
}), { props: l } = ue({
|
|
175
|
-
focusableWhenDisabled: r,
|
|
176
|
-
disabled: n,
|
|
177
|
-
composite: s,
|
|
178
|
-
tabIndex: i,
|
|
179
|
-
isNativeButton: a
|
|
180
|
-
});
|
|
181
|
-
process.env.NODE_ENV !== "production" && e.useEffect(() => {
|
|
182
|
-
if (!o.current) return;
|
|
183
|
-
let e = o.current.tagName === "BUTTON";
|
|
184
|
-
a ? e || M("A component that acts as a button was not rendered as a native <button>, which does not match the default. Ensure that the element passed to the `render` prop of the component is a real <button>, or set the `nativeButton` prop on the component to `false`.") : e && M("A component that acts as a button was rendered as a native <button>, which does not match the default. Ensure that the element passed to the `render` prop of the component is not a real <button>, or set the `nativeButton` prop on the component to `true`.");
|
|
185
|
-
}, [a]);
|
|
186
|
-
let u = e.useCallback(() => {
|
|
187
|
-
let e = o.current;
|
|
188
|
-
fe(e) && s && n && l.disabled === void 0 && e.disabled && (e.disabled = !1);
|
|
189
|
-
}, [
|
|
190
|
-
n,
|
|
191
|
-
l.disabled,
|
|
192
|
-
s
|
|
193
|
-
]);
|
|
194
|
-
return te(u, [u]), {
|
|
195
|
-
getButtonProps: e.useCallback((e = {}) => {
|
|
196
|
-
let { onClick: t, onMouseDown: r, onKeyUp: i, onKeyDown: o, onPointerDown: s, ...u } = e;
|
|
197
|
-
return ne({
|
|
198
|
-
type: a ? "button" : void 0,
|
|
199
|
-
onClick(e) {
|
|
200
|
-
if (n) {
|
|
201
|
-
e.preventDefault();
|
|
202
|
-
return;
|
|
203
|
-
}
|
|
204
|
-
t?.(e);
|
|
205
|
-
},
|
|
206
|
-
onMouseDown(e) {
|
|
207
|
-
n || r?.(e);
|
|
208
|
-
},
|
|
209
|
-
onKeyDown(e) {
|
|
210
|
-
if (n || (L(e), o?.(e)), e.baseUIHandlerPrevented) return;
|
|
211
|
-
let r = e.target === e.currentTarget && !a && !c() && !n, i = e.key === "Enter", s = e.key === " ";
|
|
212
|
-
r && ((s || i) && e.preventDefault(), i && t?.(e));
|
|
213
|
-
},
|
|
214
|
-
onKeyUp(e) {
|
|
215
|
-
n || (L(e), i?.(e)), !e.baseUIHandlerPrevented && e.target === e.currentTarget && !a && !n && e.key === " " && t?.(e);
|
|
216
|
-
},
|
|
217
|
-
onPointerDown(e) {
|
|
218
|
-
if (n) {
|
|
219
|
-
e.preventDefault();
|
|
220
|
-
return;
|
|
221
|
-
}
|
|
222
|
-
s?.(e);
|
|
223
|
-
}
|
|
224
|
-
}, a ? void 0 : { role: "button" }, l, u);
|
|
225
|
-
}, [
|
|
226
|
-
n,
|
|
227
|
-
l,
|
|
228
|
-
a,
|
|
229
|
-
c
|
|
230
|
-
]),
|
|
231
|
-
buttonRef: O((e) => {
|
|
232
|
-
o.current = e, u();
|
|
233
|
-
})
|
|
234
|
-
};
|
|
235
|
-
}
|
|
236
|
-
function fe(e) {
|
|
237
|
-
return C(e) && e.tagName === "BUTTON";
|
|
238
|
-
}
|
|
239
|
-
//#endregion
|
|
240
|
-
//#region ../../node_modules/@base-ui-components/utils/esm/useMergedRefs.js
|
|
241
|
-
function V(e, t, n, r) {
|
|
242
|
-
let i = T(H).current;
|
|
243
|
-
return me(i, e, t, n, r) && U(i, [
|
|
244
|
-
e,
|
|
245
|
-
t,
|
|
246
|
-
n,
|
|
247
|
-
r
|
|
248
|
-
]), i.callback;
|
|
249
|
-
}
|
|
250
|
-
function pe(e) {
|
|
251
|
-
let t = T(H).current;
|
|
252
|
-
return he(t, e) && U(t, e), t.callback;
|
|
253
|
-
}
|
|
254
|
-
function H() {
|
|
255
|
-
return {
|
|
256
|
-
callback: null,
|
|
257
|
-
cleanup: null,
|
|
258
|
-
refs: []
|
|
259
|
-
};
|
|
260
|
-
}
|
|
261
|
-
function me(e, t, n, r, i) {
|
|
262
|
-
return e.refs[0] !== t || e.refs[1] !== n || e.refs[2] !== r || e.refs[3] !== i;
|
|
263
|
-
}
|
|
264
|
-
function he(e, t) {
|
|
265
|
-
return e.refs.length !== t.length || e.refs.some((e, n) => e !== t[n]);
|
|
266
|
-
}
|
|
267
|
-
function U(e, t) {
|
|
268
|
-
if (e.refs = t, t.every((e) => e == null)) {
|
|
269
|
-
e.callback = null;
|
|
270
|
-
return;
|
|
271
|
-
}
|
|
272
|
-
e.callback = (n) => {
|
|
273
|
-
if (e.cleanup &&= (e.cleanup(), null), n != null) {
|
|
274
|
-
let r = Array(t.length).fill(null);
|
|
275
|
-
for (let e = 0; e < t.length; e += 1) {
|
|
276
|
-
let i = t[e];
|
|
277
|
-
if (i != null) switch (typeof i) {
|
|
278
|
-
case "function": {
|
|
279
|
-
let t = i(n);
|
|
280
|
-
typeof t == "function" && (r[e] = t);
|
|
281
|
-
break;
|
|
282
|
-
}
|
|
283
|
-
case "object":
|
|
284
|
-
i.current = n;
|
|
285
|
-
break;
|
|
286
|
-
default:
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
e.cleanup = () => {
|
|
290
|
-
for (let e = 0; e < t.length; e += 1) {
|
|
291
|
-
let n = t[e];
|
|
292
|
-
if (n != null) switch (typeof n) {
|
|
293
|
-
case "function": {
|
|
294
|
-
let t = r[e];
|
|
295
|
-
typeof t == "function" ? t() : n(null);
|
|
296
|
-
break;
|
|
297
|
-
}
|
|
298
|
-
case "object":
|
|
299
|
-
n.current = null;
|
|
300
|
-
break;
|
|
301
|
-
default:
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
};
|
|
305
|
-
}
|
|
306
|
-
};
|
|
307
|
-
}
|
|
308
|
-
//#endregion
|
|
309
|
-
//#region ../../node_modules/@base-ui-components/utils/esm/reactVersion.js
|
|
310
|
-
var ge = parseInt(e.version, 10);
|
|
311
|
-
function _e(e) {
|
|
312
|
-
return ge >= e;
|
|
313
|
-
}
|
|
314
|
-
//#endregion
|
|
315
|
-
//#region ../../node_modules/@base-ui-components/utils/esm/getReactElementRef.js
|
|
316
|
-
function W(t) {
|
|
317
|
-
if (!/* @__PURE__ */ e.isValidElement(t)) return null;
|
|
318
|
-
let n = t, r = n.props;
|
|
319
|
-
return (_e(19) ? r?.ref : n.ref) ?? null;
|
|
320
|
-
}
|
|
321
|
-
//#endregion
|
|
322
|
-
//#region ../../node_modules/@base-ui-components/react/esm/utils/getStateAttributesProps.js
|
|
323
|
-
function ve(e, t) {
|
|
324
|
-
let n = {};
|
|
325
|
-
for (let r in e) {
|
|
326
|
-
let i = e[r];
|
|
327
|
-
if (t?.hasOwnProperty(r)) {
|
|
328
|
-
let e = t[r](i);
|
|
329
|
-
e != null && Object.assign(n, e);
|
|
330
|
-
continue;
|
|
331
|
-
}
|
|
332
|
-
i === !0 ? n[`data-${r.toLowerCase()}`] = "" : i && (n[`data-${r.toLowerCase()}`] = i.toString());
|
|
333
|
-
}
|
|
334
|
-
return n;
|
|
335
|
-
}
|
|
336
|
-
//#endregion
|
|
337
|
-
//#region ../../node_modules/@base-ui-components/react/esm/utils/resolveClassName.js
|
|
338
|
-
function ye(e, t) {
|
|
339
|
-
return typeof e == "function" ? e(t) : e;
|
|
340
|
-
}
|
|
341
|
-
//#endregion
|
|
342
|
-
//#region ../../node_modules/@base-ui-components/react/esm/utils/resolveStyle.js
|
|
343
|
-
function be(e, t) {
|
|
344
|
-
return typeof e == "function" ? e(t) : e;
|
|
345
|
-
}
|
|
346
|
-
Object.freeze([]);
|
|
347
|
-
var G = Object.freeze({});
|
|
348
|
-
//#endregion
|
|
349
|
-
//#region ../../node_modules/@base-ui-components/react/esm/utils/useRenderElement.js
|
|
350
|
-
function xe(e, t, n = {}) {
|
|
351
|
-
let r = t.render, i = Se(t, n);
|
|
352
|
-
return n.enabled === !1 ? null : Ce(e, r, i, n.state ?? G);
|
|
353
|
-
}
|
|
354
|
-
function Se(e, t = {}) {
|
|
355
|
-
let { className: n, style: r, render: i } = e, { state: a = G, ref: o, props: s, stateAttributesMapping: c, enabled: l = !0 } = t, u = l ? ye(n, a) : void 0, d = l ? be(r, a) : void 0, f = l ? ve(a, c) : G, p = l ? N(f, Array.isArray(s) ? re(s) : s) ?? G : G;
|
|
356
|
-
return typeof document < "u" && (l ? Array.isArray(o) ? p.ref = pe([
|
|
357
|
-
p.ref,
|
|
358
|
-
W(i),
|
|
359
|
-
...o
|
|
360
|
-
]) : p.ref = V(p.ref, W(i), o) : V(null, null)), l ? (u !== void 0 && (p.className = R(p.className, u)), d !== void 0 && (p.style = N(p.style, d)), p) : G;
|
|
361
|
-
}
|
|
362
|
-
function Ce(t, n, r, i) {
|
|
363
|
-
if (n) {
|
|
364
|
-
if (typeof n == "function") return n(r, i);
|
|
365
|
-
let t = ne(r, n.props);
|
|
366
|
-
return t.ref = r.ref, /* @__PURE__ */ e.cloneElement(n, t);
|
|
367
|
-
}
|
|
368
|
-
if (t && typeof t == "string") return we(t, r);
|
|
369
|
-
throw Error(process.env.NODE_ENV === "production" ? z(8) : "Base UI: Render element or function are not defined.");
|
|
370
|
-
}
|
|
371
|
-
function we(n, r) {
|
|
372
|
-
return n === "button" ? /* @__PURE__ */ t("button", {
|
|
373
|
-
type: "button",
|
|
374
|
-
...r,
|
|
375
|
-
key: r.key
|
|
376
|
-
}) : n === "img" ? /* @__PURE__ */ t("img", {
|
|
377
|
-
alt: "",
|
|
378
|
-
...r,
|
|
379
|
-
key: r.key
|
|
380
|
-
}) : /* @__PURE__ */ e.createElement(n, r);
|
|
381
|
-
}
|
|
382
|
-
//#endregion
|
|
383
|
-
//#region ../../node_modules/@base-ui-components/react/esm/button/Button.js
|
|
384
|
-
var K = /* @__PURE__ */ e.forwardRef(function(t, n) {
|
|
385
|
-
let { render: r, className: i, disabled: a = !1, focusableWhenDisabled: o = !1, nativeButton: s = !0, ...c } = t, l = !!a, { getButtonProps: u, buttonRef: d } = de({
|
|
386
|
-
disabled: l,
|
|
387
|
-
focusableWhenDisabled: o,
|
|
388
|
-
native: s
|
|
389
|
-
});
|
|
390
|
-
return xe("button", t, {
|
|
391
|
-
state: e.useMemo(() => ({ disabled: l }), [l]),
|
|
392
|
-
ref: [n, d],
|
|
393
|
-
props: [c, u]
|
|
394
|
-
});
|
|
395
|
-
});
|
|
396
|
-
process.env.NODE_ENV !== "production" && (K.displayName = "Button");
|
|
397
|
-
//#endregion
|
|
398
|
-
//#region ../../node_modules/clsx/dist/clsx.mjs
|
|
399
|
-
function Te(e) {
|
|
400
|
-
var t, n, r = "";
|
|
401
|
-
if (typeof e == "string" || typeof e == "number") r += e;
|
|
402
|
-
else if (typeof e == "object") if (Array.isArray(e)) {
|
|
403
|
-
var i = e.length;
|
|
404
|
-
for (t = 0; t < i; t++) e[t] && (n = Te(e[t])) && (r && (r += " "), r += n);
|
|
405
|
-
} else for (n in e) e[n] && (r && (r += " "), r += n);
|
|
406
|
-
return r;
|
|
407
|
-
}
|
|
408
|
-
function Ee() {
|
|
409
|
-
for (var e, t, n = 0, r = "", i = arguments.length; n < i; n++) (e = arguments[n]) && (t = Te(e)) && (r && (r += " "), r += t);
|
|
410
|
-
return r;
|
|
411
|
-
}
|
|
412
|
-
//#endregion
|
|
413
|
-
//#region ../../node_modules/class-variance-authority/dist/index.mjs
|
|
414
|
-
var De = (e) => typeof e == "boolean" ? `${e}` : e === 0 ? "0" : e, Oe = Ee, ke = (e, t) => (n) => {
|
|
415
|
-
if (t?.variants == null) return Oe(e, n?.class, n?.className);
|
|
416
|
-
let { variants: r, defaultVariants: i } = t, a = Object.keys(r).map((e) => {
|
|
417
|
-
let t = n?.[e], a = i?.[e];
|
|
418
|
-
if (t === null) return null;
|
|
419
|
-
let o = De(t) || De(a);
|
|
420
|
-
return r[e][o];
|
|
421
|
-
}), o = n && Object.entries(n).reduce((e, t) => {
|
|
422
|
-
let [n, r] = t;
|
|
423
|
-
return r === void 0 || (e[n] = r), e;
|
|
424
|
-
}, {});
|
|
425
|
-
return Oe(e, a, t?.compoundVariants?.reduce((e, t) => {
|
|
426
|
-
let { class: n, className: r, ...a } = t;
|
|
427
|
-
return Object.entries(a).every((e) => {
|
|
428
|
-
let [t, n] = e;
|
|
429
|
-
return Array.isArray(n) ? n.includes({
|
|
430
|
-
...i,
|
|
431
|
-
...o
|
|
432
|
-
}[t]) : {
|
|
433
|
-
...i,
|
|
434
|
-
...o
|
|
435
|
-
}[t] === n;
|
|
436
|
-
}) ? [
|
|
437
|
-
...e,
|
|
438
|
-
n,
|
|
439
|
-
r
|
|
440
|
-
] : e;
|
|
441
|
-
}, []), n?.class, n?.className);
|
|
442
|
-
}, Ae = (...e) => Ee(e), q = {
|
|
443
|
-
Primary: "primary",
|
|
444
|
-
Secondary: "secondary",
|
|
445
|
-
Ghost: "ghost",
|
|
446
|
-
Inline: "inline",
|
|
447
|
-
Link: "link",
|
|
448
|
-
Plain: "plain"
|
|
449
|
-
}, je = {
|
|
450
|
-
Action: "action",
|
|
451
|
-
Danger: "danger",
|
|
452
|
-
Success: "success",
|
|
453
|
-
Light: "light"
|
|
454
|
-
}, Me = ke("button", {
|
|
455
|
-
variants: {
|
|
456
|
-
variant: {
|
|
457
|
-
primary: "button--primary",
|
|
458
|
-
secondary: "button--secondary",
|
|
459
|
-
ghost: "button--ghost",
|
|
460
|
-
inline: "button--inline",
|
|
461
|
-
link: "button--link",
|
|
462
|
-
plain: "button--plain"
|
|
463
|
-
},
|
|
464
|
-
tone: {
|
|
465
|
-
action: "button--tone-action",
|
|
466
|
-
danger: "button--tone-danger",
|
|
467
|
-
success: "button--tone-success",
|
|
468
|
-
light: "button--tone-light"
|
|
469
|
-
},
|
|
470
|
-
iconOnly: {
|
|
471
|
-
true: "button--icon",
|
|
472
|
-
false: ""
|
|
473
|
-
},
|
|
474
|
-
quiet: {
|
|
475
|
-
true: "button--quiet",
|
|
476
|
-
false: ""
|
|
477
|
-
},
|
|
478
|
-
fullWidth: {
|
|
479
|
-
true: "button--full-width",
|
|
480
|
-
false: ""
|
|
481
|
-
},
|
|
482
|
-
loading: {
|
|
483
|
-
true: "button--loading",
|
|
484
|
-
false: ""
|
|
485
|
-
},
|
|
486
|
-
startIcon: {
|
|
487
|
-
true: "button--start-icon",
|
|
488
|
-
false: ""
|
|
489
|
-
},
|
|
490
|
-
endIcon: {
|
|
491
|
-
true: "button--end-icon",
|
|
492
|
-
false: ""
|
|
493
|
-
}
|
|
494
|
-
},
|
|
495
|
-
defaultVariants: {
|
|
496
|
-
variant: "primary",
|
|
497
|
-
tone: "action",
|
|
498
|
-
iconOnly: !1,
|
|
499
|
-
quiet: !1,
|
|
500
|
-
fullWidth: !1,
|
|
501
|
-
loading: !1,
|
|
502
|
-
startIcon: !1,
|
|
503
|
-
endIcon: !1
|
|
504
|
-
}
|
|
505
|
-
}), J = n(({ variant: e = q.Primary, tone: t = je.Action, isFullWidth: n = !1, isLoading: r = !1, isAsync: l = !1, isDisabled: u = !1, isQuiet: d = !1, type: f = "button", className: p, onClick: m, icon: h, startIcon: g, endIcon: _, gtmAction: v, gtmLabel: y, children: b, ...ee }, x) => {
|
|
506
|
-
let [S, C] = o(!1), w = a(!0);
|
|
507
|
-
i(() => () => {
|
|
508
|
-
w.current = !1;
|
|
509
|
-
}, []);
|
|
510
|
-
let T = r || S, E = async (e) => {
|
|
511
|
-
if (T) {
|
|
512
|
-
e.preventDefault();
|
|
513
|
-
return;
|
|
514
|
-
}
|
|
515
|
-
if (m !== void 0) {
|
|
516
|
-
if (!l) {
|
|
517
|
-
m(e);
|
|
518
|
-
return;
|
|
519
|
-
}
|
|
520
|
-
try {
|
|
521
|
-
C(!0), await m(e);
|
|
522
|
-
} finally {
|
|
523
|
-
w.current && C(!1);
|
|
524
|
-
}
|
|
525
|
-
}
|
|
526
|
-
}, D = /* @__PURE__ */ s("span", {
|
|
527
|
-
className: "button__spinner",
|
|
528
|
-
"aria-hidden": "true"
|
|
529
|
-
}), O = h !== void 0, k = g === void 0 && _ !== void 0, A = T && !O && !k ? D : g, j = T && k ? D : _, M = O ? T ? D : h : b;
|
|
530
|
-
return /* @__PURE__ */ c(K, {
|
|
531
|
-
...ee,
|
|
532
|
-
ref: x,
|
|
533
|
-
type: f,
|
|
534
|
-
disabled: u,
|
|
535
|
-
className: Ae("Button", Me({
|
|
536
|
-
variant: e,
|
|
537
|
-
tone: t,
|
|
538
|
-
iconOnly: O,
|
|
539
|
-
quiet: d,
|
|
540
|
-
fullWidth: n,
|
|
541
|
-
loading: T,
|
|
542
|
-
startIcon: A !== void 0,
|
|
543
|
-
endIcon: j !== void 0
|
|
544
|
-
}), p),
|
|
545
|
-
onClick: E,
|
|
546
|
-
"aria-disabled": T || void 0,
|
|
547
|
-
"aria-busy": T || void 0,
|
|
548
|
-
"data-loading": T || void 0,
|
|
549
|
-
"gtm-action": v,
|
|
550
|
-
"gtm-label": y,
|
|
551
|
-
children: [
|
|
552
|
-
A !== void 0 && /* @__PURE__ */ s("span", {
|
|
553
|
-
className: "button__icon",
|
|
554
|
-
"aria-hidden": "true",
|
|
555
|
-
children: A
|
|
556
|
-
}),
|
|
557
|
-
M,
|
|
558
|
-
j !== void 0 && /* @__PURE__ */ s("span", {
|
|
559
|
-
className: "button__icon",
|
|
560
|
-
"aria-hidden": "true",
|
|
561
|
-
children: j
|
|
562
|
-
})
|
|
563
|
-
]
|
|
564
|
-
});
|
|
565
|
-
});
|
|
566
|
-
J.displayName = "Button";
|
|
567
|
-
//#endregion
|
|
568
|
-
//#region ../Icon/dist/index.js
|
|
569
|
-
var Y = {
|
|
570
|
-
ExtraSmall: "extra-small",
|
|
571
|
-
Small: "small",
|
|
572
|
-
MediumSmall: "medium-small",
|
|
573
|
-
Medium: "medium",
|
|
574
|
-
Large: "large",
|
|
575
|
-
ExtraLarge: "extra-large"
|
|
576
|
-
}, X = {
|
|
577
|
-
Black: "black",
|
|
578
|
-
White: "white",
|
|
579
|
-
Blue: "blue",
|
|
580
|
-
Gray: "gray",
|
|
581
|
-
GrayDark: "gray-dark",
|
|
582
|
-
Success: "success",
|
|
583
|
-
Warning: "warning",
|
|
584
|
-
Error: "error"
|
|
585
|
-
}, Z = {
|
|
586
|
-
[Y.ExtraSmall]: m * 3,
|
|
587
|
-
[Y.Small]: m * 4,
|
|
588
|
-
[Y.MediumSmall]: m * 5,
|
|
589
|
-
[Y.Medium]: m * 6,
|
|
590
|
-
[Y.Large]: m * 8,
|
|
591
|
-
[Y.ExtraLarge]: m * 16
|
|
592
|
-
}, Ne = v.svg`
|
|
593
|
-
display: inline-flex;
|
|
594
|
-
width: ${(e) => Z[e.$size]}px;
|
|
595
|
-
height: ${(e) => Z[e.$size]}px;
|
|
596
|
-
fill: ${(e) => e.$color};
|
|
1
|
+
import e, { ButtonVariant as t } from "@propellerads/button";
|
|
2
|
+
import { ArrowLeft as n, ArrowPageFirst as r, ArrowPageLast as i, ArrowRight as a } from "@propellerads/icon";
|
|
3
|
+
import { LabelPosition as o } from "@propellerads/label";
|
|
4
|
+
import s from "@propellerads/select";
|
|
5
|
+
import { spacing as c } from "@propellerads/stylevariables";
|
|
6
|
+
import l from "styled-components";
|
|
7
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
8
|
+
//#region src/style.tsx
|
|
9
|
+
var f = l.div`
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-wrap: wrap;
|
|
12
|
+
align-items: flex-end;
|
|
13
|
+
gap: ${c * 4}px ${c * 8}px;
|
|
14
|
+
`, p = l.div`
|
|
15
|
+
flex: none;
|
|
597
16
|
|
|
598
|
-
|
|
599
|
-
|
|
17
|
+
/* The select is as wide as its sizes, not as the label on top of it. */
|
|
18
|
+
.select {
|
|
19
|
+
width: fit-content;
|
|
600
20
|
}
|
|
601
|
-
`,
|
|
602
|
-
|
|
603
|
-
[X.Blue]: (e) => e?.actionColor?.main ?? l,
|
|
604
|
-
[X.Gray]: () => p,
|
|
605
|
-
[X.GrayDark]: () => f,
|
|
606
|
-
[X.Success]: (e) => e?.successColor?.main ?? h,
|
|
607
|
-
[X.Error]: (e) => e?.errorColor?.main ?? d,
|
|
608
|
-
[X.Warning]: (e) => e?.warningColor?.main ?? g,
|
|
609
|
-
[X.Black]: () => u
|
|
610
|
-
}, Fe = (e) => e in Pe, Ie = (e, t) => Fe(t) ? Pe[t](e) : t, Q = ({ children: e, size: t = Y.Medium, color: n = X.Black, hoverColor: i, ...a }) => {
|
|
611
|
-
let o = r(y);
|
|
612
|
-
return /* @__PURE__ */ s(Ne, {
|
|
613
|
-
$size: t,
|
|
614
|
-
$color: Ie(o, n),
|
|
615
|
-
$hoverColor: Ie(o, i || n),
|
|
616
|
-
viewBox: "0 0 24 24",
|
|
617
|
-
...a,
|
|
618
|
-
children: e
|
|
619
|
-
});
|
|
620
|
-
}, Le = (e) => /* @__PURE__ */ s(Q, {
|
|
621
|
-
...e,
|
|
622
|
-
children: /* @__PURE__ */ s("path", { d: "M14.71 15.88L10.83 12l3.88-3.88c.39-.39.39-1.02 0-1.41-.39-.39-1.02-.39-1.41 0L8.71 11.3c-.39.39-.39 1.02 0 1.41l4.59 4.59c.39.39 1.02.39 1.41 0 .38-.39.39-1.03 0-1.42z" })
|
|
623
|
-
}), Re = (e) => /* @__PURE__ */ c(Q, {
|
|
624
|
-
...e,
|
|
625
|
-
children: [/* @__PURE__ */ s("path", {
|
|
626
|
-
opacity: ".87",
|
|
627
|
-
fill: "none",
|
|
628
|
-
d: "M0 0h24v24H0V0z"
|
|
629
|
-
}), /* @__PURE__ */ s("path", { d: "M17.7075 15.89L13.8175 12L17.7075 8.11C18.0975 7.72 18.0975 7.09 17.7075 6.7C17.3175 6.31 16.6875 6.31 16.2975 6.7L11.7075 11.29C11.3175 11.68 11.3175 12.31 11.7075 12.7L16.2975 17.3C16.6875 17.69 17.3175 17.69 17.7075 17.3C18.0875 16.91 18.0875 16.27 17.7075 15.89ZM6.9975 18C6.4475 18 5.9975 17.55 5.9975 17L5.9975 7C5.9975 6.45 6.4475 6 6.9975 6C7.5475 6 7.9975 6.45 7.9975 7L7.9975 17C7.9975 17.55 7.5475 18 6.9975 18Z" })]
|
|
630
|
-
}), ze = (e) => /* @__PURE__ */ c(Q, {
|
|
631
|
-
...e,
|
|
632
|
-
children: [/* @__PURE__ */ s("path", {
|
|
633
|
-
opacity: ".87",
|
|
634
|
-
fill: "none",
|
|
635
|
-
d: "M0 0h24v24H0V0z"
|
|
636
|
-
}), /* @__PURE__ */ s("path", { d: "M6.29 8.11L10.18 12l-3.89 3.89c-.39.39-.39 1.02 0 1.41.39.39 1.02.39 1.41 0l4.59-4.59c.39-.39.39-1.02 0-1.41L7.7 6.7c-.39-.39-1.02-.39-1.41 0-.38.39-.38 1.03 0 1.41zM17 6c.55 0 1 .45 1 1v10c0 .55-.45 1-1 1s-1-.45-1-1V7c0-.55.45-1 1-1z" })]
|
|
637
|
-
}), Be = (e) => /* @__PURE__ */ s(Q, {
|
|
638
|
-
...e,
|
|
639
|
-
children: /* @__PURE__ */ s("path", { d: "M9.29 15.88L13.17 12 9.29 8.12c-.39-.39-.39-1.02 0-1.41.39-.39 1.02-.39 1.41 0l4.59 4.59c.39.39.39 1.02 0 1.41L10.7 17.3c-.39.39-1.02.39-1.41 0-.38-.39-.39-1.03 0-1.42z" })
|
|
640
|
-
}), Ve = v.div`
|
|
641
|
-
display: flex;
|
|
642
|
-
align-items: center;
|
|
643
|
-
`, He = v.div`
|
|
644
|
-
display: flex;
|
|
645
|
-
align-items: center;
|
|
646
|
-
margin-right: ${m * 9}px;
|
|
21
|
+
`, m = l.span`
|
|
22
|
+
display: inline-grid;
|
|
647
23
|
|
|
648
|
-
|
|
649
|
-
|
|
24
|
+
> span,
|
|
25
|
+
&::after {
|
|
26
|
+
grid-area: 1 / 1;
|
|
650
27
|
}
|
|
651
28
|
|
|
652
|
-
|
|
653
|
-
|
|
29
|
+
&::after {
|
|
30
|
+
content: attr(data-longest);
|
|
31
|
+
visibility: hidden;
|
|
654
32
|
}
|
|
655
|
-
`,
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
33
|
+
`, h = l.div`
|
|
34
|
+
display: flex;
|
|
35
|
+
flex: none;
|
|
36
|
+
align-items: center;
|
|
37
|
+
/* 36px, the height of the select and the arrow buttons, so the counter stands on their line. */
|
|
38
|
+
min-height: 36px;
|
|
39
|
+
white-space: nowrap;
|
|
40
|
+
`, g = l.div`
|
|
660
41
|
display: flex;
|
|
661
|
-
|
|
42
|
+
flex: none;
|
|
43
|
+
`, _ = l.div`
|
|
662
44
|
&:not(:last-child) {
|
|
663
|
-
margin-right: ${
|
|
45
|
+
margin-right: ${c * 2}px;
|
|
664
46
|
}
|
|
665
|
-
`,
|
|
47
|
+
`, v = /\s*:\s*$/, y = (e, t, n) => {
|
|
666
48
|
let r = e * (t - 1);
|
|
667
49
|
return {
|
|
668
50
|
from: r + 1,
|
|
669
51
|
to: Math.min(r + e, n),
|
|
670
52
|
total: n
|
|
671
53
|
};
|
|
672
|
-
},
|
|
54
|
+
}, b = ({ from: e, to: t, total: n }) => `${e}-${t} of ${n}`, x = ({ pageIndex: c, perPage: l, pageSizes: x = [
|
|
673
55
|
10,
|
|
674
56
|
20,
|
|
675
57
|
50
|
|
676
|
-
], totalPages:
|
|
677
|
-
let
|
|
58
|
+
], totalPages: S, totalItems: C, setPageSize: w, canNextPage: T, gotoPage: E, canPreviousPage: D, previousPageHandler: O, nextPageHandler: k, parentElementId: A, paginationAmount: j = "", labelPerPage: M = "", labelPosition: N = o.Left }) => {
|
|
59
|
+
let P = `${A}-pagination-select-per-page`, F = M.replace(v, ""), I = F ? {
|
|
60
|
+
label: F,
|
|
61
|
+
labelPosition: N,
|
|
62
|
+
labelWidth: "max-content"
|
|
63
|
+
} : { "aria-label": "Rows per page" }, L = x.map(String).reduce((e, t) => t.length > e.length ? t : e, ""), R = x.map((e) => ({
|
|
678
64
|
id: e,
|
|
679
65
|
label: e,
|
|
680
66
|
value: e
|
|
681
|
-
})),
|
|
682
|
-
return /* @__PURE__ */
|
|
683
|
-
/* @__PURE__ */
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
}), /* @__PURE__ */ s(Ue, { children: /* @__PURE__ */ s(ee, {
|
|
687
|
-
id: g,
|
|
67
|
+
})), z = R.find(({ value: e }) => e === l), B = y(l, c + 1, C), V = j || b(B);
|
|
68
|
+
return /* @__PURE__ */ d(f, { children: [
|
|
69
|
+
/* @__PURE__ */ u(p, { children: /* @__PURE__ */ u(s, {
|
|
70
|
+
...I,
|
|
71
|
+
id: P,
|
|
688
72
|
onChange: (e) => {
|
|
689
|
-
e !== null &&
|
|
73
|
+
e !== null && w(Number(e.value));
|
|
690
74
|
},
|
|
691
|
-
options:
|
|
692
|
-
value:
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
75
|
+
options: R,
|
|
76
|
+
value: z,
|
|
77
|
+
formatOptionLabel: (e, { context: t }) => t === "value" ? /* @__PURE__ */ u(m, {
|
|
78
|
+
"data-longest": L,
|
|
79
|
+
children: /* @__PURE__ */ u("span", { children: e.label })
|
|
80
|
+
}) : e.label
|
|
81
|
+
}) }),
|
|
82
|
+
/* @__PURE__ */ u(h, { children: V }),
|
|
83
|
+
/* @__PURE__ */ d(g, { children: [
|
|
84
|
+
/* @__PURE__ */ u(_, { children: /* @__PURE__ */ u(e, {
|
|
85
|
+
variant: t.Ghost,
|
|
86
|
+
icon: /* @__PURE__ */ u(r, { color: "currentColor" }),
|
|
87
|
+
isQuiet: !0,
|
|
702
88
|
"aria-label": "First page",
|
|
703
|
-
isDisabled: !
|
|
704
|
-
id: `${
|
|
705
|
-
onClick: () =>
|
|
89
|
+
isDisabled: !D,
|
|
90
|
+
id: `${A}-pagination-first-page-button`,
|
|
91
|
+
onClick: () => E(0)
|
|
706
92
|
}) }),
|
|
707
|
-
/* @__PURE__ */
|
|
708
|
-
variant:
|
|
709
|
-
icon: /* @__PURE__ */
|
|
710
|
-
|
|
711
|
-
color: X.Gray
|
|
712
|
-
}),
|
|
93
|
+
/* @__PURE__ */ u(_, { children: /* @__PURE__ */ u(e, {
|
|
94
|
+
variant: t.Ghost,
|
|
95
|
+
icon: /* @__PURE__ */ u(n, { color: "currentColor" }),
|
|
96
|
+
isQuiet: !0,
|
|
713
97
|
"aria-label": "Previous page",
|
|
714
|
-
isDisabled: !
|
|
715
|
-
id: `${
|
|
716
|
-
onClick:
|
|
98
|
+
isDisabled: !D,
|
|
99
|
+
id: `${A}-pagination-previous-page-button`,
|
|
100
|
+
onClick: O
|
|
717
101
|
}) }),
|
|
718
|
-
/* @__PURE__ */
|
|
719
|
-
variant:
|
|
720
|
-
icon: /* @__PURE__ */
|
|
721
|
-
|
|
722
|
-
color: X.Gray
|
|
723
|
-
}),
|
|
102
|
+
/* @__PURE__ */ u(_, { children: /* @__PURE__ */ u(e, {
|
|
103
|
+
variant: t.Ghost,
|
|
104
|
+
icon: /* @__PURE__ */ u(a, { color: "currentColor" }),
|
|
105
|
+
isQuiet: !0,
|
|
724
106
|
"aria-label": "Next page",
|
|
725
|
-
isDisabled: !
|
|
726
|
-
id: `${
|
|
727
|
-
onClick:
|
|
107
|
+
isDisabled: !T,
|
|
108
|
+
id: `${A}-pagination-next-page-button`,
|
|
109
|
+
onClick: k
|
|
728
110
|
}) }),
|
|
729
|
-
/* @__PURE__ */
|
|
730
|
-
variant:
|
|
731
|
-
icon: /* @__PURE__ */
|
|
732
|
-
|
|
733
|
-
color: X.Gray
|
|
734
|
-
}),
|
|
111
|
+
/* @__PURE__ */ u(_, { children: /* @__PURE__ */ u(e, {
|
|
112
|
+
variant: t.Ghost,
|
|
113
|
+
icon: /* @__PURE__ */ u(i, { color: "currentColor" }),
|
|
114
|
+
isQuiet: !0,
|
|
735
115
|
"aria-label": "Last page",
|
|
736
|
-
isDisabled: !
|
|
737
|
-
id: `${
|
|
738
|
-
onClick: () =>
|
|
116
|
+
isDisabled: !T,
|
|
117
|
+
id: `${A}-pagination-last-page-button`,
|
|
118
|
+
onClick: () => E(S - 1)
|
|
739
119
|
}) })
|
|
740
120
|
] })
|
|
741
121
|
] });
|
|
742
122
|
};
|
|
743
123
|
//#endregion
|
|
744
|
-
export {
|
|
124
|
+
export { x as default };
|
|
745
125
|
|
|
746
126
|
//# sourceMappingURL=index.js.map
|