@propellerads/pagination 2.0.4 → 3.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.
- package/dist/index.d.ts +29 -4
- package/dist/index.js +729 -6
- package/dist/index.js.map +1 -0
- package/package.json +32 -26
- package/dist/allowJavaScriptModules.d.ts +0 -1
- package/dist/pagination.cjs.development.js +0 -111
- package/dist/pagination.cjs.development.js.map +0 -1
- package/dist/pagination.cjs.production.min.js +0 -2
- package/dist/pagination.cjs.production.min.js.map +0 -1
- package/dist/pagination.esm.js +0 -104
- package/dist/pagination.esm.js.map +0 -1
- package/dist/styles.d.ts +0 -7
- package/dist/types.d.ts +0 -26
- package/src/allowJavaScriptModules.ts +0 -1
- package/src/index.tsx +0 -111
- package/src/styles.ts +0 -48
- package/src/types.ts +0 -30
package/dist/index.js
CHANGED
|
@@ -1,8 +1,731 @@
|
|
|
1
|
+
import * as e from "react";
|
|
2
|
+
import { createElement as t, useContext as n, useEffect as r, useRef as i, useState as a } from "react";
|
|
3
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
4
|
+
import { actionColor as c, black as l, errorColor as u, gray50 as d, gray70 as f, spacing as p, successColor as m, warningColor as h, white as g } from "@propellerads/stylevariables";
|
|
5
|
+
import _, { ThemeContext as v } from "styled-components";
|
|
6
|
+
import y from "@propellerads/label";
|
|
7
|
+
import b from "@propellerads/select";
|
|
8
|
+
//#region ../../node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs
|
|
9
|
+
function x() {
|
|
10
|
+
return typeof window < "u";
|
|
11
|
+
}
|
|
12
|
+
function S(e) {
|
|
13
|
+
var t;
|
|
14
|
+
return (e == null || (t = e.ownerDocument) == null ? void 0 : t.defaultView) || window;
|
|
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 ee(...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 M(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 N = {};
|
|
71
|
+
function P(e, t, n, r, i) {
|
|
72
|
+
let a = { ...I(e, N) };
|
|
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 ne(e) {
|
|
76
|
+
if (e.length === 0) return N;
|
|
77
|
+
if (e.length === 1) return I(e[0], N);
|
|
78
|
+
let t = { ...I(e[0], N) };
|
|
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 ae(t) ? t(e) : re(e, t);
|
|
84
|
+
}
|
|
85
|
+
function re(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] = M(e.style, r);
|
|
92
|
+
break;
|
|
93
|
+
case "className":
|
|
94
|
+
e[n] = R(e.className, r);
|
|
95
|
+
break;
|
|
96
|
+
default: ie(n, r) ? e[n] = oe(e[n], r) : e[n] = r;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return e;
|
|
100
|
+
}
|
|
101
|
+
function ie(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 ae(e) {
|
|
106
|
+
return typeof e == "function";
|
|
107
|
+
}
|
|
108
|
+
function I(e, t) {
|
|
109
|
+
return ae(e) ? e(t) : e ?? N;
|
|
110
|
+
}
|
|
111
|
+
function oe(e, t) {
|
|
112
|
+
return t ? e ? (n) => {
|
|
113
|
+
if (se(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 se(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 ce(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 le(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 ue(t = {}) {
|
|
171
|
+
let { disabled: n = !1, focusableWhenDisabled: r, tabIndex: i = 0, native: a = !0 } = t, o = e.useRef(null), s = ce(!0) !== void 0, c = O(() => {
|
|
172
|
+
let e = o.current;
|
|
173
|
+
return !!(e?.tagName === "A" && e?.href);
|
|
174
|
+
}), { props: l } = le({
|
|
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 || ee("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 && ee("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
|
+
de(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 P({
|
|
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 de(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 pe(i, e, t, n, r) && U(i, [
|
|
244
|
+
e,
|
|
245
|
+
t,
|
|
246
|
+
n,
|
|
247
|
+
r
|
|
248
|
+
]), i.callback;
|
|
249
|
+
}
|
|
250
|
+
function fe(e) {
|
|
251
|
+
let t = T(H).current;
|
|
252
|
+
return me(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 pe(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 me(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 he = parseInt(e.version, 10);
|
|
311
|
+
function ge(e) {
|
|
312
|
+
return he >= 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 (ge(19) ? r?.ref : n.ref) ?? null;
|
|
320
|
+
}
|
|
321
|
+
//#endregion
|
|
322
|
+
//#region ../../node_modules/@base-ui-components/react/esm/utils/getStateAttributesProps.js
|
|
323
|
+
function _e(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 ve(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 ye(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 be(e, t, n = {}) {
|
|
351
|
+
let r = t.render, i = xe(t, n);
|
|
352
|
+
return n.enabled === !1 ? null : Se(e, r, i, n.state ?? G);
|
|
353
|
+
}
|
|
354
|
+
function xe(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 ? ve(n, a) : void 0, d = l ? ye(r, a) : void 0, f = l ? _e(a, c) : G, p = l ? M(f, Array.isArray(s) ? ne(s) : s) ?? G : G;
|
|
356
|
+
return typeof document < "u" && (l ? Array.isArray(o) ? p.ref = fe([
|
|
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 = M(p.style, d)), p) : G;
|
|
361
|
+
}
|
|
362
|
+
function Se(t, n, r, i) {
|
|
363
|
+
if (n) {
|
|
364
|
+
if (typeof n == "function") return n(r, i);
|
|
365
|
+
let t = P(r, n.props);
|
|
366
|
+
return t.ref = r.ref, /* @__PURE__ */ e.cloneElement(n, t);
|
|
367
|
+
}
|
|
368
|
+
if (t && typeof t == "string") return Ce(t, r);
|
|
369
|
+
throw Error(process.env.NODE_ENV === "production" ? z(8) : "Base UI: Render element or function are not defined.");
|
|
370
|
+
}
|
|
371
|
+
function Ce(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 } = ue({
|
|
386
|
+
disabled: l,
|
|
387
|
+
focusableWhenDisabled: o,
|
|
388
|
+
native: s
|
|
389
|
+
});
|
|
390
|
+
return be("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 q(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 = q(e[t])) && (r && (r += " "), r += n);
|
|
405
|
+
} else for (n in e) e[n] && (r && (r += " "), r += n);
|
|
406
|
+
return r;
|
|
407
|
+
}
|
|
408
|
+
function we() {
|
|
409
|
+
for (var e, t, n = 0, r = "", i = arguments.length; n < i; n++) (e = arguments[n]) && (t = q(e)) && (r && (r += " "), r += t);
|
|
410
|
+
return r;
|
|
411
|
+
}
|
|
412
|
+
//#endregion
|
|
413
|
+
//#region ../../node_modules/class-variance-authority/dist/index.mjs
|
|
414
|
+
var Te = (e) => typeof e == "boolean" ? `${e}` : e === 0 ? "0" : e, Ee = we, De = (e, t) => (n) => {
|
|
415
|
+
if (t?.variants == null) return Ee(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 = Te(t) || Te(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 Ee(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
|
+
}, Oe = (...e) => we(e), J = {
|
|
443
|
+
Primary: "primary",
|
|
444
|
+
Secondary: "secondary",
|
|
445
|
+
Ghost: "ghost",
|
|
446
|
+
Link: "link",
|
|
447
|
+
Plain: "plain"
|
|
448
|
+
}, ke = {
|
|
449
|
+
Action: "action",
|
|
450
|
+
Danger: "danger",
|
|
451
|
+
Success: "success"
|
|
452
|
+
}, Ae = De("pa-button", {
|
|
453
|
+
variants: {
|
|
454
|
+
variant: {
|
|
455
|
+
primary: "pa-button--primary",
|
|
456
|
+
secondary: "pa-button--secondary",
|
|
457
|
+
ghost: "pa-button--ghost",
|
|
458
|
+
link: "pa-button--link",
|
|
459
|
+
plain: "pa-button--plain"
|
|
460
|
+
},
|
|
461
|
+
tone: {
|
|
462
|
+
action: "pa-button--tone-action",
|
|
463
|
+
danger: "pa-button--tone-danger",
|
|
464
|
+
success: "pa-button--tone-success"
|
|
465
|
+
},
|
|
466
|
+
iconOnly: {
|
|
467
|
+
true: "pa-button--icon",
|
|
468
|
+
false: ""
|
|
469
|
+
},
|
|
470
|
+
fullWidth: {
|
|
471
|
+
true: "pa-button--full-width",
|
|
472
|
+
false: ""
|
|
473
|
+
},
|
|
474
|
+
loading: {
|
|
475
|
+
true: "pa-button--loading",
|
|
476
|
+
false: ""
|
|
477
|
+
},
|
|
478
|
+
startIcon: {
|
|
479
|
+
true: "pa-button--start-icon",
|
|
480
|
+
false: ""
|
|
481
|
+
},
|
|
482
|
+
endIcon: {
|
|
483
|
+
true: "pa-button--end-icon",
|
|
484
|
+
false: ""
|
|
485
|
+
}
|
|
486
|
+
},
|
|
487
|
+
defaultVariants: {
|
|
488
|
+
variant: "primary",
|
|
489
|
+
tone: "action",
|
|
490
|
+
iconOnly: !1,
|
|
491
|
+
fullWidth: !1,
|
|
492
|
+
loading: !1,
|
|
493
|
+
startIcon: !1,
|
|
494
|
+
endIcon: !1
|
|
495
|
+
}
|
|
496
|
+
}), Y = ({ variant: e = J.Primary, tone: t = ke.Action, isFullWidth: n = !1, isLoading: c = !1, isAsync: l = !1, isDisabled: u = !1, type: d = "button", className: f, onClick: p, icon: m, startIcon: h, endIcon: g, gtmAction: _, gtmLabel: v, children: y, ...b }) => {
|
|
497
|
+
let [x, S] = a(!1), C = i(!0);
|
|
498
|
+
r(() => () => {
|
|
499
|
+
C.current = !1;
|
|
500
|
+
}, []);
|
|
501
|
+
let w = c || x, T = async (e) => {
|
|
502
|
+
if (w) {
|
|
503
|
+
e.preventDefault();
|
|
504
|
+
return;
|
|
505
|
+
}
|
|
506
|
+
if (p !== void 0) {
|
|
507
|
+
if (!l) {
|
|
508
|
+
p(e);
|
|
509
|
+
return;
|
|
510
|
+
}
|
|
511
|
+
try {
|
|
512
|
+
S(!0), await p(e);
|
|
513
|
+
} finally {
|
|
514
|
+
C.current && S(!1);
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
}, E = /* @__PURE__ */ o("span", {
|
|
518
|
+
className: "pa-button__spinner",
|
|
519
|
+
"aria-hidden": "true"
|
|
520
|
+
}), D = m !== void 0, O = h === void 0 && g !== void 0, k = w && !D && !O ? E : h, A = w && O ? E : g, j = D ? w ? E : m : y;
|
|
521
|
+
return /* @__PURE__ */ s(K, {
|
|
522
|
+
...b,
|
|
523
|
+
type: d,
|
|
524
|
+
disabled: u,
|
|
525
|
+
className: Oe("Button", Ae({
|
|
526
|
+
variant: e,
|
|
527
|
+
tone: t,
|
|
528
|
+
iconOnly: D,
|
|
529
|
+
fullWidth: n,
|
|
530
|
+
loading: w,
|
|
531
|
+
startIcon: k !== void 0,
|
|
532
|
+
endIcon: A !== void 0
|
|
533
|
+
}), f),
|
|
534
|
+
onClick: T,
|
|
535
|
+
"aria-disabled": w || void 0,
|
|
536
|
+
"aria-busy": w || void 0,
|
|
537
|
+
"data-loading": w || void 0,
|
|
538
|
+
"gtm-action": _,
|
|
539
|
+
"gtm-label": v,
|
|
540
|
+
children: [
|
|
541
|
+
k !== void 0 && /* @__PURE__ */ o("span", {
|
|
542
|
+
className: "pa-button__icon",
|
|
543
|
+
"aria-hidden": "true",
|
|
544
|
+
children: k
|
|
545
|
+
}),
|
|
546
|
+
j,
|
|
547
|
+
A !== void 0 && /* @__PURE__ */ o("span", {
|
|
548
|
+
className: "pa-button__icon",
|
|
549
|
+
"aria-hidden": "true",
|
|
550
|
+
children: A
|
|
551
|
+
})
|
|
552
|
+
]
|
|
553
|
+
});
|
|
554
|
+
}, X = {
|
|
555
|
+
ExtraSmall: "extra-small",
|
|
556
|
+
Small: "small",
|
|
557
|
+
MediumSmall: "medium-small",
|
|
558
|
+
Medium: "medium",
|
|
559
|
+
Large: "large",
|
|
560
|
+
ExtraLarge: "extra-large"
|
|
561
|
+
}, Z = {
|
|
562
|
+
Black: "black",
|
|
563
|
+
White: "white",
|
|
564
|
+
Blue: "blue",
|
|
565
|
+
Gray: "gray",
|
|
566
|
+
GrayDark: "gray-dark",
|
|
567
|
+
Success: "success",
|
|
568
|
+
Warning: "warning",
|
|
569
|
+
Error: "error"
|
|
570
|
+
}, je = {
|
|
571
|
+
[X.ExtraSmall]: p * 3,
|
|
572
|
+
[X.Small]: p * 4,
|
|
573
|
+
[X.MediumSmall]: p * 5,
|
|
574
|
+
[X.Medium]: p * 6,
|
|
575
|
+
[X.Large]: p * 8,
|
|
576
|
+
[X.ExtraLarge]: p * 16
|
|
577
|
+
}, Me = _.svg`
|
|
578
|
+
display: inline-flex;
|
|
579
|
+
width: ${(e) => je[e.$size]}px;
|
|
580
|
+
height: ${(e) => je[e.$size]}px;
|
|
581
|
+
fill: ${(e) => e.$color};
|
|
1
582
|
|
|
2
|
-
|
|
583
|
+
&:hover {
|
|
584
|
+
fill: ${(e) => e.$hoverColor};
|
|
585
|
+
}
|
|
586
|
+
`, Ne = {
|
|
587
|
+
[Z.White]: () => g,
|
|
588
|
+
[Z.Blue]: (e) => e?.actionColor?.main ?? c,
|
|
589
|
+
[Z.Gray]: () => f,
|
|
590
|
+
[Z.GrayDark]: () => d,
|
|
591
|
+
[Z.Success]: (e) => e?.successColor?.main ?? m,
|
|
592
|
+
[Z.Error]: (e) => e?.errorColor?.main ?? u,
|
|
593
|
+
[Z.Warning]: (e) => e?.warningColor?.main ?? h,
|
|
594
|
+
[Z.Black]: () => l
|
|
595
|
+
}, Pe = (e) => e in Ne, Fe = (e, t) => Pe(t) ? Ne[t](e) : t, Q = ({ children: e, size: t = X.Medium, color: r = Z.Black, hoverColor: i, ...a }) => {
|
|
596
|
+
let s = n(v);
|
|
597
|
+
return /* @__PURE__ */ o(Me, {
|
|
598
|
+
$size: t,
|
|
599
|
+
$color: Fe(s, r),
|
|
600
|
+
$hoverColor: Fe(s, i || r),
|
|
601
|
+
viewBox: "0 0 24 24",
|
|
602
|
+
...a,
|
|
603
|
+
children: e
|
|
604
|
+
});
|
|
605
|
+
}, Ie = (e) => /* @__PURE__ */ o(Q, {
|
|
606
|
+
...e,
|
|
607
|
+
children: /* @__PURE__ */ o("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" })
|
|
608
|
+
}), Le = (e) => /* @__PURE__ */ s(Q, {
|
|
609
|
+
...e,
|
|
610
|
+
children: [/* @__PURE__ */ o("path", {
|
|
611
|
+
opacity: ".87",
|
|
612
|
+
fill: "none",
|
|
613
|
+
d: "M0 0h24v24H0V0z"
|
|
614
|
+
}), /* @__PURE__ */ o("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" })]
|
|
615
|
+
}), Re = (e) => /* @__PURE__ */ s(Q, {
|
|
616
|
+
...e,
|
|
617
|
+
children: [/* @__PURE__ */ o("path", {
|
|
618
|
+
opacity: ".87",
|
|
619
|
+
fill: "none",
|
|
620
|
+
d: "M0 0h24v24H0V0z"
|
|
621
|
+
}), /* @__PURE__ */ o("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" })]
|
|
622
|
+
}), ze = (e) => /* @__PURE__ */ o(Q, {
|
|
623
|
+
...e,
|
|
624
|
+
children: /* @__PURE__ */ o("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" })
|
|
625
|
+
}), Be = _.div`
|
|
626
|
+
display: flex;
|
|
627
|
+
align-items: center;
|
|
628
|
+
`, Ve = _.div`
|
|
629
|
+
display: flex;
|
|
630
|
+
align-items: center;
|
|
631
|
+
margin-right: ${p * 9}px;
|
|
3
632
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
633
|
+
label {
|
|
634
|
+
margin: 0 ${p * 3}px 0 0;
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
select {
|
|
638
|
+
width: 66px;
|
|
639
|
+
}
|
|
640
|
+
`, He = _.div`
|
|
641
|
+
width: 70px;
|
|
642
|
+
`, Ue = _.div`
|
|
643
|
+
margin-right: ${p * 8}px;
|
|
644
|
+
`, We = _.div`
|
|
645
|
+
display: flex;
|
|
646
|
+
`, $ = _.div`
|
|
647
|
+
&:not(:last-child) {
|
|
648
|
+
margin-right: ${p * 2}px;
|
|
649
|
+
}
|
|
650
|
+
`, Ge = (e, t, n) => {
|
|
651
|
+
let r = e * (t - 1);
|
|
652
|
+
return {
|
|
653
|
+
from: r + 1,
|
|
654
|
+
to: Math.min(r + e, n),
|
|
655
|
+
total: n
|
|
656
|
+
};
|
|
657
|
+
}, Ke = ({ from: e, to: t, total: n }) => `${e}-${t} of ${n}`, qe = ({ pageIndex: e, perPage: t, pageSizes: n = [
|
|
658
|
+
10,
|
|
659
|
+
20,
|
|
660
|
+
50
|
|
661
|
+
], totalPages: r, totalItems: i, setPageSize: a, canNextPage: c, gotoPage: l, canPreviousPage: u, previousPageHandler: d, nextPageHandler: f, parentElementId: p, paginationAmount: m = "", labelPerPage: h = "" }) => {
|
|
662
|
+
let g = `${p}-pagination-select-per-page`, _ = n.map((e) => ({
|
|
663
|
+
id: e,
|
|
664
|
+
label: e,
|
|
665
|
+
value: e
|
|
666
|
+
})), v = _.find(({ value: e }) => e === t), x = Ge(t, e + 1, i), S = m || Ke(x);
|
|
667
|
+
return /* @__PURE__ */ s(Be, { children: [
|
|
668
|
+
/* @__PURE__ */ s(Ve, { children: [h && /* @__PURE__ */ o(y, {
|
|
669
|
+
label: h,
|
|
670
|
+
for: g
|
|
671
|
+
}), /* @__PURE__ */ o(He, { children: /* @__PURE__ */ o(b, {
|
|
672
|
+
id: g,
|
|
673
|
+
onChange: (e) => {
|
|
674
|
+
e !== null && a(Number(e.value));
|
|
675
|
+
},
|
|
676
|
+
options: _,
|
|
677
|
+
value: v
|
|
678
|
+
}) })] }),
|
|
679
|
+
/* @__PURE__ */ o(Ue, { children: S }),
|
|
680
|
+
/* @__PURE__ */ s(We, { children: [
|
|
681
|
+
/* @__PURE__ */ o($, { children: /* @__PURE__ */ o(Y, {
|
|
682
|
+
variant: J.Ghost,
|
|
683
|
+
icon: /* @__PURE__ */ o(Le, {
|
|
684
|
+
hoverColor: Z.Blue,
|
|
685
|
+
color: Z.Gray
|
|
686
|
+
}),
|
|
687
|
+
"aria-label": "First page",
|
|
688
|
+
isDisabled: !u,
|
|
689
|
+
id: `${p}-pagination-first-page-button`,
|
|
690
|
+
onClick: () => l(0)
|
|
691
|
+
}) }),
|
|
692
|
+
/* @__PURE__ */ o($, { children: /* @__PURE__ */ o(Y, {
|
|
693
|
+
variant: J.Ghost,
|
|
694
|
+
icon: /* @__PURE__ */ o(Ie, {
|
|
695
|
+
hoverColor: Z.Blue,
|
|
696
|
+
color: Z.Gray
|
|
697
|
+
}),
|
|
698
|
+
"aria-label": "Previous page",
|
|
699
|
+
isDisabled: !u,
|
|
700
|
+
id: `${p}-pagination-previous-page-button`,
|
|
701
|
+
onClick: d
|
|
702
|
+
}) }),
|
|
703
|
+
/* @__PURE__ */ o($, { children: /* @__PURE__ */ o(Y, {
|
|
704
|
+
variant: J.Ghost,
|
|
705
|
+
icon: /* @__PURE__ */ o(ze, {
|
|
706
|
+
hoverColor: Z.Blue,
|
|
707
|
+
color: Z.Gray
|
|
708
|
+
}),
|
|
709
|
+
"aria-label": "Next page",
|
|
710
|
+
isDisabled: !c,
|
|
711
|
+
id: `${p}-pagination-next-page-button`,
|
|
712
|
+
onClick: f
|
|
713
|
+
}) }),
|
|
714
|
+
/* @__PURE__ */ o($, { children: /* @__PURE__ */ o(Y, {
|
|
715
|
+
variant: J.Ghost,
|
|
716
|
+
icon: /* @__PURE__ */ o(Re, {
|
|
717
|
+
hoverColor: Z.Blue,
|
|
718
|
+
color: Z.Gray
|
|
719
|
+
}),
|
|
720
|
+
"aria-label": "Last page",
|
|
721
|
+
isDisabled: !c,
|
|
722
|
+
id: `${p}-pagination-last-page-button`,
|
|
723
|
+
onClick: () => l(r - 1)
|
|
724
|
+
}) })
|
|
725
|
+
] })
|
|
726
|
+
] });
|
|
727
|
+
};
|
|
728
|
+
//#endregion
|
|
729
|
+
export { qe as default };
|
|
730
|
+
|
|
731
|
+
//# sourceMappingURL=index.js.map
|