@apliteni/apliteni-ui 0.187.0 → 0.189.0

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.
@@ -982,6 +982,9 @@ destructive question.
982
982
  body scrolls, and the title, the close control and the footer stay visible. The title is an `h2`.
983
983
  `initialFocusRef` chooses the first focus.
984
984
 
985
+ `size="sm"` gives a 360px panel for a short sign-in form. Without `size`, Modal uses its default
986
+ wide panel.
987
+
985
988
  **On a phone.** At 560px and narrower, with a coarse pointer, each footer button has a 44px tap
986
989
  zone. The buttons keep their drawn size.
987
990
 
@@ -1291,7 +1294,8 @@ Right, Home and End move between columns and announce each one. Enter picks a co
1291
1294
  `selectable` is set. A plot that scrolls adds one more Tab stop for the scroll box. On a touch
1292
1295
  screen, the first tap on a mark opens its readout and does not call `onSelect`. After Escape, a
1293
1296
  new tap on the same mark opens its readout again. Every value is
1294
- reachable at full strength by pointer or keyboard.
1297
+ reachable at full strength by pointer or keyboard. A readout in a scrolling region stays fully
1298
+ visible over the region and opens above its mark when that space is available.
1295
1299
 
1296
1300
  ### Table values
1297
1301
 
@@ -31,4 +31,5 @@ Each row names one guideline page, the screen parts it covers, and when to read
31
31
  | [Going back](going-back.md) | The back link, its destination and the parent address. | Read it when a page sits under another page. |
32
32
  | [Account and settings](account-and-settings.md) | The account window, the account menu and settings rows. | Read it before you build the account menu or settings. |
33
33
  | [Notifications](notifications.md) | The bell, its unread count, read state and a failed load. | Read it before you build a bell or a notifications list. |
34
+ | [Session expired](session-expired.md) | A session-ended dialog, its page state and its lasting sign-in notice. | Read it before you handle an ended session. |
34
35
  | [Guidelines](overview.md) | No screen parts. The file holds only the collection heading. | Read it only for the heading. The six-card overview is in Storybook, not in the package. |
@@ -0,0 +1,61 @@
1
+ # Session expired
2
+
3
+ ## Sign in on the same page
4
+
5
+ <!-- rule: sign-in-same-page -->
6
+
7
+ **Rule:** When a session ends, open a sign-in dialog over the current page.
8
+
9
+ **Why:** The reader can see where work will continue.
10
+
11
+ **Do:** Open “Sign in again” over Payouts.
12
+
13
+ **Don't:** Send the reader to a sign-in page.
14
+
15
+ ## Keep the work
16
+
17
+ <!-- rule: keep-work -->
18
+
19
+ **Rule:** After sign-in, return the reader to the same place with the same input and filters.
20
+
21
+ **Why:** The reader loses time when they must set the search and filter again.
22
+
23
+ **Do:** Keep the search text and the pending filter.
24
+
25
+ **Don't:** Clear the search text or the filter.
26
+
27
+ ## Say that the session ended
28
+
29
+ <!-- rule: say-session-ended -->
30
+
31
+ **Rule:** Say that the session ended and that sign-in continues the work.
32
+
33
+ **Why:** The reader needs to know why the dialog opened.
34
+
35
+ **Do:** Say “Your session ended. Sign in to keep working.”
36
+
37
+ **Don't:** Say only “Sign in required.”
38
+
39
+ ## Keep the shell and title
40
+
41
+ <!-- rule: skeleton-behind-dialog -->
42
+
43
+ **Rule:** Keep the page shell and title, and replace page data with skeleton shapes until sign-in.
44
+
45
+ **Why:** The reader keeps their place without seeing protected data.
46
+
47
+ **Do:** Keep Payouts and show a table-shaped skeleton.
48
+
49
+ **Don't:** Blank the whole page behind the dialog.
50
+
51
+ ## Keep a way back in
52
+
53
+ <!-- rule: lasting-sign-in -->
54
+
55
+ **Rule:** If the reader closes the dialog, keep a lasting notice with a Sign in button on the page.
56
+
57
+ **Why:** The reader can sign in when ready without losing the page.
58
+
59
+ **Do:** Show “You are signed out” with Sign in.
60
+
61
+ **Don't:** Remove the dialog and show no sign-in action.
@@ -122,7 +122,7 @@
122
122
 
123
123
  **Don't:** Open one automatically when the page loads.
124
124
 
125
- **Except:** When a session ends while the reader works, open a sign-in dialog over the page and keep the page as it was.
125
+ **Except:** When a session ends while the reader works, open a sign-in dialog over the page, keep its shell and title, and replace its data with skeleton shapes until sign-in.
126
126
 
127
127
  ## Keep table density consistent
128
128
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apliteni/apliteni-ui",
3
- "version": "0.187.0",
3
+ "version": "0.189.0",
4
4
  "workspaces": [
5
5
  "react"
6
6
  ],
@@ -287,6 +287,9 @@
287
287
  .rx-scrim.is-open .rx-modal {
288
288
  transform: none;
289
289
  }
290
+ .rx-modal--sm {
291
+ width: min(calc(var(--panel-sm) + var(--space-10)), 96vw);
292
+ }
290
293
  .rx-modal__head {
291
294
  display: flex;
292
295
  align-items: center;
@@ -212,10 +212,11 @@ type ModalProps = {
212
212
  onClose: () => void;
213
213
  footer?: ReactNode;
214
214
  children?: ReactNode;
215
+ size?: 'sm';
215
216
  role?: 'dialog' | 'alertdialog';
216
217
  initialFocusRef?: RefObject<HTMLElement | null>;
217
218
  };
218
- declare function Modal({ open, title, onClose, footer, children, initialFocusRef, role }: ModalProps): react.ReactPortal | null;
219
+ declare function Modal({ open, title, onClose, footer, children, initialFocusRef, role, size }: ModalProps): react.ReactPortal | null;
219
220
 
220
221
  type AccountSection = {
221
222
  id: string;
@@ -1011,7 +1011,7 @@ function useDialog(active, { root, panel, body, initialFocus, fallbackFocus }, o
1011
1011
 
1012
1012
  // src/Modal.tsx
1013
1013
  import { jsx as jsx13, jsxs as jsxs9 } from "react/jsx-runtime";
1014
- function Modal({ open, title, onClose, footer, children, initialFocusRef, role = "dialog" }) {
1014
+ function Modal({ open, title, onClose, footer, children, initialFocusRef, role = "dialog", size }) {
1015
1015
  const id = useId5();
1016
1016
  const titleId = `${id}-title`;
1017
1017
  const bodyId = `${id}-body`;
@@ -1025,7 +1025,7 @@ function Modal({ open, title, onClose, footer, children, initialFocusRef, role =
1025
1025
  /* @__PURE__ */ jsx13(DialogScope.Provider, { value: scope, children: /* @__PURE__ */ jsx13("div", { className: shown ? "rx-scrim is-open" : "rx-scrim", ref: root, onMouseDown: dismissOnScrim(onClose), children: /* @__PURE__ */ jsxs9(
1026
1026
  "div",
1027
1027
  {
1028
- className: "rx-modal",
1028
+ className: `rx-modal${size === "sm" ? " rx-modal--sm" : ""}`,
1029
1029
  role,
1030
1030
  "aria-modal": "true",
1031
1031
  "aria-labelledby": titleId,
@@ -6094,6 +6094,20 @@ function Shares({ look, format, swatch }) {
6094
6094
 
6095
6095
  // src/Chart.tsx
6096
6096
  import { Fragment as Fragment21, jsx as jsx47, jsxs as jsxs43 } from "react/jsx-runtime";
6097
+ function placeChartTip(mark, tip) {
6098
+ const rect = mark.getBoundingClientRect();
6099
+ const view = tip.ownerDocument.documentElement;
6100
+ const gap = parseFloat(getComputedStyle(tip).getPropertyValue("--ui-tip-gap")) || 8;
6101
+ const above = rect.top;
6102
+ const below = view.clientHeight - rect.bottom;
6103
+ const isBelow = above < tip.offsetHeight + gap && below > above;
6104
+ tip.classList.toggle("is-below", isBelow);
6105
+ const ideal = rect.left + rect.width / 2 - tip.offsetWidth / 2;
6106
+ const left = Math.max(0, Math.min(ideal, view.clientWidth - tip.offsetWidth));
6107
+ tip.style.setProperty("--ui-tip-x", `${rect.left + rect.width / 2}px`);
6108
+ tip.style.setProperty("--ui-tip-y", `${isBelow ? rect.bottom : rect.top}px`);
6109
+ tip.style.setProperty("--ui-tip-shift", `${left - ideal}px`);
6110
+ }
6097
6111
  var HEIGHT = { months: 216, bridge: 216, spark: 32, line: 216, area: 216, stacked: 216, donut: 216 };
6098
6112
  var PAD = 2;
6099
6113
  var ZERO_INSET = 1.5;
@@ -6447,6 +6461,7 @@ function Chart(props) {
6447
6461
  const [said, setSaid] = useState21("");
6448
6462
  const [ownPick, setOwnPick] = useState21(null);
6449
6463
  const pick = selected === void 0 ? ownPick : selected;
6464
+ const topLayer = typeof HTMLElement !== "undefined" && typeof HTMLElement.prototype.showPopover === "function";
6450
6465
  const steps = props.variant === "bridge" ? props.steps : void 0;
6451
6466
  const bridgeTones = props.variant === "bridge" ? props.tones : void 0;
6452
6467
  const periods = props.variant === "bridge" || props.variant === "donut" ? void 0 : props.periods;
@@ -6614,10 +6629,20 @@ function Chart(props) {
6614
6629
  if (opensAtEnd && el) el.scrollLeft = el.scrollWidth - el.clientWidth;
6615
6630
  }, [opensAtEnd, plotWidth, boxWidth, count]);
6616
6631
  useLayoutEffect5(() => {
6617
- if (!openId || !frameEl.current || !tipEl.current || !svgEl.current) return;
6632
+ const tip = tipEl.current;
6633
+ if (!tip) return;
6634
+ const layered = topLayer;
6635
+ if (!openId) {
6636
+ if (layered && tip.matches(":popover-open")) tip.hidePopover();
6637
+ return;
6638
+ }
6639
+ if (!frameEl.current || !svgEl.current) return;
6618
6640
  const anchor2 = [...svgEl.current.querySelectorAll("[data-anchor]")].find((el) => el.getAttribute("data-anchor") === openId);
6619
- if (anchor2) placeTip(frameEl.current, anchor2, tipEl.current);
6620
- }, [openId, plotWidth, plotHeight]);
6641
+ if (!anchor2) return;
6642
+ if (layered && !tip.matches(":popover-open")) tip.showPopover();
6643
+ if (layered) placeChartTip(anchor2, tip);
6644
+ else placeTip(frameEl.current, anchor2, tip);
6645
+ }, [openId, plotWidth, plotHeight, topLayer]);
6621
6646
  useEffect21(() => {
6622
6647
  if (!openId) return;
6623
6648
  const doc = frameEl.current?.ownerDocument;
@@ -6630,9 +6655,11 @@ function Chart(props) {
6630
6655
  hide();
6631
6656
  };
6632
6657
  doc.addEventListener("keydown", escape);
6658
+ doc.addEventListener("scroll", hide, true);
6633
6659
  view2.addEventListener("resize", hide);
6634
6660
  return () => {
6635
6661
  doc.removeEventListener("keydown", escape);
6662
+ doc.removeEventListener("scroll", hide, true);
6636
6663
  view2.removeEventListener("resize", hide);
6637
6664
  };
6638
6665
  }, [openId]);
@@ -7050,7 +7077,7 @@ function Chart(props) {
7050
7077
  ] })
7051
7078
  }
7052
7079
  ),
7053
- /* @__PURE__ */ jsx47("span", { ref: tipEl, className: cx9("ui-tip", openId && "is-open"), role: open ? "tooltip" : void 0, children: open && /* @__PURE__ */ jsxs43(Fragment21, { children: [
7080
+ /* @__PURE__ */ jsx47("span", { ref: tipEl, ...topLayer && { popover: "manual" }, className: cx9("ui-tip", openId && "is-open"), role: open ? "tooltip" : void 0, children: open && /* @__PURE__ */ jsxs43(Fragment21, { children: [
7054
7081
  /* @__PURE__ */ jsx47("span", { className: "ui-tip__label", children: spark || look ? columns[open.column]?.label : `${open.name}, ${columns[open.column]?.label}` }),
7055
7082
  open.rows ? /* @__PURE__ */ jsxs43(Fragment21, { children: [
7056
7083
  open.rows.map((row) => /* @__PURE__ */ jsxs43("span", { className: "ui-tip__value ui-chart__row", children: [