@public-ui/sample-react 2.1.7-rc.1 → 2.1.7
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/.gitignore +5 -1
- 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/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/4118.js +1 -1
- package/dist/4182.js +1 -1
- package/dist/4188.js +1 -1
- package/dist/4262.js +2 -0
- package/dist/4332.js +1 -1
- package/dist/4402.js +1 -1
- 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/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/8710.js +2 -0
- 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 +2 -0
- package/dist/9333.js.LICENSE.txt +3 -0
- 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/main.css +3 -2
- package/dist/main.js +1 -1
- package/package.json +11 -6
- package/src/components/Sidebar.tsx +45 -43
- package/src/components/abbr/basic.tsx +13 -13
- package/src/components/accordion/basic.tsx +5 -5
- package/src/components/accordion/headlines.tsx +12 -12
- package/src/components/alert/basic.tsx +6 -6
- package/src/components/alert/html.tsx +3 -3
- package/src/components/breadcrumb/basic.tsx +11 -11
- package/src/components/button/access-key.tsx +5 -5
- package/src/components/button/aria-description.tsx +17 -0
- package/src/components/button/routes.ts +2 -0
- package/src/components/button/width.tsx +1 -1
- package/src/components/button-link/aria-description.tsx +17 -0
- package/src/components/button-link/basic.tsx +7 -7
- package/src/components/button-link/icons.tsx +4 -4
- package/src/components/button-link/image.tsx +2 -2
- package/src/components/button-link/routes.ts +2 -0
- package/src/components/drawer/basic.tsx +2 -2
- package/src/components/handout/basic.tsx +69 -69
- package/src/components/handout/table-data.ts +538 -538
- package/src/components/heading/badged.tsx +6 -6
- package/src/components/input-checkbox/partials/cases.tsx +5 -5
- package/src/components/input-date/partials/cases.tsx +8 -8
- package/src/components/input-date/reset.tsx +21 -0
- package/src/components/input-date/routes.ts +2 -0
- package/src/components/input-email/partials/cases.tsx +1 -1
- package/src/components/input-file/partials/cases.tsx +3 -3
- package/src/components/input-number/partials/cases.tsx +8 -8
- package/src/components/input-password/show-password.tsx +3 -3
- package/src/components/input-radio/partials/cases.tsx +30 -15
- package/src/components/input-range/partials/cases.tsx +3 -3
- package/src/components/input-text/partials/cases.tsx +11 -11
- package/src/components/input-text/routes.ts +2 -0
- package/src/components/input-text/text-formatter.tsx +91 -0
- package/src/components/link/aria-description.tsx +17 -0
- package/src/components/link/basic.tsx +8 -7
- package/src/components/link/icons.tsx +5 -5
- package/src/components/link/image.tsx +2 -2
- package/src/components/link/routes.ts +2 -0
- package/src/components/link-button/aria-description.tsx +17 -0
- package/src/components/link-button/routes.ts +2 -0
- package/src/components/modal/basic.tsx +37 -18
- package/src/components/nav/links.ts +4 -4
- package/src/components/select/partials/cases.tsx +9 -9
- package/src/components/single-select/basic.tsx +23 -0
- package/src/components/single-select/partials/cases.tsx +39 -0
- package/src/components/single-select/partials/variants.tsx +19 -0
- package/src/components/single-select/routes.ts +8 -0
- package/src/components/skip-nav/basic.tsx +4 -4
- package/src/components/split-button/basic.tsx +2 -2
- package/src/components/split-button/routes.ts +2 -0
- package/src/components/split-button/with-context.tsx +37 -0
- package/src/components/table/interactive-child-elements.tsx +105 -0
- package/src/components/table/render-cell.tsx +1 -1
- package/src/components/table/routes.ts +6 -0
- package/src/components/table/stateful-with-selection.tsx +7 -7
- package/src/components/table/stateful-with-single-selection.tsx +84 -0
- package/src/components/table/stateless-with-selection.tsx +9 -6
- package/src/components/table/stateless-with-single-selection.tsx +68 -0
- package/src/components/tabs/basic.tsx +13 -13
- package/src/components/tabs/icons-only.tsx +8 -8
- package/src/scenarios/appointment-form/AppointmentForm.tsx +13 -13
- package/src/scenarios/appointment-form/AvailableAppointmentsForm.tsx +6 -6
- package/src/scenarios/appointment-form/DistrictForm.tsx +8 -8
- package/src/scenarios/appointment-form/PersonalInformationForm.tsx +16 -16
- package/src/scenarios/appointment-form/Summary.tsx +6 -6
- package/src/scenarios/focus-elements.tsx +12 -0
- package/src/scenarios/horizontal-scrollbar-advanced/TableHorizontalScrollbarAdvanced.tsx +80 -0
- package/src/scenarios/horizontal-scrollbar-advanced/databasedata.json +317 -0
- package/src/scenarios/horizontal-scrollbar-advanced/index.ts +1 -0
- package/src/scenarios/horizontal-scrollbar-advanced/layout.css +31 -0
- package/src/scenarios/inputs-get-value.tsx +36 -10
- package/src/scenarios/routes.ts +2 -0
- package/src/scenarios/static-form.tsx +9 -0
- package/src/shares/constants.ts +2 -2
- package/src/shares/routes.ts +2 -0
- package/src/style.scss +19 -1
- package/tsconfig.json +1 -1
- package/dist/4266.js +0 -2
- package/dist/4817.js +0 -2
- /package/dist/{4266.js.LICENSE.txt → 4262.js.LICENSE.txt} +0 -0
- /package/dist/{4817.js.LICENSE.txt → 8710.js.LICENSE.txt} +0 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { FC } from 'react';
|
|
2
|
+
import React, { useEffect, useState, useRef } from 'react';
|
|
3
|
+
import { KolTableStateless } from '@public-ui/react';
|
|
4
|
+
import { SampleDescription } from '../SampleDescription';
|
|
5
|
+
import type { KoliBriTableSelection } from '@public-ui/components';
|
|
6
|
+
|
|
7
|
+
const DATA = [
|
|
8
|
+
{ id: '1001', name: 'Foo Bar', internalIdentifier: `AAA1001` },
|
|
9
|
+
{ id: '1002', name: 'Foo Baz', internalIdentifier: `AAA1002` },
|
|
10
|
+
];
|
|
11
|
+
type Data = (typeof DATA)[0];
|
|
12
|
+
|
|
13
|
+
export const TableStatelessWithSingleSelection: FC = () => {
|
|
14
|
+
const [selectedKeys, setSelectedKeys] = useState(['1002']);
|
|
15
|
+
|
|
16
|
+
const selection: KoliBriTableSelection = {
|
|
17
|
+
label: (row) => `Selection for ${(row as Data).name}`,
|
|
18
|
+
multiple: false,
|
|
19
|
+
selectedKeys,
|
|
20
|
+
keyPropertyName: 'internalIdentifier',
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const kolTableStatelessRef = useRef<HTMLKolTableStatelessElement>(null);
|
|
24
|
+
|
|
25
|
+
const handleSelectionChangeEvent = ({ detail: selection }: { detail: string[] }) => {
|
|
26
|
+
console.log('Selection change via event', selection);
|
|
27
|
+
};
|
|
28
|
+
const handleSelectionChangeCallback = (_event: Event, selection: string[] | string) => {
|
|
29
|
+
console.log('Selection change via callback', selection);
|
|
30
|
+
setSelectedKeys(typeof selection === 'string' ? [selection] : selection);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
// @ts-expect-error https://github.com/Microsoft/TypeScript/issues/28357
|
|
35
|
+
kolTableStatelessRef.current?.addEventListener('kol-selection-change', handleSelectionChangeEvent);
|
|
36
|
+
|
|
37
|
+
return () => {
|
|
38
|
+
// @ts-expect-error https://github.com/Microsoft/TypeScript/issues/28357
|
|
39
|
+
kolTableStatelessRef.current?.removeEventListener('kol-selection-change', handleSelectionChangeEvent);
|
|
40
|
+
};
|
|
41
|
+
}, [kolTableStatelessRef]);
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<>
|
|
45
|
+
<SampleDescription>
|
|
46
|
+
<p>This sample shows KolTableStateless with checkboxes for selection enabled.</p>
|
|
47
|
+
</SampleDescription>
|
|
48
|
+
|
|
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' },
|
|
56
|
+
],
|
|
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
|
+
);
|
|
68
|
+
};
|
|
@@ -7,25 +7,25 @@ import { SampleDescription } from '../SampleDescription';
|
|
|
7
7
|
const tabs = [
|
|
8
8
|
{
|
|
9
9
|
_icons: 'codicon codicon-pie-chart',
|
|
10
|
-
_label: '
|
|
10
|
+
_label: 'First tab',
|
|
11
11
|
_on: {
|
|
12
12
|
onSelect: (event: Event) => {
|
|
13
|
-
console.log('
|
|
13
|
+
console.log('First tab selected', event);
|
|
14
14
|
},
|
|
15
15
|
},
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
18
|
_icons: 'codicon codicon-calendar',
|
|
19
|
-
_label: '
|
|
19
|
+
_label: 'Second Tab',
|
|
20
20
|
},
|
|
21
21
|
{
|
|
22
22
|
_disabled: true,
|
|
23
23
|
_icons: 'codicon codicon-briefcase',
|
|
24
|
-
_label: '
|
|
24
|
+
_label: 'Disabled Tab',
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
27
|
_icons: 'codicon codicon-telescope',
|
|
28
|
-
_label: '
|
|
28
|
+
_label: 'Last tab',
|
|
29
29
|
},
|
|
30
30
|
];
|
|
31
31
|
|
|
@@ -41,17 +41,17 @@ export const TabsBasic: FC = () => (
|
|
|
41
41
|
</SampleDescription>
|
|
42
42
|
|
|
43
43
|
<KolTabs _tabs={tabsWithoutIcons} _label="Regular tabs">
|
|
44
|
-
<div slot="tab-0">
|
|
45
|
-
<div slot="tab-1">
|
|
46
|
-
<div slot="tab-2">
|
|
47
|
-
<div slot="tab-3">
|
|
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
48
|
</KolTabs>
|
|
49
49
|
|
|
50
50
|
<KolTabs _tabs={tabs} className="mt-4" _label="Tabs with icons">
|
|
51
|
-
<div slot="tab-0">
|
|
52
|
-
<div slot="tab-1">
|
|
53
|
-
<div slot="tab-2">
|
|
54
|
-
<div slot="tab-3">
|
|
51
|
+
<div slot="tab-0">Contents of Tab 1</div>
|
|
52
|
+
<div slot="tab-1">Contents of Tab 2</div>
|
|
53
|
+
<div slot="tab-2">Contents of Tab 3</div>
|
|
54
|
+
<div slot="tab-3">Contents of Tab 4</div>
|
|
55
55
|
</KolTabs>
|
|
56
56
|
</>
|
|
57
57
|
);
|
|
@@ -7,23 +7,23 @@ import { SampleDescription } from '../SampleDescription';
|
|
|
7
7
|
const tabs = [
|
|
8
8
|
{
|
|
9
9
|
_icons: 'codicon codicon-pie-chart',
|
|
10
|
-
_label: '
|
|
10
|
+
_label: 'First Tab',
|
|
11
11
|
_hideLabel: true,
|
|
12
12
|
},
|
|
13
13
|
{
|
|
14
14
|
_icons: 'codicon codicon-calendar',
|
|
15
|
-
_label: '
|
|
15
|
+
_label: 'Second Tab',
|
|
16
16
|
_hideLabel: true,
|
|
17
17
|
},
|
|
18
18
|
{
|
|
19
19
|
_disabled: true,
|
|
20
20
|
_icons: 'codicon codicon-briefcase',
|
|
21
|
-
_label: '
|
|
21
|
+
_label: 'Disabled Tab',
|
|
22
22
|
_hideLabel: true,
|
|
23
23
|
},
|
|
24
24
|
{
|
|
25
25
|
_icons: 'codicon codicon-telescope',
|
|
26
|
-
_label: '
|
|
26
|
+
_label: 'Last Tab',
|
|
27
27
|
_hideLabel: true,
|
|
28
28
|
},
|
|
29
29
|
];
|
|
@@ -34,10 +34,10 @@ export const TabsIconsOnly: FC = () => (
|
|
|
34
34
|
</SampleDescription>
|
|
35
35
|
|
|
36
36
|
<KolTabs _label="Tabs with icons" _tabs={tabs}>
|
|
37
|
-
<div slot="tab-0">
|
|
38
|
-
<div slot="tab-1">
|
|
39
|
-
<div slot="tab-2">
|
|
40
|
-
<div slot="tab-3">
|
|
37
|
+
<div slot="tab-0">Contents of Tab 1</div>
|
|
38
|
+
<div slot="tab-1">Contents of Tab 2</div>
|
|
39
|
+
<div slot="tab-2">Contents of Tab 3</div>
|
|
40
|
+
<div slot="tab-3">Contents of Tab 4</div>
|
|
41
41
|
</KolTabs>
|
|
42
42
|
</>
|
|
43
43
|
);
|
|
@@ -46,22 +46,22 @@ const initialValues: FormValues = {
|
|
|
46
46
|
};
|
|
47
47
|
|
|
48
48
|
const districtSchema = {
|
|
49
|
-
district: Yup.string().required('
|
|
49
|
+
district: Yup.string().required('Please select district.'),
|
|
50
50
|
};
|
|
51
51
|
const personalInformationSchema = {
|
|
52
|
-
salutation: Yup.string().required('
|
|
53
|
-
name: Yup.string().required('
|
|
52
|
+
salutation: Yup.string().required('Please select salutation.'),
|
|
53
|
+
name: Yup.string().required('Please enter your first and last name.'),
|
|
54
54
|
company: Yup.string().when('salutation', {
|
|
55
|
-
is: (salutation: string) => salutation === '
|
|
56
|
-
then: (schema) => schema.required('
|
|
55
|
+
is: (salutation: string) => salutation === 'Company',
|
|
56
|
+
then: (schema) => schema.required('Please specify company.'),
|
|
57
57
|
}),
|
|
58
|
-
email: Yup.string().required('
|
|
58
|
+
email: Yup.string().required('Please enter your e-mail address.'),
|
|
59
59
|
};
|
|
60
60
|
const availableAppointmentsSchema = {
|
|
61
|
-
date: Yup.string().required('
|
|
61
|
+
date: Yup.string().required('Please enter date.'),
|
|
62
62
|
time: Yup.string().when('date', {
|
|
63
63
|
is: (date: string) => Boolean(date), // only validate time when date is already set
|
|
64
|
-
then: (schema) => schema.test('checkTimeAvailability', '
|
|
64
|
+
then: (schema) => schema.test('checkTimeAvailability', 'Date unfortunately no longer available.', checkAppointmentAvailability),
|
|
65
65
|
}),
|
|
66
66
|
};
|
|
67
67
|
|
|
@@ -103,22 +103,22 @@ export function AppointmentForm() {
|
|
|
103
103
|
<KolTabs
|
|
104
104
|
_tabs={[
|
|
105
105
|
{
|
|
106
|
-
_label: '1.
|
|
106
|
+
_label: '1. Choose registration office',
|
|
107
107
|
},
|
|
108
108
|
{
|
|
109
|
-
_label: '2.
|
|
109
|
+
_label: '2. Available dates',
|
|
110
110
|
_disabled: activeFormSection < FormSection.AVAILABLE_APPOINTMENTS,
|
|
111
111
|
},
|
|
112
112
|
{
|
|
113
|
-
_label: '3.
|
|
113
|
+
_label: '3. Personal data',
|
|
114
114
|
_disabled: activeFormSection < FormSection.PERSONAL_INFORMATION,
|
|
115
115
|
},
|
|
116
116
|
{
|
|
117
|
-
_label: '
|
|
117
|
+
_label: 'Summary',
|
|
118
118
|
_disabled: activeFormSection < FormSection.SUMMARY,
|
|
119
119
|
},
|
|
120
120
|
]}
|
|
121
|
-
_label="
|
|
121
|
+
_label="Form navigation"
|
|
122
122
|
_selected={selectedTab}
|
|
123
123
|
_on={{
|
|
124
124
|
onSelect: (_event, selectedTab) => {
|
|
@@ -66,7 +66,7 @@ export function AvailableAppointmentsForm() {
|
|
|
66
66
|
);
|
|
67
67
|
return (
|
|
68
68
|
<div className="p-2">
|
|
69
|
-
<KolHeading _level={2} _label="
|
|
69
|
+
<KolHeading _level={2} _label="Select an appointment"></KolHeading>
|
|
70
70
|
<KolForm
|
|
71
71
|
ref={formikRef}
|
|
72
72
|
_errorList={sectionSubmitted ? errorList : []}
|
|
@@ -81,7 +81,7 @@ export function AvailableAppointmentsForm() {
|
|
|
81
81
|
{renderField('date', (field) => (
|
|
82
82
|
<KolInputDate
|
|
83
83
|
id="field-date"
|
|
84
|
-
_label="
|
|
84
|
+
_label="Date"
|
|
85
85
|
_value={field.value}
|
|
86
86
|
_msg={{
|
|
87
87
|
_type: 'error',
|
|
@@ -100,7 +100,7 @@ export function AvailableAppointmentsForm() {
|
|
|
100
100
|
{renderField('time', (field) => (
|
|
101
101
|
<KolInputRadio
|
|
102
102
|
id="field-time"
|
|
103
|
-
_label="
|
|
103
|
+
_label="Time"
|
|
104
104
|
_orientation="horizontal"
|
|
105
105
|
_options={availableTimes}
|
|
106
106
|
_value={field.value}
|
|
@@ -114,17 +114,17 @@ export function AvailableAppointmentsForm() {
|
|
|
114
114
|
/>
|
|
115
115
|
))}
|
|
116
116
|
<p>
|
|
117
|
-
<em>
|
|
117
|
+
<em>For test purposes, only the dates for every half hour are available.</em>
|
|
118
118
|
</p>
|
|
119
119
|
</>
|
|
120
120
|
) : (
|
|
121
|
-
<KolSpin _show className="block" aria-label="
|
|
121
|
+
<KolSpin _show className="block" aria-label="Dates are loaded." _variant="cycle" />
|
|
122
122
|
)}
|
|
123
123
|
</div>
|
|
124
124
|
)}
|
|
125
125
|
|
|
126
126
|
<KolButton _label="Weiter" _type="submit" className="mt-2" />
|
|
127
|
-
{form.values.date && form.isValidating ? <KolSpin _show aria-label="
|
|
127
|
+
{form.values.date && form.isValidating ? <KolSpin _show aria-label="Date being checked." /> : ''}
|
|
128
128
|
</KolForm>
|
|
129
129
|
</div>
|
|
130
130
|
);
|
|
@@ -21,12 +21,12 @@ const LOCATION_OPTIONS = [
|
|
|
21
21
|
label: 'Dorstfeld',
|
|
22
22
|
},
|
|
23
23
|
{
|
|
24
|
-
value: '
|
|
25
|
-
label: '
|
|
24
|
+
value: 'Downtown East',
|
|
25
|
+
label: 'downtown East',
|
|
26
26
|
},
|
|
27
27
|
{
|
|
28
|
-
value: '
|
|
29
|
-
label: '
|
|
28
|
+
value: 'Downtown West',
|
|
29
|
+
label: 'downtown West',
|
|
30
30
|
},
|
|
31
31
|
];
|
|
32
32
|
|
|
@@ -37,7 +37,7 @@ export function DistrictForm() {
|
|
|
37
37
|
const formikRef = useRef<HTMLKolFormElement>(null);
|
|
38
38
|
return (
|
|
39
39
|
<div className="p-2">
|
|
40
|
-
<KolHeading _level={2} _label="
|
|
40
|
+
<KolHeading _level={2} _label="Select a district"></KolHeading>
|
|
41
41
|
<KolForm
|
|
42
42
|
ref={formikRef}
|
|
43
43
|
_errorList={sectionSubmitted ? errorList : []}
|
|
@@ -60,8 +60,8 @@ export function DistrictForm() {
|
|
|
60
60
|
{({ field }: FieldProps<FormValues['district']>) => (
|
|
61
61
|
<KolSelect
|
|
62
62
|
id="field-district"
|
|
63
|
-
_label="
|
|
64
|
-
_options={[{ label: '
|
|
63
|
+
_label="District"
|
|
64
|
+
_options={[{ label: 'Please select…', value: '' }, ...LOCATION_OPTIONS]}
|
|
65
65
|
_value={[field.value]}
|
|
66
66
|
_msg={{
|
|
67
67
|
_type: 'error',
|
|
@@ -86,7 +86,7 @@ export function DistrictForm() {
|
|
|
86
86
|
)}
|
|
87
87
|
</Field>
|
|
88
88
|
|
|
89
|
-
<KolButton _label="
|
|
89
|
+
<KolButton _label="Next" _type="submit" className="mt-2" />
|
|
90
90
|
</KolForm>
|
|
91
91
|
</div>
|
|
92
92
|
);
|
|
@@ -9,20 +9,20 @@ import { createErrorList, focusErrorList } from './formUtils';
|
|
|
9
9
|
|
|
10
10
|
const SALUTATION_OPTIONS = [
|
|
11
11
|
{
|
|
12
|
-
value: '
|
|
13
|
-
label: '
|
|
12
|
+
value: 'Company',
|
|
13
|
+
label: 'Company',
|
|
14
14
|
},
|
|
15
15
|
{
|
|
16
|
-
value: '
|
|
17
|
-
label: '
|
|
16
|
+
value: 'Mrs.',
|
|
17
|
+
label: 'Mrs.',
|
|
18
18
|
},
|
|
19
19
|
{
|
|
20
|
-
value: '
|
|
21
|
-
label: '
|
|
20
|
+
value: 'Mr.',
|
|
21
|
+
label: 'Mr.',
|
|
22
22
|
},
|
|
23
23
|
{
|
|
24
|
-
value: '
|
|
25
|
-
label: '
|
|
24
|
+
value: 'Hello',
|
|
25
|
+
label: 'Hello',
|
|
26
26
|
},
|
|
27
27
|
];
|
|
28
28
|
|
|
@@ -37,7 +37,7 @@ export function PersonalInformationForm() {
|
|
|
37
37
|
}, [sectionSubmitted]);
|
|
38
38
|
return (
|
|
39
39
|
<div className="p-2">
|
|
40
|
-
<KolHeading _level={2} _label="
|
|
40
|
+
<KolHeading _level={2} _label="Enter your contact details"></KolHeading>
|
|
41
41
|
<KolForm
|
|
42
42
|
ref={formikRef}
|
|
43
43
|
_errorList={sectionSubmitted ? errorList : []}
|
|
@@ -56,14 +56,14 @@ export function PersonalInformationForm() {
|
|
|
56
56
|
void form.setFieldTouched('salutation', true);
|
|
57
57
|
}}
|
|
58
58
|
id="field-salutation"
|
|
59
|
-
_label="
|
|
59
|
+
_label="Salutation"
|
|
60
60
|
_value={[field.value]}
|
|
61
61
|
_msg={{
|
|
62
62
|
_type: 'error',
|
|
63
63
|
_description: form.errors.salutation || '',
|
|
64
64
|
}}
|
|
65
65
|
_touched={form.touched.salutation}
|
|
66
|
-
_options={[{ label: '
|
|
66
|
+
_options={[{ label: 'Please select…', value: '' }, ...SALUTATION_OPTIONS]}
|
|
67
67
|
_required
|
|
68
68
|
_on={{
|
|
69
69
|
onChange: (event, values: unknown) => {
|
|
@@ -77,7 +77,7 @@ export function PersonalInformationForm() {
|
|
|
77
77
|
)}
|
|
78
78
|
</Field>
|
|
79
79
|
|
|
80
|
-
{form.values.salutation === '
|
|
80
|
+
{form.values.salutation === 'Company' && (
|
|
81
81
|
<Field name="company">
|
|
82
82
|
{({ field }: FieldProps<FormValues['company']>) => (
|
|
83
83
|
<div className="block mt-2">
|
|
@@ -86,7 +86,7 @@ export function PersonalInformationForm() {
|
|
|
86
86
|
void form.setFieldTouched('company', true);
|
|
87
87
|
}}
|
|
88
88
|
id="field-company"
|
|
89
|
-
_label="
|
|
89
|
+
_label="Company"
|
|
90
90
|
_value={field.value}
|
|
91
91
|
_msg={{
|
|
92
92
|
_type: 'error',
|
|
@@ -115,7 +115,7 @@ export function PersonalInformationForm() {
|
|
|
115
115
|
void form.setFieldTouched('name', true);
|
|
116
116
|
}}
|
|
117
117
|
id="field-name"
|
|
118
|
-
_label="
|
|
118
|
+
_label="First name and surname"
|
|
119
119
|
_value={field.value}
|
|
120
120
|
_msg={{
|
|
121
121
|
_type: 'error',
|
|
@@ -166,7 +166,7 @@ export function PersonalInformationForm() {
|
|
|
166
166
|
<KolInputText
|
|
167
167
|
id="field-phone"
|
|
168
168
|
_type="tel"
|
|
169
|
-
_label="
|
|
169
|
+
_label="Telephone number"
|
|
170
170
|
_value={field.value}
|
|
171
171
|
_msg={{
|
|
172
172
|
_type: 'error',
|
|
@@ -186,7 +186,7 @@ export function PersonalInformationForm() {
|
|
|
186
186
|
)}
|
|
187
187
|
</Field>
|
|
188
188
|
|
|
189
|
-
<KolButton _label="
|
|
189
|
+
<KolButton _label="Next" _type="submit" className="mt-2" />
|
|
190
190
|
</KolForm>
|
|
191
191
|
</div>
|
|
192
192
|
);
|
|
@@ -16,23 +16,23 @@ export function Summary() {
|
|
|
16
16
|
<KolHeading _level={2} _label="Zusammenfassung"></KolHeading>
|
|
17
17
|
|
|
18
18
|
<dl>
|
|
19
|
-
<dt>
|
|
19
|
+
<dt>District</dt>
|
|
20
20
|
<dd>
|
|
21
21
|
<ValueWithFallback value={values.district} />
|
|
22
22
|
</dd>
|
|
23
|
-
<dt>
|
|
23
|
+
<dt>Appointment</dt>
|
|
24
24
|
<dd>{values.date && values.time ? `${values.date} ${values.time} Uhr` : <ValueFallback />}</dd>
|
|
25
25
|
|
|
26
|
-
{values.salutation === '
|
|
26
|
+
{values.salutation === 'Company' ? (
|
|
27
27
|
<>
|
|
28
|
-
<dt>
|
|
28
|
+
<dt>Company</dt>
|
|
29
29
|
<dd>
|
|
30
30
|
<ValueWithFallback value={values.company} />
|
|
31
31
|
</dd>
|
|
32
32
|
</>
|
|
33
33
|
) : (
|
|
34
34
|
<>
|
|
35
|
-
<dt>
|
|
35
|
+
<dt>Salutation</dt>
|
|
36
36
|
<dd>
|
|
37
37
|
<ValueWithFallback value={values.salutation} />
|
|
38
38
|
</dd>
|
|
@@ -47,7 +47,7 @@ export function Summary() {
|
|
|
47
47
|
<dd>
|
|
48
48
|
<ValueWithFallback value={values.email} />
|
|
49
49
|
</dd>
|
|
50
|
-
<dt>
|
|
50
|
+
<dt>Phone number</dt>
|
|
51
51
|
<dd>
|
|
52
52
|
<ValueWithFallback value={values.phone} />
|
|
53
53
|
</dd>
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
KolLink,
|
|
19
19
|
KolLinkButton,
|
|
20
20
|
KolSelect,
|
|
21
|
+
KolSingleSelect,
|
|
21
22
|
KolTextarea,
|
|
22
23
|
} from '@public-ui/react';
|
|
23
24
|
import type { FC, ForwardRefRenderFunction } from 'react';
|
|
@@ -75,6 +76,17 @@ const getFocusElements = () => {
|
|
|
75
76
|
ref={ref}
|
|
76
77
|
/>
|
|
77
78
|
));
|
|
79
|
+
focusElements.set('singleSelect', (_, ref) => (
|
|
80
|
+
<KolSingleSelect
|
|
81
|
+
_name="singleSelect"
|
|
82
|
+
_label="Single Select"
|
|
83
|
+
_options={[
|
|
84
|
+
{ label: 'Option A', value: 'A' },
|
|
85
|
+
{ label: 'Option B', value: 'B' },
|
|
86
|
+
]}
|
|
87
|
+
ref={ref}
|
|
88
|
+
/>
|
|
89
|
+
));
|
|
78
90
|
focusElements.set('textarea', (_, ref) => <KolTextarea _name="textarea" _label="Textarea" _rows={5} ref={ref} />);
|
|
79
91
|
focusElements.set('accordion', (_, ref) => <KolAccordion _label="Accordion here" ref={ref} />);
|
|
80
92
|
focusElements.set('button', (_, ref) => <KolButton _label="Button here" ref={ref}></KolButton>);
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { KolTable, KolTabs, KolNav } from '@public-ui/react';
|
|
3
|
+
import type { KoliBriTableHeaders, TabButtonProps } from '@public-ui/components';
|
|
4
|
+
import { SampleDescription } from '../../components/SampleDescription';
|
|
5
|
+
import { LINKS } from '../../components/nav/links';
|
|
6
|
+
import DATA from './databasedata.json';
|
|
7
|
+
|
|
8
|
+
import './layout.css';
|
|
9
|
+
|
|
10
|
+
const TABS: TabButtonProps[] = [
|
|
11
|
+
{
|
|
12
|
+
_icons: 'codicon codicon-pie-chart',
|
|
13
|
+
_label: 'Erster Tab',
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
_icons: 'codicon codicon-calendar',
|
|
17
|
+
_label: 'Zweiter Tab',
|
|
18
|
+
_disabled: true,
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
_icons: 'codicon codicon-briefcase',
|
|
22
|
+
_label: 'Deaktivierter Tab',
|
|
23
|
+
_disabled: true,
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
_icons: 'codicon codicon-telescope',
|
|
27
|
+
_label: 'Letzter Tab',
|
|
28
|
+
_disabled: true,
|
|
29
|
+
},
|
|
30
|
+
];
|
|
31
|
+
|
|
32
|
+
const HEADERS: KoliBriTableHeaders = {
|
|
33
|
+
horizontal: [
|
|
34
|
+
[
|
|
35
|
+
{ key: 'name', label: 'Name', textAlign: 'left', width: '400px' },
|
|
36
|
+
{ key: 'species', label: 'Species', textAlign: 'left', width: '400px' },
|
|
37
|
+
{ key: 'habitat', label: 'Habitat', textAlign: 'left', width: '400px' },
|
|
38
|
+
{ key: 'diet', label: 'Diet', textAlign: 'left', width: '400px' },
|
|
39
|
+
{ key: 'lifespan', label: 'lifespan', textAlign: 'right', width: '400px' },
|
|
40
|
+
],
|
|
41
|
+
],
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
function TableHorizontalScrollbarAdvanced() {
|
|
45
|
+
const [tableWith] = React.useState(() => {
|
|
46
|
+
const columnDefinitions = HEADERS.horizontal![0];
|
|
47
|
+
let width = 0;
|
|
48
|
+
|
|
49
|
+
for (const def of columnDefinitions as { width: string }[]) {
|
|
50
|
+
width += Number(def.width?.replace('px', '') || 0);
|
|
51
|
+
}
|
|
52
|
+
return `${width}px`;
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<>
|
|
57
|
+
<SampleDescription></SampleDescription>
|
|
58
|
+
<div className="mainlayout">
|
|
59
|
+
<aside className="nav-area">
|
|
60
|
+
<KolNav _label="Main navigation" _links={LINKS} _hasCompactButton _hasIconsWhenExpanded />
|
|
61
|
+
</aside>
|
|
62
|
+
<div className="content">
|
|
63
|
+
<KolTabs _tabs={TABS} _label="Demo Tabs"></KolTabs>
|
|
64
|
+
<div style={{ overflow: 'hidden' }}>
|
|
65
|
+
<KolTable
|
|
66
|
+
_label="Table for demonstration purposes with horizontal scrollbar"
|
|
67
|
+
_minWidth={tableWith}
|
|
68
|
+
_headers={HEADERS}
|
|
69
|
+
_data={DATA}
|
|
70
|
+
_pagination={{ _page: 1 }}
|
|
71
|
+
className="block"
|
|
72
|
+
/>
|
|
73
|
+
</div>
|
|
74
|
+
</div>
|
|
75
|
+
</div>
|
|
76
|
+
</>
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export default TableHorizontalScrollbarAdvanced;
|