@pk-design/react-tailwind 1.1.2 → 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 +25 -18
- package/dist/react-tailwind.cjs.js.map +1 -1
- package/dist/react-tailwind.es.js +25 -18
- package/dist/react-tailwind.es.js.map +1 -1
- package/dist/types/components/Button/Button.types.d.ts +1 -5
- package/dist/types/components/Card/Card.d.ts +2 -3
- package/dist/types/components/Card/Card.types.d.ts +62 -9
- package/dist/types/components/common-type.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,15 @@ 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-
|
|
348
|
-
const Card = forwardRef((props, ref) => {
|
|
347
|
+
const BASE_CARD_CLASS = 'bg-white rounded-md dark:bg-gray-900 block';
|
|
348
|
+
const Card = forwardRef(({ as, ...props }, ref) => {
|
|
349
349
|
// Remove Card-only props from rest (avoid leaking to DOM)
|
|
350
|
-
const {
|
|
350
|
+
const { hoverable = false, bordered = true, compact = false, zeroPadding = false, ...rest } = props;
|
|
351
|
+
const Component = as || 'div';
|
|
351
352
|
// Extract className safely from rest
|
|
352
353
|
const { className, ...cleanRest } = rest;
|
|
353
|
-
const classes = buildClassName(BASE_CARD_CLASS,
|
|
354
|
-
return jsx(
|
|
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
|
+
return jsx(Component, { ref: ref, className: classes, ...cleanRest });
|
|
355
356
|
});
|
|
356
357
|
Card.displayName = 'Card';
|
|
357
358
|
|
|
@@ -850,7 +851,7 @@ const Input = forwardRef((props, ref) => {
|
|
|
850
851
|
const hasError = Boolean(error);
|
|
851
852
|
const hasRightGroup = rightGroup !== null && rightGroup !== undefined;
|
|
852
853
|
const hasLeftGroup = leftGroup != null && leftGroup !== undefined;
|
|
853
|
-
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 }) }))] }));
|
|
854
855
|
});
|
|
855
856
|
Input.displayName = 'Input';
|
|
856
857
|
|
|
@@ -2064,25 +2065,31 @@ const VirtualizedDataTable = ({ items, columns, sorting = {}, onSort, loading =
|
|
|
2064
2065
|
};
|
|
2065
2066
|
|
|
2066
2067
|
const useIsMobile = () => {
|
|
2067
|
-
const [isMobile, setIsMobile] = useState(
|
|
2068
|
+
const [isMobile, setIsMobile] = useState(false);
|
|
2068
2069
|
useEffect(() => {
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
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);
|
|
2074
2078
|
}, []);
|
|
2075
2079
|
return isMobile;
|
|
2076
2080
|
};
|
|
2077
2081
|
|
|
2078
2082
|
const useIsTablet = () => {
|
|
2079
|
-
const [isTablet, setIsTablet] = useState(
|
|
2083
|
+
const [isTablet, setIsTablet] = useState(false);
|
|
2080
2084
|
useEffect(() => {
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
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);
|
|
2086
2093
|
}, []);
|
|
2087
2094
|
return isTablet;
|
|
2088
2095
|
};
|