@deriv-web-design/ui 0.0.1

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.js ADDED
@@ -0,0 +1,1000 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ Accordion: () => Accordion,
24
+ Breadcrumb: () => Breadcrumb,
25
+ Button: () => Button,
26
+ Card: () => Card,
27
+ Chip: () => Chip,
28
+ ChipDropdown: () => ChipDropdown,
29
+ Link: () => Link,
30
+ Pagination: () => Pagination,
31
+ SearchField: () => SearchField,
32
+ Tag: () => Tag,
33
+ TextField: () => TextField
34
+ });
35
+ module.exports = __toCommonJS(index_exports);
36
+
37
+ // primitives/Button/Button.module.css
38
+ var Button_default = {};
39
+
40
+ // primitives/Button/Button.tsx
41
+ var import_jsx_runtime = require("react/jsx-runtime");
42
+ var Button = ({
43
+ colorScheme = "coral",
44
+ variant = "primary",
45
+ iconPosition = "none",
46
+ icon,
47
+ label,
48
+ fullWidth = false,
49
+ showFocusRing = false,
50
+ children,
51
+ disabled,
52
+ className,
53
+ ...props
54
+ }) => {
55
+ const isIconOnly = iconPosition === "icon-only";
56
+ const classNames = [
57
+ Button_default.button,
58
+ Button_default[`${colorScheme}_${variant}`],
59
+ isIconOnly ? Button_default.iconOnly : "",
60
+ fullWidth ? Button_default.fullWidth : "",
61
+ className ?? ""
62
+ ].filter(Boolean).join(" ");
63
+ const iconNode = icon ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: Button_default.icon, children: icon }) : null;
64
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
65
+ "button",
66
+ {
67
+ className: classNames,
68
+ disabled,
69
+ "aria-label": isIconOnly && label ? label : void 0,
70
+ ...props,
71
+ children: [
72
+ iconPosition === "icon-left" && iconNode,
73
+ !isIconOnly && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: Button_default.label, children: label ?? children }),
74
+ iconPosition === "icon-only" && iconNode,
75
+ iconPosition === "icon-right" && iconNode,
76
+ showFocusRing && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: Button_default.focusRing, "aria-hidden": "true" })
77
+ ]
78
+ }
79
+ );
80
+ };
81
+
82
+ // primitives/Link/Link.module.css
83
+ var Link_default = {};
84
+
85
+ // primitives/Link/Link.tsx
86
+ var import_jsx_runtime2 = require("react/jsx-runtime");
87
+ var ChevronIcon = () => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M3 8h10M9 4l4 4-4 4", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) });
88
+ var Link = ({
89
+ colorScheme = "coral",
90
+ label,
91
+ icon,
92
+ showChevron = true,
93
+ disabled = false,
94
+ children,
95
+ className,
96
+ onClick,
97
+ ...props
98
+ }) => {
99
+ const hasIcon = !!icon;
100
+ const classNames = [
101
+ Link_default.link,
102
+ Link_default[colorScheme],
103
+ hasIcon ? Link_default.withIcon : Link_default.withChevron,
104
+ disabled ? Link_default.disabled : "",
105
+ className ?? ""
106
+ ].filter(Boolean).join(" ");
107
+ const handleClick = (e) => {
108
+ if (disabled) {
109
+ e.preventDefault();
110
+ return;
111
+ }
112
+ onClick?.(e);
113
+ };
114
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
115
+ "a",
116
+ {
117
+ className: classNames,
118
+ "aria-disabled": disabled || void 0,
119
+ tabIndex: disabled ? -1 : void 0,
120
+ onClick: handleClick,
121
+ ...props,
122
+ children: [
123
+ hasIcon && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: Link_default.icon, children: icon }),
124
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: Link_default.label, children: label ?? children }),
125
+ !hasIcon && showChevron && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: Link_default.chevron, "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ChevronIcon, {}) })
126
+ ]
127
+ }
128
+ );
129
+ };
130
+
131
+ // primitives/Chip/Chip.module.css
132
+ var Chip_default = {};
133
+
134
+ // primitives/Chip/Chip.tsx
135
+ var import_jsx_runtime3 = require("react/jsx-runtime");
136
+ var Chip = ({
137
+ size = "md",
138
+ label,
139
+ icon,
140
+ tag,
141
+ selected = false,
142
+ showFocusRing = false,
143
+ disabled = false,
144
+ children,
145
+ className,
146
+ ...props
147
+ }) => {
148
+ const classNames = [
149
+ Chip_default.chip,
150
+ Chip_default[size],
151
+ selected ? Chip_default.selected : "",
152
+ className ?? ""
153
+ ].filter(Boolean).join(" ");
154
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
155
+ "button",
156
+ {
157
+ className: classNames,
158
+ disabled,
159
+ "aria-pressed": selected,
160
+ ...props,
161
+ children: [
162
+ icon && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: Chip_default.icon, children: icon }),
163
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: Chip_default.label, children: label ?? children }),
164
+ tag && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: Chip_default.tag, children: tag }),
165
+ showFocusRing && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: Chip_default.focusRing, "aria-hidden": "true" })
166
+ ]
167
+ }
168
+ );
169
+ };
170
+
171
+ // primitives/Tag/Tag.module.css
172
+ var Tag_default = {};
173
+
174
+ // primitives/Tag/Tag.tsx
175
+ var import_jsx_runtime4 = require("react/jsx-runtime");
176
+ var Tag = ({
177
+ size = "sm",
178
+ variant = "fill",
179
+ fontWeight = "regular",
180
+ label,
181
+ icon,
182
+ children,
183
+ className,
184
+ ...props
185
+ }) => {
186
+ const classNames = [
187
+ Tag_default.tag,
188
+ Tag_default[size],
189
+ Tag_default[variant],
190
+ Tag_default[fontWeight],
191
+ className ?? ""
192
+ ].filter(Boolean).join(" ");
193
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: classNames, ...props, children: [
194
+ icon && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: Tag_default.icon, children: icon }),
195
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: Tag_default.label, children: label ?? children })
196
+ ] });
197
+ };
198
+
199
+ // primitives/Accordion/Accordion.tsx
200
+ var import_react = require("react");
201
+
202
+ // primitives/Accordion/Accordion.module.css
203
+ var Accordion_default = {};
204
+
205
+ // primitives/Accordion/Accordion.tsx
206
+ var import_jsx_runtime5 = require("react/jsx-runtime");
207
+ var ChevronIcon2 = () => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M4 6l4 4 4-4", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) });
208
+ var Accordion = ({
209
+ title,
210
+ children,
211
+ open,
212
+ defaultOpen = false,
213
+ onToggle,
214
+ showTopDivider = true,
215
+ showBottomDivider = true,
216
+ showFocusRing = false,
217
+ className
218
+ }) => {
219
+ const [internalOpen, setInternalOpen] = (0, import_react.useState)(defaultOpen);
220
+ const isControlled = open !== void 0;
221
+ const isOpen = isControlled ? open : internalOpen;
222
+ const handleToggle = () => {
223
+ const next = !isOpen;
224
+ if (!isControlled) setInternalOpen(next);
225
+ onToggle?.(next);
226
+ };
227
+ const classNames = [Accordion_default.accordion, className ?? ""].filter(Boolean).join(" ");
228
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
229
+ "div",
230
+ {
231
+ className: classNames,
232
+ style: {
233
+ borderTop: showTopDivider ? `1px solid var(--accordion-divider-color)` : void 0,
234
+ borderBottom: showBottomDivider ? `1px solid var(--accordion-divider-color)` : void 0
235
+ },
236
+ children: [
237
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
238
+ "button",
239
+ {
240
+ className: Accordion_default.header,
241
+ onClick: handleToggle,
242
+ "aria-expanded": isOpen,
243
+ children: [
244
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: Accordion_default.titleWrapper, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: Accordion_default.title, children: title }) }),
245
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: [Accordion_default.chevron, isOpen ? Accordion_default.chevronRotated : ""].filter(Boolean).join(" "), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ChevronIcon2, {}) }),
246
+ showFocusRing && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: Accordion_default.focusRing, "aria-hidden": "true" })
247
+ ]
248
+ }
249
+ ),
250
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: [Accordion_default.bodyWrapper, isOpen ? Accordion_default.bodyWrapperOpen : ""].filter(Boolean).join(" "), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: Accordion_default.bodyInner, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: Accordion_default.body, children }) }) })
251
+ ]
252
+ }
253
+ );
254
+ };
255
+
256
+ // primitives/TextField/TextField.tsx
257
+ var import_react2 = require("react");
258
+
259
+ // primitives/TextField/TextField.module.css
260
+ var TextField_default = {};
261
+
262
+ // primitives/TextField/TextField.tsx
263
+ var import_jsx_runtime6 = require("react/jsx-runtime");
264
+ var SuccessIcon = () => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", children: [
265
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("circle", { cx: "8", cy: "8", r: "6", stroke: "currentColor", strokeWidth: "1.5" }),
266
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M5.5 8l2 2 3-3", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
267
+ ] });
268
+ var FailIcon = () => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", children: [
269
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M8 2.5L14 13.5H2L8 2.5Z", stroke: "currentColor", strokeWidth: "1.5", strokeLinejoin: "round" }),
270
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M8 6.5v3", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }),
271
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("circle", { cx: "8", cy: "11.5", r: "0.75", fill: "currentColor" })
272
+ ] });
273
+ var TextField = (0, import_react2.forwardRef)(
274
+ ({
275
+ variant = "outline",
276
+ status = "neutral",
277
+ disabled,
278
+ className,
279
+ ...inputProps
280
+ }, ref) => {
281
+ const wrapperClass = [
282
+ TextField_default.wrapper,
283
+ TextField_default[variant],
284
+ TextField_default[status],
285
+ className ?? ""
286
+ ].filter(Boolean).join(" ");
287
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: wrapperClass, "data-disabled": disabled || void 0, children: [
288
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
289
+ "input",
290
+ {
291
+ ref,
292
+ className: TextField_default.input,
293
+ disabled,
294
+ ...inputProps
295
+ }
296
+ ),
297
+ status === "success" && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: [TextField_default.iconSlot, TextField_default.iconSuccess].join(" "), children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SuccessIcon, {}) }),
298
+ status === "fail" && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: [TextField_default.iconSlot, TextField_default.iconFail].join(" "), children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(FailIcon, {}) })
299
+ ] });
300
+ }
301
+ );
302
+ TextField.displayName = "TextField";
303
+
304
+ // primitives/SearchField/SearchField.tsx
305
+ var import_react3 = require("react");
306
+
307
+ // primitives/SearchField/SearchField.module.css
308
+ var SearchField_default = {};
309
+
310
+ // primitives/SearchField/SearchField.tsx
311
+ var import_jsx_runtime7 = require("react/jsx-runtime");
312
+ var SearchIcon = () => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", children: [
313
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("circle", { cx: "6.5", cy: "6.5", r: "4", stroke: "currentColor", strokeWidth: "1.25" }),
314
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M9.5 9.5L13 13", stroke: "currentColor", strokeWidth: "1.25", strokeLinecap: "round" })
315
+ ] });
316
+ var ClearIcon = () => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", children: [
317
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("circle", { cx: "8", cy: "8", r: "6", stroke: "currentColor", strokeWidth: "1.25" }),
318
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M6 6l4 4M10 6l-4 4", stroke: "currentColor", strokeWidth: "1.25", strokeLinecap: "round" })
319
+ ] });
320
+ var SuccessIcon2 = () => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", children: [
321
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("circle", { cx: "8", cy: "8", r: "6", stroke: "currentColor", strokeWidth: "1.5" }),
322
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M5.5 8l2 2 3-3", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
323
+ ] });
324
+ var FailIcon2 = () => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", children: [
325
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M8 2.5L14 13.5H2L8 2.5Z", stroke: "currentColor", strokeWidth: "1.5", strokeLinejoin: "round" }),
326
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M8 6.5v3", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }),
327
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("circle", { cx: "8", cy: "11.5", r: "0.75", fill: "currentColor" })
328
+ ] });
329
+ var SearchField = (0, import_react3.forwardRef)(
330
+ ({
331
+ status = "neutral",
332
+ value,
333
+ defaultValue,
334
+ onChange,
335
+ onClear,
336
+ disabled,
337
+ className,
338
+ ...inputProps
339
+ }, ref) => {
340
+ const innerRef = (0, import_react3.useRef)(null);
341
+ const setRef = (0, import_react3.useCallback)(
342
+ (node) => {
343
+ innerRef.current = node;
344
+ if (typeof ref === "function") {
345
+ ref(node);
346
+ } else if (ref) {
347
+ ref.current = node;
348
+ }
349
+ },
350
+ [ref]
351
+ );
352
+ const isControlled = value !== void 0;
353
+ const [internalHasValue, setInternalHasValue] = (0, import_react3.useState)(
354
+ Boolean(defaultValue)
355
+ );
356
+ const hasValue = isControlled ? Boolean(value) : internalHasValue;
357
+ const handleChange = (e) => {
358
+ if (!isControlled) {
359
+ setInternalHasValue(Boolean(e.target.value));
360
+ }
361
+ onChange?.(e);
362
+ };
363
+ const handleClear = () => {
364
+ if (!isControlled && innerRef.current) {
365
+ innerRef.current.value = "";
366
+ setInternalHasValue(false);
367
+ }
368
+ onClear?.();
369
+ innerRef.current?.focus();
370
+ };
371
+ const showFailIcon = status === "fail" && !disabled;
372
+ const showSuccessIcon = status === "success" && hasValue && !disabled;
373
+ const showClearButton = hasValue && !disabled;
374
+ const wrapperClass = [
375
+ SearchField_default.wrapper,
376
+ SearchField_default[status],
377
+ className ?? ""
378
+ ].filter(Boolean).join(" ");
379
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
380
+ "div",
381
+ {
382
+ className: wrapperClass,
383
+ "data-disabled": disabled || void 0,
384
+ children: [
385
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: SearchField_default.iconSlot, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SearchIcon, {}) }),
386
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
387
+ "input",
388
+ {
389
+ ref: setRef,
390
+ className: SearchField_default.input,
391
+ disabled,
392
+ value,
393
+ defaultValue,
394
+ onChange: handleChange,
395
+ ...inputProps
396
+ }
397
+ ),
398
+ showSuccessIcon && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: [SearchField_default.iconSlot, SearchField_default.iconSuccess].join(" "), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SuccessIcon2, {}) }),
399
+ showFailIcon && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: [SearchField_default.iconSlot, SearchField_default.iconFail].join(" "), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(FailIcon2, {}) }),
400
+ showClearButton && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
401
+ "button",
402
+ {
403
+ type: "button",
404
+ className: SearchField_default.clearButton,
405
+ onClick: handleClear,
406
+ "aria-label": "Clear search",
407
+ tabIndex: -1,
408
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ClearIcon, {})
409
+ }
410
+ )
411
+ ]
412
+ }
413
+ );
414
+ }
415
+ );
416
+ SearchField.displayName = "SearchField";
417
+
418
+ // primitives/Breadcrumb/Breadcrumb.tsx
419
+ var import_react4 = require("react");
420
+
421
+ // primitives/Breadcrumb/Breadcrumb.module.css
422
+ var Breadcrumb_default = {};
423
+
424
+ // primitives/Breadcrumb/Breadcrumb.tsx
425
+ var import_jsx_runtime8 = require("react/jsx-runtime");
426
+ var ChevronRightIcon = () => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
427
+ "svg",
428
+ {
429
+ width: "1em",
430
+ height: "1em",
431
+ viewBox: "0 0 16 16",
432
+ fill: "none",
433
+ xmlns: "http://www.w3.org/2000/svg",
434
+ "aria-hidden": "true",
435
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
436
+ "path",
437
+ {
438
+ d: "M6 3.5L10.5 8L6 12.5",
439
+ stroke: "currentColor",
440
+ strokeWidth: "1",
441
+ strokeLinecap: "round",
442
+ strokeLinejoin: "round"
443
+ }
444
+ )
445
+ }
446
+ );
447
+ function BreadcrumbLink({ item }) {
448
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
449
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("a", { href: item.href, onClick: item.onClick, className: Breadcrumb_default.link, children: item.label }),
450
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: Breadcrumb_default.separator, "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ChevronRightIcon, {}) })
451
+ ] });
452
+ }
453
+ function Breadcrumb({
454
+ items,
455
+ size = "md",
456
+ collapsible = true,
457
+ className,
458
+ ...navProps
459
+ }) {
460
+ const [expanded, setExpanded] = (0, import_react4.useState)(false);
461
+ const truncatable = collapsible && items.length > 3;
462
+ const listClass = [
463
+ Breadcrumb_default.list,
464
+ Breadcrumb_default[size],
465
+ truncatable ? Breadcrumb_default.collapsible : "",
466
+ truncatable && expanded ? Breadcrumb_default.expanded : ""
467
+ ].filter(Boolean).join(" ");
468
+ if (!truncatable) {
469
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("nav", { "aria-label": "Breadcrumb", className, ...navProps, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("ol", { className: listClass, children: items.map((item, index) => {
470
+ const isLast = index === items.length - 1;
471
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("li", { className: Breadcrumb_default.item, children: isLast ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: Breadcrumb_default.current, "aria-current": "page", children: item.label }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(BreadcrumbLink, { item }) }, index);
472
+ }) }) });
473
+ }
474
+ const firstItem = items[0];
475
+ const middleItems = items.slice(1, items.length - 2);
476
+ const parentItem = items[items.length - 2];
477
+ const currentItem = items[items.length - 1];
478
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("nav", { "aria-label": "Breadcrumb", className, ...navProps, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("ol", { className: listClass, children: [
479
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("li", { className: Breadcrumb_default.item, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(BreadcrumbLink, { item: firstItem }) }),
480
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("li", { className: Breadcrumb_default.ellipsisItem, "aria-hidden": expanded, children: [
481
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
482
+ "button",
483
+ {
484
+ className: Breadcrumb_default.ellipsisButton,
485
+ onClick: () => setExpanded(true),
486
+ "aria-label": "Show all breadcrumb items",
487
+ children: "\u2026"
488
+ }
489
+ ),
490
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: Breadcrumb_default.separator, "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ChevronRightIcon, {}) })
491
+ ] }),
492
+ middleItems.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("li", { className: Breadcrumb_default.middleItem, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(BreadcrumbLink, { item }) }, `m-${index}`)),
493
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("li", { className: Breadcrumb_default.item, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(BreadcrumbLink, { item: parentItem }) }),
494
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("li", { className: Breadcrumb_default.item, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: Breadcrumb_default.current, "aria-current": "page", children: currentItem.label }) })
495
+ ] }) });
496
+ }
497
+
498
+ // primitives/ChipDropdown/ChipDropdown.tsx
499
+ var import_react5 = require("react");
500
+
501
+ // primitives/ChipDropdown/ChipDropdown.module.css
502
+ var ChipDropdown_default = {};
503
+
504
+ // primitives/ChipDropdown/ChipDropdown.tsx
505
+ var import_jsx_runtime9 = require("react/jsx-runtime");
506
+ var ChevronDownIcon = () => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
507
+ "svg",
508
+ {
509
+ width: "16",
510
+ height: "16",
511
+ viewBox: "0 0 16 16",
512
+ fill: "none",
513
+ xmlns: "http://www.w3.org/2000/svg",
514
+ "aria-hidden": "true",
515
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
516
+ "path",
517
+ {
518
+ d: "M3 6l5 5 5-5",
519
+ stroke: "currentColor",
520
+ strokeWidth: "1.5",
521
+ strokeLinecap: "round",
522
+ strokeLinejoin: "round"
523
+ }
524
+ )
525
+ }
526
+ );
527
+ var CheckIcon = () => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
528
+ "svg",
529
+ {
530
+ width: "12",
531
+ height: "12",
532
+ viewBox: "0 0 12 12",
533
+ fill: "none",
534
+ xmlns: "http://www.w3.org/2000/svg",
535
+ "aria-hidden": "true",
536
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
537
+ "path",
538
+ {
539
+ d: "M2 6l3 3 5-5",
540
+ stroke: "currentColor",
541
+ strokeWidth: "1.5",
542
+ strokeLinecap: "round",
543
+ strokeLinejoin: "round"
544
+ }
545
+ )
546
+ }
547
+ );
548
+ var ChipDropdown = ({
549
+ size = "md",
550
+ label,
551
+ tag,
552
+ icon,
553
+ options,
554
+ value,
555
+ onChange,
556
+ disabled = false,
557
+ className,
558
+ ...props
559
+ }) => {
560
+ const [open, setOpen] = (0, import_react5.useState)(false);
561
+ const wrapperRef = (0, import_react5.useRef)(null);
562
+ const selectedOption = options.find((o) => o.value === value) ?? null;
563
+ const displayLabel = selectedOption ? selectedOption.label : label;
564
+ const isSelected = selectedOption !== null;
565
+ (0, import_react5.useEffect)(() => {
566
+ if (!open) return;
567
+ const handleClickOutside = (e) => {
568
+ if (wrapperRef.current && !wrapperRef.current.contains(e.target)) {
569
+ setOpen(false);
570
+ }
571
+ };
572
+ document.addEventListener("mousedown", handleClickOutside);
573
+ return () => document.removeEventListener("mousedown", handleClickOutside);
574
+ }, [open]);
575
+ const triggerClassNames = [
576
+ ChipDropdown_default.trigger,
577
+ ChipDropdown_default[size],
578
+ isSelected ? ChipDropdown_default.selected : "",
579
+ open ? ChipDropdown_default.expand : "",
580
+ className ?? ""
581
+ ].filter(Boolean).join(" ");
582
+ const handleKeyDown = (e) => {
583
+ if (e.key === "Escape") setOpen(false);
584
+ };
585
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { ref: wrapperRef, className: ChipDropdown_default.wrapper, children: [
586
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
587
+ "button",
588
+ {
589
+ type: "button",
590
+ className: triggerClassNames,
591
+ disabled,
592
+ "aria-haspopup": "listbox",
593
+ "aria-expanded": open,
594
+ onClick: () => setOpen((prev) => !prev),
595
+ onKeyDown: handleKeyDown,
596
+ ...props,
597
+ children: [
598
+ icon && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: ChipDropdown_default.icon, children: icon }),
599
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: ChipDropdown_default.label, children: displayLabel }),
600
+ tag && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: ChipDropdown_default.tag, children: tag }),
601
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
602
+ "span",
603
+ {
604
+ className: [ChipDropdown_default.chevron, open ? ChipDropdown_default.chevronOpen : ""].filter(Boolean).join(" "),
605
+ "aria-hidden": "true",
606
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ChevronDownIcon, {})
607
+ }
608
+ )
609
+ ]
610
+ }
611
+ ),
612
+ open && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
613
+ "ul",
614
+ {
615
+ role: "listbox",
616
+ "aria-label": label,
617
+ className: ChipDropdown_default.list,
618
+ children: options.map((option) => {
619
+ const isActive = option.value === value;
620
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
621
+ "li",
622
+ {
623
+ role: "option",
624
+ "aria-selected": isActive,
625
+ className: [
626
+ ChipDropdown_default.item,
627
+ isActive ? ChipDropdown_default.itemSelected : ""
628
+ ].filter(Boolean).join(" "),
629
+ onClick: () => {
630
+ onChange?.(option.value);
631
+ setOpen(false);
632
+ },
633
+ children: [
634
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: ChipDropdown_default.itemLabel, children: option.label }),
635
+ isActive && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: ChipDropdown_default.itemCheck, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(CheckIcon, {}) })
636
+ ]
637
+ },
638
+ option.value
639
+ );
640
+ })
641
+ }
642
+ )
643
+ ] });
644
+ };
645
+
646
+ // components/Card/CardPrimaryVariant.module.css
647
+ var CardPrimaryVariant_default = {};
648
+
649
+ // components/Card/CardPrimaryVariant.tsx
650
+ var import_jsx_runtime10 = require("react/jsx-runtime");
651
+ var ArrowRightIcon = () => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
652
+ "svg",
653
+ {
654
+ "aria-hidden": "true",
655
+ fill: "none",
656
+ height: "16",
657
+ viewBox: "0 0 16 16",
658
+ width: "16",
659
+ xmlns: "http://www.w3.org/2000/svg",
660
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
661
+ "path",
662
+ {
663
+ d: "M3 8h10M9 4l4 4-4 4",
664
+ stroke: "currentColor",
665
+ strokeLinecap: "round",
666
+ strokeLinejoin: "round",
667
+ strokeWidth: "1.5"
668
+ }
669
+ )
670
+ }
671
+ );
672
+ var CardPrimaryVariant = ({
673
+ colorScheme = "light",
674
+ title,
675
+ description,
676
+ image,
677
+ imageAlt = "",
678
+ showLink = true,
679
+ linkText = "Learn more",
680
+ onLinkClick,
681
+ className,
682
+ variant: _variant,
683
+ ...props
684
+ }) => {
685
+ const isInverse = colorScheme === "dark" || colorScheme === "brand" || colorScheme === "image";
686
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
687
+ "div",
688
+ {
689
+ className: [
690
+ CardPrimaryVariant_default.card,
691
+ CardPrimaryVariant_default[`style--${colorScheme}`],
692
+ className ?? ""
693
+ ].filter(Boolean).join(" "),
694
+ ...props,
695
+ children: [
696
+ colorScheme === "image" && image && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { "aria-hidden": "true", className: CardPrimaryVariant_default.imageOverlay, children: [
697
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("img", { alt: "", className: CardPrimaryVariant_default.overlayImg, src: image }),
698
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: CardPrimaryVariant_default.gradient })
699
+ ] }),
700
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: CardPrimaryVariant_default.content, children: [
701
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: [CardPrimaryVariant_default.title, isInverse ? CardPrimaryVariant_default.textInverse : CardPrimaryVariant_default.textDefault].join(" "), children: title }),
702
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: [CardPrimaryVariant_default.description, isInverse ? CardPrimaryVariant_default.textInverse : CardPrimaryVariant_default.textDefault].join(" "), children: description }),
703
+ showLink && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
704
+ "button",
705
+ {
706
+ className: [CardPrimaryVariant_default.link, isInverse ? CardPrimaryVariant_default.linkInverse : CardPrimaryVariant_default.linkCoral].join(" "),
707
+ onClick: onLinkClick,
708
+ type: "button",
709
+ children: [
710
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: linkText }),
711
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ArrowRightIcon, {})
712
+ ]
713
+ }
714
+ )
715
+ ] }),
716
+ colorScheme !== "image" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: CardPrimaryVariant_default.imageSection, children: image && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("img", { alt: imageAlt, className: CardPrimaryVariant_default.image, src: image }) })
717
+ ]
718
+ }
719
+ );
720
+ };
721
+
722
+ // components/Card/CardSecondaryVariant.module.css
723
+ var CardSecondaryVariant_default = {};
724
+
725
+ // components/Card/CardSecondaryVariant.tsx
726
+ var import_jsx_runtime11 = require("react/jsx-runtime");
727
+ var ArrowRightIcon2 = () => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
728
+ "svg",
729
+ {
730
+ "aria-hidden": "true",
731
+ fill: "none",
732
+ height: "16",
733
+ viewBox: "0 0 16 16",
734
+ width: "16",
735
+ xmlns: "http://www.w3.org/2000/svg",
736
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
737
+ "path",
738
+ {
739
+ d: "M3 8h10M9 4l4 4-4 4",
740
+ stroke: "currentColor",
741
+ strokeLinecap: "round",
742
+ strokeLinejoin: "round",
743
+ strokeWidth: "1.5"
744
+ }
745
+ )
746
+ }
747
+ );
748
+ var CardSecondaryVariant = ({
749
+ title,
750
+ description,
751
+ icon,
752
+ showIcon = true,
753
+ showLink = true,
754
+ linkText = "Learn more",
755
+ onLinkClick,
756
+ className,
757
+ variant: _variant,
758
+ ...props
759
+ }) => {
760
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
761
+ "div",
762
+ {
763
+ className: [CardSecondaryVariant_default.card, className ?? ""].filter(Boolean).join(" "),
764
+ ...props,
765
+ children: [
766
+ showIcon && icon && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: CardSecondaryVariant_default.icon, children: icon }),
767
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: CardSecondaryVariant_default.title, children: title }),
768
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: CardSecondaryVariant_default.description, children: description }),
769
+ showLink && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
770
+ "button",
771
+ {
772
+ className: CardSecondaryVariant_default.link,
773
+ onClick: onLinkClick,
774
+ type: "button",
775
+ children: [
776
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { children: linkText }),
777
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ArrowRightIcon2, {})
778
+ ]
779
+ }
780
+ )
781
+ ]
782
+ }
783
+ );
784
+ };
785
+
786
+ // components/Card/CardThumbnailVariant.module.css
787
+ var CardThumbnailVariant_default = {};
788
+
789
+ // components/Card/CardThumbnailVariant.tsx
790
+ var import_jsx_runtime12 = require("react/jsx-runtime");
791
+ var LinkIcon = () => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
792
+ "svg",
793
+ {
794
+ "aria-hidden": "true",
795
+ fill: "none",
796
+ height: "14",
797
+ viewBox: "0 0 14 14",
798
+ width: "14",
799
+ xmlns: "http://www.w3.org/2000/svg",
800
+ children: [
801
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
802
+ "path",
803
+ {
804
+ d: "M5.25 2.625H3.5A1.75 1.75 0 0 0 1.75 4.375v5.25A1.75 1.75 0 0 0 3.5 11.375h5.25a1.75 1.75 0 0 0 1.75-1.75V7.875",
805
+ stroke: "currentColor",
806
+ strokeLinecap: "round",
807
+ strokeLinejoin: "round",
808
+ strokeWidth: "1.25"
809
+ }
810
+ ),
811
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
812
+ "path",
813
+ {
814
+ d: "M7.875 1.75h4.375v4.375M12.25 1.75 6.125 7.875",
815
+ stroke: "currentColor",
816
+ strokeLinecap: "round",
817
+ strokeLinejoin: "round",
818
+ strokeWidth: "1.25"
819
+ }
820
+ )
821
+ ]
822
+ }
823
+ );
824
+ var PlayIcon = () => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
825
+ "svg",
826
+ {
827
+ "aria-hidden": "true",
828
+ fill: "none",
829
+ height: "80",
830
+ viewBox: "0 0 80 80",
831
+ width: "80",
832
+ xmlns: "http://www.w3.org/2000/svg",
833
+ children: [
834
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("circle", { cx: "40", cy: "40", fill: "rgba(255,255,255,0.88)", r: "40" }),
835
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: "M32 27l22 13-22 13V27z", fill: "rgba(24,28,37,0.72)" })
836
+ ]
837
+ }
838
+ );
839
+ var CardThumbnailVariant = ({
840
+ type = "video",
841
+ thumbnail,
842
+ thumbnailAlt = "",
843
+ title,
844
+ summary,
845
+ tags = [],
846
+ hideTags = false,
847
+ showCopyLink = true,
848
+ onCopyLink,
849
+ avatar,
850
+ avatarAlt = "",
851
+ className,
852
+ variant: _variant,
853
+ ...props
854
+ }) => {
855
+ const isVideo = type === "video";
856
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
857
+ "div",
858
+ {
859
+ className: [CardThumbnailVariant_default.card, className ?? ""].filter(Boolean).join(" "),
860
+ ...props,
861
+ children: [
862
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: CardThumbnailVariant_default.thumbnailWrapper, children: [
863
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("img", { alt: thumbnailAlt, className: CardThumbnailVariant_default.thumbnailImage, src: thumbnail }),
864
+ isVideo && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { "aria-label": "Play video", className: CardThumbnailVariant_default.playButton, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(PlayIcon, {}) }),
865
+ !isVideo && avatar && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("img", { alt: avatarAlt, className: CardThumbnailVariant_default.avatar, src: avatar })
866
+ ] }),
867
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: CardThumbnailVariant_default.content, children: [
868
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: CardThumbnailVariant_default.metaRow, children: [
869
+ !hideTags && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: CardThumbnailVariant_default.tagsList, children: tags.map((tag, i) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Tag, { icon: tag.icon, label: tag.label, size: "md", variant: "fill" }, i)) }),
870
+ showCopyLink && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
871
+ "button",
872
+ {
873
+ "aria-label": "Copy link",
874
+ className: CardThumbnailVariant_default.copyLink,
875
+ onClick: onCopyLink,
876
+ type: "button",
877
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(LinkIcon, {})
878
+ }
879
+ )
880
+ ] }),
881
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: CardThumbnailVariant_default.title, children: title }),
882
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: CardThumbnailVariant_default.summary, children: summary })
883
+ ] })
884
+ ]
885
+ }
886
+ );
887
+ };
888
+
889
+ // components/Card/Card.tsx
890
+ var import_jsx_runtime13 = require("react/jsx-runtime");
891
+ var Card = (props) => {
892
+ if (props.variant === "primary") {
893
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(CardPrimaryVariant, { ...props });
894
+ }
895
+ if (props.variant === "secondary") {
896
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(CardSecondaryVariant, { ...props });
897
+ }
898
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(CardThumbnailVariant, { ...props });
899
+ };
900
+
901
+ // primitives/Pagination/Pagination.module.css
902
+ var Pagination_default = {};
903
+
904
+ // primitives/Pagination/Pagination.tsx
905
+ var import_jsx_runtime14 = require("react/jsx-runtime");
906
+ var ChevronLeft = () => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M10 12L6 8L10 4", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) });
907
+ var ChevronRight = () => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M6 4L10 8L6 12", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) });
908
+ function getPageItems(currentPage, totalPages) {
909
+ if (totalPages <= 5) {
910
+ return Array.from({ length: totalPages }, (_, i) => i + 1);
911
+ }
912
+ if (currentPage <= 3) {
913
+ return [1, 2, 3, 4, 5, "ellipsis-right", totalPages];
914
+ }
915
+ if (currentPage >= totalPages - 2) {
916
+ return [1, "ellipsis-left", totalPages - 4, totalPages - 3, totalPages - 2, totalPages - 1, totalPages];
917
+ }
918
+ return [1, "ellipsis-left", currentPage - 1, currentPage, currentPage + 1, "ellipsis-right", totalPages];
919
+ }
920
+ var Pagination = ({
921
+ currentPage,
922
+ totalPages,
923
+ onPageChange,
924
+ className
925
+ }) => {
926
+ const items = getPageItems(currentPage, totalPages);
927
+ const isPrevDisabled = currentPage <= 1;
928
+ const isNextDisabled = currentPage >= totalPages;
929
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
930
+ "nav",
931
+ {
932
+ className: [Pagination_default.pagination, className ?? ""].filter(Boolean).join(" "),
933
+ "aria-label": "Pagination navigation",
934
+ children: [
935
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
936
+ "button",
937
+ {
938
+ className: [Pagination_default.navButton, isPrevDisabled ? Pagination_default.navButtonDisabled : ""].filter(Boolean).join(" "),
939
+ onClick: () => onPageChange(currentPage - 1),
940
+ disabled: isPrevDisabled,
941
+ "aria-label": "Previous page",
942
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: Pagination_default.navIcon, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ChevronLeft, {}) })
943
+ }
944
+ ),
945
+ items.map((item, index) => {
946
+ if (item === "ellipsis-left" || item === "ellipsis-right") {
947
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
948
+ "span",
949
+ {
950
+ className: Pagination_default.ellipsis,
951
+ "aria-hidden": "true",
952
+ children: "\u2026"
953
+ },
954
+ `${item}-${index}`
955
+ );
956
+ }
957
+ const isSelected = item === currentPage;
958
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
959
+ "button",
960
+ {
961
+ className: [Pagination_default.pageButton, isSelected ? Pagination_default.pageButtonSelected : ""].filter(Boolean).join(" "),
962
+ onClick: () => {
963
+ if (!isSelected) onPageChange(item);
964
+ },
965
+ "aria-current": isSelected ? "page" : void 0,
966
+ "aria-label": `Page ${item}`,
967
+ children: item
968
+ },
969
+ item
970
+ );
971
+ }),
972
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
973
+ "button",
974
+ {
975
+ className: [Pagination_default.navButton, isNextDisabled ? Pagination_default.navButtonDisabled : ""].filter(Boolean).join(" "),
976
+ onClick: () => onPageChange(currentPage + 1),
977
+ disabled: isNextDisabled,
978
+ "aria-label": "Next page",
979
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: Pagination_default.navIcon, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ChevronRight, {}) })
980
+ }
981
+ )
982
+ ]
983
+ }
984
+ );
985
+ };
986
+ // Annotate the CommonJS export names for ESM import in node:
987
+ 0 && (module.exports = {
988
+ Accordion,
989
+ Breadcrumb,
990
+ Button,
991
+ Card,
992
+ Chip,
993
+ ChipDropdown,
994
+ Link,
995
+ Pagination,
996
+ SearchField,
997
+ Tag,
998
+ TextField
999
+ });
1000
+ //# sourceMappingURL=index.js.map