@public-ui/sample-react 4.3.1-rc.0 → 4.3.1-rc.4
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/package.json +10 -10
- package/src/App.tsx +2 -0
- package/src/components/InputEventValueDemo.tsx +6 -3
- package/src/components/SampleBlock.tsx +81 -0
- package/src/components/SampleGroup.tsx +27 -0
- package/src/components/abbr/basic.tsx +6 -3
- package/src/components/accordion/basic.tsx +3 -2
- package/src/components/accordion/headlines.tsx +3 -2
- package/src/components/alert/basic.tsx +17 -14
- package/src/components/avatar/basic.tsx +3 -2
- package/src/components/avatar/size.tsx +3 -2
- package/src/components/badge/basic.tsx +48 -7
- package/src/components/badge/routes.ts +0 -4
- package/src/components/breadcrumb/basic.tsx +3 -2
- package/src/components/button/access-key.tsx +8 -10
- package/src/components/button/aria-description.tsx +4 -4
- package/src/components/button/baselined.tsx +4 -4
- package/src/components/button/basic.tsx +10 -17
- package/src/components/button/disabled.tsx +6 -7
- package/src/components/button/expert-slot.tsx +6 -7
- package/src/components/button/focus-options.tsx +8 -10
- package/src/components/button/hide-label.tsx +8 -10
- package/src/components/button/icons.tsx +12 -16
- package/src/components/button/row-reverse-tooltip.tsx +4 -4
- package/src/components/button/short-key.tsx +15 -20
- package/src/components/button/spinner.tsx +6 -7
- package/src/components/button/variants.tsx +6 -6
- package/src/components/button/width.tsx +6 -7
- package/src/components/button-link/aria-description.tsx +3 -2
- package/src/components/button-link/basic.tsx +37 -35
- package/src/components/button-link/icons.tsx +13 -2
- package/src/components/button-link/image.tsx +3 -2
- package/src/components/card/basic.tsx +3 -2
- package/src/components/card/headlines.tsx +3 -2
- package/src/components/card/linked.tsx +3 -2
- package/src/components/combobox/partials/cases.tsx +40 -14
- package/src/components/combobox/partials/variants.tsx +7 -8
- package/src/components/details/basic.tsx +3 -2
- package/src/components/form/basic.tsx +5 -4
- package/src/components/form/error-list-scroll.tsx +87 -0
- package/src/components/form/error-list.tsx +56 -56
- package/src/components/form/routes.ts +2 -0
- package/src/components/heading/badged.tsx +3 -2
- package/src/components/heading/basic.tsx +3 -2
- package/src/components/heading/paragraph.tsx +3 -2
- package/src/components/heading/secondary.tsx +3 -2
- package/src/components/icon/all-kolicons.tsx +1 -1
- package/src/components/icon/basic.tsx +6 -6
- package/src/components/icon/font.tsx +21 -13
- package/src/components/image/basic.tsx +8 -5
- package/src/components/input-checkbox/partials/cases.tsx +75 -14
- package/src/components/input-checkbox/partials/variants.tsx +13 -16
- package/src/components/input-color/partials/cases.tsx +61 -18
- package/src/components/input-color/partials/variants.tsx +7 -8
- package/src/components/input-date/partials/cases.tsx +70 -26
- package/src/components/input-date/partials/minMax.tsx +38 -11
- package/src/components/input-date/partials/variants.tsx +10 -12
- package/src/components/input-email/partials/cases.tsx +69 -30
- package/src/components/input-email/partials/variants.tsx +7 -8
- package/src/components/input-file/partials/cases.tsx +58 -24
- package/src/components/input-file/partials/variants.tsx +7 -8
- package/src/components/input-number/number-formatter.tsx +5 -4
- package/src/components/input-number/partials/cases.tsx +68 -28
- package/src/components/input-number/partials/variants.tsx +7 -8
- package/src/components/input-password/partials/cases.tsx +67 -30
- package/src/components/input-password/partials/variants.tsx +7 -8
- package/src/components/input-password/show-password.tsx +22 -19
- package/src/components/input-radio/horizontal.tsx +3 -2
- package/src/components/input-radio/objectValue.tsx +5 -4
- package/src/components/input-radio/partials/cases.tsx +85 -55
- package/src/components/input-radio/partials/variants.tsx +7 -9
- package/src/components/input-range/partials/cases.tsx +60 -23
- package/src/components/input-range/partials/variants.tsx +7 -8
- package/src/components/input-text/access-short-key.tsx +11 -4
- package/src/components/input-text/aria-details.tsx +3 -2
- package/src/components/input-text/background-test.tsx +7 -5
- package/src/components/input-text/basic.tsx +24 -5
- package/src/components/input-text/clear-button.tsx +26 -0
- package/src/components/input-text/counter.tsx +3 -2
- package/src/components/input-text/disabled.tsx +11 -4
- package/src/components/input-text/expert-slot.tsx +13 -8
- package/src/components/input-text/hide-label.tsx +7 -6
- package/src/components/input-text/hide-msg.tsx +5 -4
- package/src/components/input-text/message-types.tsx +13 -4
- package/src/components/input-text/msg-and-counter.tsx +9 -4
- package/src/components/input-text/pattern.tsx +18 -15
- package/src/components/input-text/placeholder.tsx +13 -4
- package/src/components/input-text/readonly.tsx +11 -4
- package/src/components/input-text/routes.ts +2 -0
- package/src/components/input-text/select-range.tsx +3 -2
- package/src/components/input-text/smart-button.tsx +7 -4
- package/src/components/input-text/text-formatter.tsx +5 -4
- package/src/components/input-text/variant.tsx +8 -6
- package/src/components/kolibri/basic.tsx +9 -6
- package/src/components/link/basic.tsx +3 -2
- package/src/components/link/icons.tsx +3 -2
- package/src/components/link/image.tsx +3 -2
- package/src/components/link/target.tsx +3 -2
- package/src/components/link/variant.tsx +5 -4
- package/src/components/link-button/aria-description.tsx +7 -1
- package/src/components/link-button/basic.tsx +5 -4
- package/src/components/link-button/routes.ts +2 -0
- package/src/components/link-button/target.tsx +19 -0
- package/src/components/meter/basic.tsx +4 -4
- package/src/components/meter/dynamic.tsx +4 -4
- package/src/components/meter/optimum.tsx +8 -10
- package/src/components/meter/orientation.tsx +6 -7
- package/src/components/nav/aria-current.tsx +18 -15
- package/src/components/nav/basic.tsx +8 -10
- package/src/components/pagination/basic.tsx +3 -2
- package/src/components/pagination/button-visibility.tsx +16 -11
- package/src/components/pagination/sibling-boundary.tsx +3 -2
- package/src/components/popover-button/inline.tsx +4 -5
- package/src/components/progress/basic.tsx +7 -6
- package/src/components/quote/basic.tsx +4 -1
- package/src/components/quote/block.tsx +9 -6
- package/src/components/select/partials/cases.tsx +73 -33
- package/src/components/select/partials/variants.tsx +7 -8
- package/src/components/single-select/partials/cases.tsx +148 -114
- package/src/components/single-select/partials/variants.tsx +7 -8
- package/src/components/spin/basic.tsx +34 -3
- package/src/components/spin/routes.ts +0 -8
- package/src/components/split-button/basic.tsx +3 -2
- package/src/components/table/action-columns.tsx +3 -2
- package/src/components/table/column-alignment.tsx +3 -2
- package/src/components/table/complex-headers.tsx +3 -2
- package/src/components/table/empty.tsx +31 -0
- package/src/components/table/horizontal-scrollbar.tsx +24 -19
- package/src/components/table/multi-sort.tsx +6 -7
- package/src/components/table/non-hidable-columns.tsx +18 -15
- package/src/components/table/pagination-position.tsx +8 -10
- package/src/components/table/routes.ts +4 -0
- package/src/components/table/sort-data.tsx +6 -7
- package/src/components/table/stateful-async.tsx +50 -0
- package/src/components/table/stateful-with-selection.tsx +3 -2
- package/src/components/table/stateful-with-single-selection.tsx +3 -2
- package/src/components/table/stateless-async-paging.tsx +9 -32
- package/src/components/table/stateless-with-selection.tsx +3 -2
- package/src/components/table/stateless-with-single-selection.tsx +3 -2
- package/src/components/table/stateless.tsx +3 -2
- package/src/components/table/sticky-col.tsx +12 -10
- package/src/components/table/sticky-header.tsx +12 -10
- package/src/components/table/variant.tsx +5 -4
- package/src/components/table/with-footer.tsx +73 -70
- package/src/components/table/with-pagination.tsx +3 -2
- package/src/components/tabs/basic.tsx +17 -12
- package/src/components/tabs/create-button.tsx +11 -8
- package/src/components/tabs/icons-only.tsx +9 -6
- package/src/components/textarea/adjust-height.tsx +6 -3
- package/src/components/textarea/partials/cases.tsx +63 -15
- package/src/components/textarea/partials/variants.tsx +7 -8
- package/src/components/textarea/resize.tsx +3 -2
- package/src/components/textarea/rows.tsx +6 -3
- package/src/components/textarea/with-counter.tsx +3 -2
- package/src/components/toolbar/basic.tsx +6 -5
- package/src/components/toolbar/disabled.tsx +41 -38
- package/src/components/tree/basic.tsx +32 -29
- package/src/components/version/basic.tsx +4 -1
- package/src/components/version/context.tsx +8 -5
- package/src/hooks/useVisualBlockOutline.ts +38 -0
- package/src/scenarios/button-shortkey-table.tsx +4 -4
- package/src/scenarios/routes.ts +2 -0
- package/src/scenarios/same-height-of-all-form-elements-with-label.tsx +46 -0
- package/src/shares/store.ts +0 -4
- package/src/shares/visualBlockOutline.ts +75 -0
- package/src/components/badge/button.tsx +0 -35
- package/src/components/badge/formatted-label.tsx +0 -19
- package/src/components/spin/custom.tsx +0 -23
- package/src/components/spin/cycle.tsx +0 -16
- package/src/components/spin/label.tsx +0 -23
- package/src/components/spin/variables.tsx +0 -16
|
@@ -3,40 +3,77 @@ import { KolInputPassword } from '@public-ui/react-v19';
|
|
|
3
3
|
import React, { forwardRef } from 'react';
|
|
4
4
|
|
|
5
5
|
import { ERROR_MSG, HINT_MSG } from '../../../shares/constants';
|
|
6
|
+
import { SampleBlock } from '../../SampleBlock';
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
type InputPasswordCasesProps = Components.KolInputPassword & {
|
|
9
|
+
/** Prefixes the visual block ids so the same cases can be rendered more than once per route. */
|
|
10
|
+
blockIdPrefix: string;
|
|
11
|
+
/**
|
|
12
|
+
* Restricts the snapshots of this rendering to the case with this id; every other block is
|
|
13
|
+
* rendered with `skipSnapshot`. Used for the `_hideLabel` groups: hiding the label mainly
|
|
14
|
+
* changes how the message is laid out, so snapshotting every case a second time would only
|
|
15
|
+
* duplicate the labelled group.
|
|
16
|
+
*/
|
|
17
|
+
snapshotOnly?: string;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const InputPasswordCases = forwardRef<HTMLKolInputPasswordElement, InputPasswordCasesProps>(function InputPasswordCases(
|
|
21
|
+
{ blockIdPrefix, snapshotOnly, ...props },
|
|
22
|
+
ref,
|
|
23
|
+
) {
|
|
24
|
+
// Blocks outside `snapshotOnly` stay visible in the sample but are excluded from the snapshots.
|
|
25
|
+
const block = (caseId: string) => ({ id: `${blockIdPrefix}-${caseId}`, skipSnapshot: snapshotOnly !== undefined && caseId !== snapshotOnly });
|
|
8
26
|
return (
|
|
9
27
|
<div className="grid gap-4">
|
|
10
|
-
<
|
|
28
|
+
<SampleBlock {...block('black-bg')} className="black-background">
|
|
11
29
|
<KolInputPassword {...props} _label="Passwort (Black background test)" />
|
|
12
|
-
</
|
|
13
|
-
<
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
<
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
<
|
|
39
|
-
|
|
30
|
+
</SampleBlock>
|
|
31
|
+
<SampleBlock {...block('icons-error')}>
|
|
32
|
+
<KolInputPassword
|
|
33
|
+
{...props}
|
|
34
|
+
ref={ref}
|
|
35
|
+
_accessKey="P"
|
|
36
|
+
_required
|
|
37
|
+
_hint={HINT_MSG}
|
|
38
|
+
_msg={{ _type: 'error', _description: ERROR_MSG }}
|
|
39
|
+
_placeholder="Mit Icons"
|
|
40
|
+
_label="Passwort"
|
|
41
|
+
_icons={{
|
|
42
|
+
left: {
|
|
43
|
+
icon: 'kolicon-chevron-left',
|
|
44
|
+
},
|
|
45
|
+
right: {
|
|
46
|
+
icon: 'kolicon-chevron-right',
|
|
47
|
+
},
|
|
48
|
+
}}
|
|
49
|
+
_touched
|
|
50
|
+
_infoPopover={{ _label: 'hint', _content: 'Ich bin ein Hinweis.', _icons: 'kolicon-alert-info' }}
|
|
51
|
+
/>
|
|
52
|
+
</SampleBlock>
|
|
53
|
+
<SampleBlock {...block('msg-info')}>
|
|
54
|
+
<KolInputPassword {...props} _msg={{ _type: 'info', _description: 'Just a hint' }} _label="Passwort" _touched />
|
|
55
|
+
</SampleBlock>
|
|
56
|
+
<SampleBlock {...block('msg-warning')}>
|
|
57
|
+
<KolInputPassword {...props} _msg={{ _type: 'warning', _description: 'Small warning' }} _label="Passwort" _touched />
|
|
58
|
+
</SampleBlock>
|
|
59
|
+
<SampleBlock {...block('msg-success')}>
|
|
60
|
+
<KolInputPassword {...props} _msg={{ _type: 'success', _description: 'Success message' }} _label="Passwort" _touched />
|
|
61
|
+
</SampleBlock>
|
|
62
|
+
<SampleBlock {...block('msg-default')}>
|
|
63
|
+
<KolInputPassword {...props} _msg={{ _type: 'default', _description: 'Default message' }} _label="Passwort" _touched />
|
|
64
|
+
</SampleBlock>
|
|
65
|
+
<SampleBlock {...block('disabled')}>
|
|
66
|
+
<KolInputPassword {...props} _disabled _msg={{ _type: 'error', _description: ERROR_MSG }} _label="Passwort (Disabled)" _touched />
|
|
67
|
+
</SampleBlock>
|
|
68
|
+
<SampleBlock {...block('readonly')}>
|
|
69
|
+
<KolInputPassword {...props} _readOnly _label="Passwort (Readonly)" />
|
|
70
|
+
</SampleBlock>
|
|
71
|
+
<SampleBlock {...block('access-key')}>
|
|
72
|
+
<KolInputPassword {...props} ref={ref} _shortKey="c" _label="With access key" />
|
|
73
|
+
</SampleBlock>
|
|
74
|
+
<SampleBlock {...block('short-key')}>
|
|
75
|
+
<KolInputPassword {...props} ref={ref} _shortKey="s" _label="With short key" />
|
|
76
|
+
</SampleBlock>
|
|
40
77
|
</div>
|
|
41
78
|
);
|
|
42
79
|
});
|
|
@@ -4,17 +4,16 @@ import { InputPasswordCases } from './cases';
|
|
|
4
4
|
|
|
5
5
|
import type { Components } from '@public-ui/components';
|
|
6
6
|
import { SampleColumns } from '../../SampleColumns';
|
|
7
|
+
import { SampleGroup } from '../../SampleGroup';
|
|
7
8
|
export const InputPasswordVariants = forwardRef<HTMLKolInputPasswordElement, Components.KolInputPassword>(function InputPasswordVariant(props, ref) {
|
|
8
9
|
return (
|
|
9
10
|
<SampleColumns>
|
|
10
|
-
<
|
|
11
|
-
<
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
<InputPasswordCases ref={ref} {...props} _hideLabel />
|
|
17
|
-
</fieldset>
|
|
11
|
+
<SampleGroup heading="Password">
|
|
12
|
+
<InputPasswordCases blockIdPrefix="label" {...props} />
|
|
13
|
+
</SampleGroup>
|
|
14
|
+
<SampleGroup heading="Password (hideLabel)">
|
|
15
|
+
<InputPasswordCases blockIdPrefix="hide-label" snapshotOnly="icons-error" ref={ref} {...props} _hideLabel />
|
|
16
|
+
</SampleGroup>
|
|
18
17
|
</SampleColumns>
|
|
19
18
|
);
|
|
20
19
|
});
|
|
@@ -2,6 +2,7 @@ import type { FC } from 'react';
|
|
|
2
2
|
import React, { useRef } from 'react';
|
|
3
3
|
|
|
4
4
|
import { KolForm, KolInputPassword } from '@public-ui/react-v19';
|
|
5
|
+
import { SampleBlock } from '../SampleBlock';
|
|
5
6
|
import { SampleDescription } from '../SampleDescription';
|
|
6
7
|
|
|
7
8
|
export const InputPasswordShowPassword: FC = () => {
|
|
@@ -16,25 +17,27 @@ export const InputPasswordShowPassword: FC = () => {
|
|
|
16
17
|
</p>
|
|
17
18
|
</SampleDescription>
|
|
18
19
|
|
|
19
|
-
<
|
|
20
|
-
<
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
20
|
+
<SampleBlock id="show-password">
|
|
21
|
+
<KolForm className="w-full">
|
|
22
|
+
<KolInputPassword _placeholder="With 'Show password' button" _label="Password" ref={passwordRef} className="block" _visibilityToggle={true} />
|
|
23
|
+
<KolInputPassword
|
|
24
|
+
_placeholder="With 'Show password' button"
|
|
25
|
+
_label="Password"
|
|
26
|
+
ref={passwordRef}
|
|
27
|
+
className="block"
|
|
28
|
+
_visibilityToggle={true}
|
|
29
|
+
_value="Password"
|
|
30
|
+
/>
|
|
31
|
+
<KolInputPassword
|
|
32
|
+
_placeholder="With 'Show password' button and disabled"
|
|
33
|
+
_label="Password"
|
|
34
|
+
ref={passwordRef}
|
|
35
|
+
className="block"
|
|
36
|
+
_disabled
|
|
37
|
+
_visibilityToggle={true}
|
|
38
|
+
/>
|
|
39
|
+
</KolForm>
|
|
40
|
+
</SampleBlock>
|
|
38
41
|
</>
|
|
39
42
|
);
|
|
40
43
|
};
|
|
@@ -3,6 +3,7 @@ import React, { useState } from 'react';
|
|
|
3
3
|
|
|
4
4
|
import { KolButton, KolForm, KolInputCheckbox, KolInputRadio } from '@public-ui/react-v19';
|
|
5
5
|
|
|
6
|
+
import { SampleBlock } from '../SampleBlock';
|
|
6
7
|
import { SampleDescription } from '../SampleDescription';
|
|
7
8
|
|
|
8
9
|
import type { OrientationPropType } from '@public-ui/components';
|
|
@@ -37,10 +38,10 @@ export const InputRadioHorizontal: FC = () => {
|
|
|
37
38
|
</div>
|
|
38
39
|
{show && (
|
|
39
40
|
<KolForm>
|
|
40
|
-
<
|
|
41
|
+
<SampleBlock id="orientation" className="container my-4 d-grid gap-4">
|
|
41
42
|
<KolInputRadio _label={`Test (${orientation})`} _options={options} _orientation={orientation} _required />
|
|
42
43
|
<KolInputRadio _hideLabel _label={`Test (${orientation})`} _options={options} _orientation={orientation} _required />
|
|
43
|
-
</
|
|
44
|
+
</SampleBlock>
|
|
44
45
|
</KolForm>
|
|
45
46
|
)}
|
|
46
47
|
</div>
|
|
@@ -3,6 +3,7 @@ import React from 'react';
|
|
|
3
3
|
|
|
4
4
|
import { KolForm, KolInputRadio } from '@public-ui/react-v19';
|
|
5
5
|
|
|
6
|
+
import { SampleBlock } from '../SampleBlock';
|
|
6
7
|
import { SampleDescription } from '../SampleDescription';
|
|
7
8
|
|
|
8
9
|
export const InputRadioObjectValue: FC = () => {
|
|
@@ -21,16 +22,16 @@ export const InputRadioObjectValue: FC = () => {
|
|
|
21
22
|
<p>
|
|
22
23
|
In this example for <code>KolInputRadio</code>, the values of the options are defined as objects.
|
|
23
24
|
</p>
|
|
24
|
-
<
|
|
25
|
+
<SampleBlock id="object-value" className="container my-4 d-grid gap-4">
|
|
25
26
|
<KolInputRadio _value={options[1].value} _options={options} _label="Test (with object value)" />
|
|
26
|
-
</
|
|
27
|
+
</SampleBlock>
|
|
27
28
|
|
|
28
29
|
<p>
|
|
29
30
|
In this example for <code>KolInputRadio</code>, no value is set.
|
|
30
31
|
</p>
|
|
31
|
-
<
|
|
32
|
+
<SampleBlock id="no-value" className="container my-4 d-grid gap-4">
|
|
32
33
|
<KolInputRadio _options={options} _label="Test (without value)" />
|
|
33
|
-
</
|
|
34
|
+
</SampleBlock>
|
|
34
35
|
</KolForm>
|
|
35
36
|
</div>
|
|
36
37
|
);
|
|
@@ -5,68 +5,98 @@ import { KolInputRadio } from '@public-ui/react-v19';
|
|
|
5
5
|
import { ERROR_MSG, HINT_MSG } from '../../../shares/constants';
|
|
6
6
|
|
|
7
7
|
import type { Components } from '@public-ui/components';
|
|
8
|
-
|
|
8
|
+
import { SampleBlock } from '../../SampleBlock';
|
|
9
|
+
|
|
10
|
+
type InputRadioCasesProps = Components.KolInputRadio & {
|
|
11
|
+
/** Prefixes the visual block ids so the same cases can be rendered more than once per route. */
|
|
12
|
+
blockIdPrefix: string;
|
|
13
|
+
/**
|
|
14
|
+
* Restricts the snapshots of this rendering to the case with this id; every other block is
|
|
15
|
+
* rendered with `skipSnapshot`. Used for the `_hideLabel` groups: hiding the label mainly
|
|
16
|
+
* changes how the message is laid out, so snapshotting every case a second time would only
|
|
17
|
+
* duplicate the labelled group.
|
|
18
|
+
*/
|
|
19
|
+
snapshotOnly?: string;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const InputRadioCases = forwardRef<HTMLKolInputRadioElement, InputRadioCasesProps>(function InputRadioCases(
|
|
23
|
+
{ blockIdPrefix, snapshotOnly, ...props },
|
|
24
|
+
ref,
|
|
25
|
+
) {
|
|
26
|
+
// Blocks outside `snapshotOnly` stay visible in the sample but are excluded from the snapshots.
|
|
27
|
+
const block = (caseId: string) => ({ id: `${blockIdPrefix}-${caseId}`, skipSnapshot: snapshotOnly !== undefined && caseId !== snapshotOnly });
|
|
9
28
|
return (
|
|
10
29
|
<div className="grid gap-4">
|
|
11
|
-
<
|
|
30
|
+
<SampleBlock {...block('black-bg')} className="black-background">
|
|
12
31
|
<KolInputRadio
|
|
13
32
|
{...props}
|
|
14
33
|
_options="[{'disabled':true,'label':'Mrs. (disabled)','value':'Mrs.'},{'label':'Mr.'},{'label':'Company','value':'Company'}]"
|
|
15
34
|
_label="Salutation (Black background test)"
|
|
16
35
|
/>
|
|
17
|
-
</
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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
|
-
|
|
36
|
+
</SampleBlock>
|
|
37
|
+
<SampleBlock {...block('error')}>
|
|
38
|
+
<KolInputRadio
|
|
39
|
+
{...props}
|
|
40
|
+
_required
|
|
41
|
+
_msg={{ _type: 'error', _description: ERROR_MSG }}
|
|
42
|
+
_touched
|
|
43
|
+
_value="Company"
|
|
44
|
+
_options="[{'label':'Mrs.','value':'Mrs.'},{'disabled':true,'label':'Mr. (disabled)','value':'Mr.'},{'label':'Company','value':'Company'}]"
|
|
45
|
+
_label="Salutation (with error)"
|
|
46
|
+
/>
|
|
47
|
+
</SampleBlock>
|
|
48
|
+
<SampleBlock {...block('horizontal')}>
|
|
49
|
+
<KolInputRadio
|
|
50
|
+
{...props}
|
|
51
|
+
ref={ref}
|
|
52
|
+
_orientation="horizontal"
|
|
53
|
+
_required
|
|
54
|
+
_value="Company"
|
|
55
|
+
_options="[{'label':'Mrs.','value':'Mrs.'},{'disabled':true,'label':'Mr. (disabled)'},{'label':'Company','value':'Company'}]"
|
|
56
|
+
_label="Salutation (horizontal)"
|
|
57
|
+
_infoPopover={{ _label: 'hint', _content: 'Ich bin ein Hinweis.', _icons: 'kolicon-alert-info' }}
|
|
58
|
+
/>
|
|
59
|
+
</SampleBlock>
|
|
60
|
+
<SampleBlock {...block('horizontal-disabled')}>
|
|
61
|
+
<KolInputRadio
|
|
62
|
+
{...props}
|
|
63
|
+
_disabled
|
|
64
|
+
_orientation="horizontal"
|
|
65
|
+
_required
|
|
66
|
+
_msg={{ _type: 'error', _description: ERROR_MSG }}
|
|
67
|
+
_touched
|
|
68
|
+
_value="Company"
|
|
69
|
+
_options="[{'label':'Mrs.','value':'Mrs.'},{'disabled':true,'label':'Mr. (disabled)'},{'label':'Company','value':'Company'}]"
|
|
70
|
+
_label="Salutation (horizontal with error)"
|
|
71
|
+
/>
|
|
72
|
+
</SampleBlock>
|
|
73
|
+
<SampleBlock {...block('disabled')}>
|
|
74
|
+
<KolInputRadio
|
|
75
|
+
{...props}
|
|
76
|
+
_disabled
|
|
77
|
+
_value="Company"
|
|
78
|
+
_options="[{'label':'Mrs.','value':'Mrs.'},{'disabled':true,'label':'Mr. (disabled)'},{'label':'Company','value':'Company'}]"
|
|
79
|
+
_label="Salutation"
|
|
80
|
+
_touched
|
|
81
|
+
/>
|
|
82
|
+
</SampleBlock>
|
|
83
|
+
<SampleBlock {...block('horizontal-hints')}>
|
|
84
|
+
<KolInputRadio
|
|
85
|
+
{...props}
|
|
86
|
+
_orientation="horizontal"
|
|
87
|
+
_required
|
|
88
|
+
_msg={{ _type: 'error', _description: ERROR_MSG }}
|
|
89
|
+
_touched
|
|
90
|
+
_value="Company"
|
|
91
|
+
_options={[
|
|
92
|
+
{ label: 'Mrs.', value: 'Mrs.', hint: 'Description for option "Mrs."' },
|
|
93
|
+
{ label: 'Mr. (disabled)', value: 'Mr.', hint: 'Description for option "Mr."', disabled: true },
|
|
94
|
+
{ label: 'Company', value: 'Company', hint: 'Description for option "Company"' },
|
|
95
|
+
]}
|
|
96
|
+
_label="Salutation (horizontal with error hint and description)"
|
|
97
|
+
_hint={HINT_MSG}
|
|
98
|
+
/>
|
|
99
|
+
</SampleBlock>
|
|
70
100
|
</div>
|
|
71
101
|
);
|
|
72
102
|
});
|
|
@@ -3,20 +3,18 @@ import React, { forwardRef } from 'react';
|
|
|
3
3
|
import { InputRadioCases } from './cases';
|
|
4
4
|
|
|
5
5
|
import type { Components } from '@public-ui/components';
|
|
6
|
-
import { KolHeading } from '@public-ui/react-v19';
|
|
7
6
|
import { SampleColumns } from '../../SampleColumns';
|
|
7
|
+
import { SampleGroup } from '../../SampleGroup';
|
|
8
8
|
|
|
9
9
|
export const InputRadioVariants = forwardRef<HTMLKolInputRadioElement, Components.KolInputRadio>(function InputRadioVariant(props, ref) {
|
|
10
10
|
return (
|
|
11
11
|
<SampleColumns>
|
|
12
|
-
<
|
|
13
|
-
<
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
<InputRadioCases ref={ref} {...props} _hideLabel />
|
|
19
|
-
</div>
|
|
12
|
+
<SampleGroup heading="Radio">
|
|
13
|
+
<InputRadioCases blockIdPrefix="label" {...props} />
|
|
14
|
+
</SampleGroup>
|
|
15
|
+
<SampleGroup heading="Radio (hideLabel)">
|
|
16
|
+
<InputRadioCases blockIdPrefix="hide-label" snapshotOnly="error" ref={ref} {...props} _hideLabel />
|
|
17
|
+
</SampleGroup>
|
|
20
18
|
</SampleColumns>
|
|
21
19
|
);
|
|
22
20
|
});
|
|
@@ -3,11 +3,29 @@ import { KolInputRange } from '@public-ui/react-v19';
|
|
|
3
3
|
import React, { forwardRef } from 'react';
|
|
4
4
|
|
|
5
5
|
import { ERROR_MSG, HINT_MSG } from '../../../shares/constants';
|
|
6
|
+
import { SampleBlock } from '../../SampleBlock';
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
type InputRangeCasesProps = Components.KolInputRange & {
|
|
9
|
+
/** Prefixes the visual block ids so the same cases can be rendered more than once per route. */
|
|
10
|
+
blockIdPrefix: string;
|
|
11
|
+
/**
|
|
12
|
+
* Restricts the snapshots of this rendering to the case with this id; every other block is
|
|
13
|
+
* rendered with `skipSnapshot`. Used for the `_hideLabel` groups: hiding the label mainly
|
|
14
|
+
* changes how the message is laid out, so snapshotting every case a second time would only
|
|
15
|
+
* duplicate the labelled group.
|
|
16
|
+
*/
|
|
17
|
+
snapshotOnly?: string;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const InputRangeCases = forwardRef<HTMLKolInputRangeElement, InputRangeCasesProps>(function InputRangeCases(
|
|
21
|
+
{ blockIdPrefix, snapshotOnly, ...props },
|
|
22
|
+
ref,
|
|
23
|
+
) {
|
|
24
|
+
// Blocks outside `snapshotOnly` stay visible in the sample but are excluded from the snapshots.
|
|
25
|
+
const block = (caseId: string) => ({ id: `${blockIdPrefix}-${caseId}`, skipSnapshot: snapshotOnly !== undefined && caseId !== snapshotOnly });
|
|
8
26
|
return (
|
|
9
27
|
<div className="grid gap-4">
|
|
10
|
-
<
|
|
28
|
+
<SampleBlock {...block('black-bg')} className="black-background">
|
|
11
29
|
<KolInputRange
|
|
12
30
|
{...props}
|
|
13
31
|
_min={0}
|
|
@@ -24,27 +42,46 @@ export const InputRangeCases = forwardRef<HTMLKolInputRangeElement, Components.K
|
|
|
24
42
|
}}
|
|
25
43
|
_touched
|
|
26
44
|
/>
|
|
27
|
-
</
|
|
28
|
-
<
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
<
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
<
|
|
47
|
-
|
|
45
|
+
</SampleBlock>
|
|
46
|
+
<SampleBlock {...block('error')}>
|
|
47
|
+
<KolInputRange
|
|
48
|
+
{...props}
|
|
49
|
+
ref={ref}
|
|
50
|
+
_accessKey="F"
|
|
51
|
+
_min={0}
|
|
52
|
+
_max={50}
|
|
53
|
+
_step={10}
|
|
54
|
+
_hint={HINT_MSG}
|
|
55
|
+
_msg={{ _type: 'error', _description: ERROR_MSG }}
|
|
56
|
+
_label="Slider with error"
|
|
57
|
+
_touched
|
|
58
|
+
_infoPopover={{ _label: 'hint', _content: 'Ich bin ein Hinweis.', _icons: 'kolicon-alert-info' }}
|
|
59
|
+
/>
|
|
60
|
+
</SampleBlock>
|
|
61
|
+
<SampleBlock {...block('msg-info')}>
|
|
62
|
+
<KolInputRange {...props} _msg={{ _type: 'info', _description: 'Just a hint' }} _label="Slider" _touched />
|
|
63
|
+
</SampleBlock>
|
|
64
|
+
<SampleBlock {...block('msg-warning')}>
|
|
65
|
+
<KolInputRange {...props} _msg={{ _type: 'warning', _description: 'Small warning' }} _label="Slider" _touched />
|
|
66
|
+
</SampleBlock>
|
|
67
|
+
<SampleBlock {...block('msg-success')}>
|
|
68
|
+
<KolInputRange {...props} _msg={{ _type: 'success', _description: 'Success message' }} _label="Slider" _touched />
|
|
69
|
+
</SampleBlock>
|
|
70
|
+
<SampleBlock {...block('msg-default')}>
|
|
71
|
+
<KolInputRange {...props} _msg={{ _type: 'default', _description: 'Default message' }} _label="Slider" _touched />
|
|
72
|
+
</SampleBlock>
|
|
73
|
+
<SampleBlock {...block('disabled')}>
|
|
74
|
+
<KolInputRange {...props} _disabled _min={0} _max={50} _label="Slider (disabled)" />
|
|
75
|
+
</SampleBlock>
|
|
76
|
+
<SampleBlock {...block('access-key')}>
|
|
77
|
+
<KolInputRange {...props} _min={0} _max={50} _label="With access key" _accessKey="c" />
|
|
78
|
+
</SampleBlock>
|
|
79
|
+
<SampleBlock {...block('short-key')}>
|
|
80
|
+
<KolInputRange {...props} _min={0} _max={50} _label="With short key" _shortKey="s" />
|
|
81
|
+
</SampleBlock>
|
|
82
|
+
<SampleBlock {...block('small-range')}>
|
|
83
|
+
<KolInputRange {...props} _min={0} _max={5} _label="Small range (max=5): number input should not be narrower than 4 digits wide" />
|
|
84
|
+
</SampleBlock>
|
|
48
85
|
</div>
|
|
49
86
|
);
|
|
50
87
|
});
|
|
@@ -4,17 +4,16 @@ import { InputRangeCases } from './cases';
|
|
|
4
4
|
|
|
5
5
|
import type { Components } from '@public-ui/components';
|
|
6
6
|
import { SampleColumns } from '../../SampleColumns';
|
|
7
|
+
import { SampleGroup } from '../../SampleGroup';
|
|
7
8
|
export const InputRangeVariants = forwardRef<HTMLKolInputRangeElement, Components.KolInputRange>(function InputRangeVariant(props, ref) {
|
|
8
9
|
return (
|
|
9
10
|
<SampleColumns>
|
|
10
|
-
<
|
|
11
|
-
<
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
<InputRangeCases ref={ref} {...props} _hideLabel />
|
|
17
|
-
</fieldset>
|
|
11
|
+
<SampleGroup heading="Range">
|
|
12
|
+
<InputRangeCases blockIdPrefix="label" {...props} />
|
|
13
|
+
</SampleGroup>
|
|
14
|
+
<SampleGroup heading="Range (hideLabel)">
|
|
15
|
+
<InputRangeCases blockIdPrefix="hide-label" snapshotOnly="error" ref={ref} {...props} _hideLabel />
|
|
16
|
+
</SampleGroup>
|
|
18
17
|
</SampleColumns>
|
|
19
18
|
);
|
|
20
19
|
});
|
|
@@ -1,19 +1,26 @@
|
|
|
1
1
|
import { KolInputText } from '@public-ui/react-v19';
|
|
2
2
|
import type { FC } from 'react';
|
|
3
3
|
import React from 'react';
|
|
4
|
+
import { SampleBlock } from '../SampleBlock';
|
|
4
5
|
import { SampleDescription } from '../SampleDescription';
|
|
5
6
|
|
|
6
7
|
export const InputTextAccessShortKey: FC = () => (
|
|
7
|
-
|
|
8
|
+
<div className="grid gap-4">
|
|
8
9
|
<SampleDescription>
|
|
9
10
|
<p>This story demonstrates access keys and short keys for KolInputText. Access keys provide keyboard shortcuts for focusing inputs.</p>
|
|
10
11
|
</SampleDescription>
|
|
11
12
|
|
|
12
|
-
<
|
|
13
|
+
<SampleBlock id="access-key-value">
|
|
13
14
|
<KolInputText _label="With access key (Alt+F)" _value="Press Alt+F to focus" _accessKey="f" />
|
|
15
|
+
</SampleBlock>
|
|
16
|
+
<SampleBlock id="short-key-value">
|
|
14
17
|
<KolInputText _label="With short key (Alt+N)" _value="Press Alt+N to focus" _shortKey="n" />
|
|
18
|
+
</SampleBlock>
|
|
19
|
+
<SampleBlock id="access-key-placeholder">
|
|
15
20
|
<KolInputText _label="Access key (Alt+E)" _value="" _placeholder="Email address" _accessKey="e" />
|
|
21
|
+
</SampleBlock>
|
|
22
|
+
<SampleBlock id="short-key-placeholder">
|
|
16
23
|
<KolInputText _label="Short key (Alt+P)" _value="" _placeholder="Phone number" _shortKey="p" />
|
|
17
|
-
</
|
|
18
|
-
|
|
24
|
+
</SampleBlock>
|
|
25
|
+
</div>
|
|
19
26
|
);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { KolCombobox, KolInputText, KolSelect, KolTextarea } from '@public-ui/react-v19';
|
|
2
2
|
import type { FC } from 'react';
|
|
3
3
|
import React from 'react';
|
|
4
|
+
import { SampleBlock } from '../SampleBlock';
|
|
4
5
|
import { SampleDescription } from '../SampleDescription';
|
|
5
6
|
|
|
6
7
|
export const InputTextAriaDetails: FC = () => (
|
|
@@ -16,7 +17,7 @@ export const InputTextAriaDetails: FC = () => (
|
|
|
16
17
|
</p>
|
|
17
18
|
</SampleDescription>
|
|
18
19
|
|
|
19
|
-
<
|
|
20
|
+
<SampleBlock id="aria-details" className="grid gap-8">
|
|
20
21
|
{/* Input Form with all 4 components */}
|
|
21
22
|
<div className="grid gap-4 p-4 border border-gray-300 rounded">
|
|
22
23
|
<h2 className="text-lg font-semibold">Form Inputs with Shared Details</h2>
|
|
@@ -56,6 +57,6 @@ export const InputTextAriaDetails: FC = () => (
|
|
|
56
57
|
</li>
|
|
57
58
|
</ul>
|
|
58
59
|
</div>
|
|
59
|
-
</
|
|
60
|
+
</SampleBlock>
|
|
60
61
|
</>
|
|
61
62
|
);
|
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
import { KolInputText } from '@public-ui/react-v19';
|
|
2
2
|
import type { FC } from 'react';
|
|
3
3
|
import React from 'react';
|
|
4
|
+
import { SampleBlock } from '../SampleBlock';
|
|
4
5
|
import { SampleDescription } from '../SampleDescription';
|
|
5
6
|
|
|
6
7
|
export const InputTextBackground: FC = () => (
|
|
7
|
-
|
|
8
|
+
<div className="grid gap-4">
|
|
8
9
|
<SampleDescription>
|
|
9
10
|
<p>This story showcases the component placed on a colored background.</p>
|
|
10
11
|
</SampleDescription>
|
|
11
12
|
|
|
12
|
-
<
|
|
13
|
+
<SampleBlock id="background-default" className="grid gap-4 bg-blue-400 p-4 rounded">
|
|
13
14
|
<strong>Default background:</strong>
|
|
14
15
|
<KolInputText _label="First name" _value="John Doe" />
|
|
15
|
-
|
|
16
|
+
</SampleBlock>
|
|
17
|
+
<SampleBlock id="background-unset" className="grid gap-4 bg-blue-400 p-4 rounded">
|
|
16
18
|
<strong>Unset background:</strong>
|
|
17
19
|
<KolInputText style={{ backgroundColor: 'unset' }} _label="First name" _value="John Doe" />
|
|
18
|
-
</
|
|
19
|
-
|
|
20
|
+
</SampleBlock>
|
|
21
|
+
</div>
|
|
20
22
|
);
|