@celestia-island/hikari 0.55.120 → 0.55.121

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": "@celestia-island/hikari",
3
- "version": "0.55.120",
3
+ "version": "0.55.121",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Hikari Vue 3 component library — production-grade UI components based on shittim-chest design system",
@@ -1,7 +1,7 @@
1
1
  import { computed, defineComponent, ref, type PropType } from "vue";
2
2
 
3
3
  import HBadge, { type BadgeVariant } from "./HkBadge";
4
- import HTooltip from "./HkTooltip";
4
+ import HTooltip, { type HkTooltipSlotProps } from "./HkTooltip";
5
5
  import { useI18n } from "../i18n/context";
6
6
  import { useClipboardWithToast } from "../runtime/useClipboard";
7
7
  import { useToast } from "../runtime/useToast";
@@ -140,7 +140,7 @@ export default defineComponent({
140
140
  if (props.disabled) return buildBadge();
141
141
  return (
142
142
  <HTooltip text={tooltipText.value}>
143
- {(tip: { popupId: string; visible: boolean }) =>
143
+ {(tip?: HkTooltipSlotProps) =>
144
144
  buildBadge(tip?.visible ? tip.popupId : undefined)}
145
145
  </HTooltip>
146
146
  );
@@ -1,7 +1,7 @@
1
1
  import { afterEach, describe, expect, it, vi } from "vitest";
2
2
  import { createApp, h, nextTick } from "vue";
3
3
 
4
- import HkTooltip from "./HkTooltip";
4
+ import HkTooltip, { type HkTooltipSlotProps } from "./HkTooltip";
5
5
  import { POPUP_Z_BANDS, POPUP_Z_STEP, usePopupManager } from "../runtime/usePopupManager";
6
6
 
7
7
  /**
@@ -176,18 +176,19 @@ describe("HkTooltip show/hide", () => {
176
176
  it("hands { popupId, visible } to the default slot for focus-target wiring", async () => {
177
177
  const container = document.createElement("div");
178
178
  document.body.appendChild(container);
179
- let seen: { popupId?: string; visible?: boolean } = {};
179
+ let seen: Partial<HkTooltipSlotProps> = {};
180
180
  const app = createApp({
181
181
  render: () =>
182
182
  h(
183
183
  HkTooltip,
184
- { text: "slot props", delay: 0 } as never,
185
- // The scoped-slot child needs a cast: HkTooltip does not declare
186
- // slot prop types, so h() types the default slot as no-arg.
187
- ((slotProps: { popupId: string; visible: boolean }) => {
184
+ { text: "slot props", delay: 0 },
185
+ // Object-form scoped slot; the arg type comes from the local
186
+ // annotation against the exported contract (h()'s RawSlots has
187
+ // no SlotsType-aware overload), not from the slots declaration.
188
+ { default: (slotProps: HkTooltipSlotProps) => {
188
189
  seen = slotProps;
189
190
  return h("span", { class: "anchor-probe" }, "anchor");
190
- }) as never,
191
+ } },
191
192
  ),
192
193
  });
193
194
  app.mount(container);
@@ -1,8 +1,20 @@
1
- import { computed, defineComponent, onBeforeUnmount, ref, Teleport, type CSSProperties, type PropType } from "vue";
1
+ import { computed, defineComponent, onBeforeUnmount, ref, Teleport, type CSSProperties, type PropType, type SlotsType } from "vue";
2
2
  import { usePopupManager, type PopupHandle } from "../runtime/usePopupManager";
3
3
  import { applyTooltipPosition, type TooltipPlacement } from "../runtime/tooltipPosition";
4
4
  import "./HkTooltip.scss";
5
5
 
6
+ /**
7
+ * The default-slot payload, handed to every render of the trigger. An
8
+ * interactive trigger should bind `popupId` onto itself via
9
+ * aria-describedby while `visible` is true — the focus target is the
10
+ * trigger element, not this component's wrapper (HkCopyBadge is the
11
+ * reference consumer).
12
+ */
13
+ export interface HkTooltipSlotProps {
14
+ popupId: string;
15
+ visible: boolean;
16
+ }
17
+
6
18
  let popupSeq = 0;
7
19
 
8
20
  export default defineComponent({
@@ -13,6 +25,9 @@ export default defineComponent({
13
25
  delay: { type: Number, default: 300 },
14
26
  maxWidth: { type: String, default: undefined },
15
27
  },
28
+ slots: Object as SlotsType<{
29
+ default?: (props: HkTooltipSlotProps) => unknown;
30
+ }>,
16
31
  setup(props, { slots }) {
17
32
  const visible = ref(false);
18
33
  // Stable id for the aria-describedby link from the trigger wrapper to
package/src/index.ts CHANGED
@@ -752,6 +752,7 @@ export { default as HkFileBrowserDialog } from "./components/HkFileBrowserDialog
752
752
  export { default as HkFilePickerField } from "./components/HkFilePickerField";
753
753
  export { default as HkToast } from "./components/HkToast";
754
754
  export { default as HkTooltip } from "./components/HkTooltip";
755
+ export { type HkTooltipSlotProps } from "./components/HkTooltip";
755
756
  export { default as HkTree } from "./components/HkTree";
756
757
  export { default as HkWindowedItem } from "./components/HkWindowedItem";
757
758
  export { default as HkWaterfall } from "./components/HkWaterfall";