angular-tailwind-components 1.5.0 → 1.6.0
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
|
@@ -63,7 +63,7 @@ export class ExampleComponent {
|
|
|
63
63
|
|
|
64
64
|
## Application configuration (`defineTheme`)
|
|
65
65
|
|
|
66
|
-
Use **`defineTheme`** from `angular-tailwind-components` as the single app-level entry: it registers **`EnvironmentProviders`** for optional **injection tokens** (`iconSize`, `datetimeLanguage`, `componentsSize`, `paginationSummary`) and, when you pass **`colors`**, an app initializer that applies semantic CSS variables on `document.documentElement` in the browser. Add **one** entry to `providers` without spreading.
|
|
66
|
+
Use **`defineTheme`** from `angular-tailwind-components` as the single app-level entry: it registers **`EnvironmentProviders`** for optional **injection tokens** (`iconSize`, `datetimeLanguage`, `componentsSize`, `buttonKind`, `paginationSummary`) and, when you pass **`colors`**, an app initializer that applies semantic CSS variables on `document.documentElement` in the browser. Add **one** entry to `providers` without spreading.
|
|
67
67
|
|
|
68
68
|
`TailwindDefineThemeConfig` extends **`TailwindComponentsConfig`** with an optional **`colors`** field.
|
|
69
69
|
|
|
@@ -79,6 +79,7 @@ export const appConfig: ApplicationConfig = {
|
|
|
79
79
|
iconSize: 20,
|
|
80
80
|
datetimeLanguage: 'it',
|
|
81
81
|
componentsSize: 'md',
|
|
82
|
+
buttonKind: 'flat',
|
|
82
83
|
paginationSummary: 'Visualizzati {start}-{end} di {total}',
|
|
83
84
|
colors: {
|
|
84
85
|
primary: 'violet', // Forma oggetto: { 600: '#4f46e5', 700: '#4338ca' }
|
|
@@ -132,6 +133,7 @@ You can omit **`colors`** if you only need token defaults, or omit token keys if
|
|
|
132
133
|
| `iconSize` | `TAILWIND_ICON_SIZE` |
|
|
133
134
|
| `datetimeLanguage` | `TAILWIND_DATETIME_LANGUAGE` |
|
|
134
135
|
| `componentsSize` | `TAILWIND_COMPONENTS_SIZE` |
|
|
136
|
+
| `buttonKind` | `TAILWIND_BUTTON_KIND` |
|
|
135
137
|
| `paginationSummary` | `TAILWIND_PAGINATION_SUMMARY` |
|
|
136
138
|
|
|
137
139
|
**`provideTailwindComponents`** is still exported for backward compatibility (token providers only, same implementation as the token slice of `defineTheme`). It is **deprecated**; prefer **`defineTheme`**.
|
|
@@ -142,25 +144,44 @@ The optional **`colors`** object remaps semantic design tokens (`primary`, `neut
|
|
|
142
144
|
|
|
143
145
|
| `colors` key | CSS variables | Default palette in `tailwind.css` |
|
|
144
146
|
| --- | --- | --- |
|
|
145
|
-
| `primary` | `--color-primary-*` | Tailwind `blue` |
|
|
146
|
-
| `neutral` | `--color-neutral-*` | Tailwind `slate` |
|
|
147
|
-
| `success` | `--color-success-*` | Tailwind `green` |
|
|
148
|
-
| `warning` | `--color-warning-*` | Tailwind `amber` |
|
|
149
|
-
| `danger` | `--color-danger-*` | Tailwind `red` |
|
|
147
|
+
| `primary` | `--color-primary-*`, `--color-on-primary-*` | Tailwind `blue` |
|
|
148
|
+
| `neutral` | `--color-neutral-*`, `--color-on-neutral-*` | Tailwind `slate` |
|
|
149
|
+
| `success` | `--color-success-*`, `--color-on-success-*` | Tailwind `green` |
|
|
150
|
+
| `warning` | `--color-warning-*`, `--color-on-warning-*` | Tailwind `amber` |
|
|
151
|
+
| `danger` | `--color-danger-*`, `--color-on-danger-*` | Tailwind `red` |
|
|
150
152
|
| `error` | Same as `danger` if `danger` is omitted | — |
|
|
151
|
-
| `info` | `--color-info-*` | Tailwind `sky` |
|
|
153
|
+
| `info` | `--color-info-*`, `--color-on-info-*` | Tailwind `sky` |
|
|
152
154
|
|
|
153
155
|
### `TailwindThemeSeverityColor`
|
|
154
156
|
|
|
155
|
-
Each `colors.*` field uses the exported type **`TailwindThemeSeverityColor`**. It can be
|
|
157
|
+
Each `colors.*` field uses the exported type **`TailwindThemeSeverityColor`**. It can be any of the following:
|
|
156
158
|
|
|
157
159
|
1. **A string — Tailwind palette name**
|
|
158
160
|
Use the lowercase **family name** only (the segment between the utility prefix and the shade), e.g. `bg-indigo-600` → `'indigo'`, `text-slate-500` → `'slate'`.
|
|
159
161
|
The full list of built-in names and swatches is in the official **[Tailwind CSS color reference](https://tailwindcss.com/docs/colors)** — pick any name from that page for the string form.
|
|
160
|
-
For each configured shade, `defineTheme` sets `--color-<semantic>-<shade>` to `var(--color-<that-name>-<shade>)`.
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
162
|
+
For each configured shade, `defineTheme` sets `--color-<semantic>-<shade>` to `var(--color-<that-name>-<shade>)`.
|
|
163
|
+
**Foreground / contrast:** built-in components that sit on saturated semantic backgrounds (solid buttons, tags, semantic toolbar) use utilities like `text-on-success-600`, backed by **`--color-on-<semantic>-<shade>`** defaults in the library `@theme`. With a **palette string**, you usually do **not** need to set `on` yourself — Tailwind’s scales stay internally consistent.
|
|
164
|
+
|
|
165
|
+
2. **A partial object — per-shade CSS (legacy flat form)**
|
|
166
|
+
Keys are optional shade steps: `'50'`, `'100'`, …, `'950'`. Values are any valid CSS color (`#hex`, `rgb()`, `oklch()`, `var(--color-fuchsia-600)`, etc.). Only the keys you pass are written to `--color-<semantic>-<shade>`.
|
|
167
|
+
**Optional `on`:** if you override background shades with custom values, set matching foreground tokens by using the structured form below so text stays readable.
|
|
168
|
+
|
|
169
|
+
3. **A structured object — `{ shades, on? }`**
|
|
170
|
+
- **`shades`**: same as the flat object: maps to `--color-<semantic>-<shade>`.
|
|
171
|
+
- **`on`**: optional partial map of the same shade keys → CSS colors for **`--color-on-<semantic>-<shade>`** (recommended foreground on that semantic background). Solid `tailwind-button` / `tailwind-tag` / semantic `tailwind-toolbar` read these via `text-on-*` utilities.
|
|
172
|
+
|
|
173
|
+
Example:
|
|
174
|
+
|
|
175
|
+
```typescript
|
|
176
|
+
defineTheme({
|
|
177
|
+
colors: {
|
|
178
|
+
success: {
|
|
179
|
+
shades: { 600: '#14532d', 700: '#0f3d21' },
|
|
180
|
+
on: { 600: '#ecfdf5', 700: '#ecfdf5' }
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
```
|
|
164
185
|
|
|
165
186
|
When you use a **string**, shade coverage matches the library tokens: `primary` and `neutral` include `950`; `success`, `warning`, `danger`, and `info` stop at `900`.
|
|
166
187
|
|
|
@@ -579,6 +579,8 @@ const TAILWIND_MODAL_DATA = new InjectionToken('TAILWIND_MODAL_DATA');
|
|
|
579
579
|
const TAILWIND_ICON_SIZE = new InjectionToken('TAILWIND_ICON_SIZE');
|
|
580
580
|
const TAILWIND_DATETIME_LANGUAGE = new InjectionToken('TAILWIND_DATETIME_LANGUAGE');
|
|
581
581
|
const TAILWIND_COMPONENTS_SIZE = new InjectionToken('TAILWIND_COMPONENTS_SIZE');
|
|
582
|
+
/** Default `kind` for `tailwind-button` when the `kind` input is omitted. */
|
|
583
|
+
const TAILWIND_BUTTON_KIND = new InjectionToken('TAILWIND_BUTTON_KIND');
|
|
582
584
|
/**
|
|
583
585
|
* Default template for `tailwind-pagination` **summary** when the `summary` input is omitted.
|
|
584
586
|
* Use placeholders `{start}`, `{end}`, `{total}` (same rules as the `summary` input).
|
|
@@ -703,17 +705,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImpo
|
|
|
703
705
|
}], ctorParameters: () => [], propDecorators: { sortKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "sortKey", required: true }] }] } });
|
|
704
706
|
|
|
705
707
|
class TailwindButton extends TailwindComponent {
|
|
708
|
+
defaultKind = inject(TAILWIND_BUTTON_KIND, { optional: true });
|
|
706
709
|
/** Visual color */
|
|
707
710
|
color = input('primary', ...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
|
|
708
|
-
/**
|
|
709
|
-
|
|
711
|
+
/**
|
|
712
|
+
* Visual kind: `flat` = filled like `solid` without border or shadow;
|
|
713
|
+
* `ghost` = transparent with hover tint; `text` = text color only, no hover background.
|
|
714
|
+
* Default from {@link TAILWIND_BUTTON_KIND} or `'solid'`.
|
|
715
|
+
*/
|
|
716
|
+
kind = input(this.defaultKind ?? 'solid', ...(ngDevMode ? [{ debugName: "kind" }] : /* istanbul ignore next */ []));
|
|
710
717
|
/** Size of the button */
|
|
711
718
|
size = input('md', ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
712
719
|
/** Whether the button is disabled */
|
|
713
720
|
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
714
721
|
/** HTML button type attribute */
|
|
715
722
|
type = input('button', ...(ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []));
|
|
716
|
-
/** Emitted when the button is clicked (not disabled
|
|
723
|
+
/** Emitted when the button is clicked (not disabled). */
|
|
717
724
|
onClick = output();
|
|
718
725
|
/** Computed Tailwind classes based on color, kind, size, and state */
|
|
719
726
|
computedClasses = computed(() => {
|
|
@@ -727,12 +734,21 @@ class TailwindButton extends TailwindComponent {
|
|
|
727
734
|
'border'
|
|
728
735
|
];
|
|
729
736
|
const solidMap = {
|
|
730
|
-
primary: 'bg-primary-600 text-
|
|
737
|
+
primary: 'bg-primary-600 text-on-primary-600 hover:bg-primary-700 hover:text-on-primary-700 active:bg-primary-800 active:text-on-primary-800 border-transparent focus-visible:outline-primary-600 shadow-sm',
|
|
731
738
|
secondary: 'bg-neutral-100 text-neutral-800 hover:bg-neutral-200 active:bg-neutral-300 border-neutral-300 focus-visible:outline-neutral-500 shadow-sm',
|
|
732
|
-
danger: 'bg-danger-600 text-
|
|
733
|
-
success: 'bg-success-600 text-
|
|
734
|
-
warning: 'bg-warning-500 text-
|
|
735
|
-
info: 'bg-info-600 text-
|
|
739
|
+
danger: 'bg-danger-600 text-on-danger-600 hover:bg-danger-700 hover:text-on-danger-700 active:bg-danger-800 active:text-on-danger-800 border-transparent focus-visible:outline-danger-600 shadow-sm',
|
|
740
|
+
success: 'bg-success-600 text-on-success-600 hover:bg-success-700 hover:text-on-success-700 active:bg-success-800 active:text-on-success-800 border-transparent focus-visible:outline-success-600 shadow-sm',
|
|
741
|
+
warning: 'bg-warning-500 text-on-warning-500 hover:bg-warning-600 hover:text-on-warning-600 active:bg-warning-700 active:text-on-warning-700 border-transparent focus-visible:outline-warning-500 shadow-sm',
|
|
742
|
+
info: 'bg-info-600 text-on-info-600 hover:bg-info-700 hover:text-on-info-700 active:bg-info-800 active:text-on-info-800 border-transparent focus-visible:outline-info-600 shadow-sm'
|
|
743
|
+
};
|
|
744
|
+
/** Filled surface like `solid`, without box shadow or visible border. */
|
|
745
|
+
const flatMap = {
|
|
746
|
+
primary: 'bg-primary-600 text-on-primary-600 hover:bg-primary-700 hover:text-on-primary-700 active:bg-primary-800 active:text-on-primary-800 border-0 shadow-none focus-visible:outline-primary-600',
|
|
747
|
+
secondary: 'bg-neutral-100 text-neutral-800 hover:bg-neutral-200 active:bg-neutral-300 border-0 shadow-none focus-visible:outline-neutral-500',
|
|
748
|
+
danger: 'bg-danger-600 text-on-danger-600 hover:bg-danger-700 hover:text-on-danger-700 active:bg-danger-800 active:text-on-danger-800 border-0 shadow-none focus-visible:outline-danger-600',
|
|
749
|
+
success: 'bg-success-600 text-on-success-600 hover:bg-success-700 hover:text-on-success-700 active:bg-success-800 active:text-on-success-800 border-0 shadow-none focus-visible:outline-success-600',
|
|
750
|
+
warning: 'bg-warning-500 text-on-warning-500 hover:bg-warning-600 hover:text-on-warning-600 active:bg-warning-700 active:text-on-warning-700 border-0 shadow-none focus-visible:outline-warning-500',
|
|
751
|
+
info: 'bg-info-600 text-on-info-600 hover:bg-info-700 hover:text-on-info-700 active:bg-info-800 active:text-on-info-800 border-0 shadow-none focus-visible:outline-info-600'
|
|
736
752
|
};
|
|
737
753
|
const outlinedMap = {
|
|
738
754
|
primary: 'bg-transparent text-primary-600 border-primary-600 hover:bg-primary-50 active:bg-primary-100 focus-visible:outline-primary-600',
|
|
@@ -762,6 +778,7 @@ class TailwindButton extends TailwindComponent {
|
|
|
762
778
|
};
|
|
763
779
|
const styleMap = {
|
|
764
780
|
solid: solidMap,
|
|
781
|
+
flat: flatMap,
|
|
765
782
|
outlined: outlinedMap,
|
|
766
783
|
ghost: ghostMap,
|
|
767
784
|
text: textMap
|
|
@@ -2623,12 +2640,12 @@ class TailwindTag extends TailwindComponent {
|
|
|
2623
2640
|
variant = input('neutral', ...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
2624
2641
|
computedClasses = computed(() => {
|
|
2625
2642
|
const variantMap = {
|
|
2626
|
-
primary: 'bg-primary-600 text-
|
|
2627
|
-
neutral: 'bg-neutral-600 text-
|
|
2628
|
-
success: 'bg-success-600 text-
|
|
2629
|
-
warning: 'bg-warning-500 text-
|
|
2630
|
-
danger: 'bg-danger-600 text-
|
|
2631
|
-
info: 'bg-info-600 text-
|
|
2643
|
+
primary: 'bg-primary-600 text-on-primary-600',
|
|
2644
|
+
neutral: 'bg-neutral-600 text-on-neutral-600',
|
|
2645
|
+
success: 'bg-success-600 text-on-success-600',
|
|
2646
|
+
warning: 'bg-warning-500 text-on-warning-500',
|
|
2647
|
+
danger: 'bg-danger-600 text-on-danger-600',
|
|
2648
|
+
info: 'bg-info-600 text-on-info-600'
|
|
2632
2649
|
};
|
|
2633
2650
|
return `inline-flex items-center text-[11px] font-semibold uppercase tracking-wider px-2 py-0.5 rounded ${variantMap[this.variant()]}`;
|
|
2634
2651
|
}, ...(ngDevMode ? [{ debugName: "computedClasses" }] : /* istanbul ignore next */ []));
|
|
@@ -3500,6 +3517,11 @@ class TailwindToolbar extends TailwindComponent {
|
|
|
3500
3517
|
width = input('full', ...(ngDevMode ? [{ debugName: "width" }] : /* istanbul ignore next */ []));
|
|
3501
3518
|
/** Applies a stronger drop shadow. */
|
|
3502
3519
|
elevated = input(false, ...(ngDevMode ? [{ debugName: "elevated" }] : /* istanbul ignore next */ []));
|
|
3520
|
+
/**
|
|
3521
|
+
* Colore di superficie della barra: `default` mantiene sfondo bianco;
|
|
3522
|
+
* i valori `TailwindSeverity` applicano tinte semantiche (come alert/notification).
|
|
3523
|
+
*/
|
|
3524
|
+
variant = input('default', ...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
3503
3525
|
/** `horizontal` for a top app bar; `vertical` for a side rail (logo → menu → end). */
|
|
3504
3526
|
orientation = input('horizontal', ...(ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []));
|
|
3505
3527
|
/** Navigation / actions rendered between logo and end slots. */
|
|
@@ -3509,9 +3531,47 @@ class TailwindToolbar extends TailwindComponent {
|
|
|
3509
3531
|
menuContainerClasses = computed(() => this.orientation() === 'horizontal'
|
|
3510
3532
|
? 'min-w-0 flex-1 flex flex-row flex-wrap items-center gap-1'
|
|
3511
3533
|
: 'min-w-0 flex-1 flex flex-col gap-1.5 overflow-y-auto min-h-0', ...(ngDevMode ? [{ debugName: "menuContainerClasses" }] : /* istanbul ignore next */ []));
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3534
|
+
/** Foreground on semantic surface (`text-on-*`), aligned with solid toolbar shade per variant. */
|
|
3535
|
+
variantContrastTextClass = computed(() => {
|
|
3536
|
+
const v = this.variant();
|
|
3537
|
+
if (v === 'default') {
|
|
3538
|
+
return null;
|
|
3539
|
+
}
|
|
3540
|
+
const map = {
|
|
3541
|
+
success: 'text-on-success-600',
|
|
3542
|
+
warning: 'text-on-warning-500',
|
|
3543
|
+
danger: 'text-on-danger-600',
|
|
3544
|
+
info: 'text-on-info-600'
|
|
3545
|
+
};
|
|
3546
|
+
return map[v];
|
|
3547
|
+
}, ...(ngDevMode ? [{ debugName: "variantContrastTextClass" }] : /* istanbul ignore next */ []));
|
|
3548
|
+
/** Heroicons are `<img>`; on light-on-color variants tint SVG strokes to match `text-on-*`. */
|
|
3549
|
+
menuItemIconClasses = computed(() => this.variant() !== 'default' && this.variant() !== 'warning' ? 'toolbar-menu-icon-on-light' : '', ...(ngDevMode ? [{ debugName: "menuItemIconClasses" }] : /* istanbul ignore next */ []));
|
|
3550
|
+
menuItemToneClasses = computed(() => {
|
|
3551
|
+
const contrast = this.variantContrastTextClass();
|
|
3552
|
+
if (!contrast) {
|
|
3553
|
+
return 'text-neutral-700 hover:bg-neutral-100 hover:text-neutral-900';
|
|
3554
|
+
}
|
|
3555
|
+
return `${contrast} hover:bg-white/12`;
|
|
3556
|
+
}, ...(ngDevMode ? [{ debugName: "menuItemToneClasses" }] : /* istanbul ignore next */ []));
|
|
3557
|
+
menuItemButtonClasses = computed(() => {
|
|
3558
|
+
const horizontal = this.orientation() === 'horizontal';
|
|
3559
|
+
const layout = horizontal
|
|
3560
|
+
? 'inline-flex shrink-0 items-center justify-center gap-1.5 rounded-md px-3 py-1.5 text-sm font-medium'
|
|
3561
|
+
: 'inline-flex w-full items-center gap-2 rounded-md px-3 py-3 text-left text-sm font-medium';
|
|
3562
|
+
const rest = 'disabled:opacity-50 disabled:cursor-not-allowed transition-colors cursor-pointer border-0 bg-transparent';
|
|
3563
|
+
return [layout, this.menuItemToneClasses(), rest].join(' ');
|
|
3564
|
+
}, ...(ngDevMode ? [{ debugName: "menuItemButtonClasses" }] : /* istanbul ignore next */ []));
|
|
3565
|
+
mobileMenuToggleClasses = computed(() => [
|
|
3566
|
+
'inline-flex shrink-0 cursor-pointer items-center justify-center rounded-md border-0 bg-transparent p-2 transition-colors',
|
|
3567
|
+
this.menuItemToneClasses()
|
|
3568
|
+
].join(' '), ...(ngDevMode ? [{ debugName: "mobileMenuToggleClasses" }] : /* istanbul ignore next */ []));
|
|
3569
|
+
menuDividerLineClasses = computed(() => this.variant() === 'default'
|
|
3570
|
+
? 'mx-0.5 h-5 w-px shrink-0 self-center bg-neutral-200'
|
|
3571
|
+
: 'mx-0.5 h-5 w-px shrink-0 self-center bg-white/30', ...(ngDevMode ? [{ debugName: "menuDividerLineClasses" }] : /* istanbul ignore next */ []));
|
|
3572
|
+
menuDividerRuleClasses = computed(() => this.variant() === 'default'
|
|
3573
|
+
? 'my-1 w-full border-0 border-t border-neutral-100'
|
|
3574
|
+
: 'my-1 w-full border-0 border-t border-white/25', ...(ngDevMode ? [{ debugName: "menuDividerRuleClasses" }] : /* istanbul ignore next */ []));
|
|
3515
3575
|
rootClasses = computed(() => {
|
|
3516
3576
|
const horizontal = this.orientation() === 'horizontal';
|
|
3517
3577
|
const sizeClasses = horizontal
|
|
@@ -3519,8 +3579,17 @@ class TailwindToolbar extends TailwindComponent {
|
|
|
3519
3579
|
? 'w-full h-16'
|
|
3520
3580
|
: 'container mx-auto h-16'
|
|
3521
3581
|
: 'h-full w-full';
|
|
3582
|
+
const variant = this.variant();
|
|
3583
|
+
const surfaceMap = {
|
|
3584
|
+
default: 'bg-white border border-neutral-200',
|
|
3585
|
+
success: 'bg-success-600 border border-white/20',
|
|
3586
|
+
warning: 'bg-warning-500 border border-white/20',
|
|
3587
|
+
danger: 'bg-danger-600 border border-white/20',
|
|
3588
|
+
info: 'bg-info-600 border border-white/20'
|
|
3589
|
+
};
|
|
3522
3590
|
const base = [
|
|
3523
|
-
|
|
3591
|
+
surfaceMap[variant] ?? surfaceMap.default,
|
|
3592
|
+
this.variantContrastTextClass() ?? '',
|
|
3524
3593
|
'flex',
|
|
3525
3594
|
sizeClasses,
|
|
3526
3595
|
this.rounded() ? 'rounded-xl' : 'rounded-none',
|
|
@@ -3532,7 +3601,7 @@ class TailwindToolbar extends TailwindComponent {
|
|
|
3532
3601
|
else {
|
|
3533
3602
|
base.push('flex-col items-stretch gap-3 px-3 py-4 min-h-0');
|
|
3534
3603
|
}
|
|
3535
|
-
return base.join(' ');
|
|
3604
|
+
return base.filter(Boolean).join(' ');
|
|
3536
3605
|
}, ...(ngDevMode ? [{ debugName: "rootClasses" }] : /* istanbul ignore next */ []));
|
|
3537
3606
|
selectMenuItem(item) {
|
|
3538
3607
|
if (item.divider || item.disabled) {
|
|
@@ -3557,12 +3626,12 @@ class TailwindToolbar extends TailwindComponent {
|
|
|
3557
3626
|
return item.value ?? item.label ?? String(index);
|
|
3558
3627
|
}
|
|
3559
3628
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: TailwindToolbar, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
3560
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.12", type: TailwindToolbar, isStandalone: true, selector: "tailwind-toolbar", inputs: { rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, elevated: { classPropertyName: "elevated", publicName: "elevated", isSignal: true, isRequired: false, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, menu: { classPropertyName: "menu", publicName: "menu", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onMenuSelect: "onMenuSelect" }, usesInheritance: true, ngImport: i0, template: "<div [class]=\"rootClasses()\">\r\n <div class=\"shrink-0\">\r\n <ng-content select=\"[tailwind-toolbar-logo]\" />\r\n </div>\r\n @if (orientation() === 'horizontal') {\r\n <nav class=\"min-w-0 flex flex-1 flex-row flex-wrap items-center gap-1\" [attr.aria-label]=\"'Toolbar menu'\">\r\n @if (menu().length) {\r\n <div class=\"flex shrink-0 items-center md:hidden\">\r\n <button\r\n type=\"button\"\r\n class=\"
|
|
3629
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.12", type: TailwindToolbar, isStandalone: true, selector: "tailwind-toolbar", inputs: { rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, elevated: { classPropertyName: "elevated", publicName: "elevated", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, menu: { classPropertyName: "menu", publicName: "menu", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onMenuSelect: "onMenuSelect" }, usesInheritance: true, ngImport: i0, template: "<div [class]=\"rootClasses()\">\r\n <div class=\"shrink-0\">\r\n <ng-content select=\"[tailwind-toolbar-logo]\" />\r\n </div>\r\n @if (orientation() === 'horizontal') {\r\n <nav class=\"min-w-0 flex flex-1 flex-row flex-wrap items-center gap-1\" [attr.aria-label]=\"'Toolbar menu'\">\r\n @if (menu().length) {\r\n <div class=\"flex shrink-0 items-center md:hidden\">\r\n <button\r\n type=\"button\"\r\n [class]=\"mobileMenuToggleClasses()\"\r\n [attr.aria-expanded]=\"mobileToolbarMenu.isOpen()\"\r\n aria-haspopup=\"menu\"\r\n aria-label=\"Open navigation menu\"\r\n (click)=\"mobileToolbarMenu.toggle($event)\">\r\n <tailwind-icon icon=\"bars-3\" [size]=\"22\" [class]=\"menuItemIconClasses()\" />\r\n </button>\r\n <tailwind-menu #mobileToolbarMenu [items]=\"menu()\" align=\"left\" (onSelect)=\"selectMenuItem($event)\" />\r\n </div>\r\n }\r\n <div class=\"hidden min-w-0 flex-1 flex-row flex-wrap items-center gap-1 md:flex\">\r\n @for (item of menu(); track menuTrackKey($index, item)) {\r\n @if (item.divider) {\r\n <span [class]=\"menuDividerLineClasses()\" aria-hidden=\"true\"></span>\r\n } @else {\r\n <button\r\n type=\"button\"\r\n [disabled]=\"!!item.disabled\"\r\n [class]=\"menuItemButtonClasses()\"\r\n [class.px-2]=\"!!item.icon && !menuItemHasVisibleLabel(item)\"\r\n [class.py-2]=\"!!item.icon && !menuItemHasVisibleLabel(item)\"\r\n [attr.aria-label]=\"menuItemAriaLabel(item)\"\r\n (click)=\"selectMenuItem(item)\">\r\n @if (item.icon) {\r\n <tailwind-icon [icon]=\"item.icon\" [size]=\"20\" [class]=\"menuItemIconClasses()\" />\r\n }\r\n @if (menuItemHasVisibleLabel(item)) {\r\n {{ item.label }}\r\n }\r\n </button>\r\n }\r\n }\r\n </div>\r\n </nav>\r\n } @else {\r\n <nav [class]=\"menuContainerClasses()\" [attr.aria-label]=\"'Toolbar menu'\">\r\n @for (item of menu(); track menuTrackKey($index, item)) {\r\n @if (item.divider) {\r\n <hr [class]=\"menuDividerRuleClasses()\" />\r\n } @else {\r\n <button\r\n type=\"button\"\r\n [disabled]=\"!!item.disabled\"\r\n [class]=\"menuItemButtonClasses()\"\r\n [class.justify-center]=\"!menuItemHasVisibleLabel(item)\"\r\n [attr.aria-label]=\"menuItemAriaLabel(item)\"\r\n (click)=\"selectMenuItem(item)\">\r\n @if (item.icon) {\r\n <tailwind-icon [icon]=\"item.icon\" [size]=\"22\" [class]=\"menuItemIconClasses()\" />\r\n }\r\n @if (menuItemHasVisibleLabel(item)) {\r\n {{ item.label }}\r\n }\r\n </button>\r\n }\r\n }\r\n </nav>\r\n }\r\n <div\r\n class=\"flex flex-wrap items-center gap-2 shrink-0\"\r\n [class.justify-end]=\"orientation() === 'horizontal'\"\r\n [class.mt-auto]=\"orientation() === 'vertical'\">\r\n <ng-content select=\"[tailwind-toolbar-end]\" />\r\n </div>\r\n</div>\r\n", styles: [":host{display:block}:host .toolbar-menu-icon-on-light img{filter:brightness(0) invert(1)}\n"], dependencies: [{ kind: "component", type: TailwindIcon, selector: "tailwind-icon", inputs: ["icon", "size"] }, { kind: "component", type: TailwindMenu, selector: "tailwind-menu", inputs: ["items", "align"], outputs: ["onSelect"] }] });
|
|
3561
3630
|
}
|
|
3562
3631
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: TailwindToolbar, decorators: [{
|
|
3563
3632
|
type: Component,
|
|
3564
|
-
args: [{ imports: [TailwindIcon, TailwindMenu], selector: 'tailwind-toolbar', template: "<div [class]=\"rootClasses()\">\r\n <div class=\"shrink-0\">\r\n <ng-content select=\"[tailwind-toolbar-logo]\" />\r\n </div>\r\n @if (orientation() === 'horizontal') {\r\n <nav class=\"min-w-0 flex flex-1 flex-row flex-wrap items-center gap-1\" [attr.aria-label]=\"'Toolbar menu'\">\r\n @if (menu().length) {\r\n <div class=\"flex shrink-0 items-center md:hidden\">\r\n <button\r\n type=\"button\"\r\n class=\"
|
|
3565
|
-
}], propDecorators: { rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }], elevated: [{ type: i0.Input, args: [{ isSignal: true, alias: "elevated", required: false }] }], orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], menu: [{ type: i0.Input, args: [{ isSignal: true, alias: "menu", required: false }] }], onMenuSelect: [{ type: i0.Output, args: ["onMenuSelect"] }] } });
|
|
3633
|
+
args: [{ imports: [TailwindIcon, TailwindMenu], selector: 'tailwind-toolbar', template: "<div [class]=\"rootClasses()\">\r\n <div class=\"shrink-0\">\r\n <ng-content select=\"[tailwind-toolbar-logo]\" />\r\n </div>\r\n @if (orientation() === 'horizontal') {\r\n <nav class=\"min-w-0 flex flex-1 flex-row flex-wrap items-center gap-1\" [attr.aria-label]=\"'Toolbar menu'\">\r\n @if (menu().length) {\r\n <div class=\"flex shrink-0 items-center md:hidden\">\r\n <button\r\n type=\"button\"\r\n [class]=\"mobileMenuToggleClasses()\"\r\n [attr.aria-expanded]=\"mobileToolbarMenu.isOpen()\"\r\n aria-haspopup=\"menu\"\r\n aria-label=\"Open navigation menu\"\r\n (click)=\"mobileToolbarMenu.toggle($event)\">\r\n <tailwind-icon icon=\"bars-3\" [size]=\"22\" [class]=\"menuItemIconClasses()\" />\r\n </button>\r\n <tailwind-menu #mobileToolbarMenu [items]=\"menu()\" align=\"left\" (onSelect)=\"selectMenuItem($event)\" />\r\n </div>\r\n }\r\n <div class=\"hidden min-w-0 flex-1 flex-row flex-wrap items-center gap-1 md:flex\">\r\n @for (item of menu(); track menuTrackKey($index, item)) {\r\n @if (item.divider) {\r\n <span [class]=\"menuDividerLineClasses()\" aria-hidden=\"true\"></span>\r\n } @else {\r\n <button\r\n type=\"button\"\r\n [disabled]=\"!!item.disabled\"\r\n [class]=\"menuItemButtonClasses()\"\r\n [class.px-2]=\"!!item.icon && !menuItemHasVisibleLabel(item)\"\r\n [class.py-2]=\"!!item.icon && !menuItemHasVisibleLabel(item)\"\r\n [attr.aria-label]=\"menuItemAriaLabel(item)\"\r\n (click)=\"selectMenuItem(item)\">\r\n @if (item.icon) {\r\n <tailwind-icon [icon]=\"item.icon\" [size]=\"20\" [class]=\"menuItemIconClasses()\" />\r\n }\r\n @if (menuItemHasVisibleLabel(item)) {\r\n {{ item.label }}\r\n }\r\n </button>\r\n }\r\n }\r\n </div>\r\n </nav>\r\n } @else {\r\n <nav [class]=\"menuContainerClasses()\" [attr.aria-label]=\"'Toolbar menu'\">\r\n @for (item of menu(); track menuTrackKey($index, item)) {\r\n @if (item.divider) {\r\n <hr [class]=\"menuDividerRuleClasses()\" />\r\n } @else {\r\n <button\r\n type=\"button\"\r\n [disabled]=\"!!item.disabled\"\r\n [class]=\"menuItemButtonClasses()\"\r\n [class.justify-center]=\"!menuItemHasVisibleLabel(item)\"\r\n [attr.aria-label]=\"menuItemAriaLabel(item)\"\r\n (click)=\"selectMenuItem(item)\">\r\n @if (item.icon) {\r\n <tailwind-icon [icon]=\"item.icon\" [size]=\"22\" [class]=\"menuItemIconClasses()\" />\r\n }\r\n @if (menuItemHasVisibleLabel(item)) {\r\n {{ item.label }}\r\n }\r\n </button>\r\n }\r\n }\r\n </nav>\r\n }\r\n <div\r\n class=\"flex flex-wrap items-center gap-2 shrink-0\"\r\n [class.justify-end]=\"orientation() === 'horizontal'\"\r\n [class.mt-auto]=\"orientation() === 'vertical'\">\r\n <ng-content select=\"[tailwind-toolbar-end]\" />\r\n </div>\r\n</div>\r\n", styles: [":host{display:block}:host .toolbar-menu-icon-on-light img{filter:brightness(0) invert(1)}\n"] }]
|
|
3634
|
+
}], propDecorators: { rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }], elevated: [{ type: i0.Input, args: [{ isSignal: true, alias: "elevated", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], menu: [{ type: i0.Input, args: [{ isSignal: true, alias: "menu", required: false }] }], onMenuSelect: [{ type: i0.Output, args: ["onMenuSelect"] }] } });
|
|
3566
3635
|
|
|
3567
3636
|
class TailwindDivider extends TailwindComponent {
|
|
3568
3637
|
/** Rule direction */
|
|
@@ -3969,6 +4038,9 @@ function providersFromTailwindComponentsConfig(config) {
|
|
|
3969
4038
|
if (config.componentsSize !== undefined) {
|
|
3970
4039
|
providers.push({ provide: TAILWIND_COMPONENTS_SIZE, useValue: config.componentsSize });
|
|
3971
4040
|
}
|
|
4041
|
+
if (config.buttonKind !== undefined) {
|
|
4042
|
+
providers.push({ provide: TAILWIND_BUTTON_KIND, useValue: config.buttonKind });
|
|
4043
|
+
}
|
|
3972
4044
|
if (config.paginationSummary !== undefined) {
|
|
3973
4045
|
providers.push({ provide: TAILWIND_PAGINATION_SUMMARY, useValue: config.paginationSummary });
|
|
3974
4046
|
}
|
|
@@ -3996,8 +4068,51 @@ function shadesForSemantic(semantic) {
|
|
|
3996
4068
|
return SHADES_WITH_950;
|
|
3997
4069
|
}
|
|
3998
4070
|
}
|
|
3999
|
-
function
|
|
4000
|
-
return
|
|
4071
|
+
function isValidShadeKey(key) {
|
|
4072
|
+
return (key === '50' ||
|
|
4073
|
+
key === '100' ||
|
|
4074
|
+
key === '200' ||
|
|
4075
|
+
key === '300' ||
|
|
4076
|
+
key === '400' ||
|
|
4077
|
+
key === '500' ||
|
|
4078
|
+
key === '600' ||
|
|
4079
|
+
key === '700' ||
|
|
4080
|
+
key === '800' ||
|
|
4081
|
+
key === '900' ||
|
|
4082
|
+
key === '950');
|
|
4083
|
+
}
|
|
4084
|
+
function isSemanticPaletteObject(value) {
|
|
4085
|
+
return ('shades' in value &&
|
|
4086
|
+
typeof value.shades === 'object' &&
|
|
4087
|
+
value.shades !== null);
|
|
4088
|
+
}
|
|
4089
|
+
/**
|
|
4090
|
+
* Normalizes object `colors` values: legacy flat shade map vs `{ shades, on? }`.
|
|
4091
|
+
*/
|
|
4092
|
+
function normalizeSemanticColorObject(value) {
|
|
4093
|
+
if (isSemanticPaletteObject(value)) {
|
|
4094
|
+
return { shades: value.shades, on: value.on };
|
|
4095
|
+
}
|
|
4096
|
+
return { shades: value };
|
|
4097
|
+
}
|
|
4098
|
+
function pushShadeVariables(semantic, shades, entries) {
|
|
4099
|
+
for (const [shade, color] of Object.entries(shades)) {
|
|
4100
|
+
if (!isValidShadeKey(shade) || color === undefined || color === '') {
|
|
4101
|
+
continue;
|
|
4102
|
+
}
|
|
4103
|
+
entries.push([`--color-${semantic}-${shade}`, color]);
|
|
4104
|
+
}
|
|
4105
|
+
}
|
|
4106
|
+
function pushOnShadeVariables(semantic, on, entries) {
|
|
4107
|
+
if (!on) {
|
|
4108
|
+
return;
|
|
4109
|
+
}
|
|
4110
|
+
for (const [shade, color] of Object.entries(on)) {
|
|
4111
|
+
if (!isValidShadeKey(shade) || color === undefined || color === '') {
|
|
4112
|
+
continue;
|
|
4113
|
+
}
|
|
4114
|
+
entries.push([`--color-on-${semantic}-${shade}`, color]);
|
|
4115
|
+
}
|
|
4001
4116
|
}
|
|
4002
4117
|
/**
|
|
4003
4118
|
* Builds `[CSS custom property name, value]` pairs for {@link defineTheme}.
|
|
@@ -4031,12 +4146,10 @@ function buildTailwindThemeVariableEntries(config) {
|
|
|
4031
4146
|
entries.push([`--color-${semantic}-${shade}`, `var(--color-${palette}-${shade})`]);
|
|
4032
4147
|
}
|
|
4033
4148
|
}
|
|
4034
|
-
else
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
}
|
|
4039
|
-
}
|
|
4149
|
+
else {
|
|
4150
|
+
const { shades, on } = normalizeSemanticColorObject(value);
|
|
4151
|
+
pushShadeVariables(semantic, shades, entries);
|
|
4152
|
+
pushOnShadeVariables(semantic, on, entries);
|
|
4040
4153
|
}
|
|
4041
4154
|
}
|
|
4042
4155
|
return entries;
|
|
@@ -4078,5 +4191,5 @@ function defineTheme(config) {
|
|
|
4078
4191
|
* Generated bundle index. Do not edit.
|
|
4079
4192
|
*/
|
|
4080
4193
|
|
|
4081
|
-
export { TAILWIND_COMPONENTS_SIZE, TAILWIND_DATETIME_LANGUAGE, TAILWIND_HEROICON_NAMES, TAILWIND_ICON_SIZE, TAILWIND_MODAL_DATA, TAILWIND_PAGINATION_SUMMARY, TW_TABLE_SORT_DIR_ATTR, TW_TABLE_SORT_KEY_ATTR, TailwindAccordion, TailwindAccordionItem, TailwindAlert, TailwindBadge, TailwindBreadcrumb, TailwindButton, TailwindCard, TailwindCheckbox, TailwindDatePicker, TailwindDateTimePicker, TailwindDivider, TailwindDrawer, TailwindIcon, TailwindInput, TailwindInputOtp, TailwindMenu, TailwindMessage, TailwindMeter, TailwindModal, TailwindModalRef, TailwindModalService, TailwindNotification, TailwindPagination, TailwindProgressBar, TailwindRadioGroup, TailwindSelect, TailwindSkeleton, TailwindSlider, TailwindSortHeaderDirective, TailwindSpinner, TailwindStep, TailwindStepper, TailwindTab, TailwindTabGroup, TailwindTable, TailwindTableRowDirective, TailwindTableRowDirective as TailwindTableRowTemplateDirective, TailwindTag, TailwindTextarea, TailwindTimePicker, TailwindTitle, TailwindToast, TailwindToastService, TailwindToggle, TailwindToolbar, TailwindTooltip, TailwindTooltipDirective, TailwindUpload, defineTheme, provideTailwindComponents };
|
|
4194
|
+
export { TAILWIND_BUTTON_KIND, TAILWIND_COMPONENTS_SIZE, TAILWIND_DATETIME_LANGUAGE, TAILWIND_HEROICON_NAMES, TAILWIND_ICON_SIZE, TAILWIND_MODAL_DATA, TAILWIND_PAGINATION_SUMMARY, TW_TABLE_SORT_DIR_ATTR, TW_TABLE_SORT_KEY_ATTR, TailwindAccordion, TailwindAccordionItem, TailwindAlert, TailwindBadge, TailwindBreadcrumb, TailwindButton, TailwindCard, TailwindCheckbox, TailwindDatePicker, TailwindDateTimePicker, TailwindDivider, TailwindDrawer, TailwindIcon, TailwindInput, TailwindInputOtp, TailwindMenu, TailwindMessage, TailwindMeter, TailwindModal, TailwindModalRef, TailwindModalService, TailwindNotification, TailwindPagination, TailwindProgressBar, TailwindRadioGroup, TailwindSelect, TailwindSkeleton, TailwindSlider, TailwindSortHeaderDirective, TailwindSpinner, TailwindStep, TailwindStepper, TailwindTab, TailwindTabGroup, TailwindTable, TailwindTableRowDirective, TailwindTableRowDirective as TailwindTableRowTemplateDirective, TailwindTag, TailwindTextarea, TailwindTimePicker, TailwindTitle, TailwindToast, TailwindToastService, TailwindToggle, TailwindToolbar, TailwindTooltip, TailwindTooltipDirective, TailwindUpload, buildTailwindThemeVariableEntries, defineTheme, provideTailwindComponents };
|
|
4082
4195
|
//# sourceMappingURL=angular-tailwind-components.mjs.map
|