@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
|
@@ -364,14 +364,15 @@ 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-
|
|
368
|
-
const Card = React.forwardRef((props, ref) => {
|
|
367
|
+
const BASE_CARD_CLASS = 'bg-white rounded-md dark:bg-gray-900 block';
|
|
368
|
+
const Card = React.forwardRef(({ as, ...props }, ref) => {
|
|
369
369
|
// Remove Card-only props from rest (avoid leaking to DOM)
|
|
370
|
-
const {
|
|
370
|
+
const { hoverable = false, bordered = true, compact = false, zeroPadding = false, ...rest } = props;
|
|
371
|
+
const Component = as || 'div';
|
|
371
372
|
// Extract className safely from rest
|
|
372
373
|
const { className, ...cleanRest } = rest;
|
|
373
|
-
const classes = buildClassName(BASE_CARD_CLASS,
|
|
374
|
-
return jsxRuntime.jsx(
|
|
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
|
+
return jsxRuntime.jsx(Component, { ref: ref, className: classes, ...cleanRest });
|
|
375
376
|
});
|
|
376
377
|
Card.displayName = 'Card';
|
|
377
378
|
|
|
@@ -870,7 +871,7 @@ const Input = React.forwardRef((props, ref) => {
|
|
|
870
871
|
const hasError = Boolean(error);
|
|
871
872
|
const hasRightGroup = rightGroup !== null && rightGroup !== undefined;
|
|
872
873
|
const hasLeftGroup = leftGroup != null && leftGroup !== undefined;
|
|
873
|
-
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 }) }))] }));
|
|
874
875
|
});
|
|
875
876
|
Input.displayName = 'Input';
|
|
876
877
|
|
|
@@ -2084,25 +2085,31 @@ const VirtualizedDataTable = ({ items, columns, sorting = {}, onSort, loading =
|
|
|
2084
2085
|
};
|
|
2085
2086
|
|
|
2086
2087
|
const useIsMobile = () => {
|
|
2087
|
-
const [isMobile, setIsMobile] = React.useState(
|
|
2088
|
+
const [isMobile, setIsMobile] = React.useState(false);
|
|
2088
2089
|
React.useEffect(() => {
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
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);
|
|
2094
2098
|
}, []);
|
|
2095
2099
|
return isMobile;
|
|
2096
2100
|
};
|
|
2097
2101
|
|
|
2098
2102
|
const useIsTablet = () => {
|
|
2099
|
-
const [isTablet, setIsTablet] = React.useState(
|
|
2103
|
+
const [isTablet, setIsTablet] = React.useState(false);
|
|
2100
2104
|
React.useEffect(() => {
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
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);
|
|
2106
2113
|
}, []);
|
|
2107
2114
|
return isTablet;
|
|
2108
2115
|
};
|