@lindle/linoardo 1.0.12 → 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 +255 -233
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +256 -234
- package/dist/index.js.map +1 -1
- package/dist/styles.css +3 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -354,46 +354,37 @@ var Chip = React3.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 = React3.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 = React3.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",
|
|
@@ -496,20 +487,20 @@ var ListItem = React3__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,
|
|
@@ -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 = React3.useMemo(() => {
|
|
937
|
-
if (!isControlled) {
|
|
938
|
-
return void 0;
|
|
939
|
-
}
|
|
940
|
-
return normalizeValues(value, multiple);
|
|
941
|
-
}, [isControlled, value, multiple]);
|
|
942
|
-
const [internalValues, setInternalValues] = React3.useState(
|
|
943
|
-
() => normalizeValues(defaultValue, multiple)
|
|
944
|
-
);
|
|
945
|
-
const expandedValues = controlledValues ?? internalValues;
|
|
946
|
-
React3.useEffect(() => {
|
|
947
|
-
if (!isControlled) {
|
|
948
|
-
setInternalValues((prev) => clampValues(prev, multiple));
|
|
949
|
-
}
|
|
950
|
-
}, [multiple, isControlled]);
|
|
951
|
-
const handleValueChange = React3.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 = React3.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";
|