@pk-design/react-tailwind 1.1.3 → 1.1.5

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,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 space-y-2';
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,28 +2065,40 @@ const VirtualizedDataTable = ({ items, columns, sorting = {}, onSort, loading =
2065
2065
  };
2066
2066
 
2067
2067
  const useIsMobile = () => {
2068
- const [isMobile, setIsMobile] = useState(window.innerWidth < 768);
2068
+ const [isMobile, setIsMobile] = useState(false);
2069
2069
  useEffect(() => {
2070
- function handleResize() {
2071
- setIsMobile(window.innerWidth < 768);
2072
- }
2073
- window.addEventListener('resize', handleResize);
2074
- 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);
2075
2078
  }, []);
2076
2079
  return isMobile;
2077
2080
  };
2078
2081
 
2079
2082
  const useIsTablet = () => {
2080
- const [isTablet, setIsTablet] = useState(window.innerWidth < 768 && window.innerHeight > 960);
2083
+ const [isTablet, setIsTablet] = useState(false);
2081
2084
  useEffect(() => {
2082
- function handleResize() {
2083
- setIsTablet(window.innerWidth > 768 && window.innerHeight < 960);
2084
- }
2085
- window.addEventListener('resize', handleResize);
2086
- 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);
2087
2093
  }, []);
2088
2094
  return isTablet;
2089
2095
  };
2090
2096
 
2091
- export { Alert, Badge, Banner, BodyText, Breadcrumb, Button, Card, Checkbox, CheckboxGroup, DOTS, DataTable, DetailedInformation, Dot, Drawer, Dropdown, EmptyState, EmptyTableRow, HeadingText, Input, Label, Loader, PASSWORD_PLACEHOLDER, PASSWORD_TYPE, Pagination, PasswordInput, Radio, RadioGroup, RadioSwitch, RangeInput, RangeSlider, SelectBox, SortIconMap, Table, TableBody, TableCell, TableFoot, TableHead, TableHeaderCell, TableRow, Tabs, TextContent, Textarea, Toast, ToastProvider, VirtualizedDataTable, buildClassName, buildInputClass, get, getSortIcon, isArray, isEmpty, nextSortDirection, updateSortQuery, useDebounce, useDebounceFn, useIsMobile, useIsTablet, usePagination, useToast };
2097
+ const useIsTabletOrMobile = () => {
2098
+ const isMobile = useIsMobile();
2099
+ const isTablet = useIsTablet();
2100
+ return isMobile || isTablet;
2101
+ };
2102
+
2103
+ export { Alert, Badge, Banner, BodyText, Breadcrumb, Button, Card, Checkbox, CheckboxGroup, DOTS, DataTable, DetailedInformation, Dot, Drawer, Dropdown, EmptyState, EmptyTableRow, HeadingText, Input, Label, Loader, PASSWORD_PLACEHOLDER, PASSWORD_TYPE, Pagination, PasswordInput, Radio, RadioGroup, RadioSwitch, RangeInput, RangeSlider, SelectBox, SortIconMap, Table, TableBody, TableCell, TableFoot, TableHead, TableHeaderCell, TableRow, Tabs, TextContent, Textarea, Toast, ToastProvider, VirtualizedDataTable, buildClassName, buildInputClass, get, getSortIcon, isArray, isEmpty, nextSortDirection, updateSortQuery, useDebounce, useDebounceFn, useIsMobile, useIsTablet, useIsTabletOrMobile, usePagination, useToast };
2092
2104
  //# sourceMappingURL=react-tailwind.es.js.map