ketekny-ui-kit 1.0.22 → 1.0.23
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/package.json +1 -1
- package/src/ui/kSelect.vue +36 -1
- package/tailwind.config.js +1 -0
package/package.json
CHANGED
package/src/ui/kSelect.vue
CHANGED
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
<SelectViewport
|
|
58
58
|
ref="viewportRef"
|
|
59
59
|
class="select-viewport p-1 overflow-y-scroll"
|
|
60
|
-
:style="{ maxHeight:
|
|
60
|
+
:style="{ maxHeight: resolvedDropdownHeight }"
|
|
61
61
|
@keydown="handleViewportKeydown"
|
|
62
62
|
>
|
|
63
63
|
<SelectItem
|
|
@@ -138,9 +138,44 @@ const defaultStyle = "w-full px-3 py-2 border rounded-lg transition shadow-sm fo
|
|
|
138
138
|
const errorStyle = "border-red-500 focus:ring focus:ring-red-300";
|
|
139
139
|
const disabledStyle = "!bg-gray-100 !text-gray-400 !cursor-not-allowed";
|
|
140
140
|
|
|
141
|
+
function normalizeDropdownHeight(value) {
|
|
142
|
+
const raw = String(value ?? "").trim();
|
|
143
|
+
if (!raw) return "min(400px, 40vh)";
|
|
144
|
+
|
|
145
|
+
// Accept Tailwind arbitrary values like max-h-[400px] / min-h-[20rem].
|
|
146
|
+
const arbitraryMatch = raw.match(/^(?:max-h|min-h)-\[(.+)\]$/);
|
|
147
|
+
if (arbitraryMatch) return arbitraryMatch[1].trim();
|
|
148
|
+
|
|
149
|
+
// Accept Tailwind scale values like max-h-80 -> 20rem.
|
|
150
|
+
const scaleMatch = raw.match(/^(?:max-h|min-h)-(\d+(?:\.\d+)?)$/);
|
|
151
|
+
if (scaleMatch) {
|
|
152
|
+
const scale = Number(scaleMatch[1]);
|
|
153
|
+
if (Number.isFinite(scale)) return `${scale * 0.25}rem`;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// Accept common Tailwind keywords.
|
|
157
|
+
const keywordMap = {
|
|
158
|
+
"max-h-full": "100%",
|
|
159
|
+
"min-h-full": "100%",
|
|
160
|
+
"max-h-screen": "100vh",
|
|
161
|
+
"min-h-screen": "100vh",
|
|
162
|
+
"max-h-fit": "fit-content",
|
|
163
|
+
"min-h-fit": "fit-content",
|
|
164
|
+
"max-h-min": "min-content",
|
|
165
|
+
"min-h-min": "min-content",
|
|
166
|
+
"max-h-max": "max-content",
|
|
167
|
+
"min-h-max": "max-content",
|
|
168
|
+
};
|
|
169
|
+
if (keywordMap[raw]) return keywordMap[raw];
|
|
170
|
+
|
|
171
|
+
// Already valid CSS values (e.g. 20rem, 400px, min(400px, 40vh)).
|
|
172
|
+
return raw;
|
|
173
|
+
}
|
|
174
|
+
|
|
141
175
|
const computedId = computed(() => (props.id != null && props.id !== "" ? props.id : generatedId));
|
|
142
176
|
const hasError = computed(() => props.error != null && props.error !== false);
|
|
143
177
|
const isSelectionSet = computed(() => props.modelValue !== null && props.modelValue !== undefined && props.modelValue !== "");
|
|
178
|
+
const resolvedDropdownHeight = computed(() => normalizeDropdownHeight(props.dropdownHeight));
|
|
144
179
|
|
|
145
180
|
const internalValue = computed({
|
|
146
181
|
get() {
|