@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
|
@@ -2,7 +2,14 @@ import type { Components } from '@public-ui/components';
|
|
|
2
2
|
import { KolInputDate } from '@public-ui/react-v19';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
import { SampleBlock } from '../../SampleBlock';
|
|
6
|
+
|
|
7
|
+
type InputDateMinMaxCasesProps = Components.KolInputDate & {
|
|
8
|
+
/** Prefixes the visual block ids so the same cases can be rendered more than once per route. */
|
|
9
|
+
blockIdPrefix: string;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const InputDateMinMaxCases = ({ blockIdPrefix, ...props }: InputDateMinMaxCasesProps) => {
|
|
6
13
|
const minDateIso = '2024-09-26';
|
|
7
14
|
const maxDateIso = '2024-09-27';
|
|
8
15
|
|
|
@@ -22,20 +29,40 @@ export const InputDateMinMaxCases = (props: Components.KolInputDate) => {
|
|
|
22
29
|
const maxDate = new Date('October 20, 2024, 15:00');
|
|
23
30
|
return (
|
|
24
31
|
<div className="grid gap-4">
|
|
25
|
-
<
|
|
26
|
-
|
|
32
|
+
<SampleBlock id={`${blockIdPrefix}-date-iso`}>
|
|
33
|
+
<KolInputDate {...props} _type="date" _label="Date with Iso" _min={minDateIso} _max={maxDateIso} />
|
|
34
|
+
</SampleBlock>
|
|
35
|
+
<SampleBlock id={`${blockIdPrefix}-date-object`}>
|
|
36
|
+
<KolInputDate {...props} _type="date" _label="Date with Date" _min={minDate} _max={maxDate} />
|
|
37
|
+
</SampleBlock>
|
|
27
38
|
|
|
28
|
-
<
|
|
29
|
-
|
|
39
|
+
<SampleBlock id={`${blockIdPrefix}-time-iso`}>
|
|
40
|
+
<KolInputDate {...props} _type="time" _label="Time with Iso" _min={minTimeIso} _max={maxTimeIso} />
|
|
41
|
+
</SampleBlock>
|
|
42
|
+
<SampleBlock id={`${blockIdPrefix}-time-object`}>
|
|
43
|
+
<KolInputDate {...props} _type="time" _label="Time with Date" _min={minDate} _max={maxDate} />
|
|
44
|
+
</SampleBlock>
|
|
30
45
|
|
|
31
|
-
<
|
|
32
|
-
|
|
46
|
+
<SampleBlock id={`${blockIdPrefix}-datetime-iso`}>
|
|
47
|
+
<KolInputDate {...props} _type="datetime-local" _label="DayTime with Iso" _min={minDayTimeIso} _max={maxDaytimeIso} />
|
|
48
|
+
</SampleBlock>
|
|
49
|
+
<SampleBlock id={`${blockIdPrefix}-datetime-object`}>
|
|
50
|
+
<KolInputDate {...props} _type="datetime-local" _label="DayTime with Date" _min={minDate} _max={maxDate} />
|
|
51
|
+
</SampleBlock>
|
|
33
52
|
|
|
34
|
-
<
|
|
35
|
-
|
|
53
|
+
<SampleBlock id={`${blockIdPrefix}-week-iso`}>
|
|
54
|
+
<KolInputDate {...props} _type="week" _label="Week with Iso" _min={minWeekIso} _max={maxWeekIso} />
|
|
55
|
+
</SampleBlock>
|
|
56
|
+
<SampleBlock id={`${blockIdPrefix}-week-object`}>
|
|
57
|
+
<KolInputDate {...props} _type="week" _label="Week with Date" _min={minDate} _max={maxDate} />
|
|
58
|
+
</SampleBlock>
|
|
36
59
|
|
|
37
|
-
<
|
|
38
|
-
|
|
60
|
+
<SampleBlock id={`${blockIdPrefix}-month-iso`}>
|
|
61
|
+
<KolInputDate {...props} _type="month" _label="Month with Iso" _min={minMonthIso} _max={maxMonthIso} />
|
|
62
|
+
</SampleBlock>
|
|
63
|
+
<SampleBlock id={`${blockIdPrefix}-month-object`}>
|
|
64
|
+
<KolInputDate {...props} _type="month" _label="Month with Date" _min={minDate} _max={maxDate} />
|
|
65
|
+
</SampleBlock>
|
|
39
66
|
</div>
|
|
40
67
|
);
|
|
41
68
|
};
|
|
@@ -4,22 +4,20 @@ import { InputDateCases } 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
|
import { InputDateMinMaxCases } from './minMax';
|
|
8
9
|
export const InputDateVariants = forwardRef<HTMLKolInputDateElement, Components.KolInputDate>(function InputDateVariant(props, ref) {
|
|
9
10
|
return (
|
|
10
11
|
<SampleColumns>
|
|
11
|
-
<
|
|
12
|
-
<
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
<legend>Date (with min/max)</legend>
|
|
21
|
-
<InputDateMinMaxCases {...props} />
|
|
22
|
-
</fieldset>
|
|
12
|
+
<SampleGroup heading="Date">
|
|
13
|
+
<InputDateCases blockIdPrefix="label" {...props} />
|
|
14
|
+
</SampleGroup>
|
|
15
|
+
<SampleGroup heading="Date (hideLabel)">
|
|
16
|
+
<InputDateCases blockIdPrefix="hide-label" snapshotOnly="datetime-seconds" ref={ref} {...props} _hideLabel />
|
|
17
|
+
</SampleGroup>
|
|
18
|
+
<SampleGroup heading="Date (with min/max)">
|
|
19
|
+
<InputDateMinMaxCases blockIdPrefix="min-max" {...props} />
|
|
20
|
+
</SampleGroup>
|
|
23
21
|
</SampleColumns>
|
|
24
22
|
);
|
|
25
23
|
});
|
|
@@ -3,40 +3,79 @@ import { KolInputEmail } 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 InputEmailCasesProps = Components.KolInputEmail & {
|
|
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 InputEmailCases = forwardRef<HTMLKolInputEmailElement, InputEmailCasesProps>(function InputEmailCases(
|
|
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
|
<KolInputEmail {...props} _required _value="test@mail.de" _msg={{ _type: 'error', _description: ERROR_MSG }} _label="E-Mail (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('suggestions')}>
|
|
32
|
+
<KolInputEmail
|
|
33
|
+
{...props}
|
|
34
|
+
ref={ref}
|
|
35
|
+
_accessKey="M"
|
|
36
|
+
_placeholder="elke@mustermann.de"
|
|
37
|
+
_suggestions="['test1@mail.de', 'test2@mail.de', 'test3@mail.de']"
|
|
38
|
+
_label="E-Mail (list)"
|
|
39
|
+
_hint={HINT_MSG}
|
|
40
|
+
_msg={{ _type: 'error', _description: ERROR_MSG }}
|
|
41
|
+
_touched
|
|
42
|
+
_icons={{
|
|
43
|
+
left: {
|
|
44
|
+
icon: 'kolicon-chevron-left',
|
|
45
|
+
},
|
|
46
|
+
right: {
|
|
47
|
+
icon: 'kolicon-chevron-right',
|
|
48
|
+
},
|
|
49
|
+
}}
|
|
50
|
+
/>
|
|
51
|
+
</SampleBlock>
|
|
52
|
+
<SampleBlock {...block('info-popover')}>
|
|
53
|
+
<KolInputEmail {...props} _required _label="E-Mail" _infoPopover={{ _label: 'hint', _content: 'Ich bin ein Hinweis.', _icons: 'kolicon-alert-info' }} />
|
|
54
|
+
</SampleBlock>
|
|
55
|
+
<SampleBlock {...block('msg-info')}>
|
|
56
|
+
<KolInputEmail {...props} _msg={{ _type: 'info', _description: 'Just a hint' }} _label="E-Mail" _touched />
|
|
57
|
+
</SampleBlock>
|
|
58
|
+
<SampleBlock {...block('msg-warning')}>
|
|
59
|
+
<KolInputEmail {...props} _msg={{ _type: 'warning', _description: 'Small warning' }} _label="E-Mail" _touched />
|
|
60
|
+
</SampleBlock>
|
|
61
|
+
<SampleBlock {...block('msg-success')}>
|
|
62
|
+
<KolInputEmail {...props} _msg={{ _type: 'success', _description: 'Success message' }} _label="E-Mail" _touched />
|
|
63
|
+
</SampleBlock>
|
|
64
|
+
<SampleBlock {...block('msg-default')}>
|
|
65
|
+
<KolInputEmail {...props} _msg={{ _type: 'default', _description: 'Default message' }} _label="E-Mail" _touched />
|
|
66
|
+
</SampleBlock>
|
|
67
|
+
<SampleBlock {...block('disabled')}>
|
|
68
|
+
<KolInputEmail {...props} _disabled _value="test@mail.de" _label="E-Mail (Disabled)" />
|
|
69
|
+
</SampleBlock>
|
|
70
|
+
<SampleBlock {...block('readonly')}>
|
|
71
|
+
<KolInputEmail {...props} _readOnly _value="test@mail.de" _label="E-Mail (Readonly)" />
|
|
72
|
+
</SampleBlock>
|
|
73
|
+
<SampleBlock {...block('access-key')}>
|
|
74
|
+
<KolInputEmail {...props} _value="test@mail.de" _label="With access key" _accessKey="c" />
|
|
75
|
+
</SampleBlock>
|
|
76
|
+
<SampleBlock {...block('short-key')}>
|
|
77
|
+
<KolInputEmail {...props} _value="test@mail.de" _label="With short key" _shortKey="s" />
|
|
78
|
+
</SampleBlock>
|
|
40
79
|
</div>
|
|
41
80
|
);
|
|
42
81
|
});
|
|
@@ -4,17 +4,16 @@ import { InputEmailCases } 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 InputEmailVariants = forwardRef<HTMLKolInputEmailElement, Components.KolInputEmail>(function InputEmailVariant(props, ref) {
|
|
8
9
|
return (
|
|
9
10
|
<SampleColumns>
|
|
10
|
-
<
|
|
11
|
-
<
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
<InputEmailCases ref={ref} {...props} _hideLabel />
|
|
17
|
-
</fieldset>
|
|
11
|
+
<SampleGroup heading="Email">
|
|
12
|
+
<InputEmailCases blockIdPrefix="label" {...props} />
|
|
13
|
+
</SampleGroup>
|
|
14
|
+
<SampleGroup heading="Email (hideLabel)">
|
|
15
|
+
<InputEmailCases blockIdPrefix="hide-label" snapshotOnly="suggestions" ref={ref} {...props} _hideLabel />
|
|
16
|
+
</SampleGroup>
|
|
18
17
|
</SampleColumns>
|
|
19
18
|
);
|
|
20
19
|
});
|
|
@@ -3,6 +3,7 @@ import { KolInputFile } 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
|
const handleOn = {
|
|
8
9
|
onClick: () => console.log('click'),
|
|
@@ -10,10 +11,24 @@ const handleOn = {
|
|
|
10
11
|
onInput: (event: Event, files: unknown) => console.log('onInput', event, files),
|
|
11
12
|
};
|
|
12
13
|
|
|
13
|
-
|
|
14
|
+
type InputFileCasesProps = Components.KolInputFile & {
|
|
15
|
+
/** Prefixes the visual block ids so the same cases can be rendered more than once per route. */
|
|
16
|
+
blockIdPrefix: string;
|
|
17
|
+
/**
|
|
18
|
+
* Restricts the snapshots of this rendering to the case with this id; every other block is
|
|
19
|
+
* rendered with `skipSnapshot`. Used for the `_hideLabel` groups: hiding the label mainly
|
|
20
|
+
* changes how the message is laid out, so snapshotting every case a second time would only
|
|
21
|
+
* duplicate the labelled group.
|
|
22
|
+
*/
|
|
23
|
+
snapshotOnly?: string;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const InputFileCases = forwardRef<HTMLKolInputFileElement, InputFileCasesProps>(function InputFileCases({ blockIdPrefix, snapshotOnly, ...props }, ref) {
|
|
27
|
+
// Blocks outside `snapshotOnly` stay visible in the sample but are excluded from the snapshots.
|
|
28
|
+
const block = (caseId: string) => ({ id: `${blockIdPrefix}-${caseId}`, skipSnapshot: snapshotOnly !== undefined && caseId !== snapshotOnly });
|
|
14
29
|
return (
|
|
15
30
|
<div className="grid gap-4">
|
|
16
|
-
<
|
|
31
|
+
<SampleBlock {...block('black-bg')} className="black-background">
|
|
17
32
|
<KolInputFile
|
|
18
33
|
{...props}
|
|
19
34
|
_label="Upload file (Black background test)"
|
|
@@ -25,28 +40,47 @@ export const InputFileCases = forwardRef<HTMLKolInputFileElement, Components.Kol
|
|
|
25
40
|
_touched
|
|
26
41
|
_on={handleOn}
|
|
27
42
|
/>
|
|
28
|
-
</
|
|
29
|
-
<
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
<
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
<
|
|
49
|
-
|
|
43
|
+
</SampleBlock>
|
|
44
|
+
<SampleBlock {...block('error')}>
|
|
45
|
+
<KolInputFile
|
|
46
|
+
{...props}
|
|
47
|
+
_required
|
|
48
|
+
_hint={HINT_MSG}
|
|
49
|
+
_msg={{ _type: 'error', _description: ERROR_MSG }}
|
|
50
|
+
_label="Upload file (Error State)"
|
|
51
|
+
_icons={{
|
|
52
|
+
left: {
|
|
53
|
+
icon: 'kolicon-up',
|
|
54
|
+
},
|
|
55
|
+
}}
|
|
56
|
+
_touched
|
|
57
|
+
_infoPopover={{ _label: 'hint', _content: 'Ich bin ein Hinweis.', _icons: 'kolicon-alert-info' }}
|
|
58
|
+
/>
|
|
59
|
+
</SampleBlock>
|
|
60
|
+
<SampleBlock {...block('msg-info')}>
|
|
61
|
+
<KolInputFile {...props} _msg={{ _type: 'info', _description: 'Just a hint' }} _label="Upload file" _touched />
|
|
62
|
+
</SampleBlock>
|
|
63
|
+
<SampleBlock {...block('msg-warning')}>
|
|
64
|
+
<KolInputFile {...props} _msg={{ _type: 'warning', _description: 'Small warning' }} _label="Upload file" _touched />
|
|
65
|
+
</SampleBlock>
|
|
66
|
+
<SampleBlock {...block('msg-success')}>
|
|
67
|
+
<KolInputFile {...props} _msg={{ _type: 'success', _description: 'Success message' }} _label="Upload file" _touched />
|
|
68
|
+
</SampleBlock>
|
|
69
|
+
<SampleBlock {...block('msg-default')}>
|
|
70
|
+
<KolInputFile {...props} _msg={{ _type: 'default', _description: 'Default message' }} _label="Upload file" _touched />
|
|
71
|
+
</SampleBlock>
|
|
72
|
+
<SampleBlock {...block('multiple')}>
|
|
73
|
+
<KolInputFile {...props} ref={ref} _accessKey="h" _multiple _msg={{ _type: 'error', _description: ERROR_MSG }} _label="Upload file (Multiple)" />
|
|
74
|
+
</SampleBlock>
|
|
75
|
+
<SampleBlock {...block('disabled')}>
|
|
76
|
+
<KolInputFile {...props} _disabled _label="Upload file (Disabled)" />
|
|
77
|
+
</SampleBlock>
|
|
78
|
+
<SampleBlock {...block('access-key')}>
|
|
79
|
+
<KolInputFile {...props} _label="With access key" _accessKey="c" />
|
|
80
|
+
</SampleBlock>
|
|
81
|
+
<SampleBlock {...block('short-key')}>
|
|
82
|
+
<KolInputFile {...props} _label="With short key" _shortKey="s" />
|
|
83
|
+
</SampleBlock>
|
|
50
84
|
</div>
|
|
51
85
|
);
|
|
52
86
|
});
|
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react';
|
|
2
2
|
|
|
3
3
|
import { SampleColumns } from '../../SampleColumns';
|
|
4
|
+
import { SampleGroup } from '../../SampleGroup';
|
|
4
5
|
import { InputFileCases } from './cases';
|
|
5
6
|
|
|
6
7
|
import type { Components } from '@public-ui/components';
|
|
7
8
|
export const InputFileVariants = forwardRef<HTMLKolInputFileElement, Components.KolInputFile>(function InputFileVariant(props, ref) {
|
|
8
9
|
return (
|
|
9
10
|
<SampleColumns>
|
|
10
|
-
<
|
|
11
|
-
<
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
<InputFileCases ref={ref} {...props} _hideLabel />
|
|
17
|
-
</fieldset>
|
|
11
|
+
<SampleGroup heading="File">
|
|
12
|
+
<InputFileCases blockIdPrefix="label" {...props} />
|
|
13
|
+
</SampleGroup>
|
|
14
|
+
<SampleGroup heading="File (hideLabel)">
|
|
15
|
+
<InputFileCases blockIdPrefix="hide-label" snapshotOnly="error" ref={ref} {...props} _hideLabel />
|
|
16
|
+
</SampleGroup>
|
|
18
17
|
</SampleColumns>
|
|
19
18
|
);
|
|
20
19
|
});
|
|
@@ -3,6 +3,7 @@ import React, { type BaseSyntheticEvent } from 'react';
|
|
|
3
3
|
import { Controller, useForm } from 'react-hook-form';
|
|
4
4
|
import { NumericFormat, type NumberFormatValues, type NumericFormatProps } from 'react-number-format';
|
|
5
5
|
|
|
6
|
+
import { SampleBlock } from '../SampleBlock';
|
|
6
7
|
import { SampleDescription } from '../SampleDescription';
|
|
7
8
|
|
|
8
9
|
type KolInputTextEvents = {
|
|
@@ -171,7 +172,7 @@ export function InputNumberNumberFormatter() {
|
|
|
171
172
|
</p>
|
|
172
173
|
</SampleDescription>
|
|
173
174
|
<section className="w-full grid gap-4">
|
|
174
|
-
<
|
|
175
|
+
<SampleBlock id="whole-number">
|
|
175
176
|
<KolForm>
|
|
176
177
|
<KolInputNumber
|
|
177
178
|
_label="Whole number"
|
|
@@ -193,9 +194,9 @@ export function InputNumberNumberFormatter() {
|
|
|
193
194
|
/>
|
|
194
195
|
</KolForm>
|
|
195
196
|
<pre className="text-base mt-2">{JSON.stringify({ value, touched }, null, 2)}</pre>
|
|
196
|
-
</
|
|
197
|
+
</SampleBlock>
|
|
197
198
|
|
|
198
|
-
<
|
|
199
|
+
<SampleBlock id="currency">
|
|
199
200
|
<KolForm _on={{ onSubmit: handleCurrencySubmit }}>
|
|
200
201
|
<KolNumericFormatController
|
|
201
202
|
control={currencyForm.control as any}
|
|
@@ -208,7 +209,7 @@ export function InputNumberNumberFormatter() {
|
|
|
208
209
|
/>
|
|
209
210
|
</KolForm>
|
|
210
211
|
<pre className="text-base mt-2">{JSON.stringify(currencyValues, null, 2)}</pre>
|
|
211
|
-
</
|
|
212
|
+
</SampleBlock>
|
|
212
213
|
</section>
|
|
213
214
|
</>
|
|
214
215
|
);
|
|
@@ -5,37 +5,77 @@ import { KolInputNumber } from '@public-ui/react-v19';
|
|
|
5
5
|
import { ERROR_MSG } from '../../../shares/constants';
|
|
6
6
|
|
|
7
7
|
import type { Components } from '@public-ui/components';
|
|
8
|
-
|
|
8
|
+
import { SampleBlock } from '../../SampleBlock';
|
|
9
|
+
|
|
10
|
+
type InputNumberCasesProps = Components.KolInputNumber & {
|
|
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 InputNumberCases = forwardRef<HTMLKolInputNumberElement, InputNumberCasesProps>(function InputNumberCases(
|
|
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
|
<KolInputNumber {...props} _required _touched _value={123} _label="Number input (Black background test)" />
|
|
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
|
-
|
|
32
|
+
</SampleBlock>
|
|
33
|
+
<SampleBlock {...block('icons-error')}>
|
|
34
|
+
<KolInputNumber
|
|
35
|
+
{...props}
|
|
36
|
+
_required
|
|
37
|
+
_msg={{ _type: 'error', _description: ERROR_MSG }}
|
|
38
|
+
_touched
|
|
39
|
+
_placeholder="Mit Icons"
|
|
40
|
+
_label="Number input"
|
|
41
|
+
_icons={{
|
|
42
|
+
left: {
|
|
43
|
+
icon: 'kolicon-kolibri',
|
|
44
|
+
},
|
|
45
|
+
right: {
|
|
46
|
+
icon: 'kolicon-kolibri',
|
|
47
|
+
},
|
|
48
|
+
}}
|
|
49
|
+
_infoPopover={{ _label: 'hint', _content: 'Ich bin ein Hinweis.', _icons: 'kolicon-alert-info' }}
|
|
50
|
+
/>
|
|
51
|
+
</SampleBlock>
|
|
52
|
+
<SampleBlock {...block('msg-error')}>
|
|
53
|
+
<KolInputNumber {...props} _required _msg={{ _type: 'error', _description: ERROR_MSG }} _touched _value={123} _label="Number input" />
|
|
54
|
+
</SampleBlock>
|
|
55
|
+
<SampleBlock {...block('msg-warning')}>
|
|
56
|
+
<KolInputNumber {...props} _required _msg={{ _type: 'warning', _description: ERROR_MSG }} _touched _value={123} _label="Number input" />
|
|
57
|
+
</SampleBlock>
|
|
58
|
+
<SampleBlock {...block('msg-info')}>
|
|
59
|
+
<KolInputNumber {...props} _required _msg={{ _type: 'info', _description: ERROR_MSG }} _touched _value={123} _label="Number input" />
|
|
60
|
+
</SampleBlock>
|
|
61
|
+
<SampleBlock {...block('msg-success')}>
|
|
62
|
+
<KolInputNumber {...props} _required _msg={{ _type: 'success', _description: ERROR_MSG }} _touched _value={123} _label="Number input" />
|
|
63
|
+
</SampleBlock>
|
|
64
|
+
<SampleBlock {...block('min-max-step')}>
|
|
65
|
+
<KolInputNumber {...props} ref={ref} _accessKey="Z" _max={10} _min={-10} _step={2} _label="Number input (-10 to 10 in steps of 2)" />
|
|
66
|
+
</SampleBlock>
|
|
67
|
+
<SampleBlock {...block('readonly')}>
|
|
68
|
+
<KolInputNumber {...props} _readOnly _value={123} _label="Number input (Readonly)" />
|
|
69
|
+
</SampleBlock>
|
|
70
|
+
<SampleBlock {...block('disabled')}>
|
|
71
|
+
<KolInputNumber {...props} _disabled _value={123} _label="Number input (Disabled)" />
|
|
72
|
+
</SampleBlock>
|
|
73
|
+
<SampleBlock {...block('access-key')}>
|
|
74
|
+
<KolInputNumber {...props} _label="With access key" _accessKey="c" />
|
|
75
|
+
</SampleBlock>
|
|
76
|
+
<SampleBlock {...block('short-key')}>
|
|
77
|
+
<KolInputNumber {...props} _label="With short key" _shortKey="s" />
|
|
78
|
+
</SampleBlock>
|
|
39
79
|
</div>
|
|
40
80
|
);
|
|
41
81
|
});
|
|
@@ -4,17 +4,16 @@ import { InputNumberCases } 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 InputNumberVariants = forwardRef<HTMLKolInputNumberElement, Components.KolInputNumber>(function InputNumberVariant(props, ref) {
|
|
8
9
|
return (
|
|
9
10
|
<SampleColumns>
|
|
10
|
-
<
|
|
11
|
-
<
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
<InputNumberCases ref={ref} {...props} _hideLabel />
|
|
17
|
-
</fieldset>
|
|
11
|
+
<SampleGroup heading="Number">
|
|
12
|
+
<InputNumberCases blockIdPrefix="label" {...props} />
|
|
13
|
+
</SampleGroup>
|
|
14
|
+
<SampleGroup heading="Number (hideLabel)">
|
|
15
|
+
<InputNumberCases blockIdPrefix="hide-label" snapshotOnly="msg-error" ref={ref} {...props} _hideLabel />
|
|
16
|
+
</SampleGroup>
|
|
18
17
|
</SampleColumns>
|
|
19
18
|
);
|
|
20
19
|
});
|