@uva-glass/component-library 3.55.9 → 3.56.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/DataTable-C46IkAmF.js +154 -0
- package/dist/DataTable-C46IkAmF.js.map +1 -0
- package/dist/assets/DataTable.css +1 -0
- package/dist/components/Accordion/Accordion.test.js +1 -1
- package/dist/components/AccordionCard/AccordionCard.test.js +1 -1
- package/dist/components/ActionList/ActionList.test.js +1 -1
- package/dist/components/AppStatusBar/AppStatusBar.test.js +1 -1
- package/dist/components/Attention/Attention.test.js +1 -1
- package/dist/components/Backdrop/Backdrop.test.js +1 -1
- package/dist/components/Buttons/Button.test.js +1 -1
- package/dist/components/Buttons/LinkButton.test.js +1 -1
- package/dist/components/Buttons/MenuButton.test.js +1 -1
- package/dist/components/Card/Card.test.js +1 -1
- package/dist/components/Checkbox/Checkbox.test.js +1 -1
- package/dist/components/CheckboxButtonBar/CheckboxButtonBar.test.js +1 -1
- package/dist/components/DataTable/DataTable.d.ts +39 -0
- package/dist/components/DataTable/DataTable.js +2 -0
- package/dist/components/DataTable/DataTable.stories.d.ts +26 -0
- package/dist/components/DataTable/DataTable.stories.js +40349 -0
- package/dist/components/DataTable/DataTable.stories.js.map +1 -0
- package/dist/components/DataTable/hooks/useVirtualScroll.d.ts +14 -0
- package/dist/components/DataTable/hooks/useVirtualScroll.js +35 -0
- package/dist/components/DataTable/hooks/useVirtualScroll.js.map +1 -0
- package/dist/components/DataTable/index.d.ts +1 -0
- package/dist/components/DataTable/index.js +2 -0
- package/dist/components/DataTable/mockDataTableData.d.ts +39 -0
- package/dist/components/FeedbackBar/FeedbackBar.test.js +1 -1
- package/dist/components/Label/Label.test.js +1 -1
- package/dist/components/MultiSelectBox/MultiSelectBox.test.js +1 -1
- package/dist/components/Notification/Notification.test.js +1 -1
- package/dist/components/RadioGroup/Radiogroup.test.js +1 -1
- package/dist/components/StatusBadge/StatusBadge.test.js +1 -1
- package/dist/components/TextArea/TextArea.test.js +1 -1
- package/dist/components/VarIndicator/VarIndicator.test.js +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +43 -42
- package/dist/{dist-Cxk2-lJw.js → dist-Dlg0QxSO.js} +413 -193
- package/dist/dist-Dlg0QxSO.js.map +1 -0
- package/dist/index.js +43 -42
- package/dist/setupTests.js +9 -5
- package/dist/setupTests.js.map +1 -1
- package/package.json +1 -1
- package/dist/dist-Cxk2-lJw.js.map +0 -1
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { UIEvent } from 'react';
|
|
2
|
+
interface UseVirtualScrollProps {
|
|
3
|
+
rowHeight: number;
|
|
4
|
+
buffer?: number;
|
|
5
|
+
totalItems: number;
|
|
6
|
+
}
|
|
7
|
+
export declare function useVirtualScroll({ rowHeight, buffer, totalItems }: UseVirtualScrollProps): {
|
|
8
|
+
visibleItems: number[];
|
|
9
|
+
totalHeight: number;
|
|
10
|
+
offsetTop: number;
|
|
11
|
+
onScroll: (event: UIEvent<HTMLElement>) => void;
|
|
12
|
+
setContainerHeight: import('react').Dispatch<import('react').SetStateAction<number>>;
|
|
13
|
+
};
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { useCallback as e, useMemo as t, useState as n } from "react";
|
|
2
|
+
//#region src/components/DataTable/hooks/useVirtualScroll.tsx
|
|
3
|
+
var r = 2;
|
|
4
|
+
function i({ rowHeight: i, buffer: a = r, totalItems: o }) {
|
|
5
|
+
let [s, c] = n(0), [l, u] = n(0), { startIndex: d, endIndex: f } = t(() => {
|
|
6
|
+
if (i <= 0) return {
|
|
7
|
+
startIndex: 0,
|
|
8
|
+
endIndex: o - 1
|
|
9
|
+
};
|
|
10
|
+
let e = Math.ceil(l / i), t = Math.max(0, Math.floor(s / i) - a);
|
|
11
|
+
return {
|
|
12
|
+
startIndex: t,
|
|
13
|
+
endIndex: Math.min(o - 1, t + e + a * r)
|
|
14
|
+
};
|
|
15
|
+
}, [
|
|
16
|
+
s,
|
|
17
|
+
i,
|
|
18
|
+
o,
|
|
19
|
+
l,
|
|
20
|
+
a
|
|
21
|
+
]), p = o * i, m = d * i;
|
|
22
|
+
return {
|
|
23
|
+
visibleItems: t(() => Array.from({ length: f - d + 1 }, (e, t) => d + t), [d, f]),
|
|
24
|
+
totalHeight: p,
|
|
25
|
+
offsetTop: m,
|
|
26
|
+
onScroll: e((e) => {
|
|
27
|
+
c(e.currentTarget.scrollTop);
|
|
28
|
+
}, []),
|
|
29
|
+
setContainerHeight: u
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { i as useVirtualScroll };
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=useVirtualScroll.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useVirtualScroll.js","names":[],"sources":["../../../../src/components/DataTable/hooks/useVirtualScroll.tsx"],"sourcesContent":["import { useState, useMemo, useCallback } from 'react';\r\n\r\nimport type { UIEvent } from 'react';\r\n\r\nconst DOUBLE = 2;\r\n\r\ninterface UseVirtualScrollProps {\r\n rowHeight: number;\r\n buffer?: number;\r\n totalItems: number;\r\n}\r\n\r\nexport function useVirtualScroll({ rowHeight, buffer = DOUBLE, totalItems }: UseVirtualScrollProps) {\r\n const [scrollTop, setScrollTop] = useState(0);\r\n const [containerHeight, setContainerHeight] = useState(0);\r\n\r\n const { startIndex, endIndex } = useMemo(() => {\r\n if (rowHeight <= 0) {\r\n return { startIndex: 0, endIndex: totalItems - 1 };\r\n }\r\n\r\n const visibleItemsCount = Math.ceil(containerHeight / rowHeight);\r\n const start = Math.max(0, Math.floor(scrollTop / rowHeight) - buffer);\r\n const end = Math.min(totalItems - 1, start + visibleItemsCount + buffer * DOUBLE);\r\n return { startIndex: start, endIndex: end };\r\n }, [scrollTop, rowHeight, totalItems, containerHeight, buffer]);\r\n\r\n const totalHeight = totalItems * rowHeight;\r\n\r\n const offsetTop = startIndex * rowHeight;\r\n\r\n const visibleItems = useMemo(\r\n () => Array.from({ length: endIndex - startIndex + 1 }, (_, counter) => startIndex + counter),\r\n [startIndex, endIndex]\r\n );\r\n\r\n const onScroll = useCallback((event: UIEvent<HTMLElement>) => {\r\n setScrollTop(event.currentTarget.scrollTop);\r\n }, []);\r\n\r\n return {\r\n visibleItems,\r\n totalHeight,\r\n offsetTop,\r\n onScroll,\r\n setContainerHeight,\r\n };\r\n}\r\n"],"mappings":";;AAIA,IAAM,IAAS;AAQf,SAAgB,EAAiB,EAAE,cAAW,YAAS,GAAQ,iBAAqC;CAClG,IAAM,CAAC,GAAW,KAAgB,EAAS,CAAC,GACtC,CAAC,GAAiB,KAAsB,EAAS,CAAC,GAElD,EAAE,eAAY,gBAAa,QAAc;EAC7C,IAAI,KAAa,GACf,OAAO;GAAE,YAAY;GAAG,UAAU,IAAa;EAAE;EAGnD,IAAM,IAAoB,KAAK,KAAK,IAAkB,CAAS,GACzD,IAAQ,KAAK,IAAI,GAAG,KAAK,MAAM,IAAY,CAAS,IAAI,CAAM;EAEpE,OAAO;GAAE,YAAY;GAAO,UADhB,KAAK,IAAI,IAAa,GAAG,IAAQ,IAAoB,IAAS,CACpC;EAAI;CAC5C,GAAG;EAAC;EAAW;EAAW;EAAY;EAAiB;CAAM,CAAC,GAExD,IAAc,IAAa,GAE3B,IAAY,IAAa;CAW/B,OAAO;EACL,cAVmB,QACb,MAAM,KAAK,EAAE,QAAQ,IAAW,IAAa,EAAE,IAAI,GAAG,MAAY,IAAa,CAAO,GAC5F,CAAC,GAAY,CAAQ,CAQrB;EACA;EACA;EACA,UARe,GAAa,MAAgC;GAC5D,EAAa,EAAM,cAAc,SAAS;EAC5C,GAAG,CAAC,CAMF;EACA;CACF;AACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './DataTable';
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export const MOCK_DATA: ({
|
|
2
|
+
id: string;
|
|
3
|
+
first_name: string;
|
|
4
|
+
last_name: string;
|
|
5
|
+
email: string;
|
|
6
|
+
street: string;
|
|
7
|
+
street_number: string;
|
|
8
|
+
zipcode: string;
|
|
9
|
+
city: string;
|
|
10
|
+
country: string;
|
|
11
|
+
country_code: string;
|
|
12
|
+
trade: string;
|
|
13
|
+
language: string;
|
|
14
|
+
birthdate: string;
|
|
15
|
+
quote: string;
|
|
16
|
+
university: string;
|
|
17
|
+
appname: string;
|
|
18
|
+
appversion: string;
|
|
19
|
+
website: string;
|
|
20
|
+
} | {
|
|
21
|
+
id: string;
|
|
22
|
+
first_name: string;
|
|
23
|
+
last_name: string;
|
|
24
|
+
email: string;
|
|
25
|
+
street: string;
|
|
26
|
+
street_number: string;
|
|
27
|
+
zipcode: null;
|
|
28
|
+
city: string;
|
|
29
|
+
country: string;
|
|
30
|
+
country_code: string;
|
|
31
|
+
trade: string;
|
|
32
|
+
language: string;
|
|
33
|
+
birthdate: string;
|
|
34
|
+
quote: string;
|
|
35
|
+
university: string;
|
|
36
|
+
appname: string;
|
|
37
|
+
appversion: string;
|
|
38
|
+
website: string;
|
|
39
|
+
})[];
|
|
@@ -13,6 +13,7 @@ export * from './CheckboxTree';
|
|
|
13
13
|
export * from './Chip';
|
|
14
14
|
export * from './ControlsButton';
|
|
15
15
|
export * from './CopyableText';
|
|
16
|
+
export * from './DataTable';
|
|
16
17
|
export * from './Drawer';
|
|
17
18
|
export * from './EmptyStateDataDisplay';
|
|
18
19
|
export * from './ExpandableInfoPanel';
|
package/dist/components/index.js
CHANGED
|
@@ -19,45 +19,46 @@ import { t as _ } from "../ControlsButton-9uR_zW_F.js";
|
|
|
19
19
|
import { d as v, f as y, h as b, m as x, n as S, t as C, u as w } from "../components-D6_Sx8Hs.js";
|
|
20
20
|
import { t as T } from "../Chip-9XnXFhoJ.js";
|
|
21
21
|
import { t as E } from "../CopyableText-hSqhyUWx.js";
|
|
22
|
-
import { t as D } from "../
|
|
23
|
-
import { t as O } from "../
|
|
24
|
-
import { t as k } from "../
|
|
25
|
-
import { t as A } from "../
|
|
26
|
-
import { t as j } from "../
|
|
27
|
-
import { t as M } from "../
|
|
28
|
-
import { t as N } from "../
|
|
29
|
-
import { t as P } from "../
|
|
30
|
-
import { t as F } from "../
|
|
31
|
-
import { t as I } from "../
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import { t as z } from "../
|
|
35
|
-
import { t as B } from "../
|
|
36
|
-
import { t as V } from "../
|
|
37
|
-
import { t as H } from "../
|
|
38
|
-
import { t as U } from "../
|
|
39
|
-
import { t as W } from "../
|
|
40
|
-
import { t as G } from "../
|
|
41
|
-
import { t as K } from "../
|
|
42
|
-
import { t as q } from "../
|
|
43
|
-
import { t as J } from "../
|
|
44
|
-
import { t as Y } from "../
|
|
45
|
-
import { t as X } from "../
|
|
46
|
-
import { t as Z } from "../
|
|
47
|
-
import { t as Q } from "../
|
|
48
|
-
import { t as $ } from "../
|
|
49
|
-
import { t as ee } from "../
|
|
50
|
-
import { t as te } from "../
|
|
51
|
-
import {
|
|
52
|
-
import {
|
|
53
|
-
import {
|
|
54
|
-
import {
|
|
55
|
-
import {
|
|
56
|
-
import {
|
|
57
|
-
import { t as le } from "../
|
|
58
|
-
import { t as ue } from "../
|
|
59
|
-
import { t as de } from "../
|
|
60
|
-
import { t as fe } from "../
|
|
61
|
-
import { t as pe } from "../
|
|
62
|
-
import {
|
|
63
|
-
|
|
22
|
+
import { t as D } from "../DataTable-C46IkAmF.js";
|
|
23
|
+
import { t as O } from "../Drawer-BbVJqFQI.js";
|
|
24
|
+
import { t as k } from "../OverlayCloseButton-j-7mC4Zz.js";
|
|
25
|
+
import { t as A } from "../EmptyStateDataDisplay-IT2P3ius.js";
|
|
26
|
+
import { t as j } from "../ExpandableInfoPanel-DMfcJFP3.js";
|
|
27
|
+
import { t as M } from "../FeedbackBar-DRbJVniP.js";
|
|
28
|
+
import { t as N } from "../Repeater-Bnoqqz0X.js";
|
|
29
|
+
import { t as P } from "../FieldHint-FEBzgLI_.js";
|
|
30
|
+
import { t as F } from "../Spinner-BmPjd2Bv.js";
|
|
31
|
+
import { t as I } from "../Fieldset-D01_rj_p.js";
|
|
32
|
+
import { t as L } from "../FormField-CcV84TfI.js";
|
|
33
|
+
import { GridRow as R } from "./GridRow/GridRow.js";
|
|
34
|
+
import { t as z } from "../HorizontalList-CLlRGWZX.js";
|
|
35
|
+
import { t as B } from "../IconButton-CSNMVEG1.js";
|
|
36
|
+
import { t as V } from "../InfoBanner-DqBWtCVE.js";
|
|
37
|
+
import { t as H } from "../InfoMessage-COywXu4O.js";
|
|
38
|
+
import { t as U } from "../Input-BzKvzbzP.js";
|
|
39
|
+
import { t as W } from "../InputField-T01uazlI.js";
|
|
40
|
+
import { t as G } from "../MenuLink-La_3ANEL.js";
|
|
41
|
+
import { t as K } from "../MetaDataBar-48J7yPrb.js";
|
|
42
|
+
import { t as q } from "../MetaDataList-Co9WCexh.js";
|
|
43
|
+
import { t as J } from "../ModalDialog-J7xcPcnS.js";
|
|
44
|
+
import { t as Y } from "../MultiSelectBox-BmBxa6PH.js";
|
|
45
|
+
import { t as X } from "../Notification-BAqCenxt.js";
|
|
46
|
+
import { t as Z } from "../OverlayStepBar-Cj_-0waE.js";
|
|
47
|
+
import { t as Q } from "../PageOverlay-DqwdG5ve.js";
|
|
48
|
+
import { t as $ } from "../Periods-C5cxLlWt.js";
|
|
49
|
+
import { t as ee } from "../ProgrammeCard-CAAOSWKa.js";
|
|
50
|
+
import { t as te } from "../RadioButton-CKALsbBb.js";
|
|
51
|
+
import { t as ne } from "../RadioGroup-DhnnBRJu.js";
|
|
52
|
+
import { SearchField as re } from "./SearchField/SearchField.js";
|
|
53
|
+
import { SelectProvider as ie, useSelect as ae } from "./SelectListbox/SelectProvider.js";
|
|
54
|
+
import { SelectListbox as oe } from "./SelectListbox/SelectListbox.js";
|
|
55
|
+
import { t as se } from "../Slider-dCmT0VM2.js";
|
|
56
|
+
import { Sortable as ce } from "./Sortable/Sortable.js";
|
|
57
|
+
import { t as le } from "../StatusBage-CfEIuIPa.js";
|
|
58
|
+
import { t as ue } from "../StatusPill-CbJV4t-V.js";
|
|
59
|
+
import { t as de } from "../TextArea-GR2ZWwLh.js";
|
|
60
|
+
import { t as fe } from "../ToggleSwitch-b54K58vY.js";
|
|
61
|
+
import { t as pe } from "../Tooltip-DvkGwn4j.js";
|
|
62
|
+
import { t as me } from "../VarIndicator-DoMWwSUm.js";
|
|
63
|
+
import { WeekSelector as he } from "./WeekSelector/WeekSelector.js";
|
|
64
|
+
export { e as Accordion, n as AccordionCard, r as ActionList, s as AppStatusBar, c as Attention, l as Backdrop, i as Button, u as ButtonGroup, d as Card, p as Checkbox, m as CheckboxButtonBar, b as CheckboxTree, T as Chip, _ as ControlsButton, E as CopyableText, D as DataTable, O as Drawer, A as EmptyStateDataDisplay, j as ExpandableInfoPanel, M as FeedbackBar, g as FeedbackBox, P as FieldHint, I as Fieldset, L as FormField, x as FormInput, R as GridRow, z as HorizontalList, t as Icon, B as IconButton, V as InfoBanner, H as InfoMessage, U as Input, W as InputField, h as Label, a as LinkButton, o as MenuButton, G as MenuLink, K as MetaDataBar, q as MetaDataList, J as ModalDialog, y as MultiSelect, Y as MultiSelectBox, X as Notification, k as OverlayCloseButton, Z as OverlayStepBar, Q as PageOverlay, v as PeriodSelector, $ as Periods, ee as ProgrammeCard, te as RadioButton, ne as RadioGroup, w as RadioTabSelector, N as Repeater, C as Rte, S as RteEditor, re as SearchField, f as SectionNotification, oe as SelectListbox, ie as SelectProvider, se as Slider, ce as Sortable, F as Spinner, le as StatusBadge, ue as StatusPill, de as TextArea, fe as ToggleSwitch, pe as Tooltip, me as VarIndicator, he as WeekSelector, ae as useSelect };
|