|
|
|
|
@ -61,12 +61,21 @@ export class TagsInputProvider {
|
|
|
|
|
private constructor(opts: TagsInputOpts) {
|
|
|
|
|
this.opts = opts;
|
|
|
|
|
this.soma = Soma.require();
|
|
|
|
|
this.runtime = this.soma.runtime(tagsInputMorfo, {});
|
|
|
|
|
this.runtime = this.soma.runtime(tagsInputMorfo, {
|
|
|
|
|
props: {
|
|
|
|
|
empty: () => this.isEmpty,
|
|
|
|
|
disabled: () => this.opts.disabled.current,
|
|
|
|
|
readonly: () => this.opts.readonly.current,
|
|
|
|
|
invalid: () => this.opts.invalid.current,
|
|
|
|
|
focus: () => this.highlightedIndex === -1
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
this.runtimePart = this.runtime.part('provider', {
|
|
|
|
|
id: opts.id,
|
|
|
|
|
ref: opts.ref,
|
|
|
|
|
owner: this,
|
|
|
|
|
context: TagsInputProvider.ctx
|
|
|
|
|
context: TagsInputProvider.ctx,
|
|
|
|
|
syncAttrs: true
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -200,11 +209,7 @@ export class TagsInputProvider {
|
|
|
|
|
|
|
|
|
|
readonly props = $derived.by(() =>
|
|
|
|
|
this.runtimePart.assert({
|
|
|
|
|
...this.runtimePart.props,
|
|
|
|
|
'data-empty': boolToEmptyStrOrUndef(this.isEmpty),
|
|
|
|
|
'data-disabled': boolToEmptyStrOrUndef(this.opts.disabled.current),
|
|
|
|
|
'data-readonly': boolToEmptyStrOrUndef(this.opts.readonly.current),
|
|
|
|
|
'data-invalid': boolToEmptyStrOrUndef(this.opts.invalid.current)
|
|
|
|
|
...this.runtimePart.props
|
|
|
|
|
} as const)
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
@ -228,7 +233,8 @@ export class TagsInputControlProvider {
|
|
|
|
|
this.runtimePart = this.provider.runtime.part('control', {
|
|
|
|
|
id: opts.id,
|
|
|
|
|
ref: opts.ref,
|
|
|
|
|
owner: this
|
|
|
|
|
owner: this,
|
|
|
|
|
syncAttrs: true
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -240,12 +246,6 @@ export class TagsInputControlProvider {
|
|
|
|
|
readonly props = $derived.by(() =>
|
|
|
|
|
this.runtimePart.assert({
|
|
|
|
|
...this.runtimePart.props,
|
|
|
|
|
role: 'listbox' as const,
|
|
|
|
|
'aria-orientation': 'horizontal' as const,
|
|
|
|
|
'data-disabled': boolToEmptyStrOrUndef(this.provider.opts.disabled.current),
|
|
|
|
|
'data-readonly': boolToEmptyStrOrUndef(this.provider.opts.readonly.current),
|
|
|
|
|
'data-invalid': boolToEmptyStrOrUndef(this.provider.opts.invalid.current),
|
|
|
|
|
'data-focus': boolToEmptyStrOrUndef(this.provider.highlightedIndex === -1),
|
|
|
|
|
onclick: this.onclick
|
|
|
|
|
} as const)
|
|
|
|
|
);
|
|
|
|
|
|