@public-ui/sample-react 1.7.0-rc.5
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/.eslintignore +1 -0
- package/.eslintrc.js +27 -0
- package/.gitignore +41 -0
- package/.prettierignore +4 -0
- package/package.json +66 -0
- package/prettier.config.js +6 -0
- package/public/index.html +28 -0
- package/src/App.tsx +259 -0
- package/src/declare.d.ts +4 -0
- package/src/main.ts +7 -0
- package/src/react.main.tsx +56 -0
- package/src/routes-test.ts +79 -0
- package/src/samples/abbr/basic.html +6 -0
- package/src/samples/abbr/basic.tsx +39 -0
- package/src/samples/abbr/routes.ts +9 -0
- package/src/samples/accordion/basic.tsx +18 -0
- package/src/samples/accordion/header.tsx +17 -0
- package/src/samples/accordion/headlines.tsx +27 -0
- package/src/samples/accordion/list.tsx +32 -0
- package/src/samples/accordion/routes.ts +17 -0
- package/src/samples/alert/basic.tsx +37 -0
- package/src/samples/alert/card-msg.tsx +11 -0
- package/src/samples/alert/html.tsx +29 -0
- package/src/samples/alert/routes.ts +15 -0
- package/src/samples/avatar/basic.tsx +10 -0
- package/src/samples/avatar/routes.ts +8 -0
- package/src/samples/badge/basic.tsx +18 -0
- package/src/samples/badge/button.tsx +25 -0
- package/src/samples/badge/routes.ts +12 -0
- package/src/samples/breadcrumb/basic.tsx +53 -0
- package/src/samples/breadcrumb/routes.ts +9 -0
- package/src/samples/button/basic.tsx +29 -0
- package/src/samples/button/hide-label.tsx +31 -0
- package/src/samples/button/icons.tsx +27 -0
- package/src/samples/button/routes.ts +18 -0
- package/src/samples/button/width.tsx +30 -0
- package/src/samples/button-group/basic.tsx +13 -0
- package/src/samples/button-group/routes.ts +9 -0
- package/src/samples/button-link/basic.tsx +23 -0
- package/src/samples/button-link/icons.tsx +37 -0
- package/src/samples/button-link/image.tsx +14 -0
- package/src/samples/button-link/routes.ts +18 -0
- package/src/samples/button-link/target.tsx +16 -0
- package/src/samples/card/basic.tsx +12 -0
- package/src/samples/card/confirm.tsx +19 -0
- package/src/samples/card/flex.tsx +44 -0
- package/src/samples/card/routes.ts +18 -0
- package/src/samples/card/selection.tsx +70 -0
- package/src/samples/details/basic.tsx +19 -0
- package/src/samples/details/routes.ts +9 -0
- package/src/samples/form/routes.ts +5 -0
- package/src/samples/handout/basic.tsx +1013 -0
- package/src/samples/handout/routes.ts +9 -0
- package/src/samples/heading/badged.tsx +27 -0
- package/src/samples/heading/basic.tsx +15 -0
- package/src/samples/heading/paragraph.tsx +45 -0
- package/src/samples/heading/routes.ts +15 -0
- package/src/samples/icon/basic.tsx +17 -0
- package/src/samples/icon/routes.ts +9 -0
- package/src/samples/indented-text/basic.tsx +24 -0
- package/src/samples/indented-text/routes.ts +9 -0
- package/src/samples/input-checkbox/basic.tsx +37 -0
- package/src/samples/input-checkbox/routes.ts +9 -0
- package/src/samples/input-color/basic.tsx +29 -0
- package/src/samples/input-color/routes.ts +9 -0
- package/src/samples/input-date/basic.tsx +20 -0
- package/src/samples/input-date/routes.ts +9 -0
- package/src/samples/input-email/basic.tsx +30 -0
- package/src/samples/input-email/routes.ts +9 -0
- package/src/samples/input-file/basic.tsx +25 -0
- package/src/samples/input-file/routes.ts +9 -0
- package/src/samples/input-number/basic.tsx +30 -0
- package/src/samples/input-number/routes.ts +9 -0
- package/src/samples/input-password/basic.tsx +41 -0
- package/src/samples/input-password/routes.ts +9 -0
- package/src/samples/input-radio/basic.tsx +46 -0
- package/src/samples/input-radio/horizontal.tsx +42 -0
- package/src/samples/input-radio/routes.ts +14 -0
- package/src/samples/input-radio/select.tsx +18 -0
- package/src/samples/input-range/basic.tsx +29 -0
- package/src/samples/input-range/routes.ts +9 -0
- package/src/samples/input-text/basic.tsx +72 -0
- package/src/samples/input-text/blur.tsx +16 -0
- package/src/samples/input-text/focus.tsx +24 -0
- package/src/samples/input-text/hidden-label.tsx +66 -0
- package/src/samples/input-text/routes.ts +16 -0
- package/src/samples/link/basic.tsx +23 -0
- package/src/samples/link/icons.tsx +37 -0
- package/src/samples/link/image.tsx +20 -0
- package/src/samples/link/routes.ts +18 -0
- package/src/samples/link/target.tsx +15 -0
- package/src/samples/link-button/basic.tsx +22 -0
- package/src/samples/link-button/routes.ts +9 -0
- package/src/samples/link-group/routes.ts +5 -0
- package/src/samples/nav/active.tsx +88 -0
- package/src/samples/nav/aria-current.tsx +22 -0
- package/src/samples/nav/basic.tsx +62 -0
- package/src/samples/nav/horizontal.tsx +59 -0
- package/src/samples/nav/routes.ts +18 -0
- package/src/samples/pagination/basic.tsx +12 -0
- package/src/samples/pagination/routes.ts +9 -0
- package/src/samples/popover/basic.tsx +36 -0
- package/src/samples/popover/routes.ts +8 -0
- package/src/samples/progress/basic.tsx +11 -0
- package/src/samples/progress/routes.ts +9 -0
- package/src/samples/select/basic.tsx +51 -0
- package/src/samples/select/routes.ts +9 -0
- package/src/samples/skip-nav/basic.tsx +33 -0
- package/src/samples/skip-nav/routes.ts +9 -0
- package/src/samples/spin/basic.tsx +6 -0
- package/src/samples/spin/custom.css +52 -0
- package/src/samples/spin/custom.tsx +11 -0
- package/src/samples/spin/cycle.tsx +6 -0
- package/src/samples/spin/routes.ts +13 -0
- package/src/samples/split-button/basic.tsx +46 -0
- package/src/samples/split-button/routes.ts +8 -0
- package/src/samples/table/badge-size.tsx +51 -0
- package/src/samples/table/render-cell.tsx +48 -0
- package/src/samples/table/routes.ts +15 -0
- package/src/samples/table/sort-date.tsx +33 -0
- package/src/samples/table/test-data.ts +66 -0
- package/src/samples/textarea/adjust-height.tsx +22 -0
- package/src/samples/textarea/basic.tsx +11 -0
- package/src/samples/textarea/disabled.tsx +10 -0
- package/src/samples/textarea/placeholder.tsx +10 -0
- package/src/samples/textarea/readonly.tsx +10 -0
- package/src/samples/textarea/resize.tsx +13 -0
- package/src/samples/textarea/routes.ts +27 -0
- package/src/samples/textarea/rows.tsx +10 -0
- package/src/samples/toast/basic.tsx +21 -0
- package/src/samples/toast/routes.ts +8 -0
- package/src/samples/version/basic.tsx +6 -0
- package/src/samples/version/context.tsx +12 -0
- package/src/samples/version/routes.ts +12 -0
- package/src/shares/constants.ts +2 -0
- package/src/shares/react-roots.ts +10 -0
- package/src/shares/routes.ts +87 -0
- package/src/shares/store.ts +85 -0
- package/src/shares/theme.ts +103 -0
- package/src/shares/types.ts +4 -0
- package/src/style.scss +89 -0
- package/test-build.sh +2 -0
- package/tsconfig.json +32 -0
- package/unocss.config.ts +7 -0
- package/webpack.config.js +14 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { KolProgress } from '@public-ui/react';
|
|
3
|
+
|
|
4
|
+
import { FC } from 'react';
|
|
5
|
+
|
|
6
|
+
export const ProgressBasic: FC = () => (
|
|
7
|
+
<div className="grid gap-4">
|
|
8
|
+
<KolProgress _variant="bar" _max={100} _value={33}></KolProgress>
|
|
9
|
+
<KolProgress _variant="cycle" _max={100} _value={33}></KolProgress>
|
|
10
|
+
</div>
|
|
11
|
+
);
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SelectOption } from '@public-ui/components';
|
|
3
|
+
|
|
4
|
+
import { KolForm, KolSelect } from '@public-ui/react';
|
|
5
|
+
|
|
6
|
+
import { FC } from 'react';
|
|
7
|
+
|
|
8
|
+
import countries from 'world_countries_lists/data/countries/de/countries.json';
|
|
9
|
+
|
|
10
|
+
import { ERROR_MSG } from '../../shares/constants';
|
|
11
|
+
|
|
12
|
+
const STATUS_OPTIONS: SelectOption<string>[] = [
|
|
13
|
+
{
|
|
14
|
+
label: '- Keine Auswahl',
|
|
15
|
+
value: '',
|
|
16
|
+
disabled: true,
|
|
17
|
+
},
|
|
18
|
+
];
|
|
19
|
+
|
|
20
|
+
type Country = {
|
|
21
|
+
id: number;
|
|
22
|
+
alpha2: string;
|
|
23
|
+
alpha3: string;
|
|
24
|
+
name: string;
|
|
25
|
+
};
|
|
26
|
+
(countries as Country[]).forEach((country) =>
|
|
27
|
+
STATUS_OPTIONS.push({
|
|
28
|
+
label: country.name,
|
|
29
|
+
value: country.alpha2,
|
|
30
|
+
}),
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
export const SelectBasic: FC = () => (
|
|
34
|
+
<KolForm className="grid gap-4">
|
|
35
|
+
<KolSelect
|
|
36
|
+
_id=""
|
|
37
|
+
_options={STATUS_OPTIONS}
|
|
38
|
+
_error={ERROR_MSG}
|
|
39
|
+
_label="Anrede"
|
|
40
|
+
_icon={{
|
|
41
|
+
left: {
|
|
42
|
+
icon: 'codicon codicon-arrow-left',
|
|
43
|
+
},
|
|
44
|
+
right: {
|
|
45
|
+
icon: 'codicon codicon-arrow-right',
|
|
46
|
+
},
|
|
47
|
+
}}
|
|
48
|
+
/>
|
|
49
|
+
<KolSelect _id="" _options={STATUS_OPTIONS} _label="Anrede" _multiple _required _error={ERROR_MSG} />
|
|
50
|
+
</KolForm>
|
|
51
|
+
);
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { KolIndentedText, KolSkipNav } from '@public-ui/react';
|
|
3
|
+
|
|
4
|
+
import { FC } from 'react';
|
|
5
|
+
|
|
6
|
+
export const SkipNavBasic: FC = () => (
|
|
7
|
+
<div className="grid gap-4">
|
|
8
|
+
<KolIndentedText>
|
|
9
|
+
<p>
|
|
10
|
+
<b>Links sind unsichtbar geschalten</b>
|
|
11
|
+
<br />
|
|
12
|
+
Um die Links zu sehen, am besten einmal in diesen Bereich klicken und Tab-Taste drücken.
|
|
13
|
+
</p>
|
|
14
|
+
</KolIndentedText>
|
|
15
|
+
<KolSkipNav
|
|
16
|
+
_ariaLabel="Versteckte Navigation"
|
|
17
|
+
_links={[
|
|
18
|
+
{
|
|
19
|
+
_label: 'Zum Anfang',
|
|
20
|
+
_selector: 'header',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
_label: 'Zum Formular',
|
|
24
|
+
_selector: '#form',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
_label: 'Zum Ende',
|
|
28
|
+
_selector: 'footer',
|
|
29
|
+
},
|
|
30
|
+
]}
|
|
31
|
+
></KolSkipNav>
|
|
32
|
+
</div>
|
|
33
|
+
);
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
.loader {
|
|
2
|
+
width: 48px;
|
|
3
|
+
height: 48px;
|
|
4
|
+
border: 5px solid #333;
|
|
5
|
+
border-radius: 50%;
|
|
6
|
+
display: inline-block;
|
|
7
|
+
box-sizing: border-box;
|
|
8
|
+
position: relative;
|
|
9
|
+
animation: pulse 1s linear infinite;
|
|
10
|
+
}
|
|
11
|
+
.loader:after {
|
|
12
|
+
content: '';
|
|
13
|
+
position: absolute;
|
|
14
|
+
width: 48px;
|
|
15
|
+
height: 48px;
|
|
16
|
+
border: 5px solid #f00;
|
|
17
|
+
border-radius: 50%;
|
|
18
|
+
display: inline-block;
|
|
19
|
+
box-sizing: border-box;
|
|
20
|
+
left: 50%;
|
|
21
|
+
top: 50%;
|
|
22
|
+
transform: translate(-50%, -50%);
|
|
23
|
+
animation: scaleUp 1s linear infinite;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@keyframes scaleUp {
|
|
27
|
+
0% {
|
|
28
|
+
transform: translate(-50%, -50%) scale(0);
|
|
29
|
+
}
|
|
30
|
+
60%,
|
|
31
|
+
100% {
|
|
32
|
+
transform: translate(-50%, -50%) scale(1);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
@keyframes pulse {
|
|
36
|
+
0%,
|
|
37
|
+
60%,
|
|
38
|
+
100% {
|
|
39
|
+
transform: scale(1);
|
|
40
|
+
}
|
|
41
|
+
80% {
|
|
42
|
+
transform: scale(1.2);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/* https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-reduced-motion#toning_down_the_animation_scaling */
|
|
47
|
+
@media (prefers-reduced-motion) {
|
|
48
|
+
.loader,
|
|
49
|
+
.loader:after {
|
|
50
|
+
animation-duration: 2s;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { KolSpin } from '@public-ui/react';
|
|
3
|
+
import './custom.css';
|
|
4
|
+
|
|
5
|
+
import { FC } from 'react';
|
|
6
|
+
|
|
7
|
+
export const SpinCustom: FC = () => (
|
|
8
|
+
<KolSpin _show _variant="none">
|
|
9
|
+
<span slot="expert" className="loader"></span>
|
|
10
|
+
</KolSpin>
|
|
11
|
+
);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Routes } from '../../shares/types';
|
|
2
|
+
|
|
3
|
+
import { SpinBasic } from './basic';
|
|
4
|
+
import { SpinCustom } from './custom';
|
|
5
|
+
import { SpinCycle } from './cycle';
|
|
6
|
+
|
|
7
|
+
export const SPIN_ROUTES: Routes = {
|
|
8
|
+
spin: {
|
|
9
|
+
basic: SpinBasic,
|
|
10
|
+
cycle: SpinCycle,
|
|
11
|
+
custom: SpinCustom,
|
|
12
|
+
},
|
|
13
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { KolSplitButton } from '@public-ui/react';
|
|
3
|
+
|
|
4
|
+
import { FC } from 'react';
|
|
5
|
+
|
|
6
|
+
export const SplitButtonBasic: FC = () => {
|
|
7
|
+
const [showDropdown, setShowDropdown] = useState(false);
|
|
8
|
+
|
|
9
|
+
return (
|
|
10
|
+
<div className="grid gap-4">
|
|
11
|
+
<KolSplitButton _label="Nur der Pfeil öffnet" _onClick={console.log}>
|
|
12
|
+
I am
|
|
13
|
+
<br />a dwarf
|
|
14
|
+
</KolSplitButton>
|
|
15
|
+
<KolSplitButton _label="ohne label" _hide-label _icon="codicon codicon-git-pull-request">
|
|
16
|
+
and
|
|
17
|
+
<br />
|
|
18
|
+
I'm
|
|
19
|
+
<br />
|
|
20
|
+
digging
|
|
21
|
+
<br />a hole
|
|
22
|
+
</KolSplitButton>
|
|
23
|
+
<KolSplitButton _label="kick me">
|
|
24
|
+
diggy
|
|
25
|
+
<br />
|
|
26
|
+
diggy
|
|
27
|
+
<br />
|
|
28
|
+
hole
|
|
29
|
+
</KolSplitButton>
|
|
30
|
+
<KolSplitButton _label="schon offen" _show-dropdown={showDropdown}>
|
|
31
|
+
diggy
|
|
32
|
+
<br />
|
|
33
|
+
diggy
|
|
34
|
+
<br />
|
|
35
|
+
hole
|
|
36
|
+
</KolSplitButton>
|
|
37
|
+
<KolSplitButton _label={`vorherigen ${showDropdown ? 'schließen' : 'öffnen'}`} _onClick={() => setShowDropdown(!showDropdown)}>
|
|
38
|
+
diggy
|
|
39
|
+
<br />
|
|
40
|
+
diggy
|
|
41
|
+
<br />
|
|
42
|
+
hole
|
|
43
|
+
</KolSplitButton>
|
|
44
|
+
</div>
|
|
45
|
+
);
|
|
46
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React, { FC } from 'react';
|
|
2
|
+
|
|
3
|
+
import { KolBadge, KolTable } from '@public-ui/react';
|
|
4
|
+
|
|
5
|
+
import { getRoot } from '../../shares/react-roots';
|
|
6
|
+
import { KoliBriTableHeaders } from '@public-ui/components';
|
|
7
|
+
import { DATA, Data } from './test-data';
|
|
8
|
+
|
|
9
|
+
const DATE_FORMATTER = Intl.DateTimeFormat('de-DE', {
|
|
10
|
+
day: '2-digit',
|
|
11
|
+
month: '2-digit',
|
|
12
|
+
year: 'numeric',
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const HEADERS: KoliBriTableHeaders = {
|
|
16
|
+
horizontal: [
|
|
17
|
+
[
|
|
18
|
+
{ label: 'order', key: 'order', textAlign: 'center' },
|
|
19
|
+
{
|
|
20
|
+
label: 'date',
|
|
21
|
+
key: 'date',
|
|
22
|
+
textAlign: 'center',
|
|
23
|
+
render: (_el, _cell, tupel) => DATE_FORMATTER.format((tupel as Data).date),
|
|
24
|
+
sort: (data: Data[]) =>
|
|
25
|
+
data.sort((data0, data1) => {
|
|
26
|
+
if (data0.date < data1.date) return -1;
|
|
27
|
+
else if (data1.date < data0.date) return 1;
|
|
28
|
+
else return 0;
|
|
29
|
+
}),
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
label: 'Aktion',
|
|
33
|
+
key: 'order',
|
|
34
|
+
render: (el, cell, tupel) => {
|
|
35
|
+
getRoot(el).render(
|
|
36
|
+
<KolBadge
|
|
37
|
+
style={{
|
|
38
|
+
backgroundColor: 'red',
|
|
39
|
+
width: '80%',
|
|
40
|
+
}}
|
|
41
|
+
_icon="codicon codicon-location"
|
|
42
|
+
_label={'Speichern'}
|
|
43
|
+
/>,
|
|
44
|
+
);
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
],
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const TableBadgeSize: FC = () => <KolTable _caption="Sort a date column" _data={DATA} _headers={HEADERS} />;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React, { FC } from 'react';
|
|
2
|
+
|
|
3
|
+
import { KolButton, KolInputText, KolTable } from '@public-ui/react';
|
|
4
|
+
|
|
5
|
+
import { getRoot } from '../../shares/react-roots';
|
|
6
|
+
import { KoliBriTableHeaders } from '@public-ui/components';
|
|
7
|
+
import { DATA, Data } from './test-data';
|
|
8
|
+
|
|
9
|
+
const DATE_FORMATTER = Intl.DateTimeFormat('de-DE', {
|
|
10
|
+
day: '2-digit',
|
|
11
|
+
month: '2-digit',
|
|
12
|
+
year: 'numeric',
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const HEADERS: KoliBriTableHeaders = {
|
|
16
|
+
horizontal: [
|
|
17
|
+
[
|
|
18
|
+
{ label: '#', key: 'order', textAlign: 'center' },
|
|
19
|
+
{
|
|
20
|
+
label: 'Datum (string)',
|
|
21
|
+
key: 'date',
|
|
22
|
+
textAlign: 'center',
|
|
23
|
+
render: (_el, _cell, tupel) => `<strong>${DATE_FORMATTER.format((tupel as Data).date)}</strong>`,
|
|
24
|
+
sort: (data: Data[]) =>
|
|
25
|
+
data.sort((data0, data1) => {
|
|
26
|
+
if (data0.date < data1.date) return -1;
|
|
27
|
+
else if (data1.date < data0.date) return 1;
|
|
28
|
+
else return 0;
|
|
29
|
+
}),
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
label: 'Aktion (react)',
|
|
33
|
+
key: 'order',
|
|
34
|
+
render: (el, cell, tupel) => {
|
|
35
|
+
// https://reactjs.org/docs/portals.html
|
|
36
|
+
getRoot(el).render(
|
|
37
|
+
<>
|
|
38
|
+
<KolButton _label={'Speichern'} />
|
|
39
|
+
<KolInputText _id="test">Eingabe</KolInputText>
|
|
40
|
+
</>,
|
|
41
|
+
);
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
],
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const TableRenderCell: FC = () => <KolTable _caption="Sort a date column" _data={DATA} _headers={HEADERS} />;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Routes } from '../../shares/types';
|
|
2
|
+
|
|
3
|
+
import { TableBadgeSize } from './badge-size';
|
|
4
|
+
|
|
5
|
+
import { TableRenderCell } from './render-cell';
|
|
6
|
+
|
|
7
|
+
import { TableSortTabel } from './sort-date';
|
|
8
|
+
|
|
9
|
+
export const TABLE_ROUTES: Routes = {
|
|
10
|
+
table: {
|
|
11
|
+
'badge-size': TableBadgeSize,
|
|
12
|
+
'render-cell': TableRenderCell,
|
|
13
|
+
'sort-data': TableSortTabel,
|
|
14
|
+
},
|
|
15
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React, { FC } from 'react';
|
|
2
|
+
|
|
3
|
+
import { KolTable } from '@public-ui/react';
|
|
4
|
+
import { KoliBriTableHeaders } from '@public-ui/components';
|
|
5
|
+
import { DATA, Data } from './test-data';
|
|
6
|
+
|
|
7
|
+
const DATE_FORMATTER = Intl.DateTimeFormat('de-DE', {
|
|
8
|
+
day: '2-digit',
|
|
9
|
+
month: '2-digit',
|
|
10
|
+
year: 'numeric',
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
const HEADERS: KoliBriTableHeaders = {
|
|
14
|
+
horizontal: [
|
|
15
|
+
[
|
|
16
|
+
{ label: 'order', key: 'order', textAlign: 'center' },
|
|
17
|
+
{
|
|
18
|
+
label: 'date',
|
|
19
|
+
key: 'date',
|
|
20
|
+
textAlign: 'center',
|
|
21
|
+
render: (_el, _cell, tupel) => DATE_FORMATTER.format((tupel as Data).date),
|
|
22
|
+
sort: (data: Data[]) =>
|
|
23
|
+
data.sort((data0, data1) => {
|
|
24
|
+
if (data0.date < data1.date) return -1;
|
|
25
|
+
else if (data1.date < data0.date) return 1;
|
|
26
|
+
else return 0;
|
|
27
|
+
}),
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
],
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const TableSortTabel: FC = () => <KolTable _caption="Sort a date column" _data={DATA} _headers={HEADERS} />;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
export type Data = {
|
|
2
|
+
order: number;
|
|
3
|
+
date: Date;
|
|
4
|
+
};
|
|
5
|
+
export const DATA: Data[] = [
|
|
6
|
+
{
|
|
7
|
+
order: 0,
|
|
8
|
+
date: new Date('1981-05-26T21:33:43.612Z'),
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
order: 1,
|
|
12
|
+
date: new Date('1971-04-25T19:44:17.014Z'),
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
order: 2,
|
|
16
|
+
date: new Date('1986-07-10T11:39:29.539Z'),
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
order: 3,
|
|
20
|
+
date: new Date('1976-02-02T10:00:36.346Z'),
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
order: 4,
|
|
24
|
+
date: new Date('1998-07-07T12:50:36.016Z'),
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
order: 5,
|
|
28
|
+
date: new Date('1994-09-05T05:10:44.078Z'),
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
order: 6,
|
|
32
|
+
date: new Date('1986-05-23T13:05:01.874Z'),
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
order: 7,
|
|
36
|
+
date: new Date('1975-06-29T21:51:29.359Z'),
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
order: 8,
|
|
40
|
+
date: new Date('1974-05-15T23:47:02.499Z'),
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
order: 9,
|
|
44
|
+
date: new Date('1990-05-27T10:13:19.641Z'),
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
order: 10,
|
|
48
|
+
date: new Date('1993-10-20T03:54:08.739Z'),
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
order: 11,
|
|
52
|
+
date: new Date('2000-02-25T11:55:43.705Z'),
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
order: 12,
|
|
56
|
+
date: new Date('1988-08-27T09:59:12.251Z'),
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
order: 13,
|
|
60
|
+
date: new Date('1980-10-24T10:41:24.897Z'),
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
order: 14,
|
|
64
|
+
date: new Date('1995-01-25T12:31:27.983Z'),
|
|
65
|
+
},
|
|
66
|
+
];
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { KolForm, KolTextarea } from '@public-ui/react';
|
|
3
|
+
|
|
4
|
+
import { FC } from 'react';
|
|
5
|
+
|
|
6
|
+
const VALUE = `Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore
|
|
7
|
+
magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd
|
|
8
|
+
gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing
|
|
9
|
+
elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos
|
|
10
|
+
et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor
|
|
11
|
+
sit amet.`;
|
|
12
|
+
|
|
13
|
+
export const TextareaAdjustHeight: FC = () => (
|
|
14
|
+
<KolForm className="row">
|
|
15
|
+
<div className="col-sm-6">
|
|
16
|
+
<KolTextarea _adjustHeight={true} _id="text-vertical" _resize="vertical" _value={VALUE} _label="Texteingabe (horizontal)" />
|
|
17
|
+
</div>
|
|
18
|
+
<div className="col-sm-6">
|
|
19
|
+
<KolTextarea _adjustHeight={true} _id="text-none" _resize="none" _value={VALUE} _label="Texteingabe (none)" />
|
|
20
|
+
</div>
|
|
21
|
+
</KolForm>
|
|
22
|
+
);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { KolForm, KolTextarea } from '@public-ui/react';
|
|
3
|
+
|
|
4
|
+
import { FC } from 'react';
|
|
5
|
+
import { ERROR_MSG } from '../../shares/constants';
|
|
6
|
+
|
|
7
|
+
export const TextareaBasic: FC = () => (
|
|
8
|
+
<KolForm>
|
|
9
|
+
<KolTextarea _id="text" _error={ERROR_MSG} _label="Texteingabe" />
|
|
10
|
+
</KolForm>
|
|
11
|
+
);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { KolForm, KolTextarea } from '@public-ui/react';
|
|
3
|
+
|
|
4
|
+
import { FC } from 'react';
|
|
5
|
+
|
|
6
|
+
export const TextareaDisabled: FC = () => (
|
|
7
|
+
<KolForm>
|
|
8
|
+
<KolTextarea _disabled _error="Es ist ein Fehler aufgetreten." _id="text" _value="Kleiner Text im Eingabefeld ..." _label="Texteingabe" />
|
|
9
|
+
</KolForm>
|
|
10
|
+
);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { KolForm, KolTextarea } from '@public-ui/react';
|
|
3
|
+
|
|
4
|
+
import { FC } from 'react';
|
|
5
|
+
|
|
6
|
+
export const TextareaPlaceholder: FC = () => (
|
|
7
|
+
<KolForm>
|
|
8
|
+
<KolTextarea _id="text" _placeholder="Hier steht ein Platzhaltertext" _label="Texteingabe" />
|
|
9
|
+
</KolForm>
|
|
10
|
+
);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { KolForm, KolTextarea } from '@public-ui/react';
|
|
3
|
+
|
|
4
|
+
import { FC } from 'react';
|
|
5
|
+
|
|
6
|
+
export const TextareaReadOnly: FC = () => (
|
|
7
|
+
<KolForm>
|
|
8
|
+
<KolTextarea _error="Es ist ein Fehler aufgetreten." _id="text" _readOnly _value="Kleiner Text im Eingabefeld ..." _label="Texteingabe" />
|
|
9
|
+
</KolForm>
|
|
10
|
+
);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { KolForm, KolTextarea } from '@public-ui/react';
|
|
3
|
+
|
|
4
|
+
import { FC } from 'react';
|
|
5
|
+
|
|
6
|
+
export const TextareaResize: FC = () => (
|
|
7
|
+
<KolForm className="grid gap-4">
|
|
8
|
+
<KolTextarea _id="text-both" _resize="both" _label="Texteingabe (both)" />
|
|
9
|
+
<KolTextarea _id="text-verical" _resize="vertical" _label="Texteingabe (vertical)" />
|
|
10
|
+
<KolTextarea _id="text-horizontal" _resize="horizontal" _label="Texteingabe (horizontal)" />
|
|
11
|
+
<KolTextarea _id="text-none" _resize="none" _label="Texteingabe (none)" />
|
|
12
|
+
</KolForm>
|
|
13
|
+
);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Routes } from '../../shares/types';
|
|
2
|
+
|
|
3
|
+
import { TextareaBasic } from './basic';
|
|
4
|
+
|
|
5
|
+
import { TextareaAdjustHeight } from './adjust-height';
|
|
6
|
+
|
|
7
|
+
import { TextareaDisabled } from './disabled';
|
|
8
|
+
|
|
9
|
+
import { TextareaPlaceholder } from './placeholder';
|
|
10
|
+
|
|
11
|
+
import { TextareaReadOnly } from './readonly';
|
|
12
|
+
|
|
13
|
+
import { TextareaResize } from './resize';
|
|
14
|
+
|
|
15
|
+
import { TextareaRows } from './rows';
|
|
16
|
+
|
|
17
|
+
export const TEXTAREA_ROUTES: Routes = {
|
|
18
|
+
textarea: {
|
|
19
|
+
basic: TextareaBasic,
|
|
20
|
+
'adjust-height': TextareaAdjustHeight,
|
|
21
|
+
disabled: TextareaDisabled,
|
|
22
|
+
placeholder: TextareaPlaceholder,
|
|
23
|
+
readonly: TextareaReadOnly,
|
|
24
|
+
resize: TextareaResize,
|
|
25
|
+
rows: TextareaRows,
|
|
26
|
+
},
|
|
27
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { KolButton, KolToast } from '@public-ui/react';
|
|
3
|
+
import { ToasterService } from '@public-ui/components';
|
|
4
|
+
|
|
5
|
+
const toaster = ToasterService.getInstance(document);
|
|
6
|
+
|
|
7
|
+
import { FC } from 'react';
|
|
8
|
+
|
|
9
|
+
const handleButtonClick = () => {
|
|
10
|
+
void toaster.enqueue({
|
|
11
|
+
description: `Toasty`,
|
|
12
|
+
label: `Initial Toast`,
|
|
13
|
+
type: 'warning',
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const ToastBasic: FC = () => (
|
|
18
|
+
<div>
|
|
19
|
+
<KolButton _label="Show toast" _on={{ onClick: handleButtonClick }}></KolButton>
|
|
20
|
+
</div>
|
|
21
|
+
);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { KolVersion } from '@public-ui/react';
|
|
3
|
+
|
|
4
|
+
import { FC } from 'react';
|
|
5
|
+
|
|
6
|
+
export const VersionContext: FC = () => (
|
|
7
|
+
<p>
|
|
8
|
+
<KolVersion _version="1.0.0" /> Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna
|
|
9
|
+
aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem
|
|
10
|
+
ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor.
|
|
11
|
+
</p>
|
|
12
|
+
);
|