@public-ui/sample-react 2.1.7 → 2.1.8
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/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/3301.js +2 -0
- 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/4065.js +2 -0
- 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/4795.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/7274.js +1 -1
- package/dist/7440.js +2 -0
- 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/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 +16 -16
- 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/access-key.tsx +34 -25
- package/src/components/button/aria-description.tsx +20 -11
- package/src/components/button/baselined.tsx +22 -13
- package/src/components/button/icons.tsx +33 -26
- package/src/components/button/partials/cases.tsx +13 -6
- package/src/components/button/partials/variants.tsx +15 -17
- package/src/components/button/width.tsx +33 -28
- package/src/components/button-group/basic.tsx +25 -16
- 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/handout/basic.tsx +304 -279
- 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/routes.ts +2 -0
- package/src/components/input-text/smart-button.tsx +33 -0
- package/src/components/input-text/text-formatter.tsx +98 -45
- 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 +81 -69
- package/src/components/table/pagination-position.tsx +15 -13
- package/src/components/table/render-cell.tsx +14 -3
- package/src/components/table/sort-data.tsx +11 -8
- package/src/components/table/stateful-with-selection.tsx +47 -27
- package/src/components/table/stateful-with-single-selection.tsx +47 -27
- package/src/components/table/stateless-with-selection.tsx +37 -17
- package/src/components/table/stateless-with-single-selection.tsx +37 -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/hooks/useToasterService.ts +21 -0
- package/src/react.main.tsx +6 -1
- package/src/scenarios/appointment-form/AppointmentForm.tsx +1 -0
- package/src/scenarios/custom-tooltip-width.tsx +26 -11
- package/src/scenarios/disabled-interactive-elements.tsx +123 -114
- 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 → 3301.js.LICENSE.txt} +0 -0
- /package/dist/{4262.js.LICENSE.txt → 4065.js.LICENSE.txt} +0 -0
- /package/dist/{479.js.LICENSE.txt → 4795.js.LICENSE.txt} +0 -0
- /package/dist/{8710.js.LICENSE.txt → 7440.js.LICENSE.txt} +0 -0
|
@@ -5,15 +5,27 @@ import { InputCheckboxCases } from './cases';
|
|
|
5
5
|
import type { Components } from '@public-ui/components';
|
|
6
6
|
export const InputCheckboxVariants = forwardRef<HTMLKolInputCheckboxElement, Components.KolInputCheckbox>(function InputCheckboxVariant(props, ref) {
|
|
7
7
|
return (
|
|
8
|
-
|
|
9
|
-
<
|
|
10
|
-
<
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
<
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
<>
|
|
9
|
+
<div className="grid md:grid-cols-2 gap-4">
|
|
10
|
+
<fieldset>
|
|
11
|
+
<legend>Label align "left" with label</legend>
|
|
12
|
+
<InputCheckboxCases {...props} _labelAlign="left" />
|
|
13
|
+
</fieldset>
|
|
14
|
+
<fieldset>
|
|
15
|
+
<legend>Label align "left" without Label (hideLabel)</legend>
|
|
16
|
+
<InputCheckboxCases ref={ref} {...props} _hideLabel _labelAlign="left" />
|
|
17
|
+
</fieldset>
|
|
18
|
+
</div>
|
|
19
|
+
<div className="grid md:grid-cols-2 gap-4">
|
|
20
|
+
<fieldset>
|
|
21
|
+
<legend>Label align "right" with label</legend>
|
|
22
|
+
<InputCheckboxCases {...props} />
|
|
23
|
+
</fieldset>
|
|
24
|
+
<fieldset>
|
|
25
|
+
<legend>Label align "right" without Label (hideLabel)</legend>
|
|
26
|
+
<InputCheckboxCases ref={ref} {...props} _hideLabel />
|
|
27
|
+
</fieldset>
|
|
28
|
+
</div>
|
|
29
|
+
</>
|
|
18
30
|
);
|
|
19
31
|
});
|
|
@@ -14,7 +14,7 @@ export const InputDateReset = () => {
|
|
|
14
14
|
</p>
|
|
15
15
|
</SampleDescription>
|
|
16
16
|
|
|
17
|
-
<KolInputDate ref={dateRef} _label="Resettable Input Date" _value="2024-02-10" />
|
|
17
|
+
<KolInputDate className="w-full" ref={dateRef} _label="Resettable Input Date" _value="2024-02-10" />
|
|
18
18
|
<KolButton className="mt" _label={'Reset'} _on={{ onClick: () => dateRef.current?.reset() }} />
|
|
19
19
|
</>
|
|
20
20
|
);
|
|
@@ -16,7 +16,7 @@ export const InputPasswordShowPassword: FC = () => {
|
|
|
16
16
|
</p>
|
|
17
17
|
</SampleDescription>
|
|
18
18
|
|
|
19
|
-
<KolForm>
|
|
19
|
+
<KolForm className="w-full">
|
|
20
20
|
<KolInputPassword _placeholder="With 'Show password' button" _label="Password" ref={passwordRef} className="block" _variant="visibility-toggle" />
|
|
21
21
|
<KolInputPassword
|
|
22
22
|
_placeholder="With 'Show password' button and disabled"
|
|
@@ -38,7 +38,7 @@ export const InputTextCases = forwardRef<HTMLKolInputTextElement, Components.Kol
|
|
|
38
38
|
<KolInputText {...props} _placeholder="Placeholder" _msg={{ _type: 'error', _description: ERROR_MSG }} _touched _type="url" _label="URL (url)" />
|
|
39
39
|
<KolInputText {...props} _placeholder="Placeholder" _type="tel" _label="Telephone (tel)" _msg={{ _type: 'warning', _description: 'Small warning' }} />
|
|
40
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} />
|
|
41
|
+
<KolInputText {...props} _placeholder="Placeholder" _label="With counter" _hasCounter _maxLength={10} _value="Lorem Ipsum" />
|
|
42
42
|
<KolInputText {...props} _placeholder="Placeholder" _readOnly _label="First name (text, readonly)" />
|
|
43
43
|
<KolInputText {...props} _value="Value" _readOnly _label="First name (text, readonly)" />
|
|
44
44
|
<KolInputText {...props} _placeholder="Placeholder" _disabled _label="First name (text, disabled)" />
|
|
@@ -2,11 +2,13 @@ import { Routes } from '../../shares/types';
|
|
|
2
2
|
import { InputTextBasic } from './basic';
|
|
3
3
|
import { InputTextHideErrors } from './hide-errors';
|
|
4
4
|
import { InputTextFormatterDemo } from './text-formatter';
|
|
5
|
+
import { InputTextSmartButton } from './smart-button';
|
|
5
6
|
|
|
6
7
|
export const INPUT_TEXT_ROUTES: Routes = {
|
|
7
8
|
'input-text': {
|
|
8
9
|
basic: InputTextBasic,
|
|
9
10
|
'hide-errors': InputTextHideErrors,
|
|
10
11
|
'text-formatter': InputTextFormatterDemo,
|
|
12
|
+
'smart-button': InputTextSmartButton,
|
|
11
13
|
},
|
|
12
14
|
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { SampleDescription } from '../SampleDescription';
|
|
3
|
+
import { ToasterService } from '@public-ui/components';
|
|
4
|
+
import { KolInputText } from '@public-ui/react';
|
|
5
|
+
|
|
6
|
+
export const InputTextSmartButton = () => {
|
|
7
|
+
const toaster = ToasterService.getInstance(document);
|
|
8
|
+
|
|
9
|
+
const smartButton = {
|
|
10
|
+
_icons: 'codicon codicon-info',
|
|
11
|
+
_hideLabel: true,
|
|
12
|
+
_label: 'Alert',
|
|
13
|
+
_on: {
|
|
14
|
+
onClick: () => {
|
|
15
|
+
void toaster.enqueue({
|
|
16
|
+
description: 'Smart-Button clicked',
|
|
17
|
+
label: `Toaster`,
|
|
18
|
+
type: 'default',
|
|
19
|
+
});
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<>
|
|
26
|
+
<SampleDescription>
|
|
27
|
+
<p>This sample shows the smart button feature for KolInputText. It allows the usage of a button inside the bnput.</p>
|
|
28
|
+
</SampleDescription>
|
|
29
|
+
|
|
30
|
+
<KolInputText _label="With Smart Button" _type="text" _smartButton={smartButton}></KolInputText>
|
|
31
|
+
</>
|
|
32
|
+
);
|
|
33
|
+
};
|
|
@@ -3,6 +3,8 @@ import { Formik, Field, type FieldProps } from 'formik';
|
|
|
3
3
|
import { KolForm, KolHeading, KolInputText } from '@public-ui/react';
|
|
4
4
|
import { SampleDescription } from '../SampleDescription';
|
|
5
5
|
|
|
6
|
+
import { NumericFormat, type NumberFormatValues } from 'react-number-format';
|
|
7
|
+
|
|
6
8
|
const NON_ALPHANUM = /[^a-zA-Z0-9]/g;
|
|
7
9
|
const EVERY_FOUR_CHARS = /(.{4})(?!$)/g;
|
|
8
10
|
|
|
@@ -23,17 +25,26 @@ class IbanFormatter {
|
|
|
23
25
|
}
|
|
24
26
|
}
|
|
25
27
|
|
|
26
|
-
type
|
|
28
|
+
type IbanExampleFormValues = {
|
|
27
29
|
iban: string;
|
|
28
30
|
};
|
|
29
31
|
|
|
32
|
+
type CurrencyExampleFormValues = {
|
|
33
|
+
currency: number;
|
|
34
|
+
};
|
|
35
|
+
|
|
30
36
|
export function InputTextFormatterDemo() {
|
|
31
37
|
const handleSubmit = async () => {};
|
|
32
38
|
const formatter = new IbanFormatter();
|
|
33
|
-
|
|
39
|
+
|
|
40
|
+
const initialIbanExampleValues: IbanExampleFormValues = {
|
|
34
41
|
iban: 'DE89370400440532013000',
|
|
35
42
|
};
|
|
36
43
|
|
|
44
|
+
const initialCurrencyExampleValues: CurrencyExampleFormValues = {
|
|
45
|
+
currency: 1000000,
|
|
46
|
+
};
|
|
47
|
+
|
|
37
48
|
return (
|
|
38
49
|
<>
|
|
39
50
|
<SampleDescription>
|
|
@@ -42,50 +53,92 @@ export function InputTextFormatterDemo() {
|
|
|
42
53
|
vice versa the formatting is removed again (machine format)
|
|
43
54
|
</p>
|
|
44
55
|
</SampleDescription>
|
|
45
|
-
<
|
|
46
|
-
{
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
<
|
|
50
|
-
|
|
51
|
-
<
|
|
52
|
-
|
|
53
|
-
<
|
|
54
|
-
<
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
56
|
+
<section className="w-full flex flex-col">
|
|
57
|
+
<Formik<IbanExampleFormValues> initialValues={initialIbanExampleValues} onSubmit={handleSubmit}>
|
|
58
|
+
{(form) => (
|
|
59
|
+
<>
|
|
60
|
+
<div className="p-2">
|
|
61
|
+
<KolHeading _label="Formatted Form Field" _level={2} />
|
|
62
|
+
<KolForm>
|
|
63
|
+
<Field name="iban">
|
|
64
|
+
{({ field }: FieldProps<IbanExampleFormValues['iban']>) => (
|
|
65
|
+
<div className="block mt-2">
|
|
66
|
+
<KolInputText
|
|
67
|
+
onBlur={() => {
|
|
68
|
+
void form.setFieldTouched('iban', true);
|
|
69
|
+
}}
|
|
70
|
+
id="field-iban"
|
|
71
|
+
_label="IBAN"
|
|
72
|
+
_value={formatter.format(field.value ?? '')}
|
|
73
|
+
_msg={{
|
|
74
|
+
_type: 'error',
|
|
75
|
+
_description: form.errors.iban || '',
|
|
76
|
+
}}
|
|
77
|
+
_touched={form.touched.iban}
|
|
78
|
+
_required
|
|
79
|
+
_on={{
|
|
80
|
+
onInput: (event, value: unknown) => {
|
|
81
|
+
if (event.target) {
|
|
82
|
+
const parsed_value = formatter.parse((value as string) ?? '');
|
|
83
|
+
|
|
84
|
+
void form.setFieldValue('iban', parsed_value, true);
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
}}
|
|
88
|
+
/>
|
|
89
|
+
</div>
|
|
90
|
+
)}
|
|
91
|
+
</Field>
|
|
92
|
+
</KolForm>
|
|
93
|
+
</div>
|
|
94
|
+
<div className="p-2">
|
|
95
|
+
<KolHeading _label="Model" _level={2} />
|
|
96
|
+
<pre className="text-base">{JSON.stringify(form.values, null, 2)}</pre>
|
|
97
|
+
</div>
|
|
98
|
+
</>
|
|
99
|
+
)}
|
|
100
|
+
</Formik>
|
|
101
|
+
</section>
|
|
71
102
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
103
|
+
<section className="w-full flex flex-col">
|
|
104
|
+
<Formik<CurrencyExampleFormValues> initialValues={initialCurrencyExampleValues} onSubmit={handleSubmit}>
|
|
105
|
+
{(form) => (
|
|
106
|
+
<>
|
|
107
|
+
<div className="p-2">
|
|
108
|
+
<KolHeading _label="Formatted Form Field (with react-number-format)" _level={2} />
|
|
109
|
+
<KolForm>
|
|
110
|
+
<Field name="currency">
|
|
111
|
+
{({ field }: FieldProps<CurrencyExampleFormValues['currency']>) => (
|
|
112
|
+
<div className="block mt-2">
|
|
113
|
+
<NumericFormat
|
|
114
|
+
customInput={({ type, value, onBlur, onChange, onFocus, ...other }: any) => {
|
|
115
|
+
console.log('OTHER: ', other);
|
|
116
|
+
return <KolInputText _label="Currency" _type={type} _value={value} _on={{ onBlur, onChange, onFocus }} />;
|
|
117
|
+
}}
|
|
118
|
+
displayType="input"
|
|
119
|
+
value={typeof field.value === 'number' ? Number(field.value).toFixed(2) : undefined}
|
|
120
|
+
onBlur={() => {
|
|
121
|
+
void form.setFieldTouched('currency', true);
|
|
122
|
+
}}
|
|
123
|
+
onValueChange={(value: NumberFormatValues) => {
|
|
124
|
+
void form.setFieldValue('currency', value.floatValue, true);
|
|
125
|
+
}}
|
|
126
|
+
suffix={'€'}
|
|
127
|
+
thousandSeparator={true}
|
|
128
|
+
/>
|
|
129
|
+
</div>
|
|
130
|
+
)}
|
|
131
|
+
</Field>
|
|
132
|
+
</KolForm>
|
|
133
|
+
</div>
|
|
134
|
+
<div className="p-2">
|
|
135
|
+
<KolHeading _label="Model" _level={2} />
|
|
136
|
+
<pre className="text-base">{JSON.stringify(form.values, null, 2)}</pre>
|
|
137
|
+
</div>
|
|
138
|
+
</>
|
|
139
|
+
)}
|
|
140
|
+
</Formik>
|
|
141
|
+
</section>
|
|
89
142
|
</>
|
|
90
143
|
);
|
|
91
144
|
}
|
|
@@ -12,7 +12,6 @@ export const LinkImage: FC = () => (
|
|
|
12
12
|
|
|
13
13
|
<div className="grid gap-4">
|
|
14
14
|
<KolLink _href="#/back-page" _label="I am a link that is rendered as text" />
|
|
15
|
-
<br />
|
|
16
15
|
<KolLink _href="#/back-page" _label="">
|
|
17
16
|
<img alt="Presentation of the KoliBri theming" slot="expert" src="abgrenzung.jpg" width="300" />
|
|
18
17
|
</KolLink>
|
|
@@ -17,7 +17,7 @@ export const ModalBasic: FC = () => {
|
|
|
17
17
|
</p>
|
|
18
18
|
</SampleDescription>
|
|
19
19
|
|
|
20
|
-
<div>
|
|
20
|
+
<div className="flex">
|
|
21
21
|
<KolModal _label="Primary modal" _width="80%" ref={modalElement} _on={{ onClose: () => console.log('Modal closed') }}>
|
|
22
22
|
<KolCard _label="I am a modal.">
|
|
23
23
|
<KolButton
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
|
|
3
|
-
import { KolInputCheckbox, KolNav } from '@public-ui/react';
|
|
3
|
+
import { KolHeading, KolInputCheckbox, KolNav } from '@public-ui/react';
|
|
4
4
|
import { SampleDescription } from '../SampleDescription';
|
|
5
|
-
import { LINKS } from './links';
|
|
5
|
+
import { LINKS, LINKS_WITHOUT_SUBMENU } from './links';
|
|
6
6
|
|
|
7
7
|
import type { FC } from 'react';
|
|
8
8
|
export const NavBasic: FC = () => {
|
|
@@ -17,16 +17,27 @@ export const NavBasic: FC = () => {
|
|
|
17
17
|
</p>
|
|
18
18
|
</SampleDescription>
|
|
19
19
|
|
|
20
|
-
<
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
20
|
+
<section className="grid gap-8">
|
|
21
|
+
<section>
|
|
22
|
+
<KolInputCheckbox
|
|
23
|
+
_label="Show icons when expanded"
|
|
24
|
+
_checked={hasIconsWhenExpanded}
|
|
25
|
+
_on={{
|
|
26
|
+
onChange: (_event, value: unknown) => {
|
|
27
|
+
setHasIconsWhenExpanded(value as boolean);
|
|
28
|
+
},
|
|
29
|
+
}}
|
|
30
|
+
></KolInputCheckbox>
|
|
31
|
+
</section>
|
|
32
|
+
<section className="grid gap-4">
|
|
33
|
+
<KolHeading _level={2} _label="Navigation without submenu" />
|
|
34
|
+
<KolNav class="block w-fit" _label="Main navigation" _links={LINKS_WITHOUT_SUBMENU} _hasCompactButton _hasIconsWhenExpanded={hasIconsWhenExpanded} />
|
|
35
|
+
</section>
|
|
36
|
+
<section className="grid gap-4">
|
|
37
|
+
<KolHeading _level={2} _label="Navigation with submenu" />
|
|
38
|
+
<KolNav class="block w-fit" _label="Main navigation" _links={LINKS} _hasCompactButton _hasIconsWhenExpanded={hasIconsWhenExpanded} />
|
|
39
|
+
</section>
|
|
40
|
+
</section>
|
|
30
41
|
</>
|
|
31
42
|
);
|
|
32
43
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { KolNav } from '@public-ui/react';
|
|
2
|
+
import { KolHeading, KolNav } from '@public-ui/react';
|
|
3
3
|
import { SampleDescription } from '../SampleDescription';
|
|
4
|
-
import { LINKS } from './links';
|
|
4
|
+
import { LINKS, LINKS_WITHOUT_SUBMENU } from './links';
|
|
5
5
|
|
|
6
6
|
import type { FC } from 'react';
|
|
7
7
|
export const NavHorizontal: FC = () => (
|
|
@@ -10,6 +10,15 @@ export const NavHorizontal: FC = () => (
|
|
|
10
10
|
<p>This sample shows KolNav with horizontal alignment.</p>
|
|
11
11
|
</SampleDescription>
|
|
12
12
|
|
|
13
|
-
<
|
|
13
|
+
<section className="grid gap-8">
|
|
14
|
+
<section className="grid gap-4">
|
|
15
|
+
<KolHeading _level={2} _label="Navigation without submenu" />
|
|
16
|
+
<KolNav _label="Main navigation" _links={LINKS_WITHOUT_SUBMENU} _orientation="horizontal" />
|
|
17
|
+
</section>
|
|
18
|
+
<section className="grid gap-4">
|
|
19
|
+
<KolHeading _level={2} _label="Navigation with submenu" />
|
|
20
|
+
<KolNav _label="Main navigation" _links={LINKS} _orientation="horizontal" />
|
|
21
|
+
</section>
|
|
22
|
+
</section>
|
|
14
23
|
</>
|
|
15
24
|
);
|
|
@@ -92,3 +92,39 @@ export const LINKS: ButtonOrLinkOrTextWithChildrenProps[] = [
|
|
|
92
92
|
],
|
|
93
93
|
},
|
|
94
94
|
];
|
|
95
|
+
|
|
96
|
+
export const LINKS_WITHOUT_SUBMENU: ButtonOrLinkOrTextWithChildrenProps[] = [
|
|
97
|
+
{
|
|
98
|
+
_label: 'Homepage',
|
|
99
|
+
_icons: 'codicon codicon-home',
|
|
100
|
+
_on: {
|
|
101
|
+
onClick: () => console.log('Homepage clicked'),
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
_label: '2 Navigation point',
|
|
106
|
+
_href: '#/back-page',
|
|
107
|
+
_on: {
|
|
108
|
+
onClick: () => console.log('Link clicked'),
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
_label: '3 Navigation point',
|
|
113
|
+
_href: '#/back-page',
|
|
114
|
+
_icons: 'codicon codicon-home',
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
_label: '4 Navigation point with children and onClick',
|
|
118
|
+
_on: {
|
|
119
|
+
onClick: () => console.log('4.1 Nested link clicked'),
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
_label: '5 No own page, only category',
|
|
124
|
+
_active: true,
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
_label: '6 No own page, with icon',
|
|
128
|
+
_icons: 'codicon codicon-squirrel',
|
|
129
|
+
},
|
|
130
|
+
];
|
|
@@ -14,74 +14,76 @@ export const TableColumnAlignment: FC = () => (
|
|
|
14
14
|
<p>This sample shows KolTable with columns headers and data in different text alignments.</p>
|
|
15
15
|
</SampleDescription>
|
|
16
16
|
|
|
17
|
-
<
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
[
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
17
|
+
<section className="w-full flex flex-col">
|
|
18
|
+
<KolHeading _label="Simple table" _level={3}></KolHeading>
|
|
19
|
+
<KolTable
|
|
20
|
+
_label="Table for demonstration purposes with different text align properties"
|
|
21
|
+
_headers={{
|
|
22
|
+
horizontal: [
|
|
23
|
+
[
|
|
24
|
+
{ label: 'left', key: 'left', textAlign: 'left' },
|
|
25
|
+
{ label: 'center', key: 'center', textAlign: 'center' },
|
|
26
|
+
{ label: 'right', key: 'right', textAlign: 'right' },
|
|
27
|
+
],
|
|
26
28
|
],
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
/>
|
|
29
|
+
}}
|
|
30
|
+
_data={DATA}
|
|
31
|
+
className="block"
|
|
32
|
+
style={{ maxWidth: '600px' }}
|
|
33
|
+
/>
|
|
33
34
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
35
|
+
<KolHeading _label="Table with sortable columns" _level={3} className="block mt-6"></KolHeading>
|
|
36
|
+
<KolTable
|
|
37
|
+
_label="Table for demonstration purposes with sortable columns"
|
|
38
|
+
_headers={{
|
|
39
|
+
horizontal: [
|
|
40
|
+
[
|
|
41
|
+
{ label: 'left', key: 'left', textAlign: 'left', sort: genericNonSorter },
|
|
42
|
+
{ label: 'center', key: 'center', textAlign: 'center', sort: genericNonSorter },
|
|
43
|
+
{ label: 'right', key: 'right', textAlign: 'right', sort: genericNonSorter },
|
|
44
|
+
],
|
|
43
45
|
],
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
/>
|
|
46
|
+
}}
|
|
47
|
+
_data={DATA}
|
|
48
|
+
className="block"
|
|
49
|
+
style={{ maxWidth: '600px' }}
|
|
50
|
+
/>
|
|
50
51
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
52
|
+
<KolHeading _label="Table some sortable columns" _level={3} className="block mt-6"></KolHeading>
|
|
53
|
+
<KolTable
|
|
54
|
+
_label="Table for demonstration purposes with some but not all columns sortable"
|
|
55
|
+
_headers={{
|
|
56
|
+
horizontal: [
|
|
57
|
+
[
|
|
58
|
+
{ label: 'left', key: 'left', textAlign: 'left', sort: genericNonSorter },
|
|
59
|
+
{ label: 'center', key: 'center', textAlign: 'center', sort: genericNonSorter },
|
|
60
|
+
{ label: 'right', key: 'right', textAlign: 'right' },
|
|
61
|
+
],
|
|
60
62
|
],
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
/>
|
|
63
|
+
}}
|
|
64
|
+
_data={DATA}
|
|
65
|
+
className="block"
|
|
66
|
+
style={{ maxWidth: '600px' }}
|
|
67
|
+
/>
|
|
67
68
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
69
|
+
<KolHeading _label="Table with vertical heading" _level={3} className="block mt-6"></KolHeading>
|
|
70
|
+
<KolTable
|
|
71
|
+
_label="Table for demonstration purposes with vertical heading"
|
|
72
|
+
_headers={{
|
|
73
|
+
horizontal: [
|
|
74
|
+
[
|
|
75
|
+
{ label: '', asTd: true },
|
|
76
|
+
{ label: 'left', key: 'left', textAlign: 'left' },
|
|
77
|
+
{ label: 'center', key: 'center', textAlign: 'center' },
|
|
78
|
+
{ label: 'right', key: 'right', textAlign: 'right' },
|
|
79
|
+
],
|
|
78
80
|
],
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
81
|
+
vertical: [[{ label: 'Vertical' }]],
|
|
82
|
+
}}
|
|
83
|
+
_data={DATA}
|
|
84
|
+
className="block"
|
|
85
|
+
style={{ maxWidth: '600px' }}
|
|
86
|
+
/>
|
|
87
|
+
</section>
|
|
86
88
|
</>
|
|
87
89
|
);
|