@kreativa/ui 0.1.2 → 0.1.4
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/index.d.mts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -462,7 +462,7 @@ function Table({
|
|
|
462
462
|
}
|
|
463
463
|
|
|
464
464
|
// src/components/DataTable.tsx
|
|
465
|
-
import { useState as useState3, useMemo as useMemo3, useCallback as useCallback2 } from "react";
|
|
465
|
+
import { useState as useState3, useMemo as useMemo3, useCallback as useCallback2, useEffect as useEffect3 } from "react";
|
|
466
466
|
|
|
467
467
|
// src/components/Select.tsx
|
|
468
468
|
import { useState as useState2, useRef as useRef2, useEffect as useEffect2, useMemo as useMemo2 } from "react";
|
|
@@ -716,7 +716,9 @@ function DataTable({
|
|
|
716
716
|
showFilters = true,
|
|
717
717
|
initialSortKey,
|
|
718
718
|
initialSortDirection = "asc",
|
|
719
|
-
onFilteredDataChange
|
|
719
|
+
onFilteredDataChange,
|
|
720
|
+
resizable = false,
|
|
721
|
+
fixedLayout = false
|
|
720
722
|
}) {
|
|
721
723
|
const [filters, setFilters] = useState3({});
|
|
722
724
|
const [sortKey, setSortKey] = useState3(initialSortKey || null);
|
|
@@ -789,7 +791,7 @@ function DataTable({
|
|
|
789
791
|
});
|
|
790
792
|
return sortDirection === "desc" ? sorted.reverse() : sorted;
|
|
791
793
|
}, [filteredData, sortKey, sortDirection, columns]);
|
|
792
|
-
|
|
794
|
+
useEffect3(() => {
|
|
793
795
|
onFilteredDataChange?.(sortedData);
|
|
794
796
|
}, [sortedData, onFilteredDataChange]);
|
|
795
797
|
const handleSort = useCallback2((columnKey) => {
|
|
@@ -864,7 +866,9 @@ function DataTable({
|
|
|
864
866
|
getRowKey,
|
|
865
867
|
onRowClick,
|
|
866
868
|
loading,
|
|
867
|
-
emptyMessage
|
|
869
|
+
emptyMessage,
|
|
870
|
+
resizable,
|
|
871
|
+
fixedLayout
|
|
868
872
|
}
|
|
869
873
|
)
|
|
870
874
|
] });
|
|
@@ -993,7 +997,7 @@ function Tabs({
|
|
|
993
997
|
}
|
|
994
998
|
|
|
995
999
|
// src/components/DatePicker.tsx
|
|
996
|
-
import { useState as useState5, useRef as useRef3, useEffect as
|
|
1000
|
+
import { useState as useState5, useRef as useRef3, useEffect as useEffect4, useMemo as useMemo4 } from "react";
|
|
997
1001
|
import { jsx as jsx17, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
998
1002
|
var WEEKDAYS = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
|
|
999
1003
|
var MONTHS = [
|
|
@@ -1102,7 +1106,7 @@ function DatePicker({
|
|
|
1102
1106
|
const [hoverDate, setHoverDate] = useState5(null);
|
|
1103
1107
|
const containerRef = useRef3(null);
|
|
1104
1108
|
const [selectingEnd, setSelectingEnd] = useState5(false);
|
|
1105
|
-
|
|
1109
|
+
useEffect4(() => {
|
|
1106
1110
|
const handleClickOutside = (e) => {
|
|
1107
1111
|
if (containerRef.current && !containerRef.current.contains(e.target)) {
|
|
1108
1112
|
setIsOpen(false);
|
|
@@ -1303,7 +1307,7 @@ function DatePicker({
|
|
|
1303
1307
|
}
|
|
1304
1308
|
|
|
1305
1309
|
// src/components/Timer.tsx
|
|
1306
|
-
import { useState as useState6, useEffect as
|
|
1310
|
+
import { useState as useState6, useEffect as useEffect5, useCallback as useCallback3, useRef as useRef4 } from "react";
|
|
1307
1311
|
import { jsx as jsx18, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1308
1312
|
function formatTime(totalSeconds) {
|
|
1309
1313
|
const hours = Math.floor(totalSeconds / 3600);
|
|
@@ -1334,14 +1338,14 @@ function Timer({
|
|
|
1334
1338
|
const elapsedSeconds = isControlled ? controlledElapsedSeconds ?? 0 : internalElapsedSeconds;
|
|
1335
1339
|
const intervalRef = useRef4(null);
|
|
1336
1340
|
const startTimeRef = useRef4(null);
|
|
1337
|
-
|
|
1341
|
+
useEffect5(() => {
|
|
1338
1342
|
return () => {
|
|
1339
1343
|
if (intervalRef.current) {
|
|
1340
1344
|
clearInterval(intervalRef.current);
|
|
1341
1345
|
}
|
|
1342
1346
|
};
|
|
1343
1347
|
}, []);
|
|
1344
|
-
|
|
1348
|
+
useEffect5(() => {
|
|
1345
1349
|
if (isControlled) return;
|
|
1346
1350
|
if (isRunning) {
|
|
1347
1351
|
intervalRef.current = setInterval(() => {
|