@basis-ng/primitives 0.0.1-alpha.146 → 0.0.1-alpha.148
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { input, output, Component, inject, ElementRef, signal, model, computed, viewChildren, booleanAttribute, ChangeDetectionStrategy, contentChildren, effect, Injectable, contentChild, ViewEncapsulation,
|
|
2
|
+
import { input, output, Component, inject, ElementRef, signal, model, computed, viewChildren, booleanAttribute, ChangeDetectionStrategy, contentChildren, effect, Injectable, contentChild, ViewEncapsulation, HostListener, Directive, linkedSignal, TemplateRef, ChangeDetectorRef, Pipe, afterRenderEffect, RendererFactory2, PLATFORM_ID } from '@angular/core';
|
|
3
3
|
import { NgIcon, provideIcons } from '@ng-icons/core';
|
|
4
4
|
import { lucideX, lucideChevronRight, lucideChevronLeft, lucideLoaderCircle, lucideLoader, lucideGripVertical } from '@ng-icons/lucide';
|
|
5
5
|
import { GridCellWidget, Grid, GridRow, GridCell } from '@angular/aria/grid';
|
|
@@ -1468,7 +1468,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.8", ngImpor
|
|
|
1468
1468
|
* A draggable floating drawer that can slide from any side.
|
|
1469
1469
|
*/
|
|
1470
1470
|
class Drawer {
|
|
1471
|
-
panel = viewChild.required('panel');
|
|
1472
1471
|
/**
|
|
1473
1472
|
* Model indicating whether the drawer is open.
|
|
1474
1473
|
*/
|
|
@@ -1505,14 +1504,31 @@ class Drawer {
|
|
|
1505
1504
|
* Computed CSS transform for the drawer based on drag/open state.
|
|
1506
1505
|
*/
|
|
1507
1506
|
transform = computed(() => this.getTransform(this.currentProgress()), ...(ngDevMode ? [{ debugName: "transform" }] : []));
|
|
1508
|
-
/**
|
|
1509
|
-
* Backdrop opacity that tracks the drawer open progress.
|
|
1510
|
-
*/
|
|
1511
|
-
backdropOpacity = computed(() => ((100 - this.currentProgress()) / 100) * 0.14, ...(ngDevMode ? [{ debugName: "backdropOpacity" }] : []));
|
|
1512
1507
|
/**
|
|
1513
1508
|
* Current progress to use for the rendered transform.
|
|
1514
1509
|
*/
|
|
1515
1510
|
currentProgress = computed(() => this.isDragging() ? this.dragProgress() : this.isOpen() ? 0 : 100, ...(ngDevMode ? [{ debugName: "currentProgress" }] : []));
|
|
1511
|
+
/**
|
|
1512
|
+
* Element reference to the host component.
|
|
1513
|
+
*/
|
|
1514
|
+
el = inject(ElementRef);
|
|
1515
|
+
/**
|
|
1516
|
+
* Close the drawer when clicking outside of it.
|
|
1517
|
+
* The stopPropagation in the drawer-content prevents clicks inside from closing it.
|
|
1518
|
+
* @param event - Click event.
|
|
1519
|
+
*/
|
|
1520
|
+
closeOnOutsideClick(event) {
|
|
1521
|
+
if (!this.isOpen())
|
|
1522
|
+
return;
|
|
1523
|
+
const target = event.target;
|
|
1524
|
+
if (this.el.nativeElement.contains(target)) {
|
|
1525
|
+
return;
|
|
1526
|
+
}
|
|
1527
|
+
if (target.closest('.cdk-overlay-container')) {
|
|
1528
|
+
return;
|
|
1529
|
+
}
|
|
1530
|
+
this.requestClose();
|
|
1531
|
+
}
|
|
1516
1532
|
/**
|
|
1517
1533
|
* Begin tracking pointer movement for drag-to-dismiss.
|
|
1518
1534
|
* @param event - Pointer down event.
|
|
@@ -1545,7 +1561,7 @@ class Drawer {
|
|
|
1545
1561
|
* @param event - Current pointer event.
|
|
1546
1562
|
*/
|
|
1547
1563
|
updateDrag(event) {
|
|
1548
|
-
const host = this.
|
|
1564
|
+
const host = this.el.nativeElement;
|
|
1549
1565
|
const pointerOffset = this.getPointerOffset(event);
|
|
1550
1566
|
const deltaPx = (pointerOffset - this.startOffset()) * this.getCloseDirection();
|
|
1551
1567
|
const size = this.isHorizontal() ? host.offsetWidth : host.offsetHeight;
|
|
@@ -1609,30 +1625,15 @@ class Drawer {
|
|
|
1609
1625
|
return this.side() === 'top' || this.side() === 'left' ? -1 : 1;
|
|
1610
1626
|
}
|
|
1611
1627
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: Drawer, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1612
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.8", type: Drawer, isStandalone: true, selector: "b-drawer", inputs: { isOpen: { classPropertyName: "isOpen", publicName: "isOpen", isSignal: true, isRequired: false, transformFunction: null }, side: { classPropertyName: "side", publicName: "side", isSignal: true, isRequired: false, transformFunction: null }, draggable: { classPropertyName: "draggable", publicName: "draggable", isSignal: true, isRequired: false, transformFunction: null }, closeThreshold: { classPropertyName: "closeThreshold", publicName: "closeThreshold", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { isOpen: "isOpenChange", closeSheet: "closeSheet" }, host: { properties: { "class.bottom": "side() === \"bottom\"", "class.dragging": "isDragging()", "class.left": "side() === \"left\"", "class.open": "isOpen()", "class.right": "side() === \"right\"", "class.top": "side() === \"top\""
|
|
1613
|
-
@if (
|
|
1614
|
-
<div
|
|
1615
|
-
class="
|
|
1616
|
-
|
|
1617
|
-
(click)="requestClose()"
|
|
1618
|
-
></div>
|
|
1628
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.8", type: Drawer, isStandalone: true, selector: "b-drawer", inputs: { isOpen: { classPropertyName: "isOpen", publicName: "isOpen", isSignal: true, isRequired: false, transformFunction: null }, side: { classPropertyName: "side", publicName: "side", isSignal: true, isRequired: false, transformFunction: null }, draggable: { classPropertyName: "draggable", publicName: "draggable", isSignal: true, isRequired: false, transformFunction: null }, closeThreshold: { classPropertyName: "closeThreshold", publicName: "closeThreshold", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { isOpen: "isOpenChange", closeSheet: "closeSheet" }, host: { listeners: { "document:click": "closeOnOutsideClick($event)" }, properties: { "class.bottom": "side() === \"bottom\"", "class.draggable": "draggable()", "class.dragging": "isDragging()", "class.left": "side() === \"left\"", "class.open": "isOpen()", "class.right": "side() === \"right\"", "class.top": "side() === \"top\"", "style.transform": "transform()" } }, ngImport: i0, template: `
|
|
1629
|
+
@if (draggable()) {
|
|
1630
|
+
<div class="drag-section" (pointerdown)="startDrag($event)">
|
|
1631
|
+
<div class="drag-indicator"></div>
|
|
1632
|
+
</div>
|
|
1619
1633
|
}
|
|
1620
1634
|
|
|
1621
|
-
<div
|
|
1622
|
-
|
|
1623
|
-
class="drawer-panel"
|
|
1624
|
-
[style.transform]="transform()"
|
|
1625
|
-
(click)="$event.stopPropagation()"
|
|
1626
|
-
>
|
|
1627
|
-
@if (draggable()) {
|
|
1628
|
-
<div class="drag-section" (pointerdown)="startDrag($event)">
|
|
1629
|
-
<div class="drag-indicator"></div>
|
|
1630
|
-
</div>
|
|
1631
|
-
}
|
|
1632
|
-
|
|
1633
|
-
<div class="drawer-content" (click)="$event.stopPropagation()">
|
|
1634
|
-
<ng-content />
|
|
1635
|
-
</div>
|
|
1635
|
+
<div class="drawer-content" (click)="$event.stopPropagation()">
|
|
1636
|
+
<ng-content />
|
|
1636
1637
|
</div>
|
|
1637
1638
|
`, isInline: true });
|
|
1638
1639
|
}
|
|
@@ -1643,41 +1644,31 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.8", ngImpor
|
|
|
1643
1644
|
standalone: true,
|
|
1644
1645
|
imports: [],
|
|
1645
1646
|
template: `
|
|
1646
|
-
@if (
|
|
1647
|
-
<div
|
|
1648
|
-
class="
|
|
1649
|
-
|
|
1650
|
-
(click)="requestClose()"
|
|
1651
|
-
></div>
|
|
1647
|
+
@if (draggable()) {
|
|
1648
|
+
<div class="drag-section" (pointerdown)="startDrag($event)">
|
|
1649
|
+
<div class="drag-indicator"></div>
|
|
1650
|
+
</div>
|
|
1652
1651
|
}
|
|
1653
1652
|
|
|
1654
|
-
<div
|
|
1655
|
-
|
|
1656
|
-
class="drawer-panel"
|
|
1657
|
-
[style.transform]="transform()"
|
|
1658
|
-
(click)="$event.stopPropagation()"
|
|
1659
|
-
>
|
|
1660
|
-
@if (draggable()) {
|
|
1661
|
-
<div class="drag-section" (pointerdown)="startDrag($event)">
|
|
1662
|
-
<div class="drag-indicator"></div>
|
|
1663
|
-
</div>
|
|
1664
|
-
}
|
|
1665
|
-
|
|
1666
|
-
<div class="drawer-content" (click)="$event.stopPropagation()">
|
|
1667
|
-
<ng-content />
|
|
1668
|
-
</div>
|
|
1653
|
+
<div class="drawer-content" (click)="$event.stopPropagation()">
|
|
1654
|
+
<ng-content />
|
|
1669
1655
|
</div>
|
|
1670
1656
|
`,
|
|
1671
1657
|
host: {
|
|
1672
1658
|
'[class.bottom]': 'side() === "bottom"',
|
|
1659
|
+
'[class.draggable]': 'draggable()',
|
|
1673
1660
|
'[class.dragging]': 'isDragging()',
|
|
1674
1661
|
'[class.left]': 'side() === "left"',
|
|
1675
1662
|
'[class.open]': 'isOpen()',
|
|
1676
1663
|
'[class.right]': 'side() === "right"',
|
|
1677
1664
|
'[class.top]': 'side() === "top"',
|
|
1665
|
+
'[style.transform]': 'transform()',
|
|
1678
1666
|
},
|
|
1679
1667
|
}]
|
|
1680
|
-
}], propDecorators: {
|
|
1668
|
+
}], propDecorators: { isOpen: [{ type: i0.Input, args: [{ isSignal: true, alias: "isOpen", required: false }] }, { type: i0.Output, args: ["isOpenChange"] }], side: [{ type: i0.Input, args: [{ isSignal: true, alias: "side", required: false }] }], draggable: [{ type: i0.Input, args: [{ isSignal: true, alias: "draggable", required: false }] }], closeSheet: [{ type: i0.Output, args: ["closeSheet"] }], closeThreshold: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeThreshold", required: false }] }], closeOnOutsideClick: [{
|
|
1669
|
+
type: HostListener,
|
|
1670
|
+
args: ['document:click', ['$event']]
|
|
1671
|
+
}] } });
|
|
1681
1672
|
|
|
1682
1673
|
/**
|
|
1683
1674
|
* Wrapper for grouping input-related elements.
|
|
@@ -1694,6 +1685,71 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.8", ngImpor
|
|
|
1694
1685
|
}]
|
|
1695
1686
|
}] });
|
|
1696
1687
|
|
|
1688
|
+
/**
|
|
1689
|
+
* A full-viewport backdrop layer that can dim background content behind projected overlays.
|
|
1690
|
+
*/
|
|
1691
|
+
class Backdrop {
|
|
1692
|
+
/**
|
|
1693
|
+
* Whether the backdrop is active.
|
|
1694
|
+
*/
|
|
1695
|
+
isOpen = model(false, ...(ngDevMode ? [{ debugName: "isOpen" }] : []));
|
|
1696
|
+
/**
|
|
1697
|
+
* Optional open progress from 0 (open) to 100 (closed).
|
|
1698
|
+
*/
|
|
1699
|
+
progress = input(null, ...(ngDevMode ? [{ debugName: "progress" }] : []));
|
|
1700
|
+
/**
|
|
1701
|
+
* Maximum darkness applied when fully open.
|
|
1702
|
+
*/
|
|
1703
|
+
maxOpacity = input(0.14, ...(ngDevMode ? [{ debugName: "maxOpacity" }] : []));
|
|
1704
|
+
/**
|
|
1705
|
+
* Whether clicking the backdrop closes it automatically.
|
|
1706
|
+
*/
|
|
1707
|
+
closeOnClick = input(true, { ...(ngDevMode ? { debugName: "closeOnClick" } : {}), transform: booleanAttribute });
|
|
1708
|
+
/**
|
|
1709
|
+
* Whether opacity changes should animate.
|
|
1710
|
+
*/
|
|
1711
|
+
animated = input(true, { ...(ngDevMode ? { debugName: "animated" } : {}), transform: booleanAttribute });
|
|
1712
|
+
/**
|
|
1713
|
+
* Emitted whenever the backdrop surface is clicked.
|
|
1714
|
+
*/
|
|
1715
|
+
backdropClick = output();
|
|
1716
|
+
/**
|
|
1717
|
+
* Current effective opacity based on explicit progress or open state.
|
|
1718
|
+
*/
|
|
1719
|
+
opacity = computed(() => {
|
|
1720
|
+
const progress = this.progress();
|
|
1721
|
+
if (progress === null) {
|
|
1722
|
+
return this.isOpen() ? this.maxOpacity() : 0;
|
|
1723
|
+
}
|
|
1724
|
+
return ((100 - progress) / 100) * this.maxOpacity();
|
|
1725
|
+
}, ...(ngDevMode ? [{ debugName: "opacity" }] : []));
|
|
1726
|
+
handleBackdropClick() {
|
|
1727
|
+
this.backdropClick.emit();
|
|
1728
|
+
if (this.closeOnClick()) {
|
|
1729
|
+
this.isOpen.set(false);
|
|
1730
|
+
}
|
|
1731
|
+
}
|
|
1732
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: Backdrop, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1733
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.0.8", type: Backdrop, isStandalone: true, selector: "b-backdrop", inputs: { isOpen: { classPropertyName: "isOpen", publicName: "isOpen", isSignal: true, isRequired: false, transformFunction: null }, progress: { classPropertyName: "progress", publicName: "progress", isSignal: true, isRequired: false, transformFunction: null }, maxOpacity: { classPropertyName: "maxOpacity", publicName: "maxOpacity", isSignal: true, isRequired: false, transformFunction: null }, closeOnClick: { classPropertyName: "closeOnClick", publicName: "closeOnClick", isSignal: true, isRequired: false, transformFunction: null }, animated: { classPropertyName: "animated", publicName: "animated", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { isOpen: "isOpenChange", backdropClick: "backdropClick" }, host: { properties: { "class.b-open": "isOpen()", "class.b-animated": "animated()" } }, ngImport: i0, template: `
|
|
1734
|
+
<div class="b-backdrop-layer" [style.opacity]="opacity()" (click)="handleBackdropClick()"></div>
|
|
1735
|
+
<ng-content />
|
|
1736
|
+
`, isInline: true });
|
|
1737
|
+
}
|
|
1738
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: Backdrop, decorators: [{
|
|
1739
|
+
type: Component,
|
|
1740
|
+
args: [{
|
|
1741
|
+
selector: 'b-backdrop',
|
|
1742
|
+
template: `
|
|
1743
|
+
<div class="b-backdrop-layer" [style.opacity]="opacity()" (click)="handleBackdropClick()"></div>
|
|
1744
|
+
<ng-content />
|
|
1745
|
+
`,
|
|
1746
|
+
host: {
|
|
1747
|
+
'[class.b-open]': 'isOpen()',
|
|
1748
|
+
'[class.b-animated]': 'animated()',
|
|
1749
|
+
},
|
|
1750
|
+
}]
|
|
1751
|
+
}], propDecorators: { isOpen: [{ type: i0.Input, args: [{ isSignal: true, alias: "isOpen", required: false }] }, { type: i0.Output, args: ["isOpenChange"] }], progress: [{ type: i0.Input, args: [{ isSignal: true, alias: "progress", required: false }] }], maxOpacity: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxOpacity", required: false }] }], closeOnClick: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeOnClick", required: false }] }], animated: [{ type: i0.Input, args: [{ isSignal: true, alias: "animated", required: false }] }], backdropClick: [{ type: i0.Output, args: ["backdropClick"] }] } });
|
|
1752
|
+
|
|
1697
1753
|
/**
|
|
1698
1754
|
* Root menu container that applies CDK menu behavior.
|
|
1699
1755
|
*/
|
|
@@ -3122,6 +3178,29 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.8", ngImpor
|
|
|
3122
3178
|
}]
|
|
3123
3179
|
}] });
|
|
3124
3180
|
|
|
3181
|
+
/**
|
|
3182
|
+
* A loading directive that overlays a skeleton shimmer on the host element while preserving size.
|
|
3183
|
+
*/
|
|
3184
|
+
class Skeleton {
|
|
3185
|
+
/**
|
|
3186
|
+
* Whether the host should display the skeleton state.
|
|
3187
|
+
*/
|
|
3188
|
+
loading = input(true, { ...(ngDevMode ? { debugName: "loading" } : {}), alias: 'bSkeleton', transform: booleanAttribute });
|
|
3189
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: Skeleton, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
3190
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.0.8", type: Skeleton, isStandalone: true, selector: "[bSkeleton]", inputs: { loading: { classPropertyName: "loading", publicName: "bSkeleton", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.aria-busy": "loading()", "class.b-skeleton": "true", "class.b-loading": "loading()" } }, ngImport: i0 });
|
|
3191
|
+
}
|
|
3192
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: Skeleton, decorators: [{
|
|
3193
|
+
type: Directive,
|
|
3194
|
+
args: [{
|
|
3195
|
+
selector: '[bSkeleton]',
|
|
3196
|
+
host: {
|
|
3197
|
+
'[attr.aria-busy]': 'loading()',
|
|
3198
|
+
'[class.b-skeleton]': 'true',
|
|
3199
|
+
'[class.b-loading]': 'loading()',
|
|
3200
|
+
},
|
|
3201
|
+
}]
|
|
3202
|
+
}], propDecorators: { loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "bSkeleton", required: false }] }] } });
|
|
3203
|
+
|
|
3125
3204
|
/**
|
|
3126
3205
|
* A spinner component to indicate loading states.
|
|
3127
3206
|
*/
|
|
@@ -4203,5 +4282,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.8", ngImpor
|
|
|
4203
4282
|
* Generated bundle index. Do not edit.
|
|
4204
4283
|
*/
|
|
4205
4284
|
|
|
4206
|
-
export { Alert, Badge, Button, ButtonGroup, Calendar, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, CommandComponent, CommandOptionsComponent, ConnectedOverlay, Dialog, DialogContent, DialogManager, Drawer, Input, InputGroup, Menu, MenuGroup, MenuItem, MenuItemCheckbox, MenuItemRadio, MenuLabel, MenuTriggerDirective, Option, Otp, OtpDigitDirective, Overlay, OverlayOrigin, OverlayTrigger, Popover, PopoverTrigger, Range, ResponsiveManager, Select, SelectContent, SelectFilter, SelectTrigger, SelectValue, Spinner, SwitchComponent, Tab, Tabs, Textarea, TextareaGroup, ThemeManager, Tooltip, TooltipContent, TooltipTrigger, TranslatePipe, TranslationManager, Tree, TreeNode, Utils };
|
|
4285
|
+
export { Alert, Backdrop, Badge, Button, ButtonGroup, Calendar, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, CommandComponent, CommandOptionsComponent, ConnectedOverlay, Dialog, DialogContent, DialogManager, Drawer, Input, InputGroup, Menu, MenuGroup, MenuItem, MenuItemCheckbox, MenuItemRadio, MenuLabel, MenuTriggerDirective, Option, Otp, OtpDigitDirective, Overlay, OverlayOrigin, OverlayTrigger, Popover, PopoverTrigger, Range, ResponsiveManager, Select, SelectContent, SelectFilter, SelectTrigger, SelectValue, Skeleton, Spinner, SwitchComponent, Tab, Tabs, Textarea, TextareaGroup, ThemeManager, Tooltip, TooltipContent, TooltipTrigger, TranslatePipe, TranslationManager, Tree, TreeNode, Utils };
|
|
4207
4286
|
//# sourceMappingURL=basis-ng-primitives.mjs.map
|