@public-ui/sample-react 2.1.3 → 2.1.4-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/dist/1069.js +1 -1
  2. package/dist/1085.js +1 -1
  3. package/dist/1184.js +1 -1
  4. package/dist/1222.js +1 -1
  5. package/dist/1278.js +1 -1
  6. package/dist/1325.js +1 -1
  7. package/dist/1333.js +1 -1
  8. package/dist/1661.js +1 -1
  9. package/dist/1703.js +1 -1
  10. package/dist/1711.js +1 -1
  11. package/dist/1771.js +2 -0
  12. package/dist/1792.js +1 -1
  13. package/dist/1793.js +1 -1
  14. package/dist/1878.js +1 -1
  15. package/dist/1957.js +1 -1
  16. package/dist/2305.js +1 -1
  17. package/dist/2471.js +1 -1
  18. package/dist/2538.js +1 -1
  19. package/dist/279.js +1 -1
  20. package/dist/2830.js +1 -1
  21. package/dist/3180.js +1 -1
  22. package/dist/3332.js +1 -1
  23. package/dist/3454.js +1 -1
  24. package/dist/3596.js +1 -1
  25. package/dist/3714.js +1 -1
  26. package/dist/3797.js +1 -1
  27. package/dist/3974.js +1 -1
  28. package/dist/3990.js +1 -1
  29. package/dist/4014.js +1 -1
  30. package/dist/4102.js +1 -1
  31. package/dist/4218.js +1 -1
  32. package/dist/4303.js +1 -1
  33. package/dist/4404.js +1 -1
  34. package/dist/453.js +1 -1
  35. package/dist/4941.js +1 -1
  36. package/dist/500.js +1 -1
  37. package/dist/5139.js +1 -1
  38. package/dist/5164.js +1 -1
  39. package/dist/5365.js +1 -1
  40. package/dist/5540.js +1 -1
  41. package/dist/5756.js +1 -1
  42. package/dist/6393.js +1 -1
  43. package/dist/6682.js +1 -1
  44. package/dist/6781.js +1 -1
  45. package/dist/7100.js +1 -1
  46. package/dist/7238.js +2 -0
  47. package/dist/7245.js +1 -1
  48. package/dist/7263.js +1 -1
  49. package/dist/7512.js +1 -1
  50. package/dist/7856.js +1 -1
  51. package/dist/8002.js +1 -1
  52. package/dist/8189.js +1 -1
  53. package/dist/8264.js +1 -1
  54. package/dist/8384.js +1 -1
  55. package/dist/8389.js +1 -1
  56. package/dist/8515.js +1 -1
  57. package/dist/8557.js +1 -1
  58. package/dist/8588.js +1 -1
  59. package/dist/8631.js +2 -0
  60. package/dist/8724.js +1 -1
  61. package/dist/8791.js +2 -0
  62. package/dist/882.js +1 -1
  63. package/dist/8823.js +1 -1
  64. package/dist/895.js +1 -1
  65. package/dist/8993.js +1 -1
  66. package/dist/902.js +1 -1
  67. package/dist/9175.js +1 -1
  68. package/dist/9202.js +1 -1
  69. package/dist/9265.js +2 -0
  70. package/dist/9265.js.LICENSE.txt +3 -0
  71. package/dist/9833.js +1 -1
  72. package/dist/9961.js +1 -1
  73. package/dist/main.js +1 -1
  74. package/package.json +5 -5
  75. package/src/components/FormWrap.tsx +22 -26
  76. package/src/components/alert/basic.tsx +1 -1
  77. package/src/components/button/partials/cases.tsx +5 -5
  78. package/src/components/button/partials/variants.tsx +7 -8
  79. package/src/components/card/routes.ts +0 -2
  80. package/src/components/combobox/partials/cases.tsx +3 -3
  81. package/src/components/combobox/partials/variants.tsx +3 -3
  82. package/src/components/drawer/basic.tsx +61 -0
  83. package/src/components/drawer/controlled.tsx +47 -0
  84. package/src/components/drawer/partials/align.tsx +26 -0
  85. package/src/components/drawer/routes.ts +10 -0
  86. package/src/components/handout/basic.tsx +5 -550
  87. package/src/components/handout/table-data.ts +543 -0
  88. package/src/components/input-checkbox/button.tsx +3 -2
  89. package/src/components/skip-nav/basic.tsx +3 -3
  90. package/src/components/table/badge-size.tsx +4 -4
  91. package/src/components/table/column-alignment.tsx +1 -2
  92. package/src/components/table/horizontal-scrollbar.tsx +1 -1
  93. package/src/components/table/render-cell.tsx +1 -1
  94. package/src/components/table/sort-data.tsx +6 -6
  95. package/src/components/table/stateful-with-selection.tsx +8 -6
  96. package/src/components/table/stateless-with-selection.tsx +6 -4
  97. package/src/components/tabs/basic.tsx +1 -1
  98. package/src/components/tabs/icons-only.tsx +2 -1
  99. package/src/scenarios/inputs-get-value.tsx +13 -1
  100. package/src/scenarios/static-form.tsx +3 -0
  101. package/src/shares/routes.ts +2 -0
  102. package/dist/1204.js +0 -2
  103. package/dist/7909.js +0 -2
  104. package/dist/8890.js +0 -2
  105. package/dist/8921.js +0 -2
  106. package/src/components/types.tsx +0 -26
  107. /package/dist/{1204.js.LICENSE.txt → 1771.js.LICENSE.txt} +0 -0
  108. /package/dist/{7909.js.LICENSE.txt → 7238.js.LICENSE.txt} +0 -0
  109. /package/dist/{8890.js.LICENSE.txt → 8631.js.LICENSE.txt} +0 -0
  110. /package/dist/{8921.js.LICENSE.txt → 8791.js.LICENSE.txt} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@public-ui/sample-react",
3
- "version": "2.1.3",
3
+ "version": "2.1.4-alpha.1",
4
4
  "description": "This app contains samples for the KoliBri/Public UI",
5
5
  "license": "EUPL-1.2",
6
6
  "dependencies": {
@@ -29,9 +29,9 @@
29
29
  "typescript": "5.5.2",
30
30
  "world_countries_lists": "2.9.0",
31
31
  "yup": "1.4.0",
32
- "@public-ui/react": "2.1.3",
33
- "@public-ui/components": "2.1.3",
34
- "@public-ui/themes": "2.1.3"
32
+ "@public-ui/react": "2.1.4-alpha.1",
33
+ "@public-ui/components": "2.1.4-alpha.1",
34
+ "@public-ui/themes": "2.1.4-alpha.1"
35
35
  },
36
36
  "files": [
37
37
  ".eslintignore",
@@ -51,7 +51,7 @@
51
51
  "build": "rimraf dist && cross-env NODE_ENV=production webpack",
52
52
  "build:deps": "pnpm --filter @public-ui/sample-react^... build",
53
53
  "format": "prettier --check src",
54
- "lint": "eslint \"{src,tests}/**/*.{html,js,json,jsx,ts,tsx,gql,graphql}\"",
54
+ "lint": "tsc --noemit && eslint \"{src,tests}/**/*.{html,js,json,jsx,ts,tsx,gql,graphql}\"",
55
55
  "prepare:components-assets": "cpy \"node_modules/@public-ui/components/assets/**/*\" public/assets --dot",
56
56
  "prepare:themes-assets": "cpy \"node_modules/@public-ui/themes/assets/**/*\" public/assets --dot",
57
57
  "serve": "cross-env NODE_ENV=development webpack serve --devtool=source-map",
@@ -1,31 +1,27 @@
1
- import type { FC } from 'react';
2
1
  import React from 'react';
3
2
 
4
3
  import { KolButton, KolForm } from '@public-ui/react';
5
- import type { RefFormComponent } from './types';
6
4
 
7
- type FormWrapProps = {
8
- RefComponent: RefFormComponent;
9
- } & Record<string, unknown>;
10
-
11
- export const FormWrap: FC<FormWrapProps> = (props) => (
12
- <KolForm>
13
- <div className="grid gap-4">
14
- <props.RefComponent {...props} />
15
- <div className="flex gap-4">
16
- <KolButton _label="Submit" _icons="codicon codicon-arrow-right" _type="submit" _variant="primary" />
17
- <KolButton
18
- _label="Bunte Icons"
19
- _icons={{
20
- left: { icon: 'codicon codicon-heart-filled', style: { color: '#cc006e' } },
21
- right: { icon: 'codicon codicon-squirrel', style: { color: '#b41b1b' } },
22
- }}
23
- _type="submit"
24
- _variant="secondary"
25
- />
26
- <KolButton _label="Reset" _type="reset" _variant="tertiary" />
27
- <KolButton _label="Help" _type="button" _variant="ghost" />
5
+ export const FormWrap = <P,>({ RefComponent: Component, ...props }: { RefComponent: any } & Partial<P>) => {
6
+ return (
7
+ <KolForm>
8
+ <div className="grid gap-4">
9
+ <Component {...props} />
10
+ <div className="flex gap-4">
11
+ <KolButton _label="Submit" _icons="codicon codicon-arrow-right" _type="submit" _variant="primary" />
12
+ <KolButton
13
+ _label="Bunte Icons"
14
+ _icons={{
15
+ left: { icon: 'codicon codicon-heart-filled', style: { color: '#cc006e' } },
16
+ right: { icon: 'codicon codicon-squirrel', style: { color: '#b41b1b' } },
17
+ }}
18
+ _type="submit"
19
+ _variant="secondary"
20
+ />
21
+ <KolButton _label="Reset" _type="reset" _variant="tertiary" />
22
+ <KolButton _label="Help" _type="button" _variant="ghost" />
23
+ </div>
28
24
  </div>
29
- </div>
30
- </KolForm>
31
- );
25
+ </KolForm>
26
+ );
27
+ };
@@ -10,7 +10,7 @@ type PropsByType = {
10
10
  variant: AlertVariant;
11
11
  };
12
12
  type PropsBasic = {
13
- variant: AlertVariant;
13
+ variant?: AlertVariant;
14
14
  };
15
15
 
16
16
  const AlertByType: FC<PropsByType> = ({ level, type, variant }) => (
@@ -1,9 +1,9 @@
1
- import type { Components } from '@public-ui/components';
2
- import React, { forwardRef } from 'react';
1
+ import React from 'react';
3
2
 
4
3
  import { KolButton } from '@public-ui/react';
4
+ import type { Components } from '@public-ui/components';
5
5
 
6
- export const ButtonCases = forwardRef<HTMLKolButtonElement, Components.KolButton>(function InputCheckboxCases(props, ref) {
6
+ export const ButtonCases = function ButtonCases(props: Partial<Components.KolButton>) {
7
7
  return (
8
8
  <div className="flex flex-wrap gap-4">
9
9
  <KolButton {...props} _icons="codicon codicon-home" _label="Primary" _variant="primary"></KolButton>
@@ -11,7 +11,7 @@ export const ButtonCases = forwardRef<HTMLKolButtonElement, Components.KolButton
11
11
  <KolButton {...props} _icons="codicon codicon-hubot" _label="Normal" _variant="normal"></KolButton>
12
12
  <KolButton {...props} _icons="codicon codicon-hubot" _label="Tertiary" _variant="tertiary"></KolButton>
13
13
  <KolButton {...props} _icons="codicon codicon-trash" _label="Danger" _variant="danger"></KolButton>
14
- <KolButton ref={ref} {...props} _icons="codicon codicon-reactions" _label="Ghost" _variant="ghost"></KolButton>
14
+ <KolButton {...props} _icons="codicon codicon-reactions" _label="Ghost" _variant="ghost"></KolButton>
15
15
  </div>
16
16
  );
17
- });
17
+ };
@@ -1,28 +1,27 @@
1
- import type { Components } from '@public-ui/components';
2
- import React, { forwardRef } from 'react';
1
+ import React from 'react';
3
2
 
4
3
  import { ButtonCases } from './cases';
5
4
 
6
- export const ButtonVariants = forwardRef<HTMLKolButtonElement, Components.KolButton>(function InputCheckboxVariant(props, ref) {
5
+ export const ButtonVariants = function ButtonVariant() {
7
6
  return (
8
7
  <div className="grid gap-4">
9
8
  <h1>Button</h1>
10
9
  <section>
11
10
  <h2>Button</h2>
12
- <ButtonCases {...props} />
11
+ <ButtonCases />
13
12
  </section>
14
13
  <section>
15
14
  <h2>Button (disabled)</h2>
16
- <ButtonCases {...props} _disabled />
15
+ <ButtonCases _disabled />
17
16
  </section>
18
17
  <section>
19
18
  <h2>Button (hideLabel)</h2>
20
- <ButtonCases ref={ref} {...props} _hideLabel />
19
+ <ButtonCases _hideLabel />
21
20
  </section>
22
21
  <section>
23
22
  <h2>Button (disabled, hideLabel)</h2>
24
- <ButtonCases {...props} _disabled _hideLabel />
23
+ <ButtonCases _disabled _hideLabel />
25
24
  </section>
26
25
  </div>
27
26
  );
28
- });
27
+ };
@@ -3,10 +3,8 @@ import { CardBasic } from './basic';
3
3
  import { CardConfirm } from './confirm';
4
4
  import { CardFlex } from './flex';
5
5
  import { CardSelection } from './selection';
6
- import { SampleDescription } from '../SampleDescription';
7
6
 
8
7
  export const CARD_ROUTES: Routes = {
9
- //SYNTAXERROR
10
8
  card: {
11
9
  basic: CardBasic,
12
10
  confirm: CardConfirm,
@@ -3,11 +3,10 @@ import React, { forwardRef } from 'react';
3
3
  import { KolCombobox } from '@public-ui/react';
4
4
 
5
5
  import { ERROR_MSG, HINT_MSG } from '../../../shares/constants';
6
-
7
- import type { Components } from '@public-ui/components';
8
6
  import { COUNTRY_SUGGESTIONS } from '../../../shares/country';
7
+ import type { Components } from '@public-ui/components';
9
8
 
10
- export const ComboboxCases = forwardRef<HTMLKolSelectElement, Components.KolSelect>(function ComboboxCases(props) {
9
+ export const ComboboxCases = forwardRef<HTMLKolComboboxElement, Components.KolCombobox>(function InputComboboxCases(props) {
11
10
  return (
12
11
  <div className="grid gap-4">
13
12
  <KolCombobox
@@ -18,6 +17,7 @@ export const ComboboxCases = forwardRef<HTMLKolSelectElement, Components.KolSele
18
17
  _value={'Deutschland'}
19
18
  _on={{
20
19
  onBlur: console.log,
20
+ onInput: console.log,
21
21
  onChange: console.log,
22
22
  onClick: console.log,
23
23
  onFocus: console.log,
@@ -1,14 +1,14 @@
1
1
  import React, { forwardRef } from 'react';
2
+ import type { Components } from '@public-ui/components';
2
3
 
3
4
  import { ComboboxCases } from './cases';
4
5
 
5
- import type { Components } from '@public-ui/components';
6
- export const ComboboxVariants = forwardRef<HTMLKolSelectElement, Components.KolSelect>(function SelectVariant(props, ref) {
6
+ export const ComboboxVariants = forwardRef<HTMLKolComboboxElement, Components.KolCombobox>(function InputComboboxVariant(props, ref) {
7
7
  return (
8
8
  <div className="grid md:grid-cols-2 gap-4">
9
9
  <fieldset>
10
10
  <legend>Text</legend>
11
- <ComboboxCases {...props} />
11
+ <ComboboxCases ref={ref} {...props} />
12
12
  </fieldset>
13
13
  <fieldset>
14
14
  <legend>Text (hideLabel)</legend>
@@ -0,0 +1,61 @@
1
+ import type { FC } from 'react';
2
+ import React, { useRef, useState, useContext, useEffect } from 'react';
3
+ import { useSearchParams } from 'react-router-dom';
4
+
5
+ import { HideMenusContext } from '../../shares/HideMenusContext';
6
+ import type { AlignPropType } from '@public-ui/components';
7
+ import { KolDrawer, KolButton, KolBadge } from '@public-ui/react';
8
+ import { SampleDescription } from '../SampleDescription';
9
+
10
+ import { DrawerRadioAlign } from './partials/align';
11
+
12
+ export const DrawerBasic: FC = () => {
13
+ const [searchParams] = useSearchParams();
14
+ const defaultAlign = searchParams.get('align') as AlignPropType;
15
+ const hideMenus = useContext(HideMenusContext);
16
+ const drawerElement = useRef<HTMLKolDrawerElement>(null);
17
+ const drawerModalElement = useRef<HTMLKolDrawerElement>(null);
18
+ const [align, setAlign] = useState<AlignPropType>(defaultAlign);
19
+ useEffect(() => {
20
+ if (defaultAlign) {
21
+ drawerModalElement.current?.open();
22
+ }
23
+ }, [defaultAlign]);
24
+ return (
25
+ <>
26
+ {!hideMenus && <KolBadge className="block mb-3" _label="Component is a DRAFT - Don't use in production yet." _color="#db5461" />}
27
+ <SampleDescription>
28
+ <p>
29
+ Hier ist ein Beispiel für ein Drawer. Dieser lässt sich öffnen und schließen mit Methoden. Dadurch erscheint ein Dialog mit Text und
30
+ &apos;Schließen&apos; Button. Durch anklicken des &apos;Schließen&apos; Button, schließt sich der Dialog wieder. Zusätzlich lässt sich der Dialog als
31
+ Modal (_modal) durch ESC schließen. Beide Varianten können über das Attribut _align links, oben, rechts oder unten ausgerichtet werden.
32
+ </p>
33
+ </SampleDescription>
34
+ <DrawerRadioAlign value={align} onChange={(_, value) => setAlign(value as AlignPropType)} />
35
+ <div className="flex flex-wrap gap-4">
36
+ <KolDrawer ref={drawerElement} _label="Ich bin ein Drawer" _align={align} _on={{ onClose: () => console.log('Drawer onClose triggered!') }}>
37
+ <p>
38
+ Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam
39
+ voluptua.
40
+ </p>
41
+ <KolButton _label="Close drawer" _on={{ onClick: () => drawerElement.current?.close() }} />
42
+ </KolDrawer>
43
+ <KolButton _label="Open drawer" _on={{ onClick: () => drawerElement.current?.open() }} />
44
+ <KolDrawer
45
+ ref={drawerModalElement}
46
+ _modal
47
+ _align={align}
48
+ _label="Ich bin ein Drawer Modal"
49
+ _on={{ onClose: () => console.log('Drawer Modal onClose triggered!') }}
50
+ >
51
+ <p>
52
+ Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam
53
+ voluptua.
54
+ </p>
55
+ <KolButton _label="Close drawer modal" _on={{ onClick: () => drawerModalElement.current?.close() }} />
56
+ </KolDrawer>
57
+ <KolButton _label="Open drawer as modal" _on={{ onClick: () => drawerModalElement.current?.open() }} />
58
+ </div>
59
+ </>
60
+ );
61
+ };
@@ -0,0 +1,47 @@
1
+ import type { FC } from 'react';
2
+ import React, { useState, useContext } from 'react';
3
+ import { useSearchParams } from 'react-router-dom';
4
+
5
+ import { HideMenusContext } from '../../shares/HideMenusContext';
6
+ import type { AlignPropType } from '@public-ui/components';
7
+ import { KolDrawer, KolButton, KolBadge } from '@public-ui/react';
8
+ import { SampleDescription } from '../SampleDescription';
9
+
10
+ import { DrawerRadioAlign } from './partials/align';
11
+
12
+ export const DrawerControlled: FC = () => {
13
+ const [searchParams] = useSearchParams();
14
+ const defaultAlign = searchParams.get('align') as AlignPropType;
15
+ const hideMenus = useContext(HideMenusContext);
16
+ const [open, setOpen] = useState(false);
17
+ const [modalOpen, setModalOpen] = useState(false);
18
+ const [align, setAlign] = useState<AlignPropType>(defaultAlign);
19
+ return (
20
+ <div>
21
+ {!hideMenus && <KolBadge className="block mb-3" _label="Component is a DRAFT - Don't use in production yet." _color="#db5461" />}
22
+ <SampleDescription>
23
+ <p>
24
+ Hier ist ein Beispiel für einen kontrollierten Drawer. Dieser lässt sich öffnen und schließen über das Attribut _open. Zusätzlich lässt sich der
25
+ Dialog als Modal (_modal) durch ESC schließen. Der Drawer kann über das Attribut _align links, oben, rechts oder unten ausgerichtet werden.
26
+ </p>
27
+ </SampleDescription>
28
+ <DrawerRadioAlign value={align} onChange={(_, value) => setAlign(value as AlignPropType)} />
29
+ <div className="flex flex-wrap gap-4">
30
+ <KolDrawer _open={open} _align={align} _label="Ich bin ein kotrollierter Drawer" _on={{ onClose: () => setOpen(false) }}>
31
+ <div>
32
+ <p>Lorem ipsum dolor sit amet,</p>
33
+ <KolButton _label="Close drawer" _on={{ onClick: () => setOpen(false) }} />
34
+ </div>
35
+ </KolDrawer>
36
+ <KolButton _label="Open drawer" _on={{ onClick: () => setOpen(true) }} />
37
+ <KolDrawer _open={modalOpen} _modal _align={align} _label="Ich bin ein kotrollierter Modal Drawer" _on={{ onClose: () => setModalOpen(false) }}>
38
+ <div>
39
+ <p>Lorem ipsum dolor sit amet,</p>
40
+ <KolButton _label="Close drawer" _on={{ onClick: () => setModalOpen(false) }} />
41
+ </div>
42
+ </KolDrawer>
43
+ <KolButton _label="Open drawer as modal" _on={{ onClick: () => setModalOpen(true) }} />
44
+ </div>
45
+ </div>
46
+ );
47
+ };
@@ -0,0 +1,26 @@
1
+ import type { FC } from 'react';
2
+ import React from 'react';
3
+
4
+ import { KolInputRadio } from '@public-ui/react';
5
+
6
+ import type { AlignPropType } from '@public-ui/components';
7
+
8
+ const options = ['left', 'top', 'right', 'bottom'].map((align) => ({
9
+ label: align,
10
+ value: align,
11
+ }));
12
+
13
+ type DrawerRadioAlignProps = {
14
+ value?: AlignPropType;
15
+ onChange?: (_: Event, value: unknown) => void;
16
+ };
17
+
18
+ export const DrawerRadioAlign: FC<DrawerRadioAlignProps> = ({ value = 'left', onChange }) => {
19
+ return (
20
+ <div className="grid gap-4">
21
+ <div className="container my-4 d-grid gap-4">
22
+ <KolInputRadio _label="Drawer alignment" _value={value} _options={options} _orientation="horizontal" _on={{ onChange }} />
23
+ </div>
24
+ </div>
25
+ );
26
+ };
@@ -0,0 +1,10 @@
1
+ import { Routes } from '../../shares/types';
2
+ import { DrawerBasic } from './basic';
3
+ import { DrawerControlled } from './controlled';
4
+
5
+ export const DRAWER_ROUTES: Routes = {
6
+ drawer: {
7
+ basic: DrawerBasic,
8
+ controlled: DrawerControlled,
9
+ },
10
+ };