@neuravision/ng-construct 0.4.0 → 0.4.2

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.
@@ -4039,6 +4039,214 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImpor
4039
4039
  `, styles: [":host{display:block}\n"] }]
4040
4040
  }], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }, { type: i0.Output, args: ["disabledChange"] }], dateFormat: [{ type: i0.Input, args: [{ isSignal: true, alias: "dateFormat", required: false }] }], inputId: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputId", required: false }] }], dateChange: [{ type: i0.Output, args: ["dateChange"] }], inputRef: [{ type: i0.ViewChild, args: ['input', { isSignal: true }] }], popoverRef: [{ type: i0.ViewChild, args: ['popover', { isSignal: true }] }] } });
4041
4041
 
4042
+ /**
4043
+ * Chip component for labels, tags, statuses, and interactive filters.
4044
+ *
4045
+ * @example Static chip
4046
+ * <af-chip variant="success" size="sm">Resolved</af-chip>
4047
+ *
4048
+ * @example Toggle chip with two-way binding
4049
+ * <af-chip selectable [(selected)]="isActive">Filter</af-chip>
4050
+ *
4051
+ * @example Removable chip
4052
+ * <af-chip removable (removed)="onRemove()">Status: Active</af-chip>
4053
+ */
4054
+ class AfChipComponent {
4055
+ /** Semantic color variant. */
4056
+ variant = input('default', ...(ngDevMode ? [{ debugName: "variant" }] : []));
4057
+ /** Visual style: subtle (filled background), outline, or solid. */
4058
+ appearance = input('subtle', ...(ngDevMode ? [{ debugName: "appearance" }] : []));
4059
+ /** Size of the chip. */
4060
+ size = input('md', ...(ngDevMode ? [{ debugName: "size" }] : []));
4061
+ /** Opaque value for identifying this chip in lists or groups. */
4062
+ value = input(...(ngDevMode ? [undefined, { debugName: "value" }] : []));
4063
+ /** Enables toggle behavior with hover, active, focus styles, and keyboard support. */
4064
+ selectable = input(false, { ...(ngDevMode ? { debugName: "selectable" } : {}), transform: booleanAttribute });
4065
+ /** Selected state for toggle chips. Supports two-way binding via `[(selected)]`. */
4066
+ selected = model(false, ...(ngDevMode ? [{ debugName: "selected" }] : []));
4067
+ /** Disables the chip, preventing all interaction. */
4068
+ disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : {}), transform: booleanAttribute });
4069
+ /** Shows a remove button inside the chip. */
4070
+ removable = input(false, { ...(ngDevMode ? { debugName: "removable" } : {}), transform: booleanAttribute });
4071
+ /** Shows a dot status indicator instead of an icon. */
4072
+ dot = input(false, { ...(ngDevMode ? { debugName: "dot" } : {}), transform: booleanAttribute });
4073
+ /** Accessible label for icon-only or truncated chips. */
4074
+ ariaLabel = input(...(ngDevMode ? [undefined, { debugName: "ariaLabel" }] : []));
4075
+ /** Accessible label for the remove button. Should be localized by the consumer. */
4076
+ removeAriaLabel = input('Remove', ...(ngDevMode ? [{ debugName: "removeAriaLabel" }] : []));
4077
+ /** Emits the chip's `value` when the remove button is clicked or Delete/Backspace is pressed. */
4078
+ removed = output();
4079
+ chipRole = computed(() => {
4080
+ if (!this.selectable())
4081
+ return null;
4082
+ return this.removable() ? 'group' : 'button';
4083
+ }, ...(ngDevMode ? [{ debugName: "chipRole" }] : []));
4084
+ iconClasses = computed(() => {
4085
+ const classes = ['ct-chip__icon'];
4086
+ if (this.variant() !== 'default') {
4087
+ classes.push(`ct-chip__icon--${this.variant()}`);
4088
+ }
4089
+ return classes.join(' ');
4090
+ }, ...(ngDevMode ? [{ debugName: "iconClasses" }] : []));
4091
+ chipClasses = computed(() => {
4092
+ const classes = ['ct-chip'];
4093
+ if (this.size() !== 'md') {
4094
+ classes.push(`ct-chip--${this.size()}`);
4095
+ }
4096
+ if (this.appearance() !== 'subtle') {
4097
+ classes.push(`ct-chip--${this.appearance()}`);
4098
+ }
4099
+ if (this.variant() !== 'default') {
4100
+ classes.push(`ct-chip--${this.variant()}`);
4101
+ }
4102
+ if (this.selectable()) {
4103
+ classes.push('ct-chip--interactive');
4104
+ }
4105
+ if (this.selectable() && this.selected()) {
4106
+ classes.push('ct-chip--selected');
4107
+ }
4108
+ if (this.disabled()) {
4109
+ classes.push('ct-chip--disabled');
4110
+ }
4111
+ return classes.join(' ');
4112
+ }, ...(ngDevMode ? [{ debugName: "chipClasses" }] : []));
4113
+ handleClick() {
4114
+ if (!this.selectable() || this.disabled())
4115
+ return;
4116
+ this.selected.update(v => !v);
4117
+ }
4118
+ handleKeydown(event) {
4119
+ if (event.target.closest('.ct-chip__remove'))
4120
+ return;
4121
+ if (!this.selectable() || this.disabled())
4122
+ return;
4123
+ event.preventDefault();
4124
+ this.selected.update(v => !v);
4125
+ }
4126
+ handleRemoveKeydown(event) {
4127
+ if (!this.removable() || this.disabled())
4128
+ return;
4129
+ event.preventDefault();
4130
+ this.removed.emit(this.value());
4131
+ }
4132
+ handleRemove(event) {
4133
+ event.stopPropagation();
4134
+ this.removed.emit(this.value());
4135
+ }
4136
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: AfChipComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
4137
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.2", type: AfChipComponent, isStandalone: true, selector: "af-chip", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, appearance: { classPropertyName: "appearance", publicName: "appearance", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, selectable: { classPropertyName: "selectable", publicName: "selectable", isSignal: true, isRequired: false, transformFunction: null }, selected: { classPropertyName: "selected", publicName: "selected", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, removable: { classPropertyName: "removable", publicName: "removable", isSignal: true, isRequired: false, transformFunction: null }, dot: { classPropertyName: "dot", publicName: "dot", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, removeAriaLabel: { classPropertyName: "removeAriaLabel", publicName: "removeAriaLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selected: "selectedChange", removed: "removed" }, host: { listeners: { "click": "handleClick()", "keydown.enter": "handleKeydown($event)", "keydown.space": "handleKeydown($event)", "keydown.delete": "handleRemoveKeydown($event)", "keydown.backspace": "handleRemoveKeydown($event)" }, properties: { "class": "chipClasses()", "attr.role": "chipRole()", "attr.tabindex": "selectable() && !removable() && !disabled() ? \"0\" : null", "attr.aria-pressed": "selectable() && !removable() ? selected() : null", "attr.aria-disabled": "disabled() || null", "attr.aria-label": "ariaLabel() || null" } }, ngImport: i0, template: `
4138
+ <span
4139
+ class="ct-chip__action"
4140
+ [attr.role]="selectable() && removable() ? 'button' : null"
4141
+ [attr.tabindex]="selectable() && removable() && !disabled() ? '0' : null"
4142
+ [attr.aria-pressed]="selectable() && removable() ? selected() : null">
4143
+ @if (dot()) {
4144
+ <span class="ct-chip__dot" aria-hidden="true"></span>
4145
+ } @else {
4146
+ <span class="ct-chip__avatar">
4147
+ <ng-content select="[chipAvatar]" />
4148
+ </span>
4149
+
4150
+ <span [class]="iconClasses()" aria-hidden="true">
4151
+ <ng-content select="af-icon,[chipIcon]" />
4152
+ </span>
4153
+ }
4154
+
4155
+ <span class="ct-chip__label">
4156
+ <ng-content />
4157
+ </span>
4158
+
4159
+ @if (selectable()) {
4160
+ <span class="ct-chip__check" aria-hidden="true"></span>
4161
+ }
4162
+ </span>
4163
+
4164
+ @if (removable() && !disabled()) {
4165
+ <button
4166
+ type="button"
4167
+ class="ct-chip__remove"
4168
+ [attr.aria-label]="removeAriaLabel()"
4169
+ (click)="handleRemove($event)">
4170
+ <svg
4171
+ viewBox="0 0 24 24"
4172
+ width="16"
4173
+ height="16"
4174
+ fill="none"
4175
+ stroke="currentColor"
4176
+ stroke-width="2"
4177
+ stroke-linecap="round"
4178
+ aria-hidden="true">
4179
+ <line x1="18" y1="6" x2="6" y2="18" />
4180
+ <line x1="6" y1="6" x2="18" y2="18" />
4181
+ </svg>
4182
+ </button>
4183
+ }
4184
+ `, isInline: true, styles: [":host{display:inline-flex;align-items:center}.ct-chip__action{display:contents}.ct-chip__action:focus-visible{outline:none}:host:has(.ct-chip__action:focus-visible){outline:2px solid var(--color-focus-ring, Highlight);outline-offset:2px}.ct-chip__icon:not(:has(*)),.ct-chip__avatar:not(:has(*)){display:none}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
4185
+ }
4186
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: AfChipComponent, decorators: [{
4187
+ type: Component,
4188
+ args: [{ selector: 'af-chip', changeDetection: ChangeDetectionStrategy.OnPush, host: {
4189
+ '[class]': 'chipClasses()',
4190
+ '[attr.role]': 'chipRole()',
4191
+ '[attr.tabindex]': 'selectable() && !removable() && !disabled() ? "0" : null',
4192
+ '[attr.aria-pressed]': 'selectable() && !removable() ? selected() : null',
4193
+ '[attr.aria-disabled]': 'disabled() || null',
4194
+ '[attr.aria-label]': 'ariaLabel() || null',
4195
+ '(click)': 'handleClick()',
4196
+ '(keydown.enter)': 'handleKeydown($event)',
4197
+ '(keydown.space)': 'handleKeydown($event)',
4198
+ '(keydown.delete)': 'handleRemoveKeydown($event)',
4199
+ '(keydown.backspace)': 'handleRemoveKeydown($event)',
4200
+ }, template: `
4201
+ <span
4202
+ class="ct-chip__action"
4203
+ [attr.role]="selectable() && removable() ? 'button' : null"
4204
+ [attr.tabindex]="selectable() && removable() && !disabled() ? '0' : null"
4205
+ [attr.aria-pressed]="selectable() && removable() ? selected() : null">
4206
+ @if (dot()) {
4207
+ <span class="ct-chip__dot" aria-hidden="true"></span>
4208
+ } @else {
4209
+ <span class="ct-chip__avatar">
4210
+ <ng-content select="[chipAvatar]" />
4211
+ </span>
4212
+
4213
+ <span [class]="iconClasses()" aria-hidden="true">
4214
+ <ng-content select="af-icon,[chipIcon]" />
4215
+ </span>
4216
+ }
4217
+
4218
+ <span class="ct-chip__label">
4219
+ <ng-content />
4220
+ </span>
4221
+
4222
+ @if (selectable()) {
4223
+ <span class="ct-chip__check" aria-hidden="true"></span>
4224
+ }
4225
+ </span>
4226
+
4227
+ @if (removable() && !disabled()) {
4228
+ <button
4229
+ type="button"
4230
+ class="ct-chip__remove"
4231
+ [attr.aria-label]="removeAriaLabel()"
4232
+ (click)="handleRemove($event)">
4233
+ <svg
4234
+ viewBox="0 0 24 24"
4235
+ width="16"
4236
+ height="16"
4237
+ fill="none"
4238
+ stroke="currentColor"
4239
+ stroke-width="2"
4240
+ stroke-linecap="round"
4241
+ aria-hidden="true">
4242
+ <line x1="18" y1="6" x2="6" y2="18" />
4243
+ <line x1="6" y1="6" x2="18" y2="18" />
4244
+ </svg>
4245
+ </button>
4246
+ }
4247
+ `, styles: [":host{display:inline-flex;align-items:center}.ct-chip__action{display:contents}.ct-chip__action:focus-visible{outline:none}:host:has(.ct-chip__action:focus-visible){outline:2px solid var(--color-focus-ring, Highlight);outline-offset:2px}.ct-chip__icon:not(:has(*)),.ct-chip__avatar:not(:has(*)){display:none}\n"] }]
4248
+ }], propDecorators: { variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], appearance: [{ type: i0.Input, args: [{ isSignal: true, alias: "appearance", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], selectable: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectable", required: false }] }], selected: [{ type: i0.Input, args: [{ isSignal: true, alias: "selected", required: false }] }, { type: i0.Output, args: ["selectedChange"] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], removable: [{ type: i0.Input, args: [{ isSignal: true, alias: "removable", required: false }] }], dot: [{ type: i0.Input, args: [{ isSignal: true, alias: "dot", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], removeAriaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "removeAriaLabel", required: false }] }], removed: [{ type: i0.Output, args: ["removed"] }] } });
4249
+
4042
4250
  /**
4043
4251
  * Chip input component for managing a list of string values.
4044
4252
  *
@@ -8275,5 +8483,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImpor
8275
8483
  * Generated bundle index. Do not edit.
8276
8484
  */
8277
8485
 
8278
- export { AfAccordionComponent, AfAccordionItemComponent, AfAlertComponent, AfAppShellComponent, AfAppShellPageHeaderComponent, AfAppShellV2Component, AfAppShellV2ToolbarComponent, AfAvatarComponent, AfBadgeComponent, AfBannerComponent, AfBreadcrumbsComponent, AfButtonComponent, AfCardComponent, AfCellDefDirective, AfCheckboxComponent, AfChipInputComponent, AfComboboxComponent, AfDataTableComponent, AfDatepickerComponent, AfDividerComponent, AfDrawerComponent, AfDropdownComponent, AfEmptyStateComponent, AfFieldComponent, AfFileUploadComponent, AfFormatLabelPipe, AfIconComponent, AfInputComponent, AfModalComponent, AfNavItemComponent, AfNavTabsComponent, AfNavbarComponent, AfPaginationComponent, AfPopoverComponent, AfPopoverTriggerDirective, AfProgressBarComponent, AfRadioComponent, AfRadioGroupComponent, AfSelectComponent, AfSelectMenuComponent, AfSidebarComponent, AfSkeletonComponent, AfSkipLinkComponent, AfSliderComponent, AfSpinnerComponent, AfSwitchComponent, AfTabPanelComponent, AfTableBodyComponent, AfTableCellComponent, AfTableComponent, AfTableHeaderCellComponent, AfTableHeaderComponent, AfTableRowComponent, AfTabsComponent, AfTextareaComponent, AfToastContainerComponent, AfToastService, AfToggleGroupComponent, AfToolbarComponent, AfTooltipDirective };
8486
+ export { AfAccordionComponent, AfAccordionItemComponent, AfAlertComponent, AfAppShellComponent, AfAppShellPageHeaderComponent, AfAppShellV2Component, AfAppShellV2ToolbarComponent, AfAvatarComponent, AfBadgeComponent, AfBannerComponent, AfBreadcrumbsComponent, AfButtonComponent, AfCardComponent, AfCellDefDirective, AfCheckboxComponent, AfChipComponent, AfChipInputComponent, AfComboboxComponent, AfDataTableComponent, AfDatepickerComponent, AfDividerComponent, AfDrawerComponent, AfDropdownComponent, AfEmptyStateComponent, AfFieldComponent, AfFileUploadComponent, AfFormatLabelPipe, AfIconComponent, AfInputComponent, AfModalComponent, AfNavItemComponent, AfNavTabsComponent, AfNavbarComponent, AfPaginationComponent, AfPopoverComponent, AfPopoverTriggerDirective, AfProgressBarComponent, AfRadioComponent, AfRadioGroupComponent, AfSelectComponent, AfSelectMenuComponent, AfSidebarComponent, AfSkeletonComponent, AfSkipLinkComponent, AfSliderComponent, AfSpinnerComponent, AfSwitchComponent, AfTabPanelComponent, AfTableBodyComponent, AfTableCellComponent, AfTableComponent, AfTableHeaderCellComponent, AfTableHeaderComponent, AfTableRowComponent, AfTabsComponent, AfTextareaComponent, AfToastContainerComponent, AfToastService, AfToggleGroupComponent, AfToolbarComponent, AfTooltipDirective };
8279
8487
  //# sourceMappingURL=neuravision-ng-construct.mjs.map