@public-ui/sample-react 2.1.7 → 2.1.8-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/1487.js +1 -1
- package/dist/1636.js +1 -1
- package/dist/1792.js +1 -1
- package/dist/1795.js +1 -1
- package/dist/1938.js +2 -0
- 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/4332.js +1 -1
- package/dist/4402.js +1 -1
- package/dist/4556.js +2 -0
- package/dist/4818.js +1 -1
- package/dist/4892.js +1 -1
- package/dist/4933.js +1 -1
- package/dist/4943.js +1 -1
- package/dist/495.js +1 -1
- package/dist/5034.js +1 -1
- package/dist/5056.js +1 -1
- package/dist/5138.js +1 -1
- package/dist/5296.js +1 -1
- package/dist/5356.js +1 -1
- package/dist/5551.js +1 -1
- package/dist/5835.js +1 -1
- package/dist/5840.js +1 -1
- package/dist/5889.js +1 -1
- package/dist/5912.js +1 -1
- package/dist/6082.js +1 -1
- package/dist/6099.js +1 -1
- package/dist/6181.js +1 -1
- package/dist/619.js +1 -1
- package/dist/6671.js +1 -1
- package/dist/6775.js +1 -1
- package/dist/6812.js +2 -0
- 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/8737.js +1 -1
- package/dist/8786.js +1 -1
- package/dist/8796.js +1 -1
- package/dist/8853.js +2 -0
- package/dist/8977.js +1 -1
- package/dist/9333.js +1 -1
- package/dist/9389.js +1 -1
- package/dist/9561.js +1 -1
- package/dist/9599.js +1 -1
- package/dist/9612.js +1 -1
- package/dist/9890.js +1 -1
- package/dist/index.html +1 -1
- package/dist/main.css +3 -3
- package/dist/main.js +1 -1
- package/dist/main.js.LICENSE.txt +2 -2
- package/package.json +13 -14
- package/public/index.html +1 -1
- package/src/@shared/_mixins.scss +3 -0
- package/src/App.tsx +1 -1
- package/src/components/FormWrap.tsx +1 -1
- package/src/components/Navigation.tsx +63 -0
- package/src/components/Sidebar.tsx +5 -41
- package/src/components/abbr/basic.tsx +12 -12
- package/src/components/alert/card-msg.tsx +3 -1
- package/src/components/alert/html.tsx +4 -2
- package/src/components/button/baselined.tsx +1 -1
- package/src/components/button/partials/variants.tsx +15 -17
- package/src/components/button/width.tsx +2 -2
- package/src/components/button-link/basic.tsx +3 -3
- package/src/components/button-link/image.tsx +0 -1
- package/src/components/card/basic.tsx +1 -1
- package/src/components/combobox/partials/variants.tsx +1 -1
- package/src/components/details/basic.tsx +2 -2
- package/src/components/form/basic.tsx +1 -1
- package/src/components/form/error-list.tsx +1 -0
- package/src/components/input-checkbox/partials/variants.tsx +22 -10
- package/src/components/input-date/reset.tsx +1 -1
- package/src/components/input-password/show-password.tsx +1 -1
- package/src/components/input-text/partials/cases.tsx +1 -1
- package/src/components/input-text/text-formatter.tsx +45 -43
- package/src/components/link/image.tsx +0 -1
- package/src/components/link/target.tsx +1 -1
- package/src/components/modal/basic.tsx +1 -1
- package/src/components/nav/basic.tsx +23 -12
- package/src/components/nav/horizontal.tsx +12 -3
- package/src/components/nav/links.ts +36 -0
- package/src/components/table/column-alignment.tsx +64 -62
- package/src/components/table/complex-headers.tsx +80 -78
- package/src/components/table/horizontal-scrollbar.tsx +30 -28
- package/src/components/table/interactive-child-elements.tsx +69 -68
- package/src/components/table/pagination-position.tsx +15 -13
- package/src/components/table/render-cell.tsx +1 -1
- package/src/components/table/sort-data.tsx +11 -8
- package/src/components/table/stateful-with-selection.tsx +36 -27
- package/src/components/table/stateful-with-single-selection.tsx +36 -27
- package/src/components/table/stateless-with-selection.tsx +26 -17
- package/src/components/table/stateless-with-single-selection.tsx +26 -17
- package/src/components/table/stateless.tsx +29 -27
- package/src/components/table/with-footer.tsx +1 -0
- package/src/components/table/with-pagination.tsx +1 -1
- package/src/components/tabs/behavior.tsx +61 -0
- package/src/components/tabs/routes.ts +2 -0
- package/src/components/textarea/adjust-height.tsx +1 -1
- package/src/components/textarea/counter.tsx +4 -1
- package/src/components/textarea/resize.tsx +1 -1
- package/src/components/textarea/rows.tsx +1 -1
- package/src/components/toast/basic.tsx +13 -11
- package/src/react.main.tsx +6 -1
- package/src/scenarios/appointment-form/AppointmentForm.tsx +1 -0
- package/src/scenarios/disabled-interactive-elements.tsx +1 -1
- package/src/scenarios/focus-elements.tsx +21 -16
- package/src/scenarios/horizontal-scrollbar-advanced/TableHorizontalScrollbarAdvanced.tsx +1 -1
- package/src/scenarios/horizontal-scrollbar-advanced/layout.scss +19 -0
- package/src/scenarios/input-group-with-error.tsx +41 -0
- package/src/scenarios/inputs-get-value.tsx +121 -119
- package/src/scenarios/routes.ts +4 -2
- package/src/scenarios/static-form.tsx +65 -62
- package/src/style.scss +10 -13
- package/tsconfig.json +1 -2
- package/unocss.config.ts +213 -0
- package/dist/3171.js +0 -2
- package/dist/4262.js +0 -2
- package/dist/479.js +0 -2
- package/dist/8710.js +0 -2
- package/src/scenarios/horizontal-scrollbar-advanced/layout.css +0 -31
- /package/dist/{3171.js.LICENSE.txt → 1938.js.LICENSE.txt} +0 -0
- /package/dist/{4262.js.LICENSE.txt → 4556.js.LICENSE.txt} +0 -0
- /package/dist/{479.js.LICENSE.txt → 6812.js.LICENSE.txt} +0 -0
- /package/dist/{8710.js.LICENSE.txt → 8853.js.LICENSE.txt} +0 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { FC } from 'react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
import { KolHeading, KolTabs } from '@public-ui/react';
|
|
5
|
+
import { SampleDescription } from '../SampleDescription';
|
|
6
|
+
|
|
7
|
+
const tabs = [
|
|
8
|
+
{
|
|
9
|
+
_icons: 'codicon codicon-pie-chart',
|
|
10
|
+
_label: 'First tab',
|
|
11
|
+
_on: {
|
|
12
|
+
onSelect: (event: Event) => {
|
|
13
|
+
console.log('First tab selected', event);
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
_icons: 'codicon codicon-calendar',
|
|
19
|
+
_label: 'Second Tab',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
_disabled: true,
|
|
23
|
+
_icons: 'codicon codicon-briefcase',
|
|
24
|
+
_label: 'Disabled Tab',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
_icons: 'codicon codicon-telescope',
|
|
28
|
+
_label: 'Last tab',
|
|
29
|
+
},
|
|
30
|
+
];
|
|
31
|
+
|
|
32
|
+
export const TabsBehavior: FC = () => (
|
|
33
|
+
<>
|
|
34
|
+
<SampleDescription>
|
|
35
|
+
<p>
|
|
36
|
+
This sample shows KolTabs with the property <code>_behavior</code> set to <code>select-manual</code> and <code>select-automatic</code>.
|
|
37
|
+
</p>
|
|
38
|
+
<p>This property allows controlling when an arrow key is pressed whether the tab change takes place right away or only focuses the tab caption.</p>
|
|
39
|
+
</SampleDescription>
|
|
40
|
+
<div className="grid gap-8">
|
|
41
|
+
<div className="grid gap-4">
|
|
42
|
+
<KolHeading _level={2} _label='Tabs with "select manual" behavior' />
|
|
43
|
+
<KolTabs _tabs={tabs} _behavior="select-manual" _label="Tabs with select manual behavior">
|
|
44
|
+
<div slot="tab-0">Contents of Tab 1</div>
|
|
45
|
+
<div slot="tab-1">Contents of Tab 2</div>
|
|
46
|
+
<div slot="tab-2">Contents of Tab 3</div>
|
|
47
|
+
<div slot="tab-3">Contents of Tab 4</div>
|
|
48
|
+
</KolTabs>
|
|
49
|
+
</div>
|
|
50
|
+
<div className="grid gap-4">
|
|
51
|
+
<KolHeading _level={2} _label='Tabs with "select automatic" behavior' />
|
|
52
|
+
<KolTabs _tabs={tabs} className="mt-4" _behavior="select-automatic" _label="Tabs with select automatic behavior">
|
|
53
|
+
<div slot="tab-0">Contents of Tab 1</div>
|
|
54
|
+
<div slot="tab-1">Contents of Tab 2</div>
|
|
55
|
+
<div slot="tab-2">Contents of Tab 3</div>
|
|
56
|
+
<div slot="tab-3">Contents of Tab 4</div>
|
|
57
|
+
</KolTabs>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
</>
|
|
61
|
+
);
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { Routes } from '../../shares/types';
|
|
2
2
|
import { TabsBasic } from './basic';
|
|
3
3
|
import { TabsIconsOnly } from './icons-only';
|
|
4
|
+
import { TabsBehavior } from './behavior';
|
|
4
5
|
|
|
5
6
|
export const TABS_ROUTES: Routes = {
|
|
6
7
|
tabs: {
|
|
7
8
|
basic: TabsBasic,
|
|
8
9
|
'icons-only': TabsIconsOnly,
|
|
10
|
+
behavior: TabsBehavior,
|
|
9
11
|
},
|
|
10
12
|
};
|
|
@@ -12,6 +12,9 @@ export const TextareaCounter: FC = () => (
|
|
|
12
12
|
</p>
|
|
13
13
|
</SampleDescription>
|
|
14
14
|
|
|
15
|
-
<
|
|
15
|
+
<section className="w-full">
|
|
16
|
+
<KolTextarea _label="Textara with counter" _hasCounter={true} />
|
|
17
|
+
<KolTextarea _label="Textara with counter and initial value" _hasCounter={true} _value={'Lorem Ipsum'} className="mt" />
|
|
18
|
+
</section>
|
|
16
19
|
</>
|
|
17
20
|
);
|
|
@@ -12,7 +12,7 @@ export const TextareaResize: FC = () => (
|
|
|
12
12
|
</p>
|
|
13
13
|
</SampleDescription>
|
|
14
14
|
|
|
15
|
-
<KolForm className="grid gap-4">
|
|
15
|
+
<KolForm className="w-full grid gap-4">
|
|
16
16
|
<KolTextarea _resize="both" _label="Text input (both)" />
|
|
17
17
|
<KolTextarea _resize="vertical" _label="Text input (vertical)" className="mt" />
|
|
18
18
|
<KolTextarea _resize="horizontal" _label="Text input (horizontal)" className="mt" />
|
|
@@ -71,17 +71,19 @@ export const ToastBasic: FC = () => {
|
|
|
71
71
|
<p>This sample demonstrates the toast service with all its options.</p>
|
|
72
72
|
</SampleDescription>
|
|
73
73
|
|
|
74
|
-
<
|
|
75
|
-
<
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
<
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
<
|
|
84
|
-
|
|
74
|
+
<section className="grid gap-4">
|
|
75
|
+
<section className="flex gap-2">
|
|
76
|
+
<KolButton _label="Show simple toast" _on={{ onClick: handleButtonClickSimple }}></KolButton>
|
|
77
|
+
<KolButton _label="Show toast with alert variant 'msg'" _on={{ onClick: handleButtonClickVariantMessage }}></KolButton>
|
|
78
|
+
<KolButton _label="Show complex toast" _on={{ onClick: handleButtonClickComplex }}></KolButton>
|
|
79
|
+
</section>
|
|
80
|
+
<section className="flex gap-2">
|
|
81
|
+
<KolButton _label="Show toast and close after 2 seconds" _on={{ onClick: () => void handleButtonClickOpenAndClose() }}></KolButton>
|
|
82
|
+
</section>
|
|
83
|
+
<section className="flex gap-2">
|
|
84
|
+
<KolButton _label="Close all toasts" _on={{ onClick: closeAll }}></KolButton>
|
|
85
|
+
</section>
|
|
86
|
+
</section>
|
|
85
87
|
</>
|
|
86
88
|
);
|
|
87
89
|
};
|
package/src/react.main.tsx
CHANGED
|
@@ -3,7 +3,7 @@ import { createRoot } from 'react-dom/client';
|
|
|
3
3
|
import { HashRouter as Router } from 'react-router-dom';
|
|
4
4
|
import { setTagNameTransformer } from '@public-ui/react';
|
|
5
5
|
|
|
6
|
-
import { bootstrap } from '@public-ui/components';
|
|
6
|
+
import { bootstrap, isInitialized } from '@public-ui/components';
|
|
7
7
|
import { defineCustomElements } from '@public-ui/components/dist/loader';
|
|
8
8
|
import { BMF, DEFAULT, ECL_EC, ECL_EU, ITZBund } from '@public-ui/themes';
|
|
9
9
|
|
|
@@ -34,6 +34,9 @@ const getThemes = async () => {
|
|
|
34
34
|
|
|
35
35
|
void (async () => {
|
|
36
36
|
try {
|
|
37
|
+
console.info('bootstap is initialized: ', isInitialized());
|
|
38
|
+
console.info('start kolibri bootstrap');
|
|
39
|
+
|
|
37
40
|
await bootstrap(
|
|
38
41
|
await getThemes(),
|
|
39
42
|
() => {
|
|
@@ -56,6 +59,8 @@ void (async () => {
|
|
|
56
59
|
environment: process.env.NODE_ENV === 'development' ? 'development' : 'production',
|
|
57
60
|
},
|
|
58
61
|
);
|
|
62
|
+
|
|
63
|
+
console.info('bootstap is initialized: ', isInitialized());
|
|
59
64
|
} catch (error) {
|
|
60
65
|
console.warn('Theme registration failed:', error);
|
|
61
66
|
}
|
|
@@ -101,6 +101,7 @@ export function AppointmentForm() {
|
|
|
101
101
|
|
|
102
102
|
<Formik<FormValues> innerRef={formikRef} initialValues={initialValues} validationSchema={validationSchema} onSubmit={handleSubmit}>
|
|
103
103
|
<KolTabs
|
|
104
|
+
className="w-full"
|
|
104
105
|
_tabs={[
|
|
105
106
|
{
|
|
106
107
|
_label: '1. Choose registration office',
|
|
@@ -50,7 +50,7 @@ export const DisabledInteractiveElements: FC = () => (
|
|
|
50
50
|
<p>This implementation ensures standardized use for all users.</p>
|
|
51
51
|
</SampleDescription>
|
|
52
52
|
|
|
53
|
-
<div className="grid gap-4">
|
|
53
|
+
<div className="w-full grid gap-4">
|
|
54
54
|
<KolCard _label="Button" _level={0}>
|
|
55
55
|
<div className="flex flex-wrap gap-4">
|
|
56
56
|
<KolButton _label="Label" />
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
KolButtonLink,
|
|
6
6
|
KolCombobox,
|
|
7
7
|
KolDetails,
|
|
8
|
+
KolHeading,
|
|
8
9
|
KolInputCheckbox,
|
|
9
10
|
KolInputColor,
|
|
10
11
|
KolInputDate,
|
|
@@ -30,16 +31,17 @@ import type { FocusableElement } from '@public-ui/components';
|
|
|
30
31
|
|
|
31
32
|
const getFocusElements = () => {
|
|
32
33
|
const focusElements = new Map<string, ForwardRefRenderFunction<any, any>>();
|
|
33
|
-
focusElements.set('inputCheckbox', (_, ref) => <KolInputCheckbox _name="checkbox" _label="Checkbox" ref={ref} />);
|
|
34
|
-
focusElements.set('inputColor', (_, ref) => <KolInputColor _name="color" _label="Color" ref={ref} />);
|
|
35
|
-
focusElements.set('inputDate', (_, ref) => <KolInputDate _name="date" _label="Date" ref={ref} />);
|
|
36
|
-
focusElements.set('inputEmail', (_, ref) => <KolInputEmail _name="email" _label="Email" ref={ref} />);
|
|
37
|
-
focusElements.set('inputFile', (_, ref) => <KolInputFile _name="file" _label="File" ref={ref} />);
|
|
38
|
-
focusElements.set('inputFileMultiple', (_, ref) => <KolInputFile _name="file" _label="Files (multiple)" _multiple ref={ref} />);
|
|
39
|
-
focusElements.set('inputNumber', (_, ref) => <KolInputNumber _name="number" _label="Number" ref={ref} />);
|
|
40
|
-
focusElements.set('inputPassword', (_, ref) => <KolInputPassword _name="password" _label="Password" ref={ref} />);
|
|
34
|
+
focusElements.set('inputCheckbox', (_, ref) => <KolInputCheckbox className="w-full" _name="checkbox" _label="Checkbox" ref={ref} />);
|
|
35
|
+
focusElements.set('inputColor', (_, ref) => <KolInputColor className="w-full" _name="color" _label="Color" ref={ref} />);
|
|
36
|
+
focusElements.set('inputDate', (_, ref) => <KolInputDate className="w-full" _name="date" _label="Date" ref={ref} />);
|
|
37
|
+
focusElements.set('inputEmail', (_, ref) => <KolInputEmail className="w-full" _name="email" _label="Email" ref={ref} />);
|
|
38
|
+
focusElements.set('inputFile', (_, ref) => <KolInputFile className="w-full" _name="file" _label="File" ref={ref} />);
|
|
39
|
+
focusElements.set('inputFileMultiple', (_, ref) => <KolInputFile className="w-full" _name="file" _label="Files (multiple)" _multiple ref={ref} />);
|
|
40
|
+
focusElements.set('inputNumber', (_, ref) => <KolInputNumber className="w-full" _name="number" _label="Number" ref={ref} />);
|
|
41
|
+
focusElements.set('inputPassword', (_, ref) => <KolInputPassword className="w-full" _name="password" _label="Password" ref={ref} />);
|
|
41
42
|
focusElements.set('inputRadio', (_, ref) => (
|
|
42
43
|
<KolInputRadio
|
|
44
|
+
className="w-full"
|
|
43
45
|
_name="radio"
|
|
44
46
|
_label="Radio"
|
|
45
47
|
_options={[
|
|
@@ -50,10 +52,11 @@ const getFocusElements = () => {
|
|
|
50
52
|
ref={ref}
|
|
51
53
|
/>
|
|
52
54
|
));
|
|
53
|
-
focusElements.set('inputRange', (_, ref) => <KolInputRange _name="range" _label="Range" ref={ref} />);
|
|
54
|
-
focusElements.set('inputText', (_, ref) => <KolInputText _name="text" _label="Text" ref={ref} />);
|
|
55
|
+
focusElements.set('inputRange', (_, ref) => <KolInputRange className="w-full" _name="range" _label="Range" ref={ref} />);
|
|
56
|
+
focusElements.set('inputText', (_, ref) => <KolInputText className="w-full" _name="text" _label="Text" ref={ref} />);
|
|
55
57
|
focusElements.set('select', (_, ref) => (
|
|
56
58
|
<KolSelect
|
|
59
|
+
className="w-full"
|
|
57
60
|
_name="select"
|
|
58
61
|
_label="Select"
|
|
59
62
|
_options={[
|
|
@@ -65,6 +68,7 @@ const getFocusElements = () => {
|
|
|
65
68
|
));
|
|
66
69
|
focusElements.set('selectMultiple', (_, ref) => (
|
|
67
70
|
<KolSelect
|
|
71
|
+
className="w-full"
|
|
68
72
|
_name="select"
|
|
69
73
|
_label="Select (multiple)"
|
|
70
74
|
_multiple
|
|
@@ -78,6 +82,7 @@ const getFocusElements = () => {
|
|
|
78
82
|
));
|
|
79
83
|
focusElements.set('singleSelect', (_, ref) => (
|
|
80
84
|
<KolSingleSelect
|
|
85
|
+
className="w-full"
|
|
81
86
|
_name="singleSelect"
|
|
82
87
|
_label="Single Select"
|
|
83
88
|
_options={[
|
|
@@ -87,17 +92,17 @@ const getFocusElements = () => {
|
|
|
87
92
|
ref={ref}
|
|
88
93
|
/>
|
|
89
94
|
));
|
|
90
|
-
focusElements.set('textarea', (_, ref) => <KolTextarea _name="textarea" _label="Textarea" _rows={5} ref={ref} />);
|
|
91
|
-
focusElements.set('accordion', (_, ref) => <KolAccordion _label="Accordion here" ref={ref} />);
|
|
95
|
+
focusElements.set('textarea', (_, ref) => <KolTextarea className="w-full" _name="textarea" _label="Textarea" _rows={5} ref={ref} />);
|
|
96
|
+
focusElements.set('accordion', (_, ref) => <KolAccordion className="w-full" _label="Accordion here" ref={ref} />);
|
|
92
97
|
focusElements.set('button', (_, ref) => <KolButton _label="Button here" ref={ref}></KolButton>);
|
|
93
98
|
focusElements.set('buttonLink', (_, ref) => <KolButtonLink _label="ButtonLink here" ref={ref}></KolButtonLink>);
|
|
94
|
-
focusElements.set('combobox', (_, ref) => <KolCombobox _label="KolCombobox here" _suggestions={[]} ref={ref}></KolCombobox>);
|
|
99
|
+
focusElements.set('combobox', (_, ref) => <KolCombobox className="w-full" _label="KolCombobox here" _suggestions={[]} ref={ref}></KolCombobox>);
|
|
95
100
|
focusElements.set('details', (_, ref) => (
|
|
96
|
-
<KolDetails _label="Details here" ref={ref}>
|
|
101
|
+
<KolDetails className="w-full" _label="Details here" ref={ref}>
|
|
97
102
|
detailed details
|
|
98
103
|
</KolDetails>
|
|
99
104
|
));
|
|
100
|
-
focusElements.set('link', (_, ref) => <KolLink _label="Link here" _href="#" ref={ref}></KolLink>);
|
|
105
|
+
focusElements.set('link', (_, ref) => <KolLink className="w-full" _label="Link here" _href="#" ref={ref}></KolLink>);
|
|
101
106
|
focusElements.set('linkButton', (_, ref) => <KolLinkButton _label="LinkButton here" _href="#" ref={ref}></KolLinkButton>);
|
|
102
107
|
|
|
103
108
|
return focusElements;
|
|
@@ -125,7 +130,7 @@ const Fallback = (props: FallbackProps) => {
|
|
|
125
130
|
</KolAlert>
|
|
126
131
|
)}
|
|
127
132
|
|
|
128
|
-
<
|
|
133
|
+
<KolHeading _level={2} _label="Focus Test Cases" />
|
|
129
134
|
<ul>
|
|
130
135
|
{componentNames.map((componentName) => (
|
|
131
136
|
<li key={componentName}>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
@import '../../@shared/mixins';
|
|
2
|
+
|
|
3
|
+
.mainlayout {
|
|
4
|
+
min-height: calc(100vh - rem(32));
|
|
5
|
+
width: 100%;
|
|
6
|
+
display: grid;
|
|
7
|
+
column-gap: rem(16);
|
|
8
|
+
grid-template-columns: rem(400) calc(100% - rem(460));
|
|
9
|
+
grid-template-rows: 1fr;
|
|
10
|
+
grid-template-areas: 'nav content';
|
|
11
|
+
|
|
12
|
+
& > .nav-area {
|
|
13
|
+
grid-area: nav;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
& > .content {
|
|
17
|
+
grid-area: content;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { FC } from 'react';
|
|
3
|
+
import { KolAlert, KolInputCheckbox, KolInputText } from '@public-ui/react';
|
|
4
|
+
import { SampleDescription } from '../components/SampleDescription';
|
|
5
|
+
|
|
6
|
+
export const InputGroupWithError: FC = () => {
|
|
7
|
+
const phoneError = true;
|
|
8
|
+
const phoneErrorMessage = 'Unrecognized phone number.';
|
|
9
|
+
const pizzaError = true;
|
|
10
|
+
const pizzaErrorMessage = 'Choose at least two and up to five toppings.';
|
|
11
|
+
const pizzaToppings = ['Mushrooms', 'Bell Peppers', 'Onions', 'Olives', 'Spinach', 'Tomatoes', 'Artichokes', 'Zucchini', 'Jalapeños', 'Basil'];
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<>
|
|
15
|
+
<SampleDescription>
|
|
16
|
+
<p>This sample shows how input components can be grouped together with just one error message, without repeating the message for every field.</p>
|
|
17
|
+
<p>The sample only demonstrates how the errors can be displayed, an actual validation logic is not part of the example.</p>
|
|
18
|
+
</SampleDescription>
|
|
19
|
+
|
|
20
|
+
<fieldset>
|
|
21
|
+
<legend>Phone number</legend>
|
|
22
|
+
{phoneError && <KolAlert _alert _type="error" _label={phoneErrorMessage} />}
|
|
23
|
+
|
|
24
|
+
<div className="grid grid-cols-3 gap-4 max-w-2xl">
|
|
25
|
+
<KolInputText _label="Country code" _msg={{ _description: phoneErrorMessage, _type: 'error' }} _touched _hideError />
|
|
26
|
+
<KolInputText _label="Area code" _msg={{ _description: phoneErrorMessage, _type: 'error' }} _touched _hideError />
|
|
27
|
+
<KolInputText _label="Local number" _msg={{ _description: phoneErrorMessage, _type: 'error' }} _touched _hideError />
|
|
28
|
+
</div>
|
|
29
|
+
</fieldset>
|
|
30
|
+
|
|
31
|
+
<fieldset className="mt">
|
|
32
|
+
<legend>Pizza toppings</legend>
|
|
33
|
+
{pizzaError && <KolAlert _alert _type="error" _label={pizzaErrorMessage} />}
|
|
34
|
+
|
|
35
|
+
{pizzaToppings.map((topping) => (
|
|
36
|
+
<KolInputCheckbox key={topping} _label={topping} _msg={{ _description: phoneErrorMessage, _type: 'error' }} _touched _hideError />
|
|
37
|
+
))}
|
|
38
|
+
</fieldset>
|
|
39
|
+
</>
|
|
40
|
+
);
|
|
41
|
+
};
|
|
@@ -80,7 +80,7 @@ const Scenario = (props: Props) => {
|
|
|
80
80
|
},
|
|
81
81
|
}}
|
|
82
82
|
></KolButton>
|
|
83
|
-
<pre>{formatter(value)}</pre>
|
|
83
|
+
<pre className="text-base">{formatter(value)}</pre>
|
|
84
84
|
</div>
|
|
85
85
|
);
|
|
86
86
|
};
|
|
@@ -100,127 +100,129 @@ export const InputsGetValue: FC = () => {
|
|
|
100
100
|
</p>
|
|
101
101
|
</SampleDescription>
|
|
102
102
|
|
|
103
|
-
<
|
|
104
|
-
<
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
103
|
+
<section className="w-full flex flex-col">
|
|
104
|
+
<KolCard _label="Sample options" className="block ha mb-8">
|
|
105
|
+
<KolInputCheckbox
|
|
106
|
+
_label="Log events to console"
|
|
107
|
+
_value={true}
|
|
108
|
+
_checked={eventLoggerActive}
|
|
109
|
+
_on={{ onChange: (_, active) => setEventLoggerActive(active as boolean) }}
|
|
110
|
+
/>
|
|
111
|
+
</KolCard>
|
|
111
112
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
}}
|
|
185
|
-
/>
|
|
186
|
-
<Scenario
|
|
187
|
-
testId="scenario-textarea"
|
|
188
|
-
InputComponent={KolTextarea}
|
|
189
|
-
inputProps={{
|
|
190
|
-
_label: 'KolTextarea',
|
|
191
|
-
}}
|
|
192
|
-
/>
|
|
193
|
-
<Scenario
|
|
194
|
-
testId="scenario-button"
|
|
195
|
-
InputComponent={KolButton}
|
|
196
|
-
inputProps={{
|
|
197
|
-
_label: 'KolButton',
|
|
198
|
-
_variant: 'ghost',
|
|
199
|
-
_value: 'KolButton value',
|
|
200
|
-
}}
|
|
201
|
-
/>
|
|
202
|
-
<Scenario
|
|
203
|
-
testId="scenario-buttonLink"
|
|
204
|
-
InputComponent={KolButtonLink}
|
|
205
|
-
inputProps={{
|
|
206
|
-
_label: 'KolButtonLink',
|
|
207
|
-
_value: 'KolButtonLink value',
|
|
208
|
-
}}
|
|
209
|
-
/>
|
|
210
|
-
|
|
211
|
-
<div className="grid grid-cols-3 gap-4">
|
|
212
|
-
<div></div>
|
|
213
|
-
<KolButton
|
|
214
|
-
_label="Run all"
|
|
215
|
-
_variant="primary"
|
|
216
|
-
_on={{
|
|
217
|
-
onClick: () => {
|
|
218
|
-
eventTarget.dispatchEvent(new Event('runAll'));
|
|
219
|
-
},
|
|
113
|
+
<div className="grid gap-4">
|
|
114
|
+
<Scenario testId="scenario-inputText" InputComponent={KolInputText} inputProps={{ _label: 'InputText' }} />
|
|
115
|
+
<Scenario
|
|
116
|
+
testId="scenario-inputCheckboxString"
|
|
117
|
+
InputComponent={KolInputCheckbox}
|
|
118
|
+
inputProps={{ _label: 'KolInputCheckbox (value)', _value: 'Checkbox True Value' }}
|
|
119
|
+
/>
|
|
120
|
+
<Scenario testId="scenario-inputCheckboxBoolean" InputComponent={KolInputCheckbox} inputProps={{ _label: 'KolInputCheckbox (boolean)' }} />
|
|
121
|
+
<Scenario testId="scenario-inputColor" InputComponent={KolInputColor} inputProps={{ _label: 'KolInputColor' }} />
|
|
122
|
+
<Scenario testId="scenario-inputDate" InputComponent={KolInputDate} inputProps={{ _label: 'KolInputDate' }} />
|
|
123
|
+
<Scenario testId="scenario-inputEmail" InputComponent={KolInputEmail} inputProps={{ _label: 'KolInputEmail' }} />
|
|
124
|
+
<Scenario
|
|
125
|
+
testId="scenario-inputFile"
|
|
126
|
+
InputComponent={KolInputFile}
|
|
127
|
+
inputProps={{ _label: 'KolInputFile' }}
|
|
128
|
+
formatter={(value) =>
|
|
129
|
+
value instanceof FileList
|
|
130
|
+
? `FileList{${Array.from(value)
|
|
131
|
+
.map((file: File) => file.name)
|
|
132
|
+
.join(', ')}}`
|
|
133
|
+
: JSON.stringify(value)
|
|
134
|
+
}
|
|
135
|
+
/>
|
|
136
|
+
<Scenario testId="scenario-inputNumber" InputComponent={KolInputNumber} inputProps={{ _label: 'KolInputNumber' }} />
|
|
137
|
+
<Scenario testId="scenario-inputPassword" InputComponent={KolInputPassword} inputProps={{ _label: 'KolInputPassword' }} />
|
|
138
|
+
<Scenario testId="scenario-inputRange" InputComponent={KolInputRange} inputProps={{ _label: 'KolInputRange' }} />
|
|
139
|
+
<Scenario
|
|
140
|
+
testId="scenario-inputRadio"
|
|
141
|
+
InputComponent={KolInputRadio}
|
|
142
|
+
inputProps={{
|
|
143
|
+
_label: 'KolInputRadio',
|
|
144
|
+
_orientation: 'horizontal',
|
|
145
|
+
_options: [
|
|
146
|
+
{ label: 'New York', value: 'New York' },
|
|
147
|
+
{ label: 'Rio de Janeiro', value: 'Rio de Janeiro' },
|
|
148
|
+
{ label: 'Rosenheim', value: 'Rosenheim' },
|
|
149
|
+
],
|
|
150
|
+
_value: 'New York',
|
|
151
|
+
}}
|
|
152
|
+
/>
|
|
153
|
+
<Scenario
|
|
154
|
+
testId="scenario-select"
|
|
155
|
+
InputComponent={KolSelect}
|
|
156
|
+
inputProps={{
|
|
157
|
+
_label: 'KolSelect',
|
|
158
|
+
_options: [
|
|
159
|
+
{ label: 'New York', value: 'New York' },
|
|
160
|
+
{ label: 'Rio de Janeiro', value: 'Rio de Janeiro' },
|
|
161
|
+
{ label: 'Rosenheim', value: 'Rosenheim' },
|
|
162
|
+
],
|
|
163
|
+
}}
|
|
164
|
+
/>
|
|
165
|
+
<Scenario
|
|
166
|
+
testId="scenario-singleSelect"
|
|
167
|
+
InputComponent={KolSingleSelect}
|
|
168
|
+
inputProps={{
|
|
169
|
+
_label: 'KolSingleSelect',
|
|
170
|
+
_options: [
|
|
171
|
+
{ label: 'New York', value: 'New York' },
|
|
172
|
+
{ label: 'Rio de Janeiro', value: 'Rio de Janeiro' },
|
|
173
|
+
{ label: 'Rosenheim', value: 'Rosenheim' },
|
|
174
|
+
],
|
|
175
|
+
_value: 'Rosenheim',
|
|
176
|
+
}}
|
|
177
|
+
/>
|
|
178
|
+
<Scenario
|
|
179
|
+
testId="scenario-combobox"
|
|
180
|
+
InputComponent={KolCombobox}
|
|
181
|
+
inputProps={{
|
|
182
|
+
_label: 'KolCombobox',
|
|
183
|
+
_suggestions: COUNTRY_SUGGESTIONS,
|
|
184
|
+
_value: 'Deutschland',
|
|
220
185
|
}}
|
|
221
|
-
|
|
186
|
+
/>
|
|
187
|
+
<Scenario
|
|
188
|
+
testId="scenario-textarea"
|
|
189
|
+
InputComponent={KolTextarea}
|
|
190
|
+
inputProps={{
|
|
191
|
+
_label: 'KolTextarea',
|
|
192
|
+
}}
|
|
193
|
+
/>
|
|
194
|
+
<Scenario
|
|
195
|
+
testId="scenario-button"
|
|
196
|
+
InputComponent={KolButton}
|
|
197
|
+
inputProps={{
|
|
198
|
+
_label: 'KolButton',
|
|
199
|
+
_variant: 'ghost',
|
|
200
|
+
_value: 'KolButton value',
|
|
201
|
+
}}
|
|
202
|
+
/>
|
|
203
|
+
<Scenario
|
|
204
|
+
testId="scenario-buttonLink"
|
|
205
|
+
InputComponent={KolButtonLink}
|
|
206
|
+
inputProps={{
|
|
207
|
+
_label: 'KolButtonLink',
|
|
208
|
+
_value: 'KolButtonLink value',
|
|
209
|
+
}}
|
|
210
|
+
/>
|
|
211
|
+
|
|
212
|
+
<div className="grid grid-cols-3 gap-4">
|
|
213
|
+
<div></div>
|
|
214
|
+
<KolButton
|
|
215
|
+
_label="Run all"
|
|
216
|
+
_variant="primary"
|
|
217
|
+
_on={{
|
|
218
|
+
onClick: () => {
|
|
219
|
+
eventTarget.dispatchEvent(new Event('runAll'));
|
|
220
|
+
},
|
|
221
|
+
}}
|
|
222
|
+
></KolButton>
|
|
223
|
+
</div>
|
|
222
224
|
</div>
|
|
223
|
-
</
|
|
225
|
+
</section>
|
|
224
226
|
</EventLoggerActiveContext.Provider>
|
|
225
227
|
</EventTargetContext.Provider>
|
|
226
228
|
</>
|
package/src/scenarios/routes.ts
CHANGED
|
@@ -6,15 +6,17 @@ import { InputsGetValue } from './inputs-get-value';
|
|
|
6
6
|
import { StaticForm } from './static-form';
|
|
7
7
|
import { FocusElements } from './focus-elements';
|
|
8
8
|
import { TableHorizontalScrollAdvanced } from './horizontal-scrollbar-advanced';
|
|
9
|
+
import { InputGroupWithError } from './input-group-with-error';
|
|
9
10
|
|
|
10
11
|
export const SCENARIO_ROUTES: Routes = {
|
|
11
12
|
scenarios: {
|
|
12
13
|
'appointment-form': AppointmentForm,
|
|
13
|
-
'inputs-get-value': InputsGetValue,
|
|
14
14
|
'custom-tooltip-width': CustomTooltipWidth,
|
|
15
|
-
'static-form': StaticForm,
|
|
16
15
|
'disabled-interactive-scenario': DisabledInteractiveElements,
|
|
17
16
|
'focus-elements': FocusElements,
|
|
17
|
+
'input-group-with-error': InputGroupWithError,
|
|
18
|
+
'inputs-get-value': InputsGetValue,
|
|
19
|
+
'static-form': StaticForm,
|
|
18
20
|
'table-horizontal-scrollbar-advanced': TableHorizontalScrollAdvanced,
|
|
19
21
|
},
|
|
20
22
|
};
|