@lindle/linoardo 1.0.42 → 1.0.43
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/chunk-F3PI7A6V.js +200 -0
- package/dist/chunk-F3PI7A6V.js.map +1 -0
- package/dist/index.cjs +240 -107
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +22 -2
- package/dist/index.d.ts +22 -2
- package/dist/index.js +121 -11
- package/dist/index.js.map +1 -1
- package/dist/select.cjs +128 -105
- package/dist/select.cjs.map +1 -1
- package/dist/select.d.cts +1 -0
- package/dist/select.d.ts +1 -0
- package/dist/select.js +1 -1
- package/dist/styles.css +41 -0
- package/package.json +1 -1
- package/dist/chunk-LULQOD2K.js +0 -177
- package/dist/chunk-LULQOD2K.js.map +0 -1
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { generateString } from './chunk-6SKW43XI.js';
|
|
2
|
+
import { iconBaseClasses } from './chunk-IEILIKS2.js';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { twMerge } from 'tailwind-merge';
|
|
5
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
6
|
+
|
|
7
|
+
var baseClass = "select-base w-full appearance-none focus-visible:outline-none focus-visible:ring-primary transition-colors duration-200 disabled:opacity-50 disabled:cursor-not-allowed bg-white text-gray-900 placeholder:text-gray-500 dark:bg-slate-900 dark:text-gray-100 dark:placeholder:text-gray-400";
|
|
8
|
+
var variantClasses = {
|
|
9
|
+
solid: "rounded border border-gray-400 bg-white shadow-sm focus-visible:border-primary focus-visible:ring-2 focus-visible:ring-primary/30 dark:border-gray-600 dark:bg-slate-900 dark:shadow-black/20 dark:focus-visible:border-primary/70 dark:focus-visible:ring-primary/40",
|
|
10
|
+
sharp: "rounded-none border border-gray-400 bg-white shadow-sm focus-visible:border-primary focus-visible:ring-2 focus-visible:ring-primary/30 dark:border-gray-600 dark:bg-slate-900 dark:shadow-black/20 dark:focus-visible:border-primary/70 dark:focus-visible:ring-primary/40",
|
|
11
|
+
outline: "rounded border-2 border-black bg-white focus-visible:border-black focus-visible:ring-2 focus-visible:ring-black/30 dark:border-black dark:bg-transparent dark:focus-visible:border-black dark:focus-visible:ring-black/40",
|
|
12
|
+
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",
|
|
13
|
+
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",
|
|
14
|
+
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",
|
|
15
|
+
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",
|
|
16
|
+
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"
|
|
17
|
+
};
|
|
18
|
+
var sizeClasses = {
|
|
19
|
+
"x-small": { padding: "pl-2 pr-8 py-2", text: "text-xs" },
|
|
20
|
+
small: { padding: "pl-2.5 pr-9 py-2.5", text: "text-sm" },
|
|
21
|
+
medium: { padding: "pl-3 pr-10 py-3", text: "text-base" },
|
|
22
|
+
large: { padding: "pl-3.5 pr-11 py-3.5", text: "text-lg" },
|
|
23
|
+
"x-large": { padding: "pl-4 pr-12 py-4", text: "text-xl" }
|
|
24
|
+
};
|
|
25
|
+
var normalizeOption = (option) => {
|
|
26
|
+
if (typeof option === "string") {
|
|
27
|
+
return { label: option, value: option };
|
|
28
|
+
}
|
|
29
|
+
return option;
|
|
30
|
+
};
|
|
31
|
+
var toIdSafe = (value) => {
|
|
32
|
+
const sanitized = value.replace(/\s+/g, "-").replace(/[^A-Za-z0-9_-]/g, "");
|
|
33
|
+
return sanitized || "opt";
|
|
34
|
+
};
|
|
35
|
+
var resolveIconClassName = (icon) => {
|
|
36
|
+
if (!icon) {
|
|
37
|
+
return void 0;
|
|
38
|
+
}
|
|
39
|
+
if (typeof icon === "string") {
|
|
40
|
+
const trimmed = icon.trim();
|
|
41
|
+
if (!trimmed) {
|
|
42
|
+
return void 0;
|
|
43
|
+
}
|
|
44
|
+
if (trimmed.includes(" ")) {
|
|
45
|
+
return trimmed;
|
|
46
|
+
}
|
|
47
|
+
const normalizedName2 = trimmed.startsWith("mdi-") ? trimmed : `mdi-${trimmed}`;
|
|
48
|
+
return ["mdi", normalizedName2].join(" ");
|
|
49
|
+
}
|
|
50
|
+
const [library, iconNameRaw] = icon;
|
|
51
|
+
const baseClasses = iconBaseClasses[library] ?? [library];
|
|
52
|
+
const iconName = iconNameRaw.trim();
|
|
53
|
+
if (!iconName) {
|
|
54
|
+
return baseClasses.join(" ");
|
|
55
|
+
}
|
|
56
|
+
const normalizedName = iconName.startsWith("mdi-") ? iconName : `mdi-${iconName}`;
|
|
57
|
+
const classes = [...baseClasses, normalizedName];
|
|
58
|
+
return Array.from(new Set(classes)).join(" ");
|
|
59
|
+
};
|
|
60
|
+
var Select = React.forwardRef(
|
|
61
|
+
({
|
|
62
|
+
options,
|
|
63
|
+
label,
|
|
64
|
+
placeholder,
|
|
65
|
+
variant = "outline",
|
|
66
|
+
size = "medium",
|
|
67
|
+
className,
|
|
68
|
+
wrapperClassName,
|
|
69
|
+
id,
|
|
70
|
+
name,
|
|
71
|
+
multiple,
|
|
72
|
+
value,
|
|
73
|
+
defaultValue,
|
|
74
|
+
error,
|
|
75
|
+
helperText,
|
|
76
|
+
disabled,
|
|
77
|
+
required,
|
|
78
|
+
onChange,
|
|
79
|
+
onBlur,
|
|
80
|
+
onFocus,
|
|
81
|
+
...props
|
|
82
|
+
}, ref) => {
|
|
83
|
+
const selectId = id || name || generateString();
|
|
84
|
+
const inputName = name || selectId;
|
|
85
|
+
const variantClass = variantClasses[variant] ?? variantClasses.outline;
|
|
86
|
+
const sizeConfig = sizeClasses[size] ?? sizeClasses.medium;
|
|
87
|
+
const sizeClass = `${sizeConfig.padding} ${sizeConfig.text}`;
|
|
88
|
+
const normalizedOptions = options.map(normalizeOption);
|
|
89
|
+
const selectedValueList = value !== void 0 ? (Array.isArray(value) ? value : [value]).map(String) : defaultValue !== void 0 ? (Array.isArray(defaultValue) ? defaultValue : [defaultValue]).map(String) : [];
|
|
90
|
+
const selectedLabels = normalizedOptions.filter((option) => selectedValueList.includes(String(option.value))).map((option) => option.label);
|
|
91
|
+
const hasSelection = selectedLabels.length > 0;
|
|
92
|
+
const summaryText = hasSelection ? multiple ? selectedLabels.join(", ") : selectedLabels[0] : placeholder || "\xA0";
|
|
93
|
+
const handleOptionChange = (event) => {
|
|
94
|
+
onChange?.(event);
|
|
95
|
+
if (multiple) return;
|
|
96
|
+
const detailsEl = event.currentTarget.closest("details");
|
|
97
|
+
detailsEl?.removeAttribute("open");
|
|
98
|
+
};
|
|
99
|
+
const handleDetailsBlur = (event) => {
|
|
100
|
+
const nextFocus = event.relatedTarget;
|
|
101
|
+
if (nextFocus && event.currentTarget.contains(nextFocus)) return;
|
|
102
|
+
event.currentTarget.removeAttribute("open");
|
|
103
|
+
};
|
|
104
|
+
const handleDetailsFocus = (event) => {
|
|
105
|
+
if (normalizedOptions.length === 0) {
|
|
106
|
+
onFocus?.(event);
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
return /* @__PURE__ */ jsxs("div", { className: twMerge("flex flex-col gap-1", wrapperClassName), children: [
|
|
110
|
+
/* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
111
|
+
/* @__PURE__ */ jsxs(
|
|
112
|
+
"details",
|
|
113
|
+
{
|
|
114
|
+
className: "group w-full",
|
|
115
|
+
...props,
|
|
116
|
+
onBlur: onBlur ? void 0 : handleDetailsBlur,
|
|
117
|
+
onFocus: onFocus ? handleDetailsFocus : void 0,
|
|
118
|
+
open: void 0,
|
|
119
|
+
children: [
|
|
120
|
+
/* @__PURE__ */ jsxs(
|
|
121
|
+
"summary",
|
|
122
|
+
{
|
|
123
|
+
className: twMerge(
|
|
124
|
+
baseClass,
|
|
125
|
+
variantClass,
|
|
126
|
+
sizeClass,
|
|
127
|
+
"list-none cursor-pointer flex items-center justify-between pr-10 relative [&::-webkit-details-marker]:hidden",
|
|
128
|
+
error && "border-red-500 focus-visible:border-red-500 focus-visible:ring-red-500",
|
|
129
|
+
disabled && "pointer-events-none opacity-50 cursor-not-allowed",
|
|
130
|
+
className
|
|
131
|
+
),
|
|
132
|
+
style: { minHeight: "2.75rem" },
|
|
133
|
+
onClick: (e) => disabled && e.preventDefault(),
|
|
134
|
+
children: [
|
|
135
|
+
/* @__PURE__ */ jsx("span", { className: twMerge("truncate", !hasSelection && "text-gray-500 dark:text-gray-400"), children: summaryText }),
|
|
136
|
+
/* @__PURE__ */ jsx("span", { className: "pointer-events-none absolute inset-y-0 right-3 flex items-center text-gray-500 dark:text-gray-300", children: /* @__PURE__ */ jsx("i", { className: "mdi mdi-chevron-down text-base leading-none transition-transform duration-200 group-open:rotate-180", "aria-hidden": true }) })
|
|
137
|
+
]
|
|
138
|
+
}
|
|
139
|
+
),
|
|
140
|
+
/* @__PURE__ */ 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) => {
|
|
141
|
+
const optionValueStr = String(option.value);
|
|
142
|
+
const isSelected = Array.isArray(value) ? value.map(String).includes(optionValueStr) : String(value) === optionValueStr;
|
|
143
|
+
const isDefaultSelected = Array.isArray(defaultValue) ? defaultValue.map(String).includes(optionValueStr) : String(defaultValue) === optionValueStr;
|
|
144
|
+
const iconClassName = resolveIconClassName(option.icon);
|
|
145
|
+
const inputId = `${selectId}-${toIdSafe(optionValueStr)}-${index}`;
|
|
146
|
+
return /* @__PURE__ */ jsxs(
|
|
147
|
+
"label",
|
|
148
|
+
{
|
|
149
|
+
htmlFor: inputId,
|
|
150
|
+
className: twMerge(
|
|
151
|
+
"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",
|
|
152
|
+
option.disabled && "cursor-not-allowed opacity-50"
|
|
153
|
+
),
|
|
154
|
+
children: [
|
|
155
|
+
/* @__PURE__ */ jsx(
|
|
156
|
+
"input",
|
|
157
|
+
{
|
|
158
|
+
type: multiple ? "checkbox" : "radio",
|
|
159
|
+
id: inputId,
|
|
160
|
+
name: inputName,
|
|
161
|
+
value: option.value,
|
|
162
|
+
disabled: option.disabled || disabled,
|
|
163
|
+
checked: value !== void 0 ? isSelected : void 0,
|
|
164
|
+
defaultChecked: defaultValue !== void 0 ? isDefaultSelected : void 0,
|
|
165
|
+
onChange: handleOptionChange,
|
|
166
|
+
onBlur,
|
|
167
|
+
ref,
|
|
168
|
+
required: required && !multiple,
|
|
169
|
+
className: "peer sr-only"
|
|
170
|
+
}
|
|
171
|
+
),
|
|
172
|
+
iconClassName && /* @__PURE__ */ jsx("i", { className: twMerge(iconClassName, "text-lg text-gray-500 peer-checked:text-primary dark:text-gray-400") }),
|
|
173
|
+
/* @__PURE__ */ jsx("span", { className: "flex-1 truncate peer-checked:font-medium peer-checked:text-primary", children: option.label }),
|
|
174
|
+
/* @__PURE__ */ jsx("i", { className: "mdi mdi-check invisible ml-auto text-primary peer-checked:visible" })
|
|
175
|
+
]
|
|
176
|
+
},
|
|
177
|
+
`${optionValueStr}-${index}`
|
|
178
|
+
);
|
|
179
|
+
}) })
|
|
180
|
+
]
|
|
181
|
+
}
|
|
182
|
+
),
|
|
183
|
+
label && /* @__PURE__ */ jsx(
|
|
184
|
+
"label",
|
|
185
|
+
{
|
|
186
|
+
className: 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"),
|
|
187
|
+
children: label
|
|
188
|
+
}
|
|
189
|
+
)
|
|
190
|
+
] }),
|
|
191
|
+
helperText && /* @__PURE__ */ jsx("p", { className: twMerge("mt-1 text-xs text-gray-500", error && "text-red-500"), children: helperText })
|
|
192
|
+
] });
|
|
193
|
+
}
|
|
194
|
+
);
|
|
195
|
+
Select.displayName = "Select";
|
|
196
|
+
var Select_default = Select;
|
|
197
|
+
|
|
198
|
+
export { Select_default };
|
|
199
|
+
//# sourceMappingURL=chunk-F3PI7A6V.js.map
|
|
200
|
+
//# sourceMappingURL=chunk-F3PI7A6V.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/Form/Select/index.tsx"],"names":["normalizedName"],"mappings":";;;;;;AAoCA,IAAM,SAAA,GACJ,8RAAA;AAEF,IAAM,cAAA,GAAiB;AAAA,EACrB,KAAA,EACE,uQAAA;AAAA,EACF,KAAA,EACE,4QAAA;AAAA,EACF,OAAA,EACE,2NAAA;AAAA,EACF,IAAA,EAAM,0NAAA;AAAA,EACN,KAAA,EACE,gTAAA;AAAA,EACF,MAAA,EACE,2OAAA;AAAA,EACF,UAAA,EACE,uNAAA;AAAA,EACF,OAAA,EACE;AACJ,CAAA;AAEA,IAAM,WAAA,GAAc;AAAA,EAClB,SAAA,EAAW,EAAE,OAAA,EAAS,gBAAA,EAAkB,MAAM,SAAA,EAAU;AAAA,EACxD,KAAA,EAAO,EAAE,OAAA,EAAS,oBAAA,EAAsB,MAAM,SAAA,EAAU;AAAA,EACxD,MAAA,EAAQ,EAAE,OAAA,EAAS,iBAA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,CAAO,WAAA,GAAc,QAAA;AAErB,IAAO,cAAA,GAAQ","file":"chunk-F3PI7A6V.js","sourcesContent":["import React from 'react';\nimport { twMerge } from 'tailwind-merge';\nimport { iconBaseClasses } from '@lindle/linoardo/globals';\nimport type { GlobalSize, PropIcon } from '@lindle/linoardo/global.types';\nimport type { InputVariant } from '../Input/types';\nimport { generateString } from '../../utils/helpers/randomStr';\n\nexport interface SelectOptionObject {\n value: string | number;\n label: string;\n disabled?: boolean;\n icon?: PropIcon;\n}\n\nexport type SelectOption = SelectOptionObject | string;\n\nexport interface SelectProps extends Omit<React.DetailsHTMLAttributes<HTMLDetailsElement>, 'onBlur' | 'onChange' | 'value' | 'defaultValue'> {\n options: SelectOption[];\n label?: string;\n placeholder?: string;\n variant?: InputVariant;\n size?: GlobalSize;\n wrapperClassName?: string;\n error?: boolean;\n helperText?: string;\n value?: string | number | readonly string[];\n defaultValue?: string | number | readonly string[];\n name?: string;\n multiple?: boolean;\n disabled?: boolean;\n required?: boolean;\n onChange?: React.ChangeEventHandler<HTMLInputElement>;\n onBlur?: React.FocusEventHandler<HTMLInputElement>;\n onFocus?: React.FocusEventHandler<HTMLDetailsElement>;\n}\n\nconst baseClass =\n 'select-base w-full appearance-none focus-visible:outline-none focus-visible:ring-primary transition-colors duration-200 disabled:opacity-50 disabled:cursor-not-allowed bg-white text-gray-900 placeholder:text-gray-500 dark:bg-slate-900 dark:text-gray-100 dark:placeholder:text-gray-400';\n\nconst variantClasses = {\n solid:\n 'rounded border border-gray-400 bg-white shadow-sm focus-visible:border-primary focus-visible:ring-2 focus-visible:ring-primary/30 dark:border-gray-600 dark:bg-slate-900 dark:shadow-black/20 dark:focus-visible:border-primary/70 dark:focus-visible:ring-primary/40',\n sharp:\n 'rounded-none border border-gray-400 bg-white shadow-sm focus-visible:border-primary focus-visible:ring-2 focus-visible:ring-primary/30 dark:border-gray-600 dark:bg-slate-900 dark:shadow-black/20 dark:focus-visible:border-primary/70 dark:focus-visible:ring-primary/40',\n outline:\n 'rounded border-2 border-black bg-white focus-visible:border-black focus-visible:ring-2 focus-visible:ring-black/30 dark:border-black dark:bg-transparent dark:focus-visible:border-black dark:focus-visible:ring-black/40',\n 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',\n ghost:\n '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',\n filled:\n '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',\n underlined:\n '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',\n rounded:\n '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'\n} satisfies Record<InputVariant, string>;\n\nconst sizeClasses = {\n 'x-small': { padding: 'pl-2 pr-8 py-2', text: 'text-xs' },\n small: { padding: 'pl-2.5 pr-9 py-2.5', text: 'text-sm' },\n medium: { padding: 'pl-3 pr-10 py-3', text: 'text-base' },\n large: { padding: 'pl-3.5 pr-11 py-3.5', text: 'text-lg' },\n 'x-large': { padding: 'pl-4 pr-12 py-4', text: 'text-xl' }\n} satisfies Record<GlobalSize, { padding: string; text: string }>;\n\nconst normalizeOption = (option: SelectOption): SelectOptionObject => {\n if (typeof option === 'string') {\n return { label: option, value: option };\n }\n return option;\n};\n\nconst toIdSafe = (value: string) => {\n const sanitized = value.replace(/\\s+/g, '-').replace(/[^A-Za-z0-9_-]/g, '');\n return sanitized || 'opt';\n};\n\nconst resolveIconClassName = (icon?: PropIcon) => {\n if (!icon) {\n return undefined;\n }\n\n if (typeof icon === 'string') {\n const trimmed = icon.trim();\n if (!trimmed) {\n return undefined;\n }\n\n if (trimmed.includes(' ')) {\n return trimmed;\n }\n\n const normalizedName = trimmed.startsWith('mdi-') ? trimmed : `mdi-${trimmed}`;\n return ['mdi', normalizedName].join(' ');\n }\n\n const [library, iconNameRaw] = icon;\n const baseClasses = iconBaseClasses[library] ?? [library];\n const iconName = iconNameRaw.trim();\n if (!iconName) {\n return baseClasses.join(' ');\n }\n\n const normalizedName = iconName.startsWith('mdi-') ? iconName : `mdi-${iconName}`;\n const classes = [...baseClasses, normalizedName];\n return Array.from(new Set(classes)).join(' ');\n};\n\n/**\n * Custom styled Select component using <details> and radio/checkbox inputs.\n * Supports icons and custom styling while remaining a Server Component (no hooks).\n */\nconst Select = React.forwardRef<HTMLInputElement, SelectProps>(\n (\n {\n options,\n label,\n placeholder,\n variant = 'outline',\n size = 'medium',\n className,\n wrapperClassName,\n id,\n name,\n multiple,\n value,\n defaultValue,\n error,\n helperText,\n disabled,\n required,\n onChange,\n onBlur,\n onFocus,\n ...props\n },\n ref\n ) => {\n const selectId = id || name || generateString();\n const inputName = name || selectId;\n const variantClass = variantClasses[variant] ?? variantClasses.outline;\n const sizeConfig = sizeClasses[size] ?? sizeClasses.medium;\n const sizeClass = `${sizeConfig.padding} ${sizeConfig.text}`;\n const normalizedOptions = options.map(normalizeOption);\n const selectedValueList =\n value !== undefined\n ? (Array.isArray(value) ? value : [value]).map(String)\n : defaultValue !== undefined\n ? (Array.isArray(defaultValue) ? defaultValue : [defaultValue]).map(String)\n : [];\n const selectedLabels = normalizedOptions.filter(option => selectedValueList.includes(String(option.value))).map(option => option.label);\n const hasSelection = selectedLabels.length > 0;\n const summaryText = hasSelection ? (multiple ? selectedLabels.join(', ') : selectedLabels[0]) : placeholder || '\\u00A0';\n const handleOptionChange: React.ChangeEventHandler<HTMLInputElement> = event => {\n onChange?.(event);\n if (multiple) return;\n const detailsEl = event.currentTarget.closest('details');\n detailsEl?.removeAttribute('open');\n };\n const handleDetailsBlur: React.FocusEventHandler<HTMLDetailsElement> = event => {\n const nextFocus = event.relatedTarget as Node | null;\n if (nextFocus && event.currentTarget.contains(nextFocus)) return;\n event.currentTarget.removeAttribute('open');\n };\n const handleDetailsFocus: React.FocusEventHandler<HTMLDetailsElement> = event => {\n if (normalizedOptions.length === 0) {\n onFocus?.(event);\n }\n };\n\n return (\n <div className={twMerge('flex flex-col gap-1', wrapperClassName)}>\n <div className='relative'>\n <details\n className='group w-full'\n {...props}\n onBlur={onBlur ? undefined : handleDetailsBlur}\n onFocus={onFocus ? handleDetailsFocus : undefined}\n open={undefined}\n >\n <summary\n className={twMerge(\n baseClass,\n variantClass,\n sizeClass,\n 'list-none cursor-pointer flex items-center justify-between pr-10 relative [&::-webkit-details-marker]:hidden',\n error && 'border-red-500 focus-visible:border-red-500 focus-visible:ring-red-500',\n disabled && 'pointer-events-none opacity-50 cursor-not-allowed',\n className\n )}\n style={{ minHeight: '2.75rem' }}\n onClick={e => disabled && e.preventDefault()}\n >\n <span className={twMerge('truncate', !hasSelection && 'text-gray-500 dark:text-gray-400')}>{summaryText}</span>\n <span className='pointer-events-none absolute inset-y-0 right-3 flex items-center text-gray-500 dark:text-gray-300'>\n <i className='mdi mdi-chevron-down text-base leading-none transition-transform duration-200 group-open:rotate-180' aria-hidden />\n </span>\n </summary>\n\n <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'>\n {normalizedOptions.map((option, index) => {\n const optionValueStr = String(option.value);\n const isSelected = Array.isArray(value) ? value.map(String).includes(optionValueStr) : String(value) === optionValueStr;\n const isDefaultSelected = Array.isArray(defaultValue)\n ? defaultValue.map(String).includes(optionValueStr)\n : String(defaultValue) === optionValueStr;\n const iconClassName = resolveIconClassName(option.icon);\n const inputId = `${selectId}-${toIdSafe(optionValueStr)}-${index}`;\n\n return (\n <label\n key={`${optionValueStr}-${index}`}\n htmlFor={inputId}\n className={twMerge(\n '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',\n option.disabled && 'cursor-not-allowed opacity-50'\n )}\n >\n <input\n type={multiple ? 'checkbox' : 'radio'}\n id={inputId}\n name={inputName}\n value={option.value}\n disabled={option.disabled || disabled}\n checked={value !== undefined ? isSelected : undefined}\n defaultChecked={defaultValue !== undefined ? isDefaultSelected : undefined}\n onChange={handleOptionChange}\n onBlur={onBlur}\n ref={ref}\n required={required && !multiple}\n className='peer sr-only'\n />\n {iconClassName && <i className={twMerge(iconClassName, 'text-lg text-gray-500 peer-checked:text-primary dark:text-gray-400')} />}\n <span className='flex-1 truncate peer-checked:font-medium peer-checked:text-primary'>{option.label}</span>\n <i className='mdi mdi-check invisible ml-auto text-primary peer-checked:visible' />\n </label>\n );\n })}\n </div>\n </details>\n\n {label && (\n <label\n className={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')}\n >\n {label}\n </label>\n )}\n </div>\n {helperText && <p className={twMerge('mt-1 text-xs text-gray-500', error && 'text-red-500')}>{helperText}</p>}\n </div>\n );\n }\n);\n\nSelect.displayName = 'Select';\n\nexport default Select;\n"]}
|
package/dist/index.cjs
CHANGED
|
@@ -1473,10 +1473,119 @@ var Dialog = React4__namespace.forwardRef((props, forwardedRef) => {
|
|
|
1473
1473
|
});
|
|
1474
1474
|
Dialog.displayName = "Dialog";
|
|
1475
1475
|
var Dialog_default = Dialog;
|
|
1476
|
+
var overlayBaseClasses3 = "fixed inset-0 z-[55] bg-gray-900/55 backdrop-blur-[2px] transition-opacity duration-200 data-[state=closed]:opacity-0 data-[state=open]:opacity-100";
|
|
1477
|
+
var temporaryContainerBaseClasses = "fixed inset-y-0 z-[60] flex max-w-full transition-transform duration-200";
|
|
1478
|
+
var staticContainerBaseClasses = "relative flex h-full max-w-full";
|
|
1479
|
+
var drawerBaseClasses = "flex h-full w-full flex-col bg-white text-gray-900 shadow-xl shadow-black/10 ring-1 ring-black/5 focus-visible:outline-none dark:bg-gray-900 dark:text-gray-100 dark:ring-white/10";
|
|
1480
|
+
var resolveSizeValue2 = (value) => {
|
|
1481
|
+
if (value === void 0) {
|
|
1482
|
+
return void 0;
|
|
1483
|
+
}
|
|
1484
|
+
return typeof value === "number" ? `${value}px` : value;
|
|
1485
|
+
};
|
|
1486
|
+
var Drawer = React4__namespace.forwardRef((props, ref) => {
|
|
1487
|
+
const {
|
|
1488
|
+
location = "left",
|
|
1489
|
+
floating = false,
|
|
1490
|
+
temporary = false,
|
|
1491
|
+
open,
|
|
1492
|
+
keepMounted = false,
|
|
1493
|
+
scrim = true,
|
|
1494
|
+
width = "18rem",
|
|
1495
|
+
onClose,
|
|
1496
|
+
containerClassName,
|
|
1497
|
+
overlayClassName,
|
|
1498
|
+
overlayProps,
|
|
1499
|
+
portal = true,
|
|
1500
|
+
portalContainer,
|
|
1501
|
+
className,
|
|
1502
|
+
style,
|
|
1503
|
+
role,
|
|
1504
|
+
...rest
|
|
1505
|
+
} = props;
|
|
1506
|
+
const isOpen = open ?? !temporary;
|
|
1507
|
+
const state = isOpen ? "open" : "closed";
|
|
1508
|
+
const shouldRender = keepMounted || isOpen || temporary;
|
|
1509
|
+
const resolvedPortalContainer = portalContainer ?? (typeof document !== "undefined" ? document.body : null);
|
|
1510
|
+
const resolvedStyle = { ...style };
|
|
1511
|
+
if (resolvedStyle.width === void 0) {
|
|
1512
|
+
resolvedStyle.width = resolveSizeValue2(width);
|
|
1513
|
+
}
|
|
1514
|
+
const locationClass = location === "right" ? "right-0" : "left-0";
|
|
1515
|
+
const translateClass = isOpen ? "translate-x-0" : location === "right" ? "translate-x-full" : "-translate-x-full";
|
|
1516
|
+
const floatingClasses = floating ? "rounded-2xl shadow-2xl shadow-black/20 ring-1 ring-black/10 dark:ring-white/10" : void 0;
|
|
1517
|
+
const borderClasses = !floating && !temporary ? location === "right" ? "border-l border-gray-200 dark:border-gray-800" : "border-r border-gray-200 dark:border-gray-800" : void 0;
|
|
1518
|
+
const {
|
|
1519
|
+
className: overlayExtraClassName,
|
|
1520
|
+
onClick: overlayOnClick,
|
|
1521
|
+
...restOverlayProps
|
|
1522
|
+
} = overlayProps ?? {};
|
|
1523
|
+
const overlayNode = temporary && scrim && shouldRender ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1524
|
+
"div",
|
|
1525
|
+
{
|
|
1526
|
+
...restOverlayProps,
|
|
1527
|
+
className: tailwindMerge.twMerge(
|
|
1528
|
+
overlayBaseClasses3,
|
|
1529
|
+
isOpen ? "pointer-events-auto opacity-100" : "pointer-events-none opacity-0",
|
|
1530
|
+
overlayClassName,
|
|
1531
|
+
overlayExtraClassName
|
|
1532
|
+
),
|
|
1533
|
+
onClick: (event) => {
|
|
1534
|
+
overlayOnClick?.(event);
|
|
1535
|
+
if (!event.defaultPrevented) {
|
|
1536
|
+
onClose?.();
|
|
1537
|
+
}
|
|
1538
|
+
},
|
|
1539
|
+
"data-state": state,
|
|
1540
|
+
"aria-hidden": true
|
|
1541
|
+
}
|
|
1542
|
+
) : null;
|
|
1543
|
+
const drawerNode = shouldRender ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1544
|
+
"div",
|
|
1545
|
+
{
|
|
1546
|
+
className: tailwindMerge.twMerge(
|
|
1547
|
+
temporary ? temporaryContainerBaseClasses : staticContainerBaseClasses,
|
|
1548
|
+
temporary ? locationClass : void 0,
|
|
1549
|
+
temporary ? translateClass : void 0,
|
|
1550
|
+
temporary && !isOpen ? "pointer-events-none" : void 0,
|
|
1551
|
+
temporary && floating ? "p-4" : void 0,
|
|
1552
|
+
!temporary && location === "right" ? "ml-auto" : void 0,
|
|
1553
|
+
containerClassName
|
|
1554
|
+
),
|
|
1555
|
+
"data-state": state,
|
|
1556
|
+
"aria-hidden": temporary ? !isOpen : void 0,
|
|
1557
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1558
|
+
"div",
|
|
1559
|
+
{
|
|
1560
|
+
...rest,
|
|
1561
|
+
ref,
|
|
1562
|
+
role: role ?? "navigation",
|
|
1563
|
+
className: tailwindMerge.twMerge(drawerBaseClasses, floatingClasses, borderClasses, className),
|
|
1564
|
+
style: resolvedStyle,
|
|
1565
|
+
"data-state": state,
|
|
1566
|
+
children: props.children
|
|
1567
|
+
}
|
|
1568
|
+
)
|
|
1569
|
+
}
|
|
1570
|
+
) : null;
|
|
1571
|
+
const outputNode = temporary && portal && resolvedPortalContainer && drawerNode ? reactDom.createPortal(
|
|
1572
|
+
/* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1573
|
+
overlayNode,
|
|
1574
|
+
drawerNode
|
|
1575
|
+
] }),
|
|
1576
|
+
resolvedPortalContainer
|
|
1577
|
+
) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1578
|
+
overlayNode,
|
|
1579
|
+
drawerNode
|
|
1580
|
+
] });
|
|
1581
|
+
return outputNode;
|
|
1582
|
+
});
|
|
1583
|
+
Drawer.displayName = "Drawer";
|
|
1584
|
+
var Drawer_default = Drawer;
|
|
1476
1585
|
var tooltipBaseClasses = "absolute z-[60] max-w-xs rounded-lg border border-white/10 bg-gray-900 px-3 py-2 text-xs font-medium text-white shadow-lg shadow-black/30 ring-1 ring-black/40 transition-all duration-150";
|
|
1477
1586
|
var wrapperBaseClasses = "relative inline-flex max-w-full align-middle";
|
|
1478
1587
|
var arrowBaseClasses = "pointer-events-none absolute h-2 w-2 rotate-45 border border-white/10 bg-gray-900 shadow-lg shadow-black/20";
|
|
1479
|
-
var
|
|
1588
|
+
var resolveSizeValue3 = (value) => {
|
|
1480
1589
|
if (value === void 0) {
|
|
1481
1590
|
return void 0;
|
|
1482
1591
|
}
|
|
@@ -1534,7 +1643,7 @@ var ToolTip = React4__namespace.forwardRef((props, forwardedRef) => {
|
|
|
1534
1643
|
const shouldRenderTooltip = hasRenderableContent && (shouldEnableTriggers || keepMounted);
|
|
1535
1644
|
const resolvedStyle = { ...style };
|
|
1536
1645
|
if (resolvedStyle.maxWidth === void 0) {
|
|
1537
|
-
resolvedStyle.maxWidth =
|
|
1646
|
+
resolvedStyle.maxWidth = resolveSizeValue3(maxWidth);
|
|
1538
1647
|
}
|
|
1539
1648
|
const baseVisibility = persistent ? "opacity-100 scale-100" : "opacity-0 scale-95";
|
|
1540
1649
|
const hoverClasses = !persistent && showOnHover ? " group-hover/tooltip:opacity-100 group-hover/tooltip:scale-100" : "";
|
|
@@ -3391,118 +3500,141 @@ var resolveIconClassName5 = (icon) => {
|
|
|
3391
3500
|
const classes = [...baseClasses, normalizedName];
|
|
3392
3501
|
return Array.from(new Set(classes)).join(" ");
|
|
3393
3502
|
};
|
|
3394
|
-
var Select = React4__namespace.default.forwardRef(
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3503
|
+
var Select = React4__namespace.default.forwardRef(
|
|
3504
|
+
({
|
|
3505
|
+
options,
|
|
3506
|
+
label,
|
|
3507
|
+
placeholder,
|
|
3508
|
+
variant = "outline",
|
|
3509
|
+
size = "medium",
|
|
3510
|
+
className,
|
|
3511
|
+
wrapperClassName,
|
|
3512
|
+
id,
|
|
3513
|
+
name,
|
|
3514
|
+
multiple,
|
|
3515
|
+
value,
|
|
3516
|
+
defaultValue,
|
|
3517
|
+
error,
|
|
3518
|
+
helperText,
|
|
3519
|
+
disabled,
|
|
3520
|
+
required,
|
|
3521
|
+
onChange,
|
|
3522
|
+
onBlur,
|
|
3523
|
+
onFocus,
|
|
3524
|
+
...props
|
|
3525
|
+
}, ref) => {
|
|
3526
|
+
const selectId = id || name || generateString();
|
|
3527
|
+
const inputName = name || selectId;
|
|
3528
|
+
const variantClass = variantClasses4[variant] ?? variantClasses4.outline;
|
|
3529
|
+
const sizeConfig = sizeClasses3[size] ?? sizeClasses3.medium;
|
|
3530
|
+
const sizeClass = `${sizeConfig.padding} ${sizeConfig.text}`;
|
|
3531
|
+
const normalizedOptions = options.map(normalizeOption);
|
|
3532
|
+
const selectedValueList = value !== void 0 ? (Array.isArray(value) ? value : [value]).map(String) : defaultValue !== void 0 ? (Array.isArray(defaultValue) ? defaultValue : [defaultValue]).map(String) : [];
|
|
3533
|
+
const selectedLabels = normalizedOptions.filter((option) => selectedValueList.includes(String(option.value))).map((option) => option.label);
|
|
3534
|
+
const hasSelection = selectedLabels.length > 0;
|
|
3535
|
+
const summaryText = hasSelection ? multiple ? selectedLabels.join(", ") : selectedLabels[0] : placeholder || "\xA0";
|
|
3536
|
+
const handleOptionChange = (event) => {
|
|
3537
|
+
onChange?.(event);
|
|
3538
|
+
if (multiple) return;
|
|
3539
|
+
const detailsEl = event.currentTarget.closest("details");
|
|
3540
|
+
detailsEl?.removeAttribute("open");
|
|
3541
|
+
};
|
|
3542
|
+
const handleDetailsBlur = (event) => {
|
|
3543
|
+
const nextFocus = event.relatedTarget;
|
|
3544
|
+
if (nextFocus && event.currentTarget.contains(nextFocus)) return;
|
|
3545
|
+
event.currentTarget.removeAttribute("open");
|
|
3546
|
+
};
|
|
3547
|
+
const handleDetailsFocus = (event) => {
|
|
3548
|
+
if (normalizedOptions.length === 0) {
|
|
3549
|
+
onFocus?.(event);
|
|
3550
|
+
}
|
|
3551
|
+
};
|
|
3552
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: tailwindMerge.twMerge("flex flex-col gap-1", wrapperClassName), children: [
|
|
3553
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
|
|
3434
3554
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3435
|
-
"
|
|
3555
|
+
"details",
|
|
3436
3556
|
{
|
|
3437
|
-
className:
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
error && "border-red-500 focus-visible:border-red-500 focus-visible:ring-red-500",
|
|
3443
|
-
disabled && "pointer-events-none opacity-50 cursor-not-allowed",
|
|
3444
|
-
className
|
|
3445
|
-
),
|
|
3446
|
-
style: { minHeight: "2.75rem" },
|
|
3447
|
-
onClick: (e) => disabled && e.preventDefault(),
|
|
3557
|
+
className: "group w-full",
|
|
3558
|
+
...props,
|
|
3559
|
+
onBlur: onBlur ? void 0 : handleDetailsBlur,
|
|
3560
|
+
onFocus: onFocus ? handleDetailsFocus : void 0,
|
|
3561
|
+
open: void 0,
|
|
3448
3562
|
children: [
|
|
3449
|
-
/* @__PURE__ */ jsxRuntime.
|
|
3450
|
-
|
|
3563
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3564
|
+
"summary",
|
|
3565
|
+
{
|
|
3566
|
+
className: tailwindMerge.twMerge(
|
|
3567
|
+
baseClass2,
|
|
3568
|
+
variantClass,
|
|
3569
|
+
sizeClass,
|
|
3570
|
+
"list-none cursor-pointer flex items-center justify-between pr-10 relative [&::-webkit-details-marker]:hidden",
|
|
3571
|
+
error && "border-red-500 focus-visible:border-red-500 focus-visible:ring-red-500",
|
|
3572
|
+
disabled && "pointer-events-none opacity-50 cursor-not-allowed",
|
|
3573
|
+
className
|
|
3574
|
+
),
|
|
3575
|
+
style: { minHeight: "2.75rem" },
|
|
3576
|
+
onClick: (e) => disabled && e.preventDefault(),
|
|
3577
|
+
children: [
|
|
3578
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: tailwindMerge.twMerge("truncate", !hasSelection && "text-gray-500 dark:text-gray-400"), children: summaryText }),
|
|
3579
|
+
/* @__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 }) })
|
|
3580
|
+
]
|
|
3581
|
+
}
|
|
3582
|
+
),
|
|
3583
|
+
/* @__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) => {
|
|
3584
|
+
const optionValueStr = String(option.value);
|
|
3585
|
+
const isSelected = Array.isArray(value) ? value.map(String).includes(optionValueStr) : String(value) === optionValueStr;
|
|
3586
|
+
const isDefaultSelected = Array.isArray(defaultValue) ? defaultValue.map(String).includes(optionValueStr) : String(defaultValue) === optionValueStr;
|
|
3587
|
+
const iconClassName = resolveIconClassName5(option.icon);
|
|
3588
|
+
const inputId = `${selectId}-${toIdSafe(optionValueStr)}-${index}`;
|
|
3589
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3590
|
+
"label",
|
|
3591
|
+
{
|
|
3592
|
+
htmlFor: inputId,
|
|
3593
|
+
className: tailwindMerge.twMerge(
|
|
3594
|
+
"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",
|
|
3595
|
+
option.disabled && "cursor-not-allowed opacity-50"
|
|
3596
|
+
),
|
|
3597
|
+
children: [
|
|
3598
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3599
|
+
"input",
|
|
3600
|
+
{
|
|
3601
|
+
type: multiple ? "checkbox" : "radio",
|
|
3602
|
+
id: inputId,
|
|
3603
|
+
name: inputName,
|
|
3604
|
+
value: option.value,
|
|
3605
|
+
disabled: option.disabled || disabled,
|
|
3606
|
+
checked: value !== void 0 ? isSelected : void 0,
|
|
3607
|
+
defaultChecked: defaultValue !== void 0 ? isDefaultSelected : void 0,
|
|
3608
|
+
onChange: handleOptionChange,
|
|
3609
|
+
onBlur,
|
|
3610
|
+
ref,
|
|
3611
|
+
required: required && !multiple,
|
|
3612
|
+
className: "peer sr-only"
|
|
3613
|
+
}
|
|
3614
|
+
),
|
|
3615
|
+
iconClassName && /* @__PURE__ */ jsxRuntime.jsx("i", { className: tailwindMerge.twMerge(iconClassName, "text-lg text-gray-500 peer-checked:text-primary dark:text-gray-400") }),
|
|
3616
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1 truncate peer-checked:font-medium peer-checked:text-primary", children: option.label }),
|
|
3617
|
+
/* @__PURE__ */ jsxRuntime.jsx("i", { className: "mdi mdi-check invisible ml-auto text-primary peer-checked:visible" })
|
|
3618
|
+
]
|
|
3619
|
+
},
|
|
3620
|
+
`${optionValueStr}-${index}`
|
|
3621
|
+
);
|
|
3622
|
+
}) })
|
|
3451
3623
|
]
|
|
3452
3624
|
}
|
|
3453
3625
|
),
|
|
3454
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
"label",
|
|
3462
|
-
{
|
|
3463
|
-
htmlFor: inputId,
|
|
3464
|
-
className: tailwindMerge.twMerge(
|
|
3465
|
-
"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",
|
|
3466
|
-
option.disabled && "cursor-not-allowed opacity-50"
|
|
3467
|
-
),
|
|
3468
|
-
children: [
|
|
3469
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3470
|
-
"input",
|
|
3471
|
-
{
|
|
3472
|
-
type: multiple ? "checkbox" : "radio",
|
|
3473
|
-
id: inputId,
|
|
3474
|
-
name: inputName,
|
|
3475
|
-
value: option.value,
|
|
3476
|
-
disabled: option.disabled || disabled,
|
|
3477
|
-
checked: value !== void 0 ? isSelected : void 0,
|
|
3478
|
-
defaultChecked: defaultValue !== void 0 ? isDefaultSelected : void 0,
|
|
3479
|
-
onChange: handleOptionChange,
|
|
3480
|
-
onBlur,
|
|
3481
|
-
ref,
|
|
3482
|
-
required: required && !multiple,
|
|
3483
|
-
className: "peer sr-only"
|
|
3484
|
-
}
|
|
3485
|
-
),
|
|
3486
|
-
iconClassName && /* @__PURE__ */ jsxRuntime.jsx("i", { className: tailwindMerge.twMerge(iconClassName, "text-lg text-gray-500 peer-checked:text-primary dark:text-gray-400") }),
|
|
3487
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1 truncate peer-checked:font-medium peer-checked:text-primary", children: option.label }),
|
|
3488
|
-
/* @__PURE__ */ jsxRuntime.jsx("i", { className: "mdi mdi-check invisible ml-auto text-primary peer-checked:visible" })
|
|
3489
|
-
]
|
|
3490
|
-
},
|
|
3491
|
-
`${optionValueStr}-${index}`
|
|
3492
|
-
);
|
|
3493
|
-
}) })
|
|
3626
|
+
label && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3627
|
+
"label",
|
|
3628
|
+
{
|
|
3629
|
+
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"),
|
|
3630
|
+
children: label
|
|
3631
|
+
}
|
|
3632
|
+
)
|
|
3494
3633
|
] }),
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
children: label
|
|
3500
|
-
}
|
|
3501
|
-
)
|
|
3502
|
-
] }),
|
|
3503
|
-
helperText && /* @__PURE__ */ jsxRuntime.jsx("p", { className: tailwindMerge.twMerge("mt-1 text-xs text-gray-500", error && "text-red-500"), children: helperText })
|
|
3504
|
-
] });
|
|
3505
|
-
});
|
|
3634
|
+
helperText && /* @__PURE__ */ jsxRuntime.jsx("p", { className: tailwindMerge.twMerge("mt-1 text-xs text-gray-500", error && "text-red-500"), children: helperText })
|
|
3635
|
+
] });
|
|
3636
|
+
}
|
|
3637
|
+
);
|
|
3506
3638
|
Select.displayName = "Select";
|
|
3507
3639
|
var Select_default = Select;
|
|
3508
3640
|
var paletteValues = {
|
|
@@ -4638,6 +4770,7 @@ exports.Button = Button_default;
|
|
|
4638
4770
|
exports.Card = Card_default;
|
|
4639
4771
|
exports.Chip = Chip_default;
|
|
4640
4772
|
exports.Dialog = Dialog_default;
|
|
4773
|
+
exports.Drawer = Drawer_default;
|
|
4641
4774
|
exports.ExpansionPanel = ExpansionPanel_default;
|
|
4642
4775
|
exports.ExpansionPanelItem = ExpansionPanelItem_default;
|
|
4643
4776
|
exports.Hero = Hero_default;
|