@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,6 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import { KolHeading } from '@public-ui/react-v19';
|
|
4
4
|
|
|
5
5
|
import type { FC } from 'react';
|
|
6
|
+
import { SampleBlock } from '../SampleBlock';
|
|
6
7
|
import { SampleDescription } from '../SampleDescription';
|
|
7
8
|
|
|
8
9
|
export const HeadingBasic: FC = () => (
|
|
@@ -11,13 +12,13 @@ export const HeadingBasic: FC = () => (
|
|
|
11
12
|
<p>KolHeading renders a heading with the given level.</p>
|
|
12
13
|
</SampleDescription>
|
|
13
14
|
|
|
14
|
-
<
|
|
15
|
+
<SampleBlock id="basic">
|
|
15
16
|
<KolHeading _label="I'm a H1-heading" _level={1} />
|
|
16
17
|
<KolHeading _label="I'm a H2-heading" _level={2} />
|
|
17
18
|
<KolHeading _label="I'm a H3-heading" _level={3} />
|
|
18
19
|
<KolHeading _label="I'm a H4-heading" _level={4} />
|
|
19
20
|
<KolHeading _label="I'm a H5-heading" _level={5} />
|
|
20
21
|
<KolHeading _label="I'm a H6-heading" _level={6} />
|
|
21
|
-
</
|
|
22
|
+
</SampleBlock>
|
|
22
23
|
</>
|
|
23
24
|
);
|
|
@@ -3,6 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import { KolHeading } from '@public-ui/react-v19';
|
|
4
4
|
|
|
5
5
|
import type { FC } from 'react';
|
|
6
|
+
import { SampleBlock } from '../SampleBlock';
|
|
6
7
|
import { SampleDescription } from '../SampleDescription';
|
|
7
8
|
|
|
8
9
|
export const HeadingParagraph: FC = () => (
|
|
@@ -11,7 +12,7 @@ export const HeadingParagraph: FC = () => (
|
|
|
11
12
|
<p>This sample shows KolHeading with its different levels combined with some text content each.</p>
|
|
12
13
|
</SampleDescription>
|
|
13
14
|
|
|
14
|
-
<
|
|
15
|
+
<SampleBlock id="paragraph">
|
|
15
16
|
<KolHeading _label="Ich bin eine H1-Überschrift" _level={1} />
|
|
16
17
|
<p>
|
|
17
18
|
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam
|
|
@@ -48,6 +49,6 @@ export const HeadingParagraph: FC = () => (
|
|
|
48
49
|
voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
|
|
49
50
|
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor.
|
|
50
51
|
</p>
|
|
51
|
-
</
|
|
52
|
+
</SampleBlock>
|
|
52
53
|
</>
|
|
53
54
|
);
|
|
@@ -3,6 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import { KolHeading } from '@public-ui/react-v19';
|
|
4
4
|
|
|
5
5
|
import type { FC } from 'react';
|
|
6
|
+
import { SampleBlock } from '../SampleBlock';
|
|
6
7
|
import { SampleDescription } from '../SampleDescription';
|
|
7
8
|
|
|
8
9
|
export const HeadingSecondary: FC = () => (
|
|
@@ -13,8 +14,8 @@ export const HeadingSecondary: FC = () => (
|
|
|
13
14
|
</p>
|
|
14
15
|
</SampleDescription>
|
|
15
16
|
|
|
16
|
-
<
|
|
17
|
+
<SampleBlock id="secondary">
|
|
17
18
|
<KolHeading _label="This is a H1 headline" _secondaryHeadline="This is a secondary headline" _level={1} />
|
|
18
|
-
</
|
|
19
|
+
</SampleBlock>
|
|
19
20
|
</>
|
|
20
21
|
);
|
|
@@ -26,7 +26,7 @@ export const IconAllKolicons: FC = () => {
|
|
|
26
26
|
{Object.entries(icons).map(([key]) => {
|
|
27
27
|
return (
|
|
28
28
|
<div className="flex gap-4" key={key}>
|
|
29
|
-
<KolIcon _label=
|
|
29
|
+
<KolIcon _label={`Icon ${key}`} _icons={'kolicon-' + key} />
|
|
30
30
|
<span>kolicon-{key}</span>
|
|
31
31
|
</div>
|
|
32
32
|
);
|
|
@@ -12,21 +12,21 @@ export const IconBasic: FC = () => (
|
|
|
12
12
|
</SampleDescription>
|
|
13
13
|
|
|
14
14
|
<div className="grid gap-4">
|
|
15
|
-
<KolIcon className="block" _label="" _icons="kolicon-alert-info" />
|
|
16
|
-
<KolIcon className="block" _label="" _icons="kolicon-kolibri" />
|
|
17
|
-
<KolIcon className="block" _label="" _icons="kolicon-house" />
|
|
18
|
-
<KolIcon className="block" _label="" _icons="kolicon-settings" />
|
|
15
|
+
<KolIcon className="block" _label="Alert Info Icon" _icons="kolicon-alert-info" />
|
|
16
|
+
<KolIcon className="block" _label="Kolibri Icon" _icons="kolicon-kolibri" />
|
|
17
|
+
<KolIcon className="block" _label="House Icon" _icons="kolicon-house" />
|
|
18
|
+
<KolIcon className="block" _label="Settings Icon" _icons="kolicon-settings" />
|
|
19
19
|
|
|
20
20
|
<KolIcon
|
|
21
21
|
className="block w-[1em] h-[1em]"
|
|
22
22
|
style={{
|
|
23
23
|
color: 'red',
|
|
24
24
|
}}
|
|
25
|
-
_label=""
|
|
25
|
+
_label="House Icon"
|
|
26
26
|
_icons="kolicon-house"
|
|
27
27
|
/>
|
|
28
28
|
|
|
29
|
-
<KolIcon className="block" _label="" _icons="codicon codicon-plus" />
|
|
29
|
+
<KolIcon className="block" _label="Plus Icon" _icons="codicon codicon-plus" />
|
|
30
30
|
</div>
|
|
31
31
|
</>
|
|
32
32
|
);
|
|
@@ -5,38 +5,46 @@ import { KolButton, KolIcon, KolInputText } from '@public-ui/react-v19';
|
|
|
5
5
|
|
|
6
6
|
import type { FC } from 'react';
|
|
7
7
|
import { fetchVariantData } from '../../shares/fetchVariantData';
|
|
8
|
-
import {
|
|
8
|
+
import { getTheme } from '../../shares/store';
|
|
9
|
+
import { SampleBlock } from '../SampleBlock';
|
|
9
10
|
import { SampleDescription } from '../SampleDescription';
|
|
10
11
|
|
|
11
12
|
export const IconFont: FC = () => {
|
|
12
13
|
const [searchParams] = useSearchParams();
|
|
13
|
-
const theme = searchParams.get('theme') ??
|
|
14
|
+
const theme = searchParams.get('theme') ?? getTheme();
|
|
14
15
|
const iconVariants = useMemo(() => (theme ? fetchVariantData(theme, 'iconVariants') : []), [theme]);
|
|
15
16
|
const iconVariantsButton = useMemo(() => (theme ? fetchVariantData(theme, 'iconVariantsButton') : []), [theme]);
|
|
16
17
|
const iconVariantsInput = useMemo(() => (theme ? fetchVariantData(theme, 'iconVariantsInput') : []), [theme]);
|
|
17
18
|
|
|
19
|
+
/* Themes without variants only render the fallback text – there is nothing theme specific to snapshot. */
|
|
20
|
+
const hasIconVariants = Array.isArray(iconVariants) && iconVariants.length > 0;
|
|
21
|
+
const hasIconVariantsButton = Array.isArray(iconVariantsButton) && iconVariantsButton.length > 0;
|
|
22
|
+
const hasIconVariantsInput = Array.isArray(iconVariantsInput) && iconVariantsInput.length > 0;
|
|
23
|
+
|
|
18
24
|
return (
|
|
19
25
|
<>
|
|
20
26
|
<SampleDescription>
|
|
21
27
|
<p>KolIcon renders different icon fonts depending on your theme.</p>
|
|
22
28
|
</SampleDescription>
|
|
23
29
|
|
|
24
|
-
<
|
|
25
|
-
{!
|
|
30
|
+
<SampleBlock id="icons" className="grid grid-cols-2 gap-8 p-8" skipSnapshot={!hasIconVariants}>
|
|
31
|
+
{!hasIconVariants ? (
|
|
26
32
|
<p>This theme has no variants for icons.</p>
|
|
27
33
|
) : (
|
|
28
34
|
iconVariants.map((element) => {
|
|
29
35
|
return (
|
|
30
36
|
<div className="flex gap-4" key={element}>
|
|
31
|
-
<KolIcon _label=
|
|
32
|
-
<span
|
|
37
|
+
<KolIcon _label={element} _icons={element} />
|
|
38
|
+
<span>
|
|
39
|
+
<KolIcon _icons='{element}' _label="{element}" />
|
|
40
|
+
</span>
|
|
33
41
|
</div>
|
|
34
42
|
);
|
|
35
43
|
})
|
|
36
44
|
)}
|
|
37
|
-
</
|
|
38
|
-
<
|
|
39
|
-
{!
|
|
45
|
+
</SampleBlock>
|
|
46
|
+
<SampleBlock id="buttons" className="grid grid-cols-2 gap-8 p-8" skipSnapshot={!hasIconVariantsButton}>
|
|
47
|
+
{!hasIconVariantsButton ? (
|
|
40
48
|
<p>This theme has no variants for icons in buttons.</p>
|
|
41
49
|
) : (
|
|
42
50
|
iconVariantsButton.map((element) => {
|
|
@@ -48,9 +56,9 @@ export const IconFont: FC = () => {
|
|
|
48
56
|
);
|
|
49
57
|
})
|
|
50
58
|
)}
|
|
51
|
-
</
|
|
52
|
-
<
|
|
53
|
-
{!
|
|
59
|
+
</SampleBlock>
|
|
60
|
+
<SampleBlock id="inputs" className="grid gap-8 p-8" skipSnapshot={!hasIconVariantsInput}>
|
|
61
|
+
{!hasIconVariantsInput ? (
|
|
54
62
|
<p>This theme has no variants for icons in inputs.</p>
|
|
55
63
|
) : (
|
|
56
64
|
iconVariantsInput.map((element) => {
|
|
@@ -62,7 +70,7 @@ export const IconFont: FC = () => {
|
|
|
62
70
|
);
|
|
63
71
|
})
|
|
64
72
|
)}
|
|
65
|
-
</
|
|
73
|
+
</SampleBlock>
|
|
66
74
|
</>
|
|
67
75
|
);
|
|
68
76
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { KolImage } 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 ImageBasic: FC = () => (
|
|
@@ -9,10 +10,12 @@ export const ImageBasic: FC = () => (
|
|
|
9
10
|
<p>KolImage renders an image. The sample shows an image with alternative text.</p>
|
|
10
11
|
</SampleDescription>
|
|
11
12
|
|
|
12
|
-
<
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
<SampleBlock id="basic" fitContent>
|
|
14
|
+
<KolImage
|
|
15
|
+
_alt="KoliBri design system illustration showing three people working on laptops surrounded by UI components, charts, and the KoliBri hummingbird logo"
|
|
16
|
+
_src="assets/sample-image.png"
|
|
17
|
+
className="w-image"
|
|
18
|
+
/>
|
|
19
|
+
</SampleBlock>
|
|
17
20
|
</>
|
|
18
21
|
);
|
|
@@ -5,22 +5,83 @@ import { KolInputCheckbox } 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 InputCheckboxCasesProps = Components.KolInputCheckbox & {
|
|
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 InputCheckboxCases = forwardRef<HTMLKolInputCheckboxElement, InputCheckboxCasesProps>(function InputCheckboxCases(
|
|
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
|
-
<
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
<
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
<
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
<
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
30
|
+
<SampleBlock {...block('unchecked')}>
|
|
31
|
+
<KolInputCheckbox {...props} _label="Not selected" _value={false} _required />
|
|
32
|
+
</SampleBlock>
|
|
33
|
+
<SampleBlock {...block('indeterminate')}>
|
|
34
|
+
<KolInputCheckbox {...props} _label="Indeterminate" _value={null} _indeterminate />
|
|
35
|
+
</SampleBlock>
|
|
36
|
+
<SampleBlock {...block('checked')}>
|
|
37
|
+
<KolInputCheckbox {...props} ref={ref} _accessKey="A" _checked _label="Selected" _tooltipAlign="right" _value={true} />
|
|
38
|
+
</SampleBlock>
|
|
39
|
+
<SampleBlock {...block('long-label')}>
|
|
40
|
+
<KolInputCheckbox
|
|
41
|
+
{...props}
|
|
42
|
+
_checked
|
|
43
|
+
_icons={{ unchecked: 'ckolicon-cross' }}
|
|
44
|
+
_label={'With a very long label and upheavals '.repeat(5)}
|
|
45
|
+
_value={true}
|
|
46
|
+
/>
|
|
47
|
+
</SampleBlock>
|
|
48
|
+
<SampleBlock {...block('disabled')}>
|
|
49
|
+
<KolInputCheckbox {...props} _disabled _label="Disabled" _value={true} _hint="Hint text" />
|
|
50
|
+
</SampleBlock>
|
|
51
|
+
<SampleBlock {...block('checked-disabled')}>
|
|
52
|
+
<KolInputCheckbox {...props} _checked _disabled _label="Checked and disabled" />
|
|
53
|
+
</SampleBlock>
|
|
54
|
+
<SampleBlock {...block('indet-disabled')}>
|
|
55
|
+
<KolInputCheckbox {...props} _indeterminate _disabled _label="Indeterminate and disabled" />
|
|
56
|
+
</SampleBlock>
|
|
57
|
+
<SampleBlock {...block('error')}>
|
|
58
|
+
<KolInputCheckbox
|
|
59
|
+
{...props}
|
|
60
|
+
_msg={{ _type: 'error', _description: ERROR_MSG }}
|
|
61
|
+
_label="With error"
|
|
62
|
+
_touched
|
|
63
|
+
_value={true}
|
|
64
|
+
_hint="Hint text"
|
|
65
|
+
_required
|
|
66
|
+
/>
|
|
67
|
+
</SampleBlock>
|
|
68
|
+
<SampleBlock {...block('access-key')}>
|
|
69
|
+
<KolInputCheckbox {...props} _label="With access key" _accessKey="c" _value={null}></KolInputCheckbox>
|
|
70
|
+
</SampleBlock>
|
|
71
|
+
<SampleBlock {...block('short-key')}>
|
|
72
|
+
<KolInputCheckbox {...props} _label="With short key" _shortKey="s" _value={null}></KolInputCheckbox>
|
|
73
|
+
</SampleBlock>
|
|
74
|
+
<SampleBlock {...block('info-popover')}>
|
|
75
|
+
<KolInputCheckbox
|
|
76
|
+
{...props}
|
|
77
|
+
_label="With popover"
|
|
78
|
+
_value={false}
|
|
79
|
+
_required
|
|
80
|
+
_infoPopover={{ _label: 'hint', _content: 'Ich bin ein Hinweis.', _icons: 'kolicon-alert-info' }}
|
|
81
|
+
>
|
|
82
|
+
<span slot="expert">Expert Slot & required</span>
|
|
83
|
+
</KolInputCheckbox>
|
|
84
|
+
</SampleBlock>
|
|
24
85
|
</div>
|
|
25
86
|
);
|
|
26
87
|
});
|
|
@@ -4,28 +4,25 @@ import { InputCheckboxCases } 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 InputCheckboxVariants = forwardRef<HTMLKolInputCheckboxElement, Components.KolInputCheckbox>(function InputCheckboxVariant(props, ref) {
|
|
8
9
|
return (
|
|
9
10
|
<>
|
|
10
11
|
<SampleColumns>
|
|
11
|
-
<
|
|
12
|
-
<
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
<InputCheckboxCases ref={ref} {...props} _hideLabel _labelAlign="left" />
|
|
18
|
-
</fieldset>
|
|
12
|
+
<SampleGroup heading='Label align "left" with label'>
|
|
13
|
+
<InputCheckboxCases blockIdPrefix="left" {...props} _labelAlign="left" />
|
|
14
|
+
</SampleGroup>
|
|
15
|
+
<SampleGroup heading='Label align "left" without Label (hideLabel)'>
|
|
16
|
+
<InputCheckboxCases blockIdPrefix="left-hide" snapshotOnly="error" ref={ref} {...props} _hideLabel _labelAlign="left" />
|
|
17
|
+
</SampleGroup>
|
|
19
18
|
</SampleColumns>
|
|
20
19
|
<SampleColumns>
|
|
21
|
-
<
|
|
22
|
-
<
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
<InputCheckboxCases ref={ref} {...props} _hideLabel />
|
|
28
|
-
</fieldset>
|
|
20
|
+
<SampleGroup heading='Label align "right" with label'>
|
|
21
|
+
<InputCheckboxCases blockIdPrefix="right" {...props} />
|
|
22
|
+
</SampleGroup>
|
|
23
|
+
<SampleGroup heading='Label align "right" without Label (hideLabel)'>
|
|
24
|
+
<InputCheckboxCases blockIdPrefix="right-hide" snapshotOnly="error" ref={ref} {...props} _hideLabel />
|
|
25
|
+
</SampleGroup>
|
|
29
26
|
</SampleColumns>
|
|
30
27
|
</>
|
|
31
28
|
);
|
|
@@ -3,11 +3,29 @@ import { KolInputColor } from '@public-ui/react-v19';
|
|
|
3
3
|
import React, { forwardRef } from 'react';
|
|
4
4
|
|
|
5
5
|
import { ERROR_MSG } from '../../../shares/constants';
|
|
6
|
+
import { SampleBlock } from '../../SampleBlock';
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
type InputColorCasesProps = Components.KolInputColor & {
|
|
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 InputColorCases = forwardRef<HTMLKolInputColorElement, InputColorCasesProps>(function InputColorCases(
|
|
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
|
<KolInputColor
|
|
12
30
|
{...props}
|
|
13
31
|
_msg={{ _type: 'error', _description: ERROR_MSG }}
|
|
@@ -17,22 +35,47 @@ export const InputColorCases = forwardRef<HTMLKolInputColorElement, Components.K
|
|
|
17
35
|
_label="Color (Black background test)"
|
|
18
36
|
_value="#f08080"
|
|
19
37
|
/>
|
|
20
|
-
</
|
|
21
|
-
<
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
<
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
<
|
|
34
|
-
|
|
35
|
-
|
|
38
|
+
</SampleBlock>
|
|
39
|
+
<SampleBlock {...block('suggestions-error')}>
|
|
40
|
+
<KolInputColor
|
|
41
|
+
{...props}
|
|
42
|
+
_msg={{ _type: 'error', _description: ERROR_MSG }}
|
|
43
|
+
_label="Color with error"
|
|
44
|
+
_suggestions="['#000000','#f08080', '#0000ff','#00ff00']"
|
|
45
|
+
_touched
|
|
46
|
+
/>
|
|
47
|
+
</SampleBlock>
|
|
48
|
+
<SampleBlock {...block('msg-info')}>
|
|
49
|
+
<KolInputColor {...props} _msg={{ _type: 'info', _description: 'Just a hint message.' }} _label="Color" _touched />
|
|
50
|
+
</SampleBlock>
|
|
51
|
+
<SampleBlock {...block('msg-warning')}>
|
|
52
|
+
<KolInputColor {...props} _msg={{ _type: 'warning', _description: 'Small warning' }} _label="Color" _touched />
|
|
53
|
+
</SampleBlock>
|
|
54
|
+
<SampleBlock {...block('msg-success')}>
|
|
55
|
+
<KolInputColor {...props} _msg={{ _type: 'success', _description: 'Success message' }} _label="Color" _touched />
|
|
56
|
+
</SampleBlock>
|
|
57
|
+
<SampleBlock {...block('msg-default')}>
|
|
58
|
+
<KolInputColor {...props} _msg={{ _type: 'default', _description: 'Default message' }} _label="Color" _touched />
|
|
59
|
+
</SampleBlock>
|
|
60
|
+
<SampleBlock {...block('hint')}>
|
|
61
|
+
<KolInputColor {...props} ref={ref} _accessKey="C" _hint="Hint text" _label="Color with hint" _value="#f08080" />
|
|
62
|
+
</SampleBlock>
|
|
63
|
+
<SampleBlock {...block('disabled')}>
|
|
64
|
+
<KolInputColor {...props} _disabled _label="Color (Disabled)" _value="#f08080" />
|
|
65
|
+
</SampleBlock>
|
|
66
|
+
<SampleBlock {...block('access-key')}>
|
|
67
|
+
<KolInputColor {...props} _label="With access key" _accessKey="c"></KolInputColor>
|
|
68
|
+
</SampleBlock>
|
|
69
|
+
<SampleBlock {...block('short-key')}>
|
|
70
|
+
<KolInputColor {...props} _label="With short key" _shortKey="s"></KolInputColor>
|
|
71
|
+
</SampleBlock>
|
|
72
|
+
<SampleBlock {...block('info-popover')}>
|
|
73
|
+
<KolInputColor
|
|
74
|
+
{...props}
|
|
75
|
+
_label="With short popover"
|
|
76
|
+
_infoPopover={{ _label: 'hint', _content: 'Ich bin ein Hinweis.', _icons: 'kolicon-alert-info' }}
|
|
77
|
+
></KolInputColor>
|
|
78
|
+
</SampleBlock>
|
|
36
79
|
</div>
|
|
37
80
|
);
|
|
38
81
|
});
|
|
@@ -4,17 +4,16 @@ import { InputColorCases } 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 InputColorVariants = forwardRef<HTMLKolInputColorElement, Components.KolInputColor>(function InputColorVariant(props, ref) {
|
|
8
9
|
return (
|
|
9
10
|
<SampleColumns>
|
|
10
|
-
<
|
|
11
|
-
<
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
<InputColorCases ref={ref} {...props} _hideLabel />
|
|
17
|
-
</fieldset>
|
|
11
|
+
<SampleGroup heading="Color">
|
|
12
|
+
<InputColorCases blockIdPrefix="label" {...props} />
|
|
13
|
+
</SampleGroup>
|
|
14
|
+
<SampleGroup heading="Color (hideLabel)">
|
|
15
|
+
<InputColorCases blockIdPrefix="hide-label" snapshotOnly="suggestions-error" ref={ref} {...props} _hideLabel />
|
|
16
|
+
</SampleGroup>
|
|
18
17
|
</SampleColumns>
|
|
19
18
|
);
|
|
20
19
|
});
|
|
@@ -3,36 +3,80 @@ import { KolInputDate } 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 InputDateCasesProps = Components.KolInputDate & {
|
|
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 InputDateCases = forwardRef<HTMLKolInputDateElement, InputDateCasesProps>(function InputDateCases({ blockIdPrefix, snapshotOnly, ...props }, ref) {
|
|
21
|
+
// Blocks outside `snapshotOnly` stay visible in the sample but are excluded from the snapshots.
|
|
22
|
+
const block = (caseId: string) => ({ id: `${blockIdPrefix}-${caseId}`, skipSnapshot: snapshotOnly !== undefined && caseId !== snapshotOnly });
|
|
8
23
|
return (
|
|
9
24
|
<div className="grid gap-4">
|
|
10
|
-
<
|
|
25
|
+
<SampleBlock {...block('black-bg')} className="black-background">
|
|
11
26
|
<KolInputDate {...props} _type="date" _label="Date input (Black background test)" _required />
|
|
12
|
-
</
|
|
13
|
-
<
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
<
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
<
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
<
|
|
27
|
+
</SampleBlock>
|
|
28
|
+
<SampleBlock {...block('datetime-local')}>
|
|
29
|
+
<KolInputDate {...props} _type="datetime-local" _label="Local-Datetime (Standard)" _required />
|
|
30
|
+
</SampleBlock>
|
|
31
|
+
<SampleBlock {...block('datetime-seconds')}>
|
|
32
|
+
<KolInputDate
|
|
33
|
+
{...props}
|
|
34
|
+
_step={1}
|
|
35
|
+
_type="datetime-local"
|
|
36
|
+
_hint={HINT_MSG}
|
|
37
|
+
_msg={{ _type: 'error', _description: ERROR_MSG }}
|
|
38
|
+
_label="Local datetime (with seconds)"
|
|
39
|
+
_required
|
|
40
|
+
_touched
|
|
41
|
+
_infoPopover={{ _label: 'hint', _content: 'Ich bin ein Hinweis.', _icons: 'kolicon-alert-info' }}
|
|
42
|
+
/>
|
|
43
|
+
</SampleBlock>
|
|
44
|
+
<SampleBlock {...block('msg-info')}>
|
|
45
|
+
<KolInputDate {...props} _msg={{ _type: 'info', _description: 'Just a hint' }} _label="Date" _touched />
|
|
46
|
+
</SampleBlock>
|
|
47
|
+
<SampleBlock {...block('msg-warning')}>
|
|
48
|
+
<KolInputDate {...props} _msg={{ _type: 'warning', _description: 'Small warning' }} _label="Date" _touched />
|
|
49
|
+
</SampleBlock>
|
|
50
|
+
<SampleBlock {...block('msg-success')}>
|
|
51
|
+
<KolInputDate {...props} _msg={{ _type: 'success', _description: 'Success message' }} _label="Date" _touched />
|
|
52
|
+
</SampleBlock>
|
|
53
|
+
<SampleBlock {...block('msg-default')}>
|
|
54
|
+
<KolInputDate {...props} _msg={{ _type: 'default', _description: 'Default message' }} _label="Date" _touched />
|
|
55
|
+
</SampleBlock>
|
|
56
|
+
<SampleBlock {...block('month')}>
|
|
57
|
+
<KolInputDate {...props} _type="month" _label="Month" _required />
|
|
58
|
+
</SampleBlock>
|
|
59
|
+
<SampleBlock {...block('week')}>
|
|
60
|
+
<KolInputDate {...props} ref={ref} _accessKey="W" _type="week" _label="Week" _required />
|
|
61
|
+
</SampleBlock>
|
|
62
|
+
<SampleBlock {...block('time')}>
|
|
63
|
+
<KolInputDate {...props} _type="time" _label="Time (standard)" _required />
|
|
64
|
+
</SampleBlock>
|
|
65
|
+
<SampleBlock {...block('time-seconds')}>
|
|
66
|
+
<KolInputDate {...props} _step={1} _type="time" _label="Time (with seconds)" _required />
|
|
67
|
+
</SampleBlock>
|
|
68
|
+
<SampleBlock {...block('readonly')}>
|
|
69
|
+
<KolInputDate {...props} _readOnly _label="Date input (read-only)" _required />
|
|
70
|
+
</SampleBlock>
|
|
71
|
+
<SampleBlock {...block('disabled')}>
|
|
72
|
+
<KolInputDate {...props} _disabled _label="Date input (Disabled)" _required />
|
|
73
|
+
</SampleBlock>
|
|
74
|
+
<SampleBlock {...block('access-key')}>
|
|
75
|
+
<KolInputDate {...props} _label="With access key" _accessKey="s" />
|
|
76
|
+
</SampleBlock>
|
|
77
|
+
<SampleBlock {...block('short-key')}>
|
|
78
|
+
<KolInputDate {...props} _label="With short key" _shortKey="s" />
|
|
79
|
+
</SampleBlock>
|
|
36
80
|
</div>
|
|
37
81
|
);
|
|
38
82
|
});
|