milk-lib 0.0.21 → 0.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.
@@ -28,7 +28,8 @@
28
28
  minWidthMenu,
29
29
  menuGap,
30
30
  menuMaxHeight,
31
- searchable=true
31
+ searchable=true,
32
+ onClear
32
33
  }: ISelectProps = $props();
33
34
 
34
35
  const menuId = `select-menu-${crypto.randomUUID()}`;
@@ -155,6 +156,7 @@
155
156
  const handleClear = () => {
156
157
  hideMenu();
157
158
  value = null;
159
+ onClear?.();
158
160
  }
159
161
 
160
162
  </script>
@@ -168,7 +170,7 @@
168
170
  readonly
169
171
  onFocus={focusHandler}
170
172
  onKeyDown={handleControlKeyDown}
171
- onClear={handleClear}
173
+ onClear={onClear ? handleClear : undefined}
172
174
  pseudoFocus={isMenuVisible}
173
175
  onClick={handleControlClick}
174
176
  variant="contained"
@@ -16,4 +16,5 @@ export interface ISelectProps {
16
16
  minWidthMenu?: number;
17
17
  menuGap?: number;
18
18
  menuMaxHeight?: number;
19
+ onClear?: () => void;
19
20
  }
@@ -32,6 +32,7 @@
32
32
 
33
33
  onMount(() => {
34
34
  if (autoFocus && inputEl) {
35
+
35
36
  // Wrapped to setTimeout to correctly autoFocus in modal and conditional rendering
36
37
  setTimeout(() => {
37
38
  inputEl.focus();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "milk-lib",
3
3
  "license": "MIT",
4
- "version": "0.0.21",
4
+ "version": "0.0.23",
5
5
  "scripts": {
6
6
  "dev": "vite dev",
7
7
  "build": "vite build && npm run prepack",