@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.
@@ -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-800';
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 { as: Element = 'div', hoverable = false, bordered = false, noPadding = false, ...rest } = props;
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, !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);
374
- return jsxRuntime.jsx(Element, { ref: ref, className: classes, ...cleanRest });
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(window.innerWidth < 768);
2088
+ const [isMobile, setIsMobile] = React.useState(false);
2088
2089
  React.useEffect(() => {
2089
- function handleResize() {
2090
- setIsMobile(window.innerWidth < 768);
2091
- }
2092
- window.addEventListener('resize', handleResize);
2093
- return () => window.removeEventListener('resize', handleResize);
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(window.innerWidth < 768 && window.innerHeight > 960);
2103
+ const [isTablet, setIsTablet] = React.useState(false);
2100
2104
  React.useEffect(() => {
2101
- function handleResize() {
2102
- setIsTablet(window.innerWidth > 768 && window.innerHeight < 960);
2103
- }
2104
- window.addEventListener('resize', handleResize);
2105
- return () => window.removeEventListener('resize', handleResize);
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
  };