@public-ui/sample-react 2.0.15 → 2.1.1

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 (235) hide show
  1. package/dist/1011.js +2 -0
  2. package/dist/1174.js +2 -0
  3. package/dist/1353.js +2 -0
  4. package/dist/142.js +2 -0
  5. package/dist/{8251.js → 1423.js} +2 -2
  6. package/dist/1499.js +2 -0
  7. package/dist/1600.js +2 -0
  8. package/dist/1602.js +2 -0
  9. package/dist/{5114.js → 1847.js} +2 -2
  10. package/dist/1990.js +2 -0
  11. package/dist/21.js +2 -0
  12. package/dist/2268.js +2 -0
  13. package/dist/2385.js +2 -0
  14. package/dist/2602.js +2 -0
  15. package/dist/{3460.js → 2680.js} +2 -2
  16. package/dist/{5020.js → 2872.js} +2 -2
  17. package/dist/310.js +2 -0
  18. package/dist/3129.js +2 -0
  19. package/dist/356.js +2 -0
  20. package/dist/372.js +2 -0
  21. package/dist/3793.js +2 -0
  22. package/dist/3830.js +2 -0
  23. package/dist/{8471.js → 4091.js} +2 -2
  24. package/dist/{7582.js → 4178.js} +2 -2
  25. package/dist/4185.js +2 -0
  26. package/dist/{8210.js → 4222.js} +2 -2
  27. package/dist/4258.js +2 -0
  28. package/dist/{4294.js → 4322.js} +2 -2
  29. package/dist/{8100.js → 4504.js} +2 -2
  30. package/dist/4774.js +2 -0
  31. package/dist/4913.js +2 -0
  32. package/dist/5185.js +2 -0
  33. package/dist/{8286.js → 5226.js} +2 -2
  34. package/dist/5445.js +2 -0
  35. package/dist/{6971.js → 5527.js} +2 -2
  36. package/dist/5672.js +2 -0
  37. package/dist/{7163.js → 5687.js} +2 -2
  38. package/dist/5797.js +2 -0
  39. package/dist/{5813.js → 5817.js} +2 -2
  40. package/dist/5893.js +2 -0
  41. package/dist/5896.js +2 -0
  42. package/dist/61.js +2 -0
  43. package/dist/6200.js +2 -0
  44. package/dist/6629.js +2 -0
  45. package/dist/6670.js +2 -0
  46. package/dist/6681.js +2 -0
  47. package/dist/6717.js +1 -1
  48. package/dist/682.js +2 -0
  49. package/dist/6856.js +2 -0
  50. package/dist/6916.js +2 -0
  51. package/dist/{1430.js → 7090.js} +2 -2
  52. package/dist/742.js +2 -0
  53. package/dist/{8799.js → 7483.js} +2 -2
  54. package/dist/{3845.js → 7785.js} +2 -2
  55. package/dist/7890.js +2 -0
  56. package/dist/7944.js +2 -0
  57. package/dist/7977.js +2 -0
  58. package/dist/8157.js +2 -0
  59. package/dist/8185.js +2 -0
  60. package/dist/{92.js → 8320.js} +2 -2
  61. package/dist/8691.js +2 -0
  62. package/dist/8730.js +2 -0
  63. package/dist/8780.js +2 -0
  64. package/dist/8881.js +2 -0
  65. package/dist/8911.js +2 -0
  66. package/dist/9091.js +2 -0
  67. package/dist/9171.js +2 -0
  68. package/dist/9244.js +2 -0
  69. package/dist/9268.js +2 -0
  70. package/dist/9283.js +2 -0
  71. package/dist/{1396.js → 9560.js} +2 -2
  72. package/dist/968.js +2 -0
  73. package/dist/9800.js +2 -0
  74. package/dist/9836.js +2 -0
  75. package/dist/9836.js.LICENSE.txt +3 -0
  76. package/dist/9913.js +2 -0
  77. package/dist/9913.js.LICENSE.txt +3 -0
  78. package/dist/9947.js +2 -0
  79. package/dist/9947.js.LICENSE.txt +3 -0
  80. package/dist/main.css +1 -1
  81. package/dist/main.js +1 -1
  82. package/package.json +5 -5
  83. package/src/components/SampleDescription.tsx +12 -9
  84. package/src/components/combobox/basic.tsx +13 -0
  85. package/src/components/combobox/partials/cases.tsx +38 -0
  86. package/src/components/combobox/partials/variants.tsx +19 -0
  87. package/src/components/combobox/routes.ts +8 -0
  88. package/src/components/input-checkbox/partials/cases.tsx +7 -0
  89. package/src/components/input-number/partials/cases.tsx +4 -0
  90. package/src/components/input-password/show-password.tsx +19 -0
  91. package/src/components/input-text/partials/cases.tsx +3 -1
  92. package/src/components/select/partials/cases.tsx +1 -14
  93. package/src/components/table/routes.ts +2 -0
  94. package/src/components/table/stateless-with-selection.tsx +60 -0
  95. package/src/components/textarea/partials/cases.tsx +3 -0
  96. package/src/components/toolbar/basic.tsx +48 -0
  97. package/src/components/toolbar/disabled.tsx +50 -0
  98. package/src/components/toolbar/routes.ts +10 -0
  99. package/src/react.main.tsx +2 -2
  100. package/src/scenarios/appointment-form/AppointmentForm.tsx +1 -2
  101. package/src/scenarios/appointment-form/AvailableAppointmentsForm.tsx +55 -49
  102. package/src/scenarios/appointment-form/DistrictForm.tsx +15 -9
  103. package/src/scenarios/appointment-form/PersonalInformationForm.tsx +18 -6
  104. package/src/scenarios/appointment-form/formUtils.ts +2 -4
  105. package/src/scenarios/inputs-get-value.tsx +109 -83
  106. package/src/shares/constants.ts +1 -0
  107. package/src/shares/country.ts +18 -0
  108. package/src/shares/routes.ts +4 -0
  109. package/src/shares/theme.ts +2 -6
  110. package/dist/1266.js +0 -2
  111. package/dist/1601.js +0 -2
  112. package/dist/1786.js +0 -2
  113. package/dist/1797.js +0 -2
  114. package/dist/1832.js +0 -2
  115. package/dist/200.js +0 -2
  116. package/dist/2441.js +0 -2
  117. package/dist/2462.js +0 -2
  118. package/dist/2605.js +0 -2
  119. package/dist/2728.js +0 -2
  120. package/dist/2960.js +0 -2
  121. package/dist/3492.js +0 -2
  122. package/dist/3503.js +0 -2
  123. package/dist/3838.js +0 -2
  124. package/dist/3882.js +0 -2
  125. package/dist/3965.js +0 -2
  126. package/dist/4181.js +0 -2
  127. package/dist/4604.js +0 -2
  128. package/dist/4737.js +0 -2
  129. package/dist/4972.js +0 -2
  130. package/dist/5076.js +0 -2
  131. package/dist/5204.js +0 -2
  132. package/dist/5399.js +0 -2
  133. package/dist/5514.js +0 -2
  134. package/dist/5522.js +0 -2
  135. package/dist/5677.js +0 -2
  136. package/dist/5781.js +0 -2
  137. package/dist/5829.js +0 -2
  138. package/dist/6320.js +0 -2
  139. package/dist/6473.js +0 -2
  140. package/dist/648.js +0 -2
  141. package/dist/6531.js +0 -2
  142. package/dist/6567.js +0 -2
  143. package/dist/6649.js +0 -2
  144. package/dist/6731.js +0 -2
  145. package/dist/6974.js +0 -2
  146. package/dist/7157.js +0 -2
  147. package/dist/7162.js +0 -2
  148. package/dist/7183.js +0 -2
  149. package/dist/7310.js +0 -2
  150. package/dist/7391.js +0 -2
  151. package/dist/7461.js +0 -2
  152. package/dist/7560.js +0 -2
  153. package/dist/8116.js +0 -2
  154. package/dist/8126.js +0 -2
  155. package/dist/85.js +0 -2
  156. package/dist/8902.js +0 -2
  157. package/dist/8956.js +0 -2
  158. package/dist/9558.js +0 -2
  159. package/dist/9768.js +0 -2
  160. package/dist/9818.js +0 -2
  161. package/dist/9849.js +0 -2
  162. package/dist/989.js +0 -2
  163. package/dist/9980.js +0 -2
  164. /package/dist/{1266.js.LICENSE.txt → 1011.js.LICENSE.txt} +0 -0
  165. /package/dist/{1396.js.LICENSE.txt → 1174.js.LICENSE.txt} +0 -0
  166. /package/dist/{1430.js.LICENSE.txt → 1353.js.LICENSE.txt} +0 -0
  167. /package/dist/{1601.js.LICENSE.txt → 142.js.LICENSE.txt} +0 -0
  168. /package/dist/{1786.js.LICENSE.txt → 1423.js.LICENSE.txt} +0 -0
  169. /package/dist/{1797.js.LICENSE.txt → 1499.js.LICENSE.txt} +0 -0
  170. /package/dist/{1832.js.LICENSE.txt → 1600.js.LICENSE.txt} +0 -0
  171. /package/dist/{200.js.LICENSE.txt → 1602.js.LICENSE.txt} +0 -0
  172. /package/dist/{2441.js.LICENSE.txt → 1847.js.LICENSE.txt} +0 -0
  173. /package/dist/{2462.js.LICENSE.txt → 1990.js.LICENSE.txt} +0 -0
  174. /package/dist/{2605.js.LICENSE.txt → 21.js.LICENSE.txt} +0 -0
  175. /package/dist/{2728.js.LICENSE.txt → 2268.js.LICENSE.txt} +0 -0
  176. /package/dist/{2960.js.LICENSE.txt → 2385.js.LICENSE.txt} +0 -0
  177. /package/dist/{3460.js.LICENSE.txt → 2602.js.LICENSE.txt} +0 -0
  178. /package/dist/{3492.js.LICENSE.txt → 2680.js.LICENSE.txt} +0 -0
  179. /package/dist/{3503.js.LICENSE.txt → 2872.js.LICENSE.txt} +0 -0
  180. /package/dist/{3838.js.LICENSE.txt → 310.js.LICENSE.txt} +0 -0
  181. /package/dist/{3845.js.LICENSE.txt → 3129.js.LICENSE.txt} +0 -0
  182. /package/dist/{3882.js.LICENSE.txt → 356.js.LICENSE.txt} +0 -0
  183. /package/dist/{3965.js.LICENSE.txt → 372.js.LICENSE.txt} +0 -0
  184. /package/dist/{4181.js.LICENSE.txt → 3793.js.LICENSE.txt} +0 -0
  185. /package/dist/{4294.js.LICENSE.txt → 3830.js.LICENSE.txt} +0 -0
  186. /package/dist/{4604.js.LICENSE.txt → 4091.js.LICENSE.txt} +0 -0
  187. /package/dist/{4737.js.LICENSE.txt → 4178.js.LICENSE.txt} +0 -0
  188. /package/dist/{4972.js.LICENSE.txt → 4185.js.LICENSE.txt} +0 -0
  189. /package/dist/{5020.js.LICENSE.txt → 4222.js.LICENSE.txt} +0 -0
  190. /package/dist/{5076.js.LICENSE.txt → 4258.js.LICENSE.txt} +0 -0
  191. /package/dist/{5114.js.LICENSE.txt → 4322.js.LICENSE.txt} +0 -0
  192. /package/dist/{5204.js.LICENSE.txt → 4504.js.LICENSE.txt} +0 -0
  193. /package/dist/{5399.js.LICENSE.txt → 4774.js.LICENSE.txt} +0 -0
  194. /package/dist/{5514.js.LICENSE.txt → 4913.js.LICENSE.txt} +0 -0
  195. /package/dist/{5522.js.LICENSE.txt → 5185.js.LICENSE.txt} +0 -0
  196. /package/dist/{5677.js.LICENSE.txt → 5226.js.LICENSE.txt} +0 -0
  197. /package/dist/{5781.js.LICENSE.txt → 5445.js.LICENSE.txt} +0 -0
  198. /package/dist/{5813.js.LICENSE.txt → 5527.js.LICENSE.txt} +0 -0
  199. /package/dist/{5829.js.LICENSE.txt → 5672.js.LICENSE.txt} +0 -0
  200. /package/dist/{6320.js.LICENSE.txt → 5687.js.LICENSE.txt} +0 -0
  201. /package/dist/{6473.js.LICENSE.txt → 5797.js.LICENSE.txt} +0 -0
  202. /package/dist/{648.js.LICENSE.txt → 5817.js.LICENSE.txt} +0 -0
  203. /package/dist/{6531.js.LICENSE.txt → 5893.js.LICENSE.txt} +0 -0
  204. /package/dist/{6567.js.LICENSE.txt → 5896.js.LICENSE.txt} +0 -0
  205. /package/dist/{6649.js.LICENSE.txt → 61.js.LICENSE.txt} +0 -0
  206. /package/dist/{6731.js.LICENSE.txt → 6200.js.LICENSE.txt} +0 -0
  207. /package/dist/{6971.js.LICENSE.txt → 6629.js.LICENSE.txt} +0 -0
  208. /package/dist/{6974.js.LICENSE.txt → 6670.js.LICENSE.txt} +0 -0
  209. /package/dist/{7157.js.LICENSE.txt → 6681.js.LICENSE.txt} +0 -0
  210. /package/dist/{7162.js.LICENSE.txt → 682.js.LICENSE.txt} +0 -0
  211. /package/dist/{7163.js.LICENSE.txt → 6856.js.LICENSE.txt} +0 -0
  212. /package/dist/{7183.js.LICENSE.txt → 6916.js.LICENSE.txt} +0 -0
  213. /package/dist/{7310.js.LICENSE.txt → 7090.js.LICENSE.txt} +0 -0
  214. /package/dist/{7391.js.LICENSE.txt → 742.js.LICENSE.txt} +0 -0
  215. /package/dist/{7461.js.LICENSE.txt → 7483.js.LICENSE.txt} +0 -0
  216. /package/dist/{7560.js.LICENSE.txt → 7785.js.LICENSE.txt} +0 -0
  217. /package/dist/{7582.js.LICENSE.txt → 7890.js.LICENSE.txt} +0 -0
  218. /package/dist/{8100.js.LICENSE.txt → 7944.js.LICENSE.txt} +0 -0
  219. /package/dist/{8116.js.LICENSE.txt → 7977.js.LICENSE.txt} +0 -0
  220. /package/dist/{8126.js.LICENSE.txt → 8157.js.LICENSE.txt} +0 -0
  221. /package/dist/{8210.js.LICENSE.txt → 8185.js.LICENSE.txt} +0 -0
  222. /package/dist/{8251.js.LICENSE.txt → 8320.js.LICENSE.txt} +0 -0
  223. /package/dist/{8286.js.LICENSE.txt → 8691.js.LICENSE.txt} +0 -0
  224. /package/dist/{8471.js.LICENSE.txt → 8730.js.LICENSE.txt} +0 -0
  225. /package/dist/{85.js.LICENSE.txt → 8780.js.LICENSE.txt} +0 -0
  226. /package/dist/{8799.js.LICENSE.txt → 8881.js.LICENSE.txt} +0 -0
  227. /package/dist/{8902.js.LICENSE.txt → 8911.js.LICENSE.txt} +0 -0
  228. /package/dist/{8956.js.LICENSE.txt → 9091.js.LICENSE.txt} +0 -0
  229. /package/dist/{92.js.LICENSE.txt → 9171.js.LICENSE.txt} +0 -0
  230. /package/dist/{9558.js.LICENSE.txt → 9244.js.LICENSE.txt} +0 -0
  231. /package/dist/{9768.js.LICENSE.txt → 9268.js.LICENSE.txt} +0 -0
  232. /package/dist/{9818.js.LICENSE.txt → 9283.js.LICENSE.txt} +0 -0
  233. /package/dist/{9849.js.LICENSE.txt → 9560.js.LICENSE.txt} +0 -0
  234. /package/dist/{989.js.LICENSE.txt → 968.js.LICENSE.txt} +0 -0
  235. /package/dist/{9980.js.LICENSE.txt → 9800.js.LICENSE.txt} +0 -0
package/package.json CHANGED
@@ -1,15 +1,12 @@
1
1
  {
2
2
  "name": "@public-ui/sample-react",
3
- "version": "2.0.15",
3
+ "version": "2.1.1",
4
4
  "description": "This app contains samples for the KoliBri/Public UI",
5
5
  "license": "EUPL-1.2",
6
6
  "dependencies": {
7
7
  "@leanup/stack": "1.3.50",
8
8
  "@leanup/stack-react": "1.3.50",
9
9
  "@leanup/stack-webpack": "1.3.50",
10
- "@public-ui/components": "2.0.15",
11
- "@public-ui/react": "2.0.15",
12
- "@public-ui/themes": "2.0.15",
13
10
  "@types/node": "ts5.4",
14
11
  "@types/react": "18.3.1",
15
12
  "@types/react-dom": "18.3.0",
@@ -31,7 +28,10 @@
31
28
  "ts-prune": "0.10.3",
32
29
  "typescript": "5.4.5",
33
30
  "world_countries_lists": "2.9.0",
34
- "yup": "1.4.0"
31
+ "yup": "1.4.0",
32
+ "@public-ui/components": "2.1.1",
33
+ "@public-ui/themes": "2.1.1",
34
+ "@public-ui/react": "2.1.1"
35
35
  },
36
36
  "files": [
37
37
  ".eslintignore",
@@ -1,5 +1,7 @@
1
1
  import type { FC, PropsWithChildren } from 'react';
2
- import React, { useContext } from 'react';
2
+ import React, { useContext, useMemo } from 'react';
3
+
4
+ import { PUBLIC_DOC_COMPONENT_URL } from '../shares/constants';
3
5
 
4
6
  import { KolIndentedText, KolLink } from '@public-ui/react';
5
7
 
@@ -7,17 +9,18 @@ import { HideMenusContext } from '../shares/HideMenusContext';
7
9
 
8
10
  export const SampleDescription: FC<PropsWithChildren> = (props) => {
9
11
  const hideMenus = useContext(HideMenusContext);
12
+ const docRedirect = useMemo(() => {
13
+ const arr = location.href.split('/');
14
+ return `${PUBLIC_DOC_COMPONENT_URL}/${arr[arr.length - 2]}`;
15
+ }, [PUBLIC_DOC_COMPONENT_URL, location.href]);
10
16
 
11
17
  return hideMenus ? null : (
12
- <div className="flex mb-sm">
18
+ <div className="flex justify-between mb-sm">
13
19
  <KolIndentedText>{props.children}</KolIndentedText>
14
- <KolLink
15
- _hideLabel
16
- _href={`${location.href}?hideMenus`}
17
- _label="Beispiel in neuem Tab öffnen"
18
- _target="_blank"
19
- className="mla flex-self-center"
20
- ></KolLink>
20
+ <div className="flex flex-wrap gap-2">
21
+ <KolLink _href={docRedirect} _label="Dokumentation" _target="_blank" />
22
+ <KolLink _href={`${location.href}?hideMenus`} _label="Beispiel" _target="_blank" />
23
+ </div>
21
24
  </div>
22
25
  );
23
26
  };
@@ -0,0 +1,13 @@
1
+ import type { FC } from 'react';
2
+ import React from 'react';
3
+ import { FormWrap } from '../FormWrap';
4
+ import { ComboboxVariants } from './partials/variants';
5
+ import { SampleDescription } from '../SampleDescription';
6
+ export const ComboboxBasic: FC = () => (
7
+ <>
8
+ <SampleDescription>The Combobox merges a text input with a suggestion list, enabling users to type or select their choice.</SampleDescription>
9
+ <>
10
+ <FormWrap RefComponent={ComboboxVariants} />
11
+ </>
12
+ </>
13
+ );
@@ -0,0 +1,38 @@
1
+ import React, { forwardRef } from 'react';
2
+
3
+ import { KolCombobox } from '@public-ui/react';
4
+
5
+ import { ERROR_MSG, HINT_MSG } from '../../../shares/constants';
6
+
7
+ import type { Components } from '@public-ui/components';
8
+ import { COUNTRY_SUGGESTIONS } from '../../../shares/country';
9
+
10
+ export const ComboboxCases = forwardRef<HTMLKolSelectElement, Components.KolSelect>(function ComboboxCases(props) {
11
+ return (
12
+ <div className="grid gap-4">
13
+ <KolCombobox
14
+ {...props}
15
+ _hint={HINT_MSG}
16
+ _label="Label"
17
+ _suggestions={COUNTRY_SUGGESTIONS}
18
+ _value={'Deutschland'}
19
+ _on={{
20
+ onBlur: console.log,
21
+ onChange: console.log,
22
+ onClick: console.log,
23
+ onFocus: console.log,
24
+ }}
25
+ />
26
+ <KolCombobox {...props} _label="Disabled" _suggestions={COUNTRY_SUGGESTIONS} _value={'Deutschland'} _disabled />
27
+ <KolCombobox
28
+ {...props}
29
+ _suggestions={COUNTRY_SUGGESTIONS}
30
+ _msg={{ _type: 'error', _description: ERROR_MSG }}
31
+ _touched
32
+ _label="Label"
33
+ _placeholder="Placeholder"
34
+ _required
35
+ />
36
+ </div>
37
+ );
38
+ });
@@ -0,0 +1,19 @@
1
+ import React, { forwardRef } from 'react';
2
+
3
+ import { ComboboxCases } from './cases';
4
+
5
+ import type { Components } from '@public-ui/components';
6
+ export const ComboboxVariants = forwardRef<HTMLKolSelectElement, Components.KolSelect>(function SelectVariant(props, ref) {
7
+ return (
8
+ <div className="grid md:grid-cols-2 gap-4">
9
+ <fieldset>
10
+ <legend>Text</legend>
11
+ <ComboboxCases {...props} />
12
+ </fieldset>
13
+ <fieldset>
14
+ <legend>Text (hideLabel)</legend>
15
+ <ComboboxCases ref={ref} {...props} _hideLabel />
16
+ </fieldset>
17
+ </div>
18
+ );
19
+ });
@@ -0,0 +1,8 @@
1
+ import { Routes } from '../../shares/types';
2
+ import { ComboboxBasic } from './basic';
3
+
4
+ export const COMBOBOX_ROUTES: Routes = {
5
+ combobox: {
6
+ basic: ComboboxBasic,
7
+ },
8
+ };
@@ -11,6 +11,13 @@ export const InputCheckboxCases = forwardRef<HTMLKolInputCheckboxElement, Compon
11
11
  <KolInputCheckbox {...props} _label="Nicht ausgewählt" _value={false} _required />
12
12
  <KolInputCheckbox {...props} _label="Unbestimmt (Indeterminate)" _value={null} _indeterminate />
13
13
  <KolInputCheckbox {...props} ref={ref} _accessKey="A" _checked _label="Ausgewählt" _tooltipAlign="right" _value={true} />
14
+ <KolInputCheckbox
15
+ {...props}
16
+ _checked
17
+ _icons={{ unchecked: 'codicon codicon-close' }}
18
+ _label={'Mit sehr langem Label und Umbrüchen '.repeat(5)}
19
+ _value={true}
20
+ />
14
21
  <KolInputCheckbox {...props} _disabled _label="Disabled" _value={true} _hint="Hint text" />
15
22
  <KolInputCheckbox {...props} _checked _disabled _label="Checked and disabled" />
16
23
  <KolInputCheckbox {...props} _indeterminate _disabled _label="Indeterminate and disabled" />
@@ -24,6 +24,10 @@ export const InputNumberCases = forwardRef<HTMLKolInputNumberElement, Components
24
24
  },
25
25
  }}
26
26
  />
27
+ <KolInputNumber {...props} _required _msg={{ _type: 'error', _description: ERROR_MSG }} _touched _value={123} _label="Zahleneingabe" />
28
+ <KolInputNumber {...props} _required _msg={{ _type: 'warning', _description: ERROR_MSG }} _touched _value={123} _label="Zahleneingabe" />
29
+ <KolInputNumber {...props} _required _msg={{ _type: 'info', _description: ERROR_MSG }} _touched _value={123} _label="Zahleneingabe" />
30
+ <KolInputNumber {...props} _required _msg={{ _type: 'success', _description: ERROR_MSG }} _touched _value={123} _label="Zahleneingabe" />
27
31
  <KolInputNumber {...props} ref={ref} _accessKey="Z" _max={10} _min={-10} _step={2} _label="Zahleneingabe (-10 bis 10 in 2er Schritten)" />
28
32
  <KolInputNumber {...props} _readOnly _label="Zahleneingabe (Readonly)" />
29
33
  <KolInputNumber {...props} _disabled _label="Zahleneingabe (Disabled)" />
@@ -44,6 +44,25 @@ export const InputPasswordShowPassword: FC = () => {
44
44
  }}
45
45
  className="block"
46
46
  />
47
+ <KolInputPassword
48
+ _placeholder="Mit 'Passwort anzeigen' Button und disabled"
49
+ _label="Passwort"
50
+ ref={passwordRef}
51
+ _smartButton={{
52
+ _icons: {
53
+ left: {
54
+ icon: 'codicon codicon-eye',
55
+ },
56
+ },
57
+ _hideLabel: true,
58
+ _label: `Passwort ${isPasswordVisible ? 'ausblenden' : 'einblenden'}`,
59
+ _on: {
60
+ onClick: handleTogglePasswordClick,
61
+ },
62
+ }}
63
+ className="block"
64
+ _disabled
65
+ />
47
66
  </KolForm>
48
67
  </>
49
68
  );
@@ -11,7 +11,7 @@ export const InputTextCases = forwardRef<HTMLKolInputTextElement, Components.Kol
11
11
  <KolInputText
12
12
  {...props}
13
13
  _hint={HINT_MSG}
14
- _msg={{ _type: 'error', _description: ERROR_MSG }}
14
+ _msg={{ _type: 'error', _description: ERROR_MSG, _label: 'test überschrift' }}
15
15
  _placeholder="Mit Icons"
16
16
  _icons={{
17
17
  right: {
@@ -37,6 +37,8 @@ export const InputTextCases = forwardRef<HTMLKolInputTextElement, Components.Kol
37
37
  <KolInputText {...props} _placeholder="Placeholder" _msg={{ _type: 'info', _description: 'Nur ein Hinweis' }} _label="Suche (search)" _type="search" />
38
38
  <KolInputText {...props} _placeholder="Placeholder" _msg={{ _type: 'error', _description: ERROR_MSG }} _touched _type="url" _label="URL (url)" />
39
39
  <KolInputText {...props} _placeholder="Placeholder" _type="tel" _label="Telefon (tel)" _msg={{ _type: 'warning', _description: 'Kleine Warnung' }} />
40
+ <KolInputText {...props} _placeholder="Placeholder" _type="tel" _label="Telefon (tel)" _msg={{ _type: 'success', _description: 'Erfolgsmeldung' }} />
41
+ <KolInputText {...props} _placeholder="Placeholder" _label="Mit Counter" _hasCounter _maxLength={10} />
40
42
  <KolInputText {...props} _placeholder="Placeholder" _readOnly _label="Vorname (text, readonly)" />
41
43
  <KolInputText {...props} _value="Value" _readOnly _label="Vorname (text, readonly)" />
42
44
  <KolInputText {...props} _placeholder="Placeholder" _disabled _label="Vorname (text, disabled)" />
@@ -1,17 +1,11 @@
1
1
  import React, { forwardRef } from 'react';
2
- import countries from 'world_countries_lists/data/countries/de/countries.json';
3
2
 
4
3
  import { KolSelect } from '@public-ui/react';
5
4
 
6
5
  import { ERROR_MSG } from '../../../shares/constants';
7
6
 
8
7
  import type { Components, SelectOption } from '@public-ui/components';
9
- type Country = {
10
- id: number;
11
- alpha2: string;
12
- alpha3: string;
13
- name: string;
14
- };
8
+ import { COUNTRY_OPTIONS } from '../../../shares/country';
15
9
 
16
10
  const SALUTATION_OPTIONS: SelectOption<string>[] = [
17
11
  {
@@ -33,13 +27,6 @@ const SALUTATION_OPTIONS: SelectOption<string>[] = [
33
27
  },
34
28
  ];
35
29
 
36
- const COUNTRY_OPTIONS: SelectOption<string>[] = [
37
- ...(countries as Country[]).map((country) => ({
38
- label: country.name,
39
- value: country.alpha2,
40
- })),
41
- ];
42
-
43
30
  export const SelectCases = forwardRef<HTMLKolSelectElement, Components.KolSelect>(function SelectCases(props, ref) {
44
31
  return (
45
32
  <div className="grid gap-4">
@@ -8,6 +8,7 @@ import { TableRenderCell } from './render-cell';
8
8
  import { TableSortData } from './sort-data';
9
9
  import { TableStateless } from './stateless';
10
10
  import { TableWithFooter } from './with-footer';
11
+ import { TableStatelessWithSelection } from './stateless-with-selection';
11
12
  import { TableWithPagination } from './with-pagination';
12
13
 
13
14
  export const TABLE_ROUTES: Routes = {
@@ -20,6 +21,7 @@ export const TABLE_ROUTES: Routes = {
20
21
  'render-cell': TableRenderCell,
21
22
  'sort-data': TableSortData,
22
23
  'with-footer': TableWithFooter,
24
+ 'stateless-with-selection': TableStatelessWithSelection,
23
25
  'with-pagination': TableWithPagination,
24
26
  stateless: TableStateless,
25
27
  },
@@ -0,0 +1,60 @@
1
+ import type { FC } from 'react';
2
+ import React, { useEffect, useRef } from 'react';
3
+ import { KolTableStateless } from '@public-ui/react';
4
+ import { SampleDescription } from '../SampleDescription';
5
+ import type { KoliBriTableSelection } from '@public-ui/components';
6
+
7
+ const DATA = [
8
+ { id: '1001', name: 'Foo Bar' },
9
+ { id: '1002', name: 'Foo Baz' },
10
+ ];
11
+ type Data = (typeof DATA)[0];
12
+
13
+ export const TableStatelessWithSelection: FC = () => {
14
+ const selection: KoliBriTableSelection = {
15
+ label: (row: Data) => `Selection for ${row.name}`,
16
+ selectedKeys: ['1002'],
17
+ keyPropertyName: 'id',
18
+ };
19
+
20
+ const kolTableStatelessRef = useRef<HTMLKolTableStatelessElement>();
21
+
22
+ const handleSelectionChangeEvent = ({ detail: selection }) => {
23
+ console.log('Selection change via event', selection);
24
+ };
25
+ const handleSelectionChangeCallback = (_event, selection) => {
26
+ console.log('Selection change via callback', selection);
27
+ };
28
+
29
+ useEffect(() => {
30
+ kolTableStatelessRef.current?.addEventListener('kol-selection-change', handleSelectionChangeEvent);
31
+
32
+ return () => {
33
+ kolTableStatelessRef.current?.removeEventListener('kol-selection-change', handleSelectionChangeEvent);
34
+ };
35
+ }, [kolTableStatelessRef]);
36
+
37
+ return (
38
+ <>
39
+ <SampleDescription>KolTableStateless with selection</SampleDescription>
40
+
41
+ <KolTableStateless
42
+ _label="Table with selection checkboxes"
43
+ _headerCells={{
44
+ horizontal: [
45
+ [
46
+ { key: 'id', label: '#ID', textAlign: 'left' },
47
+ { key: 'name', label: 'Name', textAlign: 'left' },
48
+ ],
49
+ ],
50
+ }}
51
+ _data={DATA}
52
+ _selection={selection}
53
+ _on={{ onSelectionChange: handleSelectionChangeCallback }}
54
+ className="block"
55
+ style={{ maxWidth: '600px' }}
56
+ ref={kolTableStatelessRef}
57
+ />
58
+ </>
59
+ );
60
+ };
@@ -10,6 +10,9 @@ export const TextareaCases = forwardRef<HTMLKolTextareaElement, Components.KolTe
10
10
  <div className="grid gap-4">
11
11
  <KolTextarea {...props} _msg={{ _type: 'error', _description: ERROR_MSG }} _label="Text" _touched />
12
12
  <KolTextarea {...props} ref={ref} _accessKey="T" _label="Text (3 rows)" _rows={3} />
13
+ <KolTextarea {...props} ref={ref} _label="Text (placeholder)" _rows={3} _placeholder="Placeholder" />
14
+ <KolTextarea {...props} ref={ref} _label="Text (disabled & placeholder)" _rows={3} _placeholder="Placeholder" _disabled />
15
+ <KolTextarea {...props} ref={ref} _label="Text (disabled & value)" _rows={3} _placeholder="Placeholder" _value="Lorem ipsum" _disabled />
13
16
  </div>
14
17
  );
15
18
  });
@@ -0,0 +1,48 @@
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 ToolbarBasic: 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
+ class="block w-fit"
13
+ _label="Toolbar"
14
+ _items={[
15
+ {
16
+ _label: 'Back',
17
+ _hideLabel: true,
18
+ _icons: {
19
+ left: {
20
+ icon: 'codicon codicon-arrow-left',
21
+ },
22
+ },
23
+ },
24
+ {
25
+ _label: 'Next',
26
+ _hideLabel: true,
27
+ _icons: {
28
+ right: {
29
+ icon: 'codicon codicon-arrow-right',
30
+ },
31
+ },
32
+ },
33
+ {
34
+ _href: '#',
35
+ _label: 'Simple Link 1',
36
+ },
37
+ {
38
+ _href: '#',
39
+ _label: 'Simple Link 3',
40
+ },
41
+ {
42
+ _label: 'Bold',
43
+ },
44
+ ]}
45
+ />
46
+ </>
47
+ );
48
+ };
@@ -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>