@shipfox/react-ui 0.25.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.
- package/dist/components/dot-grid/dot-grid.js +8 -2
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/slider/index.d.ts +2 -0
- package/dist/components/slider/index.js +3 -0
- package/dist/components/slider/slider.d.ts +10 -0
- package/dist/components/slider/slider.js +38 -0
- package/dist/components/table/data-table.js +7 -6
- package/dist/components/table/table.stories.data.js +1 -1
- package/dist/styles.css +1 -1
- package/package.json +17 -5
- package/dist/colors.stories.js +0 -61
- package/dist/components/alert/alert.stories.js +0 -227
- package/dist/components/avatar/avatar.stories.js +0 -267
- package/dist/components/badge/badge.stories.js +0 -802
- package/dist/components/button/button-link.stories.js +0 -127
- package/dist/components/button/button.stories.js +0 -187
- package/dist/components/button/icon-button.stories.js +0 -344
- package/dist/components/button-group/button-group.stories.js +0 -644
- package/dist/components/card/card.stories.js +0 -216
- package/dist/components/checkbox/checkbox.stories.js +0 -566
- package/dist/components/code-block/code-block.stories.js +0 -341
- package/dist/components/combobox/combobox.stories.js +0 -191
- package/dist/components/command/command.stories.js +0 -228
- package/dist/components/confetti/confetti.stories.js +0 -41
- package/dist/components/count-up/count-up.stories.js +0 -568
- package/dist/components/dashboard/components/charts/bar-chart.stories.js +0 -287
- package/dist/components/dashboard/components/charts/line-chart.stories.js +0 -257
- package/dist/components/dashboard/dashboard.stories.js +0 -23
- package/dist/components/date-picker/date-picker.stories.js +0 -349
- package/dist/components/dropdown-input/dropdown-input.stories.js +0 -240
- package/dist/components/dropdown-menu/dropdown-menu.stories.js +0 -462
- package/dist/components/dynamic-item/dynamic-item.stories.js +0 -385
- package/dist/components/empty-state/empty-state.stories.js +0 -74
- package/dist/components/form/form.stories.js +0 -587
- package/dist/components/icon/icon.stories.js +0 -38
- package/dist/components/inline-tips/inline-tips.stories.js +0 -219
- package/dist/components/input/input.stories.js +0 -265
- package/dist/components/interval-selector/interval-selector.stories.js +0 -232
- package/dist/components/item/item.stories.js +0 -239
- package/dist/components/kbd/kbd.stories.js +0 -119
- package/dist/components/label/label.stories.js +0 -105
- package/dist/components/modal/modal.stories.js +0 -566
- package/dist/components/search/search.stories.js +0 -630
- package/dist/components/select/select.stories.js +0 -393
- package/dist/components/sheet/sheet.stories.js +0 -368
- package/dist/components/skeleton/skeleton.stories.js +0 -345
- package/dist/components/table/table.stories.js +0 -302
- package/dist/components/tabs/tabs.stories.js +0 -179
- package/dist/components/textarea/textarea.stories.js +0 -339
- package/dist/components/toast/toast.stories.js +0 -326
- package/dist/components/tooltip/tooltip.stories.js +0 -560
- package/dist/components/typography/code.stories.js +0 -54
- package/dist/components/typography/header.stories.js +0 -34
- package/dist/components/typography/text.stories.js +0 -105
- package/dist/onboarding/sign-in.stories.js +0 -101
|
@@ -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
|
-
|
|
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;
|
package/dist/components/index.js
CHANGED
|
@@ -36,6 +36,7 @@ export * from './select/index.js';
|
|
|
36
36
|
export * from './sheet/index.js';
|
|
37
37
|
export * from './shiny-text/index.js';
|
|
38
38
|
export * from './skeleton/index.js';
|
|
39
|
+
export * from './slider/index.js';
|
|
39
40
|
export * from './table/index.js';
|
|
40
41
|
export * from './tabs/index.js';
|
|
41
42
|
export * from './textarea/index.js';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as SliderPrimitive from '@radix-ui/react-slider';
|
|
2
|
+
import type { ComponentProps } from 'react';
|
|
3
|
+
export type SliderProps = ComponentProps<typeof SliderPrimitive.Root> & {
|
|
4
|
+
trackClassName?: string;
|
|
5
|
+
rangeClassName?: string;
|
|
6
|
+
thumbClassName?: string;
|
|
7
|
+
};
|
|
8
|
+
declare function Slider({ className, defaultValue, value, min, max, trackClassName, rangeClassName, thumbClassName, ...props }: SliderProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export { Slider };
|
|
10
|
+
//# sourceMappingURL=slider.d.ts.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as SliderPrimitive from '@radix-ui/react-slider';
|
|
3
|
+
import { cn } from '../../utils/cn.js';
|
|
4
|
+
const trackDefaults = 'bg-background-switch-off relative grow overflow-hidden rounded-full data-[orientation=horizontal]:h-4 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-4';
|
|
5
|
+
const rangeDefaults = 'bg-foreground-highlight-interactive absolute select-none rounded-full data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full';
|
|
6
|
+
const thumbDefaults = "relative block size-6 min-w-6 min-h-6 shrink-0 select-none rounded-full border border-border-highlights-interactive bg-foreground-highlight-interactive drop-shadow transition-[color,box-shadow] outline-none after:absolute after:-inset-2 after:block after:content-[''] ring-2 ring-white ring-offset-2 data-disabled:pointer-events-none data-disabled:opacity-50";
|
|
7
|
+
function Slider({ className, defaultValue, value, min = 0, max = 100, trackClassName, rangeClassName, thumbClassName, ...props }) {
|
|
8
|
+
const values = Array.isArray(value) ? value : Array.isArray(defaultValue) ? defaultValue : [
|
|
9
|
+
min,
|
|
10
|
+
max
|
|
11
|
+
];
|
|
12
|
+
return /*#__PURE__*/ _jsxs(SliderPrimitive.Root, {
|
|
13
|
+
"data-slot": "slider",
|
|
14
|
+
defaultValue: defaultValue,
|
|
15
|
+
value: value,
|
|
16
|
+
min: min,
|
|
17
|
+
max: max,
|
|
18
|
+
className: cn('data-[orientation=vertical]:min-h-40 relative flex w-full touch-none select-none items-center data-disabled:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col', className),
|
|
19
|
+
...props,
|
|
20
|
+
children: [
|
|
21
|
+
/*#__PURE__*/ _jsx(SliderPrimitive.Track, {
|
|
22
|
+
"data-slot": "slider-track",
|
|
23
|
+
className: cn(trackDefaults, trackClassName),
|
|
24
|
+
children: /*#__PURE__*/ _jsx(SliderPrimitive.Range, {
|
|
25
|
+
"data-slot": "slider-range",
|
|
26
|
+
className: cn(rangeDefaults, rangeClassName)
|
|
27
|
+
})
|
|
28
|
+
}),
|
|
29
|
+
values.map((_, index)=>/*#__PURE__*/ _jsx(SliderPrimitive.Thumb, {
|
|
30
|
+
"data-slot": "slider-thumb",
|
|
31
|
+
className: cn(thumbDefaults, thumbClassName)
|
|
32
|
+
}, `thumb-${index.toString()}`))
|
|
33
|
+
]
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
export { Slider };
|
|
37
|
+
|
|
38
|
+
//# sourceMappingURL=slider.js.map
|
|
@@ -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:
|
|
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:
|
|
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 =
|
|
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 =
|
|
98
|
-
const minTableHeight =
|
|
99
|
-
const emptyRowCount =
|
|
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),
|