@appcorp/shadcn 2.0.0 → 2.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.
Files changed (100) hide show
  1. package/components/app-sidebar.js +1 -34
  2. package/components/audio.js +1 -13
  3. package/components/dashboard.js +1 -29
  4. package/components/drawer-generic.js +1 -39
  5. package/components/enhanced-checkbox.js +1 -39
  6. package/components/enhanced-combobox.js +1 -271
  7. package/components/enhanced-drawer-footer.js +1 -30
  8. package/components/enhanced-drawer-header.js +1 -7
  9. package/components/enhanced-dropzone-impl.js +1 -218
  10. package/components/enhanced-dropzone.js +1 -8
  11. package/components/enhanced-input.js +1 -40
  12. package/components/enhanced-label.js +1 -22
  13. package/components/enhanced-radio.js +1 -15
  14. package/components/enhanced-select.js +1 -33
  15. package/components/enhanced-slider.js +1 -33
  16. package/components/enhanced-switch.js +1 -42
  17. package/components/enhanced-table-footer-action.js +1 -102
  18. package/components/enhanced-table-footer-page.js +1 -124
  19. package/components/enhanced-table-footer-pagination.js +1 -108
  20. package/components/enhanced-table-header-action.js +1 -32
  21. package/components/enhanced-table-header-search.js +1 -10
  22. package/components/enhanced-table.js +1 -301
  23. package/components/enhanced-textarea.js +1 -40
  24. package/components/field.js +1 -96
  25. package/components/image-resize-dialog.js +1 -82
  26. package/components/nav-main.js +1 -40
  27. package/components/nav-projects.js +1 -39
  28. package/components/nav-user.js +1 -52
  29. package/components/show-toast.js +1 -7
  30. package/components/sidebar.js +1 -257
  31. package/components/team-switcher.js +1 -42
  32. package/components/theme-provider.js +1 -112
  33. package/components/timeline.js +1 -13
  34. package/components/tooltip.js +1 -36
  35. package/components/ui/accordion.js +1 -37
  36. package/components/ui/alert-dialog.js +1 -63
  37. package/components/ui/alert.js +1 -41
  38. package/components/ui/area-chart-v1-impl.js +1 -75
  39. package/components/ui/area-chart-v1.js +1 -5
  40. package/components/ui/aspect-ratio.js +1 -4
  41. package/components/ui/avatar.js +1 -31
  42. package/components/ui/badge.js +1 -32
  43. package/components/ui/breadcrumb.js +1 -54
  44. package/components/ui/button.js +1 -44
  45. package/components/ui/calendar-impl.js +1 -55
  46. package/components/ui/calendar.js +1 -6
  47. package/components/ui/card.js +1 -44
  48. package/components/ui/carousel-impl.js +1 -117
  49. package/components/ui/carousel.js +1 -9
  50. package/components/ui/chart-impl.js +6 -161
  51. package/components/ui/chart.js +1 -10
  52. package/components/ui/checkbox.js +1 -24
  53. package/components/ui/collapsible.js +1 -6
  54. package/components/ui/combobox.js +1 -52
  55. package/components/ui/command-impl.js +1 -63
  56. package/components/ui/command.js +1 -13
  57. package/components/ui/context-menu.js +1 -80
  58. package/components/ui/dialog.js +1 -57
  59. package/components/ui/drawer-impl.js +1 -56
  60. package/components/ui/drawer.js +1 -14
  61. package/components/ui/dropdown-menu.js +1 -82
  62. package/components/ui/form.d.ts +1 -1
  63. package/components/ui/form.js +1 -78
  64. package/components/ui/hover-card.js +1 -23
  65. package/components/ui/input-otp-impl.js +1 -43
  66. package/components/ui/input-otp.js +1 -8
  67. package/components/ui/input.js +1 -19
  68. package/components/ui/label.js +1 -23
  69. package/components/ui/language-selector.js +1 -25
  70. package/components/ui/menubar.js +1 -103
  71. package/components/ui/navigation-menu.js +1 -59
  72. package/components/ui/pagination.js +1 -60
  73. package/components/ui/popover.js +1 -25
  74. package/components/ui/progress.js +1 -22
  75. package/components/ui/radio-group.js +1 -29
  76. package/components/ui/resizable-impl.js +1 -27
  77. package/components/ui/resizable.js +1 -7
  78. package/components/ui/scroll-area.js +1 -32
  79. package/components/ui/select.js +1 -71
  80. package/components/ui/separator.js +1 -21
  81. package/components/ui/sheet.js +1 -71
  82. package/components/ui/skeleton.js +1 -18
  83. package/components/ui/slider.js +1 -32
  84. package/components/ui/sonner.js +1 -28
  85. package/components/ui/switch.js +1 -22
  86. package/components/ui/table.js +1 -55
  87. package/components/ui/tabs.js +1 -32
  88. package/components/ui/textarea.js +1 -19
  89. package/components/ui/theme-switcher.js +1 -102
  90. package/components/ui/toggle.js +1 -39
  91. package/data/admin-dashboard.js +1 -301
  92. package/hooks/use-enhanced-combobox.js +1 -73
  93. package/hooks/use-mobile.js +1 -15
  94. package/hooks/use-outside-click.js +1 -19
  95. package/lib/themes.js +1 -147
  96. package/lib/toast-utils.js +1 -170
  97. package/lib/utils.js +1 -5
  98. package/package.json +2 -2
  99. package/utils/transform-breadcrumbs.js +1 -7
  100. package/utils/transform-navitems.js +1 -18
@@ -1,170 +1 @@
1
- /**
2
- * Shared Toast Utilities
3
- *
4
- * Theme-aware toast notification system using Sonner with comprehensive
5
- * styling, icons, and theme integration for consistent user experience
6
- * across all modules.
7
- *
8
- * Features:
9
- * - Theme-aware styling (light/dark/system)
10
- * - Lucide React icons for each toast type
11
- * - Consistent styling with shadcn/ui components
12
- * - TypeScript support with proper interfaces
13
- * - Convenience functions for common use cases
14
- */
15
- import React from "react";
16
- import { toast } from "sonner";
17
- import { AlertCircle, AlertTriangle, CheckCircle, Info, } from "lucide-react";
18
- // Theme-aware toast styling
19
- const THEME_TOAST_STYLES = {
20
- light: {
21
- className: "bg-background text-foreground border-border shadow-lg [&_[data-title]]:text-primary [&_[data-title]]:font-semibold [&_[data-icon]]:text-primary/90 [&_[data-description]]:text-primary [&_[data-description]]:opacity-100",
22
- style: {
23
- backgroundColor: "hsl(var(--background))",
24
- color: "hsl(var(--foreground))",
25
- borderColor: "hsl(var(--border))",
26
- },
27
- },
28
- dark: {
29
- className: "bg-background text-foreground border-border shadow-lg [&_[data-title]]:text-primary [&_[data-title]]:font-semibold [&_[data-icon]]:text-primary/90 [&_[data-description]]:text-primary [&_[data-description]]:opacity-100",
30
- style: {
31
- backgroundColor: "hsl(var(--popover))",
32
- color: "hsl(var(--popover-foreground))",
33
- borderColor: "hsl(var(--border))",
34
- },
35
- },
36
- };
37
- // Toast types matching the previous Vista notification types
38
- export var TOAST_VARIANT;
39
- (function (TOAST_VARIANT) {
40
- TOAST_VARIANT["ERROR"] = "error";
41
- TOAST_VARIANT["INFO"] = "info";
42
- TOAST_VARIANT["SUCCESS"] = "success";
43
- TOAST_VARIANT["WARNING"] = "warning";
44
- })(TOAST_VARIANT || (TOAST_VARIANT = {}));
45
- // Icon mapping for each variant using object notation
46
- const TOAST_ICON_MAP = {
47
- [TOAST_VARIANT.ERROR]: AlertCircle,
48
- [TOAST_VARIANT.INFO]: Info,
49
- [TOAST_VARIANT.SUCCESS]: CheckCircle,
50
- [TOAST_VARIANT.WARNING]: AlertTriangle,
51
- };
52
- const getToastIcon = (variant) => {
53
- return TOAST_ICON_MAP[variant] || Info;
54
- };
55
- // Create icon element helper
56
- const createIconElement = (variant) => {
57
- const Icon = getToastIcon(variant);
58
- return React.createElement("span", { "data-icon": true, className: "inline-flex items-center" }, React.createElement(Icon, { className: "h-4 w-4" }));
59
- };
60
- // Enhanced theme-aware toast function
61
- export const generateToast = ({ variant, title, description, duration = 4000, action, }) => {
62
- const iconElement = createIconElement(variant);
63
- const toastOptions = Object.assign({ description,
64
- duration, icon: iconElement, className: "group-[.toaster]:bg-popover group-[.toaster]:text-popover-foreground group-[.toaster]:border-border", style: {
65
- minWidth: "320px",
66
- maxWidth: "420px",
67
- } }, (action && {
68
- action: {
69
- label: action.label,
70
- onClick: action.onClick,
71
- },
72
- }));
73
- // Toast method mapping using object notation
74
- const TOAST_METHOD_MAP = {
75
- [TOAST_VARIANT.SUCCESS]: () => toast.success(title || "Success", toastOptions),
76
- [TOAST_VARIANT.ERROR]: () => toast.error(title || "Error", toastOptions),
77
- [TOAST_VARIANT.WARNING]: () => toast.warning(title || "Warning", toastOptions),
78
- [TOAST_VARIANT.INFO]: () => toast.info(title || "Information", toastOptions),
79
- };
80
- const toastMethod = TOAST_METHOD_MAP[variant];
81
- return toastMethod
82
- ? toastMethod()
83
- : toast(title || description, toastOptions);
84
- };
85
- // Theme-aware toast generation function
86
- export const generateThemeToast = ({ variant, title, description, duration = 4000, action, theme = "system", }) => {
87
- const iconElement = createIconElement(variant);
88
- // Apply theme-specific styling
89
- const themeStyle = theme === "dark" ? THEME_TOAST_STYLES.dark : THEME_TOAST_STYLES.light;
90
- const toastOptions = Object.assign({ description,
91
- duration, icon: iconElement, className: `${themeStyle.className} toast-theme-${theme}`, style: Object.assign(Object.assign({}, themeStyle.style), { minWidth: "320px", maxWidth: "420px" }) }, (action && {
92
- action: {
93
- label: action.label,
94
- onClick: action.onClick,
95
- },
96
- }));
97
- // Toast method mapping using object notation
98
- const TOAST_METHOD_MAP = {
99
- [TOAST_VARIANT.ERROR]: () => toast.error(title || "Error", toastOptions),
100
- [TOAST_VARIANT.INFO]: () => toast.info(title || "Information", toastOptions),
101
- [TOAST_VARIANT.SUCCESS]: () => toast.success(title || "Success", toastOptions),
102
- [TOAST_VARIANT.WARNING]: () => toast.warning(title || "Warning", toastOptions),
103
- };
104
- const toastMethod = TOAST_METHOD_MAP[variant];
105
- return toastMethod
106
- ? toastMethod()
107
- : toast(title || description, toastOptions);
108
- };
109
- // Convenience functions for each toast type
110
- export const showSuccessToast = (description, title) => {
111
- generateToast({
112
- variant: TOAST_VARIANT.SUCCESS,
113
- title,
114
- description,
115
- });
116
- };
117
- export const showErrorToast = (description, title) => {
118
- generateToast({
119
- variant: TOAST_VARIANT.ERROR,
120
- title,
121
- description,
122
- });
123
- };
124
- export const showWarningToast = (description, title) => {
125
- generateToast({
126
- variant: TOAST_VARIANT.WARNING,
127
- title,
128
- description,
129
- });
130
- };
131
- export const showInfoToast = (description, title) => {
132
- generateToast({
133
- variant: TOAST_VARIANT.INFO,
134
- title,
135
- description,
136
- });
137
- };
138
- // Theme-aware convenience functions
139
- export const showThemeSuccessToast = (description, title, theme) => {
140
- generateThemeToast({
141
- variant: TOAST_VARIANT.SUCCESS,
142
- title,
143
- description,
144
- theme,
145
- });
146
- };
147
- export const showThemeErrorToast = (description, title, theme) => {
148
- generateThemeToast({
149
- variant: TOAST_VARIANT.ERROR,
150
- title,
151
- description,
152
- theme,
153
- });
154
- };
155
- export const showThemeWarningToast = (description, title, theme) => {
156
- generateThemeToast({
157
- variant: TOAST_VARIANT.WARNING,
158
- title,
159
- description,
160
- theme,
161
- });
162
- };
163
- export const showThemeInfoToast = (description, title, theme) => {
164
- generateThemeToast({
165
- variant: TOAST_VARIANT.INFO,
166
- title,
167
- description,
168
- theme,
169
- });
170
- };
1
+ "use strict";import p from"react";import{toast as e}from"sonner";import{AlertCircle as S,AlertTriangle as T,CheckCircle as b,Info as m}from"lucide-react";const g={light:{className:"bg-background text-foreground border-border shadow-lg [&_[data-title]]:text-primary [&_[data-title]]:font-semibold [&_[data-icon]]:text-primary/90 [&_[data-description]]:text-primary [&_[data-description]]:opacity-100",style:{backgroundColor:"hsl(var(--background))",color:"hsl(var(--foreground))",borderColor:"hsl(var(--border))"}},dark:{className:"bg-background text-foreground border-border shadow-lg [&_[data-title]]:text-primary [&_[data-title]]:font-semibold [&_[data-icon]]:text-primary/90 [&_[data-description]]:text-primary [&_[data-description]]:opacity-100",style:{backgroundColor:"hsl(var(--popover))",color:"hsl(var(--popover-foreground))",borderColor:"hsl(var(--border))"}}};export var TOAST_VARIANT;(function(o){o.ERROR="error",o.INFO="info",o.SUCCESS="success",o.WARNING="warning"})(TOAST_VARIANT||(TOAST_VARIANT={}));const E={[TOAST_VARIANT.ERROR]:S,[TOAST_VARIANT.INFO]:m,[TOAST_VARIANT.SUCCESS]:b,[TOAST_VARIANT.WARNING]:T},x=o=>E[o]||m,h=o=>{const r=x(o);return p.createElement("span",{"data-icon":!0,className:"inline-flex items-center"},p.createElement(r,{className:"h-4 w-4"}))};export const generateToast=({variant:o,title:r,description:t,duration:i=4e3,action:s})=>{const c=h(o),n=Object.assign({description:t,duration:i,icon:c,className:"group-[.toaster]:bg-popover group-[.toaster]:text-popover-foreground group-[.toaster]:border-border",style:{minWidth:"320px",maxWidth:"420px"}},s&&{action:{label:s.label,onClick:s.onClick}}),a={[TOAST_VARIANT.SUCCESS]:()=>e.success(r||"Success",n),[TOAST_VARIANT.ERROR]:()=>e.error(r||"Error",n),[TOAST_VARIANT.WARNING]:()=>e.warning(r||"Warning",n),[TOAST_VARIANT.INFO]:()=>e.info(r||"Information",n)}[o];return a?a():e(r||t,n)},generateThemeToast=({variant:o,title:r,description:t,duration:i=4e3,action:s,theme:c="system"})=>{const n=h(o),l=c==="dark"?g.dark:g.light,a=Object.assign({description:t,duration:i,icon:n,className:`${l.className} toast-theme-${c}`,style:Object.assign(Object.assign({},l.style),{minWidth:"320px",maxWidth:"420px"})},s&&{action:{label:s.label,onClick:s.onClick}}),d={[TOAST_VARIANT.ERROR]:()=>e.error(r||"Error",a),[TOAST_VARIANT.INFO]:()=>e.info(r||"Information",a),[TOAST_VARIANT.SUCCESS]:()=>e.success(r||"Success",a),[TOAST_VARIANT.WARNING]:()=>e.warning(r||"Warning",a)}[o];return d?d():e(r||t,a)},showSuccessToast=(o,r)=>{generateToast({variant:TOAST_VARIANT.SUCCESS,title:r,description:o})},showErrorToast=(o,r)=>{generateToast({variant:TOAST_VARIANT.ERROR,title:r,description:o})},showWarningToast=(o,r)=>{generateToast({variant:TOAST_VARIANT.WARNING,title:r,description:o})},showInfoToast=(o,r)=>{generateToast({variant:TOAST_VARIANT.INFO,title:r,description:o})},showThemeSuccessToast=(o,r,t)=>{generateThemeToast({variant:TOAST_VARIANT.SUCCESS,title:r,description:o,theme:t})},showThemeErrorToast=(o,r,t)=>{generateThemeToast({variant:TOAST_VARIANT.ERROR,title:r,description:o,theme:t})},showThemeWarningToast=(o,r,t)=>{generateThemeToast({variant:TOAST_VARIANT.WARNING,title:r,description:o,theme:t})},showThemeInfoToast=(o,r,t)=>{generateThemeToast({variant:TOAST_VARIANT.INFO,title:r,description:o,theme:t})};
package/lib/utils.js CHANGED
@@ -1,5 +1 @@
1
- import { clsx } from "clsx";
2
- import { twMerge } from "tailwind-merge";
3
- export function cn(...inputs) {
4
- return twMerge(clsx(inputs));
5
- }
1
+ "use strict";import{clsx as o}from"clsx";import{twMerge as t}from"tailwind-merge";export function cn(...r){return t(o(r))}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appcorp/shadcn",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "license": "MIT",
5
5
  "author": "Taimoor Khan <taimoor.m.k@live.com>",
6
6
  "repository": "https://github.com/app-corp/shadcn",
@@ -33,7 +33,7 @@
33
33
  "@radix-ui/react-tabs": "^1",
34
34
  "@radix-ui/react-toggle": "^1",
35
35
  "@radix-ui/react-tooltip": "^1",
36
- "@react-pakistan/util-functions": "^2.0.2",
36
+ "@react-pakistan/util-functions": "^3.0.0",
37
37
  "class-variance-authority": "^0",
38
38
  "clsx": "^2",
39
39
  "cmdk": "^1",
@@ -1,7 +1 @@
1
- export const transformBreadcrumbs = (string) => {
2
- const items = string.split("/").filter(Boolean);
3
- return items.map((item) => ({
4
- label: item.charAt(0).toUpperCase() + item.slice(1).replace(/-/g, " "),
5
- href: "#",
6
- }));
7
- };
1
+ "use strict";export const transformBreadcrumbs=r=>r.split("/").filter(Boolean).map(e=>({label:e.charAt(0).toUpperCase()+e.slice(1).replace(/-/g," "),href:"#"}));
@@ -1,18 +1 @@
1
- /**
2
- * Updates navItems to set isActive based on current pathname
3
- * Checks both main nav URLs and subItem URLs for matches
4
- * Also marks individual subItems as active when their URL matches
5
- */
6
- export const transformNavItems = (navItems, pathname) => {
7
- return navItems.map((navItem) => {
8
- // Check if main nav item URL matches
9
- const isMainActive = navItem.url !== "#" && pathname === navItem.url;
10
- // Transform subItems to mark active ones
11
- const updatedSubItems = navItem.subItems.map((subItem) => {
12
- return Object.assign(Object.assign({}, subItem), { isActive: subItem.url !== "#" && pathname === subItem.url });
13
- });
14
- // Check if any subItem is active
15
- const hasActiveSubItem = updatedSubItems.some((subItem) => subItem.isActive);
16
- return Object.assign(Object.assign({}, navItem), { isActive: isMainActive || hasActiveSubItem, subItems: updatedSubItems });
17
- });
18
- };
1
+ "use strict";export const transformNavItems=(c,e)=>c.map(t=>{const r=t.url!=="#"&&e===t.url,i=t.subItems.map(s=>Object.assign(Object.assign({},s),{isActive:s.url!=="#"&&e===s.url})),u=i.some(s=>s.isActive);return Object.assign(Object.assign({},t),{isActive:r||u,subItems:i})});