@kala-ui/react 0.0.1-beta.3 → 0.0.1-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -3
- package/dist/components/toast/index.d.ts +2 -30
- package/dist/components/toast/index.d.ts.map +1 -1
- package/dist/components/toast/index.js +2 -39
- package/dist/components/toast/index.js.map +1 -1
- package/dist/components/toast/toast.d.ts +5 -0
- package/dist/components/toast/toast.d.ts.map +1 -0
- package/dist/components/toast/toast.js +16 -0
- package/dist/components/toast/toast.js.map +1 -0
- package/dist/components/toast/toast.stories.d.ts +10 -0
- package/dist/components/toast/toast.stories.d.ts.map +1 -0
- package/dist/components/toast/toast.stories.js +60 -0
- package/dist/components/toast/toast.stories.js.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -99,6 +99,30 @@ import { DataTable } from '@kala-ui/react/data-table';
|
|
|
99
99
|
import { AreaChart, LineChart, BarChart } from '@kala-ui/react/charts';
|
|
100
100
|
```
|
|
101
101
|
|
|
102
|
+
**Notifications**
|
|
103
|
+
- `toast` - Toast notification system with full Sonner API support
|
|
104
|
+
|
|
105
|
+
Import from:
|
|
106
|
+
|
|
107
|
+
```tsx
|
|
108
|
+
import { toast, Toast } from '@kala-ui/react/toast';
|
|
109
|
+
|
|
110
|
+
// Use the API
|
|
111
|
+
toast.success('Success message');
|
|
112
|
+
toast.error('Error message');
|
|
113
|
+
toast.dismiss(toastId);
|
|
114
|
+
|
|
115
|
+
// Use the component
|
|
116
|
+
<Toast />
|
|
117
|
+
|
|
118
|
+
// Promise-based toasts
|
|
119
|
+
toast.promise(promise, {
|
|
120
|
+
loading: 'Loading...',
|
|
121
|
+
success: 'Success!',
|
|
122
|
+
error: 'Error',
|
|
123
|
+
});
|
|
124
|
+
```
|
|
125
|
+
|
|
102
126
|
**Advanced**
|
|
103
127
|
- `dropdown-menu`, `user-menu-dropdown`, `social-login-button`, `password-strength-indicator`, `session-card`
|
|
104
128
|
|
|
@@ -145,8 +169,8 @@ Or import in CSS files:
|
|
|
145
169
|
- Dark mode support
|
|
146
170
|
|
|
147
171
|
**DND** - Drag and drop components
|
|
148
|
-
- Sortable lists and grids
|
|
149
|
-
- Built with @
|
|
172
|
+
- Sortable lists and grids with animations
|
|
173
|
+
- Built with @dnd-kit/core
|
|
150
174
|
|
|
151
175
|
See the [Storybook documentation](https://krr2020.com/kala-ui) for complete component catalog.
|
|
152
176
|
|
|
@@ -335,7 +359,7 @@ This component library is built using excellent open-source libraries. We'd like
|
|
|
335
359
|
|
|
336
360
|
### Drag & Drop
|
|
337
361
|
|
|
338
|
-
- **[@
|
|
362
|
+
- **[@dnd-kit/core](https://github.com/clauderic/dnd-kit)** - Modern, lightweight drag and drop library for React
|
|
339
363
|
|
|
340
364
|
---
|
|
341
365
|
|
|
@@ -1,31 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Toast API that supports all Sonner options including custom icons
|
|
5
|
-
*
|
|
6
|
-
* @example Basic usage
|
|
7
|
-
* toast.success('Success message');
|
|
8
|
-
*
|
|
9
|
-
* @example With custom icon
|
|
10
|
-
* toast.success('Success message', { icon: <CustomIcon /> });
|
|
11
|
-
*
|
|
12
|
-
* @example Remove icon
|
|
13
|
-
* toast.success('Success message', { icon: null });
|
|
14
|
-
*
|
|
15
|
-
* @example Full options
|
|
16
|
-
* toast.success('Success message', {
|
|
17
|
-
* icon: <CustomIcon />,
|
|
18
|
-
* duration: 5000,
|
|
19
|
-
* position: 'top-right',
|
|
20
|
-
* });
|
|
21
|
-
*/
|
|
22
|
-
declare const toast: {
|
|
23
|
-
success: (message: string, options?: ToastOptions) => string | number;
|
|
24
|
-
error: (message: string, options?: ToastOptions) => string | number;
|
|
25
|
-
warning: (message: string, options?: ToastOptions) => string | number;
|
|
26
|
-
info: (message: string, options?: ToastOptions) => string | number;
|
|
27
|
-
loading: (message: string, options?: ToastOptions) => string | number;
|
|
28
|
-
};
|
|
29
|
-
export { toast };
|
|
30
|
-
export { Toaster } from "./toaster";
|
|
1
|
+
export { toast } from "sonner";
|
|
2
|
+
export { Toast } from "./toast";
|
|
31
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/toast/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/toast/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -1,40 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* Toast API that supports all Sonner options including custom icons
|
|
4
|
-
*
|
|
5
|
-
* @example Basic usage
|
|
6
|
-
* toast.success('Success message');
|
|
7
|
-
*
|
|
8
|
-
* @example With custom icon
|
|
9
|
-
* toast.success('Success message', { icon: <CustomIcon /> });
|
|
10
|
-
*
|
|
11
|
-
* @example Remove icon
|
|
12
|
-
* toast.success('Success message', { icon: null });
|
|
13
|
-
*
|
|
14
|
-
* @example Full options
|
|
15
|
-
* toast.success('Success message', {
|
|
16
|
-
* icon: <CustomIcon />,
|
|
17
|
-
* duration: 5000,
|
|
18
|
-
* position: 'top-right',
|
|
19
|
-
* });
|
|
20
|
-
*/
|
|
21
|
-
const toast = {
|
|
22
|
-
success: (message, options) => {
|
|
23
|
-
return sonnerToast.success(message, options);
|
|
24
|
-
},
|
|
25
|
-
error: (message, options) => {
|
|
26
|
-
return sonnerToast.error(message, options);
|
|
27
|
-
},
|
|
28
|
-
warning: (message, options) => {
|
|
29
|
-
return sonnerToast.warning(message, options);
|
|
30
|
-
},
|
|
31
|
-
info: (message, options) => {
|
|
32
|
-
return sonnerToast.info(message, options);
|
|
33
|
-
},
|
|
34
|
-
loading: (message, options) => {
|
|
35
|
-
return sonnerToast.loading(message, options);
|
|
36
|
-
},
|
|
37
|
-
};
|
|
38
|
-
export { toast };
|
|
39
|
-
export { Toaster } from "./toaster";
|
|
1
|
+
export { toast } from "sonner";
|
|
2
|
+
export { Toast } from "./toast";
|
|
40
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/toast/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/toast/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toast.d.ts","sourceRoot":"","sources":["../../../src/components/toast/toast.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,QAAQ,CAAC;AAE3C,KAAK,UAAU,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,MAAM,CAAC,CAAC;AAEtD,QAAA,MAAM,KAAK,GAAI,cAAc,UAAU,4CAqBtC,CAAC;AAEF,OAAO,EAAE,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Toaster as Sonner } from "sonner";
|
|
3
|
+
const Toast = ({ ...props }) => {
|
|
4
|
+
return (_jsx(Sonner, { className: "toaster group", closeButton: true, toastOptions: {
|
|
5
|
+
classNames: {
|
|
6
|
+
toast: 'group toast group-[.toaster]:bg-popover group-[.toaster]:text-foreground group-[.toaster]:border data-[type=error]:!border-destructive data-[type=success]:!border-success data-[type=warning]:!border-warning data-[type=info]:!border-info data-[type=success]:[&_[data-icon]]:!text-success data-[type=error]:[&_[data-icon]]:!text-destructive data-[type=warning]:[&_[data-icon]]:!text-warning data-[type=info]:[&_[data-icon]]:!text-info',
|
|
7
|
+
description: 'group-[.toast]:text-muted-foreground',
|
|
8
|
+
actionButton: 'group-[.toast]:bg-primary group-[.toast]:text-primary-foreground group-data-[type=success]:!bg-success group-data-[type=success]:!text-success-foreground group-data-[type=error]:!bg-destructive group-data-[type=error]:!text-destructive-foreground group-data-[type=warning]:!bg-warning group-data-[type=warning]:!text-warning-foreground group-data-[type=info]:!bg-info group-data-[type=info]:!text-info-foreground',
|
|
9
|
+
cancelButton: 'group-[.toast]:bg-muted group-[.toast]:text-muted-foreground',
|
|
10
|
+
icon: 'group-[.toast]:!text-current',
|
|
11
|
+
closeButton: 'group-[.toast]:bg-popover group-[.toast]:border group-[.toast]:hover:bg-accent group-[.toast]:!left-auto group-[.toast]:!-right-4 group-[.toast]:!-top-1 group-data-[type=success]:!border-success group-data-[type=error]:!border-destructive group-data-[type=warning]:!border-warning group-data-[type=info]:!border-info',
|
|
12
|
+
},
|
|
13
|
+
}, ...props }));
|
|
14
|
+
};
|
|
15
|
+
export { Toast };
|
|
16
|
+
//# sourceMappingURL=toast.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toast.js","sourceRoot":"","sources":["../../../src/components/toast/toast.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,QAAQ,CAAC;AAI3C,MAAM,KAAK,GAAG,CAAC,EAAE,GAAG,KAAK,EAAc,EAAE,EAAE;IAC1C,OAAO,CACN,KAAC,MAAM,IACN,SAAS,EAAC,eAAe,EACzB,WAAW,QACR,YAAY,EAAE;YACZ,UAAU,EAAE;gBACV,KAAK,EACH,kbAAkb;gBACpb,WAAW,EAAE,sCAAsC;gBACnD,YAAY,EACV,8ZAA8Z;gBACha,YAAY,EAAE,8DAA8D;gBAC5E,IAAI,EAAE,8BAA8B;gBACpC,WAAW,EACT,8TAA8T;aACjU;SACF,KACA,KAAK,GACR,CACF,CAAC;AACH,CAAC,CAAC;AAEF,OAAO,EAAE,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { Toast } from "./toast";
|
|
3
|
+
declare const meta: Meta<typeof Toast>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof Toast>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const Success: Story;
|
|
8
|
+
export declare const ErrorToast: Story;
|
|
9
|
+
export declare const VariantsWithActions: Story;
|
|
10
|
+
//# sourceMappingURL=toast.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toast.stories.d.ts","sourceRoot":"","sources":["../../../src/components/toast/toast.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAGvD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,KAAK,CAO5B,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,KAAK,CAAC,CAAC;AAEpC,eAAO,MAAM,OAAO,EAAE,KAoBrB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,KAgBrB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,KAgBxB,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,KAgEjC,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { toast } from "sonner";
|
|
3
|
+
import { Button } from "../button";
|
|
4
|
+
import { Toast } from "./toast";
|
|
5
|
+
const meta = {
|
|
6
|
+
title: "Feedback/Toast",
|
|
7
|
+
component: Toast,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: "centered",
|
|
10
|
+
},
|
|
11
|
+
tags: ["autodocs"],
|
|
12
|
+
};
|
|
13
|
+
export default meta;
|
|
14
|
+
export const Default = {
|
|
15
|
+
render: () => (_jsxs("div", { className: "flex flex-col gap-4 items-center", children: [_jsx(Toast, {}), _jsx(Button, { variant: "outline", onClick: () => toast("Event has been created", {
|
|
16
|
+
description: "Sunday, December 03, 2023 at 9:00 AM",
|
|
17
|
+
action: {
|
|
18
|
+
label: "Undo",
|
|
19
|
+
onClick: () => console.log("Undo"),
|
|
20
|
+
},
|
|
21
|
+
}), children: "Show Toast" })] })),
|
|
22
|
+
};
|
|
23
|
+
export const Success = {
|
|
24
|
+
render: () => (_jsxs("div", { className: "flex flex-col gap-4 items-center", children: [_jsx(Toast, {}), _jsx(Button, { variant: "outline", onClick: () => toast.success("Event has been created", {
|
|
25
|
+
description: "Sunday, December 03, 2023 at 9:00 AM",
|
|
26
|
+
}), children: "Show Success Toast" })] })),
|
|
27
|
+
};
|
|
28
|
+
export const ErrorToast = {
|
|
29
|
+
render: () => (_jsxs("div", { className: "flex flex-col gap-4 items-center", children: [_jsx(Toast, {}), _jsx(Button, { variant: "outline", onClick: () => toast.error("Event has not been created", {
|
|
30
|
+
description: "Sunday, December 03, 2023 at 9:00 AM",
|
|
31
|
+
}), children: "Show Error Toast" })] })),
|
|
32
|
+
};
|
|
33
|
+
export const VariantsWithActions = {
|
|
34
|
+
render: () => (_jsxs("div", { className: "flex flex-col gap-4 items-center", children: [_jsx(Toast, {}), _jsxs("div", { className: "flex gap-4", children: [_jsx(Button, { variant: "outline", onClick: () => toast.success("Project updated successfully", {
|
|
35
|
+
description: "The changes have been saved to the server.",
|
|
36
|
+
action: {
|
|
37
|
+
label: "View Changes",
|
|
38
|
+
onClick: () => console.log("View Changes"),
|
|
39
|
+
},
|
|
40
|
+
}), children: "Success with Action" }), _jsx(Button, { variant: "outline", onClick: () => toast.error("Failed to upload file", {
|
|
41
|
+
description: "The file size exceeds the limit of 10MB.",
|
|
42
|
+
action: {
|
|
43
|
+
label: "Retry",
|
|
44
|
+
onClick: () => console.log("Retry"),
|
|
45
|
+
},
|
|
46
|
+
}), children: "Error with Action" }), _jsx(Button, { variant: "outline", onClick: () => toast.warning("Storage almost full", {
|
|
47
|
+
description: "You have used 90% of your available storage.",
|
|
48
|
+
action: {
|
|
49
|
+
label: "Upgrade",
|
|
50
|
+
onClick: () => console.log("Upgrade"),
|
|
51
|
+
},
|
|
52
|
+
}), children: "Warning with Action" }), _jsx(Button, { variant: "outline", onClick: () => toast.info("New update available", {
|
|
53
|
+
description: "Version 2.0 is now available for download.",
|
|
54
|
+
action: {
|
|
55
|
+
label: "Install",
|
|
56
|
+
onClick: () => console.log("Install"),
|
|
57
|
+
},
|
|
58
|
+
}), children: "Info with Action" })] })] })),
|
|
59
|
+
};
|
|
60
|
+
//# sourceMappingURL=toast.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toast.stories.js","sourceRoot":"","sources":["../../../src/components/toast/toast.stories.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,MAAM,IAAI,GAAuB;IAChC,KAAK,EAAE,gBAAgB;IACvB,SAAS,EAAE,KAAK;IAChB,UAAU,EAAE;QACX,MAAM,EAAE,UAAU;KAClB;IACD,IAAI,EAAE,CAAC,UAAU,CAAC;CAClB,CAAC;AAEF,eAAe,IAAI,CAAC;AAGpB,MAAM,CAAC,MAAM,OAAO,GAAU;IAC7B,MAAM,EAAE,GAAG,EAAE,CAAC,CACb,eAAK,SAAS,EAAC,kCAAkC,aAChD,KAAC,KAAK,KAAG,EACT,KAAC,MAAM,IACN,OAAO,EAAC,SAAS,EACjB,OAAO,EAAE,GAAG,EAAE,CACb,KAAK,CAAC,wB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C,cAAc,CAAC;6BAC1C;yBACD,CAAC,oCAIK,EACT,KAAC,MAAM,IACN,OAAO,EAAC,SAAS,EACjB,OAAO,EAAE,GAAG,EAAE,CACb,KAAK,CAAC,KAAK,CAAC,uBAAuB,EAAE;4BACpC,WAAW,EAAE,0CAA0C;4BACvD,MAAM,EAAE;gCACP,KAAK,EAAE,OAAO;gCACd,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC;6BACnC;yBACD,CAAC,kCAIK,EACT,KAAC,MAAM,IACN,OAAO,EAAC,SAAS,EACjB,OAAO,EAAE,GAAG,EAAE,CACb,KAAK,CAAC,OAAO,CAAC,qBAAqB,EAAE;4BACpC,WAAW,EAAE,8CAA8C;4BAC3D,MAAM,EAAE;gCACP,KAAK,EAAE,SAAS;gCAChB,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC;6BACrC;yBACD,CAAC,oCAIK,EACT,KAAC,MAAM,IACN,OAAO,EAAC,SAAS,EACjB,OAAO,EAAE,GAAG,EAAE,CACb,KAAK,CAAC,IAAI,CAAC,sBAAsB,EAAE;4BAClC,WAAW,EAAE,4CAA4C;4BACzD,MAAM,EAAE;gCACP,KAAK,EAAE,SAAS;gCAChB,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC;6BACrC;yBACD,CAAC,iCAIK,IACJ,IACD,CACN;CACD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kala-ui/react",
|
|
3
|
-
"version": "0.0.1-beta.
|
|
3
|
+
"version": "0.0.1-beta.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "65+ accessible React components built with Radix UI and Tailwind CSS. Includes DataTable with server-side support, charts, drag-and-drop, and comprehensive form controls.",
|
|
6
6
|
"keywords": [
|