@lindle/linoardo 1.0.11 → 1.0.13
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/index.cjs +271 -249
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +212 -212
- package/dist/index.d.ts +212 -212
- package/dist/index.js +271 -248
- package/dist/index.js.map +1 -1
- package/dist/styles.css +3 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var React3 = require('react');
|
|
4
4
|
var tailwindMerge = require('tailwind-merge');
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
|
|
@@ -22,7 +22,7 @@ function _interopNamespace(e) {
|
|
|
22
22
|
return Object.freeze(n);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
var
|
|
25
|
+
var React3__namespace = /*#__PURE__*/_interopNamespace(React3);
|
|
26
26
|
|
|
27
27
|
// src/Containment/Button/index.tsx
|
|
28
28
|
|
|
@@ -151,7 +151,7 @@ var sizeClasses = {
|
|
|
151
151
|
large: "px-6 py-3 text-lg",
|
|
152
152
|
"x-large": "px-7 py-3.5 text-xl"
|
|
153
153
|
};
|
|
154
|
-
var Button =
|
|
154
|
+
var Button = React3__namespace.forwardRef(
|
|
155
155
|
({
|
|
156
156
|
variant = "solid",
|
|
157
157
|
color = "primary",
|
|
@@ -322,7 +322,7 @@ var resolveIconClassName2 = (icon) => {
|
|
|
322
322
|
const normalized = iconName.startsWith("mdi-") ? iconName : `mdi-${iconName}`;
|
|
323
323
|
return Array.from(/* @__PURE__ */ new Set([...baseClasses, normalized])).join(" ");
|
|
324
324
|
};
|
|
325
|
-
var Chip =
|
|
325
|
+
var Chip = React3.forwardRef(
|
|
326
326
|
({
|
|
327
327
|
variant = "solid",
|
|
328
328
|
color = "primary",
|
|
@@ -354,46 +354,37 @@ var Chip = React4__namespace.forwardRef(
|
|
|
354
354
|
const appendIconClassName = resolveIconClassName2(appendIcon);
|
|
355
355
|
const closeIconClassName = resolveIconClassName2(closeIcon);
|
|
356
356
|
const filterIconClassName = filter && selected ? resolveIconClassName2(filterIcon) : void 0;
|
|
357
|
-
const handleClick =
|
|
358
|
-
(
|
|
359
|
-
|
|
360
|
-
event.preventDefault();
|
|
361
|
-
event.stopPropagation();
|
|
362
|
-
return;
|
|
363
|
-
}
|
|
364
|
-
onClick?.(event);
|
|
365
|
-
},
|
|
366
|
-
[disabled, onClick]
|
|
367
|
-
);
|
|
368
|
-
const handleKeyDown = React4__namespace.useCallback(
|
|
369
|
-
(event) => {
|
|
370
|
-
onKeyDown?.(event);
|
|
371
|
-
if (event.defaultPrevented || disabled || !interactive) {
|
|
372
|
-
return;
|
|
373
|
-
}
|
|
374
|
-
if (event.key === "Enter" || event.key === " ") {
|
|
375
|
-
event.preventDefault();
|
|
376
|
-
event.currentTarget.click();
|
|
377
|
-
}
|
|
378
|
-
},
|
|
379
|
-
[disabled, interactive, onKeyDown]
|
|
380
|
-
);
|
|
381
|
-
const handleCloseClick = React4__namespace.useCallback(
|
|
382
|
-
(event) => {
|
|
357
|
+
const handleClick = (event) => {
|
|
358
|
+
if (disabled) {
|
|
359
|
+
event.preventDefault();
|
|
383
360
|
event.stopPropagation();
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
361
|
+
return;
|
|
362
|
+
}
|
|
363
|
+
onClick?.(event);
|
|
364
|
+
};
|
|
365
|
+
const handleKeyDown = (event) => {
|
|
366
|
+
onKeyDown?.(event);
|
|
367
|
+
if (event.defaultPrevented || disabled || !interactive) {
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
371
|
+
event.preventDefault();
|
|
372
|
+
event.currentTarget.click();
|
|
373
|
+
}
|
|
374
|
+
};
|
|
375
|
+
const handleCloseClick = (event) => {
|
|
376
|
+
event.stopPropagation();
|
|
377
|
+
if (disabled) {
|
|
378
|
+
event.preventDefault();
|
|
379
|
+
return;
|
|
380
|
+
}
|
|
381
|
+
onClose?.(event);
|
|
382
|
+
};
|
|
383
|
+
const handleCloseKeyDown = (event) => {
|
|
393
384
|
if (event.key === " " || event.key === "Enter") {
|
|
394
385
|
event.stopPropagation();
|
|
395
386
|
}
|
|
396
|
-
}
|
|
387
|
+
};
|
|
397
388
|
const renderableChildren = typeof children === "string" || typeof children === "number" ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children }) : children;
|
|
398
389
|
const filterAdornment = filter ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
399
390
|
"span",
|
|
@@ -461,7 +452,7 @@ var accentClasses = {
|
|
|
461
452
|
surface: { text: "text-gray-900", bg: "bg-gray-100", indicator: "bg-gray-900" },
|
|
462
453
|
bw: { text: "text-gray-900", bg: "bg-gray-100", indicator: "bg-gray-900" }
|
|
463
454
|
};
|
|
464
|
-
var ListItem =
|
|
455
|
+
var ListItem = React3__namespace.forwardRef((props, ref) => {
|
|
465
456
|
const {
|
|
466
457
|
component,
|
|
467
458
|
href,
|
|
@@ -496,20 +487,20 @@ var ListItem = React4__namespace.forwardRef((props, ref) => {
|
|
|
496
487
|
const sharp = sharpOverride ?? false;
|
|
497
488
|
const accent = accentClasses[color] ?? accentClasses.primary;
|
|
498
489
|
const shapeClass = divided || sharp ? "rounded-none" : "rounded-lg";
|
|
499
|
-
const
|
|
500
|
-
const interactive = typeof rest.onClick === "function" ||
|
|
490
|
+
const Component3 = component ?? (href ? "a" : "div");
|
|
491
|
+
const interactive = typeof rest.onClick === "function" || Component3 === "a" || Component3 === "button";
|
|
501
492
|
const resolvedRole = role ?? "listitem";
|
|
502
|
-
const resolvedTabIndex = disabled ? -1 : tabIndex ?? (interactive &&
|
|
503
|
-
const resolvedRel =
|
|
504
|
-
const resolvedTarget =
|
|
505
|
-
const resolvedHref =
|
|
506
|
-
const resolvedType =
|
|
493
|
+
const resolvedTabIndex = disabled ? -1 : tabIndex ?? (interactive && Component3 === "div" ? 0 : void 0);
|
|
494
|
+
const resolvedRel = Component3 === "a" ? rel : void 0;
|
|
495
|
+
const resolvedTarget = Component3 === "a" ? target : void 0;
|
|
496
|
+
const resolvedHref = Component3 === "a" ? href : void 0;
|
|
497
|
+
const resolvedType = Component3 === "button" ? type ?? "button" : void 0;
|
|
507
498
|
const disabledClass = disabled ? "pointer-events-none opacity-60" : "cursor-pointer";
|
|
508
499
|
const navPaddingClass = nav ? "pl-5" : void 0;
|
|
509
500
|
const insetClass = inset ? "pl-12" : void 0;
|
|
510
501
|
const activeClasses = active ? accent.bg : void 0;
|
|
511
502
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
512
|
-
|
|
503
|
+
Component3,
|
|
513
504
|
{
|
|
514
505
|
...rest,
|
|
515
506
|
ref,
|
|
@@ -578,13 +569,13 @@ var listRoundedClasses = {
|
|
|
578
569
|
pill: "rounded-full"
|
|
579
570
|
};
|
|
580
571
|
var isListItemElement = (element) => {
|
|
581
|
-
if (!
|
|
572
|
+
if (!React3__namespace.isValidElement(element)) {
|
|
582
573
|
return false;
|
|
583
574
|
}
|
|
584
575
|
const elementType = element.type;
|
|
585
576
|
return element.type === Item_default || elementType.displayName === Item_default.displayName;
|
|
586
577
|
};
|
|
587
|
-
var List =
|
|
578
|
+
var List = React3__namespace.forwardRef((props, ref) => {
|
|
588
579
|
const {
|
|
589
580
|
variant = "solid",
|
|
590
581
|
density = "default",
|
|
@@ -606,11 +597,11 @@ var List = React4__namespace.forwardRef((props, ref) => {
|
|
|
606
597
|
const navClass = nav ? "py-1" : void 0;
|
|
607
598
|
const accentColor = color;
|
|
608
599
|
const enhanceChild = (child) => {
|
|
609
|
-
if (!
|
|
600
|
+
if (!React3__namespace.isValidElement(child)) {
|
|
610
601
|
return child;
|
|
611
602
|
}
|
|
612
603
|
if (isListItemElement(child)) {
|
|
613
|
-
return
|
|
604
|
+
return React3__namespace.cloneElement(child, {
|
|
614
605
|
density: child.props.density ?? density,
|
|
615
606
|
lines: child.props.lines ?? lines,
|
|
616
607
|
nav: child.props.nav ?? nav,
|
|
@@ -620,14 +611,14 @@ var List = React4__namespace.forwardRef((props, ref) => {
|
|
|
620
611
|
});
|
|
621
612
|
}
|
|
622
613
|
if (child.props && typeof child.props === "object" && "children" in child.props) {
|
|
623
|
-
const nestedChildren =
|
|
614
|
+
const nestedChildren = React3__namespace.Children.map(child.props.children, enhanceChild);
|
|
624
615
|
if (nestedChildren !== child.props.children) {
|
|
625
|
-
return
|
|
616
|
+
return React3__namespace.cloneElement(child, void 0, nestedChildren);
|
|
626
617
|
}
|
|
627
618
|
}
|
|
628
619
|
return child;
|
|
629
620
|
};
|
|
630
|
-
const resolvedChildren =
|
|
621
|
+
const resolvedChildren = React3__namespace.Children.map(children, enhanceChild);
|
|
631
622
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
632
623
|
"div",
|
|
633
624
|
{
|
|
@@ -655,7 +646,7 @@ var offsetClasses = {
|
|
|
655
646
|
};
|
|
656
647
|
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";
|
|
657
648
|
var overlayBaseClasses = "fixed inset-0 z-40 bg-gray-900/30 backdrop-blur-[1px]";
|
|
658
|
-
var Menu =
|
|
649
|
+
var Menu = React3__namespace.forwardRef((props, ref) => {
|
|
659
650
|
const {
|
|
660
651
|
activator,
|
|
661
652
|
children,
|
|
@@ -732,7 +723,7 @@ var Menu = React4__namespace.forwardRef((props, ref) => {
|
|
|
732
723
|
});
|
|
733
724
|
Menu.displayName = "Menu";
|
|
734
725
|
var Menu_default = Menu;
|
|
735
|
-
var ExpansionPanelContext =
|
|
726
|
+
var ExpansionPanelContext = React3__namespace.createContext(null);
|
|
736
727
|
var densityClasses2 = {
|
|
737
728
|
comfortable: "py-5",
|
|
738
729
|
default: "py-4",
|
|
@@ -761,135 +752,148 @@ var accentClasses2 = {
|
|
|
761
752
|
surface: { text: "text-gray-900", bg: "bg-gray-100", border: "border-gray-200" },
|
|
762
753
|
bw: { text: "text-gray-900", bg: "bg-gray-100", border: "border-gray-200" }
|
|
763
754
|
};
|
|
764
|
-
var
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
"
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
"
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
disabled,
|
|
842
|
-
"aria-expanded": isExpanded,
|
|
843
|
-
"aria-controls": hasContent ? contentId : void 0,
|
|
844
|
-
className: tailwindMerge.twMerge(
|
|
845
|
-
"flex w-full items-center gap-4 px-4 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",
|
|
846
|
-
densityPadding,
|
|
847
|
-
disabledClass,
|
|
848
|
-
isExpanded ? accent.bg : void 0,
|
|
849
|
-
headerClassName
|
|
850
|
-
),
|
|
851
|
-
"data-state": isExpanded ? "open" : "closed",
|
|
852
|
-
children: [
|
|
853
|
-
prepend && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex h-10 w-10 items-center justify-center text-gray-500", children: prepend }),
|
|
854
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex min-w-0 flex-1 flex-col gap-0.5 text-left", children: [
|
|
855
|
-
title && /* @__PURE__ */ jsxRuntime.jsx("span", { className: tailwindMerge.twMerge("truncate font-medium text-gray-900", titleClass), children: title }),
|
|
856
|
-
subtitle && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-gray-500", children: subtitle })
|
|
857
|
-
] }),
|
|
858
|
-
append && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-auto flex items-center gap-2 text-sm text-gray-500", children: append }),
|
|
859
|
-
!hideToggleIcon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: toggleWrapperClass, children: toggleIconNode })
|
|
860
|
-
]
|
|
861
|
-
}
|
|
755
|
+
var uniqueIdCounter = 0;
|
|
756
|
+
var generateId = (prefix) => `${prefix}-${++uniqueIdCounter}`;
|
|
757
|
+
var ExpansionPanelItemInner = class extends React3.Component {
|
|
758
|
+
constructor(props) {
|
|
759
|
+
super(props);
|
|
760
|
+
this.handleToggle = () => {
|
|
761
|
+
const { disabled = false } = this.props;
|
|
762
|
+
if (disabled) {
|
|
763
|
+
return;
|
|
764
|
+
}
|
|
765
|
+
const context = this.context;
|
|
766
|
+
const panelValue = this.props.value ?? this.generatedValue;
|
|
767
|
+
if (context) {
|
|
768
|
+
context.toggle(panelValue, disabled);
|
|
769
|
+
return;
|
|
770
|
+
}
|
|
771
|
+
this.setState((prev) => ({ standaloneExpanded: !prev.standaloneExpanded }));
|
|
772
|
+
};
|
|
773
|
+
this.state = { standaloneExpanded: false };
|
|
774
|
+
this.generatedValue = generateId("expansion-panel-value");
|
|
775
|
+
this.headerId = generateId("expansion-panel-header");
|
|
776
|
+
this.contentId = generateId("expansion-panel-content");
|
|
777
|
+
}
|
|
778
|
+
render() {
|
|
779
|
+
const {
|
|
780
|
+
value,
|
|
781
|
+
title,
|
|
782
|
+
subtitle,
|
|
783
|
+
text,
|
|
784
|
+
prepend,
|
|
785
|
+
append,
|
|
786
|
+
expandIcon,
|
|
787
|
+
collapseIcon,
|
|
788
|
+
hideToggleIcon = false,
|
|
789
|
+
headerClassName,
|
|
790
|
+
contentClassName,
|
|
791
|
+
className,
|
|
792
|
+
disabled = false,
|
|
793
|
+
children,
|
|
794
|
+
color: colorOverride,
|
|
795
|
+
forwardedRef,
|
|
796
|
+
...rest
|
|
797
|
+
} = this.props;
|
|
798
|
+
const context = this.context;
|
|
799
|
+
const panelValue = value ?? this.generatedValue;
|
|
800
|
+
const density = context?.density ?? "default";
|
|
801
|
+
const color = colorOverride ?? context?.color ?? "primary";
|
|
802
|
+
const divider = context?.divider ?? true;
|
|
803
|
+
const variant = context?.variant ?? "elevated";
|
|
804
|
+
const rounded = context?.rounded ?? "lg";
|
|
805
|
+
const accent = accentClasses2[color] ?? accentClasses2.primary;
|
|
806
|
+
const isExpanded = context ? context.expandedValues.includes(panelValue) : this.state.standaloneExpanded;
|
|
807
|
+
const rootSurface = divider ? "bg-transparent border-0 shadow-none" : itemVariantClasses[variant];
|
|
808
|
+
const shapeClass = divider ? void 0 : roundedClasses[rounded] ?? roundedClasses.lg;
|
|
809
|
+
const densityPadding = densityClasses2[density] ?? densityClasses2.default;
|
|
810
|
+
const disabledClass = disabled ? "cursor-not-allowed opacity-60" : "cursor-pointer";
|
|
811
|
+
const titleClass = isExpanded ? accent.text : void 0;
|
|
812
|
+
const activeBorderClass = tailwindMerge.twMerge("border-l-2 border-transparent", isExpanded ? accent.border : void 0);
|
|
813
|
+
const defaultToggleIcon = /* @__PURE__ */ jsxRuntime.jsx("i", { className: "mdi mdi-chevron-down text-lg leading-none transition-transform duration-200", "aria-hidden": true });
|
|
814
|
+
const hasContent = Boolean(children ?? text);
|
|
815
|
+
const contentAnimationClass = isExpanded ? "pb-5 opacity-100" : "pb-0 opacity-0";
|
|
816
|
+
const toggleIconNode = hideToggleIcon ? null : isExpanded && collapseIcon ? collapseIcon : expandIcon ?? defaultToggleIcon;
|
|
817
|
+
const shouldRotateDefaultIcon = !expandIcon && !collapseIcon && !hideToggleIcon;
|
|
818
|
+
const toggleWrapperClass = tailwindMerge.twMerge(
|
|
819
|
+
"ml-3 flex h-6 w-6 items-center justify-center text-gray-500 transition-transform duration-200",
|
|
820
|
+
shouldRotateDefaultIcon && isExpanded ? "rotate-180" : void 0
|
|
821
|
+
);
|
|
822
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
823
|
+
"div",
|
|
824
|
+
{
|
|
825
|
+
...rest,
|
|
826
|
+
ref: forwardedRef,
|
|
827
|
+
className: tailwindMerge.twMerge(
|
|
828
|
+
"expansion-panel-item flex flex-col overflow-hidden transition-colors duration-200",
|
|
829
|
+
rootSurface,
|
|
830
|
+
shapeClass,
|
|
831
|
+
className
|
|
862
832
|
),
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
"
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
}
|
|
833
|
+
"data-state": isExpanded ? "open" : "closed",
|
|
834
|
+
"data-disabled": disabled || void 0,
|
|
835
|
+
children: [
|
|
836
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
837
|
+
"button",
|
|
838
|
+
{
|
|
839
|
+
type: "button",
|
|
840
|
+
id: this.headerId,
|
|
841
|
+
onClick: this.handleToggle,
|
|
842
|
+
disabled,
|
|
843
|
+
"aria-expanded": isExpanded,
|
|
844
|
+
"aria-controls": hasContent ? this.contentId : void 0,
|
|
845
|
+
className: tailwindMerge.twMerge(
|
|
846
|
+
"flex w-full items-center gap-4 px-4 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",
|
|
847
|
+
densityPadding,
|
|
848
|
+
disabledClass,
|
|
849
|
+
isExpanded ? accent.bg : void 0,
|
|
850
|
+
headerClassName
|
|
851
|
+
),
|
|
852
|
+
"data-state": isExpanded ? "open" : "closed",
|
|
853
|
+
children: [
|
|
854
|
+
prepend && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex h-10 w-10 items-center justify-center text-gray-500", children: prepend }),
|
|
855
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex min-w-0 flex-1 flex-col gap-0.5 text-left", children: [
|
|
856
|
+
title && /* @__PURE__ */ jsxRuntime.jsx("span", { className: tailwindMerge.twMerge("truncate font-medium text-gray-900", titleClass), children: title }),
|
|
857
|
+
subtitle && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-gray-500", children: subtitle })
|
|
858
|
+
] }),
|
|
859
|
+
append && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-auto flex items-center gap-2 text-sm text-gray-500", children: append }),
|
|
860
|
+
!hideToggleIcon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: toggleWrapperClass, children: toggleIconNode })
|
|
861
|
+
]
|
|
862
|
+
}
|
|
863
|
+
),
|
|
864
|
+
hasContent && /* @__PURE__ */ jsxRuntime.jsx(
|
|
865
|
+
"div",
|
|
866
|
+
{
|
|
867
|
+
className: "grid overflow-hidden border-t border-gray-100 transition-all duration-200 ease-in-out",
|
|
868
|
+
style: { gridTemplateRows: isExpanded ? "1fr" : "0fr" },
|
|
869
|
+
"aria-hidden": isExpanded ? void 0 : true,
|
|
870
|
+
"data-state": isExpanded ? "open" : "closed",
|
|
871
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
872
|
+
"div",
|
|
873
|
+
{
|
|
874
|
+
id: this.contentId,
|
|
875
|
+
role: "region",
|
|
876
|
+
"aria-labelledby": this.headerId,
|
|
877
|
+
"data-state": isExpanded ? "open" : "closed",
|
|
878
|
+
className: tailwindMerge.twMerge(
|
|
879
|
+
"min-h-0 px-4 pt-0 text-sm text-gray-600 transition-all duration-200",
|
|
880
|
+
activeBorderClass,
|
|
881
|
+
contentAnimationClass,
|
|
882
|
+
isExpanded ? "pointer-events-auto" : "pointer-events-none",
|
|
883
|
+
contentClassName
|
|
884
|
+
),
|
|
885
|
+
children: children ?? text
|
|
886
|
+
}
|
|
887
|
+
)
|
|
888
|
+
}
|
|
889
|
+
)
|
|
890
|
+
]
|
|
891
|
+
}
|
|
892
|
+
);
|
|
893
|
+
}
|
|
894
|
+
};
|
|
895
|
+
ExpansionPanelItemInner.contextType = ExpansionPanelContext;
|
|
896
|
+
var ExpansionPanelItem = React3.forwardRef((props, ref) => /* @__PURE__ */ jsxRuntime.jsx(ExpansionPanelItemInner, { ...props, forwardedRef: ref }));
|
|
893
897
|
ExpansionPanelItem.displayName = "ExpansionPanelItem";
|
|
894
898
|
var ExpansionPanelItem_default = ExpansionPanelItem;
|
|
895
899
|
var variantContainerClasses = {
|
|
@@ -917,80 +921,98 @@ var normalizeValues = (value, allowMultiple) => {
|
|
|
917
921
|
return normalized.length ? [normalized[0]] : [];
|
|
918
922
|
};
|
|
919
923
|
var clampValues = (values, allowMultiple) => allowMultiple ? uniqueValues(values) : values.length ? [values[0]] : [];
|
|
920
|
-
var
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
} = props;
|
|
935
|
-
const isControlled = value !== void 0;
|
|
936
|
-
const controlledValues = React4__namespace.useMemo(() => {
|
|
937
|
-
if (!isControlled) {
|
|
938
|
-
return void 0;
|
|
939
|
-
}
|
|
940
|
-
return normalizeValues(value, multiple);
|
|
941
|
-
}, [isControlled, value, multiple]);
|
|
942
|
-
const [internalValues, setInternalValues] = React4__namespace.useState(
|
|
943
|
-
() => normalizeValues(defaultValue, multiple)
|
|
944
|
-
);
|
|
945
|
-
const expandedValues = controlledValues ?? internalValues;
|
|
946
|
-
React4__namespace.useEffect(() => {
|
|
947
|
-
if (!isControlled) {
|
|
948
|
-
setInternalValues((prev) => clampValues(prev, multiple));
|
|
949
|
-
}
|
|
950
|
-
}, [multiple, isControlled]);
|
|
951
|
-
const handleValueChange = React4__namespace.useCallback(
|
|
952
|
-
(next) => {
|
|
924
|
+
var ExpansionPanelInner = class extends React3.Component {
|
|
925
|
+
constructor(props) {
|
|
926
|
+
super(props);
|
|
927
|
+
this.isControlled = () => this.props.value !== void 0;
|
|
928
|
+
this.getExpandedValues = (allowMultiple = this.props.multiple ?? false) => {
|
|
929
|
+
if (this.isControlled()) {
|
|
930
|
+
return normalizeValues(this.props.value, allowMultiple);
|
|
931
|
+
}
|
|
932
|
+
return this.state.internalValues;
|
|
933
|
+
};
|
|
934
|
+
this.handleValueChange = (next) => {
|
|
935
|
+
const { onChange } = this.props;
|
|
936
|
+
const allowMultiple = this.props.multiple ?? false;
|
|
937
|
+
const isControlled = this.isControlled();
|
|
953
938
|
if (!isControlled) {
|
|
954
|
-
|
|
939
|
+
this.setState({ internalValues: next });
|
|
955
940
|
}
|
|
956
941
|
if (onChange) {
|
|
957
|
-
if (
|
|
942
|
+
if (allowMultiple) {
|
|
958
943
|
onChange(next);
|
|
959
944
|
} else {
|
|
960
945
|
onChange(next[0] ?? null);
|
|
961
946
|
}
|
|
962
947
|
}
|
|
963
|
-
}
|
|
964
|
-
|
|
965
|
-
);
|
|
966
|
-
const toggle = React4__namespace.useCallback(
|
|
967
|
-
(panelValue, disabled) => {
|
|
948
|
+
};
|
|
949
|
+
this.handleToggle = (panelValue, disabled) => {
|
|
968
950
|
if (disabled) {
|
|
969
951
|
return;
|
|
970
952
|
}
|
|
953
|
+
const allowMultiple = this.props.multiple ?? false;
|
|
954
|
+
const expandedValues = this.getExpandedValues(allowMultiple);
|
|
971
955
|
const isActive = expandedValues.includes(panelValue);
|
|
972
|
-
const next =
|
|
973
|
-
handleValueChange(next);
|
|
974
|
-
}
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
)
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
className: tailwindMerge.twMerge("expansion-panel flex w-full flex-col text-gray-900", variantClass, shapeClass, layoutClass, className),
|
|
990
|
-
children
|
|
956
|
+
const next = allowMultiple ? isActive ? expandedValues.filter((v) => v !== panelValue) : [...expandedValues, panelValue] : isActive ? [] : [panelValue];
|
|
957
|
+
this.handleValueChange(next);
|
|
958
|
+
};
|
|
959
|
+
const allowMultiple = props.multiple ?? false;
|
|
960
|
+
this.state = {
|
|
961
|
+
internalValues: normalizeValues(props.defaultValue, allowMultiple)
|
|
962
|
+
};
|
|
963
|
+
}
|
|
964
|
+
componentDidUpdate(prevProps) {
|
|
965
|
+
const allowMultiple = this.props.multiple ?? false;
|
|
966
|
+
const prevAllowMultiple = prevProps.multiple ?? false;
|
|
967
|
+
const isControlled = this.isControlled();
|
|
968
|
+
const wasControlled = prevProps.value !== void 0;
|
|
969
|
+
if (!isControlled && (allowMultiple !== prevAllowMultiple || wasControlled !== isControlled)) {
|
|
970
|
+
this.setState((prevState) => ({
|
|
971
|
+
internalValues: clampValues(prevState.internalValues, allowMultiple)
|
|
972
|
+
}));
|
|
991
973
|
}
|
|
992
|
-
|
|
993
|
-
|
|
974
|
+
}
|
|
975
|
+
render() {
|
|
976
|
+
const {
|
|
977
|
+
variant = "elevated",
|
|
978
|
+
rounded = "lg",
|
|
979
|
+
density = "default",
|
|
980
|
+
color = "primary",
|
|
981
|
+
divider = true,
|
|
982
|
+
multiple = false,
|
|
983
|
+
className,
|
|
984
|
+
children,
|
|
985
|
+
forwardedRef,
|
|
986
|
+
value: _value,
|
|
987
|
+
defaultValue: _defaultValue,
|
|
988
|
+
onChange: _onChange,
|
|
989
|
+
...rest
|
|
990
|
+
} = this.props;
|
|
991
|
+
const expandedValues = this.getExpandedValues(multiple);
|
|
992
|
+
const providerValue = {
|
|
993
|
+
expandedValues,
|
|
994
|
+
toggle: this.handleToggle,
|
|
995
|
+
density,
|
|
996
|
+
color,
|
|
997
|
+
divider,
|
|
998
|
+
rounded,
|
|
999
|
+
variant
|
|
1000
|
+
};
|
|
1001
|
+
const variantClass = divider ? variantContainerClasses[variant] : "bg-transparent border border-transparent shadow-none";
|
|
1002
|
+
const shapeClass = roundedClasses2[rounded] ?? roundedClasses2.lg;
|
|
1003
|
+
const layoutClass = divider ? "divide-y divide-gray-100 overflow-hidden" : "gap-4";
|
|
1004
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ExpansionPanelContext.Provider, { value: providerValue, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1005
|
+
"div",
|
|
1006
|
+
{
|
|
1007
|
+
...rest,
|
|
1008
|
+
ref: forwardedRef,
|
|
1009
|
+
className: tailwindMerge.twMerge("expansion-panel flex w-full flex-col text-gray-900", variantClass, shapeClass, layoutClass, className),
|
|
1010
|
+
children
|
|
1011
|
+
}
|
|
1012
|
+
) });
|
|
1013
|
+
}
|
|
1014
|
+
};
|
|
1015
|
+
var ExpansionPanel = React3.forwardRef((props, ref) => /* @__PURE__ */ jsxRuntime.jsx(ExpansionPanelInner, { ...props, forwardedRef: ref }));
|
|
994
1016
|
ExpansionPanel.displayName = "ExpansionPanel";
|
|
995
1017
|
var ExpansionPanel_default = ExpansionPanel;
|
|
996
1018
|
var containerBaseClasses = "fixed inset-0 z-[70] flex items-center justify-center p-4 sm:p-8 data-[state=closed]:pointer-events-none";
|
|
@@ -1003,7 +1025,7 @@ var resolveSizeValue = (value) => {
|
|
|
1003
1025
|
}
|
|
1004
1026
|
return typeof value === "number" ? `${value}px` : value;
|
|
1005
1027
|
};
|
|
1006
|
-
var Dialog =
|
|
1028
|
+
var Dialog = React3__namespace.forwardRef((props, forwardedRef) => {
|
|
1007
1029
|
const {
|
|
1008
1030
|
activator,
|
|
1009
1031
|
children,
|
|
@@ -1120,7 +1142,7 @@ var arrowPlacementClasses = {
|
|
|
1120
1142
|
"right-start": "left-full top-4 -translate-x-1/2",
|
|
1121
1143
|
"right-end": "left-full bottom-4 -translate-x-1/2"
|
|
1122
1144
|
};
|
|
1123
|
-
var ToolTip =
|
|
1145
|
+
var ToolTip = React3__namespace.forwardRef((props, forwardedRef) => {
|
|
1124
1146
|
const {
|
|
1125
1147
|
activator,
|
|
1126
1148
|
children,
|