loon-bulma-react 2021.1.32 → 2022.0.0
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/README.md +218 -185
- package/dist/components/Button/Button.d.ts +4 -4
- package/dist/components/Button/ButtonBase.d.ts +6 -5
- package/dist/components/Button/ButtonProps.d.ts +5 -3
- package/dist/components/Button/InvertedButton.d.ts +1 -1
- package/dist/components/Button/LightButton.d.ts +1 -1
- package/dist/components/Button/LightOutlinedButton.d.ts +1 -1
- package/dist/components/Button/OutlinedButton.d.ts +1 -1
- package/dist/components/ButtonGroup/ButtonGroup.d.ts +12 -4
- package/dist/components/DataTable/DataTable.d.ts +1 -1
- package/dist/components/DataTable/DataTableProps.d.ts +2 -1
- package/dist/components/Form/BaseInputProps.d.ts +48 -0
- package/dist/components/Form/Checkbox.d.ts +2 -21
- package/dist/components/Form/ColorInput.d.ts +3 -17
- package/dist/components/Form/DateInput.d.ts +3 -17
- package/dist/components/Form/DateTimeInput.d.ts +3 -17
- package/dist/components/Form/EmailInput.d.ts +4 -18
- package/dist/components/Form/Form.d.ts +1 -1
- package/dist/components/Form/FormProps.d.ts +10 -10
- package/dist/components/Form/HiddenInput.d.ts +2 -0
- package/dist/components/Form/MultiRangeInput.d.ts +2 -16
- package/dist/components/Form/MultiSelect.d.ts +4 -19
- package/dist/components/Form/NumberInput.d.ts +3 -17
- package/dist/components/Form/PasswordInput.d.ts +4 -18
- package/dist/components/Form/RangeInput.d.ts +2 -16
- package/dist/components/Form/Select.d.ts +4 -18
- package/dist/components/Form/TextArea.d.ts +4 -19
- package/dist/components/Form/TextInput.d.ts +6 -20
- package/dist/components/Form/TimeInput.d.ts +3 -17
- package/dist/components/Icon/Icon.d.ts +6 -6
- package/dist/components/Layout/AspectRatio/AspectRatio.d.ts +3 -3
- package/dist/components/Layout/Box/Box.d.ts +1 -1
- package/dist/components/Layout/Columns/Column.d.ts +1 -1
- package/dist/components/Layout/Columns/ColumnProps.d.ts +2 -2
- package/dist/components/Layout/Columns/Columns.d.ts +2 -2
- package/dist/components/Layout/Columns/Fifths.d.ts +1 -1
- package/dist/components/Layout/Columns/Numbered.d.ts +1 -1
- package/dist/components/Layout/Columns/Quarters.d.ts +1 -1
- package/dist/components/Layout/Columns/Thirds.d.ts +1 -1
- package/dist/components/Layout/Container/Container.d.ts +1 -1
- package/dist/components/Layout/Content/Content.d.ts +2 -2
- package/dist/components/Layout/Footer/Footer.d.ts +2 -2
- package/dist/components/Layout/Hero/Hero.d.ts +1 -1
- package/dist/components/Layout/Hero/HeroProps.d.ts +2 -2
- package/dist/components/Layout/Image/Image.d.ts +2 -2
- package/dist/components/Layout/ScrollArea/ScrollArea.d.ts +4 -4
- package/dist/components/Layout/Section/Section.d.ts +1 -1
- package/dist/components/Link/Link.d.ts +3 -3
- package/dist/components/Menu/Menu.d.ts +33 -0
- package/dist/components/Menu/MenuContent.d.ts +4 -0
- package/dist/components/Message/Message.d.ts +12 -4
- package/dist/components/Message/MessageProps.d.ts +2 -2
- package/dist/components/Modal/Modal.d.ts +1 -1
- package/dist/components/Notification/Notification.d.ts +10 -1
- package/dist/components/Notification/NotificationProps.d.ts +1 -1
- package/dist/components/ProgressBar/ProgressBar.d.ts +2 -2
- package/dist/components/Table/Table.d.ts +1 -1
- package/dist/components/Tabs/Tabs.d.ts +14 -13
- package/dist/components/Tag/Tag.d.ts +44 -0
- package/dist/components/Titles/Titles.d.ts +2 -2
- package/dist/contexts/Notifier/Notifier.d.ts +1 -1
- package/dist/contexts/Notifier/NotifierProps.d.ts +6 -4
- package/dist/contexts/Notifier/NotifierProvider.d.ts +1 -1
- package/dist/index.d.ts +62 -57
- package/dist/index.js +945 -704
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +943 -704
- package/dist/index.modern.js.map +1 -1
- package/dist/loon-react-bulma-types.d.ts +6 -2
- package/package.json +18 -17
- package/styles/bulma-button-generator.scss +12 -0
- package/styles/custom-bulma.scss +22 -1
- package/styles/variables.scss +1 -1
- package/dist/lbr-types.d.ts +0 -2
package/README.md
CHANGED
|
@@ -23,11 +23,13 @@
|
|
|
23
23
|
- [Footer](#component-footer)
|
|
24
24
|
- [Icons (FontAwesome)](#component-icons)
|
|
25
25
|
- [Link & LinkButon](#component-linkbutton)
|
|
26
|
+
- [Menu](#component-menu)
|
|
26
27
|
- [Messages & Notificaties](#component-messages)
|
|
27
28
|
- [Modal](#component-modal)
|
|
28
29
|
- [ProgressBars](#component-progressbar)
|
|
29
30
|
- [Table](#component-table)
|
|
30
31
|
- [Tabs](#component-tabs)
|
|
32
|
+
- [Tag](#component-tags)
|
|
31
33
|
- [Titles & Subtitles](#component-titles)
|
|
32
34
|
- [Form & Inputs](#form)
|
|
33
35
|
- [Input Types](#form-input)
|
|
@@ -98,13 +100,13 @@ Dan wordt altijd de laatste versie van die tag geïnstalleerd, in plaats van de
|
|
|
98
100
|
in `index.tsx`
|
|
99
101
|
|
|
100
102
|
```tsx
|
|
101
|
-
import
|
|
103
|
+
import 'loon-bulma-react/styles/_all.scss';
|
|
102
104
|
```
|
|
103
105
|
|
|
104
106
|
in een eigen component, bijvoorbeeld de Columns:
|
|
105
107
|
|
|
106
108
|
```tsx
|
|
107
|
-
import { Columns, Column } from
|
|
109
|
+
import { Columns, Column } from 'loon-bulma-react';
|
|
108
110
|
|
|
109
111
|
function MyComponent(props) {
|
|
110
112
|
return (
|
|
@@ -142,14 +144,14 @@ import { NotifierProvider } from 'loon-react-bulma';
|
|
|
142
144
|
|
|
143
145
|
```tsx
|
|
144
146
|
// MyComponent.tsx
|
|
145
|
-
import { useNotifier } from
|
|
147
|
+
import { useNotifier } from 'loon-react-bulma';
|
|
146
148
|
// ...
|
|
147
149
|
const { notify } = useNotifier();
|
|
148
150
|
const addNotification = () => {
|
|
149
151
|
notify({
|
|
150
|
-
type:
|
|
151
|
-
content:
|
|
152
|
-
onClick: () => console.log(
|
|
152
|
+
type: 'i',
|
|
153
|
+
content: 'Dit is een notification',
|
|
154
|
+
onClick: () => console.log('notification clicked!'),
|
|
153
155
|
dismissAfter: 2500, // dismiss na 2500 ms
|
|
154
156
|
});
|
|
155
157
|
};
|
|
@@ -178,7 +180,7 @@ De `useNotifier()`-hook is een custom hook voor het gebruik van de notifier. Dez
|
|
|
178
180
|
Alleen de functions importeren die je nodig hebt is genoeg
|
|
179
181
|
|
|
180
182
|
```ts
|
|
181
|
-
import { useNotifier } from
|
|
183
|
+
import { useNotifier } from 'loon-react-bulma';
|
|
182
184
|
const { notify, remove, clear } = useNotifier();
|
|
183
185
|
```
|
|
184
186
|
|
|
@@ -317,19 +319,19 @@ Een hero bevat een optionele array van top-items:
|
|
|
317
319
|
```ts
|
|
318
320
|
const headItems = [
|
|
319
321
|
{
|
|
320
|
-
txt:
|
|
321
|
-
action: (e: any) => console.log(
|
|
322
|
-
tooltip:
|
|
322
|
+
txt: 'Bulma',
|
|
323
|
+
action: (e: any) => console.log('Bulma', e),
|
|
324
|
+
tooltip: 'Bulma website',
|
|
323
325
|
},
|
|
324
326
|
{
|
|
325
|
-
txt:
|
|
326
|
-
action: (e: any) => console.log(
|
|
327
|
-
tooltip:
|
|
327
|
+
txt: 'React',
|
|
328
|
+
action: (e: any) => console.log('React', e),
|
|
329
|
+
tooltip: 'React website',
|
|
328
330
|
},
|
|
329
331
|
{
|
|
330
|
-
txt:
|
|
331
|
-
action: (e: any) => console.log(
|
|
332
|
-
tooltip:
|
|
332
|
+
txt: 'NodeJS',
|
|
333
|
+
action: (e: any) => console.log('NodeJS', e),
|
|
334
|
+
tooltip: 'NodeJS website',
|
|
333
335
|
},
|
|
334
336
|
];
|
|
335
337
|
```
|
|
@@ -357,12 +359,7 @@ De hero wordt dan zo gebruikt:
|
|
|
357
359
|
|
|
358
360
|
```tsx
|
|
359
361
|
<div>
|
|
360
|
-
<Hero
|
|
361
|
-
title="Hero title"
|
|
362
|
-
subtitle="Hero subtitle"
|
|
363
|
-
headItems={headitems}
|
|
364
|
-
navItems={navItems}
|
|
365
|
-
/>
|
|
362
|
+
<Hero title="Hero title" subtitle="Hero subtitle" headItems={headitems} navItems={navItems} />
|
|
366
363
|
</div>
|
|
367
364
|
```
|
|
368
365
|
|
|
@@ -372,28 +369,9 @@ Een afbeelding met een vastgestelde aspect-ratio. Een ratio 'square' kan een gro
|
|
|
372
369
|
|
|
373
370
|
```tsx
|
|
374
371
|
<div>
|
|
375
|
-
<Image
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
alt="x"
|
|
379
|
-
ratio="square"
|
|
380
|
-
size="16"
|
|
381
|
-
/>
|
|
382
|
-
<Image
|
|
383
|
-
figCaption="16x16"
|
|
384
|
-
isRounded={true}
|
|
385
|
-
src=".../16x16.png"
|
|
386
|
-
alt="x"
|
|
387
|
-
ratio="square"
|
|
388
|
-
size="16"
|
|
389
|
-
/>
|
|
390
|
-
<Image
|
|
391
|
-
ratio="5by4"
|
|
392
|
-
size="250px"
|
|
393
|
-
src=".../600x480.png"
|
|
394
|
-
alt="x"
|
|
395
|
-
figCaption="x"
|
|
396
|
-
/>
|
|
372
|
+
<Image figCaption="16x16" src=".../16x16.png" alt="x" ratio="square" size="16" />
|
|
373
|
+
<Image figCaption="16x16" isRounded={true} src=".../16x16.png" alt="x" ratio="square" size="16" />
|
|
374
|
+
<Image ratio="5by4" size="250px" src=".../600x480.png" alt="x" figCaption="x" />
|
|
397
375
|
</div>
|
|
398
376
|
```
|
|
399
377
|
|
|
@@ -419,25 +397,13 @@ Een ScrollArea is een horizontaal of verticaal scrollbare `<div>` met flexbox-ei
|
|
|
419
397
|
#### Horizontaal:
|
|
420
398
|
|
|
421
399
|
```tsx
|
|
422
|
-
<ScrollArea.Horizontal gap={{ row:
|
|
423
|
-
<div>
|
|
424
|
-
|
|
425
|
-
</div>
|
|
426
|
-
<div>
|
|
427
|
-
|
|
428
|
-
</div>
|
|
429
|
-
<div>
|
|
430
|
-
Deze items worden naast elkaar getoont, en je kan naar link/rechts scrollen
|
|
431
|
-
</div>
|
|
432
|
-
<div>
|
|
433
|
-
Deze items worden naast elkaar getoont, en je kan naar link/rechts scrollen
|
|
434
|
-
</div>
|
|
435
|
-
<div>
|
|
436
|
-
Deze items worden naast elkaar getoont, en je kan naar link/rechts scrollen
|
|
437
|
-
</div>
|
|
438
|
-
<div>
|
|
439
|
-
Deze items worden naast elkaar getoont, en je kan naar link/rechts scrollen
|
|
440
|
-
</div>
|
|
400
|
+
<ScrollArea.Horizontal gap={{ row: '1em', col: 16 }} wrap={true} alignment="c">
|
|
401
|
+
<div>Deze items worden naast elkaar getoont, en je kan naar link/rechts scrollen</div>
|
|
402
|
+
<div>Deze items worden naast elkaar getoont, en je kan naar link/rechts scrollen</div>
|
|
403
|
+
<div>Deze items worden naast elkaar getoont, en je kan naar link/rechts scrollen</div>
|
|
404
|
+
<div>Deze items worden naast elkaar getoont, en je kan naar link/rechts scrollen</div>
|
|
405
|
+
<div>Deze items worden naast elkaar getoont, en je kan naar link/rechts scrollen</div>
|
|
406
|
+
<div>Deze items worden naast elkaar getoont, en je kan naar link/rechts scrollen</div>
|
|
441
407
|
</ScrollArea.Horizontal>
|
|
442
408
|
```
|
|
443
409
|
|
|
@@ -445,39 +411,20 @@ Een ScrollArea is een horizontaal of verticaal scrollbare `<div>` met flexbox-ei
|
|
|
445
411
|
|
|
446
412
|
```tsx
|
|
447
413
|
<ScrollArea.Vertical maxHeight={600}>
|
|
448
|
-
<div>
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
</div>
|
|
452
|
-
<div>
|
|
453
|
-
|
|
454
|
-
dan kan je scrollen
|
|
455
|
-
</div>
|
|
456
|
-
<div>
|
|
457
|
-
Deze items worden onder elkaar weergegeven, en als dat hoger is dan "600px"
|
|
458
|
-
dan kan je scrollen
|
|
459
|
-
</div>
|
|
460
|
-
<div>
|
|
461
|
-
Deze items worden onder elkaar weergegeven, en als dat hoger is dan "600px"
|
|
462
|
-
dan kan je scrollen
|
|
463
|
-
</div>
|
|
464
|
-
<div>
|
|
465
|
-
Deze items worden onder elkaar weergegeven, en als dat hoger is dan "600px"
|
|
466
|
-
dan kan je scrollen
|
|
467
|
-
</div>
|
|
468
|
-
<div>
|
|
469
|
-
Deze items worden onder elkaar weergegeven, en als dat hoger is dan "600px"
|
|
470
|
-
dan kan je scrollen
|
|
471
|
-
</div>
|
|
414
|
+
<div>Deze items worden onder elkaar weergegeven, en als dat hoger is dan "600px" dan kan je scrollen</div>
|
|
415
|
+
<div>Deze items worden onder elkaar weergegeven, en als dat hoger is dan "600px" dan kan je scrollen</div>
|
|
416
|
+
<div>Deze items worden onder elkaar weergegeven, en als dat hoger is dan "600px" dan kan je scrollen</div>
|
|
417
|
+
<div>Deze items worden onder elkaar weergegeven, en als dat hoger is dan "600px" dan kan je scrollen</div>
|
|
418
|
+
<div>Deze items worden onder elkaar weergegeven, en als dat hoger is dan "600px" dan kan je scrollen</div>
|
|
419
|
+
<div>Deze items worden onder elkaar weergegeven, en als dat hoger is dan "600px" dan kan je scrollen</div>
|
|
472
420
|
</ScrollArea.Vertical>
|
|
473
421
|
```
|
|
474
422
|
|
|
475
|
-
|
|
476
423
|
### Button & ButtonGroup <a id="component-button"></a>
|
|
477
424
|
|
|
478
|
-
Gebruikt de [Bulma-button](https://bulma.io/documentation/elements/button/) Er zijn meerdere soorten button-types. Van elke soort zijn er
|
|
425
|
+
Gebruikt de [Bulma-button](https://bulma.io/documentation/elements/button/) Er zijn meerdere soorten button-types. Van elke soort zijn er 6 beschikbaar: _Primary_, _Danger_, _Warning_, _Success_, _Link_, _Info_
|
|
479
426
|
|
|
480
|
-
- **Bttn**: een default button (
|
|
427
|
+
- **Bttn**: een default button (met instelbare `color`-props)
|
|
481
428
|
- **Button**: default bulma button style
|
|
482
429
|
- **LightButton**: light bulma button style
|
|
483
430
|
- **LightOutlinedButton** light & outlined combi button style.
|
|
@@ -494,21 +441,18 @@ Door geen tekst toe te voegen aan de children-prop in de Button, kan een button
|
|
|
494
441
|
De `ButtonGroup`-component kan gebruikt worden om buttons te grouperen en de grootte voor buttons in te stellen.
|
|
495
442
|
|
|
496
443
|
```tsx
|
|
497
|
-
import {
|
|
498
|
-
ButtonGroup,
|
|
499
|
-
Button,
|
|
500
|
-
Bttn,
|
|
501
|
-
LightButton,
|
|
502
|
-
InvertedButton,
|
|
503
|
-
OutlinedButton,
|
|
504
|
-
} from "loon-bulma-react";
|
|
444
|
+
import { ButtonGroup, Bttn, Button, LightButton, InvertedButton, OutlinedButton } from 'loon-bulma-react';
|
|
505
445
|
|
|
506
446
|
<ButtonGroup>
|
|
507
447
|
<Bttn>click me</Bttn>
|
|
448
|
+
<Bttn color="p">click me</Bttn>
|
|
449
|
+
<Bttn color="s">click me</Bttn>
|
|
450
|
+
|
|
508
451
|
<Button.Primary>click me</Button.Primary>
|
|
452
|
+
<Button.Warning>click me</Button.Warning>
|
|
509
453
|
<LightButton.Success>click me</LightButton.Success>
|
|
510
454
|
<LightOutlinedButton.Link>click me</LightOutlinedButton.Link>
|
|
511
|
-
<OutlinedButton.
|
|
455
|
+
<OutlinedButton.Info>click me</OutlinedButton.Info>
|
|
512
456
|
<InvertedButton.Danger>click me</InvertedButton.Danger>
|
|
513
457
|
</ButtonGroup>;
|
|
514
458
|
```
|
|
@@ -534,35 +478,35 @@ Om eigen classes toe te voegen aan rows en aan columns zijn er methodes:
|
|
|
534
478
|
|
|
535
479
|
```tsx
|
|
536
480
|
/** AppDataTable.tsx */
|
|
537
|
-
import { tableData } from
|
|
538
|
-
import { DataTable } from
|
|
539
|
-
import
|
|
481
|
+
import { tableData } from '../MOCK_DATA';
|
|
482
|
+
import { DataTable } from 'loon-bulma-react';
|
|
483
|
+
import './datatable.styles.css';
|
|
540
484
|
|
|
541
485
|
const nameSortFn = (a: any, b: any) => {
|
|
542
|
-
const aNaam = a.first_name +
|
|
543
|
-
const bNaam = b.first_name +
|
|
486
|
+
const aNaam = a.first_name + ' ' + a.last_name;
|
|
487
|
+
const bNaam = b.first_name + ' ' + b.last_name;
|
|
544
488
|
if (aNaam < bNaam) return -1;
|
|
545
489
|
if (aNaam > bNaam) return 1;
|
|
546
490
|
return 0;
|
|
547
491
|
};
|
|
548
492
|
|
|
549
493
|
const dataTableHeaders = [
|
|
550
|
-
{ sort: true, value:
|
|
494
|
+
{ sort: true, value: 'id' },
|
|
551
495
|
{
|
|
552
|
-
header:
|
|
496
|
+
header: 'Naam',
|
|
553
497
|
sort: nameSortFn,
|
|
554
498
|
value: (v: any) => `${v.first_name} ${v.last_name}`,
|
|
555
499
|
},
|
|
556
|
-
{ header:
|
|
557
|
-
{ header:
|
|
500
|
+
{ header: 'Voornaam', sort: true, value: 'first_name' },
|
|
501
|
+
{ header: 'Achternaam', sort: true, value: 'last_name' },
|
|
558
502
|
{
|
|
559
|
-
value:
|
|
560
|
-
columnClasses: (usr) => (usr.email.includes(
|
|
503
|
+
value: 'email',
|
|
504
|
+
columnClasses: (usr) => (usr.email.includes('.com') ? 'is-marked' : ''),
|
|
561
505
|
},
|
|
562
|
-
{ header:
|
|
563
|
-
{ header:
|
|
506
|
+
{ header: 'Geslacht', sort: true, value: 'gender' },
|
|
507
|
+
{ header: 'Taal', sort: true, value: 'language' },
|
|
564
508
|
{
|
|
565
|
-
header:
|
|
509
|
+
header: '',
|
|
566
510
|
sort: false,
|
|
567
511
|
value: () => <InvertedButton.Danger>DEL</InvertedButton.Danger>,
|
|
568
512
|
},
|
|
@@ -575,7 +519,7 @@ export function DataTableTab() {
|
|
|
575
519
|
|
|
576
520
|
const handleRowClick = (item: IPersoon, rowEl: HTMLTableRowElement) => {
|
|
577
521
|
console.log(item, rowEl);
|
|
578
|
-
rowEl.classList.toggle(
|
|
522
|
+
rowEl.classList.toggle('is-selected');
|
|
579
523
|
};
|
|
580
524
|
|
|
581
525
|
return (
|
|
@@ -583,9 +527,7 @@ export function DataTableTab() {
|
|
|
583
527
|
data={data}
|
|
584
528
|
columns={columns}
|
|
585
529
|
onRowSelected={(i, r) => handleRowClick(i, r)}
|
|
586
|
-
rowClasses={(item: IUser) =>
|
|
587
|
-
item.first_name.startsWith("C") ? "is-dangerous" : ""
|
|
588
|
-
}
|
|
530
|
+
rowClasses={(item: IUser) => (item.first_name.startsWith('C') ? 'is-dangerous' : '')}
|
|
589
531
|
searchTxt="Zoek een persoon ..."
|
|
590
532
|
rowIdentifier="id"
|
|
591
533
|
striped={true}
|
|
@@ -652,23 +594,104 @@ Link en LinkButton zijn bedoelt om links (`<a>`) en buttons (`<button>`) er, bij
|
|
|
652
594
|
```tsx
|
|
653
595
|
<div>
|
|
654
596
|
<Footer>
|
|
655
|
-
Dit is een <Link href="http://www.kanikeenkortebroekaan.nl">Link</Link>. En
|
|
656
|
-
|
|
657
|
-
<LinkButton onClick={(e: any) => console.log(e)}>button</LinkButton> die er
|
|
658
|
-
uit ziet als een link.
|
|
597
|
+
Dit is een <Link href="http://www.kanikeenkortebroekaan.nl">Link</Link>. En dit is een{' '}
|
|
598
|
+
<LinkButton onClick={(e: any) => console.log(e)}>button</LinkButton> die er uit ziet als een link.
|
|
659
599
|
</Footer>
|
|
660
600
|
</div>
|
|
661
601
|
```
|
|
662
602
|
|
|
603
|
+
### Menu <a id="component-menu"></a>
|
|
604
|
+
|
|
605
|
+
Een menu is een verticale lijst van 'blokjes' met een optioneel label, en een array van items. Deze items kunnen ook weer een lijst van sub-items bevatten.
|
|
606
|
+
De `<Menu />`-tag heeft een `onMenuItemChanged(id: nuymber|string)` function voor als het geselecteerde menu wijzigt.
|
|
607
|
+
|
|
608
|
+
De menu-items hebben een optioneel id, net als de sub-menu-items. Als er geen ID is opgegeven, maakt het menu zelf id's aan op basis van de globale menu-index. Dit is dan ook het nummer dat doorgegeven wordt met `onMenuItemChanged(id: nuymber|string)`.
|
|
609
|
+
|
|
610
|
+
##### Deze ID's zijn gegenereerd door de component
|
|
611
|
+
|
|
612
|
+
```tsx
|
|
613
|
+
<Menu
|
|
614
|
+
onMenuItemChanged={(id: string | number) => console.log(`menu item ${id} selected`)}
|
|
615
|
+
blocks={[
|
|
616
|
+
{
|
|
617
|
+
label: 'General',
|
|
618
|
+
items: [
|
|
619
|
+
{ itemTxt: 'Dashboard' }, // id 0
|
|
620
|
+
{ itemTxt: 'Customers' }, // id 1
|
|
621
|
+
],
|
|
622
|
+
},
|
|
623
|
+
{
|
|
624
|
+
label: 'Administration',
|
|
625
|
+
items: [
|
|
626
|
+
{ itemTxt: 'Team Settings' }, // id 2
|
|
627
|
+
{
|
|
628
|
+
itemTxt: 'Manage Your Team',
|
|
629
|
+
itemList: [
|
|
630
|
+
// id 3
|
|
631
|
+
{ txt: 'Members' }, // id 4
|
|
632
|
+
{ txt: 'Add a member' }, // id 5
|
|
633
|
+
],
|
|
634
|
+
},
|
|
635
|
+
{ itemTxt: 'Invitations' }, // id 6
|
|
636
|
+
],
|
|
637
|
+
},
|
|
638
|
+
{
|
|
639
|
+
label: 'Transactions',
|
|
640
|
+
items: [
|
|
641
|
+
{ itemTxt: 'Payments' }, // id 7
|
|
642
|
+
{ itemTxt: 'Transfers' }, // id 8
|
|
643
|
+
],
|
|
644
|
+
},
|
|
645
|
+
]}
|
|
646
|
+
/>
|
|
647
|
+
```
|
|
648
|
+
|
|
649
|
+
##### ID's kan je ook zelf opgeven
|
|
650
|
+
|
|
651
|
+
```tsx
|
|
652
|
+
<Menu
|
|
653
|
+
onMenuItemChanged={(id: string | number) => console.log(`menu item ${id} selected`)}
|
|
654
|
+
blocks={[
|
|
655
|
+
{
|
|
656
|
+
label: 'General',
|
|
657
|
+
items: [
|
|
658
|
+
{ itemTxt: 'Dashboard', id: 1 },
|
|
659
|
+
{ itemTxt: 'Customers', id: 2 },
|
|
660
|
+
],
|
|
661
|
+
},
|
|
662
|
+
{
|
|
663
|
+
label: 'Administration',
|
|
664
|
+
items: [
|
|
665
|
+
{ itemTxt: 'Team Settings', id: '3' },
|
|
666
|
+
{
|
|
667
|
+
itemTxt: 'Manage Your Team',
|
|
668
|
+
id: '4',
|
|
669
|
+
itemList: [
|
|
670
|
+
{ txt: 'Members', id: '4a' },
|
|
671
|
+
{ txt: 'Add a member', id: '4b' },
|
|
672
|
+
],
|
|
673
|
+
},
|
|
674
|
+
{ itemTxt: 'Invitations', id: 5 },
|
|
675
|
+
],
|
|
676
|
+
},
|
|
677
|
+
{
|
|
678
|
+
label: 'Transactions',
|
|
679
|
+
items: [
|
|
680
|
+
{ itemTxt: 'Payments', id: 6 },
|
|
681
|
+
{ itemTxt: 'Transfers', id: 7 },
|
|
682
|
+
],
|
|
683
|
+
},
|
|
684
|
+
]}
|
|
685
|
+
/>
|
|
686
|
+
```
|
|
687
|
+
|
|
663
688
|
### Messages & Notifications <a id="component-messages"></a>
|
|
664
689
|
|
|
665
690
|
Een message of een notifcatie bevatten een tekst. Messages hebben ook een optionele titel. Er zjn 4 soorten: _Warning_, _Info_, _Success_, _Danger_.
|
|
666
691
|
|
|
667
692
|
```tsx
|
|
668
693
|
<div>
|
|
669
|
-
<Message.Info title="Message Header">
|
|
670
|
-
Info message met een header
|
|
671
|
-
</Message.Info>
|
|
694
|
+
<Message.Info title="Message Header">Info message met een header</Message.Info>
|
|
672
695
|
<Message.Success>Success message zonder header</Message.Success>
|
|
673
696
|
</div>
|
|
674
697
|
```
|
|
@@ -677,15 +700,11 @@ Een notificatie bevat ook een tekst, maar heeft ook een dimsiss-button. Deze met
|
|
|
677
700
|
|
|
678
701
|
```tsx
|
|
679
702
|
<div>
|
|
680
|
-
<Notification.Info
|
|
681
|
-
onDismiss={(e: any) => console.info("dismissed info notification", e)}
|
|
682
|
-
>
|
|
703
|
+
<Notification.Info onDismiss={(e: any) => console.info('dismissed info notification', e)}>
|
|
683
704
|
Dit is een info-notification
|
|
684
705
|
</Notification.Info>
|
|
685
706
|
|
|
686
|
-
<Notification.Danger
|
|
687
|
-
onDismiss={(e: any) => console.error("dismissed danger notification", e)}
|
|
688
|
-
>
|
|
707
|
+
<Notification.Danger onDismiss={(e: any) => console.error('dismissed danger notification', e)}>
|
|
689
708
|
Dit is een dangerous notification
|
|
690
709
|
</Notification.Danger>
|
|
691
710
|
</div>
|
|
@@ -744,10 +763,10 @@ return (
|
|
|
744
763
|
<Table
|
|
745
764
|
data={data}
|
|
746
765
|
columns={[
|
|
747
|
-
{ name:
|
|
748
|
-
{ name:
|
|
749
|
-
{ name:
|
|
750
|
-
{ key:
|
|
766
|
+
{ name: 'ID', key: 'id' },
|
|
767
|
+
{ name: 'Voornaam', key: 'first_name' },
|
|
768
|
+
{ name: 'Achternaam', key: 'last_name' },
|
|
769
|
+
{ key: 'email' },
|
|
751
770
|
]}
|
|
752
771
|
uniqueKey="id"
|
|
753
772
|
fullWidth={true}
|
|
@@ -770,12 +789,7 @@ export default function App() {
|
|
|
770
789
|
return (
|
|
771
790
|
<>
|
|
772
791
|
<Tabs
|
|
773
|
-
items={[
|
|
774
|
-
"DataTables",
|
|
775
|
-
"Notifications & Messsages",
|
|
776
|
-
"Titles, Forms & Buttons",
|
|
777
|
-
"Images & Aspect Ratios",
|
|
778
|
-
]}
|
|
792
|
+
items={['DataTables', 'Notifications & Messsages', 'Titles, Forms & Buttons', 'Images & Aspect Ratios']}
|
|
779
793
|
activeTab={activePage}
|
|
780
794
|
onTabChange={(i: number) => setActiveTab(i)}
|
|
781
795
|
/>
|
|
@@ -791,6 +805,41 @@ export default function App() {
|
|
|
791
805
|
}
|
|
792
806
|
```
|
|
793
807
|
|
|
808
|
+
### Tag & Tags <a id="component-tags"></a>
|
|
809
|
+
|
|
810
|
+
Een `<Tag>` is een klein inline elementje om overal te kunnen stoppen. Tags kunnen een optionele sluit-knop bevatten
|
|
811
|
+
De `<Tags>` component kan gebruikt worden om meerdere tags te groeperen. Dan kunnen ze samengeplakt worden, de grootte van alle tags of de alignment kan dan ingesteld worden.
|
|
812
|
+
|
|
813
|
+
```tsx
|
|
814
|
+
<Tags alignment="l" size="s">
|
|
815
|
+
<Tag color="p">primary</Tag>
|
|
816
|
+
<Tag color="w">warning</Tag>
|
|
817
|
+
<Tag color="i">info</Tag>
|
|
818
|
+
<Tag color="l">link</Tag>
|
|
819
|
+
<Tag color="d">danger</Tag>
|
|
820
|
+
<Tag color="s">success</Tag>
|
|
821
|
+
<Tag color="light">light</Tag>
|
|
822
|
+
<Tag color="dark">dark</Tag>
|
|
823
|
+
</Tags>
|
|
824
|
+
```
|
|
825
|
+
|
|
826
|
+
Met de `onDismiss`-function van de `<Tag>` kan je een sluit-button op een tag toevoegen. Dan moet er **wel** een function opgegevens zijn om iets mee te doen
|
|
827
|
+
|
|
828
|
+
```tsx
|
|
829
|
+
<Tag color="dark" onDismiss={(e) => handleTagDismiss(e)}>
|
|
830
|
+
FlexBox
|
|
831
|
+
</Tag>
|
|
832
|
+
```
|
|
833
|
+
|
|
834
|
+
Om twee tags als 1 tag te laten zien, kan je de `merged` prop op de `<Tags>`-component gebruiken
|
|
835
|
+
|
|
836
|
+
```tsx
|
|
837
|
+
<Tags merged={true}>
|
|
838
|
+
<Tag color="dark">build</Tag>
|
|
839
|
+
<Tag color="s">success</Tag>
|
|
840
|
+
</Tags>
|
|
841
|
+
```
|
|
842
|
+
|
|
794
843
|
### Titles & Subtitles <a id="component-titles"></a>
|
|
795
844
|
|
|
796
845
|
Een verzameling van h1...h6 tags. Er zijn drie verschillende componenten om [Bulma Titles](https://bulma.io/documentation/elements/title/) te gebruiken.
|
|
@@ -818,10 +867,7 @@ Allemaal hebben ze 2 waarden die isntelbaar zijn voor Sizes: _headingSize_ en _b
|
|
|
818
867
|
headingSize={2}
|
|
819
868
|
bulmaSize={2}
|
|
820
869
|
></TitleWithSubtitle>
|
|
821
|
-
<TitleWithSubtitle
|
|
822
|
-
titleTxt="title is-3 (default)"
|
|
823
|
-
subtitleTxt="subtitle is-6 (default)"
|
|
824
|
-
></TitleWithSubtitle>
|
|
870
|
+
<TitleWithSubtitle titleTxt="title is-3 (default)" subtitleTxt="subtitle is-6 (default)"></TitleWithSubtitle>
|
|
825
871
|
</div>
|
|
826
872
|
```
|
|
827
873
|
|
|
@@ -856,7 +902,7 @@ Er zijn verschillende soorten inputs voor de afhandeling van input-types.
|
|
|
856
902
|
- **TextInput:** invoeren van tekst, urls, etc.
|
|
857
903
|
- **EmailInput:** invoeren van een emailadres. Valideert het emailadres met een regex (overschrijfbaar mbv validatie-object).
|
|
858
904
|
- **PasswordInput:** invoeren van een wachtwoord.
|
|
859
|
-
- **TextAreaInput:** een textarea
|
|
905
|
+
- **TextAreaInput:** een textarea, werkt in tegenstelling tot de `<textarea></textarea>`-tag _niet_ met children. De waarde kan gezet worden met de `value`-attribuut.
|
|
860
906
|
- Getallen:
|
|
861
907
|
- **NumberInput:** invoer van een nummer
|
|
862
908
|
- **Range:** invoer van een nummer, maar dan met een [range](#form-ranges)
|
|
@@ -890,17 +936,14 @@ Er zijn verschillende soorten inputs voor de afhandeling van input-types.
|
|
|
890
936
|
```
|
|
891
937
|
|
|
892
938
|
### CheckBox <a id="form-checkbox"></a>
|
|
939
|
+
|
|
893
940
|
> Was voorheen Checkbox (lowercase B), maar hebben we nu CheckBox van gemaakt
|
|
894
941
|
|
|
895
942
|
Een checkbox werkt zoals je verwacht:
|
|
943
|
+
|
|
896
944
|
```tsx
|
|
897
945
|
<div>
|
|
898
|
-
<CheckBox
|
|
899
|
-
name="CheckboxInput"
|
|
900
|
-
id="checkboxinput"
|
|
901
|
-
label="Dit is een checkbox"
|
|
902
|
-
validatie={{ required: true }}
|
|
903
|
-
/>
|
|
946
|
+
<CheckBox name="CheckboxInput" id="checkboxinput" label="Dit is een checkbox" validatie={{ required: true }} />
|
|
904
947
|
</div>
|
|
905
948
|
```
|
|
906
949
|
|
|
@@ -912,18 +955,8 @@ Als er in het validatie geen minimale of maximale waarde te vinden is, worden st
|
|
|
912
955
|
|
|
913
956
|
```tsx
|
|
914
957
|
<div>
|
|
915
|
-
<RangeInput
|
|
916
|
-
|
|
917
|
-
name="RangeInput"
|
|
918
|
-
id="rangeinput"
|
|
919
|
-
validatie={{ required: true, min: 0, max: 100 }}
|
|
920
|
-
/>
|
|
921
|
-
<MultiRangeInput
|
|
922
|
-
name="MultiRangeInput"
|
|
923
|
-
id="multirangeinput"
|
|
924
|
-
value={[25, 75]}
|
|
925
|
-
validatie={{ minDiff: 10 }}
|
|
926
|
-
/>
|
|
958
|
+
<RangeInput value={20} name="RangeInput" id="rangeinput" validatie={{ required: true, min: 0, max: 100 }} />
|
|
959
|
+
<MultiRangeInput name="MultiRangeInput" id="multirangeinput" value={[25, 75]} validatie={{ minDiff: 10 }} />
|
|
927
960
|
</div>
|
|
928
961
|
```
|
|
929
962
|
|
|
@@ -956,13 +989,13 @@ Een select is een lijstje met opties waaruit je er een kan selecteren. De opties
|
|
|
956
989
|
|
|
957
990
|
{/* Een select met value-label-options in optiongroups. Als geen label, wordt de value gebruikt*/}
|
|
958
991
|
<Select name="SelectInput3" label="Select options met SelectOptionGroupTypes"id="selectinput3" options={[
|
|
959
|
-
{
|
|
992
|
+
{ label: 'OptGroup 1',
|
|
960
993
|
selectOptions: [
|
|
961
994
|
{ value: 'Een select' },
|
|
962
995
|
{ value: 'werkt ook met ' }
|
|
963
996
|
]
|
|
964
997
|
},
|
|
965
|
-
{
|
|
998
|
+
{ label: 'OptGroup 2',
|
|
966
999
|
selectOptions: [
|
|
967
1000
|
{ value: 'Objects: {value: xxx, disabled?: false}' },
|
|
968
1001
|
{ value: 'Die kunnen disabled zijn', disabled: true },
|
|
@@ -990,7 +1023,7 @@ Een Multiselect werkt bijna hetzelfde als een select. Dezelfde type options word
|
|
|
990
1023
|
name="SelectInput"
|
|
991
1024
|
label="Select options met een array"
|
|
992
1025
|
id="selectinput"
|
|
993
|
-
options={[
|
|
1026
|
+
options={['Dit zijn', 'De options', 'Met een', 'string array']}
|
|
994
1027
|
/>
|
|
995
1028
|
|
|
996
1029
|
{/* Een mulit-select met value-label-options. ALs er geen label is, wordt de value daarvoor gebruikt */}
|
|
@@ -999,13 +1032,13 @@ Een Multiselect werkt bijna hetzelfde als een select. Dezelfde type options word
|
|
|
999
1032
|
label="Select options met SelectOptionTypes"
|
|
1000
1033
|
id="selectinput2"
|
|
1001
1034
|
options={[
|
|
1002
|
-
{ value:
|
|
1003
|
-
{ value:
|
|
1004
|
-
{ value:
|
|
1005
|
-
{ value:
|
|
1035
|
+
{ value: '1', label: 'Een select' },
|
|
1036
|
+
{ value: '2', label: 'werkt ook met ' },
|
|
1037
|
+
{ value: '3', label: 'Objects: {value: xxx, disabled?: false}' },
|
|
1038
|
+
{ value: '4', label: 'Die kunnen disabled zijn', disabled: true },
|
|
1006
1039
|
{
|
|
1007
|
-
value:
|
|
1008
|
-
label:
|
|
1040
|
+
value: '5',
|
|
1041
|
+
label: 'Met objects kunnen er ook optgroups gemaakt worden!',
|
|
1009
1042
|
},
|
|
1010
1043
|
]}
|
|
1011
1044
|
validatie={{ required: true, min: 2 }}
|
|
@@ -1018,20 +1051,20 @@ Een Multiselect werkt bijna hetzelfde als een select. Dezelfde type options word
|
|
|
1018
1051
|
id="selectinput3"
|
|
1019
1052
|
options={[
|
|
1020
1053
|
{
|
|
1021
|
-
label:
|
|
1054
|
+
label: 'OptGroup 1',
|
|
1022
1055
|
selectOptions: [
|
|
1023
|
-
{ value:
|
|
1024
|
-
{ value:
|
|
1056
|
+
{ value: '4', label: 'Een select' },
|
|
1057
|
+
{ value: '5', label: 'werkt ook met ' },
|
|
1025
1058
|
],
|
|
1026
1059
|
},
|
|
1027
1060
|
{
|
|
1028
|
-
label:
|
|
1061
|
+
label: 'OptGroup 2',
|
|
1029
1062
|
selectOptions: [
|
|
1030
|
-
{ value:
|
|
1031
|
-
{ value:
|
|
1063
|
+
{ value: '1', label: 'Objects: {value: xxx, disabled?: false}' },
|
|
1064
|
+
{ value: '2', label: 'Die kunnen disabled zijn', disabled: true },
|
|
1032
1065
|
{
|
|
1033
|
-
value:
|
|
1034
|
-
label:
|
|
1066
|
+
value: '3',
|
|
1067
|
+
label: 'Met objects kunnen er ook optgroups gemaakt worden!',
|
|
1035
1068
|
},
|
|
1036
1069
|
],
|
|
1037
1070
|
},
|
|
@@ -1106,14 +1139,14 @@ Het resultaat van deze form komt via de `onSubmit()` methode naar buiten. Als de
|
|
|
1106
1139
|
```ts
|
|
1107
1140
|
// post
|
|
1108
1141
|
{
|
|
1109
|
-
Token:
|
|
1110
|
-
Email:
|
|
1142
|
+
Token: 'Bazinga!';
|
|
1143
|
+
Email: 'brad@wurst.com';
|
|
1111
1144
|
Leeftijd: 31;
|
|
1112
|
-
Naam:
|
|
1113
|
-
Wachtwoord:
|
|
1145
|
+
Naam: 'Brad Wurst';
|
|
1146
|
+
Wachtwoord: '123123';
|
|
1114
1147
|
}
|
|
1115
1148
|
// get
|
|
1116
|
-
(
|
|
1149
|
+
('Token=Bazinga%21&Naam=Brad+Wurst&Email=brad%40wurst.com&Wachtwoord=123123&Leeftijd=31');
|
|
1117
1150
|
```
|
|
1118
1151
|
|
|
1119
1152
|
## Publiceren <a id="publiceren"></a>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ReactNode } from
|
|
2
|
-
import { SizeProp } from
|
|
3
|
-
import { ButtonProps } from
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { SizeProp } from '../..';
|
|
3
|
+
import { ButtonProps } from './ButtonProps';
|
|
4
4
|
/**
|
|
5
5
|
* Een gewone, default button in de primary kleur
|
|
6
6
|
* Gebruik {@link ButtonGroup} om meerdere buttons te grouperen.
|
|
@@ -48,7 +48,7 @@ export declare function Static(props: {
|
|
|
48
48
|
loading?: boolean | undefined;
|
|
49
49
|
children?: ReactNode;
|
|
50
50
|
size?: SizeProp;
|
|
51
|
-
type?:
|
|
51
|
+
type?: 'submit' | 'button' | 'reset' | undefined;
|
|
52
52
|
disabled?: boolean | undefined;
|
|
53
53
|
tooltip?: string;
|
|
54
54
|
icon?: string | any;
|