@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
|
@@ -16,32 +16,32 @@ export const HeadingBadged: FC = () => (
|
|
|
16
16
|
<div className="grid gap-4">
|
|
17
17
|
<KolHeading _label="" _level={1}>
|
|
18
18
|
<span slot="expert">
|
|
19
|
-
|
|
19
|
+
A heading with a <KolBadge _label="Label"></KolBadge>
|
|
20
20
|
</span>
|
|
21
21
|
</KolHeading>
|
|
22
22
|
<KolHeading _label="" _level={2}>
|
|
23
23
|
<span slot="expert">
|
|
24
|
-
|
|
24
|
+
A heading with a <KolBadge _color="#86ffc6" _label="Label"></KolBadge>
|
|
25
25
|
</span>
|
|
26
26
|
</KolHeading>
|
|
27
27
|
<KolHeading _label="" _level={3}>
|
|
28
28
|
<span slot="expert">
|
|
29
|
-
|
|
29
|
+
A heading with a <KolBadge _color="#06539e" _label="Label"></KolBadge>
|
|
30
30
|
</span>
|
|
31
31
|
</KolHeading>
|
|
32
32
|
<KolHeading _label="" _level={4}>
|
|
33
33
|
<span slot="expert">
|
|
34
|
-
|
|
34
|
+
A heading with a <KolBadge _color="#ae0000" _label="Label"></KolBadge>
|
|
35
35
|
</span>
|
|
36
36
|
</KolHeading>
|
|
37
37
|
<KolHeading _label="" _level={5}>
|
|
38
38
|
<span slot="expert">
|
|
39
|
-
|
|
39
|
+
A heading with a <KolBadge _color="#8b008b" _label="Label"></KolBadge>
|
|
40
40
|
</span>
|
|
41
41
|
</KolHeading>
|
|
42
42
|
<KolHeading _label="" _level={6}>
|
|
43
43
|
<span slot="expert">
|
|
44
|
-
|
|
44
|
+
A heading with a <KolBadge _color="#ffc0cb" _label="Label"></KolBadge>
|
|
45
45
|
</span>
|
|
46
46
|
</KolHeading>
|
|
47
47
|
</div>
|
|
@@ -8,20 +8,20 @@ import type { Components } from '@public-ui/components';
|
|
|
8
8
|
export const InputCheckboxCases = forwardRef<HTMLKolInputCheckboxElement, Components.KolInputCheckbox>(function InputCheckboxCases(props, ref) {
|
|
9
9
|
return (
|
|
10
10
|
<div className="grid gap-4">
|
|
11
|
-
<KolInputCheckbox {...props} _label="
|
|
12
|
-
<KolInputCheckbox {...props} _label="
|
|
13
|
-
<KolInputCheckbox {...props} ref={ref} _accessKey="A" _checked _label="
|
|
11
|
+
<KolInputCheckbox {...props} _label="Not selected" _value={false} _required />
|
|
12
|
+
<KolInputCheckbox {...props} _label="Indeterminate" _value={null} _indeterminate />
|
|
13
|
+
<KolInputCheckbox {...props} ref={ref} _accessKey="A" _checked _label="Selected" _tooltipAlign="right" _value={true} />
|
|
14
14
|
<KolInputCheckbox
|
|
15
15
|
{...props}
|
|
16
16
|
_checked
|
|
17
17
|
_icons={{ unchecked: 'codicon codicon-close' }}
|
|
18
|
-
_label={'
|
|
18
|
+
_label={'With a very long label and upheavals '.repeat(5)}
|
|
19
19
|
_value={true}
|
|
20
20
|
/>
|
|
21
21
|
<KolInputCheckbox {...props} _disabled _label="Disabled" _value={true} _hint="Hint text" />
|
|
22
22
|
<KolInputCheckbox {...props} _checked _disabled _label="Checked and disabled" />
|
|
23
23
|
<KolInputCheckbox {...props} _indeterminate _disabled _label="Indeterminate and disabled" />
|
|
24
|
-
<KolInputCheckbox {...props} _msg={{ _type: 'error', _description: ERROR_MSG }} _label="
|
|
24
|
+
<KolInputCheckbox {...props} _msg={{ _type: 'error', _description: ERROR_MSG }} _label="With error" _touched _value={true} _hint="Hint text" />
|
|
25
25
|
</div>
|
|
26
26
|
);
|
|
27
27
|
});
|
|
@@ -8,23 +8,23 @@ import type { Components } from '@public-ui/components';
|
|
|
8
8
|
export const InputDateCases = forwardRef<HTMLKolInputDateElement, Components.KolInputDate>(function InputDateCases(props, ref) {
|
|
9
9
|
return (
|
|
10
10
|
<div className="grid gap-4">
|
|
11
|
-
<KolInputDate {...props} _type="date" _label="
|
|
11
|
+
<KolInputDate {...props} _type="date" _label="Date input" _required />
|
|
12
12
|
<KolInputDate {...props} _type="datetime-local" _label="Local-Datetime (Standard)" _required />
|
|
13
13
|
<KolInputDate
|
|
14
14
|
{...props}
|
|
15
15
|
_step={1}
|
|
16
16
|
_type="datetime-local"
|
|
17
17
|
_msg={{ _type: 'error', _description: ERROR_MSG }}
|
|
18
|
-
_label="Local
|
|
18
|
+
_label="Local datetime (with seconds)"
|
|
19
19
|
_required
|
|
20
20
|
_touched
|
|
21
21
|
/>
|
|
22
|
-
<KolInputDate {...props} _type="month" _label="
|
|
23
|
-
<KolInputDate {...props} ref={ref} _accessKey="W" _type="week" _label="
|
|
24
|
-
<KolInputDate {...props} _type="time" _label="
|
|
25
|
-
<KolInputDate {...props} _step={1} _type="time" _label="
|
|
26
|
-
<KolInputDate {...props} _readOnly _label="
|
|
27
|
-
<KolInputDate {...props} _disabled _label="
|
|
22
|
+
<KolInputDate {...props} _type="month" _label="Month" _required />
|
|
23
|
+
<KolInputDate {...props} ref={ref} _accessKey="W" _type="week" _label="Week" _required />
|
|
24
|
+
<KolInputDate {...props} _type="time" _label="Time (standard)" _required />
|
|
25
|
+
<KolInputDate {...props} _step={1} _type="time" _label="Time (with seconds)" _required />
|
|
26
|
+
<KolInputDate {...props} _readOnly _label="Date input (read-only)" _required />
|
|
27
|
+
<KolInputDate {...props} _disabled _label="Date input (Disabled)" _required />
|
|
28
28
|
</div>
|
|
29
29
|
);
|
|
30
30
|
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React, { useRef } from 'react';
|
|
2
|
+
import { KolButton, KolInputDate } from '@public-ui/react';
|
|
3
|
+
import { SampleDescription } from '../SampleDescription';
|
|
4
|
+
|
|
5
|
+
export const InputDateReset = () => {
|
|
6
|
+
const dateRef = useRef<HTMLKolInputDateElement>(null);
|
|
7
|
+
|
|
8
|
+
return (
|
|
9
|
+
<>
|
|
10
|
+
<SampleDescription>
|
|
11
|
+
<p>
|
|
12
|
+
This sample demonstrates the KolInputDate <code>reset</code>-Method, which can be used to clear the field, even when it holds incomplete or invalid
|
|
13
|
+
values.
|
|
14
|
+
</p>
|
|
15
|
+
</SampleDescription>
|
|
16
|
+
|
|
17
|
+
<KolInputDate ref={dateRef} _label="Resettable Input Date" _value="2024-02-10" />
|
|
18
|
+
<KolButton className="mt" _label={'Reset'} _on={{ onClick: () => dateRef.current?.reset() }} />
|
|
19
|
+
</>
|
|
20
|
+
);
|
|
21
|
+
};
|
|
@@ -15,7 +15,7 @@ export const InputEmailCases = forwardRef<HTMLKolInputEmailElement, Components.K
|
|
|
15
15
|
_accessKey="M"
|
|
16
16
|
_placeholder="elke@mustermann.de"
|
|
17
17
|
_suggestions="['test1@mail.de', 'test2@mail.de', 'test3@mail.de']"
|
|
18
|
-
_label="E-Mail (
|
|
18
|
+
_label="E-Mail (list)"
|
|
19
19
|
_msg={{ _type: 'error', _description: ERROR_MSG }}
|
|
20
20
|
_touched
|
|
21
21
|
_icons={{
|
|
@@ -12,7 +12,7 @@ export const InputFileCases = forwardRef<HTMLKolInputFileElement, Components.Kol
|
|
|
12
12
|
{...props}
|
|
13
13
|
_required
|
|
14
14
|
_msg={{ _type: 'error', _description: ERROR_MSG }}
|
|
15
|
-
_label="
|
|
15
|
+
_label="Upload file"
|
|
16
16
|
_icons={{
|
|
17
17
|
left: {
|
|
18
18
|
icon: 'codicon codicon-save',
|
|
@@ -20,8 +20,8 @@ export const InputFileCases = forwardRef<HTMLKolInputFileElement, Components.Kol
|
|
|
20
20
|
}}
|
|
21
21
|
_touched
|
|
22
22
|
/>
|
|
23
|
-
<KolInputFile {...props} ref={ref} _accessKey="h" _multiple _msg={{ _type: 'error', _description: ERROR_MSG }} _label="
|
|
24
|
-
<KolInputFile {...props} _disabled _label="
|
|
23
|
+
<KolInputFile {...props} ref={ref} _accessKey="h" _multiple _msg={{ _type: 'error', _description: ERROR_MSG }} _label="Upload file (Multiple)" />
|
|
24
|
+
<KolInputFile {...props} _disabled _label="Upload file (Disabled)" />
|
|
25
25
|
</div>
|
|
26
26
|
);
|
|
27
27
|
});
|
|
@@ -14,7 +14,7 @@ export const InputNumberCases = forwardRef<HTMLKolInputNumberElement, Components
|
|
|
14
14
|
_msg={{ _type: 'error', _description: ERROR_MSG }}
|
|
15
15
|
_touched
|
|
16
16
|
_placeholder="Mit Icons"
|
|
17
|
-
_label="
|
|
17
|
+
_label="Number input"
|
|
18
18
|
_icons={{
|
|
19
19
|
left: {
|
|
20
20
|
icon: 'codicon codicon-arrow-left',
|
|
@@ -24,13 +24,13 @@ export const InputNumberCases = forwardRef<HTMLKolInputNumberElement, Components
|
|
|
24
24
|
},
|
|
25
25
|
}}
|
|
26
26
|
/>
|
|
27
|
-
<KolInputNumber {...props} _required _msg={{ _type: 'error', _description: ERROR_MSG }} _touched _value={123} _label="
|
|
28
|
-
<KolInputNumber {...props} _required _msg={{ _type: 'warning', _description: ERROR_MSG }} _touched _value={123} _label="
|
|
29
|
-
<KolInputNumber {...props} _required _msg={{ _type: 'info', _description: ERROR_MSG }} _touched _value={123} _label="
|
|
30
|
-
<KolInputNumber {...props} _required _msg={{ _type: 'success', _description: ERROR_MSG }} _touched _value={123} _label="
|
|
31
|
-
<KolInputNumber {...props} ref={ref} _accessKey="Z" _max={10} _min={-10} _step={2} _label="
|
|
32
|
-
<KolInputNumber {...props} _readOnly _label="
|
|
33
|
-
<KolInputNumber {...props} _disabled _label="
|
|
27
|
+
<KolInputNumber {...props} _required _msg={{ _type: 'error', _description: ERROR_MSG }} _touched _value={123} _label="Number input" />
|
|
28
|
+
<KolInputNumber {...props} _required _msg={{ _type: 'warning', _description: ERROR_MSG }} _touched _value={123} _label="Number input" />
|
|
29
|
+
<KolInputNumber {...props} _required _msg={{ _type: 'info', _description: ERROR_MSG }} _touched _value={123} _label="Number input" />
|
|
30
|
+
<KolInputNumber {...props} _required _msg={{ _type: 'success', _description: ERROR_MSG }} _touched _value={123} _label="Number input" />
|
|
31
|
+
<KolInputNumber {...props} ref={ref} _accessKey="Z" _max={10} _min={-10} _step={2} _label="Number input (-10 to 10 in steps of 2)" />
|
|
32
|
+
<KolInputNumber {...props} _readOnly _label="Number input (Readonly)" />
|
|
33
|
+
<KolInputNumber {...props} _disabled _label="Number input (Disabled)" />
|
|
34
34
|
</div>
|
|
35
35
|
);
|
|
36
36
|
});
|
|
@@ -17,10 +17,10 @@ export const InputPasswordShowPassword: FC = () => {
|
|
|
17
17
|
</SampleDescription>
|
|
18
18
|
|
|
19
19
|
<KolForm>
|
|
20
|
-
<KolInputPassword _placeholder="
|
|
20
|
+
<KolInputPassword _placeholder="With 'Show password' button" _label="Password" ref={passwordRef} className="block" _variant="visibility-toggle" />
|
|
21
21
|
<KolInputPassword
|
|
22
|
-
_placeholder="
|
|
23
|
-
_label="
|
|
22
|
+
_placeholder="With 'Show password' button and disabled"
|
|
23
|
+
_label="Password"
|
|
24
24
|
ref={passwordRef}
|
|
25
25
|
className="block"
|
|
26
26
|
_disabled
|
|
@@ -2,7 +2,7 @@ import React, { forwardRef } from 'react';
|
|
|
2
2
|
|
|
3
3
|
import { KolInputRadio } from '@public-ui/react';
|
|
4
4
|
|
|
5
|
-
import { ERROR_MSG } from '../../../shares/constants';
|
|
5
|
+
import { ERROR_MSG, HINT_MSG } from '../../../shares/constants';
|
|
6
6
|
|
|
7
7
|
import type { Components } from '@public-ui/components';
|
|
8
8
|
export const InputRadioCases = forwardRef<HTMLKolInputRadioElement, Components.KolInputRadio>(function InputRadioCases(props, ref) {
|
|
@@ -10,17 +10,17 @@ export const InputRadioCases = forwardRef<HTMLKolInputRadioElement, Components.K
|
|
|
10
10
|
<div className="grid gap-4">
|
|
11
11
|
<KolInputRadio
|
|
12
12
|
{...props}
|
|
13
|
-
_options="[{'disabled':true,'label':'
|
|
14
|
-
_label="
|
|
13
|
+
_options="[{'disabled':true,'label':'Mrs. (disabled)','value':'Mrs.'},{'label':'Mr.'},{'label':'Company','value':'Company'}]"
|
|
14
|
+
_label="Salutation"
|
|
15
15
|
/>
|
|
16
16
|
<KolInputRadio
|
|
17
17
|
{...props}
|
|
18
18
|
_required
|
|
19
19
|
_msg={{ _type: 'error', _description: ERROR_MSG }}
|
|
20
20
|
_touched
|
|
21
|
-
_value="
|
|
22
|
-
_options="[{'label':'
|
|
23
|
-
_label="
|
|
21
|
+
_value="Company"
|
|
22
|
+
_options="[{'label':'Mrs.','value':'Mrs.'},{'disabled':true,'label':'Mr. (disabled)','value':'Mr.'},{'label':'Company','value':'Company'}]"
|
|
23
|
+
_label="Salutation (with error)"
|
|
24
24
|
/>
|
|
25
25
|
<KolInputRadio
|
|
26
26
|
{...props}
|
|
@@ -28,9 +28,9 @@ export const InputRadioCases = forwardRef<HTMLKolInputRadioElement, Components.K
|
|
|
28
28
|
_accessKey="A"
|
|
29
29
|
_orientation="horizontal"
|
|
30
30
|
_required
|
|
31
|
-
_value="
|
|
32
|
-
_options="[{'label':'
|
|
33
|
-
_label="
|
|
31
|
+
_value="Company"
|
|
32
|
+
_options="[{'label':'Mrs.','value':'Mrs.'},{'disabled':true,'label':'Mr. (disabled)'},{'label':'Company','value':'Company'}]"
|
|
33
|
+
_label="Salutation (horizontal)"
|
|
34
34
|
/>
|
|
35
35
|
<KolInputRadio
|
|
36
36
|
{...props}
|
|
@@ -39,18 +39,33 @@ export const InputRadioCases = forwardRef<HTMLKolInputRadioElement, Components.K
|
|
|
39
39
|
_required
|
|
40
40
|
_msg={{ _type: 'error', _description: ERROR_MSG }}
|
|
41
41
|
_touched
|
|
42
|
-
_value="
|
|
43
|
-
_options="[{'label':'
|
|
44
|
-
_label="
|
|
42
|
+
_value="Company"
|
|
43
|
+
_options="[{'label':'Mrs.','value':'Mrs.'},{'disabled':true,'label':'Mr. (disabled)'},{'label':'Company','value':'Company'}]"
|
|
44
|
+
_label="Salutation (horizontal with error)"
|
|
45
45
|
/>
|
|
46
46
|
<KolInputRadio
|
|
47
47
|
{...props}
|
|
48
48
|
_disabled
|
|
49
|
-
_value="
|
|
50
|
-
_options="[{'label':'
|
|
51
|
-
_label="
|
|
49
|
+
_value="Company"
|
|
50
|
+
_options="[{'label':'Mrs.','value':'Mrs.'},{'disabled':true,'label':'Mr. (disabled)'},{'label':'Company','value':'Company'}]"
|
|
51
|
+
_label="Salutation"
|
|
52
52
|
_touched
|
|
53
53
|
/>
|
|
54
|
+
<KolInputRadio
|
|
55
|
+
{...props}
|
|
56
|
+
_orientation="horizontal"
|
|
57
|
+
_required
|
|
58
|
+
_msg={{ _type: 'error', _description: ERROR_MSG }}
|
|
59
|
+
_touched
|
|
60
|
+
_value="Company"
|
|
61
|
+
_options={[
|
|
62
|
+
{ label: 'Mrs.', value: 'Mrs.', hint: 'Description for option "Mrs."' },
|
|
63
|
+
{ label: 'Mr. (disabled)', value: 'Mr.', hint: 'Description for option "Mr."', disabled: true },
|
|
64
|
+
{ label: 'Company', value: 'Company', hint: 'Description for option "Company"' },
|
|
65
|
+
]}
|
|
66
|
+
_label="Salutation (horizontal with error hint and description)"
|
|
67
|
+
_hint={HINT_MSG}
|
|
68
|
+
/>
|
|
54
69
|
</div>
|
|
55
70
|
);
|
|
56
71
|
});
|
|
@@ -13,7 +13,7 @@ export const InputRangeCases = forwardRef<HTMLKolInputRangeElement, Components.K
|
|
|
13
13
|
_min={0}
|
|
14
14
|
_max={50}
|
|
15
15
|
_msg={{ _type: 'error', _description: ERROR_MSG }}
|
|
16
|
-
_label="
|
|
16
|
+
_label="Slider"
|
|
17
17
|
_icons={{
|
|
18
18
|
left: {
|
|
19
19
|
icon: 'codicon codicon-arrow-left',
|
|
@@ -32,10 +32,10 @@ export const InputRangeCases = forwardRef<HTMLKolInputRangeElement, Components.K
|
|
|
32
32
|
_max={50}
|
|
33
33
|
_step={10}
|
|
34
34
|
_msg={{ _type: 'error', _description: ERROR_MSG }}
|
|
35
|
-
_label="
|
|
35
|
+
_label="Slider with error"
|
|
36
36
|
_touched
|
|
37
37
|
/>
|
|
38
|
-
<KolInputRange {...props} _disabled _min={0} _max={50} _label="
|
|
38
|
+
<KolInputRange {...props} _disabled _min={0} _max={50} _label="Slider (disabled)" />
|
|
39
39
|
</div>
|
|
40
40
|
);
|
|
41
41
|
});
|
|
@@ -11,8 +11,8 @@ export const InputTextCases = forwardRef<HTMLKolInputTextElement, Components.Kol
|
|
|
11
11
|
<KolInputText
|
|
12
12
|
{...props}
|
|
13
13
|
_hint={HINT_MSG}
|
|
14
|
-
_msg={{ _type: 'error', _description: ERROR_MSG, _label: 'test
|
|
15
|
-
_placeholder="
|
|
14
|
+
_msg={{ _type: 'error', _description: ERROR_MSG, _label: 'test headline' }}
|
|
15
|
+
_placeholder="With icons"
|
|
16
16
|
_icons={{
|
|
17
17
|
right: {
|
|
18
18
|
icon: 'codicon codicon-arrow-right',
|
|
@@ -30,19 +30,19 @@ export const InputTextCases = forwardRef<HTMLKolInputTextElement, Components.Kol
|
|
|
30
30
|
_required
|
|
31
31
|
_type="search"
|
|
32
32
|
_touched
|
|
33
|
-
_label="
|
|
33
|
+
_label="First name (text)"
|
|
34
34
|
_accessKey="V"
|
|
35
35
|
ref={ref}
|
|
36
36
|
/>
|
|
37
|
-
<KolInputText {...props} _placeholder="Placeholder" _msg={{ _type: 'info', _description: '
|
|
37
|
+
<KolInputText {...props} _placeholder="Placeholder" _msg={{ _type: 'info', _description: 'Just a hint' }} _label="Search" _type="search" />
|
|
38
38
|
<KolInputText {...props} _placeholder="Placeholder" _msg={{ _type: 'error', _description: ERROR_MSG }} _touched _type="url" _label="URL (url)" />
|
|
39
|
-
<KolInputText {...props} _placeholder="Placeholder" _type="tel" _label="
|
|
40
|
-
<KolInputText {...props} _placeholder="Placeholder" _type="tel" _label="
|
|
41
|
-
<KolInputText {...props} _placeholder="Placeholder" _label="
|
|
42
|
-
<KolInputText {...props} _placeholder="Placeholder" _readOnly _label="
|
|
43
|
-
<KolInputText {...props} _value="Value" _readOnly _label="
|
|
44
|
-
<KolInputText {...props} _placeholder="Placeholder" _disabled _label="
|
|
45
|
-
<KolInputText {...props} _value="Value" _disabled _label="
|
|
39
|
+
<KolInputText {...props} _placeholder="Placeholder" _type="tel" _label="Telephone (tel)" _msg={{ _type: 'warning', _description: 'Small warning' }} />
|
|
40
|
+
<KolInputText {...props} _placeholder="Placeholder" _type="tel" _label="Telephone (tel)" _msg={{ _type: 'success', _description: 'Success message' }} />
|
|
41
|
+
<KolInputText {...props} _placeholder="Placeholder" _label="With counter" _hasCounter _maxLength={10} />
|
|
42
|
+
<KolInputText {...props} _placeholder="Placeholder" _readOnly _label="First name (text, readonly)" />
|
|
43
|
+
<KolInputText {...props} _value="Value" _readOnly _label="First name (text, readonly)" />
|
|
44
|
+
<KolInputText {...props} _placeholder="Placeholder" _disabled _label="First name (text, disabled)" />
|
|
45
|
+
<KolInputText {...props} _value="Value" _disabled _label="First name (text, disabled)" />
|
|
46
46
|
</div>
|
|
47
47
|
);
|
|
48
48
|
});
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { Routes } from '../../shares/types';
|
|
2
2
|
import { InputTextBasic } from './basic';
|
|
3
3
|
import { InputTextHideErrors } from './hide-errors';
|
|
4
|
+
import { InputTextFormatterDemo } from './text-formatter';
|
|
4
5
|
|
|
5
6
|
export const INPUT_TEXT_ROUTES: Routes = {
|
|
6
7
|
'input-text': {
|
|
7
8
|
basic: InputTextBasic,
|
|
8
9
|
'hide-errors': InputTextHideErrors,
|
|
10
|
+
'text-formatter': InputTextFormatterDemo,
|
|
9
11
|
},
|
|
10
12
|
};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Formik, Field, type FieldProps } from 'formik';
|
|
3
|
+
import { KolForm, KolHeading, KolInputText } from '@public-ui/react';
|
|
4
|
+
import { SampleDescription } from '../SampleDescription';
|
|
5
|
+
|
|
6
|
+
const NON_ALPHANUM = /[^a-zA-Z0-9]/g;
|
|
7
|
+
const EVERY_FOUR_CHARS = /(.{4})(?!$)/g;
|
|
8
|
+
|
|
9
|
+
class IbanFormatter {
|
|
10
|
+
private electronicFormat(iban: string): string {
|
|
11
|
+
return iban.replace(NON_ALPHANUM, '').toUpperCase();
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
private printFormat(iban: string, separator?: string) {
|
|
15
|
+
return this.electronicFormat(iban).replace(EVERY_FOUR_CHARS, '$1' + (separator || ' '));
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
public parse(value: string): string {
|
|
19
|
+
return this.electronicFormat(value);
|
|
20
|
+
}
|
|
21
|
+
public format(value: string): string {
|
|
22
|
+
return this.printFormat(value);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
type FormValues = {
|
|
27
|
+
iban: string;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export function InputTextFormatterDemo() {
|
|
31
|
+
const handleSubmit = async () => {};
|
|
32
|
+
const formatter = new IbanFormatter();
|
|
33
|
+
const initialValues: FormValues = {
|
|
34
|
+
iban: 'DE89370400440532013000',
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<>
|
|
39
|
+
<SampleDescription>
|
|
40
|
+
<p>
|
|
41
|
+
This example demonstrates formatting a data value in an input field (example IBAN). The data value is formatted to the input field (print format) and
|
|
42
|
+
vice versa the formatting is removed again (machine format)
|
|
43
|
+
</p>
|
|
44
|
+
</SampleDescription>
|
|
45
|
+
<Formik<FormValues> initialValues={initialValues} onSubmit={handleSubmit}>
|
|
46
|
+
{(form) => (
|
|
47
|
+
<>
|
|
48
|
+
<div className="p-2">
|
|
49
|
+
<KolHeading _label="Formatted Form Field" _level={2} />
|
|
50
|
+
<KolForm>
|
|
51
|
+
<Field name="iban">
|
|
52
|
+
{({ field }: FieldProps<FormValues['iban']>) => (
|
|
53
|
+
<div className="block mt-2">
|
|
54
|
+
<KolInputText
|
|
55
|
+
onBlur={() => {
|
|
56
|
+
void form.setFieldTouched('iban', true);
|
|
57
|
+
}}
|
|
58
|
+
id="field-iban"
|
|
59
|
+
_label="IBAN"
|
|
60
|
+
_value={formatter.format(field.value ?? '')}
|
|
61
|
+
_msg={{
|
|
62
|
+
_type: 'error',
|
|
63
|
+
_description: form.errors.iban || '',
|
|
64
|
+
}}
|
|
65
|
+
_touched={form.touched.iban}
|
|
66
|
+
_required
|
|
67
|
+
_on={{
|
|
68
|
+
onInput: (event, value: unknown) => {
|
|
69
|
+
if (event.target) {
|
|
70
|
+
const parsed_value = formatter.parse((value as string) ?? '');
|
|
71
|
+
|
|
72
|
+
void form.setFieldValue('iban', parsed_value, true);
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
}}
|
|
76
|
+
/>
|
|
77
|
+
</div>
|
|
78
|
+
)}
|
|
79
|
+
</Field>
|
|
80
|
+
</KolForm>
|
|
81
|
+
</div>
|
|
82
|
+
<div className="p-2">
|
|
83
|
+
<KolHeading _label="Model" _level={2} />
|
|
84
|
+
<pre>{JSON.stringify(form.values, null, 2)}</pre>
|
|
85
|
+
</div>
|
|
86
|
+
</>
|
|
87
|
+
)}
|
|
88
|
+
</Formik>
|
|
89
|
+
</>
|
|
90
|
+
);
|
|
91
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { KolLink } from '@public-ui/react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import type { FC } from 'react';
|
|
4
|
+
import { SampleDescription } from '../SampleDescription';
|
|
5
|
+
|
|
6
|
+
export const LinkAriaDescription: FC = () => (
|
|
7
|
+
<>
|
|
8
|
+
<SampleDescription>
|
|
9
|
+
<p>This sample shows KolLink with aria-description</p>
|
|
10
|
+
</SampleDescription>
|
|
11
|
+
|
|
12
|
+
<div className="flex flex-wrap gap-4">
|
|
13
|
+
<KolLink _href="#/back-page" _label="Link Text without aria description"></KolLink>
|
|
14
|
+
<KolLink _href="#/back-page" _label="Link Text" _ariaDescription="Link Area Description"></KolLink>
|
|
15
|
+
</div>
|
|
16
|
+
</>
|
|
17
|
+
);
|
|
@@ -18,17 +18,18 @@ export const LinkBasic: FC = () => (
|
|
|
18
18
|
<KolLink _hideLabel _icons="codicon codicon-home" _href="#/back-page" _label="Icon Link" />
|
|
19
19
|
<KolLink _disabled _hideLabel _icons="codicon codicon-home" _href="#/back-page" _label="Icon Link (deaktiviert)" />
|
|
20
20
|
<p>
|
|
21
|
-
In
|
|
22
|
-
|
|
21
|
+
In this paragraph, a link is inserted that contains no additional attributes.
|
|
22
|
+
<KolLink _href="#/back-page" _label="Simple Link" />
|
|
23
|
+
It is rendered by default as a <strong>inline element</strong>.
|
|
23
24
|
</p>
|
|
24
25
|
<p>
|
|
25
|
-
In
|
|
26
|
-
<KolLink class="d-inline-block" _accessKey="S" _href="#/back-page" _label="Simple Link" />.
|
|
27
|
-
|
|
26
|
+
In this paragraph, a link is inserted that is rendered as an inline-block element.
|
|
27
|
+
<KolLink class="d-inline-block" _accessKey="S" _href="#/back-page" _label="Simple Link" />. This allows you to assign width, height, and other
|
|
28
|
+
properties to it using CSS styles.
|
|
28
29
|
<br />
|
|
29
30
|
<br />
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
After that, there is a link that is rendered as a block element.
|
|
32
|
+
<KolLink class="d-block" _href="#/back-page" _label="Simple Link" />, therefore, I span the entire width of the parent element, causing a line break.
|
|
32
33
|
</p>
|
|
33
34
|
</div>
|
|
34
35
|
</>
|
|
@@ -12,26 +12,26 @@ export const LinkIcons: FC = () => (
|
|
|
12
12
|
</SampleDescription>
|
|
13
13
|
|
|
14
14
|
<div className="grid gap-4">
|
|
15
|
-
<KolLink _icons="codicon codicon-home" _label="
|
|
15
|
+
<KolLink _icons="codicon codicon-home" _label="I am a link with an icon on the left" _href="#/back-page" />
|
|
16
16
|
<KolLink
|
|
17
17
|
_icons={{
|
|
18
18
|
right: 'codicon codicon-home',
|
|
19
19
|
}}
|
|
20
|
-
_label="
|
|
20
|
+
_label="I am a link with an icon on the right"
|
|
21
21
|
_href="#/back-page"
|
|
22
22
|
/>
|
|
23
23
|
<KolLink
|
|
24
24
|
_icons={{
|
|
25
25
|
top: 'codicon codicon-home',
|
|
26
26
|
}}
|
|
27
|
-
_label="
|
|
27
|
+
_label="I am a link with an icon at the top"
|
|
28
28
|
_href="#/back-page"
|
|
29
29
|
/>
|
|
30
30
|
<KolLink
|
|
31
31
|
_icons={{
|
|
32
32
|
bottom: 'codicon codicon-home',
|
|
33
33
|
}}
|
|
34
|
-
_label="
|
|
34
|
+
_label="I am a link with icon below"
|
|
35
35
|
_href="#/back-page"
|
|
36
36
|
/>
|
|
37
37
|
<KolLink
|
|
@@ -41,7 +41,7 @@ export const LinkIcons: FC = () => (
|
|
|
41
41
|
bottom: 'codicon codicon-home',
|
|
42
42
|
left: 'codicon codicon-home',
|
|
43
43
|
}}
|
|
44
|
-
_label="
|
|
44
|
+
_label="I am a link with all icons"
|
|
45
45
|
_href="#/back-page"
|
|
46
46
|
/>
|
|
47
47
|
</div>
|
|
@@ -11,10 +11,10 @@ export const LinkImage: FC = () => (
|
|
|
11
11
|
</SampleDescription>
|
|
12
12
|
|
|
13
13
|
<div className="grid gap-4">
|
|
14
|
-
<KolLink _href="#/back-page" _label="
|
|
14
|
+
<KolLink _href="#/back-page" _label="I am a link that is rendered as text" />
|
|
15
15
|
<br />
|
|
16
16
|
<KolLink _href="#/back-page" _label="">
|
|
17
|
-
<img alt="
|
|
17
|
+
<img alt="Presentation of the KoliBri theming" slot="expert" src="abgrenzung.jpg" width="300" />
|
|
18
18
|
</KolLink>
|
|
19
19
|
</div>
|
|
20
20
|
</>
|
|
@@ -3,6 +3,7 @@ import { LinkBasic } from './basic';
|
|
|
3
3
|
import { LinkIcons } from './icons';
|
|
4
4
|
import { LinkImage } from './image';
|
|
5
5
|
import { LinkTarget } from './target';
|
|
6
|
+
import { LinkAriaDescription } from './aria-description';
|
|
6
7
|
|
|
7
8
|
export const LINK_ROUTES: Routes = {
|
|
8
9
|
link: {
|
|
@@ -10,5 +11,6 @@ export const LINK_ROUTES: Routes = {
|
|
|
10
11
|
icons: LinkIcons,
|
|
11
12
|
image: LinkImage,
|
|
12
13
|
target: LinkTarget,
|
|
14
|
+
'aria-description': LinkAriaDescription,
|
|
13
15
|
},
|
|
14
16
|
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { KolLinkButton } from '@public-ui/react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import type { FC } from 'react';
|
|
4
|
+
import { SampleDescription } from '../SampleDescription';
|
|
5
|
+
|
|
6
|
+
export const LinkButtonAriaDescription: FC = () => (
|
|
7
|
+
<>
|
|
8
|
+
<SampleDescription>
|
|
9
|
+
<p>This sample shows KolLinkButton with aria-description</p>
|
|
10
|
+
</SampleDescription>
|
|
11
|
+
|
|
12
|
+
<div className="flex flex-wrap gap-4">
|
|
13
|
+
<KolLinkButton _href="#/back-page" _label="Link Button Text without area description"></KolLinkButton>
|
|
14
|
+
<KolLinkButton _href="#/back-page" _label="Link Button Text" _ariaDescription="Link Button Area Description"></KolLinkButton>
|
|
15
|
+
</div>
|
|
16
|
+
</>
|
|
17
|
+
);
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { Routes } from '../../shares/types';
|
|
2
2
|
import { LinkButtonBasic } from './basic';
|
|
3
|
+
import { LinkButtonAriaDescription } from './aria-description';
|
|
3
4
|
|
|
4
5
|
export const LINK_BUTTON_ROUTES: Routes = {
|
|
5
6
|
'link-button': {
|
|
6
7
|
basic: LinkButtonBasic,
|
|
8
|
+
'aria-description': LinkButtonAriaDescription,
|
|
7
9
|
},
|
|
8
10
|
};
|