@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.
@@ -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-800';
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 { as: Element = 'div', hoverable = false, bordered = false, noPadding = false, ...rest } = props;
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, !noPadding && 'p-2 md:p-4', hoverable && 'shadow hover:shadow-md transition-shadow duration-200', bordered && 'border border-gray-200 dark:border-gray-700', className);
354
- return jsx(Element, { ref: ref, className: classes, ...cleanRest });
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(window.innerWidth < 768);
2068
+ const [isMobile, setIsMobile] = useState(false);
2068
2069
  useEffect(() => {
2069
- function handleResize() {
2070
- setIsMobile(window.innerWidth < 768);
2071
- }
2072
- window.addEventListener('resize', handleResize);
2073
- return () => window.removeEventListener('resize', handleResize);
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(window.innerWidth < 768 && window.innerHeight > 960);
2083
+ const [isTablet, setIsTablet] = useState(false);
2080
2084
  useEffect(() => {
2081
- function handleResize() {
2082
- setIsTablet(window.innerWidth > 768 && window.innerHeight < 960);
2083
- }
2084
- window.addEventListener('resize', handleResize);
2085
- return () => window.removeEventListener('resize', handleResize);
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
  };