@public-ui/sample-react 4.3.1-rc.1 → 4.3.1-rc.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.
Files changed (169) hide show
  1. package/package.json +10 -10
  2. package/src/App.tsx +2 -0
  3. package/src/components/InputEventValueDemo.tsx +6 -3
  4. package/src/components/SampleBlock.tsx +81 -0
  5. package/src/components/SampleGroup.tsx +27 -0
  6. package/src/components/abbr/basic.tsx +6 -3
  7. package/src/components/accordion/basic.tsx +3 -2
  8. package/src/components/accordion/headlines.tsx +3 -2
  9. package/src/components/alert/basic.tsx +17 -14
  10. package/src/components/avatar/basic.tsx +3 -2
  11. package/src/components/avatar/size.tsx +3 -2
  12. package/src/components/badge/basic.tsx +48 -7
  13. package/src/components/badge/routes.ts +0 -4
  14. package/src/components/breadcrumb/basic.tsx +3 -2
  15. package/src/components/button/access-key.tsx +8 -10
  16. package/src/components/button/aria-description.tsx +4 -4
  17. package/src/components/button/baselined.tsx +4 -4
  18. package/src/components/button/basic.tsx +10 -17
  19. package/src/components/button/disabled.tsx +6 -7
  20. package/src/components/button/expert-slot.tsx +6 -7
  21. package/src/components/button/focus-options.tsx +8 -10
  22. package/src/components/button/hide-label.tsx +8 -10
  23. package/src/components/button/icons.tsx +12 -16
  24. package/src/components/button/row-reverse-tooltip.tsx +4 -4
  25. package/src/components/button/short-key.tsx +15 -20
  26. package/src/components/button/spinner.tsx +6 -7
  27. package/src/components/button/variants.tsx +6 -6
  28. package/src/components/button/width.tsx +6 -7
  29. package/src/components/button-link/aria-description.tsx +3 -2
  30. package/src/components/button-link/basic.tsx +37 -35
  31. package/src/components/button-link/icons.tsx +13 -2
  32. package/src/components/button-link/image.tsx +3 -2
  33. package/src/components/card/basic.tsx +3 -2
  34. package/src/components/card/headlines.tsx +3 -2
  35. package/src/components/card/linked.tsx +3 -2
  36. package/src/components/combobox/partials/cases.tsx +40 -14
  37. package/src/components/combobox/partials/variants.tsx +7 -8
  38. package/src/components/details/basic.tsx +3 -2
  39. package/src/components/form/basic.tsx +5 -4
  40. package/src/components/form/error-list-scroll.tsx +87 -0
  41. package/src/components/form/error-list.tsx +56 -56
  42. package/src/components/form/routes.ts +2 -0
  43. package/src/components/heading/badged.tsx +3 -2
  44. package/src/components/heading/basic.tsx +3 -2
  45. package/src/components/heading/paragraph.tsx +3 -2
  46. package/src/components/heading/secondary.tsx +3 -2
  47. package/src/components/icon/all-kolicons.tsx +1 -1
  48. package/src/components/icon/basic.tsx +6 -6
  49. package/src/components/icon/font.tsx +21 -13
  50. package/src/components/image/basic.tsx +8 -5
  51. package/src/components/input-checkbox/partials/cases.tsx +75 -14
  52. package/src/components/input-checkbox/partials/variants.tsx +13 -16
  53. package/src/components/input-color/partials/cases.tsx +61 -18
  54. package/src/components/input-color/partials/variants.tsx +7 -8
  55. package/src/components/input-date/partials/cases.tsx +70 -26
  56. package/src/components/input-date/partials/minMax.tsx +38 -11
  57. package/src/components/input-date/partials/variants.tsx +10 -12
  58. package/src/components/input-email/partials/cases.tsx +69 -30
  59. package/src/components/input-email/partials/variants.tsx +7 -8
  60. package/src/components/input-file/partials/cases.tsx +58 -24
  61. package/src/components/input-file/partials/variants.tsx +7 -8
  62. package/src/components/input-number/number-formatter.tsx +5 -4
  63. package/src/components/input-number/partials/cases.tsx +68 -28
  64. package/src/components/input-number/partials/variants.tsx +7 -8
  65. package/src/components/input-password/partials/cases.tsx +67 -30
  66. package/src/components/input-password/partials/variants.tsx +7 -8
  67. package/src/components/input-password/show-password.tsx +22 -19
  68. package/src/components/input-radio/horizontal.tsx +3 -2
  69. package/src/components/input-radio/objectValue.tsx +5 -4
  70. package/src/components/input-radio/partials/cases.tsx +85 -55
  71. package/src/components/input-radio/partials/variants.tsx +7 -9
  72. package/src/components/input-range/partials/cases.tsx +60 -23
  73. package/src/components/input-range/partials/variants.tsx +7 -8
  74. package/src/components/input-text/access-short-key.tsx +11 -4
  75. package/src/components/input-text/aria-details.tsx +3 -2
  76. package/src/components/input-text/background-test.tsx +7 -5
  77. package/src/components/input-text/basic.tsx +24 -5
  78. package/src/components/input-text/clear-button.tsx +26 -0
  79. package/src/components/input-text/counter.tsx +3 -2
  80. package/src/components/input-text/disabled.tsx +11 -4
  81. package/src/components/input-text/expert-slot.tsx +13 -8
  82. package/src/components/input-text/hide-label.tsx +7 -6
  83. package/src/components/input-text/hide-msg.tsx +5 -4
  84. package/src/components/input-text/message-types.tsx +13 -4
  85. package/src/components/input-text/msg-and-counter.tsx +9 -4
  86. package/src/components/input-text/pattern.tsx +18 -15
  87. package/src/components/input-text/placeholder.tsx +13 -4
  88. package/src/components/input-text/readonly.tsx +11 -4
  89. package/src/components/input-text/routes.ts +2 -0
  90. package/src/components/input-text/select-range.tsx +3 -2
  91. package/src/components/input-text/smart-button.tsx +7 -4
  92. package/src/components/input-text/text-formatter.tsx +5 -4
  93. package/src/components/input-text/variant.tsx +8 -6
  94. package/src/components/kolibri/basic.tsx +9 -6
  95. package/src/components/link/basic.tsx +3 -2
  96. package/src/components/link/icons.tsx +3 -2
  97. package/src/components/link/image.tsx +3 -2
  98. package/src/components/link/target.tsx +3 -2
  99. package/src/components/link/variant.tsx +5 -4
  100. package/src/components/link-button/aria-description.tsx +7 -1
  101. package/src/components/link-button/basic.tsx +5 -4
  102. package/src/components/link-button/routes.ts +2 -0
  103. package/src/components/link-button/target.tsx +19 -0
  104. package/src/components/meter/basic.tsx +4 -4
  105. package/src/components/meter/dynamic.tsx +4 -4
  106. package/src/components/meter/optimum.tsx +8 -10
  107. package/src/components/meter/orientation.tsx +6 -7
  108. package/src/components/nav/aria-current.tsx +18 -15
  109. package/src/components/nav/basic.tsx +8 -10
  110. package/src/components/pagination/basic.tsx +3 -2
  111. package/src/components/pagination/button-visibility.tsx +16 -11
  112. package/src/components/pagination/sibling-boundary.tsx +3 -2
  113. package/src/components/popover-button/inline.tsx +4 -5
  114. package/src/components/progress/basic.tsx +7 -6
  115. package/src/components/quote/basic.tsx +4 -1
  116. package/src/components/quote/block.tsx +9 -6
  117. package/src/components/select/partials/cases.tsx +73 -33
  118. package/src/components/select/partials/variants.tsx +7 -8
  119. package/src/components/single-select/partials/cases.tsx +148 -114
  120. package/src/components/single-select/partials/variants.tsx +7 -8
  121. package/src/components/spin/basic.tsx +34 -3
  122. package/src/components/spin/routes.ts +0 -8
  123. package/src/components/split-button/basic.tsx +3 -2
  124. package/src/components/table/action-columns.tsx +3 -2
  125. package/src/components/table/column-alignment.tsx +3 -2
  126. package/src/components/table/complex-headers.tsx +3 -2
  127. package/src/components/table/empty.tsx +31 -0
  128. package/src/components/table/horizontal-scrollbar.tsx +24 -19
  129. package/src/components/table/multi-sort.tsx +6 -7
  130. package/src/components/table/non-hidable-columns.tsx +18 -15
  131. package/src/components/table/pagination-position.tsx +8 -10
  132. package/src/components/table/routes.ts +4 -0
  133. package/src/components/table/sort-data.tsx +6 -7
  134. package/src/components/table/stateful-async.tsx +50 -0
  135. package/src/components/table/stateful-with-selection.tsx +3 -2
  136. package/src/components/table/stateful-with-single-selection.tsx +3 -2
  137. package/src/components/table/stateless-async-paging.tsx +9 -32
  138. package/src/components/table/stateless-with-selection.tsx +3 -2
  139. package/src/components/table/stateless-with-single-selection.tsx +3 -2
  140. package/src/components/table/stateless.tsx +3 -2
  141. package/src/components/table/sticky-col.tsx +12 -10
  142. package/src/components/table/sticky-header.tsx +12 -10
  143. package/src/components/table/variant.tsx +5 -4
  144. package/src/components/table/with-footer.tsx +73 -70
  145. package/src/components/table/with-pagination.tsx +3 -2
  146. package/src/components/tabs/basic.tsx +17 -12
  147. package/src/components/tabs/create-button.tsx +11 -8
  148. package/src/components/tabs/icons-only.tsx +9 -6
  149. package/src/components/textarea/adjust-height.tsx +6 -3
  150. package/src/components/textarea/partials/cases.tsx +63 -15
  151. package/src/components/textarea/partials/variants.tsx +7 -8
  152. package/src/components/textarea/resize.tsx +3 -2
  153. package/src/components/textarea/rows.tsx +6 -3
  154. package/src/components/textarea/with-counter.tsx +3 -2
  155. package/src/components/toolbar/basic.tsx +6 -5
  156. package/src/components/toolbar/disabled.tsx +41 -38
  157. package/src/components/tree/basic.tsx +32 -29
  158. package/src/components/version/basic.tsx +4 -1
  159. package/src/components/version/context.tsx +8 -5
  160. package/src/hooks/useVisualBlockOutline.ts +38 -0
  161. package/src/scenarios/button-shortkey-table.tsx +4 -4
  162. package/src/shares/store.ts +0 -4
  163. package/src/shares/visualBlockOutline.ts +75 -0
  164. package/src/components/badge/button.tsx +0 -35
  165. package/src/components/badge/formatted-label.tsx +0 -19
  166. package/src/components/spin/custom.tsx +0 -23
  167. package/src/components/spin/cycle.tsx +0 -16
  168. package/src/components/spin/label.tsx +0 -23
  169. package/src/components/spin/variables.tsx +0 -16
@@ -3,6 +3,7 @@ import React from 'react';
3
3
 
4
4
  import { KolHeading, KolTableStateful } from '@public-ui/react-v19';
5
5
 
6
+ import { SampleBlock } from '../SampleBlock';
6
7
  import { SampleDescription } from '../SampleDescription';
7
8
 
8
9
  const DATA = [{ left: 'Left Example', center: 'Center Example', right: 'Right Example' }];
@@ -14,7 +15,7 @@ export const TableColumnAlignment: FC = () => (
14
15
  <p>This sample shows KolTableStateful with columns headers and data in different text alignments.</p>
15
16
  </SampleDescription>
16
17
 
17
- <section className="w-full flex flex-col">
18
+ <SampleBlock id="column-alignment" className="w-full flex flex-col" fitContent>
18
19
  <KolHeading _label="Simple table" _level={3}></KolHeading>
19
20
  <KolTableStateful
20
21
  _label="Table for demonstration purposes with different text align properties"
@@ -83,6 +84,6 @@ export const TableColumnAlignment: FC = () => (
83
84
  className="block"
84
85
  style={{ maxWidth: '600px' }}
85
86
  />
86
- </section>
87
+ </SampleBlock>
87
88
  </>
88
89
  );
@@ -1,6 +1,7 @@
1
1
  import { KolTableStateful } from '@public-ui/react-v19';
2
2
  import type { FC } from 'react';
3
3
  import React from 'react';
4
+ import { SampleBlock } from '../SampleBlock';
4
5
  import { SampleDescription } from '../SampleDescription';
5
6
 
6
7
  export const TableComplexHeaders: FC = () => (
@@ -9,7 +10,7 @@ export const TableComplexHeaders: FC = () => (
9
10
  <p>This sample shows KolTableStateful using vertical and horizontal headers, applying colspan and rowspan.</p>
10
11
  </SampleDescription>
11
12
 
12
- <section className="w-full flex flex-col">
13
+ <SampleBlock id="complex-headers" className="w-full flex flex-col">
13
14
  <KolTableStateful
14
15
  _label="Business hours"
15
16
  _data={[
@@ -127,6 +128,6 @@ export const TableComplexHeaders: FC = () => (
127
128
  ],
128
129
  }}
129
130
  />
130
- </section>
131
+ </SampleBlock>
131
132
  </>
132
133
  );
@@ -0,0 +1,31 @@
1
+ import type { KoliBriTableHeaders } from '@public-ui/components';
2
+ import { KolTableStateful } from '@public-ui/react-v19';
3
+ import type { FC } from 'react';
4
+ import React from 'react';
5
+ import { SampleDescription } from '../SampleDescription';
6
+
7
+ const HEADERS_HORIZONTAL: KoliBriTableHeaders = {
8
+ horizontal: [
9
+ [
10
+ { label: 'ID', key: 'id', textAlign: 'right', width: 160, sortDirection: 'NOS' },
11
+ { label: 'Common name', key: 'common_name', textAlign: 'left', width: 160, sortDirection: 'NOS' },
12
+ { label: 'Scientific name', key: 'scientific_name', textAlign: 'left', width: 160, sortDirection: 'NOS' },
13
+ { label: 'Conservation status', key: 'conservation_status', textAlign: 'left', width: 160, sortDirection: 'NOS' },
14
+ { label: 'Habitat', key: 'habitat', textAlign: 'left', width: 160, sortDirection: 'NOS' },
15
+ { label: 'Diet', key: 'diet', textAlign: 'left', width: 160, sortDirection: 'NOS' },
16
+ { label: 'Geographic range', key: 'geographic_range', textAlign: 'left', width: 160, sortDirection: 'NOS' },
17
+ ],
18
+ ],
19
+ };
20
+
21
+ export const TableEmpty: FC = () => {
22
+ return (
23
+ <>
24
+ <SampleDescription>
25
+ <p>This sample shows an empty KolTableStateful.</p>
26
+ </SampleDescription>
27
+
28
+ <KolTableStateful _label="Table for demonstration purposes" _headers={HEADERS_HORIZONTAL} _data={[]} />
29
+ </>
30
+ );
31
+ };
@@ -3,6 +3,7 @@ import React, { useState } from 'react';
3
3
 
4
4
  import { KolHeading, KolInputCheckbox, KolTableStateful } from '@public-ui/react-v19';
5
5
 
6
+ import { SampleBlock } from '../SampleBlock';
6
7
  import { SampleDescription } from '../SampleDescription';
7
8
  import { DATE_FORMATTER } from './formatter';
8
9
  import type { Data } from './test-data';
@@ -58,39 +59,43 @@ export const TableHorizontalScrollbar: FC = () => {
58
59
  </p>
59
60
  </SampleDescription>
60
61
 
61
- <section className="w-full flex flex-col gap-4">
62
- <div className="w-[400px] flex flex-col gap-4">
62
+ <div className="w-[400px] flex flex-col gap-4">
63
+ <SampleBlock id="scrollbar-horizontal" className="w-full flex flex-col gap-4">
63
64
  <KolTableStateful
64
65
  _label="Table for demonstration purposes with horizontal scrollbar."
65
66
  _headers={hasWidthRestriction ? HEADERS : COMPACT_HEADERS}
66
67
  _data={DATA}
67
68
  className="block"
68
69
  />
69
- <KolTableStateful _label="Table for demonstration horizontal scrolling with pagination." _headers={ORDER_HEADERS} _data={tableData} _pagination />
70
+ </SampleBlock>
71
+ <KolTableStateful _label="Table for demonstration horizontal scrolling with pagination." _headers={ORDER_HEADERS} _data={tableData} _pagination />
72
+ <SampleBlock id="scrollbar-horizontal-empty" className="w-full flex flex-col gap-4">
70
73
  <KolTableStateful
71
74
  _label="Table for demonstration purposes with horizontal scrollbar with auto width calculation."
72
75
  _headers={hasWidthRestriction ? HEADERS : COMPACT_HEADERS}
73
76
  _data={[]}
74
77
  className="block"
75
78
  />
76
- </div>
79
+ </SampleBlock>
80
+ </div>
77
81
 
78
- <KolInputCheckbox
79
- _checked={hasWidthRestriction}
80
- _label="Toggle width restriction"
81
- _variant="switch"
82
- _on={{
83
- onChange: (_event, value) => {
84
- setHasWidthRestriction(Boolean(value));
85
- },
86
- }}
87
- ></KolInputCheckbox>
82
+ <KolInputCheckbox
83
+ _checked={hasWidthRestriction}
84
+ _label="Toggle width restriction"
85
+ _variant="switch"
86
+ _on={{
87
+ onChange: (_event, value) => {
88
+ setHasWidthRestriction(Boolean(value));
89
+ },
90
+ }}
91
+ ></KolInputCheckbox>
88
92
 
89
- <KolHeading _label="Same table without scrollbar" _level={2} className="block mt-4" />
90
- <p className="mt-0">
91
- <i>Scrollbar appears on very small viewport sizes</i>
92
- </p>
93
+ <KolHeading _label="Same table without scrollbar" _level={2} className="block mt-4" />
94
+ <p className="mt-0">
95
+ <i>Scrollbar appears on very small viewport sizes</i>
96
+ </p>
93
97
 
98
+ <SampleBlock id="scrollbar-horizontal-large" className="w-full flex flex-col gap-4" skipSnapshot>
94
99
  <KolTableStateful
95
100
  _label="Table for demonstration purposes without horizontal scrollbar"
96
101
  _headers={HEADERS}
@@ -98,7 +103,7 @@ export const TableHorizontalScrollbar: FC = () => {
98
103
  className="block"
99
104
  _pagination
100
105
  />
101
- </section>
106
+ </SampleBlock>
102
107
  </>
103
108
  );
104
109
  };
@@ -2,7 +2,8 @@ import type { FC } from 'react';
2
2
  import React, { useState } from 'react';
3
3
 
4
4
  import type { KoliBriTableDataType, KoliBriTableHeaderCellWithLogic, KoliBriTableHeaders } from '@public-ui/components';
5
- import { KolButtonLink, KolHeading, KolTableStateful } from '@public-ui/react-v19';
5
+ import { KolButtonLink, KolTableStateful } from '@public-ui/react-v19';
6
+ import { SampleBlock } from '../SampleBlock';
6
7
  import { SampleDescription } from '../SampleDescription';
7
8
 
8
9
  const DATE_FORMATTER = Intl.DateTimeFormat('de-DE', {
@@ -125,8 +126,7 @@ export const MultiSortTable: FC = () => {
125
126
  </SampleDescription>
126
127
 
127
128
  <section className="w-full grid gap-6">
128
- <section className="grid gap-4">
129
- <KolHeading _level={2} _label="Vertical" />
129
+ <SampleBlock id="vertical" heading="Vertical">
130
130
  <KolButtonLink _label="Reset Table" _on={{ onClick: () => setVerticalHeader({ vertical: [[...TABLE_HEADER_CELLS]] }) }}></KolButtonLink>
131
131
  <KolTableStateful
132
132
  _label="Sort Table with Order and Date"
@@ -135,12 +135,11 @@ export const MultiSortTable: FC = () => {
135
135
  className="block"
136
136
  _allowMultiSort={true}
137
137
  />
138
- </section>
139
- <section className="grid gap-4">
140
- <KolHeading _level={2} _label="Horizontal" />
138
+ </SampleBlock>
139
+ <SampleBlock id="horizontal" heading="Horizontal">
141
140
  <KolButtonLink _label="Reset Table" _on={{ onClick: () => setHorizontalHeader({ horizontal: [[...TABLE_HEADER_CELLS]] }) }}></KolButtonLink>
142
141
  <KolTableStateful _label="Sort Table with Order and Date" _data={BACKLOG_DATA} _headers={horizontalHeader} className="block" _allowMultiSort={true} />
143
- </section>
142
+ </SampleBlock>
144
143
  </section>
145
144
  </>
146
145
  );
@@ -1,6 +1,7 @@
1
1
  import { KolTableStateful } from '@public-ui/react-v19';
2
2
  import type { FC } from 'react';
3
3
  import React from 'react';
4
+ import { SampleBlock } from '../SampleBlock';
4
5
  import { SampleDescription } from '../SampleDescription';
5
6
 
6
7
  const DATA = [
@@ -14,21 +15,23 @@ export const TableNonHidableColumns: FC = () => (
14
15
  <p>This example demonstrates a column that cannot be hidden in the settings.</p>
15
16
  </SampleDescription>
16
17
 
17
- <KolTableStateful
18
- _label="Table with a non-hidable column"
19
- _hasSettingsMenu
20
- _headers={{
21
- horizontal: [
22
- [
23
- { key: 'id', label: 'ID', hidable: false, width: 160 },
24
- { key: 'name', label: 'Name', width: 160 },
25
- { key: 'age', label: 'Age', width: 160 },
18
+ <SampleBlock id="non-hidable" fitContent>
19
+ <KolTableStateful
20
+ _label="Table with a non-hidable column"
21
+ _hasSettingsMenu
22
+ _headers={{
23
+ horizontal: [
24
+ [
25
+ { key: 'id', label: 'ID', hidable: false, width: 160 },
26
+ { key: 'name', label: 'Name', width: 160 },
27
+ { key: 'age', label: 'Age', width: 160 },
28
+ ],
26
29
  ],
27
- ],
28
- }}
29
- _data={DATA}
30
- className="block"
31
- style={{ maxWidth: '600px' }}
32
- />
30
+ }}
31
+ _data={DATA}
32
+ className="block"
33
+ style={{ maxWidth: '600px' }}
34
+ />
35
+ </SampleBlock>
33
36
  </>
34
37
  );
@@ -1,8 +1,9 @@
1
1
  import type { FC } from 'react';
2
2
  import React from 'react';
3
3
 
4
- import { KolHeading, KolTableStateful } from '@public-ui/react-v19';
4
+ import { KolTableStateful } from '@public-ui/react-v19';
5
5
 
6
+ import { SampleBlock } from '../SampleBlock';
6
7
  import { SampleDescription } from '../SampleDescription';
7
8
  import { DATE_FORMATTER } from './formatter';
8
9
  import type { Data } from './test-data';
@@ -26,8 +27,7 @@ export const PaginationPosition: FC = () => (
26
27
  </SampleDescription>
27
28
 
28
29
  <section className="w-full flex flex-col gap-14">
29
- <section className="grid gap-4">
30
- <KolHeading _level={2} _label="Table with pagination at the bottom."></KolHeading>
30
+ <SampleBlock id="bottom" heading="Table with pagination at the bottom.">
31
31
  <KolTableStateful
32
32
  _label="Sample table with pagination at the bottom"
33
33
  _data={DATA}
@@ -44,9 +44,8 @@ export const PaginationPosition: FC = () => (
44
44
  _paginationPosition="bottom"
45
45
  _variant="small"
46
46
  ></KolTableStateful>
47
- </section>
48
- <section className="grid gap-4">
49
- <KolHeading _level={2} _label="Table with pagination at the top."></KolHeading>
47
+ </SampleBlock>
48
+ <SampleBlock id="top" heading="Table with pagination at the top.">
50
49
  <KolTableStateful
51
50
  _label="Sample table with pagination at the top"
52
51
  _data={DATA}
@@ -62,9 +61,8 @@ export const PaginationPosition: FC = () => (
62
61
  }}
63
62
  _paginationPosition="top"
64
63
  ></KolTableStateful>
65
- </section>
66
- <section className="grid gap-4">
67
- <KolHeading _level={2} _label="Table with pagination at both top and bottom."></KolHeading>
64
+ </SampleBlock>
65
+ <SampleBlock id="both" heading="Table with pagination at both top and bottom.">
68
66
  <KolTableStateful
69
67
  _label="Sample table with pagination at both top and bottom"
70
68
  _data={DATA}
@@ -80,7 +78,7 @@ export const PaginationPosition: FC = () => (
80
78
  }}
81
79
  _paginationPosition="both"
82
80
  ></KolTableStateful>
83
- </section>
81
+ </SampleBlock>
84
82
  </section>
85
83
  </div>
86
84
  );
@@ -7,6 +7,7 @@ import { TableBig } from './big-table';
7
7
  import { TableColumnAlignment } from './column-alignment';
8
8
  import { TableComplexHeaders } from './complex-headers';
9
9
  import { TableDirectionAwareSort } from './direction-aware-sort';
10
+ import { TableEmpty } from './empty';
10
11
  import { TableHighlightRow } from './highlight-row';
11
12
  import { TableHorizontalScrollbar } from './horizontal-scrollbar';
12
13
  import { InteractiveChildElements } from './interactive-child-elements';
@@ -17,6 +18,7 @@ import { PredefinedSettings } from './predefined-settings';
17
18
  import { TableRenderCell } from './render-cell';
18
19
  import { TableSettingsColumnOptions } from './settings-column-options';
19
20
  import { TableSortData } from './sort-data';
21
+ import { TableStatefulAsync } from './stateful-async';
20
22
  import { TableStatefulExport } from './stateful-export';
21
23
  import { TableStatefulResetSort } from './stateful-reset-sort';
22
24
  import { TableStatefulSettingsPersistence } from './stateful-settings-persistence';
@@ -37,6 +39,7 @@ export const TABLE_ROUTES: Routes = {
37
39
  table: {
38
40
  'column-alignment': TableColumnAlignment,
39
41
  'complex-headers': TableComplexHeaders,
42
+ empty: TableEmpty,
40
43
  'horizontal-scrollbar': TableHorizontalScrollbar,
41
44
  'interactive-child-elements': InteractiveChildElements,
42
45
  'multi-sort': MultiSortTable,
@@ -50,6 +53,7 @@ export const TABLE_ROUTES: Routes = {
50
53
  'settings-column-options': TableSettingsColumnOptions,
51
54
  'sort-data': TableSortData,
52
55
  'direction-aware-sort': TableDirectionAwareSort,
56
+ 'stateful-async': TableStatefulAsync,
53
57
  'stateful-export': TableStatefulExport,
54
58
  'stateful-reset-sort': TableStatefulResetSort,
55
59
  'stateful-settings-persistence': TableStatefulSettingsPersistence,
@@ -2,7 +2,8 @@ import type { FC } from 'react';
2
2
  import React from 'react';
3
3
 
4
4
  import type { KoliBriTableDataType, KoliBriTableHeaders } from '@public-ui/components';
5
- import { KolHeading, KolTableStateful } from '@public-ui/react-v19';
5
+ import { KolTableStateful } from '@public-ui/react-v19';
6
+ import { SampleBlock } from '../SampleBlock';
6
7
  import { SampleDescription } from '../SampleDescription';
7
8
  import type { Data } from './test-data';
8
9
  import { DATA } from './test-data';
@@ -61,14 +62,12 @@ export const TableSortData: FC = () => (
61
62
  </SampleDescription>
62
63
 
63
64
  <section className="w-full grid gap-4">
64
- <section className="grid gap-4">
65
- <KolHeading _level={2} _label="Vertical headers" />
65
+ <SampleBlock id="vertical-headers" heading="Vertical headers">
66
66
  <KolTableStateful _label="Sort a date column" _data={DATA.slice(0, 10)} _headers={HEADERS_VERTICAL} className="block" />
67
- </section>
68
- <section className="grid gap-4">
69
- <KolHeading _level={2} _label="Horizontal headers" />
67
+ </SampleBlock>
68
+ <SampleBlock id="horizontal-headers" heading="Horizontal headers">
70
69
  <KolTableStateful _label="Sort a date column" _data={DATA} _headers={HEADERS_HORIZONTAL} className="block" />
71
- </section>
70
+ </SampleBlock>
72
71
  </section>
73
72
  </>
74
73
  );
@@ -0,0 +1,50 @@
1
+ import type { KoliBriTableHeaders } from '@public-ui/components';
2
+ import { KolTableStateful } from '@public-ui/react-v19';
3
+ import type { FC } from 'react';
4
+ import React, { useEffect, useState } from 'react';
5
+ import { SampleDescription } from '../SampleDescription';
6
+
7
+ import type { ComplexData } from './test-complex-data';
8
+ import { COMPLEX_DATA } from './test-complex-data';
9
+
10
+ const HEADERS_HORIZONTAL: KoliBriTableHeaders = {
11
+ horizontal: [
12
+ [
13
+ { label: 'ID', key: 'id', textAlign: 'right', width: 160, sortDirection: 'NOS' },
14
+ { label: 'Common name', key: 'common_name', textAlign: 'left', width: 160, sortDirection: 'NOS' },
15
+ { label: 'Scientific name', key: 'scientific_name', textAlign: 'left', width: 160, sortDirection: 'NOS' },
16
+ { label: 'Conservation status', key: 'conservation_status', textAlign: 'left', width: 160, sortDirection: 'NOS' },
17
+ { label: 'Habitat', key: 'habitat', textAlign: 'left', width: 160, sortDirection: 'NOS' },
18
+ { label: 'Diet', key: 'diet', textAlign: 'left', width: 160, sortDirection: 'NOS' },
19
+ { label: 'Geographic range', key: 'geographic_range', textAlign: 'left', width: 160, sortDirection: 'NOS' },
20
+ ],
21
+ ],
22
+ };
23
+
24
+ export const TableStatefulAsync: FC = () => {
25
+ const getAsyncData = () => new Promise<{ COMPLEX_DATA: ComplexData[] }>((resolve) => setTimeout(() => resolve({ COMPLEX_DATA }), 50000));
26
+ const loadData = () => {
27
+ setLoading(true);
28
+ getAsyncData().then((result: Awaited<ReturnType<typeof getAsyncData>>) => {
29
+ setComplexData(result.COMPLEX_DATA.slice(0, 15));
30
+ setLoading(false);
31
+ });
32
+ };
33
+
34
+ const [complexData, setComplexData] = useState<ComplexData[]>([]);
35
+ const [loading, setLoading] = useState<boolean>(true);
36
+
37
+ useEffect(() => loadData(), []);
38
+
39
+ return (
40
+ <>
41
+ <SampleDescription>
42
+ <p>This sample shows how KolTableStateful can load data async.</p>
43
+ </SampleDescription>
44
+
45
+ <section className="w-full relative">
46
+ <KolTableStateful _label="Table for demonstration purposes" _loading={loading} _headers={HEADERS_HORIZONTAL} _data={complexData} />
47
+ </section>
48
+ </>
49
+ );
50
+ };
@@ -3,6 +3,7 @@ import { KolTableStateful } from '@public-ui/react-v19';
3
3
  import type { FC } from 'react';
4
4
  import React from 'react';
5
5
 
6
+ import { SampleBlock } from '../SampleBlock';
6
7
  import { SampleDescription } from '../SampleDescription';
7
8
 
8
9
  import type { KoliBriTableHeaderCellWithLogic } from '@public-ui/components';
@@ -87,7 +88,7 @@ export const TableStatefulWithSelection: FC = () => {
87
88
  </p>
88
89
  </SampleDescription>
89
90
 
90
- <section className="w-full">
91
+ <SampleBlock id="selection" className="w-full">
91
92
  <KolTableStateful
92
93
  _label="Tasks with action buttons"
93
94
  _headers={HEADERS}
@@ -96,7 +97,7 @@ export const TableStatefulWithSelection: FC = () => {
96
97
  _selection={selection}
97
98
  _on={{ onSelectionChange: handleSelectionChangeCallback }}
98
99
  />
99
- </section>
100
+ </SampleBlock>
100
101
  </>
101
102
  );
102
103
  };
@@ -3,6 +3,7 @@ import { KolTableStateful } from '@public-ui/react-v19';
3
3
  import type { FC } from 'react';
4
4
  import React from 'react';
5
5
 
6
+ import { SampleBlock } from '../SampleBlock';
6
7
  import { SampleDescription } from '../SampleDescription';
7
8
 
8
9
  import type { KoliBriTableHeaderCellWithLogic } from '@public-ui/components';
@@ -88,7 +89,7 @@ export const TableStatefulWithSingleSelection: FC = () => {
88
89
  </p>
89
90
  </SampleDescription>
90
91
 
91
- <section className="w-full">
92
+ <SampleBlock id="single-selection" className="w-full">
92
93
  <KolTableStateful
93
94
  _label="Tasks with action buttons"
94
95
  _headers={HEADERS}
@@ -97,7 +98,7 @@ export const TableStatefulWithSingleSelection: FC = () => {
97
98
  _selection={selection}
98
99
  _on={{ onSelectionChange: handleSelectionChangeCallback }}
99
100
  />
100
- </section>
101
+ </SampleBlock>
101
102
  </>
102
103
  );
103
104
  };
@@ -1,7 +1,8 @@
1
1
  import type { KoliBriTableHeaders } from '@public-ui/components';
2
- import { KolPagination, KolSpin, KolTableStateless } from '@public-ui/react-v19';
2
+ import { KolPagination, KolTableStateless } from '@public-ui/react-v19';
3
3
  import type { FC } from 'react';
4
4
  import React, { useEffect, useState } from 'react';
5
+ import { SampleBlock } from '../SampleBlock';
5
6
  import { SampleDescription } from '../SampleDescription';
6
7
 
7
8
  import type { ComplexData } from './test-complex-data';
@@ -21,33 +22,10 @@ const HEADERS_HORIZONTAL: KoliBriTableHeaders = {
21
22
  ],
22
23
  };
23
24
 
24
- const LoadingOverlayFC: FC<{
25
- label: string;
26
- show: boolean;
27
- }> = ({ label, show }) => {
28
- if (show) {
29
- return (
30
- <div className="loading-overlay">
31
- <KolSpin
32
- _label={label}
33
- _show={show}
34
- _variant="cycle"
35
- style={{
36
- backgroundColor: 'transparent',
37
- }}
38
- />
39
- </div>
40
- );
41
- } else {
42
- return null;
43
- }
44
- };
45
-
46
25
  export const TableStatelessAsync: FC = () => {
47
26
  const getAsyncData = () => new Promise<{ COMPLEX_DATA: ComplexData[] }>((resolve) => setTimeout(() => resolve({ COMPLEX_DATA }), 5000));
48
- const loadData = (action: 'sort' | 'paginate') => {
27
+ const loadData = () => {
49
28
  setLoading(true);
50
- setCurrentAction(action);
51
29
  getAsyncData().then((result: Awaited<ReturnType<typeof getAsyncData>>) => {
52
30
  setComplexData(result.COMPLEX_DATA.slice(0, 15));
53
31
  setLoading(false);
@@ -56,9 +34,8 @@ export const TableStatelessAsync: FC = () => {
56
34
 
57
35
  const [complexData, setComplexData] = useState<ComplexData[]>([]);
58
36
  const [loading, setLoading] = useState<boolean>(true);
59
- const [currentAction, setCurrentAction] = useState<'sort' | 'paginate'>('sort');
60
37
 
61
- useEffect(() => loadData('sort'), []);
38
+ useEffect(() => loadData(), []);
62
39
 
63
40
  return (
64
41
  <>
@@ -69,13 +46,14 @@ export const TableStatelessAsync: FC = () => {
69
46
  </p>
70
47
  </SampleDescription>
71
48
 
72
- <section className="w-full relative">
49
+ <SampleBlock id="async" className="w-full relative">
73
50
  <KolTableStateless
74
51
  _label="Table for demonstration purposes"
52
+ _loading={loading}
75
53
  _headerCells={HEADERS_HORIZONTAL}
76
54
  _data={complexData}
77
55
  _on={{
78
- onSort: () => loadData('sort'),
56
+ onSort: () => loadData(),
79
57
  }}
80
58
  />
81
59
  <KolPagination
@@ -85,11 +63,10 @@ export const TableStatelessAsync: FC = () => {
85
63
  _boundaryCount={2}
86
64
  _pageSize={15}
87
65
  _on={{
88
- onChangePage: () => loadData('paginate'),
66
+ onChangePage: () => loadData(),
89
67
  }}
90
68
  />
91
- <LoadingOverlayFC label={currentAction === 'sort' ? 'Table is being sorted...' : 'Page is loading...'} show={loading} />
92
- </section>
69
+ </SampleBlock>
93
70
  </>
94
71
  );
95
72
  };
@@ -4,6 +4,7 @@ import type { FC } from 'react';
4
4
  import React, { useEffect, useRef, useState } from 'react';
5
5
  import { useToasterService } from '../../hooks/useToasterService';
6
6
  import { getRoot } from '../../shares/react-roots';
7
+ import { SampleBlock } from '../SampleBlock';
7
8
  import { SampleDescription } from '../SampleDescription';
8
9
 
9
10
  type SelectionValue = string | number;
@@ -72,7 +73,7 @@ export const TableStatelessWithSelection: FC = () => {
72
73
  <p>This sample shows KolTableStateless with checkboxes for selection enabled.</p>
73
74
  </SampleDescription>
74
75
 
75
- <section className="w-full">
76
+ <SampleBlock id="selection" className="w-full">
76
77
  <KolTableStateless
77
78
  _label="Table with selection checkboxes"
78
79
  _headerCells={{
@@ -91,7 +92,7 @@ export const TableStatelessWithSelection: FC = () => {
91
92
  style={{ maxWidth: '600px' }}
92
93
  ref={kolTableStatelessRef}
93
94
  />
94
- </section>
95
+ </SampleBlock>
95
96
  </>
96
97
  );
97
98
  };
@@ -4,6 +4,7 @@ import type { FC } from 'react';
4
4
  import React, { useCallback, useEffect, useRef, useState } from 'react';
5
5
  import { useToasterService } from '../../hooks/useToasterService';
6
6
  import { getRoot } from '../../shares/react-roots';
7
+ import { SampleBlock } from '../SampleBlock';
7
8
  import { SampleDescription } from '../SampleDescription';
8
9
 
9
10
  type SelectionValue = string | number;
@@ -72,7 +73,7 @@ export const TableStatelessWithSingleSelection: FC = () => {
72
73
  <p>This sample shows KolTableStateless with checkboxes for selection enabled.</p>
73
74
  </SampleDescription>
74
75
 
75
- <section className="w-full">
76
+ <SampleBlock id="single-selection" className="w-full" fitContent>
76
77
  <KolTableStateless
77
78
  _label="Table with selection checkboxes"
78
79
  _headerCells={{
@@ -91,7 +92,7 @@ export const TableStatelessWithSingleSelection: FC = () => {
91
92
  style={{ maxWidth: '600px' }}
92
93
  ref={kolTableStatelessRef}
93
94
  />
94
- </section>
95
+ </SampleBlock>
95
96
  </>
96
97
  );
97
98
  };
@@ -1,6 +1,7 @@
1
1
  import { KolTableStateless } from '@public-ui/react-v19';
2
2
  import type { FC } from 'react';
3
3
  import React from 'react';
4
+ import { SampleBlock } from '../SampleBlock';
4
5
  import { SampleDescription } from '../SampleDescription';
5
6
 
6
7
  const DATA = [{ left: 'Left Example', center: 'Center Example', right: 'Right Example' }, {}, {}, {}];
@@ -11,7 +12,7 @@ export const TableStateless: FC = () => (
11
12
  <p>This sample shows how KolTableStateless can be used directly, with the KolTableStateful wrapper.</p>
12
13
  </SampleDescription>
13
14
 
14
- <section className="w-full">
15
+ <SampleBlock id="stateless" className="w-full" fitContent>
15
16
  <KolTableStateless
16
17
  _label="Table for demonstration purposes"
17
18
  _headerCells={{
@@ -41,6 +42,6 @@ export const TableStateless: FC = () => (
41
42
  },
42
43
  }}
43
44
  />
44
- </section>
45
+ </SampleBlock>
45
46
  </>
46
47
  );