@xui/tag-input 2.0.0-alpha.20 → 2.0.0-alpha.21
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.
|
@@ -25,14 +25,18 @@ const tagInputContainerVariants = cva([
|
|
|
25
25
|
* against the filled field it sits in.
|
|
26
26
|
*/
|
|
27
27
|
class XuiTagInput {
|
|
28
|
+
/** Extra classes, merged into the component's own rather than replacing them. */
|
|
28
29
|
class = input('', /* @ts-ignore */
|
|
29
30
|
...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
30
31
|
/** The current tags. Two-way bindable with `[(values)]`. */
|
|
31
32
|
values = model([], /* @ts-ignore */
|
|
32
33
|
...(ngDevMode ? [{ debugName: "values" }] : /* istanbul ignore next */ []));
|
|
34
|
+
/** Text shown in the empty field. Hidden once there is at least one tag. */
|
|
33
35
|
placeholder = input('', /* @ts-ignore */
|
|
34
36
|
...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
37
|
+
/** Stretch to the available width instead of hugging its contents. */
|
|
35
38
|
fill = input(false, { ...(ngDevMode ? { debugName: "fill" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
39
|
+
/** Block interaction and dim the field and its tags. */
|
|
36
40
|
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
37
41
|
/** Character that also commits the current draft (besides Enter). */
|
|
38
42
|
separator = input(',', /* @ts-ignore */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xui-tag-input.mjs","sources":["../../../../../../libs/ui/tag-input/xui/src/lib/tag-input.ts","../../../../../../libs/ui/tag-input/xui/src/index.ts","../../../../../../libs/ui/tag-input/xui/src/xui-tag-input.ts"],"sourcesContent":["import { BooleanInput } from '@angular/cdk/coercion';\nimport {\n booleanAttribute,\n ChangeDetectionStrategy,\n Component,\n computed,\n ElementRef,\n input,\n model,\n output,\n signal,\n viewChild,\n ViewEncapsulation\n} from '@angular/core';\nimport { ControlValueAccessor } from '@angular/forms';\nimport { xui } from '@xui/core';\nimport { createXValueAccessor, provideXValueAccessor } from '@xui/core/forms';\nimport { XuiTag } from '@xui/tag';\nimport { cva, VariantProps } from 'class-variance-authority';\nimport type { ClassValue } from 'clsx';\n\nexport const tagInputContainerVariants = cva(\n [\n 'flex min-h-(--control-height-md) flex-wrap items-center gap-1.5 rounded-lg border border-border bg-surface-inset px-(--control-padding-sm) py-0.5 text-sm',\n 'focus-within:border-focus transition-colors',\n 'data-disabled:cursor-not-allowed data-disabled:opacity-50'\n ],\n {\n variants: {\n fill: { true: 'w-full', false: 'min-w-72' }\n },\n defaultVariants: { fill: false }\n }\n);\n\nexport type XuiTagInputVariants = VariantProps<typeof tagInputContainerVariants>;\n\n/**\n * A token/chip input: type and press Enter (or the separator) to add a tag, click\n * a tag's ✕ or press Backspace on an empty field to remove one. `[(values)]`\n * two-way binding and `ControlValueAccessor` over a `string[]`.\n *\n * The tokens are real `xui-tag`s rather than a look-alike, so they cannot drift from what a tag\n * looks like. `minimal` is the variant that carries a border, which is what marks a chip out\n * against the filled field it sits in.\n */\n@Component({\n selector: 'xui-tag-input',\n imports: [XuiTag],\n template: `\n <!-- Clicking empty container space focuses the real input, which is itself\n focusable and keyboard-operable, so no separate key handler is needed. -->\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -->\n <div [class]=\"containerClass()\" (click)=\"focusInput($event)\">\n @for (tag of values(); track $index) {\n <xui-tag minimal [removable]=\"!isDisabled()\" [removeLabel]=\"'Remove ' + tag\" (removed)=\"removeAt($index)\">{{\n tag\n }}</xui-tag>\n }\n\n <input\n #field\n type=\"text\"\n class=\"text-foreground placeholder:text-foreground-subtle min-w-24 flex-1 bg-transparent outline-none\"\n [value]=\"draft()\"\n [placeholder]=\"values().length ? '' : placeholder()\"\n [disabled]=\"isDisabled()\"\n (input)=\"onInput($event)\"\n (keydown)=\"onKeydown($event)\"\n (paste)=\"onPaste($event)\"\n (blur)=\"onBlur()\"\n />\n </div>\n `,\n host: {\n '[class]': 'computedClass()',\n '[attr.data-disabled]': 'isDisabled() ? \"\" : null'\n },\n providers: [provideXValueAccessor(() => XuiTagInput)],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None\n})\nexport class XuiTagInput implements ControlValueAccessor {\n readonly class = input<ClassValue>('');\n\n /** The current tags. Two-way bindable with `[(values)]`. */\n readonly values = model<string[]>([]);\n\n readonly placeholder = input<string>('');\n readonly fill = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /** Character that also commits the current draft (besides Enter). */\n readonly separator = input<string>(',');\n\n /** Commit the draft when the field loses focus. */\n readonly addOnBlur = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /** Split pasted text on the separator and add each piece. */\n readonly addOnPaste = input<boolean, BooleanInput>(true, { transform: booleanAttribute });\n\n /** Reject a tag that already exists. */\n readonly allowDuplicates = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /** Emits each tag as it is added. */\n readonly added = output<string>();\n /** Emits each tag as it is removed. */\n readonly removed = output<string>();\n\n protected readonly draft = signal('');\n private readonly field = viewChild<ElementRef<HTMLInputElement>>('field');\n\n protected readonly cva = createXValueAccessor<string[]>({\n onWrite: value => this.values.set(value ?? []),\n disabled: this.disabled\n });\n protected readonly isDisabled = this.cva.disabled;\n\n protected readonly computedClass = computed(() => xui('block', this.class()));\n protected readonly containerClass = computed(() => xui(tagInputContainerVariants({ fill: this.fill() })));\n\n protected onInput(event: Event): void {\n this.draft.set((event.target as HTMLInputElement).value);\n }\n\n protected onKeydown(event: KeyboardEvent): void {\n if (event.key === 'Enter' || event.key === this.separator()) {\n event.preventDefault();\n this.commitDraft();\n return;\n }\n\n // Backspace on an empty field trims the last tag.\n if (event.key === 'Backspace' && this.draft() === '' && this.values().length) {\n event.preventDefault();\n this.removeAt(this.values().length - 1);\n }\n }\n\n protected onPaste(event: ClipboardEvent): void {\n if (!this.addOnPaste()) {\n return;\n }\n\n const text = event.clipboardData?.getData('text') ?? '';\n if (text.includes(this.separator())) {\n event.preventDefault();\n this.addTokens(text);\n this.draft.set('');\n }\n }\n\n protected onBlur(): void {\n if (this.addOnBlur()) {\n this.commitDraft();\n }\n\n this.cva.markTouched();\n }\n\n protected focusInput(event: MouseEvent): void {\n // Clicking the container (but not a tag's button) focuses the field.\n if (this.isDisabled()) {\n return;\n }\n\n (event.currentTarget as HTMLElement).querySelector('input')?.focus();\n }\n\n private commitDraft(): void {\n this.addTokens(this.draft());\n this.draft.set('');\n // Clear the native field directly too: if the draft round-tripped within a\n // single change-detection pass, the `[value]` binding may not diff as changed.\n const el = this.field()?.nativeElement;\n if (el) {\n el.value = '';\n }\n }\n\n private addTokens(raw: string): void {\n const tokens = raw\n .split(this.separator())\n .map(t => t.trim())\n .filter(Boolean);\n if (!tokens.length) {\n return;\n }\n\n const next = [...this.values()];\n for (const token of tokens) {\n if (!this.allowDuplicates() && next.includes(token)) {\n continue;\n }\n\n next.push(token);\n this.added.emit(token);\n }\n\n if (next.length !== this.values().length) {\n this.commit(next);\n }\n }\n\n protected removeAt(index: number): void {\n if (this.isDisabled()) {\n return;\n }\n\n const tag = this.values()[index];\n const next = this.values().filter((_, i) => i !== index);\n this.commit(next);\n this.removed.emit(tag);\n }\n\n private commit(next: string[]): void {\n this.values.set(next);\n this.cva.notifyChange(next);\n }\n\n // --- ControlValueAccessor ---\n readonly writeValue = this.cva.writeValue;\n readonly registerOnChange = this.cva.registerOnChange;\n readonly registerOnTouched = this.cva.registerOnTouched;\n readonly setDisabledState = this.cva.setDisabledState;\n}\n","import { XuiTagInput } from './lib/tag-input';\n\nexport * from './lib/tag-input';\n\nexport const XuiTagInputImports = [XuiTagInput] as const;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":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AAA,SAAS,EAAE,iBAAiB;AAC5B,wBAAA,sBAAsB,EAAE;AACzB,qBAAA;oBACD,SAAS,EAAE,CAAC,qBAAqB,EAAC,MAAK,WAAY,EAAC,CAAC;oBACrD,eAAe,EAAE,uBAAuB,CAAC,MAAM;oBAC/C,aAAa,EAAE,iBAAiB,CAAC;AAClC,iBAAA;4jCA6BkE,OAAO,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;AC1GnE,MAAM,kBAAkB,GAAG,CAAC,WAAW;;ACJ9C;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"xui-tag-input.mjs","sources":["../../../../../../libs/ui/tag-input/xui/src/lib/tag-input.ts","../../../../../../libs/ui/tag-input/xui/src/index.ts","../../../../../../libs/ui/tag-input/xui/src/xui-tag-input.ts"],"sourcesContent":["import { BooleanInput } from '@angular/cdk/coercion';\nimport {\n booleanAttribute,\n ChangeDetectionStrategy,\n Component,\n computed,\n ElementRef,\n input,\n model,\n output,\n signal,\n viewChild,\n ViewEncapsulation\n} from '@angular/core';\nimport { ControlValueAccessor } from '@angular/forms';\nimport { xui } from '@xui/core';\nimport { createXValueAccessor, provideXValueAccessor } from '@xui/core/forms';\nimport { XuiTag } from '@xui/tag';\nimport { cva, VariantProps } from 'class-variance-authority';\nimport type { ClassValue } from 'clsx';\n\nexport const tagInputContainerVariants = cva(\n [\n 'flex min-h-(--control-height-md) flex-wrap items-center gap-1.5 rounded-lg border border-border bg-surface-inset px-(--control-padding-sm) py-0.5 text-sm',\n 'focus-within:border-focus transition-colors',\n 'data-disabled:cursor-not-allowed data-disabled:opacity-50'\n ],\n {\n variants: {\n fill: { true: 'w-full', false: 'min-w-72' }\n },\n defaultVariants: { fill: false }\n }\n);\n\nexport type XuiTagInputVariants = VariantProps<typeof tagInputContainerVariants>;\n\n/**\n * A token/chip input: type and press Enter (or the separator) to add a tag, click\n * a tag's ✕ or press Backspace on an empty field to remove one. `[(values)]`\n * two-way binding and `ControlValueAccessor` over a `string[]`.\n *\n * The tokens are real `xui-tag`s rather than a look-alike, so they cannot drift from what a tag\n * looks like. `minimal` is the variant that carries a border, which is what marks a chip out\n * against the filled field it sits in.\n */\n@Component({\n selector: 'xui-tag-input',\n imports: [XuiTag],\n template: `\n <!-- Clicking empty container space focuses the real input, which is itself\n focusable and keyboard-operable, so no separate key handler is needed. -->\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -->\n <div [class]=\"containerClass()\" (click)=\"focusInput($event)\">\n @for (tag of values(); track $index) {\n <xui-tag minimal [removable]=\"!isDisabled()\" [removeLabel]=\"'Remove ' + tag\" (removed)=\"removeAt($index)\">{{\n tag\n }}</xui-tag>\n }\n\n <input\n #field\n type=\"text\"\n class=\"text-foreground placeholder:text-foreground-subtle min-w-24 flex-1 bg-transparent outline-none\"\n [value]=\"draft()\"\n [placeholder]=\"values().length ? '' : placeholder()\"\n [disabled]=\"isDisabled()\"\n (input)=\"onInput($event)\"\n (keydown)=\"onKeydown($event)\"\n (paste)=\"onPaste($event)\"\n (blur)=\"onBlur()\"\n />\n </div>\n `,\n host: {\n '[class]': 'computedClass()',\n '[attr.data-disabled]': 'isDisabled() ? \"\" : null'\n },\n providers: [provideXValueAccessor(() => XuiTagInput)],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None\n})\nexport class XuiTagInput implements ControlValueAccessor {\n /** Extra classes, merged into the component's own rather than replacing them. */\n readonly class = input<ClassValue>('');\n\n /** The current tags. Two-way bindable with `[(values)]`. */\n readonly values = model<string[]>([]);\n\n /** Text shown in the empty field. Hidden once there is at least one tag. */\n readonly placeholder = input<string>('');\n /** Stretch to the available width instead of hugging its contents. */\n readonly fill = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n /** Block interaction and dim the field and its tags. */\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /** Character that also commits the current draft (besides Enter). */\n readonly separator = input<string>(',');\n\n /** Commit the draft when the field loses focus. */\n readonly addOnBlur = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /** Split pasted text on the separator and add each piece. */\n readonly addOnPaste = input<boolean, BooleanInput>(true, { transform: booleanAttribute });\n\n /** Reject a tag that already exists. */\n readonly allowDuplicates = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /** Emits each tag as it is added. */\n readonly added = output<string>();\n /** Emits each tag as it is removed. */\n readonly removed = output<string>();\n\n protected readonly draft = signal('');\n private readonly field = viewChild<ElementRef<HTMLInputElement>>('field');\n\n protected readonly cva = createXValueAccessor<string[]>({\n onWrite: value => this.values.set(value ?? []),\n disabled: this.disabled\n });\n protected readonly isDisabled = this.cva.disabled;\n\n protected readonly computedClass = computed(() => xui('block', this.class()));\n protected readonly containerClass = computed(() => xui(tagInputContainerVariants({ fill: this.fill() })));\n\n protected onInput(event: Event): void {\n this.draft.set((event.target as HTMLInputElement).value);\n }\n\n protected onKeydown(event: KeyboardEvent): void {\n if (event.key === 'Enter' || event.key === this.separator()) {\n event.preventDefault();\n this.commitDraft();\n return;\n }\n\n // Backspace on an empty field trims the last tag.\n if (event.key === 'Backspace' && this.draft() === '' && this.values().length) {\n event.preventDefault();\n this.removeAt(this.values().length - 1);\n }\n }\n\n protected onPaste(event: ClipboardEvent): void {\n if (!this.addOnPaste()) {\n return;\n }\n\n const text = event.clipboardData?.getData('text') ?? '';\n if (text.includes(this.separator())) {\n event.preventDefault();\n this.addTokens(text);\n this.draft.set('');\n }\n }\n\n protected onBlur(): void {\n if (this.addOnBlur()) {\n this.commitDraft();\n }\n\n this.cva.markTouched();\n }\n\n protected focusInput(event: MouseEvent): void {\n // Clicking the container (but not a tag's button) focuses the field.\n if (this.isDisabled()) {\n return;\n }\n\n (event.currentTarget as HTMLElement).querySelector('input')?.focus();\n }\n\n private commitDraft(): void {\n this.addTokens(this.draft());\n this.draft.set('');\n // Clear the native field directly too: if the draft round-tripped within a\n // single change-detection pass, the `[value]` binding may not diff as changed.\n const el = this.field()?.nativeElement;\n if (el) {\n el.value = '';\n }\n }\n\n private addTokens(raw: string): void {\n const tokens = raw\n .split(this.separator())\n .map(t => t.trim())\n .filter(Boolean);\n if (!tokens.length) {\n return;\n }\n\n const next = [...this.values()];\n for (const token of tokens) {\n if (!this.allowDuplicates() && next.includes(token)) {\n continue;\n }\n\n next.push(token);\n this.added.emit(token);\n }\n\n if (next.length !== this.values().length) {\n this.commit(next);\n }\n }\n\n protected removeAt(index: number): void {\n if (this.isDisabled()) {\n return;\n }\n\n const tag = this.values()[index];\n const next = this.values().filter((_, i) => i !== index);\n this.commit(next);\n this.removed.emit(tag);\n }\n\n private commit(next: string[]): void {\n this.values.set(next);\n this.cva.notifyChange(next);\n }\n\n // --- ControlValueAccessor ---\n readonly writeValue = this.cva.writeValue;\n readonly registerOnChange = this.cva.registerOnChange;\n readonly registerOnTouched = this.cva.registerOnTouched;\n readonly setDisabledState = this.cva.setDisabledState;\n}\n","import { XuiTagInput } from './lib/tag-input';\n\nexport * from './lib/tag-input';\n\nexport const XuiTagInputImports = [XuiTagInput] as const;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAqBO,MAAM,yBAAyB,GAAG,GAAG,CAC1C;IACE,2JAA2J;IAC3J,6CAA6C;IAC7C;CACD,EACD;AACE,IAAA,QAAQ,EAAE;QACR,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU;AAC1C,KAAA;AACD,IAAA,eAAe,EAAE,EAAE,IAAI,EAAE,KAAK;AAC/B,CAAA;AAKH;;;;;;;;AAQG;MAqCU,WAAW,CAAA;;IAEb,KAAK,GAAG,KAAK,CAAa,EAAE;8EAAC;;IAG7B,MAAM,GAAG,KAAK,CAAW,EAAE;+EAAC;;IAG5B,WAAW,GAAG,KAAK,CAAS,EAAE;oFAAC;;IAE/B,IAAI,GAAG,KAAK,CAAwB,K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version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.21",
|
|
4
4
|
"description": "Modern Angular 22 UI Library based on TailwindCSS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"angular",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"@angular/cdk": "22",
|
|
40
40
|
"@angular/core": "22",
|
|
41
41
|
"@angular/forms": "22",
|
|
42
|
-
"@xui/core": "2.0.0-alpha.
|
|
43
|
-
"@xui/tag": "2.0.0-alpha.
|
|
42
|
+
"@xui/core": "2.0.0-alpha.21",
|
|
43
|
+
"@xui/tag": "2.0.0-alpha.21",
|
|
44
44
|
"class-variance-authority": "^0.7.1",
|
|
45
45
|
"clsx": "^2.1.1"
|
|
46
46
|
},
|
package/types/xui-tag-input.d.ts
CHANGED
|
@@ -20,11 +20,15 @@ type XuiTagInputVariants = VariantProps<typeof tagInputContainerVariants>;
|
|
|
20
20
|
* against the filled field it sits in.
|
|
21
21
|
*/
|
|
22
22
|
declare class XuiTagInput implements ControlValueAccessor {
|
|
23
|
+
/** Extra classes, merged into the component's own rather than replacing them. */
|
|
23
24
|
readonly class: _angular_core.InputSignal<ClassValue>;
|
|
24
25
|
/** The current tags. Two-way bindable with `[(values)]`. */
|
|
25
26
|
readonly values: _angular_core.ModelSignal<string[]>;
|
|
27
|
+
/** Text shown in the empty field. Hidden once there is at least one tag. */
|
|
26
28
|
readonly placeholder: _angular_core.InputSignal<string>;
|
|
29
|
+
/** Stretch to the available width instead of hugging its contents. */
|
|
27
30
|
readonly fill: _angular_core.InputSignalWithTransform<boolean, BooleanInput>;
|
|
31
|
+
/** Block interaction and dim the field and its tags. */
|
|
28
32
|
readonly disabled: _angular_core.InputSignalWithTransform<boolean, BooleanInput>;
|
|
29
33
|
/** Character that also commits the current draft (besides Enter). */
|
|
30
34
|
readonly separator: _angular_core.InputSignal<string>;
|