kang-components 0.9.7 → 0.9.9
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/dist/error-boundary.d.ts +41 -0
- package/dist/error-boundary.d.ts.map +1 -0
- package/dist/error-boundary.js +44 -0
- package/dist/error-boundary.js.map +1 -0
- package/dist/error-boundary.styles.d.ts +6 -0
- package/dist/error-boundary.styles.d.ts.map +1 -0
- package/dist/error-boundary.styles.js +66 -0
- package/dist/error-boundary.styles.js.map +1 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/long-press-tooltip.d.ts +24 -0
- package/dist/long-press-tooltip.d.ts.map +1 -0
- package/dist/long-press-tooltip.js +143 -0
- package/dist/long-press-tooltip.js.map +1 -0
- package/dist/long-press-tooltip.styles.d.ts +2318 -0
- package/dist/long-press-tooltip.styles.d.ts.map +1 -0
- package/dist/long-press-tooltip.styles.js +55 -0
- package/dist/long-press-tooltip.styles.js.map +1 -0
- package/dist/spring.d.ts +10 -0
- package/dist/spring.d.ts.map +1 -1
- package/dist/spring.js +10 -0
- package/dist/spring.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Component, type ErrorInfo, type ReactNode } from 'react';
|
|
2
|
+
export interface ErrorBoundaryProps {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
/**
|
|
5
|
+
* Reporter invoked when a child throws (e.g. a Sentry/GlitchTip capture).
|
|
6
|
+
* Injected so kang stays free of any observability backend. Optional — the
|
|
7
|
+
* fallback still renders without it.
|
|
8
|
+
*/
|
|
9
|
+
onError?: (error: Error, info: ErrorInfo) => void;
|
|
10
|
+
/** Recovery action; defaults to a hard reload of the page. */
|
|
11
|
+
onReload?: () => void;
|
|
12
|
+
/** Fallback heading. */
|
|
13
|
+
title?: ReactNode;
|
|
14
|
+
/** Fallback body copy. */
|
|
15
|
+
message?: ReactNode;
|
|
16
|
+
/** Recovery button label. */
|
|
17
|
+
reloadLabel?: string;
|
|
18
|
+
}
|
|
19
|
+
interface ErrorBoundaryState {
|
|
20
|
+
hasError: boolean;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Domain-free root error boundary — the app's last line of defense against a
|
|
24
|
+
* render-time throw white-screening the whole UI. Designed to sit ABOVE the app's
|
|
25
|
+
* Redux/Theme providers, so it is fully self-contained (hard-coded, OS-color-scheme
|
|
26
|
+
* aware styles).
|
|
27
|
+
*
|
|
28
|
+
* The observability backend is injected via `onError`; recovery defaults to a hard
|
|
29
|
+
* reload (override with `onReload`) since persisted state (localStorage/Gun)
|
|
30
|
+
* restores on reload, whereas a soft state reset would just re-render the broken
|
|
31
|
+
* subtree and re-throw.
|
|
32
|
+
*/
|
|
33
|
+
export declare class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
|
|
34
|
+
state: ErrorBoundaryState;
|
|
35
|
+
static getDerivedStateFromError(): ErrorBoundaryState;
|
|
36
|
+
componentDidCatch(error: Error, info: ErrorInfo): void;
|
|
37
|
+
private handleReload;
|
|
38
|
+
render(): ReactNode;
|
|
39
|
+
}
|
|
40
|
+
export default ErrorBoundary;
|
|
41
|
+
//# sourceMappingURL=error-boundary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-boundary.d.ts","sourceRoot":"","sources":["../src/error-boundary.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AASlE,MAAM,WAAW,kBAAkB;IAClC,QAAQ,EAAE,SAAS,CAAC;IACpB;;;;OAIG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;IAClD,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,wBAAwB;IACxB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,0BAA0B;IAC1B,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,6BAA6B;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,UAAU,kBAAkB;IAC3B,QAAQ,EAAE,OAAO,CAAC;CAClB;AAOD;;;;;;;;;;GAUG;AACH,qBAAa,aAAc,SAAQ,SAAS,CAAC,kBAAkB,EAAE,kBAAkB,CAAC;IACnF,KAAK,EAAE,kBAAkB,CAAuB;IAEhD,MAAM,CAAC,wBAAwB,IAAI,kBAAkB;IAIrD,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,GAAG,IAAI;IAItD,OAAO,CAAC,YAAY,CAMlB;IAEF,MAAM,IAAI,SAAS;CAiBnB;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Component } from 'react';
|
|
3
|
+
import { ErrorBoundaryContainer, ErrorCard, ErrorTitle, ErrorMessage, ReloadButton, } from './error-boundary.styles.js';
|
|
4
|
+
const DEFAULT_TITLE = 'Something went wrong';
|
|
5
|
+
const DEFAULT_MESSAGE = 'The app hit an unexpected error. Reloading usually fixes it, and your progress is saved.';
|
|
6
|
+
const DEFAULT_RELOAD_LABEL = 'Reload';
|
|
7
|
+
/**
|
|
8
|
+
* Domain-free root error boundary — the app's last line of defense against a
|
|
9
|
+
* render-time throw white-screening the whole UI. Designed to sit ABOVE the app's
|
|
10
|
+
* Redux/Theme providers, so it is fully self-contained (hard-coded, OS-color-scheme
|
|
11
|
+
* aware styles).
|
|
12
|
+
*
|
|
13
|
+
* The observability backend is injected via `onError`; recovery defaults to a hard
|
|
14
|
+
* reload (override with `onReload`) since persisted state (localStorage/Gun)
|
|
15
|
+
* restores on reload, whereas a soft state reset would just re-render the broken
|
|
16
|
+
* subtree and re-throw.
|
|
17
|
+
*/
|
|
18
|
+
export class ErrorBoundary extends Component {
|
|
19
|
+
constructor() {
|
|
20
|
+
super(...arguments);
|
|
21
|
+
this.state = { hasError: false };
|
|
22
|
+
this.handleReload = () => {
|
|
23
|
+
if (this.props.onReload) {
|
|
24
|
+
this.props.onReload();
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
window.location.reload();
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
static getDerivedStateFromError() {
|
|
31
|
+
return { hasError: true };
|
|
32
|
+
}
|
|
33
|
+
componentDidCatch(error, info) {
|
|
34
|
+
this.props.onError?.(error, info);
|
|
35
|
+
}
|
|
36
|
+
render() {
|
|
37
|
+
if (this.state.hasError) {
|
|
38
|
+
return (_jsx(ErrorBoundaryContainer, { role: "alert", children: _jsxs(ErrorCard, { children: [_jsx(ErrorTitle, { children: this.props.title ?? DEFAULT_TITLE }), _jsx(ErrorMessage, { children: this.props.message ?? DEFAULT_MESSAGE }), _jsx(ReloadButton, { type: "button", onClick: this.handleReload, children: this.props.reloadLabel ?? DEFAULT_RELOAD_LABEL })] }) }));
|
|
39
|
+
}
|
|
40
|
+
return this.props.children;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
export default ErrorBoundary;
|
|
44
|
+
//# sourceMappingURL=error-boundary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-boundary.js","sourceRoot":"","sources":["../src/error-boundary.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAkC,MAAM,OAAO,CAAC;AAClE,OAAO,EACN,sBAAsB,EACtB,SAAS,EACT,UAAU,EACV,YAAY,EACZ,YAAY,GACZ,MAAM,4BAA4B,CAAC;AAwBpC,MAAM,aAAa,GAAG,sBAAsB,CAAC;AAC7C,MAAM,eAAe,GACpB,0FAA0F,CAAC;AAC5F,MAAM,oBAAoB,GAAG,QAAQ,CAAC;AAEtC;;;;;;;;;;GAUG;AACH,MAAM,OAAO,aAAc,SAAQ,SAAiD;IAApF;;QACC,UAAK,GAAuB,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;QAUxC,iBAAY,GAAG,GAAS,EAAE;YACjC,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;gBACzB,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;gBACtB,OAAO;YACR,CAAC;YACD,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;QAC1B,CAAC,CAAC;IAmBH,CAAC;IAjCA,MAAM,CAAC,wBAAwB;QAC9B,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC3B,CAAC;IAED,iBAAiB,CAAC,KAAY,EAAE,IAAe;QAC9C,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACnC,CAAC;IAUD,MAAM;QACL,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;YACzB,OAAO,CACN,KAAC,sBAAsB,IAAC,IAAI,EAAC,OAAO,YACnC,MAAC,SAAS,eACT,KAAC,UAAU,cAAE,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI,aAAa,GAAc,EAC5D,KAAC,YAAY,cAAE,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,eAAe,GAAgB,EACpE,KAAC,YAAY,IAAC,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAE,IAAI,CAAC,YAAY,YACpD,IAAI,CAAC,KAAK,CAAC,WAAW,IAAI,oBAAoB,GACjC,IACJ,GACY,CACzB,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;IAC5B,CAAC;CACD;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const ErrorBoundaryContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
|
|
2
|
+
export declare const ErrorCard: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
|
|
3
|
+
export declare const ErrorTitle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, never>>> & string;
|
|
4
|
+
export declare const ErrorMessage: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, never>>> & string;
|
|
5
|
+
export declare const ReloadButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, never>>> & string;
|
|
6
|
+
//# sourceMappingURL=error-boundary.styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-boundary.styles.d.ts","sourceRoot":"","sources":["../src/error-boundary.styles.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,sBAAsB,uVAiBlC,CAAC;AAEF,eAAO,MAAM,SAAS,uVAQrB,CAAC;AAEF,eAAO,MAAM,UAAU,uWAItB,CAAC;AAEF,eAAO,MAAM,YAAY,+WAKxB,CAAC;AAEF,eAAO,MAAM,YAAY,+WAoBxB,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// Named import (not the default) so styled-components resolves consistently
|
|
2
|
+
// when this file is consumed as a published node_modules ESM module.
|
|
3
|
+
import { styled } from 'styled-components';
|
|
4
|
+
// This fallback renders ABOVE the app's ThemeProvider, so it cannot read the
|
|
5
|
+
// styled-components theme. Colors are hard-coded and follow the OS color scheme
|
|
6
|
+
// directly (matching a white light / black dark theme-color).
|
|
7
|
+
export const ErrorBoundaryContainer = styled.div `
|
|
8
|
+
position: fixed;
|
|
9
|
+
inset: 0;
|
|
10
|
+
display: flex;
|
|
11
|
+
align-items: center;
|
|
12
|
+
justify-content: center;
|
|
13
|
+
padding: 24px;
|
|
14
|
+
box-sizing: border-box;
|
|
15
|
+
background: #ffffff;
|
|
16
|
+
color: #1a202c;
|
|
17
|
+
font-family:
|
|
18
|
+
-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
19
|
+
|
|
20
|
+
@media (prefers-color-scheme: dark) {
|
|
21
|
+
background: #000000;
|
|
22
|
+
color: #f7fafc;
|
|
23
|
+
}
|
|
24
|
+
`;
|
|
25
|
+
export const ErrorCard = styled.div `
|
|
26
|
+
display: flex;
|
|
27
|
+
flex-direction: column;
|
|
28
|
+
align-items: center;
|
|
29
|
+
gap: 16px;
|
|
30
|
+
width: 100%;
|
|
31
|
+
max-width: 360px;
|
|
32
|
+
text-align: center;
|
|
33
|
+
`;
|
|
34
|
+
export const ErrorTitle = styled.h1 `
|
|
35
|
+
margin: 0;
|
|
36
|
+
font-size: 1.375rem;
|
|
37
|
+
font-weight: 600;
|
|
38
|
+
`;
|
|
39
|
+
export const ErrorMessage = styled.p `
|
|
40
|
+
margin: 0;
|
|
41
|
+
font-size: 0.95rem;
|
|
42
|
+
line-height: 1.5;
|
|
43
|
+
opacity: 0.75;
|
|
44
|
+
`;
|
|
45
|
+
export const ReloadButton = styled.button `
|
|
46
|
+
margin-top: 8px;
|
|
47
|
+
padding: 12px 28px;
|
|
48
|
+
font-size: 1rem;
|
|
49
|
+
font-weight: 600;
|
|
50
|
+
color: #ffffff;
|
|
51
|
+
background: #4db6ac;
|
|
52
|
+
border: none;
|
|
53
|
+
border-radius: 9999px;
|
|
54
|
+
cursor: pointer;
|
|
55
|
+
transition: opacity 0.15s ease;
|
|
56
|
+
|
|
57
|
+
&:hover {
|
|
58
|
+
opacity: 0.9;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
&:focus-visible {
|
|
62
|
+
outline: 2px solid #4db6ac;
|
|
63
|
+
outline-offset: 3px;
|
|
64
|
+
}
|
|
65
|
+
`;
|
|
66
|
+
//# sourceMappingURL=error-boundary.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-boundary.styles.js","sourceRoot":"","sources":["../src/error-boundary.styles.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,qEAAqE;AACrE,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,6EAA6E;AAC7E,gFAAgF;AAChF,8DAA8D;AAE9D,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;CAiB/C,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;CAQlC,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,EAAE,CAAA;;;;CAIlC,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,CAAC,CAAA;;;;;CAKnC,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAA;;;;;;;;;;;;;;;;;;;;CAoBxC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export type { UseHideOnScrollOptions } from './use-hide-on-scroll.js';
|
|
|
7
7
|
export { actionSheetContainer, actionSheetList, actionSheetRow, } from './action-sheet.js';
|
|
8
8
|
export { Ripple, rippleAnimation, useRipple } from './ripple.js';
|
|
9
9
|
export type { RippleState } from './ripple.js';
|
|
10
|
-
export { SPRING_COMFORTABLE, SPRING_COMFORTABLE_SLOW, SPRING_SNAPPY, SPRING_RESPONSIVE, SPRING_STAGGERED, SPRING_INSTANT, SPRING_GENTLE, SPRING_VERY_SLOW, SPRING_LANDING, SPRING_RISING, } from './spring.js';
|
|
10
|
+
export { SPRING_COMFORTABLE, SPRING_COMFORTABLE_SLOW, SPRING_SNAPPY, SPRING_RESPONSIVE, SPRING_STAGGERED, SPRING_INSTANT, SPRING_GENTLE, SPRING_VERY_SLOW, SPRING_LANDING, SPRING_RISING, SPRING_TRACKING, SPRING_BRISK, SPRING_FLOAT, } from './spring.js';
|
|
11
11
|
export type { SpringConfigConstant } from './spring.js';
|
|
12
12
|
export { default as AnimatedText } from './animated-text.js';
|
|
13
13
|
export type { AnimatedTextProps } from './animated-text.js';
|
|
@@ -25,6 +25,10 @@ export { ConfirmDialog } from './confirm-dialog.js';
|
|
|
25
25
|
export type { ConfirmDialogProps } from './confirm-dialog.js';
|
|
26
26
|
export { Confetti } from './confetti.js';
|
|
27
27
|
export type { ConfettiProps } from './confetti.js';
|
|
28
|
+
export { ErrorBoundary } from './error-boundary.js';
|
|
29
|
+
export type { ErrorBoundaryProps } from './error-boundary.js';
|
|
30
|
+
export { LongPressTooltip } from './long-press-tooltip.js';
|
|
31
|
+
export type { LongPressTooltipProps } from './long-press-tooltip.js';
|
|
28
32
|
export { AnimatedHeight } from './animated-height.js';
|
|
29
33
|
export type { AnimatedHeightProps } from './animated-height.js';
|
|
30
34
|
export { BottomSheet } from './bottom-sheet.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,gBAAgB,GAChB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,YAAY,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE3D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,YAAY,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAEtE,OAAO,EACN,oBAAoB,EACpB,eAAe,EACf,cAAc,GACd,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACjE,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EACN,kBAAkB,EAClB,uBAAuB,EACvB,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,aAAa,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,gBAAgB,GAChB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,YAAY,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE3D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,YAAY,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAEtE,OAAO,EAC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;AACtE,YAAY,EACX,aAAa,EACb,gBAAgB,EAChB,kBAAkB,GAClB,MAAM,gBAAgB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ export { useViewportSize } from './use-viewport-size.js';
|
|
|
4
4
|
export { useHideOnScroll } from './use-hide-on-scroll.js';
|
|
5
5
|
export { actionSheetContainer, actionSheetList, actionSheetRow, } from './action-sheet.js';
|
|
6
6
|
export { Ripple, rippleAnimation, useRipple } from './ripple.js';
|
|
7
|
-
export { SPRING_COMFORTABLE, SPRING_COMFORTABLE_SLOW, SPRING_SNAPPY, SPRING_RESPONSIVE, SPRING_STAGGERED, SPRING_INSTANT, SPRING_GENTLE, SPRING_VERY_SLOW, SPRING_LANDING, SPRING_RISING, } from './spring.js';
|
|
7
|
+
export { SPRING_COMFORTABLE, SPRING_COMFORTABLE_SLOW, SPRING_SNAPPY, SPRING_RESPONSIVE, SPRING_STAGGERED, SPRING_INSTANT, SPRING_GENTLE, SPRING_VERY_SLOW, SPRING_LANDING, SPRING_RISING, SPRING_TRACKING, SPRING_BRISK, SPRING_FLOAT, } from './spring.js';
|
|
8
8
|
export { default as AnimatedText } from './animated-text.js';
|
|
9
9
|
export { default as BackButton } from './back-button.js';
|
|
10
10
|
export { default as CircleIconButton } from './circle-icon-button.js';
|
|
@@ -13,6 +13,8 @@ export { Badge } from './badge.js';
|
|
|
13
13
|
export { default as ToggleSwitch } from './toggle-switch.js';
|
|
14
14
|
export { ConfirmDialog } from './confirm-dialog.js';
|
|
15
15
|
export { Confetti } from './confetti.js';
|
|
16
|
+
export { ErrorBoundary } from './error-boundary.js';
|
|
17
|
+
export { LongPressTooltip } from './long-press-tooltip.js';
|
|
16
18
|
export { AnimatedHeight } from './animated-height.js';
|
|
17
19
|
export { BottomSheet } from './bottom-sheet.js';
|
|
18
20
|
export { SearchField } from './search-field.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,gBAAgB,GAChB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAGzD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG1D,OAAO,EACN,oBAAoB,EACpB,eAAe,EACf,cAAc,GACd,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGjE,OAAO,EACN,kBAAkB,EAClB,uBAAuB,EACvB,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,aAAa,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,gBAAgB,GAChB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAGzD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG1D,OAAO,EACN,oBAAoB,EACpB,eAAe,EACf,cAAc,GACd,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGjE,OAAO,EACN,kBAAkB,EAClB,uBAAuB,EACvB,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,cAA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|
3
|
+
/** The row/control this tooltip describes — receives the long-press gesture. */
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
/** Arbitrary content shown in the floating bubble (caller owns i18n/markup). */
|
|
6
|
+
content: ReactNode;
|
|
7
|
+
/** Hold duration before the bubble opens, in ms. */
|
|
8
|
+
longPressMs?: number;
|
|
9
|
+
/** How long the bubble stays up before auto-dismissing, in ms. */
|
|
10
|
+
autoDismissMs?: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Domain-free touch-and-hold tooltip. Reveals `content` in a floating bubble on
|
|
14
|
+
* long-press; the bubble is portaled to <body> so it escapes any clipped
|
|
15
|
+
* ancestor, and the completed hold swallows the trailing click so it never
|
|
16
|
+
* triggers the row's tap action. Dismisses on outside tap / scroll / resize /
|
|
17
|
+
* Escape / timeout.
|
|
18
|
+
*
|
|
19
|
+
* Language/character knowledge stays in the consuming app: pass an already-built
|
|
20
|
+
* node (e.g. an AnimatedText) as `content`.
|
|
21
|
+
*/
|
|
22
|
+
export declare const LongPressTooltip: ({ children, content, longPressMs, autoDismissMs, }: LongPressTooltipProps) => ReactElement;
|
|
23
|
+
export default LongPressTooltip;
|
|
24
|
+
//# sourceMappingURL=long-press-tooltip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"long-press-tooltip.d.ts","sourceRoot":"","sources":["../src/long-press-tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,EACN,YAAY,EACZ,SAAS,EAQT,MAAM,OAAO,CAAC;AAcf,MAAM,WAAW,qBAAqB;IACrC,gFAAgF;IAChF,QAAQ,EAAE,SAAS,CAAC;IACpB,gFAAgF;IAChF,OAAO,EAAE,SAAS,CAAC;IACnB,oDAAoD;IACpD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kEAAkE;IAClE,aAAa,CAAC,EAAE,MAAM,CAAC;CACvB;AASD;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB,uDAK1B,qBAAqB,KAAG,YA0K1B,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useEffect, useLayoutEffect, useRef, useState, } from 'react';
|
|
3
|
+
import { createPortal } from 'react-dom';
|
|
4
|
+
import { useTransition } from '@react-spring/web';
|
|
5
|
+
import { SPRING_RESPONSIVE } from './spring.js';
|
|
6
|
+
import { TooltipWrapper, TooltipPopover, TooltipArrow } from './long-press-tooltip.styles.js';
|
|
7
|
+
const DEFAULT_LONG_PRESS_MS = 450;
|
|
8
|
+
// Generous enough to absorb finger jitter on a "still" touch hold, small enough
|
|
9
|
+
// that a deliberate scroll still cancels the tooltip.
|
|
10
|
+
const MOVE_CANCEL_PX = 16;
|
|
11
|
+
const GAP_PX = 8;
|
|
12
|
+
const VIEWPORT_MARGIN_PX = 12;
|
|
13
|
+
const DEFAULT_AUTO_DISMISS_MS = 6000;
|
|
14
|
+
/**
|
|
15
|
+
* Domain-free touch-and-hold tooltip. Reveals `content` in a floating bubble on
|
|
16
|
+
* long-press; the bubble is portaled to <body> so it escapes any clipped
|
|
17
|
+
* ancestor, and the completed hold swallows the trailing click so it never
|
|
18
|
+
* triggers the row's tap action. Dismisses on outside tap / scroll / resize /
|
|
19
|
+
* Escape / timeout.
|
|
20
|
+
*
|
|
21
|
+
* Language/character knowledge stays in the consuming app: pass an already-built
|
|
22
|
+
* node (e.g. an AnimatedText) as `content`.
|
|
23
|
+
*/
|
|
24
|
+
export const LongPressTooltip = ({ children, content, longPressMs = DEFAULT_LONG_PRESS_MS, autoDismissMs = DEFAULT_AUTO_DISMISS_MS, }) => {
|
|
25
|
+
const wrapperRef = useRef(null);
|
|
26
|
+
const popoverRef = useRef(null);
|
|
27
|
+
const timerRef = useRef(undefined);
|
|
28
|
+
const pressStartRef = useRef(null);
|
|
29
|
+
// Set when the hold fires so the following click is swallowed (not a tap).
|
|
30
|
+
const longPressFiredRef = useRef(false);
|
|
31
|
+
const [open, setOpen] = useState(false);
|
|
32
|
+
const [anchorRect, setAnchorRect] = useState(null);
|
|
33
|
+
const [coords, setCoords] = useState(null);
|
|
34
|
+
const clearTimer = useCallback(() => {
|
|
35
|
+
if (timerRef.current !== undefined) {
|
|
36
|
+
clearTimeout(timerRef.current);
|
|
37
|
+
timerRef.current = undefined;
|
|
38
|
+
}
|
|
39
|
+
}, []);
|
|
40
|
+
const handlePointerDown = useCallback((event) => {
|
|
41
|
+
if (!event.isPrimary)
|
|
42
|
+
return;
|
|
43
|
+
if (event.pointerType === 'mouse' && event.button !== 0)
|
|
44
|
+
return;
|
|
45
|
+
pressStartRef.current = { x: event.clientX, y: event.clientY };
|
|
46
|
+
clearTimer();
|
|
47
|
+
timerRef.current = setTimeout(() => {
|
|
48
|
+
const el = wrapperRef.current;
|
|
49
|
+
if (!el)
|
|
50
|
+
return;
|
|
51
|
+
setAnchorRect(el.getBoundingClientRect());
|
|
52
|
+
setCoords(null);
|
|
53
|
+
setOpen(true);
|
|
54
|
+
longPressFiredRef.current = true;
|
|
55
|
+
// No explicit navigator.vibrate here: the OS runs its own long-press
|
|
56
|
+
// haptic, and stacking ours on top read as a double buzz.
|
|
57
|
+
}, longPressMs);
|
|
58
|
+
}, [clearTimer, longPressMs]);
|
|
59
|
+
const handlePointerMove = useCallback((event) => {
|
|
60
|
+
const start = pressStartRef.current;
|
|
61
|
+
if (!start)
|
|
62
|
+
return;
|
|
63
|
+
const dx = event.clientX - start.x;
|
|
64
|
+
const dy = event.clientY - start.y;
|
|
65
|
+
if (dx * dx + dy * dy > MOVE_CANCEL_PX * MOVE_CANCEL_PX) {
|
|
66
|
+
clearTimer();
|
|
67
|
+
}
|
|
68
|
+
}, [clearTimer]);
|
|
69
|
+
const handlePressEnd = useCallback(() => {
|
|
70
|
+
clearTimer();
|
|
71
|
+
pressStartRef.current = null;
|
|
72
|
+
}, [clearTimer]);
|
|
73
|
+
const handleClickCapture = useCallback((event) => {
|
|
74
|
+
// A completed long-press leaves a trailing click — swallow it so the row
|
|
75
|
+
// action (toggle / picker) doesn't fire from a hold.
|
|
76
|
+
if (longPressFiredRef.current) {
|
|
77
|
+
event.preventDefault();
|
|
78
|
+
event.stopPropagation();
|
|
79
|
+
longPressFiredRef.current = false;
|
|
80
|
+
}
|
|
81
|
+
}, []);
|
|
82
|
+
const handleContextMenu = useCallback((event) => {
|
|
83
|
+
// Suppress the native long-press callout / right-click menu over the row.
|
|
84
|
+
event.preventDefault();
|
|
85
|
+
}, []);
|
|
86
|
+
// Position the bubble once it has mounted and can be measured. Runs before
|
|
87
|
+
// paint, so the entrance animation starts already in the right place.
|
|
88
|
+
useLayoutEffect(() => {
|
|
89
|
+
if (!open || !anchorRect || !popoverRef.current)
|
|
90
|
+
return;
|
|
91
|
+
const pop = popoverRef.current.getBoundingClientRect();
|
|
92
|
+
const vw = window.innerWidth;
|
|
93
|
+
const vh = window.innerHeight;
|
|
94
|
+
const fitsBelow = anchorRect.bottom + GAP_PX + pop.height + VIEWPORT_MARGIN_PX <= vh;
|
|
95
|
+
const placement = fitsBelow ? 'below' : 'above';
|
|
96
|
+
const top = fitsBelow
|
|
97
|
+
? anchorRect.bottom + GAP_PX
|
|
98
|
+
: anchorRect.top - GAP_PX - pop.height;
|
|
99
|
+
const left = Math.min(Math.max(anchorRect.left, VIEWPORT_MARGIN_PX), Math.max(vw - pop.width - VIEWPORT_MARGIN_PX, VIEWPORT_MARGIN_PX));
|
|
100
|
+
const arrowLeft = Math.min(Math.max(anchorRect.left + anchorRect.width / 2 - left - 5, 12), Math.max(pop.width - 22, 12));
|
|
101
|
+
setCoords({ top, left, placement, arrowLeft });
|
|
102
|
+
}, [open, anchorRect]);
|
|
103
|
+
// While open, any tap / scroll / resize / Escape dismisses the bubble. The
|
|
104
|
+
// press that opened it already fired before this listener attached, so it
|
|
105
|
+
// won't self-close.
|
|
106
|
+
useEffect(() => {
|
|
107
|
+
if (!open)
|
|
108
|
+
return;
|
|
109
|
+
const close = () => setOpen(false);
|
|
110
|
+
const onKeyDown = (event) => {
|
|
111
|
+
if (event.key === 'Escape')
|
|
112
|
+
close();
|
|
113
|
+
};
|
|
114
|
+
const auto = setTimeout(close, autoDismissMs);
|
|
115
|
+
document.addEventListener('pointerdown', close, true);
|
|
116
|
+
window.addEventListener('scroll', close, true);
|
|
117
|
+
window.addEventListener('resize', close);
|
|
118
|
+
window.addEventListener('keydown', onKeyDown);
|
|
119
|
+
return () => {
|
|
120
|
+
clearTimeout(auto);
|
|
121
|
+
document.removeEventListener('pointerdown', close, true);
|
|
122
|
+
window.removeEventListener('scroll', close, true);
|
|
123
|
+
window.removeEventListener('resize', close);
|
|
124
|
+
window.removeEventListener('keydown', onKeyDown);
|
|
125
|
+
};
|
|
126
|
+
}, [open, autoDismissMs]);
|
|
127
|
+
useEffect(() => clearTimer, [clearTimer]);
|
|
128
|
+
const transitions = useTransition(open, {
|
|
129
|
+
from: { opacity: 0, scale: 0.92 },
|
|
130
|
+
enter: { opacity: 1, scale: 1 },
|
|
131
|
+
leave: { opacity: 0, scale: 0.92 },
|
|
132
|
+
config: SPRING_RESPONSIVE,
|
|
133
|
+
});
|
|
134
|
+
return (_jsxs(TooltipWrapper, { ref: wrapperRef, onPointerDown: handlePointerDown, onPointerMove: handlePointerMove, onPointerUp: handlePressEnd, onPointerLeave: handlePressEnd, onPointerCancel: handlePressEnd, onClickCapture: handleClickCapture, onContextMenu: handleContextMenu, children: [children, createPortal(transitions((style, isOpen) => isOpen && anchorRect ? (_jsxs(TooltipPopover, { ref: popoverRef, role: "tooltip", style: {
|
|
135
|
+
top: coords?.top ?? anchorRect.bottom + GAP_PX,
|
|
136
|
+
left: coords?.left ?? anchorRect.left,
|
|
137
|
+
opacity: style.opacity,
|
|
138
|
+
transform: style.scale.to((s) => `scale(${s})`),
|
|
139
|
+
transformOrigin: coords?.placement === 'above' ? 'bottom left' : 'top left',
|
|
140
|
+
}, children: [coords && (_jsx(TooltipArrow, { "$placement": coords.placement, style: { ['--arrow-left']: `${coords.arrowLeft}px` } })), content] })) : null), document.body)] }));
|
|
141
|
+
};
|
|
142
|
+
export default LongPressTooltip;
|
|
143
|
+
//# sourceMappingURL=long-press-tooltip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"long-press-tooltip.js","sourceRoot":"","sources":["../src/long-press-tooltip.tsx"],"names":[],"mappings":";AAAA,OAAO,EAGN,WAAW,EACX,SAAS,EACT,eAAe,EACf,MAAM,EACN,QAAQ,GAGR,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAE9F,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAClC,gFAAgF;AAChF,sDAAsD;AACtD,MAAM,cAAc,GAAG,EAAE,CAAC;AAC1B,MAAM,MAAM,GAAG,CAAC,CAAC;AACjB,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAC9B,MAAM,uBAAuB,GAAG,IAAI,CAAC;AAoBrC;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,EAChC,QAAQ,EACR,OAAO,EACP,WAAW,GAAG,qBAAqB,EACnC,aAAa,GAAG,uBAAuB,GAChB,EAAgB,EAAE;IACzC,MAAM,UAAU,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAChD,MAAM,UAAU,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAChD,MAAM,QAAQ,GAAG,MAAM,CAAqB,SAAS,CAAC,CAAC;IACvD,MAAM,aAAa,GAAG,MAAM,CAAkC,IAAI,CAAC,CAAC;IACpE,2EAA2E;IAC3E,MAAM,iBAAiB,GAAG,MAAM,CAAC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