sodtrack-web-ui 0.9.4 → 0.9.6

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,4 +1,3 @@
1
- import { rows_per_page_select_default } from './chunk-O5QOPJOD.mjs';
2
1
  import { ScrollArea, ScrollBar } from './chunk-ZVOUAD54.mjs';
3
2
  import { cn } from './chunk-P3UP2HUA.mjs';
4
3
  import { require_jsx_runtime } from './chunk-2MWIFYP3.mjs';
@@ -114,14 +113,21 @@ function DataTable({
114
113
  children: `${rowsPerPageText}:`
115
114
  }
116
115
  ),
117
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
118
- rows_per_page_select_default,
116
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
117
+ "select",
119
118
  {
120
- value: "10",
121
- onRowsPerPageChange: (value) => {
122
- table.setPageSize(Number(value));
119
+ className: "text-sm leading-[120%]",
120
+ value: pagination.pageSize,
121
+ id: "rows_per_page",
122
+ onChange: (e) => {
123
+ table.setPageSize(Number(e.target.value));
123
124
  table.setPageIndex(0);
124
- }
125
+ },
126
+ children: [
127
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "10", children: "10" }),
128
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "25", children: "25" }),
129
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "50", children: "50" })
130
+ ]
125
131
  }
126
132
  )
127
133
  ] }),
@@ -2,10 +2,10 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import React__default, { HTMLAttributes } from 'react';
3
3
  import { ColumnDef as ColumnDef$1, PaginationState as PaginationState$1, OnChangeFn } from '@tanstack/react-table';
4
4
 
5
- type ColumnDef<TData, TValue> = ColumnDef$1<TData, TValue>;
5
+ type ColumnDef<TData> = ColumnDef$1<TData>;
6
6
  type PaginationState = PaginationState$1;
7
- interface DataTableProps<TData, TValue> extends HTMLAttributes<HTMLDivElement> {
8
- columns: ColumnDef<TData, TValue>[];
7
+ interface DataTableProps<TData> extends HTMLAttributes<HTMLDivElement> {
8
+ columns: ColumnDef<TData>[];
9
9
  data: TData[];
10
10
  rowsCount?: number;
11
11
  pagination?: {
@@ -21,6 +21,6 @@ interface DataTableProps<TData, TValue> extends HTMLAttributes<HTMLDivElement> {
21
21
  rowsPerPageText?: string;
22
22
  ofText?: string;
23
23
  }
24
- declare function DataTable<TData, TValue>({ columns, data, rowsCount, pagination, onPaginationChange, noResults, rowsPerPageText, ofText, className, ...props }: DataTableProps<TData, TValue>): react_jsx_runtime.JSX.Element;
24
+ declare function DataTable<TData>({ columns, data, rowsCount, pagination, onPaginationChange, noResults, rowsPerPageText, ofText, className, ...props }: DataTableProps<TData>): react_jsx_runtime.JSX.Element;
25
25
 
26
26
  export { type ColumnDef, DataTable, type DataTableProps, type PaginationState, DataTable as default };
@@ -1,5 +1,4 @@
1
- export { DataTable, data_table_default as default } from './chunk-V2LMCQ4I.mjs';
2
- import './chunk-O5QOPJOD.mjs';
1
+ export { DataTable, data_table_default as default } from './chunk-3FWR5NYS.mjs';
3
2
  import './chunk-ZVOUAD54.mjs';
4
3
  import './chunk-P3UP2HUA.mjs';
5
4
  import './chunk-2MWIFYP3.mjs';
package/dist/index.css CHANGED
@@ -512,9 +512,6 @@ video {
512
512
  .animate-spin {
513
513
  animation: spin 1s linear infinite;
514
514
  }
515
- .cursor-default {
516
- cursor: default;
517
- }
518
515
  .cursor-not-allowed {
519
516
  cursor: not-allowed;
520
517
  }
@@ -556,9 +553,6 @@ video {
556
553
  .overflow-hidden {
557
554
  overflow: hidden;
558
555
  }
559
- .overflow-y-auto {
560
- overflow-y: auto;
561
- }
562
556
  .rounded {
563
557
  border-radius: 0.25rem;
564
558
  }
@@ -650,9 +644,6 @@ video {
650
644
  .p-4 {
651
645
  padding: 1rem;
652
646
  }
653
- .p-\[0\.625rem\] {
654
- padding: 0.625rem;
655
- }
656
647
  .px-1 {
657
648
  padding-left: 0.25rem;
658
649
  padding-right: 0.25rem;
@@ -862,10 +853,6 @@ video {
862
853
  .caret-neutral-900 {
863
854
  caret-color: #283331;
864
855
  }
865
- .outline-none {
866
- outline: 2px solid transparent;
867
- outline-offset: 2px;
868
- }
869
856
  .outline-0 {
870
857
  outline-width: 0px;
871
858
  }
package/dist/index.mjs CHANGED
@@ -6,8 +6,7 @@ export { Alert } from './chunk-XDQ2Y2UR.mjs';
6
6
  export { Button } from './chunk-4YE5CU7E.mjs';
7
7
  export { ChipForm } from './chunk-RZ2JP5UH.mjs';
8
8
  export { ChipStatus } from './chunk-WSAW6L2X.mjs';
9
- export { DataTable } from './chunk-V2LMCQ4I.mjs';
10
- import './chunk-O5QOPJOD.mjs';
9
+ export { DataTable } from './chunk-3FWR5NYS.mjs';
11
10
  export { ScrollArea, ScrollBar } from './chunk-ZVOUAD54.mjs';
12
11
  import './chunk-P3UP2HUA.mjs';
13
12
  export { IconButton } from './chunk-JVSF3AX2.mjs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sodtrack-web-ui",
3
- "version": "0.9.4",
3
+ "version": "0.9.6",
4
4
  "description": "UI components for Sodtrack Web",
5
5
  "exports": {
6
6
  "./dist/index.css": "./dist/index.css",
@@ -45,7 +45,6 @@
45
45
  "typescript": "^5.4.5"
46
46
  },
47
47
  "dependencies": {
48
- "@floating-ui/react": "^0.26.16",
49
48
  "@radix-ui/react-label": "^2.0.2",
50
49
  "@radix-ui/react-scroll-area": "^1.0.5",
51
50
  "@radix-ui/react-tabs": "^1.0.4",
@@ -1,143 +0,0 @@
1
- import { cn } from './chunk-P3UP2HUA.mjs';
2
- import { require_jsx_runtime } from './chunk-2MWIFYP3.mjs';
3
- import { ChevronDownIcon } from './chunk-ERH7LWVL.mjs';
4
- import { __toESM, require_react } from './chunk-PLJ6ZHAI.mjs';
5
- import { useFloating, autoUpdate, offset, flip, size, useClick, useDismiss, useRole, useListNavigation, useTypeahead, useInteractions, FloatingPortal, FloatingFocusManager } from '@floating-ui/react';
6
-
7
- // src/components/rows-per-page-select.tsx
8
- var React = __toESM(require_react());
9
- var import_jsx_runtime = __toESM(require_jsx_runtime());
10
- var options = ["10", "25", "50"];
11
- var RowsPerPageSelect = ({
12
- value,
13
- onRowsPerPageChange
14
- }) => {
15
- const [isOpen, setIsOpen] = React.useState(false);
16
- const [activeIndex, setActiveIndex] = React.useState(null);
17
- const [selectedIndex, setSelectedIndex] = React.useState(
18
- options.findIndex((option) => option === value)
19
- );
20
- const { refs, floatingStyles, context } = useFloating({
21
- placement: "bottom-start",
22
- open: isOpen,
23
- onOpenChange: setIsOpen,
24
- whileElementsMounted: autoUpdate,
25
- middleware: [
26
- offset(5),
27
- flip({ padding: 10 }),
28
- size({
29
- apply({ rects, elements, availableHeight }) {
30
- Object.assign(elements.floating.style, {
31
- maxHeight: `${availableHeight}px`,
32
- minWidth: `${rects.reference.width}px`
33
- });
34
- },
35
- padding: 10
36
- })
37
- ]
38
- });
39
- const listRef = React.useRef([]);
40
- const listContentRef = React.useRef(options);
41
- const isTypingRef = React.useRef(false);
42
- const click = useClick(context, { event: "mousedown" });
43
- const dismiss = useDismiss(context);
44
- const role = useRole(context, { role: "listbox" });
45
- const listNav = useListNavigation(context, {
46
- listRef,
47
- activeIndex,
48
- selectedIndex,
49
- onNavigate: setActiveIndex,
50
- // This is a large list, allow looping.
51
- loop: true
52
- });
53
- const typeahead = useTypeahead(context, {
54
- listRef: listContentRef,
55
- activeIndex,
56
- selectedIndex,
57
- onMatch: isOpen ? setActiveIndex : setSelectedIndex,
58
- onTypingChange(isTyping) {
59
- isTypingRef.current = isTyping;
60
- }
61
- });
62
- const { getReferenceProps, getFloatingProps, getItemProps } = useInteractions(
63
- [dismiss, role, listNav, typeahead, click]
64
- );
65
- const handleSelect = (index) => {
66
- onRowsPerPageChange(options[index]);
67
- setSelectedIndex(index);
68
- setIsOpen(false);
69
- };
70
- const selectedItemLabel = selectedIndex !== null ? options[selectedIndex] : void 0;
71
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { minWidth: "40px" }, children: [
72
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
73
- "div",
74
- {
75
- tabIndex: 0,
76
- ref: refs.setReference,
77
- "aria-labelledby": "select-label",
78
- "aria-autocomplete": "none",
79
- ...getReferenceProps(),
80
- className: "flex cursor-pointer items-center gap-1 text-sm leading-[120%] text-neutral-900",
81
- children: [
82
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: selectedItemLabel }),
83
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
84
- ChevronDownIcon,
85
- {
86
- width: "18px",
87
- height: "18px",
88
- className: "h-[1.125rem] w-[1.125rem] text-neutral-900"
89
- }
90
- )
91
- ]
92
- }
93
- ),
94
- isOpen && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FloatingPortal, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FloatingFocusManager, { context, modal: false, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
95
- "div",
96
- {
97
- ref: refs.setFloating,
98
- className: "overflow-y-auto rounded-lg bg-neutral-100 text-sm font-semibold leading-[120%] text-neutral-900 outline-none",
99
- style: {
100
- ...floatingStyles
101
- },
102
- ...getFloatingProps(),
103
- children: options.map((value2, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
104
- "div",
105
- {
106
- ref: (node) => {
107
- listRef.current[i] = node;
108
- },
109
- role: "option",
110
- tabIndex: i === activeIndex ? 0 : -1,
111
- "aria-selected": i === selectedIndex && i === activeIndex,
112
- className: cn(
113
- "cursor-default p-[0.625rem]",
114
- i === activeIndex && "bg-neutral-200"
115
- ),
116
- ...getItemProps({
117
- // Handle pointer select.
118
- onClick() {
119
- handleSelect(i);
120
- },
121
- // Handle keyboard select.
122
- onKeyDown(event) {
123
- if (event.key === "Enter") {
124
- event.preventDefault();
125
- handleSelect(i);
126
- }
127
- if (event.key === " " && !isTypingRef.current) {
128
- event.preventDefault();
129
- handleSelect(i);
130
- }
131
- }
132
- }),
133
- children: value2
134
- },
135
- value2
136
- ))
137
- }
138
- ) }) })
139
- ] });
140
- };
141
- var rows_per_page_select_default = RowsPerPageSelect;
142
-
143
- export { rows_per_page_select_default };
@@ -1,10 +0,0 @@
1
- import { FC } from 'react';
2
-
3
- declare const options: readonly ["10", "25", "50"];
4
- type RowsPerPageSelectProps = {
5
- value: (typeof options)[number];
6
- onRowsPerPageChange: (value: (typeof options)[number]) => void;
7
- };
8
- declare const RowsPerPageSelect: FC<RowsPerPageSelectProps>;
9
-
10
- export { RowsPerPageSelect as default };
@@ -1,5 +0,0 @@
1
- export { rows_per_page_select_default as default } from './chunk-O5QOPJOD.mjs';
2
- import './chunk-P3UP2HUA.mjs';
3
- import './chunk-2MWIFYP3.mjs';
4
- import './chunk-ERH7LWVL.mjs';
5
- import './chunk-PLJ6ZHAI.mjs';