yukit-web 0.6.1 → 0.6.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/fesm2022/yukit-web.mjs +32 -6
- package/fesm2022/yukit-web.mjs.map +1 -1
- package/package.json +1 -1
- package/types/yukit-web.d.ts +14 -2
package/fesm2022/yukit-web.mjs
CHANGED
|
@@ -12,7 +12,7 @@ import { HlmDropdownMenuTrigger, HlmDropdownMenuCheckboxIndicator, HlmDropdownMe
|
|
|
12
12
|
import { cva } from 'class-variance-authority';
|
|
13
13
|
import { NgTemplateOutlet, DOCUMENT } from '@angular/common';
|
|
14
14
|
import * as i1 from '@spartan-ng/brain/tooltip';
|
|
15
|
-
import {
|
|
15
|
+
import { BrnTooltip, provideBrnTooltipDefaultOptions } from '@spartan-ng/brain/tooltip';
|
|
16
16
|
import { tooltipPositionVariants, DEFAULT_TOOLTIP_CONTENT_CLASSES, DEFAULT_TOOLTIP_SVG_CLASS } from 'yukit-web/helm/tooltip';
|
|
17
17
|
import { NgIcon, provideIcons } from '@ng-icons/core';
|
|
18
18
|
import { lucideX, lucideChevronRight, lucideChevronLeft, lucideUpload, lucideSearch, lucideEyeOff, lucideEye, lucideChevronsUpDown, lucideChevronUp, lucideChevronDown, lucidePencil, lucideCheck, lucideMinus, lucideCopy, lucideTrash2, lucideSave, lucideArrowLeft, lucideArchiveRestore, lucidePlus, lucideSettings2, lucideList, lucideLayoutGrid, lucideDownload, lucideEllipsis, lucideStar } from '@ng-icons/lucide';
|
|
@@ -748,6 +748,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImpo
|
|
|
748
748
|
* Brain tooltip config default (`100`).
|
|
749
749
|
* - `tooltipDisabled`: Disables the tooltip entirely.
|
|
750
750
|
*
|
|
751
|
+
* Focus opens it only when it is keyboard focus (`:focus-visible`). Brain opens on any `focus`, so a
|
|
752
|
+
* dialog or sheet autofocusing its first tabbable element on open would pop the tooltip unasked.
|
|
753
|
+
* Brain has no public way to cancel a show, so a non-keyboard focus suppresses it through
|
|
754
|
+
* `mutableTooltipDisabled`, which Brain checks once the show delay elapses; blur and hover give the
|
|
755
|
+
* `tooltipDisabled` input back.
|
|
756
|
+
*
|
|
751
757
|
* Usage:
|
|
752
758
|
* ```html
|
|
753
759
|
* <button yuwTooltip="Save changes" hlmBtn>Save</button>
|
|
@@ -755,8 +761,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImpo
|
|
|
755
761
|
* ```
|
|
756
762
|
*/
|
|
757
763
|
class YuwTooltipDirective {
|
|
764
|
+
constructor() {
|
|
765
|
+
this.host = inject(ElementRef);
|
|
766
|
+
this.tooltip = inject(BrnTooltip);
|
|
767
|
+
}
|
|
768
|
+
restore() {
|
|
769
|
+
this.tooltip.mutableTooltipDisabled.set(this.tooltip.tooltipDisabled());
|
|
770
|
+
}
|
|
771
|
+
suppressUnlessKeyboardFocus() {
|
|
772
|
+
if (!this.host.nativeElement.matches(':focus-visible')) {
|
|
773
|
+
this.tooltip.mutableTooltipDisabled.set(true);
|
|
774
|
+
}
|
|
775
|
+
}
|
|
758
776
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: YuwTooltipDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
759
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.22", type: YuwTooltipDirective, isStandalone: true, selector: "[yuwTooltip]", providers: [
|
|
777
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.22", type: YuwTooltipDirective, isStandalone: true, selector: "[yuwTooltip]", host: { listeners: { "focus": "suppressUnlessKeyboardFocus()", "blur": "restore()", "pointerenter": "restore()" } }, providers: [
|
|
760
778
|
provideBrnTooltipDefaultOptions({
|
|
761
779
|
svgClasses: DEFAULT_TOOLTIP_SVG_CLASS,
|
|
762
780
|
tooltipContentClasses: DEFAULT_TOOLTIP_CONTENT_CLASSES,
|
|
@@ -781,6 +799,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImpo
|
|
|
781
799
|
inputs: ['brnTooltip: yuwTooltip', 'position', 'hideDelay', 'showDelay', 'tooltipDisabled'],
|
|
782
800
|
},
|
|
783
801
|
],
|
|
802
|
+
host: {
|
|
803
|
+
'(focus)': 'suppressUnlessKeyboardFocus()',
|
|
804
|
+
'(blur)': 'restore()',
|
|
805
|
+
'(pointerenter)': 'restore()',
|
|
806
|
+
},
|
|
784
807
|
}]
|
|
785
808
|
}] });
|
|
786
809
|
|
|
@@ -1461,8 +1484,10 @@ class YuwSheetOpenState {
|
|
|
1461
1484
|
* using `@for`.
|
|
1462
1485
|
*
|
|
1463
1486
|
* Inputs:
|
|
1464
|
-
* - `collapseWithSheet`: Inside a `<yuw-sheet>` or `<yuws-form-sheet>`, collapses every item whenever the sheet opens
|
|
1465
|
-
*
|
|
1487
|
+
* - `collapseWithSheet`: Inside a `<yuw-sheet>` or `<yuws-form-sheet>`, collapses every item whenever the sheet opens,
|
|
1488
|
+
* so each opening starts folded. Ignored outside a sheet. Default is `false`. It folds on opening and never on
|
|
1489
|
+
* closing: a height transition cut short by the sheet detaching leaves Chrome rendering the content 0 tall on every
|
|
1490
|
+
* later opening.
|
|
1466
1491
|
*
|
|
1467
1492
|
* Extends `HlmAccordion` (instead of re-applying `BrnAccordion` and copying the helm's classes
|
|
1468
1493
|
* by hand) so the helm's `data-slot`, classes and its `BrnAccordion` host directive — including
|
|
@@ -1482,8 +1507,9 @@ class YuwAccordion extends HlmAccordion {
|
|
|
1482
1507
|
if (!sheet || !this.collapseWithSheet()) {
|
|
1483
1508
|
return;
|
|
1484
1509
|
}
|
|
1485
|
-
sheet.open()
|
|
1486
|
-
|
|
1510
|
+
if (sheet.open()) {
|
|
1511
|
+
untracked(() => this._items().forEach((item) => item.close()));
|
|
1512
|
+
}
|
|
1487
1513
|
});
|
|
1488
1514
|
}
|
|
1489
1515
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: YuwAccordion, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|