@public-ui/sample-react 4.3.1-rc.1 → 4.3.1-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.
- package/package.json +10 -10
- package/src/App.tsx +2 -0
- package/src/components/InputEventValueDemo.tsx +6 -3
- package/src/components/SampleBlock.tsx +81 -0
- package/src/components/SampleGroup.tsx +27 -0
- package/src/components/abbr/basic.tsx +6 -3
- package/src/components/accordion/basic.tsx +3 -2
- package/src/components/accordion/headlines.tsx +3 -2
- package/src/components/alert/basic.tsx +17 -14
- package/src/components/avatar/basic.tsx +3 -2
- package/src/components/avatar/size.tsx +3 -2
- package/src/components/badge/basic.tsx +48 -7
- package/src/components/badge/routes.ts +0 -4
- package/src/components/breadcrumb/basic.tsx +3 -2
- package/src/components/button/access-key.tsx +8 -10
- package/src/components/button/aria-description.tsx +4 -4
- package/src/components/button/baselined.tsx +4 -4
- package/src/components/button/basic.tsx +10 -17
- package/src/components/button/disabled.tsx +6 -7
- package/src/components/button/expert-slot.tsx +6 -7
- package/src/components/button/focus-options.tsx +8 -10
- package/src/components/button/hide-label.tsx +8 -10
- package/src/components/button/icons.tsx +12 -16
- package/src/components/button/row-reverse-tooltip.tsx +4 -4
- package/src/components/button/short-key.tsx +15 -20
- package/src/components/button/spinner.tsx +6 -7
- package/src/components/button/variants.tsx +6 -6
- package/src/components/button/width.tsx +6 -7
- package/src/components/button-link/aria-description.tsx +3 -2
- package/src/components/button-link/basic.tsx +37 -35
- package/src/components/button-link/icons.tsx +13 -2
- package/src/components/button-link/image.tsx +3 -2
- package/src/components/card/basic.tsx +3 -2
- package/src/components/card/headlines.tsx +3 -2
- package/src/components/card/linked.tsx +3 -2
- package/src/components/combobox/partials/cases.tsx +40 -14
- package/src/components/combobox/partials/variants.tsx +7 -8
- package/src/components/details/basic.tsx +3 -2
- package/src/components/form/basic.tsx +5 -4
- package/src/components/form/error-list-scroll.tsx +87 -0
- package/src/components/form/error-list.tsx +56 -56
- package/src/components/form/routes.ts +2 -0
- package/src/components/heading/badged.tsx +3 -2
- package/src/components/heading/basic.tsx +3 -2
- package/src/components/heading/paragraph.tsx +3 -2
- package/src/components/heading/secondary.tsx +3 -2
- package/src/components/icon/all-kolicons.tsx +1 -1
- package/src/components/icon/basic.tsx +6 -6
- package/src/components/icon/font.tsx +21 -13
- package/src/components/image/basic.tsx +8 -5
- package/src/components/input-checkbox/partials/cases.tsx +75 -14
- package/src/components/input-checkbox/partials/variants.tsx +13 -16
- package/src/components/input-color/partials/cases.tsx +61 -18
- package/src/components/input-color/partials/variants.tsx +7 -8
- package/src/components/input-date/partials/cases.tsx +70 -26
- package/src/components/input-date/partials/minMax.tsx +38 -11
- package/src/components/input-date/partials/variants.tsx +10 -12
- package/src/components/input-email/partials/cases.tsx +69 -30
- package/src/components/input-email/partials/variants.tsx +7 -8
- package/src/components/input-file/partials/cases.tsx +58 -24
- package/src/components/input-file/partials/variants.tsx +7 -8
- package/src/components/input-number/number-formatter.tsx +5 -4
- package/src/components/input-number/partials/cases.tsx +68 -28
- package/src/components/input-number/partials/variants.tsx +7 -8
- package/src/components/input-password/partials/cases.tsx +67 -30
- package/src/components/input-password/partials/variants.tsx +7 -8
- package/src/components/input-password/show-password.tsx +22 -19
- package/src/components/input-radio/horizontal.tsx +3 -2
- package/src/components/input-radio/objectValue.tsx +5 -4
- package/src/components/input-radio/partials/cases.tsx +85 -55
- package/src/components/input-radio/partials/variants.tsx +7 -9
- package/src/components/input-range/partials/cases.tsx +60 -23
- package/src/components/input-range/partials/variants.tsx +7 -8
- package/src/components/input-text/access-short-key.tsx +11 -4
- package/src/components/input-text/aria-details.tsx +3 -2
- package/src/components/input-text/background-test.tsx +7 -5
- package/src/components/input-text/basic.tsx +24 -5
- package/src/components/input-text/clear-button.tsx +26 -0
- package/src/components/input-text/counter.tsx +3 -2
- package/src/components/input-text/disabled.tsx +11 -4
- package/src/components/input-text/expert-slot.tsx +13 -8
- package/src/components/input-text/hide-label.tsx +7 -6
- package/src/components/input-text/hide-msg.tsx +5 -4
- package/src/components/input-text/message-types.tsx +13 -4
- package/src/components/input-text/msg-and-counter.tsx +9 -4
- package/src/components/input-text/pattern.tsx +18 -15
- package/src/components/input-text/placeholder.tsx +13 -4
- package/src/components/input-text/readonly.tsx +11 -4
- package/src/components/input-text/routes.ts +2 -0
- package/src/components/input-text/select-range.tsx +3 -2
- package/src/components/input-text/smart-button.tsx +7 -4
- package/src/components/input-text/text-formatter.tsx +5 -4
- package/src/components/input-text/variant.tsx +8 -6
- package/src/components/kolibri/basic.tsx +9 -6
- package/src/components/link/basic.tsx +3 -2
- package/src/components/link/icons.tsx +3 -2
- package/src/components/link/image.tsx +3 -2
- package/src/components/link/target.tsx +3 -2
- package/src/components/link/variant.tsx +5 -4
- package/src/components/link-button/aria-description.tsx +7 -1
- package/src/components/link-button/basic.tsx +5 -4
- package/src/components/link-button/routes.ts +2 -0
- package/src/components/link-button/target.tsx +19 -0
- package/src/components/meter/basic.tsx +4 -4
- package/src/components/meter/dynamic.tsx +4 -4
- package/src/components/meter/optimum.tsx +8 -10
- package/src/components/meter/orientation.tsx +6 -7
- package/src/components/nav/aria-current.tsx +18 -15
- package/src/components/nav/basic.tsx +8 -10
- package/src/components/pagination/basic.tsx +3 -2
- package/src/components/pagination/button-visibility.tsx +16 -11
- package/src/components/pagination/sibling-boundary.tsx +3 -2
- package/src/components/popover-button/inline.tsx +4 -5
- package/src/components/progress/basic.tsx +7 -6
- package/src/components/quote/basic.tsx +4 -1
- package/src/components/quote/block.tsx +9 -6
- package/src/components/select/partials/cases.tsx +73 -33
- package/src/components/select/partials/variants.tsx +7 -8
- package/src/components/single-select/partials/cases.tsx +148 -114
- package/src/components/single-select/partials/variants.tsx +7 -8
- package/src/components/spin/basic.tsx +34 -3
- package/src/components/spin/routes.ts +0 -8
- package/src/components/split-button/basic.tsx +3 -2
- package/src/components/table/action-columns.tsx +3 -2
- package/src/components/table/column-alignment.tsx +3 -2
- package/src/components/table/complex-headers.tsx +3 -2
- package/src/components/table/empty.tsx +31 -0
- package/src/components/table/horizontal-scrollbar.tsx +24 -19
- package/src/components/table/multi-sort.tsx +6 -7
- package/src/components/table/non-hidable-columns.tsx +18 -15
- package/src/components/table/pagination-position.tsx +8 -10
- package/src/components/table/routes.ts +4 -0
- package/src/components/table/sort-data.tsx +6 -7
- package/src/components/table/stateful-async.tsx +50 -0
- package/src/components/table/stateful-with-selection.tsx +3 -2
- package/src/components/table/stateful-with-single-selection.tsx +3 -2
- package/src/components/table/stateless-async-paging.tsx +9 -32
- package/src/components/table/stateless-with-selection.tsx +3 -2
- package/src/components/table/stateless-with-single-selection.tsx +3 -2
- package/src/components/table/stateless.tsx +3 -2
- package/src/components/table/sticky-col.tsx +12 -10
- package/src/components/table/sticky-header.tsx +12 -10
- package/src/components/table/variant.tsx +5 -4
- package/src/components/table/with-footer.tsx +73 -70
- package/src/components/table/with-pagination.tsx +3 -2
- package/src/components/tabs/basic.tsx +17 -12
- package/src/components/tabs/create-button.tsx +11 -8
- package/src/components/tabs/icons-only.tsx +9 -6
- package/src/components/textarea/adjust-height.tsx +6 -3
- package/src/components/textarea/partials/cases.tsx +63 -15
- package/src/components/textarea/partials/variants.tsx +7 -8
- package/src/components/textarea/resize.tsx +3 -2
- package/src/components/textarea/rows.tsx +6 -3
- package/src/components/textarea/with-counter.tsx +3 -2
- package/src/components/toolbar/basic.tsx +6 -5
- package/src/components/toolbar/disabled.tsx +41 -38
- package/src/components/tree/basic.tsx +32 -29
- package/src/components/version/basic.tsx +4 -1
- package/src/components/version/context.tsx +8 -5
- package/src/hooks/useVisualBlockOutline.ts +38 -0
- package/src/scenarios/button-shortkey-table.tsx +4 -4
- package/src/shares/store.ts +0 -4
- package/src/shares/visualBlockOutline.ts +75 -0
- package/src/components/badge/button.tsx +0 -35
- package/src/components/badge/formatted-label.tsx +0 -19
- package/src/components/spin/custom.tsx +0 -23
- package/src/components/spin/cycle.tsx +0 -16
- package/src/components/spin/label.tsx +0 -23
- package/src/components/spin/variables.tsx +0 -16
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@public-ui/sample-react",
|
|
3
|
-
"version": "4.3.1-rc.
|
|
3
|
+
"version": "4.3.1-rc.5",
|
|
4
4
|
"description": "This app contains samples for the KoliBri/Public UI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "EUPL-1.2",
|
|
@@ -9,26 +9,26 @@
|
|
|
9
9
|
"url": "https://github.com/public-ui/kolibri"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@hookform/resolvers": "5.
|
|
12
|
+
"@hookform/resolvers": "5.9.1",
|
|
13
13
|
"@stencil/core": "4.38.3",
|
|
14
|
-
"@types/node": "26.
|
|
14
|
+
"@types/node": "26.4.0",
|
|
15
15
|
"@types/papaparse": "5.5.2",
|
|
16
|
-
"papaparse": "5.
|
|
17
|
-
"react-hook-form": "7.
|
|
16
|
+
"papaparse": "5.7.0",
|
|
17
|
+
"react-hook-form": "7.86.0",
|
|
18
18
|
"react-number-format": "5.4.5",
|
|
19
19
|
"tslib": "2.8.1",
|
|
20
20
|
"typescript": "5.9.3",
|
|
21
21
|
"world_countries_lists": "3.3.0",
|
|
22
22
|
"zod": "4.4.3",
|
|
23
|
-
"@public-ui/react-hook-form-adapter": "4.3.1-rc.
|
|
24
|
-
"@public-ui/react-v19": "4.3.1-rc.
|
|
23
|
+
"@public-ui/react-hook-form-adapter": "4.3.1-rc.5",
|
|
24
|
+
"@public-ui/react-v19": "4.3.1-rc.5"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/react": "19.2.18",
|
|
28
|
-
"@types/react-dom": "19.2.
|
|
28
|
+
"@types/react-dom": "19.2.5",
|
|
29
29
|
"adopted-style-sheets": "1.1.9-rc.25",
|
|
30
30
|
"eslint": "9.39.5",
|
|
31
|
-
"knip": "6.32.
|
|
31
|
+
"knip": "6.32.3",
|
|
32
32
|
"prettier": "3.9.6",
|
|
33
33
|
"prettier-plugin-organize-imports": "4.3.0",
|
|
34
34
|
"stylelint": "17.14.1"
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"react": "19.2.8",
|
|
38
38
|
"react-dom": "19.2.8",
|
|
39
39
|
"react-router": "8.3.0",
|
|
40
|
-
"@public-ui/components": "4.3.1-rc.
|
|
40
|
+
"@public-ui/components": "4.3.1-rc.5"
|
|
41
41
|
},
|
|
42
42
|
"files": [
|
|
43
43
|
"assets",
|
package/src/App.tsx
CHANGED
|
@@ -7,6 +7,7 @@ import PackageJson from '@public-ui/components/package.json';
|
|
|
7
7
|
import { BackPage } from './components/BackPage';
|
|
8
8
|
import { Sidebar } from './components/Sidebar';
|
|
9
9
|
import { useSetCurrentLocation } from './hooks/useSetCurrentLocation';
|
|
10
|
+
import { useVisualBlockOutline } from './hooks/useVisualBlockOutline';
|
|
10
11
|
import { HideMenusContext } from './shares/HideMenusContext';
|
|
11
12
|
import { ROUTES } from './shares/routes';
|
|
12
13
|
import { sampleAppDataService } from './shares/sampleAppDataService';
|
|
@@ -140,6 +141,7 @@ export const App: FC<Props> = ({ customThemes }) => {
|
|
|
140
141
|
|
|
141
142
|
setTheme(theme); // set for `getTheme` usages within the application
|
|
142
143
|
useSetCurrentLocation();
|
|
144
|
+
useVisualBlockOutline();
|
|
143
145
|
|
|
144
146
|
useEffect(() => {
|
|
145
147
|
document.title = `KoliBri-Handout - ${getThemeName(getTheme())} | v${PackageJson.version}`;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { FC, ReactNode } from 'react';
|
|
2
2
|
import React, { useMemo, useState } from 'react';
|
|
3
|
+
import { SampleBlock, toKebabCase } from './SampleBlock';
|
|
3
4
|
|
|
4
5
|
type EventHandlers = {
|
|
5
6
|
onChange: (_event: Event, value: unknown) => void;
|
|
@@ -8,10 +9,12 @@ type EventHandlers = {
|
|
|
8
9
|
|
|
9
10
|
type Props = {
|
|
10
11
|
label: string;
|
|
12
|
+
/** Overrides the visual block id derived from `label`. */
|
|
13
|
+
blockId?: string;
|
|
11
14
|
renderInput: (handlers: EventHandlers) => ReactNode;
|
|
12
15
|
};
|
|
13
16
|
|
|
14
|
-
export const InputEventValueDemo: FC<Props> = ({ label, renderInput }) => {
|
|
17
|
+
export const InputEventValueDemo: FC<Props> = ({ label, blockId, renderInput }) => {
|
|
15
18
|
const [changeValue, setChangeValue] = useState<unknown>(null);
|
|
16
19
|
const [inputValue, setInputValue] = useState<unknown>(null);
|
|
17
20
|
|
|
@@ -28,7 +31,7 @@ export const InputEventValueDemo: FC<Props> = ({ label, renderInput }) => {
|
|
|
28
31
|
);
|
|
29
32
|
|
|
30
33
|
return (
|
|
31
|
-
<
|
|
34
|
+
<SampleBlock id={blockId ?? toKebabCase(label)} className="grid gap-4 mb-6" aria-label={`Event callback demo: ${label}`}>
|
|
32
35
|
{renderInput(handlers)}
|
|
33
36
|
<div className="grid gap-2">
|
|
34
37
|
<p>
|
|
@@ -38,6 +41,6 @@ export const InputEventValueDemo: FC<Props> = ({ label, renderInput }) => {
|
|
|
38
41
|
<strong>onChange value:</strong> <code>{JSON.stringify(changeValue)}</code>
|
|
39
42
|
</p>
|
|
40
43
|
</div>
|
|
41
|
-
</
|
|
44
|
+
</SampleBlock>
|
|
42
45
|
);
|
|
43
46
|
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { KolHeading } from '@public-ui/react-v19';
|
|
2
|
+
import type { CSSProperties, FC, HTMLAttributes, PropsWithChildren } from 'react';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Converts an arbitrary label into a kebab-case block id, e.g. `Text (hideLabel)` → `text-hide-label`.
|
|
7
|
+
* Use this only for data-driven blocks; prefer hard-coded ids so label changes don't rename snapshots.
|
|
8
|
+
*/
|
|
9
|
+
export function toKebabCase(value: string): string {
|
|
10
|
+
return value
|
|
11
|
+
.replace(/([a-z0-9])([A-Z])/g, '$1-$2')
|
|
12
|
+
.toLowerCase()
|
|
13
|
+
.replace(/[^a-z0-9]+/g, '-')
|
|
14
|
+
.replace(/^-+|-+$/g, '');
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
type SampleBlockProps = PropsWithChildren<
|
|
18
|
+
{
|
|
19
|
+
/**
|
|
20
|
+
* Unique within the route, kebab-case, max. 30 characters.
|
|
21
|
+
* Becomes part of the visual snapshot file name — renaming it renames the snapshot.
|
|
22
|
+
*/
|
|
23
|
+
id: string;
|
|
24
|
+
/** Optional heading rendered above the block content. */
|
|
25
|
+
heading?: string;
|
|
26
|
+
level?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
27
|
+
/** Overrides the default `grid gap-4` container layout. */
|
|
28
|
+
className?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Shrinks the snapshot container to the width its content actually needs (`width: fit-content`)
|
|
31
|
+
* instead of stretching it across the full sample width. Use it for narrow, inline-ish samples
|
|
32
|
+
* (abbr, badge, link, …) so the snapshot doesn't consist mostly of empty space.
|
|
33
|
+
* Don't use it for components that rely on the available width (tables, form fields, cards).
|
|
34
|
+
*/
|
|
35
|
+
fitContent?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Captures a second element screenshot of this block at 320 px viewport width
|
|
38
|
+
* (`<route-slug>--<block-id>-320.png`) to guard the reflow behaviour required by
|
|
39
|
+
* WCAG 1.4.10. Opt in only where narrow width actually changes the layout —
|
|
40
|
+
* every flagged block doubles its snapshot count.
|
|
41
|
+
*/
|
|
42
|
+
narrow?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Excludes this block from the visual tests without turning it back into a plain `div`:
|
|
45
|
+
* heading, layout and the debug outline stay, only `data-visual-block` is dropped so no
|
|
46
|
+
* screenshot is taken. Use it for samples that can't be captured deterministically
|
|
47
|
+
* (animations, timestamps, random data) or that are only there to be looked at.
|
|
48
|
+
* The outline marks such blocks **red** instead of blue, and `narrow` has no effect on them.
|
|
49
|
+
*/
|
|
50
|
+
skipSnapshot?: boolean;
|
|
51
|
+
} & Omit<HTMLAttributes<HTMLElement>, 'className' | 'id'>
|
|
52
|
+
>;
|
|
53
|
+
|
|
54
|
+
const FIT_CONTENT_STYLE: CSSProperties = { width: 'fit-content' };
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Wraps a sample variant block in a container addressable by the visual tests.
|
|
58
|
+
* Each `data-visual-block` container is captured as an individual element screenshot
|
|
59
|
+
* instead of one full-page screenshot per route. This component is the only place
|
|
60
|
+
* that sets `data-visual-block` — samples must not set the attribute directly.
|
|
61
|
+
* The blocks can be made visible while developing (`?visualBlocks` or `Ctrl+Alt+B`),
|
|
62
|
+
* see `shares/visualBlockOutline`.
|
|
63
|
+
* See packages/tools/visual-tests/README.md.
|
|
64
|
+
*/
|
|
65
|
+
export const SampleBlock: FC<SampleBlockProps> = ({ id, heading, level = 2, className, fitContent, narrow, skipSnapshot, children, ...rest }) => (
|
|
66
|
+
<section {...rest}>
|
|
67
|
+
{/* The heading is sample chrome, not component content: it stays outside the captured block so heading changes never invalidate snapshots. */}
|
|
68
|
+
{heading ? <KolHeading _level={level} _label={heading} /> : null}
|
|
69
|
+
<div
|
|
70
|
+
/* Excluded blocks keep their id under a different attribute: the tests only look for
|
|
71
|
+
`data-visual-block`, while the debug outline can still find and mark them. */
|
|
72
|
+
data-visual-block={skipSnapshot ? undefined : id}
|
|
73
|
+
data-visual-block-skipped={skipSnapshot ? id : undefined}
|
|
74
|
+
data-visual-narrow={narrow && !skipSnapshot ? '' : undefined}
|
|
75
|
+
className={className ?? 'grid gap-4'}
|
|
76
|
+
style={fitContent ? FIT_CONTENT_STYLE : undefined}
|
|
77
|
+
>
|
|
78
|
+
{children}
|
|
79
|
+
</div>
|
|
80
|
+
</section>
|
|
81
|
+
);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { KolHeading } from '@public-ui/react-v19';
|
|
2
|
+
import type { FC, HTMLAttributes, PropsWithChildren } from 'react';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
type SampleGroupProps = PropsWithChildren<
|
|
6
|
+
{
|
|
7
|
+
/** Optional heading rendered above the group content. */
|
|
8
|
+
heading?: string;
|
|
9
|
+
level?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
10
|
+
} & HTMLAttributes<HTMLElement>
|
|
11
|
+
>;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Groups several {@link SampleBlock}s under a common heading.
|
|
15
|
+
*
|
|
16
|
+
* Unlike `SampleBlock` it renders no `data-visual-block` container, so the nested blocks stay
|
|
17
|
+
* individual element screenshots instead of being captured together as one. Use it wherever a
|
|
18
|
+
* sample renders the same set of cases more than once (e.g. with and without `_hideLabel`) – the
|
|
19
|
+
* group supplies the heading, the cases supply the blocks.
|
|
20
|
+
*/
|
|
21
|
+
export const SampleGroup: FC<SampleGroupProps> = ({ heading, level = 2, children, ...rest }) => (
|
|
22
|
+
<section {...rest}>
|
|
23
|
+
{/* The heading is sample chrome, not component content: it stays outside the captured blocks so heading changes never invalidate snapshots. */}
|
|
24
|
+
{heading ? <KolHeading _level={level} _label={heading} /> : null}
|
|
25
|
+
{children}
|
|
26
|
+
</section>
|
|
27
|
+
);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
3
|
import { KolAbbr } from '@public-ui/react-v19';
|
|
4
|
+
import { SampleBlock } from '../SampleBlock';
|
|
4
5
|
import { SampleDescription } from '../SampleDescription';
|
|
5
6
|
|
|
6
7
|
import type { FC } from 'react';
|
|
@@ -10,8 +11,10 @@ export const AbbrBasic: FC = () => (
|
|
|
10
11
|
<p>KolAbbr shows an abbreviation.</p>
|
|
11
12
|
</SampleDescription>
|
|
12
13
|
|
|
13
|
-
<
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
<SampleBlock id="basic" fitContent>
|
|
15
|
+
<span>
|
|
16
|
+
I am <KolAbbr>e.g.</KolAbbr> an abbreviation.
|
|
17
|
+
</span>
|
|
18
|
+
</SampleBlock>
|
|
16
19
|
</>
|
|
17
20
|
);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
3
|
import { KolAccordion } from '@public-ui/react-v19';
|
|
4
|
+
import { SampleBlock } from '../SampleBlock';
|
|
4
5
|
import { SampleDescription } from '../SampleDescription';
|
|
5
6
|
|
|
6
7
|
import type { FC } from 'react';
|
|
@@ -14,7 +15,7 @@ export const AccordionBasic: FC = () => (
|
|
|
14
15
|
</p>
|
|
15
16
|
</SampleDescription>
|
|
16
17
|
|
|
17
|
-
<
|
|
18
|
+
<SampleBlock id="basic">
|
|
18
19
|
<KolAccordion _label="Heading Accordion Tab 1 (open)" _open>
|
|
19
20
|
<p>Contents Accordion Tab 1</p>
|
|
20
21
|
</KolAccordion>
|
|
@@ -27,6 +28,6 @@ export const AccordionBasic: FC = () => (
|
|
|
27
28
|
<KolAccordion _label="Heading Accordion Tab 4 (disabled and open)" _disabled _open>
|
|
28
29
|
<p>Contents Accordion Tab 4</p>
|
|
29
30
|
</KolAccordion>
|
|
30
|
-
</
|
|
31
|
+
</SampleBlock>
|
|
31
32
|
</>
|
|
32
33
|
);
|
|
@@ -2,6 +2,7 @@ import type { FC } from 'react';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
|
|
4
4
|
import { KolAccordion } from '@public-ui/react-v19';
|
|
5
|
+
import { SampleBlock } from '../SampleBlock';
|
|
5
6
|
import { SampleDescription } from '../SampleDescription';
|
|
6
7
|
|
|
7
8
|
export const AccordionHeadlines: FC = () => (
|
|
@@ -10,7 +11,7 @@ export const AccordionHeadlines: FC = () => (
|
|
|
10
11
|
<p>This sample shows KolAccordion with the different heading levels from 1-6.</p>
|
|
11
12
|
</SampleDescription>
|
|
12
13
|
|
|
13
|
-
<
|
|
14
|
+
<SampleBlock id="headlines">
|
|
14
15
|
<KolAccordion _label="Heading Level 1" _level={1}>
|
|
15
16
|
<p>Contents Accordion Tab 1</p>
|
|
16
17
|
</KolAccordion>
|
|
@@ -29,6 +30,6 @@ export const AccordionHeadlines: FC = () => (
|
|
|
29
30
|
<KolAccordion _label="Heading Level 6" _level={6}>
|
|
30
31
|
<p>Contents Accordion Tab 6</p>
|
|
31
32
|
</KolAccordion>
|
|
32
|
-
</
|
|
33
|
+
</SampleBlock>
|
|
33
34
|
</>
|
|
34
35
|
);
|
|
@@ -2,6 +2,7 @@ import type { AlertTypePropType, AlertVariantPropType, HeadingLevel } from '@pub
|
|
|
2
2
|
import { KolAlert } from '@public-ui/react-v19';
|
|
3
3
|
import type { FC } from 'react';
|
|
4
4
|
import React from 'react';
|
|
5
|
+
import { SampleBlock } from '../SampleBlock';
|
|
5
6
|
import { SampleDescription } from '../SampleDescription';
|
|
6
7
|
|
|
7
8
|
type PropsByType = {
|
|
@@ -15,29 +16,31 @@ type PropsBasic = {
|
|
|
15
16
|
|
|
16
17
|
const AlertByType: FC<PropsByType> = ({ level, type, variant }) => (
|
|
17
18
|
<>
|
|
18
|
-
<
|
|
19
|
-
This is the
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
This is the
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
19
|
+
<SampleBlock id={type} className="flex flex-col gap-2">
|
|
20
|
+
<KolAlert _label={`This is the headline level ${level} of the alert.`} _level={level} _type={type} _variant={variant}>
|
|
21
|
+
This is the text of the alert.
|
|
22
|
+
</KolAlert>
|
|
23
|
+
<KolAlert _type={type} _variant={variant}>
|
|
24
|
+
In this alert, only the text without the heading is used.
|
|
25
|
+
</KolAlert>
|
|
26
|
+
<KolAlert _label={`This is the headline level ${level} of the alert.`} _level={level} _type={type} _variant={variant} _hasCloser>
|
|
27
|
+
This is the text of the alert. With close button.
|
|
28
|
+
</KolAlert>
|
|
29
|
+
<KolAlert _type={type} _variant={variant} _hasCloser>
|
|
30
|
+
In this alert, only the text without the heading is used. With close button.
|
|
31
|
+
</KolAlert>
|
|
32
|
+
</SampleBlock>
|
|
30
33
|
</>
|
|
31
34
|
);
|
|
32
35
|
|
|
33
36
|
export const AlertVariants: FC<PropsBasic> = ({ variant = 'msg' }) => (
|
|
34
|
-
|
|
37
|
+
<>
|
|
35
38
|
<AlertByType level={1} type="default" variant={variant} />
|
|
36
39
|
<AlertByType level={2} type="error" variant={variant} />
|
|
37
40
|
<AlertByType level={3} type="info" variant={variant} />
|
|
38
41
|
<AlertByType level={4} type="success" variant={variant} />
|
|
39
42
|
<AlertByType level={5} type="warning" variant={variant} />
|
|
40
|
-
|
|
43
|
+
</>
|
|
41
44
|
);
|
|
42
45
|
|
|
43
46
|
export const AlertBasic: FC<PropsBasic> = () => (
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { KolAvatar } from '@public-ui/react-v19';
|
|
2
2
|
import type { FC } from 'react';
|
|
3
3
|
import React from 'react';
|
|
4
|
+
import { SampleBlock } from '../SampleBlock';
|
|
4
5
|
import { SampleDescription } from '../SampleDescription';
|
|
5
6
|
|
|
6
7
|
export const AvatarBasic: FC = () => (
|
|
@@ -12,13 +13,13 @@ export const AvatarBasic: FC = () => (
|
|
|
12
13
|
</p>
|
|
13
14
|
</SampleDescription>
|
|
14
15
|
|
|
15
|
-
<
|
|
16
|
+
<SampleBlock className="flex gap-2" id="basic" fitContent>
|
|
16
17
|
<KolAvatar _src="assets/img_avatar.jpg" _label="Elke Mustermann" />
|
|
17
18
|
|
|
18
19
|
{/* intentional trailing space 👇 - it's supposed to be trimmed */}
|
|
19
20
|
<KolAvatar _label="Elke Mustermann " />
|
|
20
21
|
<KolAvatar _label="Marianne" />
|
|
21
22
|
<KolAvatar _color="#0000FF" _label="Christian" />
|
|
22
|
-
</
|
|
23
|
+
</SampleBlock>
|
|
23
24
|
</>
|
|
24
25
|
);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { KolAvatar } from '@public-ui/react-v19';
|
|
2
2
|
import type { FC } from 'react';
|
|
3
3
|
import React from 'react';
|
|
4
|
+
import { SampleBlock } from '../SampleBlock';
|
|
4
5
|
import { SampleDescription } from '../SampleDescription';
|
|
5
6
|
|
|
6
7
|
export const AvatarSize: FC = () => (
|
|
@@ -15,12 +16,12 @@ export const AvatarSize: FC = () => (
|
|
|
15
16
|
</p>
|
|
16
17
|
</SampleDescription>
|
|
17
18
|
|
|
18
|
-
<
|
|
19
|
+
<SampleBlock className="flex flex-wrap items-center gap-4" id="size" fitContent>
|
|
19
20
|
<KolAvatar style={{ width: '30px' }} _label="Elke Mustermann" />
|
|
20
21
|
<KolAvatar style={{ width: '30px', height: '45px' }} _label="Marianne" />
|
|
21
22
|
<KolAvatar style={{ width: '60px', height: '30px' }} _color="#0000FF" _label="Christian" />
|
|
22
23
|
<KolAvatar _src="assets/img_avatar.jpg" _label="Elke Mustermann" />
|
|
23
24
|
<KolAvatar style={{ width: '150px' }} _src="assets/img_avatar.jpg" _label="Elke Mustermann" />
|
|
24
|
-
</
|
|
25
|
+
</SampleBlock>
|
|
25
26
|
</>
|
|
26
27
|
);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
3
|
import { KolBadge } from '@public-ui/react-v19';
|
|
4
|
+
import { SampleBlock } from '../SampleBlock';
|
|
4
5
|
import { SampleDescription } from '../SampleDescription';
|
|
5
6
|
|
|
6
7
|
import type { FC } from 'react';
|
|
@@ -8,15 +9,55 @@ import type { FC } from 'react';
|
|
|
8
9
|
export const BadgeBasic: FC = () => (
|
|
9
10
|
<>
|
|
10
11
|
<SampleDescription>
|
|
11
|
-
<p>
|
|
12
|
+
<p>
|
|
13
|
+
KolBadge shows badges with a label, background color and optional icon. The label supports markdown syntax and the badge can host an optional{' '}
|
|
14
|
+
<code>smartButton</code> – here a "remove" button with X-icon and a click event listener.
|
|
15
|
+
</p>
|
|
12
16
|
</SampleDescription>
|
|
13
17
|
|
|
14
|
-
<div className="
|
|
15
|
-
<
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
<div className="grid gap-8">
|
|
19
|
+
<SampleBlock id="basic-vertical" heading="Basic Badges vertical" className="flex flex-col gap-2" fitContent>
|
|
20
|
+
<KolBadge _label="black (default)"></KolBadge>
|
|
21
|
+
<KolBadge _color="#06539e" _label="blue"></KolBadge>
|
|
22
|
+
<KolBadge _color="#ae0000" _label="red with icon" _icons="kolicon-house"></KolBadge>
|
|
23
|
+
<KolBadge _color="#8b008b" _label="purple with icon" _icons="kolicon-kolibri"></KolBadge>
|
|
24
|
+
</SampleBlock>
|
|
25
|
+
|
|
26
|
+
<SampleBlock id="basic-horizontal" heading="Basic Badges horizontal" className="flex flex-wrap gap-2" fitContent>
|
|
27
|
+
<KolBadge _label="black"></KolBadge>
|
|
28
|
+
<KolBadge _color="#06539e" _label="blue"></KolBadge>
|
|
29
|
+
<KolBadge _color="#ae0000" _label="red with icon" _icons="kolicon-kolibri"></KolBadge>
|
|
30
|
+
</SampleBlock>
|
|
31
|
+
|
|
32
|
+
<SampleBlock id="smart-button" heading="Badges with Smart Button" className="flex flex-col gap-2" fitContent>
|
|
33
|
+
<KolBadge
|
|
34
|
+
_color="#06539e"
|
|
35
|
+
_label="blue"
|
|
36
|
+
_smartButton={{
|
|
37
|
+
_ariaDescription: 'blue',
|
|
38
|
+
_icons: 'kolicon-cross',
|
|
39
|
+
_label: 'Remove',
|
|
40
|
+
_on: { onClick: () => alert('clicked') },
|
|
41
|
+
}}
|
|
42
|
+
></KolBadge>
|
|
43
|
+
<KolBadge
|
|
44
|
+
_color="#8b008b"
|
|
45
|
+
_icons="kolicon-kolibri"
|
|
46
|
+
_label="purple with icon"
|
|
47
|
+
_smartButton={{
|
|
48
|
+
_ariaDescription: 'purple with icon',
|
|
49
|
+
_icons: 'kolicon-cross',
|
|
50
|
+
_label: 'Remove',
|
|
51
|
+
_on: { onClick: () => alert('clicked') },
|
|
52
|
+
}}
|
|
53
|
+
></KolBadge>
|
|
54
|
+
</SampleBlock>
|
|
55
|
+
|
|
56
|
+
<SampleBlock id="formatted-label" heading="Formatted Label" className="flex flex-col gap-2" fitContent>
|
|
57
|
+
<KolBadge _color="#7db4ebff" _label="**Bold** and _italic_ Markdown label" />
|
|
58
|
+
<KolBadge _color="#8feb7dff" _label="This is ~~strikethrough~~ text" />
|
|
59
|
+
<KolBadge _color="#e6ee8eff" _label="Source code like `y = mx + n` is possible" />
|
|
60
|
+
</SampleBlock>
|
|
20
61
|
</div>
|
|
21
62
|
</>
|
|
22
63
|
);
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import type { Routes } from '../../shares/types';
|
|
2
2
|
import { BadgeBasic } from './basic';
|
|
3
|
-
import { BadgeButton } from './button';
|
|
4
|
-
import { FormattedLabel } from './formatted-label';
|
|
5
3
|
|
|
6
4
|
export const BADGE_ROUTES: Routes = {
|
|
7
5
|
badge: {
|
|
8
6
|
basic: BadgeBasic,
|
|
9
|
-
button: BadgeButton,
|
|
10
|
-
'formatted-label': FormattedLabel,
|
|
11
7
|
},
|
|
12
8
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
3
|
import { KolBreadcrumb } from '@public-ui/react-v19';
|
|
4
|
+
import { SampleBlock } from '../SampleBlock';
|
|
4
5
|
import { SampleDescription } from '../SampleDescription';
|
|
5
6
|
|
|
6
7
|
import type { FC } from 'react';
|
|
@@ -11,7 +12,7 @@ export const BreadcrumbBasic: FC = () => (
|
|
|
11
12
|
<p>KolBreadcrumb shows a breadcrumb navigation. The sample illustrates a variation of link, text and icon elements.</p>
|
|
12
13
|
</SampleDescription>
|
|
13
14
|
|
|
14
|
-
<
|
|
15
|
+
<SampleBlock id="basic" narrow>
|
|
15
16
|
<KolBreadcrumb
|
|
16
17
|
_label="Breadcrumb aus Text-Links"
|
|
17
18
|
_links={[
|
|
@@ -57,6 +58,6 @@ export const BreadcrumbBasic: FC = () => (
|
|
|
57
58
|
]}
|
|
58
59
|
></KolBreadcrumb>
|
|
59
60
|
<KolBreadcrumb _label="Minimal Breadcrumb" _links={[{ _label: 'Homepage', _href: '#/back-page' }]}></KolBreadcrumb>
|
|
60
|
-
</
|
|
61
|
+
</SampleBlock>
|
|
61
62
|
</>
|
|
62
63
|
);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { KolButton,
|
|
1
|
+
import { KolButton, KolLink } from '@public-ui/react-v19';
|
|
2
2
|
import type { FC } from 'react';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { useToasterService } from '../../hooks/useToasterService';
|
|
5
|
+
import { SampleBlock } from '../SampleBlock';
|
|
5
6
|
import { SampleDescription } from '../SampleDescription';
|
|
6
7
|
|
|
7
8
|
export const ButtonAccessKey: FC = () => {
|
|
@@ -22,24 +23,21 @@ export const ButtonAccessKey: FC = () => {
|
|
|
22
23
|
</SampleDescription>
|
|
23
24
|
|
|
24
25
|
<div className="grid gap-8">
|
|
25
|
-
<
|
|
26
|
-
<KolHeading _level={2} _label="Buttons with Access Keys" />
|
|
26
|
+
<SampleBlock id="buttons-access-keys" heading="Buttons with Access Keys" fitContent>
|
|
27
27
|
<div className="flex flex-wrap gap-4">
|
|
28
28
|
<KolButton _label="With S access key" _accessKey="S" _on={dummyEventHandler} />
|
|
29
29
|
<KolButton _label="Very small b" _accessKey="b" _on={dummyEventHandler} />
|
|
30
30
|
<KolButton _label="Access key does not appear in label" _accessKey="x" _on={dummyEventHandler} />
|
|
31
31
|
</div>
|
|
32
|
-
</
|
|
32
|
+
</SampleBlock>
|
|
33
33
|
|
|
34
|
-
<
|
|
35
|
-
<KolHeading _level={2} _label="Access Key with Hidden Label" />
|
|
34
|
+
<SampleBlock id="access-key-hidden-label" heading="Access Key with Hidden Label" fitContent>
|
|
36
35
|
<div className="flex flex-wrap gap-4">
|
|
37
36
|
<KolButton _label="access key without label" _hideLabel _accessKey="a" _icons="kolicon-cogwheel" _on={dummyEventHandler} />
|
|
38
37
|
</div>
|
|
39
|
-
</
|
|
38
|
+
</SampleBlock>
|
|
40
39
|
|
|
41
|
-
<
|
|
42
|
-
<KolHeading _level={2} _label="Access Key with Inline Icons" />
|
|
40
|
+
<SampleBlock id="access-key-inline-icons" heading="Access Key with Inline Icons" fitContent>
|
|
43
41
|
<div className="flex flex-wrap gap-4">
|
|
44
42
|
<KolButton
|
|
45
43
|
_label="with inline icons"
|
|
@@ -51,7 +49,7 @@ export const ButtonAccessKey: FC = () => {
|
|
|
51
49
|
_on={dummyEventHandler}
|
|
52
50
|
/>
|
|
53
51
|
</div>
|
|
54
|
-
</
|
|
52
|
+
</SampleBlock>
|
|
55
53
|
</div>
|
|
56
54
|
</>
|
|
57
55
|
);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { KolButton
|
|
1
|
+
import { KolButton } from '@public-ui/react-v19';
|
|
2
2
|
import type { FC } from 'react';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { useToasterService } from '../../hooks/useToasterService';
|
|
5
|
+
import { SampleBlock } from '../SampleBlock';
|
|
5
6
|
import { SampleDescription } from '../SampleDescription';
|
|
6
7
|
|
|
7
8
|
export const ButtonAriaDescription: FC = () => {
|
|
@@ -21,13 +22,12 @@ export const ButtonAriaDescription: FC = () => {
|
|
|
21
22
|
</SampleDescription>
|
|
22
23
|
|
|
23
24
|
<div className="grid gap-8">
|
|
24
|
-
<
|
|
25
|
-
<KolHeading _level={2} _label="Buttons with and without ARIA Description" />
|
|
25
|
+
<SampleBlock id="buttons-aria-description" heading="Buttons with and without ARIA Description" fitContent>
|
|
26
26
|
<div className="flex flex-wrap gap-4">
|
|
27
27
|
<KolButton _label="Button without ARIA description" _on={dummyEventHandler} />
|
|
28
28
|
<KolButton _label="Button with ARIA description" _ariaDescription="This button performs an important action" _on={dummyEventHandler} />
|
|
29
29
|
</div>
|
|
30
|
-
</
|
|
30
|
+
</SampleBlock>
|
|
31
31
|
</div>
|
|
32
32
|
</>
|
|
33
33
|
);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { KolButton
|
|
1
|
+
import { KolButton } from '@public-ui/react-v19';
|
|
2
2
|
import type { FC } from 'react';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { useToasterService } from '../../hooks/useToasterService';
|
|
5
|
+
import { SampleBlock } from '../SampleBlock';
|
|
5
6
|
import { SampleDescription } from '../SampleDescription';
|
|
6
7
|
|
|
7
8
|
export const ButtonBaselined: FC = () => {
|
|
@@ -21,13 +22,12 @@ export const ButtonBaselined: FC = () => {
|
|
|
21
22
|
</SampleDescription>
|
|
22
23
|
|
|
23
24
|
<div className="grid gap-8">
|
|
24
|
-
<
|
|
25
|
-
<KolHeading _level={2} _label="Vertically Aligned Buttons" />
|
|
25
|
+
<SampleBlock id="vertically-aligned-buttons" heading="Vertically Aligned Buttons" fitContent>
|
|
26
26
|
<div className="flex flex-wrap gap-2">
|
|
27
27
|
<KolButton _label="Label-Text" _on={dummyEventHandler} />
|
|
28
28
|
<KolButton _icons="kolicon-cogwheel" _label="Label-Text with Icon" _on={dummyEventHandler} />
|
|
29
29
|
</div>
|
|
30
|
-
</
|
|
30
|
+
</SampleBlock>
|
|
31
31
|
</div>
|
|
32
32
|
</>
|
|
33
33
|
);
|