@lindle/linoardo 1.0.22 → 1.0.24
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/dist/alert.cjs +18 -0
- package/dist/alert.cjs.map +1 -0
- package/dist/alert.d.cts +9 -0
- package/dist/alert.d.ts +9 -0
- package/dist/alert.js +3 -0
- package/dist/alert.js.map +1 -0
- package/dist/app-bar.cjs +168 -0
- package/dist/app-bar.cjs.map +1 -0
- package/dist/app-bar.d.cts +25 -0
- package/dist/app-bar.d.ts +25 -0
- package/dist/app-bar.js +3 -0
- package/dist/app-bar.js.map +1 -0
- package/dist/badge.cjs +205 -0
- package/dist/badge.cjs.map +1 -0
- package/dist/badge.d.cts +71 -0
- package/dist/badge.d.ts +71 -0
- package/dist/badge.js +3 -0
- package/dist/badge.js.map +1 -0
- package/dist/block.cjs +70 -0
- package/dist/block.cjs.map +1 -0
- package/dist/block.d.cts +32 -0
- package/dist/block.d.ts +32 -0
- package/dist/block.js +3 -0
- package/dist/block.js.map +1 -0
- package/dist/chunk-5GT6L4BE.js +48 -0
- package/dist/chunk-5GT6L4BE.js.map +1 -0
- package/dist/chunk-67BAO35I.js +146 -0
- package/dist/chunk-67BAO35I.js.map +1 -0
- package/dist/chunk-6SKW43XI.js +14 -0
- package/dist/chunk-6SKW43XI.js.map +1 -0
- package/dist/chunk-HIRPMCQJ.js +183 -0
- package/dist/chunk-HIRPMCQJ.js.map +1 -0
- package/dist/chunk-KQOR3C7E.js +16 -0
- package/dist/chunk-KQOR3C7E.js.map +1 -0
- package/dist/{chunk-SAGQYMS3.js → chunk-OPMXH6OF.js} +3 -14
- package/dist/chunk-OPMXH6OF.js.map +1 -0
- package/dist/chunk-SCJMH5VE.js +469 -0
- package/dist/chunk-SCJMH5VE.js.map +1 -0
- package/dist/index.cjs +755 -66
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -26
- package/dist/index.d.ts +7 -26
- package/dist/index.js +14 -151
- package/dist/index.js.map +1 -1
- package/dist/select.js +2 -1
- package/dist/styles.css +324 -0
- package/dist/textarea.cjs +486 -0
- package/dist/textarea.cjs.map +1 -0
- package/dist/textarea.d.cts +29 -0
- package/dist/textarea.d.ts +29 -0
- package/dist/textarea.js +4 -0
- package/dist/textarea.js.map +1 -0
- package/package.json +45 -1
- package/readme.md +46 -0
- package/dist/chunk-SAGQYMS3.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var React4 = require('react');
|
|
4
4
|
var tailwindMerge = require('tailwind-merge');
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
var react = require('@tiptap/react');
|
|
7
|
+
var StarterKit = require('@tiptap/starter-kit');
|
|
8
|
+
var marked = require('marked');
|
|
9
|
+
var TurndownService = require('turndown');
|
|
10
|
+
|
|
11
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
6
12
|
|
|
7
13
|
function _interopNamespace(e) {
|
|
8
14
|
if (e && e.__esModule) return e;
|
|
@@ -22,7 +28,9 @@ function _interopNamespace(e) {
|
|
|
22
28
|
return Object.freeze(n);
|
|
23
29
|
}
|
|
24
30
|
|
|
25
|
-
var
|
|
31
|
+
var React4__namespace = /*#__PURE__*/_interopNamespace(React4);
|
|
32
|
+
var StarterKit__default = /*#__PURE__*/_interopDefault(StarterKit);
|
|
33
|
+
var TurndownService__default = /*#__PURE__*/_interopDefault(TurndownService);
|
|
26
34
|
|
|
27
35
|
// src/Containment/Button/index.tsx
|
|
28
36
|
|
|
@@ -168,7 +176,7 @@ var iconOnlyIconSizeClasses = {
|
|
|
168
176
|
large: "text-xl",
|
|
169
177
|
"x-large": "text-2xl"
|
|
170
178
|
};
|
|
171
|
-
var Button =
|
|
179
|
+
var Button = React4__namespace.forwardRef(
|
|
172
180
|
({
|
|
173
181
|
variant = "solid",
|
|
174
182
|
color = "primary",
|
|
@@ -345,7 +353,7 @@ var resolveIconClassName2 = (icon) => {
|
|
|
345
353
|
const normalized = iconName.startsWith("mdi-") ? iconName : `mdi-${iconName}`;
|
|
346
354
|
return Array.from(/* @__PURE__ */ new Set([...baseClasses, normalized])).join(" ");
|
|
347
355
|
};
|
|
348
|
-
var Chip =
|
|
356
|
+
var Chip = React4.forwardRef(
|
|
349
357
|
({
|
|
350
358
|
variant = "solid",
|
|
351
359
|
color = "primary",
|
|
@@ -462,6 +470,188 @@ var Chip = React3.forwardRef(
|
|
|
462
470
|
);
|
|
463
471
|
Chip.displayName = "Chip";
|
|
464
472
|
var Chip_default = Chip;
|
|
473
|
+
|
|
474
|
+
// src/Info/Badge/states.badge.ts
|
|
475
|
+
var placementGeometries = {
|
|
476
|
+
"top-end": {
|
|
477
|
+
overlap: { top: 0, right: 0, translateX: "50%", translateY: "-50%" },
|
|
478
|
+
detached: { top: 0, right: 0, translateX: "50%", translateY: "-100%" }
|
|
479
|
+
},
|
|
480
|
+
"top-start": {
|
|
481
|
+
overlap: { top: 0, left: 0, translateX: "-50%", translateY: "-50%" },
|
|
482
|
+
detached: { top: 0, left: 0, translateX: "-50%", translateY: "-100%" }
|
|
483
|
+
},
|
|
484
|
+
"bottom-end": {
|
|
485
|
+
overlap: { bottom: 0, right: 0, translateX: "50%", translateY: "50%" },
|
|
486
|
+
detached: { bottom: 0, right: 0, translateX: "50%", translateY: "100%" }
|
|
487
|
+
},
|
|
488
|
+
"bottom-start": {
|
|
489
|
+
overlap: { bottom: 0, left: 0, translateX: "-50%", translateY: "50%" },
|
|
490
|
+
detached: { bottom: 0, left: 0, translateX: "-50%", translateY: "100%" }
|
|
491
|
+
},
|
|
492
|
+
center: {
|
|
493
|
+
overlap: { top: "50%", left: "50%", translateX: "-50%", translateY: "-50%" },
|
|
494
|
+
detached: { top: "50%", left: "50%", translateX: "-50%", translateY: "-50%" }
|
|
495
|
+
}
|
|
496
|
+
};
|
|
497
|
+
var badgePaletteClasses = {
|
|
498
|
+
primary: "bg-primary text-white",
|
|
499
|
+
neutral: "bg-gray-500 text-white",
|
|
500
|
+
info: "bg-sky-500 text-white",
|
|
501
|
+
success: "bg-emerald-500 text-white",
|
|
502
|
+
warning: "bg-amber-500 text-white",
|
|
503
|
+
danger: "bg-red-500 text-white",
|
|
504
|
+
surface: "bg-white text-gray-900 border border-gray-200",
|
|
505
|
+
bw: "bg-white text-black border border-black"
|
|
506
|
+
};
|
|
507
|
+
var resolvePlacementGeometry = (placement, overlap) => {
|
|
508
|
+
const group = placementGeometries[placement] ?? placementGeometries["top-end"];
|
|
509
|
+
return overlap ? group.overlap : group.detached;
|
|
510
|
+
};
|
|
511
|
+
var buildTranslateComponent = (base2, delta) => {
|
|
512
|
+
if (!delta) {
|
|
513
|
+
return base2;
|
|
514
|
+
}
|
|
515
|
+
const normalizedBase = base2.endsWith("%") || base2.endsWith("px") ? base2 : `${base2}`;
|
|
516
|
+
const operator = delta >= 0 ? "+" : "-";
|
|
517
|
+
const magnitude = Math.abs(delta);
|
|
518
|
+
return `calc(${normalizedBase} ${operator} ${magnitude}px)`;
|
|
519
|
+
};
|
|
520
|
+
var iconBaseClasses2 = {
|
|
521
|
+
mdi: ["mdi"]
|
|
522
|
+
};
|
|
523
|
+
var resolveIconClassName3 = (icon) => {
|
|
524
|
+
if (!icon) {
|
|
525
|
+
return void 0;
|
|
526
|
+
}
|
|
527
|
+
if (typeof icon === "string") {
|
|
528
|
+
const trimmed = icon.trim();
|
|
529
|
+
if (!trimmed) {
|
|
530
|
+
return void 0;
|
|
531
|
+
}
|
|
532
|
+
if (trimmed.includes(" ")) {
|
|
533
|
+
return trimmed;
|
|
534
|
+
}
|
|
535
|
+
const normalized2 = trimmed.startsWith("mdi-") ? trimmed : `mdi-${trimmed}`;
|
|
536
|
+
return ["mdi", normalized2].join(" ");
|
|
537
|
+
}
|
|
538
|
+
const [library, providedName] = icon;
|
|
539
|
+
const normalizedLibrary = library.trim();
|
|
540
|
+
const base2 = iconBaseClasses2[normalizedLibrary] ?? [normalizedLibrary];
|
|
541
|
+
const iconName = providedName.trim();
|
|
542
|
+
if (!iconName) {
|
|
543
|
+
return base2.join(" ");
|
|
544
|
+
}
|
|
545
|
+
const normalized = iconName.startsWith("mdi-") ? iconName : `mdi-${iconName}`;
|
|
546
|
+
return Array.from(/* @__PURE__ */ new Set([...base2, normalized])).join(" ");
|
|
547
|
+
};
|
|
548
|
+
var Badge = ({
|
|
549
|
+
children,
|
|
550
|
+
content,
|
|
551
|
+
max = 99,
|
|
552
|
+
showZero = false,
|
|
553
|
+
dot = false,
|
|
554
|
+
icon,
|
|
555
|
+
color = "primary",
|
|
556
|
+
placement = "top-end",
|
|
557
|
+
offset,
|
|
558
|
+
overlap = true,
|
|
559
|
+
bordered = false,
|
|
560
|
+
floating = false,
|
|
561
|
+
visible = true,
|
|
562
|
+
badgeClassName,
|
|
563
|
+
inline = true,
|
|
564
|
+
className,
|
|
565
|
+
...rest
|
|
566
|
+
}) => {
|
|
567
|
+
const hasChildren = React4__namespace.Children.count(children) > 0;
|
|
568
|
+
const iconClassName = resolveIconClassName3(icon);
|
|
569
|
+
const isNumberContent = typeof content === "number" && Number.isFinite(content);
|
|
570
|
+
let displayValue = content;
|
|
571
|
+
if (!dot && !iconClassName && isNumberContent) {
|
|
572
|
+
const numericContent = content;
|
|
573
|
+
if (typeof max === "number" && Number.isFinite(max) && numericContent > max) {
|
|
574
|
+
displayValue = `${max}+`;
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
if (!dot && !iconClassName && isNumberContent) {
|
|
578
|
+
const numericContent = content;
|
|
579
|
+
if (!showZero && numericContent === 0) {
|
|
580
|
+
displayValue = void 0;
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
const hasRenderableContent = dot || Boolean(iconClassName) || displayValue !== null && displayValue !== void 0 && displayValue !== "";
|
|
584
|
+
const shouldRenderBadge = visible && hasRenderableContent;
|
|
585
|
+
const paletteClass = badgePaletteClasses[color] ?? badgePaletteClasses.primary;
|
|
586
|
+
const [offsetX = 0, offsetY = 0] = offset ?? [];
|
|
587
|
+
const isPositioned = hasChildren && !floating;
|
|
588
|
+
const placementStyle = (() => {
|
|
589
|
+
if (!isPositioned) {
|
|
590
|
+
if (!offsetX && !offsetY) {
|
|
591
|
+
return void 0;
|
|
592
|
+
}
|
|
593
|
+
return {
|
|
594
|
+
transform: `translate(${offsetX}px, ${offsetY}px)`
|
|
595
|
+
};
|
|
596
|
+
}
|
|
597
|
+
const geometry = resolvePlacementGeometry(placement, overlap);
|
|
598
|
+
const style = {};
|
|
599
|
+
if (geometry.top !== void 0) {
|
|
600
|
+
style.top = geometry.top;
|
|
601
|
+
}
|
|
602
|
+
if (geometry.right !== void 0) {
|
|
603
|
+
style.right = geometry.right;
|
|
604
|
+
}
|
|
605
|
+
if (geometry.bottom !== void 0) {
|
|
606
|
+
style.bottom = geometry.bottom;
|
|
607
|
+
}
|
|
608
|
+
if (geometry.left !== void 0) {
|
|
609
|
+
style.left = geometry.left;
|
|
610
|
+
}
|
|
611
|
+
const translateX = buildTranslateComponent(geometry.translateX, offsetX);
|
|
612
|
+
const translateY = buildTranslateComponent(geometry.translateY, offsetY);
|
|
613
|
+
style.transform = `translate(${translateX}, ${translateY})`;
|
|
614
|
+
return style;
|
|
615
|
+
})();
|
|
616
|
+
const badgeContainerClasses = tailwindMerge.twMerge(
|
|
617
|
+
"pointer-events-none select-none",
|
|
618
|
+
isPositioned ? "absolute" : "relative",
|
|
619
|
+
"flex items-center justify-center whitespace-nowrap",
|
|
620
|
+
dot ? void 0 : "p-0"
|
|
621
|
+
);
|
|
622
|
+
const badgeContentClasses = tailwindMerge.twMerge(
|
|
623
|
+
"inline-flex items-center justify-center whitespace-nowrap rounded-full px-2.5 py-1.5 text-xs font-semibold leading-none min-w-6 min-h-6",
|
|
624
|
+
paletteClass,
|
|
625
|
+
bordered ? "ring-2 ring-white ring-offset-0" : void 0,
|
|
626
|
+
badgeClassName
|
|
627
|
+
);
|
|
628
|
+
const badgeDotClasses = tailwindMerge.twMerge(
|
|
629
|
+
"inline-block h-2 w-2 rounded-full",
|
|
630
|
+
paletteClass,
|
|
631
|
+
bordered ? "ring-2 ring-white ring-offset-0" : void 0,
|
|
632
|
+
badgeClassName
|
|
633
|
+
);
|
|
634
|
+
const rootClasses = tailwindMerge.twMerge(
|
|
635
|
+
"relative",
|
|
636
|
+
inline ? "inline-flex" : "flex",
|
|
637
|
+
hasChildren ? void 0 : "items-center justify-center",
|
|
638
|
+
className
|
|
639
|
+
);
|
|
640
|
+
const resolvedChildren = typeof children === "string" || typeof children === "number" ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "inline-flex items-center justify-center", children }) : children;
|
|
641
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("span", { ...rest, className: rootClasses, children: [
|
|
642
|
+
resolvedChildren,
|
|
643
|
+
shouldRenderBadge && /* @__PURE__ */ jsxRuntime.jsx("span", { className: badgeContainerClasses, style: placementStyle, children: dot ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: badgeDotClasses }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: tailwindMerge.twMerge(badgeContentClasses), children: iconClassName ? /* @__PURE__ */ jsxRuntime.jsx("i", { className: iconClassName, "aria-hidden": true }) : displayValue }) })
|
|
644
|
+
] });
|
|
645
|
+
};
|
|
646
|
+
var Badge_default = Badge;
|
|
647
|
+
var Alert = ({ className, children, ...rest }) => {
|
|
648
|
+
const classBase = "text-center p-4 bg-neutral-200 rounded-md ";
|
|
649
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { ...rest, className: tailwindMerge.twMerge("grid grid-cols-7 bg-neutral-200", className), children: [
|
|
650
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "col-span-1 pt-4 pl-4", children: /* @__PURE__ */ jsxRuntime.jsx("i", { className: "mdi mdi-google text-2xl" }) }),
|
|
651
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: tailwindMerge.twMerge("col-span-6", classBase), children })
|
|
652
|
+
] });
|
|
653
|
+
};
|
|
654
|
+
var Alert_default = Alert;
|
|
465
655
|
var listItemBaseClasses = "relative flex w-full items-center gap-4 bg-transparent text-left text-sm transition-colors duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40 focus-visible:ring-offset-2 focus-visible:ring-offset-white hover:bg-neutral-200";
|
|
466
656
|
var densityClasses = {
|
|
467
657
|
default: "px-4 py-3 text-base",
|
|
@@ -483,7 +673,7 @@ var accentClasses = {
|
|
|
483
673
|
surface: { text: "text-gray-900", bg: "bg-gray-100", indicator: "bg-gray-900" },
|
|
484
674
|
bw: { text: "text-gray-900", bg: "bg-gray-100", indicator: "bg-gray-900" }
|
|
485
675
|
};
|
|
486
|
-
var ListItem =
|
|
676
|
+
var ListItem = React4__namespace.forwardRef((props, ref) => {
|
|
487
677
|
const {
|
|
488
678
|
component,
|
|
489
679
|
href,
|
|
@@ -609,13 +799,13 @@ var listRoundedClasses = {
|
|
|
609
799
|
pill: "rounded-full"
|
|
610
800
|
};
|
|
611
801
|
var isListItemElement = (element) => {
|
|
612
|
-
if (!
|
|
802
|
+
if (!React4__namespace.isValidElement(element)) {
|
|
613
803
|
return false;
|
|
614
804
|
}
|
|
615
805
|
const elementType = element.type;
|
|
616
806
|
return element.type === Item_default || elementType.displayName === Item_default.displayName;
|
|
617
807
|
};
|
|
618
|
-
var List =
|
|
808
|
+
var List = React4__namespace.forwardRef((props, ref) => {
|
|
619
809
|
const {
|
|
620
810
|
variant = "solid",
|
|
621
811
|
density = "default",
|
|
@@ -637,11 +827,11 @@ var List = React3__namespace.forwardRef((props, ref) => {
|
|
|
637
827
|
const navClass = nav ? "py-1" : void 0;
|
|
638
828
|
const accentColor = color;
|
|
639
829
|
const enhanceChild = (child) => {
|
|
640
|
-
if (!
|
|
830
|
+
if (!React4__namespace.isValidElement(child)) {
|
|
641
831
|
return child;
|
|
642
832
|
}
|
|
643
833
|
if (isListItemElement(child)) {
|
|
644
|
-
return
|
|
834
|
+
return React4__namespace.cloneElement(child, {
|
|
645
835
|
density: child.props.density ?? density,
|
|
646
836
|
lines: child.props.lines ?? lines,
|
|
647
837
|
nav: child.props.nav ?? nav,
|
|
@@ -651,17 +841,17 @@ var List = React3__namespace.forwardRef((props, ref) => {
|
|
|
651
841
|
});
|
|
652
842
|
}
|
|
653
843
|
if (child.props && typeof child.props === "object" && "children" in child.props) {
|
|
654
|
-
const nestedChildren =
|
|
844
|
+
const nestedChildren = React4__namespace.Children.map(
|
|
655
845
|
child.props.children,
|
|
656
846
|
enhanceChild
|
|
657
847
|
);
|
|
658
848
|
if (nestedChildren !== child.props.children) {
|
|
659
|
-
return
|
|
849
|
+
return React4__namespace.cloneElement(child, void 0, nestedChildren);
|
|
660
850
|
}
|
|
661
851
|
}
|
|
662
852
|
return child;
|
|
663
853
|
};
|
|
664
|
-
const resolvedChildren =
|
|
854
|
+
const resolvedChildren = React4__namespace.Children.map(children, enhanceChild);
|
|
665
855
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
666
856
|
"div",
|
|
667
857
|
{
|
|
@@ -697,7 +887,7 @@ var offsetClasses = {
|
|
|
697
887
|
};
|
|
698
888
|
var menuBaseClasses = "absolute z-50 min-w-[10rem] rounded-xl border border-gray-200/80 bg-white/95 p-2 text-sm text-gray-700 shadow-lg shadow-gray-900/10 ring-1 ring-black/5 backdrop-blur-md transition-all duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40 focus-visible:ring-offset-2";
|
|
699
889
|
var overlayBaseClasses = "fixed inset-0 z-40 bg-gray-900/30 backdrop-blur-[1px]";
|
|
700
|
-
var Menu =
|
|
890
|
+
var Menu = React4__namespace.forwardRef((props, ref) => {
|
|
701
891
|
const {
|
|
702
892
|
activator,
|
|
703
893
|
children,
|
|
@@ -717,8 +907,8 @@ var Menu = React3__namespace.forwardRef((props, ref) => {
|
|
|
717
907
|
const { onMouseEnter, onMouseLeave, onFocus, onBlur, ...restProps } = rest;
|
|
718
908
|
const hasContent = children !== void 0 && children !== null;
|
|
719
909
|
const isControlled = typeof open === "boolean";
|
|
720
|
-
const [uncontrolledOpen, setUncontrolledOpen] =
|
|
721
|
-
const closeTimer =
|
|
910
|
+
const [uncontrolledOpen, setUncontrolledOpen] = React4__namespace.useState(false);
|
|
911
|
+
const closeTimer = React4__namespace.useRef(null);
|
|
722
912
|
const visible = isControlled ? Boolean(open) : uncontrolledOpen;
|
|
723
913
|
const shouldRenderContent = hasContent && (keepMounted || visible || !isControlled && (openOnHover || openOnFocus));
|
|
724
914
|
const verticalPlacement = placement.startsWith("top") ? "top" : "bottom";
|
|
@@ -743,7 +933,7 @@ var Menu = React3__namespace.forwardRef((props, ref) => {
|
|
|
743
933
|
}, 120);
|
|
744
934
|
}
|
|
745
935
|
};
|
|
746
|
-
|
|
936
|
+
React4__namespace.useEffect(() => {
|
|
747
937
|
return () => clearCloseTimer();
|
|
748
938
|
}, []);
|
|
749
939
|
const visibilityClasses = visible ? "pointer-events-auto opacity-100 scale-100" : "pointer-events-none opacity-0 scale-95";
|
|
@@ -859,7 +1049,7 @@ var traverseNode = (node, value) => {
|
|
|
859
1049
|
if (node === null || node === void 0 || typeof node === "boolean" || typeof node === "string" || typeof node === "number") {
|
|
860
1050
|
return { node, changed: false };
|
|
861
1051
|
}
|
|
862
|
-
if (!
|
|
1052
|
+
if (!React4.isValidElement(node)) {
|
|
863
1053
|
return { node, changed: false };
|
|
864
1054
|
}
|
|
865
1055
|
const element = node;
|
|
@@ -872,7 +1062,7 @@ var traverseNode = (node, value) => {
|
|
|
872
1062
|
return { node, changed: false };
|
|
873
1063
|
}
|
|
874
1064
|
const injectedProps = shouldInject ? { [EXPANSION_PANEL_CONTEXT_PROP]: value } : void 0;
|
|
875
|
-
const cloned = mappedChildren === void 0 ?
|
|
1065
|
+
const cloned = mappedChildren === void 0 ? React4.cloneElement(element, injectedProps) : React4.cloneElement(element, injectedProps, mappedChildren);
|
|
876
1066
|
return { node: cloned, changed: true };
|
|
877
1067
|
};
|
|
878
1068
|
var injectExpansionPanelContext = (children, value) => traverseNode(children, value).node;
|
|
@@ -933,18 +1123,18 @@ var ExpansionPanelItemInner = (props) => {
|
|
|
933
1123
|
__expansionPanelContext,
|
|
934
1124
|
...rest
|
|
935
1125
|
} = props;
|
|
936
|
-
const [standaloneExpanded, setStandaloneExpanded] =
|
|
937
|
-
const generatedValueRef =
|
|
1126
|
+
const [standaloneExpanded, setStandaloneExpanded] = React4.useState(false);
|
|
1127
|
+
const generatedValueRef = React4.useRef(null);
|
|
938
1128
|
if (generatedValueRef.current === null) {
|
|
939
1129
|
generatedValueRef.current = generateId("expansion-panel-value");
|
|
940
1130
|
}
|
|
941
1131
|
const generatedValue = generatedValueRef.current;
|
|
942
|
-
const headerIdRef =
|
|
1132
|
+
const headerIdRef = React4.useRef(null);
|
|
943
1133
|
if (!headerIdRef.current) {
|
|
944
1134
|
headerIdRef.current = generateId("expansion-panel-header");
|
|
945
1135
|
}
|
|
946
1136
|
const headerId = headerIdRef.current;
|
|
947
|
-
const contentIdRef =
|
|
1137
|
+
const contentIdRef = React4.useRef(null);
|
|
948
1138
|
if (!contentIdRef.current) {
|
|
949
1139
|
contentIdRef.current = generateId("expansion-panel-content");
|
|
950
1140
|
}
|
|
@@ -1064,7 +1254,7 @@ var ExpansionPanelItemInner = (props) => {
|
|
|
1064
1254
|
}
|
|
1065
1255
|
);
|
|
1066
1256
|
};
|
|
1067
|
-
var ExpansionPanelItem =
|
|
1257
|
+
var ExpansionPanelItem = React4.forwardRef((props, ref) => /* @__PURE__ */ jsxRuntime.jsx(ExpansionPanelItemInner, { ...props, forwardedRef: ref }));
|
|
1068
1258
|
ExpansionPanelItem.displayName = "ExpansionPanelItem";
|
|
1069
1259
|
markExpansionPanelItem(ExpansionPanelItem);
|
|
1070
1260
|
var ExpansionPanelItem_default = ExpansionPanelItem;
|
|
@@ -1110,12 +1300,12 @@ var ExpansionPanelInner = (props, forwardedRef) => {
|
|
|
1110
1300
|
} = props;
|
|
1111
1301
|
const allowMultiple = multiple ?? false;
|
|
1112
1302
|
const isControlled = value !== void 0;
|
|
1113
|
-
const [internalValues, setInternalValues] =
|
|
1303
|
+
const [internalValues, setInternalValues] = React4.useState(
|
|
1114
1304
|
() => normalizeValues(defaultValue, allowMultiple)
|
|
1115
1305
|
);
|
|
1116
|
-
const prevAllowMultipleRef =
|
|
1117
|
-
const prevIsControlledRef =
|
|
1118
|
-
|
|
1306
|
+
const prevAllowMultipleRef = React4.useRef(allowMultiple);
|
|
1307
|
+
const prevIsControlledRef = React4.useRef(isControlled);
|
|
1308
|
+
React4.useEffect(() => {
|
|
1119
1309
|
const prevAllowMultiple = prevAllowMultipleRef.current;
|
|
1120
1310
|
const wasControlled = prevIsControlledRef.current;
|
|
1121
1311
|
if (!isControlled && (allowMultiple !== prevAllowMultiple || wasControlled !== isControlled)) {
|
|
@@ -1124,7 +1314,7 @@ var ExpansionPanelInner = (props, forwardedRef) => {
|
|
|
1124
1314
|
prevAllowMultipleRef.current = allowMultiple;
|
|
1125
1315
|
prevIsControlledRef.current = isControlled;
|
|
1126
1316
|
}, [allowMultiple, isControlled]);
|
|
1127
|
-
const handleValueChange =
|
|
1317
|
+
const handleValueChange = React4.useCallback(
|
|
1128
1318
|
(next) => {
|
|
1129
1319
|
if (!isControlled) {
|
|
1130
1320
|
setInternalValues(next);
|
|
@@ -1139,7 +1329,7 @@ var ExpansionPanelInner = (props, forwardedRef) => {
|
|
|
1139
1329
|
},
|
|
1140
1330
|
[allowMultiple, isControlled, onChange]
|
|
1141
1331
|
);
|
|
1142
|
-
const handleToggle =
|
|
1332
|
+
const handleToggle = React4.useCallback(
|
|
1143
1333
|
(panelValue, disabled) => {
|
|
1144
1334
|
if (disabled) {
|
|
1145
1335
|
return;
|
|
@@ -1151,11 +1341,11 @@ var ExpansionPanelInner = (props, forwardedRef) => {
|
|
|
1151
1341
|
},
|
|
1152
1342
|
[allowMultiple, handleValueChange, internalValues, isControlled, value]
|
|
1153
1343
|
);
|
|
1154
|
-
const expandedValues =
|
|
1344
|
+
const expandedValues = React4.useMemo(
|
|
1155
1345
|
() => isControlled ? normalizeValues(value, allowMultiple) : internalValues,
|
|
1156
1346
|
[allowMultiple, internalValues, isControlled, value]
|
|
1157
1347
|
);
|
|
1158
|
-
const providerValue =
|
|
1348
|
+
const providerValue = React4.useMemo(
|
|
1159
1349
|
() => ({
|
|
1160
1350
|
expandedValues,
|
|
1161
1351
|
toggle: handleToggle,
|
|
@@ -1187,7 +1377,7 @@ var ExpansionPanelInner = (props, forwardedRef) => {
|
|
|
1187
1377
|
}
|
|
1188
1378
|
);
|
|
1189
1379
|
};
|
|
1190
|
-
var ExpansionPanel =
|
|
1380
|
+
var ExpansionPanel = React4.forwardRef(ExpansionPanelInner);
|
|
1191
1381
|
ExpansionPanel.displayName = "ExpansionPanel";
|
|
1192
1382
|
var ExpansionPanel_default = ExpansionPanel;
|
|
1193
1383
|
var containerBaseClasses = "fixed inset-0 z-[70] flex items-center justify-center p-4 sm:p-8 data-[state=closed]:pointer-events-none";
|
|
@@ -1200,7 +1390,7 @@ var resolveSizeValue = (value) => {
|
|
|
1200
1390
|
}
|
|
1201
1391
|
return typeof value === "number" ? `${value}px` : value;
|
|
1202
1392
|
};
|
|
1203
|
-
var Dialog =
|
|
1393
|
+
var Dialog = React4__namespace.forwardRef((props, forwardedRef) => {
|
|
1204
1394
|
const {
|
|
1205
1395
|
activator,
|
|
1206
1396
|
children,
|
|
@@ -1339,7 +1529,7 @@ var arrowPlacementClasses = {
|
|
|
1339
1529
|
"right-start": "right-full top-4 translate-x-1/2",
|
|
1340
1530
|
"right-end": "right-full bottom-4 translate-x-1/2"
|
|
1341
1531
|
};
|
|
1342
|
-
var ToolTip =
|
|
1532
|
+
var ToolTip = React4__namespace.forwardRef((props, forwardedRef) => {
|
|
1343
1533
|
const {
|
|
1344
1534
|
activator,
|
|
1345
1535
|
children,
|
|
@@ -1444,7 +1634,7 @@ var variantClasses = {
|
|
|
1444
1634
|
rounded: "rounded-3xl border border-gray-200 bg-white shadow-md dark:border-slate-800 dark:bg-slate-900 dark:shadow-black/25",
|
|
1445
1635
|
sharp: "rounded-none border border-gray-200 bg-white shadow-md dark:border-slate-800 dark:bg-slate-900 dark:shadow-black/25"
|
|
1446
1636
|
};
|
|
1447
|
-
var CardRoot =
|
|
1637
|
+
var CardRoot = React4.forwardRef(function Card({
|
|
1448
1638
|
className,
|
|
1449
1639
|
children,
|
|
1450
1640
|
variant = "solid",
|
|
@@ -1545,13 +1735,13 @@ var Card2 = Object.assign(CardRoot, {
|
|
|
1545
1735
|
});
|
|
1546
1736
|
var Card_default = Card2;
|
|
1547
1737
|
function applyDividers(children, dividers) {
|
|
1548
|
-
return
|
|
1549
|
-
if (!
|
|
1738
|
+
return React4.Children.map(children, (child) => {
|
|
1739
|
+
if (!React4.isValidElement(child)) return child;
|
|
1550
1740
|
if (isDividerSection(child)) {
|
|
1551
|
-
return
|
|
1741
|
+
return React4.cloneElement(child, { dividers: child.props.dividers ?? dividers });
|
|
1552
1742
|
}
|
|
1553
1743
|
if (hasNestedChildren(child)) {
|
|
1554
|
-
return
|
|
1744
|
+
return React4.cloneElement(child, {
|
|
1555
1745
|
children: applyDividers(child.props.children, dividers)
|
|
1556
1746
|
});
|
|
1557
1747
|
}
|
|
@@ -1565,6 +1755,45 @@ function hasNestedChildren(element) {
|
|
|
1565
1755
|
const props = element.props;
|
|
1566
1756
|
return "children" in props;
|
|
1567
1757
|
}
|
|
1758
|
+
var blockBase = "block-base relative overflow-hidden text-gray-900 dark:text-slate-100";
|
|
1759
|
+
var blurClasses = {
|
|
1760
|
+
none: "backdrop-blur-none",
|
|
1761
|
+
sm: "backdrop-blur-sm",
|
|
1762
|
+
base: "backdrop-blur",
|
|
1763
|
+
md: "backdrop-blur-md",
|
|
1764
|
+
lg: "backdrop-blur-lg",
|
|
1765
|
+
xl: "backdrop-blur-xl",
|
|
1766
|
+
"2xl": "backdrop-blur-2xl",
|
|
1767
|
+
"3xl": "backdrop-blur-3xl"
|
|
1768
|
+
};
|
|
1769
|
+
var variantClasses2 = {
|
|
1770
|
+
solid: "rounded-xl bg-white/40 backdrop-opacity-5 border border-white/30 dark:bg-slate-900/50 dark:border-white/10",
|
|
1771
|
+
outline: "rounded-xl bg-white/10 backdrop-opacity-5 border border-white/60 dark:bg-slate-900/30 dark:border-white/20",
|
|
1772
|
+
text: "rounded-xl bg-transparent border border-transparent",
|
|
1773
|
+
ghost: "rounded-xl bg-white/20 backdrop-opacity-5 border border-white/20 dark:bg-slate-900/30 dark:border-white/10",
|
|
1774
|
+
filled: "rounded-xl bg-white/60 backdrop-opacity-5 border border-white/40 dark:bg-slate-900/70 dark:border-white/15",
|
|
1775
|
+
underlined: "rounded-xl bg-white/20 backdrop-opacity-5 border-b border-white/40 dark:bg-slate-900/30 dark:border-white/20",
|
|
1776
|
+
rounded: "rounded-3xl bg-white/40 backdrop-opacity-5 border border-white/30 dark:bg-slate-900/50 dark:border-white/10",
|
|
1777
|
+
sharp: "rounded-none bg-white/40 backdrop-opacity-5 border border-white/30 dark:bg-slate-900/50 dark:border-white/10"
|
|
1778
|
+
};
|
|
1779
|
+
var Block = React4__namespace.forwardRef(function Block2({ className, variant = "solid", blur = "sm", interactive = false, children, ...rest }, ref) {
|
|
1780
|
+
const variantClass = variantClasses2[variant] ?? variantClasses2.solid;
|
|
1781
|
+
const blurClass = blurClasses[blur] ?? blurClasses.sm;
|
|
1782
|
+
const interactiveClass = interactive ? "transition-all duration-200 hover:-translate-y-0.5 hover:shadow-xl focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40 focus-visible:ring-offset-2 focus-visible:ring-offset-white dark:focus-visible:ring-offset-slate-900" : void 0;
|
|
1783
|
+
const tabIndexValue = interactive && rest.tabIndex === void 0 ? 0 : rest.tabIndex;
|
|
1784
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1785
|
+
"div",
|
|
1786
|
+
{
|
|
1787
|
+
...rest,
|
|
1788
|
+
ref,
|
|
1789
|
+
tabIndex: tabIndexValue,
|
|
1790
|
+
className: tailwindMerge.twMerge(blockBase, variantClass, blurClass, "p-2", interactiveClass, className),
|
|
1791
|
+
children
|
|
1792
|
+
}
|
|
1793
|
+
);
|
|
1794
|
+
});
|
|
1795
|
+
Block.displayName = "Block";
|
|
1796
|
+
var Block_default = Block;
|
|
1568
1797
|
var masonryBaseClass = "masonry-grid w-full";
|
|
1569
1798
|
var itemBaseClass = "masonry-item block break-inside-avoid";
|
|
1570
1799
|
var MasonryBase = (props, ref) => {
|
|
@@ -1605,10 +1834,10 @@ var MasonryBase = (props, ref) => {
|
|
|
1605
1834
|
const renderedItems = items && items.length ? items.map((item, index) => {
|
|
1606
1835
|
const content = resolveItemContent(item, index, renderItem);
|
|
1607
1836
|
return wrapItem(content, resolveItemKey(item, index, getKey));
|
|
1608
|
-
}) :
|
|
1837
|
+
}) : React4__namespace.Children.map(children, (child, index) => wrapItem(child, resolveChildKey(child, index))) ?? null;
|
|
1609
1838
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { ...rest, ref, role, className: tailwindMerge.twMerge(masonryBaseClass, className), style: layoutStyle, children: renderedItems });
|
|
1610
1839
|
};
|
|
1611
|
-
var Masonry =
|
|
1840
|
+
var Masonry = React4__namespace.forwardRef(MasonryBase);
|
|
1612
1841
|
Masonry.displayName = "Masonry";
|
|
1613
1842
|
var Masonry_default = Masonry;
|
|
1614
1843
|
function toCssLength(value) {
|
|
@@ -1633,13 +1862,13 @@ function resolveColumnCount(column, maxColumn, hasColumnWidth) {
|
|
|
1633
1862
|
}
|
|
1634
1863
|
function resolveItemKey(item, index, getKey) {
|
|
1635
1864
|
if (getKey) return getKey(item, index);
|
|
1636
|
-
if (
|
|
1865
|
+
if (React4__namespace.isValidElement(item) && item.key != null) {
|
|
1637
1866
|
return item.key;
|
|
1638
1867
|
}
|
|
1639
1868
|
return index;
|
|
1640
1869
|
}
|
|
1641
1870
|
function resolveChildKey(child, index) {
|
|
1642
|
-
if (
|
|
1871
|
+
if (React4__namespace.isValidElement(child) && child.key != null) {
|
|
1643
1872
|
return child.key;
|
|
1644
1873
|
}
|
|
1645
1874
|
return index;
|
|
@@ -1681,7 +1910,7 @@ var AppBar = ({
|
|
|
1681
1910
|
children,
|
|
1682
1911
|
...rest
|
|
1683
1912
|
}) => {
|
|
1684
|
-
const [mobileOpen, setMobileOpen] =
|
|
1913
|
+
const [mobileOpen, setMobileOpen] = React4__namespace.useState(false);
|
|
1685
1914
|
const isDark = color === "primary" || color === "dark";
|
|
1686
1915
|
const isTransparent = color === "transparent";
|
|
1687
1916
|
const barClass = tailwindMerge.twMerge(
|
|
@@ -2084,7 +2313,7 @@ ProfileCard.displayName = "ProfileCard";
|
|
|
2084
2313
|
var ProfileCard_default = ProfileCard;
|
|
2085
2314
|
|
|
2086
2315
|
// src/Form/Input/states.input.ts
|
|
2087
|
-
var
|
|
2316
|
+
var resolveIconClassName4 = (icon) => {
|
|
2088
2317
|
if (!icon) {
|
|
2089
2318
|
return void 0;
|
|
2090
2319
|
}
|
|
@@ -2122,13 +2351,13 @@ var Input = ({
|
|
|
2122
2351
|
...props
|
|
2123
2352
|
}) => {
|
|
2124
2353
|
const { placeholder, onFocus, onBlur, ...inputProps } = props;
|
|
2125
|
-
const reactId =
|
|
2354
|
+
const reactId = React4__namespace.default.useId();
|
|
2126
2355
|
const hasLabel = Boolean(label);
|
|
2127
2356
|
const hasProvidedPlaceholder = typeof placeholder === "string" && placeholder.trim().length > 0;
|
|
2128
2357
|
const hidePlaceholderUntilFocus = hasLabel && hasProvidedPlaceholder;
|
|
2129
|
-
const [isFocused, setIsFocused] =
|
|
2358
|
+
const [isFocused, setIsFocused] = React4__namespace.default.useState(false);
|
|
2130
2359
|
const classBase = "input-base focus-visible:outline-none focus-visible:ring-primary transition-colors duration-200 disabled:opacity-50 disabled:cursor-not-allowed w-full text-gray-900 dark:text-gray-100 placeholder:text-gray-500 dark:placeholder:text-gray-400";
|
|
2131
|
-
const
|
|
2360
|
+
const variantClasses5 = {
|
|
2132
2361
|
solid: "rounded border border-gray-400 bg-white shadow-sm focus-visible:border-primary focus-visible:ring-2 focus-visible:ring-primary/30 dark:border-gray-600 dark:bg-slate-900 dark:shadow-black/20 dark:focus-visible:border-primary/70 dark:focus-visible:ring-primary/40",
|
|
2133
2362
|
sharp: "rounded-none border border-gray-400 bg-white shadow-sm focus-visible:border-primary focus-visible:ring-2 focus-visible:ring-primary/30 dark:border-gray-600 dark:bg-slate-900 dark:shadow-black/20 dark:focus-visible:border-primary/70 dark:focus-visible:ring-primary/40",
|
|
2134
2363
|
outline: "rounded border-2 border-black bg-white focus-visible:border-black focus-visible:ring-2 focus-visible:ring-black/30 dark:border-black dark:bg-transparent dark:focus-visible:border-black dark:focus-visible:ring-black/40",
|
|
@@ -2164,9 +2393,9 @@ var Input = ({
|
|
|
2164
2393
|
warn: "text-amber-600 dark:text-amber-300",
|
|
2165
2394
|
success: "text-emerald-600 dark:text-emerald-300"
|
|
2166
2395
|
};
|
|
2167
|
-
const variantClass =
|
|
2396
|
+
const variantClass = variantClasses5[variant] ?? variantClasses5.outline;
|
|
2168
2397
|
const toneClass = status ? statusClasses[status.tone] : void 0;
|
|
2169
|
-
let prependIconClass =
|
|
2398
|
+
let prependIconClass = resolveIconClassName4(icon);
|
|
2170
2399
|
const sizeConfig = sizeClasses4[size] ?? sizeClasses4.medium;
|
|
2171
2400
|
const sizeClass = [
|
|
2172
2401
|
prependIconClass ? sizeConfig.paddingWithIcon : sizeConfig.paddingNoIcon,
|
|
@@ -2253,8 +2482,464 @@ function generateString(length = 5) {
|
|
|
2253
2482
|
}
|
|
2254
2483
|
return result;
|
|
2255
2484
|
}
|
|
2256
|
-
var baseClass = "
|
|
2257
|
-
var
|
|
2485
|
+
var baseClass = "textarea-base px-3 py-2 focus-visible:outline-none transition-colors duration-200 disabled:opacity-50 disabled:cursor-not-allowed w-full text-gray-900 dark:text-gray-100 placeholder:text-gray-500 dark:placeholder:text-gray-400";
|
|
2486
|
+
var variantClasses3 = {
|
|
2487
|
+
outlined: "rounded border-2 border-black bg-white focus-visible:border-black focus-visible:ring-2 focus-visible:ring-black/30 dark:border-black dark:bg-slate-900 dark:focus-visible:border-black dark:focus-visible:ring-black/40",
|
|
2488
|
+
filled: "rounded border border-gray-200 bg-gray-100 focus-visible:border-primary focus-visible:ring-2 focus-visible:ring-primary/25 dark:border-gray-700 dark:bg-slate-800 dark:focus-visible:border-primary/60 dark:focus-visible:ring-primary/30",
|
|
2489
|
+
standard: "rounded-none border-0 border-b border-gray-300 px-0 bg-transparent focus-visible:border-primary focus-visible:ring-0 dark:border-b-gray-700 dark:focus-visible:border-primary/70"
|
|
2490
|
+
};
|
|
2491
|
+
var labelBackground = {
|
|
2492
|
+
outlined: "bg-white/90 dark:bg-slate-900",
|
|
2493
|
+
filled: "bg-gray-100 dark:bg-slate-800",
|
|
2494
|
+
standard: "bg-transparent"
|
|
2495
|
+
};
|
|
2496
|
+
var advancedContainerVariant = {
|
|
2497
|
+
outlined: "rounded border-2 border-black bg-white dark:border-black dark:bg-slate-900",
|
|
2498
|
+
filled: "rounded border border-gray-200 bg-gray-100 dark:border-gray-700 dark:bg-slate-800",
|
|
2499
|
+
standard: "border-b border-gray-300 bg-transparent dark:border-gray-700"
|
|
2500
|
+
};
|
|
2501
|
+
var renderMarkdown = (value) => marked.marked.parse(value || "", { async: false });
|
|
2502
|
+
var dispatchInputEvent = (element) => {
|
|
2503
|
+
const event = new Event("input", { bubbles: true });
|
|
2504
|
+
element.dispatchEvent(event);
|
|
2505
|
+
};
|
|
2506
|
+
var toolbarButtonBase = "px-3 py-1 text-gray-700 transition-colors hover:bg-gray-100 dark:text-gray-200 dark:hover:bg-slate-700 disabled:cursor-not-allowed disabled:opacity-50";
|
|
2507
|
+
var toolbarButtonActive = "bg-white text-gray-900 dark:bg-slate-900 dark:text-gray-100";
|
|
2508
|
+
var handleModeToggle = (wrapperId, mode, textareaName, simpleId, advancedInputId) => {
|
|
2509
|
+
if (typeof document === "undefined") return;
|
|
2510
|
+
const wrapper = document.getElementById(wrapperId);
|
|
2511
|
+
const simple = document.getElementById(simpleId);
|
|
2512
|
+
const advancedInput = document.getElementById(advancedInputId);
|
|
2513
|
+
if (wrapper) {
|
|
2514
|
+
wrapper.dataset.mode = mode;
|
|
2515
|
+
}
|
|
2516
|
+
if (simple) {
|
|
2517
|
+
simple.classList.toggle("hidden", mode !== "simple");
|
|
2518
|
+
simple.name = mode === "simple" ? textareaName : "";
|
|
2519
|
+
}
|
|
2520
|
+
if (advancedInput) {
|
|
2521
|
+
advancedInput.classList.toggle("hidden", mode !== "advanced");
|
|
2522
|
+
advancedInput.name = mode === "advanced" ? textareaName : "";
|
|
2523
|
+
}
|
|
2524
|
+
};
|
|
2525
|
+
var TextArea = ({
|
|
2526
|
+
variant = "outlined",
|
|
2527
|
+
label,
|
|
2528
|
+
className,
|
|
2529
|
+
wrapperClassName,
|
|
2530
|
+
id,
|
|
2531
|
+
name,
|
|
2532
|
+
placeholder,
|
|
2533
|
+
rows = 4,
|
|
2534
|
+
allowModeSwitch = true,
|
|
2535
|
+
mode,
|
|
2536
|
+
view = "editor",
|
|
2537
|
+
value,
|
|
2538
|
+
defaultValue,
|
|
2539
|
+
disabled,
|
|
2540
|
+
readOnly,
|
|
2541
|
+
onChange,
|
|
2542
|
+
onInput,
|
|
2543
|
+
...props
|
|
2544
|
+
}) => {
|
|
2545
|
+
const textareaId = id || name || generateString();
|
|
2546
|
+
const textareaName = name || textareaId;
|
|
2547
|
+
const wrapperId = `${textareaId}-wrapper`;
|
|
2548
|
+
const simpleTextareaId = `${textareaId}-simple`;
|
|
2549
|
+
const advancedInputId = `${textareaId}-advanced-input`;
|
|
2550
|
+
const advancedEditorId = `${textareaId}-advanced-editor`;
|
|
2551
|
+
const advancedLabelId = `${textareaId}-advanced-label`;
|
|
2552
|
+
const previewId = `${textareaId}-preview`;
|
|
2553
|
+
const variantClass = variantClasses3[variant] ?? variantClasses3.outlined;
|
|
2554
|
+
const labelPadding = label ? "pt-6" : void 0;
|
|
2555
|
+
const placeholderValue = placeholder ?? (label ? " " : void 0);
|
|
2556
|
+
const placeholderClass = label ? "placeholder-transparent" : void 0;
|
|
2557
|
+
const labelBg = labelBackground[variant] ?? labelBackground.outlined;
|
|
2558
|
+
const focusLabelBg = variant === "filled" ? "peer-focus:bg-gray-100 dark:peer-focus:bg-slate-800" : variant === "standard" ? "peer-focus:bg-transparent" : "peer-focus:bg-white/90 dark:peer-focus:bg-slate-900";
|
|
2559
|
+
const resolvedMode = allowModeSwitch ? mode ?? "simple" : "simple";
|
|
2560
|
+
const resolvedView = view ?? "editor";
|
|
2561
|
+
const showEditor = resolvedView === "editor";
|
|
2562
|
+
const showPreview = resolvedView === "view";
|
|
2563
|
+
const contentValue = typeof value === "string" ? value : typeof defaultValue === "string" ? defaultValue : "";
|
|
2564
|
+
const isControlled = typeof value === "string";
|
|
2565
|
+
const editorEditable = !(disabled || readOnly);
|
|
2566
|
+
const modeToggleName = `${textareaId}-mode-toggle`;
|
|
2567
|
+
const simpleToggleId = `${modeToggleName}-simple`;
|
|
2568
|
+
const advancedToggleId = `${modeToggleName}-advanced`;
|
|
2569
|
+
const turndownService = React4__namespace.default.useMemo(() => {
|
|
2570
|
+
const service = new TurndownService__default.default({
|
|
2571
|
+
codeBlockStyle: "fenced",
|
|
2572
|
+
emDelimiter: "*",
|
|
2573
|
+
strongDelimiter: "**",
|
|
2574
|
+
bulletListMarker: "-"
|
|
2575
|
+
});
|
|
2576
|
+
service.addRule("strikethrough", {
|
|
2577
|
+
filter: (node) => ["DEL", "S", "STRIKE"].includes(node.nodeName),
|
|
2578
|
+
replacement: (content) => `~~${content}~~`
|
|
2579
|
+
});
|
|
2580
|
+
return service;
|
|
2581
|
+
}, []);
|
|
2582
|
+
const hiddenTextareaRef = React4__namespace.default.useRef(null);
|
|
2583
|
+
const lastMarkdownRef = React4__namespace.default.useRef(contentValue);
|
|
2584
|
+
const editorContentClass = tailwindMerge.twMerge(
|
|
2585
|
+
baseClass,
|
|
2586
|
+
"min-h-45 rounded border-0 bg-transparent outline-none whitespace-pre-wrap wrap-break-words",
|
|
2587
|
+
"[&_p]:m-0 [&_p]:leading-6",
|
|
2588
|
+
"[&_ul]:my-0 [&_ul]:list-disc [&_ul]:pl-5",
|
|
2589
|
+
"[&_ol]:my-0 [&_ol]:list-decimal [&_ol]:pl-5",
|
|
2590
|
+
"[&_li]:my-0",
|
|
2591
|
+
"[&_blockquote]:border-l-2 [&_blockquote]:border-gray-300 [&_blockquote]:pl-3 [&_blockquote]:text-gray-600",
|
|
2592
|
+
"dark:[&_blockquote]:border-gray-600 dark:[&_blockquote]:text-gray-300",
|
|
2593
|
+
"[&_pre]:bg-gray-100 [&_pre]:rounded [&_pre]:p-3 [&_pre]:text-sm [&_pre]:overflow-x-auto",
|
|
2594
|
+
"dark:[&_pre]:bg-slate-800",
|
|
2595
|
+
"[&_code]:font-mono",
|
|
2596
|
+
className,
|
|
2597
|
+
!editorEditable ? "cursor-not-allowed opacity-50" : void 0
|
|
2598
|
+
);
|
|
2599
|
+
const editor = react.useEditor({
|
|
2600
|
+
extensions: [StarterKit__default.default],
|
|
2601
|
+
content: renderMarkdown(contentValue),
|
|
2602
|
+
editable: editorEditable,
|
|
2603
|
+
editorProps: {
|
|
2604
|
+
attributes: {
|
|
2605
|
+
class: editorContentClass,
|
|
2606
|
+
role: "textbox",
|
|
2607
|
+
"aria-multiline": "true",
|
|
2608
|
+
...label ? { "aria-labelledby": advancedLabelId } : {}
|
|
2609
|
+
}
|
|
2610
|
+
},
|
|
2611
|
+
onUpdate: ({ editor: currentEditor }) => {
|
|
2612
|
+
const markdown = turndownService.turndown(currentEditor.getHTML());
|
|
2613
|
+
if (markdown === lastMarkdownRef.current) return;
|
|
2614
|
+
lastMarkdownRef.current = markdown;
|
|
2615
|
+
if (!hiddenTextareaRef.current) return;
|
|
2616
|
+
hiddenTextareaRef.current.value = markdown;
|
|
2617
|
+
dispatchInputEvent(hiddenTextareaRef.current);
|
|
2618
|
+
}
|
|
2619
|
+
});
|
|
2620
|
+
React4__namespace.default.useEffect(() => {
|
|
2621
|
+
if (!editor) return;
|
|
2622
|
+
editor.setEditable(editorEditable);
|
|
2623
|
+
}, [editor, editorEditable]);
|
|
2624
|
+
React4__namespace.default.useEffect(() => {
|
|
2625
|
+
if (!editor) return;
|
|
2626
|
+
editor.setOptions({
|
|
2627
|
+
editorProps: {
|
|
2628
|
+
...editor.options.editorProps,
|
|
2629
|
+
attributes: {
|
|
2630
|
+
...editor.options.editorProps?.attributes,
|
|
2631
|
+
class: editorContentClass,
|
|
2632
|
+
role: "textbox",
|
|
2633
|
+
"aria-multiline": "true",
|
|
2634
|
+
...label ? { "aria-labelledby": advancedLabelId } : {}
|
|
2635
|
+
}
|
|
2636
|
+
}
|
|
2637
|
+
});
|
|
2638
|
+
}, [editor, editorContentClass, label, advancedLabelId]);
|
|
2639
|
+
React4__namespace.default.useEffect(() => {
|
|
2640
|
+
if (!editor || typeof value !== "string") return;
|
|
2641
|
+
if (value === lastMarkdownRef.current) return;
|
|
2642
|
+
editor.commands.setContent(renderMarkdown(value), { emitUpdate: false });
|
|
2643
|
+
lastMarkdownRef.current = value;
|
|
2644
|
+
if (hiddenTextareaRef.current) {
|
|
2645
|
+
hiddenTextareaRef.current.value = value;
|
|
2646
|
+
}
|
|
2647
|
+
}, [editor, value]);
|
|
2648
|
+
React4__namespace.default.useEffect(() => {
|
|
2649
|
+
if (!hiddenTextareaRef.current) return;
|
|
2650
|
+
if (hiddenTextareaRef.current.value === contentValue) return;
|
|
2651
|
+
hiddenTextareaRef.current.value = contentValue;
|
|
2652
|
+
}, [contentValue]);
|
|
2653
|
+
const textareaProps = {
|
|
2654
|
+
...props,
|
|
2655
|
+
onChange,
|
|
2656
|
+
onInput,
|
|
2657
|
+
disabled,
|
|
2658
|
+
readOnly
|
|
2659
|
+
};
|
|
2660
|
+
const minHeightStyle = rows ? { minHeight: `${rows * 20}px` } : void 0;
|
|
2661
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2662
|
+
"div",
|
|
2663
|
+
{
|
|
2664
|
+
id: wrapperId,
|
|
2665
|
+
"data-mode": resolvedMode,
|
|
2666
|
+
className: tailwindMerge.twMerge("flex flex-col gap-1", wrapperClassName),
|
|
2667
|
+
children: [
|
|
2668
|
+
allowModeSwitch && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2669
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2670
|
+
"input",
|
|
2671
|
+
{
|
|
2672
|
+
type: "radio",
|
|
2673
|
+
name: modeToggleName,
|
|
2674
|
+
id: simpleToggleId,
|
|
2675
|
+
value: "simple",
|
|
2676
|
+
defaultChecked: resolvedMode === "simple",
|
|
2677
|
+
className: "peer/simple sr-only",
|
|
2678
|
+
onChange: () => handleModeToggle(wrapperId, "simple", textareaName, simpleTextareaId, advancedInputId)
|
|
2679
|
+
}
|
|
2680
|
+
),
|
|
2681
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2682
|
+
"input",
|
|
2683
|
+
{
|
|
2684
|
+
type: "radio",
|
|
2685
|
+
name: modeToggleName,
|
|
2686
|
+
id: advancedToggleId,
|
|
2687
|
+
value: "advanced",
|
|
2688
|
+
defaultChecked: resolvedMode === "advanced",
|
|
2689
|
+
className: "peer/advanced sr-only",
|
|
2690
|
+
onChange: () => handleModeToggle(
|
|
2691
|
+
wrapperId,
|
|
2692
|
+
"advanced",
|
|
2693
|
+
textareaName,
|
|
2694
|
+
simpleTextareaId,
|
|
2695
|
+
advancedInputId
|
|
2696
|
+
)
|
|
2697
|
+
}
|
|
2698
|
+
),
|
|
2699
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "inline-flex overflow-hidden rounded-md border border-gray-200 bg-gray-50 text-xs font-medium dark:border-gray-700 dark:bg-slate-800", children: [
|
|
2700
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2701
|
+
"label",
|
|
2702
|
+
{
|
|
2703
|
+
htmlFor: simpleToggleId,
|
|
2704
|
+
className: tailwindMerge.twMerge(
|
|
2705
|
+
"cursor-pointer px-3 py-1 transition-colors",
|
|
2706
|
+
"text-gray-600 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-slate-700",
|
|
2707
|
+
"peer-checked/simple:bg-white peer-checked/simple:text-gray-900 peer-checked/simple:dark:bg-slate-900 peer-checked/simple:dark:text-gray-100"
|
|
2708
|
+
),
|
|
2709
|
+
children: "Jednoduch\xFD"
|
|
2710
|
+
}
|
|
2711
|
+
),
|
|
2712
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2713
|
+
"label",
|
|
2714
|
+
{
|
|
2715
|
+
htmlFor: advancedToggleId,
|
|
2716
|
+
className: tailwindMerge.twMerge(
|
|
2717
|
+
"cursor-pointer px-3 py-1 transition-colors",
|
|
2718
|
+
"text-gray-600 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-slate-700",
|
|
2719
|
+
"peer-checked/advanced:bg-white peer-checked/advanced:text-gray-900 peer-checked/advanced:dark:bg-slate-900 peer-checked/advanced:dark:text-gray-100"
|
|
2720
|
+
),
|
|
2721
|
+
children: "Pokro\u010Dil\xFD"
|
|
2722
|
+
}
|
|
2723
|
+
)
|
|
2724
|
+
] }) })
|
|
2725
|
+
] }),
|
|
2726
|
+
(resolvedMode === "simple" || allowModeSwitch) && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2727
|
+
"div",
|
|
2728
|
+
{
|
|
2729
|
+
className: tailwindMerge.twMerge(
|
|
2730
|
+
"relative flex items-start",
|
|
2731
|
+
allowModeSwitch ? "hidden peer-checked/simple:flex peer-checked/advanced:hidden" : void 0
|
|
2732
|
+
),
|
|
2733
|
+
children: [
|
|
2734
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2735
|
+
"textarea",
|
|
2736
|
+
{
|
|
2737
|
+
...textareaProps,
|
|
2738
|
+
id: simpleTextareaId,
|
|
2739
|
+
name: !allowModeSwitch || resolvedMode === "simple" ? textareaName : "",
|
|
2740
|
+
rows,
|
|
2741
|
+
placeholder: placeholderValue,
|
|
2742
|
+
value,
|
|
2743
|
+
defaultValue,
|
|
2744
|
+
className: tailwindMerge.twMerge(
|
|
2745
|
+
"peer",
|
|
2746
|
+
baseClass,
|
|
2747
|
+
variantClass,
|
|
2748
|
+
labelPadding,
|
|
2749
|
+
placeholderClass,
|
|
2750
|
+
className
|
|
2751
|
+
)
|
|
2752
|
+
}
|
|
2753
|
+
),
|
|
2754
|
+
label && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2755
|
+
"label",
|
|
2756
|
+
{
|
|
2757
|
+
htmlFor: simpleTextareaId,
|
|
2758
|
+
className: tailwindMerge.twMerge(
|
|
2759
|
+
"absolute transition-all duration-150 pointer-events-none left-3 text-gray-700 dark:text-gray-200",
|
|
2760
|
+
"top-0 -translate-y-2/3 text-xs px-1",
|
|
2761
|
+
labelBg,
|
|
2762
|
+
focusLabelBg,
|
|
2763
|
+
"peer-focus:top-0 peer-focus:-translate-y-1/2 peer-focus:text-xs peer-focus:px-1 peer-focus:text-gray-600 dark:peer-focus:text-gray-300",
|
|
2764
|
+
"peer-placeholder-shown:top-3 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:text-sm peer-placeholder-shown:bg-transparent peer-placeholder-shown:text-gray-500 dark:peer-placeholder-shown:text-gray-400"
|
|
2765
|
+
),
|
|
2766
|
+
children: label
|
|
2767
|
+
}
|
|
2768
|
+
)
|
|
2769
|
+
]
|
|
2770
|
+
}
|
|
2771
|
+
),
|
|
2772
|
+
(resolvedMode === "advanced" || allowModeSwitch) && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2773
|
+
"div",
|
|
2774
|
+
{
|
|
2775
|
+
className: tailwindMerge.twMerge(
|
|
2776
|
+
"flex flex-col gap-2",
|
|
2777
|
+
allowModeSwitch ? "hidden peer-checked/advanced:flex peer-checked/simple:hidden" : void 0
|
|
2778
|
+
),
|
|
2779
|
+
children: [
|
|
2780
|
+
label && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2781
|
+
"label",
|
|
2782
|
+
{
|
|
2783
|
+
id: advancedLabelId,
|
|
2784
|
+
className: "text-sm font-medium text-gray-700 dark:text-gray-200",
|
|
2785
|
+
children: label
|
|
2786
|
+
}
|
|
2787
|
+
),
|
|
2788
|
+
showEditor && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap items-center justify-between gap-2", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "inline-flex overflow-hidden rounded-md border border-gray-200 bg-gray-50 text-xs font-medium dark:border-gray-700 dark:bg-slate-800", children: [
|
|
2789
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2790
|
+
"button",
|
|
2791
|
+
{
|
|
2792
|
+
type: "button",
|
|
2793
|
+
className: tailwindMerge.twMerge(
|
|
2794
|
+
toolbarButtonBase,
|
|
2795
|
+
editor?.isActive("bold") ? toolbarButtonActive : void 0
|
|
2796
|
+
),
|
|
2797
|
+
onClick: () => editor?.chain().focus().toggleBold().run(),
|
|
2798
|
+
disabled: !editor || !editorEditable,
|
|
2799
|
+
children: "B"
|
|
2800
|
+
}
|
|
2801
|
+
),
|
|
2802
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2803
|
+
"button",
|
|
2804
|
+
{
|
|
2805
|
+
type: "button",
|
|
2806
|
+
className: tailwindMerge.twMerge(
|
|
2807
|
+
toolbarButtonBase,
|
|
2808
|
+
editor?.isActive("italic") ? toolbarButtonActive : void 0
|
|
2809
|
+
),
|
|
2810
|
+
onClick: () => editor?.chain().focus().toggleItalic().run(),
|
|
2811
|
+
disabled: !editor || !editorEditable,
|
|
2812
|
+
children: "I"
|
|
2813
|
+
}
|
|
2814
|
+
),
|
|
2815
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2816
|
+
"button",
|
|
2817
|
+
{
|
|
2818
|
+
type: "button",
|
|
2819
|
+
className: tailwindMerge.twMerge(
|
|
2820
|
+
toolbarButtonBase,
|
|
2821
|
+
editor?.isActive("strike") ? toolbarButtonActive : void 0
|
|
2822
|
+
),
|
|
2823
|
+
onClick: () => editor?.chain().focus().toggleStrike().run(),
|
|
2824
|
+
disabled: !editor || !editorEditable,
|
|
2825
|
+
children: "S"
|
|
2826
|
+
}
|
|
2827
|
+
),
|
|
2828
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2829
|
+
"button",
|
|
2830
|
+
{
|
|
2831
|
+
type: "button",
|
|
2832
|
+
className: tailwindMerge.twMerge(
|
|
2833
|
+
toolbarButtonBase,
|
|
2834
|
+
editor?.isActive("bulletList") ? toolbarButtonActive : void 0
|
|
2835
|
+
),
|
|
2836
|
+
onClick: () => editor?.chain().focus().toggleBulletList().run(),
|
|
2837
|
+
disabled: !editor || !editorEditable,
|
|
2838
|
+
children: "\u2022 List"
|
|
2839
|
+
}
|
|
2840
|
+
),
|
|
2841
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2842
|
+
"button",
|
|
2843
|
+
{
|
|
2844
|
+
type: "button",
|
|
2845
|
+
className: tailwindMerge.twMerge(
|
|
2846
|
+
toolbarButtonBase,
|
|
2847
|
+
editor?.isActive("orderedList") ? toolbarButtonActive : void 0
|
|
2848
|
+
),
|
|
2849
|
+
onClick: () => editor?.chain().focus().toggleOrderedList().run(),
|
|
2850
|
+
disabled: !editor || !editorEditable,
|
|
2851
|
+
children: "1. List"
|
|
2852
|
+
}
|
|
2853
|
+
),
|
|
2854
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2855
|
+
"button",
|
|
2856
|
+
{
|
|
2857
|
+
type: "button",
|
|
2858
|
+
className: tailwindMerge.twMerge(
|
|
2859
|
+
toolbarButtonBase,
|
|
2860
|
+
editor?.isActive("blockquote") ? toolbarButtonActive : void 0
|
|
2861
|
+
),
|
|
2862
|
+
onClick: () => editor?.chain().focus().toggleBlockquote().run(),
|
|
2863
|
+
disabled: !editor || !editorEditable,
|
|
2864
|
+
children: "Quote"
|
|
2865
|
+
}
|
|
2866
|
+
),
|
|
2867
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2868
|
+
"button",
|
|
2869
|
+
{
|
|
2870
|
+
type: "button",
|
|
2871
|
+
className: tailwindMerge.twMerge(
|
|
2872
|
+
toolbarButtonBase,
|
|
2873
|
+
editor?.isActive("code") ? toolbarButtonActive : void 0
|
|
2874
|
+
),
|
|
2875
|
+
onClick: () => editor?.chain().focus().toggleCode().run(),
|
|
2876
|
+
disabled: !editor || !editorEditable,
|
|
2877
|
+
children: "Code"
|
|
2878
|
+
}
|
|
2879
|
+
),
|
|
2880
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2881
|
+
"button",
|
|
2882
|
+
{
|
|
2883
|
+
type: "button",
|
|
2884
|
+
className: tailwindMerge.twMerge(
|
|
2885
|
+
toolbarButtonBase,
|
|
2886
|
+
editor?.isActive("codeBlock") ? toolbarButtonActive : void 0
|
|
2887
|
+
),
|
|
2888
|
+
onClick: () => editor?.chain().focus().toggleCodeBlock().run(),
|
|
2889
|
+
disabled: !editor || !editorEditable,
|
|
2890
|
+
children: "Code block"
|
|
2891
|
+
}
|
|
2892
|
+
)
|
|
2893
|
+
] }) }),
|
|
2894
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: tailwindMerge.twMerge("overflow-hidden", advancedContainerVariant[variant]), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-3 py-3 space-y-3", children: [
|
|
2895
|
+
showEditor && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2896
|
+
react.EditorContent,
|
|
2897
|
+
{
|
|
2898
|
+
editor,
|
|
2899
|
+
id: advancedEditorId,
|
|
2900
|
+
className: "w-full",
|
|
2901
|
+
style: minHeightStyle
|
|
2902
|
+
}
|
|
2903
|
+
),
|
|
2904
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2905
|
+
"textarea",
|
|
2906
|
+
{
|
|
2907
|
+
...textareaProps,
|
|
2908
|
+
ref: hiddenTextareaRef,
|
|
2909
|
+
id: advancedInputId,
|
|
2910
|
+
name: !allowModeSwitch || resolvedMode === "advanced" ? textareaName : "",
|
|
2911
|
+
rows,
|
|
2912
|
+
placeholder: placeholderValue,
|
|
2913
|
+
className: "sr-only",
|
|
2914
|
+
...isControlled ? { value } : { defaultValue: contentValue }
|
|
2915
|
+
}
|
|
2916
|
+
),
|
|
2917
|
+
showPreview && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2918
|
+
"div",
|
|
2919
|
+
{
|
|
2920
|
+
id: previewId,
|
|
2921
|
+
className: tailwindMerge.twMerge(
|
|
2922
|
+
baseClass,
|
|
2923
|
+
"min-h-45 rounded border-0 px-0 focus:outline-none whitespace-pre-wrap wrap-break-words",
|
|
2924
|
+
className
|
|
2925
|
+
),
|
|
2926
|
+
style: minHeightStyle,
|
|
2927
|
+
dangerouslySetInnerHTML: {
|
|
2928
|
+
__html: renderMarkdown(contentValue)
|
|
2929
|
+
}
|
|
2930
|
+
}
|
|
2931
|
+
)
|
|
2932
|
+
] }) })
|
|
2933
|
+
]
|
|
2934
|
+
}
|
|
2935
|
+
)
|
|
2936
|
+
]
|
|
2937
|
+
}
|
|
2938
|
+
);
|
|
2939
|
+
};
|
|
2940
|
+
var TextArea_default = TextArea;
|
|
2941
|
+
var baseClass2 = "select-base w-full appearance-none focus-visible:outline-none focus-visible:ring-primary transition-colors duration-200 disabled:opacity-50 disabled:cursor-not-allowed bg-white text-gray-900 placeholder:text-gray-500 dark:bg-slate-900 dark:text-gray-100 dark:placeholder:text-gray-400";
|
|
2942
|
+
var variantClasses4 = {
|
|
2258
2943
|
solid: "rounded border border-gray-400 bg-white shadow-sm focus-visible:border-primary focus-visible:ring-2 focus-visible:ring-primary/30 dark:border-gray-600 dark:bg-slate-900 dark:shadow-black/20 dark:focus-visible:border-primary/70 dark:focus-visible:ring-primary/40",
|
|
2259
2944
|
sharp: "rounded-none border border-gray-400 bg-white shadow-sm focus-visible:border-primary focus-visible:ring-2 focus-visible:ring-primary/30 dark:border-gray-600 dark:bg-slate-900 dark:shadow-black/20 dark:focus-visible:border-primary/70 dark:focus-visible:ring-primary/40",
|
|
2260
2945
|
outline: "rounded border-2 border-black bg-white focus-visible:border-black focus-visible:ring-2 focus-visible:ring-black/30 dark:border-black dark:bg-transparent dark:focus-visible:border-black dark:focus-visible:ring-black/40",
|
|
@@ -2297,7 +2982,7 @@ var Select = ({
|
|
|
2297
2982
|
}) => {
|
|
2298
2983
|
const selectId = id || name || generateString();
|
|
2299
2984
|
const selectName = name || selectId;
|
|
2300
|
-
const variantClass =
|
|
2985
|
+
const variantClass = variantClasses4[variant] ?? variantClasses4.outline;
|
|
2301
2986
|
const sizeConfig = sizeClasses2[size] ?? sizeClasses2.medium;
|
|
2302
2987
|
const sizeClass = `${sizeConfig.padding} ${sizeConfig.text}`;
|
|
2303
2988
|
const normalizedOptions = options.map(normalizeOption);
|
|
@@ -2305,8 +2990,8 @@ var Select = ({
|
|
|
2305
2990
|
const hasProvidedPlaceholder = typeof placeholder === "string" && placeholder.trim().length > 0;
|
|
2306
2991
|
const hidePlaceholderUntilFocus = hasLabel && hasProvidedPlaceholder && !multiple;
|
|
2307
2992
|
const placeholderText = placeholder ?? (hasLabel ? " " : void 0);
|
|
2308
|
-
const [isFocused, setIsFocused] =
|
|
2309
|
-
const [hasValue, setHasValue] =
|
|
2993
|
+
const [isFocused, setIsFocused] = React4__namespace.default.useState(false);
|
|
2994
|
+
const [hasValue, setHasValue] = React4__namespace.default.useState(() => {
|
|
2310
2995
|
const initial = value ?? defaultValue;
|
|
2311
2996
|
if (initial === void 0 || initial === null) return false;
|
|
2312
2997
|
if (multiple) {
|
|
@@ -2320,7 +3005,7 @@ var Select = ({
|
|
|
2320
3005
|
return String(initial).length > 0;
|
|
2321
3006
|
});
|
|
2322
3007
|
const isControlled = value !== void 0;
|
|
2323
|
-
|
|
3008
|
+
React4__namespace.default.useEffect(() => {
|
|
2324
3009
|
if (!isControlled) return;
|
|
2325
3010
|
if (value === void 0 || value === null) {
|
|
2326
3011
|
setHasValue(false);
|
|
@@ -2373,7 +3058,7 @@ var Select = ({
|
|
|
2373
3058
|
onFocus: handleFocus,
|
|
2374
3059
|
onBlur: handleBlur,
|
|
2375
3060
|
onChange: handleChange,
|
|
2376
|
-
className: tailwindMerge.twMerge("peer",
|
|
3061
|
+
className: tailwindMerge.twMerge("peer", baseClass2, variantClass, sizeClass, className),
|
|
2377
3062
|
children: [
|
|
2378
3063
|
shouldRenderPlaceholder && /* @__PURE__ */ jsxRuntime.jsx("option", { value: "", disabled: props.required, hidden: hasValue, children: placeholderOptionLabel }),
|
|
2379
3064
|
normalizedOptions.map((option, index) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: option.value, disabled: option.disabled, children: option.label }, `${selectId}-${option.value}-${index}`))
|
|
@@ -2461,19 +3146,19 @@ var Slider = ({
|
|
|
2461
3146
|
const resolvedMax = toNumber(max, resolvedMin < 100 ? 100 : resolvedMin);
|
|
2462
3147
|
const resolvedStep = toNumber(step, 1);
|
|
2463
3148
|
const isControlled = typeof value === "number";
|
|
2464
|
-
const [internalValue, setInternalValue] =
|
|
3149
|
+
const [internalValue, setInternalValue] = React4.useState(
|
|
2465
3150
|
clamp(
|
|
2466
3151
|
typeof value === "number" ? value : typeof defaultValue === "number" ? defaultValue : resolvedMin,
|
|
2467
3152
|
resolvedMin,
|
|
2468
3153
|
resolvedMax
|
|
2469
3154
|
)
|
|
2470
3155
|
);
|
|
2471
|
-
|
|
3156
|
+
React4.useEffect(() => {
|
|
2472
3157
|
if (isControlled && typeof value === "number") {
|
|
2473
3158
|
setInternalValue(clamp(value, resolvedMin, resolvedMax));
|
|
2474
3159
|
}
|
|
2475
3160
|
}, [isControlled, value, resolvedMin, resolvedMax]);
|
|
2476
|
-
|
|
3161
|
+
React4.useEffect(() => {
|
|
2477
3162
|
if (!isControlled) {
|
|
2478
3163
|
setInternalValue((prev) => clamp(prev, resolvedMin, resolvedMax));
|
|
2479
3164
|
}
|
|
@@ -2576,7 +3261,7 @@ var thumbActiveClasses = {
|
|
|
2576
3261
|
surface: "border-gray-900 shadow-[0_4px_12px_rgba(15,23,42,0.32)]",
|
|
2577
3262
|
bw: "border-black shadow-[0_4px_12px_rgba(0,0,0,0.32)]"
|
|
2578
3263
|
};
|
|
2579
|
-
var Switch =
|
|
3264
|
+
var Switch = React4.forwardRef(
|
|
2580
3265
|
({
|
|
2581
3266
|
color = "primary",
|
|
2582
3267
|
size = "medium",
|
|
@@ -2595,10 +3280,10 @@ var Switch = React3.forwardRef(
|
|
|
2595
3280
|
const focusClass = focusRingClasses[color] ?? focusRingClasses.primary;
|
|
2596
3281
|
const thumbActive = thumbActiveClasses[color] ?? thumbActiveClasses.primary;
|
|
2597
3282
|
const isControlled = checked !== void 0;
|
|
2598
|
-
const [internalChecked, setInternalChecked] =
|
|
3283
|
+
const [internalChecked, setInternalChecked] = React4.useState(
|
|
2599
3284
|
Boolean((isControlled ? checked : defaultChecked) ?? false)
|
|
2600
3285
|
);
|
|
2601
|
-
|
|
3286
|
+
React4.useEffect(() => {
|
|
2602
3287
|
if (isControlled) {
|
|
2603
3288
|
setInternalChecked(Boolean(checked));
|
|
2604
3289
|
}
|
|
@@ -2788,7 +3473,7 @@ var resolveVariantClass3 = (variant, type) => {
|
|
|
2788
3473
|
return "bg-white/95 text-gray-900 border border-gray-200";
|
|
2789
3474
|
}
|
|
2790
3475
|
};
|
|
2791
|
-
var
|
|
3476
|
+
var resolveIconClassName5 = (icon) => {
|
|
2792
3477
|
if (!icon) return void 0;
|
|
2793
3478
|
if (typeof icon === "string") {
|
|
2794
3479
|
const trimmed = icon.trim();
|
|
@@ -2802,8 +3487,8 @@ var resolveIconClassName4 = (icon) => {
|
|
|
2802
3487
|
return `mdi ${library} ${normalized}`.trim();
|
|
2803
3488
|
};
|
|
2804
3489
|
var resolveIconNode = (icon, fallbackClassName) => {
|
|
2805
|
-
if (
|
|
2806
|
-
const iconClassName =
|
|
3490
|
+
if (React4__namespace.isValidElement(icon)) return icon;
|
|
3491
|
+
const iconClassName = resolveIconClassName5(icon) ?? fallbackClassName;
|
|
2807
3492
|
if (!iconClassName) return null;
|
|
2808
3493
|
const hasBase = iconClassName.split(" ").some((token) => token.trim() === "mdi");
|
|
2809
3494
|
const hasGlyph = iconClassName.includes("mdi-");
|
|
@@ -3224,7 +3909,10 @@ var Progress = (props) => {
|
|
|
3224
3909
|
};
|
|
3225
3910
|
var Progress_default = Progress;
|
|
3226
3911
|
|
|
3912
|
+
exports.Alert = Alert_default;
|
|
3227
3913
|
exports.AppBar = AppBar_default;
|
|
3914
|
+
exports.Badge = Badge_default;
|
|
3915
|
+
exports.Block = Block_default;
|
|
3228
3916
|
exports.Button = Button_default;
|
|
3229
3917
|
exports.Card = Card_default;
|
|
3230
3918
|
exports.Chip = Chip_default;
|
|
@@ -3244,6 +3932,7 @@ exports.Progress = Progress_default;
|
|
|
3244
3932
|
exports.Select = Select_default;
|
|
3245
3933
|
exports.Slider = Slider_default;
|
|
3246
3934
|
exports.Switch = Switch_default;
|
|
3935
|
+
exports.TextArea = TextArea_default;
|
|
3247
3936
|
exports.ToolTip = ToolTip_default;
|
|
3248
3937
|
//# sourceMappingURL=index.cjs.map
|
|
3249
3938
|
//# sourceMappingURL=index.cjs.map
|