@krak-stack/registry 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/README.md +29 -0
  2. package/dist/components/ui/alert-dialog.d.ts +18 -0
  3. package/dist/components/ui/app-brand.d.ts +26 -0
  4. package/dist/components/ui/app-brand.js +78 -0
  5. package/dist/components/ui/attachment.d.ts +23 -0
  6. package/dist/components/ui/badge.d.ts +7 -0
  7. package/dist/components/ui/button.d.ts +8 -0
  8. package/dist/components/ui/card.d.ts +11 -0
  9. package/dist/components/ui/checkbox.d.ts +3 -0
  10. package/dist/components/ui/code-block.d.ts +14 -0
  11. package/dist/components/ui/code-block.js +224 -0
  12. package/dist/components/ui/command.d.ts +18 -0
  13. package/dist/components/ui/copy-button.d.ts +18 -0
  14. package/dist/components/ui/copy-button.js +133 -0
  15. package/dist/components/ui/data-table.d.ts +264 -0
  16. package/dist/components/ui/data-table.js +3594 -0
  17. package/dist/components/ui/dialog.d.ts +13 -0
  18. package/dist/components/ui/dropdown-menu.d.ts +29 -0
  19. package/dist/components/ui/editing-locale-switcher.d.ts +7 -0
  20. package/dist/components/ui/editing-locale-switcher.js +626 -0
  21. package/dist/components/ui/effect-form.d.ts +137 -0
  22. package/dist/components/ui/effect-form.js +2330 -0
  23. package/dist/components/ui/field.d.ts +24 -0
  24. package/dist/components/ui/file-picker.d.ts +30 -0
  25. package/dist/components/ui/file-picker.js +811 -0
  26. package/dist/components/ui/form.d.ts +402 -0
  27. package/dist/components/ui/form.js +2245 -0
  28. package/dist/components/ui/google-map.d.ts +103 -0
  29. package/dist/components/ui/google-map.js +754 -0
  30. package/dist/components/ui/icon-input.d.ts +9 -0
  31. package/dist/components/ui/icon-input.js +971 -0
  32. package/dist/components/ui/input-group.d.ts +17 -0
  33. package/dist/components/ui/input.d.ts +3 -0
  34. package/dist/components/ui/label.d.ts +3 -0
  35. package/dist/components/ui/loading.d.ts +7 -0
  36. package/dist/components/ui/loading.js +467 -0
  37. package/dist/components/ui/locale-switcher.d.ts +7 -0
  38. package/dist/components/ui/locale-switcher.js +632 -0
  39. package/dist/components/ui/pagination.d.ts +43 -0
  40. package/dist/components/ui/pagination.js +787 -0
  41. package/dist/components/ui/popover.d.ts +9 -0
  42. package/dist/components/ui/scroll-area.d.ts +4 -0
  43. package/dist/components/ui/search-menu.d.ts +34 -0
  44. package/dist/components/ui/search-menu.js +839 -0
  45. package/dist/components/ui/select.d.ts +15 -0
  46. package/dist/components/ui/separator.d.ts +3 -0
  47. package/dist/components/ui/sheet.d.ts +14 -0
  48. package/dist/components/ui/sidebar-layout.d.ts +29 -0
  49. package/dist/components/ui/sidebar-layout.js +755 -0
  50. package/dist/components/ui/sidebar.d.ts +63 -0
  51. package/dist/components/ui/skeleton.d.ts +2 -0
  52. package/dist/components/ui/stats-card.d.ts +12 -0
  53. package/dist/components/ui/stats-card.js +125 -0
  54. package/dist/components/ui/table.d.ts +10 -0
  55. package/dist/components/ui/textarea.d.ts +3 -0
  56. package/dist/components/ui/theme-switcher.d.ts +29 -0
  57. package/dist/components/ui/theme-switcher.js +775 -0
  58. package/dist/components/ui/tooltip.d.ts +6 -0
  59. package/dist/components/ui/virtualized-combobox.d.ts +54 -0
  60. package/dist/components/ui/virtualized-combobox.js +821 -0
  61. package/dist/hooks/use-mobile.d.ts +1 -0
  62. package/dist/lib/query.d.ts +49 -0
  63. package/dist/lib/utils.d.ts +2 -0
  64. package/dist/paraglide/runtime.d.ts +978 -0
  65. package/dist/services/embedding.d.ts +2 -0
  66. package/dist/services/embedding.js +23 -0
  67. package/dist/services/notification/channels/index.d.ts +22 -0
  68. package/dist/services/notification/channels/index.js +11 -0
  69. package/dist/services/notification/channels/ses/index.d.ts +51 -0
  70. package/dist/services/notification/channels/ses/index.js +145 -0
  71. package/dist/services/notification/channels/ses/schema.d.ts +13 -0
  72. package/dist/services/notification/channels/ses/schema.js +35 -0
  73. package/dist/services/notification/index.d.ts +15 -0
  74. package/dist/services/notification/index.js +67 -0
  75. package/dist/services/notification/schema.d.ts +10 -0
  76. package/dist/services/notification/schema.js +30 -0
  77. package/dist/services/opentelemetry.d.ts +8 -0
  78. package/dist/services/opentelemetry.js +23 -0
  79. package/dist/services/s3/index.d.ts +62 -0
  80. package/dist/services/s3/index.js +208 -0
  81. package/dist/services/s3/schema.d.ts +18 -0
  82. package/dist/services/s3/schema.js +37 -0
  83. package/package.json +218 -0
  84. package/tailwind.css +1 -0
@@ -0,0 +1,787 @@
1
+ // ../../src/components/ui/pagination.tsx
2
+ import {
3
+ ChevronLeft,
4
+ ChevronRight,
5
+ ChevronsLeft,
6
+ ChevronsRight
7
+ } from "lucide-react";
8
+ import { useId } from "react";
9
+
10
+ // ../../src/components/ui/button.tsx
11
+ import { Button as ButtonPrimitive } from "@base-ui/react/button";
12
+ import { cva } from "class-variance-authority";
13
+
14
+ // ../../src/lib/utils.ts
15
+ import { clsx } from "clsx";
16
+ import { twMerge } from "tailwind-merge";
17
+ function cn(...inputs) {
18
+ return twMerge(clsx(inputs));
19
+ }
20
+
21
+ // ../../src/components/ui/button.tsx
22
+ import { jsxDEV } from "react/jsx-dev-runtime";
23
+ var buttonVariants = cva("group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", {
24
+ variants: {
25
+ variant: {
26
+ default: "bg-primary text-primary-foreground hover:bg-primary/80",
27
+ outline: "border-border bg-background shadow-xs hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
28
+ secondary: "bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",
29
+ ghost: "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",
30
+ destructive: "bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",
31
+ link: "text-primary underline-offset-4 hover:underline"
32
+ },
33
+ size: {
34
+ default: "h-9 gap-1.5 px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
35
+ xs: "h-6 gap-1 rounded-[min(var(--radius-md),8px)] px-2 text-xs in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",
36
+ sm: "h-8 gap-1 rounded-[min(var(--radius-md),10px)] px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5",
37
+ lg: "h-10 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
38
+ icon: "size-9",
39
+ "icon-xs": "size-6 rounded-[min(var(--radius-md),8px)] in-data-[slot=button-group]:rounded-md [&_svg:not([class*='size-'])]:size-3",
40
+ "icon-sm": "size-8 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-md",
41
+ "icon-lg": "size-10"
42
+ }
43
+ },
44
+ defaultVariants: {
45
+ variant: "default",
46
+ size: "default"
47
+ }
48
+ });
49
+ function Button({
50
+ className,
51
+ variant = "default",
52
+ size = "default",
53
+ ...props
54
+ }) {
55
+ return /* @__PURE__ */ jsxDEV(ButtonPrimitive, {
56
+ "data-slot": "button",
57
+ className: cn(buttonVariants({ variant, size, className })),
58
+ ...props
59
+ }, undefined, false, undefined, this);
60
+ }
61
+
62
+ // ../../src/components/ui/label.tsx
63
+ import { jsxDEV as jsxDEV2 } from "react/jsx-dev-runtime";
64
+ "use client";
65
+ function Label({ className, ...props }) {
66
+ return /* @__PURE__ */ jsxDEV2("label", {
67
+ "data-slot": "label",
68
+ className: cn("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50", className),
69
+ ...props
70
+ }, undefined, false, undefined, this);
71
+ }
72
+
73
+ // ../../src/components/ui/select.tsx
74
+ import { Select as SelectPrimitive } from "@base-ui/react/select";
75
+ import { ChevronDownIcon, CheckIcon, ChevronUpIcon } from "lucide-react";
76
+ import { jsxDEV as jsxDEV3 } from "react/jsx-dev-runtime";
77
+ "use client";
78
+ var Select = SelectPrimitive.Root;
79
+ function SelectValue({ className, ...props }) {
80
+ return /* @__PURE__ */ jsxDEV3(SelectPrimitive.Value, {
81
+ "data-slot": "select-value",
82
+ className: cn("flex flex-1 text-left", className),
83
+ ...props
84
+ }, undefined, false, undefined, this);
85
+ }
86
+ function SelectTrigger({
87
+ className,
88
+ size = "default",
89
+ children,
90
+ ...props
91
+ }) {
92
+ return /* @__PURE__ */ jsxDEV3(SelectPrimitive.Trigger, {
93
+ "data-slot": "select-trigger",
94
+ "data-size": size,
95
+ className: cn("flex w-fit items-center justify-between gap-1.5 rounded-md border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
96
+ ...props,
97
+ children: [
98
+ children,
99
+ /* @__PURE__ */ jsxDEV3(SelectPrimitive.Icon, {
100
+ render: /* @__PURE__ */ jsxDEV3(ChevronDownIcon, {
101
+ className: "text-muted-foreground pointer-events-none size-4"
102
+ }, undefined, false, undefined, this)
103
+ }, undefined, false, undefined, this)
104
+ ]
105
+ }, undefined, true, undefined, this);
106
+ }
107
+ function SelectContent({
108
+ className,
109
+ children,
110
+ side = "bottom",
111
+ sideOffset = 4,
112
+ align = "center",
113
+ alignOffset = 0,
114
+ alignItemWithTrigger = true,
115
+ ...props
116
+ }) {
117
+ return /* @__PURE__ */ jsxDEV3(SelectPrimitive.Portal, {
118
+ children: /* @__PURE__ */ jsxDEV3(SelectPrimitive.Positioner, {
119
+ side,
120
+ sideOffset,
121
+ align,
122
+ alignOffset,
123
+ alignItemWithTrigger,
124
+ className: "isolate z-50",
125
+ children: /* @__PURE__ */ jsxDEV3(SelectPrimitive.Popup, {
126
+ "data-slot": "select-content",
127
+ "data-align-trigger": alignItemWithTrigger,
128
+ className: cn("relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className),
129
+ ...props,
130
+ children: [
131
+ /* @__PURE__ */ jsxDEV3(SelectScrollUpButton, {}, undefined, false, undefined, this),
132
+ /* @__PURE__ */ jsxDEV3(SelectPrimitive.List, {
133
+ children
134
+ }, undefined, false, undefined, this),
135
+ /* @__PURE__ */ jsxDEV3(SelectScrollDownButton, {}, undefined, false, undefined, this)
136
+ ]
137
+ }, undefined, true, undefined, this)
138
+ }, undefined, false, undefined, this)
139
+ }, undefined, false, undefined, this);
140
+ }
141
+ function SelectItem({
142
+ className,
143
+ children,
144
+ ...props
145
+ }) {
146
+ return /* @__PURE__ */ jsxDEV3(SelectPrimitive.Item, {
147
+ "data-slot": "select-item",
148
+ className: cn("relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2", className),
149
+ ...props,
150
+ children: [
151
+ /* @__PURE__ */ jsxDEV3(SelectPrimitive.ItemText, {
152
+ className: "flex flex-1 shrink-0 gap-2 whitespace-nowrap",
153
+ children
154
+ }, undefined, false, undefined, this),
155
+ /* @__PURE__ */ jsxDEV3(SelectPrimitive.ItemIndicator, {
156
+ render: /* @__PURE__ */ jsxDEV3("span", {
157
+ className: "pointer-events-none absolute right-2 flex size-4 items-center justify-center"
158
+ }, undefined, false, undefined, this),
159
+ children: /* @__PURE__ */ jsxDEV3(CheckIcon, {
160
+ className: "pointer-events-none"
161
+ }, undefined, false, undefined, this)
162
+ }, undefined, false, undefined, this)
163
+ ]
164
+ }, undefined, true, undefined, this);
165
+ }
166
+ function SelectScrollUpButton({
167
+ className,
168
+ ...props
169
+ }) {
170
+ return /* @__PURE__ */ jsxDEV3(SelectPrimitive.ScrollUpArrow, {
171
+ "data-slot": "select-scroll-up-button",
172
+ className: cn("top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4", className),
173
+ ...props,
174
+ children: /* @__PURE__ */ jsxDEV3(ChevronUpIcon, {}, undefined, false, undefined, this)
175
+ }, undefined, false, undefined, this);
176
+ }
177
+ function SelectScrollDownButton({
178
+ className,
179
+ ...props
180
+ }) {
181
+ return /* @__PURE__ */ jsxDEV3(SelectPrimitive.ScrollDownArrow, {
182
+ "data-slot": "select-scroll-down-button",
183
+ className: cn("bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4", className),
184
+ ...props,
185
+ children: /* @__PURE__ */ jsxDEV3(ChevronDownIcon, {}, undefined, false, undefined, this)
186
+ }, undefined, false, undefined, this);
187
+ }
188
+
189
+ // ../../src/paraglide/runtime.js
190
+ import"@inlang/paraglide-js/urlpattern-polyfill";
191
+ var baseLocale = "en";
192
+ var locales = ["en", "fr"];
193
+ var cookieName = "locale";
194
+ var cookieMaxAge = 34560000;
195
+ var cookieDomain = "";
196
+ var localStorageKey = "PARAGLIDE_LOCALE";
197
+ var strategy = [
198
+ "url",
199
+ "cookie",
200
+ "preferredLanguage",
201
+ "baseLocale"
202
+ ];
203
+ var routeStrategies = [
204
+ {
205
+ match: "/api/:path(.*)?",
206
+ exclude: true
207
+ }
208
+ ];
209
+ var urlPatterns = [
210
+ {
211
+ pattern: "/:path(.*)?",
212
+ localized: [
213
+ [
214
+ "en",
215
+ "/en/:path(.*)?"
216
+ ],
217
+ [
218
+ "fr",
219
+ "/fr/:path(.*)?"
220
+ ]
221
+ ]
222
+ }
223
+ ];
224
+ var cachedRouteStrategyUrl;
225
+ var cachedRouteStrategy;
226
+ function findMatchingRouteStrategy(url) {
227
+ if (routeStrategies.length === 0) {
228
+ return;
229
+ }
230
+ const urlString = typeof url === "string" ? url : url.href;
231
+ if (cachedRouteStrategyUrl === urlString) {
232
+ return cachedRouteStrategy;
233
+ }
234
+ const urlObject = new URL(urlString, "http://dummy.com");
235
+ let match;
236
+ for (const routeStrategy of routeStrategies) {
237
+ const pattern = new URLPattern(routeStrategy.match, urlObject.href);
238
+ if (pattern.exec(urlObject.href)) {
239
+ match = routeStrategy;
240
+ break;
241
+ }
242
+ }
243
+ cachedRouteStrategyUrl = urlString;
244
+ cachedRouteStrategy = match;
245
+ return match;
246
+ }
247
+ function getStrategyForUrl(url) {
248
+ const routeStrategy = findMatchingRouteStrategy(url);
249
+ if (routeStrategy && routeStrategy.exclude !== true && Array.isArray(routeStrategy.strategy)) {
250
+ return routeStrategy.strategy;
251
+ }
252
+ return strategy;
253
+ }
254
+ var serverAsyncLocalStorage = undefined;
255
+ var isServer = import.meta.env?.SSR ?? typeof window === "undefined";
256
+ var experimentalStaticLocale = undefined;
257
+ var TREE_SHAKE_COOKIE_STRATEGY_USED = true;
258
+ var TREE_SHAKE_URL_STRATEGY_USED = true;
259
+ var TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED = false;
260
+ var TREE_SHAKE_PREFERRED_LANGUAGE_STRATEGY_USED = true;
261
+ var TREE_SHAKE_DEFAULT_URL_PATTERN_USED = false;
262
+ var TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED = false;
263
+ globalThis.__paraglide = globalThis.__paraglide ?? {};
264
+ globalThis.__paraglide.ssr = globalThis.__paraglide.ssr ?? {};
265
+ var _locale;
266
+ var localeInitiallySet = false;
267
+ var getLocale = () => {
268
+ if (experimentalStaticLocale !== undefined) {
269
+ return experimentalStaticLocale;
270
+ }
271
+ if (serverAsyncLocalStorage) {
272
+ const locale = serverAsyncLocalStorage?.getStore()?.locale;
273
+ if (locale) {
274
+ return locale;
275
+ }
276
+ }
277
+ let strategyToUse = strategy;
278
+ if (!isServer && typeof window !== "undefined" && window.location?.href) {
279
+ strategyToUse = getStrategyForUrl(window.location.href);
280
+ }
281
+ const resolved = resolveLocaleWithStrategies(strategyToUse, typeof window !== "undefined" ? window.location?.href : undefined);
282
+ if (resolved) {
283
+ if (!localeInitiallySet) {
284
+ _locale = resolved;
285
+ localeInitiallySet = true;
286
+ setLocale(resolved, { reload: false });
287
+ }
288
+ return resolved;
289
+ }
290
+ throw new Error("No locale found. Read the docs https://paraglidejs.com/errors#no-locale-found");
291
+ };
292
+ function resolveLocaleWithStrategies(strategyToUse, urlForUrlStrategy) {
293
+ let locale;
294
+ for (const strat of strategyToUse) {
295
+ if (TREE_SHAKE_COOKIE_STRATEGY_USED && strat === "cookie") {
296
+ locale = extractLocaleFromCookie();
297
+ } else if (strat === "baseLocale") {
298
+ locale = baseLocale;
299
+ } else if (TREE_SHAKE_URL_STRATEGY_USED && strat === "url" && !isServer && typeof urlForUrlStrategy === "string") {
300
+ locale = extractLocaleFromUrl(urlForUrlStrategy);
301
+ } else if (TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED && strat === "globalVariable" && _locale !== undefined) {
302
+ locale = _locale;
303
+ } else if (TREE_SHAKE_PREFERRED_LANGUAGE_STRATEGY_USED && strat === "preferredLanguage" && !isServer) {
304
+ locale = extractLocaleFromNavigator();
305
+ } else if (TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED && strat === "localStorage" && !isServer) {
306
+ locale = localStorage.getItem(localStorageKey) ?? undefined;
307
+ } else if (isCustomStrategy(strat) && customClientStrategies.has(strat)) {
308
+ const handler = customClientStrategies.get(strat);
309
+ if (handler) {
310
+ const result = handler.getLocale();
311
+ if (result instanceof Promise) {
312
+ continue;
313
+ }
314
+ if (result !== undefined) {
315
+ return assertIsLocale(result);
316
+ }
317
+ }
318
+ }
319
+ const matchedLocale = toLocale(locale);
320
+ if (matchedLocale) {
321
+ return matchedLocale;
322
+ }
323
+ }
324
+ return;
325
+ }
326
+ var rtlLanguages = new Set([
327
+ "ar",
328
+ "dv",
329
+ "fa",
330
+ "he",
331
+ "ks",
332
+ "ku",
333
+ "ps",
334
+ "sd",
335
+ "ug",
336
+ "ur",
337
+ "yi"
338
+ ]);
339
+ var navigateOrReload = (newLocation) => {
340
+ if (newLocation) {
341
+ window.location.href = newLocation;
342
+ } else {
343
+ window.location.reload();
344
+ }
345
+ };
346
+ var setLocale = (newLocale, options) => {
347
+ const optionsWithDefaults = {
348
+ reload: true,
349
+ ...options
350
+ };
351
+ let currentLocale;
352
+ try {
353
+ currentLocale = getLocale();
354
+ } catch {}
355
+ const customSetLocalePromises = [];
356
+ let newLocation = undefined;
357
+ let strategyToUse = strategy;
358
+ if (!isServer && typeof window !== "undefined" && window.location?.href) {
359
+ strategyToUse = getStrategyForUrl(window.location.href);
360
+ }
361
+ for (const strat of strategyToUse) {
362
+ if (TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED && strat === "globalVariable") {
363
+ _locale = newLocale;
364
+ } else if (TREE_SHAKE_COOKIE_STRATEGY_USED && strat === "cookie") {
365
+ if (isServer || typeof document === "undefined" || typeof window === "undefined") {
366
+ continue;
367
+ }
368
+ const cookieString = `${cookieName}=${newLocale}; path=/; max-age=${cookieMaxAge}`;
369
+ document.cookie = cookieDomain ? `${cookieString}; domain=${cookieDomain}` : cookieString;
370
+ } else if (strat === "baseLocale") {
371
+ continue;
372
+ } else if (TREE_SHAKE_URL_STRATEGY_USED && strat === "url" && typeof window !== "undefined") {
373
+ newLocation = localizeUrl(window.location.href, {
374
+ locale: newLocale
375
+ }).href;
376
+ } else if (TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED && strat === "localStorage" && typeof window !== "undefined") {
377
+ localStorage.setItem(localStorageKey, newLocale);
378
+ } else if (isCustomStrategy(strat) && customClientStrategies.has(strat)) {
379
+ const handler = customClientStrategies.get(strat);
380
+ if (handler) {
381
+ let result = handler.setLocale(newLocale);
382
+ if (result instanceof Promise) {
383
+ result = result.catch((error) => {
384
+ throw new Error(`Custom strategy "${strat}" setLocale failed.`, {
385
+ cause: error
386
+ });
387
+ });
388
+ customSetLocalePromises.push(result);
389
+ }
390
+ }
391
+ }
392
+ }
393
+ const runReload = () => {
394
+ if (!isServer && optionsWithDefaults.reload && window.location && newLocale !== currentLocale) {
395
+ navigateOrReload(newLocation);
396
+ }
397
+ };
398
+ if (customSetLocalePromises.length) {
399
+ return Promise.all(customSetLocalePromises).then(() => {
400
+ runReload();
401
+ });
402
+ }
403
+ runReload();
404
+ return;
405
+ };
406
+ var getUrlOrigin = () => {
407
+ if (serverAsyncLocalStorage) {
408
+ return serverAsyncLocalStorage.getStore()?.origin ?? "http://fallback.com";
409
+ } else if (typeof window !== "undefined") {
410
+ return window.location.origin;
411
+ }
412
+ return "http://fallback.com";
413
+ };
414
+ function toLocale(value) {
415
+ if (typeof value !== "string") {
416
+ return;
417
+ }
418
+ const lowerValue = value.toLowerCase();
419
+ for (const locale of locales) {
420
+ if (locale.toLowerCase() === lowerValue) {
421
+ return locale;
422
+ }
423
+ }
424
+ return;
425
+ }
426
+ function assertIsLocale(input) {
427
+ const locale = toLocale(input);
428
+ if (locale)
429
+ return locale;
430
+ throw new Error(`Invalid locale: ${input}. Expected one of: ${locales.join(", ")}`);
431
+ }
432
+ function extractLocaleFromCookie() {
433
+ if (typeof document === "undefined" || !document.cookie) {
434
+ return;
435
+ }
436
+ const match = document.cookie.match(new RegExp(`(^| )${cookieName}=([^;]+)`));
437
+ const locale = match?.[2];
438
+ return toLocale(locale);
439
+ }
440
+ function extractLocaleFromNavigator() {
441
+ if (!navigator?.languages?.length) {
442
+ return;
443
+ }
444
+ const languages = navigator.languages.map((lang) => ({
445
+ fullTag: lang,
446
+ baseTag: lang.split("-")[0]
447
+ }));
448
+ for (const lang of languages) {
449
+ const fullLocale = toLocale(lang.fullTag);
450
+ if (fullLocale) {
451
+ return fullLocale;
452
+ }
453
+ const baseLocale2 = toLocale(lang.baseTag);
454
+ if (baseLocale2) {
455
+ return baseLocale2;
456
+ }
457
+ }
458
+ return;
459
+ }
460
+ var cachedUrl;
461
+ var cachedLocale;
462
+ function extractLocaleFromUrl(url) {
463
+ const urlString = typeof url === "string" ? url : url.href;
464
+ if (cachedUrl === urlString) {
465
+ return cachedLocale;
466
+ }
467
+ let result;
468
+ if (TREE_SHAKE_DEFAULT_URL_PATTERN_USED) {
469
+ result = defaultUrlPatternExtractLocale(url);
470
+ } else {
471
+ const urlObj = typeof url === "string" ? new URL(url) : url;
472
+ for (const element of urlPatterns) {
473
+ for (const [locale, localizedPattern] of element.localized) {
474
+ const match = new URLPattern(localizedPattern, urlObj.href).exec(urlObj.href);
475
+ if (match) {
476
+ result = locale;
477
+ break;
478
+ }
479
+ }
480
+ if (result)
481
+ break;
482
+ }
483
+ }
484
+ cachedUrl = urlString;
485
+ cachedLocale = result;
486
+ return result;
487
+ }
488
+ function defaultUrlPatternExtractLocale(url) {
489
+ const urlObj = new URL(url, "http://dummy.com");
490
+ const pathSegments = urlObj.pathname.split("/").filter(Boolean);
491
+ return toLocale(pathSegments[0]) || baseLocale;
492
+ }
493
+ function localizeUrl(url, options) {
494
+ const targetLocale = options?.locale ? assertIsLocale(options?.locale) : getLocale();
495
+ if (TREE_SHAKE_DEFAULT_URL_PATTERN_USED) {
496
+ return localizeUrlDefaultPattern(url, targetLocale);
497
+ }
498
+ const urlObj = typeof url === "string" ? new URL(url) : url;
499
+ for (const element of urlPatterns) {
500
+ for (const [, localizedPattern] of element.localized) {
501
+ const match = new URLPattern(localizedPattern, urlObj.href).exec(urlObj.href);
502
+ if (!match) {
503
+ continue;
504
+ }
505
+ const targetPattern = element.localized.find(([locale]) => locale === targetLocale)?.[1];
506
+ if (!targetPattern) {
507
+ continue;
508
+ }
509
+ const localizedUrl = fillPattern(targetPattern, aggregateGroups(match), urlObj.origin);
510
+ return fillMissingUrlParts(localizedUrl, match);
511
+ }
512
+ const unlocalizedMatch = new URLPattern(element.pattern, urlObj.href).exec(urlObj.href);
513
+ if (unlocalizedMatch) {
514
+ const targetPattern = element.localized.find(([locale]) => locale === targetLocale)?.[1];
515
+ if (targetPattern) {
516
+ const localizedUrl = fillPattern(targetPattern, aggregateGroups(unlocalizedMatch), urlObj.origin);
517
+ return fillMissingUrlParts(localizedUrl, unlocalizedMatch);
518
+ }
519
+ }
520
+ }
521
+ return urlObj;
522
+ }
523
+ function localizeUrlDefaultPattern(url, locale) {
524
+ const urlObj = typeof url === "string" ? new URL(url, getUrlOrigin()) : new URL(url);
525
+ const currentLocale = extractLocaleFromUrl(urlObj);
526
+ if (currentLocale === locale) {
527
+ return urlObj;
528
+ }
529
+ const pathSegments = urlObj.pathname.split("/").filter(Boolean);
530
+ if (pathSegments.length > 0 && toLocale(pathSegments[0])) {
531
+ pathSegments.shift();
532
+ }
533
+ if (locale === baseLocale) {
534
+ urlObj.pathname = "/" + pathSegments.join("/");
535
+ } else {
536
+ urlObj.pathname = "/" + locale + "/" + pathSegments.join("/");
537
+ }
538
+ return urlObj;
539
+ }
540
+ function fillMissingUrlParts(url, match) {
541
+ if (match.protocol.groups["0"]) {
542
+ url.protocol = match.protocol.groups["0"] ?? "";
543
+ }
544
+ if (match.hostname.groups["0"]) {
545
+ url.hostname = match.hostname.groups["0"] ?? "";
546
+ }
547
+ if (match.username.groups["0"]) {
548
+ url.username = match.username.groups["0"] ?? "";
549
+ }
550
+ if (match.password.groups["0"]) {
551
+ url.password = match.password.groups["0"] ?? "";
552
+ }
553
+ if (match.port.groups["0"]) {
554
+ url.port = match.port.groups["0"] ?? "";
555
+ }
556
+ if (match.pathname.groups["0"]) {
557
+ url.pathname = match.pathname.groups["0"] ?? "";
558
+ }
559
+ if (match.search.groups["0"]) {
560
+ url.search = match.search.groups["0"] ?? "";
561
+ }
562
+ if (match.hash.groups["0"]) {
563
+ url.hash = match.hash.groups["0"] ?? "";
564
+ }
565
+ return url;
566
+ }
567
+ function fillPattern(pattern, values, origin) {
568
+ let processedPattern = pattern.replace(/(https?:\/\/[^:/]+):(\d+)(\/|$)/g, (_, protocol, port, slash) => {
569
+ return `${protocol}#PORT-${port}#${slash}`;
570
+ });
571
+ let processedGroupDelimiters = processedPattern.replace(/\{([^{}]*)\}([?+*]?)/g, (_, content, modifier) => {
572
+ if (modifier === "?") {
573
+ return content;
574
+ }
575
+ return content;
576
+ });
577
+ let filled = processedGroupDelimiters.replace(/(\/?):([a-zA-Z0-9_]+)(\([^)]*\))?([?+*]?)/g, (_, slash, name, __, modifier) => {
578
+ const value = values[name];
579
+ if (value === null) {
580
+ return "";
581
+ }
582
+ if (modifier === "?") {
583
+ return value !== undefined ? `${slash}${value}` : "";
584
+ }
585
+ if (modifier === "+" || modifier === "*") {
586
+ if (value === undefined && modifier === "+") {
587
+ throw new Error(`Missing value for "${name}" (one or more required)`);
588
+ }
589
+ return value ? `${slash}${value}` : "";
590
+ }
591
+ if (value === undefined) {
592
+ throw new Error(`Missing value for "${name}"`);
593
+ }
594
+ return `${slash}${value}`;
595
+ });
596
+ filled = filled.replace(/#PORT-(\d+)#/g, ":$1");
597
+ return new URL(filled, origin);
598
+ }
599
+ function aggregateGroups(match) {
600
+ return {
601
+ ...match.hash.groups,
602
+ ...match.hostname.groups,
603
+ ...match.password.groups,
604
+ ...match.pathname.groups,
605
+ ...match.port.groups,
606
+ ...match.protocol.groups,
607
+ ...match.search.groups,
608
+ ...match.username.groups
609
+ };
610
+ }
611
+ var customServerStrategies = new Map;
612
+ var customClientStrategies = new Map;
613
+ function isCustomStrategy(strategy2) {
614
+ return typeof strategy2 === "string" && /^custom-[A-Za-z0-9_-]+$/.test(strategy2);
615
+ }
616
+
617
+ // ../../src/components/ui/pagination.tsx
618
+ import { jsxDEV as jsxDEV4 } from "react/jsx-dev-runtime";
619
+ var messages = {
620
+ en: {
621
+ pageSize: "Page size",
622
+ results: (count) => `${count} results`,
623
+ selectedOf: (selected, total) => `${selected} of ${total}`,
624
+ pageOf: (page, total) => `Page ${page} of ${total}`,
625
+ goToFirstPage: "Go to first page",
626
+ goToPreviousPage: "Go to previous page",
627
+ goToNextPage: "Go to next page",
628
+ goToLastPage: "Go to last page"
629
+ },
630
+ fr: {
631
+ pageSize: "Taille de la page",
632
+ results: (count) => `${count} résultats`,
633
+ selectedOf: (selected, total) => `${selected} sur ${total}`,
634
+ pageOf: (page, total) => `Page ${page} sur ${total}`,
635
+ goToFirstPage: "Aller à la première page",
636
+ goToPreviousPage: "Aller à la page précédente",
637
+ goToNextPage: "Aller à la page suivante",
638
+ goToLastPage: "Aller à la dernière page"
639
+ }
640
+ };
641
+ var paginationMessages = (locale = getLocale(), overrides) => ({
642
+ ...locale.startsWith("fr") ? messages.fr : messages.en,
643
+ ...overrides
644
+ });
645
+ function Pagination({
646
+ compact = false,
647
+ messages: messageOverrides,
648
+ onPageChange,
649
+ onPageSizeChange,
650
+ page,
651
+ pageCount,
652
+ pageSize,
653
+ pageSizes = [10, 20, 30, 40, 50],
654
+ selectedRows = 0,
655
+ showResults = true,
656
+ totalRows
657
+ }) {
658
+ const labels = paginationMessages(getLocale(), messageOverrides);
659
+ const pageSizeId = useId();
660
+ const canGoBack = page > 0;
661
+ const canGoForward = page + 1 < pageCount;
662
+ return /* @__PURE__ */ jsxDEV4("div", {
663
+ className: cn("flex flex-col gap-3 px-2 sm:flex-row sm:items-center sm:justify-between", compact && "gap-2 px-0 sm:flex-col sm:items-stretch"),
664
+ children: [
665
+ showResults ? /* @__PURE__ */ jsxDEV4("div", {
666
+ className: "text-muted-foreground flex flex-wrap items-center gap-x-3 gap-y-1 text-sm",
667
+ children: [
668
+ /* @__PURE__ */ jsxDEV4("span", {
669
+ children: labels.results(totalRows)
670
+ }, undefined, false, undefined, this),
671
+ selectedRows > 0 ? /* @__PURE__ */ jsxDEV4("span", {
672
+ children: labels.selectedOf(selectedRows, totalRows)
673
+ }, undefined, false, undefined, this) : null
674
+ ]
675
+ }, undefined, true, undefined, this) : null,
676
+ /* @__PURE__ */ jsxDEV4("div", {
677
+ className: cn("flex items-center gap-4 sm:justify-end", compact && "flex-wrap justify-between gap-2 sm:justify-between"),
678
+ children: [
679
+ /* @__PURE__ */ jsxDEV4("div", {
680
+ className: "flex items-center gap-2",
681
+ children: [
682
+ /* @__PURE__ */ jsxDEV4(Label, {
683
+ htmlFor: pageSizeId,
684
+ className: cn("hidden text-sm sm:block", compact && "block"),
685
+ children: labels.pageSize
686
+ }, undefined, false, undefined, this),
687
+ /* @__PURE__ */ jsxDEV4(Select, {
688
+ items: pageSizes.map((size) => ({
689
+ label: size.toString(),
690
+ value: size.toString()
691
+ })),
692
+ value: `${pageSize}`,
693
+ onValueChange: (value) => onPageSizeChange(Number(value)),
694
+ children: [
695
+ /* @__PURE__ */ jsxDEV4(SelectTrigger, {
696
+ className: "h-8 w-[70px]",
697
+ id: pageSizeId,
698
+ children: /* @__PURE__ */ jsxDEV4(SelectValue, {
699
+ placeholder: pageSize
700
+ }, undefined, false, undefined, this)
701
+ }, undefined, false, undefined, this),
702
+ /* @__PURE__ */ jsxDEV4(SelectContent, {
703
+ side: "top",
704
+ children: pageSizes.map((size) => /* @__PURE__ */ jsxDEV4(SelectItem, {
705
+ value: `${size}`,
706
+ children: size
707
+ }, size, false, undefined, this))
708
+ }, undefined, false, undefined, this)
709
+ ]
710
+ }, undefined, true, undefined, this)
711
+ ]
712
+ }, undefined, true, undefined, this),
713
+ /* @__PURE__ */ jsxDEV4("div", {
714
+ className: "flex items-center gap-2",
715
+ children: [
716
+ /* @__PURE__ */ jsxDEV4("div", {
717
+ className: "flex items-center justify-center text-sm font-medium sm:block",
718
+ children: labels.pageOf(page + 1, pageCount)
719
+ }, undefined, false, undefined, this),
720
+ /* @__PURE__ */ jsxDEV4("div", {
721
+ className: "flex items-center gap-1",
722
+ children: [
723
+ /* @__PURE__ */ jsxDEV4(Button, {
724
+ className: cn("hidden h-8 w-8 p-0 lg:flex", compact && "!hidden"),
725
+ disabled: !canGoBack,
726
+ onClick: () => onPageChange(0),
727
+ type: "button",
728
+ children: [
729
+ /* @__PURE__ */ jsxDEV4("span", {
730
+ className: "sr-only",
731
+ children: labels.goToFirstPage
732
+ }, undefined, false, undefined, this),
733
+ /* @__PURE__ */ jsxDEV4(ChevronsLeft, {}, undefined, false, undefined, this)
734
+ ]
735
+ }, undefined, true, undefined, this),
736
+ /* @__PURE__ */ jsxDEV4(Button, {
737
+ className: "h-8 w-8 p-0",
738
+ disabled: !canGoBack,
739
+ onClick: () => onPageChange(page - 1),
740
+ type: "button",
741
+ children: [
742
+ /* @__PURE__ */ jsxDEV4("span", {
743
+ className: "sr-only",
744
+ children: labels.goToPreviousPage
745
+ }, undefined, false, undefined, this),
746
+ /* @__PURE__ */ jsxDEV4(ChevronLeft, {}, undefined, false, undefined, this)
747
+ ]
748
+ }, undefined, true, undefined, this),
749
+ /* @__PURE__ */ jsxDEV4(Button, {
750
+ className: "h-8 w-8 p-0",
751
+ disabled: !canGoForward,
752
+ onClick: () => onPageChange(page + 1),
753
+ type: "button",
754
+ children: [
755
+ /* @__PURE__ */ jsxDEV4("span", {
756
+ className: "sr-only",
757
+ children: labels.goToNextPage
758
+ }, undefined, false, undefined, this),
759
+ /* @__PURE__ */ jsxDEV4(ChevronRight, {}, undefined, false, undefined, this)
760
+ ]
761
+ }, undefined, true, undefined, this),
762
+ /* @__PURE__ */ jsxDEV4(Button, {
763
+ className: cn("hidden h-8 w-8 p-0 lg:flex", compact && "!hidden"),
764
+ disabled: !canGoForward,
765
+ onClick: () => onPageChange(pageCount - 1),
766
+ type: "button",
767
+ children: [
768
+ /* @__PURE__ */ jsxDEV4("span", {
769
+ className: "sr-only",
770
+ children: labels.goToLastPage
771
+ }, undefined, false, undefined, this),
772
+ /* @__PURE__ */ jsxDEV4(ChevronsRight, {}, undefined, false, undefined, this)
773
+ ]
774
+ }, undefined, true, undefined, this)
775
+ ]
776
+ }, undefined, true, undefined, this)
777
+ ]
778
+ }, undefined, true, undefined, this)
779
+ ]
780
+ }, undefined, true, undefined, this)
781
+ ]
782
+ }, undefined, true, undefined, this);
783
+ }
784
+ export {
785
+ paginationMessages,
786
+ Pagination
787
+ };