@ciridae/ui 0.13.0 → 0.15.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.
Files changed (60) hide show
  1. package/dist/components/blocks/comment-thread.js +2 -25
  2. package/dist/components/blocks/feedback-center-comments.d.ts +4 -2
  3. package/dist/components/blocks/feedback-center-comments.js +49 -6
  4. package/dist/components/blocks/feedback-center-sheet-parts.d.ts +4 -2
  5. package/dist/components/blocks/feedback-center-sheet-parts.js +8 -8
  6. package/dist/components/blocks/feedback-center-sheet.d.ts +3 -1
  7. package/dist/components/blocks/feedback-center-sheet.js +3 -1
  8. package/dist/components/blocks/feedback-composer.d.ts +2 -0
  9. package/dist/components/blocks/feedback-composer.js +5 -5
  10. package/dist/components/blocks/feedback-detail-sheet.js +2 -2
  11. package/dist/components/blocks/feedback-metrics.js +1 -1
  12. package/dist/components/blocks/feedback-tracking-types.d.ts +6 -1
  13. package/dist/components/blocks/feedback-tracking-types.js +2 -2
  14. package/dist/components/blocks/feedback-user-detail.js +7 -8
  15. package/dist/components/blocks/feedback-user-list.js +4 -4
  16. package/dist/components/blocks/timestamp-format.js +2 -4
  17. package/dist/components/blocks/use-reveal-thread-end.d.ts +11 -0
  18. package/dist/components/blocks/use-reveal-thread-end.js +25 -0
  19. package/dist/components/ui/app-shell-page.js +6 -2
  20. package/dist/components/ui/item.d.ts +1 -1
  21. package/dist/components/ui/sidebar/context.d.ts +6 -0
  22. package/dist/components/ui/sidebar/context.js +9 -1
  23. package/dist/components/ui/sidebar.d.ts +1 -1
  24. package/dist/components/ui/sidebar.js +1 -1
  25. package/dist/components/ui/tabs-variants.d.ts +1 -1
  26. package/dist/components/walkthrough/presentation/WalkthroughCoach.d.ts +14 -0
  27. package/dist/components/walkthrough/presentation/WalkthroughCoach.js +32 -0
  28. package/dist/components/walkthrough/presentation/WalkthroughHighlight.d.ts +5 -0
  29. package/dist/components/walkthrough/presentation/WalkthroughHighlight.js +9 -0
  30. package/dist/components/walkthrough/presentation/WalkthroughOverlay.d.ts +1 -0
  31. package/dist/components/walkthrough/presentation/WalkthroughOverlay.js +70 -0
  32. package/dist/components/walkthrough/presentation/positionWalkthroughCoach.d.ts +11 -0
  33. package/dist/components/walkthrough/presentation/positionWalkthroughCoach.js +24 -0
  34. package/dist/components/walkthrough/presentation/useWalkthroughCoachPosition.d.ts +4 -0
  35. package/dist/components/walkthrough/presentation/useWalkthroughCoachPosition.js +17 -0
  36. package/dist/components/walkthrough/runtime/WalkthroughContextDefinition.d.ts +20 -0
  37. package/dist/components/walkthrough/runtime/WalkthroughContextDefinition.js +2 -0
  38. package/dist/components/walkthrough/runtime/WalkthroughProvider.d.ts +12 -0
  39. package/dist/components/walkthrough/runtime/WalkthroughProvider.js +190 -0
  40. package/dist/components/walkthrough/runtime/useWalkthrough.d.ts +1 -0
  41. package/dist/components/walkthrough/runtime/useWalkthrough.js +8 -0
  42. package/dist/components/walkthrough/runtime/walkthroughEvents.d.ts +3 -0
  43. package/dist/components/walkthrough/runtime/walkthroughEvents.js +55 -0
  44. package/dist/components/walkthrough/runtime/walkthroughLocation.d.ts +2 -0
  45. package/dist/components/walkthrough/runtime/walkthroughLocation.js +27 -0
  46. package/dist/components/walkthrough/runtime/walkthroughStorage.d.ts +3 -0
  47. package/dist/components/walkthrough/runtime/walkthroughStorage.js +54 -0
  48. package/dist/components/walkthrough/runtime/walkthroughTypes.d.ts +32 -0
  49. package/dist/components/walkthrough/runtime/walkthroughTypes.js +1 -0
  50. package/dist/components/walkthrough/targeting/listenForOutsideWalkthroughInteraction.d.ts +2 -0
  51. package/dist/components/walkthrough/targeting/listenForOutsideWalkthroughInteraction.js +19 -0
  52. package/dist/components/walkthrough/targeting/useWalkthroughTargetRect.d.ts +15 -0
  53. package/dist/components/walkthrough/targeting/useWalkthroughTargetRect.js +54 -0
  54. package/dist/components/walkthrough/targeting/walkthroughTarget.d.ts +6 -0
  55. package/dist/components/walkthrough/targeting/walkthroughTarget.js +24 -0
  56. package/dist/components/walkthrough.d.ts +4 -0
  57. package/dist/components/walkthrough.js +2 -0
  58. package/dist/entries/walkthrough.d.ts +1 -0
  59. package/dist/entries/walkthrough.js +1 -0
  60. package/package.json +1 -1
@@ -0,0 +1,19 @@
1
+ import { WALKTHROUGH_TARGET_ATTRIBUTE } from "./walkthroughTarget.js";
2
+ export function listenForOutsideWalkthroughInteraction(step, pause) {
3
+ const listener = (event) => {
4
+ const element = event.target;
5
+ if (!(element instanceof Element))
6
+ return;
7
+ if (element.closest("[data-walkthrough-coach]"))
8
+ return;
9
+ const walkthroughTarget = element.closest(`[${WALKTHROUGH_TARGET_ATTRIBUTE}]`);
10
+ const targetName = walkthroughTarget?.getAttribute(WALKTHROUGH_TARGET_ATTRIBUTE);
11
+ if (walkthroughTarget && (targetName === step.target || targetName === step.restoreTarget))
12
+ return;
13
+ pause();
14
+ };
15
+ document.addEventListener("click", listener, true);
16
+ return () => {
17
+ document.removeEventListener("click", listener, true);
18
+ };
19
+ }
@@ -0,0 +1,15 @@
1
+ export type WalkthroughTargetRect = {
2
+ height: number;
3
+ left: number;
4
+ top: number;
5
+ width: number;
6
+ };
7
+ export type WalkthroughTargetObservation = {
8
+ status: "locating";
9
+ } | {
10
+ status: "missing";
11
+ } | {
12
+ rect: WalkthroughTargetRect;
13
+ status: "found";
14
+ };
15
+ export declare function useWalkthroughTargetRect(target: string | null): WalkthroughTargetObservation;
@@ -0,0 +1,54 @@
1
+ import { useEffect, useState } from "react";
2
+ import { findWalkthroughTarget } from "./walkthroughTarget.js";
3
+ const LOCATING_TARGET_OBSERVATION = { status: "locating" };
4
+ const MISSING_TARGET_OBSERVATION = { status: "missing" };
5
+ export function useWalkthroughTargetRect(target) {
6
+ const [observation, setObservation] = useState(LOCATING_TARGET_OBSERVATION);
7
+ useEffect(() => {
8
+ if (!target) {
9
+ setObservation(LOCATING_TARGET_OBSERVATION);
10
+ return;
11
+ }
12
+ let didScroll = false;
13
+ const measure = (forceUpdate = false) => {
14
+ const element = findWalkthroughTarget(target);
15
+ if (!element) {
16
+ didScroll = false;
17
+ setObservation(MISSING_TARGET_OBSERVATION);
18
+ return;
19
+ }
20
+ if (!didScroll) {
21
+ element.scrollIntoView({ behavior: "smooth", block: "center", inline: "nearest" });
22
+ didScroll = true;
23
+ }
24
+ const rect = element.getBoundingClientRect();
25
+ const next = {
26
+ rect: { height: rect.height, left: rect.left, top: rect.top, width: rect.width },
27
+ status: "found",
28
+ };
29
+ setObservation((current) => (!forceUpdate && sameObservation(current, next) ? current : next));
30
+ };
31
+ const handleResize = () => measure(true);
32
+ const handleScroll = () => measure();
33
+ measure();
34
+ const intervalId = window.setInterval(() => measure(), 300);
35
+ window.addEventListener("resize", handleResize);
36
+ window.addEventListener("scroll", handleScroll, true);
37
+ return () => {
38
+ window.clearInterval(intervalId);
39
+ window.removeEventListener("resize", handleResize);
40
+ window.removeEventListener("scroll", handleScroll, true);
41
+ };
42
+ }, [target]);
43
+ return observation;
44
+ }
45
+ function sameObservation(current, next) {
46
+ if (current.status !== next.status)
47
+ return false;
48
+ if (current.status !== "found" || next.status !== "found")
49
+ return true;
50
+ return (current.rect.height === next.rect.height &&
51
+ current.rect.left === next.rect.left &&
52
+ current.rect.top === next.rect.top &&
53
+ current.rect.width === next.rect.width);
54
+ }
@@ -0,0 +1,6 @@
1
+ export declare const WALKTHROUGH_TARGET_ATTRIBUTE = "data-walkthrough-target";
2
+ export declare function walkthroughTargetProps(target: string): {
3
+ "data-walkthrough-target": string;
4
+ };
5
+ export declare function findWalkthroughTarget(target: string): HTMLElement | null;
6
+ export declare function isEnabledWalkthroughTarget(candidate: HTMLElement): boolean;
@@ -0,0 +1,24 @@
1
+ export const WALKTHROUGH_TARGET_ATTRIBUTE = "data-walkthrough-target";
2
+ export function walkthroughTargetProps(target) {
3
+ return { "data-walkthrough-target": target };
4
+ }
5
+ export function findWalkthroughTarget(target) {
6
+ const candidates = document.querySelectorAll(`[${WALKTHROUGH_TARGET_ATTRIBUTE}]`);
7
+ for (let index = candidates.length - 1; index >= 0; index -= 1) {
8
+ const candidate = candidates.item(index);
9
+ if (candidate.getAttribute(WALKTHROUGH_TARGET_ATTRIBUTE) === target &&
10
+ isVisibleWalkthroughTarget(candidate) &&
11
+ isEnabledWalkthroughTarget(candidate)) {
12
+ return candidate;
13
+ }
14
+ }
15
+ return null;
16
+ }
17
+ export function isEnabledWalkthroughTarget(candidate) {
18
+ return !candidate.matches(":disabled, [aria-disabled='true']");
19
+ }
20
+ function isVisibleWalkthroughTarget(candidate) {
21
+ const rect = candidate.getBoundingClientRect();
22
+ const style = window.getComputedStyle(candidate);
23
+ return (rect.width > 0 && rect.height > 0 && style.display !== "none" && style.visibility !== "hidden");
24
+ }
@@ -0,0 +1,4 @@
1
+ export { WalkthroughProvider, type WalkthroughProviderProps, } from "./walkthrough/runtime/WalkthroughProvider.js";
2
+ export type { WalkthroughContextValue } from "./walkthrough/runtime/WalkthroughContextDefinition.js";
3
+ export { useWalkthrough } from "./walkthrough/runtime/useWalkthrough.js";
4
+ export type { WalkthroughAdvance, WalkthroughDefinition, WalkthroughFreshStartHandlers, WalkthroughProgress, WalkthroughStep, } from "./walkthrough/runtime/walkthroughTypes.js";
@@ -0,0 +1,2 @@
1
+ export { WalkthroughProvider, } from "./walkthrough/runtime/WalkthroughProvider.js";
2
+ export { useWalkthrough } from "./walkthrough/runtime/useWalkthrough.js";
@@ -0,0 +1 @@
1
+ export * from "../components/walkthrough.js";
@@ -0,0 +1 @@
1
+ export * from "../components/walkthrough.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ciridae/ui",
3
- "version": "0.13.0",
3
+ "version": "0.15.0",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "engines": {