@uni-design-system/uni-angular 8.3.0 → 8.3.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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # @uni-design-system/uni-angular
2
2
 
3
+ ## 8.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`66f4051`](https://github.com/uni-design-system/uni/commit/66f4051c69b6b55ed2c2b95425fd8aa1a1bccdcd) Thanks [@gaenglish](https://github.com/gaenglish)! - `uni-combobox` docs: "Allowing new values" — free text never commits implicitly (closed-set contract: typing filters, a non-matching draft reverts with `(rejected)`). The supported create-new pattern is now documented with a working story: drive `[options]` from the debounced `(query)` with `[filterLocally]="false"` and, when nothing matches exactly, append a sentinel option — `{ label: `Create "${text}"`, value: … }`. As a real option it commits through every normal path (arrow + Enter, click, Enter when the filter narrows to it alone); resolve it in `(selected)` by minting the entity and writing the model. Blur intentionally never commits the sentinel — creation takes an explicit Enter or click. Lighter alternative: listen to `(rejected: { query })` and offer creation outside the control. If most values are user-created, use `uni-tag-input` (open set) instead.
8
+
9
+ - [`dc7aef9`](https://github.com/uni-design-system/uni/commit/dc7aef994abd4e7ac73de64bdea2d3ce5cb18db3) Thanks [@gaenglish](https://github.com/gaenglish)! - `uni-dropdown` (and everything riding it — the date picker popup, menus, multi-select): the open/close scale animation now originates from the corner actually touching the trigger. The origin was mapped statically from the _requested_ placement, but `position-try-fallbacks` lets the browser flip the panel at viewport edges — so a `bottom-end` date picker repositioned above its field still animated from the top-right corner. The panel is now measured on each toggle (open and close-start) and the transform origin follows the rendered position, via the new cdk helper `transformOriginFor(panelRect, triggerRect)`.
10
+
3
11
  ## 8.3.0
4
12
 
5
13
  ### Minor Changes
@@ -637,6 +637,40 @@ function spotlightStyles(anchor, options = {}) {
637
637
  cover: { ...blocker, ...holeInset(0) },
638
638
  };
639
639
  }
640
+ /**
641
+ * Transform origin for a panel's open/close scale animation, derived from
642
+ * where the panel **actually** rendered relative to its anchor — not from the
643
+ * requested placement. `position-try-fallbacks` lets the browser flip a panel
644
+ * at viewport edges, and a statically mapped origin then animates from the
645
+ * wrong corner (a `bottom-end` picker flipped above its field would still
646
+ * scale from `top right`). Measure after the popover is shown and apply the
647
+ * result as an inline style.
648
+ *
649
+ * Returns keyword pairs like `'top right'` / `'bottom center'`, or `null`
650
+ * when the panel has no box yet (e.g. `display: none`, or jsdom).
651
+ */
652
+ function transformOriginFor(panel, trigger) {
653
+ if (!panel.width && !panel.height)
654
+ return null;
655
+ // Which side of the trigger the panel sits on wins; when it overlaps on an
656
+ // axis (aligned placements), the closer-aligned edge is the anchored one.
657
+ const axis = (panelStart, panelEnd, triggerStart, triggerEnd) => {
658
+ if (panelStart >= triggerEnd)
659
+ return 'start'; // panel after the trigger: grows away from its start edge
660
+ if (panelEnd <= triggerStart)
661
+ return 'end'; // panel before the trigger: grows toward its end edge
662
+ const startGap = Math.abs(panelStart - triggerStart);
663
+ const endGap = Math.abs(panelEnd - triggerEnd);
664
+ if (Math.abs(startGap - endGap) <= 1)
665
+ return 'center';
666
+ return startGap < endGap ? 'start' : 'end';
667
+ };
668
+ const y = axis(panel.top, panel.bottom, trigger.top, trigger.bottom);
669
+ const x = axis(panel.left, panel.right, trigger.left, trigger.right);
670
+ const vertical = y === 'start' ? 'top' : y === 'end' ? 'bottom' : 'center';
671
+ const horizontal = x === 'start' ? 'left' : x === 'end' ? 'right' : 'center';
672
+ return `${vertical} ${horizontal}`;
673
+ }
640
674
 
641
675
  /**
642
676
  * Shared plumbing for top-layer overlays built on the native `popover`
@@ -4947,6 +4981,9 @@ class UniDropdownComponent extends BaseComponent {
4947
4981
  get _dropdown() {
4948
4982
  return this.dropdownRef.nativeElement;
4949
4983
  }
4984
+ // Pre-measure default only: the requested placement's corner. The real
4985
+ // origin is measured per toggle (syncTransformOrigin), because
4986
+ // position-try fallbacks may have flipped the panel.
4950
4987
  transformOriginMap = {
4951
4988
  top: 'bottom center',
4952
4989
  right: 'center left',
@@ -5020,6 +5057,10 @@ class UniDropdownComponent extends BaseComponent {
5020
5057
  // Sync state if user invokes light-dismiss via outside click or Escape key
5021
5058
  this.renderer.listen(this._dropdown, 'toggle', (event) => {
5022
5059
  const isOpened = event.newState === 'open';
5060
+ // Both edges: on open so the entry scale grows out of the trigger, and
5061
+ // on close-start so a panel the browser flipped while open (scroll near
5062
+ // a viewport edge) still collapses back toward the trigger.
5063
+ this.syncTransformOrigin();
5023
5064
  this.showing.set(isOpened);
5024
5065
  this.renderer.setAttribute(this._focusTarget, 'aria-expanded', `${isOpened}`);
5025
5066
  if (isOpened) {
@@ -5031,6 +5072,19 @@ class UniDropdownComponent extends BaseComponent {
5031
5072
  }
5032
5073
  });
5033
5074
  }
5075
+ /**
5076
+ * Scale the open/close animation from the corner touching the trigger,
5077
+ * wherever the browser actually placed the panel. The static
5078
+ * `transformOriginMap` covers only the *requested* placement; with
5079
+ * `position-try-fallbacks` the panel may have flipped at a viewport edge,
5080
+ * and a `bottom-end` picker rendered above its field would otherwise still
5081
+ * animate from the top-right corner.
5082
+ */
5083
+ syncTransformOrigin() {
5084
+ const origin = transformOriginFor(this._dropdown.getBoundingClientRect(), this._trigger.getBoundingClientRect());
5085
+ if (origin)
5086
+ this.renderer.setStyle(this._dropdown, 'transform-origin', origin);
5087
+ }
5034
5088
  /**
5035
5089
  * Returns focus to the trigger when the popover closes while focus was
5036
5090
  * inside it (or was dropped on <body> by the top layer closing), so
@@ -11225,5 +11279,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImpo
11225
11279
  * Generated bundle index. Do not edit.
11226
11280
  */
11227
11281
 
11228
- export { BodyRenderDirective, ConfirmationDialogComponent, DragAndDropDirective, FOCUSABLE_SELECTOR, ListboxNavigation, LocalStorageService, NotificationService, NotificationsComponent, RippleDirective, TRANSFORM_ORIGINS, ThemeService, UNI_THEMES, UniAlertComponent, UniAppBarComponent, UniAvatarComponent, UniAvatarGroupComponent, UniBackgroundComponent, UniBadgeComponent, UniBaseDatasource, UniBoxComponent, UniBreadcrumbComponent, UniButtonComponent, UniButtonGroupComponent, UniCalendarComponent, UniCalloutComponent, UniCardComponent, UniCardContentComponent, UniCardHeaderComponent, UniCenterComponent, UniCheckboxComponent, UniComboboxComponent, UniDataSearchComponent, UniDataTableComponent, UniDateInputComponent, UniDateTimeInputComponent, UniDebounceInputComponent, UniDialogButtonsComponent, UniDialogComponent, UniDialogHeaderComponent, UniDividerComponent, UniDrawerComponent, UniDropdownComponent, UniExpandAreaComponent, UniExpandComponent, UniExpandToggleComponent, UniFileDropZoneComponent, UniGridAreaComponent, UniGridComponent, UniIconButtonComponent, UniIconComponent, UniInputBoxComponent, UniInputComponent, UniJsonViewComponent, UniMenuComponent, UniMultiSelectComponent, UniMultiSelectDropdownComponent, UniNotificationBadgeComponent, UniPaginatorComponent, UniPopoverComponent, UniProgressBarComponent, UniProgressGaugeComponent, UniRadioComponent, UniRecordDatasource, UniRowComponent, UniScrollAreaComponent, UniSearchInputComponent, UniSelectComponent, UniServerSideDatasource, UniSkeletonComponent, UniSliderComponent, UniSnackbarComponent, UniSortHeaderComponent, UniStackComponent, UniStatComponent, UniSymbolComponent, UniTabComponent, UniTabsComponent, UniTagComponent, UniTagInputComponent, UniTextComponent, UniTextareaComponent, UniThemeBuilderComponent, UniThemeSwitchComponent, UniTimeInputComponent, UniToggleComponent, UniTooltipComponent, UniTourComponent, UniWrapComponent, acceptableFile, addDays, addMonths, anchorArrowStyles, anchorStyles, buildMonthGrid, clearAnchorName, createListboxNavigation, dayOfWeek, daysInMonth, discreteOverlayTransition, focusableElements, formatDate, formatMonthHeading, formatTime, getFileExtension, inclusiveDayCount, isDivider, isToggleOpen, isValidDate, isoDate, joinDateTime, listboxPopupStyles, localeDatePlaceholder, localeDefaultHour12, localeFieldOrder, localeMonthNames, localeWeekStart, monthOf, motionSafe, newAnchorName, parseDateText, parseTimeText, resolveElement, resolveFocusTarget, restoreOverlayFocus, setAnchorName, splitDateTime, spotlightStyles, timeSlots, todayIso, uniqueId, useTimer, visuallyHidden, weekdayNames };
11282
+ export { BodyRenderDirective, ConfirmationDialogComponent, DragAndDropDirective, FOCUSABLE_SELECTOR, ListboxNavigation, LocalStorageService, NotificationService, NotificationsComponent, RippleDirective, TRANSFORM_ORIGINS, ThemeService, UNI_THEMES, UniAlertComponent, UniAppBarComponent, UniAvatarComponent, UniAvatarGroupComponent, UniBackgroundComponent, UniBadgeComponent, UniBaseDatasource, UniBoxComponent, UniBreadcrumbComponent, UniButtonComponent, UniButtonGroupComponent, UniCalendarComponent, UniCalloutComponent, UniCardComponent, UniCardContentComponent, UniCardHeaderComponent, UniCenterComponent, UniCheckboxComponent, UniComboboxComponent, UniDataSearchComponent, UniDataTableComponent, UniDateInputComponent, UniDateTimeInputComponent, UniDebounceInputComponent, UniDialogButtonsComponent, UniDialogComponent, UniDialogHeaderComponent, UniDividerComponent, UniDrawerComponent, UniDropdownComponent, UniExpandAreaComponent, UniExpandComponent, UniExpandToggleComponent, UniFileDropZoneComponent, UniGridAreaComponent, UniGridComponent, UniIconButtonComponent, UniIconComponent, UniInputBoxComponent, UniInputComponent, UniJsonViewComponent, UniMenuComponent, UniMultiSelectComponent, UniMultiSelectDropdownComponent, UniNotificationBadgeComponent, UniPaginatorComponent, UniPopoverComponent, UniProgressBarComponent, UniProgressGaugeComponent, UniRadioComponent, UniRecordDatasource, UniRowComponent, UniScrollAreaComponent, UniSearchInputComponent, UniSelectComponent, UniServerSideDatasource, UniSkeletonComponent, UniSliderComponent, UniSnackbarComponent, UniSortHeaderComponent, UniStackComponent, UniStatComponent, UniSymbolComponent, UniTabComponent, UniTabsComponent, UniTagComponent, UniTagInputComponent, UniTextComponent, UniTextareaComponent, UniThemeBuilderComponent, UniThemeSwitchComponent, UniTimeInputComponent, UniToggleComponent, UniTooltipComponent, UniTourComponent, UniWrapComponent, acceptableFile, addDays, addMonths, anchorArrowStyles, anchorStyles, buildMonthGrid, clearAnchorName, createListboxNavigation, dayOfWeek, daysInMonth, discreteOverlayTransition, focusableElements, formatDate, formatMonthHeading, formatTime, getFileExtension, inclusiveDayCount, isDivider, isToggleOpen, isValidDate, isoDate, joinDateTime, listboxPopupStyles, localeDatePlaceholder, localeDefaultHour12, localeFieldOrder, localeMonthNames, localeWeekStart, monthOf, motionSafe, newAnchorName, parseDateText, parseTimeText, resolveElement, resolveFocusTarget, restoreOverlayFocus, setAnchorName, splitDateTime, spotlightStyles, timeSlots, todayIso, transformOriginFor, uniqueId, useTimer, visuallyHidden, weekdayNames };
11229
11283
  //# sourceMappingURL=uni-design-system-uni-angular.mjs.map