@apliteni/apliteni-ui 0.123.0 → 0.124.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apliteni/apliteni-ui",
3
- "version": "0.123.0",
3
+ "version": "0.124.1",
4
4
  "workspaces": [
5
5
  "react"
6
6
  ],
@@ -637,7 +637,10 @@ function ddSizeHeight(dd, panel) {
637
637
  /** Fit a panel again where it now is, whichever placement it uses. */
638
638
  function ddPlace(dd) {
639
639
  const panel = dd.__ddPanel || ddPanelOf(dd);
640
- if (dd.__ddPanel) positionPortalPanel(dd, dd.__ddPanel);
640
+ if (dd.__ddPanel) {
641
+ ddResolveDirection(dd, panel);
642
+ positionPortalPanel(dd, panel);
643
+ }
641
644
  else ddFitViewport(dd, ddPanelOf(dd));
642
645
  ddSizeHeight(dd, panel);
643
646
  }
@@ -700,16 +703,36 @@ function ddCancelClose(dd, panel) {
700
703
  else panel?.classList?.remove('is-closing');
701
704
  }
702
705
 
703
- // `auto` is the only direction the wiring decides; `up` and the default are the
704
- // panel's own class, set once at render. Flip only when below is too tight AND
705
- // above is roomier, so a panel that fits nowhere still opens the way it says.
706
+ // Keep the configured side separate from the side resolved for this opening.
706
707
  function ddResolveDirection(dd, panel) {
707
- if (dd.getAttribute('data-dropdown-direction') !== 'auto') return;
708
+ const auto = dd.getAttribute('data-dropdown-direction') === 'auto';
709
+ if (!auto && !dd.__ddPanel) return;
708
710
  const trigger = dd.querySelector('[data-dropdown-trigger]');
709
711
  if (!trigger || typeof trigger.getBoundingClientRect !== 'function') return;
710
712
  const t = trigger.getBoundingClientRect();
711
713
  const below = ddViewOf(panel).innerHeight - t.bottom;
712
- panel.classList.toggle('is-up', below < panel.offsetHeight + ddGap(panel) && t.top > below);
714
+ if (auto) {
715
+ ddSetUp(panel, below < panel.offsetHeight + ddGap(panel) && t.top > below);
716
+ return;
717
+ }
718
+ const up = dd.__ddPreferredUp;
719
+ const room = (up ? t.top : below) - ddGap(panel);
720
+ const opposite = (up ? below : t.top) - ddGap(panel);
721
+ // Short content or a smaller consumer cap needs less than the usual floor.
722
+ const needed = Math.min(ddMin(panel), panel.offsetHeight);
723
+ ddSetUp(panel, room < needed && opposite > room ? !up : up);
724
+ }
725
+
726
+ /* Change the side without a transition: the shut panel's transform would otherwise
727
+ * be running when `is-open` arrives, and the open would retarget it from the wrong
728
+ * side. */
729
+ function ddSetUp(panel, up) {
730
+ if (panel.classList.contains('is-up') === up) return;
731
+ const held = panel.style.transition;
732
+ panel.style.transition = 'none';
733
+ panel.classList.toggle('is-up', up);
734
+ ddViewOf(panel).getComputedStyle(panel).transform;
735
+ panel.style.transition = held;
713
736
  }
714
737
 
715
738
  /** The shift a panel is already carrying, the one ddFitViewport() wrote. Taken
@@ -1057,6 +1080,7 @@ export function wireDropdown(root = document) {
1057
1080
  sweepOrphanPanels(host);
1058
1081
  panel.setAttribute('data-dropdown-portal', '');
1059
1082
  panel.__ddOwner = dd;
1083
+ dd.__ddPreferredUp = panel.classList.contains('is-up');
1060
1084
  dd.__ddPanel = panel;
1061
1085
  host.appendChild(panel);
1062
1086
  if (dd.classList.contains('open')) {
@@ -69,15 +69,22 @@
69
69
  selector for the markup this component emits, and the spelling that keeps a
70
70
  rule about an ENABLED control out of the disabled-rule sweep in
71
71
  stories/guidelines/accessibility-floor.test.js, which reads selector text. */
72
- /* The one selected mark #578 round r34 LEFT as an edge, and why. A pager stands on
73
- the page in one showcase and on a card in another; --surface steps off the page at
74
- 1.110:1 and off a card at 1.000:1, so a fill that marks the current page on one
75
- ground marks nothing on the other. The hairline is what survives both. Open for
76
- Artur on #578. */
72
+ /* #615: an accent fill stands off page and card alike, as the Segmented pill does. */
77
73
  .ui-pager__page.is-current:not([disabled]) {
78
- background: var(--surface); /* code-bg: inherit — control paint; the containing surface is the ground, for a chip and for a band alike. */
79
- border-color: var(--border);
80
- color: var(--strong);
74
+ background: var(--accent);
75
+ color: var(--accent-contrast);
76
+ font-weight: var(--weight-semibold);
77
+ }
78
+ /* White ink falls below the text floor on the lighter dark-theme accents. */
79
+ :where(:root[data-theme="dark"]) .ui-pager__page.is-current:not([disabled]) {
80
+ color: var(--signal-contrast);
81
+ }
82
+
83
+ /* #615: a disabled current page keeps the mark a disabled selected Segmented pill keeps: the quiet
84
+ fill and the semibold weight, in the disabled ink. A busy pager still does not look live. */
85
+ .ui-pager__page.is-current[disabled] {
86
+ background: var(--surface-3); /* code-bg: inherit — the selected control's own fill. */
87
+ /* muted-ink: state — unavailable control */ color: var(--disabled-ink);
81
88
  font-weight: var(--weight-semibold);
82
89
  }
83
90
 
@@ -209,7 +209,7 @@
209
209
  src/styles/dropdown.css:271 `.ui-dropdown__item:hover`.
210
210
  why: docs/foundations.md#elevation */
211
211
  .vopt:hover { outline: 1px solid var(--control-edge); outline-offset: -1px; background: var(--surface); /* code-bg: inherit — control paint; the containing surface is the ground, for a chip and for a band alike. */ }
212
- /* The row is a keyboard stop: src/components/dropdown.js:1141
212
+ /* The row is a keyboard stop: src/components/dropdown.js:1165
213
213
  `items[next < 0 ? 0 : next]?.focus()` moves focus onto a `[data-dd-item]` with
214
214
  the arrow keys, and this is one. It takes the ring on its own 10px radius, the
215
215
  same way `.amenu a` above does. #482 */