@public-ui/sample-react 1.7.0-rc.5

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 (145) hide show
  1. package/.eslintignore +1 -0
  2. package/.eslintrc.js +27 -0
  3. package/.gitignore +41 -0
  4. package/.prettierignore +4 -0
  5. package/package.json +66 -0
  6. package/prettier.config.js +6 -0
  7. package/public/index.html +28 -0
  8. package/src/App.tsx +259 -0
  9. package/src/declare.d.ts +4 -0
  10. package/src/main.ts +7 -0
  11. package/src/react.main.tsx +56 -0
  12. package/src/routes-test.ts +79 -0
  13. package/src/samples/abbr/basic.html +6 -0
  14. package/src/samples/abbr/basic.tsx +39 -0
  15. package/src/samples/abbr/routes.ts +9 -0
  16. package/src/samples/accordion/basic.tsx +18 -0
  17. package/src/samples/accordion/header.tsx +17 -0
  18. package/src/samples/accordion/headlines.tsx +27 -0
  19. package/src/samples/accordion/list.tsx +32 -0
  20. package/src/samples/accordion/routes.ts +17 -0
  21. package/src/samples/alert/basic.tsx +37 -0
  22. package/src/samples/alert/card-msg.tsx +11 -0
  23. package/src/samples/alert/html.tsx +29 -0
  24. package/src/samples/alert/routes.ts +15 -0
  25. package/src/samples/avatar/basic.tsx +10 -0
  26. package/src/samples/avatar/routes.ts +8 -0
  27. package/src/samples/badge/basic.tsx +18 -0
  28. package/src/samples/badge/button.tsx +25 -0
  29. package/src/samples/badge/routes.ts +12 -0
  30. package/src/samples/breadcrumb/basic.tsx +53 -0
  31. package/src/samples/breadcrumb/routes.ts +9 -0
  32. package/src/samples/button/basic.tsx +29 -0
  33. package/src/samples/button/hide-label.tsx +31 -0
  34. package/src/samples/button/icons.tsx +27 -0
  35. package/src/samples/button/routes.ts +18 -0
  36. package/src/samples/button/width.tsx +30 -0
  37. package/src/samples/button-group/basic.tsx +13 -0
  38. package/src/samples/button-group/routes.ts +9 -0
  39. package/src/samples/button-link/basic.tsx +23 -0
  40. package/src/samples/button-link/icons.tsx +37 -0
  41. package/src/samples/button-link/image.tsx +14 -0
  42. package/src/samples/button-link/routes.ts +18 -0
  43. package/src/samples/button-link/target.tsx +16 -0
  44. package/src/samples/card/basic.tsx +12 -0
  45. package/src/samples/card/confirm.tsx +19 -0
  46. package/src/samples/card/flex.tsx +44 -0
  47. package/src/samples/card/routes.ts +18 -0
  48. package/src/samples/card/selection.tsx +70 -0
  49. package/src/samples/details/basic.tsx +19 -0
  50. package/src/samples/details/routes.ts +9 -0
  51. package/src/samples/form/routes.ts +5 -0
  52. package/src/samples/handout/basic.tsx +1013 -0
  53. package/src/samples/handout/routes.ts +9 -0
  54. package/src/samples/heading/badged.tsx +27 -0
  55. package/src/samples/heading/basic.tsx +15 -0
  56. package/src/samples/heading/paragraph.tsx +45 -0
  57. package/src/samples/heading/routes.ts +15 -0
  58. package/src/samples/icon/basic.tsx +17 -0
  59. package/src/samples/icon/routes.ts +9 -0
  60. package/src/samples/indented-text/basic.tsx +24 -0
  61. package/src/samples/indented-text/routes.ts +9 -0
  62. package/src/samples/input-checkbox/basic.tsx +37 -0
  63. package/src/samples/input-checkbox/routes.ts +9 -0
  64. package/src/samples/input-color/basic.tsx +29 -0
  65. package/src/samples/input-color/routes.ts +9 -0
  66. package/src/samples/input-date/basic.tsx +20 -0
  67. package/src/samples/input-date/routes.ts +9 -0
  68. package/src/samples/input-email/basic.tsx +30 -0
  69. package/src/samples/input-email/routes.ts +9 -0
  70. package/src/samples/input-file/basic.tsx +25 -0
  71. package/src/samples/input-file/routes.ts +9 -0
  72. package/src/samples/input-number/basic.tsx +30 -0
  73. package/src/samples/input-number/routes.ts +9 -0
  74. package/src/samples/input-password/basic.tsx +41 -0
  75. package/src/samples/input-password/routes.ts +9 -0
  76. package/src/samples/input-radio/basic.tsx +46 -0
  77. package/src/samples/input-radio/horizontal.tsx +42 -0
  78. package/src/samples/input-radio/routes.ts +14 -0
  79. package/src/samples/input-radio/select.tsx +18 -0
  80. package/src/samples/input-range/basic.tsx +29 -0
  81. package/src/samples/input-range/routes.ts +9 -0
  82. package/src/samples/input-text/basic.tsx +72 -0
  83. package/src/samples/input-text/blur.tsx +16 -0
  84. package/src/samples/input-text/focus.tsx +24 -0
  85. package/src/samples/input-text/hidden-label.tsx +66 -0
  86. package/src/samples/input-text/routes.ts +16 -0
  87. package/src/samples/link/basic.tsx +23 -0
  88. package/src/samples/link/icons.tsx +37 -0
  89. package/src/samples/link/image.tsx +20 -0
  90. package/src/samples/link/routes.ts +18 -0
  91. package/src/samples/link/target.tsx +15 -0
  92. package/src/samples/link-button/basic.tsx +22 -0
  93. package/src/samples/link-button/routes.ts +9 -0
  94. package/src/samples/link-group/routes.ts +5 -0
  95. package/src/samples/nav/active.tsx +88 -0
  96. package/src/samples/nav/aria-current.tsx +22 -0
  97. package/src/samples/nav/basic.tsx +62 -0
  98. package/src/samples/nav/horizontal.tsx +59 -0
  99. package/src/samples/nav/routes.ts +18 -0
  100. package/src/samples/pagination/basic.tsx +12 -0
  101. package/src/samples/pagination/routes.ts +9 -0
  102. package/src/samples/popover/basic.tsx +36 -0
  103. package/src/samples/popover/routes.ts +8 -0
  104. package/src/samples/progress/basic.tsx +11 -0
  105. package/src/samples/progress/routes.ts +9 -0
  106. package/src/samples/select/basic.tsx +51 -0
  107. package/src/samples/select/routes.ts +9 -0
  108. package/src/samples/skip-nav/basic.tsx +33 -0
  109. package/src/samples/skip-nav/routes.ts +9 -0
  110. package/src/samples/spin/basic.tsx +6 -0
  111. package/src/samples/spin/custom.css +52 -0
  112. package/src/samples/spin/custom.tsx +11 -0
  113. package/src/samples/spin/cycle.tsx +6 -0
  114. package/src/samples/spin/routes.ts +13 -0
  115. package/src/samples/split-button/basic.tsx +46 -0
  116. package/src/samples/split-button/routes.ts +8 -0
  117. package/src/samples/table/badge-size.tsx +51 -0
  118. package/src/samples/table/render-cell.tsx +48 -0
  119. package/src/samples/table/routes.ts +15 -0
  120. package/src/samples/table/sort-date.tsx +33 -0
  121. package/src/samples/table/test-data.ts +66 -0
  122. package/src/samples/textarea/adjust-height.tsx +22 -0
  123. package/src/samples/textarea/basic.tsx +11 -0
  124. package/src/samples/textarea/disabled.tsx +10 -0
  125. package/src/samples/textarea/placeholder.tsx +10 -0
  126. package/src/samples/textarea/readonly.tsx +10 -0
  127. package/src/samples/textarea/resize.tsx +13 -0
  128. package/src/samples/textarea/routes.ts +27 -0
  129. package/src/samples/textarea/rows.tsx +10 -0
  130. package/src/samples/toast/basic.tsx +21 -0
  131. package/src/samples/toast/routes.ts +8 -0
  132. package/src/samples/version/basic.tsx +6 -0
  133. package/src/samples/version/context.tsx +12 -0
  134. package/src/samples/version/routes.ts +12 -0
  135. package/src/shares/constants.ts +2 -0
  136. package/src/shares/react-roots.ts +10 -0
  137. package/src/shares/routes.ts +87 -0
  138. package/src/shares/store.ts +85 -0
  139. package/src/shares/theme.ts +103 -0
  140. package/src/shares/types.ts +4 -0
  141. package/src/style.scss +89 -0
  142. package/test-build.sh +2 -0
  143. package/tsconfig.json +32 -0
  144. package/unocss.config.ts +7 -0
  145. package/webpack.config.js +14 -0
package/.eslintignore ADDED
@@ -0,0 +1 @@
1
+ **/assets/**
package/.eslintrc.js ADDED
@@ -0,0 +1,27 @@
1
+ const config = require('@leanup/stack/.eslintrc');
2
+
3
+ config.overrides = config.overrides || [];
4
+ config.overrides.push({
5
+ extends: ['plugin:react/recommended', 'plugin:jsx-a11y/recommended'],
6
+ files: ['**/*.tsx'],
7
+ parserOptions: {
8
+ ecmaFeatures: {
9
+ jsx: true,
10
+ },
11
+ },
12
+ rules: {
13
+ 'react/no-unused-state': 'error',
14
+ },
15
+ });
16
+
17
+ config.plugins = config.plugins || [];
18
+ config.plugins.push('react');
19
+ config.plugins.push('jsx-a11y');
20
+
21
+ config.settings = {
22
+ react: {
23
+ version: 'detect',
24
+ },
25
+ };
26
+
27
+ module.exports = config;
package/.gitignore ADDED
@@ -0,0 +1,41 @@
1
+ # Next
2
+ .next
3
+
4
+ # GraphQL
5
+ src/__generated__
6
+
7
+ # IDE's
8
+ .idea
9
+ .project
10
+ *.sublime-*
11
+ *.code-*
12
+
13
+
14
+ # Node.js
15
+ node_modules
16
+ npm-debug.log
17
+
18
+
19
+ # Build and test tools
20
+ *.zip
21
+ dist/*
22
+
23
+ # Cache
24
+ .sass-cache
25
+ .cache
26
+
27
+
28
+ # Operating system
29
+ .DS_Store
30
+ Thumbs.db
31
+
32
+
33
+ # Other
34
+ /.husky
35
+ /.reports
36
+ .env
37
+ .eslintcache
38
+ *~
39
+ *.log
40
+ *.tgz
41
+ /public/assets/
@@ -0,0 +1,4 @@
1
+ **/assets/**
2
+ *.feature
3
+ *.sass
4
+ *.scss
package/package.json ADDED
@@ -0,0 +1,66 @@
1
+ {
2
+ "name": "@public-ui/sample-react",
3
+ "version": "1.7.0-rc.5",
4
+ "description": "This app contains samples for the KoliBri/Public UI",
5
+ "license": "EUPL-1.2",
6
+ "scripts": {
7
+ "clean": "git clean -f -d -X",
8
+ "clean:locks": "rimraf package-lock.json pnpm-lock.yaml && npm run clean",
9
+ "build": "rimraf dist && cross-env NODE_ENV=production webpack",
10
+ "format": "prettier --check src",
11
+ "lint": "eslint \"{src,tests}/**/*.{html,js,json,jsx,ts,tsx,gql,graphql}\"",
12
+ "serve": "cross-env NODE_ENV=development webpack serve --devtool=source-map",
13
+ "start": "npm run serve",
14
+ "unused": "ts-prune -e src",
15
+ "postinstall": "npm-run-all postinstall:*",
16
+ "postinstall:components-assets": "cpy \"node_modules/@public-ui/components/assets/**/*\" public/assets --dot",
17
+ "postinstall:themes-assets": "cpy \"node_modules/@public-ui/themes/assets/**/*\" public/assets --dot"
18
+ },
19
+ "bin": {
20
+ "kolibri-sample-react-test-build": "test-build.sh"
21
+ },
22
+ "dependencies": {
23
+ "@leanup/stack": "1.3.47",
24
+ "@leanup/stack-react": "1.3.44",
25
+ "@leanup/stack-webpack": "1.3.47",
26
+ "@public-oss/kolibri-themes": "0.0.3",
27
+ "@public-ui/components": "1.7.0-rc.5",
28
+ "@public-ui/react": "1.7.0-rc.5",
29
+ "@public-ui/themes": "1.7.0-rc.5",
30
+ "@types/react": "18.2.21",
31
+ "@types/react-dom": "18.2.7",
32
+ "@unocss/preset-mini": "0.55.7",
33
+ "@unocss/webpack": "0.55.7",
34
+ "ajv": "8.12.0",
35
+ "chromedriver": "116.0.0",
36
+ "cpy-cli": "5.0.0",
37
+ "eslint-plugin-jsx-a11y": "6.7.1",
38
+ "eslint-plugin-react": "7.33.2",
39
+ "nightwatch-axe-verbose": "2.2.2",
40
+ "npm-run-all": "4.1.5",
41
+ "react": "18.2.0",
42
+ "react-dom": "18.2.0",
43
+ "react-router": "6.15.0",
44
+ "react-router-dom": "6.15.0",
45
+ "rimraf": "3.0.2",
46
+ "ts-prune": "0.10.3",
47
+ "typescript": "5.2.2",
48
+ "world_countries_lists": "2.8.2"
49
+ },
50
+ "files": [
51
+ ".eslintignore",
52
+ ".eslintrc.js",
53
+ ".gitignore",
54
+ ".prettierignore",
55
+ "prettier.config.js",
56
+ "public/index.html",
57
+ "src",
58
+ "test-build.sh",
59
+ "tsconfig.json",
60
+ "unocss.config.ts",
61
+ "webpack.config.js"
62
+ ],
63
+ "publishConfig": {
64
+ "registry": "https://registry.npmjs.org/"
65
+ }
66
+ }
@@ -0,0 +1,6 @@
1
+ module.exports = {
2
+ ...require('@leanup/stack/prettier.config'),
3
+ printWidth: 160,
4
+ singleQuote: true,
5
+ useTabs: true,
6
+ };
@@ -0,0 +1,28 @@
1
+ <!DOCTYPE html>
2
+ <html lang="de" dir="ltr">
3
+ <head>
4
+ <title>Code-Samples | KoliBri – Public UI</title>
5
+ <meta charset="UTF-8" />
6
+ <meta name="description" content="Webanwendung mit der KoliBri-Komponentenbibliothek." />
7
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
8
+ <link rel="shortcut icon" type="image/x-icon" href="assets/kolibri.ico" />
9
+ <link rel="stylesheet" href="assets/bundes/style.css" />
10
+ <link rel="stylesheet" href="assets/codicons/codicon.css" />
11
+ <link rel="stylesheet" href="assets/fontawesome-free/css/all.min.css" />
12
+ <link rel="stylesheet" href="assets/icofont/icofont.min.css" />
13
+ <link rel="stylesheet" href="assets/kreon/style.css" />
14
+ <link rel="stylesheet" href="assets/noto-sans/noto-sans.css" />
15
+ <link rel="stylesheet" href="assets/material-icons/iconfont/material-icons.css" />
16
+ <link rel="stylesheet" href="assets/material-symbols/index.css" />
17
+ <link rel="stylesheet" href="assets/roboto/roboto.css" />
18
+ <link rel="stylesheet" href="assets/tabler-icons/tabler-icons.css" />
19
+ <link rel="stylesheet" href="main.css" />
20
+ <meta name="robots" content="noindex" />
21
+ <meta name="kolibri" content="dev-mode=true" />
22
+ </head>
23
+ <body class="itzbund" data-theme="itzbund">
24
+ <div id="app"></div>
25
+ <script async src="main.js"></script>
26
+ <noscript>Diese Webseite erfordert, dass Sie JavaScript aktivieren.</noscript>
27
+ </body>
28
+ </html>
package/src/App.tsx ADDED
@@ -0,0 +1,259 @@
1
+ import React, { useMemo } from 'react';
2
+ import { Navigate, Route, Routes } from 'react-router-dom';
3
+ import { Route as MyRoute, Routes as MyRoutes } from './shares/types';
4
+
5
+ import { Option } from '@public-ui/components';
6
+ import { KolAlert, KolButton, KolSelect, KolVersion } from '@public-ui/react';
7
+ import { FC, useState } from 'react';
8
+ import { ROUTES } from './shares/routes';
9
+ import { THEME_OPTIONS, Theme } from './shares/theme';
10
+ import PackageJson from '../package.json';
11
+ import { getTheme, setTheme, setStorage, getThemeName } from './shares/store';
12
+
13
+ const THEME_REGEX = /theme=([^&]+)/;
14
+
15
+ setStorage(localStorage);
16
+
17
+ const getThemeFromLocation = () => {
18
+ if (THEME_REGEX.test(window.location.hash)) {
19
+ const match = window.location.hash.match(THEME_REGEX);
20
+ if (Array.isArray(match) && match.length > 0) {
21
+ return match[0].replace(THEME_REGEX, '$1').toLowerCase();
22
+ }
23
+ }
24
+ return getTheme();
25
+ };
26
+
27
+ const getRouteList = (routes: MyRoutes, offset = '/'): string[] => {
28
+ let list: string[] = [];
29
+ for (const key in routes) {
30
+ if (routes[key]) {
31
+ const ThisRoute: MyRoute = routes[key];
32
+ const path = `${offset}${key}`;
33
+ if (typeof ThisRoute === 'function') {
34
+ list.push(path);
35
+ } else if (typeof ThisRoute === 'object' && ThisRoute !== null) {
36
+ list = list.concat(getRouteList(ThisRoute, `${path}/`));
37
+ }
38
+ }
39
+ }
40
+ return list;
41
+ };
42
+
43
+ const getRouteTree = (routes: MyRoutes): ReturnType<typeof Route>[] => {
44
+ const tree: ReturnType<typeof Route>[] = [];
45
+ for (const key in routes) {
46
+ if (routes[key]) {
47
+ const ThisRoute: MyRoute = routes[key];
48
+ const path = `/${key}`;
49
+ if (typeof ThisRoute === 'function') {
50
+ tree.push(<Route key={path} path={path} element={<ThisRoute />} />);
51
+ tree.push(
52
+ <Route
53
+ key={`${path}/all`}
54
+ path={`${path}/all`}
55
+ element={
56
+ <div className="d-grid gap-4">
57
+ {THEME_OPTIONS.filter((theme) => ['bmf', 'zoll-v2'].indexOf((theme as Option<Theme>).value) >= 0).map((theme) => (
58
+ <div className="d-grid gap-2" key={(theme as Option<Theme>).value} data-theme={(theme as Option<Theme>).value}>
59
+ <strong>{theme.label}</strong>
60
+ <ThisRoute />
61
+ <hr aria-hidden="true" />
62
+ </div>
63
+ ))}
64
+ </div>
65
+ }
66
+ />,
67
+ );
68
+ } else if (typeof ThisRoute === 'object' && ThisRoute !== null) {
69
+ const keys = Object.keys(ThisRoute);
70
+ if (keys.length > 0) {
71
+ tree.push(
72
+ <Route
73
+ key={path}
74
+ path={`${path}/*`}
75
+ element={
76
+ <Routes>
77
+ <Route path="/" element={<Navigate to={keys[0]} />} />
78
+ {getRouteTree(ThisRoute)}
79
+ </Routes>
80
+ }
81
+ />,
82
+ );
83
+ }
84
+ }
85
+ }
86
+ }
87
+ return tree;
88
+ };
89
+
90
+ const ROUTE_LIST = getRouteList(ROUTES);
91
+ const ROUTE_TREE = getRouteTree(ROUTES);
92
+
93
+ const clearHash = (str: string) => str.replace(/\?.*/g, '').replace(/^#/g, '');
94
+
95
+ const getIndexOfRoute = (str: string) => {
96
+ return ROUTE_LIST.indexOf(clearHash(str));
97
+ };
98
+
99
+ type CustomRoute = { label: string; value: string };
100
+ const componentList: CustomRoute[] = [];
101
+ ROUTE_LIST.forEach((route) => {
102
+ const routeSplit = route.split('/');
103
+ if (routeSplit.pop() === 'basic') componentList.push({ label: routeSplit[1], value: route });
104
+ });
105
+
106
+ function getComponentFromSample(url: string): string {
107
+ const routeSplit = url.split('/');
108
+ routeSplit[2] = 'basic';
109
+ return routeSplit.join('/');
110
+ }
111
+
112
+ export const App: FC = () => {
113
+ const [theme] = useState(getThemeFromLocation());
114
+ const [sample, setSample] = useState(clearHash(window.location.hash));
115
+ const [active, setActive] = useState(false);
116
+ const [firstComponentChangeEvent, setFirstComponentChangeEvent] = useState(true);
117
+
118
+ const currentComponent = useMemo(() => {
119
+ return getComponentFromSample(sample);
120
+ }, [sample]);
121
+
122
+ document.title = `KoliBri-Handout - ${getThemeName(getTheme())} | v${PackageJson.version}`;
123
+ document.body.setAttribute('class', theme);
124
+ document.body.dataset.theme = theme;
125
+
126
+ const catchRef = () => {
127
+ setTimeout(() => {
128
+ setActive(true);
129
+ }, 500);
130
+ };
131
+
132
+ const componentSelectOn = {
133
+ onChange: (_e: Event, v: unknown) => {
134
+ /**
135
+ * Drop first event as a temporary bugfix for the following issue:
136
+ * When navigated to a component example which is not "basic" it would navigate away from it on the first event, because the select only stores the basic routes.
137
+ * e.g. accordion/header would become accordion/basic.
138
+ * This problem will become obsolete when the select gets replaced with a proper navigation (https://github.com/public-ui/kolibri/issues/5064)
139
+ */
140
+ if (firstComponentChangeEvent) {
141
+ setFirstComponentChangeEvent(false);
142
+ return;
143
+ }
144
+
145
+ const path = (v as string[])[0];
146
+ setSample(path);
147
+ window.location.href = `#${path}?theme=${theme}`;
148
+ },
149
+ };
150
+
151
+ const on = {
152
+ onChange: (_event: Event, value: unknown) => {
153
+ if (active) {
154
+ value = Array.isArray(value) ? value[0] : value;
155
+ setTheme(value as Theme);
156
+ window.location.href =
157
+ window.location.href
158
+ .replace(THEME_REGEX, '')
159
+ .replace(/(\?|&{1,})$/g, '')
160
+ .replace(/&{2,}/g, '&') + `?theme=${value as string}`;
161
+ window.location.reload();
162
+ }
163
+ },
164
+ };
165
+
166
+ const next = {
167
+ onClick: () => {
168
+ let idx = getIndexOfRoute(window.location.hash);
169
+ if (idx >= ROUTE_LIST.length - 1) {
170
+ idx = 0;
171
+ } else {
172
+ idx += 1;
173
+ }
174
+ setSample(clearHash(ROUTE_LIST[idx]));
175
+ window.location.href = `#${ROUTE_LIST[idx]}?theme=${theme}`;
176
+ },
177
+ };
178
+
179
+ const prev = {
180
+ onClick: () => {
181
+ let idx = getIndexOfRoute(window.location.hash);
182
+ if (idx <= 0) {
183
+ idx = ROUTE_LIST.length - 1;
184
+ } else {
185
+ idx -= 1;
186
+ }
187
+ setSample(clearHash(ROUTE_LIST[idx]));
188
+ window.location.href = `#${ROUTE_LIST[idx]}?theme=${theme}`;
189
+ },
190
+ };
191
+
192
+ return (
193
+ <div className="grid gap-4" data-theme={theme} ref={catchRef}>
194
+ <div className="no-print grid gap-4 toolbar">
195
+ <dl>
196
+ <dt>Beispiel:</dt>
197
+ <dd>
198
+ <strong>
199
+ {/* <KolLink _href={`${window.location.href}?theme=${theme}`} _label={sample} _target="codesandbox" /> */}
200
+ {sample.replace(/\//g, ' ')}
201
+ </strong>{' '}
202
+ ({getIndexOfRoute(window.location.hash) + 1}/{ROUTE_LIST.length})
203
+ </dd>
204
+ <dd>
205
+ <KolVersion _version={PackageJson.version}></KolVersion>
206
+ </dd>
207
+ </dl>
208
+ {active && (
209
+ <>
210
+ <KolButton
211
+ _ariaLabel="Weiter zum nächsten Komponenten-Beispiel"
212
+ _icon="codicon codicon-arrow-right"
213
+ _hideLabel
214
+ _label="Weiter"
215
+ _on={next}
216
+ _tooltipAlign="left"
217
+ />
218
+ <KolButton
219
+ _ariaLabel="Weiter zum nächsten Komponenten-Beispiel"
220
+ _icon="codicon codicon-arrow-left"
221
+ _hideLabel
222
+ _label="Zurück"
223
+ _on={prev}
224
+ _tooltipAlign="right"
225
+ _variant="ghost"
226
+ />
227
+ </>
228
+ )}
229
+ <KolSelect
230
+ className="col-span-2 sm:col-auto"
231
+ _disabled={!active}
232
+ _hideLabel
233
+ _label="Komponente wechseln"
234
+ _id="theme-toggle"
235
+ _list={componentList}
236
+ _on={componentSelectOn}
237
+ _value={[currentComponent]}
238
+ ></KolSelect>
239
+ <KolSelect
240
+ _label="Theme wechseln"
241
+ className="col-span-2 sm:col-auto"
242
+ _hideLabel
243
+ _disabled={!active}
244
+ _id="theme-toggle"
245
+ _list={THEME_OPTIONS}
246
+ _on={on}
247
+ _value={[theme]}
248
+ ></KolSelect>
249
+ </div>
250
+ <hr aria-hidden="true" />
251
+ <div className="p-4">
252
+ <Routes>
253
+ {getRouteTree(ROUTES)}
254
+ <Route path="*" element={<KolAlert _type="info">This code example has not been migrated yet - it&#39;s coming soon!</KolAlert>} />
255
+ </Routes>
256
+ </div>
257
+ </div>
258
+ );
259
+ };
@@ -0,0 +1,4 @@
1
+ declare module '*.jpeg';
2
+ declare module '*.jpg';
3
+ declare module '*.png';
4
+ declare module '*.gif';
package/src/main.ts ADDED
@@ -0,0 +1,7 @@
1
+ import 'uno.css'; // https://github.com/antfu/unocss
2
+
3
+ // App style
4
+ import './style.scss';
5
+
6
+ // App
7
+ import './react.main';
@@ -0,0 +1,56 @@
1
+ import React, { StrictMode } from 'react';
2
+ import { createRoot } from 'react-dom/client';
3
+ import { HashRouter as Router } from 'react-router-dom';
4
+
5
+ import { defineCustomElements } from '@public-ui/components/dist/loader';
6
+ import type { Generic } from '@a11y-ui/core';
7
+ import { register } from '@public-ui/components';
8
+ import { BAMF, BMF, BZSt, DEFAULT, DESYv1, DESYv2, ECL_EC, ECL_EU, ITZBund, MAPZ, ZOLLv2 } from '@public-ui/themes';
9
+ import { TH } from '@public-oss/kolibri-themes';
10
+ import { App } from './App';
11
+
12
+ type Theme = Generic.Theming.RegisterPatch<string, string, string>;
13
+
14
+ void (async () => {
15
+ if (process.env.THEME_MODULE) {
16
+ /* Visual regression testing mode: Themes are overridden with a certain theme module, that should be used instead. */
17
+ const { [(process.env.THEME_EXPORT as string) ?? 'default']: theme } = (await import(process.env.THEME_MODULE)) as Record<string, Theme>;
18
+ try {
19
+ await register([theme], defineCustomElements);
20
+ } catch (error) {
21
+ console.warn('Theme registration failed:', error);
22
+ }
23
+ } else {
24
+ /* Regular mode: Register all known themes. */
25
+ try {
26
+ await register([BAMF, BMF, DEFAULT, BZSt, DESYv1, DESYv2, ECL_EC, ECL_EU, ITZBund, MAPZ, ZOLLv2, TH], defineCustomElements, {
27
+ theme: {
28
+ detect: 'auto',
29
+ },
30
+ });
31
+ } catch (error) {
32
+ console.warn('Theme registration failed:', error);
33
+ }
34
+ }
35
+
36
+ /**
37
+ * You should patch the theme after the components and your default theme are registered.
38
+ *
39
+ * ↓ That is a tiny sample!
40
+ */
41
+ // KoliBriDevHelper.patchTheme('my-theme', {
42
+ // 'KOL-BUTTON': 'button{border:2px solid red;}',
43
+ // });
44
+
45
+ const htmlDivElement = document.querySelector('div#app');
46
+ if (htmlDivElement instanceof HTMLDivElement) {
47
+ const root = createRoot(htmlDivElement);
48
+ root.render(
49
+ <StrictMode>
50
+ <Router>
51
+ <App />
52
+ </Router>
53
+ </StrictMode>,
54
+ );
55
+ }
56
+ })();
@@ -0,0 +1,79 @@
1
+ export const routes = [
2
+ '/handout/basic',
3
+ '/abbr/basic',
4
+ '/accordion/basic',
5
+ '/accordion/header',
6
+ '/accordion/headlines',
7
+ '/accordion/list',
8
+ '/alert/basic',
9
+ '/alert/card-msg',
10
+ '/alert/html',
11
+ '/avatar/basic',
12
+ '/badge/basic',
13
+ '/badge/button',
14
+ '/breadcrumb/basic',
15
+ '/button/basic',
16
+ '/button/hide-label',
17
+ '/button/icons',
18
+ '/button/width',
19
+ '/button-link/basic',
20
+ '/button-link/icons',
21
+ '/button-link/image',
22
+ '/button-link/target',
23
+ '/button-group/basic',
24
+ '/card/basic',
25
+ '/card/confirm',
26
+ '/card/flex',
27
+ '/card/selection',
28
+ '/details/basic',
29
+ '/heading/badge',
30
+ '/heading/basic',
31
+ '/heading/paragraph',
32
+ '/icon/basic',
33
+ '/indented-text/basic',
34
+ '/input-checkbox/basic',
35
+ '/input-color/basic',
36
+ '/input-date/basic',
37
+ '/input-email/basic',
38
+ '/input-file/basic',
39
+ '/input-number/basic',
40
+ '/input-password/basic',
41
+ '/input-radio/basic',
42
+ '/input-radio/horizontal',
43
+ '/input-radio/select',
44
+ '/input-range/basic',
45
+ '/input-text/basic',
46
+ '/input-text/hidden-label',
47
+ '/input-text/blur',
48
+ '/input-text/focus',
49
+ '/link/basic',
50
+ '/link/icons',
51
+ '/link/image',
52
+ '/link/target',
53
+ '/link-button/basic',
54
+ '/nav/basic',
55
+ '/nav/active',
56
+ '/nav/aria-current',
57
+ '/nav/horizontal',
58
+ '/pagination/basic',
59
+ '/popover/basic',
60
+ '/progress/basic',
61
+ '/select/basic',
62
+ '/skip-nav/basic',
63
+ '/spin/basic',
64
+ '/spin/cycle',
65
+ '/spin/custom',
66
+ '/split-button/basic',
67
+ '/table/badge-size',
68
+ '/table/render-cell',
69
+ '/table/sort-data',
70
+ '/textarea/basic',
71
+ '/textarea/adjust-height',
72
+ '/textarea/disabled',
73
+ '/textarea/placeholder',
74
+ '/textarea/readonly',
75
+ '/textarea/resize',
76
+ '/textarea/rows',
77
+ '/version/basic',
78
+ '/version/context',
79
+ ];
@@ -0,0 +1,6 @@
1
+ Ich bin <kol-abbr _title="Abkürzung">z.B.</kol-abbr> eine Abkürzung.<br />
2
+ Ich bin <kol-abbr _title="Abkürzung" _tooltip-align="right">z.B.</kol-abbr> eine Abkürzung (rechts).<br />
3
+ Ich bin
4
+ <kol-abbr _title="Abkürzung" _tooltip-align="bottom">z.B.</kol-abbr> eine Abkürzung (unten).<br />
5
+ Ich bin <kol-abbr _title="Abkürzung" _tooltip-align="left">z.B.</kol-abbr> eine Abkürzung (links).<br />
6
+ Ich bin <kol-abbr _title="Abkürzung" _tooltip-align="top">z.B.</kol-abbr> eine Abkürzung (oben).
@@ -0,0 +1,39 @@
1
+ import React from 'react';
2
+ import { FC } from 'react';
3
+ import { KolAbbr } from '@public-ui/react';
4
+
5
+ export const AbbrBasic: FC = () => (
6
+ <>
7
+ <p>
8
+ Ich bin <KolAbbr _title="Abkürzung">z.B.</KolAbbr> eine Abkürzung.
9
+ </p>
10
+ <p>
11
+ Ich bin{' '}
12
+ <KolAbbr _title="Abkürzung" _tooltipAlign="right">
13
+ z.B.
14
+ </KolAbbr>{' '}
15
+ eine Abkürzung (rechts).
16
+ </p>
17
+ <p>
18
+ Ich bin{' '}
19
+ <KolAbbr _title="Abkürzung" _tooltipAlign="bottom">
20
+ z.B.
21
+ </KolAbbr>{' '}
22
+ eine Abkürzung (unten).
23
+ </p>
24
+ <p>
25
+ Ich bin{' '}
26
+ <KolAbbr _title="Abkürzung" _tooltipAlign="left">
27
+ z.B.
28
+ </KolAbbr>{' '}
29
+ eine Abkürzung (links).
30
+ </p>
31
+ <p>
32
+ Ich bin{' '}
33
+ <KolAbbr _title="Abkürzung" _tooltipAlign="top">
34
+ z.B.
35
+ </KolAbbr>{' '}
36
+ eine Abkürzung (oben).
37
+ </p>
38
+ </>
39
+ );
@@ -0,0 +1,9 @@
1
+ import { Routes } from '../../shares/types';
2
+
3
+ import { AbbrBasic } from './basic';
4
+
5
+ export const ABBR_ROUTES: Routes = {
6
+ abbr: {
7
+ basic: AbbrBasic,
8
+ },
9
+ };
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { KolAccordion } from '@public-ui/react';
3
+
4
+ import { FC } from 'react';
5
+
6
+ export const AccordionBasic: FC = () => (
7
+ <div className="grid gap-4">
8
+ <KolAccordion _heading="Überschrift Accordion Tab 1" _level={1}>
9
+ <div slot="content">Inhalt Accordion Tab 1</div>
10
+ </KolAccordion>
11
+ <KolAccordion _heading="Überschrift Accordion Tab 2" _level={1} _open>
12
+ <div slot="content">Inhalt Accordion Tab 2</div>
13
+ </KolAccordion>
14
+ <KolAccordion _heading="Überschrift Accordion Tab 3" _level={1}>
15
+ <div slot="content">Inhalt Accordion Tab 3</div>
16
+ </KolAccordion>
17
+ </div>
18
+ );
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import { KolAccordion } from '@public-ui/react';
3
+
4
+ import { FC } from 'react';
5
+
6
+ export const AccordionHeader: FC = () => (
7
+ <div className="grid gap-4">
8
+ <KolAccordion _heading="Accordion mit Header" _level={1} _open>
9
+ <div slot="header">Hier kann noch was in den Header</div>
10
+ <div slot="content">
11
+ Dieser Inhalt wird direkt beim Laden der Seite angezeigt.
12
+ <br />
13
+ Mit Klick auf die Überschrift wird der Inhalt versteckt.
14
+ </div>
15
+ </KolAccordion>
16
+ </div>
17
+ );