@shipfox/react-ui 0.26.0 → 0.27.0

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.
@@ -1,9 +1,14 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { gsap } from 'gsap';
3
- import { InertiaPlugin } from 'gsap/InertiaPlugin';
4
3
  import { useCallback, useEffect, useMemo, useRef } from 'react';
5
4
  import { cn } from '../../utils/index.js';
6
- gsap.registerPlugin(InertiaPlugin);
5
+ let inertiaPluginRegistered = false;
6
+ async function ensureInertiaPlugin() {
7
+ if (inertiaPluginRegistered) return;
8
+ const { InertiaPlugin } = await import('gsap/InertiaPlugin');
9
+ gsap.registerPlugin(InertiaPlugin);
10
+ inertiaPluginRegistered = true;
11
+ }
7
12
  const HEX_COLOR_REGEX = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i;
8
13
  const throttle = (func, limit)=>{
9
14
  let lastCall = 0;
@@ -168,6 +173,7 @@ export function DotGrid({ dotSize = 16, gap = 32, baseColor = '#5227FF', activeC
168
173
  buildGrid
169
174
  ]);
170
175
  useEffect(()=>{
176
+ ensureInertiaPlugin();
171
177
  const onMove = (e)=>{
172
178
  const now = performance.now();
173
179
  const pr = pointerRef.current;
@@ -26,10 +26,10 @@ function Slider({ className, defaultValue, value, min = 0, max = 100, trackClass
26
26
  className: cn(rangeDefaults, rangeClassName)
27
27
  })
28
28
  }),
29
- values.map((val)=>/*#__PURE__*/ _jsx(SliderPrimitive.Thumb, {
29
+ values.map((_, index)=>/*#__PURE__*/ _jsx(SliderPrimitive.Thumb, {
30
30
  "data-slot": "slider-thumb",
31
31
  className: cn(thumbDefaults, thumbClassName)
32
- }, val))
32
+ }, `thumb-${index.toString()}`))
33
33
  ]
34
34
  });
35
35
  }
@@ -64,13 +64,14 @@ export function DataTable({ columns, data, pagination = true, pageSize = 10, pag
64
64
  columns,
65
65
  showSelectedCount
66
66
  ]);
67
+ const isPaginationNeeded = pagination && data.length > pageSize;
67
68
  const table = useReactTable({
68
69
  data,
69
70
  columns: columnsWithSelection,
70
71
  getCoreRowModel: getCoreRowModel(),
71
72
  getFilteredRowModel: getFilteredRowModel(),
72
73
  getSortedRowModel: getSortedRowModel(),
73
- getPaginationRowModel: pagination ? getPaginationRowModel() : undefined,
74
+ getPaginationRowModel: isPaginationNeeded ? getPaginationRowModel() : undefined,
74
75
  enableRowSelection: showSelectedCount,
75
76
  onSortingChange: setSorting,
76
77
  onColumnFiltersChange: setColumnFilters,
@@ -82,21 +83,21 @@ export function DataTable({ columns, data, pagination = true, pageSize = 10, pag
82
83
  columnFilters,
83
84
  columnVisibility,
84
85
  rowSelection,
85
- pagination: pagination ? paginationState : undefined
86
+ pagination: isPaginationNeeded ? paginationState : undefined
86
87
  }
87
88
  });
88
89
  const rowModel = table.getRowModel();
89
90
  const rowCount = rowModel.rows.length;
90
91
  const hasRows = rowCount > 0;
91
- const currentPageSize = pagination ? paginationState.pageSize : pageSize;
92
+ const currentPageSize = isPaginationNeeded ? paginationState.pageSize : pageSize;
92
93
  const skeletonRowCount = currentPageSize > 5 ? 5 : currentPageSize;
93
94
  const headerHeight = 40;
94
95
  const rowHeight = 46;
95
96
  const paginationHeight = 52.5;
96
97
  const rowsForHeight = hasRows ? currentPageSize : 5;
97
- const shouldShowPagination = pagination && hasRows;
98
- const minTableHeight = pagination ? headerHeight + rowsForHeight * rowHeight + (shouldShowPagination ? paginationHeight : 0) : undefined;
99
- const emptyRowCount = pagination && hasRows ? Math.max(0, currentPageSize - rowCount) : 0;
98
+ const shouldShowPagination = isPaginationNeeded && hasRows;
99
+ const minTableHeight = isPaginationNeeded ? headerHeight + rowsForHeight * rowHeight + (shouldShowPagination ? paginationHeight : 0) : undefined;
100
+ const emptyRowCount = isPaginationNeeded && hasRows ? Math.max(0, currentPageSize - rowCount) : 0;
100
101
  if (isLoading) {
101
102
  return /*#__PURE__*/ _jsx(Card, {
102
103
  className: cn('p-0 gap-0', className),
@@ -75,7 +75,7 @@
75
75
  };
76
76
  /**
77
77
  * Sample job data
78
- */ export const jobsData = generateJobData(51);
78
+ */ export const jobsData = generateJobData(11);
79
79
  /**
80
80
  * Sample search job data
81
81
  */ export const searchJobsData = generateSearchJobData(50);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@shipfox/react-ui",
3
3
  "license": "MIT",
4
- "version": "0.26.0",
4
+ "version": "0.27.0",
5
5
  "private": false,
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -11,9 +11,21 @@
11
11
  "dist/**/*.js",
12
12
  "dist/**/*.d.ts",
13
13
  "dist/styles.css",
14
+ "tailwind.config.ts",
14
15
  "README.md",
15
16
  "LICENSE"
16
17
  ],
18
+ "exports": {
19
+ ".": {
20
+ "types": "./dist/index.d.ts",
21
+ "default": "./dist/index.js"
22
+ },
23
+ "./tailwind.config": {
24
+ "types": "./tailwind.config.ts",
25
+ "default": "./tailwind.config.ts"
26
+ },
27
+ "./dist/styles.css": "./dist/styles.css"
28
+ },
17
29
  "dependencies": {
18
30
  "@radix-ui/react-accordion": "^1.2.12",
19
31
  "@radix-ui/react-alert-dialog": "^1.1.15",
@@ -86,10 +98,10 @@
86
98
  "vitest": "^4.0.8",
87
99
  "zod": "^4.1.12",
88
100
  "@shipfox/biome": "1.6.0",
89
- "@shipfox/ts-config": "1.3.5",
90
- "@shipfox/vite": "1.2.2",
91
101
  "@shipfox/swc": "1.2.3",
102
+ "@shipfox/ts-config": "1.3.5",
92
103
  "@shipfox/typescript": "1.1.2",
104
+ "@shipfox/vite": "1.2.2",
93
105
  "@shipfox/vitest": "1.2.0"
94
106
  },
95
107
  "scripts": {