@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.js CHANGED
@@ -1,4 +1,5 @@
1
- import * as React4 from 'react';
1
+ import * as React3 from 'react';
2
+ import { forwardRef, Component } from 'react';
2
3
  import { twMerge } from 'tailwind-merge';
3
4
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
4
5
 
@@ -129,7 +130,7 @@ var sizeClasses = {
129
130
  large: "px-6 py-3 text-lg",
130
131
  "x-large": "px-7 py-3.5 text-xl"
131
132
  };
132
- var Button = React4.forwardRef(
133
+ var Button = React3.forwardRef(
133
134
  ({
134
135
  variant = "solid",
135
136
  color = "primary",
@@ -300,7 +301,7 @@ var resolveIconClassName2 = (icon) => {
300
301
  const normalized = iconName.startsWith("mdi-") ? iconName : `mdi-${iconName}`;
301
302
  return Array.from(/* @__PURE__ */ new Set([...baseClasses, normalized])).join(" ");
302
303
  };
303
- var Chip = React4.forwardRef(
304
+ var Chip = forwardRef(
304
305
  ({
305
306
  variant = "solid",
306
307
  color = "primary",
@@ -332,46 +333,37 @@ var Chip = React4.forwardRef(
332
333
  const appendIconClassName = resolveIconClassName2(appendIcon);
333
334
  const closeIconClassName = resolveIconClassName2(closeIcon);
334
335
  const filterIconClassName = filter && selected ? resolveIconClassName2(filterIcon) : void 0;
335
- const handleClick = React4.useCallback(
336
- (event) => {
337
- if (disabled) {
338
- event.preventDefault();
339
- event.stopPropagation();
340
- return;
341
- }
342
- onClick?.(event);
343
- },
344
- [disabled, onClick]
345
- );
346
- const handleKeyDown = React4.useCallback(
347
- (event) => {
348
- onKeyDown?.(event);
349
- if (event.defaultPrevented || disabled || !interactive) {
350
- return;
351
- }
352
- if (event.key === "Enter" || event.key === " ") {
353
- event.preventDefault();
354
- event.currentTarget.click();
355
- }
356
- },
357
- [disabled, interactive, onKeyDown]
358
- );
359
- const handleCloseClick = React4.useCallback(
360
- (event) => {
336
+ const handleClick = (event) => {
337
+ if (disabled) {
338
+ event.preventDefault();
361
339
  event.stopPropagation();
362
- if (disabled) {
363
- event.preventDefault();
364
- return;
365
- }
366
- onClose?.(event);
367
- },
368
- [disabled, onClose]
369
- );
370
- const handleCloseKeyDown = React4.useCallback((event) => {
340
+ return;
341
+ }
342
+ onClick?.(event);
343
+ };
344
+ const handleKeyDown = (event) => {
345
+ onKeyDown?.(event);
346
+ if (event.defaultPrevented || disabled || !interactive) {
347
+ return;
348
+ }
349
+ if (event.key === "Enter" || event.key === " ") {
350
+ event.preventDefault();
351
+ event.currentTarget.click();
352
+ }
353
+ };
354
+ const handleCloseClick = (event) => {
355
+ event.stopPropagation();
356
+ if (disabled) {
357
+ event.preventDefault();
358
+ return;
359
+ }
360
+ onClose?.(event);
361
+ };
362
+ const handleCloseKeyDown = (event) => {
371
363
  if (event.key === " " || event.key === "Enter") {
372
364
  event.stopPropagation();
373
365
  }
374
- }, []);
366
+ };
375
367
  const renderableChildren = typeof children === "string" || typeof children === "number" ? /* @__PURE__ */ jsx("span", { className: "truncate", children }) : children;
376
368
  const filterAdornment = filter ? /* @__PURE__ */ jsx(
377
369
  "span",
@@ -439,7 +431,7 @@ var accentClasses = {
439
431
  surface: { text: "text-gray-900", bg: "bg-gray-100", indicator: "bg-gray-900" },
440
432
  bw: { text: "text-gray-900", bg: "bg-gray-100", indicator: "bg-gray-900" }
441
433
  };
442
- var ListItem = React4.forwardRef((props, ref) => {
434
+ var ListItem = React3.forwardRef((props, ref) => {
443
435
  const {
444
436
  component,
445
437
  href,
@@ -474,20 +466,20 @@ var ListItem = React4.forwardRef((props, ref) => {
474
466
  const sharp = sharpOverride ?? false;
475
467
  const accent = accentClasses[color] ?? accentClasses.primary;
476
468
  const shapeClass = divided || sharp ? "rounded-none" : "rounded-lg";
477
- const Component = component ?? (href ? "a" : "div");
478
- const interactive = typeof rest.onClick === "function" || Component === "a" || Component === "button";
469
+ const Component3 = component ?? (href ? "a" : "div");
470
+ const interactive = typeof rest.onClick === "function" || Component3 === "a" || Component3 === "button";
479
471
  const resolvedRole = role ?? "listitem";
480
- const resolvedTabIndex = disabled ? -1 : tabIndex ?? (interactive && Component === "div" ? 0 : void 0);
481
- const resolvedRel = Component === "a" ? rel : void 0;
482
- const resolvedTarget = Component === "a" ? target : void 0;
483
- const resolvedHref = Component === "a" ? href : void 0;
484
- const resolvedType = Component === "button" ? type ?? "button" : void 0;
472
+ const resolvedTabIndex = disabled ? -1 : tabIndex ?? (interactive && Component3 === "div" ? 0 : void 0);
473
+ const resolvedRel = Component3 === "a" ? rel : void 0;
474
+ const resolvedTarget = Component3 === "a" ? target : void 0;
475
+ const resolvedHref = Component3 === "a" ? href : void 0;
476
+ const resolvedType = Component3 === "button" ? type ?? "button" : void 0;
485
477
  const disabledClass = disabled ? "pointer-events-none opacity-60" : "cursor-pointer";
486
478
  const navPaddingClass = nav ? "pl-5" : void 0;
487
479
  const insetClass = inset ? "pl-12" : void 0;
488
480
  const activeClasses = active ? accent.bg : void 0;
489
481
  return /* @__PURE__ */ jsxs(
490
- Component,
482
+ Component3,
491
483
  {
492
484
  ...rest,
493
485
  ref,
@@ -556,13 +548,13 @@ var listRoundedClasses = {
556
548
  pill: "rounded-full"
557
549
  };
558
550
  var isListItemElement = (element) => {
559
- if (!React4.isValidElement(element)) {
551
+ if (!React3.isValidElement(element)) {
560
552
  return false;
561
553
  }
562
554
  const elementType = element.type;
563
555
  return element.type === Item_default || elementType.displayName === Item_default.displayName;
564
556
  };
565
- var List = React4.forwardRef((props, ref) => {
557
+ var List = React3.forwardRef((props, ref) => {
566
558
  const {
567
559
  variant = "solid",
568
560
  density = "default",
@@ -584,11 +576,11 @@ var List = React4.forwardRef((props, ref) => {
584
576
  const navClass = nav ? "py-1" : void 0;
585
577
  const accentColor = color;
586
578
  const enhanceChild = (child) => {
587
- if (!React4.isValidElement(child)) {
579
+ if (!React3.isValidElement(child)) {
588
580
  return child;
589
581
  }
590
582
  if (isListItemElement(child)) {
591
- return React4.cloneElement(child, {
583
+ return React3.cloneElement(child, {
592
584
  density: child.props.density ?? density,
593
585
  lines: child.props.lines ?? lines,
594
586
  nav: child.props.nav ?? nav,
@@ -598,14 +590,14 @@ var List = React4.forwardRef((props, ref) => {
598
590
  });
599
591
  }
600
592
  if (child.props && typeof child.props === "object" && "children" in child.props) {
601
- const nestedChildren = React4.Children.map(child.props.children, enhanceChild);
593
+ const nestedChildren = React3.Children.map(child.props.children, enhanceChild);
602
594
  if (nestedChildren !== child.props.children) {
603
- return React4.cloneElement(child, void 0, nestedChildren);
595
+ return React3.cloneElement(child, void 0, nestedChildren);
604
596
  }
605
597
  }
606
598
  return child;
607
599
  };
608
- const resolvedChildren = React4.Children.map(children, enhanceChild);
600
+ const resolvedChildren = React3.Children.map(children, enhanceChild);
609
601
  return /* @__PURE__ */ jsx(
610
602
  "div",
611
603
  {
@@ -633,7 +625,7 @@ var offsetClasses = {
633
625
  };
634
626
  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";
635
627
  var overlayBaseClasses = "fixed inset-0 z-40 bg-gray-900/30 backdrop-blur-[1px]";
636
- var Menu = React4.forwardRef((props, ref) => {
628
+ var Menu = React3.forwardRef((props, ref) => {
637
629
  const {
638
630
  activator,
639
631
  children,
@@ -710,7 +702,7 @@ var Menu = React4.forwardRef((props, ref) => {
710
702
  });
711
703
  Menu.displayName = "Menu";
712
704
  var Menu_default = Menu;
713
- var ExpansionPanelContext = React4.createContext(null);
705
+ var ExpansionPanelContext = React3.createContext(null);
714
706
  var densityClasses2 = {
715
707
  comfortable: "py-5",
716
708
  default: "py-4",
@@ -739,135 +731,148 @@ var accentClasses2 = {
739
731
  surface: { text: "text-gray-900", bg: "bg-gray-100", border: "border-gray-200" },
740
732
  bw: { text: "text-gray-900", bg: "bg-gray-100", border: "border-gray-200" }
741
733
  };
742
- var ExpansionPanelItem = React4.forwardRef((props, ref) => {
743
- const {
744
- value,
745
- title,
746
- subtitle,
747
- text,
748
- prepend,
749
- append,
750
- expandIcon,
751
- collapseIcon,
752
- hideToggleIcon = false,
753
- headerClassName,
754
- contentClassName,
755
- className,
756
- disabled = false,
757
- children,
758
- color: colorOverride,
759
- ...rest
760
- } = props;
761
- const context = React4.useContext(ExpansionPanelContext);
762
- const generatedValue = React4.useId();
763
- const panelValue = value ?? generatedValue;
764
- const density = context?.density ?? "default";
765
- const color = colorOverride ?? context?.color ?? "primary";
766
- const divider = context?.divider ?? true;
767
- const variant = context?.variant ?? "elevated";
768
- const rounded = context?.rounded ?? "lg";
769
- const accent = accentClasses2[color] ?? accentClasses2.primary;
770
- const headerId = React4.useId();
771
- const contentId = React4.useId();
772
- const [standaloneExpanded, setStandaloneExpanded] = React4.useState(false);
773
- const isExpanded = context ? context.expandedValues.includes(panelValue) : standaloneExpanded;
774
- const handleToggle = () => {
775
- if (disabled) {
776
- return;
777
- }
778
- if (context) {
779
- context.toggle(panelValue, disabled);
780
- } else {
781
- setStandaloneExpanded((prev) => !prev);
782
- }
783
- };
784
- const rootSurface = divider ? "bg-transparent border-0 shadow-none" : itemVariantClasses[variant];
785
- const shapeClass = divider ? void 0 : roundedClasses[rounded] ?? roundedClasses.lg;
786
- const densityPadding = densityClasses2[density] ?? densityClasses2.default;
787
- const disabledClass = disabled ? "cursor-not-allowed opacity-60" : "cursor-pointer";
788
- const titleClass = isExpanded ? accent.text : void 0;
789
- const activeBorderClass = twMerge("border-l-2 border-transparent", isExpanded ? accent.border : void 0);
790
- const defaultToggleIcon = /* @__PURE__ */ jsx("i", { className: "mdi mdi-chevron-down text-lg leading-none transition-transform duration-200", "aria-hidden": true });
791
- const hasContent = Boolean(children ?? text);
792
- const contentAnimationClass = isExpanded ? "pb-5 opacity-100" : "pb-0 opacity-0";
793
- const toggleIconNode = hideToggleIcon ? null : isExpanded && collapseIcon ? collapseIcon : expandIcon ?? defaultToggleIcon;
794
- const shouldRotateDefaultIcon = !expandIcon && !collapseIcon && !hideToggleIcon;
795
- const toggleWrapperClass = twMerge(
796
- "ml-3 flex h-6 w-6 items-center justify-center text-gray-500 transition-transform duration-200",
797
- shouldRotateDefaultIcon && isExpanded ? "rotate-180" : void 0
798
- );
799
- return /* @__PURE__ */ jsxs(
800
- "div",
801
- {
802
- ...rest,
803
- ref,
804
- className: twMerge(
805
- "expansion-panel-item flex flex-col overflow-hidden transition-colors duration-200",
806
- rootSurface,
807
- shapeClass,
808
- className
809
- ),
810
- "data-state": isExpanded ? "open" : "closed",
811
- "data-disabled": disabled || void 0,
812
- children: [
813
- /* @__PURE__ */ jsxs(
814
- "button",
815
- {
816
- type: "button",
817
- id: headerId,
818
- onClick: handleToggle,
819
- disabled,
820
- "aria-expanded": isExpanded,
821
- "aria-controls": hasContent ? contentId : void 0,
822
- className: twMerge(
823
- "flex w-full items-center gap-4 px-4 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",
824
- densityPadding,
825
- disabledClass,
826
- isExpanded ? accent.bg : void 0,
827
- headerClassName
828
- ),
829
- "data-state": isExpanded ? "open" : "closed",
830
- children: [
831
- prepend && /* @__PURE__ */ jsx("span", { className: "flex h-10 w-10 items-center justify-center text-gray-500", children: prepend }),
832
- /* @__PURE__ */ jsxs("span", { className: "flex min-w-0 flex-1 flex-col gap-0.5 text-left", children: [
833
- title && /* @__PURE__ */ jsx("span", { className: twMerge("truncate font-medium text-gray-900", titleClass), children: title }),
834
- subtitle && /* @__PURE__ */ jsx("span", { className: "text-sm text-gray-500", children: subtitle })
835
- ] }),
836
- append && /* @__PURE__ */ jsx("span", { className: "ml-auto flex items-center gap-2 text-sm text-gray-500", children: append }),
837
- !hideToggleIcon && /* @__PURE__ */ jsx("span", { className: toggleWrapperClass, children: toggleIconNode })
838
- ]
839
- }
734
+ var uniqueIdCounter = 0;
735
+ var generateId = (prefix) => `${prefix}-${++uniqueIdCounter}`;
736
+ var ExpansionPanelItemInner = class extends Component {
737
+ constructor(props) {
738
+ super(props);
739
+ this.handleToggle = () => {
740
+ const { disabled = false } = this.props;
741
+ if (disabled) {
742
+ return;
743
+ }
744
+ const context = this.context;
745
+ const panelValue = this.props.value ?? this.generatedValue;
746
+ if (context) {
747
+ context.toggle(panelValue, disabled);
748
+ return;
749
+ }
750
+ this.setState((prev) => ({ standaloneExpanded: !prev.standaloneExpanded }));
751
+ };
752
+ this.state = { standaloneExpanded: false };
753
+ this.generatedValue = generateId("expansion-panel-value");
754
+ this.headerId = generateId("expansion-panel-header");
755
+ this.contentId = generateId("expansion-panel-content");
756
+ }
757
+ render() {
758
+ const {
759
+ value,
760
+ title,
761
+ subtitle,
762
+ text,
763
+ prepend,
764
+ append,
765
+ expandIcon,
766
+ collapseIcon,
767
+ hideToggleIcon = false,
768
+ headerClassName,
769
+ contentClassName,
770
+ className,
771
+ disabled = false,
772
+ children,
773
+ color: colorOverride,
774
+ forwardedRef,
775
+ ...rest
776
+ } = this.props;
777
+ const context = this.context;
778
+ const panelValue = value ?? this.generatedValue;
779
+ const density = context?.density ?? "default";
780
+ const color = colorOverride ?? context?.color ?? "primary";
781
+ const divider = context?.divider ?? true;
782
+ const variant = context?.variant ?? "elevated";
783
+ const rounded = context?.rounded ?? "lg";
784
+ const accent = accentClasses2[color] ?? accentClasses2.primary;
785
+ const isExpanded = context ? context.expandedValues.includes(panelValue) : this.state.standaloneExpanded;
786
+ const rootSurface = divider ? "bg-transparent border-0 shadow-none" : itemVariantClasses[variant];
787
+ const shapeClass = divider ? void 0 : roundedClasses[rounded] ?? roundedClasses.lg;
788
+ const densityPadding = densityClasses2[density] ?? densityClasses2.default;
789
+ const disabledClass = disabled ? "cursor-not-allowed opacity-60" : "cursor-pointer";
790
+ const titleClass = isExpanded ? accent.text : void 0;
791
+ const activeBorderClass = twMerge("border-l-2 border-transparent", isExpanded ? accent.border : void 0);
792
+ const defaultToggleIcon = /* @__PURE__ */ jsx("i", { className: "mdi mdi-chevron-down text-lg leading-none transition-transform duration-200", "aria-hidden": true });
793
+ const hasContent = Boolean(children ?? text);
794
+ const contentAnimationClass = isExpanded ? "pb-5 opacity-100" : "pb-0 opacity-0";
795
+ const toggleIconNode = hideToggleIcon ? null : isExpanded && collapseIcon ? collapseIcon : expandIcon ?? defaultToggleIcon;
796
+ const shouldRotateDefaultIcon = !expandIcon && !collapseIcon && !hideToggleIcon;
797
+ const toggleWrapperClass = twMerge(
798
+ "ml-3 flex h-6 w-6 items-center justify-center text-gray-500 transition-transform duration-200",
799
+ shouldRotateDefaultIcon && isExpanded ? "rotate-180" : void 0
800
+ );
801
+ return /* @__PURE__ */ jsxs(
802
+ "div",
803
+ {
804
+ ...rest,
805
+ ref: forwardedRef,
806
+ className: twMerge(
807
+ "expansion-panel-item flex flex-col overflow-hidden transition-colors duration-200",
808
+ rootSurface,
809
+ shapeClass,
810
+ className
840
811
  ),
841
- hasContent && /* @__PURE__ */ jsx(
842
- "div",
843
- {
844
- className: "grid overflow-hidden border-t border-gray-100 transition-all duration-200 ease-in-out",
845
- style: { gridTemplateRows: isExpanded ? "1fr" : "0fr" },
846
- "aria-hidden": isExpanded ? void 0 : true,
847
- "data-state": isExpanded ? "open" : "closed",
848
- children: /* @__PURE__ */ jsx(
849
- "div",
850
- {
851
- id: contentId,
852
- role: "region",
853
- "aria-labelledby": headerId,
854
- "data-state": isExpanded ? "open" : "closed",
855
- className: twMerge(
856
- "min-h-0 px-4 pt-0 text-sm text-gray-600 transition-all duration-200",
857
- activeBorderClass,
858
- contentAnimationClass,
859
- isExpanded ? "pointer-events-auto" : "pointer-events-none",
860
- contentClassName
861
- ),
862
- children: children ?? text
863
- }
864
- )
865
- }
866
- )
867
- ]
868
- }
869
- );
870
- });
812
+ "data-state": isExpanded ? "open" : "closed",
813
+ "data-disabled": disabled || void 0,
814
+ children: [
815
+ /* @__PURE__ */ jsxs(
816
+ "button",
817
+ {
818
+ type: "button",
819
+ id: this.headerId,
820
+ onClick: this.handleToggle,
821
+ disabled,
822
+ "aria-expanded": isExpanded,
823
+ "aria-controls": hasContent ? this.contentId : void 0,
824
+ className: twMerge(
825
+ "flex w-full items-center gap-4 px-4 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",
826
+ densityPadding,
827
+ disabledClass,
828
+ isExpanded ? accent.bg : void 0,
829
+ headerClassName
830
+ ),
831
+ "data-state": isExpanded ? "open" : "closed",
832
+ children: [
833
+ prepend && /* @__PURE__ */ jsx("span", { className: "flex h-10 w-10 items-center justify-center text-gray-500", children: prepend }),
834
+ /* @__PURE__ */ jsxs("span", { className: "flex min-w-0 flex-1 flex-col gap-0.5 text-left", children: [
835
+ title && /* @__PURE__ */ jsx("span", { className: twMerge("truncate font-medium text-gray-900", titleClass), children: title }),
836
+ subtitle && /* @__PURE__ */ jsx("span", { className: "text-sm text-gray-500", children: subtitle })
837
+ ] }),
838
+ append && /* @__PURE__ */ jsx("span", { className: "ml-auto flex items-center gap-2 text-sm text-gray-500", children: append }),
839
+ !hideToggleIcon && /* @__PURE__ */ jsx("span", { className: toggleWrapperClass, children: toggleIconNode })
840
+ ]
841
+ }
842
+ ),
843
+ hasContent && /* @__PURE__ */ jsx(
844
+ "div",
845
+ {
846
+ className: "grid overflow-hidden border-t border-gray-100 transition-all duration-200 ease-in-out",
847
+ style: { gridTemplateRows: isExpanded ? "1fr" : "0fr" },
848
+ "aria-hidden": isExpanded ? void 0 : true,
849
+ "data-state": isExpanded ? "open" : "closed",
850
+ children: /* @__PURE__ */ jsx(
851
+ "div",
852
+ {
853
+ id: this.contentId,
854
+ role: "region",
855
+ "aria-labelledby": this.headerId,
856
+ "data-state": isExpanded ? "open" : "closed",
857
+ className: twMerge(
858
+ "min-h-0 px-4 pt-0 text-sm text-gray-600 transition-all duration-200",
859
+ activeBorderClass,
860
+ contentAnimationClass,
861
+ isExpanded ? "pointer-events-auto" : "pointer-events-none",
862
+ contentClassName
863
+ ),
864
+ children: children ?? text
865
+ }
866
+ )
867
+ }
868
+ )
869
+ ]
870
+ }
871
+ );
872
+ }
873
+ };
874
+ ExpansionPanelItemInner.contextType = ExpansionPanelContext;
875
+ var ExpansionPanelItem = forwardRef((props, ref) => /* @__PURE__ */ jsx(ExpansionPanelItemInner, { ...props, forwardedRef: ref }));
871
876
  ExpansionPanelItem.displayName = "ExpansionPanelItem";
872
877
  var ExpansionPanelItem_default = ExpansionPanelItem;
873
878
  var variantContainerClasses = {
@@ -895,80 +900,98 @@ var normalizeValues = (value, allowMultiple) => {
895
900
  return normalized.length ? [normalized[0]] : [];
896
901
  };
897
902
  var clampValues = (values, allowMultiple) => allowMultiple ? uniqueValues(values) : values.length ? [values[0]] : [];
898
- var ExpansionPanel = React4.forwardRef((props, ref) => {
899
- const {
900
- variant = "elevated",
901
- rounded = "lg",
902
- density = "default",
903
- color = "primary",
904
- divider = true,
905
- multiple = false,
906
- value,
907
- defaultValue,
908
- onChange,
909
- className,
910
- children,
911
- ...rest
912
- } = props;
913
- const isControlled = value !== void 0;
914
- const controlledValues = React4.useMemo(() => {
915
- if (!isControlled) {
916
- return void 0;
917
- }
918
- return normalizeValues(value, multiple);
919
- }, [isControlled, value, multiple]);
920
- const [internalValues, setInternalValues] = React4.useState(
921
- () => normalizeValues(defaultValue, multiple)
922
- );
923
- const expandedValues = controlledValues ?? internalValues;
924
- React4.useEffect(() => {
925
- if (!isControlled) {
926
- setInternalValues((prev) => clampValues(prev, multiple));
927
- }
928
- }, [multiple, isControlled]);
929
- const handleValueChange = React4.useCallback(
930
- (next) => {
903
+ var ExpansionPanelInner = class extends Component {
904
+ constructor(props) {
905
+ super(props);
906
+ this.isControlled = () => this.props.value !== void 0;
907
+ this.getExpandedValues = (allowMultiple = this.props.multiple ?? false) => {
908
+ if (this.isControlled()) {
909
+ return normalizeValues(this.props.value, allowMultiple);
910
+ }
911
+ return this.state.internalValues;
912
+ };
913
+ this.handleValueChange = (next) => {
914
+ const { onChange } = this.props;
915
+ const allowMultiple = this.props.multiple ?? false;
916
+ const isControlled = this.isControlled();
931
917
  if (!isControlled) {
932
- setInternalValues(next);
918
+ this.setState({ internalValues: next });
933
919
  }
934
920
  if (onChange) {
935
- if (multiple) {
921
+ if (allowMultiple) {
936
922
  onChange(next);
937
923
  } else {
938
924
  onChange(next[0] ?? null);
939
925
  }
940
926
  }
941
- },
942
- [isControlled, multiple, onChange]
943
- );
944
- const toggle = React4.useCallback(
945
- (panelValue, disabled) => {
927
+ };
928
+ this.handleToggle = (panelValue, disabled) => {
946
929
  if (disabled) {
947
930
  return;
948
931
  }
932
+ const allowMultiple = this.props.multiple ?? false;
933
+ const expandedValues = this.getExpandedValues(allowMultiple);
949
934
  const isActive = expandedValues.includes(panelValue);
950
- const next = multiple ? isActive ? expandedValues.filter((v) => v !== panelValue) : [...expandedValues, panelValue] : isActive ? [] : [panelValue];
951
- handleValueChange(next);
952
- },
953
- [expandedValues, handleValueChange, multiple]
954
- );
955
- const providerValue = React4.useMemo(
956
- () => ({ expandedValues, toggle, density, color, divider, rounded, variant }),
957
- [expandedValues, toggle, density, color, divider, rounded, variant]
958
- );
959
- const variantClass = divider ? variantContainerClasses[variant] : "bg-transparent border border-transparent shadow-none";
960
- const shapeClass = roundedClasses2[rounded] ?? roundedClasses2.lg;
961
- const layoutClass = divider ? "divide-y divide-gray-100 overflow-hidden" : "gap-4";
962
- return /* @__PURE__ */ jsx(ExpansionPanelContext.Provider, { value: providerValue, children: /* @__PURE__ */ jsx(
963
- "div",
964
- {
965
- ...rest,
966
- ref,
967
- className: twMerge("expansion-panel flex w-full flex-col text-gray-900", variantClass, shapeClass, layoutClass, className),
968
- children
935
+ const next = allowMultiple ? isActive ? expandedValues.filter((v) => v !== panelValue) : [...expandedValues, panelValue] : isActive ? [] : [panelValue];
936
+ this.handleValueChange(next);
937
+ };
938
+ const allowMultiple = props.multiple ?? false;
939
+ this.state = {
940
+ internalValues: normalizeValues(props.defaultValue, allowMultiple)
941
+ };
942
+ }
943
+ componentDidUpdate(prevProps) {
944
+ const allowMultiple = this.props.multiple ?? false;
945
+ const prevAllowMultiple = prevProps.multiple ?? false;
946
+ const isControlled = this.isControlled();
947
+ const wasControlled = prevProps.value !== void 0;
948
+ if (!isControlled && (allowMultiple !== prevAllowMultiple || wasControlled !== isControlled)) {
949
+ this.setState((prevState) => ({
950
+ internalValues: clampValues(prevState.internalValues, allowMultiple)
951
+ }));
969
952
  }
970
- ) });
971
- });
953
+ }
954
+ render() {
955
+ const {
956
+ variant = "elevated",
957
+ rounded = "lg",
958
+ density = "default",
959
+ color = "primary",
960
+ divider = true,
961
+ multiple = false,
962
+ className,
963
+ children,
964
+ forwardedRef,
965
+ value: _value,
966
+ defaultValue: _defaultValue,
967
+ onChange: _onChange,
968
+ ...rest
969
+ } = this.props;
970
+ const expandedValues = this.getExpandedValues(multiple);
971
+ const providerValue = {
972
+ expandedValues,
973
+ toggle: this.handleToggle,
974
+ density,
975
+ color,
976
+ divider,
977
+ rounded,
978
+ variant
979
+ };
980
+ const variantClass = divider ? variantContainerClasses[variant] : "bg-transparent border border-transparent shadow-none";
981
+ const shapeClass = roundedClasses2[rounded] ?? roundedClasses2.lg;
982
+ const layoutClass = divider ? "divide-y divide-gray-100 overflow-hidden" : "gap-4";
983
+ return /* @__PURE__ */ jsx(ExpansionPanelContext.Provider, { value: providerValue, children: /* @__PURE__ */ jsx(
984
+ "div",
985
+ {
986
+ ...rest,
987
+ ref: forwardedRef,
988
+ className: twMerge("expansion-panel flex w-full flex-col text-gray-900", variantClass, shapeClass, layoutClass, className),
989
+ children
990
+ }
991
+ ) });
992
+ }
993
+ };
994
+ var ExpansionPanel = forwardRef((props, ref) => /* @__PURE__ */ jsx(ExpansionPanelInner, { ...props, forwardedRef: ref }));
972
995
  ExpansionPanel.displayName = "ExpansionPanel";
973
996
  var ExpansionPanel_default = ExpansionPanel;
974
997
  var containerBaseClasses = "fixed inset-0 z-[70] flex items-center justify-center p-4 sm:p-8 data-[state=closed]:pointer-events-none";
@@ -981,7 +1004,7 @@ var resolveSizeValue = (value) => {
981
1004
  }
982
1005
  return typeof value === "number" ? `${value}px` : value;
983
1006
  };
984
- var Dialog = React4.forwardRef((props, forwardedRef) => {
1007
+ var Dialog = React3.forwardRef((props, forwardedRef) => {
985
1008
  const {
986
1009
  activator,
987
1010
  children,
@@ -1098,7 +1121,7 @@ var arrowPlacementClasses = {
1098
1121
  "right-start": "left-full top-4 -translate-x-1/2",
1099
1122
  "right-end": "left-full bottom-4 -translate-x-1/2"
1100
1123
  };
1101
- var ToolTip = React4.forwardRef((props, forwardedRef) => {
1124
+ var ToolTip = React3.forwardRef((props, forwardedRef) => {
1102
1125
  const {
1103
1126
  activator,
1104
1127
  children,