angular-tailwind-components 1.8.0 → 1.8.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.
package/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
A comprehensive Angular component library built entirely with **Tailwind CSS v4** — zero additional UI dependencies.
|
|
4
4
|
|
|
5
|
+
**Live Storybook:** [angular-tailwind-components.vercel.app](https://angular-tailwind-components.vercel.app/)
|
|
6
|
+
|
|
5
7
|
## Features
|
|
6
8
|
|
|
7
9
|
- 🎨 **36 components** — Buttons, Inputs, Modals, Tables, DatePickers, and more
|
|
@@ -10,7 +12,7 @@ A comprehensive Angular component library built entirely with **Tailwind CSS v4*
|
|
|
10
12
|
- 📝 **ControlValueAccessor** — Full reactive forms integration for all form components
|
|
11
13
|
- ♿ **Accessible** — WCAG-compliant with proper ARIA roles and keyboard support
|
|
12
14
|
- 🧪 **Tested** — Unit tests with Vitest
|
|
13
|
-
- 📖 **Storybook** — Visual documentation for all components
|
|
15
|
+
- 📖 **Storybook** — [Visual documentation](https://angular-tailwind-components.vercel.app/) for all components
|
|
14
16
|
- 🎭 **Customizable** — **`defineTheme()`** for injection-token defaults and runtime semantic colors; optional CSS overrides via `@theme`
|
|
15
17
|
|
|
16
18
|
## Installation
|
|
@@ -272,12 +274,17 @@ You can still override any token in your own CSS, for example:
|
|
|
272
274
|
|
|
273
275
|
## Development
|
|
274
276
|
|
|
277
|
+
Browse components in the hosted Storybook: [angular-tailwind-components.vercel.app](https://angular-tailwind-components.vercel.app/)
|
|
278
|
+
|
|
275
279
|
```bash
|
|
276
280
|
# Build the library
|
|
277
281
|
ng build angular-tailwind-components
|
|
278
282
|
|
|
279
|
-
# Start Storybook
|
|
283
|
+
# Start Storybook locally
|
|
280
284
|
npm run storybook
|
|
285
|
+
|
|
286
|
+
# Build static Storybook (output: storybook-static/)
|
|
287
|
+
npm run build:storybook
|
|
281
288
|
```
|
|
282
289
|
|
|
283
290
|
### Component Conventions
|
|
@@ -668,6 +668,7 @@ class TailwindSortHeaderDirective {
|
|
|
668
668
|
sortKey = input.required(...(ngDevMode ? [{ debugName: "sortKey" }] : /* istanbul ignore next */ []));
|
|
669
669
|
host = inject((ElementRef));
|
|
670
670
|
renderer = inject(Renderer2);
|
|
671
|
+
labelWrapper;
|
|
671
672
|
appRef = inject(ApplicationRef);
|
|
672
673
|
environmentInjector = inject(EnvironmentInjector);
|
|
673
674
|
injector = inject(Injector);
|
|
@@ -718,11 +719,12 @@ class TailwindSortHeaderDirective {
|
|
|
718
719
|
this.iconRef.changeDetectorRef.detectChanges();
|
|
719
720
|
};
|
|
720
721
|
if (!this.iconRef) {
|
|
722
|
+
const labelHost = this.ensureLabelWrapper();
|
|
721
723
|
this.iconRef = createComponent(TailwindIcon, {
|
|
722
724
|
environmentInjector: this.environmentInjector,
|
|
723
725
|
elementInjector: this.injector
|
|
724
726
|
});
|
|
725
|
-
this.renderer.appendChild(
|
|
727
|
+
this.renderer.appendChild(labelHost, this.iconRef.location.nativeElement);
|
|
726
728
|
this.appRef.attachView(this.iconRef.hostView);
|
|
727
729
|
}
|
|
728
730
|
sync();
|
|
@@ -732,8 +734,31 @@ class TailwindSortHeaderDirective {
|
|
|
732
734
|
attributeFilter: [TW_TABLE_SORT_KEY_ATTR, TW_TABLE_SORT_DIR_ATTR]
|
|
733
735
|
});
|
|
734
736
|
}
|
|
737
|
+
/** Keep `th` as `display: table-cell`; flex only on an inner wrapper (label + icon). */
|
|
738
|
+
ensureLabelWrapper() {
|
|
739
|
+
if (this.labelWrapper)
|
|
740
|
+
return this.labelWrapper;
|
|
741
|
+
const th = this.host.nativeElement;
|
|
742
|
+
const existing = th.querySelector('[data-tw-sort-header-label]');
|
|
743
|
+
if (existing instanceof HTMLElement) {
|
|
744
|
+
this.labelWrapper = existing;
|
|
745
|
+
return existing;
|
|
746
|
+
}
|
|
747
|
+
const wrapper = this.renderer.createElement('span');
|
|
748
|
+
this.renderer.setAttribute(wrapper, 'data-tw-sort-header-label', '');
|
|
749
|
+
this.renderer.addClass(wrapper, 'inline-flex');
|
|
750
|
+
this.renderer.addClass(wrapper, 'items-center');
|
|
751
|
+
this.renderer.addClass(wrapper, 'gap-1.5');
|
|
752
|
+
this.renderer.addClass(wrapper, 'justify-start');
|
|
753
|
+
for (const child of Array.from(th.childNodes)) {
|
|
754
|
+
this.renderer.appendChild(wrapper, child);
|
|
755
|
+
}
|
|
756
|
+
this.renderer.appendChild(th, wrapper);
|
|
757
|
+
this.labelWrapper = wrapper;
|
|
758
|
+
return wrapper;
|
|
759
|
+
}
|
|
735
760
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: TailwindSortHeaderDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
736
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.12", type: TailwindSortHeaderDirective, isStandalone: true, selector: "[tailwindSortHeader]", inputs: { sortKey: { classPropertyName: "sortKey", publicName: "sortKey", isSignal: true, isRequired: true, transformFunction: null } }, host: { properties: { "attr.tabindex": "0", "attr.data-sort-key": "sortKey()" }, classAttribute: "
|
|
761
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.12", type: TailwindSortHeaderDirective, isStandalone: true, selector: "[tailwindSortHeader]", inputs: { sortKey: { classPropertyName: "sortKey", publicName: "sortKey", isSignal: true, isRequired: true, transformFunction: null } }, host: { properties: { "attr.tabindex": "0", "attr.data-sort-key": "sortKey()" }, classAttribute: "cursor-pointer whitespace-nowrap text-left select-none hover:text-neutral-900" }, ngImport: i0 });
|
|
737
762
|
}
|
|
738
763
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: TailwindSortHeaderDirective, decorators: [{
|
|
739
764
|
type: Directive,
|
|
@@ -741,7 +766,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImpo
|
|
|
741
766
|
selector: '[tailwindSortHeader]',
|
|
742
767
|
standalone: true,
|
|
743
768
|
host: {
|
|
744
|
-
class: '
|
|
769
|
+
class: 'cursor-pointer whitespace-nowrap text-left select-none hover:text-neutral-900',
|
|
745
770
|
'[attr.tabindex]': '0',
|
|
746
771
|
'[attr.data-sort-key]': 'sortKey()'
|
|
747
772
|
}
|