bits-ui 0.20.0 → 0.21.0

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/README.md CHANGED
@@ -25,7 +25,7 @@ This project is supported by the following beautiful people/organizations:
25
25
 
26
26
  <p align="center">
27
27
  <a href="https://github.com/sponsors/huntabyte">
28
- <img src='https://cdn.jsdelivr.net/gh/huntabyte/static/sponsors.svg' alt="Logos from Sponsors" />
28
+ <img src='https://cdn.jsdelivr.net/gh/huntabyte/static@main/sponsors.svg' alt="Logos from Sponsors" />
29
29
  </a>
30
30
  </p>
31
31
 
@@ -50,6 +50,13 @@ type Props<T = unknown, Multiple extends boolean = false> = Expand<OmitFloating<
50
50
  * type the `selected` and `onSelectedChange` props.
51
51
  */
52
52
  items?: Selected<T>[];
53
+ /**
54
+ * Whether the input has been touched or not. You can bind to this to
55
+ * handle filtering the items only when the input has been touched.
56
+ *
57
+ * @defaultValue false
58
+ */
59
+ touchedInput?: boolean;
53
60
  }>;
54
61
  type InputProps = DOMElement<HTMLInputElement>;
55
62
  type LabelProps = DOMElement<HTMLLabelElement>;
@@ -19,8 +19,14 @@ export let onOpenChange = void 0;
19
19
  export let items = [];
20
20
  export let onOutsideClick = void 0;
21
21
  export let inputValue = "";
22
+ export let touchedInput = false;
22
23
  const {
23
- states: { open: localOpen, selected: localSelected, inputValue: localInputValue, touchedInput },
24
+ states: {
25
+ open: localOpen,
26
+ selected: localSelected,
27
+ inputValue: localInputValue,
28
+ touchedInput: localTouchedInput
29
+ },
24
30
  updateOption,
25
31
  ids
26
32
  } = setCtx({
@@ -75,7 +81,9 @@ const idValues = derived(
75
81
  })
76
82
  );
77
83
  $:
78
- if ($touchedInput)
84
+ touchedInput = $localTouchedInput;
85
+ $:
86
+ if ($localTouchedInput)
79
87
  inputValue = $localInputValue;
80
88
  $:
81
89
  inputValue !== void 0 && localInputValue.set(inputValue);
@@ -19,6 +19,7 @@ declare class __sveltets_Render<T, Multiple extends boolean = false> {
19
19
  multiple?: Multiple | undefined;
20
20
  inputValue?: string | undefined;
21
21
  items?: import("../../../index.js").Selected<T>[] | undefined;
22
+ touchedInput?: boolean | undefined;
22
23
  };
23
24
  events(): {} & {
24
25
  [evt: string]: CustomEvent<any>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bits-ui",
3
- "version": "0.20.0",
3
+ "version": "0.21.0",
4
4
  "license": "MIT",
5
5
  "repository": "github:huntabyte/bits-ui",
6
6
  "exports": {
@@ -78,7 +78,7 @@
78
78
  "type": "module",
79
79
  "dependencies": {
80
80
  "@internationalized/date": "^3.5.1",
81
- "@melt-ui/svelte": "0.76.0",
81
+ "@melt-ui/svelte": "0.76.2",
82
82
  "nanoid": "^5.0.5"
83
83
  },
84
84
  "peerDependencies": {