ngx-strata 0.4.3 → 0.4.4
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/assets/styles/components/input-field.scss +60 -1
- package/assets/styles/components/item.scss +13 -2
- package/assets/styles/components/modal.scss +5 -3
- package/dist/strata/strata.css +1 -1
- package/fesm2022/ngx-strata.mjs +32 -4
- package/fesm2022/ngx-strata.mjs.map +1 -1
- package/package.json +1 -1
- package/skills/ngx-strata/components/input-field.md +1 -0
- package/types/ngx-strata.d.ts +4 -1
package/fesm2022/ngx-strata.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, Injectable, provideAppInitializer, makeEnvironmentProviders, DOCUMENT, signal, computed, effect, InjectionToken, provideEnvironmentInitializer, ElementRef, input, model, output, Directive, Renderer2, DestroyRef, Pipe, HostBinding, Component, contentChildren, forwardRef, contentChild, HostListener, ViewContainerRef, viewChild,
|
|
2
|
+
import { inject, Injectable, provideAppInitializer, makeEnvironmentProviders, DOCUMENT, signal, computed, effect, InjectionToken, provideEnvironmentInitializer, ElementRef, input, model, output, Directive, Renderer2, DestroyRef, Pipe, HostBinding, Component, contentChildren, forwardRef, contentChild, HostListener, ViewContainerRef, viewChild, booleanAttribute, numberAttribute, Injector, LOCALE_ID, viewChildren, ContentChildren, TemplateRef } from '@angular/core';
|
|
3
3
|
import { Observable, tap, map, fromEvent, switchMap, filter } from 'rxjs';
|
|
4
4
|
import { HttpClient } from '@angular/common/http';
|
|
5
5
|
import { DomSanitizer } from '@angular/platform-browser';
|
|
@@ -2063,6 +2063,7 @@ class StrataInputFieldComponent {
|
|
|
2063
2063
|
hostElement = inject((ElementRef));
|
|
2064
2064
|
size = input('md', /* @ts-ignore */
|
|
2065
2065
|
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
2066
|
+
disabled = input(undefined, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: (value) => value === undefined || value === null || value === '' ? undefined : booleanAttribute(value) });
|
|
2066
2067
|
maxLength = input(undefined, { ...(ngDevMode ? { debugName: "maxLength" } : /* istanbul ignore next */ {}), transform: (value) => value === undefined || value === null || value === '' ? undefined : numberAttribute(value) });
|
|
2067
2068
|
showCharacterCounter = input(false, { ...(ngDevMode ? { debugName: "showCharacterCounter" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
2068
2069
|
characterCounterFormatter = input(undefined, /* @ts-ignore */
|
|
@@ -2075,8 +2076,12 @@ class StrataInputFieldComponent {
|
|
|
2075
2076
|
...(ngDevMode ? [{ debugName: "currentLength" }] : /* istanbul ignore next */ []));
|
|
2076
2077
|
nativeMaxLength = signal(undefined, /* @ts-ignore */
|
|
2077
2078
|
...(ngDevMode ? [{ debugName: "nativeMaxLength" }] : /* istanbul ignore next */ []));
|
|
2079
|
+
nativeDisabled = signal(false, /* @ts-ignore */
|
|
2080
|
+
...(ngDevMode ? [{ debugName: "nativeDisabled" }] : /* istanbul ignore next */ []));
|
|
2078
2081
|
effectiveMaxLength = computed(() => this.maxLength() ?? this.nativeMaxLength(), /* @ts-ignore */
|
|
2079
2082
|
...(ngDevMode ? [{ debugName: "effectiveMaxLength" }] : /* istanbul ignore next */ []));
|
|
2083
|
+
effectiveDisabled = computed(() => (this.disabled() ?? false) || this.nativeDisabled(), /* @ts-ignore */
|
|
2084
|
+
...(ngDevMode ? [{ debugName: "effectiveDisabled" }] : /* istanbul ignore next */ []));
|
|
2080
2085
|
counterText = computed(() => {
|
|
2081
2086
|
const current = this.currentLength();
|
|
2082
2087
|
const max = this.effectiveMaxLength();
|
|
@@ -2098,6 +2103,16 @@ class StrataInputFieldComponent {
|
|
|
2098
2103
|
this.pendingFocus.set(false);
|
|
2099
2104
|
}
|
|
2100
2105
|
});
|
|
2106
|
+
effect(() => {
|
|
2107
|
+
const explicitDisabled = this.disabled();
|
|
2108
|
+
const input = this.nativeInput;
|
|
2109
|
+
if (input && explicitDisabled !== undefined && input.disabled !== explicitDisabled) {
|
|
2110
|
+
input.disabled = explicitDisabled;
|
|
2111
|
+
if (this.nativeDisabled() !== explicitDisabled) {
|
|
2112
|
+
this.nativeDisabled.set(explicitDisabled);
|
|
2113
|
+
}
|
|
2114
|
+
}
|
|
2115
|
+
});
|
|
2101
2116
|
}
|
|
2102
2117
|
ngAfterViewInit() {
|
|
2103
2118
|
setTimeout(() => this.iconComponents().forEach((icon) => icon.size.set('sm')), 1);
|
|
@@ -2110,6 +2125,9 @@ class StrataInputFieldComponent {
|
|
|
2110
2125
|
this.syncNativeState();
|
|
2111
2126
|
}
|
|
2112
2127
|
focus() {
|
|
2128
|
+
if (this.effectiveDisabled()) {
|
|
2129
|
+
return;
|
|
2130
|
+
}
|
|
2113
2131
|
this.pendingFocus.set(true);
|
|
2114
2132
|
}
|
|
2115
2133
|
blur() {
|
|
@@ -2144,13 +2162,21 @@ class StrataInputFieldComponent {
|
|
|
2144
2162
|
this.nativeMaxLength.set(validMax);
|
|
2145
2163
|
}
|
|
2146
2164
|
}
|
|
2165
|
+
const explicitDisabled = this.disabled();
|
|
2166
|
+
if (explicitDisabled !== undefined && input.disabled !== explicitDisabled) {
|
|
2167
|
+
input.disabled = explicitDisabled;
|
|
2168
|
+
}
|
|
2169
|
+
const isInputDisabled = input.disabled || input.hasAttribute('disabled');
|
|
2170
|
+
if (this.nativeDisabled() !== isInputDisabled) {
|
|
2171
|
+
this.nativeDisabled.set(isInputDisabled);
|
|
2172
|
+
}
|
|
2147
2173
|
const currentLen = input.value.length;
|
|
2148
2174
|
if (this.currentLength() !== currentLen) {
|
|
2149
2175
|
this.currentLength.set(currentLen);
|
|
2150
2176
|
}
|
|
2151
2177
|
}
|
|
2152
2178
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: StrataInputFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2153
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.1", type: StrataInputFieldComponent, isStandalone: true, selector: "st-input-field", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, maxLength: { classPropertyName: "maxLength", publicName: "maxLength", isSignal: true, isRequired: false, transformFunction: null }, showCharacterCounter: { classPropertyName: "showCharacterCounter", publicName: "showCharacterCounter", isSignal: true, isRequired: false, transformFunction: null }, characterCounterFormatter: { classPropertyName: "characterCounterFormatter", publicName: "characterCounterFormatter", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "input": "onNativeInput()", "change": "onNativeInput()" }, properties: { "class.st-size-sm": "size() === \"sm\"", "class.st-size-md": "size() === \"md\"", "class.st-size-lg": "size() === \"lg\"" } }, queries: [{ propertyName: "iconComponents", predicate: StrataIconComponent, descendants: true, isSignal: true }, { propertyName: "inputField", first: true, predicate: StrataNativeInputRefDirective, descendants: true, isSignal: true }], ngImport: i0, template: "<ng-content select=\"label\"></ng-content>\n<div class=\"st-input-wrapper\">\n <div class=\"affix\">\n <ng-content select=\"[prefix]\"></ng-content>\n </div>\n <ng-content select=\"input,textarea\"></ng-content>\n <div class=\"affix\">\n <ng-content select=\"[suffix]\"></ng-content>\n </div>\n</div>\n@if (showCharacterCounter()) {\n <div class=\"st-input-field-footer\">\n <span class=\"st-input-field-counter\" aria-live=\"polite\">{{ counterText() }}</span>\n </div>\n}\n" });
|
|
2179
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.1", type: StrataInputFieldComponent, isStandalone: true, selector: "st-input-field", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, maxLength: { classPropertyName: "maxLength", publicName: "maxLength", isSignal: true, isRequired: false, transformFunction: null }, showCharacterCounter: { classPropertyName: "showCharacterCounter", publicName: "showCharacterCounter", isSignal: true, isRequired: false, transformFunction: null }, characterCounterFormatter: { classPropertyName: "characterCounterFormatter", publicName: "characterCounterFormatter", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "input": "onNativeInput()", "change": "onNativeInput()" }, properties: { "class.st-size-sm": "size() === \"sm\"", "class.st-size-md": "size() === \"md\"", "class.st-size-lg": "size() === \"lg\"", "class.st-disabled": "effectiveDisabled()", "attr.aria-disabled": "effectiveDisabled() ? \"true\" : null" } }, queries: [{ propertyName: "iconComponents", predicate: StrataIconComponent, descendants: true, isSignal: true }, { propertyName: "inputField", first: true, predicate: StrataNativeInputRefDirective, descendants: true, isSignal: true }], ngImport: i0, template: "<ng-content select=\"label\"></ng-content>\n<div class=\"st-input-wrapper\">\n <div class=\"affix\">\n <ng-content select=\"[prefix]\"></ng-content>\n </div>\n <ng-content select=\"input,textarea\"></ng-content>\n <div class=\"affix\">\n <ng-content select=\"[suffix]\"></ng-content>\n </div>\n</div>\n@if (showCharacterCounter()) {\n <div class=\"st-input-field-footer\">\n <span class=\"st-input-field-counter\" aria-live=\"polite\">{{ counterText() }}</span>\n </div>\n}\n" });
|
|
2154
2180
|
}
|
|
2155
2181
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: StrataInputFieldComponent, decorators: [{
|
|
2156
2182
|
type: Component,
|
|
@@ -2158,10 +2184,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImpor
|
|
|
2158
2184
|
'[class.st-size-sm]': 'size() === "sm"',
|
|
2159
2185
|
'[class.st-size-md]': 'size() === "md"',
|
|
2160
2186
|
'[class.st-size-lg]': 'size() === "lg"',
|
|
2187
|
+
'[class.st-disabled]': 'effectiveDisabled()',
|
|
2188
|
+
'[attr.aria-disabled]': 'effectiveDisabled() ? "true" : null',
|
|
2161
2189
|
'(input)': 'onNativeInput()',
|
|
2162
2190
|
'(change)': 'onNativeInput()'
|
|
2163
2191
|
}, template: "<ng-content select=\"label\"></ng-content>\n<div class=\"st-input-wrapper\">\n <div class=\"affix\">\n <ng-content select=\"[prefix]\"></ng-content>\n </div>\n <ng-content select=\"input,textarea\"></ng-content>\n <div class=\"affix\">\n <ng-content select=\"[suffix]\"></ng-content>\n </div>\n</div>\n@if (showCharacterCounter()) {\n <div class=\"st-input-field-footer\">\n <span class=\"st-input-field-counter\" aria-live=\"polite\">{{ counterText() }}</span>\n </div>\n}\n" }]
|
|
2164
|
-
}], ctorParameters: () => [], propDecorators: { size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], maxLength: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxLength", required: false }] }], showCharacterCounter: [{ type: i0.Input, args: [{ isSignal: true, alias: "showCharacterCounter", required: false }] }], characterCounterFormatter: [{ type: i0.Input, args: [{ isSignal: true, alias: "characterCounterFormatter", required: false }] }], iconComponents: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => StrataIconComponent), { ...{ descendants: true }, isSignal: true }] }], inputField: [{ type: i0.ContentChild, args: [i0.forwardRef(() => StrataNativeInputRefDirective), { ...{
|
|
2192
|
+
}], ctorParameters: () => [], propDecorators: { size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], maxLength: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxLength", required: false }] }], showCharacterCounter: [{ type: i0.Input, args: [{ isSignal: true, alias: "showCharacterCounter", required: false }] }], characterCounterFormatter: [{ type: i0.Input, args: [{ isSignal: true, alias: "characterCounterFormatter", required: false }] }], iconComponents: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => StrataIconComponent), { ...{ descendants: true }, isSignal: true }] }], inputField: [{ type: i0.ContentChild, args: [i0.forwardRef(() => StrataNativeInputRefDirective), { ...{
|
|
2165
2193
|
descendants: true
|
|
2166
2194
|
}, isSignal: true }] }] } });
|
|
2167
2195
|
|
|
@@ -4061,7 +4089,7 @@ class StrataSingleSelectComponent {
|
|
|
4061
4089
|
useExisting: forwardRef(() => StrataSingleSelectComponent),
|
|
4062
4090
|
multi: true
|
|
4063
4091
|
}
|
|
4064
|
-
], queries: [{ propertyName: "selectItems", predicate: StrataSelectItemComponent, isSignal: true }, { propertyName: "triggerTemplate", first: true, predicate: StrataSelectTriggerDirective, descendants: true, read: TemplateRef, isSignal: true }], viewQueries: [{ propertyName: "inputField", first: true, predicate: StrataInputFieldComponent, descendants: true, isSignal: true }], ngImport: i0, template: "@if (label()) {\n<label class=\"st-label\" [for]=\"name()\"> {{ label() }}</label>\n}\n<div class=\"single-select-input\" [class.disabled]=\"effectiveDisabled()\" [id]=\"name()\" #singleSelectInput (click)=\"toggle($event)\" (keydown.space)=\"toggle($event)\" (keydown.enter)=\"toggle($event)\" (keydown.escape)=\"open.set(false)\" [attr.data-open]=\"open()\"\n [attr.tabindex]=\"effectiveDisabled() ? -1 : 0\" [stOverlay]=\"selector\" [overlayOpen]=\"open()\" [overlayPlacement]=\"placement()\">\n @if (selectedItem()) {\n @if (triggerTemplate()) {\n <ng-container *ngTemplateOutlet=\"triggerTemplate()!\"></ng-container>\n } @else {\n {{ selectedItem()!.text() }}\n }\n } @else {\n <span class=\"placeholder-text\">{{ placeholder() }}</span>\n }\n\n <st-icon name=\"expand-up-down\"></st-icon>\n</div>\n\n<ng-template #selector>\n <div class=\"single-select-selector\" #singleSelectSelector [class.full-width]=\"fullWidth()\">\n @if (searchable()) {\n <st-input-field>\n <input stInput #searchField type=\"text\" [value]=\"searchQuery() || ''\" (input)=\"searchQuery.set($any($event.target).value); onSearchChange(searchQuery())\" [placeholder]=\"searchPlaceholder()\" />\n <button stButton variant=\"ghost\" [class.visible]=\"searchQuery() !== undefined && searchQuery()!.length > 0\" suffix\n size=\"sm\" (click)=\"searchQuery.set(undefined); onSearchChange(undefined)\">\n x\n </button>\n </st-input-field>\n }\n <div class=\"single-select-items-container\">\n <ng-content select=\"st-select-item\"></ng-content>\n </div>\n </div>\n</ng-template>", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: StrataIconComponent, selector: "st-icon", inputs: ["name", "size", "ariaLabel"], outputs: ["sizeChange"] }, { kind: "directive", type: StrataOverlayDirective, selector: "[stOverlay]", inputs: ["stOverlay", "overlayOpen", "overlayPlacement", "overlayOffset", "overlayFitViewport"], outputs: ["overlayOpenChange"] }, { kind: "component", type: StrataInputFieldComponent, selector: "st-input-field", inputs: ["size", "maxLength", "showCharacterCounter", "characterCounterFormatter"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: StrataNativeInputRefDirective, selector: "input[stInput], textarea[stInput]" }, { kind: "directive", type: StrataButtonDirective, selector: "[stButton]", inputs: ["variant", "size", "fullWidth"] }] });
|
|
4092
|
+
], queries: [{ propertyName: "selectItems", predicate: StrataSelectItemComponent, isSignal: true }, { propertyName: "triggerTemplate", first: true, predicate: StrataSelectTriggerDirective, descendants: true, read: TemplateRef, isSignal: true }], viewQueries: [{ propertyName: "inputField", first: true, predicate: StrataInputFieldComponent, descendants: true, isSignal: true }], ngImport: i0, template: "@if (label()) {\n<label class=\"st-label\" [for]=\"name()\"> {{ label() }}</label>\n}\n<div class=\"single-select-input\" [class.disabled]=\"effectiveDisabled()\" [id]=\"name()\" #singleSelectInput (click)=\"toggle($event)\" (keydown.space)=\"toggle($event)\" (keydown.enter)=\"toggle($event)\" (keydown.escape)=\"open.set(false)\" [attr.data-open]=\"open()\"\n [attr.tabindex]=\"effectiveDisabled() ? -1 : 0\" [stOverlay]=\"selector\" [overlayOpen]=\"open()\" [overlayPlacement]=\"placement()\">\n @if (selectedItem()) {\n @if (triggerTemplate()) {\n <ng-container *ngTemplateOutlet=\"triggerTemplate()!\"></ng-container>\n } @else {\n {{ selectedItem()!.text() }}\n }\n } @else {\n <span class=\"placeholder-text\">{{ placeholder() }}</span>\n }\n\n <st-icon name=\"expand-up-down\"></st-icon>\n</div>\n\n<ng-template #selector>\n <div class=\"single-select-selector\" #singleSelectSelector [class.full-width]=\"fullWidth()\">\n @if (searchable()) {\n <st-input-field>\n <input stInput #searchField type=\"text\" [value]=\"searchQuery() || ''\" (input)=\"searchQuery.set($any($event.target).value); onSearchChange(searchQuery())\" [placeholder]=\"searchPlaceholder()\" />\n <button stButton variant=\"ghost\" [class.visible]=\"searchQuery() !== undefined && searchQuery()!.length > 0\" suffix\n size=\"sm\" (click)=\"searchQuery.set(undefined); onSearchChange(undefined)\">\n x\n </button>\n </st-input-field>\n }\n <div class=\"single-select-items-container\">\n <ng-content select=\"st-select-item\"></ng-content>\n </div>\n </div>\n</ng-template>", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: StrataIconComponent, selector: "st-icon", inputs: ["name", "size", "ariaLabel"], outputs: ["sizeChange"] }, { kind: "directive", type: StrataOverlayDirective, selector: "[stOverlay]", inputs: ["stOverlay", "overlayOpen", "overlayPlacement", "overlayOffset", "overlayFitViewport"], outputs: ["overlayOpenChange"] }, { kind: "component", type: StrataInputFieldComponent, selector: "st-input-field", inputs: ["size", "disabled", "maxLength", "showCharacterCounter", "characterCounterFormatter"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: StrataNativeInputRefDirective, selector: "input[stInput], textarea[stInput]" }, { kind: "directive", type: StrataButtonDirective, selector: "[stButton]", inputs: ["variant", "size", "fullWidth"] }] });
|
|
4065
4093
|
}
|
|
4066
4094
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: StrataSingleSelectComponent, decorators: [{
|
|
4067
4095
|
type: Component,
|