tw-react-components 0.0.159 → 0.0.161
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/index.esm.js +32 -32
- package/package.json +1 -1
package/index.esm.js
CHANGED
|
@@ -557,19 +557,19 @@ const variantClassNames = {
|
|
|
557
557
|
};
|
|
558
558
|
const sizeClassNames = {
|
|
559
559
|
small: {
|
|
560
|
-
base: 'gap-1
|
|
561
|
-
withChildren: 'px-
|
|
560
|
+
base: 'gap-1 text-sm h-6',
|
|
561
|
+
withChildren: 'px-1.5',
|
|
562
562
|
icon: {
|
|
563
|
-
base: 'h-
|
|
564
|
-
withChildren: 'h-
|
|
563
|
+
base: 'h-3 w-3',
|
|
564
|
+
withChildren: 'h-2 w-2',
|
|
565
565
|
},
|
|
566
566
|
},
|
|
567
567
|
medium: {
|
|
568
|
-
base: 'gap-
|
|
569
|
-
withChildren: 'px-2
|
|
568
|
+
base: 'gap-1.5 text-base h-9',
|
|
569
|
+
withChildren: 'px-2',
|
|
570
570
|
icon: {
|
|
571
|
-
base: 'h-
|
|
572
|
-
withChildren: 'h-
|
|
571
|
+
base: 'h-4 w-4',
|
|
572
|
+
withChildren: 'h-3 w-3',
|
|
573
573
|
},
|
|
574
574
|
},
|
|
575
575
|
};
|
|
@@ -594,7 +594,7 @@ const Block = forwardRef((_a, ref) => {
|
|
|
594
594
|
|
|
595
595
|
const Card = forwardRef((_a, ref) => {
|
|
596
596
|
var { children, className } = _a, blockProps = __rest(_a, ["children", "className"]);
|
|
597
|
-
return (jsx(Block, Object.assign({ className: cn('rounded-lg border p-
|
|
597
|
+
return (jsx(Block, Object.assign({ className: cn('rounded-lg border p-2 dark:border-slate-700 dark:bg-slate-900', className) }, blockProps, { ref: ref, children: children })));
|
|
598
598
|
});
|
|
599
599
|
|
|
600
600
|
const $Collapsible = CollapsiblePrimitive.Root;
|
|
@@ -628,7 +628,7 @@ const justifyClasses = {
|
|
|
628
628
|
};
|
|
629
629
|
const Flex = forwardRef((_a, ref) => {
|
|
630
630
|
var { children, className, reverse, wrap, direction = 'row', align = 'start', justify = 'start' } = _a, blockProps = __rest(_a, ["children", "className", "reverse", "wrap", "direction", "align", "justify"]);
|
|
631
|
-
return (jsx(Block, Object.assign({ className: cn('flex gap-
|
|
631
|
+
return (jsx(Block, Object.assign({ className: cn('flex gap-2', wrap && 'flex-wrap', directionClasses[direction][reverse ? 'reverse' : 'normal'], alignClasses[align], justifyClasses[justify], className) }, blockProps, { ref: ref, children: children })));
|
|
632
632
|
});
|
|
633
633
|
|
|
634
634
|
dayjs.extend(localeData);
|
|
@@ -804,35 +804,35 @@ const inputClasses = {
|
|
|
804
804
|
};
|
|
805
805
|
const sizeClasses = {
|
|
806
806
|
small: {
|
|
807
|
-
label: 'text-
|
|
808
|
-
input: 'text-
|
|
807
|
+
label: 'text-xs',
|
|
808
|
+
input: 'text-xs py-1 px-2 h-6',
|
|
809
809
|
checkbox: {
|
|
810
|
-
input: 'w-
|
|
810
|
+
input: 'w-3 h-3',
|
|
811
811
|
wrapper: 'h-6 gap-1',
|
|
812
812
|
},
|
|
813
813
|
suffix: {
|
|
814
|
-
wrapper: 'h-
|
|
815
|
-
icon: 'h-
|
|
814
|
+
wrapper: 'h-6',
|
|
815
|
+
icon: 'h-3 w-3 mx-1.5',
|
|
816
816
|
},
|
|
817
817
|
clearButton: {
|
|
818
|
-
base: 'h-
|
|
818
|
+
base: 'h-4 w-4',
|
|
819
819
|
withSuffixIcon: 'right-8',
|
|
820
820
|
},
|
|
821
821
|
},
|
|
822
822
|
medium: {
|
|
823
|
-
label: 'text-
|
|
824
|
-
input: 'text-
|
|
823
|
+
label: 'text-sm',
|
|
824
|
+
input: 'text-sm py-2 px-3 h-9',
|
|
825
825
|
checkbox: {
|
|
826
|
-
input: 'w-
|
|
826
|
+
input: 'w-4 h-4',
|
|
827
827
|
wrapper: 'h-8 gap-2',
|
|
828
828
|
},
|
|
829
829
|
suffix: {
|
|
830
|
-
wrapper: 'h-
|
|
831
|
-
icon: 'w-
|
|
830
|
+
wrapper: 'h-9',
|
|
831
|
+
icon: 'w-4 h-4 mx-2',
|
|
832
832
|
},
|
|
833
833
|
clearButton: {
|
|
834
|
-
base: 'h-
|
|
835
|
-
withSuffixIcon: 'right-
|
|
834
|
+
base: 'h-5 w-5',
|
|
835
|
+
withSuffixIcon: 'right-9',
|
|
836
836
|
},
|
|
837
837
|
},
|
|
838
838
|
};
|
|
@@ -879,7 +879,7 @@ const EmailInput = forwardRef((props, ref) => (jsx(BasicInput, Object.assign({ t
|
|
|
879
879
|
|
|
880
880
|
const NumberInput = forwardRef((_a, ref) => {
|
|
881
881
|
var { unit } = _a, props = __rest(_a, ["unit"]);
|
|
882
|
-
return (jsx(BasicInput, Object.assign({ type: "number" }, props, { suffixIcon: unit
|
|
882
|
+
return (jsx(BasicInput, Object.assign({ type: "number", inputClassName: cn(props.clearable && !!props.value && 'pr-8', props.className) }, props, { suffixIcon: unit
|
|
883
883
|
? ({ className }) => (jsx("div", { className: cn(className, 'flex w-min items-center'), onClick: props.onSuffixIconClick, children: unit }))
|
|
884
884
|
: props.suffixIcon, ref: ref })));
|
|
885
885
|
});
|
|
@@ -1383,14 +1383,14 @@ const HintRoot = forwardRef(({ children }, ref) => (jsx(Block, { className: "rel
|
|
|
1383
1383
|
HintRoot.displayName = 'HintRoot';
|
|
1384
1384
|
const dotSizeClassNames = {
|
|
1385
1385
|
small: {
|
|
1386
|
-
base: 'h-
|
|
1386
|
+
base: 'h-1.5 w-1.5',
|
|
1387
1387
|
top: '-top-0.5',
|
|
1388
1388
|
right: '-right-0.5',
|
|
1389
1389
|
bottom: '-bottom-0.5',
|
|
1390
1390
|
left: '-left-0.5',
|
|
1391
1391
|
},
|
|
1392
1392
|
medium: {
|
|
1393
|
-
base: 'h-
|
|
1393
|
+
base: 'h-2.5 w-2.5',
|
|
1394
1394
|
top: '-top-1',
|
|
1395
1395
|
right: '-right-1',
|
|
1396
1396
|
bottom: '-bottom-1',
|
|
@@ -1441,7 +1441,7 @@ const badgeSizeClassNames = {
|
|
|
1441
1441
|
};
|
|
1442
1442
|
const HintBadge = forwardRef((_a, ref) => {
|
|
1443
1443
|
var { className, size = 'small', placement = 'top-right' } = _a, props = __rest(_a, ["className", "size", "placement"]);
|
|
1444
|
-
return (jsx(Badge, Object.assign({ className: cn('absolute px-1', size === 'small' ? 'h-
|
|
1444
|
+
return (jsx(Badge, Object.assign({ className: cn('absolute z-10 px-1', size === 'small' ? 'h-4' : 'h-5', {
|
|
1445
1445
|
[`${badgeSizeClassNames.top} ${badgeSizeClassNames.left}`]: placement === 'top-left',
|
|
1446
1446
|
[`${badgeSizeClassNames.top} ${badgeSizeClassNames.right}`]: placement === 'top-right',
|
|
1447
1447
|
[`${badgeSizeClassNames.bottom} ${badgeSizeClassNames.right}`]: placement === 'bottom-right',
|
|
@@ -1457,13 +1457,13 @@ const Pagination = ({ disabled, pageSize = 10, currentPage, totalItems, setCurre
|
|
|
1457
1457
|
useEffect(() => {
|
|
1458
1458
|
setCurrentPage((page) => Math.min(page, Math.max(0, totalPages - 1)));
|
|
1459
1459
|
}, [setCurrentPage, totalPages]);
|
|
1460
|
-
return (jsx(Flex, { justify: "end", children: jsxs(Flex, { className: "h-
|
|
1460
|
+
return (jsx(Flex, { justify: "end", children: jsxs(Flex, { className: "h-9 gap-0 divide-x rounded-md border border-slate-300 bg-white dark:divide-slate-700 dark:border-slate-700 dark:bg-slate-800", children: [jsx(PaginationItem, { title: "First page", onClick: () => setCurrentPage(0), disabled: !currentPage || disabled, children: jsx(ChevronsLeftIcon, { className: "h-4 w-4" }) }), jsx(PaginationItem, { title: "Previous page", onClick: () => currentPage && setCurrentPage(currentPage - 1), disabled: !currentPage || disabled, children: jsx(ChevronLeftIcon, { className: "h-4 w-4" }) }), pagination.map((page, index) => (jsx(PaginationItem, { active: page !== '...' && page - 1 === currentPage, title: page !== '...' ? `Page ${page}` : undefined, onClick: page !== '...' ? () => setCurrentPage(page - 1) : undefined, disabled: page === '...' || disabled, children: page }, index))), jsx(PaginationItem, { title: "Next page", onClick: () => currentPage + 1 < totalPages && setCurrentPage(currentPage + 1), disabled: currentPage + 1 === totalPages || disabled, children: jsx(ChevronRightIcon, { className: "h-4 w-4" }) }), jsx(PaginationItem, { title: "Last page", onClick: () => setCurrentPage(Math.floor(totalItems && !(totalItems % pageSize)
|
|
1461
1461
|
? (totalItems - 1) / pageSize
|
|
1462
|
-
: totalItems / pageSize)), disabled: currentPage + 1 === totalPages || disabled, children: jsx(ChevronsRightIcon, { className: "h-
|
|
1462
|
+
: totalItems / pageSize)), disabled: currentPage + 1 === totalPages || disabled, children: jsx(ChevronsRightIcon, { className: "h-4 w-4" }) })] }) }));
|
|
1463
1463
|
};
|
|
1464
1464
|
const PaginationItem = (_a) => {
|
|
1465
1465
|
var { children, active, disabled } = _a, props = __rest(_a, ["children", "active", "disabled"]);
|
|
1466
|
-
return (jsx(Flex, Object.assign({ className: cn('w-
|
|
1466
|
+
return (jsx(Flex, Object.assign({ className: cn('w-9 text-sm first:rounded-l-md last:rounded-r-md', {
|
|
1467
1467
|
'text-slate-400 dark:text-slate-500': disabled,
|
|
1468
1468
|
'bg-slate-100 dark:bg-slate-900': active,
|
|
1469
1469
|
'cursor-pointer hover:bg-slate-200 dark:hover:bg-slate-900': !disabled && props.onClick,
|
|
@@ -1721,7 +1721,7 @@ const FormDialog = ({ className, formClassName, open, title, form, children, sub
|
|
|
1721
1721
|
// do nothering
|
|
1722
1722
|
}
|
|
1723
1723
|
});
|
|
1724
|
-
return (jsx(As, { open: open, onOpenChange: (value) => !value && onClose(), children: jsxs(As.Content, { className: className, children: [jsx(As.Header, { children: jsx(As.Title, { children: title }) }), jsx(FormProvider, Object.assign({}, form, { children: jsx("form", { id: `form-${id}`, className: cn('flex h-full w-full flex-col gap-
|
|
1724
|
+
return (jsx(As, { open: open, onOpenChange: (value) => !value && onClose(), children: jsxs(As.Content, { className: className, children: [jsx(As.Header, { children: jsx(As.Title, { children: title }) }), jsx(FormProvider, Object.assign({}, form, { children: jsx("form", { id: `form-${id}`, className: cn('flex h-full w-full flex-col gap-2 overflow-auto', formClassName), onSubmit: form.handleSubmit(handleSubmit, onInvalid), children: children }) })), jsxs(As.Footer, { className: "w-full sm:justify-between", children: [extraAction, jsxs(As.Footer, { className: "ml-auto", children: [jsx(As.Close, { asChild: true, children: jsx(Button, { color: "red", children: cancelLabel }) }), jsx(Button, { color: "green", type: "submit", form: `form-${id}`, disabled: form.formState.isSubmitting, children: submitLabel })] })] })] }) }));
|
|
1725
1725
|
};
|
|
1726
1726
|
|
|
1727
1727
|
function ListSorter({ className, items, idResolver, renderer, onChange, }) {
|
|
@@ -2041,7 +2041,7 @@ const Sidebar = Object.assign($Sidebar, {
|
|
|
2041
2041
|
Trigger: SidebarTrigger,
|
|
2042
2042
|
});
|
|
2043
2043
|
|
|
2044
|
-
const Navbar = ({ className, sidebarTriggerClassName, leftSlot, rightSlot, }) => (jsx(Block, { className: cn('border-b p-
|
|
2044
|
+
const Navbar = ({ className, sidebarTriggerClassName, leftSlot, rightSlot, }) => (jsx(Block, { className: cn('border-b p-2 dark:border-slate-700', className), fullWidth: true, children: jsxs(Flex, { align: "center", justify: "between", children: [jsxs(Flex, { align: "center", children: [jsx(Sidebar.Trigger, { className: sidebarTriggerClassName }), leftSlot] }), rightSlot] }) }));
|
|
2045
2045
|
|
|
2046
2046
|
const Layout = (_a) => {
|
|
2047
2047
|
var { children, className } = _a, _b = _a.sidebarProps, { basePath, header, items, extraContent, footer } = _b, sidebarProps = __rest(_b, ["basePath", "header", "items", "extraContent", "footer"]), { navbarProps, NavLink, useLocation } = _a;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tw-react-components",
|
|
3
3
|
"description": "A set of React components build with TailwindCSS to make a nice dashboard.",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.161",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://bacali95.github.io/tw-react-components",
|
|
7
7
|
"type": "module",
|