File size: 1,335 Bytes
bc20498
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<script>import { melt } from "@melt-ui/svelte";
import { setCtx } from "../ctx.js";
import { derived } from "svelte/store";
export let placeholder = void 0;
export let value = void 0;
export let name = void 0;
export let disabled = void 0;
export let type = "text";
export let onValueChange = void 0;
export let id = void 0;
export let asChild = false;
export let el = void 0;
const {
  elements: { root },
  states: { value: localValue },
  updateOption,
  ids,
  getAttrs
} = setCtx({
  placeholder,
  defaultValue: value,
  name,
  disabled,
  type,
  onValueChange: ({ next }) => {
    if (value !== next) {
      onValueChange?.(next);
      value = next;
    }
    return next;
  }
});
$:
  value !== void 0 && localValue.set(value);
const attrs = getAttrs("root");
$:
  updateOption("placeholder", placeholder);
$:
  updateOption("name", name);
$:
  updateOption("disabled", disabled);
$:
  updateOption("type", type);
$:
  builder = $root;
$:
  Object.assign(builder, attrs);
const idValues = derived([ids.root], ([$menubarId]) => ({
  menubar: $menubarId
}));
$:
  if (id) {
    ids.root.set(id);
  }
$:
  slotProps = {
    builder,
    ids: $idValues
  };
</script>

{#if asChild}
	<slot {...slotProps} />
{:else}
	<div bind:this={el} {...builder} use:builder.action {...$$restProps}>
		<slot {...slotProps} />
	</div>
{/if}