@pk-design/react-tailwind 1.1.3 → 1.1.5
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/dist/react-tailwind.cjs.js +29 -16
- package/dist/react-tailwind.cjs.js.map +1 -1
- package/dist/react-tailwind.es.js +29 -17
- package/dist/react-tailwind.es.js.map +1 -1
- package/dist/types/components/Card/Card.types.d.ts +5 -0
- package/dist/types/hooks/use-is-tablet-or-mobile.d.ts +1 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -364,14 +364,14 @@ const Breadcrumb = ({ items, render }) => {
|
|
|
364
364
|
};
|
|
365
365
|
Breadcrumb.displayName = 'Breadcrumb';
|
|
366
366
|
|
|
367
|
-
const BASE_CARD_CLASS = 'bg-white rounded-md dark:bg-gray-900 block
|
|
367
|
+
const BASE_CARD_CLASS = 'bg-white rounded-md dark:bg-gray-900 block';
|
|
368
368
|
const Card = React.forwardRef(({ as, ...props }, ref) => {
|
|
369
369
|
// Remove Card-only props from rest (avoid leaking to DOM)
|
|
370
|
-
const { hoverable = false, bordered = true, compact = false, ...rest } = props;
|
|
370
|
+
const { hoverable = false, bordered = true, compact = false, zeroPadding = false, ...rest } = props;
|
|
371
371
|
const Component = as || 'div';
|
|
372
372
|
// Extract className safely from rest
|
|
373
373
|
const { className, ...cleanRest } = rest;
|
|
374
|
-
const classes = buildClassName(BASE_CARD_CLASS, compact ? 'p-2' : 'p-6', hoverable && 'transition-background duration-200 hover:bg-gray-100 dark:hover:bg-gray-800', bordered && 'border border-gray-200 dark:border-gray-800', className);
|
|
374
|
+
const classes = buildClassName(BASE_CARD_CLASS, zeroPadding ? '' : compact ? 'p-2' : 'p-6', hoverable && 'transition-background duration-200 hover:bg-gray-100 dark:hover:bg-gray-800', bordered && 'border border-gray-200 dark:border-gray-800', className);
|
|
375
375
|
return jsxRuntime.jsx(Component, { ref: ref, className: classes, ...cleanRest });
|
|
376
376
|
});
|
|
377
377
|
Card.displayName = 'Card';
|
|
@@ -871,7 +871,7 @@ const Input = React.forwardRef((props, ref) => {
|
|
|
871
871
|
const hasError = Boolean(error);
|
|
872
872
|
const hasRightGroup = rightGroup !== null && rightGroup !== undefined;
|
|
873
873
|
const hasLeftGroup = leftGroup != null && leftGroup !== undefined;
|
|
874
|
-
return (jsxRuntime.jsxs("div", { className: buildClassName('group', hasError && 'has-error', containerClass), children: [label && (jsxRuntime.jsxs("div", { className: buildClassName('flex items-center justify-between mb-2', labelWrapperClass), children: [jsxRuntime.jsx(Label, { className: labelClass, htmlFor: id, children: label }), labelHint] })), jsxRuntime.jsxs("div", { className: "relative", children: [hasLeftGroup && (jsxRuntime.jsx("span", { className: "absolute top-0 h-full flex items-center justify-center w-10", children: leftGroup })), jsxRuntime.jsx("input", { ref: ref, autoComplete: "off", ...inputProps, name: name, id: id, type: type, className: buildClassName(buildInputClass(className), hasRightGroup ? 'pe-10' : '', hasLeftGroup ? 'ps-10' : '') }), hasRightGroup && (jsxRuntime.jsx("span", { className: "absolute end-0.75 top-0 h-full flex items-center justify-center w-10", children: rightGroup }))] }), showErrorMessage && error && (jsxRuntime.jsx("div", { className: "mt-1", children: jsxRuntime.jsx(TextContent, { error: true, small: true, children: error }) }))] }));
|
|
874
|
+
return (jsxRuntime.jsxs("div", { className: buildClassName('group', hasError && 'has-error', containerClass), children: [label && (jsxRuntime.jsxs("div", { className: buildClassName('flex items-center justify-between mb-2', labelWrapperClass), children: [jsxRuntime.jsx(Label, { className: labelClass, htmlFor: id, children: label }), labelHint] })), jsxRuntime.jsxs("div", { className: "relative", children: [hasLeftGroup && (jsxRuntime.jsx("span", { className: "absolute top-0 h-full flex items-center justify-center w-10", children: leftGroup })), jsxRuntime.jsx("input", { ref: ref, autoComplete: "off", ...inputProps, name: name, id: id, type: type, className: buildClassName(buildInputClass(className, { disabled: inputProps.disabled }), hasRightGroup ? 'pe-10' : '', hasLeftGroup ? 'ps-10' : '') }), hasRightGroup && (jsxRuntime.jsx("span", { className: "absolute end-0.75 top-0 h-full flex items-center justify-center w-10", children: rightGroup }))] }), showErrorMessage && error && (jsxRuntime.jsx("div", { className: "mt-1", children: jsxRuntime.jsx(TextContent, { error: true, small: true, children: error }) }))] }));
|
|
875
875
|
});
|
|
876
876
|
Input.displayName = 'Input';
|
|
877
877
|
|
|
@@ -2085,29 +2085,41 @@ const VirtualizedDataTable = ({ items, columns, sorting = {}, onSort, loading =
|
|
|
2085
2085
|
};
|
|
2086
2086
|
|
|
2087
2087
|
const useIsMobile = () => {
|
|
2088
|
-
const [isMobile, setIsMobile] = React.useState(
|
|
2088
|
+
const [isMobile, setIsMobile] = React.useState(false);
|
|
2089
2089
|
React.useEffect(() => {
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2090
|
+
const detect = () => {
|
|
2091
|
+
const width = window.innerWidth;
|
|
2092
|
+
const isTouch = navigator.maxTouchPoints > 1 || window.matchMedia('(pointer: coarse)').matches;
|
|
2093
|
+
setIsMobile(width < 600 && isTouch);
|
|
2094
|
+
};
|
|
2095
|
+
detect();
|
|
2096
|
+
window.addEventListener('resize', detect);
|
|
2097
|
+
return () => window.removeEventListener('resize', detect);
|
|
2095
2098
|
}, []);
|
|
2096
2099
|
return isMobile;
|
|
2097
2100
|
};
|
|
2098
2101
|
|
|
2099
2102
|
const useIsTablet = () => {
|
|
2100
|
-
const [isTablet, setIsTablet] = React.useState(
|
|
2103
|
+
const [isTablet, setIsTablet] = React.useState(false);
|
|
2101
2104
|
React.useEffect(() => {
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2105
|
+
const detect = () => {
|
|
2106
|
+
const width = window.innerWidth;
|
|
2107
|
+
const isTouch = navigator.maxTouchPoints > 1 || window.matchMedia('(pointer: coarse)').matches;
|
|
2108
|
+
setIsTablet(width >= 600 && width <= 1024 && isTouch);
|
|
2109
|
+
};
|
|
2110
|
+
detect();
|
|
2111
|
+
window.addEventListener('resize', detect);
|
|
2112
|
+
return () => window.removeEventListener('resize', detect);
|
|
2107
2113
|
}, []);
|
|
2108
2114
|
return isTablet;
|
|
2109
2115
|
};
|
|
2110
2116
|
|
|
2117
|
+
const useIsTabletOrMobile = () => {
|
|
2118
|
+
const isMobile = useIsMobile();
|
|
2119
|
+
const isTablet = useIsTablet();
|
|
2120
|
+
return isMobile || isTablet;
|
|
2121
|
+
};
|
|
2122
|
+
|
|
2111
2123
|
exports.Alert = Alert;
|
|
2112
2124
|
exports.Badge = Badge;
|
|
2113
2125
|
exports.Banner = Banner;
|
|
@@ -2165,6 +2177,7 @@ exports.useDebounce = useDebounce;
|
|
|
2165
2177
|
exports.useDebounceFn = useDebounceFn;
|
|
2166
2178
|
exports.useIsMobile = useIsMobile;
|
|
2167
2179
|
exports.useIsTablet = useIsTablet;
|
|
2180
|
+
exports.useIsTabletOrMobile = useIsTabletOrMobile;
|
|
2168
2181
|
exports.usePagination = usePagination;
|
|
2169
2182
|
exports.useToast = useToast;
|
|
2170
2183
|
//# sourceMappingURL=react-tailwind.cjs.js.map
|