@raqm/ui 0.1.2 → 0.2.1
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/CHANGELOG.md +26 -0
- package/README.md +87 -126
- package/fesm2022/raqm-ui-badge.mjs +3 -1
- package/fesm2022/raqm-ui-badge.mjs.map +1 -1
- package/fesm2022/raqm-ui-calendar.mjs +79 -12
- package/fesm2022/raqm-ui-calendar.mjs.map +1 -1
- package/fesm2022/raqm-ui-combobox.mjs +47 -23
- package/fesm2022/raqm-ui-combobox.mjs.map +1 -1
- package/fesm2022/raqm-ui-command.mjs +60 -12
- package/fesm2022/raqm-ui-command.mjs.map +1 -1
- package/fesm2022/raqm-ui-dialog.mjs +1 -3
- package/fesm2022/raqm-ui-dialog.mjs.map +1 -1
- package/fesm2022/raqm-ui-dropdown-menu.mjs.map +1 -1
- package/fesm2022/raqm-ui-hover-card.mjs.map +1 -1
- package/fesm2022/raqm-ui-icon.mjs +160 -0
- package/fesm2022/raqm-ui-icon.mjs.map +1 -0
- package/fesm2022/raqm-ui-input-otp.mjs +7 -4
- package/fesm2022/raqm-ui-input-otp.mjs.map +1 -1
- package/fesm2022/raqm-ui-menubar.mjs.map +1 -1
- package/fesm2022/raqm-ui-overlay-internal.mjs +15 -5
- package/fesm2022/raqm-ui-overlay-internal.mjs.map +1 -1
- package/fesm2022/raqm-ui-popover.mjs +51 -19
- package/fesm2022/raqm-ui-popover.mjs.map +1 -1
- package/fesm2022/raqm-ui-resizable.mjs +14 -4
- package/fesm2022/raqm-ui-resizable.mjs.map +1 -1
- package/fesm2022/raqm-ui-scroll-area.mjs +85 -29
- package/fesm2022/raqm-ui-scroll-area.mjs.map +1 -1
- package/fesm2022/raqm-ui-select.mjs +46 -19
- package/fesm2022/raqm-ui-select.mjs.map +1 -1
- package/fesm2022/raqm-ui-sidebar.mjs +13 -3
- package/fesm2022/raqm-ui-sidebar.mjs.map +1 -1
- package/fesm2022/raqm-ui-slider.mjs +59 -12
- package/fesm2022/raqm-ui-slider.mjs.map +1 -1
- package/fesm2022/raqm-ui-toast.mjs +60 -20
- package/fesm2022/raqm-ui-toast.mjs.map +1 -1
- package/fesm2022/raqm-ui-tooltip.mjs +28 -3
- package/fesm2022/raqm-ui-tooltip.mjs.map +1 -1
- package/fesm2022/raqm-ui.mjs +1 -0
- package/package.json +52 -18
- package/styles/accordion.css +1 -0
- package/styles/alert-dialog.css +1 -0
- package/styles/alert.css +1 -0
- package/styles/attachment.css +1 -0
- package/styles/avatar.css +1 -0
- package/styles/badge.css +1 -0
- package/styles/base.css +1 -0
- package/styles/button-group.css +1 -0
- package/styles/button.css +1 -0
- package/styles/checkbox.css +1 -0
- package/styles/combobox.css +1 -0
- package/styles/command.css +1 -0
- package/styles/common.css +17 -0
- package/styles/context-menu.css +1 -0
- package/styles/dialog.css +1 -0
- package/styles/drawer.css +1 -0
- package/styles/dropdown-menu.css +1 -0
- package/styles/empty.css +1 -0
- package/styles/field-parts.css +1 -0
- package/styles/field-relationships.css +1 -0
- package/styles/input-group-button.css +1 -0
- package/styles/input-group-relationships.css +1 -0
- package/styles/input-otp.css +1 -0
- package/styles/input.css +1 -0
- package/styles/item.css +1 -0
- package/styles/kbd.css +1 -0
- package/styles/menubar.css +1 -0
- package/styles/native-select.css +1 -0
- package/styles/navigation-menu.css +1 -0
- package/styles/overlay.css +1 -0
- package/styles/pagination.css +1 -0
- package/styles/popover.css +1 -0
- package/styles/questionnaire.css +1 -0
- package/styles/radio-group.css +1 -0
- package/styles/resizable.css +1 -0
- package/styles/sheet.css +1 -0
- package/styles/sidebar.css +1 -0
- package/styles/spinner.css +1 -0
- package/styles/switch.css +1 -0
- package/styles/table.css +1 -0
- package/styles/tabs.css +1 -0
- package/styles/textarea.css +1 -0
- package/styles/theme.css +50 -4324
- package/styles/toggle-group.css +1 -0
- package/styles/toggle.css +1 -0
- package/styles/tooltip.css +1 -0
- package/types/raqm-ui-calendar.d.ts +1 -0
- package/types/raqm-ui-combobox.d.ts +8 -4
- package/types/raqm-ui-command.d.ts +4 -0
- package/types/raqm-ui-dialog.d.ts +7 -1
- package/types/raqm-ui-icon.d.ts +65 -0
- package/types/raqm-ui-input-otp.d.ts +1 -0
- package/types/raqm-ui-resizable.d.ts +4 -0
- package/types/raqm-ui-rolldown-runtime-C25Le4-w.d.ts +1 -0
- package/types/raqm-ui-scroll-area.d.ts +11 -0
- package/types/raqm-ui-slider.d.ts +1 -1
- package/types/raqm-ui-toast.d.ts +6 -0
- package/types/raqm-ui.d.ts +1 -0
- package/fesm2022/raqm-ui-carousel.mjs +0 -410
- package/fesm2022/raqm-ui-carousel.mjs.map +0 -1
- package/types/raqm-ui-carousel.d.ts +0 -81
|
@@ -289,9 +289,9 @@ var RaqmPopoverOverlay = class {
|
|
|
289
289
|
this.detachSubscription = overlayRef.detachments().subscribe(() => this.handleDetached());
|
|
290
290
|
this.host.root.ownerDocument.addEventListener("focusout", this.ownedFocusOut, true);
|
|
291
291
|
this.viewportSubscription = this.viewportRuler.change(0).subscribe(() => {
|
|
292
|
-
this.position.
|
|
292
|
+
this.position.scheduleReposition();
|
|
293
293
|
});
|
|
294
|
-
this.scrollSubscription = this.scrollDispatcher.ancestorScrolled(trigger.element, 0).subscribe(() => this.position.
|
|
294
|
+
this.scrollSubscription = this.scrollDispatcher.ancestorScrolled(trigger.element, 0).subscribe(() => this.position.scheduleReposition());
|
|
295
295
|
overlayRef.attach(new TemplatePortal(panelTemplate, this.viewContainerRef));
|
|
296
296
|
overlayRef.overlayElement.style.visibility = "hidden";
|
|
297
297
|
overlayRef.overlayElement.style.pointerEvents = "none";
|
|
@@ -436,6 +436,8 @@ var RaqmPopoverPosition = class {
|
|
|
436
436
|
currentPositions = [];
|
|
437
437
|
currentPositionSides = [];
|
|
438
438
|
sideSubscription;
|
|
439
|
+
frame = 0;
|
|
440
|
+
frameView;
|
|
439
441
|
constructor(overlay, viewportRuler, state, sizing, host) {
|
|
440
442
|
this.overlay = overlay;
|
|
441
443
|
this.viewportRuler = viewportRuler;
|
|
@@ -448,26 +450,33 @@ var RaqmPopoverPosition = class {
|
|
|
448
450
|
strategy.withFlexibleDimensions(false).withGrowAfterOpen(false).withPush(true).withViewportMargin(5);
|
|
449
451
|
const preferred = this.resolvePhysicalSide(this.host.side());
|
|
450
452
|
this.currentPositionSides = [preferred, this.oppositeSide(preferred)];
|
|
451
|
-
|
|
453
|
+
const measurement = this.measure();
|
|
454
|
+
this.currentPositions = this.currentPositionSides.map((side) => this.buildPositionFor(side, measurement));
|
|
452
455
|
strategy.withPositions(this.currentPositions);
|
|
453
456
|
this.positionStrategy = strategy;
|
|
454
457
|
return strategy;
|
|
455
458
|
}
|
|
456
|
-
|
|
459
|
+
measure() {
|
|
460
|
+
return {
|
|
461
|
+
anchorRect: this.host.trigger()?.element?.getBoundingClientRect(),
|
|
462
|
+
viewport: this.viewportRuler.getViewportSize()
|
|
463
|
+
};
|
|
464
|
+
}
|
|
465
|
+
setPositions(sides, measurement = this.measure()) {
|
|
457
466
|
const strategy = this.positionStrategy;
|
|
458
467
|
if (!strategy) return;
|
|
459
|
-
const positions = sides.map((side) => this.buildPositionFor(side));
|
|
468
|
+
const positions = sides.map((side) => this.buildPositionFor(side, measurement));
|
|
460
469
|
strategy.withPositions(positions);
|
|
461
470
|
this.currentPositions = positions;
|
|
462
471
|
this.currentPositionSides = [...sides];
|
|
463
472
|
}
|
|
464
|
-
buildPositionFor(side) {
|
|
473
|
+
buildPositionFor(side, measurement) {
|
|
465
474
|
const align = this.host.align();
|
|
466
|
-
const anchorRect =
|
|
467
|
-
const viewport =
|
|
475
|
+
const anchorRect = measurement.anchorRect;
|
|
476
|
+
const viewport = measurement.viewport;
|
|
468
477
|
const x = align;
|
|
469
478
|
const y = this.toVerticalAlign(align);
|
|
470
|
-
const mainOffset = this.sizing.effectiveSideOffset(side);
|
|
479
|
+
const mainOffset = this.sizing.effectiveSideOffset(side, anchorRect, viewport);
|
|
471
480
|
const alignX = this.sizing.crossAxisGeometry("x", anchorRect, viewport.width).offset;
|
|
472
481
|
const alignY = this.sizing.crossAxisGeometry("y", anchorRect, viewport.height).offset;
|
|
473
482
|
switch (side) {
|
|
@@ -533,6 +542,7 @@ var RaqmPopoverPosition = class {
|
|
|
533
542
|
return align === "start" ? "top" : align === "end" ? "bottom" : "center";
|
|
534
543
|
}
|
|
535
544
|
reposition() {
|
|
545
|
+
this.cancelScheduledReposition();
|
|
536
546
|
const pane = this.host.pane();
|
|
537
547
|
const strategy = this.positionStrategy;
|
|
538
548
|
if (!pane || !strategy) return;
|
|
@@ -542,17 +552,32 @@ var RaqmPopoverPosition = class {
|
|
|
542
552
|
this.state.panelDir.set(dir);
|
|
543
553
|
this.host.setDirection(dir);
|
|
544
554
|
}
|
|
555
|
+
const measurement = this.measure();
|
|
545
556
|
const preferred = this.resolvePhysicalSide(this.host.side());
|
|
546
|
-
this.setPositions([preferred, this.oppositeSide(preferred)]);
|
|
557
|
+
this.setPositions([preferred, this.oppositeSide(preferred)], measurement);
|
|
547
558
|
this.sizing.resetAvailableSize();
|
|
548
559
|
this.sizing.naturalContentSize = this.sizing.contentBoxSize();
|
|
549
560
|
this.host.updatePosition();
|
|
550
561
|
const applied = this.state.resolvedSide();
|
|
551
|
-
this.sizing.applyAvailableSize();
|
|
552
|
-
this.setPositions([applied]);
|
|
562
|
+
this.sizing.applyAvailableSize(measurement.anchorRect, measurement.viewport);
|
|
563
|
+
this.setPositions([applied], measurement);
|
|
553
564
|
this.host.updatePosition();
|
|
554
565
|
this.sizing.expectedContentSize = this.sizing.contentBoxSize();
|
|
555
566
|
}
|
|
567
|
+
scheduleReposition() {
|
|
568
|
+
if (!this.positionStrategy || this.frame) return;
|
|
569
|
+
const view = this.host.trigger()?.element?.ownerDocument.defaultView;
|
|
570
|
+
if (!view || typeof view.requestAnimationFrame !== "function") {
|
|
571
|
+
this.reposition();
|
|
572
|
+
return;
|
|
573
|
+
}
|
|
574
|
+
this.frameView = view;
|
|
575
|
+
this.frame = view.requestAnimationFrame(() => {
|
|
576
|
+
this.frame = 0;
|
|
577
|
+
this.frameView = void 0;
|
|
578
|
+
this.reposition();
|
|
579
|
+
});
|
|
580
|
+
}
|
|
556
581
|
applyPositionInputs() {
|
|
557
582
|
this.reposition();
|
|
558
583
|
}
|
|
@@ -561,8 +586,15 @@ var RaqmPopoverPosition = class {
|
|
|
561
586
|
this.sideSubscription = void 0;
|
|
562
587
|
}
|
|
563
588
|
clearStrategy() {
|
|
589
|
+
this.cancelScheduledReposition();
|
|
564
590
|
this.positionStrategy = void 0;
|
|
565
591
|
}
|
|
592
|
+
cancelScheduledReposition() {
|
|
593
|
+
if (!this.frame) return;
|
|
594
|
+
this.frameView?.cancelAnimationFrame(this.frame);
|
|
595
|
+
this.frame = 0;
|
|
596
|
+
this.frameView = void 0;
|
|
597
|
+
}
|
|
566
598
|
};
|
|
567
599
|
let nextPopoverId = 0;
|
|
568
600
|
var RaqmPopoverRegistration = class {
|
|
@@ -695,12 +727,12 @@ var RaqmPopoverSizing = class {
|
|
|
695
727
|
this.resizeObserver?.disconnect();
|
|
696
728
|
this.resizeObserver = void 0;
|
|
697
729
|
}
|
|
698
|
-
applyAvailableSize() {
|
|
730
|
+
applyAvailableSize(measuredRect, measuredViewport) {
|
|
699
731
|
const pane = this.host.pane();
|
|
700
732
|
const anchor = this.host.trigger()?.element;
|
|
701
733
|
if (!pane || !anchor) return;
|
|
702
|
-
const anchorRect = anchor.getBoundingClientRect();
|
|
703
|
-
const viewport = this.viewportRuler.getViewportSize();
|
|
734
|
+
const anchorRect = measuredRect ?? anchor.getBoundingClientRect();
|
|
735
|
+
const viewport = measuredViewport ?? this.viewportRuler.getViewportSize();
|
|
704
736
|
const sideOffset = this.host.sideOffset();
|
|
705
737
|
const side = this.state.resolvedSide();
|
|
706
738
|
const capacityWidth = this.viewportCap(viewport.width);
|
|
@@ -740,18 +772,18 @@ var RaqmPopoverSizing = class {
|
|
|
740
772
|
this.applyAvailableDimension(pane, "--raqm-popover-available-width", widthIsCross || width > 0 ? Math.min(width, capacityWidth) : capacityWidth);
|
|
741
773
|
this.applyAvailableDimension(pane, "--raqm-popover-available-height", heightIsCross || height > 0 ? Math.min(height, capacityHeight) : capacityHeight);
|
|
742
774
|
}
|
|
743
|
-
effectiveSideOffset(side) {
|
|
775
|
+
effectiveSideOffset(side, measuredRect, measuredViewport) {
|
|
744
776
|
const authored = side === "bottom" || side === "right" ? this.host.sideOffset() : -this.host.sideOffset();
|
|
745
777
|
const anchor = this.host.trigger()?.element;
|
|
746
778
|
const pane = this.host.pane();
|
|
747
779
|
if (!anchor || !pane) return authored;
|
|
748
780
|
const horizontal = side === "left" || side === "right";
|
|
749
|
-
const viewport = this.viewportRuler.getViewportSize();
|
|
781
|
+
const viewport = measuredViewport ?? this.viewportRuler.getViewportSize();
|
|
750
782
|
const client = horizontal ? viewport.width : viewport.height;
|
|
751
783
|
const size = horizontal ? pane.getBoundingClientRect().width : pane.getBoundingClientRect().height;
|
|
752
784
|
const capacity = this.viewportCap(client);
|
|
753
785
|
if (size <= 0 || size > capacity) return authored;
|
|
754
|
-
const anchorRect = anchor.getBoundingClientRect();
|
|
786
|
+
const anchorRect = measuredRect ?? anchor.getBoundingClientRect();
|
|
755
787
|
const base = horizontal ? side === "right" ? anchorRect.right : anchorRect.left - size : side === "bottom" ? anchorRect.bottom : anchorRect.top - size;
|
|
756
788
|
const overflowNear = Math.max(5 - base, 0);
|
|
757
789
|
const overflowFar = Math.max(base + size - capacity, 0);
|
|
@@ -870,7 +902,7 @@ var RaqmPopoverComponent = class RaqmPopoverComponent {
|
|
|
870
902
|
trigger: () => this.registration.triggerRef(),
|
|
871
903
|
pane: () => this.layer.element,
|
|
872
904
|
content: () => this.layer.contentElement(),
|
|
873
|
-
reposition: () => this.position.
|
|
905
|
+
reposition: () => this.position.scheduleReposition()
|
|
874
906
|
});
|
|
875
907
|
position = new RaqmPopoverPosition(this.overlay, this.viewportRuler, this.state, this.sizing, {
|
|
876
908
|
side: () => this.side(),
|