@public-ui/sample-react 2.1.7 → 2.1.8

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 (160) 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/2017.js +1 -1
  6. package/dist/2322.js +1 -1
  7. package/dist/2538.js +1 -1
  8. package/dist/2567.js +1 -1
  9. package/dist/263.js +1 -1
  10. package/dist/2719.js +1 -1
  11. package/dist/3064.js +1 -1
  12. package/dist/3077.js +1 -1
  13. package/dist/3238.js +1 -1
  14. package/dist/3301.js +2 -0
  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/4065.js +2 -0
  25. package/dist/4118.js +1 -1
  26. package/dist/4182.js +1 -1
  27. package/dist/4188.js +1 -1
  28. package/dist/4332.js +1 -1
  29. package/dist/4402.js +1 -1
  30. package/dist/4795.js +2 -0
  31. package/dist/4818.js +1 -1
  32. package/dist/4892.js +1 -1
  33. package/dist/4933.js +1 -1
  34. package/dist/4943.js +1 -1
  35. package/dist/495.js +1 -1
  36. package/dist/5034.js +1 -1
  37. package/dist/5056.js +1 -1
  38. package/dist/5138.js +1 -1
  39. package/dist/5296.js +1 -1
  40. package/dist/5356.js +1 -1
  41. package/dist/5551.js +1 -1
  42. package/dist/5835.js +1 -1
  43. package/dist/5840.js +1 -1
  44. package/dist/5889.js +1 -1
  45. package/dist/5912.js +1 -1
  46. package/dist/6082.js +1 -1
  47. package/dist/6099.js +1 -1
  48. package/dist/6181.js +1 -1
  49. package/dist/619.js +1 -1
  50. package/dist/6671.js +1 -1
  51. package/dist/6775.js +1 -1
  52. package/dist/7274.js +1 -1
  53. package/dist/7440.js +2 -0
  54. package/dist/7795.js +1 -1
  55. package/dist/7802.js +1 -1
  56. package/dist/7860.js +1 -1
  57. package/dist/8092.js +1 -1
  58. package/dist/8111.js +1 -1
  59. package/dist/8146.js +1 -1
  60. package/dist/8427.js +1 -1
  61. package/dist/8495.js +1 -1
  62. package/dist/8672.js +1 -1
  63. package/dist/8737.js +1 -1
  64. package/dist/8786.js +1 -1
  65. package/dist/8796.js +1 -1
  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 +16 -16
  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/access-key.tsx +34 -25
  88. package/src/components/button/aria-description.tsx +20 -11
  89. package/src/components/button/baselined.tsx +22 -13
  90. package/src/components/button/icons.tsx +33 -26
  91. package/src/components/button/partials/cases.tsx +13 -6
  92. package/src/components/button/partials/variants.tsx +15 -17
  93. package/src/components/button/width.tsx +33 -28
  94. package/src/components/button-group/basic.tsx +25 -16
  95. package/src/components/button-link/basic.tsx +3 -3
  96. package/src/components/button-link/image.tsx +0 -1
  97. package/src/components/card/basic.tsx +1 -1
  98. package/src/components/combobox/partials/variants.tsx +1 -1
  99. package/src/components/details/basic.tsx +2 -2
  100. package/src/components/form/basic.tsx +1 -1
  101. package/src/components/form/error-list.tsx +1 -0
  102. package/src/components/handout/basic.tsx +304 -279
  103. package/src/components/input-checkbox/partials/variants.tsx +22 -10
  104. package/src/components/input-date/reset.tsx +1 -1
  105. package/src/components/input-password/show-password.tsx +1 -1
  106. package/src/components/input-text/partials/cases.tsx +1 -1
  107. package/src/components/input-text/routes.ts +2 -0
  108. package/src/components/input-text/smart-button.tsx +33 -0
  109. package/src/components/input-text/text-formatter.tsx +98 -45
  110. package/src/components/link/image.tsx +0 -1
  111. package/src/components/link/target.tsx +1 -1
  112. package/src/components/modal/basic.tsx +1 -1
  113. package/src/components/nav/basic.tsx +23 -12
  114. package/src/components/nav/horizontal.tsx +12 -3
  115. package/src/components/nav/links.ts +36 -0
  116. package/src/components/table/column-alignment.tsx +64 -62
  117. package/src/components/table/complex-headers.tsx +80 -78
  118. package/src/components/table/horizontal-scrollbar.tsx +30 -28
  119. package/src/components/table/interactive-child-elements.tsx +81 -69
  120. package/src/components/table/pagination-position.tsx +15 -13
  121. package/src/components/table/render-cell.tsx +14 -3
  122. package/src/components/table/sort-data.tsx +11 -8
  123. package/src/components/table/stateful-with-selection.tsx +47 -27
  124. package/src/components/table/stateful-with-single-selection.tsx +47 -27
  125. package/src/components/table/stateless-with-selection.tsx +37 -17
  126. package/src/components/table/stateless-with-single-selection.tsx +37 -17
  127. package/src/components/table/stateless.tsx +29 -27
  128. package/src/components/table/with-footer.tsx +1 -0
  129. package/src/components/table/with-pagination.tsx +1 -1
  130. package/src/components/tabs/behavior.tsx +61 -0
  131. package/src/components/tabs/routes.ts +2 -0
  132. package/src/components/textarea/adjust-height.tsx +1 -1
  133. package/src/components/textarea/counter.tsx +4 -1
  134. package/src/components/textarea/resize.tsx +1 -1
  135. package/src/components/textarea/rows.tsx +1 -1
  136. package/src/components/toast/basic.tsx +13 -11
  137. package/src/hooks/useToasterService.ts +21 -0
  138. package/src/react.main.tsx +6 -1
  139. package/src/scenarios/appointment-form/AppointmentForm.tsx +1 -0
  140. package/src/scenarios/custom-tooltip-width.tsx +26 -11
  141. package/src/scenarios/disabled-interactive-elements.tsx +123 -114
  142. package/src/scenarios/focus-elements.tsx +21 -16
  143. package/src/scenarios/horizontal-scrollbar-advanced/TableHorizontalScrollbarAdvanced.tsx +1 -1
  144. package/src/scenarios/horizontal-scrollbar-advanced/layout.scss +19 -0
  145. package/src/scenarios/input-group-with-error.tsx +41 -0
  146. package/src/scenarios/inputs-get-value.tsx +121 -119
  147. package/src/scenarios/routes.ts +4 -2
  148. package/src/scenarios/static-form.tsx +65 -62
  149. package/src/style.scss +10 -13
  150. package/tsconfig.json +1 -2
  151. package/unocss.config.ts +213 -0
  152. package/dist/3171.js +0 -2
  153. package/dist/4262.js +0 -2
  154. package/dist/479.js +0 -2
  155. package/dist/8710.js +0 -2
  156. package/src/scenarios/horizontal-scrollbar-advanced/layout.css +0 -31
  157. /package/dist/{3171.js.LICENSE.txt → 3301.js.LICENSE.txt} +0 -0
  158. /package/dist/{4262.js.LICENSE.txt → 4065.js.LICENSE.txt} +0 -0
  159. /package/dist/{479.js.LICENSE.txt → 4795.js.LICENSE.txt} +0 -0
  160. /package/dist/{8710.js.LICENSE.txt → 7440.js.LICENSE.txt} +0 -0
@@ -9,84 +9,86 @@ export const TableComplexHeaders: FC = () => (
9
9
  <p>This sample shows KolTable using vertical and horizontal headers, applying colspan and rowspan.</p>
10
10
  </SampleDescription>
11
11
 
12
- <KolTable
13
- _label="Business hours"
14
- _data={[
15
- {
16
- asp: 'Center',
17
- monday: '08:00',
18
- tuesday: '08:00',
19
- wednesday: '10:00',
20
- thursday: '11:00',
21
- friday: '08:00',
22
- },
23
- {
24
- asp: 'Tiergarten',
25
- monday: '08:00',
26
- tuesday: '08:00',
27
- wednesday: '10:00',
28
- thursday: '11:00',
29
- friday: '08:00',
30
- },
31
- {
32
- asp: 'Maxvorstadt',
33
- monday: '08:00',
34
- tuesday: '08:00',
35
- wednesday: '10:00',
36
- thursday: '11:00',
37
- friday: '08:00',
38
- },
39
- ]}
40
- _headers={{
41
- vertical: [[{ label: 'Berlin', rowSpan: 2 }, { label: 'München' }]],
42
- horizontal: [
43
- [
44
- {
45
- label: '',
46
- colSpan: 7,
47
- },
48
- {
49
- label: 'Weekend',
50
- colSpan: 2,
51
- },
12
+ <section className="w-full flex flex-col">
13
+ <KolTable
14
+ _label="Business hours"
15
+ _data={[
16
+ {
17
+ asp: 'Center',
18
+ monday: '08:00',
19
+ tuesday: '08:00',
20
+ wednesday: '10:00',
21
+ thursday: '11:00',
22
+ friday: '08:00',
23
+ },
24
+ {
25
+ asp: 'Tiergarten',
26
+ monday: '08:00',
27
+ tuesday: '08:00',
28
+ wednesday: '10:00',
29
+ thursday: '11:00',
30
+ friday: '08:00',
31
+ },
32
+ {
33
+ asp: 'Maxvorstadt',
34
+ monday: '08:00',
35
+ tuesday: '08:00',
36
+ wednesday: '10:00',
37
+ thursday: '11:00',
38
+ friday: '08:00',
39
+ },
40
+ ]}
41
+ _headers={{
42
+ vertical: [[{ label: 'Berlin', rowSpan: 2 }, { label: 'München' }]],
43
+ horizontal: [
44
+ [
45
+ {
46
+ label: '',
47
+ colSpan: 7,
48
+ },
49
+ {
50
+ label: 'Weekend',
51
+ colSpan: 2,
52
+ },
53
+ ],
54
+ [
55
+ { label: '' },
56
+ {
57
+ label: 'District',
58
+ key: 'asp',
59
+ },
60
+ {
61
+ label: 'Monday',
62
+ key: 'monday',
63
+ },
64
+ {
65
+ label: 'Tuesday',
66
+ key: 'tuesday',
67
+ },
68
+ {
69
+ label: 'Wednesday',
70
+ key: 'wednesday',
71
+ },
72
+ {
73
+ label: 'Thursday',
74
+ key: 'thursday',
75
+ },
76
+ {
77
+ label: 'Friday',
78
+ key: 'friday',
79
+ },
80
+ {
81
+ label: 'Saturday',
82
+ key: 'saturday',
83
+ },
84
+ {
85
+ label: 'Sunday',
86
+ key: 'sunday',
87
+ },
88
+ ],
52
89
  ],
53
- [
54
- { label: '' },
55
- {
56
- label: 'District',
57
- key: 'asp',
58
- },
59
- {
60
- label: 'Monday',
61
- key: 'monday',
62
- },
63
- {
64
- label: 'Tuesday',
65
- key: 'tuesday',
66
- },
67
- {
68
- label: 'Wednesday',
69
- key: 'wednesday',
70
- },
71
- {
72
- label: 'Thursday',
73
- key: 'thursday',
74
- },
75
- {
76
- label: 'Friday',
77
- key: 'friday',
78
- },
79
- {
80
- label: 'Saturday',
81
- key: 'saturday',
82
- },
83
- {
84
- label: 'Sunday',
85
- key: 'sunday',
86
- },
87
- ],
88
- ],
89
- }}
90
- />
90
+ }}
91
+ />
92
+ </section>
91
93
  </>
92
94
  );
@@ -29,34 +29,36 @@ export const TableHorizontalScrollbar: FC = () => {
29
29
  </p>
30
30
  </SampleDescription>
31
31
 
32
- <KolHeading _label="Table with scrollbar" _level={2} />
33
-
34
- <KolTable
35
- _label="Table for demonstration purposes with horizontal scrollbar."
36
- _minWidth={hasWidthRestriction ? '600px' : 'auto'}
37
- _headers={HEADERS}
38
- _data={DATA}
39
- className="block"
40
- style={{ width: '400px' }}
41
- />
42
-
43
- <KolInputCheckbox
44
- _checked={hasWidthRestriction}
45
- _label="Toggle width restriction"
46
- _variant="switch"
47
- _on={{
48
- onChange: (_event, value) => {
49
- setHasWidthRestriction(Boolean(value));
50
- },
51
- }}
52
- ></KolInputCheckbox>
53
-
54
- <KolHeading _label="Same table without scrollbar" _level={2} className="block mt-4" />
55
- <p className="mt-0">
56
- <i>Scrollbar appears on very small viewport sizes</i>
57
- </p>
58
-
59
- <KolTable _label="Table for demonstration purposes without horizontal scrollbar" _minWidth="600px" _headers={HEADERS} _data={DATA} className="block" />
32
+ <section className="w-full flex flex-col">
33
+ <KolHeading _label="Table with scrollbar" _level={2} />
34
+
35
+ <KolTable
36
+ _label="Table for demonstration purposes with horizontal scrollbar."
37
+ _minWidth={hasWidthRestriction ? '600px' : 'auto'}
38
+ _headers={HEADERS}
39
+ _data={DATA}
40
+ className="block"
41
+ style={{ width: '400px' }}
42
+ />
43
+
44
+ <KolInputCheckbox
45
+ _checked={hasWidthRestriction}
46
+ _label="Toggle width restriction"
47
+ _variant="switch"
48
+ _on={{
49
+ onChange: (_event, value) => {
50
+ setHasWidthRestriction(Boolean(value));
51
+ },
52
+ }}
53
+ ></KolInputCheckbox>
54
+
55
+ <KolHeading _label="Same table without scrollbar" _level={2} className="block mt-4" />
56
+ <p className="mt-0">
57
+ <i>Scrollbar appears on very small viewport sizes</i>
58
+ </p>
59
+
60
+ <KolTable _label="Table for demonstration purposes without horizontal scrollbar" _minWidth="600px" _headers={HEADERS} _data={DATA} className="block" />
61
+ </section>
60
62
  </>
61
63
  );
62
64
  };
@@ -1,10 +1,20 @@
1
+ import type { ButtonProps, 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';
7
+ import { useToasterService } from '../../hooks/useToasterService';
8
+
9
+ function KolButtonWrapper({ _on, ...other }: ButtonProps) {
10
+ const { dummyClickEventHandler } = useToasterService();
11
+
12
+ const dummyEventHandler = {
13
+ onClick: dummyClickEventHandler,
14
+ };
15
+
16
+ return <KolButton {...other} _on={dummyEventHandler} />;
17
+ }
8
18
 
9
19
  const getButtonHeaderCell = (variant: ButtonVariantPropType): KoliBriTableHeaderCell => {
10
20
  const capitalizedVariant = variant.charAt(0).toUpperCase() + variant.slice(1);
@@ -19,7 +29,7 @@ const getButtonHeaderCell = (variant: ButtonVariantPropType): KoliBriTableHeader
19
29
  _icons: { right: 'codicon codicon-squirrel' },
20
30
  };
21
31
  getRoot(createReactRenderElement(element)).render(
22
- cell.label === 'button' ? <KolButton {...commonProps} /> : <KolLinkButton _href="#/back-page" {...commonProps} />,
32
+ cell.label === 'button' ? <KolButtonWrapper {...commonProps} /> : <KolLinkButton _href="#/back-page" {...commonProps} />,
23
33
  );
24
34
  },
25
35
  };
@@ -33,73 +43,75 @@ export const InteractiveChildElements: FC = () => (
33
43
  </p>
34
44
  </SampleDescription>
35
45
 
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'),
46
+ <section className="w-full flex flex-col">
47
+ <KolTableStateless
48
+ _label="Button styles"
49
+ _headerCells={{
50
+ horizontal: [
51
+ [
52
+ { label: '', asTd: true, width: '20ex' },
53
+ getButtonHeaderCell('primary'),
54
+ getButtonHeaderCell('secondary'),
55
+ getButtonHeaderCell('normal'),
56
+ getButtonHeaderCell('danger'),
57
+ getButtonHeaderCell('ghost'),
58
+ ],
47
59
  ],
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
- />
60
+ vertical: [[{ label: 'Button' }, { label: 'Link-Button' }]],
61
+ }}
62
+ _data={[
63
+ {
64
+ primary: 'button',
65
+ secondary: 'button',
66
+ normal: 'button',
67
+ danger: 'button',
68
+ ghost: 'button',
69
+ },
70
+ {
71
+ primary: 'link-button',
72
+ secondary: 'link-button',
73
+ normal: 'link-button',
74
+ danger: 'link-button',
75
+ ghost: 'link-button',
76
+ },
77
+ ]}
78
+ className="block"
79
+ />
69
80
 
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
- );
81
+ <KolTableStateless
82
+ _label="Link styles"
83
+ _headerCells={{
84
+ horizontal: [
85
+ [
86
+ { label: '', asTd: true, width: '20ex' },
87
+ {
88
+ key: 'regular',
89
+ label: 'Regular',
90
+ textAlign: 'left',
91
+ render: (element: HTMLElement, cell: KoliBriTableCell) => {
92
+ const commonProps = {
93
+ _label: cell.label,
94
+ _icons: { right: 'codicon codicon-squirrel' },
95
+ };
96
+ getRoot(createReactRenderElement(element)).render(
97
+ cell.label === 'button-link' ? <KolButtonLink {...commonProps} /> : <KolLink _href="#/back-page" {...commonProps} />,
98
+ );
99
+ },
88
100
  },
89
- },
101
+ ],
90
102
  ],
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
- />
103
+ vertical: [[{ label: 'Link' }, { label: 'Button-Link' }]],
104
+ }}
105
+ _data={[
106
+ {
107
+ regular: 'link',
108
+ },
109
+ {
110
+ regular: 'button-link',
111
+ },
112
+ ]}
113
+ className="block mt"
114
+ />
115
+ </section>
104
116
  </>
105
117
  );
@@ -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
  );
@@ -7,7 +7,8 @@ import { getRoot } from '../../shares/react-roots';
7
7
  import { SampleDescription } from '../SampleDescription';
8
8
  import { DATE_FORMATTER } from './formatter';
9
9
 
10
- import type { KoliBriTableHeaders } from '@public-ui/components';
10
+ import type { IconsPropType, KoliBriTableHeaders } from '@public-ui/components';
11
+ import { useToasterService } from '../../hooks/useToasterService';
11
12
 
12
13
  type Data = {
13
14
  order: number;
@@ -32,6 +33,16 @@ const DATA: Data[] = [
32
33
  },
33
34
  ];
34
35
 
36
+ function KolButtonWrapper({ label, icons }: { label: string; icons: IconsPropType }) {
37
+ const { dummyClickEventHandler } = useToasterService();
38
+
39
+ const dummyEventHandler = {
40
+ onClick: dummyClickEventHandler,
41
+ };
42
+
43
+ return <KolButton _label={label} _icons={icons} _on={dummyEventHandler} />;
44
+ }
45
+
35
46
  const HEADERS: KoliBriTableHeaders = {
36
47
  horizontal: [
37
48
  [
@@ -89,7 +100,7 @@ const HEADERS: KoliBriTableHeaders = {
89
100
  }}
90
101
  >
91
102
  <KolInputText _label="Input" />
92
- <KolButton _label="Save" _icons={{ left: 'codicon codicon-save' }} />
103
+ <KolButtonWrapper label="Save" icons={{ left: 'codicon codicon-save' }} />
93
104
  </div>,
94
105
  );
95
106
  },
@@ -104,6 +115,6 @@ export const TableRenderCell: FC = () => (
104
115
  <p>This sample shows KolTable using React render functions for the cell contents.</p>
105
116
  </SampleDescription>
106
117
 
107
- <KolTable _label="Sort by date column" _data={DATA} _headers={HEADERS} className="block min-w-75em" />
118
+ <KolTable _label="Sort by date column" _data={DATA} _headers={HEADERS} className="w-full" />
108
119
  </>
109
120
  );
@@ -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,11 @@
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';
8
+ import { useToasterService } from '../../hooks/useToasterService';
6
9
 
7
10
  const DATA = [
8
11
  { id: '1001', name: 'Foo Bar', internalIdentifier: `AAA1001` },
@@ -10,6 +13,16 @@ const DATA = [
10
13
  ];
11
14
  type Data = (typeof DATA)[0];
12
15
 
16
+ function KolButtonWrapper({ label }: { label: string }) {
17
+ const { dummyClickEventHandler } = useToasterService();
18
+
19
+ const dummyEventHandler = {
20
+ onClick: dummyClickEventHandler,
21
+ };
22
+
23
+ return <KolButton _label={label} _on={dummyEventHandler} />;
24
+ }
25
+
13
26
  export const TableStatefulWithSelection: FC = () => {
14
27
  const [selectedValue, setSelectedValue] = useState<Data[] | null>();
15
28
 
@@ -43,40 +56,47 @@ export const TableStatefulWithSelection: FC = () => {
43
56
  };
44
57
  }, [kolTableStatefulRef]);
45
58
 
59
+ const renderButton = (element: HTMLElement, cell: KoliBriTableCell) => {
60
+ getRoot(createReactRenderElement(element)).render(<KolButtonWrapper label={`Click ${cell.data?.id}`} />);
61
+ };
62
+
46
63
  return (
47
64
  <>
48
65
  <SampleDescription>
49
66
  <p>This sample shows KolTableStateful with checkboxes for selection enabled.</p>
50
67
  </SampleDescription>
51
68
 
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' },
69
+ <section className="w-full">
70
+ <KolTableStateful
71
+ _label="Table with selection checkboxes"
72
+ _headers={{
73
+ horizontal: [
74
+ [
75
+ { key: 'id', label: '#ID', textAlign: 'left' },
76
+ { key: 'name', label: 'Name', textAlign: 'left' },
77
+ { key: 'action', label: 'Action', textAlign: 'left', render: renderButton },
78
+ ],
59
79
  ],
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
80
  }}
77
- ></KolButton>
78
- <pre>{JSON.stringify(selectedValue, null, 2)}</pre>
79
- </div>
81
+ _data={DATA}
82
+ _selection={selection}
83
+ _on={{ onSelectionChange: handleSelectionChangeCallback }}
84
+ className="block"
85
+ style={{ maxWidth: '600px' }}
86
+ ref={kolTableStatefulRef}
87
+ />
88
+ <div className="grid grid-cols-3 items-end gap-4 mt-4">
89
+ <KolButton
90
+ _label="getSelection()"
91
+ _on={{
92
+ onClick: () => {
93
+ void handleButtonClick();
94
+ },
95
+ }}
96
+ ></KolButton>
97
+ <pre className="text-base">{JSON.stringify(selectedValue, null, 2)}</pre>
98
+ </div>
99
+ </section>
80
100
  </>
81
101
  );
82
102
  };