@public-ui/sample-react 2.1.7 → 2.1.8

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 (160) hide show
  1. package/dist/1487.js +1 -1
  2. package/dist/1636.js +1 -1
  3. package/dist/1792.js +1 -1
  4. package/dist/1795.js +1 -1
  5. package/dist/2017.js +1 -1
  6. package/dist/2322.js +1 -1
  7. package/dist/2538.js +1 -1
  8. package/dist/2567.js +1 -1
  9. package/dist/263.js +1 -1
  10. package/dist/2719.js +1 -1
  11. package/dist/3064.js +1 -1
  12. package/dist/3077.js +1 -1
  13. package/dist/3238.js +1 -1
  14. package/dist/3301.js +2 -0
  15. package/dist/3395.js +1 -1
  16. package/dist/35.js +1 -1
  17. package/dist/3521.js +1 -1
  18. package/dist/356.js +1 -1
  19. package/dist/3714.js +1 -1
  20. package/dist/3735.js +1 -1
  21. package/dist/3766.js +1 -1
  22. package/dist/3994.js +1 -1
  23. package/dist/4025.js +1 -1
  24. package/dist/4065.js +2 -0
  25. package/dist/4118.js +1 -1
  26. package/dist/4182.js +1 -1
  27. package/dist/4188.js +1 -1
  28. package/dist/4332.js +1 -1
  29. package/dist/4402.js +1 -1
  30. package/dist/4795.js +2 -0
  31. package/dist/4818.js +1 -1
  32. package/dist/4892.js +1 -1
  33. package/dist/4933.js +1 -1
  34. package/dist/4943.js +1 -1
  35. package/dist/495.js +1 -1
  36. package/dist/5034.js +1 -1
  37. package/dist/5056.js +1 -1
  38. package/dist/5138.js +1 -1
  39. package/dist/5296.js +1 -1
  40. package/dist/5356.js +1 -1
  41. package/dist/5551.js +1 -1
  42. package/dist/5835.js +1 -1
  43. package/dist/5840.js +1 -1
  44. package/dist/5889.js +1 -1
  45. package/dist/5912.js +1 -1
  46. package/dist/6082.js +1 -1
  47. package/dist/6099.js +1 -1
  48. package/dist/6181.js +1 -1
  49. package/dist/619.js +1 -1
  50. package/dist/6671.js +1 -1
  51. package/dist/6775.js +1 -1
  52. package/dist/7274.js +1 -1
  53. package/dist/7440.js +2 -0
  54. package/dist/7795.js +1 -1
  55. package/dist/7802.js +1 -1
  56. package/dist/7860.js +1 -1
  57. package/dist/8092.js +1 -1
  58. package/dist/8111.js +1 -1
  59. package/dist/8146.js +1 -1
  60. package/dist/8427.js +1 -1
  61. package/dist/8495.js +1 -1
  62. package/dist/8672.js +1 -1
  63. package/dist/8737.js +1 -1
  64. package/dist/8786.js +1 -1
  65. package/dist/8796.js +1 -1
  66. package/dist/8977.js +1 -1
  67. package/dist/9333.js +1 -1
  68. package/dist/9389.js +1 -1
  69. package/dist/9561.js +1 -1
  70. package/dist/9599.js +1 -1
  71. package/dist/9612.js +1 -1
  72. package/dist/9890.js +1 -1
  73. package/dist/index.html +1 -1
  74. package/dist/main.css +3 -3
  75. package/dist/main.js +1 -1
  76. package/dist/main.js.LICENSE.txt +2 -2
  77. package/package.json +16 -16
  78. package/public/index.html +1 -1
  79. package/src/@shared/_mixins.scss +3 -0
  80. package/src/App.tsx +1 -1
  81. package/src/components/FormWrap.tsx +1 -1
  82. package/src/components/Navigation.tsx +63 -0
  83. package/src/components/Sidebar.tsx +5 -41
  84. package/src/components/abbr/basic.tsx +12 -12
  85. package/src/components/alert/card-msg.tsx +3 -1
  86. package/src/components/alert/html.tsx +4 -2
  87. package/src/components/button/access-key.tsx +34 -25
  88. package/src/components/button/aria-description.tsx +20 -11
  89. package/src/components/button/baselined.tsx +22 -13
  90. package/src/components/button/icons.tsx +33 -26
  91. package/src/components/button/partials/cases.tsx +13 -6
  92. package/src/components/button/partials/variants.tsx +15 -17
  93. package/src/components/button/width.tsx +33 -28
  94. package/src/components/button-group/basic.tsx +25 -16
  95. package/src/components/button-link/basic.tsx +3 -3
  96. package/src/components/button-link/image.tsx +0 -1
  97. package/src/components/card/basic.tsx +1 -1
  98. package/src/components/combobox/partials/variants.tsx +1 -1
  99. package/src/components/details/basic.tsx +2 -2
  100. package/src/components/form/basic.tsx +1 -1
  101. package/src/components/form/error-list.tsx +1 -0
  102. package/src/components/handout/basic.tsx +304 -279
  103. package/src/components/input-checkbox/partials/variants.tsx +22 -10
  104. package/src/components/input-date/reset.tsx +1 -1
  105. package/src/components/input-password/show-password.tsx +1 -1
  106. package/src/components/input-text/partials/cases.tsx +1 -1
  107. package/src/components/input-text/routes.ts +2 -0
  108. package/src/components/input-text/smart-button.tsx +33 -0
  109. package/src/components/input-text/text-formatter.tsx +98 -45
  110. package/src/components/link/image.tsx +0 -1
  111. package/src/components/link/target.tsx +1 -1
  112. package/src/components/modal/basic.tsx +1 -1
  113. package/src/components/nav/basic.tsx +23 -12
  114. package/src/components/nav/horizontal.tsx +12 -3
  115. package/src/components/nav/links.ts +36 -0
  116. package/src/components/table/column-alignment.tsx +64 -62
  117. package/src/components/table/complex-headers.tsx +80 -78
  118. package/src/components/table/horizontal-scrollbar.tsx +30 -28
  119. package/src/components/table/interactive-child-elements.tsx +81 -69
  120. package/src/components/table/pagination-position.tsx +15 -13
  121. package/src/components/table/render-cell.tsx +14 -3
  122. package/src/components/table/sort-data.tsx +11 -8
  123. package/src/components/table/stateful-with-selection.tsx +47 -27
  124. package/src/components/table/stateful-with-single-selection.tsx +47 -27
  125. package/src/components/table/stateless-with-selection.tsx +37 -17
  126. package/src/components/table/stateless-with-single-selection.tsx +37 -17
  127. package/src/components/table/stateless.tsx +29 -27
  128. package/src/components/table/with-footer.tsx +1 -0
  129. package/src/components/table/with-pagination.tsx +1 -1
  130. package/src/components/tabs/behavior.tsx +61 -0
  131. package/src/components/tabs/routes.ts +2 -0
  132. package/src/components/textarea/adjust-height.tsx +1 -1
  133. package/src/components/textarea/counter.tsx +4 -1
  134. package/src/components/textarea/resize.tsx +1 -1
  135. package/src/components/textarea/rows.tsx +1 -1
  136. package/src/components/toast/basic.tsx +13 -11
  137. package/src/hooks/useToasterService.ts +21 -0
  138. package/src/react.main.tsx +6 -1
  139. package/src/scenarios/appointment-form/AppointmentForm.tsx +1 -0
  140. package/src/scenarios/custom-tooltip-width.tsx +26 -11
  141. package/src/scenarios/disabled-interactive-elements.tsx +123 -114
  142. package/src/scenarios/focus-elements.tsx +21 -16
  143. package/src/scenarios/horizontal-scrollbar-advanced/TableHorizontalScrollbarAdvanced.tsx +1 -1
  144. package/src/scenarios/horizontal-scrollbar-advanced/layout.scss +19 -0
  145. package/src/scenarios/input-group-with-error.tsx +41 -0
  146. package/src/scenarios/inputs-get-value.tsx +121 -119
  147. package/src/scenarios/routes.ts +4 -2
  148. package/src/scenarios/static-form.tsx +65 -62
  149. package/src/style.scss +10 -13
  150. package/tsconfig.json +1 -2
  151. package/unocss.config.ts +213 -0
  152. package/dist/3171.js +0 -2
  153. package/dist/4262.js +0 -2
  154. package/dist/479.js +0 -2
  155. package/dist/8710.js +0 -2
  156. package/src/scenarios/horizontal-scrollbar-advanced/layout.css +0 -31
  157. /package/dist/{3171.js.LICENSE.txt → 3301.js.LICENSE.txt} +0 -0
  158. /package/dist/{4262.js.LICENSE.txt → 4065.js.LICENSE.txt} +0 -0
  159. /package/dist/{479.js.LICENSE.txt → 4795.js.LICENSE.txt} +0 -0
  160. /package/dist/{8710.js.LICENSE.txt → 7440.js.LICENSE.txt} +0 -0
@@ -5,15 +5,27 @@ import { InputCheckboxCases } from './cases';
5
5
  import type { Components } from '@public-ui/components';
6
6
  export const InputCheckboxVariants = forwardRef<HTMLKolInputCheckboxElement, Components.KolInputCheckbox>(function InputCheckboxVariant(props, ref) {
7
7
  return (
8
- <div className="grid md:grid-cols-2 gap-4">
9
- <fieldset>
10
- <legend>Checkbox</legend>
11
- <InputCheckboxCases {...props} />
12
- </fieldset>
13
- <fieldset>
14
- <legend>Checkbox (hideLabel)</legend>
15
- <InputCheckboxCases ref={ref} {...props} _hideLabel />
16
- </fieldset>
17
- </div>
8
+ <>
9
+ <div className="grid md:grid-cols-2 gap-4">
10
+ <fieldset>
11
+ <legend>Label align &quot;left&quot; with label</legend>
12
+ <InputCheckboxCases {...props} _labelAlign="left" />
13
+ </fieldset>
14
+ <fieldset>
15
+ <legend>Label align &quot;left&quot; without Label (hideLabel)</legend>
16
+ <InputCheckboxCases ref={ref} {...props} _hideLabel _labelAlign="left" />
17
+ </fieldset>
18
+ </div>
19
+ <div className="grid md:grid-cols-2 gap-4">
20
+ <fieldset>
21
+ <legend>Label align &quot;right&quot; with label</legend>
22
+ <InputCheckboxCases {...props} />
23
+ </fieldset>
24
+ <fieldset>
25
+ <legend>Label align &quot;right&quot; without Label (hideLabel)</legend>
26
+ <InputCheckboxCases ref={ref} {...props} _hideLabel />
27
+ </fieldset>
28
+ </div>
29
+ </>
18
30
  );
19
31
  });
@@ -14,7 +14,7 @@ export const InputDateReset = () => {
14
14
  </p>
15
15
  </SampleDescription>
16
16
 
17
- <KolInputDate ref={dateRef} _label="Resettable Input Date" _value="2024-02-10" />
17
+ <KolInputDate className="w-full" ref={dateRef} _label="Resettable Input Date" _value="2024-02-10" />
18
18
  <KolButton className="mt" _label={'Reset'} _on={{ onClick: () => dateRef.current?.reset() }} />
19
19
  </>
20
20
  );
@@ -16,7 +16,7 @@ export const InputPasswordShowPassword: FC = () => {
16
16
  </p>
17
17
  </SampleDescription>
18
18
 
19
- <KolForm>
19
+ <KolForm className="w-full">
20
20
  <KolInputPassword _placeholder="With 'Show password' button" _label="Password" ref={passwordRef} className="block" _variant="visibility-toggle" />
21
21
  <KolInputPassword
22
22
  _placeholder="With 'Show password' button and disabled"
@@ -38,7 +38,7 @@ export const InputTextCases = forwardRef<HTMLKolInputTextElement, Components.Kol
38
38
  <KolInputText {...props} _placeholder="Placeholder" _msg={{ _type: 'error', _description: ERROR_MSG }} _touched _type="url" _label="URL (url)" />
39
39
  <KolInputText {...props} _placeholder="Placeholder" _type="tel" _label="Telephone (tel)" _msg={{ _type: 'warning', _description: 'Small warning' }} />
40
40
  <KolInputText {...props} _placeholder="Placeholder" _type="tel" _label="Telephone (tel)" _msg={{ _type: 'success', _description: 'Success message' }} />
41
- <KolInputText {...props} _placeholder="Placeholder" _label="With counter" _hasCounter _maxLength={10} />
41
+ <KolInputText {...props} _placeholder="Placeholder" _label="With counter" _hasCounter _maxLength={10} _value="Lorem Ipsum" />
42
42
  <KolInputText {...props} _placeholder="Placeholder" _readOnly _label="First name (text, readonly)" />
43
43
  <KolInputText {...props} _value="Value" _readOnly _label="First name (text, readonly)" />
44
44
  <KolInputText {...props} _placeholder="Placeholder" _disabled _label="First name (text, disabled)" />
@@ -2,11 +2,13 @@ import { Routes } from '../../shares/types';
2
2
  import { InputTextBasic } from './basic';
3
3
  import { InputTextHideErrors } from './hide-errors';
4
4
  import { InputTextFormatterDemo } from './text-formatter';
5
+ import { InputTextSmartButton } from './smart-button';
5
6
 
6
7
  export const INPUT_TEXT_ROUTES: Routes = {
7
8
  'input-text': {
8
9
  basic: InputTextBasic,
9
10
  'hide-errors': InputTextHideErrors,
10
11
  'text-formatter': InputTextFormatterDemo,
12
+ 'smart-button': InputTextSmartButton,
11
13
  },
12
14
  };
@@ -0,0 +1,33 @@
1
+ import * as React from 'react';
2
+ import { SampleDescription } from '../SampleDescription';
3
+ import { ToasterService } from '@public-ui/components';
4
+ import { KolInputText } from '@public-ui/react';
5
+
6
+ export const InputTextSmartButton = () => {
7
+ const toaster = ToasterService.getInstance(document);
8
+
9
+ const smartButton = {
10
+ _icons: 'codicon codicon-info',
11
+ _hideLabel: true,
12
+ _label: 'Alert',
13
+ _on: {
14
+ onClick: () => {
15
+ void toaster.enqueue({
16
+ description: 'Smart-Button clicked',
17
+ label: `Toaster`,
18
+ type: 'default',
19
+ });
20
+ },
21
+ },
22
+ };
23
+
24
+ return (
25
+ <>
26
+ <SampleDescription>
27
+ <p>This sample shows the smart button feature for KolInputText. It allows the usage of a button inside the bnput.</p>
28
+ </SampleDescription>
29
+
30
+ <KolInputText _label="With Smart Button" _type="text" _smartButton={smartButton}></KolInputText>
31
+ </>
32
+ );
33
+ };
@@ -3,6 +3,8 @@ import { Formik, Field, type FieldProps } from 'formik';
3
3
  import { KolForm, KolHeading, KolInputText } from '@public-ui/react';
4
4
  import { SampleDescription } from '../SampleDescription';
5
5
 
6
+ import { NumericFormat, type NumberFormatValues } from 'react-number-format';
7
+
6
8
  const NON_ALPHANUM = /[^a-zA-Z0-9]/g;
7
9
  const EVERY_FOUR_CHARS = /(.{4})(?!$)/g;
8
10
 
@@ -23,17 +25,26 @@ class IbanFormatter {
23
25
  }
24
26
  }
25
27
 
26
- type FormValues = {
28
+ type IbanExampleFormValues = {
27
29
  iban: string;
28
30
  };
29
31
 
32
+ type CurrencyExampleFormValues = {
33
+ currency: number;
34
+ };
35
+
30
36
  export function InputTextFormatterDemo() {
31
37
  const handleSubmit = async () => {};
32
38
  const formatter = new IbanFormatter();
33
- const initialValues: FormValues = {
39
+
40
+ const initialIbanExampleValues: IbanExampleFormValues = {
34
41
  iban: 'DE89370400440532013000',
35
42
  };
36
43
 
44
+ const initialCurrencyExampleValues: CurrencyExampleFormValues = {
45
+ currency: 1000000,
46
+ };
47
+
37
48
  return (
38
49
  <>
39
50
  <SampleDescription>
@@ -42,50 +53,92 @@ export function InputTextFormatterDemo() {
42
53
  vice versa the formatting is removed again (machine format)
43
54
  </p>
44
55
  </SampleDescription>
45
- <Formik<FormValues> initialValues={initialValues} onSubmit={handleSubmit}>
46
- {(form) => (
47
- <>
48
- <div className="p-2">
49
- <KolHeading _label="Formatted Form Field" _level={2} />
50
- <KolForm>
51
- <Field name="iban">
52
- {({ field }: FieldProps<FormValues['iban']>) => (
53
- <div className="block mt-2">
54
- <KolInputText
55
- onBlur={() => {
56
- void form.setFieldTouched('iban', true);
57
- }}
58
- id="field-iban"
59
- _label="IBAN"
60
- _value={formatter.format(field.value ?? '')}
61
- _msg={{
62
- _type: 'error',
63
- _description: form.errors.iban || '',
64
- }}
65
- _touched={form.touched.iban}
66
- _required
67
- _on={{
68
- onInput: (event, value: unknown) => {
69
- if (event.target) {
70
- const parsed_value = formatter.parse((value as string) ?? '');
56
+ <section className="w-full flex flex-col">
57
+ <Formik<IbanExampleFormValues> initialValues={initialIbanExampleValues} onSubmit={handleSubmit}>
58
+ {(form) => (
59
+ <>
60
+ <div className="p-2">
61
+ <KolHeading _label="Formatted Form Field" _level={2} />
62
+ <KolForm>
63
+ <Field name="iban">
64
+ {({ field }: FieldProps<IbanExampleFormValues['iban']>) => (
65
+ <div className="block mt-2">
66
+ <KolInputText
67
+ onBlur={() => {
68
+ void form.setFieldTouched('iban', true);
69
+ }}
70
+ id="field-iban"
71
+ _label="IBAN"
72
+ _value={formatter.format(field.value ?? '')}
73
+ _msg={{
74
+ _type: 'error',
75
+ _description: form.errors.iban || '',
76
+ }}
77
+ _touched={form.touched.iban}
78
+ _required
79
+ _on={{
80
+ onInput: (event, value: unknown) => {
81
+ if (event.target) {
82
+ const parsed_value = formatter.parse((value as string) ?? '');
83
+
84
+ void form.setFieldValue('iban', parsed_value, true);
85
+ }
86
+ },
87
+ }}
88
+ />
89
+ </div>
90
+ )}
91
+ </Field>
92
+ </KolForm>
93
+ </div>
94
+ <div className="p-2">
95
+ <KolHeading _label="Model" _level={2} />
96
+ <pre className="text-base">{JSON.stringify(form.values, null, 2)}</pre>
97
+ </div>
98
+ </>
99
+ )}
100
+ </Formik>
101
+ </section>
71
102
 
72
- void form.setFieldValue('iban', parsed_value, true);
73
- }
74
- },
75
- }}
76
- />
77
- </div>
78
- )}
79
- </Field>
80
- </KolForm>
81
- </div>
82
- <div className="p-2">
83
- <KolHeading _label="Model" _level={2} />
84
- <pre>{JSON.stringify(form.values, null, 2)}</pre>
85
- </div>
86
- </>
87
- )}
88
- </Formik>
103
+ <section className="w-full flex flex-col">
104
+ <Formik<CurrencyExampleFormValues> initialValues={initialCurrencyExampleValues} onSubmit={handleSubmit}>
105
+ {(form) => (
106
+ <>
107
+ <div className="p-2">
108
+ <KolHeading _label="Formatted Form Field (with react-number-format)" _level={2} />
109
+ <KolForm>
110
+ <Field name="currency">
111
+ {({ field }: FieldProps<CurrencyExampleFormValues['currency']>) => (
112
+ <div className="block mt-2">
113
+ <NumericFormat
114
+ customInput={({ type, value, onBlur, onChange, onFocus, ...other }: any) => {
115
+ console.log('OTHER: ', other);
116
+ return <KolInputText _label="Currency" _type={type} _value={value} _on={{ onBlur, onChange, onFocus }} />;
117
+ }}
118
+ displayType="input"
119
+ value={typeof field.value === 'number' ? Number(field.value).toFixed(2) : undefined}
120
+ onBlur={() => {
121
+ void form.setFieldTouched('currency', true);
122
+ }}
123
+ onValueChange={(value: NumberFormatValues) => {
124
+ void form.setFieldValue('currency', value.floatValue, true);
125
+ }}
126
+ suffix={'€'}
127
+ thousandSeparator={true}
128
+ />
129
+ </div>
130
+ )}
131
+ </Field>
132
+ </KolForm>
133
+ </div>
134
+ <div className="p-2">
135
+ <KolHeading _label="Model" _level={2} />
136
+ <pre className="text-base">{JSON.stringify(form.values, null, 2)}</pre>
137
+ </div>
138
+ </>
139
+ )}
140
+ </Formik>
141
+ </section>
89
142
  </>
90
143
  );
91
144
  }
@@ -12,7 +12,6 @@ export const LinkImage: FC = () => (
12
12
 
13
13
  <div className="grid gap-4">
14
14
  <KolLink _href="#/back-page" _label="I am a link that is rendered as text" />
15
- <br />
16
15
  <KolLink _href="#/back-page" _label="">
17
16
  <img alt="Presentation of the KoliBri theming" slot="expert" src="abgrenzung.jpg" width="300" />
18
17
  </KolLink>
@@ -13,7 +13,7 @@ export const LinkTarget: FC = () => (
13
13
  </p>
14
14
  </SampleDescription>
15
15
 
16
- <div className="d-flex gap-4">
16
+ <div className="text-base d-flex gap-4">
17
17
  <ul>
18
18
  <li>
19
19
  <KolLink _href="#/back-page" _label="Link without target" />
@@ -17,7 +17,7 @@ export const ModalBasic: FC = () => {
17
17
  </p>
18
18
  </SampleDescription>
19
19
 
20
- <div>
20
+ <div className="flex">
21
21
  <KolModal _label="Primary modal" _width="80%" ref={modalElement} _on={{ onClose: () => console.log('Modal closed') }}>
22
22
  <KolCard _label="I am a modal.">
23
23
  <KolButton
@@ -1,8 +1,8 @@
1
1
  import React, { useState } from 'react';
2
2
 
3
- import { KolInputCheckbox, KolNav } from '@public-ui/react';
3
+ import { KolHeading, KolInputCheckbox, KolNav } from '@public-ui/react';
4
4
  import { SampleDescription } from '../SampleDescription';
5
- import { LINKS } from './links';
5
+ import { LINKS, LINKS_WITHOUT_SUBMENU } from './links';
6
6
 
7
7
  import type { FC } from 'react';
8
8
  export const NavBasic: FC = () => {
@@ -17,16 +17,27 @@ export const NavBasic: FC = () => {
17
17
  </p>
18
18
  </SampleDescription>
19
19
 
20
- <KolInputCheckbox
21
- _label="Show icons when expanded"
22
- _checked={hasIconsWhenExpanded}
23
- _on={{
24
- onChange: (_event, value: unknown) => {
25
- setHasIconsWhenExpanded(value as boolean);
26
- },
27
- }}
28
- ></KolInputCheckbox>
29
- <KolNav class="block w-fit" _label="Main navigation" _links={LINKS} _hasCompactButton _hasIconsWhenExpanded={hasIconsWhenExpanded} />
20
+ <section className="grid gap-8">
21
+ <section>
22
+ <KolInputCheckbox
23
+ _label="Show icons when expanded"
24
+ _checked={hasIconsWhenExpanded}
25
+ _on={{
26
+ onChange: (_event, value: unknown) => {
27
+ setHasIconsWhenExpanded(value as boolean);
28
+ },
29
+ }}
30
+ ></KolInputCheckbox>
31
+ </section>
32
+ <section className="grid gap-4">
33
+ <KolHeading _level={2} _label="Navigation without submenu" />
34
+ <KolNav class="block w-fit" _label="Main navigation" _links={LINKS_WITHOUT_SUBMENU} _hasCompactButton _hasIconsWhenExpanded={hasIconsWhenExpanded} />
35
+ </section>
36
+ <section className="grid gap-4">
37
+ <KolHeading _level={2} _label="Navigation with submenu" />
38
+ <KolNav class="block w-fit" _label="Main navigation" _links={LINKS} _hasCompactButton _hasIconsWhenExpanded={hasIconsWhenExpanded} />
39
+ </section>
40
+ </section>
30
41
  </>
31
42
  );
32
43
  };
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
- import { KolNav } from '@public-ui/react';
2
+ import { KolHeading, KolNav } from '@public-ui/react';
3
3
  import { SampleDescription } from '../SampleDescription';
4
- import { LINKS } from './links';
4
+ import { LINKS, LINKS_WITHOUT_SUBMENU } from './links';
5
5
 
6
6
  import type { FC } from 'react';
7
7
  export const NavHorizontal: FC = () => (
@@ -10,6 +10,15 @@ export const NavHorizontal: FC = () => (
10
10
  <p>This sample shows KolNav with horizontal alignment.</p>
11
11
  </SampleDescription>
12
12
 
13
- <KolNav _label="Main navigation" _links={LINKS} _orientation="horizontal" />
13
+ <section className="grid gap-8">
14
+ <section className="grid gap-4">
15
+ <KolHeading _level={2} _label="Navigation without submenu" />
16
+ <KolNav _label="Main navigation" _links={LINKS_WITHOUT_SUBMENU} _orientation="horizontal" />
17
+ </section>
18
+ <section className="grid gap-4">
19
+ <KolHeading _level={2} _label="Navigation with submenu" />
20
+ <KolNav _label="Main navigation" _links={LINKS} _orientation="horizontal" />
21
+ </section>
22
+ </section>
14
23
  </>
15
24
  );
@@ -92,3 +92,39 @@ export const LINKS: ButtonOrLinkOrTextWithChildrenProps[] = [
92
92
  ],
93
93
  },
94
94
  ];
95
+
96
+ export const LINKS_WITHOUT_SUBMENU: ButtonOrLinkOrTextWithChildrenProps[] = [
97
+ {
98
+ _label: 'Homepage',
99
+ _icons: 'codicon codicon-home',
100
+ _on: {
101
+ onClick: () => console.log('Homepage clicked'),
102
+ },
103
+ },
104
+ {
105
+ _label: '2 Navigation point',
106
+ _href: '#/back-page',
107
+ _on: {
108
+ onClick: () => console.log('Link clicked'),
109
+ },
110
+ },
111
+ {
112
+ _label: '3 Navigation point',
113
+ _href: '#/back-page',
114
+ _icons: 'codicon codicon-home',
115
+ },
116
+ {
117
+ _label: '4 Navigation point with children and onClick',
118
+ _on: {
119
+ onClick: () => console.log('4.1 Nested link clicked'),
120
+ },
121
+ },
122
+ {
123
+ _label: '5 No own page, only category',
124
+ _active: true,
125
+ },
126
+ {
127
+ _label: '6 No own page, with icon',
128
+ _icons: 'codicon codicon-squirrel',
129
+ },
130
+ ];
@@ -14,74 +14,76 @@ export const TableColumnAlignment: FC = () => (
14
14
  <p>This sample shows KolTable with columns headers and data in different text alignments.</p>
15
15
  </SampleDescription>
16
16
 
17
- <KolHeading _label="Simple table" _level={3}></KolHeading>
18
- <KolTable
19
- _label="Table for demonstration purposes with different text align properties"
20
- _headers={{
21
- horizontal: [
22
- [
23
- { label: 'left', key: 'left', textAlign: 'left' },
24
- { label: 'center', key: 'center', textAlign: 'center' },
25
- { label: 'right', key: 'right', textAlign: 'right' },
17
+ <section className="w-full flex flex-col">
18
+ <KolHeading _label="Simple table" _level={3}></KolHeading>
19
+ <KolTable
20
+ _label="Table for demonstration purposes with different text align properties"
21
+ _headers={{
22
+ horizontal: [
23
+ [
24
+ { label: 'left', key: 'left', textAlign: 'left' },
25
+ { label: 'center', key: 'center', textAlign: 'center' },
26
+ { label: 'right', key: 'right', textAlign: 'right' },
27
+ ],
26
28
  ],
27
- ],
28
- }}
29
- _data={DATA}
30
- className="block"
31
- style={{ maxWidth: '600px' }}
32
- />
29
+ }}
30
+ _data={DATA}
31
+ className="block"
32
+ style={{ maxWidth: '600px' }}
33
+ />
33
34
 
34
- <KolHeading _label="Table with sortable columns" _level={3} className="block mt-6"></KolHeading>
35
- <KolTable
36
- _label="Table for demonstration purposes with sortable columns"
37
- _headers={{
38
- horizontal: [
39
- [
40
- { label: 'left', key: 'left', textAlign: 'left', sort: genericNonSorter },
41
- { label: 'center', key: 'center', textAlign: 'center', sort: genericNonSorter },
42
- { label: 'right', key: 'right', textAlign: 'right', sort: genericNonSorter },
35
+ <KolHeading _label="Table with sortable columns" _level={3} className="block mt-6"></KolHeading>
36
+ <KolTable
37
+ _label="Table for demonstration purposes with sortable columns"
38
+ _headers={{
39
+ horizontal: [
40
+ [
41
+ { label: 'left', key: 'left', textAlign: 'left', sort: genericNonSorter },
42
+ { label: 'center', key: 'center', textAlign: 'center', sort: genericNonSorter },
43
+ { label: 'right', key: 'right', textAlign: 'right', sort: genericNonSorter },
44
+ ],
43
45
  ],
44
- ],
45
- }}
46
- _data={DATA}
47
- className="block"
48
- style={{ maxWidth: '600px' }}
49
- />
46
+ }}
47
+ _data={DATA}
48
+ className="block"
49
+ style={{ maxWidth: '600px' }}
50
+ />
50
51
 
51
- <KolHeading _label="Table some sortable columns" _level={3} className="block mt-6"></KolHeading>
52
- <KolTable
53
- _label="Table for demonstration purposes with some but not all columns sortable"
54
- _headers={{
55
- horizontal: [
56
- [
57
- { label: 'left', key: 'left', textAlign: 'left', sort: genericNonSorter },
58
- { label: 'center', key: 'center', textAlign: 'center', sort: genericNonSorter },
59
- { label: 'right', key: 'right', textAlign: 'right' },
52
+ <KolHeading _label="Table some sortable columns" _level={3} className="block mt-6"></KolHeading>
53
+ <KolTable
54
+ _label="Table for demonstration purposes with some but not all columns sortable"
55
+ _headers={{
56
+ horizontal: [
57
+ [
58
+ { label: 'left', key: 'left', textAlign: 'left', sort: genericNonSorter },
59
+ { label: 'center', key: 'center', textAlign: 'center', sort: genericNonSorter },
60
+ { label: 'right', key: 'right', textAlign: 'right' },
61
+ ],
60
62
  ],
61
- ],
62
- }}
63
- _data={DATA}
64
- className="block"
65
- style={{ maxWidth: '600px' }}
66
- />
63
+ }}
64
+ _data={DATA}
65
+ className="block"
66
+ style={{ maxWidth: '600px' }}
67
+ />
67
68
 
68
- <KolHeading _label="Table with vertical heading" _level={3} className="block mt-6"></KolHeading>
69
- <KolTable
70
- _label="Table for demonstration purposes with vertical heading"
71
- _headers={{
72
- horizontal: [
73
- [
74
- { label: '', asTd: true },
75
- { label: 'left', key: 'left', textAlign: 'left' },
76
- { label: 'center', key: 'center', textAlign: 'center' },
77
- { label: 'right', key: 'right', textAlign: 'right' },
69
+ <KolHeading _label="Table with vertical heading" _level={3} className="block mt-6"></KolHeading>
70
+ <KolTable
71
+ _label="Table for demonstration purposes with vertical heading"
72
+ _headers={{
73
+ horizontal: [
74
+ [
75
+ { label: '', asTd: true },
76
+ { label: 'left', key: 'left', textAlign: 'left' },
77
+ { label: 'center', key: 'center', textAlign: 'center' },
78
+ { label: 'right', key: 'right', textAlign: 'right' },
79
+ ],
78
80
  ],
79
- ],
80
- vertical: [[{ label: 'Vertical' }]],
81
- }}
82
- _data={DATA}
83
- className="block"
84
- style={{ maxWidth: '600px' }}
85
- />
81
+ vertical: [[{ label: 'Vertical' }]],
82
+ }}
83
+ _data={DATA}
84
+ className="block"
85
+ style={{ maxWidth: '600px' }}
86
+ />
87
+ </section>
86
88
  </>
87
89
  );