@public-ui/sample-react 2.1.7 → 2.1.8-rc.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 (150) hide show
  1. package/dist/1487.js +1 -1
  2. package/dist/1636.js +1 -1
  3. package/dist/1792.js +1 -1
  4. package/dist/1795.js +1 -1
  5. package/dist/1938.js +2 -0
  6. package/dist/2017.js +1 -1
  7. package/dist/2322.js +1 -1
  8. package/dist/2538.js +1 -1
  9. package/dist/2567.js +1 -1
  10. package/dist/263.js +1 -1
  11. package/dist/2719.js +1 -1
  12. package/dist/3064.js +1 -1
  13. package/dist/3077.js +1 -1
  14. package/dist/3238.js +1 -1
  15. package/dist/3395.js +1 -1
  16. package/dist/35.js +1 -1
  17. package/dist/3521.js +1 -1
  18. package/dist/356.js +1 -1
  19. package/dist/3714.js +1 -1
  20. package/dist/3735.js +1 -1
  21. package/dist/3766.js +1 -1
  22. package/dist/3994.js +1 -1
  23. package/dist/4025.js +1 -1
  24. package/dist/4118.js +1 -1
  25. package/dist/4182.js +1 -1
  26. package/dist/4188.js +1 -1
  27. package/dist/4332.js +1 -1
  28. package/dist/4402.js +1 -1
  29. package/dist/4556.js +2 -0
  30. package/dist/4818.js +1 -1
  31. package/dist/4892.js +1 -1
  32. package/dist/4933.js +1 -1
  33. package/dist/4943.js +1 -1
  34. package/dist/495.js +1 -1
  35. package/dist/5034.js +1 -1
  36. package/dist/5056.js +1 -1
  37. package/dist/5138.js +1 -1
  38. package/dist/5296.js +1 -1
  39. package/dist/5356.js +1 -1
  40. package/dist/5551.js +1 -1
  41. package/dist/5835.js +1 -1
  42. package/dist/5840.js +1 -1
  43. package/dist/5889.js +1 -1
  44. package/dist/5912.js +1 -1
  45. package/dist/6082.js +1 -1
  46. package/dist/6099.js +1 -1
  47. package/dist/6181.js +1 -1
  48. package/dist/619.js +1 -1
  49. package/dist/6671.js +1 -1
  50. package/dist/6775.js +1 -1
  51. package/dist/6812.js +2 -0
  52. package/dist/7274.js +1 -1
  53. package/dist/7795.js +1 -1
  54. package/dist/7802.js +1 -1
  55. package/dist/7860.js +1 -1
  56. package/dist/8092.js +1 -1
  57. package/dist/8111.js +1 -1
  58. package/dist/8146.js +1 -1
  59. package/dist/8427.js +1 -1
  60. package/dist/8495.js +1 -1
  61. package/dist/8672.js +1 -1
  62. package/dist/8737.js +1 -1
  63. package/dist/8786.js +1 -1
  64. package/dist/8796.js +1 -1
  65. package/dist/8853.js +2 -0
  66. package/dist/8977.js +1 -1
  67. package/dist/9333.js +1 -1
  68. package/dist/9389.js +1 -1
  69. package/dist/9561.js +1 -1
  70. package/dist/9599.js +1 -1
  71. package/dist/9612.js +1 -1
  72. package/dist/9890.js +1 -1
  73. package/dist/index.html +1 -1
  74. package/dist/main.css +3 -3
  75. package/dist/main.js +1 -1
  76. package/dist/main.js.LICENSE.txt +2 -2
  77. package/package.json +13 -14
  78. package/public/index.html +1 -1
  79. package/src/@shared/_mixins.scss +3 -0
  80. package/src/App.tsx +1 -1
  81. package/src/components/FormWrap.tsx +1 -1
  82. package/src/components/Navigation.tsx +63 -0
  83. package/src/components/Sidebar.tsx +5 -41
  84. package/src/components/abbr/basic.tsx +12 -12
  85. package/src/components/alert/card-msg.tsx +3 -1
  86. package/src/components/alert/html.tsx +4 -2
  87. package/src/components/button/baselined.tsx +1 -1
  88. package/src/components/button/partials/variants.tsx +15 -17
  89. package/src/components/button/width.tsx +2 -2
  90. package/src/components/button-link/basic.tsx +3 -3
  91. package/src/components/button-link/image.tsx +0 -1
  92. package/src/components/card/basic.tsx +1 -1
  93. package/src/components/combobox/partials/variants.tsx +1 -1
  94. package/src/components/details/basic.tsx +2 -2
  95. package/src/components/form/basic.tsx +1 -1
  96. package/src/components/form/error-list.tsx +1 -0
  97. package/src/components/input-checkbox/partials/variants.tsx +22 -10
  98. package/src/components/input-date/reset.tsx +1 -1
  99. package/src/components/input-password/show-password.tsx +1 -1
  100. package/src/components/input-text/partials/cases.tsx +1 -1
  101. package/src/components/input-text/text-formatter.tsx +45 -43
  102. package/src/components/link/image.tsx +0 -1
  103. package/src/components/link/target.tsx +1 -1
  104. package/src/components/modal/basic.tsx +1 -1
  105. package/src/components/nav/basic.tsx +23 -12
  106. package/src/components/nav/horizontal.tsx +12 -3
  107. package/src/components/nav/links.ts +36 -0
  108. package/src/components/table/column-alignment.tsx +64 -62
  109. package/src/components/table/complex-headers.tsx +80 -78
  110. package/src/components/table/horizontal-scrollbar.tsx +30 -28
  111. package/src/components/table/interactive-child-elements.tsx +69 -68
  112. package/src/components/table/pagination-position.tsx +15 -13
  113. package/src/components/table/render-cell.tsx +1 -1
  114. package/src/components/table/sort-data.tsx +11 -8
  115. package/src/components/table/stateful-with-selection.tsx +36 -27
  116. package/src/components/table/stateful-with-single-selection.tsx +36 -27
  117. package/src/components/table/stateless-with-selection.tsx +26 -17
  118. package/src/components/table/stateless-with-single-selection.tsx +26 -17
  119. package/src/components/table/stateless.tsx +29 -27
  120. package/src/components/table/with-footer.tsx +1 -0
  121. package/src/components/table/with-pagination.tsx +1 -1
  122. package/src/components/tabs/behavior.tsx +61 -0
  123. package/src/components/tabs/routes.ts +2 -0
  124. package/src/components/textarea/adjust-height.tsx +1 -1
  125. package/src/components/textarea/counter.tsx +4 -1
  126. package/src/components/textarea/resize.tsx +1 -1
  127. package/src/components/textarea/rows.tsx +1 -1
  128. package/src/components/toast/basic.tsx +13 -11
  129. package/src/react.main.tsx +6 -1
  130. package/src/scenarios/appointment-form/AppointmentForm.tsx +1 -0
  131. package/src/scenarios/disabled-interactive-elements.tsx +1 -1
  132. package/src/scenarios/focus-elements.tsx +21 -16
  133. package/src/scenarios/horizontal-scrollbar-advanced/TableHorizontalScrollbarAdvanced.tsx +1 -1
  134. package/src/scenarios/horizontal-scrollbar-advanced/layout.scss +19 -0
  135. package/src/scenarios/input-group-with-error.tsx +41 -0
  136. package/src/scenarios/inputs-get-value.tsx +121 -119
  137. package/src/scenarios/routes.ts +4 -2
  138. package/src/scenarios/static-form.tsx +65 -62
  139. package/src/style.scss +10 -13
  140. package/tsconfig.json +1 -2
  141. package/unocss.config.ts +213 -0
  142. package/dist/3171.js +0 -2
  143. package/dist/4262.js +0 -2
  144. package/dist/479.js +0 -2
  145. package/dist/8710.js +0 -2
  146. package/src/scenarios/horizontal-scrollbar-advanced/layout.css +0 -31
  147. /package/dist/{3171.js.LICENSE.txt → 1938.js.LICENSE.txt} +0 -0
  148. /package/dist/{4262.js.LICENSE.txt → 4556.js.LICENSE.txt} +0 -0
  149. /package/dist/{479.js.LICENSE.txt → 6812.js.LICENSE.txt} +0 -0
  150. /package/dist/{8710.js.LICENSE.txt → 8853.js.LICENSE.txt} +0 -0
@@ -1,10 +1,9 @@
1
+ import type { ButtonVariantPropType, KoliBriTableCell, KoliBriTableHeaderCell } from '@public-ui/components';
2
+ import { createReactRenderElement, KolButton, KolButtonLink, KolLink, KolLinkButton, KolTableStateless } from '@public-ui/react';
1
3
  import type { FC } from 'react';
2
4
  import React from 'react';
3
- import { createReactRenderElement, KolButton, KolButtonLink, KolLink, KolLinkButton, KolTableStateless } from '@public-ui/react';
4
- import { SampleDescription } from '../SampleDescription';
5
5
  import { getRoot } from '../../shares/react-roots';
6
- import type { ButtonVariantPropType, KoliBriTableCell } from '@public-ui/components';
7
- import type { KoliBriTableHeaderCell } from '@public-ui/components/src/schema';
6
+ import { SampleDescription } from '../SampleDescription';
8
7
 
9
8
  const getButtonHeaderCell = (variant: ButtonVariantPropType): KoliBriTableHeaderCell => {
10
9
  const capitalizedVariant = variant.charAt(0).toUpperCase() + variant.slice(1);
@@ -33,73 +32,75 @@ export const InteractiveChildElements: FC = () => (
33
32
  </p>
34
33
  </SampleDescription>
35
34
 
36
- <KolTableStateless
37
- _label="Button styles"
38
- _headerCells={{
39
- horizontal: [
40
- [
41
- { label: '', asTd: true, width: '20ex' },
42
- getButtonHeaderCell('primary'),
43
- getButtonHeaderCell('secondary'),
44
- getButtonHeaderCell('normal'),
45
- getButtonHeaderCell('danger'),
46
- getButtonHeaderCell('ghost'),
35
+ <section className="w-full flex flex-col">
36
+ <KolTableStateless
37
+ _label="Button styles"
38
+ _headerCells={{
39
+ horizontal: [
40
+ [
41
+ { label: '', asTd: true, width: '20ex' },
42
+ getButtonHeaderCell('primary'),
43
+ getButtonHeaderCell('secondary'),
44
+ getButtonHeaderCell('normal'),
45
+ getButtonHeaderCell('danger'),
46
+ getButtonHeaderCell('ghost'),
47
+ ],
47
48
  ],
48
- ],
49
- vertical: [[{ label: 'Button' }, { label: 'Link-Button' }]],
50
- }}
51
- _data={[
52
- {
53
- primary: 'button',
54
- secondary: 'button',
55
- normal: 'button',
56
- danger: 'button',
57
- ghost: 'button',
58
- },
59
- {
60
- primary: 'link-button',
61
- secondary: 'link-button',
62
- normal: 'link-button',
63
- danger: 'link-button',
64
- ghost: 'link-button',
65
- },
66
- ]}
67
- className="block"
68
- />
49
+ vertical: [[{ label: 'Button' }, { label: 'Link-Button' }]],
50
+ }}
51
+ _data={[
52
+ {
53
+ primary: 'button',
54
+ secondary: 'button',
55
+ normal: 'button',
56
+ danger: 'button',
57
+ ghost: 'button',
58
+ },
59
+ {
60
+ primary: 'link-button',
61
+ secondary: 'link-button',
62
+ normal: 'link-button',
63
+ danger: 'link-button',
64
+ ghost: 'link-button',
65
+ },
66
+ ]}
67
+ className="block"
68
+ />
69
69
 
70
- <KolTableStateless
71
- _label="Link styles"
72
- _headerCells={{
73
- horizontal: [
74
- [
75
- { label: '', asTd: true, width: '20ex' },
76
- {
77
- key: 'regular',
78
- label: 'Regular',
79
- textAlign: 'left',
80
- render: (element: HTMLElement, cell: KoliBriTableCell) => {
81
- const commonProps = {
82
- _label: cell.label,
83
- _icons: { right: 'codicon codicon-squirrel' },
84
- };
85
- getRoot(createReactRenderElement(element)).render(
86
- cell.label === 'button-link' ? <KolButtonLink {...commonProps} /> : <KolLink _href="#/back-page" {...commonProps} />,
87
- );
70
+ <KolTableStateless
71
+ _label="Link styles"
72
+ _headerCells={{
73
+ horizontal: [
74
+ [
75
+ { label: '', asTd: true, width: '20ex' },
76
+ {
77
+ key: 'regular',
78
+ label: 'Regular',
79
+ textAlign: 'left',
80
+ render: (element: HTMLElement, cell: KoliBriTableCell) => {
81
+ const commonProps = {
82
+ _label: cell.label,
83
+ _icons: { right: 'codicon codicon-squirrel' },
84
+ };
85
+ getRoot(createReactRenderElement(element)).render(
86
+ cell.label === 'button-link' ? <KolButtonLink {...commonProps} /> : <KolLink _href="#/back-page" {...commonProps} />,
87
+ );
88
+ },
88
89
  },
89
- },
90
+ ],
90
91
  ],
91
- ],
92
- vertical: [[{ label: 'Link' }, { label: 'Button-Link' }]],
93
- }}
94
- _data={[
95
- {
96
- regular: 'link',
97
- },
98
- {
99
- regular: 'button-link',
100
- },
101
- ]}
102
- className="block mt"
103
- />
92
+ vertical: [[{ label: 'Link' }, { label: 'Button-Link' }]],
93
+ }}
94
+ _data={[
95
+ {
96
+ regular: 'link',
97
+ },
98
+ {
99
+ regular: 'button-link',
100
+ },
101
+ ]}
102
+ className="block mt"
103
+ />
104
+ </section>
104
105
  </>
105
106
  );
@@ -1,7 +1,7 @@
1
1
  import type { FC } from 'react';
2
2
  import React from 'react';
3
3
 
4
- import { KolTable } from '@public-ui/react';
4
+ import { KolHeading, KolTable } from '@public-ui/react';
5
5
 
6
6
  import { SampleDescription } from '../SampleDescription';
7
7
  import { DATE_FORMATTER } from './formatter';
@@ -21,22 +21,24 @@ const HEADERS: KoliBriTableHeaders = {
21
21
  const PAGINATION: KoliBriTablePaginationProps = { _page: 2 };
22
22
 
23
23
  export const PaginationPosition: FC = () => (
24
- <div className="grid gap-14">
24
+ <div className="w-full grid gap-14">
25
25
  <SampleDescription>
26
26
  <p>This sample shows KolTable with different pagination positions.</p>
27
27
  </SampleDescription>
28
28
 
29
- <section>
30
- <h2>Table with pagination at the bottom.</h2>
31
- <KolTable _label="Tabellenbeschreibung" _data={DATA} _headers={HEADERS} _pagination={PAGINATION} _paginationPosition="bottom"></KolTable>
32
- </section>
33
- <section>
34
- <h2>Table with pagination at the top.</h2>
35
- <KolTable _label="Tabellenbeschreibung" _data={DATA} _headers={HEADERS} _pagination={PAGINATION} _paginationPosition="top"></KolTable>
36
- </section>
37
- <section>
38
- <h2>Table with pagination at both top and bottom.</h2>
39
- <KolTable _label="Tabellenbeschreibung" _data={DATA} _headers={HEADERS} _pagination={PAGINATION} _paginationPosition="both"></KolTable>
29
+ <section className="w-full flex flex-col gap-14">
30
+ <section className="grid gap-4">
31
+ <KolHeading _level={2} _label="Table with pagination at the bottom."></KolHeading>
32
+ <KolTable _label="Tabellenbeschreibung" _data={DATA} _headers={HEADERS} _pagination={PAGINATION} _paginationPosition="bottom"></KolTable>
33
+ </section>
34
+ <section className="grid gap-4">
35
+ <KolHeading _level={2} _label="Table with pagination at the top."></KolHeading>
36
+ <KolTable _label="Tabellenbeschreibung" _data={DATA} _headers={HEADERS} _pagination={PAGINATION} _paginationPosition="top"></KolTable>
37
+ </section>
38
+ <section className="grid gap-4">
39
+ <KolHeading _level={2} _label="Table with pagination at both top and bottom."></KolHeading>
40
+ <KolTable _label="Tabellenbeschreibung" _data={DATA} _headers={HEADERS} _pagination={PAGINATION} _paginationPosition="both"></KolTable>
41
+ </section>
40
42
  </section>
41
43
  </div>
42
44
  );
@@ -104,6 +104,6 @@ export const TableRenderCell: FC = () => (
104
104
  <p>This sample shows KolTable using React render functions for the cell contents.</p>
105
105
  </SampleDescription>
106
106
 
107
- <KolTable _label="Sort by date column" _data={DATA} _headers={HEADERS} className="block min-w-75em" />
107
+ <KolTable _label="Sort by date column" _data={DATA} _headers={HEADERS} className="w-full" />
108
108
  </>
109
109
  );
@@ -1,7 +1,7 @@
1
1
  import type { FC } from 'react';
2
2
  import React from 'react';
3
3
 
4
- import { KolTable } from '@public-ui/react';
4
+ import { KolHeading, KolTable } from '@public-ui/react';
5
5
  import type { KoliBriTableHeaders } from '@public-ui/components';
6
6
  import type { Data } from './test-data';
7
7
  import { DATA } from './test-data';
@@ -59,12 +59,15 @@ export const TableSortData: FC = () => (
59
59
  <p>This sample shows KolTable with sortable columns. The sort-order can be changed by clicking the &quot;date&quot; header column.</p>
60
60
  </SampleDescription>
61
61
 
62
- <h2>Vertical</h2>
63
-
64
- <KolTable _label="Sort a date column" _data={DATA.slice(0, 10)} _headers={HEADERS_VERTICAL} className="block" />
65
-
66
- <h2>Horizontal</h2>
67
-
68
- <KolTable _label="Sort a date column" _data={DATA} _headers={HEADERS_HORIZONTAL} className="block" />
62
+ <section className="w-full grid gap-4">
63
+ <section className="grid gap-4">
64
+ <KolHeading _level={2} _label="Vertical" />
65
+ <KolTable _label="Sort a date column" _data={DATA.slice(0, 10)} _headers={HEADERS_VERTICAL} className="block" />
66
+ </section>
67
+ <section className="grid gap-4">
68
+ <KolHeading _level={2} _label="Horizontal" />
69
+ <KolTable _label="Sort a date column" _data={DATA} _headers={HEADERS_HORIZONTAL} className="block" />
70
+ </section>
71
+ </section>
69
72
  </>
70
73
  );
@@ -1,8 +1,10 @@
1
1
  import type { FC } from 'react';
2
2
  import React, { useEffect, useRef, useState } from 'react';
3
- import { KolButton, KolTableStateful } from '@public-ui/react';
3
+ import { KolButton, KolTableStateful, createReactRenderElement } from '@public-ui/react';
4
4
  import { SampleDescription } from '../SampleDescription';
5
5
  import type { KoliBriTableDataType, KoliBriTableSelection } from '@public-ui/components';
6
+ import { getRoot } from '../../shares/react-roots';
7
+ import type { KoliBriTableCell } from '@public-ui/components';
6
8
 
7
9
  const DATA = [
8
10
  { id: '1001', name: 'Foo Bar', internalIdentifier: `AAA1001` },
@@ -43,40 +45,47 @@ export const TableStatefulWithSelection: FC = () => {
43
45
  };
44
46
  }, [kolTableStatefulRef]);
45
47
 
48
+ const renderButton = (element: HTMLElement, cell: KoliBriTableCell) => {
49
+ getRoot(createReactRenderElement(element)).render(<KolButton _label={`Click ${cell.data?.id}`}></KolButton>);
50
+ };
51
+
46
52
  return (
47
53
  <>
48
54
  <SampleDescription>
49
55
  <p>This sample shows KolTableStateful with checkboxes for selection enabled.</p>
50
56
  </SampleDescription>
51
57
 
52
- <KolTableStateful
53
- _label="Table with selection checkboxes"
54
- _headers={{
55
- horizontal: [
56
- [
57
- { key: 'id', label: '#ID', textAlign: 'left' },
58
- { key: 'name', label: 'Name', textAlign: 'left' },
58
+ <section className="w-full">
59
+ <KolTableStateful
60
+ _label="Table with selection checkboxes"
61
+ _headers={{
62
+ horizontal: [
63
+ [
64
+ { key: 'id', label: '#ID', textAlign: 'left' },
65
+ { key: 'name', label: 'Name', textAlign: 'left' },
66
+ { key: 'action', label: 'Action', textAlign: 'left', render: renderButton },
67
+ ],
59
68
  ],
60
- ],
61
- }}
62
- _data={DATA}
63
- _selection={selection}
64
- _on={{ onSelectionChange: handleSelectionChangeCallback }}
65
- className="block"
66
- style={{ maxWidth: '600px' }}
67
- ref={kolTableStatefulRef}
68
- />
69
- <div className="grid grid-cols-3 items-end gap-4 mt-4">
70
- <KolButton
71
- _label="getSelection()"
72
- _on={{
73
- onClick: () => {
74
- void handleButtonClick();
75
- },
76
69
  }}
77
- ></KolButton>
78
- <pre>{JSON.stringify(selectedValue, null, 2)}</pre>
79
- </div>
70
+ _data={DATA}
71
+ _selection={selection}
72
+ _on={{ onSelectionChange: handleSelectionChangeCallback }}
73
+ className="block"
74
+ style={{ maxWidth: '600px' }}
75
+ ref={kolTableStatefulRef}
76
+ />
77
+ <div className="grid grid-cols-3 items-end gap-4 mt-4">
78
+ <KolButton
79
+ _label="getSelection()"
80
+ _on={{
81
+ onClick: () => {
82
+ void handleButtonClick();
83
+ },
84
+ }}
85
+ ></KolButton>
86
+ <pre className="text-base">{JSON.stringify(selectedValue, null, 2)}</pre>
87
+ </div>
88
+ </section>
80
89
  </>
81
90
  );
82
91
  };
@@ -1,8 +1,10 @@
1
1
  import type { FC } from 'react';
2
2
  import React, { useEffect, useRef, useState } from 'react';
3
- import { KolButton, KolTableStateful } from '@public-ui/react';
3
+ import { KolButton, KolTableStateful, createReactRenderElement } from '@public-ui/react';
4
4
  import { SampleDescription } from '../SampleDescription';
5
5
  import type { KoliBriTableDataType, KoliBriTableSelection } from '@public-ui/components';
6
+ import { getRoot } from '../../shares/react-roots';
7
+ import type { KoliBriTableCell } from '@public-ui/components';
6
8
 
7
9
  const DATA = [
8
10
  { id: '1001', name: 'Foo Bar', internalIdentifier: `AAA1001` },
@@ -45,40 +47,47 @@ export const TableStatefulWithSingleSelection: FC = () => {
45
47
  };
46
48
  }, [kolTableStatefulRef]);
47
49
 
50
+ const renderButton = (element: HTMLElement, cell: KoliBriTableCell) => {
51
+ getRoot(createReactRenderElement(element)).render(<KolButton _label={`Click ${cell.data?.id}`}></KolButton>);
52
+ };
53
+
48
54
  return (
49
55
  <>
50
56
  <SampleDescription>
51
57
  <p>This sample shows KolTableStateful with radio buttons for selection enabled.</p>
52
58
  </SampleDescription>
53
59
 
54
- <KolTableStateful
55
- _label="Table with selection radio"
56
- _headers={{
57
- horizontal: [
58
- [
59
- { key: 'id', label: '#ID', textAlign: 'left' },
60
- { key: 'name', label: 'Name', textAlign: 'left' },
60
+ <section className="w-full">
61
+ <KolTableStateful
62
+ _label="Table with selection radio"
63
+ _headers={{
64
+ horizontal: [
65
+ [
66
+ { key: 'id', label: '#ID', textAlign: 'left' },
67
+ { key: 'name', label: 'Name', textAlign: 'left' },
68
+ { key: 'action', label: 'Action', textAlign: 'left', render: renderButton },
69
+ ],
61
70
  ],
62
- ],
63
- }}
64
- _data={DATA}
65
- _selection={selection}
66
- _on={{ onSelectionChange: handleSelectionChangeCallback }}
67
- className="block"
68
- style={{ maxWidth: '600px' }}
69
- ref={kolTableStatefulRef}
70
- />
71
- <div className="grid grid-cols-3 items-end gap-4 mt-4">
72
- <KolButton
73
- _label="getSelection()"
74
- _on={{
75
- onClick: () => {
76
- void handleButtonClick();
77
- },
78
71
  }}
79
- ></KolButton>
80
- <pre>{JSON.stringify(selectedValue, null, 2)}</pre>
81
- </div>
72
+ _data={DATA}
73
+ _selection={selection}
74
+ _on={{ onSelectionChange: handleSelectionChangeCallback }}
75
+ className="block"
76
+ style={{ maxWidth: '600px' }}
77
+ ref={kolTableStatefulRef}
78
+ />
79
+ <div className="grid grid-cols-3 items-end gap-4 mt-4">
80
+ <KolButton
81
+ _label="getSelection()"
82
+ _on={{
83
+ onClick: () => {
84
+ void handleButtonClick();
85
+ },
86
+ }}
87
+ ></KolButton>
88
+ <pre className="text-base">{JSON.stringify(selectedValue, null, 2)}</pre>
89
+ </div>
90
+ </section>
82
91
  </>
83
92
  );
84
93
  };
@@ -1,8 +1,10 @@
1
1
  import type { FC } from 'react';
2
2
  import React, { useEffect, useState, useRef } from 'react';
3
- import { KolTableStateless } from '@public-ui/react';
3
+ import { KolButton, KolTableStateless, createReactRenderElement } from '@public-ui/react';
4
4
  import { SampleDescription } from '../SampleDescription';
5
5
  import type { KoliBriTableSelection } from '@public-ui/components';
6
+ import { getRoot } from '../../shares/react-roots';
7
+ import type { KoliBriTableCell } from '@public-ui/components';
6
8
 
7
9
  const DATA = [
8
10
  { id: '1001', name: 'Foo Bar', internalIdentifier: `AAA1001` },
@@ -39,29 +41,36 @@ export const TableStatelessWithSelection: FC = () => {
39
41
  };
40
42
  }, [kolTableStatelessRef]);
41
43
 
44
+ const renderButton = (element: HTMLElement, cell: KoliBriTableCell) => {
45
+ getRoot(createReactRenderElement(element)).render(<KolButton _label={`Click ${cell.data?.id}`}></KolButton>);
46
+ };
47
+
42
48
  return (
43
49
  <>
44
50
  <SampleDescription>
45
51
  <p>This sample shows KolTableStateless with checkboxes for selection enabled.</p>
46
52
  </SampleDescription>
47
53
 
48
- <KolTableStateless
49
- _label="Table with selection checkboxes"
50
- _headerCells={{
51
- horizontal: [
52
- [
53
- { key: 'id', label: '#ID', textAlign: 'left' },
54
- { key: 'name', label: 'Name', textAlign: 'left' },
54
+ <section className="w-full">
55
+ <KolTableStateless
56
+ _label="Table with selection checkboxes"
57
+ _headerCells={{
58
+ horizontal: [
59
+ [
60
+ { key: 'id', label: '#ID', textAlign: 'left' },
61
+ { key: 'name', label: 'Name', textAlign: 'left' },
62
+ { key: 'action', label: 'Action', textAlign: 'left', render: renderButton },
63
+ ],
55
64
  ],
56
- ],
57
- }}
58
- _data={DATA}
59
- _selection={selection}
60
- _on={{ onSelectionChange: handleSelectionChangeCallback }}
61
- className="block"
62
- style={{ maxWidth: '600px' }}
63
- ref={kolTableStatelessRef}
64
- />
65
+ }}
66
+ _data={DATA}
67
+ _selection={selection}
68
+ _on={{ onSelectionChange: handleSelectionChangeCallback }}
69
+ className="block"
70
+ style={{ maxWidth: '600px' }}
71
+ ref={kolTableStatelessRef}
72
+ />
73
+ </section>
65
74
  </>
66
75
  );
67
76
  };
@@ -1,8 +1,10 @@
1
1
  import type { FC } from 'react';
2
2
  import React, { useEffect, useState, useRef } from 'react';
3
- import { KolTableStateless } from '@public-ui/react';
3
+ import { KolButton, KolTableStateless, createReactRenderElement } from '@public-ui/react';
4
4
  import { SampleDescription } from '../SampleDescription';
5
5
  import type { KoliBriTableSelection } from '@public-ui/components';
6
+ import { getRoot } from '../../shares/react-roots';
7
+ import type { KoliBriTableCell } from '@public-ui/components';
6
8
 
7
9
  const DATA = [
8
10
  { id: '1001', name: 'Foo Bar', internalIdentifier: `AAA1001` },
@@ -40,29 +42,36 @@ export const TableStatelessWithSingleSelection: FC = () => {
40
42
  };
41
43
  }, [kolTableStatelessRef]);
42
44
 
45
+ const renderButton = (element: HTMLElement, cell: KoliBriTableCell) => {
46
+ getRoot(createReactRenderElement(element)).render(<KolButton _label={`Click ${cell.data?.id}`}></KolButton>);
47
+ };
48
+
43
49
  return (
44
50
  <>
45
51
  <SampleDescription>
46
52
  <p>This sample shows KolTableStateless with checkboxes for selection enabled.</p>
47
53
  </SampleDescription>
48
54
 
49
- <KolTableStateless
50
- _label="Table with selection checkboxes"
51
- _headerCells={{
52
- horizontal: [
53
- [
54
- { key: 'id', label: '#ID', textAlign: 'left' },
55
- { key: 'name', label: 'Name', textAlign: 'left' },
55
+ <section className="w-full">
56
+ <KolTableStateless
57
+ _label="Table with selection checkboxes"
58
+ _headerCells={{
59
+ horizontal: [
60
+ [
61
+ { key: 'id', label: '#ID', textAlign: 'left' },
62
+ { key: 'name', label: 'Name', textAlign: 'left' },
63
+ { key: 'action', label: 'Action', textAlign: 'left', render: renderButton },
64
+ ],
56
65
  ],
57
- ],
58
- }}
59
- _data={DATA}
60
- _selection={selection}
61
- _on={{ onSelectionChange: handleSelectionChangeCallback }}
62
- className="block"
63
- style={{ maxWidth: '600px' }}
64
- ref={kolTableStatelessRef}
65
- />
66
+ }}
67
+ _data={DATA}
68
+ _selection={selection}
69
+ _on={{ onSelectionChange: handleSelectionChangeCallback }}
70
+ className="block"
71
+ style={{ maxWidth: '600px' }}
72
+ ref={kolTableStatelessRef}
73
+ />
74
+ </section>
66
75
  </>
67
76
  );
68
77
  };
@@ -11,34 +11,36 @@ export const TableStateless: FC = () => (
11
11
  <p>This sample shows how KolTableStateless can be used directly, with the KolTableStateful wrapper.</p>
12
12
  </SampleDescription>
13
13
 
14
- <KolTableStateless
15
- _label="Table for demonstration purposes"
16
- _headerCells={{
17
- horizontal: [
18
- [
19
- { key: 'left', label: 'left', textAlign: 'left', sortDirection: 'ASC' },
20
- { key: 'center', label: 'center', textAlign: 'center', sortDirection: 'DESC' },
21
- { key: 'right', label: 'right', textAlign: 'right', sortDirection: 'NOS' },
22
- { key: 'nosort', label: 'no sort option' },
14
+ <section className="w-full">
15
+ <KolTableStateless
16
+ _label="Table for demonstration purposes"
17
+ _headerCells={{
18
+ horizontal: [
19
+ [
20
+ { key: 'left', label: 'left', textAlign: 'left', sortDirection: 'ASC' },
21
+ { key: 'center', label: 'center', textAlign: 'center', sortDirection: 'DESC' },
22
+ { key: 'right', label: 'right', textAlign: 'right', sortDirection: 'NOS' },
23
+ { key: 'nosort', label: 'no sort option' },
24
+ ],
23
25
  ],
24
- ],
25
- vertical: [
26
- [
27
- { key: 'vertical-left', label: 'left', textAlign: 'left', sortDirection: 'ASC' },
28
- { key: 'vertical-center', label: 'center', textAlign: 'center', sortDirection: 'DESC' },
29
- { key: 'vertical-right', label: 'right', textAlign: 'right', sortDirection: 'NOS' },
30
- { key: 'vertical-nosort', label: 'no sort option' },
26
+ vertical: [
27
+ [
28
+ { key: 'vertical-left', label: 'left', textAlign: 'left', sortDirection: 'ASC' },
29
+ { key: 'vertical-center', label: 'center', textAlign: 'center', sortDirection: 'DESC' },
30
+ { key: 'vertical-right', label: 'right', textAlign: 'right', sortDirection: 'NOS' },
31
+ { key: 'vertical-nosort', label: 'no sort option' },
32
+ ],
31
33
  ],
32
- ],
33
- }}
34
- _data={DATA}
35
- className="block"
36
- style={{ maxWidth: '600px' }}
37
- _on={{
38
- onSort: (_event, payload) => {
39
- console.log(payload);
40
- },
41
- }}
42
- />
34
+ }}
35
+ _data={DATA}
36
+ className="block"
37
+ style={{ maxWidth: '600px' }}
38
+ _on={{
39
+ onSort: (_event, payload) => {
40
+ console.log(payload);
41
+ },
42
+ }}
43
+ />
44
+ </section>
43
45
  </>
44
46
  );
@@ -10,6 +10,7 @@ export const TableWithFooter: FC = () => (
10
10
  </SampleDescription>
11
11
 
12
12
  <KolTable
13
+ className="w-full"
13
14
  _label="Business hours"
14
15
  _headers={{
15
16
  horizontal: [
@@ -25,7 +25,7 @@ export const TableWithPagination: FC = () => (
25
25
  <SampleDescription>
26
26
  <p>This sample shows how KolTable can be navigated using a pagination.</p>
27
27
  </SampleDescription>
28
- <div>
28
+ <div className="w-full">
29
29
  <KolTable _label="Tabellenbeschreibung" _data={DATA} _headers={HEADERS} _pagination={PAGINATION}></KolTable>
30
30
  </div>
31
31
  </>