@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var React4 = require('react');
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 React4__namespace = /*#__PURE__*/_interopNamespace(React4);
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 = React4__namespace.forwardRef(
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 = React4__namespace.forwardRef(
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 = React4__namespace.useCallback(
358
- (event) => {
359
- if (disabled) {
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
- if (disabled) {
385
- event.preventDefault();
386
- return;
387
- }
388
- onClose?.(event);
389
- },
390
- [disabled, onClose]
391
- );
392
- const handleCloseKeyDown = React4__namespace.useCallback((event) => {
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 = React4__namespace.forwardRef((props, ref) => {
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 Component = component ?? (href ? "a" : "div");
500
- const interactive = typeof rest.onClick === "function" || Component === "a" || Component === "button";
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 && Component === "div" ? 0 : void 0);
503
- const resolvedRel = Component === "a" ? rel : void 0;
504
- const resolvedTarget = Component === "a" ? target : void 0;
505
- const resolvedHref = Component === "a" ? href : void 0;
506
- const resolvedType = Component === "button" ? type ?? "button" : void 0;
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
- Component,
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 (!React4__namespace.isValidElement(element)) {
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 = React4__namespace.forwardRef((props, ref) => {
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 (!React4__namespace.isValidElement(child)) {
600
+ if (!React3__namespace.isValidElement(child)) {
610
601
  return child;
611
602
  }
612
603
  if (isListItemElement(child)) {
613
- return React4__namespace.cloneElement(child, {
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 = React4__namespace.Children.map(child.props.children, enhanceChild);
614
+ const nestedChildren = React3__namespace.Children.map(child.props.children, enhanceChild);
624
615
  if (nestedChildren !== child.props.children) {
625
- return React4__namespace.cloneElement(child, void 0, nestedChildren);
616
+ return React3__namespace.cloneElement(child, void 0, nestedChildren);
626
617
  }
627
618
  }
628
619
  return child;
629
620
  };
630
- const resolvedChildren = React4__namespace.Children.map(children, enhanceChild);
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 = React4__namespace.forwardRef((props, ref) => {
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 = React4__namespace.createContext(null);
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 ExpansionPanelItem = React4__namespace.forwardRef((props, ref) => {
765
- const {
766
- value,
767
- title,
768
- subtitle,
769
- text,
770
- prepend,
771
- append,
772
- expandIcon,
773
- collapseIcon,
774
- hideToggleIcon = false,
775
- headerClassName,
776
- contentClassName,
777
- className,
778
- disabled = false,
779
- children,
780
- color: colorOverride,
781
- ...rest
782
- } = props;
783
- const context = React4__namespace.useContext(ExpansionPanelContext);
784
- const generatedValue = React4__namespace.useId();
785
- const panelValue = value ?? generatedValue;
786
- const density = context?.density ?? "default";
787
- const color = colorOverride ?? context?.color ?? "primary";
788
- const divider = context?.divider ?? true;
789
- const variant = context?.variant ?? "elevated";
790
- const rounded = context?.rounded ?? "lg";
791
- const accent = accentClasses2[color] ?? accentClasses2.primary;
792
- const headerId = React4__namespace.useId();
793
- const contentId = React4__namespace.useId();
794
- const [standaloneExpanded, setStandaloneExpanded] = React4__namespace.useState(false);
795
- const isExpanded = context ? context.expandedValues.includes(panelValue) : standaloneExpanded;
796
- const handleToggle = () => {
797
- if (disabled) {
798
- return;
799
- }
800
- if (context) {
801
- context.toggle(panelValue, disabled);
802
- } else {
803
- setStandaloneExpanded((prev) => !prev);
804
- }
805
- };
806
- const rootSurface = divider ? "bg-transparent border-0 shadow-none" : itemVariantClasses[variant];
807
- const shapeClass = divider ? void 0 : roundedClasses[rounded] ?? roundedClasses.lg;
808
- const densityPadding = densityClasses2[density] ?? densityClasses2.default;
809
- const disabledClass = disabled ? "cursor-not-allowed opacity-60" : "cursor-pointer";
810
- const titleClass = isExpanded ? accent.text : void 0;
811
- const activeBorderClass = tailwindMerge.twMerge("border-l-2 border-transparent", isExpanded ? accent.border : void 0);
812
- const defaultToggleIcon = /* @__PURE__ */ jsxRuntime.jsx("i", { className: "mdi mdi-chevron-down text-lg leading-none transition-transform duration-200", "aria-hidden": true });
813
- const hasContent = Boolean(children ?? text);
814
- const contentAnimationClass = isExpanded ? "pb-5 opacity-100" : "pb-0 opacity-0";
815
- const toggleIconNode = hideToggleIcon ? null : isExpanded && collapseIcon ? collapseIcon : expandIcon ?? defaultToggleIcon;
816
- const shouldRotateDefaultIcon = !expandIcon && !collapseIcon && !hideToggleIcon;
817
- const toggleWrapperClass = tailwindMerge.twMerge(
818
- "ml-3 flex h-6 w-6 items-center justify-center text-gray-500 transition-transform duration-200",
819
- shouldRotateDefaultIcon && isExpanded ? "rotate-180" : void 0
820
- );
821
- return /* @__PURE__ */ jsxRuntime.jsxs(
822
- "div",
823
- {
824
- ...rest,
825
- ref,
826
- className: tailwindMerge.twMerge(
827
- "expansion-panel-item flex flex-col overflow-hidden transition-colors duration-200",
828
- rootSurface,
829
- shapeClass,
830
- className
831
- ),
832
- "data-state": isExpanded ? "open" : "closed",
833
- "data-disabled": disabled || void 0,
834
- children: [
835
- /* @__PURE__ */ jsxRuntime.jsxs(
836
- "button",
837
- {
838
- type: "button",
839
- id: headerId,
840
- onClick: handleToggle,
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
- hasContent && /* @__PURE__ */ jsxRuntime.jsx(
864
- "div",
865
- {
866
- className: "grid overflow-hidden border-t border-gray-100 transition-all duration-200 ease-in-out",
867
- style: { gridTemplateRows: isExpanded ? "1fr" : "0fr" },
868
- "aria-hidden": isExpanded ? void 0 : true,
869
- "data-state": isExpanded ? "open" : "closed",
870
- children: /* @__PURE__ */ jsxRuntime.jsx(
871
- "div",
872
- {
873
- id: contentId,
874
- role: "region",
875
- "aria-labelledby": headerId,
876
- "data-state": isExpanded ? "open" : "closed",
877
- className: tailwindMerge.twMerge(
878
- "min-h-0 px-4 pt-0 text-sm text-gray-600 transition-all duration-200",
879
- activeBorderClass,
880
- contentAnimationClass,
881
- isExpanded ? "pointer-events-auto" : "pointer-events-none",
882
- contentClassName
883
- ),
884
- children: children ?? text
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 ExpansionPanel = React4__namespace.forwardRef((props, ref) => {
921
- const {
922
- variant = "elevated",
923
- rounded = "lg",
924
- density = "default",
925
- color = "primary",
926
- divider = true,
927
- multiple = false,
928
- value,
929
- defaultValue,
930
- onChange,
931
- className,
932
- children,
933
- ...rest
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
- setInternalValues(next);
939
+ this.setState({ internalValues: next });
955
940
  }
956
941
  if (onChange) {
957
- if (multiple) {
942
+ if (allowMultiple) {
958
943
  onChange(next);
959
944
  } else {
960
945
  onChange(next[0] ?? null);
961
946
  }
962
947
  }
963
- },
964
- [isControlled, multiple, onChange]
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 = multiple ? isActive ? expandedValues.filter((v) => v !== panelValue) : [...expandedValues, panelValue] : isActive ? [] : [panelValue];
973
- handleValueChange(next);
974
- },
975
- [expandedValues, handleValueChange, multiple]
976
- );
977
- const providerValue = React4__namespace.useMemo(
978
- () => ({ expandedValues, toggle, density, color, divider, rounded, variant }),
979
- [expandedValues, toggle, density, color, divider, rounded, variant]
980
- );
981
- const variantClass = divider ? variantContainerClasses[variant] : "bg-transparent border border-transparent shadow-none";
982
- const shapeClass = roundedClasses2[rounded] ?? roundedClasses2.lg;
983
- const layoutClass = divider ? "divide-y divide-gray-100 overflow-hidden" : "gap-4";
984
- return /* @__PURE__ */ jsxRuntime.jsx(ExpansionPanelContext.Provider, { value: providerValue, children: /* @__PURE__ */ jsxRuntime.jsx(
985
- "div",
986
- {
987
- ...rest,
988
- ref,
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 = React4__namespace.forwardRef((props, forwardedRef) => {
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 = React4__namespace.forwardRef((props, forwardedRef) => {
1145
+ var ToolTip = React3__namespace.forwardRef((props, forwardedRef) => {
1124
1146
  const {
1125
1147
  activator,
1126
1148
  children,