@insymetri/styleguide 0.1.26 → 0.1.27
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.
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
emptyContent?: Snippet
|
|
37
37
|
// Grouped items (alternative to flat items)
|
|
38
38
|
groups?: Group<T>[]
|
|
39
|
+
openOnFocus?: boolean
|
|
39
40
|
// CSS classes
|
|
40
41
|
class?: string
|
|
41
42
|
contentClass?: string
|
|
@@ -54,6 +55,7 @@
|
|
|
54
55
|
renderItem,
|
|
55
56
|
emptyContent,
|
|
56
57
|
groups,
|
|
58
|
+
openOnFocus = false,
|
|
57
59
|
class: className,
|
|
58
60
|
contentClass,
|
|
59
61
|
}: Props<T> = $props()
|
|
@@ -135,6 +137,10 @@
|
|
|
135
137
|
inputValue = e.currentTarget.value
|
|
136
138
|
}
|
|
137
139
|
|
|
140
|
+
function handleFocus() {
|
|
141
|
+
open = true
|
|
142
|
+
}
|
|
143
|
+
|
|
138
144
|
// Check if item looks like a SimpleItem for default rendering
|
|
139
145
|
function isSimpleItem(item: T): item is T & SimpleItem {
|
|
140
146
|
return typeof item === 'object' && item !== null && 'label' in item && 'value' in item
|
|
@@ -182,6 +188,7 @@
|
|
|
182
188
|
{placeholder}
|
|
183
189
|
{disabled}
|
|
184
190
|
oninput={handleInput}
|
|
191
|
+
onfocus={openOnFocus ? handleFocus : undefined}
|
|
185
192
|
class={cn(
|
|
186
193
|
'w-full box-border py-5 px-12 text-input-text bg-input-bg border border-input-border transition-all duration-fast outline-none placeholder:text-input-placeholder hover:border-input-border-hover focus:border-input-border-hover disabled:opacity-50 disabled:cursor-not-allowed disabled:bg-input-bg-disabled motion-reduce:transition-none',
|
|
187
194
|
densityClasses[density.value]
|