@shipfox/react-ui 0.24.0 → 0.26.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.
Files changed (58) hide show
  1. package/dist/components/index.d.ts +1 -0
  2. package/dist/components/index.js +1 -0
  3. package/dist/components/modal/modal.d.ts +2 -1
  4. package/dist/components/modal/modal.js +3 -2
  5. package/dist/components/slider/index.d.ts +2 -0
  6. package/dist/components/slider/index.js +3 -0
  7. package/dist/components/slider/slider.d.ts +10 -0
  8. package/dist/components/slider/slider.js +38 -0
  9. package/dist/components/table/data-table.js +57 -22
  10. package/dist/components/table/table.js +2 -1
  11. package/dist/components/table/table.stories.data.js +1 -1
  12. package/dist/styles.css +1 -1
  13. package/package.json +5 -5
  14. package/dist/colors.stories.js +0 -61
  15. package/dist/components/alert/alert.stories.js +0 -227
  16. package/dist/components/avatar/avatar.stories.js +0 -267
  17. package/dist/components/badge/badge.stories.js +0 -802
  18. package/dist/components/button/button-link.stories.js +0 -127
  19. package/dist/components/button/button.stories.js +0 -187
  20. package/dist/components/button/icon-button.stories.js +0 -344
  21. package/dist/components/button-group/button-group.stories.js +0 -644
  22. package/dist/components/card/card.stories.js +0 -216
  23. package/dist/components/checkbox/checkbox.stories.js +0 -566
  24. package/dist/components/code-block/code-block.stories.js +0 -341
  25. package/dist/components/combobox/combobox.stories.js +0 -191
  26. package/dist/components/command/command.stories.js +0 -228
  27. package/dist/components/confetti/confetti.stories.js +0 -41
  28. package/dist/components/count-up/count-up.stories.js +0 -568
  29. package/dist/components/dashboard/components/charts/bar-chart.stories.js +0 -287
  30. package/dist/components/dashboard/components/charts/line-chart.stories.js +0 -257
  31. package/dist/components/dashboard/dashboard.stories.js +0 -23
  32. package/dist/components/date-picker/date-picker.stories.js +0 -349
  33. package/dist/components/dropdown-input/dropdown-input.stories.js +0 -240
  34. package/dist/components/dropdown-menu/dropdown-menu.stories.js +0 -462
  35. package/dist/components/dynamic-item/dynamic-item.stories.js +0 -385
  36. package/dist/components/empty-state/empty-state.stories.js +0 -74
  37. package/dist/components/form/form.stories.js +0 -587
  38. package/dist/components/icon/icon.stories.js +0 -38
  39. package/dist/components/inline-tips/inline-tips.stories.js +0 -219
  40. package/dist/components/input/input.stories.js +0 -265
  41. package/dist/components/interval-selector/interval-selector.stories.js +0 -232
  42. package/dist/components/item/item.stories.js +0 -239
  43. package/dist/components/kbd/kbd.stories.js +0 -119
  44. package/dist/components/label/label.stories.js +0 -105
  45. package/dist/components/modal/modal.stories.js +0 -566
  46. package/dist/components/search/search.stories.js +0 -630
  47. package/dist/components/select/select.stories.js +0 -393
  48. package/dist/components/sheet/sheet.stories.js +0 -368
  49. package/dist/components/skeleton/skeleton.stories.js +0 -345
  50. package/dist/components/table/table.stories.js +0 -302
  51. package/dist/components/tabs/tabs.stories.js +0 -179
  52. package/dist/components/textarea/textarea.stories.js +0 -339
  53. package/dist/components/toast/toast.stories.js +0 -326
  54. package/dist/components/tooltip/tooltip.stories.js +0 -560
  55. package/dist/components/typography/code.stories.js +0 -54
  56. package/dist/components/typography/header.stories.js +0 -34
  57. package/dist/components/typography/text.stories.js +0 -105
  58. package/dist/onboarding/sign-in.stories.js +0 -101
@@ -36,6 +36,7 @@ export * from './select';
36
36
  export * from './sheet';
37
37
  export * from './shiny-text';
38
38
  export * from './skeleton';
39
+ export * from './slider';
39
40
  export * from './table';
40
41
  export * from './tabs';
41
42
  export * from './textarea';
@@ -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';
@@ -38,8 +38,9 @@ type ModalBodyHeaderProps = ComponentProps<'div'> & {
38
38
  alt?: string;
39
39
  title: string;
40
40
  description?: ReactNode;
41
+ children?: ReactNode;
41
42
  };
42
- declare function ModalBodyHeader({ className, src, alt, title, description, ...props }: ModalBodyHeaderProps): import("react/jsx-runtime").JSX.Element;
43
+ declare function ModalBodyHeader({ className, src, alt, title, description, children, ...props }: ModalBodyHeaderProps): import("react/jsx-runtime").JSX.Element;
43
44
  export { Modal, ModalPortal, ModalOverlay, ModalTrigger, ModalClose, ModalContent, ModalHeader, ModalBody, ModalFooter, ModalBodyHeader, ModalTitle, ModalDescription, modalContentVariants, modalOverlayVariants, modalDefaultTransition, };
44
45
  export type { ModalContentProps, ModalHeaderProps, ModalOverlayProps, ModalTitleProps, ModalDescriptionProps, ModalBodyHeaderProps, };
45
46
  //# sourceMappingURL=modal.d.ts.map
@@ -259,7 +259,7 @@ function ModalDescription({ className, ...props }) {
259
259
  ...props
260
260
  });
261
261
  }
262
- function ModalBodyHeader({ className, src, alt = '', title, description, ...props }) {
262
+ function ModalBodyHeader({ className, src, alt = '', title, description, children, ...props }) {
263
263
  return /*#__PURE__*/ _jsxs("div", {
264
264
  className: cn('flex flex-col gap-32 items-start max-w-xl', className),
265
265
  ...props,
@@ -283,7 +283,8 @@ function ModalBodyHeader({ className, src, alt = '', title, description, ...prop
283
283
  children: description
284
284
  })
285
285
  ]
286
- })
286
+ }),
287
+ children
287
288
  ]
288
289
  });
289
290
  }
@@ -0,0 +1,2 @@
1
+ export * from './slider';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,3 @@
1
+ export * from './slider.js';
2
+
3
+ //# sourceMappingURL=index.js.map
@@ -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((val)=>/*#__PURE__*/ _jsx(SliderPrimitive.Thumb, {
30
+ "data-slot": "slider-thumb",
31
+ className: cn(thumbDefaults, thumbClassName)
32
+ }, val))
33
+ ]
34
+ });
35
+ }
36
+ export { Slider };
37
+
38
+ //# sourceMappingURL=slider.js.map
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { flexRender, getCoreRowModel, getFilteredRowModel, getPaginationRowModel, getSortedRowModel, useReactTable } from '@tanstack/react-table';
3
3
  import { Card, CardContent } from '../../components/card/index.js';
4
4
  import { Checkbox } from '../../components/checkbox/index.js';
@@ -85,7 +85,18 @@ export function DataTable({ columns, data, pagination = true, pageSize = 10, pag
85
85
  pagination: pagination ? paginationState : undefined
86
86
  }
87
87
  });
88
- const skeletonRowCount = pageSize > 5 ? 5 : pageSize;
88
+ const rowModel = table.getRowModel();
89
+ const rowCount = rowModel.rows.length;
90
+ const hasRows = rowCount > 0;
91
+ const currentPageSize = pagination ? paginationState.pageSize : pageSize;
92
+ const skeletonRowCount = currentPageSize > 5 ? 5 : currentPageSize;
93
+ const headerHeight = 40;
94
+ const rowHeight = 46;
95
+ const paginationHeight = 52.5;
96
+ 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;
89
100
  if (isLoading) {
90
101
  return /*#__PURE__*/ _jsx(Card, {
91
102
  className: cn('p-0 gap-0', className),
@@ -93,6 +104,9 @@ export function DataTable({ columns, data, pagination = true, pageSize = 10, pag
93
104
  children: /*#__PURE__*/ _jsx(CardContent, {
94
105
  className: "overflow-hidden p-0",
95
106
  children: /*#__PURE__*/ _jsxs(Table, {
107
+ style: minTableHeight ? {
108
+ minHeight: `${minTableHeight}px`
109
+ } : undefined,
96
110
  children: [
97
111
  /*#__PURE__*/ _jsx(TableHeader, {
98
112
  children: /*#__PURE__*/ _jsx(TableRow, {
@@ -127,8 +141,11 @@ export function DataTable({ columns, data, pagination = true, pageSize = 10, pag
127
141
  children: /*#__PURE__*/ _jsx(CardContent, {
128
142
  className: "overflow-hidden p-0",
129
143
  children: /*#__PURE__*/ _jsxs(Table, {
144
+ style: minTableHeight ? {
145
+ minHeight: `${minTableHeight}px`
146
+ } : undefined,
130
147
  children: [
131
- table.getRowModel().rows.length > 0 ? /*#__PURE__*/ _jsx(TableHeader, {
148
+ hasRows ? /*#__PURE__*/ _jsx(TableHeader, {
132
149
  children: table.getHeaderGroups().map((headerGroup)=>/*#__PURE__*/ _jsx(TableRow, {
133
150
  className: "hover:bg-transparent border-b",
134
151
  children: headerGroup.headers.map((header)=>/*#__PURE__*/ _jsx(TableHead, {
@@ -137,32 +154,50 @@ export function DataTable({ columns, data, pagination = true, pageSize = 10, pag
137
154
  }, headerGroup.id))
138
155
  }) : null,
139
156
  /*#__PURE__*/ _jsx(TableBody, {
140
- children: table.getRowModel().rows?.length ? table.getRowModel().rows.map((row)=>/*#__PURE__*/ _jsx(TableRow, {
141
- onClick: ()=>onRowClick?.(row.original),
142
- "data-selected": row.getIsSelected(),
143
- className: onRowClick ? 'cursor-pointer' : '',
144
- tabIndex: onRowClick ? 0 : undefined,
145
- role: onRowClick ? 'button' : undefined,
146
- onKeyDown: (event)=>{
147
- if (!onRowClick) return;
148
- if (event.key === 'Enter' || event.key === ' ') {
149
- event.preventDefault();
150
- onRowClick(row.original);
151
- }
152
- },
153
- children: row.getVisibleCells().map((cell)=>/*#__PURE__*/ _jsx(TableCell, {
154
- children: flexRender(cell.column.columnDef.cell, cell.getContext())
155
- }, cell.id))
156
- }, row.id)) : /*#__PURE__*/ _jsx(TableRow, {
157
+ children: hasRows ? /*#__PURE__*/ _jsxs(_Fragment, {
158
+ children: [
159
+ rowModel.rows.map((row)=>/*#__PURE__*/ _jsx(TableRow, {
160
+ onClick: ()=>onRowClick?.(row.original),
161
+ "data-selected": row.getIsSelected(),
162
+ className: onRowClick ? 'cursor-pointer' : '',
163
+ tabIndex: onRowClick ? 0 : undefined,
164
+ role: onRowClick ? 'button' : undefined,
165
+ onKeyDown: (event)=>{
166
+ if (!onRowClick) return;
167
+ if (event.key === 'Enter' || event.key === ' ') {
168
+ event.preventDefault();
169
+ onRowClick(row.original);
170
+ }
171
+ },
172
+ children: row.getVisibleCells().map((cell)=>/*#__PURE__*/ _jsx(TableCell, {
173
+ children: flexRender(cell.column.columnDef.cell, cell.getContext())
174
+ }, cell.id))
175
+ }, row.id)),
176
+ emptyRowCount > 0 && Array.from({
177
+ length: emptyRowCount
178
+ }, (_, idx)=>{
179
+ const emptyRowKey = `empty-row-${rowCount}-pos-${idx + rowCount}`;
180
+ return /*#__PURE__*/ _jsx(TableRow, {
181
+ className: "hover:bg-transparent pointer-events-none",
182
+ children: table.getAllColumns().map((column)=>/*#__PURE__*/ _jsx(TableCell, {
183
+ children: /*#__PURE__*/ _jsx("span", {
184
+ className: "invisible",
185
+ children: "."
186
+ })
187
+ }, column.id))
188
+ }, emptyRowKey);
189
+ })
190
+ ]
191
+ }) : /*#__PURE__*/ _jsx(TableRow, {
157
192
  className: "hover:bg-transparent",
158
193
  children: /*#__PURE__*/ _jsx(TableCell, {
159
194
  colSpan: table.getAllColumns().length,
160
- className: "h-240 text-center rounded-t-8",
195
+ className: "h-240 text-center rounded-t-8 hover:bg-transparent",
161
196
  children: emptyState || /*#__PURE__*/ _jsx(EmptyState, {})
162
197
  })
163
198
  })
164
199
  }),
165
- pagination && table.getRowModel().rows?.length > 0 && /*#__PURE__*/ _jsx(TablePagination, {
200
+ shouldShowPagination && /*#__PURE__*/ _jsx(TablePagination, {
166
201
  table: table,
167
202
  pageSizeOptions: pageSizeOptions,
168
203
  showSelectedCount: showSelectedCount,
@@ -3,6 +3,7 @@ import { cn } from '../../utils/cn.js';
3
3
  function Table({ className, ...props }) {
4
4
  return /*#__PURE__*/ _jsx("div", {
5
5
  className: "relative w-full overflow-auto scrollbar rounded-x-8 rounded-b-8",
6
+ style: props.style,
6
7
  children: /*#__PURE__*/ _jsx("table", {
7
8
  "data-slot": "table",
8
9
  className: cn('w-full caption-bottom text-sm', className),
@@ -48,7 +49,7 @@ function TableHead({ className, ...props }) {
48
49
  function TableCell({ className, ...props }) {
49
50
  return /*#__PURE__*/ _jsx("td", {
50
51
  "data-slot": "table-cell",
51
- className: cn('px-12 py-10 align-middle text-sm leading-20 text-foreground-neutral-base', 'bg-background-neutral-base', 'group-hover/row:bg-background-neutral-hover', 'group-data-[selected=true]/row:bg-background-neutral-pressed!', '[&:has([role=checkbox])]:pr-0 [&:has([role=checkbox])]:pt-14', className),
52
+ className: cn('px-12 py-10 align-middle text-sm leading-20 text-foreground-neutral-base truncate', 'bg-background-neutral-base', 'group-hover/row:bg-background-neutral-hover', 'group-data-[selected=true]/row:bg-background-neutral-pressed!', '[&:has([role=checkbox])]:pr-0 [&:has([role=checkbox])]:pt-14', className),
52
53
  ...props
53
54
  });
54
55
  }
@@ -75,7 +75,7 @@
75
75
  };
76
76
  /**
77
77
  * Sample job data
78
- */ export const jobsData = generateJobData(100);
78
+ */ export const jobsData = generateJobData(51);
79
79
  /**
80
80
  * Sample search job data
81
81
  */ export const searchJobsData = generateSearchJobData(50);