@max-ts/kit 0.14.0 → 0.15.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/lib/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  import { Accordion, Checkbox } from "@base-ui/react";
3
3
  import clsx_0, { clsx } from "clsx";
4
- import { ArrowDownNarrowWide, ArrowDownUp, ArrowDownWideNarrow, Calendar1, Check, ChevronDown, ChevronLeft, ChevronRight, ChevronUp, Circle, CircleIcon, Copy, Ellipsis, EllipsisVertical, PanelLeftClose, PanelLeftOpen, X } from "lucide-react";
4
+ import { ArrowDownNarrowWide, ArrowDownUp, ArrowDownWideNarrow, Calendar1, Check, ChevronDown, ChevronLeft, ChevronRight, ChevronUp, Circle, CircleCheck, CircleIcon, Copy, Ellipsis, EllipsisVertical, Info, OctagonAlert, PanelLeftClose, PanelLeftOpen, TriangleAlert, X } from "lucide-react";
5
5
  import { AlertDialog } from "@base-ui/react/alert-dialog";
6
6
  import { Slot } from "@radix-ui/react-slot";
7
7
  import { Root } from "@radix-ui/react-label";
@@ -16,6 +16,7 @@ import { useMask } from "@react-input/mask";
16
16
  import { Close, Content as react_dialog_Content, Description as react_dialog_Description, Overlay as react_dialog_Overlay, Portal as react_dialog_Portal, Root as react_dialog_Root, Title as react_dialog_Title, Trigger as react_dialog_Trigger } from "@radix-ui/react-dialog";
17
17
  import { Drawer, Root as external_vaul_Root } from "vaul";
18
18
  import { OTPInput } from "input-otp";
19
+ import { Toaster, toast } from "sonner";
19
20
  import { Indicator, Item as react_radio_group_Item, Root as react_radio_group_Root } from "@radix-ui/react-radio-group";
20
21
  import { Range, Root as react_slider_Root, Thumb, Track } from "@radix-ui/react-slider";
21
22
  import { Content as react_select_Content, Group, Icon, Item as react_select_Item, ItemIndicator, ItemText, Label as react_select_Label, Portal as react_select_Portal, Root as react_select_Root, ScrollDownButton, ScrollUpButton, Separator as react_select_Separator, Trigger as react_select_Trigger, Value as react_select_Value, Viewport } from "@radix-ui/react-select";
@@ -2486,6 +2487,69 @@ const InputOTP = ({ className, containerClassName, disabled, ...props })=>/*#__P
2486
2487
  },
2487
2488
  ...props
2488
2489
  });
2490
+ var constants_NotificationVariantTypes = /*#__PURE__*/ function(NotificationVariantTypes) {
2491
+ NotificationVariantTypes["info"] = "info";
2492
+ NotificationVariantTypes["success"] = "success";
2493
+ NotificationVariantTypes["warning"] = "warning";
2494
+ NotificationVariantTypes["error"] = "error";
2495
+ return NotificationVariantTypes;
2496
+ }({});
2497
+ const NOTIFICATION_POSITIONS = {
2498
+ topRight: 'top-right',
2499
+ topLeft: 'top-left',
2500
+ bottomRight: 'bottom-right',
2501
+ bottomLeft: 'bottom-left',
2502
+ topCenter: 'top-center',
2503
+ bottomCenter: 'bottom-center'
2504
+ };
2505
+ class Notification {
2506
+ service;
2507
+ constructor(sonner){
2508
+ this.service = sonner;
2509
+ }
2510
+ message(title, message) {
2511
+ return this.service.message(title, {
2512
+ description: message
2513
+ });
2514
+ }
2515
+ success = (title)=>this.service.success(title);
2516
+ error = (title)=>this.service.error(title);
2517
+ info = (title)=>this.service.info(title);
2518
+ warning = (title)=>this.service.warning(title);
2519
+ loading = (title)=>this.service.loading(title);
2520
+ dismiss = (id)=>this.service.dismiss(id);
2521
+ custom = (node)=>this.service(node);
2522
+ action = ({ title, buttonLabel, onClick })=>this.service(title, {
2523
+ action: {
2524
+ label: buttonLabel,
2525
+ onClick
2526
+ }
2527
+ });
2528
+ }
2529
+ const notification = new Notification(toast);
2530
+ const NotificationContainer = ({ position = 'bottomRight', ...props })=>/*#__PURE__*/ jsx(Toaster, {
2531
+ duration: 3000,
2532
+ icons: {
2533
+ error: /*#__PURE__*/ jsx(OctagonAlert, {
2534
+ size: 20,
2535
+ color: theme.colors.error
2536
+ }),
2537
+ success: /*#__PURE__*/ jsx(CircleCheck, {
2538
+ size: 20,
2539
+ color: theme.colors.success
2540
+ }),
2541
+ warning: /*#__PURE__*/ jsx(TriangleAlert, {
2542
+ size: 20,
2543
+ color: theme.colors.warning
2544
+ }),
2545
+ info: /*#__PURE__*/ jsx(Info, {
2546
+ size: 20,
2547
+ color: theme.colors.info
2548
+ })
2549
+ },
2550
+ position: NOTIFICATION_POSITIONS[position],
2551
+ ...props
2552
+ });
2489
2553
  const PAGE_CONTENT_CLASSNAME = 'page-content';
2490
2554
  const PAGE_HEADER_CLASSNAME = 'page_header';
2491
2555
  const PAGE_ASIDE_CLASSNAME = 'page_aside';
@@ -3229,4 +3293,5 @@ function FormTextField({ name, control, gridArea, ...props }) {
3229
3293
  }
3230
3294
  var src_DEFAULT_SEPARATOR = ":";
3231
3295
  var src_DEFAULT_SYMBOL = "—";
3232
- export { Accordion_Accordion as Accordion, AlertDialog_AlertDialog as AlertDialog, Badge, Button, ButtonGroup, Calendar, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, Checkbox_Checkbox as Checkbox, CircularProgress, ConfirmAction, ContentState, Controller as FormController, CopyTypography, DESCRIPTION_ROOT_CLASSNAME, DashboardLayout, DataGrid, DataGridActionCell, DataGridSortHeader, DataList, DatePicker, Description_Description as Description, Dialog, Drawer_Drawer as Drawer, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Form, FormMaskField, FormProvider, FormSubmitButton, FormTextField, Image, ImageCarousel, Input, InputOTP, Label, MaskField, PageLayout, Pagination, PeriodPicker, Placeholder, Popover, PopoverContent, PopoverTrigger, RadioGroup, RadioGroupItem, RangeInput, ScrollTopButton, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Slider, Tabs_Tabs as Tabs, TextField, Tooltip, Typography, alignments, badgeVariants, buttonSizes, buttonVariants, colors, displays, src_DEFAULT_SEPARATOR as DEFAULT_SEPARATOR, src_DEFAULT_SYMBOL as DEFAULT_SYMBOL, theme, transforms, useController as useFormController, useDashboard, useFieldArray as useFormFieldArray, useFormContext, useForm_useForm as useForm, useWatch as useFormWatch, variants, weights };
3296
+ var src_NOTIFY_CLASSNAME = "notify";
3297
+ export { Accordion_Accordion as Accordion, AlertDialog_AlertDialog as AlertDialog, Badge, Button, ButtonGroup, Calendar, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, Checkbox_Checkbox as Checkbox, CircularProgress, ConfirmAction, ContentState, Controller as FormController, CopyTypography, DESCRIPTION_ROOT_CLASSNAME, DashboardLayout, DataGrid, DataGridActionCell, DataGridSortHeader, DataList, DatePicker, Description_Description as Description, Dialog, Drawer_Drawer as Drawer, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Form, FormMaskField, FormProvider, FormSubmitButton, FormTextField, Image, ImageCarousel, Input, InputOTP, Label, MaskField, NOTIFICATION_POSITIONS, Notification, NotificationContainer, PageLayout, Pagination, PeriodPicker, Placeholder, Popover, PopoverContent, PopoverTrigger, RadioGroup, RadioGroupItem, RangeInput, ScrollTopButton, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Slider, Tabs_Tabs as Tabs, TextField, Tooltip, Typography, alignments, badgeVariants, buttonSizes, buttonVariants, colors, constants_NotificationVariantTypes as NotificationVariantTypes, displays, notification, src_DEFAULT_SEPARATOR as DEFAULT_SEPARATOR, src_DEFAULT_SYMBOL as DEFAULT_SYMBOL, src_NOTIFY_CLASSNAME as NOTIFY_CLASSNAME, theme, transforms, useController as useFormController, useDashboard, useFieldArray as useFormFieldArray, useFormContext, useForm_useForm as useForm, useWatch as useFormWatch, variants, weights };
@@ -0,0 +1,20 @@
1
+ import { toast } from 'sonner';
2
+ export declare class Notification {
3
+ private readonly service;
4
+ constructor(sonner: typeof toast);
5
+ message(title: string, message?: string): string | number;
6
+ success: (title: string) => string | number;
7
+ error: (title: string) => string | number;
8
+ info: (title: string) => string | number;
9
+ warning: (title: string) => string | number;
10
+ loading: (title: string) => string | number;
11
+ dismiss: (id?: string | number | undefined) => string | number;
12
+ custom: (node: React.ReactNode) => string | number;
13
+ action: ({ title, buttonLabel, onClick, }: {
14
+ title: string;
15
+ buttonLabel: string;
16
+ onClick: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
17
+ }) => string | number;
18
+ }
19
+ export declare const notification: Notification;
20
+ //# sourceMappingURL=Notification.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Notification.d.ts","sourceRoot":"","sources":["../../../../src/components/Notification/Notification.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAE/B,qBAAa,YAAY;IACxB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC;gBACb,MAAM,EAAE,OAAO,KAAK;IAIzB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM;IAMvC,OAAO,GAAI,OAAO,MAAM,qBAAiC;IAEzD,KAAK,GAAI,OAAO,MAAM,qBAA+B;IAErD,IAAI,GAAI,OAAO,MAAM,qBAA8B;IAEnD,OAAO,GAAI,OAAO,MAAM,qBAAiC;IAEzD,OAAO,GAAI,OAAO,MAAM,qBAAiC;IAEzD,OAAO,GAAI,KAAK,MAAM,GAAG,MAAM,GAAG,SAAS,qBACxB;IAEnB,MAAM,GAAI,MAAM,KAAK,CAAC,SAAS,qBAAwB;IAEvD,MAAM,GAAI,kCAId;QACF,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,EAAE,MAAM,CAAC;QACpB,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;KAC1E,qBAMG;CACJ;AAED,eAAO,MAAM,YAAY,cAA0B,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { NOTIFICATION_POSITIONS } from '../constants';
2
+ type NotificationsProps = {
3
+ position?: keyof typeof NOTIFICATION_POSITIONS;
4
+ className?: string;
5
+ style?: React.CSSProperties;
6
+ };
7
+ export declare const NotificationContainer: ({ position, ...props }: NotificationsProps) => import("react/jsx-runtime").JSX.Element;
8
+ export {};
9
+ //# sourceMappingURL=NotificationContainer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NotificationContainer.d.ts","sourceRoot":"","sources":["../../../../../src/components/Notification/NotificationContainer/NotificationContainer.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAEtD,KAAK,kBAAkB,GAAG;IACzB,QAAQ,CAAC,EAAE,MAAM,OAAO,sBAAsB,CAAC;IAC/C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC5B,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,wBAGnC,kBAAkB,4CAapB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './NotificationContainer';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/Notification/NotificationContainer/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC"}
@@ -0,0 +1,16 @@
1
+ export declare enum NotificationVariantTypes {
2
+ info = "info",
3
+ success = "success",
4
+ warning = "warning",
5
+ error = "error"
6
+ }
7
+ export declare const NOTIFICATION_POSITIONS: {
8
+ readonly topRight: "top-right";
9
+ readonly topLeft: "top-left";
10
+ readonly bottomRight: "bottom-right";
11
+ readonly bottomLeft: "bottom-left";
12
+ readonly topCenter: "top-center";
13
+ readonly bottomCenter: "bottom-center";
14
+ };
15
+ export declare const NOTIFY_CLASSNAME = "notify";
16
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/components/Notification/constants.ts"],"names":[],"mappings":"AAAA,oBAAY,wBAAwB;IACnC,IAAI,SAAS;IACb,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,KAAK,UAAU;CACf;AAED,eAAO,MAAM,sBAAsB;;;;;;;CAOzB,CAAC;AAEX,eAAO,MAAM,gBAAgB,WAAW,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from './constants';
2
+ export * from './Notification';
3
+ export * from './NotificationContainer';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Notification/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC"}
@@ -26,6 +26,7 @@ export * from './Input';
26
26
  export * from './InputOTP';
27
27
  export * from './Label';
28
28
  export * from './MaskField';
29
+ export * from './Notification';
29
30
  export * from './PageLayout';
30
31
  export * from './Pagination';
31
32
  export * from './PeriodPicker';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CA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AAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@max-ts/kit",
3
- "version": "0.14.0",
3
+ "version": "0.15.0",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./lib/index.mjs",
6
6
  "types": "./lib/index.d.ts",
@@ -36,6 +36,7 @@
36
36
  "react-dom": "19.2.6",
37
37
  "react-hook-form": "^7.76.1",
38
38
  "react-virtuoso": "^4.18.7",
39
+ "sonner": "^2.0.7",
39
40
  "vaul": "^1.1.2"
40
41
  },
41
42
  "devDependencies": {