@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.
- package/dist/1487.js +1 -1
- package/dist/1636.js +1 -1
- package/dist/1792.js +1 -1
- package/dist/1795.js +1 -1
- package/dist/2017.js +1 -1
- package/dist/2322.js +1 -1
- package/dist/2538.js +1 -1
- package/dist/2567.js +1 -1
- package/dist/263.js +1 -1
- package/dist/2719.js +1 -1
- package/dist/3064.js +1 -1
- package/dist/3077.js +1 -1
- package/dist/3238.js +1 -1
- package/dist/3301.js +2 -0
- package/dist/3395.js +1 -1
- package/dist/35.js +1 -1
- package/dist/3521.js +1 -1
- package/dist/356.js +1 -1
- package/dist/3714.js +1 -1
- package/dist/3735.js +1 -1
- package/dist/3766.js +1 -1
- package/dist/3994.js +1 -1
- package/dist/4025.js +1 -1
- package/dist/4065.js +2 -0
- package/dist/4118.js +1 -1
- package/dist/4182.js +1 -1
- package/dist/4188.js +1 -1
- package/dist/4332.js +1 -1
- package/dist/4402.js +1 -1
- package/dist/4795.js +2 -0
- package/dist/4818.js +1 -1
- package/dist/4892.js +1 -1
- package/dist/4933.js +1 -1
- package/dist/4943.js +1 -1
- package/dist/495.js +1 -1
- package/dist/5034.js +1 -1
- package/dist/5056.js +1 -1
- package/dist/5138.js +1 -1
- package/dist/5296.js +1 -1
- package/dist/5356.js +1 -1
- package/dist/5551.js +1 -1
- package/dist/5835.js +1 -1
- package/dist/5840.js +1 -1
- package/dist/5889.js +1 -1
- package/dist/5912.js +1 -1
- package/dist/6082.js +1 -1
- package/dist/6099.js +1 -1
- package/dist/6181.js +1 -1
- package/dist/619.js +1 -1
- package/dist/6671.js +1 -1
- package/dist/6775.js +1 -1
- package/dist/7274.js +1 -1
- package/dist/7440.js +2 -0
- package/dist/7795.js +1 -1
- package/dist/7802.js +1 -1
- package/dist/7860.js +1 -1
- package/dist/8092.js +1 -1
- package/dist/8111.js +1 -1
- package/dist/8146.js +1 -1
- package/dist/8427.js +1 -1
- package/dist/8495.js +1 -1
- package/dist/8672.js +1 -1
- package/dist/8737.js +1 -1
- package/dist/8786.js +1 -1
- package/dist/8796.js +1 -1
- package/dist/8977.js +1 -1
- package/dist/9333.js +1 -1
- package/dist/9389.js +1 -1
- package/dist/9561.js +1 -1
- package/dist/9599.js +1 -1
- package/dist/9612.js +1 -1
- package/dist/9890.js +1 -1
- package/dist/index.html +1 -1
- package/dist/main.css +3 -3
- package/dist/main.js +1 -1
- package/dist/main.js.LICENSE.txt +2 -2
- package/package.json +16 -16
- package/public/index.html +1 -1
- package/src/@shared/_mixins.scss +3 -0
- package/src/App.tsx +1 -1
- package/src/components/FormWrap.tsx +1 -1
- package/src/components/Navigation.tsx +63 -0
- package/src/components/Sidebar.tsx +5 -41
- package/src/components/abbr/basic.tsx +12 -12
- package/src/components/alert/card-msg.tsx +3 -1
- package/src/components/alert/html.tsx +4 -2
- package/src/components/button/access-key.tsx +34 -25
- package/src/components/button/aria-description.tsx +20 -11
- package/src/components/button/baselined.tsx +22 -13
- package/src/components/button/icons.tsx +33 -26
- package/src/components/button/partials/cases.tsx +13 -6
- package/src/components/button/partials/variants.tsx +15 -17
- package/src/components/button/width.tsx +33 -28
- package/src/components/button-group/basic.tsx +25 -16
- package/src/components/button-link/basic.tsx +3 -3
- package/src/components/button-link/image.tsx +0 -1
- package/src/components/card/basic.tsx +1 -1
- package/src/components/combobox/partials/variants.tsx +1 -1
- package/src/components/details/basic.tsx +2 -2
- package/src/components/form/basic.tsx +1 -1
- package/src/components/form/error-list.tsx +1 -0
- package/src/components/handout/basic.tsx +304 -279
- package/src/components/input-checkbox/partials/variants.tsx +22 -10
- package/src/components/input-date/reset.tsx +1 -1
- package/src/components/input-password/show-password.tsx +1 -1
- package/src/components/input-text/partials/cases.tsx +1 -1
- package/src/components/input-text/routes.ts +2 -0
- package/src/components/input-text/smart-button.tsx +33 -0
- package/src/components/input-text/text-formatter.tsx +98 -45
- package/src/components/link/image.tsx +0 -1
- package/src/components/link/target.tsx +1 -1
- package/src/components/modal/basic.tsx +1 -1
- package/src/components/nav/basic.tsx +23 -12
- package/src/components/nav/horizontal.tsx +12 -3
- package/src/components/nav/links.ts +36 -0
- package/src/components/table/column-alignment.tsx +64 -62
- package/src/components/table/complex-headers.tsx +80 -78
- package/src/components/table/horizontal-scrollbar.tsx +30 -28
- package/src/components/table/interactive-child-elements.tsx +81 -69
- package/src/components/table/pagination-position.tsx +15 -13
- package/src/components/table/render-cell.tsx +14 -3
- package/src/components/table/sort-data.tsx +11 -8
- package/src/components/table/stateful-with-selection.tsx +47 -27
- package/src/components/table/stateful-with-single-selection.tsx +47 -27
- package/src/components/table/stateless-with-selection.tsx +37 -17
- package/src/components/table/stateless-with-single-selection.tsx +37 -17
- package/src/components/table/stateless.tsx +29 -27
- package/src/components/table/with-footer.tsx +1 -0
- package/src/components/table/with-pagination.tsx +1 -1
- package/src/components/tabs/behavior.tsx +61 -0
- package/src/components/tabs/routes.ts +2 -0
- package/src/components/textarea/adjust-height.tsx +1 -1
- package/src/components/textarea/counter.tsx +4 -1
- package/src/components/textarea/resize.tsx +1 -1
- package/src/components/textarea/rows.tsx +1 -1
- package/src/components/toast/basic.tsx +13 -11
- package/src/hooks/useToasterService.ts +21 -0
- package/src/react.main.tsx +6 -1
- package/src/scenarios/appointment-form/AppointmentForm.tsx +1 -0
- package/src/scenarios/custom-tooltip-width.tsx +26 -11
- package/src/scenarios/disabled-interactive-elements.tsx +123 -114
- package/src/scenarios/focus-elements.tsx +21 -16
- package/src/scenarios/horizontal-scrollbar-advanced/TableHorizontalScrollbarAdvanced.tsx +1 -1
- package/src/scenarios/horizontal-scrollbar-advanced/layout.scss +19 -0
- package/src/scenarios/input-group-with-error.tsx +41 -0
- package/src/scenarios/inputs-get-value.tsx +121 -119
- package/src/scenarios/routes.ts +4 -2
- package/src/scenarios/static-form.tsx +65 -62
- package/src/style.scss +10 -13
- package/tsconfig.json +1 -2
- package/unocss.config.ts +213 -0
- package/dist/3171.js +0 -2
- package/dist/4262.js +0 -2
- package/dist/479.js +0 -2
- package/dist/8710.js +0 -2
- package/src/scenarios/horizontal-scrollbar-advanced/layout.css +0 -31
- /package/dist/{3171.js.LICENSE.txt → 3301.js.LICENSE.txt} +0 -0
- /package/dist/{4262.js.LICENSE.txt → 4065.js.LICENSE.txt} +0 -0
- /package/dist/{479.js.LICENSE.txt → 4795.js.LICENSE.txt} +0 -0
- /package/dist/{8710.js.LICENSE.txt → 7440.js.LICENSE.txt} +0 -0
|
@@ -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` },
|
|
@@ -11,6 +14,16 @@ const DATA = [
|
|
|
11
14
|
|
|
12
15
|
type Data = (typeof DATA)[0];
|
|
13
16
|
|
|
17
|
+
function KolButtonWrapper({ label }: { label: string }) {
|
|
18
|
+
const { dummyClickEventHandler } = useToasterService();
|
|
19
|
+
|
|
20
|
+
const dummyEventHandler = {
|
|
21
|
+
onClick: dummyClickEventHandler,
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
return <KolButton _label={label} _on={dummyEventHandler} />;
|
|
25
|
+
}
|
|
26
|
+
|
|
14
27
|
export const TableStatefulWithSingleSelection: FC = () => {
|
|
15
28
|
const [selectedValue, setSelectedValue] = useState<Data | null>();
|
|
16
29
|
|
|
@@ -45,40 +58,47 @@ export const TableStatefulWithSingleSelection: FC = () => {
|
|
|
45
58
|
};
|
|
46
59
|
}, [kolTableStatefulRef]);
|
|
47
60
|
|
|
61
|
+
const renderButton = (element: HTMLElement, cell: KoliBriTableCell) => {
|
|
62
|
+
getRoot(createReactRenderElement(element)).render(<KolButtonWrapper label={`Click ${cell.data?.id}`} />);
|
|
63
|
+
};
|
|
64
|
+
|
|
48
65
|
return (
|
|
49
66
|
<>
|
|
50
67
|
<SampleDescription>
|
|
51
68
|
<p>This sample shows KolTableStateful with radio buttons for selection enabled.</p>
|
|
52
69
|
</SampleDescription>
|
|
53
70
|
|
|
54
|
-
<
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
[
|
|
59
|
-
|
|
60
|
-
|
|
71
|
+
<section className="w-full">
|
|
72
|
+
<KolTableStateful
|
|
73
|
+
_label="Table with selection radio"
|
|
74
|
+
_headers={{
|
|
75
|
+
horizontal: [
|
|
76
|
+
[
|
|
77
|
+
{ key: 'id', label: '#ID', textAlign: 'left' },
|
|
78
|
+
{ key: 'name', label: 'Name', textAlign: 'left' },
|
|
79
|
+
{ key: 'action', label: 'Action', textAlign: 'left', render: renderButton },
|
|
80
|
+
],
|
|
61
81
|
],
|
|
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
82
|
}}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
83
|
+
_data={DATA}
|
|
84
|
+
_selection={selection}
|
|
85
|
+
_on={{ onSelectionChange: handleSelectionChangeCallback }}
|
|
86
|
+
className="block"
|
|
87
|
+
style={{ maxWidth: '600px' }}
|
|
88
|
+
ref={kolTableStatefulRef}
|
|
89
|
+
/>
|
|
90
|
+
<div className="grid grid-cols-3 items-end gap-4 mt-4">
|
|
91
|
+
<KolButton
|
|
92
|
+
_label="getSelection()"
|
|
93
|
+
_on={{
|
|
94
|
+
onClick: () => {
|
|
95
|
+
void handleButtonClick();
|
|
96
|
+
},
|
|
97
|
+
}}
|
|
98
|
+
></KolButton>
|
|
99
|
+
<pre className="text-base">{JSON.stringify(selectedValue, null, 2)}</pre>
|
|
100
|
+
</div>
|
|
101
|
+
</section>
|
|
82
102
|
</>
|
|
83
103
|
);
|
|
84
104
|
};
|
|
@@ -1,8 +1,11 @@
|
|
|
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';
|
|
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 TableStatelessWithSelection: FC = () => {
|
|
14
27
|
const [selectedKeys, setSelectedKeys] = useState(['AAA1002']);
|
|
15
28
|
|
|
@@ -39,29 +52,36 @@ export const TableStatelessWithSelection: FC = () => {
|
|
|
39
52
|
};
|
|
40
53
|
}, [kolTableStatelessRef]);
|
|
41
54
|
|
|
55
|
+
const renderButton = (element: HTMLElement, cell: KoliBriTableCell) => {
|
|
56
|
+
getRoot(createReactRenderElement(element)).render(<KolButtonWrapper label={`Click ${cell.data?.id}`} />);
|
|
57
|
+
};
|
|
58
|
+
|
|
42
59
|
return (
|
|
43
60
|
<>
|
|
44
61
|
<SampleDescription>
|
|
45
62
|
<p>This sample shows KolTableStateless with checkboxes for selection enabled.</p>
|
|
46
63
|
</SampleDescription>
|
|
47
64
|
|
|
48
|
-
<
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
[
|
|
53
|
-
|
|
54
|
-
|
|
65
|
+
<section className="w-full">
|
|
66
|
+
<KolTableStateless
|
|
67
|
+
_label="Table with selection checkboxes"
|
|
68
|
+
_headerCells={{
|
|
69
|
+
horizontal: [
|
|
70
|
+
[
|
|
71
|
+
{ key: 'id', label: '#ID', textAlign: 'left' },
|
|
72
|
+
{ key: 'name', label: 'Name', textAlign: 'left' },
|
|
73
|
+
{ key: 'action', label: 'Action', textAlign: 'left', render: renderButton },
|
|
74
|
+
],
|
|
55
75
|
],
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
76
|
+
}}
|
|
77
|
+
_data={DATA}
|
|
78
|
+
_selection={selection}
|
|
79
|
+
_on={{ onSelectionChange: handleSelectionChangeCallback }}
|
|
80
|
+
className="block"
|
|
81
|
+
style={{ maxWidth: '600px' }}
|
|
82
|
+
ref={kolTableStatelessRef}
|
|
83
|
+
/>
|
|
84
|
+
</section>
|
|
65
85
|
</>
|
|
66
86
|
);
|
|
67
87
|
};
|
|
@@ -1,8 +1,11 @@
|
|
|
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';
|
|
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 TableStatelessWithSingleSelection: FC = () => {
|
|
14
27
|
const [selectedKeys, setSelectedKeys] = useState(['1002']);
|
|
15
28
|
|
|
@@ -40,29 +53,36 @@ export const TableStatelessWithSingleSelection: FC = () => {
|
|
|
40
53
|
};
|
|
41
54
|
}, [kolTableStatelessRef]);
|
|
42
55
|
|
|
56
|
+
const renderButton = (element: HTMLElement, cell: KoliBriTableCell) => {
|
|
57
|
+
getRoot(createReactRenderElement(element)).render(<KolButtonWrapper label={`Click ${cell.data?.id}`} />);
|
|
58
|
+
};
|
|
59
|
+
|
|
43
60
|
return (
|
|
44
61
|
<>
|
|
45
62
|
<SampleDescription>
|
|
46
63
|
<p>This sample shows KolTableStateless with checkboxes for selection enabled.</p>
|
|
47
64
|
</SampleDescription>
|
|
48
65
|
|
|
49
|
-
<
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
[
|
|
54
|
-
|
|
55
|
-
|
|
66
|
+
<section className="w-full">
|
|
67
|
+
<KolTableStateless
|
|
68
|
+
_label="Table with selection checkboxes"
|
|
69
|
+
_headerCells={{
|
|
70
|
+
horizontal: [
|
|
71
|
+
[
|
|
72
|
+
{ key: 'id', label: '#ID', textAlign: 'left' },
|
|
73
|
+
{ key: 'name', label: 'Name', textAlign: 'left' },
|
|
74
|
+
{ key: 'action', label: 'Action', textAlign: 'left', render: renderButton },
|
|
75
|
+
],
|
|
56
76
|
],
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
77
|
+
}}
|
|
78
|
+
_data={DATA}
|
|
79
|
+
_selection={selection}
|
|
80
|
+
_on={{ onSelectionChange: handleSelectionChangeCallback }}
|
|
81
|
+
className="block"
|
|
82
|
+
style={{ maxWidth: '600px' }}
|
|
83
|
+
ref={kolTableStatelessRef}
|
|
84
|
+
/>
|
|
85
|
+
</section>
|
|
66
86
|
</>
|
|
67
87
|
);
|
|
68
88
|
};
|
|
@@ -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
|
-
<
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
[
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
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
|
);
|
|
@@ -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
|
</>
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { FC } from 'react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
import { KolHeading, KolTabs } from '@public-ui/react';
|
|
5
|
+
import { SampleDescription } from '../SampleDescription';
|
|
6
|
+
|
|
7
|
+
const tabs = [
|
|
8
|
+
{
|
|
9
|
+
_icons: 'codicon codicon-pie-chart',
|
|
10
|
+
_label: 'First tab',
|
|
11
|
+
_on: {
|
|
12
|
+
onSelect: (event: Event) => {
|
|
13
|
+
console.log('First tab selected', event);
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
_icons: 'codicon codicon-calendar',
|
|
19
|
+
_label: 'Second Tab',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
_disabled: true,
|
|
23
|
+
_icons: 'codicon codicon-briefcase',
|
|
24
|
+
_label: 'Disabled Tab',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
_icons: 'codicon codicon-telescope',
|
|
28
|
+
_label: 'Last tab',
|
|
29
|
+
},
|
|
30
|
+
];
|
|
31
|
+
|
|
32
|
+
export const TabsBehavior: FC = () => (
|
|
33
|
+
<>
|
|
34
|
+
<SampleDescription>
|
|
35
|
+
<p>
|
|
36
|
+
This sample shows KolTabs with the property <code>_behavior</code> set to <code>select-manual</code> and <code>select-automatic</code>.
|
|
37
|
+
</p>
|
|
38
|
+
<p>This property allows controlling when an arrow key is pressed whether the tab change takes place right away or only focuses the tab caption.</p>
|
|
39
|
+
</SampleDescription>
|
|
40
|
+
<div className="grid gap-8">
|
|
41
|
+
<div className="grid gap-4">
|
|
42
|
+
<KolHeading _level={2} _label='Tabs with "select manual" behavior' />
|
|
43
|
+
<KolTabs _tabs={tabs} _behavior="select-manual" _label="Tabs with select manual behavior">
|
|
44
|
+
<div slot="tab-0">Contents of Tab 1</div>
|
|
45
|
+
<div slot="tab-1">Contents of Tab 2</div>
|
|
46
|
+
<div slot="tab-2">Contents of Tab 3</div>
|
|
47
|
+
<div slot="tab-3">Contents of Tab 4</div>
|
|
48
|
+
</KolTabs>
|
|
49
|
+
</div>
|
|
50
|
+
<div className="grid gap-4">
|
|
51
|
+
<KolHeading _level={2} _label='Tabs with "select automatic" behavior' />
|
|
52
|
+
<KolTabs _tabs={tabs} className="mt-4" _behavior="select-automatic" _label="Tabs with select automatic behavior">
|
|
53
|
+
<div slot="tab-0">Contents of Tab 1</div>
|
|
54
|
+
<div slot="tab-1">Contents of Tab 2</div>
|
|
55
|
+
<div slot="tab-2">Contents of Tab 3</div>
|
|
56
|
+
<div slot="tab-3">Contents of Tab 4</div>
|
|
57
|
+
</KolTabs>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
</>
|
|
61
|
+
);
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { Routes } from '../../shares/types';
|
|
2
2
|
import { TabsBasic } from './basic';
|
|
3
3
|
import { TabsIconsOnly } from './icons-only';
|
|
4
|
+
import { TabsBehavior } from './behavior';
|
|
4
5
|
|
|
5
6
|
export const TABS_ROUTES: Routes = {
|
|
6
7
|
tabs: {
|
|
7
8
|
basic: TabsBasic,
|
|
8
9
|
'icons-only': TabsIconsOnly,
|
|
10
|
+
behavior: TabsBehavior,
|
|
9
11
|
},
|
|
10
12
|
};
|
|
@@ -12,6 +12,9 @@ export const TextareaCounter: FC = () => (
|
|
|
12
12
|
</p>
|
|
13
13
|
</SampleDescription>
|
|
14
14
|
|
|
15
|
-
<
|
|
15
|
+
<section className="w-full">
|
|
16
|
+
<KolTextarea _label="Textara with counter" _hasCounter={true} />
|
|
17
|
+
<KolTextarea _label="Textara with counter and initial value" _hasCounter={true} _value={'Lorem Ipsum'} className="mt" />
|
|
18
|
+
</section>
|
|
16
19
|
</>
|
|
17
20
|
);
|
|
@@ -12,7 +12,7 @@ export const TextareaResize: FC = () => (
|
|
|
12
12
|
</p>
|
|
13
13
|
</SampleDescription>
|
|
14
14
|
|
|
15
|
-
<KolForm className="grid gap-4">
|
|
15
|
+
<KolForm className="w-full grid gap-4">
|
|
16
16
|
<KolTextarea _resize="both" _label="Text input (both)" />
|
|
17
17
|
<KolTextarea _resize="vertical" _label="Text input (vertical)" className="mt" />
|
|
18
18
|
<KolTextarea _resize="horizontal" _label="Text input (horizontal)" className="mt" />
|
|
@@ -71,17 +71,19 @@ export const ToastBasic: FC = () => {
|
|
|
71
71
|
<p>This sample demonstrates the toast service with all its options.</p>
|
|
72
72
|
</SampleDescription>
|
|
73
73
|
|
|
74
|
-
<
|
|
75
|
-
<
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
<
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
<
|
|
84
|
-
|
|
74
|
+
<section className="grid gap-4">
|
|
75
|
+
<section className="flex gap-2">
|
|
76
|
+
<KolButton _label="Show simple toast" _on={{ onClick: handleButtonClickSimple }}></KolButton>
|
|
77
|
+
<KolButton _label="Show toast with alert variant 'msg'" _on={{ onClick: handleButtonClickVariantMessage }}></KolButton>
|
|
78
|
+
<KolButton _label="Show complex toast" _on={{ onClick: handleButtonClickComplex }}></KolButton>
|
|
79
|
+
</section>
|
|
80
|
+
<section className="flex gap-2">
|
|
81
|
+
<KolButton _label="Show toast and close after 2 seconds" _on={{ onClick: () => void handleButtonClickOpenAndClose() }}></KolButton>
|
|
82
|
+
</section>
|
|
83
|
+
<section className="flex gap-2">
|
|
84
|
+
<KolButton _label="Close all toasts" _on={{ onClick: closeAll }}></KolButton>
|
|
85
|
+
</section>
|
|
86
|
+
</section>
|
|
85
87
|
</>
|
|
86
88
|
);
|
|
87
89
|
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ToasterService } from '@public-ui/components';
|
|
2
|
+
|
|
3
|
+
export function useToasterService() {
|
|
4
|
+
const toaster = ToasterService.getInstance(document);
|
|
5
|
+
|
|
6
|
+
const message = () => {
|
|
7
|
+
void toaster.enqueue({
|
|
8
|
+
description: 'Hello',
|
|
9
|
+
label: `Hello`,
|
|
10
|
+
type: 'info',
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const dummyClickEventHandler = () => {
|
|
15
|
+
message();
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
return {
|
|
19
|
+
dummyClickEventHandler,
|
|
20
|
+
};
|
|
21
|
+
}
|
package/src/react.main.tsx
CHANGED
|
@@ -3,7 +3,7 @@ import { createRoot } from 'react-dom/client';
|
|
|
3
3
|
import { HashRouter as Router } from 'react-router-dom';
|
|
4
4
|
import { setTagNameTransformer } from '@public-ui/react';
|
|
5
5
|
|
|
6
|
-
import { bootstrap } from '@public-ui/components';
|
|
6
|
+
import { bootstrap, isInitialized } from '@public-ui/components';
|
|
7
7
|
import { defineCustomElements } from '@public-ui/components/dist/loader';
|
|
8
8
|
import { BMF, DEFAULT, ECL_EC, ECL_EU, ITZBund } from '@public-ui/themes';
|
|
9
9
|
|
|
@@ -34,6 +34,9 @@ const getThemes = async () => {
|
|
|
34
34
|
|
|
35
35
|
void (async () => {
|
|
36
36
|
try {
|
|
37
|
+
console.info('bootstap is initialized: ', isInitialized());
|
|
38
|
+
console.info('start kolibri bootstrap');
|
|
39
|
+
|
|
37
40
|
await bootstrap(
|
|
38
41
|
await getThemes(),
|
|
39
42
|
() => {
|
|
@@ -56,6 +59,8 @@ void (async () => {
|
|
|
56
59
|
environment: process.env.NODE_ENV === 'development' ? 'development' : 'production',
|
|
57
60
|
},
|
|
58
61
|
);
|
|
62
|
+
|
|
63
|
+
console.info('bootstap is initialized: ', isInitialized());
|
|
59
64
|
} catch (error) {
|
|
60
65
|
console.warn('Theme registration failed:', error);
|
|
61
66
|
}
|
|
@@ -101,6 +101,7 @@ export function AppointmentForm() {
|
|
|
101
101
|
|
|
102
102
|
<Formik<FormValues> innerRef={formikRef} initialValues={initialValues} validationSchema={validationSchema} onSubmit={handleSubmit}>
|
|
103
103
|
<KolTabs
|
|
104
|
+
className="w-full"
|
|
104
105
|
_tabs={[
|
|
105
106
|
{
|
|
106
107
|
_label: '1. Choose registration office',
|
|
@@ -3,16 +3,31 @@ import React from 'react';
|
|
|
3
3
|
|
|
4
4
|
import { KolButton } from '@public-ui/react';
|
|
5
5
|
import { SampleDescription } from '../components/SampleDescription';
|
|
6
|
+
import { useToasterService } from '../hooks/useToasterService';
|
|
6
7
|
|
|
7
|
-
export const CustomTooltipWidth: FC = () =>
|
|
8
|
-
|
|
9
|
-
<SampleDescription>
|
|
10
|
-
<p>
|
|
11
|
-
This sample demonstrates how a tooltip's width can be adjusted by defining the CSS custom property <code>--kol-tooltip-width</code> on one of the
|
|
12
|
-
parent elements.
|
|
13
|
-
</p>
|
|
14
|
-
</SampleDescription>
|
|
8
|
+
export const CustomTooltipWidth: FC = () => {
|
|
9
|
+
const { dummyClickEventHandler } = useToasterService();
|
|
15
10
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
const dummyEventHandler = {
|
|
12
|
+
onClick: dummyClickEventHandler,
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<>
|
|
17
|
+
<SampleDescription>
|
|
18
|
+
<p>
|
|
19
|
+
This sample demonstrates how a tooltip's width can be adjusted by defining the CSS custom property <code>--kol-tooltip-width</code> on one of the
|
|
20
|
+
parent elements.
|
|
21
|
+
</p>
|
|
22
|
+
</SampleDescription>
|
|
23
|
+
|
|
24
|
+
<KolButton
|
|
25
|
+
_label="Tooltip with fixed width"
|
|
26
|
+
_hideLabel
|
|
27
|
+
style={{ '--kol-tooltip-width': '400px' }}
|
|
28
|
+
_icons="codicon codicon-reactions"
|
|
29
|
+
_on={dummyEventHandler}
|
|
30
|
+
></KolButton>
|
|
31
|
+
</>
|
|
32
|
+
);
|
|
33
|
+
};
|