@robert-stackflow/oneui 0.6.20 → 0.6.22

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,3 +1,15 @@
1
+ # 0.6.22
2
+
3
+ - Add opt-in Popover arrow and offset. The pointer tracks the anchor after viewport clamping; the body scrolls without clipping the pointer. Vertical surfaces flip when the other side offers more space.
4
+ - Animate pointed popovers with a small scale and slide from the pointer, preserving interrupted transitions and reduced-motion preferences.
5
+ - Add IconButton disclosure with a spaced, animated chevron and an expanded state; keep ordinary icon buttons unchanged.
6
+
7
+ # 0.6.21
8
+
9
+ - Add Link with inherited typography, subtle content links, shared hover/focus states and disabled navigation. Export from the root and Link subpath.
10
+ - Add Markdown fontSize for reading preferences, with scaled prose and headings; default rendering remains unchanged.
11
+ - Keep Slider's accessible name stable when its current value changes; native range value announcements remain available.
12
+
1
13
  # 0.6.19
2
14
 
3
15
  - Add opt-in Combobox allowCustomValue input mode: preserve freely typed text on blur, Enter, and async loading or failure; only explicit option selection commits an option. Pass the selected option as the optional second onChange argument.
package/README.md CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  React 组件、应用外壳和两套可互换的主题。无 Electron、React Router、账户 API 或持久化存储依赖。
4
4
 
5
+ ## 带指向箭头的浮层(0.6.22)
6
+
7
+ `Popover arrow offset={14}` 在浮层边缘显示指向 anchor 的小三角,并以该点为原点轻微缩放、位移和淡入淡出。`offset` 控制浮层边缘与触发区域的距离;默认值保持原有布局。箭头在窗口边缘钳制位置后仍对准触发区域,内容在内部滚动。动效继承主题时长和减少动态效果设置。
8
+
9
+ `IconButton disclosure aria-expanded={open}` 自动添加有间距的展开箭头、旋转动效和展开状态;调用方只传主要图标。组合按钮的尺寸与焦点继续由 OneUI 负责。
10
+
11
+ ## 内容链接与阅读字号(0.6.21)
12
+
13
+ `Link` 从根入口或 `@robert-stackflow/oneui/Link` 导入。默认使用主题链接色;`variant="subtle"` 继承周围标题或正文的颜色与字体,统一 hover、键盘焦点和 disabled 行为,保留原生链接与新标签打开语义。应用无需单独定义标题链接样式。
14
+
15
+ `Markdown` 支持 `fontSize={18}`,正文与相对字号标题共同缩放;不传时保持默认 14 px。有限数值限制在 10–48 px,非有限数值沿用默认值。
16
+
5
17
  ## 可读前景色(0.6.16 候选)
6
18
 
7
19
  `--accent-ink` 用于文字、小图标、细标记和焦点;按钮实心填充仍使用 `--accent-fill` / `--accent`。极简主题的 ink 随前景色变化,蓝白主题使用相应模式的强调色;自定义强调色混入当前前景色后用于 ink,避免深色模式中的深灰标记或浅色模式中的白色标记不可见。可单独覆盖此变量。徽标、链接、步骤、菜单/单选标记、进度、图表、时间线及信息反馈复用这套颜色。
@@ -1,7 +1,9 @@
1
1
  import type { ComponentPropsWithRef } from "react";
2
- export declare function IconButton({ label, loading, children, variant, size, ...props }: ComponentPropsWithRef<"button"> & {
2
+ export declare function IconButton({ label, loading, children, variant, size, disclosure, ...props }: ComponentPropsWithRef<"button"> & {
3
3
  label: string;
4
4
  loading?: boolean;
5
5
  variant?: "primary" | "secondary" | "ghost" | "danger";
6
6
  size?: "small" | "normal";
7
+ /** Add a spaced disclosure chevron, driven by aria-expanded. */
8
+ disclosure?: boolean;
7
9
  }): import("react").JSX.Element;
@@ -1,7 +1,8 @@
1
1
  "use client";
2
- import { jsx } from "react/jsx-runtime";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import { Spinner } from "./Spinner.js";
4
4
  import { Tooltip } from "./Tooltip.js";
5
+ import { DisclosureChevron } from "./DisclosureChevron.js";
5
6
  import s from "./IconButton.module.css";
6
7
  function IconButton({
7
8
  label,
@@ -9,6 +10,7 @@ function IconButton({
9
10
  children,
10
11
  variant = "ghost",
11
12
  size = "normal",
13
+ disclosure = false,
12
14
  ...props
13
15
  }) {
14
16
  return /* @__PURE__ */ jsx(Tooltip, { content: label, children: /* @__PURE__ */ jsx(
@@ -20,9 +22,18 @@ function IconButton({
20
22
  "aria-busy": loading || void 0,
21
23
  "data-variant": variant,
22
24
  "data-size": size,
25
+ "data-disclosure": disclosure || void 0,
23
26
  disabled: props.disabled || loading,
24
27
  className: `${s.iconButton} ${props.className || ""}`,
25
- children: /* @__PURE__ */ jsx("span", { className: s.icon, children: loading ? /* @__PURE__ */ jsx(Spinner, { decorative: true }) : children })
28
+ children: /* @__PURE__ */ jsxs("span", { className: s.icon, children: [
29
+ loading ? /* @__PURE__ */ jsx(Spinner, { decorative: true }) : children,
30
+ disclosure && /* @__PURE__ */ jsx(
31
+ DisclosureChevron,
32
+ {
33
+ expanded: props["aria-expanded"] === true || props["aria-expanded"] === "true"
34
+ }
35
+ )
36
+ ] })
26
37
  }
27
38
  ) });
28
39
  }
@@ -40,3 +40,16 @@
40
40
  color: var(--danger);
41
41
  background: var(--danger-soft);
42
42
  }
43
+ .iconButton[data-disclosure] {
44
+ width: auto;
45
+ padding-inline: 7px;
46
+ }
47
+ .iconButton[data-disclosure] .icon {
48
+ display: flex;
49
+ align-items: center;
50
+ gap: 3px;
51
+ }
52
+ .iconButton[data-disclosure][aria-expanded="true"] {
53
+ color: var(--accent-ink, var(--fg));
54
+ background: var(--hover);
55
+ }
@@ -0,0 +1,8 @@
1
+ import type { ComponentPropsWithRef } from "react";
2
+ export type LinkProps = ComponentPropsWithRef<"a"> & {
3
+ /** Subtle links inherit their surrounding heading or text color. */
4
+ variant?: "default" | "subtle";
5
+ disabled?: boolean;
6
+ };
7
+ /** Content navigation with shared typography, hover and keyboard focus. */
8
+ export declare function Link({ variant, disabled, className, children, onClick, target, rel, ...props }: LinkProps): import("react").JSX.Element;
@@ -0,0 +1,36 @@
1
+ "use client";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import s from "./Link.module.css";
4
+ function Link({
5
+ variant = "default",
6
+ disabled = false,
7
+ className = "",
8
+ children,
9
+ onClick,
10
+ target,
11
+ rel,
12
+ ...props
13
+ }) {
14
+ return /* @__PURE__ */ jsx(
15
+ "a",
16
+ {
17
+ ...props,
18
+ target,
19
+ rel: rel ?? (target === "_blank" ? "noopener noreferrer" : void 0),
20
+ className: `${s.link} ${variant === "subtle" ? s.subtle : ""} ${className}`,
21
+ "aria-disabled": disabled || void 0,
22
+ tabIndex: disabled ? -1 : props.tabIndex,
23
+ onClick: (event) => {
24
+ if (disabled) {
25
+ event.preventDefault();
26
+ return;
27
+ }
28
+ onClick?.(event);
29
+ },
30
+ children
31
+ }
32
+ );
33
+ }
34
+ export {
35
+ Link
36
+ };
@@ -0,0 +1,18 @@
1
+ .link {
2
+ color: var(--link-color, var(--accent-ink, var(--accent)));
3
+ font: inherit;
4
+ text-decoration: none;
5
+ text-underline-offset: 3px;
6
+ overflow-wrap: anywhere;
7
+ border-radius: 2px;
8
+ }
9
+ .subtle { color: inherit; }
10
+ .link:hover:not([aria-disabled="true"]) {
11
+ color: var(--link-hover-color, var(--accent-ink, var(--accent)));
12
+ text-decoration: underline;
13
+ }
14
+ .link:focus-visible {
15
+ outline: 2px solid var(--accent-ink, var(--accent));
16
+ outline-offset: 3px;
17
+ }
18
+ .link[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
@@ -3,6 +3,8 @@ import type { TableAppearance } from "./Table";
3
3
  export type MarkdownCodeTheme = "auto" | "github-light" | "github-dark" | "nord" | "dracula";
4
4
  export type MarkdownProps = {
5
5
  children: string;
6
+ /** Reading size in pixels; headings and prose scale together. */
7
+ fontSize?: number;
6
8
  className?: string;
7
9
  codeTheme?: MarkdownCodeTheme;
8
10
  tableProps?: TableAppearance;
@@ -10,4 +12,4 @@ export type MarkdownProps = {
10
12
  components?: Components;
11
13
  };
12
14
  /** Shared GFM rendering; raw HTML is omitted and URL filtering stays enabled. */
13
- export declare function Markdown({ children, className, components, codeTheme, tableProps, }: MarkdownProps): import("react").JSX.Element;
15
+ export declare function Markdown({ children, fontSize, className, components, codeTheme, tableProps, }: MarkdownProps): import("react").JSX.Element;
@@ -130,13 +130,14 @@ function footnoteLabels({ id, prefix }) {
130
130
  }
131
131
  function Markdown({
132
132
  children,
133
+ fontSize,
133
134
  className = "",
134
135
  components,
135
136
  codeTheme = "auto",
136
137
  tableProps = { striped: true }
137
138
  }) {
138
139
  const id = useId();
139
- return /* @__PURE__ */ jsx(MarkdownOptions, { value: { codeTheme, tableProps }, children: /* @__PURE__ */ jsx("div", { className: `${s.markdown} ${className}`, "data-markdown": true, children: /* @__PURE__ */ jsx(
140
+ return /* @__PURE__ */ jsx(MarkdownOptions, { value: { codeTheme, tableProps }, children: /* @__PURE__ */ jsx("div", { className: `${s.markdown} ${className}`, "data-markdown": true, style: fontSize !== void 0 && Number.isFinite(fontSize) ? { fontSize: Math.min(48, Math.max(10, fontSize)) } : void 0, children: /* @__PURE__ */ jsx(
140
141
  ReactMarkdown,
141
142
  {
142
143
  remarkPlugins: plugins,
@@ -1,6 +1,6 @@
1
1
  import { type ReactNode, type RefObject } from "react";
2
2
  import { type MenuSide } from "./motion";
3
- export declare function Popover({ open: requestedOpen, onClose, anchor, children, width, maxHeight, scrollable, side, align, label, role, id, onKeyDown, descriptionId, autoFocus, matchAnchorWidth, className, portalContainer, }: {
3
+ export declare function Popover({ open: requestedOpen, onClose, anchor, children, width, maxHeight, scrollable, side, align, label, role, id, onKeyDown, descriptionId, autoFocus, matchAnchorWidth, className, portalContainer, arrow, offset, }: {
4
4
  open: boolean;
5
5
  onClose(): void;
6
6
  anchor: RefObject<HTMLElement | null>;
@@ -21,4 +21,8 @@ export declare function Popover({ open: requestedOpen, onClose, anchor, children
21
21
  matchAnchorWidth?: boolean;
22
22
  className?: string;
23
23
  portalContainer?: HTMLElement | null;
24
+ /** Show a pointer toward the anchor, with motion originating at that point. */
25
+ arrow?: boolean;
26
+ /** Space between the anchor and surface edge, in CSS pixels. */
27
+ offset?: number;
24
28
  }): import("react").ReactPortal | null;
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { jsx } from "react/jsx-runtime";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
3
  import { usePortalRoot } from "./usePortalRoot.js";
4
4
  import { FieldContext } from "./field.js";
5
5
  import {
@@ -8,7 +8,11 @@ import {
8
8
  useEffect
9
9
  } from "react";
10
10
  import { createPortal } from "react-dom";
11
- import { menuSurfaceMotion, cancelMotion } from "./motion.js";
11
+ import {
12
+ menuSurfaceMotion,
13
+ popoverSurfaceMotion,
14
+ cancelMotion
15
+ } from "./motion.js";
12
16
  import s from "./Popover.module.css";
13
17
  import { useSurfacePortal } from "./surfacePortal.js";
14
18
  function Popover({
@@ -29,7 +33,9 @@ function Popover({
29
33
  autoFocus = true,
30
34
  matchAnchorWidth = false,
31
35
  className = "",
32
- portalContainer
36
+ portalContainer,
37
+ arrow = false,
38
+ offset
33
39
  }) {
34
40
  const root = usePortalRoot();
35
41
  const owner = useSurfacePortal(), portalHost = portalContainer || owner?.host || root, open = requestedOpen && owner?.active !== false;
@@ -37,6 +43,7 @@ function Popover({
37
43
  close.current = onClose;
38
44
  const opened = useRef(open);
39
45
  opened.current = open;
46
+ const animate = arrow ? popoverSurfaceMotion : menuSurfaceMotion;
40
47
  useEffect(() => {
41
48
  if (requestedOpen && owner?.active === false) close.current();
42
49
  }, [requestedOpen, owner?.active]);
@@ -52,14 +59,12 @@ function Popover({
52
59
  if (!surface.matches(":popover-open")) return;
53
60
  surface.inert = true;
54
61
  surface.setAttribute("aria-hidden", "true");
55
- void menuSurfaceMotion(
56
- surface,
57
- "exit",
58
- surface.dataset.side
59
- ).then((done) => {
60
- if (done && !opened.current && surface.matches(":popover-open"))
61
- surface.hidePopover();
62
- });
62
+ void animate(surface, "exit", surface.dataset.side).then(
63
+ (done) => {
64
+ if (done && !opened.current && surface.matches(":popover-open"))
65
+ surface.hidePopover();
66
+ }
67
+ );
63
68
  return;
64
69
  }
65
70
  if (!trigger) return;
@@ -80,40 +85,61 @@ function Popover({
80
85
  Math.min(maxHeight, viewportBottom - viewportTop - 24)
81
86
  );
82
87
  surface.style.maxHeight = available + "px";
88
+ surface.style.setProperty(
89
+ "--popover-body-height",
90
+ Math.max(0, available - 12) + "px"
91
+ );
83
92
  const actualWidth = Math.min(
84
93
  matchAnchorWidth ? rect.width : width,
85
94
  Math.max(0, viewportWidth - 24)
86
95
  );
87
96
  surface.style.width = actualWidth + "px";
88
- const height = Math.min(surface.scrollHeight + 2, available);
89
- const below = viewportBottom - rect.bottom - 10;
90
- let resolved = side === "auto" ? below >= height || rect.top - viewportTop < height ? "bottom" : "top" : side;
97
+ const height = Math.min(surface.offsetHeight, available);
98
+ const gap = Math.max(0, Number.isFinite(offset) ? offset : 6);
99
+ const horizontalGap = Math.max(0, Number.isFinite(offset) ? offset : 8);
100
+ const below = viewportBottom - rect.bottom - gap - 12;
101
+ const above = rect.top - viewportTop - gap - 12;
102
+ let resolved = side === "auto" ? below >= height || below >= above ? "bottom" : "top" : side;
103
+ if (resolved === "top" && above < height && below > above)
104
+ resolved = "bottom";
105
+ else if (resolved === "bottom" && below < height && above > below)
106
+ resolved = "top";
91
107
  if (resolved === "left" && rect.left - viewportLeft - 20 < actualWidth && viewportLeft + viewportWidth - rect.right - 20 >= actualWidth)
92
108
  resolved = "right";
93
109
  if (resolved === "right" && viewportLeft + viewportWidth - rect.right - 20 < actualWidth && rect.left - viewportLeft - 20 >= actualWidth)
94
110
  resolved = "left";
95
111
  const horizontal = resolved === "left" || resolved === "right";
96
- const left = horizontal ? resolved === "left" ? rect.left - actualWidth - 8 : rect.right + 8 : align === "end" ? rect.right - actualWidth : align === "center" ? rect.left + (rect.width - actualWidth) / 2 : rect.left;
97
- const top = horizontal ? align === "end" ? rect.bottom - height : align === "center" ? rect.top + (rect.height - height) / 2 : rect.top : resolved === "bottom" ? rect.bottom + 6 : rect.top - height - 6;
112
+ const left = horizontal ? resolved === "left" ? rect.left - actualWidth - horizontalGap : rect.right + horizontalGap : align === "end" ? rect.right - actualWidth : align === "center" ? rect.left + (rect.width - actualWidth) / 2 : rect.left;
113
+ const top = horizontal ? align === "end" ? rect.bottom - height : align === "center" ? rect.top + (rect.height - height) / 2 : rect.top : resolved === "bottom" ? rect.bottom + gap : rect.top - height - gap;
98
114
  surface.dataset.side = resolved;
99
- surface.style.left = Math.max(
115
+ const placedLeft = Math.max(
100
116
  viewportLeft + 12,
101
117
  Math.min(left, viewportLeft + viewportWidth - actualWidth - 12)
102
- ) + "px";
103
- surface.style.top = Math.max(
118
+ );
119
+ const placedTop = Math.max(
104
120
  viewportTop + 12,
105
121
  Math.min(top, viewportBottom - height - 12)
106
- ) + "px";
122
+ );
123
+ surface.style.left = placedLeft + "px";
124
+ surface.style.top = placedTop + "px";
125
+ const pointerX = Math.max(
126
+ 16,
127
+ Math.min(actualWidth - 16, rect.left + rect.width / 2 - placedLeft)
128
+ );
129
+ const pointerY = Math.max(
130
+ 16,
131
+ Math.min(height - 16, rect.top + rect.height / 2 - placedTop)
132
+ );
133
+ surface.style.setProperty("--popover-arrow-x", pointerX + "px");
134
+ surface.style.setProperty("--popover-arrow-y", pointerY + "px");
135
+ if (arrow)
136
+ surface.style.transformOrigin = horizontal ? `${resolved === "right" ? "0" : "100%"} ${pointerY}px` : `${pointerX}px ${resolved === "bottom" ? "0" : "100%"}`;
107
137
  };
108
138
  const entering = !surface.matches(":popover-open") || surface.dataset.motionPhase === "exit" || surface.dataset.motionPhase === "hidden";
109
139
  if (!surface.matches(":popover-open")) surface.showPopover();
110
140
  position();
111
141
  if (entering)
112
- void menuSurfaceMotion(
113
- surface,
114
- "enter",
115
- surface.dataset.side
116
- );
142
+ void animate(surface, "enter", surface.dataset.side);
117
143
  if (autoFocus && role !== "listbox")
118
144
  (surface.querySelector("[data-autofocus]") || surface.querySelector(
119
145
  'input:not([disabled]),button:not([disabled]),[tabindex="0"]'
@@ -164,7 +190,9 @@ function Popover({
164
190
  autoFocus,
165
191
  matchAnchorWidth,
166
192
  side,
167
- align
193
+ align,
194
+ arrow,
195
+ offset
168
196
  ]);
169
197
  if (!portalHost) return null;
170
198
  return createPortal(
@@ -178,8 +206,11 @@ function Popover({
178
206
  "aria-label": label,
179
207
  "aria-describedby": descriptionId,
180
208
  onKeyDown,
181
- className: `${s.popover} ${scrollable ? "" : s.contained} ${className}`,
182
- children: /* @__PURE__ */ jsx(FieldContext, { value: null, children })
209
+ className: `${s.popover} ${scrollable ? "" : s.contained} ${arrow ? s.withArrow : ""} ${className}`,
210
+ children: /* @__PURE__ */ jsx(FieldContext, { value: null, children: arrow ? /* @__PURE__ */ jsxs(Fragment, { children: [
211
+ /* @__PURE__ */ jsx("span", { className: s.arrow, "data-popover-arrow": true, "aria-hidden": "true" }),
212
+ /* @__PURE__ */ jsx("div", { className: `${s.body} ${scrollable ? "" : s.bodyContained}`, children })
213
+ ] }) : children })
183
214
  }
184
215
  ),
185
216
  portalHost
@@ -25,3 +25,55 @@
25
25
  .popover:not(:popover-open) {
26
26
  display: none;
27
27
  }
28
+ .popover.withArrow {
29
+ overflow: visible;
30
+ }
31
+ .body {
32
+ min-height: 0;
33
+ flex-shrink: 1;
34
+ max-height: var(--popover-body-height);
35
+ overflow-y: auto;
36
+ overscroll-behavior: contain;
37
+ border-radius: max(0px, calc(var(--popup-radius) - 5px));
38
+ }
39
+ .bodyContained {
40
+ display: flex;
41
+ flex-direction: column;
42
+ overflow: hidden;
43
+ }
44
+ .bodyContained > * {
45
+ flex-shrink: 0;
46
+ }
47
+ .arrow {
48
+ position: absolute;
49
+ width: 10px;
50
+ height: 10px;
51
+ background: var(--popup-background);
52
+ border: 0 solid var(--popup-border);
53
+ transform: rotate(45deg);
54
+ pointer-events: none;
55
+ }
56
+ .withArrow[data-side="bottom"] > .arrow {
57
+ top: -6px;
58
+ left: calc(var(--popover-arrow-x) - 5px);
59
+ border-top-width: 1px;
60
+ border-left-width: 1px;
61
+ }
62
+ .withArrow[data-side="top"] > .arrow {
63
+ bottom: -6px;
64
+ left: calc(var(--popover-arrow-x) - 5px);
65
+ border-bottom-width: 1px;
66
+ border-right-width: 1px;
67
+ }
68
+ .withArrow[data-side="right"] > .arrow {
69
+ left: -6px;
70
+ top: calc(var(--popover-arrow-y) - 5px);
71
+ border-bottom-width: 1px;
72
+ border-left-width: 1px;
73
+ }
74
+ .withArrow[data-side="left"] > .arrow {
75
+ right: -6px;
76
+ top: calc(var(--popover-arrow-y) - 5px);
77
+ border-top-width: 1px;
78
+ border-right-width: 1px;
79
+ }
@@ -16,7 +16,7 @@ function Slider({
16
16
  return /* @__PURE__ */ jsxs("div", { className: s.field, children: [
17
17
  /* @__PURE__ */ jsxs("label", { htmlFor: id, children: [
18
18
  label,
19
- /* @__PURE__ */ jsxs("span", { children: [
19
+ /* @__PURE__ */ jsxs("span", { "aria-hidden": "true", children: [
20
20
  value,
21
21
  suffix
22
22
  ] })
@@ -1,6 +1,7 @@
1
1
  export { Badge } from "./Badge";
2
2
  export { ActionSheet, type ActionSheetItem } from "./ActionSheet";
3
3
  export { Button } from "./Button";
4
+ export { Link, type LinkProps } from "./Link";
4
5
  export { Checkbox } from "./Checkbox";
5
6
  export { ColorField } from "./ColorField";
6
7
  export { DatePicker } from "./DatePicker";
@@ -2,6 +2,7 @@
2
2
  import { Badge } from "./Badge.js";
3
3
  import { ActionSheet } from "./ActionSheet.js";
4
4
  import { Button } from "./Button.js";
5
+ import { Link } from "./Link.js";
5
6
  import { Checkbox } from "./Checkbox.js";
6
7
  import { ColorField } from "./ColorField.js";
7
8
  import { DatePicker } from "./DatePicker.js";
@@ -215,6 +216,7 @@ export {
215
216
  IconSurface,
216
217
  Indicator,
217
218
  Input,
219
+ Link,
218
220
  LoadingOverlay,
219
221
  LoadingState,
220
222
  Mark,
@@ -6,5 +6,6 @@ export declare function cancelMotion(node: HTMLElement): void;
6
6
  export declare function surfaceMotion(node: HTMLElement, phase: Phase, offset?: string, token?: string): Promise<boolean>;
7
7
  export declare function toastMotion(node: HTMLElement, phase: Phase, position: string): Promise<boolean>;
8
8
  export type MenuSide = "top" | "bottom" | "left" | "right";
9
+ export declare function popoverSurfaceMotion(node: HTMLElement, phase: "enter" | "exit", side?: MenuSide): Promise<boolean>;
9
10
  export declare function menuSurfaceMotion(node: HTMLElement, phase: "enter" | "exit", side?: MenuSide): Promise<boolean>;
10
11
  export {};
@@ -24,13 +24,17 @@ function runMotion(node, phase, offset = "0 -4px", token, profile = "surface") {
24
24
  opacity: interrupted ? style.opacity : phase === "enter" ? "0" : phase === "update" ? ".78" : "1",
25
25
  translate: interrupted ? style.translate : phase === "enter" ? offset : phase === "update" ? profile === "toast" ? "0 0" : "0 2px" : "0 0"
26
26
  };
27
- const scale = profile === "toast" ? { scale: interrupted ? style.scale : phase === "enter" ? ".96" : "1" } : {};
27
+ const scale = profile !== "surface" ? {
28
+ scale: interrupted ? style.scale : phase === "enter" ? profile === "toast" ? ".96" : ".97" : "1"
29
+ } : {};
28
30
  Object.assign(from, scale);
29
31
  state.animation?.cancel();
30
32
  const to = {
31
33
  opacity: phase === "exit" ? "0" : "1",
32
34
  translate: phase === "exit" ? offset : "0 0",
33
- ...profile === "toast" ? { scale: phase === "exit" ? ".98" : "1" } : {}
35
+ ...profile !== "surface" ? {
36
+ scale: phase === "exit" ? profile === "toast" ? ".98" : ".985" : "1"
37
+ } : {}
34
38
  };
35
39
  node.dataset.motionPhase = phase;
36
40
  const finish = () => {
@@ -75,6 +79,15 @@ function toastMotion(node, phase, position) {
75
79
  const offset = position.endsWith("right") ? "14px 0" : position.endsWith("left") ? "-14px 0" : position.startsWith("top") ? "0 -12px" : "0 12px";
76
80
  return runMotion(node, phase, offset, `--toast-${phase}`, "toast");
77
81
  }
82
+ function popoverSurfaceMotion(node, phase, side = "bottom") {
83
+ const offset = {
84
+ top: "0 6px",
85
+ bottom: "0 -6px",
86
+ left: "6px 0",
87
+ right: "-6px 0"
88
+ }[side];
89
+ return runMotion(node, phase, offset, void 0, "popover");
90
+ }
78
91
  function menuSurfaceMotion(node, phase, side = "bottom") {
79
92
  const offset = {
80
93
  top: "0 4px",
@@ -88,6 +101,7 @@ export {
88
101
  cancelMotion,
89
102
  menuSurfaceMotion,
90
103
  motionDuration,
104
+ popoverSurfaceMotion,
91
105
  popupExitDuration,
92
106
  reducedMotion,
93
107
  surfaceMotion,
package/package.json CHANGED
@@ -1,12 +1,18 @@
1
1
  {
2
2
  "name": "@robert-stackflow/oneui",
3
- "version": "0.6.20",
3
+ "version": "0.6.22",
4
4
  "description": "OneUI React components, application shell and portable visual themes",
5
5
  "type": "module",
6
6
  "sideEffects": [
7
7
  "**/*.css"
8
8
  ],
9
9
  "exports": {
10
+ "./Link": {
11
+ "types": "./components/Link.d.ts",
12
+ "import": "./components/Link.js",
13
+ "default": "./components/Link.js"
14
+ },
15
+ "./Link.module.css": "./components/Link.module.css",
10
16
  ".": {
11
17
  "types": "./components/index.d.ts",
12
18
  "import": "./components/index.js",