@public-ui/sample-react 2.1.0 → 2.1.2

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 (252) hide show
  1. package/dist/1016.js +2 -0
  2. package/dist/121.js +2 -0
  3. package/dist/1278.js +2 -0
  4. package/dist/{7163.js → 1443.js} +2 -2
  5. package/dist/149.js +2 -0
  6. package/dist/1524.js +2 -0
  7. package/dist/2072.js +2 -0
  8. package/dist/{3845.js → 2221.js} +2 -2
  9. package/dist/2252.js +2 -0
  10. package/dist/2256.js +2 -0
  11. package/dist/2381.js +2 -0
  12. package/dist/2416.js +2 -0
  13. package/dist/2545.js +2 -0
  14. package/dist/2615.js +2 -0
  15. package/dist/263.js +2 -0
  16. package/dist/{5399.js → 2639.js} +2 -2
  17. package/dist/2657.js +2 -0
  18. package/dist/2669.js +2 -0
  19. package/dist/277.js +2 -0
  20. package/dist/2858.js +2 -0
  21. package/dist/2879.js +2 -0
  22. package/dist/3110.js +2 -0
  23. package/dist/3261.js +2 -0
  24. package/dist/3353.js +2 -0
  25. package/dist/{8286.js → 3510.js} +2 -2
  26. package/dist/3563.js +2 -0
  27. package/dist/3869.js +2 -0
  28. package/dist/4014.js +2 -0
  29. package/dist/4082.js +2 -0
  30. package/dist/4156.js +2 -0
  31. package/dist/4177.js +2 -0
  32. package/dist/4178.js +2 -0
  33. package/dist/4179.js +2 -0
  34. package/dist/4212.js +2 -0
  35. package/dist/{1430.js → 4318.js} +2 -2
  36. package/dist/4346.js +2 -0
  37. package/dist/4486.js +2 -0
  38. package/dist/{4294.js → 4702.js} +2 -2
  39. package/dist/{8251.js → 4723.js} +2 -2
  40. package/dist/{8855.js → 4893.js} +2 -2
  41. package/dist/5018.js +2 -0
  42. package/dist/5157.js +2 -0
  43. package/dist/5244.js +2 -0
  44. package/dist/5350.js +2 -0
  45. package/dist/5599.js +2 -0
  46. package/dist/{7582.js → 5670.js} +2 -2
  47. package/dist/{5020.js → 5716.js} +2 -2
  48. package/dist/5973.js +2 -0
  49. package/dist/605.js +2 -0
  50. package/dist/{3460.js → 6284.js} +2 -2
  51. package/dist/6295.js +2 -0
  52. package/dist/6402.js +2 -0
  53. package/dist/6596.js +2 -0
  54. package/dist/6629.js +2 -0
  55. package/dist/6636.js +2 -0
  56. package/dist/6716.js +2 -0
  57. package/dist/{8471.js → 7055.js} +2 -2
  58. package/dist/7132.js +2 -0
  59. package/dist/{6971.js → 7219.js} +2 -2
  60. package/dist/7305.js +2 -0
  61. package/dist/7367.js +2 -0
  62. package/dist/7372.js +2 -0
  63. package/dist/7533.js +2 -0
  64. package/dist/7677.js +2 -0
  65. package/dist/8310.js +2 -0
  66. package/dist/8516.js +2 -0
  67. package/dist/8642.js +2 -0
  68. package/dist/8797.js +2 -0
  69. package/dist/8804.js +2 -0
  70. package/dist/8809.js +2 -0
  71. package/dist/8928.js +2 -0
  72. package/dist/{2462.js → 9031.js} +2 -2
  73. package/dist/{1396.js → 9116.js} +2 -2
  74. package/dist/9344.js +2 -0
  75. package/dist/9673.js +2 -0
  76. package/dist/9673.js.LICENSE.txt +3 -0
  77. package/dist/9730.js +2 -0
  78. package/dist/9730.js.LICENSE.txt +3 -0
  79. package/dist/main.css +1 -1
  80. package/dist/main.js +1 -1
  81. package/dist/main.js.LICENSE.txt +2 -2
  82. package/package.json +16 -16
  83. package/src/App.tsx +2 -0
  84. package/src/components/Sidebar.tsx +12 -8
  85. package/src/components/combobox/basic.tsx +13 -0
  86. package/src/components/combobox/partials/cases.tsx +38 -0
  87. package/src/components/combobox/partials/variants.tsx +19 -0
  88. package/src/components/combobox/routes.ts +8 -0
  89. package/src/components/form/basic.tsx +19 -0
  90. package/src/components/form/error-list.tsx +26 -0
  91. package/src/components/form/routes.ts +6 -1
  92. package/src/components/handout/basic.tsx +0 -7
  93. package/src/components/input-checkbox/partials/cases.tsx +7 -0
  94. package/src/components/input-number/partials/cases.tsx +4 -0
  95. package/src/components/input-password/show-password.tsx +19 -0
  96. package/src/components/input-text/partials/cases.tsx +3 -1
  97. package/src/components/pagination/basic.tsx +2 -2
  98. package/src/components/select/partials/cases.tsx +1 -14
  99. package/src/components/table/routes.ts +4 -0
  100. package/src/components/table/stateful-with-selection.tsx +78 -0
  101. package/src/components/table/stateless-with-selection.tsx +60 -0
  102. package/src/components/tabs/basic.tsx +5 -0
  103. package/src/components/textarea/partials/cases.tsx +3 -0
  104. package/src/components/toolbar/basic.tsx +48 -0
  105. package/src/components/toolbar/disabled.tsx +50 -0
  106. package/src/components/toolbar/routes.ts +10 -0
  107. package/src/react.main.tsx +2 -2
  108. package/src/scenarios/appointment-form/AppointmentForm.tsx +1 -2
  109. package/src/scenarios/appointment-form/AvailableAppointmentsForm.tsx +55 -49
  110. package/src/scenarios/appointment-form/DistrictForm.tsx +15 -9
  111. package/src/scenarios/appointment-form/PersonalInformationForm.tsx +18 -6
  112. package/src/scenarios/appointment-form/formUtils.ts +2 -4
  113. package/src/scenarios/inputs-get-value.tsx +109 -83
  114. package/src/shares/country.ts +18 -0
  115. package/src/shares/routes.ts +4 -2
  116. package/src/shares/theme.ts +2 -6
  117. package/webpack.config.js +3 -0
  118. package/dist/1266.js +0 -2
  119. package/dist/1601.js +0 -2
  120. package/dist/1786.js +0 -2
  121. package/dist/1797.js +0 -2
  122. package/dist/1832.js +0 -2
  123. package/dist/2441.js +0 -2
  124. package/dist/2605.js +0 -2
  125. package/dist/2728.js +0 -2
  126. package/dist/2960.js +0 -2
  127. package/dist/3492.js +0 -2
  128. package/dist/3503.js +0 -2
  129. package/dist/3801.js +0 -2
  130. package/dist/3882.js +0 -2
  131. package/dist/3965.js +0 -2
  132. package/dist/4181.js +0 -2
  133. package/dist/4604.js +0 -2
  134. package/dist/4737.js +0 -2
  135. package/dist/4972.js +0 -2
  136. package/dist/5076.js +0 -2
  137. package/dist/5204.js +0 -2
  138. package/dist/5398.js +0 -2
  139. package/dist/5514.js +0 -2
  140. package/dist/5522.js +0 -2
  141. package/dist/5677.js +0 -2
  142. package/dist/5781.js +0 -2
  143. package/dist/5813.js +0 -2
  144. package/dist/5829.js +0 -2
  145. package/dist/6320.js +0 -2
  146. package/dist/6324.js +0 -2
  147. package/dist/6473.js +0 -2
  148. package/dist/6567.js +0 -2
  149. package/dist/6649.js +0 -2
  150. package/dist/6717.js +0 -2
  151. package/dist/6731.js +0 -2
  152. package/dist/6809.js +0 -2
  153. package/dist/6974.js +0 -2
  154. package/dist/7157.js +0 -2
  155. package/dist/7162.js +0 -2
  156. package/dist/7183.js +0 -2
  157. package/dist/7310.js +0 -2
  158. package/dist/7391.js +0 -2
  159. package/dist/7461.js +0 -2
  160. package/dist/7560.js +0 -2
  161. package/dist/8100.js +0 -2
  162. package/dist/8116.js +0 -2
  163. package/dist/8126.js +0 -2
  164. package/dist/8210.js +0 -2
  165. package/dist/85.js +0 -2
  166. package/dist/8799.js +0 -2
  167. package/dist/8902.js +0 -2
  168. package/dist/8956.js +0 -2
  169. package/dist/92.js +0 -2
  170. package/dist/9558.js +0 -2
  171. package/dist/9768.js +0 -2
  172. package/dist/9818.js +0 -2
  173. package/dist/9849.js +0 -2
  174. package/dist/989.js +0 -2
  175. package/dist/9975.js +0 -2
  176. package/dist/9980.js +0 -2
  177. package/src/components/logo/basic.tsx +0 -15
  178. package/src/components/logo/routes.ts +0 -8
  179. /package/dist/{1266.js.LICENSE.txt → 1016.js.LICENSE.txt} +0 -0
  180. /package/dist/{1396.js.LICENSE.txt → 121.js.LICENSE.txt} +0 -0
  181. /package/dist/{1430.js.LICENSE.txt → 1278.js.LICENSE.txt} +0 -0
  182. /package/dist/{1601.js.LICENSE.txt → 1443.js.LICENSE.txt} +0 -0
  183. /package/dist/{1786.js.LICENSE.txt → 149.js.LICENSE.txt} +0 -0
  184. /package/dist/{1797.js.LICENSE.txt → 1524.js.LICENSE.txt} +0 -0
  185. /package/dist/{1832.js.LICENSE.txt → 2072.js.LICENSE.txt} +0 -0
  186. /package/dist/{2441.js.LICENSE.txt → 2221.js.LICENSE.txt} +0 -0
  187. /package/dist/{2462.js.LICENSE.txt → 2252.js.LICENSE.txt} +0 -0
  188. /package/dist/{2605.js.LICENSE.txt → 2256.js.LICENSE.txt} +0 -0
  189. /package/dist/{2728.js.LICENSE.txt → 2381.js.LICENSE.txt} +0 -0
  190. /package/dist/{2960.js.LICENSE.txt → 2416.js.LICENSE.txt} +0 -0
  191. /package/dist/{3460.js.LICENSE.txt → 2545.js.LICENSE.txt} +0 -0
  192. /package/dist/{3492.js.LICENSE.txt → 2615.js.LICENSE.txt} +0 -0
  193. /package/dist/{3503.js.LICENSE.txt → 263.js.LICENSE.txt} +0 -0
  194. /package/dist/{3801.js.LICENSE.txt → 2639.js.LICENSE.txt} +0 -0
  195. /package/dist/{3845.js.LICENSE.txt → 2657.js.LICENSE.txt} +0 -0
  196. /package/dist/{3882.js.LICENSE.txt → 2669.js.LICENSE.txt} +0 -0
  197. /package/dist/{3965.js.LICENSE.txt → 277.js.LICENSE.txt} +0 -0
  198. /package/dist/{4181.js.LICENSE.txt → 2858.js.LICENSE.txt} +0 -0
  199. /package/dist/{4294.js.LICENSE.txt → 2879.js.LICENSE.txt} +0 -0
  200. /package/dist/{4604.js.LICENSE.txt → 3110.js.LICENSE.txt} +0 -0
  201. /package/dist/{4737.js.LICENSE.txt → 3261.js.LICENSE.txt} +0 -0
  202. /package/dist/{4972.js.LICENSE.txt → 3353.js.LICENSE.txt} +0 -0
  203. /package/dist/{5020.js.LICENSE.txt → 3510.js.LICENSE.txt} +0 -0
  204. /package/dist/{5076.js.LICENSE.txt → 3563.js.LICENSE.txt} +0 -0
  205. /package/dist/{5204.js.LICENSE.txt → 3869.js.LICENSE.txt} +0 -0
  206. /package/dist/{5398.js.LICENSE.txt → 4014.js.LICENSE.txt} +0 -0
  207. /package/dist/{5399.js.LICENSE.txt → 4082.js.LICENSE.txt} +0 -0
  208. /package/dist/{5514.js.LICENSE.txt → 4156.js.LICENSE.txt} +0 -0
  209. /package/dist/{5522.js.LICENSE.txt → 4177.js.LICENSE.txt} +0 -0
  210. /package/dist/{5677.js.LICENSE.txt → 4178.js.LICENSE.txt} +0 -0
  211. /package/dist/{5781.js.LICENSE.txt → 4179.js.LICENSE.txt} +0 -0
  212. /package/dist/{5813.js.LICENSE.txt → 4212.js.LICENSE.txt} +0 -0
  213. /package/dist/{5829.js.LICENSE.txt → 4318.js.LICENSE.txt} +0 -0
  214. /package/dist/{6320.js.LICENSE.txt → 4346.js.LICENSE.txt} +0 -0
  215. /package/dist/{6324.js.LICENSE.txt → 4486.js.LICENSE.txt} +0 -0
  216. /package/dist/{6473.js.LICENSE.txt → 4702.js.LICENSE.txt} +0 -0
  217. /package/dist/{6567.js.LICENSE.txt → 4723.js.LICENSE.txt} +0 -0
  218. /package/dist/{6649.js.LICENSE.txt → 4893.js.LICENSE.txt} +0 -0
  219. /package/dist/{6717.js.LICENSE.txt → 5018.js.LICENSE.txt} +0 -0
  220. /package/dist/{6731.js.LICENSE.txt → 5157.js.LICENSE.txt} +0 -0
  221. /package/dist/{6809.js.LICENSE.txt → 5244.js.LICENSE.txt} +0 -0
  222. /package/dist/{6971.js.LICENSE.txt → 5350.js.LICENSE.txt} +0 -0
  223. /package/dist/{6974.js.LICENSE.txt → 5599.js.LICENSE.txt} +0 -0
  224. /package/dist/{7157.js.LICENSE.txt → 5670.js.LICENSE.txt} +0 -0
  225. /package/dist/{7162.js.LICENSE.txt → 5716.js.LICENSE.txt} +0 -0
  226. /package/dist/{7163.js.LICENSE.txt → 5973.js.LICENSE.txt} +0 -0
  227. /package/dist/{7183.js.LICENSE.txt → 605.js.LICENSE.txt} +0 -0
  228. /package/dist/{7310.js.LICENSE.txt → 6284.js.LICENSE.txt} +0 -0
  229. /package/dist/{7391.js.LICENSE.txt → 6295.js.LICENSE.txt} +0 -0
  230. /package/dist/{7461.js.LICENSE.txt → 6402.js.LICENSE.txt} +0 -0
  231. /package/dist/{7560.js.LICENSE.txt → 6596.js.LICENSE.txt} +0 -0
  232. /package/dist/{7582.js.LICENSE.txt → 6629.js.LICENSE.txt} +0 -0
  233. /package/dist/{8100.js.LICENSE.txt → 6636.js.LICENSE.txt} +0 -0
  234. /package/dist/{8116.js.LICENSE.txt → 6716.js.LICENSE.txt} +0 -0
  235. /package/dist/{8126.js.LICENSE.txt → 7055.js.LICENSE.txt} +0 -0
  236. /package/dist/{8210.js.LICENSE.txt → 7132.js.LICENSE.txt} +0 -0
  237. /package/dist/{8251.js.LICENSE.txt → 7219.js.LICENSE.txt} +0 -0
  238. /package/dist/{8286.js.LICENSE.txt → 7305.js.LICENSE.txt} +0 -0
  239. /package/dist/{8471.js.LICENSE.txt → 7367.js.LICENSE.txt} +0 -0
  240. /package/dist/{85.js.LICENSE.txt → 7372.js.LICENSE.txt} +0 -0
  241. /package/dist/{8799.js.LICENSE.txt → 7533.js.LICENSE.txt} +0 -0
  242. /package/dist/{8855.js.LICENSE.txt → 7677.js.LICENSE.txt} +0 -0
  243. /package/dist/{8902.js.LICENSE.txt → 8310.js.LICENSE.txt} +0 -0
  244. /package/dist/{8956.js.LICENSE.txt → 8516.js.LICENSE.txt} +0 -0
  245. /package/dist/{92.js.LICENSE.txt → 8642.js.LICENSE.txt} +0 -0
  246. /package/dist/{9558.js.LICENSE.txt → 8797.js.LICENSE.txt} +0 -0
  247. /package/dist/{9768.js.LICENSE.txt → 8804.js.LICENSE.txt} +0 -0
  248. /package/dist/{9818.js.LICENSE.txt → 8809.js.LICENSE.txt} +0 -0
  249. /package/dist/{9849.js.LICENSE.txt → 8928.js.LICENSE.txt} +0 -0
  250. /package/dist/{989.js.LICENSE.txt → 9031.js.LICENSE.txt} +0 -0
  251. /package/dist/{9975.js.LICENSE.txt → 9116.js.LICENSE.txt} +0 -0
  252. /package/dist/{9980.js.LICENSE.txt → 9344.js.LICENSE.txt} +0 -0
@@ -0,0 +1,50 @@
1
+ import type { FC } from 'react';
2
+ import React, { useContext } from 'react';
3
+ import { KolBadge, KolToolbar } from '@public-ui/react';
4
+ import { HideMenusContext } from '../../shares/HideMenusContext';
5
+
6
+ export const ToolbarDisabled: FC = () => {
7
+ const hideMenus = useContext(HideMenusContext);
8
+ return (
9
+ <>
10
+ {!hideMenus && <KolBadge className="block mb-3" _label="Component is a DRAFT - Don't use in production yet." _color="#db5461" />}
11
+ <KolToolbar
12
+ _label="Toolbar"
13
+ class="block w-fit"
14
+ _items={[
15
+ {
16
+ _label: 'Back',
17
+ _disabled: true,
18
+ _hideLabel: true,
19
+ _icons: {
20
+ left: {
21
+ icon: 'codicon codicon-arrow-left',
22
+ },
23
+ },
24
+ },
25
+ {
26
+ _label: 'Next',
27
+ _hideLabel: true,
28
+ _icons: {
29
+ right: {
30
+ icon: 'codicon codicon-arrow-right',
31
+ },
32
+ },
33
+ },
34
+ {
35
+ _href: '#',
36
+ _label: 'Simple Link 1',
37
+ },
38
+ {
39
+ _href: '#',
40
+ _disabled: true,
41
+ _label: 'Simple Link 3',
42
+ },
43
+ {
44
+ _label: 'Bold',
45
+ },
46
+ ]}
47
+ />
48
+ </>
49
+ );
50
+ };
@@ -0,0 +1,10 @@
1
+ import { Routes } from '../../shares/types';
2
+ import { ToolbarBasic } from './basic';
3
+ import { ToolbarDisabled } from './disabled';
4
+
5
+ export const TOOLBAR_ROUTES: Routes = {
6
+ toolbar: {
7
+ basic: ToolbarBasic,
8
+ disabled: ToolbarDisabled,
9
+ },
10
+ };
@@ -5,7 +5,7 @@ import { setTagNameTransformer } from '@public-ui/react';
5
5
 
6
6
  import { bootstrap } from '@public-ui/components';
7
7
  import { defineCustomElements } from '@public-ui/components/dist/loader';
8
- import { BMF, BStW, DEFAULT, ECL_EC, ECL_EU, ITZBund } from '@public-ui/themes';
8
+ import { BMF, DEFAULT, ECL_EC, ECL_EU, ITZBund } from '@public-ui/themes';
9
9
 
10
10
  import { App } from './App';
11
11
 
@@ -29,7 +29,7 @@ const getThemes = async () => {
29
29
  }
30
30
 
31
31
  /* List of regular sample app themes */
32
- return [BMF, BStW, DEFAULT, ECL_EC, ECL_EU, ITZBund] as Theme[];
32
+ return [BMF, DEFAULT, ECL_EC, ECL_EU, ITZBund] as Theme[];
33
33
  };
34
34
 
35
35
  void (async () => {
@@ -80,12 +80,11 @@ export function AppointmentForm() {
80
80
  }, [activeFormSection]);
81
81
 
82
82
  const handleSubmit = async (_values: FormValues, formik: FormikHelpers<FormValues>) => {
83
- console.log(_values, formik);
84
83
  const currentSectionIndex = formSectionSequence.indexOf(activeFormSection);
85
84
  const nextSection = formSectionSequence[currentSectionIndex + 1];
86
85
  if (nextSection !== undefined) {
87
86
  await formik.setTouched({});
88
- setTimeout(() => setActiveFormSection(nextSection), 1000);
87
+ setActiveFormSection(nextSection);
89
88
  }
90
89
  };
91
90
 
@@ -1,12 +1,12 @@
1
1
  import { Field, useFormikContext } from 'formik';
2
- import React, { useEffect, useState, useRef } from 'react';
2
+ import React, { useEffect, useState, useRef, useCallback } from 'react';
3
3
 
4
4
  import { KolButton, KolForm, KolHeading, KolInputDate, KolInputRadio, KolSpin } from '@public-ui/react';
5
5
 
6
6
  import { fetchAvailableTimes } from './appointmentService';
7
7
 
8
8
  import type { FormValues } from './AppointmentForm';
9
- import type { FieldProps } from 'formik';
9
+ import type { FieldProps, FieldInputProps } from 'formik';
10
10
  import type { Option } from '@public-ui/components';
11
11
  import { createErrorList, focusErrorList } from './formUtils';
12
12
 
@@ -23,7 +23,7 @@ export function AvailableAppointmentsForm() {
23
23
  let ignoreResponse = false;
24
24
  setAvailableTimes(null);
25
25
  if (schouldFocusErrorList && sectionSubmitted) {
26
- focusErrorList(errorList, formikRef);
26
+ focusErrorList(formikRef);
27
27
  setSchouldFocusErrorList(false);
28
28
  }
29
29
 
@@ -44,6 +44,26 @@ export function AvailableAppointmentsForm() {
44
44
  };
45
45
  }, [form.values.date, sectionSubmitted]);
46
46
 
47
+ const renderField = useCallback(
48
+ (name: string, node: (field: FieldInputProps<FormValues['date' | 'time']>) => void) => (
49
+ <Field name={name}>{({ field }: FieldProps<FormValues['date' | 'time']>) => node(field)}</Field>
50
+ ),
51
+ [],
52
+ );
53
+
54
+ const handleField = useCallback(
55
+ (name: string) => ({
56
+ onChange: (event: Event, value: unknown): void => {
57
+ if (event.target) {
58
+ void form.setFieldValue(name, value, true);
59
+ }
60
+ },
61
+ onBlur: () => {
62
+ void form.setFieldTouched(name, true);
63
+ },
64
+ }),
65
+ [form.setFieldValue, form.setFieldTouched],
66
+ );
47
67
  return (
48
68
  <div className="p-2">
49
69
  <KolHeading _level={2} _label="Wählen Sie einen Termin aus"></KolHeading>
@@ -54,59 +74,45 @@ export function AvailableAppointmentsForm() {
54
74
  onSubmit: () => {
55
75
  setSectionSubmitted(true);
56
76
  void form.submitForm();
57
- focusErrorList(errorList, formikRef);
77
+ focusErrorList(formikRef);
58
78
  },
59
79
  }}
60
80
  >
61
- <Field name="date">
62
- {({ field }: FieldProps<FormValues['date']>) => (
63
- <KolInputDate
64
- id="field-date"
65
- _label="Datum"
66
- _value={field.value}
67
- _error={form.errors.date || ''}
68
- _touched={form.touched.date}
69
- _required
70
- _on={{
71
- onChange: (event: Event, value: unknown): void => {
72
- if (event.target) {
73
- void form.setFieldValue('date', value, true);
74
- }
75
- },
76
- onBlur: () => {
77
- void form.setFieldTouched('date', true);
78
- },
79
- }}
80
- />
81
- )}
82
- </Field>
81
+ {renderField('date', (field) => (
82
+ <KolInputDate
83
+ id="field-date"
84
+ _label="Datum"
85
+ _value={field.value}
86
+ _msg={{
87
+ _type: 'error',
88
+ _description: form.errors.date || '',
89
+ }}
90
+ _touched={form.touched.date}
91
+ _required
92
+ _on={handleField('date')}
93
+ />
94
+ ))}
83
95
 
84
96
  {form.values.date && (
85
97
  <div className="grid gap-4 mt-4">
86
98
  {availableTimes ? (
87
99
  <>
88
- <Field name="time">
89
- {({ field }: FieldProps<FormValues['time']>) => (
90
- <KolInputRadio
91
- id="field-time"
92
- _label="Zeit"
93
- _orientation="horizontal"
94
- _options={availableTimes}
95
- _value={field.value}
96
- _error={form.errors.time || ''}
97
- _touched={form.touched.time}
98
- _required
99
- _on={{
100
- onChange: (event: Event, value: unknown): void => {
101
- if (event.target) {
102
- void form.setFieldTouched('time', true);
103
- void form.setFieldValue('time', value, true);
104
- }
105
- },
106
- }}
107
- />
108
- )}
109
- </Field>
100
+ {renderField('time', (field) => (
101
+ <KolInputRadio
102
+ id="field-time"
103
+ _label="Zeit"
104
+ _orientation="horizontal"
105
+ _options={availableTimes}
106
+ _value={field.value}
107
+ _msg={{
108
+ _type: 'error',
109
+ _description: form.errors.time || '',
110
+ }}
111
+ _touched={form.touched.time}
112
+ _required
113
+ _on={handleField('time')}
114
+ />
115
+ ))}
110
116
  <p>
111
117
  <em>Aus Testzwecken sind nur die Termine zu jeder halben Stunde verfügbar.</em>
112
118
  </p>
@@ -117,7 +123,7 @@ export function AvailableAppointmentsForm() {
117
123
  </div>
118
124
  )}
119
125
 
120
- <KolButton _label="Weiter" _type="submit" className="mt-2" _disabled={form.isValidating} />
126
+ <KolButton _label="Weiter" _type="submit" className="mt-2" />
121
127
  {form.values.date && form.isValidating ? <KolSpin _show aria-label="Termin wird geprüft." /> : ''}
122
128
  </KolForm>
123
129
  </div>
@@ -1,5 +1,5 @@
1
1
  import { Field, useFormikContext } from 'formik';
2
- import React, { useState, useRef, useEffect } from 'react';
2
+ import React, { useState, useRef } from 'react';
3
3
 
4
4
  import { KolButton, KolForm, KolHeading, KolSelect } from '@public-ui/react';
5
5
 
@@ -35,11 +35,6 @@ export function DistrictForm() {
35
35
  const errorList = createErrorList(form.errors);
36
36
  const [sectionSubmitted, setSectionSubmitted] = useState(false);
37
37
  const formikRef = useRef<HTMLKolFormElement>(null);
38
-
39
- useEffect(() => {
40
- focusErrorList(errorList, formikRef);
41
- }, [sectionSubmitted]);
42
-
43
38
  return (
44
39
  <div className="p-2">
45
40
  <KolHeading _level={2} _label="Wählen Sie einen Stadtteil aus"></KolHeading>
@@ -48,9 +43,16 @@ export function DistrictForm() {
48
43
  _errorList={sectionSubmitted ? errorList : []}
49
44
  _on={{
50
45
  onSubmit: () => {
51
- void form.submitForm();
52
46
  setSectionSubmitted(true);
53
- focusErrorList(errorList, formikRef);
47
+ form
48
+ .validateForm()
49
+ .then((res) => {
50
+ if (res && Object.keys(res).length > 0) throw Error();
51
+ void form.submitForm();
52
+ })
53
+ .catch(() => {
54
+ focusErrorList(formikRef);
55
+ });
54
56
  },
55
57
  }}
56
58
  >
@@ -61,7 +63,10 @@ export function DistrictForm() {
61
63
  _label="Stadtteil"
62
64
  _options={[{ label: 'Bitte wählen…', value: '' }, ...LOCATION_OPTIONS]}
63
65
  _value={[field.value]}
64
- _error={form.errors.district || ''}
66
+ _msg={{
67
+ _type: 'error',
68
+ _description: form.errors.district || '',
69
+ }}
65
70
  _touched={form.touched.district}
66
71
  _required
67
72
  onBlur={() => {
@@ -69,6 +74,7 @@ export function DistrictForm() {
69
74
  }}
70
75
  _on={{
71
76
  onChange: (event, values: unknown) => {
77
+ setSectionSubmitted(false);
72
78
  // Select und Radio setzen den Wert immer initial.
73
79
  if (event.target) {
74
80
  const [value] = values as [FormValues['district']];
@@ -33,7 +33,7 @@ export function PersonalInformationForm() {
33
33
  const formikRef = useRef(null);
34
34
 
35
35
  useEffect(() => {
36
- focusErrorList(errorList, formikRef);
36
+ focusErrorList(formikRef);
37
37
  }, [sectionSubmitted]);
38
38
  return (
39
39
  <div className="p-2">
@@ -45,7 +45,7 @@ export function PersonalInformationForm() {
45
45
  onSubmit: () => {
46
46
  void form.submitForm();
47
47
  setSectionSubmitted(true);
48
- focusErrorList(errorList, formikRef);
48
+ focusErrorList(formikRef);
49
49
  },
50
50
  }}
51
51
  >
@@ -58,7 +58,10 @@ export function PersonalInformationForm() {
58
58
  id="field-salutation"
59
59
  _label="Anrede"
60
60
  _value={[field.value]}
61
- _error={form.errors.salutation || ''}
61
+ _msg={{
62
+ _type: 'error',
63
+ _description: form.errors.salutation || '',
64
+ }}
62
65
  _touched={form.touched.salutation}
63
66
  _options={[{ label: 'Bitte wählen…', value: '' }, ...SALUTATION_OPTIONS]}
64
67
  _required
@@ -85,7 +88,10 @@ export function PersonalInformationForm() {
85
88
  id="field-company"
86
89
  _label="Firma"
87
90
  _value={field.value}
88
- _error={form.errors.company || ''}
91
+ _msg={{
92
+ _type: 'error',
93
+ _description: form.errors.company || '',
94
+ }}
89
95
  _touched={form.touched.company}
90
96
  _required
91
97
  _on={{
@@ -111,7 +117,10 @@ export function PersonalInformationForm() {
111
117
  id="field-name"
112
118
  _label="Vor- und Zuname"
113
119
  _value={field.value}
114
- _error={form.errors.name || ''}
120
+ _msg={{
121
+ _type: 'error',
122
+ _description: form.errors.name || '',
123
+ }}
115
124
  _touched={form.touched.name}
116
125
  _required
117
126
  _on={{
@@ -159,7 +168,10 @@ export function PersonalInformationForm() {
159
168
  _type="tel"
160
169
  _label="Telefonnumer"
161
170
  _value={field.value}
162
- _error={form.errors.phone || ''}
171
+ _msg={{
172
+ _type: 'error',
173
+ _description: form.errors.phone || '',
174
+ }}
163
175
  _touched={form.touched.phone}
164
176
  _on={{
165
177
  onChange: (event, value: unknown) => {
@@ -7,8 +7,6 @@ export function createErrorList(formikErrors: Record<string, string>): ErrorList
7
7
  }));
8
8
  }
9
9
 
10
- export function focusErrorList(errorList: ErrorListPropType[], formikRef: React.RefObject<HTMLKolFormElement>) {
11
- if (errorList.length > 0 && formikRef && formikRef.current) {
12
- formikRef.current.focusErrorList().catch(console.warn);
13
- }
10
+ export function focusErrorList(formikRef: React.RefObject<HTMLKolFormElement>) {
11
+ formikRef.current?.focusErrorList().catch(console.warn);
14
12
  }
@@ -4,6 +4,7 @@ import React, { createContext, useContext, useEffect, useMemo, useRef, useState
4
4
  import {
5
5
  KolButton,
6
6
  KolButtonLink,
7
+ KolCard,
7
8
  KolInputCheckbox,
8
9
  KolInputColor,
9
10
  KolInputDate,
@@ -22,6 +23,7 @@ import { SampleDescription } from '../components/SampleDescription';
22
23
 
23
24
  import type { HTMLStencilElement } from '@stencil/core/internal';
24
25
  const EventTargetContext = createContext<EventTarget | undefined>(undefined);
26
+ const EventLoggerActiveContext = createContext<boolean>(false);
25
27
 
26
28
  type Props = {
27
29
  InputComponent: React.ComponentType<any>;
@@ -33,6 +35,7 @@ const Scenario = (props: Props) => {
33
35
  const [value, setValue] = useState<unknown>(undefined);
34
36
  const formatter = props.formatter || JSON.stringify;
35
37
  const eventTarget = useContext(EventTargetContext);
38
+ const eventLoggerActive = useContext(EventLoggerActiveContext);
36
39
 
37
40
  const handleButtonClick = async () => {
38
41
  setValue(await ref.current?.getValue());
@@ -49,9 +52,20 @@ const Scenario = (props: Props) => {
49
52
  };
50
53
  }, [eventTarget]);
51
54
 
55
+ const eventListeners = Object.fromEntries(
56
+ ['onInput', 'onChange', 'onBlur', 'onClick', 'onFocus', 'onMouseDown'].map((eventName) => [
57
+ eventName,
58
+ (event, value) => {
59
+ if (eventLoggerActive) {
60
+ console.log(props.inputProps._label, eventName, value, event);
61
+ }
62
+ },
63
+ ]),
64
+ );
65
+
52
66
  return (
53
67
  <div className="grid grid-cols-3 items-end gap-4">
54
- <props.InputComponent ref={ref} {...props.inputProps} />
68
+ <props.InputComponent ref={ref} _on={eventListeners} {...props.inputProps} />
55
69
  <KolButton
56
70
  _label="getValue()"
57
71
  _on={{
@@ -67,96 +81,108 @@ const Scenario = (props: Props) => {
67
81
 
68
82
  export const InputsGetValue: FC = () => {
69
83
  const eventTarget = useMemo(() => new EventTarget(), []);
84
+ const [eventLoggerActive, setEventLoggerActive] = useState<boolean>(true);
70
85
 
71
86
  return (
72
87
  <>
73
88
  <EventTargetContext.Provider value={eventTarget}>
74
- <SampleDescription>
75
- <p>
76
- This sample show how the input components <code>getValue()</code> method works. It&apos;s called when clicking the &quot;getValue()&quot; button and
77
- prints the current value right next to itself.
78
- </p>
79
- </SampleDescription>
89
+ <EventLoggerActiveContext.Provider value={eventLoggerActive}>
90
+ <SampleDescription>
91
+ <p>
92
+ This sample show how the input components <code>getValue()</code> method works. It&apos;s called when clicking the &quot;getValue()&quot; button
93
+ and prints the current value right next to itself.
94
+ </p>
95
+ </SampleDescription>
80
96
 
81
- <div className="grid gap-4">
82
- <Scenario InputComponent={KolInputText} inputProps={{ _label: 'InputText' }} />
83
- <Scenario InputComponent={KolInputCheckbox} inputProps={{ _label: 'KolInputCheckbox' }} />
84
- <Scenario InputComponent={KolInputColor} inputProps={{ _label: 'KolInputColor' }} />
85
- <Scenario InputComponent={KolInputDate} inputProps={{ _label: 'KolInputDate' }} />
86
- <Scenario InputComponent={KolInputEmail} inputProps={{ _label: 'KolInputEmail' }} />
87
- <Scenario
88
- InputComponent={KolInputFile}
89
- inputProps={{ _label: 'KolInputFile' }}
90
- formatter={(value) =>
91
- value instanceof FileList
92
- ? `FileList{${Array.from(value)
93
- .map((file: File) => file.name)
94
- .join(', ')}}`
95
- : JSON.stringify(value)
96
- }
97
- />
98
- <Scenario InputComponent={KolInputNumber} inputProps={{ _label: 'KolInputNumber' }} />
99
- <Scenario InputComponent={KolInputPassword} inputProps={{ _label: 'KolInputPassword' }} />
100
- <Scenario InputComponent={KolInputRange} inputProps={{ _label: 'KolInputRange' }} />
101
- <Scenario
102
- InputComponent={KolInputRadio}
103
- inputProps={{
104
- _label: 'KolInputRadio',
105
- _orientation: 'horizontal',
106
- _options: [
107
- { label: 'New York', value: 'New York' },
108
- { label: 'Rio de Janeiro', value: 'Rio de Janeiro' },
109
- { label: 'Rosenheim', value: 'Rosenheim' },
110
- ],
111
- _value: 'New York',
112
- }}
113
- />
114
- <Scenario
115
- InputComponent={KolSelect}
116
- inputProps={{
117
- _label: 'KolSelect',
118
- _options: [
119
- { label: 'New York', value: 'New York' },
120
- { label: 'Rio de Janeiro', value: 'Rio de Janeiro' },
121
- { label: 'Rosenheim', value: 'Rosenheim' },
122
- ],
123
- }}
124
- />
125
- <Scenario
126
- InputComponent={KolTextarea}
127
- inputProps={{
128
- _label: 'KolTextarea',
129
- }}
130
- />
131
- <Scenario
132
- InputComponent={KolButton}
133
- inputProps={{
134
- _label: 'KolButton',
135
- _variant: 'ghost',
136
- _value: 'KolButton value',
137
- }}
138
- />
139
- <Scenario
140
- InputComponent={KolButtonLink}
141
- inputProps={{
142
- _label: 'KolButtonLink',
143
- _value: 'KolButtonLink value',
144
- }}
145
- />
97
+ <KolCard _label="Sample options" className="block ha mb-8">
98
+ <KolInputCheckbox
99
+ _label="Log events to console"
100
+ _value={true}
101
+ _checked={eventLoggerActive}
102
+ _on={{ onChange: (_, active) => setEventLoggerActive(active as boolean) }}
103
+ />
104
+ </KolCard>
146
105
 
147
- <div className="grid grid-cols-3 gap-4">
148
- <div></div>
149
- <KolButton
150
- _label="Run all"
151
- _variant="primary"
152
- _on={{
153
- onClick: () => {
154
- eventTarget.dispatchEvent(new Event('runAll'));
155
- },
106
+ <div className="grid gap-4">
107
+ <Scenario InputComponent={KolInputText} inputProps={{ _label: 'InputText' }} />
108
+ <Scenario InputComponent={KolInputCheckbox} inputProps={{ _label: 'KolInputCheckbox' }} />
109
+ <Scenario InputComponent={KolInputColor} inputProps={{ _label: 'KolInputColor' }} />
110
+ <Scenario InputComponent={KolInputDate} inputProps={{ _label: 'KolInputDate' }} />
111
+ <Scenario InputComponent={KolInputEmail} inputProps={{ _label: 'KolInputEmail' }} />
112
+ <Scenario
113
+ InputComponent={KolInputFile}
114
+ inputProps={{ _label: 'KolInputFile' }}
115
+ formatter={(value) =>
116
+ value instanceof FileList
117
+ ? `FileList{${Array.from(value)
118
+ .map((file: File) => file.name)
119
+ .join(', ')}}`
120
+ : JSON.stringify(value)
121
+ }
122
+ />
123
+ <Scenario InputComponent={KolInputNumber} inputProps={{ _label: 'KolInputNumber' }} />
124
+ <Scenario InputComponent={KolInputPassword} inputProps={{ _label: 'KolInputPassword' }} />
125
+ <Scenario InputComponent={KolInputRange} inputProps={{ _label: 'KolInputRange' }} />
126
+ <Scenario
127
+ InputComponent={KolInputRadio}
128
+ inputProps={{
129
+ _label: 'KolInputRadio',
130
+ _orientation: 'horizontal',
131
+ _options: [
132
+ { label: 'New York', value: 'New York' },
133
+ { label: 'Rio de Janeiro', value: 'Rio de Janeiro' },
134
+ { label: 'Rosenheim', value: 'Rosenheim' },
135
+ ],
136
+ _value: 'New York',
137
+ }}
138
+ />
139
+ <Scenario
140
+ InputComponent={KolSelect}
141
+ inputProps={{
142
+ _label: 'KolSelect',
143
+ _options: [
144
+ { label: 'New York', value: 'New York' },
145
+ { label: 'Rio de Janeiro', value: 'Rio de Janeiro' },
146
+ { label: 'Rosenheim', value: 'Rosenheim' },
147
+ ],
148
+ }}
149
+ />
150
+ <Scenario
151
+ InputComponent={KolTextarea}
152
+ inputProps={{
153
+ _label: 'KolTextarea',
156
154
  }}
157
- ></KolButton>
155
+ />
156
+ <Scenario
157
+ InputComponent={KolButton}
158
+ inputProps={{
159
+ _label: 'KolButton',
160
+ _variant: 'ghost',
161
+ _value: 'KolButton value',
162
+ }}
163
+ />
164
+ <Scenario
165
+ InputComponent={KolButtonLink}
166
+ inputProps={{
167
+ _label: 'KolButtonLink',
168
+ _value: 'KolButtonLink value',
169
+ }}
170
+ />
171
+
172
+ <div className="grid grid-cols-3 gap-4">
173
+ <div></div>
174
+ <KolButton
175
+ _label="Run all"
176
+ _variant="primary"
177
+ _on={{
178
+ onClick: () => {
179
+ eventTarget.dispatchEvent(new Event('runAll'));
180
+ },
181
+ }}
182
+ ></KolButton>
183
+ </div>
158
184
  </div>
159
- </div>
185
+ </EventLoggerActiveContext.Provider>
160
186
  </EventTargetContext.Provider>
161
187
  </>
162
188
  );
@@ -0,0 +1,18 @@
1
+ import { SelectOption } from '@public-ui/components';
2
+ import countries from 'world_countries_lists/data/countries/de/countries.json';
3
+
4
+ type Country = {
5
+ id: number;
6
+ alpha2: string;
7
+ alpha3: string;
8
+ name: string;
9
+ };
10
+
11
+ export const COUNTRY_OPTIONS: SelectOption<string>[] = [
12
+ ...(countries as Country[]).map((country) => ({
13
+ label: country.name,
14
+ value: country.alpha2,
15
+ })),
16
+ ];
17
+
18
+ export const COUNTRY_SUGGESTIONS: string[] = [...(countries as Country[]).map((country) => country.name)];
@@ -29,7 +29,6 @@ import { KOLIBRI_ROUTES } from '../components/kolibri/routes';
29
29
  import { LINK_BUTTON_ROUTES } from '../components/link-button/routes';
30
30
  import { LINK_GROUP_ROUTES } from '../components/link-group/routes';
31
31
  import { LINK_ROUTES } from '../components/link/routes';
32
- import { LOGO_ROUTES } from '../components/logo/routes';
33
32
  import { MODAL_ROUTES } from '../components/modal/routes';
34
33
  import { NAV_ROUTES } from '../components/nav/routes';
35
34
  import { PAGINATION_ROUTES } from '../components/pagination/routes';
@@ -43,10 +42,12 @@ import { TABLE_ROUTES } from '../components/table/routes';
43
42
  import { TABS_ROUTES } from '../components/tabs/routes';
44
43
  import { TEXTAREA_ROUTES } from '../components/textarea/routes';
45
44
  import { TOAST_ROUTES } from '../components/toast/routes';
45
+ import { TOOLBAR_ROUTES } from '../components/toolbar/routes';
46
46
  import { VERSION_ROUTES } from '../components/version/routes';
47
47
  import { SCENARIO_ROUTES } from '../scenarios/routes';
48
48
  import { Routes } from './types';
49
49
  import { TREE_ROUTES } from '../components/tree/routes';
50
+ import { COMBOBOX_ROUTES } from '../components/combobox/routes';
50
51
 
51
52
  export const ROUTES: Routes = {
52
53
  ...HANDOUT_ROUTES,
@@ -60,6 +61,7 @@ export const ROUTES: Routes = {
60
61
  ...BUTTON_LINK_ROUTES,
61
62
  ...BUTTON_ROUTES,
62
63
  ...CARD_ROUTES,
64
+ ...COMBOBOX_ROUTES,
63
65
  ...DETAILS_ROUTES,
64
66
  ...FORM_ROUTES,
65
67
  ...HEADING_ROUTES,
@@ -80,7 +82,6 @@ export const ROUTES: Routes = {
80
82
  ...LINK_BUTTON_ROUTES,
81
83
  ...LINK_GROUP_ROUTES,
82
84
  ...LINK_ROUTES,
83
- ...LOGO_ROUTES,
84
85
  ...MODAL_ROUTES,
85
86
  ...NAV_ROUTES,
86
87
  ...PAGINATION_ROUTES,
@@ -95,6 +96,7 @@ export const ROUTES: Routes = {
95
96
  ...TABS_ROUTES,
96
97
  ...TEXTAREA_ROUTES,
97
98
  ...TOAST_ROUTES,
99
+ ...TOOLBAR_ROUTES,
98
100
  ...TREE_ROUTES,
99
101
  ...VERSION_ROUTES,
100
102
  ...SCENARIO_ROUTES,