@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.
Files changed (171) hide show
  1. package/package.json +10 -10
  2. package/src/App.tsx +2 -0
  3. package/src/components/InputEventValueDemo.tsx +6 -3
  4. package/src/components/SampleBlock.tsx +81 -0
  5. package/src/components/SampleGroup.tsx +27 -0
  6. package/src/components/abbr/basic.tsx +6 -3
  7. package/src/components/accordion/basic.tsx +3 -2
  8. package/src/components/accordion/headlines.tsx +3 -2
  9. package/src/components/alert/basic.tsx +17 -14
  10. package/src/components/avatar/basic.tsx +3 -2
  11. package/src/components/avatar/size.tsx +3 -2
  12. package/src/components/badge/basic.tsx +48 -7
  13. package/src/components/badge/routes.ts +0 -4
  14. package/src/components/breadcrumb/basic.tsx +3 -2
  15. package/src/components/button/access-key.tsx +8 -10
  16. package/src/components/button/aria-description.tsx +4 -4
  17. package/src/components/button/baselined.tsx +4 -4
  18. package/src/components/button/basic.tsx +10 -17
  19. package/src/components/button/disabled.tsx +6 -7
  20. package/src/components/button/expert-slot.tsx +6 -7
  21. package/src/components/button/focus-options.tsx +8 -10
  22. package/src/components/button/hide-label.tsx +8 -10
  23. package/src/components/button/icons.tsx +12 -16
  24. package/src/components/button/row-reverse-tooltip.tsx +4 -4
  25. package/src/components/button/short-key.tsx +15 -20
  26. package/src/components/button/spinner.tsx +6 -7
  27. package/src/components/button/variants.tsx +6 -6
  28. package/src/components/button/width.tsx +6 -7
  29. package/src/components/button-link/aria-description.tsx +3 -2
  30. package/src/components/button-link/basic.tsx +37 -35
  31. package/src/components/button-link/icons.tsx +13 -2
  32. package/src/components/button-link/image.tsx +3 -2
  33. package/src/components/card/basic.tsx +3 -2
  34. package/src/components/card/headlines.tsx +3 -2
  35. package/src/components/card/linked.tsx +3 -2
  36. package/src/components/combobox/partials/cases.tsx +40 -14
  37. package/src/components/combobox/partials/variants.tsx +7 -8
  38. package/src/components/details/basic.tsx +3 -2
  39. package/src/components/form/basic.tsx +5 -4
  40. package/src/components/form/error-list-scroll.tsx +87 -0
  41. package/src/components/form/error-list.tsx +56 -56
  42. package/src/components/form/routes.ts +2 -0
  43. package/src/components/heading/badged.tsx +3 -2
  44. package/src/components/heading/basic.tsx +3 -2
  45. package/src/components/heading/paragraph.tsx +3 -2
  46. package/src/components/heading/secondary.tsx +3 -2
  47. package/src/components/icon/all-kolicons.tsx +1 -1
  48. package/src/components/icon/basic.tsx +6 -6
  49. package/src/components/icon/font.tsx +21 -13
  50. package/src/components/image/basic.tsx +8 -5
  51. package/src/components/input-checkbox/partials/cases.tsx +75 -14
  52. package/src/components/input-checkbox/partials/variants.tsx +13 -16
  53. package/src/components/input-color/partials/cases.tsx +61 -18
  54. package/src/components/input-color/partials/variants.tsx +7 -8
  55. package/src/components/input-date/partials/cases.tsx +70 -26
  56. package/src/components/input-date/partials/minMax.tsx +38 -11
  57. package/src/components/input-date/partials/variants.tsx +10 -12
  58. package/src/components/input-email/partials/cases.tsx +69 -30
  59. package/src/components/input-email/partials/variants.tsx +7 -8
  60. package/src/components/input-file/partials/cases.tsx +58 -24
  61. package/src/components/input-file/partials/variants.tsx +7 -8
  62. package/src/components/input-number/number-formatter.tsx +5 -4
  63. package/src/components/input-number/partials/cases.tsx +68 -28
  64. package/src/components/input-number/partials/variants.tsx +7 -8
  65. package/src/components/input-password/partials/cases.tsx +67 -30
  66. package/src/components/input-password/partials/variants.tsx +7 -8
  67. package/src/components/input-password/show-password.tsx +22 -19
  68. package/src/components/input-radio/horizontal.tsx +3 -2
  69. package/src/components/input-radio/objectValue.tsx +5 -4
  70. package/src/components/input-radio/partials/cases.tsx +85 -55
  71. package/src/components/input-radio/partials/variants.tsx +7 -9
  72. package/src/components/input-range/partials/cases.tsx +60 -23
  73. package/src/components/input-range/partials/variants.tsx +7 -8
  74. package/src/components/input-text/access-short-key.tsx +11 -4
  75. package/src/components/input-text/aria-details.tsx +3 -2
  76. package/src/components/input-text/background-test.tsx +7 -5
  77. package/src/components/input-text/basic.tsx +24 -5
  78. package/src/components/input-text/clear-button.tsx +26 -0
  79. package/src/components/input-text/counter.tsx +3 -2
  80. package/src/components/input-text/disabled.tsx +11 -4
  81. package/src/components/input-text/expert-slot.tsx +13 -8
  82. package/src/components/input-text/hide-label.tsx +7 -6
  83. package/src/components/input-text/hide-msg.tsx +5 -4
  84. package/src/components/input-text/message-types.tsx +13 -4
  85. package/src/components/input-text/msg-and-counter.tsx +9 -4
  86. package/src/components/input-text/pattern.tsx +18 -15
  87. package/src/components/input-text/placeholder.tsx +13 -4
  88. package/src/components/input-text/readonly.tsx +11 -4
  89. package/src/components/input-text/routes.ts +2 -0
  90. package/src/components/input-text/select-range.tsx +3 -2
  91. package/src/components/input-text/smart-button.tsx +7 -4
  92. package/src/components/input-text/text-formatter.tsx +5 -4
  93. package/src/components/input-text/variant.tsx +8 -6
  94. package/src/components/kolibri/basic.tsx +9 -6
  95. package/src/components/link/basic.tsx +3 -2
  96. package/src/components/link/icons.tsx +3 -2
  97. package/src/components/link/image.tsx +3 -2
  98. package/src/components/link/target.tsx +3 -2
  99. package/src/components/link/variant.tsx +5 -4
  100. package/src/components/link-button/aria-description.tsx +7 -1
  101. package/src/components/link-button/basic.tsx +5 -4
  102. package/src/components/link-button/routes.ts +2 -0
  103. package/src/components/link-button/target.tsx +19 -0
  104. package/src/components/meter/basic.tsx +4 -4
  105. package/src/components/meter/dynamic.tsx +4 -4
  106. package/src/components/meter/optimum.tsx +8 -10
  107. package/src/components/meter/orientation.tsx +6 -7
  108. package/src/components/nav/aria-current.tsx +18 -15
  109. package/src/components/nav/basic.tsx +8 -10
  110. package/src/components/pagination/basic.tsx +3 -2
  111. package/src/components/pagination/button-visibility.tsx +16 -11
  112. package/src/components/pagination/sibling-boundary.tsx +3 -2
  113. package/src/components/popover-button/inline.tsx +4 -5
  114. package/src/components/progress/basic.tsx +7 -6
  115. package/src/components/quote/basic.tsx +4 -1
  116. package/src/components/quote/block.tsx +9 -6
  117. package/src/components/select/partials/cases.tsx +73 -33
  118. package/src/components/select/partials/variants.tsx +7 -8
  119. package/src/components/single-select/partials/cases.tsx +148 -114
  120. package/src/components/single-select/partials/variants.tsx +7 -8
  121. package/src/components/spin/basic.tsx +34 -3
  122. package/src/components/spin/routes.ts +0 -8
  123. package/src/components/split-button/basic.tsx +3 -2
  124. package/src/components/table/action-columns.tsx +3 -2
  125. package/src/components/table/column-alignment.tsx +3 -2
  126. package/src/components/table/complex-headers.tsx +3 -2
  127. package/src/components/table/empty.tsx +31 -0
  128. package/src/components/table/horizontal-scrollbar.tsx +24 -19
  129. package/src/components/table/multi-sort.tsx +6 -7
  130. package/src/components/table/non-hidable-columns.tsx +18 -15
  131. package/src/components/table/pagination-position.tsx +8 -10
  132. package/src/components/table/routes.ts +4 -0
  133. package/src/components/table/sort-data.tsx +6 -7
  134. package/src/components/table/stateful-async.tsx +50 -0
  135. package/src/components/table/stateful-with-selection.tsx +3 -2
  136. package/src/components/table/stateful-with-single-selection.tsx +3 -2
  137. package/src/components/table/stateless-async-paging.tsx +9 -32
  138. package/src/components/table/stateless-with-selection.tsx +3 -2
  139. package/src/components/table/stateless-with-single-selection.tsx +3 -2
  140. package/src/components/table/stateless.tsx +3 -2
  141. package/src/components/table/sticky-col.tsx +12 -10
  142. package/src/components/table/sticky-header.tsx +12 -10
  143. package/src/components/table/variant.tsx +5 -4
  144. package/src/components/table/with-footer.tsx +73 -70
  145. package/src/components/table/with-pagination.tsx +3 -2
  146. package/src/components/tabs/basic.tsx +17 -12
  147. package/src/components/tabs/create-button.tsx +11 -8
  148. package/src/components/tabs/icons-only.tsx +9 -6
  149. package/src/components/textarea/adjust-height.tsx +6 -3
  150. package/src/components/textarea/partials/cases.tsx +63 -15
  151. package/src/components/textarea/partials/variants.tsx +7 -8
  152. package/src/components/textarea/resize.tsx +3 -2
  153. package/src/components/textarea/rows.tsx +6 -3
  154. package/src/components/textarea/with-counter.tsx +3 -2
  155. package/src/components/toolbar/basic.tsx +6 -5
  156. package/src/components/toolbar/disabled.tsx +41 -38
  157. package/src/components/tree/basic.tsx +32 -29
  158. package/src/components/version/basic.tsx +4 -1
  159. package/src/components/version/context.tsx +8 -5
  160. package/src/hooks/useVisualBlockOutline.ts +38 -0
  161. package/src/scenarios/button-shortkey-table.tsx +4 -4
  162. package/src/scenarios/routes.ts +2 -0
  163. package/src/scenarios/same-height-of-all-form-elements-with-label.tsx +46 -0
  164. package/src/shares/store.ts +0 -4
  165. package/src/shares/visualBlockOutline.ts +75 -0
  166. package/src/components/badge/button.tsx +0 -35
  167. package/src/components/badge/formatted-label.tsx +0 -19
  168. package/src/components/spin/custom.tsx +0 -23
  169. package/src/components/spin/cycle.tsx +0 -16
  170. package/src/components/spin/label.tsx +0 -23
  171. package/src/components/spin/variables.tsx +0 -16
@@ -4,6 +4,7 @@ import { KolButtonLink, KolHeading } from '@public-ui/react-v19';
4
4
 
5
5
  import type { FC } from 'react';
6
6
  import { useToasterService } from '../../hooks/useToasterService';
7
+ import { SampleBlock } from '../SampleBlock';
7
8
  import { SampleDescription } from '../SampleDescription';
8
9
 
9
10
  export const ButtonLinkBasic: FC = () => {
@@ -20,41 +21,42 @@ export const ButtonLinkBasic: FC = () => {
20
21
  display-properties such as <code>block</code>, <code>inline-block</code> and <code>inline</code>. It also demonstrates the disabled-state.
21
22
  </p>
22
23
  </SampleDescription>
23
- <section className="text-base">
24
- <KolHeading _level={2} _label="Button-Link with _inline" />
25
-
26
- <p>
27
- In this paragraph, a link is inserted that contains no additional attributes. <KolButtonLink _label="Simple Link" /> It is rendered by default as an{' '}
28
- <strong>inline element</strong>.
29
- </p>
30
- <p>
31
- In this paragraph, a link is inserted that is rendered as an inline-block element.
32
- <KolButtonLink className="m-4" style={{ display: 'inline-block', border: '1px dotted' }} _label="Simple Link" />. This allows you to assign width,
33
- height, and other properties to it using CSS styles.
34
- <br />
35
- <br />
36
- After that, there is a link that is rendered as a block element.
37
- <KolButtonLink style={{ display: 'block' }} _label="Simple Link" />
38
- Therefore, I go over the entire width of the parent element to create a line break.
39
- </p>
40
-
41
- <KolHeading _level={2} _label="Button-Link with _inline={false}" />
42
-
43
- <p>Use the boolean _inline property to render the link inline (default) or standalone.</p>
44
-
45
- <p>
46
- <KolButtonLink _label="Disabled ButtonLink" _disabled _inline={false} />
47
- </p>
48
- <p>
49
- <KolButtonLink _label="With access key" _accessKey="c" _inline={false} _on={dummyEventHandler} />
50
- </p>
51
- <p>
52
- <KolButtonLink _label="With short key" _shortKey="s" _inline={false} _on={dummyEventHandler} />
53
- </p>
54
- <p>
55
- <KolButtonLink _label="Special Variant ButtonLink" _variant="theme-link" />
56
- </p>
57
- </section>
24
+ <KolHeading _level={2} _label="Button-Link with _inline" />
25
+
26
+ <p>
27
+ In this paragraph, a link is inserted that contains no additional attributes. <KolButtonLink _label="Simple Link" /> It is rendered by default as an{' '}
28
+ <strong>inline element</strong>.
29
+ </p>
30
+ <p>
31
+ In this paragraph, a link is inserted that is rendered as an inline-block element.
32
+ <KolButtonLink className="m-4" style={{ display: 'inline-block', border: '1px dotted' }} _label="Simple Link" />. This allows you to assign width,
33
+ height, and other properties to it using CSS styles.
34
+ <br />
35
+ <br />
36
+ After that, there is a link that is rendered as a block element.
37
+ <KolButtonLink style={{ display: 'block' }} _label="Simple Link" />
38
+ Therefore, I go over the entire width of the parent element to create a line break.
39
+ </p>
40
+
41
+ <KolHeading _level={2} _label="Button-Link with _inline={false}" />
42
+
43
+ <p>Use the boolean _inline property to render the link inline (default) or standalone.</p>
44
+
45
+ <SampleBlock id="basic" className="flex flex-col gap-2" fitContent>
46
+ <KolButtonLink _label="Standalone ButtonLink" _inline={false} _on={dummyEventHandler} />
47
+ </SampleBlock>
48
+ <SampleBlock id="disabled" className="flex flex-col gap-2" fitContent>
49
+ <KolButtonLink _label="Disabled ButtonLink" _disabled _inline={false} />
50
+ </SampleBlock>
51
+ <SampleBlock id="access-key" className="flex flex-col gap-2" fitContent>
52
+ <KolButtonLink _label="With access key" _accessKey="c" _inline={false} _on={dummyEventHandler} />
53
+ </SampleBlock>
54
+ <SampleBlock id="short-key" className="flex flex-col gap-2" fitContent>
55
+ <KolButtonLink _label="With short key" _shortKey="s" _inline={false} _on={dummyEventHandler} />
56
+ </SampleBlock>
57
+ <SampleBlock id="variant" className="flex flex-col gap-2" fitContent>
58
+ <KolButtonLink _label="Special Variant ButtonLink" _variant="theme-link" />
59
+ </SampleBlock>
58
60
  </>
59
61
  );
60
62
  };
@@ -3,6 +3,7 @@ import React from 'react';
3
3
  import { KolButtonLink } 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 ButtonLinkIcons: FC = () => (
@@ -11,26 +12,34 @@ export const ButtonLinkIcons: FC = () => (
11
12
  <p>This sample shows KolButtonLink with icons in different locations.</p>
12
13
  </SampleDescription>
13
14
 
14
- <div className="grid gap-4">
15
+ <SampleBlock id="left" fitContent>
15
16
  <KolButtonLink _icons="kolicon-house" _label="I am a link with an icon on the left" />
17
+ </SampleBlock>
18
+ <SampleBlock id="right" fitContent>
16
19
  <KolButtonLink
17
20
  _icons={{
18
21
  right: 'kolicon-house',
19
22
  }}
20
23
  _label="I am a link with an icon on the right"
21
24
  />
25
+ </SampleBlock>
26
+ <SampleBlock id="top" fitContent>
22
27
  <KolButtonLink
23
28
  _icons={{
24
29
  top: 'kolicon-house',
25
30
  }}
26
31
  _label="I am a link with an icon at the top"
27
32
  />
33
+ </SampleBlock>
34
+ <SampleBlock id="bottom" fitContent>
28
35
  <KolButtonLink
29
36
  _icons={{
30
37
  bottom: 'kolicon-house',
31
38
  }}
32
39
  _label="I am a link with icon below"
33
40
  />
41
+ </SampleBlock>
42
+ <SampleBlock id="all" fitContent>
34
43
  <KolButtonLink
35
44
  _icons={{
36
45
  top: 'kolicon-house',
@@ -40,7 +49,9 @@ export const ButtonLinkIcons: FC = () => (
40
49
  }}
41
50
  _label="I am a link with all icons"
42
51
  />
52
+ </SampleBlock>
53
+ <SampleBlock id="hide-label" fitContent>
43
54
  <KolButtonLink _icons="kolicon-house" _hideLabel _label="I am a link with icon only" />
44
- </div>
55
+ </SampleBlock>
45
56
  </>
46
57
  );
@@ -3,6 +3,7 @@ import React from 'react';
3
3
  import { KolButtonLink, KolImage } 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 ButtonLinkImage: FC = () => (
@@ -11,7 +12,7 @@ export const ButtonLinkImage: FC = () => (
11
12
  <p>This sample shows KolButtonLink with slot-content instead of a label. The sample uses an image as content.</p>
12
13
  </SampleDescription>
13
14
 
14
- <div className="grid gap-4">
15
+ <SampleBlock id="image">
15
16
  <KolButtonLink _label="I am a link that is rendered as text" />
16
17
  <KolButtonLink _label="">
17
18
  <KolImage
@@ -21,6 +22,6 @@ export const ButtonLinkImage: FC = () => (
21
22
  slot="expert"
22
23
  />
23
24
  </KolButtonLink>
24
- </div>
25
+ </SampleBlock>
25
26
  </>
26
27
  );
@@ -3,6 +3,7 @@ import React from 'react';
3
3
  import { KolCard } 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 CardBasic: FC = () => (
@@ -11,7 +12,7 @@ export const CardBasic: FC = () => (
11
12
  <p>KolCard shows a card with title and slot content. The second sample features a close button.</p>
12
13
  </SampleDescription>
13
14
 
14
- <div className="w-full grid grid-cols-2 gap-4">
15
+ <SampleBlock id="basic" className="w-full grid grid-cols-2 gap-4" narrow>
15
16
  <KolCard _label="Card with title and content">
16
17
  <p>Card contents.</p>
17
18
  </KolCard>
@@ -19,6 +20,6 @@ export const CardBasic: FC = () => (
19
20
  <KolCard _label="Card with closer" _hasCloser>
20
21
  <p>This card has a close button.</p>
21
22
  </KolCard>
22
- </div>
23
+ </SampleBlock>
23
24
  </>
24
25
  );
@@ -3,6 +3,7 @@ import React from 'react';
3
3
  import { KolCard } 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 CardHeadlines: FC = () => {
@@ -12,7 +13,7 @@ export const CardHeadlines: FC = () => {
12
13
  <p>This sample shows cards with all headline levels as title.</p>
13
14
  </SampleDescription>
14
15
 
15
- <div className="w-full grid grid-cols-2 gap-4">
16
+ <SampleBlock id="headlines" className="w-full grid grid-cols-2 gap-4">
16
17
  <KolCard _label="Card with headline level 0" _level={0}>
17
18
  <p>Card contents.</p>
18
19
  </KolCard>
@@ -40,7 +41,7 @@ export const CardHeadlines: FC = () => {
40
41
  <KolCard _label="Card with headline level 6" _level={6}>
41
42
  <p>Card contents.</p>
42
43
  </KolCard>
43
- </div>
44
+ </SampleBlock>
44
45
  </>
45
46
  );
46
47
  };
@@ -3,6 +3,7 @@ import React from 'react';
3
3
  import { KolCard } 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 CardLinked: FC = () => {
@@ -12,7 +13,7 @@ export const CardLinked: FC = () => {
12
13
  <p>This sample shows KolCards with links. The headline is wrapped with an a-tag. The whole card is clickable.</p>
13
14
  </SampleDescription>
14
15
 
15
- <div className="w-full grid grid-cols-2 gap-4">
16
+ <SampleBlock id="linked" className="w-full grid grid-cols-2 gap-4">
16
17
  <KolCard _label="Card with title and content" _href="#/back-page">
17
18
  <p>This card has a link.</p>
18
19
  </KolCard>
@@ -20,7 +21,7 @@ export const CardLinked: FC = () => {
20
21
  <KolCard _label="Card with title and content" _href="#/back-page" _target="_blank">
21
22
  <p>This card has a link and a target.</p>
22
23
  </KolCard>
23
- </div>
24
+ </SampleBlock>
24
25
  </>
25
26
  );
26
27
  };
@@ -5,23 +5,49 @@ import { KolCombobox } from '@public-ui/react-v19';
5
5
  import type { Components } from '@public-ui/components';
6
6
  import { ERROR_MSG, HINT_MSG } from '../../../shares/constants';
7
7
  import { COUNTRY_SUGGESTIONS } from '../../../shares/country';
8
+ import { SampleBlock } from '../../SampleBlock';
8
9
 
9
- export const ComboboxCases = (props: Partial<Components.KolCombobox>) => {
10
+ type ComboboxCasesProps = Partial<Components.KolCombobox> & {
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 ComboboxCases = ({ blockIdPrefix, snapshotOnly, ...props }: ComboboxCasesProps) => {
23
+ // Blocks outside `snapshotOnly` stay visible in the sample but are excluded from the snapshots.
24
+ const block = (caseId: string) => ({ id: `${blockIdPrefix}-${caseId}`, skipSnapshot: snapshotOnly !== undefined && caseId !== snapshotOnly });
10
25
  return (
11
26
  <div className="grid gap-4">
12
- <KolCombobox {...props} _hint={HINT_MSG} _label="Label" _suggestions={COUNTRY_SUGGESTIONS} _value={'Deutschland'} />
13
- <KolCombobox {...props} _label="Disabled" _suggestions={COUNTRY_SUGGESTIONS} _value={'Deutschland'} _disabled />
14
- <KolCombobox
15
- {...props}
16
- _suggestions={COUNTRY_SUGGESTIONS}
17
- _msg={{ _type: 'error', _description: ERROR_MSG }}
18
- _touched
19
- _label="Label"
20
- _placeholder="Placeholder"
21
- _required
22
- />
23
- <KolCombobox {...props} _label="With access key" _suggestions={COUNTRY_SUGGESTIONS} _value={'Deutschland'} _accessKey="c" />
24
- <KolCombobox {...props} _label="With short key" _suggestions={COUNTRY_SUGGESTIONS} _value={'Deutschland'} _shortKey="s" />
27
+ <SampleBlock {...block('hint')}>
28
+ <KolCombobox {...props} _hint={HINT_MSG} _label="Label" _suggestions={COUNTRY_SUGGESTIONS} _value={'Deutschland'} />
29
+ </SampleBlock>
30
+ <SampleBlock {...block('disabled')}>
31
+ <KolCombobox {...props} _label="Disabled" _suggestions={COUNTRY_SUGGESTIONS} _value={'Deutschland'} _disabled />
32
+ </SampleBlock>
33
+ <SampleBlock {...block('error')}>
34
+ <KolCombobox
35
+ {...props}
36
+ _suggestions={COUNTRY_SUGGESTIONS}
37
+ _msg={{ _type: 'error', _description: ERROR_MSG }}
38
+ _touched
39
+ _label="Label"
40
+ _placeholder="Placeholder"
41
+ _required
42
+ _infoPopover={{ _label: 'hint', _content: 'Ich bin ein Hinweis.', _icons: 'kolicon-alert-info' }}
43
+ />
44
+ </SampleBlock>
45
+ <SampleBlock {...block('access-key')}>
46
+ <KolCombobox {...props} _label="With access key" _suggestions={COUNTRY_SUGGESTIONS} _value={'Deutschland'} _accessKey="c" />
47
+ </SampleBlock>
48
+ <SampleBlock {...block('short-key')} skipSnapshot={props._hideLabel}>
49
+ <KolCombobox {...props} _label="With short key" _suggestions={COUNTRY_SUGGESTIONS} _value={'Deutschland'} _shortKey="s" />
50
+ </SampleBlock>
25
51
  </div>
26
52
  );
27
53
  };
@@ -2,19 +2,18 @@ import type { Components } from '@public-ui/components';
2
2
  import React from 'react';
3
3
 
4
4
  import { SampleColumns } from '../../SampleColumns';
5
+ import { SampleGroup } from '../../SampleGroup';
5
6
  import { ComboboxCases } from './cases';
6
7
 
7
8
  export const ComboboxVariants = (props: Partial<Components.KolCombobox>) => {
8
9
  return (
9
10
  <SampleColumns>
10
- <fieldset>
11
- <legend>Text</legend>
12
- <ComboboxCases {...props} />
13
- </fieldset>
14
- <fieldset>
15
- <legend>Text (hideLabel)</legend>
16
- <ComboboxCases {...props} _hideLabel />
17
- </fieldset>
11
+ <SampleGroup heading="Text">
12
+ <ComboboxCases blockIdPrefix="label" {...props} />
13
+ </SampleGroup>
14
+ <SampleGroup heading="Text (hideLabel)">
15
+ <ComboboxCases blockIdPrefix="hide-label" snapshotOnly="error" {...props} _hideLabel />
16
+ </SampleGroup>
18
17
  </SampleColumns>
19
18
  );
20
19
  };
@@ -3,6 +3,7 @@ import React from 'react';
3
3
  import { KolDetails } 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 DetailsBasic: FC = () => (
@@ -14,7 +15,7 @@ export const DetailsBasic: FC = () => (
14
15
  </p>
15
16
  </SampleDescription>
16
17
 
17
- <section className="grid gap-4">
18
+ <SampleBlock id="basic">
18
19
  <KolDetails _label="Closed initially">
19
20
  <p>
20
21
  Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam
@@ -36,6 +37,6 @@ export const DetailsBasic: FC = () => (
36
37
  Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt.
37
38
  </p>
38
39
  </KolDetails>
39
- </section>
40
+ </SampleBlock>
40
41
  </>
41
42
  );
@@ -1,6 +1,7 @@
1
1
  import { KolButton, KolForm, 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 FormBasic: FC = () => {
@@ -16,14 +17,14 @@ export const FormBasic: FC = () => {
16
17
  </p>
17
18
  </SampleDescription>
18
19
 
19
- <KolForm className="w-full" _on={formEventHAndler}>
20
- <div className="grid gap-2">
20
+ <SampleBlock id="form-basic" className="grid gap-2">
21
+ <KolForm className="w-full" _on={formEventHAndler}>
21
22
  <KolInputText id="input1" _label="Input 1" />
22
23
  <KolInputText id="input2" _label="Input 2" />
23
24
  <KolInputText id="input3" _label="Input 3" />
24
25
  <KolButton _label="Submit" _variant="primary" _type="submit" />
25
- </div>
26
- </KolForm>
26
+ </KolForm>
27
+ </SampleBlock>
27
28
  </>
28
29
  );
29
30
  };
@@ -0,0 +1,87 @@
1
+ import { KolButton, KolForm, KolInputText } from '@public-ui/react-v19';
2
+ import type { FC } from 'react';
3
+ import React, { useEffect, useRef } from 'react';
4
+ import { SampleBlock } from '../SampleBlock';
5
+ import { SampleDescription } from '../SampleDescription';
6
+
7
+ export const FormErrorListScroll: FC = () => {
8
+ const formRef = useRef<HTMLKolFormElement | null>(null);
9
+
10
+ const scrollTo = () => {
11
+ formRef.current?.focusErrorList();
12
+ };
13
+
14
+ /**
15
+ * Simulate the form submission
16
+ */
17
+ useEffect(() => {
18
+ formRef.current?.focusErrorList();
19
+ }, []);
20
+
21
+ return (
22
+ <>
23
+ <SampleDescription>
24
+ <p>This sample shows a form with error messages.</p>
25
+ </SampleDescription>
26
+
27
+ <SampleBlock id="error-list">
28
+ <KolForm
29
+ className="w-full"
30
+ ref={formRef}
31
+ _on={{
32
+ onSubmit: scrollTo,
33
+ }}
34
+ _errorList={[
35
+ {
36
+ message: 'Error in Input 2 (default scroll behaviour)',
37
+ selector: '#input2',
38
+ },
39
+ {
40
+ message: 'Error in Input 3 (no scrolling, just alert)',
41
+ selector: () => alert('Error in Input 3'),
42
+ },
43
+ {
44
+ message: 'Error in Input 4 (custom scroll behaviour)',
45
+ selector: '#input4',
46
+ options: { behavior: 'instant', block: 'start', afterFocus: () => console.log('after Focus Input 4') },
47
+ },
48
+ ]}
49
+ >
50
+ <div className="flex flex-col gap-250">
51
+ <KolInputText id="input1" _label="Input 1" />
52
+ <KolInputText
53
+ id="input2"
54
+ _label="Input 2"
55
+ _touched
56
+ _msg={{
57
+ _description: 'Input error',
58
+ _type: 'error',
59
+ }}
60
+ />
61
+ <KolInputText
62
+ id="input3"
63
+ _label="Input 3"
64
+ _touched
65
+ _msg={{
66
+ _description: 'Input error',
67
+ _type: 'error',
68
+ }}
69
+ />
70
+ <KolInputText
71
+ id="input4"
72
+ _label="Input 4"
73
+ _touched
74
+ _msg={{
75
+ _description: 'Input error',
76
+ _type: 'error',
77
+ }}
78
+ />
79
+ <div>
80
+ <KolButton _label="ScrollTo" _type="submit" />
81
+ </div>
82
+ </div>
83
+ </KolForm>
84
+ </SampleBlock>
85
+ </>
86
+ );
87
+ };
@@ -1,6 +1,7 @@
1
- import { KolButton, KolForm, KolInputText } from '@public-ui/react-v19';
1
+ import { KolForm, KolInputText } from '@public-ui/react-v19';
2
2
  import type { FC } from 'react';
3
3
  import React, { useEffect, useRef } from 'react';
4
+ import { SampleBlock } from '../SampleBlock';
4
5
  import { SampleDescription } from '../SampleDescription';
5
6
 
6
7
  export const FormErrorList: FC = () => {
@@ -23,62 +24,61 @@ export const FormErrorList: FC = () => {
23
24
  <p>This sample shows a form with error messages.</p>
24
25
  </SampleDescription>
25
26
 
26
- <KolForm
27
- className="w-full"
28
- ref={formRef}
29
- _on={{
30
- onSubmit: scrollTo,
31
- }}
32
- _errorList={[
33
- {
34
- message: 'Error in Input 2 (default scroll behaviour)',
35
- selector: '#input2',
36
- },
37
- {
38
- message: 'Error in Input 3 (no scrolling, just alert)',
39
- selector: () => alert('Error in Input 3'),
40
- },
41
- {
42
- message: 'Error in Input 4 (custom scroll behaviour)',
43
- selector: '#input4',
44
- options: { behavior: 'instant', block: 'start', afterFocus: () => console.log('after Focus Input 4') },
45
- },
46
- ]}
47
- >
48
- <div className="grid gap-250">
49
- <KolInputText id="input1" _label="Input 1" />
50
- <KolInputText
51
- id="input2"
52
- _label="Input 2"
53
- _touched
54
- _msg={{
55
- _description: 'Input error',
56
- _type: 'error',
57
- }}
58
- />
59
- <KolInputText
60
- id="input3"
61
- _label="Input 3"
62
- _touched
63
- _msg={{
64
- _description: 'Input error',
65
- _type: 'error',
66
- }}
67
- />
68
- <KolInputText
69
- id="input4"
70
- _label="Input 4"
71
- _touched
72
- _msg={{
73
- _description: 'Input error',
74
- _type: 'error',
75
- }}
76
- />
77
- <div>
78
- <KolButton _label="ScrollTo" _type="submit" />
27
+ <SampleBlock id="error-list">
28
+ <KolForm
29
+ className="w-full"
30
+ ref={formRef}
31
+ _on={{
32
+ onSubmit: scrollTo,
33
+ }}
34
+ _errorList={[
35
+ {
36
+ message: 'Error in Input 2 (default scroll behaviour)',
37
+ selector: '#input2',
38
+ },
39
+ {
40
+ message: 'Error in Input 3 (no scrolling, just alert)',
41
+ selector: () => alert('Error in Input 3'),
42
+ },
43
+ {
44
+ message: 'Error in Input 4 (custom scroll behaviour)',
45
+ selector: '#input4',
46
+ options: { behavior: 'instant', block: 'start', afterFocus: () => console.log('after Focus Input 4') },
47
+ },
48
+ ]}
49
+ >
50
+ <div className="flex flex-col gap-2">
51
+ <KolInputText id="input1" _label="Input 1" />
52
+ <KolInputText
53
+ id="input2"
54
+ _label="Input 2"
55
+ _touched
56
+ _msg={{
57
+ _description: 'Input error',
58
+ _type: 'error',
59
+ }}
60
+ />
61
+ <KolInputText
62
+ id="input3"
63
+ _label="Input 3"
64
+ _touched
65
+ _msg={{
66
+ _description: 'Input error',
67
+ _type: 'error',
68
+ }}
69
+ />
70
+ <KolInputText
71
+ id="input4"
72
+ _label="Input 4"
73
+ _touched
74
+ _msg={{
75
+ _description: 'Input error',
76
+ _type: 'error',
77
+ }}
78
+ />
79
79
  </div>
80
- </div>
81
- </KolForm>
80
+ </KolForm>
81
+ </SampleBlock>
82
82
  </>
83
83
  );
84
84
  };
@@ -1,10 +1,12 @@
1
1
  import type { Routes } from '../../shares/types';
2
2
  import { FormBasic } from './basic';
3
3
  import { FormErrorList } from './error-list';
4
+ import { FormErrorListScroll } from './error-list-scroll';
4
5
 
5
6
  export const FORM_ROUTES: Routes = {
6
7
  form: {
7
8
  basic: FormBasic,
8
9
  'error-list': FormErrorList,
10
+ 'error-list-scroll': FormErrorListScroll,
9
11
  },
10
12
  };
@@ -3,6 +3,7 @@ import React from 'react';
3
3
  import { KolBadge, 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 HeadingBadged: FC = () => (
@@ -13,7 +14,7 @@ export const HeadingBadged: FC = () => (
13
14
  </p>
14
15
  </SampleDescription>
15
16
 
16
- <div className="grid gap-4">
17
+ <SampleBlock id="badged">
17
18
  <KolHeading _label="" _level={1}>
18
19
  <span slot="expert">
19
20
  A heading with a <KolBadge _label="Label"></KolBadge>
@@ -44,6 +45,6 @@ export const HeadingBadged: FC = () => (
44
45
  A heading with a <KolBadge _color="#ffc0cb" _label="Label"></KolBadge>
45
46
  </span>
46
47
  </KolHeading>
47
- </div>
48
+ </SampleBlock>
48
49
  </>
49
50
  );