@lindle/linoardo 1.0.37 → 1.0.39
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/chip.cjs +2 -2
- package/dist/chip.cjs.map +1 -1
- package/dist/chip.js +1 -1
- package/dist/{chunk-DJMAR7NV.js → chunk-5MVIF5GP.js} +8 -3
- package/dist/chunk-5MVIF5GP.js.map +1 -0
- package/dist/chunk-BDN4EDJQ.js +171 -0
- package/dist/chunk-BDN4EDJQ.js.map +1 -0
- package/dist/{chunk-XPEOXO2T.js → chunk-HJFHZNOV.js} +4 -4
- package/dist/{chunk-XPEOXO2T.js.map → chunk-HJFHZNOV.js.map} +1 -1
- package/dist/{chunk-5WQW6YSJ.js → chunk-L4UUC4EF.js} +48 -16
- package/dist/chunk-L4UUC4EF.js.map +1 -0
- package/dist/{chunk-AK7LFJI4.js → chunk-NADLY6LM.js} +17 -26
- package/dist/chunk-NADLY6LM.js.map +1 -0
- package/dist/index.cjs +183 -148
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +5 -5
- package/dist/list/item.cjs +46 -14
- package/dist/list/item.cjs.map +1 -1
- package/dist/list/item.js +1 -1
- package/dist/list.cjs +60 -37
- package/dist/list.cjs.map +1 -1
- package/dist/list.d.cts +7 -7
- package/dist/list.d.ts +7 -7
- package/dist/list.js +2 -2
- package/dist/profileCard.cjs +6 -1
- package/dist/profileCard.cjs.map +1 -1
- package/dist/profileCard.d.cts +1 -0
- package/dist/profileCard.d.ts +1 -0
- package/dist/profileCard.js +1 -1
- package/dist/select.cjs +118 -111
- package/dist/select.cjs.map +1 -1
- package/dist/select.d.cts +22 -16
- package/dist/select.d.ts +22 -16
- package/dist/select.js +2 -1
- package/dist/styles.css +174 -2
- package/package.json +1 -1
- package/readme.md +4 -0
- package/dist/chunk-5WQW6YSJ.js.map +0 -1
- package/dist/chunk-AK7LFJI4.js.map +0 -1
- package/dist/chunk-BZVDAMMY.js +0 -164
- package/dist/chunk-BZVDAMMY.js.map +0 -1
- package/dist/chunk-DJMAR7NV.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -438,9 +438,9 @@ var Chip = React4.forwardRef(
|
|
|
438
438
|
onKeyDown: isInteractive ? handleKeyDown : onKeyDown,
|
|
439
439
|
children: [
|
|
440
440
|
filterAdornment,
|
|
441
|
-
prependIconClassName && /* @__PURE__ */ jsxRuntime.jsx("i", { className: tailwindMerge.twMerge("text-[
|
|
441
|
+
prependIconClassName && /* @__PURE__ */ jsxRuntime.jsx("i", { className: tailwindMerge.twMerge("text-[1.125em] leading-none", prependIconClassName), "aria-hidden": true }),
|
|
442
442
|
renderableChildren,
|
|
443
|
-
appendIconClassName && /* @__PURE__ */ jsxRuntime.jsx("i", { className: tailwindMerge.twMerge("text-[
|
|
443
|
+
appendIconClassName && /* @__PURE__ */ jsxRuntime.jsx("i", { className: tailwindMerge.twMerge("text-[1.125em] leading-none", appendIconClassName), "aria-hidden": true }),
|
|
444
444
|
closable && /* @__PURE__ */ jsxRuntime.jsx(
|
|
445
445
|
"button",
|
|
446
446
|
{
|
|
@@ -642,7 +642,7 @@ var Alert = ({ className, children, ...rest }) => {
|
|
|
642
642
|
] });
|
|
643
643
|
};
|
|
644
644
|
var Alert_default = Alert;
|
|
645
|
-
var listItemBaseClasses = "relative flex w-full items-center gap-4 bg-transparent text-left text-sm transition-colors duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40 focus-visible:ring-offset-2 focus-visible:ring-offset-white hover:bg-neutral-200";
|
|
645
|
+
var listItemBaseClasses = "relative flex w-full items-center gap-4 bg-transparent text-left text-sm transition-colors duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40 focus-visible:ring-offset-2 focus-visible:ring-offset-white hover:bg-neutral-200 dark:focus-visible:ring-offset-gray-900 dark:hover:bg-white/5";
|
|
646
646
|
var densityClasses = {
|
|
647
647
|
default: "px-4 py-3 text-base",
|
|
648
648
|
comfortable: "px-4 py-2.5 text-sm",
|
|
@@ -654,14 +654,46 @@ var lineClasses = {
|
|
|
654
654
|
three: "min-h-[4.5rem]"
|
|
655
655
|
};
|
|
656
656
|
var accentClasses = {
|
|
657
|
-
primary: {
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
657
|
+
primary: {
|
|
658
|
+
text: "text-primary dark:text-primary",
|
|
659
|
+
bg: "bg-primary/10 dark:bg-primary/15",
|
|
660
|
+
indicator: "bg-primary"
|
|
661
|
+
},
|
|
662
|
+
neutral: {
|
|
663
|
+
text: "text-gray-900 dark:text-gray-100",
|
|
664
|
+
bg: "bg-gray-100 dark:bg-white/10",
|
|
665
|
+
indicator: "bg-gray-900 dark:bg-gray-100"
|
|
666
|
+
},
|
|
667
|
+
info: {
|
|
668
|
+
text: "text-sky-600 dark:text-sky-400",
|
|
669
|
+
bg: "bg-sky-50 dark:bg-sky-500/15",
|
|
670
|
+
indicator: "bg-sky-500"
|
|
671
|
+
},
|
|
672
|
+
success: {
|
|
673
|
+
text: "text-emerald-600 dark:text-emerald-400",
|
|
674
|
+
bg: "bg-emerald-50 dark:bg-emerald-500/15",
|
|
675
|
+
indicator: "bg-emerald-500"
|
|
676
|
+
},
|
|
677
|
+
warning: {
|
|
678
|
+
text: "text-amber-700 dark:text-amber-400",
|
|
679
|
+
bg: "bg-amber-50 dark:bg-amber-500/15",
|
|
680
|
+
indicator: "bg-amber-500"
|
|
681
|
+
},
|
|
682
|
+
danger: {
|
|
683
|
+
text: "text-red-600 dark:text-red-400",
|
|
684
|
+
bg: "bg-red-50 dark:bg-red-500/15",
|
|
685
|
+
indicator: "bg-red-500"
|
|
686
|
+
},
|
|
687
|
+
surface: {
|
|
688
|
+
text: "text-gray-900 dark:text-gray-100",
|
|
689
|
+
bg: "bg-gray-100 dark:bg-white/10",
|
|
690
|
+
indicator: "bg-gray-900 dark:bg-gray-100"
|
|
691
|
+
},
|
|
692
|
+
bw: {
|
|
693
|
+
text: "text-gray-900 dark:text-gray-100",
|
|
694
|
+
bg: "bg-gray-100 dark:bg-white/10",
|
|
695
|
+
indicator: "bg-gray-900 dark:bg-gray-100"
|
|
696
|
+
}
|
|
665
697
|
};
|
|
666
698
|
var ListItem = React4__namespace.forwardRef((props, ref) => {
|
|
667
699
|
const {
|
|
@@ -746,39 +778,39 @@ var ListItem = React4__namespace.forwardRef((props, ref) => {
|
|
|
746
778
|
)
|
|
747
779
|
}
|
|
748
780
|
),
|
|
749
|
-
prepend && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex h-10 w-10 shrink-0 items-center justify-center text-base text-gray-500", children: prepend }),
|
|
781
|
+
prepend && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex h-10 w-10 shrink-0 items-center justify-center text-base text-gray-500 dark:text-gray-400", children: prepend }),
|
|
750
782
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex min-w-0 flex-col gap-0.5 text-left", children: [
|
|
751
|
-
overline && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[0.65rem] font-semibold uppercase tracking-wide text-gray-500", children: overline }),
|
|
783
|
+
overline && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[0.65rem] font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400", children: overline }),
|
|
752
784
|
title && /* @__PURE__ */ jsxRuntime.jsx(
|
|
753
785
|
"span",
|
|
754
786
|
{
|
|
755
787
|
className: tailwindMerge.twMerge(
|
|
756
|
-
"truncate font-medium text-gray-900",
|
|
788
|
+
"truncate font-medium text-gray-900 dark:text-gray-100",
|
|
757
789
|
active ? accent.text : void 0
|
|
758
790
|
),
|
|
759
791
|
children: title
|
|
760
792
|
}
|
|
761
793
|
),
|
|
762
|
-
subtitle && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-gray-500", children: subtitle }),
|
|
794
|
+
subtitle && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-gray-500 dark:text-gray-400", children: subtitle }),
|
|
763
795
|
children
|
|
764
796
|
] }),
|
|
765
|
-
append && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-auto flex items-center gap-2 whitespace-nowrap text-sm text-gray-500", children: append })
|
|
797
|
+
append && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-auto flex items-center gap-2 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400", children: append })
|
|
766
798
|
]
|
|
767
799
|
}
|
|
768
800
|
);
|
|
769
801
|
});
|
|
770
802
|
ListItem.displayName = "ListItem";
|
|
771
803
|
var Item_default = ListItem;
|
|
772
|
-
var listBaseClasses = "flex w-full min-w-0 flex-col text-gray-900 transition-colors duration-150";
|
|
804
|
+
var listBaseClasses = "flex w-full min-w-0 flex-col text-gray-900 transition-colors duration-150 dark:text-gray-100";
|
|
773
805
|
var listVariantClasses = {
|
|
774
|
-
solid: "bg-white border border-gray-200 shadow-sm shadow-gray-900/5",
|
|
775
|
-
sharp: "bg-white border border-gray-200 shadow-sm shadow-gray-900/5 rounded-none",
|
|
776
|
-
outline: "bg-transparent border border-gray-300",
|
|
777
|
-
ghost: "bg-gray-50 border border-transparent",
|
|
806
|
+
solid: "bg-white border border-gray-200 shadow-sm shadow-gray-900/5 dark:bg-gray-900 dark:border-gray-800 dark:shadow-black/20",
|
|
807
|
+
sharp: "bg-white border border-gray-200 shadow-sm shadow-gray-900/5 rounded-none dark:bg-gray-900 dark:border-gray-800 dark:shadow-black/20",
|
|
808
|
+
outline: "bg-transparent border border-gray-300 dark:border-gray-700",
|
|
809
|
+
ghost: "bg-gray-50 border border-transparent dark:bg-gray-900/60",
|
|
778
810
|
text: "bg-transparent border border-transparent",
|
|
779
|
-
filled: "bg-gray-50 border border-gray-200 shadow-inner shadow-gray-900/5",
|
|
780
|
-
underlined: "bg-transparent border border-transparent border-b border-gray-200 rounded-none",
|
|
781
|
-
rounded: "bg-white border border-gray-200 shadow-lg shadow-gray-900/10"
|
|
811
|
+
filled: "bg-gray-50 border border-gray-200 shadow-inner shadow-gray-900/5 dark:bg-gray-900/70 dark:border-gray-800 dark:shadow-black/30",
|
|
812
|
+
underlined: "bg-transparent border border-transparent border-b border-gray-200 rounded-none dark:border-gray-800",
|
|
813
|
+
rounded: "bg-white border border-gray-200 shadow-lg shadow-gray-900/10 dark:bg-gray-900 dark:border-gray-800 dark:shadow-black/30"
|
|
782
814
|
};
|
|
783
815
|
var listRoundedClasses = {
|
|
784
816
|
none: "rounded-none",
|
|
@@ -812,7 +844,7 @@ var List = React4__namespace.forwardRef((props, ref) => {
|
|
|
812
844
|
const isSharpVariant = variant === "sharp";
|
|
813
845
|
const variantClass = listVariantClasses[variant] ?? listVariantClasses.solid;
|
|
814
846
|
const roundedClass = isSharpVariant ? "rounded-none" : listRoundedClasses[rounded] ?? listRoundedClasses.lg;
|
|
815
|
-
const dividerClass = divided ? "divide-y divide-gray-100" : void 0;
|
|
847
|
+
const dividerClass = divided ? "divide-y divide-gray-100 dark:divide-gray-800" : void 0;
|
|
816
848
|
const gapClass = divided ? "p-0" : "gap-1 p-1";
|
|
817
849
|
const navClass = nav ? "py-1" : void 0;
|
|
818
850
|
const accentColor = color;
|
|
@@ -831,10 +863,7 @@ var List = React4__namespace.forwardRef((props, ref) => {
|
|
|
831
863
|
});
|
|
832
864
|
}
|
|
833
865
|
if (child.props && typeof child.props === "object" && "children" in child.props) {
|
|
834
|
-
const nestedChildren = React4__namespace.Children.map(
|
|
835
|
-
child.props.children,
|
|
836
|
-
enhanceChild
|
|
837
|
-
);
|
|
866
|
+
const nestedChildren = React4__namespace.Children.map(child.props.children, enhanceChild);
|
|
838
867
|
if (nestedChildren !== child.props.children) {
|
|
839
868
|
return React4__namespace.cloneElement(child, void 0, nestedChildren);
|
|
840
869
|
}
|
|
@@ -848,21 +877,15 @@ var List = React4__namespace.forwardRef((props, ref) => {
|
|
|
848
877
|
...rest,
|
|
849
878
|
ref,
|
|
850
879
|
role: role ?? "list",
|
|
851
|
-
className: tailwindMerge.twMerge(
|
|
852
|
-
listBaseClasses,
|
|
853
|
-
variantClass,
|
|
854
|
-
roundedClass,
|
|
855
|
-
dividerClass,
|
|
856
|
-
gapClass,
|
|
857
|
-
navClass,
|
|
858
|
-
className
|
|
859
|
-
),
|
|
880
|
+
className: tailwindMerge.twMerge(listBaseClasses, variantClass, roundedClass, dividerClass, gapClass, navClass, className),
|
|
860
881
|
children: resolvedChildren
|
|
861
882
|
}
|
|
862
883
|
);
|
|
863
884
|
});
|
|
864
885
|
List.displayName = "List";
|
|
865
|
-
var
|
|
886
|
+
var ListWithItem = List;
|
|
887
|
+
ListWithItem.Item = Item_default;
|
|
888
|
+
var List_default = ListWithItem;
|
|
866
889
|
var placementClasses = {
|
|
867
890
|
"bottom-start": "left-0 top-full origin-top-left",
|
|
868
891
|
bottom: "left-1/2 top-full -translate-x-1/2 origin-top",
|
|
@@ -2162,6 +2185,7 @@ var ProfileCard = ({
|
|
|
2162
2185
|
layout = "classic",
|
|
2163
2186
|
variant = "solid",
|
|
2164
2187
|
elevation = 0,
|
|
2188
|
+
interactive = false,
|
|
2165
2189
|
className,
|
|
2166
2190
|
...rest
|
|
2167
2191
|
}) => {
|
|
@@ -2172,6 +2196,8 @@ var ProfileCard = ({
|
|
|
2172
2196
|
const muted = dark ? "text-white/70" : "text-gray-600";
|
|
2173
2197
|
const accent = dark ? "text-white" : "text-gray-900";
|
|
2174
2198
|
const elevationClass = elevationClasses2[elevation] ?? elevationClasses2[0];
|
|
2199
|
+
const interactiveClass = interactive ? "transition-all duration-200 hover:-translate-y-0.5 hover:shadow-xl hover:z-10 focus-within:z-10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40 focus-visible:ring-offset-2 focus-visible:ring-offset-white dark:focus-visible:ring-offset-slate-900" : void 0;
|
|
2200
|
+
const tabIndexValue = interactive && rest.tabIndex === void 0 ? 0 : rest.tabIndex;
|
|
2175
2201
|
const content = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2176
2202
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
2177
2203
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
@@ -2220,11 +2246,13 @@ var ProfileCard = ({
|
|
|
2220
2246
|
"article",
|
|
2221
2247
|
{
|
|
2222
2248
|
...rest,
|
|
2249
|
+
tabIndex: tabIndexValue,
|
|
2223
2250
|
className: tailwindMerge.twMerge(
|
|
2224
|
-
"profile-card relative overflow-hidden p-6 transition
|
|
2251
|
+
"profile-card relative overflow-hidden p-6 transition-colors",
|
|
2225
2252
|
baseVariant,
|
|
2226
2253
|
cardRadius,
|
|
2227
2254
|
elevationClass,
|
|
2255
|
+
interactiveClass,
|
|
2228
2256
|
className
|
|
2229
2257
|
),
|
|
2230
2258
|
children: layoutMap[layout] ?? layoutMap.classic
|
|
@@ -2872,7 +2900,7 @@ var variantClasses4 = {
|
|
|
2872
2900
|
text: "rounded-none border-0 border-b border-transparent pl-0 pr-10 bg-transparent focus-visible:border-primary focus-visible:ring-0 focus-visible:ring-transparent dark:border-b-gray-600 dark:focus-visible:border-primary/70",
|
|
2873
2901
|
ghost: "rounded border border-transparent bg-gray-50 text-gray-900 focus-visible:bg-white focus-visible:border-primary focus-visible:ring-2 focus-visible:ring-primary/15 dark:bg-slate-800 dark:text-gray-100 dark:focus-visible:bg-slate-700 dark:focus-visible:border-primary/60 dark:focus-visible:ring-primary/25",
|
|
2874
2902
|
filled: "rounded border border-gray-200 bg-gray-100 focus-visible:border-primary focus-visible:ring-2 focus-visible:ring-primary/25 dark:border-gray-700 dark:bg-slate-800 dark:focus-visible:border-primary/60 dark:focus-visible:ring-primary/30",
|
|
2875
|
-
underlined: "rounded-none border-0 border-b border-gray-300 pl-0 pr-10 bg-transparent focus-visible:border-primary focus-visible:ring-0 focus-visible:ring-transparent dark:border-b-gray-
|
|
2903
|
+
underlined: "rounded-none border-0 border-b border-gray-300 pl-0 pr-10 bg-transparent focus-visible:border-primary focus-visible:ring-0 focus-visible:ring-transparent dark:border-b-gray-300 dark:focus-visible:border-primary/70",
|
|
2876
2904
|
rounded: "rounded-full pl-4 pr-10 border border-gray-300 bg-white focus-visible:border-primary focus-visible:ring-2 focus-visible:ring-primary/20 shadow-sm dark:border-gray-600 dark:bg-slate-900 dark:focus-visible:border-primary/70 dark:focus-visible:ring-primary/30 dark:shadow-black/20"
|
|
2877
2905
|
};
|
|
2878
2906
|
var sizeClasses2 = {
|
|
@@ -2888,6 +2916,35 @@ var normalizeOption = (option) => {
|
|
|
2888
2916
|
}
|
|
2889
2917
|
return option;
|
|
2890
2918
|
};
|
|
2919
|
+
var toIdSafe = (value) => {
|
|
2920
|
+
const sanitized = value.replace(/\s+/g, "-").replace(/[^A-Za-z0-9_-]/g, "");
|
|
2921
|
+
return sanitized || "opt";
|
|
2922
|
+
};
|
|
2923
|
+
var resolveIconClassName5 = (icon) => {
|
|
2924
|
+
if (!icon) {
|
|
2925
|
+
return void 0;
|
|
2926
|
+
}
|
|
2927
|
+
if (typeof icon === "string") {
|
|
2928
|
+
const trimmed = icon.trim();
|
|
2929
|
+
if (!trimmed) {
|
|
2930
|
+
return void 0;
|
|
2931
|
+
}
|
|
2932
|
+
if (trimmed.includes(" ")) {
|
|
2933
|
+
return trimmed;
|
|
2934
|
+
}
|
|
2935
|
+
const normalizedName2 = trimmed.startsWith("mdi-") ? trimmed : `mdi-${trimmed}`;
|
|
2936
|
+
return ["mdi", normalizedName2].join(" ");
|
|
2937
|
+
}
|
|
2938
|
+
const [library, iconNameRaw] = icon;
|
|
2939
|
+
const baseClasses = iconBaseClasses[library] ?? [library];
|
|
2940
|
+
const iconName = iconNameRaw.trim();
|
|
2941
|
+
if (!iconName) {
|
|
2942
|
+
return baseClasses.join(" ");
|
|
2943
|
+
}
|
|
2944
|
+
const normalizedName = iconName.startsWith("mdi-") ? iconName : `mdi-${iconName}`;
|
|
2945
|
+
const classes = [...baseClasses, normalizedName];
|
|
2946
|
+
return Array.from(new Set(classes)).join(" ");
|
|
2947
|
+
};
|
|
2891
2948
|
var Select = ({
|
|
2892
2949
|
options,
|
|
2893
2950
|
label,
|
|
@@ -2899,124 +2956,102 @@ var Select = ({
|
|
|
2899
2956
|
id,
|
|
2900
2957
|
name,
|
|
2901
2958
|
multiple,
|
|
2902
|
-
onFocus,
|
|
2903
|
-
onBlur,
|
|
2904
|
-
onChange,
|
|
2905
2959
|
value,
|
|
2906
2960
|
defaultValue,
|
|
2961
|
+
error,
|
|
2962
|
+
helperText,
|
|
2963
|
+
disabled,
|
|
2964
|
+
required,
|
|
2965
|
+
onChange,
|
|
2907
2966
|
...props
|
|
2908
2967
|
}) => {
|
|
2909
2968
|
const selectId = id || name || generateString();
|
|
2910
|
-
const selectName = name || selectId;
|
|
2911
2969
|
const variantClass = variantClasses4[variant] ?? variantClasses4.outline;
|
|
2912
2970
|
const sizeConfig = sizeClasses2[size] ?? sizeClasses2.medium;
|
|
2913
2971
|
const sizeClass = `${sizeConfig.padding} ${sizeConfig.text}`;
|
|
2914
2972
|
const normalizedOptions = options.map(normalizeOption);
|
|
2915
|
-
const
|
|
2916
|
-
const
|
|
2917
|
-
const
|
|
2918
|
-
const
|
|
2919
|
-
const
|
|
2920
|
-
const [hasValue, setHasValue] = React4__namespace.default.useState(() => {
|
|
2921
|
-
const initial = value ?? defaultValue;
|
|
2922
|
-
if (initial === void 0 || initial === null) return false;
|
|
2923
|
-
if (multiple) {
|
|
2924
|
-
if (Array.isArray(initial)) return initial.length > 0;
|
|
2925
|
-
return String(initial).length > 0;
|
|
2926
|
-
}
|
|
2927
|
-
if (Array.isArray(initial)) {
|
|
2928
|
-
if (initial.length === 0) return false;
|
|
2929
|
-
return String(initial[0]).length > 0;
|
|
2930
|
-
}
|
|
2931
|
-
return String(initial).length > 0;
|
|
2932
|
-
});
|
|
2933
|
-
const isControlled = value !== void 0;
|
|
2934
|
-
React4__namespace.default.useEffect(() => {
|
|
2935
|
-
if (!isControlled) return;
|
|
2936
|
-
if (value === void 0 || value === null) {
|
|
2937
|
-
setHasValue(false);
|
|
2938
|
-
return;
|
|
2939
|
-
}
|
|
2940
|
-
if (multiple) {
|
|
2941
|
-
if (Array.isArray(value)) {
|
|
2942
|
-
setHasValue(value.length > 0);
|
|
2943
|
-
} else {
|
|
2944
|
-
setHasValue(String(value).length > 0);
|
|
2945
|
-
}
|
|
2946
|
-
return;
|
|
2947
|
-
}
|
|
2948
|
-
if (Array.isArray(value)) {
|
|
2949
|
-
setHasValue(value.length > 0 ? String(value[0]).length > 0 : false);
|
|
2950
|
-
return;
|
|
2951
|
-
}
|
|
2952
|
-
setHasValue(String(value).length > 0);
|
|
2953
|
-
}, [isControlled, multiple, value]);
|
|
2954
|
-
const placeholderOptionLabel = hidePlaceholderUntilFocus && !isFocused ? " " : placeholderText;
|
|
2955
|
-
const shouldRenderPlaceholder = !multiple && placeholderText !== void 0;
|
|
2956
|
-
const labelShouldFloat = hasValue || isFocused;
|
|
2957
|
-
const labelLeftClass = "left-3";
|
|
2958
|
-
const labelBgDefault = ["outline", "text", "underlined"].includes(variant) ? "bg-transparent" : "bg-white/90 dark:bg-slate-900";
|
|
2959
|
-
const handleFocus = (event) => {
|
|
2960
|
-
if (hidePlaceholderUntilFocus) setIsFocused(true);
|
|
2961
|
-
onFocus?.(event);
|
|
2962
|
-
};
|
|
2963
|
-
const handleBlur = (event) => {
|
|
2964
|
-
if (hidePlaceholderUntilFocus) setIsFocused(false);
|
|
2965
|
-
onBlur?.(event);
|
|
2966
|
-
};
|
|
2967
|
-
const handleChange = (event) => {
|
|
2968
|
-
if (!isControlled) {
|
|
2969
|
-
const nextHasValue = multiple ? event.target.selectedOptions.length > 0 : event.target.value !== "";
|
|
2970
|
-
setHasValue(nextHasValue);
|
|
2971
|
-
}
|
|
2973
|
+
const selectedValueList = value !== void 0 ? (Array.isArray(value) ? value : [value]).map(String) : defaultValue !== void 0 ? (Array.isArray(defaultValue) ? defaultValue : [defaultValue]).map(String) : [];
|
|
2974
|
+
const selectedLabels = normalizedOptions.filter((option) => selectedValueList.includes(String(option.value))).map((option) => option.label);
|
|
2975
|
+
const hasSelection = selectedLabels.length > 0;
|
|
2976
|
+
const summaryText = hasSelection ? multiple ? selectedLabels.join(", ") : selectedLabels[0] : placeholder || "\xA0";
|
|
2977
|
+
const handleOptionChange = (event) => {
|
|
2972
2978
|
onChange?.(event);
|
|
2979
|
+
if (multiple) return;
|
|
2980
|
+
const detailsEl = event.currentTarget.closest("details");
|
|
2981
|
+
detailsEl?.removeAttribute("open");
|
|
2973
2982
|
};
|
|
2974
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
2975
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2976
|
-
"
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2983
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: tailwindMerge.twMerge("flex flex-col gap-1", wrapperClassName), children: [
|
|
2984
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
|
|
2985
|
+
/* @__PURE__ */ jsxRuntime.jsxs("details", { className: "group w-full", ...props, open: void 0, children: [
|
|
2986
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2987
|
+
"summary",
|
|
2988
|
+
{
|
|
2989
|
+
className: tailwindMerge.twMerge(
|
|
2990
|
+
baseClass2,
|
|
2991
|
+
variantClass,
|
|
2992
|
+
sizeClass,
|
|
2993
|
+
"list-none cursor-pointer flex items-center justify-between pr-10 relative [&::-webkit-details-marker]:hidden",
|
|
2994
|
+
error && "border-red-500 focus-visible:border-red-500 focus-visible:ring-red-500",
|
|
2995
|
+
disabled && "pointer-events-none opacity-50 cursor-not-allowed",
|
|
2996
|
+
className
|
|
2997
|
+
),
|
|
2998
|
+
style: { minHeight: "2.75rem" },
|
|
2999
|
+
onClick: (e) => disabled && e.preventDefault(),
|
|
3000
|
+
children: [
|
|
3001
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: tailwindMerge.twMerge("truncate", !hasSelection && "text-gray-500 dark:text-gray-400"), children: summaryText }),
|
|
3002
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pointer-events-none absolute inset-y-0 right-3 flex items-center text-gray-500 dark:text-gray-300", children: /* @__PURE__ */ jsxRuntime.jsx("i", { className: "mdi mdi-chevron-down text-base leading-none transition-transform duration-200 group-open:rotate-180", "aria-hidden": true }) })
|
|
3003
|
+
]
|
|
3004
|
+
}
|
|
3005
|
+
),
|
|
3006
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute z-50 mt-1 max-h-60 w-full overflow-auto rounded-lg border border-gray-200 bg-white py-1 shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none dark:bg-slate-800 dark:border-slate-700", children: normalizedOptions.map((option, index) => {
|
|
3007
|
+
const optionValueStr = String(option.value);
|
|
3008
|
+
const isSelected = Array.isArray(value) ? value.map(String).includes(optionValueStr) : String(value) === optionValueStr;
|
|
3009
|
+
const isDefaultSelected = Array.isArray(defaultValue) ? defaultValue.map(String).includes(optionValueStr) : String(defaultValue) === optionValueStr;
|
|
3010
|
+
const iconClassName = resolveIconClassName5(option.icon);
|
|
3011
|
+
const inputId = `${selectId}-${toIdSafe(optionValueStr)}-${index}`;
|
|
3012
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3013
|
+
"label",
|
|
2992
3014
|
{
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
3015
|
+
htmlFor: inputId,
|
|
3016
|
+
className: tailwindMerge.twMerge(
|
|
3017
|
+
"relative flex cursor-pointer select-none items-center gap-2 px-4 py-2 text-sm text-gray-900 hover:bg-gray-50 dark:text-gray-100 dark:hover:bg-slate-700",
|
|
3018
|
+
option.disabled && "cursor-not-allowed opacity-50"
|
|
3019
|
+
),
|
|
3020
|
+
children: [
|
|
3021
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3022
|
+
"input",
|
|
3023
|
+
{
|
|
3024
|
+
type: multiple ? "checkbox" : "radio",
|
|
3025
|
+
id: inputId,
|
|
3026
|
+
name: name || selectId,
|
|
3027
|
+
value: option.value,
|
|
3028
|
+
disabled: option.disabled || disabled,
|
|
3029
|
+
checked: value !== void 0 ? isSelected : void 0,
|
|
3030
|
+
defaultChecked: defaultValue !== void 0 ? isDefaultSelected : void 0,
|
|
3031
|
+
onChange: handleOptionChange,
|
|
3032
|
+
required: required && !multiple,
|
|
3033
|
+
className: "peer sr-only"
|
|
3034
|
+
}
|
|
3035
|
+
),
|
|
3036
|
+
iconClassName && /* @__PURE__ */ jsxRuntime.jsx("i", { className: tailwindMerge.twMerge(iconClassName, "text-lg text-gray-500 peer-checked:text-primary dark:text-gray-400") }),
|
|
3037
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1 truncate peer-checked:font-medium peer-checked:text-primary", children: option.label }),
|
|
3038
|
+
/* @__PURE__ */ jsxRuntime.jsx("i", { className: "mdi mdi-check invisible ml-auto text-primary peer-checked:visible" })
|
|
3039
|
+
]
|
|
2996
3040
|
},
|
|
2997
|
-
`${
|
|
2998
|
-
)
|
|
2999
|
-
|
|
3000
|
-
}
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
"-top-1.5 left-1 text-xs px-1",
|
|
3012
|
-
isFocused ? "-translate-y-1/2 text-gray-600" : "-translate-y-2/3",
|
|
3013
|
-
labelBgDefault
|
|
3014
|
-
].join(" ") : "top-1/2 -translate-y-1/2 text-sm text-gray-500"
|
|
3015
|
-
),
|
|
3016
|
-
children: label
|
|
3017
|
-
}
|
|
3018
|
-
)
|
|
3019
|
-
] }) });
|
|
3041
|
+
`${optionValueStr}-${index}`
|
|
3042
|
+
);
|
|
3043
|
+
}) })
|
|
3044
|
+
] }),
|
|
3045
|
+
label && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3046
|
+
"label",
|
|
3047
|
+
{
|
|
3048
|
+
className: tailwindMerge.twMerge("absolute left-3 -top-1.5 text-xs bg-white px-1 text-gray-500 transition-all dark:bg-slate-900 dark:text-gray-400"),
|
|
3049
|
+
children: label
|
|
3050
|
+
}
|
|
3051
|
+
)
|
|
3052
|
+
] }),
|
|
3053
|
+
helperText && /* @__PURE__ */ jsxRuntime.jsx("p", { className: tailwindMerge.twMerge("mt-1 text-xs text-gray-500", error && "text-red-500"), children: helperText })
|
|
3054
|
+
] });
|
|
3020
3055
|
};
|
|
3021
3056
|
var Select_default = Select;
|
|
3022
3057
|
var paletteValues = {
|
|
@@ -3438,7 +3473,7 @@ var resolveVariantClass3 = (variant, type) => {
|
|
|
3438
3473
|
return "bg-white/95 text-gray-900 border border-gray-200";
|
|
3439
3474
|
}
|
|
3440
3475
|
};
|
|
3441
|
-
var
|
|
3476
|
+
var resolveIconClassName6 = (icon) => {
|
|
3442
3477
|
if (!icon) return void 0;
|
|
3443
3478
|
if (typeof icon === "string") {
|
|
3444
3479
|
const trimmed = icon.trim();
|
|
@@ -3453,7 +3488,7 @@ var resolveIconClassName5 = (icon) => {
|
|
|
3453
3488
|
};
|
|
3454
3489
|
var resolveIconNode = (icon, fallbackClassName) => {
|
|
3455
3490
|
if (React4__namespace.isValidElement(icon)) return icon;
|
|
3456
|
-
const iconClassName =
|
|
3491
|
+
const iconClassName = resolveIconClassName6(icon) ?? fallbackClassName;
|
|
3457
3492
|
if (!iconClassName) return null;
|
|
3458
3493
|
const hasBase = iconClassName.split(" ").some((token) => token.trim() === "mdi");
|
|
3459
3494
|
const hasGlyph = iconClassName.includes("mdi-");
|