@public-ui/sample-react 1.7.14 → 1.7.16

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 (94) hide show
  1. package/dist/104.js +1 -1
  2. package/dist/1296.js +1 -1
  3. package/dist/1461.js +1 -1
  4. package/dist/1480.js +1 -0
  5. package/dist/1684.js +1 -1
  6. package/dist/1720.js +1 -1
  7. package/dist/1888.js +1 -1
  8. package/dist/2120.js +1 -1
  9. package/dist/2240.js +1 -1
  10. package/dist/232.js +2 -0
  11. package/dist/2444.js +1 -1
  12. package/dist/2628.js +1 -1
  13. package/dist/2740.js +1 -1
  14. package/dist/2764.js +1 -1
  15. package/dist/2782.js +1 -1
  16. package/dist/2812.js +1 -1
  17. package/dist/3200.js +1 -1
  18. package/dist/3204.js +1 -1
  19. package/dist/352.js +1 -1
  20. package/dist/3564.js +1 -1
  21. package/dist/3920.js +1 -1
  22. package/dist/4064.js +1 -1
  23. package/dist/4136.js +1 -1
  24. package/dist/4184.js +1 -1
  25. package/dist/{5496.js → 4312.js} +2 -2
  26. package/dist/4544.js +1 -1
  27. package/dist/4728.js +1 -1
  28. package/dist/4915.js +1 -1
  29. package/dist/4988.js +1 -1
  30. package/dist/5376.js +1 -1
  31. package/dist/5456.js +1 -1
  32. package/dist/5615.js +1 -1
  33. package/dist/5628.js +1 -1
  34. package/dist/5744.js +1 -1
  35. package/dist/5768.js +1 -1
  36. package/dist/5839.js +1 -1
  37. package/dist/5956.js +1 -1
  38. package/dist/5972.js +1 -1
  39. package/dist/6040.js +1 -1
  40. package/dist/6272.js +1 -1
  41. package/dist/7192.js +1 -1
  42. package/dist/7312.js +1 -1
  43. package/dist/7344.js +1 -1
  44. package/dist/736.js +1 -1
  45. package/dist/7496.js +1 -1
  46. package/dist/7508.js +1 -1
  47. package/dist/7596.js +1 -1
  48. package/dist/7712.js +1 -1
  49. package/dist/7808.js +1 -1
  50. package/dist/8188.js +1 -1
  51. package/dist/8232.js +1 -1
  52. package/dist/8248.js +1 -1
  53. package/dist/828.js +1 -1
  54. package/dist/8476.js +1 -1
  55. package/dist/8524.js +1 -1
  56. package/dist/{3044.js → 9008.js} +2 -2
  57. package/dist/9088.js +1 -1
  58. package/dist/9404.js +1 -1
  59. package/dist/9424.js +1 -1
  60. package/dist/9496.js +1 -1
  61. package/dist/9544.js +1 -1
  62. package/dist/9680.js +1 -1
  63. package/dist/9888.js +1 -1
  64. package/dist/9984.js +1 -1
  65. package/dist/main.css +1 -1
  66. package/dist/main.js +1 -1
  67. package/dist/main.js.LICENSE.txt +2 -2
  68. package/package.json +16 -16
  69. package/src/App.tsx +6 -6
  70. package/src/components/Sidebar.tsx +1 -1
  71. package/src/react.main.tsx +10 -3
  72. package/src/scenarios/appointment-form/AppointmentForm.tsx +0 -1
  73. package/src/scenarios/appointment-form/AvailableAppointmentsForm.tsx +11 -4
  74. package/src/scenarios/appointment-form/DistrictForm.tsx +9 -2
  75. package/src/scenarios/appointment-form/PersonalInformationForm.tsx +9 -2
  76. package/src/scenarios/appointment-form/formUtils.ts +6 -0
  77. package/src/scenarios/routes.ts +0 -2
  78. package/src/scenarios/static-form.tsx +15 -0
  79. package/src/shares/store.ts +5 -5
  80. package/src/shares/theme.ts +6 -5
  81. package/dist/12.js +0 -2
  82. package/dist/392.js +0 -2
  83. package/dist/5496.js.LICENSE.txt +0 -3
  84. package/src/scenarios/complex-form/common/form/component.tsx +0 -25
  85. package/src/scenarios/complex-form/common/form/types.ts +0 -13
  86. package/src/scenarios/complex-form/component.tsx +0 -163
  87. package/src/scenarios/complex-form/kopfdaten/component.tsx +0 -50
  88. package/src/scenarios/complex-form/location/component.tsx +0 -16
  89. package/src/scenarios/complex-form/location/location.form.ts +0 -22
  90. package/src/scenarios/complex-form/schedule/component.tsx +0 -16
  91. package/src/scenarios/complex-form/schedule/schedule.form.ts +0 -34
  92. /package/dist/{12.js.LICENSE.txt → 232.js.LICENSE.txt} +0 -0
  93. /package/dist/{3044.js.LICENSE.txt → 4312.js.LICENSE.txt} +0 -0
  94. /package/dist/{392.js.LICENSE.txt → 9008.js.LICENSE.txt} +0 -0
@@ -33,7 +33,7 @@
33
33
  */
34
34
 
35
35
  /**
36
- * @remix-run/router v1.15.1
36
+ * @remix-run/router v1.15.3
37
37
  *
38
38
  * Copyright (c) Remix Software Inc.
39
39
  *
@@ -44,7 +44,7 @@
44
44
  */
45
45
 
46
46
  /**
47
- * React Router v6.22.1
47
+ * React Router v6.22.3
48
48
  *
49
49
  * Copyright (c) Remix Software Inc.
50
50
  *
package/package.json CHANGED
@@ -1,37 +1,37 @@
1
1
  {
2
2
  "name": "@public-ui/sample-react",
3
- "version": "1.7.14",
3
+ "version": "1.7.16",
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.49",
8
8
  "@leanup/stack-react": "1.3.49",
9
9
  "@leanup/stack-webpack": "1.3.49",
10
- "@public-ui/components": "1.7.14",
11
- "@public-ui/react": "1.7.14",
12
- "@public-ui/themes": "1.7.14",
13
- "@types/node": "20.11.19",
14
- "@types/react": "18.2.57",
15
- "@types/react-dom": "18.2.19",
16
- "@unocss/preset-uno": "0.58.5",
17
- "@unocss/webpack": "0.58.5",
10
+ "@public-ui/components": "1.7.16",
11
+ "@public-ui/react": "1.7.16",
12
+ "@public-ui/themes": "1.7.16",
13
+ "@types/node": "ts5.4",
14
+ "@types/react": "18.2.68",
15
+ "@types/react-dom": "18.2.22",
16
+ "@unocss/preset-uno": "0.58.6",
17
+ "@unocss/webpack": "0.58.6",
18
18
  "ajv": "8.12.0",
19
- "chromedriver": "121.0.2",
19
+ "chromedriver": "122.0.6",
20
20
  "cpy-cli": "5.0.0",
21
21
  "eslint-plugin-jsx-a11y": "6.8.0",
22
- "eslint-plugin-react": "7.33.2",
22
+ "eslint-plugin-react": "7.34.1",
23
23
  "formik": "2.4.5",
24
24
  "nightwatch-axe-verbose": "2.3.0",
25
25
  "npm-run-all": "4.1.5",
26
26
  "react": "18.2.0",
27
27
  "react-dom": "18.2.0",
28
- "react-router": "6.22.1",
29
- "react-router-dom": "6.22.1",
30
- "rimraf": "3.0.2",
28
+ "react-router": "6.22.3",
29
+ "react-router-dom": "6.22.3",
30
+ "rimraf": "5.0.5",
31
31
  "ts-prune": "0.10.3",
32
- "typescript": "5.3.3",
32
+ "typescript": "5.4.3",
33
33
  "world_countries_lists": "2.9.0",
34
- "yup": "1.3.3"
34
+ "yup": "1.4.0"
35
35
  },
36
36
  "files": [
37
37
  ".eslintignore",
package/src/App.tsx CHANGED
@@ -4,13 +4,13 @@ import { Route as MyRoute, Routes as MyRoutes } from './shares/types';
4
4
 
5
5
  import { Option } from '@public-ui/components';
6
6
  import PackageJson from '@public-ui/components/package.json';
7
- import { KolAlert, KolBadge } from '@public-ui/react';
7
+ import { KolBadge } from '@public-ui/react';
8
8
  import { useLocation } from 'react-router';
9
9
  import { Sidebar } from './components/Sidebar';
10
10
  import { HideMenusContext } from './shares/HideMenusContext';
11
11
  import { ROUTES } from './shares/routes';
12
12
  import { getTheme, getThemeName, setStorage, setTheme } from './shares/store';
13
- import { THEMES, THEME_OPTIONS, Theme, isDraftTheme } from './shares/theme';
13
+ import { THEMES, THEME_OPTIONS, Theme, ThemeAndUnstyled, isDraftTheme } from './shares/theme';
14
14
 
15
15
  import { BackPage } from './components/BackPage';
16
16
 
@@ -47,7 +47,7 @@ const getRouteTree = (routes: MyRoutes): ReturnType<typeof Route>[] => {
47
47
  element={
48
48
  <div className="d-grid gap-4">
49
49
  {THEME_OPTIONS.filter((theme) => THEMES.indexOf((theme as Option<Theme>).value) >= 0).map((theme) => (
50
- <div className="d-grid gap-2" key={(theme as Option<Theme>).value} data-theme={(theme as Option<Theme>).value}>
50
+ <div className="d-grid gap-2" key={(theme as Option<ThemeAndUnstyled>).value} data-theme={(theme as Option<ThemeAndUnstyled>).value}>
51
51
  <div className="mt-4">
52
52
  <strong>{theme.label}</strong>
53
53
  </div>
@@ -102,10 +102,10 @@ ROUTE_LIST.forEach((route) => {
102
102
  export const App: FC = () => {
103
103
  const routerLocation = useLocation();
104
104
  const [searchParams, setSearchParams] = useSearchParams();
105
- const theme: Theme = (searchParams.get('theme') as Theme) ?? getTheme();
105
+ const theme: ThemeAndUnstyled = (searchParams.get('theme') as ThemeAndUnstyled) ?? getTheme();
106
106
  const hideMenus = searchParams.has('hideMenus');
107
107
 
108
- setTheme(theme as Theme); // set for `getTheme` usages within the application
108
+ setTheme(theme); // set for `getTheme` usages within the application
109
109
 
110
110
  document.title = `KoliBri-Handout - ${getThemeName(getTheme())} | v${PackageJson.version}`;
111
111
  document.body.setAttribute('class', theme);
@@ -134,7 +134,7 @@ export const App: FC = () => {
134
134
  {!hideMenus && isDraftTheme(theme) && <KolBadge className="mb-3" _label="DRAFT" _color="#db5461" />}
135
135
  <Routes>
136
136
  {ROUTE_TREE}
137
- <Route path="*" element={<KolAlert _type="info">This code example has not been migrated yet - it&#39;s coming soon!</KolAlert>} />
137
+ <Route path="*" element={<Navigate to={ROUTE_LIST[0]} replace />} />
138
138
  <Route path="back-page" element={<BackPage />} />
139
139
  </Routes>
140
140
  </div>
@@ -44,7 +44,7 @@ export const Sidebar: FC<Props> = ({ version, theme, routes, routeList, sample,
44
44
 
45
45
  const handlePreviousClick = () => {
46
46
  const currentIndex = getIndexOfSample();
47
- const nextIndex = currentIndex === 0 ? routeList.length - 1 : currentIndex - 1;
47
+ const nextIndex = currentIndex <= 0 ? routeList.length - 1 : currentIndex - 1;
48
48
  location.replace(`#${routeList[nextIndex]}`);
49
49
  };
50
50
 
@@ -2,7 +2,7 @@ import React, { StrictMode } from 'react';
2
2
  import { createRoot } from 'react-dom/client';
3
3
  import { HashRouter as Router } from 'react-router-dom';
4
4
 
5
- import { register } from '@public-ui/components';
5
+ import { bootstrap } from '@public-ui/components';
6
6
  import { defineCustomElements } from '@public-ui/components/dist/loader';
7
7
  import { BMF, DEFAULT, ECL_EC, ECL_EU, ITZBund } from '@public-ui/themes';
8
8
  import type { Generic } from 'adopted-style-sheets';
@@ -15,17 +15,24 @@ void (async () => {
15
15
  /* Visual regression testing mode: Themes are overridden with a certain theme module, that should be used instead. */
16
16
  const { [(process.env.THEME_EXPORT as string) ?? 'default']: theme } = (await import(process.env.THEME_MODULE)) as Record<string, Theme>;
17
17
  try {
18
- await register([theme], defineCustomElements);
18
+ await bootstrap([theme], defineCustomElements, {
19
+ translation: {
20
+ name: 'de',
21
+ },
22
+ });
19
23
  } catch (error) {
20
24
  console.warn('Theme registration failed:', error);
21
25
  }
22
26
  } else {
23
27
  /* Regular mode: Register all known themes. */
24
28
  try {
25
- await register([BMF, DEFAULT, ECL_EC, ECL_EU, ITZBund], defineCustomElements, {
29
+ await bootstrap([BMF, DEFAULT, ECL_EC, ECL_EU, ITZBund], defineCustomElements, {
26
30
  theme: {
27
31
  detect: 'auto',
28
32
  },
33
+ translation: {
34
+ name: 'de',
35
+ },
29
36
  });
30
37
  } catch (error) {
31
38
  console.warn('Theme registration failed:', error);
@@ -77,7 +77,6 @@ export function AppointmentForm() {
77
77
  }, [activeFormSection]);
78
78
 
79
79
  const handleSubmit = async (_values: FormValues, formik: FormikHelpers<FormValues>) => {
80
- console.log(_values, formik);
81
80
  const currentSectionIndex = formSectionSequence.indexOf(activeFormSection);
82
81
  const nextSection = formSectionSequence[currentSectionIndex + 1];
83
82
  if (nextSection !== undefined) {
@@ -1,22 +1,27 @@
1
- import React, { useEffect, useState } from 'react';
1
+ import React, { useEffect, useState, useRef } from 'react';
2
2
  import { KolButton, KolForm, KolHeading, KolInputDate, KolInputRadio, KolSpin } from '@public-ui/react';
3
3
  import { FormValues } from './AppointmentForm';
4
4
  import { Field, FieldProps, useFormikContext } from 'formik';
5
5
  import { fetchAvailableTimes } from './appointmentService';
6
6
  import { Option } from '@public-ui/components/src';
7
- import { createErrorList } from './formUtils';
7
+ import { createErrorList, focusErrorList } from './formUtils';
8
8
 
9
9
  export function AvailableAppointmentsForm() {
10
10
  const form = useFormikContext<FormValues>();
11
11
 
12
12
  const [sectionSubmitted, setSectionSubmitted] = useState(false);
13
13
  const [availableTimes, setAvailableTimes] = useState<Option<string>[] | null>(null);
14
+ const [schouldFocusErrorList, setSchouldFocusErrorList] = useState(true);
14
15
  const errorList = createErrorList(form.errors);
16
+ const formikRef = useRef(null);
15
17
 
16
18
  useEffect(() => {
17
19
  let ignoreResponse = false;
18
20
  setAvailableTimes(null);
19
-
21
+ if (schouldFocusErrorList && sectionSubmitted) {
22
+ focusErrorList(errorList, formikRef);
23
+ setSchouldFocusErrorList(false);
24
+ }
20
25
  if (form.values.date) {
21
26
  fetchAvailableTimes().then(
22
27
  (times) => {
@@ -32,17 +37,19 @@ export function AvailableAppointmentsForm() {
32
37
  return () => {
33
38
  ignoreResponse = true;
34
39
  };
35
- }, [form.values.date]);
40
+ }, [form.values.date, sectionSubmitted]);
36
41
 
37
42
  return (
38
43
  <div className="p-2">
39
44
  <KolHeading _level={2} _label="Wählen Sie einen Termin aus"></KolHeading>
40
45
  <KolForm
46
+ ref={formikRef}
41
47
  _errorList={sectionSubmitted ? errorList : []}
42
48
  _on={{
43
49
  onSubmit: () => {
44
50
  void form.submitForm();
45
51
  setSectionSubmitted(true);
52
+ focusErrorList(errorList, formikRef);
46
53
  },
47
54
  }}
48
55
  >
@@ -1,8 +1,8 @@
1
- import React, { useState } from 'react';
1
+ import React, { useState, useRef, useEffect } from 'react';
2
2
  import { KolButton, KolForm, KolHeading, KolSelect } from '@public-ui/react';
3
3
  import { Field, FieldProps, useFormikContext } from 'formik';
4
4
  import { FormValues } from './AppointmentForm';
5
- import { createErrorList } from './formUtils';
5
+ import { createErrorList, focusErrorList } from './formUtils';
6
6
 
7
7
  const LOCATION_OPTIONS = [
8
8
  {
@@ -31,16 +31,23 @@ export function DistrictForm() {
31
31
  const form = useFormikContext<FormValues>();
32
32
  const [sectionSubmitted, setSectionSubmitted] = useState(false);
33
33
  const errorList = createErrorList(form.errors);
34
+ const formikRef = useRef<HTMLKolFormElement>(null);
35
+
36
+ useEffect(() => {
37
+ focusErrorList(errorList, formikRef);
38
+ }, [sectionSubmitted]);
34
39
 
35
40
  return (
36
41
  <div className="p-2">
37
42
  <KolHeading _level={2} _label="Wählen Sie einen Stadtteil aus"></KolHeading>
38
43
  <KolForm
44
+ ref={formikRef}
39
45
  _errorList={sectionSubmitted ? errorList : []}
40
46
  _on={{
41
47
  onSubmit: () => {
42
48
  void form.submitForm();
43
49
  setSectionSubmitted(true);
50
+ focusErrorList(errorList, formikRef);
44
51
  },
45
52
  }}
46
53
  >
@@ -1,8 +1,8 @@
1
- import React, { useState } from 'react';
1
+ import React, { useState, useEffect, useRef } from 'react';
2
2
  import { KolButton, KolForm, KolHeading, KolInputEmail, KolInputText, KolSelect } from '@public-ui/react';
3
3
  import { Field, FieldProps, useFormikContext } from 'formik';
4
4
  import { FormValues } from './AppointmentForm';
5
- import { createErrorList } from './formUtils';
5
+ import { createErrorList, focusErrorList } from './formUtils';
6
6
 
7
7
  const SALUTATION_OPTIONS = [
8
8
  {
@@ -27,16 +27,23 @@ export function PersonalInformationForm() {
27
27
  const form = useFormikContext<FormValues>();
28
28
  const [sectionSubmitted, setSectionSubmitted] = useState(false);
29
29
  const errorList = createErrorList(form.errors);
30
+ const formikRef = useRef(null);
31
+
32
+ useEffect(() => {
33
+ focusErrorList(errorList, formikRef);
34
+ }, [sectionSubmitted]);
30
35
 
31
36
  return (
32
37
  <div className="p-2">
33
38
  <KolHeading _level={2} _label="Geben Sie Ihre Kontaktdaten ein"></KolHeading>
34
39
  <KolForm
40
+ ref={formikRef}
35
41
  _errorList={sectionSubmitted ? errorList : []}
36
42
  _on={{
37
43
  onSubmit: () => {
38
44
  void form.submitForm();
39
45
  setSectionSubmitted(true);
46
+ focusErrorList(errorList, formikRef);
40
47
  },
41
48
  }}
42
49
  >
@@ -6,3 +6,9 @@ export function createErrorList(formikErrors: Record<string, string>): ErrorList
6
6
  selector: `#field-${fieldName}`,
7
7
  }));
8
8
  }
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
+ }
14
+ }
@@ -1,12 +1,10 @@
1
1
  import { Routes } from '../shares/types';
2
2
  import { AppointmentForm } from './appointment-form/AppointmentForm';
3
- import { TerminComponent } from './complex-form/component';
4
3
  import { CustomTooltipWidth } from './custom-tooltip-width';
5
4
  import { StaticForm } from './static-form';
6
5
 
7
6
  export const SCENARIO_ROUTES: Routes = {
8
7
  scenarios: {
9
- 'complex-form': TerminComponent,
10
8
  'appointment-form': AppointmentForm,
11
9
  'custom-tooltip-width': CustomTooltipWidth,
12
10
  'static-form': StaticForm,
@@ -18,6 +18,8 @@ import React from 'react';
18
18
  import { SampleDescription } from '../components/SampleDescription';
19
19
 
20
20
  export const StaticForm: FC = () => {
21
+ const { searchParams } = new URL(location.href);
22
+
21
23
  return (
22
24
  <>
23
25
  <SampleDescription>
@@ -41,6 +43,16 @@ export const StaticForm: FC = () => {
41
43
  </li>
42
44
  </ol>
43
45
  </SampleDescription>
46
+
47
+ {searchParams.size > 0 && (
48
+ <>
49
+ <h2>Submitted data</h2>
50
+ <pre>
51
+ <code>{JSON.stringify(Object.fromEntries(searchParams.entries()), null, 2)}</code>
52
+ </pre>
53
+ </>
54
+ )}
55
+
44
56
  <form className="grid gap-4" method="get" noValidate>
45
57
  <KolInputCheckbox _name="checkbox" _label="Checkbox" />
46
58
  <KolInputColor _name="color" _label="Color" />
@@ -83,6 +95,9 @@ export const StaticForm: FC = () => {
83
95
  <KolButton _label="Submit" _type="submit" _variant="primary" />
84
96
  <KolButton _label="Reset" _type="reset" />
85
97
  </div>
98
+
99
+ {/* Add a random string to allow the form to be always submitted. Without it, if theres no change to the data, the form simply won't submit when requested. */}
100
+ <input type="hidden" value={crypto.randomUUID()} name="random" />
86
101
  </form>
87
102
  </>
88
103
  );
@@ -1,4 +1,4 @@
1
- import { isTheme, Store, Theme } from './theme';
1
+ import { isTheme, Store, ThemeAndUnstyled } from './theme';
2
2
  import PackageJson from '@public-ui/components/package.json';
3
3
  import { THEME_OPTIONS } from './theme';
4
4
  import { Option } from '@public-ui/components';
@@ -63,7 +63,7 @@ export const getDarkMode = (): boolean => {
63
63
  return STORE.darkMode === true;
64
64
  };
65
65
 
66
- export const setTheme = (theme: Theme) => {
66
+ export const setTheme = (theme: ThemeAndUnstyled) => {
67
67
  if (isTheme(theme)) {
68
68
  STORE.theme = theme;
69
69
  setStore();
@@ -72,13 +72,13 @@ export const setTheme = (theme: Theme) => {
72
72
  }
73
73
  };
74
74
 
75
- export const getTheme = (): Theme => {
75
+ export const getTheme = (): ThemeAndUnstyled => {
76
76
  return `${STORE.theme}`;
77
77
  };
78
78
 
79
- export const getThemeName = (theme: Theme): string => {
79
+ export const getThemeName = (theme: ThemeAndUnstyled): string => {
80
80
  if (isTheme(theme)) {
81
- return THEME_OPTIONS.find((option) => (option as Option<Theme>).value === theme)?.label;
81
+ return THEME_OPTIONS.find((option) => (option as Option<ThemeAndUnstyled>).value === theme)?.label;
82
82
  } else {
83
83
  throw new Error(`The theme identifier "${theme}" is not valid or an available option.`);
84
84
  }
@@ -1,11 +1,12 @@
1
1
  import { SelectOption } from '@public-ui/components';
2
2
 
3
3
  export const THEMES = ['bmf', 'default', 'ecl-ec', 'ecl-eu', 'itzbund'] as const;
4
- export type Theme = (typeof THEMES)[number] | 'unstyled';
4
+ export type Theme = (typeof THEMES)[number];
5
+ export type ThemeAndUnstyled = Theme | 'unstyled';
5
6
 
6
- const drafts: Theme[] = ['ecl-ec', 'ecl-eu', 'itzbund'];
7
+ const drafts: ThemeAndUnstyled[] = ['ecl-ec', 'ecl-eu', 'itzbund'];
7
8
 
8
- export const isDraftTheme = (theme: Theme) => drafts.includes(theme);
9
+ export const isDraftTheme = (theme: ThemeAndUnstyled) => drafts.includes(theme);
9
10
 
10
11
  export const isTheme = (value: unknown) => {
11
12
  return (
@@ -16,10 +17,10 @@ export const isTheme = (value: unknown) => {
16
17
 
17
18
  export type Store = {
18
19
  darkMode: boolean;
19
- theme: Theme;
20
+ theme: ThemeAndUnstyled;
20
21
  };
21
22
 
22
- export const THEME_OPTIONS: SelectOption<Theme>[] = [
23
+ export const THEME_OPTIONS: SelectOption<ThemeAndUnstyled>[] = [
23
24
  {
24
25
  label: 'Unstyled (Uncolored)',
25
26
  value: 'unstyled',
package/dist/12.js DELETED
@@ -1,2 +0,0 @@
1
- /*! For license information please see 12.js.LICENSE.txt */
2
- "use strict";(self.webpackChunk_public_ui_sample_react=self.webpackChunk_public_ui_sample_react||[]).push([[12],{6040:(t,e,i)=>{i.r(e),i.d(e,{initialize:()=>a});var l=i(3304),r=i(5496);function n(t,e){try{Object.defineProperty((0,l.g)(),t,{get:function(){return e}})}catch(e){l.L.debug(`KoliBri property ${t} is already bind.`)}}const o=(t,e)=>l.L.debug(`${t} ${e?"":"not "}activated`),a=()=>{if((0,l.i)(),(0,l.e)()){(0,l.r)(),n("a11yColorContrast",r.q),n("querySelector",r.k),n("querySelectorAll",r.t),n("querySelectorColors",r.u),n("utils",(function(){return r.n})),n("parseJson",r.p),n("stringifyJson",r.v);const t=(0,l.a)().body,e=(0,l.a)().createElement("svg");if(e.setAttribute("aria-label","KoliBri-DevTools"),e.setAttribute("xmlns","http://www.w3.org/2000/svg"),e.setAttribute("role","toolbar"),e.setAttribute("style","position: fixed;color: black;font-size: 200%;bottom: 0.25rem;right: 0.25rem;"),e.innerHTML='<svg\n xmlns="http://www.w3.org/2000/svg"\n width="50"\n height="50"\n viewBox="0 0 600 600"\n>\n <path d="M353 322L213 304V434L353 322Z" fill="#047" />\n <path d="M209 564V304L149 434L209 564Z" fill="#047" />\n <path d="M357 316L417 250L361 210L275 244L357 316Z" fill="#047" />\n <path d="M353 318L35 36L213 300L353 318Z" fill="#047" />\n <path d="M329 218L237 92L250 222L272 241L329 218Z" fill="#047" />\n <path d="M391 286L565 272L421 252L391 286Z" fill="#047" />\n</svg>',(0,l.a)().body.appendChild(e),o("Development mode",(0,l.e)()),o("Experimental mode",(0,l.d)()),o("Color contrast analysis",(0,l.f)()),(0,l.f)()){const e=setTimeout((()=>{clearTimeout(e),setInterval((()=>{r.n.queryHtmlElementColors((0,l.a)().createElement("div"),(0,r.q)(t),!1,!1)}),1e4)}),2500)}}}}}]);
package/dist/392.js DELETED
@@ -1,2 +0,0 @@
1
- /*! For license information please see 392.js.LICENSE.txt */
2
- "use strict";(self.webpackChunk_public_ui_sample_react=self.webpackChunk_public_ui_sample_react||[]).push([[392],{4008:(t,e,o)=>{o.d(e,{A:()=>a});var i=o(5496),n=o(3992),s=o(3304);class a{constructor(t,e,o){var i,a,r,c;if(this.experimentalMode=(0,s.d)(),this.setFormAssociatedValue=t=>{var e;const o=null===(e=this.formAssociated)||void 0===e?void 0:e.getAttribute("name");null!==o&&""!==o||(0,n.d)(` The form field (${this.type}) must have a name attribute to be form-associated. Please define the _name attribute.`);const i=this.tryToStringifyValue(t);this.syncValue(t,i,this.formAssociated),this.syncValue(t,i,this.syncToOwnInput)},this.component=t,this.host=this.findHostWithShadowRoot(o),this.type=e,this.experimentalMode&&("KOL-BUTTON"===(c=null===(i=this.host)||void 0===i?void 0:i.tagName)||"KOL-INPUT-CHECKBOX"===c||"KOL-INPUT-COLOR"===c||"KOL-INPUT-DATE"===c||"KOL-INPUT-EMAIL"===c||"KOL-INPUT-FILE"===c||"KOL-INPUT-NUMBER"===c||"KOL-INPUT-PASSWORD"===c||"KOL-INPUT-RADIO"===c||"KOL-INPUT-RANGE"===c||"KOL-INPUT-TEXT"===c||"KOL-SELECT"===c||"KOL-TEXTAREA"===c)){switch(null===(a=this.host)||void 0===a||a.querySelectorAll("input,select,textarea").forEach((t=>{var e;null===(e=this.host)||void 0===e||e.removeChild(t)})),this.type){case"button":case"color":case"date":case"email":case"file":case"number":case"password":case"radio":case"range":case"text":this.formAssociated=document.createElement("input"),this.formAssociated.setAttribute("type",this.type);break;case"select":this.formAssociated=document.createElement("select"),this.formAssociated.setAttribute("multiple","");break;case"textarea":this.formAssociated=document.createElement("textarea");break;default:this.formAssociated=document.createElement("input"),this.formAssociated.setAttribute("type","hidden")}this.formAssociated.setAttribute("aria-hidden","true"),this.formAssociated.setAttribute("data-form-associated",""),this.formAssociated.setAttribute("hidden",""),null===(r=this.host)||void 0===r||r.appendChild(this.formAssociated)}}findHostWithShadowRoot(t){for(;null===(null==t?void 0:t.shadowRoot)&&t!==document.body;)(t=null==t?void 0:t.parentNode).host&&(t=t.host);return t}setAttribute(t,e,o){if(this.experimentalMode)try{if("boolean"!=typeof(o="object"==typeof o&&null!==o?JSON.stringify(o):o)&&"number"!=typeof o&&"string"!=typeof o)throw new Error("Invalid value type: "+typeof o);null==e||e.setAttribute(t,`${o}`)}catch(o){null==e||e.removeAttribute(t)}}tryToStringifyValue(t){try{return"object"==typeof t&&null!==t?JSON.stringify(t).toString():null==t?null:t.toString()}catch(t){return(0,n.h)(`The form field raw value is not able to stringify! ${t}`),""}}syncValue(t,e,o){if(o)switch(this.type){case"file":o.files=t;break;case"select":o.querySelectorAll("option").forEach((t=>{o.removeChild(t)})),Array.isArray(t)&&t.forEach((t=>{const e=this.tryToStringifyValue(t);if("string"==typeof e){const t=document.createElement("option");t.setAttribute("value",e),t.setAttribute("selected",""),o.appendChild(t)}}));break;default:"string"==typeof e?(o.setAttribute("value",e),o.value=e):(o.removeAttribute("value"),o.value="")}}validateName(t){((t,e,o)=>{(0,i.d)(t,"_name",e,o)})(this.component,t,{hooks:{afterPatch:()=>{this.setAttribute("name",this.formAssociated,this.component.state._name)}}}),void 0===t&&(0,n.d)("Ein Name am Eingabefeldern oder Schalter ist nicht zwingend erforderlich, kann aber für die Autocomplete-Funktion und für das statische Versenden des Eingabefeldes relevant sein.")}validateSyncValueBySelector(t){if(this.experimentalMode&&"string"==typeof t){const e=document.querySelector(t);e&&(this.syncToOwnInput=e)}}componentWillLoad(){this.validateName(this.component._name),this.validateSyncValueBySelector(this.component._syncValueBySelector)}}},1952:(t,e,o)=>{o.d(e,{I:()=>u,g:()=>h});var i=o(5496),n=o(5212),s=o(2528),a=o(3992),r=o(1500),c=o(5456),l=o(4008);const h=t=>{const e="string"==typeof t._error&&t._error.length>0&&!0===t._touched,o="string"==typeof t._hint&&t._hint.length>0,i=[];return!0===e&&i.push(`${t._id}-error`),!0===o&&i.push(`${t._id}-hint`),{hasError:e,hasHint:o,ariaDescribedBy:i}};class d extends l.A{constructor(t,e,o){super(t,e,o),this.component=t}validateAlert(t){(0,i.a)(this.component,"_alert",t)}validateTouched(t){((t,e)=>{(0,i.a)(t,"_touched",e)})(this.component,t)}componentWillLoad(){super.componentWillLoad(),this.validateAlert(this.component._alert),this.validateTouched(this.component._touched)}}class u extends d{constructor(t,e,o){super(t,e,o),this.valueChangeListeners=[],this.onFacade={onBlur:this.onBlur.bind(this),onChange:this.onChange.bind(this),onClick:this.onClick.bind(this),onFocus:this.onFocus.bind(this)},this.component=t}validateAccessKey(t){(0,i.d)(this.component,"_accessKey",t)}validateAdjustHeight(t){((t,e)=>{(0,i.a)(t,"_adjustHeight",e)})(this.component,t)}validateDisabled(t){(0,i.a)(this.component,"_disabled",t),!0===t&&(0,a.g)()}validateError(t){(0,i.d)(this.component,"_error",t)}validateHideError(t){((t,e,o)=>{(0,i.a)(t,"_hideError",e,o)})(this.component,t,{hooks:{afterPatch:()=>{this.component.state._hideError&&(0,a.a)("Property hide-error for inputs: Only use when the error message is shown outside of the input component.")}}})}validateHideLabel(t){(0,n.v)(this.component,t,{hooks:{afterPatch:()=>{this.component.state._hideLabel&&(0,a.a)("Property hide-label for inputs: Only use for exceptions like search inputs that are clearly identifiable by their context.")}}})}validateHint(t){(0,i.d)(this.component,"_hint",t)}validateId(t){(0,i.d)(this.component,"_id",t,{hooks:{afterPatch:()=>{this.setAttribute("id",this.formAssociated,this.component.state._id)}},minLength:1}),""!==t&&void 0!==t||(0,a.d)("Eine eindeutige ID an den Eingabefeldern ist nicht zwingend erforderlich, könnte aber für die E2E-Tests relevant sein.")}validateLabel(t){(0,s.a)(this.component,t,{required:!0})}validateOn(t){"object"==typeof t&&(0,i.s)(this.component,"_on",t)}validateSmartButton(t){(0,i.o)(t,(()=>{try{t=(0,i.p)(t)}catch(t){}(0,i.s)(this.component,"_smartButton",t)}))}validateTabIndex(t){(0,c.v)(this.component,t)}componentWillLoad(){super.componentWillLoad(),this.validateAccessKey(this.component._accessKey),this.validateAdjustHeight(this.component._adjustHeight),this.validateError(this.component._error),this.validateDisabled(this.component._disabled),this.validateHideError(this.component._hideError),this.validateHideLabel(this.component._hideLabel),this.validateHint(this.component._hint),this.validateId(this.component._id),this.validateLabel(this.component._label),this.validateSmartButton(this.component._smartButton),this.validateOn(this.component._on),this.validateTabIndex(this.component._tabIndex)}onBlur(t){var e;this.component._alert=!0,this.component._touched=!0,(0,r.s)(t),(0,r.t)("blur",this.host),"function"==typeof(null===(e=this.component._on)||void 0===e?void 0:e.onBlur)&&this.component._on.onBlur(t)}onChange(t){var e;const o=t.target.value;(0,r.t)("change",this.host,o),this.setFormAssociatedValue(o),"function"==typeof(null===(e=this.component._on)||void 0===e?void 0:e.onChange)&&this.component._on.onChange(t,o),this.valueChangeListeners.forEach((t=>t(o)))}onClick(t){var e;(0,r.s)(t),(0,r.t)("click",this.host),"function"==typeof(null===(e=this.component._on)||void 0===e?void 0:e.onClick)&&this.component._on.onClick(t)}onFocus(t){var e;this.component._alert=!0,(0,r.s)(t),(0,r.t)("focus",this.host),"function"==typeof(null===(e=this.component._on)||void 0===e?void 0:e.onFocus)&&this.component._on.onFocus(t)}setValue(t,e){var o;this.setFormAssociatedValue(e),"function"==typeof(null===(o=this.component._on)||void 0===o?void 0:o.onChange)&&this.component._on.onChange(t,e)}addValueChangeListener(t){this.valueChangeListeners.push(t)}}},392:(t,e,o)=>{o.d(e,{I:()=>c});var i=o(1092),n=o(5496),s=o(5776),a=o(1952);const r=(t,e)=>{const o=t;"object"==typeof o&&null!==o&&((0,s.i)(o.right,1)&&(o.right={icon:o.right}),(0,s.i)(o.left,1)&&(o.left={icon:o.left}),e.set("_icons",o))};class c extends a.I{constructor(t,e,o){super(t,e,o),this.component=t}validateIcon(t){this.validateIcons(t)}validateIcons(t){(0,n.o)(t,(()=>{try{t=(0,n.p)(t)}catch(t){}(0,n.w)(this.component,"_icons",(t=>"object"==typeof t&&null!==t&&((0,s.i)(t.left,1)||(0,i.i)(t.left)||(0,s.i)(t.right,1)||(0,i.i)(t.right))),new Set(["KoliBriHorizontalIcon"]),t,{hooks:{beforePatch:r},required:!0})}))}componentWillLoad(){super.componentWillLoad(),this.validateIcons(this.component._icons||this.component._icon)}}},1500:(t,e,o)=>{function i(t){t.stopImmediatePropagation(),t.stopPropagation()}function n(t,e,o){e&&function(t,e,o){const i=t.dispatchEvent(function(t,e){return new CustomEvent(`kol-${t}`,{bubbles:!0,cancelable:!0,composed:!0,detail:e})}(e,o))}(e,t,o)}o.d(e,{s:()=>i,t:()=>n})},5212:(t,e,o)=>{o.d(e,{v:()=>n});var i=o(5496);const n=(t,e,o={})=>{(0,i.a)(t,"_hideLabel",e,o)}},1092:(t,e,o)=>{o.d(e,{i:()=>r,v:()=>c,w:()=>l});var i=o(5496),n=o(5776);const s=(t,e,o)=>{(0,n.c)(o)?t[e]=o:(0,n.i)(o,1)&&(t[e]={icon:o})},a=t=>{var e,o,i;if(null===(e=t.nextState)||void 0===e?void 0:e.has("_icons")){const e=null===(o=t.nextState)||void 0===o?void 0:o.get("_icons");null===(i=t.nextState)||void 0===i||i.set("_icons",(t=>{let e={};return(0,n.i)(t,1)?e={left:{icon:t}}:"object"==typeof t&&null!==t&&(s(e,"top",t.top),s(e,"right",t.right),s(e,"bottom",t.bottom),s(e,"left",t.left)),e})(e))}},r=t=>"object"==typeof t&&null!==t&&(void 0===t.style||(0,n.b)(t.style))&&(0,n.i)(t.icon,1),c=(t,e,o={})=>{(0,i.o)(e,(()=>{var s;try{e=(0,i.p)(e)}catch(t){}(0,i.w)(t,"_icons",(t=>null===t||(0,n.i)(t,1)||"object"==typeof t&&null!==t&&((0,n.i)(t.left,1)||r(t.left)||(0,n.i)(t.right,1)||r(t.right)||(0,n.i)(t.top,1)||r(t.top)||(0,n.i)(t.bottom,1)||r(t.bottom))),new Set(["KoliBriIcon"]),e,Object.assign(Object.assign({},o),{defaultValue:{},hooks:{afterPatch:null===(s=o.hooks)||void 0===s?void 0:s.afterPatch,beforePatch:(t,e,i,n)=>{var s,r;"function"==typeof(null===(s=o.hooks)||void 0===s?void 0:s.beforePatch)&&(null===(r=o.hooks)||void 0===r||r.beforePatch(t,e,i,n)),a(i)}}}))}))},l=(t,e)=>{(0,i.w)(t,"_iconAlign",(t=>"left"===t||"right"===t),new Set(["Alignment {left, right, top, bottom}"]),e,{hooks:{beforePatch:()=>{a(t)}}})}},2528:(t,e,o)=>{o.d(e,{a:()=>d,c:()=>c,h:()=>r,v:()=>h});var i=o(3992),n=o(5496);const s=/[a-zA-Z0-9äöüÄÖÜß]/g,a=/^\d+$/;function r(t,e=1){return function(t){var e;return"string"==typeof t&&(null===(e=t.match(s))||void 0===e?void 0:e.length)||0}(t)>=e}function c(t){return a.test(t)}const l=new Set(["string"]),h=(t,e,o={})=>{(0,n.w)(t,"_label",(t=>"string"==typeof t),l,e,function(t){var e;return Object.assign(Object.assign({},t),{hooks:{afterPatch:(e,o,n,s)=>{var a,l;"function"==typeof(null===(a=t.hooks)||void 0===a?void 0:a.afterPatch)&&(null===(l=t.hooks)||void 0===l||l.afterPatch(e,o,n,s)),"string"==typeof e&&!1===r(e,3)&&!1===c(e)&&(0,i.a)(`The heading or label ("${e}") is not accessible. A label should consist of at least three readable characters.`),"string"==typeof e&&e.length>80&&(0,i.u)("A heading or label should not be longer than 80 characters.")},beforePatch:null===(e=t.hooks)||void 0===e?void 0:e.beforePatch}})}(o))},d=h},5456:(t,e,o)=>{o.d(e,{v:()=>a});var i=o(3992),n=o(5496);const s={hooks:{afterPatch:t=>{-1!==t&&0!==t&&(0,i.a)("Don’t Use Tabindex Greater than 0: https://adrianroselli.com/2014/11/dont-use-tabindex-greater-than-0.html")}}},a=(t,e)=>{(0,n.e)(t,"_tabIndex",e,s)}}}]);
@@ -1,3 +0,0 @@
1
- /*!
2
- * KoliBri - The accessible HTML-Standard
3
- */
@@ -1,25 +0,0 @@
1
- import React, { FC, ReactNode } from 'react';
2
-
3
- import { KolForm, KolLinkGroup } from '@public-ui/react';
4
-
5
- type Props = {
6
- submitted: boolean;
7
- children: ReactNode;
8
- onSubmit: (event: Event) => void;
9
- };
10
-
11
- export const FromComponent: FC<Props> = (props) => (
12
- <>
13
- {props.submitted === true && (
14
- <KolLinkGroup tabIndex={0} class="fehlerliste" data-removed-_label="Fehlerliste" _label="Fehlerliste" _level={3} _links={[]} />
15
- )}
16
- <KolForm
17
- className="block mb-2"
18
- _on={{
19
- onSubmit: props.onSubmit,
20
- }}
21
- >
22
- {props.children}
23
- </KolForm>
24
- </>
25
- );
@@ -1,13 +0,0 @@
1
- export type Fehler = {
2
- _label: string;
3
- _selector: string;
4
- };
5
-
6
- export type FormProps = {
7
- onSubmitted: (event: Event) => void;
8
- };
9
-
10
- export type FormState = {
11
- loader: boolean;
12
- touched: boolean;
13
- };