@andreagiugni/tailwind-dashboard-ui 1.0.27 → 1.0.29
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 +1 -1
- package/dist/index.cjs +84 -65
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +26 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -267,6 +267,7 @@ interface CardProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "title">,
|
|
|
267
267
|
declare const Card: React.FC<CardProps>;
|
|
268
268
|
|
|
269
269
|
type ToastVariant = "success" | "danger" | "warning" | "info";
|
|
270
|
+
type ToastPosition = "left" | "center" | "right";
|
|
270
271
|
interface ToastProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "title">, ColorOverrideProps {
|
|
271
272
|
/** Color/severity variant. */
|
|
272
273
|
variant?: ToastVariant;
|
|
@@ -282,6 +283,10 @@ interface ToastProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "title">
|
|
|
282
283
|
onClose?: () => void;
|
|
283
284
|
/** Hide the colored accent bar at the bottom. */
|
|
284
285
|
hideAccentBar?: boolean;
|
|
286
|
+
/** Fixed bottom alignment. Default: `"right"`. */
|
|
287
|
+
position?: ToastPosition;
|
|
288
|
+
/** Auto-dismiss duration in milliseconds. Omit or pass `0` to keep visible. */
|
|
289
|
+
duration?: number;
|
|
285
290
|
}
|
|
286
291
|
declare const Toast: React.FC<ToastProps>;
|
|
287
292
|
|
|
@@ -682,4 +687,4 @@ interface SliderProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>,
|
|
|
682
687
|
}
|
|
683
688
|
declare const Slider: React.FC<SliderProps>;
|
|
684
689
|
|
|
685
|
-
export { Accordion, AccordionItem, type AccordionItemProps, type AccordionProps, type AccordionSelectionMode, Alert, type AlertProps, type AlertVariant, Avatar, type AvatarProps, type AvatarSize, type AvatarStatus, AvatarText, type AvatarTextProps, Badge, type BadgeColor, type BadgeProps, type BadgeSize, type BadgeVariant, Breadcrumb, type BreadcrumbItem, type BreadcrumbProps, Button, type ButtonProps, Card, type CardProps, Checkbox, type CheckboxProps, Chip, type ChipColor, type ChipProps, type ChipSize, type ChipVariant, Code, type CodeColor, type CodeProps, type CodeSize, ColorOverrideProps, DatePicker, type DatePickerProps, DateTimePicker, type DateTimePickerProps, Drawer, type DrawerPlacement, type DrawerProps, Dropdown, DropdownItem, type DropdownItemProps, type DropdownItemVariant, type DropdownProps, Dropzone, type DropzoneProps, FileInput, type FileInputProps, Form, type FormProps, Input, type InputProps, Label, type LabelProps, Modal, type ModalProps, type ModalVariant, MultiSelect, type MultiSelectProps, Pagination, type PaginationAlign, type PaginationProps, PasswordInput, type PasswordInputProps, PollResults, type PollResultsColor, type PollResultsOption, type PollResultsProps, type PollResultsSeries, type PollResultsSize, type PollResultsTextColor, type PollResultsTextSize, type PollResultsTextWeight, Popover, type PopoverPlacement, type PopoverProps, Progress, type ProgressColor, type ProgressProps, type ProgressSize, Radio, type RadioProps, RadioSm, type RadioSmProps, Ribbon, type RibbonColor, type RibbonPosition, type RibbonProps, type RibbonVariant, Select, type SelectOption, type SelectProps, Skeleton, type SkeletonProps, Slider, type SliderColor, type SliderProps, Snippet, type SnippetProps, type SnippetSize, type SortDirection, Spinner, type SpinnerColor, type SpinnerProps, type SpinnerSize, Switch, type SwitchProps, Tab, type TabProps, Table, TableBody, TableCell, type TableCellProps, type TableColumn, TableHeader, type TableProps, TableRow, type TableRowProps, type TableSectionProps, Tabs, type TabsProps, type TabsVariant, TextArea, type TextAreaProps, ThemeToggleButton, type ThemeToggleButtonProps, Toast, type ToastProps, type ToastVariant, Tooltip, type TooltipPlacement, type TooltipProps, cn };
|
|
690
|
+
export { Accordion, AccordionItem, type AccordionItemProps, type AccordionProps, type AccordionSelectionMode, Alert, type AlertProps, type AlertVariant, Avatar, type AvatarProps, type AvatarSize, type AvatarStatus, AvatarText, type AvatarTextProps, Badge, type BadgeColor, type BadgeProps, type BadgeSize, type BadgeVariant, Breadcrumb, type BreadcrumbItem, type BreadcrumbProps, Button, type ButtonProps, Card, type CardProps, Checkbox, type CheckboxProps, Chip, type ChipColor, type ChipProps, type ChipSize, type ChipVariant, Code, type CodeColor, type CodeProps, type CodeSize, ColorOverrideProps, DatePicker, type DatePickerProps, DateTimePicker, type DateTimePickerProps, Drawer, type DrawerPlacement, type DrawerProps, Dropdown, DropdownItem, type DropdownItemProps, type DropdownItemVariant, type DropdownProps, Dropzone, type DropzoneProps, FileInput, type FileInputProps, Form, type FormProps, Input, type InputProps, Label, type LabelProps, Modal, type ModalProps, type ModalVariant, MultiSelect, type MultiSelectProps, Pagination, type PaginationAlign, type PaginationProps, PasswordInput, type PasswordInputProps, PollResults, type PollResultsColor, type PollResultsOption, type PollResultsProps, type PollResultsSeries, type PollResultsSize, type PollResultsTextColor, type PollResultsTextSize, type PollResultsTextWeight, Popover, type PopoverPlacement, type PopoverProps, Progress, type ProgressColor, type ProgressProps, type ProgressSize, Radio, type RadioProps, RadioSm, type RadioSmProps, Ribbon, type RibbonColor, type RibbonPosition, type RibbonProps, type RibbonVariant, Select, type SelectOption, type SelectProps, Skeleton, type SkeletonProps, Slider, type SliderColor, type SliderProps, Snippet, type SnippetProps, type SnippetSize, type SortDirection, Spinner, type SpinnerColor, type SpinnerProps, type SpinnerSize, Switch, type SwitchProps, Tab, type TabProps, Table, TableBody, TableCell, type TableCellProps, type TableColumn, TableHeader, type TableProps, TableRow, type TableRowProps, type TableSectionProps, Tabs, type TabsProps, type TabsVariant, TextArea, type TextAreaProps, ThemeToggleButton, type ThemeToggleButtonProps, Toast, type ToastPosition, type ToastProps, type ToastVariant, Tooltip, type TooltipPlacement, type TooltipProps, cn };
|
package/dist/index.d.ts
CHANGED
|
@@ -267,6 +267,7 @@ interface CardProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "title">,
|
|
|
267
267
|
declare const Card: React.FC<CardProps>;
|
|
268
268
|
|
|
269
269
|
type ToastVariant = "success" | "danger" | "warning" | "info";
|
|
270
|
+
type ToastPosition = "left" | "center" | "right";
|
|
270
271
|
interface ToastProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "title">, ColorOverrideProps {
|
|
271
272
|
/** Color/severity variant. */
|
|
272
273
|
variant?: ToastVariant;
|
|
@@ -282,6 +283,10 @@ interface ToastProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "title">
|
|
|
282
283
|
onClose?: () => void;
|
|
283
284
|
/** Hide the colored accent bar at the bottom. */
|
|
284
285
|
hideAccentBar?: boolean;
|
|
286
|
+
/** Fixed bottom alignment. Default: `"right"`. */
|
|
287
|
+
position?: ToastPosition;
|
|
288
|
+
/** Auto-dismiss duration in milliseconds. Omit or pass `0` to keep visible. */
|
|
289
|
+
duration?: number;
|
|
285
290
|
}
|
|
286
291
|
declare const Toast: React.FC<ToastProps>;
|
|
287
292
|
|
|
@@ -682,4 +687,4 @@ interface SliderProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>,
|
|
|
682
687
|
}
|
|
683
688
|
declare const Slider: React.FC<SliderProps>;
|
|
684
689
|
|
|
685
|
-
export { Accordion, AccordionItem, type AccordionItemProps, type AccordionProps, type AccordionSelectionMode, Alert, type AlertProps, type AlertVariant, Avatar, type AvatarProps, type AvatarSize, type AvatarStatus, AvatarText, type AvatarTextProps, Badge, type BadgeColor, type BadgeProps, type BadgeSize, type BadgeVariant, Breadcrumb, type BreadcrumbItem, type BreadcrumbProps, Button, type ButtonProps, Card, type CardProps, Checkbox, type CheckboxProps, Chip, type ChipColor, type ChipProps, type ChipSize, type ChipVariant, Code, type CodeColor, type CodeProps, type CodeSize, ColorOverrideProps, DatePicker, type DatePickerProps, DateTimePicker, type DateTimePickerProps, Drawer, type DrawerPlacement, type DrawerProps, Dropdown, DropdownItem, type DropdownItemProps, type DropdownItemVariant, type DropdownProps, Dropzone, type DropzoneProps, FileInput, type FileInputProps, Form, type FormProps, Input, type InputProps, Label, type LabelProps, Modal, type ModalProps, type ModalVariant, MultiSelect, type MultiSelectProps, Pagination, type PaginationAlign, type PaginationProps, PasswordInput, type PasswordInputProps, PollResults, type PollResultsColor, type PollResultsOption, type PollResultsProps, type PollResultsSeries, type PollResultsSize, type PollResultsTextColor, type PollResultsTextSize, type PollResultsTextWeight, Popover, type PopoverPlacement, type PopoverProps, Progress, type ProgressColor, type ProgressProps, type ProgressSize, Radio, type RadioProps, RadioSm, type RadioSmProps, Ribbon, type RibbonColor, type RibbonPosition, type RibbonProps, type RibbonVariant, Select, type SelectOption, type SelectProps, Skeleton, type SkeletonProps, Slider, type SliderColor, type SliderProps, Snippet, type SnippetProps, type SnippetSize, type SortDirection, Spinner, type SpinnerColor, type SpinnerProps, type SpinnerSize, Switch, type SwitchProps, Tab, type TabProps, Table, TableBody, TableCell, type TableCellProps, type TableColumn, TableHeader, type TableProps, TableRow, type TableRowProps, type TableSectionProps, Tabs, type TabsProps, type TabsVariant, TextArea, type TextAreaProps, ThemeToggleButton, type ThemeToggleButtonProps, Toast, type ToastProps, type ToastVariant, Tooltip, type TooltipPlacement, type TooltipProps, cn };
|
|
690
|
+
export { Accordion, AccordionItem, type AccordionItemProps, type AccordionProps, type AccordionSelectionMode, Alert, type AlertProps, type AlertVariant, Avatar, type AvatarProps, type AvatarSize, type AvatarStatus, AvatarText, type AvatarTextProps, Badge, type BadgeColor, type BadgeProps, type BadgeSize, type BadgeVariant, Breadcrumb, type BreadcrumbItem, type BreadcrumbProps, Button, type ButtonProps, Card, type CardProps, Checkbox, type CheckboxProps, Chip, type ChipColor, type ChipProps, type ChipSize, type ChipVariant, Code, type CodeColor, type CodeProps, type CodeSize, ColorOverrideProps, DatePicker, type DatePickerProps, DateTimePicker, type DateTimePickerProps, Drawer, type DrawerPlacement, type DrawerProps, Dropdown, DropdownItem, type DropdownItemProps, type DropdownItemVariant, type DropdownProps, Dropzone, type DropzoneProps, FileInput, type FileInputProps, Form, type FormProps, Input, type InputProps, Label, type LabelProps, Modal, type ModalProps, type ModalVariant, MultiSelect, type MultiSelectProps, Pagination, type PaginationAlign, type PaginationProps, PasswordInput, type PasswordInputProps, PollResults, type PollResultsColor, type PollResultsOption, type PollResultsProps, type PollResultsSeries, type PollResultsSize, type PollResultsTextColor, type PollResultsTextSize, type PollResultsTextWeight, Popover, type PopoverPlacement, type PopoverProps, Progress, type ProgressColor, type ProgressProps, type ProgressSize, Radio, type RadioProps, RadioSm, type RadioSmProps, Ribbon, type RibbonColor, type RibbonPosition, type RibbonProps, type RibbonVariant, Select, type SelectOption, type SelectProps, Skeleton, type SkeletonProps, Slider, type SliderColor, type SliderProps, Snippet, type SnippetProps, type SnippetSize, type SortDirection, Spinner, type SpinnerColor, type SpinnerProps, type SpinnerSize, Switch, type SwitchProps, Tab, type TabProps, Table, TableBody, TableCell, type TableCellProps, type TableColumn, TableHeader, type TableProps, TableRow, type TableRowProps, type TableSectionProps, Tabs, type TabsProps, type TabsVariant, TextArea, type TextAreaProps, ThemeToggleButton, type ThemeToggleButtonProps, Toast, type ToastPosition, type ToastProps, type ToastVariant, Tooltip, type TooltipPlacement, type TooltipProps, cn };
|
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import { cn } from './chunk-ZLIYUUA4.js';
|
|
|
9
9
|
export { cn } from './chunk-ZLIYUUA4.js';
|
|
10
10
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
11
11
|
import { Info, CircleAlert, CircleX, CircleCheck, Upload, Sun, Moon, X, Check, Copy, ChevronDown, Calendar, Clock, Eye, EyeOff, ChevronRight, ChevronUp } from 'lucide-react';
|
|
12
|
-
import
|
|
12
|
+
import React6, { useRef, useState, useEffect, useLayoutEffect, useCallback, useId, useMemo } from 'react';
|
|
13
13
|
import { createPortal } from 'react-dom';
|
|
14
14
|
import flatpickr from 'flatpickr';
|
|
15
15
|
import 'flatpickr/dist/flatpickr.css';
|
|
@@ -1096,6 +1096,11 @@ var variantIcons2 = {
|
|
|
1096
1096
|
warning: CircleAlert,
|
|
1097
1097
|
info: Info
|
|
1098
1098
|
};
|
|
1099
|
+
var positionStyles = {
|
|
1100
|
+
left: "bottom-6 left-4 right-4 sm:left-6 sm:right-auto sm:w-full",
|
|
1101
|
+
center: "bottom-6 left-1/2 w-[calc(100%-2rem)] -translate-x-1/2 sm:w-full",
|
|
1102
|
+
right: "bottom-6 left-4 right-4 sm:left-auto sm:right-6 sm:w-full"
|
|
1103
|
+
};
|
|
1099
1104
|
var Toast = ({
|
|
1100
1105
|
variant = "success",
|
|
1101
1106
|
title,
|
|
@@ -1105,6 +1110,8 @@ var Toast = ({
|
|
|
1105
1110
|
showCloseButton = true,
|
|
1106
1111
|
onClose,
|
|
1107
1112
|
hideAccentBar = false,
|
|
1113
|
+
position = "right",
|
|
1114
|
+
duration,
|
|
1108
1115
|
className,
|
|
1109
1116
|
bgColor,
|
|
1110
1117
|
textColor,
|
|
@@ -1114,12 +1121,24 @@ var Toast = ({
|
|
|
1114
1121
|
}) => {
|
|
1115
1122
|
const styles = variantStyles[variant];
|
|
1116
1123
|
const Icon = variantIcons2[variant];
|
|
1124
|
+
const [isVisible, setIsVisible] = useState(true);
|
|
1125
|
+
const handleClose = useCallback(() => {
|
|
1126
|
+
setIsVisible(false);
|
|
1127
|
+
onClose?.();
|
|
1128
|
+
}, [onClose]);
|
|
1129
|
+
useEffect(() => {
|
|
1130
|
+
if (!duration || duration <= 0) return;
|
|
1131
|
+
const timer = window.setTimeout(handleClose, duration);
|
|
1132
|
+
return () => window.clearTimeout(timer);
|
|
1133
|
+
}, [duration, handleClose]);
|
|
1134
|
+
if (!isVisible) return null;
|
|
1117
1135
|
return /* @__PURE__ */ jsxs(
|
|
1118
1136
|
"div",
|
|
1119
1137
|
{
|
|
1120
1138
|
role: "alert",
|
|
1121
1139
|
className: cn(
|
|
1122
|
-
"
|
|
1140
|
+
"fixed z-9999 flex max-w-md items-center gap-3 overflow-hidden rounded-xl border border-gray-200 bg-white px-4 py-3.5 pr-10 shadow-theme-sm dark:border-gray-800 dark:bg-gray-900",
|
|
1141
|
+
positionStyles[position],
|
|
1123
1142
|
className
|
|
1124
1143
|
),
|
|
1125
1144
|
style: { ...styleOverride({ bgColor, textColor, borderColor }), ...style },
|
|
@@ -1144,7 +1163,7 @@ var Toast = ({
|
|
|
1144
1163
|
{
|
|
1145
1164
|
type: "button",
|
|
1146
1165
|
"aria-label": "Close",
|
|
1147
|
-
onClick:
|
|
1166
|
+
onClick: handleClose,
|
|
1148
1167
|
className: "absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 transition hover:text-gray-700 dark:hover:text-gray-200",
|
|
1149
1168
|
children: /* @__PURE__ */ jsx(X, { className: "size-4", "aria-hidden": "true" })
|
|
1150
1169
|
}
|
|
@@ -1160,7 +1179,7 @@ var Toast = ({
|
|
|
1160
1179
|
}
|
|
1161
1180
|
);
|
|
1162
1181
|
};
|
|
1163
|
-
var AccordionContext =
|
|
1182
|
+
var AccordionContext = React6.createContext(null);
|
|
1164
1183
|
var ChevronIcon2 = ({ open }) => /* @__PURE__ */ jsx(
|
|
1165
1184
|
ChevronDown,
|
|
1166
1185
|
{
|
|
@@ -1180,7 +1199,7 @@ var AccordionItem = ({
|
|
|
1180
1199
|
className,
|
|
1181
1200
|
...rest
|
|
1182
1201
|
}) => {
|
|
1183
|
-
const ctx =
|
|
1202
|
+
const ctx = React6.useContext(AccordionContext);
|
|
1184
1203
|
if (!ctx) {
|
|
1185
1204
|
throw new Error("AccordionItem must be used within an Accordion");
|
|
1186
1205
|
}
|
|
@@ -1292,8 +1311,8 @@ var Tabs = ({
|
|
|
1292
1311
|
className,
|
|
1293
1312
|
...rest
|
|
1294
1313
|
}) => {
|
|
1295
|
-
const tabs =
|
|
1296
|
-
|
|
1314
|
+
const tabs = React6.Children.toArray(children).filter(
|
|
1315
|
+
React6.isValidElement
|
|
1297
1316
|
);
|
|
1298
1317
|
const firstKey = tabs[0]?.props.tabKey;
|
|
1299
1318
|
const isControlled = selectedKey !== void 0;
|