@pk-design/react-tailwind 1.1.3 → 1.1.4
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 +22 -16
- package/dist/react-tailwind.cjs.js.map +1 -1
- package/dist/react-tailwind.es.js +22 -16
- 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/package.json +1 -1
|
@@ -344,14 +344,14 @@ const Breadcrumb = ({ items, render }) => {
|
|
|
344
344
|
};
|
|
345
345
|
Breadcrumb.displayName = 'Breadcrumb';
|
|
346
346
|
|
|
347
|
-
const BASE_CARD_CLASS = 'bg-white rounded-md dark:bg-gray-900 block
|
|
347
|
+
const BASE_CARD_CLASS = 'bg-white rounded-md dark:bg-gray-900 block';
|
|
348
348
|
const Card = forwardRef(({ as, ...props }, ref) => {
|
|
349
349
|
// Remove Card-only props from rest (avoid leaking to DOM)
|
|
350
|
-
const { hoverable = false, bordered = true, compact = false, ...rest } = props;
|
|
350
|
+
const { hoverable = false, bordered = true, compact = false, zeroPadding = false, ...rest } = props;
|
|
351
351
|
const Component = as || 'div';
|
|
352
352
|
// Extract className safely from rest
|
|
353
353
|
const { className, ...cleanRest } = rest;
|
|
354
|
-
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);
|
|
354
|
+
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);
|
|
355
355
|
return jsx(Component, { ref: ref, className: classes, ...cleanRest });
|
|
356
356
|
});
|
|
357
357
|
Card.displayName = 'Card';
|
|
@@ -851,7 +851,7 @@ const Input = forwardRef((props, ref) => {
|
|
|
851
851
|
const hasError = Boolean(error);
|
|
852
852
|
const hasRightGroup = rightGroup !== null && rightGroup !== undefined;
|
|
853
853
|
const hasLeftGroup = leftGroup != null && leftGroup !== undefined;
|
|
854
|
-
return (jsxs("div", { className: buildClassName('group', hasError && 'has-error', containerClass), children: [label && (jsxs("div", { className: buildClassName('flex items-center justify-between mb-2', labelWrapperClass), children: [jsx(Label, { className: labelClass, htmlFor: id, children: label }), labelHint] })), jsxs("div", { className: "relative", children: [hasLeftGroup && (jsx("span", { className: "absolute top-0 h-full flex items-center justify-center w-10", children: leftGroup })), jsx("input", { ref: ref, autoComplete: "off", ...inputProps, name: name, id: id, type: type, className: buildClassName(buildInputClass(className), hasRightGroup ? 'pe-10' : '', hasLeftGroup ? 'ps-10' : '') }), hasRightGroup && (jsx("span", { className: "absolute end-0.75 top-0 h-full flex items-center justify-center w-10", children: rightGroup }))] }), showErrorMessage && error && (jsx("div", { className: "mt-1", children: jsx(TextContent, { error: true, small: true, children: error }) }))] }));
|
|
854
|
+
return (jsxs("div", { className: buildClassName('group', hasError && 'has-error', containerClass), children: [label && (jsxs("div", { className: buildClassName('flex items-center justify-between mb-2', labelWrapperClass), children: [jsx(Label, { className: labelClass, htmlFor: id, children: label }), labelHint] })), jsxs("div", { className: "relative", children: [hasLeftGroup && (jsx("span", { className: "absolute top-0 h-full flex items-center justify-center w-10", children: leftGroup })), 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 && (jsx("span", { className: "absolute end-0.75 top-0 h-full flex items-center justify-center w-10", children: rightGroup }))] }), showErrorMessage && error && (jsx("div", { className: "mt-1", children: jsx(TextContent, { error: true, small: true, children: error }) }))] }));
|
|
855
855
|
});
|
|
856
856
|
Input.displayName = 'Input';
|
|
857
857
|
|
|
@@ -2065,25 +2065,31 @@ const VirtualizedDataTable = ({ items, columns, sorting = {}, onSort, loading =
|
|
|
2065
2065
|
};
|
|
2066
2066
|
|
|
2067
2067
|
const useIsMobile = () => {
|
|
2068
|
-
const [isMobile, setIsMobile] = useState(
|
|
2068
|
+
const [isMobile, setIsMobile] = useState(false);
|
|
2069
2069
|
useEffect(() => {
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2070
|
+
const detect = () => {
|
|
2071
|
+
const width = window.innerWidth;
|
|
2072
|
+
const isTouch = navigator.maxTouchPoints > 1 || window.matchMedia('(pointer: coarse)').matches;
|
|
2073
|
+
setIsMobile(width < 600 && isTouch);
|
|
2074
|
+
};
|
|
2075
|
+
detect();
|
|
2076
|
+
window.addEventListener('resize', detect);
|
|
2077
|
+
return () => window.removeEventListener('resize', detect);
|
|
2075
2078
|
}, []);
|
|
2076
2079
|
return isMobile;
|
|
2077
2080
|
};
|
|
2078
2081
|
|
|
2079
2082
|
const useIsTablet = () => {
|
|
2080
|
-
const [isTablet, setIsTablet] = useState(
|
|
2083
|
+
const [isTablet, setIsTablet] = useState(false);
|
|
2081
2084
|
useEffect(() => {
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2085
|
+
const detect = () => {
|
|
2086
|
+
const width = window.innerWidth;
|
|
2087
|
+
const isTouch = navigator.maxTouchPoints > 1 || window.matchMedia('(pointer: coarse)').matches;
|
|
2088
|
+
setIsTablet(width >= 600 && width <= 1024 && isTouch);
|
|
2089
|
+
};
|
|
2090
|
+
detect();
|
|
2091
|
+
window.addEventListener('resize', detect);
|
|
2092
|
+
return () => window.removeEventListener('resize', detect);
|
|
2087
2093
|
}, []);
|
|
2088
2094
|
return isTablet;
|
|
2089
2095
|
};
|