@krak-stack/registry 0.8.2 → 0.9.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/CHANGELOG.md +13 -0
- package/dist/components/ui/animated-list.js +5 -0
- package/dist/components/ui/app-switcher.d.ts +2 -1
- package/dist/components/ui/app-switcher.js +5 -1
- package/dist/components/ui/async-action-button.d.ts +2 -1
- package/dist/components/ui/async-action-button.js +3 -1
- package/dist/components/ui/bulk-list-input.d.ts +2 -1
- package/dist/components/ui/bulk-list-input.js +6 -1
- package/dist/components/ui/calendar.d.ts +10 -0
- package/dist/components/ui/choice-cards.d.ts +1 -0
- package/dist/components/ui/choice-cards.js +7 -1
- package/dist/components/ui/color-picker.d.ts +2 -1
- package/dist/components/ui/color-picker.js +4 -1
- package/dist/components/ui/cron-expression-editor.d.ts +3 -1
- package/dist/components/ui/cron-expression-editor.js +13 -3
- package/dist/components/ui/danger-confirmation.d.ts +1 -0
- package/dist/components/ui/danger-confirmation.js +5 -1
- package/dist/components/ui/date-picker.d.ts +33 -0
- package/dist/components/ui/date-picker.js +470 -0
- package/dist/components/ui/date-picker.schema.d.ts +9 -0
- package/dist/components/ui/editable-text.js +8 -1
- package/dist/components/ui/form.d.ts +5 -5
- package/dist/components/ui/image-crop-editor.js +10 -1
- package/dist/components/ui/phone-number-input.d.ts +3 -1
- package/dist/components/ui/phone-number-input.js +53 -13
- package/dist/components/ui/phone-number-input.schema.d.ts +7 -0
- package/dist/components/ui/secret-value.js +6 -0
- package/dist/components/ui/select-with-custom-input.d.ts +36 -0
- package/dist/components/ui/select-with-custom-input.js +275 -0
- package/dist/components/ui/sidebar-layout.js +1 -0
- package/dist/components/ui/stepper.js +8 -0
- package/dist/components/ui/timezone-select.d.ts +2 -1
- package/dist/components/ui/timezone-select.js +5 -1
- package/dist/components/ui/toast.d.ts +18 -0
- package/dist/components/ui/toast.js +121 -0
- package/dist/components/ui/unsaved-changes-guard.d.ts +2 -1
- package/dist/components/ui/unsaved-changes-guard.js +4 -1
- package/dist/components/ui/upload-attachment.js +3 -0
- package/dist/lib/docs.js +1 -0
- package/dist/services/notification/client/index.js +4 -7
- package/dist/services/notification/public.js +4 -7
- package/package.json +15 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Toast as ToastPrimitive } from "@base-ui/react/toast";
|
|
2
|
+
import type { ComponentProps } from "react";
|
|
3
|
+
export declare const useToast: typeof ToastPrimitive.useToastManager;
|
|
4
|
+
export declare const createToastManager: typeof ToastPrimitive.createToastManager;
|
|
5
|
+
export type ToastPosition = "top-left" | "top-center" | "top-right" | "bottom-left" | "bottom-center" | "bottom-right";
|
|
6
|
+
export type ToastMessages = {
|
|
7
|
+
notifications: string;
|
|
8
|
+
dismiss: string;
|
|
9
|
+
};
|
|
10
|
+
export type ToastClassNames = Partial<Record<"viewport" | "toast" | "content" | "icon" | "body" | "title" | "description" | "action" | "close", string>>;
|
|
11
|
+
export type ToastProviderProps = ComponentProps<typeof ToastPrimitive.Provider> & {
|
|
12
|
+
position?: ToastPosition;
|
|
13
|
+
locale?: string;
|
|
14
|
+
messages?: Partial<Record<string, Partial<ToastMessages>>>;
|
|
15
|
+
classNames?: ToastClassNames;
|
|
16
|
+
};
|
|
17
|
+
/** Mount once around a client application or a deliberately isolated subtree. */
|
|
18
|
+
export declare const ToastProvider: ({ children, position, locale, messages, classNames, ...props }: ToastProviderProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
// ../../src/components/ui/toast.tsx
|
|
2
|
+
import { Toast as ToastPrimitive } from "@base-ui/react/toast";
|
|
3
|
+
import {
|
|
4
|
+
CircleCheck,
|
|
5
|
+
CircleAlert,
|
|
6
|
+
Info,
|
|
7
|
+
TriangleAlert,
|
|
8
|
+
LoaderCircle,
|
|
9
|
+
X
|
|
10
|
+
} from "lucide-react";
|
|
11
|
+
import { useKrakstackLocale } from "@krak-stack/registry/krakstack-provider";
|
|
12
|
+
|
|
13
|
+
// ../../src/lib/utils.ts
|
|
14
|
+
import { cn } from "cn";
|
|
15
|
+
|
|
16
|
+
// ../../src/components/ui/toast.tsx
|
|
17
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
18
|
+
"use client";
|
|
19
|
+
var useToast = ToastPrimitive.useToastManager;
|
|
20
|
+
var createToastManager = ToastPrimitive.createToastManager;
|
|
21
|
+
var positions = {
|
|
22
|
+
"top-left": "top-4 left-4",
|
|
23
|
+
"top-center": "top-4 left-1/2 -translate-x-1/2",
|
|
24
|
+
"top-right": "top-4 right-4",
|
|
25
|
+
"bottom-left": "bottom-4 left-4",
|
|
26
|
+
"bottom-center": "bottom-4 left-1/2 -translate-x-1/2",
|
|
27
|
+
"bottom-right": "bottom-4 right-4"
|
|
28
|
+
};
|
|
29
|
+
var ToastViewport = ({
|
|
30
|
+
position,
|
|
31
|
+
locale,
|
|
32
|
+
messages,
|
|
33
|
+
classNames
|
|
34
|
+
}) => {
|
|
35
|
+
const language = useKrakstackLocale(locale);
|
|
36
|
+
const copy = {
|
|
37
|
+
...language.startsWith("fr") ? { notifications: "Notifications", dismiss: "Fermer la notification" } : { notifications: "Notifications", dismiss: "Dismiss notification" },
|
|
38
|
+
...messages?.[language.split("-")[0] ?? language],
|
|
39
|
+
...messages?.[language]
|
|
40
|
+
};
|
|
41
|
+
const { toasts } = useToast();
|
|
42
|
+
return /* @__PURE__ */ jsx(ToastPrimitive.Portal, {
|
|
43
|
+
children: /* @__PURE__ */ jsx(ToastPrimitive.Viewport, {
|
|
44
|
+
"data-slot": "toast-viewport",
|
|
45
|
+
"data-position": position,
|
|
46
|
+
"aria-label": copy.notifications,
|
|
47
|
+
className: cn("pointer-events-none fixed z-[100] flex max-h-[calc(100dvh-2rem)] w-96 max-w-[calc(100vw-2rem)] [scrollbar-width:none] flex-col gap-3 overflow-y-auto overscroll-contain outline-none [&::-webkit-scrollbar]:hidden", positions[position], classNames?.viewport),
|
|
48
|
+
children: toasts.map((toast) => {
|
|
49
|
+
const Icon = toast.type === "success" ? CircleCheck : toast.type === "error" ? CircleAlert : toast.type === "warning" ? TriangleAlert : toast.type === "loading" ? LoaderCircle : Info;
|
|
50
|
+
return /* @__PURE__ */ jsx(ToastPrimitive.Root, {
|
|
51
|
+
"data-slot": "toast",
|
|
52
|
+
toast,
|
|
53
|
+
swipeDirection: position.endsWith("left") ? ["left"] : position.endsWith("right") ? ["right"] : [position.startsWith("top") ? "up" : "down"],
|
|
54
|
+
className: cn("bg-popover text-popover-foreground focus-visible:ring-ring pointer-events-auto relative shrink-0 touch-pan-y rounded-lg border p-4 shadow-lg transition-[opacity,transform] duration-150 outline-none focus-visible:ring-2 data-ending-style:translate-y-2 data-ending-style:opacity-0 data-limited:hidden data-starting-style:translate-y-2 data-starting-style:opacity-0 motion-reduce:transition-none", classNames?.toast),
|
|
55
|
+
children: /* @__PURE__ */ jsxs(ToastPrimitive.Content, {
|
|
56
|
+
"data-slot": "toast-content",
|
|
57
|
+
className: cn("flex min-w-0 items-start gap-3", classNames?.content),
|
|
58
|
+
children: [
|
|
59
|
+
/* @__PURE__ */ jsx(Icon, {
|
|
60
|
+
"data-slot": "toast-icon",
|
|
61
|
+
"aria-hidden": "true",
|
|
62
|
+
className: cn("mt-0.5 size-4 shrink-0", toast.type === "success" && "text-emerald-600 dark:text-emerald-400", toast.type === "error" && "text-destructive", toast.type === "warning" && "text-amber-600 dark:text-amber-400", toast.type === "loading" && "motion-safe:animate-spin", classNames?.icon)
|
|
63
|
+
}),
|
|
64
|
+
/* @__PURE__ */ jsxs("div", {
|
|
65
|
+
"data-slot": "toast-body",
|
|
66
|
+
className: cn("grid min-w-0 flex-1 gap-1 [overflow-wrap:anywhere]", classNames?.body),
|
|
67
|
+
children: [
|
|
68
|
+
/* @__PURE__ */ jsx(ToastPrimitive.Title, {
|
|
69
|
+
"data-slot": "toast-title",
|
|
70
|
+
className: cn("text-sm leading-5 font-medium", classNames?.title)
|
|
71
|
+
}),
|
|
72
|
+
/* @__PURE__ */ jsx(ToastPrimitive.Description, {
|
|
73
|
+
"data-slot": "toast-description",
|
|
74
|
+
className: cn("text-muted-foreground text-sm leading-5", classNames?.description)
|
|
75
|
+
}),
|
|
76
|
+
/* @__PURE__ */ jsx(ToastPrimitive.Action, {
|
|
77
|
+
"data-slot": "toast-action",
|
|
78
|
+
className: cn("text-foreground mt-2 w-fit rounded-sm text-sm font-medium underline underline-offset-4 outline-offset-4 disabled:opacity-50", classNames?.action)
|
|
79
|
+
})
|
|
80
|
+
]
|
|
81
|
+
}),
|
|
82
|
+
/* @__PURE__ */ jsx(ToastPrimitive.Close, {
|
|
83
|
+
"data-slot": "toast-close",
|
|
84
|
+
"aria-label": copy.dismiss,
|
|
85
|
+
className: cn("text-muted-foreground hover:bg-muted hover:text-foreground -mt-1 -mr-1 inline-flex size-7 shrink-0 items-center justify-center rounded-md outline-offset-2", classNames?.close),
|
|
86
|
+
children: /* @__PURE__ */ jsx(X, {
|
|
87
|
+
"aria-hidden": "true",
|
|
88
|
+
className: "size-4"
|
|
89
|
+
})
|
|
90
|
+
})
|
|
91
|
+
]
|
|
92
|
+
})
|
|
93
|
+
}, toast.id);
|
|
94
|
+
})
|
|
95
|
+
})
|
|
96
|
+
});
|
|
97
|
+
};
|
|
98
|
+
var ToastProvider = ({
|
|
99
|
+
children,
|
|
100
|
+
position = "bottom-right",
|
|
101
|
+
locale,
|
|
102
|
+
messages,
|
|
103
|
+
classNames,
|
|
104
|
+
...props
|
|
105
|
+
}) => /* @__PURE__ */ jsxs(ToastPrimitive.Provider, {
|
|
106
|
+
...props,
|
|
107
|
+
children: [
|
|
108
|
+
children,
|
|
109
|
+
/* @__PURE__ */ jsx(ToastViewport, {
|
|
110
|
+
position,
|
|
111
|
+
locale,
|
|
112
|
+
messages,
|
|
113
|
+
classNames
|
|
114
|
+
})
|
|
115
|
+
]
|
|
116
|
+
});
|
|
117
|
+
export {
|
|
118
|
+
ToastProvider,
|
|
119
|
+
createToastManager,
|
|
120
|
+
useToast
|
|
121
|
+
};
|
|
@@ -10,6 +10,7 @@ export type UnsavedChangesGuardProps = {
|
|
|
10
10
|
protectBeforeUnload?: boolean;
|
|
11
11
|
locale?: string;
|
|
12
12
|
messages?: Partial<Record<string, Partial<UnsavedChangesGuardMessages>>>;
|
|
13
|
+
className?: string;
|
|
13
14
|
};
|
|
14
15
|
/** Mount once per editing route, inside a TanStack Router provider. */
|
|
15
|
-
export declare const UnsavedChangesGuard: ({ dirty, enabled, protectBeforeUnload, locale: override, messages, }: UnsavedChangesGuardProps) => import("react").JSX.Element;
|
|
16
|
+
export declare const UnsavedChangesGuard: ({ dirty, enabled, protectBeforeUnload, locale: override, messages, className, }: UnsavedChangesGuardProps) => import("react").JSX.Element;
|
|
@@ -181,7 +181,8 @@ var UnsavedChangesGuard = ({
|
|
|
181
181
|
enabled = true,
|
|
182
182
|
protectBeforeUnload = true,
|
|
183
183
|
locale: override,
|
|
184
|
-
messages
|
|
184
|
+
messages,
|
|
185
|
+
className
|
|
185
186
|
}) => {
|
|
186
187
|
const locale = useKrakstackLocale(override);
|
|
187
188
|
const copy = {
|
|
@@ -201,6 +202,8 @@ var UnsavedChangesGuard = ({
|
|
|
201
202
|
blocker.reset?.();
|
|
202
203
|
},
|
|
203
204
|
children: /* @__PURE__ */ jsxs2(AlertDialogContent, {
|
|
205
|
+
"data-component": "unsaved-changes-guard",
|
|
206
|
+
className,
|
|
204
207
|
children: [
|
|
205
208
|
/* @__PURE__ */ jsxs2(AlertDialogHeader, {
|
|
206
209
|
children: [
|
|
@@ -203,6 +203,7 @@ var UploadAttachment = ({
|
|
|
203
203
|
const progress = state.status === "uploading" && state.progress !== undefined && Number.isFinite(state.progress) ? Math.min(100, Math.max(0, state.progress)) : undefined;
|
|
204
204
|
const status = state.status === "error" ? state.message : copy[state.status];
|
|
205
205
|
return /* @__PURE__ */ jsxs(Attachment, {
|
|
206
|
+
"data-component": "upload-attachment",
|
|
206
207
|
state: state.status === "cancelled" ? "idle" : state.status,
|
|
207
208
|
className,
|
|
208
209
|
"aria-labelledby": `${id}-name`,
|
|
@@ -229,11 +230,13 @@ var UploadAttachment = ({
|
|
|
229
230
|
children: description
|
|
230
231
|
}) : null,
|
|
231
232
|
/* @__PURE__ */ jsx3("p", {
|
|
233
|
+
"data-slot": "upload-attachment-status",
|
|
232
234
|
role: state.status === "error" ? "alert" : "status",
|
|
233
235
|
className: "text-muted-foreground mt-1 text-xs",
|
|
234
236
|
children: status
|
|
235
237
|
}),
|
|
236
238
|
state.status === "uploading" ? /* @__PURE__ */ jsx3("progress", {
|
|
239
|
+
"data-slot": "upload-attachment-progress",
|
|
237
240
|
className: "accent-primary mt-2 h-1.5 w-full",
|
|
238
241
|
"aria-label": `${copy.uploading}: ${name}`,
|
|
239
242
|
max: 100,
|
package/dist/lib/docs.js
CHANGED
|
@@ -1348,6 +1348,7 @@ function AppSidebar({ collapsible, footer, groups, header }) {
|
|
|
1348
1348
|
});
|
|
1349
1349
|
return /* @__PURE__ */ jsx13(SidebarMenuItem, {
|
|
1350
1350
|
children: /* @__PURE__ */ jsxs10(SidebarMenuButton, {
|
|
1351
|
+
className: "h-auto min-h-8",
|
|
1351
1352
|
onClick: closeMobileSidebar,
|
|
1352
1353
|
render,
|
|
1353
1354
|
tooltip: item.label(),
|
|
@@ -605,21 +605,18 @@ function NotificationListItem({
|
|
|
605
605
|
]
|
|
606
606
|
});
|
|
607
607
|
return /* @__PURE__ */ jsxs2("div", {
|
|
608
|
-
className: cn("group
|
|
608
|
+
className: cn("group relative min-w-0", unread && "bg-muted/70"),
|
|
609
609
|
"data-unread": unread || undefined,
|
|
610
610
|
children: [
|
|
611
|
-
|
|
612
|
-
className: "h-auto w-full min-w-0 justify-start px-3 py-
|
|
611
|
+
/* @__PURE__ */ jsx8(Button, {
|
|
612
|
+
className: cn("h-auto w-full min-w-0 cursor-pointer justify-start rounded-none border-0 px-3 py-4 text-left [overflow-wrap:anywhere] whitespace-normal", !notification.archivedAt && onArchive && "pr-14"),
|
|
613
613
|
onClick: selectNotification,
|
|
614
614
|
type: "button",
|
|
615
615
|
variant: "ghost",
|
|
616
616
|
children: content
|
|
617
|
-
}) : /* @__PURE__ */ jsx8("div", {
|
|
618
|
-
className: "flex min-w-0 px-3 py-2.5 [overflow-wrap:anywhere]",
|
|
619
|
-
children: content
|
|
620
617
|
}),
|
|
621
618
|
!notification.archivedAt && onArchive ? /* @__PURE__ */ jsx8("div", {
|
|
622
|
-
className: "
|
|
619
|
+
className: "absolute top-3 right-2",
|
|
623
620
|
children: /* @__PURE__ */ jsx8(ArchiveButton, {
|
|
624
621
|
label: labels.archiveItem(notificationTitle(notification)),
|
|
625
622
|
notificationIds: [notification.id],
|
|
@@ -698,21 +698,18 @@ function NotificationListItem({
|
|
|
698
698
|
]
|
|
699
699
|
});
|
|
700
700
|
return /* @__PURE__ */ jsxs2("div", {
|
|
701
|
-
className: cn("group
|
|
701
|
+
className: cn("group relative min-w-0", unread && "bg-muted/70"),
|
|
702
702
|
"data-unread": unread || undefined,
|
|
703
703
|
children: [
|
|
704
|
-
|
|
705
|
-
className: "h-auto w-full min-w-0 justify-start px-3 py-
|
|
704
|
+
/* @__PURE__ */ jsx8(Button, {
|
|
705
|
+
className: cn("h-auto w-full min-w-0 cursor-pointer justify-start rounded-none border-0 px-3 py-4 text-left [overflow-wrap:anywhere] whitespace-normal", !notification.archivedAt && onArchive && "pr-14"),
|
|
706
706
|
onClick: selectNotification,
|
|
707
707
|
type: "button",
|
|
708
708
|
variant: "ghost",
|
|
709
709
|
children: content
|
|
710
|
-
}) : /* @__PURE__ */ jsx8("div", {
|
|
711
|
-
className: "flex min-w-0 px-3 py-2.5 [overflow-wrap:anywhere]",
|
|
712
|
-
children: content
|
|
713
710
|
}),
|
|
714
711
|
!notification.archivedAt && onArchive ? /* @__PURE__ */ jsx8("div", {
|
|
715
|
-
className: "
|
|
712
|
+
className: "absolute top-3 right-2",
|
|
716
713
|
children: /* @__PURE__ */ jsx8(ArchiveButton, {
|
|
717
714
|
label: labels.archiveItem(notificationTitle(notification)),
|
|
718
715
|
notificationIds: [notification.id],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@krak-stack/registry",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Tree-shakable KrakStack components and Effect services.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -17,6 +17,18 @@
|
|
|
17
17
|
"type": "module",
|
|
18
18
|
"sideEffects": false,
|
|
19
19
|
"exports": {
|
|
20
|
+
"./date-picker": {
|
|
21
|
+
"types": "./dist/components/ui/date-picker.d.ts",
|
|
22
|
+
"import": "./dist/components/ui/date-picker.js"
|
|
23
|
+
},
|
|
24
|
+
"./select-with-custom-input": {
|
|
25
|
+
"types": "./dist/components/ui/select-with-custom-input.d.ts",
|
|
26
|
+
"import": "./dist/components/ui/select-with-custom-input.js"
|
|
27
|
+
},
|
|
28
|
+
"./toast": {
|
|
29
|
+
"types": "./dist/components/ui/toast.d.ts",
|
|
30
|
+
"import": "./dist/components/ui/toast.js"
|
|
31
|
+
},
|
|
20
32
|
"./cron-expression-editor": {
|
|
21
33
|
"types": "./dist/components/ui/cron-expression-editor.d.ts",
|
|
22
34
|
"import": "./dist/components/ui/cron-expression-editor.js"
|
|
@@ -379,7 +391,9 @@
|
|
|
379
391
|
"@oxlint/plugins": "1.78.0",
|
|
380
392
|
"bowser": "^2.14.1",
|
|
381
393
|
"cron-parser": "^5.10.4",
|
|
394
|
+
"date-fns": "^4.4.0",
|
|
382
395
|
"react-colorful": "^5.8.1",
|
|
396
|
+
"react-day-picker": "^10.0.2",
|
|
383
397
|
"web-vitals": "^5.1.0"
|
|
384
398
|
},
|
|
385
399
|
"peerDependencies": {
|