uibee 2.7.6 → 2.7.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.
@@ -28,11 +28,11 @@ export default function Input({ label, name, type = 'text', placeholder, value,
28
28
  const mm = pad(date.getMinutes());
29
29
  let newValue = '';
30
30
  if (type === 'date')
31
- newValue = `${dd}/${MM}/${yyyy}`;
31
+ newValue = `${yyyy}-${MM}-${dd}`;
32
32
  else if (type === 'time')
33
33
  newValue = `${hh}:${mm}`;
34
34
  else if (type === 'datetime-local')
35
- newValue = `${dd}/${MM}/${yyyy} ${hh}:${mm}`;
35
+ newValue = `${yyyy}-${MM}-${dd}T${hh}:${mm}`;
36
36
  const event = {
37
37
  target: {
38
38
  name,
@@ -11,5 +11,6 @@ export type TextareaProps = {
11
11
  required?: boolean;
12
12
  rows?: number;
13
13
  info?: string;
14
+ markdown?: boolean;
14
15
  };
15
- export default function Textarea({ label, name, placeholder, value, onChange, error, className, disabled, required, rows, info, }: TextareaProps): import("react/jsx-runtime").JSX.Element;
16
+ export default function Textarea({ label, name, placeholder, value, onChange, error, className, disabled, required, rows, info, markdown, }: TextareaProps): import("react/jsx-runtime").JSX.Element;
@@ -1,14 +1,24 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from 'react';
3
+ import ReactMarkdown from 'react-markdown';
4
+ import { Eye, Pencil } from 'lucide-react';
2
5
  import { FieldWrapper } from './shared';
3
- export default function Textarea({ label, name, placeholder, value, onChange, error, className, disabled, required, rows = 4, info, }) {
4
- return (_jsx(FieldWrapper, { label: label, name: name, required: required, info: info, error: error, className: className, children: _jsx("textarea", { id: name, name: name, placeholder: placeholder, value: value, onChange: onChange, disabled: disabled, required: required, rows: rows, title: label, "aria-invalid": !!error, "aria-describedby": error ? `${name}-error` : undefined, className: `
5
- w-full rounded-md bg-login-500/50 border border-login-500
6
- text-login-text placeholder-login-200
7
- focus:outline-none focus:border-login focus:ring-1 focus:ring-login
8
- disabled:opacity-50 disabled:cursor-not-allowed
9
- p-3
10
- transition-all duration-200
11
- resize-y
12
- ${error ? 'border-red-500 focus:border-red-500 focus:ring-red-500' : ''}
13
- ` }) }));
6
+ export default function Textarea({ label, name, placeholder, value, onChange, error, className, disabled, required, rows = 4, info, markdown = false, }) {
7
+ const [preview, setPreview] = useState(false);
8
+ return (_jsx(FieldWrapper, { label: label, name: name, required: required, info: info, error: error, className: className, children: _jsxs("div", { className: 'relative', children: [markdown && (_jsx("div", { className: 'absolute right-2 top-2 z-10 flex gap-2', children: _jsx("button", { type: 'button', onClick: () => setPreview(!preview), className: 'p-1 rounded hover:bg-login-500/50 text-login-text transition-colors', title: preview ? 'Edit' : 'Preview', children: preview ? _jsx(Pencil, { size: 16 }) : _jsx(Eye, { size: 16 }) }) })), markdown && preview ? (_jsx("div", { className: `
9
+ w-full rounded-md bg-login-500/50 border border-login-500
10
+ text-login-text
11
+ p-3
12
+ prose prose-invert prose-sm max-w-none overflow-y-auto
13
+ ${error ? 'border-red-500' : ''}
14
+ `, style: { minHeight: `${rows * 1.5}rem` }, children: _jsx(ReactMarkdown, { children: value || '' }) })) : (_jsx("textarea", { id: name, name: name, placeholder: placeholder, value: value, onChange: onChange, disabled: disabled, required: required, rows: rows, title: label, "aria-invalid": !!error, "aria-describedby": error ? `${name}-error` : undefined, className: `
15
+ w-full rounded-md bg-login-500/50 border border-login-500
16
+ text-login-text placeholder-login-200
17
+ focus:outline-none focus:border-login focus:ring-1 focus:ring-login
18
+ disabled:opacity-50 disabled:cursor-not-allowed
19
+ p-3
20
+ transition-all duration-200
21
+ resize-y
22
+ ${error ? 'border-red-500 focus:border-red-500 focus:ring-red-500' : ''}
23
+ ` }))] }) }));
14
24
  }
@@ -299,6 +299,9 @@
299
299
  .top-1\/2 {
300
300
  top: calc(1/2 * 100%);
301
301
  }
302
+ .top-2 {
303
+ top: calc(var(--spacing) * 2);
304
+ }
302
305
  .top-4 {
303
306
  top: calc(var(--spacing) * 4);
304
307
  }
@@ -317,6 +320,9 @@
317
320
  .right-0 {
318
321
  right: calc(var(--spacing) * 0);
319
322
  }
323
+ .right-2 {
324
+ right: calc(var(--spacing) * 2);
325
+ }
320
326
  .right-4 {
321
327
  right: calc(var(--spacing) * 4);
322
328
  }
@@ -359,6 +365,421 @@
359
365
  .mx-auto {
360
366
  margin-inline: auto;
361
367
  }
368
+ .prose {
369
+ color: var(--tw-prose-body);
370
+ max-width: 65ch;
371
+ :where(p):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
372
+ margin-top: 1.25em;
373
+ margin-bottom: 1.25em;
374
+ }
375
+ :where([class~="lead"]):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
376
+ color: var(--tw-prose-lead);
377
+ font-size: 1.25em;
378
+ line-height: 1.6;
379
+ margin-top: 1.2em;
380
+ margin-bottom: 1.2em;
381
+ }
382
+ :where(a):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
383
+ color: var(--tw-prose-links);
384
+ text-decoration: underline;
385
+ font-weight: 500;
386
+ }
387
+ :where(strong):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
388
+ color: var(--tw-prose-bold);
389
+ font-weight: 600;
390
+ }
391
+ :where(a strong):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
392
+ color: inherit;
393
+ }
394
+ :where(blockquote strong):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
395
+ color: inherit;
396
+ }
397
+ :where(thead th strong):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
398
+ color: inherit;
399
+ }
400
+ :where(ol):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
401
+ list-style-type: decimal;
402
+ margin-top: 1.25em;
403
+ margin-bottom: 1.25em;
404
+ padding-inline-start: 1.625em;
405
+ }
406
+ :where(ol[type="A"]):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
407
+ list-style-type: upper-alpha;
408
+ }
409
+ :where(ol[type="a"]):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
410
+ list-style-type: lower-alpha;
411
+ }
412
+ :where(ol[type="A" s]):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
413
+ list-style-type: upper-alpha;
414
+ }
415
+ :where(ol[type="a" s]):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
416
+ list-style-type: lower-alpha;
417
+ }
418
+ :where(ol[type="I"]):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
419
+ list-style-type: upper-roman;
420
+ }
421
+ :where(ol[type="i"]):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
422
+ list-style-type: lower-roman;
423
+ }
424
+ :where(ol[type="I" s]):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
425
+ list-style-type: upper-roman;
426
+ }
427
+ :where(ol[type="i" s]):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
428
+ list-style-type: lower-roman;
429
+ }
430
+ :where(ol[type="1"]):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
431
+ list-style-type: decimal;
432
+ }
433
+ :where(ul):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
434
+ list-style-type: disc;
435
+ margin-top: 1.25em;
436
+ margin-bottom: 1.25em;
437
+ padding-inline-start: 1.625em;
438
+ }
439
+ :where(ol > li):not(:where([class~="not-prose"],[class~="not-prose"] *))::marker {
440
+ font-weight: 400;
441
+ color: var(--tw-prose-counters);
442
+ }
443
+ :where(ul > li):not(:where([class~="not-prose"],[class~="not-prose"] *))::marker {
444
+ color: var(--tw-prose-bullets);
445
+ }
446
+ :where(dt):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
447
+ color: var(--tw-prose-headings);
448
+ font-weight: 600;
449
+ margin-top: 1.25em;
450
+ }
451
+ :where(hr):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
452
+ border-color: var(--tw-prose-hr);
453
+ border-top-width: 1px;
454
+ margin-top: 3em;
455
+ margin-bottom: 3em;
456
+ }
457
+ :where(blockquote):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
458
+ font-weight: 500;
459
+ font-style: italic;
460
+ color: var(--tw-prose-quotes);
461
+ border-inline-start-width: 0.25rem;
462
+ border-inline-start-color: var(--tw-prose-quote-borders);
463
+ quotes: "\201C""\201D""\2018""\2019";
464
+ margin-top: 1.6em;
465
+ margin-bottom: 1.6em;
466
+ padding-inline-start: 1em;
467
+ }
468
+ :where(blockquote p:first-of-type):not(:where([class~="not-prose"],[class~="not-prose"] *))::before {
469
+ content: open-quote;
470
+ }
471
+ :where(blockquote p:last-of-type):not(:where([class~="not-prose"],[class~="not-prose"] *))::after {
472
+ content: close-quote;
473
+ }
474
+ :where(h1):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
475
+ color: var(--tw-prose-headings);
476
+ font-weight: 800;
477
+ font-size: 2.25em;
478
+ margin-top: 0;
479
+ margin-bottom: 0.8888889em;
480
+ line-height: 1.1111111;
481
+ }
482
+ :where(h1 strong):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
483
+ font-weight: 900;
484
+ color: inherit;
485
+ }
486
+ :where(h2):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
487
+ color: var(--tw-prose-headings);
488
+ font-weight: 700;
489
+ font-size: 1.5em;
490
+ margin-top: 2em;
491
+ margin-bottom: 1em;
492
+ line-height: 1.3333333;
493
+ }
494
+ :where(h2 strong):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
495
+ font-weight: 800;
496
+ color: inherit;
497
+ }
498
+ :where(h3):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
499
+ color: var(--tw-prose-headings);
500
+ font-weight: 600;
501
+ font-size: 1.25em;
502
+ margin-top: 1.6em;
503
+ margin-bottom: 0.6em;
504
+ line-height: 1.6;
505
+ }
506
+ :where(h3 strong):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
507
+ font-weight: 700;
508
+ color: inherit;
509
+ }
510
+ :where(h4):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
511
+ color: var(--tw-prose-headings);
512
+ font-weight: 600;
513
+ margin-top: 1.5em;
514
+ margin-bottom: 0.5em;
515
+ line-height: 1.5;
516
+ }
517
+ :where(h4 strong):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
518
+ font-weight: 700;
519
+ color: inherit;
520
+ }
521
+ :where(img):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
522
+ margin-top: 2em;
523
+ margin-bottom: 2em;
524
+ }
525
+ :where(picture):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
526
+ display: block;
527
+ margin-top: 2em;
528
+ margin-bottom: 2em;
529
+ }
530
+ :where(video):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
531
+ margin-top: 2em;
532
+ margin-bottom: 2em;
533
+ }
534
+ :where(kbd):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
535
+ font-weight: 500;
536
+ font-family: inherit;
537
+ color: var(--tw-prose-kbd);
538
+ box-shadow: 0 0 0 1px var(--tw-prose-kbd-shadows), 0 3px 0 var(--tw-prose-kbd-shadows);
539
+ font-size: 0.875em;
540
+ border-radius: 0.3125rem;
541
+ padding-top: 0.1875em;
542
+ padding-inline-end: 0.375em;
543
+ padding-bottom: 0.1875em;
544
+ padding-inline-start: 0.375em;
545
+ }
546
+ :where(code):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
547
+ color: var(--tw-prose-code);
548
+ font-weight: 600;
549
+ font-size: 0.875em;
550
+ }
551
+ :where(code):not(:where([class~="not-prose"],[class~="not-prose"] *))::before {
552
+ content: "`";
553
+ }
554
+ :where(code):not(:where([class~="not-prose"],[class~="not-prose"] *))::after {
555
+ content: "`";
556
+ }
557
+ :where(a code):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
558
+ color: inherit;
559
+ }
560
+ :where(h1 code):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
561
+ color: inherit;
562
+ }
563
+ :where(h2 code):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
564
+ color: inherit;
565
+ font-size: 0.875em;
566
+ }
567
+ :where(h3 code):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
568
+ color: inherit;
569
+ font-size: 0.9em;
570
+ }
571
+ :where(h4 code):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
572
+ color: inherit;
573
+ }
574
+ :where(blockquote code):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
575
+ color: inherit;
576
+ }
577
+ :where(thead th code):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
578
+ color: inherit;
579
+ }
580
+ :where(pre):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
581
+ color: var(--tw-prose-pre-code);
582
+ background-color: var(--tw-prose-pre-bg);
583
+ overflow-x: auto;
584
+ font-weight: 400;
585
+ font-size: 0.875em;
586
+ line-height: 1.7142857;
587
+ margin-top: 1.7142857em;
588
+ margin-bottom: 1.7142857em;
589
+ border-radius: 0.375rem;
590
+ padding-top: 0.8571429em;
591
+ padding-inline-end: 1.1428571em;
592
+ padding-bottom: 0.8571429em;
593
+ padding-inline-start: 1.1428571em;
594
+ }
595
+ :where(pre code):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
596
+ background-color: transparent;
597
+ border-width: 0;
598
+ border-radius: 0;
599
+ padding: 0;
600
+ font-weight: inherit;
601
+ color: inherit;
602
+ font-size: inherit;
603
+ font-family: inherit;
604
+ line-height: inherit;
605
+ }
606
+ :where(pre code):not(:where([class~="not-prose"],[class~="not-prose"] *))::before {
607
+ content: none;
608
+ }
609
+ :where(pre code):not(:where([class~="not-prose"],[class~="not-prose"] *))::after {
610
+ content: none;
611
+ }
612
+ :where(table):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
613
+ width: 100%;
614
+ table-layout: auto;
615
+ margin-top: 2em;
616
+ margin-bottom: 2em;
617
+ font-size: 0.875em;
618
+ line-height: 1.7142857;
619
+ }
620
+ :where(thead):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
621
+ border-bottom-width: 1px;
622
+ border-bottom-color: var(--tw-prose-th-borders);
623
+ }
624
+ :where(thead th):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
625
+ color: var(--tw-prose-headings);
626
+ font-weight: 600;
627
+ vertical-align: bottom;
628
+ padding-inline-end: 0.5714286em;
629
+ padding-bottom: 0.5714286em;
630
+ padding-inline-start: 0.5714286em;
631
+ }
632
+ :where(tbody tr):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
633
+ border-bottom-width: 1px;
634
+ border-bottom-color: var(--tw-prose-td-borders);
635
+ }
636
+ :where(tbody tr:last-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
637
+ border-bottom-width: 0;
638
+ }
639
+ :where(tbody td):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
640
+ vertical-align: baseline;
641
+ }
642
+ :where(tfoot):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
643
+ border-top-width: 1px;
644
+ border-top-color: var(--tw-prose-th-borders);
645
+ }
646
+ :where(tfoot td):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
647
+ vertical-align: top;
648
+ }
649
+ :where(th, td):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
650
+ text-align: start;
651
+ }
652
+ :where(figure > *):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
653
+ margin-top: 0;
654
+ margin-bottom: 0;
655
+ }
656
+ :where(figcaption):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
657
+ color: var(--tw-prose-captions);
658
+ font-size: 0.875em;
659
+ line-height: 1.4285714;
660
+ margin-top: 0.8571429em;
661
+ }
662
+ --tw-prose-body: oklch(37.3% 0.034 259.733);
663
+ --tw-prose-headings: oklch(21% 0.034 264.665);
664
+ --tw-prose-lead: oklch(44.6% 0.03 256.802);
665
+ --tw-prose-links: oklch(21% 0.034 264.665);
666
+ --tw-prose-bold: oklch(21% 0.034 264.665);
667
+ --tw-prose-counters: oklch(55.1% 0.027 264.364);
668
+ --tw-prose-bullets: oklch(87.2% 0.01 258.338);
669
+ --tw-prose-hr: oklch(92.8% 0.006 264.531);
670
+ --tw-prose-quotes: oklch(21% 0.034 264.665);
671
+ --tw-prose-quote-borders: oklch(92.8% 0.006 264.531);
672
+ --tw-prose-captions: oklch(55.1% 0.027 264.364);
673
+ --tw-prose-kbd: oklch(21% 0.034 264.665);
674
+ --tw-prose-kbd-shadows: color-mix(in oklab, oklch(21% 0.034 264.665) 10%, transparent);
675
+ --tw-prose-code: oklch(21% 0.034 264.665);
676
+ --tw-prose-pre-code: oklch(92.8% 0.006 264.531);
677
+ --tw-prose-pre-bg: oklch(27.8% 0.033 256.848);
678
+ --tw-prose-th-borders: oklch(87.2% 0.01 258.338);
679
+ --tw-prose-td-borders: oklch(92.8% 0.006 264.531);
680
+ --tw-prose-invert-body: oklch(87.2% 0.01 258.338);
681
+ --tw-prose-invert-headings: #fff;
682
+ --tw-prose-invert-lead: oklch(70.7% 0.022 261.325);
683
+ --tw-prose-invert-links: #fff;
684
+ --tw-prose-invert-bold: #fff;
685
+ --tw-prose-invert-counters: oklch(70.7% 0.022 261.325);
686
+ --tw-prose-invert-bullets: oklch(44.6% 0.03 256.802);
687
+ --tw-prose-invert-hr: oklch(37.3% 0.034 259.733);
688
+ --tw-prose-invert-quotes: oklch(96.7% 0.003 264.542);
689
+ --tw-prose-invert-quote-borders: oklch(37.3% 0.034 259.733);
690
+ --tw-prose-invert-captions: oklch(70.7% 0.022 261.325);
691
+ --tw-prose-invert-kbd: #fff;
692
+ --tw-prose-invert-kbd-shadows: rgb(255 255 255 / 10%);
693
+ --tw-prose-invert-code: #fff;
694
+ --tw-prose-invert-pre-code: oklch(87.2% 0.01 258.338);
695
+ --tw-prose-invert-pre-bg: rgb(0 0 0 / 50%);
696
+ --tw-prose-invert-th-borders: oklch(44.6% 0.03 256.802);
697
+ --tw-prose-invert-td-borders: oklch(37.3% 0.034 259.733);
698
+ font-size: 1rem;
699
+ line-height: 1.75;
700
+ :where(picture > img):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
701
+ margin-top: 0;
702
+ margin-bottom: 0;
703
+ }
704
+ :where(li):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
705
+ margin-top: 0.5em;
706
+ margin-bottom: 0.5em;
707
+ }
708
+ :where(ol > li):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
709
+ padding-inline-start: 0.375em;
710
+ }
711
+ :where(ul > li):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
712
+ padding-inline-start: 0.375em;
713
+ }
714
+ :where(.prose > ul > li p):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
715
+ margin-top: 0.75em;
716
+ margin-bottom: 0.75em;
717
+ }
718
+ :where(.prose > ul > li > p:first-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
719
+ margin-top: 1.25em;
720
+ }
721
+ :where(.prose > ul > li > p:last-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
722
+ margin-bottom: 1.25em;
723
+ }
724
+ :where(.prose > ol > li > p:first-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
725
+ margin-top: 1.25em;
726
+ }
727
+ :where(.prose > ol > li > p:last-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
728
+ margin-bottom: 1.25em;
729
+ }
730
+ :where(ul ul, ul ol, ol ul, ol ol):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
731
+ margin-top: 0.75em;
732
+ margin-bottom: 0.75em;
733
+ }
734
+ :where(dl):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
735
+ margin-top: 1.25em;
736
+ margin-bottom: 1.25em;
737
+ }
738
+ :where(dd):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
739
+ margin-top: 0.5em;
740
+ padding-inline-start: 1.625em;
741
+ }
742
+ :where(hr + *):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
743
+ margin-top: 0;
744
+ }
745
+ :where(h2 + *):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
746
+ margin-top: 0;
747
+ }
748
+ :where(h3 + *):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
749
+ margin-top: 0;
750
+ }
751
+ :where(h4 + *):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
752
+ margin-top: 0;
753
+ }
754
+ :where(thead th:first-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
755
+ padding-inline-start: 0;
756
+ }
757
+ :where(thead th:last-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
758
+ padding-inline-end: 0;
759
+ }
760
+ :where(tbody td, tfoot td):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
761
+ padding-top: 0.5714286em;
762
+ padding-inline-end: 0.5714286em;
763
+ padding-bottom: 0.5714286em;
764
+ padding-inline-start: 0.5714286em;
765
+ }
766
+ :where(tbody td:first-child, tfoot td:first-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
767
+ padding-inline-start: 0;
768
+ }
769
+ :where(tbody td:last-child, tfoot td:last-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
770
+ padding-inline-end: 0;
771
+ }
772
+ :where(figure):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
773
+ margin-top: 2em;
774
+ margin-bottom: 2em;
775
+ }
776
+ :where(.prose > :first-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
777
+ margin-top: 0;
778
+ }
779
+ :where(.prose > :last-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
780
+ margin-bottom: 0;
781
+ }
782
+ }
362
783
  .highlighted-section {
363
784
  line-height: 1.8rem;
364
785
  border-left: .3rem solid var(--color-login);
@@ -369,6 +790,205 @@
369
790
  font-size: 1.2rem;
370
791
  font-weight: 500;
371
792
  }
793
+ .prose-sm {
794
+ font-size: 0.875rem;
795
+ line-height: 1.7142857;
796
+ :where(p):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
797
+ margin-top: 1.1428571em;
798
+ margin-bottom: 1.1428571em;
799
+ }
800
+ :where([class~="lead"]):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
801
+ font-size: 1.2857143em;
802
+ line-height: 1.5555556;
803
+ margin-top: 0.8888889em;
804
+ margin-bottom: 0.8888889em;
805
+ }
806
+ :where(blockquote):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
807
+ margin-top: 1.3333333em;
808
+ margin-bottom: 1.3333333em;
809
+ padding-inline-start: 1.1111111em;
810
+ }
811
+ :where(h1):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
812
+ font-size: 2.1428571em;
813
+ margin-top: 0;
814
+ margin-bottom: 0.8em;
815
+ line-height: 1.2;
816
+ }
817
+ :where(h2):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
818
+ font-size: 1.4285714em;
819
+ margin-top: 1.6em;
820
+ margin-bottom: 0.8em;
821
+ line-height: 1.4;
822
+ }
823
+ :where(h3):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
824
+ font-size: 1.2857143em;
825
+ margin-top: 1.5555556em;
826
+ margin-bottom: 0.4444444em;
827
+ line-height: 1.5555556;
828
+ }
829
+ :where(h4):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
830
+ margin-top: 1.4285714em;
831
+ margin-bottom: 0.5714286em;
832
+ line-height: 1.4285714;
833
+ }
834
+ :where(img):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
835
+ margin-top: 1.7142857em;
836
+ margin-bottom: 1.7142857em;
837
+ }
838
+ :where(picture):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
839
+ margin-top: 1.7142857em;
840
+ margin-bottom: 1.7142857em;
841
+ }
842
+ :where(picture > img):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
843
+ margin-top: 0;
844
+ margin-bottom: 0;
845
+ }
846
+ :where(video):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
847
+ margin-top: 1.7142857em;
848
+ margin-bottom: 1.7142857em;
849
+ }
850
+ :where(kbd):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
851
+ font-size: 0.8571429em;
852
+ border-radius: 0.3125rem;
853
+ padding-top: 0.1428571em;
854
+ padding-inline-end: 0.3571429em;
855
+ padding-bottom: 0.1428571em;
856
+ padding-inline-start: 0.3571429em;
857
+ }
858
+ :where(code):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
859
+ font-size: 0.8571429em;
860
+ }
861
+ :where(h2 code):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
862
+ font-size: 0.9em;
863
+ }
864
+ :where(h3 code):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
865
+ font-size: 0.8888889em;
866
+ }
867
+ :where(pre):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
868
+ font-size: 0.8571429em;
869
+ line-height: 1.6666667;
870
+ margin-top: 1.6666667em;
871
+ margin-bottom: 1.6666667em;
872
+ border-radius: 0.25rem;
873
+ padding-top: 0.6666667em;
874
+ padding-inline-end: 1em;
875
+ padding-bottom: 0.6666667em;
876
+ padding-inline-start: 1em;
877
+ }
878
+ :where(ol):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
879
+ margin-top: 1.1428571em;
880
+ margin-bottom: 1.1428571em;
881
+ padding-inline-start: 1.5714286em;
882
+ }
883
+ :where(ul):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
884
+ margin-top: 1.1428571em;
885
+ margin-bottom: 1.1428571em;
886
+ padding-inline-start: 1.5714286em;
887
+ }
888
+ :where(li):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
889
+ margin-top: 0.2857143em;
890
+ margin-bottom: 0.2857143em;
891
+ }
892
+ :where(ol > li):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
893
+ padding-inline-start: 0.4285714em;
894
+ }
895
+ :where(ul > li):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
896
+ padding-inline-start: 0.4285714em;
897
+ }
898
+ :where(.prose-sm > ul > li p):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
899
+ margin-top: 0.5714286em;
900
+ margin-bottom: 0.5714286em;
901
+ }
902
+ :where(.prose-sm > ul > li > p:first-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
903
+ margin-top: 1.1428571em;
904
+ }
905
+ :where(.prose-sm > ul > li > p:last-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
906
+ margin-bottom: 1.1428571em;
907
+ }
908
+ :where(.prose-sm > ol > li > p:first-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
909
+ margin-top: 1.1428571em;
910
+ }
911
+ :where(.prose-sm > ol > li > p:last-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
912
+ margin-bottom: 1.1428571em;
913
+ }
914
+ :where(ul ul, ul ol, ol ul, ol ol):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
915
+ margin-top: 0.5714286em;
916
+ margin-bottom: 0.5714286em;
917
+ }
918
+ :where(dl):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
919
+ margin-top: 1.1428571em;
920
+ margin-bottom: 1.1428571em;
921
+ }
922
+ :where(dt):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
923
+ margin-top: 1.1428571em;
924
+ }
925
+ :where(dd):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
926
+ margin-top: 0.2857143em;
927
+ padding-inline-start: 1.5714286em;
928
+ }
929
+ :where(hr):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
930
+ margin-top: 2.8571429em;
931
+ margin-bottom: 2.8571429em;
932
+ }
933
+ :where(hr + *):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
934
+ margin-top: 0;
935
+ }
936
+ :where(h2 + *):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
937
+ margin-top: 0;
938
+ }
939
+ :where(h3 + *):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
940
+ margin-top: 0;
941
+ }
942
+ :where(h4 + *):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
943
+ margin-top: 0;
944
+ }
945
+ :where(table):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
946
+ font-size: 0.8571429em;
947
+ line-height: 1.5;
948
+ }
949
+ :where(thead th):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
950
+ padding-inline-end: 1em;
951
+ padding-bottom: 0.6666667em;
952
+ padding-inline-start: 1em;
953
+ }
954
+ :where(thead th:first-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
955
+ padding-inline-start: 0;
956
+ }
957
+ :where(thead th:last-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
958
+ padding-inline-end: 0;
959
+ }
960
+ :where(tbody td, tfoot td):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
961
+ padding-top: 0.6666667em;
962
+ padding-inline-end: 1em;
963
+ padding-bottom: 0.6666667em;
964
+ padding-inline-start: 1em;
965
+ }
966
+ :where(tbody td:first-child, tfoot td:first-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
967
+ padding-inline-start: 0;
968
+ }
969
+ :where(tbody td:last-child, tfoot td:last-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
970
+ padding-inline-end: 0;
971
+ }
972
+ :where(figure):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
973
+ margin-top: 1.7142857em;
974
+ margin-bottom: 1.7142857em;
975
+ }
976
+ :where(figure > *):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
977
+ margin-top: 0;
978
+ margin-bottom: 0;
979
+ }
980
+ :where(figcaption):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
981
+ font-size: 0.8571429em;
982
+ line-height: 1.3333333;
983
+ margin-top: 0.6666667em;
984
+ }
985
+ :where(.prose-sm > :first-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
986
+ margin-top: 0;
987
+ }
988
+ :where(.prose-sm > :last-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
989
+ margin-bottom: 0;
990
+ }
991
+ }
372
992
  .-mt-0\.5 {
373
993
  margin-top: calc(var(--spacing) * -0.5);
374
994
  }
@@ -544,6 +1164,9 @@
544
1164
  .max-w-md {
545
1165
  max-width: var(--container-md);
546
1166
  }
1167
+ .max-w-none {
1168
+ max-width: none;
1169
+ }
547
1170
  .max-w-sm {
548
1171
  max-width: var(--container-sm);
549
1172
  }
@@ -690,6 +1313,9 @@
690
1313
  .overflow-hidden {
691
1314
  overflow: hidden;
692
1315
  }
1316
+ .overflow-y-auto {
1317
+ overflow-y: auto;
1318
+ }
693
1319
  .rounded {
694
1320
  border-radius: 0.25rem;
695
1321
  }
@@ -1144,6 +1770,26 @@
1144
1770
  --tw-ease: var(--ease-out);
1145
1771
  transition-timing-function: var(--ease-out);
1146
1772
  }
1773
+ .prose-invert {
1774
+ --tw-prose-body: var(--tw-prose-invert-body);
1775
+ --tw-prose-headings: var(--tw-prose-invert-headings);
1776
+ --tw-prose-lead: var(--tw-prose-invert-lead);
1777
+ --tw-prose-links: var(--tw-prose-invert-links);
1778
+ --tw-prose-bold: var(--tw-prose-invert-bold);
1779
+ --tw-prose-counters: var(--tw-prose-invert-counters);
1780
+ --tw-prose-bullets: var(--tw-prose-invert-bullets);
1781
+ --tw-prose-hr: var(--tw-prose-invert-hr);
1782
+ --tw-prose-quotes: var(--tw-prose-invert-quotes);
1783
+ --tw-prose-quote-borders: var(--tw-prose-invert-quote-borders);
1784
+ --tw-prose-captions: var(--tw-prose-invert-captions);
1785
+ --tw-prose-kbd: var(--tw-prose-invert-kbd);
1786
+ --tw-prose-kbd-shadows: var(--tw-prose-invert-kbd-shadows);
1787
+ --tw-prose-code: var(--tw-prose-invert-code);
1788
+ --tw-prose-pre-code: var(--tw-prose-invert-pre-code);
1789
+ --tw-prose-pre-bg: var(--tw-prose-invert-pre-bg);
1790
+ --tw-prose-th-borders: var(--tw-prose-invert-th-borders);
1791
+ --tw-prose-td-borders: var(--tw-prose-invert-td-borders);
1792
+ }
1147
1793
  .outline-none {
1148
1794
  --tw-outline-style: none;
1149
1795
  outline-style: none;
@@ -1353,6 +1999,16 @@
1353
1999
  }
1354
2000
  }
1355
2001
  }
2002
+ .hover\:bg-login-500\/50 {
2003
+ &:hover {
2004
+ @media (hover: hover) {
2005
+ background-color: color-mix(in srgb, #323232 50%, transparent);
2006
+ @supports (color: color-mix(in lab, red, red)) {
2007
+ background-color: color-mix(in oklab, var(--color-login-500) 50%, transparent);
2008
+ }
2009
+ }
2010
+ }
2011
+ }
1356
2012
  .hover\:bg-login-500\/90 {
1357
2013
  &:hover {
1358
2014
  @media (hover: hover) {
@@ -1,6 +1,7 @@
1
+ import typography from '@tailwindcss/typography';
1
2
  const tailwindConfig = {
2
3
  content: ['./app/**/*.{js,ts,jsx,tsx}', './components/**/*.{js,ts,jsx,tsx}'],
3
4
  theme: { extend: {} },
4
- plugins: [],
5
+ plugins: [typography],
5
6
  };
6
7
  export default tailwindConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uibee",
3
- "version": "2.7.6",
3
+ "version": "2.7.8",
4
4
  "description": "Shared components, functions and hooks for reuse across Login projects",
5
5
  "homepage": "https://github.com/Login-Linjeforening-for-IT/uibee#readme",
6
6
  "bugs": {
@@ -40,6 +40,7 @@
40
40
  "@next/eslint-plugin-next": "16.1.1",
41
41
  "@stylistic/eslint-plugin": "^5.6.1",
42
42
  "@tailwindcss/postcss": "^4.1.18",
43
+ "@tailwindcss/typography": "^0.5.19",
43
44
  "@types/node": "^25.0.3",
44
45
  "@types/react": "19.2.7",
45
46
  "eslint": "^9.39.2",
@@ -53,6 +54,7 @@
53
54
  "dependencies": {
54
55
  "lucide-react": "^0.562.0",
55
56
  "react-dom": "19.2.3",
57
+ "react-markdown": "^10.1.0",
56
58
  "utilbee": "^1.1.0"
57
59
  }
58
60
  }
@@ -59,9 +59,9 @@ export default function Input({
59
59
  const mm = pad(date.getMinutes())
60
60
 
61
61
  let newValue = ''
62
- if (type === 'date') newValue = `${dd}/${MM}/${yyyy}`
62
+ if (type === 'date') newValue = `${yyyy}-${MM}-${dd}`
63
63
  else if (type === 'time') newValue = `${hh}:${mm}`
64
- else if (type === 'datetime-local') newValue = `${dd}/${MM}/${yyyy} ${hh}:${mm}`
64
+ else if (type === 'datetime-local') newValue = `${yyyy}-${MM}-${dd}T${hh}:${mm}`
65
65
 
66
66
  const event = {
67
67
  target: {
@@ -1,4 +1,6 @@
1
- import { type ChangeEvent } from 'react'
1
+ import { type ChangeEvent, useState } from 'react'
2
+ import ReactMarkdown from 'react-markdown'
3
+ import { Eye, Pencil } from 'lucide-react'
2
4
  import { FieldWrapper } from './shared'
3
5
 
4
6
  export type TextareaProps = {
@@ -13,6 +15,7 @@ export type TextareaProps = {
13
15
  required?: boolean
14
16
  rows?: number
15
17
  info?: string
18
+ markdown?: boolean
16
19
  }
17
20
 
18
21
  export default function Textarea({
@@ -27,7 +30,10 @@ export default function Textarea({
27
30
  required,
28
31
  rows = 4,
29
32
  info,
33
+ markdown = false,
30
34
  }: TextareaProps) {
35
+ const [preview, setPreview] = useState(false)
36
+
31
37
  return (
32
38
  <FieldWrapper
33
39
  label={label}
@@ -37,29 +43,59 @@ export default function Textarea({
37
43
  error={error}
38
44
  className={className}
39
45
  >
40
- <textarea
41
- id={name}
42
- name={name}
43
- placeholder={placeholder}
44
- value={value}
45
- onChange={onChange}
46
- disabled={disabled}
47
- required={required}
48
- rows={rows}
49
- title={label}
50
- aria-invalid={!!error}
51
- aria-describedby={error ? `${name}-error` : undefined}
52
- className={`
53
- w-full rounded-md bg-login-500/50 border border-login-500
54
- text-login-text placeholder-login-200
55
- focus:outline-none focus:border-login focus:ring-1 focus:ring-login
56
- disabled:opacity-50 disabled:cursor-not-allowed
57
- p-3
58
- transition-all duration-200
59
- resize-y
60
- ${error ? 'border-red-500 focus:border-red-500 focus:ring-red-500' : ''}
61
- `}
62
- />
46
+ <div className='relative'>
47
+ {markdown && (
48
+ <div className='absolute right-2 top-2 z-10 flex gap-2'>
49
+ <button
50
+ type='button'
51
+ onClick={() => setPreview(!preview)}
52
+ className='p-1 rounded hover:bg-login-500/50 text-login-text transition-colors'
53
+ title={preview ? 'Edit' : 'Preview'}
54
+ >
55
+ {preview ? <Pencil size={16} /> : <Eye size={16} />}
56
+ </button>
57
+ </div>
58
+ )}
59
+
60
+ {markdown && preview ? (
61
+ <div
62
+ className={`
63
+ w-full rounded-md bg-login-500/50 border border-login-500
64
+ text-login-text
65
+ p-3
66
+ prose prose-invert prose-sm max-w-none overflow-y-auto
67
+ ${error ? 'border-red-500' : ''}
68
+ `}
69
+ style={{ minHeight: `${rows * 1.5}rem` }}
70
+ >
71
+ <ReactMarkdown>{value || ''}</ReactMarkdown>
72
+ </div>
73
+ ) : (
74
+ <textarea
75
+ id={name}
76
+ name={name}
77
+ placeholder={placeholder}
78
+ value={value}
79
+ onChange={onChange}
80
+ disabled={disabled}
81
+ required={required}
82
+ rows={rows}
83
+ title={label}
84
+ aria-invalid={!!error}
85
+ aria-describedby={error ? `${name}-error` : undefined}
86
+ className={`
87
+ w-full rounded-md bg-login-500/50 border border-login-500
88
+ text-login-text placeholder-login-200
89
+ focus:outline-none focus:border-login focus:ring-1 focus:ring-login
90
+ disabled:opacity-50 disabled:cursor-not-allowed
91
+ p-3
92
+ transition-all duration-200
93
+ resize-y
94
+ ${error ? 'border-red-500 focus:border-red-500 focus:ring-red-500' : ''}
95
+ `}
96
+ />
97
+ )}
98
+ </div>
63
99
  </FieldWrapper>
64
100
  )
65
101
  }
@@ -1,9 +1,10 @@
1
1
  import type { Config } from 'tailwindcss'
2
+ import typography from '@tailwindcss/typography'
2
3
 
3
4
  const tailwindConfig: Config = {
4
5
  content: ['./app/**/*.{js,ts,jsx,tsx}', './components/**/*.{js,ts,jsx,tsx}'],
5
6
  theme: { extend: {} },
6
- plugins: [],
7
+ plugins: [typography],
7
8
  }
8
9
 
9
10
  export default tailwindConfig