@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
@@ -3,6 +3,7 @@ import React from 'react';
3
3
  import { KolProgress } 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 ProgressBasic: FC = () => (
@@ -12,21 +13,21 @@ export const ProgressBasic: FC = () => (
12
13
  </SampleDescription>
13
14
 
14
15
  <div className="grid gap-4 grid-cols-1 sm:grid-cols-2">
15
- <fieldset title="Percentages" className="flex flex-col gap-4">
16
+ <SampleBlock id="percentages" heading="Percentages" className="flex flex-col gap-4">
16
17
  <KolProgress _variant="bar" _max={7} _value={0}></KolProgress>
17
18
  <KolProgress _variant="bar" _max={7} _value={2}></KolProgress>
18
19
  <KolProgress _variant="bar" _max={7} _value={7}></KolProgress>
19
20
  <KolProgress _variant="cycle" _max={7} _value={6}></KolProgress>
20
- </fieldset>
21
- <fieldset title="Custom units" className="flex flex-col gap-4">
21
+ </SampleBlock>
22
+ <SampleBlock id="custom-units" heading="Custom units" className="flex flex-col gap-4">
22
23
  <KolProgress _label="Distance" _variant="bar" _max={65434} _value={7236} _unit="m"></KolProgress>
23
24
  <KolProgress _label="12 Tasks to do" _variant="bar" _max={12} _value={5} _unit="tasks completed"></KolProgress>
24
25
  <KolProgress _label="Max 150 kg" _variant="cycle" _max={150} _value={42} _unit="kg"></KolProgress>
25
- </fieldset>
26
- <fieldset title="Min & Max" className="flex flex-col gap-4">
26
+ </SampleBlock>
27
+ <SampleBlock id="min-max" heading="Min & Max" className="flex flex-col gap-4">
27
28
  <KolProgress _label="More than max" _variant="bar" _max={7} _value={14}></KolProgress>
28
29
  <KolProgress _label="Less than min" _variant="bar" _max={7} _value={-7}></KolProgress>
29
- </fieldset>
30
+ </SampleBlock>
30
31
  </div>
31
32
  </>
32
33
  );
@@ -2,6 +2,7 @@ import type { FC } from 'react';
2
2
  import React from 'react';
3
3
 
4
4
  import { KolQuote } from '@public-ui/react-v19';
5
+ import { SampleBlock } from '../SampleBlock';
5
6
  import { SampleDescription } from '../SampleDescription';
6
7
 
7
8
  export const QuoteBasic: FC = () => (
@@ -10,6 +11,8 @@ export const QuoteBasic: FC = () => (
10
11
  <p>KolQuote renders a quote with optional citation. This sample shows a quote in the variant &quot;inline&quot; with a link for citation.</p>
11
12
  </SampleDescription>
12
13
 
13
- <KolQuote _href="https://datatracker.ietf.org/doc/html/rfc1149" _quote="Avian carriers can provide high delay." _variant="inline"></KolQuote>
14
+ <SampleBlock id="basic">
15
+ <KolQuote _href="https://datatracker.ietf.org/doc/html/rfc1149" _quote="Avian carriers can provide high delay." _variant="inline"></KolQuote>
16
+ </SampleBlock>
14
17
  </>
15
18
  );
@@ -2,6 +2,7 @@ import type { FC } from 'react';
2
2
  import React from 'react';
3
3
 
4
4
  import { KolQuote } from '@public-ui/react-v19';
5
+ import { SampleBlock } from '../SampleBlock';
5
6
  import { SampleDescription } from '../SampleDescription';
6
7
 
7
8
  export const QuoteBlock: FC = () => (
@@ -10,17 +11,19 @@ export const QuoteBlock: FC = () => (
10
11
  <p>This sample shows a quote in the &quot;block&quot; variant.</p>
11
12
  </SampleDescription>
12
13
 
13
- <KolQuote
14
- _label="RFC 1149"
15
- _href="https://datatracker.ietf.org/doc/html/rfc1149"
16
- _quote="Avian carriers can provide high delay, low throughput, and low altitude
14
+ <SampleBlock id="block">
15
+ <KolQuote
16
+ _label="RFC 1149"
17
+ _href="https://datatracker.ietf.org/doc/html/rfc1149"
18
+ _quote="Avian carriers can provide high delay, low throughput, and low altitude
17
19
  service. The connection topology is limited to a single point-to-point path
18
20
  for each carrier, used with standard carriers, but many carriers can be used
19
21
  without significant interference with each other, outside early spring.
20
22
  This is because of the 3D ether space available to the carriers, in contrast
21
23
  to the 1D ether used by IEEE802.3. The carriers have an intrinsic collision
22
24
  avoidance system, which increases availability."
23
- _variant="block"
24
- ></KolQuote>
25
+ _variant="block"
26
+ ></KolQuote>
27
+ </SampleBlock>
25
28
  </>
26
29
  );
@@ -6,6 +6,7 @@ import { ERROR_MSG, HINT_MSG } from '../../../shares/constants';
6
6
 
7
7
  import type { Components, Optgroup, SelectOption, StencilUnknown } from '@public-ui/components';
8
8
  import { COUNTRY_OPTIONS } from '../../../shares/country';
9
+ import { SampleBlock } from '../../SampleBlock';
9
10
 
10
11
  const SALUTATION_OPTIONS: SelectOption<string>[] = [
11
12
  {
@@ -47,41 +48,80 @@ const groupedOptions: GroupedOptionsType = COUNTRY_OPTIONS.reduce((acc, option)
47
48
 
48
49
  const groupedOptionsArray = Object.values(groupedOptions);
49
50
 
50
- export const SelectCases = forwardRef<HTMLKolSelectElement, Components.KolSelect>(function SelectCases(props, ref) {
51
+ type SelectCasesProps = Components.KolSelect & {
52
+ /** Prefixes the visual block ids so the same cases can be rendered more than once per route. */
53
+ blockIdPrefix: string;
54
+ /**
55
+ * Restricts the snapshots of this rendering to the case with this id; every other block is
56
+ * rendered with `skipSnapshot`. Used for the `_hideLabel` groups: hiding the label mainly
57
+ * changes how the message is laid out, so snapshotting every case a second time would only
58
+ * duplicate the labelled group.
59
+ */
60
+ snapshotOnly?: string;
61
+ };
62
+
63
+ export const SelectCases = forwardRef<HTMLKolSelectElement, SelectCasesProps>(function SelectCases({ blockIdPrefix, snapshotOnly, ...props }, ref) {
64
+ // Blocks outside `snapshotOnly` stay visible in the sample but are excluded from the snapshots.
65
+ const block = (caseId: string) => ({ id: `${blockIdPrefix}-${caseId}`, skipSnapshot: snapshotOnly !== undefined && caseId !== snapshotOnly });
51
66
  return (
52
67
  <div className="grid gap-4">
53
- <KolSelect
54
- {...props}
55
- ref={ref}
56
- _accessKey="a"
57
- _options={SALUTATION_OPTIONS}
58
- _label="Salutation"
59
- _icons={{
60
- left: {
61
- icon: 'kolicon-chevron-left',
62
- },
63
- right: {
64
- icon: 'kolicon-chevron-right',
65
- },
66
- }}
67
- />
68
- <KolSelect {...props} _options={SALUTATION_OPTIONS} _label="Disabled" _disabled />
69
- <KolSelect {...props} _options={SALUTATION_OPTIONS_DISABLED} _label="Salutation with error" _msg={{ _type: 'error', _description: ERROR_MSG }} _touched />
70
- <KolSelect {...props} _options={COUNTRY_OPTIONS} _label="Multiple choice" _multiple />
71
- <KolSelect
72
- {...props}
73
- _options={COUNTRY_OPTIONS}
74
- _label="Multiple choice with error"
75
- _multiple
76
- _required
77
- _msg={{ _type: 'error', _description: ERROR_MSG }}
78
- _hint={HINT_MSG}
79
- _touched
80
- />
81
- <KolSelect {...props} _options={SALUTATION_OPTIONS} _label="With access key" _accessKey="c" />
82
- <KolSelect {...props} _options={SALUTATION_OPTIONS} _label="With short key" _shortKey="s" />
83
- <KolSelect {...props} _options={groupedOptionsArray} _label="With grouped by first letter" _value="Albanien" />
84
- <KolSelect {...props} _options={groupedOptionsArray} _label="With grouped by first letter (multiple)" _multiple _value={['Albanien']} />
68
+ <SampleBlock {...block('salutation-icons')}>
69
+ <KolSelect
70
+ {...props}
71
+ ref={ref}
72
+ _accessKey="a"
73
+ _options={SALUTATION_OPTIONS}
74
+ _label="Salutation"
75
+ _icons={{
76
+ left: {
77
+ icon: 'kolicon-chevron-left',
78
+ },
79
+ right: {
80
+ icon: 'kolicon-chevron-right',
81
+ },
82
+ }}
83
+ />
84
+ </SampleBlock>
85
+ <SampleBlock {...block('disabled')}>
86
+ <KolSelect {...props} _options={SALUTATION_OPTIONS} _label="Disabled" _disabled />
87
+ </SampleBlock>
88
+ <SampleBlock {...block('error')}>
89
+ <KolSelect
90
+ {...props}
91
+ _options={SALUTATION_OPTIONS_DISABLED}
92
+ _label="Salutation with error"
93
+ _msg={{ _type: 'error', _description: ERROR_MSG }}
94
+ _touched
95
+ />
96
+ </SampleBlock>
97
+ <SampleBlock {...block('multiple')}>
98
+ <KolSelect {...props} _options={COUNTRY_OPTIONS} _label="Multiple choice" _multiple />
99
+ </SampleBlock>
100
+ <SampleBlock {...block('multiple-error')}>
101
+ <KolSelect
102
+ {...props}
103
+ _options={COUNTRY_OPTIONS}
104
+ _label="Multiple choice with error"
105
+ _multiple
106
+ _required
107
+ _msg={{ _type: 'error', _description: ERROR_MSG }}
108
+ _hint={HINT_MSG}
109
+ _touched
110
+ _infoPopover={{ _label: 'hint', _content: 'Ich bin ein Hinweis.', _icons: 'kolicon-alert-info' }}
111
+ />
112
+ </SampleBlock>
113
+ <SampleBlock {...block('access-key')}>
114
+ <KolSelect {...props} _options={SALUTATION_OPTIONS} _label="With access key" _accessKey="c" />
115
+ </SampleBlock>
116
+ <SampleBlock {...block('short-key')}>
117
+ <KolSelect {...props} _options={SALUTATION_OPTIONS} _label="With short key" _shortKey="s" />
118
+ </SampleBlock>
119
+ <SampleBlock {...block('grouped')}>
120
+ <KolSelect {...props} _options={groupedOptionsArray} _label="With grouped by first letter" _value="Albanien" />
121
+ </SampleBlock>
122
+ <SampleBlock {...block('grouped-multiple')}>
123
+ <KolSelect {...props} _options={groupedOptionsArray} _label="With grouped by first letter (multiple)" _multiple _value={['Albanien']} />
124
+ </SampleBlock>
85
125
  </div>
86
126
  );
87
127
  });
@@ -4,17 +4,16 @@ import { SelectCases } 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 SelectVariants = forwardRef<HTMLKolSelectElement, Components.KolSelect>(function SelectVariant(props, ref) {
8
9
  return (
9
10
  <SampleColumns>
10
- <fieldset>
11
- <legend>Text</legend>
12
- <SelectCases {...props} />
13
- </fieldset>
14
- <fieldset>
15
- <legend>Text (hideLabel)</legend>
16
- <SelectCases ref={ref} {...props} _hideLabel />
17
- </fieldset>
11
+ <SampleGroup heading="Text">
12
+ <SelectCases blockIdPrefix="label" {...props} />
13
+ </SampleGroup>
14
+ <SampleGroup heading="Text (hideLabel)">
15
+ <SelectCases blockIdPrefix="hide-label" snapshotOnly="error" ref={ref} {...props} _hideLabel />
16
+ </SampleGroup>
18
17
  </SampleColumns>
19
18
  );
20
19
  });
@@ -7,123 +7,157 @@ import { ERROR_MSG, HINT_MSG } from '../../../shares/constants';
7
7
  import type { Components, Option, StencilUnknown } from '@public-ui/components';
8
8
  import { COUNTRY_OPTIONS } from '../../../shares/country';
9
9
  import { LONG_OPTIONS } from '../../../shares/longOptions';
10
+ import { SampleBlock } from '../../SampleBlock';
10
11
 
11
- export const SingleSelectCases = (props: Components.KolSingleSelect) => {
12
+ type SingleSelectCasesProps = Components.KolSingleSelect & {
13
+ /** Prefixes the visual block ids so the same cases can be rendered more than once per route. */
14
+ blockIdPrefix: string;
15
+ /**
16
+ * Restricts the snapshots of this rendering to the case with this id; every other block is
17
+ * rendered with `skipSnapshot`. Used for the `_hideLabel` groups: hiding the label mainly
18
+ * changes how the message is laid out, so snapshotting every case a second time would only
19
+ * duplicate the labelled group.
20
+ */
21
+ snapshotOnly?: string;
22
+ };
23
+
24
+ export const SingleSelectCases = ({ blockIdPrefix, snapshotOnly, ...props }: SingleSelectCasesProps) => {
25
+ // Blocks outside `snapshotOnly` stay visible in the sample but are excluded from the snapshots.
26
+ const block = (caseId: string) => ({ id: `${blockIdPrefix}-${caseId}`, skipSnapshot: snapshotOnly !== undefined && caseId !== snapshotOnly });
12
27
  return (
13
28
  <div className="grid gap-4">
14
- <KolSingleSelect {...props} _hint={HINT_MSG} _label="Label" _options={COUNTRY_OPTIONS as Option<StencilUnknown>[]} _value={'de'} />
15
- <KolSingleSelect {...props} _label="Disabled" _options={COUNTRY_OPTIONS as Option<StencilUnknown>[]} _value={'de'} _disabled />
16
- <KolSingleSelect
17
- {...props}
18
- _options={COUNTRY_OPTIONS as Option<StencilUnknown>[]}
19
- _msg={{ _type: 'error', _description: ERROR_MSG }}
20
- _rows={3}
21
- _touched
22
- _label="Label"
23
- _placeholder="Placeholder"
24
- _required
25
- />
26
- <KolSingleSelect {...props} _label="With access key" _options={COUNTRY_OPTIONS as Option<StencilUnknown>[]} _value={'de'} _accessKey="c" />
27
- <KolSingleSelect {...props} _label="With short key" _options={COUNTRY_OPTIONS as Option<StencilUnknown>[]} _value={'de'} _shortKey="s" />
28
- <KolSingleSelect {...props} _label="With long labels" _options={LONG_OPTIONS as Option<StencilUnknown>[]} _placeholder="Placeholder" />
29
- <KolSingleSelect
30
- {...props}
31
- _label="With hidden clear button"
32
- _options={COUNTRY_OPTIONS as Option<StencilUnknown>[]}
33
- _value={'de'}
34
- _hasClearButton={false}
35
- />
36
- <KolSingleSelect
37
- {...props}
38
- _label="Boolean option values (Issue #9122)"
39
- _options={
40
- [
41
- { label: 'False', value: false },
42
- { label: 'True', value: true },
43
- ] as Option<StencilUnknown>[]
44
- }
45
- _value={false}
46
- />
47
- <KolSingleSelect
48
- {...props}
49
- _hint={HINT_MSG}
50
- _label="With disabled options"
51
- _options={
52
- [
53
- {
54
- value: 'bw',
55
- label: 'Baden-Württemberg',
56
- },
57
- {
58
- value: 'by',
59
- label: 'Bayern',
60
- disabled: true,
61
- },
62
- {
63
- value: 'be',
64
- label: 'Berlin',
65
- },
66
- {
67
- value: 'bb',
68
- label: 'Brandenburg',
69
- },
70
- {
71
- value: 'hb',
72
- label: 'Bremen',
73
- },
74
- {
75
- value: 'hh',
76
- label: 'Hamburg',
77
- },
78
- {
79
- value: 'he',
80
- label: 'Hessen',
81
- },
82
- {
83
- value: 'mv',
84
- label: 'Mecklenburg-Vorpommern',
85
- disabled: true,
86
- },
87
- {
88
- value: 'ni',
89
- label: 'Niedersachsen',
90
- disabled: true,
91
- },
92
- {
93
- value: 'nw',
94
- label: 'Nordrhein-Westfalen',
95
- },
96
- {
97
- value: 'rp',
98
- label: 'Rheinland-Pfalz',
99
- disabled: true,
100
- },
101
- {
102
- value: 'sl',
103
- label: 'Saarland',
104
- },
105
- {
106
- value: 'sn',
107
- label: 'Sachsen',
108
- },
109
- {
110
- value: 'st',
111
- label: 'Sachsen-Anhalt',
112
- disabled: true,
113
- },
114
- {
115
- value: 'sh',
116
- label: 'Schleswig-Holstein',
117
- disabled: true,
118
- },
119
- {
120
- value: 'th',
121
- label: 'Thüringen',
122
- },
123
- ] as Option<StencilUnknown>[]
124
- }
125
- _value={'be'}
126
- />
29
+ <SampleBlock {...block('hint')}>
30
+ <KolSingleSelect {...props} _hint={HINT_MSG} _label="Label" _options={COUNTRY_OPTIONS as Option<StencilUnknown>[]} _value={'de'} />
31
+ </SampleBlock>
32
+ <SampleBlock {...block('disabled')}>
33
+ <KolSingleSelect {...props} _label="Disabled" _options={COUNTRY_OPTIONS as Option<StencilUnknown>[]} _value={'de'} _disabled />
34
+ </SampleBlock>
35
+ <SampleBlock {...block('error')}>
36
+ <KolSingleSelect
37
+ {...props}
38
+ _options={COUNTRY_OPTIONS as Option<StencilUnknown>[]}
39
+ _msg={{ _type: 'error', _description: ERROR_MSG }}
40
+ _rows={3}
41
+ _touched
42
+ _label="Label"
43
+ _placeholder="Placeholder"
44
+ _required
45
+ _infoPopover={{ _label: 'hint', _content: 'Ich bin ein Hinweis.', _icons: 'kolicon-alert-info' }}
46
+ />
47
+ </SampleBlock>
48
+ <SampleBlock {...block('access-key')}>
49
+ <KolSingleSelect {...props} _label="With access key" _options={COUNTRY_OPTIONS as Option<StencilUnknown>[]} _value={'de'} _accessKey="c" />
50
+ </SampleBlock>
51
+ <SampleBlock {...block('short-key')}>
52
+ <KolSingleSelect {...props} _label="With short key" _options={COUNTRY_OPTIONS as Option<StencilUnknown>[]} _value={'de'} _shortKey="s" />
53
+ </SampleBlock>
54
+ <SampleBlock {...block('long-labels')}>
55
+ <KolSingleSelect {...props} _label="With long labels" _options={LONG_OPTIONS as Option<StencilUnknown>[]} _placeholder="Placeholder" />
56
+ </SampleBlock>
57
+ <SampleBlock {...block('no-clear-button')}>
58
+ <KolSingleSelect
59
+ {...props}
60
+ _label="With hidden clear button"
61
+ _options={COUNTRY_OPTIONS as Option<StencilUnknown>[]}
62
+ _value={'de'}
63
+ _hasClearButton={false}
64
+ />
65
+ </SampleBlock>
66
+ <SampleBlock {...block('boolean-values')}>
67
+ <KolSingleSelect
68
+ {...props}
69
+ _label="Boolean option values (Issue #9122)"
70
+ _options={
71
+ [
72
+ { label: 'False', value: false },
73
+ { label: 'True', value: true },
74
+ ] as Option<StencilUnknown>[]
75
+ }
76
+ _value={false}
77
+ />
78
+ </SampleBlock>
79
+ <SampleBlock {...block('disabled-options')}>
80
+ <KolSingleSelect
81
+ {...props}
82
+ _hint={HINT_MSG}
83
+ _label="With disabled options"
84
+ _options={
85
+ [
86
+ {
87
+ value: 'bw',
88
+ label: 'Baden-Württemberg',
89
+ },
90
+ {
91
+ value: 'by',
92
+ label: 'Bayern',
93
+ disabled: true,
94
+ },
95
+ {
96
+ value: 'be',
97
+ label: 'Berlin',
98
+ },
99
+ {
100
+ value: 'bb',
101
+ label: 'Brandenburg',
102
+ },
103
+ {
104
+ value: 'hb',
105
+ label: 'Bremen',
106
+ },
107
+ {
108
+ value: 'hh',
109
+ label: 'Hamburg',
110
+ },
111
+ {
112
+ value: 'he',
113
+ label: 'Hessen',
114
+ },
115
+ {
116
+ value: 'mv',
117
+ label: 'Mecklenburg-Vorpommern',
118
+ disabled: true,
119
+ },
120
+ {
121
+ value: 'ni',
122
+ label: 'Niedersachsen',
123
+ disabled: true,
124
+ },
125
+ {
126
+ value: 'nw',
127
+ label: 'Nordrhein-Westfalen',
128
+ },
129
+ {
130
+ value: 'rp',
131
+ label: 'Rheinland-Pfalz',
132
+ disabled: true,
133
+ },
134
+ {
135
+ value: 'sl',
136
+ label: 'Saarland',
137
+ },
138
+ {
139
+ value: 'sn',
140
+ label: 'Sachsen',
141
+ },
142
+ {
143
+ value: 'st',
144
+ label: 'Sachsen-Anhalt',
145
+ disabled: true,
146
+ },
147
+ {
148
+ value: 'sh',
149
+ label: 'Schleswig-Holstein',
150
+ disabled: true,
151
+ },
152
+ {
153
+ value: 'th',
154
+ label: 'Thüringen',
155
+ },
156
+ ] as Option<StencilUnknown>[]
157
+ }
158
+ _value={'be'}
159
+ />
160
+ </SampleBlock>
127
161
  </div>
128
162
  );
129
163
  };
@@ -2,19 +2,18 @@ import React from 'react';
2
2
 
3
3
  import type { Components } from '@public-ui/components';
4
4
  import { SampleColumns } from '../../SampleColumns';
5
+ import { SampleGroup } from '../../SampleGroup';
5
6
  import { SingleSelectCases } from './cases';
6
7
 
7
8
  export const SingleSelectVariants = (props: Components.KolSingleSelect) => {
8
9
  return (
9
10
  <SampleColumns>
10
- <fieldset>
11
- <legend>Text</legend>
12
- <SingleSelectCases {...props} />
13
- </fieldset>
14
- <fieldset>
15
- <legend>Text (hideLabel)</legend>
16
- <SingleSelectCases {...props} _hideLabel />
17
- </fieldset>
11
+ <SampleGroup heading="Text">
12
+ <SingleSelectCases blockIdPrefix="label" {...props} />
13
+ </SampleGroup>
14
+ <SampleGroup heading="Text (hideLabel)">
15
+ <SingleSelectCases blockIdPrefix="hide-label" snapshotOnly="error" {...props} _hideLabel />
16
+ </SampleGroup>
18
17
  </SampleColumns>
19
18
  );
20
19
  };
@@ -1,16 +1,47 @@
1
1
  import React from 'react';
2
2
 
3
- import { KolSpin } from '@public-ui/react-v19';
3
+ import { KolHeading, KolSpin } 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';
8
+ import './custom.css';
7
9
 
8
10
  export const SpinBasic: FC = () => (
9
11
  <>
10
12
  <SampleDescription>
11
- <p>KolSpin renders a loading indicator. This sample shows the default variant &quot;dot&quot;.</p>
13
+ <p>
14
+ KolSpin renders a loading indicator. It supports the variants &quot;dot&quot; (default) and &quot;cycle&quot;. With{' '}
15
+ <code>_variant=&quot;none&quot;</code> and the expert slot a custom animation can be used &ndash; custom animations are not necessarily barrier-free.
16
+ Color and size can be changed with the CSS properties <code>--kol-spin-color</code> and <code>--kol-spin-size</code>. The label (<code>_label</code>) is
17
+ only exposed to assistive technology, so it does not change the visual appearance.
18
+ </p>
12
19
  </SampleDescription>
13
20
 
14
- <KolSpin _show />
21
+ <div className="grid gap-8">
22
+ <SampleBlock id="basic" heading="Variant dot (default)" fitContent>
23
+ <KolSpin _show />
24
+ </SampleBlock>
25
+
26
+ <SampleBlock id="cycle" heading="Variant cycle" fitContent>
27
+ <KolSpin _show _variant="cycle" />
28
+ </SampleBlock>
29
+
30
+ <SampleBlock id="custom" heading="Custom animation (expert slot)" fitContent>
31
+ <KolSpin _show _variant="none">
32
+ <span slot="expert" className="loader"></span>
33
+ </KolSpin>
34
+ </SampleBlock>
35
+
36
+ <div>
37
+ <KolHeading _level={2} _label="With label (screen reader only)" />
38
+ <KolSpin _show _label="Loading data..." />
39
+ </div>
40
+
41
+ <div>
42
+ <KolHeading _level={2} _label="Custom color and size (CSS properties)" />
43
+ <KolSpin _show style={{ '--kol-spin-color': 'green', '--kol-spin-size': '80' }} />
44
+ </div>
45
+ </div>
15
46
  </>
16
47
  );
@@ -1,16 +1,8 @@
1
1
  import type { Routes } from '../../shares/types';
2
2
  import { SpinBasic } from './basic';
3
- import { SpinCustom } from './custom';
4
- import { SpinCycle } from './cycle';
5
- import { SpinLabel } from './label';
6
- import { SpinVariables } from './variables';
7
3
 
8
4
  export const SPIN_ROUTES: Routes = {
9
5
  spin: {
10
6
  basic: SpinBasic,
11
- cycle: SpinCycle,
12
- custom: SpinCustom,
13
- label: SpinLabel,
14
- variables: SpinVariables,
15
7
  },
16
8
  };
@@ -3,6 +3,7 @@ import React from 'react';
3
3
  import type { ToolbarItemsPropType } from '@public-ui/components';
4
4
  import { KolSplitButton, KolToolbar } from '@public-ui/react-v19';
5
5
  import { useToasterService } from '../../hooks/useToasterService';
6
+ import { SampleBlock } from '../SampleBlock';
6
7
  import { SampleDescription } from '../SampleDescription';
7
8
 
8
9
  import type { FC } from 'react';
@@ -43,11 +44,11 @@ export const SplitButtonBasic: FC = () => {
43
44
  </p>
44
45
  </SampleDescription>
45
46
 
46
- <div className="flex flex-col gap-4">
47
+ <SampleBlock id="basic" className="flex flex-col gap-4">
47
48
  <KolSplitButton _label="Edit" _on={dummyEventHandler}>
48
49
  <KolToolbar _label="Action toolbar" _items={TOOLBAR_ITEMS} _orientation="vertical" />
49
50
  </KolSplitButton>
50
- </div>
51
+ </SampleBlock>
51
52
  </>
52
53
  );
53
54
  };
@@ -2,6 +2,7 @@ import type { KoliBriTableHeaderCellWithLogic } from '@public-ui/components';
2
2
  import { KolTableStateful } from '@public-ui/react-v19';
3
3
  import type { FC } from 'react';
4
4
  import React from 'react';
5
+ import { SampleBlock } from '../SampleBlock';
5
6
  import { SampleDescription } from '../SampleDescription';
6
7
 
7
8
  type ProjectTask = {
@@ -98,8 +99,8 @@ export const TableActionColumns: FC = () => (
98
99
  </p>
99
100
  </SampleDescription>
100
101
 
101
- <section className="w-full">
102
+ <SampleBlock id="action-columns" className="w-full">
102
103
  <KolTableStateful _label="Tasks with action buttons" _headers={HEADERS} _data={DATA} className="block" />
103
- </section>
104
+ </SampleBlock>
104
105
  </>
105
106
  );