@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.
- package/package.json +10 -10
- package/src/App.tsx +2 -0
- package/src/components/InputEventValueDemo.tsx +6 -3
- package/src/components/SampleBlock.tsx +81 -0
- package/src/components/SampleGroup.tsx +27 -0
- package/src/components/abbr/basic.tsx +6 -3
- package/src/components/accordion/basic.tsx +3 -2
- package/src/components/accordion/headlines.tsx +3 -2
- package/src/components/alert/basic.tsx +17 -14
- package/src/components/avatar/basic.tsx +3 -2
- package/src/components/avatar/size.tsx +3 -2
- package/src/components/badge/basic.tsx +48 -7
- package/src/components/badge/routes.ts +0 -4
- package/src/components/breadcrumb/basic.tsx +3 -2
- package/src/components/button/access-key.tsx +8 -10
- package/src/components/button/aria-description.tsx +4 -4
- package/src/components/button/baselined.tsx +4 -4
- package/src/components/button/basic.tsx +10 -17
- package/src/components/button/disabled.tsx +6 -7
- package/src/components/button/expert-slot.tsx +6 -7
- package/src/components/button/focus-options.tsx +8 -10
- package/src/components/button/hide-label.tsx +8 -10
- package/src/components/button/icons.tsx +12 -16
- package/src/components/button/row-reverse-tooltip.tsx +4 -4
- package/src/components/button/short-key.tsx +15 -20
- package/src/components/button/spinner.tsx +6 -7
- package/src/components/button/variants.tsx +6 -6
- package/src/components/button/width.tsx +6 -7
- package/src/components/button-link/aria-description.tsx +3 -2
- package/src/components/button-link/basic.tsx +37 -35
- package/src/components/button-link/icons.tsx +13 -2
- package/src/components/button-link/image.tsx +3 -2
- package/src/components/card/basic.tsx +3 -2
- package/src/components/card/headlines.tsx +3 -2
- package/src/components/card/linked.tsx +3 -2
- package/src/components/combobox/partials/cases.tsx +40 -14
- package/src/components/combobox/partials/variants.tsx +7 -8
- package/src/components/details/basic.tsx +3 -2
- package/src/components/form/basic.tsx +5 -4
- package/src/components/form/error-list-scroll.tsx +87 -0
- package/src/components/form/error-list.tsx +56 -56
- package/src/components/form/routes.ts +2 -0
- package/src/components/heading/badged.tsx +3 -2
- package/src/components/heading/basic.tsx +3 -2
- package/src/components/heading/paragraph.tsx +3 -2
- package/src/components/heading/secondary.tsx +3 -2
- package/src/components/icon/all-kolicons.tsx +1 -1
- package/src/components/icon/basic.tsx +6 -6
- package/src/components/icon/font.tsx +21 -13
- package/src/components/image/basic.tsx +8 -5
- package/src/components/input-checkbox/partials/cases.tsx +75 -14
- package/src/components/input-checkbox/partials/variants.tsx +13 -16
- package/src/components/input-color/partials/cases.tsx +61 -18
- package/src/components/input-color/partials/variants.tsx +7 -8
- package/src/components/input-date/partials/cases.tsx +70 -26
- package/src/components/input-date/partials/minMax.tsx +38 -11
- package/src/components/input-date/partials/variants.tsx +10 -12
- package/src/components/input-email/partials/cases.tsx +69 -30
- package/src/components/input-email/partials/variants.tsx +7 -8
- package/src/components/input-file/partials/cases.tsx +58 -24
- package/src/components/input-file/partials/variants.tsx +7 -8
- package/src/components/input-number/number-formatter.tsx +5 -4
- package/src/components/input-number/partials/cases.tsx +68 -28
- package/src/components/input-number/partials/variants.tsx +7 -8
- package/src/components/input-password/partials/cases.tsx +67 -30
- package/src/components/input-password/partials/variants.tsx +7 -8
- package/src/components/input-password/show-password.tsx +22 -19
- package/src/components/input-radio/horizontal.tsx +3 -2
- package/src/components/input-radio/objectValue.tsx +5 -4
- package/src/components/input-radio/partials/cases.tsx +85 -55
- package/src/components/input-radio/partials/variants.tsx +7 -9
- package/src/components/input-range/partials/cases.tsx +60 -23
- package/src/components/input-range/partials/variants.tsx +7 -8
- package/src/components/input-text/access-short-key.tsx +11 -4
- package/src/components/input-text/aria-details.tsx +3 -2
- package/src/components/input-text/background-test.tsx +7 -5
- package/src/components/input-text/basic.tsx +24 -5
- package/src/components/input-text/clear-button.tsx +26 -0
- package/src/components/input-text/counter.tsx +3 -2
- package/src/components/input-text/disabled.tsx +11 -4
- package/src/components/input-text/expert-slot.tsx +13 -8
- package/src/components/input-text/hide-label.tsx +7 -6
- package/src/components/input-text/hide-msg.tsx +5 -4
- package/src/components/input-text/message-types.tsx +13 -4
- package/src/components/input-text/msg-and-counter.tsx +9 -4
- package/src/components/input-text/pattern.tsx +18 -15
- package/src/components/input-text/placeholder.tsx +13 -4
- package/src/components/input-text/readonly.tsx +11 -4
- package/src/components/input-text/routes.ts +2 -0
- package/src/components/input-text/select-range.tsx +3 -2
- package/src/components/input-text/smart-button.tsx +7 -4
- package/src/components/input-text/text-formatter.tsx +5 -4
- package/src/components/input-text/variant.tsx +8 -6
- package/src/components/kolibri/basic.tsx +9 -6
- package/src/components/link/basic.tsx +3 -2
- package/src/components/link/icons.tsx +3 -2
- package/src/components/link/image.tsx +3 -2
- package/src/components/link/target.tsx +3 -2
- package/src/components/link/variant.tsx +5 -4
- package/src/components/link-button/aria-description.tsx +7 -1
- package/src/components/link-button/basic.tsx +5 -4
- package/src/components/link-button/routes.ts +2 -0
- package/src/components/link-button/target.tsx +19 -0
- package/src/components/meter/basic.tsx +4 -4
- package/src/components/meter/dynamic.tsx +4 -4
- package/src/components/meter/optimum.tsx +8 -10
- package/src/components/meter/orientation.tsx +6 -7
- package/src/components/nav/aria-current.tsx +18 -15
- package/src/components/nav/basic.tsx +8 -10
- package/src/components/pagination/basic.tsx +3 -2
- package/src/components/pagination/button-visibility.tsx +16 -11
- package/src/components/pagination/sibling-boundary.tsx +3 -2
- package/src/components/popover-button/inline.tsx +4 -5
- package/src/components/progress/basic.tsx +7 -6
- package/src/components/quote/basic.tsx +4 -1
- package/src/components/quote/block.tsx +9 -6
- package/src/components/select/partials/cases.tsx +73 -33
- package/src/components/select/partials/variants.tsx +7 -8
- package/src/components/single-select/partials/cases.tsx +148 -114
- package/src/components/single-select/partials/variants.tsx +7 -8
- package/src/components/spin/basic.tsx +34 -3
- package/src/components/spin/routes.ts +0 -8
- package/src/components/split-button/basic.tsx +3 -2
- package/src/components/table/action-columns.tsx +3 -2
- package/src/components/table/column-alignment.tsx +3 -2
- package/src/components/table/complex-headers.tsx +3 -2
- package/src/components/table/empty.tsx +31 -0
- package/src/components/table/horizontal-scrollbar.tsx +24 -19
- package/src/components/table/multi-sort.tsx +6 -7
- package/src/components/table/non-hidable-columns.tsx +18 -15
- package/src/components/table/pagination-position.tsx +8 -10
- package/src/components/table/routes.ts +4 -0
- package/src/components/table/sort-data.tsx +6 -7
- package/src/components/table/stateful-async.tsx +50 -0
- package/src/components/table/stateful-with-selection.tsx +3 -2
- package/src/components/table/stateful-with-single-selection.tsx +3 -2
- package/src/components/table/stateless-async-paging.tsx +9 -32
- package/src/components/table/stateless-with-selection.tsx +3 -2
- package/src/components/table/stateless-with-single-selection.tsx +3 -2
- package/src/components/table/stateless.tsx +3 -2
- package/src/components/table/sticky-col.tsx +12 -10
- package/src/components/table/sticky-header.tsx +12 -10
- package/src/components/table/variant.tsx +5 -4
- package/src/components/table/with-footer.tsx +73 -70
- package/src/components/table/with-pagination.tsx +3 -2
- package/src/components/tabs/basic.tsx +17 -12
- package/src/components/tabs/create-button.tsx +11 -8
- package/src/components/tabs/icons-only.tsx +9 -6
- package/src/components/textarea/adjust-height.tsx +6 -3
- package/src/components/textarea/partials/cases.tsx +63 -15
- package/src/components/textarea/partials/variants.tsx +7 -8
- package/src/components/textarea/resize.tsx +3 -2
- package/src/components/textarea/rows.tsx +6 -3
- package/src/components/textarea/with-counter.tsx +3 -2
- package/src/components/toolbar/basic.tsx +6 -5
- package/src/components/toolbar/disabled.tsx +41 -38
- package/src/components/tree/basic.tsx +32 -29
- package/src/components/version/basic.tsx +4 -1
- package/src/components/version/context.tsx +8 -5
- package/src/hooks/useVisualBlockOutline.ts +38 -0
- package/src/scenarios/button-shortkey-table.tsx +4 -4
- package/src/shares/store.ts +0 -4
- package/src/shares/visualBlockOutline.ts +75 -0
- package/src/components/badge/button.tsx +0 -35
- package/src/components/badge/formatted-label.tsx +0 -19
- package/src/components/spin/custom.tsx +0 -23
- package/src/components/spin/cycle.tsx +0 -16
- package/src/components/spin/label.tsx +0 -23
- package/src/components/spin/variables.tsx +0 -16
|
@@ -2,7 +2,8 @@ import type { FC } from 'react';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
|
|
4
4
|
import type { KoliBriTableHeaders, KoliBriTableSelection } from '@public-ui/components';
|
|
5
|
-
import {
|
|
5
|
+
import { KolTableStateful } from '@public-ui/react-v19';
|
|
6
|
+
import { SampleBlock } from '../SampleBlock';
|
|
6
7
|
import { SampleDescription } from '../SampleDescription';
|
|
7
8
|
import { COMPLEX_DATA } from './test-complex-data';
|
|
8
9
|
|
|
@@ -37,14 +38,15 @@ export const TableStickyCol: FC = () => (
|
|
|
37
38
|
</p>
|
|
38
39
|
</SampleDescription>
|
|
39
40
|
|
|
40
|
-
<
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
41
|
+
<SampleBlock id="sticky-cols" heading="Sticky columns">
|
|
42
|
+
<KolTableStateful
|
|
43
|
+
_label="Animal species overview"
|
|
44
|
+
_data={COMPLEX_DATA}
|
|
45
|
+
_headers={HEADERS_HORIZONTAL}
|
|
46
|
+
className="block"
|
|
47
|
+
_selection={selection}
|
|
48
|
+
_fixedCols={[2, 1]}
|
|
49
|
+
/>
|
|
50
|
+
</SampleBlock>
|
|
49
51
|
</>
|
|
50
52
|
);
|
|
@@ -2,7 +2,8 @@ import type { FC } from 'react';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
|
|
4
4
|
import type { KoliBriTableHeaders, KoliBriTableSelection } from '@public-ui/components';
|
|
5
|
-
import {
|
|
5
|
+
import { KolTableStateful } from '@public-ui/react-v19';
|
|
6
|
+
import { SampleBlock } from '../SampleBlock';
|
|
6
7
|
import { SampleDescription } from '../SampleDescription';
|
|
7
8
|
import { COMPLEX_DATA } from './test-complex-data';
|
|
8
9
|
|
|
@@ -38,14 +39,15 @@ export const TableStickyHeader: FC = () => (
|
|
|
38
39
|
</p>
|
|
39
40
|
</SampleDescription>
|
|
40
41
|
|
|
41
|
-
<
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
42
|
+
<SampleBlock id="sticky-header" heading="Sticky headers">
|
|
43
|
+
<KolTableStateful
|
|
44
|
+
_label="Animal species overview"
|
|
45
|
+
_data={COMPLEX_DATA}
|
|
46
|
+
_headers={HEADERS_HORIZONTAL}
|
|
47
|
+
className="block"
|
|
48
|
+
_selection={selection}
|
|
49
|
+
style={{ '--kol-table-max-height': '75vh' }}
|
|
50
|
+
/>
|
|
51
|
+
</SampleBlock>
|
|
50
52
|
</>
|
|
51
53
|
);
|
|
@@ -3,6 +3,7 @@ import React, { useMemo } from 'react';
|
|
|
3
3
|
|
|
4
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';
|
|
@@ -11,7 +12,7 @@ import { DATA } from './test-data';
|
|
|
11
12
|
import type { KoliBriTableHeaders } from '@public-ui/components';
|
|
12
13
|
import { useSearchParams } from 'react-router';
|
|
13
14
|
import { fetchVariantData } from '../../shares/fetchVariantData';
|
|
14
|
-
import {
|
|
15
|
+
import { getTheme } from '../../shares/store';
|
|
15
16
|
|
|
16
17
|
const HEADERS: KoliBriTableHeaders = {
|
|
17
18
|
horizontal: [
|
|
@@ -24,7 +25,7 @@ const HEADERS: KoliBriTableHeaders = {
|
|
|
24
25
|
|
|
25
26
|
export const TableVariant: FC = () => {
|
|
26
27
|
const [searchParams] = useSearchParams();
|
|
27
|
-
const theme = searchParams.get('theme') ??
|
|
28
|
+
const theme = searchParams.get('theme') ?? getTheme();
|
|
28
29
|
const tableVariants = useMemo(() => (theme ? fetchVariantData(theme, 'tableVariants') : []), [theme]);
|
|
29
30
|
|
|
30
31
|
return (
|
|
@@ -33,7 +34,7 @@ export const TableVariant: FC = () => {
|
|
|
33
34
|
<p>This sample shows KolTableStateful with different variants controlled by the theme.</p>
|
|
34
35
|
</SampleDescription>
|
|
35
36
|
|
|
36
|
-
<
|
|
37
|
+
<SampleBlock id="variants" className="w-full flex flex-col gap-14">
|
|
37
38
|
{!Array.isArray(tableVariants) || tableVariants.length === 0 ? (
|
|
38
39
|
<p>This theme has no variants for tables.</p>
|
|
39
40
|
) : (
|
|
@@ -58,7 +59,7 @@ export const TableVariant: FC = () => {
|
|
|
58
59
|
);
|
|
59
60
|
})
|
|
60
61
|
)}
|
|
61
|
-
</
|
|
62
|
+
</SampleBlock>
|
|
62
63
|
</div>
|
|
63
64
|
);
|
|
64
65
|
};
|
|
@@ -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 TableWithFooter: FC = () => (
|
|
@@ -9,76 +10,78 @@ export const TableWithFooter: FC = () => (
|
|
|
9
10
|
<p>This sample shows KolTableStateful with footer data.</p>
|
|
10
11
|
</SampleDescription>
|
|
11
12
|
|
|
12
|
-
<
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
[
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
13
|
+
<SampleBlock id="with-footer">
|
|
14
|
+
<KolTableStateful
|
|
15
|
+
className="w-full"
|
|
16
|
+
_label="Business hours"
|
|
17
|
+
_headers={{
|
|
18
|
+
horizontal: [
|
|
19
|
+
[
|
|
20
|
+
{
|
|
21
|
+
label: 'District',
|
|
22
|
+
key: 'asp',
|
|
23
|
+
width: 160,
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
label: 'Monday',
|
|
27
|
+
key: 'monday',
|
|
28
|
+
width: 160,
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
label: 'Tuesday',
|
|
32
|
+
key: 'tuesday',
|
|
33
|
+
width: 160,
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
label: 'Wednesday',
|
|
37
|
+
key: 'wednesday',
|
|
38
|
+
width: 160,
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
label: 'Thursday',
|
|
42
|
+
key: 'thursday',
|
|
43
|
+
width: 160,
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
label: 'Friday',
|
|
47
|
+
key: 'friday',
|
|
48
|
+
width: 160,
|
|
49
|
+
},
|
|
50
|
+
],
|
|
48
51
|
],
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
52
|
+
}}
|
|
53
|
+
_data={[
|
|
54
|
+
{
|
|
55
|
+
asp: 'Center',
|
|
56
|
+
monday: '08:00',
|
|
57
|
+
tuesday: '08:00',
|
|
58
|
+
wednesday: '10:00',
|
|
59
|
+
thursday: '11:00',
|
|
60
|
+
friday: '08:00',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
asp: 'Tiergarten',
|
|
64
|
+
monday: '08:00',
|
|
65
|
+
tuesday: '08:00',
|
|
66
|
+
wednesday: '10:00',
|
|
67
|
+
thursday: '11:00',
|
|
68
|
+
friday: '08:00',
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
asp: 'Maxvorstadt',
|
|
72
|
+
monday: '08:00',
|
|
73
|
+
tuesday: '08:00',
|
|
74
|
+
wednesday: '10:00',
|
|
75
|
+
thursday: '11:00',
|
|
76
|
+
friday: '08:00',
|
|
77
|
+
},
|
|
78
|
+
]}
|
|
79
|
+
_dataFoot={[
|
|
80
|
+
{
|
|
81
|
+
tuesday: "Lunch break from 11 to 14 o'clock",
|
|
82
|
+
},
|
|
83
|
+
]}
|
|
84
|
+
/>
|
|
85
|
+
</SampleBlock>
|
|
83
86
|
</>
|
|
84
87
|
);
|
|
@@ -3,6 +3,7 @@ import React from 'react';
|
|
|
3
3
|
|
|
4
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';
|
|
@@ -25,8 +26,8 @@ export const TableWithPagination: FC = () => (
|
|
|
25
26
|
<SampleDescription>
|
|
26
27
|
<p>This sample shows how KolTableStateful can be navigated using a pagination.</p>
|
|
27
28
|
</SampleDescription>
|
|
28
|
-
<
|
|
29
|
+
<SampleBlock id="with-pagination" className="w-full">
|
|
29
30
|
<KolTableStateful _label="Table description" _data={DATA} _headers={HEADERS} _pagination={PAGINATION}></KolTableStateful>
|
|
30
|
-
</
|
|
31
|
+
</SampleBlock>
|
|
31
32
|
</>
|
|
32
33
|
);
|
|
@@ -2,6 +2,7 @@ import type { FC } from 'react';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
|
|
4
4
|
import { KolTabs } from '@public-ui/react-v19';
|
|
5
|
+
import { SampleBlock } from '../SampleBlock';
|
|
5
6
|
import { SampleDescription } from '../SampleDescription';
|
|
6
7
|
|
|
7
8
|
const tabs = [
|
|
@@ -40,18 +41,22 @@ export const TabsBasic: FC = () => (
|
|
|
40
41
|
<p>KolTabs renders tab captions and their associated content. This sample shows tab captions with and without icons and disabled tabs.</p>
|
|
41
42
|
</SampleDescription>
|
|
42
43
|
|
|
43
|
-
<
|
|
44
|
-
<
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
<SampleBlock id="regular" fitContent>
|
|
45
|
+
<KolTabs _tabs={tabsWithoutIcons} _label="Regular tabs">
|
|
46
|
+
<div slot="tab-0">Contents of Tab 1</div>
|
|
47
|
+
<div slot="tab-1">Contents of Tab 2</div>
|
|
48
|
+
<div slot="tab-2">Contents of Tab 3</div>
|
|
49
|
+
<div slot="tab-3">Contents of Tab 4</div>
|
|
50
|
+
</KolTabs>
|
|
51
|
+
</SampleBlock>
|
|
49
52
|
|
|
50
|
-
<
|
|
51
|
-
<
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
<SampleBlock id="icons" fitContent>
|
|
54
|
+
<KolTabs _tabs={tabs} className="mt-4" _label="Tabs with icons">
|
|
55
|
+
<div slot="tab-0">Contents of Tab 1</div>
|
|
56
|
+
<div slot="tab-1">Contents of Tab 2</div>
|
|
57
|
+
<div slot="tab-2">Contents of Tab 3</div>
|
|
58
|
+
<div slot="tab-3">Contents of Tab 4</div>
|
|
59
|
+
</KolTabs>
|
|
60
|
+
</SampleBlock>
|
|
56
61
|
</>
|
|
57
62
|
);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { KolTabs } from '@public-ui/react-v19';
|
|
2
2
|
import type { FC } from 'react';
|
|
3
3
|
import React, { useState } from 'react';
|
|
4
|
+
import { SampleBlock } from '../SampleBlock';
|
|
4
5
|
import { SampleDescription } from '../SampleDescription';
|
|
5
6
|
|
|
6
7
|
export const CreateButton: FC = () => {
|
|
@@ -28,15 +29,17 @@ export const CreateButton: FC = () => {
|
|
|
28
29
|
<p>This sample shows KolTabs with a "create tab" button.</p>
|
|
29
30
|
</SampleDescription>
|
|
30
31
|
|
|
31
|
-
<
|
|
32
|
-
{tabs
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
<SampleBlock id="create-button" fitContent>
|
|
33
|
+
<KolTabs _tabs={tabs} className="mt-4" _label="Tabs with create button" _hasCreateButton _on={{ onCreate: addTab }}>
|
|
34
|
+
{tabs.map((tab, index) => (
|
|
35
|
+
<div key={`tab-${index}`} slot={`tab-${index}`}>
|
|
36
|
+
Contents of {tab._label}
|
|
37
|
+
</div>
|
|
38
|
+
))}
|
|
37
39
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
+
<div slot="tab-1">Contents of Tab 2</div>
|
|
41
|
+
</KolTabs>
|
|
42
|
+
</SampleBlock>
|
|
40
43
|
</>
|
|
41
44
|
);
|
|
42
45
|
};
|
|
@@ -2,6 +2,7 @@ import type { FC } from 'react';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
|
|
4
4
|
import { KolTabs } from '@public-ui/react-v19';
|
|
5
|
+
import { SampleBlock } from '../SampleBlock';
|
|
5
6
|
import { SampleDescription } from '../SampleDescription';
|
|
6
7
|
|
|
7
8
|
const tabs = [
|
|
@@ -38,11 +39,13 @@ export const TabsIconsOnly: FC = () => (
|
|
|
38
39
|
<p>This sample shows KolTabs with hidden labels.</p>
|
|
39
40
|
</SampleDescription>
|
|
40
41
|
|
|
41
|
-
<
|
|
42
|
-
<
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
<SampleBlock id="icons-only" fitContent>
|
|
43
|
+
<KolTabs _label="Tabs with icons" _tabs={tabs}>
|
|
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
|
+
</SampleBlock>
|
|
47
50
|
</>
|
|
48
51
|
);
|
|
@@ -2,6 +2,7 @@ import type { FC } from 'react';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
|
|
4
4
|
import { KolForm, KolTextarea } from '@public-ui/react-v19';
|
|
5
|
+
import { SampleBlock } from '../SampleBlock';
|
|
5
6
|
import { SampleDescription } from '../SampleDescription';
|
|
6
7
|
|
|
7
8
|
const VALUE = `Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore
|
|
@@ -19,8 +20,10 @@ export const TextareaAdjustHeight: FC = () => (
|
|
|
19
20
|
</p>
|
|
20
21
|
</SampleDescription>
|
|
21
22
|
|
|
22
|
-
<
|
|
23
|
-
<
|
|
24
|
-
|
|
23
|
+
<SampleBlock id="adjust-height">
|
|
24
|
+
<KolForm className="w-full">
|
|
25
|
+
<KolTextarea _adjustHeight={true} _value={VALUE} _label="Text input (auto grow)" />
|
|
26
|
+
</KolForm>
|
|
27
|
+
</SampleBlock>
|
|
25
28
|
</>
|
|
26
29
|
);
|
|
@@ -3,25 +3,73 @@ import { KolTextarea } from '@public-ui/react-v19';
|
|
|
3
3
|
import React, { forwardRef } from 'react';
|
|
4
4
|
|
|
5
5
|
import { ERROR_MSG, HINT_MSG } from '../../../shares/constants';
|
|
6
|
+
import { SampleBlock } from '../../SampleBlock';
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
type TextareaCasesProps = Components.KolTextarea & {
|
|
9
|
+
/** Prefixes the visual block ids so the same cases can be rendered more than once per route. */
|
|
10
|
+
blockIdPrefix: string;
|
|
11
|
+
/**
|
|
12
|
+
* Restricts the snapshots of this rendering to the case with this id; every other block is
|
|
13
|
+
* rendered with `skipSnapshot`. Used for the `_hideLabel` groups: hiding the label mainly
|
|
14
|
+
* changes how the message is laid out, so snapshotting every case a second time would only
|
|
15
|
+
* duplicate the labelled group.
|
|
16
|
+
*/
|
|
17
|
+
snapshotOnly?: string;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const TextareaCases = forwardRef<HTMLKolTextareaElement, TextareaCasesProps>(function TextareaCases({ blockIdPrefix, snapshotOnly, ...props }, ref) {
|
|
21
|
+
// Blocks outside `snapshotOnly` stay visible in the sample but are excluded from the snapshots.
|
|
22
|
+
const block = (caseId: string) => ({ id: `${blockIdPrefix}-${caseId}`, skipSnapshot: snapshotOnly !== undefined && caseId !== snapshotOnly });
|
|
8
23
|
return (
|
|
9
24
|
<div className="grid gap-4">
|
|
10
|
-
<
|
|
25
|
+
<SampleBlock {...block('black-bg')} className="black-background">
|
|
11
26
|
<KolTextarea {...props} ref={ref} _placeholder="Placeholder" _label="Text" />
|
|
12
|
-
</
|
|
13
|
-
<
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
27
|
+
</SampleBlock>
|
|
28
|
+
<SampleBlock {...block('error')}>
|
|
29
|
+
<KolTextarea
|
|
30
|
+
{...props}
|
|
31
|
+
_placeholder="Placeholder"
|
|
32
|
+
_required
|
|
33
|
+
_msg={{ _type: 'error', _description: ERROR_MSG }}
|
|
34
|
+
_label="Text"
|
|
35
|
+
_touched
|
|
36
|
+
_hint={HINT_MSG}
|
|
37
|
+
_infoPopover={{ _label: 'hint', _content: 'Ich bin ein Hinweis.', _icons: 'kolicon-alert-info' }}
|
|
38
|
+
/>
|
|
39
|
+
</SampleBlock>
|
|
40
|
+
<SampleBlock {...block('msg-info')}>
|
|
41
|
+
<KolTextarea {...props} _placeholder="Placeholder" _label="Text" _msg={{ _type: 'info', _description: 'Just a hint' }} _touched />
|
|
42
|
+
</SampleBlock>
|
|
43
|
+
<SampleBlock {...block('msg-warning')}>
|
|
44
|
+
<KolTextarea {...props} _placeholder="Placeholder" _label="Text" _msg={{ _type: 'warning', _description: 'Small warning' }} _touched />
|
|
45
|
+
</SampleBlock>
|
|
46
|
+
<SampleBlock {...block('msg-success')}>
|
|
47
|
+
<KolTextarea {...props} _placeholder="Placeholder" _label="Text" _msg={{ _type: 'success', _description: 'Success message' }} _touched />
|
|
48
|
+
</SampleBlock>
|
|
49
|
+
<SampleBlock {...block('msg-default')}>
|
|
50
|
+
<KolTextarea {...props} _placeholder="Placeholder" _label="Text" _msg={{ _type: 'default', _description: 'Default message' }} _touched />
|
|
51
|
+
</SampleBlock>
|
|
52
|
+
<SampleBlock {...block('rows')}>
|
|
53
|
+
<KolTextarea {...props} ref={ref} _accessKey="T" _label="Text (3 rows)" _rows={3} />
|
|
54
|
+
</SampleBlock>
|
|
55
|
+
<SampleBlock {...block('placeholder')}>
|
|
56
|
+
<KolTextarea {...props} ref={ref} _label="Text (placeholder)" _rows={3} _placeholder="Placeholder" />
|
|
57
|
+
</SampleBlock>
|
|
58
|
+
<SampleBlock {...block('disabled-empty')}>
|
|
59
|
+
<KolTextarea {...props} ref={ref} _label="Text (disabled & placeholder)" _rows={3} _placeholder="Placeholder" _disabled />
|
|
60
|
+
</SampleBlock>
|
|
61
|
+
<SampleBlock {...block('readonly')}>
|
|
62
|
+
<KolTextarea {...props} ref={ref} _label="Text (readonly)" _rows={3} _placeholder="Placeholder" _readOnly />
|
|
63
|
+
</SampleBlock>
|
|
64
|
+
<SampleBlock {...block('disabled-value')}>
|
|
65
|
+
<KolTextarea {...props} ref={ref} _label="Text (disabled & value)" _rows={3} _placeholder="Placeholder" _value="Lorem ipsum" _disabled />
|
|
66
|
+
</SampleBlock>
|
|
67
|
+
<SampleBlock {...block('access-key')}>
|
|
68
|
+
<KolTextarea {...props} ref={ref} _label="With access key" _rows={3} _placeholder="Placeholder" _value="Lorem ipsum" _accessKey="c" />
|
|
69
|
+
</SampleBlock>
|
|
70
|
+
<SampleBlock {...block('short-key')}>
|
|
71
|
+
<KolTextarea {...props} ref={ref} _label="With short key" _rows={3} _placeholder="Placeholder" _value="Lorem ipsum" _shortKey="s" />
|
|
72
|
+
</SampleBlock>
|
|
25
73
|
</div>
|
|
26
74
|
);
|
|
27
75
|
});
|
|
@@ -4,17 +4,16 @@ import { TextareaCases } from './cases';
|
|
|
4
4
|
|
|
5
5
|
import type { Components } from '@public-ui/components';
|
|
6
6
|
import { SampleColumns } from '../../SampleColumns';
|
|
7
|
+
import { SampleGroup } from '../../SampleGroup';
|
|
7
8
|
export const TextareaVariants = forwardRef<HTMLKolTextareaElement, Components.KolTextarea>(function TextareaVariant(props, ref) {
|
|
8
9
|
return (
|
|
9
10
|
<SampleColumns>
|
|
10
|
-
<
|
|
11
|
-
<
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
<TextareaCases ref={ref} {...props} _hideLabel />
|
|
17
|
-
</fieldset>
|
|
11
|
+
<SampleGroup heading="Text">
|
|
12
|
+
<TextareaCases blockIdPrefix="label" {...props} />
|
|
13
|
+
</SampleGroup>
|
|
14
|
+
<SampleGroup heading="Text (hideLabel)">
|
|
15
|
+
<TextareaCases blockIdPrefix="hide-label" snapshotOnly="error" ref={ref} {...props} _hideLabel />
|
|
16
|
+
</SampleGroup>
|
|
18
17
|
</SampleColumns>
|
|
19
18
|
);
|
|
20
19
|
});
|
|
@@ -3,6 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import { KolForm, KolTextarea } from '@public-ui/react-v19';
|
|
4
4
|
|
|
5
5
|
import type { FC } from 'react';
|
|
6
|
+
import { SampleBlock } from '../SampleBlock';
|
|
6
7
|
import { SampleDescription } from '../SampleDescription';
|
|
7
8
|
export const TextareaResize: FC = () => (
|
|
8
9
|
<>
|
|
@@ -13,11 +14,11 @@ export const TextareaResize: FC = () => (
|
|
|
13
14
|
</SampleDescription>
|
|
14
15
|
|
|
15
16
|
<KolForm className="w-full">
|
|
16
|
-
<
|
|
17
|
+
<SampleBlock id="resize" className="flex flex-col gap-4">
|
|
17
18
|
<KolTextarea _label="Text input (unset)" />
|
|
18
19
|
<KolTextarea _resize="vertical" _label="Text input (vertical)" />
|
|
19
20
|
<KolTextarea _resize="none" _label="Text input (none)" />
|
|
20
|
-
</
|
|
21
|
+
</SampleBlock>
|
|
21
22
|
</KolForm>
|
|
22
23
|
</>
|
|
23
24
|
);
|
|
@@ -3,6 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import { KolForm, KolTextarea } from '@public-ui/react-v19';
|
|
4
4
|
|
|
5
5
|
import type { FC } from 'react';
|
|
6
|
+
import { SampleBlock } from '../SampleBlock';
|
|
6
7
|
import { SampleDescription } from '../SampleDescription';
|
|
7
8
|
|
|
8
9
|
export const TextareaRows: FC = () => (
|
|
@@ -13,8 +14,10 @@ export const TextareaRows: FC = () => (
|
|
|
13
14
|
</p>
|
|
14
15
|
</SampleDescription>
|
|
15
16
|
|
|
16
|
-
<
|
|
17
|
-
<
|
|
18
|
-
|
|
17
|
+
<SampleBlock id="rows">
|
|
18
|
+
<KolForm className="w-full">
|
|
19
|
+
<KolTextarea _rows={10} _label="Texteingabe" />
|
|
20
|
+
</KolForm>
|
|
21
|
+
</SampleBlock>
|
|
19
22
|
</>
|
|
20
23
|
);
|
|
@@ -2,6 +2,7 @@ import type { FC } from 'react';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
|
|
4
4
|
import { KolTextarea } from '@public-ui/react-v19';
|
|
5
|
+
import { SampleBlock } from '../SampleBlock';
|
|
5
6
|
import { SampleDescription } from '../SampleDescription';
|
|
6
7
|
|
|
7
8
|
export const TextareaWithCounter: FC = () => (
|
|
@@ -13,11 +14,11 @@ export const TextareaWithCounter: FC = () => (
|
|
|
13
14
|
</p>
|
|
14
15
|
</SampleDescription>
|
|
15
16
|
|
|
16
|
-
<
|
|
17
|
+
<SampleBlock id="with-counter" className="w-full flex flex-col gap-4">
|
|
17
18
|
<KolTextarea _label="Textarea with soft max length" _value={'Lorem Ipsum'} className="mt-2" _maxLength={20} _hasCounter _maxLengthBehavior="soft" />
|
|
18
19
|
<KolTextarea _label="Textarea with max length" _value={'Lorem Ipsum'} className="mt-2" _maxLength={20} />
|
|
19
20
|
<KolTextarea _label="Textarea with max length and counter" _value={'Lorem Ipsum'} className="mt-2" _maxLength={20} _hasCounter />
|
|
20
21
|
<KolTextarea _label="Textarea with counter" _value={'Lorem Ipsum'} className="mt-2" _hasCounter />
|
|
21
|
-
</
|
|
22
|
+
</SampleBlock>
|
|
22
23
|
</>
|
|
23
24
|
);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { ToolbarItemsPropType } from '@public-ui/components';
|
|
2
|
-
import {
|
|
2
|
+
import { KolToolbar } from '@public-ui/react-v19';
|
|
3
3
|
import type { FC } from 'react';
|
|
4
4
|
import React from 'react';
|
|
5
|
+
import { SampleBlock } from '../SampleBlock';
|
|
5
6
|
import { SampleDescription } from '../SampleDescription';
|
|
6
7
|
|
|
7
8
|
export const ToolbarBasic: FC = () => {
|
|
@@ -61,13 +62,13 @@ export const ToolbarBasic: FC = () => {
|
|
|
61
62
|
</p>
|
|
62
63
|
</SampleDescription>
|
|
63
64
|
|
|
64
|
-
<
|
|
65
|
-
<KolHeading _label="Orientation horizontal" _level={2} />
|
|
65
|
+
<SampleBlock id="horizontal" heading="Orientation horizontal" fitContent narrow>
|
|
66
66
|
<KolToolbar class="block w-fit" _label="Toolbar" _items={TOOLBAR_ITEMS} />
|
|
67
|
+
</SampleBlock>
|
|
67
68
|
|
|
68
|
-
|
|
69
|
+
<SampleBlock id="vertical" heading="Orientation vertical" fitContent>
|
|
69
70
|
<KolToolbar class="block w-fit" _label="Toolbar" _items={TOOLBAR_ITEMS} _orientation="vertical" />
|
|
70
|
-
</
|
|
71
|
+
</SampleBlock>
|
|
71
72
|
</>
|
|
72
73
|
);
|
|
73
74
|
};
|